@m4l/components 0.1.63 → 0.1.65
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/export.d.ts +9 -5
- package/components/CommonActions/components/ActionCancel/{index.2eb2c1e1.js → index.0f471356.js} +1 -1
- package/components/CommonActions/components/ActionFormCancel/{index.2864d574.js → index.4d2f599e.js} +16 -18
- package/components/CommonActions/components/ActionFormIntro/{index.e7f83ddd.js → index.0eed3ba3.js} +1 -1
- package/components/CommonActions/components/ActionIntro/{index.0d138cb3.js → index.41a598d6.js} +2 -2
- package/components/CommonActions/components/Actions/{index.433cd345.js → index.3b882471.js} +15 -18
- package/components/DataGrid/{index.42521a55.js → index.dc84293a.js} +32 -35
- package/components/DynamicFilter/{index.442bda79.js → index.abc697c7.js} +38 -46
- package/components/DynamicFilter/index.d.ts +1 -1
- package/components/HelperText/{index.3c07ca2a.js → index.1a24d41b.js} +10 -10
- package/components/Icon/{index.0f9b360e.js → index.6938827f.js} +2 -2
- package/components/Icon/tests/utils.d.ts +1 -1
- package/components/Image/{index.1a9c0327.js → index.674024d4.js} +1 -1
- package/components/LanguagePopover/{index.68de7176.js → index.47aa8119.js} +11 -11
- package/components/ModalDialog/{index.3efe049b.js → index.3db4480d.js} +5 -5
- package/components/NavLink/{index.ae9f1cc9.js → index.0d125c6b.js} +11 -11
- package/components/NoItemSelected/{index.7cfd7613.js → index.1aa96110.js} +1 -1
- package/components/ObjectLogs/{index.b50726fb.js → index.05788334.js} +18 -21
- package/components/PaperForm/{index.44bf4469.js → index.b3da0da3.js} +1 -1
- package/components/Period/{index.99feb99e.js → index.a1b7b4cc.js} +16 -19
- package/components/Resizeable/{index.b5d42efb.js → index.ee84ebc5.js} +3 -3
- package/components/SideBar/{index.011880b6.js → index.99ce4e06.js} +7 -7
- package/components/areas/components/AreasAdmin/classes/index.d.ts +5 -0
- package/components/areas/components/AreasAdmin/classes/types.d.ts +11 -0
- package/components/areas/components/AreasAdmin/index.46fab65b.js +135 -0
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/types.d.ts +1 -1
- package/components/areas/components/AreasViewer/classes/index.d.ts +5 -0
- package/components/areas/components/AreasViewer/classes/types.d.ts +19 -0
- package/components/areas/components/AreasViewer/index.1aa4d12d.js +1972 -0
- package/components/areas/components/AreasViewer/index.d.ts +7 -0
- package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/contexts}/AreaContext/helper.d.ts +2 -2
- package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/contexts}/AreaContext/index.d.ts +3 -3
- package/components/areas/components/AreasViewer/subcomponents/Area/contexts/AreaContext/store.d.ts +11 -0
- package/components/areas/{contexts/AreaContext/store.d.ts → components/AreasViewer/subcomponents/Area/contexts/AreaContext/types.d.ts} +29 -16
- package/components/areas/components/AreasViewer/subcomponents/Area/index.d.ts +12 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/GridLayout/index.d.ts +5 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/PanelWindows/index.d.ts +6 -0
- package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/WindowContext/store.d.ts +8 -3
- package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/WindowContext/types.d.ts +1 -1
- package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/index.d.ts +1 -1
- package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/index.d.ts +1 -1
- package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/Component/index.d.ts +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/Header/helper.d.ts +3 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/Header/subcomponents/MainActions/index.d.ts +1 -0
- package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/index.d.ts +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/types.d.ts +8 -0
- package/components/areas/components/{WindowModal → AreasViewer/subcomponents/Area/subcomponents/WindowModal}/index.d.ts +1 -1
- package/components/areas/components/{WindowPopUp → AreasViewer/subcomponents/Area/subcomponents/WindowPopUp}/index.d.ts +1 -1
- package/components/areas/components/{Area → AreasViewer/subcomponents/Area}/types.d.ts +6 -11
- package/components/areas/components/index.9de77fae.js +12 -0
- package/components/areas/components/index.d.ts +4 -4
- package/components/areas/constants.d.ts +3 -0
- package/components/areas/contexts/AreasContext/{index.0792a8d1.js → index.b3b26965.js} +78 -44
- package/components/areas/contexts/AreasContext/index.d.ts +10 -4
- package/components/areas/contexts/AreasContext/store.d.ts +8 -29
- package/components/areas/contexts/AreasContext/types.d.ts +119 -0
- package/components/areas/contexts/WindowToolsMFContext/types.d.ts +3 -2
- package/components/areas/contexts/index.4ebef035.js +21 -0
- package/components/areas/dictionary.d.ts +9 -14
- package/components/areas/hooks/{index.f4d78492.js → index.ffb1009e.js} +3 -2
- package/components/areas/hooks/useArea/{index.d6263051.js → index.c7e4f3fc.js} +17 -3
- package/components/areas/hooks/useArea/index.d.ts +1 -1
- package/components/areas/hooks/useAreas/index.d.ts +1 -1
- package/components/areas/hooks/useDynamicMFParameters/{index.041a666b.js → index.9a25f88a.js} +1 -1
- package/components/areas/hooks/useWindow/index.d.ts +1 -1
- package/components/areas/icons.d.ts +8 -0
- package/components/areas/index.bfe6bf91.js +46 -0
- package/components/areas/index.d.ts +1 -0
- package/components/formatters/BooleanFormatter/{index.cd00c8e1.js → index.7b9e92f8.js} +1 -1
- package/components/formatters/{index.deae4701.js → index.01b027ad.js} +2 -2
- package/components/hook-form/RHFAutocomplete/{index.083e23c1.js → index.73d33896.js} +13 -12
- package/components/hook-form/RHFAutocomplete/test/constants.d.ts +1 -0
- package/components/hook-form/RHFAutocomplete/test/utils.d.ts +1 -1
- package/components/hook-form/RHFAutocompleteAsync/{index.ba751be9.js → index.21f4cb53.js} +2 -2
- package/components/hook-form/RHFCheckbox/{index.c19393b1.js → index.c3b1884b.js} +3 -3
- package/components/hook-form/RHFPeriod/{index.c0a80aeb.js → index.cc624bb3.js} +2 -2
- package/components/hook-form/RHFTextField/{index.97485ff2.js → index.15659666.js} +13 -13
- package/components/hook-form/RHFUpload/{index.798eb11d.js → index.ecf5c788.js} +1 -1
- package/components/index.d.ts +1 -3
- package/components/modal/{WindowBase.59f50553.js → WindowBase.1b0657de.js} +3 -3
- package/components/modal/{WindowConfirm.c1339cf8.js → WindowConfirm.60028bce.js} +18 -21
- package/components/modal/index.fde6acc3.js +27 -0
- package/components/mui_extended/Accordion/{index.b7487e37.js → index.95a1b021.js} +2 -2
- package/components/mui_extended/Button/{index.d9e0ae2e.js → index.e4c61b66.js} +3 -3
- package/components/mui_extended/IconButton/{index.be9c2ce5.js → index.78a489d3.js} +15 -11
- package/components/mui_extended/IconButton/types.d.ts +1 -1
- package/components/mui_extended/MenuActions/icons.d.ts +3 -0
- package/components/mui_extended/MenuActions/{index.ec654122.js → index.742a57d7.js} +21 -20
- package/components/mui_extended/MenuActions/types.d.ts +5 -6
- package/components/mui_extended/Pager/{index.9e123670.js → index.a44594e9.js} +5 -5
- package/components/mui_extended/Popover/{index.260aae81.js → index.e271e4f0.js} +1 -0
- package/components/mui_extended/Typography/{index.41b60a6b.js → index.86505aed.js} +1 -1
- package/components/mui_extended/index.61356a6a.js +19 -0
- package/contexts/ModalContext/{index.ae8041f3.js → index.bfc47ba9.js} +1 -1
- package/hooks/useModal/{index.5c159ed2.js → index.979ab2ea.js} +1 -1
- package/index.js +111 -116
- package/package.json +5 -6
- package/{react-draggable.1aa81436.js → react-draggable.d6441025.js} +1 -1
- package/{react-resizable.e86cb01e.js → react-resizable.79fb7404.js} +5 -4
- package/utils/{index.e199226a.js → index.64775c34.js} +32 -32
- package/{vendor.a15d263e.js → vendor.2d9f95b4.js} +50 -52
- package/components/AccountPopover/style.d.ts +0 -2
- package/components/AccountPopover/subcomponents/PopOver/styles.d.ts +0 -8
- package/components/AppBar/styles.d.ts +0 -2
- package/components/CommonActions/components/Actions/styles.d.ts +0 -2
- package/components/DataGrid/styles.d.ts +0 -3
- package/components/DataGrid/subcomponents/Actions/styles.d.ts +0 -2
- package/components/DataGrid/subcomponents/Actions/subcomponents/Density/styles.d.ts +0 -3
- package/components/DataGrid/subcomponents/Actions/subcomponents/Filter/styles.d.ts +0 -2
- package/components/DataGrid/subcomponents/Actions/subcomponents/RowsCount/styles.d.ts +0 -4
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/styles.d.ts +0 -2
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/styles.d.ts +0 -8
- package/components/DataGrid/subcomponents/Table/styles.d.ts +0 -3
- package/components/DataGrid/subcomponents/Table/subcomponents/SkeletonFormatter/styles.d.ts +0 -2
- package/components/DataGrid/subcomponents/editors/TextEditor/index.d.ts +0 -6
- package/components/DynamicFilter/subcomponents/ApplyedFilters/styles.d.ts +0 -3
- package/components/DynamicFilter/subcomponents/ApplyedFilters/subcomponents/ApplyedFilter/styles.d.ts +0 -6
- package/components/DynamicFilter/subcomponents/ClearFilters/styles.d.ts +0 -3
- package/components/DynamicFilter/subcomponents/FilterButton/styles.d.ts +0 -3
- package/components/DynamicFilter/subcomponents/InnerForHooks/styles.d.ts +0 -3
- package/components/DynamicFilter/subcomponents/InputFilter/styles.d.ts +0 -2
- package/components/DynamicFilter/subcomponents/PopoverFilter/styles.d.ts +0 -3
- package/components/DynamicFilter/subcomponents/fieldstypes/BooleanFilter/styles.d.ts +0 -2
- package/components/DynamicFilter/subcomponents/fieldstypes/DateTimeFilter/styles.d.ts +0 -2
- package/components/DynamicFilter/subcomponents/fieldstypes/NumberFilter/styles.d.ts +0 -2
- package/components/DynamicFilter/subcomponents/fieldstypes/StringFilter/styles.d.ts +0 -2
- package/components/HelperText/styles.d.ts +0 -2
- package/components/Icon/styles.d.ts +0 -4
- package/components/Image/styles.d.ts +0 -3
- package/components/Image/subcomponents/LazyLoadComponent/styles.d.ts +0 -2
- package/components/Image/subcomponents/Skeleton/styles.d.ts +0 -2
- package/components/LanguagePopover/styles.d.ts +0 -6
- package/components/NavLink/styles.d.ts +0 -2
- package/components/NoItemSelected/styles.d.ts +0 -5
- package/components/ObjectLogs/components/DetailDialog/styles.d.ts +0 -3
- package/components/ObjectLogs/styles.d.ts +0 -4
- package/components/PaperForm/styles.d.ts +0 -7
- package/components/Period/styles.d.ts +0 -7
- package/components/PropertyValue/styles.d.ts +0 -6
- package/components/ResizeableWindow/styles.d.ts +0 -5
- package/components/ScrollBar/styles.d.ts +0 -8
- package/components/SideBar/styles.d.ts +0 -5
- package/components/SideBar/subcomponents/ContentDesktop/style.d.ts +0 -2
- package/components/SideBar/subcomponents/ContentDesktop/subcomponents/CollapseButton/styles.d.ts +0 -3
- package/components/SideBar/subcomponents/ContentGroups/styles.d.ts +0 -5
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/styles.d.ts +0 -2
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/ArrowIcon/styles.d.ts +0 -2
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavItemRoot/styles.d.ts +0 -9
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavItemRoot/subcomponents/NavItemRootContent/styles.d.ts +0 -3
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavListSub/styles.d.ts +0 -2
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavListSub/subcomponents/NavItemSub/subcomponents/NavItemSubContent/styles.d.ts +0 -22
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/Skeleton/styles.d.ts +0 -5
- package/components/SideBar/subcomponents/ContentMobile/styles.d.ts +0 -3
- package/components/SplitLayout/styles.d.ts +0 -4
- package/components/animate/LoadingScreen/styles.d.ts +0 -3
- package/components/animate/PropagateLoader/syles.d.ts +0 -2
- package/components/areas/components/Area/index.d.ts +0 -5
- package/components/areas/components/Area/styles.d.ts +0 -6
- package/components/areas/components/AreasAdmin/index.51e28f63.js +0 -120
- package/components/areas/components/AreasAdmin/styles.d.ts +0 -2
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/styles.d.ts +0 -3
- package/components/areas/components/AreasContainer/index.1e5e6e91.js +0 -37
- package/components/areas/components/AreasContainer/index.d.ts +0 -1
- package/components/areas/components/AreasContainer/styles.d.ts +0 -2
- package/components/areas/components/GridLayout/index.5bf8d5e4.js +0 -103
- package/components/areas/components/GridLayout/index.d.ts +0 -1
- package/components/areas/components/GridLayout/styles.d.ts +0 -7
- package/components/areas/components/Window/icons.d.ts +0 -3
- package/components/areas/components/Window/index.416a874f.js +0 -855
- package/components/areas/components/Window/styles.d.ts +0 -6
- package/components/areas/components/Window/subcomponents/InnerForHooks/styles.d.ts +0 -2
- package/components/areas/components/Window/subcomponents/InnerForHooks/subcomponents/Header/styles.d.ts +0 -9
- package/components/areas/components/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/styles.d.ts +0 -2
- package/components/areas/components/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/subcomponents/NotFound/styles.d.ts +0 -2
- package/components/areas/components/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/types.d.ts +0 -8
- package/components/areas/components/WindowModal/styles.d.ts +0 -3
- package/components/areas/components/WindowPopUp/index.f053fca7.js +0 -118
- package/components/areas/components/WindowsPanel/index.d.ts +0 -1
- package/components/areas/components/WindowsPanel/styles.d.ts +0 -10
- package/components/areas/components/index.eace295a.js +0 -77
- package/components/areas/contexts/AreaContext/index.7890e58d.js +0 -509
- package/components/areas/contexts/AreaContext/types.d.ts +0 -20
- package/components/areas/contexts/index.2a915acf.js +0 -198
- package/components/areas/index.8fca0f8f.js +0 -20
- package/components/hook-form/RHFAutocomplete/styles.d.ts +0 -2
- package/components/hook-form/RHFAutocomplete/subcomponents/RenderOption/styles.d.ts +0 -2
- package/components/hook-form/RHFAutocomplete/subcomponents/Skeleton/styles.d.ts +0 -4
- package/components/hook-form/RHFAutocompleteAsync/styles.d.ts +0 -5
- package/components/hook-form/RHFCheckbox/styles.d.ts +0 -15
- package/components/hook-form/RHFCheckbox/subcomponents/Skeleton/styles.d.ts +0 -3
- package/components/hook-form/RHFDateTime/subcomponents/Skeleton/styles.d.ts +0 -2
- package/components/hook-form/RHFPeriod/styles.d.ts +0 -2
- package/components/hook-form/RHFTextField/styles.d.ts +0 -3
- package/components/hook-form/RHFTextField/subcomponents/Skeleton/styles.d.ts +0 -3
- package/components/hook-form/RHFTextFieldPassword/styles.d.ts +0 -2
- package/components/hook-form/RHFUpload/RHFUploadImage/styles.d.ts +0 -2
- package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/styles.d.ts +0 -12
- package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/subcomponents/Skeleton/styles.d.ts +0 -2
- package/components/modal/ModalDialog/styles.d.ts +0 -9
- package/components/modal/WindowBase/styles.d.ts +0 -2
- package/components/modal/WindowBase/subcomponents/Header/styles.d.ts +0 -6
- package/components/modal/WindowConfirm/subcomponents/MessageIlustration/styles.d.ts +0 -6
- package/components/modal/index.7a84f64d.js +0 -30
- package/components/mui_extended/Accordion/styles.d.ts +0 -4
- package/components/mui_extended/Button/styles.d.ts +0 -13
- package/components/mui_extended/IconButton/styles.d.ts +0 -2
- package/components/mui_extended/ImageButton/styles.d.ts +0 -2
- package/components/mui_extended/LoadingButton/styles.d.ts +0 -2
- package/components/mui_extended/MenuActions/styles.d.ts +0 -30
- package/components/mui_extended/Pager/components/PagerActions/styles.d.ts +0 -2
- package/components/mui_extended/Pager/styles.d.ts +0 -6
- package/components/mui_extended/Popover/styles.d.ts +0 -1
- package/components/mui_extended/Popover/subcomponts/ArrowIcon/index.d.ts +0 -3
- package/components/mui_extended/Tab/styles.d.ts +0 -2
- package/components/mui_extended/Typography/styles.d.ts +0 -2
- package/components/mui_extended/index.459cbd6c.js +0 -19
- package/contexts/RHFormContext/styles.d.ts +0 -2
- package/components/areas/components/{Area → AreasViewer/subcomponents/Area}/subcomponents/InnerForHooks/index.d.ts +0 -0
- package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/WindowContext/helper.d.ts +0 -0
- package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/WindowContext/index.d.ts +0 -0
- package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/Header/index.d.ts +0 -0
- package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/Header/skeleton.d.ts +0 -0
- package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/index.d.ts +0 -0
- package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/index.d.ts +0 -0
- package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/subcomponents/NotFound/index.d.ts +0 -0
- package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/subcomponents/NotFound/types.d.ts +0 -0
- package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/types.d.ts +0 -0
- package/components/areas/contexts/DynamicMFParmsContext/{index.c19cb8cc.js → index.5b3248df.js} +14 -14
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Muestra las áreas cargadas en el store, si no se han cargado muestra un componente indicando la carga.
|
|
3
|
+
* Se debe visualizar todas las areas, y con display:none para todas menos para la activa, para que no se tengan que estar montando y destruyendo
|
|
4
|
+
* las ventanas que al cambiar entre áreas
|
|
5
|
+
* @returns JSX Areas
|
|
6
|
+
*/
|
|
7
|
+
export declare function AreasViewer(): JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WritableDraft } from 'immer/dist/internal';
|
|
2
2
|
import { Layouts } from 'react-grid-layout';
|
|
3
|
-
import { HashWindowsByLayouts } from '../../
|
|
4
|
-
import { AreaStateWithActions } from './
|
|
3
|
+
import { HashWindowsByLayouts } from '../../types';
|
|
4
|
+
import { AreaStateWithActions } from './types';
|
|
5
5
|
import { WinLayout } from './types';
|
|
6
6
|
export declare const ROW_HEIGTH_GRIDLAYOUT = 100;
|
|
7
7
|
export declare const CONTAINER_PADDING_GRIDLAYOUT = 3;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AreaProviderProps } from './types';
|
|
3
|
-
declare const AreaContext: React.Context<(Omit<Omit<import("zustand").StoreApi<import("./
|
|
3
|
+
declare const AreaContext: React.Context<(Omit<Omit<import("zustand").StoreApi<import("./types").AreaStateWithActions>, "setState"> & {
|
|
4
4
|
setState<A extends string | {
|
|
5
5
|
type: unknown;
|
|
6
|
-
}>(partial: import("./
|
|
6
|
+
}>(partial: import("./types").AreaStateWithActions | Partial<import("./types").AreaStateWithActions> | ((state: import("./types").AreaStateWithActions) => import("./types").AreaStateWithActions | Partial<import("./types").AreaStateWithActions>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
7
7
|
}, "setState"> & {
|
|
8
|
-
setState(nextStateOrUpdater: import("./
|
|
8
|
+
setState(nextStateOrUpdater: import("./types").AreaStateWithActions | Partial<import("./types").AreaStateWithActions> | ((state: import("immer/dist/internal").WritableDraft<import("./types").AreaStateWithActions>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
9
9
|
type: unknown;
|
|
10
10
|
} | undefined): void;
|
|
11
11
|
}) | null>;
|
package/components/areas/components/AreasViewer/subcomponents/Area/contexts/AreaContext/store.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AreaStateWithActions, InitialStoreProps } from './types';
|
|
2
|
+
export declare const createAreaStore: (initProps: InitialStoreProps) => Omit<Omit<import("zustand").StoreApi<AreaStateWithActions>, "setState"> & {
|
|
3
|
+
setState<A extends string | {
|
|
4
|
+
type: unknown;
|
|
5
|
+
}>(partial: AreaStateWithActions | Partial<AreaStateWithActions> | ((state: AreaStateWithActions) => AreaStateWithActions | Partial<AreaStateWithActions>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
6
|
+
}, "setState"> & {
|
|
7
|
+
setState(nextStateOrUpdater: AreaStateWithActions | Partial<AreaStateWithActions> | ((state: import("immer/dist/internal").WritableDraft<AreaStateWithActions>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
8
|
+
type: unknown;
|
|
9
|
+
} | undefined): void;
|
|
10
|
+
};
|
|
11
|
+
export declare type AreaStore = ReturnType<typeof createAreaStore>;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Layout, Layouts } from 'react-grid-layout';
|
|
1
|
+
import { ReactNode } from 'react';
|
|
3
2
|
import { DebouncedFunc } from 'lodash';
|
|
4
|
-
import {
|
|
3
|
+
import { Layout, Layouts } from 'react-grid-layout';
|
|
4
|
+
import { HashWindowsByLayouts, HashWindowsByPopups, ModalProps, NewLayoutProps, NewModalProps, NewPopUpProps, NewWindowProps, WinType } from '../../types';
|
|
5
|
+
import { AreaProps } from '../../types';
|
|
6
|
+
import { AreaStore } from './store';
|
|
7
|
+
import { Maybe, NetworkProps } from '@m4l/core';
|
|
8
|
+
export declare type WinLayout = Layout & {
|
|
9
|
+
winType: WinType;
|
|
10
|
+
};
|
|
5
11
|
export declare type AreaStatus = 'init' | 'load' | 'loaded' | 'error';
|
|
6
12
|
export declare type Breakpoints = {
|
|
7
13
|
[P: string]: number;
|
|
@@ -11,9 +17,16 @@ export declare type Cols = {
|
|
|
11
17
|
};
|
|
12
18
|
export declare type ViewAreaMode = 'multiple' | 'single';
|
|
13
19
|
export interface AreaState {
|
|
14
|
-
zPopUpIndex: number;
|
|
15
20
|
id: string;
|
|
21
|
+
/**
|
|
22
|
+
* "loadAreasFromNetwork" Indica si se deben cargar las ventanas desde la API
|
|
23
|
+
*/
|
|
16
24
|
loadAreasFromNetwork: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* "loadCookiesFromNetwork" Indica si se deben cargar/grabar las cookies en la API
|
|
27
|
+
*/
|
|
28
|
+
loadCookiesFromNetwork: boolean;
|
|
29
|
+
zPopUpIndex: number;
|
|
17
30
|
loadWindows: boolean;
|
|
18
31
|
status: AreaStatus;
|
|
19
32
|
breakpointsLayouts: Layouts;
|
|
@@ -54,16 +67,16 @@ export interface AreaStateWithActions extends AreaState {
|
|
|
54
67
|
changeDesktopBreakpoint: (isDesktop: boolean) => void;
|
|
55
68
|
};
|
|
56
69
|
}
|
|
57
|
-
declare type DefaultStoreProps = Omit<AreaState, 'id'>;
|
|
58
|
-
declare type InitialStoreProps = Pick<AreaState, 'id' | 'networkOperation' | '
|
|
59
|
-
export
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
type: unknown;
|
|
66
|
-
} | undefined): void;
|
|
70
|
+
export declare type DefaultStoreProps = Omit<AreaState, 'id'>;
|
|
71
|
+
export declare type InitialStoreProps = Pick<AreaState, 'id' | 'networkOperation' | 'loadWindows' | 'isDesktop' | 'loadAreasFromNetwork' | 'loadCookiesFromNetwork'> & Partial<DefaultStoreProps>;
|
|
72
|
+
export interface AreaProviderProps extends AreaProps {
|
|
73
|
+
children: ReactNode;
|
|
74
|
+
}
|
|
75
|
+
export declare type AreaProviderRef = {
|
|
76
|
+
store: AreaStore;
|
|
77
|
+
addWindow: (newWindow: NewWindowProps) => string;
|
|
67
78
|
};
|
|
68
|
-
export
|
|
69
|
-
|
|
79
|
+
export interface AreaContextProps {
|
|
80
|
+
store: AreaStore;
|
|
81
|
+
addWindow: (newWindow: NewWindowProps) => string;
|
|
82
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AreaProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @description Funcion encargada de renderizar un área completa.
|
|
4
|
+
* El AreaProvider crea el store del área, por medio del cual se controla todo el estado y almacenamiento del área
|
|
5
|
+
*
|
|
6
|
+
* @param props AreaProps
|
|
7
|
+
* @returns JSX
|
|
8
|
+
*/
|
|
9
|
+
export declare const Area: {
|
|
10
|
+
(props: AreaProps): JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { ModuleAction, WindowToolsMF } from '
|
|
2
|
-
import { Cookies, WindowBaseProps } from '
|
|
1
|
+
import { ModuleAction, WindowToolsMF } from '../../../../../../../../contexts';
|
|
2
|
+
import { Cookies, WindowBaseProps } from '../../../../types';
|
|
3
3
|
import { NetworkProps } from '@m4l/core';
|
|
4
|
-
import { DynamicMFStore } from '
|
|
4
|
+
import { DynamicMFStore } from '../../../../../../../../contexts/DynamicMFParmsContext/store';
|
|
5
|
+
import { AreaStore } from '../../../../contexts/AreaContext/store';
|
|
6
|
+
import { AreasStore } from '../../../../../../../../contexts/AreasContext/store';
|
|
5
7
|
export declare type WindowStatus = 'init' | 'loaded' | 'error';
|
|
6
8
|
export interface WindowState extends WindowBaseProps {
|
|
7
9
|
status: WindowStatus;
|
|
8
10
|
dynamicMFStore: DynamicMFStore;
|
|
11
|
+
areaStore: AreaStore;
|
|
12
|
+
areasStore: AreasStore;
|
|
13
|
+
version?: string;
|
|
9
14
|
moduleActions: ModuleAction[];
|
|
10
15
|
networkOperation: (props: NetworkProps) => Promise<any>;
|
|
11
16
|
cookies: Cookies;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { WindowProps } from '
|
|
2
|
+
import { WindowProps } from '../../types';
|
|
3
3
|
export declare const Window: (props: WindowProps) => JSX.Element;
|
|
4
4
|
export declare const MemonizedWindow: React.MemoExoticComponent<(props: WindowProps) => JSX.Element>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { WindowProps } from '
|
|
2
|
+
import { WindowProps } from '../../../../types';
|
|
3
3
|
export declare const InnerForHooks: (props: WindowProps) => JSX.Element | null;
|
|
4
4
|
export declare const MemonizedInnerForHooks: React.MemoExoticComponent<(props: WindowProps) => JSX.Element | null>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ModuleAction } from '../../../../../../../../../../contexts';
|
|
2
|
+
export declare function getMainActions(isDesktop: boolean | undefined, moduleActions: ModuleAction[]): ModuleAction[];
|
|
3
|
+
export declare function getMenuActions(isDesktop: boolean | undefined, moduleActions: ModuleAction[], urlPrefix: string, saveModuleCookies: () => void, version?: string): ModuleAction[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function MainActions(): JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { MFBaseProps } from '
|
|
2
|
+
import { MFBaseProps } from '../../../../../../types';
|
|
3
3
|
export declare const MicroFrontend: (props: MFBaseProps) => JSX.Element;
|
|
4
4
|
export declare const MemonizedMF: React.MemoExoticComponent<(props: MFBaseProps) => JSX.Element>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WindowToolsMF } from '../../../../../../../../../../contexts/WindowToolsMFContext/types';
|
|
2
|
+
import { MFBaseProps } from '../../../../../../types';
|
|
3
|
+
import { DynamicMFStore } from '../../../../../../../../../../contexts/DynamicMFParmsContext/store';
|
|
4
|
+
export interface MicroFrontendProps extends MFBaseProps {
|
|
5
|
+
moduleId: string;
|
|
6
|
+
dynamicMFStore?: DynamicMFStore;
|
|
7
|
+
windowTools: WindowToolsMF;
|
|
8
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ModalProps } from '
|
|
2
|
+
import { ModalProps } from '../../types';
|
|
3
3
|
export declare const WindowModal: (props: ModalProps) => JSX.Element;
|
|
4
4
|
export declare const MemonizedWindowModal: React.MemoExoticComponent<(props: ModalProps) => JSX.Element>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { PopUpProps } from '
|
|
2
|
+
import { PopUpProps } from '../../types';
|
|
3
3
|
export declare const WindowPopUp: (props: PopUpProps) => JSX.Element;
|
|
4
4
|
export declare const MemonizedWindowPopUp: React.MemoExoticComponent<(props: PopUpProps) => JSX.Element>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { DynamicMFParameters } from '
|
|
2
|
+
import { DynamicMFParameters } from '../../../../contexts/DynamicMFParmsContext/types';
|
|
3
3
|
import type { Layout } from 'react-grid-layout';
|
|
4
|
-
import { WindowStore } from '
|
|
5
|
-
import { AreaStore } from '
|
|
4
|
+
import { WindowStore } from './subcomponents/Window/contexts/WindowContext/store';
|
|
5
|
+
import { AreaStore } from './contexts/AreaContext/store';
|
|
6
6
|
export declare type WinType = 'microfrontend' | 'component';
|
|
7
7
|
export declare type EmergeType = 'layout' | 'popup' | 'modal';
|
|
8
8
|
export interface MFBaseProps {
|
|
@@ -73,7 +73,8 @@ export interface HashWindowsByPopups {
|
|
|
73
73
|
export interface ModalBaseProps extends WindowBaseProps {
|
|
74
74
|
emergeType: 'modal';
|
|
75
75
|
zIndex?: number;
|
|
76
|
-
|
|
76
|
+
width?: number;
|
|
77
|
+
height?: number;
|
|
77
78
|
}
|
|
78
79
|
export interface ModalMFProps extends ModalBaseProps {
|
|
79
80
|
winType: 'microfrontend';
|
|
@@ -96,11 +97,5 @@ export interface AreaType {
|
|
|
96
97
|
linked?: boolean;
|
|
97
98
|
}
|
|
98
99
|
export interface AreaProps extends Omit<AreaType, 'url_icon' | 'name'> {
|
|
99
|
-
|
|
100
|
+
selected: boolean;
|
|
100
101
|
}
|
|
101
|
-
export declare type AreaRef = {
|
|
102
|
-
addWindow?: (newWindow: NewWindowProps) => string;
|
|
103
|
-
current: {
|
|
104
|
-
divRef: HTMLDivElement | null;
|
|
105
|
-
};
|
|
106
|
-
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "./AreasViewer/index.1aa4d12d.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import "@m4l/core";
|
|
4
|
+
import "@mui/material";
|
|
5
|
+
import "../../Icon/index.6938827f.js";
|
|
6
|
+
import "react/jsx-runtime";
|
|
7
|
+
import "../../mui_extended/IconButton/index.78a489d3.js";
|
|
8
|
+
import "clsx";
|
|
9
|
+
import "zustand";
|
|
10
|
+
import "../contexts/AreasContext/index.b3b26965.js";
|
|
11
|
+
import "./AreasAdmin/index.46fab65b.js";
|
|
12
|
+
import "zustand/shallow";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './Area';
|
|
1
|
+
export * from './AreasViewer/subcomponents/Area';
|
|
2
2
|
export * from './AreasAdmin';
|
|
3
|
-
export * from './
|
|
4
|
-
export type { NewWindowProps as NewWindow } from './Area/types';
|
|
5
|
-
export type { MicroFrontendProps } from './Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/types';
|
|
3
|
+
export * from './AreasViewer';
|
|
4
|
+
export type { NewWindowProps as NewWindow } from './AreasViewer/subcomponents/Area/types';
|
|
5
|
+
export type { MicroFrontendProps } from './AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/types';
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { createContext, useRef, useCallback, useEffect } from "react";
|
|
2
|
-
import { useHostTools, useModuleDictionary, useNetwork, EmitEvents } from "@m4l/core";
|
|
3
2
|
import { createStore, useStore } from "zustand";
|
|
3
|
+
import { shallow } from "zustand/shallow";
|
|
4
|
+
import { useResponsiveDesktop, useFirstRender } from "@m4l/graphics";
|
|
5
|
+
import { useHostTools, useModuleDictionary, useNetwork, useModuleSkeleton, EmitEvents } from "@m4l/core";
|
|
4
6
|
import { devtools } from "zustand/middleware";
|
|
5
7
|
import { immer } from "zustand/middleware/immer";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
8
|
+
import { g as getAreasDictionary } from "../../index.bfe6bf91.js";
|
|
9
|
+
import { u as useAreasViewerUtilityClasses } from "../../components/AreasViewer/index.1aa4d12d.js";
|
|
10
|
+
import { u as useAreasAdminUtilityClasses } from "../../components/AreasAdmin/index.46fab65b.js";
|
|
9
11
|
import { jsx } from "react/jsx-runtime";
|
|
10
|
-
const
|
|
12
|
+
const addArea = (state) => {
|
|
11
13
|
let newName = "";
|
|
12
14
|
const newId = `area_${new Date().getTime()}_${(Math.random() * 1e3).toFixed(0)}`;
|
|
13
|
-
newName = `${state.getLabel(
|
|
15
|
+
newName = `${state.getLabel(getAreasDictionary("label_new_area"))} ${state.areas.length + 1}`;
|
|
14
16
|
state.areas.push({ id: newId, name: newName, loadWindows: false });
|
|
15
17
|
state.currentArea = newId;
|
|
16
18
|
if (state.loadAreasFromNetwork) {
|
|
@@ -24,9 +26,14 @@ const addAreaNoBoilerPlate = (state) => {
|
|
|
24
26
|
}
|
|
25
27
|
return newId;
|
|
26
28
|
};
|
|
29
|
+
const updateOwnerStateClasses = (state) => {
|
|
30
|
+
state.viwerClasses = useAreasViewerUtilityClasses(state.ownerState);
|
|
31
|
+
state.adminClasses = useAreasAdminUtilityClasses(state.ownerState);
|
|
32
|
+
};
|
|
27
33
|
const createAreasStore = (initProps) => {
|
|
28
34
|
const startProps = {
|
|
29
|
-
|
|
35
|
+
viwerClasses: useAreasViewerUtilityClasses(initProps.ownerState),
|
|
36
|
+
adminClasses: useAreasAdminUtilityClasses(initProps.ownerState),
|
|
30
37
|
currentArea: "",
|
|
31
38
|
areas: [],
|
|
32
39
|
...initProps
|
|
@@ -36,10 +43,46 @@ const createAreasStore = (initProps) => {
|
|
|
36
43
|
immer((set, get) => ({
|
|
37
44
|
...startProps,
|
|
38
45
|
actions: {
|
|
46
|
+
init: () => {
|
|
47
|
+
if (get().ownerState.status === "init") {
|
|
48
|
+
if (!get().loadAreasFromNetwork) {
|
|
49
|
+
get().actions.addArea();
|
|
50
|
+
set((state) => {
|
|
51
|
+
state.ownerState.status = "loaded";
|
|
52
|
+
updateOwnerStateClasses(state);
|
|
53
|
+
});
|
|
54
|
+
} else {
|
|
55
|
+
set((state) => {
|
|
56
|
+
state.ownerState.status = "loading";
|
|
57
|
+
updateOwnerStateClasses(state);
|
|
58
|
+
state.networkOperation({
|
|
59
|
+
method: "GET",
|
|
60
|
+
endPoint: `areas`,
|
|
61
|
+
parms: {},
|
|
62
|
+
toastSuccess: false
|
|
63
|
+
}).then((response) => {
|
|
64
|
+
set((otherState) => {
|
|
65
|
+
if (response?.data && Array.isArray(response.data) && response.data.length > 0) {
|
|
66
|
+
otherState.areas = response.data;
|
|
67
|
+
otherState.currentArea = response.data[0].id;
|
|
68
|
+
} else {
|
|
69
|
+
addArea(otherState);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}).finally(() => {
|
|
73
|
+
set((state2) => {
|
|
74
|
+
state2.ownerState.status = "loaded";
|
|
75
|
+
updateOwnerStateClasses(state2);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
39
82
|
addArea: () => {
|
|
40
83
|
let newId = "";
|
|
41
84
|
set((state) => {
|
|
42
|
-
newId =
|
|
85
|
+
newId = addArea(state);
|
|
43
86
|
});
|
|
44
87
|
return newId;
|
|
45
88
|
},
|
|
@@ -81,39 +124,6 @@ const createAreasStore = (initProps) => {
|
|
|
81
124
|
state.getLabel = newHandler;
|
|
82
125
|
});
|
|
83
126
|
},
|
|
84
|
-
loadFromApi: () => {
|
|
85
|
-
if (get().status === "init") {
|
|
86
|
-
if (!get().loadAreasFromNetwork) {
|
|
87
|
-
get().actions.addArea();
|
|
88
|
-
set((state) => {
|
|
89
|
-
state.status = "loaded";
|
|
90
|
-
});
|
|
91
|
-
} else {
|
|
92
|
-
set((state) => {
|
|
93
|
-
state.status = "loading";
|
|
94
|
-
state.networkOperation({
|
|
95
|
-
method: "GET",
|
|
96
|
-
endPoint: `areas`,
|
|
97
|
-
parms: {},
|
|
98
|
-
toastSuccess: false
|
|
99
|
-
}).then((response) => {
|
|
100
|
-
set((otherState) => {
|
|
101
|
-
if (response?.data && Array.isArray(response.data) && response.data.length > 0) {
|
|
102
|
-
otherState.areas = response.data;
|
|
103
|
-
otherState.currentArea = response.data[0].id;
|
|
104
|
-
} else {
|
|
105
|
-
addAreaNoBoilerPlate(otherState);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}).finally(() => {
|
|
109
|
-
set((otherState) => {
|
|
110
|
-
otherState.status = "loaded";
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
127
|
setAreaLink: (areaId, store) => {
|
|
118
128
|
set((state) => {
|
|
119
129
|
const areaIndex = state.areas.findIndex((area) => area.id === areaId);
|
|
@@ -122,6 +132,12 @@ const createAreasStore = (initProps) => {
|
|
|
122
132
|
state.areas[areaIndex].linked = true;
|
|
123
133
|
}
|
|
124
134
|
});
|
|
135
|
+
},
|
|
136
|
+
setExternalState: (newExternalState) => {
|
|
137
|
+
set((state) => {
|
|
138
|
+
state.ownerState = { ...state.ownerState, ...newExternalState };
|
|
139
|
+
updateOwnerStateClasses(state);
|
|
140
|
+
});
|
|
125
141
|
}
|
|
126
142
|
}
|
|
127
143
|
})),
|
|
@@ -134,6 +150,7 @@ function AreasProvider(props) {
|
|
|
134
150
|
const {
|
|
135
151
|
children,
|
|
136
152
|
loadAreasFromNetwork,
|
|
153
|
+
loadCookiesFromNetwork,
|
|
137
154
|
onLoad
|
|
138
155
|
} = props;
|
|
139
156
|
const {
|
|
@@ -146,16 +163,25 @@ function AreasProvider(props) {
|
|
|
146
163
|
const {
|
|
147
164
|
networkOperation
|
|
148
165
|
} = useNetwork();
|
|
166
|
+
const isDesktop = useResponsiveDesktop();
|
|
167
|
+
const isSkeleton = useModuleSkeleton();
|
|
149
168
|
const isFirstRender = useFirstRender([getLabel]);
|
|
150
169
|
const areasStoreRef = useRef();
|
|
151
170
|
if (!areasStoreRef.current) {
|
|
152
171
|
areasStoreRef.current = createAreasStore({
|
|
153
172
|
getLabel,
|
|
154
173
|
loadAreasFromNetwork,
|
|
155
|
-
|
|
174
|
+
loadCookiesFromNetwork,
|
|
175
|
+
networkOperation,
|
|
176
|
+
ownerState: {
|
|
177
|
+
status: "init",
|
|
178
|
+
isMobile: !isDesktop,
|
|
179
|
+
isSkeleton
|
|
180
|
+
}
|
|
156
181
|
});
|
|
182
|
+
areasStoreRef.current?.getState().actions.init();
|
|
157
183
|
}
|
|
158
|
-
const status = useStore(areasStoreRef.current, (state) => state.status, shallow);
|
|
184
|
+
const status = useStore(areasStoreRef.current, (state) => state.ownerState.status, shallow);
|
|
159
185
|
const {
|
|
160
186
|
setHandlerGetLabel
|
|
161
187
|
} = useStore(areasStoreRef.current, (state) => state.internalActions, shallow);
|
|
@@ -181,11 +207,19 @@ function AreasProvider(props) {
|
|
|
181
207
|
}, [getLabel]);
|
|
182
208
|
useEffect(() => {
|
|
183
209
|
events_add_listener(EmitEvents.EMMIT_EVENT_HOST_EMERGE_WINDOW, addWindow);
|
|
184
|
-
areasStoreRef.current?.getState().internalActions.loadFromApi();
|
|
185
210
|
return () => {
|
|
186
211
|
events_remove_listener(EmitEvents.EMMIT_EVENT_HOST_EMERGE_WINDOW, addWindow);
|
|
187
212
|
};
|
|
188
213
|
}, []);
|
|
214
|
+
useEffect(() => {
|
|
215
|
+
if (isFirstRender) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
areasStoreRef.current?.getState().internalActions.setExternalState({
|
|
219
|
+
isMobile: !isDesktop,
|
|
220
|
+
isSkeleton
|
|
221
|
+
});
|
|
222
|
+
}, [isDesktop, isSkeleton]);
|
|
189
223
|
return /* @__PURE__ */ jsx(AreasContext.Provider, {
|
|
190
224
|
value: areasStoreRef.current,
|
|
191
225
|
children
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AreasProviderProps } from './types';
|
|
3
|
-
declare const AreasContext: import("react").Context<(Omit<Omit<import("zustand").StoreApi<import("./
|
|
2
|
+
import type { AreasProviderProps } from './types';
|
|
3
|
+
declare const AreasContext: import("react").Context<(Omit<Omit<import("zustand").StoreApi<import("./types").AreasStateWithActions>, "setState"> & {
|
|
4
4
|
setState<A extends string | {
|
|
5
5
|
type: unknown;
|
|
6
|
-
}>(partial: import("./
|
|
6
|
+
}>(partial: import("./types").AreasStateWithActions | Partial<import("./types").AreasStateWithActions> | ((state: import("./types").AreasStateWithActions) => import("./types").AreasStateWithActions | Partial<import("./types").AreasStateWithActions>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
7
7
|
}, "setState"> & {
|
|
8
|
-
setState(nextStateOrUpdater: import("./
|
|
8
|
+
setState(nextStateOrUpdater: import("./types").AreasStateWithActions | Partial<import("./types").AreasStateWithActions> | ((state: import("immer/dist/internal").WritableDraft<import("./types").AreasStateWithActions>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
9
9
|
type: unknown;
|
|
10
10
|
} | undefined): void;
|
|
11
11
|
}) | null>;
|
|
12
|
+
/**
|
|
13
|
+
* @description Provedor del contexto de las areas de trabajo,
|
|
14
|
+
* Expone el store (AreasStore) encargado de gestionar la creación, modificación y borrado de las areas de trabajo.
|
|
15
|
+
* @param props
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
12
18
|
declare function AreasProvider(props: AreasProviderProps): JSX.Element;
|
|
13
19
|
export { AreasProvider, AreasContext };
|
|
@@ -1,31 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
loadAreasFromNetwork: boolean;
|
|
10
|
-
currentArea: string;
|
|
11
|
-
status: AreasStatus;
|
|
12
|
-
areas: AreaType[];
|
|
13
|
-
}
|
|
14
|
-
export interface AreasStateWithActions extends AreasState {
|
|
15
|
-
actions: {
|
|
16
|
-
addArea: () => string;
|
|
17
|
-
deleteArea: (areaId: string) => void;
|
|
18
|
-
selectArea: (newAreaId: string) => void;
|
|
19
|
-
};
|
|
20
|
-
internalActions: {
|
|
21
|
-
setHandlerGetLabel: (newHandler: GetLabelType) => void;
|
|
22
|
-
loadFromApi: () => void;
|
|
23
|
-
setAreaLink: (areaId: string, store: AreaStore) => void;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
declare type DefaultStoreProps = Omit<AreasState, 'currentArea'>;
|
|
27
|
-
declare type InitialStoreProps = Pick<AreasState, 'networkOperation' | 'loadAreasFromNetwork' | 'getLabel'> & Partial<DefaultStoreProps>;
|
|
28
|
-
export declare const createAreasStore: (initProps: InitialStoreProps) => Omit<Omit<import("zustand").StoreApi<AreasStateWithActions>, "setState"> & {
|
|
1
|
+
import type { WritableDraft } from 'immer/dist/internal';
|
|
2
|
+
import type { AreasStateWithActions, InitialAreasStoreProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* @description Crea el Store, por defecto inicia en estado 'init'
|
|
5
|
+
* @param initProps propiedades iniciales del store
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare const createAreasStore: (initProps: InitialAreasStoreProps) => Omit<Omit<import("zustand").StoreApi<AreasStateWithActions>, "setState"> & {
|
|
29
9
|
setState<A extends string | {
|
|
30
10
|
type: unknown;
|
|
31
11
|
}>(partial: AreasStateWithActions | Partial<AreasStateWithActions> | ((state: AreasStateWithActions) => AreasStateWithActions | Partial<AreasStateWithActions>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
@@ -35,4 +15,3 @@ export declare const createAreasStore: (initProps: InitialStoreProps) => Omit<Om
|
|
|
35
15
|
} | undefined): void;
|
|
36
16
|
};
|
|
37
17
|
export declare type AreasStore = ReturnType<typeof createAreasStore>;
|
|
38
|
-
export {};
|