From 0d75e7d3872f3f319b38b64f601f8542ca79885c Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Mon, 20 Mar 2023 23:04:41 +0800 Subject: [PATCH] 0.15.0 (#524) * chore: update site-components * fix(Loading): fix loading render in safari * fix(Tag): update style (#507) * fix(Tag): update style * fix: fix type * style: update common * fix: fix cr * feat(Stepper): new stepper (#518) * feat(Stepper): support size attr * feat: adjust the api document path to the v2 folder * feat(radio): new radio (#517) * feat(radio): update api * refactor(radio): move radio-group folder * fix: import less use new way * feat(radio): enrich property * test(radio): update unit test * test: update snapshot * feat(switch): enrich property (#520) * feat(switch): enrich property * feat(switch): finish new switch * test(switch): update unit test * test(switch): update snapshots * test(switch): update snapshots * test: update snapshot * chore: publish v0.15.0 (#522) * chore: publish v0.15.0 * chore: changelog's changes --------- Co-authored-by: github-actions[bot] --------- Co-authored-by: HQ-Lin Co-authored-by: Y Co-authored-by: yuyang Co-authored-by: github-actions[bot] --- CHANGELOG.md | 20 + package.json | 16 +- site/mobile/main.ts | 1 - site/web/main.ts | 3 +- site/web/plugin-tdoc/transforms.js | 2 +- src/_common | 2 +- src/action-sheet/action-sheet.vue | 4 +- src/action-sheet/menu-grid.vue | 4 +- src/action-sheet/menu-list.vue | 4 +- src/avatar/avatar.vue | 4 +- .../__test__/__snapshots__/demo.test.jsx.snap | 236 - src/back-top/__test__/demo.test.jsx | 6 - src/back-top/back-top.vue | 4 +- src/back-top/demos/base.vue | 51 - src/back-top/demos/mobile.vue | 2 +- src/back-top/demos/target.vue | 27 - src/back-top/demos/theme.vue | 20 - src/button/button.vue | 4 +- src/calendar/demos/custom-text.vue | 13 +- src/cascader/cascader-item.vue | 4 +- src/cascader/cascader.vue | 4 +- .../__test__/__snapshots__/demo.test.jsx.snap | 42 +- src/cell/cell.vue | 4 +- .../__test__/__snapshots__/demo.test.jsx.snap | 8 +- src/checkbox/checkbox.vue | 4 +- src/checkbox/group.vue | 4 +- src/collapse/collapse-panel.vue | 14 +- src/collapse/collapse.vue | 4 +- src/common.ts | 36 +- src/components.ts | 3 +- .../__test__/__snapshots__/demo.test.jsx.snap | 60 +- .../__snapshots__/index.test.jsx.snap | 14 +- src/date-time-picker/__test__/index.test.jsx | 4 +- src/date-time-picker/date-time-picker.vue | 4 +- src/dialog/index.ts | 2 +- src/drawer/drawer.vue | 4 +- .../__snapshots__/index.test.jsx.snap | 158 +- src/dropdown-menu/__test__/index.test.jsx | 83 +- src/dropdown-menu/demos/demo-container.vue | 12 +- src/dropdown-menu/dropdown-item.vue | 21 +- src/fab/fab.vue | 4 +- src/icon/demos/base.vue | 2 +- src/icon/demos/enhanced.vue | 2 +- src/icon/demos/iconfont.vue | 2 +- src/icon/demos/single.vue | 2 +- src/image-viewer/image-viewer.vue | 14 +- src/image/image.vue | 4 +- src/indexes/indexes.vue | 3 +- src/input/input.vue | 4 +- src/list/list.vue | 4 +- .../__test__/__snapshots__/demo.test.jsx.snap | 126 +- .../__snapshots__/index.test.jsx.snap | 12 +- src/loading/icon/gradient.vue | 4 +- src/message/index.ts | 2 +- src/message/message.vue | 3 +- src/navbar/navbar.vue | 4 +- src/notice-bar/notice-bar.vue | 3 +- .../__test__/__snapshots__/demo.test.jsx.snap | 44 +- src/picker/cascade.vue | 4 +- src/picker/picker-item.vue | 4 +- src/picker/picker.vue | 4 +- src/popup/popup.vue | 4 +- src/pull-down-refresh/pull-down-refresh.vue | 4 +- src/radio-group/index.ts | 5 - src/radio-group/radio-group.md | 7 - src/radio-group/style/css.js | 1 - src/radio-group/style/index.js | 1 - .../__test__/__snapshots__/demo.test.jsx.snap | 4055 +++++++---------- .../__snapshots__/index.test.jsx.snap | 122 +- src/radio/__test__/demo.test.jsx | 18 +- src/radio/__test__/index.test.jsx | 95 +- src/radio/demos/base.vue | 12 +- src/radio/demos/card.vue | 27 + src/radio/demos/custom.vue | 86 + src/radio/demos/group.vue | 42 - src/radio/demos/horizontal.vue | 29 + src/radio/demos/icon.vue | 10 +- src/radio/demos/leftStrokeLine.vue | 35 - src/radio/demos/mobile.vue | 34 +- src/radio/demos/placement.vue | 12 + src/radio/demos/right.vue | 20 - src/radio/demos/rightStrovkeLine.vue | 37 - src/radio/demos/size.vue | 37 - src/radio/demos/status.vue | 24 +- src/radio/index.ts | 3 + src/radio/props.ts | 44 +- src/radio/radio-group-props.ts | 23 +- src/{radio-group => radio}/radio-group.vue | 17 +- src/radio/radio.en-US.md | 52 + src/radio/radio.md | 36 +- src/radio/radio.vue | 123 +- src/radio/style/index.js | 2 +- src/radio/type.ts | 88 +- src/rate/rate.vue | 4 +- src/result/result.vue | 2 +- src/shared/useDefault/index.ts | 4 +- src/shared/useEmitEvent/index.ts | 2 +- src/slider/slider.vue | 4 +- .../__test__/__snapshots__/demo.test.jsx.snap | 1615 +++---- src/stepper/__test__/demo.test.jsx | 10 +- src/stepper/__test__/index.test.jsx | 24 +- src/stepper/demos/base.vue | 15 +- src/stepper/demos/min-max.vue | 41 + src/stepper/demos/mobile.vue | 24 +- src/stepper/demos/pure-stepper.vue | 9 - src/stepper/demos/size.vue | 27 + src/stepper/demos/status.vue | 47 +- src/stepper/demos/theme.vue | 17 + src/stepper/demos/unit-stepper.vue | 32 - src/stepper/props.ts | 16 +- src/stepper/stepper.en-US.md | 28 + src/stepper/stepper.md | 17 +- src/stepper/stepper.vue | 65 +- src/stepper/style/index.js | 2 +- src/stepper/type.ts | 22 +- .../__test__/__snapshots__/demo.test.jsx.snap | 52 +- src/steps/steps.vue | 4 +- src/style/css.js | 2 +- src/style/index.js | 2 +- .../__test__/__snapshots__/demo.test.jsx.snap | 256 +- src/swipe-cell/demos/bind.vue | 4 +- src/swipe-cell/demos/btns.vue | 13 +- src/swipe-cell/demos/disabled.vue | 2 +- src/swipe-cell/demos/left-more-menu.vue | 43 +- src/swipe-cell/demos/left-two-menu.vue | 4 +- src/swipe-cell/swipe-cell.vue | 14 +- .../__snapshots__/index.test.jsx.snap | 81 - src/swiper/__test__/index.test.jsx | 241 +- src/swiper/swiper.vue | 3 +- .../__test__/__snapshots__/demo.test.jsx.snap | 1572 ++++--- src/switch/__test__/demo.test.jsx | 12 +- src/switch/__test__/index.test.jsx | 58 +- src/switch/demos/base.vue | 34 +- src/switch/demos/color.vue | 13 + src/switch/demos/desc.vue | 27 - src/switch/demos/disabled.vue | 32 - src/switch/demos/label.vue | 20 + src/switch/demos/mobile.vue | 25 +- src/switch/demos/size.vue | 23 + src/switch/demos/status.vue | 40 + src/switch/props.ts | 29 +- src/switch/style/index.js | 2 +- src/switch/switch.en-US.md | 23 + src/switch/switch.md | 19 +- src/switch/switch.vue | 60 +- src/switch/type.ts | 43 +- src/tab-bar/tab-bar.vue | 4 +- src/tabs/tabs.vue | 3 +- .../__test__/__snapshots__/demo.test.jsx.snap | 84 +- src/tag/__test__/index.test.jsx | 12 +- src/tag/check-tag.vue | 8 +- src/tag/tag.vue | 12 +- src/textarea/textarea.vue | 4 +- .../__test__/__snapshots__/demo.test.jsx.snap | 65 - src/toast/__test__/demo.test.jsx | 2 - src/toast/demos/icon.vue | 19 - src/toast/demos/position.vue | 2 +- src/toast/demos/preventScrollThrough.vue | 2 +- src/toast/demos/text.vue | 2 +- src/toast/index.ts | 2 +- src/upload/upload.vue | 4 +- tsconfig.build.json | 13 - tsconfig.json | 8 +- 163 files changed, 5039 insertions(+), 6255 deletions(-) delete mode 100644 src/back-top/demos/base.vue delete mode 100644 src/back-top/demos/target.vue delete mode 100644 src/back-top/demos/theme.vue delete mode 100644 src/radio-group/index.ts delete mode 100644 src/radio-group/radio-group.md delete mode 100644 src/radio-group/style/css.js delete mode 100644 src/radio-group/style/index.js create mode 100644 src/radio/demos/card.vue create mode 100644 src/radio/demos/custom.vue delete mode 100644 src/radio/demos/group.vue create mode 100644 src/radio/demos/horizontal.vue delete mode 100644 src/radio/demos/leftStrokeLine.vue create mode 100644 src/radio/demos/placement.vue delete mode 100644 src/radio/demos/right.vue delete mode 100644 src/radio/demos/rightStrovkeLine.vue delete mode 100644 src/radio/demos/size.vue rename src/{radio-group => radio}/radio-group.vue (82%) create mode 100644 src/radio/radio.en-US.md create mode 100644 src/stepper/demos/min-max.vue delete mode 100644 src/stepper/demos/pure-stepper.vue create mode 100644 src/stepper/demos/size.vue create mode 100644 src/stepper/demos/theme.vue delete mode 100644 src/stepper/demos/unit-stepper.vue create mode 100644 src/stepper/stepper.en-US.md delete mode 100644 src/swiper/__test__/__snapshots__/index.test.jsx.snap create mode 100644 src/switch/demos/color.vue delete mode 100644 src/switch/demos/desc.vue delete mode 100644 src/switch/demos/disabled.vue create mode 100644 src/switch/demos/label.vue create mode 100644 src/switch/demos/size.vue create mode 100644 src/switch/demos/status.vue create mode 100644 src/switch/switch.en-US.md delete mode 100644 src/toast/demos/icon.vue delete mode 100644 tsconfig.build.json diff --git a/CHANGELOG.md b/CHANGELOG.md index ead19a7d9..e59dd56fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,26 @@ toc: false spline: explain --- +## 🌈 0.15.0 `2023-03-20` +### ❗ BREAKING CHANGES +- `Stepper`: 属性 theme 的 gray 主题更名为 filled,并新增 outline 主题 @anlyyao ([#518](https://github.com/Tencent/tdesign-mobile-vue/pull/518)) +- `Radio`: 属性 align 更名为 placement @LeeJim ([#517](https://github.com/Tencent/tdesign-mobile-vue/pull/517)) +- `Radio`: 属性 icon 的枚举值变更、DOM 变更 @LeeJim ([#517](https://github.com/Tencent/tdesign-mobile-vue/pull/517)) +- `Switch`: 废弃 colors 属性,改用 CSS Variables @LeeJim ([#520](https://github.com/Tencent/tdesign-mobile-vue/pull/520)) +- `Switch`: 属性 label 的类型从 string 变为 array @LeeJim ([#520](https://github.com/Tencent/tdesign-mobile-vue/pull/520)) +- `Switch`: 优化 DOM @LeeJim ([#520](https://github.com/Tencent/tdesign-mobile-vue/pull/520)) + +### 🚀 Features +- `Tag`: 支持 css variable @anlyyao ([#507](https://github.com/Tencent/tdesign-mobile-vue/pull/507)) +- `Stepper`: 新增 size 属性 @anlyyao ([#518](https://github.com/Tencent/tdesign-mobile-vue/pull/518)) +- `Radio`: 新增支持 allowUncheck、block、maxContentRow、maxLabelRow 属性 @LeeJim ([#517](https://github.com/Tencent/tdesign-mobile-vue/pull/517)) +- `RadioGroup`: 新增支持 allowUncheck、borderless、keys、placement 属性 @LeeJim ([#517](https://github.com/Tencent/tdesign-mobile-vue/pull/517)) +- `Swtich`: 新增 icon、loading、size 属性 @LeeJim ([#520](https://github.com/Tencent/tdesign-mobile-vue/pull/520)) +### 🐞 Bug Fixes +- `Loading`: 修复部分浏览器下 loading 晃动问题 @anlyyao ([#505](https://github.com/Tencent/tdesign-mobile-vue/pull/505)) +- `Stepper`: 修复 min/max 存在时,输入受限问题 @anlyyao ([#518](https://github.com/Tencent/tdesign-mobile-vue/pull/518)) + + ## 🌈 0.14.1 `2022-11-14` ### 🚧 Others - `Badge`: 提升测试覆盖率 @anlyyao ([#479](https://github.com/Tencent/tdesign-mobile-vue/pull/479)) diff --git a/package.json b/package.json index 6df964c20..e0a58ff18 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tdesign-mobile-vue", "purename": "tdesign", - "version": "0.14.1", + "version": "0.15.0", "description": "tdesign-mobile-vue", "author": "TDesign Group", "homepage": "https://tdesign.tencent.com/mobile-vue/", @@ -20,9 +20,9 @@ "prebuild": "rimraf dist/* lib/* es/* esm/* typings/*", "build": "cross-env NODE_ENV=production rollup -c scripts/rollup.config.js && npm run build:tsc", "build:tsc": "concurrently \"npm:build:tsc-*\"", - "build:tsc-es": "vue-tsc --declaration --emitDeclarationOnly --outDir es/ -p tsconfig.build.json", - "build:tsc-esm": "vue-tsc --declaration --emitDeclarationOnly --outDir esm/ -p tsconfig.build.json", - "build:tsc-lib": "vue-tsc --declaration --emitDeclarationOnly --outDir lib/ -p tsconfig.build.json", + "build:tsc-es": "vue-tsc --declaration --emitDeclarationOnly --outDir es/", + "build:tsc-esm": "vue-tsc --declaration --emitDeclarationOnly --outDir esm/", + "build:tsc-lib": "vue-tsc --declaration --emitDeclarationOnly --outDir lib/", "site": "cd site && vite build", "site:intranet": "cd site && vite build --mode intranet", "site:preview": "cd site && vite build --mode preview", @@ -109,15 +109,15 @@ "@rollup/plugin-url": "^6.0.0", "@soerenmartius/vue3-clipboard": "^0.1.1", "@types/jest": "^28.1.6", - "@types/prismjs": "^1.16.2", "@types/node": "18.8.0", + "@types/prismjs": "^1.16.2", "@typescript-eslint/eslint-plugin": "^5.5.0", "@typescript-eslint/parser": "~5.34.0", "@vitejs/plugin-vue": "^1.2.3", "@vitejs/plugin-vue-jsx": "^1.3.3", "@vitest/ui": "^0.16.0", "@vue/eslint-config-typescript": "^9.1.0", - "@vue/runtime-core": "3.2.41", + "@vue/runtime-core": "^3.2.41", "@vue/test-utils": "^2.0.0-rc.17", "autoprefixer": "^10.2.4", "axios": "^0.21.0", @@ -161,13 +161,13 @@ "rollup-pluginutils": "^2.8.2", "tdesign-icons-view": "^0.1.0", "tdesign-publish-cli": "^0.0.10", - "tdesign-site-components": "0.11.15", + "tdesign-site-components": "^0.11.19", "tslib": "^2.3.1", "typescript": "~4.7.2", "vite": "^2.9.14", "vite-plugin-tdoc": "^2.0.1", "vitest": "^0.16.0", - "vue": "^3.2.33", + "vue": "^3.2.47", "vue-eslint-parser": "^8.0.1", "vue-router": "4.0.11", "vue-tsc": "^0.40.0" diff --git a/site/mobile/main.ts b/site/mobile/main.ts index faa003f44..b3389ff79 100644 --- a/site/mobile/main.ts +++ b/site/mobile/main.ts @@ -6,7 +6,6 @@ import router from './router'; import TDesign from '@/index'; import '../../src/_common/style/mobile/_reset.less'; -import '../../src/_common/style/mobile/index.less'; import '../styles/mobile/index.less'; createApp(app) diff --git a/site/web/main.ts b/site/web/main.ts index cfde4caef..0dd67826c 100644 --- a/site/web/main.ts +++ b/site/web/main.ts @@ -5,8 +5,7 @@ import TDesign from '@/index'; import Stackblitz from './stackblitz/index.vue'; // import tdesign style -import '@common/style/mobile/_reset.less'; -import '@common/style/mobile/index.less'; +import 'tdesign-mobile-vue/style/index.js'; // import site webcomponents import 'tdesign-site-components'; diff --git a/site/web/plugin-tdoc/transforms.js b/site/web/plugin-tdoc/transforms.js index 1e835d801..b6a605334 100644 --- a/site/web/plugin-tdoc/transforms.js +++ b/site/web/plugin-tdoc/transforms.js @@ -14,7 +14,7 @@ export default { // 统一换成 common 文档内容 if (name && source.includes(':: BASE_DOC ::')) { - const docPath = path.resolve(__dirname, `../../../src/_common/docs/mobile/api/${name}.md`); + const docPath = path.resolve(__dirname, `../../../src/_common/docs/mobile/api_v2/${name}.md`); if (fs.existsSync(docPath)) { const baseDoc = fs.readFileSync(docPath, 'utf-8'); source = source.replace(':: BASE_DOC ::', baseDoc); diff --git a/src/_common b/src/_common index 0f49a8975..0a709515d 160000 --- a/src/_common +++ b/src/_common @@ -1 +1 @@ -Subproject commit 0f49a89751a960aefce24fc1b8e4f50f49613397 +Subproject commit 0a709515dd1bdebc42e18f4224c6b99395b01a55 diff --git a/src/action-sheet/action-sheet.vue b/src/action-sheet/action-sheet.vue index 9d11256f2..85d9e4cb5 100644 --- a/src/action-sheet/action-sheet.vue +++ b/src/action-sheet/action-sheet.vue @@ -23,7 +23,7 @@ - - diff --git a/src/back-top/demos/mobile.vue b/src/back-top/demos/mobile.vue index b293961d8..d81f571d7 100644 --- a/src/back-top/demos/mobile.vue +++ b/src/back-top/demos/mobile.vue @@ -49,7 +49,7 @@ const rowCols = [ ]; window.document.addEventListener('scroll', function (e: Event) { - const { scrollTop } = e.currentTarget?.scrollingElement || {}; + const { scrollTop = 0 } = (e.currentTarget as Document)?.scrollingElement || {}; if (scrollTop <= 300) { style.value = { display: 'none' }; } else { diff --git a/src/back-top/demos/target.vue b/src/back-top/demos/target.vue deleted file mode 100644 index 0a51234d4..000000000 --- a/src/back-top/demos/target.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - - - diff --git a/src/back-top/demos/theme.vue b/src/back-top/demos/theme.vue deleted file mode 100644 index 2ff10be8f..000000000 --- a/src/back-top/demos/theme.vue +++ /dev/null @@ -1,20 +0,0 @@ - - - - - diff --git a/src/button/button.vue b/src/button/button.vue index e76f1ca61..8af780218 100644 --- a/src/button/button.vue +++ b/src/button/button.vue @@ -8,7 +8,7 @@ + + diff --git a/src/radio/demos/custom.vue b/src/radio/demos/custom.vue new file mode 100644 index 000000000..e162b45b4 --- /dev/null +++ b/src/radio/demos/custom.vue @@ -0,0 +1,86 @@ + + + + diff --git a/src/radio/demos/group.vue b/src/radio/demos/group.vue deleted file mode 100644 index ba6935755..000000000 --- a/src/radio/demos/group.vue +++ /dev/null @@ -1,42 +0,0 @@ - - - diff --git a/src/radio/demos/horizontal.vue b/src/radio/demos/horizontal.vue new file mode 100644 index 000000000..e1a1ee8cd --- /dev/null +++ b/src/radio/demos/horizontal.vue @@ -0,0 +1,29 @@ + + + + + diff --git a/src/radio/demos/icon.vue b/src/radio/demos/icon.vue index 3c0658de0..43833663a 100644 --- a/src/radio/demos/icon.vue +++ b/src/radio/demos/icon.vue @@ -1,11 +1,8 @@ + + diff --git a/src/radio/demos/mobile.vue b/src/radio/demos/mobile.vue index 347956551..0355eaac1 100644 --- a/src/radio/demos/mobile.vue +++ b/src/radio/demos/mobile.vue @@ -2,42 +2,42 @@

Radio 单选框

用于在预设的一组选项中执行单项选择,并呈现选择结果。

- + - - + + - - + + - - + + - - + + - - + + - - + +
diff --git a/src/radio/demos/placement.vue b/src/radio/demos/placement.vue new file mode 100644 index 000000000..1620725b1 --- /dev/null +++ b/src/radio/demos/placement.vue @@ -0,0 +1,12 @@ + + + + + diff --git a/src/radio/demos/right.vue b/src/radio/demos/right.vue deleted file mode 100644 index 52f60bb16..000000000 --- a/src/radio/demos/right.vue +++ /dev/null @@ -1,20 +0,0 @@ - - - diff --git a/src/radio/demos/rightStrovkeLine.vue b/src/radio/demos/rightStrovkeLine.vue deleted file mode 100644 index e9eff51e0..000000000 --- a/src/radio/demos/rightStrovkeLine.vue +++ /dev/null @@ -1,37 +0,0 @@ - - - diff --git a/src/radio/demos/size.vue b/src/radio/demos/size.vue deleted file mode 100644 index bba032374..000000000 --- a/src/radio/demos/size.vue +++ /dev/null @@ -1,37 +0,0 @@ - - - diff --git a/src/radio/demos/status.vue b/src/radio/demos/status.vue index 5dc95056f..f418fd855 100644 --- a/src/radio/demos/status.vue +++ b/src/radio/demos/status.vue @@ -1,36 +1,20 @@ + + diff --git a/src/stepper/demos/min-max.vue b/src/stepper/demos/min-max.vue new file mode 100644 index 000000000..5d8847f8f --- /dev/null +++ b/src/stepper/demos/min-max.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/src/stepper/demos/mobile.vue b/src/stepper/demos/mobile.vue index db454416f..f52ae5dee 100644 --- a/src/stepper/demos/mobile.vue +++ b/src/stepper/demos/mobile.vue @@ -1,27 +1,29 @@ diff --git a/src/stepper/demos/pure-stepper.vue b/src/stepper/demos/pure-stepper.vue deleted file mode 100644 index 8e5b948b4..000000000 --- a/src/stepper/demos/pure-stepper.vue +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/src/stepper/demos/size.vue b/src/stepper/demos/size.vue new file mode 100644 index 000000000..3481b3a94 --- /dev/null +++ b/src/stepper/demos/size.vue @@ -0,0 +1,27 @@ + + + + + diff --git a/src/stepper/demos/status.vue b/src/stepper/demos/status.vue index 4356aed5e..3db3b5dd0 100644 --- a/src/stepper/demos/status.vue +++ b/src/stepper/demos/status.vue @@ -1,43 +1,12 @@ - + diff --git a/src/stepper/demos/theme.vue b/src/stepper/demos/theme.vue new file mode 100644 index 000000000..156f32e2e --- /dev/null +++ b/src/stepper/demos/theme.vue @@ -0,0 +1,17 @@ + + + diff --git a/src/stepper/demos/unit-stepper.vue b/src/stepper/demos/unit-stepper.vue deleted file mode 100644 index 45ac68dca..000000000 --- a/src/stepper/demos/unit-stepper.vue +++ /dev/null @@ -1,32 +0,0 @@ - - - diff --git a/src/stepper/props.ts b/src/stepper/props.ts index a3ac80139..3af219423 100644 --- a/src/stepper/props.ts +++ b/src/stepper/props.ts @@ -8,10 +8,10 @@ import { TdStepperProps } from './type'; import { PropType } from 'vue'; export default { - /** 禁用全部操作 */ - disabled: Boolean, /** 禁用输入框 */ disableInput: Boolean, + /** 禁用全部操作 */ + disabled: Boolean, /** 输入框宽度 */ inputWidth: { type: Number, @@ -26,6 +26,15 @@ export default { type: Number, default: 0, }, + /** 组件尺寸 */ + size: { + type: String as PropType, + default: 'medium' as TdStepperProps['size'], + validator(val: TdStepperProps['size']): boolean { + if (!val) return true; + return ['small', 'medium', 'large'].includes(val); + }, + }, /** 步长 */ step: { type: Number, @@ -36,7 +45,8 @@ export default { type: String as PropType, default: 'normal' as TdStepperProps['theme'], validator(val: TdStepperProps['theme']): boolean { - return ['normal', 'grey'].includes(val!); + if (!val) return true; + return ['normal', 'filled', 'outline'].includes(val); }, }, /** 值 */ diff --git a/src/stepper/stepper.en-US.md b/src/stepper/stepper.en-US.md new file mode 100644 index 000000000..408c6c2a1 --- /dev/null +++ b/src/stepper/stepper.en-US.md @@ -0,0 +1,28 @@ +:: BASE_DOC :: + +## API +### Stepper Props + +name | type | default | description | required +-- | -- | -- | -- | -- +disableInput | Boolean | false | \- | N +disabled | Boolean | false | \- | N +inputWidth | Number | - | \- | N +max | Number | 100 | \- | N +min | Number | 0 | \- | N +size | String | medium | options:small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N +step | Number | 1 | \- | N +theme | String | normal | stylish。options:normal/filled/outline | N +value | String / Number | 0 | `v-model` and `v-model:value` is supported | N +defaultValue | String / Number | 0 | uncontrolled property | N +onBlur | Function | | Typescript:`(value: string \| number) => void`
| N +onChange | Function | | Typescript:`(value: string \| number) => void`
| N +onOverlimit | Function | | Typescript:`(type: 'minus' \| 'plus') => void`
| N + +### Stepper Events + +name | params | description +-- | -- | -- +blur | `(value: string \| number)` | \- +change | `(value: string \| number)` | \- +overlimit | `(type: 'minus' \| 'plus')` | \- diff --git a/src/stepper/stepper.md b/src/stepper/stepper.md index 5bbedcb9b..4184b724b 100644 --- a/src/stepper/stepper.md +++ b/src/stepper/stepper.md @@ -5,23 +5,24 @@ 名称 | 类型 | 默认值 | 说明 | 必传 -- | -- | -- | -- | -- -disabled | Boolean | false | 禁用全部操作 | N disableInput | Boolean | false | 禁用输入框 | N +disabled | Boolean | false | 禁用全部操作 | N inputWidth | Number | - | 输入框宽度 | N max | Number | 100 | 最大值 | N min | Number | 0 | 最小值 | N +size | String | medium | 组件尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N step | Number | 1 | 步长 | N -theme | String | normal | 组件风格。可选项:normal/grey | N +theme | String | normal | 组件风格。可选项:normal/filled/outline | N value | String / Number | 0 | 值。支持语法糖 `v-model` 或 `v-model:value` | N defaultValue | String / Number | 0 | 值。非受控属性 | N -onBlur | Function | | TS 类型:`(value: string | number) => void`
输入框失去焦点时触发 | N -onChange | Function | | TS 类型:`(value: string | number) => void`
数值发生变更时触发 | N -onOverlimit | Function | | TS 类型:`(type: 'minus' | 'plus') => void`
数值超出限制时触发 | N +onBlur | Function | | TS 类型:`(value: string \| number) => void`
输入框失去焦点时触发 | N +onChange | Function | | TS 类型:`(value: string \| number) => void`
数值发生变更时触发 | N +onOverlimit | Function | | TS 类型:`(type: 'minus' \| 'plus') => void`
数值超出限制时触发 | N ### Stepper Events 名称 | 参数 | 描述 -- | -- | -- -blur | `(value: string | number)` | 输入框失去焦点时触发 -change | `(value: string | number)` | 数值发生变更时触发 -overlimit | `(type: 'minus' | 'plus')` | 数值超出限制时触发 +blur | `(value: string \| number)` | 输入框失去焦点时触发 +change | `(value: string \| number)` | 数值发生变更时触发 +overlimit | `(type: 'minus' \| 'plus')` | 数值超出限制时触发 diff --git a/src/stepper/stepper.vue b/src/stepper/stepper.vue index 418943f99..5e809fd95 100644 --- a/src/stepper/stepper.vue +++ b/src/stepper/stepper.vue @@ -1,36 +1,57 @@ diff --git a/src/swipe-cell/demos/left-two-menu.vue b/src/swipe-cell/demos/left-two-menu.vue index 3e420ef7d..4c3a55b08 100644 --- a/src/swipe-cell/demos/left-two-menu.vue +++ b/src/swipe-cell/demos/left-two-menu.vue @@ -1,11 +1,11 @@ diff --git a/src/switch/demos/size.vue b/src/switch/demos/size.vue new file mode 100644 index 000000000..7800fd348 --- /dev/null +++ b/src/switch/demos/size.vue @@ -0,0 +1,23 @@ + + + diff --git a/src/switch/demos/status.vue b/src/switch/demos/status.vue new file mode 100644 index 000000000..596e50d66 --- /dev/null +++ b/src/switch/demos/status.vue @@ -0,0 +1,40 @@ + + + diff --git a/src/switch/props.ts b/src/switch/props.ts index 1884439e7..c88f8b1d2 100644 --- a/src/switch/props.ts +++ b/src/switch/props.ts @@ -8,20 +8,36 @@ import { TdSwitchProps } from './type'; import { PropType } from 'vue'; export default { - /** 自定义颜色,[打开时的颜色,关闭时的颜色]。组件默认颜色为 ['#0052d9', 'rgba(0, 0, 0, .26']。示例:[blue, gray] */ + /** 已废弃。已废弃。自定义颜色,[打开时的颜色,关闭时的颜色]。组件默认颜色为 ['#0052d9', 'rgba(0, 0, 0, .26']。示例:[blue, gray] */ colors: { type: Array as PropType, }, - /** 开关内容,[打开时的值,关闭时的值]。默认为 [true, false]。示例:[1, 0] */ + /** 用于自定义开关的值,[打开时的值,关闭时的值]。默认为 [true, false]。示例:[1, 0]、['open', 'close'] */ customValue: { type: Array as PropType, }, - /** 是否禁用组件 */ + /** 是否禁用组件,默认为 false */ disabled: Boolean, - /** 开关的标签 */ + /** 开关的图标;[打开时的图标,关闭时的图标] */ + icon: { + type: Array as PropType, + default: (): TdSwitchProps['icon'] => [], + }, + /** 开关的标签;[打开时的标签,关闭时的标签] */ label: { - type: String, - default: '', + type: Array as PropType, + default: (): TdSwitchProps['label'] => [], + }, + /** 是否处于加载中状态 */ + loading: Boolean, + /** 开关尺寸 */ + size: { + type: String as PropType, + default: 'medium' as TdSwitchProps['size'], + validator(val: TdSwitchProps['size']): boolean { + if (!val) return true; + return ['small', 'medium', 'large'].includes(val); + }, }, /** 开关值 */ value: { @@ -35,7 +51,6 @@ export default { /** 开关值,非受控属性 */ defaultValue: { type: [String, Number, Boolean] as PropType, - default: undefined, }, /** 数据发生变化时触发 */ onChange: Function as PropType, diff --git a/src/switch/style/index.js b/src/switch/style/index.js index 819f6e613..84f6dd097 100644 --- a/src/switch/style/index.js +++ b/src/switch/style/index.js @@ -1 +1 @@ -import '../../_common/style/mobile/components/switch/_index.less'; +import '../../_common/style/mobile/components/switch/v2/_index.less'; diff --git a/src/switch/switch.en-US.md b/src/switch/switch.en-US.md new file mode 100644 index 000000000..8a22fcb86 --- /dev/null +++ b/src/switch/switch.en-US.md @@ -0,0 +1,23 @@ +:: BASE_DOC :: + +## API +### Switch Props + +name | type | default | description | required +-- | -- | -- | -- | -- +colors | Array | - | `deprecated`。Typescript:`string[]` | N +customValue | Array | - | Typescript:`Array` | N +disabled | Boolean | - | \- | N +icon | Array | [] | Typescript:`TNode[]`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N +label | Array | [] | Typescript:`string[]` | N +loading | Boolean | false | \- | N +size | String | medium | options:small/medium/large | N +value | String / Number / Boolean | - | `v-model` and `v-model:value` is supported。Typescript:`T` `type SwitchValue = string \| number \| boolean`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/switch/type.ts) | N +defaultValue | String / Number / Boolean | - | uncontrolled property。Typescript:`T` `type SwitchValue = string \| number \| boolean`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/switch/type.ts) | N +onChange | Function | | Typescript:`(value: T) => void`
| N + +### Switch Events + +name | params | description +-- | -- | -- +change | `(value: T)` | \- diff --git a/src/switch/switch.md b/src/switch/switch.md index 31de635f1..1acd903ae 100644 --- a/src/switch/switch.md +++ b/src/switch/switch.md @@ -5,16 +5,19 @@ 名称 | 类型 | 默认值 | 说明 | 必传 -- | -- | -- | -- | -- -colors | Array | - | 自定义颜色,[打开时的颜色,关闭时的颜色]。组件默认颜色为 ['#0052d9', 'rgba(0, 0, 0, .26']。示例:[blue, gray]。TS 类型:`string[]` | N -customValue | Array | - | 开关内容,[打开时的值,关闭时的值]。默认为 [true, false]。示例:[1, 0]。TS 类型:`Array` | N -disabled | Boolean | false | 是否禁用组件 | N -label | String | '' | 开关的标签 | N -value | String / Number / Boolean | undefined | 开关值。支持语法糖 `v-model` 或 `v-model:value`。TS 类型:`SwitchValue` `type SwitchValue = string | number | boolean`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/switch/type.ts) | N -defaultValue | String / Number / Boolean | undefined | 开关值。非受控属性。TS 类型:`SwitchValue` `type SwitchValue = string | number | boolean`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/switch/type.ts) | N -onChange | Function | | TS 类型:`(value: SwitchValue) => void`
数据发生变化时触发 | N +colors | Array | - | 已废弃。已废弃。自定义颜色,[打开时的颜色,关闭时的颜色]。组件默认颜色为 ['#0052d9', 'rgba(0, 0, 0, .26']。示例:[blue, gray]。TS 类型:`string[]` | N +customValue | Array | - | 用于自定义开关的值,[打开时的值,关闭时的值]。默认为 [true, false]。示例:[1, 0]、['open', 'close']。TS 类型:`Array` | N +disabled | Boolean | - | 是否禁用组件,默认为 false | N +icon | Array | [] | 开关的图标;[打开时的图标,关闭时的图标]。TS 类型:`TNode[]`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N +label | Array | [] | 开关的标签;[打开时的标签,关闭时的标签]。TS 类型:`string[]` | N +loading | Boolean | false | 是否处于加载中状态 | N +size | String | medium | 开关尺寸。可选项:small/medium/large | N +value | String / Number / Boolean | - | 开关值。支持语法糖 `v-model` 或 `v-model:value`。TS 类型:`T` `type SwitchValue = string \| number \| boolean`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/switch/type.ts) | N +defaultValue | String / Number / Boolean | - | 开关值。非受控属性。TS 类型:`T` `type SwitchValue = string \| number \| boolean`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/switch/type.ts) | N +onChange | Function | | TS 类型:`(value: T) => void`
数据发生变化时触发 | N ### Switch Events 名称 | 参数 | 描述 -- | -- | -- -change | `(value: SwitchValue)` | 数据发生变化时触发 +change | `(value: T)` | 数据发生变化时触发 diff --git a/src/switch/switch.vue b/src/switch/switch.vue index 8a3e8f353..eefc194f5 100644 --- a/src/switch/switch.vue +++ b/src/switch/switch.vue @@ -1,18 +1,22 @@ diff --git a/src/toast/demos/position.vue b/src/toast/demos/position.vue index 46f8712e6..3bfb8d746 100644 --- a/src/toast/demos/position.vue +++ b/src/toast/demos/position.vue @@ -14,8 +14,8 @@