From e6804444094ef681343b8503e0657a1a41b705b8 Mon Sep 17 00:00:00 2001 From: leejimchill Date: Wed, 21 Jun 2023 10:41:37 +0800 Subject: [PATCH] 1.1.10 (#2121) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(loading): resolve style error (#1873) * fix(loading): resolve style error * test: update unit test * feat: empty的文案添加换行 (#1870) * fix(button): 修复[button] type="submit"时,disabled未生效 (#1878) * fix(button): 修复[button] type="submit"时,disabled未生效 修复[button] type="submit"时,disabled未生效 * fix(button): 修复[button] type="submit"时,disabled未生效 修复[button] type="submit"时,disabled未生效 * test: update snap --------- Co-authored-by: zjianzzhang * style(row): row垂直居中样式 (#1866) 添加row的flex布局,垂直居中 * fix(progress): 安卓机朗读异常 & 动态朗读 (#1354) * fix: 安卓机朗读异常 * fix: fix code * fix: 安卓不发音 * fix: fix code * fix: wip 优化中 * fix: 优化 * chore: update snap * fix: fix code * fix: fix code * fix: 错误使用iOS变量 * fix(补充注释): 补充注释 * fix: 优化 * test: update snap * fix: 补充注释 * fix: 优化部分注释, remove code * fix: 优化注释 --------- Co-authored-by: leejimqiu * feature/swiper aria v2 (#1598) * feat(swiper): support aria * feat(swiper): support custom ariaLabel * feat(swiper): image name * chore(swiper): update snap --------- Co-authored-by: leejimqiu * docs: update custom theme * fix(radio): resolve style (#1889) * feat: 支持分割线组件的线条使用变量控制属性 (#1890) * fix(action-sheet): resolve ts error of show method (#1907) * fix(grid): 修复column>=4个时,--td-grid-item-image-width和--td-grid-item-text-font-size是无效的 (#1903) * chore: update _common (#1902) * feat: 支持radio的内容字体大小使用变量。 (#1895) * feat: 支持radio的内容字体大小使用变量。 * style: 修改css变量名称 * Bitjian fix/radio icon size (#1909) * fix: 修复--td-radio-icon-size对未选中的图标未生效 * fix: fix radio 未选择的图标未生效 * fix(radio): support css variables to change circle icon size --------- Co-authored-by: bitjian <1183048003@qq.com> * chore: publish v1.1.2 (#1910) * chore: publish v1.1.2 * chore: changelog's changes --------- Co-authored-by: github-actions[bot] * fix(rate): 评分组件支持无障碍滑动 (#1574) * fix(rate): 评分组件支持滑动无障碍操作(#1050) * fix(rate): 评分组件样式问题修复.(#1050) * fix(rate): 评分组件单测问题.(#1050) * fix(rate): 抽象样式, 冗余代码.(#1050) * fix(rate): 删除冗余节点.(#1050) * fix(rate): 优化读取.(#1050) * fix(rate): 新增额外的读取.(#1050) * fix(rate): 修复警告旁白导致的滑动卡顿.(#1050) * fix(rate): sr-only注释(#1050) * fix(rate): update test snapshots. (#1050) * build: remove preview workflow tentatively * fix(upload): resolve max (#1914) * fix(navbar): resolve capsule zindex (#1920) * chore: update site * fix(button): 修复variant=outline等状态下loading不展示 (#1922) * fix(button): 修复variant=outline等状态下loading不展示 * fix(button): loading inheritColor 字段错误 * fix(navbar): resolve vertical align (#1926) * fix(navbar): resolve vertical align * test(navbar): update snapshot * fix(dropdown-menu): support multiple column radio (#1927) * fix(Link): resolve disabled problem (#1928) * fix(calendar): resolve error (#1930) * fix(calendar): resolve error * fix(calendar): make observer robust * fix(tabs): resolve content overflow (#1931) * fix(tabs): resolve content overflow * test(tabs): update snapshot * chore: update issue template * fix(Input): resolve vertical layout style error (#1934) * feat(collapse): add header-left-icon property (#1933) * feat(tabs): add middle slot (#1936) * chore: publish v1.1.3 (#1937) * chore: publish v1.1.3 * chore: changelog's changes --------- Co-authored-by: github-actions[bot] * fix(slider): enable dragstart and dragend event (#1940) * fix(image-viewer): add using-custom-navation property (#1944) * feat(Swiper): update api docs (#1945) * feat(Swiper): update api docs * Update CHANGELOG.md * fix(picker): enable to using falsy value (#1948) * fix(toast): auto hide when page is hide (#1947) * feat(swiper): add image-load event (#1949) * feat(swiper): add image-load event * fix: resolve fallback value * test: update snapshot * chore: publish v1.1.4 (#1950) * chore: publish v1.1.4 * chore: changelog's changes --------- Co-authored-by: github-actions[bot] * docs(picker): enrich api detail (#1956) * fix(tabs): resolve track position (#1958) * feat(pulldown-refresh): add some properties from scroll-view (#1959) * feat(pulldown-refresh): add some properties from scroll-view * refactor(pulldown-refresh): using px to calculate * feat(loading): support indicator slot * test: update snapshot * fix(pulldown-refresh): resolve value (#1960) * feat(datetime-picker): support steps property (#1961) * feat(steps): add sequence property (#1962) * feat(dropdown-menu): add css variable for border width (#1967) * feat(Stepper): allow input to be empty (#1971) * fix(calendar): enable scroll into view when use-popup is false (#1969) * chore(image-viewer): update demo (#1968) * chore(image-viewer): update demo * chore(image-viewer): update demo * fix(action-sheet): enable close when click cancel * chore: recover demo * chore: publish v1.1.5 (#1975) * chore: publish v1.1.5 * chore: changelog's changes --------- Co-authored-by: github-actions[bot] * docs(badge): update api * fix(navbar): Fix invalid fixed attribute of Navbar component (#1982) * feat(Icon): update icon from 0.1.2 to 0.1.4 (#1979) * feat(Icon): update iconform 0.1.2 to 0.1.4 * test: update snapshots * chore: update _common * Feat/picker-zindex (#1985) * feat: picker添加层级控制 * refactor: 修改popupProps的处理逻辑 * refactor: fix template error * fix: picker compile error * fix(DropdownMenu): auto scroll to current (#1788) (#1981) * fix(DropdownMenu): auto scroll to current (#1788) * fix(DropdownMenu): resolve auto scroll wrong height (#1788) * fix(DropdownMenu): auto multi scroll to current (#1788) * feat: 添加支持date-picker的蒙层属性透 (#1991) * feat(Slider): the step attribute supports decimals (#1990) * feat(Slider): the step attribute supports decimals * fix(slider): resolve emit same value --------- Co-authored-by: leejimqiu * chore: publish v1.1.5-beta * fix(pulldown-refresh): resolve refresh event * fix: 修复variant动态修改无效 * feat(Grid): enrich demo (#1993) * feat(Input): resolve label content wraps (#1994) * docs(Steps): remove invalid attributes (#1995) * fix(pulldown-refresh): resolve refresh event (#1998) * fix(pulldown-refresh): resolve refresh event * fix(pulldown-refresh): resolve change event * fix: fix [下拉菜单] 单选选项行高不一致 #1980 (#1992) * feat: action-sheet支持层级 (#2002) * fix: 修复多余 row 的样式导致 col 不换行问题 (#1996) * fix: 修复row样式问题 fix #1964, fix #1851 * fix: 修复多余 row 的样式导致 col 不换行问题 "fix #1964", "fix #1851" --------- Co-authored-by: pingwu * fix(dialog): display of cancel and confirm button when calling a command. (#1986) * fix(dialog): Display problem of cancel and confirm button when calling a command. * revert(dialog): Revert changes to ` dialog.wxml` * fix(dialog): Button issue when invoking commands. --------- Co-authored-by: yuchumian * fix(calendar): enable calendar type (#2003) * chore: publish v1.1.6 (#2004) * chore: publish v1.1.6 * chore: changelog's changes --------- Co-authored-by: github-actions[bot] * chore(ActionSheet): prohibit exporting components at index (#2008) * feat: action-sheet支持cancel的颜色变量 (#2007) * fix(sticky): resolve width (#2012) * fix(side-bar-item): fix prefix and suffix style anomalies (#2011) * fix(tabbar): resolve width when virtual-host not available (#2013) * chore: publish v1.1.6-beta * build: update npm publish * fix(action-sheet): resolve invalid syntax * fix(Icon): rename some icons (#2020) * fix(Icon): rename some icons * test: update snapshots * chore: publish v1.1.7 (#2031) * chore: publish v1.1.7 * chore: changelog's changes --------- Co-authored-by: github-actions[bot] * feat(Textarea): support max/min height (#2035) * feat(Textarea): support max/min height * test: update snapshots * fix: rename proposal to transform and display installation dependencies (#2046) * fix(DropdownMenu): resolved the basic library cannot be used under version 2.19.2 (#2043) * fix(DropdownMenu): resolved the basic library cannot be used under version 2.19.2 * test: update snapshots * fix(Sticky): resolved width problem (#2047) * fix(Sticky): resolved width problem * fix(sticky): recover classname --------- Co-authored-by: leejimqiu * fix(navbar): polish bg support (#2049) * fix(drawer): resolve word misspelling (#2039) * fix(drawer): item-click parameter error * fix(drawer): item-click parameter error * fix(drawer): item-click parameter error * fix(image): enable dynamic dimension (#2050) * chore: publish v1.1.8 (#2051) * chore: publish v1.1.8 * chore: changelog's changes --------- Co-authored-by: github-actions[bot] * fix(indexes): 索引导航无法选中问题 (#2036) * fix(indexes): 异步数据未重新计算高度 * docs(indexes): 增加async文档说明 * fix(indexes): 通过indexList null判断是否异步数据 * fix(indexes): 修改indexList type类型 * feat(switch): prevent click when the switch component props loading is true (#2061) * feat(checkbox): 自定义图标增加半选中态 (#2056) * feat(Search): support cursor-spacing attr (#2065) * feat(Search): support cursor-spacing attr * test: update snapshots * fix(Switch): resolved loading state style (#2074) * fix(Icon): resolved icon naming error (#2076) * fix(tree-select): enable keys property (#2085) * fix(radio-group): fix abnormal display of radio group selection status (#2082) * fix(radio-group): fix abnormal display of radio group selection status * fix(radio-group): fix abnormal display of radio group selection status * docs(slider): add faq part * fix(CellGroup): resolved borderen invalid (#2089) * chore: publish v1.1.9 (#2091) * chore: publish v1.1.9 * chore: changelog's changes --------- Co-authored-by: github-actions[bot] * feat(notice-bar): add interval property when direction='vertical' * test(notice-bar): add interval property when direction='vertical' * fix(Grid): resolved align='laft' valid (#2110) * fix(Fab): resolved hover-class invalid (#2093) * fix(upload): fix abnormal image display (#2098) * feat(tabs): add split property (#2113) * fix(slider): fix abnormal calculation of slider mark (#2114) * fix(Input): resolve value=0 is valid when type is number (#2108) * fix(slider): enable async render (#2115) * fix: add type check before call pagescroll (#2116) * build: remove issue assign logic * fix(action-sheet): do not trigger close event when disabled (#2117) * fix(stepper): trigger change when value changed (#2118) * chore: publish v1.1.10 (#2119) * chore: publish v1.1.10 * chore: changelog's changes --------- Co-authored-by: github-actions[bot] --------- Co-authored-by: Cyrus Co-authored-by: favouredddd <40692560+favouredddd@users.noreply.github.com> Co-authored-by: 孜孜 <1183048003@qq.com> Co-authored-by: zjianzzhang Co-authored-by: tomcat-hz <59186135+tomcat-hz@users.noreply.github.com> Co-authored-by: 龙风 <455947455@qq.com> Co-authored-by: zhangpaopao Co-authored-by: Guan9 Co-authored-by: Y Co-authored-by: github-actions[bot] Co-authored-by: byqbai Co-authored-by: betavs <34408516+betavs@users.noreply.github.com> Co-authored-by: jarmywang Co-authored-by: jurrychen <534747442@qq.com> Co-authored-by: pingwu <58472278+wuping97@users.noreply.github.com> Co-authored-by: pingwu Co-authored-by: yuchumian <26185330+yuchumian@users.noreply.github.com> Co-authored-by: yuchumian Co-authored-by: ElanYoung <39727435+ElanYoung@users.noreply.github.com> Co-authored-by: betavs <392368711@qq.com> --- .github/workflows/issue-assignees.temp.yml | 35 ---------- CHANGELOG.md | 15 +++++ package.json | 2 +- src/action-sheet/action-sheet.ts | 8 ++- src/common/bus.ts | 7 ++ src/common/template/button.wxml | 1 + src/grid-item/grid-item.less | 18 ++--- src/input/input.ts | 8 ++- src/mixins/page-scroll.ts | 2 +- src/notice-bar/README.en-US.md | 1 + src/notice-bar/README.md | 1 + .../__test__/__snapshots__/demo.test.js.snap | 1 + .../__virtualHostSnapshot__/demo.test.js.snap | 1 + src/notice-bar/_example/scrolling/index.wxml | 1 + src/notice-bar/notice-bar.wxml | 2 +- src/notice-bar/props.ts | 5 ++ src/notice-bar/type.ts | 7 ++ src/slider/README.md | 12 +++- src/slider/slider.ts | 67 ++++++++++--------- src/stepper/stepper.ts | 3 + src/tab-panel/props.ts | 2 +- src/tab-panel/type.ts | 2 +- src/tabs/README.en-US.md | 5 +- src/tabs/README.md | 7 +- src/tabs/props.ts | 7 +- src/tabs/tabs.less | 5 +- src/tabs/tabs.wxml | 2 +- src/tabs/type.ts | 10 ++- src/upload/__test__/index.test.js | 2 +- src/upload/upload.ts | 2 +- 30 files changed, 144 insertions(+), 97 deletions(-) diff --git a/.github/workflows/issue-assignees.temp.yml b/.github/workflows/issue-assignees.temp.yml index 643436136..1700ee170 100644 --- a/.github/workflows/issue-assignees.temp.yml +++ b/.github/workflows/issue-assignees.temp.yml @@ -15,38 +15,3 @@ jobs: issuesOpened: | 👋 @{{ author }},感谢给 TDesign 提出了 issue。 请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。 - - # https://docs.github.com/cn/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#issues - - uses: 94dreamer/issue-assignees@main - id: assignees - with: - project_name: ${{github.event.repository.name}} - issue_title: ${{github.event.issue.title}} - - - run: echo ${{ steps.assignees.outputs.contributors }} - - name: Add assigness - if: steps.assignees.outputs.contributors != '' - uses: actions-cool/issues-helper@v3 - with: - actions: 'add-assignees' - token: ${{ secrets.GITHUB_TOKEN }} - issue-number: ${{ github.event.issue.number }} - assignees: ${{ steps.assignees.outputs.contributors }} - - - run: | - contributors=${{ steps.assignees.outputs.contributors }} - contributorstring=${contributors//,/ @} - echo "string=@$contributorstring" >> $GITHUB_OUTPUT - id: contributors - - - name: 通知贡献者 - if: steps.assignees.outputs.contributors != '' - uses: actions-cool/maintain-one-comment@v2.0.0 - with: - token: ${{ secrets.GITHUB_TOKEN }} - body: | - ♥️ 有劳 ${{ steps.contributors.outputs.string }} 尽快确认问题。 - 确认有效后将下一步计划和可能需要的时间回复给 @${{ github.event.issue.user.login }} 。 - - number: ${{ github.event.issue.number }} - body-include: "" diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d55d8208..983a428d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,21 @@ toc: false docClass: timeline --- +## 🌈 1.1.10 `2023-06-20` +### 🚀 Features +- `Tabs`: 新增 split 属性 @LeeJim ([#2113](https://github.com/Tencent/tdesign-miniprogram/pull/2113)) +- `NoticeBar`: 新增 interval 属性 @betavs ([#2097](https://github.com/Tencent/tdesign-miniprogram/pull/2097)) +### 🐞 Bug Fixes +- `Grid`: 修复 `align=left` 无效的问题 @anlyyao ([#2110](https://github.com/Tencent/tdesign-miniprogram/pull/2110)) +- `Fab`: 修复 `buttonProps` 中的 `hoverClass`属性透传至 `button` 无效 @anlyyao ([#2093](https://github.com/Tencent/tdesign-miniprogram/pull/2093)) +- `Upload`: 修复图片尺寸超出的问题 @betavs ([#2098](https://github.com/Tencent/tdesign-miniprogram/pull/2098)) +- `Slider`: 修复使用 max 之后刻度展示错误的问题 @betavs ([#2114](https://github.com/Tencent/tdesign-miniprogram/pull/2114)) +- `Input`: 修复 `type=number` 时,`value=0` 无效的问题 @anlyyao ([#2108](https://github.com/Tencent/tdesign-miniprogram/pull/2108)) +- `Slider`: 修复异步展示时导致刻度渲染错误的问题 @LeeJim ([#2115](https://github.com/Tencent/tdesign-miniprogram/pull/2115)) +- `ActionSheet`: 修复点击 disabled 的选项仍触发 close、visible-change 事件 @LeeJim ([#2117](https://github.com/Tencent/tdesign-miniprogram/pull/2117)) +- `Stepper`: 保证值发生变化才触发 change 事件 @LeeJim ([#2118](https://github.com/Tencent/tdesign-miniprogram/pull/2118)) + + ## 🌈 1.1.9 `2023-06-13` ### 🚀 Features - `CheckBox`: 自定义图标增加半选中态 @lolhezihehe ([#2056](https://github.com/Tencent/tdesign-miniprogram/pull/2056)) diff --git a/package.json b/package.json index 3cf6f78c6..f21d54d0b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tdesign-miniprogram", "purename": "tdesign", - "version": "1.1.9", + "version": "1.1.10", "description": "tdesign-miniprogram", "title": "tdesign-ßminiprogram", "main": "miniprogram_dist/index.js", diff --git a/src/action-sheet/action-sheet.ts b/src/action-sheet/action-sheet.ts index e5ea56f25..7ac9c1552 100644 --- a/src/action-sheet/action-sheet.ts +++ b/src/action-sheet/action-sheet.ts @@ -98,10 +98,14 @@ export default class ActionSheet extends SuperComponent { const isSwiperMode = theme === ActionSheetTheme.Grid; const item = isSwiperMode ? gridThemeItems[currentSwiperIndex][index] : items[index]; const realIndex = isSwiperMode ? index + currentSwiperIndex * count : index; + if (item) { this.triggerEvent('selected', { selected: item, index: realIndex }); - this.triggerEvent('close', { trigger: 'select' }); - this._trigger('visible-change', { visible: false }); + + if (!item.disabled) { + this.triggerEvent('close', { trigger: 'select' }); + this._trigger('visible-change', { visible: false }); + } } }, diff --git a/src/common/bus.ts b/src/common/bus.ts index 46402dfec..216a4a647 100644 --- a/src/common/bus.ts +++ b/src/common/bus.ts @@ -1,11 +1,17 @@ export default class Bus { listeners: Map; + emited: Set; constructor() { this.listeners = new Map(); + this.emited = new Set(); } on(evtName: string, listener) { + if (this.emited.has(evtName)) { + listener(); + return; + } const target = this.listeners.get(evtName) || []; target.push(listener); @@ -18,6 +24,7 @@ export default class Bus { if (listeners) { listeners.forEach((func) => func()); + this.emited.add(evtName); } } } diff --git a/src/common/template/button.wxml b/src/common/template/button.wxml index 173e8bb80..27d6bc493 100644 --- a/src/common/template/button.wxml +++ b/src/common/template/button.wxml @@ -14,6 +14,7 @@ size="{{size || 'medium'}}" variant="{{variant || 'base'}}" open-type="{{openType || ''}}" + hover-class="{{hoverClass}}" hover-stop-propagation="{{hoverStopPropagation || false}}" hover-start-time="{{hoverStartTime || 20}}" hover-stay-time="{{hoverStayTime || 70}}" diff --git a/src/grid-item/grid-item.less b/src/grid-item/grid-item.less index 89e09a640..4a98d5d82 100644 --- a/src/grid-item/grid-item.less +++ b/src/grid-item/grid-item.less @@ -53,6 +53,15 @@ flex-direction: row; padding-left: @grid-item-padding; } + + &--left { + justify-self: flex-start; + align-items: flex-start; + + .@{prefix}-grid-item__words { + text-align: left; + } + } } &__words { @@ -104,15 +113,6 @@ } } - &--left { - justify-self: flex-start; - align-items: flex-start; - - .@{prefix}-grid-item__words { - text-align: left; - } - } - &__text { width: inherit; color: @grid-item-text-color; diff --git a/src/input/input.ts b/src/input/input.ts index 7ff04e146..76689a5de 100644 --- a/src/input/input.ts +++ b/src/input/input.ts @@ -31,6 +31,7 @@ export default class Input extends SuperComponent { prefix, classPrefix: name, classBasePrefix: prefix, + excludeType: ['number', 'digit'], }; lifetimes = { @@ -62,14 +63,15 @@ export default class Input extends SuperComponent { methods = { updateValue(value) { - const { maxcharacter, maxlength } = this.properties; - if (maxcharacter && maxcharacter > 0 && !Number.isNaN(maxcharacter)) { + const { maxcharacter, maxlength, type } = this.properties; + const { excludeType } = this.data; + if (!excludeType.includes(type) && maxcharacter && maxcharacter > 0 && !Number.isNaN(maxcharacter)) { const { length, characters } = getCharacterLength('maxcharacter', value, maxcharacter); this.setData({ value: characters, count: length, }); - } else if (maxlength > 0 && !Number.isNaN(maxlength)) { + } else if (!excludeType.includes(type) && maxlength > 0 && !Number.isNaN(maxlength)) { const { length, characters } = getCharacterLength('maxlength', value, maxlength); this.setData({ value: characters, diff --git a/src/mixins/page-scroll.ts b/src/mixins/page-scroll.ts index 268a8fd5f..e7252e8dc 100644 --- a/src/mixins/page-scroll.ts +++ b/src/mixins/page-scroll.ts @@ -11,7 +11,7 @@ const onPageScroll = function (event?: IPageScrollOption) { if (!page) return; const { pageScroller } = page; - pageScroller.forEach((scroller: Scroller) => { + pageScroller?.forEach((scroller: Scroller) => { if (typeof scroller === 'function') { // @ts-ignore scroller(event); diff --git a/src/notice-bar/README.en-US.md b/src/notice-bar/README.en-US.md index 6d98c4ad3..b3efc1062 100644 --- a/src/notice-bar/README.en-US.md +++ b/src/notice-bar/README.en-US.md @@ -10,6 +10,7 @@ direction | String | horizontal | options:horizontal/vertical | N external-classes | Array | - | `['t-class', 't-class-content', 't-class-prefix-icon', 't-class-operation', 't-class-suffix-icon']` | N operation | String / Slot | - | \- | N marquee | Boolean / Object | false | Typescript:`boolean \| DrawMarquee` `interface DrawMarquee { speed?: number; loop?: number; delay?: number }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/notice-bar/type.ts) | N +interval | Number | 2000 | - | N prefix-icon | String / Boolean/ Object / Slot | - | \- | N suffix-icon | String / Boolean / Object / Slot | - | \- | N theme | String | info | options:info/success/warning/error | N diff --git a/src/notice-bar/README.md b/src/notice-bar/README.md index d236cec4d..e6d6726ad 100644 --- a/src/notice-bar/README.md +++ b/src/notice-bar/README.md @@ -75,6 +75,7 @@ direction | String | horizontal | 滚动方向。可选项:horizontal/vertical external-classes | Array | - | 组件类名,分别用于设置 组件外层元素、文本内容、前缀图标、右侧额外信息、后缀图标 等元素类名。。`['t-class', 't-class-content', 't-class-prefix-icon', 't-class-operation', 't-class-suffix-icon']` | N operation | String / Slot | - | 右侧额外信息 | N marquee | Boolean / Object | false | 跑马灯效果。speed 指速度控制;loop 指循环播放次数,值为 -1 表示循环播放,值为 0 表示不循环播放;delay 表示延迟多久开始播放【仅在 direction='horizontal' 有效】。TS 类型:`boolean \| DrawMarquee` `interface DrawMarquee { speed?: number; loop?: number; delay?: number }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/notice-bar/type.ts) | N +interval | Number | 2000 | 间隔时间【仅在 direction='vertical' 有效】。 | N prefix-icon | String / Boolean / Object / Slot | - | 前缀图标。值为字符串表示图标名称,值为 `false` 表示不显示前缀图标,值为 `Object` 类型,表示透传至 `icon`,不传表示使用主题图标。| N suffix-icon | String / Object / Slot | - | 后缀图标。值为字符串表示图标名称。值为 `Object` 类型,表示透传至 `icon`,不传表示不显示后缀图标。 | N theme | String | info | 内置主题。可选项:info/success/warning/error | N diff --git a/src/notice-bar/__test__/__snapshots__/demo.test.js.snap b/src/notice-bar/__test__/__snapshots__/demo.test.js.snap index 3f132d309..1f3414812 100644 --- a/src/notice-bar/__test__/__snapshots__/demo.test.js.snap +++ b/src/notice-bar/__test__/__snapshots__/demo.test.js.snap @@ -142,6 +142,7 @@ exports[`NoticeBar NoticeBar scrolling demo works fine 1`] = ` ] }}" direction="vertical" + interval="{{3000}}" prefixIcon="sound" visible="{{true}}" bind:click="click" diff --git a/src/notice-bar/__test__/__virtualHostSnapshot__/demo.test.js.snap b/src/notice-bar/__test__/__virtualHostSnapshot__/demo.test.js.snap index 3f132d309..1f3414812 100644 --- a/src/notice-bar/__test__/__virtualHostSnapshot__/demo.test.js.snap +++ b/src/notice-bar/__test__/__virtualHostSnapshot__/demo.test.js.snap @@ -142,6 +142,7 @@ exports[`NoticeBar NoticeBar scrolling demo works fine 1`] = ` ] }}" direction="vertical" + interval="{{3000}}" prefixIcon="sound" visible="{{true}}" bind:click="click" diff --git a/src/notice-bar/_example/scrolling/index.wxml b/src/notice-bar/_example/scrolling/index.wxml index 8a877ccad..b6379a159 100644 --- a/src/notice-bar/_example/scrolling/index.wxml +++ b/src/notice-bar/_example/scrolling/index.wxml @@ -14,6 +14,7 @@ diff --git a/src/notice-bar/props.ts b/src/notice-bar/props.ts index 323068816..835ee6bc7 100644 --- a/src/notice-bar/props.ts +++ b/src/notice-bar/props.ts @@ -23,6 +23,11 @@ const props: TdNoticeBarProps = { operation: { type: String, }, + /** 间隔时间 */ + interval: { + type: Number, + value: 2000, + }, /** 跑马灯效果。speed 指速度控制;loop 指循环播放次数,值为 -1 表示循环播放,值为 0 表示不循环播放;delay 表示延迟多久开始播放 */ marquee: { type: null, diff --git a/src/notice-bar/type.ts b/src/notice-bar/type.ts index f71efec7a..5bf0a923c 100644 --- a/src/notice-bar/type.ts +++ b/src/notice-bar/type.ts @@ -42,6 +42,13 @@ export interface TdNoticeBarProps { type: StringConstructor; value?: string; }; + /** + * 间隔时间 + */ + interval: { + type: NumberConstructor; + value: number; + }; /** * 跑马灯效果。speed 指速度控制;loop 指循环播放次数,值为 -1 表示循环播放,值为 0 表示不循环播放;delay 表示延迟多久开始播放 * @default false diff --git a/src/slider/README.md b/src/slider/README.md index 85f985c57..8fdf12a62 100644 --- a/src/slider/README.md +++ b/src/slider/README.md @@ -80,4 +80,14 @@ dragstart | \- | 开始拖动时触发 ## FAQ -当 slider 外层使用 `hidden` 包裹,需要在 `hidden = false` 时,重新调用组件的 `getInitialStyle` 方法,才能正常渲染。 \ No newline at end of file +当 slider 外层使用 `hidden` 包裹,需要在 `hidden = false` 时,重新调用组件的 `init` 方法,才能正常渲染。如下: + +```html + +``` + +```js +const $slider = this.selectComponent('#slider'); + +$slider.init(); +``` diff --git a/src/slider/slider.ts b/src/slider/slider.ts index 1a7285053..e78aa1c20 100644 --- a/src/slider/slider.ts +++ b/src/slider/slider.ts @@ -79,33 +79,11 @@ export default class Slider extends SuperComponent { this.handlePropsChange(newValue); }, _value(newValue: SliderValue) { - const { min, max, range } = this.properties; - const { maxRange } = this.data; - - if (range) { - const left = (maxRange * (newValue[0] - Number(min))) / (Number(max) - Number(min)); - const right = (maxRange * (Number(max) - newValue[1])) / (Number(max) - Number(min)); - // 因为要计算点相对于线的绝对定位,所以要取整条线的长度而非可滑动的范围 - this.setLineStyle(left, right); - } else { - this.setSingleBarWidth(newValue as number); - } - - this.setData({ - isVisibleToScreenReader: true, - }); - setTimeout(() => { - this.setData({ - isVisibleToScreenReader: false, - }); - }, 2e3); + this.bus.on('initial', () => this.renderLine(newValue)); + this.toggleA11yTips(); }, marks(val) { - if (this.data.initialLeft != null) { - this.handleMask(val); - } else { - this.bus.on('initial', () => this.handleMask(val)); - } + this.bus.on('initial', () => this.handleMark(val)); }, }; @@ -116,10 +94,35 @@ export default class Slider extends SuperComponent { attached() { const { value } = this.properties; if (!value) this.handlePropsChange(0); - this.getInitialStyle(); + this.init(); }, }; + toggleA11yTips() { + this.setData({ + isVisibleToScreenReader: true, + }); + setTimeout(() => { + this.setData({ + isVisibleToScreenReader: false, + }); + }, 2000); + } + + renderLine(val) { + const { min, max, range } = this.properties; + const { maxRange } = this.data; + + if (range) { + const left = (maxRange * (val[0] - Number(min))) / (Number(max) - Number(min)); + const right = (maxRange * (Number(max) - val[1])) / (Number(max) - Number(min)); + // 因为要计算点相对于线的绝对定位,所以要取整条线的长度而非可滑动的范围 + this.setLineStyle(left, right); + } else { + this.setSingleBarWidth(val as number); + } + } + triggerValue(value?: SliderValue) { if (this.preval === value) return; this.preval = value; @@ -139,22 +142,22 @@ export default class Slider extends SuperComponent { // 基本样式未初始化,等待初始化后在改变数据。 if (this.data.maxRange === 0) { - this.getInitialStyle().then(setValueAndTrigger); + this.init().then(setValueAndTrigger); return; } setValueAndTrigger(); } - handleMask(marks: any) { + handleMark(marks: any) { const calcPos = (arr: number[]) => { - const { theme } = this.properties; + const { max, theme } = this.properties; const { blockSize, maxRange } = this.data; const margin = (theme as any) === 'capsule' ? blockSize / 2 : 0; return arr.map((item) => ({ val: item, - left: Math.round((item / 100) * maxRange) + margin, + left: Math.round((item / Number(max)) * maxRange) + margin, })); }; if (marks?.length && Array.isArray(marks)) { @@ -189,7 +192,7 @@ export default class Slider extends SuperComponent { }); } - async getInitialStyle() { + async init() { const line: boundingClientRect = await getRect(this, '#sliderLine'); const { blockSize } = this.data; const { theme } = this.properties; @@ -198,6 +201,8 @@ export default class Slider extends SuperComponent { let initialLeft = line.left; let initialRight = line.right; + if (initialLeft === 0 && initialRight === 0) return; + if ((theme as any) === 'capsule') { maxRange = maxRange - Number(blockSize) - 6; // 6 是边框宽度 initialLeft -= halfBlock; diff --git a/src/stepper/stepper.ts b/src/stepper/stepper.ts index 0cb809341..64f8ebf77 100644 --- a/src/stepper/stepper.ts +++ b/src/stepper/stepper.ts @@ -24,6 +24,7 @@ export default class Stepper extends SuperComponent { observers = { value(v) { + this.preValue = Number(v); this.setData({ currentValue: Number(v), }); @@ -65,6 +66,8 @@ export default class Stepper extends SuperComponent { } setValue(value) { + if (this.preValue === value) return; + this.preValue = value; this._trigger('change', { value }); } diff --git a/src/tab-panel/props.ts b/src/tab-panel/props.ts index 8915a6357..bc991282a 100644 --- a/src/tab-panel/props.ts +++ b/src/tab-panel/props.ts @@ -11,7 +11,7 @@ const props: TdTabPanelProps = { type: Object, value: null, }, - /** 选项卡内容隐藏时是否销毁 */ + /** 【实现有误,暂不支持】选项卡内容隐藏时是否销毁 */ destroyOnHide: { type: Boolean, value: true, diff --git a/src/tab-panel/type.ts b/src/tab-panel/type.ts index 40440d995..d35b546d1 100644 --- a/src/tab-panel/type.ts +++ b/src/tab-panel/type.ts @@ -16,7 +16,7 @@ export interface TdTabPanelProps { value?: object; }; /** - * 选项卡内容隐藏时是否销毁 + * 【实现有误,暂不支持】选项卡内容隐藏时是否销毁 * @default true */ destroyOnHide?: { diff --git a/src/tabs/README.en-US.md b/src/tabs/README.en-US.md index e57ca0e16..262f4f677 100644 --- a/src/tabs/README.en-US.md +++ b/src/tabs/README.en-US.md @@ -7,9 +7,10 @@ name | type | default | description | required -- | -- | -- | -- | -- animation | Object | - | Typescript:`TabAnimation` `type TabAnimation = { duration: number } & Record`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N external-classes | Array | - | `['t-class', 't-class-item', 't-class-active', 't-class-track']` | N -middle | Slot | - | \- | N +middle | Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N show-bottom-line | Boolean | true | \- | N space-evenly | Boolean | true | \- | N +split | Boolean | true | `1.1.10` | N sticky | Boolean | false | \- | N sticky-props | Object | - | Typescript:`StickyProps`,[Sticky API Documents](./sticky?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N swipeable | Boolean | true | \- | N @@ -34,5 +35,5 @@ destroy-on-hide | Boolean | true | \- | N disabled | Boolean | false | \- | N icon | String / Object | - | `1.0.0-rc.1` | N label | String | - | \- | N -panel | String / Slot | - | \- | N +panel | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N value | String / Number | - | Typescript:`TabValue`,[Tabs API Documents](./tabs?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-panel/type.ts) | N diff --git a/src/tabs/README.md b/src/tabs/README.md index 523bf1711..744854f7c 100644 --- a/src/tabs/README.md +++ b/src/tabs/README.md @@ -112,11 +112,12 @@ Page({ 名称 | 类型 | 默认值 | 说明 | 必传 -- | -- | -- | -- | -- -animation | Object | - | 动画效果设置。其中 duration 表示动画时长。(单位秒)TS 类型:`TabAnimation` `type TabAnimation = { duration: number } & Record`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N +animation | Object | - | 动画效果设置。其中 duration 表示动画时长。(单位:秒)。TS 类型:`TabAnimation` `type TabAnimation = { duration: number } & Record`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N external-classes | Array | - | 组件类名,分别用于设置 组件外层元素、选项卡单项、选项卡激活态、滚动条样式类名 等类名。`['t-class', 't-class-item', 't-class-active', 't-class-track']` | N -middle | Slot | - | 中间内容,介于头部和内容之间 | N +middle | Slot | - | 中间内容,介于头部和内容之间。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N show-bottom-line | Boolean | true | 是否展示底部激活线条 | N space-evenly | Boolean | true | 选项卡头部空间是否均分 | N +split | Boolean | true | `1.1.10`。是否展示分割线 | N sticky | Boolean | false | 是否开启粘性布局 | N sticky-props | Object | - | 透传至 Sticky 组件。TS 类型:`StickyProps`,[Sticky API Documents](./sticky?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N swipeable | Boolean | true | 是否可以滑动切换 | N @@ -141,5 +142,5 @@ destroy-on-hide | Boolean | true | 【实现有误,暂不支持】选项卡内 disabled | Boolean | false | 是否禁用当前选项卡 | N icon | String / Object | - | `1.0.0-rc.1`。图标,传对象则透传至 Icon | N label | String | - | 选项卡名称 | N -panel | String / Slot | - | 用于自定义选项卡面板内容 | N +panel | String / Slot | - | 用于自定义选项卡面板内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N value | String / Number | - | 选项卡的值,唯一标识。TS 类型:`TabValue`,[Tabs API Documents](./tabs?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-panel/type.ts) | N diff --git a/src/tabs/props.ts b/src/tabs/props.ts index e754115d8..39832dd65 100644 --- a/src/tabs/props.ts +++ b/src/tabs/props.ts @@ -6,7 +6,7 @@ import { TdTabsProps } from './type'; const props: TdTabsProps = { - /** 动画效果设置。其中 duration 表示动画时长 */ + /** 动画效果设置。其中 duration 表示动画时长。(单位:秒) */ animation: { type: Object, }, @@ -24,6 +24,11 @@ const props: TdTabsProps = { type: Boolean, value: true, }, + /** 是否展示分割线 */ + split: { + type: Boolean, + value: true, + }, /** 是否开启粘性布局 */ sticky: { type: Boolean, diff --git a/src/tabs/tabs.less b/src/tabs/tabs.less index 5d8ed5e92..19209cf07 100644 --- a/src/tabs/tabs.less +++ b/src/tabs/tabs.less @@ -194,7 +194,10 @@ &__scroll { position: relative; height: @tab-item-height; - .border(bottom, @tab-border-color); + + &--split { + .border(bottom, @tab-border-color); + } &::-webkit-scrollbar { display: none; diff --git a/src/tabs/tabs.wxml b/src/tabs/tabs.wxml index c716f9ca7..1ca9e8a9e 100644 --- a/src/tabs/tabs.wxml +++ b/src/tabs/tabs.wxml @@ -14,7 +14,7 @@ > { // gridConfig: width、 height expect($gridItemWrapper.dom.getAttribute('style')).toEqual( - `width:${comp.data.gridConfig.width}px;height:${comp.data.gridConfig.height}px`, + `align-self:flex-end;width:${comp.data.gridConfig.width}px;height:${comp.data.gridConfig.height}px`, ); // gridConfig: column diff --git a/src/upload/upload.ts b/src/upload/upload.ts index 8a34fa3cf..d12b84418 100644 --- a/src/upload/upload.ts +++ b/src/upload/upload.ts @@ -128,7 +128,7 @@ export default class Upload extends SuperComponent { if (!isObject(gridConfig)) gridConfig = {}; const { column = 4, width = 160, height = 160 } = gridConfig as any; this.setData({ - gridItemStyle: `width:${width}rpx;height:${height}rpx`, + gridItemStyle: `align-self:flex-end;width:${width}rpx;height:${height}rpx`, column: column, }); }