7 | {['date', 'month'].map(type => (
8 |
9 | console.log(v)} />
10 |
11 | ))}
12 |
13 | );
14 | // demo end
15 |
16 | export default Demo;
17 |
--------------------------------------------------------------------------------
/src/components/Icon/__demo__/customStyle.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Icon from 'src/components/Icon';
3 |
4 | // demo start
5 | const layout = {
6 | style: {
7 | marginRight: 10
8 | }
9 | };
10 | const Demo = () => (
11 | console.log(fileList)}
9 | onError={({ message, name }) => alert(`there is an error of ${name}: ${message}`)}
10 | onRemove={console.log}
11 | onAdd={console.log}
12 | multiple={false}
13 | />
14 | );
15 | // demo end
16 |
17 | export default Demo;
18 |
--------------------------------------------------------------------------------
/src/components/SvgIcon/__demo__/svgIcon-size.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import SvgIcon from 'src/components/SvgIcon';
4 |
5 | // demo start
6 | const layout = {
7 | style: {
8 | marginRight: 10
9 | }
10 | };
11 | const Demo = () => (
12 |
13 | {['12px', '16px', '30px', '2em', '3rem'].map(size => (
14 |
15 | ))}
16 |
17 | );
18 | // demo end
19 |
20 | export default Demo;
21 |
--------------------------------------------------------------------------------
/src/components/SvgIcon/SvgIcon.md:
--------------------------------------------------------------------------------
1 | ### 说明
2 |
3 | - 这是 SvgIcon 组件,主要是组件内部使用的一些图标,目前直接不建议使用
4 |
5 | ### 演示
6 |
7 | #### 演示
8 |
9 | ```js {"codepath": "svgIcon.jsx"}
10 | ```
11 |
12 | #### type - 图标类型
13 |
14 | ```js {"codepath": "svgIcon-type.jsx"}
15 | ```
16 |
17 | #### color - 颜色
18 |
19 | ```js {"codepath": "svgIcon-color.jsx"}
20 | ```
21 |
22 | #### spin - 是否旋转
23 |
24 | ```js {"codepath": "svgIcon-spin.jsx"}
25 | ```
26 |
27 | #### size - 尺寸
28 |
29 | ```js {"codepath": "svgIcon-size.jsx"}
30 | ```
31 |
--------------------------------------------------------------------------------
/src/components/Calendar/__demo__/base.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import Calendar from 'src/components/Calendar';
4 |
5 | // demo start
6 | const Demo = () => (
7 |
8 | console.log('select', v)}
10 | onChange={v => console.log('change', v)}
11 | rules={{ range: [Date.now() - 7 * 24 * 60 * 60 * 1000, Date.now() + 7 * 24 * 60 * 60 * 1000] }}
12 | />
13 |
14 | );
15 | // demo end
16 |
17 | export default Demo;
18 |
--------------------------------------------------------------------------------
/src/components/SvgIcon/icons/CircleYesMdFill.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export default React.memo(() => (
4 |
5 | ));
6 |
--------------------------------------------------------------------------------
/src/components/SvgIcon/icons/Search.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export default React.memo(() => (
4 |
5 | ));
6 |
--------------------------------------------------------------------------------
/.recodo/data/Link.doc.json:
--------------------------------------------------------------------------------
1 | {
2 | "Button": {
3 | "path": "Link/Button.md",
4 | "name": "Button",
5 | "info": "### 说明\n\n- 这是 Link.Button 子组件,提供 Button 样式的 Link 组件,除了支持 Link 的属性外,还支持 Button 的样式属性\n\n### 演示\n\n- 普通使用\n\n```js {\"codepath\": \"button.jsx\"}\n```\n"
6 | },
7 | "Link": {
8 | "path": "Link/Link.md",
9 | "name": "Link",
10 | "info": "### 说明\n\n- 这是 Link 组件,主要是针对 a 标签进行样式封装\n\n### 演示\n\n- 普通使用\n\n```js {\"codepath\": \"base.jsx\"}\n```\n"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/.recodo/data/PopConfirm.doc.json:
--------------------------------------------------------------------------------
1 | {
2 | "PopConfirm": {
3 | "path": "PopConfirm/PopConfirm.md",
4 | "name": "PopConfirm",
5 | "info": "### 说明\n\n- 这是 PopConfirm 组件,用作一些按钮操作的二次确认\n- PopConfirm 由 Tooltip 封装,支持所有 Tooltip 的 props\n\n### 演示\n\n#### 普通使用\n\n```js {\"codepath\": \"popConfirm.jsx\"}\n```\n\n#### onConfirm - 确认按钮回调\n\n```js {\"codepath\": \"onConfirm.jsx\"}\n```\n\n#### onCancel - 取消按钮回调\n\n```js {\"codepath\": \"onCancel.jsx\"}\n```\n\n#### 演示\n\n```js {\"codepath\": \"demo.jsx\"}\n```\n"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/components/Button/__demo__/size.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import Button from 'src/components/Button';
4 |
5 | // demo start
6 | const { Sizes } = Button;
7 |
8 | const Demo = () => {
9 | return (
10 |
11 | {Sizes.map(size => (
12 |
15 | ))}
16 |
17 | );
18 | };
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/ConfigProvider/ConfigProvider.md:
--------------------------------------------------------------------------------
1 | ### 说明
2 |
3 | 这是 ConfigProvider 组件,用于统一配置应用的配置
4 |
5 | ### 演示
6 |
7 | #### 普通使用
8 |
9 | ```js {"codepath": "demo.jsx"}
10 | ```
11 |
12 | #### theme - 用作定义主题
13 |
14 | ```js {"codepath": "theme.jsx"}
15 | ```
16 |
17 | #### locale - 用作定义语言
18 |
19 | ```js {"codepath": "locale.jsx"}
20 | ```
21 |
22 | #### iconDefaultPrefix - icon 默认前缀
23 |
24 | ```js {"codepath": "icon.jsx"}
25 | ```
26 |
27 | #### actionListAutoAdjustment
28 |
29 | ```js {"codepath": "actionList.jsx"}
30 | ```
31 |
--------------------------------------------------------------------------------
/src/components/SvgIcon/__demo__/svgIcon-color.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import SvgIcon from 'src/components/SvgIcon';
4 |
5 | // demo start
6 | const layout = {
7 | style: {
8 | marginRight: 10
9 | }
10 | };
11 | const Demo = () => (
12 |
13 | {['black', 'white', 'red', 'green', 'blue', 'purple', '#18E1c9'].map(color => (
14 |
15 | ))}
16 |
17 | );
18 | // demo end
19 |
20 | export default Demo;
21 |
--------------------------------------------------------------------------------
/src/components/Upload/locale/zh_CN.js:
--------------------------------------------------------------------------------
1 | export default {
2 | selectFile: '请选择文件',
3 | selectFileTip: '请选择符合规则的文件',
4 | emptyTip: '你还未上传任何内容',
5 | retry: '重试',
6 | uploading: '上传中...',
7 | defaultUploadErrorTip: '上传失败,请重试',
8 | defaultErrorTipTitle: '无法添加文件',
9 | defaultErrorTip: '请检查添加的文件是否符合规则',
10 | maxCountErrorTip: '最大文件数量为 {maxCount}',
11 | typeErrorTip: '支持的文件类型为 {accept}',
12 | maxSizeErrorTip: '文件最大尺寸为 {size}',
13 | dropzoneMainTip: '拖拽文件到此处上传',
14 | dropzoneSubTip: '请上传符合要求的文件'
15 | };
16 |
--------------------------------------------------------------------------------
/src/components/Radio/__demo__/group-size.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Radio from 'src/components/Radio';
3 |
4 | // demo start
5 | const { Size } = Radio;
6 | const options = [1, 2, 3];
7 | const Demo = () => (
8 |
9 | {Size.map(size => (
10 |
11 | ({ value: v, styleType: 'button' }))} />
12 |
13 | ))}
14 |
15 | );
16 | // demo end
17 |
18 | export default Demo;
19 |
--------------------------------------------------------------------------------
/.recodo/data/Layout.doc.json:
--------------------------------------------------------------------------------
1 | {
2 | "Layout": {
3 | "path": "Layout/Layout.md",
4 | "name": "Layout",
5 | "info": "### 说明\n\n- 这是 Layout 布局组件\n\n### 演示\n\n#### 顶部通栏+侧边导航\n\n```js {\"codepath\": \"full-header.jsx\"}\n```\n\n#### 顶部通栏\n\n```js {\"codepath\": \"no-sider.jsx\"}\n```\n"
6 | },
7 | "Sider": {
8 | "path": "Layout/Sider.md",
9 | "name": "Sider",
10 | "info": "### 说明\n\n- 侧边导航\n\n### 演示\n\n- 普通使用\n\n#### 侧边通栏\n\n```js {\"codepath\": \"full-sider.jsx\"}\n```\n"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/.recodo/data/SvgIcon.doc.json:
--------------------------------------------------------------------------------
1 | {
2 | "SvgIcon": {
3 | "path": "SvgIcon/SvgIcon.md",
4 | "name": "SvgIcon",
5 | "info": "### 说明\n\n- 这是 SvgIcon 组件,主要是组件内部使用的一些图标,目前直接不建议使用\n\n### 演示\n\n#### 演示\n\n```js {\"codepath\": \"svgIcon.jsx\"}\n```\n\n#### type - 图标类型\n\n```js {\"codepath\": \"svgIcon-type.jsx\"}\n```\n\n#### color - 颜色\n\n```js {\"codepath\": \"svgIcon-color.jsx\"}\n```\n\n#### spin - 是否旋转\n\n```js {\"codepath\": \"svgIcon-spin.jsx\"}\n```\n\n#### size - 尺寸\n\n```js {\"codepath\": \"svgIcon-size.jsx\"}\n```\n"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/components/Checkbox/CheckboxContext.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import { SelectableContext } from 'src/hooks/selectable';
4 | import noop from 'src/utils/noop';
5 |
6 | import { Size, StyleType } from './interface';
7 |
8 | const CheckboxContext = React.createContext<
9 | {
10 | disabled?: boolean;
11 | styleType?: StyleType;
12 | size?: Size;
13 | } & SelectableContext
14 | >({
15 | toggleSelect: noop,
16 | addItem: noop,
17 | removeItem: noop
18 | });
19 | export default CheckboxContext;
20 |
--------------------------------------------------------------------------------
/src/components/SvgIcon/icons/TriangleLeft.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export default React.memo(() => (
4 |
8 | ));
9 |
--------------------------------------------------------------------------------
/src/components/Table/SearchInput.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | import Input from 'src/components/Input';
4 |
5 | import { TableContext } from './Table';
6 |
7 | export default class SearchInput extends Component {
8 | render() {
9 | const { ...rest } = this.props;
10 | return (
11 |
12 | {({ handleSearch }) => }
13 |
14 | );
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/components/ConfigProvider/ConfigContext.tsx:
--------------------------------------------------------------------------------
1 | import { createContext } from 'react';
2 |
3 | import { ConfigProviderProps } from './ConfigProvider';
4 |
5 | export const defaultConfig = {
6 | forwardPopupContainer: true,
7 | preventFormDefaultAction: true
8 | };
9 |
10 | export type ConfigContextType = Pick<
11 | ConfigProviderProps,
12 | 'forwardPopupContainer' | 'popover' | 'preventFormDefaultAction' | 'iconDefaultPrefix' | 'actionListAutoAdjustment'
13 | >;
14 |
15 | export default createContext(defaultConfig);
16 |
--------------------------------------------------------------------------------
/src/components/SvgIcon/icons/Ellipsis.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export default React.memo(() => (
4 |
5 | ));
6 |
--------------------------------------------------------------------------------
/src/components/Calendar/__demo__/month.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import Calendar from 'src/components/Calendar';
4 |
5 | // demo start
6 | const Demo = () => (
7 |
8 | console.log('select', v)}
11 | onChange={v => console.log('change', v)}
12 | rules={{ range: [Date.now() - 3 * 30 * 24 * 60 * 60 * 1000, Date.now() + 3 * 30 * 24 * 60 * 60 * 1000] }}
13 | />
14 |
15 | );
16 | // demo end
17 |
18 | export default Demo;
19 |
--------------------------------------------------------------------------------
/src/components/Cascader/interface.ts:
--------------------------------------------------------------------------------
1 | import { ReactNode } from 'react';
2 |
3 | export type Key = string;
4 |
5 | export interface LoadData {
6 | (expandedKeys: Key[]): Promise;
7 | }
8 |
9 | export interface CascadeData {
10 | // 唯一键,所有值的字符串不得重复,会用作 key 和选中判定,如果为其它值会转为 string 再应用
11 | key: Key;
12 | // 选项标题内容
13 | title: ReactNode;
14 | // 子数据,存在即为父节点,不存在即为叶子结点,与程序树有差异,原因详见说明
15 | children?: CascadeData[];
16 | // 是否禁用,父节点禁用会禁用所有子孙节点
17 | disabled?: boolean;
18 | // 是否强制为父节点
19 | isParent?: boolean;
20 | }
21 |
--------------------------------------------------------------------------------
/src/components/Radio/__demo__/group-disabled.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Radio from 'src/components/Radio';
3 |
4 | // demo start
5 | const options = [1, 2, 3];
6 | const Demo = () => (
7 |
8 |
9 | ({ value: v }))} />
10 |
11 |
12 | ({ value: v }))} />
13 |
14 |
15 | );
16 | // demo end
17 |
18 | export default Demo;
19 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | **What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)**
2 |
3 | **What is the current behavior? (You can also link to an open issue here)**
4 |
5 | **What is the new behavior (if this is a feature change)?**
6 |
7 | **Does this PR introduce a breaking change?**
8 |
9 | **Please check if the PR fulfills these requirements**
10 |
11 | * [ ] Follow our contributing docs
12 | * [ ] Docs have been added/updated
13 | * [ ] Tests have been added; existing tests pass
14 |
15 | **Other information**:
16 |
--------------------------------------------------------------------------------
/src/components/Tooltip/Tooltip.md:
--------------------------------------------------------------------------------
1 | ### 说明
2 |
3 | - Tooltip 基于 Popover,增加了箭头样式,支持所有 Popover 的 props,其它 props 的定义和注意事项参考 Popover 文档
4 | - 主要用于包裹一些展示性的提示
5 |
6 | ### 演示
7 |
8 | #### 演示
9 |
10 | ```js {"codepath": "tooltip.jsx"}
11 | ```
12 |
13 | #### theme - 主题
14 |
15 | ```js {"codepath": "theme.jsx"}
16 | ```
17 |
18 | #### arrow - 箭头
19 |
20 | ```js {"codepath": "arrow.jsx"}
21 | ```
22 |
23 | #### placement - 位置
24 |
25 | ```js {"codepath": "placement.jsx"}
26 | ```
27 |
28 | #### style - 修改提示文案宽度
29 |
30 | ```js {"codepath": "style.jsx"}
31 | ```
32 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # dependencies
2 | /node_modules
3 | package-lock.json
4 |
5 | # testing
6 | /coverage
7 |
8 | # production
9 | /build
10 | /dist
11 | /styleguide-build
12 | /styleguide
13 | /lib
14 |
15 | # misc
16 | .DS_Store
17 | .env.local
18 | .env.development.local
19 | .env.test.local
20 | .env.production.local
21 |
22 | npm-debug.log*
23 | yarn-debug.log*
24 | yarn-error.log*
25 |
26 | # local
27 | /.vscode
28 | /jsconfig.json
29 | /.idea
30 |
31 | /static/fonts/demoTemplate.html
32 |
33 | # cache
34 | .eslintcache
35 | .gh-pages-cache
36 | __image_snapshots__
37 |
--------------------------------------------------------------------------------
/src/components/Calendar/__demo__/range.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import Calendar from 'src/components/Calendar';
4 |
5 | // demo start
6 | const Demo = () => (
7 |
8 | console.log('change', v)}
11 | rangeValue={[
12 | new Date(Date.now() - 30 * 24 * 60 * 60 * 1000),
13 | new Date(Date.now() + 30 * 24 * 60 * 60 * 1000)
14 | ]}
15 | />
16 |
17 | );
18 | // demo end
19 |
20 | export default Demo;
21 |
--------------------------------------------------------------------------------
/src/components/ConfigProvider/__demo__/locale.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import ConfigProvider from 'src/components/ConfigProvider';
4 | import Pagination from 'src/components/Pagination';
5 |
6 | // demo start
7 | const Demo = () => (
8 |
13 | );
14 | // demo end
15 |
16 | export default Demo;
17 |
--------------------------------------------------------------------------------
/src/components/DatePicker/index.tsx:
--------------------------------------------------------------------------------
1 | import { Sizes } from 'src/type';
2 |
3 | import DatePicker from './DatePicker';
4 | import Month from './Month';
5 | import Range from './Range';
6 |
7 | type TExportDatePicker = typeof DatePicker & {
8 | Month: typeof Month;
9 | Range: typeof Range;
10 | Sizes: typeof Sizes;
11 | };
12 |
13 | const ExportDatePicker: TExportDatePicker = DatePicker as TExportDatePicker;
14 | ExportDatePicker.Month = Month;
15 | ExportDatePicker.Range = Range;
16 | ExportDatePicker.Sizes = Sizes;
17 |
18 | export default ExportDatePicker;
19 |
--------------------------------------------------------------------------------
/src/components/EditableTable/EditableTable.md:
--------------------------------------------------------------------------------
1 | ### 说明
2 |
3 | - 这是 EditableTable 组件,主要用于列表项的编辑删除
4 | - 与表格的区别
5 | 1. pagination 固定为 null
6 | 2. emptyContent 固定为 null
7 | 3. columns 中添加了删除列
8 | - 其余属性与 Table 保持一致
9 |
10 | ### 演示
11 |
12 | #### 普通使用
13 |
14 | ```js {"codepath": "editableTable.jsx"}
15 | ```
16 |
17 | #### addition - 添加
18 |
19 | ```js {"codepath": "addition.jsx"}
20 | ```
21 |
22 | #### rowDeletion - 删除
23 |
24 | ```js {"codepath": "rowDeletion.jsx"}
25 | ```
26 |
27 | #### 样例演示
28 |
29 | ```js {"codepath": "demo.jsx"}
30 | ```
31 |
--------------------------------------------------------------------------------
/src/components/Table/locale/en_US.js:
--------------------------------------------------------------------------------
1 | export default {
2 | emptyTip: 'Data is empty',
3 | search: 'Search',
4 | filter: 'Filter',
5 | searchResult: 'Search result',
6 | items: 'Items',
7 | reset: 'Reset search and filter',
8 | period: '.',
9 | semicolon: ';',
10 | colon: ': ',
11 | selected: 'Selected',
12 | cancelSelect: 'Cancel select',
13 | columnConfigHeader: 'Custom columns',
14 | columnConfigTip: 'When you clean cache or change browser, the saving record will lost.',
15 | columnConfigSelected: 'Selected'
16 | };
17 |
--------------------------------------------------------------------------------
/shared/DemoWrap.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 | import PropTypes from 'prop-types';
4 |
5 | const DemoWrap = ({ children, className, title }) => {
6 | return (
7 | <>
8 | {title && {title}
}
9 | {children}
10 | >
11 | );
12 | };
13 | DemoWrap.propTypes = {
14 | children: PropTypes.node,
15 | className: PropTypes.string,
16 | title: PropTypes.node
17 | };
18 | export default DemoWrap;
19 |
--------------------------------------------------------------------------------
/src/components/Button/__demo__/styleType.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import Button from 'src/components/Button';
4 |
5 | // demo start
6 | const { StyleTypes } = Button;
7 |
8 | const Demo = () => {
9 | return (
10 |
11 | {StyleTypes.map(styleType => (
12 |
15 | ))}
16 |
17 | );
18 | };
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/LocaleProvider/__demo__/localeprovider.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import LocaleProvider from 'src/components/LocaleProvider';
3 | import Pagination from 'src/components/Pagination';
4 |
5 | // demo start
6 | const Demo = () => (
7 |
12 | );
13 | // demo end
14 |
15 | export default Demo;
16 |
--------------------------------------------------------------------------------
/src/components/SvgIcon/icons/CircleCrossFill.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export default React.memo(() => (
4 |
5 | ));
6 |
--------------------------------------------------------------------------------
/src/components/SvgIcon/icons/TickSmall.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export default React.memo(() => (
4 |
5 | ));
6 |
--------------------------------------------------------------------------------
/src/components/TimePicker/__demo__/disabled.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import demoUtil from 'shared/demoUtil';
4 | import TimePicker from 'src/components/TimePicker';
5 |
6 | // demo start
7 | const { DemoWrap } = demoUtil;
8 | const Demo = () => {
9 | return (
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | );
19 | };
20 | // demo end
21 |
22 | export default Demo;
23 |
--------------------------------------------------------------------------------
/src/components/TimePicker/__demo__/nullable.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import demoUtil from 'shared/demoUtil';
4 | import TimePicker from 'src/components/TimePicker';
5 |
6 | // demo start
7 | const { DemoWrap } = demoUtil;
8 | const Demo = () => {
9 | return (
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | );
19 | };
20 | // demo end
21 |
22 | export default Demo;
23 |
--------------------------------------------------------------------------------
/src/components/TimePicker/__demo__/size.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import demoUtil from 'shared/demoUtil';
4 | import TimePicker from 'src/components/TimePicker';
5 |
6 | // demo start
7 | const { DemoWrap } = demoUtil;
8 | const Demo = () => {
9 | return (
10 |
11 | {['sm', 'md', 'lg'].map(size => (
12 |
13 |
14 |
15 | ))}
16 |
17 | );
18 | };
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/libs/rc-trigger/src/mock.js:
--------------------------------------------------------------------------------
1 | import Portal from 'rc-util/lib/Portal';
2 | import Trigger from './index';
3 |
4 | Portal.prototype.render = function () {
5 | // eslint-disable-line
6 | return this.props.children;
7 | };
8 |
9 | const render = Trigger.prototype.render;
10 |
11 | Trigger.prototype.render = function () {
12 | // eslint-disable-line
13 | const tree = render.call(this);
14 |
15 | if (this.state.popupVisible || this._component) {
16 | return tree;
17 | }
18 |
19 | return tree[0];
20 | };
21 |
22 | export default Trigger;
23 |
--------------------------------------------------------------------------------
/src/components/EditableList/EditableList.md:
--------------------------------------------------------------------------------
1 | ### 说明
2 |
3 | 这是 EditableList 可编辑列表组件
4 |
5 | ### 演示
6 |
7 | #### 普通使用
8 |
9 | ```js {"codepath": "editableList.jsx"}
10 | ```
11 |
12 | #### addition - 添加
13 |
14 | ```js {"codepath": "addition.jsx"}
15 | ```
16 |
17 | #### itemDeletion - 项删除
18 |
19 | ```js {"codepath": "itemDeletion.jsx"}
20 | ```
21 |
22 | #### grid - 布局
23 |
24 | ```js {"codepath": "grid.jsx"}
25 | ```
26 |
27 | #### size - 空间尺寸
28 |
29 | ```js {"codepath": "size.jsx"}
30 | ```
31 |
32 | #### demo - 案例演示
33 |
34 | ```js {"codepath": "demo.jsx"}
35 | ```
36 |
--------------------------------------------------------------------------------
/src/components/LocaleProvider/__demo__/localefile.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import LocaleProvider from 'src/components/LocaleProvider';
4 | import Pagination from 'src/components/Pagination';
5 | import ENLocale from 'src/components/LocaleProvider/locale/en_US';
6 |
7 | // demo start
8 | const Demo = () => (
9 |
14 | );
15 | // demo end
16 |
17 | export default Demo;
18 |
--------------------------------------------------------------------------------
/src/components/Message/__demo__/message.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import Message from 'src/components/Message';
4 |
5 | // demo start
6 | const { StyleType } = Message;
7 | const Demo = () => {
8 | return (
9 |
10 | {StyleType.map(styleType => (
11 |
12 | this is a message
} />
13 |
14 | ))}
15 |
16 | );
17 | };
18 | // demo end
19 |
20 | export default Demo;
21 |
--------------------------------------------------------------------------------
/src/components/Switch/__demo__/disabled.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Switch from 'src/components/Switch';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/.recodo/data/ZForm.info.json:
--------------------------------------------------------------------------------
1 | {
2 | "ZForm": {
3 | "path": "ZForm/ZForm.jsx",
4 | "name": "ZForm",
5 | "info": {
6 | "description": "",
7 | "displayName": "ZForm",
8 | "methods": [],
9 | "props": {
10 | "form": {
11 | "type": { "name": "custom", "raw": "formShape" },
12 | "required": false,
13 | "description": { "description": "formDecorator生成的form实例", "tags": [] }
14 | }
15 | }
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/shared/DemoBlock.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 | import PropTypes from 'prop-types';
4 |
5 | const DemoBlock = ({ children, className, lg, row }) => {
6 | return (
7 |
8 | {children}
9 |
10 | );
11 | };
12 | DemoBlock.propTypes = {
13 | children: PropTypes.node,
14 | className: PropTypes.string,
15 | lg: PropTypes.bool,
16 | row: PropTypes.bool
17 | };
18 | export default DemoBlock;
19 |
--------------------------------------------------------------------------------
/src/components/Input/__demo__/input-clearable.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import Input from 'src/components/Input';
4 |
5 | // demo start
6 | class Demo extends React.Component {
7 | render() {
8 | return (
9 |
17 | );
18 | }
19 | }
20 | // demo end
21 |
22 | export default Demo;
23 |
--------------------------------------------------------------------------------
/src/components/Steps/Steps.md:
--------------------------------------------------------------------------------
1 | ### 说明
2 |
3 | 这是步骤条组件
4 |
5 | ### 演示
6 |
7 | #### 演示
8 |
9 | ```js {"codepath": "steps.jsx"}
10 | ```
11 |
12 | #### steps - 步骤
13 |
14 | ```js {"codepath": "steps-steps.jsx"}
15 | ```
16 |
17 | #### status - 状态
18 |
19 | ```js {"codepath": "steps-status.jsx"}
20 | ```
21 |
22 | #### current - 当前 step
23 |
24 | ```js {"codepath": "steps-current.jsx"}
25 | ```
26 |
27 | #### vertical - 纵向 step
28 |
29 | ```js {"codepath": "steps-vertical.jsx"}
30 | ```
31 |
32 | #### onChange - 可点击 step
33 |
34 | ```js {"codepath": "steps-change.jsx"}
35 | ```
36 |
--------------------------------------------------------------------------------
/src/components/Switch/__demo__/size.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Switch from 'src/components/Switch';
3 |
4 | // demo start
5 | const { Sizes } = Switch;
6 | class Demo extends React.Component {
7 | render() {
8 | return (
9 |
10 | {Sizes.map(size => (
11 |
12 |
13 |
14 | ))}
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/.recodo/data/ConfigProvider.doc.json:
--------------------------------------------------------------------------------
1 | {
2 | "ConfigProvider": {
3 | "path": "ConfigProvider/ConfigProvider.md",
4 | "name": "ConfigProvider",
5 | "info": "### 说明\n\n这是 ConfigProvider 组件,用于统一配置应用的配置\n\n### 演示\n\n#### 普通使用\n\n```js {\"codepath\": \"demo.jsx\"}\n```\n\n#### theme - 用作定义主题\n\n```js {\"codepath\": \"theme.jsx\"}\n```\n\n#### locale - 用作定义语言\n\n```js {\"codepath\": \"locale.jsx\"}\n```\n\n#### iconDefaultPrefix - icon 默认前缀\n\n```js {\"codepath\": \"icon.jsx\"}\n```\n\n#### actionListAutoAdjustment\n\n```js {\"codepath\": \"actionList.jsx\"}\n```\n"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/components/Calendar/Calendar.md:
--------------------------------------------------------------------------------
1 | ### 说明
2 |
3 | - 这是 日历 组件
4 | - 需要自行导入 moment 语言包、设置时区
5 |
6 | ### 演示
7 |
8 | #### 普通使用
9 |
10 | ```js {"codepath": "base.jsx"}
11 | ```
12 |
13 | #### 范围
14 |
15 | ```js {"codepath": "range.jsx"}
16 | ```
17 |
18 | #### value / defaultValue - 选中的时间 (受控 / 非受控)
19 |
20 | ```js {"codepath": "controlled.jsx"}
21 | ```
22 |
23 | #### rules - 自定义规则
24 |
25 | ```js {"codepath": "rules.jsx"}
26 | ```
27 |
28 | #### month - 月历
29 |
30 | ```js {"codepath": "month.jsx"}
31 | ```
32 |
33 | #### 组合
34 |
35 | ```js {"codepath": "twoside.jsx"}
36 | ```
37 |
--------------------------------------------------------------------------------
/src/components/Input/__demo__/input-size.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import Input from 'src/components/Input';
4 |
5 | // demo start
6 | const { Sizes } = Input;
7 | class Demo extends React.Component {
8 | render() {
9 | return (
10 |
11 | {Sizes.map(size => (
12 |
13 |
14 |
15 | ))}
16 |
17 | );
18 | }
19 | }
20 | // demo end
21 |
22 | export default Demo;
23 |
--------------------------------------------------------------------------------
/src/components/Input/__demo__/input-status.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import Input from 'src/components/Input';
4 |
5 | // demo start
6 | class Demo extends React.Component {
7 | render() {
8 | return (
9 |
17 | );
18 | }
19 | }
20 | // demo end
21 |
22 | export default Demo;
23 |
--------------------------------------------------------------------------------
/src/components/LocaleProvider/LocaleProvider.tsx:
--------------------------------------------------------------------------------
1 | import React, { ReactNode, useEffect } from 'react';
2 |
3 | import { setRuntimeLocale } from './runtime';
4 | import LocaleContext, { AllLocaleMap } from './LocaleContext';
5 |
6 | const LocaleProvider = ({ locale = {}, children }: { locale: AllLocaleMap; children: ReactNode }) => {
7 | useEffect(() => {
8 | setRuntimeLocale(locale);
9 | }, [locale]);
10 | return {React.Children.only(children)};
11 | };
12 |
13 | export default React.memo(LocaleProvider);
14 |
--------------------------------------------------------------------------------
/src/components/Switch/__demo__/checked.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Switch from 'src/components/Switch';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/Tabs/shared.ts:
--------------------------------------------------------------------------------
1 | import { ReactElement } from 'react';
2 |
3 | import { tuple } from 'src/style';
4 |
5 | import { TabPaneProps } from './Pane';
6 |
7 | export const TabBarPositions = tuple('top', 'bottom', 'left', 'right');
8 | export const StyleTypes = tuple('default', 'ink', 'pure');
9 | export const Sizes = tuple('sm', 'md', 'lg');
10 | export type TabBarPosition = typeof TabBarPositions[number];
11 | export type StyleType = typeof StyleTypes[number];
12 | export type Size = typeof Sizes[number];
13 | export type Panes = { pane: ReactElement; key: string }[];
14 |
--------------------------------------------------------------------------------
/src/components/Textarea/__demo__/disabled.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Textarea from 'src/components/Textarea';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/.recodo/data/Tooltip.doc.json:
--------------------------------------------------------------------------------
1 | {
2 | "Tooltip": {
3 | "path": "Tooltip/Tooltip.md",
4 | "name": "Tooltip",
5 | "info": "### 说明\n\n- Tooltip 基于 Popover,增加了箭头样式,支持所有 Popover 的 props,其它 props 的定义和注意事项参考 Popover 文档\n- 主要用于包裹一些展示性的提示\n\n### 演示\n\n#### 演示\n\n```js {\"codepath\": \"tooltip.jsx\"}\n```\n\n#### theme - 主题\n\n```js {\"codepath\": \"theme.jsx\"}\n```\n\n#### arrow - 箭头\n\n```js {\"codepath\": \"arrow.jsx\"}\n```\n\n#### placement - 位置\n\n```js {\"codepath\": \"placement.jsx\"}\n```\n\n#### style - 修改提示文案宽度\n\n```js {\"codepath\": \"style.jsx\"}\n```\n"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/components/Button/__demo__/loading.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import Button from 'src/components/Button';
4 |
5 | // demo start
6 | const Demo = () => {
7 | return (
8 |
9 |
12 |
15 | );
16 | };
17 | // demo end
18 |
19 | export default Demo;
20 |
--------------------------------------------------------------------------------
/src/components/Input/__demo__/search-disabled.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Input from 'src/components/Input';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/Input/__demo__/search-size.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Input from 'src/components/Input';
3 |
4 | // demo start
5 | const { Sizes } = Input;
6 | class Demo extends React.Component {
7 | render() {
8 | return (
9 |
10 | {Sizes.map(size => (
11 |
12 |
13 |
14 | ))}
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/Switch/__demo__/uncontrolled.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Switch from 'src/components/Switch';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/libs/dom-align/getElFuturePos.js:
--------------------------------------------------------------------------------
1 | import getAlignOffset from './getAlignOffset';
2 |
3 | function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) {
4 | const p1 = getAlignOffset(refNodeRegion, points[1]);
5 | const p2 = getAlignOffset(elRegion, points[0]);
6 | const diff = [p2.left - p1.left, p2.top - p1.top];
7 |
8 | return {
9 | left: Math.round(elRegion.left - diff[0] + offset[0] - targetOffset[0]),
10 | top: Math.round(elRegion.top - diff[1] + offset[1] - targetOffset[1])
11 | };
12 | }
13 |
14 | export default getElFuturePos;
15 |
--------------------------------------------------------------------------------
/.recodo/data/Steps.doc.json:
--------------------------------------------------------------------------------
1 | {
2 | "Steps": {
3 | "path": "Steps/Steps.md",
4 | "name": "Steps",
5 | "info": "### 说明\n\n这是步骤条组件\n\n### 演示\n\n#### 演示\n\n```js {\"codepath\": \"steps.jsx\"}\n```\n\n#### steps - 步骤\n\n```js {\"codepath\": \"steps-steps.jsx\"}\n```\n\n#### status - 状态\n\n```js {\"codepath\": \"steps-status.jsx\"}\n```\n\n#### current - 当前 step\n\n```js {\"codepath\": \"steps-current.jsx\"}\n```\n\n#### vertical - 纵向 step\n\n```js {\"codepath\": \"steps-vertical.jsx\"}\n```\n\n#### onChange - 可点击 step\n\n```js {\"codepath\": \"steps-change.jsx\"}\n```\n"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/components/Switch/__demo__/onTextAndOffText.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Switch from 'src/components/Switch';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/Tag/Tag.md:
--------------------------------------------------------------------------------
1 | ### 说明
2 |
3 | 这是 Tag 组件,用作属性标签等标识
4 |
5 | ### 演示
6 |
7 | #### 功能演示
8 |
9 | ```js {"codepath": "tag.jsx"}
10 | ```
11 |
12 | #### 样式风格 - styleType
13 |
14 | ```js {"codepath": "tag-styleType.jsx"}
15 | ```
16 |
17 | #### 是否可关闭 - closable
18 |
19 | ```js {"codepath": "tag-closable.jsx"}
20 | ```
21 |
22 | #### 是否禁用 - disabled
23 |
24 | ```js {"codepath": "tag-disabled.jsx"}
25 | ```
26 |
27 | #### 自定义 icon - icon
28 |
29 | ```js {"codepath": "tag-icon.jsx"}
30 | ```
31 |
32 | #### 自定义样式 - customStyle
33 |
34 | ```js {"codepath": "tag-customStyle.jsx"}
35 | ```
36 |
--------------------------------------------------------------------------------
/src/components/Textarea/Textarea.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | import { TextareaWrap } from './style';
5 |
6 | // TODO: autoSize https://github.com/ant-design/ant-design/blob/master/components/input/calculateNodeHeight.tsx
7 |
8 | class Textarea extends Component {
9 | static propTypes = {
10 | /** @ignore */
11 | className: PropTypes.string
12 | };
13 | render() {
14 | const { ...rest } = this.props;
15 | return ;
16 | }
17 | }
18 |
19 | export default Textarea;
20 |
--------------------------------------------------------------------------------
/src/components/Card/SubArea.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | import { SubAreaWrap, titleCls, subAreaContentCls } from './style';
5 |
6 | const SubArea = ({ title, children, ...rest }) => {
7 | return (
8 |
9 | {title}
10 | {children}
11 |
12 | );
13 | };
14 | SubArea.propTypes = {
15 | title: PropTypes.node,
16 | children: PropTypes.node
17 | };
18 |
19 | export default React.memo(SubArea);
20 |
--------------------------------------------------------------------------------
/src/components/Combine/__demo__/null.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import Combine from 'src/components/Combine';
4 | import Input from 'src/components/Input';
5 |
6 | // demo start
7 | const Demo = () => (
8 |
9 |
10 |
11 | {undefined}
12 |
13 | {null}
14 | {undefined}
15 | {''}
16 | {false}
17 |
18 |
19 |
20 | );
21 | // demo end
22 |
23 | export default Demo;
24 |
--------------------------------------------------------------------------------
/src/components/NumberInput/__demo__/disabled.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import NumberInput from 'src/components/NumberInput';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/NumberInput/__demo__/readOnly.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import NumberInput from 'src/components/NumberInput';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/Steps/Link.jsx:
--------------------------------------------------------------------------------
1 | import React, { PureComponent } from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | import { LinkWrapper, Icon } from './style';
5 |
6 | export default class Step extends PureComponent {
7 | static propTypes = {
8 | status: PropTypes.oneOf(['before', 'after'])
9 | };
10 |
11 | render() {
12 | const { status, ...rest } = this.props;
13 | return (
14 |
15 |
16 |
17 | );
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/components/Upload/icons/Docs.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import SvgIconWrap from 'src/components/SvgIcon/SvgIconWrap';
4 |
5 | export default function Docs(props) {
6 | return (
7 |
8 |
9 |
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/.recodo/data/Calendar.doc.json:
--------------------------------------------------------------------------------
1 | {
2 | "Calendar": {
3 | "path": "Calendar/Calendar.md",
4 | "name": "Calendar",
5 | "info": "### 说明\n\n- 这是 日历 组件\n- 需要自行导入 moment 语言包、设置时区\n\n### 演示\n\n#### 普通使用\n\n```js {\"codepath\": \"base.jsx\"}\n```\n\n#### 范围\n\n```js {\"codepath\": \"range.jsx\"}\n```\n\n#### value / defaultValue - 选中的时间 (受控 / 非受控)\n\n```js {\"codepath\": \"controlled.jsx\"}\n```\n\n#### rules - 自定义规则\n\n```js {\"codepath\": \"rules.jsx\"}\n```\n\n#### month - 月历\n\n```js {\"codepath\": \"month.jsx\"}\n```\n\n#### 组合\n\n```js {\"codepath\": \"twoside.jsx\"}\n```\n"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/.recodo/data/Textarea.info.json:
--------------------------------------------------------------------------------
1 | {
2 | "Textarea": {
3 | "path": "Textarea/Textarea.jsx",
4 | "name": "Textarea",
5 | "info": {
6 | "description": "",
7 | "displayName": "Textarea",
8 | "methods": [],
9 | "props": {
10 | "className": {
11 | "type": { "name": "string" },
12 | "required": false,
13 | "description": { "description": "", "tags": [{ "title": "ignore", "description": null }] }
14 | }
15 | }
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/components/NumberInput/__demo__/hideHandler.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import NumberInput from 'src/components/NumberInput';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/NumberInput/__demo__/step.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import NumberInput from 'src/components/NumberInput';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/Pagination/__demo__/total.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Pagination from 'src/components/Pagination';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/decorators/__tests__/index.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import uncontrolled from 'src/decorators/uncontrolled';
4 |
5 | describe('uncontrolled', () => {
6 | test('uncontrolled warn', () => {
7 | const error = (global.console.error = jest.fn());
8 | @uncontrolled()
9 | class A extends React.Component {
10 | render() {
11 | return ;
12 | }
13 | }
14 | // expect(error).toHaveBeenCalledTimes(1);
15 | // expect(error).toHaveBeenLastCalledWith('Must have at least one option');
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/.recodo/componentDemos/Notice.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Notice, Box, NoticeStyleType } from '@ucloud-fe/react-components';
3 |
4 | const styleTypes: NoticeStyleType[] = ['default', 'success', 'warning', 'error', 'disabled'];
5 |
6 | const Demo = () => {
7 | return (
8 |
9 | {styleTypes.map(styleType => (
10 |
11 | 提示文本
12 |
13 | ))}
14 |
15 | );
16 | };
17 |
18 | export default React.memo(Demo);
19 |
--------------------------------------------------------------------------------
/.recodo/data/EditableList.doc.json:
--------------------------------------------------------------------------------
1 | {
2 | "EditableList": {
3 | "path": "EditableList/EditableList.md",
4 | "name": "EditableList",
5 | "info": "### 说明\n\n这是 EditableList 可编辑列表组件\n\n### 演示\n\n#### 普通使用\n\n```js {\"codepath\": \"editableList.jsx\"}\n```\n\n#### addition - 添加\n\n```js {\"codepath\": \"addition.jsx\"}\n```\n\n#### itemDeletion - 项删除\n\n```js {\"codepath\": \"itemDeletion.jsx\"}\n```\n\n#### grid - 布局\n\n```js {\"codepath\": \"grid.jsx\"}\n```\n\n#### size - 空间尺寸\n\n```js {\"codepath\": \"size.jsx\"}\n```\n\n#### demo - 案例演示\n\n```js {\"codepath\": \"demo.jsx\"}\n```\n"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/.recodo/data/EditableTable.doc.json:
--------------------------------------------------------------------------------
1 | {
2 | "EditableTable": {
3 | "path": "EditableTable/EditableTable.md",
4 | "name": "EditableTable",
5 | "info": "### 说明\n\n- 这是 EditableTable 组件,主要用于列表项的编辑删除\n- 与表格的区别\n 1. pagination 固定为 null\n 2. emptyContent 固定为 null\n 3. columns 中添加了删除列\n- 其余属性与 Table 保持一致\n\n### 演示\n\n#### 普通使用\n\n```js {\"codepath\": \"editableTable.jsx\"}\n```\n\n#### addition - 添加\n\n```js {\"codepath\": \"addition.jsx\"}\n```\n\n#### rowDeletion - 删除\n\n```js {\"codepath\": \"rowDeletion.jsx\"}\n```\n\n#### 样例演示\n\n```js {\"codepath\": \"demo.jsx\"}\n```\n"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/components/Card/Card.md:
--------------------------------------------------------------------------------
1 | ### 说明
2 |
3 | - 该组件主要用于卡片式布局,包含 Header、Action、Footer、Content 四个子组件。
4 | - 由于 Card 外层具有 overflow,内部的弹层会被遮挡错位,现通过 Context 来解决,在 Card 内部的弹层将会自动使用 Card 的 parentNode 作为容器,可参考下方容器测试 demo
5 |
6 | ### 演示
7 |
8 | #### 普通使用
9 |
10 | ```js {"codepath": "card.jsx"}
11 | ```
12 |
13 | #### 列表展示
14 |
15 | ```js {"codepath": "list.jsx"}
16 | ```
17 |
18 | #### 自定义顺序等
19 |
20 | ```js {"codepath": "custom.jsx"}
21 | ```
22 |
23 | #### 拆分展示
24 |
25 | ```js {"codepath": "single.jsx"}
26 | ```
27 |
28 | #### popupContainer - 容器测试
29 |
30 | ```js {"codepath": "popupContainer.jsx"}
31 | ```
32 |
--------------------------------------------------------------------------------
/src/components/Card/Header.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | import { HeaderWrap, TitleWrap, CommentWrap } from './style';
5 |
6 | const Header = ({ comment, children, ...rest }) => {
7 | return (
8 |
9 | {children}
10 | {comment}
11 |
12 | );
13 | };
14 |
15 | Header.propTypes = {
16 | /** 小标题,注解 */
17 | comment: PropTypes.node,
18 | /** @ignore */
19 | children: PropTypes.node
20 | };
21 |
22 | export default Header;
23 |
--------------------------------------------------------------------------------
/src/components/DatePicker/__demo__/datepicker-disabled.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import DatePicker from 'src/components/DatePicker';
4 |
5 | // demo start
6 | class Demo extends React.Component {
7 | render() {
8 | return (
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | );
18 | }
19 | }
20 | // demo end
21 |
22 | export default Demo;
23 |
--------------------------------------------------------------------------------
/src/components/DatePicker/__demo__/datepicker-nullable.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import DatePicker from 'src/components/DatePicker';
4 |
5 | // demo start
6 | class Demo extends React.Component {
7 | render() {
8 | return (
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | );
18 | }
19 | }
20 | // demo end
21 |
22 | export default Demo;
23 |
--------------------------------------------------------------------------------
/src/components/DatePicker/__demo__/range-disabled.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import DatePicker from 'src/components/DatePicker';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/DatePicker/__demo__/range-size.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import DatePicker from 'src/components/DatePicker';
3 |
4 | // demo start
5 | const { Sizes } = DatePicker;
6 | class Demo extends React.Component {
7 | render() {
8 | return (
9 |
10 | {Sizes.map(size => (
11 |
12 |
13 |
14 | ))}
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/Form/__demo__/item-required.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import Form from 'src/components/Form';
4 | import Input from 'src/components/Input';
5 |
6 | // demo start
7 | const { Item } = Form;
8 | const horizontalLayout = {
9 | labelCol: {
10 | span: 3
11 | },
12 | controllerCol: {
13 | span: 9
14 | }
15 | };
16 | const Demo = () => (
17 |
22 | );
23 | // demo end
24 |
25 | export default Demo;
26 |
--------------------------------------------------------------------------------
/src/components/Popover/ContainerContext.tsx:
--------------------------------------------------------------------------------
1 | import React, { createContext, ProviderProps, useContext } from 'react';
2 |
3 | interface Context {
4 | getPopupContainer?: (trigger: HTMLElement) => HTMLElement;
5 | }
6 | const ContainerContext = createContext({});
7 |
8 | export default ContainerContext;
9 |
10 | export const { Consumer, Provider } = ContainerContext;
11 |
12 | export const InheritProvider = ({ value, ...props }: ProviderProps) => {
13 | const context = useContext(ContainerContext);
14 | return ;
15 | };
16 |
--------------------------------------------------------------------------------
/src/components/Checkbox/Checkbox.md:
--------------------------------------------------------------------------------
1 | ### 说明
2 |
3 | - 这是 checkbox 勾选框组件
4 |
5 | ### 演示
6 |
7 | #### 演示
8 |
9 | ```js {"codepath": "checkbox.jsx"}
10 | ```
11 |
12 | #### checked - 是否勾选
13 |
14 | ```js {"codepath": "checkbox-checked.jsx"}
15 | ```
16 |
17 | #### disabled - 禁用
18 |
19 | ```js {"codepath": "checkbox-disabled.jsx"}
20 | ```
21 |
22 | #### size - 尺寸
23 |
24 | ```js {"codepath": "checkbox-size.jsx"}
25 | ```
26 |
27 | #### styleType - 样式风格
28 |
29 | ```js {"codepath": "checkbox-styleType.jsx"}
30 | ```
31 |
32 | #### uncontrolled
33 |
34 | ```js {"codepath": "checkbox-uncontrolled.jsx"}
35 | ```
36 |
--------------------------------------------------------------------------------
/src/components/Checkbox/__demo__/checkbox-size.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Checkbox from 'src/components/Checkbox';
3 |
4 | // demo start
5 | const { Size } = Checkbox;
6 | class Demo extends React.Component {
7 | render() {
8 | return (
9 |
10 | {Size.map(size => (
11 |
12 | checkbox
13 |
14 | ))}
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/DatePicker/__demo__/datepicker-size.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import DatePicker from 'src/components/DatePicker';
4 |
5 | // demo start
6 | const { Sizes } = DatePicker;
7 | class Demo extends React.Component {
8 | render() {
9 | return (
10 |
11 | {Sizes.map(size => (
12 |
13 |
14 |
15 | ))}
16 |
17 | );
18 | }
19 | }
20 | // demo end
21 |
22 | export default Demo;
23 |
--------------------------------------------------------------------------------
/src/components/DatePicker/__demo__/datepicker-status.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import DatePicker from 'src/components/DatePicker';
4 |
5 | // demo start
6 | class Demo extends React.Component {
7 | render() {
8 | return (
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | );
18 | }
19 | }
20 | // demo end
21 |
22 | export default Demo;
23 |
--------------------------------------------------------------------------------
/src/components/Form/__demo__/item-help.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import Form from 'src/components/Form';
4 | import Input from 'src/components/Input';
5 |
6 | // demo start
7 | const { Item } = Form;
8 | const horizontalLayout = {
9 | labelCol: {
10 | span: 3
11 | },
12 | controllerCol: {
13 | span: 9
14 | }
15 | };
16 | const Demo = () => (
17 |
22 | );
23 | // demo end
24 |
25 | export default Demo;
26 |
--------------------------------------------------------------------------------
/src/components/Icon/__demo__/type.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Icon from 'src/components/Icon';
3 |
4 | // demo start
5 | const layout = {
6 | style: {
7 | marginRight: 10
8 | }
9 | };
10 | const Demo = () => (
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | );
20 | // demo end
21 |
22 | export default Demo;
23 |
--------------------------------------------------------------------------------
/src/components/Input/__demo__/input-icon.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Input from 'src/components/Input';
3 |
4 | // demo start
5 | const IconType = ['circle-fill', 'circle', 'loading'];
6 | class Demo extends React.Component {
7 | render() {
8 | return (
9 |
10 | {IconType.map(icon => (
11 |
12 |
13 |
14 | ))}
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/Pagination/__demo__/simple.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Pagination from 'src/components/Pagination';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/SvgIcon/icons/Sort.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export default React.memo(() => (
4 |
5 | ));
6 |
--------------------------------------------------------------------------------
/src/components/DatePicker/__demo__/datepicker-uncontrolled.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import DatePicker from 'src/components/DatePicker';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/DatePicker/__demo__/month-size.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import DatePicker from 'src/components/DatePicker';
3 |
4 | // demo start
5 | const { Sizes } = DatePicker;
6 | class Demo extends React.Component {
7 | render() {
8 | return (
9 |
10 | {Sizes.map(size => (
11 |
12 |
13 |
14 | ))}
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/DatePicker/__demo__/range-status.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import DatePicker from 'src/components/DatePicker';
4 |
5 | // demo start
6 | class Demo extends React.Component {
7 | render() {
8 | return (
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | );
18 | }
19 | }
20 | // demo end
21 |
22 | export default Demo;
23 |
--------------------------------------------------------------------------------
/src/components/Tooltip/__demo__/theme.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import Tooltip from 'src/components/Tooltip';
4 | import Button from 'src/components/Button';
5 |
6 | // demo start
7 | const { Theme } = Tooltip;
8 |
9 | const Demo = () => (
10 |
11 | {Theme.map(theme => (
12 |
13 |
14 | Hover
15 |
16 |
17 | ))}
18 |
19 | );
20 | // demo end
21 |
22 | export default Demo;
23 |
--------------------------------------------------------------------------------
/src/components/Checkbox/__demo__/checkbox-checked.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Checkbox from 'src/components/Checkbox';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 | unchecked
11 |
12 |
13 | checked
14 |
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/Checkbox/__demo__/checkbox-disabled.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Checkbox from 'src/components/Checkbox';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 | common
11 |
12 |
13 | disabled
14 |
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/Collapse/Panel.md:
--------------------------------------------------------------------------------
1 | ### 说明
2 |
3 | Collapse 的子组件
4 |
5 | ### 演示
6 |
7 | #### 普通使用
8 |
9 | ```js {"codepath": "panel.jsx"}
10 | ```
11 |
12 | #### disabled - 禁用
13 |
14 | ```js {"codepath": "panel-disabled.jsx"}
15 | ```
16 |
17 | #### forceRender - 强制渲染
18 |
19 | ```js {"codepath": "panel-forceRender.jsx"}
20 | ```
21 |
22 | #### custom title - 自定义 title
23 |
24 | ```js {"codepath": "panel-customTitle.jsx"}
25 | ```
26 |
27 | #### uncontrolled
28 |
29 | ```js {"codepath": "panel-uncontrolled.jsx"}
30 | ```
31 |
32 | #### titlePosition - 标题位置
33 |
34 | ```js {"codepath": "panel-titlePosition.jsx"}
35 | ```
36 |
--------------------------------------------------------------------------------
/src/components/DatePicker/__demo__/month-disabled.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import DatePicker from 'src/components/DatePicker';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/DatePicker/locale/zh_CN.js:
--------------------------------------------------------------------------------
1 | export default {
2 | custom: '自定义',
3 | inputErrorTip: '输入不是有效值',
4 | dateErrorTip: '当前值不合法',
5 | nullableErrorTip: '不能为空',
6 | chooseTodayNow: '今时此刻',
7 | chooseThisMonth: '本月',
8 | rangeErrorTip: '超出可选择范围',
9 | maxRangeErrorTip: '超出最大范围',
10 | minRangeErrorTip: '小于最小范围',
11 | startGreaterThanEndTip: '起始时间不得大于结束时间',
12 | confirm: '确定',
13 | placeholder: '选择日期',
14 | placeholderRangeStart: '开始时间',
15 | placeholderRangeEnd: '结束时间',
16 | chooseTipRangeStart: '选择开始时间',
17 | chooseTipRangeEnd: '选择结束时间',
18 | to: '至'
19 | };
20 |
--------------------------------------------------------------------------------
/src/components/Pagination/__demo__/showLessItems.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Pagination from 'src/components/Pagination';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/Pagination/__demo__/showTitle.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Pagination from 'src/components/Pagination';
3 |
4 | // demo start
5 | class Demo extends React.Component {
6 | render() {
7 | return (
8 |
16 | );
17 | }
18 | }
19 | // demo end
20 |
21 | export default Demo;
22 |
--------------------------------------------------------------------------------
/src/components/Radio/__demo__/group-uncontrolled.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Radio from 'src/components/Radio';
3 |
4 | // demo start
5 | const options = [1, 2, 3];
6 | const Demo = () => (
7 |
8 |
9 | ({ value: v }))} />
10 |
11 |
12 | ({ value: v }))} />
13 |
14 |
15 | );
16 | // demo end
17 |
18 | export default Demo;
19 |
--------------------------------------------------------------------------------
/.recodo/data/Card.doc.json:
--------------------------------------------------------------------------------
1 | {
2 | "Card": {
3 | "path": "Card/Card.md",
4 | "name": "Card",
5 | "info": "### 说明\n\n- 该组件主要用于卡片式布局,包含 Header、Action、Footer、Content 四个子组件。\n- 由于 Card 外层具有 overflow,内部的弹层会被遮挡错位,现通过 Context 来解决,在 Card 内部的弹层将会自动使用 Card 的 parentNode 作为容器,可参考下方容器测试 demo\n\n### 演示\n\n#### 普通使用\n\n```js {\"codepath\": \"card.jsx\"}\n```\n\n#### 列表展示\n\n```js {\"codepath\": \"list.jsx\"}\n```\n\n#### 自定义顺序等\n\n```js {\"codepath\": \"custom.jsx\"}\n```\n\n#### 拆分展示\n\n```js {\"codepath\": \"single.jsx\"}\n```\n\n#### popupContainer - 容器测试\n\n```js {\"codepath\": \"popupContainer.jsx\"}\n```\n"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/components/DatePicker/__demo__/month-nullable.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import DatePicker from 'src/components/DatePicker';
4 |
5 | // demo start
6 | class Demo extends React.Component {
7 | render() {
8 | return (
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | );
18 | }
19 | }
20 | // demo end
21 |
22 | export default Demo;
23 |
--------------------------------------------------------------------------------