Compare commits

...

7 Commits

Author SHA1 Message Date
neverland
ba4e83df52
feat(Locale): add Ukrainian translation (#10291) 2022-02-11 17:57:48 +08:00
neverland
c51f1cfa5f
feat(Locale): add Indonesian translation (#10289)
* feat(Locale): add Indonesian translation

* docs: upd
2022-02-11 16:46:21 +08:00
neverland
5b7c8883a3
feat(Locale): add Italain translation (#10288) 2022-02-11 16:29:48 +08:00
neverland
8acb93c43d
feat(Locale): add Bangla (Bangladesh) (#10287) 2022-02-11 16:18:51 +08:00
neverland
a5ee18f31c
style(SubmitBar): using english colon (#10286) 2022-02-11 16:12:36 +08:00
neverland
0603479ee4
fix(Dialog): skip keyboard events of child elements (#10285)
* fix(Dialog): skip keyboard events of child elements

* test: fix snapshot
2022-02-11 15:25:38 +08:00
zoy-l
c1be4112e4
feat(Dialog): support enter/esc keyboard event (#10261)
* feat(dialog): the enter/esc keyboard event is supported

* fix(dialog): the corresponding method is not executed when there is no button

* chore(dialog): simplify implementation

* fix: the wrong judgment
2022-02-11 14:52:49 +08:00
29 changed files with 391 additions and 61 deletions

View File

@ -1,5 +1,7 @@
import {
ref,
reactive,
withKeys,
defineComponent,
type PropType,
type ExtractPropTypes,
@ -7,6 +9,7 @@ import {
// Utils
import {
noop,
pick,
extend,
addUnit,
@ -19,6 +22,7 @@ import {
makeStringProp,
callInterceptor,
createNamespace,
type ComponentInstance,
} from '../utils';
import { popupSharedProps, popupSharedPropKeys } from '../popup/shared';
@ -71,9 +75,10 @@ export default defineComponent({
props: dialogProps,
emits: ['confirm', 'cancel', 'update:show'],
emits: ['confirm', 'cancel', 'keydown', 'update:show'],
setup(props, { emit, slots }) {
const root = ref<ComponentInstance>();
const loading = reactive({
confirm: false,
cancel: false,
@ -113,6 +118,23 @@ export default defineComponent({
const onCancel = getActionHandler('cancel');
const onConfirm = getActionHandler('confirm');
const onKeydown = withKeys(
(event: KeyboardEvent) => {
// skip keyboard events of child elements
if (event.target !== root.value?.popupRef?.value) {
return;
}
const onEventType: Record<string, () => void> = {
Enter: props.showConfirmButton ? onConfirm : noop,
Escape: props.showCancelButton ? onCancel : noop,
};
onEventType[event.key]();
emit('keydown', event);
},
['enter', 'esc']
);
const renderTitle = () => {
const title = slots.title ? slots.title() : props.title;
@ -229,10 +251,13 @@ export default defineComponent({
const { width, title, theme, message, className } = props;
return (
<Popup
ref={root}
role="dialog"
class={[bem([theme]), className]}
style={{ width: addUnit(width) }}
tabindex={0}
aria-labelledby={title || message}
onKeydown={onKeydown}
onUpdate:show={updateShow}
{...pick(props, popupInheritKeys)}
>

View File

@ -97,6 +97,7 @@ exports[`should render demo and match snapshot 1`] = `
<transition-stub>
<div class="van-popup van-popup--center van-dialog"
role="dialog"
tabindex="0"
aria-labelledby="Title"
style="display: none;"
>

View File

@ -32,6 +32,7 @@ exports[`should render default slot correctly 1`] = `
exports[`should render footer slot correctly 1`] = `
<div class="van-popup van-popup--center van-dialog"
role="dialog"
tabindex="0"
aria-labelledby="message"
>
<div class="van-dialog__content van-dialog__content--isolated">

View File

@ -39,25 +39,29 @@ Locale.add(messages);
Current supported languages:
| Language | Filename |
| ------------------------ | ------------ |
| German | de-DE |
| German (formal) | de-DE-formal |
| English | en-US |
| Spanish (Spain) | es-ES |
| French | fr-FR |
| Hindi | hi-IN |
| Japanese | ja-JP |
| Korean | ko-KR |
| Norwegian | nb-NO |
| Portuguese (Brazil) | pt-BR |
| Romanian | ro-RO |
| Russian | ru-RU |
| Turkish | tr-TR |
| Thai | th-TH |
| Chinese | zh-CN |
| Traditional Chinese (HK) | zh-HK |
| Traditional Chinese (TW) | zh-TW |
| Language | Filename | Version |
| ------------------------ | ------------ | -------- |
| Bangla (Bangladesh) | bn-BD | `v3.4.5` |
| German | de-DE | - |
| German (formal) | de-DE-formal | - |
| English | en-US | - |
| Spanish (Spain) | es-ES | - |
| French | fr-FR | - |
| Hindi | hi-IN | `v3.4.3` |
| Indonesian | id-ID | `v3.4.5` |
| Italian | it-IT | `v3.4.5` |
| Japanese | ja-JP | - |
| Korean | ko-KR | `v3.4.3` |
| Norwegian | nb-NO | - |
| Portuguese (Brazil) | pt-BR | `v3.3.3` |
| Romanian | ro-RO | - |
| Russian | ru-RU | `v3.1.5` |
| Turkish | tr-TR | - |
| Thai | th-TH | - |
| Ukrainian | uk-UA | `v3.4.5` |
| Chinese | zh-CN | - |
| Traditional Chinese (HK) | zh-HK | - |
| Traditional Chinese (TW) | zh-TW | - |
> View all language configs [Here](https://github.com/youzan/vant/tree/dev/packages/vant/src/locale/lang).

View File

@ -40,25 +40,29 @@ Locale.add(messages);
目前支持的语言:
| 语言 | 文件名 |
| --------------- | ------------ |
| 德语 | de-DE |
| 德语 (正式) | de-DE-formal |
| 英语 | en-US |
| 西班牙语 | es-ES |
| 法语 | fr-FR |
| 印地语 | hi-IN |
| 日语 | ja-JP |
| 韩语/朝鲜语 | ko-KR.ts |
| 挪威语 | nb-NO |
| 葡萄牙语 (巴西) | pt-BR |
| 罗马尼亚语 | ro-RO |
| 俄罗斯语 | ru-RU |
| 土耳其语 | tr-TR |
| 泰语 | th-TH |
| 简体中文 | zh-CN |
| 繁體中文(港) | zh-HK |
| 繁體中文(台) | zh-TW |
| 语言 | 文件名 | 版本 |
| -------------------- | ------------ | -------- |
| 孟加拉语(孟加拉国) | bn-BD | `v3.4.5` |
| 德语 | de-DE | - |
| 德语(正式) | de-DE-formal | - |
| 英语 | en-US | - |
| 西班牙语 | es-ES | - |
| 法语 | fr-FR | - |
| 印地语 | hi-IN | `v3.4.3` |
| 印度尼西亚语 | id-ID | `v3.4.5` |
| 意大利语 | it-IT | `v3.4.5` |
| 日语 | ja-JP | - |
| 韩语/朝鲜语 | ko-KR | `v3.4.3` |
| 挪威语 | nb-NO | - |
| 葡萄牙语(巴西) | pt-BR | `v3.3.3` |
| 罗马尼亚语 | ro-RO | - |
| 俄罗斯语 | ru-RU | `v3.1.5` |
| 土耳其语 | tr-TR | - |
| 泰语 | th-TH | - |
| 乌克兰语 | uk-UA | `v3.4.5` |
| 简体中文 | zh-CN | - |
| 繁體中文(港) | zh-HK | - |
| 繁體中文(台) | zh-TW | - |
> 在 [这里](https://github.com/youzan/vant/tree/dev/packages/vant/src/locale/lang) 查看所有的语言包源文件。

View File

@ -0,0 +1,72 @@
export default {
name: 'নাম',
tel: 'ফোন',
save: 'সংরক্ষণ করুন',
confirm: 'নিশ্চিত করুন',
cancel: 'বাতিল',
delete: 'মুছুন',
loading: 'লোড হচ্ছে...',
noCoupon: 'কোন কুপন নেই',
nameEmpty: 'অনুগ্রহ করে নামটি পূরণ করুন',
addContact: 'যোগাযোগ যোগ করুন',
telInvalid: 'বিকৃত ফোন নম্বর',
vanCalendar: {
end: 'শেষ',
start: 'শুরু',
title: 'ক্যালেন্ডার',
weekdays: [
'রবিবার',
'সোমবার',
'মঙ্গলবার',
'বুধবার',
'বৃহস্পতিবার',
'শুক্রবার',
'শনিবার',
],
monthTitle: (year: number, month: number) => `${year}/${month}`,
rangePrompt: (maxRange: number) =>
`${maxRange} দিনের বেশি নির্বাচন করবেন না`,
},
vanCascader: {
select: 'নির্বাচন',
},
vanPagination: {
prev: 'পূর্ববর্তী',
next: 'পরবর্তী',
},
vanPullRefresh: {
pulling: 'রিফ্রেশ করতে টানুন...',
loosing: 'রিফ্রেশ করতে আলগা...',
},
vanSubmitBar: {
label: 'মোট:',
},
vanCoupon: {
unlimited: 'আনলিমিটেড',
discount: (discount: number) => `${discount * 10}% ছাড়`,
condition: (condition: number) => `অন্তত ${condition}`,
},
vanCouponCell: {
title: 'কুপন',
count: (count: number) => `আপনার ${count} কুপন আছে`,
},
vanCouponList: {
exchange: 'বিনিময়',
close: 'বন্ধ',
enable: 'উপলভ্য',
disabled: 'অনুপলব্ধ',
placeholder: 'কুপন কোড',
},
vanAddressEdit: {
area: 'এরিয়া',
postal: 'ডাক',
areaEmpty: 'অনুগ্রহ করে একটি রিসিভিং এলাকা নির্বাচন করুন',
addressEmpty: 'ঠিকানা খালি হতে পারে না',
postalEmpty: 'ভুল পোস্টাল কোড',
addressDetail: 'ঠিকানা',
defaultAddress: 'ডিফল্ট ঠিকানা হিসাবে সেট করুন',
},
vanAddressList: {
add: 'নতুন ঠিকানা যোগ করুন',
},
};

View File

@ -30,7 +30,7 @@ export default {
loosing: 'Loslassen zum Aktualisieren...',
},
vanSubmitBar: {
label: 'Total',
label: 'Total:',
},
vanCoupon: {
unlimited: 'Unbegrenzt',

View File

@ -30,7 +30,7 @@ export default {
loosing: 'Loslassen zum Aktualisieren...',
},
vanSubmitBar: {
label: 'Total',
label: 'Total:',
},
vanCoupon: {
unlimited: 'Unbegrenzt',

View File

@ -30,7 +30,7 @@ export default {
loosing: 'Loose to refresh...',
},
vanSubmitBar: {
label: 'Total',
label: 'Total:',
},
vanCoupon: {
unlimited: 'Unlimited',

View File

@ -30,7 +30,7 @@ export default {
loosing: 'Suelta para recargar...',
},
vanSubmitBar: {
label: 'Total',
label: 'Total:',
},
vanCoupon: {
unlimited: 'Ilimitado',

View File

@ -30,7 +30,7 @@ export default {
loosing: 'Relâchez pour actualiser...',
},
vanSubmitBar: {
label: 'Total',
label: 'Total:',
},
vanCoupon: {
unlimited: 'Illimité',

View File

@ -38,7 +38,7 @@ export default {
loosing: 'ताज़ा करने के लिए ढीला...',
},
vanSubmitBar: {
label: 'कुल',
label: 'कुल:',
},
vanCoupon: {
unlimited: 'असीमित',

View File

@ -0,0 +1,64 @@
export default {
name: 'Nama',
tel: 'Telepon',
save: 'Simpan',
confirm: 'Konfirmasi',
cancel: 'Batal',
delete: 'Hapus',
loading: 'Memuat...',
noCoupon: 'Tidak ada kupon',
nameEmpty: 'Silakan isi nama',
addContact: 'Tambahkan kontak',
telInvalid: 'Nomor telepon salah format',
vanCalendar: {
end: 'Akhir',
start: 'Mulai',
title: 'Kalender',
weekdays: ['minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'],
monthTitle: (year: number, month: number) => `${year}/${month}`,
rangePrompt: (maxRange: number) =>
`Pilih tidak lebih dari ${maxRange} hari`,
},
vanCascader: {
select: 'Pilih',
},
vanPagination: {
prev: 'Sebelumnya',
next: 'Selanjutnya',
},
vanPullRefresh: {
pulling: 'Tarik untuk menyegarkan...',
loosing: 'Loose untuk menyegarkan...',
},
vanSubmitBar: {
label: 'Jumlah:',
},
vanCoupon: {
unlimited: 'Tidak terbatas',
discount: (discount: number) => `${discount * 10}% off`,
condition: (condition: number) => `Setidaknya ${condition}`,
},
vanCouponCell: {
title: 'Kupon',
count: (count: number) => `Anda memiliki kupon ${count}`,
},
vanCouponList: {
exchange: 'Pertukaran',
close: 'Tutup',
enable: 'Tersedia',
disabled: 'Tidak tersedia',
placeholder: 'Kode kupon',
},
vanAddressEdit: {
area: 'Daerah',
postal: 'pos',
areaEmpty: 'Silakan pilih area penerima',
addressEmpty: 'Alamat tidak boleh kosong',
postalEmpty: 'Kode pos salah',
addressDetail: 'Alamat',
defaultAddress: 'Tetapkan sebagai alamat default',
},
vanAddressList: {
add: 'Tambahkan alamat baru',
},
};

View File

@ -0,0 +1,71 @@
export default {
name: 'Nome',
tel: 'Telefono',
save: 'Salva',
confirm: 'Conferma',
cancel: 'Annulla',
delete: 'Elimina',
loading: 'Caricamento in corso...',
noCoupon: 'Nessun coupon',
nameEmpty: 'Inserisci il nome',
addContact: 'Aggiungi contatto',
telInvalid: 'Numero di telefono errato',
vanCalendar: {
end: 'Fine',
start: 'Inizio',
title: 'Calendario',
weekdays: [
'domenica',
'Lunedi',
'Martedì',
'mercoledì',
'giovedì',
'venerdì',
'Sabato',
],
monthTitle: (year: number, month: number) => `${year}/${month}`,
rangePrompt: (maxRange: number) => `Scegli non più di ${maxRange} giorni`,
},
vanCascader: {
select: 'Seleziona',
},
vanPagination: {
prev: 'Precedente',
next: 'Avanti',
},
vanPullRefresh: {
pulling: 'Tiri per aggiornare...',
loosing: 'Largo per rinfrescare...',
},
vanSubmitBar: {
label: 'Totale:',
},
vanCoupon: {
unlimited: 'Illimitato',
discount: (discount: number) => `${discount * 10}% di sconto`,
condition: (condition: number) => `Almeno ${condition}`,
},
vanCouponCell: {
title: 'Buono',
count: (count: number) => `Hai ${count} coupon`,
},
vanCouponList: {
exchange: 'Scambio',
close: 'Chiudi',
enable: 'Disponibile',
disabled: 'Non disponibile',
placeholder: 'Codice coupon',
},
vanAddressEdit: {
area: 'Area',
postal: 'Postale',
areaEmpty: "Seleziona un'area di ricezione",
addressEmpty: "L'indirizzo non può essere vuoto",
postalEmpty: 'Codice postale errato',
addressDetail: 'Indirizzo',
defaultAddress: 'Imposta come indirizzo predefinito',
},
vanAddressList: {
add: 'Aggiungi nuovo indirizzo',
},
};

View File

@ -30,7 +30,7 @@ export default {
loosing: 'リリース時に更新...',
},
vanSubmitBar: {
label: '合計',
label: '合計:',
},
vanCoupon: {
unlimited: '無制限',

View File

@ -38,7 +38,7 @@ export default {
loosing: '새로 고침...',
},
vanSubmitBar: {
label: '총',
label: '총:',
},
vanCoupon: {
unlimited: '제한 없는',

View File

@ -30,7 +30,7 @@ export default {
loosing: 'Mist for oppdatering...',
},
vanSubmitBar: {
label: 'Totalt',
label: 'Totalt:',
},
vanCoupon: {
unlimited: 'Uendelig',

View File

@ -30,7 +30,7 @@ export default {
loosing: 'Solte para atualizar...',
},
vanSubmitBar: {
label: 'Total',
label: 'Total:',
},
vanCoupon: {
unlimited: 'Ilimitado',

View File

@ -30,7 +30,7 @@ export default {
loosing: 'Eliberează pentru a împrospăta...',
},
vanSubmitBar: {
label: 'Total',
label: 'Total:',
},
vanCoupon: {
unlimited: 'Nelimitat',

View File

@ -30,7 +30,7 @@ export default {
loosing: 'Отпустите для обновления...',
},
vanSubmitBar: {
label: 'Всего',
label: 'Всего:',
},
vanCoupon: {
unlimited: 'Безлимитный',

View File

@ -31,7 +31,7 @@ export default {
loosing: 'ปล่อยเพื่อรีเฟรช...',
},
vanSubmitBar: {
label: 'รวม',
label: 'รวม:',
},
vanCoupon: {
unlimited: 'ไม่ จำกัด',

View File

@ -0,0 +1,72 @@
export default {
name: "Ім'я",
tel: 'Телефон',
save: 'Зберегти',
confirm: 'підтвердити',
cancel: 'Скасувати',
delete: 'Видалити',
loading: 'Завантаження...',
noCoupon: 'Без купонів',
nameEmpty: "Будь ласка, введіть ім'я",
addContact: 'Додати контакт',
telInvalid: 'Неправильний номер телефону',
vanCalendar: {
end: 'Кінець',
start: 'Почати',
title: 'Календар',
weekdays: [
'неділя',
'понеділок',
'вівторок',
'середа',
'четвер',
"п'ятниця",
'субота',
],
monthTitle: (year: number, month: number) => `${year}/${month}`,
rangePrompt: (maxRange: number) =>
`Виберіть не більше ніж ${maxRange} днів`,
},
vanCascader: {
select: 'Вибрати',
},
vanPagination: {
prev: 'Попередній',
next: 'Далі',
},
vanPullRefresh: {
pulling: 'Потягніть, щоб оновити...',
loosing: 'Погано оновити...',
},
vanSubmitBar: {
label: 'Усього:',
},
vanCoupon: {
unlimited: 'Необмежено',
discount: (discount: number) => `${discount * 10}% off`,
condition: (condition: number) => `Принаймні ${condition}`,
},
vanCouponCell: {
title: 'Купон',
count: (count: number) => `У вас є ${count} купонів`,
},
vanCouponList: {
exchange: 'Обмін',
close: 'Закрити',
enable: 'Доступно',
disabled: 'Недоступно',
placeholder: 'Код купона',
},
vanAddressEdit: {
area: 'Область',
postal: 'Поштовий',
areaEmpty: 'Будь ласка, виберіть зону прийому',
addressEmpty: 'Адреса не може бути порожньою',
postalEmpty: 'Неправильний поштовий індекс',
addressDetail: 'Адреса',
defaultAddress: 'Встановити як адресу за замовчуванням',
},
vanAddressList: {
add: 'Додати нову адресу',
},
};

View File

@ -30,7 +30,7 @@ export default {
loosing: '释放即可刷新...',
},
vanSubmitBar: {
label: '合计',
label: '合计:',
},
vanCoupon: {
unlimited: '无门槛',

View File

@ -30,7 +30,7 @@ export default {
loosing: '釋放即可刷新...',
},
vanSubmitBar: {
label: '合計',
label: '合計:',
},
vanCoupon: {
unlimited: '無門檻',

View File

@ -30,7 +30,7 @@ export default {
loosing: '釋放即可刷新...',
},
vanSubmitBar: {
label: '合計',
label: '合計:',
},
vanCoupon: {
unlimited: '無門檻',

View File

@ -3,6 +3,7 @@ import {
watch,
provide,
Teleport,
nextTick,
computed,
onMounted,
Transition,
@ -68,6 +69,7 @@ export default defineComponent({
'close',
'opened',
'closed',
'keydown',
'update:show',
'click-overlay',
'click-close-icon',
@ -172,9 +174,11 @@ export default defineComponent({
const onOpened = () => emit('opened');
const onClosed = () => emit('closed');
const onKeydown = (event: KeyboardEvent) => emit('keydown', event);
const renderPopup = lazyRender(() => {
const { round, position, safeAreaInsetBottom } = props;
return (
<div
v-show={props.show}
@ -187,6 +191,7 @@ export default defineComponent({
}),
{ 'van-safe-area-bottom': safeAreaInsetBottom },
]}
onKeydown={onKeydown}
{...attrs}
>
{slots.default?.()}
@ -216,6 +221,12 @@ export default defineComponent({
(show) => {
if (show && !opened) {
open();
if (attrs.tabindex === 0) {
nextTick(() => {
popupRef.value?.focus();
});
}
}
if (!show && opened) {
opened = false;

View File

@ -1,4 +1,4 @@
import type { ComponentPublicInstance } from 'vue';
import type { Ref, ComponentPublicInstance } from 'vue';
import type { PopupProps } from './Popup';
export type PopupPosition = 'top' | 'left' | 'bottom' | 'right' | 'center' | '';
@ -9,4 +9,8 @@ export type PopupCloseIconPosition =
| 'bottom-left'
| 'bottom-right';
export type PopupInstance = ComponentPublicInstance<PopupProps>;
export type PopupExpose = {
popupRef: Ref<HTMLElement>;
};
export type PopupInstance = ComponentPublicInstance<PopupProps, PopupExpose>;

View File

@ -78,6 +78,7 @@
color: var(--van-submit-bar-price-color);
font-weight: var(--van-font-weight-bold);
font-size: var(--van-submit-bar-price-font-size);
margin-left: var(--van-padding-base);
&-integer {
font-size: var(--van-submit-bar-price-integer-font-size);

View File

@ -6,7 +6,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-submit-bar__bar">
<div class="van-submit-bar__text">
<span>
Total
Total:
</span>
<span class="van-submit-bar__price">
¥
@ -40,7 +40,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-submit-bar__bar">
<div class="van-submit-bar__text">
<span>
Total
Total:
</span>
<span class="van-submit-bar__price">
¥
@ -68,7 +68,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-submit-bar__bar">
<div class="van-submit-bar__text">
<span>
Total
Total:
</span>
<span class="van-submit-bar__price">
¥
@ -125,7 +125,7 @@ exports[`should render demo and match snapshot 1`] = `
</div>
<div class="van-submit-bar__text">
<span>
Total
Total:
</span>
<span class="van-submit-bar__price">
¥