Skip to content

refactor: Anchor、Alert、Avatar、Badge、BackTop、Col、Form、Layout、Menu、Space、Spin、Switch、Row、Result、Rate #4171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 68 commits into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
44cd93e
chore: remove resize-observer-polyfill
tangjinzhou Apr 17, 2021
7315bfd
Merge remote-tracking branch 'origin/next' into v3
tangjinzhou May 10, 2021
184957e
refactor: align
tangjinzhou May 10, 2021
4d178de
refactor(v3/avatar): refactor using composition api (#4052)
John60676 May 10, 2021
7a2f28a
fix: avatar src scale not update
tangjinzhou May 10, 2021
11ffa8d
refactor: resizeObserver
tangjinzhou May 10, 2021
170a169
refactor: divider
tangjinzhou May 11, 2021
dbbd07d
refactor: localeProvider
tangjinzhou May 11, 2021
5bcca46
refactor(v3/back-top): use composition api (#4060)
sendya May 11, 2021
b96fc44
refactor: backtop
tangjinzhou May 11, 2021
3a13ef2
refactor: empty
tangjinzhou May 11, 2021
8f02b6d
refactor: transButton
tangjinzhou May 11, 2021
49ad768
Merge remote-tracking branch 'origin/next' into v3
tangjinzhou May 12, 2021
0984951
feat(v3/avatar): add avatar group (#4062)
John60676 May 12, 2021
4a5c4cd
refactor: avatar
tangjinzhou May 12, 2021
7acf577
refactor: avatar
tangjinzhou May 13, 2021
ea8ff66
style: rename useProvide
tangjinzhou May 13, 2021
67952ab
refactor: menu (#4110)
tangjinzhou May 23, 2021
7b494fd
fix: menu
tangjinzhou May 23, 2021
8179361
refactor: menu
tangjinzhou May 24, 2021
3d0edbc
refactor: remove rc-menu
tangjinzhou May 24, 2021
0c9951a
fix: menu rtl error
tangjinzhou May 24, 2021
1139aa5
style: lint
tangjinzhou May 24, 2021
1877d66
refactor(Anchor): use composition api (#4054)
sendya May 24, 2021
fbe3a48
refactor: anchor
tangjinzhou May 24, 2021
a6e30c2
refactor: anchor
tangjinzhou May 24, 2021
de4693c
refactor: anchor
tangjinzhou May 24, 2021
44ccaa1
feat: update
tangjinzhou May 25, 2021
69b9f80
fix: icon class lose
tangjinzhou May 25, 2021
372ac5c
refactor(v3/badge): use composition api (#4076)
sendya May 25, 2021
e442b0d
refactor: badge
tangjinzhou May 25, 2021
a01be5c
fix: badge inheritAttrs
tangjinzhou May 25, 2021
fe99051
refactor: grid
tangjinzhou May 25, 2021
3825c65
refactor: layout
tangjinzhou May 26, 2021
a049a66
fix: menu not close
tangjinzhou May 26, 2021
42916f5
refactor: space
tangjinzhou May 26, 2021
3b89f59
refactor: result
tangjinzhou May 26, 2021
e9854da
refactor: affix
tangjinzhou May 26, 2021
5ee3d30
refactor: comment
tangjinzhou May 26, 2021
2089961
refactor: form
tangjinzhou May 26, 2021
b53a91c
feat: spin add rtl
tangjinzhou May 26, 2021
ad2b447
feat: export spin type
tangjinzhou May 26, 2021
d2a1c42
refactor: pageHeader
tangjinzhou May 26, 2021
5096ee4
refactor: page-header
tangjinzhou May 27, 2021
c889882
refactor: skeleton
tangjinzhou May 28, 2021
b68bb81
refactor: typography
tangjinzhou May 28, 2021
2b78d2d
refactor(v3/rate): use composition api
sendya May 28, 2021
7ec594c
fix: add useRef hook
sendya May 28, 2021
c2bba2e
refactor: form
tangjinzhou May 28, 2021
0a2940e
fix: menu not update
tangjinzhou May 28, 2021
3d2a04d
refactor: form
tangjinzhou May 30, 2021
7214710
refactor: form
tangjinzhou May 31, 2021
f9ccbfd
fix: slide animate not work
tangjinzhou May 31, 2021
b8c52b3
fix: menu mode error
tangjinzhou May 31, 2021
6b2af5c
fix: menu icon
tangjinzhou May 31, 2021
3186b92
Merge branch 'refactor/v3/rate' of git://github.com/sendya/ant-design…
tangjinzhou Jun 1, 2021
836ae6d
Merge branch 'sendya-refactor/v3/rate' into v3
tangjinzhou Jun 1, 2021
bc85604
refactor: rate
tangjinzhou Jun 2, 2021
a58cb3c
perf: remove rate
tangjinzhou Jun 2, 2021
08a5ff3
feat: add vc-overflow
tangjinzhou Jun 2, 2021
1281e4a
refactor: menu
tangjinzhou Jun 7, 2021
2b0afda
fix: remove flex check (#4165)
zkwolf Jun 7, 2021
0d02391
Merge remote-tracking branch 'origin/next' into v3
tangjinzhou Jun 7, 2021
62ca3a9
fix: dist locale file lose #3684
tangjinzhou Jun 7, 2021
2cfc6cc
release 2.2.0-beta.1
tangjinzhou Jun 7, 2021
5cc10c6
dcos: update changelog
tangjinzhou Jun 7, 2021
dde7719
chore: update type
tangjinzhou Jun 7, 2021
772ac3c
docs: update changelog
tangjinzhou Jun 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,37 @@

---

## 2.2.0-beta.1

`2021-06-17`

- 🔥🔥🔥 Virtual Table independent library released https://www.npmjs.com/package/@surely-vue/table, this component is an independent library, the document example is not yet complete, it is a completely ts-developed component , There are good type hints, there are API documents on npm, those who are in a hurry can explore and use it, here is an online experience example, https://store.antdv.com/pro/preview/list/big- table-list
- 🔥🔥🔥 Refactored a large number of components, the source code is more readable, the performance is better, and the ts type is more comprehensive -Refactored components in this version Anchor, Alert, Avatar, Badge, BackTop, Col, Form, Layout, Menu, Space, Spin, Switch, Row, Result, Rate
- 🎉 Menu

- Better performance [#3300](https://github.com/vueComponent/ant-design-vue/issues/3300)
- Fix the problem of incorrect highlighting [#4053](https://github.com/vueComponent/ant-design-vue/issues/4053)
- Fix console invalid warning [#4169](https://github.com/vueComponent/ant-design-vue/issues/4169)
- Easier to use, simpler to use single file recursion [#4133](https://github.com/vueComponent/ant-design-vue/issues/4133)
- 💄 icon icon needs to be passed through slot

- Skeleton

- 🌟 Support Skeleton.Avatar placeholder component.
- 🌟 Support Skeleton.Button placeholder component.
- 🌟 Support Skeleton.Input placeholder component.

- 💄 Destructive update

- The `a-menu-item` and `a-sub-menu` icons need to be passed through the slot, and the icon is not automatically obtained through the sub-node
- row gutter supports row-wrap, no need to use multiple rows to divide col
- `Menu` removes `defaultOpenKeys` and `defaultSelectedKeys`; `Switch` removes `defaultChecked`; `Rate` removes `defaultValue`; Please be cautious to use the defaultXxx-named attributes of other unrefactored components, and they will be removed in future versions.

- 🌟 Added Avatar.Group component
- 🐞 Fix AutoComplete filterOptions not taking effect [#4170](https://github.com/vueComponent/ant-design-vue/issues/4170)
- 🐞 Fix Select automatic width invalidation problem [#4118](https://github.com/vueComponent/ant-design-vue/issues/4118)
- 🐞 Fix the lack of internationalized files in dist [#3684](https://github.com/vueComponent/ant-design-vue/issues/3684)

## 2.1.6

`2021-05-13`
Expand Down
32 changes: 32 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,38 @@

---

## 2.2.0-beta.1

`2021-06-17`

- 🔥🔥🔥 虚拟 Table 独立库发布 https://www.npmjs.com/package/@surely-vue/table , 该组件是一个独立的库,目前文档示例尚未完善,他是一个完全 ts 开发的组件,有较好的类型提示,npm 上已有 API 文档,着急使用的的可以摸索着用起来了,这里有个在线体验示例,https://store.antdv.com/pro/preview/list/big-table-list
- 🔥🔥🔥 重构大量组件,源码更加易读,性能更优,ts 类型更加全面
- 本版本重构组件 Anchor、Alert、Avatar、Badge、BackTop、Col、Form、Layout、Menu、Space、Spin、Switch、Row、Result、Rate
- 🎉 Menu

- 性能更优 [#3300](https://github.com/vueComponent/ant-design-vue/issues/3300)
- 修复高亮不正确问题 [#4053](https://github.com/vueComponent/ant-design-vue/issues/4053)
- 修复控制台无效 warning [#4169](https://github.com/vueComponent/ant-design-vue/issues/4169)
- 更加易用,更加简单的使用单文件递归 [#4133](https://github.com/vueComponent/ant-design-vue/issues/4133)
- 💄 图标 icon 需要通过 slot 传递

- Skeleton

- 🌟 支持 Skeleton.Avatar 占位组件。
- 🌟 支持 Skeleton.Button 占位组件。
- 🌟 支持 Skeleton.Input 占位组件。

- 💄 破坏性更新

- `a-menu-item`、`a-sub-menu` 图标需要通过 slot 传递,不在通过子节点自动获取图标
- row gutter 支持 row-wrap, 无需使用多个 row 划分 col
- Menu 移除 defaultOpenKeys、defaultSelectedKeys; Switch 移除 defaultChecked; Rate 移除 defaultValue; 其它未重构组件的 defaultXxx 命名的属性请谨慎使用,在未来的版本中也会被移除。

- 🌟 新增 Avatar.Group 组件
- 🐞 修复 AutoComplete filterOptions 不生效问题 [#4170](https://github.com/vueComponent/ant-design-vue/issues/4170)
- 🐞 修复 Select 自动宽度失效问题 [#4118](https://github.com/vueComponent/ant-design-vue/issues/4118)
- 🐞 修复 dist 缺少国际化文件问题 [#3684](https://github.com/vueComponent/ant-design-vue/issues/3684)

## 2.1.6

`2021-05-13`
Expand Down
2 changes: 1 addition & 1 deletion antd-tools/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ gulp.task(

function publish(tagString, done) {
let args = ['publish', '--with-antd-tools'];
args = args.concat(['--tag', 'next']);
// args = args.concat(['--tag', 'next']);
if (tagString) {
args = args.concat(['--tag', tagString]);
}
Expand Down
5 changes: 5 additions & 0 deletions components/_util/canUseDom.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function canUseDom() {
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
}

export default canUseDom;
17 changes: 0 additions & 17 deletions components/_util/getScroll.js

This file was deleted.

27 changes: 27 additions & 0 deletions components/_util/getScroll.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export function isWindow(obj: any) {
return obj !== null && obj !== undefined && obj === obj.window;
}

export default function getScroll(
target: HTMLElement | Window | Document | null,
top: boolean,
): number {
if (typeof window === 'undefined') {
return 0;
}
const method = top ? 'scrollTop' : 'scrollLeft';
let result = 0;
if (isWindow(target)) {
result = (target as Window)[top ? 'pageYOffset' : 'pageXOffset'];
} else if (target instanceof Document) {
result = target.documentElement[method];
} else if (target) {
result = (target as HTMLElement)[method];
}
if (target && !isWindow(target) && typeof result !== 'number') {
result = ((target as HTMLElement).ownerDocument || (target as Document)).documentElement?.[
method
];
}
return result;
}
21 changes: 21 additions & 0 deletions components/_util/hooks/useBreakpoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { onMounted, onUnmounted, Ref, ref } from 'vue';
import ResponsiveObserve, { ScreenMap } from '../../_util/responsiveObserve';

function useBreakpoint(): Ref<ScreenMap> {
const screens = ref<ScreenMap>({});
let token = null;

onMounted(() => {
token = ResponsiveObserve.subscribe(supportScreens => {
screens.value = supportScreens;
});
});

onUnmounted(() => {
ResponsiveObserve.unsubscribe(token);
});

return screens;
}

export default useBreakpoint;
48 changes: 43 additions & 5 deletions components/_util/hooks/useConfigInject.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,46 @@
import { computed, inject } from 'vue';
import { defaultConfigProvider } from '../../config-provider';
import { RequiredMark } from '../../form/Form';
import { computed, ComputedRef, inject, UnwrapRef } from 'vue';
import {
ConfigProviderProps,
defaultConfigProvider,
Direction,
SizeType,
} from '../../config-provider';

export default (name: string, props: Record<any, any>) => {
const configProvider = inject('configProvider', defaultConfigProvider);
export default (
name: string,
props: Record<any, any>,
): {
configProvider: UnwrapRef<ConfigProviderProps>;
prefixCls: ComputedRef<string>;
direction: ComputedRef<Direction>;
size: ComputedRef<SizeType>;
getTargetContainer: ComputedRef<() => HTMLElement>;
space: ComputedRef<{ size: SizeType | number }>;
pageHeader: ComputedRef<{ ghost: boolean }>;
form?: ComputedRef<{
requiredMark?: RequiredMark;
}>;
} => {
const configProvider = inject<UnwrapRef<ConfigProviderProps>>(
'configProvider',
defaultConfigProvider,
);
const prefixCls = computed(() => configProvider.getPrefixCls(name, props.prefixCls));
return { configProvider, prefixCls };
const direction = computed(() => configProvider.direction);
const space = computed(() => configProvider.space);
const pageHeader = computed(() => configProvider.pageHeader);
const form = computed(() => configProvider.form);
const size = computed(() => props.size || configProvider.componentSize);
const getTargetContainer = computed(() => props.getTargetContainer);
return {
configProvider,
prefixCls,
direction,
size,
getTargetContainer,
space,
pageHeader,
form,
};
};
11 changes: 11 additions & 0 deletions components/_util/hooks/useFlexGapSupport.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { onMounted, ref } from 'vue';
import { detectFlexGapSupported } from '../styleChecker';

export default () => {
const flexible = ref(false);
onMounted(() => {
flexible.value = detectFlexGapSupported();
});

return flexible;
};
8 changes: 8 additions & 0 deletions components/_util/hooks/usePrefixCls.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { computed, ComputedRef, inject } from 'vue';
import { defaultConfigProvider } from '../../config-provider';

export default (name: string, props: Record<any, any>): ComputedRef<string> => {
const configProvider = inject('configProvider', defaultConfigProvider);
const prefixCls = computed(() => configProvider.getPrefixCls(name, props.prefixCls));
return prefixCls;
};
14 changes: 14 additions & 0 deletions components/_util/hooks/useRef.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { onBeforeUpdate, ref, Ref } from 'vue';

export type UseRef = [(el: any, key: string | number) => void, Ref<any>];

export const useRef = (): UseRef => {
const refs = ref<any>({});
const setRef = (el: any, key: string | number) => {
refs.value[key] = el;
};
onBeforeUpdate(() => {
refs.value = {};
});
return [setRef, refs];
};
28 changes: 28 additions & 0 deletions components/_util/hooks/useSize.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { computed, ComputedRef, inject, provide, UnwrapRef } from 'vue';
import { ConfigProviderProps, defaultConfigProvider, SizeType } from '../../config-provider';

const sizeProvider = Symbol('SizeProvider');

const useProvideSize = <T = SizeType>(props: Record<any, any>): ComputedRef<T> => {
const configProvider = inject<UnwrapRef<ConfigProviderProps>>(
'configProvider',
defaultConfigProvider,
);
const size = computed<T>(() => props.size || configProvider.componentSize);
provide(sizeProvider, size);
return size;
};

const useInjectSize = <T = SizeType>(props?: Record<any, any>): ComputedRef<T> => {
const size: ComputedRef<T> = props
? computed(() => props.size)
: inject(
sizeProvider,
computed(() => ('default' as unknown) as T),
);
return size;
};

export { useInjectSize, sizeProvider, useProvideSize };

export default useProvideSize;
File renamed without changes.
4 changes: 2 additions & 2 deletions components/_util/props-util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const getSlotOptions = () => {
throw Error('使用 .type 直接取值');
};
const findDOMNode = instance => {
let node = instance && (instance.$el || instance);
let node = instance?.vnode?.el || (instance && (instance.$el || instance));
while (node && !node.tagName) {
node = node.nextSibling;
}
Expand Down Expand Up @@ -394,7 +394,7 @@ function isValidElement(element) {
}

function getPropsSlot(slots, props, prop = 'default') {
return slots[prop]?.() ?? props[prop];
return props[prop] ?? slots[prop]?.();
}

export {
Expand Down
7 changes: 4 additions & 3 deletions components/_util/responsiveObserve.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
export type BreakpointMap = Partial<Record<Breakpoint, string>>;
export type BreakpointMap = Record<Breakpoint, string>;
export type ScreenMap = Partial<Record<Breakpoint, boolean>>;
export type ScreenSizeMap = Partial<Record<Breakpoint, number>>;

export const responsiveArray: Breakpoint[] = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];

Expand Down Expand Up @@ -43,15 +44,15 @@ const responsiveObserve = {
},
unregister() {
Object.keys(responsiveMap).forEach((screen: string) => {
const matchMediaQuery = responsiveMap[screen]!;
const matchMediaQuery = responsiveMap[screen];
const handler = this.matchHandlers[matchMediaQuery];
handler?.mql.removeListener(handler?.listener);
});
subscribers.clear();
},
register() {
Object.keys(responsiveMap).forEach((screen: string) => {
const matchMediaQuery = responsiveMap[screen]!;
const matchMediaQuery = responsiveMap[screen];
const listener = ({ matches }: { matches: boolean }) => {
this.dispatch({
...screens,
Expand Down
16 changes: 9 additions & 7 deletions components/_util/scrollTo.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import getScroll from './getScroll';
import raf from './raf';
import getScroll, { isWindow } from './getScroll';
import { easeInOutCubic } from './easings';

interface ScrollToOptions {
/** Scroll container, default as window */
getContainer?: () => HTMLElement | Window;
getContainer?: () => HTMLElement | Window | Document;
/** Scroll end callback */
callback?: () => any;
/** Animation duration, default as 450 */
Expand All @@ -12,7 +13,6 @@ interface ScrollToOptions {

export default function scrollTo(y: number, options: ScrollToOptions = {}) {
const { getContainer = () => window, callback, duration = 450 } = options;

const container = getContainer();
const scrollTop = getScroll(container, true);
const startTime = Date.now();
Expand All @@ -21,16 +21,18 @@ export default function scrollTo(y: number, options: ScrollToOptions = {}) {
const timestamp = Date.now();
const time = timestamp - startTime;
const nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);
if (container === window) {
window.scrollTo(window.pageXOffset, nextScrollTop);
if (isWindow(container)) {
(container as Window).scrollTo(window.pageXOffset, nextScrollTop);
} else if (container instanceof HTMLDocument || container.constructor.name === 'HTMLDocument') {
(container as HTMLDocument).documentElement.scrollTop = nextScrollTop;
} else {
(container as HTMLElement).scrollTop = nextScrollTop;
}
if (time < duration) {
requestAnimationFrame(frameFunc);
raf(frameFunc);
} else if (typeof callback === 'function') {
callback();
}
};
requestAnimationFrame(frameFunc);
raf(frameFunc);
}
Loading