@m4l/components 0.0.37 → 0.0.40

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.
Files changed (31) hide show
  1. package/dist/components/DataGrid/index.js +0 -1
  2. package/dist/components/DynamicFilter/components/fieldstypes/validations.d.ts +1 -0
  3. package/dist/components/DynamicFilter/index.js +146 -122
  4. package/dist/components/DynamicFilter/types.d.ts +10 -10
  5. package/dist/components/Icon/index.js +1 -0
  6. package/dist/components/Image/index.d.ts +1 -1
  7. package/dist/components/Image/index.js +4 -4
  8. package/dist/components/Image/types.d.ts +1 -1
  9. package/dist/components/ModalDialog/index.js +19 -16
  10. package/dist/components/NoItemSelected/index.d.ts +2 -1
  11. package/dist/components/NoItemSelected/index.js +41 -33
  12. package/dist/components/NoItemSelected/styles.d.ts +2 -2
  13. package/dist/components/NoItemSelected/types.d.ts +6 -1
  14. package/dist/components/ObjectLogs/index.js +11 -9
  15. package/dist/components/SplitLayout/index.js +3 -1
  16. package/dist/components/{DataGrid/formatters → formatters}/BooleanFormatter/index.d.ts +0 -0
  17. package/dist/components/formatters/BooleanFormatter/index.js +32 -0
  18. package/dist/components/{DataGrid/formatters → formatters}/BooleanFormatter/types.d.ts +2 -0
  19. package/dist/components/{DataGrid/formatters → formatters}/DateFormatter/index.d.ts +0 -0
  20. package/dist/components/formatters/DateFormatter/index.js +55 -0
  21. package/dist/components/{DataGrid/formatters → formatters}/DateFormatter/types.d.ts +4 -2
  22. package/dist/components/{DataGrid/formatters → formatters}/index.d.ts +0 -0
  23. package/dist/components/formatters/types.d.ts +2 -0
  24. package/dist/components/index.d.ts +1 -1
  25. package/dist/components/mui_extended/IconButton/index.js +3 -2
  26. package/dist/components/mui_extended/Pager/index.js +3 -0
  27. package/dist/index.js +4 -4
  28. package/dist/vendor.js +3 -4
  29. package/package.json +2 -2
  30. package/dist/components/DataGrid/formatters/BooleanFormatter/index.js +0 -26
  31. package/dist/components/DataGrid/formatters/DateFormatter/index.js +0 -33
