白色主题

This commit is contained in:
2023-02-12 19:04:01 +08:00
parent d736a5912f
commit 57ab6fbb49
411 changed files with 1752 additions and 5304 deletions

View File

@@ -6,13 +6,12 @@
name | type | default | description | required
-- | -- | -- | -- | --
bordered | Boolean | true | \- | N
custom-style `v0.25.0` | String | - | \- | N
custom-style | String | - | `0.25.0` | N
external-classes | Array | - | `['t-class']` | N
fixed | Boolean | true | \- | N
safe-area-inset-bottom | Boolean | true | \- | N
shape | String | normal | optionsnormal/round | N
split | Boolean | true | \- | N
style | String | - | \- | N
theme | String | normal | optionsnormal/tag | N
value | String / Number / Array | null | Typescript`string \| number \| Array<string \| number>` | N
default-value | String / Number / Array | undefined | uncontrolled property。Typescript`string \| number \| Array<string \| number>` | N
@@ -21,15 +20,14 @@ default-value | String / Number / Array | undefined | uncontrolled property。Ty
name | params | description
-- | -- | --
change | \- | \-
change | `(value: string \| number)` | \-
### TabBarItem Props
name | type | default | description | required
-- | -- | -- | -- | --
badge-props | Object | - | Typescript`BadgeProps`[Badge API Documents](./badge?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-bar/type.ts) | N
custom-style | String | - | \- | N
badge-props | Object | - | Typescript`BadgeProps`[Badge API Documents](./badge?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-bar-item/type.ts) | N
custom-style | String | - | `0.25.0` | N
icon | String / Slot | - | \- | N
style | String | - | \- | N
sub-tab-bar | Array | - | Typescript`SubTabBarItem[] ` `interface SubTabBarItem { value: string; label: string }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-bar/type.ts) | N
sub-tab-bar | Array | - | Typescript`SubTabBarItem[] ` `interface SubTabBarItem { value: string; label: string }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-bar-item/type.ts) | N
value | String / Number | - | \- | N

View File

@@ -13,7 +13,7 @@ isComponent: true
```json
"usingComponents": {
"t-tab-bar": "tdesign-miniprogram/tab-bar/tab-bar",
"t-tab-bar-item": "tdesign-miniprogram/tab-bar/tab-bar-item"
"t-tab-bar-item": "tdesign-miniprogram/tab-bar-item/tab-bar-item"
}
```
@@ -56,7 +56,7 @@ isComponent: true
名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
bordered | Boolean | true | 是否显示外边框 | N
custom-style `v0.25.0` | String | - | 自定义组件样式 | N
custom-style | String | - | `0.25.0`自定义组件样式 | N
external-classes | Array | - | 组件类名,用于设置外层元素类名。`['t-class']` | N
fixed | Boolean | true | 是否固定在底部 | N
safe-area-inset-bottom | Boolean | true | 是否为 iPhoneX 留出底部安全距离 | N
@@ -70,14 +70,14 @@ default-value | String / Number / Array | undefined | 当前选中标签的索
名称 | 参数 | 描述
-- | -- | --
change | `(value: string | number)` | 选中标签切换时触发
change | `(value: string \| number)` | 选中标签切换时触发
### TabBarItem Props
名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
badge-props | Object | - | 图标右上角提示信息。TS 类型:`BadgeProps`[Badge API Documents](./badge?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-bar/type.ts) | N
custom-style | String | - | 自定义组件样式 | N
badge-props | Object | - | 图标右上角提示信息。TS 类型:`BadgeProps`[Badge API Documents](./badge?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-bar-item/type.ts) | N
custom-style | String | - | `0.25.0`自定义组件样式 | N
icon | String / Slot | - | 图标名称 | N
sub-tab-bar | Array | - | 二级菜单。TS 类型:`SubTabBarItem[] ` `interface SubTabBarItem { value: string; label: string }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-bar/type.ts) | N
sub-tab-bar | Array | - | 二级菜单。TS 类型:`SubTabBarItem[] ` `interface SubTabBarItem { value: string; label: string }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-bar-item/type.ts) | N
value | String / Number | - | 标识符 | N

View File

