Merge remote-tracking branch 'origin/next' into v3

pull/4060/head
tanjinzhou 2021-05-10 11:22:54 +08:00
commit 7315bfd03e
32 changed files with 193 additions and 81 deletions

View File

@ -10,6 +10,39 @@
--- ---
## 2.1.4
`2021-05-09`
- ๐Ÿž Fix `Table` scrolling misalignment issue [#4045](https://github.com/vueComponent/ant-design-vue/issues/4045)
- ๐Ÿž Fix `Typography` editable mode triggering link jump issue [#4105](https://github.com/vueComponent/ant-design-vue/issues/4105)
- ๐Ÿž Fix the issue that `Carousel` variableWidth does not take effect [#3977](https://github.com/vueComponent/ant-design-vue/issues/3977)
- ๐Ÿž Fix the problem that `TreeSelect` cannot delete parent and child nodes at the same time through the keyboard [#3508](https://github.com/vueComponent/ant-design-vue/issues/3508)
- ๐Ÿž Fix some types of errors
## 2.1.3
`2021-04-25`
- ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰ remove ads during npm installation
- ๐Ÿž `Select`
- Fix the first issue of default activation [#3842](https://github.com/vueComponent/ant-design-vue/issues/3842)
- Fix group display abnormal problem [#3841](https://github.com/vueComponent/ant-design-vue/issues/3841)
- Fix scrolling abnormal issue after dynamically updating selections [#3972](https://github.com/vueComponent/ant-design-vue/issues/3972)
- ๐Ÿž Fix the issue that `Checkbox` triggers twice `update:checked` [#3838](https://github.com/vueComponent/ant-design-vue/issues/3838)
- ๐ŸŒŸ `Table` column group supports fixed [#3882](https://github.com/vueComponent/ant-design-vue/issues/3882)
- ๐ŸŒŸ `Table` column supports v-for [#3934](https://github.com/vueComponent/ant-design-vue/issues/3934)
- ๐Ÿž Fix the problem that `Table` displays horizontal scroll bar on windows [6d33d6](https://github.com/vueComponent/ant-design-vue/commit/6d33d60d2bca98825f274e48bcc3badd1857f742)
- ๐ŸŒŸ `Form` scrollToFirstError supports option parameter passing [#3918](https://github.com/vueComponent/ant-design-vue/issues/3918)
- ๐Ÿž Fix the issue of `Calendar` month selector displaying wrong characters [#3915](https://github.com/vueComponent/ant-design-vue/issues/3915)
- ๐ŸŒŸ Refactor the `Switch` component and remove the defaultChecked attribute [#3885](https://github.com/vueComponent/ant-design-vue/issues/3885)
- ๐Ÿž Fix the process exception when using Vite [#3930](https://github.com/vueComponent/ant-design-vue/issues/3930)
- ๐Ÿž Fix `Radio` shadow occlusion problem [#3955](https://github.com/vueComponent/ant-design-vue/issues/3955)
- ๐Ÿž Fix the issue that span does not take effect in `Form` inline mode [#3862](https://github.com/vueComponent/ant-design-vue/issues/3862)
- ๐Ÿž Fix the issue that `Cascader` keydown selection does not take effect [#958](https://github.com/vueComponent/ant-design-vue/issues/958)
- ๐Ÿž Fix `Image` preview function failure problem [#3701](https://github.com/vueComponent/ant-design-vue/issues/3701)
- ๐Ÿž Fix some TS type issues
## 2.1.2 ## 2.1.2
`2021-03-28` `2021-03-28`

View File

@ -10,6 +10,39 @@
--- ---
## 2.1.4
`2021-05-09`
- ๐Ÿž ไฟฎๅค `Table` ๆปšๅŠจ้”™ไฝ้—ฎ้ข˜ [#4045](https://github.com/vueComponent/ant-design-vue/issues/4045)
- ๐Ÿž ไฟฎๅค `Typography` editable ๆจกๅผ่งฆๅ‘้“พๆŽฅ่ทณ่ฝฌ้—ฎ้ข˜ [#4105](https://github.com/vueComponent/ant-design-vue/issues/4105)
- ๐Ÿž ไฟฎๅค `Carousel` variableWidth ไธ็”Ÿๆ•ˆ้—ฎ้ข˜ [#3977](https://github.com/vueComponent/ant-design-vue/issues/3977)
- ๐Ÿž ไฟฎๅค `TreeSelect` ๆ— ๆณ•้€š่ฟ‡้”ฎ็›˜ๅŒๆ—ถๅˆ ้™ค็ˆถๅญ่Š‚็‚น้—ฎ้ข˜ [#3508](https://github.com/vueComponent/ant-design-vue/issues/3508)
- ๐Ÿž ไฟฎๅค่‹ฅๅนฒ็ฑปๅž‹้”™่ฏฏ้—ฎ้ข˜
## 2.1.3
`2021-04-25`
- ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰ ็งป้™ค npm ๅฎ‰่ฃ…ๆ—ถ็š„ๅนฟๅ‘Š
- ๐Ÿž `Select`
- ไฟฎๅค้ป˜่ฎคๆฟ€ๆดป็ฌฌไธ€้กน้—ฎ้ข˜ [#3842](https://github.com/vueComponent/ant-design-vue/issues/3842)
- ไฟฎๅคๅˆ†็ป„ๆ˜พ็คบๅผ‚ๅธธ้—ฎ้ข˜ [#3841](https://github.com/vueComponent/ant-design-vue/issues/3841)
- ไฟฎๅคๅŠจๆ€ๆ›ดๆ–ฐ้€‰ๆ‹ฉ้กนๅŽๆปšๅŠจๅผ‚ๅธธ้—ฎ้ข˜ [#3972](https://github.com/vueComponent/ant-design-vue/issues/3972)
- ๐Ÿž ไฟฎๅค `Checkbox` ่งฆๅ‘ไธคๆฌก `update:checked` ้—ฎ้ข˜ [#3838](https://github.com/vueComponent/ant-design-vue/issues/3838)
- ๐ŸŒŸ `Table` column group ๆ”ฏๆŒ fixed [#3882](https://github.com/vueComponent/ant-design-vue/issues/3882)
- ๐ŸŒŸ `Table` column ๆ”ฏๆŒ v-for [#3934](https://github.com/vueComponent/ant-design-vue/issues/3934)
- ๐Ÿž ไฟฎๅค `Table` ๅœจ windows ๆ˜พ็คบๆจชๅ‘ๆปšๅŠจๆก้—ฎ้ข˜ [6d33d6](https://github.com/vueComponent/ant-design-vue/commit/6d33d60d2bca98825f274e48bcc3badd1857f742)
- ๐ŸŒŸ `Form` scrollToFirstError ๆ”ฏๆŒ้€‰้กนๅ‚ๆ•ฐไผ ้€’ [#3918](https://github.com/vueComponent/ant-design-vue/issues/3918)
- ๐Ÿž ไฟฎๅค `Calendar` ๆœˆไปฝ้€‰ๆ‹ฉๅ™จๆ˜พ็คบ้”™่ฏฏๅญ—็ฌฆ้—ฎ้ข˜ [#3915](https://github.com/vueComponent/ant-design-vue/issues/3915)
- ๐ŸŒŸ ้‡ๆž„ `Switch` ็ป„ไปถ๏ผŒ็งป้™ค defaultChecked ๅฑžๆ€ง [#3885](https://github.com/vueComponent/ant-design-vue/issues/3885)
- ๐Ÿž ไฟฎๅคไฝฟ็”จ Vite ๆ—ถ๏ผŒๆŠ›ๅ‡บ process ๅผ‚ๅธธ้—ฎ้ข˜ [#3930](https://github.com/vueComponent/ant-design-vue/issues/3930)
- ๐Ÿž ไฟฎๅค `Radio` ้˜ดๅฝฑ้ฎๆŒก้—ฎ้ข˜ [#3955](https://github.com/vueComponent/ant-design-vue/issues/3955)
- ๐Ÿž ไฟฎๅค `Form` inline ๆจกๅผไธ‹๏ผŒ span ไธ็”Ÿๆ•ˆ้—ฎ้ข˜ [#3862](https://github.com/vueComponent/ant-design-vue/issues/3862)
- ๐Ÿž ไฟฎๅค `Cascader` keydown ้€‰ๆ‹ฉไธ็”Ÿๆ•ˆ้—ฎ้ข˜ [#958](https://github.com/vueComponent/ant-design-vue/issues/958)
- ๐Ÿž ไฟฎๅค `Image` ้ข„่งˆๅŠŸ่ƒฝๅคฑ่ดฅ้—ฎ้ข˜ [#3701](https://github.com/vueComponent/ant-design-vue/issues/3701)
- ๐Ÿž ไฟฎๅคไธ€ไบ› TS ็ฑปๅž‹้—ฎ้ข˜
## 2.1.2 ## 2.1.2
`2021-03-28` `2021-03-28`

View File

@ -8,7 +8,7 @@ module.exports = function(modules) {
isTSX: true, isTSX: true,
}, },
], ],
[resolve('@vue/babel-plugin-jsx'), { mergeProps: false }], [resolve('@vue/babel-plugin-jsx'), { mergeProps: false, enableObjectSlots: false }],
resolve('@babel/plugin-proposal-optional-chaining'), resolve('@babel/plugin-proposal-optional-chaining'),
resolve('@babel/plugin-transform-object-assign'), resolve('@babel/plugin-transform-object-assign'),
resolve('@babel/plugin-proposal-object-rest-spread'), resolve('@babel/plugin-proposal-object-rest-spread'),

View File

@ -4,11 +4,9 @@ const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const WebpackBar = require('webpackbar'); const WebpackBar = require('webpackbar');
const { merge } = require('webpack-merge'); const { merge } = require('webpack-merge');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const postcssConfig = require('./postcssConfig');
const CleanUpStatsPlugin = require('./utils/CleanUpStatsPlugin'); const CleanUpStatsPlugin = require('./utils/CleanUpStatsPlugin');
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; // const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
@ -97,7 +95,10 @@ function getWebpackConfig(modules) {
options: { options: {
presets: [resolve('@babel/preset-env')], presets: [resolve('@babel/preset-env')],
plugins: [ plugins: [
[resolve('@vue/babel-plugin-jsx'), { mergeProps: false }], [
resolve('@vue/babel-plugin-jsx'),
{ mergeProps: false, enableObjectSlots: false },
],
resolve('@babel/plugin-proposal-object-rest-spread'), resolve('@babel/plugin-proposal-object-rest-spread'),
], ],
}, },
@ -138,7 +139,12 @@ function getWebpackConfig(modules) {
}, },
{ {
loader: 'postcss-loader', loader: 'postcss-loader',
options: Object.assign({}, postcssConfig, { sourceMap: true }), options: {
postcssOptions: {
plugins: ['autoprefixer'],
},
sourceMap: true,
},
}, },
], ],
}, },
@ -154,7 +160,12 @@ function getWebpackConfig(modules) {
}, },
{ {
loader: 'postcss-loader', loader: 'postcss-loader',
options: Object.assign({}, postcssConfig, { sourceMap: true }), options: {
postcssOptions: {
plugins: ['autoprefixer'],
},
sourceMap: true,
},
}, },
{ {
loader: 'less-loader', loader: 'less-loader',
@ -212,9 +223,17 @@ All rights reserved.
config.output.libraryTarget = 'umd'; config.output.libraryTarget = 'umd';
config.optimization = { config.optimization = {
minimizer: [ minimizer: [
new TerserPlugin({ // eslint-disable-next-line no-unused-vars
sourceMap: true, compiler => {
}), return () => {
return {
parallel: true,
terserOptions: {
warnings: false,
},
};
};
},
], ],
}; };

View File

@ -288,6 +288,7 @@ gulp.task(
function publish(tagString, done) { function publish(tagString, done) {
let args = ['publish', '--with-antd-tools']; let args = ['publish', '--with-antd-tools'];
args = args.concat(['--tag', 'next']);
if (tagString) { if (tagString) {
args = args.concat(['--tag', tagString]); args = args.concat(['--tag', tagString]);
} }

View File

@ -1,6 +0,0 @@
const rucksack = require('rucksack-css');
const autoprefixer = require('autoprefixer');
module.exports = {
plugins: [rucksack(), autoprefixer()],
};

View File

@ -3,7 +3,7 @@ const { readFileSync } = require('fs');
const path = require('path'); const path = require('path');
const postcss = require('postcss'); const postcss = require('postcss');
const NpmImportPlugin = require('less-plugin-npm-import'); const NpmImportPlugin = require('less-plugin-npm-import');
const postcssConfig = require('./postcssConfig'); const autoprefixer = require('autoprefixer');
function transformLess(lessFile, config = {}) { function transformLess(lessFile, config = {}) {
const { cwd = process.cwd() } = config; const { cwd = process.cwd() } = config;
@ -21,10 +21,7 @@ function transformLess(lessFile, config = {}) {
}; };
return less return less
.render(data, lessOpts) .render(data, lessOpts)
.then(result => { .then(result => postcss([autoprefixer]).process(result.css, { from: undefined }))
const source = result.css;
return postcss(postcssConfig.plugins).process(source, { from: undefined });
})
.then(r => { .then(r => {
return r.css; return r.css;
}); });

View File

@ -3,7 +3,7 @@ module.exports = {
test: { test: {
presets: [['@babel/preset-env', { targets: { node: true } }]], presets: [['@babel/preset-env', { targets: { node: true } }]],
plugins: [ plugins: [
['@vue/babel-plugin-jsx', { mergeProps: false }], ['@vue/babel-plugin-jsx', { mergeProps: false, enableObjectSlots: false }],
'@babel/plugin-proposal-optional-chaining', '@babel/plugin-proposal-optional-chaining',
'@babel/plugin-transform-object-assign', '@babel/plugin-transform-object-assign',
'@babel/plugin-proposal-object-rest-spread', '@babel/plugin-proposal-object-rest-spread',

View File

@ -42,7 +42,7 @@ export const DescriptionsItem = defineComponent({
}, },
}); });
const DEFAULT_COLUMN_MAP: Record<Breakpoint, number> = { const DEFAULT_COLUMN_MAP: Partial<Record<Breakpoint, number>> = {
xxl: 3, xxl: 3,
xl: 3, xl: 3,
lg: 3, lg: 3,
@ -126,7 +126,7 @@ const descriptionsProps = {
extra: PropTypes.VNodeChild, extra: PropTypes.VNodeChild,
column: { column: {
type: [Number, Object] as PropType<number | Partial<Record<Breakpoint, number>>>, type: [Number, Object] as PropType<number | Partial<Record<Breakpoint, number>>>,
default: () => DEFAULT_COLUMN_MAP, default: (): number | Partial<Record<Breakpoint, number>> => DEFAULT_COLUMN_MAP,
}, },
layout: PropTypes.oneOf(tuple('horizontal', 'vertical')), layout: PropTypes.oneOf(tuple('horizontal', 'vertical')),
colon: PropTypes.looseBool, colon: PropTypes.looseBool,
@ -135,8 +135,9 @@ const descriptionsProps = {
export type DescriptionsProps = HTMLAttributes & export type DescriptionsProps = HTMLAttributes &
Partial<ExtractPropTypes<typeof descriptionsProps>>; Partial<ExtractPropTypes<typeof descriptionsProps>>;
const Descriptions = defineComponent<DescriptionsProps>({ const Descriptions = defineComponent({
name: 'ADescriptions', name: 'ADescriptions',
props: descriptionsProps,
Item: DescriptionsItem, Item: DescriptionsItem,
setup(props, { slots }) { setup(props, { slots }) {
const { getPrefixCls } = inject('configProvider', defaultConfigProvider); const { getPrefixCls } = inject('configProvider', defaultConfigProvider);
@ -215,8 +216,6 @@ const Descriptions = defineComponent<DescriptionsProps>({
}, },
}); });
Descriptions.props = descriptionsProps;
Descriptions.install = function(app: App) { Descriptions.install = function(app: App) {
app.component(Descriptions.name, Descriptions); app.component(Descriptions.name, Descriptions);
app.component(Descriptions.Item.name, Descriptions.Item); app.component(Descriptions.Item.name, Descriptions.Item);

View File

@ -79,8 +79,8 @@ const modalProps = {
maskClosable: PropTypes.looseBool, maskClosable: PropTypes.looseBool,
/** ๅผบๅˆถๆธฒๆŸ“ Modal*/ /** ๅผบๅˆถๆธฒๆŸ“ Modal*/
forceRender: PropTypes.looseBool, forceRender: PropTypes.looseBool,
okButtonProps: PropTypes.shape(buttonTypes), okButtonProps: PropTypes.shape(buttonTypes).loose,
cancelButtonProps: PropTypes.shape(buttonTypes), cancelButtonProps: PropTypes.shape(buttonTypes).loose,
destroyOnClose: PropTypes.looseBool, destroyOnClose: PropTypes.looseBool,
wrapClassName: PropTypes.string, wrapClassName: PropTypes.string,
maskTransitionName: PropTypes.string, maskTransitionName: PropTypes.string,

View File

@ -9,7 +9,7 @@ const skeletonParagraphProps = {
rows: PropTypes.number, rows: PropTypes.number,
}; };
export const SkeletonParagraphProps = PropTypes.shape(skeletonParagraphProps); export const SkeletonParagraphProps = PropTypes.shape(skeletonParagraphProps).loose;
export type ISkeletonParagraphProps = Partial<ExtractPropTypes<typeof skeletonParagraphProps>>; export type ISkeletonParagraphProps = Partial<ExtractPropTypes<typeof skeletonParagraphProps>>;

View File

@ -6,7 +6,7 @@ const skeletonTitleProps = {
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
}; };
export const SkeletonTitleProps = PropTypes.shape(skeletonTitleProps); export const SkeletonTitleProps = PropTypes.shape(skeletonTitleProps).loose;
export type ISkeletonTitleProps = Partial<ExtractPropTypes<typeof skeletonTitleProps>>; export type ISkeletonTitleProps = Partial<ExtractPropTypes<typeof skeletonTitleProps>>;

View File

@ -47,7 +47,6 @@ import './upload/style';
import './layout/style'; import './layout/style';
import './anchor/style'; import './anchor/style';
import './list/style'; import './list/style';
import './carousel/style';
import './tree-select/style'; import './tree-select/style';
import './drawer/style'; import './drawer/style';
import './skeleton/style'; import './skeleton/style';

View File

@ -3,6 +3,7 @@ import { mount } from '@vue/test-utils';
import focusTest from '../../../tests/shared/focusTest'; import focusTest from '../../../tests/shared/focusTest';
import { resetWarned } from '../../_util/warning'; import { resetWarned } from '../../_util/warning';
import mountTest from '../../../tests/shared/mountTest'; import mountTest from '../../../tests/shared/mountTest';
import { ref } from 'vue';
describe('Switch', () => { describe('Switch', () => {
focusTest(Switch); focusTest(Switch);
@ -10,8 +11,16 @@ describe('Switch', () => {
it('should has click wave effect', async () => { it('should has click wave effect', async () => {
const wrapper = mount({ const wrapper = mount({
render() { setup() {
return <Switch />; const checked = ref(false);
return () => {
return (
<Switch
checked={checked.value}
onChange={() => (checked.value = !checked.value)}
></Switch>
);
};
}, },
}); });
wrapper.find('.ant-switch').trigger('click'); wrapper.find('.ant-switch').trigger('click');

View File

@ -31,6 +31,11 @@ const switchProps = {
autofocus: PropTypes.looseBool, autofocus: PropTypes.looseBool,
loading: PropTypes.looseBool, loading: PropTypes.looseBool,
checked: PropTypes.looseBool, checked: PropTypes.looseBool,
onChange: PropTypes.func,
onClick: PropTypes.func,
onKeydown: PropTypes.func,
onMouseup: PropTypes.func,
'onUpdate:checked': PropTypes.func
}; };
export type SwitchProps = Partial<ExtractPropTypes<typeof switchProps>>; export type SwitchProps = Partial<ExtractPropTypes<typeof switchProps>>;

View File

@ -1144,7 +1144,7 @@ export default defineComponent({
getPopupContainer: contextGetPopupContainer, getPopupContainer: contextGetPopupContainer,
transformCellText, transformCellText,
}) { }) {
const { showHeader, locale, getPopupContainer, ...restProps } = { const { showHeader, locale, getPopupContainer, style, ...restProps } = {
...getOptionProps(this), ...getOptionProps(this),
...this.$attrs, ...this.$attrs,
} as any; } as any;

View File

@ -2,7 +2,13 @@ import { App, defineComponent, Plugin } from 'vue';
import T, { defaultTableProps } from './Table'; import T, { defaultTableProps } from './Table';
import Column from './Column'; import Column from './Column';
import ColumnGroup from './ColumnGroup'; import ColumnGroup from './ColumnGroup';
import { getOptionProps, getKey, getPropsData, getSlot, flattenChildren } from '../_util/props-util'; import {
getOptionProps,
getKey,
getPropsData,
getSlot,
flattenChildren,
} from '../_util/props-util';
const Table = defineComponent({ const Table = defineComponent({
name: 'ATable', name: 'ATable',
@ -12,7 +18,7 @@ const Table = defineComponent({
props: defaultTableProps, props: defaultTableProps,
methods: { methods: {
normalize(elements = []) { normalize(elements = []) {
const flattenElements = flattenChildren(elements) const flattenElements = flattenChildren(elements);
const columns = []; const columns = [];
flattenElements.forEach(element => { flattenElements.forEach(element => {
if (!element) { if (!element) {

View File

@ -189,7 +189,8 @@ const Base = defineComponent<InternalBlockProps>({
onExpand?.(e); onExpand?.(e);
} }
// ================ Edit ================ // ================ Edit ================
function onEditClick() { function onEditClick(e: MouseEvent) {
e.preventDefault();
state.originContent = props.content; state.originContent = props.content;
triggerEdit(true); triggerEdit(true);
} }

View File

@ -253,7 +253,7 @@ describe('Typography', () => {
describe('editable', async () => { describe('editable', async () => {
function testStep(name, submitFunc, expectFunc) { function testStep(name, submitFunc, expectFunc) {
it(name, async () => { fit(name, async () => {
const onStart = jest.fn(); const onStart = jest.fn();
const onChange = jest.fn(); const onChange = jest.fn();
@ -286,7 +286,7 @@ describe('Typography', () => {
await sleep(20); await sleep(20);
wrapper.find('textarea').element.value = 'Bamboo'; wrapper.find('textarea').element.value = 'Bamboo';
wrapper.find('textarea').trigger('change'); //wrapper.find('textarea').trigger('change');
if (submitFunc) { if (submitFunc) {
submitFunc(wrapper); submitFunc(wrapper);

View File

@ -50,7 +50,7 @@ export const ImageProps = {
visible: PropTypes.bool, visible: PropTypes.bool,
onVisibleChange: PropTypes.func, onVisibleChange: PropTypes.func,
getContainer: PropTypes.oneOf([PropTypes.func, PropTypes.bool]), getContainer: PropTypes.oneOf([PropTypes.func, PropTypes.bool]),
}), }).loose,
]).def(true), ]).def(true),
}; };
type ImageStatus = 'normal' | 'error' | 'loading'; type ImageStatus = 'normal' | 'error' | 'loading';

View File

@ -34,7 +34,7 @@ const Menu = {
watch( watch(
() => props.selectedKeys, () => props.selectedKeys,
() => { () => {
selectedKeys.value = props.selectedKeys; selectedKeys.value = props.selectedKeys || [];
}, },
); );
watch( watch(

View File

@ -57,6 +57,7 @@ const VueResizeObserver = defineComponent({
handleResize(entries) { handleResize(entries) {
const { target } = entries[0]; const { target } = entries[0];
const { width, height } = target.getBoundingClientRect(); const { width, height } = target.getBoundingClientRect();
const { offsetWidth, offsetHeight } = target;
/** /**
* Resize observer trigger when content size changed. * Resize observer trigger when content size changed.
* In most case we just care about element size, * In most case we just care about element size,
@ -66,7 +67,7 @@ const VueResizeObserver = defineComponent({
const fixedHeight = Math.floor(height); const fixedHeight = Math.floor(height);
if (this.width !== fixedWidth || this.height !== fixedHeight) { if (this.width !== fixedWidth || this.height !== fixedHeight) {
const size = { width: fixedWidth, height: fixedHeight }; const size = { width: fixedWidth, height: fixedHeight, offsetWidth, offsetHeight };
this.width = fixedWidth; this.width = fixedWidth;
this.height = fixedHeight; this.height = fixedHeight;
this.__emit('resize', size); this.__emit('resize', size);

View File

@ -17,7 +17,7 @@ import useLock from '../hooks/useLock';
import { defineComponent, VNodeChild } from 'vue'; import { defineComponent, VNodeChild } from 'vue';
import createRef, { RefObject } from '../../_util/createRef'; import createRef, { RefObject } from '../../_util/createRef';
import PropTypes from '../../_util/vue-types'; import PropTypes from '../../_util/vue-types';
import { VueNode } from 'ant-design-vue/es/_util/type'; import { VueNode } from '../../_util/type';
export interface InnerSelectorProps { export interface InnerSelectorProps {
prefixCls: string; prefixCls: string;

View File

@ -115,7 +115,7 @@ export default {
slideCount: children.length, slideCount: children.length,
}); });
children.forEach(child => { children.forEach(child => {
const childWidth = child.props.width.split('px')[0]; const childWidth = child.props.style?.width?.split('px')[0] || 0;
childrenWidths.push(childWidth); childrenWidths.push(childWidth);
trackWidth += childWidth; trackWidth += childWidth;
}); });

View File

@ -155,7 +155,7 @@ export default defineComponent({
for (let j = i; j < i + settings.rows * settings.slidesPerRow; j += settings.slidesPerRow) { for (let j = i; j < i + settings.rows * settings.slidesPerRow; j += settings.slidesPerRow) {
const row = []; const row = [];
for (let k = j; k < j + settings.slidesPerRow; k += 1) { for (let k = j; k < j + settings.slidesPerRow; k += 1) {
if (settings.variableWidth && children[k].props.style) { if (settings.variableWidth && children[k].props?.style) {
currentWidth = children[k].props.style.width; currentWidth = children[k].props.style.width;
} }
if (k >= children.length) break; if (k >= children.length) break;

View File

@ -49,13 +49,13 @@ export default defineComponent({
wrapper: PropTypes.any, wrapper: PropTypes.any,
row: PropTypes.any, row: PropTypes.any,
cell: PropTypes.any, cell: PropTypes.any,
}), }).loose,
body: PropTypes.shape({ body: PropTypes.shape({
wrapper: PropTypes.any, wrapper: PropTypes.any,
row: PropTypes.any, row: PropTypes.any,
cell: PropTypes.any, cell: PropTypes.any,
}), }).loose,
}), }).loose,
expandIconAsCell: PropTypes.looseBool, expandIconAsCell: PropTypes.looseBool,
expandedRowKeys: PropTypes.array, expandedRowKeys: PropTypes.array,
expandedRowClassName: PropTypes.func, expandedRowClassName: PropTypes.func,

View File

@ -874,12 +874,28 @@ const Select = defineComponent({
}, },
onSearchInputKeyDown(event) { onSearchInputKeyDown(event) {
const { _searchValue: searchValue, _valueList: valueList } = this.$data; const {
_searchValue: searchValue,
_valueList: valueList,
_valueEntities: valueEntities,
} = this.$data;
const { keyCode } = event; const { keyCode } = event;
if (KeyCode.BACKSPACE === keyCode && this.isMultiple() && !searchValue && valueList.length) { if (KeyCode.BACKSPACE === keyCode && this.isMultiple() && !searchValue && valueList.length) {
const lastValue = valueList[valueList.length - 1].value; let lastValue = valueList[valueList.length - 1].value;
const { treeCheckStrictly } = this.$props;
if (!treeCheckStrictly) {
let cur = valueEntities[lastValue];
while (cur) {
if (valueList.some(j => j.value === cur.value)) {
lastValue = cur.value;
cur = cur.parent;
} else {
cur = null;
}
}
}
this.onMultipleSelectorRemove(event, lastValue); this.onMultipleSelectorRemove(event, lastValue);
} }
}, },

View File

@ -31,7 +31,7 @@ export default {
point: PropTypes.shape({ point: PropTypes.shape({
pageX: PropTypes.number, pageX: PropTypes.number,
pageY: PropTypes.number, pageY: PropTypes.number,
}), }).loose,
}, },
data() { data() {
this.domEl = null; this.domEl = null;

View File

@ -134,10 +134,11 @@ const List = defineComponent({
// ================================ Height ================================ // ================================ Height ================================
const [setInstance, collectHeight, heights] = useHeights(getKey, null, null); const [setInstance, collectHeight, heights] = useHeights(getKey, null, null);
// ========================== Visible Calculation =========================
const calRes = computed(() => { const calRes = ref();
watchEffect(() => {
if (!useVirtual.value) { if (!useVirtual.value) {
return { calRes.value = {
scrollHeight: undefined, scrollHeight: undefined,
start: 0, start: 0,
end: state.mergedData.length - 1, end: state.mergedData.length - 1,
@ -147,7 +148,7 @@ const List = defineComponent({
// Always use virtual scroll bar in avoid shaking // Always use virtual scroll bar in avoid shaking
if (!inVirtual.value) { if (!inVirtual.value) {
return { calRes.value = {
scrollHeight: fillerInnerRef.value?.offsetHeight || 0, scrollHeight: fillerInnerRef.value?.offsetHeight || 0,
start: 0, start: 0,
end: state.mergedData.length - 1, end: state.mergedData.length - 1,
@ -193,13 +194,14 @@ const List = defineComponent({
// Give cache to improve scroll experience // Give cache to improve scroll experience
endIndex = Math.min(endIndex + 1, state.mergedData.length); endIndex = Math.min(endIndex + 1, state.mergedData.length);
return { calRes.value = {
scrollHeight: itemTop, scrollHeight: itemTop,
start: startIndex, start: startIndex,
end: endIndex, end: endIndex,
offset: startOffset, offset: startOffset,
}; };
}); });
// =============================== In Range =============================== // =============================== In Range ===============================
const maxScrollHeight = computed(() => calRes.value.scrollHeight! - props.height!); const maxScrollHeight = computed(() => calRes.value.scrollHeight! - props.height!);

View File

@ -1,6 +1,6 @@
{ {
"name": "ant-design-vue", "name": "ant-design-vue",
"version": "2.1.2", "version": "2.1.4",
"title": "Ant Design Vue", "title": "Ant Design Vue",
"description": "An enterprise-class UI design language and Vue-based implementation", "description": "An enterprise-class UI design language and Vue-based implementation",
"keywords": [ "keywords": [
@ -39,7 +39,7 @@
"pre-publish": "node ./scripts/prepub && npm run generator-webtypes", "pre-publish": "node ./scripts/prepub && npm run generator-webtypes",
"prettier": "prettier -c --write '**/*'", "prettier": "prettier -c --write '**/*'",
"pretty-quick": "pretty-quick", "pretty-quick": "pretty-quick",
"dist": "node --max_old_space_size=6144 antd-tools/cli/run.js dist", "dist": "node --max_old_space_size=8192 antd-tools/cli/run.js dist",
"lint": "eslint -c ./.eslintrc --fix --ext .jsx,.js,.vue,.ts,.tsx ./components", "lint": "eslint -c ./.eslintrc --fix --ext .jsx,.js,.vue,.ts,.tsx ./components",
"lint:style": "stylelint \"{site,components}/**/*.less\" --syntax less", "lint:style": "stylelint \"{site,components}/**/*.less\" --syntax less",
"codecov": "codecov" "codecov": "codecov"
@ -81,7 +81,7 @@
"@babel/preset-typescript": "^7.10.4", "@babel/preset-typescript": "^7.10.4",
"@commitlint/cli": "^12.0.0", "@commitlint/cli": "^12.0.0",
"@commitlint/config-conventional": "^12.0.0", "@commitlint/config-conventional": "^12.0.0",
"@octokit/rest": "^16.0.0", "@octokit/rest": "^18.0.0",
"@types/fs-extra": "^9.0.8", "@types/fs-extra": "^9.0.8",
"@types/lodash-es": "^4.17.3", "@types/lodash-es": "^4.17.3",
"@types/raf": "^3.4.0", "@types/raf": "^3.4.0",
@ -94,8 +94,8 @@
"@vue/eslint-config-typescript": "^7.0.0", "@vue/eslint-config-typescript": "^7.0.0",
"@vue/test-utils": "^2.0.0-0", "@vue/test-utils": "^2.0.0-0",
"@webpack-cli/serve": "^1.3.1", "@webpack-cli/serve": "^1.3.1",
"acorn": "^7.0.0", "acorn": "^8.0.0",
"autoprefixer": "^9.6.0", "autoprefixer": "^10.2.0",
"axios": "^0.21.0", "axios": "^0.21.0",
"babel-eslint": "^10.0.1", "babel-eslint": "^10.0.1",
"babel-jest": "^26.1.0", "babel-jest": "^26.1.0",
@ -104,25 +104,25 @@
"babel-plugin-inline-import-data-uri": "^1.0.1", "babel-plugin-inline-import-data-uri": "^1.0.1",
"babel-plugin-istanbul": "^6.0.0", "babel-plugin-istanbul": "^6.0.0",
"case-sensitive-paths-webpack-plugin": "^2.1.2", "case-sensitive-paths-webpack-plugin": "^2.1.2",
"chalk": "^3.0.0", "chalk": "^4.1.0",
"cheerio": "^1.0.0-rc.2", "cheerio": "^1.0.0-rc.2",
"codecov": "^3.0.0", "codecov": "^3.0.0",
"colorful": "^2.1.0", "colorful": "^2.1.0",
"commander": "^4.0.0", "commander": "^7.2.0",
"compare-versions": "^3.3.0", "compare-versions": "^3.3.0",
"cross-env": "^7.0.0", "cross-env": "^7.0.0",
"css-loader": "^3.0.0", "css-loader": "^5.0.0",
"deep-assign": "^2.0.0", "deep-assign": "^3.0.0",
"docsearch.js": "^2.6.3", "docsearch.js": "^2.6.3",
"enquire-js": "^0.2.1", "enquire-js": "^0.2.1",
"eslint": "^6.8.0", "eslint": "^7.25.0",
"eslint-config-prettier": "^8.0.0", "eslint-config-prettier": "^8.0.0",
"eslint-plugin-html": "^6.0.0", "eslint-plugin-html": "^6.0.0",
"eslint-plugin-markdown": "^2.0.0-alpha.0", "eslint-plugin-markdown": "^2.0.0-alpha.0",
"eslint-plugin-prettier": "^3.1.4", "eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-vue": "^7.1.0", "eslint-plugin-vue": "^7.1.0",
"fetch-jsonp": "^1.1.3", "fetch-jsonp": "^1.1.3",
"fs-extra": "^8.0.0", "fs-extra": "^10.0.0",
"glob": "^7.1.2", "glob": "^7.1.2",
"gulp": "^4.0.1", "gulp": "^4.0.1",
"gulp-babel": "^8.0.0", "gulp-babel": "^8.0.0",
@ -140,20 +140,20 @@
"json-templater": "^1.2.0", "json-templater": "^1.2.0",
"jsonp": "^0.2.1", "jsonp": "^0.2.1",
"less": "^4.0.0", "less": "^4.0.0",
"less-loader": "^7.0.0", "less-loader": "^8.0.0",
"less-plugin-npm-import": "^2.1.0", "less-plugin-npm-import": "^2.1.0",
"less-vars-to-js": "^1.3.0", "less-vars-to-js": "^1.3.0",
"lint-staged": "^10.0.0", "lint-staged": "^11.0.0",
"marked": "0.3.18", "marked": "0.3.18",
"merge2": "^1.2.1", "merge2": "^1.2.1",
"mini-css-extract-plugin": "^0.10.0", "mini-css-extract-plugin": "^1.5.0",
"minimist": "^1.2.0", "minimist": "^1.2.0",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"mockdate": "^2.0.2", "mockdate": "^2.0.2",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"optimize-css-assets-webpack-plugin": "^5.0.1", "optimize-css-assets-webpack-plugin": "^5.0.1",
"postcss": "^7.0.6", "postcss": "^8.2.12",
"postcss-loader": "^3.0.0", "postcss-loader": "^5.0.0",
"prettier": "^1.18.2", "prettier": "^1.18.2",
"pretty-quick": "^2.0.0", "pretty-quick": "^2.0.0",
"prismjs": "^1.20.0", "prismjs": "^1.20.0",
@ -164,17 +164,16 @@
"rucksack-css": "^1.0.2", "rucksack-css": "^1.0.2",
"selenium-server": "^3.0.1", "selenium-server": "^3.0.1",
"semver": "^7.0.0", "semver": "^7.0.0",
"style-loader": "^1.0.0", "style-loader": "^2.0.0",
"stylelint": "^13.0.0", "stylelint": "^13.0.0",
"stylelint-config-prettier": "^8.0.0", "stylelint-config-prettier": "^8.0.0",
"stylelint-config-rational-order": "^0.1.2", "stylelint-config-rational-order": "^0.1.2",
"stylelint-config-standard": "^21.0.0", "stylelint-config-standard": "^22.0.0",
"stylelint-declaration-block-no-ignored-properties": "^2.1.0", "stylelint-declaration-block-no-ignored-properties": "^2.1.0",
"stylelint-order": "^4.0.0", "stylelint-order": "^4.0.0",
"terser-webpack-plugin": "^3.0.3",
"through2": "^3.0.0", "through2": "^3.0.0",
"ts-jest": "^26.4.1", "ts-jest": "^26.4.1",
"ts-loader": "^8.1.0", "ts-loader": "^9.1.0",
"typescript": "^4.2.0", "typescript": "^4.2.0",
"umi-mock-middleware": "^1.0.0", "umi-mock-middleware": "^1.0.0",
"umi-request": "^1.3.5", "umi-request": "^1.3.5",

2
v2-doc

@ -1 +1 @@
Subproject commit 31d85319dcc0438b3c80957c99f57b931b047c11 Subproject commit 4da56dac85f43ad7a288951cbf09d860ecf93bb4

View File

@ -33,7 +33,7 @@ const babelConfig = {
style: true, style: true,
}, },
], ],
['@vue/babel-plugin-jsx', { mergeProps: false }], ['@vue/babel-plugin-jsx', { mergeProps: false, enableObjectSlots: false }],
'@babel/plugin-proposal-optional-chaining', '@babel/plugin-proposal-optional-chaining',
'@babel/plugin-transform-object-assign', '@babel/plugin-transform-object-assign',
'@babel/plugin-proposal-object-rest-spread', '@babel/plugin-proposal-object-rest-spread',
@ -118,9 +118,7 @@ module.exports = {
use: [ use: [
{ {
loader: MiniCssExtractPlugin.loader, loader: MiniCssExtractPlugin.loader,
options: { options: {},
hmr: true,
},
}, },
'css-loader', 'css-loader',
], ],