@etsoo/materialui 1.5.62 → 1.5.64

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.
@@ -0,0 +1,17 @@
1
+ import { InputFieldProps } from "./InputField";
2
+ /**
3
+ * Data load field properties
4
+ */
5
+ export type DataLoadFieldProps = InputFieldProps & {
6
+ /**
7
+ *
8
+ * Load data handler
9
+ */
10
+ loadData: () => Promise<string | undefined>;
11
+ };
12
+ /**
13
+ * Data load field component
14
+ * @param props Properties
15
+ * @returns Component
16
+ */
17
+ export declare function DataLoadField(props: DataLoadFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DataLoadField = DataLoadField;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = __importDefault(require("react"));
9
+ const InputField_1 = require("./InputField");
10
+ /**
11
+ * Data load field component
12
+ * @param props Properties
13
+ * @returns Component
14
+ */
15
+ function DataLoadField(props) {
16
+ // Destruct
17
+ const { disabled = true, fullWidth = true, loadData, ...rest } = props;
18
+ // Ref
19
+ const inputRef = react_1.default.useRef(null);
20
+ react_1.default.useEffect(() => {
21
+ loadData().then((data) => (inputRef.current.value = data ?? ""));
22
+ }, [loadData]);
23
+ // Layout
24
+ return ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { disabled: disabled, fullWidth: fullWidth, inputRef: inputRef, ...rest }));
25
+ }
@@ -0,0 +1,11 @@
1
+ import { InputFieldProps } from "./InputField";
2
+ /**
3
+ * JSON data input component properties
4
+ */
5
+ export type JsonDataInputProps = Omit<InputFieldProps, "multiple">;
6
+ /**
7
+ * JSON data input component
8
+ * @param props - Component properties
9
+ * @returns JSX Element
10
+ */
11
+ export declare function JsonDataInput(props: JsonDataInputProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.JsonDataInput = JsonDataInput;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = __importDefault(require("react"));
9
+ const InputField_1 = require("./InputField");
10
+ const ReactApp_1 = require("./app/ReactApp");
11
+ /**
12
+ * JSON data input component
13
+ * @param props - Component properties
14
+ * @returns JSX Element
15
+ */
16
+ function JsonDataInput(props) {
17
+ // Destruct
18
+ const { onChange, rows = 3, ...rest } = props;
19
+ // Global app
20
+ const app = (0, ReactApp_1.useRequiredAppContext)();
21
+ const jsonError = app.get("jsonDataError") ?? "JSON format error";
22
+ // Error message
23
+ const [error, setError] = react_1.default.useState();
24
+ // Layout
25
+ return ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { multiline: true, rows: rows, ...rest, error: !!error, helperText: error, onChange: (e) => {
26
+ if (onChange) {
27
+ onChange(e);
28
+ if (e.isDefaultPrevented())
29
+ return;
30
+ }
31
+ const json = e.target.value;
32
+ if (json) {
33
+ try {
34
+ JSON.parse(json);
35
+ }
36
+ catch (e) {
37
+ setError(`${jsonError}: ${e instanceof Error ? e.message : String(e)}`);
38
+ return;
39
+ }
40
+ }
41
+ setError(undefined);
42
+ } }));
43
+ }
@@ -50,6 +50,7 @@ export * from "./CultureDataTable";
50
50
  export * from "./CustomFabProps";
51
51
  export * from "./DataGridEx";
52
52
  export * from "./DataGridRenderers";
53
+ export * from "./DataLoadField";
53
54
  export * from "./DataSteps";
54
55
  export * from "./DataTable";
55
56
  export * from "./DialogButton";
@@ -70,6 +71,7 @@ export * from "./InputField";
70
71
  export * from "./InputTipField";
71
72
  export * from "./IntInputField";
72
73
  export * from "./ItemList";
74
+ export * from "./JsonDataInput";
73
75
  export * from "./LineChart";
74
76
  export * from "./LinkEx";
75
77
  export * from "./ListChooser";
package/lib/cjs/index.js CHANGED
@@ -66,6 +66,7 @@ __exportStar(require("./CultureDataTable"), exports);
66
66
  __exportStar(require("./CustomFabProps"), exports);
67
67
  __exportStar(require("./DataGridEx"), exports);
68
68
  __exportStar(require("./DataGridRenderers"), exports);
69
+ __exportStar(require("./DataLoadField"), exports);
69
70
  __exportStar(require("./DataSteps"), exports);
70
71
  __exportStar(require("./DataTable"), exports);
71
72
  __exportStar(require("./DialogButton"), exports);
@@ -86,6 +87,7 @@ __exportStar(require("./InputField"), exports);
86
87
  __exportStar(require("./InputTipField"), exports);
87
88
  __exportStar(require("./IntInputField"), exports);
88
89
  __exportStar(require("./ItemList"), exports);
90
+ __exportStar(require("./JsonDataInput"), exports);
89
91
  __exportStar(require("./LineChart"), exports);
90
92
  __exportStar(require("./LinkEx"), exports);
91
93
  __exportStar(require("./ListChooser"), exports);