@@ -3,7 +3,7 @@ const props = {
type: Boolean,
value: true,
},
customStyle: {
style: {
type: String,
value: '',
},

View File

@@ -1,3 +0,0 @@
import { TdTabBarItemProps } from './type';
declare const props: TdTabBarItemProps;
export default props;

View File

@@ -1,23 +0,0 @@
const props = {
badgeProps: {
type: Object,
},
customStyle: {
type: String,
value: '',
},
icon: {
type: String,
},
style: {
type: String,
value: '',
},
subTabBar: {
type: Array,
},
value: {
type: null,
},
};
export default props;

View File

@@ -1,35 +0,0 @@
import { SuperComponent, RelationsOptions } from '../common/src/index';
export default class TabBarItem extends SuperComponent {
parent: any;
relations: RelationsOptions;
options: {
multipleSlots: boolean;
};
data: {
prefix: string;
classPrefix: string;
isSpread: boolean;
isChecked: boolean;
hasChildren: boolean;
currentName: string;
split: boolean;
iconOnly: boolean;
theme: string;
crowded: boolean;
shape: string;
};
properties: import("./type").TdTabBarItemProps;
observers: {
subTabBar(value: Record<string, any>[]): void;
};
lifetimes: {
attached(): Promise<void>;
};
methods: {
showSpread(): void;
toggle(): void;
selectChild(event: any): void;
checkActive(value: any): void;
closeSpread(): void;
};
}

View File

@@ -1,117 +0,0 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { wxComponent, SuperComponent } from '../common/src/index';
import config from '../common/config';
import props from './tab-bar-item-props';
import { getRect } from '../common/utils';
const { prefix } = config;
const classPrefix = `${prefix}-tab-bar-item`;
let TabBarItem = class TabBarItem extends SuperComponent {
constructor() {
super(...arguments);
this.parent = null;
this.relations = {
'./tab-bar': {
type: 'ancestor',
linked(parent) {
const { theme, split, shape } = parent.data;
this.parent = parent;
this.setData({
theme,
split,
shape,
currentName: this.properties.value ? this.properties.value : parent.initName(),
});
parent.updateChildren();
},
},
};
this.options = {
multipleSlots: true,
};
this.data = {
prefix,
classPrefix,
isSpread: false,
isChecked: false,
hasChildren: false,
currentName: '',
split: true,
iconOnly: false,
theme: '',
crowded: false,
shape: 'normal',
};
this.properties = props;
this.observers = {
subTabBar(value) {
this.setData({
hasChildren: value.length > 0,
});
},
};
this.lifetimes = {
attached() {
return __awaiter(this, void 0, void 0, function* () {
const res = yield getRect(this, `.${classPrefix}__text`);
this.setData({ iconOnly: res.height === 0 });
});
},
};
this.methods = {
showSpread() {
this.setData({
isSpread: true,
});
},
toggle() {
const { parent } = this;
const { currentName, hasChildren, isSpread } = this.data;
if (hasChildren) {
this.setData({
isSpread: !isSpread,
});
}
parent.updateValue(currentName);
parent.changeOtherSpread(currentName);
},
selectChild(event) {
const { parent } = this;
const { value } = event.target.dataset;
parent.updateValue(value);
this.setData({
isSpread: false,
});
},
checkActive(value) {
const { currentName, subTabBar } = this.data;
const isChecked = (subTabBar === null || subTabBar === void 0 ? void 0 : subTabBar.some((item) => item.value === value)) || currentName === value;
this.setData({
isChecked,
});
},
closeSpread() {
this.setData({
isSpread: false,
});
},
};
}
};
TabBarItem = __decorate([
wxComponent()
], TabBarItem);
export default TabBarItem;

View File

@@ -1,7 +0,0 @@
{
"component": true,
"usingComponents": {
"t-icon": "../icon/icon",
"t-badge": "../badge/badge"
}
}

View File

@@ -1,62 +0,0 @@
<wxs src="../common/utils.wxs" module="_" />
<view
style="{{ customStyle }}"
class="{{_.cls(classPrefix, [['split', split], ['text-only', !icon], ['crowded', crowded], shape])}}"
>
<view
class="{{_.cls(classPrefix + '__content', [['checked', isChecked], theme])}}"
hover-class="{{classPrefix}}__content--active"
hover-stay-time="{{200}}"
bindtap="toggle"
aria-selected="{{(!hasChildren || !isSpread) && isChecked ? true : false}}"
aria-expanded="{{hasChildren && isSpread ? true : ''}}"
aria-role="{{hasChildren ? 'button' : 'tab'}}"
>
<view wx:if="{{icon}}" class="{{classPrefix}}__icon" style="height: {{iconOnly ? 24 : 20}}px">
<t-badge
wx:if="{{badgeProps.dot || badgeProps.count}}"
count="{{badgeProps.count}}"
max-count="{{badgeProps.maxCount || 99}}"
dot="{{badgeProps.dot}}"
content="{{badgeProps.content}}"
size="{{badgeProps.size}}"
visible="{{badgeProps.visible}}"
offset="{{badgeProps.offset || [0,0]}}"
t-class-count="{{prefix + '-badge-class'}}"
>
<t-icon name="{{icon}}" size="{{iconOnly ? 24 : 20}}" />
</t-badge>
<t-icon
wx:else
name="{{icon}}"
size="{{iconOnly ? 24 : 20}}"
aria-label="{{ariaLabel}}"
aria-hidden="{{iconOnly ? false : true}}"
/>
<slot name="icon" />
</view>
<view class="{{_.cls(classPrefix + '__text', [['small', !!icon]])}}">
<t-icon wx:if="{{hasChildren}}" name="view-list" size="16" class="{{classPrefix}}__icon-menu" />
<slot />
</view>
</view>
<view class="{{classPrefix}}__spread" wx:if="{{hasChildren && isSpread}}">
<view
class="{{classPrefix}}__spread-item"
hover-class="{{classPrefix}}__spread-item--active"
hover-stay-time="{{200}}"
wx:for="{{subTabBar}}"
wx:for-item="child"
wx:for-index="index"
wx:key="index"
bind:tap="selectChild"
data-value="{{child.value || index}}"
aria-role="tab"
>
<view class="{{classPrefix}}__spread-item-split" wx:if="{{index !== 0}}" />
<view class="{{classPrefix}}__spread-item-text" data-value="{{child.value || index}}">{{ child.label }}</view>
</view>
</view>
</view>

View File

@@ -1,143 +0,0 @@
.t-float-left {
float: left;
}
.t-float-right {
float: right;
}
@keyframes tdesign-fade-out {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
.hotspot-expanded.relative {
position: relative;
}
.hotspot-expanded::after {
content: '';
display: block;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
transform: scale(1.5);
}
:host {
flex: 1;
}
.t-tab-bar-item {
height: var(--td-tab-bar-height, 80rpx);
box-sizing: border-box;
user-select: none;
position: relative;
margin: 16rpx 0;
background-color: var(--td-tab-bar-bg-color, var(--td-bg-color-block, #fff));
padding: 0 24rpx;
}
.t-tab-bar-item--text-only {
font-size: 32rpx;
}
.t-tab-bar-item--split:before {
position: absolute;
box-sizing: border-box;
content: ' ';
pointer-events: none;
top: 0;
bottom: 0;
left: 0;
border-left: 1px solid var(--td-tab-bar-border-color, var(--td-border-level-1-color, #e6e6e6));
transform: scaleX(0.5);
top: 16rpx;
bottom: 16rpx;
}
.t-tab-bar-item--crowded {
padding: 0 16rpx;
}
.t-tab-bar-item--round {
border-radius: 99px;
}
.t-tab-bar-item__content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border-radius: 16rpx;
color: var(--td-tab-bar-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
}
.t-tab-bar-item__content--checked {
color: var(--td-tab-bar-active-color, var(--td-primary-color, #0052d9));
font-weight: 600;
}
.t-tab-bar-item__content--tag {
border-radius: 99px;
}
.t-tab-bar-item__content--tag.t-tab-bar-item__content--checked {
background-color: var(--td-tab-bar-active-bg, var(--td-primary-color-1, #fff));
}
.t-tab-bar-item .t-badge-class {
transform: translate(50%, -10%) !important;
}
.t-tab-bar-item__text {
display: flex;
align-items: center;
}
.t-tab-bar-item__text--small {
font-size: 20rpx;
line-height: 32rpx;
}
.t-tab-bar-item__icon-menu {
margin-right: 8rpx;
}
.t-tab-bar-item__spread {
position: absolute;
top: 0;
left: 7%;
width: 86%;
background-color: var(--td-tab-bar-bg-color, var(--td-bg-color-block, #fff));
transform: translate3d(0, calc(-100% - 32rpx), 0);
z-index: 1;
border-radius: 12rpx;
color: var(--td-tab-bar-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
box-shadow: var(--td-tab-bar-spread-shadow, var(--td-shadow-3, 0 6px 30px 5px rgba(0, 0, 0, 0.05), 0 16px 24px 2px rgba(0, 0, 0, 0.04), 0 8px 10px -5px rgba(0, 0, 0, 0.08)));
}
.t-tab-bar-item__spread::before {
display: block;
content: '';
position: absolute;
bottom: 0;
left: 50%;
width: 0;
height: 0;
border: 16rpx solid transparent;
border-top: 16rpx solid var(--td-tab-bar-bg-color, var(--td-bg-color-block, #fff));
transform: translate3d(-50%, 32rpx, 0);
}
.t-tab-bar-item__spread-item {
width: 100%;
height: 96rpx;
display: flex;
align-items: center;
justify-content: flex-start;
position: relative;
flex-direction: column;
}
.t-tab-bar-item__spread-item--active {
background-color: var(--td-tab-bar-hover-bg-color, rgba(0, 0, 0, 0.05));
}
.t-tab-bar-item__spread-item-split {
box-sizing: border-box;
content: ' ';
pointer-events: none;
background-color: var(--td-tab-bar-spread-border-color, var(--td-border-color, #e7e7e7));
width: 80%;
height: 1px;
transform: translateY(0.5);
}
.t-tab-bar-item__spread-item-text {
padding-top: 24rpx;
}

View File

@@ -13,7 +13,7 @@ let Tabbar = class Tabbar extends SuperComponent {
constructor() {
super(...arguments);
this.relations = {
'./tab-bar-item': {
'../tab-bar-item/tab-bar-item': {
type: 'descendant',
},
};

View File

@@ -1,6 +1,4 @@
{
"component": true,
"usingComponents": {
"t-tab-bar-item": "./tab-bar-item"
}
"usingComponents": {}
}

View File

@@ -1,6 +1,6 @@
<wxs src="../common/utils.wxs" module="_" />
<view
style="{{ customStyle }}"
style="{{ style }}"
class="{{_.cls(classPrefix, [['border', bordered], ['fixed', fixed], ['safe', safeAreaInsetBottom], shape])}} {{prefix}}-class"
aria-role="tablist"
>

View File

@@ -26,7 +26,6 @@
transform: scale(1.5);
}
.t-tab-bar {
height: 110rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;

View File

@@ -1,10 +1,9 @@
import { BadgeProps } from '../badge/index';
export interface TdTabBarProps {
bordered?: {
type: BooleanConstructor;
value?: boolean;
};
customStyle?: {
style?: {
type: StringConstructor;
value?: string;
};
@@ -28,10 +27,6 @@ export interface TdTabBarProps {
type: BooleanConstructor;
value?: boolean;
};
style?: {
type: StringConstructor;
value?: string;
};
theme?: {
type: StringConstructor;
value?: 'normal' | 'tag';
@@ -45,33 +40,3 @@ export interface TdTabBarProps {
value?: string | number | Array<string | number>;
};
}
export interface TdTabBarItemProps {
badgeProps?: {
type: ObjectConstructor;
value?: BadgeProps;
};
customStyle?: {
type: StringConstructor;
value?: string;
};
icon?: {
type: StringConstructor;
value?: string;
};
style?: {
type: StringConstructor;
value?: string;
};
subTabBar?: {
type: ArrayConstructor;
value?: SubTabBarItem[];
};
value?: {
type: null;
value?: string | number;
};
}
export interface SubTabBarItem {
value: string;
label: string;
}