Skip to content

Commit 660ead3

Browse files
committed
Merge remote-tracking branch 'origin/master' into feat-vue3
2 parents 38ab3d5 + 9195ba5 commit 660ead3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1041
-25
lines changed

CHANGELOG.en-US.md

+14
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@
1010

1111
---
1212

13+
## 1.6.3
14+
15+
`2020-07-05`
16+
17+
- 🐞 Fix Input.Password focus position shift issue [#2420](https://github.com/vueComponent/ant-design-vue/pull/2420)
18+
- 🐞 Fix Drawer maskstyle not working [#2407](https://github.com/vueComponent/ant-design-vue/issues/2407)
19+
- 🐞 Fix Drawer maskstyle not working [#2407](https://github.com/vueComponent/ant-design-vue/issues/2407)
20+
- 🌟 Button supports custom Icon [#2245](https://github.com/vueComponent/ant-design-vue/pull/2245)
21+
- 🌟 DatePicker supports custom format [#2276](https://github.com/vueComponent/ant-design-vue/pull/2276)
22+
- 🐞 Fix DatePicker year and time is incorrect [#2488](https://github.com/vueComponent/ant-design-vue/issues/2488)
23+
- 🌟 Optimize the Menu component, the animation is smoother
24+
- 🐞 Fix Dropdown pop-up position error [#2359](https://github.com/vueComponent/ant-design-vue/issues/2359)
25+
- 🐞 Fix the problem of duplicate key when `Breadcrumb` has the same name [#2505](https://github.com/vueComponent/ant-design-vue/issues/2505)
26+
1327
## 1.6.2
1428

1529
`2020-06-02`

CHANGELOG.zh-CN.md

+14
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@
1010

1111
---
1212

13+
## 1.6.3
14+
15+
`2020-07-05`
16+
17+
- 🐞 修复 Input.Password focus 位置移位问题 [#2420](https://github.com/vueComponent/ant-design-vue/pull/2420)
18+
- 🐞 修复 Drawer maskstyle 不生效问题 [#2407](https://github.com/vueComponent/ant-design-vue/issues/2407)
19+
- 🐞 修复 Drawer maskstyle 不生效问题 [#2407](https://github.com/vueComponent/ant-design-vue/issues/2407)
20+
- 🌟 Button 支持自定义 Icon [#2245](https://github.com/vueComponent/ant-design-vue/pull/2245)
21+
- 🌟 DatePicker 支持自定义 format [#2276](https://github.com/vueComponent/ant-design-vue/pull/2276)
22+
- 🐞 修复 DatePicker 年份时间不正确问题 [#2488](https://github.com/vueComponent/ant-design-vue/issues/2488)
23+
- 🌟 优化 Menu 组件,动画更加流畅
24+
- 🐞 修复 Dropdown 弹窗位置错误问题 [#2359](https://github.com/vueComponent/ant-design-vue/issues/2359)
25+
- 🐞 修复 Breadcrumb 名称相同时重复 key 问题 [#2505](https://github.com/vueComponent/ant-design-vue/issues/2505)
26+
1327
## 1.6.2
1428

1529
`2020-06-02`

antd-tools/gulpfile.js

+3
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ function githubRelease(done) {
196196
})
197197
.then(() => {
198198
done();
199+
})
200+
.catch(err => {
201+
console.log(err);
199202
});
200203
}
201204

components/breadcrumb/Breadcrumb.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default {
7777
overlay = (
7878
<Menu>
7979
{route.children.map(child => (
80-
<Menu.Item key={child.breadcrumbName || child.path}>
80+
<Menu.Item key={child.path || child.breadcrumbName}>
8181
{itemRender({
8282
route: child,
8383
params,

components/carousel/__tests__/__snapshots__/demo.test.js.snap

+9-6
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ exports[`renders ./antdv-demo/docs/carousel/demo/autoplay.md correctly 1`] = `
7070
</div>
7171
</div>
7272
</div>
73-
<ul class="slick-dots slick-dots-bottom undefined" style="display: block;">
73+
<ul class="slick-dots slick-dots-bottom" style="display: block;">
7474
<li class="slick-active"><button class="">1</button></li>
7575
<li class=""><button class="">2</button></li>
7676
<li class=""><button class="">3</button></li>
@@ -150,7 +150,7 @@ exports[`renders ./antdv-demo/docs/carousel/demo/basic.md correctly 1`] = `
150150
</div>
151151
</div>
152152
</div>
153-
<ul class="slick-dots slick-dots-bottom undefined" style="display: block;">
153+
<ul class="slick-dots slick-dots-bottom" style="display: block;">
154154
<li class="slick-active"><button class="">1</button></li>
155155
<li class=""><button class="">2</button></li>
156156
<li class=""><button class="">3</button></li>
@@ -231,8 +231,11 @@ exports[`renders ./antdv-demo/docs/carousel/demo/customArrows.md correctly 1`] =
231231
</div>
232232
</div>
233233
</div>
234-
<div class="custom-slick-arrow slick-arrow slick-next" style="right: 10px; display: block;"><span role="img" aria-label="right-circle" class="anticon anticon-right-circle"><svg viewBox="64 64 896 896" focusable="false" data-icon="right-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true" class=""><path d="M666.7 505.5l-246-178A8 8 0 00408 334v46.9c0 10.2 4.9 19.9 13.2 25.9L566.6 512 421.2 617.2c-8.3 6-13.2 15.6-13.2 25.9V690c0 6.5 7.4 10.3 12.7 6.5l246-178c4.4-3.2 4.4-9.8 0-13z"></path><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"></path></svg></span></div>
235-
<ul class="slick-dots slick-dots-bottom undefined" style="display: block;">
234+
<div class="custom-slick-arrow slick-arrow slick-next" style="right: 10px; display: block;"><i aria-label="icon: right-circle" class="anticon anticon-right-circle"><svg viewBox="64 64 896 896" data-icon="right-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class="">
235+
<path d="M666.7 505.5l-246-178A8 8 0 0 0 408 334v46.9c0 10.2 4.9 19.9 13.2 25.9L566.6 512 421.2 617.2c-8.3 6-13.2 15.6-13.2 25.9V690c0 6.5 7.4 10.3 12.7 6.5l246-178c4.4-3.2 4.4-9.8 0-13z"></path>
236+
<path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"></path>
237+
</svg></i></div>
238+
<ul class="slick-dots slick-dots-bottom" style="display: block;">
236239
<li class="slick-active"><button class="">1</button></li>
237240
<li class=""><button class="">2</button></li>
238241
<li class=""><button class="">3</button></li>
@@ -339,7 +342,7 @@ exports[`renders ./antdv-demo/docs/carousel/demo/fade.md correctly 1`] = `
339342
</div>
340343
</div>
341344
</div>
342-
<ul class="slick-dots slick-dots-bottom undefined" style="display: block;">
345+
<ul class="slick-dots slick-dots-bottom" style="display: block;">
343346
<li class="slick-active"><button class="">1</button></li>
344347
<li class=""><button class="">2</button></li>
345348
<li class=""><button class="">3</button></li>
@@ -429,7 +432,7 @@ exports[`renders ./antdv-demo/docs/carousel/demo/position.md correctly 1`] = `
429432
</div>
430433
</div>
431434
</div>
432-
<ul class="slick-dots slick-dots-top undefined" style="display: block;">
435+
<ul class="slick-dots slick-dots-top" style="display: block;">
433436
<li class="slick-active"><button class="">1</button></li>
434437
<li class=""><button class="">2</button></li>
435438
<li class=""><button class="">3</button></li>

components/carousel/index.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import hasProp, {
99
import { ConfigConsumerProps } from '../config-provider';
1010
import Base from '../base';
1111
import warning from '../_util/warning';
12+
import classNames from 'classnames';
1213

1314
// matchMedia polyfill for
1415
// https://github.com/WickyNilliams/enquire.js/issues/82
@@ -164,7 +165,9 @@ const Carousel = {
164165
const dotsClass = 'slick-dots';
165166
const dotPosition = this.getDotPosition();
166167
props.vertical = dotPosition === 'left' || dotPosition === 'right';
167-
props.dotsClass = `${dotsClass} ${dotsClass}-${dotPosition || 'bottom'} ${props.dotsClass}`;
168+
props.dotsClass = classNames(`${dotsClass}`, `${dotsClass}-${dotPosition || 'bottom'}`, {
169+
[`${props.dotsClass}`]: !!props.dotsClass,
170+
});
168171
if (props.vertical) {
169172
className = `${className} ${className}-vertical`;
170173
}
+208
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
import PropTypes from '../_util/vue-types';
2+
import { ConfigConsumerProps } from '../config-provider';
3+
import BaseMixin from '../_util/BaseMixin';
4+
import Pickr from '@simonwep/pickr/dist/pickr.es5.min';
5+
import Icon from '../icon';
6+
import LocaleReceiver from '../locale-provider/LocaleReceiver';
7+
import enUS from './locale/en_US';
8+
import debounce from 'lodash/debounce';
9+
10+
import { getOptionProps } from '../_util/props-util';
11+
let colors = '#194d33';
12+
export default {
13+
name: 'AColorPicker',
14+
mixins: [BaseMixin],
15+
model: {
16+
prop: 'value',
17+
event: 'change.value', //为了支持v-model直接返回颜色字符串 所以用了自定义的事件,与pickr自带change事件进行区分
18+
},
19+
props: {
20+
prefixCls: PropTypes.string,
21+
defaultValue: PropTypes.string, //默认值
22+
config: PropTypes.object, //pickr配置
23+
value: PropTypes.string, //颜色值
24+
locale: PropTypes.object, //双语包
25+
colorRounded: PropTypes.number, //颜色数值保留几位小数
26+
size: PropTypes.oneOf(['default', 'small', 'large']).def('default'), //尺寸
27+
getPopupContainer: PropTypes.func, //指定渲染容器
28+
disabled: PropTypes.bool.def(false), //是否禁用
29+
format: PropTypes.string, //颜色格式设置
30+
alpha: PropTypes.bool.def(false), //是否开启透明通道
31+
hue: PropTypes.bool.def(true), //是否开启色彩预选
32+
},
33+
inject: {
34+
configProvider: { default: () => ConfigConsumerProps },
35+
},
36+
data() {
37+
return {
38+
colors,
39+
myOpen: false,
40+
pickr: null,
41+
i18n: enUS,
42+
};
43+
},
44+
watch: {
45+
'configProvider.locale.ColorPicker': {
46+
handler(val) {
47+
if (this.locale) return;
48+
this.i18n = val;
49+
this.reInitialize();
50+
},
51+
},
52+
locale(val) {
53+
this.i18n = val.ColorPicker || val.lang;
54+
this.reInitialize();
55+
},
56+
value(val) {
57+
this.setColor(val);
58+
},
59+
disabled(val) {
60+
this.pickr[val ? 'disable' : 'enable']();
61+
},
62+
config: {
63+
handler() {
64+
this.reInitialize();
65+
},
66+
deep: true,
67+
},
68+
format(val) {
69+
const type = val.toLocaleUpperCase();
70+
let res = this.pickr.setColorRepresentation(type);
71+
if (res) {
72+
this.pickr.applyColor();
73+
} else {
74+
throw new TypeError('format was invalid');
75+
}
76+
},
77+
},
78+
mounted() {
79+
if (this.locale) {
80+
this.i18n = this.locale.ColorPicker || this.locale.lang;
81+
}
82+
this.createPickr();
83+
this.eventsBinding();
84+
},
85+
destroyed() {
86+
this.pickr.destroyAndRemove();
87+
},
88+
methods: {
89+
reInitialize() {
90+
this.pickr.destroyAndRemove();
91+
const dom = document.createElement('div');
92+
dom.id = 'color-picker' + this._uid;
93+
const box = this.$el.querySelector('#color-picker-box' + this._uid);
94+
box.appendChild(dom);
95+
this.createPickr();
96+
this.eventsBinding();
97+
},
98+
setColor: debounce(function(val) {
99+
this.pickr.setColor(val);
100+
}, 1000),
101+
eventsBinding() {
102+
const pickrEvents = [
103+
'init',
104+
'hide',
105+
'show',
106+
'save',
107+
'clear',
108+
'change',
109+
'changestop',
110+
'cancel',
111+
'swatchselect',
112+
];
113+
Object.keys(this.$listeners).forEach(event => {
114+
pickrEvents.includes(event) && this.pickr.on(event, this.$listeners[event]);
115+
});
116+
},
117+
createPickr() {
118+
const { getPopupContainer } = getOptionProps(this);
119+
const { getPopupContainer: getContextPopupContainer } = this.configProvider;
120+
const container = getPopupContainer || getContextPopupContainer;
121+
this.pickr = Pickr.create(
122+
Object.assign(
123+
{
124+
el: '#color-picker' + this._uid,
125+
container: (container && container(this.$el)) || document.body,
126+
theme: 'monolith', // or 'monolith', or 'nano'
127+
default: this.value || this.defaultValue || null, // 有默认颜色pickr才可以获取到_representation
128+
components: {
129+
// Main components
130+
preview: true,
131+
opacity: this.alpha,
132+
hue: this.hue,
133+
// Input / output Options
134+
interaction: {
135+
hex: true,
136+
rgba: true,
137+
input: true,
138+
clear: true,
139+
save: true,
140+
},
141+
},
142+
},
143+
this.config,
144+
{ i18n: this.i18n },
145+
),
146+
)
147+
.on('save', (color, instance) => {
148+
if (color) {
149+
let _representation = instance._representation || 'HEXA';
150+
color = color['to' + _representation]().toString(this.colorRounded || 0);
151+
}
152+
this.$emit('change.value', color || '');
153+
})
154+
.on('hide', () => {
155+
this.setState({ myOpen: false });
156+
});
157+
},
158+
handleOpenChange() {
159+
const open = !this.myOpen;
160+
this.setState({ myOpen: open });
161+
this.pickr[open ? 'show' : 'hide']();
162+
this.$emit('openChange', open);
163+
},
164+
getDefaultLocale() {
165+
const result = {
166+
...enUS,
167+
...this.$props.locale,
168+
};
169+
result.lang = {
170+
...result.lang,
171+
...(this.$props.locale || {}).lang,
172+
};
173+
return result;
174+
},
175+
renderColorPicker() {
176+
const { prefixCls: customizePrefixCls } = this.$props;
177+
const { getPrefixCls } = this.configProvider;
178+
const prefixCls = getPrefixCls('color-picker', customizePrefixCls);
179+
const { disabled } = getOptionProps(this);
180+
const classString = {
181+
[prefixCls]: true,
182+
[`${prefixCls}-open`]: this.myOpen,
183+
[`${prefixCls}-lg`]: this.size === 'large',
184+
[`${prefixCls}-sm`]: this.size === 'small',
185+
[`${prefixCls}-disabled`]: this.disabled,
186+
};
187+
return (
188+
<div class={classString} tabIndex={disabled ? -1 : 0} onClick={this.handleOpenChange}>
189+
<div class={`${prefixCls}-selection`}>
190+
<div id={'color-picker-box' + this._uid}>
191+
<div id={'color-picker' + this._uid}></div>
192+
</div>
193+
<Icon type="down" class={`${prefixCls}-icon`} />
194+
</div>
195+
</div>
196+
);
197+
},
198+
},
199+
render() {
200+
return (
201+
<LocaleReceiver
202+
componentName="ColorPicker"
203+
defaultLocale={this.getDefaultLocale}
204+
scopedSlots={{ default: this.renderColorPicker }}
205+
/>
206+
);
207+
},
208+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`renders ./antdv-demo/docs/color-picker/demo/alpha.md correctly 1`] = `<a-color-picker alpha="true"></a-color-picker>`;
4+
5+
exports[`renders ./antdv-demo/docs/color-picker/demo/basic.md correctly 1`] = `
6+
<div class="ant-row">
7+
<div class="ant-col ant-col-12">
8+
有默认值
9+
<a-colorpicker></a-colorpicker>
10+
</div>
11+
<div class="ant-col ant-col-12">
12+
无默认值
13+
<a-colorpicker></a-colorpicker>
14+
</div>
15+
</div>
16+
`;
17+
18+
exports[`renders ./antdv-demo/docs/color-picker/demo/colors.md correctly 1`] = `<a-color-picker config="[object Object]"></a-color-picker>`;
19+
20+
exports[`renders ./antdv-demo/docs/color-picker/demo/hue.md correctly 1`] = `<a-color-picker></a-color-picker>`;
21+
22+
exports[`renders ./antdv-demo/docs/color-picker/demo/size.md correctly 1`] = `
23+
<div>
24+
<div class="ant-row">
25+
<div class="ant-col ant-col-8">
26+
<a-colorpicker size="large"></a-colorpicker>
27+
</div>
28+
<div class="ant-col ant-col-8">
29+
<a-colorpicker></a-colorpicker>
30+
</div>
31+
<div class="ant-col ant-col-8">
32+
<a-colorpicker size="small"></a-colorpicker>
33+
</div>
34+
</div>
35+
</div>
36+
`;

0 commit comments

Comments
 (0)