@m4l/components 0.1.6 → 0.1.8

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 (44) hide show
  1. package/components/DataGrid/components/editors/TextEditor/index.d.ts +6 -0
  2. package/components/DataGrid/index.js +66 -4
  3. package/components/DataGrid/types.d.ts +3 -2
  4. package/components/DynamicFilter/index.js +1 -1
  5. package/components/LanguagePopover/index.js +2 -1
  6. package/components/ModalDialog/index.js +1 -1
  7. package/components/NoItemSelected/index.d.ts +1 -2
  8. package/components/NoItemSelected/index.js +3 -5
  9. package/components/PaperForm/index.js +5 -4
  10. package/components/PaperForm/types.d.ts +1 -2
  11. package/components/PropertyValue/index.js +3 -2
  12. package/components/PropertyValue/types.d.ts +0 -1
  13. package/components/ScrollBar/index.js +2 -2
  14. package/components/hook-form/RHFAutocomplete/index.js +4 -2
  15. package/components/hook-form/RHFAutocomplete/types.d.ts +0 -1
  16. package/components/hook-form/RHFAutocompleteAsync/index.js +16 -5
  17. package/components/hook-form/RHFAutocompleteAsync/types.d.ts +1 -2
  18. package/components/hook-form/RHFCheckbox/index.d.ts +2 -1
  19. package/components/hook-form/RHFCheckbox/index.js +24 -8
  20. package/components/hook-form/RHFCheckbox/types.d.ts +0 -1
  21. package/components/hook-form/RHFDateTime/index.js +2 -2
  22. package/components/hook-form/RHFDateTime/types.d.ts +0 -1
  23. package/components/hook-form/RHFTextField/index.js +41 -17
  24. package/components/hook-form/RHFTextField/types.d.ts +0 -1
  25. package/components/hook-form/RHFUpload/index.js +3 -2
  26. package/components/index.d.ts +2 -1
  27. package/components/mui_extended/Accordion/index.js +6 -6
  28. package/components/mui_extended/Accordion/types.d.ts +0 -1
  29. package/components/mui_extended/Button/index.js +25 -25
  30. package/components/mui_extended/Tab/index.js +2 -1
  31. package/components/mui_extended/index.d.ts +1 -0
  32. package/index.js +5 -7
  33. package/lodash.js +23 -512
  34. package/package.json +3 -2
  35. package/react-draggable.js +4 -4
  36. package/react-resizable.js +4 -4
  37. package/react-splitter-layout.js +2 -2
  38. package/utils/index.js +1 -190
  39. package/can-use-dom.js +0 -3
  40. package/components/NoItemSelected/types.d.ts +0 -10
  41. package/core-js.js +0 -2684
  42. package/juggle.js +0 -325
  43. package/simplebar.js +0 -850
  44. package/style.css +0 -1
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { EditorProps } from 'react-data-grid';
3
+ export declare const Input: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {}>;
4
+ export declare function TextEditor<TRow, TSummaryRow>({ row, column, onRowChange, onClose, }: EditorProps<TRow, TSummaryRow>): JSX.Element;
5
+ export declare function NumberEditor<TRow, TSummaryRow>({ row, column, onRowChange, onClose, }: EditorProps<TRow, TSummaryRow>): JSX.Element;
6
+ export default TextEditor;
@@ -5,7 +5,7 @@ import { useDrag, useDrop, DndProvider } from "react-dnd";
5
5
  import { HTML5Backend } from "react-dnd-html5-backend";
6
6
  import { SvgIcon, Checkbox, InputBase, Skeleton } from "@mui/material";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
- import { voidFunction, useModuleDictionary } from "@m4l/core";
8
+ import { voidFunction, useModuleDictionary, useModuleSkeleton } from "@m4l/core";
9
9
  import { A as ActionsColumn, a as Actions } from "../CommonActions/components/Actions/index.js";
