diff --git a/.gitignore b/.gitignore index 9416a7fd1..51b07a34e 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,6 @@ typings/ .idea .DS_Store dist/ + +# 备份文件 +/components/test/* diff --git a/components/_util/ContainerRender.vue b/components/_util/ContainerRender.vue index d949112bc..19c0db2be 100644 --- a/components/_util/ContainerRender.vue +++ b/components/_util/ContainerRender.vue @@ -40,18 +40,25 @@ export default { } }, - renderComponent (props, ready) { + renderComponent (props = {}, ready) { const { visible, getComponent, forceRender, getContainer, parent } = this const self = this if (visible || parent.$refs._component || forceRender) { + let el = this.componentEl if (!this.container) { this.container = getContainer() + el = document.createElement('div') + this.componentEl = el + this.container.appendChild(el) } if (!this._component) { this._component = new Vue({ + data: { + comProps: props, + }, parent: self.parent, - el: self.container, + el: el, mounted () { this.$nextTick(() => { if (ready) { @@ -60,9 +67,11 @@ export default { }) }, render () { - return getComponent(props) + return getComponent(this.comProps) }, }) + } else { + this._component.comProps = props } } }, diff --git a/components/_util/props-util.js b/components/_util/props-util.js index ea74b6b4f..465278457 100644 --- a/components/_util/props-util.js +++ b/components/_util/props-util.js @@ -1,12 +1,18 @@ - -const parseStyleText = (cssText = '') => { +const camelizeRE = /-(\w)/g +const camelize = (str) => { + return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : '') +} +const parseStyleText = (cssText = '', camel) => { const res = {} const listDelimiter = /;(?![^(]*\))/g const propertyDelimiter = /:(.+)/ cssText.split(listDelimiter).forEach(function (item) { if (item) { const tmp = item.split(propertyDelimiter) - tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim()) + if (tmp.length > 1) { + const k = camel ? camelize(tmp[0].trim()) : tmp[0].trim() + res[k] = tmp[1].trim() + } } }) return res @@ -39,6 +45,18 @@ const getSlotOptions = (ele) => { return componentOptions ? componentOptions.Ctor.options || {} : {} } const getOptionProps = (instance) => { + if (instance.componentOptions) { + const componentOptions = instance.componentOptions + const { propsData = {}, Ctor = {}} = componentOptions + const props = (Ctor.options || {}).props || {} + const res = {} + for (const [k, v] of Object.entries(props)) { + if (v.default !== undefined) { + res[k] = v + } + } + return { ...res, ...propsData } + } const { $options = {}, $props = {}} = instance return filterProps($props, $options.propsData) } @@ -120,14 +138,22 @@ export function getClass (ele) { } return cls } -export function getStyle (ele) { +export function getStyle (ele, camel) { let data = {} if (ele.data) { data = ele.data } else if (ele.$vnode && ele.$vnode.data) { data = ele.$vnode.data } - return data.style || parseStyleText(data.staticStyle || '') + let style = data.style || data.staticStyle + if (typeof style === 'string') { + style = parseStyleText(style, camel) + } else if (camel && style) { // 驼峰化 + const res = {} + Object.keys(style).forEach(k => (res[camelize(k)] = style[k])) + return res + } + return style } export function getComponentName (opts) { diff --git a/components/alert/demo/banner.md b/components/alert/demo/banner.md new file mode 100644 index 000000000..da0d10833 --- /dev/null +++ b/components/alert/demo/banner.md @@ -0,0 +1,23 @@ + +#### 顶部公告 +页面顶部通告形式,默认有图标且`type` 为 'warning'。 + + + +#### Banner +Display Alert as a banner at top of page. + + +```html + +``` diff --git a/components/alert/demo/basic.md b/components/alert/demo/basic.md new file mode 100644 index 000000000..d3e81b4cf --- /dev/null +++ b/components/alert/demo/basic.md @@ -0,0 +1,15 @@ + +#### 基本 +最简单的用法,适用于简短的警告提示。 + + + +#### basic +The simplest usage for short messages. + + +```html + +``` diff --git a/components/alert/demo/closable.md b/components/alert/demo/closable.md new file mode 100644 index 000000000..d42ca2859 --- /dev/null +++ b/components/alert/demo/closable.md @@ -0,0 +1,38 @@ + +#### 可关闭的警告提示 +显示关闭按钮,点击可关闭警告提示。 + + + +#### Closable +To show close button. + + +```html + + +``` diff --git a/components/alert/demo/close-text.md b/components/alert/demo/close-text.md new file mode 100644 index 000000000..06516026e --- /dev/null +++ b/components/alert/demo/close-text.md @@ -0,0 +1,15 @@ + +#### 自定义关闭 +可以自定义关闭,自定义的文字会替换原先的关闭 `Icon`。 + + + +#### Customized Close Text +Replace the default icon with customized text. + + +```html + +``` diff --git a/components/alert/demo/description.md b/components/alert/demo/description.md new file mode 100644 index 000000000..8da625522 --- /dev/null +++ b/components/alert/demo/description.md @@ -0,0 +1,39 @@ + +#### 含有辅助性文字介绍 +含有辅助性文字介绍的警告提示。 + + + +#### Description +Additional description for alert message. + + +```html + +``` diff --git a/components/alert/demo/icon.md b/components/alert/demo/icon.md new file mode 100644 index 000000000..68f32c6e7 --- /dev/null +++ b/components/alert/demo/icon.md @@ -0,0 +1,44 @@ + +#### 图标 +可口的图标让信息类型更加醒目。 + + + +#### Icon +Decent icon make information more clear and more friendly. + + +```html + +``` diff --git a/components/alert/demo/index.vue b/components/alert/demo/index.vue new file mode 100644 index 000000000..038f85940 --- /dev/null +++ b/components/alert/demo/index.vue @@ -0,0 +1,55 @@ + + diff --git a/components/alert/demo/style.md b/components/alert/demo/style.md new file mode 100644 index 000000000..47a111bf3 --- /dev/null +++ b/components/alert/demo/style.md @@ -0,0 +1,20 @@ + +#### 四种样式 +共有四种样式 `success`、`info`、`warning`、`error`。 + + + +#### More types +There are 4 types of Alert: `success`, `info`, `warning`, `error`. + + +```html + +``` diff --git a/components/alert/index.en-US.md b/components/alert/index.en-US.md new file mode 100644 index 000000000..cbc01cf36 --- /dev/null +++ b/components/alert/index.en-US.md @@ -0,0 +1,18 @@ + +## API + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| banner | Whether to show as banner | boolean | false | +| closable | Whether Alert can be closed | boolean | - | +| closeText | Close text to show | string\|slot | - | +| description | Additional content of Alert | string\|slot | - | +| message | Content of Alert | string\|slot | - | +| showIcon | Whether to show icon | boolean | false, in `banner` mode default is true | +| iconType | Icon type, effective when `showIcon` is `true` | string | - | +| type | Type of Alert styles, options: `success`, `info`, `warning`, `error` | string | `info`, in `banner` mode default is `warning` | + +### events +| Events Name | Description | Arguments | +| --- | --- | --- | +| close | Callback when Alert is closed | Function | diff --git a/components/alert/index.vue b/components/alert/index.vue new file mode 100644 index 000000000..613a1fe63 --- /dev/null +++ b/components/alert/index.vue @@ -0,0 +1,133 @@ + diff --git a/components/alert/index.zh-CN.md b/components/alert/index.zh-CN.md new file mode 100644 index 000000000..649e9b922 --- /dev/null +++ b/components/alert/index.zh-CN.md @@ -0,0 +1,18 @@ + +## API + +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| banner | 是否用作顶部公告 | boolean | false | +| closable | 默认不显示关闭按钮 | boolean | 无 | +| closeText | 自定义关闭按钮 | string\|slot | 无 | +| description | 警告提示的辅助性文字介绍 | string\|slot | 无 | +| message | 警告提示内容 | string\|slot | 无 | +| showIcon | 是否显示辅助图标 | boolean | false,`banner` 模式下默认值为 true | +| iconType | 自定义图标类型,`showIcon` 为 `true` 时有效 | string | - | +| type | 指定警告提示的样式,有四种选择 `success`、`info`、`warning`、`error` | string | `info`,`banner` 模式下默认值为 `warning` | + +### 事件 +| 事件名称 | 说明 | 回调参数 | +| --- | --- | --- | +| close | 关闭时触发的回调函数 | Function | diff --git a/components/alert/style/index.js b/components/alert/style/index.js new file mode 100644 index 000000000..cf31ed80f --- /dev/null +++ b/components/alert/style/index.js @@ -0,0 +1,2 @@ +import '../../style/index.less' +import './index.less' diff --git a/components/alert/style/index.less b/components/alert/style/index.less new file mode 100644 index 000000000..dfcf65789 --- /dev/null +++ b/components/alert/style/index.less @@ -0,0 +1,169 @@ +@import "../../style/themes/default"; +@import "../../style/mixins/index"; + +@alert-prefix-cls: ~"@{ant-prefix}-alert"; + +@alert-message-color: @heading-color; +@alert-text-color: @text-color; + +.@{alert-prefix-cls} { + .reset-component; + position: relative; + padding: 8px 15px 8px 37px; + border-radius: @border-radius-base; + + &&-no-icon { + padding: 8px 15px; + } + + &-icon { + top: 8px + @font-size-base * @line-height-base / 2 - @font-size-base / 2 + 1px; + left: 16px; + position: absolute; + } + + &-description { + font-size: @font-size-base; + line-height: 22px; + display: none; + } + + &-success { + border: @border-width-base @border-style-base ~`colorPalette("@{success-color}", 3)`; + background-color: ~`colorPalette("@{success-color}", 1)`; + .@{alert-prefix-cls}-icon { + color: @success-color; + } + } + + &-info { + border: @border-width-base @border-style-base ~`colorPalette("@{info-color}", 3)`; + background-color: ~`colorPalette("@{info-color}", 1)`; + .@{alert-prefix-cls}-icon { + color: @info-color; + } + } + + &-warning { + border: @border-width-base @border-style-base ~`colorPalette("@{warning-color}", 3)`; + background-color: ~`colorPalette("@{warning-color}", 1)`; + .@{alert-prefix-cls}-icon { + color: @warning-color; + } + } + + &-error { + border: @border-width-base @border-style-base ~`colorPalette("@{error-color}", 3)`; + background-color: ~`colorPalette("@{error-color}", 1)`; + .@{alert-prefix-cls}-icon { + color: @error-color; + } + } + + &-close-icon { + font-size: @font-size-sm; + position: absolute; + right: 16px; + top: 8px; + line-height: 22px; + overflow: hidden; + cursor: pointer; + + .@{iconfont-css-prefix}-cross { + color: @text-color-secondary; + transition: color .3s; + &:hover { + color: #404040; + } + } + } + + &-close-text { + position: absolute; + right: 16px; + } + + &-with-description { + padding: 15px 15px 15px 64px; + position: relative; + border-radius: @border-radius-base; + color: @text-color; + line-height: @line-height-base; + } + + &-with-description&-no-icon { + padding: 15px; + } + + &-with-description &-icon { + position: absolute; + top: 16px; + left: 24px; + font-size: 24px; + } + + &-with-description &-close-icon { + position: absolute; + top: 16px; + right: 16px; + cursor: pointer; + font-size: @font-size-base; + } + + &-with-description &-message { + font-size: @font-size-lg; + color: @alert-message-color; + display: block; + margin-bottom: 4px; + } + + &-with-description &-description { + display: block; + } + + &&-close { + height: 0 !important; + margin: 0; + padding-top: 0; + padding-bottom: 0; + transition: all .3s @ease-in-out-circ; + transform-origin: 50% 0; + } + + &-slide-up-leave { + animation: antAlertSlideUpOut .3s @ease-in-out-circ; + animation-fill-mode: both; + } + + &-banner { + border-radius: 0; + border: 0; + margin-bottom: 0; + } +} + +@keyframes antAlertSlideUpIn { + 0% { + opacity: 0; + transform-origin: 0% 0%; + transform: scaleY(0); + } + 100% { + opacity: 1; + transform-origin: 0% 0%; + transform: scaleY(1); + } +} + +@keyframes antAlertSlideUpOut { + 0% { + opacity: 1; + transform-origin: 0% 0%; + transform: scaleY(1); + } + 100% { + opacity: 0; + transform-origin: 0% 0%; + transform: scaleY(0); + } +} diff --git a/components/badge/Badge.vue b/components/badge/Badge.vue index 7f8fe8121..dcc657788 100644 --- a/components/badge/Badge.vue +++ b/components/badge/Badge.vue @@ -1,128 +1,114 @@ - diff --git a/components/badge/ScrollNumber.vue b/components/badge/ScrollNumber.vue index b81832e98..4375ee5fe 100644 --- a/components/badge/ScrollNumber.vue +++ b/components/badge/ScrollNumber.vue @@ -1,5 +1,8 @@ diff --git a/components/badge/demo/basic.md b/components/badge/demo/basic.md new file mode 100644 index 000000000..f14ddd221 --- /dev/null +++ b/components/badge/demo/basic.md @@ -0,0 +1,23 @@ + +#### 基本 +简单的徽章展示,当 `count` 为 `0` 时,默认不显示,但是可以使用 `showZero` 修改为显示。 + + + +#### basic +Simplest Usage. Badge will be hidden when `count` is `0`, but we can use `showZero` to show it. + + +```html + +``` + diff --git a/components/badge/demo/change.md b/components/badge/demo/change.md new file mode 100644 index 000000000..a113e5ab7 --- /dev/null +++ b/components/badge/demo/change.md @@ -0,0 +1,57 @@ + +#### 动态 + 展示动态变化的效果。 + + + +#### Dynamic + The count will be animated as it changes. + + +```html + + +``` diff --git a/components/badge/demo/dot.md b/components/badge/demo/dot.md new file mode 100644 index 000000000..31d082c66 --- /dev/null +++ b/components/badge/demo/dot.md @@ -0,0 +1,30 @@ + +#### 讨嫌的小红点 +没有具体的数字。 + + + +#### Red badge +This will simply display a red badge, without a specific count. + + +```html + + +``` diff --git a/components/badge/demo/index.vue b/components/badge/demo/index.vue index 6aeb8d7ca..7b47ace61 100644 --- a/components/badge/demo/index.vue +++ b/components/badge/demo/index.vue @@ -1,134 +1,59 @@ - - diff --git a/components/badge/demo/link.md b/components/badge/demo/link.md new file mode 100644 index 000000000..efb8c3ae6 --- /dev/null +++ b/components/badge/demo/link.md @@ -0,0 +1,19 @@ + +#### 可点击 + 用 a 标签进行包裹即可。 + + + +#### Clickable + The badge can be wrapped with `a` tag to make it linkable. + + +```html + +``` diff --git a/components/badge/demo/no-wrapper.md b/components/badge/demo/no-wrapper.md new file mode 100644 index 000000000..0f8735328 --- /dev/null +++ b/components/badge/demo/no-wrapper.md @@ -0,0 +1,20 @@ + +#### 独立使用 +不包裹任何元素即是独立使用,可自定样式展现。 +在右上角的 badge 则限定为红色。 + + + +#### Standalone +Used in standalone when children is empty. + + +```html + +``` diff --git a/components/badge/demo/overflow.md b/components/badge/demo/overflow.md new file mode 100644 index 000000000..0a23162b9 --- /dev/null +++ b/components/badge/demo/overflow.md @@ -0,0 +1,28 @@ + +#### 封顶数字 +超过 `overflowCount` 的会显示为 `${overflowCount}+`,默认的 `overflowCount` 为 `99`。 + + + +#### Overflow Count +`${overflowCount}+` is displayed when count is larger than `overflowCount`. The default value of `overflowCount` is `99`. + + +```html + +``` diff --git a/components/badge/demo/status.md b/components/badge/demo/status.md new file mode 100644 index 000000000..9ec4f91cc --- /dev/null +++ b/components/badge/demo/status.md @@ -0,0 +1,31 @@ + +#### 状态点 + 用于表示状态的小圆点。 + + + +#### Status + Standalone badge with status. + + +```html + +``` diff --git a/components/badge/index.en_US.md b/components/badge/index.en_US.md new file mode 100644 index 000000000..bc2adf5e0 --- /dev/null +++ b/components/badge/index.en_US.md @@ -0,0 +1,22 @@ +## API + +````html + + + +```` + +```html + +```` + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| count | Number to show in badge | number\|string | | +| dot | Whether to display a red dot instead of `count` | boolean | `false` | +| offset | set offset of the badge dot, like [x, y] | [number, number] | - | +| overflowCount | Max count to show | number | 99 | +| showZero | Whether to show badge when `count` is zero | boolean | `false` | +| status | Set Badge as a status dot | `success` \| `processing` \| `default` \| `error` \| `warning` | `''` | +| text | If `status` is set, `text` sets the display text of the status `dot` | string | `''` | +| numberStyle | sets the display style of the status `dot` | object | '' | diff --git a/components/badge/index.zh-CN.md b/components/badge/index.zh-CN.md new file mode 100644 index 000000000..ef80e4898 --- /dev/null +++ b/components/badge/index.zh-CN.md @@ -0,0 +1,23 @@ +## API + + +````html + + + +```` + +```html + +```` + +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | number\|string | | +| dot | 不展示数字,只有一个小红点 | boolean | false | +| offset | 设置状态点的位置偏移,格式为 [x, y] | [number, number] | - | +| overflowCount | 展示封顶的数字值 | number | 99 | +| showZero | 当数值为 0 时,是否展示 Badge | boolean | false | +| status | 设置 Badge 为状态点 | Enum{ 'success', 'processing, 'default', 'error', 'warning' } | '' | +| text | 在设置了 `status` 的前提下有效,设置状态点的文本 | string | '' | +| numberStyle | 设置状态点的样式 | object | '' | diff --git a/components/breadcrumb/demo/basic.md b/components/breadcrumb/demo/basic.md new file mode 100644 index 000000000..62adb984c --- /dev/null +++ b/components/breadcrumb/demo/basic.md @@ -0,0 +1,33 @@ + + #### 基本 + 最简单的用法 + + + + #### Basic usage + The simplest use + + +```html + + + + +``` diff --git a/components/breadcrumb/demo/basic.vue b/components/breadcrumb/demo/basic.vue deleted file mode 100644 index c2fd827c7..000000000 --- a/components/breadcrumb/demo/basic.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - diff --git a/components/breadcrumb/demo/index.vue b/components/breadcrumb/demo/index.vue index d1efc5566..61e91449a 100644 --- a/components/breadcrumb/demo/index.vue +++ b/components/breadcrumb/demo/index.vue @@ -1,21 +1,45 @@ - diff --git a/components/breadcrumb/demo/separator.vue b/components/breadcrumb/demo/separator.md similarity index 67% rename from components/breadcrumb/demo/separator.vue rename to components/breadcrumb/demo/separator.md index 87323cbc4..f4a8cbba9 100644 --- a/components/breadcrumb/demo/separator.vue +++ b/components/breadcrumb/demo/separator.md @@ -1,15 +1,21 @@ + + #### 分隔符 + 使用` separator=">" `可以自定义分隔符 + + + + #### Configuring the Separator + The separator can be customized by setting the separator preperty: separator=">" + + +```html + +``` diff --git a/components/breadcrumb/demo/withIcon.vue b/components/breadcrumb/demo/withIcon.md similarity index 75% rename from components/breadcrumb/demo/withIcon.vue rename to components/breadcrumb/demo/withIcon.md index f83d665e9..a24888ed1 100644 --- a/components/breadcrumb/demo/withIcon.vue +++ b/components/breadcrumb/demo/withIcon.md @@ -1,8 +1,15 @@ + + #### 带有图标的 + 图标放在文字前面 + + + + #### With an Icon + The icon should be placed in front of the text + + +```html + +``` diff --git a/components/breadcrumb/index.en-US.md b/components/breadcrumb/index.en-US.md new file mode 100644 index 000000000..0ed0297fa --- /dev/null +++ b/components/breadcrumb/index.en-US.md @@ -0,0 +1,35 @@ +## API + +| Property | Description | Type | Optional | Default | +| -------- | ----------- | ---- | -------- | ------- | +| itemRender | Custom item renderer | (route, params, routes, paths) => ReactNode | | - | +| params | Routing parameters | object | | - | +| routes | The routing stack information of router | object\[] | | - | +| separator | Custom separator | string\|ReactNode | | `/` | + +> `linkRender` and `nameRender` were removed after `antd@2.0`, please use `itemRender` instead. + +### Use with browserHistory + +The link of Breadcrumb item targets `#` by default, you can use `itemRender` to make a `browserHistory` Link. + +```vue +import { Link } from 'react-router'; + +const routes = [{ + path: 'index', +  breadcrumbName: 'home' +}, { + path: 'first', + breadcrumbName: 'first' +}, { + path: 'second', + breadcrumbName: 'second' +}]; +function itemRender(route, params, routes, paths) { + const last = routes.indexOf(route) === routes.length - 1; + return last ? {route.breadcrumbName} : {route.breadcrumbName}; +} + +return ; +``` diff --git a/components/breadcrumb/index.zh-CN.md b/components/breadcrumb/index.zh-CN.md new file mode 100644 index 000000000..649557606 --- /dev/null +++ b/components/breadcrumb/index.zh-CN.md @@ -0,0 +1,33 @@ +## API + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| --- | --- | --- | --- | --- | +| itemRender | 自定义链接函数,和 react-router 配置使用 | (route, params, routes, paths) => ReactNode | | - | +| params | 路由的参数 | object | | - | +| routes | router 的路由栈信息 | object\[] | | - | +| separator | 分隔符自定义 | string\|slot | | '/' | + +### 和 browserHistory 配合 + +和 vue-router 一起使用时,默认生成的 url 路径是带有 `#` 的,如果和 browserHistory 一起使用的话,你可以使用 `itemRender` 属性定义面包屑链接。 + +````html +import { Link } from 'react-router'; + +const routes = [{ + path: 'index', + breadcrumbName: '首页' +}, { + path: 'first', + breadcrumbName: '一级面包屑' +}, { + path: 'second', + breadcrumbName: '当前页面' +}]; +function itemRender(route, params, routes, paths) { + const last = routes.indexOf(route) === routes.length - 1; + return last ? {route.breadcrumbName} : {route.breadcrumbName}; +} + +return ; +```` diff --git a/components/button/demo/ghost.md b/components/button/demo/ghost.md index 25d9a2662..eccced014 100644 --- a/components/button/demo/ghost.md +++ b/components/button/demo/ghost.md @@ -7,6 +7,7 @@ #### Ghost Button `ghost` property will make button's background transparent, it is common used in colored background. + ```html - - diff --git a/components/card/demo/concise.md b/components/card/demo/concise.md new file mode 100644 index 000000000..0ee3c79d7 --- /dev/null +++ b/components/card/demo/concise.md @@ -0,0 +1,19 @@ + + #### 简洁卡片 + 只包含内容区域 + + + + #### Simple card + A simple card only containing a content area. + + +```html + +``` diff --git a/components/card/demo/grid.md b/components/card/demo/grid.md new file mode 100644 index 000000000..8a7c6c82c --- /dev/null +++ b/components/card/demo/grid.md @@ -0,0 +1,37 @@ +[>_<]: + 这个卡片没起作用还报错!一堆的那种!!! + + +#### 网格型内嵌卡片 +一种常见的卡片内容区隔模式。 + + + +#### Grid card +Grid style card content. + + +```html + + + +``` diff --git a/components/card/demo/index.vue b/components/card/demo/index.vue index 313281dd6..c34007f8a 100644 --- a/components/card/demo/index.vue +++ b/components/card/demo/index.vue @@ -1,46 +1,53 @@ - diff --git a/components/card/demo/inline.md b/components/card/demo/inline.md new file mode 100644 index 000000000..c2f005800 --- /dev/null +++ b/components/card/demo/inline.md @@ -0,0 +1,27 @@ + + #### 内部卡片 + 可以放在普通卡片内部,展示多层级结构的信息 + + + + #### Inner card + It can be placed inside the ordinary card to display the information of the multilevel structure + + +```html + + +``` diff --git a/components/card/demo/loading.md b/components/card/demo/loading.md new file mode 100644 index 000000000..67a061aad --- /dev/null +++ b/components/card/demo/loading.md @@ -0,0 +1,18 @@ + + #### 预加载的卡片 + 数据读入前会有文本块样式 + + + #### Loading card + Shows a loading indirector while the contents of the card is being featched + + +```html + +``` + + diff --git a/components/card/demo/moreConfigs.md b/components/card/demo/moreConfigs.md new file mode 100644 index 000000000..5e04c05be --- /dev/null +++ b/components/card/demo/moreConfigs.md @@ -0,0 +1,47 @@ + + #### 更灵活的内容展示 + 可以利用 `Card.Meta` 支持更灵活的内容 + + + + #### Customized content + You can use `Card.Meta` to support more flexible content. + + +```html + + + +``` diff --git a/components/card/demo/noBorder.md b/components/card/demo/noBorder.md new file mode 100644 index 000000000..6ca04fe46 --- /dev/null +++ b/components/card/demo/noBorder.md @@ -0,0 +1,30 @@ + + #### 无边框 + 在灰色背景上使用无边框的卡片 + + + #### No border + A borderless card on a gray background. + + +```html + + + +``` diff --git a/components/card/demo/tabsCard.md b/components/card/demo/tabsCard.md new file mode 100644 index 000000000..49dce21b5 --- /dev/null +++ b/components/card/demo/tabsCard.md @@ -0,0 +1,83 @@ + + #### 带页签的卡片 + 可承载更多内容 + + + + #### With tabs + More content can be hosted + + +```html + + + + +``` diff --git a/components/card/index.en-US.md b/components/card/index.en-US.md new file mode 100644 index 000000000..d7271a6c2 --- /dev/null +++ b/components/card/index.en-US.md @@ -0,0 +1,34 @@ +## API + +### Card + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| actions | The action list, shows at the bottom of the Card. | slot | - | +| bodyStyle | Inline style to apply to the card content | object | - | +| bordered | Toggles rendering of the border around the card | boolean | `true` | +| cover | Card cover | ReactNode | - | +| extra | Content to render in the top-right corner of the card | string\|ReactNode | - | +| hoverable | Lift up when hovering card | boolean | false | +| loading | Shows a loading indicator while the contents of the card are being fetched | boolean | false | +| tabList | List of TabPane's head. | Array<{key: string, tab: ReactNode}> | - | +| title | Card title | string\|ReactNode | - | +| type | Card style type, can be set to `inner` or not set | string | - | +| onTabChange | Callback when tab is switched | (key) => void | - | + +### Card.Grid + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| className | className of container | string | - | +| style | style object of container | object | - | + +### Card.Meta + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| avatar | avatar or icon | ReactNode | - | +| className | className of container | string | - | +| description | description content | ReactNode | - | +| style | style object of container | object | - | +| title | title content | ReactNode | - | diff --git a/components/card/index.zh-CN.md b/components/card/index.zh-CN.md new file mode 100644 index 000000000..35bf37488 --- /dev/null +++ b/components/card/index.zh-CN.md @@ -0,0 +1,35 @@ + +## API + +### Card + +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| actions | 卡片操作组,位置在卡片底部 |slot | - | +| bodyStyle | 内容区域自定义样式 | object | - | +| bordered | 是否有边框 | boolean | true | +| cover | 卡片封面 | ReactNode | - | +| extra | 卡片右上角的操作区域 | string\|slot | - | +| hoverable | 鼠标移过时可浮起 | boolean | false | +| loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean | false | +| tabList | 页签标题列表 | Array<{key: string, tab: ReactNode}> | - | +| title | 卡片标题 | string\|ReactNode | - | +| type | 卡片类型,可设置为 `inner` 或 不设置 | string | - | +| onTabChange | 页签切换的回调 | (key) => void | - | + +### Card.Grid + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| className | 网格容器类名 | string | - | +| style | 定义网格容器类名的样式 | object | - | + +### Card.Meta + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| avatar | 头像/图标 | ReactNode | - | +| className | 容器类名 | string | - | +| description | 描述内容 | ReactNode | - | +| style | 定义容器类名的样式 | object | - | +| title | 标题内容 | ReactNode | - | diff --git a/components/checkbox/demo/basic.md b/components/checkbox/demo/basic.md new file mode 100644 index 000000000..4a4948e6e --- /dev/null +++ b/components/checkbox/demo/basic.md @@ -0,0 +1,24 @@ + +#### 基本用法 +简单的checkbox + + + +#### Basic +Basic usage of checkbox + + +```html + + +``` diff --git a/components/checkbox/demo/basic.vue b/components/checkbox/demo/basic.vue deleted file mode 100644 index f360e66ef..000000000 --- a/components/checkbox/demo/basic.vue +++ /dev/null @@ -1,18 +0,0 @@ - - diff --git a/components/checkbox/demo/check-all.vue b/components/checkbox/demo/check-all.md similarity index 83% rename from components/checkbox/demo/check-all.vue rename to components/checkbox/demo/check-all.md index b1a3f09d3..bac267a36 100644 --- a/components/checkbox/demo/check-all.vue +++ b/components/checkbox/demo/check-all.md @@ -1,3 +1,14 @@ + +#### 全选 +在实现全选效果时,你可能会用到`indeterminate`属性 + + + +#### Check all +The `indeterminate` property can help you to achieve a 'check all' effect. + + +```html + +``` diff --git a/components/checkbox/demo/controller.vue b/components/checkbox/demo/controller.md similarity index 89% rename from components/checkbox/demo/controller.vue rename to components/checkbox/demo/controller.md index 72e38acf2..310916efd 100644 --- a/components/checkbox/demo/controller.vue +++ b/components/checkbox/demo/controller.md @@ -1,3 +1,14 @@ + +#### 受控的checkbox +联动checkbox + + + +#### Controlled Checkbox +Communicated with other components + + +```html +``` diff --git a/components/checkbox/demo/disabled.vue b/components/checkbox/demo/disabled.md similarity index 58% rename from components/checkbox/demo/disabled.vue rename to components/checkbox/demo/disabled.md index fac1e9399..e20f8b52a 100644 --- a/components/checkbox/demo/disabled.vue +++ b/components/checkbox/demo/disabled.md @@ -1,3 +1,14 @@ + +#### 不可用 +checkbox 不可用 + + + +#### Disabled +Disabled checkbox + + +```html - +``` diff --git a/components/checkbox/demo/group.vue b/components/checkbox/demo/group.md similarity index 87% rename from components/checkbox/demo/group.vue rename to components/checkbox/demo/group.md index b7cfcc6a3..eb6c696af 100644 --- a/components/checkbox/demo/group.vue +++ b/components/checkbox/demo/group.md @@ -1,3 +1,14 @@ + +#### Checkbox组 +方便的从数组生成checkbox + + + +#### Checkbox group +Generate a group of checkboxes from an array + + +```html +``` diff --git a/components/checkbox/demo/index.vue b/components/checkbox/demo/index.vue index eea51bd1d..80fb85fbd 100644 --- a/components/checkbox/demo/index.vue +++ b/components/checkbox/demo/index.vue @@ -1,35 +1,47 @@ - diff --git a/components/checkbox/demo/layout.md b/components/checkbox/demo/layout.md new file mode 100644 index 000000000..7068674fb --- /dev/null +++ b/components/checkbox/demo/layout.md @@ -0,0 +1,32 @@ + +#### 布局 +Checkbox.Group内嵌Checkbox并与Grid组件一起使用,可以实现灵活的布局 + + + +#### Use with grid +We can use Checkbox and Grid Checkbox.group, to implement complex layout + + +```html + + +``` diff --git a/components/checkbox/demo/layout.vue b/components/checkbox/demo/layout.vue deleted file mode 100644 index ebc74eef0..000000000 --- a/components/checkbox/demo/layout.vue +++ /dev/null @@ -1,27 +0,0 @@ - - diff --git a/components/checkbox/index.en-US.md b/components/checkbox/index.en-US.md new file mode 100644 index 000000000..863c4d935 --- /dev/null +++ b/components/checkbox/index.en-US.md @@ -0,0 +1,30 @@ +## API + +### Checkbox + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| autoFocus | get focus when component mounted | boolean | false | +| checked | Specifies whether the checkbox is selected. | boolean | false | +| defaultChecked | Specifies the initial state: whether or not the checkbox is selected. | boolean | false | +| disabled | Disable checkbox | boolean | false | +| onChange | The callback function that is triggered when the state changes. | Function(e:Event) | - | + +### Checkbox Group + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| defaultValue | Default selected value | string\[] | \[] | +| disabled | Disable all checkboxes | boolean | false | +| options | Specifies options | string\[] | \[] | +| value | Used for setting the currently selected value. | string\[] | \[] | +| onChange | The callback function that is triggered when the state changes. | Function(checkedValue) | - | + +## Methods + +### Checkbox + +| Name | Description | +| ---- | ----------- | +| blur() | remove focus | +| focus() | get focus | diff --git a/components/checkbox/index.zh-CN.md b/components/checkbox/index.zh-CN.md new file mode 100644 index 000000000..03e2d4aed --- /dev/null +++ b/components/checkbox/index.zh-CN.md @@ -0,0 +1,29 @@ +## API + +### Checkbox + +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| autoFocus | 自动获取焦点 | boolean | false | +| checked | 指定当前是否选中 | boolean | false | +| defaultChecked | 初始是否选中 | boolean | false | +| indeterminate | 设置 indeterminate 状态,只负责样式控制 | boolean | false | +| onChange | 变化时回调函数 | Function(e:Event) | - | + +### Checkbox Group + +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| defaultValue | 默认选中的选项 | string\[] | \[] | +| options | 指定可选项 | string\[] | \[] | +| value | 指定选中的选项 | string\[] | \[] | +| onChange | 变化时回调函数 | Function(checkedValue) | - | + +## 方法 + +### Checkbox + +| 名称 | 描述 | +| --- | --- | +| blur() | 移除焦点 | +| focus() | 获取焦点 | diff --git a/components/dropdown/src/Dropdown.vue b/components/dropdown/src/Dropdown.vue index 4c3bddd86..61f99503b 100644 --- a/components/dropdown/src/Dropdown.vue +++ b/components/dropdown/src/Dropdown.vue @@ -89,7 +89,7 @@ export default { const overlayNode = this.getPopupDomNode() const rootNode = this.$el if (rootNode && overlayNode && rootNode.offsetWidth > overlayNode.offsetWidth) { - overlayNode.style.width = `${rootNode.offsetWidth}px` + overlayNode.style.minWidth = `${rootNode.offsetWidth}px` if (this.$refs.trigger && this.$refs.trigger._component && this.$refs.trigger._component.alignInstance) { diff --git a/components/grid/Col.vue b/components/grid/Col.vue index b35e35882..d3584f389 100644 --- a/components/grid/Col.vue +++ b/components/grid/Col.vue @@ -1,83 +1,72 @@ diff --git a/components/grid/Row.vue b/components/grid/Row.vue index df1ee6d7a..e2f485a09 100644 --- a/components/grid/Row.vue +++ b/components/grid/Row.vue @@ -1,84 +1,151 @@ - diff --git a/components/grid/demo/align.vue b/components/grid/demo/align.vue deleted file mode 100644 index 403634e5c..000000000 --- a/components/grid/demo/align.vue +++ /dev/null @@ -1,62 +0,0 @@ - - - diff --git a/components/grid/demo/basic.md b/components/grid/demo/basic.md new file mode 100644 index 000000000..57ab4a5d8 --- /dev/null +++ b/components/grid/demo/basic.md @@ -0,0 +1,35 @@ + +#### 基础栅格 +从堆叠到水平排列。 +使用单一的一组 `Row` 和 `Col` 栅格组件,就可以创建一个基本的栅格系统,所有列(Col)必须放在 `Row` 内。 + + + +#### Basic Grid +From the stack to the horizontal arrangement. +You can create a basic grid system by using a single set of `Row` and `Col` grid assembly, all of the columns (Col) must be placed in `Row`. + + +```html + +``` + + diff --git a/components/grid/demo/basic.vue b/components/grid/demo/basic.vue deleted file mode 100644 index dd6b80617..000000000 --- a/components/grid/demo/basic.vue +++ /dev/null @@ -1,48 +0,0 @@ - - - diff --git a/components/grid/demo/complex.vue b/components/grid/demo/complex.vue deleted file mode 100644 index 490bbb4c7..000000000 --- a/components/grid/demo/complex.vue +++ /dev/null @@ -1,34 +0,0 @@ - - - diff --git a/components/grid/demo/flex-align.md b/components/grid/demo/flex-align.md new file mode 100644 index 000000000..3e4ad1c75 --- /dev/null +++ b/components/grid/demo/flex-align.md @@ -0,0 +1,41 @@ + +#### Flex 对齐 +Flex 子元素垂直对齐。 + + + +#### Flex Alignment +Flex child elements vertically aligned. + + +```html + +``` + + diff --git a/components/grid/demo/flex-order.md b/components/grid/demo/flex-order.md new file mode 100644 index 000000000..370d163c1 --- /dev/null +++ b/components/grid/demo/flex-order.md @@ -0,0 +1,25 @@ + +#### Flex 排序 +从堆叠到水平排列。 +通过 Flex 布局的 Order 来改变元素的排序。 + + + +#### Flex Order +To change the element sort by Flex layout order. + + +```html + +``` + + diff --git a/components/grid/demo/flex-order.vue b/components/grid/demo/flex-order.vue deleted file mode 100644 index 2f680b396..000000000 --- a/components/grid/demo/flex-order.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - diff --git a/components/grid/demo/flex.md b/components/grid/demo/flex.md new file mode 100644 index 000000000..d786a08e1 --- /dev/null +++ b/components/grid/demo/flex.md @@ -0,0 +1,58 @@ + +#### Flex 布局 +Flex 布局基础。 +使用 `row-flex` 定义 `flex` 布局,其子元素根据不同的值 `start`,`center`,`end`,`space-between`,`space-around`,分别定义其在父节点里面的排版方式。 + + + +#### Flex Layout +Use `row-flex` define `flex` layout, its child elements depending on the value of the `start`,` center`, `end`,` space-between`, `space-around`, which are defined in its parent node layout mode. + + +```html + +``` + + diff --git a/components/grid/demo/flex.vue b/components/grid/demo/flex.vue deleted file mode 100644 index d7deb1566..000000000 --- a/components/grid/demo/flex.vue +++ /dev/null @@ -1,68 +0,0 @@ - - - diff --git a/components/grid/demo/flexible.vue b/components/grid/demo/flexible.vue deleted file mode 100644 index 96a5c6a01..000000000 --- a/components/grid/demo/flexible.vue +++ /dev/null @@ -1,34 +0,0 @@ - - - diff --git a/components/grid/demo/gutter.md b/components/grid/demo/gutter.md new file mode 100644 index 000000000..fe1254d3d --- /dev/null +++ b/components/grid/demo/gutter.md @@ -0,0 +1,44 @@ + +#### 区块间隔 +栅格常常需要和间隔进行配合,你可以使用 `Row` 的 `gutter` 属性,我们推荐使用 `(16+8n)px` 作为栅格间隔。(n 是自然数) +如果要支持响应式,可以写成 `{ xs: 8, sm: 16, md: 24, lg: 32 }`。 + + + +#### Grid Gutter +You can use the `gutter` property of `Row` as grid spacing, we recommend set it to `(16 + 8n) px`. (`n` stands for natural number.) +You can set it to a object like `{ xs: 8, sm: 16, md: 24, lg: 32 }` for responsive design. + + +```html + + +``` + + diff --git a/components/grid/demo/gutter.vue b/components/grid/demo/gutter.vue deleted file mode 100644 index b9ce3d289..000000000 --- a/components/grid/demo/gutter.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - diff --git a/components/grid/demo/index.vue b/components/grid/demo/index.vue index 9d25299d3..bca5e182b 100644 --- a/components/grid/demo/index.vue +++ b/components/grid/demo/index.vue @@ -1,75 +1,137 @@ - - + diff --git a/components/grid/demo/layout.vue b/components/grid/demo/layout.vue deleted file mode 100644 index 58ca44de9..000000000 --- a/components/grid/demo/layout.vue +++ /dev/null @@ -1,44 +0,0 @@ - - - diff --git a/components/grid/demo/offset.md b/components/grid/demo/offset.md new file mode 100644 index 000000000..db4514f01 --- /dev/null +++ b/components/grid/demo/offset.md @@ -0,0 +1,30 @@ + +#### 左右偏移 +列偏移。 +使用 `offset` 可以将列向右侧偏。例如,`:offset="4"` 将元素向右侧偏移了 4 个列(column)的宽度。 + + + +#### a-column offset +`Offset` can set the column to the right side. For example, using `offset = {4}` can set the element shifted to the right four columns width. + + +```html + +``` + + diff --git a/components/grid/demo/offset.vue b/components/grid/demo/offset.vue deleted file mode 100644 index 293141411..000000000 --- a/components/grid/demo/offset.vue +++ /dev/null @@ -1,40 +0,0 @@ - - - diff --git a/components/grid/demo/pull.vue b/components/grid/demo/pull.vue deleted file mode 100644 index 1b249d074..000000000 --- a/components/grid/demo/pull.vue +++ /dev/null @@ -1,33 +0,0 @@ - - - diff --git a/components/grid/demo/responsive-more.md b/components/grid/demo/responsive-more.md new file mode 100644 index 000000000..e3b524079 --- /dev/null +++ b/components/grid/demo/responsive-more.md @@ -0,0 +1,23 @@ + +#### 其他属性的响应式 +`span` `pull` `push` `offset` `order` 属性可以通过内嵌到 `xs` `sm` `md` `lg` `xl` `xxl` 属性中来使用。 +其中 `:xs="6"` 相当于 `:xs="{ span: 6 }"`。 + + + +#### More responsive +`span` `pull` `push` `offset` `order` property can be embedded into `xs` `sm` `md` `lg` `xl` properties to use, +where `:xs="6"` is equivalent to `:xs="{span: 6}"`. + + +```html + +``` + + diff --git a/components/grid/demo/responsive.md b/components/grid/demo/responsive.md new file mode 100644 index 000000000..2c0f075d1 --- /dev/null +++ b/components/grid/demo/responsive.md @@ -0,0 +1,21 @@ + +#### 响应式布局 +参照 Bootstrap 的 [响应式设计](http://getbootstrap.com/css/#grid-media-queries),预设五个响应尺寸:`xs` `sm` `md` `lg` `xl` `xxl`。 + + + +#### 响应式布局 +Referring to the Bootstrap [responsive design] (http://getbootstrap.com/css/#grid-media-queries), here preset five dimensions: `xs` `sm` `md` `lg` `xl`. + + +```html + +``` + + diff --git a/components/grid/demo/sort.md b/components/grid/demo/sort.md new file mode 100644 index 000000000..fbdd70a8c --- /dev/null +++ b/components/grid/demo/sort.md @@ -0,0 +1,23 @@ + +#### 栅格排序 +列排序。 +通过使用 `push` 和 `pull` 类就可以很容易的改变列(column)的顺序。 + + + +#### Grid sort +By using `push` and` pull` class you can easily change column order. + + +```html + +``` + + diff --git a/components/grid/index.en-US.md b/components/grid/index.en-US.md new file mode 100644 index 000000000..ee923db71 --- /dev/null +++ b/components/grid/index.en-US.md @@ -0,0 +1,28 @@ +## API + +### Row + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| align | the vertical alignment of the flex layout: `top` `middle` `bottom` | string | `top` | +| gutter | spacing between grids, could be a number or a object like `{ xs: 8, sm: 16, md: 24}` | number/object | 0 | +| justify | horizontal arrangement of the flex layout: `start` `end` `center` `space-around` `space-between` | string | `start` | +| type | layout mode, optional `flex`, [browser support](http://caniuse.com/#search=flex) | string | | + +### Col + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| offset | the number of cells to offset Col from the left | number | 0 | +| order | raster order, used in `flex` layout mode | number | 0 | +| pull | the number of cells that raster is moved to the left | number | 0 | +| push | the number of cells that raster is moved to the right | number | 0 | +| span | raster number of cells to occupy, 0 corresponds to `display: none` | number | none | +| xs | `<576px` and also default setting, could be a `span` value or an object containing above props | number\|object | - | +| sm | `≥576px`, could be a `span` value or an object containing above props | number\|object | - | +| md | `≥768px`, could be a `span` value or an object containing above props | number\|object | - | +| lg | `≥992px`, could be a `span` value or an object containing above props | number\|object | - | +| xl | `≥1200px`, could be a `span` value or an object containing above props | number\|object | - | +| xxl | `≥1600px`, could be a `span` value or an object containing above props | number\|object | - | + +The breakpoints of responsive grid follow [BootStrap 4 media queries rules](https://getbootstrap.com/docs/4.0/layout/overview/#responsive-breakpoints)(not including `occasionally part`). diff --git a/components/grid/index.js b/components/grid/index.js index cd65231b0..c5913e63c 100644 --- a/components/grid/index.js +++ b/components/grid/index.js @@ -1,6 +1,7 @@ -import Row from './Row.vue' -import Col from './Col.vue' +import Row from './Row' +import Col from './Col' -export default { - Col, Row, +export { + Row, + Col, } diff --git a/components/grid/index.zh-CN.md b/components/grid/index.zh-CN.md new file mode 100644 index 000000000..a139e98fd --- /dev/null +++ b/components/grid/index.zh-CN.md @@ -0,0 +1,28 @@ +## API + +### Row + +| 成员 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| align | flex 布局下的垂直对齐方式:`top` `middle` `bottom` | string | `top` | +| gutter | 栅格间隔,可以写成像素值或支持响应式的对象写法 `{ xs: 8, sm: 16, md: 24}` | number/object | 0 | +| justify | flex 布局下的水平排列方式:`start` `end` `center` `space-around` `space-between` | string | `start` | +| type | 布局模式,可选 `flex`,[现代浏览器](http://caniuse.com/#search=flex) 下有效 | string | | + +### Col + +| 成员 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| offset | 栅格左侧的间隔格数,间隔内不可以有栅格 | number | 0 | +| order | 栅格顺序,`flex` 布局模式下有效 | number | 0 | +| pull | 栅格向左移动格数 | number | 0 | +| push | 栅格向右移动格数 | number | 0 | +| span | 栅格占位格数,为 0 时相当于 `display: none` | number | - | +| xs | `<576px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number\|object | - | +| sm | `≥576px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number\|object | - | +| md | `≥768px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number\|object | - | +| lg | `≥992px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number\|object | - | +| xl | `≥1200px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number\|object | - | +| xxl | `≥1600px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number\|object | - | + +响应式栅格的断点扩展自 [BootStrap 4 的规则](https://getbootstrap.com/docs/4.0/layout/overview/#responsive-breakpoints)(不包含链接里 `occasionally` 的部分)。 diff --git a/components/index.js b/components/index.js index 61e55c926..7787567d5 100644 --- a/components/index.js +++ b/components/index.js @@ -13,7 +13,11 @@ const RadioGroup = Radio.Group const RadioButton = Radio.Button export { Radio, RadioGroup, RadioButton } -export { default as Grid } from './grid' +import { Row, Col } from './grid' +export { + Row, + Col, +} export { default as Rate } from './rate' @@ -21,10 +25,6 @@ export { default as Tooltip } from './tooltip' export { default as Pagination } from './pagination' -export { default as Row } from './grid/Row' - -export { default as Col } from './grid/Col' - export { default as Tag } from './tag' export { default as Avatar } from './avatar' @@ -88,24 +88,12 @@ export { default as Affix } from './affix' export { default as Cascader } from './cascader' export { default as BackTop } from './back-top' export { default as Modal } from './modal' -import { - info, - success, - error, - warning, - warn, - confirm, -} from './modal' +export { default as Alert } from './alert' +export { default as TimePicker } from './time-picker' const api = { notification, message, - modalInfo: info, - modalSuccess: success, - modalError: error, - modalWarning: warning, - modalWarn: warn, - modalConfirm: confirm, } export { api } diff --git a/components/locale-provider/default.js b/components/locale-provider/default.js index 5d8c10b1c..d0224bed9 100644 --- a/components/locale-provider/default.js +++ b/components/locale-provider/default.js @@ -1,13 +1,13 @@ -// import Pagination from 'rc-pagination/lib/locale/en_US' +import Pagination from '../vc-pagination/locale/en_US' // import DatePicker from '../date-picker/locale/en_US' -// import TimePicker from '../time-picker/locale/en_US' +import TimePicker from '../time-picker/locale/en_US' // import Calendar from '../calendar/locale/en_US' export default { locale: 'en', - // Pagination, + Pagination, // DatePicker, - // TimePicker, + TimePicker, // Calendar, Table: { filterTitle: 'Filter menu', diff --git a/components/locale-provider/zh_CN.js b/components/locale-provider/zh_CN.js index 4fb6613c5..148e02e6c 100644 --- a/components/locale-provider/zh_CN.js +++ b/components/locale-provider/zh_CN.js @@ -1,13 +1,13 @@ -// import Pagination from 'rc-pagination/lib/locale/zh_CN' +import Pagination from '../vc-pagination/locale/zh_CN' // import DatePicker from '../date-picker/locale/zh_CN' -// import TimePicker from '../time-picker/locale/zh_CN' +import TimePicker from '../time-picker/locale/zh_CN' // import Calendar from '../calendar/locale/zh_CN' export default { locale: 'zh-cn', - // Pagination, + Pagination, // DatePicker, - // TimePicker, + TimePicker, // Calendar, Table: { filterTitle: '筛选', diff --git a/components/modal/Modal.vue b/components/modal/Modal.vue index 81ff819d2..99893ae9d 100644 --- a/components/modal/Modal.vue +++ b/components/modal/Modal.vue @@ -63,6 +63,10 @@ export default { visible: false, okType: 'primary', }), + model: { + prop: 'visible', + event: 'change', + }, // static info: ModalFunc; // static success: ModalFunc; // static error: ModalFunc; @@ -72,6 +76,7 @@ export default { methods: { handleCancel (e) { this.$emit('cancel', e) + this.$emit('change', false) }, handleOk (e) { @@ -131,7 +136,7 @@ export default { props: { ...this.$props, title, - footer: typeof footer === undefined ? defaultFooter : footer, + footer: footer === undefined ? defaultFooter : footer, visible: visible, mousePosition, }, diff --git a/components/modal/confirm.js b/components/modal/confirm.js index 23365b493..a4781d986 100644 --- a/components/modal/confirm.js +++ b/components/modal/confirm.js @@ -2,7 +2,10 @@ import Vue from 'vue' import ConfirmDialog from './ConfirmDialog' export default function confirm (config) { const div = document.createElement('div') + const el = document.createElement('div') + div.appendChild(el) document.body.appendChild(div) + let confirmDialogInstance = null function close (...args) { destroy(...args) @@ -23,7 +26,7 @@ export default function confirm (config) { function render (props) { return new Vue({ - el: div, + el: el, render () { return }, diff --git a/components/modal/demo/async.md b/components/modal/demo/async.md new file mode 100644 index 000000000..b35ef6e5b --- /dev/null +++ b/components/modal/demo/async.md @@ -0,0 +1,57 @@ + + +#### 异步关闭 +点击确定后异步关闭对话框,例如提交表单。 + + + +#### Asynchronously close +Asynchronously close a modal dialog when a user clicked OK button, for example, +you can use this pattern when you submit a form. + + +```html + + +``` + diff --git a/components/modal/demo/basic.md b/components/modal/demo/basic.md index f955e32db..e041be603 100644 --- a/components/modal/demo/basic.md +++ b/components/modal/demo/basic.md @@ -15,9 +15,8 @@ Basic modal. Open

