Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/components/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,16 @@ export default class Calendar extends SuperComponent {
updateActionButton(value: Date) {
const _min = this.getCurrentYearAndMonth(this.base.minDate);
const _max = this.getCurrentYearAndMonth(this.base.maxDate);
const _value = this.getCurrentYearAndMonth(value);

const _minTimestamp = new Date(_min.year, _min.month, 1).getTime();
const _maxTimestamp = new Date(_max.year, _max.month, 1).getTime();
const _dateValue = new Date(_value.year, _value.month, 1);

const _prevYearTimestamp = getPrevYear(value).getTime();
const _prevMonthTimestamp = getPrevMonth(value).getTime();
const _nextMonthTimestamp = getNextMonth(value).getTime();
const _nextYearTimestamp = getNextYear(value).getTime();
const _prevYearTimestamp = getPrevYear(_dateValue).getTime();
const _prevMonthTimestamp = getPrevMonth(_dateValue).getTime();
const _nextMonthTimestamp = getNextMonth(_dateValue).getTime();
const _nextYearTimestamp = getNextYear(_dateValue).getTime();

const preYearBtnDisable = _prevYearTimestamp < _minTimestamp || _prevMonthTimestamp < _minTimestamp;
const prevMonthBtnDisable = _prevMonthTimestamp < _minTimestamp;
Expand Down
2 changes: 0 additions & 2 deletions packages/components/calendar/utils.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
export function getMonthByOffset(date: Date, offset: number) {
const _date = new Date(date);
_date.setMonth(_date.getMonth() + offset);
_date.setDate(1);
return _date;
}

export function getYearByOffset(date: Date, offset: number) {
const _date = new Date(date);
_date.setFullYear(_date.getFullYear() + offset);
_date.setDate(1);
return _date;
}

Expand Down
12 changes: 10 additions & 2 deletions packages/components/drawer/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,23 @@ style | Object | - | CSS(Cascading Style Sheets) | N
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
close-on-overlay-click | Boolean | true | \- | N
destroy-on-close | Boolean | false | \- | N
footer | Slot | - | `0.29.0`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/common/common.ts) | N

items | Array | - | Typescript:`DrawerItem[]` `interface DrawerItem { title: string; icon: string; }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/drawer/type.ts) | N
overlay-props | Object | {} | Typescript:`OverlayProps`,[Overlay API Documents](./overlay?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/drawer/type.ts) | N
placement | String | right | options: left/right | N
show-overlay | Boolean | true | \- | N
title | String / Slot | - | `0.29.0`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/common/common.ts) | N
title | String | - | `0.29.0` | N
using-custom-navbar | Boolean | false | \- | N
visible | Boolean | false | \- | N
z-index | Number | 11500 | \- | N

### Drawer Slots

name | Description
-- | --
footer | `0.29.0`
title | `0.29.0`

### Drawer Events

name | params | description
Expand Down
12 changes: 10 additions & 2 deletions packages/components/drawer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,23 @@ style | Object | - | 样式 | N
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
close-on-overlay-click | Boolean | true | 点击蒙层时是否触发抽屉关闭事件 | N
destroy-on-close | Boolean | false | 抽屉关闭时是否销毁节点 | N
footer | Slot | - | `0.29.0`。抽屉的底部。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/common/common.ts) | N

items | Array | - | 抽屉里的列表项。TS 类型:`DrawerItem[]` `interface DrawerItem { title: string; icon: string; }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/drawer/type.ts) | N
overlay-props | Object | {} | 遮罩层的属性,透传至 overlay。TS 类型:`OverlayProps`,[Overlay API Documents](./overlay?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/drawer/type.ts) | N
placement | String | right | 抽屉方向。可选项:left/right | N
show-overlay | Boolean | true | 是否显示遮罩层 | N
title | String / Slot | - | `0.29.0`。抽屉的标题。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/common/common.ts) | N
title | String | - | `0.29.0`。抽屉的标题 | N
using-custom-navbar | Boolean | false | 是否使用了自定义导航栏 | N
visible | Boolean | false | 组件是否可见 | N
z-index | Number | 11500 | 抽屉层级,样式默认为 11500 | N

### Drawer Slots

