New Huajishe Check ChaoXing
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
:: BASE_DOC ::
|
||||
|
||||
## API
|
||||
|
||||
### Steps 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
|
||||
current | String / Number | - | \- | N
|
||||
default-current | String / Number | undefined | uncontrolled property | N
|
||||
current-status | String | process | options: default/process/finish/error | N
|
||||
layout | String | horizontal | options: horizontal/vertical | N
|
||||
readonly | Boolean | false | \- | N
|
||||
sequence | String | positive | options: positive/reverse | N
|
||||
theme | String | default | options: default/dot | N
|
||||
|
||||
### Steps Events
|
||||
|
||||
name | params | description
|
||||
-- | -- | --
|
||||
change | `({current: string \| number, previous: string \| number})` | \-
|
||||
### Steps External Classes
|
||||
|
||||
className | Description
|
||||
-- | --
|
||||
t-class | \-
|
||||
|
||||
|
||||
### StepItem 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
|
||||
icon | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
|
||||
status | String | default | options: default/process/finish/error。Typescript:`StepStatus` `type StepStatus = 'default' \| 'process' \| 'finish' \| 'error'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/step-item/type.ts) | N
|
||||
sub-step-items | Array | [] | `deprecated`。Typescript:`SubStepItem[]` `interface SubStepItem { status: StepStatus, title: string }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/step-item/type.ts) | N
|
||||
title | String / Slot | '' | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
|
||||
### StepItem External Classes
|
||||
|
||||
className | Description
|
||||
-- | --
|
||||
t-class | class name of root node
|
||||
t-class-content | \-
|
||||
t-class-description | \-
|
||||
t-class-extra | \-
|
||||
t-class-title | \-
|
||||
|
||||
### CSS Variables
|
||||
|
||||
The component provides the following CSS variables, which can be used to customize styles.
|
||||
Name | Default Value | Description
|
||||
-- | -- | --
|
||||
--td-step-item-circle-font-size | 28rpx | -
|
||||
--td-step-item-circle-size | 44rpx | -
|
||||
--td-step-item-default-circle-bg | @bg-color-secondarycontainer | -
|
||||
--td-step-item-default-circle-color | @font-gray-3 | -
|
||||
--td-step-item-default-dot-border-color | @component-border | -
|
||||
--td-step-item-default-icon-color | @font-gray-3 | -
|
||||
--td-step-item-default-title-color | @font-gray-3 | -
|
||||
--td-step-item-description-color | @font-gray-3 | -
|
||||
--td-step-item-dot-size | 16rpx | -
|
||||
--td-step-item-error-circle-bg | @error-color-1 | -
|
||||
--td-step-item-error-circle-color | @error-color | -
|
||||
--td-step-item-error-dot-border-color | @error-color | -
|
||||
--td-step-item-error-icon-color | @error-color | -
|
||||
--td-step-item-error-title-color | @error-color | -
|
||||
--td-step-item-finish-circle-bg | @brand-color-light | -
|
||||
--td-step-item-finish-circle-color | @brand-color | -
|
||||
--td-step-item-finish-dot-border-color | @brand-color | -
|
||||
--td-step-item-finish-icon-color | @brand-color | -
|
||||
--td-step-item-finish-line-color | @brand-color | -
|
||||
--td-step-item-finish-title-color | @font-gray-1 | -
|
||||
--td-step-item-line-color | @component-border | -
|
||||
--td-step-item-process-circle-bg | @brand-color | -
|
||||
--td-step-item-process-circle-color | @font-white-1 | -
|
||||
--td-step-item-process-dot-border-color | @brand-color | -
|
||||
--td-step-item-process-icon-color | @brand-color | -
|
||||
--td-step-item-process-title-color | @brand-color | -
|
||||
@@ -0,0 +1,142 @@
|
||||
---
|
||||
title: Steps 步骤条
|
||||
description: 用于任务步骤展示或任务进度展示。
|
||||
spline: navigation
|
||||
isComponent: true
|
||||
---
|
||||
|
||||
<span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20lines-98%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20functions-88%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20statements-96%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20branches-82%25-blue" /></span>
|
||||
## 引入
|
||||
|
||||
全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
|
||||
|
||||
```json
|
||||
"usingComponents": {
|
||||
"t-steps": "tdesign-miniprogram/steps/steps",
|
||||
"t-step-item": "tdesign-miniprogram/step-item/step-item",
|
||||
}
|
||||
```
|
||||
|
||||
## 代码演示
|
||||
|
||||
步骤条,方向可以横向和纵向,可以自定义步骤条显示内容以及是否可写
|
||||
|
||||
<a href="https://developers.weixin.qq.com/s/3H9EuimQ7JS0" 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>
|
||||
|
||||
### 组件类型
|
||||
|
||||
#### 水平步骤条
|
||||
|
||||
支持三种类型:序号、图标、简略
|
||||
|
||||
{{ horizontal }}
|
||||
|
||||
#### 垂直步骤条
|
||||
|
||||
支持三种类型:序号、图标、简略
|
||||
|
||||
{{ vertical }}
|
||||
|
||||
### 组件状态
|
||||
|
||||
#### 选项卡状态
|
||||
|
||||
共支持 4 种状态:未完成(default)、已完成(finish)、进行中(process)、错误(error)
|
||||
|
||||
{{ status }}
|
||||
|
||||
### 特殊类型
|
||||
|
||||
通过已有特性,改造出两种常见类型:
|
||||
|
||||
- 垂直自定义(在 Cascader 中使用)
|
||||
- 纯展示步骤条
|
||||
|
||||
可以参考以下代码实现
|
||||
|
||||
{{ special }}
|
||||
|
||||
## API
|
||||
|
||||
### Steps Props
|
||||
|
||||
名称 | 类型 | 默认值 | 描述 | 必传
|
||||
-- | -- | -- | -- | --
|
||||
style | Object | - | 样式 | N
|
||||
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
|
||||
current | String / Number | - | 当前步骤,即整个步骤条进度。默认根据步骤下标判断步骤的完成状态,当前步骤为进行中,当前步骤之前的步骤为已完成,当前步骤之后的步骤为未开始。如果每个步骤没有设置 value,current 值为步骤长度则表示所有步骤已完成。如果每个步骤设置了自定义 value,则 current = 'FINISH' 表示所有状态完成 | N
|
||||
default-current | String / Number | undefined | 当前步骤,即整个步骤条进度。默认根据步骤下标判断步骤的完成状态,当前步骤为进行中,当前步骤之前的步骤为已完成,当前步骤之后的步骤为未开始。如果每个步骤没有设置 value,current 值为步骤长度则表示所有步骤已完成。如果每个步骤设置了自定义 value,则 current = 'FINISH' 表示所有状态完成。非受控属性 | N
|
||||
current-status | String | process | 用于控制 current 指向的步骤条的状态。可选项:default/process/finish/error | N
|
||||
layout | String | horizontal | 步骤条方向,有两种:横向和纵向。可选项:horizontal/vertical | N
|
||||
readonly | Boolean | false | 只读状态 | N
|
||||
sequence | String | positive | 步骤条顺序。可选项:positive/reverse | N
|
||||
theme | String | default | 步骤条风格。可选项:default/dot | N
|
||||
|
||||
### Steps Events
|
||||
|
||||
名称 | 参数 | 描述
|
||||
-- | -- | --
|
||||
change | `({current: string \| number, previous: string \| number})` | 当前步骤发生变化时触发
|
||||
### Steps External Classes
|
||||
|
||||
类名 | 描述
|
||||
-- | --
|
||||
t-class | 根节点样式类
|
||||
|
||||
|
||||
### StepItem Props
|
||||
|
||||
名称 | 类型 | 默认值 | 描述 | 必传
|
||||
-- | -- | -- | -- | --
|
||||
style | Object | - | 样式 | N
|
||||
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
|
||||
content | String / Slot | '' | 步骤描述。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
|
||||
icon | String / Slot | - | 图标。传入 slot 代表使用插槽,其他字符串代表使用内置图标。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
|
||||
status | String | default | 当前步骤的状态:默认状态(未开始)、进行中状态、完成状态、错误状态。可选项:default/process/finish/error。TS 类型:`StepStatus` `type StepStatus = 'default' \| 'process' \| 'finish' \| 'error'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/step-item/type.ts) | N
|
||||
sub-step-items | Array | [] | 已废弃。子步骤条,仅支持 layout = 'vertical' 时。TS 类型:`SubStepItem[]` `interface SubStepItem { status: StepStatus, title: string }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/step-item/type.ts) | N
|
||||
title | String / Slot | '' | 标题。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
|
||||
### StepItem External Classes
|
||||
|
||||
类名 | 描述
|
||||
-- | --
|
||||
t-class | 根节点样式类
|
||||
t-class-content | 内容样式类
|
||||
t-class-description | 描述样式类
|
||||
t-class-extra | 额外样式类
|
||||
t-class-title | 标题样式类
|
||||
|
||||
### CSS Variables
|
||||
|
||||
组件提供了下列 CSS 变量,可用于自定义样式。
|
||||
名称 | 默认值 | 描述
|
||||
-- | -- | --
|
||||
--td-step-item-circle-font-size | 28rpx | -
|
||||
--td-step-item-circle-size | 44rpx | -
|
||||
--td-step-item-default-circle-bg | @bg-color-secondarycontainer | -
|
||||
--td-step-item-default-circle-color | @font-gray-3 | -
|
||||
--td-step-item-default-dot-border-color | @component-border | -
|
||||
--td-step-item-default-icon-color | @font-gray-3 | -
|
||||
--td-step-item-default-title-color | @font-gray-3 | -
|
||||
--td-step-item-description-color | @font-gray-3 | -
|
||||
--td-step-item-dot-size | 16rpx | -
|
||||
--td-step-item-error-circle-bg | @error-color-1 | -
|
||||
--td-step-item-error-circle-color | @error-color | -
|
||||
--td-step-item-error-dot-border-color | @error-color | -
|
||||
--td-step-item-error-icon-color | @error-color | -
|
||||
--td-step-item-error-title-color | @error-color | -
|
||||
--td-step-item-finish-circle-bg | @brand-color-light | -
|
||||
--td-step-item-finish-circle-color | @brand-color | -
|
||||
--td-step-item-finish-dot-border-color | @brand-color | -
|
||||
--td-step-item-finish-icon-color | @brand-color | -
|
||||
--td-step-item-finish-line-color | @brand-color | -
|
||||
--td-step-item-finish-title-color | @font-gray-1 | -
|
||||
--td-step-item-line-color | @component-border | -
|
||||
--td-step-item-process-circle-bg | @brand-color | -
|
||||
--td-step-item-process-circle-color | @font-white-1 | -
|
||||
--td-step-item-process-dot-border-color | @brand-color | -
|
||||
--td-step-item-process-icon-color | @brand-color | -
|
||||
--td-step-item-process-title-color | @brand-color | -
|
||||
3
HuajisheCheckChaoXing/miniprogram_npm/tdesign-miniprogram/steps/props.d.ts
vendored
Normal file
3
HuajisheCheckChaoXing/miniprogram_npm/tdesign-miniprogram/steps/props.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { TdStepsProps } from './type';
|
||||
declare const props: TdStepsProps;
|
||||
export default props;
|
||||
@@ -0,0 +1,30 @@
|
||||
const props = {
|
||||
current: {
|
||||
type: null,
|
||||
value: null,
|
||||
},
|
||||
defaultCurrent: {
|
||||
type: null,
|
||||
},
|
||||
currentStatus: {
|
||||
type: String,
|
||||
value: 'process',
|
||||
},
|
||||
layout: {
|
||||
type: String,
|
||||
value: 'horizontal',
|
||||
},
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
sequence: {
|
||||
type: String,
|
||||
value: 'positive',
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
value: 'default',
|
||||
},
|
||||
};
|
||||
export default props;
|
||||
22
HuajisheCheckChaoXing/miniprogram_npm/tdesign-miniprogram/steps/steps.d.ts
vendored
Normal file
22
HuajisheCheckChaoXing/miniprogram_npm/tdesign-miniprogram/steps/steps.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { SuperComponent, RelationsOptions } from '../common/src/index';
|
||||
export default class Steps extends SuperComponent {
|
||||
relations: RelationsOptions;
|
||||
externalClasses: string[];
|
||||
properties: import("./type").TdStepsProps;
|
||||
controlledProps: {
|
||||
key: string;
|
||||
event: string;
|
||||
}[];
|
||||
data: {
|
||||
prefix: string;
|
||||
classPrefix: string;
|
||||
};
|
||||
observers: {
|
||||
current(): void;
|
||||
};
|
||||
methods: {
|
||||
updateChildren(): void;
|
||||
updateLastChid(): void;
|
||||
handleClick(index: any): void;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
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 { wxComponent, SuperComponent } from '../common/src/index';
|
||||
import config from '../common/config';
|
||||
import props from './props';
|
||||
const { prefix } = config;
|
||||
const name = `${prefix}-steps`;
|
||||
let Steps = class Steps extends SuperComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.relations = {
|
||||
'../step-item/step-item': {
|
||||
type: 'child',
|
||||
linked(child) {
|
||||
this.updateChildren();
|
||||
const { readonly } = this.data;
|
||||
child.setData({
|
||||
readonly,
|
||||
});
|
||||
},
|
||||
unlinked() {
|
||||
this.updateLastChid();
|
||||
},
|
||||
},
|
||||
};
|
||||
this.externalClasses = [`${prefix}-class`];
|
||||
this.properties = props;
|
||||
this.controlledProps = [
|
||||
{
|
||||
key: 'current',
|
||||
event: 'change',
|
||||
},
|
||||
];
|
||||
this.data = {
|
||||
prefix,
|
||||
classPrefix: name,
|
||||
};
|
||||
this.observers = {
|
||||
current() {
|
||||
this.updateChildren();
|
||||
},
|
||||
};
|
||||
this.methods = {
|
||||
updateChildren() {
|
||||
const items = this.$children;
|
||||
items.forEach((item, index) => {
|
||||
item.updateStatus(Object.assign({ index, items }, this.data));
|
||||
});
|
||||
},
|
||||
updateLastChid() {
|
||||
const items = this.$children;
|
||||
items.forEach((child, index) => child.setData({ isLastChild: index === items.length - 1 }));
|
||||
},
|
||||
handleClick(index) {
|
||||
if (!this.data.readonly) {
|
||||
const preIndex = this.data.current;
|
||||
this._trigger('change', {
|
||||
previous: preIndex,
|
||||
current: index,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
Steps = __decorate([
|
||||
wxComponent()
|
||||
], Steps);
|
||||
export default Steps;
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {
|
||||
"t-step": "../step-item/step-item"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<wxs src="../common/utils.wxs" module="_" />
|
||||
|
||||
<view
|
||||
style="{{_._style([style, customStyle])}}"
|
||||
class="{{_.cls(classPrefix, [layout, ['readonly', readonly], sequence])}} class {{prefix}}-class"
|
||||
>
|
||||
<slot />
|
||||
</view>
|
||||
@@ -0,0 +1,46 @@
|
||||
.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 {
|
||||
display: flex;
|
||||
}
|
||||
.t-step--vertical {
|
||||
padding-right: 32rpx;
|
||||
}
|
||||
.t-steps {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
.t-steps--vertical {
|
||||
flex-direction: column;
|
||||
}
|
||||
.t-steps--reverse {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
.t-steps--vertical.t-steps--reverse {
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
30
HuajisheCheckChaoXing/miniprogram_npm/tdesign-miniprogram/steps/type.d.ts
vendored
Normal file
30
HuajisheCheckChaoXing/miniprogram_npm/tdesign-miniprogram/steps/type.d.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
export interface TdStepsProps {
|
||||
current?: {
|
||||
type: null;
|
||||
value?: string | number;
|
||||
};
|
||||
defaultCurrent?: {
|
||||
type: null;
|
||||
value?: string | number;
|
||||
};
|
||||
currentStatus?: {
|
||||
type: StringConstructor;
|
||||
value?: 'default' | 'process' | 'finish' | 'error';
|
||||
};
|
||||
layout?: {
|
||||
type: StringConstructor;
|
||||
value?: 'horizontal' | 'vertical';
|
||||
};
|
||||
readonly?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
sequence?: {
|
||||
type: StringConstructor;
|
||||
value?: 'positive' | 'reverse';
|
||||
};
|
||||
theme?: {
|
||||
type: StringConstructor;
|
||||
value?: 'default' | 'dot';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Reference in New Issue
Block a user