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,49 @@
:: BASE_DOC ::
## API
### Cascader 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
check-strictly | Boolean | false | \- | N
close-btn | Boolean / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
keys | Object | - | Typescript`KeysType`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
options | Array | [] | Typescript`Array<CascaderOption>` | N
placeholder | String | 选择选项 | \- | N
sub-titles | Array | [] | Typescript`Array<string>` | N
theme | String | step | options: step/tab | N
title | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
value | String / Number | null | \- | N
default-value | String / Number | undefined | uncontrolled property | N
visible | Boolean | false | \- | N
### Cascader Events
name | params | description
-- | -- | --
change | `(value: string \| number, selectedOptions: string[])` | `1.0.1`
close | `(trigger: CascaderTriggerSource)` | `1.0.1`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/cascader/type.ts)。<br/>`type CascaderTriggerSource = 'overlay' \| 'close-btn' \| 'finish'`<br/>
pick | `(value: string \| number, label: string, index: number, level: number)` | `1.0.1`
### CSS Variables
The component provides the following CSS variables, which can be used to customize styles.
Name | Default Value | Description
-- | -- | --
--td-cascader-active-color | @brand-color | -
--td-cascader-bg-color | @bg-color-container | -
--td-cascader-border-color | @component-stroke | -
--td-cascader-content-height | 78vh | -
--td-cascader-disabled-color | @text-color-disabled | -
--td-cascader-options-height | calc(100% - @cascader-step-height) | -
--td-cascader-options-title-color | @text-color-placeholder | -
--td-cascader-step-arrow-color | @text-color-placeholder | -
--td-cascader-step-dot-size | 16rpx | -
--td-cascader-step-height | 88rpx | -
--td-cascader-title-color | @text-color-primary | -
--td-cascader-title-height | 26rpx | -
--td-cascader-title-padding | @spacer-2 | -
--td-cascder-title-font-size | 36rpx | -

View File

@@ -0,0 +1,101 @@
---
title: Cascader 级联选择器
description: 级联选择器适用于有清晰层级结构的数据集合,用户可以通过逐级查看并选择。
spline: form
isComponent: true
---
<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.23.0 版本上线,请留意版本。
</div>
## 引入
全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
```json
"usingComponents": {
"t-cascader": "tdesign-miniprogram/cascader/cascader"
}
```
## 代码演示
<a href="https://developers.weixin.qq.com/s/i75I6imI7TSh" 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 }}
### 选项卡风格
{{ theme-tab }}
### 进阶
#### 带初始值
{{ with-value }}
#### 自定义 keys
{{ keys }}
#### 使用次级标题
{{ with-title }}
## API
### Cascader Props
名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
style | Object | - | 样式 | N
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
check-strictly | Boolean | false | 父子节点选中状态不再关联,可各自选中或取消 | N
close-btn | Boolean / Slot | true | 关闭按钮。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
keys | Object | - | 用来定义 value / label 在 `options` 中对应的字段别名。TS 类型:`KeysType`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
options | Array | [] | 可选项数据源。TS 类型:`Array<CascaderOption>` | N
placeholder | String | 选择选项 | 未选中时的提示文案 | N
sub-titles | Array | [] | 每级展示的次标题。TS 类型:`Array<string>` | N
theme | String | step | 展示风格。可选项step/tab | N
title | String / Slot | - | 标题。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
value | String / Number | null | 选项值 | N
default-value | String / Number | undefined | 选项值。非受控属性 | N
visible | Boolean | false | 是否展示 | N
### Cascader Events
名称 | 参数 | 描述
-- | -- | --
change | `(value: string \| number, selectedOptions: string[])` | `1.0.1`。值发生变更时触发
close | `(trigger: CascaderTriggerSource)` | `1.0.1`。关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/cascader/type.ts)。<br/>`type CascaderTriggerSource = 'overlay' \| 'close-btn' \| 'finish'`<br/>
pick | `(value: string \| number, label: string, index: number, level: number)` | `1.0.1`。选择后触发
### CSS Variables
组件提供了下列 CSS 变量,可用于自定义样式。
名称 | 默认值 | 描述
-- | -- | --
--td-cascader-active-color | @brand-color | -
--td-cascader-bg-color | @bg-color-container | -
--td-cascader-border-color | @component-stroke | -
--td-cascader-content-height | 78vh | -
--td-cascader-disabled-color | @text-color-disabled | -
--td-cascader-options-height | calc(100% - @cascader-step-height) | -
--td-cascader-options-title-color | @text-color-placeholder | -
--td-cascader-step-arrow-color | @text-color-placeholder | -
--td-cascader-step-dot-size | 16rpx | -
--td-cascader-step-height | 88rpx | -
--td-cascader-title-color | @text-color-primary | -
--td-cascader-title-height | 26rpx | -
--td-cascader-title-padding | @spacer-2 | -
--td-cascder-title-font-size | 36rpx | -

