@m4l/components 0.0.46 → 0.0.49

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 (55) hide show
  1. package/dist/commonjs.js +1 -1
  2. package/dist/components/CommonActions/components/ActionCancel/index.d.ts +3 -0
  3. package/dist/components/CommonActions/components/ActionCancel/index.js +15 -0
  4. package/dist/components/CommonActions/components/ActionFormCancel/index.d.ts +3 -0
  5. package/dist/components/CommonActions/components/ActionFormCancel/index.js +62 -0
  6. package/dist/components/CommonActions/components/ActionFormCancel/types.d.ts +6 -0
  7. package/dist/components/CommonActions/components/ActionFormIntro/index.d.ts +3 -0
  8. package/dist/components/CommonActions/components/ActionFormIntro/index.js +35 -0
  9. package/dist/components/CommonActions/components/ActionIntro/index.d.ts +3 -0
  10. package/dist/components/CommonActions/components/ActionIntro/index.js +16 -0
  11. package/dist/components/CommonActions/components/Actions/index.d.ts +3 -0
  12. package/dist/components/CommonActions/components/Actions/index.js +857 -0
  13. package/dist/components/CommonActions/components/Actions/styles.d.ts +2 -0
  14. package/dist/components/CommonActions/components/Actions/types.d.ts +4 -0
  15. package/dist/components/{FormActions → CommonActions}/dictionary.d.ts +1 -1
  16. package/dist/components/CommonActions/index.d.ts +6 -0
  17. package/dist/components/DataGrid/index.js +8 -648
  18. package/dist/components/DynamicFilter/components/fieldstypes/DateTimeFilter/index.d.ts +2 -1
  19. package/dist/components/DynamicFilter/components/fieldstypes/factory.d.ts +2 -1
  20. package/dist/components/DynamicFilter/index.js +23 -23
  21. package/dist/components/Icon/index.js +14 -12
  22. package/dist/components/ModalDialog/components/Header/types.d.ts +2 -2
  23. package/dist/components/ModalDialog/index.js +20 -20
  24. package/dist/components/ModalDialog/types.d.ts +2 -2
  25. package/dist/components/ObjectLogs/index.js +0 -3
  26. package/dist/components/SplitLayout/index.js +0 -1
  27. package/dist/components/formatters/DateFormatter/index.js +10 -8
  28. package/dist/components/hook-form/FormProvider/index.js +8 -124
  29. package/dist/components/hook-form/FormProvider/types.d.ts +0 -2
  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 +8 -5
  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 +55 -34
  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/hook-form/FormProvider/components/FormActions/index.d.ts +0 -3
  52. package/dist/components/hook-form/FormProvider/components/FormActions/skeleton.d.ts +0 -2
  53. package/dist/components/hook-form/FormProvider/components/FormActions/styles.d.ts +0 -3
  54. package/dist/components/hook-form/FormProvider/components/FormActions/types.d.ts +0 -4
  55. 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,14 +1,11 @@
1
1
  import "./components/mui_extended/IconButton/index.js";
2
2
  import "framer-motion";
3
- import { Skeleton, Autocomplete, TextField } from "@mui/material";
3
+ import { Skeleton, Autocomplete, TextField, styled as styled$1 } from "@mui/material";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import "react";
6
6
  import { useFormContext, Controller } from "react-hook-form";
7
7
  import "./components/hook-form/FormProvider/index.js";
8
- import "react-router-dom";
9
- import { useModuleDictionary } from "@m4l/core";
10
- import "@mui/lab";
11
- import "./contexts/ModalContext/index.js";
8
+ import { useModuleDictionary, useModuleSkeleton } from "@m4l/core";
12
9
  import "./components/hook-form/RHFAutocompleteAsync/index.js";
13
10
  import "./components/hook-form/RHFCheckbox/index.js";
14
11
  import "./components/hook-form/RHFDateTime.js";
