@rolster/react-components 19.4.0 → 19.4.5
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/LICENSE +21 -21
- package/dist/cjs/assets/{index-CvUJnmkm.css → index-ChnUq-Oa.css} +102 -16
- package/dist/cjs/index.cjs +323 -269
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/components/atoms/Avatar/Avatar.css +4 -4
- package/dist/esm/components/atoms/Avatar/Avatar.css.map +1 -1
- package/dist/esm/components/atoms/ButtonOption/ButtonOption.js +1 -1
- package/dist/esm/components/atoms/ButtonOption/ButtonOption.js.map +1 -1
- package/dist/esm/components/atoms/Image/Image.js +3 -6
- package/dist/esm/components/atoms/Image/Image.js.map +1 -1
- package/dist/esm/components/atoms/InputPassword/InputPassword.js +3 -3
- package/dist/esm/components/atoms/InputPassword/InputPassword.js.map +1 -1
- package/dist/esm/components/atoms/Poster/Poster.css +1 -1
- package/dist/esm/components/atoms/Poster/Poster.css.map +1 -1
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.js +9 -5
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.js.map +1 -1
- package/dist/esm/components/molecules/FieldFile/FieldFile.css +29 -0
- package/dist/esm/components/molecules/FieldFile/FieldFile.css.map +1 -0
- package/dist/esm/components/molecules/FieldFile/FieldFile.d.ts +15 -0
- package/dist/esm/components/molecules/FieldFile/FieldFile.js +43 -0
- package/dist/esm/components/molecules/FieldFile/FieldFile.js.map +1 -0
- package/dist/esm/components/molecules/FieldListSuggestions/FieldListSuggestions.css +49 -0
- package/dist/esm/components/molecules/FieldListSuggestions/FieldListSuggestions.css.map +1 -0
- package/dist/esm/components/molecules/FieldListSuggestions/FieldListSuggestions.d.ts +29 -0
- package/dist/esm/components/molecules/FieldListSuggestions/FieldListSuggestions.js +44 -0
- package/dist/esm/components/molecules/FieldListSuggestions/FieldListSuggestions.js.map +1 -0
- package/dist/esm/components/molecules/FieldReadonly/FieldReadonly.css.map +1 -1
- package/dist/esm/components/molecules/Pagination/Pagination.js +18 -17
- package/dist/esm/components/molecules/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/molecules/PickerDay/PickerDay.d.ts +1 -1
- package/dist/esm/components/molecules/PickerDay/PickerDay.js +13 -17
- 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 +20 -24
- package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.js.map +1 -1
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.d.ts +1 -1
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js +11 -15
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js.map +1 -1
- package/dist/esm/components/molecules/PickerSelectorTitle/PickerSelectorTitle.js +2 -2
- package/dist/esm/components/molecules/PickerSelectorTitle/PickerSelectorTitle.js.map +1 -1
- package/dist/esm/components/molecules/PickerYear/PickerYear.d.ts +1 -1
- package/dist/esm/components/molecules/PickerYear/PickerYear.js +10 -14
- package/dist/esm/components/molecules/PickerYear/PickerYear.js.map +1 -1
- package/dist/esm/components/molecules/Slider/Slider.d.ts +1 -1
- package/dist/esm/components/molecules/Slider/Slider.js +26 -26
- package/dist/esm/components/molecules/Slider/Slider.js.map +1 -1
- package/dist/esm/components/organisms/BottomSheet/BottomSheet.css +6 -3
- package/dist/esm/components/organisms/BottomSheet/BottomSheet.css.map +1 -1
- package/dist/esm/components/organisms/Confirmation/Confirmation.css +2 -2
- package/dist/esm/components/organisms/Confirmation/Confirmation.css.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js +28 -24
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteController.js +26 -15
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteController.js.map +1 -1
- package/dist/esm/components/organisms/FieldClock/FieldClock.js +1 -1
- package/dist/esm/components/organisms/FieldClock/FieldClock.js.map +1 -1
- package/dist/esm/components/organisms/FieldDate/FieldDate.js +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js +3 -23
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js.map +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelectController.d.ts +2 -2
- package/dist/esm/components/organisms/FieldSelect/FieldSelectController.js +13 -13
- package/dist/esm/components/organisms/FieldSelect/FieldSelectController.js.map +1 -1
- package/dist/esm/components/organisms/ImageChooser/ImageChooser.js +1 -1
- package/dist/esm/components/organisms/ImageChooser/ImageChooser.js.map +1 -1
- package/dist/esm/components/organisms/ImageEditor/ImageEditor.js +1 -1
- package/dist/esm/components/organisms/ImageEditor/ImageEditor.js.map +1 -1
- package/dist/esm/components/organisms/Modal/Modal.css +3 -3
- package/dist/esm/components/organisms/Modal/Modal.css.map +1 -1
- package/dist/esm/components/organisms/ModalSheet/ModalSheet.css +6 -3
- package/dist/esm/components/organisms/ModalSheet/ModalSheet.css.map +1 -1
- package/dist/esm/components/organisms/ModalSheet/ModalSheet.js +1 -1
- package/dist/esm/components/organisms/ModalSheet/ModalSheet.js.map +1 -1
- package/dist/esm/components/organisms/PickerDate/PickerDate.js +11 -10
- package/dist/esm/components/organisms/PickerDate/PickerDate.js.map +1 -1
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js +15 -19
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js.map +1 -1
- package/dist/esm/components/organisms/VirtualScroll/VirtualScroll.d.ts +8 -1
- package/dist/esm/components/organisms/VirtualScroll/VirtualScroll.js +14 -23
- package/dist/esm/components/organisms/VirtualScroll/VirtualScroll.js.map +1 -1
- package/dist/esm/controllers/FormSingleSelectionController.js +2 -2
- package/dist/esm/controllers/FormSingleSelectionController.js.map +1 -1
- package/dist/esm/controllers/ListController.d.ts +1 -1
- package/dist/esm/controllers/ListController.js +9 -9
- package/dist/esm/controllers/ListController.js.map +1 -1
- package/dist/esm/controllers/RelocationOnComponentController.js +1 -1
- package/dist/esm/controllers/RelocationOnComponentController.js.map +1 -1
- package/dist/esm/definitions.d.ts +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +5 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -527,8 +527,8 @@ function useFormSingleSelectionController({ disabled, formControl, onValue, valu
|
|
|
527
527
|
}, [formControl?.value]);
|
|
528
528
|
const onSelect = require$$0.useCallback(() => {
|
|
529
529
|
if (!disabled) {
|
|
530
|
-
formControl
|
|
531
|
-
onValue
|
|
530
|
+
formControl?.setValue(value);
|
|
531
|
+
onValue?.(value);
|
|
532
532
|
}
|
|
533
533
|
}, [formControl, value, onValue, disabled]);
|
|
534
534
|
return { checked, onSelect };
|
|
@@ -546,7 +546,7 @@ function RlsButtonOption({ icon, children, disabled, formControl, identifier, on
|
|
|
546
546
|
}, [checked]);
|
|
547
547
|
const onAction = require$$0.useCallback(() => {
|
|
548
548
|
onSelect();
|
|
549
|
-
onClick
|
|
549
|
+
onClick?.();
|
|
550
550
|
}, [onSelect, onClick]);
|
|
551
551
|
return (jsxRuntimeExports.jsxs("button", { id: identifier, className: className, onClick: onAction, disabled: disabled, children: [jsxRuntimeExports.jsx(RlsIcon, { value: icon }), children] }));
|
|
552
552
|
}
|
|
@@ -570,20 +570,17 @@ function RlsSkeleton({ rlsTheme }) {
|
|
|
570
570
|
|
|
571
571
|
function RlsImage({ src, rlsTheme }) {
|
|
572
572
|
const [srcIsComplet, setSrcIsComplet] = require$$0.useState(false);
|
|
573
|
-
const
|
|
573
|
+
const refImage = require$$0.useRef(null);
|
|
574
574
|
const className = require$$0.useMemo(() => {
|
|
575
575
|
return renderClassStatus('rls-image', { complet: srcIsComplet });
|
|
576
576
|
}, [srcIsComplet]);
|
|
577
577
|
require$$0.useEffect(() => {
|
|
578
|
-
|
|
579
|
-
setSrcIsComplet(false);
|
|
580
|
-
refSrc.current = src;
|
|
581
|
-
}
|
|
578
|
+
setSrcIsComplet(!!(src && refImage.current?.complete));
|
|
582
579
|
}, [src]);
|
|
583
580
|
const onLoad = require$$0.useCallback(() => {
|
|
584
581
|
setSrcIsComplet(true);
|
|
585
582
|
}, []);
|
|
586
|
-
return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [!srcIsComplet && jsxRuntimeExports.jsx(RlsSkeleton, { rlsTheme: rlsTheme }), jsxRuntimeExports.jsx("img", { src: src, onLoad: onLoad })] }));
|
|
583
|
+
return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [!srcIsComplet && jsxRuntimeExports.jsx(RlsSkeleton, { rlsTheme: rlsTheme }), jsxRuntimeExports.jsx("img", { ref: refImage, src: src, onLoad: onLoad })] }));
|
|
587
584
|
}
|
|
588
585
|
|
|
589
586
|
function RlsInput({ children, decimals, disabled, formControl, identifier, onBlur, onEnter, onFocus, onKeyDown, onKeyUp, onValue, placeholder, readOnly, type, value }) {
|
|
@@ -676,11 +673,11 @@ function RlsInputPassword({ disabled, formControl, identifier, onEnter, onKeyDow
|
|
|
676
673
|
onValue?.(event.target.value);
|
|
677
674
|
}, [formControl, onValue]);
|
|
678
675
|
const _onKeyDown = require$$0.useCallback((event) => {
|
|
679
|
-
onKeyDown
|
|
680
|
-
event.key === 'Enter' && onEnter
|
|
676
|
+
onKeyDown?.(event);
|
|
677
|
+
event.key === 'Enter' && onEnter?.();
|
|
681
678
|
}, [onKeyDown, onEnter]);
|
|
682
679
|
const _onKeyUp = require$$0.useCallback((event) => {
|
|
683
|
-
onKeyUp
|
|
680
|
+
onKeyUp?.(event);
|
|
684
681
|
}, [onKeyUp]);
|
|
685
682
|
const _onFocus = require$$0.useCallback(() => {
|
|
686
683
|
formControl?.focus();
|
|
@@ -828,11 +825,15 @@ function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsThem
|
|
|
828
825
|
setVisible(() => false);
|
|
829
826
|
automatic && onAction(action.value);
|
|
830
827
|
}, [onAction, automatic]);
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
828
|
+
const onClickAction = require$$0.useCallback(() => {
|
|
829
|
+
action && onAction(action.value);
|
|
830
|
+
}, [action, onAction]);
|
|
831
|
+
const onClickOption = require$$0.useCallback((event) => {
|
|
832
|
+
const index = Number(event.currentTarget.dataset.index);
|
|
833
|
+
const option = options[index];
|
|
834
|
+
option && onSelectAction(option);
|
|
835
|
+
}, [options, onSelectAction]);
|
|
836
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle", ref: componentRef, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle__content", children: [action && (jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__action", children: jsxRuntimeExports.jsx(RlsButton, { disabled: disabled, type: type, onClick: onClickAction, children: action.label }) })), jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__icon", children: jsxRuntimeExports.jsx(RlsButton, { type: type, prefixIcon: "arrow-ios-down", disabled: disabled, onClick: onClickMenu }) })] }), jsxRuntimeExports.jsx("div", { className: classNameList, children: jsxRuntimeExports.jsx("ul", { children: options.map((action, index) => (jsxRuntimeExports.jsx("li", { className: "rls-truncate", "data-index": index, onClick: onClickOption, children: action.label }, index))) }) })] }));
|
|
836
837
|
}
|
|
837
838
|
|
|
838
839
|
function RlsContent({ children, identifier, rlsTheme }) {
|
|
@@ -979,6 +980,106 @@ function RlsFieldDecimal(props) {
|
|
|
979
980
|
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { 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(RlsInputDecimal, { ...props }) }) }), !props.msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
980
981
|
}
|
|
981
982
|
|
|
983
|
+
function RlsFieldFile({ accept, children, disabled: disabledProp, formControl, identifier, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, value }) {
|
|
984
|
+
const inputRef = require$$0.useRef(null);
|
|
985
|
+
const disabled = require$$0.useMemo(() => formControl?.disabled || disabledProp, [formControl?.disabled, disabledProp]);
|
|
986
|
+
const className = require$$0.useMemo(() => renderClassStatus('rls-field-box', {
|
|
987
|
+
disabled,
|
|
988
|
+
error: formControl?.wrong,
|
|
989
|
+
focused: formControl?.focused && !disabled,
|
|
990
|
+
readonly: readOnly
|
|
991
|
+
}, 'rls-field-file'), [formControl?.focused, formControl?.wrong, readOnly, disabled]);
|
|
992
|
+
const currentFile = require$$0.useMemo(() => formControl?.value ?? value, [formControl?.value, value]);
|
|
993
|
+
const displayValue = require$$0.useMemo(() => {
|
|
994
|
+
return currentFile?.name ?? '';
|
|
995
|
+
}, [currentFile]);
|
|
996
|
+
const onClickAction = require$$0.useCallback((event) => {
|
|
997
|
+
if (currentFile) {
|
|
998
|
+
formControl?.setValue(undefined);
|
|
999
|
+
onValue?.(undefined);
|
|
1000
|
+
}
|
|
1001
|
+
else {
|
|
1002
|
+
inputRef.current?.click();
|
|
1003
|
+
}
|
|
1004
|
+
event.stopPropagation();
|
|
1005
|
+
}, [currentFile, formControl, onValue]);
|
|
1006
|
+
const onChangeInput = require$$0.useCallback((event) => {
|
|
1007
|
+
const file = event.target.files?.[0];
|
|
1008
|
+
if (file) {
|
|
1009
|
+
formControl?.setValue(file);
|
|
1010
|
+
onValue?.(file);
|
|
1011
|
+
}
|
|
1012
|
+
event.target.value = '';
|
|
1013
|
+
}, [formControl, onValue]);
|
|
1014
|
+
const onClickControl = require$$0.useCallback(() => {
|
|
1015
|
+
!readOnly && !disabled && inputRef.current?.click();
|
|
1016
|
+
}, [readOnly, disabled]);
|
|
1017
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", onClick: onClickControl, children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-input__component", readOnly: true, type: "text", value: displayValue, placeholder: placeholder }), jsxRuntimeExports.jsx("input", { ref: inputRef, className: "rls-field-file__input", type: "file", accept: accept, disabled: disabled || readOnly, onChange: onChangeInput }), jsxRuntimeExports.jsx(RlsButtonAction, { icon: currentFile ? 'close' : 'attach-2', disabled: disabled, onClick: onClickAction })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
const reactI18n = i18n.i18n({
|
|
1021
|
+
es: {
|
|
1022
|
+
confirmationActionApproved: 'Aceptar',
|
|
1023
|
+
dateActionCancel: 'Cancelar',
|
|
1024
|
+
dateActionSelect: 'Establecer',
|
|
1025
|
+
dateActionToday: 'Hoy',
|
|
1026
|
+
chooserImageActionCancel: 'Cancelar',
|
|
1027
|
+
editorImageActionRestore: 'Restaurar',
|
|
1028
|
+
editorImageActionSelect: 'Seleccionar',
|
|
1029
|
+
listEmptyDescription: 'Lo sentimos, en el momento no hay elementos en el listado',
|
|
1030
|
+
listEmptyTitle: 'Selección no disponible',
|
|
1031
|
+
listInputPlaceholder: 'Escriba palabre clave para filtrar...'
|
|
1032
|
+
},
|
|
1033
|
+
en: {
|
|
1034
|
+
confirmationActionApproved: 'Approved',
|
|
1035
|
+
dateActionCancel: 'Cancel',
|
|
1036
|
+
dateActionSelect: 'Select',
|
|
1037
|
+
dateActionToday: 'Today',
|
|
1038
|
+
chooserImageActionCancel: 'Cancel',
|
|
1039
|
+
editorImageActionRestore: 'Restore',
|
|
1040
|
+
editorImageActionSelect: 'Select',
|
|
1041
|
+
listEmptyDescription: 'Sorry, there are currently no items in the list',
|
|
1042
|
+
listEmptyTitle: 'Selection not available',
|
|
1043
|
+
listInputPlaceholder: 'Enter keyword to filter...'
|
|
1044
|
+
}
|
|
1045
|
+
});
|
|
1046
|
+
|
|
1047
|
+
function RlsFieldListLi({ element, onClickElement, onKeydownElement, render }) {
|
|
1048
|
+
const onClick = require$$0.useMemo(() => {
|
|
1049
|
+
return onClickElement(element);
|
|
1050
|
+
}, [element, onClickElement]);
|
|
1051
|
+
const onKeyDown = require$$0.useMemo(() => {
|
|
1052
|
+
return onKeydownElement(element);
|
|
1053
|
+
}, [element, onKeydownElement]);
|
|
1054
|
+
return (jsxRuntimeExports.jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: onClick, onKeyDown: onKeyDown, children: render(element) }));
|
|
1055
|
+
}
|
|
1056
|
+
function RlsFieldListSuggestions({ elements, disabled, higher, render, renderEmpty, searchControl, visible, onClickBackdrop, onClickElement, onKeydownElement, refList, rlsTheme }) {
|
|
1057
|
+
const [labels, setLabels] = require$$0.useState({
|
|
1058
|
+
listEmptyDescription: reactI18n('listEmptyDescription'),
|
|
1059
|
+
listEmptyTitle: reactI18n('listEmptyTitle')
|
|
1060
|
+
});
|
|
1061
|
+
require$$0.useEffect(() => {
|
|
1062
|
+
return i18n.i18nSubscribe(() => {
|
|
1063
|
+
setLabels({
|
|
1064
|
+
listEmptyDescription: reactI18n('listEmptyDescription'),
|
|
1065
|
+
listEmptyTitle: reactI18n('listEmptyTitle')
|
|
1066
|
+
});
|
|
1067
|
+
});
|
|
1068
|
+
}, []);
|
|
1069
|
+
const className = require$$0.useMemo(() => {
|
|
1070
|
+
return renderClassStatus('rls-field-list__suggestions', {
|
|
1071
|
+
disabled,
|
|
1072
|
+
higher,
|
|
1073
|
+
visible
|
|
1074
|
+
});
|
|
1075
|
+
}, [disabled, higher, visible]);
|
|
1076
|
+
const onChangePattern = require$$0.useCallback((event) => {
|
|
1077
|
+
searchControl?.onChange(event.target.value);
|
|
1078
|
+
}, [searchControl?.onChange]);
|
|
1079
|
+
const searching = searchControl?.searching ?? false;
|
|
1080
|
+
return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: refList, className: "rls-field-list__ul", children: [searchControl && (jsxRuntimeExports.jsxs("div", { className: "rls-field-list__ul__search", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-list__ul__control", ref: searchControl.refInput, type: "text", placeholder: searchControl.placeholder, value: searchControl.pattern, onChange: onChangePattern, onFocus: searchControl.onFocus, onBlur: searchControl.onBlur, onKeyDown: searchControl.onKeyDown, disabled: disabled || searching }), searchControl.onSearch && (jsxRuntimeExports.jsx("button", { disabled: disabled || searching, onClick: searchControl.onSearch, children: jsxRuntimeExports.jsx(RlsIcon, { value: "search" }) }))] })), searching && jsxRuntimeExports.jsx(RlsProgressBar, { indeterminate: true }), elements.map((element, index) => (jsxRuntimeExports.jsx(RlsFieldListLi, { element: element, onClickElement: onClickElement, onKeydownElement: onKeydownElement, render: render }, index))), !elements.length && (jsxRuntimeExports.jsx("li", { className: "rls-field-list__empty", children: renderEmpty ? (renderEmpty()) : (jsxRuntimeExports.jsxs("div", { className: "rls-field-list__empty__description", children: [jsxRuntimeExports.jsx("label", { className: "rls-label-bold rls-truncate", children: labels.listEmptyTitle }), jsxRuntimeExports.jsx("p", { className: "rls-caption-regular", children: labels.listEmptyDescription })] })) }))] }) }), jsxRuntimeExports.jsx("div", { className: "rls-field-list__backdrop", onClick: onClickBackdrop })] }));
|
|
1081
|
+
}
|
|
1082
|
+
|
|
982
1083
|
function RlsFieldMoney(props) {
|
|
983
1084
|
const { children, formControl, identifier, rlsTheme } = props;
|
|
984
1085
|
const disabled = require$$0.useMemo(() => {
|
|
@@ -1133,18 +1234,25 @@ function RlsNavbar({ children, identifier, rlsTheme }) {
|
|
|
1133
1234
|
return (jsxRuntimeExports.jsxs("nav", { id: identifier, className: "rls-app__page__nav", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-app__page__nav__content", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-app__page__nav__backdrop" })] }));
|
|
1134
1235
|
}
|
|
1135
1236
|
|
|
1237
|
+
function PageButton({ page, onSelect }) {
|
|
1238
|
+
const className = require$$0.useMemo(() => renderClassStatus('rls-pagination__page', { active: page.active }), [page.active]);
|
|
1239
|
+
const onClick = require$$0.useCallback(() => {
|
|
1240
|
+
onSelect(page);
|
|
1241
|
+
}, [page, onSelect]);
|
|
1242
|
+
return (jsxRuntimeExports.jsx("button", { type: "button", className: className, onClick: onClick, children: page.label }));
|
|
1243
|
+
}
|
|
1136
1244
|
function RlsPagination({ suggestions, count, filter, onPagination }) {
|
|
1137
1245
|
const [template, setTemplate] = require$$0.useState();
|
|
1138
1246
|
const controller = require$$0.useRef(undefined);
|
|
1139
1247
|
const refreshTemplate = require$$0.useCallback((template, suggestions) => {
|
|
1140
1248
|
const { firstPage, lastPage } = template;
|
|
1141
|
-
onPagination
|
|
1249
|
+
onPagination?.({ firstPage, lastPage, suggestions });
|
|
1142
1250
|
setTemplate(template);
|
|
1143
1251
|
}, [onPagination]);
|
|
1144
1252
|
const refreshPagination = require$$0.useCallback((pagination) => {
|
|
1145
1253
|
pagination &&
|
|
1146
1254
|
refreshTemplate(pagination.template, pagination.page.collection);
|
|
1147
|
-
}, []);
|
|
1255
|
+
}, [refreshTemplate]);
|
|
1148
1256
|
require$$0.useEffect(() => {
|
|
1149
1257
|
const pagination = new components.PaginationController({
|
|
1150
1258
|
suggestions,
|
|
@@ -1153,32 +1261,26 @@ function RlsPagination({ suggestions, count, filter, onPagination }) {
|
|
|
1153
1261
|
});
|
|
1154
1262
|
controller.current = pagination;
|
|
1155
1263
|
refreshTemplate(pagination.template, pagination.page.collection);
|
|
1156
|
-
}, [suggestions, count]);
|
|
1264
|
+
}, [suggestions, count, refreshTemplate]);
|
|
1157
1265
|
require$$0.useEffect(() => {
|
|
1158
1266
|
refreshPagination(controller.current?.filtrable(filter));
|
|
1159
|
-
}, [filter]);
|
|
1267
|
+
}, [filter, refreshPagination]);
|
|
1160
1268
|
const goToPagination = require$$0.useCallback((page) => {
|
|
1161
1269
|
refreshPagination(controller.current?.goToPage(page));
|
|
1162
|
-
}, []);
|
|
1270
|
+
}, [refreshPagination]);
|
|
1163
1271
|
const goFirstPagination = require$$0.useCallback(() => {
|
|
1164
1272
|
refreshPagination(controller.current?.goFirstPage());
|
|
1165
|
-
}, []);
|
|
1273
|
+
}, [refreshPagination]);
|
|
1166
1274
|
const goPreviousPagination = require$$0.useCallback(() => {
|
|
1167
1275
|
refreshPagination(controller.current?.goPreviousPage());
|
|
1168
|
-
}, []);
|
|
1276
|
+
}, [refreshPagination]);
|
|
1169
1277
|
const goNextPagination = require$$0.useCallback(() => {
|
|
1170
1278
|
refreshPagination(controller.current?.goNextPage());
|
|
1171
|
-
}, []);
|
|
1279
|
+
}, [refreshPagination]);
|
|
1172
1280
|
const goLastPagination = require$$0.useCallback(() => {
|
|
1173
1281
|
refreshPagination(controller.current?.goLastPage());
|
|
1174
|
-
}, []);
|
|
1175
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-pagination", children: [jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goFirstPagination, disabled: template?.firstPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrowhead-left" }) }), jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goPreviousPagination, disabled: template?.firstPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-left" }) })] }), jsxRuntimeExports.jsxs("div", { className: "rls-pagination__body", children: [jsxRuntimeExports.jsx("div", { className: "rls-pagination__pages", children: template?.pages.map((page,
|
|
1176
|
-
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-pagination__page', {
|
|
1177
|
-
active: page.active
|
|
1178
|
-
}), onClick: () => {
|
|
1179
|
-
goToPagination(page);
|
|
1180
|
-
}, children: page.label }, index));
|
|
1181
|
-
}) }), jsxRuntimeExports.jsx("div", { className: "rls-pagination__description", children: template?.description }), jsxRuntimeExports.jsx("span", { className: "rls-pagination__count", children: suggestions.length })] }), jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goNextPagination, disabled: template?.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-right" }) }), jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goLastPagination, disabled: template?.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrowhead-right" }) })] })] }));
|
|
1282
|
+
}, [refreshPagination]);
|
|
1283
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-pagination", children: [jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goFirstPagination, disabled: template?.firstPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrowhead-left" }) }), jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goPreviousPagination, disabled: template?.firstPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-left" }) })] }), jsxRuntimeExports.jsxs("div", { className: "rls-pagination__body", children: [jsxRuntimeExports.jsx("div", { className: "rls-pagination__pages", children: template?.pages.map((page) => (jsxRuntimeExports.jsx(PageButton, { page: page, onSelect: goToPagination }, page.value))) }), jsxRuntimeExports.jsx("div", { className: "rls-pagination__description", children: template?.description }), jsxRuntimeExports.jsx("span", { className: "rls-pagination__count", children: suggestions.length })] }), jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goNextPagination, disabled: template?.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-right" }) }), jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goLastPagination, disabled: template?.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrowhead-right" }) })] })] }));
|
|
1182
1284
|
}
|
|
1183
1285
|
|
|
1184
1286
|
function RlsPickerDayHeaders() {
|
|
@@ -1199,12 +1301,11 @@ function RlsPickerDayElement({ day, onSelect, disabled }) {
|
|
|
1199
1301
|
}, [day.value, day.disabled, disabled, onSelect]);
|
|
1200
1302
|
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-day__element__span", children: day.value || '??' }) }));
|
|
1201
1303
|
}
|
|
1202
|
-
function RlsPickerDay({ date
|
|
1203
|
-
const
|
|
1304
|
+
function RlsPickerDay({ date, disabled, formControl, maxDate, month, minDate, onValue, rlsTheme, year }) {
|
|
1305
|
+
const dateDay = require$$0.useMemo(() => date ?? new Date(), [date]);
|
|
1204
1306
|
const [weeks, setWeeks] = require$$0.useState([]);
|
|
1205
|
-
const [value, setValue] = require$$0.useState(formControl?.value
|
|
1206
|
-
const [
|
|
1207
|
-
const [component, setComponent] = require$$0.useState(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}));
|
|
1307
|
+
const [value, setValue] = require$$0.useState(formControl?.value ?? dateDay.getDate());
|
|
1308
|
+
const [_, setI18nVersion] = require$$0.useState(0);
|
|
1208
1309
|
const setDayValue = require$$0.useCallback((value) => {
|
|
1209
1310
|
formControl ? formControl.setValue(value) : setValue(value);
|
|
1210
1311
|
}, [formControl]);
|
|
@@ -1214,38 +1315,35 @@ function RlsPickerDay({ date: _date, disabled, formControl, maxDate, month, minD
|
|
|
1214
1315
|
}, [setDayValue, onValue]);
|
|
1215
1316
|
require$$0.useEffect(() => {
|
|
1216
1317
|
return i18n.i18nSubscribe(() => {
|
|
1217
|
-
|
|
1318
|
+
setI18nVersion((value) => value + 1);
|
|
1218
1319
|
});
|
|
1219
1320
|
}, []);
|
|
1220
|
-
require$$0.useEffect(() => {
|
|
1221
|
-
setComponent(jsxRuntimeExports.jsx("div", { className: "rls-picker-day__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__week", children: days.map((day, index) => (jsxRuntimeExports.jsx(RlsPickerDayElement, { day: day, onSelect: onSelect, disabled: disabled }, index))) }, index))) }));
|
|
1222
|
-
}, [weeks, onSelect, disabled]);
|
|
1223
1321
|
require$$0.useEffect(() => {
|
|
1224
1322
|
const options = createPickerOptions();
|
|
1225
1323
|
const day = components.verifyDayPicker(options);
|
|
1226
1324
|
day ? setDayValue(day) : setWeeks(components.createDayPicker(options));
|
|
1227
|
-
}, [
|
|
1325
|
+
}, [dateDay, month, year, value, minDate, maxDate]);
|
|
1228
1326
|
require$$0.useEffect(() => {
|
|
1229
1327
|
const day = components.verifyDayPicker(createPickerOptions());
|
|
1230
1328
|
day
|
|
1231
1329
|
? formControl?.setValue(day)
|
|
1232
|
-
: setValue(formControl?.value ||
|
|
1330
|
+
: setValue(formControl?.value || dateDay.getDate());
|
|
1233
1331
|
}, [formControl?.value]);
|
|
1234
1332
|
const createPickerOptions = require$$0.useCallback(() => {
|
|
1235
1333
|
return {
|
|
1236
|
-
date,
|
|
1334
|
+
date: dateDay,
|
|
1237
1335
|
day: formControl?.value ?? value,
|
|
1238
|
-
month: month ??
|
|
1239
|
-
year: year ??
|
|
1336
|
+
month: month ?? dateDay.getMonth(),
|
|
1337
|
+
year: year ?? dateDay.getFullYear(),
|
|
1240
1338
|
minDate,
|
|
1241
1339
|
maxDate
|
|
1242
1340
|
};
|
|
1243
|
-
}, [
|
|
1244
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-day", "rls-theme": rlsTheme, children: [
|
|
1341
|
+
}, [dateDay, formControl?.value, value, month, year, minDate, maxDate]);
|
|
1342
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-day", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx(RlsPickerDayHeaders, {}), jsxRuntimeExports.jsx("div", { className: "rls-picker-day__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__week", children: days.map((day, index) => (jsxRuntimeExports.jsx(RlsPickerDayElement, { day: day, onSelect: onSelect, disabled: disabled }, index))) }, index))) })] }));
|
|
1245
1343
|
}
|
|
1246
1344
|
|
|
1247
1345
|
function RlsPickerDayRangeHeaders() {
|
|
1248
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__header", children: dates.DAY_LABELS().map((title, index) => (jsxRuntimeExports.jsx("
|
|
1346
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__header", children: dates.DAY_LABELS().map((title, index) => (jsxRuntimeExports.jsx("span", { className: "rls-picker-day__label", children: title }, index))) }));
|
|
1249
1347
|
}
|
|
1250
1348
|
function RlsPickerDayRangeElement({ day, onSelect, disabled }) {
|
|
1251
1349
|
const className = require$$0.useMemo(() => {
|
|
@@ -1262,45 +1360,41 @@ function RlsPickerDayRangeElement({ day, onSelect, disabled }) {
|
|
|
1262
1360
|
}, [day.value, day.disabled, disabled, onSelect]);
|
|
1263
1361
|
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-day-range__element__span", children: day.value || '??' }) }));
|
|
1264
1362
|
}
|
|
1265
|
-
function RlsPickerDayRange({ date
|
|
1266
|
-
const
|
|
1363
|
+
function RlsPickerDayRange({ date, disabled, formControl, maxDate, minDate, rlsTheme }) {
|
|
1364
|
+
const rangeDay = require$$0.useMemo(() => {
|
|
1267
1365
|
return formControl?.value ?? dates.DateRange.now();
|
|
1268
1366
|
}, [formControl?.value]);
|
|
1269
|
-
const
|
|
1270
|
-
return dates.normalizeMinTime(
|
|
1271
|
-
}, [
|
|
1272
|
-
const sourceDate = require$$0.useRef(
|
|
1367
|
+
const dateDayRange = require$$0.useMemo(() => {
|
|
1368
|
+
return dates.normalizeMinTime(date ?? rangeDay.minDate);
|
|
1369
|
+
}, [date, rangeDay]);
|
|
1370
|
+
const sourceDate = require$$0.useRef(rangeDay.minDate);
|
|
1273
1371
|
const [weeks, setWeeks] = require$$0.useState([]);
|
|
1274
|
-
const [range, setRange] = require$$0.useState(
|
|
1275
|
-
const [
|
|
1276
|
-
const [component, setComponent] = require$$0.useState(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}));
|
|
1372
|
+
const [range, setRange] = require$$0.useState(rangeDay);
|
|
1373
|
+
const [_, setI18nVersion] = require$$0.useState(0);
|
|
1277
1374
|
const onSelect = require$$0.useCallback((value) => {
|
|
1278
|
-
const
|
|
1279
|
-
const range = dates.dateIsBefore(
|
|
1280
|
-
? new dates.DateRange(sourceDate.current,
|
|
1281
|
-
: new dates.DateRange(
|
|
1282
|
-
sourceDate.current =
|
|
1375
|
+
const date = dates.assignDayInDate(dateDayRange, value);
|
|
1376
|
+
const range = dates.dateIsBefore(date, sourceDate.current)
|
|
1377
|
+
? new dates.DateRange(sourceDate.current, date)
|
|
1378
|
+
: new dates.DateRange(date, sourceDate.current);
|
|
1379
|
+
sourceDate.current = date;
|
|
1283
1380
|
setRange(range);
|
|
1284
1381
|
formControl?.setValue(range);
|
|
1285
|
-
}, [
|
|
1382
|
+
}, [dateDayRange, formControl]);
|
|
1286
1383
|
require$$0.useEffect(() => {
|
|
1287
1384
|
return i18n.i18nSubscribe(() => {
|
|
1288
|
-
|
|
1385
|
+
setI18nVersion((value) => value + 1);
|
|
1289
1386
|
});
|
|
1290
1387
|
}, []);
|
|
1291
|
-
require$$0.useEffect(() => {
|
|
1292
|
-
setComponent(jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__week", children: days.map((day, index) => (jsxRuntimeExports.jsx(RlsPickerDayRangeElement, { day: day, onSelect: onSelect, disabled: disabled }, index))) }, index))) }));
|
|
1293
|
-
}, [weeks, onSelect, disabled]);
|
|
1294
1388
|
require$$0.useEffect(() => {
|
|
1295
1389
|
setWeeks(components.createDayRangePicker({
|
|
1296
|
-
date,
|
|
1390
|
+
date: dateDayRange,
|
|
1297
1391
|
range,
|
|
1298
1392
|
sourceDate: sourceDate.current,
|
|
1299
1393
|
minDate,
|
|
1300
1394
|
maxDate
|
|
1301
1395
|
}));
|
|
1302
|
-
}, [
|
|
1303
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-day-range", "rls-theme": rlsTheme, children: [
|
|
1396
|
+
}, [dateDayRange, range, minDate, maxDate]);
|
|
1397
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-day-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx(RlsPickerDayRangeHeaders, {}), jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__week", children: days.map((day, index) => (jsxRuntimeExports.jsx(RlsPickerDayRangeElement, { day: day, onSelect: onSelect, disabled: disabled }, index))) }, index))) })] }));
|
|
1304
1398
|
}
|
|
1305
1399
|
|
|
1306
1400
|
function RlsPickerMonthElement({ month, onSelect, disabled }) {
|
|
@@ -1325,11 +1419,10 @@ function RlsPickerMonthElement({ month, onSelect, disabled }) {
|
|
|
1325
1419
|
}, [month.value, month.disabled, disabled, onSelect]);
|
|
1326
1420
|
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-month__span", children: label }) }));
|
|
1327
1421
|
}
|
|
1328
|
-
function RlsPickerMonth({ date
|
|
1329
|
-
const
|
|
1422
|
+
function RlsPickerMonth({ date, disabled, formControl, maxDate, minDate, onValue, rlsTheme, year }) {
|
|
1423
|
+
const dateMonth = require$$0.useMemo(() => date ?? new Date(), [date]);
|
|
1330
1424
|
const [months, setMonths] = require$$0.useState([]);
|
|
1331
|
-
const [value, setValue] = require$$0.useState(formControl?.value ??
|
|
1332
|
-
const [component, setComponent] = require$$0.useState(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}));
|
|
1425
|
+
const [value, setValue] = require$$0.useState(formControl?.value ?? dateMonth.getMonth());
|
|
1333
1426
|
const setMonthValue = require$$0.useCallback((value) => {
|
|
1334
1427
|
formControl ? formControl.setValue(value) : setValue(value);
|
|
1335
1428
|
}, [formControl]);
|
|
@@ -1337,14 +1430,11 @@ function RlsPickerMonth({ date: _date, disabled, formControl, maxDate, minDate,
|
|
|
1337
1430
|
setMonthValue(value);
|
|
1338
1431
|
onValue?.(value);
|
|
1339
1432
|
}, [setMonthValue, onValue]);
|
|
1340
|
-
require$$0.useEffect(() => {
|
|
1341
|
-
setComponent(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: months.map((month, index) => (jsxRuntimeExports.jsx(RlsPickerMonthElement, { month: month, onSelect: onSelect, disabled: disabled }, index))) }));
|
|
1342
|
-
}, [months, onSelect, disabled]);
|
|
1343
1433
|
require$$0.useEffect(() => {
|
|
1344
1434
|
const options = {
|
|
1345
|
-
date,
|
|
1435
|
+
date: dateMonth,
|
|
1346
1436
|
month: formControl?.value ?? value,
|
|
1347
|
-
year: year ??
|
|
1437
|
+
year: year ?? dateMonth.getFullYear(),
|
|
1348
1438
|
minDate,
|
|
1349
1439
|
maxDate
|
|
1350
1440
|
};
|
|
@@ -1352,20 +1442,20 @@ function RlsPickerMonth({ date: _date, disabled, formControl, maxDate, minDate,
|
|
|
1352
1442
|
commons.valueIsDefined(month)
|
|
1353
1443
|
? setMonthValue(month)
|
|
1354
1444
|
: setMonths(components.createMonthPicker(options));
|
|
1355
|
-
}, [
|
|
1445
|
+
}, [dateMonth, year, value, minDate, maxDate]);
|
|
1356
1446
|
require$$0.useEffect(() => {
|
|
1357
1447
|
const month = components.verifyMonthPicker({
|
|
1358
|
-
date,
|
|
1448
|
+
date: dateMonth,
|
|
1359
1449
|
month: formControl?.value ?? value,
|
|
1360
|
-
year: year ??
|
|
1450
|
+
year: year ?? dateMonth.getFullYear(),
|
|
1361
1451
|
minDate,
|
|
1362
1452
|
maxDate
|
|
1363
1453
|
});
|
|
1364
1454
|
commons.valueIsDefined(month)
|
|
1365
1455
|
? formControl?.setValue(month)
|
|
1366
|
-
: setValue(formControl?.value ??
|
|
1456
|
+
: setValue(formControl?.value ?? dateMonth.getMonth());
|
|
1367
1457
|
}, [formControl?.value]);
|
|
1368
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-month", "rls-theme": rlsTheme, children:
|
|
1458
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-month", "rls-theme": rlsTheme, children: months.map((month, index) => (jsxRuntimeExports.jsx(RlsPickerMonthElement, { month: month, onSelect: onSelect, disabled: disabled }, index))) }));
|
|
1369
1459
|
}
|
|
1370
1460
|
|
|
1371
1461
|
function RlsPickerSelectorTitle({ monthControl, type, yearControl, date, disabled, maxDate, minDate, onClick }) {
|
|
@@ -1399,10 +1489,10 @@ function RlsPickerSelectorTitle({ monthControl, type, yearControl, date, disable
|
|
|
1399
1489
|
}
|
|
1400
1490
|
}, [monthControl.value, yearControl.value]);
|
|
1401
1491
|
const onMonth = require$$0.useCallback(() => {
|
|
1402
|
-
onClick
|
|
1492
|
+
onClick?.('month');
|
|
1403
1493
|
}, [onClick]);
|
|
1404
1494
|
const onYear = require$$0.useCallback(() => {
|
|
1405
|
-
onClick
|
|
1495
|
+
onClick?.('year');
|
|
1406
1496
|
}, [onClick]);
|
|
1407
1497
|
const onPreviousYear = require$$0.useCallback(() => {
|
|
1408
1498
|
commons.valueIsDefined(yearControl.value) &&
|
|
@@ -1446,19 +1536,18 @@ function RlsPickerYearElement({ onSelect, year, disabled }) {
|
|
|
1446
1536
|
}, [year.value, year.disabled, disabled, onSelect]);
|
|
1447
1537
|
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-year__span", children: year.value || '????' }) }));
|
|
1448
1538
|
}
|
|
1449
|
-
function RlsPickerYear({ date
|
|
1450
|
-
const
|
|
1451
|
-
const [value, setValue] = require$$0.useState(formControl?.value ??
|
|
1452
|
-
const [year, setYear] = require$$0.useState(formControl?.value ??
|
|
1453
|
-
const [component, setComponent] = require$$0.useState(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}));
|
|
1539
|
+
function RlsPickerYear({ date, disabled, formControl, maxDate, minDate, onValue, rlsTheme }) {
|
|
1540
|
+
const dateYear = require$$0.useMemo(() => date ?? new Date(), [date]);
|
|
1541
|
+
const [value, setValue] = require$$0.useState(formControl?.value ?? dateYear.getFullYear());
|
|
1542
|
+
const [year, setYear] = require$$0.useState(formControl?.value ?? dateYear.getFullYear());
|
|
1454
1543
|
const createPickerOptions = require$$0.useCallback(() => {
|
|
1455
1544
|
return {
|
|
1456
|
-
date,
|
|
1545
|
+
date: dateYear,
|
|
1457
1546
|
year,
|
|
1458
1547
|
minDate,
|
|
1459
1548
|
maxDate
|
|
1460
1549
|
};
|
|
1461
|
-
}, [
|
|
1550
|
+
}, [dateYear, year, minDate, maxDate]);
|
|
1462
1551
|
const [template, setTemplate] = require$$0.useState(components.createYearPicker(createPickerOptions()));
|
|
1463
1552
|
const setYearValue = require$$0.useCallback((value) => {
|
|
1464
1553
|
formControl ? formControl.setValue(value) : setValue(value);
|
|
@@ -1472,15 +1561,12 @@ function RlsPickerYear({ date: _date, disabled, formControl, maxDate, minDate, o
|
|
|
1472
1561
|
const options = createPickerOptions(); // YearPickerProps
|
|
1473
1562
|
const year = components.verifyYearPicker(options);
|
|
1474
1563
|
year ? setYearValue(year) : setTemplate(components.createYearPicker(options));
|
|
1475
|
-
}, [
|
|
1476
|
-
require$$0.useEffect(() => {
|
|
1477
|
-
setComponent(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: template.years.map((year, index) => (jsxRuntimeExports.jsx(RlsPickerYearElement, { year: year, onSelect: onSelect, disabled: disabled }, index))) }));
|
|
1478
|
-
}, [template.years, onSelect, disabled]);
|
|
1564
|
+
}, [dateYear, year, value, minDate, maxDate]);
|
|
1479
1565
|
require$$0.useEffect(() => {
|
|
1480
1566
|
const year = components.verifyYearPicker(createPickerOptions());
|
|
1481
1567
|
commons.valueIsDefined(year)
|
|
1482
1568
|
? formControl?.setValue(year)
|
|
1483
|
-
: setValue(formControl?.value ??
|
|
1569
|
+
: setValue(formControl?.value ?? dateYear.getFullYear());
|
|
1484
1570
|
}, [formControl?.value]);
|
|
1485
1571
|
const onClickPrev = require$$0.useCallback(() => {
|
|
1486
1572
|
setYear((year) => year - 8);
|
|
@@ -1488,7 +1574,7 @@ function RlsPickerYear({ date: _date, disabled, formControl, maxDate, minDate, o
|
|
|
1488
1574
|
const onClickNext = require$$0.useCallback(() => {
|
|
1489
1575
|
setYear((year) => year + 8);
|
|
1490
1576
|
}, []);
|
|
1491
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-year", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-year__header", children: [jsxRuntimeExports.jsx("button", { className: "rls-picker-year__action rls-picker-year__action--prev", onClick: onClickPrev, disabled: !template.canPrevious || disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-left" }) }), jsxRuntimeExports.jsxs("span", { children: [template.minRange, " - ", template.maxRange] }), jsxRuntimeExports.jsx("button", { className: "rls-picker-year__action rls-picker-year__action--next", onClick: onClickNext, disabled: !template.canNext || disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-right" }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-year__component", children:
|
|
1577
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-year", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-year__header", children: [jsxRuntimeExports.jsx("button", { className: "rls-picker-year__action rls-picker-year__action--prev", onClick: onClickPrev, disabled: !template.canPrevious || disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-left" }) }), jsxRuntimeExports.jsxs("span", { children: [template.minRange, " - ", template.maxRange] }), jsxRuntimeExports.jsx("button", { className: "rls-picker-year__action rls-picker-year__action--next", onClick: onClickNext, disabled: !template.canNext || disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-right" }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-year__component", children: template.years.map((year, index) => (jsxRuntimeExports.jsx(RlsPickerYearElement, { year: year, onSelect: onSelect, disabled: disabled }, index))) })] }));
|
|
1492
1578
|
}
|
|
1493
1579
|
|
|
1494
1580
|
function calculateInitialValue(value, minValue, maxValue) {
|
|
@@ -1499,51 +1585,51 @@ function calculateInitialRate(value, minValue, maxValue) {
|
|
|
1499
1585
|
const rateValue = value - minValue;
|
|
1500
1586
|
return Math.ceil((rateValue / rateMax) * 100);
|
|
1501
1587
|
}
|
|
1502
|
-
function RlsSlider(
|
|
1503
|
-
const
|
|
1504
|
-
return
|
|
1505
|
-
}, [
|
|
1506
|
-
const
|
|
1507
|
-
return
|
|
1508
|
-
}, [
|
|
1509
|
-
const [
|
|
1510
|
-
const [rate, setRate] = require$$0.useState(calculateInitialRate(
|
|
1588
|
+
function RlsSlider({ children, className, disabled, formControl, identifier, maxValue, minValue, onValue, prefixIcon, rlsTheme, value }) {
|
|
1589
|
+
const minValueSlider = require$$0.useMemo(() => {
|
|
1590
|
+
return minValue ?? 0;
|
|
1591
|
+
}, [minValue]);
|
|
1592
|
+
const maxValueSlider = require$$0.useMemo(() => {
|
|
1593
|
+
return maxValue ?? 100;
|
|
1594
|
+
}, [maxValue]);
|
|
1595
|
+
const [valueSlider, setValue] = require$$0.useState(calculateInitialValue(formControl?.value ?? value ?? 0, minValueSlider, maxValueSlider));
|
|
1596
|
+
const [rate, setRate] = require$$0.useState(calculateInitialRate(valueSlider, minValueSlider, maxValueSlider));
|
|
1511
1597
|
const refComponent = require$$0.useRef(null);
|
|
1512
1598
|
const refTrack = require$$0.useRef(null);
|
|
1513
1599
|
const refTrackOn = require$$0.useRef(null);
|
|
1514
1600
|
const refThumb = require$$0.useRef(null);
|
|
1515
|
-
const
|
|
1601
|
+
const classNameSlider = require$$0.useMemo(() => {
|
|
1516
1602
|
return renderClassStatus('rls-slider', {
|
|
1517
|
-
complet:
|
|
1518
|
-
disabled:
|
|
1519
|
-
empty:
|
|
1520
|
-
});
|
|
1521
|
-
}, [
|
|
1603
|
+
complet: valueSlider === maxValueSlider,
|
|
1604
|
+
disabled: disabled,
|
|
1605
|
+
empty: valueSlider === minValueSlider
|
|
1606
|
+
}, className);
|
|
1607
|
+
}, [valueSlider, minValueSlider, maxValueSlider, disabled]);
|
|
1522
1608
|
require$$0.useEffect(() => {
|
|
1523
|
-
const valueInitial =
|
|
1609
|
+
const valueInitial = formControl?.value ?? value ?? 0;
|
|
1524
1610
|
refThumb.current.style.left = `${rate}%`;
|
|
1525
1611
|
refTrackOn.current.style.width = `${rate}%`;
|
|
1526
|
-
if (valueInitial !==
|
|
1527
|
-
|
|
1528
|
-
|
|
1612
|
+
if (valueInitial !== valueSlider) {
|
|
1613
|
+
formControl?.setValue(valueSlider);
|
|
1614
|
+
onValue?.(valueSlider);
|
|
1529
1615
|
}
|
|
1530
1616
|
}, []);
|
|
1531
1617
|
const calculateValueWithRate = require$$0.useCallback((rate) => {
|
|
1532
|
-
const value = Math.ceil(((
|
|
1618
|
+
const value = Math.ceil(((maxValueSlider - minValueSlider) * rate) / 100);
|
|
1533
1619
|
refThumb.current.style.left = `${rate}%`;
|
|
1534
1620
|
refTrackOn.current.style.width = `${rate}%`;
|
|
1535
|
-
const sliderValue = value +
|
|
1621
|
+
const sliderValue = value + minValueSlider;
|
|
1536
1622
|
setRate(rate);
|
|
1537
1623
|
setValue(sliderValue);
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
}, [
|
|
1624
|
+
formControl?.setValue(sliderValue);
|
|
1625
|
+
onValue?.(sliderValue);
|
|
1626
|
+
}, [minValueSlider, maxValueSlider, formControl, onValue]);
|
|
1541
1627
|
const onClickTrack = require$$0.useCallback((event) => {
|
|
1542
1628
|
const { left, width } = refTrack.current.getBoundingClientRect();
|
|
1543
1629
|
const rate = Math.ceil(((event.clientX - left) / width) * 100);
|
|
1544
1630
|
calculateValueWithRate(rate);
|
|
1545
|
-
}, [
|
|
1546
|
-
return (jsxRuntimeExports.jsxs("div", { className:
|
|
1631
|
+
}, [minValueSlider, maxValueSlider]);
|
|
1632
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: classNameSlider, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-slider__label", children: children }), jsxRuntimeExports.jsxs("div", { className: "rls-slider__body", children: [prefixIcon && jsxRuntimeExports.jsx(RlsIcon, { value: prefixIcon }), jsxRuntimeExports.jsxs("div", { ref: refComponent, className: "rls-slider__component", children: [jsxRuntimeExports.jsx("div", { ref: refTrack, className: "rls-slider__track", onClick: onClickTrack, children: jsxRuntimeExports.jsx("div", { ref: refTrackOn, className: "rls-slider__track__on" }) }), jsxRuntimeExports.jsxs("div", { ref: refThumb, className: "rls-slider__thumb", children: [rate, "%"] })] })] })] }));
|
|
1547
1633
|
}
|
|
1548
1634
|
|
|
1549
1635
|
function RlsTab({ onSelect, tab, value }) {
|
|
@@ -1595,33 +1681,6 @@ function RlsCard({ children, className, outline, rlsTheme }) {
|
|
|
1595
1681
|
return (jsxRuntimeExports.jsx("div", { className: classNameCard, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-card__content", children: children }) }));
|
|
1596
1682
|
}
|
|
1597
1683
|
|
|
1598
|
-
const reactI18n = i18n.i18n({
|
|
1599
|
-
es: {
|
|
1600
|
-
confirmationActionApproved: 'Aceptar',
|
|
1601
|
-
dateActionCancel: 'Cancelar',
|
|
1602
|
-
dateActionSelect: 'Establecer',
|
|
1603
|
-
dateActionToday: 'Hoy',
|
|
1604
|
-
chooserImageActionCancel: 'Cancelar',
|
|
1605
|
-
editorImageActionRestore: 'Restaurar',
|
|
1606
|
-
editorImageActionSelect: 'Seleccionar',
|
|
1607
|
-
listEmptyDescription: 'Lo sentimos, en el momento no hay elementos en el listado',
|
|
1608
|
-
listEmptyTitle: 'Selección no disponible',
|
|
1609
|
-
listInputPlaceholder: 'Escriba palabre clave para filtrar...'
|
|
1610
|
-
},
|
|
1611
|
-
en: {
|
|
1612
|
-
confirmationActionApproved: 'Approved',
|
|
1613
|
-
dateActionCancel: 'Cancel',
|
|
1614
|
-
dateActionSelect: 'Select',
|
|
1615
|
-
dateActionToday: 'Today',
|
|
1616
|
-
chooserImageActionCancel: 'Cancel',
|
|
1617
|
-
editorImageActionRestore: 'Restore',
|
|
1618
|
-
editorImageActionSelect: 'Select',
|
|
1619
|
-
listEmptyDescription: 'Sorry, there are currently no items in the list',
|
|
1620
|
-
listEmptyTitle: 'Selection not available',
|
|
1621
|
-
listInputPlaceholder: 'Enter keyword to filter...'
|
|
1622
|
-
}
|
|
1623
|
-
});
|
|
1624
|
-
|
|
1625
1684
|
class ConfirmationResult extends commons.SealedPartial {
|
|
1626
1685
|
static approved() {
|
|
1627
1686
|
return new ConfirmationResult('approved');
|
|
@@ -1789,7 +1848,7 @@ function useListController(props) {
|
|
|
1789
1848
|
const [state, refreshState] = require$$0.useState({
|
|
1790
1849
|
focused: false,
|
|
1791
1850
|
higher: false,
|
|
1792
|
-
|
|
1851
|
+
listIsVisible: false,
|
|
1793
1852
|
value: ''
|
|
1794
1853
|
});
|
|
1795
1854
|
const changeValueInternal = require$$0.useRef(false);
|
|
@@ -1798,7 +1857,7 @@ function useListController(props) {
|
|
|
1798
1857
|
require$$0.useEffect(() => {
|
|
1799
1858
|
function onCloseSuggestions({ target }) {
|
|
1800
1859
|
!refContent?.current?.contains(target) &&
|
|
1801
|
-
refreshState((state) => ({ ...state,
|
|
1860
|
+
refreshState((state) => ({ ...state, listIsVisible: false }));
|
|
1802
1861
|
}
|
|
1803
1862
|
document.addEventListener('click', onCloseSuggestions);
|
|
1804
1863
|
return () => {
|
|
@@ -1806,13 +1865,13 @@ function useListController(props) {
|
|
|
1806
1865
|
};
|
|
1807
1866
|
}, []);
|
|
1808
1867
|
require$$0.useEffect(() => {
|
|
1809
|
-
if (!listIsOpen.current && state.
|
|
1868
|
+
if (!listIsOpen.current && state.listIsVisible) {
|
|
1810
1869
|
listIsOpen.current = true;
|
|
1811
1870
|
}
|
|
1812
|
-
if (listIsOpen.current && !state.
|
|
1871
|
+
if (listIsOpen.current && !state.listIsVisible) {
|
|
1813
1872
|
formControl?.touch();
|
|
1814
1873
|
}
|
|
1815
|
-
}, [state.
|
|
1874
|
+
}, [state.listIsVisible]);
|
|
1816
1875
|
require$$0.useEffect(() => {
|
|
1817
1876
|
setCollection(new components.ListCollection(suggestions, reference));
|
|
1818
1877
|
}, [suggestions]);
|
|
@@ -1844,7 +1903,7 @@ function useListController(props) {
|
|
|
1844
1903
|
}, [collection, formControl?.value]);
|
|
1845
1904
|
const setState = require$$0.useCallback((state) => {
|
|
1846
1905
|
const minHeightList = calculateMinHeightList(count, lineHeight ?? 48);
|
|
1847
|
-
const _state = state.
|
|
1906
|
+
const _state = state.listIsVisible
|
|
1848
1907
|
? {
|
|
1849
1908
|
...state,
|
|
1850
1909
|
higher: components.locationListCanTop(refContent.current, refList.current, minHeightList)
|
|
@@ -1863,7 +1922,7 @@ function useListController(props) {
|
|
|
1863
1922
|
: formControl?.setValue(element?.value);
|
|
1864
1923
|
}, [formControl]);
|
|
1865
1924
|
const navigationInput = require$$0.useCallback((event) => {
|
|
1866
|
-
if (state.
|
|
1925
|
+
if (state.listIsVisible) {
|
|
1867
1926
|
const _position = components.navigationListFromInput({
|
|
1868
1927
|
content: refContent.current,
|
|
1869
1928
|
event: event,
|
|
@@ -1871,7 +1930,7 @@ function useListController(props) {
|
|
|
1871
1930
|
});
|
|
1872
1931
|
position.current = _position ?? 0;
|
|
1873
1932
|
}
|
|
1874
|
-
}, [state.
|
|
1933
|
+
}, [state.listIsVisible]);
|
|
1875
1934
|
const navigationElement = require$$0.useCallback((event) => {
|
|
1876
1935
|
position.current = components.navigationListFromElement({
|
|
1877
1936
|
content: refContent.current,
|
|
@@ -1880,7 +1939,7 @@ function useListController(props) {
|
|
|
1880
1939
|
list: refList.current,
|
|
1881
1940
|
position: position.current
|
|
1882
1941
|
});
|
|
1883
|
-
}, [state.
|
|
1942
|
+
}, [state.listIsVisible]);
|
|
1884
1943
|
return {
|
|
1885
1944
|
...state,
|
|
1886
1945
|
navigationElement,
|
|
@@ -1908,6 +1967,9 @@ function useFieldAutocomplete(props) {
|
|
|
1908
1967
|
pattern: '',
|
|
1909
1968
|
previous: null
|
|
1910
1969
|
});
|
|
1970
|
+
const focusTimeoutId = require$$0.useRef(undefined);
|
|
1971
|
+
const rebootIsRequired = require$$0.useRef(true);
|
|
1972
|
+
const prevSuggestions = require$$0.useRef(props.suggestions);
|
|
1911
1973
|
const refreshCoincidences = require$$0.useCallback((suggestions, pattern, reboot = false) => {
|
|
1912
1974
|
const { collection, store } = components.createAutocompleteStore({
|
|
1913
1975
|
pattern,
|
|
@@ -1921,14 +1983,14 @@ function useFieldAutocomplete(props) {
|
|
|
1921
1983
|
count.current = coincidences.length;
|
|
1922
1984
|
}, []);
|
|
1923
1985
|
require$$0.useEffect(() => {
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
refreshCoincidences(props.suggestions, pattern);
|
|
1928
|
-
}, [pattern]);
|
|
1986
|
+
const reboot = rebootIsRequired.current || prevSuggestions.current !== props.suggestions;
|
|
1987
|
+
rebootIsRequired.current = false;
|
|
1988
|
+
prevSuggestions.current = props.suggestions;
|
|
1989
|
+
refreshCoincidences(props.suggestions, pattern, reboot);
|
|
1990
|
+
}, [props.suggestions, pattern]);
|
|
1929
1991
|
require$$0.useEffect(() => {
|
|
1930
1992
|
props.disabled && controller.setState({ focused: false });
|
|
1931
|
-
}, [props.disabled]);
|
|
1993
|
+
}, [props.disabled, controller.setState]);
|
|
1932
1994
|
const onFocusInput = require$$0.useCallback(() => {
|
|
1933
1995
|
controller.setState({ focused: true });
|
|
1934
1996
|
}, [controller.setState]);
|
|
@@ -1939,7 +2001,7 @@ function useFieldAutocomplete(props) {
|
|
|
1939
2001
|
switch (event.code) {
|
|
1940
2002
|
case 'Escape':
|
|
1941
2003
|
case 'Tab':
|
|
1942
|
-
controller.setState({
|
|
2004
|
+
controller.setState({ listIsVisible: false });
|
|
1943
2005
|
break;
|
|
1944
2006
|
default:
|
|
1945
2007
|
controller.navigationInput(event);
|
|
@@ -1948,17 +2010,23 @@ function useFieldAutocomplete(props) {
|
|
|
1948
2010
|
}, [controller.setState, controller.navigationInput]);
|
|
1949
2011
|
const onClickControl = require$$0.useCallback(() => {
|
|
1950
2012
|
if (!props.readOnly) {
|
|
1951
|
-
controller.setState({
|
|
1952
|
-
|
|
2013
|
+
controller.setState({ listIsVisible: true });
|
|
2014
|
+
clearTimeout(focusTimeoutId.current);
|
|
2015
|
+
focusTimeoutId.current = setTimeout(() => {
|
|
1953
2016
|
controller.refInput?.current?.focus();
|
|
1954
2017
|
}, DURATION_ANIMATION$1);
|
|
1955
2018
|
}
|
|
1956
2019
|
}, [controller.setState, props.readOnly]);
|
|
2020
|
+
require$$0.useEffect(() => {
|
|
2021
|
+
return () => {
|
|
2022
|
+
clearTimeout(focusTimeoutId.current);
|
|
2023
|
+
};
|
|
2024
|
+
}, []);
|
|
1957
2025
|
const onClickAction = require$$0.useCallback(() => {
|
|
1958
2026
|
if (controller.value) {
|
|
1959
|
-
controller.setState({
|
|
2027
|
+
controller.setState({ listIsVisible: false });
|
|
1960
2028
|
controller.setFormValue(undefined);
|
|
1961
|
-
props.onValue
|
|
2029
|
+
props.onValue?.(props.value);
|
|
1962
2030
|
}
|
|
1963
2031
|
else {
|
|
1964
2032
|
onClickControl();
|
|
@@ -1967,10 +2035,12 @@ function useFieldAutocomplete(props) {
|
|
|
1967
2035
|
controller.value,
|
|
1968
2036
|
controller.setState,
|
|
1969
2037
|
controller.setFormValue,
|
|
1970
|
-
props.onValue
|
|
2038
|
+
props.onValue,
|
|
2039
|
+
props.value,
|
|
2040
|
+
onClickControl
|
|
1971
2041
|
]);
|
|
1972
2042
|
const onClickBackdrop = require$$0.useCallback(() => {
|
|
1973
|
-
controller.setState({
|
|
2043
|
+
controller.setState({ listIsVisible: false });
|
|
1974
2044
|
}, [controller.setState]);
|
|
1975
2045
|
const onChange = require$$0.useCallback((element) => {
|
|
1976
2046
|
if (props.onSelect) {
|
|
@@ -1984,9 +2054,9 @@ function useFieldAutocomplete(props) {
|
|
|
1984
2054
|
controller.refInput?.current?.focus();
|
|
1985
2055
|
}
|
|
1986
2056
|
else {
|
|
1987
|
-
controller.setState({
|
|
2057
|
+
controller.setState({ listIsVisible: false });
|
|
1988
2058
|
}
|
|
1989
|
-
props.onValue
|
|
2059
|
+
props.onValue?.(element.value);
|
|
1990
2060
|
}, [
|
|
1991
2061
|
controller.setState,
|
|
1992
2062
|
controller.setFormValue,
|
|
@@ -2026,18 +2096,10 @@ function useFieldAutocomplete(props) {
|
|
|
2026
2096
|
function RlsFieldAutocompleteTemplate(props) {
|
|
2027
2097
|
const autocomplete = useFieldAutocomplete(props);
|
|
2028
2098
|
const { render, children, formControl, msgErrorDisabled, onSearch, placeholder, rlsTheme, searching } = props;
|
|
2029
|
-
const [
|
|
2030
|
-
listEmptyDescription: reactI18n('listEmptyDescription'),
|
|
2031
|
-
listEmptyTitle: reactI18n('listEmptyTitle'),
|
|
2032
|
-
listInputPlaceholder: reactI18n('listInputPlaceholder')
|
|
2033
|
-
});
|
|
2099
|
+
const [listInputPlaceholder, setListInputPlaceholder] = require$$0.useState(reactI18n('listInputPlaceholder'));
|
|
2034
2100
|
require$$0.useEffect(() => {
|
|
2035
2101
|
return i18n.i18nSubscribe(() => {
|
|
2036
|
-
|
|
2037
|
-
listEmptyDescription: reactI18n('listEmptyDescription'),
|
|
2038
|
-
listEmptyTitle: reactI18n('listEmptyTitle'),
|
|
2039
|
-
listInputPlaceholder: reactI18n('listInputPlaceholder')
|
|
2040
|
-
});
|
|
2102
|
+
setListInputPlaceholder(reactI18n('listInputPlaceholder'));
|
|
2041
2103
|
});
|
|
2042
2104
|
}, []);
|
|
2043
2105
|
const disabled = require$$0.useMemo(() => {
|
|
@@ -2059,24 +2121,36 @@ function RlsFieldAutocompleteTemplate(props) {
|
|
|
2059
2121
|
props.readOnly,
|
|
2060
2122
|
disabled
|
|
2061
2123
|
]);
|
|
2062
|
-
const classNameSuggestions = require$$0.useMemo(() => {
|
|
2063
|
-
return renderClassStatus('rls-field-list__suggestions', {
|
|
2064
|
-
disabled,
|
|
2065
|
-
higher: autocomplete.higher,
|
|
2066
|
-
visible: autocomplete.modalIsVisible
|
|
2067
|
-
});
|
|
2068
|
-
}, [autocomplete.higher, autocomplete.modalIsVisible, disabled]);
|
|
2069
|
-
const onChangePattern = require$$0.useCallback((event) => {
|
|
2070
|
-
autocomplete.setPattern(event.target.value);
|
|
2071
|
-
}, [autocomplete.setPattern]);
|
|
2072
2124
|
const onClickPattern = require$$0.useCallback(() => {
|
|
2073
|
-
onSearch
|
|
2125
|
+
onSearch?.(autocomplete.pattern);
|
|
2074
2126
|
}, [onSearch, autocomplete.pattern]);
|
|
2075
2127
|
const onKeyDownPattern = require$$0.useCallback((event) => {
|
|
2076
|
-
event.key === 'Enter' && onSearch
|
|
2128
|
+
event.key === 'Enter' && onSearch?.(autocomplete.pattern);
|
|
2077
2129
|
autocomplete.onKeydownInput(event);
|
|
2078
2130
|
}, [autocomplete.onKeydownInput, onSearch, autocomplete.pattern]);
|
|
2079
|
-
|
|
2131
|
+
const searchControl = require$$0.useMemo(() => ({
|
|
2132
|
+
pattern: autocomplete.pattern,
|
|
2133
|
+
placeholder: listInputPlaceholder,
|
|
2134
|
+
searching,
|
|
2135
|
+
refInput: autocomplete.refInput,
|
|
2136
|
+
onChange: autocomplete.setPattern,
|
|
2137
|
+
onFocus: autocomplete.onFocusInput,
|
|
2138
|
+
onBlur: autocomplete.onBlurInput,
|
|
2139
|
+
onKeyDown: onKeyDownPattern,
|
|
2140
|
+
onSearch: onSearch ? onClickPattern : undefined
|
|
2141
|
+
}), [
|
|
2142
|
+
autocomplete.pattern,
|
|
2143
|
+
autocomplete.refInput,
|
|
2144
|
+
autocomplete.setPattern,
|
|
2145
|
+
autocomplete.onFocusInput,
|
|
2146
|
+
autocomplete.onBlurInput,
|
|
2147
|
+
listInputPlaceholder,
|
|
2148
|
+
searching,
|
|
2149
|
+
onKeyDownPattern,
|
|
2150
|
+
onClickPattern,
|
|
2151
|
+
onSearch
|
|
2152
|
+
]);
|
|
2153
|
+
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: autocomplete.refContent, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-list__control", readOnly: true, disabled: disabled, placeholder: placeholder, value: autocomplete.value, onClick: autocomplete.onClickControl }), !props.readOnly && (jsxRuntimeExports.jsx("button", { className: "rls-field-list__action", disabled: disabled, onClick: autocomplete.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: autocomplete.value ? 'trash-2' : 'arrow-ios-down' }) }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsx(RlsFieldListSuggestions, { elements: autocomplete.coincidences, visible: autocomplete.listIsVisible, disabled: disabled, higher: autocomplete.higher, render: render, refList: autocomplete.refList, searchControl: searchControl, onClickElement: autocomplete.onClickElement, onKeydownElement: autocomplete.onKeydownElement, onClickBackdrop: autocomplete.onClickBackdrop })] }));
|
|
2080
2154
|
}
|
|
2081
2155
|
function RlsFieldAutocomplete(props) {
|
|
2082
2156
|
const render = require$$0.useCallback((element) => (jsxRuntimeExports.jsx(RlsBallot, { className: "rls-field-list__ballot", subtitle: element.subtitle, img: element.img, initials: element.initials, children: jsxRuntimeExports.jsx("span", { children: element.title }) })), []);
|
|
@@ -2347,7 +2421,7 @@ function RlsFieldClock({ children, disabled: disabledProps, formControl, identif
|
|
|
2347
2421
|
formControl?.touch();
|
|
2348
2422
|
setModalIsVisible(false);
|
|
2349
2423
|
}, [formControl, onChange]);
|
|
2350
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-
|
|
2424
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-clock", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children && jsxRuntimeExports.jsx("span", { 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-clock__control", type: "text", value: status.valueInput, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), !readOnly && (jsxRuntimeExports.jsx("button", { className: "rls-field-clock__action", onClick: onClickAction, disabled: disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: status.icon }) }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }), jsxRuntimeExports.jsx(RlsModal, { className: "rls-field-clock-modal", visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerClock, { formControl: formControl, time: time, disabled: disabled, onListener: onListener }) })] }));
|
|
2351
2425
|
}
|
|
2352
2426
|
|
|
2353
2427
|
const DATE_FORMAT = '{dd}/{mx}/{yy}';
|
|
@@ -2362,13 +2436,15 @@ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDat
|
|
|
2362
2436
|
const yearControl = reactForms.useReactControl(_date.getFullYear());
|
|
2363
2437
|
const dayControl = reactForms.useReactControl(_date.getDate());
|
|
2364
2438
|
const monthControl = reactForms.useReactControl(_date.getMonth());
|
|
2365
|
-
const [value, setValue] = require$$0.useState(_date);
|
|
2366
2439
|
const [visibility, setVisibility] = require$$0.useState('DAY');
|
|
2367
2440
|
const [labels, setLabels] = require$$0.useState({
|
|
2368
2441
|
dateActionCancel: reactI18n('dateActionCancel'),
|
|
2369
2442
|
dateActionSelect: reactI18n('dateActionSelect'),
|
|
2370
2443
|
dateActionToday: reactI18n('dateActionToday')
|
|
2371
2444
|
});
|
|
2445
|
+
const value = require$$0.useMemo(() => {
|
|
2446
|
+
return new Date(yearControl.value, monthControl.value, dayControl.value);
|
|
2447
|
+
}, [yearControl.value, monthControl.value, dayControl.value]);
|
|
2372
2448
|
const classNameComponent = require$$0.useMemo(() => {
|
|
2373
2449
|
return renderClassStatus('rls-picker-date__component', {
|
|
2374
2450
|
day: visibility === 'DAY',
|
|
@@ -2377,16 +2453,18 @@ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDat
|
|
|
2377
2453
|
});
|
|
2378
2454
|
}, [visibility]);
|
|
2379
2455
|
const title = require$$0.useMemo(() => {
|
|
2380
|
-
return dates.dateFormatTemplate(
|
|
2381
|
-
}, [
|
|
2456
|
+
return dates.dateFormatTemplate(value, DATE_FORMAT_TITLE);
|
|
2457
|
+
}, [value]);
|
|
2382
2458
|
const itIsDisabledToday = require$$0.useMemo(() => components.dateOutRange({
|
|
2383
2459
|
date: today.current,
|
|
2384
2460
|
maxDate,
|
|
2385
2461
|
minDate
|
|
2386
|
-
}), [
|
|
2462
|
+
}), [maxDate, minDate]);
|
|
2387
2463
|
require$$0.useEffect(() => {
|
|
2388
2464
|
const date = components.verifyDateRange({ date: _date, minDate, maxDate });
|
|
2389
|
-
setValue(date);
|
|
2465
|
+
yearControl.setValue(date.getFullYear());
|
|
2466
|
+
monthControl.setValue(date.getMonth());
|
|
2467
|
+
dayControl.setValue(date.getDate());
|
|
2390
2468
|
formControl?.setValue(date);
|
|
2391
2469
|
return i18n.i18nSubscribe(() => {
|
|
2392
2470
|
setLabels({
|
|
@@ -2396,9 +2474,6 @@ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDat
|
|
|
2396
2474
|
});
|
|
2397
2475
|
});
|
|
2398
2476
|
}, []);
|
|
2399
|
-
require$$0.useEffect(() => {
|
|
2400
|
-
setValue(new Date(yearControl.value, monthControl.value, dayControl.value));
|
|
2401
|
-
}, [yearControl.value, monthControl.value, dayControl.value]);
|
|
2402
2477
|
const onVisibilityDay = require$$0.useCallback(() => {
|
|
2403
2478
|
setVisibility('DAY');
|
|
2404
2479
|
}, []);
|
|
@@ -2422,10 +2497,10 @@ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDat
|
|
|
2422
2497
|
formControl?.setValue(value);
|
|
2423
2498
|
onListener?.({
|
|
2424
2499
|
event: components.PickerListenerEvent.Select,
|
|
2425
|
-
value
|
|
2500
|
+
value: value
|
|
2426
2501
|
});
|
|
2427
2502
|
}, [formControl, value, onListener]);
|
|
2428
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__header", children: [jsxRuntimeExports.jsx(RlsPickerSelectorTitle, { monthControl: monthControl, yearControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: 'month', onClick: onVisibilityTitle }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__title", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: title }) })] }), jsxRuntimeExports.jsxs("div", { className: classNameComponent, children: [jsxRuntimeExports.jsx(RlsPickerDay, { formControl: dayControl, date:
|
|
2503
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__header", children: [jsxRuntimeExports.jsx(RlsPickerSelectorTitle, { monthControl: monthControl, yearControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: 'month', onClick: onVisibilityTitle }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__title", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: title }) })] }), jsxRuntimeExports.jsxs("div", { className: classNameComponent, children: [jsxRuntimeExports.jsx(RlsPickerDay, { formControl: dayControl, date: value, month: monthControl.value, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntimeExports.jsx(RlsPickerMonth, { formControl: monthControl, date: value, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntimeExports.jsx(RlsPickerYear, { formControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), !automatic && (jsxRuntimeExports.jsx("div", { className: "rls-picker-date__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", onClick: onCancel, children: labels.dateActionCancel }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--today", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "calendar", onClick: onToday, disabled: itIsDisabledToday }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "gradient", onClick: onSelect, children: labels.dateActionSelect }) })] }) }))] }));
|
|
2429
2504
|
}
|
|
2430
2505
|
|
|
2431
2506
|
function RlsFieldDate({ children, date, disabled: disabledProps, formControl, format, identifier, maxDate, minDate, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, value: valueInitial }) {
|
|
@@ -2448,7 +2523,7 @@ function RlsFieldDate({ children, date, disabled: disabledProps, formControl, fo
|
|
|
2448
2523
|
return {
|
|
2449
2524
|
icon: dateValue ? 'trash-2' : 'calendar',
|
|
2450
2525
|
label: dateValue
|
|
2451
|
-
? dates.dateFormatTemplate(dateValue, format
|
|
2526
|
+
? dates.dateFormatTemplate(dateValue, format ?? DATE_FORMAT)
|
|
2452
2527
|
: ''
|
|
2453
2528
|
};
|
|
2454
2529
|
}, [dateValue, format]);
|
|
@@ -2498,13 +2573,24 @@ function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl
|
|
|
2498
2573
|
const yearControl = reactForms.useReactControl(_date.getFullYear());
|
|
2499
2574
|
const monthControl = reactForms.useReactControl(_date.getMonth());
|
|
2500
2575
|
const rangeControl = reactForms.useReactControl(_range);
|
|
2501
|
-
const [value, setValue] = require$$0.useState(_range);
|
|
2502
|
-
const [date, setDate] = require$$0.useState(_date);
|
|
2503
2576
|
const [visibility, setVisibility] = require$$0.useState('DAY');
|
|
2504
2577
|
const [labels, setLabels] = require$$0.useState({
|
|
2505
2578
|
dateActionCancel: reactI18n('dateActionCancel'),
|
|
2506
2579
|
dateActionSelect: reactI18n('dateActionSelect')
|
|
2507
2580
|
});
|
|
2581
|
+
const value = require$$0.useMemo(() => {
|
|
2582
|
+
return rangeControl.value ?? _range;
|
|
2583
|
+
}, [rangeControl.value, _range]);
|
|
2584
|
+
const date = require$$0.useMemo(() => {
|
|
2585
|
+
let value = _date;
|
|
2586
|
+
if (commons.valueIsDefined(yearControl.value)) {
|
|
2587
|
+
value = dates.assignYearInDate(value, yearControl.value);
|
|
2588
|
+
}
|
|
2589
|
+
if (commons.valueIsDefined(monthControl.value)) {
|
|
2590
|
+
value = dates.assignMonthInDate(value, monthControl.value);
|
|
2591
|
+
}
|
|
2592
|
+
return value;
|
|
2593
|
+
}, [_date, yearControl.value, monthControl.value]);
|
|
2508
2594
|
const classNameComponent = require$$0.useMemo(() => {
|
|
2509
2595
|
return renderClassStatus('rls-picker-date-range__component', {
|
|
2510
2596
|
day: visibility === 'DAY',
|
|
@@ -2525,21 +2611,6 @@ function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl
|
|
|
2525
2611
|
});
|
|
2526
2612
|
}, []);
|
|
2527
2613
|
require$$0.useEffect(() => {
|
|
2528
|
-
setDate((date) => {
|
|
2529
|
-
return commons.valueIsDefined(yearControl.value)
|
|
2530
|
-
? dates.assignYearInDate(date, yearControl.value)
|
|
2531
|
-
: date;
|
|
2532
|
-
});
|
|
2533
|
-
}, [yearControl.value]);
|
|
2534
|
-
require$$0.useEffect(() => {
|
|
2535
|
-
setDate((date) => {
|
|
2536
|
-
return commons.valueIsDefined(monthControl.value)
|
|
2537
|
-
? dates.assignMonthInDate(date, monthControl.value)
|
|
2538
|
-
: date;
|
|
2539
|
-
});
|
|
2540
|
-
}, [monthControl.value]);
|
|
2541
|
-
require$$0.useEffect(() => {
|
|
2542
|
-
rangeControl.value && setValue(rangeControl.value);
|
|
2543
2614
|
setVisibility('DAY');
|
|
2544
2615
|
}, [rangeControl.value]);
|
|
2545
2616
|
const onVisibilityDay = require$$0.useCallback(() => {
|
|
@@ -2549,11 +2620,11 @@ function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl
|
|
|
2549
2620
|
type === 'month' ? setVisibility('MONTH') : setVisibility('YEAR');
|
|
2550
2621
|
}, []);
|
|
2551
2622
|
const onCancel = require$$0.useCallback(() => {
|
|
2552
|
-
onListener
|
|
2623
|
+
onListener?.({ event: components.PickerListenerEvent.Cancel });
|
|
2553
2624
|
}, [onListener]);
|
|
2554
2625
|
const onSelect = require$$0.useCallback(() => {
|
|
2555
2626
|
formControl?.setValue(value);
|
|
2556
|
-
onListener
|
|
2627
|
+
onListener?.({ event: components.PickerListenerEvent.Select, value });
|
|
2557
2628
|
}, [formControl, value, onListener]);
|
|
2558
2629
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range__header", children: [jsxRuntimeExports.jsx(RlsPickerSelectorTitle, { monthControl: monthControl, yearControl: yearControl, date: date, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: visibility === 'MONTH' ? 'year' : 'month', onClick: onVisibilityTitle }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__title", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: title }) })] }), jsxRuntimeExports.jsxs("div", { className: classNameComponent, children: [jsxRuntimeExports.jsx(RlsPickerDayRange, { formControl: rangeControl, date: date, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntimeExports.jsx(RlsPickerMonth, { formControl: monthControl, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntimeExports.jsx(RlsPickerYear, { formControl: yearControl, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), jsxRuntimeExports.jsx("div", { className: classNameFooter, children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", onClick: onCancel, children: labels.dateActionCancel }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "gradient", onClick: onSelect, children: labels.dateActionSelect }) })] }) })] }));
|
|
2559
2630
|
}
|
|
@@ -2624,17 +2695,17 @@ function useFieldSelect(props) {
|
|
|
2624
2695
|
controller.setState({ focused: false });
|
|
2625
2696
|
}, [controller.setState]);
|
|
2626
2697
|
const onClickInput = require$$0.useCallback(() => {
|
|
2627
|
-
!props.readOnly && controller.setState({
|
|
2698
|
+
!props.readOnly && controller.setState({ listIsVisible: true });
|
|
2628
2699
|
}, [controller.setState, props.readOnly]);
|
|
2629
2700
|
const onKeydownInput = require$$0.useCallback((event) => {
|
|
2630
2701
|
switch (event.code) {
|
|
2631
2702
|
case 'Space':
|
|
2632
2703
|
case 'Enter':
|
|
2633
|
-
controller.setState({
|
|
2704
|
+
controller.setState({ listIsVisible: true });
|
|
2634
2705
|
break;
|
|
2635
2706
|
case 'Escape':
|
|
2636
2707
|
case 'Tab':
|
|
2637
|
-
controller.setState({
|
|
2708
|
+
controller.setState({ listIsVisible: false });
|
|
2638
2709
|
break;
|
|
2639
2710
|
default:
|
|
2640
2711
|
controller.navigationInput(event);
|
|
@@ -2644,17 +2715,17 @@ function useFieldSelect(props) {
|
|
|
2644
2715
|
const onClickAction = require$$0.useCallback(() => {
|
|
2645
2716
|
const removable = !props.unremovable && !!controller.value;
|
|
2646
2717
|
if (removable) {
|
|
2647
|
-
controller.setState({
|
|
2718
|
+
controller.setState({ listIsVisible: false });
|
|
2648
2719
|
controller.setFormValue(undefined);
|
|
2649
|
-
props.onValue
|
|
2720
|
+
props.onValue?.(props.value);
|
|
2650
2721
|
}
|
|
2651
2722
|
else {
|
|
2652
|
-
const
|
|
2653
|
-
controller.setState({
|
|
2654
|
-
|
|
2723
|
+
const listIsVisible = !controller.listIsVisible;
|
|
2724
|
+
controller.setState({ listIsVisible });
|
|
2725
|
+
listIsVisible && controller.refInput?.current?.focus();
|
|
2655
2726
|
}
|
|
2656
2727
|
}, [
|
|
2657
|
-
controller.
|
|
2728
|
+
controller.listIsVisible,
|
|
2658
2729
|
controller.value,
|
|
2659
2730
|
controller.setState,
|
|
2660
2731
|
controller.setFormValue,
|
|
@@ -2662,19 +2733,19 @@ function useFieldSelect(props) {
|
|
|
2662
2733
|
props.onValue
|
|
2663
2734
|
]);
|
|
2664
2735
|
const onClickBackdrop = require$$0.useCallback(() => {
|
|
2665
|
-
controller.setState({
|
|
2736
|
+
controller.setState({ listIsVisible: false });
|
|
2666
2737
|
}, [controller.setState]);
|
|
2667
2738
|
const onChange = require$$0.useCallback((element) => {
|
|
2668
2739
|
!props.disabled && controller.refInput?.current?.focus();
|
|
2669
2740
|
if (props.onSelect) {
|
|
2670
|
-
controller.setState({
|
|
2741
|
+
controller.setState({ listIsVisible: false });
|
|
2671
2742
|
element.value && props.onSelect(element.value);
|
|
2672
2743
|
}
|
|
2673
2744
|
else {
|
|
2674
2745
|
controller.setFormValue(element);
|
|
2675
|
-
controller.setState({
|
|
2746
|
+
controller.setState({ listIsVisible: false });
|
|
2676
2747
|
}
|
|
2677
|
-
props.onValue
|
|
2748
|
+
props.onValue?.(element.value);
|
|
2678
2749
|
}, [
|
|
2679
2750
|
controller.setState,
|
|
2680
2751
|
controller.setFormValue,
|
|
@@ -2710,18 +2781,6 @@ function useFieldSelect(props) {
|
|
|
2710
2781
|
function RlsFieldSelectTemplate(props) {
|
|
2711
2782
|
const select = useFieldSelect(props);
|
|
2712
2783
|
const { render, suggestions, children, formControl, msgErrorDisabled, placeholder, rlsTheme, unremovable } = props;
|
|
2713
|
-
const [labels, setLabels] = require$$0.useState({
|
|
2714
|
-
listEmptyDescription: reactI18n('listEmptyDescription'),
|
|
2715
|
-
listEmptyTitle: reactI18n('listEmptyTitle')
|
|
2716
|
-
});
|
|
2717
|
-
require$$0.useEffect(() => {
|
|
2718
|
-
return i18n.i18nSubscribe(() => {
|
|
2719
|
-
setLabels({
|
|
2720
|
-
listEmptyDescription: reactI18n('listEmptyDescription'),
|
|
2721
|
-
listEmptyTitle: reactI18n('listEmptyTitle')
|
|
2722
|
-
});
|
|
2723
|
-
});
|
|
2724
|
-
}, []);
|
|
2725
2784
|
const disabled = require$$0.useMemo(() => {
|
|
2726
2785
|
return formControl?.disabled || props.disabled;
|
|
2727
2786
|
}, [formControl?.disabled, props.disabled]);
|
|
@@ -2739,14 +2798,7 @@ function RlsFieldSelectTemplate(props) {
|
|
|
2739
2798
|
props.readOnly,
|
|
2740
2799
|
disabled
|
|
2741
2800
|
]);
|
|
2742
|
-
|
|
2743
|
-
return renderClassStatus('rls-field-list__suggestions', {
|
|
2744
|
-
disabled,
|
|
2745
|
-
higher: select.higher,
|
|
2746
|
-
visible: select.modalIsVisible
|
|
2747
|
-
});
|
|
2748
|
-
}, [select.modalIsVisible, select.higher, disabled]);
|
|
2749
|
-
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: select.refContent, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { 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: select.refInput, className: "rls-field-list__control", readOnly: true, placeholder: placeholder, value: select.value, onFocus: select.onFocusInput, onBlur: select.onBlurInput, onClick: select.onClickInput, onKeyDown: select.onKeydownInput, disabled: disabled }), !props.readOnly && (jsxRuntimeExports.jsx("button", { className: 'rls-field-list__action', disabled: disabled, onClick: select.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: !unremovable && !!select.value ? 'close' : 'arrow-ios-down' }) }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsxs("div", { className: classNameSuggestions, children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: select.refList, className: "rls-field-list__ul", children: [suggestions.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: select.onClickElement(element), onKeyDown: select.onKeydownElement(element), children: render(element) }, index))), !suggestions.length && (jsxRuntimeExports.jsx("li", { className: "rls-field-list__empty", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-list__empty__description", children: [jsxRuntimeExports.jsx("label", { className: "rls-label-bold rls-truncate", children: labels.listEmptyTitle }), jsxRuntimeExports.jsx("p", { className: "rls-caption-regular", children: labels.listEmptyDescription })] }) }))] }) }), jsxRuntimeExports.jsx("div", { className: "rls-field-list__backdrop", onClick: select.onClickBackdrop })] })] }));
|
|
2801
|
+
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: select.refContent, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { 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: select.refInput, className: "rls-field-list__control", readOnly: true, placeholder: placeholder, value: select.value, onFocus: select.onFocusInput, onBlur: select.onBlurInput, onClick: select.onClickInput, onKeyDown: select.onKeydownInput, disabled: disabled }), !props.readOnly && (jsxRuntimeExports.jsx("button", { className: 'rls-field-list__action', disabled: disabled, onClick: select.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: !unremovable && !!select.value ? 'close' : 'arrow-ios-down' }) }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsx(RlsFieldListSuggestions, { elements: suggestions, visible: select.listIsVisible, disabled: disabled, higher: select.higher, render: render, refList: select.refList, onClickElement: select.onClickElement, onKeydownElement: select.onKeydownElement, onClickBackdrop: select.onClickBackdrop })] }));
|
|
2750
2802
|
}
|
|
2751
2803
|
function RlsFieldSelect(props) {
|
|
2752
2804
|
const render = require$$0.useCallback((element) => (jsxRuntimeExports.jsx(RlsBallot, { className: "rls-field-list__ballot", subtitle: element.subtitle, img: element.img, initials: element.initials, children: jsxRuntimeExports.jsx("span", { children: element.title }) })), []);
|
|
@@ -2806,7 +2858,7 @@ function useRelocationOnComponent({ container, element, onDrag }) {
|
|
|
2806
2858
|
const clientY = getClientY(positionY);
|
|
2807
2859
|
element.current.style.top = `${clientY}px`;
|
|
2808
2860
|
element.current.style.left = `${clientX}px`;
|
|
2809
|
-
onDrag
|
|
2861
|
+
onDrag?.();
|
|
2810
2862
|
}, []);
|
|
2811
2863
|
require$$0.useEffect(() => {
|
|
2812
2864
|
const mousedown = (event) => {
|
|
@@ -3081,7 +3133,7 @@ function RlsImageEditor(props) {
|
|
|
3081
3133
|
base64: reader.result,
|
|
3082
3134
|
blob
|
|
3083
3135
|
};
|
|
3084
|
-
props.onValue
|
|
3136
|
+
props.onValue?.(value);
|
|
3085
3137
|
props.formControl?.setValue(value);
|
|
3086
3138
|
};
|
|
3087
3139
|
}
|
|
@@ -3176,7 +3228,7 @@ function RlsImageChooser(props) {
|
|
|
3176
3228
|
const [src, setSrc] = require$$0.useState();
|
|
3177
3229
|
const onValue = require$$0.useCallback((image) => {
|
|
3178
3230
|
setSrc(image.base64);
|
|
3179
|
-
props.onValue
|
|
3231
|
+
props.onValue?.(image);
|
|
3180
3232
|
}, [props.onValue]);
|
|
3181
3233
|
const controller = useImageEditorController({ ...props, onValue });
|
|
3182
3234
|
require$$0.useEffect(() => {
|
|
@@ -3190,7 +3242,7 @@ function RlsModalSheet({ children, className, onAutoClose, visible, rlsTheme })
|
|
|
3190
3242
|
return renderClassStatus('rls-modal-sheet', { visible }, className);
|
|
3191
3243
|
}, [className, visible]);
|
|
3192
3244
|
const onClickBackdrop = require$$0.useCallback(() => {
|
|
3193
|
-
onAutoClose
|
|
3245
|
+
onAutoClose?.();
|
|
3194
3246
|
}, [onAutoClose]);
|
|
3195
3247
|
return ReactDOM.createPortal(jsxRuntimeExports.jsxs("div", { className: classNameModal, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-modal-sheet__component", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-modal-sheet__backdrop", onClick: onClickBackdrop })] }), document.body);
|
|
3196
3248
|
}
|
|
@@ -3410,6 +3462,8 @@ exports.RlsFieldClock = RlsFieldClock;
|
|
|
3410
3462
|
exports.RlsFieldDate = RlsFieldDate;
|
|
3411
3463
|
exports.RlsFieldDateRange = RlsFieldDateRange;
|
|
3412
3464
|
exports.RlsFieldDecimal = RlsFieldDecimal;
|
|
3465
|
+
exports.RlsFieldFile = RlsFieldFile;
|
|
3466
|
+
exports.RlsFieldListSuggestions = RlsFieldListSuggestions;
|
|
3413
3467
|
exports.RlsFieldMoney = RlsFieldMoney;
|
|
3414
3468
|
exports.RlsFieldNumber = RlsFieldNumber;
|
|
3415
3469
|
exports.RlsFieldPassword = RlsFieldPassword;
|