Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bkunyun
Commits
79789509
Commit
79789509
authored
Jul 27, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UI: input DEmo
parent
2f2e8e21
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
0 deletions
+113
-0
MyInputCopy.tsx
src/components/mui/MyInputCopy.tsx
+110
-0
input.tsx
src/views/mui_demo/input.tsx
+3
-0
No files found.
src/components/mui/MyInputCopy.tsx
0 → 100644
View file @
79789509
/*
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-07-05 14:00:37
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-07-21 17:33:59
* @FilePath: /bkunyun/src/components/mui/MyInput.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import
TextField
,
{
TextFieldProps
}
from
"@mui/material/TextField"
;
import
{
ThemeProvider
,
createTheme
}
from
"@mui/material/styles"
;
interface
MyInputProps
extends
Omit
<
TextFieldProps
,
"value"
>
{
value
?:
string
;
variant
?:
"standard"
|
"filled"
|
"outlined"
;
size
?:
"small"
|
"medium"
;
placeholder
?:
string
;
fullWidth
?:
boolean
;
// 宽度是否和容器一致
error
?:
boolean
;
}
const
MyInput
=
(
props
:
MyInputProps
)
=>
{
const
{
size
=
"medium"
,
placeholder
=
"请输入"
,
fullWidth
=
true
,
error
=
false
,
label
,
...
other
}
=
props
;
const
theme
=
createTheme
({
components
:
{
MuiInputBase
:
{
styleOverrides
:
{
root
:
{
height
:
"36px"
,
fontSize
:
"14px"
,
"&.MuiInputBase-sizeSmall"
:
{
height
:
"32px"
,
"& .MuiOutlinedInput-notchedOutline"
:
{
// height: "34px",
},
},
},
},
},
MuiInputLabel
:
{
styleOverrides
:
{
root
:
{
// top: label ? "-5px" : "-10px",
top
:
"-9px"
,
},
shrink
:
{
top
:
0
,
},
sizeSmall
:
{
top
:
"-5px"
,
},
},
},
MuiOutlinedInput
:
{
styleOverrides
:
{
root
:
{
// height: "36px",
// lineHeight: "36px",
// paddingRight: "12px",
"&.Mui-focused .MuiOutlinedInput-notchedOutline"
:
{
borderWidth
:
"1px"
,
},
":hover"
:
{
"& .MuiOutlinedInput-notchedOutline"
:
error
?
{}
:
{
borderColor
:
"#1370ff"
,
},
},
},
input
:
{
padding
:
"6.5px 12px"
,
verticalAlign
:
"middle"
,
},
// focused: {
// "&.MuiOutlinedInput-notchedOutline": {
// borderWidth: "1px",
// },
// },
notchedOutline
:
{
// height: "36px",
},
},
},
// .css-1lkr5rz-MuiInputBase-input-MuiOutlinedInput-input
},
});
return
(
<
ThemeProvider
theme=
{
theme
}
>
<
TextField
error=
{
error
}
size=
{
size
}
placeholder=
{
placeholder
}
fullWidth=
{
fullWidth
}
label=
{
label
}
{
...
other
}
/>
</
ThemeProvider
>
);
};
export
default
MyInput
;
src/views/mui_demo/input.tsx
View file @
79789509
import
{
memo
}
from
"react"
;
import
{
InputAdornment
}
from
"@mui/material"
;
import
InputComponent
from
"@/components/mui/MyInput"
;
// import InputComponent from "@/components/mui/MyInputCopy";
const
ProjectMembers
=
()
=>
{
return
(
...
...
@@ -10,6 +11,7 @@ const ProjectMembers = () => {
label=
{
"test"
}
defaultValue=
{
"sssssssss"
}
/>
<
InputComponent
fullWidth=
{
false
}
defaultValue=
{
"sssssssss"
}
/>
<
InputComponent
fullWidth=
{
false
}
...
...
@@ -33,6 +35,7 @@ const ProjectMembers = () => {
fullWidth=
{
false
}
size=
{
"small"
}
placeholder=
{
"nishuoshenm"
}
label=
{
"asdasfasf"
}
/>
<
br
/>
<
br
/>
<
InputComponent
fullWidth=
{
true
}
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment