@etsoo/materialui 1.6.78 → 1.6.80

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,25 @@
1
+ import React from "react";
2
+ import { InputFieldProps } from "./InputField";
3
+ /**
4
+ * HTML Description component base props
5
+ * HTML 描述组件基础属性
6
+ */
7
+ export type HtmlDescriptionBaseProps = Omit<InputFieldProps, "multiline"> & {
8
+ /**
9
+ * Maximum length of the input
10
+ * 输入的最大长度
11
+ */
12
+ maxLength?: number;
13
+ /**
14
+ * Edit handler
15
+ * 编辑处理器
16
+ */
17
+ onEdit: (input: HTMLInputElement) => void;
18
+ };
19
+ /**
20
+ * HTML Description component base
21
+ * HTML 描述组件属性基础
22
+ * @param props Props
23
+ * @returns Component
24
+ */
25
+ export declare function HtmlDescriptionBase(props: HtmlDescriptionBaseProps): React.JSX.Element;
@@ -0,0 +1,36 @@
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.HtmlDescriptionBase = HtmlDescriptionBase;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = __importDefault(require("react"));
9
+ const InputField_1 = require("./InputField");
10
+ const react_2 = require("@etsoo/react");
11
+ const InputAdornment_1 = __importDefault(require("@mui/material/InputAdornment"));
12
+ const IconButton_1 = __importDefault(require("@mui/material/IconButton"));
13
+ const Edit_1 = __importDefault(require("@mui/icons-material/Edit"));
14
+ /**
15
+ * HTML Description component base
16
+ * HTML 描述组件属性基础
17
+ * @param props Props
18
+ * @returns Component
19
+ */
20
+ function HtmlDescriptionBase(props) {
21
+ // Destruct
22
+ const { fullWidth = true, inputRef, label, maxLength = 1280, name = "description", onEdit, rows = 3, ...rest } = props;
23
+ const localRef = react_1.default.useRef(null);
24
+ const refs = (0, react_2.useCombinedRefs)(localRef, inputRef);
25
+ return ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { fullWidth: fullWidth, inputRef: refs, name: name, slotProps: {
26
+ htmlInput: { maxLength },
27
+ input: {
28
+ endAdornment: ((0, jsx_runtime_1.jsx)(InputAdornment_1.default, { position: "end", children: (0, jsx_runtime_1.jsx)(IconButton_1.default, { edge: "end", onClick: () => {
29
+ const input = localRef.current;
30
+ if (input == null)
31
+ return;
32
+ onEdit(input);
33
+ }, children: (0, jsx_runtime_1.jsx)(Edit_1.default, {}) }) }))
34
+ }
35
+ }, label: label, multiline: true, rows: rows, ...rest }));
36
+ }
@@ -73,6 +73,7 @@ export * from "./GridDataFormat";
73
73
  export * from "./GridUtils";
74
74
  export * from "./HiSelector";
75
75
  export * from "./HiSelectorTL";
76
+ export * from "./HtmlDescriptionBase";
76
77
  export * from "./IconButtonLink";
77
78
  export * from "./ImagePreviewButton";
78
79
  export * from "./InputField";
package/lib/cjs/index.js CHANGED
@@ -93,6 +93,7 @@ __exportStar(require("./GridDataFormat"), exports);
93
93
  __exportStar(require("./GridUtils"), exports);
94
94
  __exportStar(require("./HiSelector"), exports);
95
95
  __exportStar(require("./HiSelectorTL"), exports);
96
+ __exportStar(require("./HtmlDescriptionBase"), exports);
96
97
  __exportStar(require("./IconButtonLink"), exports);
97
98
  __exportStar(require("./ImagePreviewButton"), exports);
98
99
  __exportStar(require("./InputField"), exports);
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { InputFieldProps } from "./InputField";
3
+ /**
4
+ * HTML Description component base props
5
+ * HTML 描述组件基础属性
6
+ */
7
+ export type HtmlDescriptionBaseProps = Omit<InputFieldProps, "multiline"> & {
8
+ /**
9
+ * Maximum length of the input
10
+ * 输入的最大长度
11
+ */
12
+ maxLength?: number;
13
+ /**
14
+ * Edit handler
15
+ * 编辑处理器
16
+ */
17
+ onEdit: (input: HTMLInputElement) => void;
18
+ };
19
+ /**
20
+ * HTML Description component base
21
+ * HTML 描述组件属性基础
22
+ * @param props Props
23
+ * @returns Component
24
+ */
25
+ export declare function HtmlDescriptionBase(props: HtmlDescriptionBaseProps): React.JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { InputField } from "./InputField";
4
+ import { useCombinedRefs } from "@etsoo/react";
5
+ import InputAdornment from "@mui/material/InputAdornment";
6
+ import IconButton from "@mui/material/IconButton";
7
+ import EditIcon from "@mui/icons-material/Edit";
8
+ /**
9
+ * HTML Description component base
10
+ * HTML 描述组件属性基础
11
+ * @param props Props
12
+ * @returns Component
13
+ */
14
+ export function HtmlDescriptionBase(props) {
15
+ // Destruct
16
+ const { fullWidth = true, inputRef, label, maxLength = 1280, name = "description", onEdit, rows = 3, ...rest } = props;
17
+ const localRef = React.useRef(null);
18
+ const refs = useCombinedRefs(localRef, inputRef);
19
+ return (_jsx(InputField, { fullWidth: fullWidth, inputRef: refs, name: name, slotProps: {
20
+ htmlInput: { maxLength },
21
+ input: {
22
+ endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { edge: "end", onClick: () => {
23
+ const input = localRef.current;
24
+ if (input == null)
25
+ return;
26
+ onEdit(input);
27
+ }, children: _jsx(EditIcon, {}) }) }))
28
+ }
29
+ }, label: label, multiline: true, rows: rows, ...rest }));
30
+ }
@@ -73,6 +73,7 @@ export * from "./GridDataFormat";
73
73
  export * from "./GridUtils";
