diff --git a/mock/menu.js b/mock/menu.js index e4f3e0d..3f8fe1a 100644 --- a/mock/menu.js +++ b/mock/menu.js @@ -42,22 +42,6 @@ let database = [ name: 'UI Element', icon: 'camera-o', }, - { - id: '41', - bpid: '4', - mpid: '4', - name: 'IconFont', - icon: 'heart-o', - route: '/UIElement/iconfont', - }, - { - id: '42', - bpid: '4', - mpid: '4', - name: 'DataTable', - icon: 'database', - route: '/UIElement/dataTable', - }, { id: '43', bpid: '4', @@ -66,30 +50,14 @@ let database = [ icon: 'bars', route: '/UIElement/dropOption', }, - { - id: '44', - bpid: '4', - mpid: '4', - name: 'Search', - icon: 'search', - route: '/UIElement/search', - }, { id: '45', bpid: '4', mpid: '4', - name: '56pxor', + name: 'Editor', icon: 'edit', route: '/UIElement/editor', }, - { - id: '46', - bpid: '4', - mpid: '4', - name: 'layer (Function)', - icon: 'credit-card', - route: '/UIElement/layer', - }, { id: '5', bpid: '1', diff --git a/src/components/DataTable/DataTable.js b/src/components/DataTable/DataTable.js deleted file mode 100644 index cd7c002..0000000 --- a/src/components/DataTable/DataTable.js +++ /dev/null @@ -1,118 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' -import { Table } from 'antd' -import { request } from 'utils' -import cloneDeep from 'lodash.clonedeep' -import isEqual from 'lodash.isequal' - -class DataTable extends React.Component { - constructor (props) { - super(props) - const { - dataSource, - pagination = { - showSizeChanger: true, - showQuickJumper: true, - showTotal: total => `共 ${total} 条`, - current: 1, - total: 100, - }, - } = props - this.state = { - loading: false, - dataSource, - fetchData: {}, - pagination, - } - } - - componentDidMount () { - if (this.props.fetch) { - this.fetch() - } - } - - UNSAFE_componentWillReceiveProps (nextProps) { - const staticNextProps = cloneDeep(nextProps) - delete staticNextProps.columns - const { columns, ...otherProps } = this.props - - if (!isEqual(staticNextProps, otherProps)) { - this.props = nextProps - this.fetch() - } - } - - handleTableChange = (pagination, filters, sorter) => { - const pager = this.state.pagination - pager.current = pagination.current - this.setState( - { - pagination: pager, - fetchData: { - results: pagination.pageSize, - page: pagination.current, - sortField: sorter.field, - sortOrder: sorter.order, - ...filters, - }, - }, - () => { - this.fetch() - } - ) - } - - fetch = () => { - const { - fetch: { url, data, dataKey }, - } = this.props - const { fetchData } = this.state - this.setState({ loading: true }) - this.promise = request({ - url, - data: { - ...data, - ...fetchData, - }, - }).then(result => { - if (!this.refs.DataTable) { - return - } - const { pagination } = this.state - pagination.total = result.total || pagination.total - this.setState({ - loading: false, - dataSource: dataKey ? result[dataKey] : result.data, - pagination, - }) - }) - } - - render () { - const { fetch, ...tableProps } = this.props - const { loading, dataSource, pagination } = this.state - - return ( - - ) - } -} - -DataTable.propTypes = { - fetch: PropTypes.object, - rowKey: PropTypes.string, - pagination: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]), - columns: PropTypes.array, - dataSource: PropTypes.array, -} - -export default DataTable diff --git a/src/components/DataTable/package.json b/src/components/DataTable/package.json deleted file mode 100644 index 9272c27..0000000 --- a/src/components/DataTable/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "DataTable", - "version": "0.0.0", - "private": true, - "main": "./DataTable.js" -} diff --git a/src/components/Search/Search.js b/src/components/Search/Search.js deleted file mode 100644 index 1c2fe26..0000000 --- a/src/components/Search/Search.js +++ /dev/null @@ -1,96 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' -import ReactDOM from 'react-dom' -import { Input, Select, Button, Icon } from 'antd' -import styles from './Search.less' - -class Search extends React.Component { - state = { - clearVisible: false, - selectValue: - this.props.select && this.props.selectProps - ? this.props.selectProps.defaultValue - : '', - } - handleSearch = () => { - const data = { - keyword: ReactDOM.findDOMNode(this.refs.searchInput).value, - } - if (this.props.select) { - data.field = this.state.selectValue - } - if (this.props.onSearch) this.props.onSearch(data) - } - handleInputChange = e => { - this.setState({ - ...this.state, - clearVisible: e.target.value !== '', - }) - } - handleSelectChange = value => { - this.setState({ - ...this.state, - selectValue: value, - }) - } - handleClearInput = () => { - ReactDOM.findDOMNode(this.refs.searchInput).value = '' - this.setState({ - clearVisible: false, - }) - this.handleSearch() - } - render () { - const { - size, - select, - selectOptions, - selectProps, - style, - keyword, - } = this.props - const { clearVisible } = this.state - return ( - - {select && ( - - )} - - - {clearVisible && } - - ) - } -} - -Search.propTypes = { - size: PropTypes.string, - select: PropTypes.bool, - selectProps: PropTypes.object, - onSearch: PropTypes.func, - selectOptions: PropTypes.array, - style: PropTypes.object, - keyword: PropTypes.string, -} - -export default Search diff --git a/src/components/Search/Search.less b/src/components/Search/Search.less deleted file mode 100644 index 4b00801..0000000 --- a/src/components/Search/Search.less +++ /dev/null @@ -1,54 +0,0 @@ -.no-highlight() { - border-color: #e5e5e5; - box-shadow: none; -} - -.search { - display: flex !important; - width: 100%; - position: relative; - - :global { - .anticon-cross { - position: absolute; - width: 18px; - height: 18px; - right: 84px; - cursor: pointer; - color: #fff; - line-height: 18px; - border-radius: 50% !important; - background-color: rgba(0, 0, 0, 0.16); - top: 7px; - } - - .ant-select { - width: 80px; - flex-shrink: 0; - flex-grow: 0; - - &.ant-select-focused .ant-select-selection, - &.ant-select-open .ant-select-selection, - .ant-select-selection:active, - .ant-select-selection:focus, - .ant-select-selection:hover { - .no-highlight(); - } - } - - .ant-input { - &:focus, - &:hover { - .no-highlight(); - } - flex-shrink: 1; - flex-grow: 1; - } - - .ant-btn { - width: 80px; - flex-shrink: 0; - flex-grow: 0; - } - } -} diff --git a/src/components/Search/package.json b/src/components/Search/package.json deleted file mode 100644 index d5a3a52..0000000 --- a/src/components/Search/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Search", - "version": "0.0.0", - "private": true, - "main": "./Search.js" -} diff --git a/src/components/index.js b/src/components/index.js index 42ffc9f..877281b 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -1,22 +1,15 @@ -import DataTable from './DataTable' -import DropOption from './DropOption' -import Search from './Search' import Editor from './Editor' import FilterItem from './FilterItem' +import DropOption from './DropOption' import Loader from './Loader' import * as MyLayout from './Layout/index.js' import Page from './Page' -import layer from './layer' - export { MyLayout, - DataTable, - DropOption, - Search, Editor, FilterItem, + DropOption, Loader, - layer, Page, } diff --git a/src/components/layer/layer.js b/src/components/layer/layer.js deleted file mode 100644 index 1e9e650..0000000 --- a/src/components/layer/layer.js +++ /dev/null @@ -1,95 +0,0 @@ -/* global document */ -import { Modal, message } from 'antd' -import React from 'react' -import ReactDOM from 'react-dom' -import classnames from 'classnames' -import styles from './layer.less' - -const { info, success, error, warning, confirm } = Modal - -const layer = { - prefixCls: 'ant-layer', - index: 1, - info, - success, - error, - warning, - confirm, -} - -layer.close = index => - new Promise((resolve, reject) => { - const { prefixCls } = layer - let div = document.getElementById(`${prefixCls}-reference-${index}`) - if (index === undefined) { - const references = document.querySelectorAll(`.${prefixCls}-reference`) - div = references[references.length - 1] - } - if (!div) { - message.error('关闭失败,未找到Dom') - return - } - const unmountResult = ReactDOM.unmountComponentAtNode(div) - if (unmountResult && div.parentNode) { - div.parentNode.removeChild(div) - resolve(index) - } else { - reject(index) - } - }) - -layer.closeAll = () => { - const { prefixCls } = layer - const references = document.querySelectorAll(`.${prefixCls}-reference`) - let i = 0 - while (i < references.length) { - layer.close() - i += 1 - } -} - -layer.open = config => { - const props = Object.assign({}, config) - const { content, ...modalProps } = props - const { className, wrapClassName = '', verticalCenter = true } = modalProps - const { prefixCls } = layer - layer.index += 1 - const { index } = layer - let div = document.createElement('div') - div.id = `${prefixCls}-reference-${index}` - div.className = `${prefixCls}-reference` - document.body.appendChild(div) - - ReactDOM.render( - { - layer.close(index) - }} - onOk={() => { - layer.close(index) - }} - {...modalProps} - wrapClassName={classnames({ - [styles.verticalCenter]: verticalCenter, - [wrapClassName]: true, - })} - className={classnames(prefixCls, className, [`${prefixCls}-${index}`])} - > -
- {content} -
-
, - div - ) - - return index -} - -export default layer diff --git a/src/components/layer/layer.less b/src/components/layer/layer.less deleted file mode 100644 index 4350c20..0000000 --- a/src/components/layer/layer.less +++ /dev/null @@ -1,14 +0,0 @@ -.verticalCenter { - display: flex; - align-items: center; - justify-content: center; - - :global .ant-modal { - top: 0; - padding-bottom: 0; - - .ant-modal-body { - overflow-y: auto; - } - } -} diff --git a/src/components/layer/package.json b/src/components/layer/package.json deleted file mode 100644 index 729ee31..0000000 --- a/src/components/layer/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "layer", - "version": "0.0.0", - "private": true, - "main": "./layer.js" -} diff --git a/src/pages/UIElement/dataTable/index.js b/src/pages/UIElement/dataTable/index.js deleted file mode 100644 index ebf20e8..0000000 --- a/src/pages/UIElement/dataTable/index.js +++ /dev/null @@ -1,166 +0,0 @@ -import React from 'react' -import { DataTable } from 'components' -import { Table, Row, Col, Card, Select } from 'antd' - -class DataTablePage extends React.Component { - constructor (props) { - super(props) - this.state = { - filterCase: { - gender: '', - }, - } - } - - handleSelectChange = gender => { - this.setState({ - filterCase: { - gender, - }, - }) - } - render () { - const { filterCase } = this.state - const staticDataTableProps = { - dataSource: [ - { - key: '1', - name: 'John Brown', - age: 24, - address: 'New York', - }, - { - key: '2', - name: 'Jim Green', - age: 23, - address: 'London', - }, - ], - columns: [ - { title: 'name', dataIndex: 'name' }, - { title: 'Age', dataIndex: 'age' }, - { title: 'Address', dataIndex: 'address' }, - ], - pagination: false, - } - - const fetchDataTableProps = { - fetch: { - url: 'https://randomuser.me/api', - data: { - results: 10, - testPrams: 'test', - }, - dataKey: 'results', - }, - columns: [ - { - title: 'Name', - dataIndex: 'name', - render: text => `${text.first} ${text.last}`, - }, - { title: 'Phone', dataIndex: 'phone' }, - { title: 'Gender', dataIndex: 'gender' }, - ], - rowKey: 'email', - } - - const caseChangeDataTableProps = { - fetch: { - url: 'https://randomuser.me/api', - data: { - results: 10, - testPrams: 'test', - ...filterCase, - }, - dataKey: 'results', - }, - columns: [ - { - title: 'Name', - dataIndex: 'name', - render: text => `${text.first} ${text.last}`, - }, - { title: 'Phone', dataIndex: 'phone' }, - { title: 'Gender', dataIndex: 'gender' }, - ], - rowKey: 'email', - } - - return ( -
- -
- - - - - - - - - - - - - - - - - - - - - -

Props

- - -
key} - pagination={false} - bordered - scroll={{ x: 800 }} - columns={[ - { - title: '参数', - dataIndex: 'props', - }, - { - title: '说明', - dataIndex: 'desciption', - }, - { - title: '类型', - dataIndex: 'type', - }, - { - title: '默认值', - dataIndex: 'default', - }, - ]} - dataSource={[ - { - props: 'fetch', - desciption: '远程获取数据的参数', - type: 'Object', - default: '后面有空加上', - key: 'basetable', - }, - ]} - /> - - - - ) - } -} - -export default DataTablePage diff --git a/src/pages/UIElement/iconfont/emoji.js b/src/pages/UIElement/iconfont/emoji.js deleted file mode 100644 index fa200c9..0000000 --- a/src/pages/UIElement/iconfont/emoji.js +++ /dev/null @@ -1,8 +0,0 @@ -import '../../../svg/emoji/vomiting.svg' -import '../../../svg/emoji/smirking.svg' -import '../../../svg/emoji/surprised.svg' -import '../../../svg/emoji/unamused.svg' -import '../../../svg/emoji/zombie.svg' -import '../../../svg/emoji/tired.svg' -import '../../../svg/emoji/tongue.svg' -import '../../../svg/emoji/wink.svg' diff --git a/src/pages/UIElement/iconfont/index.js b/src/pages/UIElement/iconfont/index.js deleted file mode 100644 index ca42795..0000000 --- a/src/pages/UIElement/iconfont/index.js +++ /dev/null @@ -1,204 +0,0 @@ -import React from 'react' -import { Page } from 'components' -import { Table, Row, Col, Icon } from 'antd' -import styles from './index.less' -import './emoji' - -const colorfulIcons = [ - 'boluo', - 'baixiangguo', - 'chengzi', - 'boluomei', - 'caomei', - 'dayouzi', - 'chelizi', - 'fanqie', - 'hamigua', - 'ganlan', - 'juzi', - 'heimei', - 'huolongguo', - 'hongmei', - 'lizi', - 'lanmei', - 'mangguo', - 'mihoutao', - 'longyan', - 'mugua', - 'lizi1', - 'ningmeng', -] - -const flatIcons = [ - 'home', - 'user', - 'timelimit', - 'shopcart', - 'message', - 'remind', - 'service', - 'shop', - 'sweep', - 'express', - 'payment', - 'search', - 'feedback', - 'pencil', - 'setting', - 'refund', - 'delete', - 'star', - 'heart', - 'share', - 'location', - 'console', -] - -const localSVGIcons = [ - 'vomiting', - 'smirking', - 'surprised', - 'unamused', - 'zombie', - 'tired', - 'tongue', - 'wink', -] - -const localRequireSVGIcons = [ - require('../../../svg/cute/congratulations.svg'), - require('../../../svg/cute/cry.svg'), - require('../../../svg/cute/kiss.svg'), - require('../../../svg/cute/leisurely.svg'), - require('../../../svg/cute/notice.svg'), - require('../../../svg/cute/proud.svg'), - require('../../../svg/cute/shy.svg'), - require('../../../svg/cute/sweat.svg'), - require('../../../svg/cute/think.svg'), -] - -const IcoPage = () => ( - - -

Colorful Icon

- -

Flat Icon

- -

Local SVG

- -

Local Require SVG

- -

API

- -
-
key} - pagination={false} - bordered - scroll={{ x: 800 }} - columns={[ - { - title: 'Property', - dataIndex: 'props', - }, - { - title: 'Description', - dataIndex: 'desciption', - }, - { - title: 'Type', - dataIndex: 'type', - }, - { - title: 'Default', - dataIndex: 'default', - }, - ]} - dataSource={[ - { - props: 'type', - desciption: 'icon type', - type: 'String', - default: '-', - }, - { - props: 'colorful', - desciption: "to set the SVG has 'symbol element'", - type: 'Bool', - default: 'false', - }, - ]} - /> - - -

