Skip to content

Commit fde90a9

Browse files
committed
Merge branch 'main-backup' into fix/TimePicker-disabled
2 parents 85b972d + ed27700 commit fde90a9

Some content is hidden

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

49 files changed

+340
-150
lines changed

.eslintrc.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module.exports = {
2727
// ],
2828
plugins: ['markdown', 'jest', '@typescript-eslint', 'import'],
2929
globals: {
30+
h: true,
3031
defineProps: 'readonly',
3132
},
3233
overrides: [
@@ -108,7 +109,4 @@ module.exports = {
108109
],
109110
'vue/multi-word-component-names': 'off',
110111
},
111-
globals: {
112-
h: true,
113-
},
114112
};

README-zh_CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ ant-design-vue 是 MIT 协议的开源项目。为了项目能够更好的持续
8888
- [opencollective](https://opencollective.com/ant-design-vue)
8989
- [paypal](https://www.paypal.me/tangjinzhou)
9090
- [支付宝或微信](https://aliyuncdn.antdv.com/alipay-and-wechat.png)
91+
- ETH: 0x30cc48515d8ae9fefa20ab87226ad7e8ab9c3bc2
9192

9293
## Sponsors
9394

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ ant-design-vue is an MIT-licensed open source project. In order to achieve bette
8282
- [opencollective](https://opencollective.com/ant-design-vue)
8383
- [paypal](https://www.paypal.me/tangjinzhou)
8484
- [支付宝或微信](https://aliyuncdn.antdv.com/alipay-and-wechat.png)
85+
- ETH: 0x30cc48515d8ae9fefa20ab87226ad7e8ab9c3bc2
8586

8687
## Sponsors
8788

components/_util/cssinjs/hooks/useCacheToken.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const isPrerender = process.env.NODE_ENV === 'prerender';
1414

1515
// Generate different prefix to make user selector break in production env.
1616
// This helps developer not to do style override directly on the hash id.
17-
const hashPrefix = (!isProduction && !isPrerender) ? 'css-dev-only-do-not-override' : 'css';
17+
const hashPrefix = !isProduction && !isPrerender ? 'css-dev-only-do-not-override' : 'css';
1818

1919
export interface Option<DerivativeToken, DesignToken> {
2020
/**

components/_util/hooks/_vueuse/_configurable.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface ConfigurableLocation {
2828
location?: Location;
2929
}
3030

31-
export const defaultWindow = isClient ? window : undefined;
32-
export const defaultDocument = isClient ? window.document : undefined;
33-
export const defaultNavigator = isClient ? window.navigator : undefined;
34-
export const defaultLocation = isClient ? window.location : undefined;
31+
export const defaultWindow = isClient ? window : undefined;
32+
export const defaultDocument = isClient ? window.document : undefined;
33+
export const defaultNavigator = isClient ? window.navigator : undefined;
34+
export const defaultLocation = isClient ? window.location : undefined;

components/_util/hooks/_vueuse/is.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ export const rand = (min: number, max: number) => {
2121
return Math.floor(Math.random() * (max - min + 1)) + min;
2222
};
2323
export const isIOS =
24-
isClient &&
25-
window?.navigator?.userAgent &&
26-
/iP(ad|hone|od)/.test(window.navigator.userAgent);
24+
isClient && window?.navigator?.userAgent && /iP(ad|hone|od)/.test(window.navigator.userAgent);
2725
export const hasOwn = <T extends object, K extends keyof T>(val: T, key: K): key is K =>
2826
Object.prototype.hasOwnProperty.call(val, key);

components/app/index.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ import type { MessageInstance } from 'ant-design-vue/es/message/interface';
9797
import type { ModalStaticFunctions } from 'ant-design-vue/es/modal/confirm';
9898
import type { NotificationInstance } from 'ant-design-vue/es/notification/interface';
9999

100-
export const useGloablStore = defineStore('global', () => {
100+
export const useGlobalStore = defineStore('global', () => {
101101
const message: MessageInstance = ref();
102102
const notification: NotificationInstance = ref();
103103
const modal: Omit<ModalStaticFunctions, 'warn'> = ref();

components/app/index.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ import type { MessageInstance } from 'ant-design-vue/es/message/interface';
9898
import type { ModalStaticFunctions } from 'ant-design-vue/es/modal/confirm';
9999
import type { NotificationInstance } from 'ant-design-vue/es/notification/interface';
100100

101-
export const useGloablStore = defineStore('global', () => {
101+
export const useGlobalStore = defineStore('global', () => {
102102
const message: MessageInstance = ref();
103103
const notification: NotificationInstance = ref();
104104
const modal: Omit<ModalStaticFunctions, 'warn'> = ref();

components/auto-complete/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ const AutoComplete = defineComponent({
5050
props: autoCompleteProps(),
5151
// emits: ['change', 'select', 'focus', 'blur'],
5252
slots: Object as CustomSlotsType<{
53+
option: any;
54+
// deprecated, should use props `options` instead, not slot
5355
options: any;
5456
default: any;
5557
notFoundContent: any;

components/date-picker/locale/ja_JP.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ import type { PickerLocale } from '../generatePicker';
66
const locale: PickerLocale = {
77
lang: {
88
placeholder: '日付を選択',
9+
yearPlaceholder: '年を選択',
10+
quarterPlaceholder: '四半期を選択',
11+
monthPlaceholder: '月を選択',
12+
weekPlaceholder: '週を選択',
913
rangePlaceholder: ['開始日付', '終了日付'],
14+
rangeYearPlaceholder: ['開始年', '終了年'],
15+
rangeMonthPlaceholder: ['開始月', '終了月'],
16+
rangeQuarterPlaceholder: ['開始四半期', '終了四半期'],
17+
rangeWeekPlaceholder: ['開始週', '終了週'],
1018
...CalendarLocale,
1119
},
1220
timePickerLocale: {

components/form/useForm.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,13 @@ function useForm(
214214
const errorList = results.filter(
215215
(result: { errors: string | any[] }) => result && result.errors.length,
216216
);
217-
return Promise.reject({
218-
values,
219-
errorFields: errorList,
220-
outOfDate: lastValidatePromise !== summaryPromise,
221-
});
217+
return errorList.length
218+
? Promise.reject({
219+
values,
220+
errorFields: errorList,
221+
outOfDate: lastValidatePromise !== summaryPromise,
222+
})
223+
: Promise.resolve(values);
222224
});
223225

224226
// Do not throw in console

components/input/ResizableTextArea.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const ResizableTextArea = defineComponent({
7777
startResize();
7878
}
7979
},
80-
{ immediate: true, flush: 'post' },
80+
{ immediate: true },
8181
);
8282
const autoSizeStyle = ref<CSSProperties>();
8383
watch(

components/input/TextArea.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export default defineComponent({
172172
const handleChange = (e: Event) => {
173173
const { composing } = e.target as any;
174174
let triggerValue = (e.target as any).value;
175-
compositing.value = !!((e as any).isComposing || composing);
175+
compositing.value = !!((e as any).isComposing && composing);
176176
if ((compositing.value && props.lazy) || stateValue.value === triggerValue) return;
177177

178178
if (hasMaxLength.value) {

components/layout/style/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const genLayoutStyle: GenerateStyle<LayoutToken, CSSObject> = token => {
4545
display: 'flex',
4646
flex: 'auto',
4747
flexDirection: 'column',
48+
color: colorText,
4849

4950
/* fix firefox can't set height smaller than content on flex item */
5051
minHeight: 0,

components/locale/ru_RU.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ const localeValues: Locale = {
3434
triggerAsc: 'Нажмите для сортировки по возрастанию',
3535
cancelSort: 'Нажмите, чтобы отменить сортировку',
3636
},
37+
Tour: {
38+
Next: 'Вперёд',
39+
Previous: 'Назад',
40+
Finish: 'Готово',
41+
},
3742
Modal: {
3843
okText: 'OK',
3944
cancelText: 'Отмена',
@@ -78,6 +83,7 @@ const localeValues: Locale = {
7883
back: 'Назад',
7984
},
8085
Form: {
86+
optional: '(опционально)',
8187
defaultValidateMessages: {
8288
default: 'Ошибка проверки поля ${label}',
8389
required: 'Пожалуйста, введите ${label}',
@@ -128,6 +134,11 @@ const localeValues: Locale = {
128134
Image: {
129135
preview: 'Предпросмотр',
130136
},
137+
QRCode: {
138+
expired: 'QR код просрочен',
139+
refresh: 'Обновить',
140+
scanned: 'Отсканирован',
141+
},
131142
};
132143

133144
export default localeValues;

components/menu/src/Menu.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,15 +439,17 @@ export default defineComponent({
439439
forceSubMenuRender: computed(() => props.forceSubMenuRender),
440440
rootClassName: hashId,
441441
});
442+
443+
const getChildrenList = () => itemsNodes.value || flattenChildren(slots.default?.());
442444
return () => {
443-
const childList = itemsNodes.value || flattenChildren(slots.default?.());
445+
const childList = getChildrenList();
444446
const allVisible =
445447
lastVisibleIndex.value >= childList.length - 1 ||
446448
mergedMode.value !== 'horizontal' ||
447449
props.disabledOverflow;
448450
// >>>>> Children
449-
const wrappedChildList =
450-
mergedMode.value !== 'horizontal' || props.disabledOverflow
451+
const getWrapperList = childList => {
452+
return mergedMode.value !== 'horizontal' || props.disabledOverflow
451453
? childList
452454
: // Need wrap for overflow dropdown that do not response for open
453455
childList.map((child, index) => (
@@ -458,6 +460,7 @@ export default defineComponent({
458460
v-slots={{ default: () => child }}
459461
></MenuContextProvider>
460462
));
463+
};
461464
const overflowedIndicator = slots.overflowedIndicator?.() || <EllipsisOutlined />;
462465

463466
return wrapSSR(
@@ -470,7 +473,7 @@ export default defineComponent({
470473
class={[className.value, attrs.class, hashId.value]}
471474
role="menu"
472475
id={props.id}
473-
data={wrappedChildList}
476+
data={getWrapperList(childList)}
474477
renderRawItem={node => node}
475478
renderRawRest={omitItems => {
476479
// We use origin list since wrapped list use context to prevent open
@@ -514,7 +517,7 @@ export default defineComponent({
514517
>
515518
<Teleport to="body">
516519
<div style={{ display: 'none' }} aria-hidden>
517-
<PathContext>{wrappedChildList}</PathContext>
520+
<PathContext>{getWrapperList(getChildrenList())}</PathContext>
518521
</div>
519522
</Teleport>
520523
</Overflow>,

components/modal/index.en-US.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,5 @@ When you need context information (for example, using a globally registered comp
155155
});
156156
</script>
157157
```
158+
159+
> [App Package Component](/components/app) can be used to simplify the problem of `useModal` and other methods that need to manually implant contextHolder.

components/modal/index.zh-CN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,5 @@ router.beforeEach((to, from, next) => {
159159
});
160160
</script>
161161
```
162+
163+
> 可通过 [App 包裹组件](/components/app-cn) 简化`useModal`等方法需要手动植入 contextHolder 的问题。

components/style/placementArrow.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,23 +209,29 @@ export default function getArrowStyle<Token extends TokenWithCommonCls<AliasToke
209209
// Offset the popover to account for the dropdown arrow
210210
// >>>>> Top
211211
[connectArrowCls(
212-
[`&-placement-topLeft`, `&-placement-top`, `&-placement-topRight`],
212+
[`&-placement-topLeft`, `&-placement-top`, `&-placement-topRight`].map(
213+
cls => (cls += ':not(&-arrow-hidden)'),
214+
),
213215
showArrowCls,
214216
)]: {
215217
paddingBottom: dropdownArrowDistance,
216218
},
217219

218220
// >>>>> Bottom
219221
[connectArrowCls(
220-
[`&-placement-bottomLeft`, `&-placement-bottom`, `&-placement-bottomRight`],
222+
[`&-placement-bottomLeft`, `&-placement-bottom`, `&-placement-bottomRight`].map(
223+
cls => (cls += ':not(&-arrow-hidden)'),
224+
),
221225
showArrowCls,
222226
)]: {
223227
paddingTop: dropdownArrowDistance,
224228
},
225229

226230
// >>>>> Left
227231
[connectArrowCls(
228-
[`&-placement-leftTop`, `&-placement-left`, `&-placement-leftBottom`],
232+
[`&-placement-leftTop`, `&-placement-left`, `&-placement-leftBottom`].map(
233+
cls => (cls += ':not(&-arrow-hidden)'),
234+
),
229235
showArrowCls,
230236
)]: {
231237
paddingRight: {
@@ -236,7 +242,9 @@ export default function getArrowStyle<Token extends TokenWithCommonCls<AliasToke
236242

237243
// >>>>> Right
238244
[connectArrowCls(
239-
[`&-placement-rightTop`, `&-placement-right`, `&-placement-rightBottom`],
245+
[`&-placement-rightTop`, `&-placement-right`, `&-placement-rightBottom`].map(
246+
cls => (cls += ':not(&-arrow-hidden)'),
247+
),
240248
showArrowCls,
241249
)]: {
242250
paddingLeft: {

components/table/index.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Specify `dataSource` of Table as an array of data.
116116

117117
| Events Name | Description | Arguments | |
118118
| --- | --- | --- | --- |
119-
| change | Callback executed when pagination, filters or sorter is changed | Function(pagination, filters, sorter, { currentDataSource }) | |
119+
| change | Callback executed when pagination, filters or sorter is changed | Function(pagination, filters, sorter, { action, currentDataSource }) | |
120120
| expand | Callback executed when the row expand icon is clicked | Function(expanded, record) | |
121121
| expandedRowsChange | Callback executed when the expanded rows change | Function(expandedRows) | |
122122
| resizeColumn | Triggered when the column is dragged | Function(width, column) | |

components/table/index.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*Sv8XQ50NB40AAA
121121

122122
| 事件名称 | 说明 | 回调参数 |
123123
| --- | --- | --- |
124-
| change | 分页、排序、筛选变化时触发 | Function(pagination, filters, sorter, { currentDataSource }) |
124+
| change | 分页、排序、筛选变化时触发 | Function(pagination, filters, sorter, { action, currentDataSource }) |
125125
| expand | 点击展开图标时触发 | Function(expanded, record) |
126126
| expandedRowsChange | 展开的行变化时触发 | Function(expandedRows) |
127127
| resizeColumn | 拖动列时触发 | Function(width, column) |

components/tabs/src/TabNavList/index.tsx

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,34 @@ interface ExtraContentProps {
6464
extra?: (info?: { position: 'left' | 'right' }) => TabBarExtraContent;
6565
}
6666

67+
const getTabSize = (tab: HTMLElement, containerRect: { x: number; y: number }) => {
68+
// tabListRef
69+
const { offsetWidth, offsetHeight, offsetTop, offsetLeft } = tab;
70+
const { width, height, x, y } = tab.getBoundingClientRect();
71+
72+
// Use getBoundingClientRect to avoid decimal inaccuracy
73+
if (Math.abs(width - offsetWidth) < 1) {
74+
return [width, height, x - containerRect.x, y - containerRect.y];
75+
}
76+
77+
return [offsetWidth, offsetHeight, offsetLeft, offsetTop];
78+
};
79+
80+
// const getSize = (refObj: ShallowRef<HTMLElement>) => {
81+
// const { offsetWidth = 0, offsetHeight = 0 } = refObj.value || {};
82+
83+
// // Use getBoundingClientRect to avoid decimal inaccuracy
84+
// if (refObj.value) {
85+
// const { width, height } = refObj.value.getBoundingClientRect();
86+
87+
// if (Math.abs(width - offsetWidth) < 1) {
88+
// return [width, height];
89+
// }
90+
// }
91+
92+
// return [offsetWidth, offsetHeight];
93+
// };
94+
6795
export default defineComponent({
6896
compatConfig: { MODE: 3 },
6997
name: 'TabNavList',
@@ -288,7 +316,29 @@ export default defineComponent({
288316

289317
return ([visibleStart.value, visibleEnd.value] = [startIndex, endIndex]);
290318
});
319+
const updateTabSizes = () => {
320+
setTabSizes(() => {
321+
const newSizes: TabSizeMap = new Map();
322+
const listRect = tabListRef.value?.getBoundingClientRect();
323+
tabs.value.forEach(({ key }) => {
324+
const btnRef = btnRefs.value.get(key);
325+
const btnNode = (btnRef as any)?.$el || btnRef;
326+
if (btnNode) {
327+
const [width, height, left, top] = getTabSize(btnNode, listRect);
328+
newSizes.set(key, { width, height, left, top });
329+
}
330+
});
331+
return newSizes;
332+
});
333+
};
291334

335+
watch(
336+
() => tabs.value.map(tab => tab.key).join('%%'),
337+
() => {
338+
updateTabSizes();
339+
},
340+
{ flush: 'post' },
341+
);
292342
const onListHolderResize = () => {
293343
// Update wrapper records
294344
const offsetWidth = tabsWrapperRef.value?.offsetWidth || 0;
@@ -308,22 +358,7 @@ export default defineComponent({
308358
setWrapperScrollHeight(newWrapperScrollHeight);
309359

310360
// Update buttons records
311-
setTabSizes(() => {
312-
const newSizes: TabSizeMap = new Map();
313-
tabs.value.forEach(({ key }) => {
314-
const btnRef = btnRefs.value.get(key);
315-
const btnNode = (btnRef as any)?.$el || btnRef;
316-
if (btnNode) {
317-
newSizes.set(key, {
318-
width: btnNode.offsetWidth,
319-
height: btnNode.offsetHeight,
320-
left: btnNode.offsetLeft,
321-
top: btnNode.offsetTop,
322-
});
323-
}
324-
});
325-
return newSizes;
326-
});
361+
updateTabSizes();
327362
};
328363

329364
// ======================== Dropdown =======================

0 commit comments

Comments
 (0)