10
10
  import { g as getModalDialogComponentsDictionary, d as defaultModalDialogDictionary } from "../ModalDialog/index.js";
11
11
  import { g as getPagerComponentsDictionary, d as defaultPagerDictionary } from "../mui_extended/Pager/index.js";
@@ -816,7 +816,8 @@ function Table(props) {
816
816
  isMultipleSelect = false,
817
817
  columns,
818
818
  rows,
819
- withActions
819
+ withActions,
820
+ onRowsChange
820
821
  } = props;
821
822
  const {
822
823
  finalColumns,
@@ -908,6 +909,7 @@ function Table(props) {
908
909
  onSortColumnsChange: onChangeSort,
909
910
  onColumnResize,
910
911
  rows: finalRows,
912
+ onRowsChange,
911
913
  selectedRows,
912
914
  onSelectedRowsChange: onInternalSelectedRowsChange,
913
915
  onRowClick,
@@ -928,16 +930,17 @@ function Table(props) {
928
930
  }
929
931
  function DataGrid(props) {
930
932
  const {
931
- isSkeleton = false,
932
933
  withActions = true,
933
934
  rows,
934
935
  columns,
935
936
  actionsProps,
936
937
  rowActionsGetter,
938
+ onRowsChange,
937
939
  rowHeaderHeights = [44, 63, 75],
938
940
  rowHeights = [36, 52, 67],
939
941
  initialRowHeightVariant = "compact"
940
942
  } = props;
943
+ const isSkeleton = useModuleSkeleton();
941
944
  return /* @__PURE__ */ jsx(WrapperGrid, {
942
945
  id: `WrapperGrid_${props.id}`,
943
946
  children: /* @__PURE__ */ jsx(BaseProvider, {
@@ -961,6 +964,7 @@ function DataGrid(props) {
961
964
  isMultipleSelect: props.isMultipleSelect,
962
965
  selectedRows: props.selectedRows,
963
966
  rowKeyGetter: props.rowKeyGetter,
967
+ onRowsChange,
964
968
  onRowsSelectedChange: props.onRowsSelectedChange
965
969
  })]
966
970
  })
@@ -999,4 +1003,62 @@ function getDataGridComponentsDictionary() {
999
1003
  ...defaultPagerDictionary,
1000
1004
  ...defaultModalDialogDictionary
1001
1005
  });
1002
- export { DataGrid as D, OriginalDataGridWrapperStyled as O, useFilters as a, getDataGridComponentsDictionary as g, useBase as u };
1006
+ const Input = styled("input")(() => ({
1007
+ appearance: "none",
1008
+ boxSizing: "border-box",
1009
+ inlineSize: "100%",
1010
+ blockSize: "100%",
1011
+ paddingBlock: "0",
1012
+ verticalAlign: "top",
1013
+ textAlign: "right",
1014
+ color: "var(--rdg-color)",
1015
+ backgroundColor: "var(--rdg-background-color)",
1016
+ fontFamily: "inherit",
1017
+ "&:focus": {
1018
+ outline: "none"
1019
+ },
1020
+ "&::placeholder": {
1021
+ color: "#999",
1022
+ opacity: "1"
1023
+ }
1024
+ }));
1025
+ function autoFocusAndSelect(input) {
1026
+ input?.focus();
1027
+ input?.select();
1028
+ }
1029
+ function TextEditor({
1030
+ row,
1031
+ column,
1032
+ onRowChange,
1033
+ onClose
1034
+ }) {
1035
+ return /* @__PURE__ */ jsx(Input, {
1036
+ className: "rdg-text-editor",
1037
+ ref: autoFocusAndSelect,
1038
+ value: row[column.key],
1039
+ onChange: (event) => onRowChange({
1040
+ ...row,
1041
+ [column.key]: event.target.value
1042
+ }),
1043
+ onBlur: () => onClose(true)
1044
+ });
1045
+ }
1046
+ function NumberEditor({
1047
+ row,
1048
+ column,
1049
+ onRowChange,
1050
+ onClose
1051
+ }) {
1052
+ return /* @__PURE__ */ jsx(Input, {
1053
+ className: "rdg-text-editor",
1054
+ ref: autoFocusAndSelect,
1055
+ type: "number",
1056
+ value: row[column.key],
1057
+ onChange: (event) => onRowChange({
1058
+ ...row,
1059
+ [column.key]: event.target.value !== "" ? Number(event.target.value) : ""
1060
+ }),
1061
+ onBlur: () => onClose(true)
1062
+ });
1063
+ }
1064
+ export { DataGrid as D, NumberEditor as N, OriginalDataGridWrapperStyled as O, TextEditor as T, useFilters as a, getDataGridComponentsDictionary as g, useBase as u };
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { Column } from 'react-data-grid';
2
+ import { Maybe } from '@m4l/core';
3
+ import type { Column, RowsChangeData } from 'react-data-grid';
3
4
  import type { MenuAction } from '../mui_extended/MenuActions/types';
4
5
  import { ActionsProps } from './components/Actions/types';
5
6
  export declare type ColumnType = 'text' | 'date' | 'number' | 'boolean' | 'custom';
@@ -38,7 +39,6 @@ export declare type RowHeightVariants = 'standard' | 'compact' | 'confortable';
38
39
  export declare type RowHeights = number | number[];
39
40
  export declare interface GridProps<TRow, TSummaryRow> {
40
41
  id: RowKey;
41
- isSkeleton?: boolean;
42
42
  withActions?: boolean;
43
43
  columns: readonly Column<TRow, TSummaryRow>[];
44
44
  rows: TRow[];
@@ -49,6 +49,7 @@ export declare interface GridProps<TRow, TSummaryRow> {
49
49
  rowKeyGetter: (row: TRow) => RowKey;
50
50
  isMultipleSelect?: boolean;
51
51
  selectedRows?: Set<RowKey>;
52
+ onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, TSummaryRow>) => void>;
52
53
  onRowsSelectedChange?: (mapRowsSelected: ReadonlySet<RowKey>, rawRowsSelected: TRow[]) => void;
53
54
  }
54
55
  export declare interface DataGridProps<TRow, TSummaryRow> extends GridProps<TRow, TSummaryRow> {
@@ -19,7 +19,7 @@ import "../../react-lazy-load-image-component.js";
19
19
  import "../Image/index.js";
20
20
  import "../hook-form/RHFUpload/index.js";
21
21
  import { I as IconButton } from "../mui_extended/IconButton/index.js";
22
- import "../../simplebar.js";
22
+ import "simplebar/dist/simplebar.min.css";
23
23
  import { F as FilterButton } from "../mui_extended/Button/index.js";
24
24
  import { L as LabelMemuItem, b as Actions, g as getCommonActionsDictionary } from "../CommonActions/components/Actions/index.js";
25
25
  import { M as MenuPopover } from "../mui_extended/MenuPopover/index.js";
@@ -8,8 +8,9 @@ import "@mui/material/styles";
8
8
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
9
9
  import "../mui_extended/Avatar/index.js";
10
10
  import "react-router-dom";
11
- import "@mui/lab";
11
+ import "@mui/material/Button";
12
12
  import "../mui_extended/Button/index.js";
13
+ import "@mui/lab";
13
14
  import { M as MenuPopover } from "../mui_extended/MenuPopover/index.js";
14
15
  import "../CommonActions/components/Actions/index.js";
15
16
  import "../mui_extended/Pager/index.js";
@@ -71,7 +71,7 @@ const Header = (props) => {
71
71
  const iconSrcWarning = `${host_static_assets}/${environment_assets}/frontend/components/dialog/assets/icons/warning.svg`;
72
72
  const iconSrcError = `${host_static_assets}/${environment_assets}/frontend/components/dialog/assets/icons/error.svg`;
73
73
  const iconSrcInfo = `${host_static_assets}/${environment_assets}/frontend/components/dialog/assets/icons/info.svg`;
74
- const iconDefault = `${host_static_assets}/${environment_assets}/frontend/components/dialog/assets/icons/icon_bar_tittle.svg`;
74
+ const iconDefault = `${host_static_assets}/${environment_assets}/frontend/components/dialog/assets/icons/icon_bar_title.svg`;
75
75
  return /* @__PURE__ */ jsxs(Header$1, {
76
76
  id: "Header",
77
77
  className: "draggable-dialog-title",
@@ -1,3 +1,2 @@
1
1
  /// <reference types="react" />
2
- import { NoItemSelectedProps } from './types';
3
- export declare function NoItemSelected(props: NoItemSelectedProps): JSX.Element;
2
+ export declare function NoItemSelected(): JSX.Element;
@@ -1,4 +1,4 @@
1
- import { useEnvironment, useModuleDictionary } from "@m4l/core";
1
+ import { useEnvironment, useModuleDictionary, useModuleSkeleton } from "@m4l/core";
2
2
  import { styled } from "@mui/material/styles";
3
3
  import { I as Image } from "../Image/index.js";
4
4
  import { Skeleton } from "@mui/material";
@@ -34,10 +34,7 @@ const WrapperSKTNoItemSelected = styled("div")(() => ({
34
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
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
36
  }));
37
- function NoItemSelected(props) {
38
- const {
39
- isSkeleton
40
- } = props;
37
+ function NoItemSelected() {
41
38
  const {
42
39
  host_static_assets,
43
40
  environment_assets
@@ -45,6 +42,7 @@ function NoItemSelected(props) {
45
42
  const {
46
43
  getLabel
47
44
  } = useModuleDictionary();
45
+ const isSkeleton = useModuleSkeleton();
48
46
  const src = useMemo(() => {
49
47
  return `${host_static_assets}/${environment_assets}/frontend/components/no_item_selected/assets/icons/no_selected.svg`;
50
48
  }, []);
@@ -2,6 +2,7 @@ import { Skeleton } from "@mui/material";
2
2
  import { styled } from "@mui/material/styles";
3
3
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
4
4
  import { I as Icon } from "../Icon/index.js";
5
+ import { useModuleSkeleton } from "@m4l/core";
5
6
  const WrapperPaper = styled("div")(({
6
7
  theme
7
8
  }) => ({
@@ -89,10 +90,10 @@ function SKTPaperForm(prop) {
89
90
  function PaperForm(props) {
90
91
  const {
91
92
  urlIcon,
92
- tittle,
93
- children,
94
- isSkeleton = false
93
+ title,
94
+ children
95
95
  } = props;
96
+ const isSkeleton = useModuleSkeleton();
96
97
  return /* @__PURE__ */ jsx(WrapperPaper, {
97
98
  id: "ContainerPropertyValue",
98
99
  children: !isSkeleton ? /* @__PURE__ */ jsxs(Fragment, {
@@ -104,7 +105,7 @@ function PaperForm(props) {
104
105
  children: /* @__PURE__ */ jsx(Icon, {
105
106
  src: urlIcon
106
107
  })
107
- }), tittle]
108
+ }), title]
108
109
  })
109
110
  }), /* @__PURE__ */ jsx(Content, {
110
111
  id: "Content",
@@ -1,7 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  export interface PaperFormProps {
3
- isSkeleton?: boolean;
4
3
  urlIcon: string;
5
- tittle: string;
4
+ title: string;
6
5
  children: ReactNode;
7
6
  }
@@ -2,6 +2,7 @@ import { styled } from "@mui/material/styles";
2
2
  import { Skeleton } from "@mui/material";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { useResponsiveDesktop } from "@m4l/graphics";
5
+ import { useModuleSkeleton } from "@m4l/core";
5
6
  const WrapperPropertyValue = styled("div", {
6
7
  shouldForwardProp: (prop) => prop !== "propertyWidth" && prop !== "propertyHeight" && prop !== "isForm"
7
8
  })(({
@@ -86,10 +87,10 @@ function PropertyValue(props) {
86
87
  propertyWidth,
87
88
  propertyHeight,
88
89
  valueWidth = "100",
89
- isForm,
90
- isSkeleton = false
90
+ isForm
91
91
  } = props;
92
92
  const isDesktop = useResponsiveDesktop();
93
+ const isSkeleton = useModuleSkeleton();
93
94
  const getValueW = () => {
94
95
  if (valueWidth === "75" && isDesktop) {
95
96
  return "75";
@@ -10,7 +10,6 @@ export interface ValueProps {
10
10
  }
11
11
  export interface PropertyValueProps extends PropertyProps, ValueTypeProps {
12
12
  property: string;
13
- isSkeleton?: boolean;
14
13
  value: number | string | ReactNode;
15
14
  }
16
15
  export interface ValueTypeProps {
@@ -1,4 +1,4 @@
1
- import { S as SimpleBar } from "../../simplebar.js";
1
+ import SimpleBarReact from "simplebar-react";
2
2
  import { styled, alpha } from "@mui/material/styles";
3
3
  import { Box } from "@mui/material";
4
4
  import { jsx } from "react/jsx-runtime";
@@ -7,7 +7,7 @@ const RootStyle = styled("div")(() => ({
7
7
  height: "100%",
8
8
  overflow: "hidden"
9
9
  }));
10
- const SimpleBarStyle = styled(SimpleBar)(({
10
+ const SimpleBarStyle = styled(SimpleBarReact)(({
11
11
  theme
12
12
  }) => ({
13
13
  maxHeight: "100%",
@@ -1,4 +1,4 @@
1
- import { useModuleDictionary } from "@m4l/core";
1
+ import { useModuleDictionary, useModuleSkeleton } from "@m4l/core";
2
2
  import { useFormContext, Controller } from "react-hook-form";
3
3
  import { Skeleton, Autocomplete, TextField } from "@mui/material";
4
4
  import { styled } from "@mui/material/styles";
@@ -49,16 +49,17 @@ function RHFAutocomplete(props) {
49
49
  label,
50
50
  skeletonProps = {},
51
51
  options,
52
+ disabled,
52
53
  ...other
53
54
  } = props;
54
55
  const {
55
- isSkeleton = false,
56
56
  width = 100,
57
57
  height = "18px"
58
58
  } = skeletonProps;
59
59
  const {
60
60
  getLabel
61
61
  } = useModuleDictionary();
62
+ const isSkeleton = useModuleSkeleton();
62
63
  const {
63
64
  control,
64
65
  getValues
@@ -116,6 +117,7 @@ function RHFAutocomplete(props) {
116
117
  onChange(val);
117
118
  },
118
119
  loadingText: "",
120
+ disabled,
119
121
  noOptionsText: getLabel("rhf_autocomplete.component_no_options"),
120
122
  renderInput: (params) => {
121
123
  return /* @__PURE__ */ jsx(TextField, {
@@ -1,5 +1,4 @@
1
1
  export interface SkeletonProps {
2
- isSkeleton?: boolean;
3
2
  width?: string | number;
4
3
  height?: string | number;
5
4
  }
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect, Fragment } from "react";
2
- import { useModuleDictionary, useNetwork, getPropertyByString } from "@m4l/core";
2
+ import { useModuleDictionary, useModuleSkeleton, useNetwork, getPropertyByString } from "@m4l/core";
3
3
  import { useFormContext, Controller } from "react-hook-form";
4
4
  import { Skeleton, Autocomplete, TextField, CircularProgress } from "@mui/material";
5
5
  import { styled } from "@mui/material/styles";
@@ -43,23 +43,25 @@ function RHFAutocompleteAsync(props) {
43
43
  label,
44
44
  endPoint,
45
45
  timeout = 5e3,
46
- parms = {},
46
+ parms,
47
47
  resultField = "data",
48
48
  skeletonProps = {},
49
49
  isRemote = true,
50
+ disabled,
50
51
  ...other
51
52
  } = props;
52
53
  const {
53
- isSkeleton = false,
54
54
  width = 100,
55
55
  height = "18px"
56
56
  } = skeletonProps;
57
57
  const {
58
58
  getLabel
59
59
  } = useModuleDictionary();
60
+ const isSkeleton = useModuleSkeleton();
60
61
  const {
61
62
  control,
62
- getValues
63
+ getValues,
64
+ setValue
63
65
  } = useFormContext();
64
66
  const {
65
67
  networkOperation
@@ -68,7 +70,14 @@ function RHFAutocompleteAsync(props) {
68
70
  const [options, setOptions] = useState(initialValue === null ? [] : [initialValue]);
69
71
  const [open, setOpen] = useState(false);
70
72
  const [optionsLoaded, setOptionsLoaded] = useState(false);
71
- const loading = open && !optionsLoaded;
73
+ const loading = open && !optionsLoaded && !!endPoint && !isSkeleton;
74
+ useEffect(() => {
75
+ if (optionsLoaded) {
76
+ setOptionsLoaded(false);
77
+ setOptions([]);
78
+ setValue(name, null);
79
+ }
80
+ }, [parms, endPoint]);
72
81
  useEffect(() => {
73
82
  if (!optionsLoaded && initialValue) {
74
83
  setOptions([initialValue]);
@@ -147,8 +156,10 @@ function RHFAutocompleteAsync(props) {
147
156
  setOpen(false);
148
157
  },
149
158
  onChange: (_e, val) => {
159
+ console.log("onChante auto", _e, val);
150
160
  onChange(val);
151
161
  },
162
+ disabled,
152
163
  loading,
153
164
  loadingText: "",
154
165
  noOptionsText: getLabel("rhf_autocomplete.component_no_options"),
@@ -1,5 +1,4 @@
1
1
  export interface SkeletonProps {
2
- isSkeleton?: boolean;
3
2
  width?: string | number;
4
3
  height?: string | number;
5
4
  }
@@ -10,7 +9,7 @@ export interface RHFAutocompleteAsyncProps<T> {
10
9
  skeletonProps?: SkeletonProps;
11
10
  endPoint: string;
12
11
  timeout?: number;
13
- parms?: any;
12
+ parms?: Record<string, any>;
14
13
  resultField?: string;
15
14
  label: string;
16
15
  isRemote?: boolean;
@@ -1,3 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { RHFCheckboxProps } from './types';
3
- export declare function RHFCheckbox({ name, sizeCheck, isSkeleton, ...other }: RHFCheckboxProps): JSX.Element;
3
+ export declare const ErrorLabel: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
4
+ export declare function RHFCheckbox({ name, sizeCheck, ...other }: RHFCheckboxProps): JSX.Element;
@@ -1,7 +1,8 @@
1
1
  import { useFormContext, Controller } from "react-hook-form";
2
- import { Skeleton, FormControlLabel, Checkbox } from "@mui/material";
3
2
  import { styled } from "@mui/material/styles";
4
- import { jsx } from "react/jsx-runtime";
3
+ import { Skeleton, FormControlLabel, Checkbox } from "@mui/material";
4
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
+ import { useModuleSkeleton } from "@m4l/core";
5
6
  const WrapperSKTRHFCheckbox = styled("div")(() => ({
6
7
  display: "flex"
7
8
  }));
@@ -14,15 +15,23 @@ function SKTRHFCheckbox() {
14
15
  })
15
16
  });
16
17
  }
18
+ const ErrorLabel = styled("p")(({
19
+ theme
20
+ }) => ({
21
+ ...theme.typography.caption,
22
+ color: theme.palette.error.main,
23
+ marginRight: 14,
24
+ marginLeft: 14
25
+ }));
17
26
  function RHFCheckbox({
18
27
  name,
19
28
  sizeCheck = "small",
20
- isSkeleton = false,
21
29
  ...other
22
30
  }) {
23
31
  const {
24
32
  control
25
33
  } = useFormContext();
34
+ const isSkeleton = useModuleSkeleton();
26
35
  return /* @__PURE__ */ jsx(
27
36
  FormControlLabel,
28
37
  {
@@ -30,11 +39,18 @@ function RHFCheckbox({
30
39
  name,
31
40
  control,
32
41
  render: ({
33
- field
34
- }) => isSkeleton ? /* @__PURE__ */ jsx(SKTRHFCheckbox, {}) : /* @__PURE__ */ jsx(Checkbox, {
35
- size: sizeCheck,
36
- ...field,
37
- checked: field.value
42
+ field,
43
+ fieldState: {
44
+ error
45
+ }
46
+ }) => isSkeleton ? /* @__PURE__ */ jsx(SKTRHFCheckbox, {}) : /* @__PURE__ */ jsxs(Fragment, {
47
+ children: [/* @__PURE__ */ jsx(Checkbox, {
48
+ size: sizeCheck,
49
+ ...field,
50
+ checked: field.value
51
+ }), console.log("Error1", error?.message), error?.message && /* @__PURE__ */ jsx(ErrorLabel, {
52
+ children: error?.message + ""
53
+ })]
38
54
  })
39
55
  }),
40
56
  ...other
@@ -2,7 +2,6 @@ import { FormControlLabelProps } from '@mui/material';
2
2
  export interface RHFCheckboxProps extends Omit<FormControlLabelProps, 'control'> {
3
3
  name: string;
4
4
  sizeCheck?: 'small' | 'medium';
5
- isSkeleton?: boolean;
6
5
  }
7
6
  export interface RHFMultiCheckboxProps extends Omit<FormControlLabelProps, 'control' | 'label'> {
8
7
  name: string;
@@ -2,7 +2,7 @@ import { useFormContext, Controller } from "react-hook-form";
2
2
  import { Skeleton, TextField } from "@mui/material";
3
3
  import { styled } from "@mui/material/styles";
4
4
  import { DateTimePicker } from "@mui/x-date-pickers";
5
- import { useEnvironment } from "@m4l/core";
5
+ import { useModuleSkeleton, useEnvironment } from "@m4l/core";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  const SKTRHFWrapperTextField = styled("div")(({
8
8
  theme
@@ -21,10 +21,10 @@ function RHFDateTime(props) {
21
21
  skeletonProps: skeletoProps = {}
22
22
  } = props;
23
23
  const {
24
- isSkeleton = false,
25
24
  width = "100%",
26
25
  height = 14
27
26
  } = skeletoProps;
27
+ const isSkeleton = useModuleSkeleton();
28
28
  const {
29
29
  control
30
30
  } = useFormContext();
@@ -1,5 +1,4 @@
1
1
  export interface SkeletonProps {
2
- isSkeleton?: boolean;
3
2
  width?: string | number;
4
3
  height?: string | number;
5
4
  }
@@ -2,6 +2,7 @@ import { useFormContext, Controller } from "react-hook-form";
2
2
  import { Skeleton, TextField } from "@mui/material";
3
3
  import { styled } from "@mui/material/styles";
4
4
  import { forwardRef } from "react";
5
+ import { useModuleSkeleton } from "@m4l/core";
5
6
  import { jsx } from "react/jsx-runtime";
6
7
  const SKTRHFWrapperTextField = styled("div")(({
7
8
  theme
@@ -13,18 +14,19 @@ const SKTRHFWrapperTextField = styled("div")(({
13
14
  padding: "12px 14px",
14
15
  borderRadius: theme.spacing(1)
15
16
  }));
16
- const RHFTextField = forwardRef((props, ref) => {
17
+ const RHFTextField = forwardRef((props, inputRef) => {
17
18
  const {
18
- name,
19
+ name: nameRHF,
19
20
  autoComplete = "off",
20
21
  skeletonProps: skeletoProps = {},
22
+ type,
21
23
  ...other
22
24
  } = props;
23
25
  const {
24
- isSkeleton = false,
25
26
  width = "100%",
26
27
  height = 14
27
28
  } = skeletoProps;
29
+ const isSkeleton = useModuleSkeleton();
28
30
  const {
29
31
  control
30
32
  } = useFormContext();
@@ -38,25 +40,47 @@ const RHFTextField = forwardRef((props, ref) => {
38
40
  });
39
41
  }
40
42
  return /* @__PURE__ */ jsx(Controller, {
41
- name,
43
+ name: nameRHF,
42
44
  control,
43
45
  render: ({
44
- field,
46
+ field: {
47
+ onChange,
48
+ onBlur,
49
+ value,
50
+ name,
51
+ ref
52
+ },
45
53
  fieldState: {
46
54
  error
47
55
  }
48
- }) => /* @__PURE__ */ jsx(
49
- TextField,
50
- {
51
- inputRef: ref,
52
- autoComplete,
53
- ...field,
54
- fullWidth: true,
55
- error: !!error,
56
- helperText: error?.message,
57
- ...other
58
- }
59
- )
56
+ }) => {
57
+ const onInternalChange = (event) => {
58
+ if (type === "number") {
59
+ if (event.target.value) {
60
+ onChange(Number(event.target.value));
61
+ return;
62
+ }
63
+ }
64
+ onChange(event);
65
+ };
66
+ return /* @__PURE__ */ jsx(
67
+ TextField,
68
+ {
69
+ inputRef,
70
+ autoComplete,
71
+ onChange: onInternalChange,
72
+ onBlur,
73
+ value,
74
+ name,
75
+ ref,
76
+ fullWidth: true,
77
+ error: !!error,
78
+ helperText: error?.message,
79
+ type,
80
+ ...other
81
+ }
82
+ );
83
+ }
60
84
  });
61
85
  });
62
86
  RHFTextField.displayName = "RHFTextField";
@@ -1,5 +1,4 @@
1
1
  export interface SkeletonProps {
2
- isSkeleton?: boolean;
3
2
  width?: string | number;
4
3
  height?: string | number;
5
4
  }
@@ -173,8 +173,9 @@ function UploadImage({
173
173
  opacity: 1
174
174
  },
175
175
  ...(isDragReject || error) && {
176
- backgroundColor: alpha("error.main", 0.72),
177
- color: "common.white"
176
+ bgcolor: "error.lighter",
177
+ borderColor: "error.light",
178
+ color: "error.main"
178
179
  }
179
180
  },
180
181
  children: /* @__PURE__ */ jsxs(ContainerUploadBody, {
@@ -5,9 +5,10 @@ export * from '../components/CompanyLogo';
5
5
  export * from './formatters';
6
6
  export * from './formatters/dicctionary';
7
7
  export { DataGrid } from '../components/DataGrid';
8
- export type { Column } from 'react-data-grid';
8
+ export type { Column, EditorProps } from 'react-data-grid';
9
9
  export type { RowKey } from '../components/DataGrid/types';
10
10
  export { getDataGridComponentsDictionary as getGridComponentsDictionary } from '../components/DataGrid/dictionary';
11
+ export { TextEditor, NumberEditor } from '../components/DataGrid/components/editors/TextEditor';
11
12
  export * from '../components/DynamicFilter';
12
13
  export * from '../components/DynamicFilter/dictionary';
13
14
  export type { FilterFieldApply, RawFilterFieldApply, InitialFilterFieldApply, } from '../components/DynamicFilter/types';