Skip to content

Refactor date #4522

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 70 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
1f7c1ef
feat: picker
tangjinzhou Jun 8, 2021
a020c2f
refactor: date
tangjinzhou Jun 15, 2021
a8113d7
refactor: date
tangjinzhou Jun 15, 2021
a501b59
Merge branch 'refactor-date' of github.com:vueComponent/ant-design-vu…
tangjinzhou Jul 19, 2021
16fc2a1
Merge branch 'refactor-date' of github.com:vueComponent/ant-design-vu…
tangjinzhou Jul 19, 2021
53f3c6e
refactor: date
tangjinzhou Jul 20, 2021
571369b
refactor: date
tangjinzhou Jul 20, 2021
8b7197d
refactor: date
tangjinzhou Jul 20, 2021
7058323
feat: add new date picker
tangjinzhou Jul 20, 2021
a9c5940
style: eslint format
tangjinzhou Jul 20, 2021
56620fe
refactor: date-picker
tangjinzhou Jul 21, 2021
4a21e41
refactor: date
tangjinzhou Jul 21, 2021
e1277cd
refactor: date
tangjinzhou Jul 21, 2021
59085a1
refactor: date
tangjinzhou Jul 21, 2021
229f642
refactor: picker
tangjinzhou Jul 21, 2021
cd04ba2
refactor: date props
tangjinzhou Jul 21, 2021
55f0d33
fix: date-picker props
tangjinzhou Aug 3, 2021
d5312db
fix: date-picker
tangjinzhou Aug 3, 2021
0dcae5b
fix: focus methods not work
tangjinzhou Aug 3, 2021
d8c8bc4
feat: support valueFormat
tangjinzhou Aug 3, 2021
6261cc0
fix: use dayjs
tangjinzhou Aug 3, 2021
e9404f1
fix: showtime error
tangjinzhou Aug 4, 2021
9356686
refactor: time-picker
tangjinzhou Aug 4, 2021
ff49f57
refactor: time-picker
tangjinzhou Aug 4, 2021
11b7185
refactor: time-picker
tangjinzhou Aug 5, 2021
5ae9597
feat: time-picker custom clearIcon
tangjinzhou Aug 5, 2021
7b7ccc3
Merge branch 'next' into refactor-date
tangjinzhou Aug 8, 2021
1bb5830
refactor: calendar
tangjinzhou Aug 8, 2021
e4a6063
refactor: calendar
tangjinzhou Aug 9, 2021
c69495a
refactor: calendar
tangjinzhou Aug 9, 2021
95acde2
refactor: calendar
tangjinzhou Aug 9, 2021
16f0d49
refactor: calendar
tangjinzhou Aug 9, 2021
75f7f3f
refactor: calendar
tangjinzhou Aug 9, 2021
7cdc73b
refactor: remove no use pkg
tangjinzhou Aug 9, 2021
4639a0c
feat: update locale
tangjinzhou Aug 9, 2021
c0ae4a6
style: type
tangjinzhou Aug 9, 2021
f4140b9
chore: use dayjs
tangjinzhou Aug 9, 2021
99ac478
perf: ts type perf
tangjinzhou Aug 9, 2021
8b8a825
chore: tsconfig
tangjinzhou Aug 9, 2021
553554d
Merge remote-tracking branch 'origin/v2.3' into refactor-date
tangjinzhou Aug 9, 2021
02b934c
chore: update webpack
tangjinzhou Aug 9, 2021
278a69e
style: type
tangjinzhou Aug 10, 2021
6f3fca4
feat: support [email protected]
tangjinzhou Aug 10, 2021
f5849fa
test: update snap
tangjinzhou Aug 10, 2021
08c3c9c
fix: symbol error
tangjinzhou Aug 10, 2021
0cd3db0
fix: auto hide table scrollbar #4484
tangjinzhou Aug 10, 2021
3be5a42
release 2.2.4
tangjinzhou Aug 10, 2021
1da679d
release 2.2.4
tangjinzhou Aug 10, 2021
07f6d9e
docs: udapte changelog
tangjinzhou Aug 10, 2021
68c1f45
feat: select support custom option by option slot
tangjinzhou Aug 11, 2021
01718e3
fix: transition remove appearFromClass #4409
tangjinzhou Aug 11, 2021
ccb2401
fix: select not scrollTo active position
tangjinzhou Aug 11, 2021
665e591
release 2.2.5
tangjinzhou Aug 11, 2021
70f9b02
Merge remote-tracking branch 'origin/next' into refactor-date
tangjinzhou Aug 11, 2021
eda5362
fix: date-pick type error (#4499)
Amour1688 Aug 12, 2021
f32cbaf
perf: portal
tangjinzhou Aug 12, 2021
deca154
perf: update align
tangjinzhou Aug 12, 2021
c153d56
Merge branch 'refactor-date' of github.com:vueComponent/ant-design-vu…
tangjinzhou Aug 12, 2021
4e14656
fix: table expanded icon render error #4507
tangjinzhou Aug 12, 2021
8187d3a
fix: rate slot character not work #4509
tangjinzhou Aug 12, 2021
9f15fe9
fix: add resize-observer-polyfill #4508
tangjinzhou Aug 12, 2021
d0f03ca
fix(modal): allow Prop `getContainer` to be type of string & boolean …
CarterLi Aug 12, 2021
6479864
release 2.2.6
tangjinzhou Aug 12, 2021
aa4e8de
refactor: trigger
tangjinzhou Aug 13, 2021
62e5a1a
refactor: trigger
tangjinzhou Aug 14, 2021
448e912
refactor: trigger
tangjinzhou Aug 14, 2021
44acf61
perf: portal
tangjinzhou Aug 15, 2021
f623c3f
perf: trigger
tangjinzhou Aug 15, 2021
64f07a0
Merge branch 'refactor-trigger' into refactor-date
tangjinzhou Aug 15, 2021
fc487c6
perf: trigger
tangjinzhou Aug 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ site/dev.js

# IDE 语法提示临时文件
vetur/

report.html
24 changes: 24 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,30 @@

---

## 2.2.6

`2021-08-12`

- 🐞 Fix `Table` expanded list rendering problem [#4507](https://github.com/vueComponent/ant-design-vue/issues/4507)
- 🐞 Fix `Rate` custom `character` slot not taking effect [#4509](https://github.com/vueComponent/ant-design-vue/issues/4509)
- 🐞 Add resize-observer-polyfill to fix the problem of reporting errors in low versions of Chrome [#4508](https://github.com/vueComponent/ant-design-vue/issues/4508)

## 2.2.5

`2021-08-11`

- 🌟 `Select` supports customizing nodes through option slots [68c1f4](https://github.com/vueComponent/ant-design-vue/commit/68c1f4550108a3a6bbe4f1b2c5c168523fd6c84a)
- 🐞 Fix the problem that the pop-up window component in the development environment does not display in the lower version of chrome, and avoid the pop-up window flashing [#4409](https://github.com/vueComponent/ant-design-vue/issues/4409)
- 🐞 Fix the problem of not scrolling to the active position when `Select` is opened [ccb240](https://github.com/vueComponent/ant-design-vue/commit/ccb24016c07632f49550646c971060c402586c67)

## 2.2.4

`2021-08-10`

- 🌟 Support [email protected] [#4490](https://github.com/vueComponent/ant-design-vue/issues/4490)
- 🌟 Automatically hide the horizontal scroll bar of `Table` [#4484](https://github.com/vueComponent/ant-design-vue/issues/4484)
- 🐞 Fix the issue of `Progress` trailColor not taking effect [#4483](https://github.com/vueComponent/ant-design-vue/issues/4483)

## 2.2.3

`2021-08-07`
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,30 @@

---

## 2.2.6

`2021-08-12`

- 🐞 修复 `Table` 展开列表渲染错位问题 [#4507](https://github.com/vueComponent/ant-design-vue/issues/4507)
- 🐞 修复 `Rate` 自定义 `character` 插槽未生效问题 [#4509](https://github.com/vueComponent/ant-design-vue/issues/4509)
- 🐞 添加 resize-observer-polyfill, 修复在低版本 Chrome 下报错问题 [#4508](https://github.com/vueComponent/ant-design-vue/issues/4508)

## 2.2.5

`2021-08-11`

- 🌟 `Select` 支持通过 option 插槽定制化节点 [68c1f4](https://github.com/vueComponent/ant-design-vue/commit/68c1f4550108a3a6bbe4f1b2c5c168523fd6c84a)
- 🐞 修复开发环境下弹窗类组件在低版本 chrome 下,不显示问题,并避免弹窗闪动 [#4409](https://github.com/vueComponent/ant-design-vue/issues/4409)
- 🐞 修复 `Select` 打开时没有滚动到激活位置问题 [ccb240](https://github.com/vueComponent/ant-design-vue/commit/ccb24016c07632f49550646c971060c402586c67)

## 2.2.4

`2021-08-10`

- 🌟 支持 [email protected] [#4490](https://github.com/vueComponent/ant-design-vue/issues/4490)
- 🌟 自动隐藏 `Table` 横向滚动条 [#4484](https://github.com/vueComponent/ant-design-vue/issues/4484)
- 🐞 修复 `Progress` trailColor 不生效问题 [#4483](https://github.com/vueComponent/ant-design-vue/issues/4483)

## 2.2.3

`2021-08-07`
Expand Down
1 change: 0 additions & 1 deletion antd-tools/getWebpackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ function getWebpackConfig(modules) {
},

module: {
noParse: [/moment.js/],
rules: [
{
test: /\.vue$/,
Expand Down
8 changes: 8 additions & 0 deletions components/_util/EventInterface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type FocusEventHandler = (e: FocusEvent) => void;
export type MouseEventHandler = (e: MouseEvent) => void;
export type KeyboardEventHandler = (e: KeyboardEvent) => void;
export type ChangeEvent = Event & {
target: {
value?: string | undefined;
};
};
60 changes: 25 additions & 35 deletions components/_util/Portal.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,38 @@
import PropTypes from './vue-types';
import { defineComponent, nextTick, Teleport } from 'vue';
import {
defineComponent,
nextTick,
onBeforeUnmount,
onMounted,
onUpdated,
ref,
Teleport,
} from 'vue';

export default defineComponent({
name: 'Portal',
inheritAttrs: false,
props: {
getContainer: PropTypes.func.isRequired,
children: PropTypes.any.isRequired,
didUpdate: PropTypes.func,
},
data() {
this._container = null;
return {};
},
mounted() {
this.createContainer();
},
updated() {
const { didUpdate } = this.$props;
if (didUpdate) {
setup(props, { slots }) {
const container = ref();
onMounted(() => {
container.value = props.getContainer();
});
onUpdated(() => {
nextTick(() => {
didUpdate(this.$props);
props.nextTick?.(props);
});
}
},

beforeUnmount() {
this.removeContainer();
},
methods: {
createContainer() {
this._container = this.$props.getContainer();
this.$forceUpdate();
},
removeContainer() {
if (this._container && this._container.parentNode) {
this._container.parentNode.removeChild(this._container);
});
onBeforeUnmount(() => {
if (container.value && container.value.parentNode) {
container.value.parentNode.removeChild(container.value);
}
},
},

render() {
if (this._container) {
return <Teleport to={this._container}>{this.$props.children}</Teleport>;
}
return null;
});
return () => {
return container.value ? <Teleport to={container.value}>{slots.default?.()}</Teleport> : null;
};
},
});
5 changes: 2 additions & 3 deletions components/_util/PortalWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default defineComponent({
wrapperClassName: PropTypes.string,
forceRender: PropTypes.looseBool,
getContainer: PropTypes.any,
children: PropTypes.func,
visible: PropTypes.looseBool,
},
data() {
Expand Down Expand Up @@ -130,7 +129,7 @@ export default defineComponent({
},

render() {
const { children, forceRender, visible } = this.$props;
const { forceRender, visible } = this.$props;
let portal = null;
const childProps = {
getOpenCount: () => openCount,
Expand All @@ -141,8 +140,8 @@ export default defineComponent({
portal = (
<Portal
getContainer={this.getDomContainer}
children={children(childProps)}
ref={this.savePortal}
v-slots={{ default: () => this.$slots.default?.(childProps) }}
></Portal>
);
}
Expand Down
6 changes: 6 additions & 0 deletions components/_util/hooks/useConfigInject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ export default (
): {
configProvider: UnwrapRef<ConfigProviderProps>;
prefixCls: ComputedRef<string>;
rootPrefixCls: ComputedRef<string>;
direction: ComputedRef<Direction>;
size: ComputedRef<SizeType>;
getTargetContainer: ComputedRef<() => HTMLElement>;
getPopupContainer: ComputedRef<() => HTMLElement>;
space: ComputedRef<{ size: SizeType | number }>;
pageHeader: ComputedRef<{ ghost: boolean }>;
form?: ComputedRef<{
Expand All @@ -26,6 +28,7 @@ export default (
defaultConfigProvider,
);
const prefixCls = computed(() => configProvider.getPrefixCls(name, props.prefixCls));
const rootPrefixCls = computed(() => configProvider.getPrefixCls());
const direction = computed(() => configProvider.direction);
const autoInsertSpaceInButton = computed(() => configProvider.autoInsertSpaceInButton);
const renderEmpty = computed(() => configProvider.renderEmpty);
Expand All @@ -34,16 +37,19 @@ export default (
const form = computed(() => configProvider.form);
const size = computed(() => props.size || configProvider.componentSize);
const getTargetContainer = computed(() => props.getTargetContainer);
const getPopupContainer = computed(() => props.getPopupContainer);
return {
configProvider,
prefixCls,
direction,
size,
getTargetContainer,
getPopupContainer,
space,
pageHeader,
form,
autoInsertSpaceInButton,
renderEmpty,
rootPrefixCls,
};
};
4 changes: 2 additions & 2 deletions components/_util/hooks/useMemo.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Ref } from 'vue';
import type { Ref, WatchSource } from 'vue';
import { ref, watch } from 'vue';

export default function useMemo<T>(
getValue: () => T,
condition: any[],
condition: (WatchSource<unknown> | object)[],
shouldUpdate?: (prev: any[], next: any[]) => boolean,
) {
const cacheRef: Ref<T> = ref(getValue() as any);
Expand Down
51 changes: 51 additions & 0 deletions components/_util/hooks/useMergedState.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import type { Ref, UnwrapRef } from 'vue';
import { toRaw } from 'vue';
import { watchEffect } from 'vue';
import { unref } from 'vue';
import { watch } from 'vue';
import { ref } from 'vue';

export default function useMergedState<T, R = Ref<T>>(
defaultStateValue: T | (() => T),
option?: {
defaultValue?: T | (() => T);
value?: Ref<T> | Ref<UnwrapRef<T>>;
onChange?: (val: T, prevValue: T) => void;
postState?: (val: T) => T;
},
): [R, (val: T) => void] {
const { defaultValue, value = ref() } = option || {};
let initValue: T =
typeof defaultStateValue === 'function' ? (defaultStateValue as any)() : defaultStateValue;
if (value.value !== undefined) {
initValue = unref(value as any) as T;
}
if (defaultValue !== undefined) {
initValue = typeof defaultValue === 'function' ? (defaultValue as any)() : defaultValue;
}

const innerValue = ref(initValue) as Ref<T>;
const mergedValue = ref(initValue) as Ref<T>;
watchEffect(() => {
let val = value.value !== undefined ? value.value : innerValue.value;
if (option.postState) {
val = option.postState(val as T);
}
mergedValue.value = val as T;
});

function triggerChange(newValue: T) {
const preVal = mergedValue.value;
innerValue.value = newValue;
if (toRaw(mergedValue.value) !== newValue && option.onChange) {
option.onChange(newValue, preVal);
}
}

// Effect of reset value to `undefined`
watch(value, () => {
innerValue.value = value.value as T;
});

return [mergedValue as unknown as R, triggerChange];
}
17 changes: 17 additions & 0 deletions components/_util/hooks/useState.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { Ref } from 'vue';
import { ref } from 'vue';

export default function useState<T, R = Ref<T>>(
defaultStateValue: T | (() => T),
): [R, (val: T) => void] {
const initValue: T =
typeof defaultStateValue === 'function' ? (defaultStateValue as any)() : defaultStateValue;

const innerValue = ref(initValue) as Ref<T>;

function triggerChange(newValue: T) {
innerValue.value = newValue;
}

return [innerValue as unknown as R, triggerChange];
}
4 changes: 0 additions & 4 deletions components/_util/interopDefault.js

This file was deleted.

75 changes: 0 additions & 75 deletions components/_util/moment-util.js

This file was deleted.

Loading