diff --git a/.eslintignore b/.eslintignore index 965aaca32..5484d7a9c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -7,4 +7,3 @@ es/ lib/ _site/ dist/ -types/ diff --git a/.eslintrc b/.eslintrc index 6d1be14cc..c61e47679 100644 --- a/.eslintrc +++ b/.eslintrc @@ -19,6 +19,14 @@ "rules": { "no-console": "off" } + }, + { + "files": ["**/types/**/*.ts"], + "extends": ["@vue/typescript/recommended"], + "rules": { + "@typescript-eslint/no-explicit-any": 0, + "@typescript-eslint/ban-types": 0 + } } ], "rules": { diff --git a/.jest.js b/.jest.js index 171aff90a..a1dd53c46 100644 --- a/.jest.js +++ b/.jest.js @@ -2,7 +2,9 @@ const libDir = process.env.LIB_DIR; const transformIgnorePatterns = [ '/dist/', - 'node_modules/[^/]+?/(?!(es|node_modules)/)', // Ignore modules without es dir + // Ignore modules without es dir. + // Update: @babel/runtime should also be transformed + 'node_modules/(?!.*(@babel|lodash-es))[^/]+?/(?!(es|node_modules)/)', ]; module.exports = { diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 89dfca655..379ef7f0f 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -10,6 +10,133 @@ --- +## 2.0.0-beta.8 + +- 🐞 Fix ts types error + +## 2.0.0-beta.7 + +- 🐞 Fix the problem that Descriptions Item does not support v-for [#2793](https://github.com/vueComponent/ant-design-vue/issues/2793) +- 🐞 Fix Modal button loading effect not working problem [9257c1](https://github.com/vueComponent/ant-design-vue/commit/9257c1ea685db4339239589153aee3189d0434fe) +- 🐞 Fix the problem that the Steps component cannot be clicked when using v-model [ec7309](https://github.com/vueComponent/ant-design-vue/commit/ec73097d9b6ea8e2f2942ac28853c19191ca3298) +- 🌟 Checkbox, Radio add event declaration +- 🐞 Fix ts type error [802446](https://github.com/vueComponent/ant-design-vue/commit/8024469b8832cfc4fe85498b639bfb48820531aa) + +## 2.0.0-beta.6 + +- 🐞 Fix the problem that TreeSelectNode subcomponent TreeSelectNode is not registered + +## 2.0.0-beta.5 + +- 🔥 Support Vite. + +## 2.0.0-beta.4 + +- 🌟 Remove polyfills that are no longer used +- 🐞 Fix the problem of calling `Modal` afterClose twice +- 🐞 Supplement the declaration that ts type files lack native attributes + +## 2.0.0-beta.3 + +- 🔥 Support Typescript. +- 🔥 Added `Space` component. +- 🐞 Fix the problem that some components cannot use css scope [4bdb24](https://github.com/vueComponent/ant-design-vue/commit/4bdb241aa674b50fafa29b3b98e291643f2a06cc). +- 🐞 Fix `List.Meta` registration failure problem [03a42a](https://github.com/vueComponent/ant-design-vue/commit/03a42a5b35e7d42a39aedb1aba8346995be2c27e) +- 🐞 Fix the problem of misalignment in the fixed column of Table [#1493](https://github.com/vueComponent/ant-design-vue/issues/1493) +- 🐞 Fix the problem that the `Button` is not vertically centered [bd71e3](https://github.com/vueComponent/ant-design-vue/commit/bd71e3806b73881f9a95028982d17a10b2cd0b5c) +- 🐞 Fix `Tabs` multiple departure `change` event issue [8ed937](https://github.com/vueComponent/ant-design-vue/commit/8ed937344a57142a575e5272f50933c9c4459a43) + +## 2.0.0-beta.2 + +### Design specification adjustment + +- Adjust the row height from `1.5`(`21px`) to `1.5715`(`22px`). +- Basic round corner adjustment, changed from `4px` to `2px`. +- The color brightness of the dividing line is reduced, from `#E8E8E8` to `#F0F0F0`. +- The default background color of Table is changed from transparent to white. + +### Compatibility adjustment + +- The minimum supported version of IE is IE 11. +- The minimum supported version of Vue is Vue 3.0. + +#### Adjusted API + +- Removed LocaleProvider, please use `ConfigProvider` instead. +- Removed the afterClose property of Tag. +- Merged FormModel and Form, see the Form refactoring part below for details. +- `tabIndex`, `maxLength`, `readOnly`, `autoComplete`, `autoFocus` are changed to all lowercase. +- In order to use the slot more friendly in template syntax, all related to xxxRender, renderXxxx are changed to single parameter, involving `itemRender`, `renderItem`, `customRender`, `dropdownRender`, `dateCellRender`, `dateFullCellRender`, `monthCellRender`, `monthFullCellRender`, `renderTabBar`. +- All the places where scopedSlots are configured are changed to slots. +- `{ on, props, attrs, ... }` configuration is flattened, such as `{ props: {type:'xxx'}, on: {click: this.handleClick}}` changed to `{ type: 'xxx', onClick: this.handleClick }`, related fields: `okButtonProps`, `cancelButtonProps`. +- Change xxx.sync to v-model:xxx +- v-model is changed to v-model:xxx, which specifically involves components: + + - The components changed from v-model to v-model:checked are: CheckableTag, Checkbox, Switch + - The components changed from v-model to v-model:value are: Radio, Mentions, CheckboxGroup, Rate, DatePicker + - The components changed from v-model to v-model:visible are: Tag, Popconfirm, Popove, Tooltip, Moda, Dropdown + - The components changed from v-model to v-model:activeKey are: Collaps, Tabs + - The components changed from v-model to v-model:current are: Steps + - The components changed from v-model to v-model:selectedKeys are: Menu + +#### Icon Upgrade + +In `ant-design-vue@1.2.0`, we introduced the svg icon ([Why use the svg icon?](https://github.com/ant-design/ant-design/issues/10353)). The icon API that uses string naming cannot be loaded on demand, so the svg icon file is fully introduced, which greatly increases the size of the packaged product. In 2.0, we adjusted the icon usage API to support tree shaking, reducing the default package size by approximately 150 KB (Gzipped). + +The old way of using Icon will be obsolete: + +```html + +``` + +In 2.0, an on-demand introduction method will be adopted: + +```html + + +``` + +#### Component refactoring + +In 1.x, we provide two form components, Form and FormModel. The original Form component uses v-decorator for data binding. In Vue2, we use context to force update components. However, in Vue3, due to the introduction of patchFlag, etc. Optimization method, forced refresh will destroy the performance advantage brought by patchFlag. So in version 2.0, we merged Form and FormModel, retained the use of FormModel, enriched related functions, and renamed it to Form. + +Involving changes: + +- Added `scrollToFirstError`, `name`, `validateTrigger` properties for Form, added `finish`, `finishFailed` events, and added `scrollToField` method. +- Form.Item adds `validateFirst`, `validateTrigger`, and discards the `prop` attribute, and replaces it with `name`. +- The nested field path uses an array. In the past version, we used. To represent the nested path (such as user.name to represent {user: {name:''} }). However, in some back-end systems, the variable name will also carry .. This causes users to need additional codes for conversion. Therefore, in the new version, nested paths are represented by arrays to avoid wrong handling behaviors (such as ['user','name']). +- validateFields no longer supports callback. validateFields will return a Promise object, so you can perform corresponding error handling through async/await or then/catch. It is no longer necessary to determine whether errors is empty: + +```js +// v1 +validateFields((err, value) => { + if (!err) { + // Do something with value + } +}); +``` + +Change to + +```js +// v2 +validateFields().then(values ​​=> { + // Do something with value +}); +``` + ## 1.6.4 `2020-07-21` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 50dce553f..3667f7f2c 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -10,6 +10,135 @@ --- +## 2.0.0-beta.8 + +- 🐞 修复 ts 类型错误 + +## 2.0.0-beta.7 + +- 🐞 修复 Descriptions Item 不支持 v-for 问题 [#2793](https://github.com/vueComponent/ant-design-vue/issues/2793) +- 🐞 修复 Modal button loading 效果不生效问题 [9257c1](https://github.com/vueComponent/ant-design-vue/commit/9257c1ea685db4339239589153aee3189d0434fe) +- 🐞 修复 Steps 组件使用 v-model 时不可点击的问题 [ec7309](https://github.com/vueComponent/ant-design-vue/commit/ec73097d9b6ea8e2f2942ac28853c19191ca3298) +- 🌟 Checkbox、Radio 添加事件声明 +- 🐞 修复 ts 类型错误 [802446](https://github.com/vueComponent/ant-design-vue/commit/8024469b8832cfc4fe85498b639bfb48820531aa) + +## 2.0.0-beta.6 + +- 🐞 修复 TreeSelectNode 子组件 TreeSelectNode 没有注册的问题 + +## 2.0.0-beta.5 + +- 🔥 支持 Vite。 + +## 2.0.0-beta.4 + +- 🌟 移除不再使用的 polyfill +- 🐞 修复 `Modal` afterClose 调用两次的问题 +- 🐞 补充 ts 类型文件缺少原生属性的声明 + +## 2.0.0-beta.3 + +- 🔥 支持 Typescript。 +- 🔥 新增 `Space` 组件。 +- 🐞 修复部分组件无法使用 css scope 问题 [4bdb24](https://github.com/vueComponent/ant-design-vue/commit/4bdb241aa674b50fafa29b3b98e291643f2a06cc)。 +- 🐞 修复 `List.Meta` 注册失败的问题 [03a42a](https://github.com/vueComponent/ant-design-vue/commit/03a42a5b35e7d42a39aedb1aba8346995be2c27e) +- 🐞 修复 `Table` 固定列情况下错位问题 [#1493](https://github.com/vueComponent/ant-design-vue/issues/1493) +- 🐞 修复 `Button` 没有垂直居中的问题 [bd71e3](https://github.com/vueComponent/ant-design-vue/commit/bd71e3806b73881f9a95028982d17a10b2cd0b5c) +- 🐞 修复 `Tabs` 多次出发 `change` 事件问题 [8ed937](https://github.com/vueComponent/ant-design-vue/commit/8ed937344a57142a575e5272f50933c9c4459a43) + +## 2.0.0-beta.2 + +`2020-08-14` + +### 设计规范调整 + +- 行高从 `1.5`(`21px`) 调整为 `1.5715`(`22px`)。 +- 基础圆角调整,由`4px` 改为 `2px`。 +- 分割线颜色明度降低,由 `#E8E8E8` 改为 `#F0F0F0`。 +- Table 默认背景颜色从透明修改为白色。 + +### 兼容性调整 + +- IE 最低支持版本为 IE 11。 +- Vue 最低支持版本为 Vue 3.0。 + +#### 调整的 API + +- 移除了 LocaleProvider,请使用 `ConfigProvider` 替代。 +- 移除了 Tag 的 afterClose 属性。 +- 合并了 FormModel、Form,详见下方的 Form 重构部分。 +- `tabIndex`、`maxLength`、`readOnly`、`autoComplete`、`autoFocus` 更改为全小写。 +- 为了在 template 语法中更友好的使用插槽,所有涉及到 xxxRender, renderXxxx 的均改成单参数,涉及到 `itemRender`、`renderItem`、`customRender`、`dropdownRender`、`dateCellRender`、`dateFullCellRender`、`monthCellRender`、`monthFullCellRender`、`renderTabBar`。 +- 所有配置 scopedSlots 的地方统一改成 slots。 +- `{ on, props, attrs, ... }` 配置进行扁平化处理,如 `{ props: {type: 'xxx'}, on: {click: this.handleClick}}` 改成 `{ type: 'xxx', onClick: this.handleClick }`, 涉及相关字段:`okButtonProps`、`cancelButtonProps`。 +- xxx.sync 改成 v-model:xxx +- v-model 更改成 v-model:xxx,具体涉及组件: + + - v-model 改成 v-model:checked 的组件有: CheckableTag、Checkbox、Switch + - v-model 改成 v-model:value 的组件有: Radio、Mentions、CheckboxGroup、Rate、DatePicker + - v-model 改成 v-model:visible 的组件有: Tag、Popconfirm、Popove、Tooltip、Moda、Dropdown + - v-model 改成 v-model:activeKey 的组件有: Collaps、Tabs + - v-model 改成 v-model:current 的组件有: Steps + - v-model 改成 v-model:selectedKeys 的组件有: Menu + +#### 图标升级 + +在 `ant-design-vue@1.2.0` 中,我们引入了 svg 图标([为何使用 svg 图标?](https://github.com/ant-design/ant-design/issues/10353))。使用了字符串命名的图标 API 无法做到按需加载,因而全量引入了 svg 图标文件,这大大增加了打包产物的尺寸。在 2.0 中,我们调整了图标的使用 API 从而支持 tree shaking,减少默认包体积约 150 KB(Gzipped)。 + +旧版 Icon 使用方式将被废弃: + +```html + +``` + +2.0 中会采用按需引入的方式: + +```html + + +``` + +#### 组件重构 + +在 1.x 中我们提供了 Form、FormModel 两个表单组件,原有的 Form 组件使用 v-decorator 进行数据绑定,在 Vue2 中我们通过上下文进行强制更新组件,但是在 Vue3 中,由于引入 patchFlag 等优化方式,强制刷新会破坏 patchFlag 带来的性能优势。所以在 2.0 版本中我们将 Form、FormModel 进行合并,保留了 FormModel 的使用方式,丰富了相关功能,并改名成 Form。 + +涉及改动: + +- Form 新增 `scrollToFirstError`,`name`,`validateTrigger` 属性,新增 `finish`、`finishFailed` 事件,新增 `scrollToField` 方法。 +- Form.Item 新增 `validateFirst`, `validateTrigger`, 废弃 `prop` 属性,使用 `name` 替换。 +- 嵌套字段路径使用数组,过去版本我们通过 . 代表嵌套路径(诸如 user.name 来代表 { user: { name: '' } })。然而在一些后台系统中,变量名中也会带上 .。这造成用户需要额外的代码进行转化,因而新版中,嵌套路径通过数组来表示以避免错误的处理行为(如 ['user', 'name'])。 +- validateFields 不再支持 callback。validateFields 会返回 Promise 对象,因而你可以通过 async/await 或者 then/catch 来执行对应的错误处理。不再需要判断 errors 是否为空: + +```js +// v1 +validateFields((err, value) => { + if (!err) { + // Do something with value + } +}); +``` + +改成 + +```js +// v2 +validateFields().then(values => { + // Do something with value +}); +``` + ## 1.6.4 `2020-07-21` diff --git a/antd-tools/getBabelCommonConfig.js b/antd-tools/getBabelCommonConfig.js index cd6b14caa..b6886ea4e 100644 --- a/antd-tools/getBabelCommonConfig.js +++ b/antd-tools/getBabelCommonConfig.js @@ -2,7 +2,7 @@ module.exports = function(modules) { const plugins = [ - require.resolve('@ant-design-vue/babel-plugin-jsx'), + require.resolve('@vue/babel-plugin-jsx'), require.resolve('@babel/plugin-proposal-optional-chaining'), require.resolve('@babel/plugin-transform-object-assign'), require.resolve('@babel/plugin-proposal-object-rest-spread'), diff --git a/antd-tools/getWebpackConfig.js b/antd-tools/getWebpackConfig.js index 4efa0822a..5c2e646fc 100644 --- a/antd-tools/getWebpackConfig.js +++ b/antd-tools/getWebpackConfig.js @@ -83,7 +83,7 @@ function getWebpackConfig(modules) { options: { presets: [require.resolve('@babel/preset-env')], plugins: [ - require.resolve('@ant-design-vue/babel-plugin-jsx'), + require.resolve('@vue/babel-plugin-jsx'), require.resolve('@babel/plugin-proposal-object-rest-spread'), ], }, diff --git a/antdv-demo b/antdv-demo index 31e7b308a..cd4d03a89 160000 --- a/antdv-demo +++ b/antdv-demo @@ -1 +1 @@ -Subproject commit 31e7b308adb6eabb97c003fbc7883e4d00c8f764 +Subproject commit cd4d03a897a0ab0224f4a631481e73cb05540f4a diff --git a/babel.config.js b/babel.config.js index c0bd6b4be..58c70b70a 100644 --- a/babel.config.js +++ b/babel.config.js @@ -3,7 +3,7 @@ module.exports = { test: { presets: [['@babel/preset-env', { targets: { node: true } }]], plugins: [ - ['@ant-design-vue/babel-plugin-jsx'], + ['@vue/babel-plugin-jsx'], '@babel/plugin-proposal-optional-chaining', '@babel/plugin-transform-object-assign', '@babel/plugin-proposal-object-rest-spread', diff --git a/breakChange-2.x.md b/breakChange-2.x.md deleted file mode 100644 index ab1a183da..000000000 --- a/breakChange-2.x.md +++ /dev/null @@ -1,121 +0,0 @@ -# break change - -## global api - -所有 dom 原生属性由驼峰改成全小写,涉及 API - -#### - -maxLength -> maxlength tabIndex => tabindex readOnly => readonly autoComplete => autocomplete - -## Tag - -### CheckableTag - -v-model -> v-model:checked - -### Tag - -v-model -> v-model:visible - -移除 afterClose 属性 - -## Radio - -radioGroup radio v-model -> v-model:value - -## popconfirm - -okButtonProps、cancelButtonProps 扁平化处理 - -v-model -> v-model:visible - -## popover - -v-model -> v-model:visible - -## Tooltip - -v-model -> v-model:visible - -## Modal - -v-model -> v-model:visible - -okButtonProps、cancelButtonProps 扁平化处理 - -## Mentions - -v-model -> v-model:value - -## menu - -v-model -> v-model:selectedKeys :openKeys.sync -> v-mdoel:openKeys - -## dropdown - -v-model -> v-model:visible - -## Steps - -v-model -> v-model:current - -## checkbox - -v-model -> v-model:checked - -checkboxGroup - -v-model -> v-model:value - -## Switch - -v-model -> v-model:checked - -## tabs - -v-model -> v-model:activeKey - -renderTabBar({props, on, style, class}, DefaultTabBar) -> {DefaultTabBar, ...props} 多参数改成单参数并且扁平化处理 - -## card - -tabList[{scopedSlots}] -> tabList[{slots}] - -## rate - -v-model -> v-model:value - -## Collapse - -v-model -> v-model:activeKey - -## List - -renderItem(item, index) => renderItem({item, index}) 该用单参数 - -## TreeSelect - -treeData 中 scopedSlots => slots , v-model => v-model:value - -## datePicker - -dateRender - -(current: moment.Moment, today: moment.Moment) => ({current: moment.Moment, today: moment.Moment}) - -monthCellContentRender (date, locale) => ({date, locale}) - -## table - -customRender( text, record, index, column ); => customRender({ text, record, index, column }); - -expandedRowRender(record, index, indent, expanded) => expandedRowRender({ record, index, indent, expanded }) - -filterIcon(filtered, column) => filterIcon({ filtered, column }) - -## calendar - -dateCellRender、dateFullCellRender、monthCellRender、monthFullCellRender - -function (date, today?) => function({current, today?}) diff --git a/components/_util/PortalWrapper.ts b/components/_util/PortalWrapper.ts index 2ae3f6b29..84170c206 100644 --- a/components/_util/PortalWrapper.ts +++ b/components/_util/PortalWrapper.ts @@ -2,6 +2,7 @@ import PropTypes from './vue-types'; import switchScrollingEffect from './switchScrollingEffect'; import setStyle from './setStyle'; import Portal from './Portal'; +import syncWatch from './syncWatch'; let openCount = 0; const windowIsUndefined = !( @@ -32,9 +33,9 @@ export default { this.setWrapperClassName(); }, watch: { - visible(val) { + visible: syncWatch(function(val) { openCount = val ? openCount + 1 : openCount - 1; - }, + }), getContainer(getContainer, prevGetContainer) { const getContainerIsFunc = typeof getContainer === 'function' && typeof prevGetContainer === 'function'; diff --git a/components/_util/classNames.js b/components/_util/classNames.js new file mode 100644 index 000000000..55875ffb7 --- /dev/null +++ b/components/_util/classNames.js @@ -0,0 +1,27 @@ +import { isArray, isString, isObject } from './util'; +function classNames() { + let classes = []; + for (let i = 0; i < arguments.length; i++) { + const value = arguments[i]; + if (!value) continue; + if (isString(value)) { + classes.push(value); + } else if (isArray(value)) { + for (let i = 0; i < value.length; i++) { + const inner = classNames(value[i]); + if (inner) { + classes.push(inner); + } + } + } else if (isObject(value)) { + for (const name in value) { + if (value[name]) { + classes.push(name); + } + } + } + } + return classes.join(' '); +} + +export default classNames; diff --git a/components/_util/moment-util.ts b/components/_util/moment-util.ts index 163effc36..002820474 100644 --- a/components/_util/moment-util.ts +++ b/components/_util/moment-util.ts @@ -1,7 +1,7 @@ import interopDefault from './interopDefault'; -import * as moment from 'moment'; +import moment from 'moment'; import warning from './warning'; -import isNil from 'lodash/isNil'; +import isNil from 'lodash-es/isNil'; export const TimeType = { validator(value) { diff --git a/components/_util/props-util.ts b/components/_util/props-util.ts index f65b04425..9572a7f3f 100644 --- a/components/_util/props-util.ts +++ b/components/_util/props-util.ts @@ -1,3 +1,4 @@ +<<<<<<< HEAD:components/_util/props-util.ts import isPlainObject from 'lodash/isPlainObject'; import classNames from 'classnames'; import { @@ -10,6 +11,11 @@ import { ComponentPublicInstance, PropOptions, } from 'vue'; +======= +import isPlainObject from 'lodash-es/isPlainObject'; +import classNames from './classNames'; +import { isVNode, Fragment, Comment, Text, h } from 'vue'; +>>>>>>> @{-1}:components/_util/props-util.js import { camelize, hyphenate, isOn, resolvePropValue } from './util'; import isValid from './isValid'; // function getType(fn) { diff --git a/components/_util/responsiveObserve.js b/components/_util/responsiveObserve.js new file mode 100644 index 000000000..9b6fa3c76 --- /dev/null +++ b/components/_util/responsiveObserve.js @@ -0,0 +1,63 @@ +export const responsiveArray = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs']; + +export const responsiveMap = { + xs: '(max-width: 575px)', + sm: '(min-width: 576px)', + md: '(min-width: 768px)', + lg: '(min-width: 992px)', + xl: '(min-width: 1200px)', + xxl: '(min-width: 1600px)', +}; + +const subscribers = new Map(); +let subUid = -1; +let screens = {}; + +const responsiveObserve = { + matchHandlers: {}, + dispatch(pointMap) { + screens = pointMap; + subscribers.forEach(func => func(screens)); + return subscribers.size >= 1; + }, + subscribe(func) { + if (!subscribers.size) this.register(); + subUid += 1; + subscribers.set(subUid, func); + func(screens); + return subUid; + }, + unsubscribe(token) { + subscribers.delete(token); + if (!subscribers.size) this.unregister(); + }, + unregister() { + Object.keys(responsiveMap).forEach(screen => { + const matchMediaQuery = responsiveMap[screen]; + const handler = this.matchHandlers[matchMediaQuery]; + handler?.mql.removeListener(handler?.listener); + }); + subscribers.clear(); + }, + register() { + Object.keys(responsiveMap).forEach(screen => { + const matchMediaQuery = responsiveMap[screen]; + const listener = ({ matches }) => { + this.dispatch({ + ...screens, + [screen]: matches, + }); + }; + const mql = window.matchMedia(matchMediaQuery); + mql.addListener(listener); + this.matchHandlers[matchMediaQuery] = { + mql, + listener, + }; + + listener(mql); + }); + }, +}; + +export default responsiveObserve; diff --git a/components/_util/util.ts b/components/_util/util.ts index 8c8e7ced5..8140af3fa 100644 --- a/components/_util/util.ts +++ b/components/_util/util.ts @@ -1,4 +1,9 @@ -const isFunction = val => typeof val === 'function'; +export const isFunction = val => typeof val === 'function'; + +export const isArray = Array.isArray; +export const isString = val => typeof val === 'string'; +export const isSymbol = val => typeof val === 'symbol'; +export const isObject = val => val !== null && typeof val === 'object'; const onRE = /^on[^a-z]/; const isOn = key => onRE.test(key); diff --git a/components/_util/vue-types/index.ts b/components/_util/vue-types/index.ts index e04b3e431..de2dbb92e 100644 --- a/components/_util/vue-types/index.ts +++ b/components/_util/vue-types/index.ts @@ -1,5 +1,9 @@ +<<<<<<< HEAD:components/_util/vue-types/index.ts import { PropType } from 'vue'; import isPlainObject from 'lodash/isPlainObject'; +======= +import isPlainObject from 'lodash-es/isPlainObject'; +>>>>>>> @{-1}:components/_util/vue-types/index.js import { toType, getType, isFunction, validateType, isInteger, isArray, warn } from './utils'; const VuePropTypes = { diff --git a/components/_util/vue-types/utils.ts b/components/_util/vue-types/utils.ts index 6d77d4e9e..5f09b5875 100644 --- a/components/_util/vue-types/utils.ts +++ b/components/_util/vue-types/utils.ts @@ -1,4 +1,4 @@ -import isPlainObject from 'lodash/isPlainObject'; +import isPlainObject from 'lodash-es/isPlainObject'; const ObjProto = Object.prototype; const toString = ObjProto.toString; diff --git a/components/affix/__tests__/__snapshots__/demo.test.js.snap b/components/affix/__tests__/__snapshots__/demo.test.js.snap index d6c6954a5..62bfb421b 100644 --- a/components/affix/__tests__/__snapshots__/demo.test.js.snap +++ b/components/affix/__tests__/__snapshots__/demo.test.js.snap @@ -3,18 +3,21 @@ exports[`renders ./antdv-demo/docs/affix/demo/basic.md correctly 1`] = `
+ Affix top +

+ Affix bottom +
`; exports[`renders ./antdv-demo/docs/affix/demo/on-change.md correctly 1`] = `
+ 120px to affix top +
`; @@ -23,7 +26,8 @@ exports[`renders ./antdv-demo/docs/affix/demo/target.md correctly 1`] = `
+ Fixed at the top of container +
diff --git a/components/affix/index.tsx b/components/affix/index.tsx index eb0778eaa..7eea0b00c 100644 --- a/components/affix/index.tsx +++ b/components/affix/index.tsx @@ -1,6 +1,6 @@ import { inject } from 'vue'; import PropTypes from '../_util/vue-types'; -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import omit from 'omit.js'; import ResizeObserver from '../vc-resize-observer'; import BaseMixin from '../_util/BaseMixin'; diff --git a/components/alert/__tests__/__snapshots__/demo.test.js.snap b/components/alert/__tests__/__snapshots__/demo.test.js.snap index 76acf0c82..0ddccef29 100644 --- a/components/alert/__tests__/__snapshots__/demo.test.js.snap +++ b/components/alert/__tests__/__snapshots__/demo.test.js.snap @@ -23,14 +23,17 @@ exports[`renders ./antdv-demo/docs/alert/demo/basic.md correctly 1`] = ` exports[`renders ./antdv-demo/docs/alert/demo/closable.md correctly 1`] = `
- Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text
+ Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text +
- Error TextError Description Error Description Error Description Error Description Error Description Error Description
+ Error TextError Description Error Description Error Description Error Description Error Description Error Description + `; exports[`renders ./antdv-demo/docs/alert/demo/close-text.md correctly 1`] = `
- Info TextClose Now
+ Info TextClose Now + `; exports[`renders ./antdv-demo/docs/alert/demo/custom-icon.md correctly 1`] = ` @@ -96,7 +99,7 @@ exports[`renders ./antdv-demo/docs/alert/demo/icon.md correctly 1`] = `
Error
-
Success TipsDetailed description and advices about successful copywriting. +
Success TipsDetailed description and advices about successful copywriting.
Informational NotesAdditional description and informations about copywriting. @@ -112,7 +115,8 @@ exports[`renders ./antdv-demo/docs/alert/demo/icon.md correctly 1`] = ` exports[`renders ./antdv-demo/docs/alert/demo/smooth-closed.md correctly 1`] = `
- Alert Message Text
+ Alert Message Text +
`; exports[`renders ./antdv-demo/docs/alert/demo/style.md correctly 1`] = ` diff --git a/components/alert/index.tsx b/components/alert/index.tsx index ea209f039..c51b25135 100644 --- a/components/alert/index.tsx +++ b/components/alert/index.tsx @@ -8,7 +8,7 @@ import CheckCircleFilled from '@ant-design/icons-vue/CheckCircleFilled'; import ExclamationCircleFilled from '@ant-design/icons-vue/ExclamationCircleFilled'; import InfoCircleFilled from '@ant-design/icons-vue/InfoCircleFilled'; import CloseCircleFilled from '@ant-design/icons-vue/CloseCircleFilled'; -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import BaseMixin from '../_util/BaseMixin'; import PropTypes from '../_util/vue-types'; import getTransitionProps from '../_util/getTransitionProps'; diff --git a/components/anchor/Anchor.jsx b/components/anchor/Anchor.jsx index 9150d5f67..b8ca299aa 100644 --- a/components/anchor/Anchor.jsx +++ b/components/anchor/Anchor.jsx @@ -1,6 +1,6 @@ import { inject, provide } from 'vue'; import PropTypes from '../_util/vue-types'; -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import addEventListener from '../vc-util/Dom/addEventListener'; import Affix from '../affix'; import scrollTo from '../_util/scrollTo'; diff --git a/components/anchor/AnchorLink.jsx b/components/anchor/AnchorLink.jsx index 40579b217..cca32ff82 100644 --- a/components/anchor/AnchorLink.jsx +++ b/components/anchor/AnchorLink.jsx @@ -1,7 +1,7 @@ import { inject } from 'vue'; import PropTypes from '../_util/vue-types'; import { initDefaultProps, getComponent } from '../_util/props-util'; -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import { ConfigConsumerProps } from '../config-provider'; function noop() {} diff --git a/components/avatar/__tests__/__snapshots__/demo.test.js.snap b/components/avatar/__tests__/__snapshots__/demo.test.js.snap index 8bcb8b973..5d0fdd55e 100644 --- a/components/avatar/__tests__/__snapshots__/demo.test.js.snap +++ b/components/avatar/__tests__/__snapshots__/demo.test.js.snap @@ -3,7 +3,8 @@ exports[`renders ./antdv-demo/docs/avatar/demo/badge.md correctly 1`] = `

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

-
+ +
`; exports[`renders ./antdv-demo/docs/avatar/demo/basic.md correctly 1`] = ` @@ -15,7 +16,8 @@ exports[`renders ./antdv-demo/docs/avatar/demo/basic.md correctly 1`] = ` exports[`renders ./antdv-demo/docs/avatar/demo/dynamic.md correctly 1`] = `
U
+ 改 变 + `; exports[`renders ./antdv-demo/docs/avatar/demo/type.md correctly 1`] = `
UUSERU
`; diff --git a/components/back-top/__tests__/__snapshots__/demo.test.js.snap b/components/back-top/__tests__/__snapshots__/demo.test.js.snap index 30d58d134..31d2c6d54 100644 --- a/components/back-top/__tests__/__snapshots__/demo.test.js.snap +++ b/components/back-top/__tests__/__snapshots__/demo.test.js.snap @@ -2,10 +2,12 @@ exports[`renders ./antdv-demo/docs/back-top/demo/basic.md correctly 1`] = `
- Scroll down to see the bottom-right gray button.
+ Scroll down to see the bottom-right gray button. + `; exports[`renders ./antdv-demo/docs/back-top/demo/custom.md correctly 1`] = `
- Scroll down to see the bottom-right blue button.
+ Scroll down to see the bottom-right blue button. + `; diff --git a/components/back-top/index.jsx b/components/back-top/index.jsx index 0eb5e8f70..bb715156e 100644 --- a/components/back-top/index.jsx +++ b/components/back-top/index.jsx @@ -1,5 +1,5 @@ import { inject, Transition } from 'vue'; -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import PropTypes from '../_util/vue-types'; import backTopTypes from './backTopTypes'; import addEventListener from '../vc-util/Dom/addEventListener'; diff --git a/components/badge/Badge.jsx b/components/badge/Badge.jsx index 846e97d83..98368c2e1 100644 --- a/components/badge/Badge.jsx +++ b/components/badge/Badge.jsx @@ -1,7 +1,7 @@ import PropTypes from '../_util/vue-types'; import ScrollNumber from './ScrollNumber'; import { PresetColorTypes } from '../_util/colors'; -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import { initDefaultProps, getComponent, getSlot } from '../_util/props-util'; import { cloneElement } from '../_util/vnode'; import getTransitionProps from '../_util/getTransitionProps'; @@ -21,7 +21,7 @@ const BadgeProps = { scrollNumberPrefixCls: PropTypes.string, status: PropTypes.oneOf(['success', 'processing', 'default', 'error', 'warning']), color: PropTypes.string, - text: PropTypes.string, + text: PropTypes.any, offset: PropTypes.array, numberStyle: PropTypes.object.def(() => ({})), title: PropTypes.string, @@ -110,7 +110,7 @@ export default { }, renderStatusText(prefixCls) { - const { text } = this.$props; + const text = getComponent(this, 'text'); const hidden = this.isHidden(); return hidden || !text ? null : {text}; }, @@ -173,10 +173,10 @@ export default { prefixCls: customizePrefixCls, scrollNumberPrefixCls: customizeScrollNumberPrefixCls, status, - text, color, } = this; + const text = getComponent(this, 'text'); const getPrefixCls = this.configProvider.getPrefixCls; const prefixCls = getPrefixCls('badge', customizePrefixCls); const scrollNumberPrefixCls = getPrefixCls('scroll-number', customizeScrollNumberPrefixCls); diff --git a/components/badge/ScrollNumber.jsx b/components/badge/ScrollNumber.jsx index 69a01f7d8..f91f71d99 100644 --- a/components/badge/ScrollNumber.jsx +++ b/components/badge/ScrollNumber.jsx @@ -1,4 +1,4 @@ -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import PropTypes from '../_util/vue-types'; import BaseMixin from '../_util/BaseMixin'; import omit from 'omit.js'; diff --git a/components/badge/__tests__/__snapshots__/demo.test.js.snap b/components/badge/__tests__/__snapshots__/demo.test.js.snap index 19b0c9609..4aa8b83f1 100644 --- a/components/badge/__tests__/__snapshots__/demo.test.js.snap +++ b/components/badge/__tests__/__snapshots__/demo.test.js.snap @@ -11,11 +11,14 @@ exports[`renders ./antdv-demo/docs/badge/demo/change.md correctly 1`] = `

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

+ +
+ + `; exports[`renders ./antdv-demo/docs/badge/demo/colors.md correctly 1`] = ` @@ -43,12 +46,14 @@ exports[`renders ./antdv-demo/docs/badge/demo/dot.md correctly 1`] = ` + Link something + `; exports[`renders ./antdv-demo/docs/badge/demo/link.md correctly 1`] = `

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

-
+ + `; exports[`renders ./antdv-demo/docs/badge/demo/no-wrapper.md correctly 1`] = ` @@ -66,5 +71,6 @@ exports[`renders ./antdv-demo/docs/badge/demo/status.md correctly 1`] = `

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

-
+
+ `; diff --git a/components/badge/__tests__/__snapshots__/index.test.js.snap b/components/badge/__tests__/__snapshots__/index.test.js.snap index 2939e5279..0274af1fb 100644 --- a/components/badge/__tests__/__snapshots__/index.test.js.snap +++ b/components/badge/__tests__/__snapshots__/index.test.js.snap @@ -7,7 +7,8 @@ exports[`Badge badge should support float number 2`] = `-

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

-

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

-
+ + `; exports[`Badge should be compatible with borderColor style 1`] = ` @@ -44,3 +45,5 @@ exports[`Badge should support offset when count is a VueNode 1`] = ` head `; + +exports[`Badge text works with vnode 1`] = `hello`; diff --git a/components/badge/__tests__/index.test.js b/components/badge/__tests__/index.test.js index cf93f59d1..aa27ec16b 100644 --- a/components/badge/__tests__/index.test.js +++ b/components/badge/__tests__/index.test.js @@ -136,4 +136,14 @@ describe('Badge', () => { }); expect(wrapper.html()).toMatchSnapshot(); }); + + it('text works with vnode', () => { + const wrapper = mount({ + render() { + return hello} />; + }, + }); + + expect(wrapper.html()).toMatchSnapshot(); + }); }); diff --git a/components/button/__tests__/__snapshots__/demo.test.js.snap b/components/button/__tests__/__snapshots__/demo.test.js.snap index 59393b406..80f161eff 100644 --- a/components/button/__tests__/__snapshots__/demo.test.js.snap +++ b/components/button/__tests__/__snapshots__/demo.test.js.snap @@ -2,97 +2,147 @@ exports[`renders ./antdv-demo/docs/button/demo/basic.md correctly 1`] = ` + Primary + `; exports[`renders ./antdv-demo/docs/button/demo/block.md correctly 1`] = ` + Primary + `; exports[`renders ./antdv-demo/docs/button/demo/button-group.md correctly 1`] = `

Basic

+ Cancel +
+ L +
+ L +

With Icon

+ Go back +
`; exports[`renders ./antdv-demo/docs/button/demo/disabled.md correctly 1`] = `


+ Primary +


+ Ghost + `; exports[`renders ./antdv-demo/docs/button/demo/ghost.md correctly 1`] = `
+ Primary + `; exports[`renders ./antdv-demo/docs/button/demo/icon.md correctly 1`] = ` + A + `; exports[`renders ./antdv-demo/docs/button/demo/loading.md correctly 1`] = `

+ mouseenter me! +
`; exports[`renders ./antdv-demo/docs/button/demo/multiple.md correctly 1`] = ` + Primary + + Actions + `; exports[`renders ./antdv-demo/docs/button/demo/size.md correctly 1`] = `




+ Primary +

+ Backward + `; diff --git a/components/button/__tests__/__snapshots__/index.test.js.snap b/components/button/__tests__/__snapshots__/index.test.js.snap index 5dcebaebd..b45ab8461 100644 --- a/components/button/__tests__/__snapshots__/index.test.js.snap +++ b/components/button/__tests__/__snapshots__/index.test.js.snap @@ -2,32 +2,38 @@ exports[`Button fixbug renders {0} , 0 and {false} 1`] = ` + 0 + `; exports[`Button fixbug renders {0} , 0 and {false} 2`] = ` + 0 + `; exports[`Button fixbug renders {0} , 0 and {false} 3`] = ` + + `; exports[`Button renders Chinese characters correctly 1`] = ` + 按 钮 + `; exports[`Button renders Chinese characters correctly 2`] = ` + 按钮 + `; exports[`Button renders Chinese characters correctly 3`] = ` + 按 钮 + `; exports[`Button renders Chinese characters correctly 4`] = ``; @@ -36,20 +42,24 @@ exports[`Button renders Chinese characters correctly 5`] = ` + 按钮 + `; exports[`Button renders correctly 1`] = ` + Follow + `; exports[`Button should not render as link button when href is undefined 1`] = ` + button + `; exports[`Button should support link button 1`] = ` - link button + link button + `; diff --git a/components/calendar/__tests__/__snapshots__/demo.test.js.snap b/components/calendar/__tests__/__snapshots__/demo.test.js.snap index 90ce54e9f..3e1a066d4 100644 --- a/components/calendar/__tests__/__snapshots__/demo.test.js.snap +++ b/components/calendar/__tests__/__snapshots__/demo.test.js.snap @@ -1647,7 +1647,7 @@ exports[`renders ./antdv-demo/docs/calendar/demo/notice-calendar.md correctly 1` `; exports[`renders ./antdv-demo/docs/calendar/demo/select.md correctly 1`] = ` -
+
You selected date: 2017-01-25
diff --git a/components/calendar/index.jsx b/components/calendar/index.jsx index 5f0d23176..97a3ee6d0 100644 --- a/components/calendar/index.jsx +++ b/components/calendar/index.jsx @@ -2,7 +2,7 @@ import { inject } from 'vue'; import PropTypes from '../_util/vue-types'; import BaseMixin from '../_util/BaseMixin'; import { getOptionProps, hasProp, initDefaultProps } from '../_util/props-util'; -import * as moment from 'moment'; +import moment from 'moment'; import FullCalendar from '../vc-calendar/src/FullCalendar'; import Header from './Header'; import LocaleReceiver from '../locale-provider/LocaleReceiver'; diff --git a/components/card/Card.tsx b/components/card/Card.tsx index 578a730a7..c97775708 100644 --- a/components/card/Card.tsx +++ b/components/card/Card.tsx @@ -6,7 +6,7 @@ import PropTypes from '../_util/vue-types'; import { getComponent, getSlot, isEmptyElement } from '../_util/props-util'; import BaseMixin from '../_util/BaseMixin'; import { ConfigConsumerProps } from '../config-provider'; -import isPlainObject from 'lodash/isPlainObject'; +import isPlainObject from 'lodash-es/isPlainObject'; const { TabPane } = Tabs; export default { diff --git a/components/card/__tests__/__snapshots__/demo.test.js.snap b/components/card/__tests__/__snapshots__/demo.test.js.snap index 091e50dc8..5f421cae1 100644 --- a/components/card/__tests__/__snapshots__/demo.test.js.snap +++ b/components/card/__tests__/__snapshots__/demo.test.js.snap @@ -249,7 +249,8 @@ exports[`renders ./antdv-demo/docs/card/demo/loading.md correctly 1`] = `
+ Toggle loading + `; exports[`renders ./antdv-demo/docs/card/demo/meta.md correctly 1`] = ` diff --git a/components/card/__tests__/__snapshots__/index.test.js.snap b/components/card/__tests__/__snapshots__/index.test.js.snap index 96f5f3dd0..bf48381bf 100644 --- a/components/card/__tests__/__snapshots__/index.test.js.snap +++ b/components/card/__tests__/__snapshots__/index.test.js.snap @@ -58,7 +58,8 @@ exports[`Card title should be vertically aligned 1`] = `
Card title
+ Button +
diff --git a/components/carousel/__tests__/__snapshots__/demo.test.js.snap b/components/carousel/__tests__/__snapshots__/demo.test.js.snap index 8fb95d8a2..d2b9470a9 100644 --- a/components/carousel/__tests__/__snapshots__/demo.test.js.snap +++ b/components/carousel/__tests__/__snapshots__/demo.test.js.snap @@ -314,28 +314,28 @@ exports[`renders ./antdv-demo/docs/carousel/demo/fade.md correctly 1`] = `
-
+

1

- @@ -79,7 +80,8 @@ exports[`Drawer render correctly 1`] = `
-
+ +
Here is content of Drawer
@@ -97,7 +99,8 @@ exports[`Drawer render top drawer 1`] = `
-
+ +
Here is content of Drawer
diff --git a/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap b/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap index 98b9f7c03..684bf6b56 100644 --- a/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap +++ b/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap @@ -2,7 +2,8 @@ exports[`Drawer render correctly 1`] = `
+ open +
@@ -10,7 +11,8 @@ exports[`Drawer render correctly 1`] = `
-
+ +
Here is content of Drawer
diff --git a/components/drawer/__tests__/__snapshots__/demo.test.js.snap b/components/drawer/__tests__/__snapshots__/demo.test.js.snap index 3d2a80e10..172893f8c 100644 --- a/components/drawer/__tests__/__snapshots__/demo.test.js.snap +++ b/components/drawer/__tests__/__snapshots__/demo.test.js.snap @@ -2,31 +2,36 @@ exports[`renders ./antdv-demo/docs/drawer/demo/basic-right.md correctly 1`] = ` + Open + `; exports[`renders ./antdv-demo/docs/drawer/demo/form-in-drawer.md correctly 1`] = ` + New account + `; exports[`renders ./antdv-demo/docs/drawer/demo/multi-level-drawer.md correctly 1`] = ` + Open + `; exports[`renders ./antdv-demo/docs/drawer/demo/placement.md correctly 1`] = `
+ Open + `; exports[`renders ./antdv-demo/docs/drawer/demo/render-in-current.md correctly 1`] = `
Render in this
+ Open +
diff --git a/components/drawer/index.jsx b/components/drawer/index.jsx index 2584f95d8..77a37e6d0 100644 --- a/components/drawer/index.jsx +++ b/components/drawer/index.jsx @@ -1,5 +1,5 @@ import { inject, provide, nextTick } from 'vue'; -import classnames from 'classnames'; +import classnames from '../_util/classNames'; import omit from 'omit.js'; import VcDrawer from '../vc-drawer/src'; import PropTypes from '../_util/vue-types'; diff --git a/components/dropdown/__tests__/__snapshots__/demo.test.js.snap b/components/dropdown/__tests__/__snapshots__/demo.test.js.snap index 80740a861..ba658324f 100644 --- a/components/dropdown/__tests__/__snapshots__/demo.test.js.snap +++ b/components/dropdown/__tests__/__snapshots__/demo.test.js.snap @@ -9,19 +9,29 @@ exports[`renders ./antdv-demo/docs/dropdown/demo/context-menu.md correctly 1`] = exports[`renders ./antdv-demo/docs/dropdown/demo/dropdown-button.md correctly 1`] = `
+ Dropdown +
+ + +
+ Dropdown +
+ + +
+ Dropdown +
+ + +
+ Button + `; exports[`renders ./antdv-demo/docs/dropdown/demo/event.md correctly 1`] = ` Hover me, Click menu item `; @@ -33,21 +43,27 @@ exports[`renders ./antdv-demo/docs/dropdown/demo/overlay-visible.md correctly 1` exports[`renders ./antdv-demo/docs/dropdown/demo/placement.md correctly 1`] = `
+ bottomLeft + + bottomCenter +
+ bottomRight +
+ topLeft + + topCenter + + topRight +
`; diff --git a/components/dropdown/__tests__/__snapshots__/dropdown-button.test.js.snap b/components/dropdown/__tests__/__snapshots__/dropdown-button.test.js.snap index 72bef44de..0e137c47b 100644 --- a/components/dropdown/__tests__/__snapshots__/dropdown-button.test.js.snap +++ b/components/dropdown/__tests__/__snapshots__/dropdown-button.test.js.snap @@ -2,7 +2,10 @@ exports[`DropdownButton should support href like Button 1`] = `
- + +
+ + +
`; diff --git a/components/dropdown/dropdown-button.jsx b/components/dropdown/dropdown-button.jsx index 891e8cc43..086bd19e3 100644 --- a/components/dropdown/dropdown-button.jsx +++ b/components/dropdown/dropdown-button.jsx @@ -1,6 +1,6 @@ import { provide, inject } from 'vue'; import Button from '../button'; -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import buttonTypes from '../button/buttonTypes'; import { ButtonGroupProps } from '../button/button-group'; import Dropdown from './dropdown'; diff --git a/components/dropdown/dropdown.jsx b/components/dropdown/dropdown.jsx index 5a5bf205c..f573fefe2 100644 --- a/components/dropdown/dropdown.jsx +++ b/components/dropdown/dropdown.jsx @@ -3,7 +3,7 @@ import RcDropdown from '../vc-dropdown/src/index'; import DropdownButton from './dropdown-button'; import PropTypes from '../_util/vue-types'; import { cloneElement } from '../_util/vnode'; -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import { getOptionProps, getPropsData, diff --git a/components/empty/__tests__/__snapshots__/demo.test.js.snap b/components/empty/__tests__/__snapshots__/demo.test.js.snap index 354dd1c7b..8a01c712a 100644 --- a/components/empty/__tests__/__snapshots__/demo.test.js.snap +++ b/components/empty/__tests__/__snapshots__/demo.test.js.snap @@ -25,7 +25,8 @@ exports[`renders ./antdv-demo/docs/empty/demo/basic.md correctly 1`] = ` exports[`renders ./antdv-demo/docs/empty/demo/config-provider.md correctly 1`] = ` + default + @@ -52,7 +53,8 @@ exports[`renders ./antdv-demo/docs/empty/demo/config-provider.md correctly 1`] =
0 item
+ + 0 item
@@ -76,7 +78,8 @@ exports[`renders ./antdv-demo/docs/empty/demo/config-provider.md correctly 1`] =
0 item
+ + 0 item
@@ -186,7 +189,8 @@ exports[`renders ./antdv-demo/docs/empty/demo/customize.md correctly 1`] = `
empty

Customize Description

+ Create Now +
`; diff --git a/components/form/Form.jsx b/components/form/Form.jsx index e87526abd..eca955557 100755 --- a/components/form/Form.jsx +++ b/components/form/Form.jsx @@ -1,8 +1,8 @@ import { inject, provide } from 'vue'; import PropTypes from '../_util/vue-types'; -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import { ColProps } from '../grid/Col'; -import isRegExp from 'lodash/isRegExp'; +import isRegExp from 'lodash-es/isRegExp'; import warning from '../_util/warning'; import FormItem from './FormItem'; import { initDefaultProps, getSlot } from '../_util/props-util'; @@ -11,7 +11,7 @@ import { getNamePath, containsNamePath } from './utils/valueUtil'; import { defaultValidateMessages } from './utils/messages'; import { allPromiseFinish } from './utils/asyncUtil'; import { toArray } from './utils/typeUtil'; -import isEqual from 'lodash/isEqual'; +import isEqual from 'lodash-es/isEqual'; import scrollIntoView from 'scroll-into-view-if-needed'; export const FormProps = { @@ -191,7 +191,7 @@ const Form = { ); if (!this.model) { warning(false, 'Form', 'model is required for validateFields to work.'); - return; + return Promise.reject('Form `model` is required for validateFields to work.'); } const provideNameList = !!nameList; const namePathList = provideNameList ? toArray(nameList).map(getNamePath) : []; diff --git a/components/form/FormItem.jsx b/components/form/FormItem.jsx index e17e1cfe4..61241a6d1 100644 --- a/components/form/FormItem.jsx +++ b/components/form/FormItem.jsx @@ -1,7 +1,7 @@ import { inject, provide, Transition } from 'vue'; -import cloneDeep from 'lodash/cloneDeep'; +import cloneDeep from 'lodash-es/cloneDeep'; import PropTypes from '../_util/vue-types'; -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import getTransitionProps from '../_util/getTransitionProps'; import Row from '../grid/Row'; import Col, { ColProps } from '../grid/Col'; @@ -25,7 +25,7 @@ import { validateRules } from './utils/validateUtil'; import { getNamePath } from './utils/valueUtil'; import { toArray } from './utils/typeUtil'; import { warning } from '../vc-util/warning'; -import find from 'lodash/find'; +import find from 'lodash-es/find'; const iconMap = { success: CheckCircleFilled, diff --git a/components/form/__tests__/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap index 13a173f28..845ffd75d 100644 --- a/components/form/__tests__/__snapshots__/demo.test.js.snap +++ b/components/form/__tests__/__snapshots__/demo.test.js.snap @@ -74,7 +74,8 @@ exports[`renders ./antdv-demo/docs/form/demo/basic.md correctly 1`] = `
+ Cancel + @@ -119,7 +120,8 @@ exports[`renders ./antdv-demo/docs/form/demo/custom-validation.md correctly 1`]
+ Reset + @@ -143,7 +145,8 @@ exports[`renders ./antdv-demo/docs/form/demo/dynamic-form-item.md correctly 1`]
+ Reset + @@ -303,7 +306,8 @@ exports[`renders ./antdv-demo/docs/form/demo/validation.md correctly 1`] = `
+ Reset + diff --git a/components/input-number/__tests__/__snapshots__/demo.test.js.snap b/components/input-number/__tests__/__snapshots__/demo.test.js.snap index 8cd96351a..ed2c673a2 100644 --- a/components/input-number/__tests__/__snapshots__/demo.test.js.snap +++ b/components/input-number/__tests__/__snapshots__/demo.test.js.snap @@ -23,7 +23,8 @@ exports[`renders ./antdv-demo/docs/input-number/demo/disabled.md correctly 1`] =
+ Toggle disabled +
`; diff --git a/components/input-number/index.jsx b/components/input-number/index.jsx index 6b82355d1..c1730db9c 100644 --- a/components/input-number/index.jsx +++ b/components/input-number/index.jsx @@ -1,7 +1,7 @@ import { inject } from 'vue'; import PropTypes from '../_util/vue-types'; import { initDefaultProps, getOptionProps } from '../_util/props-util'; -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import UpOutlined from '@ant-design/icons-vue/UpOutlined'; import DownOutlined from '@ant-design/icons-vue/DownOutlined'; import VcInputNumber from '../vc-input-number/src'; diff --git a/components/input/ClearableLabeledInput.jsx b/components/input/ClearableLabeledInput.jsx index 62f3538ee..bbeb170ef 100644 --- a/components/input/ClearableLabeledInput.jsx +++ b/components/input/ClearableLabeledInput.jsx @@ -1,4 +1,4 @@ -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import CloseCircleFilled from '@ant-design/icons-vue/CloseCircleFilled'; import { getInputClassName } from './Input'; import PropTypes from '../_util/vue-types'; diff --git a/components/input/Input.jsx b/components/input/Input.jsx index a90ede41e..1dc080a69 100644 --- a/components/input/Input.jsx +++ b/components/input/Input.jsx @@ -1,5 +1,5 @@ import { inject } from 'vue'; -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import omit from 'omit.js'; import inputProps from './inputProps'; import { hasProp, getComponent, getOptionProps } from '../_util/props-util'; diff --git a/components/input/Password.jsx b/components/input/Password.jsx index 99ce991d6..1473d58b9 100644 --- a/components/input/Password.jsx +++ b/components/input/Password.jsx @@ -1,4 +1,4 @@ -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import { getComponent, getOptionProps } from '../_util/props-util'; import Input from './Input'; import EyeOutlined from '@ant-design/icons-vue/EyeOutlined'; diff --git a/components/input/ResizableTextArea.jsx b/components/input/ResizableTextArea.jsx index 9910f6606..369d603d3 100644 --- a/components/input/ResizableTextArea.jsx +++ b/components/input/ResizableTextArea.jsx @@ -1,6 +1,6 @@ import ResizeObserver from '../vc-resize-observer'; import omit from 'omit.js'; -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import calculateNodeHeight from './calculateNodeHeight'; import raf from '../_util/raf'; import warning from '../_util/warning'; diff --git a/components/input/Search.jsx b/components/input/Search.jsx index 03adc0338..efac9c7ad 100644 --- a/components/input/Search.jsx +++ b/components/input/Search.jsx @@ -1,5 +1,5 @@ import { inject } from 'vue'; -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import { isMobile } from 'is-mobile'; import Input from './Input'; import LoadingOutlined from '@ant-design/icons-vue/LoadingOutlined'; @@ -10,7 +10,7 @@ import { cloneElement } from '../_util/vnode'; import PropTypes from '../_util/vue-types'; import { getOptionProps, getComponent } from '../_util/props-util'; import { ConfigConsumerProps } from '../config-provider'; -import isPlainObject from 'lodash/isPlainObject'; +import isPlainObject from 'lodash-es/isPlainObject'; export default { name: 'AInputSearch', diff --git a/components/input/__tests__/__snapshots__/demo.test.js.snap b/components/input/__tests__/__snapshots__/demo.test.js.snap index cc931299a..1ab6fe444 100644 --- a/components/input/__tests__/__snapshots__/demo.test.js.snap +++ b/components/input/__tests__/__snapshots__/demo.test.js.snap @@ -64,7 +64,8 @@ exports[`renders ./antdv-demo/docs/input/demo/search-input.md correctly 1`] = `< exports[`renders ./antdv-demo/docs/input/demo/search-input-loading.md correctly 1`] = `


-
+ +
`; exports[`renders ./antdv-demo/docs/input/demo/size.md correctly 1`] = `
`; @@ -73,7 +74,8 @@ exports[`renders ./antdv-demo/docs/input/demo/textarea.md correctly 1`] = `
+ Auto Resize: false +
`; exports[`renders ./antdv-demo/docs/input/demo/tooltip.md correctly 1`] = ``; diff --git a/components/layout/Sider.jsx b/components/layout/Sider.jsx index 42c179fe1..602c1efd4 100644 --- a/components/layout/Sider.jsx +++ b/components/layout/Sider.jsx @@ -1,4 +1,4 @@ -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import { inject, provide } from 'vue'; import PropTypes from '../_util/vue-types'; import { @@ -16,20 +16,6 @@ import RightOutlined from '@ant-design/icons-vue/RightOutlined'; import LeftOutlined from '@ant-design/icons-vue/LeftOutlined'; import omit from 'omit.js'; -// matchMedia polyfill for -// https://github.com/WickyNilliams/enquire.js/issues/82 -if (typeof window !== 'undefined') { - const matchMediaPolyfill = mediaQuery => { - return { - media: mediaQuery, - matches: false, - addListener() {}, - removeListener() {}, - }; - }; - window.matchMedia = window.matchMedia || matchMediaPolyfill; -} - const dimensionMaxMap = { xs: '479.98px', sm: '575.98px', diff --git a/components/layout/__tests__/__snapshots__/demo.test.js.snap b/components/layout/__tests__/__snapshots__/demo.test.js.snap index ea7ca60c5..4ad41417c 100644 --- a/components/layout/__tests__/__snapshots__/demo.test.js.snap +++ b/components/layout/__tests__/__snapshots__/demo.test.js.snap @@ -356,7 +356,7 @@ exports[`renders ./antdv-demo/docs/layout/demo/top-side.md correctly 1`] = `
+ loading more +
`; diff --git a/components/list/index.jsx b/components/list/index.jsx index 8854953f2..474089fc2 100644 --- a/components/list/index.jsx +++ b/components/list/index.jsx @@ -1,5 +1,5 @@ import PropTypes from '../_util/vue-types'; -import classNames from 'classnames'; +import classNames from '../_util/classNames'; import omit from 'omit.js'; import { ConfigConsumerProps } from '../config-provider'; diff --git a/components/locale-provider/__tests__/__snapshots__/demo.test.js.snap b/components/locale-provider/__tests__/__snapshots__/demo.test.js.snap index d7dd39d91..e56804d25 100644 --- a/components/locale-provider/__tests__/__snapshots__/demo.test.js.snap +++ b/components/locale-provider/__tests__/__snapshots__/demo.test.js.snap @@ -52,15 +52,20 @@ exports[`renders ./antdv-demo/docs/locale-provider/demo/all.md correctly 1`] = `
- Click to confirm
+ Show Modal + + Click to confirm +
0 item
+ + 0 item