New Huajishe Check ChaoXing

This commit is contained in:
e2hang
2025-10-01 10:01:52 +08:00
parent 240b884eac
commit 80be8ae3cf
1094 changed files with 61709 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
:: BASE_DOC ::
## API
### Collapse Props
name | type | default | description | required
-- | -- | -- | -- | --
style | Object | - | CSS(Cascading Style Sheets) | N
custom-style | Object | - | CSS(Cascading Style Sheets)used to set style on virtual component | N
default-expand-all | Boolean | false | \- | N
disabled | Boolean | - | \- | N
expand-icon | Boolean | true | \- | N
expand-mutex | Boolean | false | \- | N
theme | String | default | options: default/card | N
value | Array | [] | Typescript`CollapseValue` `type CollapseValue = Array<string \| number>`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/collapse/type.ts) | N
default-value | Array | undefined | uncontrolled property。Typescript`CollapseValue` `type CollapseValue = Array<string \| number>`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/collapse/type.ts) | N
### Collapse Events
name | params | description
-- | -- | --
change | `(value: CollapseValue)` | \-
### CollapsePanel Props
name | type | default | description | required
-- | -- | -- | -- | --
style | Object | - | CSS(Cascading Style Sheets) | N
custom-style | Object | - | CSS(Cascading Style Sheets)used to set style on virtual component | N
content | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
disabled | Boolean | undefined | \- | N
expand-icon | Boolean / Slot | undefined | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
header | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
header-left-icon | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
header-right-content | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
placement | String | bottom | `0.34.0`。options: bottom/top | N
value | String / Number | - | \- | N
### CollapsePanel External Classes
className | Description
-- | --
t-class | \-
t-class-content | \-
t-class-header | \-
### CSS Variables
The component provides the following CSS variables, which can be used to customize styles.
Name | Default Value | Description
-- | -- | --
--td-collapse-border-color | @border-level-1-color | -
--td-collapse-content-font-size | @font-size-base | -
--td-collapse-content-line-height | 1.5 | -
--td-collapse-content-padding | 32rpx | -
--td-collapse-content-text-color | @text-color-primary | -
--td-collapse-extra-font-size | @font-size-m | -
--td-collapse-header-height | auto | -
--td-collapse-header-text-color | @text-color-primary | -
--td-collapse-header-text-disabled-color | @text-color-disabled | -
--td-collapse-horizontal-padding | 32rpx | -
--td-collapse-icon-color | @font-gray-3 | -
--td-collapse-panel-bg-color | @bg-color-container | -
--td-collapse-title-font-size | @font-size-m | -

View File

@@ -0,0 +1,119 @@
---
title: Collapse 折叠面板
description: 用于对复杂区域进行分组和隐藏 常用于订单信息展示等
spline: data
isComponent: true
---
<span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20lines-100%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20functions-100%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20statements-99%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20branches-87%25-blue" /></span>
<div style="background: #ecf2fe; display: flex; align-items: center; line-height: 20px; padding: 14px 24px; border-radius: 3px; color: #555a65">
<svg fill="none" viewBox="0 0 16 16" width="16px" height="16px" style="margin-right: 5px">
<path fill="#0052d9" d="M8 15A7 7 0 108 1a7 7 0 000 14zM7.4 4h1.2v1.2H7.4V4zm.1 2.5h1V12h-1V6.5z" fillOpacity="0.9"></path>
</svg>
该组件于 0.7.3 版本上线,请留意版本。
</div>
## 引入
全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
```json
"usingComponents": {
"t-collapse": "tdesign-miniprogram/collapse/collapse",
"t-collapse-panel": "tdesign-miniprogram/collapse-panel/collapse-panel"
}
```
## 代码演示
<a href="https://developers.weixin.qq.com/s/P67sAimx75Sy" title="在开发者工具中预览效果" target="_blank" rel="noopener noreferrer"> 在开发者工具中预览效果 </a>
<blockquote style="background-color: #d9e1ff; font-size: 15px; line-height: 26px;margin: 16px 0 0;padding: 16px; border-radius: 6px; color: #0052d9" >
<p>Tips: 请确保开发者工具为打开状态。导入开发者工具后依次执行npm i > 构建npm包 > 勾选 "将JS编译成ES5"</p>
</blockquote>
### 类型
基础折叠面板
{{ base }}
带操作说明
{{ action }}
手风琴模式
{{ accordion }}
### 样式
卡片折叠面板
{{ theme }}
## API
### Collapse Props
名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
style | Object | - | 样式 | N
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
default-expand-all | Boolean | false | 默认是否展开全部 | N
disabled | Boolean | - | 是否禁用面板展开/收起操作 | N
expand-icon | Boolean | true | 展开图标 | N
expand-mutex | Boolean | false | 每个面板互斥展开,每次只展开一个面板 | N
theme | String | default | 折叠面板风格。可选项default/card | N
value | Array | [] | 展开的面板集合。TS 类型:`CollapseValue` `type CollapseValue = Array<string \| number>`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/collapse/type.ts) | N
default-value | Array | undefined | 展开的面板集合。非受控属性。TS 类型:`CollapseValue` `type CollapseValue = Array<string \| number>`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/collapse/type.ts) | N
### Collapse Events
名称 | 参数 | 描述
-- | -- | --
change | `(value: CollapseValue)` | 切换面板时触发,返回变化的值
### CollapsePanel Props
名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
style | Object | - | 样式 | N
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
content | String / Slot | - | 折叠面板内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
disabled | Boolean | undefined | 禁止当前面板展开,优先级大于 Collapse 的同名属性 | N
expand-icon | Boolean / Slot | undefined | 当前折叠面板展开图标,优先级大于 Collapse 的同名属性。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
header | String / Slot | - | 面板头内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
header-left-icon | String / Slot | - | 面板头左侧图标。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
header-right-content | String / Slot | - | 面板头的右侧区域,一般用于呈现面板操作。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
placement | String | bottom | `0.34.0`。选项卡内容的位置。可选项bottom/top | N
value | String / Number | - | 当前面板唯一标识,如果值为空则取当前面下标兜底作为唯一标识 | N
### CollapsePanel External Classes
类名 | 描述
-- | --
t-class | 根节点样式类
t-class-content | 内容样式类
t-class-header | 头部样式类
### CSS Variables
组件提供了下列 CSS 变量,可用于自定义样式。
名称 | 默认值 | 描述
-- | -- | --
--td-collapse-border-color | @border-level-1-color | -
--td-collapse-content-font-size | @font-size-base | -
--td-collapse-content-line-height | 1.5 | -
--td-collapse-content-padding | 32rpx | -
--td-collapse-content-text-color | @text-color-primary | -
--td-collapse-extra-font-size | @font-size-m | -
--td-collapse-header-height | auto | -
--td-collapse-header-text-color | @text-color-primary | -
--td-collapse-header-text-disabled-color | @text-color-disabled | -
--td-collapse-horizontal-padding | 32rpx | -
--td-collapse-icon-color | @font-gray-3 | -
--td-collapse-panel-bg-color | @bg-color-container | -
--td-collapse-title-font-size | @font-size-m | -

