@rolster/react-components 18.14.0 → 18.15.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-L7r-Teuk.css → index-xOmRdBnF.css} +111 -146
- package/dist/cjs/index.js +626 -196
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/assets/{index-L7r-Teuk.css → index-xOmRdBnF.css} +111 -146
- package/dist/es/index.js +565 -136
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/Amount/Amount.js +1 -1
- package/dist/esm/components/atoms/Amount/Amount.js.map +1 -1
- package/dist/esm/components/atoms/Avatar/Avatar.css +1 -1
- package/dist/esm/components/atoms/Button/Button.d.ts +2 -2
- package/dist/esm/components/atoms/Input/Input.js +0 -3
- package/dist/esm/components/atoms/Input/Input.js.map +1 -1
- package/dist/esm/components/atoms/InputMoney/InputMoney.css +2 -0
- package/dist/esm/components/atoms/InputPassword/InputPassword.js +0 -3
- package/dist/esm/components/atoms/InputPassword/InputPassword.js.map +1 -1
- package/dist/esm/components/atoms/{SearchInput/SearchInput.css → InputSearch/InputSearch.css} +1 -2
- package/dist/esm/components/atoms/InputSearch/InputSearch.d.ts +9 -0
- package/dist/esm/components/atoms/{SearchInput/SearchInput.js → InputSearch/InputSearch.js} +4 -4
- package/dist/esm/components/atoms/{SearchInput/SearchInput.js.map → InputSearch/InputSearch.js.map} +1 -1
- package/dist/esm/components/atoms/Label/Label.css +6 -0
- package/dist/esm/components/atoms/Poster/Poster.css +4 -3
- package/dist/esm/components/atoms/ProgressBar/ProgressBar.css +1 -2
- package/dist/esm/components/atoms/RadioButton/RadioButton.css +0 -1
- package/dist/esm/components/atoms/Skeleton/Skeleton.css +3 -4
- package/dist/esm/components/atoms/SkeletonText/SkeletonText.css +8 -48
- package/dist/esm/components/atoms/SkeletonText/SkeletonText.js +2 -2
- package/dist/esm/components/atoms/SkeletonText/SkeletonText.js.map +1 -1
- package/dist/esm/components/atoms/TabularText/TabularText.css +5 -2
- package/dist/esm/components/atoms/index.d.ts +1 -1
- package/dist/esm/components/atoms/index.js +1 -1
- package/dist/esm/components/atoms/index.js.map +1 -1
- package/dist/esm/components/molecules/Ballot/Ballot.css +1 -1
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.d.ts +2 -2
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.js.map +1 -1
- 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/molecules/LabelCheckBox/LabelCheckBox.js +2 -2
- package/dist/esm/components/molecules/LabelCheckBox/LabelCheckBox.js.map +1 -1
- package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.js +1 -1
- package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.js.map +1 -1
- package/dist/esm/components/molecules/LabelSwitch/LabelSwitch.js +2 -2
- package/dist/esm/components/molecules/LabelSwitch/LabelSwitch.js.map +1 -1
- package/dist/esm/components/molecules/MessageFormError/MessageFormError.d.ts +7 -0
- package/dist/esm/components/molecules/MessageFormError/MessageFormError.js +6 -0
- package/dist/esm/components/molecules/MessageFormError/MessageFormError.js.map +1 -0
- package/dist/esm/components/molecules/PickerDay/PickerDay.js +3 -3
- package/dist/esm/components/molecules/PickerDay/PickerDay.js.map +1 -1
- package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.d.ts +1 -1
- package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.js +2 -2
- package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.js.map +1 -1
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js +2 -2
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js.map +1 -1
- package/dist/esm/components/molecules/PickerMonthTitle/PickerMonthTitle.js +3 -3
- package/dist/esm/components/molecules/PickerMonthTitle/PickerMonthTitle.js.map +1 -1
- package/dist/esm/components/molecules/PickerYear/PickerYear.js +2 -2
- package/dist/esm/components/molecules/PickerYear/PickerYear.js.map +1 -1
- package/dist/esm/components/molecules/index.d.ts +1 -0
- package/dist/esm/components/molecules/index.js +1 -0
- package/dist/esm/components/molecules/index.js.map +1 -1
- package/dist/esm/components/organisms/Confirmation/Confirmation.css +15 -12
- package/dist/esm/components/organisms/Confirmation/Confirmation.d.ts +1 -1
- package/dist/esm/components/organisms/Confirmation/Confirmation.js +2 -10
- package/dist/esm/components/organisms/Confirmation/Confirmation.js.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.d.ts +4 -4
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js +3 -3
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteHook.d.ts +4 -4
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteHook.js +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteHook.js.map +1 -1
- package/dist/esm/components/organisms/FieldDate/FieldDate.d.ts +1 -1
- package/dist/esm/components/organisms/FieldDate/FieldDate.js +8 -11
- package/dist/esm/components/organisms/FieldDate/FieldDate.js.map +1 -1
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.d.ts +2 -2
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js +4 -3
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js.map +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.d.ts +2 -2
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js +3 -3
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js.map +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelectHook.d.ts +2 -2
- package/dist/esm/components/organisms/FieldSelect/FieldSelectHook.js.map +1 -1
- package/dist/esm/components/organisms/PickerDate/PickerDate.d.ts +2 -2
- package/dist/esm/components/organisms/PickerDate/PickerDate.js +4 -4
- package/dist/esm/components/organisms/PickerDate/PickerDate.js.map +1 -1
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.d.ts +3 -3
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js +2 -2
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js.map +1 -1
- package/dist/esm/helpers/date-range-picker.d.ts +1 -1
- package/dist/esm/helpers/date-range-picker.js +1 -1
- package/dist/esm/helpers/date-range-picker.js.map +1 -1
- package/dist/esm/hooks/DatatableHook.js +7 -4
- package/dist/esm/hooks/DatatableHook.js.map +1 -1
- package/dist/esm/hooks/ListControlHook.d.ts +14 -12
- package/dist/esm/hooks/ListControlHook.js +34 -26
- package/dist/esm/hooks/ListControlHook.js.map +1 -1
- package/package.json +13 -10
- package/dist/esm/components/atoms/SearchInput/SearchInput.d.ts +0 -9
package/dist/cjs/index.js
CHANGED
|
@@ -2,14 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
|
-
var helpersAdvanced = require('@rolster/helpers-advanced');
|
|
6
5
|
var helpersString = require('@rolster/helpers-string');
|
|
7
|
-
var helpersDate = require('@rolster/helpers-date');
|
|
8
|
-
var ReactDOM = require('react-dom');
|
|
9
6
|
var i18n = require('@rolster/i18n');
|
|
10
|
-
var
|
|
7
|
+
var ReactDOM = require('react-dom');
|
|
11
8
|
require('uuid');
|
|
12
|
-
|
|
9
|
+
|
|
10
|
+
function currencyFormat(currency) {
|
|
11
|
+
const { value, decimals, symbol } = currency;
|
|
12
|
+
const [integer, decimal] = Math.abs(value).toString().split('.');
|
|
13
|
+
let result = '';
|
|
14
|
+
let count = 0;
|
|
15
|
+
for (let i = 1; i <= integer.length; i++) {
|
|
16
|
+
const index = integer.length - i;
|
|
17
|
+
if (count === 3) {
|
|
18
|
+
count = 0;
|
|
19
|
+
result = `.${result}`;
|
|
20
|
+
}
|
|
21
|
+
count++;
|
|
22
|
+
result = `${integer.charAt(index)}${result}`;
|
|
23
|
+
}
|
|
24
|
+
if (decimals && decimal) {
|
|
25
|
+
result = `${result},${decimal.slice(0, 2)}`;
|
|
26
|
+
}
|
|
27
|
+
if (value < 0) {
|
|
28
|
+
result = `-${result}`;
|
|
29
|
+
}
|
|
30
|
+
return symbol ? `${symbol} ${result}` : result;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
class PartialSealed {
|
|
34
|
+
constructor(key, value) {
|
|
35
|
+
this.key = key;
|
|
36
|
+
this.value = value;
|
|
37
|
+
}
|
|
38
|
+
otherwise(otherwise) {
|
|
39
|
+
this.sealedOtherwise = otherwise;
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
when(resolver, whenOtherwise) {
|
|
43
|
+
const handler = resolver[this.key];
|
|
44
|
+
const otherwise = whenOtherwise || this.sealedOtherwise;
|
|
45
|
+
if (otherwise) {
|
|
46
|
+
otherwise();
|
|
47
|
+
}
|
|
48
|
+
return handler ? handler(this.value) : undefined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function itIsDefined(object) {
|
|
53
|
+
return typeof object !== 'undefined' && object !== null;
|
|
54
|
+
}
|
|
13
55
|
|
|
14
56
|
const baseCls = 'rls-tabular-text';
|
|
15
57
|
const pointers = ['.', ','];
|
|
@@ -21,7 +63,7 @@ function RlsTabularText({ value }) {
|
|
|
21
63
|
}
|
|
22
64
|
|
|
23
65
|
function RlsAmount({ value, decimals, rlsTheme, symbol }) {
|
|
24
|
-
return (jsxRuntime.jsxs("div", { className: "rls-amount", "rls-theme": rlsTheme, children: [symbol && jsxRuntime.jsx("span", { children: symbol }), jsxRuntime.jsx(RlsTabularText, { value:
|
|
66
|
+
return (jsxRuntime.jsxs("div", { className: "rls-amount", "rls-theme": rlsTheme, children: [symbol && jsxRuntime.jsx("span", { children: symbol }), jsxRuntime.jsx(RlsTabularText, { value: currencyFormat({ value, decimals }) })] }));
|
|
25
67
|
}
|
|
26
68
|
|
|
27
69
|
function renderClassStatus(base, status = {}, aditionals) {
|
|
@@ -88,9 +130,6 @@ function RlsInput({ children, disabled, formControl, placeholder, type, value, o
|
|
|
88
130
|
setFocused(true);
|
|
89
131
|
}
|
|
90
132
|
function onBlur() {
|
|
91
|
-
if (formControl && !formControl.touched) {
|
|
92
|
-
formControl.touch();
|
|
93
|
-
}
|
|
94
133
|
formControl?.blur();
|
|
95
134
|
setFocused(false);
|
|
96
135
|
}
|
|
@@ -139,9 +178,6 @@ function RlsInputPassword({ disabled, formControl, placeholder, type, onValue })
|
|
|
139
178
|
setFocused(true);
|
|
140
179
|
}
|
|
141
180
|
function onBlur() {
|
|
142
|
-
if (formControl && !formControl.touched) {
|
|
143
|
-
formControl.touch();
|
|
144
|
-
}
|
|
145
181
|
formControl?.blur();
|
|
146
182
|
setFocused(false);
|
|
147
183
|
}
|
|
@@ -151,6 +187,10 @@ function RlsInputPassword({ disabled, formControl, placeholder, type, onValue })
|
|
|
151
187
|
}), children: jsxRuntime.jsx("input", { className: "rls-input-password__component", autoComplete: "off", type: type || 'password', placeholder: placeholder, disabled: disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange }) }));
|
|
152
188
|
}
|
|
153
189
|
|
|
190
|
+
function RlsInputSearch({ formControl, placeholder, onSearch }) {
|
|
191
|
+
return (jsxRuntime.jsxs("div", { className: "rls-input-search", children: [jsxRuntime.jsx(RlsInput, { formControl: formControl, placeholder: placeholder }), onSearch && jsxRuntime.jsx(RlsButtonAction, { icon: "search", onClick: onSearch })] }));
|
|
192
|
+
}
|
|
193
|
+
|
|
154
194
|
function RlsInputText({ disabled, formControl, placeholder, value, onValue }) {
|
|
155
195
|
const [valueInput, setValueInput] = react.useState(value || '');
|
|
156
196
|
function onText(value) {
|
|
@@ -188,16 +228,12 @@ function RlsRadioButton({ checked, disabled, rlsTheme, onClick }) {
|
|
|
188
228
|
return (jsxRuntime.jsx("div", { className: renderClassStatus('rls-radiobutton', { checked, disabled }), onClick: onClick, "rls-theme": rlsTheme, children: jsxRuntime.jsx("div", { className: "rls-radiobutton__component" }) }));
|
|
189
229
|
}
|
|
190
230
|
|
|
191
|
-
function RlsSearchInput({ formControl, placeholder, onSearch }) {
|
|
192
|
-
return (jsxRuntime.jsxs("div", { className: "rls-search-input", children: [jsxRuntime.jsx(RlsInput, { formControl: formControl, placeholder: placeholder }), onSearch && jsxRuntime.jsx(RlsButtonAction, { icon: "search", onClick: onSearch })] }));
|
|
193
|
-
}
|
|
194
|
-
|
|
195
231
|
function RlsSkeleton({ rlsTheme }) {
|
|
196
232
|
return jsxRuntime.jsx("div", { className: "rls-skeleton", "rls-theme": rlsTheme });
|
|
197
233
|
}
|
|
198
234
|
|
|
199
235
|
function RlsSkeletonText({ active, children, rlsTheme }) {
|
|
200
|
-
return (jsxRuntime.jsx("div", { className:
|
|
236
|
+
return (jsxRuntime.jsx("div", { className: "rls-skeleton-text", "rls-theme": rlsTheme, children: active ? (jsxRuntime.jsx(RlsSkeleton, {})) : (jsxRuntime.jsx("span", { className: "rls-skeleton-text__value", children: children })) }));
|
|
201
237
|
}
|
|
202
238
|
|
|
203
239
|
function RlsSwitch({ checked, disabled, rlsTheme, onClick }) {
|
|
@@ -249,12 +285,16 @@ function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsThem
|
|
|
249
285
|
}), children: jsxRuntime.jsx("ul", { children: options.map((action, index) => (jsxRuntime.jsx("li", { className: "truncate", onClick: () => onSelectAction(action), children: action.label }, index))) }) })] }));
|
|
250
286
|
}
|
|
251
287
|
|
|
288
|
+
function RlsMessageFormError({ className, formControl }) {
|
|
289
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: formControl?.wrong && (jsxRuntime.jsx("div", { className: className, children: jsxRuntime.jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl?.error?.message }) })) }));
|
|
290
|
+
}
|
|
291
|
+
|
|
252
292
|
function RlsFieldMoney({ children, decimals, disabled, formControl, placeholder, symbol, rlsTheme, value, onValue }) {
|
|
253
293
|
return (jsxRuntime.jsxs("div", { className: renderClassStatus('rls-field-box', {
|
|
254
294
|
focused: formControl?.focused,
|
|
255
295
|
error: formControl?.wrong,
|
|
256
296
|
disabled: formControl?.disabled || disabled
|
|
257
|
-
}, 'rls-field-money'), "rls-theme": rlsTheme, children: [children && jsxRuntime.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntime.jsx("div", { className: "rls-field-box__component", children: jsxRuntime.jsx("div", { className: "rls-field-box__body", children: jsxRuntime.jsx(RlsInputMoney, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, symbol: symbol, decimals: decimals, onValue: onValue }) }) }),
|
|
297
|
+
}, 'rls-field-money'), "rls-theme": rlsTheme, children: [children && jsxRuntime.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntime.jsx("div", { className: "rls-field-box__component", children: jsxRuntime.jsx("div", { className: "rls-field-box__body", children: jsxRuntime.jsx(RlsInputMoney, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, symbol: symbol, decimals: decimals, onValue: onValue }) }) }), jsxRuntime.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
|
|
258
298
|
}
|
|
259
299
|
|
|
260
300
|
function RlsFieldNumber({ children, disabled, formControl, placeholder, rlsTheme, value, onValue }) {
|
|
@@ -262,7 +302,7 @@ function RlsFieldNumber({ children, disabled, formControl, placeholder, rlsTheme
|
|
|
262
302
|
focused: formControl?.focused,
|
|
263
303
|
error: formControl?.wrong,
|
|
264
304
|
disabled: formControl?.disabled || disabled
|
|
265
|
-
}, 'rls-field-number'), "rls-theme": rlsTheme, children: [children && jsxRuntime.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntime.jsx("div", { className: "rls-field-box__component", children: jsxRuntime.jsx("div", { className: "rls-field-box__body", children: jsxRuntime.jsx(RlsInputNumber, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }),
|
|
305
|
+
}, 'rls-field-number'), "rls-theme": rlsTheme, children: [children && jsxRuntime.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntime.jsx("div", { className: "rls-field-box__component", children: jsxRuntime.jsx("div", { className: "rls-field-box__body", children: jsxRuntime.jsx(RlsInputNumber, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), jsxRuntime.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
|
|
266
306
|
}
|
|
267
307
|
|
|
268
308
|
function RlsFieldPassword({ children, disabled, formControl, placeholder, rlsTheme }) {
|
|
@@ -274,7 +314,7 @@ function RlsFieldPassword({ children, disabled, formControl, placeholder, rlsThe
|
|
|
274
314
|
focused: formControl?.focused,
|
|
275
315
|
error: formControl?.wrong,
|
|
276
316
|
disabled: formControl?.disabled || disabled
|
|
277
|
-
}, 'rls-field-password'), "rls-theme": rlsTheme, children: [children && jsxRuntime.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntime.jsx("div", { className: "rls-field-box__component", children: jsxRuntime.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntime.jsx(RlsInputPassword, { formControl: formControl, disabled: disabled, placeholder: placeholder, type: password ? 'password' : 'text' }), jsxRuntime.jsx(RlsButtonAction, { icon: password ? 'eye' : 'eye-off', onClick: onToggleInput })] }) }),
|
|
317
|
+
}, 'rls-field-password'), "rls-theme": rlsTheme, children: [children && jsxRuntime.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntime.jsx("div", { className: "rls-field-box__component", children: jsxRuntime.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntime.jsx(RlsInputPassword, { formControl: formControl, disabled: disabled, placeholder: placeholder, type: password ? 'password' : 'text' }), jsxRuntime.jsx(RlsButtonAction, { icon: password ? 'eye' : 'eye-off', onClick: onToggleInput })] }) }), jsxRuntime.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
|
|
278
318
|
}
|
|
279
319
|
|
|
280
320
|
function RlsFieldText({ children, disabled, formControl, placeholder, rlsTheme, value, onValue }) {
|
|
@@ -282,13 +322,13 @@ function RlsFieldText({ children, disabled, formControl, placeholder, rlsTheme,
|
|
|
282
322
|
focused: formControl?.focused,
|
|
283
323
|
error: formControl?.wrong,
|
|
284
324
|
disabled: formControl?.disabled || disabled
|
|
285
|
-
}, 'rls-field-text'), "rls-theme": rlsTheme, children: [children && jsxRuntime.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntime.jsx("div", { className: "rls-field-box__component", children: jsxRuntime.jsx("div", { className: "rls-field-box__body", children: jsxRuntime.jsx(RlsInputText, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }),
|
|
325
|
+
}, 'rls-field-text'), "rls-theme": rlsTheme, children: [children && jsxRuntime.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntime.jsx("div", { className: "rls-field-box__component", children: jsxRuntime.jsx("div", { className: "rls-field-box__body", children: jsxRuntime.jsx(RlsInputText, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), jsxRuntime.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
|
|
286
326
|
}
|
|
287
327
|
|
|
288
328
|
function RlsLabelCheckBox({ children, disabled, extended, formControl, rlsTheme }) {
|
|
289
|
-
const [checked, setChecked] = react.useState(formControl?.
|
|
329
|
+
const [checked, setChecked] = react.useState(!!formControl?.state);
|
|
290
330
|
react.useEffect(() => {
|
|
291
|
-
setChecked(formControl?.state
|
|
331
|
+
setChecked(!!formControl?.state);
|
|
292
332
|
}, [formControl?.state]);
|
|
293
333
|
function onToggle() {
|
|
294
334
|
if (formControl) {
|
|
@@ -305,7 +345,7 @@ function RlsLabelCheckBox({ children, disabled, extended, formControl, rlsTheme
|
|
|
305
345
|
}
|
|
306
346
|
|
|
307
347
|
function RlsLabelRadioButton({ children, disabled, extended, formControl, rlsTheme, value }) {
|
|
308
|
-
const [checked, setChecked] = react.useState(formControl?.state
|
|
348
|
+
const [checked, setChecked] = react.useState(formControl?.state === value);
|
|
309
349
|
react.useEffect(() => {
|
|
310
350
|
setChecked(formControl?.state === value);
|
|
311
351
|
}, [formControl?.state]);
|
|
@@ -321,9 +361,9 @@ function RlsLabelRadioButton({ children, disabled, extended, formControl, rlsThe
|
|
|
321
361
|
}
|
|
322
362
|
|
|
323
363
|
function RlsLabelSwitch({ children, disabled, extended, formControl, rlsTheme }) {
|
|
324
|
-
const [checked, setChecked] = react.useState(formControl?.
|
|
364
|
+
const [checked, setChecked] = react.useState(!!formControl?.state);
|
|
325
365
|
react.useEffect(() => {
|
|
326
|
-
setChecked(formControl?.state
|
|
366
|
+
setChecked(!!formControl?.state);
|
|
327
367
|
}, [formControl?.state]);
|
|
328
368
|
function onToggle() {
|
|
329
369
|
if (formControl) {
|
|
@@ -549,13 +589,374 @@ function RlsPagination({ elements, count: defaultCount, filter, onElements, onPa
|
|
|
549
589
|
}) }), jsxRuntime.jsx("div", { className: "rls-pagination__description", children: description }), jsxRuntime.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntime.jsx("button", { className: "rls-pagination__action", onClick: goNextPagination, disabled: lastPage, children: jsxRuntime.jsx(RlsIcon, { value: "arrow-ios-right" }) }), jsxRuntime.jsx("button", { className: "rls-pagination__action", onClick: goLastPagination, disabled: lastPage, children: jsxRuntime.jsx(RlsIcon, { value: "arrowhead-right" }) })] })] }));
|
|
550
590
|
}
|
|
551
591
|
|
|
592
|
+
const dateI18n = i18n.i18n({
|
|
593
|
+
es: {
|
|
594
|
+
// Months
|
|
595
|
+
january: 'Enero',
|
|
596
|
+
february: 'Febrero',
|
|
597
|
+
march: 'Marzo',
|
|
598
|
+
april: 'Abril',
|
|
599
|
+
may: 'Mayo',
|
|
600
|
+
june: 'Junio',
|
|
601
|
+
july: 'Julio',
|
|
602
|
+
august: 'Agosto',
|
|
603
|
+
september: 'Septiembre',
|
|
604
|
+
october: 'Octubre',
|
|
605
|
+
november: 'Noviembre',
|
|
606
|
+
december: 'Diciembre',
|
|
607
|
+
// Days
|
|
608
|
+
monday: 'Lunes',
|
|
609
|
+
tuesday: 'Martes',
|
|
610
|
+
wednesday: 'Miércoles',
|
|
611
|
+
thursday: 'Jueves',
|
|
612
|
+
friday: 'Viernes',
|
|
613
|
+
saturday: 'Sábado',
|
|
614
|
+
sunday: 'Domingo',
|
|
615
|
+
// Timestamps
|
|
616
|
+
year: 'año',
|
|
617
|
+
month: 'mes',
|
|
618
|
+
week: 'semana',
|
|
619
|
+
day: 'día',
|
|
620
|
+
hour: 'hora',
|
|
621
|
+
minute: 'minuto',
|
|
622
|
+
second: 'segundo'
|
|
623
|
+
},
|
|
624
|
+
en: {
|
|
625
|
+
// Months
|
|
626
|
+
january: 'January',
|
|
627
|
+
february: 'February',
|
|
628
|
+
march: 'March',
|
|
629
|
+
april: 'April',
|
|
630
|
+
may: 'May',
|
|
631
|
+
june: 'June',
|
|
632
|
+
july: 'July',
|
|
633
|
+
august: 'August',
|
|
634
|
+
september: 'September',
|
|
635
|
+
october: 'October',
|
|
636
|
+
november: 'November',
|
|
637
|
+
december: 'December',
|
|
638
|
+
// Days
|
|
639
|
+
monday: 'Monday',
|
|
640
|
+
tuesday: 'Tuesday',
|
|
641
|
+
wednesday: 'Wednesday',
|
|
642
|
+
thursday: 'Thursday',
|
|
643
|
+
friday: 'Friday',
|
|
644
|
+
saturday: 'Saturday',
|
|
645
|
+
sunday: 'Sunday',
|
|
646
|
+
// Timestamps
|
|
647
|
+
year: 'year',
|
|
648
|
+
month: 'month',
|
|
649
|
+
week: 'week',
|
|
650
|
+
day: 'day',
|
|
651
|
+
hour: 'hour',
|
|
652
|
+
minute: 'minute',
|
|
653
|
+
second: 'second'
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
var Miliseconds;
|
|
658
|
+
(function (Miliseconds) {
|
|
659
|
+
Miliseconds[Miliseconds["Year"] = 31536000000] = "Year";
|
|
660
|
+
Miliseconds[Miliseconds["Month"] = 2592000000] = "Month";
|
|
661
|
+
Miliseconds[Miliseconds["Week"] = 604800000] = "Week";
|
|
662
|
+
Miliseconds[Miliseconds["Day"] = 86400000] = "Day";
|
|
663
|
+
Miliseconds[Miliseconds["Hour"] = 3600000] = "Hour";
|
|
664
|
+
Miliseconds[Miliseconds["Minute"] = 60000] = "Minute";
|
|
665
|
+
Miliseconds[Miliseconds["Second"] = 1000] = "Second";
|
|
666
|
+
})(Miliseconds || (Miliseconds = {}));
|
|
667
|
+
var Day;
|
|
668
|
+
(function (Day) {
|
|
669
|
+
Day[Day["Sunday"] = 0] = "Sunday";
|
|
670
|
+
Day[Day["Monday"] = 1] = "Monday";
|
|
671
|
+
Day[Day["Tuesday"] = 2] = "Tuesday";
|
|
672
|
+
Day[Day["Wednesday"] = 3] = "Wednesday";
|
|
673
|
+
Day[Day["Thursday"] = 4] = "Thursday";
|
|
674
|
+
Day[Day["Friday"] = 5] = "Friday";
|
|
675
|
+
Day[Day["Saturday"] = 6] = "Saturday";
|
|
676
|
+
})(Day || (Day = {}));
|
|
677
|
+
var Month;
|
|
678
|
+
(function (Month) {
|
|
679
|
+
Month[Month["January"] = 0] = "January";
|
|
680
|
+
Month[Month["February"] = 1] = "February";
|
|
681
|
+
Month[Month["March"] = 2] = "March";
|
|
682
|
+
Month[Month["April"] = 3] = "April";
|
|
683
|
+
Month[Month["May"] = 4] = "May";
|
|
684
|
+
Month[Month["June"] = 5] = "June";
|
|
685
|
+
Month[Month["July"] = 6] = "July";
|
|
686
|
+
Month[Month["August"] = 7] = "August";
|
|
687
|
+
Month[Month["September"] = 8] = "September";
|
|
688
|
+
Month[Month["October"] = 9] = "October";
|
|
689
|
+
Month[Month["November"] = 10] = "November";
|
|
690
|
+
Month[Month["December"] = 11] = "December";
|
|
691
|
+
})(Month || (Month = {}));
|
|
692
|
+
var MonthDay;
|
|
693
|
+
(function (MonthDay) {
|
|
694
|
+
MonthDay[MonthDay["January"] = 31] = "January";
|
|
695
|
+
MonthDay[MonthDay["February"] = 28] = "February";
|
|
696
|
+
MonthDay[MonthDay["March"] = 31] = "March";
|
|
697
|
+
MonthDay[MonthDay["April"] = 30] = "April";
|
|
698
|
+
MonthDay[MonthDay["May"] = 31] = "May";
|
|
699
|
+
MonthDay[MonthDay["June"] = 30] = "June";
|
|
700
|
+
MonthDay[MonthDay["July"] = 31] = "July";
|
|
701
|
+
MonthDay[MonthDay["August"] = 31] = "August";
|
|
702
|
+
MonthDay[MonthDay["September"] = 30] = "September";
|
|
703
|
+
MonthDay[MonthDay["October"] = 31] = "October";
|
|
704
|
+
MonthDay[MonthDay["November"] = 30] = "November";
|
|
705
|
+
MonthDay[MonthDay["December"] = 31] = "December";
|
|
706
|
+
})(MonthDay || (MonthDay = {}));
|
|
707
|
+
|
|
708
|
+
let MONTH_NAMES_I18N = [];
|
|
709
|
+
let MONTH_LABELS_I18N = [];
|
|
710
|
+
let DAY_NAMES_I18N = [];
|
|
711
|
+
let DAY_LABELS_I18N = [];
|
|
712
|
+
function loadI18n(language = 'es') {
|
|
713
|
+
MONTH_NAMES_I18N = [
|
|
714
|
+
dateI18n('january', { language }),
|
|
715
|
+
dateI18n('february', { language }),
|
|
716
|
+
dateI18n('march', { language }),
|
|
717
|
+
dateI18n('april', { language }),
|
|
718
|
+
dateI18n('may', { language }),
|
|
719
|
+
dateI18n('june', { language }),
|
|
720
|
+
dateI18n('july', { language }),
|
|
721
|
+
dateI18n('august', { language }),
|
|
722
|
+
dateI18n('september', { language }),
|
|
723
|
+
dateI18n('october', { language }),
|
|
724
|
+
dateI18n('november', { language }),
|
|
725
|
+
dateI18n('december', { language })
|
|
726
|
+
];
|
|
727
|
+
MONTH_LABELS_I18N = MONTH_NAMES_I18N.map((name) => name.substring(0, 3));
|
|
728
|
+
DAY_NAMES_I18N = [
|
|
729
|
+
dateI18n('sunday', { language }),
|
|
730
|
+
dateI18n('monday', { language }),
|
|
731
|
+
dateI18n('tuesday', { language }),
|
|
732
|
+
dateI18n('wednesday', { language }),
|
|
733
|
+
dateI18n('thursday', { language }),
|
|
734
|
+
dateI18n('friday', { language }),
|
|
735
|
+
dateI18n('saturday', { language })
|
|
736
|
+
];
|
|
737
|
+
DAY_LABELS_I18N = DAY_NAMES_I18N.map((name) => name.substring(0, 3));
|
|
738
|
+
}
|
|
739
|
+
function isNumber(value) {
|
|
740
|
+
return value !== undefined && value !== null;
|
|
741
|
+
}
|
|
742
|
+
loadI18n();
|
|
743
|
+
i18n.i18nSubscribe((language) => loadI18n(language));
|
|
744
|
+
const MONTH_DAYS = [
|
|
745
|
+
MonthDay.January,
|
|
746
|
+
MonthDay.February,
|
|
747
|
+
MonthDay.March,
|
|
748
|
+
MonthDay.April,
|
|
749
|
+
MonthDay.May,
|
|
750
|
+
MonthDay.June,
|
|
751
|
+
MonthDay.July,
|
|
752
|
+
MonthDay.August,
|
|
753
|
+
MonthDay.September,
|
|
754
|
+
MonthDay.October,
|
|
755
|
+
MonthDay.November,
|
|
756
|
+
MonthDay.December
|
|
757
|
+
];
|
|
758
|
+
function MONTH_NAMES(index) {
|
|
759
|
+
return isNumber(index) ? MONTH_NAMES_I18N[index] || '' : MONTH_NAMES_I18N;
|
|
760
|
+
}
|
|
761
|
+
function MONTH_LABELS(index) {
|
|
762
|
+
return isNumber(index) ? MONTH_LABELS_I18N[index] || '' : MONTH_LABELS_I18N;
|
|
763
|
+
}
|
|
764
|
+
function DAY_NAMES(index) {
|
|
765
|
+
return isNumber(index) ? DAY_NAMES_I18N[index] || '' : DAY_NAMES_I18N;
|
|
766
|
+
}
|
|
767
|
+
function DAY_LABELS(index) {
|
|
768
|
+
return isNumber(index) ? DAY_LABELS_I18N[index] || '' : DAY_LABELS_I18N;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
function completFormat(value, size) {
|
|
772
|
+
return value.toString().padStart(size, '0');
|
|
773
|
+
}
|
|
774
|
+
function hourFormat(date) {
|
|
775
|
+
const hour = date.getHours();
|
|
776
|
+
return hour > 12 ? hour - 12 : hour === 0 ? 12 : hour;
|
|
777
|
+
}
|
|
778
|
+
function verifyDayInYear(date, year) {
|
|
779
|
+
const days = getDaysOfMonth(year, date.getMonth());
|
|
780
|
+
if (days < date.getDate()) {
|
|
781
|
+
date.setDate(days);
|
|
782
|
+
}
|
|
783
|
+
date.setFullYear(year); // Establecer el año
|
|
784
|
+
}
|
|
785
|
+
function verifyDayInMonth(date, month) {
|
|
786
|
+
const days = getDaysOfMonth(date.getFullYear(), month);
|
|
787
|
+
if (days < date.getDate()) {
|
|
788
|
+
date.setDate(days);
|
|
789
|
+
}
|
|
790
|
+
date.setMonth(month); // Establecer el mes
|
|
791
|
+
}
|
|
792
|
+
const formatters = {
|
|
793
|
+
dd: (date) => {
|
|
794
|
+
return completFormat(date.getDate(), 2);
|
|
795
|
+
},
|
|
796
|
+
dw: (date) => {
|
|
797
|
+
return DAY_NAMES()[date.getDay()];
|
|
798
|
+
},
|
|
799
|
+
dx: (date) => {
|
|
800
|
+
return DAY_NAMES()[date.getDay()];
|
|
801
|
+
},
|
|
802
|
+
mm: (date) => {
|
|
803
|
+
return completFormat(date.getMonth() + 1, 2);
|
|
804
|
+
},
|
|
805
|
+
mn: (date) => {
|
|
806
|
+
return MONTH_NAMES(date.getMonth());
|
|
807
|
+
},
|
|
808
|
+
mx: (date) => {
|
|
809
|
+
return MONTH_LABELS(date.getMonth());
|
|
810
|
+
},
|
|
811
|
+
aa: (date) => {
|
|
812
|
+
return completFormat(date.getFullYear(), 4);
|
|
813
|
+
},
|
|
814
|
+
hh: (date) => {
|
|
815
|
+
return completFormat(date.getHours(), 2);
|
|
816
|
+
},
|
|
817
|
+
ii: (date) => {
|
|
818
|
+
return completFormat(date.getMinutes(), 2);
|
|
819
|
+
},
|
|
820
|
+
ss: (date) => {
|
|
821
|
+
return completFormat(date.getSeconds(), 2);
|
|
822
|
+
},
|
|
823
|
+
hz: (date) => {
|
|
824
|
+
return completFormat(hourFormat(date), 2);
|
|
825
|
+
},
|
|
826
|
+
zz: (date) => {
|
|
827
|
+
return date.getHours() > 11 ? 'PM' : 'AM';
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
const createElapsedTime = (value, single, charPlural = 's', plural) => {
|
|
831
|
+
plural = plural || `${single}${charPlural}`;
|
|
832
|
+
const label = `${single}(${charPlural})`;
|
|
833
|
+
return {
|
|
834
|
+
value,
|
|
835
|
+
label,
|
|
836
|
+
single,
|
|
837
|
+
plural
|
|
838
|
+
};
|
|
839
|
+
};
|
|
840
|
+
[
|
|
841
|
+
createElapsedTime(Miliseconds.Year, 'año'),
|
|
842
|
+
createElapsedTime(Miliseconds.Month, 'mes', 'es'),
|
|
843
|
+
createElapsedTime(Miliseconds.Week, 'semana'),
|
|
844
|
+
createElapsedTime(Miliseconds.Day, 'día', 's', 'dias'),
|
|
845
|
+
createElapsedTime(Miliseconds.Hour, 'hora'),
|
|
846
|
+
createElapsedTime(Miliseconds.Minute, 'minuto'),
|
|
847
|
+
createElapsedTime(Miliseconds.Second, 'segundo')
|
|
848
|
+
];
|
|
849
|
+
function getDateWeight(date) {
|
|
850
|
+
return date.getFullYear() * 365 + (date.getMonth() + 1) * 30 + date.getDate();
|
|
851
|
+
}
|
|
852
|
+
function dateIsEquals(date, compare = new Date()) {
|
|
853
|
+
return date.getTime() === compare.getTime();
|
|
854
|
+
}
|
|
855
|
+
function dateIsEqualsWeight(date, compare = new Date()) {
|
|
856
|
+
return getDateWeight(date) === getDateWeight(compare);
|
|
857
|
+
}
|
|
858
|
+
function dateIsBefore(date, compare = new Date()) {
|
|
859
|
+
return date.getTime() > compare.getTime();
|
|
860
|
+
}
|
|
861
|
+
function dateIsAfter(date, compare = new Date()) {
|
|
862
|
+
return date.getTime() < compare.getTime();
|
|
863
|
+
}
|
|
864
|
+
function dateIsBetween(minDate, maxDate, compare = new Date()) {
|
|
865
|
+
return dateIsAfter(minDate, compare) && dateIsBefore(maxDate, compare);
|
|
866
|
+
}
|
|
867
|
+
function getTimeDifference(date, compare = new Date()) {
|
|
868
|
+
return date.getTime() - compare.getTime();
|
|
869
|
+
}
|
|
870
|
+
function normalizeMinTime(date) {
|
|
871
|
+
const normalize = new Date(date.getTime());
|
|
872
|
+
normalize.setHours(0);
|
|
873
|
+
normalize.setMinutes(0);
|
|
874
|
+
normalize.setSeconds(0);
|
|
875
|
+
normalize.setMilliseconds(0);
|
|
876
|
+
return normalize;
|
|
877
|
+
}
|
|
878
|
+
function normalizeMaxTime(date) {
|
|
879
|
+
const normalize = new Date(date.getTime());
|
|
880
|
+
normalize.setHours(23);
|
|
881
|
+
normalize.setMinutes(59);
|
|
882
|
+
normalize.setSeconds(59);
|
|
883
|
+
normalize.setMilliseconds(0);
|
|
884
|
+
return normalize;
|
|
885
|
+
}
|
|
886
|
+
function getDaysOfMonth(year, month) {
|
|
887
|
+
return month === 1 && isLeapYear(year) ? 29 : MONTH_DAYS[month];
|
|
888
|
+
}
|
|
889
|
+
function isLeapYear(value) {
|
|
890
|
+
const year = value instanceof Date ? value.getFullYear() : value;
|
|
891
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
892
|
+
}
|
|
893
|
+
const regInterpolation = /{([^{}]*)}/g;
|
|
894
|
+
function dateFormatTemplate(date, template) {
|
|
895
|
+
return template.replace(regInterpolation, (value, key) => formatters[key] ? formatters[key](date) : value);
|
|
896
|
+
}
|
|
897
|
+
function assignYearInDate(date, year) {
|
|
898
|
+
const newDate = new Date(date.getTime());
|
|
899
|
+
verifyDayInYear(newDate, year);
|
|
900
|
+
newDate.setFullYear(year);
|
|
901
|
+
return newDate;
|
|
902
|
+
}
|
|
903
|
+
function assignMonthInDate(date, month) {
|
|
904
|
+
const newDate = new Date(date.getTime());
|
|
905
|
+
verifyDayInMonth(newDate, month);
|
|
906
|
+
newDate.setMonth(month);
|
|
907
|
+
return newDate;
|
|
908
|
+
}
|
|
909
|
+
function assignDayInDate(date, day) {
|
|
910
|
+
const newDate = new Date(date.getTime());
|
|
911
|
+
newDate.setDate(day);
|
|
912
|
+
return newDate;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
class DateRange {
|
|
916
|
+
constructor(minDate, maxDate) {
|
|
917
|
+
this.minDate = normalizeMinTime(minDate);
|
|
918
|
+
this.maxDate =
|
|
919
|
+
maxDate && dateIsBefore(maxDate, minDate)
|
|
920
|
+
? normalizeMinTime(maxDate)
|
|
921
|
+
: normalizeMinTime(minDate);
|
|
922
|
+
}
|
|
923
|
+
get minISOFormat() {
|
|
924
|
+
return this.minDate.toISOString();
|
|
925
|
+
}
|
|
926
|
+
get maxISOFormat() {
|
|
927
|
+
return this.maxDate.toISOString();
|
|
928
|
+
}
|
|
929
|
+
between(date) {
|
|
930
|
+
return dateIsBetween(this.minDate, this.maxDate, date);
|
|
931
|
+
}
|
|
932
|
+
equals({ maxDate, minDate }) {
|
|
933
|
+
return dateIsEquals(this.minDate, minDate) && dateIsEquals(this.maxDate, maxDate);
|
|
934
|
+
}
|
|
935
|
+
recalculate(date) {
|
|
936
|
+
if (dateIsBefore(this.minDate, date)) {
|
|
937
|
+
return new DateRange(date, this.maxDate);
|
|
938
|
+
}
|
|
939
|
+
if (dateIsAfter(this.maxDate, date)) {
|
|
940
|
+
return new DateRange(this.minDate, date);
|
|
941
|
+
}
|
|
942
|
+
const minDifference = getTimeDifference(date, this.minDate);
|
|
943
|
+
const maxDifference = getTimeDifference(this.maxDate, date);
|
|
944
|
+
return minDifference > maxDifference
|
|
945
|
+
? new DateRange(this.minDate, date)
|
|
946
|
+
: new DateRange(date, this.maxDate);
|
|
947
|
+
}
|
|
948
|
+
static now() {
|
|
949
|
+
return new DateRange(new Date());
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
|
|
552
953
|
function dateIsOutRangeMin(props) {
|
|
553
954
|
const { date, minDate } = props;
|
|
554
|
-
return !!minDate &&
|
|
955
|
+
return !!minDate && dateIsBefore(normalizeMinTime(minDate), date);
|
|
555
956
|
}
|
|
556
957
|
function dateIsOutRangeMax(props) {
|
|
557
958
|
const { date, maxDate } = props;
|
|
558
|
-
return !!maxDate &&
|
|
959
|
+
return !!maxDate && dateIsAfter(normalizeMaxTime(maxDate), date);
|
|
559
960
|
}
|
|
560
961
|
function dateOutRange(props) {
|
|
561
962
|
return dateIsOutRangeMin(props) || dateIsOutRangeMax(props);
|
|
@@ -579,8 +980,8 @@ function createDayState(props, today, value) {
|
|
|
579
980
|
disabled: dayIsOutside(props, value || 0),
|
|
580
981
|
focused: !!value && day === value,
|
|
581
982
|
forbidden: !value,
|
|
582
|
-
selected: !!dateValue &&
|
|
583
|
-
today: !!dateValue &&
|
|
983
|
+
selected: !!dateValue && dateIsEqualsWeight(date, dateValue),
|
|
984
|
+
today: !!dateValue && dateIsEqualsWeight(today, dateValue),
|
|
584
985
|
value
|
|
585
986
|
};
|
|
586
987
|
}
|
|
@@ -605,7 +1006,7 @@ function createDaysPending$1(props, today, days) {
|
|
|
605
1006
|
return daysPending;
|
|
606
1007
|
}
|
|
607
1008
|
function createNextWeeks$1(props, date, today) {
|
|
608
|
-
const daysMonth =
|
|
1009
|
+
const daysMonth = getDaysOfMonth(date.getFullYear(), date.getMonth());
|
|
609
1010
|
const weeks = [];
|
|
610
1011
|
let days = [];
|
|
611
1012
|
let countDays = 1;
|
|
@@ -630,13 +1031,13 @@ function createNextWeeks$1(props, date, today) {
|
|
|
630
1031
|
function dayIsOutsideMin(props, day) {
|
|
631
1032
|
const { month, year, minDate } = props;
|
|
632
1033
|
return minDate
|
|
633
|
-
?
|
|
1034
|
+
? getDateWeight(new Date(year, month, day)) < getDateWeight(minDate)
|
|
634
1035
|
: false;
|
|
635
1036
|
}
|
|
636
1037
|
function dayIsOutsideMax(props, day) {
|
|
637
1038
|
const { month, year, maxDate } = props;
|
|
638
1039
|
return maxDate
|
|
639
|
-
?
|
|
1040
|
+
? getDateWeight(new Date(year, month, day)) > getDateWeight(maxDate)
|
|
640
1041
|
: false;
|
|
641
1042
|
}
|
|
642
1043
|
function dayIsOutside(props, day) {
|
|
@@ -671,7 +1072,7 @@ function rangeIsSelected({ range }, base, day) {
|
|
|
671
1072
|
dateIsSelected(base, range.maxDate, day));
|
|
672
1073
|
}
|
|
673
1074
|
function dayIsRange({ range }, base, day) {
|
|
674
|
-
return
|
|
1075
|
+
return dateIsBetween(range.minDate, range.maxDate, assignDayInDate(base, day));
|
|
675
1076
|
}
|
|
676
1077
|
function createDayRangeState(props, base, day) {
|
|
677
1078
|
return {
|
|
@@ -706,7 +1107,7 @@ function createDaysPending(props, base, days) {
|
|
|
706
1107
|
function createNextWeeks(props, base) {
|
|
707
1108
|
const weeks = [];
|
|
708
1109
|
const { date } = props;
|
|
709
|
-
const dayCount =
|
|
1110
|
+
const dayCount = getDaysOfMonth(date.getFullYear(), date.getMonth());
|
|
710
1111
|
let days = [];
|
|
711
1112
|
let countDays = 1;
|
|
712
1113
|
let day = DAYS_WEEK - base.getDay() + 1;
|
|
@@ -730,13 +1131,13 @@ function createNextWeeks(props, base) {
|
|
|
730
1131
|
function dayRangeIsOutsideMin(props, day) {
|
|
731
1132
|
const { date, minDate } = props;
|
|
732
1133
|
return minDate
|
|
733
|
-
?
|
|
1134
|
+
? getDateWeight(assignDayInDate(date, day)) < getDateWeight(minDate)
|
|
734
1135
|
: false;
|
|
735
1136
|
}
|
|
736
1137
|
function dayRangeIsOutsideMax(props, day) {
|
|
737
1138
|
const { date, maxDate } = props;
|
|
738
1139
|
return maxDate
|
|
739
|
-
?
|
|
1140
|
+
? getDateWeight(assignDayInDate(date, day)) > getDateWeight(maxDate)
|
|
740
1141
|
: false;
|
|
741
1142
|
}
|
|
742
1143
|
function dayRangeIsOutside(props, day) {
|
|
@@ -754,7 +1155,7 @@ function createMonthState(props, value) {
|
|
|
754
1155
|
return {
|
|
755
1156
|
disabled: monthIsOutside(props, value),
|
|
756
1157
|
focused: value === month,
|
|
757
|
-
label:
|
|
1158
|
+
label: MONTH_NAMES()[value],
|
|
758
1159
|
selected: date.getFullYear() === year && value === date.getMonth(),
|
|
759
1160
|
value
|
|
760
1161
|
};
|
|
@@ -784,23 +1185,23 @@ function checkMonthPicker(props) {
|
|
|
784
1185
|
}
|
|
785
1186
|
function createMonthPicker(props) {
|
|
786
1187
|
return [
|
|
787
|
-
createMonthState(props,
|
|
788
|
-
createMonthState(props,
|
|
789
|
-
createMonthState(props,
|
|
790
|
-
createMonthState(props,
|
|
791
|
-
createMonthState(props,
|
|
792
|
-
createMonthState(props,
|
|
793
|
-
createMonthState(props,
|
|
794
|
-
createMonthState(props,
|
|
795
|
-
createMonthState(props,
|
|
796
|
-
createMonthState(props,
|
|
797
|
-
createMonthState(props,
|
|
798
|
-
createMonthState(props,
|
|
1188
|
+
createMonthState(props, Month.January),
|
|
1189
|
+
createMonthState(props, Month.February),
|
|
1190
|
+
createMonthState(props, Month.March),
|
|
1191
|
+
createMonthState(props, Month.April),
|
|
1192
|
+
createMonthState(props, Month.May),
|
|
1193
|
+
createMonthState(props, Month.June),
|
|
1194
|
+
createMonthState(props, Month.July),
|
|
1195
|
+
createMonthState(props, Month.August),
|
|
1196
|
+
createMonthState(props, Month.September),
|
|
1197
|
+
createMonthState(props, Month.October),
|
|
1198
|
+
createMonthState(props, Month.November),
|
|
1199
|
+
createMonthState(props, Month.December)
|
|
799
1200
|
];
|
|
800
1201
|
}
|
|
801
1202
|
function monthIsLimitMin(props) {
|
|
802
1203
|
const { month, date, minDate } = props;
|
|
803
|
-
if (
|
|
1204
|
+
if (itIsDefined(month) && date) {
|
|
804
1205
|
const minYear = minDate ? minDate.getFullYear() : 0;
|
|
805
1206
|
const minMonth = minDate ? minDate.getMonth() : 0;
|
|
806
1207
|
return date.getFullYear() === minYear && month <= minMonth;
|
|
@@ -809,7 +1210,7 @@ function monthIsLimitMin(props) {
|
|
|
809
1210
|
}
|
|
810
1211
|
function monthIsLimitMax(props) {
|
|
811
1212
|
const { month, date, maxDate } = props;
|
|
812
|
-
if (
|
|
1213
|
+
if (itIsDefined(month) && date) {
|
|
813
1214
|
const maxYear = maxDate ? maxDate.getFullYear() : 10000;
|
|
814
1215
|
const maxMonth = maxDate ? maxDate.getMonth() : 11;
|
|
815
1216
|
return date.getFullYear() === maxYear && month >= maxMonth;
|
|
@@ -889,6 +1290,30 @@ function createYearPicker(props) {
|
|
|
889
1290
|
};
|
|
890
1291
|
}
|
|
891
1292
|
|
|
1293
|
+
const normalize = (word) => {
|
|
1294
|
+
return word
|
|
1295
|
+
.slice()
|
|
1296
|
+
.replace(/á/g, 'a')
|
|
1297
|
+
.replace(/Á/g, 'A')
|
|
1298
|
+
.replace(/é/g, 'e')
|
|
1299
|
+
.replace(/É/g, 'E')
|
|
1300
|
+
.replace(/í/g, 'i')
|
|
1301
|
+
.replace(/Í/g, 'I')
|
|
1302
|
+
.replace(/ó/g, 'o')
|
|
1303
|
+
.replace(/Ó/g, 'O')
|
|
1304
|
+
.replace(/ú/g, 'u')
|
|
1305
|
+
.replace(/Ú/g, 'U');
|
|
1306
|
+
};
|
|
1307
|
+
const hasPattern = (word, pattern, force = false) => {
|
|
1308
|
+
let filter = pattern.toLowerCase();
|
|
1309
|
+
let test = word.toLowerCase();
|
|
1310
|
+
if (force) {
|
|
1311
|
+
test = normalize(test);
|
|
1312
|
+
filter = normalize(filter);
|
|
1313
|
+
}
|
|
1314
|
+
return !!test.match(`^.*${filter}.*$`);
|
|
1315
|
+
};
|
|
1316
|
+
|
|
892
1317
|
function createEmptyStore() {
|
|
893
1318
|
return {
|
|
894
1319
|
coincidences: undefined,
|
|
@@ -904,7 +1329,7 @@ function searchForPattern(props) {
|
|
|
904
1329
|
let newStore = store;
|
|
905
1330
|
let search = false;
|
|
906
1331
|
while (!search && newStore) {
|
|
907
|
-
search =
|
|
1332
|
+
search = hasPattern(pattern || '', newStore.pattern, true);
|
|
908
1333
|
if (!search) {
|
|
909
1334
|
newStore = newStore.previous;
|
|
910
1335
|
}
|
|
@@ -1049,7 +1474,7 @@ function RlsPickerDay({ date, disabled: disabledPicker, formControl, maxDate, mo
|
|
|
1049
1474
|
return {
|
|
1050
1475
|
date: currentDate,
|
|
1051
1476
|
day: formControl?.state || value,
|
|
1052
|
-
month:
|
|
1477
|
+
month: itIsDefined(month) ? month : currentDate.getMonth(),
|
|
1053
1478
|
year: year || currentDate.getFullYear(),
|
|
1054
1479
|
minDate,
|
|
1055
1480
|
maxDate
|
|
@@ -1064,7 +1489,7 @@ function RlsPickerDay({ date, disabled: disabledPicker, formControl, maxDate, mo
|
|
|
1064
1489
|
onValue(value);
|
|
1065
1490
|
}
|
|
1066
1491
|
}
|
|
1067
|
-
return (jsxRuntime.jsxs("div", { className: "rls-picker-day", "rls-theme": rlsTheme, children: [jsxRuntime.jsx("div", { className: "rls-picker-day__header", children:
|
|
1492
|
+
return (jsxRuntime.jsxs("div", { className: "rls-picker-day", "rls-theme": rlsTheme, children: [jsxRuntime.jsx("div", { className: "rls-picker-day__header", children: DAY_LABELS().map((title, index) => (jsxRuntime.jsx("label", { className: "rls-picker-day__label", children: title }, index))) }), jsxRuntime.jsx("div", { className: "rls-picker-day__component", children: weeks.map(({ days }, index) => (jsxRuntime.jsx("div", { className: "rls-picker-day__week", children: days.map(({ value, disabled, focused, forbidden, selected, today }, index) => (jsxRuntime.jsx("div", { className: renderClassStatus('rls-picker-day__element', {
|
|
1068
1493
|
disabled: disabled || disabledPicker,
|
|
1069
1494
|
focused,
|
|
1070
1495
|
forbidden,
|
|
@@ -1076,8 +1501,8 @@ function RlsPickerDay({ date, disabled: disabledPicker, formControl, maxDate, mo
|
|
|
1076
1501
|
const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
|
|
1077
1502
|
|
|
1078
1503
|
function RlsPickerDayRange({ date, disabled: disabledPicker, formControl, maxDate, minDate, rlsTheme }) {
|
|
1079
|
-
const currentRange = formControl?.state ||
|
|
1080
|
-
const currentDate =
|
|
1504
|
+
const currentRange = formControl?.state || DateRange.now();
|
|
1505
|
+
const currentDate = normalizeMinTime(date || currentRange.minDate);
|
|
1081
1506
|
const sourceDate = react.useRef(currentRange.minDate);
|
|
1082
1507
|
const [weeks, setWeeks] = react.useState([]);
|
|
1083
1508
|
const [range, setRange] = react.useState(currentRange);
|
|
@@ -1091,15 +1516,15 @@ function RlsPickerDayRange({ date, disabled: disabledPicker, formControl, maxDat
|
|
|
1091
1516
|
}));
|
|
1092
1517
|
}, [range, date, minDate, maxDate]);
|
|
1093
1518
|
function onChange(value) {
|
|
1094
|
-
const date =
|
|
1095
|
-
const range =
|
|
1096
|
-
? new
|
|
1097
|
-
: new
|
|
1519
|
+
const date = assignDayInDate(currentDate, value);
|
|
1520
|
+
const range = dateIsBefore(date, sourceDate.current)
|
|
1521
|
+
? new DateRange(sourceDate.current, date)
|
|
1522
|
+
: new DateRange(date, sourceDate.current);
|
|
1098
1523
|
sourceDate.current = date;
|
|
1099
1524
|
setRange(range);
|
|
1100
1525
|
formControl?.setState(range);
|
|
1101
1526
|
}
|
|
1102
|
-
return (jsxRuntime.jsxs("div", { className: "rls-picker-day-range", "rls-theme": rlsTheme, children: [jsxRuntime.jsx("div", { className: "rls-picker-day-range__title", children:
|
|
1527
|
+
return (jsxRuntime.jsxs("div", { className: "rls-picker-day-range", "rls-theme": rlsTheme, children: [jsxRuntime.jsx("div", { className: "rls-picker-day-range__title", children: dateFormatTemplate(sourceDate.current, DATE_RANGE_FORMAT) }), jsxRuntime.jsx("div", { className: "rls-picker-day-range__header", children: DAY_LABELS().map((title, index) => (jsxRuntime.jsx("label", { className: "rls-picker-day-range__label", children: title }, index))) }), jsxRuntime.jsx("div", { className: "rls-picker-day-range__component", children: weeks.map(({ days }, index) => (jsxRuntime.jsx("div", { className: "rls-picker-day-range__week", children: days.map(({ disabled, end, forbidden, source, ranged, value }, index) => (jsxRuntime.jsx("div", { className: renderClassStatus('rls-picker-day-range__element', {
|
|
1103
1528
|
disabled: disabled || disabledPicker,
|
|
1104
1529
|
end,
|
|
1105
1530
|
forbidden,
|
|
@@ -1119,14 +1544,14 @@ function RlsPickerMonth({ date, disabled: disabledPicker, formControl, maxDate,
|
|
|
1119
1544
|
}, [date, year, value, minDate, maxDate]);
|
|
1120
1545
|
react.useEffect(() => {
|
|
1121
1546
|
const month = checkMonthPicker(createPickerProps());
|
|
1122
|
-
|
|
1547
|
+
itIsDefined(month)
|
|
1123
1548
|
? formControl?.setState(month)
|
|
1124
1549
|
: setValue(formControl?.state || currentDate.getMonth());
|
|
1125
1550
|
}, [formControl?.state]);
|
|
1126
1551
|
function createPickerProps() {
|
|
1127
1552
|
return {
|
|
1128
1553
|
date: currentDate,
|
|
1129
|
-
month:
|
|
1554
|
+
month: itIsDefined(formControl?.state) ? formControl?.state : value,
|
|
1130
1555
|
year: year || currentDate.getFullYear(),
|
|
1131
1556
|
minDate,
|
|
1132
1557
|
maxDate
|
|
@@ -1155,20 +1580,20 @@ function RlsPickerMonthTitle({ monthControl, type, yearControl, date, disabled,
|
|
|
1155
1580
|
minDate,
|
|
1156
1581
|
month: monthControl.state
|
|
1157
1582
|
});
|
|
1158
|
-
const monthName =
|
|
1583
|
+
const monthName = MONTH_NAMES()[monthControl.state || 0];
|
|
1159
1584
|
function onPreviousMonth() {
|
|
1160
|
-
if (
|
|
1161
|
-
if (monthControl.state >
|
|
1585
|
+
if (itIsDefined(monthControl.state) && itIsDefined(yearControl.state)) {
|
|
1586
|
+
if (monthControl.state > Month.January) {
|
|
1162
1587
|
monthControl.setState(monthControl.state - 1);
|
|
1163
1588
|
}
|
|
1164
1589
|
else {
|
|
1165
|
-
monthControl.setState(
|
|
1590
|
+
monthControl.setState(Month.December);
|
|
1166
1591
|
yearControl.setState(yearControl.state - 1);
|
|
1167
1592
|
}
|
|
1168
1593
|
}
|
|
1169
1594
|
}
|
|
1170
1595
|
function onPreviousYear() {
|
|
1171
|
-
if (
|
|
1596
|
+
if (itIsDefined(yearControl.state)) {
|
|
1172
1597
|
yearControl.setState(yearControl.state - 1);
|
|
1173
1598
|
}
|
|
1174
1599
|
}
|
|
@@ -1176,18 +1601,18 @@ function RlsPickerMonthTitle({ monthControl, type, yearControl, date, disabled,
|
|
|
1176
1601
|
type === 'month' ? onPreviousMonth() : onPreviousYear();
|
|
1177
1602
|
}
|
|
1178
1603
|
function onNextMonth() {
|
|
1179
|
-
if (
|
|
1180
|
-
if (monthControl.state <
|
|
1604
|
+
if (itIsDefined(monthControl.state) && itIsDefined(yearControl.state)) {
|
|
1605
|
+
if (monthControl.state < Month.December) {
|
|
1181
1606
|
monthControl.setState(monthControl.state + 1);
|
|
1182
1607
|
}
|
|
1183
1608
|
else {
|
|
1184
|
-
monthControl.setState(
|
|
1609
|
+
monthControl.setState(Month.January);
|
|
1185
1610
|
yearControl.setState(yearControl.state + 1);
|
|
1186
1611
|
}
|
|
1187
1612
|
}
|
|
1188
1613
|
}
|
|
1189
1614
|
function onNextYear() {
|
|
1190
|
-
if (
|
|
1615
|
+
if (itIsDefined(yearControl.state)) {
|
|
1191
1616
|
yearControl.setState(yearControl.state + 1);
|
|
1192
1617
|
}
|
|
1193
1618
|
}
|
|
@@ -1211,7 +1636,7 @@ function RlsPickerYear({ date, disabled: disabledPicker, formControl, maxDate, m
|
|
|
1211
1636
|
}, [date, year, value, minDate, maxDate]);
|
|
1212
1637
|
react.useEffect(() => {
|
|
1213
1638
|
const year = checkYearPicker(createPickerProps());
|
|
1214
|
-
|
|
1639
|
+
itIsDefined(year)
|
|
1215
1640
|
? formControl?.setState(year)
|
|
1216
1641
|
: setValue(formControl?.state || currentDate.getFullYear());
|
|
1217
1642
|
}, [formControl?.state]);
|
|
@@ -1275,7 +1700,7 @@ const reactI18n = i18n.i18n({
|
|
|
1275
1700
|
}
|
|
1276
1701
|
});
|
|
1277
1702
|
|
|
1278
|
-
class ConfirmationResult extends
|
|
1703
|
+
class ConfirmationResult extends PartialSealed {
|
|
1279
1704
|
static approved() {
|
|
1280
1705
|
return new ConfirmationResult('approved');
|
|
1281
1706
|
}
|
|
@@ -1284,15 +1709,7 @@ class ConfirmationResult extends helpersAdvanced.PartialSealed {
|
|
|
1284
1709
|
}
|
|
1285
1710
|
}
|
|
1286
1711
|
function RlsConfirmation({ approved, content, reject, rlsTheme, subtitle, title, visible }) {
|
|
1287
|
-
return (jsxRuntime.jsxs("div", { className: renderClassStatus('rls-confirmation', { visible }), "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("div", { className: "rls-confirmation__component", children: [jsxRuntime.jsxs("div", { className: "rls-confirmation__header", children: [title &&
|
|
1288
|
-
if (approved.onClick) {
|
|
1289
|
-
approved.onClick();
|
|
1290
|
-
}
|
|
1291
|
-
}, children: approved.label })), reject && (jsxRuntime.jsx(RlsButton, { type: "outline", onClick: () => {
|
|
1292
|
-
if (reject.onClick) {
|
|
1293
|
-
reject.onClick();
|
|
1294
|
-
}
|
|
1295
|
-
}, children: reject.label }))] }) }))] }), jsxRuntime.jsx("div", { className: "rls-confirmation__backdrop" })] }));
|
|
1712
|
+
return (jsxRuntime.jsxs("div", { className: renderClassStatus('rls-confirmation', { visible }), "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("div", { className: "rls-confirmation__component", children: [jsxRuntime.jsxs("div", { className: "rls-confirmation__header", children: [title && jsxRuntime.jsx("div", { className: "rls-confirmation__title", children: title }), subtitle && (jsxRuntime.jsx("div", { className: "rls-confirmation__subtitle", children: subtitle }))] }), jsxRuntime.jsx("div", { className: "rls-confirmation__body", children: content && (jsxRuntime.jsx("div", { className: "rls-confirmation__message", children: content })) }), (approved || reject) && (jsxRuntime.jsx("div", { className: "rls-confirmation__footer", children: jsxRuntime.jsxs("div", { className: "rls-confirmation__actions", children: [approved && (jsxRuntime.jsx(RlsButton, { type: "raised", onClick: approved.onClick, children: approved.label })), reject && (jsxRuntime.jsx(RlsButton, { type: "outline", onClick: reject.onClick, children: reject.label }))] }) }))] }), jsxRuntime.jsx("div", { className: "rls-confirmation__backdrop" })] }));
|
|
1296
1713
|
}
|
|
1297
1714
|
function useConfirmationService() {
|
|
1298
1715
|
const [config, setConfig] = react.useState({});
|
|
@@ -1361,15 +1778,18 @@ function useDatatable() {
|
|
|
1361
1778
|
const bodyRef = react.useRef(null);
|
|
1362
1779
|
react.useEffect(() => {
|
|
1363
1780
|
let observer;
|
|
1364
|
-
|
|
1781
|
+
const body = bodyRef?.current;
|
|
1782
|
+
if (body) {
|
|
1365
1783
|
observer = new ResizeObserver(() => {
|
|
1366
|
-
const scrollHeight =
|
|
1367
|
-
const clientHeight =
|
|
1784
|
+
const scrollHeight = body.scrollHeight || 0;
|
|
1785
|
+
const clientHeight = body.clientHeight || 0;
|
|
1368
1786
|
setScrolleable(scrollHeight > clientHeight);
|
|
1369
1787
|
});
|
|
1370
1788
|
observer.observe(bodyRef?.current);
|
|
1371
1789
|
}
|
|
1372
|
-
return () =>
|
|
1790
|
+
return () => {
|
|
1791
|
+
observer?.disconnect();
|
|
1792
|
+
};
|
|
1373
1793
|
}, []);
|
|
1374
1794
|
return { bodyRef, scrolleable };
|
|
1375
1795
|
}
|
|
@@ -1378,17 +1798,18 @@ function useListControl({ suggestions, formControl }) {
|
|
|
1378
1798
|
const boxContentRef = react.useRef(null);
|
|
1379
1799
|
const listRef = react.useRef(null);
|
|
1380
1800
|
const inputRef = react.useRef(null);
|
|
1381
|
-
const [
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1801
|
+
const [listState, setListState] = react.useState({
|
|
1802
|
+
collection: new ListCollection([]),
|
|
1803
|
+
focused: false,
|
|
1804
|
+
higher: false,
|
|
1805
|
+
value: '',
|
|
1806
|
+
visible: false
|
|
1807
|
+
});
|
|
1387
1808
|
const position = react.useRef(0);
|
|
1388
1809
|
react.useEffect(() => {
|
|
1389
1810
|
function onCloseSuggestions({ target }) {
|
|
1390
1811
|
if (!boxContentRef?.current?.contains(target)) {
|
|
1391
|
-
|
|
1812
|
+
setListState((state) => ({ ...state, visible: false }));
|
|
1392
1813
|
}
|
|
1393
1814
|
}
|
|
1394
1815
|
document.addEventListener('click', onCloseSuggestions);
|
|
@@ -1397,25 +1818,37 @@ function useListControl({ suggestions, formControl }) {
|
|
|
1397
1818
|
};
|
|
1398
1819
|
}, []);
|
|
1399
1820
|
react.useEffect(() => {
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
}, [visible]);
|
|
1821
|
+
const boxContent = boxContentRef.current;
|
|
1822
|
+
const list = listRef.current;
|
|
1823
|
+
formControl?.touch();
|
|
1824
|
+
setListState((state) => ({
|
|
1825
|
+
...state,
|
|
1826
|
+
higher: !locationListIsBottom(boxContent, list)
|
|
1827
|
+
}));
|
|
1828
|
+
}, [listState.visible]);
|
|
1408
1829
|
react.useEffect(() => {
|
|
1409
|
-
|
|
1830
|
+
setListState((state) => ({
|
|
1831
|
+
...state,
|
|
1832
|
+
collection: new ListCollection(suggestions)
|
|
1833
|
+
}));
|
|
1410
1834
|
}, [suggestions]);
|
|
1835
|
+
function setFocused(focused) {
|
|
1836
|
+
setListState((state) => ({ ...state, focused }));
|
|
1837
|
+
}
|
|
1838
|
+
function setValue(value) {
|
|
1839
|
+
setListState((state) => ({ ...state, value }));
|
|
1840
|
+
}
|
|
1841
|
+
function setVisible(visible) {
|
|
1842
|
+
setListState((state) => ({ ...state, visible }));
|
|
1843
|
+
}
|
|
1411
1844
|
function navigationInput(event) {
|
|
1412
|
-
if (visible) {
|
|
1845
|
+
if (listState.visible) {
|
|
1413
1846
|
const newPosition = listNavigationInput({
|
|
1414
1847
|
contentElement: boxContentRef.current,
|
|
1415
1848
|
event: event,
|
|
1416
1849
|
listElement: listRef.current
|
|
1417
1850
|
});
|
|
1418
|
-
position.current =
|
|
1851
|
+
position.current = newPosition || 0;
|
|
1419
1852
|
}
|
|
1420
1853
|
}
|
|
1421
1854
|
function navigationElement(event) {
|
|
@@ -1428,19 +1861,15 @@ function useListControl({ suggestions, formControl }) {
|
|
|
1428
1861
|
});
|
|
1429
1862
|
}
|
|
1430
1863
|
return {
|
|
1864
|
+
...listState,
|
|
1431
1865
|
boxContentRef,
|
|
1432
|
-
collection,
|
|
1433
|
-
focused,
|
|
1434
|
-
higher,
|
|
1435
1866
|
inputRef,
|
|
1436
1867
|
listRef,
|
|
1437
1868
|
navigationElement,
|
|
1438
1869
|
navigationInput,
|
|
1439
1870
|
setFocused,
|
|
1440
1871
|
setValue,
|
|
1441
|
-
setVisible
|
|
1442
|
-
value,
|
|
1443
|
-
visible
|
|
1872
|
+
setVisible
|
|
1444
1873
|
};
|
|
1445
1874
|
}
|
|
1446
1875
|
|
|
@@ -1597,7 +2026,7 @@ function RlsFieldAutocompleteTemplate({ suggestions, children, disabled, formCon
|
|
|
1597
2026
|
disabled,
|
|
1598
2027
|
focused: listControl.focused,
|
|
1599
2028
|
selected: !!listControl.value
|
|
1600
|
-
}, 'rls-field-list rls-field-autocomplete'), "rls-theme": rlsTheme, children: [children && jsxRuntime.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntime.jsx("div", { className: "rls-field-box__component", children: jsxRuntime.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntime.jsx("label", { className: "rls-field-list__control", onClick: onClickControl, children: listControl.value ? (jsxRuntime.jsx("span", { className: "rls-field-list__control__description", children: listControl.value })) : (jsxRuntime.jsx("span", { className: "rls-field-list__control__placeholder", children: placeholder })) }), !hiddenIcon && listControl.value && (jsxRuntime.jsx("button", { className: "rls-field-list__action", disabled: disabled, onClick: onClickAction, children: jsxRuntime.jsx(RlsIcon, { value: "trash-2" }) }))] }) }),
|
|
2029
|
+
}, 'rls-field-list rls-field-autocomplete'), "rls-theme": rlsTheme, children: [children && jsxRuntime.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntime.jsx("div", { className: "rls-field-box__component", children: jsxRuntime.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntime.jsx("label", { className: "rls-field-list__control", onClick: onClickControl, children: listControl.value ? (jsxRuntime.jsx("span", { className: "rls-field-list__control__description", children: listControl.value })) : (jsxRuntime.jsx("span", { className: "rls-field-list__control__placeholder", children: placeholder })) }), !hiddenIcon && listControl.value && (jsxRuntime.jsx("button", { className: "rls-field-list__action", disabled: disabled, onClick: onClickAction, children: jsxRuntime.jsx(RlsIcon, { value: "trash-2" }) }))] }) }), jsxRuntime.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }), jsxRuntime.jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
|
|
1601
2030
|
visible: listControl.visible,
|
|
1602
2031
|
hide: !listControl.visible,
|
|
1603
2032
|
higher: listControl.higher
|
|
@@ -1612,13 +2041,33 @@ function RlsFieldAutocomplete(props) {
|
|
|
1612
2041
|
}
|
|
1613
2042
|
|
|
1614
2043
|
function rangeFormatTemplate({ maxDate, minDate }) {
|
|
1615
|
-
const minFormat =
|
|
1616
|
-
const maxFormat =
|
|
2044
|
+
const minFormat = dateFormatTemplate(minDate, DATE_RANGE_FORMAT);
|
|
2045
|
+
const maxFormat = dateFormatTemplate(maxDate, DATE_RANGE_FORMAT);
|
|
1617
2046
|
return `${minFormat} - ${maxFormat}`;
|
|
1618
2047
|
}
|
|
1619
2048
|
|
|
1620
|
-
|
|
1621
|
-
|
|
2049
|
+
function RlsModal({ children, visible, rlsTheme }) {
|
|
2050
|
+
return ReactDOM.createPortal(jsxRuntime.jsxs("div", { className: renderClassStatus('rls-modal', { visible }), "rls-theme": rlsTheme, children: [jsxRuntime.jsx("div", { className: "rls-modal__component", children: children }), jsxRuntime.jsx("div", { className: "rls-modal__backdrop" })] }), document.body);
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
function itIsFormControlOptions(props) {
|
|
2054
|
+
return (typeof props === 'object' && ('state' in props || 'validators' in props));
|
|
2055
|
+
}
|
|
2056
|
+
function createFormControlOptions(...argsProps) {
|
|
2057
|
+
const [props, validators] = argsProps;
|
|
2058
|
+
if (!props) {
|
|
2059
|
+
return { state: props, validators };
|
|
2060
|
+
}
|
|
2061
|
+
if (!validators && itIsFormControlOptions(props)) {
|
|
2062
|
+
return props;
|
|
2063
|
+
}
|
|
2064
|
+
return {
|
|
2065
|
+
state: props,
|
|
2066
|
+
validators
|
|
2067
|
+
};
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
const controlIsValid = ({ state, validators }) => {
|
|
1622
2071
|
return validators.reduce((errors, validator) => {
|
|
1623
2072
|
const error = validator(state);
|
|
1624
2073
|
if (error) {
|
|
@@ -1628,89 +2077,77 @@ const controlIsValid = (props) => {
|
|
|
1628
2077
|
}, []);
|
|
1629
2078
|
};
|
|
1630
2079
|
|
|
1631
|
-
function useControl(
|
|
1632
|
-
const
|
|
1633
|
-
const [
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
const
|
|
2080
|
+
function useControl(controlOptions, controlValidators) {
|
|
2081
|
+
const { state, touched, validators } = createFormControlOptions(controlOptions, controlValidators);
|
|
2082
|
+
const [controlState, setControlState] = react.useState({
|
|
2083
|
+
dirty: false,
|
|
2084
|
+
disabled: false,
|
|
2085
|
+
focused: false,
|
|
2086
|
+
state: state,
|
|
2087
|
+
touched: !!touched,
|
|
2088
|
+
validators: validators
|
|
2089
|
+
});
|
|
2090
|
+
const initialState = react.useRef(state);
|
|
1642
2091
|
const elementRef = react.useRef(null);
|
|
1643
|
-
const errors =
|
|
1644
|
-
const
|
|
1645
|
-
const valid = (() => errors.length === 0)();
|
|
1646
|
-
react.useEffect(() => {
|
|
1647
|
-
if (state !== null && state !== undefined) {
|
|
1648
|
-
setValue(state);
|
|
1649
|
-
}
|
|
1650
|
-
subscribers.next(state);
|
|
1651
|
-
}, [state]);
|
|
2092
|
+
const errors = validators ? controlIsValid({ state, validators }) : [];
|
|
2093
|
+
const valid = errors.length === 0;
|
|
1652
2094
|
function focus() {
|
|
1653
|
-
|
|
2095
|
+
setControlState((state) => ({ ...state, focused: true }));
|
|
1654
2096
|
}
|
|
1655
2097
|
function blur() {
|
|
1656
|
-
|
|
2098
|
+
setControlState((state) => ({ ...state, focused: false, touched: true }));
|
|
1657
2099
|
}
|
|
1658
2100
|
function disable() {
|
|
1659
|
-
|
|
2101
|
+
setControlState((state) => ({ ...state, disabled: true }));
|
|
1660
2102
|
}
|
|
1661
2103
|
function enable() {
|
|
1662
|
-
|
|
2104
|
+
setControlState((state) => ({ ...state, disabled: false }));
|
|
1663
2105
|
}
|
|
1664
2106
|
function touch() {
|
|
1665
|
-
|
|
1666
|
-
}
|
|
1667
|
-
function untouch() {
|
|
1668
|
-
setTouched(false);
|
|
2107
|
+
setControlState((state) => ({ ...state, touched: true }));
|
|
1669
2108
|
}
|
|
1670
2109
|
function setState(state) {
|
|
1671
|
-
|
|
1672
|
-
|
|
2110
|
+
setControlState((currentState) => ({
|
|
2111
|
+
...currentState,
|
|
2112
|
+
dirty: true,
|
|
2113
|
+
state
|
|
2114
|
+
}));
|
|
1673
2115
|
}
|
|
1674
|
-
function
|
|
1675
|
-
|
|
1676
|
-
setDirty(false);
|
|
1677
|
-
setCurrentState(initialValue);
|
|
2116
|
+
function setValidators(validators) {
|
|
2117
|
+
setControlState((state) => ({ ...state, validators }));
|
|
1678
2118
|
}
|
|
1679
|
-
function
|
|
1680
|
-
|
|
1681
|
-
|
|
2119
|
+
function reset() {
|
|
2120
|
+
setControlState((currentState) => ({
|
|
2121
|
+
...currentState,
|
|
2122
|
+
dirty: false,
|
|
2123
|
+
state: initialState.current,
|
|
2124
|
+
touched: false
|
|
2125
|
+
}));
|
|
1682
2126
|
}
|
|
1683
2127
|
return {
|
|
2128
|
+
...controlState,
|
|
1684
2129
|
blur,
|
|
1685
|
-
dirty,
|
|
1686
2130
|
disable,
|
|
1687
|
-
disabled,
|
|
1688
2131
|
elementRef,
|
|
1689
2132
|
enable,
|
|
1690
|
-
enabled: !disabled,
|
|
1691
|
-
error,
|
|
2133
|
+
enabled: !controlState.disabled,
|
|
2134
|
+
error: errors[0],
|
|
1692
2135
|
errors,
|
|
1693
2136
|
focus,
|
|
1694
|
-
focused,
|
|
1695
2137
|
invalid: !valid,
|
|
1696
|
-
pristine: !dirty,
|
|
2138
|
+
pristine: !controlState.dirty,
|
|
1697
2139
|
reset,
|
|
1698
2140
|
setState,
|
|
1699
2141
|
setValidators,
|
|
1700
|
-
state,
|
|
1701
|
-
subscribe,
|
|
1702
2142
|
touch,
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
untouch,
|
|
1706
|
-
untouched: !touched,
|
|
2143
|
+
unfocused: !controlState.focused,
|
|
2144
|
+
untouched: !controlState.touched,
|
|
1707
2145
|
valid,
|
|
1708
|
-
|
|
1709
|
-
wrong: touched && !valid
|
|
2146
|
+
wrong: controlState.touched && !valid
|
|
1710
2147
|
};
|
|
1711
2148
|
}
|
|
1712
|
-
function useReactControl(
|
|
1713
|
-
return useControl(
|
|
2149
|
+
function useReactControl(options, validators) {
|
|
2150
|
+
return useControl(options, validators);
|
|
1714
2151
|
}
|
|
1715
2152
|
|
|
1716
2153
|
const FORMAT_DESCRIPTION = '{dw}, {mx} {dd} de {aa}';
|
|
@@ -1732,18 +2169,18 @@ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDat
|
|
|
1732
2169
|
formControl?.setState(dateCheck);
|
|
1733
2170
|
}, []);
|
|
1734
2171
|
react.useEffect(() => {
|
|
1735
|
-
setValue((prevValue) =>
|
|
1736
|
-
?
|
|
2172
|
+
setValue((prevValue) => itIsDefined(yearControl.state)
|
|
2173
|
+
? assignYearInDate(prevValue, yearControl.state)
|
|
1737
2174
|
: prevValue);
|
|
1738
2175
|
}, [yearControl.state]);
|
|
1739
2176
|
react.useEffect(() => {
|
|
1740
|
-
setValue((prevValue) =>
|
|
1741
|
-
?
|
|
2177
|
+
setValue((prevValue) => itIsDefined(monthControl.state)
|
|
2178
|
+
? assignMonthInDate(prevValue, monthControl.state)
|
|
1742
2179
|
: prevValue);
|
|
1743
2180
|
}, [monthControl.state]);
|
|
1744
2181
|
react.useEffect(() => {
|
|
1745
|
-
setValue((prevValue) =>
|
|
1746
|
-
?
|
|
2182
|
+
setValue((prevValue) => itIsDefined(dayControl.state)
|
|
2183
|
+
? assignDayInDate(prevValue, dayControl.state)
|
|
1747
2184
|
: prevValue);
|
|
1748
2185
|
}, [dayControl.state]);
|
|
1749
2186
|
function onVisibilityDay() {
|
|
@@ -1775,17 +2212,13 @@ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDat
|
|
|
1775
2212
|
onListener({ type: PickerListenerType.Select, value });
|
|
1776
2213
|
}
|
|
1777
2214
|
}
|
|
1778
|
-
return (jsxRuntime.jsxs("div", { className: "rls-picker-date", "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("div", { className: "rls-picker-date__header", children: [jsxRuntime.jsx("div", { className: "rls-picker-date__title rls-picker-date__title--description", children: jsxRuntime.jsx("span", { onClick: onVisibilityDay, children:
|
|
2215
|
+
return (jsxRuntime.jsxs("div", { className: "rls-picker-date", "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("div", { className: "rls-picker-date__header", children: [jsxRuntime.jsx("div", { className: "rls-picker-date__title rls-picker-date__title--description", children: jsxRuntime.jsx("span", { onClick: onVisibilityDay, children: dateFormatTemplate(dateInitial, FORMAT_DESCRIPTION) }) }), jsxRuntime.jsx("div", { className: "rls-picker-date__title rls-picker-date__title--year", children: jsxRuntime.jsx("span", { onClick: onVisibilityYear, children: yearControl.state }) }), jsxRuntime.jsx(RlsPickerMonthTitle, { monthControl: monthControl, yearControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: 'month', onClick: onVisibilityMonth })] }), jsxRuntime.jsxs("div", { className: renderClassStatus('rls-picker-date__component', {
|
|
1779
2216
|
day: visibility === 'DAY',
|
|
1780
2217
|
month: visibility === 'MONTH',
|
|
1781
2218
|
year: visibility === 'YEAR'
|
|
1782
2219
|
}), children: [jsxRuntime.jsx(RlsPickerDay, { formControl: dayControl, date: dateInitial, month: monthControl.state, year: yearControl.state, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntime.jsx(RlsPickerMonth, { formControl: monthControl, date: dateInitial, year: yearControl.state, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntime.jsx(RlsPickerYear, { formControl: yearControl, date: dateInitial, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), jsxRuntime.jsx("div", { className: renderClassStatus('rls-picker-date__footer', { automatic }), children: jsxRuntime.jsxs("div", { className: "rls-picker-date__actions", children: [jsxRuntime.jsx("div", { className: "rls-picker-date__actions--cancel", children: jsxRuntime.jsx(RlsButton, { type: "ghost", onClick: onCancel, children: reactI18n('dateActionCancel') }) }), jsxRuntime.jsx("div", { className: "rls-picker-date__actions--today", children: jsxRuntime.jsx(RlsButton, { type: "ghost", onClick: onToday, disabled: dateOutRange({ date: today, maxDate, minDate }), children: reactI18n('dateActionToday') }) }), jsxRuntime.jsx("div", { className: "rls-picker-date__actions--ok", children: jsxRuntime.jsx(RlsButton, { type: "raised", onClick: onSelect, children: reactI18n('dateActionSelect') }) })] }) })] }));
|
|
1783
2220
|
}
|
|
1784
2221
|
|
|
1785
|
-
function RlsModal({ children, visible, rlsTheme }) {
|
|
1786
|
-
return ReactDOM.createPortal(jsxRuntime.jsxs("div", { className: renderClassStatus('rls-modal', { visible }), "rls-theme": rlsTheme, children: [jsxRuntime.jsx("div", { className: "rls-modal__component", children: children }), jsxRuntime.jsx("div", { className: "rls-modal__backdrop" })] }), document.body);
|
|
1787
|
-
}
|
|
1788
|
-
|
|
1789
2222
|
function RlsFieldDate({ children, date, disabled, formControl, maxDate, minDate, onValue, placeholder, rlsTheme }) {
|
|
1790
2223
|
const today = new Date(); // Initial current date in component
|
|
1791
2224
|
const [value, setValue] = react.useState();
|
|
@@ -1813,29 +2246,25 @@ function RlsFieldDate({ children, date, disabled, formControl, maxDate, minDate,
|
|
|
1813
2246
|
}
|
|
1814
2247
|
function onClean() {
|
|
1815
2248
|
if (value) {
|
|
2249
|
+
formControl?.touch();
|
|
1816
2250
|
onChange(undefined);
|
|
1817
|
-
if (formControl && !formControl.touched) {
|
|
1818
|
-
formControl.touch();
|
|
1819
|
-
}
|
|
1820
2251
|
}
|
|
1821
2252
|
else {
|
|
1822
2253
|
setModalIsVisible(true);
|
|
1823
2254
|
}
|
|
1824
2255
|
}
|
|
1825
|
-
return (jsxRuntime.jsxs("div", { className: "rls-field-date", "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("div", { className: renderClassStatus('rls-field-box', { disabled }), children: [children && jsxRuntime.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntime.jsx("div", { className: "rls-field-box__component", children: jsxRuntime.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntime.jsx("input", { className: "rls-field-date__control", type: "text", value: value ?
|
|
2256
|
+
return (jsxRuntime.jsxs("div", { className: "rls-field-date", "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("div", { className: renderClassStatus('rls-field-box', { disabled }), children: [children && jsxRuntime.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntime.jsx("div", { className: "rls-field-box__component", children: jsxRuntime.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntime.jsx("input", { className: "rls-field-date__control", type: "text", value: value ? dateFormatTemplate(value, DATE_RANGE_FORMAT) : '', readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsxRuntime.jsx("button", { className: "rls-field-date__action", onClick: onClean, disabled: disabled, children: jsxRuntime.jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), jsxRuntime.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }), jsxRuntime.jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntime.jsx(RlsPickerDate, { formControl: formControl, date: date, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value, type }) => {
|
|
1826
2257
|
if (type !== PickerListenerType.Cancel) {
|
|
1827
2258
|
onChange(value, true);
|
|
1828
2259
|
}
|
|
2260
|
+
formControl?.touch();
|
|
1829
2261
|
setModalIsVisible(false);
|
|
1830
|
-
if (!formControl?.touched) {
|
|
1831
|
-
formControl?.touch();
|
|
1832
|
-
}
|
|
1833
2262
|
} }) })] }));
|
|
1834
2263
|
}
|
|
1835
2264
|
|
|
1836
2265
|
function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
|
|
1837
|
-
const dateInitial =
|
|
1838
|
-
const rangeInitial = formControl?.state ||
|
|
2266
|
+
const dateInitial = normalizeMinTime(datePicker || new Date());
|
|
2267
|
+
const rangeInitial = formControl?.state || DateRange.now();
|
|
1839
2268
|
const yearControl = useReactControl(dateInitial.getFullYear());
|
|
1840
2269
|
const monthControl = useReactControl(dateInitial.getMonth());
|
|
1841
2270
|
const dayControl = useReactControl(rangeInitial);
|
|
@@ -1845,14 +2274,14 @@ function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl
|
|
|
1845
2274
|
react.useEffect(() => {
|
|
1846
2275
|
setDate((prevValue) => {
|
|
1847
2276
|
return typeof yearControl.state === 'number'
|
|
1848
|
-
?
|
|
2277
|
+
? assignYearInDate(prevValue, yearControl.state)
|
|
1849
2278
|
: prevValue;
|
|
1850
2279
|
});
|
|
1851
2280
|
}, [yearControl.state]);
|
|
1852
2281
|
react.useEffect(() => {
|
|
1853
2282
|
setDate((prevValue) => {
|
|
1854
2283
|
return typeof monthControl.state === 'number'
|
|
1855
|
-
?
|
|
2284
|
+
? assignMonthInDate(prevValue, monthControl.state)
|
|
1856
2285
|
: prevValue;
|
|
1857
2286
|
});
|
|
1858
2287
|
}, [monthControl.state]);
|
|
@@ -1892,7 +2321,7 @@ function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl
|
|
|
1892
2321
|
}
|
|
1893
2322
|
|
|
1894
2323
|
function RlsFieldDateRange({ children, date: datePicker, disabled, formControl, maxDate, minDate, placeholder, rlsTheme }) {
|
|
1895
|
-
const currentRange = formControl?.state ||
|
|
2324
|
+
const currentRange = formControl?.state || DateRange.now();
|
|
1896
2325
|
const currentDate = datePicker || new Date();
|
|
1897
2326
|
const [value, setValue] = react.useState(currentRange);
|
|
1898
2327
|
const [modalIsVisible, setModalIsVisible] = react.useState(false);
|
|
@@ -1908,7 +2337,7 @@ function RlsFieldDateRange({ children, date: datePicker, disabled, formControl,
|
|
|
1908
2337
|
setModalIsVisible(true);
|
|
1909
2338
|
}
|
|
1910
2339
|
}
|
|
1911
|
-
return (jsxRuntime.jsxs("div", { className: "rls-field-date-range", "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("div", { className: renderClassStatus('rls-field-box', { disabled }), children: [children && jsxRuntime.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntime.jsx("div", { className: "rls-field-box__component", children: jsxRuntime.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntime.jsx("input", { className: "rls-field-date-range__control", type: "text", value: value ? rangeFormatTemplate(value) : '', readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsxRuntime.jsx("button", { className: "rls-field-date-range__action", onClick: onClickAction, disabled: disabled, children: jsxRuntime.jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) })] }), jsxRuntime.jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntime.jsx(RlsPickerDateRange, { formControl: formControl, date: currentDate, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value }) => {
|
|
2340
|
+
return (jsxRuntime.jsxs("div", { className: "rls-field-date-range", "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("div", { className: renderClassStatus('rls-field-box', { disabled }), children: [children && jsxRuntime.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntime.jsx("div", { className: "rls-field-box__component", children: jsxRuntime.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntime.jsx("input", { className: "rls-field-date-range__control", type: "text", value: value ? rangeFormatTemplate(value) : '', readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsxRuntime.jsx("button", { className: "rls-field-date-range__action", onClick: onClickAction, disabled: disabled, children: jsxRuntime.jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), jsxRuntime.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }), jsxRuntime.jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntime.jsx(RlsPickerDateRange, { formControl: formControl, date: currentDate, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value }) => {
|
|
1912
2341
|
if (value) {
|
|
1913
2342
|
setValue(value);
|
|
1914
2343
|
}
|
|
@@ -2037,7 +2466,7 @@ function RlsFieldSelectTemplate({ suggestions, children, disabled, formControl,
|
|
|
2037
2466
|
});
|
|
2038
2467
|
return (jsxRuntime.jsxs("div", { ref: listControl.boxContentRef, className: renderClassStatus('rls-field-box', { focused: listControl.focused, disabled }, 'rls-field-list rls-field-select'), "rls-theme": rlsTheme, children: [children && jsxRuntime.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntime.jsx("div", { className: "rls-field-box__component", children: jsxRuntime.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntime.jsx("input", { ref: listControl.inputRef, className: "rls-field-list__control", readOnly: true, disabled: disabled, placeholder: placeholder, value: listControl.value, onFocus: onFocusInput, onBlur: onBlurInput, onClick: onClickInput, onKeyDown: onKeydownInput }), jsxRuntime.jsx("button", { className: renderClassStatus('rls-field-list__action', {
|
|
2039
2468
|
visible: listControl.visible
|
|
2040
|
-
}), disabled: disabled, onClick: onClickAction, children: jsxRuntime.jsx(RlsIcon, { value: "arrow-ios-down" }) })] }) }),
|
|
2469
|
+
}), disabled: disabled, onClick: onClickAction, children: jsxRuntime.jsx(RlsIcon, { value: "arrow-ios-down" }) })] }) }), jsxRuntime.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }), jsxRuntime.jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
|
|
2041
2470
|
visible: listControl.visible,
|
|
2042
2471
|
hide: !listControl.visible,
|
|
2043
2472
|
higher: listControl.higher
|
|
@@ -2151,11 +2580,13 @@ exports.RlsInput = RlsInput;
|
|
|
2151
2580
|
exports.RlsInputMoney = RlsInputMoney;
|
|
2152
2581
|
exports.RlsInputNumber = RlsInputNumber;
|
|
2153
2582
|
exports.RlsInputPassword = RlsInputPassword;
|
|
2583
|
+
exports.RlsInputSearch = RlsInputSearch;
|
|
2154
2584
|
exports.RlsInputText = RlsInputText;
|
|
2155
2585
|
exports.RlsLabel = RlsLabel;
|
|
2156
2586
|
exports.RlsLabelCheckBox = RlsLabelCheckBox;
|
|
2157
2587
|
exports.RlsLabelRadioButton = RlsLabelRadioButton;
|
|
2158
2588
|
exports.RlsLabelSwitch = RlsLabelSwitch;
|
|
2589
|
+
exports.RlsMessageFormError = RlsMessageFormError;
|
|
2159
2590
|
exports.RlsMessageIcon = RlsMessageIcon;
|
|
2160
2591
|
exports.RlsModal = RlsModal;
|
|
2161
2592
|
exports.RlsPagination = RlsPagination;
|
|
@@ -2170,7 +2601,6 @@ exports.RlsPoster = RlsPoster;
|
|
|
2170
2601
|
exports.RlsProgressBar = RlsProgressBar;
|
|
2171
2602
|
exports.RlsProgressCircular = RlsProgressCircular;
|
|
2172
2603
|
exports.RlsRadioButton = RlsRadioButton;
|
|
2173
|
-
exports.RlsSearchInput = RlsSearchInput;
|
|
2174
2604
|
exports.RlsSkeleton = RlsSkeleton;
|
|
2175
2605
|
exports.RlsSkeletonText = RlsSkeletonText;
|
|
2176
2606
|
exports.RlsSnackbar = RlsSnackbar;
|