@m4l/layouts 9.1.8 → 9.1.10-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/.storybook/constants.d.ts +21 -0
- package/.storybook/decorators/WithContexts/WithContexts.d.ts +5 -0
- package/.storybook/decorators/WithContexts/constants.d.ts +10 -0
- package/.storybook/decorators/WithContexts/index.d.ts +1 -0
- package/.storybook/decorators/WithContexts/styles.d.ts +1 -0
- package/.storybook/decorators/WithContexts/subcomponents/AppWithTheme.d.ts +6 -0
- package/.storybook/decorators/WithContexts/types.d.ts +7 -0
- package/.storybook/decorators/index.d.ts +1 -0
- package/.storybook/main.d.ts +3 -0
- package/.storybook/storybook.vite.d.ts +2 -0
- package/.storybook/utils/getGlobalsFromSearchParams.d.ts +7 -0
- package/.storybook/utils/getStylesColorsByMode.d.ts +744 -0
- package/components/MFHostApp/MFHostApp.d.ts +6 -0
- package/components/MFHostApp/MFHostApp.js +59 -0
- package/components/MFHostApp/index.d.ts +2 -10
- package/components/MFHostApp/index.js +1 -60
- package/components/MFHostApp/types.d.ts +4 -1
- package/components/MFNoAuthApp/index.d.ts +0 -4
- package/components/MFNoAuthApp/index.js +3 -4
- package/components/MFNoAuthApp/types.d.ts +4 -1
- package/components/MFWindowsTitle/MFWindowsTitle.d.ts +0 -4
- package/components/ModuleDetailTabs/ModuleDetailTabs.d.ts +5 -0
- package/components/ModuleDetailTabs/ModuleDetailTabs.js +42 -0
- package/components/ModuleDetailTabs/index.d.ts +2 -0
- package/components/ModuleDetailTabs/index.js +1 -0
- package/components/ModuleDetailTabs/types.d.ts +88 -0
- package/components/ModuleDetailTabs/useModuleDatailTabs.d.ts +308 -0
- package/components/ModuleDetailTabs/useModuleDatailTabs.js +86 -0
- package/components/index.d.ts +3 -2
- package/contexts/AuthContext/index.d.ts +0 -4
- package/hooks/index.d.ts +1 -0
- package/hooks/useAuth/index.d.ts +0 -4
- package/hooks/useDynamicAccordions/index.d.ts +2 -0
- package/hooks/useDynamicAccordions/index.js +1 -0
- package/hooks/useDynamicAccordions/types.d.ts +42 -0
- package/hooks/useDynamicAccordions/useBaseAccordions.d.ts +5 -0
- package/hooks/useDynamicAccordions/useBaseAccordions.js +38 -0
- package/hooks/useDynamicAccordions/useDynamicAccordions.d.ts +6 -0
- package/hooks/useDynamicAccordions/useDynamicAccordions.js +18 -0
- package/hooks/useMasterDetail/index.d.ts +1 -1
- package/hooks/useModule/index.d.ts +0 -4
- package/index.d.ts +1 -0
- package/index.js +14 -9
- package/layouts/MasterDetailLayout/MasterDetailLayout.d.ts +0 -4
- package/layouts/MasterDetailLayout/MasterDetailLayout.js +6 -6
- package/layouts/MasterDetailLayout/classes/index.d.ts +0 -4
- package/layouts/MasterDetailLayout/components/ButtonDetail/index.d.ts +0 -4
- package/layouts/MasterDetailLayout/contexts/MasterDetailContext/index.d.ts +0 -4
- package/layouts/MasterDetailLayout/dicctionary.js +2 -11
- package/layouts/MasterDetailLayout/index.d.ts +2 -0
- package/layouts/MasterDetailLayout/index.js +1 -0
- package/layouts/ModuleLayout/ModuleLayout.js +6 -3
- package/layouts/ModuleLayout/constants.d.ts +1 -0
- package/layouts/ModuleLayout/constants.js +4 -0
- package/layouts/ModuleLayout/contexts/ModuleContext/index.d.ts +0 -4
- package/layouts/ModuleLayout/contexts/ModuleContext/index.js +0 -5
- package/layouts/ModuleLayout/slots/ModuleLayoutEnum.d.ts +3 -0
- package/layouts/ModuleLayout/slots/ModuleLayoutEnum.js +7 -0
- package/layouts/ModuleLayout/slots/ModuleLayoutSlots.d.ts +1 -0
- package/layouts/ModuleLayout/slots/ModuleLayoutSlots.js +11 -0
- package/layouts/ModuleLayout/styles.d.ts +2 -0
- package/layouts/ModuleLayout/styles.js +16 -0
- package/layouts/ModuleLayout/subcomponents/BaseModuleLayout/index.d.ts +2 -0
- package/layouts/ModuleLayout/subcomponents/BaseModuleLayout/index.js +20 -0
- package/layouts/ModuleLayout/subcomponents/{InnerModule → BaseModuleLayout}/types.d.ts +1 -0
- package/layouts/ModuleLayout/types.d.ts +8 -1
- package/layouts/NoAuthModuleLayout/constants.d.ts +1 -0
- package/layouts/NoAuthModuleLayout/constants.js +4 -0
- package/layouts/NoAuthModuleLayout/index.d.ts +4 -5
- package/layouts/NoAuthModuleLayout/index.js +4 -5
- package/layouts/NoAuthModuleLayout/slots/NoAuthModuleLayoutEnum.d.ts +25 -0
- package/layouts/NoAuthModuleLayout/slots/NoAuthModuleLayoutEnum.js +33 -0
- package/layouts/NoAuthModuleLayout/slots/NoAuthModuleLayoutSlots.d.ts +19 -0
- package/layouts/NoAuthModuleLayout/slots/NoAuthModuleLayoutSlots.js +100 -0
- package/layouts/NoAuthModuleLayout/styles.d.ts +2 -0
- package/layouts/NoAuthModuleLayout/styles.js +314 -0
- package/layouts/NoAuthModuleLayout/subcomponents/BaseNoAuthModuleLayout/index.d.ts +4 -0
- package/layouts/NoAuthModuleLayout/subcomponents/BaseNoAuthModuleLayout/index.js +16 -0
- package/layouts/NoAuthModuleLayout/subcomponents/BaseNoAuthModuleLayout/subcomponents/DesktopContent/index.d.ts +4 -0
- package/layouts/NoAuthModuleLayout/subcomponents/BaseNoAuthModuleLayout/subcomponents/DesktopContent/index.js +47 -0
- package/layouts/NoAuthModuleLayout/subcomponents/BaseNoAuthModuleLayout/subcomponents/MobileContent/index.d.ts +4 -0
- package/layouts/NoAuthModuleLayout/subcomponents/BaseNoAuthModuleLayout/subcomponents/MobileContent/index.js +43 -0
- package/layouts/NoAuthModuleLayout/tests/NoAuthModuleLayout.test.d.ts +1 -0
- package/layouts/NoAuthModuleLayout/types.d.ts +45 -0
- package/layouts/index.d.ts +1 -2
- package/package.json +4 -3
- package/storybook/layouts/ModuleLayout/ModuleLayout.stories.d.ts +6 -0
- package/storybook/layouts/ModuleLayout/moks/mokData.d.ts +14 -0
- package/storybook/layouts/ModuleLayout/subcomponents/ClientsHeaderActions.d.ts +4 -0
- package/storybook/layouts/ModuleLayout/subcomponents/RenderModuleLayout.d.ts +6 -0
- package/storybook/layouts/ModuleLayout/subcomponents/UsersHeaderActions.d.ts +4 -0
- package/storybook/layouts/ModuleLayout/subcomponents/WithExtendedContainer.d.ts +5 -0
- package/storybook/layouts/NoAuthModuleLayout/NoAuthModuleLayout.stories.d.ts +9 -0
- package/test/HostThemeProviderMock.d.ts +10 -0
- package/test/TestAppWrapper.d.ts +29 -0
- package/test/TestFormAutoValidation.d.ts +4 -0
- package/test/constants.d.ts +69 -0
- package/test/constants_no_mock.d.ts +1 -0
- package/test/getNameDataTestId.d.ts +15 -0
- package/test/index.d.ts +4 -0
- package/test/mocks.d.ts +24 -0
- package/test/types.d.ts +4 -0
- package/test/utils.d.ts +23 -10
- package/utils/createAppMF.d.ts +13 -0
- package/utils/createAppMF.js +58 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/vite-env.d.ts +19 -0
- package/layouts/ModuleLayout/classes/constants.d.ts +0 -1
- package/layouts/ModuleLayout/classes/constants.js +0 -4
- package/layouts/ModuleLayout/classes/index.d.ts +0 -14
- package/layouts/ModuleLayout/classes/index.js +0 -25
- package/layouts/ModuleLayout/classes/types.d.ts +0 -7
- package/layouts/ModuleLayout/subcomponents/InnerModule/index.d.ts +0 -2
- package/layouts/ModuleLayout/subcomponents/InnerModule/index.js +0 -20
- package/layouts/ModuleLayout/subcomponents/InnerModule/styles.d.ts +0 -1
- package/layouts/ModuleLayout/subcomponents/InnerModule/styles.js +0 -7
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/index.d.ts +0 -8
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/index.js +0 -16
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/styles.d.ts +0 -1
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/styles.js +0 -15
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/DesktopContent/index.d.ts +0 -8
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/DesktopContent/index.js +0 -47
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/DesktopContent/styles.d.ts +0 -9
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/DesktopContent/styles.js +0 -115
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/MobileContent/index.d.ts +0 -8
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/MobileContent/index.js +0 -43
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/MobileContent/styles.d.ts +0 -8
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/MobileContent/styles.js +0 -96
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { unstable_HistoryRouter } from "react-router-dom";
|
|
3
|
+
import { EnvironmentProvider, HostToolsProvider, NetworkProvider, DomainCountryProvider } from "@m4l/core";
|
|
4
|
+
import { DeviceTypeProvider, LocalesProvider, HostThemeProvider, FormatterProvider } from "@m4l/graphics";
|
|
5
|
+
import { BaseModule, WindowToolsMFProvider, DynamicMFParmsProvider, AppearanceComponentProvider } from "@m4l/components";
|
|
6
|
+
import { M as MFWindowsTitle } from "../MFWindowsTitle/MFWindowsTitle.js";
|
|
7
|
+
function MFHostApp(props) {
|
|
8
|
+
const {
|
|
9
|
+
children,
|
|
10
|
+
currentLocale,
|
|
11
|
+
hostTheme,
|
|
12
|
+
environment,
|
|
13
|
+
hostTools,
|
|
14
|
+
axiosOperation,
|
|
15
|
+
formatters,
|
|
16
|
+
isAuth = true,
|
|
17
|
+
moduleId,
|
|
18
|
+
moduleNameField,
|
|
19
|
+
skeletonFlags,
|
|
20
|
+
privileges,
|
|
21
|
+
componentsDictionary,
|
|
22
|
+
dynamicMFStore,
|
|
23
|
+
windowTools,
|
|
24
|
+
isAddEditModule = false
|
|
25
|
+
} = props;
|
|
26
|
+
return /* @__PURE__ */ jsx(EnvironmentProvider, { ...environment, children: /* @__PURE__ */ jsx(HostToolsProvider, { ...hostTools, children: /* @__PURE__ */ jsx(NetworkProvider, { axiosOperation, children: /* @__PURE__ */ jsx(DeviceTypeProvider, { children: /* @__PURE__ */ jsx(LocalesProvider, { isMicroFrontEnd: true, localeHost: currentLocale, children: /* @__PURE__ */ jsx(
|
|
27
|
+
HostThemeProvider,
|
|
28
|
+
{
|
|
29
|
+
isMicroFrontEnd: true,
|
|
30
|
+
...hostTheme,
|
|
31
|
+
children: /* @__PURE__ */ jsx(unstable_HistoryRouter, { history: hostTools.history, children: /* @__PURE__ */ jsx(
|
|
32
|
+
DomainCountryProvider,
|
|
33
|
+
{
|
|
34
|
+
isMicroFrontEnd: true,
|
|
35
|
+
id: dynamicMFStore?.getState().dynamicMFParameters?.id || 1,
|
|
36
|
+
currency: formatters.currencyFormatter.code,
|
|
37
|
+
currency_decimal_digits: formatters.currencyFormatter.decimalDigits,
|
|
38
|
+
decimal_symbol: formatters.numberFormatter.decimalSymbol,
|
|
39
|
+
thousands_symbol: formatters.numberFormatter.thousandsSymbol,
|
|
40
|
+
children: /* @__PURE__ */ jsx(
|
|
41
|
+
BaseModule,
|
|
42
|
+
{
|
|
43
|
+
isAuth,
|
|
44
|
+
moduleId,
|
|
45
|
+
moduleNameField,
|
|
46
|
+
componentsDictionary,
|
|
47
|
+
skeletonFlags,
|
|
48
|
+
privileges,
|
|
49
|
+
children: /* @__PURE__ */ jsx(FormatterProvider, { isMicroFrontEnd: true, ...formatters, children: /* @__PURE__ */ jsx(WindowToolsMFProvider, { ...windowTools, children: /* @__PURE__ */ jsx(DynamicMFParmsProvider, { store: dynamicMFStore, children: /* @__PURE__ */ jsx(MFWindowsTitle, { isAddEditModule, children: /* @__PURE__ */ jsx(AppearanceComponentProvider, { children }) }) }) }) })
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
) })
|
|
54
|
+
}
|
|
55
|
+
) }) }) }) }) });
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
MFHostApp as M
|
|
59
|
+
};
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Componente que envuelve la aplicación de un microfrontend
|
|
4
|
-
* @author Juan Escobar - automatic
|
|
5
|
-
* @createdAt 2024-10-09 19:56:26 - automatic
|
|
6
|
-
* @updatedAt 2024-10-09 20:00:30 - automatic
|
|
7
|
-
* @updatedUser Juan Escobar - automatic
|
|
8
|
-
*/
|
|
9
|
-
export declare function MFHostApp(props: MFHostAppProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export default MFHostApp;
|
|
1
|
+
export { MFHostApp } from './MFHostApp';
|
|
2
|
+
export type { ByHostProps } from './types';
|
|
@@ -1,60 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { unstable_HistoryRouter } from "react-router-dom";
|
|
3
|
-
import { EnvironmentProvider, HostToolsProvider, NetworkProvider, DomainCountryProvider } from "@m4l/core";
|
|
4
|
-
import { DeviceTypeProvider, LocalesProvider, HostThemeProvider, ResponsiveContainerProvider, FormatterProvider } from "@m4l/graphics";
|
|
5
|
-
import { BaseModule, WindowToolsMFProvider, DynamicMFParmsProvider, AppearanceComponentProvider } from "@m4l/components";
|
|
6
|
-
import { M as MFWindowsTitle } from "../MFWindowsTitle/MFWindowsTitle.js";
|
|
7
|
-
function MFHostApp(props) {
|
|
8
|
-
const {
|
|
9
|
-
children,
|
|
10
|
-
currentLocale,
|
|
11
|
-
hostTheme,
|
|
12
|
-
environment,
|
|
13
|
-
hostTools,
|
|
14
|
-
axiosOperation,
|
|
15
|
-
formatters,
|
|
16
|
-
isAuth = true,
|
|
17
|
-
moduleId,
|
|
18
|
-
moduleNameField,
|
|
19
|
-
skeletonFlags,
|
|
20
|
-
privileges,
|
|
21
|
-
componentsDictionary,
|
|
22
|
-
dynamicMFStore,
|
|
23
|
-
windowTools,
|
|
24
|
-
observedDivRef,
|
|
25
|
-
isAddEditModule = false
|
|
26
|
-
} = props;
|
|
27
|
-
return /* @__PURE__ */ jsx(EnvironmentProvider, { ...environment, children: /* @__PURE__ */ jsx(HostToolsProvider, { ...hostTools, children: /* @__PURE__ */ jsx(NetworkProvider, { axiosOperation, children: /* @__PURE__ */ jsx(DeviceTypeProvider, { children: /* @__PURE__ */ jsx(LocalesProvider, { isMicroFrontEnd: true, localeHost: currentLocale, children: /* @__PURE__ */ jsx(
|
|
28
|
-
HostThemeProvider,
|
|
29
|
-
{
|
|
30
|
-
isMicroFrontEnd: true,
|
|
31
|
-
...hostTheme,
|
|
32
|
-
children: /* @__PURE__ */ jsx(ResponsiveContainerProvider, { observedDivRef, children: /* @__PURE__ */ jsx(unstable_HistoryRouter, { history: hostTools.history, children: /* @__PURE__ */ jsx(
|
|
33
|
-
DomainCountryProvider,
|
|
34
|
-
{
|
|
35
|
-
isMicroFrontEnd: true,
|
|
36
|
-
id: dynamicMFStore?.getState().dynamicMFParameters?.id || 1,
|
|
37
|
-
currency: formatters.currencyFormatter.code,
|
|
38
|
-
currency_decimal_digits: formatters.currencyFormatter.decimalDigits,
|
|
39
|
-
decimal_symbol: formatters.numberFormatter.decimalSymbol,
|
|
40
|
-
thousands_symbol: formatters.numberFormatter.thousandsSymbol,
|
|
41
|
-
children: /* @__PURE__ */ jsx(
|
|
42
|
-
BaseModule,
|
|
43
|
-
{
|
|
44
|
-
isAuth,
|
|
45
|
-
moduleId,
|
|
46
|
-
moduleNameField,
|
|
47
|
-
componentsDictionary,
|
|
48
|
-
skeletonFlags,
|
|
49
|
-
privileges,
|
|
50
|
-
children: /* @__PURE__ */ jsx(FormatterProvider, { isMicroFrontEnd: true, ...formatters, children: /* @__PURE__ */ jsx(WindowToolsMFProvider, { ...windowTools, children: /* @__PURE__ */ jsx(DynamicMFParmsProvider, { store: dynamicMFStore, children: /* @__PURE__ */ jsx(MFWindowsTitle, { isAddEditModule, children: /* @__PURE__ */ jsx(AppearanceComponentProvider, { children }) }) }) }) })
|
|
51
|
-
}
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
) }) })
|
|
55
|
-
}
|
|
56
|
-
) }) }) }) }) });
|
|
57
|
-
}
|
|
58
|
-
export {
|
|
59
|
-
MFHostApp as M
|
|
60
|
-
};
|
|
1
|
+
|
|
@@ -10,7 +10,10 @@ export interface ByHostProps {
|
|
|
10
10
|
formatters: Formatters;
|
|
11
11
|
dynamicMFStore: DynamicMFStore;
|
|
12
12
|
windowTools: WindowToolsMF;
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated no usar, no tiene efecto. esto se usaba para detectar la resposividad de los breakpoints
|
|
15
|
+
*/
|
|
16
|
+
observedDivRef?: Element | Text | null;
|
|
14
17
|
/**
|
|
15
18
|
* isAddEditModule saber si el módulo es tipo add/edit, para poder asignar el title automáticamente
|
|
16
19
|
* cuando se cambia el idioma, desde MFHostApp/MFWindowsTitle
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { MFNoAuthAppProps } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Componente que envuelve la aplicación de un microfrontend sin autenticación
|
|
4
|
-
* @author Juan Escobar - automatic
|
|
5
|
-
* @createdAt 2024-10-09 19:56:26 - automatic
|
|
6
|
-
* @updatedAt 2024-10-17 15:37:19 - automatic
|
|
7
|
-
* @updatedUser Juan Escobar - automatic
|
|
8
4
|
*/
|
|
9
5
|
export declare function MFNoAuthApp(props: MFNoAuthAppProps): import("react/jsx-runtime").JSX.Element;
|
|
10
6
|
export default MFNoAuthApp;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { DomainCountryProvider } from "@m4l/core";
|
|
3
|
-
import { DeviceTypeProvider, FormatterProvider
|
|
3
|
+
import { DeviceTypeProvider, FormatterProvider } from "@m4l/graphics";
|
|
4
4
|
import { BaseModule } from "@m4l/components";
|
|
5
5
|
function MFNoAuthApp(props) {
|
|
6
6
|
const {
|
|
@@ -11,8 +11,7 @@ function MFNoAuthApp(props) {
|
|
|
11
11
|
skeletonFlags,
|
|
12
12
|
privileges,
|
|
13
13
|
componentsDictionary,
|
|
14
|
-
isAuth
|
|
15
|
-
observedDivRef
|
|
14
|
+
isAuth
|
|
16
15
|
} = props;
|
|
17
16
|
const domianCountry = {
|
|
18
17
|
id: 1,
|
|
@@ -30,7 +29,7 @@ function MFNoAuthApp(props) {
|
|
|
30
29
|
componentsDictionary,
|
|
31
30
|
skeletonFlags,
|
|
32
31
|
privileges,
|
|
33
|
-
children: /* @__PURE__ */ jsx(FormatterProvider, { isMicroFrontEnd: true, ...formatters, children
|
|
32
|
+
children: /* @__PURE__ */ jsx(FormatterProvider, { isMicroFrontEnd: true, ...formatters, children })
|
|
34
33
|
}
|
|
35
34
|
) }) });
|
|
36
35
|
}
|
|
@@ -5,5 +5,8 @@ export interface ByHostProps {
|
|
|
5
5
|
windowTools: WindowToolsMF;
|
|
6
6
|
}
|
|
7
7
|
export interface MFNoAuthAppProps extends ByHostProps, BaseModuleProps {
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated no usar, no tiene efecto. esto se usaba para detectar la resposividad de los breakpoints
|
|
10
|
+
*/
|
|
11
|
+
observedDivRef?: Element | Text | null;
|
|
9
12
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { MFWindowsTitleProps } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Titulo de la ventana del microfrontend
|
|
4
|
-
* @author Juan Escobar - automatic
|
|
5
|
-
* @createdAt 2024-10-09 19:56:26 - automatic
|
|
6
|
-
* @updatedAt 2024-10-09 20:00:30 - automatic
|
|
7
|
-
* @updatedUser Juan Escobar - automatic
|
|
8
4
|
*/
|
|
9
5
|
export declare function MFWindowsTitle({ isAddEditModule, children }: MFWindowsTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ModuleDetailTabsProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Componente para mostrar un listado de tabs y contenido en un MasterDetail, basado en las props
|
|
4
|
+
*/
|
|
5
|
+
export declare function ModuleDetailTabs(props: ModuleDetailTabsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { NoItemSelected, ModalProvider, Stack, Tabs, Tab, TabContent } from "@m4l/components";
|
|
3
|
+
import { u as useModuleDetailTabs } from "./useModuleDatailTabs.js";
|
|
4
|
+
function ModuleDetailTabs(props) {
|
|
5
|
+
const { conditionNoMasterSelection, currentTab, detailData, finalTabs, handleChangeTab, hasPrivilegeDetail, endPointData } = useModuleDetailTabs(props);
|
|
6
|
+
if (conditionNoMasterSelection) {
|
|
7
|
+
return /* @__PURE__ */ jsx(NoItemSelected, {});
|
|
8
|
+
}
|
|
9
|
+
if (!hasPrivilegeDetail) {
|
|
10
|
+
return /* @__PURE__ */ jsx("div", { children: "No tiene privilegio para ver el detalle" });
|
|
11
|
+
}
|
|
12
|
+
return /* @__PURE__ */ jsx(ModalProvider, { children: /* @__PURE__ */ jsxs(Stack, { direction: "column", children: [
|
|
13
|
+
/* @__PURE__ */ jsx(
|
|
14
|
+
Tabs,
|
|
15
|
+
{
|
|
16
|
+
value: currentTab,
|
|
17
|
+
scrollButtons: "auto",
|
|
18
|
+
variant: "scrollable",
|
|
19
|
+
allowScrollButtonsMobile: true,
|
|
20
|
+
onChange: (_e, value) => handleChangeTab(value),
|
|
21
|
+
children: finalTabs.map((tab) => {
|
|
22
|
+
const { value, label } = tab;
|
|
23
|
+
return /* @__PURE__ */ jsx(Tab, { value, label }, value);
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
finalTabs.map((tab) => {
|
|
28
|
+
const isMatched = tab.value === currentTab;
|
|
29
|
+
return (isMatched || !tab.unmountable) && /* @__PURE__ */ jsx(
|
|
30
|
+
TabContent,
|
|
31
|
+
{
|
|
32
|
+
style: { display: isMatched ? "flex" : "none" },
|
|
33
|
+
children: /* @__PURE__ */ jsx(tab.tabContent, { data: detailData, endPointData, hasPrivilegeDetail, ...tab.componentProps })
|
|
34
|
+
},
|
|
35
|
+
tab.value
|
|
36
|
+
);
|
|
37
|
+
})
|
|
38
|
+
] }) });
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
ModuleDetailTabs as M
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TabProps } from '@m4l/components';
|
|
3
|
+
import { NetworkProps } from '@m4l/core';
|
|
4
|
+
/**
|
|
5
|
+
* Props obligatorias que deben tener todos los componentes de tab
|
|
6
|
+
* Estas props serán inyectadas automáticamente por ModuleDetailTabs
|
|
7
|
+
*/
|
|
8
|
+
export interface ModuleDetailTabContent<T extends Record<string, any> = Record<string, any>, K extends Record<string, any> = Record<string, any>> {
|
|
9
|
+
/**
|
|
10
|
+
* data - Contiene los datos del registro seleccionado en el master
|
|
11
|
+
* Esta prop es OBLIGATORIA para todos los componentes de tab
|
|
12
|
+
*/
|
|
13
|
+
data: T;
|
|
14
|
+
/**
|
|
15
|
+
* endPointData - Contiene los datos del endpoint de detalle, en caso de haberse configurado.
|
|
16
|
+
*/
|
|
17
|
+
endPointData?: K;
|
|
18
|
+
/**
|
|
19
|
+
* hasPrivilegeDetail - Indica si el usuario tiene privilegio para ver el detalle.
|
|
20
|
+
*/
|
|
21
|
+
hasPrivilegeDetail?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface ModuleDetailBaseTab extends Omit<TabProps, 'label'> {
|
|
24
|
+
/**
|
|
25
|
+
* "dictionaryId" Id del diccionario para el label.
|
|
26
|
+
*/
|
|
27
|
+
dictionaryId?: string;
|
|
28
|
+
/**
|
|
29
|
+
* "unmountable" Indica si el tab se desmonta cuando el tab no está seleccionado, default: true
|
|
30
|
+
*/
|
|
31
|
+
unmountable?: boolean;
|
|
32
|
+
}
|
|
33
|
+
type ComponentWithData<T extends Record<string, any> = Record<string, any>, K extends Record<string, any> = Record<string, any>, C extends React.ElementType = React.ElementType> = React.FunctionComponent<ModuleDetailTabContent<T, K> & React.ComponentProps<C>>;
|
|
34
|
+
export interface ModuleDatailTab<T extends Record<string, any> = Record<string, any>, K extends Record<string, any> = Record<string, any>, C extends React.ElementType = React.ElementType> extends ModuleDetailBaseTab {
|
|
35
|
+
/**
|
|
36
|
+
* "value" Valor o key del tab
|
|
37
|
+
*/
|
|
38
|
+
value: string;
|
|
39
|
+
/**
|
|
40
|
+
* "tabContent" Contenido del tab, debe ser un componente que acepte como mínimo
|
|
41
|
+
* la prop "data" (DetailComponentProps) que será inyectada automáticamente
|
|
42
|
+
*/
|
|
43
|
+
tabContent: ComponentWithData<T, K>; /**Elemento no instanciado de react, solamente la funcion */
|
|
44
|
+
/**
|
|
45
|
+
* "componentProps" Propiedades adicionales del componente del tab.
|
|
46
|
+
* IMPORTANTE: No se puede sobrescribir la prop "data" aquí, ya que será inyectada
|
|
47
|
+
* automáticamente por ModuleDetailTabs
|
|
48
|
+
*/
|
|
49
|
+
componentProps?: Omit<React.ComponentProps<C>, keyof ModuleDetailTabContent<T, K>>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Interfaz para las props del tab de logs
|
|
53
|
+
*/
|
|
54
|
+
export interface ModuleDetailObjectLogs extends ModuleDetailBaseTab {
|
|
55
|
+
/**
|
|
56
|
+
* "resourceId" Id del recurso para el logs.
|
|
57
|
+
*/
|
|
58
|
+
resourceId: string | number;
|
|
59
|
+
/**
|
|
60
|
+
* "getObjectId" Función para obtener el id del objeto.
|
|
61
|
+
*/
|
|
62
|
+
getObjectId: (detailData: Record<string, any>) => number;
|
|
63
|
+
}
|
|
64
|
+
export interface ModuleDetailTabsProps<T extends Record<string, any> = Record<string, any>, K extends Record<string, any> = Record<string, any>> {
|
|
65
|
+
/**
|
|
66
|
+
* "defaultTab" Valor o key del tab por defecto, default: el primer tab
|
|
67
|
+
*/
|
|
68
|
+
defaultTab: string;
|
|
69
|
+
/**
|
|
70
|
+
* "urlAssetsPrefix" Prefijo de la url para la ruta de los iconos, en algunos casos es:
|
|
71
|
+
* - host_api_remote
|
|
72
|
+
* - host_static_asset/environment_assets
|
|
73
|
+
*/
|
|
74
|
+
urlAssetsPrefix: string;
|
|
75
|
+
/**
|
|
76
|
+
* "tabs" Lista de tabs con los siguientes campos:
|
|
77
|
+
*/
|
|
78
|
+
tabs: ModuleDatailTab<T, K>[];
|
|
79
|
+
/**
|
|
80
|
+
* ObjectLogs props
|
|
81
|
+
*/
|
|
82
|
+
objectLogsProps?: ModuleDetailObjectLogs;
|
|
83
|
+
/**
|
|
84
|
+
* "endPoint" Endpoint para obtener los datos del detalle., en caso de que se requiera.
|
|
85
|
+
*/
|
|
86
|
+
getEndPoint?: (masterSelection: T) => NetworkProps;
|
|
87
|
+
}
|
|
88
|
+
export {};
|