@m4l/components 0.0.45 → 0.0.48

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 (51) hide show
  1. package/dist/components/CommonActions/components/ActionCancel/index.d.ts +3 -0
  2. package/dist/components/CommonActions/components/ActionCancel/index.js +14 -0
  3. package/dist/components/CommonActions/components/ActionFormCancel/index.d.ts +3 -0
  4. package/dist/components/CommonActions/components/ActionFormCancel/index.js +62 -0
  5. package/dist/components/CommonActions/components/ActionFormCancel/types.d.ts +6 -0
  6. package/dist/components/CommonActions/components/ActionFormIntro/index.d.ts +3 -0
  7. package/dist/components/CommonActions/components/ActionFormIntro/index.js +34 -0
  8. package/dist/components/CommonActions/components/ActionIntro/index.d.ts +3 -0
  9. package/dist/components/CommonActions/components/ActionIntro/index.js +16 -0
  10. package/dist/components/CommonActions/components/Actions/index.d.ts +3 -0
  11. package/dist/components/CommonActions/components/Actions/index.js +980 -0
  12. package/dist/components/CommonActions/components/Actions/styles.d.ts +2 -0
  13. package/dist/components/CommonActions/components/Actions/types.d.ts +6 -0
  14. package/dist/components/CommonActions/context/index.d.ts +5 -0
  15. package/dist/components/CommonActions/context/types.d.ts +9 -0
  16. package/dist/components/{FormActions → CommonActions}/dictionary.d.ts +1 -1
  17. package/dist/components/CommonActions/index.d.ts +6 -0
  18. package/dist/components/DataGrid/index.js +8 -648
  19. package/dist/components/DynamicFilter/components/fieldstypes/DateTimeFilter/index.d.ts +2 -1
  20. package/dist/components/DynamicFilter/components/fieldstypes/factory.d.ts +2 -1
  21. package/dist/components/DynamicFilter/index.js +21 -17
  22. package/dist/components/Icon/index.js +14 -12
  23. package/dist/components/ModalDialog/components/Header/types.d.ts +2 -2
  24. package/dist/components/ModalDialog/index.js +20 -20
  25. package/dist/components/ModalDialog/types.d.ts +2 -2
  26. package/dist/components/ObjectLogs/index.js +3 -6
  27. package/dist/components/SplitLayout/index.js +0 -1
  28. package/dist/components/formatters/DateFormatter/index.js +10 -8
  29. package/dist/components/hook-form/FormProvider/index.js +6 -116
  30. package/dist/components/hook-form/RHFTextField/index.d.ts +1 -1
  31. package/dist/components/index.d.ts +2 -2
  32. package/dist/components/mui_extended/Button/index.d.ts +3 -0
  33. package/dist/components/mui_extended/Button/styles.d.ts +12 -0
  34. package/dist/components/mui_extended/Button/types.d.ts +2 -0
  35. package/dist/components/mui_extended/IconButton/index.d.ts +0 -1
  36. package/dist/components/mui_extended/IconButton/index.js +23 -16
  37. package/dist/components/mui_extended/Pager/index.js +1 -66
  38. package/dist/contexts/ModalContext/components/ContentConfirm/types.d.ts +3 -3
  39. package/dist/contexts/ModalContext/index.js +12 -9
  40. package/dist/contexts/ModalContext/types.d.ts +5 -6
  41. package/dist/index.js +6 -3
  42. package/dist/react-lazy-load-image-component.js +197 -173
  43. package/dist/utils/index.d.ts +3 -3
  44. package/dist/utils/types.d.ts +1 -0
  45. package/dist/vendor.js +32 -11
  46. package/package.json +4 -5
  47. package/dist/components/FormActions/index.d.ts +0 -3
  48. package/dist/components/FormActions/index.js +0 -51
  49. package/dist/components/FormActions/styles.d.ts +0 -2
  50. package/dist/components/FormActions/types.d.ts +0 -7
  51. package/dist/components/mui_extended/MenuActions/index.js +0 -111
@@ -1,4 +1,4 @@
1
1
  import { Theme } from '@mui/material/styles';
2
- import { VariantModal } from '../contexts/ModalContext/types';
3
- export declare const getVariantColor: (variant: VariantModal | undefined) => "warning" | "info" | "primary" | "error";
4
- export declare const getThemeVariantColor: (theme: Theme, variant: VariantModal | undefined) => string;
2
+ import { VariantColor } from './types';
3
+ export declare const getVariantColor: (variant: VariantColor | undefined) => "warning" | "info" | "primary" | "error";
4
+ export declare const getThemeVariantColor: (theme: Theme, variant: VariantColor | undefined) => string;
@@ -0,0 +1 @@
1
+ export declare type VariantColor = 'warning' | 'delete' | 'info' | 'primary';
package/dist/vendor.js CHANGED
@@ -1,13 +1,15 @@
1
1
  import "./components/mui_extended/IconButton/index.js";
