Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into chore/release126
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
jarmywang committed Dec 22, 2023
2 parents a51f5a5 + 323a28d commit 7c3a97e
Show file tree
Hide file tree
Showing 75 changed files with 492 additions and 135 deletions.
2 changes: 1 addition & 1 deletion .github/issue-shoot.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
- 期望完成时间: {{ .deadline }}
- 开发难度: {{ .level }}
- 参与人数: 1
- 需求对接人: jeannehuang;anlyyao
- 需求对接人: jeannehuang;anlyyao;jarmywang
- 验收标准: 实现期望改造效果,提 PR 并通过验收无误
- 备注: 最终激励以实际提交 `pull request` 并合并为准
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"editor.formatOnSave": true,
"eslint.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll.tslint": true,
"source.fixAll.eslint": true
"source.fixAll.tslint": "explicit",
"source.fixAll.eslint": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
Expand All @@ -15,6 +15,7 @@
},
"minapp-vscode.reserveTags": ["text"],
"files.associations": {
"*.wxml": "html",
"*.wxss": "css",
"*.wxs": "javascript"
},
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ docClass: timeline
---


## 🌈 1.2.6 `2023-12-22`
### 🚀 Features
- `Upload`: 新增 `disabled` 属性,首页补充服务声明 @anlyyao ([#2489](https://github.com/Tencent/tdesign-miniprogram/pull/2489))
- `NoticeBar`: 新增 `change` 事件,仅在 `direction``vertical` 时有效 @betavs ([#2492](https://github.com/Tencent/tdesign-miniprogram/pull/2492))
- `Fab`: 悬浮按钮支持拖拽 @hkaikai ([#2478](https://github.com/Tencent/tdesign-miniprogram/pull/2478))
- `Checkbox`: `change` 事件新增参数 `context`,返回当前点击项内容 @gjl-0810 ([#2469](https://github.com/Tencent/tdesign-miniprogram/pull/2469))
### 🐞 Bug Fixes
- `Calender`: 兼容 `glass-easel` 框架真机环境 `<include>` 节点上不支持 `wx:` 指令 @jarmywang ([#2491](https://github.com/Tencent/tdesign-miniprogram/pull/2491))
- `Step`: 修复 `status` 属性变更后子项未及时更新的问题 @betavs ([#2480](https://github.com/Tencent/tdesign-miniprogram/pull/2480))
- `NoticeBar`: 处理基础库为 `3.x.x` 时控制台报错的问题 @betavs ([#2470](https://github.com/Tencent/tdesign-miniprogram/pull/2470))
- `Input`: 修复 `type``digit``number`时,`maxlength``maxcharacter` 属性无效的问题 @zyqq ([#2497](https://github.com/Tencent/tdesign-miniprogram/pull/2497))
- `Grid`: 修复 `hover` 属性无效的问题 @betavs ([#2508](https://github.com/Tencent/tdesign-miniprogram/pull/2508))
- `Tabbar`: 修复徽标遮挡底部内容的问题 @yangbai1991 ([#2456](https://github.com/Tencent/tdesign-miniprogram/pull/2456))
### 🚧 Others
- `Icon`: 弃用 `wx.setClipboardData` 防止收集用户信息。 @anlyyao ([#2498](https://github.com/Tencent/tdesign-miniprogram/pull/2498))
- `Textarea`: 更新文档默认值 @betavs ([#2507](https://github.com/Tencent/tdesign-miniprogram/pull/2507))


## 🌈 1.2.5 `2023-12-08`
### 🚀 Features
- `Cell`: 新增外部样式类 `t-class-center` @anlyyao ([#2439](https://github.com/Tencent/tdesign-miniprogram/pull/2439))
Expand All @@ -15,6 +33,9 @@ docClass: timeline
- `Checkbox`: 修复 `checked` 属性无效的问题 @Nightmare1664 ([#2455](https://github.com/Tencent/tdesign-miniprogram/pull/2455))
- `Upload`: 处理关闭按钮溢出问题 @betavs ([#2449](https://github.com/Tencent/tdesign-miniprogram/pull/2449))
- `DateTimePicker`: 组件支持国际化。目前支持简体中文(zh)、 (tc)、 英文(en)、日语(ja)、 韩语(ko)、俄语(ru) 等六种语言 @eric-lua ([#2464](https://github.com/Tencent/tdesign-miniprogram/pull/2464))
- `Calendar`: 修复 `use-popup``false` 时,组件未适应父容器宽度的问题 @yangbai1991 ([#2458](https://github.com/Tencent/tdesign-miniprogram/pull/2458))
- `Checkbox`: 修复 `checked` 属性无效的问题 @Nightmare1664 ([#2455](https://github.com/Tencent/tdesign-miniprogram/pull/2455))
- `DateTimePicker`: 组件支持国际化。目前支持简体中文(zh)、 (tc)、 英文(en)、日语(ja)、 韩语(ko)、俄语(ru) 等六种语言 @eric-lua ([#2464](https://github.com/Tencent/tdesign-miniprogram/pull/2464))
### 🚧 Others
- `Textarea`: 修复文档 `confirm-type` 属性默认值描述错误 @betavs ([#2475](https://github.com/Tencent/tdesign-miniprogram/pull/2475))
- `BackTop`: 返回顶部按钮,增加 `iphone` 底部安全区 @leozeli ([#2457](https://github.com/Tencent/tdesign-miniprogram/pull/2457))
Expand All @@ -37,6 +58,7 @@ docClass: timeline
### 🚧 Others
- `Tabs`: 更新示例 @Xcyq ([#2386](https://github.com/Tencent/tdesign-miniprogram/pull/2386))


## 🌈 1.2.3 `2023-09-14`
### 🚀 Features
- `ImageViewer`:支持无障碍访问
Expand Down
3 changes: 2 additions & 1 deletion example/pages/home/home.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"usingComponents": {
"pull-down-list": "../../components/pull-down-list/index",
"t-footer": "tdesign-miniprogram/footer/footer"
"t-footer": "tdesign-miniprogram/footer/footer",
"trd-privacy": "/components/trd-privacy/privacy"
},
"navigationBarTitleText": "TDesign UI",
"navigationBarBackgroundColor": "#f6f6f6",
Expand Down
8 changes: 8 additions & 0 deletions example/pages/home/home.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ page {
text-align: center;
}

.show_privacy {
color: #576b95;
text-align: right;
line-height: 50rpx;
font-size: 24rpx;
text-align: center;
}

.title-wrap {
display: flex;
align-items: center;
Expand Down
6 changes: 6 additions & 0 deletions example/pages/home/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ Page({
url: `/pages/${str.page}/${str.page}`,
});
}

this.trdPrivacy = this.selectComponent('#trdPrivacy');
},

showPrivacyWin() {
this.trdPrivacy.showPrivacyWin();
},

clickHandle(e) {
Expand Down
3 changes: 3 additions & 0 deletions example/pages/home/home.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
/>
</view>
<view class="footer">
<view class="show_privacy" bindtap="showPrivacyWin">《TDesign组件库服务声明》</view>
<t-footer text="该小程序仅演示示例,不收集个人信息。"></t-footer>
<t-footer text="Copyright © 1998 - {{currentYear}} Tencent. All Rights Reserved. 腾讯公司 版权所有"></t-footer>
</view>
<trd-privacy id="trdPrivacy" name="TDesign组件库" date="2023年11月14日" winStyle="{{winStyle}}"></trd-privacy>
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tdesign-miniprogram",
"purename": "tdesign",
"version": "1.2.5",
"version": "1.2.6",
"description": "tdesign-miniprogram",
"title": "tdesign-ßminiprogram",
"main": "miniprogram_dist/index.js",
Expand Down Expand Up @@ -125,4 +125,4 @@
"dependencies": {
"dayjs": "^1.10.7"
}
}
}
14 changes: 4 additions & 10 deletions src/badge/__test__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ exports[`Badge Badge base demo works fine 1`] = `
class="wrapper"
content="消息"
dot="{{true}}"
offset="{{
Array [
-4,
4,
]
}}"
/>
<t-badge
class="wrapper"
Expand Down Expand Up @@ -66,7 +60,7 @@ exports[`Badge Badge base demo works fine 1`] = `
count="8"
offset="{{
Array [
-8,
4,
]
}}"
/>
Expand All @@ -75,7 +69,7 @@ exports[`Badge Badge base demo works fine 1`] = `
count="2"
offset="{{
Array [
-2,
2,
-2,
]
}}"
Expand Down Expand Up @@ -193,7 +187,7 @@ exports[`Badge Badge theme demo works fine 1`] = `
count="2"
offset="{{
Array [
-2,
2,
-2,
]
}}"
Expand All @@ -217,7 +211,7 @@ exports[`Badge Badge theme demo works fine 1`] = `
count="2"
offset="{{
Array [
-2,
1,
-2,
]
}}"
Expand Down
2 changes: 0 additions & 2 deletions src/badge/__test__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ describe('badge', () => {

const $count = comp.querySelector('.badge >>> .t-badge--basic');
expect($count.dom.style.top).toBe('20em');
expect($count.dom.style.right).toBe('15px');
});

it(':offset number without unit', async () => {
Expand All @@ -229,6 +228,5 @@ describe('badge', () => {

const $count = comp.querySelector('.badge >>> .t-badge--basic');
expect($count.dom.style.top).toBe('29px');
expect($count.dom.style.right).toBe('16px');
});
});
6 changes: 3 additions & 3 deletions src/badge/_example/base/index.wxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<view class="demo-desc">红点徽标</view>
<view class="demo-wrapper">
<t-badge dot offset="{{ [-4, 4] }}" class="wrapper" content="消息" />
<t-badge dot class="wrapper" content="消息" />
<t-badge dot offset="{{ [1, -1] }}" class="wrapper">
<t-icon name="notification" size="24" ariaLabel="通知" />
</t-badge>
Expand All @@ -11,8 +11,8 @@

<view class="demo-desc">数字徽标</view>
<view class="demo-wrapper">
<t-badge count="8" content="消息" offset="{{ [-8] }}" class="wrapper" />
<t-badge count="2" offset="{{ [-2, -2] }}" class="wrapper">
<t-badge count="8" content="消息" offset="{{ [4] }}" class="wrapper" />
<t-badge count="2" offset="{{ [2, -2] }}" class="wrapper">
<t-icon name="notification" size="24" ariaLabel="通知" />
</t-badge>
<t-badge count="8" offset="{{ [2, 2] }}" class="wrapper">
Expand Down
4 changes: 2 additions & 2 deletions src/badge/_example/theme/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

<view class="demo-desc">圆形徽标</view>
<view class="demo-wrapper">
<t-badge count="2" offset="{{ [-2, -2] }}">
<t-badge count="2" offset="{{ [2, -2] }}">
<t-icon name="notification" size="24" ariaLabel="通知" />
</t-badge>
</view>

<view class="demo-desc">方形徽标</view>
<view class="demo-wrapper">
<t-badge count="2" shape="square" offset="{{ [-2, -2] }}">
<t-badge count="2" shape="square" offset="{{ [1, -2] }}">
<t-icon name="notification" size="24" ariaLabel="通知" />
</t-badge>
</view>
Expand Down
4 changes: 2 additions & 2 deletions src/badge/badge.less
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@
}

&__content:not(:empty) + .t-has-count {
transform: translate(50%, -50%);
transform: translate(-50%, -50%);
position: absolute;
right: 0;
left: 100%;
top: 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/badge/badge.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var getBadgeStyles = function (props) {
styleStr += 'background:' + props.color + ';';
}
if (props.offset[0]) {
styleStr += 'right:' + (hasUnit(props.offset[0].toString()) ? props.offset[0] : props.offset[0] + 'px') + ';';
styleStr += 'left: calc(100% + ' + (hasUnit(props.offset[0].toString()) ? props.offset[0] : props.offset[0] + 'px') + ');';
}
if (props.offset[1]) {
styleStr += 'top:' + (hasUnit(props.offset[1].toString()) ? props.offset[1] : props.offset[1] + 'px') + ';';
Expand Down
4 changes: 3 additions & 1 deletion src/calendar/calendar.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
>
<include src="./template.wxml" />
</t-popup>
<include wx:else src="./template.wxml" />
<block wx:else>
<include src="./template.wxml" />
</block>
6 changes: 3 additions & 3 deletions src/checkbox-group/checkbox-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default class CheckBoxGroup extends SuperComponent {
}
},

updateValue({ value, checked, checkAll, indeterminate }) {
updateValue({ value, checked, checkAll, item, indeterminate }) {
let { value: newValue } = this.data;
const { max } = this.data;
const keySet = new Set(this.getChildren().map((item) => item.data.value));
Expand Down Expand Up @@ -104,7 +104,7 @@ export default class CheckBoxGroup extends SuperComponent {
newValue.splice(index, 1);
}

this._trigger('change', { value: newValue });
this._trigger('change', { value: newValue, context: item });
},

initWithOptions() {
Expand Down Expand Up @@ -137,7 +137,7 @@ export default class CheckBoxGroup extends SuperComponent {
rect.indeterminate = this.$checkAll?.data.indeterminate;
}

this.updateValue({ ...item, checked, ...rect });
this.updateValue({ ...item, checked, item, ...rect });
},

setCheckall() {
Expand Down
4 changes: 2 additions & 2 deletions src/checkbox/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ value | String / Number / Boolean | - | value of checkbox。Typescript:`string

name | params | description
-- | -- | --
change | `(checked: boolean)` | \-
change | `(checked: boolean, context: { value: boolean|number|string, label: boolean|number|string })` | \-

### CheckboxGroup Props

Expand All @@ -46,7 +46,7 @@ default-value | Array | undefined | uncontrolled property。Typescript:`T` `ty

name | params | description
-- | -- | --
change | `(value: CheckboxGroupValue)` | \-
change | `(value: CheckboxGroupValue, context: { value: boolean|number|string, label: boolean|number|string })` | \-


### CSS Variables
Expand Down
4 changes: 2 additions & 2 deletions src/checkbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ value | String / Number / Boolean | - | 多选框的值。TS 类型:`string \|

名称 | 参数 | 描述
-- | -- | --
change | `(checked: boolean)` | 值变化时触发
change | `(checked: boolean, context: { value: boolean|number|string, label: boolean|number|string })` | 值变化时触发`context` 表示当前点击项内容。

### Checkbox 外部样式类
类名 | 说明
Expand All @@ -113,7 +113,7 @@ default-value | Array | undefined | 选中值。非受控属性。TS 类型:`T

名称 | 参数 | 描述
-- | -- | --
change | `(value: CheckboxGroupValue)` | 值变化时触发
change | `(value: CheckboxGroupValue, context: { value: boolean|number|string, label: boolean|number|string })` | 值变化时触发`context` 表示当前点击项内容。


### CSS 变量
Expand Down
4 changes: 2 additions & 2 deletions src/checkbox/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ export default class CheckBox extends SuperComponent {
if (target === 'text' && contentDisabled) {
return;
}

const { value, label } = this.data;
const checked = !this.data.checked;
const parent = this.$parent;

if (parent) {
parent.updateValue({ ...this.data, checked });
} else {
this._trigger('change', { checked });
this._trigger('change', { context: { value, label }, checked });
}
},
};
Expand Down
22 changes: 15 additions & 7 deletions src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,20 @@ export const getRect = function (context: any, selector: string, needAll: boolea
});
};

const isDef = function (value: any): boolean {
return value !== undefined && value !== null;
};

export const isNumber = function (value) {
return /^\d+(\.\d+)?$/.test(value);
};

export const isNull = function (value: any): boolean {
return value === null;
};

export const isUndefined = (value: any): boolean => typeof value === 'undefined';

export const isDef = function (value: any): boolean {
return !isUndefined(value) && !isNull(value);
};

export const addUnit = function (value?: string | number): string | undefined {
if (!isDef(value)) {
return undefined;
Expand All @@ -128,12 +134,14 @@ export const addUnit = function (value?: string | number): string | undefined {

/**
* 计算字符串字符的长度并可以截取字符串。
* @param str 传入字符串(maxcharacter条件下,一个汉字表示两个字符)
* @param char 传入字符串(maxcharacter条件下,一个汉字表示两个字符)
* @param max 规定最大字符串长度
* @returns 当没有传入maxCharacter/maxLength 时返回字符串字符长度,当传入maxCharacter/maxLength时返回截取之后的字符串和长度。
*/
export const getCharacterLength = (type: string, str: string, max?: number) => {
if (!str || str.length === 0) {
export const getCharacterLength = (type: string, char: string | number, max?: number) => {
const str = String(char ?? '');

if (str.length === 0) {
return {
length: 0,
characters: '',
Expand Down
1 change: 1 addition & 0 deletions src/fab/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ button-props | Object | - | \- | N
icon | String | - | \- | N
style | String | right: 16px; bottom: 32px; | \- | N
text | String | - | \- | N
draggable | Boolean / String | false | \- | N

### Fab Events

Expand Down
Loading

0 comments on commit 7c3a97e

Please sign in to comment.