View File

@@ -0,0 +1,24 @@
import { SuperComponent, RelationsOptions } from '../common/src/index';
import type { CollapseValue, TdCollapseProps } from './type';
export interface CollapseProps extends TdCollapseProps {
}
export default class Collapse extends SuperComponent {
externalClasses: string[];
relations: RelationsOptions;
controlledProps: {
key: string;
event: string;
}[];
properties: TdCollapseProps;
data: {
prefix: string;
classPrefix: string;
};
observers: {
'value, expandMutex '(): void;
};
methods: {
updateExpanded(): void;
switch(panelValue: CollapseValue): void;
};
}

View File

@@ -0,0 +1,61 @@
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;
};
import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
const { prefix } = config;
const name = `${prefix}-collapse`;
let Collapse = class Collapse extends SuperComponent {
constructor() {
super(...arguments);
this.externalClasses = [`${prefix}-class`];
this.relations = {
'../collapse-panel/collapse-panel': {
type: 'descendant',
},
};
this.controlledProps = [
{
key: 'value',
event: 'change',
},
];
this.properties = props;
this.data = {
prefix,
classPrefix: name,
};
this.observers = {
'value, expandMutex '() {
this.updateExpanded();
},
};
this.methods = {
updateExpanded() {
this.$children.forEach((child) => {
child.updateExpanded(this.properties.value);
});
},
switch(panelValue) {
const { expandMutex, value: activeValues } = this.properties;
let value = [];
const hit = activeValues.indexOf(panelValue);
if (hit > -1) {
value = activeValues.filter((item) => item !== panelValue);
}
else {
value = expandMutex ? [panelValue] : activeValues.concat(panelValue);
}
this._trigger('change', { value });
},
};
}
};
Collapse = __decorate([
wxComponent()
], Collapse);
export default Collapse;

View File

@@ -0,0 +1,4 @@
{
"component": true,
"styleIsolation": "apply-shared"
}

View File

@@ -0,0 +1,8 @@
<wxs src="../common/utils.wxs" module="_" />
<view
style="{{_._style([style, customStyle])}}"
class="class {{prefix}}-class {{_.cls(classPrefix, [['hairline--top-bottom', border], theme])}}"
>
<slot />
</view>

View File

@@ -0,0 +1,32 @@
.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);
}
.t-collapse--card {
margin: 0 32rpx;
border-radius: var(--td-radius-large, 18rpx);
overflow: hidden;
}

View File

@@ -0,0 +1,4 @@
export { default as Collapse } from './collapse';
export * from './type';
export * from './props';
export { CollapseProps } from './collapse';

View File

@@ -0,0 +1,3 @@
export { default as Collapse } from './collapse';
export * from './type';
export * from './props';

View File

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

View File

@@ -0,0 +1,30 @@
const props = {
defaultExpandAll: {
type: Boolean,
value: false,
},
disabled: {
type: Boolean,
},
expandIcon: {
type: Boolean,
value: true,
},
expandMutex: {
type: Boolean,
value: false,
},
theme: {
type: String,
value: 'default',
},
value: {
type: Array,
value: null,
},
defaultValue: {
type: Array,
value: [],
},
};
export default props;

View File

@@ -0,0 +1,31 @@
export interface TdCollapseProps {
defaultExpandAll?: {
type: BooleanConstructor;
value?: boolean;
};
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
expandIcon?: {
type: BooleanConstructor;
value?: boolean;
};
expandMutex?: {
type: BooleanConstructor;
value?: boolean;
};
theme?: {
type: StringConstructor;
value?: 'default' | 'card';
};
value?: {
type: ArrayConstructor;
value?: CollapseValue;
};
defaultValue?: {
type: ArrayConstructor;
value?: CollapseValue;
};
}
export declare type CollapseValue = Array<string | number>;

View File

@@ -0,0 +1 @@
export {};