@@ -6,6 +6,7 @@ const MaskIcon = styled("div", {
6
6
  })((props) => ({
7
7
  WebkitMask: `url(${props.src}) no-repeat`,
8
8
  mask: `url(${props.src}) no-repeat`,
9
+ maskPosition: "center",
9
10
  width: props.width === void 0 ? "20px" : props.width,
10
11
  height: props.height === void 0 ? "20px" : props.height,
11
12
  backgroundColor: props.bgColor
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { Props } from './types';
3
- export declare function Image({ ratio, sx, isSekeleton, width, height, src, ...other }: Props): JSX.Element;
3
+ export declare function Image({ ratio, sx, isSkeleton, width, height, src, ...other }: Props): JSX.Element;
4
4
  export default Image;
@@ -48,15 +48,15 @@ const WrapperLazyLoadImage = styled("div")(({
48
48
  function Image({
49
49
  ratio,
50
50
  sx,
51
- isSekeleton = false,
52
- width,
53
- height,
51
+ isSkeleton = false,
52
+ width = "100%",
53
+ height = "100%",
54
54
  src,
55
55
  ...other
56
56
  }) {
57
57
  const theme = useTheme();
58
58
  const themeMode = theme.palette.mode;
59
- if (isSekeleton) {
59
+ if (isSkeleton) {
60
60
  return /* @__PURE__ */ jsx(SKTWrapperImage, {
61
61
  width,
62
62
  children: /* @__PURE__ */ jsx(Skeleton, {
@@ -6,7 +6,7 @@ export declare type IProps = BoxProps & LazyLoadImageProps;
6
6
  export interface Props extends IProps {
7
7
  sx?: SxProps<Theme>;
8
8
  ratio?: ImageRato;
9
- isSekeleton?: boolean;
9
+ isSkeleton?: boolean;
10
10
  width?: string;
11
11
  height?: string;
12
12
  }
@@ -19,13 +19,13 @@ const Container = styled("div")(({ theme }) => ({
19
19
  }));
20
20
  const Header$1 = styled("div")(({ theme }) => ({
21
21
  display: "flex",
22
- flexDirection: "row",
23
22
  alignItems: "center",
24
- height: theme.spacing(5),
23
+ justifyContent: "space-between",
24
+ minHeight: theme.spacing(5),
25
25
  borderBottom: `1px solid ${theme.palette.divider}`,
26
26
  overflow: "hidden"
27
27
  }));
28
- const IconTitleContainer = styled("div")(({ theme }) => ({
28
+ styled("div")(({ theme }) => ({
29
29
  display: "flex",
30
30
  flexDirection: "row",
31
31
  flexGrow: 1,
@@ -45,11 +45,16 @@ const IconHeader = styled("div")(({ theme, variant }) => ({
45
45
  }));
46
46
  const Content = styled("div")(() => ({
47
47
  flexGrow: 1,
48
- position: "relative"
48
+ position: "relative",
49
+ overflow: "auto"
49
50
  }));
50
51
  const ModalTitle = styled("div")(({ theme, variant }) => ({
51
52
  ...theme.typography.subtitle1,
52
- color: getThemeVariantColor(theme, variant)
53
+ color: getThemeVariantColor(theme, variant),
54
+ width: "100%",
55
+ whiteSpace: "nowrap",
56
+ textOverflow: "ellipsis",
57
+ overflow: "hidden"
53
58
  }));
54
59
  const Header = (props) => {
55
60
  const {
@@ -69,17 +74,15 @@ const Header = (props) => {
69
74
  const iconDefault = `${host_static_assets}/${environment_assets}/frontend/components/dialog/assets/icons/icon_bar_tittle.svg`;
70
75
  return /* @__PURE__ */ jsxs(Header$1, {
71
76
  id: "Header",
72
- children: [/* @__PURE__ */ jsxs(IconTitleContainer, {
73
- className: "draggable-dialog-title",
74
- children: [/* @__PURE__ */ jsx(IconHeader, {
75
- variant,
76
- children: !iconComponent ? /* @__PURE__ */ jsx(Icon, {
77
- src: variant === "warning" ? iconSrcWarning : variant === "delete" ? iconSrcError : variant === "info" ? iconSrcInfo : iconDefault
78
- }) : iconComponent
79
- }), /* @__PURE__ */ jsx(ModalTitle, {
80
- variant,
81
- children: title
82
- })]
77
+ className: "draggable-dialog-title",
78
+ children: [/* @__PURE__ */ jsx(IconHeader, {
79
+ variant,
80
+ children: !iconComponent ? /* @__PURE__ */ jsx(Icon, {
81
+ src: variant === "warning" ? iconSrcWarning : variant === "delete" ? iconSrcError : variant === "info" ? iconSrcInfo : iconDefault
82
+ }) : iconComponent
83
+ }), /* @__PURE__ */ jsx(ModalTitle, {
84
+ variant,
85
+ children: title
83
86
  }), withClose && /* @__PURE__ */ jsx(IconButton, {
84
87
  onClick: onCloseModal,
85
88
  "aria-label": "click",
@@ -1,2 +1,3 @@
1
1
  /// <reference types="react" />
2
- export declare function NoItemSelected(): JSX.Element;
2
+ import { NoItemSelectedProps } from './types';
3
+ export declare function NoItemSelected(props: NoItemSelectedProps): JSX.Element;
@@ -1,43 +1,23 @@
1
1
  import { useEnvironment, useModuleDictionary } from "@m4l/core";
2
2
  import { styled } from "@mui/material/styles";
3
- import { jsxs, jsx } from "react/jsx-runtime";
3
+ import { I as Image } from "../Image/index.js";
4
+ import { Skeleton } from "@mui/material";
5
+ import { useMemo } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
4
7
  const WrapperNoItemSelected = styled("div")(({
5
8
  theme
6
9
  }) => ({
7
10
  width: "100%",
8
- height: "100%",
11
+ maxWidth: "400px",
12
+ minWidth: "300px",
9
13
  display: "flex",
10
14
  flexDirection: "column",
11
15
  alignItems: "center",
12
16
  justifyContent: "center",
13
- overflow: "auto",
14
17
  padding: theme.spacing(3)
15
18
  }));
16
- const Image = styled("span", {
17
- shouldForwardProp: (prop) => prop !== "src"
18
- })(({
19
- src,
20
- theme
21
- }) => ({
22
- top: 0,
23
- height: "100%",
24
- width: "100%",
25
- maxWidth: "500px",
26
- maxHeight: "200px",
27
- ".split_horizontal &": {
28
- bruces: "sss",
29
- minWidth: "150px"
30
- },
31
- ".split_vertical &": {
32
- bruces: "sss",
33
- minHeight: "150px"
34
- },
35
- padding: `0px ${theme.spacing(1)} ${theme.spacing(1)} ${theme.spacing(1)}`,
36
- display: "inline-block",
37
- backgroundColor: theme.palette.divider,
38
- justifyContent: "center",
39
- mask: `url(${src}) no-repeat center / contain`,
40
- WebkitMask: `url(${src}) no-repeat center / contain`
19
+ const Img = styled(Image)(() => ({
20
+ display: "flex"
41
21
  }));
42
22
  const Label = styled("span")(({
43
23
  theme
@@ -46,7 +26,18 @@ const Label = styled("span")(({
46
26
  padding: `${theme.spacing(1.5)} ${theme.spacing(1)} ${theme.spacing(1)} ${theme.spacing(1)}`,
47
27
  color: theme.palette.text.primary
48
28
  }));
49
- function NoItemSelected() {
29
+ const WrapperSKTNoItemSelected = styled("div")(() => ({
30
+ display: "flex",
31
+ width: "100%",
32
+ minWidth: "100%",
33
+ minHeight: "230px",
34
+ mask: `url("data:image/svg+xml,%3Csvg version='1.1' id='Capa_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 70 70' style='enable-background:new 0 0 70 70%3B' xml:space='preserve'%3E%3Cg%3E%3Cpath d='M45 8.7c1.4-1.5 3.4-2.3 5.4-2.3s3.9 0.8 5.4 2.3s2.4 3.5 2.5 5.7c0 2.2-0.9 4.2-2.4 5.7s-3.5 2.3-5.5 2.2c-2.1 0.1-4-0.7-5.5-2.2c-1.4-1.5-2.3-3.5-2.4-5.7C42.6 12.2 43.5 10.2 45 8.7z'/%3E%3Cpath d='M68.4 62.1c-0.3 0.5-0.7 0.8-1.2 1.1s-1 0.4-1.6 0.4H4.3c-0.6 0-1.1-0.1-1.6-0.4s-0.9-0.6-1.2-1.1c-0.2-0.5-0.4-1-0.4-1.5s0.1-1.1 0.4-1.5l23-36.4c0.3-0.5 0.7-0.8 1.2-1.1c0.5-0.3 1-0.4 1.6-0.4c0.6 0 1.1 0.1 1.6 0.4c0.5 0.3 0.9 0.6 1.2 1.1l11.5 18.2c0.2 0.3 0.5 0.5 0.8 0.7c0.3 0.2 0.6 0.3 1 0.3c0.3 0 0.7-0.1 1-0.3c0.3-0.2 0.6-0.4 0.8-0.7l3.1-4.9c0.3-0.5 0.7-0.8 1.2-1.1c0.5-0.3 1-0.4 1.6-0.4c0.6 0 1.1 0.1 1.6 0.4c0.5 0.3 0.9 0.6 1.2 1.1l14.6 23.1c0.3 0.5 0.3 1 0.3 1.5S68.7 61.7 68.4 62.1z'/%3E%3C/g%3E%3C/svg%3E") no-repeat center / contain`,
35
+ WebkitMask: `url("data:image/svg+xml,%3Csvg version='1.1' id='Capa_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 70 70' style='enable-background:new 0 0 70 70%3B' xml:space='preserve'%3E%3Cg%3E%3Cpath d='M45 8.7c1.4-1.5 3.4-2.3 5.4-2.3s3.9 0.8 5.4 2.3s2.4 3.5 2.5 5.7c0 2.2-0.9 4.2-2.4 5.7s-3.5 2.3-5.5 2.2c-2.1 0.1-4-0.7-5.5-2.2c-1.4-1.5-2.3-3.5-2.4-5.7C42.6 12.2 43.5 10.2 45 8.7z'/%3E%3Cpath d='M68.4 62.1c-0.3 0.5-0.7 0.8-1.2 1.1s-1 0.4-1.6 0.4H4.3c-0.6 0-1.1-0.1-1.6-0.4s-0.9-0.6-1.2-1.1c-0.2-0.5-0.4-1-0.4-1.5s0.1-1.1 0.4-1.5l23-36.4c0.3-0.5 0.7-0.8 1.2-1.1c0.5-0.3 1-0.4 1.6-0.4c0.6 0 1.1 0.1 1.6 0.4c0.5 0.3 0.9 0.6 1.2 1.1l11.5 18.2c0.2 0.3 0.5 0.5 0.8 0.7c0.3 0.2 0.6 0.3 1 0.3c0.3 0 0.7-0.1 1-0.3c0.3-0.2 0.6-0.4 0.8-0.7l3.1-4.9c0.3-0.5 0.7-0.8 1.2-1.1c0.5-0.3 1-0.4 1.6-0.4c0.6 0 1.1 0.1 1.6 0.4c0.5 0.3 0.9 0.6 1.2 1.1l14.6 23.1c0.3 0.5 0.3 1 0.3 1.5S68.7 61.7 68.4 62.1z'/%3E%3C/g%3E%3C/svg%3E") no-repeat center / contain`
36
+ }));
37
+ function NoItemSelected(props) {
38
+ const {
39
+ isSkeleton
40
+ } = props;
50
41
  const {
51
42
  host_static_assets,
52
43
  environment_assets
@@ -54,11 +45,28 @@ function NoItemSelected() {
54
45
  const {
55
46
  getLabel
56
47
  } = useModuleDictionary();
57
- const src = `${host_static_assets}/${environment_assets}/frontend/components/no_item_selected/assets/icons/no_selected.svg`;
48
+ const src = useMemo(() => {
49
+ return `${host_static_assets}/${environment_assets}/frontend/components/no_item_selected/assets/icons/no_selected.svg`;
50
+ }, []);
51
+ if (isSkeleton) {
52
+ return /* @__PURE__ */ jsx(WrapperNoItemSelected, {
53
+ id: "WrapperNoItemSelected",
54
+ children: /* @__PURE__ */ jsx(WrapperSKTNoItemSelected, {
55
+ id: "WrapperSKTNoItemSelected",
56
+ children: /* @__PURE__ */ jsx(Skeleton, {
57
+ variant: "rectangular",
58
+ width: "100%",
59
+ height: "100%"
60
+ })
61
+ })
62
+ });
63
+ }
58
64
  return /* @__PURE__ */ jsxs(WrapperNoItemSelected, {
59
- id: "Wrapper",
60
- children: [/* @__PURE__ */ jsx(Image, {
61
- src
65
+ id: "WrapperNoItemSelected",
66
+ children: [/* @__PURE__ */ jsx(Img, {
67
+ src,
68
+ width: "100%",
69
+ height: "100%"
62
70
  }), /* @__PURE__ */ jsx(Label, {
63
71
  children: getLabel("no_item_selected.message")
64
72
  })]
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ImageProps } from './types';
3
2
  export declare const WrapperNoItemSelected: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
4
- export declare const Image: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & ImageProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
3
+ export declare const Img: import("@emotion/styled").StyledComponent<import("../Image/types").Props & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
5
4
  export declare const Label: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
5
+ export declare const WrapperSKTNoItemSelected: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,5 +1,10 @@
1
+ import { Props } from '../Image/types';
1
2
  export interface NoItemSelectedProps {
3
+ isSkeleton: boolean;
2
4
  }
3
- export interface ImageProps extends NoItemSelectedProps {
5
+ export interface WrapperSKTNoItemSelectedProps {
6
+ src: string;
7
+ }
8
+ export interface ImageProps extends Props {
4
9
  src: string;
5
10
  }
@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback, useMemo } from "react";
2
2
  import { useNetwork, useModuleDictionary, useEnvironment, usePaginate } from "@m4l/core";
3
3
  import { styled } from "@mui/material/styles";
4
4
  import { D as DataGrid } from "../DataGrid/index.js";
5
- import { D as DateFormatter } from "../DataGrid/formatters/DateFormatter/index.js";
5
+ import { D as DateFormatter } from "../formatters/DateFormatter/index.js";
6
6
  import { Tooltip, IconButton } from "@mui/material";
7
7
  import { R as ReactJson } from "../../react-json-view.js";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -79,6 +79,10 @@ function DetailDialog(props) {
79
79
  return /* @__PURE__ */ jsx(Container, {
80
80
  id: "objectLogsDetail",
81
81
  children: /* @__PURE__ */ jsx(ReactJson, {
82
+ name: null,
83
+ sortKeys: true,
84
+ displayDataTypes: false,
85
+ quotesOnKeys: false,
82
86
  src: detail
83
87
  })
84
88
  });
@@ -102,8 +106,8 @@ function DetailFormatter(props) {
102
106
  openModal({
103
107
  onQueryClose: () => closeModal(),
104
108
  title: getLabel("object_logs.modal_detail_title"),
105
- iconComponent: /* @__PURE__ */ jsx("div", {
106
- children: "Sin icono"
109
+ iconComponent: /* @__PURE__ */ jsx(Icon, {
110
+ src: `${host_static_assets}/${environment_assets}/frontend/components/object_logs/assets/icons/search.svg`
107
111
  }),
108
112
  contentComponent: /* @__PURE__ */ jsx(DetailDialog, {
109
113
  log_id
@@ -125,7 +129,6 @@ function ObjectLogs(props) {
125
129
  const {
126
130
  getLabel
127
131
  } = useModuleDictionary();
128
- useEnvironment();
129
132
  const {
130
133
  resource_id,
131
134
  object_id
@@ -136,7 +139,7 @@ function ObjectLogs(props) {
136
139
  });
137
140
  const dateFormatterCreatedAt = useCallback((rowProps) => /* @__PURE__ */ jsx(DateFormatter, {
138
141
  presentationType: "datetime",
139
- dateTime: rowProps.row.created_at
142
+ value: rowProps.row.created_at
140
143
  }), []);
141
144
  const DetailRowFormatter = useCallback((rowProps) => /* @__PURE__ */ jsx(DetailFormatter, {
142
145
  log_id: rowProps.row.id
@@ -184,13 +187,12 @@ function ObjectLogs(props) {
184
187
  useEffect(() => {
185
188
  clearRows();
186
189
  }, [object_id]);
187
- const onChangeFilter = (filters, rawFilters) => {
190
+ const onChangeFilter = (_initFilters, rawFilters) => {
188
191
  setQueryParams({
189
192
  resource_id,
190
193
  object_id,
191
194
  f: rawFilters
192
195
  });
193
- console.log("filter was change*****", JSON.stringify(rawFilters));
194
196
  };
195
197
  return /* @__PURE__ */ jsxs(Container$1, {
196
198
  children: [/* @__PURE__ */ jsx(Actions, {
@@ -204,14 +206,14 @@ function ObjectLogs(props) {
204
206
  label: getLabel("object_logs.date"),
205
207
  type: "datetime",
206
208
  multiple: false,
207
- fixed: true,
209
+ presence: "optional",
208
210
  urlIcon: "https://s3.amazonaws.com/static.made4labs/environments/d1/frontend/components/icon/assets/icons/default.svg"
209
211
  }, {
210
212
  name: "user_logs.log_detail",
211
213
  label: getLabel("object_logs.log_detail"),
212
214
  type: "string",
213
215
  multiple: false,
214
- fixed: false,
216
+ presence: "optional",
215
217
  urlIcon: "https://s3.amazonaws.com/static.made4labs/environments/d1/frontend/components/icon/assets/icons/default.svg"
216
218
  }],
217
219
  initialFilters: []
@@ -95,6 +95,8 @@ const SplitMaster = styled("div")(() => ({
95
95
  const SplitDetail = styled("div")(() => ({
96
96
  display: "flex",
97
97
  flexDirection: "column",
98
+ justifyContent: "center",
99
+ alignItems: "center",
98
100
  overflow: "hidden",
99
101
  position: "absolute",
100
102
  left: "0px",
@@ -121,7 +123,7 @@ function SplitLayout(props) {
121
123
  id: "splitMaster",
122
124
  children: typeof firstPart === "function" ? firstPart() : firstPart
123
125
  }), splitPosition !== "none" && /* @__PURE__ */ jsx(SplitDetail, {
124
- id: "detail",
126
+ id: "detail2",
125
127
  children: typeof secondPart === "function" ? secondPart() : secondPart
126
128
  })]
127
129
  })
@@ -0,0 +1,32 @@
1
+ import require$$0 from "react";
2
+ import { useModuleDictionary } from "@m4l/core";
3
+ import { Checkbox } from "@mui/material";
4
+ import { jsx } from "react/jsx-runtime";
5
+ function BooleanFormatter(props) {
6
+ const {
7
+ presentationType,
8
+ value,
9
+ Component = require$$0.Fragment
10
+ } = props;
11
+ const {
12
+ getLabel
13
+ } = useModuleDictionary();
14
+ if (presentationType === "string_yes_no") {
15
+ return /* @__PURE__ */ jsx(Component, {
16
+ children: value ? getLabel("formatters.boolean_yes") : getLabel("formatters.boolean_no")
17
+ });
18
+ }
19
+ if (presentationType === "string_true_false") {
20
+ return /* @__PURE__ */ jsx(Component, {
21
+ children: value ? getLabel("formatters.boolean_true") : getLabel("formatters.boolean_false")
22
+ });
23
+ }
24
+ return /* @__PURE__ */ jsx(Checkbox, {
25
+ checked: value !== void 0 ? value : false,
26
+ size: "small",
27
+ readOnly: true,
28
+ disableFocusRipple: true,
29
+ disableRipple: true
30
+ });
31
+ }
32
+ export { BooleanFormatter as B };
@@ -1,5 +1,7 @@
1
+ import { ComponentForrmaterType } from '../types';
1
2
  export declare type PresentationType = 'string_yes_no' | 'string_true_false' | 'check';
2
3
  export interface BooleanFormatterProps {
4
+ Component?: ComponentForrmaterType;
3
5
  presentationType: PresentationType;
4
6
  value: boolean;
5
7
  }
@@ -0,0 +1,55 @@
1
+ import { useEnvironment } from "@m4l/core";
2
+ import { format } from "date-fns";
3
+ import require$$0 from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ function DateFormatter(props) {
6
+ const {
7
+ presentationType,
8
+ value,
9
+ format: format$1,
10
+ Component = require$$0.Fragment
11
+ } = props;
12
+ const {
13
+ dfnsFormat
14
+ } = useEnvironment();
15
+ let finalFormat = format$1 || dfnsFormat.datetime_format;
16
+ let result;
17
+ let resultDate;
18
+ switch (presentationType) {
19
+ case "datetime":
20
+ finalFormat = format$1 || dfnsFormat.datetime_format;
21
+ break;
22
+ case "date":
23
+ finalFormat = format$1 || dfnsFormat.date_format;
24
+ break;
25
+ case "time":
26
+ finalFormat = format$1 || dfnsFormat.time_format;
27
+ break;
28
+ }
29
+ try {
30
+ if (typeof value === "number" || typeof value === "string") {
31
+ resultDate = new Date(value);
32
+ } else {
33
+ resultDate = value;
34
+ }
35
+ result = format(resultDate, finalFormat);
36
+ } catch (e) {
37
+ result = "err_typing";
38
+ }
39
+ switch (Component) {
40
+ case "div":
41
+ return /* @__PURE__ */ jsx("div", {
42
+ className: "DateFormatter",
43
+ children: result
44
+ });
45
+ case "span":
46
+ return /* @__PURE__ */ jsx("span", {
47
+ className: "DateFormatter",
48
+ children: result
49
+ });
50
+ }
51
+ return /* @__PURE__ */ jsx(Component, {
52
+ children: result
53
+ });
54
+ }
55
+ export { DateFormatter as D };
@@ -1,6 +1,8 @@
1
+ import { ComponentForrmaterType } from '../types';
1
2
  export declare type PresentationType = 'date' | 'datetime' | 'time';
2
3
  export interface DateFormatterProps {
4
+ Component?: ComponentForrmaterType;
3
5
  presentationType: PresentationType;
4
- formatDate?: string;
5
- dateTime: Date | string | number;
6
+ format?: string;
7
+ value: Date | string | number;
6
8
  }
@@ -0,0 +1,2 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export declare type ComponentForrmaterType = 'div' | 'span' | ((props: PropsWithChildren<any>) => JSX.Element);
@@ -2,8 +2,8 @@ export * from '../components/animate';
2
2
  export * from '../components/hook-form';
3
3
  export * from '../components/mui_extended';
4
4
  export * from '../components/CompanyLogo';
5
+ export * from './formatters';
5
6
  export { DataGrid } from '../components/DataGrid';
6
- export { DateFormatter, BooleanFormatter } from '../components/DataGrid/formatters';
7
7
  export type { Column } from 'react-data-grid';
8
8
  export type { RowKey } from '../components/DataGrid/types';
9
9
  export { getGridComponentsDictionary } from '../components/DataGrid/dictionary';
@@ -74,15 +74,16 @@ function IconButton({
74
74
  console.log("IconButton", size, other, src);
75
75
  return /* @__PURE__ */ jsx(Icon, {
76
76
  src,
77
- bgColor
77
+ bgColor: other.disabled ? "disabled" : bgColor
78
78
  });
79
- }, [src, bgColor]);
79
+ }, [src, bgColor, other.disabled]);
80
80
  const finalTooltip = useMemo(() => {
81
81
  if (dictionaryTooltip && getLabel) {
82
82
  return getLabel(dictionaryTooltip);
83
83
  }
84
84
  return tooltip;
85
85
  }, [dictionaryTooltip, tooltip, getLabel]);
86
+ console.log("icon button test validation disabled", other.disabled ? "disabled" : bgColor);
86
87
  if (finalTooltip && !other.disabled) {
87
88
  return /* @__PURE__ */ jsx(Tooltip, {
88
89
  title: finalTooltip,
@@ -38,9 +38,12 @@ function PagerActions(props) {
38
38
  const handleLastPageButtonClick = (event) => {
39
39
  onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
40
40
  };
41
+ console.log("validaci\xF3n pager action 1", page === 0);
42
+ console.log("validaci\xF3n pager action 2", page >= Math.ceil(count / rowsPerPage) - 1);
41
43
  return /* @__PURE__ */ jsxs(WrapperPagerActions, {
42
44
  id: "WrapperPagerActions",
43
45
  children: [/* @__PURE__ */ jsx(IconButton, {
46
+ id: "test_bruce",
44
47
  dictionaryTooltip: "pager.first",
45
48
  onClick: handleFirstPageButtonClick,
46
49
  disabled: page === 0,
package/dist/index.js CHANGED
@@ -26,9 +26,9 @@ export { P as Pager, g as getPagerComponentsDictionary } from "./components/mui_
26
26
  export { T as Tab } from "./components/mui_extended/Tab/index.js";
27
27
  export { T as Typography } from "./components/mui_extended/Typography/index.js";
28
28
  export { C as CompanyLogo } from "./components/CompanyLogo/index.js";
29
+ export { B as BooleanFormatter } from "./components/formatters/BooleanFormatter/index.js";
30
+ export { D as DateFormatter } from "./components/formatters/DateFormatter/index.js";
29
31
  export { D as DataGrid, g as getGridComponentsDictionary } from "./components/DataGrid/index.js";
30
- export { B as BooleanFormatter } from "./components/DataGrid/formatters/BooleanFormatter/index.js";
31
- export { D as DateFormatter } from "./components/DataGrid/formatters/DateFormatter/index.js";
32
32
  export { D as DynamicFilter } from "./components/DynamicFilter/index.js";
33
33
  export { F as FormActions, d as defaultActionsDictionary, g as getActionnsComponentsDictionary } from "./components/FormActions/index.js";
34
34
  export { I as Icon } from "./components/Icon/index.js";
@@ -62,17 +62,17 @@ import "./commonjs.js";
62
62
  import "react-dom";
63
63
  import "clsx";
64
64
  import "./react-lazy-load-image-component.js";
65
+ import "date-fns";
65
66
  import "@m4l/graphics";
66
67
  import "react-dnd";
67
68
  import "react-dnd-html5-backend";
68
- import "date-fns";
69
69
  import "./simplebar.js";
70
70
  import "./core-js.js";
71
71
  import "./juggle.js";
72
72
  import "./can-use-dom.js";
73
- import "yup";
74
73
  import "./react-draggable.js";
75
74
  import "./react-json-view.js";
76
75
  import "./react-splitter-layout.js";
77
76
  import "./react-data-grid.js";
77
+ import "yup";
78
78
  import "./react-resizable.js";
package/dist/vendor.js CHANGED
@@ -25,16 +25,15 @@ import "./components/mui_extended/MenuPopover/index.js";
25
25
  import "./components/mui_extended/MenuActions/index.js";
26
26
  import "./components/mui_extended/Pager/index.js";
27
27
  import "./components/mui_extended/Tab/index.js";
28
+ import "date-fns";
28
29
  import "@m4l/graphics";
29
30
  import "./components/CompanyLogo/index.js";
30
31
  import "./components/DataGrid/index.js";
31
32
  import "react-dnd";
32
33
  import "react-dnd-html5-backend";
33
- import "date-fns";
34
34
  import "./components/ScrollBar/index.js";
35
35
  import "./components/DynamicFilter/index.js";
36
36
  import "./simplebar.js";
37
- import "yup";
38
37
  import "./components/FormActions/index.js";
39
38
  import "./react-draggable.js";
40
39
  import "./components/ModalDialog/index.js";
@@ -60,8 +59,8 @@ import "./components/mui_extended/BoxIcon/index.js";
60
59
  import "./components/mui_extended/Breadcrumbs/index.js";
61
60
  import "./components/mui_extended/LinkWithRoute/index.js";
62
61
  import "./components/mui_extended/Typography/index.js";
63
- import "./components/DataGrid/formatters/BooleanFormatter/index.js";
64
- import "./components/DataGrid/formatters/DateFormatter/index.js";
62
+ import "./components/formatters/BooleanFormatter/index.js";
63
+ import "./components/formatters/DateFormatter/index.js";
65
64
  import "./components/LanguagePopover/index.js";
66
65
  import "./components/Loadable/index.js";
67
66
  import "./hooks/useModal/index.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
3
  "private": false,
4
- "version": "0.0.37",
4
+ "version": "0.0.40",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -14,7 +14,7 @@
14
14
  "format": "npm run prettier:fix && npm run lint:fix"
15
15
  },
16
16
  "dependencies": {
17
- "@m4l/graphics": "^0.0.28",
17
+ "@m4l/graphics": "^0.0.30",
18
18
  "react": "^17.0.0 || 18.x",
19
19
  "react-dom": "^18.0.0",
20
20
  "react-draggable": "^4.4.5"
@@ -1,26 +0,0 @@
1
- import { Checkbox } from "@mui/material";
2
- import { jsx, Fragment } from "react/jsx-runtime";
3
- function BooleanFormatter(props) {
4
- const {
5
- presentationType,
6
- value
7
- } = props;
8
- if (presentationType === "string_yes_no") {
9
- return /* @__PURE__ */ jsx(Fragment, {
10
- children: value ? "Yes" : "No"
11
- });
12
- }
13
- if (presentationType === "string_true_false") {
14
- return /* @__PURE__ */ jsx(Fragment, {
15
- children: value ? "True" : "False"
16
- });
17
- }
18
- return /* @__PURE__ */ jsx(Checkbox, {
19
- checked: value !== void 0 ? value : false,
20
- size: "small",
21
- readOnly: true,
22
- disableFocusRipple: true,
23
- disableRipple: true
24
- });
25
- }
26
- export { BooleanFormatter as B };
@@ -1,33 +0,0 @@
1
- import { format } from "date-fns";
2
- import { jsx, Fragment } from "react/jsx-runtime";
3
- function DateFormatter(props) {
4
- const {
5
- presentationType,
6
- dateTime,
7
- formatDate
8
- } = props;
9
- let finalFormat = formatDate || "yyyy-MM-dd HH:mm:ss";
10
- let result;
11
- let resultDate;
12
- if (presentationType === "date") {
13
- finalFormat = formatDate || "yyyy-MM-dd";
14
- } else if (presentationType === "time") {
15
- finalFormat = formatDate || "HH:mm:ss";
16
- }
17
- try {
18
- if (typeof dateTime === "number") {
19
- resultDate = new Date(dateTime);
20
- } else if (typeof dateTime === "string") {
21
- resultDate = new Date(Date.parse(dateTime));
22
- } else {
23
- resultDate = dateTime;
24
- }
25
- result = format(resultDate, finalFormat);
26
- } catch (e) {
27
- result = "err_typing";
28
- }
29
- return /* @__PURE__ */ jsx(Fragment, {
30
- children: result
31
- });
32
- }
33
- export { DateFormatter as D };