2
2
  import "framer-motion";
3
- import { Skeleton, Autocomplete, TextField } from "@mui/material";
3
+ import { styled, Skeleton, Autocomplete, TextField } from "@mui/material";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { useModuleSkeleton, useModuleDictionary } from "@m4l/core";
6
+ import MuiButton from "@mui/material/Button";
5
7
  import "react";
6
8
  import { useFormContext, Controller } from "react-hook-form";
7
9
  import "./components/hook-form/FormProvider/index.js";
8
10
  import "react-router-dom";
9
- import { useModuleDictionary } from "@m4l/core";
10
11
  import "@mui/lab";
12
+ import "./components/CommonActions/components/Actions/index.js";
11
13
  import "./contexts/ModalContext/index.js";
12
14
  import "./components/hook-form/RHFAutocompleteAsync/index.js";
13
15
  import "./components/hook-form/RHFCheckbox/index.js";
@@ -15,17 +17,15 @@ import "./components/hook-form/RHFDateTime.js";
15
17
  import "@mui/x-date-pickers";
16
18
  import "./components/hook-form/RHFTextField/index.js";
17
19
  import "./lodash.js";
18
- import { styled } from "@mui/material/styles";
20
+ import { styled as styled$1 } from "@mui/material/styles";
19
21
  import "./react-lazy-load-image-component.js";
20
22
  import "./components/Image/index.js";
21
23
  import "./components/hook-form/RHFUpload.js";
22
24
  import "./components/Icon/index.js";
23
25
  import "./components/mui_extended/LoadingButton/index.js";
24
26
  import "./components/mui_extended/MenuPopover/index.js";
25
- import "./components/mui_extended/MenuActions/index.js";
26
27
  import "./components/mui_extended/Pager/index.js";
27
28
  import "./components/mui_extended/Tab/index.js";
28
- import "date-fns";
29
29
  import "@m4l/graphics";
30
30
  import "./components/CompanyLogo/index.js";
31
31
  import "./components/DataGrid/index.js";
@@ -34,7 +34,6 @@ import "react-dnd-html5-backend";
34
34
  import "./components/ScrollBar/index.js";
35
35
  import "./components/DynamicFilter/index.js";
36
36
  import "./simplebar.js";
37
- import "./components/FormActions/index.js";
38
37
  import "./react-draggable.js";
39
38
  import "./components/ModalDialog/index.js";
40
39
  import "./components/Resizeable/index.js";
@@ -61,6 +60,10 @@ import "./components/mui_extended/LinkWithRoute/index.js";
61
60
  import "./components/mui_extended/Typography/index.js";
62
61
  import "./components/formatters/BooleanFormatter/index.js";
63
62
  import "./components/formatters/DateFormatter/index.js";
63
+ import "./components/CommonActions/components/ActionCancel/index.js";
64
+ import "./components/CommonActions/components/ActionIntro/index.js";
65
+ import "./components/CommonActions/components/ActionFormCancel/index.js";
66
+ import "./components/CommonActions/components/ActionFormIntro/index.js";
64
67
  import "./components/LanguagePopover/index.js";
65
68
  import "./components/Loadable/index.js";
66
69
  import "./hooks/useModal/index.js";
@@ -89,12 +92,30 @@ const getThemeVariantColor = (theme, variant) => {
89
92
  }
90
93
  return theme.palette.text.primary;
91
94
  };