Some contents...

Some contents...

@@ -40,10 +39,6 @@ export default { console.log(e); this.visible = false }, - handleCancel(e) { - console.log(e); - this.visible = false - }, } } diff --git a/components/modal/demo/confirm-promise.md b/components/modal/demo/confirm-promise.md new file mode 100644 index 000000000..24106f6b5 --- /dev/null +++ b/components/modal/demo/confirm-promise.md @@ -0,0 +1,40 @@ + + +#### 确认对话框 +使用 `confirm()` 可以快捷地弹出确认框。onCancel/onOk 返回 promise 可以延迟关闭 + + + +#### Confirmation modal dialog +To use `confirm()` to popup confirmation modal dialog. Let onCancel/onOk function return a promise object to +delay closing the dialog. + + +```html + + +``` + diff --git a/components/modal/demo/confirm.md b/components/modal/demo/confirm.md index b5db87850..839f3f4bc 100644 --- a/components/modal/demo/confirm.md +++ b/components/modal/demo/confirm.md @@ -21,10 +21,12 @@ To use `confirm()` to popup a confirmation modal dialog. +``` + diff --git a/components/modal/demo/index.vue b/components/modal/demo/index.vue new file mode 100644 index 000000000..a7895bdaa --- /dev/null +++ b/components/modal/demo/index.vue @@ -0,0 +1,63 @@ + + + diff --git a/components/modal/demo/info.md b/components/modal/demo/info.md new file mode 100644 index 000000000..bcfba8058 --- /dev/null +++ b/components/modal/demo/info.md @@ -0,0 +1,66 @@ + + +#### 信息提示 +各种类型的信息提示,只提供一个按钮用于关闭。 + + + +#### Information modal dialog +In the various types of information modal dialog, only one button to close dialog is provided. + + +```html + + +``` + diff --git a/components/modal/demo/locale.md b/components/modal/demo/locale.md new file mode 100644 index 000000000..ba3d40512 --- /dev/null +++ b/components/modal/demo/locale.md @@ -0,0 +1,60 @@ + + +#### 国际化 +设置 `okText` 与 `cancelText` 以自定义按钮文字。 + + + +#### Internationalization +To customize the text of the buttons, you need to set `okText` and `cancelText` props. + + +```html + + +``` + diff --git a/components/modal/demo/manual.md b/components/modal/demo/manual.md new file mode 100644 index 000000000..e8b2f3d2d --- /dev/null +++ b/components/modal/demo/manual.md @@ -0,0 +1,31 @@ + + +#### 手动移除 +手动关闭modal。 + + + +#### Manual to destroy +Manually destroying a modal. + + +```html + + +``` + diff --git a/components/modal/demo/position.md b/components/modal/demo/position.md new file mode 100644 index 000000000..1d868906b --- /dev/null +++ b/components/modal/demo/position.md @@ -0,0 +1,92 @@ + + +#### 自定义位置 +使用 `style.top` 或配合其他样式来设置对话框位置。 + + + +#### To customize the position of modal +You can use `style.top` or other styles to set position of modal dialog. + + +```html + + + +``` + diff --git a/components/modal/index.en-US.md b/components/modal/index.en-US.md new file mode 100644 index 000000000..92323c5cf --- /dev/null +++ b/components/modal/index.en-US.md @@ -0,0 +1,69 @@ + +## API + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| afterClose | Specify a function that will be called when modal is closed completely. | function | - | +| bodyStyle | Body style for modal body element. Such as height, padding etc. | object | {} | +| cancelText | Text of the Cancel button | string\|slot | `Cancel` | +| closable | Whether a close (x) button is visible on top right of the modal dialog or not | boolean | true | +| confirmLoading | Whether to apply loading visual effect for OK button or not | boolean | false | +| destroyOnClose | Whether to unmount child compenents on onClose | boolean | false | +| footer | Footer content, set as `:footer="null"` when you don't need default buttons | string\|slot | OK and Cancel buttons | +| getContainer | Return the mount node for Modal | (instance): HTMLElement | () => document.body | +| mask | Whether show mask or not. | Boolean | true | +| maskClosable | Whether to close the modal dialog when the mask (area outside the modal) is clicked | boolean | true | +| maskStyle | Style for modal's mask element. | object | {} | +| okText | Text of the OK button | string\|slot | `OK` | +| okType | Button `type` of the OK button | string | `primary` | +| style | Style of floating layer, typically used at least for adjusting the position. | object | - | +| title | The modal dialog's title | string\|slot | - | +| visible | Whether the modal dialog is visible or not | boolean | false | +| width | Width of the modal dialog | string\|number | 520 | +| wrapClassName | The class name of the container of the modal dialog | string | - | +| zIndex | The `z-index` of the Modal | Number | 1000 | + +### events +| Events Name | Description | Arguments | +| --- | --- | --- | +| cancel | Specify a function that will be called when a user clicks mask, close button on top right or Cancel button | function(e) | +| ok | Specify a function that will be called when a user clicks the OK button | function(e) | + +#### Note + +> The state of Modal will be preserved at it's component lifecycle by default, if you wish to open it with a brand new state everytime, set `destroyOnClose` on it. + +### Modal.method() + +There are five ways to display the information based on the content's nature: + +- `Modal.info` +- `Modal.success` +- `Modal.error` +- `Modal.warning` +- `Modal.confirm` + +The items listed above are all functions, expecting a settings object as parameter. +The properties of the object are follows: + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| cancelText | Text of the Cancel button | string | `Cancel` | +| class | class of container | string | - | +| content | Content | string\|vNode | - | +| iconType | Icon `type` of the Icon component | string | `question-circle` | +| maskClosable | Whether to close the modal dialog when the mask (area outside the modal) is clicked | Boolean | `false` | +| okText | Text of the OK button | string | `OK` | +| okType | Button `type` of the OK button | string | `primary` | +| title | Title | string\|vNode | - | +| width | Width of the modal dialog | string\|number | 416 | +| zIndex | The `z-index` of the Modal | Number | 1000 | +| onCancel | Specify a function that will be called when the user clicks the Cancel button. The parameter of this function is a function whose execution should include closing the dialog. You can also just return a promise and when the promise is resolved, the modal dialog will also be closed | function | - | +| onOk | Specify a function that will be called when the user clicks the OK button. The parameter of this function is a function whose execution should include closing the dialog. You can also just return a promise and when the promise is resolved, the modal dialog will also be closed | function | - | + +All the `Modal.method`s will return a reference, and then we can close the modal dialog by the reference. + +```jsx +const ref = Modal.info(); +ref.destroy(); +``` diff --git a/components/modal/index.js b/components/modal/index.js index 032891f54..759838756 100644 --- a/components/modal/index.js +++ b/components/modal/index.js @@ -53,14 +53,11 @@ const confirm = function (props) { } return modalConfirm(config) } - -export { - info, - success, - error, - warning, - warn, - confirm, -} +Modal.info = info +Modal.success = success +Modal.error = error +Modal.warning = warning +Modal.warn = warn +Modal.confirm = confirm export default Modal diff --git a/components/modal/index.zh-CN.md b/components/modal/index.zh-CN.md new file mode 100644 index 000000000..cb68f3e33 --- /dev/null +++ b/components/modal/index.zh-CN.md @@ -0,0 +1,67 @@ +## API + +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| afterClose | Modal 完全关闭后的回调 | function | 无 | +| bodyStyle | Modal body 样式 | object | {} | +| cancelText | 取消按钮文字 | string\| slot | 取消 | +| closable | 是否显示右上角的关闭按钮 | boolean | true | +| confirmLoading | 确定按钮 loading | boolean | 无 | +| destroyOnClose | 关闭时销毁 Modal 里的子元素 | boolean | false | +| footer | 底部内容,当不需要默认底部按钮时,可以设为 `:footer="null"` | string\|slot | 确定取消按钮 | +| getContainer | 指定 Modal 挂载的 HTML 节点 | (instance): HTMLElement | () => document.body | +| mask | 是否展示遮罩 | Boolean | true | +| maskClosable | 点击蒙层是否允许关闭 | boolean | true | +| maskStyle | 遮罩样式 | object | {} | +| okText | 确认按钮文字 | string\|slot | 确定 | +| okType | 确认按钮类型 | string | primary | +| style | 可用于设置浮层的样式,调整浮层位置等 | object | - | +| title | 标题 | string\|slot | 无 | +| visible(v-model) | 对话框是否可见 | boolean | 无 | +| width | 宽度 | string\|number | 520 | +| wrapClassName | 对话框外层容器的类名 | string | - | +| zIndex | 设置 Modal 的 `z-index` | Number | 1000 | + +### 事件 +| 事件名称 | 说明 | 回调参数 | +| --- | --- | --- | +| cancel | 点击遮罩层或右上角叉或取消按钮的回调 | function(e) | +| ok | 点击确定回调 | function(e) | + +#### 注意 + +> `` 默认关闭后状态不会自动清空, 如果希望每次打开都是新内容,请设置 `destroyOnClose`。 + +### Modal.method() + +包括: + +- `Modal.info` +- `Modal.success` +- `Modal.error` +- `Modal.warning` +- `Modal.confirm` + +以上均为一个函数,参数为 object,具体属性如下: + +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| cancelText | 取消按钮文字 | string | 取消 | +| class | 容器类名 | string | - | +| content | 内容 | string\|vNode | 无 | +| iconType | 图标 Icon 类型 | string | question-circle | +| maskClosable | 点击蒙层是否允许关闭 | Boolean | `false` | +| okText | 确认按钮文字 | string | 确定 | +| okType | 确认按钮类型 | string | primary | +| title | 标题 | string\|vNode | 无 | +| width | 宽度 | string\|number | 416 | +| zIndex | 设置 Modal 的 `z-index` | Number | 1000 | +| onCancel | 取消回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭 | function | 无 | +| onOk | 点击确定回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭 | function | 无 | + +以上函数调用后,会返回一个引用,可以通过该引用关闭弹窗。 + +```jsx +const ref = Modal.info(); +ref.destroy(); +``` diff --git a/components/style.js b/components/style.js index 82f50e0d0..954a968c3 100644 --- a/components/style.js +++ b/components/style.js @@ -28,3 +28,5 @@ import './affix/style' import './cascader/style' import './back-top/style' import './modal/style' +import './alert/style' +import './time-picker/style' diff --git a/components/tag/demo/control.vue b/components/tag/demo/control.vue index eff2c24f3..1f81d908a 100644 --- a/components/tag/demo/control.vue +++ b/components/tag/demo/control.vue @@ -10,12 +10,12 @@ {{tag}} - +#### 12 小时制 +12 小时制的时间选择器,默认的 format 为 `h:mm:ss a`。 + + + +#### 12 hours +TimePicker of 12 hours format, with default format `h:mm:ss a`. + + +```html + + +``` diff --git a/components/time-picker/demo/addon.md b/components/time-picker/demo/addon.md new file mode 100644 index 000000000..2f744d775 --- /dev/null +++ b/components/time-picker/demo/addon.md @@ -0,0 +1,43 @@ + +#### 附加内容 +在 TimePicker 选择框底部显示自定义的内容。 + + + +#### Addon +Render addon contents to timepicker panel's bottom. + + +```html + + +``` diff --git a/components/time-picker/demo/basic.md b/components/time-picker/demo/basic.md new file mode 100644 index 000000000..643040b57 --- /dev/null +++ b/components/time-picker/demo/basic.md @@ -0,0 +1,26 @@ + +#### 基本 +点击 TimePicker,然后可以在浮层中选择或者输入某一时间。 + + + +#### Basic +Click `TimePicker`, and then we could select or input a time in panel. + + +```html + + +``` diff --git a/components/time-picker/demo/disabled.md b/components/time-picker/demo/disabled.md new file mode 100644 index 000000000..6cf2a43c4 --- /dev/null +++ b/components/time-picker/demo/disabled.md @@ -0,0 +1,23 @@ + +#### 禁用 +禁用时间选择。 + + + +#### disabled +A disabled state of the `TimePicker`. + + +```html + + +``` diff --git a/components/time-picker/demo/hide-column.md b/components/time-picker/demo/hide-column.md new file mode 100644 index 000000000..415e2d833 --- /dev/null +++ b/components/time-picker/demo/hide-column.md @@ -0,0 +1,23 @@ + +#### 选择时分 +TimePicker 浮层中的列会随着 `format` 变化,当略去 `format` 中的某部分时,浮层中对应的列也会消失。 + + + +#### Hour and minute +While part of `format` is omitted, the corresponding column in panel will disappear, too. + + +```html + + +``` diff --git a/components/time-picker/demo/index.vue b/components/time-picker/demo/index.vue new file mode 100644 index 000000000..9298d36e9 --- /dev/null +++ b/components/time-picker/demo/index.vue @@ -0,0 +1,52 @@ + + diff --git a/components/time-picker/demo/interval-options.md b/components/time-picker/demo/interval-options.md new file mode 100644 index 000000000..0add82dd7 --- /dev/null +++ b/components/time-picker/demo/interval-options.md @@ -0,0 +1,15 @@ + +#### 步长选项 +可以使用 `hourStep` `minuteStep` `secondStep` 按步长展示可选的时分秒。 + + + +#### interval option +Show stepped options by `hourStep` `minuteStep` `secondStep`. + + +```html + +``` diff --git a/components/time-picker/demo/size.md b/components/time-picker/demo/size.md new file mode 100644 index 000000000..9569b03a4 --- /dev/null +++ b/components/time-picker/demo/size.md @@ -0,0 +1,27 @@ + +#### 三种大小 +三种大小的输入框,大的用在表单中,中的为默认。 + + + +#### Three Sizes +The input box comes in three sizes. large is used in the form, while the medium size is the default. + + +```html + + +``` diff --git a/components/time-picker/demo/value.md b/components/time-picker/demo/value.md new file mode 100644 index 000000000..f6578cb62 --- /dev/null +++ b/components/time-picker/demo/value.md @@ -0,0 +1,43 @@ + +#### 受控组件 +value 和 onChange 需要配合使用。也可以直接使用v-model。 + + + +#### Under Control +`value` and `@change` should be used together or use v-model. + + +```html + + +``` diff --git a/components/time-picker/index.en-US.md b/components/time-picker/index.en-US.md new file mode 100644 index 000000000..436066709 --- /dev/null +++ b/components/time-picker/index.en-US.md @@ -0,0 +1,39 @@ +## API + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| addon | some addon to timepicker panel bottom | slot | - | +| allowEmpty | allow clearing text | boolean | true | +| autoFocus | get focus when component mounted | boolean | false | +| clearText | clear tooltip of icon | string | clear | +| defaultOpenValue | default open panel value, used to set utcOffset,locale if value/defaultValue absent | [moment](http://momentjs.com/) | moment() | +| defaultValue | to set default time | [moment](http://momentjs.com/) | - | +| disabled | determine whether the TimePicker is disabled | boolean | false | +| disabledHours | to specify the hours that cannot be selected | function() | - | +| disabledMinutes | to specify the minutes that cannot be selected | function(selectedHour) | - | +| disabledSeconds | to specify the seconds that cannot be selected | function(selectedHour, selectedMinute) | - | +| format | to set the time format | string | "HH:mm:ss" | +| getPopupContainer | to set the container of the floating layer, while the default is to create a div element in body | function(trigger) | - | +| hideDisabledOptions | hide the options that can not be selected | boolean | false | +| hourStep | interval between hours in picker | number | 1 | +| minuteStep | interval between minutes in picker | number | 1 | +| open(.sync) | whether to popup panel | boolean | false | +| placeholder | display when there's no value | string | "Select a time" | +| popupClassName | className of panel | string | '' | +| secondStep | interval between seconds in picker | number | 1 | +| use12Hours | display as 12 hours format, with default format `h:mm:ss a` | boolean | false | +| value(v-model) | to set time | [moment](http://momentjs.com/) | - | + +### events +| Events Name | Description | Arguments | +| --- | --- | --- | +| change | a callback function, can be executed when the selected time is changing | function(time: moment, timeString: string): void | +| openChange | a callback function which will be called while panel opening/closing | (open: boolean): void | + +## Methods + +| Name | Description | +| ---- | ----------- | +| blur() | remove focus | +| focus() | get focus | + diff --git a/components/time-picker/index.vue b/components/time-picker/index.vue new file mode 100644 index 000000000..acdf41474 --- /dev/null +++ b/components/time-picker/index.vue @@ -0,0 +1,166 @@ + \ No newline at end of file diff --git a/components/time-picker/index.zh-CN.md b/components/time-picker/index.zh-CN.md new file mode 100644 index 000000000..d25057dc4 --- /dev/null +++ b/components/time-picker/index.zh-CN.md @@ -0,0 +1,39 @@ + +## API + +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| addon | 选择框底部显示自定义的内容 | slot | 无 | +| allowEmpty | 是否展示清除按钮 | boolean | true | +| autoFocus | 自动获取焦点 | boolean | false | +| clearText | 清除按钮的提示文案 | string | clear | +| defaultOpenValue | 当 defaultValue/value 不存在时,可以设置面板打开时默认选中的值 | [moment](http://momentjs.com/) | moment() | +| defaultValue | 默认时间 | [moment](http://momentjs.com/) | 无 | +| disabled | 禁用全部操作 | boolean | false | +| disabledHours | 禁止选择部分小时选项 | function() | 无 | +| disabledMinutes | 禁止选择部分分钟选项 | function(selectedHour) | 无 | +| disabledSeconds | 禁止选择部分秒选项 | function(selectedHour, selectedMinute) | 无 | +| format | 展示的时间格式 | string | "HH:mm:ss" | +| getPopupContainer | 定义浮层的容器,默认为 body 上新建 div | function(trigger) | 无 | +| hideDisabledOptions | 隐藏禁止选择的选项 | boolean | false | +| hourStep | 小时选项间隔 | number | 1 | +| minuteStep | 分钟选项间隔 | number | 1 | +| open(.sync) | 面板是否打开 | boolean | false | +| placeholder | 没有值的时候显示的内容 | string | "请选择时间" | +| popupClassName | 弹出层类名 | string | '' | +| secondStep | 秒选项间隔 | number | 1 | +| use12Hours | 使用 12 小时制,为 true 时 `format` 默认为 `h:mm:ss a` | boolean | false | +| value(v-model) | 当前时间 | [moment](http://momentjs.com/) | 无 | + +### 事件 +| 事件名称 | 说明 | 回调参数 | +| --- | --- | --- | +| change | 时间发生变化的回调 | function(time: moment, timeString: string): void | +| openChange | 面板打开/关闭时的回调 | (open: boolean): void | + +## 方法 + +| 名称 | 描述 | +| --- | --- | +| blur() | 移除焦点 | +| focus() | 获取焦点 | diff --git a/components/time-picker/locale/ar_EG.js b/components/time-picker/locale/ar_EG.js new file mode 100644 index 000000000..cf6d7575b --- /dev/null +++ b/components/time-picker/locale/ar_EG.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'اختيار الوقت', +} + +export default locale diff --git a/components/time-picker/locale/bg_BG.js b/components/time-picker/locale/bg_BG.js new file mode 100644 index 000000000..cf69fa433 --- /dev/null +++ b/components/time-picker/locale/bg_BG.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Избор на час', +} + +export default locale diff --git a/components/time-picker/locale/ca_ES.js b/components/time-picker/locale/ca_ES.js new file mode 100644 index 000000000..3333a9ab7 --- /dev/null +++ b/components/time-picker/locale/ca_ES.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Seleccionar hora', +} + +export default locale diff --git a/components/time-picker/locale/cs_CZ.js b/components/time-picker/locale/cs_CZ.js new file mode 100644 index 000000000..0f9049c33 --- /dev/null +++ b/components/time-picker/locale/cs_CZ.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Vybrat čas', +} + +export default locale diff --git a/components/time-picker/locale/de_DE.js b/components/time-picker/locale/de_DE.js new file mode 100644 index 000000000..c784b34da --- /dev/null +++ b/components/time-picker/locale/de_DE.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Zeit auswählen', +} + +export default locale diff --git a/components/time-picker/locale/el_GR.js b/components/time-picker/locale/el_GR.js new file mode 100644 index 000000000..31df2e549 --- /dev/null +++ b/components/time-picker/locale/el_GR.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Επιλέξτε ώρα', +} + +export default locale diff --git a/components/time-picker/locale/en_GB.js b/components/time-picker/locale/en_GB.js new file mode 100644 index 000000000..02b92d52a --- /dev/null +++ b/components/time-picker/locale/en_GB.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Select time', +} + +export default locale diff --git a/components/time-picker/locale/en_US.js b/components/time-picker/locale/en_US.js new file mode 100644 index 000000000..02b92d52a --- /dev/null +++ b/components/time-picker/locale/en_US.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Select time', +} + +export default locale diff --git a/components/time-picker/locale/es_ES.js b/components/time-picker/locale/es_ES.js new file mode 100644 index 000000000..3333a9ab7 --- /dev/null +++ b/components/time-picker/locale/es_ES.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Seleccionar hora', +} + +export default locale diff --git a/components/time-picker/locale/et_EE.js b/components/time-picker/locale/et_EE.js new file mode 100644 index 000000000..04b9cbc85 --- /dev/null +++ b/components/time-picker/locale/et_EE.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Vali aeg', +} + +export default locale diff --git a/components/time-picker/locale/fa_IR.js b/components/time-picker/locale/fa_IR.js new file mode 100644 index 000000000..82c5a5783 --- /dev/null +++ b/components/time-picker/locale/fa_IR.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'انتخاب زمان', +} + +export default locale diff --git a/components/time-picker/locale/fi_FI.js b/components/time-picker/locale/fi_FI.js new file mode 100644 index 000000000..e296072d0 --- /dev/null +++ b/components/time-picker/locale/fi_FI.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Valitse aika', +} + +export default locale diff --git a/components/time-picker/locale/fr_BE.js b/components/time-picker/locale/fr_BE.js new file mode 100644 index 000000000..76c4c75b0 --- /dev/null +++ b/components/time-picker/locale/fr_BE.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Sélectionner l\'heure', +} + +export default locale diff --git a/components/time-picker/locale/fr_FR.js b/components/time-picker/locale/fr_FR.js new file mode 100644 index 000000000..76c4c75b0 --- /dev/null +++ b/components/time-picker/locale/fr_FR.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Sélectionner l\'heure', +} + +export default locale diff --git a/components/time-picker/locale/is_IS.js b/components/time-picker/locale/is_IS.js new file mode 100644 index 000000000..5542ec5c6 --- /dev/null +++ b/components/time-picker/locale/is_IS.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Velja tíma', +} + +export default locale diff --git a/components/time-picker/locale/it_IT.js b/components/time-picker/locale/it_IT.js new file mode 100644 index 000000000..eecb1aed7 --- /dev/null +++ b/components/time-picker/locale/it_IT.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Selezionare il tempo', +} + +export default locale diff --git a/components/time-picker/locale/ja_JP.js b/components/time-picker/locale/ja_JP.js new file mode 100644 index 000000000..0f00617ea --- /dev/null +++ b/components/time-picker/locale/ja_JP.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: '時刻を選択', +} + +export default locale diff --git a/components/time-picker/locale/ko_KR.js b/components/time-picker/locale/ko_KR.js new file mode 100644 index 000000000..9354fbd3d --- /dev/null +++ b/components/time-picker/locale/ko_KR.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: '날짜 선택', +} + +export default locale diff --git a/components/time-picker/locale/ku_IQ.js b/components/time-picker/locale/ku_IQ.js new file mode 100755 index 000000000..fc1d17455 --- /dev/null +++ b/components/time-picker/locale/ku_IQ.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Demê hilbijêre', +} + +export default locale diff --git a/components/time-picker/locale/nb_NO.js b/components/time-picker/locale/nb_NO.js new file mode 100644 index 000000000..8309eb2f3 --- /dev/null +++ b/components/time-picker/locale/nb_NO.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Velg tid', +} + +export default locale diff --git a/components/time-picker/locale/nl_BE.js b/components/time-picker/locale/nl_BE.js new file mode 100644 index 000000000..5a89f5331 --- /dev/null +++ b/components/time-picker/locale/nl_BE.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Selecteer tijd', +} + +export default locale diff --git a/components/time-picker/locale/nl_NL.js b/components/time-picker/locale/nl_NL.js new file mode 100644 index 000000000..5a89f5331 --- /dev/null +++ b/components/time-picker/locale/nl_NL.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Selecteer tijd', +} + +export default locale diff --git a/components/time-picker/locale/pl_PL.js b/components/time-picker/locale/pl_PL.js new file mode 100644 index 000000000..a38a35c95 --- /dev/null +++ b/components/time-picker/locale/pl_PL.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Wybierz godzinę', +} + +export default locale diff --git a/components/time-picker/locale/pt_BR.js b/components/time-picker/locale/pt_BR.js new file mode 100644 index 000000000..d1722b879 --- /dev/null +++ b/components/time-picker/locale/pt_BR.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Hora', +} + +export default locale diff --git a/components/time-picker/locale/pt_PT.js b/components/time-picker/locale/pt_PT.js new file mode 100644 index 000000000..d1722b879 --- /dev/null +++ b/components/time-picker/locale/pt_PT.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Hora', +} + +export default locale diff --git a/components/time-picker/locale/ru_RU.js b/components/time-picker/locale/ru_RU.js new file mode 100644 index 000000000..f4395aea8 --- /dev/null +++ b/components/time-picker/locale/ru_RU.js @@ -0,0 +1,8 @@ +/** + * Created by Andrey Gayvoronsky on 13/04/16. + */ +const locale = { + placeholder: 'Выберите время', +} + +export default locale diff --git a/components/time-picker/locale/sk_SK.js b/components/time-picker/locale/sk_SK.js new file mode 100644 index 000000000..1a7cb3804 --- /dev/null +++ b/components/time-picker/locale/sk_SK.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Vybrať čas', +} + +export default locale diff --git a/components/time-picker/locale/sr_RS.js b/components/time-picker/locale/sr_RS.js new file mode 100644 index 000000000..202655005 --- /dev/null +++ b/components/time-picker/locale/sr_RS.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Izaberite vreme', +} + +export default locale diff --git a/components/time-picker/locale/sv_SE.js b/components/time-picker/locale/sv_SE.js new file mode 100644 index 000000000..0d892a93a --- /dev/null +++ b/components/time-picker/locale/sv_SE.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Välj tid', +} + +export default locale diff --git a/components/time-picker/locale/th_TH.js b/components/time-picker/locale/th_TH.js new file mode 100644 index 000000000..6d8628976 --- /dev/null +++ b/components/time-picker/locale/th_TH.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'เลือกเวลา', +} + +export default locale diff --git a/components/time-picker/locale/tr_TR.js b/components/time-picker/locale/tr_TR.js new file mode 100644 index 000000000..3cb3d7e15 --- /dev/null +++ b/components/time-picker/locale/tr_TR.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Zaman Seç', +} + +export default locale diff --git a/components/time-picker/locale/uk_UA.js b/components/time-picker/locale/uk_UA.js new file mode 100644 index 000000000..4f379c553 --- /dev/null +++ b/components/time-picker/locale/uk_UA.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Оберіть час', +} + +export default locale diff --git a/components/time-picker/locale/vi_VN.js b/components/time-picker/locale/vi_VN.js new file mode 100644 index 000000000..225ef167f --- /dev/null +++ b/components/time-picker/locale/vi_VN.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Chọn thời gian', +} + +export default locale diff --git a/components/time-picker/locale/zh_CN.js b/components/time-picker/locale/zh_CN.js new file mode 100644 index 000000000..1b83292e3 --- /dev/null +++ b/components/time-picker/locale/zh_CN.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: '请选择时间', +} + +export default locale diff --git a/components/time-picker/locale/zh_TW.js b/components/time-picker/locale/zh_TW.js new file mode 100644 index 000000000..0d415a019 --- /dev/null +++ b/components/time-picker/locale/zh_TW.js @@ -0,0 +1,5 @@ +const locale = { + placeholder: '請選擇時間', +} + +export default locale diff --git a/components/time-picker/style/index.js b/components/time-picker/style/index.js new file mode 100644 index 000000000..992a50794 --- /dev/null +++ b/components/time-picker/style/index.js @@ -0,0 +1,5 @@ +import '../../style/index.less' +import './index.less' + +// style dependencies +import '../../input/style' diff --git a/components/time-picker/style/index.less b/components/time-picker/style/index.less new file mode 100644 index 000000000..0d7f8c591 --- /dev/null +++ b/components/time-picker/style/index.less @@ -0,0 +1,234 @@ +@import "../../style/themes/default"; +@import "../../style/mixins/index"; +@import "../../input/style/mixin"; + +@timepicker-prefix-cls: ~"@{ant-prefix}-time-picker"; +@timepicker-item-height: 32px; + +.@{timepicker-prefix-cls}-panel { + .reset-component; + z-index: @zindex-picker; + position: absolute; + + &-inner { + position: relative; + outline: none; + list-style: none; + font-size: @font-size-base; + text-align: left; + background-color: @component-background; + border-radius: @border-radius-base; + box-shadow: @box-shadow-base; + background-clip: padding-box; + overflow: hidden; + left: -2px; + } + + &-input { + margin: 0; + padding: 0; + border: 0; + width: 100%; + cursor: auto; + outline: 0; + + .placeholder; + + &-wrap { + box-sizing: border-box; + position: relative; + padding: 7px 2px 7px @control-padding-horizontal; + border-bottom: @border-width-base @border-style-base @border-color-split; + } + + &-invalid { + border-color: red; + } + } + + &-clear-btn { + position: absolute; + right: 8px; + cursor: pointer; + overflow: hidden; + width: 20px; + height: 20px; + text-align: center; + line-height: 20px; + top: 7px; + margin: 0; + } + + &-clear-btn:after { + font-size: @font-size-base - 2px; + color: @disabled-color; + display: inline-block; + line-height: 1; + width: 20px; + transition: color 0.3s ease; + .iconfont-font("\e62e"); + } + + &-clear-btn:hover:after { + color: @text-color-secondary; + } + + &-narrow &-input-wrap { + max-width: @time-picker-panel-column-width * 2; + } + + &-select { + float: left; + font-size: @font-size-base; + border-left: @border-width-base @border-style-base @border-color-split; + box-sizing: border-box; + width: @time-picker-panel-column-width; + overflow: hidden; + position: relative; // Fix chrome weird render bug + max-height: @timepicker-item-height * 6; + + &:hover { + overflow-y: auto; + } + + &:first-child { + border-left: 0; + margin-left: 0; + } + + &:last-child { + border-right: 0; + } + + &:only-child { + width: 100%; + } + + ul { + list-style: none; + box-sizing: border-box; + margin: 0; + padding: 0 0 @timepicker-item-height * 5; + width: 100%; + } + + li { + list-style: none; + box-sizing: content-box; + margin: 0; + padding: 0 0 0 @control-padding-horizontal; + width: 100%; + height: @timepicker-item-height; + line-height: @timepicker-item-height; + text-align: left; + cursor: pointer; + user-select: none; + transition: background 0.3s; + } + + li:hover { + background: @item-hover-bg; + } + + li&-option-selected { + background: @time-picker-selected-bg; + font-weight: bold; + &:hover { + background: @time-picker-selected-bg; + } + } + + li&-option-disabled { + color: @btn-disable-color; + &:hover { + background: transparent; + cursor: not-allowed; + } + } + } + + &-combobox { + .clearfix; + } + + &-addon { + padding: 8px; + border-top: @border-width-base @border-style-base @border-color-split; + } + + &.slide-up-enter.slide-up-enter-active&-placement-topLeft, + &.slide-up-enter.slide-up-enter-active&-placement-topRight, + &.slide-up-appear.slide-up-appear-active&-placement-topLeft, + &.slide-up-appear.slide-up-appear-active&-placement-topRight { + animation-name: antSlideDownIn; + } + + &.slide-up-enter.slide-up-enter-active&-placement-bottomLeft, + &.slide-up-enter.slide-up-enter-active&-placement-bottomRight, + &.slide-up-appear.slide-up-appear-active&-placement-bottomLeft, + &.slide-up-appear.slide-up-appear-active&-placement-bottomRight { + animation-name: antSlideUpIn; + } + + &.slide-up-leave.slide-up-leave-active&-placement-topLeft, + &.slide-up-leave.slide-up-leave-active&-placement-topRight { + animation-name: antSlideDownOut; + } + + &.slide-up-leave.slide-up-leave-active&-placement-bottomLeft, + &.slide-up-leave.slide-up-leave-active&-placement-bottomRight { + animation-name: antSlideUpOut; + } +} + +.@{timepicker-prefix-cls} { + .reset-component; + position: relative; + display: inline-block; + outline: none; + transition: opacity .3s; + width: 128px; + + &-input { + .input; + &[disabled] { + .disabled; + } + } + + &-open { + opacity: 0; + } + + &-icon { + position: absolute; + user-select: none; + transition: all .3s @ease-in-out; + width: 14px; + height: 14px; + line-height: 14px; + right: @control-padding-horizontal - 1px; + color: @disabled-color; + top: 50%; + margin-top: -7px; + &:after { + content: "\e641"; + font-family: "anticon"; + color: @disabled-color; + display: block; + line-height: 1; + } + } + + &-large &-input { + .input-lg; + } + + &-small &-input { + .input-sm; + } + + &-small &-icon { + right: @control-padding-horizontal-sm - 1px; + } +} diff --git a/components/vc-dialog/DialogWrap.vue b/components/vc-dialog/DialogWrap.vue index 567b42e55..c917a1230 100644 --- a/components/vc-dialog/DialogWrap.vue +++ b/components/vc-dialog/DialogWrap.vue @@ -20,9 +20,10 @@ const DialogWrap = { if (this.visible) { this.renderComponent({ afterClose: this.removeContainer, - onClose () { - }, visible: false, + on: { + close () {}, + }, }) } else { this.removeContainer() @@ -31,18 +32,21 @@ const DialogWrap = { methods: { getComponent (extra = {}) { const { $attrs, $listeners, $props, $slots } = this - + const { on, ...otherProps } = extra const dialogProps = { props: { ...$props, dialogClass: getClass(this), dialogStyle: getStyle(this), - ...extra, + ...otherProps, }, attrs: $attrs, ref: '_component', key: 'dialog', - on: $listeners, + on: { + ...$listeners, + ...on, + }, } return ( {$slots.default} diff --git a/components/vc-pagination/Pagination.vue b/components/vc-pagination/Pagination.vue index 6cf4b4fec..e8ea89a8f 100644 --- a/components/vc-pagination/Pagination.vue +++ b/components/vc-pagination/Pagination.vue @@ -277,14 +277,16 @@ export default { ) } + const hasPrev = this.hasPrev() + const hasNext = this.hasNext() return (