@@ -0,0 +1,17 @@
1
+ import { InputFieldProps } from "./InputField";
2
+ /**
3
+ * Data load field properties
4
+ */
5
+ export type DataLoadFieldProps = InputFieldProps & {
6
+ /**
7
+ *
8
+ * Load data handler
9
+ */
10
+ loadData: () => Promise<string | undefined>;
11
+ };
12
+ /**
13
+ * Data load field component
14
+ * @param props Properties
15
+ * @returns Component
16
+ */
17
+ export declare function DataLoadField(props: DataLoadFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { InputField } from "./InputField";
4
+ /**
5
+ * Data load field component
6
+ * @param props Properties
7
+ * @returns Component
8
+ */
9
+ export function DataLoadField(props) {
10
+ // Destruct
11
+ const { disabled = true, fullWidth = true, loadData, ...rest } = props;
12
+ // Ref
13
+ const inputRef = React.useRef(null);
14
+ React.useEffect(() => {
15
+ loadData().then((data) => (inputRef.current.value = data ?? ""));
16
+ }, [loadData]);
17
+ // Layout
18
+ return (_jsx(InputField, { disabled: disabled, fullWidth: fullWidth, inputRef: inputRef, ...rest }));
19
+ }
@@ -0,0 +1,11 @@
1
+ import { InputFieldProps } from "./InputField";
2
+ /**
3
+ * JSON data input component properties
4
+ */
5
+ export type JsonDataInputProps = Omit<InputFieldProps, "multiple">;
6
+ /**
7
+ * JSON data input component
8
+ * @param props - Component properties
9
+ * @returns JSX Element
10
+ */
11
+ export declare function JsonDataInput(props: JsonDataInputProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { InputField } from "./InputField";
4
+ import { useRequiredAppContext } from "./app/ReactApp";
5
+ /**
6
+ * JSON data input component
7
+ * @param props - Component properties
8
+ * @returns JSX Element
9
+ */
10
+ export function JsonDataInput(props) {
11
+ // Destruct
12
+ const { onChange, rows = 3, ...rest } = props;
13
+ // Global app
14
+ const app = useRequiredAppContext();
15
+ const jsonError = app.get("jsonDataError") ?? "JSON format error";
16
+ // Error message
17
+ const [error, setError] = React.useState();
18
+ // Layout
19
+ return (_jsx(InputField, { multiline: true, rows: rows, ...rest, error: !!error, helperText: error, onChange: (e) => {
20
+ if (onChange) {
21
+ onChange(e);
22
+ if (e.isDefaultPrevented())
23
+ return;
24
+ }
25
+ const json = e.target.value;
26
+ if (json) {
27
+ try {
28
+ JSON.parse(json);
29
+ }
30
+ catch (e) {
31
+ setError(`${jsonError}: ${e instanceof Error ? e.message : String(e)}`);
32
+ return;
33
+ }
34
+ }
35
+ setError(undefined);
36
+ } }));
37
+ }
@@ -50,6 +50,7 @@ export * from "./CultureDataTable";
50
50
  export * from "./CustomFabProps";
51
51
  export * from "./DataGridEx";
52
52
  export * from "./DataGridRenderers";
53
+ export * from "./DataLoadField";
53
54
  export * from "./DataSteps";
54
55
  export * from "./DataTable";
55
56
  export * from "./DialogButton";
@@ -70,6 +71,7 @@ export * from "./InputField";
70
71
  export * from "./InputTipField";
71
72
  export * from "./IntInputField";
72
73
  export * from "./ItemList";
74
+ export * from "./JsonDataInput";
73
75
  export * from "./LineChart";
74
76
  export * from "./LinkEx";
75
77
  export * from "./ListChooser";
package/lib/mjs/index.js CHANGED
@@ -50,6 +50,7 @@ export * from "./CultureDataTable";
50
50
  export * from "./CustomFabProps";
51
51
  export * from "./DataGridEx";
52
52
  export * from "./DataGridRenderers";
53
+ export * from "./DataLoadField";
53
54
  export * from "./DataSteps";
54
55
  export * from "./DataTable";
55
56
  export * from "./DialogButton";
@@ -70,6 +71,7 @@ export * from "./InputField";
70
71
  export * from "./InputTipField";
71
72
  export * from "./IntInputField";
72
73
  export * from "./ItemList";
74
+ export * from "./JsonDataInput";
73
75
  export * from "./LineChart";
74
76
  export * from "./LinkEx";
75
77
  export * from "./ListChooser";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.5.62",
3
+ "version": "1.5.64",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -40,14 +40,14 @@
40
40
  "@dnd-kit/sortable": "^10.0.0",
41
41
  "@emotion/react": "^11.14.0",
42
42
  "@emotion/styled": "^11.14.0",
43
- "@etsoo/appscript": "^1.6.39",
43
+ "@etsoo/appscript": "^1.6.41",
44
44
  "@etsoo/notificationbase": "^1.1.63",
45
45
  "@etsoo/react": "^1.8.49",
46
46
  "@etsoo/shared": "^1.2.75",
47
- "@mui/icons-material": "^7.1.1",
48
- "@mui/material": "^7.1.1",
49
- "@mui/x-data-grid": "^8.5.1",
50
- "chart.js": "^4.4.9",
47
+ "@mui/icons-material": "^7.1.2",
48
+ "@mui/material": "^7.1.2",
49
+ "@mui/x-data-grid": "^8.5.3",
50
+ "chart.js": "^4.5.0",
51
51
  "chartjs-plugin-datalabels": "^2.2.0",
52
52
  "dompurify": "^3.2.6",
53
53
  "eventemitter3": "^5.0.1",
@@ -57,7 +57,7 @@
57
57
  "react-avatar-editor": "^13.0.2",
58
58
  "react-chartjs-2": "^5.3.0",
59
59
  "react-dom": "^18.3.1",
60
- "react-draggable": "^4.4.6",
60
+ "react-draggable": "^4.5.0",
61
61
  "react-imask": "7.6.1"
62
62
  },
63
63
  "overrides": {
@@ -81,9 +81,9 @@
81
81
  "@types/react-dom": "^18.3.7",
82
82
  "@types/react-input-mask": "^3.0.6",
83
83
  "@types/react-window": "^1.8.8",
84
- "@vitejs/plugin-react": "^4.5.2",
84
+ "@vitejs/plugin-react": "^4.6.0",
85
85
  "jsdom": "^26.1.0",
86
86
  "typescript": "^5.8.3",
87
- "vitest": "^3.2.3"
87
+ "vitest": "^3.2.4"
88
88
  }
89
89
  }