名称 | 描述
-- | --
footer | `0.29.0`。抽屉的底部
title | `0.29.0`。抽屉的标题

### Drawer Events

名称 | 参数 | 描述
Expand Down
4 changes: 2 additions & 2 deletions packages/components/drawer/drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class Drawer extends SuperComponent {

methods = {
// closeOnOverlayClick为true时才能触发popup的visible-change事件
visibleChange({ detail }) {
onVisibleChange({ detail }) {
const { visible } = detail;
const { showOverlay } = this.data;

Expand All @@ -41,7 +41,7 @@ export default class Drawer extends SuperComponent {
}
},

itemClick(detail) {
onItemClick(detail) {
const { index, item } = detail.currentTarget.dataset;

this.triggerEvent('item-click', { index, item });
Expand Down
13 changes: 7 additions & 6 deletions packages/components/drawer/drawer.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
wx:if="{{!destroyOnClose || visible}}"
style="{{_._style([style, customStyle])}}"
class="class"
bind:visible-change="visibleChange"
visible="{{visible}}"
zIndex="{{zIndex}}"
usingCustomNavbar="{{usingCustomNavbar}}"
z-index="{{zIndex}}"
using-custom-navbar="{{usingCustomNavbar}}"
placement="{{placement == 'right' ? 'right' : 'left'}}"
showOverlay="{{showOverlay}}"
closeOnOverlayClick="{{closeOnOverlayClick}}"
show-overlay="{{showOverlay}}"
overlay-props="{{overlayProps}}"
close-on-click-overlay="{{closeOnOverlayClick}}"
bind:visible-change="onVisibleChange"
>
<view class="{{classPrefix}}">
<slot name="title" />
Expand All @@ -26,9 +27,9 @@
wx:key="index"
data-item="{{item}}"
data-index="{{index}}"
bindtap="itemClick"
aria-role="{{ ariaRole || 'button' }}"
aria-label="{{item.title}}"
bindtap="onItemClick"
>
<view aria-hidden="{{true}}" wx:if="{{item.icon}}" class="{{classPrefix}}__sidebar-item-icon">
<t-icon name="{{item.icon}}" />
Expand Down
5 changes: 5 additions & 0 deletions packages/components/drawer/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ const props: TdDrawerProps = {
items: {
type: Array,
},
/** 遮罩层的属性,透传至 overlay */
overlayProps: {
type: Object,
value: {},
},
/** 抽屉方向 */
placement: {
type: String,
Expand Down
10 changes: 10 additions & 0 deletions packages/components/drawer/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { OverlayProps } from '../overlay/index';

export interface TdDrawerProps {
/**
* 点击蒙层时是否触发抽屉关闭事件
Expand All @@ -28,6 +30,14 @@ export interface TdDrawerProps {
type: ArrayConstructor;
value?: DrawerItem[];
};
/**
* 遮罩层的属性,透传至 overlay
* @default {}
*/
overlayProps?: {
type: ObjectConstructor;
value?: OverlayProps;
};
/**
* 抽屉方向
* @default right
Expand Down
1 change: 0 additions & 1 deletion packages/components/dropdown-menu/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ Name | Default Value | Description
--td-dropdown-menu-height | 96rpx | -
--td-dropdown-menu-icon-size | 40rpx | -
--td-dropdown-body-max-height | 560rpx | -
--td-dropdown-menu-bg-color | @bg-color-container | -
--td-tree-bg-color | @bg-color-container | -
--td-tree-item-active-color | @brand-color | -
--td-tree-item-font-size | 32rpx | -
Expand Down
1 change: 0 additions & 1 deletion packages/components/dropdown-menu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ t-class-footer | 底部样式类
--td-dropdown-menu-height | 96rpx | -
--td-dropdown-menu-icon-size | 40rpx | -
--td-dropdown-body-max-height | 560rpx | -
--td-dropdown-menu-bg-color | @bg-color-container | -
--td-tree-bg-color | @bg-color-container | -
--td-tree-item-active-color | @brand-color | -
--td-tree-item-font-size | 32rpx | -
Expand Down
10 changes: 10 additions & 0 deletions packages/components/form-item/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,13 @@ name | String | - | \- | N
required-mark | Boolean | undefined | \- | N
rules | Array | - | Typescript:`Array<FormRule>` | N
show-error-message | Boolean | undefined | \- | N

### CSS Variables

The component provides the following CSS variables, which can be used to customize styles.
Name | Default Value | Description
-- | -- | --
--td-form-item-horizontal-padding | 32rpx | -
--td-form-item-justify-content | space-between | -
--td-form-item-label-width | 160rpx | -
--td-form-item-vertical-padding | 32rpx | -
10 changes: 10 additions & 0 deletions packages/components/form-item/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,13 @@ name | String | - | 表单字段名称 | N
required-mark | Boolean | undefined | 是否显示必填符号(*),优先级高于 Form.requiredMark | N
rules | Array | - | 【开发中】 | N
show-error-message | Boolean | undefined | 校验不通过时,是否显示错误提示信息,优先级高于 `Form.showErrorMessage` | N

### CSS Variables

组件提供了下列 CSS 变量,可用于自定义样式。
名称 | 默认值 | 描述
-- | -- | --
--td-form-item-horizontal-padding | 32rpx | -
--td-form-item-justify-content | space-between | -
--td-form-item-label-width | 160rpx | -
--td-form-item-vertical-padding | 32rpx | -
14 changes: 14 additions & 0 deletions packages/components/form/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,17 @@ telnumber | String | - | \- | N
url | String | - | \- | N
validator | String | - | \- | N
whitespace | String | - | \- | N

### CSS Variables

The component provides the following CSS variables, which can be used to customize styles.
Name | Default Value | Description
-- | -- | --
--td-form-bg-color | @bg-color-container | -
--td-form-border-radius | 0 | -
--td-form-padding | 0 | -
--td-form-readonly-bg-color | @bg-color-secondarycontainer | -
--td-form-item-horizontal-padding | 32rpx | -
--td-form-item-justify-content | space-between | -
--td-form-item-label-width | 160rpx | -
--td-form-item-vertical-padding | 32rpx | -
14 changes: 14 additions & 0 deletions packages/components/form/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,17 @@ telnumber | String | - | 手机号号码校验不通过时的表单项显示文
url | String | - | 链接校验规则不通过时的表单项显示文案,全局配置默认是:`'请输入正确的${name}'` | N
validator | String | - | 自定义校验规则校验不通过时的表单项显示文案,全局配置默认是:'${name}不符合要求' | N
whitespace | String | - | 值为空格校验不通过时表单项显示文案,全局配置默认是:`'${name}不能为空` | N

### CSS Variables

组件提供了下列 CSS 变量,可用于自定义样式。
名称 | 默认值 | 描述
-- | -- | --
--td-form-bg-color | @bg-color-container | -
--td-form-border-radius | 0 | -
--td-form-padding | 0 | -
--td-form-readonly-bg-color | @bg-color-secondarycontainer | -
--td-form-item-horizontal-padding | 32rpx | -
--td-form-item-justify-content | space-between | -
--td-form-item-label-width | 160rpx | -
--td-form-item-vertical-padding | 32rpx | -
10 changes: 5 additions & 5 deletions packages/components/guide/guide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,22 +189,22 @@ export default class Guide extends SuperComponent {
},
onTplButtonTap(e) {
const { type } = e.target.dataset;
const parmas = { e, current: this.data.current, total: this.data.steps.length };
const params = { e, current: this.data.current, total: this.data.steps.length };
switch (type) {
case 'next':
this.triggerEvent('next-step-click', { next: this.data.current + 1, ...parmas });
this.triggerEvent('next-step-click', { next: this.data.current + 1, ...params });
this.setData({ current: this.data.current + 1 });
break;
case 'skip':
this.triggerEvent('skip', parmas);
this.triggerEvent('skip', params);
this.setData({ current: -1 });
break;
case 'back':
this.triggerEvent('back', parmas);
this.triggerEvent('back', params);
this.setData({ current: 0 });
break;
case 'finish':
this.triggerEvent('finish', parmas);
this.triggerEvent('finish', params);
this.setData({ current: -1 });
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion packages/components/indexes-anchor/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ Name | Default Value | Description
--td-indexes-anchor-font-size | 28rpx | -
--td-indexes-anchor-line-height | 44rpx | -
--td-indexes-anchor-padding | 8rpx 32rpx | -
--td-indexes-anchor-top | 0 | -
--td-indexes-anchor-top | 0 | -
2 changes: 1 addition & 1 deletion packages/components/indexes-anchor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ t-class | 根节点样式类
--td-indexes-anchor-font-size | 28rpx | -
--td-indexes-anchor-line-height | 44rpx | -
--td-indexes-anchor-padding | 8rpx 32rpx | -
--td-indexes-anchor-top | 0 | -
--td-indexes-anchor-top | 0 | -
6 changes: 4 additions & 2 deletions packages/components/indexes/_example/base/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Page({
data: {
defaultCurrent: 'B',
current: 'B',
indexList: [],
list: [
{
Expand Down Expand Up @@ -104,7 +104,9 @@ Page({

onChange(e) {
const { index } = e.detail;

this.setData({
current: index,
});
console.log('change:', index);
},

Expand Down
2 changes: 1 addition & 1 deletion packages/components/indexes/_example/base/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<t-navbar title="TDesign" leftArrow />
</view>
<t-indexes
current="{{defaultCurrent}}"
current="{{current}}"
index-list="{{indexList}}"
sticky-offset="{{stickyOffset}}"
bind:select="onSelect"
Expand Down
32 changes: 16 additions & 16 deletions packages/components/progress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,21 @@ t-class-label | 标签样式类
### CSS Variables

组件提供了下列 CSS 变量,可用于自定义样式。
名称 | 默认值 | 描述
名称 | 默认值 | 描述
-- | -- | --
--td-progress-info-dark-color | @text-color-primary | -
--td-progress-info-light-color | @text-color-anti | -
--td-progress-inner-bg-color-active | @bg-color-container | -
--td-progress-inner-bg-color-error | @error-color | -
--td-progress-inner-bg-color-success | @success-color | -
--td-progress-inner-bg-color-warning | @warning-color | -
--td-progress-circle-inner-bg-color | @text-color-anti | -
--td-progress-circle-label-font-size | 40rpx | -
--td-progress-circle-label-font-weight | 700 | -
--td-progress-circle-label-line-height | 56rpx | -
--td-progress-circle-width | 224rpx | -
--td-progress-inner-bg-color | @brand-color | -
--td-progress-line-stroke-width | 12rpx | -
--td-progress-stroke-circle-width | 12rpx | -
--td-progress-stroke-plump-width | 40rpx | -
--td-progress-info-dark-color | @text-color-primary | -
--td-progress-info-light-color | @text-color-anti | -
--td-progress-inner-bg-color-active | @bg-color-container | -
--td-progress-inner-bg-color-error | @error-color | -
--td-progress-inner-bg-color-success | @success-color | -
--td-progress-inner-bg-color-warning | @warning-color | -
--td-progress-circle-inner-bg-color | @text-color-anti | -
--td-progress-circle-label-font-size | 40rpx | -
--td-progress-circle-label-font-weight | 700 | -
--td-progress-circle-label-line-height | 56rpx | -
--td-progress-circle-width | 224rpx | -
--td-progress-inner-bg-color | @brand-color | -
--td-progress-line-stroke-width | 12rpx | -
--td-progress-stroke-circle-width | 12rpx | -
--td-progress-stroke-plump-width | 40rpx | -
--td-progress-track-bg-color | @bg-color-component | -
4 changes: 3 additions & 1 deletion packages/components/side-bar-item/side-bar-item.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

@side-bar-color: var(--td-side-bar-color, @text-color-primary);
@side-bar-font-size: var(--td-side-bar-font-size, 32rpx);
@side-bar-item-height: var(--td-side-bar-item-height, 112rpx);
@side-bar-item-height: var(--td-side-bar-item-height, auto);
@side-bar-item-line-height: var(--td-side-bar-item-line-height, 48rpx);
@side-bar-bg-color: var(--td-side-bar-bg-color, @bg-color-secondarycontainer);
@side-bar-disabled-color: var(--td-side-bar-disabled-color, @text-color-disabled);
Expand Down Expand Up @@ -73,6 +73,8 @@

&--disabled {
color: @side-bar-disabled-color;

--td-badge-content-text-color: @side-bar-disabled-color;
}

&__line {
Expand Down
Loading
Loading