diff --git a/components/index.js b/components/index.js index e896f363f..e3650b104 100644 --- a/components/index.js +++ b/components/index.js @@ -142,3 +142,7 @@ export { default as version } from './version' export { default as Slider } from './slider' export { default as Progress } from './progress' + +import Timeline from './timeline' +const TimelineItem = Timeline.Item +export { Timeline, TimelineItem } diff --git a/components/slider/demo/index.vue b/components/slider/demo/index.vue index a04488de3..7d65ffaff 100644 --- a/components/slider/demo/index.vue +++ b/components/slider/demo/index.vue @@ -1,6 +1,6 @@ diff --git a/components/timeline/demo/pending.md b/components/timeline/demo/pending.md new file mode 100644 index 000000000..50a67867f --- /dev/null +++ b/components/timeline/demo/pending.md @@ -0,0 +1,23 @@ + +#### 最后一个 +当任务状态正在发生,还在记录过程中,可用幽灵节点来表示当前的时间节点。(用于时间正序排列) + + + +#### Last node +When the timeline is incomplete and ongoing, put a ghost node at last. set `pending={true}` or `pending={a React Element}`. Used in ascend chronological order. + + +```html + +``` + + + + diff --git a/components/timeline/index.en-US.md b/components/timeline/index.en-US.md new file mode 100644 index 000000000..5de3cd3c7 --- /dev/null +++ b/components/timeline/index.en-US.md @@ -0,0 +1,27 @@ +## API + +```` html + + step1 2015-09-01 + step2 2015-09-01 + step3 2015-09-01 + step4 2015-09-01 + +```` + +### Timeline + +Timeline + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| pending | Set the last ghost node's existence or its content | boolean\|string\|slot | `false` | + +### Timeline.Item + +Node of timeline + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| color | Set the circle's color to `blue`, `red`, `green` or other custom colors | string | `blue` | +| dot | Customize timeline dot | string\|slot | - | diff --git a/components/timeline/index.jsx b/components/timeline/index.jsx new file mode 100644 index 000000000..48bd15f66 --- /dev/null +++ b/components/timeline/index.jsx @@ -0,0 +1,9 @@ +import Timeline from './Timeline' + +export { TimelineProps } from './Timeline' +export { TimeLineItemProps } from './TimelineItem' +import TimelineItem from './TimelineItem' + +Timeline.Item = TimelineItem + +export default Timeline diff --git a/components/timeline/index.zh-CN.md b/components/timeline/index.zh-CN.md new file mode 100644 index 000000000..c127fafdb --- /dev/null +++ b/components/timeline/index.zh-CN.md @@ -0,0 +1,27 @@ +## API + +```` html + + 创建服务现场 2015-09-01 + 初步排除网络异常 2015-09-01 + 技术测试异常 2015-09-01 + 网络异常正在修复 2015-09-01 + +```` + +### Timeline + +时间轴。 + +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| pending | 指定最后一个幽灵节点是否存在或内容 | boolean\|string\|slot | false | + +### Timeline.Item + +时间轴的每一个节点。 + +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| color | 指定圆圈颜色 `blue, red, green`,或自定义的色值 | string | blue | +| dot | 自定义时间轴点 | string\|slot | - | diff --git a/components/timeline/style/index.jsx b/components/timeline/style/index.jsx new file mode 100644 index 000000000..cf31ed80f --- /dev/null +++ b/components/timeline/style/index.jsx @@ -0,0 +1,2 @@ +import '../../style/index.less' +import './index.less' diff --git a/components/timeline/style/index.less b/components/timeline/style/index.less new file mode 100644 index 000000000..610ab815b --- /dev/null +++ b/components/timeline/style/index.less @@ -0,0 +1,93 @@ +@import "../../style/themes/default"; +@import "../../style/mixins/index"; + +@timeline-prefix-cls: ~"@{ant-prefix}-timeline"; +@timeline-color: @border-color-split; + +.@{timeline-prefix-cls} { + .reset-component; + list-style: none; + margin: 0; + padding: 0; + + &-item { + position: relative; + padding: 0 0 20px; + list-style: none; + margin: 0; + font-size: @font-size-base; + + &-tail { + position: absolute; + left: 4px; + top: 0.75em; + height: 100%; + border-left: 2px solid @timeline-color; + } + + &-pending &-head { + font-size: @font-size-sm; + } + + &-pending &-tail { + display: none; + } + + &-head { + position: absolute; + width: 10px; + height: 10px; + background-color: @component-background; + border-radius: 100px; + border: 2px solid transparent; + + &-blue { + border-color: @primary-color; + color: @primary-color; + } + &-red { + border-color: @error-color; + color: @error-color; + } + &-green { + border-color: @success-color; + color: @success-color; + } + } + + &-head-custom { + position: absolute; + text-align: center; + line-height: 1; + margin-top: 0; + border: 0; + height: auto; + border-radius: 0; + padding: 3px 0; + transform: translate(-50%, -50%); + top: 5px; + left: 5px; + width: auto; + } + + &-content { + padding: 0 0 0 18px; + position: relative; + top: -(@font-size-base * @line-height-base - @font-size-base) + 1px; + } + + &-last { + .@{timeline-prefix-cls}-item-tail { + border-left: 2px dotted @timeline-color; + display: none; + } + .@{timeline-prefix-cls}-item-content { + min-height: 48px; + } + } + } + + &&-pending &-item-last &-item-tail { + display: block; + } +} diff --git a/contributors.md b/contributors.md index fadb8c3d6..79aa47e5d 100644 --- a/contributors.md +++ b/contributors.md @@ -50,8 +50,7 @@ Collapse | done Spin | done Switch | done Steps | done -Progress -Slider -Table -Timeline +Progress | done +Slider | done InputNumber做完补全demo +Timeline | done Transfer diff --git a/examples/demo.js b/examples/demo.js index f80c853f1..063ceb7eb 100644 --- a/examples/demo.js +++ b/examples/demo.js @@ -35,5 +35,6 @@ export { default as steps } from 'antd/steps/demo/index.vue' export { default as calendar } from 'antd/calendar/demo/index.vue' export { default as datePicker } from 'antd/date-picker/demo/index.vue' export { default as localeProvider } from 'antd/locale-provider/demo/index.vue' -// export { default as slider } from 'antd/slider/demo/index.vue' +export { default as slider } from 'antd/slider/demo/index.vue' export { default as progress } from 'antd/progress/demo/index.vue' +export { default as timeline } from 'antd/timeline/demo/index.vue' diff --git a/examples/routes.js b/examples/routes.js index d5cf1ac00..b73615c7c 100644 --- a/examples/routes.js +++ b/examples/routes.js @@ -3,7 +3,7 @@ const AsyncComp = () => { const hashs = window.location.hash.split('/') const d = hashs[hashs.length - 1] return { - component: import(`../components/progress/demo/${d}`), + component: import(`../components/timeline/demo/${d}`), } } export default [