74
74
  export * from "./HiSelector";
75
75
  export * from "./HiSelectorTL";
76
+ export * from "./HtmlDescriptionBase";
76
77
  export * from "./IconButtonLink";
77
78
  export * from "./ImagePreviewButton";
78
79
  export * from "./InputField";
package/lib/mjs/index.js CHANGED
@@ -73,6 +73,7 @@ export * from "./GridDataFormat";
73
73
  export * from "./GridUtils";
74
74
  export * from "./HiSelector";
75
75
  export * from "./HiSelectorTL";
76
+ export * from "./HtmlDescriptionBase";
76
77
  export * from "./IconButtonLink";
77
78
  export * from "./ImagePreviewButton";
78
79
  export * from "./InputField";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.6.78",
3
+ "version": "1.6.80",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -40,16 +40,16 @@
40
40
  "@dnd-kit/react": "^0.5.0",
41
41
  "@emotion/react": "^11.14.0",
42
42
  "@emotion/styled": "^11.14.1",
43
- "@etsoo/appscript": "^1.6.70",
44
- "@etsoo/notificationbase": "^1.1.72",
45
- "@etsoo/react": "^1.8.94",
46
- "@etsoo/shared": "^1.2.87",
43
+ "@etsoo/appscript": "^1.6.71",
44
+ "@etsoo/notificationbase": "^1.1.73",
45
+ "@etsoo/react": "^1.8.95",
46
+ "@etsoo/shared": "^1.2.88",
47
47
  "@mui/icons-material": "^9.2.0",
48
48
  "@mui/material": "^9.2.0",
49
- "@mui/x-data-grid": "^9.8.0",
49
+ "@mui/x-data-grid": "^9.9.0",
50
50
  "chart.js": "^4.5.1",
51
51
  "chartjs-plugin-datalabels": "^2.2.0",
52
- "dompurify": "^3.4.11",
52
+ "dompurify": "^3.4.12",
53
53
  "eventemitter3": "^5.0.4",
54
54
  "pica": "^10.0.2",
55
55
  "pulltorefreshjs": "^0.1.22",
@@ -83,7 +83,7 @@
83
83
  "@vitejs/plugin-react": "^6.0.3",
84
84
  "jsdom": "^29.1.1",
85
85
  "typescript": "^6.0.3",
86
- "vitest": "^4.1.9"
86
+ "vitest": "^4.1.10"
87
87
  },
88
88
  "allowScripts": {
89
89
  "core-js-pure@3.49.0": true
@@ -0,0 +1,79 @@
1
+ import React from "react";
2
+ import { InputField, InputFieldProps } from "./InputField";
3
+ import { useCombinedRefs } from "@etsoo/react";
4
+ import InputAdornment from "@mui/material/InputAdornment";
5
+ import IconButton from "@mui/material/IconButton";
6
+ import EditIcon from "@mui/icons-material/Edit";
7
+
8
+ /**
9
+ * HTML Description component base props
10
+ * HTML 描述组件基础属性
11
+ */
12
+ export type HtmlDescriptionBaseProps = Omit<InputFieldProps, "multiline"> & {
13
+ /**
14
+ * Maximum length of the input
15
+ * 输入的最大长度
16
+ */
17
+ maxLength?: number;
18
+
19
+ /**
20
+ * Edit handler
21
+ * 编辑处理器
22
+ */
23
+ onEdit: (input: HTMLInputElement) => void;
24
+ };
25
+
26
+ /**
27
+ * HTML Description component base
28
+ * HTML 描述组件属性基础
29
+ * @param props Props
30
+ * @returns Component
31
+ */
32
+ export function HtmlDescriptionBase(props: HtmlDescriptionBaseProps) {
33
+ // Destruct
34
+ const {
35
+ fullWidth = true,
36
+ inputRef,
37
+ label,
38
+ maxLength = 1280,
39
+ name = "description",
40
+ onEdit,
41
+ rows = 3,
42
+ ...rest
43
+ } = props;
44
+
45
+ const localRef = React.useRef<HTMLInputElement>(null);
46
+ const refs = useCombinedRefs(localRef, inputRef);
47
+
48
+ return (
49
+ <InputField
50
+ fullWidth={fullWidth}
51
+ inputRef={refs}
52
+ name={name}
53
+ slotProps={{
54
+ htmlInput: { maxLength },
55
+ input: {
56
+ endAdornment: (
57
+ <InputAdornment position="end">
58
+ <IconButton
59
+ edge="end"
60
+ onClick={() => {
61
+ const input = localRef.current;
62
+ if (input == null) return;
63
+
64
+ onEdit(input);
65
+ }}
66
+ >
67
+ <EditIcon />
68
+ </IconButton>
69
+ </InputAdornment>
70
+ )
71
+ }
72
+ }}
73
+ label={label}
74
+ multiline
75
+ rows={rows}
76
+ {...rest}
77
+ />
78
+ );
79
+ }
package/src/index.ts CHANGED
@@ -80,6 +80,7 @@ export * from "./GridDataFormat";
80
80
  export * from "./GridUtils";
81
81
  export * from "./HiSelector";
82
82
  export * from "./HiSelectorTL";
83
+ export * from "./HtmlDescriptionBase";
83
84
  export * from "./IconButtonLink";
84
85
  export * from "./ImagePreviewButton";
85
86
  export * from "./InputField";