92
- const SKTRHFAutocompleteWrapper = styled("div")(() => ({
95
+ const SKTButton = styled(Skeleton)(({
96
+ theme
97
+ }) => ({
98
+ borderRadius: theme.spacing(0.5)
99
+ }));
100
+ const Button = (props) => {
101
+ const isSkeleton = useModuleSkeleton();
102
+ if (isSkeleton) {
103
+ return /* @__PURE__ */ jsx(SKTButton, {
104
+ variant: "rectangular",
105
+ width: "100px",
106
+ height: "36px"
107
+ });
108
+ }
109
+ return /* @__PURE__ */ jsx(MuiButton, {
110
+ ...props
111
+ });
112
+ };
113
+ const SKTRHFAutocompleteWrapper = styled$1("div")(() => ({
93
114
  display: "flex",
94
115
  width: "100%",
95
116
  flexDirection: "column"
96
117
  }));
97
- styled("div")(({
118
+ styled$1("div")(({
98
119
  theme
99
120
  }) => ({
100
121
  display: "flex",
@@ -104,7 +125,7 @@ styled("div")(({
104
125
  justifyContent: "flex-start"
105
126
  }
106
127
  }));
107
- const SKTInputText = styled("div")(({
128
+ const SKTInputText = styled$1("div")(({
108
129
  theme
109
130
  }) => ({
110
131
  width: "100%",
@@ -120,7 +141,7 @@ const SKTInputText = styled("div")(({
120
141
  width: "100%"
121
142
  }
122
143
  }));
123
- styled("div")(() => ({
144
+ styled$1("div")(() => ({
124
145
  display: "flex",
125
146
  width: "100%",
126
147
  "& .MuiAutocomplete-root": {
@@ -222,4 +243,4 @@ function RHFAutocomplete(props) {
222
243
  }
223
244
  });
224
245
  }
225
- export { RHFAutocomplete as R, getThemeVariantColor as a, getVariantColor as g };
246
+ export { Button as B, RHFAutocomplete as R, getVariantColor as a, getThemeVariantColor as g };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
3
  "private": false,
4
- "version": "0.0.45",
4
+ "version": "0.0.48",
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.31",
17
+ "@m4l/graphics": "^0.0.33",
18
18
  "react": "^17.0.0 || 18.x",
19
19
  "react-dom": "^18.0.0",
20
20
  "react-draggable": "^4.4.5"
@@ -25,7 +25,6 @@
25
25
  "@mui/material": "^5.8.7",
26
26
  "@mui/x-date-pickers": "^5.0.0-beta.0",
27
27
  "clsx": "^1.2.1",
28
- "date-fns": "^2.28.0",
29
28
  "framer-motion": "^6.5.0",
30
29
  "lodash": "^4.17.21",
31
30
  "prop-types": "^15.8.1",
@@ -56,8 +55,8 @@
56
55
  "@typescript-eslint/eslint-plugin": "^5.27.1",
57
56
  "@typescript-eslint/parser": "^5.27.1",
58
57
  "@vitejs/plugin-react": "^1.3.2",
58
+ "base-64": "^1.0.0",
59
59
  "clsx": "^1.2.1",
60
- "date-fns": "^2.28.0",
61
60
  "eslint": "^8.17.0",
62
61
  "eslint-config-prettier": "^8.5.0",
63
62
  "eslint-import-resolver-alias": "^1.1.2",
@@ -76,7 +75,7 @@
76
75
  "react-dnd": "^16.0.1",
77
76
  "react-dnd-html5-backend": "^16.0.1",
78
77
  "react-json-view": "^1.21.3",
79
- "react-lazy-load-image-component": "^1.5.4",
78
+ "react-lazy-load-image-component": "^1.5.5",
80
79
  "react-resizable": "^3.0.4",
81
80
  "react-splitter-layout": "^4.0.0",
82
81
  "react-toastify": "^9.0.5",
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import type { ActionsProps } from './types';
3
- export declare const FormActions: (props: ActionsProps) => JSX.Element;
@@ -1,51 +0,0 @@
1
- import { useModuleDictionary } from "@m4l/core";
2
- import { Button } from "@mui/material";
3
- import { g as getVariantColor } from "../../vendor.js";
4
- import { styled } from "@mui/material/styles";
5
- import { jsxs, jsx } from "react/jsx-runtime";
6
- const WrapperActions = styled("div")(({
7
- theme
8
- }) => ({
9
- paddingTop: theme.spacing(3),
10
- display: "flex",
11
- flexDirection: "row",
12
- justifyContent: "flex-end",
13
- "& > button": {
14
- marginLeft: "10px"
15
- }
16
- }));
17
- const FormActions = (props) => {
18
- const {
19
- variant,
20
- standardActions,
21
- actionComponents,
22
- onCloseModal
23
- } = props;
24
- const {
25
- getLabel
26
- } = useModuleDictionary();
27
- return /* @__PURE__ */ jsxs(WrapperActions, {
28
- children: [actionComponents && actionComponents.map((action) => action), standardActions && standardActions.withCancel && /* @__PURE__ */ jsx(Button, {
29
- variant: "outlined",
30
- color: variant !== void 0 ? "inherit" : variant,
31
- onClick: onCloseModal,
32
- children: getLabel("actions.action_cancel")
33
- }), standardActions && standardActions.onClickIntro && /* @__PURE__ */ jsx(Button, {
34
- variant: "contained",
35
- onClick: standardActions.onClickIntro,
36
- type: "submit",
37
- color: getVariantColor(variant),
38
- children: getLabel("actions.action_accept")
39
- })]
40
- });
41
- };
42
- function getActionnsComponentsDictionary() {
43
- return ["actions"];
44
- }
45
- const defaultActionsDictionary = {
46
- actions: {
47
- action_cancel: "Cancel",
48
- action_accept: "Intro"
49
- }
50
- };
51
- export { FormActions as F, defaultActionsDictionary as d, getActionnsComponentsDictionary as g };
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const WrapperActions: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,7 +0,0 @@
1
- import { ModalOpenOptions, VariantModal } from '../../contexts/ModalContext/types';
2
- declare type ImodalOpt = Pick<ModalOpenOptions, 'actionComponents' | 'standardActions'>;
3
- export interface ActionsProps extends ImodalOpt {
4
- variant?: VariantModal;
5
- onCloseModal?: () => void | undefined;
6
- }
7
- export {};
@@ -1,111 +0,0 @@
1
- import { useState, useMemo } from "react";
2
- import { useEnvironment, useModuleDictionary } from "@m4l/core";
3
- import { IconButton, Tooltip, MenuItem } from "@mui/material";
4
- import { M as MenuPopover } from "../MenuPopover/index.js";
5
- import { styled } from "@mui/material/styles";
6
- import { I as Icon } from "../../Icon/index.js";
7
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
8
- const WrapperMenuActions = styled(IconButton)(() => ({}));
9
- const LabelMemuItem = styled("div")(({
10
- theme
11
- }) => ({
12
- height: "22px",
13
- marginLeft: theme.spacing(1.5),
14
- display: "flex",
15
- alignItems: "center"
16
- }));
17
- function MenuActions(props) {
18
- const {
19
- menuActions,
20
- objItem = {},
21
- urlIcon,
22
- toolTip = "",
23
- marginTop = -1,
24
- marginBottom,
25
- marginLeft,
26
- marginRight,
27
- width = 200,
28
- arrow = "right-top",
29
- ...other
30
- } = props;
31
- const {
32
- host_static_assets,
33
- environment_assets
34
- } = useEnvironment();
35
- const {
36
- getLabel
37
- } = useModuleDictionary();
38
- const [open, setOpen] = useState(null);
39
- const handleOpen = (event) => {
40
- setOpen(event.currentTarget);
41
- };
42
- const urlFinalIcon = useMemo(() => {
43
- if (urlIcon)
44
- return urlIcon;
45
- return `${host_static_assets}/${environment_assets}/frontend/commons/assets/icons/more_vertical.svg`;
46
- }, [urlIcon, host_static_assets, environment_assets]);
47
- const handleClose = () => {
48
- setOpen(null);
49
- };
50
- const handleClick = (menuAction) => {
51
- setOpen(null);
52
- menuAction.onClick();
53
- };
54
- const finalActions = useMemo(() => {
55
- let ret;
56
- if (typeof menuActions !== "function") {
57
- ret = menuActions;
58
- } else {
59
- ret = menuActions(objItem);
60
- }
61
- return ret;
62
- }, [menuActions, objItem]);
63
- return /* @__PURE__ */ jsxs(Fragment, {
64
- children: [/* @__PURE__ */ jsx(Tooltip, {
65
- title: toolTip,
66
- children: /* @__PURE__ */ jsx(WrapperMenuActions, {
67
- id: "WrapperMenuActions",
68
- size: "small",
69
- onClick: handleOpen,
70
- children: /* @__PURE__ */ jsx(Icon, {
71
- src: urlFinalIcon,
72
- width: 16,
73
- height: 16
74
- })
75
- })
76
- }), /* @__PURE__ */ jsx(MenuPopover, {
77
- id: "MenuPopover",
78
- open: Boolean(open),
79
- anchorEl: open,
80
- onClose: handleClose,
81
- arrow,
82
- sx: {
83
- marginTop,
84
- marginBottom,
85
- marginLeft,
86
- marginRight,
87
- width,
88
- "& .MuiMenuItem-root": {
89
- px: 1,
90
- typography: "body2",
91
- borderRadius: 0.75
92
- }
93
- },
94
- ...other,
95
- children: open && finalActions.map((menuAction, index) => /* @__PURE__ */ jsxs(MenuItem, {
96
- dense: true,
97
- onClick: () => handleClick(menuAction),
98
- sx: {
99
- color: menuAction.color ? menuAction.color : "text.main"
100
- },
101
- disabled: menuAction.disabled,
102
- children: [/* @__PURE__ */ jsx(Icon, {
103
- src: menuAction.urlIcon
104
- }), /* @__PURE__ */ jsx(LabelMemuItem, {
105
- children: getLabel(menuAction.dictionaryField)
106
- })]
107
- }, `menu_action_${index}`))
108
- })]
109
- });
110
- }
111
- export { LabelMemuItem as L, MenuActions as M };