From b45c5bffad4933cfc4540de51dc5d6ee56ab8b23 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 22:07:37 +0000 Subject: [PATCH 0001/1046] build(deps-dev): bump gulp-sourcemaps from 2.6.5 to 3.0.0 Bumps [gulp-sourcemaps](https://github.com/gulp-sourcemaps/gulp-sourcemaps) from 2.6.5 to 3.0.0. - [Release notes](https://github.com/gulp-sourcemaps/gulp-sourcemaps/releases) - [Commits](https://github.com/gulp-sourcemaps/gulp-sourcemaps/compare/v2.6.5...v3.0.0) --- updated-dependencies: - dependency-name: gulp-sourcemaps dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0601cd6ab..73edbdc15 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "gulp-rename": "^2.0.0", "gulp-replace": "^1.0.0", "gulp-replace-task": "^2.0.1", - "gulp-sourcemaps": "^2.6.5", + "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", "husky": "^7.0.4", "jest": "^26.6.3", From 169ebd9c3a568a81b581087082b4f8b37bf3a688 Mon Sep 17 00:00:00 2001 From: ericjyang Date: Thu, 21 Apr 2022 14:05:22 +0800 Subject: [PATCH 0002/1046] feat: add tpl.json file --- script/tpl.json | 270 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 270 insertions(+) create mode 100644 script/tpl.json diff --git a/script/tpl.json b/script/tpl.json new file mode 100644 index 000000000..414d5c8c4 --- /dev/null +++ b/script/tpl.json @@ -0,0 +1,270 @@ +{ + "t-action-sheet": { + "tpl": "" + }, + "t-avatar-group": { + "tpl": "", + "require": { + "t-avatar": "./avatar/avatar" + }, + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-avatar.png" + }, + "t-avatar": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-avatar.png" + }, + "t-back-top": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-backtop.png" + }, + "t-badge": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-badge.png" + }, + "t-button": { + "tpl": "强按钮", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-button.png" + }, + "t-cell": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-cell.png" + }, + "t-cell-group": { + "tpl": "", + "require": { + "t-cell": "./cell/cell" + }, + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-cell.png" + }, + "t-check-tag": { + "tpl": "check tag" + }, + "t-checkbox": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-checkbox.png" + }, + "t-checkbox-group": { + "tpl": "", + "require": { + "t-checkbox": "./checkbox/checkbox" + }, + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-checkbox.png" + }, + "t-collapse-panel": { + "tpl": "此处可自定义内容" + }, + "t-collapse": { + "tpl": "此处可自定义内容", + "require": { + "t-collapse-panel": "./collapse/collapse-panel" + } + }, + "t-count-down": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-countdown.png" + }, + "t-date-time-picker": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-datetimepicker.png" + }, + "t-dialog": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-dialog.png" + }, + "t-divider": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-divider.png" + }, + "t-drawer": { + "tpl": "" + }, + "t-dropdown-item": { + "tpl": "" + }, + "t-dropdown-menu": { + "tpl": "", + "require": { + "t-dropdown-menu": "./dropdown-menu/dropdown-item" + } + }, + "t-empty": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-empty.png" + }, + "t-fab": { + "tpl": "" + }, + "t-footer": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-footer.png" + }, + "t-grid-item": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-grid.png" + }, + "t-grid": { + "tpl": "", + "require": { + "t-grid-item": "./grid/grid-item" + }, + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-grid.png" + }, + "t-icon": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-icon.png" + }, + "t-image": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-image.png" + }, + "t-indexes": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-indexes.png" + }, + "t-input": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-input.png" + }, + "t-loading": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-loading.png" + }, + "t-message": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-message.png" + }, + "t-navbar": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-navbar.png" + }, + "t-picker-item": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-picker.png" + }, + "t-picker": { + "tpl": "", + "require": { + "t-picker-item": "./picker/picker-item" + }, + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-picker.png" + }, + "t-popup": { + "tpl": "顶部弹出", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-popup.png" + }, + "t-progress": { + "tpl": "" + }, + "t-pull-down-refresh": { + "tpl": "拖拽该区域演示 中间下拉刷新", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-pulldownrefresh.png" + }, + "t-radio-group": { + "tpl": "", + "require": { + "t-radio": "./radio/radio" + }, + "icon:": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-radio.png" + }, + "t-radio": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-radio.png" + }, + "t-rate": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-rate.png" + }, + "t-search": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-search.png" + }, + "t-segmented-control": { + "tpl": "" + }, + "t-skeleton": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-skeleton.png" + }, + "t-slider": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-slider.png" + }, + "t-stepper": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-stepper.png" + }, + "t-step-item": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-steps.png" + }, + "t-steps": { + "tpl": "", + "require": { + "t-step-item": "./steps/step-item" + }, + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-steps.png" + }, + "t-sticky": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-sticky.png" + }, + "t-swipe-cell": { + "tpl": "删除", + "require": { + "t-cell": "./cell/cell" + }, + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-swipecell.png" + }, + "t-swiper": { + "tpl": "", + "require": { + "t-swiper-item": "./swiper/swiper-item" + }, + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-swiper.png" + }, + "t-switch": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-switch.png" + }, + "t-tab-bar-item": { + "tpl": "{{item.label}}", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-tabbar.png" + }, + "t-tab-bar": { + "tpl": "{{item.label}}", + "require": { + "t-tab-bar-item": "./tab-bar/tab-bar-item" + }, + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-tabbar.png" + }, + "t-tab-panel": { + "tpl": "标签一内容", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-tabs.png" + }, + "t-tabs": { + "tpl": "标签一内容标签二内容", + "require": { + "t-tab-panel": "./tabs/tab-panel" + }, + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-tabs.png" + }, + "t-tag": { + "tpl": "重要", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-tag.png" + }, + "t-textarea": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-textarea.png" + }, + "t-toast": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-toast.png" + }, + "t-transition": { + "tpl": "" + }, + "t-upload": { + "tpl": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-upload.png" + } +} From 5da3733dc330f598e5e3ab2dd30e019aa4805f72 Mon Sep 17 00:00:00 2001 From: ericjyang Date: Mon, 25 Apr 2022 20:14:11 +0800 Subject: [PATCH 0003/1046] ci(wechatide): update cli logic --- .wechatide.ib.json | 1674 +++++++++++++--------------------- script/gulpfile.wechatide.js | 58 +- script/tpl.json | 2 +- 3 files changed, 688 insertions(+), 1046 deletions(-) diff --git a/.wechatide.ib.json b/.wechatide.ib.json index 61aa33405..6a511da9c 100644 --- a/.wechatide.ib.json +++ b/.wechatide.ib.json @@ -1,16 +1,91 @@ { - "components": [ - { + "key": "TDesign", + "label": "Tdesign", + "components": { + "t-action-sheet": { + "key": "t-action-sheet", + "label": "动作面板", + "icon": "", + "properties": [ + { + "key": "cancelText", + "type": [ + "String" + ], + "desc": "设置取消按钮的文本", + "label": "" + }, + { + "key": "count", + "type": [ + "Number" + ], + "desc": "设置每页展示菜单的数量,仅当 type=grid 时有效", + "label": "" + }, + { + "key": "items", + "type": [ + "Array" + ], + "desc": "菜单项", + "label": "" + }, + { + "key": "showCancel", + "type": [ + "Boolean" + ], + "desc": "是否显示取消按钮", + "label": "" + }, + { + "key": "theme", + "type": [ + "String" + ], + "desc": "展示类型,列表和表格形式展示", + "label": "" + }, + { + "key": "visible", + "type": [ + "Boolean" + ], + "desc": "显示与隐藏", + "label": "" + } + ], + "events": [ + { + "key": "cancel", + "desc": "点击取消按钮时触发", + "label": "" + }, + { + "key": "close", + "desc": "关闭时触发", + "label": "" + }, + { + "key": "selected", + "desc": "选择菜单项时触发", + "label": "" + } + ], + "tpl": "", + "path": "./action-sheet/action-sheet" + }, + "t-avatar-group": { "key": "t-avatar-group", "label": "头像组", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-avatar.png", "properties": [ { "key": "cascading", "type": [ "String" ], - "defaultValue": "'right-up'", "desc": "图片之间的层叠关系,可选值:左侧图片在上和右侧图片在上", "label": "" }, @@ -19,7 +94,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "头像数量超出时,会出现一个头像折叠元素。该元素内容可自定义。默认为 `+N`。示例:`+5`,`...`, `更多`", "label": "" }, @@ -28,7 +102,6 @@ "type": [ "Number" ], - "defaultValue": "", "desc": "能够同时显示的最多头像数量", "label": "" }, @@ -37,26 +110,26 @@ "type": [ "String" ], - "defaultValue": "medium", "desc": "尺寸,示例值:small/medium/large/24px/38px 等。优先级低于 Avatar.size", "label": "" } ], + "tpl": "", "require": { - "t-avatar": "./avatar" - } + "t-avatar": "./avatar/avatar" + }, + "path": "./avatar/avatar-group" }, - { + "t-avatar": { "key": "t-avatar", "label": "头像", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-avatar.png", "properties": [ { "key": "alt", "type": [ "String" ], - "defaultValue": "", "desc": "头像替换文本,仅当图片加载失败时有效", "label": "" }, @@ -65,7 +138,6 @@ "type": [ "Object" ], - "defaultValue": "", "desc": "头像右上角提示信息,继承 Badge 组件的全部特性。如:小红点,或者数字", "label": "" }, @@ -74,7 +146,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "加载失败时隐藏图片", "label": "" }, @@ -83,7 +154,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "图标", "label": "" }, @@ -92,7 +162,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "图片地址", "label": "" }, @@ -101,7 +170,6 @@ "type": [ "String" ], - "defaultValue": "circle", "desc": "形状", "label": "" }, @@ -110,7 +178,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "尺寸,示例值:small/medium/large/24px/38px 等,默认为 large", "label": "" } @@ -122,23 +189,19 @@ "label": "" } ], - "require": { - "t-icon": "../icon/icon", - "t-badge": "../badge/badge", - "t-image": "../image/image" - } + "tpl": "", + "path": "./avatar/avatar" }, - { + "t-back-top": { "key": "t-back-top", "label": "回到顶部", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-backtop.png", "properties": [ { "key": "fixed", "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否绝对定位固定到屏幕右下方", "label": "" }, @@ -147,7 +210,6 @@ "type": [ "String" ], - "defaultValue": "'backtop'", "desc": "图标", "label": "" }, @@ -156,7 +218,6 @@ "type": [ "String" ], - "defaultValue": "''", "desc": "文案", "label": "" }, @@ -165,7 +226,6 @@ "type": [ "String" ], - "defaultValue": "round", "desc": "预设的样式类型", "label": "" } @@ -177,21 +237,19 @@ "label": "" } ], - "require": { - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./back-top/back-top" }, - { + "t-badge": { "key": "t-badge", "label": "徽标数", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-badge.png", "properties": [ { "key": "color", "type": [ "String" ], - "defaultValue": "", "desc": "颜色", "label": "" }, @@ -200,7 +258,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "徽标内容,示例:`content='自定义内容'`。也可以使用默认插槽定义", "label": "" }, @@ -210,7 +267,6 @@ "String", "Number" ], - "defaultValue": "0", "desc": "徽标右上角内容。可以是数字,也可以是文字。如:'new'/3/99+。特殊:值为空表示使用插槽渲染", "label": "" }, @@ -219,7 +275,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否为红点", "label": "" }, @@ -228,7 +283,6 @@ "type": [ "Number" ], - "defaultValue": "99", "desc": "封顶的数字值", "label": "" }, @@ -237,7 +291,6 @@ "type": [ "Array" ], - "defaultValue": "", "desc": "设置状态点的位置偏移,示例:[-10, 20] 或 ['10em', '8rem']", "label": "" }, @@ -246,7 +299,6 @@ "type": [ "String" ], - "defaultValue": "circle", "desc": "形状", "label": "" }, @@ -255,7 +307,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "当数值为 0 时,是否展示徽标", "label": "" }, @@ -264,23 +315,23 @@ "type": [ "String" ], - "defaultValue": "medium", "desc": "尺寸", "label": "" } - ] + ], + "tpl": "", + "path": "./badge/badge" }, - { + "t-button": { "key": "t-button", "label": "按钮", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-button.png", "properties": [ { "key": "block", "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否为块级元素", "label": "" }, @@ -289,7 +340,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "按钮内容", "label": "" }, @@ -298,7 +348,6 @@ "type": [ "Object" ], - "defaultValue": "", "desc": "自定义 dataset,可通过 event.currentTarget.dataset.custom 获取", "label": "" }, @@ -307,7 +356,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否禁用按钮", "label": "" }, @@ -316,7 +364,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否为幽灵按钮(镂空按钮)", "label": "" }, @@ -325,7 +372,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "图标名称", "label": "" }, @@ -334,7 +380,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否显示为加载状态", "label": "" }, @@ -343,7 +388,6 @@ "type": [ "String" ], - "defaultValue": "rectangle", "desc": "按钮形状,有 4 种:长方形、正方形、圆角长方形、圆形", "label": "" }, @@ -352,7 +396,6 @@ "type": [ "String" ], - "defaultValue": "medium", "desc": "组件尺寸", "label": "" }, @@ -361,7 +404,6 @@ "type": [ "String" ], - "defaultValue": "default", "desc": "组件风格,依次为品牌色、危险色", "label": "" }, @@ -370,7 +412,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "同小程序的 formType", "label": "" }, @@ -379,7 +420,6 @@ "type": [ "String" ], - "defaultValue": "base", "desc": "按钮形式,基础、线框、文字", "label": "" } @@ -391,21 +431,19 @@ "label": "" } ], - "require": { - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./button/button" }, - { + "t-cell-group": { "key": "t-cell-group", "label": "单元格组", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-cell.png", "properties": [ { "key": "bordered", "type": [ "Boolean" ], - "defaultValue": "", "desc": "是否显示组边框", "label": "" }, @@ -414,23 +452,26 @@ "type": [ "String" ], - "defaultValue": "", "desc": "单元格组标题", "label": "" } - ] + ], + "tpl": "", + "require": { + "t-cell": "./cell/cell" + }, + "path": "./cell-group/cell-group" }, - { + "t-cell": { "key": "t-cell", "label": "单元格", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-cell.png", "properties": [ { "key": "align", "type": [ "String" ], - "defaultValue": "middle", "desc": "内容的对齐方式,默认居中对齐", "label": "" }, @@ -439,7 +480,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否显示右侧箭头", "label": "" }, @@ -448,7 +488,6 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否显示下边框", "label": "" }, @@ -457,7 +496,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "下方内容描述", "label": "" }, @@ -466,7 +504,6 @@ "type": [ "Boolean" ], - "defaultValue": "", "desc": "是否开启点击反馈", "label": "" }, @@ -475,7 +512,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "主图", "label": "" }, @@ -484,7 +520,6 @@ "type": [ "String" ], - "defaultValue": "navigateTo", "desc": "链接跳转类型", "label": "" }, @@ -493,7 +528,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "左侧图标,出现在单元格标题的左侧", "label": "" }, @@ -502,7 +536,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "和标题同行的说明文字", "label": "" }, @@ -511,7 +544,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否显示表单必填星号", "label": "" }, @@ -520,7 +552,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "最右侧图标", "label": "" }, @@ -529,7 +560,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "标题", "label": "" }, @@ -538,7 +568,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "点击后跳转链接地址。如果值为空,则表示不需要跳转", "label": "" } @@ -550,11 +579,10 @@ "label": "" } ], - "require": { - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./cell/cell" }, - { + "t-check-tag": { "key": "t-check-tag", "label": "可选标签", "icon": "", @@ -564,18 +592,15 @@ "type": [ "Boolean" ], - "defaultValue": "undefined", "desc": "标签选中的状态,默认风格(theme=default)才有选中态", "label": "" }, { "key": "closable", "type": [ - "String", "Boolean" ], - "defaultValue": "false", - "desc": "是否可以关闭", + "desc": "标签是否可关闭", "label": "" }, { @@ -584,7 +609,6 @@ "String", "Number" ], - "defaultValue": "", "desc": "组件子元素", "label": "" }, @@ -593,7 +617,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态", "label": "" }, @@ -602,8 +625,7 @@ "type": [ "String" ], - "defaultValue": "", - "desc": "标签图标", + "desc": "标签中的图标,可自定义图标呈现", "label": "" }, { @@ -611,7 +633,6 @@ "type": [ "String" ], - "defaultValue": "square", "desc": "标签类型,有三种:方形、圆角方形、标记型", "label": "" }, @@ -620,7 +641,6 @@ "type": [ "String" ], - "defaultValue": "medium", "desc": "标签尺寸", "label": "" } @@ -637,21 +657,19 @@ "label": "" } ], - "require": { - "t-icon": ".././icon/icon" - } + "tpl": "check tag", + "path": "./tag/check-tag" }, - { + "t-checkbox-group": { "key": "t-checkbox-group", "label": "多选框组", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-checkbox.png", "properties": [ { "key": "disabled", "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否禁用组件", "label": "" }, @@ -660,7 +678,6 @@ "type": [ "Number" ], - "defaultValue": "undefined", "desc": "支持最多选中的数量", "label": "" }, @@ -669,7 +686,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "统一设置内部复选框 HTML 属性", "label": "" }, @@ -678,7 +694,6 @@ "type": [ "Array" ], - "defaultValue": "[]", "desc": "以配置形式设置子元素。示例1:`['北京', '上海']` ,示例2: `[{ label: '全选', checkAll: true }, { label: '上海', value: 'shanghai' }]`。checkAll 值为 true 表示当前选项为「全选选项」", "label": "" }, @@ -687,7 +702,6 @@ "type": [ "Array" ], - "defaultValue": "[]", "desc": "选中值", "label": "" } @@ -695,26 +709,27 @@ "events": [ { "key": "change", - "desc": "值变化时触发。`context.current` 表示当前变化的数据项,如果是全选则为空;`context.type` 表示引起选中数据变化的是选中或是取消选中", + "desc": "值变化时触发。`context.current` 表示当前变化的数据项,如果是全选则为空;`context.type` 表示引起选中数据变化的是选中或是取消选中,`context.option` 表示当前变化的数据项", "label": "" } ], + "tpl": "", "require": { - "t-checkbox": "../checkbox/checkbox" - } + "t-checkbox": "./checkbox/checkbox" + }, + "path": "./checkbox-group/checkbox-group" }, - { + "t-checkbox": { "key": "t-checkbox", "label": "多选框", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-checkbox.png", "properties": [ { "key": "align", "type": [ "String" ], - "defaultValue": "left", - "desc": "复选框和内容相对位置", + "desc": "多选框和内容相对位置", "label": "" }, { @@ -722,7 +737,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "用于标识是否为「全选选项」。单独使用无效,需在 CheckboxGroup 中使用", "label": "" }, @@ -731,7 +745,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否选中", "label": "" }, @@ -740,8 +753,7 @@ "type": [ "String" ], - "defaultValue": "#0052d9", - "desc": "复选框颜色", + "desc": "多选框颜色", "label": "" }, { @@ -749,8 +761,7 @@ "type": [ "String" ], - "defaultValue": "", - "desc": "复选框内容", + "desc": "多选框内容", "label": "" }, { @@ -758,7 +769,6 @@ "type": [ "Boolean" ], - "defaultValue": "", "desc": "是否禁用组件内容(content)触发选中", "label": "" }, @@ -767,7 +777,6 @@ "type": [ "Boolean" ], - "defaultValue": "undefined", "desc": "是否禁用组件", "label": "" }, @@ -776,7 +785,6 @@ "type": [ "Array" ], - "defaultValue": "", "desc": "自定义选中图标和非选中图标。示例:[选中态图标地址,非选中态图标地址]", "label": "" }, @@ -785,7 +793,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否为半选", "label": "" }, @@ -794,7 +801,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "主文案", "label": "" }, @@ -803,7 +809,6 @@ "type": [ "Number" ], - "defaultValue": "5", "desc": "内容最大行数限制", "label": "" }, @@ -812,7 +817,6 @@ "type": [ "Number" ], - "defaultValue": "3", "desc": "主文案最大行数限制", "label": "" }, @@ -821,7 +825,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "HTML 元素原生属性", "label": "" }, @@ -830,7 +833,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "只读状态", "label": "" }, @@ -840,8 +842,7 @@ "String", "Number" ], - "defaultValue": "", - "desc": "复选框的值", + "desc": "多选框的值", "label": "" } ], @@ -852,12 +853,10 @@ "label": "" } ], - "require": { - "t-cell": "../cell/cell", - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./checkbox/checkbox" }, - { + "t-collapse-panel": { "key": "t-collapse-panel", "label": "折叠面板", "icon": "", @@ -867,25 +866,14 @@ "type": [ "String" ], - "defaultValue": "", "desc": "折叠面板内容", "label": "" }, - { - "key": "destroyOnCollapse", - "type": [ - "Boolean" - ], - "defaultValue": "false", - "desc": "当前面板处理折叠状态时,是否销毁面板内容", - "label": "" - }, { "key": "disabled", "type": [ "Boolean" ], - "defaultValue": "undefined", "desc": "禁止当前面板展开,优先级大于 Collapse 的同名属性", "label": "" }, @@ -894,7 +882,6 @@ "type": [ "Boolean" ], - "defaultValue": "", "desc": "当前折叠面板展开图标,优先级大于 Collapse 的同名属性", "label": "" }, @@ -903,7 +890,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "面板头内容", "label": "" }, @@ -912,35 +898,32 @@ "type": [ "String" ], - "defaultValue": "", "desc": "面板头的右侧区域,一般用于呈现面板操作", "label": "" + }, + { + "key": "value", + "type": [ + "String", + "Number" + ], + "desc": "当前面板唯一标识,如果值为空则取当前面下标兜底作为唯一标识", + "label": "" } ], - "require": { - "t-cell": "../cell/cell" - } + "tpl": "此处可自定义内容", + "path": "./collapse/collapse-panel" }, - { + "t-collapse": { "key": "t-collapse", "label": "折叠", "icon": "", "properties": [ - { - "key": "borderless", - "type": [ - "Boolean" - ], - "defaultValue": "false", - "desc": "是否为无边框模式", - "label": "" - }, { "key": "defaultExpandAll", "type": [ "Boolean" ], - "defaultValue": "false", "desc": "默认是否展开全部", "label": "" }, @@ -949,8 +932,7 @@ "type": [ "Boolean" ], - "defaultValue": "", - "desc": "是否禁用全部面板展开", + "desc": "是否禁用面板展开/收起操作", "label": "" }, { @@ -958,36 +940,22 @@ "type": [ "Boolean" ], - "defaultValue": "", "desc": "展开图标。值为 undefined 或 false 则不显示展开图标;值为 true 显示默认图标;值类型为函数,则表示完全自定义展开图标", "label": "" }, - { - "key": "expandIconPlacement", - "type": [ - "String" - ], - "defaultValue": "right", - "desc": "展开图标的位置,左侧或右侧", - "label": "" - }, { "key": "expandMutex", "type": [ "Boolean" ], - "defaultValue": "false", "desc": "每个面板互斥展开,每次只展开一个面板", "label": "" }, { "key": "value", "type": [ - "String", - "Number", "Array" ], - "defaultValue": "", "desc": "展开的面板集合", "label": "" } @@ -998,19 +966,23 @@ "desc": "切换面板时触发,返回变化的值", "label": "" } - ] + ], + "tpl": "此处可自定义内容", + "require": { + "t-collapse-panel": "./collapse/collapse-panel" + }, + "path": "./collapse/collapse" }, - { + "t-count-down": { "key": "t-count-down", "label": "倒计时", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-countdown.png", "properties": [ { "key": "autoStart", "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否自动开始倒计时", "label": "" }, @@ -1019,7 +991,6 @@ "type": [ "String" ], - "defaultValue": "'default'", "desc": "最终倒计时的展示内容,值为'default'时使用默认的格式,否则使用自定义样式插槽", "label": "" }, @@ -1028,7 +999,6 @@ "type": [ "String" ], - "defaultValue": "HH:mm:ss", "desc": "时间格式,DD-日,HH-时,mm-分,ss-秒,SSS-毫秒", "label": "" }, @@ -1037,7 +1007,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否开启毫秒级渲染", "label": "" }, @@ -1046,7 +1015,6 @@ "type": [ "String" ], - "defaultValue": "'small'", "desc": "倒计时尺寸", "label": "" }, @@ -1055,7 +1023,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "使用时间单位分割", "label": "" }, @@ -1064,7 +1031,6 @@ "type": [ "String" ], - "defaultValue": "'default'", "desc": "倒计时风格", "label": "" }, @@ -1073,7 +1039,6 @@ "type": [ "Number" ], - "defaultValue": "", "desc": "倒计时时长,单位毫秒", "label": "" } @@ -1090,21 +1055,19 @@ "label": "" } ], - "require": { - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./count-down/count-down" }, - { + "t-date-time-picker": { "key": "t-date-time-picker", "label": "日期时间选择器", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-datetimepicker.png", "properties": [ { "key": "cancelBtn", "type": [ "String" ], - "defaultValue": "取消", "desc": "取消按钮文字", "label": "" }, @@ -1113,7 +1076,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "确定按钮文字", "label": "" }, @@ -1123,143 +1085,40 @@ "Object", "Array" ], - "defaultValue": "", "desc": "禁用日期,示例:['A', 'B'] 表示日期 A 和日期 B 会被禁用。{ from: 'A', to: 'B' } 表示在 A 到 B 之间的日期会被禁用。{ before: 'A', after: 'B' } 表示在 A 之前和在 B 之后的日期都会被禁用。其中 A = '2021-01-01',B = '2021-02-01'。值类型为 Function 则表示返回值为 true 的日期会被禁用", "label": "" }, { - "key": "format", + "key": "footer", "type": [ "String" ], - "defaultValue": "'YYYY-MM-DD'", - "desc": "用于格式化日期,[详细文档](https://day.js.org/docs/en/display/format)", + "desc": "底部内容", "label": "" }, { - "key": "mode", - "type": [ - "String", - "Array" - ], - "defaultValue": "['year', 'month', 'date']", - "desc": "选择器模式,用于表示可以选择到哪一个层级。【示例一】year 或者 ['year'] 表示纯日期选择器,只能选择到年份,只显示年份。【示例二】'hour' 或 ['hour'] 表示纯时间选择器,只能选择到小时维度。【示例三】['year', 'month', 'date', 'hour', 'minute'] 表示,日期和时间 混合选择器,可以选择到具体哪一分钟,显示全部时间:年/月/日/时/分", - "label": "" - }, - { - "key": "showWeek", - "type": [ - "Boolean" - ], - "defaultValue": "false", - "desc": "是否在日期旁边显示周几(如周一,周二,周日等)", - "label": "" - }, - { - "key": "title", + "key": "format", "type": [ "String" ], - "defaultValue": "", - "desc": "标题", - "label": "" - }, - { - "key": "value", - "type": [ - "String", - "Number" - ], - "defaultValue": "", - "desc": "选中值", + "desc": "用于格式化日期,[详细文档](https://day.js.org/docs/en/display/format)", "label": "" }, { - "key": "visible", + "key": "header", "type": [ "Boolean" ], - "defaultValue": "false", - "desc": "是否显示", - "label": "" - } - ], - "events": [ - { - "key": "cancel", - "desc": "取消按钮点击时触发", - "label": "" - }, - { - "key": "change", - "desc": "选中值发生变化时触发", - "label": "" - }, - { - "key": "columnChange", - "desc": "每一列选中数据变化时触发", - "label": "" - }, - { - "key": "confirm", - "desc": "确认按钮点击时触发", - "label": "" - } - ], - "require": { - "t-picker": "../picker/picker", - "t-picker-column": "../picker/picker-column" - } - }, - { - "key": "t-date-time-range-picker", - "label": "日期时间范围选择器", - "icon": "", - "properties": [ - { - "key": "cancelBtn", - "type": [ - "String" - ], - "defaultValue": "取消", - "desc": "取消按钮文字", - "label": "" - }, - { - "key": "confirmBtn", - "type": [ - "String" - ], - "defaultValue": "", - "desc": "确定按钮文字", - "label": "" - }, - { - "key": "disableDate", - "type": [ - "Object", - "Array" - ], - "defaultValue": "", - "desc": "禁用日期,示例:['A', 'B'] 表示日期 A 和日期 B 会被禁用。{ from: 'A', to: 'B' } 表示在 A 到 B 之间的日期会被禁用。{ before: 'A', after: 'B' } 表示在 A 之前和在 B 之后的日期都会被禁用。其中 A = '2021-01-01',B = '2021-02-01'。值类型为 Function 则表示返回值为 true 的日期会被禁用", - "label": "" - }, - { - "key": "format", - "type": [ - "String" - ], - "defaultValue": "'YYYY-MM-DD'", - "desc": "用于格式化日期,[详细文档](https://day.js.org/docs/en/display/format)", + "desc": "头部内容。值为 true 显示空白头部,值为 false 不显示任何内容,值类型为 TNode 表示自定义头部内容", "label": "" }, { "key": "mode", "type": [ - "String" + "String", + "Array" ], - "defaultValue": "date", - "desc": "选择器模式,用于表示可以选择到哪一个层级", + "desc": "选择器模式,用于表示可以选择到哪一个层级。【示例一】year 或者 ['year'] 表示纯日期选择器,只能选择到年份,只显示年份。【示例二】'hour' 或 ['hour'] 表示纯时间选择器,只能选择到小时维度。【示例三】['year', 'month', 'date', 'hour', 'minute'] 表示,日期和时间 混合选择器,可以选择到具体哪一分钟,显示全部时间:年/月/日/时/分", "label": "" }, { @@ -1267,7 +1126,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否在日期旁边显示周几(如周一,周二,周日等)", "label": "" }, @@ -1276,16 +1134,15 @@ "type": [ "String" ], - "defaultValue": "", "desc": "标题", "label": "" }, { "key": "value", "type": [ - "Array" + "String", + "Number" ], - "defaultValue": "", "desc": "选中值", "label": "" }, @@ -1294,7 +1151,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否显示", "label": "" } @@ -1320,19 +1176,20 @@ "desc": "确认按钮点击时触发", "label": "" } - ] + ], + "tpl": "", + "path": "./date-time-picker/date-time-picker" }, - { + "t-dialog": { "key": "t-dialog", "label": "对话框", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-dialog.png", "properties": [ { "key": "actions", "type": [ "Array" ], - "defaultValue": "", "desc": "操作栏", "label": "" }, @@ -1341,7 +1198,6 @@ "type": [ "String" ], - "defaultValue": "horizontal", "desc": "多按钮排列方式", "label": "" }, @@ -1351,7 +1207,6 @@ "String", "Object" ], - "defaultValue": "''", "desc": "取消按钮,可自定义。值为 null 则不显示取消按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制取消事件", "label": "" }, @@ -1360,7 +1215,6 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "点击蒙层时是否触发关闭事件", "label": "" }, @@ -1370,7 +1224,6 @@ "String", "Object" ], - "defaultValue": "''", "desc": "确认按钮。值为 null 则不显示确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制确认事件", "label": "" }, @@ -1379,7 +1232,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "内容", "label": "" }, @@ -1388,16 +1240,22 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "防止滚动穿透", "label": "" }, + { + "key": "showInAttachedElement", + "type": [ + "Boolean" + ], + "desc": "【开发中】仅在挂载元素中显示抽屉,默认在浏览器可视区域显示。父元素需要有定位属性,如:position: relative", + "label": "" + }, { "key": "showOverlay", "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否显示遮罩层", "label": "" }, @@ -1406,7 +1264,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "标题", "label": "" }, @@ -1415,7 +1272,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "控制对话框是否显示", "label": "" }, @@ -1424,7 +1280,6 @@ "type": [ "Number" ], - "defaultValue": "", "desc": "对话框层级,Web 侧样式默认为 2500,移动端和小程序样式默认为 1500", "label": "" } @@ -1446,22 +1301,19 @@ "label": "" } ], - "require": { - "t-popup": "../popup/popup", - "t-button": "../button/button" - } + "tpl": "", + "path": "./dialog/dialog" }, - { + "t-divider": { "key": "t-divider", "label": "分割线", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-divider.png", "properties": [ { "key": "align", "type": [ "String" ], - "defaultValue": "center", "desc": "文本位置(仅在水平分割线有效)", "label": "" }, @@ -1470,7 +1322,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "子元素", "label": "" }, @@ -1479,7 +1330,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否虚线(仅在水平分割线有效)", "label": "" }, @@ -1488,7 +1338,6 @@ "type": [ "String" ], - "defaultValue": "horizontal", "desc": "分隔线类型有两种:水平和垂直", "label": "" }, @@ -1497,90 +1346,40 @@ "type": [ "String" ], - "defaultValue": "", "desc": "分隔线颜色", "label": "" } - ] + ], + "tpl": "", + "path": "./divider/divider" }, - { + "t-drawer": { "key": "t-drawer", "label": "模态抽屉", "icon": "", "properties": [ - { - "key": "attach", - "type": [ - "String" - ], - "defaultValue": "''", - "desc": "抽屉挂载的节点,默认挂在组件本身的位置。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body", - "label": "" - }, - { - "key": "cancelBtn", - "type": [ - "String", - "Object" - ], - "defaultValue": "''", - "desc": "取消按钮,可自定义。值为 null 则不显示取消按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制取消事件", - "label": "" - }, - { - "key": "closeBtn", - "type": [ - "String", - "Boolean" - ], - "defaultValue": "undefined", - "desc": "关闭按钮,可以自定义。值为 true 显示默认关闭按钮,值为 false 不显示关闭按钮。值类型为 string 则直接显示值,如:“关闭”。值类型为 TNode,则表示呈现自定义按钮示例", - "label": "" - }, - { - "key": "closeOnEscKeydown", - "type": [ - "Boolean" - ], - "defaultValue": "true", - "desc": "按下 ESC 时是否触发抽屉关闭事件", - "label": "" - }, { "key": "closeOnOverlayClick", "type": [ "Boolean" ], - "defaultValue": "true", "desc": "点击蒙层时是否触发抽屉关闭事件", "label": "" }, - { - "key": "confirmBtn", - "type": [ - "String", - "Object" - ], - "defaultValue": "''", - "desc": "确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制确认事件", - "label": "" - }, { "key": "destroyOnClose", "type": [ "Boolean" ], - "defaultValue": "false", "desc": "抽屉关闭时是否销毁节点", "label": "" }, { - "key": "mode", + "key": "items", "type": [ - "String" + "Array" ], - "defaultValue": "overlay", - "desc": "展开方式,有两种:直接展示在内容上方 和 推开内容区域", + "desc": "抽屉里的列表项", "label": "" }, { @@ -1588,52 +1387,22 @@ "type": [ "String" ], - "defaultValue": "right", "desc": "抽屉方向", "label": "" }, - { - "key": "showInAttachedElement", - "type": [ - "Boolean" - ], - "defaultValue": "false", - "desc": "仅在挂载元素中显示抽屉,默认在浏览器可视区域显示。父元素需要有定位属性,如:position: relative", - "label": "" - }, { "key": "showOverlay", "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否显示遮罩层", "label": "" }, - { - "key": "size", - "type": [ - "String" - ], - "defaultValue": "small", - "desc": "尺寸,支持 'small', 'medium', 'large','35px', '30%', '3em' 等。纵向抽屉调整的是抽屉宽度,横向抽屉调整的是抽屉高度", - "label": "" - }, - { - "key": "sizeDraggable", - "type": [ - "Boolean" - ], - "defaultValue": "false", - "desc": "抽屉大小可拖拽调整,横向抽屉调整宽度,纵向抽屉调整高度", - "label": "" - }, { "key": "visible", "type": [ "Boolean" ], - "defaultValue": "false", "desc": "组件是否可见", "label": "" }, @@ -1642,58 +1411,93 @@ "type": [ "Number" ], - "defaultValue": "", "desc": "抽屉层级,样式默认为 1500", "label": "" } ], "events": [ { - "key": "cancel", - "desc": "如果“取消”按钮存在,点击“取消”按钮时触发,同时触发关闭事件", + "key": "close", + "desc": "关闭事件,取消按钮点击时、关闭按钮点击时、点击蒙层时均会触发", "label": "" }, { - "key": "close", - "desc": "关闭事件,取消按钮点击时、关闭按钮点击时、ESC 按下时、点击蒙层时均会触发", + "key": "itemClick", + "desc": "点击抽屉里的列表项", "label": "" }, { - "key": "closeBtnClick", - "desc": "如果关闭按钮存在,点击关闭按钮时触发该事件,同时触发关闭事件", + "key": "overlayClick", + "desc": "如果蒙层存在,点击蒙层时触发", + "label": "" + } + ], + "tpl": "", + "path": "./drawer/drawer" + }, + "t-dropdown-menu": { + "key": "t-dropdown-menu", + "label": "下拉菜单", + "icon": "", + "properties": [ + { + "key": "activeColor", + "type": [ + "String" + ], + "desc": "【讨论中】菜单标题和选项的选中态颜色", "label": "" }, { - "key": "confirm", - "desc": "如果“确认”按钮存在,则点击“确认”按钮时触发", + "key": "closeOnClickOverlay", + "type": [ + "Boolean" + ], + "desc": "是否在点击遮罩层后关闭菜单", "label": "" }, { - "key": "escKeydown", - "desc": "按下 ESC 键时触发", + "key": "duration", + "type": [ + "String", + "Number" + ], + "desc": "动画时长", "label": "" }, { - "key": "overlayClick", - "desc": "如果蒙层存在,点击蒙层时触发", + "key": "overlay", + "type": [ + "Boolean" + ], + "desc": "是否显示遮罩层", + "label": "" + }, + { + "key": "zIndex", + "type": [ + "Number" + ], + "desc": "菜单栏 z-index 层级", "label": "" } ], + "tpl": "", "require": { - "t-popup": "../popup/popup" - } + "t-dropdown-menu": "./dropdown-menu/dropdown-item" + }, + "path": "./dropdown-menu/dropdown-menu" }, - { + "t-empty": { "key": "t-empty", "label": "空状态", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-empty.png", "properties": [ { "key": "action", "type": [ "String" ], - "defaultValue": "", "desc": "操作按钮", "label": "" }, @@ -1702,7 +1506,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "描述文字", "label": "" }, @@ -1711,7 +1514,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "图标名称", "label": "" }, @@ -1720,26 +1522,71 @@ "type": [ "String" ], - "defaultValue": "", "desc": "图片地址", "label": "" } ], - "require": { - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./empty/empty" }, - { + "t-fab": { + "key": "t-fab", + "label": "悬浮按钮", + "icon": "", + "properties": [ + { + "key": "buttonProps", + "type": [ + "Object" + ], + "desc": "透传至 Button 组件", + "label": "" + }, + { + "key": "icon", + "type": [ + "String" + ], + "desc": "图标", + "label": "" + }, + { + "key": "style", + "type": [ + "String" + ], + "desc": "悬浮按钮的样式,常用于调整位置", + "label": "" + }, + { + "key": "text", + "type": [ + "String" + ], + "desc": "文本内容", + "label": "" + } + ], + "events": [ + { + "key": "click", + "desc": "悬浮按钮点击事件", + "label": "" + } + ], + "tpl": "", + "path": "./fab/fab" + }, + "t-footer": { "key": "t-footer", "label": "布局-底部内容", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-footer.png", "properties": [ { "key": "copyright", "type": [ "String" ], - "defaultValue": "''", "desc": "版权信息,type 为`text`生效", "label": "" }, @@ -1748,7 +1595,6 @@ "type": [ "Object" ], - "defaultValue": "", "desc": "图标配置,type 为`logo`生效。`logo.icon` 表示图标链接地址,`logo.title` 表示标题文本,`logo.url` 表示链接跳转地址", "label": "" }, @@ -1757,7 +1603,6 @@ "type": [ "Array" ], - "defaultValue": "[]", "desc": "链接列表,type 为`text`生效。name 表示链接名称, url 表示链接 page 路径,目前只支持小程序内部跳转,openType 表示跳转方式", "label": "" }, @@ -1766,23 +1611,23 @@ "type": [ "String" ], - "defaultValue": "'text'", "desc": "页脚展示类型", "label": "" } - ] + ], + "tpl": "", + "path": "./footer/footer" }, - { + "t-grid-item": { "key": "t-grid-item", "label": "宫格子项", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-grid.png", "properties": [ { "key": "badgeProps", "type": [ "Object" ], - "defaultValue": "", "desc": "头像右上角提示信息,继承 Badge 组件的全部特性。如:小红点,或者数字", "label": "" }, @@ -1791,7 +1636,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "文本以外的更多描述,辅助信息。可以通过 Props 传入文本,也可以自定义标题节点", "label": "" }, @@ -1800,7 +1644,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "图片,可以是图片地址,也可以自定义图片节点", "label": "" }, @@ -1809,7 +1652,6 @@ "type": [ "String" ], - "defaultValue": "navigate-to", "desc": "链接跳转类型", "label": "" }, @@ -1818,7 +1660,6 @@ "type": [ "String" ], - "defaultValue": "vertical", "desc": "内容布局方式", "label": "" }, @@ -1827,7 +1668,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "文本,可以通过 Props 传入文本,也可以自定义标题节点", "label": "" }, @@ -1836,26 +1676,23 @@ "type": [ "String" ], - "defaultValue": "", "desc": "点击后的跳转链接", "label": "" } ], - "require": { - "t-image": "../image/image" - } + "tpl": "", + "path": "./grid/grid-item" }, - { + "t-grid": { "key": "t-grid", "label": "栅格", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-grid.png", "properties": [ { "key": "align", "type": [ "String" ], - "defaultValue": "center", "desc": "内容对齐方式", "label": "" }, @@ -1865,7 +1702,6 @@ "Boolean", "Object" ], - "defaultValue": "false", "desc": "边框,默认不显示。值为 true 则显示默认边框,值类型为 object 则表示自定义边框样式", "label": "" }, @@ -1874,7 +1710,6 @@ "type": [ "Number" ], - "defaultValue": "4", "desc": "每一行的列数量", "label": "" }, @@ -1883,196 +1718,84 @@ "type": [ "Number" ], - "defaultValue": "", - "desc": "间隔大小", - "label": "" - }, - { - "key": "hover", - "type": [ - "Boolean" - ], - "defaultValue": "false", - "desc": "是否开启点击反馈", - "label": "" - } - ] - }, - { - "key": "t-icon-svg", - "label": "图标(IconSVG)", - "icon": "", - "properties": [ - { - "key": "name", - "type": [ - "String" - ], - "defaultValue": "", - "desc": "图标名称", - "label": "" - }, - { - "key": "size", - "type": [ - "String" - ], - "defaultValue": "undefined", - "desc": "图标尺寸,支持 'small', 'medium', 'large','35px', '3em' 等", - "label": "" - }, - { - "key": "style", - "type": [ - "String" - ], - "defaultValue": "", - "desc": "可用于设置图标颜色,如:style=\"color: red\"", - "label": "" - }, - { - "key": "url", - "type": [ - "String", - "Array" - ], - "defaultValue": "", - "desc": "图标地址,地址内容参考[组件内部默认加载图标](https://tdesign.gtimg.com/icon/web/index.js)", - "label": "" - } - ], - "events": [ - { - "key": "click", - "desc": "点击时触发", - "label": "" - } - ] - }, - { - "key": "t-icon", - "label": "图标", - "icon": "", - "properties": [ - { - "key": "classPrefix", - "type": [ - "String" - ], - "defaultValue": "", - "desc": "自定义icon前缀", - "label": "" - }, - { - "key": "color", - "type": [ - "String" - ], - "defaultValue": "", - "desc": "图标颜色", - "label": "" - }, - { - "key": "customStyle", - "type": [ - "String" - ], - "defaultValue": "", - "desc": "自定义样式", - "label": "" - }, - { - "key": "name", - "type": [ - "String" - ], - "defaultValue": "", - "desc": "图标名称", + "desc": "间隔大小", "label": "" }, { - "key": "size", + "key": "hover", "type": [ - "String", - "Number" + "Boolean" ], - "defaultValue": "", - "desc": "图标名称", + "desc": "是否开启点击反馈", "label": "" } - ] + ], + "tpl": "", + "require": { + "t-grid-item": "./grid/grid-item" + }, + "path": "./grid/grid" }, - { - "key": "t-iconfont", - "label": "图标(Iconfont)", - "icon": "", + "t-icon": { + "key": "t-icon", + "label": "图标", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-icon.png", "properties": [ { - "key": "name", + "key": "classPrefix", "type": [ "String" ], - "defaultValue": "", - "desc": "图标名称", + "desc": "自定义icon前缀", "label": "" }, { - "key": "size", + "key": "color", "type": [ "String" ], - "defaultValue": "undefined", - "desc": "图标尺寸,支持 'small', 'medium', 'large','35px', '3em' 等", + "desc": "图标颜色", "label": "" }, { - "key": "style", + "key": "customStyle", "type": [ "String" ], - "defaultValue": "", - "desc": "可用于设置图标颜色,如:style=\"color: red\"", + "desc": "自定义样式", "label": "" }, { - "key": "tag", + "key": "name", "type": [ "String" ], - "defaultValue": "i", - "desc": "图标 DOM 元素,可选值:i/span/div/...", + "desc": "图标名称", "label": "" }, { - "key": "url", + "key": "size", "type": [ "String", - "Array" + "Number" ], - "defaultValue": "", - "desc": "图标地址,地址内容参考[组件内部默认加载图标](https://tdesign.gtimg.com/icon/web/index.css)。也可以在 index.html 中引入图标地址", + "desc": "图标名称", "label": "" } ], - "events": [ - { - "key": "click", - "desc": "点击时触发", - "label": "" - } - ] + "tpl": "", + "path": "./icon/icon" }, - { + "t-image": { "key": "t-image", "label": "图片", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-image.png", "properties": [ { "key": "error", "type": [ "String" ], - "defaultValue": "'default'", "desc": "加载失败时显示的内容。值为 `default` 则表示使用默认加载失败风格;值为空或者 `slot` 表示使用插槽渲染,插槽名称为 `error`;值为其他则表示普通文本内容,如“加载失败”", "label": "" }, @@ -2081,7 +1804,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否开启图片懒加载", "label": "" }, @@ -2090,7 +1812,6 @@ "type": [ "String" ], - "defaultValue": "'default'", "desc": "加载态内容。值为 `default` 则表示使用默认加载中风格;值为空或者 `slot` 表示使用插槽渲染,插槽名称为 `loading`;值为其他则表示普通文本内容,如“加载中”", "label": "" }, @@ -2099,7 +1820,6 @@ "type": [ "String" ], - "defaultValue": "square", "desc": "图片圆角类型", "label": "" }, @@ -2108,7 +1828,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "图片链接", "label": "" } @@ -2125,22 +1844,19 @@ "label": "" } ], - "require": { - "t-loading": "../loading/loading", - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./image/image" }, - { + "t-indexes": { "key": "t-indexes", "label": "索引", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-indexes.png", "properties": [ { "key": "height", "type": [ "Number" ], - "defaultValue": "", "desc": "列表高度,未设置默认占满设备高度", "label": "" }, @@ -2149,8 +1865,7 @@ "type": [ "Array" ], - "defaultValue": "[]", - "desc": "索引列表的列表数据。每个元素包含三个字元素,index(string):索引值,例如1,2,3,...或A,B,C等;title(string): 索引标题,可不填将默认设为索引值;children(Array<{title: string}>): 子元素列表,title为子元素的展示文案。", + "desc": "索引列表的列表数据。每个元素包含三个子元素,index(string):索引值,例如1,2,3,...或A,B,C等;title(string): 索引标题,可不填将默认设为索引值;children(Array<{title: string}>): 子元素列表,title为子元素的展示文案。", "label": "" } ], @@ -2161,23 +1876,19 @@ "label": "" } ], - "require": { - "t-icon": "../icon/icon", - "t-cell": "../cell/cell", - "t-cell-group": "../cell-group/cell-group" - } + "tpl": "", + "path": "./indexes/indexes" }, - { + "t-input": { "key": "t-input", "label": "输入框", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-input.png", "properties": [ { "key": "adjustPosition", "type": [ "Boolean" ], - "defaultValue": "true", "desc": "键盘弹起时,是否自动上推页面", "label": "" }, @@ -2186,7 +1897,6 @@ "type": [ "String" ], - "defaultValue": "left", "desc": "文本内容位置,居左/居中/居右", "label": "" }, @@ -2195,8 +1905,7 @@ "type": [ "Boolean" ], - "defaultValue": "false", - "desc": "【开发中】是否开启无边框模式", + "desc": "【讨论中】是否开启无边框模式", "label": "" }, { @@ -2204,7 +1913,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否可清空", "label": "" }, @@ -2213,7 +1921,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "点击键盘右下角按钮时是否保持键盘不收起点", "label": "" }, @@ -2222,7 +1929,6 @@ "type": [ "String" ], - "defaultValue": "done", "desc": "设置键盘右下角按钮的文字,仅在 type='text'时生效", "label": "" }, @@ -2231,7 +1937,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否禁用输入框", "label": "" }, @@ -2240,8 +1945,7 @@ "type": [ "String" ], - "defaultValue": "", - "desc": "错误提示文本,值为空不显示", + "desc": "错误提示文本,值为空不显示(废弃属性,如果需要,请更为使用 status 和 tips)", "label": "" }, { @@ -2249,16 +1953,22 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "自动聚焦", "label": "" }, + { + "key": "format", + "type": [ + "String" + ], + "desc": "【开发中】指定输入框展示值的格式", + "label": "" + }, { "key": "label", "type": [ "String" ], - "defaultValue": "", "desc": "左侧文本", "label": "" }, @@ -2267,7 +1977,6 @@ "type": [ "Number" ], - "defaultValue": "", "desc": "用户最多可以输入的字符个数,一个中文汉字表示两个字符长度。`maxcharacter` 和 `maxlength` 二选一使用", "label": "" }, @@ -2276,7 +1985,6 @@ "type": [ "Number" ], - "defaultValue": "", "desc": "用户最多可以输入的文本长度,一个中文等于一个计数长度。值小于等于 0 的时候,则表示不限制输入长度。`maxcharacter` 和 `maxlength` 二选一使用", "label": "" }, @@ -2285,7 +1993,6 @@ "type": [ "String" ], - "defaultValue": "undefined", "desc": "占位符", "label": "" }, @@ -2294,25 +2001,38 @@ "type": [ "String" ], - "defaultValue": "", "desc": "组件前置图标,值为字符串则表示图标名称", "label": "" }, + { + "key": "readonly", + "type": [ + "Boolean" + ], + "desc": "只读状态", + "label": "" + }, { "key": "size", "type": [ "String" ], - "defaultValue": "small", "desc": "输入框尺寸", "label": "" }, + { + "key": "status", + "type": [ + "String" + ], + "desc": "输入框状态", + "label": "" + }, { "key": "suffix", "type": [ "String" ], - "defaultValue": "", "desc": "后置图标前的后置内容", "label": "" }, @@ -2321,16 +2041,22 @@ "type": [ "String" ], - "defaultValue": "", "desc": "后置文本内容,值为字符串则表示图标名称", "label": "" }, + { + "key": "tips", + "type": [ + "String" + ], + "desc": "输入框下方提示文本,会根据不同的 `status` 呈现不同的样式", + "label": "" + }, { "key": "type", "type": [ "String" ], - "defaultValue": "text", "desc": "输入框类型", "label": "" }, @@ -2340,7 +2066,6 @@ "String", "Number" ], - "defaultValue": "", "desc": "输入框的值", "label": "" } @@ -2372,22 +2097,19 @@ "label": "" } ], - "require": { - "t-cell": "../cell/cell", - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./input/input" }, - { + "t-loading": { "key": "t-loading", "label": "加载中", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-loading.png", "properties": [ { "key": "delay", "type": [ "Number" ], - "defaultValue": "0", "desc": "延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒", "label": "" }, @@ -2396,7 +2118,6 @@ "type": [ "Number" ], - "defaultValue": "800", "desc": "加载动画执行完成一次的时间,单位:毫秒", "label": "" }, @@ -2405,7 +2126,6 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否显示加载指示符", "label": "" }, @@ -2414,7 +2134,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否继承父元素颜色", "label": "" }, @@ -2423,7 +2142,6 @@ "type": [ "String" ], - "defaultValue": "horizontal", "desc": "对齐方式", "label": "" }, @@ -2432,7 +2150,6 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否处于加载状态", "label": "" }, @@ -2441,7 +2158,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否暂停动画", "label": "" }, @@ -2450,7 +2166,6 @@ "type": [ "Number" ], - "defaultValue": "", "desc": "加载进度", "label": "" }, @@ -2459,7 +2174,6 @@ "type": [ "Boolean" ], - "defaultValue": "", "desc": "加载动画是否反向", "label": "" }, @@ -2468,7 +2182,6 @@ "type": [ "String" ], - "defaultValue": "'40rpx'", "desc": "尺寸,示例:40rpx/20px", "label": "" }, @@ -2477,7 +2190,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "加载提示文案", "label": "" }, @@ -2486,23 +2198,23 @@ "type": [ "String" ], - "defaultValue": "circular", "desc": "加载组件类型", "label": "" } - ] + ], + "tpl": "", + "path": "./loading/loading" }, - { + "t-message": { "key": "t-message", "label": "全局提醒", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-message.png", "properties": [ { "key": "action", "type": [ "String" ], - "defaultValue": "", "desc": "操作", "label": "" }, @@ -2511,7 +2223,6 @@ "type": [ "String" ], - "defaultValue": "left", "desc": "文本对齐方式", "label": "" }, @@ -2521,7 +2232,6 @@ "String", "Boolean" ], - "defaultValue": "undefined", "desc": "关闭按钮,可以自定义。值为 true 显示默认关闭按钮,值为 false 不显示关闭按钮。值类型为 string 则直接显示值,如:“关闭”。也可以完全自定义按钮", "label": "" }, @@ -2530,7 +2240,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "用于自定义消息弹出内容", "label": "" }, @@ -2539,7 +2248,6 @@ "type": [ "Number" ], - "defaultValue": "3000", "desc": "消息内置计时器,计时到达时会触发 duration-end 事件。单位:毫秒。值为 0 则表示没有计时器。", "label": "" }, @@ -2549,7 +2257,6 @@ "String", "Boolean" ], - "defaultValue": "true", "desc": "消息提醒前面的图标。值为 true 则根据 theme 显示对应的图标,值为 false 则不显示图标。值为 'info' 或 'bell' 则显示组件内置图标。也可以完全自定义图标节点", "label": "" }, @@ -2559,7 +2266,6 @@ "Boolean", "Object" ], - "defaultValue": "false", "desc": "跑马灯效果。speed 指速度控制;loop 指循环播放次数,值为 -1 表示循环播放,值为 0 表示不循环播放;delay 表示延迟多久开始播放", "label": "" }, @@ -2568,7 +2274,6 @@ "type": [ "Array" ], - "defaultValue": "", "desc": "相对于 placement 的偏移量,示例:[-10, 20] 或 ['10rpx', '8rpx']", "label": "" }, @@ -2577,7 +2282,6 @@ "type": [ "String" ], - "defaultValue": "info", "desc": "消息组件风格", "label": "" }, @@ -2586,7 +2290,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否显示,隐藏时默认销毁组件", "label": "" }, @@ -2595,7 +2298,6 @@ "type": [ "Number" ], - "defaultValue": "", "desc": "元素层级,样式默认为 5000", "label": "" } @@ -2617,22 +2319,19 @@ "label": "" } ], - "require": { - "t-icon": "../icon/icon", - "t-button": "../button/button" - } + "tpl": "", + "path": "./message/message" }, - { + "t-navbar": { "key": "t-navbar", "label": "导航条", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-navbar.png", "properties": [ { "key": "animation", "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否添加动画效果", "label": "" }, @@ -2641,7 +2340,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "背景", "label": "" }, @@ -2650,7 +2348,6 @@ "type": [ "Number" ], - "defaultValue": "1", "desc": "后退按钮后退层数,含义参考 [wx.navigateBack](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html),特殊的,传入 0 不会发生执行 wx.navigateBack,只会触发一个 goback 事件供自行处理。", "label": "" }, @@ -2659,7 +2356,6 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否固定在顶部", "label": "" }, @@ -2668,7 +2364,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "首页图标地址。值为 '' 或者 undefiend 则表示不显示返回图标,值为 'circle' 表示显示默认图标,值为 'slot' 表示使用插槽渲染,值为其他则表示图标地址", "label": "" }, @@ -2677,7 +2372,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "左侧图标地址,值为 '' 或者 undefiend 则表示不显示返回图标,值为 'arrow-left' 表示显示返回图标,值为 'slot' 表示使用插槽渲染,值为其他则表示图标地址", "label": "" }, @@ -2686,7 +2380,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "页面标题", "label": "" }, @@ -2695,7 +2388,6 @@ "type": [ "Number" ], - "defaultValue": "", "desc": "标题文字最大长度,超出的范围使用 `...` 表示", "label": "" }, @@ -2704,7 +2396,6 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否显示", "label": "" } @@ -2736,21 +2427,19 @@ "label": "" } ], - "require": { - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./navbar/navbar" }, - { + "t-picker-item": { "key": "t-picker-item", "label": "选择器子项", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-picker.png", "properties": [ { "key": "options", "type": [ "Array" ], - "defaultValue": "[]", "desc": "数据源", "label": "" }, @@ -2760,23 +2449,22 @@ "String", "Number" ], - "defaultValue": "", "desc": "默认选中的选项", "label": "" } - ] + ], + "tpl": "" }, - { + "t-picker": { "key": "t-picker", "label": "选择器", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-picker.png", "properties": [ { "key": "cancelBtn", "type": [ "String" ], - "defaultValue": "取消", "desc": "取消按钮文字", "label": "" }, @@ -2785,16 +2473,30 @@ "type": [ "String" ], - "defaultValue": "确认", "desc": "确定按钮文字", "label": "" }, + { + "key": "footer", + "type": [ + "String" + ], + "desc": "底部内容", + "label": "" + }, + { + "key": "header", + "type": [ + "Boolean" + ], + "desc": "头部内容。值为 true 显示空白头部,值为 false 不显示任何内容,值类型为 TNode 表示自定义头部内容", + "label": "" + }, { "key": "title", "type": [ "String" ], - "defaultValue": "''", "desc": "标题", "label": "" }, @@ -2803,7 +2505,6 @@ "type": [ "Array" ], - "defaultValue": "", "desc": "选中值", "label": "" }, @@ -2812,7 +2513,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否显示", "label": "" } @@ -2834,21 +2534,22 @@ "label": "" } ], + "tpl": "", "require": { - "t-popup": "../popup/popup" - } + "t-picker-item": "./picker/picker-item" + }, + "path": "./picker/picker" }, - { + "t-popup": { "key": "t-popup", "label": "气泡框", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-popup.png", "properties": [ { "key": "closeBtn", "type": [ "Boolean" ], - "defaultValue": "", "desc": "关闭按钮,值类型为 Boolean 时表示是否显示关闭按钮。也可以自定义关闭按钮", "label": "" }, @@ -2857,7 +2558,6 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "点击遮罩层是否关闭", "label": "" }, @@ -2866,7 +2566,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "浮层里面的内容", "label": "" }, @@ -2875,7 +2574,6 @@ "type": [ "String" ], - "defaultValue": "top", "desc": "浮层出现位置", "label": "" }, @@ -2884,7 +2582,6 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "防止滚动穿透", "label": "" }, @@ -2893,7 +2590,6 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否显示遮罩层", "label": "" }, @@ -2902,7 +2598,6 @@ "type": [ "Object" ], - "defaultValue": "", "desc": "动画效果定义", "label": "" }, @@ -2911,7 +2606,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否显示浮层", "label": "" }, @@ -2920,7 +2614,6 @@ "type": [ "Number" ], - "defaultValue": "", "desc": "组件层级,Web 侧样式默认为 5500,移动端和小程序样式默认为 1500", "label": "" } @@ -2932,12 +2625,10 @@ "label": "" } ], - "require": { - "t-transition": "../transition/transition", - "t-icon": "../icon/icon" - } + "tpl": "顶部弹出", + "path": "./popup/popup" }, - { + "t-progress": { "key": "t-progress", "label": "进度条", "icon": "", @@ -2949,7 +2640,6 @@ "Object", "Array" ], - "defaultValue": "''", "desc": "进度条颜色。示例:'#ED7B2F' 或 'orange' 或 `['#f00', '#0ff', '#f0f']` 或 `{ '0%': '#f00', '100%': '#0ff' }` 或 `{ from: '#000', to: '#000' }` 等", "label": "" }, @@ -2959,7 +2649,6 @@ "String", "Boolean" ], - "defaultValue": "true", "desc": "进度百分比,可自定义", "label": "" }, @@ -2968,7 +2657,6 @@ "type": [ "Number" ], - "defaultValue": "0", "desc": "进度条百分比", "label": "" }, @@ -2978,7 +2666,6 @@ "String", "Number" ], - "defaultValue": "'medium'", "desc": "进度条尺寸,示例:small/medium/large/240。small 值为 72; medium 值为 112;large 值为 160", "label": "" }, @@ -2987,7 +2674,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "进度条状态", "label": "" }, @@ -2997,7 +2683,6 @@ "String", "Number" ], - "defaultValue": "", "desc": "进度条线宽。宽度数值不能超过 size 的一半,否则不能输出环形进度", "label": "" }, @@ -3006,7 +2691,6 @@ "type": [ "String" ], - "defaultValue": "line", "desc": "进度条风格。值为 line,标签(label)显示在进度条右侧;值为 plump,标签(label)显示在进度条里面;值为 circle,标签(label)显示在进度条正中间", "label": "" }, @@ -3015,24 +2699,25 @@ "type": [ "String" ], - "defaultValue": "''", "desc": "进度条未完成部分颜色", "label": "" } - ] + ], + "tpl": "", + "path": "./progress/progress" }, - { + "t-pull-down-refresh": { "key": "t-pull-down-refresh", "label": "下拉刷新", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-pulldownrefresh.png", "properties": [ { "key": "loadingBarHeight", "type": [ + "String", "Number" ], - "defaultValue": "200", - "desc": "加载中下拉高度", + "desc": "加载中下拉高度,如果值为数字则单位是:'px'", "label": "" }, { @@ -3040,7 +2725,6 @@ "type": [ "Object" ], - "defaultValue": "", "desc": "加载loading样式", "label": "" }, @@ -3049,17 +2733,16 @@ "type": [ "Array" ], - "defaultValue": "[]", "desc": "提示语,组件内部默认值为 ['下拉刷新', '松手刷新', '正在刷新', '刷新完成']", "label": "" }, { "key": "maxBarHeight", "type": [ + "String", "Number" ], - "defaultValue": "272", - "desc": "最大下拉高度", + "desc": "最大下拉高度,如果值为数字则单位是:'px'", "label": "" }, { @@ -3067,12 +2750,24 @@ "type": [ "Number" ], - "defaultValue": "3000", "desc": "刷新超时时间", "label": "" + }, + { + "key": "value", + "type": [ + "Boolean" + ], + "desc": "组件状态,值为 `true` 表示下拉状态,值为 `false` 表示收起状态", + "label": "" } ], "events": [ + { + "key": "change", + "desc": "下拉或收起时触发,用户手势往下滑动触发下拉状态,手势松开触发收起状态", + "label": "" + }, { "key": "refresh", "desc": "结束下拉时触发", @@ -3084,11 +2779,10 @@ "label": "" } ], - "require": { - "t-loading": "../loading/loading" - } + "tpl": "拖拽该区域演示 中间下拉刷新", + "path": "./pull-down-refresh/pull-down-refresh" }, - { + "t-radio-group": { "key": "t-radio-group", "label": "单选框组", "icon": "", @@ -3098,7 +2792,6 @@ "type": [ "Boolean" ], - "defaultValue": "undefined", "desc": "是否禁用全部子单选框", "label": "" }, @@ -3107,7 +2800,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "HTML 元素原生属性", "label": "" }, @@ -3116,7 +2808,6 @@ "type": [ "Array" ], - "defaultValue": "", "desc": "单选组件按钮形式。RadioOption 数据类型为 string 或 number 时,表示 label 和 value 值相同", "label": "" }, @@ -3127,7 +2818,6 @@ "Number", "Boolean" ], - "defaultValue": "false", "desc": "选中的值", "label": "" } @@ -3139,21 +2829,22 @@ "label": "" } ], + "tpl": "", "require": { - "t-radio": "../radio/radio" - } + "t-radio": "./radio/radio" + }, + "path": "./radio-group/radio-group" }, - { + "t-radio": { "key": "t-radio", "label": "单选框", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-radio.png", "properties": [ { "key": "align", "type": [ "String" ], - "defaultValue": "left", "desc": "复选框和内容相对位置", "label": "" }, @@ -3162,7 +2853,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否允许取消选中", "label": "" }, @@ -3171,7 +2861,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否选中", "label": "" }, @@ -3180,7 +2869,6 @@ "type": [ "String" ], - "defaultValue": "#0052d9", "desc": "单选按钮颜色", "label": "" }, @@ -3189,7 +2877,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "单选内容", "label": "" }, @@ -3198,7 +2885,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否禁用组件内容(content)触发选中", "label": "" }, @@ -3207,7 +2893,6 @@ "type": [ "Boolean" ], - "defaultValue": "undefined", "desc": "是否为禁用态", "label": "" }, @@ -3217,7 +2902,6 @@ "String", "Array" ], - "defaultValue": "'fill-circle'", "desc": "自定义选中图标和非选中图标。示例:[选中态图标,非选中态图标]。值为 fill-circle 表示图标为填充型图标,值为 stroke-line 表示图标为描边型图标", "label": "" }, @@ -3226,7 +2910,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "主文案", "label": "" }, @@ -3235,7 +2918,6 @@ "type": [ "Number" ], - "defaultValue": "5", "desc": "内容最大行数限制", "label": "" }, @@ -3244,7 +2926,6 @@ "type": [ "Number" ], - "defaultValue": "3", "desc": "主文案最大行数限制", "label": "" }, @@ -3253,7 +2934,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "HTML 元素原生属性", "label": "" }, @@ -3264,7 +2944,6 @@ "Number", "Boolean" ], - "defaultValue": "false", "desc": "单选按钮的值", "label": "" } @@ -3276,22 +2955,19 @@ "label": "" } ], - "require": { - "t-cell": "../cell/cell", - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./radio/radio" }, - { + "t-rate": { "key": "t-rate", "label": "评分", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-rate.png", "properties": [ { "key": "allowHalf", "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否允许半选", "label": "" }, @@ -3301,8 +2977,7 @@ "String", "Array" ], - "defaultValue": "'#ED7B2F'", - "desc": "评分图标的颜色,样式中默认为 #ED7B2F。一个值表示设置选中高亮的五角星颜色,两个值表示分别设置 选中高亮的五角星颜色 和 未选中暗灰的五角星颜色。示例:['#ED7B2F', '#999999']", + "desc": "评分图标的颜色,样式中默认为 #ED7B2F。一个值表示设置选中高亮的五角星颜色,示例:[选中颜色]。数组则表示分别设置 选中高亮的五角星颜色 和 未选中暗灰的五角星颜色,[选中颜色,未选中颜色]。示例:['#ED7B2F', '#E3E6EB']", "label": "" }, { @@ -3310,7 +2985,6 @@ "type": [ "Number" ], - "defaultValue": "5", "desc": "评分的数量", "label": "" }, @@ -3319,7 +2993,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否禁用评分", "label": "" }, @@ -3328,7 +3001,6 @@ "type": [ "Number" ], - "defaultValue": "6", "desc": "评分图标的间距", "label": "" }, @@ -3337,7 +3009,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否显示对应的辅助文字", "label": "" }, @@ -3346,7 +3017,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "评分图标的大小,示例:`20`", "label": "" }, @@ -3355,7 +3025,6 @@ "type": [ "Array" ], - "defaultValue": "[]", "desc": "评分等级对应的辅助文字。组件内置默认值为:['极差', '失望', '一般', '满意', '惊喜']。自定义值示例:['1分', '2分', '3分', '4分', '5分']", "label": "" }, @@ -3364,7 +3033,6 @@ "type": [ "Number" ], - "defaultValue": "0", "desc": "选择评分的值", "label": "" }, @@ -3373,7 +3041,6 @@ "type": [ "String" ], - "defaultValue": "outline", "desc": "形状类型,有描边类型和填充类型两种", "label": "" } @@ -3385,21 +3052,19 @@ "label": "" } ], - "require": { - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./rate/rate" }, - { + "t-search": { "key": "t-search", "label": "搜索", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-search.png", "properties": [ { "key": "action", "type": [ "String" ], - "defaultValue": "''", "desc": "自定义右侧操作按钮文字", "label": "" }, @@ -3408,7 +3073,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否居中", "label": "" }, @@ -3417,7 +3081,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否禁用", "label": "" }, @@ -3426,7 +3089,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否聚焦", "label": "" }, @@ -3435,7 +3097,6 @@ "type": [ "String" ], - "defaultValue": "''", "desc": "左侧文本", "label": "" }, @@ -3444,7 +3105,6 @@ "type": [ "String" ], - "defaultValue": "'search'", "desc": "左侧图标", "label": "" }, @@ -3453,7 +3113,6 @@ "type": [ "String" ], - "defaultValue": "''", "desc": "占位符", "label": "" }, @@ -3462,7 +3121,6 @@ "type": [ "String" ], - "defaultValue": "'close'", "desc": "右侧图标", "label": "" }, @@ -3471,7 +3129,6 @@ "type": [ "String" ], - "defaultValue": "'square'", "desc": "搜索框形状", "label": "" }, @@ -3480,7 +3137,6 @@ "type": [ "String" ], - "defaultValue": "''", "desc": "值", "label": "" } @@ -3517,21 +3173,19 @@ "label": "" } ], - "require": { - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./search/search" }, - { + "t-segmented-control": { "key": "t-segmented-control", "label": "分段器", "icon": "", "properties": [ { - "key": "list", + "key": "items", "type": [ "Array" ], - "defaultValue": "", "desc": "分段器选项", "label": "" }, @@ -3542,7 +3196,6 @@ "Number", "Array" ], - "defaultValue": "", "desc": "选中值", "label": "" } @@ -3553,19 +3206,20 @@ "desc": "选中值变化时触发", "label": "" } - ] + ], + "tpl": "", + "path": "./segmented-control/segmented-control" }, - { + "t-skeleton": { "key": "t-skeleton", "label": "骨架屏", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-skeleton.png", "properties": [ { "key": "animation", "type": [ "String" ], - "defaultValue": "", "desc": "动画效果,有「渐变加载动画」和「闪烁加载动画」两种。值为空则表示没有动画", "label": "" }, @@ -3574,7 +3228,6 @@ "type": [ "Number" ], - "defaultValue": "0", "desc": "【开发中】延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒", "label": "" }, @@ -3583,7 +3236,6 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否为加载状态,如果是则显示骨架图,如果不是则显示加载完成的内容", "label": "" }, @@ -3592,7 +3244,6 @@ "type": [ "Array" ], - "defaultValue": "[1, 1, 1, { width: '70%' }]", "desc": "用于设置行列数量、宽度高度、间距等。【示例一】,`[1, 1, 2]` 表示输出三行骨架图,第一行一列,第二行一列,第三行两列。【示例二】,`[1, 1, { width: '100px' }]` 表示自定义第三行的宽度为 `100px`。【示例三】,`[1, 2, [{ width, height }, { width, height, marginLeft }]]` 表示第三行有两列,且自定义宽度、高度和间距", "label": "" }, @@ -3601,24 +3252,24 @@ "type": [ "String" ], - "defaultValue": "text", "desc": "骨架图风格,有基础、头像组合等两大类", "label": "" } - ] + ], + "tpl": "", + "path": "./skeleton/skeleton" }, - { + "t-slider": { "key": "t-slider", "label": "滑块", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-slider.png", "properties": [ { "key": "colors", "type": [ "Array" ], - "defaultValue": "['#0052D9', 'rgba(220, 220, 220, 1)']", - "desc": "颜色(已选择&未选择)", + "desc": "颜色,[已选择, 未选择]", "label": "" }, { @@ -3626,7 +3277,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否禁用组件", "label": "" }, @@ -3635,8 +3285,7 @@ "type": [ "Array" ], - "defaultValue": "['#bbd3fb', '#dcdcdc']", - "desc": "禁用状态滑动条的颜色(已选、未选)", + "desc": "禁用状态滑动条的颜色,[已选, 未选]", "label": "" }, { @@ -3645,7 +3294,6 @@ "String", "Boolean" ], - "defaultValue": "false", "desc": "滑块当前值文本。
值为 true 显示默认文案;值为 false 不显示滑块当前值文本;
值为 `${value}%` 则表示组件会根据占位符渲染文案;
值类型为函数时,参数 `value` 标识滑块值,参数 `position=start` 表示范围滑块的起始值,参数 `position=end` 表示范围滑块的终点值", "label": "" }, @@ -3655,7 +3303,6 @@ "Object", "Array" ], - "defaultValue": "{}", "desc": "刻度标记,示例:`[0, 10, 40, 200]` 或者 `{ 5: '5¥', 10: '10%' }`", "label": "" }, @@ -3664,7 +3311,6 @@ "type": [ "Number" ], - "defaultValue": "100", "desc": "滑块范围最大值", "label": "" }, @@ -3673,7 +3319,6 @@ "type": [ "Number" ], - "defaultValue": "0", "desc": "滑块范围最小值", "label": "" }, @@ -3682,7 +3327,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "双游标滑块", "label": "" }, @@ -3691,7 +3335,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否边界值", "label": "" }, @@ -3700,7 +3343,6 @@ "type": [ "Number" ], - "defaultValue": "1", "desc": "步长", "label": "" }, @@ -3710,7 +3352,6 @@ "Number", "Array" ], - "defaultValue": "", "desc": "滑块值", "label": "" } @@ -3720,20 +3361,31 @@ "key": "change", "desc": "滑块值变化时触发", "label": "" + }, + { + "key": "dragend", + "desc": "结束拖动时触发", + "label": "" + }, + { + "key": "dragstart", + "desc": "开始拖动时触发", + "label": "" } - ] + ], + "tpl": "", + "path": "./slider/slider" }, - { + "t-step-item": { "key": "t-step-item", "label": "步骤", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-steps.png", "properties": [ { "key": "content", "type": [ "String" ], - "defaultValue": "''", "desc": "步骤描述", "label": "" }, @@ -3742,7 +3394,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "图标。传入 slot 代表使用插槽,其他字符串代表使用内置图标", "label": "" }, @@ -3751,35 +3402,39 @@ "type": [ "String" ], - "defaultValue": "default", "desc": "当前步骤的状态", "label": "" }, + { + "key": "subStepItems", + "type": [ + "Array" + ], + "desc": "子步骤条,仅支持 layout = 'vertical' 时", + "label": "" + }, { "key": "title", "type": [ "String" ], - "defaultValue": "''", "desc": "标题", "label": "" } ], - "require": { - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./steps/step-item" }, - { + "t-stepper": { "key": "t-stepper", "label": "步进器", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-stepper.png", "properties": [ { "key": "disabled", "type": [ "Boolean" ], - "defaultValue": "false", "desc": "禁用全部操作", "label": "" }, @@ -3788,7 +3443,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "禁用输入框", "label": "" }, @@ -3797,7 +3451,6 @@ "type": [ "Number" ], - "defaultValue": "", "desc": "输入框宽度", "label": "" }, @@ -3806,7 +3459,6 @@ "type": [ "Number" ], - "defaultValue": "100", "desc": "最大值", "label": "" }, @@ -3815,7 +3467,6 @@ "type": [ "Number" ], - "defaultValue": "0", "desc": "最小值", "label": "" }, @@ -3824,7 +3475,6 @@ "type": [ "Number" ], - "defaultValue": "1", "desc": "步长", "label": "" }, @@ -3833,7 +3483,6 @@ "type": [ "String" ], - "defaultValue": "normal", "desc": "组件风格", "label": "" }, @@ -3843,7 +3492,6 @@ "String", "Number" ], - "defaultValue": "0", "desc": "值", "label": "" } @@ -3865,15 +3513,13 @@ "label": "" } ], - "require": { - "t-cell": "../cell/cell", - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./stepper/stepper" }, - { + "t-steps": { "key": "t-steps", "label": "步骤条", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-steps.png", "properties": [ { "key": "current", @@ -3881,16 +3527,22 @@ "String", "Number" ], - "defaultValue": "0", "desc": "当前步骤,即整个步骤条进度。默认根据步骤下标判断步骤的完成状态,当前步骤为进行中,当前步骤之前的步骤为已完成,当前步骤之后的步骤为未开始。如果每个步骤没有设置 value,current 值为步骤长度则表示所有步骤已完成。如果每个步骤设置了自定义 value,则 current = 'FINISH' 表示所有状态完成", "label": "" }, + { + "key": "currentStatus", + "type": [ + "String" + ], + "desc": "用于控制 current 指向的步骤条的状态", + "label": "" + }, { "key": "layout", "type": [ "String" ], - "defaultValue": "horizontal", "desc": "步骤条方向,有两种:横向和纵向", "label": "" }, @@ -3899,7 +3551,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "只读状态", "label": "" }, @@ -3908,7 +3559,6 @@ "type": [ "String" ], - "defaultValue": "default", "desc": "步骤条风格", "label": "" } @@ -3920,21 +3570,22 @@ "label": "" } ], + "tpl": "", "require": { - "t-step": "./step-item" - } + "t-step-item": "./steps/step-item" + }, + "path": "./steps/steps" }, - { + "t-sticky": { "key": "t-sticky", "label": "吸顶容器", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-sticky.png", "properties": [ { "key": "container", "type": [ "String" ], - "defaultValue": "", "desc": "函数返回容器对应的 NodesRef 节点,将对应节点指定为组件的外部容器,滚动时组件会始终保持在容器范围内,当组件即将超出容器底部时,会返回原位置。", "label": "" }, @@ -3943,7 +3594,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否禁用组件", "label": "" }, @@ -3953,7 +3603,6 @@ "String", "Number" ], - "defaultValue": "0", "desc": "吸顶时与顶部的距离,单位`px`", "label": "" }, @@ -3962,7 +3611,6 @@ "type": [ "Number" ], - "defaultValue": "99", "desc": "吸顶时的 z-index", "label": "" } @@ -3973,19 +3621,20 @@ "desc": "滚动时触发,scrollTop: 距离顶部位置,isFixed: 是否吸顶", "label": "" } - ] + ], + "tpl": "", + "path": "./sticky/sticky" }, - { + "t-swipe-cell": { "key": "t-swipe-cell", "label": "滑动操作", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-swipecell.png", "properties": [ { "key": "disabled", "type": [ "Boolean" ], - "defaultValue": "", "desc": "是否禁用滑动", "label": "" }, @@ -3994,7 +3643,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "操作项是否呈现为打开态", "label": "" }, @@ -4003,7 +3651,6 @@ "type": [ "Array" ], - "defaultValue": "", "desc": "左侧滑动操作项。所有行为同 `right`", "label": "" }, @@ -4012,7 +3659,6 @@ "type": [ "Array" ], - "defaultValue": "", "desc": "右侧滑动操作项。有两种定义方式,一种是使用数组,二种是使用插槽。`right.text` 表示操作文本,`right.className` 表示操作项类名,`right.style` 表示操作项样式,`right.onClick` 表示点击操作项后执行的回调函数。示例:`[{ text: '删除', style: 'background-color: red', onClick: () => {} }]`", "label": "" } @@ -4023,19 +3669,23 @@ "desc": "操作项点击时触发(插槽写法组件不触发,业务侧自定义内容和事件)", "label": "" } - ] + ], + "tpl": "删除", + "require": { + "t-cell": "./cell/cell" + }, + "path": "./swipe-cell/swipe-cell" }, - { + "t-swiper": { "key": "t-swiper", "label": "轮播", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-swiper.png", "properties": [ { "key": "animation", "type": [ "String" ], - "defaultValue": "slide", "desc": "轮播切换动画效果类型", "label": "" }, @@ -4044,7 +3694,6 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否自动播放", "label": "" }, @@ -4053,7 +3702,6 @@ "type": [ "Number" ], - "defaultValue": "0", "desc": "当前轮播在哪一项(下标)", "label": "" }, @@ -4062,7 +3710,6 @@ "type": [ "String" ], - "defaultValue": "horizontal", "desc": "轮播滑动方向,包括横向滑动和纵向滑动两个方向", "label": "" }, @@ -4071,7 +3718,6 @@ "type": [ "Number" ], - "defaultValue": "300", "desc": "滑动动画时长", "label": "" }, @@ -4080,7 +3726,6 @@ "type": [ "Number" ], - "defaultValue": "", "desc": "当使用垂直方向滚动时的高度", "label": "" }, @@ -4089,7 +3734,6 @@ "type": [ "Number" ], - "defaultValue": "5000", "desc": "轮播间隔时间", "label": "" }, @@ -4098,7 +3742,6 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否循环播放", "label": "" }, @@ -4107,7 +3750,6 @@ "type": [ "Object" ], - "defaultValue": "", "desc": "导航器全部配置", "label": "" } @@ -4119,22 +3761,22 @@ "label": "" } ], + "tpl": "", "require": { - "t-swiper-item": "./swiper-item", - "t-swiper-nav": "./swiper-nav" - } + "t-swiper-item": "./swiper/swiper-item" + }, + "path": "./swiper/swiper" }, - { + "t-switch": { "key": "t-switch", "label": "开关", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-switch.png", "properties": [ { "key": "colors", "type": [ "Array" ], - "defaultValue": "", "desc": "自定义颜色,[打开时的颜色,关闭时的颜色]。组件默认颜色为 ['#0052d9', 'rgba(0, 0, 0, .26']。示例:[blue, gray]", "label": "" }, @@ -4143,7 +3785,6 @@ "type": [ "Array" ], - "defaultValue": "", "desc": "开关内容,[打开时的值,关闭时的值]。默认为 [true, false]。示例:[1, 0]", "label": "" }, @@ -4152,7 +3793,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否禁用组件", "label": "" }, @@ -4161,7 +3801,6 @@ "type": [ "String" ], - "defaultValue": "''", "desc": "开关的标签", "label": "" }, @@ -4170,7 +3809,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否处于加载中状态", "label": "" }, @@ -4179,7 +3817,6 @@ "type": [ "String" ], - "defaultValue": "medium", "desc": "开关尺寸", "label": "" }, @@ -4190,7 +3827,6 @@ "Number", "Boolean" ], - "defaultValue": "undefined", "desc": "开关值", "label": "" } @@ -4201,19 +3837,20 @@ "desc": "数据发生变化时触发", "label": "" } - ] + ], + "tpl": "", + "path": "./switch/switch" }, - { + "t-tab-bar-item": { "key": "t-tab-bar-item", "label": "标签栏选项", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-tabbar.png", "properties": [ { "key": "badgeProps", "type": [ "Object" ], - "defaultValue": "", "desc": "图标右上角提示信息", "label": "" }, @@ -4222,7 +3859,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "图标名称", "label": "" }, @@ -4231,7 +3867,6 @@ "type": [ "Array" ], - "defaultValue": "", "desc": "二级菜单", "label": "" }, @@ -4241,27 +3876,23 @@ "String", "Number" ], - "defaultValue": "", "desc": "标识符", "label": "" } ], - "require": { - "t-icon": "../icon/icon", - "t-badge": "../badge/badge" - } + "tpl": "{{item.label}}", + "path": "./tab-bar/tab-bar-item" }, - { + "t-tab-bar": { "key": "t-tab-bar", "label": "标签栏", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-tabbar.png", "properties": [ { "key": "bordered", "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否显示外边框", "label": "" }, @@ -4270,7 +3901,6 @@ "type": [ "Array" ], - "defaultValue": "['#0052D9', 'rgba(0, 0, 0, .6)']", "desc": "标签颜色设置。示例:[选中标签的颜色, 未选中的标签颜色]", "label": "" }, @@ -4279,7 +3909,6 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否固定在底部", "label": "" }, @@ -4288,7 +3917,6 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否为 iPhoneX 留出底部安全距离", "label": "" }, @@ -4297,7 +3925,6 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否需要分割线", "label": "" }, @@ -4308,7 +3935,6 @@ "Number", "Array" ], - "defaultValue": "undefined", "desc": "当前选中标签的索引", "label": "" } @@ -4320,21 +3946,22 @@ "label": "" } ], + "tpl": "{{item.label}}", "require": { - "t-tab-bar-item": "./tab-bar-item" - } + "t-tab-bar-item": "./tab-bar/tab-bar-item" + }, + "path": "./tab-bar/tab-bar" }, - { + "t-tab-panel": { "key": "t-tab-panel", "label": "选项卡面板", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-tabs.png", "properties": [ { "key": "destroyOnHide", "type": [ "Boolean" ], - "defaultValue": "true", "desc": "选项卡内容隐藏时是否销毁", "label": "" }, @@ -4343,7 +3970,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否禁用当前选项卡", "label": "" }, @@ -4352,7 +3978,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "选项卡名称,可自定义选项卡导航内容", "label": "" }, @@ -4361,7 +3986,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "用于自定义选项卡面板内容", "label": "" }, @@ -4371,23 +3995,23 @@ "String", "Number" ], - "defaultValue": "", "desc": "选项卡的值,唯一标识", "label": "" } - ] + ], + "tpl": "标签一内容", + "path": "./tabs/tab-panel" }, - { + "t-tabs": { "key": "t-tabs", "label": "选项卡", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-tabs.png", "properties": [ { "key": "animation", "type": [ "Object" ], - "defaultValue": "", "desc": "动画效果设置。其中 duration 表示动画时长", "label": "" }, @@ -4396,7 +4020,6 @@ "type": [ "String" ], - "defaultValue": "top", "desc": "选项卡位置", "label": "" }, @@ -4405,17 +4028,23 @@ "type": [ "Boolean" ], - "defaultValue": "true", "desc": "是否展示底部激活线条", "label": "" }, + { + "key": "stickyProps", + "type": [ + "Object" + ], + "desc": "是否支持吸顶", + "label": "" + }, { "key": "value", "type": [ "String", "Number" ], - "defaultValue": "", "desc": "激活的选项卡值", "label": "" } @@ -4426,19 +4055,23 @@ "desc": "激活的选项卡发生变化时触发", "label": "" } - ] + ], + "tpl": "标签一内容标签二内容", + "require": { + "t-tab-panel": "./tabs/tab-panel" + }, + "path": "./tabs/tabs" }, - { + "t-tag": { "key": "t-tag", "label": "标签", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-tag.png", "properties": [ { "key": "closable", "type": [ "Boolean" ], - "defaultValue": "false", "desc": "标签是否可关闭", "label": "" }, @@ -4447,7 +4080,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态", "label": "" }, @@ -4456,7 +4088,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "标签中的图标,可自定义图标呈现", "label": "" }, @@ -4466,7 +4097,6 @@ "String", "Number" ], - "defaultValue": "", "desc": "标签最大宽度,宽度超出后会出现省略号。示例:'50px' / 80", "label": "" }, @@ -4475,7 +4105,6 @@ "type": [ "String" ], - "defaultValue": "square", "desc": "标签类型,有三种:方形、圆角方形、标记型", "label": "" }, @@ -4484,7 +4113,6 @@ "type": [ "String" ], - "defaultValue": "medium", "desc": "标签尺寸", "label": "" }, @@ -4493,7 +4121,6 @@ "type": [ "String" ], - "defaultValue": "default", "desc": "组件风格,用于描述组件不同的应用场景", "label": "" }, @@ -4502,7 +4129,6 @@ "type": [ "String" ], - "defaultValue": "dark", "desc": "标签风格变体", "label": "" } @@ -4519,21 +4145,19 @@ "label": "" } ], - "require": { - "t-icon": ".././icon/icon" - } + "tpl": "重要", + "path": "./tag/tag" }, - { + "t-textarea": { "key": "t-textarea", "label": "文本输入框", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-textarea.png", "properties": [ { "key": "adjustPosition", "type": [ "Boolean" ], - "defaultValue": "true", "desc": "键盘弹起时,是否自动上推页面", "label": "" }, @@ -4542,7 +4166,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "自动聚焦,拉起键盘", "label": "" }, @@ -4551,7 +4174,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否自动增高,值为 autosize 时,style.height 不生效", "label": "" }, @@ -4560,7 +4182,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "点击键盘右下角按钮时是否保持键盘不收起点", "label": "" }, @@ -4569,7 +4190,6 @@ "type": [ "String" ], - "defaultValue": "done", "desc": "设置键盘右下角按钮的文字,仅在 type='text'时生效", "label": "" }, @@ -4578,7 +4198,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否禁用文本框", "label": "" }, @@ -4587,7 +4206,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "自动聚焦", "label": "" }, @@ -4596,7 +4214,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "左侧文本", "label": "" }, @@ -4605,7 +4222,6 @@ "type": [ "Number" ], - "defaultValue": "", "desc": "用户最多可以输入的字符个数,一个中文汉字表示两个字符长度", "label": "" }, @@ -4614,7 +4230,6 @@ "type": [ "Number" ], - "defaultValue": "", "desc": "用户最多可以输入的字符个数", "label": "" }, @@ -4623,7 +4238,6 @@ "type": [ "String" ], - "defaultValue": "undefined", "desc": "占位符", "label": "" }, @@ -4632,7 +4246,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "文本框值", "label": "" } @@ -4664,22 +4277,19 @@ "label": "" } ], - "require": { - "t-cell": "../cell/cell", - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./textarea/textarea" }, - { + "t-toast": { "key": "t-toast", "label": "轻提示", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-toast.png", "properties": [ { "key": "direction", "type": [ "String" ], - "defaultValue": "row", "desc": "图标排列方式", "label": "" }, @@ -4688,7 +4298,6 @@ "type": [ "Number" ], - "defaultValue": "2000", "desc": "弹窗显示毫秒数", "label": "" }, @@ -4697,7 +4306,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "自定义图标", "label": "" }, @@ -4706,7 +4314,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "弹窗显示文字", "label": "" }, @@ -4715,7 +4322,6 @@ "type": [ "String" ], - "defaultValue": "middle", "desc": "弹窗展示位置", "label": "" }, @@ -4724,7 +4330,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "防止滚动穿透,即不允许点击和滚动", "label": "" }, @@ -4733,17 +4338,14 @@ "type": [ "String" ], - "defaultValue": "", "desc": "提示类型", "label": "" } ], - "require": { - "t-icon": "../icon/icon", - "t-loading": "../loading/loading" - } + "tpl": "", + "path": "./toast/toast" }, - { + "t-transition": { "key": "t-transition", "label": "动画", "icon": "", @@ -4753,7 +4355,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "首次出现是否展示动画", "label": "" }, @@ -4762,7 +4363,6 @@ "type": [ "String" ], - "defaultValue": "''", "desc": "自定义容器类名", "label": "" }, @@ -4771,7 +4371,6 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "隐藏时是否销毁内容", "label": "" }, @@ -4780,7 +4379,6 @@ "type": [ "Number" ], - "defaultValue": "", "desc": "指定过渡时间", "label": "" }, @@ -4789,7 +4387,6 @@ "type": [ "String" ], - "defaultValue": "'t-transition'", "desc": "过渡类名", "label": "" }, @@ -4798,32 +4395,39 @@ "type": [ "Boolean" ], - "defaultValue": "false", "desc": "是否显示", "label": "" } - ] + ], + "tpl": "", + "path": "./transition/transition" }, - { + "t-upload": { "key": "t-upload", "label": "上传", - "icon": "", + "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-upload.png", "properties": [ { "key": "addContent", "type": [ "String" ], - "defaultValue": "", "desc": "添加按钮内容。值为空,使用默认图标渲染;值为 slot 则表示使用插槽渲染;其他值无效。", "label": "" }, + { + "key": "allowUploadDuplicateFile", + "type": [ + "Boolean" + ], + "desc": "是否允许重复上传相同文件名的文件", + "label": "" + }, { "key": "config", "type": [ "Object" ], - "defaultValue": "", "desc": "图片上传配置,视频上传配置,文件上传配置等,包含图片尺寸、图片来源、视频来源、视频拍摄最长时间等。更多细节查看小程序官网。[图片上传](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html)。[视频上传](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseVideo.html)", "label": "" }, @@ -4832,7 +4436,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "删除图标。值为空,使用默认图标渲染;值为 slot 则表示使用插槽渲染;其他值无效。", "label": "" }, @@ -4841,7 +4444,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "【开发中】用于完全自定义文件列表内容", "label": "" }, @@ -4850,7 +4452,6 @@ "type": [ "Array" ], - "defaultValue": "", "desc": "已上传文件列表", "label": "" }, @@ -4859,7 +4460,6 @@ "type": [ "Object" ], - "defaultValue": "", "desc": "upload组件每行上传图片列数以及图片的宽度和高度", "label": "" }, @@ -4868,7 +4468,6 @@ "type": [ "Number" ], - "defaultValue": "16", "desc": "预览窗格的 gutter 大小,单位 rpx", "label": "" }, @@ -4877,7 +4476,6 @@ "type": [ "Object" ], - "defaultValue": "", "desc": "透传 Image 组件全部属性", "label": "" }, @@ -4886,7 +4484,6 @@ "type": [ "Number" ], - "defaultValue": "0", "desc": "用于控制文件上传数量,值为 0 则不限制", "label": "" }, @@ -4895,7 +4492,6 @@ "type": [ "Array" ], - "defaultValue": "['image', 'video']", "desc": "支持上传的文件类型,图片或视频", "label": "" }, @@ -4904,7 +4500,6 @@ "type": [ "String" ], - "defaultValue": "", "desc": "自定义上传方法", "label": "" }, @@ -4914,7 +4509,6 @@ "Number", "Object" ], - "defaultValue": "", "desc": "图片文件大小限制,单位 KB。可选单位有:`'B' | 'KB' | 'MB' | 'GB'`。示例一:`1000`。示例二:`{ size: 2, unit: 'MB', message: '图片大小不超过 {sizeLimit} MB' }`", "label": "" } @@ -4922,7 +4516,7 @@ "events": [ { "key": "add", - "desc": "上传成功后触发,仅包含本次选择的照片;`context.url` 表示选定视频的临时文件路径 (本地路径)。`context.duration` 表示选定视频的时间长度。`context.size`选定视频的数据量大小。更多描述参考 wx.chooseMedia 小程序官网描述", + "desc": "上传成功后触发,仅包含本次选择的照片;`url` 表示选定视频的临时文件路径 (本地路径)。`duration` 表示选定视频的时间长度。`size`选定视频的数据量大小。更多描述参考 wx.chooseMedia 小程序官网描述", "label": "" }, { @@ -4942,23 +4536,19 @@ }, { "key": "selectChange", - "desc": "选择文件或图片之后,上传之前,触发该事件。
`params.value` 表示之前已经上传完成的文件列表。
`params.currentSelectedFiles` 表示本次上传选中的文件列表", + "desc": "选择文件或图片之后,上传之前,触发该事件。
`files` 表示之前已经上传完成的文件列表。
`currentSelectedFiles` 表示本次上传选中的文件列表", "label": "" }, { "key": "success", - "desc": "上传成功后触发,包含所有上传的文件;`context.url` 表示选定视频的临时文件路径 (本地路径)。`context.duration` 表示选定视频的时间长度。`context.size`选定视频的数据量大小。更多描述参考 wx.chooseMedia 小程序官网描述", + "desc": "上传成功后触发,包含所有上传的文件;`url` 表示选定视频的临时文件路径 (本地路径)。`duration` 表示选定视频的时间长度。`size`选定视频的数据量大小。更多描述参考 wx.chooseMedia 小程序官网描述", "label": "" } ], - "require": { - "t-grid": "../grid/grid", - "t-grid-item": "../grid/grid-item", - "t-popup": "../popup/popup", - "t-icon": "../icon/icon" - } + "tpl": "", + "path": "./upload/upload" } - ], + }, "common": { "properties": {}, "events": {} @@ -4982,6 +4572,13 @@ "t-divider" ] }, + { + "key": "subMenu-fab", + "label": "Fab 悬浮按钮", + "components": [ + "t-fab" + ] + }, { "key": "subMenu-icon", "label": "Icon 图标", @@ -4995,6 +4592,13 @@ "key": "menu-nav", "label": "导航", "submenu": [ + { + "key": "subMenu-drawer", + "label": "Drawer 抽屉", + "components": [ + "t-drawer" + ] + }, { "key": "subMenu-indexes", "label": "Indexes 索引", @@ -5147,6 +4751,13 @@ "t-cell" ] }, + { + "key": "subMenu-collapse", + "label": "Collapse 折叠面板", + "components": [ + "t-collapse" + ] + }, { "key": "subMenu-countdown", "label": "CountDown 倒计时", @@ -5154,6 +4765,13 @@ "t-countdown" ] }, + { + "key": "subMenu-dropdown-menu", + "label": "DropdownMenu 下拉菜单", + "components": [ + "t-dropdown-menu" + ] + }, { "key": "subMenu-empty", "label": "Empty 空状态", @@ -5216,6 +4834,13 @@ "key": "menu-info", "label": "消息提醒", "submenu": [ + { + "key": "subMenu-actionsheet", + "label": "ActionSheet 动作面板", + "components": [ + "t-actionsheet" + ] + }, { "key": "subMenu-back-top", "label": "BackTop 返回顶部", @@ -5251,6 +4876,13 @@ "t-popup" ] }, + { + "key": "subMenu-progress", + "label": "Progress 进度条", + "components": [ + "t-progress" + ] + }, { "key": "subMenu-pullDownRefresh", "label": "PullDownRefresh 下拉刷新", diff --git a/script/gulpfile.wechatide.js b/script/gulpfile.wechatide.js index 8fde3454b..c09f7cba7 100644 --- a/script/gulpfile.wechatide.js +++ b/script/gulpfile.wechatide.js @@ -5,7 +5,9 @@ const fs = require('fs'); const config = require('./config.js'); const wechatideConfig = { - components: [], + key: 'TDesign', + label: 'Tdesign', + components: {}, common: { properties: {}, events: {}, @@ -32,35 +34,45 @@ gulp.task('wechatide:components', (cb) => { const componentsFolder = fs.readdirSync(wechatideFolder); const src = path.resolve(__dirname, '../src'); + const tplConfigPath = path.resolve(__dirname, './tpl.json'); + const tplConfigPathJsonFile = fs.readFileSync(tplConfigPath); + const componentJson = JSON.parse(tplConfigPathJsonFile.toString()); + // 根据生成的组件信息转换整合成配置文件内容 componentsFolder.forEach((componentName) => { const cmpInfoPath = `${wechatideFolder}/${componentName}`; const cmpInfo = fs.readFileSync(cmpInfoPath); const cmpInfoJson = JSON.parse(cmpInfo.toString()); + const componentFileName = componentName.split('.')[0]; // 组件key值替换 - const cmpKey = componentName.split('.')[0]; - cmpInfoJson.key = `t-${cmpKey}`; - - let componentJsonFilePath = `${src}/${cmpKey}/${cmpKey}.json`; - // 获取存放在父组件目录中的子组件json文件地址 - const srcFolder = fs.readdirSync(src); - srcFolder.forEach((cmp) => { - if (isExistFile(`${src}/${cmp}/${cmpKey}.json`)) { - componentJsonFilePath = `${src}/${cmp}/${cmpKey}.json`; - } - }); + const cmpKey = `t-${componentFileName}`; + const configJson = componentJson[cmpKey]; + + // 如果tpl.json文件没有录入的组件信息 + if (!configJson) { + console.log(`组件${cmpKey}没有录入tpl.json文件,请注意查看组件是否存在`); + return; + } + + // 组件的key、icon、tpl、require替换 + cmpInfoJson.key = cmpKey; + cmpInfoJson.icon = configJson.icon || ''; + cmpInfoJson.tpl = configJson.tpl || undefined; + cmpInfoJson.require = configJson.require || undefined; - // 获取到组件依赖组件并录入json - if (isExistFile(componentJsonFilePath)) { - const componentJsonFile = fs.readFileSync(componentJsonFilePath); - const componentJson = JSON.parse(componentJsonFile.toString()); - // usingComponents为空时忽略 - if (componentJson.usingComponents && Object.keys(componentJson.usingComponents).length > 0) { - cmpInfoJson.require = componentJson.usingComponents; - } + // 获取组件path,可能在父组件目录下 + if (isExistFile(`${src}/${componentFileName}/${componentFileName}.ts`)) { + cmpInfoJson.path = `./${componentFileName}/${componentFileName}`; + } else { + const srcFolder = fs.readdirSync(src); + srcFolder.forEach((cmp) => { + if (isExistFile(`${src}/${cmp}/${componentFileName}.ts`)) { + cmpInfoJson.path = `./${cmp}/${componentFileName}`; + } + }); } - wechatideConfig.components.push(cmpInfoJson); + wechatideConfig.components[cmpKey] = cmpInfoJson; }); cb(); @@ -81,9 +93,7 @@ gulp.task('wechatide:menu', (cb) => { return { key: `subMenu-${subItem.name}`, label: subItem.title, - components: [ - `${config.CONFIG_PREFIX}-${subItem.name.replace(/([A-Z])/g, '-$1').toLowerCase()}`, - ], + components: [`${config.CONFIG_PREFIX}-${subItem.name.replace(/([A-Z])/g, '-$1').toLowerCase()}`], }; }); wechatideConfig.menu.push(menuFirst); diff --git a/script/tpl.json b/script/tpl.json index 414d5c8c4..e051b63d0 100644 --- a/script/tpl.json +++ b/script/tpl.json @@ -22,7 +22,7 @@ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-badge.png" }, "t-button": { - "tpl": "强按钮", + "tpl": "", "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-button.png" }, "t-cell": { From 8481a86c27f10125b7595bf46cbda14282868024 Mon Sep 17 00:00:00 2001 From: ericjyang Date: Mon, 25 Apr 2022 20:25:00 +0800 Subject: [PATCH 0004/1046] feat: update .wechatide.ib.json button tpl --- .wechatide.ib.json | 2 +- script/tpl.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.wechatide.ib.json b/.wechatide.ib.json index 6a511da9c..7e9709cff 100644 --- a/.wechatide.ib.json +++ b/.wechatide.ib.json @@ -431,7 +431,7 @@ "label": "" } ], - "tpl": "", + "tpl": "", "path": "./button/button" }, "t-cell-group": { diff --git a/script/tpl.json b/script/tpl.json index e051b63d0..18d9b00cc 100644 --- a/script/tpl.json +++ b/script/tpl.json @@ -22,7 +22,7 @@ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-badge.png" }, "t-button": { - "tpl": "", + "tpl": "", "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-button.png" }, "t-cell": { From cb6a55c02ffa894bcd1967cfa9da5d0e96055601 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Tue, 26 Apr 2022 17:05:15 +0800 Subject: [PATCH 0005/1046] fix(pull-down-refresh): enable to use --- .../pull-down-refresh/pull-down-refresh.json | 2 + .../pull-down-refresh/pull-down-refresh.less | 23 ++- .../pull-down-refresh/pull-down-refresh.ts | 51 +---- .../pull-down-refresh/pull-down-refresh.wxml | 35 ++-- src/pull-down-refresh/README.md | 70 ++----- src/pull-down-refresh/props.ts | 25 ++- src/pull-down-refresh/pull-down-refresh.less | 57 ++---- src/pull-down-refresh/pull-down-refresh.ts | 192 +++++++----------- src/pull-down-refresh/pull-down-refresh.wxml | 46 ++--- src/pull-down-refresh/type.ts | 49 +++-- 10 files changed, 226 insertions(+), 324 deletions(-) diff --git a/example/pages/pull-down-refresh/pull-down-refresh.json b/example/pages/pull-down-refresh/pull-down-refresh.json index 9b9bddc7f..4746791a6 100644 --- a/example/pages/pull-down-refresh/pull-down-refresh.json +++ b/example/pages/pull-down-refresh/pull-down-refresh.json @@ -1,6 +1,8 @@ { "navigationBarTitleText": "PullDownRefresh 下拉刷新", "navigationBarBackgroundColor": "#fff", + "backgroundColor": "#f5f5f5", + "disableScroll": true, "usingComponents": { "t-demo": "../../components/demo-block/index" } diff --git a/example/pages/pull-down-refresh/pull-down-refresh.less b/example/pages/pull-down-refresh/pull-down-refresh.less index 3db527d8b..830ca7fc3 100644 --- a/example/pages/pull-down-refresh/pull-down-refresh.less +++ b/example/pages/pull-down-refresh/pull-down-refresh.less @@ -1,16 +1,14 @@ -page { - background: #fff; - .demo { - padding-bottom: 0; - } +.demo { + background-color: #fff; + padding-bottom: 0; } .pulldown-reflesh__content { justify-content: space-between; - margin: 0 24rpx; flex-wrap: wrap; - padding-bottom: 32rpx; + padding: 0 24rpx 32rpx; position: relative; + background-color: #fff; .text { position: absolute; @@ -19,7 +17,7 @@ page { right: 0; text-align: center; font-size: 32rpx; - color: rgba(0, 0, 0, .26); + color: rgba(0, 0, 0, 0.26); width: 686rpx; } } @@ -31,3 +29,12 @@ page { .skeleton-text { border-radius: 16rpx; } + +.demo-title { + margin: 0; + padding: 48rpx 32rpx 0; +} + +t-demo { + background-color: #fff; +} diff --git a/example/pages/pull-down-refresh/pull-down-refresh.ts b/example/pages/pull-down-refresh/pull-down-refresh.ts index 6f3dd45ca..8ac355651 100644 --- a/example/pages/pull-down-refresh/pull-down-refresh.ts +++ b/example/pages/pull-down-refresh/pull-down-refresh.ts @@ -1,8 +1,8 @@ Page({ - pullDownRefresh0: null as WechatMiniprogram.Component.TrivialInstance | null, - pullDownRefresh1: null as WechatMiniprogram.Component.TrivialInstance | null, data: { - error: false, + baseRefresh: { + value: false, + }, loadingProps0: { size: '50rpx', }, @@ -21,46 +21,17 @@ Page({ ], ], }, - onLoad() { - this.pullDownRefresh0 = this.selectComponent('#pull-down-refresh-0'); - this.pullDownRefresh1 = this.selectComponent('#pull-down-refresh-1'); - }, - // 监听页面滚动事件,并调用pull-down-refresh组件的onPageScroll方法 - // 组件内根据页面滚动距离来判定页面是否到顶部,页面回到顶部后才能下拉刷新 - onPageScroll(e) { - this.pullDownRefresh0 && this.pullDownRefresh0.onPageScroll(e); - this.pullDownRefresh1 && this.pullDownRefresh1.onPageScroll(e); - }, - - onPullDownRefresh0(e) { - // 模拟1秒刷新完成 - const { callback } = e.detail; - - if (callback) { - setTimeout(() => { - callback(); - }, 1000); - } - }, - - timeoutCallback() { - console.log('timeout'); - }, - - onPullDownRefresh1(e) { - // 模拟2秒刷新完成 - const { callback } = e.detail; - if (callback) { - setTimeout(() => { - callback(); - }, 2000); - } + onPullDownRefresh() { + setTimeout(() => { + this.setData({ 'baseRefresh.value': false }); + }, 1500); }, - toggleError() { - this.setData({ - error: !this.data.error, + handleTimeout() { + wx.showToast({ + title: '时间超时', + icon: 'none', }); }, }); diff --git a/example/pages/pull-down-refresh/pull-down-refresh.wxml b/example/pages/pull-down-refresh/pull-down-refresh.wxml index 03d0a38c3..3e6266e05 100644 --- a/example/pages/pull-down-refresh/pull-down-refresh.wxml +++ b/example/pages/pull-down-refresh/pull-down-refresh.wxml @@ -1,36 +1,35 @@ PullDownRefresh 下拉刷新 用于快速刷新页面信息,刷新可以是整页刷新也可以是页面的局部刷新。 - - - - - 下拉刷新大致分为顶部下拉和中间下拉 - - + + + + 拖拽该区域演示 顶部下拉刷新 + + + ```html - - - - 拖拽该区域下拉刷新 - + ``` ```js Page({ - pullDownRefresh: null as WechatMiniprogram.Component.TrivialInstance | null, - data: {}, - onLoad() { - this.pullDownRefresh = this.selectComponent('#pull-down-refresh'); - }, - // 监听页面滚动事件,并调用pull-down-refresh组件的onPageScroll方法 - // 组件内根据页面滚动距离来判定页面是否到顶部,页面回到顶部后才能下拉刷新 - onPageScroll(e) { - this.pullDownRefresh && this.pullDownRefresh.onPageScroll(e); + data: { + loading: false }, - onPullDownRefresh(e: WechatMiniprogram.Event<{ callback: () => void }>) { - // 模拟1秒刷新完成 - const { callback } = e.detail; + handleRefresh() { + // 模拟 1s 加载 setTimeout(() => { - callback && callback(); - }, 1000); + this.setData({ loading: false }) + }, 1000) }, }); ``` ## API - ### PullDownRefresh Props -| 名称 | 类型 | 默认值 | 说明 | 必传 | -| ------------------ | ------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---- | -| external-classes | Array | - | 加载 loading 样式。`['t-class', 't-class-loading','t-class-text', 't-class-indicator']` | N | -| loading-bar-height | Number | 200 | 加载中下拉高度 | N | -| loading-props | Object | - | 加载 loading 样式。TS 类型:`TdLoadingProps`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/pull-down-refresh/type.ts) | N | -| loading-texts | Array | [] | 提示语,组件内部默认值为 ['下拉刷新', '松手刷新', '正在刷新', '刷新完成']。TS 类型:`string[]` | N | -| max-bar-height | Number | 272 | 最大下拉高度 | N | -| refresh-timeout | Number | 3000 | 刷新超时时间 | N | +名称 | 类型 | 默认值 | 说明 | 必传 +-- | -- | -- | -- | -- +external-classes | Array | - | 加载loading样式。`['t-class', 't-class-loading','t-class-text', 't-class-indicator']` | N +loading-bar-height | String / Number | 50 | 加载中下拉高度,如果值为数字则单位是:'px' | N +loading-props | Object | - | 加载loading样式。TS 类型:`LoadingProps`,[Loading API Documents](./loading?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/pull-down-refresh/type.ts) | N +loading-texts | Array | [] | 提示语,组件内部默认值为 ['下拉刷新', '松手刷新', '正在刷新', '刷新完成']。TS 类型:`string[]` | N +max-bar-height | String / Number | 80 | 最大下拉高度,如果值为数字则单位是:'px' | N +refresh-timeout | Number | 3000 | 刷新超时时间 | N +value | Boolean | false | 组件状态,值为 `true` 表示下拉状态,值为 `false` 表示收起状态 | N ### PullDownRefresh Events -| 名称 | 参数 | 描述 | -| ------- | ---- | -------------- | -| refresh | - | 结束下拉时触发 | -| timeout | - | 刷新超时触发 | +名称 | 参数 | 描述 +-- | -- | -- +change | `(value: boolean)` | 下拉或收起时触发,用户手势往下滑动触发下拉状态,手势松开触发收起状态 +refresh | - | 结束下拉时触发 +timeout | - | 刷新超时触发 diff --git a/src/pull-down-refresh/props.ts b/src/pull-down-refresh/props.ts index b3d9a41d1..8ec7484e8 100644 --- a/src/pull-down-refresh/props.ts +++ b/src/pull-down-refresh/props.ts @@ -2,7 +2,6 @@ /** * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC - * updated at 2021-11-24 10:58:05 * */ import { TdPullDownRefreshProps } from './type'; @@ -11,10 +10,11 @@ const props: TdPullDownRefreshProps = { externalClasses: { type: Array, }, - /** 加载中下拉高度 */ + /** 加载中下拉高度,如果值为数字则单位是:'px' */ loadingBarHeight: { - type: Number, - value: 200, + type: String, + optionalTypes: [Number], + value: 50, }, /** 加载loading样式 */ loadingProps: { @@ -25,16 +25,27 @@ const props: TdPullDownRefreshProps = { type: Array, value: [], }, - /** 最大下拉高度 */ + /** 最大下拉高度,如果值为数字则单位是:'px' */ maxBarHeight: { - type: Number, - value: 272, + type: String, + optionalTypes: [Number], + value: 80, }, /** 刷新超时时间 */ refreshTimeout: { type: Number, value: 3000, }, + /** 组件状态,值为 `true` 表示下拉状态,值为 `false` 表示收起状态 */ + value: { + type: Boolean, + value: null, + }, + /** 组件状态,值为 `true` 表示下拉状态,值为 `false` 表示收起状态,非受控属性 */ + defaultValue: { + type: Boolean, + value: false, + }, }; export default props; diff --git a/src/pull-down-refresh/pull-down-refresh.less b/src/pull-down-refresh/pull-down-refresh.less index 41cf8be96..fb69556ef 100644 --- a/src/pull-down-refresh/pull-down-refresh.less +++ b/src/pull-down-refresh/pull-down-refresh.less @@ -1,49 +1,28 @@ @import '../common/style/index.less'; .@{prefix}-pull-down-refresh { - &__bar { - overflow: hidden; - position: relative; - background: #f6f6f6; - color: #bbb; - font-size: 24rpx; - - &--refreshing { - transition: height .5s; + overflow: hidden; - .@{prefix}-pull-down-refresh__loading { - animation: rotateLoading .5s linear infinite; - } - } - - &--success { - .refresh-bar__loading { - display: none; - } - } - - &--finishing { - transition: height 1s; + &__track { + position: relative; - .@{prefix}-pull-down-refresh__loading { - visibility: hidden; - } + &--loosing { + transition: transform ease 0.24s; } } - &__content { - margin-top: 55rpx; + &__tips { + position: absolute; + color: #bbb; + font-size: 24rpx; + top: 0; + width: 100%; + transform: translateY(-100%); display: flex; justify-content: center; align-items: center; flex-direction: column; - } - - &__loading { - position: relative; - box-sizing: border-box; - width: auto; - height: auto; + overflow: hidden; } &__text { @@ -54,13 +33,3 @@ position: relative; } } - -@keyframes rotateLoading { - from { - transform: rotate(0deg); - } - - to { - transform: rotate(360deg); - } -} diff --git a/src/pull-down-refresh/pull-down-refresh.ts b/src/pull-down-refresh/pull-down-refresh.ts index 3eadf6a8b..55a913336 100644 --- a/src/pull-down-refresh/pull-down-refresh.ts +++ b/src/pull-down-refresh/pull-down-refresh.ts @@ -1,5 +1,3 @@ -/* eslint-disable dot-notation */ -/* eslint-disable prefer-destructuring */ import { SuperComponent, wxComponent } from '../common/src/index'; import config from '../common/config'; import props from './props'; @@ -9,37 +7,25 @@ const name = `${prefix}-pull-down-refresh`; @wxComponent() export default class PullDownRefresh extends SuperComponent { - isScrollToTop = true; - pixelRatio = 1; // 像素比(rpx与px在此设备上的比值) startPoint: { pageX: number; pageY: number } | null = null; // 下拉开始的起点,主要用于计算下拉高度 isPulling = false; // 是否下拉中 - defaultBarHeight = 0; // 下拉效果的默认高度 - - maxBarHeight = 276; // 最大下拉高度,单位 rpx + maxBarHeight: number = 0; // 最大下拉高度,单位 rpx // 触发刷新的下拉高度,单位rpx // 松开时下拉高度大于这个值即会触发刷新,触发刷新后松开,会恢复到这个高度并保持,直到刷新结束 loadingBarHeight = 200; - refreshTimeout = 3000; // 刷新超时时间,超过没有回调刷新成功,会自动结束刷新动画。单位 ms - - /** 开始刷新 - 刷新成功/失败 最小间隔时间setTimeout句柄 */ - minRefreshTimeFlag = 0; - - /** 刷新成功/失败 - 关闭刷新动画 最小间隔时间setTimeout句柄 */ - minRefreshStatusShowTimeFlag = 0; - /** 开始刷新 - 刷新成功/失败 最大间隔时间setTimeout句柄 */ maxRefreshAnimateTimeFlag = 0; /** 关闭动画耗时setTimeout句柄 */ closingAnimateTimeFlag = 0; - externalClasses = ['t--class', 't-class-loading', 't-class-tex', 't-class-indicator']; + externalClasses = [`${prefix}-class`, `${prefix}-class-loading`, `${prefix}-class-tex`, `${prefix}-class-indicator`]; options = { multipleSlots: true, @@ -48,78 +34,84 @@ export default class PullDownRefresh extends SuperComponent { properties = props; data = { + prefix, classPrefix: name, - barHeight: this.defaultBarHeight, - refreshStatus: 0, // 0-未开始,1释放可刷新,2-刷新中,3-刷新成功,4-结束中 - refreshTypes: ['not-start', 'wait-start', 'refreshing', 'success', 'finishing'], - rotate: 0, // 旋转角度,refreshStatus为0、1时根据下拉距离动态计算得出 + barHeight: 0, + refreshStatus: -1, + loosing: false, }; - attached() { - const systemInfo = wx.getSystemInfoSync(); - // 计算像素比 - this.screenWidth = systemInfo.screenWidth; - this.pixelRatio = 750 / systemInfo.screenWidth; - // 判断是否ios - this.ios = !!(systemInfo.system.toLowerCase().search('ios') + 1); - - // 自定义拉下宽度 - const maxBarHeight = this.properties.maxBarHeight as any as number; - if (maxBarHeight) { - this.maxBarHeight = maxBarHeight; - } - const loadingBarHeight = this.properties.loadingBarHeight as any as number; - if (loadingBarHeight) { - this.loadingBarHeight = loadingBarHeight; - } - const refreshTimeout = this.properties.refreshTimeout as any as number; - if (refreshTimeout) { - this.refreshTimeout = refreshTimeout; - } - } + lifetimes = { + attached() { + const { screenWidth } = wx.getSystemInfoSync(); + const { maxBarHeight, loadingBarHeight } = this.properties; - detached() { - this.cleanTimeFlag(); - } + this.pixelRatio = 750 / screenWidth; - onPageScroll(e: WechatMiniprogram.Component.TrivialInstance) { - const { scrollTop } = e; - this.isScrollToTop = scrollTop === 0; - } + if (maxBarHeight) { + this.maxBarHeight = this.toRpx(maxBarHeight); + } - /** 清理timeout */ - cleanTimeFlag() { - clearTimeout(this.minRefreshTimeFlag); - clearTimeout(this.minRefreshStatusShowTimeFlag); - clearTimeout(this.maxRefreshAnimateTimeFlag); - clearTimeout(this.closingAnimateTimeFlag); - } + if (loadingBarHeight) { + this.setData({ + computedLoadingBarHeight: this.toRpx(loadingBarHeight), + }); + this.loadingBarHeight = this.toRpx(loadingBarHeight); + } + }, + + detached() { + clearTimeout(this.maxRefreshAnimateTimeFlag); + clearTimeout(this.closingAnimateTimeFlag); + }, + }; + + observers = { + value(val) { + if (!val) { + clearTimeout(this.maxRefreshAnimateTimeFlag); + this.setData({ refreshStatus: 3 }); + this.close(); + } + }, + maxBarHeight(val) { + this.maxBarHeight = this.toRpx(val); + }, + loadingBarHeight(val) { + this.setData({ + computedLoadingBarHeight: this.toRpx(val), + }); + this.loadingBarHeight = this.toRpx(val); + }, + }; onTouchStart(e: WechatMiniprogram.Component.TrivialInstance) { - // 如果页面没滚动到顶部,不做处理 - // 如果下拉效果没有结束,不做处理 - if (!this.isScrollToTop || this.isPulling) return; + if (this.isPulling) return; const { touches } = e; if (touches.length !== 1) return; const { pageX, pageY } = touches[0]; - this.startPoint = { pageX, pageY }; // 设置起点 - this.isPulling = true; // 进入下拉状态 + + this.setData({ loosing: false }); + this.startPoint = { pageX, pageY }; + this.isPulling = true; } onTouchMove(e: WechatMiniprogram.Component.TrivialInstance) { - // 如果页面没滚到顶部,不做处理 - // 如果没有起点,不做处理 - if (!this.isScrollToTop || !this.startPoint) return; + if (!this.startPoint) return; + const { touches } = e; + if (touches.length !== 1) return; + const { pageY } = touches[0]; const offset = pageY - this.startPoint.pageY; const barHeight = this.toRpx(offset); + if (barHeight > 0) { if (barHeight > this.maxBarHeight) { // 限高 this.setRefreshBarHeight(this.maxBarHeight); - this.startPoint.pageY = pageY - this.toPx(this.maxBarHeight); // 限高的同时修正起点,避免触摸点上移时无效果 + // this.startPoint.pageY = pageY - this.toPx(this.maxBarHeight); // 限高的同时修正起点,避免触摸点上移时无效果 } else { this.setRefreshBarHeight(barHeight); } @@ -127,78 +119,54 @@ export default class PullDownRefresh extends SuperComponent { } onTouchEnd(e: WechatMiniprogram.Component.TrivialInstance) { - // 如果没有起点,不做处理 if (!this.startPoint) return; const { changedTouches } = e; if (changedTouches.length !== 1) return; const { pageY } = changedTouches[0]; + const barHeight = this.toRpx(pageY - this.startPoint.pageY); this.startPoint = null; // 清掉起点,之后将忽略touchMove、touchEnd事件 + + this.setData({ loosing: true }); + // 松开时高度超过阈值则触发刷新 if (barHeight > this.loadingBarHeight) { this.setData({ barHeight: this.loadingBarHeight, - rotate: 0, refreshStatus: 2, - }); // 正在刷新 - const startTime = Date.now(); - const callback = () => { - // 正在刷新效果至少持续1秒钟 - const remainTime = 1000 - (Date.now() - startTime); - this.minRefreshTimeFlag = setTimeout( - () => { - // 清理自身timeout - this.minRefreshTimeFlag = 0; - // 如果还没超时 - if (this.maxRefreshAnimateTimeFlag) { - // 清理超时setup - clearTimeout(this.maxRefreshAnimateTimeFlag); - this.maxRefreshAnimateTimeFlag = 0; - - // 执行成功状态展示 - this.setData({ refreshStatus: 3 }); // 刷新成功 - this.minRefreshStatusShowTimeFlag = setTimeout(() => { - this.minRefreshStatusShowTimeFlag = 0; - - this.close(); - }, 1000) as any as number; // 刷新成功展示持续一段时间后再结束 - } - }, - remainTime > 0 ? remainTime : 0, - ) as any as number; - }; - this.triggerEvent('refresh', { callback }); + }); + + this.triggerEvent('change', { value: true }); + this.triggerEvent('refresh'); this.maxRefreshAnimateTimeFlag = setTimeout(() => { - // 清理自身timeout - this.maxRefreshAnimateTimeFlag = 0; + this.maxRefreshAnimateTimeFlag = null; if (this.data.refreshStatus === 2) { // 超时回调 this.triggerEvent('timeout'); this.close(); // 超时仍未被回调,则直接结束下拉 } - }, this.refreshTimeout) as any as number; + }, this.properties.refreshTimeout as any) as any as number; } else { this.close(); } } - toRpx(v: number) { - return v * this.pixelRatio; + toRpx(v: number | string): number { + if (typeof v === 'number') return v * this.pixelRatio; + return parseInt(v, 10); } toPx(v: number) { return v / this.pixelRatio; } - setRefreshBarHeight(barHeight: number): Promise { + setRefreshBarHeight(barHeight: number) { const data: Record = { barHeight }; if (barHeight >= this.loadingBarHeight) { data.refreshStatus = 1; - data.rotate = -720; // 大于正常高度后不再旋转 } else { data.refreshStatus = 0; - data.rotate = (barHeight / this.loadingBarHeight) * -720; // 小于正常高度时随下拉高度旋转720度 } return new Promise((resolve) => { this.setData(data, () => resolve(barHeight)); @@ -206,18 +174,14 @@ export default class PullDownRefresh extends SuperComponent { } close() { - this.setData({ barHeight: this.defaultBarHeight, refreshStatus: 4 }); // 结束下拉 - this.closingAnimateTimeFlag = setTimeout(() => { - // 清理自身timeout - this.closingAnimateTimeFlag = 0; - - if (this.minRefreshStatusShowTimeFlag) { - clearTimeout(this.minRefreshStatusShowTimeFlag); - this.minRefreshStatusShowTimeFlag = 0; - } + const animationDuration = 240; - this.setData({ refreshStatus: 0 }); + this.setData({ barHeight: 0 }); + this.triggerEvent('change', { value: false }); + this.closingAnimateTimeFlag = setTimeout(() => { + this.closingAnimateTimeFlag = null; + this.setData({ refreshStatus: -1 }); this.isPulling = false; // 退出下拉状态 - }, 1000) as any as number; + }, animationDuration) as any as number; } } diff --git a/src/pull-down-refresh/pull-down-refresh.wxml b/src/pull-down-refresh/pull-down-refresh.wxml index f8ac9be6c..e1db93c2d 100644 --- a/src/pull-down-refresh/pull-down-refresh.wxml +++ b/src/pull-down-refresh/pull-down-refresh.wxml @@ -1,37 +1,33 @@ - - + + {{loadingTexts[refreshStatus]}} - - - {{loadingTexts[refreshStatus]}} - - diff --git a/src/pull-down-refresh/type.ts b/src/pull-down-refresh/type.ts index 4e77dd19a..4d1637553 100644 --- a/src/pull-down-refresh/type.ts +++ b/src/pull-down-refresh/type.ts @@ -2,10 +2,9 @@ /** * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC - * updated at 2021-11-24 10:58:05 * */ -import { TdLoadingProps } from '../loading/type'; +import { LoadingProps } from '../loading/index'; export interface TdPullDownRefreshProps { /** @@ -13,25 +12,23 @@ export interface TdPullDownRefreshProps { */ externalClasses?: { type: ArrayConstructor; - value?: ['t-class', 't-class-loading','t-class-text', 't-class-indicator']; - required?: boolean; + value?: ['t-class', 't-class-loading', 't-class-text', 't-class-indicator']; }; /** - * 加载中下拉高度 - * @default 200 + * 加载中下拉高度,如果值为数字则单位是:'px' + * @default 50 */ loadingBarHeight?: { - type: NumberConstructor; - value?: number; - required?: boolean; + type: StringConstructor; + optionalTypes: Array; + value?: string | number; }; /** * 加载loading样式 */ loadingProps?: { type: ObjectConstructor; - value?: TdLoadingProps; - required?: boolean; + value?: LoadingProps; }; /** * 提示语,组件内部默认值为 ['下拉刷新', '松手刷新', '正在刷新', '刷新完成'] @@ -40,16 +37,15 @@ export interface TdPullDownRefreshProps { loadingTexts?: { type: ArrayConstructor; value?: string[]; - required?: boolean; }; /** - * 最大下拉高度 - * @default 272 + * 最大下拉高度,如果值为数字则单位是:'px' + * @default 80 */ maxBarHeight?: { - type: NumberConstructor; - value?: number; - required?: boolean; + type: StringConstructor; + optionalTypes: Array; + value?: string | number; }; /** * 刷新超时时间 @@ -58,6 +54,21 @@ export interface TdPullDownRefreshProps { refreshTimeout?: { type: NumberConstructor; value?: number; - required?: boolean; }; -}; + /** + * 组件状态,值为 `true` 表示下拉状态,值为 `false` 表示收起状态 + * @default false + */ + value?: { + type: BooleanConstructor; + value?: boolean; + }; + /** + * 组件状态,值为 `true` 表示下拉状态,值为 `false` 表示收起状态,非受控属性 + * @default false + */ + defaultValue?: { + type: BooleanConstructor; + value?: boolean; + }; +} From 23a06ffbe4399cfa32af3f95004cbc0322d1a2cc Mon Sep 17 00:00:00 2001 From: ericjyang Date: Wed, 27 Apr 2022 10:31:38 +0800 Subject: [PATCH 0006/1046] feat: tpl update --- script/tpl.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/tpl.json b/script/tpl.json index 18d9b00cc..3f36e9c5b 100644 --- a/script/tpl.json +++ b/script/tpl.json @@ -198,7 +198,7 @@ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-steps.png" }, "t-steps": { - "tpl": "", + "tpl": "", "require": { "t-step-item": "./steps/step-item" }, From 4d558fd249c1dd9957b7b8281ed232c222cf0f55 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Wed, 27 Apr 2022 17:18:26 +0800 Subject: [PATCH 0007/1046] feat(loading): support inherit color --- src/loading/README.md | 30 +++++++++++++++--------------- src/loading/loading.ts | 4 +++- src/loading/loading.wxml | 8 ++------ src/loading/props.ts | 6 +++++- src/loading/type.ts | 23 +++++++++-------------- 5 files changed, 34 insertions(+), 37 deletions(-) diff --git a/src/loading/README.md b/src/loading/README.md index 202208e8b..2f7f874ea 100644 --- a/src/loading/README.md +++ b/src/loading/README.md @@ -113,20 +113,20 @@ Page({ ``` ## API - ### Loading Props -| 名称 | 类型 | 默认值 | 说明 | 必传 | -| ---------------- | ------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | -| delay | Number | 0 | 延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒 | N | -| duration | Number | 800 | 加载动画执行完成一次的时间,单位:毫秒 | N | -| external-classes | Array | - | 组件类名,分别用于设置加载组件外层元素,加载组件文本,加载组件指示符,加载指示符内侧同心圆等元素类名。`['t-class', 't-class-text', 't-class-indicator']` | N | -| indicator | Boolean | true | 是否显示加载指示符 | N | -| layout | String | horizontal | 对齐方式。可选项:horizontal/vertical | N | -| loading | Boolean | true | 是否处于加载状态 | N | -| pause | Boolean | false | 是否暂停动画 | N | -| progress | Number | - | 加载进度 | N | -| reverse | Boolean | - | 加载动画是否反向 | N | -| size | String | '40rpx' | 尺寸,示例:40rpx/20px | N | -| text | String / Slot | - | 加载提示文案 | N | -| theme | String | circular | 加载组件类型。可选项:circular/spinner/bar/error/dots | N | +名称 | 类型 | 默认值 | 说明 | 必传 +-- | -- | -- | -- | -- +delay | Number | 0 | 延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒 | N +duration | Number | 800 | 加载动画执行完成一次的时间,单位:毫秒 | N +external-classes | Array | - | 组件类名,分别用于设置加载组件外层元素,加载组件文本,加载组件指示符,加载指示符内侧同心圆等元素类名。`['t-class', 't-class-text', 't-class-indicator']` | N +indicator | Boolean | true | 是否显示加载指示符 | N +inherit-color | Boolean | false | 是否继承父元素颜色 | N +layout | String | horizontal | 对齐方式。可选项:horizontal/vertical | N +loading | Boolean | true | 是否处于加载状态 | N +pause | Boolean | false | 是否暂停动画 | N +progress | Number | - | 加载进度 | N +reverse | Boolean | - | 加载动画是否反向 | N +size | String | '40rpx' | 尺寸,示例:40rpx/20px | N +text | String / Slot | - | 加载提示文案 | N +theme | String | circular | 加载组件类型。可选项:circular/spinner/bar/error/dots | N diff --git a/src/loading/loading.ts b/src/loading/loading.ts index e34790fbd..f568ed150 100644 --- a/src/loading/loading.ts +++ b/src/loading/loading.ts @@ -21,7 +21,9 @@ export default class Loading extends SuperComponent { multipleSlots: true, }; - properties = props; + properties = { + ...props, + }; timer = null; diff --git a/src/loading/loading.wxml b/src/loading/loading.wxml index 51d4a3c32..527ef84f3 100644 --- a/src/loading/loading.wxml +++ b/src/loading/loading.wxml @@ -5,15 +5,11 @@ style="{{progress >= 0 ? 'width:' + progress + '%' : ''}}" class="{{prefix}}-class-indicator {{classPrefix}}__bar {{classPrefix}}__bar--{{progress < 0 ? 'animation' : progress < 100 ? 'static': ''}} {{progress >= 100 || !loading ? classPrefix + '__bar--loaded' : ''}}" > - + Date: Wed, 27 Apr 2022 17:57:15 +0800 Subject: [PATCH 0008/1046] fix(toast): correct loading color --- src/toast/toast.less | 5 +++-- src/toast/toast.wxml | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/toast/toast.less b/src/toast/toast.less index b83571126..001a16675 100644 --- a/src/toast/toast.less +++ b/src/toast/toast.less @@ -1,5 +1,6 @@ -// @import (css) '../common/index.wxss'; -.t-toast { +@import '../common/style/index.less'; + +.@{prefix}-toast { &__bg { width: 100%; height: 100%; diff --git a/src/toast/toast.wxml b/src/toast/toast.wxml index e8a73b557..cdda52fcd 100644 --- a/src/toast/toast.wxml +++ b/src/toast/toast.wxml @@ -16,7 +16,8 @@ theme="circular" size="{{direction === 'row' ? '42rpx' : '96rpx'}}" loading - t-class-indicator="indicator-blue" + inherit-color + style="color: white" layout="vertical" /> From 4ca85b400bca0b1de52862cfc0cf7de93a816ff6 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Wed, 27 Apr 2022 19:07:24 +0800 Subject: [PATCH 0009/1046] feat(overlay): add new component --- example/app.json | 2 ++ example/pages/home/data/ux.ts | 4 +++ example/pages/overlay/overlay.json | 5 +++ example/pages/overlay/overlay.less | 3 ++ example/pages/overlay/overlay.ts | 24 ++++++++++++++ example/pages/overlay/overlay.wxml | 7 ++++ site/site.config.mjs | 7 ++++ src/overlay/README.md | 53 ++++++++++++++++++++++++++++++ src/overlay/overlay.json | 3 ++ src/overlay/overlay.less | 16 +++++++++ src/overlay/overlay.ts | 36 ++++++++++++++++++++ src/overlay/overlay.wxml | 8 +++++ 12 files changed, 168 insertions(+) create mode 100644 example/pages/overlay/overlay.json create mode 100644 example/pages/overlay/overlay.less create mode 100644 example/pages/overlay/overlay.ts create mode 100644 example/pages/overlay/overlay.wxml create mode 100644 src/overlay/README.md create mode 100644 src/overlay/overlay.json create mode 100644 src/overlay/overlay.less create mode 100644 src/overlay/overlay.ts create mode 100644 src/overlay/overlay.wxml diff --git a/example/app.json b/example/app.json index bde31dc6f..9cbdd7674 100644 --- a/example/app.json +++ b/example/app.json @@ -50,6 +50,7 @@ "pages/grid/grid", "pages/upload/upload", "pages/count-down/count-down", + "pages/overlay/overlay", "pages/image/image", "pages/search/search", "pages/home/navigateFail/navigateFail", @@ -82,6 +83,7 @@ "t-textarea": "tdesign-miniprogram/textarea/textarea", "t-message": "tdesign-miniprogram/message/message", "t-toast": "tdesign-miniprogram/toast/toast", + "t-overlay": "tdesign-miniprogram/overlay/overlay", "t-segmented-control": "tdesign-miniprogram/segmented-control/segmented-control", "t-stepper": "tdesign-miniprogram/stepper/stepper", "t-slider": "tdesign-miniprogram/slider/slider", diff --git a/example/pages/home/data/ux.ts b/example/pages/home/data/ux.ts index de8a13faa..3fee15850 100644 --- a/example/pages/home/data/ux.ts +++ b/example/pages/home/data/ux.ts @@ -30,6 +30,10 @@ const ux = { // name: 'NoticeBar', // label: '公告栏', // }, + { + name: 'Overlay', + label: '遮罩层', + }, { name: 'Popup', label: '弹出层', diff --git a/example/pages/overlay/overlay.json b/example/pages/overlay/overlay.json new file mode 100644 index 000000000..911e06c5d --- /dev/null +++ b/example/pages/overlay/overlay.json @@ -0,0 +1,5 @@ +{ + "navigationBarTitleText": "Overlay 遮罩层", + "navigationBarBackgroundColor": "#fff", + "usingComponents": {} +} diff --git a/example/pages/overlay/overlay.less b/example/pages/overlay/overlay.less new file mode 100644 index 000000000..51901d7c1 --- /dev/null +++ b/example/pages/overlay/overlay.less @@ -0,0 +1,3 @@ +.demo-block__oper { + margin: 0 32rpx; +} diff --git a/example/pages/overlay/overlay.ts b/example/pages/overlay/overlay.ts new file mode 100644 index 000000000..50a6f6752 --- /dev/null +++ b/example/pages/overlay/overlay.ts @@ -0,0 +1,24 @@ +Page({ + data: { + visible: false, + list: [ + { + title: '基础遮罩层', + btns: [ + { + type: 'base', + text: '基础用法', + }, + ], + }, + ], + }, + handleClick() { + this.setData({ visible: true }); + }, + handleOverlayClick(e) { + this.setData({ + visible: e.detail.visible, + }); + }, +}); diff --git a/example/pages/overlay/overlay.wxml b/example/pages/overlay/overlay.wxml new file mode 100644 index 000000000..3b6197022 --- /dev/null +++ b/example/pages/overlay/overlay.wxml @@ -0,0 +1,7 @@ + + Overlay 遮罩层 + 通过遮罩层,可以强调部分内容 + + + + diff --git a/site/site.config.mjs b/site/site.config.mjs index 3ae895a7b..0463214b1 100644 --- a/site/site.config.mjs +++ b/site/site.config.mjs @@ -378,6 +378,13 @@ export default { // path: '/miniprogram/components/noticebar', // component: () => import('@/noticebar/README.md'), // }, + { + title: 'Overlay 遮罩层', + name: 'overlay', + meta: { docType: 'message' }, + path: '/miniprogram/components/overlay', + component: () => import('@/overlay/README.md'), + }, { title: 'Popup 弹出层', name: 'popup', diff --git a/src/overlay/README.md b/src/overlay/README.md new file mode 100644 index 000000000..a7f912a71 --- /dev/null +++ b/src/overlay/README.md @@ -0,0 +1,53 @@ +--- +title: Overlay 遮罩层 +description: 通过遮罩层,可以强调部分内容 +spline: message +isComponent: true +--- + +## 引入 + +全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。 + +```json +"usingComponents": { + "t-overlay": "tdesign-miniprogram/overlay/overlay" +} +``` + +## 代码演示 + +### 基础使用 + +```html + + + +``` + +```js +Page({ + data: { + overlayVisible: true + }, + handleOverlay() { + this.setData({ overlayVisible: false }); + } +}) +``` + +## API + +### Overlay Props + +名称 | 类型 | 默认值 | 说明 | 必传 +-- | -- | -- | -- | -- +visible | Boolean | false | 是否展示 | N +zIndex | Number | 11000 | 遮罩层及 | N +duration | Number | 300 | (暂不支持)背景色过渡时间,单位毫秒 | N + +### Overlay Events + +名称 | 参数 | 描述 +-- | -- | -- +click | `({ visible: boolean })` | 点击遮罩时触发 \ No newline at end of file diff --git a/src/overlay/overlay.json b/src/overlay/overlay.json new file mode 100644 index 000000000..467ce2945 --- /dev/null +++ b/src/overlay/overlay.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/src/overlay/overlay.less b/src/overlay/overlay.less new file mode 100644 index 000000000..2040f3c59 --- /dev/null +++ b/src/overlay/overlay.less @@ -0,0 +1,16 @@ +@import '../common/style/index.less'; + +@overlay: ~'@{prefix}-overlay'; + +.@{overlay} { + position: fixed; + top: 0; + left: 0; + width: 100%; + bottom: 0; + background-color: #fff; + + &--active { + background-color: rgba(0, 0, 0, 0.6); + } +} diff --git a/src/overlay/overlay.ts b/src/overlay/overlay.ts new file mode 100644 index 000000000..928536594 --- /dev/null +++ b/src/overlay/overlay.ts @@ -0,0 +1,36 @@ +import { SuperComponent, wxComponent } from '../common/src/index'; +import config from '../common/config'; + +const { prefix } = config; +const name = `${prefix}-overlay`; + +@wxComponent() +export default class Overlay extends SuperComponent { + properties = { + visible: { + type: Boolean, + value: false, + }, + + zIndex: { + type: Number, + value: 11000, + }, + + duration: { + type: Number, + value: 300, + }, + }; + + data = { + prefix, + classPrefix: name, + }; + + methods = { + handleClick() { + this.triggerEvent('click', { visible: !this.properties.visible }); + }, + }; +} diff --git a/src/overlay/overlay.wxml b/src/overlay/overlay.wxml new file mode 100644 index 000000000..d91514ddd --- /dev/null +++ b/src/overlay/overlay.wxml @@ -0,0 +1,8 @@ + + + From fcb33649a6da214964fd5145c59e7394ec2b79b0 Mon Sep 17 00:00:00 2001 From: NuoHui Date: Sun, 24 Apr 2022 22:07:26 +0800 Subject: [PATCH 0010/1046] feat(image-viewer): add image-viewer component --- example/app.json | 6 +- example/pages/home/data/display.ts | 8 +- example/pages/image-viewer/image-viewer.json | 7 + example/pages/image-viewer/image-viewer.less | 62 ++++++++ example/pages/image-viewer/image-viewer.ts | 134 +++++++++++++++++ example/pages/image-viewer/image-viewer.wxml | 17 +++ example/project.config.json | 6 + src/image-viewer/README.md | 103 +++++++++++++ src/image-viewer/image-viewer.json | 9 ++ src/image-viewer/image-viewer.less | 81 ++++++++++ src/image-viewer/image-viewer.ts | 150 +++++++++++++++++++ src/image-viewer/image-viewer.wxml | 50 +++++++ src/image-viewer/props.ts | 52 +++++++ src/image-viewer/type.ts | 67 +++++++++ 14 files changed, 746 insertions(+), 6 deletions(-) create mode 100644 example/pages/image-viewer/image-viewer.json create mode 100644 example/pages/image-viewer/image-viewer.less create mode 100644 example/pages/image-viewer/image-viewer.ts create mode 100644 example/pages/image-viewer/image-viewer.wxml create mode 100644 src/image-viewer/README.md create mode 100644 src/image-viewer/image-viewer.json create mode 100644 src/image-viewer/image-viewer.less create mode 100644 src/image-viewer/image-viewer.ts create mode 100644 src/image-viewer/image-viewer.wxml create mode 100644 src/image-viewer/props.ts create mode 100644 src/image-viewer/type.ts diff --git a/example/app.json b/example/app.json index c5de3e8a8..ebfc409aa 100644 --- a/example/app.json +++ b/example/app.json @@ -56,7 +56,8 @@ "pages/navbar/navbar", "pages/date-time-picker/date-time-picker", "pages/action-sheet/action-sheet", - "pages/notice-bar/notice-bar" + "pages/notice-bar/notice-bar", + "pages/image-viewer/image-viewer" ], "usingComponents": { "t-demo": "../../components/demo-block/index", @@ -123,7 +124,8 @@ "t-navbar": "tdesign-miniprogram/navbar/navbar", "t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker", "t-action-sheet": "tdesign-miniprogram/action-sheet/action-sheet", - "t-notice-bar": "tdesign-miniprogram/notice-bar/notice-bar" + "t-notice-bar": "tdesign-miniprogram/notice-bar/notice-bar", + "t-image-viewer": "tdesign-miniprogram/image-viewer/image-viewer" }, "window": { "backgroundTextStyle": "light", diff --git a/example/pages/home/data/display.ts b/example/pages/home/data/display.ts index 89a6d6ed7..339fd0bf1 100644 --- a/example/pages/home/data/display.ts +++ b/example/pages/home/data/display.ts @@ -54,10 +54,10 @@ const display = { name: 'Image', label: '图片', }, - // { - // name: 'Preview', - // label: '图片预览', - // }, + { + name: 'ImageViewer', + label: '图片预览', + }, { name: 'Swiper', label: '轮播图', diff --git a/example/pages/image-viewer/image-viewer.json b/example/pages/image-viewer/image-viewer.json new file mode 100644 index 000000000..708cd5713 --- /dev/null +++ b/example/pages/image-viewer/image-viewer.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "ImageViewer", + "navigationBarBackgroundColor": "#fff", + "usingComponents": { + "t-demo": "../../components/demo-block/index" + } +} diff --git a/example/pages/image-viewer/image-viewer.less b/example/pages/image-viewer/image-viewer.less new file mode 100644 index 000000000..5e22e43af --- /dev/null +++ b/example/pages/image-viewer/image-viewer.less @@ -0,0 +1,62 @@ +.image-viewer { + background-color: #fff; + font-size: 32rpx; + line-height: 48rpx; + color: rgba(0, 0, 0, 0.9); + padding: 48rpx 0rpx 96rpx 0rpx; + height: 100vh; + + .slot-wrap { + background-color: #fff; + padding: 10px; + } + + .title { + font-weight: bold; + font-size: 40rpx; + line-height: 56rpx; + color: rgba(0, 0, 0, 0.9); + padding: 0 32rpx; + } + + .desc { + margin-top: 16rpx; + font-size: 26rpx; + line-height: 36rpx; + color: rgba(0, 0, 0, 0.4); + padding: 0 32rpx; + } + + .sub-title { + margin-top: 40rpx; + font-weight: bold; + padding: 0 32rpx; + } + + .t-button { + width: 686rpx; + height: 96rpx; + border-radius: 8rpx; + display: flex; + align-items: center; + justify-content: center; + margin-top: 32rpx; + + &::after { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 200%; + height: 200%; + transform: scale(0.5); + transform-origin: 0 0; + box-sizing: border-box; + border: 2rpx solid #dcdcdc; + } + } + + .demo-block__oper { + padding: 0 32rpx; + } +} diff --git a/example/pages/image-viewer/image-viewer.ts b/example/pages/image-viewer/image-viewer.ts new file mode 100644 index 000000000..8aeffe30f --- /dev/null +++ b/example/pages/image-viewer/image-viewer.ts @@ -0,0 +1,134 @@ +import Toast from 'tdesign-miniprogram/toast/index'; + +Page({ + data: { + visible: false, + showIndex: false, + closeBtn: false, + deleteBtn: false, + images: [], + operList1: [ + { + title: '图片预览类型', + btns: [ + { + type: 'basic', + text: '基础图片预览', + }, + { + type: 'withDeleteBasic', + text: '有删除操作', + }, + { + type: 'withOverHeightBasic', + text: '图片超高情况', + }, + { + type: 'withOverWidthBasic', + text: '图片超宽情况', + }, + ], + }, + ], + }, + + onReady() { + // + }, + + clickHandle(e: any) { + const { detail } = e; + switch (detail) { + case 'basic': + this.setData({ + images: [ + ...Array.from({ length: 6 }).fill( + 'https://oteam-tdesign-1258344706.cos.ap-guangzhou.myqcloud.com/miniprogram/images/preview1.png', + ), + ], + showIndex: true, + visible: true, + }); + break; + case 'withDeleteBasic': + this.setData({ + images: [ + ...Array.from({ length: 6 }).fill( + 'https://oteam-tdesign-1258344706.cos.ap-guangzhou.myqcloud.com/miniprogram/images/preview4.png', + ), + ], + showIndex: true, + visible: true, + closeBtn: true, + deleteBtn: true, + }); + break; + case 'withOverHeightBasic': + this.setData({ + images: [ + ...Array.from({ length: 6 }).fill( + 'https://oteam-tdesign-1258344706.cos.ap-guangzhou.myqcloud.com/miniprogram/images/preview3.png', + ), + ], + showIndex: true, + visible: true, + }); + break; + case 'withOverWidthBasic': + this.setData({ + images: [ + ...Array.from({ length: 6 }).fill( + 'https://oteam-tdesign-1258344706.cos.ap-guangzhou.myqcloud.com/miniprogram/images/preview2.png', + ), + ], + showIndex: true, + visible: true, + }); + break; + default: + break; + } + }, + + onChange(e: any) { + const { + detail: { index }, + } = e; + Toast({ + context: this, + selector: '#t-toast', + message: `翻到第${index + 1}个`, + }); + }, + + onDelete(e: any) { + const { + detail: { index }, + } = e; + Toast({ + context: this, + selector: '#t-toast', + message: `删除第${index + 1}个`, + }); + }, + + onClose(e: any) { + const { + detail: { index }, + } = e; + Toast({ + context: this, + selector: '#t-toast', + message: `关闭第${index + 1}个`, + }); + }, + + onVisibleChange(e: any) { + const { + detail: { visible }, + } = e; + this.setData({ + visible, + }); + }, +}); diff --git a/example/pages/image-viewer/image-viewer.wxml b/example/pages/image-viewer/image-viewer.wxml new file mode 100644 index 000000000..a5ea217de --- /dev/null +++ b/example/pages/image-viewer/image-viewer.wxml @@ -0,0 +1,17 @@ + + ImageViewer 图片预览 + 图片全屏放大预览效果,包含全屏背景色、页码位置样式、增加操作等规范 + + + + diff --git a/example/project.config.json b/example/project.config.json index ac76fc5cb..42a3e1528 100644 --- a/example/project.config.json +++ b/example/project.config.json @@ -86,6 +86,12 @@ "name": "actionSheet", "pathName": "pages/action-sheet/action-sheet", "scene": null + }, + { + "id": -1, + "name": "image-viewer", + "pathName": "pages/image-viewer/image-viewer", + "scene": null } ] } diff --git a/src/image-viewer/README.md b/src/image-viewer/README.md new file mode 100644 index 000000000..9205b5c3b --- /dev/null +++ b/src/image-viewer/README.md @@ -0,0 +1,103 @@ +--- +title: ImageViewer 图片预览 +description: 图片全屏放大预览效果,包含全屏背景色、页码位置样式、增加操作等规范。 +spline: data +isComponent: true +--- + +## 引入 + +全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。 + +```json +"usingComponents": { + "t-image-viewer": "tdesign-miniprogram/image-viewer/image-viewer", +} +``` + +## 代码演示 + +### 基础用法 + +```html + +``` + +### 显示页码 + +```html + +``` + +### 带删除操作 + +```html + +``` + +### 支持自定义操作按钮 + +```html + + 我是自定义的关闭内容 + 我是自定义的删除内容 + +``` + + +## API + +### ImageViewer Props + +名称 | 类型 | 默认值 | 说明 | 必传 +-- | -- | -- | -- | -- +background-color | String / Number | rgba(0, 0, 0, 1) | 遮罩的背景颜色 | N +images | Array | [] | 图片数组。TS 类型:`Array` | N +initial-index | Number | 0 | 默认展示第几项 | N +show-index | Boolean | false | 是否显示页码 | N +delete-btn | Boolean | false | 是否显示删除操作,前提需要开启页码 | N +close-btn | Boolean | false | 是否显示关闭操作,前提需要开启页码 | N +visible | Boolean | false | 隐藏/显示预览 | N +default-visible | Boolean | undefined | 隐藏/显示预览。非受控属性 | N + + + +### ImageViewer Events + +名称 | 参数 | 描述 +-- | -- | -- +visible-change | `(visible: Boolean)` | 当浮层隐藏或显示时触发。 +change | `(index: Number)` | 翻页时回调 +close | `(index: Number)` | 关闭操作时触发 +delete | `(index: Number)` | 删除时触发 + diff --git a/src/image-viewer/image-viewer.json b/src/image-viewer/image-viewer.json new file mode 100644 index 000000000..57fe7ea66 --- /dev/null +++ b/src/image-viewer/image-viewer.json @@ -0,0 +1,9 @@ +{ + "component": true, + "usingComponents": { + "t-image": "../image/image", + "t-icon": "../icon/icon", + "t-swiper": "../swiper/swiper", + "t-swiper-item": "../swiper/swiper-item" + } +} diff --git a/src/image-viewer/image-viewer.less b/src/image-viewer/image-viewer.less new file mode 100644 index 000000000..57d73c355 --- /dev/null +++ b/src/image-viewer/image-viewer.less @@ -0,0 +1,81 @@ +@import '../common/style/index.less'; + +@image-viewer: ~'@{prefix}-image-viewer'; +@image-viewer-nav-height: 48rpx; +@image-viewer-nav-margin: 36rpx; + +.@{image-viewer} { + position: fixed; + top: 0; + left: 0; + bottom: 0; + right: 0; + z-index: 1001; + height: 100%; + transform: translateZ(0); + overflow: hidden; + + &__mask { + position: fixed; + z-index: 1000; + left: 0; + top: 0; + width: 100%; + height: 100%; + } + + &__content { + width: 100vw; + display: inline-block; + position: absolute; + top: 50%; + transform: translateY(-50%); + z-index: 1005; + } + + &__image { + width: 100%; + display: inline-block; + position: absolute; + top: 50%; + transform: translateY(-50%); + image { + width: inherit !important; + height: inherit !important; + display: block; + } + } + + &__nav { + width: 100%; + position: fixed; + display: flex; + align-items: center; + justify-content: space-between; + height: @image-viewer-nav-height; + top: 68rpx; + left: 0; + color: #ffffff; + z-index: 1005; + + &-icon { + flex: 0 0 @image-viewer-nav-height; + width: @image-viewer-nav-height; + height: @image-viewer-nav-height; + } + + &-close { + margin-left: @image-viewer-nav-margin; + } + + &-delete { + margin-right: @image-viewer-nav-margin; + } + + &-index { + flex: 1; + font-size: 28rpx; + text-align: center; + } + } +} diff --git a/src/image-viewer/image-viewer.ts b/src/image-viewer/image-viewer.ts new file mode 100644 index 000000000..26bf61b41 --- /dev/null +++ b/src/image-viewer/image-viewer.ts @@ -0,0 +1,150 @@ +import { styles } from '../common/utils'; +import { SuperComponent, wxComponent } from '../common/src/index'; +import config from '../common/config'; +import props from './props'; + +const { prefix } = config; +const name = `${prefix}-image-viewer`; + +@wxComponent() +export default class ImageViewer extends SuperComponent { + externalClasses = [`${prefix}-class`]; + + properties = { + ...props, + }; + + data = { + prefix, + classPrefix: name, + currentSwiperIndex: 0, + windowHeight: 0, + windowWidth: 0, + imagesShape: {}, + }; + + options = { + multipleSlots: true, + }; + + controlledProps = [ + { + key: 'visible', + event: 'visible-change', + }, + ]; + + ready() { + this.saveScreenSize(); + } + + observers = { + visible(value) { + this.setData({ + currentSwiperIndex: value ? this.properties.initialIndex : 0, + }); + }, + }; + + methods = { + saveScreenSize() { + const { windowHeight, windowWidth } = wx.getSystemInfoSync(); + this.setData({ + windowHeight, + windowWidth, + }); + }, + + calcImageDisplayStyle(imageWidth, imageHeight) { + const { windowWidth, windowHeight } = this.data; + // 图片宽高都小于屏幕宽高 + if (imageWidth < windowWidth && imageHeight < windowHeight) { + return { + mode: 'scaleToFill', + styleObj: { + width: '100%', + height: `${imageHeight * 2}rpx`, + }, + }; + } + + // 图片宽高都大等于屏幕宽高 + if (imageWidth >= windowWidth && imageHeight >= windowHeight) { + return { + mode: 'aspectFit', + styleObj: { + width: '100%', + height: `${(imageHeight / (imageWidth / windowWidth)) * 2}rpx`, + }, + }; + } + + // 图片超高:图片宽小于屏幕宽,图片高大于等于屏幕高 + if (imageWidth < windowWidth && imageHeight >= windowHeight) { + return { + mode: 'widthFix', + styleObj: { + width: `${(imageWidth / (imageHeight / windowHeight)) * 2}rpx`, + height: '100vh', + left: '50%', + transform: 'translate(-50%, -50%)', + }, + }; + } + + // 图片超宽:图片宽大于等于屏幕宽,图片高小于屏幕高 + if (imageWidth >= windowWidth && imageHeight < windowHeight) { + return { + mode: 'heightFix', + styleObj: { + width: '100%', + height: `${(imageHeight / (imageWidth / windowWidth)) * 2}rpx`, + }, + }; + } + }, + + onImageLoadSuccess(e: WechatMiniprogram.TouchEvent) { + const { + detail: { width, height }, + currentTarget: { + dataset: { index }, + }, + } = e; + const { mode, styleObj } = this.calcImageDisplayStyle(width, height); + const origin = this.data.imagesShape; + this.setData({ + imagesShape: { + ...origin, + [index]: { + mode, + style: styles({ ...styleObj }), + }, + }, + }); + }, + + onSwiperChange(e: WechatMiniprogram.TouchEvent) { + const { + detail: { current }, + } = e; + this.setData({ + currentSwiperIndex: current, + }); + this._trigger('change', { index: current }); + }, + + onVisibleChange() { + const { visible } = this.data; + this._trigger('visible-change', { visible: !visible }); + }, + + onClose() { + this._trigger('close', { index: this.data.currentSwiperIndex }); + }, + + onDelete() { + this._trigger('delete', { index: this.data.currentSwiperIndex }); + }, + }; +} diff --git a/src/image-viewer/image-viewer.wxml b/src/image-viewer/image-viewer.wxml new file mode 100644 index 000000000..a1838381b --- /dev/null +++ b/src/image-viewer/image-viewer.wxml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + {{currentSwiperIndex + 1}}/{{images.length}} + + + + + diff --git a/src/image-viewer/props.ts b/src/image-viewer/props.ts new file mode 100644 index 000000000..4dc23fa01 --- /dev/null +++ b/src/image-viewer/props.ts @@ -0,0 +1,52 @@ +/* eslint-disable */ + +/** + * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC + * */ + +import { TdImageViewerProps } from './type'; +const props: TdImageViewerProps = { + /** 遮罩的背景颜色 */ + backgroundColor: { + type: String, + optionalTypes: [Number], + value: 'rgba(0, 0, 0, 1)', + }, + /** 图片数组 */ + images: { + type: Array, + value: [], + }, + /** 默认展示第几项 */ + initialIndex: { + type: Number, + value: 0, + }, + /** 是否显示页码 */ + showIndex: { + type: Boolean, + value: false, + }, + /** 是否显示删除操作 */ + deleteBtn: { + type: Boolean, + value: false, + }, + /** 是否显示关闭操作 */ + closeBtn: { + type: Boolean, + value: false, + }, + /** 隐藏/显示预览 */ + visible: { + type: Boolean, + value: null, + }, + /** 隐藏/显示预览,非受控属性 */ + defaultVisible: { + type: Boolean, + value: false, + }, +}; + +export default props; diff --git a/src/image-viewer/type.ts b/src/image-viewer/type.ts new file mode 100644 index 000000000..ba6af79ff --- /dev/null +++ b/src/image-viewer/type.ts @@ -0,0 +1,67 @@ +/* eslint-disable */ + +/** + * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC + * */ + +export interface TdImageViewerProps { + /** + * 遮罩的背景颜色 + * @default rgba(0, 0, 0, .6) + */ + backgroundColor?: { + type: StringConstructor; + optionalTypes: Array; + value?: string | number; + }; + /** + * 图片数组 + * @default [] + */ + images?: { + type: ArrayConstructor; + value?: Array; + }; + /** + * 默认展示第几项 + * @default 0 + */ + initialIndex?: { + type: NumberConstructor; + value?: number; + }; + /** + * 是否显示页码 + * @default false + */ + showIndex?: { + type: BooleanConstructor; + value?: boolean; + }; + /** 是否显示删除操作 */ + deleteBtn?: { + type: BooleanConstructor; + value: false; + }; + /** 是否显示关闭操作 */ + closeBtn?: { + type: BooleanConstructor; + value: false; + }; + /** + * 隐藏/显示预览 + * @default false + */ + visible?: { + type: BooleanConstructor; + value?: boolean; + }; + /** + * 隐藏/显示预览,非受控属性 + * @default false + */ + defaultVisible?: { + type: BooleanConstructor; + value?: boolean; + }; +} From 326332324e6d600b321624f72b0b505819a6d4c0 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Thu, 28 Apr 2022 10:46:01 +0800 Subject: [PATCH 0011/1046] chore(site): add noticebar --- site/site.config.mjs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/site/site.config.mjs b/site/site.config.mjs index 0463214b1..6ca11694d 100644 --- a/site/site.config.mjs +++ b/site/site.config.mjs @@ -371,13 +371,13 @@ export default { path: '/miniprogram/components/message', component: () => import('@/message/README.md'), }, - // { - // title: 'NoticeBar 公告栏', - // name: 'noticebar', - // meta: { docType: 'message' }, - // path: '/miniprogram/components/noticebar', - // component: () => import('@/noticebar/README.md'), - // }, + { + title: 'NoticeBar 公告栏', + name: 'noticebar', + meta: { docType: 'message' }, + path: '/miniprogram/components/noticebar', + component: () => import('@/noticebar/README.md'), + }, { title: 'Overlay 遮罩层', name: 'overlay', From 996cce5e61c132da34322cd6f05743c1d73a48b9 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Thu, 28 Apr 2022 11:32:45 +0800 Subject: [PATCH 0012/1046] feat(overlay): enrich properties --- src/overlay/overlay.ts | 20 ++++++++++++++++++++ src/overlay/overlay.wxml | 13 +++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/overlay/overlay.ts b/src/overlay/overlay.ts index 928536594..38f6f7509 100644 --- a/src/overlay/overlay.ts +++ b/src/overlay/overlay.ts @@ -21,16 +21,36 @@ export default class Overlay extends SuperComponent { type: Number, value: 300, }, + + backgroundColor: { + type: String, + value: '', + }, + + preventScrollThrough: { + type: Boolean, + value: true, + }, }; data = { prefix, classPrefix: name, + computedStyle: '', + }; + + observers = { + backgroundColor(v) { + this.setData({ + computedStyle: `; background-color: ${v}`, + }); + }, }; methods = { handleClick() { this.triggerEvent('click', { visible: !this.properties.visible }); }, + noop() {}, }; } diff --git a/src/overlay/overlay.wxml b/src/overlay/overlay.wxml index d91514ddd..a52d6a252 100644 --- a/src/overlay/overlay.wxml +++ b/src/overlay/overlay.wxml @@ -1,7 +1,16 @@ + + + From a058636789e20d699efb08f42eb8c4a91d37a8a7 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Thu, 28 Apr 2022 11:34:16 +0800 Subject: [PATCH 0013/1046] feat(toast): support overlay --- src/toast/README.md | 23 ++++++++++++----------- src/toast/props.ts | 11 ++++++++++- src/toast/toast.json | 3 ++- src/toast/toast.wxml | 7 +++++++ src/toast/type.ts | 27 +++++++++++++++++---------- 5 files changed, 48 insertions(+), 23 deletions(-) diff --git a/src/toast/README.md b/src/toast/README.md index 18f10e6c8..8754e74fb 100644 --- a/src/toast/README.md +++ b/src/toast/README.md @@ -130,16 +130,17 @@ Toast({ ``` ## API - ### Toast Props -| 名称 | 类型 | 默认值 | 说明 | 必传 | -| ---------------------- | ------------- | ------ | ---------------------------------------- | ---- | -| direction | String | row | 图标排列方式。可选项:`row`/`column` | N | -| duration | Number | 2000 | 弹窗显示毫秒数 | N | -| external-classes | Array | - | 组件类名。`['t-class']` | N | -| icon | String | - | 自定义图标 | N | -| message | String / Slot | - | 弹窗显示文字 | N | -| placement | String | middle | 弹窗展示位置。可选项: `top`/`middle`/`bottom` | N | -| prevent-scroll-through | Boolean | false | 防止滚动穿透,即不允许点击和滚动 | N | -| theme | String | - | 提示类型。可选项:`loading`/`success`/`fail` | N | +名称 | 类型 | 默认值 | 说明 | 必传 +-- | -- | -- | -- | -- +direction | String | row | 图标排列方式。可选项:row/column | N +duration | Number | 2000 | 弹窗显示毫秒数 | N +external-classes | Array | - | 组件类名。`['t-class']` | N +icon | String | - | 自定义图标 | N +message | String / Slot | - | 弹窗显示文字 | N +overlay-props | Object | {} | 遮罩层属性,透传至 Overlay | N +placement | String | middle | 弹窗展示位置。可选项: top/middle/bottom | N +prevent-scroll-through | Boolean | false | 防止滚动穿透,即不允许点击和滚动 | N +show-overlay | Boolean | true | 是否显示遮罩层 | N +theme | String | - | 提示类型。可选项:loading/success/fail | N diff --git a/src/toast/props.ts b/src/toast/props.ts index 63e4a932b..015f77ceb 100644 --- a/src/toast/props.ts +++ b/src/toast/props.ts @@ -2,7 +2,6 @@ /** * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC - * updated at 2021-11-24 10:58:05 * */ import { TdToastProps } from './type'; @@ -30,6 +29,11 @@ const props: TdToastProps = { message: { type: String, }, + /** 遮罩层属性,透传至 Overlay */ + overlayProps: { + type: Object, + value: {}, + }, /** 弹窗展示位置 */ placement: { type: String, @@ -40,6 +44,11 @@ const props: TdToastProps = { type: Boolean, value: false, }, + /** 是否显示遮罩层 */ + showOverlay: { + type: Boolean, + value: false, + }, /** 提示类型 */ theme: { type: String, diff --git a/src/toast/toast.json b/src/toast/toast.json index 708bd1bbd..b60dbbc48 100644 --- a/src/toast/toast.json +++ b/src/toast/toast.json @@ -2,6 +2,7 @@ "component": true, "usingComponents": { "t-icon": "../icon/icon", - "t-loading": "../loading/loading" + "t-loading": "../loading/loading", + "t-overlay": "../overlay/overlay" } } diff --git a/src/toast/toast.wxml b/src/toast/toast.wxml index cdda52fcd..d3f727f69 100644 --- a/src/toast/toast.wxml +++ b/src/toast/toast.wxml @@ -27,4 +27,11 @@ + diff --git a/src/toast/type.ts b/src/toast/type.ts index 8b240ca36..3ed2d78ce 100644 --- a/src/toast/type.ts +++ b/src/toast/type.ts @@ -2,7 +2,6 @@ /** * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC - * updated at 2021-11-24 10:58:05 * */ export interface TdToastProps { @@ -13,7 +12,6 @@ export interface TdToastProps { direction?: { type: StringConstructor; value?: 'row' | 'column'; - required?: boolean; }; /** * 弹窗显示毫秒数 @@ -22,7 +20,6 @@ export interface TdToastProps { duration?: { type: NumberConstructor; value?: number; - required?: boolean; }; /** * 组件类名 @@ -30,7 +27,6 @@ export interface TdToastProps { externalClasses?: { type: ArrayConstructor; value?: ['t-class']; - required?: boolean; }; /** * 自定义图标 @@ -39,7 +35,6 @@ export interface TdToastProps { icon?: { type: StringConstructor; value?: string; - required?: boolean; }; /** * 弹窗显示文字 @@ -47,7 +42,14 @@ export interface TdToastProps { message?: { type: StringConstructor; value?: string; - required?: boolean; + }; + /** + * 遮罩层属性,透传至 Overlay + * @default {} + */ + overlayProps?: { + type: ObjectConstructor; + value?: object; }; /** * 弹窗展示位置 @@ -56,7 +58,6 @@ export interface TdToastProps { placement?: { type: StringConstructor; value?: 'top' | 'middle' | 'bottom'; - required?: boolean; }; /** * 防止滚动穿透,即不允许点击和滚动 @@ -65,7 +66,14 @@ export interface TdToastProps { preventScrollThrough?: { type: BooleanConstructor; value?: boolean; - required?: boolean; + }; + /** + * 是否显示遮罩层 + * @default true + */ + showOverlay?: { + type: BooleanConstructor; + value?: boolean; }; /** * 提示类型 @@ -73,6 +81,5 @@ export interface TdToastProps { theme?: { type: StringConstructor; value?: 'loading' | 'success' | 'fail'; - required?: boolean; }; -}; +} From cf19fe7be3e48a31fb04f04e94f391ad0f89212b Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Thu, 28 Apr 2022 11:36:26 +0800 Subject: [PATCH 0014/1046] docs(overlay): update doc --- src/overlay/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/overlay/README.md b/src/overlay/README.md index a7f912a71..e7fa2e15d 100644 --- a/src/overlay/README.md +++ b/src/overlay/README.md @@ -45,6 +45,8 @@ Page({ visible | Boolean | false | 是否展示 | N zIndex | Number | 11000 | 遮罩层及 | N duration | Number | 300 | (暂不支持)背景色过渡时间,单位毫秒 | N +backgroundColor | String | - | 遮罩层的背景色 | N +preventScrollThrough | Boolean | true | 防止滚动穿透,即不允许点击和滚动 | N ### Overlay Events From 7ee284b8fb6a0b6fbaa68520e71d1cef104c3cc7 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Thu, 28 Apr 2022 14:44:27 +0800 Subject: [PATCH 0015/1046] fix(button): move default slot placement --- src/button/button.wxml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/button/button.wxml b/src/button/button.wxml index 4e6b37c93..d4432de84 100644 --- a/src/button/button.wxml +++ b/src/button/button.wxml @@ -28,9 +28,9 @@ - {{content}} + From 5b8c8fc2a5ddd6d01943af0af82bbb794ccd19ae Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Thu, 28 Apr 2022 15:33:28 +0800 Subject: [PATCH 0016/1046] fix(button): remove useless wrapper --- src/button/button.less | 9 +-------- src/button/button.wxml | 18 ++++++++---------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/button/button.less b/src/button/button.less index 4e7c36a1a..9a58135d6 100644 --- a/src/button/button.less +++ b/src/button/button.less @@ -83,13 +83,6 @@ opacity: 0.1; } - &__wrapper { - display: flex; - height: inherit; - align-items: center; - justify-content: center; - } - &--default { color: @button-default-color; background-color: @button-default-bg-color; @@ -298,7 +291,7 @@ &.@{prefix}-is { &-block { - display: block; + display: flex; width: 100%; } diff --git a/src/button/button.wxml b/src/button/button.wxml index d4432de84..b184ed966 100644 --- a/src/button/button.wxml +++ b/src/button/button.wxml @@ -22,15 +22,13 @@ bind:opensetting="opensetting" bind:launchapp="launchapp" > - - - - - - - - {{content}} - + + + + + + + {{content}} + - From bbda38361fd5b5f93e0cc9ed05d2ff4a3e174f01 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Thu, 28 Apr 2022 19:08:58 +0800 Subject: [PATCH 0017/1046] fix(datetime-picker): resolve default value --- .../date-time-picker/date-time-picker.wxml | 2 +- src/date-time-picker/date-time-picker.ts | 56 +++++++++++-------- src/date-time-picker/date-time-picker.wxml | 1 + src/picker/picker-item.ts | 6 +- 4 files changed, 37 insertions(+), 28 deletions(-) diff --git a/example/pages/date-time-picker/date-time-picker.wxml b/example/pages/date-time-picker/date-time-picker.wxml index 27e42774d..cf5f0bcd3 100644 --- a/example/pages/date-time-picker/date-time-picker.wxml +++ b/example/pages/date-time-picker/date-time-picker.wxml @@ -59,7 +59,7 @@ title="选择日期" visible="{{dateVisible}}" mode="{{['date']}}" - value="{{date}}" + defaultValue="{{date}}" format="YYYY-MM-DD" bindconfirm="onConfirm" bindcancel="hidePicker" diff --git a/src/date-time-picker/date-time-picker.ts b/src/date-time-picker/date-time-picker.ts index e9223b8e4..34661420e 100644 --- a/src/date-time-picker/date-time-picker.ts +++ b/src/date-time-picker/date-time-picker.ts @@ -1,11 +1,14 @@ import dayjs from 'dayjs'; import type { Dayjs } from 'dayjs'; +import config from '../common/config'; import { SuperComponent, wxComponent } from '../common/src/index'; import defaultLocale from './locale/zh'; import props from './props'; import { DisableDateObj } from './type'; +const { prefix } = config; + /** * mode 数组 [日期选择器的最后一个时间点,时间选择器的最后一个时间点] @@ -54,12 +57,14 @@ const DEFAULT_MAX_DATE: Dayjs = dayjs('2030-12-31 23:59:59'); export default class DateTimePicker extends SuperComponent { properties = props; - externalClasses = ['t-class', 't-class-confirm', 't-class-cancel', 't-class-title']; + externalClasses = [`${prefix}-class`, `${prefix}-class-confirm`, `${prefix}-class-cancel`, `${prefix}-class-title`]; options = { multipleSlots: true, }; + initValue = null; + observers = { // value 变化需要同步 内部 date 实现受控属性 value() { @@ -72,9 +77,23 @@ export default class DateTimePicker extends SuperComponent { }); this.updateColumns(); }, + visible(v) { + if (v && this.initValue) { + const pikcerItems = this.selectAllComponents(`.${prefix}-picker-item-host`); + const parseDate = dayjs(this.initValue || DEFAULT_MIN_DATE); + + this.setData({ + date: parseDate, + }); + if (pikcerItems) { + pikcerItems.forEach((item) => item.updateColumns()); + } + } + }, }; data = { + prefix, date: null, columns: [], columnsValue: [], @@ -82,11 +101,21 @@ export default class DateTimePicker extends SuperComponent { locale: defaultLocale, }; + lifetimes = { + attached() { + const { value, defaultValue } = this.properties; + + if (value == null && defaultValue != null) { + this.initValue = defaultValue; + } + }, + }; + methods = { updateColumns() { - const { value } = this.properties; + const { value, defaultValue } = this.properties; - const parseDate = dayjs(value || DEFAULT_MIN_DATE); + const parseDate = dayjs(value || defaultValue || DEFAULT_MIN_DATE); this.setData({ date: parseDate, @@ -423,13 +452,6 @@ export default class DateTimePicker extends SuperComponent { date: newValue, }); - const { columns, columnsValue } = this.getValueCols(); - - this.setData({ - columns, - columnsValue, - }); - this.triggerEvent('column-change', { index: column, value }); this.triggerEvent('change', { value: date, formatValue: date.format(format) }); }, @@ -442,20 +464,6 @@ export default class DateTimePicker extends SuperComponent { }, onCancel() { - const { value } = this.properties; - const parseDate = dayjs(value || DEFAULT_MIN_DATE); - - this.setData({ - date: parseDate, - }); - - const { columns, columnsValue } = this.getValueCols(); - - this.setData({ - columns, - columnsValue, - }); - this.triggerEvent('cancel'); }, }; diff --git a/src/date-time-picker/date-time-picker.wxml b/src/date-time-picker/date-time-picker.wxml index 6dc514fc2..c73e343ff 100644 --- a/src/date-time-picker/date-time-picker.wxml +++ b/src/date-time-picker/date-time-picker.wxml @@ -11,6 +11,7 @@ Date: Thu, 28 Apr 2022 20:21:26 +0800 Subject: [PATCH 0018/1046] feat(image-viewer): unified close event parameters --- example/pages/image-viewer/image-viewer.ts | 28 +++++++++++--------- example/pages/image-viewer/image-viewer.wxml | 1 - src/image-viewer/README.md | 9 +++---- src/image-viewer/image-viewer.ts | 16 +++++------ src/image-viewer/image-viewer.wxml | 10 ++++--- 5 files changed, 33 insertions(+), 31 deletions(-) diff --git a/example/pages/image-viewer/image-viewer.ts b/example/pages/image-viewer/image-viewer.ts index 8aeffe30f..c7b1801c5 100644 --- a/example/pages/image-viewer/image-viewer.ts +++ b/example/pages/image-viewer/image-viewer.ts @@ -114,21 +114,23 @@ Page({ onClose(e: any) { const { - detail: { index }, - } = e; - Toast({ - context: this, - selector: '#t-toast', - message: `关闭第${index + 1}个`, - }); - }, - - onVisibleChange(e: any) { - const { - detail: { visible }, + detail: { trigger }, } = e; + if (trigger === 'overlay') { + Toast({ + context: this, + selector: '#t-toast', + message: '点击overlay关闭', + }); + } else if (trigger === 'button') { + Toast({ + context: this, + selector: '#t-toast', + message: `点击button关闭`, + }); + } this.setData({ - visible, + visible: false, }); }, }); diff --git a/example/pages/image-viewer/image-viewer.wxml b/example/pages/image-viewer/image-viewer.wxml index a5ea217de..a92e42df3 100644 --- a/example/pages/image-viewer/image-viewer.wxml +++ b/example/pages/image-viewer/image-viewer.wxml @@ -9,7 +9,6 @@ showIndex="{{showIndex}}" visible="{{visible}}" images="{{images}}" - bind:visible-change="onVisibleChange" bind:change="onChange" bind:delete="onDelete" bind:close="onClose" diff --git a/src/image-viewer/README.md b/src/image-viewer/README.md index 9205b5c3b..44c28b5b5 100644 --- a/src/image-viewer/README.md +++ b/src/image-viewer/README.md @@ -36,7 +36,7 @@ isComponent: true visible="{{visible}}" images="{{images}}" initialIndex="{{initialIndex}}" - bind:visible-change="onVisibleChange" + bind:close="onClose" bind:change="onChange" /> ``` @@ -51,7 +51,6 @@ isComponent: true visible="{{visible}}" images="{{images}}" initialIndex="{{initialIndex}}" - bind:visible-change="onVisibleChange" bind:change="onChange" bind:delete="onDelete" bind:close="onClose" @@ -66,7 +65,6 @@ isComponent: true visible="{{visible}}" images="{{images}}" initialIndex="{{initialIndex}}" - bind:visible-change="onVisibleChange" bind:change="onChange" /> 我是自定义的关闭内容 @@ -96,8 +94,7 @@ default-visible | Boolean | undefined | 隐藏/显示预览。非受控属性 | 名称 | 参数 | 描述 -- | -- | -- -visible-change | `(visible: Boolean)` | 当浮层隐藏或显示时触发。 change | `(index: Number)` | 翻页时回调 -close | `(index: Number)` | 关闭操作时触发 -delete | `(index: Number)` | 删除时触发 +close | `(trigger: 'overlay' | 'button' , visible: Boolean, index: Number)` | 点击操作按钮button或者overlay时触发 +delete | `(index: Number)` | 点击删除操作按钮时触发 diff --git a/src/image-viewer/image-viewer.ts b/src/image-viewer/image-viewer.ts index 26bf61b41..79ce39b5e 100644 --- a/src/image-viewer/image-viewer.ts +++ b/src/image-viewer/image-viewer.ts @@ -30,7 +30,7 @@ export default class ImageViewer extends SuperComponent { controlledProps = [ { key: 'visible', - event: 'visible-change', + event: 'close', }, ]; @@ -134,13 +134,13 @@ export default class ImageViewer extends SuperComponent { this._trigger('change', { index: current }); }, - onVisibleChange() { - const { visible } = this.data; - this._trigger('visible-change', { visible: !visible }); - }, - - onClose() { - this._trigger('close', { index: this.data.currentSwiperIndex }); + onClose(e: WechatMiniprogram.TouchEvent) { + const { + target: { + dataset: { source }, + }, + } = e; + this._trigger('close', { visible: false, trigger: source, index: this.data.currentSwiperIndex }); }, onDelete() { diff --git a/src/image-viewer/image-viewer.wxml b/src/image-viewer/image-viewer.wxml index a1838381b..2ce474e4c 100644 --- a/src/image-viewer/image-viewer.wxml +++ b/src/image-viewer/image-viewer.wxml @@ -13,7 +13,8 @@ wx:for="{{images}}" wx:key="index" class="{{classPrefix}}__preview-image" - bind:tap="onVisibleChange" + data-source="overlay" + bind:tap="onClose" > - + - {{currentSwiperIndex + 1}}/{{images.length}} + + {{currentSwiperIndex + 1}}/{{images.length}} + Date: Fri, 29 Apr 2022 08:54:55 +0800 Subject: [PATCH 0019/1046] docs(notice-bar): update --- site/site.config.mjs | 2 +- src/notice-bar/README.md | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/site/site.config.mjs b/site/site.config.mjs index 6ca11694d..dad580c03 100644 --- a/site/site.config.mjs +++ b/site/site.config.mjs @@ -376,7 +376,7 @@ export default { name: 'noticebar', meta: { docType: 'message' }, path: '/miniprogram/components/noticebar', - component: () => import('@/noticebar/README.md'), + component: () => import('@/notice-bar/README.md'), }, { title: 'Overlay 遮罩层', diff --git a/src/notice-bar/README.md b/src/notice-bar/README.md index 456d89c3d..2e625ecf4 100644 --- a/src/notice-bar/README.md +++ b/src/notice-bar/README.md @@ -19,7 +19,7 @@ isComponent: true ### 基础静态公告栏 ```xml - + ``` ### 带图标静态公告栏 @@ -27,7 +27,7 @@ isComponent: true - + ``` @@ -111,7 +111,7 @@ isComponent: true content="提示文字描述提示文字描述提示文字描述提示文字描述提示文字描述提示文字描述" /> - + 详情 - + ``` @@ -135,7 +135,7 @@ isComponent: true ### NoticeBar Props | 名称 | 类型 | 默认值 | 说明 | 必传 | -| ---- | ---- | ------ | ---- || +| ---- | ---- | ------ | ---- | -- | | content | String / Slot | - | 文本内容 | N | | extra | String / Slot | - | 右侧额外信息| N | | marquee | Boolean / Object | false | 跑马灯效果。speed 指速度控制;loop 指循环播放次数,值为 -1 表示循环播放,值为 0 表示不循环播放;delay 表示延迟多久开始播放。TS 类型:`boolean | DrawMarquee` `interface DrawMarquee { speed?: number; loop?: number; delay?: number }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/notice-bar/type.ts) | N | From ca3cb22ddb35c58299feed00dcc158f05eee1c4a Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Fri, 29 Apr 2022 09:01:51 +0800 Subject: [PATCH 0020/1046] docs(notice-bar): update --- site/site.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/site.config.mjs b/site/site.config.mjs index dad580c03..70bbd01ab 100644 --- a/site/site.config.mjs +++ b/site/site.config.mjs @@ -375,7 +375,7 @@ export default { title: 'NoticeBar 公告栏', name: 'noticebar', meta: { docType: 'message' }, - path: '/miniprogram/components/noticebar', + path: '/miniprogram/components/notice-bar', component: () => import('@/notice-bar/README.md'), }, { From eb5571c2cc2173f597abaa7d410b6b7ce74c9d56 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Fri, 29 Apr 2022 09:22:52 +0800 Subject: [PATCH 0021/1046] docs(image-viewer): update --- site/site.config.mjs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/site/site.config.mjs b/site/site.config.mjs index 70bbd01ab..3d28eefb5 100644 --- a/site/site.config.mjs +++ b/site/site.config.mjs @@ -86,13 +86,6 @@ export default { path: '/miniprogram/components/drawer', component: () => import('@/drawer/README.md'), }, - // { - // title: 'ImageViewer 图片预览', - // name: 'image-viewer', - // meta: { docType: 'navigation' }, - // path: '/miniprogram/components/image-viewer', - // component: () => import('@/image-viewer/README.md'), - // }, { title: 'Indexes 索引', name: 'indexes', @@ -302,6 +295,13 @@ export default { path: '/miniprogram/components/image', component: () => import('@/image/README.md'), }, + { + title: 'ImageViewer 图片预览', + name: 'image-viewer', + meta: { docType: 'navigation' }, + path: '/miniprogram/components/image-viewer', + component: () => import('@/image-viewer/README.md'), + }, { title: 'Skeleton 骨架屏', name: 'skeleton', From 42970dd9c8641a96346ca5d751c9e1a0e89fa7e4 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Fri, 29 Apr 2022 17:02:15 +0800 Subject: [PATCH 0022/1046] fix(datetime-picker): optimize code --- src/date-time-picker/date-time-picker.ts | 14 +++----------- src/date-time-picker/date-time-picker.wxml | 1 - 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/date-time-picker/date-time-picker.ts b/src/date-time-picker/date-time-picker.ts index 34661420e..f4fdb09a5 100644 --- a/src/date-time-picker/date-time-picker.ts +++ b/src/date-time-picker/date-time-picker.ts @@ -78,16 +78,8 @@ export default class DateTimePicker extends SuperComponent { this.updateColumns(); }, visible(v) { - if (v && this.initValue) { - const pikcerItems = this.selectAllComponents(`.${prefix}-picker-item-host`); - const parseDate = dayjs(this.initValue || DEFAULT_MIN_DATE); - - this.setData({ - date: parseDate, - }); - if (pikcerItems) { - pikcerItems.forEach((item) => item.updateColumns()); - } + if (v) { + this.updateColumns(); } }, }; @@ -115,7 +107,7 @@ export default class DateTimePicker extends SuperComponent { updateColumns() { const { value, defaultValue } = this.properties; - const parseDate = dayjs(value || defaultValue || DEFAULT_MIN_DATE); + const parseDate = dayjs(this.initValue || value || defaultValue || DEFAULT_MIN_DATE); this.setData({ date: parseDate, diff --git a/src/date-time-picker/date-time-picker.wxml b/src/date-time-picker/date-time-picker.wxml index c73e343ff..6dc514fc2 100644 --- a/src/date-time-picker/date-time-picker.wxml +++ b/src/date-time-picker/date-time-picker.wxml @@ -11,7 +11,6 @@ Date: Fri, 29 Apr 2022 21:40:16 +0800 Subject: [PATCH 0023/1046] chore: publish v0.10.0 --- CHANGELOG.md | 21 +++++++++++++++++++++ package.json | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d20386bb9..0e8600647 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,27 @@ spline: explain toc: false docClass: timeline --- +## 0.10.0 `2022-4-29` + +### BREAKING CHANGES + +- Picker: 子组件名称从 `t-picker-column` 改成 `t-picker-item` [#392](https://github.com/Tencent/tdesign-miniprogram/pull/392) [@LeeJim](https://github.com/LeeJim) +- DateTimePicker: `value` 从非受控改成受控 [#413](https://github.com/Tencent/tdesign-miniprogram/pull/413) [@LeeJim](https://github.com/LeeJim) +### Bug Fixes + +- Drawer: 修复 `items` 标题无法显示的问题 [#388](https://github.com/Tencent/tdesign-miniprogram/pull/388) [@anlyyao](https://github.com/anlyyao) +- PullDownRefresh: 修复无法使用的问题 [#400](https://github.com/Tencent/tdesign-miniprogram/pull/400) [@LeeJim](https://github.com/LeeJim) +- Toast: 更正 `Loading` 标志的颜色 [#405](https://github.com/Tencent/tdesign-miniprogram/pull/405) [@LeeJim](https://github.com/LeeJim) +- DateTimePicker: 修复 `defaultValue` 无法使用的问题 [#413](https://github.com/Tencent/tdesign-miniprogram/pull/413) [@LeeJim](https://github.com/LeeJim) + +### Features + +- Overlay: 新增遮罩层组件 [#407](https://github.com/Tencent/tdesign-miniprogram/pull/407) [@LeeJim](https://github.com/LeeJim) +- ImageViewer: 新增图片预览组件 [#408](https://github.com/Tencent/tdesign-miniprogram/pull/408) [@NuoHui](https://github.com/NuoHui) +- Tabs: 新增 `click` 事件 [#384](https://github.com/Tencent/tdesign-miniprogram/pull/384) [@JJunYang](https://github.com/JJunYang) +- Grid: 新增 default `slot` [#395](https://github.com/Tencent/tdesign-miniprogram/pull/395) [@LeeJim](https://github.com/LeeJim) +- Loading: 新增 `inheritColor` 属性,加载标志的颜色继承外部 [#404](https://github.com/Tencent/tdesign-miniprogram/pull/404) [@LeeJim](https://github.com/LeeJim) +- Toast: 新增遮罩层,通过 `showOverlay` 和 `overlayProps` 控制 [#409](https://github.com/Tencent/tdesign-miniprogram/pull/409) [@LeeJim](https://github.com/LeeJim) ## 0.9.0 `2022-4-21` diff --git a/package.json b/package.json index 6c8494a48..db93ab000 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tdesign-miniprogram", "purename": "tdesign", - "version": "0.9.0", + "version": "0.10.0", "description": "tdesign-miniprogram", "title": "tdesign-miniprogram", "main": "miniprogram_dist/index.js", @@ -108,4 +108,4 @@ "dependencies": { "dayjs": "^1.10.7" } -} +} \ No newline at end of file From 523311322d1536c15f41b06b28bbeb1b5a849209 Mon Sep 17 00:00:00 2001 From: Peter Qiu <273743552@qq.com> Date: Fri, 29 Apr 2022 23:16:49 +0800 Subject: [PATCH 0024/1046] chore(site): update --- site/docs/overview.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/site/docs/overview.md b/site/docs/overview.md index 6a604b94c..8b98c81ba 100644 --- a/site/docs/overview.md +++ b/site/docs/overview.md @@ -174,7 +174,7 @@ spline: explain -

数据展示14

+

数据展示15

- +
- +

ImageViewer 图片预览

@@ -300,7 +300,7 @@ spline: explain

消息提醒10

- +

ActionSheet 动作面板

From 9fbc41c257b59db353f0885c8a65762a9df9eb50 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Thu, 5 May 2022 14:36:41 +0800 Subject: [PATCH 0027/1046] fix(tabs): remove not work label slot --- src/tabs/README.md | 2 +- src/tabs/tabs.wxml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tabs/README.md b/src/tabs/README.md index f9077a4e8..9bfbe5a2b 100644 --- a/src/tabs/README.md +++ b/src/tabs/README.md @@ -113,6 +113,6 @@ change | `(value: TabValue)` | 激活的选项卡发生变化时触发 -- | -- | -- | -- | -- destroy-on-hide | Boolean | true | 选项卡内容隐藏时是否销毁 | N disabled | Boolean | false | 是否禁用当前选项卡 | N -label | String / Slot | - | 选项卡名称,可自定义选项卡导航内容 | N +label | String | - | 选项卡名称 | N panel | String / Slot | - | 用于自定义选项卡面板内容 | N value | String / Number | - | 选项卡的值,唯一标识。TS 类型:`TabValue` | N diff --git a/src/tabs/tabs.wxml b/src/tabs/tabs.wxml index da2477944..e9c5e791f 100644 --- a/src/tabs/tabs.wxml +++ b/src/tabs/tabs.wxml @@ -10,7 +10,6 @@ bind:tap="onTabTap" > {{item.label}} - From 3b4ccf4723b2c55bab2fd385812855e2b9947e38 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Sun, 24 Apr 2022 15:20:27 +0800 Subject: [PATCH 0028/1046] refactor: remove segmented-control component --- .wechatide.ib.json | 34 -------- example/app.json | 4 +- example/pages/home/data/nav.ts | 4 - .../segmented-control/segmented-control.json | 3 - .../segmented-control/segmented-control.less | 9 -- .../segmented-control/segmented-control.ts | 19 ----- .../segmented-control/segmented-control.wxml | 49 ----------- site/site.config.mjs | 7 -- src/segmented-control/README.md | 85 ------------------- src/segmented-control/segmented-control.json | 3 - src/segmented-control/segmented-control.less | 1 - src/segmented-control/segmented-control.ts | 39 --------- src/segmented-control/segmented-control.wxml | 14 --- 13 files changed, 1 insertion(+), 270 deletions(-) delete mode 100644 example/pages/segmented-control/segmented-control.json delete mode 100644 example/pages/segmented-control/segmented-control.less delete mode 100644 example/pages/segmented-control/segmented-control.ts delete mode 100644 example/pages/segmented-control/segmented-control.wxml delete mode 100644 src/segmented-control/README.md delete mode 100644 src/segmented-control/segmented-control.json delete mode 100644 src/segmented-control/segmented-control.less delete mode 100644 src/segmented-control/segmented-control.ts delete mode 100644 src/segmented-control/segmented-control.wxml diff --git a/.wechatide.ib.json b/.wechatide.ib.json index 3db83e12e..56f443130 100644 --- a/.wechatide.ib.json +++ b/.wechatide.ib.json @@ -3521,40 +3521,6 @@ "t-icon": "../icon/icon" } }, - { - "key": "t-segmented-control", - "label": "分段器", - "icon": "", - "properties": [ - { - "key": "list", - "type": [ - "Array" - ], - "defaultValue": "", - "desc": "分段器选项", - "label": "" - }, - { - "key": "value", - "type": [ - "String", - "Number", - "Array" - ], - "defaultValue": "", - "desc": "选中值", - "label": "" - } - ], - "events": [ - { - "key": "change", - "desc": "选中值变化时触发", - "label": "" - } - ] - }, { "key": "t-skeleton", "label": "骨架屏", diff --git a/example/app.json b/example/app.json index b2cb9c8ba..20a5a2de1 100644 --- a/example/app.json +++ b/example/app.json @@ -20,7 +20,6 @@ "pages/textarea/textarea", "pages/message/message", "pages/toast/toast", - "pages/segmented-control/segmented-control", "pages/stepper/stepper", "pages/slider/slider", "pages/radio/radio", @@ -85,7 +84,6 @@ "t-message": "tdesign-miniprogram/message/message", "t-toast": "tdesign-miniprogram/toast/toast", "t-overlay": "tdesign-miniprogram/overlay/overlay", - "t-segmented-control": "tdesign-miniprogram/segmented-control/segmented-control", "t-stepper": "tdesign-miniprogram/stepper/stepper", "t-slider": "tdesign-miniprogram/slider/slider", "t-tag": "tdesign-miniprogram/tag/tag", @@ -137,4 +135,4 @@ "navigationBarTextStyle": "black" }, "sitemapLocation": "sitemap.json" -} +} \ No newline at end of file diff --git a/example/pages/home/data/nav.ts b/example/pages/home/data/nav.ts index 466202f5f..264474fed 100644 --- a/example/pages/home/data/nav.ts +++ b/example/pages/home/data/nav.ts @@ -14,10 +14,6 @@ const nav = { name: 'Navbar', label: '导航栏', }, - // { - // name: 'SegmentedControl', - // label: '分段器', - // }, { name: 'Steps', label: '步骤条', diff --git a/example/pages/segmented-control/segmented-control.json b/example/pages/segmented-control/segmented-control.json deleted file mode 100644 index 373529d22..000000000 --- a/example/pages/segmented-control/segmented-control.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "navigationBarTitleText": "SegmentedControl 分段器" -} diff --git a/example/pages/segmented-control/segmented-control.less b/example/pages/segmented-control/segmented-control.less deleted file mode 100644 index 156b94b7d..000000000 --- a/example/pages/segmented-control/segmented-control.less +++ /dev/null @@ -1,9 +0,0 @@ -.segmented-control-wrapper { - padding: 4px; -} - -.segmented-control-content { - padding-top: 8px; - font-size: 12px; - text-align: center; -} diff --git a/example/pages/segmented-control/segmented-control.ts b/example/pages/segmented-control/segmented-control.ts deleted file mode 100644 index 0568aba8b..000000000 --- a/example/pages/segmented-control/segmented-control.ts +++ /dev/null @@ -1,19 +0,0 @@ -Page({ - data: { - list1: [{ text: '项目一' }, { text: '项目二' }], - list2: [ - { text: '项目A', value: 'item_1' }, - { text: '项目B', value: 'item_2' }, - ], - currentValue: -1, - currentValue2: '', - }, - onChange(event) { - console.log(`点击: ${event.detail}`); - this.setData({ currentValue: event.detail }); - }, - onChange2(event) { - console.log(`点击: ${event.detail}`); - this.setData({ currentValue2: event.detail }); - }, -}); diff --git a/example/pages/segmented-control/segmented-control.wxml b/example/pages/segmented-control/segmented-control.wxml deleted file mode 100644 index a98cc2186..000000000 --- a/example/pages/segmented-control/segmented-control.wxml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - 选项一的内容 - 选项二的内容 - - - - - - - - - - - 选项A的内容 - 选项B的内容 - - - - - - - - - - - - - - - - - - - - diff --git a/site/site.config.mjs b/site/site.config.mjs index 3d28eefb5..0bba09f1e 100644 --- a/site/site.config.mjs +++ b/site/site.config.mjs @@ -100,13 +100,6 @@ export default { path: '/miniprogram/components/navbar', component: () => import('@/navbar/README.md'), }, - // { - // title: 'SegmentedControl 分段器', - // name: 'segmented-control', - // meta: { docType: 'navigation' }, - // path: '/miniprogram/components/segmented-control', - // component: () => import('@/segmented-control/README.md'), - // }, { title: 'Steps 步骤条', name: 'steps', diff --git a/src/segmented-control/README.md b/src/segmented-control/README.md deleted file mode 100644 index a61aef0cb..000000000 --- a/src/segmented-control/README.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: SegmentedControl -description: 分段器。 -spline: navigation -isComponent: true ---- - -### 特性及兼容性 - -无 - -## 引入 - -### 引入组件 - -在 `app.json` 或 `page.json` 中引入组件: - -```json -"usingComponents": { - "t-segmented-control": "tdesign-miniprogram/segmented-control/segmented-control" -} -``` - -## 用法 - -### 组件方式 - -默认使用数组索引判断当前元素,若 `items` 的元素中存在 value 属性则使用该属性进行判断。 - -```html - - - - 选项一的内容 - 选项二的内容 - - - - - 选项A的内容 - 选项B的内容 - -``` - -```js -Page({ - data: { - list: [{ text: '项目一' }, { text: '项目二' }], - list: [ - { text: '项目A', value: 'item_1' }, - { text: '项目B', value: 'item_2' }, - ], - currentValue: -1, - currentValue2: '', - }, - onChange(event) { - this.setData({ currentValue: event.detail }); - }, - onChange2(event) { - this.setData({ currentValue2: event.detail }); - }, -}); -``` - -## API - -### Props - -| 属性 | 类型 | 默认值 | 必传 | 说明 | -| ----- | ------------- | -------- | ---- | ---- | ------------ | -| items | `Array` | [] | Y | 分段器的选项 | -| value | `String | Number` | - | N | 当前选中的值 | - -### Props items 参数 - -| 属性 | 类型 | 默认值 | 必传 | 说明 | -| ----- | -------- | ------- | ---- | -------------- | ------------ | -| text | `String` | - | Y | 选项显示的内容 | -| value | `String | Number` | - | N | 选项的标识符 | - -### Event - -| 事件名 | 说明 | 回调参数 | -| ------ | ---------------------------------------------------- | -------- | ------- | -| change | 选中变化时候触发,回调参数为 `item.value` 或数组索引 | `String | Number` | diff --git a/src/segmented-control/segmented-control.json b/src/segmented-control/segmented-control.json deleted file mode 100644 index 467ce2945..000000000 --- a/src/segmented-control/segmented-control.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "component": true -} diff --git a/src/segmented-control/segmented-control.less b/src/segmented-control/segmented-control.less deleted file mode 100644 index f026128a8..000000000 --- a/src/segmented-control/segmented-control.less +++ /dev/null @@ -1 +0,0 @@ -@import (css) '../common/index.wxss'; diff --git a/src/segmented-control/segmented-control.ts b/src/segmented-control/segmented-control.ts deleted file mode 100644 index 02ba774ef..000000000 --- a/src/segmented-control/segmented-control.ts +++ /dev/null @@ -1,39 +0,0 @@ -import TComponent from '../common/component'; -import config from '../common/config'; - -const { prefix } = config; -const name = `${prefix}-segmented-control`; - -TComponent({ - properties: { - value: { - type: String, - optionalTypes: [Number], - value: '', - observer: 'updateValue', - }, - items: { - type: Array, - value: [], - }, - }, - data: { - currentValue: null, - classPrefix: name, - classBasePrefix: prefix, - }, - methods: { - onTap(event: any) { - const { value } = event.currentTarget.dataset; - this.updateValue(value); - this.triggerEvent('change', value); - }, - updateValue(value) { - if ((this.data.items || []).some((item) => item.value === value)) { - this.setData({ currentValue: value }); - } else { - this.setData({ currentValue: +value }); - } - }, - }, -}); diff --git a/src/segmented-control/segmented-control.wxml b/src/segmented-control/segmented-control.wxml deleted file mode 100644 index e63791b41..000000000 --- a/src/segmented-control/segmented-control.wxml +++ /dev/null @@ -1,14 +0,0 @@ - - - - {{item.text}} - - - From f2fd2e6b698ced43315e5cd360c2549912f33a51 Mon Sep 17 00:00:00 2001 From: anlyyao Date: Fri, 6 May 2022 10:27:57 +0800 Subject: [PATCH 0029/1046] fix(tabbar): fix console warning && remove useless css --- src/tab-bar/tab-bar-item.less | 10 ++++------ src/tab-bar/tab-bar.less | 6 ------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/tab-bar/tab-bar-item.less b/src/tab-bar/tab-bar-item.less index 3c1496462..2f5585580 100644 --- a/src/tab-bar/tab-bar-item.less +++ b/src/tab-bar/tab-bar-item.less @@ -4,13 +4,11 @@ @tab-bar-height: 48px; @tab-bar-bg-color: @bg-color-block; @tab-bar-border-color: @border-level-1-color; -@tab-bar-hover-bg-color: rgba(0, 0, 0, .05); +@tab-bar-hover-bg-color: rgba(0, 0, 0, 0.05); @tab-bar-active-color: @primary-color; -@{item} { - height: 100%; - flex-basis: 0; - flex-grow: 1; +:host { + flex: 1; } .@{item} { @@ -133,7 +131,7 @@ pointer-events: none; top: 0; border-top: 1px solid #e6e6e6; - transform: scaleY(.5); + transform: scaleY(0.5); border-top-width: 1px; border-top-style: solid; border-top-color: @tab-bar-border-color; diff --git a/src/tab-bar/tab-bar.less b/src/tab-bar/tab-bar.less index d4aaaf81a..f6a2088b3 100644 --- a/src/tab-bar/tab-bar.less +++ b/src/tab-bar/tab-bar.less @@ -29,10 +29,4 @@ padding-bottom: constant(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom); } - - @{tab-bar-cls}-item:first-child { - &::before { - border: unset; - } - } } From 2bde5bd42108bf248db9eb2a9a5dd5c52c62400b Mon Sep 17 00:00:00 2001 From: Perisiguiendo <1987391831@qq.com> Date: Fri, 6 May 2022 15:02:27 +0800 Subject: [PATCH 0030/1046] fix(avatar): fix icon and text's size (#424) * fix(avatar): fix icon and text's size --- example/pages/avatar/avatar.less | 5 ----- src/avatar/README.md | 4 ++-- src/avatar/avatar-group.wxml | 5 +---- src/avatar/avatar.less | 30 +++++------------------------- src/avatar/avatar.wxs | 8 ++++---- src/avatar/type.ts | 13 ------------- 6 files changed, 12 insertions(+), 53 deletions(-) diff --git a/example/pages/avatar/avatar.less b/example/pages/avatar/avatar.less index 14fa1fbf3..7d87ea5dc 100644 --- a/example/pages/avatar/avatar.less +++ b/example/pages/avatar/avatar.less @@ -55,14 +55,9 @@ page { } .row-text-common { - // display: flex; text-align: center; } - .font-size-20 { - font-size: 40rpx; - } - .border-size { &-2 { border: 4rpx solid #fff; diff --git a/src/avatar/README.md b/src/avatar/README.md index 92515bbb7..ced5b46f8 100644 --- a/src/avatar/README.md +++ b/src/avatar/README.md @@ -112,7 +112,7 @@ onAddTap() { 名称 | 类型 | 默认值 | 说明 | 必传 -- | -- | -- | -- | -- alt | String | - | 头像替换文本,仅当图片加载失败时有效 | N -badge-props | Object | - | 头像右上角提示信息,继承 Badge 组件的全部特性。如:小红点,或者数字。TS 类型:`TdBadgeProps` `import { TdBadgeProps } from '@Badge'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/avatar/type.ts) | N +badge-props | Object | - | 头像右上角提示信息,继承 Badge 组件的全部特性。如:小红点,或者数字。TS 类型:`BadgeProps`,[Badge API Documents](./badge?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/avatar/type.ts) | N external-classes | Array | - | 组件类名,用于设置组件外层元素类名。`['t-class']` | N hide-on-load-failed | Boolean | false | 加载失败时隐藏图片 | N icon | String / Slot | - | 图标 | N @@ -124,7 +124,7 @@ size | String | - | 尺寸,示例值:small/medium/large/24px/38px 等,默 名称 | 参数 | 描述 -- | -- | -- -error | - | 图片加载失败时触发 +error | \- | 图片加载失败时触发 ### AvatarGroup Props diff --git a/src/avatar/avatar-group.wxml b/src/avatar/avatar-group.wxml index 13149f206..58a816b51 100644 --- a/src/avatar/avatar-group.wxml +++ b/src/avatar/avatar-group.wxml @@ -11,10 +11,7 @@ - {{collapseAvatar || '+N'}} diff --git a/src/avatar/avatar.less b/src/avatar/avatar.less index 59c9ef772..0e7844c36 100644 --- a/src/avatar/avatar.less +++ b/src/avatar/avatar.less @@ -1,14 +1,11 @@ @import '../common/style/index.less'; .@{prefix}-avatar { - font-weight: 600; - font-size: 28rpx; display: flex; align-items: center; justify-content: center; box-sizing: border-box; - overflow: hidden; - border-radius: 999rpx; + font-weight: 600; &__wrapper { float: left; @@ -37,22 +34,19 @@ &.@{prefix}-size-l { width: 128rpx; height: 128rpx; - font-weight: 600; - font-size: 36rpx; + font-size: 52rpx; } &.@{prefix}-size-m { width: 96rpx; height: 96rpx; - font-weight: 600; - font-size: 32rpx; + font-size: 40rpx; } &.@{prefix}-size-s { width: 64rpx; height: 64rpx; - font-weight: 600; - font-size: 24rpx; + font-size: 28rpx; } .@{prefix}-image, @@ -73,30 +67,16 @@ &__text, &__icon { + font-size: inherit; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; - border-radius: 999rpx; &:empty { width: 0; height: 0; } } - - &__icon--default { - &-l { - font-size: 64rpx; - } - - &-m { - font-size: 48rpx; - } - - &-s { - font-size: 32rpx; - } - } } diff --git a/src/avatar/avatar.wxs b/src/avatar/avatar.wxs index 2fd46cdde..d5383bb99 100644 --- a/src/avatar/avatar.wxs +++ b/src/avatar/avatar.wxs @@ -12,10 +12,10 @@ module.exports = { ]; return classNames.join(' '); }, - getAvatarSizePx: function (size) { - var isIncludePx = size.indexOf('px') > -1; - if (isIncludePx) { - return 'width:' + size + ';height:' + size + ';'; + getAvatarSizePx: function (size = 'medium') { + var pxIndex = size.indexOf('px'); + if (pxIndex > -1) { + return 'width:' + size + ';height:' + size + ';font-size:' + ((size.slice(0, pxIndex) / 8) * 3 + 2) + 'px;'; } }, getStyles: function (isShow, zIndex) { diff --git a/src/avatar/type.ts b/src/avatar/type.ts index f1dae25f2..157f51790 100644 --- a/src/avatar/type.ts +++ b/src/avatar/type.ts @@ -14,7 +14,6 @@ export interface TdAvatarProps { alt?: { type: StringConstructor; value?: string; - required?: boolean; }; /** * 头像右上角提示信息,继承 Badge 组件的全部特性。如:小红点,或者数字 @@ -22,7 +21,6 @@ export interface TdAvatarProps { badgeProps?: { type: ObjectConstructor; value?: BadgeProps; - required?: boolean; }; /** * 组件类名,用于设置组件外层元素类名 @@ -30,7 +28,6 @@ export interface TdAvatarProps { externalClasses?: { type: ArrayConstructor; value?: ['t-class']; - required?: boolean; }; /** * 加载失败时隐藏图片 @@ -39,7 +36,6 @@ export interface TdAvatarProps { hideOnLoadFailed?: { type: BooleanConstructor; value?: boolean; - required?: boolean; }; /** * 图标 @@ -47,7 +43,6 @@ export interface TdAvatarProps { icon?: { type: StringConstructor; value?: string; - required?: boolean; }; /** * 图片地址 @@ -56,7 +51,6 @@ export interface TdAvatarProps { image?: { type: StringConstructor; value?: string; - required?: boolean; }; /** * 形状 @@ -65,7 +59,6 @@ export interface TdAvatarProps { shape?: { type: StringConstructor; value?: ShapeEnum; - required?: boolean; }; /** * 尺寸,示例值:small/medium/large/24px/38px 等,默认为 large @@ -74,7 +67,6 @@ export interface TdAvatarProps { size?: { type: StringConstructor; value?: string; - required?: boolean; }; } @@ -86,7 +78,6 @@ export interface TdAvatarGroupProps { cascading?: { type: StringConstructor; value?: CascadingValue; - required?: boolean; }; /** * 头像数量超出时,会出现一个头像折叠元素。该元素内容可自定义。默认为 `+N`。示例:`+5`,`...`, `更多` @@ -94,7 +85,6 @@ export interface TdAvatarGroupProps { collapseAvatar?: { type: StringConstructor; value?: string; - required?: boolean; }; /** * 组件类名,用于设置组件外层元素类名 @@ -102,7 +92,6 @@ export interface TdAvatarGroupProps { externalClasses?: { type: ArrayConstructor; value?: ['t-class', 't-class-image', 't-class-content']; - required?: boolean; }; /** * 能够同时显示的最多头像数量 @@ -110,7 +99,6 @@ export interface TdAvatarGroupProps { max?: { type: NumberConstructor; value?: number; - required?: boolean; }; /** * 尺寸,示例值:small/medium/large/24px/38px 等。优先级低于 Avatar.size @@ -119,7 +107,6 @@ export interface TdAvatarGroupProps { size?: { type: StringConstructor; value?: string; - required?: boolean; }; } From 6401186a3e9bd3ad56e425964a6096e17117be9d Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Fri, 6 May 2022 15:46:11 +0800 Subject: [PATCH 0031/1046] docs(tab-bar): optimize usage guide --- example/pages/tab-bar/tab-bar.wxml | 31 ++-------- src/tab-bar/README.md | 96 ++++++++++++++---------------- 2 files changed, 51 insertions(+), 76 deletions(-) diff --git a/example/pages/tab-bar/tab-bar.wxml b/example/pages/tab-bar/tab-bar.wxml index 6ceae7e62..79002d346 100644 --- a/example/pages/tab-bar/tab-bar.wxml +++ b/example/pages/tab-bar/tab-bar.wxml @@ -11,13 +11,7 @@ bindchange="onChange" class="{{index===demoList_1.length-1?'':'mb-12'}}" > - + {{item.label}} @@ -44,24 +38,11 @@ {{item.label}} - - 文字 - - 文字 - - 文字 - - 文字 - + + 文字 + 文字 + 文字 + 文字 diff --git a/src/tab-bar/README.md b/src/tab-bar/README.md index 97e4cc1d7..d8c95d999 100644 --- a/src/tab-bar/README.md +++ b/src/tab-bar/README.md @@ -22,67 +22,61 @@ isComponent: true 文本标签栏,分为单层双层,可以自定义标签栏内容 - - ```html - - - - {{item.text}} + + + {{item.label}} ``` - +```js +Page({ + data: { + list: [{ + icon: 'home', + value: 'home', + label: '首页', + }, { + icon: 'user', + value: 'user', + label: '我的' + }] + } +}) +``` + +### 受控用法 + ```html - - - - {{item.text}} + + + {{item.label}} ``` - - -```html - - - - - {{item.text}} - - - +```js +Page({ + data: { + activeTab: 'home', + list: [{ + icon: 'home', + value: 'home', + label: '首页', + }, { + icon: 'user', + value: 'user', + label: '我的' + }] + }, + onChange(e) { + this.setData({ + activeTab: e.detail.value + }) + } +}) ``` ## API @@ -103,7 +97,7 @@ default-value | String / Number / Array | undefined | 当前选中标签的索 名称 | 参数 | 描述 -- | -- | -- -change | - | 选中标签切换时触发 +change | `(value: string | number)` | 选中标签切换时触发 ### TabBarItem Props From 361141d99a9bec470d46db817d592a934922f8f9 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Fri, 6 May 2022 15:47:14 +0800 Subject: [PATCH 0032/1046] docs(icon): enrich content --- package.json | 5 ++-- site/main.ts | 7 +++-- src/icon/README.md | 68 ++++++++++++++++++++++++++-------------------- 3 files changed, 46 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index db93ab000..c0a609369 100644 --- a/package.json +++ b/package.json @@ -106,6 +106,7 @@ ] }, "dependencies": { - "dayjs": "^1.10.7" + "dayjs": "^1.10.7", + "tdesign-icons-view": "^0.0.2" } -} \ No newline at end of file +} diff --git a/site/main.ts b/site/main.ts index 8921305cc..372a8b83d 100644 --- a/site/main.ts +++ b/site/main.ts @@ -10,6 +10,7 @@ import 'tdesign-site-components/lib/styles/style.css'; import 'tdesign-site-components/lib/styles/prism-theme.less'; import 'tdesign-site-components/lib/styles/prism-theme-dark.less'; -createApp(app) - .use(router) - .mount('#app'); +// import icons webcomponents +import 'tdesign-icons-view'; + +createApp(app).use(router).mount('#app'); diff --git a/src/icon/README.md b/src/icon/README.md index 9683b97e6..32e7fd043 100644 --- a/src/icon/README.md +++ b/src/icon/README.md @@ -21,44 +21,54 @@ isComponent: true ```html - + ``` ### 自定义图标 ```html - + ``` -自定义图标用法:`以`iconfont`为例` - -1. 准备自定义图标文件,文件后缀应为`.wxss`,如下方代码块所示。 - ```css - @font-face { - font-family: 'icon'; // 使用自定义的字体名称 - ··· - } - - .icon { - font-family: 'icon' !important; // 字体名称 - ··· - } - - .icon-a-0:before { // icon图标。注意FontClass前缀与font-family保持一致 - content: '\e64d'; - } - ··· - ``` - - 1.1 添加所需图标,下载图标。图标库一般会提供 `在线链接` 或者 `下载至本地` 等使用方式, `在线链接` 方式会指向一个 `.css` 文件,可以下载或复制其内容,将其修改成后缀名为 `.wxss` 的文件 - - 1.2 将 `.wxss` 文件中的 `FontClass/Symbol前缀` 与 `Font Family` 两项内容保持一致,如: `FontClass/Symbol` 前缀为 `icon-`,则 `Font Family` 为 `icon`。 - - 注:若是采用 `下载至本地` 方式,需关注 `.css` 和 `.ttf` 文件。由于微信小程序不支持处理 `ttf、woff、eot` 等文件,但支持 `base64`,所以需要将 `.ttf` 文件转换为 `base64` (借助转换工具(如[transfonter.org](https://transfonter.org/)),会得到一个 `stylesheet.css` 文件),然后将 `.css` 文件中的 `@font-face {}` 内容替换为 `stylesheet.css` 中的 `base64` 内容,最后将 `.css` 文件修改后缀为 `.wxss`, -2. 引入自定义图标。 - - 2.1 全局引入:在项目 `app.wxss`,使用 `@import` 引入上述的 `.wxss` 文件 - - 2.2 局部引入:在 `page` 对应的 `.wxss` 中,使用 `@import` 引入上述的 `.wxss` 文件 -3. 自定义图标的使用。 - - 3.1 `` 组件中的 `prefix` 属性值与第2步中设置的 `Font Family` 保持一致,即 `prefix="icon"`,`name` 属性值为自定义图标名称,如图标的 `className` 为 `icon-a-1h`,则 `name="a-1h"`。 +自定义图标用法,下面以 `iconfont` 为例 +#### 准备图标文件 + +文件后缀应为`.wxss`,如下方代码块所示: + +```css +@font-face { + font-family: 'icon'; // 使用自定义的字体名称 + ··· +} + +.icon { + font-family: 'icon' !important; // 字体名称 + ··· +} + +.icon-a-0:before { // icon 图标。注意 FontClass 前缀与 font-family 保持一致 + content: '\e64d'; +} +``` +- 添加所需图标,下载图标。图标库一般会提供 **在线链接** 或者 **下载至本地** 等使用方式。**在线链接** 方式会指向一个 `.css` 文件,可以下载或复制其内容,将其修改成后缀名为 `.wxss` 的文件 +- 将 `.wxss` 文件中的 `FontClass/Symbol前缀` 与 `Font Family` 两项内容保持一致,如: `FontClass/Symbol` 前缀为 `icon-`,则 `Font Family` 为 `icon`。 + +> 注:若是采用 `下载至本地` 方式,需关注 `.css` 和 `.ttf` 文件。由于微信小程序不支持处理 `ttf、woff、eot` 等文件,但支持 `base64`,所以需要将 `.ttf` 文件转换为 `base64` (可借助转换工具,如 [transfonter.org](https://transfonter.org/),会得到一个 `stylesheet.css` 文件),然后将 `.css` 文件中的 `@font-face {}` 内容替换为 `stylesheet.css` 中的 `base64` 内容,最后将 `.css` 文件修改后缀为 `.wxss` + +#### 引入自定义图标 + +- 全局引入:在项目 `app.wxss`,使用 `@import` 引入上述的 `.wxss` 文件 +- 局部引入:在 `page` 对应的 `.wxss` 中,使用 `@import` 引入上述的 `.wxss` 文件 + +#### 自定义图标的使用 + + `` 组件中的 `prefix` 属性值与前面设置的 `Font Family` 保持一致,即 `prefix="icon"`,`name` 属性值为自定义图标名称,如图标的 `className` 为 `icon-a-1h`,则 `name="a-1h"`。 + +### 全部图标 + + ## API From 3dac7724e4a90fdeb654d5d001400b26eff3af7e Mon Sep 17 00:00:00 2001 From: wangyang1213 <877593729@qq.com> Date: Sat, 7 May 2022 11:32:20 +0800 Subject: [PATCH 0033/1046] docs: modify the README.md of the indexes component (#427) --- src/indexes/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/indexes/README.md b/src/indexes/README.md index eb378cc07..31a607f35 100644 --- a/src/indexes/README.md +++ b/src/indexes/README.md @@ -43,7 +43,7 @@ Page({ }, onSelect(e) { const { indexes } = e.detail; - const group = this.data.groups[indexes[0]]; + const group = this.data.letter[indexes[0]]; const city = group.children[indexes[1]]; wx.showToast({ icon: 'none', title: `你选择了: ${group.title}>${city.title}` }); }, From 2d0c899e79c3c72a2c4e7089276b416fe283494b Mon Sep 17 00:00:00 2001 From: Y Date: Sat, 7 May 2022 14:17:56 +0800 Subject: [PATCH 0034/1046] fix: fix multiple components by console warning && remove useless css (#431) --- src/action-sheet/action-sheet.less | 4 ---- src/image-viewer/image-viewer.less | 11 ++++++----- src/image-viewer/image-viewer.wxml | 1 + src/picker/picker-item.less | 2 +- src/steps/step-item.less | 16 ++++++++++++---- src/steps/steps.less | 13 +------------ 6 files changed, 21 insertions(+), 26 deletions(-) diff --git a/src/action-sheet/action-sheet.less b/src/action-sheet/action-sheet.less index 2b104389c..586495520 100644 --- a/src/action-sheet/action-sheet.less +++ b/src/action-sheet/action-sheet.less @@ -61,10 +61,6 @@ width: @action-sheet-square-image-size; height: @action-sheet-square-image-size; padding: @action-sheet-square-image-padding; - image { - width: @action-sheet-square-image-size; - height: @action-sheet-square-image-size; - } } &-text { width: 100%; diff --git a/src/image-viewer/image-viewer.less b/src/image-viewer/image-viewer.less index 57d73c355..7b48f5064 100644 --- a/src/image-viewer/image-viewer.less +++ b/src/image-viewer/image-viewer.less @@ -39,11 +39,12 @@ position: absolute; top: 50%; transform: translateY(-50%); - image { - width: inherit !important; - height: inherit !important; - display: block; - } + } + + .t-class-image { + width: inherit !important; + height: inherit !important; + display: block; } &__nav { diff --git a/src/image-viewer/image-viewer.wxml b/src/image-viewer/image-viewer.wxml index 2ce474e4c..f5ac534f9 100644 --- a/src/image-viewer/image-viewer.wxml +++ b/src/image-viewer/image-viewer.wxml @@ -17,6 +17,7 @@ bind:tap="onClose" > Date: Sat, 7 May 2022 14:27:55 +0800 Subject: [PATCH 0035/1046] chore: update site component --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c0a609369..9d120ec96 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "standard-changelog": "^2.0.27", "stylelint": "^13.13.1", "tdesign-publish-cli": "^0.0.9", - "tdesign-site-components": "^0.9.9", + "tdesign-site-components": "^0.9.13", "typescript": "^4.5.2", "vite": "^2.7.6", "vite-plugin-tdoc": "^2.0.1", From d25b86bdefd11e24b43352270075b5dec0d3515a Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Sat, 7 May 2022 14:39:04 +0800 Subject: [PATCH 0036/1046] chore: publish v0.11.0 --- CHANGELOG.md | 17 +++++++++++++++++ package.json | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e8600647..998f5a139 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ spline: explain toc: false docClass: timeline --- + +## 0.11.0 `2022-5-7` + +### BREAKING CHANGES + +- Tabs: 不再支持 slot 类型的 `label` [#423](https://github.com/Tencent/tdesign-miniprogram/pull/423) [@LeeJim](https://github.com/LeeJim) + +### Bug Fixes + +- Picker: 修复滑动延迟的问题 [#415](https://github.com/Tencent/tdesign-miniprogram/pull/415) [@LeeJim](https://github.com/LeeJim) +- Avatar: 修复图标大小不随尺寸变化的问题 [#424](https://github.com/Tencent/tdesign-miniprogram/pull/424) [@Perisiguiendo](https://github.com/Perisiguiendo) +- Tabbar: 修复样式告警问题 [#426](https://github.com/Tencent/tdesign-miniprogram/pull/426) [@anlyyao](https://github.com/anlyyao) +- 修复样式告警问题: [#431](https://github.com/Tencent/tdesign-miniprogram/pull/431) [@anlyyao](https://github.com/anlyyao) + - ActionSheet + - ImageViewer + - Picker + - Steps ## 0.10.0 `2022-4-29` ### BREAKING CHANGES diff --git a/package.json b/package.json index 9d120ec96..3bac7c831 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tdesign-miniprogram", "purename": "tdesign", - "version": "0.10.0", + "version": "0.11.0", "description": "tdesign-miniprogram", "title": "tdesign-miniprogram", "main": "miniprogram_dist/index.js", @@ -109,4 +109,4 @@ "dayjs": "^1.10.7", "tdesign-icons-view": "^0.0.2" } -} +} \ No newline at end of file From 164f23f9a399ec9dc811eef1e0e7d46832dc42dd Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Sat, 7 May 2022 15:09:04 +0800 Subject: [PATCH 0037/1046] docs: update getting started document --- site/docs/getting-started.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/site/docs/getting-started.md b/site/docs/getting-started.md index 11ee687c1..5dc1b843a 100644 --- a/site/docs/getting-started.md +++ b/site/docs/getting-started.md @@ -34,14 +34,6 @@ npm i tdesign-miniprogram -S --production > 安装完之后,需要在微信开发者工具中对 npm 进行构建:`工具 - 构建 npm` -### 通过 Git Clone - -克隆到源代码之后,然后将 `tdesign-miniprogram` 目录拷贝到自己的项目中 - -```bash -git clone git@github.com:Tencent/tdesign-miniprogram.git -``` - ## 修改 app.json 将 `app.json` 中的 `"style": "v2"` 移除。 @@ -55,7 +47,7 @@ git clone git@github.com:Tencent/tdesign-miniprogram.git ```json { "usingComponents": { - "t-button": "tdesign-miniprogram/dist/button/index" + "t-button": "tdesign-miniprogram/button/button" } } ``` @@ -80,4 +72,4 @@ npm run dev ## 基础库版本 -最低基础库版本`^2.6.1` +最低基础库版本`^2.6.5` From 342f36d12061f9323f0d91c685e2985f1a3d3505 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Sat, 7 May 2022 17:12:34 +0800 Subject: [PATCH 0038/1046] feat(input): enrich props --- src/input/README.md | 27 +++++-- src/input/input.ts | 43 +++++----- src/input/input.wxml | 23 +++++- src/input/props.ts | 123 +++++++++++++++++++++++------ src/input/type.ts | 184 +++++++++++++++++++++++++++++++++++-------- 5 files changed, 313 insertions(+), 87 deletions(-) diff --git a/src/input/README.md b/src/input/README.md index f54e7b60a..b3c5fabff 100644 --- a/src/input/README.md +++ b/src/input/README.md @@ -58,16 +58,12 @@ isComponent: true 名称 | 类型 | 默认值 | 说明 | 必传 -- | -- | -- | -- | -- -adjust-position | Boolean | true | 键盘弹起时,是否自动上推页面 | N align | String | left | 文本内容位置,居左/居中/居右。可选项:left/center/right | N borderless | Boolean | false | 【讨论中】是否开启无边框模式 | N clearable | Boolean | false | 是否可清空 | N -confirm-hold | Boolean | false | 点击键盘右下角按钮时是否保持键盘不收起点 | N -confirm-type | String | done | 设置键盘右下角按钮的文字,仅在 type='text'时生效。可选项:send/search/next/go/done | N disabled | Boolean | false | 是否禁用输入框 | N error-message | String | - | 已废弃。错误提示文本,值为空不显示(废弃属性,如果需要,请更为使用 status 和 tips) | N external-classes | Array | - | 组件类名,用于设置组件外层元素、输入框、占位符、错误信息等元素类名。`['t-class', 't-class-input', 't-class-placeholder', 't-class-error-msg']` | N -focus | Boolean | false | 自动聚焦 | N format | Function | - | 【开发中】指定输入框展示值的格式。TS 类型:`InputFormatType` `type InputFormatType = (value: InputValue) => number | string`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/input/type.ts) | N label | String / Slot | - | 左侧文本 | N maxcharacter | Number | - | 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度。`maxcharacter` 和 `maxlength` 二选一使用 | N @@ -83,13 +79,34 @@ tips | String / Slot | - | 【开发中】输入框下方提示文本,会根 type | String | text | 输入框类型。可选项:text/number/idcard/digit/safe-password/password | N value | String / Number | - | 输入框的值。TS 类型:`InputValue` `type InputValue = string | number`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/input/type.ts) | N default-value | String / Number | undefined | 输入框的值。非受控属性。TS 类型:`InputValue` `type InputValue = string | number`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/input/type.ts) | N +password | Boolean | false | 是否是密码类型 | N +placeholder-style | String | - | 必需。指定 placeholder 的样式 | Y +placeholder-class | String | input-placeholder | 指定 placeholder 的样式类 | N +cursor-spacing | Number | 0 | 指定光标与键盘的距离,取 input 距离底部的距离和 cursor-spacing 指定的距离的最小值作为光标与键盘的距离 | N +auto-focus | Boolean | false | (即将废弃,请直接使用 focus )自动聚焦,拉起键盘 | N +focus | Boolean | false | 获取焦点 | N +confirm-type | String | done | 设置键盘右下角按钮的文字,仅在type='text'时生效。
具体释义:
`send` 右下角按钮为“发送”;
`search` 右下角按钮为“搜索”;
`next` 右下角按钮为“下一个”;
`go` 右下角按钮为“前往”;
`done` 右下角按钮为“完成”。
[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/input.html)。可选项:send/search/next/go/done | N +always-embed | Boolean | false | 强制 input 处于同层状态,默认 focus 时 input 会切到非同层状态 (仅在 iOS 下生效) | N +confirm-hold | Boolean | false | 点击键盘右下角按钮时是否保持键盘不收起 | N +cursor | Number | - | 必需。指定focus时的光标位置 | Y +selection-start | Number | -1 | 光标起始位置,自动聚集时有效,需与selection-end搭配使用 | N +selection-end | Number | -1 | 光标结束位置,自动聚集时有效,需与selection-start搭配使用 | N +adjust-position | Boolean | true | 键盘弹起时,是否自动上推页面 | N +hold-keyboard | Boolean | false | focus时,点击页面的时候不收起键盘 | N +safe-password-cert-path | String | - | 安全键盘加密公钥的路径,只支持包内路径 | N +safe-password-length | Number | - | 安全键盘输入密码长度 | N +safe-password-time-stamp | Number | - | 安全键盘加密时间戳 | N +safe-password-nonce | String | - | 安全键盘加密盐值 | N +safe-password-salt | String | - | 安全键盘计算hash盐值,若指定custom-hash 则无效 | N +safe-password-custom-hash | String | - | 安全键盘计算hash的算法表达式,如 `md5(sha1('foo' + sha256(sm3(password + 'bar'))))` | N ### Input Events 名称 | 参数 | 描述 -- | -- | -- blur | `(value: InputValue)` | 失去焦点时触发 -change | `(value: InputValue)` | 输入框值发生变化时触发 +change | `(value: InputValue, cursor: number, keyCode: number)` | 输入框值发生变化时触发 clear | - | 清空按钮点击时触发 enter | `(value: InputValue)` | 回车键按下时触发 focus | `(value: InputValue)` | 获得焦点时触发 +keyboardheightchange | `(height: number, duration: number)` | 键盘高度发生变化的时候触发此事件 diff --git a/src/input/input.ts b/src/input/input.ts index 5a3e5f4cc..7500c2b51 100644 --- a/src/input/input.ts +++ b/src/input/input.ts @@ -20,52 +20,55 @@ export default class Input extends SuperComponent { multipleSlots: true, // 在组件定义时的选项中启用多slot支持 }; - externalClasses = ['t-class', 't-class-input', 't-class-placeholder', 't-class-error-msg']; + externalClasses = [ + `${prefix}-class`, + `${prefix}-class-input`, + `${prefix}-class-placeholder`, + `${prefix}-class-error-msg`, + ]; behaviors = ['wx://form-field']; properties = props; - controlledProps = [ - { - key: 'value', - event: 'change', - }, - ]; - data = { + prefix, classPrefix: name, classBasePrefix: prefix, characterLength: 0, }; methods = { - onInput(event) { - const { value } = event.detail; + onInput(e) { + const { value, cursor, keyCode } = e.detail; const { maxcharacter } = this.properties; + if (maxcharacter && maxcharacter > 0 && !Number.isNaN(maxcharacter)) { const { characters = '', length = 0 } = getCharacterLength(value, maxcharacter); - this._trigger('change', { value: characters }); + this.triggerEvent('change', { value: characters, cursor, keyCode }); this.setData({ characterLength: length, }); } else { - this._trigger('change', { value }); + this.triggerEvent('change', { value, cursor, keyCode }); } }, - onFocus(event) { - this.triggerEvent('focus', event.detail); + onFocus(e) { + this.triggerEvent('focus', e.detail); }, - onBlur(event) { - this.triggerEvent('blur', event.detail); + onBlur(e) { + this.triggerEvent('blur', e.detail); }, - onConfirm(event) { - this.triggerEvent('enter', event.detail); + onConfirm(e) { + this.triggerEvent('enter', e.detail); }, - clearInput(event) { - this.triggerEvent('clear', event.detail); + clearInput(e) { + this.triggerEvent('clear', e.detail); this.setData({ value: '' }); }, + onKeyboardHeightChange(e) { + this.triggerEvent('keyboardheightchange', e.detail); + }, }; } diff --git a/src/input/input.wxml b/src/input/input.wxml index 0ad920017..d4a811cbb 100644 --- a/src/input/input.wxml +++ b/src/input/input.wxml @@ -1,5 +1,5 @@ @@ -12,19 +12,34 @@ maxlength="{{maxlength || -1}}" disabled="{{disabled}}" placeholder="{{placeholder}}" - placeholder-class="{{classPrefix}}__placeholder t-class-placeholder" + placeholderStyle="{{placeholderStyle}}" + placeholder-class="{{classPrefix}}__placeholder t-class-placeholder {{placeholderClass}}" model:value="{{value}}" bindinput="onInput" bindfocus="onFocus" bindblur="onBlur" bindconfirm="onConfirm" + bind:keyboardheightchange="onKeyboardHeightChange" password="{{type === 'password'}}" type="{{type === 'password' ? 'text' : type}}" focus="{{focus}}" confirm-type="{{confirmType}}" confirm-hold="{{confirmHold}}" + cursor="{{cursor}}" + cursor-spacing="{{cursorSpacing}}" adjust-position="{{adjustPosition}}" - class="{{classPrefix}}__control {{suffix || align ==='right' ? classPrefix + '__control--right':''}} {{align === 'center' ? classPrefix + '__control--center':''}} t-class-input" + auto-focus="{{autoFocus}}" + always-embed="{{alwaysEmbed}}" + selection-start="{{selectionStart}}" + selection-end="{{selectionEnd}}" + hold-keyboard="{{holdKeyboard}}" + safe-password-cert-path="{{safePasswordCertPath}}" + safe-password-length="{{safePasswordLength}}" + safe-password-time-stamp="{{safePasswordTimeStamp}}" + safe-password-nonce="{{safePasswordNonce}}" + safe-password-salt="{{safePasswordSalt}}" + safe-password-custom-hash="{{safePasswordCustomHash}}" + class="{{classPrefix}}__control {{suffix || align ==='right' ? classPrefix + '__control--right':''}} {{align === 'center' ? classPrefix + '__control--center':''}} {{prefix}}-class-input" /> {{errorMessage}} diff --git a/src/input/props.ts b/src/input/props.ts index d045c0195..369dc03f0 100644 --- a/src/input/props.ts +++ b/src/input/props.ts @@ -6,11 +6,6 @@ import { TdInputProps } from './type'; const props: TdInputProps = { - /** 键盘弹起时,是否自动上推页面 */ - adjustPosition: { - type: Boolean, - value: true, - }, /** 文本内容位置,居左/居中/居右 */ align: { type: String, @@ -26,16 +21,6 @@ const props: TdInputProps = { type: Boolean, value: false, }, - /** 点击键盘右下角按钮时是否保持键盘不收起点 */ - confirmHold: { - type: Boolean, - value: false, - }, - /** 设置键盘右下角按钮的文字,仅在 type='text'时生效 */ - confirmType: { - type: String, - value: 'done', - }, /** 是否禁用输入框 */ disabled: { type: Boolean, @@ -50,11 +35,6 @@ const props: TdInputProps = { externalClasses: { type: Array, }, - /** 自动聚焦 */ - focus: { - type: Boolean, - value: false, - }, /** 【开发中】指定输入框展示值的格式 */ format: { type: null, @@ -93,6 +73,7 @@ const props: TdInputProps = { /** 输入框状态 */ status: { type: String, + value: 'default', }, /** 后置图标前的后置内容 */ suffix: { @@ -106,11 +87,6 @@ const props: TdInputProps = { tips: { type: String, }, - /** 输入框类型 */ - type: { - type: String, - value: 'text', - }, /** 输入框的值 */ value: { type: String, @@ -122,6 +98,103 @@ const props: TdInputProps = { type: String, optionalTypes: [Number], }, + /** input 的类型。
具体释义:
`text` 文本输入键盘;
`number` 数字输入键盘;
`idcard` 身份证输入键盘;
`digit` 带小数点的数字键盘;
`safe-password` 密码安全输入键盘
指引
`nickname` 昵称输入键盘。
[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/input.html) */ + type: { + type: String, + value: 'text', + }, + /** 指定 placeholder 的样式 */ + placeholderStyle: { + type: String, + value: '', + }, + /** 指定 placeholder 的样式类 */ + placeholderClass: { + type: String, + value: 'input-placeholder', + }, + /** 指定光标与键盘的距离,取 input 距离底部的距离和 cursor-spacing 指定的距离的最小值作为光标与键盘的距离 */ + cursorSpacing: { + type: Number, + value: 0, + }, + /** (即将废弃,请直接使用 focus )自动聚焦,拉起键盘 */ + autoFocus: { + type: Boolean, + value: false, + }, + /** 获取焦点 */ + focus: { + type: Boolean, + value: false, + }, + /** 设置键盘右下角按钮的文字,仅在type='text'时生效。
具体释义:
`send` 右下角按钮为“发送”;
`search` 右下角按钮为“搜索”;
`next` 右下角按钮为“下一个”;
`go` 右下角按钮为“前往”;
`done` 右下角按钮为“完成”。
[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/input.html) */ + confirmType: { + type: String, + value: 'done', + }, + /** 强制 input 处于同层状态,默认 focus 时 input 会切到非同层状态 (仅在 iOS 下生效) */ + alwaysEmbed: { + type: Boolean, + value: false, + }, + /** 点击键盘右下角按钮时是否保持键盘不收起 */ + confirmHold: { + type: Boolean, + value: false, + }, + /** 指定focus时的光标位置 */ + cursor: { + type: Number, + }, + /** 光标起始位置,自动聚集时有效,需与selection-end搭配使用 */ + selectionStart: { + type: Number, + value: -1, + }, + /** 光标结束位置,自动聚集时有效,需与selection-start搭配使用 */ + selectionEnd: { + type: Number, + value: -1, + }, + /** 键盘弹起时,是否自动上推页面 */ + adjustPosition: { + type: Boolean, + value: true, + }, + /** focus时,点击页面的时候不收起键盘 */ + holdKeyboard: { + type: Boolean, + value: false, + }, + /** 安全键盘加密公钥的路径,只支持包内路径 */ + safePasswordCertPath: { + type: String, + value: '', + }, + /** 安全键盘输入密码长度 */ + safePasswordLength: { + type: Number, + }, + /** 安全键盘加密时间戳 */ + safePasswordTimeStamp: { + type: Number, + }, + /** 安全键盘加密盐值 */ + safePasswordNonce: { + type: String, + value: '', + }, + /** 安全键盘计算hash盐值,若指定custom-hash 则无效 */ + safePasswordSalt: { + type: String, + value: '', + }, + /** 安全键盘计算hash的算法表达式,如 `md5(sha1('foo' + sha256(sm3(password + 'bar'))))` */ + safePasswordCustomHash: { + type: String, + value: '', + }, }; export default props; diff --git a/src/input/type.ts b/src/input/type.ts index 6d56d4102..3b96a2bd9 100644 --- a/src/input/type.ts +++ b/src/input/type.ts @@ -5,14 +5,6 @@ * */ export interface TdInputProps { - /** - * 键盘弹起时,是否自动上推页面 - * @default true - */ - adjustPosition?: { - type: BooleanConstructor; - value?: boolean; - }; /** * 文本内容位置,居左/居中/居右 * @default left @@ -37,22 +29,6 @@ export interface TdInputProps { type: BooleanConstructor; value?: boolean; }; - /** - * 点击键盘右下角按钮时是否保持键盘不收起点 - * @default false - */ - confirmHold?: { - type: BooleanConstructor; - value?: boolean; - }; - /** - * 设置键盘右下角按钮的文字,仅在 type='text'时生效 - * @default done - */ - confirmType?: { - type: StringConstructor; - value?: 'send' | 'search' | 'next' | 'go' | 'done'; - }; /** * 是否禁用输入框 * @default false @@ -77,14 +53,6 @@ export interface TdInputProps { type: ArrayConstructor; value?: ['t-class', 't-class-input', 't-class-placeholder', 't-class-error-msg']; }; - /** - * 自动聚焦 - * @default false - */ - focus?: { - type: BooleanConstructor; - value?: boolean; - }; /** * 【开发中】指定输入框展示值的格式 */ @@ -145,10 +113,11 @@ export interface TdInputProps { }; /** * 输入框状态 + * @default default */ status?: { type: StringConstructor; - value?: 'success' | 'warning' | 'error'; + value?: 'default' | 'success' | 'warning' | 'error'; }; /** * 后置图标前的后置内容 @@ -195,6 +164,155 @@ export interface TdInputProps { optionalTypes: Array; value?: InputValue; }; + /** + * 指定 placeholder 的样式 + * @default '' + */ + placeholderStyle: { + type: StringConstructor; + value?: string; + }; + /** + * 指定 placeholder 的样式类 + * @default input-placeholder + */ + placeholderClass?: { + type: StringConstructor; + value?: string; + }; + /** + * 指定光标与键盘的距离,取 input 距离底部的距离和 cursor-spacing 指定的距离的最小值作为光标与键盘的距离 + * @default 0 + */ + cursorSpacing?: { + type: NumberConstructor; + value?: number; + }; + /** + * (即将废弃,请直接使用 focus )自动聚焦,拉起键盘 + * @default false + */ + autoFocus?: { + type: BooleanConstructor; + value?: boolean; + }; + /** + * 获取焦点 + * @default false + */ + focus?: { + type: BooleanConstructor; + value?: boolean; + }; + /** + * 设置键盘右下角按钮的文字,仅在type='text'时生效。
具体释义:
`send` 右下角按钮为“发送”;
`search` 右下角按钮为“搜索”;
`next` 右下角按钮为“下一个”;
`go` 右下角按钮为“前往”;
`done` 右下角按钮为“完成”。
[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/input.html) + * @default done + */ + confirmType?: { + type: StringConstructor; + value?: 'send' | 'search' | 'next' | 'go' | 'done'; + }; + /** + * 强制 input 处于同层状态,默认 focus 时 input 会切到非同层状态 (仅在 iOS 下生效) + * @default false + */ + alwaysEmbed?: { + type: BooleanConstructor; + value?: boolean; + }; + /** + * 点击键盘右下角按钮时是否保持键盘不收起 + * @default false + */ + confirmHold?: { + type: BooleanConstructor; + value?: boolean; + }; + /** + * 指定focus时的光标位置 + */ + cursor: { + type: NumberConstructor; + value?: number; + }; + /** + * 光标起始位置,自动聚集时有效,需与selection-end搭配使用 + * @default -1 + */ + selectionStart?: { + type: NumberConstructor; + value?: number; + }; + /** + * 光标结束位置,自动聚集时有效,需与selection-start搭配使用 + * @default -1 + */ + selectionEnd?: { + type: NumberConstructor; + value?: number; + }; + /** + * 键盘弹起时,是否自动上推页面 + * @default true + */ + adjustPosition?: { + type: BooleanConstructor; + value?: boolean; + }; + /** + * focus时,点击页面的时候不收起键盘 + * @default false + */ + holdKeyboard?: { + type: BooleanConstructor; + value?: boolean; + }; + /** + * 安全键盘加密公钥的路径,只支持包内路径 + * @default '' + */ + safePasswordCertPath?: { + type: StringConstructor; + value?: string; + }; + /** + * 安全键盘输入密码长度 + */ + safePasswordLength?: { + type: NumberConstructor; + value?: number; + }; + /** + * 安全键盘加密时间戳 + */ + safePasswordTimeStamp?: { + type: NumberConstructor; + value?: number; + }; + /** + * 安全键盘加密盐值 + * @default '' + */ + safePasswordNonce?: { + type: StringConstructor; + value?: string; + }; + /** + * 安全键盘计算hash盐值,若指定custom-hash 则无效 + * @default '' + */ + safePasswordSalt?: { + type: StringConstructor; + value?: string; + }; + /** + * 安全键盘计算hash的算法表达式,如 `md5(sha1('foo' + sha256(sm3(password + 'bar'))))` + * @default '' + */ + safePasswordCustomHash?: { + type: StringConstructor; + value?: string; + }; } export type InputFormatType = (value: InputValue) => number | string; From bd32e722ceff148a360934b61056bcfbdec13046 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Mon, 9 May 2022 11:07:36 +0800 Subject: [PATCH 0039/1046] fix(picker): title align problem --- src/picker/README.md | 4 ++-- src/picker/picker.less | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/picker/README.md b/src/picker/README.md index bd23873b5..54d47161c 100644 --- a/src/picker/README.md +++ b/src/picker/README.md @@ -59,8 +59,8 @@ Page({ 名称 | 类型 | 默认值 | 说明 | 必传 -- | -- | -- | -- | -- -cancel-btn | String | 取消 | 取消按钮文字 | N -confirm-btn | String | 确认 | 确定按钮文字 | N +cancel-btn | String | '' | 取消按钮文字 | N +confirm-btn | String | '' | 确定按钮文字 | N footer | Slot | - | 底部内容 | N header | Boolean / Slot | true | 头部内容。值为 true 显示空白头部,值为 false 不显示任何内容,值类型为 TNode 表示自定义头部内容 | N title | String | '' | 标题 | N diff --git a/src/picker/picker.less b/src/picker/picker.less index b4953ee16..48b52870e 100644 --- a/src/picker/picker.less +++ b/src/picker/picker.less @@ -28,6 +28,11 @@ } &__title { + flex: 1; + text-align: center; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; color: @text-level-1-color; font-weight: @picker-font-weight; } From f81d7cf7bcb7dfec99262f92af064861caccf4d9 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Mon, 9 May 2022 11:24:46 +0800 Subject: [PATCH 0040/1046] fix(picker): simplify code and update docs --- src/picker/README.md | 4 ++-- src/picker/picker.ts | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/picker/README.md b/src/picker/README.md index 54d47161c..fe3ef93d1 100644 --- a/src/picker/README.md +++ b/src/picker/README.md @@ -72,9 +72,9 @@ visible | Boolean | false | 是否显示 | N 名称 | 参数 | 描述 -- | -- | -- -cancel | `({})` | 点击取消按钮时触发 +cancel | - | 点击取消按钮时触发 change | `(value: Array)` | 选中变化时候触发 -confirm | `({})` | 点击确认确认按钮时触发 +confirm | `(index: number, value: Array)` | 点击确认确认按钮时触发 ### PickerItem Props diff --git a/src/picker/picker.ts b/src/picker/picker.ts index 3ae70972c..50e8f8bd8 100644 --- a/src/picker/picker.ts +++ b/src/picker/picker.ts @@ -48,12 +48,10 @@ export default class Picker extends SuperComponent { return { index: undefined, value: undefined }; } - const selectedValues = { + return { index: pickerColumns.map((pickerColumn) => pickerColumn._selectedIndex), value: pickerColumns.map((pickerColumn) => pickerColumn._selectedValue), }; - - return selectedValues; }, onConfirm() { this.triggerEvent('confirm', this.getSelectedValues()); From 89e61503eb12af1359caf9e12ca87761fc6e461b Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Mon, 9 May 2022 18:45:27 +0800 Subject: [PATCH 0041/1046] chore: cache --- script/gulpfile.base.js | 18 ++++++++++++++++-- script/gulpfile.example.js | 20 ++++++++++++++++++-- script/gulpfile.js | 2 +- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/script/gulpfile.base.js b/script/gulpfile.base.js index 3cb76b6b8..87377ab51 100644 --- a/script/gulpfile.base.js +++ b/script/gulpfile.base.js @@ -43,7 +43,9 @@ module.exports = (src, dist, moduleName) => { }); // options - const srcOptions = { base: src, ignore: ['**/__test__', '**/__test__/**'] }; + const ignore = ['**/__test__', '**/__test__/**']; + if (moduleName !== 'demo') ignore.push('**/_example/**'); + const srcOptions = { base: src, ignore }; const watchOptions = { events: ['add', 'change'] }; const gulpErrorPath = 'example/utils/gulpError.js'; // 文件匹配路径 @@ -74,6 +76,11 @@ module.exports = (src, dist, moduleName) => { /* tasks */ const tasks = {}; + const moveDemo = gulpIf( + moduleName === 'demo', + rename((path) => (path.dirname = path.basename)), + ); + /** `gulp clear` * 清理文件 * */ @@ -100,6 +107,7 @@ module.exports = (src, dist, moduleName) => { gulp .src(globs.copy, { ...srcOptions, since: since(tasks.copy) }) .pipe(changed(dist)) // 过滤掉未改变的文件 + .pipe(moveDemo) .pipe(gulp.dest(dist)); /** `gulp ts` @@ -120,6 +128,7 @@ module.exports = (src, dist, moduleName) => { .pipe(tsProject()) // 编译ts .pipe(mpNpm()) .pipe(gulpIf(!isProduction, sourcemaps.write('.'))) + .pipe(moveDemo) .pipe(gulp.dest(dist)); /** `gulp js` @@ -143,7 +152,11 @@ module.exports = (src, dist, moduleName) => { /** `gulp json` * 处理json * */ - tasks.json = () => gulp.src(globs.json, { ...srcOptions, since: since(tasks.json) }).pipe(gulp.dest(dist)); + tasks.json = () => + gulp + .src(globs.json, { ...srcOptions, since: since(tasks.json) }) + .pipe(moveDemo) + .pipe(gulp.dest(dist)); /** `gulp less` * 处理less @@ -164,6 +177,7 @@ module.exports = (src, dist, moduleName) => { .pipe(gulpLess()) // 编译less .pipe(rename({ extname: '.wxss' })) .pipe(gulpIf(!isProduction, sourcemaps.write('.'))) + .pipe(moveDemo) .pipe(gulp.dest(dist)); /** `gulp wxss` diff --git a/script/gulpfile.example.js b/script/gulpfile.example.js index b5ef8788f..464dbf5bb 100644 --- a/script/gulpfile.example.js +++ b/script/gulpfile.example.js @@ -14,6 +14,22 @@ const dist = '_example'; /* base tasks */ const { clear, build: baseBuild, watch: baseWatch, handleError, resetError } = base(src, dist, 'example'); +const { build: demoBuild, watch: demoWatch } = base('src/*/_example', '_example/pages', 'demo'); + +// Demo +// const demoGlobs = 'src/*/_example/**'; +// const moveDemo = () => { +// return gulp +// .src(demoGlobs) +// .pipe( +// rename((path) => { +// path.dirname = path.basename; +// }), +// ) +// .pipe(gulp.dest('example/pages')); +// }; + +// const watchDemo = () => gulp.watch(demoGlobs, moveDemo); // 包装 gulp.lastRun, 引入文件 ctime 作为文件变动判断另一标准 // https://github.com/gulpjs/vinyl-fs/issues/226 @@ -39,7 +55,7 @@ watchDist.displayName = 'syncDist:watch'; /** `gulp build` * 构建 * */ -const build = gulp.series(baseBuild, syncDist); +const build = gulp.series(demoBuild, baseBuild, syncDist); /** `gulp task` * 编译app.less @@ -74,7 +90,7 @@ const watchCommonLess = () => { /** `gulp watch` * 监听 * */ -const watch = gulp.parallel(baseWatch, watchCommonLess, watchDist); +const watch = gulp.parallel(baseWatch, demoWatch, watchCommonLess, watchDist); // `gulp --tasks --gulpfile script/gulpfile.example.js` list tasks module.exports = { diff --git a/script/gulpfile.js b/script/gulpfile.js index 60308bdfe..4b7b6289a 100644 --- a/script/gulpfile.js +++ b/script/gulpfile.js @@ -1,8 +1,8 @@ const gulp = require('gulp'); +const rename = require('gulp-rename'); const dist = require('./gulpfile.dist'); const example = require('./gulpfile.example'); const wechatide = require('./gulpfile.wechatide'); - /** `gulp build` * 构建 * */ From 6188424ae067714b9a5cf278b886282820898b5a Mon Sep 17 00:00:00 2001 From: Peter Qiu <273743552@qq.com> Date: Tue, 10 May 2022 15:31:21 +0800 Subject: [PATCH 0042/1046] fix: resolve dependencies --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 3bac7c831..8e6943de8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tdesign-miniprogram", "purename": "tdesign", - "version": "0.11.0", + "version": "0.11.1", "description": "tdesign-miniprogram", "title": "tdesign-miniprogram", "main": "miniprogram_dist/index.js", @@ -84,6 +84,7 @@ "prismjs": "^1.24.1", "standard-changelog": "^2.0.27", "stylelint": "^13.13.1", + "tdesign-icons-view": "^0.1.0", "tdesign-publish-cli": "^0.0.9", "tdesign-site-components": "^0.9.13", "typescript": "^4.5.2", @@ -106,7 +107,6 @@ ] }, "dependencies": { - "dayjs": "^1.10.7", - "tdesign-icons-view": "^0.0.2" + "dayjs": "^1.10.7" } } \ No newline at end of file From b4cff9a2638882eb7f2bb7f5b7d4f46267b9573a Mon Sep 17 00:00:00 2001 From: Peter Qiu <273743552@qq.com> Date: Tue, 10 May 2022 15:35:07 +0800 Subject: [PATCH 0043/1046] chore: publish v0.11.1 --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 998f5a139..ac273703b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ toc: false docClass: timeline --- +## 0.11.1 `2022-5-10` + +### Bug Fixes + +- 依赖错误的问题 [#438](https://github.com/Tencent/tdesign-miniprogram/pull/438) [@LeeJim](https://github.com/LeeJim) + ## 0.11.0 `2022-5-7` ### BREAKING CHANGES @@ -13,7 +19,7 @@ docClass: timeline ### Bug Fixes -- Picker: 修复滑动延迟的问题 [#415](https://github.com/Tencent/tdesign-miniprogram/pull/415) [@LeeJim](https://github.com/LeeJim) +- Picker: 修复滑动延迟的问题 [#438](https://github.com/Tencent/tdesign-miniprogram/pull/415) [@LeeJim](https://github.com/LeeJim) - Avatar: 修复图标大小不随尺寸变化的问题 [#424](https://github.com/Tencent/tdesign-miniprogram/pull/424) [@Perisiguiendo](https://github.com/Perisiguiendo) - Tabbar: 修复样式告警问题 [#426](https://github.com/Tencent/tdesign-miniprogram/pull/426) [@anlyyao](https://github.com/anlyyao) - 修复样式告警问题: [#431](https://github.com/Tencent/tdesign-miniprogram/pull/431) [@anlyyao](https://github.com/anlyyao) From 6caa103395b9e61b193a689c21793506758a4567 Mon Sep 17 00:00:00 2001 From: Peter Qiu <273743552@qq.com> Date: Tue, 10 May 2022 18:39:21 +0800 Subject: [PATCH 0044/1046] build: move example to src --- .eslintrc.js | 2 +- .gitignore | 2 +- example/pages/back-top/back-top.wxml | 134 ------------------ example/pages/empty/empty-page.wxml | 10 -- .../action-sheet/_example}/action-sheet.json | 0 .../action-sheet/_example}/action-sheet.less | 0 .../action-sheet/_example}/action-sheet.ts | 0 .../action-sheet/_example}/action-sheet.wxml | 0 .../action-sheet/_example}/constants.ts | 0 .../avatar/_example}/avatar.json | 2 +- .../avatar/_example}/avatar.less | 0 .../avatar => src/avatar/_example}/avatar.ts | 0 .../avatar/_example}/avatar.wxml | 24 +--- .../back-top => src/back-top/_example}/api.md | 0 .../back-top/_example}/back-top.json | 0 .../back-top/_example}/back-top.less | 0 .../back-top/_example}/back-top.ts | 0 src/back-top/_example/back-top.wxml | 57 ++++++++ .../pages/badge => src/badge/_example}/api.md | 0 .../badge => src/badge/_example}/badge.json | 0 .../badge => src/badge/_example}/badge.less | 0 .../badge => src/badge/_example}/badge.ts | 0 .../badge => src/badge/_example}/badge.wxml | 8 +- .../button-group/_example}/button-group.json | 0 .../button-group/_example}/button-group.less | 0 .../button-group/_example}/button-group.ts | 0 .../button-group/_example}/button-group.wxml | 0 .../button/_example}/button.json | 0 .../button/_example}/button.less | 0 .../button => src/button/_example}/button.ts | 0 .../button/_example}/button.wxml | 0 .../cell-group/_example}/api.md | 0 .../cell-group/_example}/cell-group.json | 0 .../cell-group/_example}/cell-group.less | 0 .../cell-group/_example}/cell-group.ts | 0 .../cell-group/_example}/cell-group.wxml | 0 .../pages/cell => src/cell/_example}/api.md | 0 .../cell => src/cell/_example}/cell.json | 0 .../cell => src/cell/_example}/cell.less | 0 .../pages/cell => src/cell/_example}/cell.ts | 0 .../cell => src/cell/_example}/cell.wxml | 13 +- .../checkbox => src/checkbox/_example}/api.md | 0 .../checkbox/_example}/checkbox.json | 0 .../checkbox/_example}/checkbox.less | 0 .../checkbox/_example}/checkbox.ts | 13 +- .../checkbox/_example}/checkbox.wxml | 0 .../collapse/_example}/collapse.json | 0 .../collapse/_example}/collapse.less | 0 .../collapse/_example}/collapse.ts | 0 .../collapse/_example}/collapse.wxml | 0 .../count-down/_example}/count-down.json | 0 .../count-down/_example}/count-down.less | 2 +- .../count-down/_example}/count-down.ts | 0 .../count-down/_example}/count-down.wxml | 0 .../_example}/date-time-picker.json | 0 .../_example}/date-time-picker.less | 5 +- .../_example}/date-time-picker.ts | 0 .../_example}/date-time-picker.wxml | 0 .../dialog/_example}/dialog.json | 0 .../dialog/_example}/dialog.less | 4 +- .../dialog => src/dialog/_example}/dialog.ts | 0 .../dialog/_example}/dialog.wxml | 18 +-- .../divider => src/divider/_example}/api.md | 0 .../divider/_example}/divider.json | 0 .../divider/_example}/divider.less | 4 +- .../divider/_example}/divider.ts | 0 .../divider/_example}/divider.wxml | 0 .../drawer/_example}/drawer.json | 0 .../drawer/_example}/drawer.less | 0 .../drawer => src/drawer/_example}/drawer.ts | 0 .../drawer/_example}/drawer.wxml | 0 .../_example}/dropdown-menu.json | 2 +- .../_example}/dropdown-menu.less | 0 .../dropdown-menu/_example}/dropdown-menu.ts | 0 .../_example}/dropdown-menu.wxml | 0 .../empty/_example}/empty-page.json | 0 .../empty/_example}/empty-page.less | 2 +- .../empty/_example}/empty-page.ts | 0 src/empty/_example/empty-page.wxml | 5 + .../empty => src/empty/_example}/empty.json | 0 .../empty => src/empty/_example}/empty.less | 2 +- .../empty => src/empty/_example}/empty.ts | 3 +- .../empty => src/empty/_example}/empty.wxml | 11 +- .../pages/fab => src/fab/_example}/fab.json | 0 .../pages/fab => src/fab/_example}/fab.less | 0 .../pages/fab => src/fab/_example}/fab.ts | 0 .../pages/fab => src/fab/_example}/fab.wxml | 0 .../footer/_example}/footer.json | 0 .../footer/_example}/footer.less | 0 .../footer => src/footer/_example}/footer.ts | 0 .../footer/_example}/footer.wxml | 18 +-- .../grid => src/grid/_example}/grid.json | 0 .../grid => src/grid/_example}/grid.less | 0 .../pages/grid => src/grid/_example}/grid.ts | 0 .../grid => src/grid/_example}/grid.wxml | 0 .../pages/icon => src/icon/_example}/data.js | 0 .../icon => src/icon/_example}/icon.json | 0 .../icon => src/icon/_example}/icon.less | 0 .../pages/icon => src/icon/_example}/icon.ts | 0 .../icon => src/icon/_example}/icon.wxml | 7 +- .../icon => src/icon/_example}/iconfont.wxss | 0 .../image-viewer/_example}/image-viewer.json | 0 .../image-viewer/_example}/image-viewer.less | 0 .../image-viewer/_example}/image-viewer.ts | 0 .../image-viewer/_example}/image-viewer.wxml | 0 .../image => src/image/_example}/image.json | 0 .../image => src/image/_example}/image.less | 0 .../image => src/image/_example}/image.ts | 0 .../image => src/image/_example}/image.wxml | 8 +- .../indexes => src/indexes/_example}/data.js | 0 .../indexes/_example}/display.json | 2 +- .../indexes/_example}/display.less | 0 .../indexes/_example}/display.ts | 0 .../indexes/_example}/display.wxml | 0 .../indexes/_example}/indexes.json | 0 .../indexes/_example}/indexes.less | 0 .../indexes/_example}/indexes.ts | 0 .../indexes/_example}/indexes.wxml | 0 .../pages/input => src/input/_example}/api.md | 0 .../input => src/input/_example}/input.json | 0 .../input => src/input/_example}/input.less | 0 .../input => src/input/_example}/input.ts | 0 .../input => src/input/_example}/input.wxml | 0 .../loading/_example}/loading.json | 0 .../loading/_example}/loading.less | 0 .../loading/_example}/loading.ts | 0 .../loading/_example}/loading.wxml | 0 .../loadingProgress/loadingProgress.json | 0 .../loadingProgress/loadingProgress.less | 0 .../loadingProgress/loadingProgress.ts | 0 .../loadingProgress/loadingProgress.wxml | 0 .../message/_example}/message.json | 0 .../message/_example}/message.less | 0 .../message/_example}/message.ts | 0 .../message/_example}/message.wxml | 0 .../navbar/_example}/navbar.json | 0 .../navbar/_example}/navbar.less | 4 +- .../navbar => src/navbar/_example}/navbar.ts | 0 .../navbar/_example}/navbar.wxml | 7 +- .../notice-bar/_example}/notice-bar.json | 0 .../notice-bar/_example}/notice-bar.less | 0 .../notice-bar/_example}/notice-bar.ts | 0 .../notice-bar/_example}/notice-bar.wxml | 0 .../overlay/_example}/overlay.json | 0 .../overlay/_example}/overlay.less | 0 .../overlay/_example}/overlay.ts | 0 .../overlay/_example}/overlay.wxml | 0 .../picker/_example}/picker.json | 0 .../picker/_example}/picker.less | 4 +- .../picker => src/picker/_example}/picker.ts | 0 .../picker/_example}/picker.wxml | 0 .../popup => src/popup/_example}/popup.json | 0 .../popup => src/popup/_example}/popup.less | 0 .../popup => src/popup/_example}/popup.ts | 0 .../popup => src/popup/_example}/popup.wxml | 7 +- .../progress/_example}/progress.json | 0 .../progress/_example}/progress.less | 0 .../progress/_example}/progress.ts | 0 .../progress/_example}/progress.wxml | 0 .../_example}/pull-down-refresh.json | 0 .../_example}/pull-down-refresh.less | 0 .../_example}/pull-down-refresh.ts | 0 .../_example}/pull-down-refresh.wxml | 0 .../radio/_example}/__test__/index.test.js | 0 .../radio => src/radio/_example}/radio.json | 0 .../radio => src/radio/_example}/radio.less | 0 .../radio => src/radio/_example}/radio.ts | 0 .../radio => src/radio/_example}/radio.wxml | 0 .../pages/rate => src/rate/_example}/api.md | 0 .../rate => src/rate/_example}/rate.json | 0 .../rate => src/rate/_example}/rate.less | 0 .../pages/rate => src/rate/_example}/rate.ts | 0 .../rate => src/rate/_example}/rate.wxml | 0 .../search => src/search/_example}/api.md | 0 .../search/_example}/search.json | 0 .../search/_example}/search.less | 0 .../search => src/search/_example}/search.ts | 0 .../search/_example}/search.wxml | 0 .../skeleton/_example}/skeleton.json | 0 .../skeleton/_example}/skeleton.less | 0 .../skeleton/_example}/skeleton.ts | 0 .../skeleton/_example}/skeleton.wxml | 11 +- .../slider/_example}/slider.json | 0 .../slider/_example}/slider.less | 6 +- .../slider => src/slider/_example}/slider.ts | 0 .../slider/_example}/slider.wxml | 31 +--- .../stepper/_example}/stepper.json | 0 .../stepper/_example}/stepper.less | 6 +- .../stepper/_example}/stepper.ts | 0 .../stepper/_example}/stepper.wxml | 0 .../steps => src/steps/_example}/steps.json | 0 .../steps => src/steps/_example}/steps.less | 2 +- .../steps => src/steps/_example}/steps.ts | 0 .../steps => src/steps/_example}/steps.wxml | 0 .../sticky/_example}/sticky.json | 0 .../sticky/_example}/sticky.less | 4 +- .../sticky => src/sticky/_example}/sticky.ts | 0 .../sticky/_example}/sticky.wxml | 0 .../swipe-cell/_example}/swipe-cell.json | 4 +- .../swipe-cell/_example}/swipe-cell.less | 0 .../swipe-cell/_example}/swipe-cell.ts | 0 .../swipe-cell/_example}/swipe-cell.wxml | 4 +- .../swiper/_example}/swiper.json | 0 .../swiper/_example}/swiper.less | 0 .../swiper => src/swiper/_example}/swiper.ts | 0 .../swiper/_example}/swiper.wxml | 21 +-- .../switch/_example}/switch.json | 2 +- .../switch/_example}/switch.less | 0 .../switch => src/switch/_example}/switch.ts | 0 .../switch/_example}/switch.wxml | 0 .../tab-bar/_example}/tab-bar.json | 0 .../tab-bar/_example}/tab-bar.less | 4 +- .../tab-bar/_example}/tab-bar.ts | 0 .../tab-bar/_example}/tab-bar.wxml | 0 .../tabs => src/tabs/_example}/tabs.json | 0 .../tabs => src/tabs/_example}/tabs.less | 4 +- .../pages/tabs => src/tabs/_example}/tabs.ts | 0 .../tabs => src/tabs/_example}/tabs.wxml | 0 .../pages/tag => src/tag/_example}/tag.json | 0 .../pages/tag => src/tag/_example}/tag.less | 0 .../pages/tag => src/tag/_example}/tag.ts | 0 .../pages/tag => src/tag/_example}/tag.wxml | 4 +- .../textarea => src/textarea/_example}/api.md | 0 .../textarea/_example}/textarea.json | 0 .../textarea/_example}/textarea.less | 0 .../textarea/_example}/textarea.ts | 0 .../textarea/_example}/textarea.wxml | 0 .../toast => src/toast/_example}/toast.json | 0 .../toast => src/toast/_example}/toast.less | 8 +- .../toast => src/toast/_example}/toast.ts | 0 .../toast => src/toast/_example}/toast.wxml | 7 +- .../transition/_example}/api.md | 0 .../_example}/demos/appear/index.json | 0 .../_example}/demos/appear/index.ts | 0 .../_example}/demos/appear/index.wxml | 0 .../_example}/demos/base/index.json | 0 .../transition/_example}/demos/base/index.ts | 0 .../_example}/demos/base/index.wxml | 0 .../_example}/demos/custom/index.json | 0 .../_example}/demos/custom/index.less | 0 .../_example}/demos/custom/index.ts | 0 .../_example}/demos/custom/index.wxml | 0 .../_example}/demos/destroy/index.json | 0 .../_example}/demos/destroy/index.ts | 0 .../_example}/demos/destroy/index.wxml | 0 .../transition/_example}/transition.json | 0 .../transition/_example}/transition.less | 0 .../transition/_example}/transition.ts | 0 .../transition/_example}/transition.wxml | 0 .../upload/_example}/upload.json | 0 .../upload/_example}/upload.less | 4 +- .../upload => src/upload/_example}/upload.ts | 0 .../upload/_example}/upload.wxml | 0 253 files changed, 138 insertions(+), 364 deletions(-) delete mode 100644 example/pages/back-top/back-top.wxml delete mode 100644 example/pages/empty/empty-page.wxml rename {example/pages/action-sheet => src/action-sheet/_example}/action-sheet.json (100%) rename {example/pages/action-sheet => src/action-sheet/_example}/action-sheet.less (100%) rename {example/pages/action-sheet => src/action-sheet/_example}/action-sheet.ts (100%) rename {example/pages/action-sheet => src/action-sheet/_example}/action-sheet.wxml (100%) rename {example/pages/action-sheet => src/action-sheet/_example}/constants.ts (100%) rename {example/pages/avatar => src/avatar/_example}/avatar.json (97%) rename {example/pages/avatar => src/avatar/_example}/avatar.less (100%) rename {example/pages/avatar => src/avatar/_example}/avatar.ts (100%) rename {example/pages/avatar => src/avatar/_example}/avatar.wxml (93%) rename {example/pages/back-top => src/back-top/_example}/api.md (100%) rename {example/pages/back-top => src/back-top/_example}/back-top.json (100%) rename {example/pages/back-top => src/back-top/_example}/back-top.less (100%) rename {example/pages/back-top => src/back-top/_example}/back-top.ts (100%) create mode 100644 src/back-top/_example/back-top.wxml rename {example/pages/badge => src/badge/_example}/api.md (100%) rename {example/pages/badge => src/badge/_example}/badge.json (100%) rename {example/pages/badge => src/badge/_example}/badge.less (100%) rename {example/pages/badge => src/badge/_example}/badge.ts (100%) rename {example/pages/badge => src/badge/_example}/badge.wxml (95%) rename {example/pages/button-group => src/button-group/_example}/button-group.json (100%) rename {example/pages/button-group => src/button-group/_example}/button-group.less (100%) rename {example/pages/button-group => src/button-group/_example}/button-group.ts (100%) rename {example/pages/button-group => src/button-group/_example}/button-group.wxml (100%) rename {example/pages/button => src/button/_example}/button.json (100%) rename {example/pages/button => src/button/_example}/button.less (100%) rename {example/pages/button => src/button/_example}/button.ts (100%) rename {example/pages/button => src/button/_example}/button.wxml (100%) rename {example/pages/cell-group => src/cell-group/_example}/api.md (100%) rename {example/pages/cell-group => src/cell-group/_example}/cell-group.json (100%) rename {example/pages/cell-group => src/cell-group/_example}/cell-group.less (100%) rename {example/pages/cell-group => src/cell-group/_example}/cell-group.ts (100%) rename {example/pages/cell-group => src/cell-group/_example}/cell-group.wxml (100%) rename {example/pages/cell => src/cell/_example}/api.md (100%) rename {example/pages/cell => src/cell/_example}/cell.json (100%) rename {example/pages/cell => src/cell/_example}/cell.less (100%) rename {example/pages/cell => src/cell/_example}/cell.ts (100%) rename {example/pages/cell => src/cell/_example}/cell.wxml (84%) rename {example/pages/checkbox => src/checkbox/_example}/api.md (100%) rename {example/pages/checkbox => src/checkbox/_example}/checkbox.json (100%) rename {example/pages/checkbox => src/checkbox/_example}/checkbox.less (100%) rename {example/pages/checkbox => src/checkbox/_example}/checkbox.ts (79%) rename {example/pages/checkbox => src/checkbox/_example}/checkbox.wxml (100%) rename {example/pages/collapse => src/collapse/_example}/collapse.json (100%) rename {example/pages/collapse => src/collapse/_example}/collapse.less (100%) rename {example/pages/collapse => src/collapse/_example}/collapse.ts (100%) rename {example/pages/collapse => src/collapse/_example}/collapse.wxml (100%) rename {example/pages/count-down => src/count-down/_example}/count-down.json (100%) rename {example/pages/count-down => src/count-down/_example}/count-down.less (95%) rename {example/pages/count-down => src/count-down/_example}/count-down.ts (100%) rename {example/pages/count-down => src/count-down/_example}/count-down.wxml (100%) rename {example/pages/date-time-picker => src/date-time-picker/_example}/date-time-picker.json (100%) rename {example/pages/date-time-picker => src/date-time-picker/_example}/date-time-picker.less (81%) rename {example/pages/date-time-picker => src/date-time-picker/_example}/date-time-picker.ts (100%) rename {example/pages/date-time-picker => src/date-time-picker/_example}/date-time-picker.wxml (100%) rename {example/pages/dialog => src/dialog/_example}/dialog.json (100%) rename {example/pages/dialog => src/dialog/_example}/dialog.less (94%) rename {example/pages/dialog => src/dialog/_example}/dialog.ts (100%) rename {example/pages/dialog => src/dialog/_example}/dialog.wxml (78%) rename {example/pages/divider => src/divider/_example}/api.md (100%) rename {example/pages/divider => src/divider/_example}/divider.json (100%) rename {example/pages/divider => src/divider/_example}/divider.less (93%) rename {example/pages/divider => src/divider/_example}/divider.ts (100%) rename {example/pages/divider => src/divider/_example}/divider.wxml (100%) rename {example/pages/drawer => src/drawer/_example}/drawer.json (100%) rename {example/pages/drawer => src/drawer/_example}/drawer.less (100%) rename {example/pages/drawer => src/drawer/_example}/drawer.ts (100%) rename {example/pages/drawer => src/drawer/_example}/drawer.wxml (100%) rename {example/pages/dropdown-menu => src/dropdown-menu/_example}/dropdown-menu.json (96%) rename {example/pages/dropdown-menu => src/dropdown-menu/_example}/dropdown-menu.less (100%) rename {example/pages/dropdown-menu => src/dropdown-menu/_example}/dropdown-menu.ts (100%) rename {example/pages/dropdown-menu => src/dropdown-menu/_example}/dropdown-menu.wxml (100%) rename {example/pages/empty => src/empty/_example}/empty-page.json (100%) rename {example/pages/empty => src/empty/_example}/empty-page.less (98%) rename {example/pages/empty => src/empty/_example}/empty-page.ts (100%) create mode 100644 src/empty/_example/empty-page.wxml rename {example/pages/empty => src/empty/_example}/empty.json (100%) rename {example/pages/empty => src/empty/_example}/empty.less (99%) rename {example/pages/empty => src/empty/_example}/empty.ts (66%) rename {example/pages/empty => src/empty/_example}/empty.wxml (82%) rename {example/pages/fab => src/fab/_example}/fab.json (100%) rename {example/pages/fab => src/fab/_example}/fab.less (100%) rename {example/pages/fab => src/fab/_example}/fab.ts (100%) rename {example/pages/fab => src/fab/_example}/fab.wxml (100%) rename {example/pages/footer => src/footer/_example}/footer.json (100%) rename {example/pages/footer => src/footer/_example}/footer.less (100%) rename {example/pages/footer => src/footer/_example}/footer.ts (100%) rename {example/pages/footer => src/footer/_example}/footer.wxml (58%) rename {example/pages/grid => src/grid/_example}/grid.json (100%) rename {example/pages/grid => src/grid/_example}/grid.less (100%) rename {example/pages/grid => src/grid/_example}/grid.ts (100%) rename {example/pages/grid => src/grid/_example}/grid.wxml (100%) rename {example/pages/icon => src/icon/_example}/data.js (100%) rename {example/pages/icon => src/icon/_example}/icon.json (100%) rename {example/pages/icon => src/icon/_example}/icon.less (100%) rename {example/pages/icon => src/icon/_example}/icon.ts (100%) rename {example/pages/icon => src/icon/_example}/icon.wxml (86%) rename {example/pages/icon => src/icon/_example}/iconfont.wxss (100%) rename {example/pages/image-viewer => src/image-viewer/_example}/image-viewer.json (100%) rename {example/pages/image-viewer => src/image-viewer/_example}/image-viewer.less (100%) rename {example/pages/image-viewer => src/image-viewer/_example}/image-viewer.ts (100%) rename {example/pages/image-viewer => src/image-viewer/_example}/image-viewer.wxml (100%) rename {example/pages/image => src/image/_example}/image.json (100%) rename {example/pages/image => src/image/_example}/image.less (100%) rename {example/pages/image => src/image/_example}/image.ts (100%) rename {example/pages/image => src/image/_example}/image.wxml (97%) rename {example/pages/indexes => src/indexes/_example}/data.js (100%) rename {example/pages/indexes => src/indexes/_example}/display.json (97%) rename {example/pages/indexes => src/indexes/_example}/display.less (100%) rename {example/pages/indexes => src/indexes/_example}/display.ts (100%) rename {example/pages/indexes => src/indexes/_example}/display.wxml (100%) rename {example/pages/indexes => src/indexes/_example}/indexes.json (100%) rename {example/pages/indexes => src/indexes/_example}/indexes.less (100%) rename {example/pages/indexes => src/indexes/_example}/indexes.ts (100%) rename {example/pages/indexes => src/indexes/_example}/indexes.wxml (100%) rename {example/pages/input => src/input/_example}/api.md (100%) rename {example/pages/input => src/input/_example}/input.json (100%) rename {example/pages/input => src/input/_example}/input.less (100%) rename {example/pages/input => src/input/_example}/input.ts (100%) rename {example/pages/input => src/input/_example}/input.wxml (100%) rename {example/pages/loading => src/loading/_example}/loading.json (100%) rename {example/pages/loading => src/loading/_example}/loading.less (100%) rename {example/pages/loading => src/loading/_example}/loading.ts (100%) rename {example/pages/loading => src/loading/_example}/loading.wxml (100%) rename {example/pages/loading => src/loading/_example}/loadingProgress/loadingProgress.json (100%) rename {example/pages/loading => src/loading/_example}/loadingProgress/loadingProgress.less (100%) rename {example/pages/loading => src/loading/_example}/loadingProgress/loadingProgress.ts (100%) rename {example/pages/loading => src/loading/_example}/loadingProgress/loadingProgress.wxml (100%) rename {example/pages/message => src/message/_example}/message.json (100%) rename {example/pages/message => src/message/_example}/message.less (100%) rename {example/pages/message => src/message/_example}/message.ts (100%) rename {example/pages/message => src/message/_example}/message.wxml (100%) rename {example/pages/navbar => src/navbar/_example}/navbar.json (100%) rename {example/pages/navbar => src/navbar/_example}/navbar.less (90%) rename {example/pages/navbar => src/navbar/_example}/navbar.ts (100%) rename {example/pages/navbar => src/navbar/_example}/navbar.wxml (93%) rename {example/pages/notice-bar => src/notice-bar/_example}/notice-bar.json (100%) rename {example/pages/notice-bar => src/notice-bar/_example}/notice-bar.less (100%) rename {example/pages/notice-bar => src/notice-bar/_example}/notice-bar.ts (100%) rename {example/pages/notice-bar => src/notice-bar/_example}/notice-bar.wxml (100%) rename {example/pages/overlay => src/overlay/_example}/overlay.json (100%) rename {example/pages/overlay => src/overlay/_example}/overlay.less (100%) rename {example/pages/overlay => src/overlay/_example}/overlay.ts (100%) rename {example/pages/overlay => src/overlay/_example}/overlay.wxml (100%) rename {example/pages/picker => src/picker/_example}/picker.json (100%) rename {example/pages/picker => src/picker/_example}/picker.less (92%) rename {example/pages/picker => src/picker/_example}/picker.ts (100%) rename {example/pages/picker => src/picker/_example}/picker.wxml (100%) rename {example/pages/popup => src/popup/_example}/popup.json (100%) rename {example/pages/popup => src/popup/_example}/popup.less (100%) rename {example/pages/popup => src/popup/_example}/popup.ts (100%) rename {example/pages/popup => src/popup/_example}/popup.wxml (87%) rename {example/pages/progress => src/progress/_example}/progress.json (100%) rename {example/pages/progress => src/progress/_example}/progress.less (100%) rename {example/pages/progress => src/progress/_example}/progress.ts (100%) rename {example/pages/progress => src/progress/_example}/progress.wxml (100%) rename {example/pages/pull-down-refresh => src/pull-down-refresh/_example}/pull-down-refresh.json (100%) rename {example/pages/pull-down-refresh => src/pull-down-refresh/_example}/pull-down-refresh.less (100%) rename {example/pages/pull-down-refresh => src/pull-down-refresh/_example}/pull-down-refresh.ts (100%) rename {example/pages/pull-down-refresh => src/pull-down-refresh/_example}/pull-down-refresh.wxml (100%) rename {example/pages/radio => src/radio/_example}/__test__/index.test.js (100%) rename {example/pages/radio => src/radio/_example}/radio.json (100%) rename {example/pages/radio => src/radio/_example}/radio.less (100%) rename {example/pages/radio => src/radio/_example}/radio.ts (100%) rename {example/pages/radio => src/radio/_example}/radio.wxml (100%) rename {example/pages/rate => src/rate/_example}/api.md (100%) rename {example/pages/rate => src/rate/_example}/rate.json (100%) rename {example/pages/rate => src/rate/_example}/rate.less (100%) rename {example/pages/rate => src/rate/_example}/rate.ts (100%) rename {example/pages/rate => src/rate/_example}/rate.wxml (100%) rename {example/pages/search => src/search/_example}/api.md (100%) rename {example/pages/search => src/search/_example}/search.json (100%) rename {example/pages/search => src/search/_example}/search.less (100%) rename {example/pages/search => src/search/_example}/search.ts (100%) rename {example/pages/search => src/search/_example}/search.wxml (100%) rename {example/pages/skeleton => src/skeleton/_example}/skeleton.json (100%) rename {example/pages/skeleton => src/skeleton/_example}/skeleton.less (100%) rename {example/pages/skeleton => src/skeleton/_example}/skeleton.ts (100%) rename {example/pages/skeleton => src/skeleton/_example}/skeleton.wxml (81%) rename {example/pages/slider => src/slider/_example}/slider.json (100%) rename {example/pages/slider => src/slider/_example}/slider.less (90%) rename {example/pages/slider => src/slider/_example}/slider.ts (100%) rename {example/pages/slider => src/slider/_example}/slider.wxml (78%) rename {example/pages/stepper => src/stepper/_example}/stepper.json (100%) rename {example/pages/stepper => src/stepper/_example}/stepper.less (89%) rename {example/pages/stepper => src/stepper/_example}/stepper.ts (100%) rename {example/pages/stepper => src/stepper/_example}/stepper.wxml (100%) rename {example/pages/steps => src/steps/_example}/steps.json (100%) rename {example/pages/steps => src/steps/_example}/steps.less (99%) rename {example/pages/steps => src/steps/_example}/steps.ts (100%) rename {example/pages/steps => src/steps/_example}/steps.wxml (100%) rename {example/pages/sticky => src/sticky/_example}/sticky.json (100%) rename {example/pages/sticky => src/sticky/_example}/sticky.less (81%) rename {example/pages/sticky => src/sticky/_example}/sticky.ts (100%) rename {example/pages/sticky => src/sticky/_example}/sticky.wxml (100%) rename {example/pages/swipe-cell => src/swipe-cell/_example}/swipe-cell.json (69%) rename {example/pages/swipe-cell => src/swipe-cell/_example}/swipe-cell.less (100%) rename {example/pages/swipe-cell => src/swipe-cell/_example}/swipe-cell.ts (100%) rename {example/pages/swipe-cell => src/swipe-cell/_example}/swipe-cell.wxml (92%) rename {example/pages/swiper => src/swiper/_example}/swiper.json (100%) rename {example/pages/swiper => src/swiper/_example}/swiper.less (100%) rename {example/pages/swiper => src/swiper/_example}/swiper.ts (100%) rename {example/pages/swiper => src/swiper/_example}/swiper.wxml (89%) rename {example/pages/switch => src/switch/_example}/switch.json (98%) rename {example/pages/switch => src/switch/_example}/switch.less (100%) rename {example/pages/switch => src/switch/_example}/switch.ts (100%) rename {example/pages/switch => src/switch/_example}/switch.wxml (100%) rename {example/pages/tab-bar => src/tab-bar/_example}/tab-bar.json (100%) rename {example/pages/tab-bar => src/tab-bar/_example}/tab-bar.less (87%) rename {example/pages/tab-bar => src/tab-bar/_example}/tab-bar.ts (100%) rename {example/pages/tab-bar => src/tab-bar/_example}/tab-bar.wxml (100%) rename {example/pages/tabs => src/tabs/_example}/tabs.json (100%) rename {example/pages/tabs => src/tabs/_example}/tabs.less (82%) rename {example/pages/tabs => src/tabs/_example}/tabs.ts (100%) rename {example/pages/tabs => src/tabs/_example}/tabs.wxml (100%) rename {example/pages/tag => src/tag/_example}/tag.json (100%) rename {example/pages/tag => src/tag/_example}/tag.less (100%) rename {example/pages/tag => src/tag/_example}/tag.ts (100%) rename {example/pages/tag => src/tag/_example}/tag.wxml (95%) rename {example/pages/textarea => src/textarea/_example}/api.md (100%) rename {example/pages/textarea => src/textarea/_example}/textarea.json (100%) rename {example/pages/textarea => src/textarea/_example}/textarea.less (100%) rename {example/pages/textarea => src/textarea/_example}/textarea.ts (100%) rename {example/pages/textarea => src/textarea/_example}/textarea.wxml (100%) rename {example/pages/toast => src/toast/_example}/toast.json (100%) rename {example/pages/toast => src/toast/_example}/toast.less (88%) rename {example/pages/toast => src/toast/_example}/toast.ts (100%) rename {example/pages/toast => src/toast/_example}/toast.wxml (74%) rename {example/pages/transition => src/transition/_example}/api.md (100%) rename {example/pages/transition => src/transition/_example}/demos/appear/index.json (100%) rename {example/pages/transition => src/transition/_example}/demos/appear/index.ts (100%) rename {example/pages/transition => src/transition/_example}/demos/appear/index.wxml (100%) rename {example/pages/transition => src/transition/_example}/demos/base/index.json (100%) rename {example/pages/transition => src/transition/_example}/demos/base/index.ts (100%) rename {example/pages/transition => src/transition/_example}/demos/base/index.wxml (100%) rename {example/pages/transition => src/transition/_example}/demos/custom/index.json (100%) rename {example/pages/transition => src/transition/_example}/demos/custom/index.less (100%) rename {example/pages/transition => src/transition/_example}/demos/custom/index.ts (100%) rename {example/pages/transition => src/transition/_example}/demos/custom/index.wxml (100%) rename {example/pages/transition => src/transition/_example}/demos/destroy/index.json (100%) rename {example/pages/transition => src/transition/_example}/demos/destroy/index.ts (100%) rename {example/pages/transition => src/transition/_example}/demos/destroy/index.wxml (100%) rename {example/pages/transition => src/transition/_example}/transition.json (100%) rename {example/pages/transition => src/transition/_example}/transition.less (100%) rename {example/pages/transition => src/transition/_example}/transition.ts (100%) rename {example/pages/transition => src/transition/_example}/transition.wxml (100%) rename {example/pages/upload => src/upload/_example}/upload.json (100%) rename {example/pages/upload => src/upload/_example}/upload.less (89%) rename {example/pages/upload => src/upload/_example}/upload.ts (100%) rename {example/pages/upload => src/upload/_example}/upload.wxml (100%) diff --git a/.eslintrc.js b/.eslintrc.js index 7f088000e..c9ea7f852 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -96,7 +96,7 @@ module.exports = { }, }, { - files: ['example/**'], + files: ['example/**', '**/_example/**'], rules: { 'no-console': 0, }, diff --git a/.gitignore b/.gitignore index 2155be81c..19eec70a2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ _site miniprogram_dist _wechatide dist -_example +/_example test/e2e test/unit .DS_Store diff --git a/example/pages/back-top/back-top.wxml b/example/pages/back-top/back-top.wxml deleted file mode 100644 index 343e0a605..000000000 --- a/example/pages/back-top/back-top.wxml +++ /dev/null @@ -1,134 +0,0 @@ - - BackTop 返回顶部 - 用于当页面过长往下滑动时,帮助用户快速回到页面顶部。 - - - 圆型返回顶部 - - - - 圆白底 - - - - - 圆黑底 - - - - - 圆白底纯图标 - - - - - 圆黑底纯图标 - - - - - 半圆型返回顶部 - - - - 半圆白底 - - - - - 半圆黑底 - - - - - - - - - - - - - - - - - - - diff --git a/example/pages/empty/empty-page.wxml b/example/pages/empty/empty-page.wxml deleted file mode 100644 index c16bd2bbe..000000000 --- a/example/pages/empty/empty-page.wxml +++ /dev/null @@ -1,10 +0,0 @@ - - - 按钮 - - diff --git a/example/pages/action-sheet/action-sheet.json b/src/action-sheet/_example/action-sheet.json similarity index 100% rename from example/pages/action-sheet/action-sheet.json rename to src/action-sheet/_example/action-sheet.json diff --git a/example/pages/action-sheet/action-sheet.less b/src/action-sheet/_example/action-sheet.less similarity index 100% rename from example/pages/action-sheet/action-sheet.less rename to src/action-sheet/_example/action-sheet.less diff --git a/example/pages/action-sheet/action-sheet.ts b/src/action-sheet/_example/action-sheet.ts similarity index 100% rename from example/pages/action-sheet/action-sheet.ts rename to src/action-sheet/_example/action-sheet.ts diff --git a/example/pages/action-sheet/action-sheet.wxml b/src/action-sheet/_example/action-sheet.wxml similarity index 100% rename from example/pages/action-sheet/action-sheet.wxml rename to src/action-sheet/_example/action-sheet.wxml diff --git a/example/pages/action-sheet/constants.ts b/src/action-sheet/_example/constants.ts similarity index 100% rename from example/pages/action-sheet/constants.ts rename to src/action-sheet/_example/constants.ts diff --git a/example/pages/avatar/avatar.json b/src/avatar/_example/avatar.json similarity index 97% rename from example/pages/avatar/avatar.json rename to src/avatar/_example/avatar.json index 4500b03d8..a956686bf 100644 --- a/example/pages/avatar/avatar.json +++ b/src/avatar/_example/avatar.json @@ -1,4 +1,4 @@ { "navigationBarTitleText": "Avatar", "navigationBarBackgroundColor": "#fff" -} \ No newline at end of file +} diff --git a/example/pages/avatar/avatar.less b/src/avatar/_example/avatar.less similarity index 100% rename from example/pages/avatar/avatar.less rename to src/avatar/_example/avatar.less diff --git a/example/pages/avatar/avatar.ts b/src/avatar/_example/avatar.ts similarity index 100% rename from example/pages/avatar/avatar.ts rename to src/avatar/_example/avatar.ts diff --git a/example/pages/avatar/avatar.wxml b/src/avatar/_example/avatar.wxml similarity index 93% rename from example/pages/avatar/avatar.wxml rename to src/avatar/_example/avatar.wxml index dc950896b..e366c752e 100644 --- a/example/pages/avatar/avatar.wxml +++ b/src/avatar/_example/avatar.wxml @@ -33,13 +33,7 @@ - + - + - + + BackTop 返回顶部 + 用于当页面过长往下滑动时,帮助用户快速回到页面顶部。 + + + 圆型返回顶部 + + + + 圆白底 + + + + + 圆黑底 + + + + + 圆白底纯图标 + + + + + 圆黑底纯图标 + + + + + 半圆型返回顶部 + + + + 半圆白底 + + + + + 半圆黑底 + + + + + + + + + + + + + + + + + + diff --git a/example/pages/badge/api.md b/src/badge/_example/api.md similarity index 100% rename from example/pages/badge/api.md rename to src/badge/_example/api.md diff --git a/example/pages/badge/badge.json b/src/badge/_example/badge.json similarity index 100% rename from example/pages/badge/badge.json rename to src/badge/_example/badge.json diff --git a/example/pages/badge/badge.less b/src/badge/_example/badge.less similarity index 100% rename from example/pages/badge/badge.less rename to src/badge/_example/badge.less diff --git a/example/pages/badge/badge.ts b/src/badge/_example/badge.ts similarity index 100% rename from example/pages/badge/badge.ts rename to src/badge/_example/badge.ts diff --git a/example/pages/badge/badge.wxml b/src/badge/_example/badge.wxml similarity index 95% rename from example/pages/badge/badge.wxml rename to src/badge/_example/badge.wxml index 02d773e44..f14711e06 100644 --- a/example/pages/badge/badge.wxml +++ b/src/badge/_example/badge.wxml @@ -49,11 +49,7 @@ 文字 文字 - 文字 - - 文字 - + 文字 + 文字 diff --git a/example/pages/button-group/button-group.json b/src/button-group/_example/button-group.json similarity index 100% rename from example/pages/button-group/button-group.json rename to src/button-group/_example/button-group.json diff --git a/example/pages/button-group/button-group.less b/src/button-group/_example/button-group.less similarity index 100% rename from example/pages/button-group/button-group.less rename to src/button-group/_example/button-group.less diff --git a/example/pages/button-group/button-group.ts b/src/button-group/_example/button-group.ts similarity index 100% rename from example/pages/button-group/button-group.ts rename to src/button-group/_example/button-group.ts diff --git a/example/pages/button-group/button-group.wxml b/src/button-group/_example/button-group.wxml similarity index 100% rename from example/pages/button-group/button-group.wxml rename to src/button-group/_example/button-group.wxml diff --git a/example/pages/button/button.json b/src/button/_example/button.json similarity index 100% rename from example/pages/button/button.json rename to src/button/_example/button.json diff --git a/example/pages/button/button.less b/src/button/_example/button.less similarity index 100% rename from example/pages/button/button.less rename to src/button/_example/button.less diff --git a/example/pages/button/button.ts b/src/button/_example/button.ts similarity index 100% rename from example/pages/button/button.ts rename to src/button/_example/button.ts diff --git a/example/pages/button/button.wxml b/src/button/_example/button.wxml similarity index 100% rename from example/pages/button/button.wxml rename to src/button/_example/button.wxml diff --git a/example/pages/cell-group/api.md b/src/cell-group/_example/api.md similarity index 100% rename from example/pages/cell-group/api.md rename to src/cell-group/_example/api.md diff --git a/example/pages/cell-group/cell-group.json b/src/cell-group/_example/cell-group.json similarity index 100% rename from example/pages/cell-group/cell-group.json rename to src/cell-group/_example/cell-group.json diff --git a/example/pages/cell-group/cell-group.less b/src/cell-group/_example/cell-group.less similarity index 100% rename from example/pages/cell-group/cell-group.less rename to src/cell-group/_example/cell-group.less diff --git a/example/pages/cell-group/cell-group.ts b/src/cell-group/_example/cell-group.ts similarity index 100% rename from example/pages/cell-group/cell-group.ts rename to src/cell-group/_example/cell-group.ts diff --git a/example/pages/cell-group/cell-group.wxml b/src/cell-group/_example/cell-group.wxml similarity index 100% rename from example/pages/cell-group/cell-group.wxml rename to src/cell-group/_example/cell-group.wxml diff --git a/example/pages/cell/api.md b/src/cell/_example/api.md similarity index 100% rename from example/pages/cell/api.md rename to src/cell/_example/api.md diff --git a/example/pages/cell/cell.json b/src/cell/_example/cell.json similarity index 100% rename from example/pages/cell/cell.json rename to src/cell/_example/cell.json diff --git a/example/pages/cell/cell.less b/src/cell/_example/cell.less similarity index 100% rename from example/pages/cell/cell.less rename to src/cell/_example/cell.less diff --git a/example/pages/cell/cell.ts b/src/cell/_example/cell.ts similarity index 100% rename from example/pages/cell/cell.ts rename to src/cell/_example/cell.ts diff --git a/example/pages/cell/cell.wxml b/src/cell/_example/cell.wxml similarity index 84% rename from example/pages/cell/cell.wxml rename to src/cell/_example/cell.wxml index ecedb8d3d..ebb6bfd82 100644 --- a/example/pages/cell/cell.wxml +++ b/src/cell/_example/cell.wxml @@ -23,13 +23,7 @@ 多行 - + @@ -43,10 +37,7 @@ align="top" image="https://we-retail-static-1300977798.cos.ap-guangzhou.myqcloud.com/retail-ui/components-exp/placeholder/quartet.svg" /> - + Dialog 对话框 - 用于显示重要提示或请求用户进行重要操作,一种打断当前操作的模态视图。 + 用于显示重要提示或请求用户进行重要操作,一种打断当前操作的模态视图。 @@ -21,20 +19,10 @@ bind:cancel="closeHandle" bind:action="closeHandle" > - + 告知当前状态、信息和解决方法,等内容。描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案 - + diff --git a/example/pages/divider/api.md b/src/divider/_example/api.md similarity index 100% rename from example/pages/divider/api.md rename to src/divider/_example/api.md diff --git a/example/pages/divider/divider.json b/src/divider/_example/divider.json similarity index 100% rename from example/pages/divider/divider.json rename to src/divider/_example/divider.json diff --git a/example/pages/divider/divider.less b/src/divider/_example/divider.less similarity index 93% rename from example/pages/divider/divider.less rename to src/divider/_example/divider.less index 87bcc2074..ef2fbc3f5 100644 --- a/example/pages/divider/divider.less +++ b/src/divider/_example/divider.less @@ -14,7 +14,7 @@ page { margin-left: 32rpx; margin-bottom: 16rpx; line-height: 40rpx; - color: rgba(0, 0, 0, .4); + color: rgba(0, 0, 0, 0.4); } &__wrapper { @@ -54,6 +54,6 @@ page { &--text-color { color: #000; - opacity: .4; + opacity: 0.4; } } diff --git a/example/pages/divider/divider.ts b/src/divider/_example/divider.ts similarity index 100% rename from example/pages/divider/divider.ts rename to src/divider/_example/divider.ts diff --git a/example/pages/divider/divider.wxml b/src/divider/_example/divider.wxml similarity index 100% rename from example/pages/divider/divider.wxml rename to src/divider/_example/divider.wxml diff --git a/example/pages/drawer/drawer.json b/src/drawer/_example/drawer.json similarity index 100% rename from example/pages/drawer/drawer.json rename to src/drawer/_example/drawer.json diff --git a/example/pages/drawer/drawer.less b/src/drawer/_example/drawer.less similarity index 100% rename from example/pages/drawer/drawer.less rename to src/drawer/_example/drawer.less diff --git a/example/pages/drawer/drawer.ts b/src/drawer/_example/drawer.ts similarity index 100% rename from example/pages/drawer/drawer.ts rename to src/drawer/_example/drawer.ts diff --git a/example/pages/drawer/drawer.wxml b/src/drawer/_example/drawer.wxml similarity index 100% rename from example/pages/drawer/drawer.wxml rename to src/drawer/_example/drawer.wxml diff --git a/example/pages/dropdown-menu/dropdown-menu.json b/src/dropdown-menu/_example/dropdown-menu.json similarity index 96% rename from example/pages/dropdown-menu/dropdown-menu.json rename to src/dropdown-menu/_example/dropdown-menu.json index 4eca9396a..9a84a56a4 100644 --- a/example/pages/dropdown-menu/dropdown-menu.json +++ b/src/dropdown-menu/_example/dropdown-menu.json @@ -1,3 +1,3 @@ { "navigationBarTitleText": "Dropdown Menu 下拉菜单" -} \ No newline at end of file +} diff --git a/example/pages/dropdown-menu/dropdown-menu.less b/src/dropdown-menu/_example/dropdown-menu.less similarity index 100% rename from example/pages/dropdown-menu/dropdown-menu.less rename to src/dropdown-menu/_example/dropdown-menu.less diff --git a/example/pages/dropdown-menu/dropdown-menu.ts b/src/dropdown-menu/_example/dropdown-menu.ts similarity index 100% rename from example/pages/dropdown-menu/dropdown-menu.ts rename to src/dropdown-menu/_example/dropdown-menu.ts diff --git a/example/pages/dropdown-menu/dropdown-menu.wxml b/src/dropdown-menu/_example/dropdown-menu.wxml similarity index 100% rename from example/pages/dropdown-menu/dropdown-menu.wxml rename to src/dropdown-menu/_example/dropdown-menu.wxml diff --git a/example/pages/empty/empty-page.json b/src/empty/_example/empty-page.json similarity index 100% rename from example/pages/empty/empty-page.json rename to src/empty/_example/empty-page.json diff --git a/example/pages/empty/empty-page.less b/src/empty/_example/empty-page.less similarity index 98% rename from example/pages/empty/empty-page.less rename to src/empty/_example/empty-page.less index d99284e6b..22453b00e 100644 --- a/example/pages/empty/empty-page.less +++ b/src/empty/_example/empty-page.less @@ -10,4 +10,4 @@ page { &__actions { margin-top: 128rpx !important; } -} \ No newline at end of file +} diff --git a/example/pages/empty/empty-page.ts b/src/empty/_example/empty-page.ts similarity index 100% rename from example/pages/empty/empty-page.ts rename to src/empty/_example/empty-page.ts diff --git a/src/empty/_example/empty-page.wxml b/src/empty/_example/empty-page.wxml new file mode 100644 index 000000000..3ea6f5e8d --- /dev/null +++ b/src/empty/_example/empty-page.wxml @@ -0,0 +1,5 @@ + + + 按钮 + + diff --git a/example/pages/empty/empty.json b/src/empty/_example/empty.json similarity index 100% rename from example/pages/empty/empty.json rename to src/empty/_example/empty.json diff --git a/example/pages/empty/empty.less b/src/empty/_example/empty.less similarity index 99% rename from example/pages/empty/empty.less rename to src/empty/_example/empty.less index 7f83bb05c..9a59d0cfc 100644 --- a/example/pages/empty/empty.less +++ b/src/empty/_example/empty.less @@ -36,4 +36,4 @@ page { margin: 32rpx 0; } } -} \ No newline at end of file +} diff --git a/example/pages/empty/empty.ts b/src/empty/_example/empty.ts similarity index 66% rename from example/pages/empty/empty.ts rename to src/empty/_example/empty.ts index a8b5f8ee4..7653d212b 100644 --- a/example/pages/empty/empty.ts +++ b/src/empty/_example/empty.ts @@ -6,8 +6,7 @@ */ Page({ data: { - image: - 'https://oteam-tdesign-1258344706.cos.ap-guangzhou.myqcloud.com/miniprogram/empty__demo-image.png', + image: 'https://oteam-tdesign-1258344706.cos.ap-guangzhou.myqcloud.com/miniprogram/empty__demo-image.png', }, goEmptyPage() { wx.navigateTo({ url: './empty-page' }); diff --git a/example/pages/empty/empty.wxml b/src/empty/_example/empty.wxml similarity index 82% rename from example/pages/empty/empty.wxml rename to src/empty/_example/empty.wxml index ebbc38d2d..71569547e 100644 --- a/example/pages/empty/empty.wxml +++ b/src/empty/_example/empty.wxml @@ -7,12 +7,7 @@ 自定义图片空状态 - + 带操作空状态 @@ -23,9 +18,7 @@ 空页面 - 空页面 + 空页面 diff --git a/example/pages/fab/fab.json b/src/fab/_example/fab.json similarity index 100% rename from example/pages/fab/fab.json rename to src/fab/_example/fab.json diff --git a/example/pages/fab/fab.less b/src/fab/_example/fab.less similarity index 100% rename from example/pages/fab/fab.less rename to src/fab/_example/fab.less diff --git a/example/pages/fab/fab.ts b/src/fab/_example/fab.ts similarity index 100% rename from example/pages/fab/fab.ts rename to src/fab/_example/fab.ts diff --git a/example/pages/fab/fab.wxml b/src/fab/_example/fab.wxml similarity index 100% rename from example/pages/fab/fab.wxml rename to src/fab/_example/fab.wxml diff --git a/example/pages/footer/footer.json b/src/footer/_example/footer.json similarity index 100% rename from example/pages/footer/footer.json rename to src/footer/_example/footer.json diff --git a/example/pages/footer/footer.less b/src/footer/_example/footer.less similarity index 100% rename from example/pages/footer/footer.less rename to src/footer/_example/footer.less diff --git a/example/pages/footer/footer.ts b/src/footer/_example/footer.ts similarity index 100% rename from example/pages/footer/footer.ts rename to src/footer/_example/footer.ts diff --git a/example/pages/footer/footer.wxml b/src/footer/_example/footer.wxml similarity index 58% rename from example/pages/footer/footer.wxml rename to src/footer/_example/footer.wxml index 9a8e90fdb..e1a6f5f04 100644 --- a/example/pages/footer/footer.wxml +++ b/src/footer/_example/footer.wxml @@ -1,27 +1,15 @@ Footer 页脚 -用于基础列表展示,可附带文字、品牌logo、操作,常用商详、个人中心、设置等页面。 +用于基础列表展示,可附带文字、品牌logo、操作,常用商详、个人中心、设置等页面。 - + - + diff --git a/example/pages/grid/grid.json b/src/grid/_example/grid.json similarity index 100% rename from example/pages/grid/grid.json rename to src/grid/_example/grid.json diff --git a/example/pages/grid/grid.less b/src/grid/_example/grid.less similarity index 100% rename from example/pages/grid/grid.less rename to src/grid/_example/grid.less diff --git a/example/pages/grid/grid.ts b/src/grid/_example/grid.ts similarity index 100% rename from example/pages/grid/grid.ts rename to src/grid/_example/grid.ts diff --git a/example/pages/grid/grid.wxml b/src/grid/_example/grid.wxml similarity index 100% rename from example/pages/grid/grid.wxml rename to src/grid/_example/grid.wxml diff --git a/example/pages/icon/data.js b/src/icon/_example/data.js similarity index 100% rename from example/pages/icon/data.js rename to src/icon/_example/data.js diff --git a/example/pages/icon/icon.json b/src/icon/_example/icon.json similarity index 100% rename from example/pages/icon/icon.json rename to src/icon/_example/icon.json diff --git a/example/pages/icon/icon.less b/src/icon/_example/icon.less similarity index 100% rename from example/pages/icon/icon.less rename to src/icon/_example/icon.less diff --git a/example/pages/icon/icon.ts b/src/icon/_example/icon.ts similarity index 100% rename from example/pages/icon/icon.ts rename to src/icon/_example/icon.ts diff --git a/example/pages/icon/icon.wxml b/src/icon/_example/icon.wxml similarity index 86% rename from example/pages/icon/icon.wxml rename to src/icon/_example/icon.wxml index b149fd3b0..e41a7cec3 100644 --- a/example/pages/icon/icon.wxml +++ b/src/icon/_example/icon.wxml @@ -20,12 +20,7 @@ > -