@m4l/components 0.0.7 → 0.0.10

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 (75) hide show
  1. package/dist/can-use-dom.js +3 -0
  2. package/dist/components/DataGrid/components/Actions/types.d.ts +1 -1
  3. package/dist/components/DataGrid/contexts/BaseContext/types.d.ts +1 -1
  4. package/dist/components/DataGrid/formatters/BooleanFormatter/index.d.ts +3 -0
  5. package/dist/components/DataGrid/formatters/BooleanFormatter/index.js +26 -0
  6. package/dist/components/DataGrid/formatters/BooleanFormatter/types.d.ts +5 -0
  7. package/dist/components/DataGrid/formatters/DateFormatter/index.js +33 -0
  8. package/dist/components/DataGrid/formatters/index.d.ts +2 -0
  9. package/dist/components/DataGrid/index.js +6 -37
  10. package/dist/components/DataGrid/types.d.ts +1 -1
  11. package/dist/components/FormActions/types.d.ts +1 -1
  12. package/dist/components/ModalDialog/components/Header/types.d.ts +1 -1
  13. package/dist/components/ModalDialog/index.js +0 -5
  14. package/dist/components/ObjectLogs/index.js +2 -1
  15. package/dist/components/PropertyValue/index.d.ts +3 -0
  16. package/dist/components/PropertyValue/index.js +108 -0
  17. package/dist/components/PropertyValue/skeleton.d.ts +2 -0
  18. package/dist/components/PropertyValue/styles.d.ts +6 -0
  19. package/dist/components/PropertyValue/types.d.ts +11 -0
  20. package/dist/components/ScrollBar/index.d.ts +3 -0
  21. package/dist/components/ScrollBar/index.js +60 -0
  22. package/dist/components/ScrollBar/styles.d.ts +6 -0
  23. package/dist/components/ScrollBar/types.d.ts +7 -0
  24. package/dist/components/hook-form/FormProvider/components/FormActions/index.d.ts +3 -0
  25. package/dist/components/hook-form/FormProvider/components/FormActions/skeleton.d.ts +2 -0
  26. package/dist/components/hook-form/FormProvider/components/FormActions/styles.d.ts +3 -0
  27. package/dist/components/hook-form/FormProvider/components/FormActions/types.d.ts +4 -0
  28. package/dist/components/hook-form/FormProvider/index.d.ts +3 -0
  29. package/dist/components/hook-form/FormProvider/index.js +162 -0
  30. package/dist/components/hook-form/FormProvider/styles.d.ts +2 -0
  31. package/dist/components/hook-form/FormProvider/types.d.ts +10 -0
  32. package/dist/components/hook-form/RHFAutocompleteAsync/index.d.ts +4 -0
  33. package/dist/components/hook-form/RHFAutocompleteAsync/index.js +184 -0
  34. package/dist/components/hook-form/RHFAutocompleteAsync/styles.d.ts +4 -0
  35. package/dist/components/hook-form/RHFAutocompleteAsync/types.d.ts +17 -0
  36. package/dist/components/hook-form/RHFCheckbox/index.d.ts +3 -0
  37. package/dist/components/hook-form/RHFCheckbox/index.js +41 -0
  38. package/dist/components/hook-form/RHFCheckbox/skeleton.d.ts +2 -0
  39. package/dist/components/hook-form/RHFCheckbox/styles.d.ts +2 -0
  40. package/dist/components/hook-form/RHFCheckbox/types.d.ts +10 -0
  41. package/dist/components/hook-form/RHFMultiCheckbox/index.d.ts +3 -0
  42. package/dist/components/hook-form/RHFMultiCheckbox/index.js +32 -0
  43. package/dist/components/hook-form/RHFMultiCheckbox/types.d.ts +10 -0
  44. package/dist/components/hook-form/RHFRadioGroup.d.ts +9 -0
  45. package/dist/components/hook-form/RHFRadioGroup.js +41 -0
  46. package/dist/components/hook-form/RHFSelect.d.ts +8 -0
  47. package/dist/components/hook-form/RHFSelect.js +34 -0
  48. package/dist/components/hook-form/RHFTextField/index.d.ts +4 -0
  49. package/dist/components/hook-form/RHFTextField/index.js +57 -0
  50. package/dist/components/hook-form/RHFTextField/styles.d.ts +2 -0
  51. package/dist/components/hook-form/RHFTextField/types.d.ts +9 -0
  52. package/dist/components/hook-form/index.d.ts +7 -0
  53. package/dist/components/index.d.ts +11 -5
  54. package/dist/components/mui_extended/Accordion/index.d.ts +3 -0
  55. package/dist/components/mui_extended/Accordion/index.js +45 -0
  56. package/dist/components/mui_extended/Accordion/types.d.ts +11 -0
  57. package/dist/components/mui_extended/BoxIcon/index.js +1 -1
  58. package/dist/components/mui_extended/Breadcrumbs/index.d.ts +2 -1
  59. package/dist/components/mui_extended/MenuPopover/index.d.ts +2 -1
  60. package/dist/components/mui_extended/Tab/index.d.ts +2 -0
  61. package/dist/components/mui_extended/Tab/index.js +29 -0
  62. package/dist/components/mui_extended/Tab/styles.d.ts +2 -0
  63. package/dist/components/mui_extended/index.d.ts +8 -6
  64. package/dist/contexts/ModalContext/index.js +1 -1
  65. package/dist/core-js.js +2645 -0
  66. package/dist/index.js +37 -19
  67. package/dist/juggle.js +511 -0
  68. package/dist/lodash.js +489 -0
  69. package/dist/node_modules.js +54 -0
  70. package/dist/react-draggable.js +3 -3
  71. package/dist/react-resizable.js +3 -3
  72. package/dist/react-splitter-layout.js +2 -2
  73. package/dist/simplebar.js +849 -0
  74. package/dist/vendor.js +27 -14
  75. package/package.json +7 -2