@@ -20,21 +17,23 @@ import "./react-lazy-load-image-component.js";
20
17
  import "./components/Image/index.js";
21
18
  import "./components/hook-form/RHFUpload.js";
22
19
  import "./components/Icon/index.js";
20
+ import "react-router-dom";
21
+ import "@mui/lab";
23
22
  import "./components/mui_extended/LoadingButton/index.js";
24
23
  import "./components/mui_extended/MenuPopover/index.js";
25
- import "./components/mui_extended/MenuActions/index.js";
24
+ import "./components/CommonActions/components/Actions/index.js";
26
25
  import "./components/mui_extended/Pager/index.js";
27
26
  import "./components/mui_extended/Tab/index.js";
28
- import "date-fns";
27
+ import MuiButton from "@mui/material/Button";
29
28
  import "@m4l/graphics";
30
29
  import "./components/CompanyLogo/index.js";
31
30
  import "./components/DataGrid/index.js";
32
31
  import "react-dnd";
33
32
  import "react-dnd-html5-backend";
33
+ import "./contexts/ModalContext/index.js";
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,34 +60,13 @@ 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";
67
- const getVariantColor = (variant) => {
68
- switch (variant) {
69
- case "warning":
70
- return "warning";
71
- case "delete":
72
- return "error";
73
- case "info":
74
- return "info";
75
- }
76
- return "primary";
77
- };
78
- const getThemeVariantColor = (theme, variant) => {
79
- switch (variant) {
80
- case "warning":
81
- theme.palette.warning.main;
82
- break;
83
- case "delete":
84
- theme.palette.error.main;
85
- break;
86
- case "info":
87
- theme.palette.info.main;
88
- break;
89
- }
90
- return theme.palette.text.primary;
91
- };
92
70
  const SKTRHFAutocompleteWrapper = styled("div")(() => ({
93
71
  display: "flex",
94
72
  width: "100%",
@@ -222,4 +200,47 @@ function RHFAutocomplete(props) {
222
200
  }
223
201
  });
224
202
  }
225
- export { RHFAutocomplete as R, getThemeVariantColor as a, getVariantColor as g };
203
+ const getVariantColor = (variant) => {
204
+ switch (variant) {
205
+ case "warning":
206
+ return "warning";
207
+ case "delete":
208
+ return "error";
209
+ case "info":
210
+ return "info";
211
+ }
212
+ return "primary";
213
+ };
214
+ const getThemeVariantColor = (theme, variant) => {
215
+ switch (variant) {
216
+ case "warning":
217
+ theme.palette.warning.main;
218
+ break;
219
+ case "delete":
220
+ theme.palette.error.main;
221
+ break;
222
+ case "info":
223
+ theme.palette.info.main;
224
+ break;
225
+ }
226
+ return theme.palette.text.primary;
227
+ };
228
+ const SKTButton = styled$1(Skeleton)(({
229
+ theme
230
+ }) => ({
231
+ borderRadius: theme.spacing(0.5)
232
+ }));
233
+ const Button = (props) => {
234
+ const isSkeleton = useModuleSkeleton();
235
+ if (isSkeleton) {
236
+ return /* @__PURE__ */ jsx(SKTButton, {
237
+ variant: "rectangular",
238
+ width: "100px",
239
+ height: "36px"
240
+ });
241
+ }
242
+ return /* @__PURE__ */ jsx(MuiButton, {
243
+ ...props
244
+ });
245
+ };
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.46",
4
+ "version": "0.0.49",
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,3 +0,0 @@
1
- /// <reference types="react" />
2
- import type { FormActionsProps } from './types';
3
- export declare function FormActions(props: FormActionsProps): JSX.Element;
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare function SKTFormActions(): JSX.Element;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const WrapperFormActions: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
3
- export declare const WrapperSKTFormActions: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,4 +0,0 @@
1
- export interface FormActionsProps {
2
- withIntro?: boolean;
3
- urlCancel?: string | number;
4
- }
@@ -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 };