Thanks

-
-

- 何阿酥{' '} - colorful fruit icon - - {' '} - http://www.iconfont.cn/collections/detail?cid=4014 - -

-

- ColinXu{' '} - colorful 'tsundere' emoji icon - - {' '} - http://www.iconfont.cn/collections/detail?cid=4116 - -

-

- 咕噜小莫莫{' '} - colorful 'face cute' emoji icon - - {' '} - http://www.iconfont.cn/collections/detail?cid=4268 - -

-
- -) - -export default IcoPage diff --git a/src/pages/UIElement/iconfont/index.less b/src/pages/UIElement/iconfont/index.less deleted file mode 100644 index 6a81dd7..0000000 --- a/src/pages/UIElement/iconfont/index.less +++ /dev/null @@ -1,47 +0,0 @@ -.list { - display: flex; - flex-wrap: wrap; - justify-content: flex-start; - - li { - width: 120px; - text-align: center; - cursor: pointer; - height: 100px; - transition: all 0.5s ease; - display: flex; - flex-direction: column; - align-items: center; - margin-bottom: 24px; - box-sizing: border-box; - border: solid 1px transparent; - justify-content: center; - - &:hover { - border: solid 1px #f5f5f5; - } - } - - .name { - margin-top: 8px; - } - - .icon { - font-size: 32px; - line-height: 1; - } -} -@media (min-width: 1600px) { - .list { - li { - width: 160px; - } - } -} -@media (max-width: 767px) { - .list { - li { - width: 100px; - } - } -} diff --git a/src/pages/UIElement/layer/index.js b/src/pages/UIElement/layer/index.js deleted file mode 100644 index 7e348d1..0000000 --- a/src/pages/UIElement/layer/index.js +++ /dev/null @@ -1,161 +0,0 @@ -import React from 'react' -import { layer } from 'components' -import { Table, Row, Col, Button, Card } from 'antd' - -let Enum = { - default: 1, -} - -const IcoPage = () => { - const handleButtonClick = key => { - if (key === Enum.default) { - layer.open({ - title: '默认弹层', - content:
弹层内容
, - }) - } - } - return ( -
- -
- - - - - -

API

-
-

layer.open(config)

- config对象与 - - Modal - - 的参数基本一致,config属性如下。 - 注意:1.visible属性一般不需要设置;2.afterClose无效,layer.close()可代替;3.layer.open()返回一个唯一的layer - Id -
- - -
key} - pagination={false} - bordered - scroll={{ x: 800 }} - columns={[ - { - title: '参数', - dataIndex: 'props', - }, - { - title: '说明', - dataIndex: 'desciption', - }, - { - title: '类型', - dataIndex: 'type', - }, - { - title: '默认值', - dataIndex: 'default', - }, - ]} - dataSource={[ - { - props: 'content', - desciption: '内容', - type: 'string|ReactNode', - default: '无', - }, - { - props: 'title', - desciption: '标题', - type: 'string|ReactNode', - default: '标题', - }, - { - props: 'confirmLoading', - desciption: '确定按钮 loading', - type: 'boolean', - default: '无', - }, - { - props: 'closable', - desciption: '是否显示右上角的关闭按钮', - type: 'boolean', - default: '无', - }, - { - props: 'onOk', - desciption: '点击确定回调', - type: 'function(e)', - default: '无', - }, - { - props: 'onCancel', - desciption: '点击遮罩层或右上角叉或取消按钮的回调', - type: 'function(e)', - default: '"无"', - }, - { - props: 'width', - desciption: '宽度', - type: 'string|number', - default: '520', - }, - { - props: 'okText', - desciption: '确认按钮文字', - type: 'string', - default: '无', - }, - { - props: 'cancelText', - desciption: '取消按钮文字', - type: 'string', - default: '无', - }, - { - props: 'maskClosable', - desciption: '点击蒙层是否允许关闭', - type: 'boolean', - default: 'true', - }, - { - props: 'style', - desciption: '可用于设置浮层的样式,调整浮层位置等', - type: 'object', - default: '-', - }, - { - props: 'wrapClassName', - desciption: '对话框外层容器的类名', - type: 'string', - default: '-', - }, - ]} - /> - - -
-

