Merge pull request #144 from TuSimple/freestyle

Freestyle
This commit is contained in:
07akioni 2020-06-01 23:53:50 +08:00 committed by GitHub Enterprise
commit 4c991fb450
12 changed files with 68 additions and 51 deletions

View File

@ -1,4 +1,9 @@
# CHANGELOG
## 1.3.2 (2020-06-02)
### Fixes
- Fix the problem that `n-log`'s loading indicator uses monospace font.
- Fix the problem that icon-related class name isn't applied properly.
## 1.3.1 (2020-06-01)
### Fixes
- Fix the problem that checkbox in the selection column of `n-data-table` is not center aligned.

View File

@ -1,9 +1,14 @@
# CHANGELOG
## 1.3.2 (2020-06-02)
### Fixes
- 修正了 `n-log` 的加载器显示等宽字体的问题
- 修正了 `n-button` icon 有关的类名没有被正确应用的问题
## 1.3.1 (2020-06-01)
### Fixes
- 修正了 `n-data-table` 选框列的选框没有垂直居中的问题
- 修正了 `n-data-table` 表头没 border-color transition 的问题
- 修正 `$NConfirm``show-icon` & `closable` & `bordered` 属性设置无效的问题
- 修正 `$NConfirm``show-icon` & `closable` & `bordered` 属性设置无效的问题
### Features
- 增加并调整了一些 `n-config-consumer` 样式方案中的颜色

View File

@ -71,4 +71,4 @@ scroll-to
### Layout, Layout Content, Layout Sider Methods
|Name|Type|Description|
|-|-|-|
|scrollTo|`((xCoord: number, yCoord: number) => void) \| ({ left?: number, top?: number, behavior: 'smooth' \| 'auto' }) => void`|Scroll to somewhere.|
|scrollTo|`((xCoord: number, yCoord: number) => void) \| (options: { left?: number, top?: number, behavior: 'smooth' \| 'auto' }) => void`|Scroll to somewhere.|

View File

@ -69,4 +69,4 @@ scroll-to
### Layout, Layout Content, Layout Sider Methods
|名称|类型|说明|
|-|-|-|
|scrollTo|`((xCoord: number, yCoord: number) => void) \| ({ left?: number, top?: number, behavior: 'smooth' \| 'auto' }) => void`|滚动到某处|
|scrollTo|`((xCoord: number, yCoord: number) => void) \| (options: { left?: number, top?: number, behavior: 'smooth' \| 'auto' }) => void`|滚动到某处|

View File

@ -1,6 +1,6 @@
{
"name": "naive-ui",
"version": "1.3.0",
"version": "1.3.1",
"description": "A Vue UI Framework. Caring About Styles, Themed, Batteries Included, Not Rather Slow.",
"main": "lib/index.js",
"module": "es/index.js",

View File

@ -19,8 +19,8 @@
[`n-button--${type}-type`]: true,
[`n-button--${colorHash || type}-colored`]: true,
[`n-button--${syntheticSize}-size`]: true,
[`n-button--${iconPlacement}-icon`]: hasIcon && iconPlacement && !noTextContent,
[`n-button--${iconDepth}-icon-depth`]: hasIcon && type === 'default',
[`n-button--${iconPlacement}-icon`]: iconPlacement && !noTextContent,
[`n-button--${iconDepth}-icon-depth`]: type === 'default',
[`n-${syntheticTheme}-theme`]: syntheticTheme,
}"
:tabindex="syntheticFocusable ? 0 : -1"

View File