View File

@@ -0,0 +1,59 @@
/// <reference types="miniprogram-api-typings" />
import { SuperComponent } from '../common/src/index';
import { TdCascaderProps } from './type';
export interface CascaderProps extends TdCascaderProps {
}
export default class Cascader extends SuperComponent {
externalClasses: string[];
options: WechatMiniprogram.Component.ComponentOptions;
properties: TdCascaderProps<import("../common/common").TreeOptionData<string | number>>;
controlledProps: {
key: string;
event: string;
}[];
state: {
contentHeight: number;
stepHeight: number;
tabsHeight: number;
subTitlesHeight: number;
stepsInitHeight: number;
};
data: {
prefix: string;
name: string;
stepIndex: number;
selectedIndexes: any[];
selectedValue: any[];
scrollTopList: any[];
steps: any[];
_optionsHeight: number;
};
observers: {
visible(v: any): void;
value(): void;
options(): void;
selectedIndexes(): void;
stepIndex(): Promise<void>;
};
methods: {
updateOptionsHeight(steps: number): void;
initOptionsHeight(steps: number): Promise<void>;
initWithValue(): void;
getIndexesByValue(options: import("../common/common").TreeOptionData<string | number>[], value: any): any[];
updateScrollTop(): void;
hide(trigger: any): void;
onVisibleChange(): void;
onClose(): void;
onStepClick(e: any): void;
onTabChange(e: any): void;
genItems(): {
selectedValue: any[];
steps: any[];
items: {
[x: string]: any;
}[][];
};
handleSelect(e: any): void;
triggerChange(): void;
};
}

View File