@@ -0,0 +1,40 @@
1
+ import React from "react";
2
+ import { InputField, InputFieldProps } from "./InputField";
3
+
4
+ /**
5
+ * Data load field properties
6
+ */
7
+ export type DataLoadFieldProps = InputFieldProps & {
8
+ /**
9
+ *
10
+ * Load data handler
11
+ */
12
+ loadData: () => Promise<string | undefined>;
13
+ };
14
+
15
+ /**
16
+ * Data load field component
17
+ * @param props Properties
18
+ * @returns Component
19
+ */
20
+ export function DataLoadField(props: DataLoadFieldProps) {
21
+ // Destruct
22
+ const { disabled = true, fullWidth = true, loadData, ...rest } = props;
23
+
24
+ // Ref
25
+ const inputRef = React.useRef<HTMLInputElement>(null);
26
+
27
+ React.useEffect(() => {
28
+ loadData().then((data) => (inputRef.current!.value = data ?? ""));
29
+ }, [loadData]);
30
+
31
+ // Layout
32
+ return (
33
+ <InputField
34
+ disabled={disabled}
35
+ fullWidth={fullWidth}
36
+ inputRef={inputRef}
37
+ {...rest}
38
+ />
39
+ );
40
+ }
@@ -0,0 +1,56 @@
1
+ import React from "react";
2
+ import { InputField, InputFieldProps } from "./InputField";
3
+ import { useRequiredAppContext } from "./app/ReactApp";
4
+
5
+ /**
6
+ * JSON data input component properties
7
+ */
8
+ export type JsonDataInputProps = Omit<InputFieldProps, "multiple">;
9
+
10
+ /**
11
+ * JSON data input component
12
+ * @param props - Component properties
13
+ * @returns JSX Element
14
+ */
15
+ export function JsonDataInput(props: JsonDataInputProps) {
16
+ // Destruct
17
+ const { onChange, rows = 3, ...rest } = props;
18
+
19
+ // Global app
20
+ const app = useRequiredAppContext();
21
+ const jsonError = app.get("jsonDataError") ?? "JSON format error";
22
+
23
+ // Error message
24
+ const [error, setError] = React.useState<string>();
25
+
26
+ // Layout
27
+ return (
28
+ <InputField
29
+ multiline
30
+ rows={rows}
31
+ {...rest}
32
+ error={!!error}
33
+ helperText={error}
34
+ onChange={(e) => {
35
+ if (onChange) {
36
+ onChange(e);
37
+ if (e.isDefaultPrevented()) return;
38
+ }
39
+
40
+ const json = e.target.value;
41
+ if (json) {
42
+ try {
43
+ JSON.parse(json);
44
+ } catch (e) {
45
+ setError(
46
+ `${jsonError}: ${e instanceof Error ? e.message : String(e)}`
47
+ );
48
+ return;
49
+ }
50
+ }
51
+
52
+ setError(undefined);
53
+ }}
54
+ />
55
+ );
56
+ }
package/src/index.ts CHANGED
@@ -56,6 +56,7 @@ export * from "./CultureDataTable";
56
56
  export * from "./CustomFabProps";
57
57
  export * from "./DataGridEx";
58
58
  export * from "./DataGridRenderers";
59
+ export * from "./DataLoadField";
59
60
  export * from "./DataSteps";
60
61
  export * from "./DataTable";
61
62
  export * from "./DialogButton";
@@ -76,6 +77,7 @@ export * from "./InputField";
76
77
  export * from "./InputTipField";
77
78
  export * from "./IntInputField";
78
79
  export * from "./ItemList";
80
+ export * from "./JsonDataInput";
79
81
  export * from "./LineChart";
80
82
  export * from "./LinkEx";
81
83
  export * from "./ListChooser";