@m4l/components 9.3.19-BE101025-beta.2 → 9.3.19-BE241025-beta.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/@types/types.d.ts +1 -1
- package/components/AccountPopover/AccountPopover.js +12 -13
- package/components/AccountPopover/subcomponents/MenuPopover/MenuPopover.d.ts +1 -1
- package/components/AccountPopover/subcomponents/MenuPopover/MenuPopover.js +7 -4
- package/components/AccountPopover/subcomponents/MenuPopover/types.d.ts +1 -1
- package/components/Chip/Chip.js +9 -7
- package/components/Chip/ChipStyles.js +4 -31
- package/components/Chip/helpers.d.ts +10 -0
- package/components/Chip/helpers.js +34 -0
- package/components/Chip/types.d.ts +6 -0
- package/components/DataGrid/DataGrid.js +9 -4
- package/components/DataGrid/Datagrid.styles.js +270 -0
- package/components/DataGrid/constants.js +2 -2
- package/components/DataGrid/contexts/DataGridContext/index.js +322 -112
- package/components/DataGrid/contexts/DataGridContext/types.d.ts +63 -4
- package/components/DataGrid/dictionary.d.ts +5 -0
- package/components/DataGrid/dictionary.js +6 -1
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/formatter.js +2 -2
- package/components/DataGrid/hooks/useModalCardDetail.d.ts +6 -0
- package/components/DataGrid/hooks/useModalCardDetail.js +74 -0
- package/components/DataGrid/hooks/useProcessedColumns.d.ts +50 -0
- package/components/DataGrid/hooks/useProcessedColumns.js +44 -0
- package/components/DataGrid/icons.d.ts +7 -0
- package/components/DataGrid/icons.js +5 -1
- package/components/DataGrid/index.d.ts +1 -1
- package/components/DataGrid/slots/DataGridEnum.d.ts +22 -1
- package/components/DataGrid/slots/DataGridEnum.js +21 -0
- package/components/DataGrid/slots/DataGridSlot.d.ts +24 -0
- package/components/DataGrid/slots/DataGridSlot.js +123 -21
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.d.ts +9 -0
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.js +91 -0
- package/components/DataGrid/subcomponents/Cards/index.d.ts +5 -0
- package/components/DataGrid/subcomponents/Cards/index.js +40 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.d.ts +8 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.js +79 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.d.ts +7 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +98 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.d.ts +6 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +71 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/IntersectCard/index.d.ts +20 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/IntersectCard/index.js +46 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/LazyLoadCard/index.d.ts +17 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/LazyLoadCard/index.js +34 -0
- package/components/DataGrid/subcomponents/Cards/types.d.ts +118 -0
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.d.ts +7 -0
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +43 -0
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/types.d.ts +7 -0
- package/components/DataGrid/subcomponents/ControlNavigate/ControlNavigate.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/index.js +5 -3
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/RowsCount/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/index.js +11 -2
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.d.ts +2 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.js +304 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/types.d.ts +31 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.d.ts +4 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.js +125 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettings/index.js +3 -3
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettingsCards/index.d.ts +7 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettingsCards/index.js +74 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettingsCards/types.d.ts +4 -0
- package/components/DataGrid/subcomponents/RenderContent/index.d.ts +5 -0
- package/components/DataGrid/subcomponents/RenderContent/index.js +11 -0
- package/components/DataGrid/subcomponents/Table/hooks/useHeaderMenuActions.js +2 -2
- package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +1 -1
- package/components/DataGrid/subcomponents/Table/index.js +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/ActionsColumn.js +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
- package/components/DataGrid/subcomponents/editors/TextEditor/index.js +1 -1
- package/components/DataGrid/tests/components/CardDetails.test.d.ts +1 -0
- package/components/DataGrid/tests/components/CardHeader.test.d.ts +1 -0
- package/components/DataGrid/tests/components/CardRow.test.d.ts +1 -0
- package/components/DataGrid/tests/components/Cards.test.d.ts +1 -0
- package/components/DataGrid/tests/components/CheckboxCellAdapter.test.d.ts +1 -0
- package/components/DataGrid/tests/components/ColumnsConfigCards.test.d.ts +1 -0
- package/components/DataGrid/tests/components/IntersectCard.test.d.ts +1 -0
- package/components/DataGrid/tests/components/ViewMode.test.d.ts +1 -0
- package/components/DataGrid/tests/helpers/types.d.ts +1 -0
- package/components/DataGrid/tests/helpers/useCardsViewConfig.d.ts +24 -0
- package/components/DataGrid/tests/helpers/useCustomCardExample.d.ts +7 -0
- package/components/DataGrid/tests/hooks/useCardContent.test.d.ts +1 -0
- package/components/DataGrid/tests/hooks/useModalDetail.test.d.ts +1 -0
- package/components/DataGrid/tests/hooks/useModalSettingsCards.test.d.ts +1 -0
- package/components/DataGrid/tests/hooks/useProcessedColumns.test.d.ts +1 -0
- package/components/DataGrid/types.d.ts +87 -5
- package/components/DragResizeWindowRND/DragResizeWindowRND.js +14 -10
- package/components/DragResizeWindowRND/helpers/expandingParentContainer.d.ts +1 -1
- package/components/DragResizeWindowRND/helpers/expandingParentContainer.js +24 -19
- package/components/DragResizeWindowRND/helpers/getInitialSize.d.ts +3 -3
- package/components/DragResizeWindowRND/helpers/getInitialSize.js +18 -15
- package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.d.ts +1 -1
- package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.js +17 -9
- package/components/DragResizeWindowRND/hooks/useRNDDimensionEffects.js +4 -1
- package/components/DragResizeWindowRND/index.d.ts +1 -0
- package/components/DragResizeWindowRND/types.d.ts +12 -2
- package/components/DynamicFilter/DynamicFilter.js +2 -1
- package/components/DynamicFilter/helpers/formatToInitialFilters.js +3 -3
- package/components/DynamicFilter/helpers/frontEndHelpers.d.ts +2 -2
- package/components/DynamicFilter/helpers/frontEndHelpers.js +31 -9
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.d.ts +2 -1
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.js +4 -2
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/types.d.ts +3 -0
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/helpers.js +11 -3
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.js +16 -4
- package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/helpers.js +11 -8
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/helpers.js +21 -8
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.js +18 -8
- package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/helpers.js +5 -3
- package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +1 -1
- package/components/DynamicFilter/types.d.ts +4 -0
- package/components/DynamicSort/DynamicSort.js +2 -1
- package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.d.ts +2 -1
- package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.js +4 -2
- package/components/DynamicSort/subcomponents/DynamicSortBase/types.d.ts +3 -0
- package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +1 -1
- package/components/DynamicSort/types.d.ts +4 -0
- package/components/EditLabel/hooks/useEditLabel.d.ts +1 -0
- package/components/GridLayout/subcomponents/GridItem/index.js +2 -2
- package/components/Image/Image.js +4 -1
- package/components/LanguagePopover/LanguagePopover.js +2 -0
- package/components/MFIsolationApp/MFIsolationApp.js +1 -4
- package/components/MFIsolationApp/subcomponents/AppBarSettings/AppBarSettings.js +1 -1
- package/components/MFIsolationAppStorybook/MFIsolationAppStorybook.js +4 -20
- package/components/MFIsolationAppStorybook/types.d.ts +0 -4
- package/components/MFLoader/MFLoader.js +8 -3
- package/components/MFLoader/styles.js +1 -1
- package/components/MFLoader/types.d.ts +10 -0
- package/components/MenuActions/MenuActions.js +105 -55
- package/components/ObjectLogs/hooks/useDetailFormatter.js +1 -1
- package/components/WindowBase/WindowBase.js +3 -3
- package/components/WindowBase/WindowBase.styles.js +36 -31
- package/components/WindowBase/constants.d.ts +1 -1
- package/components/WindowBase/constants.js +2 -2
- package/components/WindowBase/index.d.ts +1 -0
- package/components/WindowBase/subcomponents/Component/index.js +2 -2
- package/components/WindowBase/subcomponents/Component/types.d.ts +2 -0
- package/components/WindowBase/subcomponents/Header/HeaderWindowBase.js +7 -7
- package/components/WindowBase/subcomponents/Header/types.d.ts +1 -1
- package/components/WindowBase/subcomponents/MicroFrontend/types.d.ts +4 -0
- package/components/WindowBase/types.d.ts +3 -3
- package/components/WindowConfirm/WindowConfirm.js +1 -1
- package/components/areas/components/AreasViewer/AreasViewer.styles.js +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +6 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.d.ts +1 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.js +21 -3
- package/components/areas/index.d.ts +1 -1
- package/components/areas/types.d.ts +1 -1
- package/components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js +3 -34
- package/components/formatters/DistanceToNowFormatter/dictionary.d.ts +8 -0
- package/components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.d.ts +13 -0
- package/components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.js +65 -0
- package/components/formatters/DistanceToNowFormatter/index.d.ts +1 -0
- package/components/formatters/DistanceToNowFormatter/types.d.ts +4 -1
- package/components/hook-form/RHFAutocomplete/RHFAutocomplete.d.ts +1 -1
- package/components/hook-form/RHFAutocomplete/RHFAutocomplete.js +8 -4
- package/components/hook-form/RHFAutocomplete/constants.d.ts +1 -0
- package/components/hook-form/RHFAutocomplete/constants.js +5 -1
- package/components/hook-form/RHFAutocomplete/types.d.ts +2 -2
- package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.js +6 -4
- package/components/hook-form/RHFAutocompleteAsync/slots/RHFAutocompleteSlotsAsync.d.ts +1 -1
- package/components/hook-form/RHFAutocompleteAsync/types.d.ts +4 -0
- package/components/mui_extended/Autocomplete/Autocomplete.d.ts +4 -8
- package/components/mui_extended/Autocomplete/Autocomplete.js +11 -11
- package/components/mui_extended/Autocomplete/Autocomplete.styles.js +7 -3
- package/components/mui_extended/Autocomplete/RenderAdornment/RenderAdornment.d.ts +6 -0
- package/components/mui_extended/Autocomplete/RenderAdornment/RenderAdornment.js +45 -0
- package/components/mui_extended/Autocomplete/hooks/useEndAdornments.js +2 -1
- package/components/mui_extended/Autocomplete/hooks/useStartAdornments.d.ts +4 -12
- package/components/mui_extended/Autocomplete/hooks/useStartAdornments.js +72 -23
- package/components/mui_extended/Autocomplete/hooks/useValuesAndHandlers.d.ts +0 -2
- package/components/mui_extended/Autocomplete/hooks/useValuesAndHandlers.js +0 -13
- package/components/mui_extended/Autocomplete/renderOptions/index.d.ts +4 -17
- package/components/mui_extended/Autocomplete/renderOptions/index.js +42 -5
- package/components/mui_extended/Autocomplete/renderOptions/types.d.ts +7 -0
- package/components/mui_extended/Autocomplete/types.d.ts +10 -3
- package/components/mui_extended/Button/ButtonStyles.js +15 -5
- package/components/mui_extended/ToggleIconButton/ToggleIconButton.js +6 -2
- package/components/mui_extended/ToggleIconButton/ToggleIconButton.styles.js +9 -0
- package/components/mui_extended/ToggleIconButton/types.d.ts +1 -0
- package/components/mui_extended/index.d.ts +1 -1
- package/components/popups/components/PopupsProvider/hooks/usePopups.d.ts +2 -2
- package/components/popups/components/PopupsProvider/hooks/usePopups.js +0 -1
- package/components/popups/components/PopupsViewer/PopupsViewer.js +4 -3
- package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +5 -2
- package/components/popups/components/PopupsViewer/subcomponents/Popup/types.d.ts +5 -0
- package/components/popups/components/PopupsViewer/types.d.ts +3 -0
- package/contexts/AppearanceComponentContext/AppearanceComponentContext.js +4 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/useDataGridPersistence/helpers.d.ts +2 -2
- package/hooks/useDataGridPersistence/useDataGridPersistence.d.ts +2 -2
- package/hooks/useDataGridPersistence/useDataGridPersistence.js +5 -0
- package/hooks/useSizeContainer/index.d.ts +2 -1
- package/hooks/useSizeContainer/index.js +22 -13
- package/hooks/useSizeContainer/types.d.ts +6 -0
- package/hooks/useStateRef/index.d.ts +1 -1
- package/hooks/useStateRef/index.js +6 -6
- package/index.js +53 -46
- package/package.json +3 -4
- package/utils/deepShallow.d.ts +17 -0
- package/utils/deepShallow.js +76 -0
- package/utils/formatDistanceToNow/formatDistanteToNow.d.ts +2 -2
- package/utils/formatDistanceToNow/formatDistanteToNow.js +18 -2
- package/utils/formatDistanceToNow/types.d.ts +13 -0
- package/utils/index.d.ts +1 -0
- package/components/MFIsolationAppStorybook/icons.js +0 -6
- package/components/MFIsolationAppStorybook/subcomponents/AppBarSettings/AppBarSettings.d.ts +0 -4
- package/components/MFIsolationAppStorybook/subcomponents/AppBarSettings/AppBarSettings.js +0 -21
- package/components/MFIsolationAppStorybook/subcomponents/AppBarSettings/index.d.ts +0 -1
- package/components/MFIsolationAppStorybook/subcomponents/AppBarSettings/index.js +0 -1
|
@@ -8,7 +8,7 @@ import { deepEqual } from "fast-equals";
|
|
|
8
8
|
import { useFormatter } from "@m4l/graphics";
|
|
9
9
|
import { u as useButtonActions } from "./useButtonActions.js";
|
|
10
10
|
import { H as HeaderWindowComponentStyled, c as HeaderContentStyled, I as IconWindowStyled, d as ContainerTitleSubtitleStyled, e as TitleWindowStyled, P as PointIconStyled, S as SubtitleWindowStyled, f as IconsWrapperStyled, g as ContainerLeftActionsStyled, M as MenuActionsWindowsStyled } from "../../slots/WindowBaseSlots.js";
|
|
11
|
-
import {
|
|
11
|
+
import { w as windowBaseClasses } from "../../constants.js";
|
|
12
12
|
import clsx from "clsx";
|
|
13
13
|
const HeaderWindowBase = (props) => {
|
|
14
14
|
const {
|
|
@@ -24,7 +24,7 @@ const HeaderWindowBase = (props) => {
|
|
|
24
24
|
variant,
|
|
25
25
|
actions = [],
|
|
26
26
|
collapsed,
|
|
27
|
-
|
|
27
|
+
emergeType,
|
|
28
28
|
draggable
|
|
29
29
|
} = props;
|
|
30
30
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
@@ -103,17 +103,17 @@ const HeaderWindowBase = (props) => {
|
|
|
103
103
|
maximized,
|
|
104
104
|
variant,
|
|
105
105
|
size,
|
|
106
|
-
|
|
106
|
+
emergeType,
|
|
107
107
|
collapsed,
|
|
108
108
|
draggable
|
|
109
109
|
};
|
|
110
110
|
const IconButtonLeftActions = useButtonActions(leftActions);
|
|
111
111
|
const IconButtonRightActions = useButtonActions(rightActions);
|
|
112
|
-
return /* @__PURE__ */ jsxs(HeaderWindowComponentStyled, { className: clsx(draggable && dragResizeWindowRNDClasses.draggableHandle,
|
|
113
|
-
/* @__PURE__ */ jsxs(HeaderContentStyled, { ownerState, children: [
|
|
112
|
+
return /* @__PURE__ */ jsxs(HeaderWindowComponentStyled, { className: clsx(draggable && dragResizeWindowRNDClasses.draggableHandle, windowBaseClasses.headerWindowComponent), ownerState, children: [
|
|
113
|
+
/* @__PURE__ */ jsxs(HeaderContentStyled, { ownerState, className: windowBaseClasses.headerContentWindowBase, children: [
|
|
114
114
|
iconUrl && /* @__PURE__ */ jsx(IconWindowStyled, { size, ownerState, src: iconUrl, "aria-label": "main icon" }),
|
|
115
115
|
/* @__PURE__ */ jsxs(ContainerTitleSubtitleStyled, { size, ownerState, children: [
|
|
116
|
-
/* @__PURE__ */ jsx(TitleWindowStyled, { variant:
|
|
116
|
+
/* @__PURE__ */ jsx(TitleWindowStyled, { variant: emergeType === "popup" || emergeType === "modal" ? "body" : "captionDens", size, skeletonWidth: 100, ownerState, children: title }),
|
|
117
117
|
subTitle && /* @__PURE__ */ jsx(
|
|
118
118
|
PointIconStyled,
|
|
119
119
|
{
|
|
@@ -122,7 +122,7 @@ const HeaderWindowBase = (props) => {
|
|
|
122
122
|
ownerState
|
|
123
123
|
}
|
|
124
124
|
),
|
|
125
|
-
subTitle && /* @__PURE__ */ jsx(SubtitleWindowStyled, { variant:
|
|
125
|
+
subTitle && /* @__PURE__ */ jsx(SubtitleWindowStyled, { variant: emergeType === "popup" || emergeType === "modal" ? "body" : "captionDens", size, skeletonWidth: 100, ownerState, children: subTitle })
|
|
126
126
|
] })
|
|
127
127
|
] }),
|
|
128
128
|
/* @__PURE__ */ jsxs(
|
|
@@ -32,7 +32,7 @@ import { WindowBaseAction, WindowBaseProps } from '../../types';
|
|
|
32
32
|
* - `selected` modifies the visual appearance to indicate the selected state.
|
|
33
33
|
* @see WindowBaseProps - General properties for the window base.
|
|
34
34
|
*/
|
|
35
|
-
export type HeaderProps = Pick<WindowBaseProps, 'title' | 'subTitle' | 'iconUrl' | 'onClose' | 'version' | 'selected' | 'variant' | '
|
|
35
|
+
export type HeaderProps = Pick<WindowBaseProps, 'title' | 'subTitle' | 'iconUrl' | 'onClose' | 'version' | 'selected' | 'variant' | 'emergeType' | 'buildTime' | 'maximized' | 'draggable'> & {
|
|
36
36
|
actions?: WindowBaseAction[];
|
|
37
37
|
};
|
|
38
38
|
/**
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { AuthUserType } from '@m4l/core';
|
|
2
|
+
import { EmergeType } from '../../../areas/types';
|
|
1
3
|
import { MFBaseProps } from '../../../MFLoader/types';
|
|
2
4
|
import { WindowToolsMF } from '../../contexts';
|
|
3
5
|
import { DynamicMFStore } from '../../contexts/DynamicMFParmsContext/store';
|
|
@@ -5,4 +7,6 @@ export interface MicroFrontendProps extends MFBaseProps {
|
|
|
5
7
|
moduleId: string;
|
|
6
8
|
windowTools: WindowToolsMF;
|
|
7
9
|
dynamicMFStore: DynamicMFStore;
|
|
10
|
+
emergeType: EmergeType;
|
|
11
|
+
loggedUser: AuthUserType;
|
|
8
12
|
}
|
|
@@ -189,7 +189,7 @@ export interface WindowBaseProps {
|
|
|
189
189
|
* - `'window'`: A window.
|
|
190
190
|
* Default is `'window'` if not specified.
|
|
191
191
|
*/
|
|
192
|
-
|
|
192
|
+
emergeType?: EmergeType;
|
|
193
193
|
/**
|
|
194
194
|
* Indicates if the window is draggable.
|
|
195
195
|
*/
|
|
@@ -210,13 +210,13 @@ export type WindowBaseType = keyof typeof WindowBaseSlots;
|
|
|
210
210
|
* windowBaseVariant (optional) - Visual variant of the component (`'outlined'` or `'text'`).
|
|
211
211
|
* windowBaseSize (optional) - Size of the component (`'small'` or `'medium'`).
|
|
212
212
|
*/
|
|
213
|
-
export type WindowBaseOwnerState =
|
|
213
|
+
export type WindowBaseOwnerState = {
|
|
214
214
|
selected?: WindowBaseProps['selected'];
|
|
215
215
|
collapsed?: WindowBaseProps['collapsed'];
|
|
216
216
|
maximized?: WindowBaseProps['maximized'];
|
|
217
217
|
variant?: WindowBaseProps['variant'];
|
|
218
218
|
size?: WindowBaseProps['size'];
|
|
219
|
-
|
|
219
|
+
emergeType?: WindowBaseProps['emergeType'];
|
|
220
220
|
draggable?: WindowBaseProps['draggable'];
|
|
221
221
|
};
|
|
222
222
|
/**
|
|
@@ -56,7 +56,7 @@ const WindowConfirm = (props) => {
|
|
|
56
56
|
info: `${host_static_assets}/${environment_assets}/frontend/components/window_confirm/assets/icons/Info.svg`
|
|
57
57
|
};
|
|
58
58
|
const iconUrl = iconMap[variant] || iconMap.warning;
|
|
59
|
-
return /* @__PURE__ */ jsx(AppearanceComponentProvider, { defaultSize: currentSize, children: /* @__PURE__ */ jsx(WindowBase, { iconUrl, variant: "outlined", title: getLabel("modal_dialog.label_window_confirm"), onClose: () => closeModal(),
|
|
59
|
+
return /* @__PURE__ */ jsx(AppearanceComponentProvider, { defaultSize: currentSize, children: /* @__PURE__ */ jsx(WindowBase, { iconUrl, variant: "outlined", title: getLabel("modal_dialog.label_window_confirm"), onClose: () => closeModal(), emergeType: "modal", children: /* @__PURE__ */ jsx(
|
|
60
60
|
WindowConfirmRootStyled,
|
|
61
61
|
{
|
|
62
62
|
className: clsx(getComponentSlotRoot(WINDOW_CONFIRM_KEY_COMPONENT)),
|
package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js
CHANGED
|
@@ -30,7 +30,8 @@ const Window = (props) => {
|
|
|
30
30
|
dynamicMFStore,
|
|
31
31
|
windowTools,
|
|
32
32
|
onTouch,
|
|
33
|
-
memoizedActions
|
|
33
|
+
memoizedActions,
|
|
34
|
+
loggedUser
|
|
34
35
|
} = useWindow(windowId, areaId);
|
|
35
36
|
const maximizedId = useAreasStore(
|
|
36
37
|
(state) => areaId ? state.hashAreas[areaId]?.maximizedId : void 0,
|
|
@@ -67,7 +68,7 @@ const Window = (props) => {
|
|
|
67
68
|
selected,
|
|
68
69
|
maximized: !!maximizedId,
|
|
69
70
|
onMouseDown: onTouch,
|
|
70
|
-
|
|
71
|
+
emergeType,
|
|
71
72
|
collapsed,
|
|
72
73
|
...process.env.NODE_ENV !== "production" ? {
|
|
73
74
|
[TEST_PROP_ID]: getNameDataTestId(
|
|
@@ -79,14 +80,17 @@ const Window = (props) => {
|
|
|
79
80
|
children: status === "loaded" ? winType === "microfrontend" ? /* @__PURE__ */ jsx(
|
|
80
81
|
MemonizedWindowBaseMicroFrontend,
|
|
81
82
|
{
|
|
83
|
+
emergeType,
|
|
82
84
|
moduleId,
|
|
83
85
|
dynamicMFStore,
|
|
84
86
|
windowTools,
|
|
87
|
+
loggedUser,
|
|
85
88
|
...mfProps
|
|
86
89
|
}
|
|
87
90
|
) : /* @__PURE__ */ jsx(
|
|
88
91
|
WindowBaseComponent,
|
|
89
92
|
{
|
|
93
|
+
emergeType,
|
|
90
94
|
dynamicMFStore,
|
|
91
95
|
windowTools,
|
|
92
96
|
component
|
|
@@ -31,4 +31,5 @@ export declare const useWindow: (windowId: string, areaId?: string) => {
|
|
|
31
31
|
windowTools: WindowToolsMF;
|
|
32
32
|
onTouch: () => void;
|
|
33
33
|
memoizedActions: import('../../../../../../../../WindowBase/types').WindowBaseAction[];
|
|
34
|
+
loggedUser: import('@m4l/core').Maybe<import('@m4l/core').UserAuth>;
|
|
34
35
|
};
|
|
@@ -3,9 +3,25 @@ import { shallow } from "zustand/shallow";
|
|
|
3
3
|
import { u as useAreasStore } from "../../../../../../../hooks/useAreas/index.js";
|
|
4
4
|
import { u as useHeaderActions } from "./useHeaderActions.js";
|
|
5
5
|
import { u as usePopupsStore } from "../../../../../../../../popups/components/PopupsProvider/hooks/usePopupsStore.js";
|
|
6
|
+
import { useAuth } from "@m4l/core";
|
|
6
7
|
import { c as createToaster } from "../../../../../../../../ToastContainer/helpers/toaster.js";
|
|
7
8
|
const useWindow = (windowId, areaId) => {
|
|
8
|
-
const [
|
|
9
|
+
const [
|
|
10
|
+
emergeType,
|
|
11
|
+
moduleId,
|
|
12
|
+
winType,
|
|
13
|
+
title,
|
|
14
|
+
subTitle,
|
|
15
|
+
editionInfo,
|
|
16
|
+
iconUrl,
|
|
17
|
+
version,
|
|
18
|
+
buildTime,
|
|
19
|
+
moduleCount,
|
|
20
|
+
selected,
|
|
21
|
+
loading,
|
|
22
|
+
status,
|
|
23
|
+
dynamicMFStore
|
|
24
|
+
] = useAreasStore((state) => {
|
|
9
25
|
const window = state.hashWindows[windowId];
|
|
10
26
|
const selected2 = areaId ? state.hashAreas[areaId]?.currentLayoutId === windowId : false;
|
|
11
27
|
return [
|
|
@@ -26,6 +42,7 @@ const useWindow = (windowId, areaId) => {
|
|
|
26
42
|
];
|
|
27
43
|
}, shallow);
|
|
28
44
|
const mfProps = useAreasStore((state) => state.hashWindows[windowId]?.mfProps, shallow);
|
|
45
|
+
const { user: loggedUser } = useAuth();
|
|
29
46
|
const component = useAreasStore(
|
|
30
47
|
(state) => state.hashWindows[windowId]?.component,
|
|
31
48
|
shallow
|
|
@@ -66,7 +83,7 @@ const useWindow = (windowId, areaId) => {
|
|
|
66
83
|
throw new Error("show not implemented");
|
|
67
84
|
}
|
|
68
85
|
}),
|
|
69
|
-
[windowId,
|
|
86
|
+
[windowId, setActions, getCookie, getCookies, setCookie, close, startProgress, stopProgress, setFnQueryClose, setWindowTitle]
|
|
70
87
|
);
|
|
71
88
|
useEffect(() => {
|
|
72
89
|
if (status === "init") {
|
|
@@ -100,7 +117,8 @@ const useWindow = (windowId, areaId) => {
|
|
|
100
117
|
dynamicMFStore,
|
|
101
118
|
windowTools,
|
|
102
119
|
onTouch,
|
|
103
|
-
memoizedActions
|
|
120
|
+
memoizedActions,
|
|
121
|
+
loggedUser
|
|
104
122
|
};
|
|
105
123
|
};
|
|
106
124
|
export {
|
|
@@ -148,7 +148,7 @@ export type AreaLayoutStateProps = AreaLayoutProps & WindowState;
|
|
|
148
148
|
export type EmmitNewLayoutProps = Omit<AreaLayoutMFProps, 'windowId' | 'onClose' | 'areaId'> | Omit<AreaLayoutComponentProps, 'windowId' | 'onClose' | 'areaId'> & {
|
|
149
149
|
winType: string;
|
|
150
150
|
emergeType: string;
|
|
151
|
-
layoutProps:
|
|
151
|
+
layoutProps: Omit<LayoutItem, 'i'>;
|
|
152
152
|
moduleId: string;
|
|
153
153
|
dynamicParams: Record<string, any>;
|
|
154
154
|
iconUrl: string;
|
|
@@ -1,46 +1,15 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
import { useModuleDictionary } from "@m4l/core";
|
|
5
4
|
import { R as RootStyled } from "./slots/DistanceToNowFormatterSlots.js";
|
|
6
|
-
import { u as useInterval } from "../../../hooks/useInterval/index.js";
|
|
7
|
-
import { D as DTNF_DICCTIONARY } from "./dictionary.js";
|
|
8
5
|
import { g as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
9
6
|
import { C as COMPONET_KEY_COMPONENT } from "./constants.js";
|
|
10
7
|
import { D as DistanceToNowFormatterSlots } from "./slots/slots.js";
|
|
11
|
-
import {
|
|
8
|
+
import { u as useDistanceToNowFormatter } from "./hooks/useDistanceToNowFormatter.js";
|
|
12
9
|
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
13
10
|
function DistanceToNowFormatter(props) {
|
|
14
11
|
const { presentationTime = "present", date, dataTestId, delay, className, Component = RootStyled, componentProps } = props;
|
|
15
|
-
const {
|
|
16
|
-
const dictionary = useMemo(() => {
|
|
17
|
-
const ret = {
|
|
18
|
-
label_sentence_past_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PAST_SECONDS),
|
|
19
|
-
label_sentence_past_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PAST_OTHERS),
|
|
20
|
-
label_sentence_present_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PRESENT_SECONDS),
|
|
21
|
-
label_sentence_present_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PRESENT_OTHERS),
|
|
22
|
-
label_sentence_future_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_FUTURE_SECONDS),
|
|
23
|
-
label_sentence_future_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_FUTURE_OTHERS),
|
|
24
|
-
label_unit_time_second: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_SECOND),
|
|
25
|
-
label_unit_time_seconds: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_SECONDS),
|
|
26
|
-
label_unit_time_minute: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MINUTE),
|
|
27
|
-
label_unit_time_minutes: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MINUTES),
|
|
28
|
-
label_unit_time_hour: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_HOUR),
|
|
29
|
-
label_unit_time_hours: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_HOURS),
|
|
30
|
-
label_unit_time_day: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_DAY),
|
|
31
|
-
label_unit_time_days: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_DAYS),
|
|
32
|
-
label_unit_time_month: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MONTH),
|
|
33
|
-
label_unit_time_months: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MONTHS),
|
|
34
|
-
label_unit_time_year: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_YEAR),
|
|
35
|
-
label_unit_time_years: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_YEARS)
|
|
36
|
-
};
|
|
37
|
-
return ret;
|
|
38
|
-
}, [getLabel]);
|
|
39
|
-
const [time, setTime] = useState(formatDistanceToNow(presentationTime, date, dictionary));
|
|
40
|
-
const updateTime = useCallback(() => {
|
|
41
|
-
setTime(formatDistanceToNow(presentationTime, date, dictionary));
|
|
42
|
-
}, [date, dictionary, presentationTime]);
|
|
43
|
-
useInterval(updateTime, delay);
|
|
12
|
+
const { time } = useDistanceToNowFormatter({ presentationTime, date, delay });
|
|
44
13
|
if (Component === React.Fragment) {
|
|
45
14
|
return time;
|
|
46
15
|
}
|
|
@@ -19,4 +19,12 @@ export declare const DTNF_DICCTIONARY: {
|
|
|
19
19
|
readonly LABEL_UNIT_TIME_MONTHS: "distance_to_now_formmater.label_unit_time_months";
|
|
20
20
|
readonly LABEL_UNIT_TIME_YEAR: "distance_to_now_formmater.label_unit_time_year";
|
|
21
21
|
readonly LABEL_UNIT_TIME_YEARS: "distance_to_now_formmater.label_unit_time_years";
|
|
22
|
+
readonly LABEL_UNIT_TIME_SECONDS_SHORT: "distance_to_now_formmater.label_unit_time_seconds_short";
|
|
23
|
+
readonly LABEL_UNIT_TIME_MINUTES_SHORT: "distance_to_now_formmater.label_unit_time_minutes_short";
|
|
24
|
+
readonly LABEL_UNIT_TIME_HOURS_SHORT: "distance_to_now_formmater.label_unit_time_hours_short";
|
|
25
|
+
readonly LABEL_UNIT_TIME_DAYS_SHORT: "distance_to_now_formmater.label_unit_time_days_short";
|
|
26
|
+
readonly LABEL_UNIT_TIME_MONTHS_SHORT: "distance_to_now_formmater.label_unit_time_months_short";
|
|
27
|
+
readonly LABEL_UNIT_TIME_YEARS_SHORT: "distance_to_now_formmater.label_unit_time_years_short";
|
|
28
|
+
readonly LABEL_SEPARATOR_TIME: "distance_to_now_formmater.label_separator_time";
|
|
29
|
+
readonly LABEL_SEPARATOR_DATE: "distance_to_now_formmater.label_separator_date";
|
|
22
30
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { DistanceToNowFormatterProps } from '../types';
|
|
3
|
+
import { FormatDistanceToNowReturn } from '../../../../utils/formatDistanceToNow/types';
|
|
4
|
+
/**
|
|
5
|
+
* "useDistanceToNowFormatter" que se encarga de retornar el tiempo transcurrido desde una fecha hasta la fecha actual.
|
|
6
|
+
* Actualizando cada delay configurable a través de props
|
|
7
|
+
* Tiene 3 tipos de presentaciones:
|
|
8
|
+
* En tiempo pasado
|
|
9
|
+
* En tiempo presente
|
|
10
|
+
* En tiempo futuro
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export declare function useDistanceToNowFormatter<T extends React.ElementType>(props: DistanceToNowFormatterProps<T>): FormatDistanceToNowReturn;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useMemo, useState, useRef, useCallback, useEffect } from "react";
|
|
2
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
3
|
+
import { u as useInterval } from "../../../../hooks/useInterval/index.js";
|
|
4
|
+
import { D as DTNF_DICCTIONARY } from "../dictionary.js";
|
|
5
|
+
import { f as formatDistanceToNow } from "../../../../utils/formatDistanceToNow/formatDistanteToNow.js";
|
|
6
|
+
function useDistanceToNowFormatter(props) {
|
|
7
|
+
const { presentationTime = "present", date, delay } = props;
|
|
8
|
+
const { getLabel } = useModuleDictionary();
|
|
9
|
+
const dictionary = useMemo(() => {
|
|
10
|
+
const ret = {
|
|
11
|
+
label_sentence_past_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PAST_SECONDS),
|
|
12
|
+
label_sentence_past_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PAST_OTHERS),
|
|
13
|
+
label_sentence_present_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PRESENT_SECONDS),
|
|
14
|
+
label_sentence_present_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PRESENT_OTHERS),
|
|
15
|
+
label_sentence_future_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_FUTURE_SECONDS),
|
|
16
|
+
label_sentence_future_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_FUTURE_OTHERS),
|
|
17
|
+
label_unit_time_second: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_SECOND),
|
|
18
|
+
label_unit_time_seconds: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_SECONDS),
|
|
19
|
+
label_unit_time_minute: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MINUTE),
|
|
20
|
+
label_unit_time_minutes: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MINUTES),
|
|
21
|
+
label_unit_time_hour: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_HOUR),
|
|
22
|
+
label_unit_time_hours: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_HOURS),
|
|
23
|
+
label_unit_time_day: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_DAY),
|
|
24
|
+
label_unit_time_days: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_DAYS),
|
|
25
|
+
label_unit_time_month: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MONTH),
|
|
26
|
+
label_unit_time_months: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MONTHS),
|
|
27
|
+
label_unit_time_year: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_YEAR),
|
|
28
|
+
label_unit_time_years: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_YEARS),
|
|
29
|
+
label_unit_time_seconds_short: "ss",
|
|
30
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_SECONDS_SHORT),
|
|
31
|
+
label_unit_time_minutes_short: "mm",
|
|
32
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MINUTES_SHORT),
|
|
33
|
+
label_unit_time_hours_short: "hh",
|
|
34
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_HOURS_SHORT),
|
|
35
|
+
label_unit_time_days_short: "DD",
|
|
36
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_DAYS_SHORT),
|
|
37
|
+
label_unit_time_months_short: "MM",
|
|
38
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MONTHS_SHORT),
|
|
39
|
+
label_unit_time_years_short: "YY",
|
|
40
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_YEARS_SHORT),
|
|
41
|
+
label_separator_time: ":",
|
|
42
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_SEPARATOR_TIME),
|
|
43
|
+
label_separator_date: "-"
|
|
44
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_SEPARATOR_DATE),
|
|
45
|
+
};
|
|
46
|
+
return ret;
|
|
47
|
+
}, [getLabel]);
|
|
48
|
+
const [time, setTime] = useState(formatDistanceToNow(presentationTime, new Date(date), dictionary));
|
|
49
|
+
const refTime = useRef({ ...time });
|
|
50
|
+
const updateTime = useCallback(() => {
|
|
51
|
+
const newTime = formatDistanceToNow(presentationTime, new Date(date), dictionary);
|
|
52
|
+
if (refTime.current.value !== newTime.value || refTime.current.unit !== newTime.unit) {
|
|
53
|
+
refTime.current = newTime;
|
|
54
|
+
setTime(newTime);
|
|
55
|
+
}
|
|
56
|
+
}, [date, dictionary, presentationTime]);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
updateTime();
|
|
59
|
+
}, [updateTime]);
|
|
60
|
+
useInterval(updateTime, delay);
|
|
61
|
+
return time;
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
useDistanceToNowFormatter as u
|
|
65
|
+
};
|
|
@@ -11,7 +11,10 @@ export type DistanceToNowFormatterProps<T extends React.ElementType = typeof Roo
|
|
|
11
11
|
*/
|
|
12
12
|
componentProps?: React.ComponentPropsWithoutRef<T>;
|
|
13
13
|
presentationTime: PresentationTimeType;
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Se maneja en string, para evitar re-renderizaciones innecesarias debido a que Date es un objeto y se crea un nuevo objeto cada vez que se pasa como prop.
|
|
16
|
+
*/
|
|
17
|
+
date: string;
|
|
15
18
|
delay?: number;
|
|
16
19
|
dataTestId?: string;
|
|
17
20
|
className?: string;
|
|
@@ -4,4 +4,4 @@ import { RHFAutocompleteProps } from './types';
|
|
|
4
4
|
* @param props - The properties for the RHFAutocomplete component.
|
|
5
5
|
* @returns The RHFAutocomplete component.
|
|
6
6
|
*/
|
|
7
|
-
export declare function RHFAutocomplete<T>(props: RHFAutocompleteProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function RHFAutocomplete<T, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined>(props: RHFAutocompleteProps<T, Multiple, DisableClearable, FreeSolo>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useId, useState, useCallback, useEffect } from "react";
|
|
3
3
|
import { useFormContext, Controller } from "react-hook-form";
|
|
4
|
+
import { r as rhfAutocompleteClasses } from "./constants.js";
|
|
5
|
+
import clsx from "clsx";
|
|
4
6
|
import { A as AutocompleteRootStyled, L as LabelStyled } from "./slots/RHFAutocompleteSlots.js";
|
|
5
7
|
import { A as Autocomplete } from "../../mui_extended/Autocomplete/Autocomplete.js";
|
|
6
8
|
import { H as HelperError } from "../../HelperError/HelperError.js";
|
|
@@ -23,8 +25,9 @@ function RHFAutocomplete(props) {
|
|
|
23
25
|
multiple,
|
|
24
26
|
refresh,
|
|
25
27
|
startAdornment,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
getOptionStartAdornment,
|
|
29
|
+
getOptionEndAdornment,
|
|
30
|
+
className
|
|
28
31
|
// onChange: onChangeRHF,
|
|
29
32
|
} = props;
|
|
30
33
|
const htmlForId = useId();
|
|
@@ -62,6 +65,7 @@ function RHFAutocomplete(props) {
|
|
|
62
65
|
return /* @__PURE__ */ jsx(
|
|
63
66
|
AutocompleteRootStyled,
|
|
64
67
|
{
|
|
68
|
+
className: clsx(className, rhfAutocompleteClasses.autocompleteRoot),
|
|
65
69
|
ownerState: { ...ownerState },
|
|
66
70
|
size,
|
|
67
71
|
children: /* @__PURE__ */ jsx(
|
|
@@ -117,8 +121,8 @@ function RHFAutocomplete(props) {
|
|
|
117
121
|
value,
|
|
118
122
|
htmlFor: htmlForId,
|
|
119
123
|
startAdornment,
|
|
120
|
-
|
|
121
|
-
|
|
124
|
+
getOptionStartAdornment,
|
|
125
|
+
getOptionEndAdornment
|
|
122
126
|
}
|
|
123
127
|
),
|
|
124
128
|
error?.message ? /* @__PURE__ */ jsx(HelperError, { message: error?.message }) : null
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { g as getComponentClasses } from "../../../utils/getComponentSlotRoot.js";
|
|
2
|
+
import { R as RFHAutocompleteSlots } from "./slots/RHFAutocompleteEnum.js";
|
|
1
3
|
const RFHAUTOCOMPLETE_KEY_COMPONENT = "RHFM4LAutocomplete";
|
|
4
|
+
const rhfAutocompleteClasses = getComponentClasses(RFHAUTOCOMPLETE_KEY_COMPONENT, RFHAutocompleteSlots);
|
|
2
5
|
export {
|
|
3
|
-
RFHAUTOCOMPLETE_KEY_COMPONENT as R
|
|
6
|
+
RFHAUTOCOMPLETE_KEY_COMPONENT as R,
|
|
7
|
+
rhfAutocompleteClasses as r
|
|
4
8
|
};
|
|
@@ -54,11 +54,11 @@ export interface RHFAutocompleteProps<T = any, Multiple extends boolean | undefi
|
|
|
54
54
|
/**
|
|
55
55
|
* Icono o adorno inicial que se muestra en cada opción del autocomplete.
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
getOptionEndAdornment?: AutocompleteProps<T, Multiple>['getOptionEndAdornment'];
|
|
58
58
|
/**
|
|
59
59
|
* Icono o adorno final que se muestra en cada opción del autocomplete.
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
getOptionStartAdornment?: AutocompleteProps<T, Multiple>['getOptionStartAdornment'];
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Represents the owner state of the Autocomplete component for styling purposes.
|
|
@@ -24,8 +24,9 @@ function RHFAutocompleteAsync(props) {
|
|
|
24
24
|
skeletonWidth,
|
|
25
25
|
responseToCamelCase,
|
|
26
26
|
startAdornment,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
getOptionStartAdornment,
|
|
28
|
+
getOptionEndAdornment,
|
|
29
|
+
className
|
|
29
30
|
} = props;
|
|
30
31
|
const [state, dispatch] = useReducer(
|
|
31
32
|
RHFAutocompleteAsyncReducer(onChangeFilterParms),
|
|
@@ -77,6 +78,7 @@ function RHFAutocompleteAsync(props) {
|
|
|
77
78
|
return /* @__PURE__ */ jsx(
|
|
78
79
|
RHFAutocomplete,
|
|
79
80
|
{
|
|
81
|
+
className,
|
|
80
82
|
name,
|
|
81
83
|
loading: state.loading,
|
|
82
84
|
label,
|
|
@@ -92,8 +94,8 @@ function RHFAutocompleteAsync(props) {
|
|
|
92
94
|
onClose: onCloseLocal,
|
|
93
95
|
skeletonWidth,
|
|
94
96
|
startAdornment,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
getOptionStartAdornment,
|
|
98
|
+
getOptionEndAdornment
|
|
97
99
|
}
|
|
98
100
|
);
|
|
99
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const RHFAutocompleteAsyncRootStyled: import('@emotion/styled').StyledComponent<Pick<import('../../RHFAutocomplete/types').RHFAutocompleteProps<unknown, undefined, undefined, undefined>, keyof import('../../RHFAutocomplete/types').RHFAutocompleteProps<unknown, undefined, undefined, undefined>> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown>, {}, {}>;
|
|
1
|
+
export declare const RHFAutocompleteAsyncRootStyled: import('@emotion/styled').StyledComponent<Pick<import('../../RHFAutocomplete/types').RHFAutocompleteProps<unknown, boolean | undefined, boolean | undefined, boolean | undefined>, keyof import('../../RHFAutocomplete/types').RHFAutocompleteProps<unknown, boolean | undefined, boolean | undefined, boolean | undefined>> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown>, {}, {}>;
|
|
@@ -41,6 +41,10 @@ export interface RHFAutocompleteAsyncProps<T extends any = unknown> extends Omit
|
|
|
41
41
|
* Whether the autocomplete is multiple
|
|
42
42
|
*/
|
|
43
43
|
multiple?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Class name for the autocomplete
|
|
46
|
+
*/
|
|
47
|
+
className?: string;
|
|
44
48
|
}
|
|
45
49
|
/**
|
|
46
50
|
* Defines the types of Slots available for the Autocomplete.
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
1
2
|
import { AutocompleteProps } from './types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* MUI va a genera el siguiente warning (Y es normal que suceda, no es necesario darle solución):
|
|
6
|
-
* MUI: The value provided to Autocomplete is invalid.
|
|
7
|
-
* None of the options match with `{"y":y,"x":"xxx"}`. etc.
|
|
8
|
-
*/
|
|
9
|
-
export declare const Autocomplete: import('react').ForwardRefExoticComponent<AutocompleteProps<unknown, boolean | undefined> & import('react').RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
|
|
3
|
+
export declare const Autocomplete: <T, Multiple extends boolean | undefined = undefined>(props: AutocompleteProps<T, Multiple> & {
|
|
4
|
+
ref?: Ref<HTMLInputElement | HTMLTextAreaElement>;
|
|
5
|
+
}) => JSX.Element;
|
|
@@ -8,7 +8,7 @@ import { u as useEndAdornments } from "./hooks/useEndAdornments.js";
|
|
|
8
8
|
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
9
9
|
import { S as SkeletonAutocompleteStyled, A as AutocompleteRootStyled, R as RenderInputStyled, P as PopperComponentStyled } from "./slots/AutocompleteSlots.js";
|
|
10
10
|
import { T as Typography } from "../Typography/Typography.js";
|
|
11
|
-
|
|
11
|
+
function AutocompleteComponent(props, ref) {
|
|
12
12
|
const {
|
|
13
13
|
options,
|
|
14
14
|
disabled,
|
|
@@ -17,16 +17,14 @@ const Autocomplete = forwardRef(function Autocomplete2(props, ref) {
|
|
|
17
17
|
size = "medium",
|
|
18
18
|
onChangeFilterParmsLocal,
|
|
19
19
|
multiple,
|
|
20
|
-
getOptionUrlImage,
|
|
21
|
-
// Diferencia
|
|
22
20
|
refresh,
|
|
23
21
|
error = false,
|
|
24
22
|
htmlFor,
|
|
25
23
|
readOnly = false,
|
|
26
24
|
placeholder,
|
|
27
25
|
startAdornment,
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
getOptionStartAdornment,
|
|
27
|
+
getOptionEndAdornment
|
|
30
28
|
} = props;
|
|
31
29
|
const { getLabel } = useModuleDictionary();
|
|
32
30
|
const isSkeleton = useModuleSkeleton();
|
|
@@ -47,6 +45,7 @@ const Autocomplete = forwardRef(function Autocomplete2(props, ref) {
|
|
|
47
45
|
checkKeyDown,
|
|
48
46
|
scrollPositionOptionsRef
|
|
49
47
|
} = useValuesAndHandlers(props);
|
|
48
|
+
const hasStartAdornment = !!startAdornment;
|
|
50
49
|
const ownerState = useMemo(() => ({
|
|
51
50
|
size: adjustedSize,
|
|
52
51
|
variant,
|
|
@@ -54,8 +53,8 @@ const Autocomplete = forwardRef(function Autocomplete2(props, ref) {
|
|
|
54
53
|
multiple: Boolean(multiple),
|
|
55
54
|
error,
|
|
56
55
|
readOnly,
|
|
57
|
-
startAdornment:
|
|
58
|
-
}), [adjustedSize, disabled, error, multiple, variant, readOnly,
|
|
56
|
+
startAdornment: hasStartAdornment
|
|
57
|
+
}), [adjustedSize, disabled, error, multiple, variant, readOnly, hasStartAdornment]);
|
|
59
58
|
const startAdornments = useStartAdornments({
|
|
60
59
|
selectedValue,
|
|
61
60
|
multiple,
|
|
@@ -65,8 +64,8 @@ const Autocomplete = forwardRef(function Autocomplete2(props, ref) {
|
|
|
65
64
|
handleDelete,
|
|
66
65
|
disabled,
|
|
67
66
|
startAdornment,
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
getOptionStartAdornment,
|
|
68
|
+
getOptionEndAdornment
|
|
70
69
|
});
|
|
71
70
|
const endAdornments = useEndAdornments({
|
|
72
71
|
loading,
|
|
@@ -133,7 +132,7 @@ const Autocomplete = forwardRef(function Autocomplete2(props, ref) {
|
|
|
133
132
|
selected: isSelected,
|
|
134
133
|
disabled,
|
|
135
134
|
size
|
|
136
|
-
});
|
|
135
|
+
}, getOptionStartAdornment, getOptionEndAdornment);
|
|
137
136
|
},
|
|
138
137
|
ListboxProps: {
|
|
139
138
|
//Esto para no perder el scroll de la lista de opciones, cuando es multiple, ya que MUI no lo guarda
|
|
@@ -182,7 +181,8 @@ const Autocomplete = forwardRef(function Autocomplete2(props, ref) {
|
|
|
182
181
|
}
|
|
183
182
|
}
|
|
184
183
|
);
|
|
185
|
-
}
|
|
184
|
+
}
|
|
185
|
+
const Autocomplete = forwardRef(AutocompleteComponent);
|
|
186
186
|
export {
|
|
187
187
|
Autocomplete as A
|
|
188
188
|
};
|