@@ -0,0 +1,303 @@
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 { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
import { getRect } from '../common/utils';
const { prefix } = config;
const name = `${prefix}-cascader`;
function parseOptions(options, keys) {
var _a, _b;
const label = (_a = keys === null || keys === void 0 ? void 0 : keys.label) !== null && _a !== void 0 ? _a : 'label';
const value = (_b = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _b !== void 0 ? _b : 'value';
return options.map((item) => {
return {
[label]: item[label],
[value]: item[value],
};
});
}
const defaultState = {
contentHeight: 0,
stepHeight: 0,
tabsHeight: 0,
subTitlesHeight: 0,
stepsInitHeight: 0,
};
let Cascader = class Cascader extends SuperComponent {
constructor() {
super(...arguments);
this.externalClasses = [`${prefix}-class`];
this.options = {
multipleSlots: true,
pureDataPattern: /^options$/,
};
this.properties = props;
this.controlledProps = [
{
key: 'value',
event: 'change',
},
];
this.state = Object.assign({}, defaultState);
this.data = {
prefix,
name,
stepIndex: 0,
selectedIndexes: [],
selectedValue: [],
scrollTopList: [],
steps: [],
_optionsHeight: 0,
};
this.observers = {
visible(v) {
if (v) {
const $tabs = this.selectComponent('#tabs');
$tabs === null || $tabs === void 0 ? void 0 : $tabs.setTrack();
$tabs === null || $tabs === void 0 ? void 0 : $tabs.getTabHeight().then((res) => {
this.state.tabsHeight = res.height;
});
this.initOptionsHeight(this.data.steps.length);
this.updateScrollTop();
this.initWithValue();
}
else {
this.state = Object.assign({}, defaultState);
}
},
value() {
this.initWithValue();
},
options() {
const { selectedValue, steps, items } = this.genItems();
this.setData({
steps,
items,
selectedValue,
stepIndex: items.length - 1,
});
},
selectedIndexes() {
const { visible, theme } = this.properties;
const { selectedValue, steps, items } = this.genItems();
const setData = {
steps,
selectedValue,
stepIndex: items.length - 1,
};
if (JSON.stringify(items) !== JSON.stringify(this.data.items)) {
Object.assign(setData, { items });
}
this.setData(setData);
if (visible && theme === 'step') {
this.updateOptionsHeight(steps.length);
}
},
stepIndex() {
return __awaiter(this, void 0, void 0, function* () {
const { visible } = this.data;
if (visible) {
this.updateScrollTop();
}
});
},
};
this.methods = {
updateOptionsHeight(steps) {
const { contentHeight, stepsInitHeight, stepHeight, subTitlesHeight } = this.state;
this.setData({
_optionsHeight: contentHeight - stepsInitHeight - subTitlesHeight - (steps - 1) * stepHeight,
});
},
initOptionsHeight(steps) {
return __awaiter(this, void 0, void 0, function* () {
const { theme, subTitles } = this.properties;
const { height } = yield getRect(this, `.${name}__content`);
this.state.contentHeight = height;
if (theme === 'step') {
yield Promise.all([getRect(this, `.${name}__steps`), getRect(this, `.${name}__step`)]).then(([stepsRect, stepRect]) => {
this.state.stepsInitHeight = stepsRect.height - (steps - 1) * stepRect.height;
this.state.stepHeight = stepRect.height;
});
}
if (subTitles.length > 0) {
const { height } = yield getRect(this, `.${name}__options-title`);
this.state.subTitlesHeight = height;
}
const optionsInitHeight = this.state.contentHeight - this.state.subTitlesHeight;
this.setData({
_optionsHeight: theme === 'step'
? optionsInitHeight - this.state.stepsInitHeight - (steps - 1) * this.state.stepHeight
: optionsInitHeight - this.state.tabsHeight,
});
});
},
initWithValue() {
if (this.data.value != null && this.data.value !== '') {
const selectedIndexes = this.getIndexesByValue(this.data.options, this.data.value);
if (selectedIndexes) {
this.setData({ selectedIndexes });
}
}
else {
this.setData({ selectedIndexes: [] });
}
},
getIndexesByValue(options, value) {
var _a, _b, _c;
const { keys } = this.data;
for (let i = 0, size = options.length; i < size; i += 1) {
const opt = options[i];
if (opt[(_a = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _a !== void 0 ? _a : 'value'] === value) {
return [i];
}
if (opt[(_b = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _b !== void 0 ? _b : 'children']) {
const res = this.getIndexesByValue(opt[(_c = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _c !== void 0 ? _c : 'children'], value);
if (res) {
return [i, ...res];
}
}
}
},
updateScrollTop() {
const { visible, items, selectedIndexes, stepIndex } = this.data;
if (visible) {
getRect(this, '.cascader-radio-group-0').then((rect) => {
var _a;
const eachRadioHeight = rect.height / ((_a = items[0]) === null || _a === void 0 ? void 0 : _a.length);
this.setData({
[`scrollTopList[${stepIndex}]`]: eachRadioHeight * selectedIndexes[stepIndex],
});
});
}
},
hide(trigger) {
this.setData({ visible: false });
this.triggerEvent('close', { trigger: trigger });
},
onVisibleChange() {
this.hide('overlay');
},
onClose() {
if (this.data.checkStrictly) {
this.triggerChange();
}
this.hide('close-btn');
},
onStepClick(e) {
const { index } = e.currentTarget.dataset;
this.setData({ stepIndex: index });
},
onTabChange(e) {
const { value } = e.detail;
this.setData({
stepIndex: value,
});
},
genItems() {
var _a, _b, _c, _d, _e;
const { options, selectedIndexes, keys, placeholder } = this.data;
const selectedValue = [];
const steps = [];
const items = [parseOptions(options, keys)];
if (options.length > 0) {
let current = options;
for (let i = 0, size = selectedIndexes.length; i < size; i += 1) {
const index = selectedIndexes[i];
const next = current[index];
current = next[(_a = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _a !== void 0 ? _a : 'children'];
selectedValue.push(next[(_b = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _b !== void 0 ? _b : 'value']);
steps.push(next[(_c = keys === null || keys === void 0 ? void 0 : keys.label) !== null && _c !== void 0 ? _c : 'label']);
if (next[(_d = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _d !== void 0 ? _d : 'children']) {
items.push(parseOptions(next[(_e = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _e !== void 0 ? _e : 'children'], keys));
}
}
}
if (steps.length < items.length) {
steps.push(placeholder);
}
return {
selectedValue,
steps,
items,
};
},
handleSelect(e) {
var _a, _b, _c, _d, _e;
const { level } = e.target.dataset;
const { value } = e.detail;
const { checkStrictly } = this.properties;
const { selectedIndexes, items, keys, options, selectedValue } = this.data;
const index = items[level].findIndex((item) => { var _a; return item[(_a = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _a !== void 0 ? _a : 'value'] === value; });
let item = selectedIndexes.slice(0, level).reduce((acc, item, index) => {
var _a;
if (index === 0) {
return acc[item];
}
return acc[(_a = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _a !== void 0 ? _a : 'children'][item];
}, options);
if (level === 0) {
item = item[index];
}
else {
item = item[(_a = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _a !== void 0 ? _a : 'children'][index];
}
if (item.disabled) {
return;
}
this.triggerEvent('pick', {
value: item[(_b = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _b !== void 0 ? _b : 'value'],
label: item[(_c = keys === null || keys === void 0 ? void 0 : keys.label) !== null && _c !== void 0 ? _c : 'label'],
index,
level,
});
selectedIndexes[level] = index;
if (checkStrictly && selectedValue.includes(String(value))) {
selectedIndexes.length = level;
this.setData({ selectedIndexes });
return;
}
selectedIndexes.length = level + 1;
const { items: newItems } = this.genItems();
if ((_e = item === null || item === void 0 ? void 0 : item[(_d = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _d !== void 0 ? _d : 'children']) === null || _e === void 0 ? void 0 : _e.length) {
this.setData({
selectedIndexes,
[`items[${level + 1}]`]: newItems[level + 1],
});
}
else {
this.setData({
selectedIndexes,
}, this.triggerChange);
this.hide('finish');
}
},
triggerChange() {
var _a;
const { items, selectedValue, selectedIndexes } = this.data;
this._trigger('change', {
value: (_a = selectedValue[selectedValue.length - 1]) !== null && _a !== void 0 ? _a : '',
selectedOptions: items.map((item, index) => item[selectedIndexes[index]]).filter(Boolean),
});
},
};
}
};
Cascader = __decorate([
wxComponent()
], Cascader);
export default Cascader;

View File

@@ -0,0 +1,11 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon",
"t-popup": "../popup/popup",
"t-tabs": "../tabs/tabs",
"t-tab-panel": "../tab-panel/tab-panel",
"t-radio-group": "../radio-group/radio-group"
}
}

View File

@@ -0,0 +1,66 @@
<wxs src="../common/utils.wxs" module="_" />
<t-popup class="class" visible="{{visible}}" placement="bottom" bind:visible-change="onVisibleChange">
<view style="{{_._style([style, customStyle])}}" class="{{name}}">
<view class="{{name}}__title">
<slot name="title" />
{{title}}
</view>
<view class="{{name}}__close-btn" bind:tap="onClose">
<slot name="close-btn" />
<t-icon wx:if="{{closeBtn}}" size="48rpx" name="close" />
</view>
<view class="{{name}}__content">
<block wx:if="{{steps && steps.length}}">
<view wx:if="{{theme == 'step'}}" class="{{name}}__steps">
<view wx:for="{{steps}}" wx:key="index" class="{{name}}__step" bind:tap="onStepClick" data-index="{{index}}">
<view
class="{{name}}__step-dot {{name}}__step-dot--{{item !== placeholder ? 'active' : ''}} {{name}}__step-dot--{{index === steps.length - 1 ? 'last' : ''}}"
></view>
<view class="{{name}}__step-label {{name}}__step-label--{{index === stepIndex ? 'active' : ''}}">
{{ item }}
</view>
<t-icon name="chevron-right" size="44rpx" t-class="{{name}}__step-arrow" />
</view>
</view>
<block wx:if="{{theme == 'tab'}}">
<t-tabs id="tabs" value="{{stepIndex}}" bind:change="onTabChange" space-evenly="{{false}}">
<t-tab-panel wx:for="{{steps}}" wx:key="index" value="{{index}}" label="{{item}}" />
</t-tabs>
</block>
</block>
<view wx:if="{{ subTitles && subTitles[stepIndex] }}" class="{{name}}__options-title"
>{{subTitles[stepIndex]}}</view
>
<view
class="{{name}}__options-container"
style="width: {{items.length + 1}}00vw; transform: translateX(-{{stepIndex}}00vw)"
>
<scroll-view
wx:for="{{items}}"
wx:for-item="options"
wx:key="index"
class="{{name}}__options"
scroll-y
scroll-top="{{scrollTopList[index]}}"
type="list"
style="height: {{_optionsHeight}}px"
>
<view class="cascader-radio-group-{{index}}">
<t-radio-group
value="{{selectedValue[index]}}"
keys="{{keys}}"
options="{{options}}"
bind:change="handleSelect"
data-level="{{index}}"
placement="right"
icon="line"
borderless
>
</t-radio-group>
</view>
</scroll-view>
</view>
</view>
</view>
</t-popup>

View File

@@ -0,0 +1,132 @@
.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-cascader {
display: flex;
flex-direction: column;
background-color: var(--td-cascader-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
color: var(--td-cascader-title-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
border-radius: var(--td-radius-extra-large, 24rpx) var(--td-radius-extra-large, 24rpx) 0 0;
--td-radio-icon-checked-color: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
--td-tab-item-active-color: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
--td-tab-track-color: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
}
.t-cascader__close-btn {
right: 32rpx;
top: 24rpx;
position: absolute;
}
.t-cascader__title {
position: relative;
font-weight: 700;
text-align: center;
line-height: var(--td-cascader-title-height, 26rpx);
padding: var(--td-cascader-title-padding, var(--td-spacer-2, 32rpx));
font-size: var(--td-cascder-title-font-size, 36rpx);
}
.t-cascader__content {
width: 100%;
height: var(--td-cascader-content-height, 78vh);
display: flex;
flex-direction: column;
}
.t-cascader__options {
width: 100vw;
}
.t-cascader__options-title {
color: var(--td-cascader-options-title-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
font-size: var(--td-font-size-base, 28rpx);
line-height: 44rpx;
padding-top: 40rpx;
padding-left: var(--td-spacer-2, 32rpx);
box-sizing: border-box;
}
.t-cascader__options-container {
flex: 1;
display: flex;
transition: all ease 0.3s;
}
.t-cascader__step {
display: flex;
align-items: center;
height: var(--td-cascader-step-height, 88rpx);
}
.t-cascader__steps {
padding: 0 32rpx 10rpx;
position: relative;
}
.t-cascader__steps::after {
content: '';
display: block;
position: absolute;
top: unset;
bottom: 0;
left: unset;
right: unset;
background-color: var(--td-cascader-border-color, var(--td-component-stroke, var(--td-gray-color-3, #e7e7e7)));
}
.t-cascader__steps::after {
height: 1px;
left: 0;
right: 0;
transform: scaleY(0.5);
}
.t-cascader__step-dot {
position: relative;
width: var(--td-cascader-step-dot-size, 16rpx);
height: var(--td-cascader-step-dot-size, 16rpx);
border-radius: 50%;
border: 2rpx solid var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
box-sizing: border-box;
}
.t-cascader__step-dot:not(.t-cascader__step-dot--last)::after {
content: '';
display: block;
position: absolute;
left: 50%;
top: calc(var(--td-cascader-step-dot-size, 16rpx) + 14rpx);
height: 36rpx;
width: 2rpx;
background: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
transform: translateX(-50%);
}
.t-cascader__step-dot--active {
background: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
border-color: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
}
.t-cascader__step-label {
padding-left: var(--td-spacer-2, 32rpx);
font-size: var(--td-font-size-m, 32rpx);
}
.t-cascader__step-label--active {
color: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
font-weight: 600;
}
.t-cascader__step-arrow {
color: var(--td-cascader-step-arrow-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
margin-left: auto;
}

View File

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

View File

@@ -0,0 +1,45 @@
const props = {
checkStrictly: {
type: Boolean,
value: false,
},
closeBtn: {
type: Boolean,
value: true,
},
keys: {
type: Object,
},
options: {
type: Array,
value: [],
},
placeholder: {
type: String,
value: '选择选项',
},
subTitles: {
type: Array,
value: [],
},
theme: {
type: String,
value: 'step',
},
title: {
type: String,
},
value: {
type: null,
value: null,
},
defaultValue: {
type: null,
value: null,
},
visible: {
type: Boolean,
value: false,
},
};
export default props;

View File

@@ -0,0 +1,47 @@
import { TreeOptionData, KeysType } from '../common/common';
export interface TdCascaderProps<CascaderOption extends TreeOptionData = TreeOptionData> {
checkStrictly?: {
type: BooleanConstructor;
value?: boolean;
};
closeBtn?: {
type: BooleanConstructor;
value?: boolean;
};
keys?: {
type: ObjectConstructor;
value?: KeysType;
};
options?: {
type: ArrayConstructor;
value?: Array<CascaderOption>;
};
placeholder?: {
type: StringConstructor;
value?: string;
};
subTitles?: {
type: ArrayConstructor;
value?: Array<string>;
};
theme?: {
type: StringConstructor;
value?: 'step' | 'tab';
};
title?: {
type: StringConstructor;
value?: string;
};
value?: {
type: null;
value?: string | number;
};
defaultValue?: {
type: null;
value?: string | number;
};
visible?: {
type: BooleanConstructor;
value?: boolean;
};
}

View File

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