From 72884d0adcb3c0ddee3295553e84bf35f537c8e0 Mon Sep 17 00:00:00 2001 From: anlyyao Date: Mon, 17 Jul 2023 14:29:30 +0800 Subject: [PATCH] fix: resolved some spelling mistake --- CHANGELOG.md | 2 +- CONTRIBUTING.md | 2 +- site/plugin-tdoc/transforms.ts | 4 +- src/checkbox-group/checkbox-group.ts | 10 +- src/common/bus.ts | 8 +- src/date-time-picker/README.en-US.md | 2 +- src/date-time-picker/README.md | 2 +- .../__test__/__snapshots__/demo.test.js.snap | 12 +- .../__virtualHostSnapshot__/demo.test.js.snap | 174 ------- .../index.test.js.snap | 474 ------------------ .../_example/date-all/index.wxml | 2 +- .../_example/date-all/index.wxss | 2 +- .../_example/steps/index.wxml | 2 +- .../_example/steps/index.wxss | 2 +- src/date-time-picker/_example/time/index.wxml | 4 +- src/date-time-picker/_example/time/index.wxss | 2 +- .../_example/year-month-date/index.wxml | 2 +- .../_example/year-month-date/index.wxss | 4 +- .../_example/year-month/index.wxml | 10 +- .../_example/year-month/index.wxss | 2 +- src/picker/README.en-US.md | 2 +- src/picker/README.md | 2 +- src/picker/__test__/index.wxml | 18 +- src/radio-group/radio-group.ts | 4 +- src/side-bar/side-bar.ts | 8 +- src/step-item/step-item.less | 2 +- 26 files changed, 51 insertions(+), 707 deletions(-) delete mode 100644 src/date-time-picker/__test__/__virtualHostSnapshot__/demo.test.js.snap delete mode 100644 src/date-time-picker/__test__/__virtualHostSnapshot__/index.test.js.snap diff --git a/CHANGELOG.md b/CHANGELOG.md index fcbd39c53..1c0b44063 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -425,7 +425,7 @@ docClass: timeline - `Tabs`: 废弃 placement 属性,左右布局请使用 SideBar 组件 @LeeJim ([#1492](https://github.com/Tencent/tdesign-miniprogram/pull/1492)) ### 🚀 Features -- `Cell`: 新增 CSS Varialbes 用于控制高度 @LeeJim ([#1482](https://github.com/Tencent/tdesign-miniprogram/pull/1482)) +- `Cell`: 新增 CSS Variables 用于控制高度 @LeeJim ([#1482](https://github.com/Tencent/tdesign-miniprogram/pull/1482)) - `Indexes`: 新增支持 stickyOffset 属性,用于调整吸顶时的距离 @LeeJim ([#1485](https://github.com/Tencent/tdesign-miniprogram/pull/1485)) - `Button`: 支持 0.5px 边框 @anlyyao ([#1474](https://github.com/Tencent/tdesign-miniprogram/pull/1474)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bd64d085a..c101117b9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,7 +54,7 @@ npm start 此时会同时启动 `dist` 与 `example` 的构建服务,对应的开发路径与构建路径分别为: - `src` -> `miniprogram_dist` -- `src/*/_exmaple` -> `example` -> `_example` +- `src/*/_example` -> `example` -> `_example` 使用微信开发者工具导入项目 `_example` 文件夹 diff --git a/site/plugin-tdoc/transforms.ts b/site/plugin-tdoc/transforms.ts index 965a7f604..06ca728e4 100644 --- a/site/plugin-tdoc/transforms.ts +++ b/site/plugin-tdoc/transforms.ts @@ -6,7 +6,7 @@ let demoCodesImports: Record = {}; export default { before({ source, file, md }: any) { - const resouceDir = path.dirname(file); + const resourceDir = path.dirname(file); const reg = file.match(/src\/(\S*)(?=\/\S*.md)/); const name = reg && reg[1]; demoCodesImports = {}; @@ -23,7 +23,7 @@ export default { // 替换成对应 demo 文件 source = source.replace(/{{\s+(.+)\s+}}/g, (_: string, demoDirName: string) => { - const demoPath = path.resolve(resouceDir, `./_example/${demoDirName}`); + const demoPath = path.resolve(resourceDir, `./_example/${demoDirName}`); if (!fs.existsSync(demoPath)) { console.log('\x1B[36m%s\x1B[0m', `${name} 组件需要实现 _example/${demoDirName} 示例!`); return '\n

DEMO (🚧建设中)...

'; diff --git a/src/checkbox-group/checkbox-group.ts b/src/checkbox-group/checkbox-group.ts index a9008dbf3..9ed0487b1 100644 --- a/src/checkbox-group/checkbox-group.ts +++ b/src/checkbox-group/checkbox-group.ts @@ -47,7 +47,7 @@ export default class CheckBoxGroup extends SuperComponent { $checkAll = null; // 全选复选框 methods = { - getChilds() { + getChildren() { let items = this.$children; if (!items.length) { items = this.selectAllComponents(`.${prefix}-checkbox-option`); @@ -56,7 +56,7 @@ export default class CheckBoxGroup extends SuperComponent { }, updateChildren() { - const items = this.getChilds(); + const items = this.getChildren(); const { value } = this.data; if (items.length > 0) { @@ -76,14 +76,14 @@ export default class CheckBoxGroup extends SuperComponent { updateValue({ value, checked, checkAll, indeterminate }) { let { value: newValue } = this.data; const { max } = this.data; - const keySet = new Set(this.getChilds().map((item) => item.data.value)); + const keySet = new Set(this.getChildren().map((item) => item.data.value)); newValue = newValue.filter((value) => keySet.has(value)); if (max && checked && newValue.length === max) return; if (checkAll) { - const items = this.getChilds(); + const items = this.getChildren(); newValue = !checked && indeterminate ? items @@ -141,7 +141,7 @@ export default class CheckBoxGroup extends SuperComponent { }, setCheckall() { - const items = this.getChilds(); + const items = this.getChildren(); if (!this.$checkAll) { this.$checkAll = items.find((item) => item.data.checkAll); diff --git a/src/common/bus.ts b/src/common/bus.ts index 216a4a647..76da2c660 100644 --- a/src/common/bus.ts +++ b/src/common/bus.ts @@ -1,14 +1,14 @@ export default class Bus { listeners: Map; - emited: Set; + emitted: Set; constructor() { this.listeners = new Map(); - this.emited = new Set(); + this.emitted = new Set(); } on(evtName: string, listener) { - if (this.emited.has(evtName)) { + if (this.emitted.has(evtName)) { listener(); return; } @@ -24,7 +24,7 @@ export default class Bus { if (listeners) { listeners.forEach((func) => func()); - this.emited.add(evtName); + this.emitted.add(evtName); } } } diff --git a/src/date-time-picker/README.en-US.md b/src/date-time-picker/README.en-US.md index 8e8fb1ebf..baff36170 100644 --- a/src/date-time-picker/README.en-US.md +++ b/src/date-time-picker/README.en-US.md @@ -26,7 +26,7 @@ name | params | description -- | -- | -- cancel | \- | \- change | `(value: DateValue)` | \- -close | `(trigger: TriggerSource)` | `1.0.1`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confrim-btn'`
+close | `(trigger: TriggerSource)` | `1.0.1`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confirm-btn'`
confirm | `(value: DateValue)` | `1.0.1` pick | `(value: DateValue)` | \- diff --git a/src/date-time-picker/README.md b/src/date-time-picker/README.md index b67e38428..06ed5ec35 100644 --- a/src/date-time-picker/README.md +++ b/src/date-time-picker/README.md @@ -70,7 +70,7 @@ visible | Boolean | false | 是否显示 | N -- | -- | -- cancel | \- | 取消按钮点击时触发 change | `(value: DateValue)` | 确认按钮点击时触发 -close | `(trigger: TriggerSource)` | `1.0.1`。关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confrim-btn'`
+close | `(trigger: TriggerSource)` | `1.0.1`。关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confirm-btn'`
confirm | `(value: DateValue)` | `1.0.1`。确认按钮点击时触发 pick | `(value: DateValue)` | 选中值发生变化时触发 diff --git a/src/date-time-picker/__test__/__snapshots__/demo.test.js.snap b/src/date-time-picker/__test__/__snapshots__/demo.test.js.snap index 80996ced0..5a0f83228 100644 --- a/src/date-time-picker/__test__/__snapshots__/demo.test.js.snap +++ b/src/date-time-picker/__test__/__snapshots__/demo.test.js.snap @@ -7,7 +7,7 @@ exports[`DateTimePicker DateTimePicker date-all demo works fine 1`] = ` data-mode="datetime" hover="{{true}}" note="" - tClass="pannel-item" + tClass="panel-item" title="选择日期时间" bind:tap="showPicker" /> @@ -30,7 +30,7 @@ exports[`DateTimePicker DateTimePicker steps demo works fine 1`] = ` arrow="{{true}}" hover="{{true}}" note="" - tClass="pannel-item" + tClass="panel-item" title="选择时间" bind:tap="showPicker" /> @@ -69,7 +69,7 @@ exports[`DateTimePicker DateTimePicker time demo works fine 1`] = ` data-mode="second" hover="{{true}}" note="" - tClass="pannel-item" + tClass="panel-item" title="选择时间" bind:tap="showPicker" /> @@ -83,7 +83,7 @@ exports[`DateTimePicker DateTimePicker time demo works fine 1`] = ` data-mode="minute" hover="{{true}}" note="" - tClass="pannel-item" + tClass="panel-item" title="选择时间" bind:tap="showPicker" /> @@ -127,7 +127,7 @@ exports[`DateTimePicker DateTimePicker year-month demo works fine 1`] = ` data-mode="month" hover="{{true}}" note="" - tClass="pannel-item" + tClass="panel-item" title="选择日期" bind:tap="showPicker" /> @@ -154,7 +154,7 @@ exports[`DateTimePicker DateTimePicker year-month-date demo works fine 1`] = ` data-mode="date" hover="{{true}}" note="" - tClass="pannel-item" + tClass="panel-item" title="选择日期" bind:tap="showPicker" /> diff --git a/src/date-time-picker/__test__/__virtualHostSnapshot__/demo.test.js.snap b/src/date-time-picker/__test__/__virtualHostSnapshot__/demo.test.js.snap deleted file mode 100644 index 80996ced0..000000000 --- a/src/date-time-picker/__test__/__virtualHostSnapshot__/demo.test.js.snap +++ /dev/null @@ -1,174 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`DateTimePicker DateTimePicker date-all demo works fine 1`] = ` - - - - -`; - -exports[`DateTimePicker DateTimePicker steps demo works fine 1`] = ` - - - - -`; - -exports[`DateTimePicker DateTimePicker time demo works fine 1`] = ` - -`; - -exports[`DateTimePicker DateTimePicker year-month demo works fine 1`] = ` - - - - -`; - -exports[`DateTimePicker DateTimePicker year-month-date demo works fine 1`] = ` - - - - -`; diff --git a/src/date-time-picker/__test__/__virtualHostSnapshot__/index.test.js.snap b/src/date-time-picker/__test__/__virtualHostSnapshot__/index.test.js.snap deleted file mode 100644 index 134e5a7fe..000000000 --- a/src/date-time-picker/__test__/__virtualHostSnapshot__/index.test.js.snap +++ /dev/null @@ -1,474 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`date-time-picker :base 1`] = ` -
- - - - - - - - - 取消 - - - 选择日期 - - - 确定 - - - - - - - - - 2000年 - - - - - 2001年 - - - - - 2002年 - - - - - 2003年 - - - - - 2004年 - - - - - 2005年 - - - - - 2006年 - - - - - 2007年 - - - - - 2008年 - - - - - 2009年 - - - - - 2010年 - - - - - 2011年 - - - - - 2012年 - - - - - 2013年 - - - - - 2014年 - - - - - 2015年 - - - - - 2016年 - - - - - 2017年 - - - - - 2018年 - - - - - 2019年 - - - - - 2020年 - - - - - 2021年 - - - - - 2022年 - - - - - 2023年 - - - - - 2024年 - - - - - 2025年 - - - - - 2026年 - - - - - 2027年 - - - - - 2028年 - - - - - 2029年 - - - - - 2030年 - - - - - - - - - - - 1月 - - - - - 2月 - - - - - 3月 - - - - - 4月 - - - - - 5月 - - - - - 6月 - - - - - 7月 - - - - - 8月 - - - - - 9月 - - - - - 10月 - - - - - 11月 - - - - - 12月 - - - - - - - - - - - - - - - - - - - -
-`; diff --git a/src/date-time-picker/_example/date-all/index.wxml b/src/date-time-picker/_example/date-all/index.wxml index 434fe1173..d00a533af 100644 --- a/src/date-time-picker/_example/date-all/index.wxml +++ b/src/date-time-picker/_example/date-all/index.wxml @@ -5,7 +5,7 @@ arrow data-mode="datetime" bindtap="showPicker" - t-class="pannel-item" + t-class="panel-item" /> diff --git a/src/date-time-picker/_example/date-all/index.wxss b/src/date-time-picker/_example/date-all/index.wxss index b55ebb7e1..490c7f58a 100644 --- a/src/date-time-picker/_example/date-all/index.wxss +++ b/src/date-time-picker/_example/date-all/index.wxss @@ -1,3 +1,3 @@ -.pannel-item { +.panel-item { margin-bottom: 32rpx; } diff --git a/src/date-time-picker/_example/steps/index.wxml b/src/date-time-picker/_example/steps/index.wxml index d5b0daf7b..6cb68616c 100644 --- a/src/date-time-picker/_example/steps/index.wxml +++ b/src/date-time-picker/_example/steps/index.wxml @@ -1,4 +1,4 @@ - + 时分选择器 @@ -17,7 +17,7 @@ arrow data-mode="minute" bindtap="showPicker" - t-class="pannel-item" + t-class="panel-item" /> diff --git a/src/date-time-picker/_example/time/index.wxss b/src/date-time-picker/_example/time/index.wxss index 453683895..34f4fe483 100644 --- a/src/date-time-picker/_example/time/index.wxss +++ b/src/date-time-picker/_example/time/index.wxss @@ -1,3 +1,3 @@ -.pannel-item { +.panel-item { margin: 32rpx 0; } diff --git a/src/date-time-picker/_example/year-month-date/index.wxml b/src/date-time-picker/_example/year-month-date/index.wxml index 38efbeb6c..0fc496579 100644 --- a/src/date-time-picker/_example/year-month-date/index.wxml +++ b/src/date-time-picker/_example/year-month-date/index.wxml @@ -6,7 +6,7 @@ data-mode="date" bindtap="showPicker" class="test" - t-class="pannel-item" + t-class="panel-item" /> diff --git a/src/date-time-picker/_example/year-month-date/index.wxss b/src/date-time-picker/_example/year-month-date/index.wxss index 93662c17c..05412e1d3 100644 --- a/src/date-time-picker/_example/year-month-date/index.wxss +++ b/src/date-time-picker/_example/year-month-date/index.wxss @@ -1,7 +1,7 @@ -.pannel-item { +.panel-item { margin-bottom: 32rpx; } -.pannel-item::after { +.panel-item::after { border: 0; } diff --git a/src/date-time-picker/_example/year-month/index.wxml b/src/date-time-picker/_example/year-month/index.wxml index ec99fee35..7438ab912 100644 --- a/src/date-time-picker/_example/year-month/index.wxml +++ b/src/date-time-picker/_example/year-month/index.wxml @@ -1,12 +1,4 @@ - + , label: string, columns: Array<{ column: number; index: number }> )` | \- -close | `(trigger: TriggerSource)` | `1.0.1`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confrim-btn'`
+close | `(trigger: TriggerSource)` | `1.0.1`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confirm-btn'`
confirm | `(value: Array, label: string, columns: Array<{ column: number; index: number }> )` | \- pick | `(value: Array, label: string, column: number, index: number)` | \- diff --git a/src/picker/README.md b/src/picker/README.md index 08db314bc..96c74b109 100644 --- a/src/picker/README.md +++ b/src/picker/README.md @@ -61,7 +61,7 @@ visible | Boolean | false | 是否显示 | N -- | -- | -- cancel | - | 点击取消按钮时触发 change | `(value: Array, label: string, columns: Array<{ column: number; index: number }> )` | 选中变化时候触发,即确认变化时触发 -close | `(trigger: TriggerSource)` | `1.0.1`。关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confrim-btn'`
+close | `(trigger: TriggerSource)` | `1.0.1`。关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confirm-btn'`
confirm | `(value: Array, label: string, columns: Array<{ column: number; index: number }> )` | 点击确认按钮时触发 pick | `(value: Array, label: string, column: number, index: number)` | 任何一列选中都会触发,不同的列参数不同。`column` 表示第几列变化,`index` 表示变化那一列的选中项下标 diff --git a/src/picker/__test__/index.wxml b/src/picker/__test__/index.wxml index 4d3a7d28b..23b48560c 100644 --- a/src/picker/__test__/index.wxml +++ b/src/picker/__test__/index.wxml @@ -1,19 +1,19 @@ - - 城市 - {{cityCurrentValue || '选择城市'}} + + 城市 + {{cityCurrentValue || '选择城市'}} - - 年份和季节 - + + 年份和季节 + {{yearSeasonsCurrentValue || '选择年份和季节' }} - - 日期 - {{dateCurrentValue || '选择日期' }} + + 日期 + {{dateCurrentValue || '选择日期' }} diff --git a/src/radio-group/radio-group.ts b/src/radio-group/radio-group.ts index 5d8badb1b..13ae3c773 100644 --- a/src/radio-group/radio-group.ts +++ b/src/radio-group/radio-group.ts @@ -39,7 +39,7 @@ export default class RadioGroup extends SuperComponent { observers = { value(v) { - this.getChilds().forEach((item) => { + this.getChildren().forEach((item) => { item.setData({ checked: v === item.data.value, }); @@ -51,7 +51,7 @@ export default class RadioGroup extends SuperComponent { }; methods = { - getChilds() { + getChildren() { let items = this.$children; if (!items?.length) { diff --git a/src/side-bar/side-bar.ts b/src/side-bar/side-bar.ts index e2d76efb3..a371d9a45 100644 --- a/src/side-bar/side-bar.ts +++ b/src/side-bar/side-bar.ts @@ -10,17 +10,17 @@ const relationsPath = '../side-bar-item/side-bar-item'; export default class SideBar extends SuperComponent { externalClasses = [`${prefix}-class`]; - childs = []; + children = []; relations: RelationsOptions = { [relationsPath]: { type: 'child', linked(child) { - this.childs.push(child); + this.children.push(child); }, unlinked(child) { - const index = this.childs.findIndex((item) => item === child); - this.childs.splice(index, 1); + const index = this.children.findIndex((item) => item === child); + this.children.splice(index, 1); }, }, }; diff --git a/src/step-item/step-item.less b/src/step-item/step-item.less index 8e9b1f87a..a9f2123be 100644 --- a/src/step-item/step-item.less +++ b/src/step-item/step-item.less @@ -106,7 +106,7 @@ font-size: @font-size-base; position: relative; - &--finsh, + &--finish, &--process { color: @brand-color; }