@ -7,7 +7,7 @@
[`n-${syntheticTheme}-theme`]: syntheticTheme,
[`n-layout--${siderCollapseMode}-collapse-mode`]: siderCollapseMode
}"
:style="syntheticStyle"
:style="syntheticLayoutStyle"
>
<n-scrollbar
v-if="!useNativeScrollbar"
@ -51,10 +51,6 @@ export default {
scrollContainerStyle: {
type: Object,
default: null
},
themedStyle: {
type: Object,
default: null
}
},
data () {
@ -81,12 +77,11 @@ export default {
}
return null
},
syntheticStyle () {
const themedStyle = this.themedStyle
syntheticLayoutStyle () {
return Object.assign({
marginLeft: this.styleMarginLeft,
transition: this.transitionDisabled ? 'none' : null
}, themedStyle ? themedStyle[this.syntheticTheme] : null)
}, this.syntheticStyle)
},
transitionDisabled () {
if (this.NLayout && this.NLayout.childLayoutTransitionDisabled) {

View File

@ -1,6 +1,6 @@
<template>
<div
class="n-log n-code"
class="n-log"
:class="{
[`n-${syntheticTheme}-theme`]: syntheticTheme
}"
@ -12,6 +12,7 @@
>
<n-scrollbar
ref="scrollbar"
class="n-code"
:theme="syntheticTheme"
@scroll="handleScroll"
>

View File

@ -8,7 +8,8 @@ export default {
}
},
render (h) {
const children = (this.data.render && this.data.render(h, this.data)) || [ this.data.name ]
const data = this.data
const children = (data.render && data.render(h, data)) || [ data.name ]
return h('div', {
staticClass: 'n-base-select-group-header'
}, Array.isArray(children) ? children : [ children ])

View File

@ -356,18 +356,21 @@ export default {
* select option background related
*/
updateTrackingRectTop (el) {
if (this.$refs.trackingRect) {
this.$refs.trackingRect.updateTrackingRectTop(el)
const refs = this.$refs
if (refs.trackingRect) {
refs.trackingRect.updateTrackingRectTop(el)
}
},
hideTrackingRect () {
if (this.$refs.trackingRect) {
this.$refs.trackingRect.hideTrackingRect()
const refs = this.$refs
if (refs.trackingRect) {
refs.trackingRect.hideTrackingRect()
}
},
hideTrackingRectSync () {
if (this.$refs.trackingRect) {
this.$refs.trackingRect.hideTrackingRect(0)
const refs = this.$refs
if (refs.trackingRect) {
refs.trackingRect.hideTrackingRect(0)
}
}
}

View File

@ -286,8 +286,9 @@ export default {
active (active) {
if (active) {
this.$nextTick().then(() => {
if (this.$refs.singleInput) {
this.$refs.singleInput.focus()
const refs = this.$refs
if (refs.singleInput) {
refs.singleInput.focus()
}
})
}
@ -331,8 +332,9 @@ export default {
handleMouseDown (e) {
if (!this.active) return
const filterableElKeys = ['focusableEl1', 'patternInputWrapper', 'patternInput', 'focusableEl2']
const refs = this.$refs
for (const key of filterableElKeys) {
const el = this.$refs[key]
const el = refs[key]
if (el && document.hasFocus(el)) {
e.preventDefault()
break

View File

@ -24,60 +24,65 @@ export default {
},
methods: {
handleBeforeLeave () {
const el = this.$el
if (this.width) {
this.$el.style.maxWidth = this.$el.offsetWidth + 'px'
this.$el.style.width = this.$el.offsetWidth + 'px'
el.style.maxWidth = el.offsetWidth + 'px'
el.style.width = el.offsetWidth + 'px'
} else {
this.$el.style.maxHeight = this.$el.offsetHeight + 'px'
this.$el.style.height = this.$el.offsetHeight + 'px'
el.style.maxHeight = el.offsetHeight + 'px'
el.style.height = el.offsetHeight + 'px'
}
this.$el.getBoundingClientRect()
void el.offsetWidth
},
handleLeave () {
const el = this.$el
if (this.width) {
this.$el.style.maxWidth = 0
el.style.maxWidth = 0
} else {
this.$el.style.maxHeight = 0
el.style.maxHeight = 0
}
this.$el.getBoundingClientRect()
void el.offsetWidth
},
handleAfterLeave () {
if (!this.$el || this.$el.nodeType !== 1) return
const el = this.$el
if (!el || this.$el.nodeType !== 1) return
if (this.width) {
this.$el.style.maxWidth = null
el.style.maxWidth = null
} else {
this.$el.style.maxHeight = null
el.style.maxHeight = null
}
this.$emit('after-leave')
},
handleEnter () {
this.$nextTick().then(() => {
const el = this.$el
if (this.width) {
this.$el.style.maxWidth = 'unset'
this.$el.style.width = this.$el.offsetWidth + 'px'
this.$el.style.maxWidth = 0
el.style.maxWidth = 'unset'
el.style.width = el.offsetWidth + 'px'
el.style.maxWidth = 0
} else {
this.$el.style.height = this.$el.offsetHeight + 'px'
this.$el.style.maxHeight = 0
el.style.height = el.offsetHeight + 'px'
el.style.maxHeight = 0
}
this.$el.style.transition = 'none'
this.$el.getBoundingClientRect()
this.$el.style.transition = null
this.$el.getBoundingClientRect()
el.style.transition = 'none'
void el.offsetWidth
el.style.transition = null
void el.offsetWidth
if (this.width) {
this.$el.style.maxWidth = this.$el.style.width
el.style.maxWidth = el.style.width
} else {
this.$el.style.maxHeight = this.$el.style.height
el.style.maxHeight = el.style.height
}
})
},
handleAfterEnter () {
const el = this.$el
if (this.width) {
this.$el.style.width = null
this.$el.style.maxWidth = null
el.style.width = null
el.style.maxWidth = null
} else {
this.$el.style.height = null
this.$el.style.maxHeight = null
el.style.height = null
el.style.maxHeight = null
}
}
},