@@ -0,0 +1,3 @@
1
+ var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
2
+ var canUseDom = canUseDOM;
3
+ export { canUseDom as c };
@@ -1,4 +1,4 @@
1
- import { PagerProps } from '@mui_extended/Pager/types';
1
+ import type { PagerProps } from '../../../mui_extended/Pager/types';
2
2
  import { SettingsProps } from './components/Settings/types';
3
3
  export interface ActionsProps {
4
4
  withSettings?: boolean;
@@ -1,4 +1,4 @@
1
- import { MenuAction } from '@mui_extended/MenuActions/types';
1
+ import { MenuAction } from '../../../mui_extended/MenuActions/types';
2
2
  import { ReactNode } from 'react';
3
3
  import { Column } from 'react-data-grid';
4
4
  import { Maybe } from '@m4l/core';
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { BooleanFormatterProps } from './types';
3
+ export declare function BooleanFormatter(props: BooleanFormatterProps): JSX.Element;
@@ -0,0 +1,26 @@
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 };
@@ -0,0 +1,5 @@
1
+ export declare type PresentationType = 'string_yes_no' | 'string_true_false' | 'check';
2
+ export interface BooleanFormatterProps {
3
+ presentationType: PresentationType;
4
+ value: boolean;
5
+ }
@@ -0,0 +1,33 @@
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 };
@@ -0,0 +1,2 @@
1
+ export { BooleanFormatter } from './BooleanFormatter';
2
+ export { DateFormatter } from './DateFormatter';
@@ -6,14 +6,13 @@ import { HTML5Backend } from "react-dnd-html5-backend";
6
6
  import { SvgIcon, Checkbox, InputBase, Skeleton } from "@mui/material";
7
7
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
8
8
  import { voidFunction, useModuleDictionary, useEnvironment } from "@m4l/core";
9
- import { MenuActions } from "@mui_extended";
9
+ import { M as MenuActions } from "../mui_extended/MenuActions/index.js";
10
10
  import { P as Pager, g as getPagerComponentsDictionary, d as defaultPagerDictionary } from "../mui_extended/Pager/index.js";
11
11
  import { I as IconButton } from "../mui_extended/IconButton/index.js";
12
12
  import { u as useModal } from "../../hooks/useModal/index.js";
13
- import { M as MenuActions$1 } from "../mui_extended/MenuActions/index.js";
14
13
  import { u as useResponsiveDesktop } from "../../vendor.js";
