mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 19:19:26 +08:00
Merge branch 'feature' into master-merge-feature
This commit is contained in:
commit
596d24e4e5
11
.github/workflows/test.yml
vendored
11
.github/workflows/test.yml
vendored
@ -138,7 +138,7 @@ jobs:
|
|||||||
key: dist-${{ github.sha }}
|
key: dist-${{ github.sha }}
|
||||||
|
|
||||||
- name: dist
|
- name: dist
|
||||||
run: npm run dist
|
run: CI=1 npm run dist
|
||||||
env:
|
env:
|
||||||
NODE_OPTIONS: --max_old_space_size=4096
|
NODE_OPTIONS: --max_old_space_size=4096
|
||||||
needs: setup
|
needs: setup
|
||||||
@ -236,6 +236,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
react: ['16', '17', '18']
|
react: ['16', '17', '18']
|
||||||
module: ['dom', 'node', 'dist']
|
module: ['dom', 'node', 'dist']
|
||||||
|
shard: ['1/4', '2/4', '3/4', '4/4']
|
||||||
env:
|
env:
|
||||||
REACT: ${{ matrix.react }}
|
REACT: ${{ matrix.react }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -288,12 +289,11 @@ jobs:
|
|||||||
# dom test
|
# dom test
|
||||||
- name: dom test
|
- name: dom test
|
||||||
if: ${{ matrix.module == 'dom' }}
|
if: ${{ matrix.module == 'dom' }}
|
||||||
run: npm test -- -w 1 --coverage
|
run: npm test -- --maxWorkers=2 --shard=${{matrix.shard}} --coverage
|
||||||
|
|
||||||
# > 17 only
|
|
||||||
- name: coverage
|
- name: coverage
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
if: ${{ matrix.module == 'dom' && matrix.react == '17' }}
|
if: ${{ matrix.module == 'dom' && matrix.react == '17' }}
|
||||||
run: bash <(curl -s https://codecov.io/bash)
|
|
||||||
|
|
||||||
# node test
|
# node test
|
||||||
- name: node test
|
- name: node test
|
||||||
@ -353,6 +353,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
react: ['16', '17', '18']
|
react: ['16', '17', '18']
|
||||||
module: [lib, es]
|
module: [lib, es]
|
||||||
|
shard: ['1/4', '2/4', '3/4', '4/4']
|
||||||
env:
|
env:
|
||||||
REACT: ${{ matrix.react }}
|
REACT: ${{ matrix.react }}
|
||||||
steps:
|
steps:
|
||||||
@ -400,7 +401,7 @@ jobs:
|
|||||||
- name: test
|
- name: test
|
||||||
# lib only run in master branch not in pull request
|
# lib only run in master branch not in pull request
|
||||||
if: ${{ github.event_name != 'pull_request' || matrix.module != 'lib' }}
|
if: ${{ github.event_name != 'pull_request' || matrix.module != 'lib' }}
|
||||||
run: npm test
|
run: npm test -- --maxWorkers=2 --shard=${{matrix.shard}}
|
||||||
env:
|
env:
|
||||||
LIB_DIR: ${{ matrix.module }}
|
LIB_DIR: ${{ matrix.module }}
|
||||||
needs: compile
|
needs: compile
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
The simplest usage.
|
The simplest usage.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { Affix, Button } from 'antd';
|
import { Affix, Button } from 'antd';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const [top, setTop] = useState(10);
|
const [top, setTop] = useState(10);
|
||||||
|
@ -15,8 +15,8 @@ DEBUG
|
|||||||
DEBUG
|
DEBUG
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { Affix, Button } from 'antd';
|
import { Affix, Button } from 'antd';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const [top, setTop] = useState(10);
|
const [top, setTop] = useState(10);
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Callback with affixed state.
|
Callback with affixed state.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Affix, Button } from 'antd';
|
import { Affix, Button } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<Affix offsetTop={120} onChange={affixed => console.log(affixed)}>
|
<Affix offsetTop={120} onChange={affixed => console.log(affixed)}>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Set a `target` for 'Affix', which is listen to scroll event of target element (default is `window`).
|
Set a `target` for 'Affix', which is listen to scroll event of target element (default is `window`).
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { Affix, Button } from 'antd';
|
import { Affix, Button } from 'antd';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const [container, setContainer] = useState<HTMLDivElement | null>(null);
|
const [container, setContainer] = useState<HTMLDivElement | null>(null);
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Custom action.
|
Custom action.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Alert, Button, Space } from 'antd';
|
import { Alert, Button, Space } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -15,8 +15,8 @@ title:
|
|||||||
Display Alert as a banner at top of page.
|
Display Alert as a banner at top of page.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Alert } from 'antd';
|
import { Alert } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
The simplest usage for short messages.
|
The simplest usage for short messages.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Alert } from 'antd';
|
import { Alert } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => <Alert message="Success Text" type="success" />;
|
const App: React.FC = () => <Alert message="Success Text" type="success" />;
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
To show close button.
|
To show close button.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Alert } from 'antd';
|
import { Alert } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const onClose = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
const onClose = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
||||||
console.log(e, 'I was closed.');
|
console.log(e, 'I was closed.');
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Replace the default icon with customized text.
|
Replace the default icon with customized text.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Alert } from 'antd';
|
import { Alert } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => <Alert message="Info Text" type="info" closeText="Close Now" />;
|
const App: React.FC = () => <Alert message="Info Text" type="info" closeText="Close Now" />;
|
||||||
|
|
||||||
|
@ -15,9 +15,9 @@ title:
|
|||||||
A relevant icon makes information clearer and more friendly.
|
A relevant icon makes information clearer and more friendly.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Alert } from 'antd';
|
|
||||||
import { SmileOutlined } from '@ant-design/icons';
|
import { SmileOutlined } from '@ant-design/icons';
|
||||||
|
import { Alert } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const icon = <SmileOutlined />;
|
const icon = <SmileOutlined />;
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Additional description for alert message.
|
Additional description for alert message.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Alert } from 'antd';
|
import { Alert } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
ErrorBoundary Component for making error handling easier in [React](https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html).
|
ErrorBoundary Component for making error handling easier in [React](https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html).
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
|
import { Alert, Button } from 'antd';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Button, Alert } from 'antd';
|
|
||||||
|
|
||||||
const { ErrorBoundary } = Alert;
|
const { ErrorBoundary } = Alert;
|
||||||
const ThrowError: React.FC = () => {
|
const ThrowError: React.FC = () => {
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
A relevant icon will make information clearer and more friendly.
|
A relevant icon will make information clearer and more friendly.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Alert } from 'antd';
|
import { Alert } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,10 +14,10 @@ title:
|
|||||||
Show a loop banner by using with [react-text-loop-next](https://npmjs.com/package/react-text-loop-next) or [react-fast-marquee](https://npmjs.com/package/react-fast-marquee).
|
Show a loop banner by using with [react-text-loop-next](https://npmjs.com/package/react-text-loop-next) or [react-fast-marquee](https://npmjs.com/package/react-fast-marquee).
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Alert } from 'antd';
|
import { Alert } from 'antd';
|
||||||
import { TextLoop } from 'react-text-loop-next';
|
import React from 'react';
|
||||||
import Marquee from 'react-fast-marquee';
|
import Marquee from 'react-fast-marquee';
|
||||||
|
import { TextLoop } from 'react-text-loop-next';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Smoothly unmount Alert upon close.
|
Smoothly unmount Alert upon close.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { Alert } from 'antd';
|
import { Alert } from 'antd';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const [visible, setVisible] = useState(true);
|
const [visible, setVisible] = useState(true);
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
There are 4 types of Alert: `success`, `info`, `warning`, `error`.
|
There are 4 types of Alert: `success`, `info`, `warning`, `error`.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Alert } from 'antd';
|
import { Alert } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
The simplest usage.
|
The simplest usage.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Anchor } from 'antd';
|
import { Anchor } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const { Link } = Anchor;
|
const { Link } = Anchor;
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Customize the anchor highlight.
|
Customize the anchor highlight.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Anchor } from 'antd';
|
import { Anchor } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const { Link } = Anchor;
|
const { Link } = Anchor;
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Listening for anchor link change.
|
Listening for anchor link change.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Anchor } from 'antd';
|
import { Anchor } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const { Link } = Anchor;
|
const { Link } = Anchor;
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Clicking on an anchor does not record history.
|
Clicking on an anchor does not record history.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Anchor } from 'antd';
|
import { Anchor } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const { Link } = Anchor;
|
const { Link } = Anchor;
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Do not change state when page is scrolling.
|
Do not change state when page is scrolling.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Anchor } from 'antd';
|
import { Anchor } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const { Link } = Anchor;
|
const { Link } = Anchor;
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Anchor target scroll to screen center.
|
Anchor target scroll to screen center.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState, useEffect } from 'react';
|
|
||||||
import { Anchor } from 'antd';
|
import { Anchor } from 'antd';
|
||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
|
||||||
const { Link } = Anchor;
|
const { Link } = Anchor;
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Basic Usage, set data source of autocomplete with `options` property.
|
Basic Usage, set data source of autocomplete with `options` property.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { AutoComplete } from 'antd';
|
import { AutoComplete } from 'antd';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const mockVal = (str: string, repeat = 1) => ({
|
const mockVal = (str: string, repeat = 1) => ({
|
||||||
value: str.repeat(repeat),
|
value: str.repeat(repeat),
|
||||||
|
@ -14,9 +14,9 @@ title:
|
|||||||
Demonstration of [Lookup Patterns: Certain Category](https://ant.design/docs/spec/reaction#Lookup-Patterns). Basic Usage, set options of autocomplete with `options` property.
|
Demonstration of [Lookup Patterns: Certain Category](https://ant.design/docs/spec/reaction#Lookup-Patterns). Basic Usage, set options of autocomplete with `options` property.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Input, AutoComplete } from 'antd';
|
|
||||||
import { UserOutlined } from '@ant-design/icons';
|
import { UserOutlined } from '@ant-design/icons';
|
||||||
|
import { AutoComplete, Input } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const renderTitle = (title: string) => (
|
const renderTitle = (title: string) => (
|
||||||
<span>
|
<span>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Customize Input Component
|
Customize Input Component
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { AutoComplete, Input } from 'antd';
|
import { AutoComplete, Input } from 'antd';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const { TextArea } = Input;
|
const { TextArea } = Input;
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@ debug: true
|
|||||||
---
|
---
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Input, AutoComplete, Form, TreeSelect, Button } from 'antd';
|
|
||||||
import { SearchOutlined } from '@ant-design/icons';
|
import { SearchOutlined } from '@ant-design/icons';
|
||||||
|
import { AutoComplete, Button, Form, Input, TreeSelect } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const formItemLayout = {
|
const formItemLayout = {
|
||||||
labelCol: {
|
labelCol: {
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
A non-case-sensitive AutoComplete
|
A non-case-sensitive AutoComplete
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { AutoComplete } from 'antd';
|
import { AutoComplete } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const options = [
|
const options = [
|
||||||
{ value: 'Burns Bay Road' },
|
{ value: 'Burns Bay Road' },
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
You could pass `AutoComplete.Option` as children of `AutoComplete`, instead of using `options`。
|
You could pass `AutoComplete.Option` as children of `AutoComplete`, instead of using `options`。
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { AutoComplete } from 'antd';
|
import { AutoComplete } from 'antd';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const { Option } = AutoComplete;
|
const { Option } = AutoComplete;
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ title:
|
|||||||
Add status to AutoComplete with `status`, which could be `error` or `warning`.
|
Add status to AutoComplete with `status`, which could be `error` or `warning`.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { AutoComplete, Space } from 'antd';
|
import { AutoComplete, Space } from 'antd';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const mockVal = (str: string, repeat = 1) => ({
|
const mockVal = (str: string, repeat = 1) => ({
|
||||||
value: str.repeat(repeat),
|
value: str.repeat(repeat),
|
||||||
|
@ -14,9 +14,9 @@ title:
|
|||||||
Demonstration of [Lookup Patterns: Uncertain Category](https://ant.design/docs/spec/reaction#Lookup-Patterns).
|
Demonstration of [Lookup Patterns: Uncertain Category](https://ant.design/docs/spec/reaction#Lookup-Patterns).
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
import { AutoComplete, Input } from 'antd';
|
||||||
import { Input, AutoComplete } from 'antd';
|
|
||||||
import type { SelectProps } from 'antd/es/select';
|
import type { SelectProps } from 'antd/es/select';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const getRandomInt = (max: number, min = 0) => Math.floor(Math.random() * (max - min + 1)) + min;
|
const getRandomInt = (max: number, min = 0) => Math.floor(Math.random() * (max - min + 1)) + min;
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ title:
|
|||||||
Usually used for reminders and notifications.
|
Usually used for reminders and notifications.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Avatar, Badge } from 'antd';
|
|
||||||
import { UserOutlined } from '@ant-design/icons';
|
import { UserOutlined } from '@ant-design/icons';
|
||||||
|
import { Avatar, Badge } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,9 +14,9 @@ title:
|
|||||||
Three sizes and two shapes are available.
|
Three sizes and two shapes are available.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Avatar } from 'antd';
|
|
||||||
import { UserOutlined } from '@ant-design/icons';
|
import { UserOutlined } from '@ant-design/icons';
|
||||||
|
import { Avatar } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
For letter type Avatar, when the letters are too long to display, the font size can be automatically adjusted according to the width of the Avatar. You can also use `gap` to set the unit distance between left and right sides.
|
For letter type Avatar, when the letters are too long to display, the font size can be automatically adjusted according to the width of the Avatar. You can also use `gap` to set the unit distance between left and right sides.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { Avatar, Button } from 'antd';
|
import { Avatar, Button } from 'antd';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const UserList = ['U', 'Lucy', 'Tom', 'Edward'];
|
const UserList = ['U', 'Lucy', 'Tom', 'Edward'];
|
||||||
const ColorList = ['#f56a00', '#7265e6', '#ffbf00', '#00a2ae'];
|
const ColorList = ['#f56a00', '#7265e6', '#ffbf00', '#00a2ae'];
|
||||||
|
@ -15,8 +15,8 @@ debug: true
|
|||||||
图片不存在时,如果 `src` 本身是个 ReactElement,会尝试回退到 `src`,否则尝试回退到 `icon`,最后回退到显示 `children`。
|
图片不存在时,如果 `src` 本身是个 ReactElement,会尝试回退到 `src`,否则尝试回退到 `icon`,最后回退到显示 `children`。
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Avatar } from 'antd';
|
import { Avatar } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,9 +14,9 @@ title:
|
|||||||
Avatar group display.
|
Avatar group display.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
import { AntDesignOutlined, UserOutlined } from '@ant-design/icons';
|
||||||
import { Avatar, Divider, Tooltip } from 'antd';
|
import { Avatar, Divider, Tooltip } from 'antd';
|
||||||
import { UserOutlined, AntDesignOutlined } from '@ant-design/icons';
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,9 +14,9 @@ title:
|
|||||||
Avatar size can be automatically adjusted based on the screen size.
|
Avatar size can be automatically adjusted based on the screen size.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Avatar } from 'antd';
|
|
||||||
import { AntDesignOutlined } from '@ant-design/icons';
|
import { AntDesignOutlined } from '@ant-design/icons';
|
||||||
|
import { Avatar } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<Avatar
|
<Avatar
|
||||||
|
@ -15,8 +15,8 @@ debug: true
|
|||||||
Text inside Avatar should be set a proper font size when toggle it's visibility.
|
Text inside Avatar should be set a proper font size when toggle it's visibility.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { Avatar, Button } from 'antd';
|
import { Avatar, Button } from 'antd';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
type SizeType = 'large' | 'small' | 'default' | number;
|
type SizeType = 'large' | 'small' | 'default' | number;
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ title:
|
|||||||
Image, Icon and letter are supported, and the latter two kinds of avatar can have custom colors and background colors.
|
Image, Icon and letter are supported, and the latter two kinds of avatar can have custom colors and background colors.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Avatar, Image } from 'antd';
|
|
||||||
import { UserOutlined } from '@ant-design/icons';
|
import { UserOutlined } from '@ant-design/icons';
|
||||||
|
import { Avatar, Image } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
The most basic usage.
|
The most basic usage.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { BackTop } from 'antd';
|
import { BackTop } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -19,8 +19,8 @@ You can customize the style of the button, just note the size limit: no more tha
|
|||||||
> Note: `BackTop` expects a element could accept `onClick` propety as children. If you put a text directly as children the component will not function properly.
|
> Note: `BackTop` expects a element could accept `onClick` propety as children. If you put a text directly as children the component will not function properly.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { BackTop } from 'antd';
|
import { BackTop } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const style: React.CSSProperties = {
|
const style: React.CSSProperties = {
|
||||||
height: 40,
|
height: 40,
|
||||||
|
@ -14,9 +14,9 @@ title:
|
|||||||
Simplest Usage. Badge will be hidden when `count` is `0`, but we can use `showZero` to show it.
|
Simplest Usage. Badge will be hidden when `count` is `0`, but we can use `showZero` to show it.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Badge, Avatar } from 'antd';
|
|
||||||
import { ClockCircleOutlined } from '@ant-design/icons';
|
import { ClockCircleOutlined } from '@ant-design/icons';
|
||||||
|
import { Avatar, Badge } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,9 +14,9 @@ title:
|
|||||||
The count will be animated as it changes.
|
The count will be animated as it changes.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { Badge, Button, Switch, Divider, Avatar } from 'antd';
|
|
||||||
import { MinusOutlined, PlusOutlined, QuestionOutlined } from '@ant-design/icons';
|
import { MinusOutlined, PlusOutlined, QuestionOutlined } from '@ant-design/icons';
|
||||||
|
import { Avatar, Badge, Button, Divider, Switch } from 'antd';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const ButtonGroup = Button.Group;
|
const ButtonGroup = Button.Group;
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
We preset a series of colorful Badge styles for use in different situations. You can also set it to a hex color string for custom color.
|
We preset a series of colorful Badge styles for use in different situations. You can also set it to a hex color string for custom color.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Badge, Divider } from 'antd';
|
import { Badge, Divider } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const colors = [
|
const colors = [
|
||||||
'pink',
|
'pink',
|
||||||
|
@ -14,9 +14,9 @@ title:
|
|||||||
This will simply display a red badge, without a specific count. If count equals 0, it won't display the dot.
|
This will simply display a red badge, without a specific count. If count equals 0, it won't display the dot.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Badge } from 'antd';
|
|
||||||
import { NotificationOutlined } from '@ant-design/icons';
|
import { NotificationOutlined } from '@ant-design/icons';
|
||||||
|
import { Badge } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
The badge can be wrapped with `a` tag to make it linkable.
|
The badge can be wrapped with `a` tag to make it linkable.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
|
import { Avatar, Badge } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Badge, Avatar } from 'antd';
|
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<a href="#">
|
<a href="#">
|
||||||
|
@ -15,8 +15,8 @@ debug: true
|
|||||||
Using `count/dot` with custom `stauts/color`.
|
Using `count/dot` with custom `stauts/color`.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
|
import { Avatar, Badge } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Badge, Avatar } from 'antd';
|
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -16,9 +16,9 @@ title:
|
|||||||
Used in standalone when children is empty.
|
Used in standalone when children is empty.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { Badge, Space, Switch } from 'antd';
|
|
||||||
import { ClockCircleOutlined } from '@ant-design/icons';
|
import { ClockCircleOutlined } from '@ant-design/icons';
|
||||||
|
import { Badge, Space, Switch } from 'antd';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const [show, setShow] = useState(true);
|
const [show, setShow] = useState(true);
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Set offset of the badge dot, the format is `[left, top]`, which represents the offset of the status dot from the left and top of the default position.
|
Set offset of the badge dot, the format is `[left, top]`, which represents the offset of the status dot from the left and top of the default position.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
|
import { Avatar, Badge } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Badge, Avatar } from 'antd';
|
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<Badge count={5} offset={[10, 10]}>
|
<Badge count={5} offset={[10, 10]}>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
`${overflowCount}+` is displayed when count is larger than `overflowCount`. The default value of `overflowCount` is `99`.
|
`${overflowCount}+` is displayed when count is larger than `overflowCount`. The default value of `overflowCount` is `99`.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
|
import { Avatar, Badge } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Badge, Avatar } from 'antd';
|
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Use ribbon badge.
|
Use ribbon badge.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Badge, Card } from 'antd';
|
import { Badge, Card } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -15,8 +15,8 @@ Buggy!
|
|||||||
Buggy!
|
Buggy!
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Badge, Card, Space } from 'antd';
|
import { Badge, Card, Space } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<Space direction="vertical" style={{ width: '100%' }}>
|
<Space direction="vertical" style={{ width: '100%' }}>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Set size of numeral Badge.
|
Set size of numeral Badge.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
|
import { Avatar, Badge } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Badge, Avatar } from 'antd';
|
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Standalone badge with status.
|
Standalone badge with status.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Badge } from 'antd';
|
import { Badge } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -15,8 +15,8 @@ debug: true
|
|||||||
The badge will display `title` when hovered over, instead of `count`.
|
The badge will display `title` when hovered over, instead of `count`.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
|
import { Avatar, Badge } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Badge, Avatar } from 'antd';
|
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
The simplest use.
|
The simplest use.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Breadcrumb } from 'antd';
|
import { Breadcrumb } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<Breadcrumb>
|
<Breadcrumb>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Breadcrumbs support drop down menu.
|
Breadcrumbs support drop down menu.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Breadcrumb, Menu } from 'antd';
|
import { Breadcrumb, Menu } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const menu = (
|
const menu = (
|
||||||
<Menu
|
<Menu
|
||||||
|
@ -16,9 +16,9 @@ title:
|
|||||||
Used together with `react-router@6+`.
|
Used together with `react-router@6+`.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
|
import { Alert, Breadcrumb } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { HashRouter, Route, Routes, Link, useLocation } from 'react-router-dom';
|
import { HashRouter, Link, Route, Routes, useLocation } from 'react-router-dom';
|
||||||
import { Breadcrumb, Alert } from 'antd';
|
|
||||||
|
|
||||||
const Apps = () => (
|
const Apps = () => (
|
||||||
<ul className="app-list">
|
<ul className="app-list">
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
The separator can be customized by setting the separator property: `Breadcrumb.Separator`.
|
The separator can be customized by setting the separator property: `Breadcrumb.Separator`.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Breadcrumb } from 'antd';
|
import { Breadcrumb } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<Breadcrumb separator="">
|
<Breadcrumb separator="">
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
The separator can be customized by setting the separator property: `separator=">"`.
|
The separator can be customized by setting the separator property: `separator=">"`.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Breadcrumb } from 'antd';
|
import { Breadcrumb } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<Breadcrumb separator=">">
|
<Breadcrumb separator=">">
|
||||||
|
@ -14,9 +14,9 @@ title:
|
|||||||
The icon should be placed in front of the text.
|
The icon should be placed in front of the text.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Breadcrumb } from 'antd';
|
|
||||||
import { HomeOutlined, UserOutlined } from '@ant-design/icons';
|
import { HomeOutlined, UserOutlined } from '@ant-design/icons';
|
||||||
|
import { Breadcrumb } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<Breadcrumb>
|
<Breadcrumb>
|
||||||
|
@ -10,6 +10,7 @@ import { tuple } from '../_util/type';
|
|||||||
import warning from '../_util/warning';
|
import warning from '../_util/warning';
|
||||||
import type { SizeType } from '../config-provider/SizeContext';
|
import type { SizeType } from '../config-provider/SizeContext';
|
||||||
import SizeContext from '../config-provider/SizeContext';
|
import SizeContext from '../config-provider/SizeContext';
|
||||||
|
import DisabledContext from '../config-provider/DisabledContext';
|
||||||
import LoadingIcon from './LoadingIcon';
|
import LoadingIcon from './LoadingIcon';
|
||||||
import { cloneElement } from '../_util/reactNode';
|
import { cloneElement } from '../_util/reactNode';
|
||||||
|
|
||||||
@ -102,6 +103,7 @@ export interface BaseButtonProps {
|
|||||||
*/
|
*/
|
||||||
shape?: ButtonShape;
|
shape?: ButtonShape;
|
||||||
size?: SizeType;
|
size?: SizeType;
|
||||||
|
disabled?: boolean;
|
||||||
loading?: boolean | { delay?: number };
|
loading?: boolean | { delay?: number };
|
||||||
prefixCls?: string;
|
prefixCls?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
@ -145,6 +147,7 @@ const InternalButton: React.ForwardRefRenderFunction<unknown, ButtonProps> = (pr
|
|||||||
danger,
|
danger,
|
||||||
shape = 'default',
|
shape = 'default',
|
||||||
size: customizeSize,
|
size: customizeSize,
|
||||||
|
disabled: customDisabled,
|
||||||
className,
|
className,
|
||||||
children,
|
children,
|
||||||
icon,
|
icon,
|
||||||
@ -157,6 +160,10 @@ const InternalButton: React.ForwardRefRenderFunction<unknown, ButtonProps> = (pr
|
|||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const size = React.useContext(SizeContext);
|
const size = React.useContext(SizeContext);
|
||||||
|
// ===================== Disabled =====================
|
||||||
|
const disabled = React.useContext(DisabledContext);
|
||||||
|
const mergedDisabled = customDisabled || disabled;
|
||||||
|
|
||||||
const groupSize = React.useContext(GroupSizeContext);
|
const groupSize = React.useContext(GroupSizeContext);
|
||||||
const [innerLoading, setLoading] = React.useState<Loading>(!!loading);
|
const [innerLoading, setLoading] = React.useState<Loading>(!!loading);
|
||||||
const [hasTwoCNChar, setHasTwoCNChar] = React.useState(false);
|
const [hasTwoCNChar, setHasTwoCNChar] = React.useState(false);
|
||||||
@ -210,9 +217,9 @@ const InternalButton: React.ForwardRefRenderFunction<unknown, ButtonProps> = (pr
|
|||||||
React.useEffect(fixTwoCNChar, [buttonRef]);
|
React.useEffect(fixTwoCNChar, [buttonRef]);
|
||||||
|
|
||||||
const handleClick = (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement, MouseEvent>) => {
|
const handleClick = (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement, MouseEvent>) => {
|
||||||
const { onClick, disabled } = props;
|
const { onClick } = props;
|
||||||
// https://github.com/ant-design/ant-design/issues/30207
|
// https://github.com/ant-design/ant-design/issues/30207
|
||||||
if (innerLoading || disabled) {
|
if (innerLoading || mergedDisabled) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -285,6 +292,7 @@ const InternalButton: React.ForwardRefRenderFunction<unknown, ButtonProps> = (pr
|
|||||||
type={htmlType}
|
type={htmlType}
|
||||||
className={classes}
|
className={classes}
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
|
disabled={mergedDisabled}
|
||||||
ref={buttonRef}
|
ref={buttonRef}
|
||||||
>
|
>
|
||||||
{iconNode}
|
{iconNode}
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
There are `primary` button, `default` button, `dashed` button, `text` button and `link` button in antd.
|
There are `primary` button, `default` button, `dashed` button, `text` button and `link` button in antd.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Button } from 'antd';
|
import { Button } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
`block` property will make the button fit to its parent width.
|
`block` property will make the button fit to its parent width.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Button } from 'antd';
|
import { Button } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
`danger` is a property of button after antd 4.0.
|
`danger` is a property of button after antd 4.0.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Button } from 'antd';
|
import { Button } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
To mark a button as disabled, add the `disabled` property to the `Button`.
|
To mark a button as disabled, add the `disabled` property to the `Button`.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Button } from 'antd';
|
import { Button } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
`ghost` property will make button's background transparent, it is commonly used in colored background.
|
`ghost` property will make button's background transparent, it is commonly used in colored background.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Button } from 'antd';
|
import { Button } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<div className="site-button-ghost-wrapper">
|
<div className="site-button-ghost-wrapper">
|
||||||
|
@ -18,9 +18,9 @@ title:
|
|||||||
If you want specific control over the positioning and placement of the `Icon`, then that should be done by placing the `Icon` component within the `Button` rather than using the `icon` property.
|
If you want specific control over the positioning and placement of the `Icon`, then that should be done by placing the `Icon` component within the `Button` rather than using the `icon` property.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Button, Tooltip } from 'antd';
|
|
||||||
import { SearchOutlined } from '@ant-design/icons';
|
import { SearchOutlined } from '@ant-design/icons';
|
||||||
|
import { Button, Tooltip } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -15,10 +15,10 @@ Debug usage
|
|||||||
Debug usage
|
Debug usage
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Button, Tooltip } from 'antd';
|
|
||||||
import { DownloadOutlined } from '@ant-design/icons';
|
import { DownloadOutlined } from '@ant-design/icons';
|
||||||
|
import { Button, Tooltip } from 'antd';
|
||||||
import type { ButtonGroupProps } from 'antd/es/button';
|
import type { ButtonGroupProps } from 'antd/es/button';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const getGroup = (props?: ButtonGroupProps) => (
|
const getGroup = (props?: ButtonGroupProps) => (
|
||||||
<div>
|
<div>
|
||||||
|
@ -14,9 +14,9 @@ title:
|
|||||||
A loading indicator can be added to a button by setting the `loading` property on the `Button`.
|
A loading indicator can be added to a button by setting the `loading` property on the `Button`.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { Button, Space } from 'antd';
|
|
||||||
import { PoweroffOutlined } from '@ant-design/icons';
|
import { PoweroffOutlined } from '@ant-design/icons';
|
||||||
|
import { Button, Space } from 'antd';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const [loadings, setLoadings] = useState<boolean[]>([]);
|
const [loadings, setLoadings] = useState<boolean[]>([]);
|
||||||
|
@ -14,9 +14,9 @@ title:
|
|||||||
If you need several buttons, we recommend that you use 1 primary button + n secondary buttons, and if there are more than three operations, you can group some of them into [Dropdown.Button](/components/dropdown/#components-dropdown-demo-dropdown-button).
|
If you need several buttons, we recommend that you use 1 primary button + n secondary buttons, and if there are more than three operations, you can group some of them into [Dropdown.Button](/components/dropdown/#components-dropdown-demo-dropdown-button).
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Button, Menu, Dropdown } from 'antd';
|
|
||||||
import type { MenuProps } from 'antd';
|
import type { MenuProps } from 'antd';
|
||||||
|
import { Button, Dropdown, Menu } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const onMenuClick: MenuProps['onClick'] = e => {
|
const onMenuClick: MenuProps['onClick'] = e => {
|
||||||
console.log('click', e);
|
console.log('click', e);
|
||||||
|
@ -18,10 +18,10 @@ Ant Design supports a default button size as well as a large and small size.
|
|||||||
If a large or small button is desired, set the `size` property to either `large` or `small` respectively. Omit the `size` property for a button with the default size.
|
If a large or small button is desired, set the `size` property to either `large` or `small` respectively. Omit the `size` property for a button with the default size.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { Button, Radio } from 'antd';
|
|
||||||
import { DownloadOutlined } from '@ant-design/icons';
|
import { DownloadOutlined } from '@ant-design/icons';
|
||||||
|
import { Button, Radio } from 'antd';
|
||||||
import type { SizeType } from 'antd/es/config-provider/SizeContext';
|
import type { SizeType } from 'antd/es/config-provider/SizeContext';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const [size, setSize] = useState<SizeType>('large');
|
const [size, setSize] = useState<SizeType>('large');
|
||||||
|
@ -14,10 +14,10 @@ title:
|
|||||||
A basic calendar component with Year/Month switch.
|
A basic calendar component with Year/Month switch.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Calendar } from 'antd';
|
import { Calendar } from 'antd';
|
||||||
import type { CalendarMode } from 'antd/lib/calendar/generateCalendar';
|
import type { CalendarMode } from 'antd/lib/calendar/generateCalendar';
|
||||||
import type { Moment } from 'moment';
|
import type { Moment } from 'moment';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const onPanelChange = (value: Moment, mode: CalendarMode) => {
|
const onPanelChange = (value: Moment, mode: CalendarMode) => {
|
||||||
|
@ -14,10 +14,10 @@ title:
|
|||||||
Nested inside a container element for rendering in limited space.
|
Nested inside a container element for rendering in limited space.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Calendar } from 'antd';
|
import { Calendar } from 'antd';
|
||||||
import type { CalendarMode } from 'antd/lib/calendar/generateCalendar';
|
import type { CalendarMode } from 'antd/lib/calendar/generateCalendar';
|
||||||
import type { Moment } from 'moment';
|
import type { Moment } from 'moment';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const onPanelChange = (value: Moment, mode: CalendarMode) => {
|
const onPanelChange = (value: Moment, mode: CalendarMode) => {
|
||||||
|
@ -14,10 +14,10 @@ title:
|
|||||||
Customize Calendar header content.
|
Customize Calendar header content.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
import { Calendar, Col, Radio, Row, Select, Typography } from 'antd';
|
||||||
import { Calendar, Select, Radio, Col, Row, Typography } from 'antd';
|
|
||||||
import type { CalendarMode } from 'antd/lib/calendar/generateCalendar';
|
import type { CalendarMode } from 'antd/lib/calendar/generateCalendar';
|
||||||
import type { Moment } from 'moment';
|
import type { Moment } from 'moment';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const onPanelChange = (value: Moment, mode: CalendarMode) => {
|
const onPanelChange = (value: Moment, mode: CalendarMode) => {
|
||||||
|
@ -14,10 +14,10 @@ title:
|
|||||||
This component can be rendered by using `dateCellRender` and `monthCellRender` with the data you need.
|
This component can be rendered by using `dateCellRender` and `monthCellRender` with the data you need.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Calendar, Badge } from 'antd';
|
|
||||||
import type { BadgeProps } from 'antd';
|
import type { BadgeProps } from 'antd';
|
||||||
|
import { Badge, Calendar } from 'antd';
|
||||||
import type { Moment } from 'moment';
|
import type { Moment } from 'moment';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const getListData = (value: Moment) => {
|
const getListData = (value: Moment) => {
|
||||||
let listData;
|
let listData;
|
||||||
|
@ -14,10 +14,10 @@ title:
|
|||||||
A basic calendar component with Year/Month switch.
|
A basic calendar component with Year/Month switch.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
import { Alert, Calendar } from 'antd';
|
||||||
import { Calendar, Alert } from 'antd';
|
|
||||||
import moment from 'moment';
|
|
||||||
import type { Moment } from 'moment';
|
import type { Moment } from 'moment';
|
||||||
|
import moment from 'moment';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const [value, setValue] = useState(moment('2017-01-25'));
|
const [value, setValue] = useState(moment('2017-01-25'));
|
||||||
|
3
components/calendar/locale/tk_TK.tsx
Normal file
3
components/calendar/locale/tk_TK.tsx
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import tkTK from '../../date-picker/locale/tk_TK';
|
||||||
|
|
||||||
|
export default tkTK;
|
@ -2,12 +2,11 @@ import * as React from 'react';
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import omit from 'rc-util/lib/omit';
|
import omit from 'rc-util/lib/omit';
|
||||||
import Tabs from '../tabs';
|
import Tabs from '../tabs';
|
||||||
import Row from '../row';
|
|
||||||
import Col from '../col';
|
|
||||||
import Grid from './Grid';
|
import Grid from './Grid';
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import SizeContext from '../config-provider/SizeContext';
|
import SizeContext from '../config-provider/SizeContext';
|
||||||
import type { TabsProps } from '../tabs';
|
import type { TabsProps } from '../tabs';
|
||||||
|
import Skeleton from '../skeleton';
|
||||||
|
|
||||||
export type CardType = 'inner';
|
export type CardType = 'inner';
|
||||||
export type CardSize = 'default' | 'small';
|
export type CardSize = 'default' | 'small';
|
||||||
@ -96,34 +95,10 @@ const Card = React.forwardRef((props: CardProps, ref: React.Ref<HTMLDivElement>)
|
|||||||
|
|
||||||
const prefixCls = getPrefixCls('card', customizePrefixCls);
|
const prefixCls = getPrefixCls('card', customizePrefixCls);
|
||||||
|
|
||||||
const loadingBlockStyle =
|
|
||||||
bodyStyle.padding === 0 || bodyStyle.padding === '0px' ? { padding: 24 } : undefined;
|
|
||||||
|
|
||||||
const block = <div className={`${prefixCls}-loading-block`} />;
|
|
||||||
|
|
||||||
const loadingBlock = (
|
const loadingBlock = (
|
||||||
<div className={`${prefixCls}-loading-content`} style={loadingBlockStyle}>
|
<Skeleton loading active paragraph={{ rows: 4 }} title={false}>
|
||||||
<Row gutter={8}>
|
{children}
|
||||||
<Col span={22}>{block}</Col>
|
</Skeleton>
|
||||||
</Row>
|
|
||||||
<Row gutter={8}>
|
|
||||||
<Col span={8}>{block}</Col>
|
|
||||||
<Col span={15}>{block}</Col>
|
|
||||||
</Row>
|
|
||||||
<Row gutter={8}>
|
|
||||||
<Col span={6}>{block}</Col>
|
|
||||||
<Col span={18}>{block}</Col>
|
|
||||||
</Row>
|
|
||||||
<Row gutter={8}>
|
|
||||||
<Col span={13}>{block}</Col>
|
|
||||||
<Col span={9}>{block}</Col>
|
|
||||||
</Row>
|
|
||||||
<Row gutter={8}>
|
|
||||||
<Col span={4}>{block}</Col>
|
|
||||||
<Col span={3}>{block}</Col>
|
|
||||||
<Col span={16}>{block}</Col>
|
|
||||||
</Row>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const hasActiveTabKey = activeTabKey !== undefined;
|
const hasActiveTabKey = activeTabKey !== undefined;
|
||||||
|
@ -430,112 +430,21 @@ Array [
|
|||||||
class="ant-card-body"
|
class="ant-card-body"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-card-loading-content"
|
class="ant-skeleton ant-skeleton-active"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-row"
|
class="ant-skeleton-content"
|
||||||
style="margin-left:-4px;margin-right:-4px"
|
|
||||||
>
|
>
|
||||||
<div
|
<ul
|
||||||
class="ant-col ant-col-22"
|
class="ant-skeleton-paragraph"
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
>
|
||||||
<div
|
<li />
|
||||||
class="ant-card-loading-block"
|
<li />
|
||||||
|
<li />
|
||||||
|
<li
|
||||||
|
style="width:61%"
|
||||||
/>
|
/>
|
||||||
</div>
|
</ul>
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-row"
|
|
||||||
style="margin-left:-4px;margin-right:-4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-8"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-15"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-row"
|
|
||||||
style="margin-left:-4px;margin-right:-4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-6"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-18"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-row"
|
|
||||||
style="margin-left:-4px;margin-right:-4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-13"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-9"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-row"
|
|
||||||
style="margin-left:-4px;margin-right:-4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-4"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-3"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-16"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -430,112 +430,21 @@ Array [
|
|||||||
class="ant-card-body"
|
class="ant-card-body"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-card-loading-content"
|
class="ant-skeleton ant-skeleton-active"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-row"
|
class="ant-skeleton-content"
|
||||||
style="margin-left:-4px;margin-right:-4px"
|
|
||||||
>
|
>
|
||||||
<div
|
<ul
|
||||||
class="ant-col ant-col-22"
|
class="ant-skeleton-paragraph"
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
>
|
||||||
<div
|
<li />
|
||||||
class="ant-card-loading-block"
|
<li />
|
||||||
|
<li />
|
||||||
|
<li
|
||||||
|
style="width:61%"
|
||||||
/>
|
/>
|
||||||
</div>
|
</ul>
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-row"
|
|
||||||
style="margin-left:-4px;margin-right:-4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-8"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-15"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-row"
|
|
||||||
style="margin-left:-4px;margin-right:-4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-6"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-18"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-row"
|
|
||||||
style="margin-left:-4px;margin-right:-4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-13"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-9"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-row"
|
|
||||||
style="margin-left:-4px;margin-right:-4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-4"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-3"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-16"
|
|
||||||
style="padding-left:4px;padding-right:4px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -19,113 +19,21 @@ exports[`Card should still have padding when card which set padding to 0 is load
|
|||||||
style="padding: 0px;"
|
style="padding: 0px;"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-card-loading-content"
|
class="ant-skeleton ant-skeleton-active"
|
||||||
style="padding: 24px;"
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-row"
|
class="ant-skeleton-content"
|
||||||
style="margin-left: -4px; margin-right: -4px;"
|
|
||||||
>
|
>
|
||||||
<div
|
<ul
|
||||||
class="ant-col ant-col-22"
|
class="ant-skeleton-paragraph"
|
||||||
style="padding-left: 4px; padding-right: 4px;"
|
|
||||||
>
|
>
|
||||||
<div
|
<li />
|
||||||
class="ant-card-loading-block"
|
<li />
|
||||||
|
<li />
|
||||||
|
<li
|
||||||
|
style="width: 61%;"
|
||||||
/>
|
/>
|
||||||
</div>
|
</ul>
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-row"
|
|
||||||
style="margin-left: -4px; margin-right: -4px;"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-8"
|
|
||||||
style="padding-left: 4px; padding-right: 4px;"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-15"
|
|
||||||
style="padding-left: 4px; padding-right: 4px;"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-row"
|
|
||||||
style="margin-left: -4px; margin-right: -4px;"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-6"
|
|
||||||
style="padding-left: 4px; padding-right: 4px;"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-18"
|
|
||||||
style="padding-left: 4px; padding-right: 4px;"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-row"
|
|
||||||
style="margin-left: -4px; margin-right: -4px;"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-13"
|
|
||||||
style="padding-left: 4px; padding-right: 4px;"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-9"
|
|
||||||
style="padding-left: 4px; padding-right: 4px;"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-row"
|
|
||||||
style="margin-left: -4px; margin-right: -4px;"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-4"
|
|
||||||
style="padding-left: 4px; padding-right: 4px;"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-3"
|
|
||||||
style="padding-left: 4px; padding-right: 4px;"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-16"
|
|
||||||
style="padding-left: 4px; padding-right: 4px;"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-card-loading-block"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
A basic card containing a title, content and an extra corner content. Supports two sizes: `default` and `small`.
|
A basic card containing a title, content and an extra corner content. Supports two sizes: `default` and `small`.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Card } from 'antd';
|
import { Card } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
A borderless card on a gray background.
|
A borderless card on a gray background.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Card } from 'antd';
|
import { Card } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<div className="site-card-border-less-wrapper">
|
<div className="site-card-border-less-wrapper">
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
You can use `Card.Meta` to support more flexible content.
|
You can use `Card.Meta` to support more flexible content.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Card } from 'antd';
|
import { Card } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const { Meta } = Card;
|
const { Meta } = Card;
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Grid style card content.
|
Grid style card content.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Card } from 'antd';
|
import { Card } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const gridStyle: React.CSSProperties = {
|
const gridStyle: React.CSSProperties = {
|
||||||
width: '25%',
|
width: '25%',
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Cards usually cooperate with grid column layout in overview page.
|
Cards usually cooperate with grid column layout in overview page.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Card, Col, Row } from 'antd';
|
import { Card, Col, Row } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<div className="site-card-wrapper">
|
<div className="site-card-wrapper">
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
It can be placed inside the ordinary card to display the information of the multilevel structure.
|
It can be placed inside the ordinary card to display the information of the multilevel structure.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Card } from 'antd';
|
import { Card } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<Card title="Card title">
|
<Card title="Card title">
|
||||||
|
@ -14,9 +14,9 @@ title:
|
|||||||
Shows a loading indicator while the contents of the card is being fetched.
|
Shows a loading indicator while the contents of the card is being fetched.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { Skeleton, Switch, Card, Avatar } from 'antd';
|
|
||||||
import { EditOutlined, EllipsisOutlined, SettingOutlined } from '@ant-design/icons';
|
import { EditOutlined, EllipsisOutlined, SettingOutlined } from '@ant-design/icons';
|
||||||
|
import { Avatar, Card, Skeleton, Switch } from 'antd';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const { Meta } = Card;
|
const { Meta } = Card;
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ title:
|
|||||||
A Card that supports `cover`, `avatar`, `title` and `description`.
|
A Card that supports `cover`, `avatar`, `title` and `description`.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Card, Avatar } from 'antd';
|
|
||||||
import { EditOutlined, EllipsisOutlined, SettingOutlined } from '@ant-design/icons';
|
import { EditOutlined, EllipsisOutlined, SettingOutlined } from '@ant-design/icons';
|
||||||
|
import { Avatar, Card } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const { Meta } = Card;
|
const { Meta } = Card;
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
A simple card only containing a content area.
|
A simple card only containing a content area.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Card } from 'antd';
|
import { Card } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<Card style={{ width: 300 }}>
|
<Card style={{ width: 300 }}>
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
More content can be hosted.
|
More content can be hosted.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { Card } from 'antd';
|
import { Card } from 'antd';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const tabList = [
|
const tabList = [
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import Grid from './Grid';
|
import Grid from './Grid';
|
||||||
import Meta from './Meta';
|
import Meta from './Meta';
|
||||||
|
|
||||||
import InternalCard from './Card';
|
import InternalCard from './Card';
|
||||||
|
|
||||||
export { CardGridProps } from './Grid';
|
export { CardGridProps } from './Grid';
|
||||||
|
@ -80,7 +80,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&-extra {
|
&-extra {
|
||||||
float: right;
|
|
||||||
// https://stackoverflow.com/a/22429853/3040605
|
// https://stackoverflow.com/a/22429853/3040605
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
padding: @card-head-padding 0;
|
padding: @card-head-padding 0;
|
||||||
@ -99,13 +98,17 @@
|
|||||||
.clearfix();
|
.clearfix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-contain-grid &-body {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
&-contain-grid:not(&-loading) &-body {
|
&-contain-grid:not(&-loading) &-body {
|
||||||
margin: -1px 0 0 -1px;
|
margin: -1px 0 0 -1px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-grid {
|
&-grid {
|
||||||
float: left;
|
|
||||||
width: 33.33%;
|
width: 33.33%;
|
||||||
padding: @card-padding-base;
|
padding: @card-padding-base;
|
||||||
border: 0;
|
border: 0;
|
||||||
@ -115,10 +118,6 @@
|
|||||||
0 1px 0 0 @border-color-split inset;
|
0 1px 0 0 @border-color-split inset;
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
|
|
||||||
.@{card-prefix-cls}-rtl & {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-hoverable {
|
&-hoverable {
|
||||||
&:hover {
|
&:hover {
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -155,6 +154,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&-actions {
|
&-actions {
|
||||||
|
display: flex;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
@ -163,15 +163,10 @@
|
|||||||
.clearfix();
|
.clearfix();
|
||||||
|
|
||||||
& > li {
|
& > li {
|
||||||
float: left;
|
|
||||||
margin: @card-actions-li-margin;
|
margin: @card-actions-li-margin;
|
||||||
color: @text-color-secondary;
|
color: @text-color-secondary;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
.@{card-prefix-cls}-rtl & {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
> span {
|
> span {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: block;
|
||||||
@ -234,15 +229,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&-meta {
|
&-meta {
|
||||||
|
display: flex;
|
||||||
margin: -4px 0;
|
margin: -4px 0;
|
||||||
.clearfix();
|
.clearfix();
|
||||||
|
|
||||||
&-avatar {
|
&-avatar {
|
||||||
float: left;
|
|
||||||
padding-right: 16px;
|
padding-right: 16px;
|
||||||
|
|
||||||
.@{card-prefix-cls}-rtl & {
|
.@{card-prefix-cls}-rtl & {
|
||||||
float: right;
|
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
padding-left: 16px;
|
padding-left: 16px;
|
||||||
}
|
}
|
||||||
@ -277,32 +271,6 @@
|
|||||||
&-loading &-body {
|
&-loading &-body {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-loading-content {
|
|
||||||
p {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-loading-block {
|
|
||||||
height: 14px;
|
|
||||||
margin: 4px 0;
|
|
||||||
background: linear-gradient(90deg, @gradient-min, @gradient-max, @gradient-min);
|
|
||||||
background-size: 600% 600%;
|
|
||||||
border-radius: @card-radius;
|
|
||||||
animation: card-loading 1.4s ease infinite;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes card-loading {
|
|
||||||
0%,
|
|
||||||
100% {
|
|
||||||
background-position: 0 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
50% {
|
|
||||||
background-position: 100% 50%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@import './size';
|
@import './size';
|
||||||
|
@ -3,5 +3,4 @@ import './index.less';
|
|||||||
|
|
||||||
// style dependencies
|
// style dependencies
|
||||||
import '../../tabs/style';
|
import '../../tabs/style';
|
||||||
import '../../row/style';
|
import '../../skeleton/style';
|
||||||
import '../../col/style';
|
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Timing of scrolling to the next card/picture.
|
Timing of scrolling to the next card/picture.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Carousel } from 'antd';
|
import { Carousel } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const contentStyle: React.CSSProperties = {
|
const contentStyle: React.CSSProperties = {
|
||||||
height: '160px',
|
height: '160px',
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Basic usage.
|
Basic usage.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Carousel } from 'antd';
|
import { Carousel } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const contentStyle: React.CSSProperties = {
|
const contentStyle: React.CSSProperties = {
|
||||||
height: '160px',
|
height: '160px',
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Slides use fade for transition.
|
Slides use fade for transition.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Carousel } from 'antd';
|
import { Carousel } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const contentStyle: React.CSSProperties = {
|
const contentStyle: React.CSSProperties = {
|
||||||
height: '160px',
|
height: '160px',
|
||||||
|
@ -14,10 +14,10 @@ title:
|
|||||||
There are 4 position options available.
|
There are 4 position options available.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { Carousel, Radio } from 'antd';
|
|
||||||
import type { RadioChangeEvent } from 'antd';
|
import type { RadioChangeEvent } from 'antd';
|
||||||
|
import { Carousel, Radio } from 'antd';
|
||||||
import type { DotPosition } from 'antd/lib/carousel';
|
import type { DotPosition } from 'antd/lib/carousel';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const contentStyle: React.CSSProperties = {
|
const contentStyle: React.CSSProperties = {
|
||||||
height: '160px',
|
height: '160px',
|
||||||
|
@ -14,8 +14,8 @@ title:
|
|||||||
Cascade selection box for selecting province/city/district.
|
Cascade selection box for selecting province/city/district.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { Cascader } from 'antd';
|
import { Cascader } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
interface Option {
|
interface Option {
|
||||||
value: string | number;
|
value: string | number;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user