@m4l/components 9.1.95 → 9.1.97
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 +8 -0
- package/components/DynamicFilter/subcomponents/AppliedFilters/AppliedFilters.js +1 -1
- package/components/ObjectLogs/components/DetailDialog/index.js +1 -1
- package/components/ScrollBar/{index.d.ts → ScrollBar.d.ts} +1 -4
- package/components/ScrollBar/ScrollBar.js +46 -0
- package/components/ScrollBar/ScrollBar.styles.d.ts +2 -0
- package/components/ScrollBar/ScrollBar.styles.js +65 -0
- package/components/ScrollBar/constants.d.ts +2 -0
- package/components/ScrollBar/constants.js +7 -0
- package/components/ScrollBar/slots/ScrollBarEnum.d.ts +4 -0
- package/components/ScrollBar/slots/ScrollBarEnum.js +8 -0
- package/components/ScrollBar/slots/ScrollBarSlots.d.ts +6 -0
- package/components/ScrollBar/slots/ScrollBarSlots.js +17 -0
- package/components/ScrollBar/slots/index.d.ts +2 -0
- package/components/ScrollBar/types.d.ts +43 -1
- package/components/areas/components/AreasAdmin/AreasAdmin.js +1 -1
- package/components/hook-form/RHFPeriod/RHFPeriod.d.ts +2 -2
- package/components/hook-form/RHFPeriod/RHFPeriod.js +5 -5
- package/components/hook-form/RHFPeriod/index.d.ts +2 -0
- package/components/hook-form/RHFPeriod/index.js +1 -0
- package/components/hook-form/RHFPeriod/subcomponents/Period/Period.d.ts +3 -3
- package/components/hook-form/RHFPeriod/subcomponents/Period/Period.js +84 -35
- package/components/hook-form/RHFPeriod/subcomponents/Period/dictionary.js +6 -1
- package/components/hook-form/RHFPeriod/subcomponents/Period/types.d.ts +7 -4
- package/components/hook-form/RHFPeriod/types.d.ts +6 -2
- package/components/hook-form/RHFPeriod/types.js +1 -0
- package/components/hook-form/index.d.ts +1 -2
- package/components/index.d.ts +1 -2
- package/index.js +102 -93
- package/package.json +1 -1
- package/components/Period/Period.d.ts +0 -5
- package/components/Period/Period.js +0 -193
- package/components/Period/classes/constants.d.ts +0 -1
- package/components/Period/classes/constants.js +0 -4
- package/components/Period/classes/index.d.ts +0 -15
- package/components/Period/classes/index.js +0 -53
- package/components/Period/classes/types.d.ts +0 -18
- package/components/Period/dictionary.d.ts +0 -7
- package/components/Period/dictionary.js +0 -13
- package/components/Period/index.d.ts +0 -2
- package/components/Period/styles.d.ts +0 -6
- package/components/Period/styles.js +0 -45
- package/components/Period/subcomponents/SkeletonPeriod/index.d.ts +0 -5
- package/components/Period/subcomponents/SkeletonPeriod/index.js +0 -12
- package/components/Period/subcomponents/SkeletonPeriod/types.d.ts +0 -4
- package/components/Period/tests/constants.d.ts +0 -1
- package/components/Period/tests/constants.js +0 -4
- package/components/Period/tests/index.test.d.ts +0 -1
- package/components/Period/tests/utils.d.ts +0 -2
- package/components/Period/tests/utils.js +0 -7
- package/components/Period/types.d.ts +0 -35
- package/components/Period/types.js +0 -9
- package/components/ScrollBar/classes/constants.d.ts +0 -1
- package/components/ScrollBar/classes/constants.js +0 -4
- package/components/ScrollBar/classes/index.d.ts +0 -9
- package/components/ScrollBar/classes/index.js +0 -23
- package/components/ScrollBar/classes/types.d.ts +0 -6
- package/components/ScrollBar/index.js +0 -17
- package/components/ScrollBar/styles.d.ts +0 -3
- package/components/ScrollBar/styles.js +0 -46
- /package/components/{Period → ScrollBar/slots}/index.js +0 -0
package/@types/types.d.ts
CHANGED
|
@@ -144,6 +144,7 @@ import { MenuDividerOwnerState, MenuDividerSlotsType } from '../components/mui_e
|
|
|
144
144
|
import { NavLinkOwnerState, NavLinkSlotsType } from '../components/mui_extended/NavLink/types';
|
|
145
145
|
|
|
146
146
|
import { RHFSelectSlotsType, RHFSelectOwnerState } from '../components/hook-form/RHFSelect/types';
|
|
147
|
+
import { ScrollBarSlotsType, ScrollBarOwnerState } from '../components/ScrollBar/types';
|
|
147
148
|
import { StackOwnerState, StackSlotsType } from '../components/mui_extended/Stack/types';
|
|
148
149
|
import { RHFCheckBoxOwnerState, RHFCheckBoxSlotsType } from '../components/hook-form/RHFCheckbox/types';
|
|
149
150
|
import { AreasAdminOwnerState, AreasAdminType } from '../components/areas/components/AreasAdmin/types';
|
|
@@ -210,6 +211,7 @@ declare module '@mui/material/styles' {
|
|
|
210
211
|
M4LMenuDivider: MenuDividerSlotsType;
|
|
211
212
|
M4LNavLink: NavLinkSlotsType;
|
|
212
213
|
M4LRHFSelect: RHFSelectSlotsType;
|
|
214
|
+
M4LScrollBar: ScrollBarSlotsType;
|
|
213
215
|
M4LAreasAdmin: AreasAdminType;
|
|
214
216
|
M4LStack: StackSlotsType;
|
|
215
217
|
M4LDateTimePicker: DateTimePickerSlotsType;
|
|
@@ -274,6 +276,7 @@ declare module '@mui/material/styles' {
|
|
|
274
276
|
M4LMenuDivider: Partial<MenuDividerOwnerState>;
|
|
275
277
|
M4LNavLink: Partial<NavLinkOwnerState>;
|
|
276
278
|
M4LRHFSelect: Partial<RHFSelectOwnerState>;
|
|
279
|
+
M4LScrollBar: Partial<ScrollBarOwnerState>;
|
|
277
280
|
M4LAreasAdmin: Partial<AreasAdminOwnerState>;
|
|
278
281
|
M4LStack: Partial<StackOwnerState>;
|
|
279
282
|
M4LDateTimePicker: Partial<DateTimePickerOwnerState>;
|
|
@@ -562,6 +565,10 @@ declare module '@mui/material/styles' {
|
|
|
562
565
|
styleOverrides?: ComponentsOverrides<Theme>['M4LRHFSelect'];
|
|
563
566
|
variants?: ComponentsVariants['M4LRHFSelect'];
|
|
564
567
|
};
|
|
568
|
+
M4LScrollBar?: {
|
|
569
|
+
defaultProps?: ComponentsPropsList['M4LScrollBar'];
|
|
570
|
+
styleOverrides?: ComponentsOverrides<Theme>['M4LScrollBar'];
|
|
571
|
+
variants?: ComponentsVariants['M4LScrollBar'];
|
|
565
572
|
M4LAreasAdmin?: {
|
|
566
573
|
defaultProps?: ComponentsPropsList['M4LAreasAdmin'];
|
|
567
574
|
styleOverrides?: ComponentsOverrides<Theme>['M4LAreasAdmin'];
|
|
@@ -583,5 +590,6 @@ declare module '@mui/material/styles' {
|
|
|
583
590
|
styleOverrides?: ComponentsOverrides<Theme>['M4LDivider'];
|
|
584
591
|
variants?: ComponentsVariants['M4LDivider'];
|
|
585
592
|
};
|
|
593
|
+
}
|
|
586
594
|
}
|
|
587
595
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { S as ScrollBar } from "../../../ScrollBar/
|
|
2
|
+
import { S as ScrollBar } from "../../../ScrollBar/ScrollBar.js";
|
|
3
3
|
import { u as useAppliedFilters } from "./useAppliedFilters.js";
|
|
4
4
|
import { g as AppliedFiltersStyled, h as AppliedFilterInnerContainerStyled } from "../../slots/dynamicFilterSlots.js";
|
|
5
5
|
import { A as AppliedFilterChip } from "../AppliedFilterChip/AppliedFilterChip.js";
|
|
@@ -3,7 +3,7 @@ import { useState, useEffect } from "react";
|
|
|
3
3
|
import { useNetwork } from "@m4l/core";
|
|
4
4
|
import { useHostTheme } from "@m4l/graphics";
|
|
5
5
|
import ReactJson from "@microlink/react-json-view";
|
|
6
|
-
import { S as ScrollBar } from "../../../ScrollBar/
|
|
6
|
+
import { S as ScrollBar } from "../../../ScrollBar/ScrollBar.js";
|
|
7
7
|
function DetailDialog(props) {
|
|
8
8
|
const { log_id } = props;
|
|
9
9
|
const { networkOperation } = useNetwork();
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import { useIsMobile } from "@m4l/graphics";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import { c as classScrollRoot, S as SCROLL_KEY_COMPONENT } from "./constants.js";
|
|
6
|
+
import { g as getPropDataTestId } from "../../test/getNameDataTestId.js";
|
|
7
|
+
import { R as RootScrollBar, S as SimpleBarStyled } from "./slots/ScrollBarSlots.js";
|
|
8
|
+
import { S as ScrollBarSlots } from "./slots/ScrollBarEnum.js";
|
|
9
|
+
function ScrollBar(props) {
|
|
10
|
+
const {
|
|
11
|
+
orientation,
|
|
12
|
+
children,
|
|
13
|
+
className,
|
|
14
|
+
dataTestId
|
|
15
|
+
} = props;
|
|
16
|
+
const isMobile = useIsMobile();
|
|
17
|
+
const ownerState = {
|
|
18
|
+
orientation,
|
|
19
|
+
children
|
|
20
|
+
};
|
|
21
|
+
if (isMobile) {
|
|
22
|
+
return /* @__PURE__ */ jsx(Box, { sx: { overflowX: "auto", width: "100%" }, children });
|
|
23
|
+
}
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
25
|
+
RootScrollBar,
|
|
26
|
+
{
|
|
27
|
+
ownerState: { ...ownerState },
|
|
28
|
+
id: "RootStyle",
|
|
29
|
+
className: clsx(classScrollRoot, className),
|
|
30
|
+
...getPropDataTestId(SCROLL_KEY_COMPONENT, ScrollBarSlots.root, dataTestId),
|
|
31
|
+
children: /* @__PURE__ */ jsx(
|
|
32
|
+
SimpleBarStyled,
|
|
33
|
+
{
|
|
34
|
+
orientation: props.orientation,
|
|
35
|
+
autoHide: false,
|
|
36
|
+
ownerState: {},
|
|
37
|
+
className: "simplebar",
|
|
38
|
+
children
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
ScrollBar as S
|
|
46
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import "simplebar-react/dist/simplebar.min.css";
|
|
2
|
+
const scrollBarStyles = {
|
|
3
|
+
/**
|
|
4
|
+
* 👾 Estilos para el Componente ScrollBar 👾
|
|
5
|
+
*/
|
|
6
|
+
root: ({ theme }) => ({
|
|
7
|
+
flexGrow: "1",
|
|
8
|
+
width: "100%",
|
|
9
|
+
height: "100%",
|
|
10
|
+
overflow: "hidden",
|
|
11
|
+
minHeight: "inherit",
|
|
12
|
+
"& .simplebar-scrollbar.simplebar-visible:before": {
|
|
13
|
+
opacity: "1"
|
|
14
|
+
},
|
|
15
|
+
'& .simplebar-content-wrapper[style*="overflow: hidden scroll;"] .simplebar-content': {},
|
|
16
|
+
'& .simplebar-content-wrapper[style*="overflow: scroll hidden;"] .simplebar-content': {
|
|
17
|
+
marginBottom: "9px"
|
|
18
|
+
},
|
|
19
|
+
"& .simplebar-track.simplebar-horizontal .simplebar-scrollbar:before": {
|
|
20
|
+
backgroundColor: theme.vars.palette.default.focusOpacity,
|
|
21
|
+
borderRadius: "2px",
|
|
22
|
+
height: "5px"
|
|
23
|
+
},
|
|
24
|
+
"& .simplebar-track.simplebar-vertical .simplebar-scrollbar:before": {
|
|
25
|
+
background: theme.vars.palette.general.scrollBar,
|
|
26
|
+
borderRadius: "2px"
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
/**
|
|
30
|
+
* 👾 Estilos para el Componente ScrollBar 👾
|
|
31
|
+
*/
|
|
32
|
+
scrollBar: () => ({
|
|
33
|
+
height: "100%",
|
|
34
|
+
"& .simplebar-scrollbar": {
|
|
35
|
+
"&:before": {
|
|
36
|
+
// backgroundColor: alpha(theme.colorSchemes.finalTheme.palette.grey[600], 0.48),
|
|
37
|
+
},
|
|
38
|
+
"&.simplebar-visible:before": {
|
|
39
|
+
opacity: 1
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"& .simplebar-track.simplebar-vertical": {
|
|
43
|
+
width: 10
|
|
44
|
+
},
|
|
45
|
+
"& .simplebar-track.simplebar-horizontal .simplebar-scrollbar": {
|
|
46
|
+
height: 6
|
|
47
|
+
},
|
|
48
|
+
"& .simplebar-mask": {
|
|
49
|
+
zIndex: "inherit"
|
|
50
|
+
},
|
|
51
|
+
"& .simplebar-content": {
|
|
52
|
+
display: "flex",
|
|
53
|
+
flexDirection: "column",
|
|
54
|
+
height: "100%"
|
|
55
|
+
},
|
|
56
|
+
'& .simplebar-content-wrapper[style*="overflow: hidden scroll;"] ': {
|
|
57
|
+
"& .simplebar-content": {
|
|
58
|
+
marginRight: "12px"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
scrollBarStyles as s
|
|
65
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const RootScrollBar: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').ScrollBarProps> & Record<string, unknown> & {
|
|
2
|
+
ownerState: Partial<import('../types').ScrollBarProps> & Record<string, unknown>;
|
|
3
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
4
|
+
export declare const SimpleBarStyled: import('@emotion/styled').StyledComponent<Pick<import('simplebar-react').Props & import('react').RefAttributes<import('simplebar-core').default | null>, keyof import('simplebar-react').Props | keyof import('react').RefAttributes<import('simplebar-core').default | null>> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').ScrollBarProps> & Record<string, unknown> & {
|
|
5
|
+
ownerState: Partial<import('../types').ScrollBarProps> & Record<string, unknown>;
|
|
6
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
|
+
import SimpleBarReact from "simplebar-react";
|
|
3
|
+
import { S as SCROLL_KEY_COMPONENT } from "../constants.js";
|
|
4
|
+
import { S as ScrollBarSlots } from "./ScrollBarEnum.js";
|
|
5
|
+
import { s as scrollBarStyles } from "../ScrollBar.styles.js";
|
|
6
|
+
const RootScrollBar = styled("div", {
|
|
7
|
+
name: SCROLL_KEY_COMPONENT,
|
|
8
|
+
slot: ScrollBarSlots.root
|
|
9
|
+
})(scrollBarStyles?.root);
|
|
10
|
+
const SimpleBarStyled = styled(SimpleBarReact, {
|
|
11
|
+
name: SCROLL_KEY_COMPONENT,
|
|
12
|
+
slot: ScrollBarSlots.scrollBar
|
|
13
|
+
})(scrollBarStyles?.scrollBar);
|
|
14
|
+
export {
|
|
15
|
+
RootScrollBar as R,
|
|
16
|
+
SimpleBarStyled as S
|
|
17
|
+
};
|
|
@@ -1,7 +1,49 @@
|
|
|
1
|
-
import { SxProps } from '@mui/material';
|
|
1
|
+
import { SxProps, Theme } from '@mui/material';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { Props as SimpleProps } from 'simplebar-react';
|
|
4
|
+
import { SCROLL_KEY_COMPONENT } from './constants';
|
|
5
|
+
import { OverridesStyleRules } from '@mui/material/styles/overrides';
|
|
6
|
+
import { ScrollBarSlots } from './slots';
|
|
7
|
+
/**
|
|
8
|
+
* Props for the ScrollBar component.
|
|
9
|
+
*/
|
|
4
10
|
export interface ScrollBarProps extends SimpleProps {
|
|
11
|
+
/**
|
|
12
|
+
* The content of the ScrollBar.
|
|
13
|
+
*/
|
|
5
14
|
children: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
17
|
+
*/
|
|
6
18
|
sx?: SxProps;
|
|
19
|
+
/**
|
|
20
|
+
* The orientation of the ScrollBar.
|
|
21
|
+
* @default 'vertical'
|
|
22
|
+
*/
|
|
23
|
+
orientation?: 'vertical' | 'horizontal';
|
|
24
|
+
/**
|
|
25
|
+
* The class name of the ScrollBar.
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The data-testid attribute for testing purposes.
|
|
30
|
+
*/
|
|
31
|
+
dataTestId?: string;
|
|
7
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* The owner state for the ScrollBar component.
|
|
35
|
+
*/
|
|
36
|
+
export type ownerState = ScrollBarProps;
|
|
37
|
+
/**
|
|
38
|
+
* The owner state for the ScrollBar component.
|
|
39
|
+
* @deprecated This type is redundant and can be removed.
|
|
40
|
+
*/
|
|
41
|
+
export type ScrollBarOwnerState = ScrollBarProps & {};
|
|
42
|
+
/**
|
|
43
|
+
* The type for the ScrollBar slots.
|
|
44
|
+
*/
|
|
45
|
+
export type ScrollBarSlotsType = keyof typeof ScrollBarSlots;
|
|
46
|
+
/**
|
|
47
|
+
* The styles for the ScrollBar component.
|
|
48
|
+
*/
|
|
49
|
+
export type ScrollBarStyles = OverridesStyleRules<ScrollBarSlots, typeof SCROLL_KEY_COMPONENT, Theme>;
|
|
@@ -5,7 +5,6 @@ import clsx from "clsx";
|
|
|
5
5
|
import { A as AreaChip } from "./subcomponents/AreaChip/AreaChip.js";
|
|
6
6
|
import { shallow } from "zustand/shallow";
|
|
7
7
|
import { I as ICONS } from "../../icons.js";
|
|
8
|
-
import { S as ScrollBar } from "../../../ScrollBar/index.js";
|
|
9
8
|
import { A as AreaChipMobile } from "./subcomponents/AreaChipMobile/AreaChipMobile.js";
|
|
10
9
|
import { useRef } from "react";
|
|
11
10
|
import { g as getAreasDictionary, A as AREAS_DICCTIONARY } from "../../dictionary.js";
|
|
@@ -14,6 +13,7 @@ import { useIsMobile } from "@m4l/graphics";
|
|
|
14
13
|
import { A as AREAS_ADMIN_KEY_COMPONENT } from "./constants.js";
|
|
15
14
|
import { a as getComponentSlotRoot } from "../../../../utils/getComponentSlotRoot.js";
|
|
16
15
|
import { g as getPropDataTestId } from "../../../../test/getNameDataTestId.js";
|
|
16
|
+
import { S as ScrollBar } from "../../../ScrollBar/ScrollBar.js";
|
|
17
17
|
import { u as useComponentSize } from "../../../../hooks/useComponentSize/useComponentSize.js";
|
|
18
18
|
import { T as Typography } from "../../../mui_extended/Typography/Typography.js";
|
|
19
19
|
import { A as AreasAdminSlots } from "./slots/AreasAdminEnum.js";
|
|
@@ -3,7 +3,7 @@ import { RHFPeriodProps } from './types';
|
|
|
3
3
|
* Componente que renderiza un campo de formulario para ingresar un período.
|
|
4
4
|
* @author cesar - automatic
|
|
5
5
|
* @createdAt 2024-12-27 15:03:02 - automatic
|
|
6
|
-
* @updatedAt 2025-01-
|
|
7
|
-
* @updatedUser
|
|
6
|
+
* @updatedAt 2025-01-24 15:21:25 - automatic
|
|
7
|
+
* @updatedUser cesar - automatic
|
|
8
8
|
*/
|
|
9
9
|
export declare const RHFPeriod: (props: RHFPeriodProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,7 +14,6 @@ import { H as HelperError } from "../../HelperError/HelperError.js";
|
|
|
14
14
|
const RHFPeriod = (props) => {
|
|
15
15
|
const {
|
|
16
16
|
name,
|
|
17
|
-
readOnly,
|
|
18
17
|
label,
|
|
19
18
|
mandatory,
|
|
20
19
|
mandatoryMessage,
|
|
@@ -45,8 +44,9 @@ const RHFPeriod = (props) => {
|
|
|
45
44
|
children: /* @__PURE__ */ jsx(
|
|
46
45
|
Controller,
|
|
47
46
|
{
|
|
48
|
-
name,
|
|
47
|
+
name: name || "",
|
|
49
48
|
control,
|
|
49
|
+
defaultValue: { selPeriodTime: "", singleValue: "" },
|
|
50
50
|
render: ({ field: { onChange, value }, fieldState: { error } }) => {
|
|
51
51
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
52
52
|
label && /* @__PURE__ */ jsx(
|
|
@@ -62,12 +62,12 @@ const RHFPeriod = (props) => {
|
|
|
62
62
|
/* @__PURE__ */ jsx(
|
|
63
63
|
Period,
|
|
64
64
|
{
|
|
65
|
+
name,
|
|
66
|
+
control,
|
|
65
67
|
disabled,
|
|
66
68
|
value,
|
|
67
69
|
onChange,
|
|
68
|
-
size
|
|
69
|
-
readOnly,
|
|
70
|
-
error: !!error
|
|
70
|
+
size
|
|
71
71
|
}
|
|
72
72
|
),
|
|
73
73
|
error && /* @__PURE__ */ jsx(HelperError, { message: error.message || "" })
|
|
@@ -4,3 +4,5 @@ export * from './constants';
|
|
|
4
4
|
export * from './slots/RHFPeriodEnum';
|
|
5
5
|
export * from './slots/RHFPeriodSlots';
|
|
6
6
|
export * from './types';
|
|
7
|
+
export { getPeriodComponetsDictionary } from './subcomponents/Period/dictionary';
|
|
8
|
+
export type { PeriodType } from './subcomponents/Period/types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -3,7 +3,7 @@ import { PeriodProps } from './types';
|
|
|
3
3
|
* Componente que renderiza un campo de formulario para ingresar un período.
|
|
4
4
|
* @author cesar - automatic
|
|
5
5
|
* @createdAt 2024-12-30 16:32:50 - automatic
|
|
6
|
-
* @updatedAt 2025-01-
|
|
7
|
-
* @updatedUser
|
|
6
|
+
* @updatedAt 2025-01-28 17:32:00 - automatic
|
|
7
|
+
* @updatedUser cesar - automatic
|
|
8
8
|
*/
|
|
9
|
-
export declare const Period: (
|
|
9
|
+
export declare const Period: (props: PeriodProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,23 +2,21 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useModuleDictionary, useEnvironment } from "@m4l/core";
|
|
3
3
|
import { E as ETimePeriods } from "./types.js";
|
|
4
4
|
import { d as dictionary } from "./dictionary.js";
|
|
5
|
-
import { useMemo
|
|
5
|
+
import { useMemo } from "react";
|
|
6
6
|
import { u as useComponentSize } from "../../../../../hooks/useComponentSize/useComponentSize.js";
|
|
7
7
|
import { P as PeriodRootStyled, S as SelectStyled, T as TextFieldStyled } from "../../slots/RHFPeriodSlots.js";
|
|
8
8
|
import { I as Icon } from "../../../../Icon/Icon.js";
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
const Period = (props) => {
|
|
10
|
+
const {
|
|
11
|
+
value,
|
|
12
|
+
onChange,
|
|
13
|
+
size,
|
|
14
|
+
error,
|
|
15
|
+
disabled
|
|
16
|
+
} = props;
|
|
17
17
|
const { getLabel } = useModuleDictionary();
|
|
18
18
|
const { currentSize } = useComponentSize(size);
|
|
19
19
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
20
|
-
const normalizedSize = currentSize === "large" ? "medium" : currentSize;
|
|
21
|
-
const { selPeriodTime, singleValue } = normalizePeriod(valuePeriod);
|
|
22
20
|
const options = useMemo(
|
|
23
21
|
() => [
|
|
24
22
|
{ id: ETimePeriods.YEARS.toString(), label: getLabel(dictionary.LABEL_YEARS) },
|
|
@@ -27,23 +25,75 @@ const Period = ({ value: valuePeriod, onChange, size, disabled, error }) => {
|
|
|
27
25
|
],
|
|
28
26
|
[getLabel]
|
|
29
27
|
);
|
|
30
|
-
const
|
|
31
|
-
(
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
const getSingleValue = (period) => {
|
|
29
|
+
if (!period) {
|
|
30
|
+
return "";
|
|
31
|
+
}
|
|
32
|
+
if (period.singleValue !== void 0) {
|
|
33
|
+
return period.singleValue;
|
|
34
|
+
}
|
|
35
|
+
if (period.years && period.years > 0) {
|
|
36
|
+
return period.years;
|
|
37
|
+
}
|
|
38
|
+
if (period.months && period.months > 0) {
|
|
39
|
+
return period.months;
|
|
40
|
+
}
|
|
41
|
+
if (period.days && period.days > 0) {
|
|
42
|
+
return period.days;
|
|
43
|
+
}
|
|
44
|
+
return "";
|
|
45
|
+
};
|
|
46
|
+
const getSelPeriodTime = (period) => {
|
|
47
|
+
if (!period) {
|
|
48
|
+
return ETimePeriods.YEARS;
|
|
49
|
+
}
|
|
50
|
+
if (period.selPeriodTime) {
|
|
51
|
+
return period.selPeriodTime;
|
|
52
|
+
}
|
|
53
|
+
if (period.years && period.years > 0) {
|
|
54
|
+
return ETimePeriods.YEARS;
|
|
55
|
+
}
|
|
56
|
+
if (period.months && period.months > 0) {
|
|
57
|
+
return ETimePeriods.MONTHS;
|
|
58
|
+
}
|
|
59
|
+
if (period.days && period.days > 0) {
|
|
60
|
+
return ETimePeriods.DAYS;
|
|
61
|
+
}
|
|
62
|
+
return ETimePeriods.YEARS;
|
|
63
|
+
};
|
|
64
|
+
const singleValue = getSingleValue(value);
|
|
65
|
+
const selPeriodTime = getSelPeriodTime(value);
|
|
66
|
+
const onTotalChange = (newPeriodTime, newValue) => {
|
|
67
|
+
const newPeriod = {
|
|
68
|
+
selPeriodTime: newPeriodTime,
|
|
69
|
+
singleValue: newValue
|
|
70
|
+
};
|
|
71
|
+
if (newValue !== "" && newValue > 0) {
|
|
72
|
+
newPeriod.years = 0;
|
|
73
|
+
newPeriod.months = 0;
|
|
74
|
+
newPeriod.days = 0;
|
|
75
|
+
if (newPeriodTime === ETimePeriods.YEARS) {
|
|
76
|
+
newPeriod.years = newValue;
|
|
77
|
+
}
|
|
78
|
+
if (newPeriodTime === ETimePeriods.MONTHS) {
|
|
79
|
+
newPeriod.months = newValue;
|
|
80
|
+
}
|
|
81
|
+
if (newPeriodTime === ETimePeriods.DAYS) {
|
|
82
|
+
newPeriod.days = newValue;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
onChange(newPeriod);
|
|
86
|
+
};
|
|
87
|
+
const onChangeTime = (newPeriodTime) => {
|
|
88
|
+
if (newPeriodTime) {
|
|
89
|
+
onTotalChange(newPeriodTime.id, singleValue);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const normalizedSize = currentSize === "large" ? "medium" : currentSize;
|
|
36
93
|
const ownerState = {
|
|
37
94
|
size: normalizedSize,
|
|
38
|
-
disabled
|
|
39
|
-
isValid: !error
|
|
95
|
+
disabled
|
|
40
96
|
};
|
|
41
|
-
const handleKeyDown = useCallback((e) => {
|
|
42
|
-
const validKeys = /^[0-9]$/;
|
|
43
|
-
if (!validKeys.test(e.key) && e.key !== "Backspace" && e.key !== "Delete" && e.key !== "Tab") {
|
|
44
|
-
e.preventDefault();
|
|
45
|
-
}
|
|
46
|
-
}, []);
|
|
47
97
|
return /* @__PURE__ */ jsxs(PeriodRootStyled, { ownerState, children: [
|
|
48
98
|
/* @__PURE__ */ jsx(
|
|
49
99
|
Icon,
|
|
@@ -56,13 +106,14 @@ const Period = ({ value: valuePeriod, onChange, size, disabled, error }) => {
|
|
|
56
106
|
/* @__PURE__ */ jsx(
|
|
57
107
|
SelectStyled,
|
|
58
108
|
{
|
|
59
|
-
|
|
109
|
+
size: normalizedSize,
|
|
110
|
+
value: options[selPeriodTime].id,
|
|
60
111
|
options,
|
|
61
|
-
onChange: (
|
|
112
|
+
onChange: (autcValue) => {
|
|
113
|
+
onChangeTime(autcValue);
|
|
114
|
+
},
|
|
62
115
|
disabled,
|
|
63
|
-
|
|
64
|
-
error,
|
|
65
|
-
variant: "outlined"
|
|
116
|
+
error: !!error
|
|
66
117
|
}
|
|
67
118
|
),
|
|
68
119
|
/* @__PURE__ */ jsx(
|
|
@@ -72,11 +123,9 @@ const Period = ({ value: valuePeriod, onChange, size, disabled, error }) => {
|
|
|
72
123
|
variant: "outlined",
|
|
73
124
|
value: singleValue,
|
|
74
125
|
InputProps: { disableUnderline: true },
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
onKeyDown: handleKeyDown,
|
|
79
|
-
disabled
|
|
126
|
+
onChange: (e) => {
|
|
127
|
+
onTotalChange(selPeriodTime, e.target.value === "" ? "" : parseInt(e.target.value));
|
|
128
|
+
}
|
|
80
129
|
}
|
|
81
130
|
)
|
|
82
131
|
] });
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { g as getCommonActionsDictionary } from "../../../../CommonActions/dictionary.js";
|
|
1
2
|
const dictionary = {
|
|
2
3
|
LABEL_YEARS: "period.label_years",
|
|
3
4
|
LABEL_MONTHS: "period.label_months",
|
|
4
5
|
LABEL_DAYS: "period.label_days"
|
|
5
6
|
};
|
|
7
|
+
function getPeriodComponetsDictionary() {
|
|
8
|
+
return ["period"].concat(getCommonActionsDictionary());
|
|
9
|
+
}
|
|
6
10
|
export {
|
|
7
|
-
dictionary as d
|
|
11
|
+
dictionary as d,
|
|
12
|
+
getPeriodComponetsDictionary as g
|
|
8
13
|
};
|
|
@@ -5,22 +5,25 @@ export declare enum ETimePeriods {
|
|
|
5
5
|
DAYS = 2
|
|
6
6
|
}
|
|
7
7
|
export type PeriodTime = {
|
|
8
|
-
id: number
|
|
8
|
+
id: number;
|
|
9
9
|
label: string;
|
|
10
10
|
};
|
|
11
|
-
export type SKTWrapperProps = Pick<PeriodProps, 'readOnly'>;
|
|
12
11
|
export type PeriodType = {
|
|
13
|
-
selPeriodTime:
|
|
12
|
+
selPeriodTime: '' | ETimePeriods | undefined;
|
|
14
13
|
singleValue: number | '';
|
|
14
|
+
years?: number;
|
|
15
|
+
months?: number;
|
|
16
|
+
days?: number;
|
|
15
17
|
};
|
|
16
18
|
export interface PeriodProps {
|
|
17
19
|
value: PeriodType;
|
|
18
20
|
onChange: (newValue: PeriodType) => void;
|
|
19
|
-
readOnly?: boolean;
|
|
20
21
|
size: Sizes;
|
|
21
22
|
disabled?: boolean;
|
|
22
23
|
isValid?: boolean;
|
|
23
24
|
error?: boolean;
|
|
25
|
+
name?: string;
|
|
26
|
+
control?: any;
|
|
24
27
|
}
|
|
25
28
|
export interface WrapperProps {
|
|
26
29
|
error: boolean;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { LabelProps } from '../../Label/types';
|
|
2
|
-
import { PeriodProps } from '../RHFPeriod/subcomponents/Period/types';
|
|
3
2
|
import { RHFPeriodSlots } from './slots/RHFPeriodEnum';
|
|
4
3
|
import { OverridesStyleRules } from '@mui/material/styles/overrides';
|
|
5
4
|
import { Theme } from '@mui/material';
|
|
6
5
|
import { RHF_PERIOD_KEY_COMPONENT } from './constants';
|
|
7
6
|
export type RHFPeriodType = keyof typeof RHFPeriodSlots;
|
|
8
|
-
export interface RHFPeriodProps extends
|
|
7
|
+
export interface RHFPeriodProps extends Omit<LabelProps, 'label'> {
|
|
9
8
|
size?: 'small' | 'medium';
|
|
10
9
|
name: string;
|
|
11
10
|
label?: string;
|
|
12
11
|
dataTestId?: string;
|
|
13
12
|
/**
|
|
14
13
|
* Clase CSS adicional para aplicar estilos personalizados al componente.
|
|
14
|
+
* @author cesar - automatic
|
|
15
|
+
* @createdAt 2025-01-24 15:21:25 - automatic
|
|
16
|
+
* @updatedAt 2025-01-24 15:21:25 - automatic
|
|
17
|
+
* @updatedUser cesar - automatic
|
|
15
18
|
*/
|
|
16
19
|
className?: string;
|
|
20
|
+
onChange?: (newValue: any) => void;
|
|
17
21
|
}
|
|
18
22
|
export interface RHFPeriodOwnerState {
|
|
19
23
|
isFocus: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -10,8 +10,7 @@ export { RHFSelect } from './RHFSelect';
|
|
|
10
10
|
export { RHFHelperError } from './RHFHelperError';
|
|
11
11
|
export * from './RHFTextField';
|
|
12
12
|
export * from './RHFTextFieldPassword';
|
|
13
|
-
export
|
|
14
|
-
export { getPeriodComponetsDictionary } from '../Period/dictionary';
|
|
13
|
+
export * from './RHFPeriod';
|
|
15
14
|
export { RHFRadioGroup } from './RHFRadioGroup';
|
|
16
15
|
export { RHFNumberInput } from './RHFNumberInput/RHFNumberInput';
|
|
17
16
|
export * from './RHFUpload';
|
package/components/index.d.ts
CHANGED
|
@@ -35,13 +35,12 @@ export * from './ObjectLogs';
|
|
|
35
35
|
export * from './ObjectLogs/dictionary';
|
|
36
36
|
export * from './PaperForm/PaperForm';
|
|
37
37
|
export * from './PDFViewer';
|
|
38
|
-
export * from './Period';
|
|
39
38
|
export * from './HelmetPage';
|
|
40
39
|
export * from './PropertyValue/PropertyValue';
|
|
41
40
|
export * from './MenuActions';
|
|
42
41
|
export type { MenuAction, ComponentActionProps } from './MenuActions/types';
|
|
43
42
|
export * from './extended/React-Resizable';
|
|
44
|
-
export * from './ScrollBar';
|
|
43
|
+
export * from './ScrollBar/ScrollBar';
|
|
45
44
|
export { ScrollToTop } from './ScrollToTop';
|
|
46
45
|
export * from './extended/React-Splitter/SplitLayout/SplitLayout';
|
|
47
46
|
export * from './ToastContainer';
|