Skip to content

Commit dd6e2c5

Browse files
committed
feat(locales): [locales] Optimize the style and demo
1 parent f6f512f commit dd6e2c5

File tree

13 files changed

+109
-25
lines changed

13 files changed

+109
-25
lines changed

examples/sites/demos/pc/app/amount/size-composition-api.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<template>
22
<tiny-amount size="medium" v-model="value" :date="date"></tiny-amount>
3+
<br />
4+
<tiny-amount v-model="value" :date="date"></tiny-amount>
5+
<br />
6+
<tiny-amount size="small" v-model="value" :date="date"></tiny-amount>
7+
<br />
8+
<tiny-amount size="mini" v-model="value" :date="date"></tiny-amount>
39
</template>
410

511
<script setup lang="jsx">

examples/sites/demos/pc/app/amount/size.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<template>
22
<tiny-amount size="medium" v-model="value" :date="date"></tiny-amount>
3+
<br />
4+
<tiny-amount v-model="value" :date="date"></tiny-amount>
5+
<br />
6+
<tiny-amount size="small" v-model="value" :date="date"></tiny-amount>
7+
<br />
8+
<tiny-amount size="mini" v-model="value" :date="date"></tiny-amount>
39
</template>
410

511
<script lang="jsx">

examples/sites/demos/pc/app/area/custom-service-composition-api.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function getJCR() {
2323
id: '3623',
2424
id_and_type: '3623JCR',
2525
parent_and_type: null,
26-
name: 'A公司 Marketing与销售服务部',
26+
name: 'A公司销售服务部',
2727
date_from: '2005/06/21 00:00:00',
2828
name_en: 'Consumer BG Marketing and Sales Service Dept',
2929
parent_type: null,
@@ -36,7 +36,7 @@ function getJCR() {
3636
id: '650561',
3737
id_and_type: '650561JCR',
3838
parent_and_type: null,
39-
name: 'A公司 Marketing与销售服务部(东莞)',
39+
name: 'A公司销售服务部(东莞)',
4040
date_from: '2012/09/27 00:00:00',
4141
name_en: 'Consumer BG Marketing and Sales Service Dept (Dongguan)',
4242
parent_type: null,

examples/sites/demos/pc/app/area/custom-service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test('测试自定义服务', async ({ page }) => {
3434
await getSelectItem(areaRep).first().click()
3535
await areaInput.nth(3).click()
3636
await getSelectItem(areaOffice).first().click()
37-
await expect(areaInput.first()).toHaveValue('A公司 Marketing与销售服务部')
37+
await expect(areaInput.first()).toHaveValue('A公司销售服务部')
3838
await expect(areaInput.nth(1)).toHaveValue('火星终端子公司')
3939
await expect(areaInput.nth(2)).toHaveValue('北京代表处')
4040
await expect(areaInput.nth(3)).toHaveValue('牙买加办事处')

examples/sites/demos/pc/app/area/custom-service.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default {
3030
id: '3623',
3131
id_and_type: '3623JCR',
3232
parent_and_type: null,
33-
name: 'A公司 Marketing与销售服务部',
33+
name: 'A公司销售服务部',
3434
date_from: '2005/06/21 00:00:00',
3535
name_en: 'Consumer BG Marketing and Sales Service Dept',
3636
parent_type: null,
@@ -43,7 +43,7 @@ export default {
4343
id: '650561',
4444
id_and_type: '650561JCR',
4545
parent_and_type: null,
46-
name: 'A公司 Marketing与销售服务部(东莞)',
46+
name: 'A公司销售服务部(东莞)',
4747
date_from: '2012/09/27 00:00:00',
4848
name_en: 'Consumer BG Marketing and Sales Service Dept (Dongguan)',
4949
parent_type: null,

examples/sites/demos/pc/app/locales/custom-service-composition-api.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import { TinyLocales } from '@opentiny/vue'
1111
1212
function getLocale() {
1313
// resolve 出来的必须是国际化的 key
14-
return Promise.resolve(['zhCN', 'enUS', 'zhTW'])
14+
return Promise.resolve(['zh_CN', 'en_US', 'zh_TW'])
1515
}
1616
1717
function getCurrentLocale() {
18-
return Promise.resolve(['zhCN'])
18+
return Promise.resolve(['zh_CN'])
1919
}
2020
2121
function getChangeLocaleUrl(targetLocale) {
22-
if (targetLocale === 'enUS') {
22+
if (targetLocale === 'en_US') {
2323
return Promise.resolve(`${window.location.origin}/#/webenglish/en-US/component/locales/custom-service`)
2424
} else {
2525
return Promise.resolve(`${window.location.origin}/#/zh-CN/component/custom-service`)

examples/sites/demos/pc/app/locales/custom-service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test('locales-custom-service', async ({ page }) => {
88
const reference = demo.locator('.reference-wrapper')
99
const popper = page.locator('.tiny-locales__popper')
1010

11-
await expect(reference).toHaveText('zhCN')
11+
await expect(reference).toHaveText('zh_CN')
1212
await expect(popper).toBeHidden()
1313
await reference.hover()
1414
await page.waitForTimeout(200)

examples/sites/demos/pc/app/locales/custom-service.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ export default {
1616
methods: {
1717
getLocale() {
1818
// resolve 出来的必须是国际化的 key
19-
return Promise.resolve(['zhCN', 'enUS', 'zhTW'])
19+
return Promise.resolve(['zh_CN', 'en_US', 'zh_TW'])
2020
},
2121
getCurrentLocale() {
22-
return Promise.resolve(['zhCN'])
22+
return Promise.resolve(['zh_CN'])
2323
},
2424
getChangeLocaleUrl(targetLocale) {
25-
if (targetLocale === 'enUS') {
25+
if (targetLocale === 'en_US') {
2626
return Promise.resolve(`${window.location.origin}/#/webenglish/en-US/component/locales/custom-service`)
2727
} else {
2828
return Promise.resolve(`${window.location.origin}/#/zh-CN/component/custom-service`)

packages/theme/src/area/index.less

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@
1111
*/
1212

1313
@import '../custom.less';
14+
@import './vars.less';
1415

1516
@area-prefix-cls: ~'@{css-prefix}area';
1617
@select-prefix-cls: ~'@{css-prefix}select';
1718

1819
.@{area-prefix-cls} {
1920
.@{select-prefix-cls} {
20-
width: 270px;
21-
margin-right: 10px;
22-
margin-bottom: 10px;
21+
.inject-Area-vars();
22+
23+
width: 220px;
24+
margin-right: var(--tv-Area-select-margin-right);
25+
margin-bottom: var(--tv-Area-select-margin-bottom);;
2326
}
2427
}

packages/theme/src/area/vars.less

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Copyright (c) 2022 - present TinyVue Authors.
3+
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4+
*
5+
* Use of this source code is governed by an MIT-style license.
6+
*
7+
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8+
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9+
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10+
*
11+
*/
12+
13+
.inject-Area-vars() {
14+
// 选中框间距
15+
--tv-Area-select-margin-right: var(--tv-space-xl, 16px);
16+
--tv-Area-select-margin-bottom: var(--tv-space-xl, 16px);
17+
}

0 commit comments

Comments
 (0)