kasinooya
9 years ago
41 changed files with 161 additions and 137 deletions
@ -1,14 +1,8 @@ |
|||
import objectAssign from 'object-assign'; |
|||
import GregorianCalendarLocale from 'gregorian-calendar/lib/locale/en_US'; |
|||
import TimepickerLocale from 'rc-time-picker/lib/locale/en_US'; |
|||
|
|||
// 统一合并为完整的 Locale
|
|||
let locale = objectAssign({}, GregorianCalendarLocale); |
|||
locale.lang = objectAssign({ |
|||
placeholder: 'Select a time' |
|||
}, TimepickerLocale); |
|||
|
|||
// All settings at:
|
|||
// https://github.com/ant-design/ant-design/issues/424
|
|||
const locale = { |
|||
placeholder: 'Select a time', |
|||
... TimepickerLocale, |
|||
}; |
|||
|
|||
export default locale; |
|||
|
@ -1,14 +1,8 @@ |
|||
import objectAssign from 'object-assign'; |
|||
import GregorianCalendarLocale from 'gregorian-calendar/lib/locale/zh_CN'; |
|||
import TimepickerLocale from 'rc-time-picker/lib/locale/zh_CN'; |
|||
|
|||
// 统一合并为完整的 Locale
|
|||
let locale = objectAssign({}, GregorianCalendarLocale); |
|||
locale.lang = objectAssign({ |
|||
placeholder: '请选择时间' |
|||
}, TimepickerLocale); |
|||
|
|||
// All settings at:
|
|||
// https://github.com/ant-design/ant-design/issues/424
|
|||
const locale = { |
|||
placeholder: '请选择时间', |
|||
... TimepickerLocale, |
|||
}; |
|||
|
|||
export default locale; |
|||
|
@ -1,56 +1,62 @@ |
|||
import React from 'react'; |
|||
import classNames from 'classnames'; |
|||
|
|||
let Timeline = React.createClass({ |
|||
const TimelineItem = React.createClass({ |
|||
getDefaultProps() { |
|||
return { |
|||
prefixCls: 'ant-timeline' |
|||
prefixCls: 'ant-timeline', |
|||
color: 'blue', |
|||
last: false, |
|||
pending: false, |
|||
}; |
|||
}, |
|||
render() { |
|||
let children = this.props.children; |
|||
const { prefixCls, color, last, children, pending } = this.props; |
|||
const itemClassName = classNames({ |
|||
[prefixCls + '-item']: true, |
|||
[prefixCls + '-item-last']: last, |
|||
[prefixCls + '-item-pending']: pending, |
|||
}); |
|||
return ( |
|||
<ul className={this.props.prefixCls}> |
|||
{React.Children.map(children, function (ele, idx) { |
|||
let np = { |
|||
timelineLast: idx === children.length - 1, |
|||
pending: this.props.pending |
|||
}; |
|||
return React.cloneElement(ele, np); |
|||
}, this)} |
|||
</ul> |
|||
<li className={itemClassName}> |
|||
<div className={prefixCls + '-item-tail'} /> |
|||
<div className={prefixCls + '-item-head ' + prefixCls + '-item-head-' + color} /> |
|||
<div className={prefixCls + '-item-content'}>{children}</div> |
|||
</li> |
|||
); |
|||
} |
|||
}); |
|||
|
|||
Timeline.Item = React.createClass({ |
|||
const Timeline = React.createClass({ |
|||
getDefaultProps() { |
|||
return { |
|||
prefixCls: 'ant-timeline', |
|||
color: 'blue', |
|||
pending: false |
|||
}; |
|||
}, |
|||
render() { |
|||
let props = this.props; |
|||
let prefixCls = props.prefixCls; |
|||
let color = props.color; |
|||
let pending = props.pending; |
|||
let timelineLast = props.timelineLast; |
|||
let endCls = pending && timelineLast ? prefixCls + '-item-last' : ''; |
|||
let last = pending && timelineLast ? |
|||
<div className={prefixCls + '-item-head ' + prefixCls + '-item-head-end'}></div> : |
|||
null; |
|||
let lastTailShow = (timelineLast && !pending) ? 'none' : 'block'; |
|||
|
|||
const { prefixCls, children, pending } = this.props; |
|||
const pendingNode = typeof pending === 'boolean' ? null : pending; |
|||
const className = classNames({ |
|||
[prefixCls]: true, |
|||
[prefixCls + '-pending']: !!pending, |
|||
}); |
|||
return ( |
|||
<li className={prefixCls + '-item ' + endCls}> |
|||
<div style={{ display: lastTailShow }} className={prefixCls + '-item-tail'}></div> |
|||
<div className={prefixCls + '-item-head ' + prefixCls + '-item-head-' + color}></div> |
|||
<div className={prefixCls + '-item-content'}>{props.children}</div> |
|||
{last} |
|||
</li> |
|||
<ul className={className}> |
|||
{ |
|||
React.Children.map(children, (ele, idx) => |
|||
React.cloneElement(ele, { |
|||
last: idx === children.length - 1, |
|||
}) |
|||
) |
|||
} |
|||
{(!!pending) |
|||
? <TimelineItem pending={!!pending}>{pendingNode}</TimelineItem> |
|||
: null} |
|||
</ul> |
|||
); |
|||
} |
|||
}); |
|||
|
|||
Timeline.Item = TimelineItem; |
|||
|
|||
export default Timeline; |
|||
|
@ -1,19 +1,11 @@ |
|||
var fs = require('fs'); |
|||
var cwd = process.cwd(); |
|||
var path = require('path'); |
|||
var pkg = require('../package'); |
|||
|
|||
var originalIndex = fs.readFileSync(path.join(cwd, 'lib/index.js'), 'utf-8'); |
|||
var newIndex = originalIndex |
|||
.replace(/\/components\//g, '/') |
|||
.replace(/require\(\'\.\/package.json\'\)/g, "require('./package')"); |
|||
.replace(/\/components\//g, '/'); |
|||
fs.writeFileSync(path.join(cwd, 'lib/index.js'), newIndex, 'utf-8'); |
|||
fs.writeFileSync( |
|||
path.join(cwd, 'lib/package.js'), |
|||
"module.exports = " + JSON.stringify(require('../package.json')) + ";", |
|||
'utf-8' |
|||
); |
|||
var antdCss = path.join(cwd, 'dist/index.css'); |
|||
var antdCss = path.join(cwd, 'dist/antd.css'); |
|||
fs.createReadStream(antdCss) |
|||
.pipe(fs.createWriteStream(path.join(cwd, 'lib/index.css'))); |
|||
console.log('prenpm done'); |
|||
|
Loading…
Reference in new issue