layer.close(index)

- 当index有值时,关闭指定Id的layer;当index无值时,关闭最顶层layer -
-
-

layer.closeAll()

- 关闭所有的layer -
- - ) -} - -export default IcoPage diff --git a/src/pages/UIElement/search/index.js b/src/pages/UIElement/search/index.js deleted file mode 100644 index d228748..0000000 --- a/src/pages/UIElement/search/index.js +++ /dev/null @@ -1,102 +0,0 @@ -import React from 'react' -import { Search, Page } from 'components' -import { Table, Row, Col, Card } from 'antd' - -const SearchPage = () => ( - - - - - - - - - - - - - - - - - - - -

Props

- - -
key} - pagination={false} - bordered - scroll={{ x: 800 }} - columns={[ - { - title: '参数', - dataIndex: 'props', - }, - { - title: '说明', - dataIndex: 'desciption', - }, - { - title: '类型', - dataIndex: 'type', - }, - { - title: '默认值', - dataIndex: 'default', - }, - ]} - dataSource={[ - { - props: 'size', - desciption: - '设置Search大小,可选值为 【small】 【large】 或者不设', - type: 'String', - default: '-', - }, - { - props: 'select', - desciption: '设置是否有选择器', - type: 'Boolean', - default: 'false', - }, - { - props: 'selectOptions', - desciption: - '选择器的选项,格式为[{name:"",value:""}]或者[{value:""}]', - type: 'Array', - default: '-', - }, - { - props: 'selectProps', - desciption: '选择器的属性,可参考antd的【Select】组件', - type: 'Object', - default: '-', - }, - { - props: 'onSearch', - desciption: '点击搜索按钮, 按Enter键或者点击清除时的回调', - type: 'Function({keyword:string,field:string})', - default: '-', - }, - ]} - /> - - - -) - -export default SearchPage