14
+ import "date-fns";
15
15
  import { g as getModalDialogComponentsDictionary, d as defaultModalDialogDictionary } from "../ModalDialog/index.js";
16
- import { format } from "date-fns";
17
16
  const WrapperGrid$1 = styled("div")(() => ({
18
17
  display: "flex",
19
18
  flexDirection: "column",
@@ -1478,7 +1477,7 @@ function Density() {
1478
1477
  }
1479
1478
  return /* @__PURE__ */ jsx(WrapperDensity, {
1480
1479
  id: "WrapperDensity",
1481
- children: /* @__PURE__ */ jsx(MenuActions$1, {
1480
+ children: /* @__PURE__ */ jsx(MenuActions, {
1482
1481
  arrow: "right-top",
1483
1482
  anchorOrigin: {
1484
1483
  vertical: "top",
@@ -1589,7 +1588,7 @@ function DataGrid(props) {
1589
1588
  function getGridComponentsDictionary() {
1590
1589
  return ["grid"].concat(getPagerComponentsDictionary()).concat(getModalDialogComponentsDictionary());
1591
1590
  }
1592
- const defaultGridDictionary = {
1591
+ ({
1593
1592
  grid: {
1594
1593
  actions: "Actions",
1595
1594
  settings_tooltip: "Settings",
@@ -1617,40 +1616,10 @@ const defaultGridDictionary = {
1617
1616
  },
1618
1617
  ...defaultPagerDictionary,
1619
1618
  ...defaultModalDialogDictionary
1620
- };
1621
- function DateFormatter(props) {
1622
- const {
1623
- presentationType,
1624
- dateTime,
1625
- formatDate
1626
- } = props;
1627
- let finalFormat = formatDate || "yyyy-MM-dd HH:mm:ss";
1628
- let result;
1629
- let resultDate;
1630
- if (presentationType === "date") {
1631
- finalFormat = formatDate || "yyyy-MM-dd";
1632
- } else if (presentationType === "time") {
1633
- finalFormat = formatDate || "HH:mm:ss";
1634
- }
1635
- try {
1636
- if (typeof dateTime === "number") {
1637
- resultDate = new Date(dateTime);
1638
- } else if (typeof dateTime === "string") {
1639
- resultDate = new Date(Date.parse(dateTime));
1640
- } else {
1641
- resultDate = dateTime;
1642
- }
1643
- result = format(resultDate, finalFormat);
1644
- } catch (e) {
1645
- result = "err_typing";
1646
- }
1647
- return /* @__PURE__ */ jsx(Fragment, {
1648
- children: result
1649
- });
1650
- }
1619
+ });
1651
1620
  const initialPagerState = {
1652
1621
  page: 0,
1653
1622
  rowsPerPage: 25,
1654
1623
  totalRecords: 0
1655
1624
  };
1656
- export { DateFormatter as D, DataGrid as a, defaultGridDictionary as d, getGridComponentsDictionary as g, initialPagerState as i };
1625
+ export { DataGrid as D, getGridComponentsDictionary as g, initialPagerState as i };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { MenuAction } from '@mui_extended/MenuActions/types';
3
2
  import { Column } from 'react-data-grid';
3
+ import type { MenuAction } from '../mui_extended/MenuActions/types';
4
4
  import { ActionsProps } from './components/Actions/types';
5
5
  export declare type ColumnType = 'text' | 'date' | 'number' | 'boolean' | 'custom';
6
6
  export declare type ColumnAlign = 'left' | 'center' | 'right';
@@ -1,4 +1,4 @@
1
- import { ModalOpenOptions } from "src/contexts/ModalContext/types";
1
+ import { ModalOpenOptions } from "../../contexts/ModalContext/types";
2
2
  declare type ImodalOpt = Pick<ModalOpenOptions, 'actionComponents' | 'standardActions'>;
3
3
  export interface ActionsProps extends ImodalOpt {
4
4
  variant?: string | undefined;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { VariantModal } from 'src/contexts/ModalContext/types';
2
+ import { VariantModal } from '../../../../contexts/ModalContext/types';
3
3
  export interface HeaderProps {
4
4
  variant?: VariantModal;
5
5
  title: string;
@@ -6,12 +6,7 @@ import { R as Resizeable } from "../Resizeable/index.js";
6
6
  import { u as useResponsiveDesktop } from "../../vendor.js";
7
7
  import { useEnvironment } from "@m4l/core";
8
8
  import { B as BoxIcon } from "../mui_extended/BoxIcon/index.js";
9
- import "../mui_extended/MenuPopover/index.js";
10
- import "react";
11
9
  import { jsxs, jsx } from "react/jsx-runtime";
12
- import "react-router-dom";
13
- import "../mui_extended/MenuActions/index.js";
14
- import "../mui_extended/Pager/index.js";
15
10
  import { F as FormActions, g as getActionnsComponentsDictionary } from "../FormActions/index.js";
16
11
  const WrapperDialog = styled(Dialog)(() => ({}));
17
12
  const Container = styled("div")(({ theme }) => ({
@@ -5,8 +5,9 @@ import { LocalizationProvider, DateTimePicker } from "@mui/x-date-pickers";
5
5
  import AdapterDateFns from "@mui/lab/AdapterDateFns";
6
6
  import { styled, useTheme } from "@mui/material/styles";
7
7
  import { startOfMonth, endOfDay } from "date-fns";
8
- import { D as DateFormatter, a as DataGrid } from "../DataGrid/index.js";
8
+ import { D as DataGrid } from "../DataGrid/index.js";
9
9
  import { I as IconButton$1 } from "../mui_extended/IconButton/index.js";
10
+ import { D as DateFormatter } from "../DataGrid/formatters/DateFormatter/index.js";
10
11
  import { R as ReactJson } from "../../react-json-view.js";
11
12
  import { jsx, jsxs } from "react/jsx-runtime";
12
13
  import { u as useModal } from "../../hooks/useModal/index.js";
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { PropertyValueProps } from './types';
3
+ export declare function PropertyValue(props: PropertyValueProps): JSX.Element;
@@ -0,0 +1,108 @@
1
+ import { styled } from "@mui/material/styles";
2
+ import { Skeleton } from "@mui/material";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ const WrapperPropertyValue = styled("div", {
5
+ shouldForwardProp: (prop) => prop !== "propertyWidth" && prop !== "propertyHeight" && prop !== "isForm"
6
+ })(({
7
+ propertyHeight,
8
+ isForm,
9
+ theme
10
+ }) => ({
11
+ display: "flex",
12
+ alignItems: "flex-start",
13
+ width: "100%",
14
+ padding: `${theme.spacing(1)} ${theme.spacing(2)}`,
15
+ height: propertyHeight || "auto",
16
+ ":hover": {
17
+ backgroundColor: isForm ? "unset" : theme.palette.grid?.rowHover
18
+ },
19
+ borderBottom: isForm ? "none" : `1px solid ${theme.palette.divider}`,
20
+ flexDirection: "column",
21
+ [theme.breakpoints.up("sm")]: {
22
+ flexDirection: "row",
23
+ alignItems: "center"
24
+ }
25
+ }));
26
+ const Property = styled("span", {
27
+ shouldForwardProp: (prop) => prop !== "propertyWidth" && prop !== "propertyHeight" && prop !== "isForm"
28
+ })(({
29
+ propertyWidth,
30
+ isForm,
31
+ theme
32
+ }) => ({
33
+ width: propertyWidth || "150px",
34
+ minWidth: propertyWidth || "150px",
35
+ ...theme.typography.subtitle2,
36
+ color: theme.palette.text.primary,
37
+ position: "relative",
38
+ [theme.breakpoints.up("sm")]: {
39
+ borderRight: isForm ? "none" : `1px solid ${theme.palette.divider}`,
40
+ paddingRight: theme.spacing(2),
41
+ textAlign: "right"
42
+ },
43
+ overflow: "hidden",
44
+ overflowWrap: "break-word"
45
+ }));
46
+ const Value = styled("div", {
47
+ shouldForwardProp: (prop) => prop !== "propertyWidth" && prop !== "propertyHeight"
48
+ })(({
49
+ propertyHeight,
50
+ theme
51
+ }) => ({
52
+ flexGrow: "1",
53
+ ...theme.typography.body2,
54
+ color: theme.palette.text.secondary,
55
+ position: "relative",
56
+ padding: "1px",
57
+ height: propertyHeight ? propertyHeight - 24 : "auto",
58
+ marginTop: theme.spacing(1),
59
+ width: "100%",
60
+ [theme.breakpoints.up("sm")]: {
61
+ marginLeft: theme.spacing(2),
62
+ marginTop: "0px"
63
+ },
64
+ overflow: "hidden",
65
+ overflowWrap: "break-word"
66
+ }));
67
+ const SKTWrapperProperty = styled("div")(() => ({
68
+ display: "flex",
69
+ justifyContent: "flex-end"
70
+ }));
71
+ function SKTProperty() {
72
+ return /* @__PURE__ */ jsx(SKTWrapperProperty, {
73
+ children: /* @__PURE__ */ jsx(Skeleton, {
74
+ variant: "text",
75
+ width: 68,
76
+ height: 14
77
+ })
78
+ });
79
+ }
80
+ function PropertyValue(props) {
81
+ const {
82
+ property,
83
+ value,
84
+ propertyWidth,
85
+ propertyHeight,
86
+ isForm,
87
+ isSkeleton = false
88
+ } = props;
89
+ return /* @__PURE__ */ jsxs(WrapperPropertyValue, {
90
+ id: "ContainerPropertyValue",
91
+ isForm,
92
+ propertyWidth,
93
+ propertyHeight,
94
+ children: [/* @__PURE__ */ jsx(Property, {
95
+ id: "Property",
96
+ isForm,
97
+ propertyWidth,
98
+ propertyHeight,
99
+ children: isSkeleton ? /* @__PURE__ */ jsx(SKTProperty, {}) : property
100
+ }), /* @__PURE__ */ jsx(Value, {
101
+ id: "Value",
102
+ propertyWidth,
103
+ propertyHeight,
104
+ children: value
105
+ })]
106
+ });
107
+ }
108
+ export { PropertyValue as P };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function SKTProperty(): JSX.Element;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { PropertyProps } from './types';
3
+ export declare const WrapperPropertyValue: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & PropertyProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
4
+ export declare const Property: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & PropertyProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
5
+ export declare const Value: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & PropertyProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
+ export declare const SKTWrapperProperty: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface PropertyProps {
3
+ propertyWidth?: number;
4
+ propertyHeight?: number;
5
+ isForm?: boolean;
6
+ }
7
+ export interface PropertyValueProps extends PropertyProps {
8
+ isSkeleton?: boolean;
9
+ property: string;
10
+ value: number | string | ReactNode;
11
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { ScrollBarProps } from './types';
3
+ export declare function ScrollBar({ children, sx, ...other }: ScrollBarProps): JSX.Element;
@@ -0,0 +1,60 @@
1
+ import { Box } from "@mui/material";
2
+ import { styled, alpha } from "@mui/material/styles";
3
+ import { S as SimpleBar } from "../../simplebar.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ const RootStyle = styled("div")(() => ({
6
+ flexGrow: 1,
7
+ height: "100%",
8
+ overflow: "hidden"
9
+ }));
10
+ const SimpleBarStyle = styled(SimpleBar)(({
11
+ theme
12
+ }) => ({
13
+ maxHeight: "100%",
14
+ "& .simplebar-scrollbar": {
15
+ "&:before": {
16
+ backgroundColor: alpha(theme.palette.grey[600], 0.48)
17
+ },
18
+ "&.simplebar-visible:before": {
19
+ opacity: 1
20
+ }
21
+ },
22
+ "& .simplebar-track.simplebar-vertical": {
23
+ width: 10
24
+ },
25
+ "& .simplebar-track.simplebar-horizontal .simplebar-scrollbar": {
26
+ height: 6
27
+ },
28
+ "& .simplebar-mask": {
29
+ zIndex: "inherit"
30
+ }
31
+ }));
32
+ function ScrollBar({
33
+ children,
34
+ sx,
35
+ ...other
36
+ }) {
37
+ const userAgent = typeof navigator === "undefined" ? "SSR" : navigator.userAgent;
38
+ const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
39
+ if (isMobile) {
40
+ return /* @__PURE__ */ jsx(Box, {
41
+ sx: {
42
+ overflowX: "auto",
43
+ ...sx
44
+ },
45
+ ...other,
46
+ children
47
+ });
48
+ }
49
+ return /* @__PURE__ */ jsx(RootStyle, {
50
+ id: "RootStyle",
51
+ children: /* @__PURE__ */ jsx(SimpleBarStyle, {
52
+ timeout: 500,
53
+ clickOnTrack: false,
54
+ sx,
55
+ ...other,
56
+ children
57
+ })
58
+ });
59
+ }
60
+ export { ScrollBar as S };
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import SimpleBarReact from 'simplebar-react';
3
+ export declare const RootStyle: 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 SimpleBarStyle: import("@emotion/styled").StyledComponent<SimpleBarReact.Props & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {
5
+ ref?: import("react").Ref<SimpleBarReact> | undefined;
6
+ }>;
@@ -0,0 +1,7 @@
1
+ import { SxProps } from '@mui/material';
2
+ import type { ReactNode } from 'react';
3
+ import type { Props as SimpleProps } from 'simplebar-react';
4
+ export interface ScrollBarProps extends SimpleProps {
5
+ children: ReactNode;
6
+ sx?: SxProps;
7
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { FormActionsProps } from './types';
3
+ export declare function FormActions(props: FormActionsProps): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function SKTFormActions(): JSX.Element;
@@ -0,0 +1,3 @@
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>, {}>;
@@ -0,0 +1,4 @@
1
+ export interface FormActionsProps {
2
+ withIntro?: boolean;
3
+ urlCancel?: string | number;
4
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { FormProviderProps } from './types';
3
+ export declare function FormProvider(props: FormProviderProps): JSX.Element;
@@ -0,0 +1,162 @@
1
+ import { useCallback, useEffect } from "react";
2
+ import { useFormContext, useFormState, useForm, FormProvider as FormProvider$1 } from "react-hook-form";
3
+ import { o } from "../../../node_modules.js";
4
+ import { styled } from "@mui/material/styles";
5
+ import { useNavigate } from "react-router-dom";
6
+ import { useModuleDictionary, useFlagsPresent } from "@m4l/core";
7
+ import { LoadingButton } from "@mui/lab";
8
+ import { Skeleton, Button } from "@mui/material";
9
+ import { u as useModal } from "../../../hooks/useModal/index.js";
10
+ import { jsxs, jsx } from "react/jsx-runtime";
11
+ const WrapperFormProvider = styled("form")(({
12
+ theme
13
+ }) => ({
14
+ display: "flex",
15
+ flexDirection: "column",
16
+ width: "100%",
17
+ overflow: "scroll",
18
+ marginBottom: theme.spacing(1)
19
+ }));
20
+ const WrapperFormActions = styled("div")(({
21
+ theme
22
+ }) => ({
23
+ paddingTop: theme.spacing(3),
24
+ marginRight: theme.spacing(1.5),
25
+ display: "flex",
26
+ flexDirection: "row",
27
+ justifyContent: "flex-end",
28
+ "& > button": {
29
+ marginLeft: "10px"
30
+ },
31
+ "& .MuiLoadingButton-root ": {
32
+ minWidth: "80px"
33
+ }
34
+ }));
35
+ const WrapperSKTFormActions = styled("div")(({
36
+ theme
37
+ }) => ({
38
+ display: "grid",
39
+ gridTemplateColumns: "auto auto",
40
+ margin: "0px",
41
+ gridGap: `${theme.spacing(3)}`,
42
+ justifyContent: "flex-end",
43
+ paddingTop: `${theme.spacing(3)}`,
44
+ borderTop: `1px solid ${theme.palette.divider}`,
45
+ [theme.breakpoints.up("sm")]: {
46
+ margin: `0 ${theme.spacing(4.5)}`
47
+ }
48
+ }));
49
+ function SKTFormActions() {
50
+ return /* @__PURE__ */ jsxs(WrapperSKTFormActions, {
51
+ children: [/* @__PURE__ */ jsx(Skeleton, {
52
+ variant: "text",
53
+ width: 57,
54
+ height: 30
55
+ }), /* @__PURE__ */ jsx(Skeleton, {
56
+ variant: "text",
57
+ width: 57,
58
+ height: 30
59
+ })]
60
+ });
61
+ }
62
+ function FormActions(props) {
63
+ const {
64
+ withIntro,
65
+ urlCancel
66
+ } = props;
67
+ const navigate = useNavigate();
68
+ const {
69
+ getLabel
70
+ } = useModuleDictionary();
71
+ const isSkeleton = !useFlagsPresent(["dictionary_loaded", "form_loaded"]);
72
+ const {
73
+ openModalConfirm
74
+ } = useModal();
75
+ const {
76
+ control
77
+ } = useFormContext();
78
+ const {
79
+ isDirty,
80
+ isSubmitting
81
+ } = useFormState({
82
+ control
83
+ });
84
+ const onConfirmCancel = useCallback(() => {
85
+ if (typeof urlCancel === "number") {
86
+ navigate(urlCancel);
87
+ }
88
+ if (urlCancel && typeof urlCancel === "undefined") {
89
+ navigate(urlCancel, {
90
+ replace: false
91
+ });
92
+ }
93
+ }, [navigate, urlCancel]);
94
+ const onClickCancel = useCallback(() => {
95
+ if (isDirty) {
96
+ openModalConfirm({
97
+ variant: "warning",
98
+ title: getLabel("form_provider.confirm_quit_title"),
99
+ msg: getLabel("form_provider.confirm_quit_msg"),
100
+ onClickIntro: onConfirmCancel
101
+ });
102
+ } else {
103
+ onConfirmCancel();
104
+ }
105
+ }, [getLabel, isDirty, onConfirmCancel, openModalConfirm]);
106
+ if (isSkeleton) {
107
+ return /* @__PURE__ */ jsx(SKTFormActions, {});
108
+ }
109
+ return /* @__PURE__ */ jsxs(WrapperFormActions, {
110
+ children: [urlCancel && /* @__PURE__ */ jsx(Button, {
111
+ variant: "outlined",
112
+ color: "inherit",
113
+ onClick: onClickCancel,
114
+ children: getLabel("actions.action_cancel")
115
+ }), withIntro && /* @__PURE__ */ jsx(LoadingButton, {
116
+ variant: "contained",
117
+ type: "submit",
118
+ loading: isSubmitting,
119
+ children: getLabel("actions.action_accept")
120
+ })]
121
+ });
122
+ }
123
+ function FormProvider(props) {
124
+ const {
125
+ children,
126
+ onSubmit,
127
+ values,
128
+ validationSchema,
129
+ withIntro,
130
+ urlCancel = -1
131
+ } = props;
132
+ const methods = useForm({
133
+ resolver: o(validationSchema),
134
+ defaultValues: values
135
+ });
136
+ useEffect(() => {
137
+ if (values.initial) {
138
+ return;
139
+ }
140
+ console.log("****\xB7\xB7\xB7\xB7\xB7\xB7useEffect FormProvider", values);
141
+ const keys = Object.keys(values);
142
+ keys.forEach((key) => {
143
+ methods.setValue(key, values[key], {
144
+ shouldValidate: false,
145
+ shouldDirty: false,
146
+ shouldTouch: false
147
+ });
148
+ });
149
+ }, [methods, values]);
150
+ return /* @__PURE__ */ jsx(FormProvider$1, {
151
+ ...methods,
152
+ children: /* @__PURE__ */ jsxs(WrapperFormProvider, {
153
+ id: "formProvider",
154
+ onSubmit: methods.handleSubmit(onSubmit),
155
+ children: [children, withIntro && /* @__PURE__ */ jsx(FormActions, {
156
+ withIntro,
157
+ urlCancel
158
+ })]
159
+ })
160
+ });
161
+ }
162
+ export { FormProvider as F };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const WrapperFormProvider: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, {}>;
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { FieldValues } from 'react-hook-form';
3
+ export interface FormProviderProps {
4
+ children: ReactNode;
5
+ onSubmit: (data: FieldValues) => void;
6
+ values: FieldValues;
7
+ validationSchema: any;
8
+ withIntro?: boolean;
9
+ urlCancel?: string | number;
10
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { TextFieldProps } from '@mui/material';
3
+ import type { RHFAutocompleteAsyncProps } from './types';
4
+ export declare function RHFAutocompleteAsync<T>(props: RHFAutocompleteAsyncProps<T> & TextFieldProps): JSX.Element;