mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
chore: unified code style (#55406)
This commit is contained in:
@@ -20,7 +20,9 @@
|
|||||||
|
|
||||||
const isEnabled = always || enabledCondition.every(Boolean);
|
const isEnabled = always || enabledCondition.every(Boolean);
|
||||||
|
|
||||||
if (!isEnabled) return;
|
if (!isEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const prefixCls = 'antd-mirror-notify';
|
const prefixCls = 'antd-mirror-notify';
|
||||||
const primaryColor = '#1677ff';
|
const primaryColor = '#1677ff';
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ jobs:
|
|||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
|
||||||
for (const issue of issues) {
|
for (const issue of issues) {
|
||||||
if (issue.pull_request) continue;
|
if (issue.pull_request) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const updatedAt = new Date(issue.updated_at);
|
const updatedAt = new Date(issue.updated_at);
|
||||||
const daysInactive = (now - updatedAt) / (1000 * 60 * 60 * 24);
|
const daysInactive = (now - updatedAt) / (1000 * 60 * 60 * 24);
|
||||||
|
|||||||
@@ -176,7 +176,9 @@ const Alert = React.forwardRef<AlertRef, AlertProps>((props, ref) => {
|
|||||||
|
|
||||||
// closeable when closeText or closeIcon is assigned
|
// closeable when closeText or closeIcon is assigned
|
||||||
const isClosable = React.useMemo<boolean>(() => {
|
const isClosable = React.useMemo<boolean>(() => {
|
||||||
if (typeof closable === 'object' && closable.closeIcon) return true;
|
if (typeof closable === 'object' && closable.closeIcon) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (closeText) {
|
if (closeText) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,8 +65,12 @@ const App: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const cellRender: CalendarProps<Dayjs>['cellRender'] = (current, info) => {
|
const cellRender: CalendarProps<Dayjs>['cellRender'] = (current, info) => {
|
||||||
if (info.type === 'date') return dateCellRender(current);
|
if (info.type === 'date') {
|
||||||
if (info.type === 'month') return monthCellRender(current);
|
return dateCellRender(current);
|
||||||
|
}
|
||||||
|
if (info.type === 'month') {
|
||||||
|
return monthCellRender(current);
|
||||||
|
}
|
||||||
return info.originNode;
|
return info.originNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,12 @@ const PickerWithType = ({
|
|||||||
type: PickerType;
|
type: PickerType;
|
||||||
onChange: TimePickerProps['onChange'] | DatePickerProps['onChange'];
|
onChange: TimePickerProps['onChange'] | DatePickerProps['onChange'];
|
||||||
}) => {
|
}) => {
|
||||||
if (type === 'time') return <TimePicker onChange={onChange} />;
|
if (type === 'time') {
|
||||||
if (type === 'date') return <DatePicker onChange={onChange} />;
|
return <TimePicker onChange={onChange} />;
|
||||||
|
}
|
||||||
|
if (type === 'date') {
|
||||||
|
return <DatePicker onChange={onChange} />;
|
||||||
|
}
|
||||||
return <DatePicker picker={type} onChange={onChange} />;
|
return <DatePicker picker={type} onChange={onChange} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ const formItemNameBlackList = ['parentNode'];
|
|||||||
const defaultItemNamePrefixCls: string = 'form_item';
|
const defaultItemNamePrefixCls: string = 'form_item';
|
||||||
|
|
||||||
export function toArray<T>(candidate?: T | T[] | false): T[] {
|
export function toArray<T>(candidate?: T | T[] | false): T[] {
|
||||||
if (candidate === undefined || candidate === false) return [];
|
if (candidate === undefined || candidate === false) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
return Array.isArray(candidate) ? candidate : [candidate];
|
return Array.isArray(candidate) ? candidate : [candidate];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,9 @@ const App: React.FC = () => {
|
|||||||
fetch(`https://api.github.com/search/users?q=${key}`)
|
fetch(`https://api.github.com/search/users?q=${key}`)
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.then(({ items = [] }) => {
|
.then(({ items = [] }) => {
|
||||||
if (ref.current !== key) return;
|
if (ref.current !== key) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
setUsers(items.slice(0, 10));
|
setUsers(items.slice(0, 10));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ const App: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const remove = (targetKey: TargetKey) => {
|
const remove = (targetKey: TargetKey) => {
|
||||||
if (!items) return;
|
if (!items) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const targetIndex = items.findIndex((item) => item.key === targetKey);
|
const targetIndex = items.findIndex((item) => item.key === targetKey);
|
||||||
const newItems = items.filter((item) => item.key !== targetKey);
|
const newItems = items.filter((item) => item.key !== targetKey);
|
||||||
|
|
||||||
|
|||||||
@@ -22,13 +22,23 @@ const TimelineItemList: React.FC<TimelineProps & { hashId: string; direction?: s
|
|||||||
}) => {
|
}) => {
|
||||||
const getPositionCls = (position: string, idx: number) => {
|
const getPositionCls = (position: string, idx: number) => {
|
||||||
if (mode === 'alternate') {
|
if (mode === 'alternate') {
|
||||||
if (position === 'right') return `${prefixCls}-item-right`;
|
if (position === 'right') {
|
||||||
if (position === 'left') return `${prefixCls}-item-left`;
|
return `${prefixCls}-item-right`;
|
||||||
|
}
|
||||||
|
if (position === 'left') {
|
||||||
|
return `${prefixCls}-item-left`;
|
||||||
|
}
|
||||||
return idx % 2 === 0 ? `${prefixCls}-item-left` : `${prefixCls}-item-right`;
|
return idx % 2 === 0 ? `${prefixCls}-item-left` : `${prefixCls}-item-right`;
|
||||||
}
|
}
|
||||||
if (mode === 'left') return `${prefixCls}-item-left`;
|
if (mode === 'left') {
|
||||||
if (mode === 'right') return `${prefixCls}-item-right`;
|
return `${prefixCls}-item-left`;
|
||||||
if (position === 'right') return `${prefixCls}-item-right`;
|
}
|
||||||
|
if (mode === 'right') {
|
||||||
|
return `${prefixCls}-item-right`;
|
||||||
|
}
|
||||||
|
if (position === 'right') {
|
||||||
|
return `${prefixCls}-item-right`;
|
||||||
|
}
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
const mergedItems = [...(items || [])];
|
const mergedItems = [...(items || [])];
|
||||||
|
|||||||
@@ -76,8 +76,9 @@ const Editable: React.FC<EditableProps> = (props) => {
|
|||||||
|
|
||||||
const onKeyDown: React.KeyboardEventHandler<HTMLTextAreaElement> = ({ keyCode }) => {
|
const onKeyDown: React.KeyboardEventHandler<HTMLTextAreaElement> = ({ keyCode }) => {
|
||||||
// We don't record keyCode when IME is using
|
// We don't record keyCode when IME is using
|
||||||
if (inComposition.current) return;
|
if (inComposition.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
lastKeyCode.current = keyCode;
|
lastKeyCode.current = keyCode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -249,7 +249,9 @@ export default function Page() {
|
|||||||
queryClient.invalidateQueries({ queryKey: ['products'] });
|
queryClient.invalidateQueries({ queryKey: ['products'] });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (productsQuery.isLoading) return null;
|
if (productsQuery.isLoading) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1 className={styles.title}>Page products</h1>
|
<h1 className={styles.title}>Page products</h1>
|
||||||
|
|||||||
@@ -249,7 +249,9 @@ export default function Page() {
|
|||||||
queryClient.invalidateQueries({ queryKey: ['products'] });
|
queryClient.invalidateQueries({ queryKey: ['products'] });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (productsQuery.isLoading) return null;
|
if (productsQuery.isLoading) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1 className={styles.title}>Page products</h1>
|
<h1 className={styles.title}>Page products</h1>
|
||||||
|
|||||||
Reference in New Issue
Block a user