chore: resource list
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
:local(.wrapper) {
|
||||
@wrapheight: 54px;
|
||||
@inputheight: 32px;
|
||||
@borderRadius: 24px;
|
||||
@borderRadius: 20px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -13,6 +13,12 @@
|
||||
border-radius: @borderRadius;
|
||||
padding-inline: 12px;
|
||||
padding-block: 20px 0;
|
||||
.extra {
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
top: 8px;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
&.seal-input-wrapper-disabled {
|
||||
background-color: var(--ant-color-bg-container-disabled);
|
||||
|
||||
@@ -11,6 +11,7 @@ interface WrapperProps {
|
||||
description?: React.ReactNode;
|
||||
className?: string;
|
||||
disabled?: boolean;
|
||||
extra?: React.ReactNode;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
@@ -23,6 +24,7 @@ const Wrapper: React.FC<WrapperProps> = ({
|
||||
disabled,
|
||||
description,
|
||||
required,
|
||||
extra,
|
||||
onClick
|
||||
}) => {
|
||||
return (
|
||||
@@ -50,6 +52,7 @@ const Wrapper: React.FC<WrapperProps> = ({
|
||||
description={description}
|
||||
></LabelInfo>
|
||||
</label>
|
||||
{extra && <div className={wrapperStyle.extra}>{extra}</div>}
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -7,10 +7,21 @@ import { SealFormItemProps } from './types';
|
||||
const SealInputNumber: React.FC<InputNumberProps & SealFormItemProps> = (
|
||||
props
|
||||
) => {
|
||||
const { label, placeholder, required, description, ...rest } = props;
|
||||
const {
|
||||
label,
|
||||
placeholder,
|
||||
required,
|
||||
description,
|
||||
isInFormItems = true,
|
||||
...rest
|
||||
} = props;
|
||||
const [isFocus, setIsFocus] = useState(false);
|
||||
const inputRef = useRef<any>(null);
|
||||
const { status } = Form.Item.useStatus();
|
||||
let status = '';
|
||||
if (isInFormItems) {
|
||||
const statusData = Form?.Item?.useStatus?.();
|
||||
status = statusData?.status || '';
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (props.value) {
|
||||
|
||||
@@ -16,10 +16,21 @@ type OnSearch = (
|
||||
) => void;
|
||||
|
||||
const SealInputSearch: React.FC<SearchProps & SealFormItemProps> = (props) => {
|
||||
const { label, placeholder, required, description, ...rest } = props;
|
||||
const {
|
||||
label,
|
||||
placeholder,
|
||||
required,
|
||||
description,
|
||||
isInFormItems = true,
|
||||
...rest
|
||||
} = props;
|
||||
const [isFocus, setIsFocus] = useState(false);
|
||||
const inputRef = useRef<any>(null);
|
||||
const { status } = Form.Item.useStatus();
|
||||
let status = '';
|
||||
if (isInFormItems) {
|
||||
const statusData = Form?.Item?.useStatus?.();
|
||||
status = statusData?.status || '';
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (props.value) {
|
||||
|
||||
@@ -5,10 +5,21 @@ import Wrapper from './components/wrapper';
|
||||
import { SealFormItemProps } from './types';
|
||||
|
||||
const SealPassword: React.FC<InputProps & SealFormItemProps> = (props) => {
|
||||
const { label, placeholder, required, description, ...rest } = props;
|
||||
const {
|
||||
label,
|
||||
placeholder,
|
||||
required,
|
||||
description,
|
||||
isInFormItems = true,
|
||||
...rest
|
||||
} = props;
|
||||
const [isFocus, setIsFocus] = useState(false);
|
||||
const inputRef = useRef<any>(null);
|
||||
const { status } = Form.Item.useStatus();
|
||||
let status = '';
|
||||
if (isInFormItems) {
|
||||
const statusData = Form?.Item?.useStatus?.();
|
||||
status = statusData?.status || '';
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (props.value) {
|
||||
|
||||
@@ -18,12 +18,19 @@ const SealTextArea: React.FC<TextAreaProps & SealFormItemProps> = (props) => {
|
||||
onInput,
|
||||
style,
|
||||
required,
|
||||
isInFormItems = true,
|
||||
description,
|
||||
variant,
|
||||
extra,
|
||||
...rest
|
||||
} = props;
|
||||
const [isFocus, setIsFocus] = useState(false);
|
||||
const inputRef = useRef<any>(null);
|
||||
const { status } = Form.Item.useStatus();
|
||||
let status = '';
|
||||
if (isInFormItems) {
|
||||
const statusData = Form?.Item?.useStatus?.();
|
||||
status = statusData?.status || '';
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (props.value) {
|
||||
@@ -57,7 +64,11 @@ const SealTextArea: React.FC<TextAreaProps & SealFormItemProps> = (props) => {
|
||||
|
||||
const handleOnBlur = useCallback(
|
||||
(e: any) => {
|
||||
if (!inputRef.current?.input?.value) {
|
||||
console.log(
|
||||
'inputRef.current==========',
|
||||
inputRef.current?.resizableTextArea?.textArea?.value
|
||||
);
|
||||
if (!inputRef.current?.resizableTextArea?.textArea?.value) {
|
||||
setIsFocus(false);
|
||||
onBlur?.(e);
|
||||
}
|
||||
@@ -80,6 +91,8 @@ const SealTextArea: React.FC<TextAreaProps & SealFormItemProps> = (props) => {
|
||||
required={required}
|
||||
description={description}
|
||||
className="seal-textarea-wrapper"
|
||||
variant={variant}
|
||||
extra={extra}
|
||||
disabled={props.disabled}
|
||||
onClick={handleClickWrapper}
|
||||
>
|
||||
@@ -98,10 +111,21 @@ const SealTextArea: React.FC<TextAreaProps & SealFormItemProps> = (props) => {
|
||||
};
|
||||
|
||||
const SealInput: React.FC<InputProps & SealFormItemProps> = (props) => {
|
||||
const { label, placeholder, required, description, ...rest } = props;
|
||||
const {
|
||||
label,
|
||||
placeholder,
|
||||
required,
|
||||
description,
|
||||
isInFormItems = true,
|
||||
...rest
|
||||
} = props;
|
||||
const [isFocus, setIsFocus] = useState(false);
|
||||
const inputRef = useRef<any>(null);
|
||||
const { status } = Form.Item.useStatus();
|
||||
let status = '';
|
||||
if (isInFormItems) {
|
||||
const statusData = Form?.Item?.useStatus?.();
|
||||
status = statusData?.status || '';
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (props.value) {
|
||||
|
||||
@@ -6,11 +6,22 @@ import Wrapper from './components/wrapper';
|
||||
import { SealFormItemProps } from './types';
|
||||
|
||||
const SealSelect: React.FC<SelectProps & SealFormItemProps> = (props) => {
|
||||
const { label, placeholder, children, required, description, ...rest } =
|
||||
props;
|
||||
const {
|
||||
label,
|
||||
placeholder,
|
||||
children,
|
||||
required,
|
||||
description,
|
||||
isInFormItems = true,
|
||||
...rest
|
||||
} = props;
|
||||
const [isFocus, setIsFocus] = useState(false);
|
||||
const inputRef = useRef<any>(null);
|
||||
const { status } = Form.Item.useStatus();
|
||||
let status = '';
|
||||
if (isInFormItems) {
|
||||
const statusData = Form?.Item?.useStatus?.();
|
||||
status = statusData?.status || '';
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (isNotEmptyValue(props.value)) {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import React from 'react';
|
||||
|
||||
export interface SealFormItemProps {
|
||||
label?: string;
|
||||
label?: React.ReactNode;
|
||||
required?: boolean;
|
||||
isInFormItems?: boolean;
|
||||
description?: React.ReactNode;
|
||||
extra?: React.ReactNode;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
.transition-wrapper {
|
||||
border-radius: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
&.bordered {
|
||||
border-width: var(--ant-line-width);
|
||||
border-style: var(--ant-line-type);
|
||||
border-color: var(--ant-color-border);
|
||||
background-color: var(--color-white-1);
|
||||
}
|
||||
&.filled {
|
||||
border-color: var(--ant-color-border);
|
||||
.content-wrapper {
|
||||
background-color: var(--color-fill-1);
|
||||
}
|
||||
}
|
||||
.header {
|
||||
background-color: var(--color-fill-1);
|
||||
cursor: pointer;
|
||||
padding: 8px 16px;
|
||||
}
|
||||
|
||||
.content-wrapper {
|
||||
overflow: hidden;
|
||||
transition: height 300ms ease-in-out;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
import classNames from 'classnames';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import './index.less';
|
||||
|
||||
interface TransitionWrapProps {
|
||||
minHeight?: number;
|
||||
header?: React.ReactNode;
|
||||
variant?: 'bordered' | 'filled';
|
||||
children: React.ReactNode;
|
||||
}
|
||||
const TransitionWrapper: React.FC<TransitionWrapProps> = (props) => {
|
||||
const { minHeight = 50, header, variant = 'bordered', children } = props;
|
||||
const [isOpen, setIsOpen] = useState(true);
|
||||
const [height, setHeight] = useState(0);
|
||||
const contentRef = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen) {
|
||||
setHeight(contentRef?.current?.scrollHeight);
|
||||
} else {
|
||||
setHeight(0);
|
||||
}
|
||||
}, [isOpen]);
|
||||
|
||||
const toggleOpen = () => {
|
||||
setIsOpen(!isOpen);
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classNames('transition-wrapper', {
|
||||
bordered: variant === 'bordered',
|
||||
filled: variant === 'filled'
|
||||
})}
|
||||
>
|
||||
<div
|
||||
onClick={toggleOpen}
|
||||
className="header"
|
||||
style={{
|
||||
height: minHeight
|
||||
}}
|
||||
>
|
||||
{header}
|
||||
</div>
|
||||
<div
|
||||
className="content-wrapper"
|
||||
style={{ height: height }}
|
||||
ref={contentRef}
|
||||
>
|
||||
<div className="content">{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default TransitionWrapper;
|
||||
Reference in New Issue
Block a user