diff --git a/api/form/index.ts b/api/form/index.ts
new file mode 100644
index 0000000..6ee1e23
--- /dev/null
+++ b/api/form/index.ts
@@ -0,0 +1,19 @@
+import { Request } from '../../utils/request'
+
+export const GetCheckoutRoomNum = (roomNum: string) => Request({
+ url: `/room/checkout?roomNum=${roomNum}`,
+ method: 'get'
+})
+export const PostAnonLogin = (data: any) => Request({
+ url: `/auth/anon-login`,
+ method: 'post',
+ data,
+})
+export const GetAgoraConf = () => Request({
+ url: `/home/agora-conf`,
+ method: 'get',
+})
+export const GetRoomRtcToken = (roomNum: string) => Request({
+ url: `/room/tk/rtc?roomNum=${roomNum}`,
+ method: 'get',
+})
diff --git a/api/meeting/index.ts b/api/meeting/index.ts
new file mode 100644
index 0000000..de1b195
--- /dev/null
+++ b/api/meeting/index.ts
@@ -0,0 +1,50 @@
+import { Request } from '../../utils/request'
+
+export const GetRoomUser = (roomNum: string) => Request({
+ url: `/room/user?roomNum=${roomNum}`,
+ method: 'get'
+})
+
+export const GetShowUser = (roomNum: string) => Request({
+ url: `/room/show-user?roomNum=${roomNum}`,
+ method: 'get'
+})
+
+export const GetApplySpeak = (roomNum: string) => Request({
+ url: `/room/apply-speak?roomNum=${roomNum}`,
+ method: 'get'
+})
+
+export const PostMuteAll = (data: any) => {
+ return Request({
+ url: `/room/mute-all?roomNum=${data.roomNum}&enableMicr=${data.enableMicr}`,
+ method: 'get',
+ })
+}
+
+export const PostOpenMicr = (data: any) => {
+ return Request({
+ url: `/room/oper-micr?roomNum=${data.roomNum}&enableMicr=${data.enableMicr}&uid=${data.uid}`,
+ method: 'get',
+ })
+}
+
+export const PostOpenCamera = (data: any) =>
+ Request({
+ url: `/room/oper-camera`,
+ method: 'get',
+ data
+ })
+
+export const DeleteRoomManager = (data: any) =>
+ Request({
+ url: `/room/manager`,
+ method: 'delete',
+ data
+ })
+
+export const GetRoomInfo = (roomNum: string) =>
+ Request({
+ url: `/room/${roomNum}`,
+ method: 'get',
+ })
diff --git a/app.js b/app.js
index 2c70df4..2aff100 100644
--- a/app.js
+++ b/app.js
@@ -1,10 +1,5 @@
-import gulpError from './utils/gulpError';
App({
- onShow() {
- if (gulpError !== 'gulpErrorPlaceHolder') {
- wx.redirectTo({
- url: `/pages/gulp-error/index?gulpError=${gulpError}`,
- });
- }
- },
+ onShow() {
+
+ }
});
diff --git a/app.json b/app.json
index 05c393c..50a56d4 100644
--- a/app.json
+++ b/app.json
@@ -1,113 +1,24 @@
{
"pages": [
- "pages/home/home",
- "pages/button/button",
- "pages/tabs/tabs",
- "pages/icon/icon",
- "pages/loading/loading",
- "pages/progress/progress",
- "pages/cascader/cascader",
- "pages/cell/cell",
- "pages/cell-group/cell-group",
- "pages/collapse/collapse",
- "pages/input/input",
- "pages/badge/badge",
- "pages/textarea/textarea",
- "pages/message/message",
- "pages/toast/toast",
- "pages/stepper/stepper",
- "pages/slider/slider",
- "pages/radio/radio",
- "pages/switch/switch",
- "pages/sticky/sticky",
- "pages/tag/tag",
- "pages/checkbox/checkbox",
- "pages/gulp-error/index",
- "pages/fab/fab",
- "pages/tab-bar/tab-bar",
- "pages/transition/transition",
- "pages/popup/popup",
- "pages/steps/steps",
- "pages/dropdown-menu/dropdown-menu",
- "pages/drawer/drawer",
- "pages/pull-down-refresh/pull-down-refresh",
- "pages/skeleton/skeleton",
- "pages/footer/footer",
- "pages/divider/divider",
- "pages/empty/empty",
- "pages/back-top/back-top",
- "pages/grid/grid",
- "pages/upload/upload",
- "pages/count-down/count-down",
- "pages/overlay/overlay",
- "pages/image/image",
- "pages/search/search",
- "pages/home/navigateFail/navigateFail",
- "pages/navbar/navbar",
- "pages/date-time-picker/date-time-picker",
- "pages/notice-bar/notice-bar",
- "pages/image-viewer/image-viewer",
- "pages/result/result",
- "pages/result/result-page",
- "pages/link/link"
- ],
- "subpackages": [
- {
- "root": "pages/side-bar/",
- "pages": ["side-bar", "base/index", "switch/index", "custom/index", "with-icon/index"]
- },
- {
- "root": "pages/action-sheet/",
- "pages": ["action-sheet"]
- },
- {
- "root": "pages/avatar/",
- "pages": ["avatar"]
- },
- {
- "root": "pages/calendar/",
- "pages": ["calendar"]
- },
- {
- "root": "pages/dialog/",
- "pages": ["dialog"]
- },
- {
- "root": "pages/picker/",
- "pages": ["picker"]
- },
- {
- "root": "pages/rate/",
- "pages": ["rate"]
- },
- {
- "root": "pages/swiper/",
- "pages": ["swiper"]
- },
- {
- "root": "pages/swipe-cell/",
- "pages": ["swipe-cell"]
- },
- {
- "root": "pages/tree-select/",
- "pages": ["tree-select"]
- },
- {
- "root": "pages/indexes/",
- "pages": ["indexes", "base/index", "custom/index"]
- }
+ "pages/form/index",
+ "pages/meeting/index"
],
+ "subpackages": [],
"usingComponents": {
- "t-demo": "./components/demo-block/index",
+ "status-bar-height": "components/status-bar-height/index",
+ "header-tab": "components/header-tab/index",
+ "t-input": "tdesign-miniprogram/input/input",
"t-button": "tdesign-miniprogram/button/button",
- "t-icon": "tdesign-miniprogram/icon/icon"
+ "t-icon": "tdesign-miniprogram/icon/icon",
+ "t-avatar": "tdesign-miniprogram/avatar/avatar",
+ "t-message": "tdesign-miniprogram/message/message",
+ "t-dialog": "tdesign-miniprogram/dialog/dialog",
+ "t-popup": "tdesign-miniprogram/popup/popup"
},
+ "entryPagePath": "pages/form/index",
"window": {
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#f6f6f6",
- "backgroundColor": "#f6f6f6",
- "navigationBarTitleText": "TDesign",
+ "navigationStyle": "custom",
"navigationBarTextStyle": "black"
},
"sitemapLocation": "sitemap.json"
-}
+}
\ No newline at end of file
diff --git a/app.wxss b/app.wxss
index c397851..382ef28 100644
--- a/app.wxss
+++ b/app.wxss
@@ -1,19 +1,10 @@
+image {
+ display: block;
+}
+
page {
- background: #f6f6f6;
-}
-.demo {
- padding-bottom: 56rpx;
-}
-.demo-title {
- font-size: 48rpx;
- font-weight: 700;
- line-height: 64rpx;
- margin: 48rpx 32rpx 0;
- color: var(--td-font-gray-1, rgba(0, 0, 0, 0.9));
-}
-.demo-desc {
- font-size: 28rpx;
- color: var(--td-font-gray-2, rgba(0, 0, 0, 0.6));
- margin: 16rpx 32rpx 0;
- line-height: 44rpx;
-}
+ --td-button-primary-color: white;
+ --td-button-primary-bg-color: #5575F2;
+ --td-button-primary-border-color: #5575F2;
+ --td-switch-checked-color: #5575F2;
+}
\ No newline at end of file
diff --git a/assets/TDesignLogo@2x.png b/assets/TDesignLogo@2x.png
deleted file mode 100644
index ab44a89..0000000
Binary files a/assets/TDesignLogo@2x.png and /dev/null differ
diff --git a/assets/icon1-active.png b/assets/icon1-active.png
new file mode 100644
index 0000000..2451b91
Binary files /dev/null and b/assets/icon1-active.png differ
diff --git a/assets/icon1.png b/assets/icon1.png
new file mode 100644
index 0000000..6d08544
Binary files /dev/null and b/assets/icon1.png differ
diff --git a/assets/icon2-active.png b/assets/icon2-active.png
new file mode 100644
index 0000000..ab92720
Binary files /dev/null and b/assets/icon2-active.png differ
diff --git a/assets/icon2.png b/assets/icon2.png
new file mode 100644
index 0000000..6240217
Binary files /dev/null and b/assets/icon2.png differ
diff --git a/assets/icon3-active.png b/assets/icon3-active.png
new file mode 100644
index 0000000..b2357c8
Binary files /dev/null and b/assets/icon3-active.png differ
diff --git a/assets/icon3.png b/assets/icon3.png
new file mode 100644
index 0000000..46d733b
Binary files /dev/null and b/assets/icon3.png differ
diff --git a/assets/icon4.png b/assets/icon4.png
new file mode 100644
index 0000000..fa7c474
Binary files /dev/null and b/assets/icon4.png differ
diff --git a/assets/icon5.png b/assets/icon5.png
new file mode 100644
index 0000000..bb70c70
Binary files /dev/null and b/assets/icon5.png differ
diff --git a/assets/icon6.png b/assets/icon6.png
new file mode 100644
index 0000000..bf25396
Binary files /dev/null and b/assets/icon6.png differ
diff --git a/assets/icon7-active.png b/assets/icon7-active.png
new file mode 100644
index 0000000..757ee17
Binary files /dev/null and b/assets/icon7-active.png differ
diff --git a/assets/icon7.png b/assets/icon7.png
new file mode 100644
index 0000000..93cf87e
Binary files /dev/null and b/assets/icon7.png differ
diff --git a/assets/icon8.png b/assets/icon8.png
new file mode 100644
index 0000000..12d0958
Binary files /dev/null and b/assets/icon8.png differ
diff --git a/assets/icon9.png b/assets/icon9.png
new file mode 100644
index 0000000..81a9878
Binary files /dev/null and b/assets/icon9.png differ
diff --git a/components/demo-block/index.d.ts b/components/demo-block/index.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/components/demo-block/index.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/components/demo-block/index.js b/components/demo-block/index.js
deleted file mode 100644
index 007225f..0000000
--- a/components/demo-block/index.js
+++ /dev/null
@@ -1,27 +0,0 @@
-Component({
- options: {
- multipleSlots: true,
- addGlobalClass: true,
- },
- properties: {
- title: {
- type: String,
- default: '',
- },
- desc: {
- type: String,
- default: '',
- },
- operList: Array,
- padding: {
- type: Boolean,
- default: false,
- },
- },
- methods: {
- clickHandle(e) {
- const { type } = e.currentTarget.dataset;
- this.triggerEvent('clickoper', type);
- },
- },
-});
diff --git a/components/demo-block/index.json b/components/demo-block/index.json
deleted file mode 100644
index 467ce29..0000000
--- a/components/demo-block/index.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "component": true
-}
diff --git a/components/demo-block/index.wxml b/components/demo-block/index.wxml
deleted file mode 100644
index ff89daa..0000000
--- a/components/demo-block/index.wxml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- {{ operItem.title }}
-
-
- {{ btnItem.text }}
-
-
-
-
-
-
-
diff --git a/components/demo-block/index.wxss b/components/demo-block/index.wxss
deleted file mode 100644
index 6553930..0000000
--- a/components/demo-block/index.wxss
+++ /dev/null
@@ -1,43 +0,0 @@
-.demo-block {
- margin: var(--td-spacer-4, 64rpx) 0 0;
-}
-.demo-block__header {
- color: #000;
- margin: 0 var(--td-spacer-2, 32rpx);
-}
-.demo-block__header-title {
- font-weight: 700;
- font-size: 36rpx;
- line-height: 52rpx;
-}
-.demo-block__header-desc {
- margin-top: var(--td-spacer, 16rpx);
- font-size: var(--td-font-size-base, 28rpx);
- white-space: pre-line;
- color: var(--td-font-gray-2, rgba(0, 0, 0, 0.6));
- line-height: 22px;
-}
-.demo-block__oper {
- margin-top: var(--td-spacer, 16rpx);
-}
-.demo-block__oper-subtitle {
- font-size: var(--td-font-size-s, 24rpx);
- margin-bottom: var(--td-spacer-2, 32rpx);
- opacity: 0.4;
-}
-.demo-block__oper-btn {
- margin: 0 0 var(--td-spacer-2, 32rpx) 0;
- height: 96rpx;
-}
-.demo-block__slot {
- margin-top: var(--td-spacer-2, 32rpx);
-}
-.demo-block__slot.with-padding {
- margin: var(--td-spacer-2, 32rpx) var(--td-spacer-2, 32rpx) 0;
-}
-.demo-block_notitle {
- margin-top: 0px;
-}
-.demo-block_notitle .demo-block_subtitle {
- margin-top: var(--td-spacer-3, 48rpx);
-}
diff --git a/components/header-tab/index.json b/components/header-tab/index.json
new file mode 100644
index 0000000..e8cfaaf
--- /dev/null
+++ b/components/header-tab/index.json
@@ -0,0 +1,4 @@
+{
+ "component": true,
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/components/header-tab/index.scss b/components/header-tab/index.scss
new file mode 100644
index 0000000..8a11a7a
--- /dev/null
+++ b/components/header-tab/index.scss
@@ -0,0 +1,18 @@
+.header-tab {
+ flex-shrink: 0;
+
+ &-title {
+ position: relative;
+ text-align: center;
+ width: 100%;
+ padding: 24rpx 0;
+
+ &-back {
+ position: absolute;
+ left: 40rpx;
+ top: 50%;
+ transform: translate(0, -50%);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/components/header-tab/index.ts b/components/header-tab/index.ts
new file mode 100644
index 0000000..3fce1fc
--- /dev/null
+++ b/components/header-tab/index.ts
@@ -0,0 +1,43 @@
+Component({
+ properties: {
+ title: {
+ type: String,
+ value: '无'
+ },
+ backGround: {
+ type: String,
+ value: 'white'
+ },
+ isBack: {
+ type: Boolean,
+ value: true
+ },
+ isStatusBarHeight: {
+ type: Boolean,
+ value: true
+ },
+ color: {
+ type: String,
+ value: 'black'
+ },
+ titleStyle: {
+ type: String,
+ },
+ iconSize: {
+ type: String,
+ value: '48'
+ },
+ },
+ data: {
+
+ },
+ methods: {
+ back() {
+ wx.navigateBack()
+ },
+ },
+ ready() {
+
+
+ }
+})
diff --git a/components/header-tab/index.wxml b/components/header-tab/index.wxml
new file mode 100644
index 0000000..cda9fa0
--- /dev/null
+++ b/components/header-tab/index.wxml
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/components/pull-down-list/index.d.ts b/components/pull-down-list/index.d.ts
deleted file mode 100644
index 8639a8d..0000000
--- a/components/pull-down-list/index.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-declare const itemHeight: number;
diff --git a/components/pull-down-list/index.js b/components/pull-down-list/index.js
deleted file mode 100644
index ef76163..0000000
--- a/components/pull-down-list/index.js
+++ /dev/null
@@ -1,41 +0,0 @@
-const itemHeight = 56 * 2;
-Component({
- data: {
- childBoxHeight: 0,
- },
- externalClasses: ['t-class'],
- properties: {
- defaultOpen: {
- type: Boolean,
- value: false,
- },
- name: {
- type: String,
- value: '',
- },
- icon: {
- type: String,
- value: '',
- },
- childArr: {
- type: Array,
- value: [],
- observer(childArr) {
- this.setData({
- childBoxHeight: this.data.defaultOpen ? itemHeight * childArr.length : 0,
- });
- },
- },
- },
- methods: {
- switchHandle() {
- const { childArr, childBoxHeight } = this.data;
- this.setData({
- childBoxHeight: childBoxHeight > 0 ? 0 : childArr.length * itemHeight,
- });
- },
- tapChild(e) {
- this.triggerEvent('click', e.target.dataset);
- },
- },
-});
diff --git a/components/pull-down-list/index.json b/components/pull-down-list/index.json
deleted file mode 100644
index 32640e0..0000000
--- a/components/pull-down-list/index.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "component": true
-}
\ No newline at end of file
diff --git a/components/pull-down-list/index.wxml b/components/pull-down-list/index.wxml
deleted file mode 100644
index cf58f3b..0000000
--- a/components/pull-down-list/index.wxml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- {{ name }}
-
-
-
-
- {{ item.name }} {{ item.label }}
-
-
-
-
diff --git a/components/pull-down-list/index.wxss b/components/pull-down-list/index.wxss
deleted file mode 100644
index ce6c2f1..0000000
--- a/components/pull-down-list/index.wxss
+++ /dev/null
@@ -1,49 +0,0 @@
-.pullDownList {
- width: 100%;
- box-sizing: border-box;
- background-color: #fff;
- border-radius: 8rpx;
- margin-bottom: 24rpx;
- overflow: hidden;
-}
-.pullDownList .switchBox {
- height: 120rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 32rpx;
- font-size: 32rpx;
- line-height: 48rpx;
- color: #333;
-}
-.pullDownList .name,
-.pullDownList .icon {
- transition: opacity 0.3s;
-}
-.pullDownList .name {
- opacity: 0.9;
-}
-.pullDownList.actived .name {
- opacity: 0.4;
-}
-.pullDownList.actived .icon {
- opacity: 0.4;
-}
-.pullDownList .childBox {
- transition: height 0.3s;
-}
-.pullDownList .childBox .child {
- box-sizing: border-box;
- border-bottom: 1rpx solid #e5e5e5;
- height: 112rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-left: 32rpx;
- margin-right: 32rpx;
- font-size: 32rpx;
- opacity: 0.9;
-}
-.pullDownList .childBox .child:last-of-type {
- border-bottom-color: transparent;
-}
diff --git a/components/status-bar-height/index.json b/components/status-bar-height/index.json
new file mode 100644
index 0000000..e8cfaaf
--- /dev/null
+++ b/components/status-bar-height/index.json
@@ -0,0 +1,4 @@
+{
+ "component": true,
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/demos/radio/basic/basic.wxss b/components/status-bar-height/index.scss
similarity index 100%
rename from demos/radio/basic/basic.wxss
rename to components/status-bar-height/index.scss
diff --git a/components/status-bar-height/index.ts b/components/status-bar-height/index.ts
new file mode 100644
index 0000000..eb3c0b2
--- /dev/null
+++ b/components/status-bar-height/index.ts
@@ -0,0 +1,16 @@
+Component({
+ properties: {
+
+ },
+ data: {
+ height: 0
+ },
+ methods: {
+
+ },
+ ready() {
+ this.setData({
+ height: wx.getWindowInfo().statusBarHeight
+ })
+ }
+})
diff --git a/components/status-bar-height/index.wxml b/components/status-bar-height/index.wxml
new file mode 100644
index 0000000..d168bae
--- /dev/null
+++ b/components/status-bar-height/index.wxml
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/demos/radio/basic/basic.d.ts b/demos/radio/basic/basic.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/demos/radio/basic/basic.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/demos/radio/basic/basic.js b/demos/radio/basic/basic.js
deleted file mode 100644
index b79c512..0000000
--- a/demos/radio/basic/basic.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/demos/radio/basic/basic.json b/demos/radio/basic/basic.json
deleted file mode 100644
index 467ce29..0000000
--- a/demos/radio/basic/basic.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "component": true
-}
diff --git a/demos/radio/basic/basic.wxml b/demos/radio/basic/basic.wxml
deleted file mode 100644
index c1c2a69..0000000
--- a/demos/radio/basic/basic.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/demos/radio/group/group.d.ts b/demos/radio/group/group.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/demos/radio/group/group.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/demos/radio/group/group.js b/demos/radio/group/group.js
deleted file mode 100644
index 074920b..0000000
--- a/demos/radio/group/group.js
+++ /dev/null
@@ -1,22 +0,0 @@
-Component({
- properties: {
- items: {
- type: Array,
- value: [],
- },
- value: {
- type: String,
- value: '',
- },
- },
- data: {
- currentValue: '',
- },
- methods: {
- onChange(event) {
- this.setData({
- currentValue: event.detail.name,
- });
- },
- },
-});
diff --git a/demos/radio/group/group.json b/demos/radio/group/group.json
deleted file mode 100644
index 467ce29..0000000
--- a/demos/radio/group/group.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "component": true
-}
diff --git a/demos/radio/group/group.wxml b/demos/radio/group/group.wxml
deleted file mode 100644
index 8ff56d4..0000000
--- a/demos/radio/group/group.wxml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
diff --git a/lib/agora-miniapp-sdk.js b/lib/agora-miniapp-sdk.js
new file mode 100644
index 0000000..fec3c9f
--- /dev/null
+++ b/lib/agora-miniapp-sdk.js
@@ -0,0 +1,2 @@
+/*! For license information please see agora-miniapp-sdk.js.LICENSE.txt */
+!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("AgoraSDK",[],t):"object"==typeof exports?exports.AgoraSDK=t():e.AgoraSDK=t()}(self,(()=>(()=>{var __webpack_modules__={537:e=>{"use strict";e.exports=function(e,t){for(var n=new Array(arguments.length-1),r=0,i=2,o=!0;i{"use strict";var n=t;n.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var r=new Array(64),i=new Array(123),o=0;o<64;)i[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;n.encode=function(e,t,n){for(var i,o=null,s=[],a=0,c=0;t>2],i=(3&l)<<4,c=1;break;case 1:s[a++]=r[i|l>>4],i=(15&l)<<2,c=2;break;case 2:s[a++]=r[i|l>>6],s[a++]=r[63&l],c=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return c&&(s[a++]=r[i],s[a++]=61,1===c&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";n.decode=function(e,t,n){for(var r,o=n,a=0,c=0;c1)break;if(void 0===(l=i[l]))throw Error(s);switch(a){case 0:r=l,a=1;break;case 1:t[n++]=r<<2|(48&l)>>4,r=l,a=2;break;case 2:t[n++]=(15&r)<<4|(60&l)>>2,r=l,a=3;break;case 3:t[n++]=(3&r)<<6|l,a=0}}if(1===a)throw Error(s);return n-o},n.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},211:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var n=this._listeners[e],r=0;r{"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),r=128===n[3];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3]}function o(e,r,i){t[0]=e,r[i]=n[3],r[i+1]=n[2],r[i+2]=n[1],r[i+3]=n[0]}function s(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],t[0]}function a(e,r){return n[3]=e[r],n[2]=e[r+1],n[1]=e[r+2],n[0]=e[r+3],t[0]}e.writeFloatLE=r?i:o,e.writeFloatBE=r?o:i,e.readFloatLE=r?s:a,e.readFloatBE=r?a:s}():function(){function t(e,t,n,r){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,n,r);else if(isNaN(t))e(2143289344,n,r);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,n,r);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,n,r);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,n,r)}}function s(e,t,n){var r=e(t,n),i=2*(r>>31)+1,o=r>>>23&255,s=8388607&r;return 255===o?s?NaN:i*(1/0):0===o?1401298464324817e-60*i*s:i*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=t.bind(null,n),e.writeFloatBE=t.bind(null,r),e.readFloatLE=s.bind(null,i),e.readFloatBE=s.bind(null,o)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),r=128===n[7];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3],r[i+4]=n[4],r[i+5]=n[5],r[i+6]=n[6],r[i+7]=n[7]}function o(e,r,i){t[0]=e,r[i]=n[7],r[i+1]=n[6],r[i+2]=n[5],r[i+3]=n[4],r[i+4]=n[3],r[i+5]=n[2],r[i+6]=n[1],r[i+7]=n[0]}function s(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],n[4]=e[r+4],n[5]=e[r+5],n[6]=e[r+6],n[7]=e[r+7],t[0]}function a(e,r){return n[7]=e[r],n[6]=e[r+1],n[5]=e[r+2],n[4]=e[r+3],n[3]=e[r+4],n[2]=e[r+5],n[1]=e[r+6],n[0]=e[r+7],t[0]}e.writeDoubleLE=r?i:o,e.writeDoubleBE=r?o:i,e.readDoubleLE=r?s:a,e.readDoubleBE=r?a:s}():function(){function t(e,t,n,r,i,o){var s=r<0?1:0;if(s&&(r=-r),0===r)e(0,i,o+t),e(1/r>0?0:2147483648,i,o+n);else if(isNaN(r))e(0,i,o+t),e(2146959360,i,o+n);else if(r>17976931348623157e292)e(0,i,o+t),e((s<<31|2146435072)>>>0,i,o+n);else{var a;if(r<22250738585072014e-324)e((a=r/5e-324)>>>0,i,o+t),e((s<<31|a/4294967296)>>>0,i,o+n);else{var c=Math.floor(Math.log(r)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=r*Math.pow(2,-c))>>>0,i,o+t),e((s<<31|c+1023<<20|1048576*a&1048575)>>>0,i,o+n)}}}function s(e,t,n,r,i){var o=e(r,i+t),s=e(r,i+n),a=2*(s>>31)+1,c=s>>>20&2047,l=4294967296*(1048575&s)+o;return 2047===c?l?NaN:a*(1/0):0===c?5e-324*a*l:a*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,n,0,4),e.writeDoubleBE=t.bind(null,r,4,0),e.readDoubleLE=s.bind(null,i,0,4),e.readDoubleBE=s.bind(null,o,4,0)}(),e}function n(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function r(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},199:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},662:e=>{"use strict";e.exports=function(e,t,n){var r=n||8192,i=r>>>1,o=null,s=r;return function(n){if(n<1||n>i)return e(n);s+n>r&&(o=e(r),s=0);var a=t.call(o,s,s+=n);return 7&s&&(s=1+(7|s)),a}}},997:(e,t)=>{"use strict";var n=t;n.length=function(e){for(var t=0,n=0,r=0;r191&&r<224?o[s++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(r>>10),o[s++]=56320+(1023&r)):o[s++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))},n.write=function(e,t,n){for(var r,i,o=n,s=0;s>6|192,t[n++]=63&r|128):55296==(64512&r)&&56320==(64512&(i=e.charCodeAt(s+1)))?(r=65536+((1023&r)<<10)+(1023&i),++s,t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128);return n-o}},699:(e,t,n)=>{"use strict";var r,i,o,s,a,c=n(100),l=c.Writer,u=c.util,p=c.roots.default||(c.roots.default={});p.io=((a={}).agora=((s={}).pb=((o={}).CounterCompact=function(){function e(e){if(this.items=[],e)for(var t=Object.keys(e),n=0;n{"use strict";n.r(t),n.d(t,{DOMAIN_NAME:()=>o,SDK_VERSION:()=>i,VERSION:()=>r});var r="1.1.0",i="2.6.4",o="mini-app.broadcastapp.agoraio.cn"},426:(e,t,n)=>{"use strict";n.r(t),n.d(t,{generateSessionId:()=>s,is32Uint:()=>l,isWeiXin:()=>c,random:()=>o,shouldUseHttps:()=>a});var r=n(171),i=n.n(r),o=function(e){isNaN(e)&&(e=1e3);var t=+new Date,n=(t=(9301*t+49297)%233280)/233280;return Math.ceil(n*e)},s=function(){return i()().replace(/-/g,"").toUpperCase()},a=function(){return"https:"==document.location.protocol},c=function(){try{return wx,!0}catch(e){return!1}},l=function(e){return!!(0<=e&&e<=4294967295)}},186:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>u});var r=n(861),i=n(671),o=n(144),s=n(687),a=n.n(s),c=(n(568),n(446)),l=function(){function e(t){var n=t.appId,r=t.content,o=t.ts;(0,i.Z)(this,e),this.appId=n,this.content=r,this.ts=o}return(0,o.Z)(e,[{key:"upload",value:function(){var e=this;return new Promise((function(t,n){wx.request({url:"https://report-ad.agoralab.co/v1/log/report",method:"post",data:{data:e.content,appId:e.appId,ts:e.ts,src:"miniapp",version:c.SDK_VERSION},success:function(){t()},fail:function(e){n(e)}})}))}}]),e}();const u=new(function(){function e(){(0,i.Z)(this,e),this.level=3,this.onLog=null,this.logItems=[],this.appId="",this.sid=""}return(0,o.Z)(e,[{key:"setOptions",value:function(e){var t=e.appId,n=void 0===t?"":t,r=e.sid,i=void 0===r?"":r;this.appId=n,this.sid=i}},{key:"setLogLevel",value:function(e){if("number"!=typeof e||!(e<=4&&e>=-1))throw Error("Invalid level");this.level=e}},{key:"_storeLog",value:function(e){this.logItems.push({msg:e,sid:this.sid}),this.logItems.length>5e4&&this.logItems.shift()}},{key:"_log",value:function(){for(var e="",t=arguments.length,n=new Array(t),r=0;r{"use strict";n.r(t),n.d(t,{checkValidBoolean:()=>l,checkValidEnum:()=>i,checkValidFloatNumber:()=>c,checkValidNumber:()=>a,checkValidObject:()=>o,checkValidString:()=>s,getServerUrlIp:()=>b,isASCII:()=>_,isArray:()=>w,isEmpty:()=>O,isInteger:()=>g,isNumber:()=>v,isString:()=>m,isValidBoolean:()=>d,isValidChannelName:()=>y,isValidNumber:()=>p,isValidString:()=>u,isValidToken:()=>f,stringifyErr:()=>E,throttle:()=>S,transformElapseStr:()=>R});var r=n(2),i=function(e,t,n){for(var r=0;r=t&&e.length<=n},p=function(e,t,n){return g(e)&&e>=t&&e<=n},h=function(e,t,n){return v(e)&&e>=t&&e<=n},d=function(e){return"boolean"==typeof e},f=function(e){return u(e,1,2047)},y=function(e){return m(e)&&/^[a-zA-Z0-9 \!\#\$\%\&\(\)\+\-\:\;\<\=\.\>\?\@\[\]\^\_\{\}\|\~\,]{1,64}$/.test(e)},_=function(e){if("string"==typeof e){for(var t=0;t255)return!1}return!0}},g=function(e){return"number"==typeof e&&e%1==0},v=function(e){return"number"==typeof e},m=function(e){return"string"==typeof e},w=function(e){return e instanceof Array},O=function(e){return null==e},E=function(e){return e instanceof Error||e.message?e.message:JSON.stringify(e)},b=function(e){var t=/wss:\/\/miniapp.agoraio.cn\/(\S+)\/api/g.exec(e);return t instanceof Array&&t[1]||""},R=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return(e=Number(e))<=0?"<0ms":e>0&&e<=50?"0~50ms":e>50&&e<=100?"50~100ms":e>100&&e<=200?"100~200ms":e>200&&e<=300?"200~300ms":e>300&&e<=500?"300~500ms":e>500&&e<=800?"500~800ms":e>800&&e<=1e3?"800~1000ms":e>1e3&&e<=1500?"1~1.5s":e>1500&&e<=2e3?"1.5~2s":e>2e3&&e<=3e3?"2~3s":e>3e3&&e<=5e3?"3~5s":e>5e3&&e<=8e3?"5~8s":e>8e3&&e<=1e4?"8~10s":">10s"},S=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(){for(var i=arguments.length,o=new Array(i),s=0;s{var t={utf8:{stringToBytes:function(e){return t.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(t.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n{var t,n;t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n>>6*(3-o)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],r=0,i=0;r>>6-2*i);return n}},e.exports=n},738:e=>{function t(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(t(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},568:(e,t,n)=>{var r,i,o,s,a;r=n(12),i=n(487).utf8,o=n(738),s=n(487).bin,(a=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?s.stringToBytes(e):i.stringToBytes(e):o(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var n=r.bytesToWords(e),c=8*e.length,l=1732584193,u=-271733879,p=-1732584194,h=271733878,d=0;d>>24)|4278255360&(n[d]<<24|n[d]>>>8);n[c>>>5]|=128<>>9<<4)]=c;var f=a._ff,y=a._gg,_=a._hh,g=a._ii;for(d=0;d>>0,u=u+m>>>0,p=p+w>>>0,h=h+O>>>0}return r.endian([l,u,p,h])})._ff=function(e,t,n,r,i,o,s){var a=e+(t&n|~t&r)+(i>>>0)+s;return(a<>>32-o)+t},a._gg=function(e,t,n,r,i,o,s){var a=e+(t&r|n&~r)+(i>>>0)+s;return(a<>>32-o)+t},a._hh=function(e,t,n,r,i,o,s){var a=e+(t^n^r)+(i>>>0)+s;return(a<>>32-o)+t},a._ii=function(e,t,n,r,i,o,s){var a=e+(n^(t|~r))+(i>>>0)+s;return(a<>>32-o)+t},a._blocksize=16,a._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var n=r.wordsToBytes(a(e,t));return t&&t.asBytes?n:t&&t.asString?s.bytesToString(n):r.bytesToHex(n)}},100:(e,t,n)=>{"use strict";e.exports=n(482)},482:(e,t,n)=>{"use strict";var r=t;function i(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}r.build="minimal",r.Writer=n(173),r.BufferWriter=n(155),r.Reader=n(408),r.BufferReader=n(593),r.util=n(693),r.rpc=n(994),r.roots=n(54),r.configure=i,i()},408:(e,t,n)=>{"use strict";e.exports=c;var r,i=n(693),o=i.LongBits,s=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var l,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},p=function(){return i.Buffer?function(e){return(c.create=function(e){return i.Buffer.isBuffer(e)?new r(e):u(e)})(e)}:u};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=p(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return l}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return d(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|d(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){r=e,c.create=p(),r._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},593:(e,t,n)=>{"use strict";e.exports=o;var r=n(408);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(693);function o(e){r.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},54:e=>{"use strict";e.exports={}},994:(e,t,n)=>{"use strict";t.Service=n(948)},948:(e,t,n)=>{"use strict";e.exports=i;var r=n(693);function i(e,t,n){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(i.prototype=Object.create(r.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,n,i,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return r.asPromise(e,a,t,n,i,o);if(a.rpcImpl)try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,n){if(e)return a.emit("error",e,t),s(e);if(null!==n){if(!(n instanceof i))try{n=i[a.responseDelimited?"decodeDelimited":"decode"](n)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",n,t),s(null,n)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){s(e)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},630:(e,t,n)=>{"use strict";e.exports=i;var r=n(693);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"==typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},693:function(e,t,n){"use strict";var r=t;function i(e,t,n){for(var r=Object.keys(t),i=0;i0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"==typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n{"use strict";e.exports=p;var r,i=n(693),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function p(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var h=function(){return i.Buffer?function(){return(p.create=function(){return new r})()}:function(){return new p}};function d(e,t,n){t[n]=255&e}function f(e,t){this.len=e,this.next=void 0,this.val=t}function y(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function _(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}p.create=h(),p.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(p.alloc=i.pool(p.alloc,i.Array.prototype.subarray)),p.prototype._push=function(e,t,n){return this.tail=this.tail.next=new c(e,t,n),this.len+=t,this},f.prototype=Object.create(c.prototype),f.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e},p.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new f((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},p.prototype.int32=function(e){return e<0?this._push(y,10,o.fromNumber(e)):this.uint32(e)},p.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},p.prototype.uint64=function(e){var t=o.from(e);return this._push(y,t.length(),t)},p.prototype.int64=p.prototype.uint64,p.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(y,t.length(),t)},p.prototype.bool=function(e){return this._push(d,1,e?1:0)},p.prototype.fixed32=function(e){return this._push(_,4,e>>>0)},p.prototype.sfixed32=p.prototype.fixed32,p.prototype.fixed64=function(e){var t=o.from(e);return this._push(_,4,t.lo)._push(_,4,t.hi)},p.prototype.sfixed64=p.prototype.fixed64,p.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},p.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var g=i.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var r=0;r>>0;if(!t)return this._push(d,1,0);if(i.isString(e)){var n=p.alloc(t=s.length(e));s.decode(e,n,0),e=n}return this.uint32(t)._push(g,t,e)},p.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(d,1,0)},p.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},p.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},p.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},p.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},p._configure=function(e){r=e,p.create=h(),r._configure()}},155:(e,t,n)=>{"use strict";e.exports=o;var r=n(173);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(693);function o(){r.call(this)}function s(e,t,n){e.length<40?i.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},500:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]{for(var t=[],n=0;n<256;++n)t[n]=(n+256).toString(16).substr(1);e.exports=function(e,n){var r=n||0,i=t;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var n=new Uint8Array(16);e.exports=function(){return t(n),n}}else{var r=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),r[t]=e>>>((3&t)<<3)&255;return r}}},171:(e,t,n)=>{var r=n(217),i=n(327);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},795:function(e,t,n){var r;!function(t){"use strict";function i(){}var o=i.prototype,s=t.EventEmitter;function a(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function c(e){return function(){return this[e].apply(this,arguments)}}function l(e){return"function"==typeof e||e instanceof RegExp||!(!e||"object"!=typeof e)&&l(e.listener)}o.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp)for(n in t={},r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n]);else t=r[e]||(r[e]=[]);return t},o.flattenListeners=function(e){var t,n=[];for(t=0;t{var r=n(698).default;function i(){"use strict";e.exports=i=function(){return n},e.exports.__esModule=!0,e.exports.default=e.exports;var t,n={},o=Object.prototype,s=o.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},c="function"==typeof Symbol?Symbol:{},l=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",p=c.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(t){h=function(e,t,n){return e[t]=n}}function d(e,t,n,r){var i=t&&t.prototype instanceof w?t:w,o=Object.create(i.prototype),s=new L(r||[]);return a(o,"_invoke",{value:A(e,n,s)}),o}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}n.wrap=d;var y="suspendedStart",_="suspendedYield",g="executing",v="completed",m={};function w(){}function O(){}function E(){}var b={};h(b,l,(function(){return this}));var R=Object.getPrototypeOf,S=R&&R(R(M([])));S&&S!==o&&s.call(S,l)&&(b=S);var k=E.prototype=w.prototype=Object.create(b);function P(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function I(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var u=l.arg,p=u.value;return p&&"object"==r(p)&&s.call(p,"__await")?t.resolve(p.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(p).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var i;a(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}})}function A(e,n,r){var i=y;return function(o,s){if(i===g)throw new Error("Generator is already running");if(i===v){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var c=T(a,r);if(c){if(c===m)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===y)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=g;var l=f(e,n,r);if("normal"===l.type){if(i=r.done?v:_,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function T(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function N(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function M(e){if(e||""===e){var n=e[l];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=s.call(o,"catchLoc"),l=s.call(o,"finallyLoc");if(c&&l){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),N(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;N(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:M(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},n}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},698:e=>{function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},687:(e,t,n)=>{var r=n(61)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},861:(e,t,n)=>{"use strict";function r(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var s=e.apply(t,n);function a(e){r(s,i,o,a,c,"next",e)}function c(e){r(s,i,o,a,c,"throw",e)}a(void 0)}))}}n.d(t,{Z:()=>i})},671:(e,t,n)=>{"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,{Z:()=>r})},144:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(142);function i(e,t){for(var n=0;n{"use strict";n.d(t,{Z:()=>i});var r=n(2);function i(e){var t=function(e,t){if("object"!=(0,r.Z)(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!=(0,r.Z)(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==(0,r.Z)(t)?t:String(t)}},2:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}n.d(t,{Z:()=>r})}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__webpack_require__),n.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{ChannelMediaRelayConfiguration:()=>I.ChannelMediaRelayConfiguration,Client:()=>le,LOG:()=>a.default,SDK_VERSION:()=>s.SDK_VERSION});var e=__webpack_require__(861),t=__webpack_require__(671),n=__webpack_require__(144),r=__webpack_require__(687),i=__webpack_require__.n(r),o=__webpack_require__(426),s=__webpack_require__(446),a=__webpack_require__(186);function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&void 0!==u[0]?u[0]:0,o=u.length>1&&void 0!==u[1]?u[1]:{},this.vid||(this.vid=O().vid),s={m:"net_status",ls:{type:0===r?"live-pusher":"live-player",vid:String(this.vid),app_id:this.appId,version:this.sdk_version,ip:this.ip,wx_version:null===(t=this.systemInfo)||void 0===t?void 0:t.version,wx_basic_version:null===(n=this.systemInfo)||void 0===n?void 0:n.SDKVersion},vs:{videoBitrate:String(null==o?void 0:o.videoBitrate),audioBitrate:String(null==o?void 0:o.audioBitrate),videoFPS:String(null==o?void 0:o.videoFPS),videoGOP:String(null==o?void 0:o.videoGOP),netSpeed:String(null==o?void 0:o.netSpeed),netQualityLevel:String(null==o?void 0:o.netQualityLevel),netJitter:String(null==o?void 0:o.netJitter)}},this.netStatusPts.push(s),10!==this.netStatusPts.length){e.next=11;break}return a=Date.now(),c=this.netStatusPts.splice(0,10),l={pts:c,sign:h()("src=miniapp_sdk&ts=".concat(a)),src:"miniapp_sdk",ts:a},e.next=11,this.request({body:l,url:this.url});case 11:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"report",value:(o=(0,e.Z)(i().mark((function e(t){var n,r,o,s,a,l,u,p,d,y,_,g=arguments;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=g.length>1&&void 0!==g[1]?g[1]:"",s=g.length>2&&void 0!==g[2]?g[2]:"",a=g.length>3&&void 0!==g[3]?g[3]:"",l=g.length>4&&void 0!==g[4]?g[4]:{},this.vid||(this.vid=O().vid),u={m:"online_user"===t?"online_user":"event",ls:f({vid:String(this.vid),app_id:this.appId,version:this.sdk_version,ip:this.ip,wx_version:null===(n=this.systemInfo)||void 0===n?void 0:n.version,wx_basic_version:null===(r=this.systemInfo)||void 0===r?void 0:r.SDKVersion},l),vs:{count:1}},"online_user"!==t&&((p={event:t,result:"success"===o?"1":"0",err_code:s.toString()}).message="string"==typeof a?a:JSON.stringify(a),c(u.ls,p)),this.pts.push(u),10!==this.pts.length){e.next=14;break}return d=this.pts.splice(0,10),y=Date.now(),_={pts:d,sign:h()("src=miniapp_sdk&ts=".concat(y)),src:"miniapp_sdk",ts:y},e.next=14,this.request({body:_,url:this.url});case 14:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"request",value:function(e){return new Promise((function(t,n){wx.request({url:e.url,data:e.body,header:{"content-type":"application/json"},method:"POST",success:function(e){200===e.statusCode?t(e):a.default.error("grafana report fail: ".concat(e.statusCode))},fail:function(e){a.default.error("grafana report fail",JSON.stringify(e)),n(e)}})}))}}]),r}(),v=function(){function e(){(0,t.Z)(this,e),this.ts=-1}return(0,n.Z)(e,[{key:"start",value:function(){return this.ts=(new Date).getTime(),this}},{key:"elapse",value:function(){if(-1===this.ts)throw new Error("timer not started");return(new Date).getTime()-this.ts}}],[{key:"create",value:function(){return new e}}]),e}(),m=__webpack_require__(483),w={ip:"",vid:""};function O(){return w}var E=["https://uap-ap-web-1.agora.io/api/v1","https://uap-ap-web-3.agora.io/api/v1","https://uap-ap-web-2.agoraio.cn/api/v1","https://uap-ap-web-4.agoraio.cn/api/v1"],b="connected",R="disconnected";const S=function(){function e(n,r){(0,t.Z)(this,e),this.serverlist=[],this.option=n,this.index=0,this.isInit=!0,this.state=R,this.hasInvokeClose=!1,this.emitter=r,this.on=this.emitter.on,this.off=this.emitter.off,this.emit=this.emitter.emit}return(0,n.Z)(e,[{key:"connect",value:function(){var e=this,t=this.option.grafanaReport;this.state!==R&&this.close(),function(e){var t=e.grafanaReport,n=e.argusReport,r={command:"convergeAllocateEdge",sid:e.sid,appId:e.appId,token:e.appId,uid:e.uid+"",cname:e.channel,ts:Math.floor(Date.now()/1e3),version:s.VERSION,seq:0,requestId:1};return new Promise((function(i,o){var s=0,c=v.create().start(),l=function(r,i){n.reportJoinCS(e.channel,e.uid,!1,c.elapse(),JSON.stringify(r),i,null),s++,a.default.error("get server list failed, counter:".concat(s," url:").concat(i," "),JSON.stringify(r)),4===s&&(t&&t.report("get_server_list",_,null==r?void 0:r.code,null==r?void 0:r.reason),o(r))},u=function(o){wx.request({url:o,data:{service_name:"miniapp",json_body:JSON.stringify(r)},header:{"content-type":"application/json","X-Packet-URI":61,"X-Packet-Service-Type":0},method:"POST",success:function(r){var s,u,p=r.data;if(r.profile?(s=r.profile.peerIP,w.ip=s):a.default.info("skip user IP report!"),200!==r.statusCode){var h="choose server fail";l({code:r.statusCode,reason:h},o),t&&t.report("choose_server",_,r.statusCode,h)}else{var d=c.elapse(),f=(0,m.transformElapseStr)(d),g=JSON.parse(p.json_body);u=g.vid,w.vid=u;var v=function(e){if(void 0!==e)return e.map((function(e){var t=e.address.split("."),n=t.length;return"wss://miniapp.agoraio.cn/".concat(t[n-4],"-").concat(t[n-3],"-").concat(t[n-2],"-").concat(t[n-1],"/api")}));a.default.error("miniapp service is not enabled for this AppID")}(g.servers);n.reportJoinCS(e.channel,e.uid,!0,d,null,o,v.join(",")),t.report("choose_server",y,"","",{elapse:f}),a.default.info("get server list request success,url:".concat(o,",time:").concat(d,"ms,elapse:").concat(f,",serverlist:").concat(JSON.stringify(v))),i({serverlist:v,url:o})}},fail:function(e){var n=e.errMsg||"choose server fail";l({code:901,reason:n},o),t&&t.report("choose_server",_,901,n)}})};e.apUrl?u(e.apUrl):E.map((function(e,t){u(e)}))}))}(this.option).then((function(t){var n=t.serverlist,r=t.url;a.default.info("websocket get server list final success, url:".concat(r,",serverlist:").concat(JSON.stringify(n))),e.index=0,e.serverlist=n,e.option&&e.option.servers&&(e.serverlist=e.option.servers),e.connectWorker(e.serverlist[e.index])})).catch((function(n){a.default.error("websocket connect failed in get server list ".concat(JSON.stringify(n))),t&&t.report("wxsocket_connect",_,null==n?void 0:n.code,null==n?void 0:n.reason),e.emit&&e.emit("socketError",n)}))}},{key:"connectWorker",value:function(){var e=this;this.state="connecting";var t=this.serverlist[this.index];a.default.info("websocket connect server: ",t);var n=this.option,r=(n.sid,n.channel),i=n.uid,o=n.argusReport,s=n.grafanaReport,c=v.create().start();this.ws=wx.connectSocket({url:t,fail:function(n){var l=JSON.stringify(n);a.default.error("websocket connect worker failed url:".concat(t," "),l),o&&o.reportConnectWS(r,i,!1,c.elapse(),l,null,t),s&&s.report("wxsocket_connect_worker",_,n.statusCode,l,{retry:String(e.index)})},success:function(n){var l=c.elapse(),u=(0,m.transformElapseStr)(l);if(a.default.info("websocket connect worker success,url:".concat(t,",time:").concat(l,"ms,elapse:").concat(u)),e.option.grafanaReport){var p=(0,m.getServerUrlIp)(t);e.option.grafanaReport.setOptions({ip:p})}o&&o.reportConnectWS(r,i,!0,l,null,null,t),s&&s.report("wxsocket_connect_worker",y,"","".concat(t),{elapse:u,retry:String(e.index)})}}),this.ws.onOpen(this._onopen.bind(this)),this.ws.onMessage(this._onmessage.bind(this)),this.ws.onError((function(e){a.default.error("websocket onerror: "+JSON.stringify(e)),o&&o.reportConnectWS(r,i,!1,c.elapse(),JSON.stringify(e),null,t),s&&s.report("wxsocket_connect_worker_on_error",_,"",JSON.stringify(e))})),this.establishWSTimeoutTimer=setTimeout((function(){e.state!==b&&e.connectNextWorker()}),5e3)}},{key:"connectNextWorker",value:function(){var e=this,t=this.option.grafanaReport;this.close().then((function(n){if(a.default.info("websocket connect next worker current:".concat(e.index," total:").concat(e.serverlist.length)),e.index>=e.serverlist.length-1){var r={code:905,reason:"connect websocket failed"};a.default.error("websocket connect next worker failed, all serverlist tried. ",JSON.stringify(r)),e.emit&&e.emit("socketError",{code:r.code,reason:r.reason,wsurl:JSON.stringify(e.serverlist)}),t&&t.report("wxsocket_connect_next_worker",_,r.code,r.reason)}else e.index++,e.connectWorker()}))}},{key:"_onopen",value:function(){a.default.info("websocket onopen"),clearTimeout(this.establishWSTimeoutTimer),this.state=b,this.isInit=!1,this.hasInvokeClose?a.default.info("websocket already invoke ws.Close, will not throw onopen event"):(this.ws.onClose(this._onclose.bind(this)),this.emit&&this.emit("onopen"))}},{key:"_onclose",value:function(e){a.default.info("websocket onclose:"+JSON.stringify(e)),this.emitter.emit("_wsClose"),clearTimeout(this.establishWSTimeoutTimer),this.state=R,e&&"close"==e.reason||this.hasInvokeClose||(this.isInit?this.connectNextWorker():this.emit&&this.emit("onclose",e))}},{key:"_onmessage",value:function(e){if(!this.hasInvokeClose){var t=JSON.parse(null==e?void 0:e.data)||{};"pong"!==(null==t?void 0:t.command)&&a.default.info("websocket receive message: ",JSON.stringify(e)),this.isConnected()&&this.emit&&this.emit("onmessage",e)}}},{key:"isConnected",value:function(){return this.state===b}},{key:"sendMessage",value:function(e){var t=JSON.parse(e)||{};"ping"!==(null==t?void 0:t.command)&&a.default.info("websocket send message: ",e),this.isConnected()&&this.ws&&this.ws.send({data:e})}},{key:"_checkServerList",value:function(e){return e instanceof Array!=0&&0!=e.length}},{key:"destroy",value:function(e){var t=this;this.state!==R&&this.close(),this.on("_wsClose",(function n(){t.off("_wsClose",n),t.serverlist=null,t.ws=null,t.emitter=null,t.on=null,t.off=null,t.emit=null,e&&e()}))}},{key:"close",value:function(){var e=this;return new Promise((function(t,n){return e.state==R?t():(clearTimeout(e.establishWSTimeoutTimer),e.hasInvokeClose=!0,e.state=R,e.ws?void e.ws.close({reason:"close",success:function(){a.default.info("websocket close success"),t()},fail:function(t){a.default.error("websocket close failed: ",JSON.stringify(t));var r=e.option,i=(r.sid,r.channel),o=r.uid,s=r.argusReport,c=r.grafanaReport;n();var l=e.serverlist[e.index];s&&s.reportConnectWS(i,o,!1,0,JSON.stringify(t),null,l),c&&c.report("wxsocket_close",_,"",JSON.stringify(t))},complete:function(){e.ws=null}}):t())}))}}]),e}(),k=function(){function e(n){(0,t.Z)(this,e),this.appId=n.appId,this.channel=n.channel,this.uid=n.uid+"",this.sid=n.sid,this.seq=1,this.requestId=2}return(0,n.Z)(e,[{key:"setSid",value:function(e){this.sid=e}},{key:"_getWorkerManagerMsg",value:function(){return{appId:this.appId,cname:this.channel,uid:this.uid,sid:this.sid,sdkVersion:s.VERSION,seq:++this.seq,requestId:++this.requestId,ts:Math.floor(Date.now()/1e3)}}},{key:"send",value:function(e){var t=this._getWorkerManagerMsg();return t.clientRequest=e,t}},{key:"updatePushUrl",value:function(){var e=this._getWorkerManagerMsg();return e.clientRequest={action:"update_url",role:"publish",uid:+this.uid},e}},{key:"ping",value:function(){return{command:"ping",requestId:++this.requestId,appId:this.appId,cname:this.channel,uid:this.uid+"",sid:this.sid,ts:Math.floor(Date.now()/1e3)}}},{key:"ping2",value:function(){var e=this._getWorkerManagerMsg();return e.clientRequest={action:"ping"},e}},{key:"setRole",value:function(e){var t=this._getWorkerManagerMsg();return t.clientRequest={action:"set_role",role:e},t}},{key:"rejoin",value:function(e,t,n,r,i,o,s,a,c){var l=this._getWorkerManagerMsg();return l.clientRequest={action:"join",role:o,appId:e,customAudioCodec:a,key_vocs:r||e,key_vos:r||e,channel_name:t,uid:n+"",known_speakers:i,clientType:"undefined"==typeof qq?"wechat":"qq",audio_only:s,uidType:c},l}},{key:"join",value:function(e,t,n,r,i,o,a,c,l,u){var p=this._getWorkerManagerMsg();return p.clientRequest={action:"join",role:i,appId:e,customAudioCodec:l,key_vocs:r||e,key_vos:r||e,channel_name:t,uid:n+"",vid:O().vid.toString(),device:o,os:a,version:s.SDK_VERSION,clientType:"undefined"==typeof qq?"wechat":"qq",audio_only:c,uidType:u},p}},{key:"muteLocal",value:function(e,t){var n=this._getWorkerManagerMsg();return n.clientRequest={action:"mute_local",uid:+e,target:t,mute:!0},n}},{key:"unmuteLocal",value:function(e,t){var n=this._getWorkerManagerMsg();return n.clientRequest={action:"mute_local",uid:+e,target:t,mute:!1},n}},{key:"mute",value:function(e,t){var n=this._getWorkerManagerMsg();return n.clientRequest={action:"mute",uid:+e,target:t},n}},{key:"unmute",value:function(e,t){var n=this._getWorkerManagerMsg();return n.clientRequest={action:"unmute",uid:+e,target:t},n}},{key:"publish",value:function(e){var t=this._getWorkerManagerMsg();return t.clientRequest={action:"publish",uid:+e},t}},{key:"unpublish",value:function(e){var t=this._getWorkerManagerMsg();return t.clientRequest={action:"unpublish",uid:+e},t}},{key:"subscribe",value:function(e,t){var n=this._getWorkerManagerMsg();return n.clientRequest={action:"subscribe",uid:+e,options:{audio:t.audio,video:t.video}},n}},{key:"unsubscribe",value:function(e){var t=this._getWorkerManagerMsg();return t.clientRequest={action:"unsubscribe",uid:[+e]},t}},{key:"setRemoteVideoStreamType",value:function(e,t){var n=this._getWorkerManagerMsg();return n.clientRequest={action:"set_remote_stream_type",uid:+e,type:t},n}},{key:"renewToken",value:function(e){var t=this._getWorkerManagerMsg();return t.clientRequest={action:"update_key",key_vos:e},t}},{key:"leave",value:function(e){var t=this._getWorkerManagerMsg();return t.clientRequest={action:"leave",uid:+e},t}}]),e}();function P(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map((function(e){e(n)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,n)}))}}}var I=__webpack_require__(500),A=__webpack_require__.n(I);const T=function(){function r(e,n){(0,t.Z)(this,r),this.appId=e.appId,this.channel=e.channel,this.uid=e.uid,this.sid=e.sid,this.role=e.role,this.channelKey=e.channelKey,this.clientId="client",this.option=e,this.timers=new Set,this.grafanaReport=e.grafanaReport,this.argusReport=e.argusReport,this.audioCodec=e.audioCodec,this.uidType=e.uidType,this.clientEmitter=n,this.emitter=new P,this.on=this.emitter.on,this.off=this.emitter.off,this.emit=this.emitter.emit,this.join=this.join.bind(this),this.msgManager=new k(e)}var o,s,c;return(0,n.Z)(r,[{key:"connect",value:function(){var e=this;return new Promise((function(t,n){e.ws=new S(e.option,e.emitter),e.ws.connect(),e.on("onmessage",e._onMessage.bind(e)),e.on("socketError",(function(t){n(t),a.default.error("worker socket error: ",JSON.stringify(t)),e.grafanaReport&&e.grafanaReport.report("worker_connect_socket_error",_,"",JSON.stringify(t))})),e.on("onopen",(function n(){e.off&&e.off("onopen",n),e._ping(),t()})),e.on("onclose",(function(t){a.default.error("worker on close: ",JSON.stringify(t)),e.ws=null,e.clientEmitter.emit("error",{code:904,reason:"websocket disconnected"}),e.grafanaReport&&e.grafanaReport.report("worker_connect_on_close",_,"",JSON.stringify(t))}))}))}},{key:"_onMessage",value:function(e){if(e&&e.data){var t=JSON.parse(e.data);if(t&&"pong"!==t.command&&(a.default.info("worker onmessage: ",t),this.argusReport.reportServerEvent(this.channel,this.uid,!0,0,"serverEvent",t)),t.requestId&&this.emit(t.requestId,t),"serverStatus"===t.command){if(t.code&&200!==t.code){if(this.grafanaReport&&this.grafanaReport.report("worker_on_message",_,t.code,null==t?void 0:t.reason),503===t.code)return;a.default.error("worker onmessage error: ",JSON.stringify(t)),this.clientEmitter.emit("error",{code:t.code,reason:t.reason||"server error"})}if(t.serverStatus){a.default.info("Receive message from server: ".concat(JSON.stringify(t.serverStatus)));var n=t.serverStatus.action;if("audio-mute"==n)return t.serverStatus.mute?this.clientEmitter.emit("mute-audio",{uid:t.serverStatus.uid}):this.clientEmitter.emit("unmute-audio",{uid:t.serverStatus.uid});if("video-mute"==n)return t.serverStatus.mute?this.clientEmitter.emit("mute-video",{uid:t.serverStatus.uid}):this.clientEmitter.emit("unmute-video",{uid:t.serverStatus.uid});if("key-expired"===n)return this.clientEmitter.emit("token-privilege-did-expire");if("key-will-expire"===n)return this.clientEmitter.emit("token-privilege-will-expire");if("client-is-banned-by-server"===n)return this.clientEmitter.emit("client-banned");this.clientEmitter.emit(n,t.serverStatus)}}}}},{key:"_sendMessage",value:function(e){var t=this;if(this.ws)return new Promise((function(n,r){if(!t.isWSConnected())return r({code:904,reason:"websocket disconnected",wsurl:t.getWSUrl()});"ping"!==e.command&&a.default.info("worker send message: ",e);var i,o=e?e.requestId:null,s=function e(s){if(t.ws)return t.off(o,e),clearTimeout(i),t.timers.delete(i),200==s.code?n(s.serverResponse):r({code:s.code,reason:s.msg||s.reason,serverResponse:s.serverResponse,wsurl:t.getWSUrl()})};if(!o)return r({code:902,reason:"no requestid"});t.ws.sendMessage(JSON.stringify(e)),t.on(o,s),i=setTimeout((function(){return s({code:903,reason:"time out"})}),1e4),t.timers.add(i)}))}},{key:"_ping",value:function(){var e=this;this.pingTimer=setInterval((function(){e.ws.sendMessage(JSON.stringify(e.msgManager.ping()))}),3e3)}},{key:"setRole",value:function(e){return this._sendMessage(this.msgManager.setRole(e))}},{key:"rejoin",value:function(e,t){return this._sendMessage(this.msgManager.rejoin(this.appId,this.channel,this.uid,this.channelKey,e,this.role,t,this.audioCodec,this.uidType))}},{key:"join",value:function(e,t,n){return this._sendMessage(this.msgManager.join(this.appId,this.channel,this.uid,this.channelKey,this.role,e,t,n,this.audioCodec,this.uidType))}},{key:"send",value:function(e){return this._sendMessage(this.msgManager.send(e))}},{key:"updatePushUrl",value:function(){return this._sendMessage(this.msgManager.updatePushUrl())}},{key:"publish",value:function(){return this._sendMessage(this.msgManager.publish(this.uid))}},{key:"unpublish",value:function(){return this._sendMessage(this.msgManager.unpublish(this.uid))}},{key:"subscribe",value:function(e,t){return this._sendMessage(this.msgManager.subscribe(e,t))}},{key:"unsubscribe",value:function(e){return this._sendMessage(this.msgManager.unsubscribe(e))}},{key:"setRemoteVideoStreamType",value:function(e,t){return this._sendMessage(this.msgManager.setRemoteVideoStreamType(e,t))}},{key:"mute",value:function(e,t){return this._sendMessage(this.msgManager.mute(e,t))}},{key:"unmute",value:function(e,t){return this._sendMessage(this.msgManager.unmute(e,t))}},{key:"muteLocal",value:function(e){return this._sendMessage(this.msgManager.muteLocal(this.uid,e))}},{key:"unmuteLocal",value:function(e){return this._sendMessage(this.msgManager.unmuteLocal(this.uid,e))}},{key:"renewToken",value:function(e){return this._sendMessage(this.msgManager.renewToken(e))}},{key:"leave",value:function(){return this._sendMessage(this.msgManager.leave(this.uid))}},{key:"isWSConnected",value:function(){return!!this.ws&&this.ws.isConnected()}},{key:"getWSUrl",value:function(){return this.ws?this.ws.serverlist[this.ws.index]:""}},{key:"destroy",value:function(){var e=this;return new Promise((function(t,n){clearInterval(e.pingTimer),e.timers.size&&(e.timers.forEach((function(e){clearInterval(e)})),e.timers.clear()),e.ws?e.ws.destroy((function(){e.ws=null,e.emitter=null,e.on=null,e.off=null,e.emit=null,t()})):t()}))}},{key:"startChannelMediaRelay",value:(c=(0,e.Z)(i().mark((function e(t){var n,r,o,s,c,l=this;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.channelMediaRelayController){e.next=2;break}throw new I.ChannelMediaError("RELAY_ALREADY_START","",I.CHANNEL_MEDIA_RELAY_ERROR.RELAY_ALREADY_START);case 2:return n=function(e){l.clientEmitter.emit("channel-media-relay-event",{code:e})},r=function(e,t,n){e===I.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_FAILURE&&t===I.CHANNEL_MEDIA_RELAY_ERROR.SERVER_CONNECTION_LOST&&(l.channelMediaRelayController.dispose(),l.channelMediaRelayController=null),l.clientEmitter.emit("channel-media-relay-state",{state:e,code:t,data:n})},o={token:this.appId,appId:this.appId,cname:this.channel,uid:this.uid,sid:this.sid,clientId:this.clientId},this.channelMediaRelayController=new(A())(o,this.clientId),this.channelMediaRelayController.on("event",n),this.channelMediaRelayController.on("state",r),e.prev=8,e.next=11,this.channelMediaRelayController.startChannelMediaRelay(t);case 11:e.next=23;break;case 13:throw e.prev=13,e.t0=e.catch(8),a.default.error("[".concat(this.clientId,"] startChannelMediaRelay exception: ").concat(JSON.stringify(e.t0))),s=I.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_FAILURE,"",c=e.t0 instanceof I.ChannelMediaError?"SetSourceChannelStatus"===e.t0.data||e.t0.data&&e.t0.data.serverResponse&&"SetSourceChannel"===e.t0.data.serverResponse.command?"FAILED_JOIN_SRC":"SetDestChannelStatus"===e.t0.data||e.t0.data&&e.t0.data.serverResponse&&"SetDestChannel"===e.t0.data.serverResponse.command?"FAILED_JOIN_DEST":e.t0.data&&e.t0.data.serverResponse&&"StartPacketTransfer"===e.t0.data.serverResponse.command?"FAILED_PACKET_SENT_TO_DEST":e.t0.message===I.CHANNEL_MEDIA_ERROR.REQUEST_TIMEOUT||e.t0.message===I.CHANNEL_MEDIA_ERROR.WAIT_STATUS_TIMEOUT?"SERVER_NO_RESPONSE":e.t0.message===I.CHANNEL_MEDIA_ERROR.REQUEST_FAILED||e.t0.message===I.CHANNEL_MEDIA_ERROR.WAIT_STATUS_ERROR?"SERVER_ERROR_RESPONSE":e.t0.message===I.CHANNEL_MEDIA_ERROR.AP_REQUEST_TIMEOUT?"NO_RESOURCE_AVAILABLE":e.t0.message===I.CHANNEL_MEDIA_ERROR.WS_ABORT||e.t0.message===I.CHANNEL_MEDIA_ERROR.AP_REQUEST_ABORT?"OPERATION_ABORT":"INTERNAL_ERROR":"INTERNAL_ERROR",this.clientEmitter.emit("channel-media-relay-state",{state:s,code:I.CHANNEL_MEDIA_RELAY_ERROR[c]}),this.channelMediaRelayController&&(this.channelMediaRelayController.dispose(),this.channelMediaConfig=null,this.channelMediaRelayController=null),this.clientEmitter.emit("channel-media-relay-state",{state:I.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_IDLE}),new I.ChannelMediaError(c,null,I.CHANNEL_MEDIA_RELAY_ERROR[c]);case 23:this.clientEmitter.emit("channel-media-relay-state",{state:I.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_RUNNING,code:I.CHANNEL_MEDIA_RELAY_ERROR.RELAY_OK}),this.channelMediaConfig=t;case 25:case"end":return e.stop()}}),e,this,[[8,13]])}))),function(e){return c.apply(this,arguments)})},{key:"updateChannelMediaRelay",value:(s=(0,e.Z)(i().mark((function e(t){var n,r;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.channelMediaRelayController){e.next=2;break}throw new I.ChannelMediaError("RELAY_NOT_START",null,I.CHANNEL_MEDIA_RELAY_ERROR.RELAY_NOT_START);case 2:return e.prev=2,e.next=5,this.channelMediaRelayController.updateChannelMediaRelay(t);case 5:e.next=18;break;case 7:throw e.prev=7,e.t0=e.catch(2),a.default.debug("[".concat(this.clientId,"] updateChannelMediaRelay exception: ").concat(JSON.stringify(e.t0))),n=I.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_FAILURE,"",r=e.t0 instanceof I.ChannelMediaError?e.t0.message===I.CHANNEL_MEDIA_ERROR.REQUEST_TIMEOUT||e.t0.message===I.CHANNEL_MEDIA_ERROR.WAIT_STATUS_TIMEOUT?"SERVER_NO_RESPONSE":e.t0.message===I.CHANNEL_MEDIA_ERROR.REQUEST_FAILED||e.t0.message===I.CHANNEL_MEDIA_ERROR.WAIT_STATUS_ERROR?"SERVER_ERROR_RESPONSE":e.t0.message===I.CHANNEL_MEDIA_ERROR.WS_ABORT||e.t0.message===I.CHANNEL_MEDIA_ERROR.AP_REQUEST_ABORT?"OPERATION_ABORT":"INTERNAL_ERROR":"INTERNAL_ERROR",this.clientEmitter.emit("channel-media-relay-event",{code:I.CHANNEL_MEDIA_RELAY_EVENT.PACKET_UPDATE_DEST_CHANNEL_REFUSED}),this.clientEmitter.emit("channel-media-relay-state",{state:n,code:I.CHANNEL_MEDIA_RELAY_ERROR[r]}),this.channelMediaRelayController&&(this.channelMediaRelayController.dispose(),this.channelMediaConfig=null,this.channelMediaRelayController=null),this.clientEmitter.emit("channel-media-relay-state",{state:I.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_IDLE}),new I.ChannelMediaError(r,null,I.CHANNEL_MEDIA_RELAY_ERROR[r]);case 18:this.channelMediaConfig=t;case 19:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(e){return s.apply(this,arguments)})},{key:"stopChannelMediaRelay",value:(o=(0,e.Z)(i().mark((function e(){var t,n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.channelMediaRelayController){e.next=2;break}throw new I.ChannelMediaError("RELAY_NOT_START",null,I.CHANNEL_MEDIA_RELAY_ERROR.RELAY_NOT_START);case 2:return e.prev=2,e.next=5,this.channelMediaRelayController.stopChannelMediaRelay();case 5:e.next=17;break;case 7:throw e.prev=7,e.t0=e.catch(2),a.default.debug("[".concat(this.clientId,"] stopChannelMediaRelay exception: ").concat(JSON.stringify(e.t0))),t=I.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_FAILURE,"",n=e.t0 instanceof I.ChannelMediaError?e.t0.message===I.CHANNEL_MEDIA_ERROR.REQUEST_TIMEOUT||e.t0.message===I.CHANNEL_MEDIA_ERROR.WAIT_STATUS_TIMEOUT?"SERVER_NO_RESPONSE":e.t0.message===I.CHANNEL_MEDIA_ERROR.REQUEST_FAILED||e.t0.message===I.CHANNEL_MEDIA_ERROR.WAIT_STATUS_ERROR?"SERVER_ERROR_RESPONSE":"INTERNAL_ERROR":"INTERNAL_ERROR",this.clientEmitter.emit("channel-media-relay-state",{state:t,code:I.CHANNEL_MEDIA_RELAY_ERROR[n]}),this.channelMediaRelayController&&(this.channelMediaRelayController.dispose(),this.channelMediaConfig=null,this.channelMediaRelayController=null),this.emit("channel-media-relay-state",{state:I.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_IDLE}),new I.ChannelMediaError(n,null,I.CHANNEL_MEDIA_RELAY_ERROR[n]);case 17:this.channelMediaConfig=null,this.channelMediaRelayController=null;case 19:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(){return o.apply(this,arguments)})}]),r}();var C={videoBitrate:"Miniapp_SDK_Pusher_Video_Bitrate",audioBitrate:"Miniapp_SDK_Pusher_Audio_Bitrate",videoFPS:"Miniapp_SDK_Pusher_Video_FPS",videoGOP:"Miniapp_SDK_Pusher_Video_GOP",netSpeed:"Miniapp_SDK_Pusher_Net_Speed",videoCache:"Miniapp_SDK_Pusher_Video_Cache",audioCache:"Miniapp_SDK_Pusher_Audio_Cache",videoWidth:"Miniapp_SDK_Pusher_Video_Width",videoHeight:"Miniapp_SDK_Pusher_Video_Height",netJitter:"Miniapp_SDK_Pusher_Net_Jitter",netQualityLevel:"Miniapp_SDK_Pusher_Net_QualityLevel"},N={videoBitrate:"Miniapp_SDK_Player_Video_Bitrate",audioBitrate:"Miniapp_SDK_Player_Audio_Bitrate",videoFPS:"Miniapp_SDK_Player_Video_FPS",videoGOP:"Miniapp_SDK_Player_Video_GOP",netSpeed:"Miniapp_SDK_Player_Net_Speed",videoCache:"Miniapp_SDK_Player_Video_Cache",audioCache:"Miniapp_SDK_Player_Audio_Cache",vDecCacheSize:"Miniapp_SDK_Player_V_Dec_Cache_Size",vSumCacheSize:"Miniapp_SDK_Player_V_Sum_Cache_Size",avPlayInterval:"Miniapp_SDK_Player_AV_Play_Interval",avRecvInterval:"Miniapp_SDK_Player_AV_Recv_Interval",audioCacheThreshold:"Miniapp_SDK_Player_Audio_Cache_Threshold",videoWidth:"Miniapp_SDK_Player_Video_Width",videoHeight:"Miniapp_SDK_Player_Video_Height",netJitter:"Miniapp_SDK_Player_Net_Jitter",netQualityLevel:"Miniapp_SDK_Player_Net_QualityLevel"},L=__webpack_require__(699),M=__webpack_require__.n(L),j=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;if("function"!=typeof e)throw Error("request must be function");var n=function(e,t){!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(null==e)e=1;else if(0===e)throw new Error("Concurrency must not be zero")}(t);var n=[],r=[];return{concurrency:t,push:function(e,t){var r=this;n.push({task:e,callback:t}),setTimeout((function(){r.process()}),0)},process:function(){for(var e=this,t=function(){var t,i=n.shift();r.push(i),function(e,t){e(t)}(i.task,(t=function(){e.pull(i),"function"==typeof i.callback&&i.callback.apply(i,arguments),e.process()},function(){if(null===t)throw new Error("Callback was already called");var e=t;return t=null,e.apply(void 0,arguments)}))};this.concurrency>r.length&&n.length;)t()},pull:function(e){var t=r.indexOf(e);-1!==t&&r.splice(t,1)}}}(0,t);return function(t){n.push((function(n){var r=t.complete;t.complete=function(){n(),"function"==typeof r&&r.apply(void 0,arguments)},e(t)}))}}(wx.request,2);function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function x(e){for(var t=1;t4&&void 0!==arguments[4]&&arguments[4],c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,l=arguments.length>6?arguments[6]:void 0,u=arguments.length>7?arguments[7]:void 0;if("function"==typeof s){var p=l,h=u;l=s,u=c,s=p||!1,c=h||0}return new Promise((function(p,h){if(i._dealSid(),i.grafanaReport.onlineUser(),i.worker)return i._startNetworkJudge(),l&&l(),p();if(e){if("string"!=typeof e||"null"===e.toLowerCase()){var d=new Error("Invalid channelKey");return a.default.error("client rejoin channel failed: ".concat(d.message)),u&&u(d),void h(d)}}else e=i.appId;if(!t||"string"!=typeof t||"null"===t.toLowerCase()||t.length>128){var f=new Error("Invalid channel");return a.default.error("client rejoin channel failed: ".concat(f.message)),u&&u(f),void h(f)}if("boolean"!=typeof s){var g=new Error("isAudioOnly should be boolean");return a.default.error("client rejoin channel failed: ".concat(g.message)),u&&u(g),h(g),void i.grafanaReport.report("join",_,"",g.message)}if(1==c){if(!n.trim()){var w=new Error("uid empty");return a.default.error("client rejoin channel failed: ".concat(w.message)),u&&u(w),void h(w)}i.uid=n}else if(i.uid=n||(0,o.random)(1e7),i.uid=Number.parseInt(i.uid),!(0,o.is32Uint)(i.uid)){var O=new Error("Invalid uid type");return a.default.error("client rejoin channel failed: ".concat(O.message)),u&&u(O),void h(O)}i.channel=t,i.worker=new T({appId:i.appId,channel:i.channel,uid:i.uid,sid:i.sid,role:i.role,servers:i.servers,apUrl:i.apUrl,channelKey:e,grafanaReport:i.grafanaReport,argusReport:i.argusReport,audioCodec:i.audioCodec,uidType:c},i.emitter);var E=v.create().start();i.worker.connect().then((function(){return i.worker.rejoin(r,s)})).then((function(e){setTimeout((function(){a.default.info("client rejoin channel success"),l&&l(i.uid),p(i.uid),i.argusReport.reportRejoin(i.channel,i.uid,!0,E.elapse(),null,i.appId,i.worker&&i.worker.getWSUrl()),i.grafanaReport.report("join",y),i._startNetworkJudge()}),1),e&&e.uid&&(i.uid=e.uid,i.worker.uid=e.uid)})).catch((function(e){i.destroy(),a.default.error("client rejoin channel failed: ".concat((0,m.stringifyErr)(e))),u&&u(e),h(e),i.argusReport.reportRejoin(i.channel,i.uid,!1,E.elapse(),JSON.stringify(e),i.appId,i.worker&&i.worker.getWSUrl()),i.grafanaReport.report("join",_,e.code,null==e?void 0:e.reason)}))}))}},{key:"join",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,c=arguments.length>5?arguments[5]:void 0,l=arguments.length>6?arguments[6]:void 0;if("function"==typeof i){var u=c,p=l;c=i,l=s,i=u||!1,s=p||0}return new Promise((function(u,p){if(r._dealSid(),r.grafanaReport.onlineUser(),r.worker)return a.default.info("client join channel success"),c&&c(),r._startNetworkJudge(),u();if(e){if("string"!=typeof e||"null"===e.toLowerCase()){var h=new Error("Invalid channelKey");return a.default.error("client join channel failed: ".concat(h.message)),l&&l(h),p(h),void r.grafanaReport.report("join",_,"",h.message)}}else e=r.appId;if(!t||"string"!=typeof t||"null"===t.toLowerCase()||t.length>128){var d=new Error("Invalid channel");return a.default.error("client join channel failed: ".concat(d.message)),l&&l(d),p(d),void r.grafanaReport.report("join",_,"",d.message)}if("boolean"!=typeof i){var f=new Error("isAudioOnly should be boolean");return a.default.error("client join channel failed: ".concat(f.message)),l&&l(f),p(f),void r.grafanaReport.report("join",_,"",f.message)}if(1==s){if(!n.trim()){var g=new Error("uid empty");return a.default.error("client join channel failed: ".concat(g.message)),l&&l(g),p(g),void r.grafanaReport.report("join",_,"",g.message)}r.uid=n}else if(r.uid=n||(0,o.random)(1e7),r.uid=Number.parseInt(r.uid),!(0,o.is32Uint)(r.uid)){var w=new Error("Invalid uid type");return a.default.error("client join channel failed: ".concat(w.message)),l&&l(w),p(w),void r.grafanaReport.report("join",_,"",w.message)}r.channel=t,r.worker=new T({appId:r.appId,channel:r.channel,uid:r.uid,sid:r.sid,role:r.role,servers:r.servers,apUrl:r.apUrl,channelKey:e,grafanaReport:r.grafanaReport,argusReport:r.argusReport,audioCodec:r.audioCodec,uidType:s},r.emitter);var O=v.create().start();r.worker.connect().then((function(){return r.worker.join(r.systemInfo.model,r.systemInfo.system,i)})).then((function(e){var t=O.elapse(),n=(0,m.transformElapseStr)(t);setTimeout((function(){a.default.info("client join channel success,time:".concat(t,"ms,elapse:").concat(n)),c&&c(r.uid),u(r.uid),r._startNetworkJudge(),r.argusReport.reportJoin(r.channel,r.uid,!0,t),r.grafanaReport.report("join",y,"","",{elapse:n})}),1),e&&e.uid&&(r.uid=e.uid,r.worker.uid=e.uid)})).catch((function(e){r.destroy(),a.default.error("client join channel failed: ".concat((0,m.stringifyErr)(e))),l&&l(e),p(e),r.argusReport.reportJoin(r.channel,r.uid,!1,O.elapse(),JSON.stringify(e)),r.grafanaReport.report("join",_,null==e?void 0:e.code,null==e?void 0:e.reason)}))}))}},{key:"publish",value:function(e,t){var n=this;return new Promise((function(r,i){n._checkWorker();var o=v.create().start();n.worker.publish().then((function(t){n.pushUrl=t.url,setTimeout((function(){a.default.info("client publish url: ".concat(t.url," success")),e&&e(t.url),r(t.url),n.argusReport.reportPublish(t.url,n.channel,n.uid,!0,o.elapse()),n.grafanaReport.report("publish",y)}),1)})).catch((function(e){a.default.error("client publish failed: ".concat((0,m.stringifyErr)(e))),t&&t(e),i(e),n.argusReport.reportPublish(null,n.channel,n.uid,!1,o.elapse(),JSON.stringify(e)),n.grafanaReport.report("publish",_,e.code,null==e?void 0:e.reason)}))}))}},{key:"unpublish",value:function(e,t){var n=this;return new Promise((function(r,i){n._checkWorker();var o=v.create().start();n.worker.unpublish().then((function(t){n.pushUrl=null,setTimeout((function(){a.default.info("client unpublish success"),e&&e(),r(),n.argusReport.reportUnPublish(n.channel,n.uid,!0,o.elapse()),n.grafanaReport.report("unpublish",y)}),1)})).catch((function(e){a.default.error("client unpublish failed: ".concat((0,m.stringifyErr)(e))),t&&t(e),i(e),n.argusReport.reportUnPublish(n.channel,n.uid,!1,o.elapse(),JSON.stringify(e)),n.grafanaReport.report("unpublish",_,e.code,null==e?void 0:e.reason)}))}))}},{key:"subscribe",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{audio:!0,video:!0},r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if("function"==typeof n){var o=i;i=r,r=n,n=o||{audio:!0,video:!0}}return new Promise((function(o,s){t._checkUid(e),t._checkWorker();var c=v.create().start();t.worker.subscribe(e,n).then((function(n){t.playUrls.set(e,n.url),setTimeout((function(){a.default.info("client stream ".concat(e," subscribed successful")),r&&r(n.url,n.rotation),o({url:n.url,rotation:n.rotation}),t.argusReport.reportSubscribe(n.url,e,t.channel,t.uid,!0,c.elapse()),t.grafanaReport.report("subscribe",y)}),1)})).catch((function(n){a.default.error("client stream ".concat(e," subscribed failed: ").concat((0,m.stringifyErr)(n))),i&&i(n),s(n),t.argusReport.reportSubscribe(null,e,t.channel,t.uid,!1,c.elapse(),JSON.stringify(n)),t.grafanaReport.report("subscribe",_,n.code,null==n?void 0:n.reason)}))}))}},{key:"unsubscribe",value:function(e,t,n){var r=this;return new Promise((function(i,o){r._checkUid(e),r._checkWorker();var s=v.create().start();r.worker.unsubscribe(e).then((function(n){r.playUrls.delete(e),setTimeout((function(){a.default.info("client unsubscribe ".concat(e," successful")),t&&t(),i(),r.argusReport.reportUnSubscribe(e,r.channel,r.uid,!0,s.elapse(),null),r.grafanaReport.report("unsubscribe",y)}),1)})).catch((function(t){a.default.error("client unsubscribe ".concat(e," failed: ").concat((0,m.stringifyErr)(t))),n&&n(t),o(t),r.argusReport.reportUnSubscribe(e,r.channel,r.uid,!1,s.elapse(),JSON.stringify(t)),r.grafanaReport.report("unsubscribe",_,t.code,null==t?void 0:t.reason)}))}))}},{key:"mute",value:function(e,t,n,r){var i=this;return new Promise((function(o,s){if(i._checkUid(e),i._checkWorker(),"video"!==t&&"audio"!==t&&"all"!==t){var c=new Error('target should be "video", "audio" or "all"');return a.default.error("client mute ".concat(e," failed: ").concat(c.message)),r&&r(c),void s(c)}var l=v.create().start();i.worker.mute(e,t).then((function(r){setTimeout((function(){a.default.info("client mute ".concat(e," ").concat(t," success")),n&&n(),o(),i.argusReport.reportMuteRemote(i.channel,i.uid,!0,l.elapse(),null,e,i.targetMap[t],1),i.grafanaReport.report("mute",y)}),1)})).catch((function(n){a.default.error("client mute ".concat(e," ").concat(t," failed: ").concat((0,m.stringifyErr)(n))),r&&r(n),s(n),i.argusReport.reportMuteRemote(i.channel,i.uid,!1,l.elapse(),JSON.stringify(n),e,i.targetMap[t],1),i.grafanaReport.report("mute",_,n.code,null==n?void 0:n.reason)}))}))}},{key:"unmute",value:function(e,t,n,r){var i=this;return new Promise((function(o,s){if(i._checkUid(e),i._checkWorker(),"video"!==t&&"audio"!==t&&"all"!==t){var c=new Error('target should be "video", "audio" or "all"');return a.default.error("client unmute ".concat(e," ").concat(t," failed: ").concat(c.message)),r&&r(c),void s(c)}var l=v.create().start();i.worker.unmute(e,t).then((function(r){setTimeout((function(){a.default.info("client unmute ".concat(e," ").concat(t," success")),n&&n(),o(),i.argusReport.reportMuteRemote(i.channel,i.uid,!0,l.elapse(),null,e,i.targetMap[t],-1),i.grafanaReport.report("unmute",y)}),1)})).catch((function(n){a.default.error("client unmute ".concat(e," ").concat(t," failed: ").concat((0,m.stringifyErr)(n))),r&&r(n),s(n),i.argusReport.reportMuteRemote(i.channel,i.uid,!1,l.elapse(),JSON.stringify(n),e,i.targetMap[t],-1),i.grafanaReport.report("unmute",_,n.code,null==n?void 0:n.reason)}))}))}},{key:"setRemoteVideoStreamType",value:function(e,t,n,r){var i=this;return new Promise((function(o,s){i._checkUid(e),i._checkWorker();var c=v.create().start();i.worker.setRemoteVideoStreamType(e,t).then((function(r){setTimeout((function(){a.default.info("client set remoteVideoStreamType ".concat(e," ").concat(t," success")),n&&n(),o(),i.argusReport.reportSetRemoteStreamType(i.channel,i.uid,!0,c.elapse(),null,t),i.grafanaReport.report("set_remote_stream_type",y)}),1)})).catch((function(n){a.default.error("client set remoteVideoStreamType ".concat(e," ").concat(t," failed: ").concat((0,m.stringifyErr)(n))),r&&r(n),s(n),i.argusReport.reportSetRemoteStreamType(i.channel,i.uid,!1,c.elapse(),JSON.stringify(n),t),i.grafanaReport.report("set_remote_stream_type",_,n.code,null==n?void 0:n.reason)}))}))}},{key:"renewToken",value:function(e,t,n){var r=this;return new Promise((function(i,o){r._checkWorker();var s=v.create().start();r.worker.renewToken(e).then((function(e){setTimeout((function(){a.default.info("client renew token success"),t&&t(),i(),r.argusReport.reportRenewToken(r.channel,r.uid,!0,s.elapse(),null),r.grafanaReport.report("renew_token",y)}),1)})).catch((function(e){a.default.error("client renew token failed: ".concat((0,m.stringifyErr)(e))),n&&n(e),o(e),r.argusReport.reportRenewToken(r.channel,r.uid,!1,s.elapse(),JSON.stringify(e)),r.grafanaReport.report("renew_token",_,e.code,null==e?void 0:e.reason)}))}))}},{key:"muteLocal",value:function(e,t,n){var r=this;return new Promise((function(i,o){if(r._checkWorker(),"video"!==e&&"audio"!==e&&"all"!==e){var s=new Error('target should be "video", "audio" or "all"');return a.default.error("client muteLocal failed: ".concat(s.message)),n&&n(s),void o(s)}var c=v.create().start();r.worker.muteLocal(e).then((function(n){setTimeout((function(){a.default.info("client muteLocal ".concat(e," success")),t&&t(),i(),r.argusReport.reportMuteLocal(r.channel,r.uid,!0,c.elapse(),null,r.targetMap[e],1),r.grafanaReport.report("mute_local",y)}),1)})).catch((function(t){a.default.error("client muteLocal ".concat(e," failed: ").concat((0,m.stringifyErr)(t))),n&&n(t),o(t),r.argusReport.reportMuteLocal(r.channel,r.uid,!1,c.elapse(),JSON.stringify(t),r.targetMap[e],1),r.grafanaReport.report("mute_local",_,t.code,null==t?void 0:t.reason)}))}))}},{key:"unmuteLocal",value:function(e,t,n){var r=this;return new Promise((function(i,o){if(r._checkWorker(),"video"!==e&&"audio"!==e&&"all"!==e){var s=new Error('target should be "video", "audio" or "all"');return a.default.error("client unmuteLocal failed: ".concat(s.message)),n&&n(s),void o(s)}var c=v.create().start();r.worker.unmuteLocal(e).then((function(n){setTimeout((function(){a.default.info("client unmuteLocal ".concat(e," success")),t&&t(),i(),r.argusReport.reportMuteLocal(r.channel,r.uid,!0,c.elapse(),null,r.targetMap[e],-1),r.grafanaReport.report("unmute_local",y)}),1)})).catch((function(t){a.default.error("client unmuteLocal ".concat(e," failed: ").concat((0,m.stringifyErr)(t))),n&&n(t),o(t),r.argusReport.reportMuteLocal(r.channel,r.uid,!1,c.elapse(),JSON.stringify(t),r.targetMap[e],-1),r.grafanaReport.report("unmute_local",_,t.code,null==t?void 0:t.reason)}))}))}},{key:"leave",value:function(t,n){var r=this;return new Promise((function(o,s){if(r.worker&&r.worker.isWSConnected()){var c=v.create().start();r.worker.leave().then(function(){var n=(0,e.Z)(i().mark((function e(n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.argusReport.reportLeave(r.channel,r.uid,!0,c.elapse()),r.grafanaReport.report("leave",y),e.next=4,r.destroy();case 4:setTimeout((function(){a.default.info("client leave success"),t&&t(),o()}),1);case 5:case"end":return e.stop()}}),e)})));return function(e){return n.apply(this,arguments)}}()).catch((function(e){a.default.error("client leave failed: ".concat((0,m.stringifyErr)(e))),n&&n(e),s(e),r.argusReport.reportLeave(r.channel,r.uid,!1,c.elapse(),JSON.stringify(e)),r.grafanaReport.report("leave",_,e.code,null==e?void 0:e.reason)}))}else a.default.info("client leave success without worker"),t&&t(),o(),r._stopNetworkJudge(),r._resetData()}))}},{key:"isConnected",value:function(){return!(!this.worker||!this.worker.isWSConnected())}},{key:"updatePusherStateChange",value:function(e){if(this.pushUrl){var t=e.detail.code,n=e.detail.message;a.default.info("client update pusher state, code:".concat(t," message:").concat(n)),this.argusReport.reportPusherStateChange(this.channel,this.uid,t>=1002,0,this.pushUrl,t,{message:n}),1002===t?this.grafanaReport.report("pusher_state_change",y,t,n):-1307===t&&this.grafanaReport.report("pusher_state_change",_,t,n)}}},{key:"updatePlayerStateChange",value:function(e,t){var n=this.playUrls.get(Number(e));if(n){var r=t.detail.code,i=t.detail.message;if(a.default.info("client update player state, uid:".concat(e," code:").concat(r," message:").concat(i)),this.argusReport.reportPlayerStateChange(e,this.channel,this.uid,r>=2002,0,n,r,{message:i}),2003===r||-2301===r){var o=2003===r?y:_;this.grafanaReport.report("player_state_change",o,r,i)}}}},{key:"updatePusherNetStatus",value:function(e){if(this.pushUrl){var t=e.detail.info;this.argusReport.setPusherNetData(t),oe(this.grafanaReport,0,t)}}},{key:"updatePlayerNetStatus",value:function(e,t){if(this.playUrls.get(Number(e))){var n=t.detail.info;this.argusReport.setPlayerNetData(e,n),se(this.grafanaReport,1,n,e)}}},{key:"send",value:function(e,t,n){var r=this;return new Promise((function(i,o){r._checkWorker(),r.worker.send(e).then((function(e){t&&t(e),i(e)})).catch((function(e){n&&n(e),o(e)}))}))}},{key:"updatePushUrl",value:function(e,t){var n=this;return new Promise((function(r,i){n._checkWorker(),n.worker.updatePushUrl().then((function(t){setTimeout((function(){a.default.info("client updatePushUrl success"),e&&e(t),r(t),n.grafanaReport.report("update_url",y)}),1)})).catch((function(e){a.default.error("client updatePushUrl failed: ".concat((0,m.stringifyErr)(e))),t&&t(e),i(e),n.grafanaReport.report("update_url",_,e.code,null==e?void 0:e.reason)}))}))}},{key:"destroy",value:function(e,t){var n=this;return new Promise((function(r,i){n.worker?n.worker.destroy().then((function(){n.pushUrl=null,n.playUrls.clear(),a.default.info("client destroy success"),e&&e(),r()})).catch((function(e){a.default.error("client destroy failed: ".concat((0,m.stringifyErr)(e))),t&&t(e),i(e)})).finally((function(){n.worker=null,n._stopNetworkJudge(),n._resetData()})):(n.pushUrl=null,n.playUrls.clear(),a.default.info("client destroy success without worker"),e&&e(),r(),n._stopNetworkJudge(),n._resetData()),n.grafanaReport.destroy(),n.argusReport.destroy()}))}},{key:"startChannelMediaRelay",value:function(e,t){if(!(e instanceof I.ChannelMediaRelayConfiguration))throw"Configration should be instance of [ChannelMediaRelayConfiguration]";var n=e.getSrcChannelMediaInfo(),r=e.getDestChannelMediaInfos();if((0,m.isEmpty)(n))throw"srcChannelMediaInfo should not be empty";if((0,m.isEmpty)(r)||0===r.length)throw"destChannelMediaInfos should not be empty";if(a.default.info("[startChannelMediaRelay]: srcInfo: ",n," destInfo: ",r),!(0,o.is32Uint)(n.uid))throw"Invalid uid in srcChannelMediaInfo";if(!(0,m.isValidChannelName)(n.channelName))throw"Invalid channelName in srcChannelMediaInfo";if(n.token&&!(0,m.isValidToken)(n.token))throw"Invalid token in srcChannelMediaInfo";if(r.forEach((function(e){if(!(0,o.is32Uint)(e.uid))throw"Invalid uid in destChannelMediaInfo";if(!(0,m.isValidChannelName)(e.channelName))throw"Invalid channelName in destChannelMediaInfo";if(e.token&&!(0,m.isValidToken)(e.token))throw"Invalid token in destChannelMediaInfo"})),!this.worker)throw"startChannelMediaRelay should be used after join";this.worker.startChannelMediaRelay(e).then((function(){a.default.info("client startChannelMediaRelay success"),t&&t()})).catch((function(e){a.default.error("client startChannelMediaRelay failed: ".concat((0,m.stringifyErr)(e))),t&&t(e)}))}},{key:"updateChannelMediaRelay",value:function(e,t){if(!(e instanceof I.ChannelMediaRelayConfiguration))throw"Configration should be instance of [ChannelMediaRelayConfiguration]";var n=e.getSrcChannelMediaInfo(),r=e.getDestChannelMediaInfos();if((0,m.isEmpty)(n))throw"srcChannelMediaInfo should not be empty";if((0,m.isEmpty)(r)||0===r.length)throw"destChannelMediaInfos should not be empty";if(a.default.info("[updateChannelMediaRelay]: srcInfo: ",n," destInfo: ",r),!(0,o.is32Uint)(n.uid))throw"Invalid uid in srcChannelMediaInfo";if(!(0,m.isValidChannelName)(n.channelName))throw"Invalid channelName in srcChannelMediaInfo";if(n.token&&!(0,m.isValidToken)(n.token))throw"Invalid token in srcChannelMediaInfo";if(r.forEach((function(e){if(!(0,o.is32Uint)(e.uid))throw"Invalid uid in destChannelMediaInfo";if(!(0,m.isValidChannelName)(e.channelName))throw"Invalid channelName in destChannelMediaInfo";if(e.token&&!(0,m.isValidToken)(e.token))throw"Invalid token in destChannelMediaInfo"})),!this.worker)throw"updateChannelMediaRelay should be used after join";this.worker.updateChannelMediaRelay(e).then((function(){a.default.info("client updateChannelMediaRelay success"),t&&t()})).catch((function(e){a.default.error("client updateChannelMediaRelay failed: ".concat((0,m.stringifyErr)(e))),t&&t(e)}))}},{key:"stopChannelMediaRelay",value:function(e){a.default.info("[stopChannelMediaRelay]"),this.worker.stopChannelMediaRelay().then((function(){a.default.info("client stopChannelMediaRelay success"),e&&e()})).catch((function(t){a.default.error("client stopChannelMediaRelay failed: ".concat((0,m.stringifyErr)(t))),e&&e(t)}))}},{key:"_checkUid",value:function(e){if(!e||"number"!=typeof e||!(0,o.is32Uint)(e)){var t=new Error("Invalid uid type");throw a.default.error("client ".concat(t.message)),t}}},{key:"_checkWorker",value:function(){if(!this.worker||!this.worker.isWSConnected()){var e=new Error("Disconnected from server");throw a.default.error("client ".concat(e.message)),e}}},{key:"_dealSid",value:function(){this.sid||(this.sid=(0,o.generateSessionId)(),this.argusReport.sid=this.sid,a.default.setOptions({appId:this.appId,sid:this.sid}),a.default.info("client sid: ".concat(this.sid)))}},{key:"_startNetworkJudge",value:function(){this.networkJudge||(this.networkJudge=!0,a.default.info("client start network judge"),wx.onNetworkStatusChange(ae),wx.onNetworkWeakChange(ce))}},{key:"_stopNetworkJudge",value:function(){this.networkJudge&&(this.networkJudge=!1,a.default.info("client stop network judge"),wx.offNetworkStatusChange(ae),wx.offNetworkWeakChange(ce))}},{key:"_resetData",value:function(){this.sid=""}}]),r}()})(),__webpack_exports__})()));
diff --git a/miniprogram_npm/dayjs/index.js b/miniprogram_npm/dayjs/index.js
new file mode 100644
index 0000000..3fa8603
--- /dev/null
+++ b/miniprogram_npm/dayjs/index.js
@@ -0,0 +1,13 @@
+module.exports = (function() {
+var __MODS__ = {};
+var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
+var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
+var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
+var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
+__DEFINE__(1731653753936, function(require, module, exports) {
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)=e?t:\"\"+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?\"+\":\"-\")+m(r,2,\"0\")+\":\"+m(i,2,\"0\")},m:function t(e,n){if(e.date()1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n=\"object\"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if(\"string\"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||\"0\").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)()=>(t||e((t={exports:{}}).exports,t),t.exports);var U=W(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(L,{getDataOnPath:function(){return se},parseMultiDataPaths:function(){return ce}});var N=/^\s/,k=function(e,t){throw Error('Parsing data path "'+e+'" failed at char "'+e[t]+'" (index '+t+")")},ae=function(e,t){for(var r=t.index;t.index{z.exports=function(){let t=null,r;function n(i){return i?typeof i=="object"||typeof i=="function":!1}function a(i){if(i!==null&&!n(i))throw new TypeError("Object prototype may only be an Object or null: "+i)}let o=Object,u=!!o.create||!({__proto__:null}instanceof o),c=o.create||(u?function(s){return a(s),{__proto__:s}}:function(s){if(a(s),s===null)throw new SyntaxError("Native Object.create is required to create objects with null prototype");var l=function(){};return l.prototype=s,new l}),d=function(){return null},g=o.getPrototypeOf||([].__proto__===Array.prototype?function(s){let l=s.__proto__;return n(l)?l:null}:d);return r=function(i,s){if((this&&this instanceof r?this.constructor:void 0)===void 0)throw new TypeError("Constructor Proxy requires 'new'");if(!n(i)||!n(s))throw new TypeError("Cannot create proxy with a non-object as target or handler");let h=function(){};t=function(){i=null,h=function(f){throw new TypeError(`Cannot perform '${f}' on a proxy that has been revoked`)}},setTimeout(function(){t=null},0);let b=s;s={get:null,set:null,apply:null,construct:null};for(let f in b){if(!(f in s))throw new TypeError(`Proxy polyfill does not support trap '${f}'`);s[f]=b[f]}typeof b=="function"&&(s.apply=b.apply.bind(b));let v=g(i),p,_=!1,w=!1;typeof i=="function"?(p=function(){let m=this&&this.constructor===p,y=Array.prototype.slice.call(arguments);if(h(m?"construct":"apply"),m&&s.construct)return s.construct.call(this,i,y);if(!m&&s.apply)return s.apply(i,this,y);if(m){y.unshift(i);let j=i.bind.apply(i,y);return new j}return i.apply(this,y)},_=!0):i instanceof Array?(p=[],w=!0):p=u||v!==null?c(v):{};let O=s.get?function(f){return h("get"),s.get(this,f,p)}:function(f){return h("get"),this[f]},x=s.set?function(f,m){h("set");let y=s.set(this,f,m,p)}:function(f,m){h("set"),this[f]=m},q=o.getOwnPropertyNames(i),A={};q.forEach(function(f){if((_||w)&&f in p)return;let y={enumerable:!!o.getOwnPropertyDescriptor(i,f).enumerable,get:O.bind(i,f),set:x.bind(i,f)};o.defineProperty(p,f,y),A[f]=!0});let P=!0;if(_||w){let f=o.setPrototypeOf||([].__proto__===Array.prototype?function(y,j){return a(j),y.__proto__=j,y}:d);v&&f(p,v)||(P=!1)}if(s.get||!P)for(let f in i)A[f]||o.defineProperty(p,f,{get:O.bind(i,f)});return o.seal(i),o.seal(p),p},r.revocable=function(i,s){return{proxy:new r(i,s),revoke:t}},r}});var G=W(R=>{"use strict";function D(e){return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}Object.defineProperty(R,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(R,{create:function(){return de},unwrap:function(){return function e(t){if(t!==null&&(t===void 0?"undefined":D(t))==="object"&&D(t.__rawObject__)!=="object"){if(Array.isArray(t))return t.map(function(n){return e(n)});var r={};return Object.keys(t).forEach(function(n){r[n]=e(t[n])}),r}return(t===void 0?"undefined":D(t))!=="object"||t===null||D(t.__rawObject__)!=="object"?t:t.__rawObject__}}});var T,fe=(0,((T=Z())&&T.__esModule?T:{default:T}).default)(),K=function(e,t,r){if((e===void 0?"undefined":D(e))!=="object"||e===null)return e;var n={get:function(a,o){if(o==="__rawObject__")return a;var u=r.concat(o),c=a[o];return t.push({kind:"value",path:u,value:c}),K(c,t,u)},ownKeys:function(a){var o=r.slice(),u=Object.keys(a).sort();return t.push({kind:"keys",path:o,keys:u}),u}};try{return new Proxy(e,n)}catch{return new fe(e,n)}};function de(e,t){return K(e,t,[])}});var ne=W(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(V,{behavior:function(){return ve},computed:function(){return ye},watch:function(){return be}});var M,J,pe=Y(require("rfdc")),le=Y(require("fast-deep-equal")),E=te(U()),F=te(G());function Y(e){return e&&e.__esModule?e:{default:e}}function ee(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(ee=function(n){return n?r:t})(e)}function te(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=ee(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var u=a?Object.getOwnPropertyDescriptor(e,o):null;u&&(u.get||u.set)?Object.defineProperty(n,o,u):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}var Q=(0,pe.default)({proto:!0});(M=J||(J={}))[M.CREATED=0]="CREATED",M[M.ATTACHED=1]="ATTACHED";var he=0;function X(e,t){return e===t||e!=e&&t!=t}var S=function(){"use strict";function e(){this.observersItems=[],this.computedWatchDefId=he++,this.computedList=[],this.watchList=[];var r=this.computedWatchDefId,n=this.computedList,a=this.watchList;this.observersItems.push({fields:"_computedWatchInit",observer:function(){var o=this,u=this.data._computedWatchInit;if(u===0){var c={computedUpdaters:[],computedRelatedPathValues:Array(n.length),watchCurVal:Array(a.length),_triggerFromComputedAttached:Object.create(null)};this._computedWatchInfo||(this._computedWatchInfo={}),this._computedWatchInfo[r]=c,a.forEach(function(g,i){var s=g.map(function(l){var h=l.path,b=l.options,v=E.getDataOnPath(o.data,h);return b.deepCmp?Q(v):v});c.watchCurVal[i]=s})}else if(u===1){var d=this._computedWatchInfo[r];n.forEach(function(g,i){var s,l=g[0],h=g[1],b=[],v=h(F.create(o.data,b));o.setData(((s={})[l]=F.unwrap(v),s)),d._triggerFromComputedAttached[l]=!0,d.computedRelatedPathValues[i]=b,d.computedUpdaters.push(function(){for(var p,_=d.computedRelatedPathValues[i],w=!1,O=0;O<_.length;O++){var x=_[O];if(x.kind==="keys"){var q=x.path,A=x.keys,P=Object.keys(E.getDataOnPath(o.data,q)).sort();if(P.length!==A.length){w=!0;break}for(var f=0;f new Date(o))
+ constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)))
+ constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)))
+ if (opts.constructorHandlers) {
+ for (const handler of opts.constructorHandlers) {
+ constructorHandlers.set(handler[0], handler[1])
+ }
+ }
+
+ let handler = null
+
+ return opts.proto ? cloneProto : clone
+
+ function cloneArray (a, fn) {
+ const keys = Object.keys(a)
+ const a2 = new Array(keys.length)
+ for (let i = 0; i < keys.length; i++) {
+ const k = keys[i]
+ const cur = a[k]
+ if (typeof cur !== 'object' || cur === null) {
+ a2[k] = cur
+ } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
+ a2[k] = handler(cur, fn)
+ } else if (ArrayBuffer.isView(cur)) {
+ a2[k] = copyBuffer(cur)
+ } else {
+ a2[k] = fn(cur)
+ }
+ }
+ return a2
+ }
+
+ function clone (o) {
+ if (typeof o !== 'object' || o === null) return o
+ if (Array.isArray(o)) return cloneArray(o, clone)
+ if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
+ return handler(o, clone)
+ }
+ const o2 = {}
+ for (const k in o) {
+ if (Object.hasOwnProperty.call(o, k) === false) continue
+ const cur = o[k]
+ if (typeof cur !== 'object' || cur === null) {
+ o2[k] = cur
+ } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
+ o2[k] = handler(cur, clone)
+ } else if (ArrayBuffer.isView(cur)) {
+ o2[k] = copyBuffer(cur)
+ } else {
+ o2[k] = clone(cur)
+ }
+ }
+ return o2
+ }
+
+ function cloneProto (o) {
+ if (typeof o !== 'object' || o === null) return o
+ if (Array.isArray(o)) return cloneArray(o, cloneProto)
+ if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
+ return handler(o, cloneProto)
+ }
+ const o2 = {}
+ for (const k in o) {
+ const cur = o[k]
+ if (typeof cur !== 'object' || cur === null) {
+ o2[k] = cur
+ } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
+ o2[k] = handler(cur, cloneProto)
+ } else if (ArrayBuffer.isView(cur)) {
+ o2[k] = copyBuffer(cur)
+ } else {
+ o2[k] = cloneProto(cur)
+ }
+ }
+ return o2
+ }
+}
+
+function rfdcCircles (opts) {
+ const refs = []
+ const refsNew = []
+
+ const constructorHandlers = new Map()
+ constructorHandlers.set(Date, (o) => new Date(o))
+ constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)))
+ constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)))
+ if (opts.constructorHandlers) {
+ for (const handler of opts.constructorHandlers) {
+ constructorHandlers.set(handler[0], handler[1])
+ }
+ }
+
+ let handler = null
+ return opts.proto ? cloneProto : clone
+
+ function cloneArray (a, fn) {
+ const keys = Object.keys(a)
+ const a2 = new Array(keys.length)
+ for (let i = 0; i < keys.length; i++) {
+ const k = keys[i]
+ const cur = a[k]
+ if (typeof cur !== 'object' || cur === null) {
+ a2[k] = cur
+ } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
+ a2[k] = handler(cur, fn)
+ } else if (ArrayBuffer.isView(cur)) {
+ a2[k] = copyBuffer(cur)
+ } else {
+ const index = refs.indexOf(cur)
+ if (index !== -1) {
+ a2[k] = refsNew[index]
+ } else {
+ a2[k] = fn(cur)
+ }
+ }
+ }
+ return a2
+ }
+
+ function clone (o) {
+ if (typeof o !== 'object' || o === null) return o
+ if (Array.isArray(o)) return cloneArray(o, clone)
+ if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
+ return handler(o, clone)
+ }
+ const o2 = {}
+ refs.push(o)
+ refsNew.push(o2)
+ for (const k in o) {
+ if (Object.hasOwnProperty.call(o, k) === false) continue
+ const cur = o[k]
+ if (typeof cur !== 'object' || cur === null) {
+ o2[k] = cur
+ } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
+ o2[k] = handler(cur, clone)
+ } else if (ArrayBuffer.isView(cur)) {
+ o2[k] = copyBuffer(cur)
+ } else {
+ const i = refs.indexOf(cur)
+ if (i !== -1) {
+ o2[k] = refsNew[i]
+ } else {
+ o2[k] = clone(cur)
+ }
+ }
+ }
+ refs.pop()
+ refsNew.pop()
+ return o2
+ }
+
+ function cloneProto (o) {
+ if (typeof o !== 'object' || o === null) return o
+ if (Array.isArray(o)) return cloneArray(o, cloneProto)
+ if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
+ return handler(o, cloneProto)
+ }
+ const o2 = {}
+ refs.push(o)
+ refsNew.push(o2)
+ for (const k in o) {
+ const cur = o[k]
+ if (typeof cur !== 'object' || cur === null) {
+ o2[k] = cur
+ } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
+ o2[k] = handler(cur, cloneProto)
+ } else if (ArrayBuffer.isView(cur)) {
+ o2[k] = copyBuffer(cur)
+ } else {
+ const i = refs.indexOf(cur)
+ if (i !== -1) {
+ o2[k] = refsNew[i]
+ } else {
+ o2[k] = cloneProto(cur)
+ }
+ }
+ }
+ refs.pop()
+ refsNew.pop()
+ return o2
+ }
+}
+
+}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
+return __REQUIRE__(1731653753938);
+})()
+//miniprogram-npm-outsideDeps=[]
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/miniprogram_npm/rfdc/index.js.map b/miniprogram_npm/rfdc/index.js.map
new file mode 100644
index 0000000..a6fba6a
--- /dev/null
+++ b/miniprogram_npm/rfdc/index.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\nmodule.exports = rfdc\n\nfunction copyBuffer (cur) {\n if (cur instanceof Buffer) {\n return Buffer.from(cur)\n }\n\n return new cur.constructor(cur.buffer.slice(), cur.byteOffset, cur.length)\n}\n\nfunction rfdc (opts) {\n opts = opts || {}\n if (opts.circles) return rfdcCircles(opts)\n\n const constructorHandlers = new Map()\n constructorHandlers.set(Date, (o) => new Date(o))\n constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)))\n constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)))\n if (opts.constructorHandlers) {\n for (const handler of opts.constructorHandlers) {\n constructorHandlers.set(handler[0], handler[1])\n }\n }\n\n let handler = null\n\n return opts.proto ? cloneProto : clone\n\n function cloneArray (a, fn) {\n const keys = Object.keys(a)\n const a2 = new Array(keys.length)\n for (let i = 0; i < keys.length; i++) {\n const k = keys[i]\n const cur = a[k]\n if (typeof cur !== 'object' || cur === null) {\n a2[k] = cur\n } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {\n a2[k] = handler(cur, fn)\n } else if (ArrayBuffer.isView(cur)) {\n a2[k] = copyBuffer(cur)\n } else {\n a2[k] = fn(cur)\n }\n }\n return a2\n }\n\n function clone (o) {\n if (typeof o !== 'object' || o === null) return o\n if (Array.isArray(o)) return cloneArray(o, clone)\n if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {\n return handler(o, clone)\n }\n const o2 = {}\n for (const k in o) {\n if (Object.hasOwnProperty.call(o, k) === false) continue\n const cur = o[k]\n if (typeof cur !== 'object' || cur === null) {\n o2[k] = cur\n } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {\n o2[k] = handler(cur, clone)\n } else if (ArrayBuffer.isView(cur)) {\n o2[k] = copyBuffer(cur)\n } else {\n o2[k] = clone(cur)\n }\n }\n return o2\n }\n\n function cloneProto (o) {\n if (typeof o !== 'object' || o === null) return o\n if (Array.isArray(o)) return cloneArray(o, cloneProto)\n if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {\n return handler(o, cloneProto)\n }\n const o2 = {}\n for (const k in o) {\n const cur = o[k]\n if (typeof cur !== 'object' || cur === null) {\n o2[k] = cur\n } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {\n o2[k] = handler(cur, cloneProto)\n } else if (ArrayBuffer.isView(cur)) {\n o2[k] = copyBuffer(cur)\n } else {\n o2[k] = cloneProto(cur)\n }\n }\n return o2\n }\n}\n\nfunction rfdcCircles (opts) {\n const refs = []\n const refsNew = []\n\n const constructorHandlers = new Map()\n constructorHandlers.set(Date, (o) => new Date(o))\n constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)))\n constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)))\n if (opts.constructorHandlers) {\n for (const handler of opts.constructorHandlers) {\n constructorHandlers.set(handler[0], handler[1])\n }\n }\n\n let handler = null\n return opts.proto ? cloneProto : clone\n\n function cloneArray (a, fn) {\n const keys = Object.keys(a)\n const a2 = new Array(keys.length)\n for (let i = 0; i < keys.length; i++) {\n const k = keys[i]\n const cur = a[k]\n if (typeof cur !== 'object' || cur === null) {\n a2[k] = cur\n } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {\n a2[k] = handler(cur, fn)\n } else if (ArrayBuffer.isView(cur)) {\n a2[k] = copyBuffer(cur)\n } else {\n const index = refs.indexOf(cur)\n if (index !== -1) {\n a2[k] = refsNew[index]\n } else {\n a2[k] = fn(cur)\n }\n }\n }\n return a2\n }\n\n function clone (o) {\n if (typeof o !== 'object' || o === null) return o\n if (Array.isArray(o)) return cloneArray(o, clone)\n if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {\n return handler(o, clone)\n }\n const o2 = {}\n refs.push(o)\n refsNew.push(o2)\n for (const k in o) {\n if (Object.hasOwnProperty.call(o, k) === false) continue\n const cur = o[k]\n if (typeof cur !== 'object' || cur === null) {\n o2[k] = cur\n } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {\n o2[k] = handler(cur, clone)\n } else if (ArrayBuffer.isView(cur)) {\n o2[k] = copyBuffer(cur)\n } else {\n const i = refs.indexOf(cur)\n if (i !== -1) {\n o2[k] = refsNew[i]\n } else {\n o2[k] = clone(cur)\n }\n }\n }\n refs.pop()\n refsNew.pop()\n return o2\n }\n\n function cloneProto (o) {\n if (typeof o !== 'object' || o === null) return o\n if (Array.isArray(o)) return cloneArray(o, cloneProto)\n if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {\n return handler(o, cloneProto)\n }\n const o2 = {}\n refs.push(o)\n refsNew.push(o2)\n for (const k in o) {\n const cur = o[k]\n if (typeof cur !== 'object' || cur === null) {\n o2[k] = cur\n } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {\n o2[k] = handler(cur, cloneProto)\n } else if (ArrayBuffer.isView(cur)) {\n o2[k] = copyBuffer(cur)\n } else {\n const i = refs.indexOf(cur)\n if (i !== -1) {\n o2[k] = refsNew[i]\n } else {\n o2[k] = cloneProto(cur)\n }\n }\n }\n refs.pop()\n refsNew.pop()\n return o2\n }\n}\n"]}
\ No newline at end of file
diff --git a/miniprogram_npm/signalr-for-wx/AbortController.js b/miniprogram_npm/signalr-for-wx/AbortController.js
new file mode 100644
index 0000000..7944488
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/AbortController.js
@@ -0,0 +1,39 @@
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
+//粗略填写 https://developer.mozilla.org/en-US/docs/Web/API/AbortController
+//实际上,我们从来没有使用被polyfill填充的API,我们总是使用polyfill,因为
+//它现在还是一个非常新的API。
+/**
+ *
+ * @private
+ */
+var AbortController = /** @class */ (function () {
+ function AbortController() {
+ this.isAborted = false;
+ this.onabort = null;
+ }
+ AbortController.prototype.abort = function () {
+ if (!this.isAborted) {
+ this.isAborted = true;
+ if (this.onabort) {
+ this.onabort();
+ }
+ }
+ };
+ Object.defineProperty(AbortController.prototype, "signal", {
+ get: function () {
+ return this;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(AbortController.prototype, "aborted", {
+ get: function () {
+ return this.isAborted;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return AbortController;
+}());
+export { AbortController };
diff --git a/miniprogram_npm/signalr-for-wx/DefualtRequest.js b/miniprogram_npm/signalr-for-wx/DefualtRequest.js
new file mode 100644
index 0000000..48571b7
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/DefualtRequest.js
@@ -0,0 +1,50 @@
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+var __assign = (this && this.__assign) || function () {
+ __assign = Object.assign || function(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
+ t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+};
+import { Request } from "./wx-request/index";
+import { RequestMethod, ResponseType } from "./wx-request/model";
+/**
+ * 生成默认请求库
+ *
+ * @export
+ * @class DefaultRequest
+ */
+var DefaultRequest = /** @class */ (function (_super) {
+ __extends(DefaultRequest, _super);
+ function DefaultRequest(config, logger) {
+ var _this = _super.call(this) || this;
+ _this.logger = logger
+ ? logger
+ : {
+ log: function (logLevel, message) {
+ /* 屏蔽打印 */
+ }
+ };
+ // default config
+ _this.setConfig(__assign({ about: false, forceEnableHttps: false, headers: {}, method: RequestMethod.GET, responseEncoding: ResponseType.JSON, timeout: 2 * 60 * 1000, transformRequest: [], transformResponse: [] }, config));
+ return _this;
+ }
+ return DefaultRequest;
+}(Request));
+export default DefaultRequest;
diff --git a/miniprogram_npm/signalr-for-wx/Errors.js b/miniprogram_npm/signalr-for-wx/Errors.js
new file mode 100644
index 0000000..d9a5f9b
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/Errors.js
@@ -0,0 +1,114 @@
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
+/**
+ * Error thrown when an HTTP request fails.
+ * HTTP请求失败时引发错误。
+ */
+var HttpError = /** @class */ (function (_super) {
+ __extends(HttpError, _super);
+ /** Constructs a new instance of {@link @aspnet/signalr.HttpError}.
+ *
+ * @param {string} errorMessage A descriptive error message.
+ * @param {number} statusCode The HTTP status code represented by this error.
+ */
+ function HttpError(errorMessage, statusCode) {
+ var _newTarget = this.constructor;
+ var _this = this;
+ var trueProto = _newTarget.prototype;
+ _this = _super.call(this, errorMessage) || this;
+ _this.statusCode = statusCode;
+ // Workaround issue in Typescript compiler
+ // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
+ _this.__proto__ = trueProto;
+ return _this;
+ }
+ return HttpError;
+}(Error));
+export { HttpError };
+/**
+ * Error thrown when a timeout elapses.
+ * 超时错误
+ */
+var TimeoutError = /** @class */ (function (_super) {
+ __extends(TimeoutError, _super);
+ /** Constructs a new instance of {@link @aspnet/signalr.TimeoutError}.
+ *
+ * @param {string} errorMessage A descriptive error message.
+ */
+ function TimeoutError(errorMessage) {
+ var _newTarget = this.constructor;
+ if (errorMessage === void 0) { errorMessage = "A timeout occurred."; }
+ var _this = this;
+ var trueProto = _newTarget.prototype;
+ _this = _super.call(this, errorMessage) || this;
+ // Workaround issue in Typescript compiler
+ // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
+ _this.__proto__ = trueProto;
+ return _this;
+ }
+ return TimeoutError;
+}(Error));
+export { TimeoutError };
+/**
+ * Error thrown when an action is aborted.
+ * 连接错误
+ */
+var AbortError = /** @class */ (function (_super) {
+ __extends(AbortError, _super);
+ /** Constructs a new instance of {@link AbortError}.
+ *
+ * @param {string} errorMessage A descriptive error message.
+ */
+ function AbortError(errorMessage) {
+ var _newTarget = this.constructor;
+ if (errorMessage === void 0) { errorMessage = "An abort occurred."; }
+ var _this = this;
+ var trueProto = _newTarget.prototype;
+ _this = _super.call(this, errorMessage) || this;
+ // Workaround issue in Typescript compiler
+ // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
+ _this.__proto__ = trueProto;
+ return _this;
+ }
+ return AbortError;
+}(Error));
+export { AbortError };
+/**
+ * Error thrown when message event is not found.
+ * 事件未定义
+ */
+var EventNotFoundError = /** @class */ (function (_super) {
+ __extends(EventNotFoundError, _super);
+ /** Constructs a new instance of {@link AbortError}.
+ *
+ * @param {string} errorMessage A descriptive error message.
+ */
+ function EventNotFoundError(invocationMessage, errorMessage) {
+ var _newTarget = this.constructor;
+ if (errorMessage === void 0) { errorMessage = "message event not found."; }
+ var _this = this;
+ var trueProto = _newTarget.prototype;
+ _this = _super.call(this, errorMessage) || this;
+ _this.methodName = invocationMessage.target;
+ _this.invocationMessage = invocationMessage;
+ // Workaround issue in Typescript compiler
+ // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
+ _this.__proto__ = trueProto;
+ return _this;
+ }
+ return EventNotFoundError;
+}(Error));
+export { EventNotFoundError };
diff --git a/miniprogram_npm/signalr-for-wx/HandshakeProtocol.js b/miniprogram_npm/signalr-for-wx/HandshakeProtocol.js
new file mode 100644
index 0000000..1ec667c
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/HandshakeProtocol.js
@@ -0,0 +1,67 @@
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
+import { TextMessageFormat } from "./TextMessageFormat";
+import { isArrayBuffer } from "./Utils";
+/**
+ * 握手协议
+ * @private
+ */
+var HandshakeProtocol = /** @class */ (function () {
+ function HandshakeProtocol() {
+ }
+ // Handshake request is always JSON - 握手请求总是JSON
+ HandshakeProtocol.prototype.writeHandshakeRequest = function (handshakeRequest) {
+ // commond
+ return TextMessageFormat.write(JSON.stringify(handshakeRequest));
+ };
+ /**
+ * 解析握手协议 response
+ *
+ * @param {*} data
+ * @returns {[any, HandshakeResponseMessage]}
+ * @memberof HandshakeProtocol
+ */
+ HandshakeProtocol.prototype.parseHandshakeResponse = function (data) {
+ var responseMessage;
+ var messageData;
+ var remainingData;
+ // ! 删除了 @aspnet/signlaR 原有的 Buffer(仅适用 nodejs)判断
+ if (isArrayBuffer(data)) {
+ // Format is binary but still need to read JSON text from handshake response - fy: 格式是二进制的,但仍然需要从握手响应中读取JSON文本
+ var binaryData = new Uint8Array(data);
+ var separatorIndex = binaryData.indexOf(TextMessageFormat.RecordSeparatorCode);
+ if (separatorIndex === -1) {
+ throw new Error("Message is incomplete.");
+ }
+ // content before separator is handshake response - fy:分隔符前的内容是握手响应
+ // optional content after is additional messages - fy:后面是附加消息的可选内容
+ var responseLength = separatorIndex + 1;
+ messageData = String.fromCharCode.apply(null, binaryData.slice(0, responseLength));
+ remainingData = (binaryData.byteLength > responseLength) ? binaryData.slice(responseLength).buffer : null;
+ }
+ else {
+ var textData = data;
+ var separatorIndex = textData.indexOf(TextMessageFormat.RecordSeparator);
+ if (separatorIndex === -1) {
+ throw new Error("Message is incomplete.");
+ }
+ // content before separator is handshake response - fy:分隔符前的内容是握手响应
+ // optional content after is additional messages - fy:后面是附加消息的可选内容
+ var responseLength = separatorIndex + 1;
+ messageData = textData.substring(0, responseLength);
+ remainingData = (textData.length > responseLength) ? textData.substring(responseLength) : null;
+ }
+ // At this point we should have just the single handshake message - fy: 在这一点上,我们应该只有一个握手信息
+ var messages = TextMessageFormat.parse(messageData);
+ var response = JSON.parse(messages[0]);
+ if (response.type) {
+ throw new Error("Expected a handshake response from the server. -(fy: 需要来自服务器的握手响应)");
+ }
+ responseMessage = response;
+ // multiple messages could have arrived with handshake - fy: 握手时可能会收到多条消息
+ // return additional data to be parsed as usual, or null if all parsed - fy: 返回要像往常一样分析的其他数据,如果所有数据都已分析,则返回null
+ return [remainingData, responseMessage];
+ };
+ return HandshakeProtocol;
+}());
+export { HandshakeProtocol };
diff --git a/miniprogram_npm/signalr-for-wx/HttpConnection.js b/miniprogram_npm/signalr-for-wx/HttpConnection.js
new file mode 100644
index 0000000..db4235a
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/HttpConnection.js
@@ -0,0 +1,479 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __generator = (this && this.__generator) || function (thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+};
+import { LogLevel } from "./ILogger";
+import { HttpTransportType, TransferFormat } from "./ITransport";
+import { LongPollingTransport } from "./LongPollingTransport";
+import { Arg, createLogger } from "./Utils";
+import DefaultRequest from "./DefualtRequest";
+import { ResponseType } from "./wx-request/model/ResponseType";
+import { WxSocketTransport } from "./WxSocketTransport";
+var MAX_REDIRECTS = 100;
+var WxSocketModule = WxSocketTransport;
+var LongPollingModule = LongPollingTransport;
+/** @private */
+var HttpConnection = /** @class */ (function () {
+ function HttpConnection(url, options) {
+ if (options === void 0) { options = {}; }
+ this.features = {};
+ Arg.isRequired(url, "url");
+ this.logger = createLogger(options.logger);
+ options = options || {};
+ // ! 这里修改为自定义解析 和 默认传入 全路径方式
+ this.baseUrl = options.resolveUrl ? options.resolveUrl(url) : this.resolveUrl(url);
+ options.logMessageContent = options.logMessageContent || false;
+ // ! 修改 options 参数赋值方式
+ if (!options.WxSocket && wx) {
+ options.WxSocket = WxSocketModule;
+ }
+ if (!options.LongPolling) {
+ options.LongPolling = LongPollingModule;
+ }
+ this.request = options.request || new DefaultRequest({}, this.logger);
+ this.connectionState = 2 /* Disconnected */;
+ this.options = options;
+ this.onreceive = null;
+ this.onclose = null;
+ }
+ HttpConnection.prototype.start = function (transferFormat) {
+ transferFormat = transferFormat || TransferFormat.Binary;
+ Arg.isIn(transferFormat, TransferFormat, "transferFormat");
+ this.logger.log(LogLevel.Debug, "Starting connection with transfer format '" + TransferFormat[transferFormat] + "'.", TransferFormat);
+ if (this.connectionState !== 2 /* Disconnected */) {
+ return Promise.reject(new Error("Cannot start a connection that is not in the 'Disconnected' state. state is " + this.connectionState));
+ }
+ this.connectionState = 0 /* Connecting */;
+ this.startPromise = this.startInternal(transferFormat);
+ return this.startPromise;
+ };
+ HttpConnection.prototype.send = function (data) {
+ if (this.connectionState !== 1 /* Connected */) {
+ throw new Error("Cannot send data if the connection is not in the 'Connected' State.");
+ }
+ // Transport will not be null if state is connected
+ return this.transport.send(data);
+ };
+ HttpConnection.prototype.stop = function (error) {
+ return __awaiter(this, void 0, void 0, function () {
+ var e_1;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ this.connectionState = 2 /* Disconnected */;
+ // Set error as soon as possible otherwise there is a race between
+ // the transport closing and providing an error and the error from a close message
+ // We would prefer the close message error.
+ this.stopError = error;
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, this.startPromise];
+ case 2:
+ _a.sent();
+ return [3 /*break*/, 4];
+ case 3:
+ e_1 = _a.sent();
+ return [3 /*break*/, 4];
+ case 4:
+ if (!this.transport) return [3 /*break*/, 6];
+ return [4 /*yield*/, this.transport.stop()];
+ case 5:
+ _a.sent();
+ this.transport = undefined;
+ _a.label = 6;
+ case 6: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ HttpConnection.prototype.startInternal = function (transferFormat) {
+ return __awaiter(this, void 0, void 0, function () {
+ var url, negotiateResponse, redirects, _loop_1, this_1, state_1, e_2;
+ var _this = this;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ url = this.baseUrl;
+ this.accessTokenFactory = this.options.accessTokenFactory;
+ this.socketUrlFactory = this.options.socketUrlFactory;
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 12, , 13]);
+ if (!this.options.skipNegotiation) return [3 /*break*/, 5];
+ if (!(this.options.transport === HttpTransportType.WebSockets)) return [3 /*break*/, 3];
+ // No need to add a connection ID in this case
+ this.transport = this.constructTransport(HttpTransportType.WebSockets);
+ // We should just call connect directly in this case.
+ // No fallback or negotiate in this case.
+ return [4 /*yield*/, this.transport.connect({
+ url: url,
+ header: {},
+ protocols: [],
+ tcpNoDelay: true,
+ transferFormat: transferFormat
+ })];
+ case 2:
+ // We should just call connect directly in this case.
+ // No fallback or negotiate in this case.
+ _a.sent();
+ return [3 /*break*/, 4];
+ case 3: throw Error("Negotiation can only be skipped when using the WxSocket transport directly.");
+ case 4: return [3 /*break*/, 11];
+ case 5:
+ negotiateResponse = null;
+ redirects = 0;
+ _loop_1 = function () {
+ var accessToken_1;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0: return [4 /*yield*/, this_1.getNegotiationResponse(url)];
+ case 1:
+ negotiateResponse = _a.sent();
+ // the user tries to stop the connection when it is being started
+ if (this_1.connectionState === 2 /* Disconnected */) {
+ return [2 /*return*/, { value: void 0 }];
+ }
+ if (negotiateResponse.error) {
+ throw Error(negotiateResponse.error);
+ }
+ if (negotiateResponse.ProtocolVersion) {
+ throw Error("检测到尝试连接到一个 非 ASP.NET Core 服务器。此客户端仅支持连接到ASP.NET Core 服务器。. See https://aka.ms/signalr-core-differences for details.");
+ }
+ if (negotiateResponse.url) {
+ url = negotiateResponse.url;
+ }
+ if (negotiateResponse.accessToken) {
+ accessToken_1 = negotiateResponse.accessToken;
+ // ! 通过 /negotiate 接口返回的assessToken 仅支持 accessTokenFactory(),如果实现了 socketUrlFactory(),会忽略掉这个token
+ this_1.accessTokenFactory = function () { return accessToken_1; };
+ }
+ redirects++;
+ return [2 /*return*/];
+ }
+ });
+ };
+ this_1 = this;
+ _a.label = 6;
+ case 6: return [5 /*yield**/, _loop_1()];
+ case 7:
+ state_1 = _a.sent();
+ if (typeof state_1 === "object")
+ return [2 /*return*/, state_1.value];
+ _a.label = 8;
+ case 8:
+ if (negotiateResponse.url && redirects < MAX_REDIRECTS) return [3 /*break*/, 6];
+ _a.label = 9;
+ case 9:
+ if (redirects === MAX_REDIRECTS && negotiateResponse.url) {
+ throw Error("Negotiate redirection limit exceeded. -fy : 超出协商重定向限制");
+ }
+ return [4 /*yield*/, this.createTransport(url, this.options.transport, negotiateResponse, transferFormat)];
+ case 10:
+ _a.sent();
+ _a.label = 11;
+ case 11:
+ if (this.transport instanceof LongPollingTransport) {
+ this.features.inherentKeepAlive = true;
+ }
+ this.transport.onreceive = this.onreceive;
+ this.transport.onclose = function (e) { return _this.stopConnection(e); };
+ // only change the state if we were connecting to not overwrite
+ // the state if the connection is already marked as Disconnected
+ this.changeState(0 /* Connecting */, 1 /* Connected */);
+ return [2 /*return*/];
+ case 12:
+ e_2 = _a.sent();
+ this.logger.log(LogLevel.Error, "Failed to start the connection: ", e_2);
+ this.connectionState = 2 /* Disconnected */;
+ this.transport = undefined;
+ throw e_2;
+ case 13: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ HttpConnection.prototype.getNegotiationResponse = function (url) {
+ return __awaiter(this, void 0, void 0, function () {
+ var headers, token, negotiateUrl, response, e_3;
+ var _a;
+ return __generator(this, function (_b) {
+ switch (_b.label) {
+ case 0:
+ if (!this.accessTokenFactory) return [3 /*break*/, 2];
+ return [4 /*yield*/, this.accessTokenFactory()];
+ case 1:
+ token = _b.sent();
+ if (token) {
+ headers = (_a = {},
+ _a["Authorization"] = "Bearer " + token,
+ _a);
+ }
+ _b.label = 2;
+ case 2:
+ negotiateUrl = this.resolveNegotiateUrl(url);
+ this.logger.log(LogLevel.Debug, "Sending negotiation request: " + negotiateUrl + ".");
+ _b.label = 3;
+ case 3:
+ _b.trys.push([3, 5, , 6]);
+ return [4 /*yield*/, this.request.post(negotiateUrl, {}, {
+ headers: headers,
+ responseType: ResponseType.TEXT
+ })];
+ case 4:
+ response = _b.sent();
+ if (response.statusCode !== 200) {
+ throw Error("Unexpected status code returned from negotiate " + response.statusCode);
+ }
+ return [2 /*return*/, JSON.parse(response.data)];
+ case 5:
+ e_3 = _b.sent();
+ this.logger.log(LogLevel.Error, "Failed to complete negotiation with the server: ", e_3);
+ throw e_3;
+ case 6: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ HttpConnection.prototype.createConnectUrl = function (url, connectionId) {
+ if (!connectionId) {
+ return url;
+ }
+ return url + (url.indexOf("?") === -1 ? "?" : "&") + ("id=" + connectionId);
+ };
+ HttpConnection.prototype.createTransport = function (url, requestedTransport, negotiateResponse, requestedTransferFormat) {
+ return __awaiter(this, void 0, void 0, function () {
+ var connectUrl, transports, _i, transports_1, endpoint, transport, ex_1;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ connectUrl = this.createConnectUrl(url, negotiateResponse.connectionId);
+ if (!this.isITransport(requestedTransport)) return [3 /*break*/, 2];
+ this.logger.log(LogLevel.Debug, "Connection was provided an instance of ITransport, using that directly.");
+ this.transport = requestedTransport;
+ return [4 /*yield*/, this.transport.connect({
+ url: connectUrl,
+ transferFormat: requestedTransferFormat
+ })];
+ case 1:
+ _a.sent();
+ // only change the state if we were connecting to not overwrite
+ // the state if the connection is already marked as Disconnected
+ this.changeState(0 /* Connecting */, 1 /* Connected */);
+ return [2 /*return*/];
+ case 2:
+ transports = negotiateResponse.availableTransports || [];
+ _i = 0, transports_1 = transports;
+ _a.label = 3;
+ case 3:
+ if (!(_i < transports_1.length)) return [3 /*break*/, 9];
+ endpoint = transports_1[_i];
+ this.connectionState = 0 /* Connecting */;
+ transport = this.resolveTransport(endpoint, requestedTransport, requestedTransferFormat);
+ if (!(typeof transport === "number")) return [3 /*break*/, 8];
+ this.transport = this.constructTransport(transport);
+ if (!!negotiateResponse.connectionId) return [3 /*break*/, 5];
+ return [4 /*yield*/, this.getNegotiationResponse(url)];
+ case 4:
+ negotiateResponse = _a.sent();
+ connectUrl = this.createConnectUrl(url, negotiateResponse.connectionId);
+ _a.label = 5;
+ case 5:
+ _a.trys.push([5, 7, , 8]);
+ return [4 /*yield*/, this.transport.connect({
+ url: connectUrl,
+ transferFormat: requestedTransferFormat
+ })];
+ case 6:
+ _a.sent();
+ this.changeState(0 /* Connecting */, 1 /* Connected */);
+ return [2 /*return*/];
+ case 7:
+ ex_1 = _a.sent();
+ this.logger.log(LogLevel.Error, "Failed to start the transport '" + HttpTransportType[transport] + "':", ex_1);
+ this.connectionState = 2 /* Disconnected */;
+ negotiateResponse.connectionId = undefined;
+ return [3 /*break*/, 8];
+ case 8:
+ _i++;
+ return [3 /*break*/, 3];
+ case 9: throw new Error("Unable to initialize any of the available transports.");
+ }
+ });
+ });
+ };
+ /**
+ *
+ * @description 这里对原来的实例化方式进行了改写,如果传入的是实例化完成的 Transport ,将直接返回
+ * 如果是传入继承 Transport的 class,将执行 new Transport(options)
+ * - 这里对原生的多项入参合并成了options(这点差异需要注意)
+ * @private
+ * @param {HttpTransportType} transport
+ * @returns
+ * @memberof HttpConnection
+ */
+ HttpConnection.prototype.constructTransport = function (transport) {
+ var _a = this.options, WxSocket = _a.WxSocket, LongPolling = _a.LongPolling, wxSocketTransportOptions = _a.wxSocketTransportOptions, longPollingTransportOptions = _a.longPollingTransportOptions;
+ switch (transport) {
+ case HttpTransportType.WebSockets: // wx socket 方式
+ if (WxSocket instanceof WxSocketTransport) {
+ return WxSocket;
+ }
+ else {
+ return new WxSocket(wxSocketTransportOptions
+ ? wxSocketTransportOptions
+ : {
+ // token 工厂
+ accessTokenFactory: this.accessTokenFactory,
+ // socket 单独实现一个socket url factory(用于后端改了 accecc_token 参数名的场景)
+ socketUrlFactory: this.socketUrlFactory,
+ // logger
+ logger: this.logger,
+ logMessageContent: this.options.logMessageContent || false,
+ /** 是否允许替换socket连接
+ *
+ * 小程序 版本 < 1.7.0 时, 最多允许存在一个socket连接, 此参数用于是否允许在这个情况下,替换这个打开的socket
+ */
+ allowReplaceSocket: true,
+ /** 是否启用消息队列缓存连接建立前消息,并在建立连接后发送 */
+ enableMessageQueue: this.options.enableMessageQueue == undefined ? true : this.options.enableMessageQueue,
+ /** 重连设置 */
+ reconnect: {
+ enable: true,
+ max: 3
+ }
+ });
+ }
+ case HttpTransportType.LongPolling: // 长轮询方式
+ if (LongPolling instanceof LongPollingTransport) {
+ return LongPolling;
+ }
+ else {
+ return new LongPolling(longPollingTransportOptions
+ ? longPollingTransportOptions
+ : {
+ request: this.request,
+ accessTokenFactory: this.accessTokenFactory,
+ logger: this.logger,
+ logMessageContent: this.options.logMessageContent || false
+ });
+ }
+ default:
+ throw new Error("Unknown transport: " + transport + ".");
+ }
+ };
+ HttpConnection.prototype.resolveTransport = function (endpoint, requestedTransport, requestedTransferFormat) {
+ var transport = HttpTransportType[endpoint.transport];
+ if (transport === null || transport === undefined) {
+ this.logger.log(LogLevel.Debug, "Skipping transport '" + endpoint.transport + "' because it is not supported by this client.");
+ }
+ else {
+ var transferFormats = endpoint.transferFormats.map(function (s) { return TransferFormat[s]; });
+ if (transportMatches(requestedTransport, transport)) {
+ if (transferFormats.indexOf(requestedTransferFormat) >= 0) {
+ if (transport === HttpTransportType.WebSockets && !this.options.WxSocket) {
+ this.logger.log(LogLevel.Debug, "Skipping transport '" + HttpTransportType[transport] + "' because it is not supported in your environment.'");
+ }
+ else {
+ this.logger.log(LogLevel.Debug, "Selecting transport '" + HttpTransportType[transport] + "'.");
+ return transport;
+ }
+ }
+ else {
+ this.logger.log(LogLevel.Debug, "Skipping transport '" + HttpTransportType[transport] + "' because it does not support the requested transfer format '" + TransferFormat[requestedTransferFormat] + "'.");
+ }
+ }
+ else {
+ this.logger.log(LogLevel.Debug, "Skipping transport '" + HttpTransportType[transport] + "' because it was disabled by the client.");
+ }
+ }
+ return null;
+ };
+ HttpConnection.prototype.isITransport = function (transport) {
+ return transport && typeof transport === "object" && "connect" in transport;
+ };
+ HttpConnection.prototype.changeState = function (from, to) {
+ if (this.connectionState === from) {
+ this.connectionState = to;
+ return true;
+ }
+ return false;
+ };
+ HttpConnection.prototype.stopConnection = function (error) {
+ this.transport = undefined;
+ // If we have a stopError, it takes precedence over the error from the transport
+ error = this.stopError || error;
+ if (error) {
+ this.logger.log(LogLevel.Error, "Connection disconnected with error '" + error + "'.");
+ }
+ else {
+ this.logger.log(LogLevel.Information, "Connection disconnected.");
+ }
+ this.connectionState = 2 /* Disconnected */;
+ if (this.onclose) {
+ this.onclose(error);
+ }
+ };
+ /**
+ * ! 由于小程序内必须指定 BaseUrl 关系,这里如果不是全路径的话,暂时直接抛出异常
+ * @param url
+ */
+ HttpConnection.prototype.resolveUrl = function (url) {
+ // startsWith is not supported in IE
+ if (url.lastIndexOf("https://", 0) === 0 || url.lastIndexOf("http://", 0) === 0) {
+ return url;
+ }
+ else {
+ throw new Error("HttpConnection. \u89E3\u6790url\u9519\u8BEF,\u5C0F\u7A0B\u5E8F\u5185\u9700\u8981\u4F20\u5165\u5168\u8DEF\u5F84 ->link: " + url);
+ }
+ };
+ HttpConnection.prototype.resolveNegotiateUrl = function (url) {
+ var index = url.indexOf("?");
+ var negotiateUrl = url.substring(0, index === -1 ? url.length : index);
+ if (negotiateUrl[negotiateUrl.length - 1] !== "/") {
+ negotiateUrl += "/";
+ }
+ negotiateUrl += "negotiate";
+ negotiateUrl += index === -1 ? "" : url.substring(index);
+ return negotiateUrl;
+ };
+ return HttpConnection;
+}());
+export { HttpConnection };
+function transportMatches(requestedTransport, actualTransport) {
+ return !requestedTransport || (actualTransport & requestedTransport) !== 0;
+}
diff --git a/miniprogram_npm/signalr-for-wx/HubConnection.js b/miniprogram_npm/signalr-for-wx/HubConnection.js
new file mode 100644
index 0000000..2b56bbb
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/HubConnection.js
@@ -0,0 +1,546 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __generator = (this && this.__generator) || function (thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+};
+import { HandshakeProtocol } from "./HandshakeProtocol";
+import { MessageType } from "./IHubProtocol";
+import { LogLevel } from "./ILogger";
+import { Arg, Subject } from "./Utils";
+import { EventNotFoundError } from "./Errors";
+var DEFAULT_TIMEOUT_IN_MS = 30 * 1000;
+var DEFAULT_PING_INTERVAL_IN_MS = 15 * 1000;
+/** Describes the current state of the {@link HubConnection} to the server. */
+export var HubConnectionState;
+(function (HubConnectionState) {
+ /** The hub connection is disconnected. */
+ HubConnectionState[HubConnectionState["Disconnected"] = 0] = "Disconnected";
+ /** The hub connection is connected. */
+ HubConnectionState[HubConnectionState["Connected"] = 1] = "Connected";
+})(HubConnectionState || (HubConnectionState = {}));
+/** Represents a connection to a SignalR Hub. */
+var HubConnection = /** @class */ (function () {
+ function HubConnection(connection, logger, protocol) {
+ var _this = this;
+ Arg.isRequired(connection, "connection");
+ Arg.isRequired(logger, "logger");
+ Arg.isRequired(protocol, "protocol");
+ this.serverTimeoutInMilliseconds = DEFAULT_TIMEOUT_IN_MS;
+ this.keepAliveIntervalInMilliseconds = DEFAULT_PING_INTERVAL_IN_MS;
+ this.logger = logger;
+ this.protocol = protocol;
+ this.connection = connection;
+ this.handshakeProtocol = new HandshakeProtocol();
+ this.connection.onreceive = function (data) { return _this.processIncomingData(data); };
+ this.connection.onclose = function (error) { return _this.connectionClosed(error); };
+ this.callbacks = {};
+ this.methods = {};
+ this.closedCallbacks = [];
+ this.id = 0;
+ this.receivedHandshakeResponse = false;
+ this.connectionState = HubConnectionState.Disconnected;
+ this.cachedPingMessage = this.protocol.writeMessage({ type: MessageType.Ping });
+ }
+ /** @internal */
+ // Using a public static factory method means we can have a private constructor and an _internal_
+ // create method that can be used by HubConnectionBuilder. An "internal" constructor would just
+ // be stripped away and the '.d.ts' file would have no constructor, which is interpreted as a
+ // public parameter-less constructor.
+ HubConnection.create = function (connection, logger, protocol) {
+ return new HubConnection(connection, logger, protocol);
+ };
+ Object.defineProperty(HubConnection.prototype, "state", {
+ /** Indicates the state of the {@link HubConnection} to the server. */
+ get: function () {
+ return this.connectionState;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ /** Starts the connection.
+ *
+ * @returns {Promise} A Promise that resolves when the connection has been successfully established, or rejects with an error.
+ */
+ HubConnection.prototype.start = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var handshakeRequest, handshakePromise;
+ var _this = this;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ handshakeRequest = {
+ protocol: this.protocol.name,
+ version: this.protocol.version
+ };
+ this.logger.log(LogLevel.Debug, "Starting HubConnection.");
+ this.receivedHandshakeResponse = false;
+ handshakePromise = new Promise(function (resolve, reject) {
+ _this.handshakeResolver = resolve;
+ _this.handshakeRejecter = reject;
+ });
+ return [4 /*yield*/, this.connection.start(this.protocol.transferFormat)];
+ case 1:
+ _a.sent();
+ this.logger.log(LogLevel.Debug, "Sending handshake request.");
+ return [4 /*yield*/, this.sendMessage(this.handshakeProtocol.writeHandshakeRequest(handshakeRequest))];
+ case 2:
+ _a.sent();
+ this.logger.log(LogLevel.Information, "Using HubProtocol '" + this.protocol.name + "'.", this.protocol);
+ // defensively cleanup timeout in case we receive a message from the server before we finish start
+ this.cleanupTimeout();
+ this.resetTimeoutPeriod();
+ this.resetKeepAliveInterval();
+ // Wait for the handshake to complete before marking connection as connected
+ return [4 /*yield*/, handshakePromise];
+ case 3:
+ // Wait for the handshake to complete before marking connection as connected
+ _a.sent();
+ this.connectionState = HubConnectionState.Connected;
+ return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /** Stops the connection.
+ *
+ * @returns {Promise} A Promise that resolves when the connection has been successfully terminated, or rejects with an error.
+ */
+ HubConnection.prototype.stop = function () {
+ this.logger.log(LogLevel.Debug, "Stopping HubConnection.");
+ this.cleanupTimeout();
+ this.cleanupPingTimer();
+ return this.connection.stop();
+ };
+ /** Invokes a streaming hub method on the server using the specified name and arguments.
+ *
+ * @typeparam T The type of the items returned by the server.
+ * @param {string} methodName The name of the server method to invoke.
+ * @param {any[]} args The arguments used to invoke the server method.
+ * @returns {IStreamResult} An object that yields results from the server as they are received.
+ */
+ HubConnection.prototype.stream = function (methodName) {
+ var _this = this;
+ var args = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ args[_i - 1] = arguments[_i];
+ }
+ var invocationDescriptor = this.createStreamInvocation(methodName, args);
+ var subject = new Subject(function () {
+ var cancelInvocation = _this.createCancelInvocation(invocationDescriptor.invocationId);
+ var cancelMessage = _this.protocol.writeMessage(cancelInvocation);
+ delete _this.callbacks[invocationDescriptor.invocationId];
+ return _this.sendMessage(cancelMessage);
+ });
+ this.callbacks[invocationDescriptor.invocationId] = function (invocationEvent, error) {
+ if (error) {
+ subject.error(error);
+ return;
+ }
+ else if (invocationEvent) {
+ // invocationEvent will not be null when an error is not passed to the callback
+ if (invocationEvent.type === MessageType.Completion) {
+ if (invocationEvent.error) {
+ subject.error(new Error(invocationEvent.error));
+ }
+ else {
+ subject.complete();
+ }
+ }
+ else {
+ subject.next(invocationEvent.item);
+ }
+ }
+ };
+ var message = this.protocol.writeMessage(invocationDescriptor);
+ this.sendMessage(message).catch(function (e) {
+ subject.error(e);
+ delete _this.callbacks[invocationDescriptor.invocationId];
+ });
+ return subject;
+ };
+ HubConnection.prototype.sendMessage = function (message) {
+ this.resetKeepAliveInterval();
+ return this.connection.send(message);
+ };
+ /** Invokes a hub method on the server using the specified name and arguments. Does not wait for a response from the receiver.
+ *
+ * The Promise returned by this method resolves when the client has sent the invocation to the server. The server may still
+ * be processing the invocation.
+ *
+ * @param {string} methodName The name of the server method to invoke.
+ * @param {any[]} args The arguments used to invoke the server method.
+ * @returns {Promise} A Promise that resolves when the invocation has been successfully sent, or rejects with an error.
+ */
+ HubConnection.prototype.send = function (methodName) {
+ var args = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ args[_i - 1] = arguments[_i];
+ }
+ var invocationDescriptor = this.createInvocation(methodName, args, true);
+ var message = this.protocol.writeMessage(invocationDescriptor);
+ return this.sendMessage(message);
+ };
+ /** Invokes a hub method on the server using the specified name and arguments.
+ *
+ * The Promise returned by this method resolves when the server indicates it has finished invoking the method. When the promise
+ * resolves, the server has finished invoking the method. If the server method returns a result, it is produced as the result of
+ * resolving the Promise.
+ *
+ * @typeparam T The expected return type.
+ * @param {string} methodName The name of the server method to invoke.
+ * @param {any[]} args The arguments used to invoke the server method.
+ * @returns {Promise} A Promise that resolves with the result of the server method (if any), or rejects with an error.
+ */
+ HubConnection.prototype.invoke = function (methodName) {
+ var _this = this;
+ var args = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ args[_i - 1] = arguments[_i];
+ }
+ var invocationDescriptor = this.createInvocation(methodName, args, false);
+ var p = new Promise(function (resolve, reject) {
+ // invocationId will always have a value for a non-blocking invocation
+ _this.callbacks[invocationDescriptor.invocationId] = function (invocationEvent, error) {
+ if (error) {
+ reject(error);
+ return;
+ }
+ else if (invocationEvent) {
+ // invocationEvent will not be null when an error is not passed to the callback
+ if (invocationEvent.type === MessageType.Completion) {
+ if (invocationEvent.error) {
+ reject(new Error(invocationEvent.error));
+ }
+ else {
+ resolve(invocationEvent.result);
+ }
+ }
+ else {
+ reject(new Error("Unexpected message type: " + invocationEvent.type));
+ }
+ }
+ };
+ var message = _this.protocol.writeMessage(invocationDescriptor);
+ _this.sendMessage(message).catch(function (e) {
+ reject(e);
+ // invocationId will always have a value for a non-blocking invocation
+ delete _this.callbacks[invocationDescriptor.invocationId];
+ });
+ });
+ return p;
+ };
+ HubConnection.prototype.on = function (methodName, newMethod, only) {
+ if (!methodName || !newMethod) {
+ return;
+ }
+ methodName = methodName.toLowerCase();
+ if (only) {
+ this.methods[methodName] = [newMethod];
+ return;
+ }
+ if (!this.methods[methodName]) {
+ this.methods[methodName] = [];
+ }
+ // Preventing adding the same handler multiple times.
+ if (this.methods[methodName].indexOf(newMethod) !== -1) {
+ return;
+ }
+ this.methods[methodName].push(newMethod);
+ };
+ HubConnection.prototype.off = function (methodName, method) {
+ if (!methodName) {
+ return;
+ }
+ methodName = methodName.toLowerCase();
+ var handlers = this.methods[methodName];
+ if (!handlers) {
+ return;
+ }
+ if (method) {
+ var removeIdx = handlers.indexOf(method);
+ if (removeIdx !== -1) {
+ handlers.splice(removeIdx, 1);
+ if (handlers.length === 0) {
+ delete this.methods[methodName];
+ }
+ }
+ }
+ else {
+ delete this.methods[methodName];
+ }
+ };
+ /** Registers a handler that will be invoked when the connection is closed.
+ *
+ * @param {Function} callback The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).
+ */
+ HubConnection.prototype.onclose = function (callback) {
+ if (callback) {
+ this.closedCallbacks.push(callback);
+ }
+ };
+ HubConnection.prototype.onEventNotFound = function (callback) {
+ if (callback) {
+ this.eventNotFoundCallback = callback;
+ }
+ };
+ HubConnection.prototype.processIncomingData = function (data) {
+ this.cleanupTimeout();
+ if (!this.receivedHandshakeResponse) {
+ data = this.processHandshakeResponse(data);
+ this.receivedHandshakeResponse = true;
+ }
+ // Data may have all been read when processing handshake response
+ if (data) {
+ // Parse the messages
+ var messages = this.protocol.parseMessages(data, this.logger);
+ for (var _i = 0, messages_1 = messages; _i < messages_1.length; _i++) {
+ var message = messages_1[_i];
+ switch (message.type) {
+ case MessageType.Invocation:
+ this.invokeClientMethod(message);
+ break;
+ case MessageType.StreamItem:
+ case MessageType.Completion:
+ var callback = this.callbacks[message.invocationId];
+ if (callback != null) {
+ if (message.type === MessageType.Completion) {
+ delete this.callbacks[message.invocationId];
+ }
+ callback(message);
+ }
+ break;
+ case MessageType.Ping:
+ // Don't care about pings
+ break;
+ case MessageType.Close:
+ this.logger.log(LogLevel.Information, "Close message received from server.");
+ // We don't want to wait on the stop itself.
+ // tslint:disable-next-line:no-floating-promises
+ this.connection.stop(message.error ? new Error("Server returned an error on close: " + message.error) : undefined);
+ break;
+ default:
+ this.logger.log(LogLevel.Warning, "Invalid message type: " + message.type + ".", message);
+ break;
+ }
+ }
+ }
+ this.resetTimeoutPeriod();
+ };
+ HubConnection.prototype.processHandshakeResponse = function (data) {
+ var _a;
+ var responseMessage;
+ var remainingData;
+ try {
+ _a = this.handshakeProtocol.parseHandshakeResponse(data), remainingData = _a[0], responseMessage = _a[1];
+ }
+ catch (e) {
+ var message = "Error parsing handshake response: " + e;
+ this.logger.log(LogLevel.Error, message);
+ var error = new Error(message);
+ // We don't want to wait on the stop itself.
+ // tslint:disable-next-line:no-floating-promises
+ this.connection.stop(error);
+ this.handshakeRejecter(error);
+ throw error;
+ }
+ if (responseMessage.error) {
+ var message = "Server returned handshake error: " + responseMessage.error;
+ this.logger.log(LogLevel.Error, message);
+ this.handshakeRejecter(message);
+ // We don't want to wait on the stop itself.
+ // tslint:disable-next-line:no-floating-promises
+ this.connection.stop(new Error(message));
+ throw new Error(message);
+ }
+ else {
+ this.logger.log(LogLevel.Debug, "Server handshake complete.");
+ }
+ this.handshakeResolver();
+ return remainingData;
+ };
+ HubConnection.prototype.resetKeepAliveInterval = function () {
+ var _this = this;
+ this.cleanupPingTimer();
+ this.pingServerHandle = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
+ var _a;
+ return __generator(this, function (_b) {
+ switch (_b.label) {
+ case 0:
+ if (!(this.connectionState === HubConnectionState.Connected)) return [3 /*break*/, 4];
+ _b.label = 1;
+ case 1:
+ _b.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, this.sendMessage(this.cachedPingMessage)];
+ case 2:
+ _b.sent();
+ return [3 /*break*/, 4];
+ case 3:
+ _a = _b.sent();
+ // We don't care about the error. It should be seen elsewhere in the client.
+ // The connection is probably in a bad or closed state now, cleanup the timer so it stops triggering
+ this.cleanupPingTimer();
+ return [3 /*break*/, 4];
+ case 4: return [2 /*return*/];
+ }
+ });
+ }); }, this.keepAliveIntervalInMilliseconds);
+ };
+ HubConnection.prototype.resetTimeoutPeriod = function () {
+ var _this = this;
+ if (!this.connection.features || !this.connection.features.inherentKeepAlive) {
+ // Set the timeout timer
+ this.timeoutHandle = setTimeout(function () { return _this.serverTimeout(); }, this.serverTimeoutInMilliseconds);
+ }
+ };
+ HubConnection.prototype.serverTimeout = function () {
+ // The server hasn't talked to us in a while. It doesn't like us anymore ... :(
+ // Terminate the connection, but we don't need to wait on the promise.
+ // tslint:disable-next-line:no-floating-promises
+ this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."));
+ };
+ HubConnection.prototype.invokeClientMethod = function (invocationMessage) {
+ var _this = this;
+ var methods = this.methods[invocationMessage.target.toLowerCase()];
+ if (methods) {
+ try {
+ // Time:2020年1月1日 22:30:30 增加一个 try cache, 获取 signalr 在特定场景下,处理事件失败会关闭问题.
+ methods.forEach(function (m) { return m.apply(_this, invocationMessage.arguments); });
+ }
+ catch (error) {
+ console.error(error);
+ }
+ if (invocationMessage.invocationId) {
+ // This is not supported in v1. So we return an error to avoid blocking the server waiting for the response.
+ var message = "Server requested a response, which is not supported in this version of the client.";
+ this.logger.log(LogLevel.Error, message);
+ // We don't need to wait on this Promise.
+ // tslint:disable-next-line:no-floating-promises
+ this.connection.stop(new Error(message));
+ }
+ }
+ else {
+ var message = "No client method with the name '" + invocationMessage.target + "' found.";
+ this.logger.log(LogLevel.Warning, message);
+ this.logger.log(LogLevel.Information, "Current Event Methods:" + Object.keys(this.methods));
+ this.eventNotFound(new EventNotFoundError(invocationMessage, message));
+ }
+ };
+ HubConnection.prototype.connectionClosed = function (error) {
+ var _this = this;
+ var callbacks = this.callbacks;
+ this.callbacks = {};
+ this.connectionState = HubConnectionState.Disconnected;
+ // if handshake is in progress start will be waiting for the handshake promise, so we complete it
+ // if it has already completed this should just noop
+ if (this.handshakeRejecter) {
+ this.handshakeRejecter(error);
+ }
+ Object.keys(callbacks).forEach(function (key) {
+ var callback = callbacks[key];
+ callback(null, error ? error : new Error("Invocation canceled due to connection being closed."));
+ });
+ this.cleanupTimeout();
+ this.cleanupPingTimer();
+ this.closedCallbacks.forEach(function (c) { return c.apply(_this, [error]); });
+ };
+ HubConnection.prototype.eventNotFound = function (error) {
+ return __awaiter(this, void 0, void 0, function () {
+ var r;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if (!this.eventNotFoundCallback) return [3 /*break*/, 2];
+ return [4 /*yield*/, this.eventNotFoundCallback(error)];
+ case 1:
+ r = _a.sent();
+ if (r === true) {
+ this.logger.log(LogLevel.Information, "retry invoke local message callback.");
+ this.invokeClientMethod(error.invocationMessage);
+ }
+ _a.label = 2;
+ case 2: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ HubConnection.prototype.cleanupPingTimer = function () {
+ if (this.pingServerHandle) {
+ clearTimeout(this.pingServerHandle);
+ }
+ };
+ HubConnection.prototype.cleanupTimeout = function () {
+ if (this.timeoutHandle) {
+ clearTimeout(this.timeoutHandle);
+ }
+ };
+ HubConnection.prototype.createInvocation = function (methodName, args, nonblocking) {
+ if (nonblocking) {
+ return {
+ arguments: args,
+ target: methodName,
+ type: MessageType.Invocation
+ };
+ }
+ else {
+ var id = this.id;
+ this.id++;
+ return {
+ arguments: args,
+ invocationId: id.toString(),
+ target: methodName,
+ type: MessageType.Invocation
+ };
+ }
+ };
+ HubConnection.prototype.createStreamInvocation = function (methodName, args) {
+ var id = this.id;
+ this.id++;
+ return {
+ arguments: args,
+ invocationId: id.toString(),
+ target: methodName,
+ type: MessageType.StreamInvocation
+ };
+ };
+ HubConnection.prototype.createCancelInvocation = function (id) {
+ return {
+ invocationId: id,
+ type: MessageType.CancelInvocation
+ };
+ };
+ return HubConnection;
+}());
+export { HubConnection };
diff --git a/miniprogram_npm/signalr-for-wx/HubConnectionBuilder.js b/miniprogram_npm/signalr-for-wx/HubConnectionBuilder.js
new file mode 100644
index 0000000..0406f21
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/HubConnectionBuilder.js
@@ -0,0 +1,71 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+import { HttpConnection } from "./HttpConnection";
+import { HubConnection } from "./HubConnection";
+import { JsonHubProtocol } from "./JsonHubProtocol";
+import { NullLogger } from "./Loggers";
+import { Arg, ConsoleLogger } from "./Utils";
+/** A builder for configuring {@link @aspnet/signalr.HubConnection} instances. */
+var HubConnectionBuilder = /** @class */ (function () {
+ function HubConnectionBuilder() {
+ }
+ HubConnectionBuilder.prototype.configureLogging = function (logging) {
+ Arg.isRequired(logging, "logging");
+ if (isLogger(logging)) {
+ this.logger = logging;
+ }
+ else {
+ this.logger = new ConsoleLogger(logging);
+ }
+ return this;
+ };
+ HubConnectionBuilder.prototype.withUrl = function (url, transportTypeOrOptions) {
+ Arg.isRequired(url, "url");
+ this.url = url;
+ // Flow-typing knows where it's at. Since HttpTransportType is a number and IHttpConnectionOptions is guaranteed
+ // to be an object, we know (as does TypeScript) this comparison is all we need to figure out which overload was called.
+ if (typeof transportTypeOrOptions === "object") {
+ this.httpConnectionOptions = transportTypeOrOptions;
+ }
+ else {
+ this.httpConnectionOptions = {
+ transport: transportTypeOrOptions,
+ };
+ }
+ return this;
+ };
+ /** Configures the {@link @aspnet/signalr.HubConnection} to use the specified Hub Protocol.
+ *
+ * @param {IHubProtocol} protocol The {@link @aspnet/signalr.IHubProtocol} implementation to use.
+ */
+ HubConnectionBuilder.prototype.withHubProtocol = function (protocol) {
+ Arg.isRequired(protocol, "protocol");
+ this.protocol = protocol;
+ return this;
+ };
+ /** Creates a {@link @aspnet/signalr.HubConnection} from the configuration options specified in this builder.
+ *
+ * @returns {HubConnection} The configured {@link @aspnet/signalr.HubConnection}.
+ */
+ HubConnectionBuilder.prototype.build = function () {
+ // If httpConnectionOptions has a logger, use it. Otherwise, override it with the one
+ // provided to configureLogger
+ var httpConnectionOptions = this.httpConnectionOptions || {};
+ // If it's 'null', the user **explicitly** asked for null, don't mess with it.
+ if (httpConnectionOptions.logger === undefined) {
+ // If our logger is undefined or null, that's OK, the HttpConnection constructor will handle it.
+ httpConnectionOptions.logger = this.logger;
+ }
+ // Now create the connection
+ if (!this.url) {
+ throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");
+ }
+ var connection = new HttpConnection(this.url, httpConnectionOptions);
+ return HubConnection.create(connection, this.logger || NullLogger.instance, this.protocol || new JsonHubProtocol());
+ };
+ return HubConnectionBuilder;
+}());
+export { HubConnectionBuilder };
+function isLogger(logger) {
+ return logger.log !== undefined;
+}
diff --git a/miniprogram_npm/signalr-for-wx/IConnection.js b/miniprogram_npm/signalr-for-wx/IConnection.js
new file mode 100644
index 0000000..95328c3
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/IConnection.js
@@ -0,0 +1,2 @@
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
diff --git a/miniprogram_npm/signalr-for-wx/IHttpConnectionOptions.js b/miniprogram_npm/signalr-for-wx/IHttpConnectionOptions.js
new file mode 100644
index 0000000..95328c3
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/IHttpConnectionOptions.js
@@ -0,0 +1,2 @@
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
diff --git a/miniprogram_npm/signalr-for-wx/IHubProtocol.js b/miniprogram_npm/signalr-for-wx/IHubProtocol.js
new file mode 100644
index 0000000..d04194b
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/IHubProtocol.js
@@ -0,0 +1,34 @@
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
+/* 定义消息的类型[枚举] */
+export var MessageType;
+(function (MessageType) {
+ /**
+ * - 指示消息是一个 `调用消息` 并实现 {@link @aspnet/signalr.InvocationMessage} 接口。
+ */
+ MessageType[MessageType["Invocation"] = 1] = "Invocation";
+ /**
+ * - 指示消息是一个 `流消息` 并实现 {@link @aspnet/signalr.StreamItemMessage} 接口。
+ */
+ MessageType[MessageType["StreamItem"] = 2] = "StreamItem";
+ /**
+ * - 指示消息是一个 `完成消息` 并实现 {@link @aspnet/signalr.CompletionMessage} 接口。
+ */
+ MessageType[MessageType["Completion"] = 3] = "Completion";
+ /**
+ * - 指示消息是一个 `流调用消息` 并实现 {@link @aspnet/signalr.StreamInvocationMessage} 接口。
+ */
+ MessageType[MessageType["StreamInvocation"] = 4] = "StreamInvocation";
+ /**
+ * - 指示消息是一个 `取消调用消息` 并实现 {@link @aspnet/signalr.CancelInvocationMessage} 接口。
+ */
+ MessageType[MessageType["CancelInvocation"] = 5] = "CancelInvocation";
+ /**
+ * - 指示消息是一个 `Ping消息` 并实现 {@link @aspnet/signalr.PingMessage} 接口。
+ */
+ MessageType[MessageType["Ping"] = 6] = "Ping";
+ /**
+ * - 指示消息是一个 `关闭消息` 并实现 {@link @aspnet/signalr.CloseMessage} 接口。
+ */
+ MessageType[MessageType["Close"] = 7] = "Close";
+})(MessageType || (MessageType = {}));
diff --git a/miniprogram_npm/signalr-for-wx/ILogger.js b/miniprogram_npm/signalr-for-wx/ILogger.js
new file mode 100644
index 0000000..67bdc07
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/ILogger.js
@@ -0,0 +1,25 @@
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
+//这些值被设计为与ASP.NET日志级别匹配,因为这是我们在这里模拟的模式。
+/**
+ * 指示日志消息的严重性。
+ * 日志级别按严重性递增的顺序排列。所以“Debug”比“Trace”等更严重。
+ *
+ */
+export var LogLevel;
+(function (LogLevel) {
+ /** 极低严重性诊断消息的日志级别. */
+ LogLevel[LogLevel["Trace"] = 0] = "Trace";
+ /** 调试错误. */
+ LogLevel[LogLevel["Debug"] = 1] = "Debug";
+ /** 消息. */
+ LogLevel[LogLevel["Information"] = 2] = "Information";
+ /** 警告. */
+ LogLevel[LogLevel["Warning"] = 3] = "Warning";
+ /** 错误. */
+ LogLevel[LogLevel["Error"] = 4] = "Error";
+ /** 严重错误. */
+ LogLevel[LogLevel["Critical"] = 5] = "Critical";
+ /** 最高日志级别。在配置日志记录以指示不应发出日志消息时使用. */
+ LogLevel[LogLevel["None"] = 6] = "None";
+})(LogLevel || (LogLevel = {}));
diff --git a/miniprogram_npm/signalr-for-wx/ITransport.js b/miniprogram_npm/signalr-for-wx/ITransport.js
new file mode 100644
index 0000000..606fed1
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/ITransport.js
@@ -0,0 +1,21 @@
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
+//这在将来会被当作一个位标志,所以我们使用两个值的幂来保持它。
+/**指定特定的HTTP传输类型。*/
+export var HttpTransportType;
+(function (HttpTransportType) {
+ /**未指定传输首选项。*/
+ HttpTransportType[HttpTransportType["None"] = 0] = "None";
+ /**指定WebSocket传输。*/
+ HttpTransportType[HttpTransportType["WebSockets"] = 1] = "WebSockets";
+ /**指定长轮询传输。*/
+ HttpTransportType[HttpTransportType["LongPolling"] = 4] = "LongPolling";
+})(HttpTransportType || (HttpTransportType = {}));
+/**指定连接的传输格式。*/
+export var TransferFormat;
+(function (TransferFormat) {
+ /**指定仅通过连接传输文本数据。*/
+ TransferFormat[TransferFormat["Text"] = 1] = "Text";
+ /**指定将通过连接传输二进制数据。*/
+ TransferFormat[TransferFormat["Binary"] = 2] = "Binary";
+})(TransferFormat || (TransferFormat = {}));
diff --git a/miniprogram_npm/signalr-for-wx/JsonHubProtocol.js b/miniprogram_npm/signalr-for-wx/JsonHubProtocol.js
new file mode 100644
index 0000000..518aaae
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/JsonHubProtocol.js
@@ -0,0 +1,129 @@
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
+import { MessageType } from "./IHubProtocol";
+import { LogLevel } from "./ILogger";
+import { TransferFormat } from "./ITransport";
+import { NullLogger } from "./Loggers";
+import { TextMessageFormat } from "./TextMessageFormat";
+var JSON_HUB_PROTOCOL_NAME = "json";
+/** Implements the JSON Hub Protocol. */
+var JsonHubProtocol = /** @class */ (function () {
+ function JsonHubProtocol() {
+ /** @inheritDoc */
+ this.name = JSON_HUB_PROTOCOL_NAME;
+ /** @inheritDoc */
+ this.version = 1;
+ /** @inheritDoc */
+ this.transferFormat = TransferFormat.Text;
+ }
+ /**
+ * Creates an array of {@link @aspnet/signalr.HubMessage} objects from the specified serialized representation.
+ * 从指定的序列化表示创建{@link@aspnet/signaler.HubMessage}对象数组
+ *
+ * @param {string} input 包含序列化表示的字符串 A string containing the serialized representation.
+ * @param {ILogger} logger
+ */
+ JsonHubProtocol.prototype.parseMessages = function (input, logger) {
+ // 接口允许传入“ArrayBuffer”,但此实现不允许。所以让我们抛出一个有用的错误
+ if (typeof input !== "string") {
+ throw new Error("Invalid input for JSON hub protocol. Expected a string. (fy:包含一个无效的JSON协议输入,但是这里需要输入string 消息)");
+ }
+ // fixed
+ if (!input) {
+ return [];
+ }
+ // fixed
+ if (logger === null) {
+ logger = NullLogger.instance;
+ }
+ // string 类型消息格式化转换
+ var messages = TextMessageFormat.parse(input);
+ var hubMessages = [];
+ for (var _i = 0, messages_1 = messages; _i < messages_1.length; _i++) {
+ var message = messages_1[_i];
+ // 转换消息
+ var parsedMessage = JSON.parse(message);
+ if (typeof parsedMessage.type !== "number") {
+ throw new Error("Invalid payload. (fy: 无效的消息)");
+ }
+ switch (parsedMessage.type) {
+ case MessageType.Invocation: // 调用命令
+ this.isInvocationMessage(parsedMessage);
+ break;
+ case MessageType.StreamItem: // 流消息
+ this.isStreamItemMessage(parsedMessage);
+ break;
+ case MessageType.Completion: // 完成消息
+ this.isCompletionMessage(parsedMessage);
+ break;
+ case MessageType.Ping: // ping 命令
+ // Single value, no need to validate
+ break;
+ case MessageType.Close: // 关闭命令
+ // All optional values, no need to validate
+ break;
+ default: // 未定义命令,抛出异常
+ // Future protocol changes can add message types, old clients can ignore them
+ logger.log(LogLevel.Information, "Unknown message type '" + parsedMessage.type + "' ignored.");
+ continue;
+ }
+ hubMessages.push(parsedMessage);
+ }
+ return hubMessages;
+ };
+ /**
+ * Writes the specified {@link @aspnet/signalr.HubMessage} to a string and returns it.
+ * 将指定的{@link@aspnet/signalr.HubMessage}写入字符串并返回
+ *
+ * @param {HubMessage} message The message to write. 消息内容
+ * @returns {string} 包含消息的序列化表示形式的字符串。
+ */
+ JsonHubProtocol.prototype.writeMessage = function (message) {
+ return TextMessageFormat.write(JSON.stringify(message));
+ };
+ /**
+ * 判断是否是一个正常的调用消息
+ * @param message
+ */
+ JsonHubProtocol.prototype.isInvocationMessage = function (message) {
+ this.assertNotEmptyString(message.target, "Invalid payload for Invocation message.");
+ if (message.invocationId !== undefined) {
+ this.assertNotEmptyString(message.invocationId, "Invalid payload for Invocation message. (fy:无效的 [调用] 消息)");
+ }
+ };
+ /**
+ * 判断是否是一个流消息子项
+ * @param message
+ */
+ JsonHubProtocol.prototype.isStreamItemMessage = function (message) {
+ this.assertNotEmptyString(message.invocationId, "Invalid payload for StreamItem message. (fy:无效的 [StreamItem] 消息)");
+ if (message.item === undefined) {
+ throw new Error("Invalid payload for StreamItem message. (fy:无效的 [StreamItem] 消息)");
+ }
+ };
+ /**
+ * 判断是否是一个完整的消息
+ * @param message
+ */
+ JsonHubProtocol.prototype.isCompletionMessage = function (message) {
+ if (message.result && message.error) {
+ throw new Error("Invalid payload for Completion message (fy:消息不完整).");
+ }
+ if (!message.result && message.error) {
+ this.assertNotEmptyString(message.error, "Invalid payload for Completion message (fy:消息不完整).");
+ }
+ this.assertNotEmptyString(message.invocationId, "Invalid payload for Completion message (fy:消息不完整).");
+ };
+ /**
+ * 断言非空字符串
+ * @param value
+ * @param errorMessage
+ */
+ JsonHubProtocol.prototype.assertNotEmptyString = function (value, errorMessage) {
+ if (typeof value !== "string" || value === "") {
+ throw new Error(errorMessage);
+ }
+ };
+ return JsonHubProtocol;
+}());
+export { JsonHubProtocol };
diff --git a/miniprogram_npm/signalr-for-wx/Loggers.js b/miniprogram_npm/signalr-for-wx/Loggers.js
new file mode 100644
index 0000000..59fc6f5
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/Loggers.js
@@ -0,0 +1,17 @@
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
+/** 未定义 logger 时使用的 空输出实现. */
+var NullLogger = /** @class */ (function () {
+ function NullLogger() {
+ }
+ NullLogger.prototype.log = function (logLevel) {
+ var msg = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ msg[_i - 1] = arguments[_i];
+ }
+ };
+ /** The singleton instance of the {@link @aspnet/signalr.NullLogger}. */
+ NullLogger.instance = new NullLogger();
+ return NullLogger;
+}());
+export { NullLogger };
diff --git a/miniprogram_npm/signalr-for-wx/LongPollingTransport.js b/miniprogram_npm/signalr-for-wx/LongPollingTransport.js
new file mode 100644
index 0000000..c3adad2
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/LongPollingTransport.js
@@ -0,0 +1,380 @@
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __generator = (this && this.__generator) || function (thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+};
+import { AbortController } from "./AbortController";
+import { HttpError, TimeoutError } from "./Errors";
+import { LogLevel } from "./ILogger";
+import { TransferFormat } from "./ITransport";
+import { Arg, getDataDetail, sendMessage } from "./Utils";
+import { ResponseType } from "./wx-request/model/ResponseType";
+import { NullLogger } from './Loggers';
+import DefaultRequest from "./DefualtRequest";
+// Not exported from 'index', this type is internal.
+/**
+ * 长轮询
+ * @private
+ */
+var LongPollingTransport = /** @class */ (function () {
+ /**
+ * 导出 request 工具
+ * @param {Request} request
+ * @param {((() => string | Promise) | undefined)} accessTokenFactory access-token-factory
+ * @param {ILogger} logger
+ * @param {boolean} logMessageContent
+ * @memberof LongPollingTransport
+ */
+ function LongPollingTransport(options) {
+ this.accessTokenFactory = options.accessTokenFactory ? options.accessTokenFactory : undefined;
+ this.logger = options.logger ? options.logger : new NullLogger();
+ this.pollAbort = new AbortController();
+ this.logMessageContent = options.logMessageContent ? options.logMessageContent : false;
+ this.request = options.request ? options.request : new DefaultRequest({}, this.logger);
+ this.running = false;
+ this.onreceive = null;
+ this.onclose = null;
+ }
+ Object.defineProperty(LongPollingTransport.prototype, "pollAborted", {
+ // This is an internal type, not exported from 'index' so this is really just internal.
+ get: function () {
+ return this.pollAbort.aborted;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ /**
+ * 连接 - 这里理解为请求
+ *
+ * @param {string} url
+ * @param {TransferFormat} transferFormat
+ * @returns {Promise}
+ * @memberof LongPollingTransport
+ */
+ LongPollingTransport.prototype.connect = function (options) {
+ return __awaiter(this, void 0, void 0, function () {
+ var pollOptions, token, response;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ /* 验证参数完整性,不完整抛出异常 */
+ Arg.isRequired(options, "options");
+ Arg.isRequired(options.transferFormat, "transferFormat");
+ Arg.isIn(options.transferFormat, TransferFormat, "transferFormat");
+ // update options
+ this.url = options.url;
+ // print log
+ this.logger.log(LogLevel.Trace, "(LongPolling transport) Connecting.");
+ pollOptions = {
+ config: {
+ // 中断信号
+ about: this.pollAbort.signal.aborted,
+ timeout: 120 * 1000 // 超时时间 2 min
+ },
+ // origin header 头
+ headers: {}
+ };
+ if (options.transferFormat === TransferFormat.Binary) {
+ pollOptions.responseType = ResponseType.ARRAY_BUFFER;
+ }
+ return [4 /*yield*/, this.getAccessToken()];
+ case 1:
+ token = _a.sent();
+ this.updateHeaderToken(pollOptions, token);
+ // Make initial long polling request
+ // Server uses first long polling request to finish initializing connection and it returns without data
+ //发出初始长轮询请求
+ //服务器使用第一个长轮询请求完成连接初始化,它返回时不带数据
+ this.logger.log(LogLevel.Trace, "(LongPolling transport) polling: [url]" + this.url);
+ return [4 /*yield*/, this.request.get(this.url, {
+ _: Date.now()
+ }, pollOptions)];
+ case 2:
+ response = _a.sent();
+ if (response.statusCode !== 200) {
+ this.logger.log(LogLevel.Error, "(LongPolling transport) Unexpected response code: " + response.statusCode + ".");
+ // Mark running as false so that the poll immediately ends and runs the close logic
+ // ! 重写了 内置 的 创建 `HttpError` 方法
+ this.closeError = new HttpError(response.errMsg || "", response.statusCode);
+ this.running = false;
+ }
+ else {
+ this.running = true;
+ }
+ this.receiving = this.poll(this.url, pollOptions);
+ return [2 /*return*/, Promise.resolve({
+ errMsg: "connect success"
+ })];
+ }
+ });
+ });
+ };
+ /**
+ * 获取 access-token
+ *
+ * @private
+ * @returns {(Promise)}
+ * @memberof LongPollingTransport
+ */
+ LongPollingTransport.prototype.getAccessToken = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if (!this.accessTokenFactory) return [3 /*break*/, 2];
+ return [4 /*yield*/, this.accessTokenFactory()];
+ case 1: return [2 /*return*/, _a.sent()];
+ case 2: return [2 /*return*/, null];
+ }
+ });
+ });
+ };
+ /**
+ * 更新 access-token
+ *
+ * @private
+ * @param {RequestOption} request
+ * @param {(string | null)} token
+ * @returns
+ * @memberof LongPollingTransport
+ */
+ LongPollingTransport.prototype.updateHeaderToken = function (request, token) {
+ /**
+ * fix header
+ */
+ if (!request.headers) {
+ request.headers = {};
+ }
+ /**
+ * push token to headers
+ */
+ if (token) {
+ // tslint:disable-next-line:no-string-literal
+ request.headers["Authorization"] = "Bearer " + token;
+ return;
+ }
+ // tslint:disable-next-line:no-string-literal
+ if (request.headers["Authorization"]) {
+ // tslint:disable-next-line:no-string-literal
+ delete request.headers["Authorization"];
+ }
+ };
+ /**
+ * 异步计数?
+ *
+ * @private
+ * @param {string} url
+ * @param {RequestOption} pollOptions
+ * @returns {Promise}
+ * @memberof LongPollingTransport
+ */
+ LongPollingTransport.prototype.poll = function (url, pollOptions) {
+ return __awaiter(this, void 0, void 0, function () {
+ var token, pollUrl, response, e_1;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ _a.trys.push([0, , 8, 9]);
+ _a.label = 1;
+ case 1:
+ if (!this.running) return [3 /*break*/, 7];
+ return [4 /*yield*/, this.getAccessToken()];
+ case 2:
+ token = _a.sent();
+ this.updateHeaderToken(pollOptions, token);
+ _a.label = 3;
+ case 3:
+ _a.trys.push([3, 5, , 6]);
+ pollUrl = url + "&_=" + Date.now();
+ this.logger.log(LogLevel.Trace, "(LongPolling transport) polling: " + pollUrl + ". - (fy:\u957F\u8F6E\u8BE2\u4F20\u8F93 - polling)");
+ return [4 /*yield*/, this.request.get(this.url, {
+ _: Date.now()
+ }, pollOptions)];
+ case 4:
+ response = _a.sent();
+ if (response.statusCode === 204) {
+ this.logger.log(LogLevel.Information, "(LongPolling transport) Poll terminated by server. - (fy:长轮询传输 - 由服务器终止轮询。)");
+ this.running = false;
+ }
+ else if (response.statusCode !== 200) {
+ this.logger.log(LogLevel.Error, "(LongPolling transport) Unexpected response code: " + response.statusCode + ". - (fy:\u957F\u8F6E\u8BE2\u4F20\u8F93 - \u610F\u5916\u7684\u54CD\u5E94\u4EE3\u7801)");
+ // Unexpected status code
+ this.closeError = new HttpError(response.errMsg || "", response.statusCode);
+ this.running = false;
+ }
+ else {
+ // Process the response
+ if (response.data) {
+ this.logger.log(LogLevel.Trace, "(LongPolling transport) data received. " + getDataDetail(response.data, this.logMessageContent) + ".");
+ if (this.onreceive) {
+ this.onreceive(response.data);
+ }
+ }
+ else {
+ // This is another way timeout manifest.
+ this.logger.log(LogLevel.Trace, "(LongPolling transport) Poll timed out, reissuing.");
+ }
+ }
+ return [3 /*break*/, 6];
+ case 5:
+ e_1 = _a.sent();
+ if (!this.running) {
+ // Log but disregard errors that occur after stopping - fy: 记录但忽略停止后发生的错误
+ this.logger.log(LogLevel.Trace, "(LongPolling transport) Poll errored after shutdown: " + e_1.message);
+ }
+ else {
+ if (e_1 instanceof TimeoutError) {
+ // Ignore timeouts and reissue the poll. - 忽略超时并重新发出投票
+ this.logger.log(LogLevel.Trace, "(LongPolling transport) Poll timed out, reissuing. - (fy:长轮询传输 - 请求超时)");
+ }
+ else {
+ // Close the connection with the error as the result.
+ this.closeError = e_1;
+ this.running = false;
+ }
+ }
+ return [3 /*break*/, 6];
+ case 6: return [3 /*break*/, 1];
+ case 7: return [3 /*break*/, 9];
+ case 8:
+ this.logger.log(LogLevel.Trace, "(LongPolling transport) Polling complete. - (fy:长轮询传输 - 请求完成)");
+ // We will reach here with pollAborted==false when the server returned a response causing the transport to stop.
+ // If pollAborted==true then client initiated the stop and the stop method will raise the close event after DELETE is sent.
+ //当服务器返回导致传输停止的响应时,我们将使用pollAborted==false到达这里。
+ //如果pollAborted==true,则客户端启动了stop,stop方法将在发送DELETE后引发close事件。
+ if (!this.pollAborted) {
+ this.raiseOnClose();
+ }
+ return [7 /*endfinally*/];
+ case 9: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * 发送轮询包
+ *
+ * @param {*} data
+ * @returns {Promise}
+ * @memberof LongPollingTransport
+ */
+ LongPollingTransport.prototype.send = function (data) {
+ return __awaiter(this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ if (!this.running) {
+ return [2 /*return*/, Promise.reject(new Error("Cannot send until the transport is connected"))];
+ }
+ return [2 /*return*/, sendMessage(this.logger, "LongPolling", this.request, this.url, this.accessTokenFactory, data, this.logMessageContent)];
+ });
+ });
+ };
+ /**
+ * 停止
+ *
+ * @returns {Promise}
+ * @memberof LongPollingTransport
+ */
+ LongPollingTransport.prototype.stop = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var deleteOptions, token, e_2;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ this.logger.log(LogLevel.Trace, "(LongPolling transport) Stopping polling.");
+ // Tell receiving loop to stop, abort any current request, and then wait for it to finish
+ this.running = false;
+ this.pollAbort.abort();
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 5, 6, 7]);
+ return [4 /*yield*/, this.receiving];
+ case 2:
+ _a.sent(); // 这里 receiving 本身是一个 promise result, 用这个对象来监控请求未完成
+ // Send DELETE to clean up long polling on the server
+ // 发送DELETE以清除服务器上的长轮询
+ this.logger.log(LogLevel.Trace, "(LongPolling transport) sending DELETE request to " + this.url + ".");
+ deleteOptions = {
+ headers: {}
+ };
+ return [4 /*yield*/, this.getAccessToken()];
+ case 3:
+ token = _a.sent();
+ this.updateHeaderToken(deleteOptions, token);
+ return [4 /*yield*/, this.request.delete(this.url, {}, deleteOptions)];
+ case 4:
+ _a.sent();
+ this.logger.log(LogLevel.Trace, "(LongPolling transport) DELETE request sent.");
+ return [2 /*return*/, Promise.resolve({
+ errMsg: "stop success"
+ })];
+ case 5:
+ e_2 = _a.sent();
+ this.logger.log(LogLevel.Error, "(LongPolling transport) Stop error.", e_2);
+ return [2 /*return*/, Promise.reject({
+ errMsg: "stop fail"
+ })];
+ case 6:
+ this.logger.log(LogLevel.Trace, "(LongPolling transport) Stop finished.");
+ // Raise close event here instead of in polling
+ // It needs to happen after the DELETE request is sent
+ //在此处引发关闭事件,而不是在轮询中
+ //它需要在发送删除请求后发生
+ this.raiseOnClose();
+ return [7 /*endfinally*/];
+ case 7: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * 调用关闭回调
+ *
+ * @private
+ * @memberof LongPollingTransport
+ */
+ LongPollingTransport.prototype.raiseOnClose = function () {
+ if (this.onclose) {
+ var logMessage = "(LongPolling transport) Firing onclose event.";
+ if (this.closeError) {
+ logMessage += " Error: " + this.closeError;
+ }
+ this.logger.log(LogLevel.Trace, logMessage);
+ this.onclose(this.closeError);
+ }
+ };
+ return LongPollingTransport;
+}());
+export { LongPollingTransport };
diff --git a/miniprogram_npm/signalr-for-wx/Polyfills.js b/miniprogram_npm/signalr-for-wx/Polyfills.js
new file mode 100644
index 0000000..5f1c2d6
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/Polyfills.js
@@ -0,0 +1,13 @@
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt
+// Not exported from index
+/**
+ * 小程序socket连接状态[枚举]
+ */
+export var WxSocketReadyState;
+(function (WxSocketReadyState) {
+ WxSocketReadyState[WxSocketReadyState["CONNECTING"] = 0] = "CONNECTING";
+ WxSocketReadyState[WxSocketReadyState["OPEN"] = 1] = "OPEN";
+ WxSocketReadyState[WxSocketReadyState["CLOSING"] = 2] = "CLOSING";
+ WxSocketReadyState[WxSocketReadyState["CLOSED"] = 3] = "CLOSED";
+})(WxSocketReadyState || (WxSocketReadyState = {}));
diff --git a/miniprogram_npm/signalr-for-wx/Stream.js b/miniprogram_npm/signalr-for-wx/Stream.js
new file mode 100644
index 0000000..95328c3
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/Stream.js
@@ -0,0 +1,2 @@
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
diff --git a/miniprogram_npm/signalr-for-wx/TextMessageFormat.js b/miniprogram_npm/signalr-for-wx/TextMessageFormat.js
new file mode 100644
index 0000000..4252522
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/TextMessageFormat.js
@@ -0,0 +1,46 @@
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
+// 未从索引导出
+/**
+ * 文本类型消息格式化
+ * @private
+ */
+var TextMessageFormat = /** @class */ (function () {
+ function TextMessageFormat() {
+ }
+ /**
+ * 输出一个格式化过的消息
+ * @param output
+ */
+ TextMessageFormat.write = function (output) {
+ return "" + output + TextMessageFormat.RecordSeparator;
+ };
+ /**
+ * 解析
+ * @param input
+ */
+ TextMessageFormat.parse = function (input) {
+ if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {
+ throw new Error("Message is incomplete.");
+ }
+ var messages = input.split(TextMessageFormat.RecordSeparator);
+ messages.pop();
+ return messages;
+ };
+ /**
+ * 记录分隔符 code
+ *
+ * @static
+ * @memberof TextMessageFormat
+ */
+ TextMessageFormat.RecordSeparatorCode = 0x1e;
+ /**
+ * 记录分隔符(string)
+ *
+ * @static
+ * @memberof TextMessageFormat
+ */
+ TextMessageFormat.RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);
+ return TextMessageFormat;
+}());
+export { TextMessageFormat };
diff --git a/miniprogram_npm/signalr-for-wx/Utils.js b/miniprogram_npm/signalr-for-wx/Utils.js
new file mode 100644
index 0000000..84004d4
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/Utils.js
@@ -0,0 +1,324 @@
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __generator = (this && this.__generator) || function (thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+};
+var __spreadArrays = (this && this.__spreadArrays) || function () {
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
+ r[k] = a[j];
+ return r;
+};
+import { LogLevel } from "./ILogger";
+import { NullLogger } from "./Loggers";
+import { ResponseType } from "./wx-request/model/ResponseType";
+/**
+ * 参数处理方法
+ * @private
+ */
+var Arg = /** @class */ (function () {
+ function Arg() {
+ }
+ /**
+ * 是否存在
+ *
+ * @static
+ * @param {*} val
+ * @param {string} name
+ * @memberof Arg
+ */
+ Arg.isRequired = function (val, name) {
+ if (val === null || val === undefined) {
+ throw new Error("The '" + name + "' argument is required.");
+ }
+ };
+ /**
+ * 是否包含
+ *
+ * @static
+ * @param {*} val
+ * @param {*} values
+ * @param {string} name
+ * @memberof Arg
+ */
+ Arg.isIn = function (val, values, name) {
+ // TypeScript enums have keys for **both** the name and the value of each enum member on the type itself.
+ if (!(val in values)) {
+ throw new Error("Unknown " + name + " value: " + val + ".");
+ }
+ };
+ /**
+ * 验证url是否被微信支持
+ */
+ Arg.validationUrlIsSupportByWechat = function (url) {
+ if (!url) {
+ throw new Error("Url is undefined.");
+ }
+ else if (!/^(ws|wws):\/\//.test(url)) {
+ if (/^http/.test(url)) {
+ return url.replace(/^http/, "wx");
+ }
+ throw new Error("error: instantiation [url](" + url + ") not supported by wechat miniprogram.");
+ }
+ else {
+ return url;
+ }
+ };
+ return Arg;
+}());
+export { Arg };
+/**
+ * 获取data details
+ * @param data origin data
+ * @param includeContent 是否导出上下文?
+ */
+export function getDataDetail(data, includeContent) {
+ var detail = "";
+ if (isArrayBuffer(data)) {
+ detail = "Binary data of length " + data.byteLength;
+ if (includeContent) {
+ detail += ". Content: '" + formatArrayBuffer(data) + "'";
+ }
+ }
+ else if (typeof data === "string") {
+ detail = "String data of length " + data.length;
+ if (includeContent) {
+ detail += ". Content: '" + data + "'";
+ }
+ }
+ return detail;
+}
+/**
+ * 格式化 array buffer
+ * @private
+ */
+export function formatArrayBuffer(data) {
+ var view = new Uint8Array(data);
+ // Uint8Array.map only supports returning another Uint8Array?
+ var str = "";
+ view.forEach(function (num) {
+ var pad = num < 16 ? "0" : "";
+ str += "0x" + pad + num.toString(16) + " ";
+ });
+ // Trim of trailing space.
+ return str.substr(0, str.length - 1);
+}
+// Also in signalr-protocol-msgpack/Utils.ts
+/**
+ * 判断是不是 ArrayBuffer
+ * @private
+ */
+export function isArrayBuffer(val) {
+ return (val &&
+ typeof ArrayBuffer !== "undefined" &&
+ (val instanceof ArrayBuffer ||
+ // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof
+ (val.constructor && val.constructor.name === "ArrayBuffer")));
+}
+/**
+ * 发送消息
+ * @param logger 日志工具
+ * @param transportName
+ * @param request - 注: 原版代码为 httpClient,这里使用 wx-request.
+ * @param url
+ * @param accessTokenFactory
+ * @param content
+ * @param logMessageContent
+ */
+export function sendMessage(logger, transportName, request, url, accessTokenFactory, content, logMessageContent) {
+ return __awaiter(this, void 0, void 0, function () {
+ var headers, token, responseType, response;
+ var _a;
+ return __generator(this, function (_b) {
+ switch (_b.label) {
+ case 0:
+ if (!accessTokenFactory) return [3 /*break*/, 2];
+ return [4 /*yield*/, accessTokenFactory()];
+ case 1:
+ token = _b.sent();
+ if (token) {
+ headers = (_a = {},
+ _a["Authorization"] = "Bearer " + token,
+ _a);
+ }
+ _b.label = 2;
+ case 2:
+ logger.log(LogLevel.Trace, "(" + transportName + " transport) sending data. " + getDataDetail(content, logMessageContent) + ".");
+ responseType = isArrayBuffer(content) ? ResponseType.ARRAY_BUFFER : ResponseType.TEXT;
+ return [4 /*yield*/, request.post(url, content, {
+ headers: headers,
+ responseType: responseType
+ })];
+ case 3:
+ response = _b.sent();
+ logger.log(LogLevel.Trace, "(" + transportName + " transport) request complete. Response status: " + response.statusCode + ".");
+ return [2 /*return*/];
+ }
+ });
+ });
+}
+/**
+ * 创建一个 logger
+ * @private
+ */
+export function createLogger(logger) {
+ if (logger === undefined) {
+ return new ConsoleLogger(LogLevel.Information);
+ }
+ if (logger === null) {
+ return NullLogger.instance;
+ }
+ if (logger.log) {
+ return logger;
+ }
+ return new ConsoleLogger(logger);
+}
+/**
+ * 订阅接口实现
+ * @private
+ */
+var Subject = /** @class */ (function () {
+ function Subject(cancelCallback) {
+ this.observers = [];
+ this.cancelCallback = cancelCallback;
+ }
+ Subject.prototype.next = function (item) {
+ for (var _i = 0, _a = this.observers; _i < _a.length; _i++) {
+ var observer = _a[_i];
+ observer.next(item);
+ }
+ };
+ Subject.prototype.error = function (err) {
+ for (var _i = 0, _a = this.observers; _i < _a.length; _i++) {
+ var observer = _a[_i];
+ if (observer.error) {
+ observer.error(err);
+ }
+ }
+ };
+ Subject.prototype.complete = function () {
+ for (var _i = 0, _a = this.observers; _i < _a.length; _i++) {
+ var observer = _a[_i];
+ if (observer.complete) {
+ observer.complete();
+ }
+ }
+ };
+ Subject.prototype.subscribe = function (observer) {
+ this.observers.push(observer);
+ return new SubjectSubscription(this, observer);
+ };
+ return Subject;
+}());
+export { Subject };
+/**
+ * 主题订阅??
+ * 应该时定制 断开流 的 实现吧.
+ * @private
+ */
+var SubjectSubscription = /** @class */ (function () {
+ function SubjectSubscription(subject, observer) {
+ this.subject = subject;
+ this.observer = observer;
+ }
+ SubjectSubscription.prototype.dispose = function () {
+ var index = this.subject.observers.indexOf(this.observer);
+ if (index > -1) {
+ this.subject.observers.splice(index, 1);
+ }
+ if (this.subject.observers.length === 0) {
+ this.subject.cancelCallback().catch(function (_) { });
+ }
+ };
+ return SubjectSubscription;
+}());
+export { SubjectSubscription };
+/**
+ * console logger 内置实现
+ * @private
+ */
+var ConsoleLogger = /** @class */ (function () {
+ /**
+ * 构造方法 定义 最小输出日志等级
+ * @param {LogLevel} minimumLogLevel
+ * @memberof ConsoleLogger
+ */
+ function ConsoleLogger(minimumLogLevel) {
+ this.minimumLogLevel = minimumLogLevel;
+ }
+ /**
+ * 日志输出
+ *
+ * @param {LogLevel} logLevel
+ * @param {string} message
+ * @memberof ConsoleLogger
+ */
+ ConsoleLogger.prototype.log = function () {
+ var msg = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ msg[_i] = arguments[_i];
+ }
+ var logLevel = LogLevel.Information;
+ for (var _a = 0, _b = arguments; _a < _b.length; _a++) {
+ var ll = _b[_a];
+ if (Object.values(LogLevel).indexOf(ll) != -1) {
+ logLevel = ll;
+ break;
+ }
+ }
+ if (logLevel >= this.minimumLogLevel) {
+ switch (logLevel) {
+ case LogLevel.Critical:
+ case LogLevel.Error:
+ console.error.apply(console, __spreadArrays(["[" + new Date().toISOString() + "] " + LogLevel[logLevel] + " =>"], msg.slice(1, msg.length)));
+ break;
+ case LogLevel.Warning:
+ console.warn.apply(console, __spreadArrays(["[" + new Date().toISOString() + "] " + LogLevel[logLevel] + " =>"], msg));
+ break;
+ case LogLevel.Information:
+ console.info.apply(console, __spreadArrays(["[" + new Date().toISOString() + "] " + LogLevel[logLevel] + " =>"], msg));
+ break;
+ default:
+ // console.debug only goes to attached debuggers in Node, so we use console.log for Trace and Debug
+ console.log.apply(console, __spreadArrays(["[" + new Date().toISOString() + "] " + LogLevel[logLevel] + " =>"], msg));
+ break;
+ }
+ }
+ };
+ return ConsoleLogger;
+}());
+export { ConsoleLogger };
diff --git a/miniprogram_npm/signalr-for-wx/WechatVersionDiff.js b/miniprogram_npm/signalr-for-wx/WechatVersionDiff.js
new file mode 100644
index 0000000..5cec6f8
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/WechatVersionDiff.js
@@ -0,0 +1,33 @@
+/**
+ * 小程序版本支持
+ * @param minimumVersion 最小支持版本号
+ */
+export var isVersionSupport = function (minimumVersion) {
+ // diff
+ var compareVersion = function (v1, v2) {
+ v1 = v1.split(".");
+ v2 = v2.split(".");
+ var len = Math.max(v1.length, v2.length);
+ while (v1.length < len) {
+ v1.push("0");
+ }
+ while (v2.length < len) {
+ v2.push("0");
+ }
+ for (var i = 0; i < len; i++) {
+ var num1 = parseInt(v1[i]);
+ var num2 = parseInt(v2[i]);
+ if (num1 > num2) {
+ return 1;
+ }
+ else if (num1 < num2) {
+ return -1;
+ }
+ }
+ return 0;
+ };
+ // 获取当前小程序 版本号
+ var SDKVersion = wx.getSystemInfoSync().SDKVersion;
+ // check
+ return compareVersion(SDKVersion, minimumVersion) >= 0;
+};
diff --git a/miniprogram_npm/signalr-for-wx/WxSocketTransport.js b/miniprogram_npm/signalr-for-wx/WxSocketTransport.js
new file mode 100644
index 0000000..908c636
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/WxSocketTransport.js
@@ -0,0 +1,300 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+var __assign = (this && this.__assign) || function () {
+ __assign = Object.assign || function(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
+ t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+};
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __generator = (this && this.__generator) || function (thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+};
+import { LogLevel } from "./ILogger";
+import { Arg, getDataDetail } from "./Utils";
+import { WxSocketReadyState } from "./Polyfills";
+import { isVersionSupport } from "./WechatVersionDiff";
+/**
+ * 微信 sosocket 数据传输
+ * @description 整体重写了这部分websocket支持,逻辑这样看起来合理一些
+ */
+var WxSocketTransport = /** @class */ (function () {
+ function WxSocketTransport(options) {
+ this.readyState = WxSocketReadyState.CONNECTING;
+ this.logger = options.logger;
+ this.accessTokenFactory = options.accessTokenFactory;
+ this.socketUrlFactory = options.socketUrlFactory;
+ this.logMessageContent = options.logMessageContent;
+ this.onreceive = null;
+ this.onclose = null;
+ this.allowReplaceSocket = options.allowReplaceSocket;
+ this.timeout = options.timeout ? options.timeout : 60 * 1000;
+ this.delayTime = options.delayTime ? options.delayTime : 100;
+ if (options.enableMessageQueue) {
+ this.enableMessageQueue = true;
+ this.messageQueue = [];
+ }
+ else {
+ this.enableMessageQueue = false;
+ }
+ if (options.reconnect) {
+ this.reconnect = {
+ enable: options.reconnect.enable == true ? true : false,
+ max: options.reconnect.max ? options.reconnect.max : 3,
+ val: 0
+ };
+ }
+ else {
+ this.reconnect = {
+ enable: false,
+ max: 3,
+ val: 0
+ };
+ }
+ }
+ WxSocketTransport.prototype.connect = function (options) {
+ return __awaiter(this, void 0, void 0, function () {
+ var replacedUrl, token;
+ var _this = this;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ // vali is exists
+ Arg.isRequired(options, "options");
+ // vali url is support by wechat
+ Arg.validationUrlIsSupportByWechat(options.url);
+ this.connectOptions = options; // 连接参数缓存
+ this.logger.log(LogLevel.Trace, "(WebSockets transport) Connecting.");
+ if (!this.socketUrlFactory) return [3 /*break*/, 2];
+ return [4 /*yield*/, this.socketUrlFactory(options.url)];
+ case 1:
+ replacedUrl = _a.sent();
+ if (replacedUrl) {
+ options.url = replacedUrl;
+ }
+ return [3 /*break*/, 4];
+ case 2:
+ if (!this.accessTokenFactory) return [3 /*break*/, 4];
+ return [4 /*yield*/, this.accessTokenFactory()];
+ case 3:
+ token = _a.sent();
+ this.logger.log(LogLevel.Debug, "getted token:", token);
+ if (token) {
+ options.url += (options.url.indexOf("?") < 0 ? "?" : "&") + ("access_token=" + encodeURIComponent(token));
+ }
+ _a.label = 4;
+ case 4: return [2 /*return*/, new Promise(function (resolve, reject) {
+ // 忽略url修正,因为传入错误url的话,将直接抛出异常
+ options.url = options.url.replace(/^http/, "ws");
+ // 这里执行的是连接操socket的逻辑
+ var socketTask;
+ // 1.7.0 及以上版本,最多可以同时存在 5 个 WebSocket 连接, 以下版本,一个小程序同时只能有一个 WebSocket 连接,如果当前已存在一个 WebSocket 连接,会自动关闭该连接,并重新创建一个 WebSocket 连接
+ var supportCount = isVersionSupport("1.7.0") ? 5 : 1;
+ if (supportCount <= WxSocketTransport.count && !_this.allowReplaceSocket) {
+ // 抛出异常, 并return
+ reject({
+ errMsg: "Maximum connections|" + WxSocketTransport.count
+ });
+ return;
+ }
+ else if (WxSocketTransport.count == 5) {
+ // 抛出异常, 并return
+ reject({
+ errMsg: "Maximum connections|" + WxSocketTransport.count
+ });
+ return;
+ }
+ if (!socketTask) {
+ socketTask = wx.connectSocket(__assign({
+ // 传入 两个默认的 回调,当然也可以在 options 里面覆盖 使用自定义回调.
+ success: function (res) {
+ _this.logger.log(LogLevel.Debug, "wx.connectSocket():success");
+ }, fail: function (res) {
+ _this.logger.log(LogLevel.Debug, "wx.connectSocket():fail");
+ reject(res);
+ } }, options));
+ }
+ // ! 因为小程序两种协议都支持,所以不需要指定特定的 binaryType
+ /** 连接成功处理 */
+ socketTask.onOpen(function (result) { return __awaiter(_this, void 0, void 0, function () {
+ var _i, _a, msg;
+ return __generator(this, function (_b) {
+ switch (_b.label) {
+ case 0:
+ this.logger.log(LogLevel.Information, "websocket\u8FDE\u63A5\u5EFA\u7ACB " + (this.logMessageContent ? "wx api:[" + options.url + "]" : ""));
+ this.logger.log(LogLevel.Debug, "wx.connectSocket success message:", result);
+ WxSocketTransport.count += 1;
+ this.readyState = WxSocketReadyState.OPEN;
+ this.socketTask = socketTask;
+ // 等待回调执行完成后,再重新队列中消息
+ return [4 /*yield*/, resolve()];
+ case 1:
+ // 等待回调执行完成后,再重新队列中消息
+ _b.sent();
+ if (!(this.enableMessageQueue && this.messageQueue.length > 0)) return [3 /*break*/, 5];
+ _i = 0, _a = this.messageQueue;
+ _b.label = 2;
+ case 2:
+ if (!(_i < _a.length)) return [3 /*break*/, 5];
+ msg = _a[_i];
+ this.logger.log(LogLevel.Debug, "\u63A8\u9001\u79BB\u7EBF\u6D88\u606F", this.logMessageContent ? msg : "");
+ return [4 /*yield*/, this.send(msg)];
+ case 3:
+ _b.sent();
+ _b.label = 4;
+ case 4:
+ _i++;
+ return [3 /*break*/, 2];
+ case 5: return [2 /*return*/];
+ }
+ });
+ }); });
+ /** 建立连接出错处理 */
+ socketTask.onError(function (res) {
+ _this.readyState = WxSocketReadyState.CLOSED;
+ reject(res);
+ });
+ /** 接收到消息处理 */
+ socketTask.onMessage(function (res) {
+ _this.logger.log(LogLevel.Trace, "(WebSockets transport) data received.", getDataDetail(res.data, _this.logMessageContent));
+ if (_this.onreceive) {
+ _this.onreceive(res.data);
+ }
+ });
+ socketTask.onClose(function (res) { return _this.close(res); });
+ })];
+ }
+ });
+ });
+ };
+ /** 休眠 */
+ WxSocketTransport.prototype.delay = function () {
+ var _this = this;
+ return new Promise(function (resolve) {
+ // ! 由于小程序机制,所以需要手工清理timer
+ var timer = setTimeout(function () {
+ clearTimeout(timer);
+ resolve();
+ }, _this.delayTime);
+ });
+ };
+ /** 发送 */
+ WxSocketTransport.prototype.send = function (data) {
+ return __awaiter(this, void 0, void 0, function () {
+ var loop;
+ var _this = this;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if (!(this.socketTask && this.readyState === WxSocketReadyState.OPEN)) return [3 /*break*/, 1];
+ this.logger.log(LogLevel.Trace, "[WxSocket] \u63A8\u9001\u6570\u636E.", getDataDetail(data, this.logMessageContent));
+ return [2 /*return*/, new Promise(function (resolve, reject) {
+ _this.socketTask.send({
+ data: data,
+ success: function () { return resolve(); },
+ fail: function () { return reject(); }
+ });
+ })];
+ case 1:
+ if (!this.enableMessageQueue) return [3 /*break*/, 5];
+ this.messageQueue.push(data);
+ loop = 0;
+ _a.label = 2;
+ case 2:
+ if (!(this.socketTask && this.readyState !== WxSocketReadyState.OPEN)) return [3 /*break*/, 4];
+ return [4 /*yield*/, this.delay()];
+ case 3:
+ _a.sent();
+ loop += this.delayTime;
+ if (loop >= this.timeout) {
+ // 超时设置
+ return [2 /*return*/, Promise.reject({
+ errMsg: "WebSocket connect timeout."
+ })];
+ }
+ return [3 /*break*/, 2];
+ case 4:
+ // 回调
+ return [2 /*return*/, this.send(data)];
+ case 5: return [2 /*return*/, Promise.reject({
+ errMsg: "WebSocket is not in the OPEN state"
+ })];
+ }
+ });
+ });
+ };
+ /** 停止 */
+ WxSocketTransport.prototype.stop = function (msg) {
+ var _this = this;
+ return new Promise(function (resolve, reject) {
+ if (_this.socketTask) {
+ _this.socketTask.close({
+ code: 1000,
+ reason: "stop socket",
+ success: function (res) { return resolve(msg || res); },
+ fail: function (res) { return reject(res); }
+ });
+ }
+ });
+ };
+ /**
+ * 连接断开处理
+ * @param res
+ */
+ WxSocketTransport.prototype.close = function (res) {
+ // webSocket will be null if the transport did not start successfully
+ this.logger.log(LogLevel.Trace, "(WebSockets transport) socket closed.");
+ WxSocketTransport.count = WxSocketTransport.count > 0 ? WxSocketTransport.count - 1 : 0;
+ if (this.onclose) {
+ if (res && res.code !== 1000) {
+ this.onclose(new Error("WebSocket closed with status code: " + res.code + " (" + res.reason + ")."));
+ }
+ else {
+ this.onclose();
+ }
+ }
+ };
+ /**
+ * 静态变量 - 表示当前是否有正在连接中的socket
+ */
+ WxSocketTransport.count = 0;
+ return WxSocketTransport;
+}());
+export { WxSocketTransport };
diff --git a/miniprogram_npm/signalr-for-wx/index.js b/miniprogram_npm/signalr-for-wx/index.js
new file mode 100644
index 0000000..39f0d5e
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/index.js
@@ -0,0 +1,24 @@
+// 版权所有(c).NET基金会。保留所有权利。
+// 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
+// 版本号模板 - builder 自动更新,无需手动
+/** The version of the SignalR client. */
+export var VERSION = "1.1.6";
+// 协议|类型参数 导出
+export { MessageType } from "./IHubProtocol";
+// json格式传输协议
+export { JsonHubProtocol } from "./JsonHubProtocol";
+export { HubConnectionBuilder } from "./HubConnectionBuilder";
+export { HubConnection, HubConnectionState } from "./HubConnection";
+// 微信最低版本支持检查
+export { isVersionSupport } from "./WechatVersionDiff";
+// 微信socket传输实现
+export { WxSocketTransport } from "./WxSocketTransport";
+// 微信 request 请求实现(封装 wx.request)
+export { Request } from "./wx-request/index";
+export { RequestMethod, ResponseType } from "./wx-request/model";
+// Error 接口
+export { AbortError, HttpError, TimeoutError } from "./Errors";
+// logger 接口
+export { LogLevel } from "./ILogger";
+// Transport 接口
+export { HttpTransportType, TransferFormat } from "./ITransport";
diff --git a/miniprogram_npm/signalr-for-wx/wx-request/index.js b/miniprogram_npm/signalr-for-wx/wx-request/index.js
new file mode 100644
index 0000000..a7cda3a
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/wx-request/index.js
@@ -0,0 +1,477 @@
+var __assign = (this && this.__assign) || function () {
+ __assign = Object.assign || function(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
+ t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+};
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __generator = (this && this.__generator) || function (thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+};
+import { RequestMethod } from "./model/RequestMethod";
+import { ResponseType } from "./model/ResponseType";
+import { LogLevel } from "../ILogger";
+import { TimeoutError, HttpError } from "../Errors";
+import { NullLogger } from "../Loggers";
+/**
+ * 封装微信ajax请求工具
+ * @author halo
+ */
+var Request = /** @class */ (function () {
+ /**
+ * Creates an instance of Request.
+ * 实例化配置
+ * @param {*} [config]
+ * @memberof Request
+ */
+ function Request(config, logger) {
+ if (config === void 0) { config = {}; }
+ // 写入配置
+ if (wx) {
+ // Time: 继承 signalR logger. 日志统一维护
+ this.logger = logger ? logger : new NullLogger();
+ }
+ else {
+ throw new Error("当前运行环境不是微信运行环境");
+ }
+ // custom wx request promise library.
+ this.setConfig(config);
+ }
+ /**
+ * merge config
+ * @param config
+ */
+ Request.prototype.setConfig = function (config) {
+ if (config === void 0) { config = {}; }
+ // 合并默认配置和
+ this.config = __assign({ baseUrl: "http://", headers: { "Content-Type": "application/json" }, forceEnableHttps: false, method: RequestMethod.GET, responseType: ResponseType.JSON, responseEncoding: "utf8", timeout: 60 * 1000, transformRequest: [], transformResponse: [] }, config);
+ // 请求头默认附加response 解析器
+ if (!this.config.transformResponse) {
+ this.config.transformResponse = [];
+ }
+ this.logger.log(LogLevel.Information, "set config success.");
+ };
+ /**
+ * 请求参数序列化
+ *
+ * @param {RequestOptions} options
+ * @memberof Request
+ *
+ * @description 只支持普通get请求,和content-type = json 的 其他请求(post,put,delete,patch)
+ */
+ Request.prototype.handleRequestOptions = function (options) {
+ return __awaiter(this, void 0, void 0, function () {
+ var _i, _a, fun, e_1;
+ return __generator(this, function (_b) {
+ switch (_b.label) {
+ case 0:
+ // 请求地址处理,对于非:// 请求,附加baseUrl
+ if (options.url && !/:\/\/.+?/.test(options.url)) {
+ options.url = ((options.config ? options.config.baseUrl : "") + "/" + options.url).replace(/([^:])(\/\/)/g, "$1/");
+ }
+ this.logger.log(LogLevel.Trace, "checked request url");
+ // https 处理
+ if (options.config && options.config.forceEnableHttps) {
+ options.url = options.url.replace(/http:/, "https:");
+ this.logger.log(LogLevel.Trace, "execute fix [request.config.forceEnableHttps] " + options.url);
+ }
+ // header 合并
+ options.headers = Object.assign({}, options.config ? options.config.headers : {}, options.headers);
+ this.logger.log(LogLevel.Trace, "merge headers ", options.headers);
+ // 移除微信封锁参数
+ delete options.headers["Referer"];
+ this.logger.log(LogLevel.Trace, "try delete headers Referer.");
+ // 替换请求内的ResponseType
+ options.responseType = options.responseType
+ ? options.responseType
+ : options.config
+ ? options.config.responseType
+ : ResponseType.TEXT;
+ this.logger.log(LogLevel.Trace, "checked responseType [" + options.responseType + "]");
+ if (!(options.config && options.config.transformRequest)) return [3 /*break*/, 6];
+ this.logger.log(LogLevel.Trace, "execute transform request list. -result\n", options.config);
+ _i = 0, _a = options.config.transformRequest;
+ _b.label = 1;
+ case 1:
+ if (!(_i < _a.length)) return [3 /*break*/, 6];
+ fun = _a[_i];
+ _b.label = 2;
+ case 2:
+ _b.trys.push([2, 4, , 5]);
+ return [4 /*yield*/, fun(options)];
+ case 3:
+ _b.sent();
+ return [3 /*break*/, 5];
+ case 4:
+ e_1 = _b.sent();
+ throw e_1;
+ case 5:
+ _i++;
+ return [3 /*break*/, 1];
+ case 6:
+ // debug print handled request options
+ this.logger.log(LogLevel.Debug, "handled request options \n", options);
+ return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * 验证响应结果,执行回调
+ *
+ * @param {*} resolve
+ * @param {*} reject
+ * @param {*} response
+ * @memberof Request
+ */
+ Request.prototype.handleResponse = function (response) {
+ return __awaiter(this, void 0, void 0, function () {
+ var _i, _a, fun, res_1;
+ return __generator(this, function (_b) {
+ switch (_b.label) {
+ case 0:
+ if (!(response.options.config &&
+ response.options.config.responseType == "json" &&
+ response.options.config.transformResponse)) return [3 /*break*/, 6];
+ _i = 0, _a = response.options.config.transformResponse;
+ _b.label = 1;
+ case 1:
+ if (!(_i < _a.length)) return [3 /*break*/, 6];
+ fun = _a[_i];
+ _b.label = 2;
+ case 2:
+ _b.trys.push([2, 4, , 5]);
+ // handler response
+ return [4 /*yield*/, fun(response)];
+ case 3:
+ // handler response
+ _b.sent();
+ return [3 /*break*/, 5];
+ case 4:
+ res_1 = _b.sent();
+ this.logger.log(LogLevel.Trace, "execute transform request list. -result \n ", res_1);
+ throw res_1;
+ case 5:
+ _i++;
+ return [3 /*break*/, 1];
+ case 6:
+ // debug print handled response context
+ this.logger.log(LogLevel.Debug, "handled response context \n", response);
+ return [2 /*return*/, Promise.resolve(response)];
+ }
+ });
+ });
+ };
+ /**
+ * 执行请求
+ *
+ * @param {RequestOptions} [options={
+ * url: this.config.baseUrl
+ * }]
+ * @returns {Promise}
+ * @memberof Request
+ */
+ Request.prototype.executeRequest = function (options) {
+ var _this = this;
+ return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
+ var error_1, task;
+ var _this = this;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ this.logger.log(LogLevel.Trace, "execute request -options \n", options);
+ // 合并 baseConfig
+ options.config = options.config ? __assign(__assign({}, this.config), options.config) : __assign({}, this.config);
+ if (this.checkAbout(options.config, reject))
+ return [2 /*return*/];
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ // 序列化请求参数
+ return [4 /*yield*/, this.handleRequestOptions(options)];
+ case 2:
+ // 序列化请求参数
+ _a.sent();
+ return [3 /*break*/, 4];
+ case 3:
+ error_1 = _a.sent();
+ // 抛出异常.
+ return [2 /*return*/, reject(__assign({ data: null, header: null, statusCode: -1, options: options }, error_1))];
+ case 4:
+ if (this.checkAbout(options.config, reject))
+ return [2 /*return*/];
+ // print fixed options
+ this.logger.log(LogLevel.Debug, "fixed options \n", options);
+ // execute request
+ this.logger.log(LogLevel.Trace, "invoke wx.request");
+ task = wx.request({
+ url: options.url,
+ data: options.data,
+ dataType: options.responseType,
+ header: options.headers,
+ method: options.method,
+ responseType: (function () {
+ switch (options.responseType) {
+ case "json":
+ case "text":
+ return "text";
+ case "arraybuffer":
+ return "arraybuffer";
+ }
+ })(),
+ success: function (res) { return __awaiter(_this, void 0, void 0, function () {
+ var data, header, statusCode, errMsg, responseOptions;
+ var _this = this;
+ return __generator(this, function (_a) {
+ if (this.checkAbout(options.config, reject))
+ return [2 /*return*/];
+ this.logger.log(LogLevel.Debug, "origin response context \n", res);
+ data = res.data, header = res.header, statusCode = res.statusCode, errMsg = res.errMsg;
+ responseOptions = {
+ data: data,
+ header: header,
+ statusCode: statusCode,
+ options: options,
+ errMsg: errMsg
+ };
+ // 调用响应处理链(并返回结果)
+ this.handleResponse(responseOptions)
+ .then(function (res) {
+ // print debug
+ _this.logger.log(LogLevel.Debug, "handle response context is success. \n", res);
+ /**
+ * check and cache cookie (if has) |
+ * @description 这里因为 signalR的原因,内置了一个 cookies.js [library](https://github.com/jshttp/cookie/index.js)
+ * 略有改写,暂时将cookie 扔到内存中维护(毕竟就signalr使用,不考虑扔到 localStore 中占地方).
+ */
+ if (options.config.cookie)
+ options.config.cookie.set(options.url, header);
+ // callback
+ resolve(res);
+ })
+ .catch(function (res) {
+ // print log
+ _this.logger.log(LogLevel.Error, "handle response context is fail. \n ", res);
+ // ! 这里为了兼容 signalR的错误格式,抛出继承了HttpError异常.
+ var httpError = new HttpError(res.errMsg, res.statusCode);
+ // callback - 合并后,返回,可以被认定为 继承 HttpError对象.
+ reject(__assign(__assign({}, res), httpError));
+ });
+ return [2 /*return*/];
+ });
+ }); },
+ fail: function (res) {
+ var responseOptions = null;
+ if (res && /request:fail socket time out timeout/.test(res.errMsg)) {
+ // ! 这里为了兼容 signalR的错误格式,抛出继承了TimeoutError异常.
+ responseOptions = __assign({ data: null, status: -1, errMsg: res.errMsg }, new TimeoutError(res.errMsg));
+ }
+ else {
+ // ! 这里为了兼容 signalR的错误格式,抛出继承了HttpError异常.
+ responseOptions = __assign({ data: null, status: -1, errMsg: res.errMsg }, new HttpError(res.errMsg, 500));
+ }
+ /**
+ * @date 2019年12月11日 13:14:25
+ * ! 修复bug,wx.request fail 情况下, 未调用 response 处理链.
+ */
+ // 调用响应处理链(并返回结果)
+ _this.handleResponse(responseOptions)
+ .then(function (res) {
+ // print debug
+ _this.logger.log(LogLevel.Debug, "handle response context is success. \n", res);
+ /**
+ * check and cache cookie (if has) |
+ * @description 这里因为 signalR的原因,内置了一个 cookies.js [library](https://github.com/jshttp/cookie/index.js)
+ * 略有改写,暂时将cookie 扔到内存中维护(毕竟就signalr使用,不考虑扔到 localStore 中占地方).
+ */
+ if (options.config.cookie)
+ options.config.cookie.set(options.url, {});
+ // callback
+ resolve(res);
+ })
+ .catch(function (res) {
+ // print log
+ _this.logger.log(LogLevel.Error, "handle response context is fail. \n ", res);
+ // ! 这里为了兼容 signalR的错误格式,抛出继承了HttpError异常.
+ var httpError = new HttpError(res.errMsg, res.statusCode);
+ // callback - 合并后,返回,可以被认定为 继承 HttpError对象.
+ reject(__assign(__assign({}, res), httpError));
+ });
+ }
+ });
+ // 监听 headers 变化
+ task.onHeadersReceived(function () {
+ // 当检查到 about() 状态,中断请求
+ if (_this.checkAbout(options.config, reject)) {
+ // 中断请求
+ task.abort();
+ return;
+ }
+ });
+ return [2 /*return*/];
+ }
+ });
+ }); });
+ };
+ /**
+ * 检查中断
+ *
+ * @memberof Request
+ */
+ Request.prototype.checkAbout = function (options, reject) {
+ if (options.config && options.config.about) {
+ reject({
+ data: null,
+ header: options.headers,
+ statusCode: 412,
+ options: options,
+ errMsg: "网络异常" // 直接自定义错误了.
+ });
+ return true;
+ }
+ else {
+ return false;
+ }
+ };
+ /**
+ * GET 请求
+ * @description 封装调用
+ * @param url 请求地址
+ * @param data 请求参数
+ * @param options 请求配置
+ */
+ Request.prototype.get = function (url, data, options) {
+ if (data === void 0) { data = {}; }
+ // print execute step
+ this.logger.log(LogLevel.Trace, "invoke request.get()");
+ // merge config
+ var requestOptions = __assign(__assign({}, (function () { return (options ? options : {}); })()), { method: RequestMethod.GET, url: url,
+ data: data });
+ // execute and response
+ return this.executeRequest(requestOptions);
+ };
+ /**
+ * POST 请求
+ * @description 封装调用
+ * @param url 请求地址
+ * @param data 请求参数
+ * @param options 请求配置
+ */
+ Request.prototype.post = function (url, data, options) {
+ if (data === void 0) { data = {}; }
+ // print execute step
+ this.logger.log(LogLevel.Trace, "invoke request.post()");
+ // merge config
+ var requestOptions = __assign(__assign({}, (function () { return (options ? options : {}); })()), { method: RequestMethod.POST, url: url,
+ data: data });
+ // execute and response
+ return this.executeRequest(requestOptions);
+ };
+ /**
+ * PUT 请求
+ * @description 封装调用
+ * @param url 请求地址
+ * @param data 请求参数
+ * @param options 请求配置
+ */
+ Request.prototype.put = function (url, data, options) {
+ if (data === void 0) { data = {}; }
+ // print execute step
+ this.logger.log(LogLevel.Trace, "invoke request.put()");
+ // merge config
+ var requestOptions = __assign(__assign({}, (function () { return (options ? options : {}); })()), { method: RequestMethod.PUT, url: url,
+ data: data });
+ // execute and response
+ return this.executeRequest(requestOptions);
+ };
+ /**
+ * DELETE 请求
+ * @description 封装调用
+ * @param url 请求地址
+ * @param data 请求参数
+ * @param options 请求配置
+ */
+ Request.prototype.delete = function (url, data, options) {
+ if (data === void 0) { data = {}; }
+ // print execute step
+ this.logger.log(LogLevel.Trace, "invoke request.delete()");
+ // merge config
+ var requestOptions = __assign(__assign({}, (function () { return (options ? options : {}); })()), { method: RequestMethod.DELETE, url: url,
+ data: data });
+ // execute and response
+ return this.executeRequest(requestOptions);
+ };
+ /**
+ * 多请求同步执行
+ * @param taskQueue
+ */
+ Request.prototype.all = function (taskQueue) {
+ // print execute step
+ this.logger.log(LogLevel.Trace, "invoke request.all()");
+ // merge config
+ return Promise.all(taskQueue);
+ };
+ /**
+ * 用于兼容 @aspnet/signalR 的 获取 cookie 方法
+ *
+ * @description 这里用内存对象来维护一个 在线 cookies
+ * @param {string} url
+ * @returns
+ * @memberof Request
+ */
+ Request.prototype.getCookieString = function (url) {
+ if (this.config && this.config.cookie) {
+ return this.config.cookie.origin(url);
+ }
+ else {
+ return "";
+ }
+ };
+ Request.prototype.cookie = function (url, key) {
+ if (this.config && this.config.cookie) {
+ return this.config.cookie.get(url, key);
+ }
+ else {
+ return "";
+ }
+ };
+ return Request;
+}());
+export { Request };
diff --git a/miniprogram_npm/signalr-for-wx/wx-request/model.js b/miniprogram_npm/signalr-for-wx/wx-request/model.js
new file mode 100644
index 0000000..88ca256
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/wx-request/model.js
@@ -0,0 +1,2 @@
+export { RequestMethod } from "./model/RequestMethod";
+export { ResponseType } from "./model/ResponseType";
diff --git a/demos/radio/group/group.wxss b/miniprogram_npm/signalr-for-wx/wx-request/model/RequestConfig.js
similarity index 100%
rename from demos/radio/group/group.wxss
rename to miniprogram_npm/signalr-for-wx/wx-request/model/RequestConfig.js
diff --git a/miniprogram_npm/signalr-for-wx/wx-request/model/RequestMethod.js b/miniprogram_npm/signalr-for-wx/wx-request/model/RequestMethod.js
new file mode 100644
index 0000000..9f89dfe
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/wx-request/model/RequestMethod.js
@@ -0,0 +1,10 @@
+/**
+ * 请求类型
+ */
+export var RequestMethod;
+(function (RequestMethod) {
+ RequestMethod["GET"] = "GET";
+ RequestMethod["POST"] = "POST";
+ RequestMethod["PUT"] = "PUT";
+ RequestMethod["DELETE"] = "DELETE";
+})(RequestMethod || (RequestMethod = {}));
diff --git a/pages/action-sheet/align/index.wxss b/miniprogram_npm/signalr-for-wx/wx-request/model/RequestOption.js
similarity index 100%
rename from pages/action-sheet/align/index.wxss
rename to miniprogram_npm/signalr-for-wx/wx-request/model/RequestOption.js
diff --git a/pages/action-sheet/grid/index.wxss b/miniprogram_npm/signalr-for-wx/wx-request/model/ResponseOptions.js
similarity index 100%
rename from pages/action-sheet/grid/index.wxss
rename to miniprogram_npm/signalr-for-wx/wx-request/model/ResponseOptions.js
diff --git a/miniprogram_npm/signalr-for-wx/wx-request/model/ResponseType.js b/miniprogram_npm/signalr-for-wx/wx-request/model/ResponseType.js
new file mode 100644
index 0000000..4d0b601
--- /dev/null
+++ b/miniprogram_npm/signalr-for-wx/wx-request/model/ResponseType.js
@@ -0,0 +1,20 @@
+/**
+ * 响应数据类型
+ *
+ * @interface ResponseType
+ */
+export var ResponseType;
+(function (ResponseType) {
+ /**
+ * JSON 类型
+ */
+ ResponseType["JSON"] = "json";
+ /**
+ * 文本类型(跳过返回数据处理链,直接返回)
+ */
+ ResponseType["TEXT"] = "text";
+ /**
+ * 二进制数据
+ */
+ ResponseType["ARRAY_BUFFER"] = "arraybuffer";
+})(ResponseType || (ResponseType = {}));
diff --git a/miniprogram_npm/tdesign-miniprogram/.wechatide.ib.json b/miniprogram_npm/tdesign-miniprogram/.wechatide.ib.json
new file mode 100644
index 0000000..461d4e1
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/.wechatide.ib.json
@@ -0,0 +1,3895 @@
+{
+ "key": "TDesign",
+ "label": "Tdesign",
+ "components": {
+ "t-action-sheet": {
+ "key": "t-action-sheet",
+ "label": "动作面板",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-actionsheet.png",
+ "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": "bind:cancel",
+ "desc": "点击取消按钮时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:close",
+ "desc": "关闭时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:selected",
+ "desc": "选择菜单项时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./action-sheet/action-sheet"
+ },
+ "t-avatar-group": {
+ "key": "t-avatar-group",
+ "label": "头像组",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-avatar.png",
+ "properties": [
+ {
+ "key": "cascading",
+ "type": ["String"],
+ "desc": "图片之间的层叠关系,可选值:左侧图片在上和右侧图片在上",
+ "label": ""
+ },
+ {
+ "key": "collapseAvatar",
+ "type": ["String"],
+ "desc": "头像数量超出时,会出现一个头像折叠元素。该元素内容可自定义。默认为 `+N`。示例:`+5`,`...`, `更多`",
+ "label": ""
+ },
+ {
+ "key": "max",
+ "type": ["Number"],
+ "desc": "能够同时显示的最多头像数量",
+ "label": ""
+ },
+ {
+ "key": "size",
+ "type": ["String"],
+ "desc": "尺寸,示例值:small/medium/large/24px/38px 等。优先级低于 Avatar.size",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-image", "t-class-content"],
+ "tpl": "",
+ "require": {
+ "t-avatar": "./avatar/avatar"
+ },
+ "path": "./avatar/avatar-group"
+ },
+ "t-avatar": {
+ "key": "t-avatar",
+ "label": "头像",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-avatar.png",
+ "properties": [
+ {
+ "key": "alt",
+ "type": ["String"],
+ "desc": "头像替换文本,仅当图片加载失败时有效",
+ "label": ""
+ },
+ {
+ "key": "badgeProps",
+ "type": ["Object"],
+ "desc": "头像右上角提示信息,继承 Badge 组件的全部特性。如:小红点,或者数字",
+ "label": ""
+ },
+ {
+ "key": "hideOnLoadFailed",
+ "type": ["Boolean"],
+ "desc": "加载失败时隐藏图片",
+ "label": ""
+ },
+ {
+ "key": "icon",
+ "type": ["String"],
+ "desc": "图标",
+ "label": ""
+ },
+ {
+ "key": "image",
+ "type": ["String"],
+ "desc": "图片地址",
+ "label": ""
+ },
+ {
+ "key": "shape",
+ "type": ["String"],
+ "desc": "形状",
+ "label": ""
+ },
+ {
+ "key": "size",
+ "type": ["String"],
+ "desc": "尺寸,示例值:small/medium/large/24px/38px 等,默认为 large",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class"],
+ "events": [
+ {
+ "key": "bind:error",
+ "desc": "图片加载失败时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./avatar/avatar"
+ },
+ "t-back-top": {
+ "key": "t-back-top",
+ "label": "回到顶部",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-backtop.png",
+ "properties": [
+ {
+ "key": "fixed",
+ "type": ["Boolean"],
+ "desc": "是否绝对定位固定到屏幕右下方",
+ "label": ""
+ },
+ {
+ "key": "icon",
+ "type": ["String"],
+ "desc": "图标",
+ "label": ""
+ },
+ {
+ "key": "text",
+ "type": ["String"],
+ "desc": "文案",
+ "label": ""
+ },
+ {
+ "key": "theme",
+ "type": ["String"],
+ "desc": "预设的样式类型",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-icon", "t-class-text"],
+ "events": [
+ {
+ "key": "bind:to-top",
+ "desc": "点击触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./back-top/back-top"
+ },
+ "t-badge": {
+ "key": "t-badge",
+ "label": "徽标数",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-badge.png",
+ "properties": [
+ {
+ "key": "color",
+ "type": ["String"],
+ "desc": "颜色",
+ "label": ""
+ },
+ {
+ "key": "content",
+ "type": ["String"],
+ "desc": "徽标内容,示例:`content='自定义内容'`。也可以使用默认插槽定义",
+ "label": ""
+ },
+ {
+ "key": "count",
+ "type": ["String", "Number"],
+ "desc": "徽标右上角内容。可以是数字,也可以是文字。如:'new'/3/99+。特殊:值为空表示使用插槽渲染",
+ "label": ""
+ },
+ {
+ "key": "dot",
+ "type": ["Boolean"],
+ "desc": "是否为红点",
+ "label": ""
+ },
+ {
+ "key": "maxCount",
+ "type": ["Number"],
+ "desc": "封顶的数字值",
+ "label": ""
+ },
+ {
+ "key": "offset",
+ "type": ["Array"],
+ "desc": "设置状态点的位置偏移,示例:[-10, 20] 或 ['10em', '8rem']",
+ "label": ""
+ },
+ {
+ "key": "shape",
+ "type": ["String"],
+ "desc": "形状",
+ "label": ""
+ },
+ {
+ "key": "showZero",
+ "type": ["Boolean"],
+ "desc": "当数值为 0 时,是否展示徽标",
+ "label": ""
+ },
+ {
+ "key": "size",
+ "type": ["String"],
+ "desc": "尺寸",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-content", "t-class-count"],
+ "tpl": "",
+ "path": "./badge/badge"
+ },
+ "t-button": {
+ "key": "t-button",
+ "label": "按钮",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-button.png",
+ "properties": [
+ {
+ "key": "block",
+ "type": ["Boolean"],
+ "desc": "是否为块级元素",
+ "label": ""
+ },
+ {
+ "key": "content",
+ "type": ["String"],
+ "desc": "按钮内容",
+ "label": ""
+ },
+ {
+ "key": "customDataset",
+ "type": ["Object"],
+ "desc": "自定义 dataset,可通过 event.currentTarget.dataset.custom 获取",
+ "label": ""
+ },
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用按钮",
+ "label": ""
+ },
+ {
+ "key": "ghost",
+ "type": ["Boolean"],
+ "desc": "是否为幽灵按钮(镂空按钮)",
+ "label": ""
+ },
+ {
+ "key": "icon",
+ "type": ["String"],
+ "desc": "图标名称",
+ "label": ""
+ },
+ {
+ "key": "loading",
+ "type": ["Boolean"],
+ "desc": "是否显示为加载状态",
+ "label": ""
+ },
+ {
+ "key": "shape",
+ "type": ["String"],
+ "desc": "按钮形状,有 4 种:长方形、正方形、圆角长方形、圆形",
+ "label": ""
+ },
+ {
+ "key": "size",
+ "type": ["String"],
+ "desc": "组件尺寸",
+ "label": ""
+ },
+ {
+ "key": "theme",
+ "type": ["String"],
+ "desc": "组件风格,依次为品牌色、危险色",
+ "label": ""
+ },
+ {
+ "key": "type",
+ "type": ["String"],
+ "desc": "同小程序的 formType",
+ "label": ""
+ },
+ {
+ "key": "variant",
+ "type": ["String"],
+ "desc": "按钮形式,基础、线框、文字",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-icon"],
+ "events": [
+ {
+ "key": "bind:click",
+ "desc": "点击时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./button/button"
+ },
+ "t-cell-group": {
+ "key": "t-cell-group",
+ "label": "单元格组",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-cell.png",
+ "properties": [
+ {
+ "key": "bordered",
+ "type": ["Boolean"],
+ "desc": "是否显示组边框",
+ "label": ""
+ },
+ {
+ "key": "title",
+ "type": ["String"],
+ "desc": "单元格组标题",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class"],
+ "tpl": "",
+ "require": {
+ "t-cell": "./cell/cell"
+ },
+ "path": "./cell-group/cell-group"
+ },
+ "t-cell": {
+ "key": "t-cell",
+ "label": "单元格",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-cell.png",
+ "properties": [
+ {
+ "key": "align",
+ "type": ["String"],
+ "desc": "内容的对齐方式,默认居中对齐",
+ "label": ""
+ },
+ {
+ "key": "arrow",
+ "type": ["Boolean"],
+ "desc": "是否显示右侧箭头",
+ "label": ""
+ },
+ {
+ "key": "bordered",
+ "type": ["Boolean"],
+ "desc": "是否显示下边框",
+ "label": ""
+ },
+ {
+ "key": "description",
+ "type": ["String"],
+ "desc": "下方内容描述",
+ "label": ""
+ },
+ {
+ "key": "hover",
+ "type": ["Boolean"],
+ "desc": "是否开启点击反馈",
+ "label": ""
+ },
+ {
+ "key": "image",
+ "type": ["String"],
+ "desc": "主图",
+ "label": ""
+ },
+ {
+ "key": "jumpType",
+ "type": ["String"],
+ "desc": "链接跳转类型",
+ "label": ""
+ },
+ {
+ "key": "leftIcon",
+ "type": ["String"],
+ "desc": "左侧图标,出现在单元格标题的左侧",
+ "label": ""
+ },
+ {
+ "key": "note",
+ "type": ["String"],
+ "desc": "和标题同行的说明文字",
+ "label": ""
+ },
+ {
+ "key": "required",
+ "type": ["Boolean"],
+ "desc": "是否显示表单必填星号",
+ "label": ""
+ },
+ {
+ "key": "rightIcon",
+ "type": ["String"],
+ "desc": "最右侧图标",
+ "label": ""
+ },
+ {
+ "key": "title",
+ "type": ["String"],
+ "desc": "标题",
+ "label": ""
+ },
+ {
+ "key": "url",
+ "type": ["String"],
+ "desc": "点击后跳转链接地址。如果值为空,则表示不需要跳转",
+ "label": ""
+ }
+ ],
+ "externalClasses": [
+ "t-class",
+ "t-class-title",
+ "t-class-note",
+ "t-class-description",
+ "t-class-thumb",
+ "t-class-hover",
+ "t-class-left",
+ "t-class-right"
+ ],
+ "events": [
+ {
+ "key": "bind:click",
+ "desc": "右侧内容",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./cell/cell"
+ },
+ "t-check-tag": {
+ "key": "t-check-tag",
+ "label": "可选标签",
+ "icon": "",
+ "properties": [
+ {
+ "key": "checked",
+ "type": ["Boolean"],
+ "desc": "标签选中的状态,默认风格(theme=default)才有选中态",
+ "label": ""
+ },
+ {
+ "key": "closable",
+ "type": ["Boolean"],
+ "desc": "标签是否可关闭",
+ "label": ""
+ },
+ {
+ "key": "content",
+ "type": ["String", "Number"],
+ "desc": "组件子元素",
+ "label": ""
+ },
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态",
+ "label": ""
+ },
+ {
+ "key": "icon",
+ "type": ["String"],
+ "desc": "标签中的图标,可自定义图标呈现",
+ "label": ""
+ },
+ {
+ "key": "shape",
+ "type": ["String"],
+ "desc": "标签类型,有三种:方形、圆角方形、标记型",
+ "label": ""
+ },
+ {
+ "key": "size",
+ "type": ["String"],
+ "desc": "标签尺寸",
+ "label": ""
+ }
+ ],
+ "events": [
+ {
+ "key": "bind:change",
+ "desc": "组件子元素",
+ "label": ""
+ },
+ {
+ "key": "bind:click",
+ "desc": "点击标签时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "check tag",
+ "path": "./check-tag/check-tag"
+ },
+ "t-checkbox-group": {
+ "key": "t-checkbox-group",
+ "label": "多选框组",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-checkbox.png",
+ "properties": [
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用组件",
+ "label": ""
+ },
+ {
+ "key": "max",
+ "type": ["Number"],
+ "desc": "支持最多选中的数量",
+ "label": ""
+ },
+ {
+ "key": "name",
+ "type": ["String"],
+ "desc": "统一设置内部复选框 HTML 属性",
+ "label": ""
+ },
+ {
+ "key": "options",
+ "type": ["Array"],
+ "desc": "以配置形式设置子元素。示例1:`['北京', '上海']` ,示例2: `[{ label: '全选', checkAll: true }, { label: '上海', value: 'shanghai' }]`。checkAll 值为 true 表示当前选项为「全选选项」",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["Array"],
+ "desc": "选中值",
+ "label": ""
+ }
+ ],
+ "events": [
+ {
+ "key": "bind:change",
+ "desc": "值变化时触发。`context.current` 表示当前变化的数据项,如果是全选则为空;`context.type` 表示引起选中数据变化的是选中或是取消选中,`context.option` 表示当前变化的数据项",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "require": {
+ "t-checkbox": "./checkbox/checkbox"
+ },
+ "path": "./checkbox-group/checkbox-group"
+ },
+ "t-checkbox": {
+ "key": "t-checkbox",
+ "label": "多选框",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-checkbox.png",
+ "properties": [
+ {
+ "key": "align",
+ "type": ["String"],
+ "desc": "多选框和内容相对位置",
+ "label": ""
+ },
+ {
+ "key": "checkAll",
+ "type": ["Boolean"],
+ "desc": "用于标识是否为「全选选项」。单独使用无效,需在 CheckboxGroup 中使用",
+ "label": ""
+ },
+ {
+ "key": "checked",
+ "type": ["Boolean"],
+ "desc": "是否选中",
+ "label": ""
+ },
+ {
+ "key": "color",
+ "type": ["String"],
+ "desc": "多选框颜色",
+ "label": ""
+ },
+ {
+ "key": "content",
+ "type": ["String"],
+ "desc": "多选框内容",
+ "label": ""
+ },
+ {
+ "key": "contentDisabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用组件内容(content)触发选中",
+ "label": ""
+ },
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用组件",
+ "label": ""
+ },
+ {
+ "key": "icon",
+ "type": ["Array"],
+ "desc": "自定义选中图标和非选中图标。示例:[选中态图标地址,非选中态图标地址]",
+ "label": ""
+ },
+ {
+ "key": "indeterminate",
+ "type": ["Boolean"],
+ "desc": "是否为半选",
+ "label": ""
+ },
+ {
+ "key": "label",
+ "type": ["String"],
+ "desc": "主文案",
+ "label": ""
+ },
+ {
+ "key": "maxContentRow",
+ "type": ["Number"],
+ "desc": "内容最大行数限制",
+ "label": ""
+ },
+ {
+ "key": "maxLabelRow",
+ "type": ["Number"],
+ "desc": "主文案最大行数限制",
+ "label": ""
+ },
+ {
+ "key": "name",
+ "type": ["String"],
+ "desc": "HTML 元素原生属性",
+ "label": ""
+ },
+ {
+ "key": "readonly",
+ "type": ["Boolean"],
+ "desc": "只读状态",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["String", "Number"],
+ "desc": "多选框的值",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-icon", "t-class-label", "t-class-content", "t-class-border"],
+ "events": [
+ {
+ "key": "bind:change",
+ "desc": "值变化时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./checkbox/checkbox"
+ },
+ "t-collapse-panel": {
+ "key": "t-collapse-panel",
+ "label": "折叠面板",
+ "icon": "",
+ "properties": [
+ {
+ "key": "content",
+ "type": ["String"],
+ "desc": "折叠面板内容",
+ "label": ""
+ },
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "禁止当前面板展开,优先级大于 Collapse 的同名属性",
+ "label": ""
+ },
+ {
+ "key": "expandIcon",
+ "type": ["Boolean"],
+ "desc": "当前折叠面板展开图标,优先级大于 Collapse 的同名属性",
+ "label": ""
+ },
+ {
+ "key": "header",
+ "type": ["String"],
+ "desc": "面板头内容",
+ "label": ""
+ },
+ {
+ "key": "headerRightContent",
+ "type": ["String"],
+ "desc": "面板头的右侧区域,一般用于呈现面板操作",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["String", "Number"],
+ "desc": "当前面板唯一标识,如果值为空则取当前面下标兜底作为唯一标识",
+ "label": ""
+ }
+ ],
+ "tpl": "此处可自定义内容",
+ "path": "./collapse/collapse-panel"
+ },
+ "t-collapse": {
+ "key": "t-collapse",
+ "label": "折叠",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-collapse.png",
+ "properties": [
+ {
+ "key": "defaultExpandAll",
+ "type": ["Boolean"],
+ "desc": "默认是否展开全部",
+ "label": ""
+ },
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用面板展开/收起操作",
+ "label": ""
+ },
+ {
+ "key": "expandIcon",
+ "type": ["Boolean"],
+ "desc": "展开图标。值为 undefined 或 false 则不显示展开图标;值为 true 显示默认图标;值类型为函数,则表示完全自定义展开图标",
+ "label": ""
+ },
+ {
+ "key": "expandMutex",
+ "type": ["Boolean"],
+ "desc": "每个面板互斥展开,每次只展开一个面板",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["Array"],
+ "desc": "展开的面板集合",
+ "label": ""
+ }
+ ],
+ "events": [
+ {
+ "key": "bind:change",
+ "desc": "切换面板时触发,返回变化的值",
+ "label": ""
+ }
+ ],
+ "tpl": "此处可自定义内容",
+ "require": {
+ "t-collapse-panel": "./collapse/collapse-panel"
+ },
+ "path": "./collapse/collapse"
+ },
+ "t-date-time-picker": {
+ "key": "t-date-time-picker",
+ "label": "日期时间选择器",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-datetimepicker.png",
+ "properties": [
+ {
+ "key": "cancelBtn",
+ "type": ["String"],
+ "desc": "取消按钮文字",
+ "label": ""
+ },
+ {
+ "key": "confirmBtn",
+ "type": ["String"],
+ "desc": "确定按钮文字",
+ "label": ""
+ },
+ {
+ "key": "end",
+ "type": ["String", "Number"],
+ "desc": "选择器的结束时间",
+ "label": ""
+ },
+ {
+ "key": "footer",
+ "type": ["String"],
+ "desc": "底部内容",
+ "label": ""
+ },
+ {
+ "key": "format",
+ "type": ["String"],
+ "desc": "用于格式化日期,[详细文档](https://day.js.org/docs/en/display/format)",
+ "label": ""
+ },
+ {
+ "key": "header",
+ "type": ["Boolean"],
+ "desc": "头部内容。值为 true 显示空白头部,值为 false 不显示任何内容,值类型为 TNode 表示自定义头部内容",
+ "label": ""
+ },
+ {
+ "key": "mode",
+ "type": ["String", "Array"],
+ "desc": "选择器模式,用于表示可以选择到哪一个层级。【示例一】year 或者 ['year'] 表示纯日期选择器,只能选择到年份,只显示年份。【示例二】'hour' 或 ['hour'] 表示纯时间选择器,只能选择到小时维度。【示例三】['year', 'month', 'date', 'hour', 'minute'] 表示,日期和时间 混合选择器,可以选择到具体哪一分钟,显示全部时间:年/月/日/时/分",
+ "label": ""
+ },
+ {
+ "key": "showWeek",
+ "type": ["Boolean"],
+ "desc": "【开发中】是否在日期旁边显示周几(如周一,周二,周日等)",
+ "label": ""
+ },
+ {
+ "key": "start",
+ "type": ["String", "Number"],
+ "desc": "选择器的开始时间",
+ "label": ""
+ },
+ {
+ "key": "title",
+ "type": ["String"],
+ "desc": "标题",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["String", "Number"],
+ "desc": "选中值",
+ "label": ""
+ },
+ {
+ "key": "visible",
+ "type": ["Boolean"],
+ "desc": "是否显示",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-confirm", "t-class-cancel", "t-class-title"],
+ "events": [
+ {
+ "key": "bind:cancel",
+ "desc": "取消按钮点击时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:change",
+ "desc": "选中值发生变化时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:column-change",
+ "desc": "每一列选中数据变化时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:confirm",
+ "desc": "确认按钮点击时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./date-time-picker/date-time-picker"
+ },
+ "t-dialog": {
+ "key": "t-dialog",
+ "label": "对话框",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-dialog.png",
+ "properties": [
+ {
+ "key": "actions",
+ "type": ["Array"],
+ "desc": "操作栏",
+ "label": ""
+ },
+ {
+ "key": "buttonLayout",
+ "type": ["String"],
+ "desc": "多按钮排列方式",
+ "label": ""
+ },
+ {
+ "key": "cancelBtn",
+ "type": ["String", "Object"],
+ "desc": "取消按钮,可自定义。值为 null 则不显示取消按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制取消事件",
+ "label": ""
+ },
+ {
+ "key": "closeOnOverlayClick",
+ "type": ["Boolean"],
+ "desc": "点击蒙层时是否触发关闭事件",
+ "label": ""
+ },
+ {
+ "key": "confirmBtn",
+ "type": ["String", "Object"],
+ "desc": "确认按钮。值为 null 则不显示确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制确认事件",
+ "label": ""
+ },
+ {
+ "key": "content",
+ "type": ["String"],
+ "desc": "内容",
+ "label": ""
+ },
+ {
+ "key": "preventScrollThrough",
+ "type": ["Boolean"],
+ "desc": "防止滚动穿透",
+ "label": ""
+ },
+ {
+ "key": "showInAttachedElement",
+ "type": ["Boolean"],
+ "desc": "【开发中】仅在挂载元素中显示抽屉,默认在浏览器可视区域显示。父元素需要有定位属性,如:position: relative",
+ "label": ""
+ },
+ {
+ "key": "showOverlay",
+ "type": ["Boolean"],
+ "desc": "是否显示遮罩层",
+ "label": ""
+ },
+ {
+ "key": "title",
+ "type": ["String"],
+ "desc": "标题",
+ "label": ""
+ },
+ {
+ "key": "visible",
+ "type": ["Boolean"],
+ "desc": "控制对话框是否显示",
+ "label": ""
+ },
+ {
+ "key": "zIndex",
+ "type": ["Number"],
+ "desc": "对话框层级,Web 侧样式默认为 2500,移动端和小程序样式默认为 1500",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-content", "t-class-confirm", "t-class-cancel"],
+ "events": [
+ {
+ "key": "bind:cancel",
+ "desc": "如果“取消”按钮存在,则点击“取消”按钮时触发,同时触发关闭事件",
+ "label": ""
+ },
+ {
+ "key": "bind:close",
+ "desc": "关闭事件,点击 取消按钮 或 点击蒙层 时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:overlay-click",
+ "desc": "如果蒙层存在,点击蒙层时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./dialog/dialog"
+ },
+ "t-divider": {
+ "key": "t-divider",
+ "label": "分割线",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-divider.png",
+ "properties": [
+ {
+ "key": "align",
+ "type": ["String"],
+ "desc": "文本位置(仅在水平分割线有效)",
+ "label": ""
+ },
+ {
+ "key": "content",
+ "type": ["String"],
+ "desc": "子元素",
+ "label": ""
+ },
+ {
+ "key": "dashed",
+ "type": ["Boolean"],
+ "desc": "是否虚线(仅在水平分割线有效)",
+ "label": ""
+ },
+ {
+ "key": "layout",
+ "type": ["String"],
+ "desc": "分隔线类型有两种:水平和垂直",
+ "label": ""
+ },
+ {
+ "key": "lineColor",
+ "type": ["String"],
+ "desc": "分隔线颜色",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-line", "t-class-content"],
+ "tpl": "",
+ "path": "./divider/divider"
+ },
+ "t-drawer": {
+ "key": "t-drawer",
+ "label": "模态抽屉",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-drawer.png",
+ "properties": [
+ {
+ "key": "closeOnOverlayClick",
+ "type": ["Boolean"],
+ "desc": "点击蒙层时是否触发抽屉关闭事件",
+ "label": ""
+ },
+ {
+ "key": "destroyOnClose",
+ "type": ["Boolean"],
+ "desc": "抽屉关闭时是否销毁节点",
+ "label": ""
+ },
+ {
+ "key": "items",
+ "type": ["Array"],
+ "desc": "抽屉里的列表项",
+ "label": ""
+ },
+ {
+ "key": "placement",
+ "type": ["String"],
+ "desc": "抽屉方向",
+ "label": ""
+ },
+ {
+ "key": "showOverlay",
+ "type": ["Boolean"],
+ "desc": "是否显示遮罩层",
+ "label": ""
+ },
+ {
+ "key": "visible",
+ "type": ["Boolean"],
+ "desc": "组件是否可见",
+ "label": ""
+ },
+ {
+ "key": "zIndex",
+ "type": ["Number"],
+ "desc": "抽屉层级,样式默认为 1500",
+ "label": ""
+ }
+ ],
+ "events": [
+ {
+ "key": "bind:close",
+ "desc": "关闭事件,取消按钮点击时、关闭按钮点击时、点击蒙层时均会触发",
+ "label": ""
+ },
+ {
+ "key": "bind:item-click",
+ "desc": "点击抽屉里的列表项",
+ "label": ""
+ },
+ {
+ "key": "bind:overlay-click",
+ "desc": "如果蒙层存在,点击蒙层时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./drawer/drawer"
+ },
+ "t-dropdown-item": {
+ "key": "t-dropdown-item",
+ "label": "下拉菜单子项",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-dropdownmenu.png",
+ "properties": [
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用",
+ "label": ""
+ },
+ {
+ "key": "label",
+ "type": ["String"],
+ "desc": "标题",
+ "label": ""
+ },
+ {
+ "key": "multiple",
+ "type": ["Boolean"],
+ "desc": "是否多选",
+ "label": ""
+ },
+ {
+ "key": "options",
+ "type": ["Array"],
+ "desc": "选项数据",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./dropdown-menu/dropdown-item"
+ },
+ "t-dropdown-menu": {
+ "key": "t-dropdown-menu",
+ "label": "下拉菜单",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-dropdownmenu.png",
+ "properties": [
+ {
+ "key": "activeColor",
+ "type": ["String"],
+ "desc": "【讨论中】菜单标题和选项的选中态颜色",
+ "label": ""
+ },
+ {
+ "key": "closeOnClickOverlay",
+ "type": ["Boolean"],
+ "desc": "是否在点击遮罩层后关闭菜单",
+ "label": ""
+ },
+ {
+ "key": "duration",
+ "type": ["String", "Number"],
+ "desc": "动画时长",
+ "label": ""
+ },
+ {
+ "key": "showOverlay",
+ "type": ["Boolean"],
+ "desc": "是否显示遮罩层",
+ "label": ""
+ },
+ {
+ "key": "zIndex",
+ "type": ["Number"],
+ "desc": "菜单栏 z-index 层级",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "require": {
+ "t-dropdown-item": "./dropdown-menu/dropdown-item"
+ },
+ "path": "./dropdown-menu/dropdown-menu"
+ },
+ "t-empty": {
+ "key": "t-empty",
+ "label": "空状态",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-empty.png",
+ "properties": [
+ {
+ "key": "action",
+ "type": ["String"],
+ "desc": "操作按钮",
+ "label": ""
+ },
+ {
+ "key": "description",
+ "type": ["String"],
+ "desc": "描述文字",
+ "label": ""
+ },
+ {
+ "key": "icon",
+ "type": ["String"],
+ "desc": "图标名称",
+ "label": ""
+ },
+ {
+ "key": "image",
+ "type": ["String"],
+ "desc": "图片地址",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-description", "t-class-image", "t-class-actions"],
+ "tpl": "",
+ "path": "./empty/empty"
+ },
+ "t-fab": {
+ "key": "t-fab",
+ "label": "悬浮按钮",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-fab.png",
+ "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": "bind:click",
+ "desc": "悬浮按钮点击事件",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./fab/fab"
+ },
+ "t-footer": {
+ "key": "t-footer",
+ "label": "布局-底部内容",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-footer.png",
+ "properties": [
+ {
+ "key": "copyright",
+ "type": ["String"],
+ "desc": "版权信息,type 为`text`生效",
+ "label": ""
+ },
+ {
+ "key": "logo",
+ "type": ["Object"],
+ "desc": "图标配置,type 为`logo`生效。`logo.icon` 表示图标链接地址,`logo.title` 表示标题文本,`logo.url` 表示链接跳转地址",
+ "label": ""
+ },
+ {
+ "key": "textLinkList",
+ "type": ["Array"],
+ "desc": "链接列表,type 为`text`生效。name 表示链接名称, url 表示链接 page 路径,目前只支持小程序内部跳转,openType 表示跳转方式",
+ "label": ""
+ },
+ {
+ "key": "theme",
+ "type": ["String"],
+ "desc": "页脚展示类型",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./footer/footer"
+ },
+ "t-grid-item": {
+ "key": "t-grid-item",
+ "label": "宫格子项",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-grid.png",
+ "properties": [
+ {
+ "key": "badgeProps",
+ "type": ["Object"],
+ "desc": "头像右上角提示信息,继承 Badge 组件的全部特性。如:小红点,或者数字",
+ "label": ""
+ },
+ {
+ "key": "description",
+ "type": ["String"],
+ "desc": "文本以外的更多描述,辅助信息。可以通过 Props 传入文本,也可以自定义标题节点",
+ "label": ""
+ },
+ {
+ "key": "image",
+ "type": ["String"],
+ "desc": "图片,可以是图片地址,也可以自定义图片节点",
+ "label": ""
+ },
+ {
+ "key": "jumpType",
+ "type": ["String"],
+ "desc": "链接跳转类型",
+ "label": ""
+ },
+ {
+ "key": "layout",
+ "type": ["String"],
+ "desc": "内容布局方式",
+ "label": ""
+ },
+ {
+ "key": "text",
+ "type": ["String"],
+ "desc": "文本,可以通过 Props 传入文本,也可以自定义标题节点",
+ "label": ""
+ },
+ {
+ "key": "url",
+ "type": ["String"],
+ "desc": "点击后的跳转链接",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-image", "t-class-text", "t-class-description"],
+ "tpl": "",
+ "path": "./grid-item/grid-item"
+ },
+ "t-grid": {
+ "key": "t-grid",
+ "label": "栅格",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-grid.png",
+ "properties": [
+ {
+ "key": "align",
+ "type": ["String"],
+ "desc": "内容对齐方式",
+ "label": ""
+ },
+ {
+ "key": "border",
+ "type": ["Boolean", "Object"],
+ "desc": "边框,默认不显示。值为 true 则显示默认边框,值类型为 object 则表示自定义边框样式",
+ "label": ""
+ },
+ {
+ "key": "column",
+ "type": ["Number"],
+ "desc": "每一行的列数量",
+ "label": ""
+ },
+ {
+ "key": "gutter",
+ "type": ["Number"],
+ "desc": "间隔大小",
+ "label": ""
+ },
+ {
+ "key": "hover",
+ "type": ["Boolean"],
+ "desc": "是否开启点击反馈",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class"],
+ "tpl": "",
+ "require": {
+ "t-grid-item": "./grid-item/grid-item"
+ },
+ "path": "./grid/grid"
+ },
+ "t-icon": {
+ "key": "t-icon",
+ "label": "图标",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-icon.png",
+ "properties": [
+ {
+ "key": "classPrefix",
+ "type": ["String"],
+ "desc": "自定义icon前缀",
+ "label": ""
+ },
+ {
+ "key": "color",
+ "type": ["String"],
+ "desc": "图标颜色",
+ "label": ""
+ },
+ {
+ "key": "style",
+ "type": ["String"],
+ "desc": "自定义样式",
+ "label": ""
+ },
+ {
+ "key": "name",
+ "type": ["String"],
+ "desc": "图标名称",
+ "label": ""
+ },
+ {
+ "key": "size",
+ "type": ["String", "Number"],
+ "desc": "图标名称",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./icon/icon"
+ },
+ "t-image": {
+ "key": "t-image",
+ "label": "图片",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-image.png",
+ "properties": [
+ {
+ "key": "error",
+ "type": ["String"],
+ "desc": "加载失败时显示的内容。值为 `default` 则表示使用默认加载失败风格;值为空或者 `slot` 表示使用插槽渲染,插槽名称为 `error`;值为其他则表示普通文本内容,如“加载失败”",
+ "label": ""
+ },
+ {
+ "key": "lazy",
+ "type": ["Boolean"],
+ "desc": "是否开启图片懒加载",
+ "label": ""
+ },
+ {
+ "key": "loading",
+ "type": ["String"],
+ "desc": "加载态内容。值为 `default` 则表示使用默认加载中风格;值为空或者 `slot` 表示使用插槽渲染,插槽名称为 `loading`;值为其他则表示普通文本内容,如“加载中”",
+ "label": ""
+ },
+ {
+ "key": "shape",
+ "type": ["String"],
+ "desc": "图片圆角类型",
+ "label": ""
+ },
+ {
+ "key": "src",
+ "type": ["String"],
+ "desc": "图片链接",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-load"],
+ "events": [
+ {
+ "key": "bind:error",
+ "desc": "图片加载失败时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:load",
+ "desc": "图片加载完成时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./image/image"
+ },
+ "t-indexes": {
+ "key": "t-indexes",
+ "label": "索引",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-indexes.png",
+ "properties": [
+ {
+ "key": "height",
+ "type": ["Number"],
+ "desc": "列表高度,未设置默认占满设备高度",
+ "label": ""
+ },
+ {
+ "key": "list",
+ "type": ["Array"],
+ "desc": "索引列表的列表数据。每个元素包含三个子元素,index(string):索引值,例如1,2,3,...或A,B,C等;title(string): 索引标题,可不填将默认设为索引值;children(Array<{title: string}>): 子元素列表,title为子元素的展示文案。",
+ "label": ""
+ },
+ {
+ "key": "sticky",
+ "type": ["Boolean"],
+ "desc": "索引是否吸顶,默认为true",
+ "label": ""
+ }
+ ],
+ "events": [
+ {
+ "key": "bind:select",
+ "desc": "点击行元素时触发事件",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./indexes/indexes"
+ },
+ "t-input": {
+ "key": "t-input",
+ "label": "输入框",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-input.png",
+ "properties": [
+ {
+ "key": "align",
+ "type": ["String"],
+ "desc": "文本内容位置,居左/居中/居右",
+ "label": ""
+ },
+ {
+ "key": "borderless",
+ "type": ["Boolean"],
+ "desc": "【讨论中】是否开启无边框模式",
+ "label": ""
+ },
+ {
+ "key": "clearable",
+ "type": ["Boolean"],
+ "desc": "是否可清空",
+ "label": ""
+ },
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用输入框",
+ "label": ""
+ },
+ {
+ "key": "errorMessage",
+ "type": ["String"],
+ "desc": "错误提示文本,值为空不显示(废弃属性,如果需要,请更为使用 status 和 tips)",
+ "label": ""
+ },
+ {
+ "key": "format",
+ "type": ["String"],
+ "desc": "【开发中】指定输入框展示值的格式",
+ "label": ""
+ },
+ {
+ "key": "label",
+ "type": ["String"],
+ "desc": "左侧文本",
+ "label": ""
+ },
+ {
+ "key": "maxcharacter",
+ "type": ["Number"],
+ "desc": "用户最多可以输入的字符个数,一个中文汉字表示两个字符长度。`maxcharacter` 和 `maxlength` 二选一使用",
+ "label": ""
+ },
+ {
+ "key": "maxlength",
+ "type": ["Number"],
+ "desc": "用户最多可以输入的文本长度,一个中文等于一个计数长度。值小于等于 0 的时候,则表示不限制输入长度。`maxcharacter` 和 `maxlength` 二选一使用",
+ "label": ""
+ },
+ {
+ "key": "placeholder",
+ "type": ["String"],
+ "desc": "占位符",
+ "label": ""
+ },
+ {
+ "key": "prefixIcon",
+ "type": ["String"],
+ "desc": "组件前置图标,值为字符串则表示图标名称",
+ "label": ""
+ },
+ {
+ "key": "readonly",
+ "type": ["Boolean"],
+ "desc": "只读状态",
+ "label": ""
+ },
+ {
+ "key": "size",
+ "type": ["String"],
+ "desc": "输入框尺寸",
+ "label": ""
+ },
+ {
+ "key": "status",
+ "type": ["String"],
+ "desc": "输入框状态",
+ "label": ""
+ },
+ {
+ "key": "suffix",
+ "type": ["String"],
+ "desc": "后置图标前的后置内容",
+ "label": ""
+ },
+ {
+ "key": "suffixIcon",
+ "type": ["String"],
+ "desc": "后置文本内容,值为字符串则表示图标名称",
+ "label": ""
+ },
+ {
+ "key": "tips",
+ "type": ["String"],
+ "desc": "输入框下方提示文本,会根据不同的 `status` 呈现不同的样式",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["String", "Number"],
+ "desc": "输入框的值",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-input", "t-class-placeholder", "t-class-error-msg"],
+ "events": [
+ {
+ "key": "bind:blur",
+ "desc": "失去焦点时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:change",
+ "desc": "输入框值发生变化时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:clear",
+ "desc": "清空按钮点击时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:enter",
+ "desc": "回车键按下时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:focus",
+ "desc": "获得焦点时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./input/input"
+ },
+ "t-loading": {
+ "key": "t-loading",
+ "label": "加载中",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-loading.png",
+ "properties": [
+ {
+ "key": "delay",
+ "type": ["Number"],
+ "desc": "延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒",
+ "label": ""
+ },
+ {
+ "key": "duration",
+ "type": ["Number"],
+ "desc": "加载动画执行完成一次的时间,单位:毫秒",
+ "label": ""
+ },
+ {
+ "key": "indicator",
+ "type": ["Boolean"],
+ "desc": "是否显示加载指示符",
+ "label": ""
+ },
+ {
+ "key": "inheritColor",
+ "type": ["Boolean"],
+ "desc": "是否继承父元素颜色",
+ "label": ""
+ },
+ {
+ "key": "layout",
+ "type": ["String"],
+ "desc": "对齐方式",
+ "label": ""
+ },
+ {
+ "key": "loading",
+ "type": ["Boolean"],
+ "desc": "是否处于加载状态",
+ "label": ""
+ },
+ {
+ "key": "pause",
+ "type": ["Boolean"],
+ "desc": "是否暂停动画",
+ "label": ""
+ },
+ {
+ "key": "progress",
+ "type": ["Number"],
+ "desc": "加载进度",
+ "label": ""
+ },
+ {
+ "key": "reverse",
+ "type": ["Boolean"],
+ "desc": "加载动画是否反向",
+ "label": ""
+ },
+ {
+ "key": "size",
+ "type": ["String"],
+ "desc": "尺寸,示例:40rpx/20px",
+ "label": ""
+ },
+ {
+ "key": "text",
+ "type": ["String"],
+ "desc": "加载提示文案",
+ "label": ""
+ },
+ {
+ "key": "theme",
+ "type": ["String"],
+ "desc": "加载组件类型",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-text", "t-class-indicator"],
+ "tpl": "",
+ "path": "./loading/loading"
+ },
+ "t-message": {
+ "key": "t-message",
+ "label": "全局提醒",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-message.png",
+ "properties": [
+ {
+ "key": "action",
+ "type": ["String"],
+ "desc": "操作",
+ "label": ""
+ },
+ {
+ "key": "align",
+ "type": ["String"],
+ "desc": "文本对齐方式",
+ "label": ""
+ },
+ {
+ "key": "closeBtn",
+ "type": ["String", "Boolean"],
+ "desc": "关闭按钮,可以自定义。值为 true 显示默认关闭按钮,值为 false 不显示关闭按钮。值类型为 string 则直接显示值,如:“关闭”。也可以完全自定义按钮",
+ "label": ""
+ },
+ {
+ "key": "content",
+ "type": ["String"],
+ "desc": "用于自定义消息弹出内容",
+ "label": ""
+ },
+ {
+ "key": "duration",
+ "type": ["Number"],
+ "desc": "消息内置计时器,计时到达时会触发 duration-end 事件。单位:毫秒。值为 0 则表示没有计时器。",
+ "label": ""
+ },
+ {
+ "key": "icon",
+ "type": ["String", "Boolean"],
+ "desc": "消息提醒前面的图标。值为 true 则根据 theme 显示对应的图标,值为 false 则不显示图标。值为 'info' 或 'bell' 则显示组件内置图标。也可以完全自定义图标节点",
+ "label": ""
+ },
+ {
+ "key": "marquee",
+ "type": ["Boolean", "Object"],
+ "desc": "跑马灯效果。speed 指速度控制;loop 指循环播放次数,值为 -1 表示循环播放,值为 0 表示不循环播放;delay 表示延迟多久开始播放",
+ "label": ""
+ },
+ {
+ "key": "offset",
+ "type": ["Array"],
+ "desc": "相对于 placement 的偏移量,示例:[-10, 20] 或 ['10rpx', '8rpx']",
+ "label": ""
+ },
+ {
+ "key": "theme",
+ "type": ["String"],
+ "desc": "消息组件风格",
+ "label": ""
+ },
+ {
+ "key": "visible",
+ "type": ["Boolean"],
+ "desc": "是否显示,隐藏时默认销毁组件",
+ "label": ""
+ },
+ {
+ "key": "zIndex",
+ "type": ["Number"],
+ "desc": "元素层级,样式默认为 5000",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-content", "t-class-icon", "t-class-action", "t-class-close-btn"],
+ "events": [
+ {
+ "key": "bind:action-btn-click",
+ "desc": "当操作按钮存在时,用户点击操作按钮时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:close-btn-click",
+ "desc": "当关闭按钮存在时,用户点击关闭按钮触发",
+ "label": ""
+ },
+ {
+ "key": "bind:duration-end",
+ "desc": "计时结束后触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./message/message"
+ },
+ "t-navbar": {
+ "key": "t-navbar",
+ "label": "导航条",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-navbar.png",
+ "properties": [
+ {
+ "key": "animation",
+ "type": ["Boolean"],
+ "desc": "是否添加动画效果",
+ "label": ""
+ },
+ {
+ "key": "background",
+ "type": ["String"],
+ "desc": "背景",
+ "label": ""
+ },
+ {
+ "key": "delta",
+ "type": ["Number"],
+ "desc": "后退按钮后退层数,含义参考 [wx.navigateBack](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html),特殊的,传入 0 不会发生执行 wx.navigateBack,只会触发一个 goback 事件供自行处理。",
+ "label": ""
+ },
+ {
+ "key": "fixed",
+ "type": ["Boolean"],
+ "desc": "是否固定在顶部",
+ "label": ""
+ },
+ {
+ "key": "homeIcon",
+ "type": ["String"],
+ "desc": "首页图标地址。值为 '' 或者 undefiend 则表示不显示返回图标,值为 'circle' 表示显示默认图标,值为 'slot' 表示使用插槽渲染,值为其他则表示图标地址",
+ "label": ""
+ },
+ {
+ "key": "leftIcon",
+ "type": ["String"],
+ "desc": "左侧图标地址,值为 '' 或者 undefiend 则表示不显示返回图标,值为 'arrow-left' 表示显示返回图标,值为 'slot' 表示使用插槽渲染,值为其他则表示图标地址",
+ "label": ""
+ },
+ {
+ "key": "title",
+ "type": ["String"],
+ "desc": "页面标题",
+ "label": ""
+ },
+ {
+ "key": "titleMaxLength",
+ "type": ["Number"],
+ "desc": "标题文字最大长度,超出的范围使用 `...` 表示",
+ "label": ""
+ },
+ {
+ "key": "visible",
+ "type": ["Boolean"],
+ "desc": "是否显示",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-title", "t-class-left-icon", "t-class-home-icon", "t-class-capsule"],
+ "events": [
+ {
+ "key": "bind:complete",
+ "desc": "navigateBack 执行完成后触发(失败或成功均会触发)",
+ "label": ""
+ },
+ {
+ "key": "bind:fail",
+ "desc": "navigateBack 执行失败后触发",
+ "label": ""
+ },
+ {
+ "key": "bind:go-back",
+ "desc": "delta 值为 0 时,点击返回,触发该事件",
+ "label": ""
+ },
+ {
+ "key": "bind:go-home",
+ "desc": "点击 Home 触发",
+ "label": ""
+ },
+ {
+ "key": "bind:success",
+ "desc": "navigateBack 执行成功后触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./navbar/navbar"
+ },
+ "t-picker-item": {
+ "key": "t-picker-item",
+ "label": "选择器子项",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-picker.png",
+ "properties": [
+ {
+ "key": "format",
+ "type": ["String"],
+ "desc": "格式化标签",
+ "label": ""
+ },
+ {
+ "key": "options",
+ "type": ["Array"],
+ "desc": "数据源",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./picker-item/picker-item"
+ },
+ "t-picker": {
+ "key": "t-picker",
+ "label": "选择器",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-picker.png",
+ "properties": [
+ {
+ "key": "cancelBtn",
+ "type": ["String", "Object"],
+ "desc": "取消按钮文字",
+ "label": ""
+ },
+ {
+ "key": "confirmBtn",
+ "type": ["String", "Object"],
+ "desc": "确定按钮文字",
+ "label": ""
+ },
+ {
+ "key": "footer",
+ "type": ["String"],
+ "desc": "底部内容",
+ "label": ""
+ },
+ {
+ "key": "header",
+ "type": ["Boolean"],
+ "desc": "头部内容。值为 true 显示空白头部,值为 false 不显示任何内容,值类型为 TNode 表示自定义头部内容",
+ "label": ""
+ },
+ {
+ "key": "title",
+ "type": ["String"],
+ "desc": "标题",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["Array"],
+ "desc": "选中值",
+ "label": ""
+ },
+ {
+ "key": "visible",
+ "type": ["Boolean"],
+ "desc": "是否显示",
+ "label": ""
+ }
+ ],
+ "events": [
+ {
+ "key": "bind:cancel",
+ "desc": "点击取消按钮时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:change",
+ "desc": "选中变化时候触发",
+ "label": ""
+ },
+ {
+ "key": "bind:pick",
+ "desc": "任何一列选中都会触发,不同的列参数不同。`context.column` 表示第几列变化,`context.index` 表示变化那一列的选中项下标",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "require": {
+ "t-picker-item": "./picker-item/picker-item"
+ },
+ "path": "./picker/picker"
+ },
+ "t-popup": {
+ "key": "t-popup",
+ "label": "气泡框",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-popup.png",
+ "properties": [
+ {
+ "key": "closeBtn",
+ "type": ["Boolean"],
+ "desc": "关闭按钮,值类型为 Boolean 时表示是否显示关闭按钮。也可以自定义关闭按钮",
+ "label": ""
+ },
+ {
+ "key": "closeOnOverlayClick",
+ "type": ["Boolean"],
+ "desc": "点击遮罩层是否关闭",
+ "label": ""
+ },
+ {
+ "key": "content",
+ "type": ["String"],
+ "desc": "浮层里面的内容",
+ "label": ""
+ },
+ {
+ "key": "placement",
+ "type": ["String"],
+ "desc": "浮层出现位置",
+ "label": ""
+ },
+ {
+ "key": "preventScrollThrough",
+ "type": ["Boolean"],
+ "desc": "防止滚动穿透",
+ "label": ""
+ },
+ {
+ "key": "showOverlay",
+ "type": ["Boolean"],
+ "desc": "是否显示遮罩层",
+ "label": ""
+ },
+ {
+ "key": "transitionProps",
+ "type": ["Object"],
+ "desc": "动画效果定义",
+ "label": ""
+ },
+ {
+ "key": "visible",
+ "type": ["Boolean"],
+ "desc": "是否显示浮层",
+ "label": ""
+ },
+ {
+ "key": "zIndex",
+ "type": ["Number"],
+ "desc": "组件层级,Web 侧样式默认为 5500,移动端和小程序样式默认为 1500",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-overlay", "t-class-content"],
+ "events": [
+ {
+ "key": "bind:visible-change",
+ "desc": "当浮层隐藏或显示时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./popup/popup"
+ },
+ "t-progress": {
+ "key": "t-progress",
+ "label": "进度条",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-progress.png",
+ "properties": [
+ {
+ "key": "color",
+ "type": ["String", "Object", "Array"],
+ "desc": "进度条颜色。示例:'#ED7B2F' 或 'orange' 或 `['#f00', '#0ff', '#f0f']` 或 `{ '0%': '#f00', '100%': '#0ff' }` 或 `{ from: '#000', to: '#000' }` 等",
+ "label": ""
+ },
+ {
+ "key": "label",
+ "type": ["String", "Boolean"],
+ "desc": "进度百分比,可自定义",
+ "label": ""
+ },
+ {
+ "key": "percentage",
+ "type": ["Number"],
+ "desc": "进度条百分比",
+ "label": ""
+ },
+ {
+ "key": "size",
+ "type": ["String", "Number"],
+ "desc": "进度条尺寸,示例:small/medium/large/240。small 值为 72; medium 值为 112;large 值为 160",
+ "label": ""
+ },
+ {
+ "key": "status",
+ "type": ["String"],
+ "desc": "进度条状态",
+ "label": ""
+ },
+ {
+ "key": "strokeWidth",
+ "type": ["String", "Number"],
+ "desc": "进度条线宽。宽度数值不能超过 size 的一半,否则不能输出环形进度",
+ "label": ""
+ },
+ {
+ "key": "theme",
+ "type": ["String"],
+ "desc": "进度条风格。值为 line,标签(label)显示在进度条右侧;值为 plump,标签(label)显示在进度条里面;值为 circle,标签(label)显示在进度条正中间",
+ "label": ""
+ },
+ {
+ "key": "trackColor",
+ "type": ["String"],
+ "desc": "进度条未完成部分颜色",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./progress/progress"
+ },
+ "t-pull-down-refresh": {
+ "key": "t-pull-down-refresh",
+ "label": "下拉刷新",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-pulldownrefresh.png",
+ "properties": [
+ {
+ "key": "loadingBarHeight",
+ "type": ["String", "Number"],
+ "desc": "加载中下拉高度,如果值为数字则单位是:'px'",
+ "label": ""
+ },
+ {
+ "key": "loadingProps",
+ "type": ["Object"],
+ "desc": "加载loading样式",
+ "label": ""
+ },
+ {
+ "key": "loadingTexts",
+ "type": ["Array"],
+ "desc": "提示语,组件内部默认值为 ['下拉刷新', '松手刷新', '正在刷新', '刷新完成']",
+ "label": ""
+ },
+ {
+ "key": "maxBarHeight",
+ "type": ["String", "Number"],
+ "desc": "最大下拉高度,如果值为数字则单位是:'px'",
+ "label": ""
+ },
+ {
+ "key": "refreshTimeout",
+ "type": ["Number"],
+ "desc": "刷新超时时间",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["Boolean"],
+ "desc": "组件状态,值为 `true` 表示下拉状态,值为 `false` 表示收起状态",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-loading", "t-class-text", "t-class-indicator"],
+ "events": [
+ {
+ "key": "bind:change",
+ "desc": "下拉或收起时触发,用户手势往下滑动触发下拉状态,手势松开触发收起状态",
+ "label": ""
+ },
+ {
+ "key": "bind:refresh",
+ "desc": "结束下拉时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:timeout",
+ "desc": "刷新超时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "拖拽该区域演示 中间下拉刷新",
+ "path": "./pull-down-refresh/pull-down-refresh"
+ },
+ "t-radio-group": {
+ "key": "t-radio-group",
+ "label": "单选框组",
+ "icon": "",
+ "properties": [
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用全部子单选框",
+ "label": ""
+ },
+ {
+ "key": "name",
+ "type": ["String"],
+ "desc": "HTML 元素原生属性",
+ "label": ""
+ },
+ {
+ "key": "options",
+ "type": ["Array"],
+ "desc": "单选组件按钮形式。RadioOption 数据类型为 string 或 number 时,表示 label 和 value 值相同",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["String", "Number", "Boolean"],
+ "desc": "选中的值",
+ "label": ""
+ }
+ ],
+ "events": [
+ {
+ "key": "bind:change",
+ "desc": "选中值发生变化时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "require": {
+ "t-radio": "./radio/radio"
+ },
+ "path": "./radio-group/radio-group"
+ },
+ "t-radio": {
+ "key": "t-radio",
+ "label": "单选框",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-radio.png",
+ "properties": [
+ {
+ "key": "align",
+ "type": ["String"],
+ "desc": "复选框和内容相对位置",
+ "label": ""
+ },
+ {
+ "key": "allowUncheck",
+ "type": ["Boolean"],
+ "desc": "是否允许取消选中",
+ "label": ""
+ },
+ {
+ "key": "checked",
+ "type": ["Boolean"],
+ "desc": "是否选中",
+ "label": ""
+ },
+ {
+ "key": "color",
+ "type": ["String"],
+ "desc": "单选按钮颜色",
+ "label": ""
+ },
+ {
+ "key": "content",
+ "type": ["String"],
+ "desc": "单选内容",
+ "label": ""
+ },
+ {
+ "key": "contentDisabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用组件内容(content)触发选中",
+ "label": ""
+ },
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否为禁用态",
+ "label": ""
+ },
+ {
+ "key": "icon",
+ "type": ["String", "Array"],
+ "desc": "自定义选中图标和非选中图标。示例:[选中态图标,非选中态图标]。值为 fill-circle 表示图标为填充型图标,值为 stroke-line 表示图标为描边型图标",
+ "label": ""
+ },
+ {
+ "key": "label",
+ "type": ["String"],
+ "desc": "主文案",
+ "label": ""
+ },
+ {
+ "key": "maxContentRow",
+ "type": ["Number"],
+ "desc": "内容最大行数限制",
+ "label": ""
+ },
+ {
+ "key": "maxLabelRow",
+ "type": ["Number"],
+ "desc": "主文案最大行数限制",
+ "label": ""
+ },
+ {
+ "key": "name",
+ "type": ["String"],
+ "desc": "HTML 元素原生属性",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["String", "Number", "Boolean"],
+ "desc": "单选按钮的值",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-icon", "t-class-label", "t-class-content", "t-class-border"],
+ "events": [
+ {
+ "key": "bind:change",
+ "desc": "值变化时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./radio/radio"
+ },
+ "t-rate": {
+ "key": "t-rate",
+ "label": "评分",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-rate.png",
+ "properties": [
+ {
+ "key": "allowHalf",
+ "type": ["Boolean"],
+ "desc": "是否允许半选",
+ "label": ""
+ },
+ {
+ "key": "color",
+ "type": ["String", "Array"],
+ "desc": "评分图标的颜色,样式中默认为 #ED7B2F。一个值表示设置选中高亮的五角星颜色,示例:[选中颜色]。数组则表示分别设置 选中高亮的五角星颜色 和 未选中暗灰的五角星颜色,[选中颜色,未选中颜色]。示例:['#ED7B2F', '#E3E6EB']",
+ "label": ""
+ },
+ {
+ "key": "count",
+ "type": ["Number"],
+ "desc": "评分的数量",
+ "label": ""
+ },
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用评分",
+ "label": ""
+ },
+ {
+ "key": "gap",
+ "type": ["Number"],
+ "desc": "评分图标的间距",
+ "label": ""
+ },
+ {
+ "key": "showText",
+ "type": ["Boolean"],
+ "desc": "是否显示对应的辅助文字",
+ "label": ""
+ },
+ {
+ "key": "size",
+ "type": ["String"],
+ "desc": "评分图标的大小,示例:`20`",
+ "label": ""
+ },
+ {
+ "key": "texts",
+ "type": ["Array"],
+ "desc": "评分等级对应的辅助文字。组件内置默认值为:['极差', '失望', '一般', '满意', '惊喜']。自定义值示例:['1分', '2分', '3分', '4分', '5分']",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["Number"],
+ "desc": "选择评分的值",
+ "label": ""
+ },
+ {
+ "key": "variant",
+ "type": ["String"],
+ "desc": "形状类型,有描边类型和填充类型两种",
+ "label": ""
+ }
+ ],
+ "events": [
+ {
+ "key": "bind:change",
+ "desc": "评分数改变时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./rate/rate"
+ },
+ "t-search": {
+ "key": "t-search",
+ "label": "搜索",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-search.png",
+ "properties": [
+ {
+ "key": "action",
+ "type": ["String"],
+ "desc": "自定义右侧操作按钮文字",
+ "label": ""
+ },
+ {
+ "key": "center",
+ "type": ["Boolean"],
+ "desc": "是否居中",
+ "label": ""
+ },
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用",
+ "label": ""
+ },
+ {
+ "key": "focus",
+ "type": ["Boolean"],
+ "desc": "是否聚焦",
+ "label": ""
+ },
+ {
+ "key": "label",
+ "type": ["String"],
+ "desc": "左侧文本",
+ "label": ""
+ },
+ {
+ "key": "leftIcon",
+ "type": ["String"],
+ "desc": "左侧图标",
+ "label": ""
+ },
+ {
+ "key": "placeholder",
+ "type": ["String"],
+ "desc": "占位符",
+ "label": ""
+ },
+ {
+ "key": "rightIcon",
+ "type": ["String"],
+ "desc": "右侧图标",
+ "label": ""
+ },
+ {
+ "key": "shape",
+ "type": ["String"],
+ "desc": "搜索框形状",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["String"],
+ "desc": "值",
+ "label": ""
+ }
+ ],
+ "externalClasses": [
+ "t-class",
+ "t-class-input",
+ "t-class-input-container",
+ "t-class-cancel",
+ "t-class-left",
+ "t-class-right"
+ ],
+ "events": [
+ {
+ "key": "bind:action-click",
+ "desc": "点击右侧操作按钮文字时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:blur",
+ "desc": "失去焦点时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:change",
+ "desc": "值发生变化时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:clear",
+ "desc": "点击清除时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:focus",
+ "desc": "聚焦时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:submit",
+ "desc": "提交时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./search/search"
+ },
+ "t-skeleton": {
+ "key": "t-skeleton",
+ "label": "骨架屏",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-skeleton.png",
+ "properties": [
+ {
+ "key": "animation",
+ "type": ["String"],
+ "desc": "动画效果,有「渐变加载动画」和「闪烁加载动画」两种。值为 'none' 则表示没有动画",
+ "label": ""
+ },
+ {
+ "key": "delay",
+ "type": ["Number"],
+ "desc": "【开发中】延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒",
+ "label": ""
+ },
+ {
+ "key": "loading",
+ "type": ["Boolean"],
+ "desc": "是否为加载状态,如果是则显示骨架图,如果不是则显示加载完成的内容",
+ "label": ""
+ },
+ {
+ "key": "rowCol",
+ "type": ["Array"],
+ "desc": "用于设置行列数量、宽度高度、间距等。【示例一】,`[1, 1, 2]` 表示输出三行骨架图,第一行一列,第二行一列,第三行两列。【示例二】,`[1, 1, { width: '100px' }]` 表示自定义第三行的宽度为 `100px`。【示例三】,`[1, 2, [{ width, height }, { width, height, marginLeft }]]` 表示第三行有两列,且自定义宽度、高度和间距",
+ "label": ""
+ },
+ {
+ "key": "theme",
+ "type": ["String"],
+ "desc": "骨架图风格,有基础、头像组合等两大类",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-avatar", "t-class-image", "t-class-text"],
+ "tpl": "",
+ "path": "./skeleton/skeleton"
+ },
+ "t-slider": {
+ "key": "t-slider",
+ "label": "滑块",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-slider.png",
+ "properties": [
+ {
+ "key": "colors",
+ "type": ["Array"],
+ "desc": "颜色,[已选择, 未选择]",
+ "label": ""
+ },
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用组件",
+ "label": ""
+ },
+ {
+ "key": "disabledColor",
+ "type": ["Array"],
+ "desc": "禁用状态滑动条的颜色,[已选, 未选]",
+ "label": ""
+ },
+ {
+ "key": "label",
+ "type": ["String", "Boolean"],
+ "desc": "滑块当前值文本。
值为 true 显示默认文案;值为 false 不显示滑块当前值文本;
值为 `${value}%` 则表示组件会根据占位符渲染文案;
值类型为函数时,参数 `value` 标识滑块值,参数 `position=start` 表示范围滑块的起始值,参数 `position=end` 表示范围滑块的终点值",
+ "label": ""
+ },
+ {
+ "key": "marks",
+ "type": ["Object", "Array"],
+ "desc": "刻度标记,示例:`[0, 10, 40, 200]` 或者 `{ 5: '5¥', 10: '10%' }`",
+ "label": ""
+ },
+ {
+ "key": "max",
+ "type": ["Number"],
+ "desc": "滑块范围最大值",
+ "label": ""
+ },
+ {
+ "key": "min",
+ "type": ["Number"],
+ "desc": "滑块范围最小值",
+ "label": ""
+ },
+ {
+ "key": "range",
+ "type": ["Boolean"],
+ "desc": "双游标滑块",
+ "label": ""
+ },
+ {
+ "key": "showExtremeValue",
+ "type": ["Boolean"],
+ "desc": "是否边界值",
+ "label": ""
+ },
+ {
+ "key": "step",
+ "type": ["Number"],
+ "desc": "步长",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["Number", "Array"],
+ "desc": "滑块值",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-bar", "t-class-bar-active", "t-class-bar-disabled", "t-class-cursor"],
+ "events": [
+ {
+ "key": "bind:change",
+ "desc": "滑块值变化时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:dragend",
+ "desc": "结束拖动时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:dragstart",
+ "desc": "开始拖动时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./slider/slider"
+ },
+ "t-step-item": {
+ "key": "t-step-item",
+ "label": "步骤",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-steps.png",
+ "properties": [
+ {
+ "key": "content",
+ "type": ["String"],
+ "desc": "步骤描述",
+ "label": ""
+ },
+ {
+ "key": "icon",
+ "type": ["String"],
+ "desc": "图标。传入 slot 代表使用插槽,其他字符串代表使用内置图标",
+ "label": ""
+ },
+ {
+ "key": "status",
+ "type": ["String"],
+ "desc": "当前步骤的状态",
+ "label": ""
+ },
+ {
+ "key": "subStepItems",
+ "type": ["Array"],
+ "desc": "子步骤条,仅支持 layout = 'vertical' 时",
+ "label": ""
+ },
+ {
+ "key": "title",
+ "type": ["String"],
+ "desc": "标题",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-content", "t-class-title", "t-class-description", "t-class-extra"],
+ "tpl": "",
+ "path": "./step-item/step-item"
+ },
+ "t-stepper": {
+ "key": "t-stepper",
+ "label": "步进器",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-stepper.png",
+ "properties": [
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "禁用全部操作",
+ "label": ""
+ },
+ {
+ "key": "disableInput",
+ "type": ["Boolean"],
+ "desc": "禁用输入框",
+ "label": ""
+ },
+ {
+ "key": "inputWidth",
+ "type": ["Number"],
+ "desc": "输入框宽度",
+ "label": ""
+ },
+ {
+ "key": "max",
+ "type": ["Number"],
+ "desc": "最大值",
+ "label": ""
+ },
+ {
+ "key": "min",
+ "type": ["Number"],
+ "desc": "最小值",
+ "label": ""
+ },
+ {
+ "key": "step",
+ "type": ["Number"],
+ "desc": "步长",
+ "label": ""
+ },
+ {
+ "key": "theme",
+ "type": ["String"],
+ "desc": "组件风格",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["String", "Number"],
+ "desc": "值",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-input", "t-class-add", "t-class-minus"],
+ "events": [
+ {
+ "key": "bind:blur",
+ "desc": "输入框失去焦点时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:change",
+ "desc": "数值发生变更时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:overlimit",
+ "desc": "数值超出限制时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./stepper/stepper"
+ },
+ "t-steps": {
+ "key": "t-steps",
+ "label": "步骤条",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-steps.png",
+ "properties": [
+ {
+ "key": "current",
+ "type": ["String", "Number"],
+ "desc": "当前步骤,即整个步骤条进度。默认根据步骤下标判断步骤的完成状态,当前步骤为进行中,当前步骤之前的步骤为已完成,当前步骤之后的步骤为未开始。如果每个步骤没有设置 value,current 值为步骤长度则表示所有步骤已完成。如果每个步骤设置了自定义 value,则 current = 'FINISH' 表示所有状态完成",
+ "label": ""
+ },
+ {
+ "key": "currentStatus",
+ "type": ["String"],
+ "desc": "用于控制 current 指向的步骤条的状态",
+ "label": ""
+ },
+ {
+ "key": "layout",
+ "type": ["String"],
+ "desc": "步骤条方向,有两种:横向和纵向",
+ "label": ""
+ },
+ {
+ "key": "readonly",
+ "type": ["Boolean"],
+ "desc": "只读状态",
+ "label": ""
+ },
+ {
+ "key": "separator",
+ "type": ["String"],
+ "desc": "步骤条分割符",
+ "label": ""
+ },
+ {
+ "key": "theme",
+ "type": ["String"],
+ "desc": "步骤条风格",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class"],
+ "events": [
+ {
+ "key": "bind:change",
+ "desc": "当前步骤发生变化时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "require": {
+ "t-step-item": "./step-item/step-item"
+ },
+ "path": "./steps/steps"
+ },
+ "t-sticky": {
+ "key": "t-sticky",
+ "label": "吸顶容器",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-sticky.png",
+ "properties": [
+ {
+ "key": "container",
+ "type": ["String"],
+ "desc": "函数返回容器对应的 NodesRef 节点,将对应节点指定为组件的外部容器,滚动时组件会始终保持在容器范围内,当组件即将超出容器底部时,会返回原位置。",
+ "label": ""
+ },
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用组件",
+ "label": ""
+ },
+ {
+ "key": "offsetTop",
+ "type": ["String", "Number"],
+ "desc": "吸顶时与顶部的距离,单位`px`",
+ "label": ""
+ },
+ {
+ "key": "zIndex",
+ "type": ["Number"],
+ "desc": "吸顶时的 z-index",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class"],
+ "events": [
+ {
+ "key": "bind:scroll",
+ "desc": "滚动时触发,scrollTop: 距离顶部位置,isFixed: 是否吸顶",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./sticky/sticky"
+ },
+ "t-swipe-cell": {
+ "key": "t-swipe-cell",
+ "label": "滑动操作",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-swipecell.png",
+ "properties": [
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用滑动",
+ "label": ""
+ },
+ {
+ "key": "expanded",
+ "type": ["String"],
+ "desc": "操作项是否呈现为打开态",
+ "label": ""
+ },
+ {
+ "key": "left",
+ "type": ["Array"],
+ "desc": "左侧滑动操作项。所有行为同 `right`",
+ "label": ""
+ },
+ {
+ "key": "right",
+ "type": ["Array"],
+ "desc": "右侧滑动操作项。有两种定义方式,一种是使用数组,二种是使用插槽。`right.text` 表示操作文本,`right.className` 表示操作项类名,`right.style` 表示操作项样式,`right.onClick` 表示点击操作项后执行的回调函数。示例:`[{ text: '删除', style: 'background-color: red', onClick: () => {} }]`",
+ "label": ""
+ }
+ ],
+ "events": [
+ {
+ "key": "bind:click",
+ "desc": "操作项点击时触发(插槽写法组件不触发,业务侧自定义内容和事件)",
+ "label": ""
+ }
+ ],
+ "tpl": "删除",
+ "require": {
+ "t-cell": "./cell/cell"
+ },
+ "path": "./swipe-cell/swipe-cell"
+ },
+ "t-swiper": {
+ "key": "t-swiper",
+ "label": "轮播",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-swiper.png",
+ "properties": [
+ {
+ "key": "animation",
+ "type": ["String"],
+ "desc": "轮播切换动画效果类型",
+ "label": ""
+ },
+ {
+ "key": "autoplay",
+ "type": ["Boolean"],
+ "desc": "是否自动播放",
+ "label": ""
+ },
+ {
+ "key": "current",
+ "type": ["Number"],
+ "desc": "当前轮播在哪一项(下标)",
+ "label": ""
+ },
+ {
+ "key": "direction",
+ "type": ["String"],
+ "desc": "轮播滑动方向,包括横向滑动和纵向滑动两个方向",
+ "label": ""
+ },
+ {
+ "key": "duration",
+ "type": ["Number"],
+ "desc": "滑动动画时长",
+ "label": ""
+ },
+ {
+ "key": "height",
+ "type": ["Number"],
+ "desc": "当使用垂直方向滚动时的高度",
+ "label": ""
+ },
+ {
+ "key": "interval",
+ "type": ["Number"],
+ "desc": "轮播间隔时间",
+ "label": ""
+ },
+ {
+ "key": "loop",
+ "type": ["Boolean"],
+ "desc": "是否循环播放",
+ "label": ""
+ },
+ {
+ "key": "navigation",
+ "type": ["Object"],
+ "desc": "导航器全部配置",
+ "label": ""
+ }
+ ],
+ "events": [
+ {
+ "key": "bind:change",
+ "desc": "轮播切换时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "require": {
+ "t-swiper-item": "./swiper/swiper-item"
+ },
+ "path": "./swiper/swiper"
+ },
+ "t-switch": {
+ "key": "t-switch",
+ "label": "开关",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-switch.png",
+ "properties": [
+ {
+ "key": "colors",
+ "type": ["Array"],
+ "desc": "自定义颜色,[打开时的颜色,关闭时的颜色]。组件默认颜色为 ['#0052d9', 'rgba(0, 0, 0, .26']。示例:[blue, gray]",
+ "label": ""
+ },
+ {
+ "key": "customValue",
+ "type": ["Array"],
+ "desc": "开关内容,[打开时的值,关闭时的值]。默认为 [true, false]。示例:[1, 0]",
+ "label": ""
+ },
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用组件",
+ "label": ""
+ },
+ {
+ "key": "label",
+ "type": ["String"],
+ "desc": "开关的标签",
+ "label": ""
+ },
+ {
+ "key": "loading",
+ "type": ["Boolean"],
+ "desc": "是否处于加载中状态",
+ "label": ""
+ },
+ {
+ "key": "size",
+ "type": ["String"],
+ "desc": "开关尺寸",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["String", "Number", "Boolean"],
+ "desc": "开关值",
+ "label": ""
+ }
+ ],
+ "events": [
+ {
+ "key": "bind:change",
+ "desc": "数据发生变化时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./switch/switch"
+ },
+ "t-tab-bar-item": {
+ "key": "t-tab-bar-item",
+ "label": "标签栏选项",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-tabbar.png",
+ "properties": [
+ {
+ "key": "badgeProps",
+ "type": ["Object"],
+ "desc": "图标右上角提示信息",
+ "label": ""
+ },
+ {
+ "key": "icon",
+ "type": ["String"],
+ "desc": "图标名称",
+ "label": ""
+ },
+ {
+ "key": "subTabBar",
+ "type": ["Array"],
+ "desc": "二级菜单",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["String", "Number"],
+ "desc": "标识符",
+ "label": ""
+ }
+ ],
+ "tpl": "{{item.label}}",
+ "path": "./tab-bar-item/tab-bar-item"
+ },
+ "t-tab-bar": {
+ "key": "t-tab-bar",
+ "label": "标签栏",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-tabbar.png",
+ "properties": [
+ {
+ "key": "bordered",
+ "type": ["Boolean"],
+ "desc": "是否显示外边框",
+ "label": ""
+ },
+ {
+ "key": "color",
+ "type": ["Array"],
+ "desc": "标签颜色设置。示例:[选中标签的颜色, 未选中的标签颜色]",
+ "label": ""
+ },
+ {
+ "key": "fixed",
+ "type": ["Boolean"],
+ "desc": "是否固定在底部",
+ "label": ""
+ },
+ {
+ "key": "safeAreaInsetBottom",
+ "type": ["Boolean"],
+ "desc": "是否为 iPhoneX 留出底部安全距离",
+ "label": ""
+ },
+ {
+ "key": "split",
+ "type": ["Boolean"],
+ "desc": "是否需要分割线",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["String", "Number", "Array"],
+ "desc": "当前选中标签的索引",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class"],
+ "events": [
+ {
+ "key": "bind:change",
+ "desc": "选中标签切换时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "{{item.label}}",
+ "require": {
+ "t-tab-bar-item": "./tab-bar-item/tab-bar-item"
+ },
+ "path": "./tab-bar/tab-bar"
+ },
+ "t-tab-panel": {
+ "key": "t-tab-panel",
+ "label": "选项卡面板",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-tabs.png",
+ "properties": [
+ {
+ "key": "destroyOnHide",
+ "type": ["Boolean"],
+ "desc": "选项卡内容隐藏时是否销毁",
+ "label": ""
+ },
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用当前选项卡",
+ "label": ""
+ },
+ {
+ "key": "label",
+ "type": ["String"],
+ "desc": "选项卡名称",
+ "label": ""
+ },
+ {
+ "key": "panel",
+ "type": ["String"],
+ "desc": "用于自定义选项卡面板内容",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["String", "Number"],
+ "desc": "选项卡的值,唯一标识",
+ "label": ""
+ }
+ ],
+ "tpl": "标签一内容",
+ "path": "./tab-panel/tab-panel"
+ },
+ "t-tabs": {
+ "key": "t-tabs",
+ "label": "选项卡",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-tabs.png",
+ "properties": [
+ {
+ "key": "animation",
+ "type": ["Object"],
+ "desc": "动画效果设置。其中 duration 表示动画时长",
+ "label": ""
+ },
+ {
+ "key": "placement",
+ "type": ["String"],
+ "desc": "选项卡位置",
+ "label": ""
+ },
+ {
+ "key": "showBottomLine",
+ "type": ["Boolean"],
+ "desc": "是否展示底部激活线条",
+ "label": ""
+ },
+ {
+ "key": "stickyProps",
+ "type": ["Object"],
+ "desc": "是否支持吸顶",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["String", "Number"],
+ "desc": "激活的选项卡值",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-item", "t-class-active", "t-class-track"],
+ "events": [
+ {
+ "key": "bind:change",
+ "desc": "激活的选项卡发生变化时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "标签一内容标签二内容",
+ "require": {
+ "t-tab-panel": "./tab-panel/tab-panel"
+ },
+ "path": "./tabs/tabs"
+ },
+ "t-tag": {
+ "key": "t-tag",
+ "label": "标签",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-tag.png",
+ "properties": [
+ {
+ "key": "closable",
+ "type": ["Boolean"],
+ "desc": "标签是否可关闭",
+ "label": ""
+ },
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态",
+ "label": ""
+ },
+ {
+ "key": "icon",
+ "type": ["String"],
+ "desc": "标签中的图标,可自定义图标呈现",
+ "label": ""
+ },
+ {
+ "key": "maxWidth",
+ "type": ["String", "Number"],
+ "desc": "标签最大宽度,宽度超出后会出现省略号。示例:'50px' / 80",
+ "label": ""
+ },
+ {
+ "key": "shape",
+ "type": ["String"],
+ "desc": "标签类型,有三种:方形、圆角方形、标记型",
+ "label": ""
+ },
+ {
+ "key": "size",
+ "type": ["String"],
+ "desc": "标签尺寸",
+ "label": ""
+ },
+ {
+ "key": "theme",
+ "type": ["String"],
+ "desc": "组件风格,用于描述组件不同的应用场景",
+ "label": ""
+ },
+ {
+ "key": "variant",
+ "type": ["String"],
+ "desc": "标签风格变体",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class"],
+ "events": [
+ {
+ "key": "bind:click",
+ "desc": "点击时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:close",
+ "desc": "如果关闭按钮存在,点击关闭按钮时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "重要",
+ "path": "./tag/tag"
+ },
+ "t-textarea": {
+ "key": "t-textarea",
+ "label": "文本输入框",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-textarea.png",
+ "properties": [
+ {
+ "key": "adjustPosition",
+ "type": ["Boolean"],
+ "desc": "键盘弹起时,是否自动上推页面",
+ "label": ""
+ },
+ {
+ "key": "autofocus",
+ "type": ["Boolean"],
+ "desc": "自动聚焦,拉起键盘",
+ "label": ""
+ },
+ {
+ "key": "autosize",
+ "type": ["Boolean"],
+ "desc": "是否自动增高,值为 autosize 时,style.height 不生效",
+ "label": ""
+ },
+ {
+ "key": "confirmHold",
+ "type": ["Boolean"],
+ "desc": "点击键盘右下角按钮时是否保持键盘不收起点",
+ "label": ""
+ },
+ {
+ "key": "confirmType",
+ "type": ["String"],
+ "desc": "设置键盘右下角按钮的文字,仅在 type='text'时生效",
+ "label": ""
+ },
+ {
+ "key": "disabled",
+ "type": ["Boolean"],
+ "desc": "是否禁用文本框",
+ "label": ""
+ },
+ {
+ "key": "focus",
+ "type": ["Boolean"],
+ "desc": "自动聚焦",
+ "label": ""
+ },
+ {
+ "key": "label",
+ "type": ["String"],
+ "desc": "左侧文本",
+ "label": ""
+ },
+ {
+ "key": "maxcharacter",
+ "type": ["Number"],
+ "desc": "用户最多可以输入的字符个数,一个中文汉字表示两个字符长度",
+ "label": ""
+ },
+ {
+ "key": "maxlength",
+ "type": ["Number"],
+ "desc": "用户最多可以输入的字符个数",
+ "label": ""
+ },
+ {
+ "key": "placeholder",
+ "type": ["String"],
+ "desc": "占位符",
+ "label": ""
+ },
+ {
+ "key": "value",
+ "type": ["String"],
+ "desc": "文本框值",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class", "t-class-textarea", "t-class-placeholder", "t-class-name"],
+ "events": [
+ {
+ "key": "bind:blur",
+ "desc": "失去焦点时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:change",
+ "desc": "输入内容变化时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:enter",
+ "desc": "点击完成时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:focus",
+ "desc": "获得焦点时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:line-change",
+ "desc": "行高发生变化时触发",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./textarea/textarea"
+ },
+ "t-toast": {
+ "key": "t-toast",
+ "label": "轻提示",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-toast.png",
+ "properties": [
+ {
+ "key": "direction",
+ "type": ["String"],
+ "desc": "图标排列方式",
+ "label": ""
+ },
+ {
+ "key": "duration",
+ "type": ["Number"],
+ "desc": "弹窗显示毫秒数",
+ "label": ""
+ },
+ {
+ "key": "icon",
+ "type": ["String"],
+ "desc": "自定义图标",
+ "label": ""
+ },
+ {
+ "key": "message",
+ "type": ["String"],
+ "desc": "弹窗显示文字",
+ "label": ""
+ },
+ {
+ "key": "overlayProps",
+ "type": ["Object"],
+ "desc": "遮罩层属性,透传至 Overlay",
+ "label": ""
+ },
+ {
+ "key": "placement",
+ "type": ["String"],
+ "desc": "弹窗展示位置",
+ "label": ""
+ },
+ {
+ "key": "preventScrollThrough",
+ "type": ["Boolean"],
+ "desc": "防止滚动穿透,即不允许点击和滚动",
+ "label": ""
+ },
+ {
+ "key": "showOverlay",
+ "type": ["Boolean"],
+ "desc": "是否显示遮罩层",
+ "label": ""
+ },
+ {
+ "key": "theme",
+ "type": ["String"],
+ "desc": "提示类型",
+ "label": ""
+ }
+ ],
+ "externalClasses": ["t-class"],
+ "tpl": "",
+ "path": "./toast/toast"
+ },
+ "t-transition": {
+ "key": "t-transition",
+ "label": "动画",
+ "icon": "",
+ "properties": [
+ {
+ "key": "appear",
+ "type": ["Boolean"],
+ "desc": "首次出现是否展示动画",
+ "label": ""
+ },
+ {
+ "key": "customClass",
+ "type": ["String"],
+ "desc": "自定义容器类名",
+ "label": ""
+ },
+ {
+ "key": "destoryOnClose",
+ "type": ["Boolean"],
+ "desc": "隐藏时是否销毁内容",
+ "label": ""
+ },
+ {
+ "key": "duration",
+ "type": ["Number"],
+ "desc": "指定过渡时间",
+ "label": ""
+ },
+ {
+ "key": "name",
+ "type": ["String"],
+ "desc": "过渡类名",
+ "label": ""
+ },
+ {
+ "key": "visible",
+ "type": ["Boolean"],
+ "desc": "是否显示",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./transition/transition"
+ },
+ "t-upload": {
+ "key": "t-upload",
+ "label": "上传",
+ "icon": "https://tdesign.gtimg.com/site/miniprogram-doc/doc-upload.png",
+ "properties": [
+ {
+ "key": "addContent",
+ "type": ["String"],
+ "desc": "添加按钮内容。值为空,使用默认图标渲染;值为 slot 则表示使用插槽渲染;其他值无效。",
+ "label": ""
+ },
+ {
+ "key": "allowUploadDuplicateFile",
+ "type": ["Boolean"],
+ "desc": "是否允许重复上传相同文件名的文件",
+ "label": ""
+ },
+ {
+ "key": "config",
+ "type": ["Object"],
+ "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": ""
+ },
+ {
+ "key": "deleteBtn",
+ "type": ["String"],
+ "desc": "删除图标。值为空,使用默认图标渲染;值为 slot 则表示使用插槽渲染;其他值无效。",
+ "label": ""
+ },
+ {
+ "key": "fileListDisplay",
+ "type": ["String"],
+ "desc": "用于完全自定义文件列表内容",
+ "label": ""
+ },
+ {
+ "key": "files",
+ "type": ["Array"],
+ "desc": "已上传文件列表",
+ "label": ""
+ },
+ {
+ "key": "gridConfig",
+ "type": ["Object"],
+ "desc": "upload组件每行上传图片列数以及图片的宽度和高度",
+ "label": ""
+ },
+ {
+ "key": "gutter",
+ "type": ["Number"],
+ "desc": "预览窗格的 `gutter` 大小,单位 rpx",
+ "label": ""
+ },
+ {
+ "key": "imageProps",
+ "type": ["Object"],
+ "desc": "透传 Image 组件全部属性",
+ "label": ""
+ },
+ {
+ "key": "max",
+ "type": ["Number"],
+ "desc": "用于控制文件上传数量,值为 0 则不限制",
+ "label": ""
+ },
+ {
+ "key": "mediaType",
+ "type": ["Array"],
+ "desc": "支持上传的文件类型,图片或视频",
+ "label": ""
+ },
+ {
+ "key": "requestMethod",
+ "type": ["String"],
+ "desc": "自定义上传方法",
+ "label": ""
+ },
+ {
+ "key": "sizeLimit",
+ "type": ["Number", "Object"],
+ "desc": "图片文件大小限制,单位 KB。可选单位有:`'B' | 'KB' | 'MB' | 'GB'`。示例一:`1000`。示例二:`{ size: 2, unit: 'MB', message: '图片大小不超过 {sizeLimit} MB' }`",
+ "label": ""
+ }
+ ],
+ "events": [
+ {
+ "key": "bind:add",
+ "desc": "上传成功后触发,仅包含本次选择的照片;`url` 表示选定视频的临时文件路径 (本地路径)。`duration` 表示选定视频的时间长度。`size`选定视频的数据量大小。更多描述参考 wx.chooseMedia 小程序官网描述",
+ "label": ""
+ },
+ {
+ "key": "bind:complete",
+ "desc": "上传成功或失败后触发",
+ "label": ""
+ },
+ {
+ "key": "bind:fail",
+ "desc": "上传失败后触发",
+ "label": ""
+ },
+ {
+ "key": "bind:remove",
+ "desc": "移除文件时触发",
+ "label": ""
+ },
+ {
+ "key": "bind:select-change",
+ "desc": "选择文件或图片之后,上传之前,触发该事件。
`files` 表示之前已经上传完成的文件列表。
`currentSelectedFiles` 表示本次上传选中的文件列表",
+ "label": ""
+ },
+ {
+ "key": "bind:success",
+ "desc": "上传成功后触发,包含所有上传的文件;`url` 表示选定视频的临时文件路径 (本地路径)。`duration` 表示选定视频的时间长度。`size`选定视频的数据量大小。更多描述参考 wx.chooseMedia 小程序官网描述",
+ "label": ""
+ }
+ ],
+ "tpl": "",
+ "path": "./upload/upload"
+ }
+ },
+ "common": {
+ "properties": {},
+ "events": {}
+ },
+ "menu": [
+ {
+ "key": "menu-basic",
+ "label": "基础",
+ "submenu": [
+ {
+ "key": "subMenu-button",
+ "label": "Button 按钮",
+ "components": ["t-button"]
+ },
+ {
+ "key": "subMenu-divider",
+ "label": "Divider 分割线",
+ "components": ["t-divider"]
+ },
+ {
+ "key": "subMenu-fab",
+ "label": "Fab 悬浮按钮",
+ "components": ["t-fab"]
+ },
+ {
+ "key": "subMenu-icon",
+ "label": "Icon 图标",
+ "components": ["t-icon"]
+ }
+ ]
+ },
+ {
+ "key": "menu-nav",
+ "label": "导航",
+ "submenu": [
+ {
+ "key": "subMenu-drawer",
+ "label": "Drawer 抽屉",
+ "components": ["t-drawer"]
+ },
+ {
+ "key": "subMenu-indexes",
+ "label": "Indexes 索引",
+ "components": ["t-indexes"]
+ },
+ {
+ "key": "subMenu-navbar",
+ "label": "Navbar 导航条",
+ "components": ["t-navbar"]
+ },
+ {
+ "key": "subMenu-steps",
+ "label": "Steps 步骤条",
+ "components": ["t-steps"]
+ },
+ {
+ "key": "subMenu-tabbar",
+ "label": "TabBar 标签栏",
+ "components": ["t-tab-bar"]
+ },
+ {
+ "key": "subMenu-tabs",
+ "label": "Tabs 选项卡",
+ "components": ["t-tabs"]
+ }
+ ]
+ },
+ {
+ "key": "menu-input",
+ "label": "输入",
+ "submenu": [
+ {
+ "key": "subMenu-checkbox",
+ "label": "CheckBox 复选框",
+ "components": ["t-checkbox"]
+ },
+ {
+ "key": "subMenu-dateTimePicker",
+ "label": "DateTimePicker 时间选择器",
+ "components": ["t-date-time-picker"]
+ },
+ {
+ "key": "subMenu-input",
+ "label": "Input 输入框",
+ "components": ["t-input"]
+ },
+ {
+ "key": "subMenu-picker",
+ "label": "Picker 选择器",
+ "components": ["t-picker"]
+ },
+ {
+ "key": "subMenu-radio",
+ "label": "Radio 单选框",
+ "components": ["t-radio"]
+ },
+ {
+ "key": "subMenu-rate",
+ "label": "Rate 评分",
+ "components": ["t-rate"]
+ },
+ {
+ "key": "subMenu-search",
+ "label": "Search 搜索框",
+ "components": ["t-search"]
+ },
+ {
+ "key": "subMenu-slider",
+ "label": "Slider 滑动选择器",
+ "components": ["t-slider"]
+ },
+ {
+ "key": "subMenu-stepper",
+ "label": "Stepper 步进器",
+ "components": ["t-stepper"]
+ },
+ {
+ "key": "subMenu-switch",
+ "label": "Switch 开关",
+ "components": ["t-switch"]
+ },
+ {
+ "key": "subMenu-textarea",
+ "label": "Textarea 多行文本框",
+ "components": ["t-textarea"]
+ },
+ {
+ "key": "subMenu-upload",
+ "label": "UpLoad 上传",
+ "components": ["t-upload"]
+ }
+ ]
+ },
+ {
+ "key": "menu-data",
+ "label": "数据展示",
+ "submenu": [
+ {
+ "key": "subMenu-avatar",
+ "label": "Avatar 头像",
+ "components": ["t-avatar"]
+ },
+ {
+ "key": "subMenu-badge",
+ "label": "Badge 徽标",
+ "components": ["t-badge"]
+ },
+ {
+ "key": "subMenu-cell",
+ "label": "Cell 单元格",
+ "components": ["t-cell"]
+ },
+ {
+ "key": "subMenu-collapse",
+ "label": "Collapse 折叠面板",
+ "components": ["t-collapse"]
+ },
+ {
+ "key": "subMenu-dropdown-menu",
+ "label": "DropdownMenu 下拉菜单",
+ "components": ["t-dropdown-menu"]
+ },
+ {
+ "key": "subMenu-empty",
+ "label": "Empty 空状态",
+ "components": ["t-empty"]
+ },
+ {
+ "key": "subMenu-footer",
+ "label": "Footer 页脚",
+ "components": ["t-footer"]
+ },
+ {
+ "key": "subMenu-grid",
+ "label": "Grid 宫格",
+ "components": ["t-grid"]
+ },
+ {
+ "key": "subMenu-image",
+ "label": "Image 图片",
+ "components": ["t-image"]
+ },
+ {
+ "key": "subMenu-skeleton",
+ "label": "Skeleton 骨架屏",
+ "components": ["t-skeleton"]
+ },
+ {
+ "key": "subMenu-sticky",
+ "label": "Sticky 吸顶容器",
+ "components": ["t-sticky"]
+ },
+ {
+ "key": "subMenu-swiper",
+ "label": "Swiper 轮播图",
+ "components": ["t-swiper"]
+ },
+ {
+ "key": "subMenu-tag",
+ "label": "Tag 标签",
+ "components": ["t-tag"]
+ }
+ ]
+ },
+ {
+ "key": "menu-info",
+ "label": "消息提醒",
+ "submenu": [
+ {
+ "key": "subMenu-actionsheet",
+ "label": "ActionSheet 动作面板",
+ "components": ["t-action-sheet"]
+ },
+ {
+ "key": "subMenu-back-top",
+ "label": "BackTop 返回顶部",
+ "components": ["t-back-top"]
+ },
+ {
+ "key": "subMenu-dialog",
+ "label": "Dialog 弹出框",
+ "components": ["t-dialog"]
+ },
+ {
+ "key": "subMenu-loading",
+ "label": "Loading 加载",
+ "components": ["t-loading"]
+ },
+ {
+ "key": "subMenu-message",
+ "label": "Message 消息通知",
+ "components": ["t-message"]
+ },
+ {
+ "key": "subMenu-popup",
+ "label": "Popup 弹出层",
+ "components": ["t-popup"]
+ },
+ {
+ "key": "subMenu-progress",
+ "label": "Progress 进度条",
+ "components": ["t-progress"]
+ },
+ {
+ "key": "subMenu-pullDownRefresh",
+ "label": "PullDownRefresh 下拉刷新",
+ "components": ["t-pull-down-refresh"]
+ },
+ {
+ "key": "subMenu-swipeCell",
+ "label": "SwipeCell 滑动操作",
+ "components": ["t-swipe-cell"]
+ },
+ {
+ "key": "subMenu-toast",
+ "label": "Toast 轻提示",
+ "components": ["t-toast"]
+ }
+ ]
+ }
+ ]
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/action-sheet/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/action-sheet/README.en-US.md
index 0c84067..c2e750e 100644
--- a/miniprogram_npm/tdesign-miniprogram/action-sheet/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/action-sheet/README.en-US.md
@@ -1,17 +1,23 @@
:: BASE_DOC ::
## API
+
### ActionSheet Props
name | type | default | description | required
-- | -- | -- | -- | --
-align | String | center | `0.29.0`。options:center/left | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+align | String | center | `0.29.0`。options: center/left | N
cancel-text | String | - | \- | N
count | Number | 8 | \- | N
description | String | - | `0.29.0` | N
-items | Array | - | required。Typescript:`Array` `interface ActionSheetItem {label: string; color?: string; disabled?: boolean }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts) | Y
+items | Array | - | required。Typescript:`Array` `interface ActionSheetItem {label: string; color?: string; disabled?: boolean;icon?: string;suffixIcon?: string; }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts) | Y
+popup-props | Object | {} | Typescript:`PopupProps`,[Popup API Documents](./popup?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts) | N
show-cancel | Boolean | true | \- | N
-theme | String | list | options:list/grid | N
+show-overlay | Boolean | true | \- | N
+theme | String | list | options: list/grid | N
+using-custom-navbar | Boolean | false | \- | N
visible | Boolean | false | required | Y
default-visible | Boolean | undefined | required。uncontrolled property | Y
@@ -22,3 +28,25 @@ name | params | description
cancel | \- | \-
close | `(trigger: TriggerSource)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts)。
`type TriggerSource = 'overlay' \| 'command' \| 'select' `
selected | `(selected: ActionSheetItem \| string, index: number)` | \-
+### ActionSheet External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-cancel | \-
+t-class-content | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-action-sheet-border-color | @gray-color-1 | -
+--td-action-sheet-border-radius | @radius-extra-large | -
+--td-action-sheet-cancel-color | @font-gray-1 | -
+--td-action-sheet-cancel-height | 96rpx | -
+--td-action-sheet-color | @font-gray-1 | -
+--td-action-sheet-description-color | @font-gray-3 | -
+--td-action-sheet-list-item-disabled-color | @font-gray-4 | -
+--td-action-sheet-list-item-height | 112rpx | -
+--td-action-sheet-text-align | center | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/action-sheet/README.md b/miniprogram_npm/tdesign-miniprogram/action-sheet/README.md
index 1ba2bab..97d176a 100644
--- a/miniprogram_npm/tdesign-miniprogram/action-sheet/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/action-sheet/README.md
@@ -26,6 +26,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
列表型动作面板
@@ -83,20 +89,25 @@ handler.close();
## API
+
### ActionSheet Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
align | String | center | `0.29.0`。水平对齐方式。可选项:center/left | N
cancel-text | String | - | 设置取消按钮的文本 | N
count | Number | 8 | 设置每页展示菜单的数量,仅当 type=grid 时有效 | N
description | String | - | `0.29.0`。动作面板描述文字 | N
-items | Array | - | 必需。菜单项。TS 类型:`Array` `interface ActionSheetItem {label: string; color?: string; disabled?: boolean }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts) | Y
+items | Array | - | 必需。菜单项。TS 类型:`Array` `interface ActionSheetItem {label: string; color?: string; disabled?: boolean;icon?: string;suffixIcon?: string; }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts) | Y
+popup-props | Object | {} | popupProps透传。TS 类型:`PopupProps`,[Popup API Documents](./popup?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts) | N
show-cancel | Boolean | true | 是否显示取消按钮 | N
+show-overlay | Boolean | true | 是否显示遮罩层 | N
theme | String | list | 展示类型,列表和表格形式展示。可选项:list/grid | N
+using-custom-navbar | Boolean | false | 是否使用了自定义导航栏 | N
visible | Boolean | false | 必需。显示与隐藏 | Y
default-visible | Boolean | undefined | 必需。显示与隐藏。非受控属性 | Y
-external-classes | Array | - | 组件类名,用于设置组件外层元素类名。`['t-class', 't-class-content', 't-class-cancel']` | N
### ActionSheet Events
@@ -105,3 +116,25 @@ external-classes | Array | - | 组件类名,用于设置组件外层元素类
cancel | \- | 点击取消按钮时触发
close | `(trigger: TriggerSource)` | 关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts)。
`type TriggerSource = 'overlay' \| 'command' \| 'select' `
selected | `(selected: ActionSheetItem \| string, index: number)` | 选择菜单项时触发
+### ActionSheet External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-cancel | 取消样式类
+t-class-content | 内容样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-action-sheet-border-color | @gray-color-1 | -
+--td-action-sheet-border-radius | @radius-extra-large | -
+--td-action-sheet-cancel-color | @font-gray-1 | -
+--td-action-sheet-cancel-height | 96rpx | -
+--td-action-sheet-color | @font-gray-1 | -
+--td-action-sheet-description-color | @font-gray-3 | -
+--td-action-sheet-list-item-disabled-color | @font-gray-4 | -
+--td-action-sheet-list-item-height | 112rpx | -
+--td-action-sheet-text-align | center | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.d.ts b/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.d.ts
index dd4d4bf..924dfe5 100644
--- a/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.d.ts
@@ -1,6 +1,7 @@
import { SuperComponent } from '../common/src/index';
export default class ActionSheet extends SuperComponent {
static show: (options: import("./show").ActionSheetShowOption) => WechatMiniprogram.Component.TrivialInstance;
+ behaviors: string[];
externalClasses: string[];
properties: {
align?: {
@@ -22,22 +23,37 @@ export default class ActionSheet extends SuperComponent {
items: {
type: ArrayConstructor;
value?: (string | import("./type").ActionSheetItem)[];
+ required?: boolean;
+ };
+ popupProps?: {
+ type: ObjectConstructor;
+ value?: import("../popup").TdPopupProps;
};
showCancel?: {
type: BooleanConstructor;
value?: boolean;
};
+ showOverlay?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
theme?: {
type: StringConstructor;
value?: "list" | "grid";
};
+ usingCustomNavbar?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
visible: {
type: BooleanConstructor;
value?: boolean;
+ required?: boolean;
};
defaultVisible: {
type: BooleanConstructor;
value?: boolean;
+ required?: boolean;
};
};
data: {
@@ -45,6 +61,8 @@ export default class ActionSheet extends SuperComponent {
classPrefix: string;
gridThemeItems: any[];
currentSwiperIndex: number;
+ defaultPopUpProps: {};
+ defaultPopUpzIndex: number;
};
controlledProps: {
key: string;
diff --git a/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.js b/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.js
index aa8ba4d..c20b865 100644
--- a/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.js
+++ b/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.js
@@ -9,11 +9,13 @@ import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import { ActionSheetTheme, show } from './show';
import props from './props';
+import useCustomNavbar from '../mixins/using-custom-navbar';
const { prefix } = config;
const name = `${prefix}-action-sheet`;
let ActionSheet = class ActionSheet extends SuperComponent {
constructor() {
super(...arguments);
+ this.behaviors = [useCustomNavbar];
this.externalClasses = [`${prefix}-class`, `${prefix}-class-content`, `${prefix}-class-cancel`];
this.properties = Object.assign({}, props);
this.data = {
@@ -21,6 +23,8 @@ let ActionSheet = class ActionSheet extends SuperComponent {
classPrefix: name,
gridThemeItems: [],
currentSwiperIndex: 0,
+ defaultPopUpProps: {},
+ defaultPopUpzIndex: 11500,
};
this.controlledProps = [
{
@@ -73,12 +77,18 @@ let ActionSheet = class ActionSheet extends SuperComponent {
const realIndex = isSwiperMode ? index + currentSwiperIndex * count : index;
if (item) {
this.triggerEvent('selected', { selected: item, index: realIndex });
- this.trigger('close', { trigger: 'select' });
- this._trigger('visible-change', { visible: false });
+ if (!item.disabled) {
+ this.triggerEvent('close', { trigger: 'select' });
+ this._trigger('visible-change', { visible: false });
+ }
}
},
onCancel() {
this.triggerEvent('cancel');
+ if (this.autoClose) {
+ this.setData({ visible: false });
+ this.autoClose = false;
+ }
},
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.json b/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.json
index c1eb33e..70f0a29 100644
--- a/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.json
+++ b/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.json
@@ -1,10 +1,10 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon",
"t-popup": "../popup/popup",
"t-grid": "../grid/grid",
- "t-grid-item": "../grid-item/grid-item",
- "t-swiper-nav": "../swiper-nav/swiper-nav"
+ "t-grid-item": "../grid-item/grid-item"
}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.wxml b/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.wxml
index bf8d757..3928217 100644
--- a/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.wxml
@@ -4,7 +4,15 @@
-
+
-
diff --git a/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.wxss b/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.wxss
index e9ad6bb..c647d5a 100644
--- a/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/action-sheet/action-sheet.wxss
@@ -26,7 +26,7 @@
transform: scale(1.5);
}
.t-action-sheet__content {
- color: var(--td-action-sheet-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-action-sheet-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
border-top-left-radius: var(--td-action-sheet-border-radius, var(--td-radius-extra-large, 24rpx));
border-top-right-radius: var(--td-action-sheet-border-radius, var(--td-radius-extra-large, 24rpx));
background-color: var(--td-bg-color-container, var(--td-font-white-1, #ffffff));
@@ -45,7 +45,7 @@
padding-bottom: 48rpx;
}
.t-action-sheet__description {
- color: var(--td-action-sheet-description-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-action-sheet-description-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
line-height: 44rpx;
font-size: 28rpx;
text-align: var(--td-action-sheet-text-align, center);
@@ -63,7 +63,7 @@
bottom: 0;
left: unset;
right: unset;
- background-color: var(--td-action-sheet-border-color, var(--td-gray-color-1, #f3f3f3));
+ background-color: var(--td-action-sheet-border-color, var(--td-border-level-1-color, var(--td-gray-color-3, #e7e7e7)));
}
.t-action-sheet__description::after {
height: 1px;
@@ -93,7 +93,7 @@
bottom: 0;
left: unset;
right: unset;
- background-color: var(--td-action-sheet-border-color, var(--td-gray-color-1, #f3f3f3));
+ background-color: var(--td-action-sheet-border-color, var(--td-border-level-1-color, var(--td-gray-color-3, #e7e7e7)));
}
.t-action-sheet__list-item::after {
height: 1px;
@@ -111,7 +111,7 @@
left: 32rpx;
}
.t-action-sheet__list-item--disabled {
- color: var(--td-action-sheet-list-item-disabled-color, var(--td-font-gray-4, rgba(0, 0, 0, 0.26)));
+ color: var(--td-action-sheet-list-item-disabled-color, var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26))));
}
.t-action-sheet__list-item-text {
font-size: var(--td-font-size-m, 32rpx);
@@ -123,6 +123,9 @@
.t-action-sheet__list-item-icon {
margin-right: 16rpx;
}
+.t-action-sheet__list-item-icon--suffix {
+ margin-left: auto;
+}
.t-action-sheet__swiper-wrap {
margin-top: 8rpx;
position: relative;
@@ -132,16 +135,17 @@
}
.t-action-sheet__gap-list {
height: 16rpx;
- background-color: var(--td-action-sheet-border-color, var(--td-gray-color-1, #f3f3f3));
+ background-color: var(--td-action-sheet-gap-color, var(--td-bg-color-page, var(--td-gray-color-1, #f3f3f3)));
}
.t-action-sheet__gap-grid {
height: 1rpx;
- background-color: var(--td-action-sheet-border-color, var(--td-gray-color-1, #f3f3f3));
+ background-color: var(--td-action-sheet-border-color, var(--td-border-level-1-color, var(--td-gray-color-3, #e7e7e7)));
}
.t-action-sheet__cancel {
display: flex;
align-items: center;
justify-content: center;
+ color: var(--td-action-sheet-cancel-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
height: var(--td-action-sheet-cancel-height, 96rpx);
}
.t-action-sheet__dots {
@@ -163,7 +167,3 @@
.t-action-sheet__dots-item.t-is-active {
background-color: #0052d9;
}
-.t-action-sheet__safe {
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
-}
diff --git a/miniprogram_npm/tdesign-miniprogram/action-sheet/index.d.ts b/miniprogram_npm/tdesign-miniprogram/action-sheet/index.d.ts
index de46874..5c41389 100644
--- a/miniprogram_npm/tdesign-miniprogram/action-sheet/index.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/action-sheet/index.d.ts
@@ -1,3 +1,8 @@
-import ActionSheet from './action-sheet';
-export * from './show';
-export default ActionSheet;
+///
+import { ActionSheetItem, ActionSheetTheme, ActionSheetShowOption } from './show';
+export { ActionSheetItem, ActionSheetTheme, ActionSheetShowOption };
+declare const _default: {
+ show(options: ActionSheetShowOption): WechatMiniprogram.Component.TrivialInstance;
+ close(options: ActionSheetShowOption): void;
+};
+export default _default;
diff --git a/miniprogram_npm/tdesign-miniprogram/action-sheet/index.js b/miniprogram_npm/tdesign-miniprogram/action-sheet/index.js
index de46874..7fcdd3c 100644
--- a/miniprogram_npm/tdesign-miniprogram/action-sheet/index.js
+++ b/miniprogram_npm/tdesign-miniprogram/action-sheet/index.js
@@ -1,3 +1,10 @@
-import ActionSheet from './action-sheet';
-export * from './show';
-export default ActionSheet;
+import { show, close, ActionSheetTheme } from './show';
+export { ActionSheetTheme };
+export default {
+ show(options) {
+ return show(options);
+ },
+ close(options) {
+ return close(options);
+ },
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/action-sheet/props.js b/miniprogram_npm/tdesign-miniprogram/action-sheet/props.js
index c89fa9e..5a86e41 100644
--- a/miniprogram_npm/tdesign-miniprogram/action-sheet/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/action-sheet/props.js
@@ -5,7 +5,7 @@ const props = {
},
cancelText: {
type: String,
- value: '取消',
+ value: '',
},
count: {
type: Number,
@@ -17,22 +17,37 @@ const props = {
},
items: {
type: Array,
+ required: true,
+ },
+ popupProps: {
+ type: Object,
+ value: {},
},
showCancel: {
type: Boolean,
value: true,
},
+ showOverlay: {
+ type: Boolean,
+ value: true,
+ },
theme: {
type: String,
value: 'list',
},
+ usingCustomNavbar: {
+ type: Boolean,
+ value: false,
+ },
visible: {
type: Boolean,
value: null,
+ required: true,
},
defaultVisible: {
type: Boolean,
value: false,
+ required: true,
},
};
export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/action-sheet/show.d.ts b/miniprogram_npm/tdesign-miniprogram/action-sheet/show.d.ts
index e0d8eae..824502a 100644
--- a/miniprogram_npm/tdesign-miniprogram/action-sheet/show.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/action-sheet/show.d.ts
@@ -12,13 +12,15 @@ export declare enum ActionSheetTheme {
Grid = "grid"
}
interface ActionSheetProps {
- visible: boolean;
- items: Array;
- defaultVisible?: boolean;
+ align: 'center' | 'left';
cancelText?: string;
count?: number;
+ description: string;
+ items: Array;
showCancel?: boolean;
theme?: ActionSheetTheme;
+ visible: boolean;
+ defaultVisible?: boolean;
}
export interface ActionSheetShowOption extends Omit {
context?: Context;
diff --git a/miniprogram_npm/tdesign-miniprogram/action-sheet/template/grid.wxml b/miniprogram_npm/tdesign-miniprogram/action-sheet/template/grid.wxml
index bdc595e..8f6f20d 100644
--- a/miniprogram_npm/tdesign-miniprogram/action-sheet/template/grid.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/action-sheet/template/grid.wxml
@@ -8,9 +8,10 @@
wx:key="index"
bind:tap="onSelect"
data-index="{{index}}"
- icon="{{item.icon}}"
- text="{{item.label}}"
- image="{{item.image}}"
+ icon="{{ { name: item.icon, color: item.color } }}"
+ text="{{item.label || ''}}"
+ image="{{item.image || ''}}"
+ style="--td-grid-item-text-color: {{item.color}}"
>
@@ -27,9 +28,10 @@
wx:key="index"
data-index="{{index}}"
bind:tap="onSelect"
- icon="{{item.icon}}"
- text="{{item.label}}"
- image="{{item.image}}"
+ icon="{{ { name: item.icon, color: item.color } }}"
+ text="{{item.label || ''}}"
+ image="{{item.image || ''}}"
+ style="--td-grid-item-text-color: {{item.color}}"
>
diff --git a/miniprogram_npm/tdesign-miniprogram/action-sheet/template/list.wxml b/miniprogram_npm/tdesign-miniprogram/action-sheet/template/list.wxml
index 37e5dcf..04f2e34 100644
--- a/miniprogram_npm/tdesign-miniprogram/action-sheet/template/list.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/action-sheet/template/list.wxml
@@ -10,5 +10,11 @@
>
{{item.label || item}}
+
diff --git a/miniprogram_npm/tdesign-miniprogram/action-sheet/type.d.ts b/miniprogram_npm/tdesign-miniprogram/action-sheet/type.d.ts
index f77a8fb..3fb8bdc 100644
--- a/miniprogram_npm/tdesign-miniprogram/action-sheet/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/action-sheet/type.d.ts
@@ -1,3 +1,4 @@
+import { PopupProps } from '../popup/index';
export interface TdActionSheetProps {
align?: {
type: StringConstructor;
@@ -18,26 +19,43 @@ export interface TdActionSheetProps {
items: {
type: ArrayConstructor;
value?: Array;
+ required?: boolean;
+ };
+ popupProps?: {
+ type: ObjectConstructor;
+ value?: PopupProps;
};
showCancel?: {
type: BooleanConstructor;
value?: boolean;
};
+ showOverlay?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
theme?: {
type: StringConstructor;
value?: 'list' | 'grid';
};
+ usingCustomNavbar?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
visible: {
type: BooleanConstructor;
value?: boolean;
+ required?: boolean;
};
defaultVisible: {
type: BooleanConstructor;
value?: boolean;
+ required?: boolean;
};
}
export interface ActionSheetItem {
label: string;
color?: string;
disabled?: boolean;
+ icon?: string;
+ suffixIcon?: string;
}
diff --git a/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.d.ts b/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.d.ts
index c9f9ba6..e131442 100644
--- a/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.d.ts
@@ -23,6 +23,6 @@ export default class AvatarGroup extends SuperComponent {
methods: {
setClass(): void;
handleMax(): void;
- handleChildCascading(): void;
+ onCollapsedItemClick(e: WechatMiniprogram.CustomEvent): void;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.js b/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.js
index b1d4563..f85c574 100644
--- a/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.js
+++ b/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.js
@@ -38,7 +38,6 @@ let AvatarGroup = class AvatarGroup extends SuperComponent {
length: this.$children.length,
});
this.handleMax();
- this.handleChildCascading();
},
};
this.observers = {
@@ -53,7 +52,8 @@ let AvatarGroup = class AvatarGroup extends SuperComponent {
const classList = [
name,
`${prefix}-class`,
- `${name}-offset-${direction}-${size.indexOf('px') > -1 ? 'medium' : size}`,
+ `${name}-offset-${direction}`,
+ `${name}-offset-${direction}-${size.indexOf('px') > -1 ? 'medium' : size || 'medium'}`,
];
this.setData({
className: classList.join(' '),
@@ -69,13 +69,8 @@ let AvatarGroup = class AvatarGroup extends SuperComponent {
child.hide();
});
},
- handleChildCascading() {
- if (this.properties.cascading === 'right-up')
- return;
- const defaultZIndex = 100;
- this.$children.forEach((child, index) => {
- child.updateCascading(defaultZIndex - index * 10);
- });
+ onCollapsedItemClick(e) {
+ this.triggerEvent('collapsed-item-click', e.detail);
},
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.json b/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.json
index 9f58d25..9b5763d 100644
--- a/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.json
+++ b/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "shared",
"usingComponents": {
"t-avatar": "../avatar/avatar"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.wxml b/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.wxml
index 26929f2..1e2f6cd 100644
--- a/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/avatar-group/avatar-group.wxml
@@ -7,11 +7,12 @@
-
+
{{collapseAvatar}} 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 头像类型
图片头像
@@ -55,33 +61,91 @@ isComponent: true
{{ size }}
## API
+
### Avatar Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
alt | String | - | 头像替换文本,仅当图片加载失败时有效 | 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
bordered | Boolean | false | 已废弃。是否显示外边框 | N
-external-classes | Array | - | 组件类名,用于设置组件外层元素类名。`['t-class', 't-class-image', 't-class-icon', 't-class-alt', 't-class-content']` | N
hide-on-load-failed | Boolean | false | 加载失败时隐藏图片 | N
icon | String / Object | - | 图标。值为字符串表示图标名称,值为 `Object` 类型,表示透传至 `icon`。 | N
image | String | - | 图片地址 | N
-image-props | Object | - | 透传至 Image 组件 | N
-shape | String | circle | 形状。可选项:circle/round。TS 类型:`ShapeEnum ` `type ShapeEnum = 'circle' \| 'round'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/avatar/type.ts) | N
-size | String | medium | 尺寸,示例值:small/medium/large/24px/38px 等 | N
+image-props | Object | - | 透传至 Image 组件。TS 类型:`ImageProps`,[Image API Documents](./image?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/avatar/type.ts) | N
+shape | String | - | 形状。优先级高于 AvatarGroup.shape 。Avatar 单独存在时,默认值为 circle。如果父组件 AvatarGroup 存在,默认值便由 AvatarGroup.shape 决定。可选项:circle/round。TS 类型:`ShapeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+size | String | - | 尺寸,示例值:small/medium/large/24px/38px 等。优先级高于 AvatarGroup.size 。Avatar 单独存在时,默认值为 medium。如果父组件 AvatarGroup 存在,默认值便由 AvatarGroup.size 决定 | N
### Avatar Events
名称 | 参数 | 描述
-- | -- | --
-error | \- | 图片加载失败时触发
+error | - | 图片加载失败时触发
+
+### Avatar External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-alt | 替代文本样式类
+t-class-content | 内容样式类
+t-class-icon | 图标样式类
+t-class-image | 图片样式类
+
### AvatarGroup Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
cascading | String | 'left-up' | 图片之间的层叠关系,可选值:左侧图片在上和右侧图片在上。可选项:left-up/right-up。TS 类型:`CascadingValue` `type CascadingValue = 'left-up' \| 'right-up'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/avatar-group/type.ts) | N
-collapse-avatar | String / Slot | - | 头像数量超出时,会出现一个头像折叠元素。该元素内容可自定义。默认为 `+N`。示例:`+5`,`...`, `更多` | N
-external-classes | Array | - | 组件类名,用于设置组件外层元素类名。`['t-class', 't-class-image', 't-class-content']` | N
+collapse-avatar | String / Slot | - | 头像数量超出时,会出现一个头像折叠元素。该元素内容可自定义。默认为 `+N`。示例:`+5`,`...`, `更多`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
max | Number | - | 能够同时显示的最多头像数量 | N
-size | String | medium | 尺寸,示例值:small/medium/large/24px/38px 等。优先级低于 Avatar.size | N
+shape | String | - | 形状。优先级低于 Avatar.shape。可选项:circle/round。TS 类型:`ShapeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+size | String | - | 尺寸,示例值:small/medium/large/24px/38px 等。优先级低于 Avatar.size | N
+
+### AvatarGroup Events
+
+名称 | 参数 | 描述
+-- | -- | --
+collapsed-item-click | - | 点击头像折叠元素触发
+
+### AvatarGroup External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-content | 内容样式类
+t-class-image | 图片样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-avatar-group-init-z-index | @avatar-group-init-zIndex) - @i | -
+--td-avatar-group-line-spacing | 4rpx | -
+--td-avatar-group-margin-left-large | -16rpx | -
+--td-avatar-group-margin-left-medium | -16rpx | -
+--td-avatar-group-margin-left-small | -16rpx | -
+--td-avatar-bg-color | @brand-color-light-active | -
+--td-avatar-border-color | #fff | -
+--td-avatar-border-width-large | 6rpx | -
+--td-avatar-border-width-medium | 4rpx | -
+--td-avatar-border-width-small | 2rpx | -
+--td-avatar-circle-border-radius | @radius-circle | -
+--td-avatar-content-color | @brand-color | -
+--td-avatar-icon-large-font-size | 64rpx | -
+--td-avatar-icon-medium-font-size | 48rpx | -
+--td-avatar-icon-small-font-size | 40rpx | -
+--td-avatar-large-width | 128rpx | -
+--td-avatar-margin-left | 0 | -
+--td-avatar-medium-width | 96rpx | -
+--td-avatar-round-border-radius | @radius-default | -
+--td-avatar-small-width | 80rpx | -
+--td-avatar-text-large-font-size | @font-size-xl | -
+--td-avatar-text-medium-font-size | @font-size-m | -
+--td-avatar-text-small-font-size | @font-size-base | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/avatar/avatar.d.ts b/miniprogram_npm/tdesign-miniprogram/avatar/avatar.d.ts
index f25f03d..b4536dc 100644
--- a/miniprogram_npm/tdesign-miniprogram/avatar/avatar.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/avatar/avatar.d.ts
@@ -9,7 +9,6 @@ export default class Avatar extends SuperComponent {
classPrefix: string;
isShow: boolean;
zIndex: number;
- bordered: boolean;
};
relations: RelationsOptions;
observers: {
@@ -17,7 +16,6 @@ export default class Avatar extends SuperComponent {
};
methods: {
hide(): void;
- updateCascading(zIndex: any): void;
onLoadError(e: WechatMiniprogram.CustomEvent): void;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/avatar/avatar.js b/miniprogram_npm/tdesign-miniprogram/avatar/avatar.js
index 29f7288..9f5c7c1 100644
--- a/miniprogram_npm/tdesign-miniprogram/avatar/avatar.js
+++ b/miniprogram_npm/tdesign-miniprogram/avatar/avatar.js
@@ -15,7 +15,6 @@ let Avatar = class Avatar extends SuperComponent {
super(...arguments);
this.options = {
multipleSlots: true,
- styleIsolation: 'apply-shared',
};
this.externalClasses = [
`${prefix}-class`,
@@ -30,16 +29,15 @@ let Avatar = class Avatar extends SuperComponent {
classPrefix: name,
isShow: true,
zIndex: 0,
- bordered: false,
};
this.relations = {
'../avatar-group/avatar-group': {
type: 'ancestor',
linked(parent) {
- var _a;
this.parent = parent;
this.setData({
- size: (_a = this.data.size) !== null && _a !== void 0 ? _a : parent.data.size,
+ shape: this.data.shape || parent.data.shape || 'circle',
+ size: this.data.size || parent.data.size,
bordered: true,
});
},
@@ -57,9 +55,6 @@ let Avatar = class Avatar extends SuperComponent {
isShow: false,
});
},
- updateCascading(zIndex) {
- this.setData({ zIndex });
- },
onLoadError(e) {
if (this.properties.hideOnLoadFailed) {
this.setData({
diff --git a/miniprogram_npm/tdesign-miniprogram/avatar/avatar.json b/miniprogram_npm/tdesign-miniprogram/avatar/avatar.json
index 4461d94..15361c2 100644
--- a/miniprogram_npm/tdesign-miniprogram/avatar/avatar.json
+++ b/miniprogram_npm/tdesign-miniprogram/avatar/avatar.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "shared",
"usingComponents": {
"t-icon": "../icon/icon",
"t-badge": "../badge/badge",
diff --git a/miniprogram_npm/tdesign-miniprogram/avatar/avatar.wxml b/miniprogram_npm/tdesign-miniprogram/avatar/avatar.wxml
index e908f5a..3f6e679 100644
--- a/miniprogram_npm/tdesign-miniprogram/avatar/avatar.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/avatar/avatar.wxml
@@ -4,7 +4,7 @@
diff --git a/miniprogram_npm/tdesign-miniprogram/avatar/avatar.wxs b/miniprogram_npm/tdesign-miniprogram/avatar/avatar.wxs
index d67e5d8..50476e4 100644
--- a/miniprogram_npm/tdesign-miniprogram/avatar/avatar.wxs
+++ b/miniprogram_npm/tdesign-miniprogram/avatar/avatar.wxs
@@ -18,9 +18,7 @@ module.exports = {
}
},
- getStyles: function (isShow, zIndex) {
- var displayStyle = isShow ? '' : 'display: none;';
- var zIndexStyle = zIndex ? 'z-index:' + zIndex + ';' : '';
- return displayStyle + zIndexStyle;
+ getStyles: function (isShow) {
+ return isShow ? '' : 'display: none;';
},
};
diff --git a/miniprogram_npm/tdesign-miniprogram/avatar/avatar.wxss b/miniprogram_npm/tdesign-miniprogram/avatar/avatar.wxss
index b1c3697..5d1b506 100644
--- a/miniprogram_npm/tdesign-miniprogram/avatar/avatar.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/avatar/avatar.wxss
@@ -42,7 +42,7 @@
.t-avatar--large {
width: var(--td-avatar-large-width, 128rpx);
height: var(--td-avatar-large-width, 128rpx);
- font-size: var(--td-avatar-text-large-font-size, 16px);
+ font-size: var(--td-avatar-text-large-font-size, var(--td-font-size-xl, 40rpx));
}
.t-avatar--large .t-avatar__icon {
font-size: var(--td-avatar-icon-large-font-size, 64rpx);
@@ -50,7 +50,7 @@
.t-avatar--medium {
width: var(--td-avatar-medium-width, 96rpx);
height: var(--td-avatar-medium-width, 96rpx);
- font-size: var(--td-avatar-text-medium-font-size, var(--td-font-size-base, 28rpx));
+ font-size: var(--td-avatar-text-medium-font-size, var(--td-font-size-m, 32rpx));
}
.t-avatar--medium .t-avatar__icon {
font-size: var(--td-avatar-icon-medium-font-size, 48rpx);
@@ -58,7 +58,7 @@
.t-avatar--small {
width: var(--td-avatar-small-width, 80rpx);
height: var(--td-avatar-small-width, 80rpx);
- font-size: var(--td-avatar-text-small-font-size, var(--td-font-size-s, 24rpx));
+ font-size: var(--td-avatar-text-small-font-size, var(--td-font-size-base, 28rpx));
}
.t-avatar--small .t-avatar__icon {
font-size: var(--td-avatar-icon-small-font-size, 40rpx);
@@ -94,11 +94,11 @@
border-style: solid;
}
.t-avatar--border-small {
- border-width: var(--td-avatar-border-width-small, 4rpx);
+ border-width: var(--td-avatar-border-width-small, 2rpx);
}
.t-avatar--border-medium {
- border-width: var(--td-avatar-border-width-medium, 6rpx);
+ border-width: var(--td-avatar-border-width-medium, 4rpx);
}
.t-avatar--border-large {
- border-width: var(--td-avatar-border-width-large, 8rpx);
+ border-width: var(--td-avatar-border-width-large, 6rpx);
}
diff --git a/miniprogram_npm/tdesign-miniprogram/avatar/props.js b/miniprogram_npm/tdesign-miniprogram/avatar/props.js
index bd83025..9aba4c5 100644
--- a/miniprogram_npm/tdesign-miniprogram/avatar/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/avatar/props.js
@@ -10,9 +10,6 @@ const props = {
type: Boolean,
value: false,
},
- externalClasses: {
- type: Array,
- },
hideOnLoadFailed: {
type: Boolean,
value: false,
@@ -29,11 +26,10 @@ const props = {
},
shape: {
type: String,
- value: 'circle',
},
size: {
type: String,
- value: 'medium',
+ value: '',
},
};
export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/avatar/type.d.ts b/miniprogram_npm/tdesign-miniprogram/avatar/type.d.ts
index 07dfe75..79cac9d 100644
--- a/miniprogram_npm/tdesign-miniprogram/avatar/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/avatar/type.d.ts
@@ -1,4 +1,6 @@
import { BadgeProps } from '../badge/index';
+import { ImageProps } from '../image/index';
+import { ShapeEnum } from '../common/common';
export interface TdAvatarProps {
alt?: {
type: StringConstructor;
@@ -12,14 +14,6 @@ export interface TdAvatarProps {
type: BooleanConstructor;
value?: boolean;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-image', 't-class-icon', 't-class-alt', 't-class-content'];
- };
hideOnLoadFailed?: {
type: BooleanConstructor;
value?: boolean;
@@ -34,7 +28,7 @@ export interface TdAvatarProps {
};
imageProps?: {
type: ObjectConstructor;
- value?: object;
+ value?: ImageProps;
};
shape?: {
type: StringConstructor;
@@ -45,4 +39,3 @@ export interface TdAvatarProps {
value?: string;
};
}
-export declare type ShapeEnum = 'circle' | 'round';
diff --git a/miniprogram_npm/tdesign-miniprogram/back-top/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/back-top/README.en-US.md
index c75a4b5..558178c 100644
--- a/miniprogram_npm/tdesign-miniprogram/back-top/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/back-top/README.en-US.md
@@ -6,14 +6,36 @@
name | type | default | description | required
-- | -- | -- | -- | --
-external-classes | Array | - | `['t-class', 't-class-icon', 't-class-text']` | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
fixed | Boolean | true | \- | N
-icon | String / Boolean / Object / Slot | - | \- | N
+icon | String / Boolean / Object / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+scroll-top | Number | 0 | \- | N
text | String | '' | \- | N
-theme | String | round | options:round/half-round/round-dark/half-round-dark | N
+theme | String | round | options: round/half-round/round-dark/half-round-dark | N
+visibility-height | Number | 200 | \- | N
### BackTop Events
name | params | description
-- | -- | --
to-top | \- | \-
+### BackTop External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-icon | \-
+t-class-text | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-back-top-round-bg-color | @font-white-1 | -
+--td-back-top-round-border-color | @component-border | -
+--td-back-top-round-border-radius | @radius-circle | -
+--td-back-top-round-color | @font-gray-1 | -
+--td-back-top-round-dark-bg-color | @gray-color-14 | -
+--td-back-top-round-dark-color | @font-white-1 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/back-top/README.md b/miniprogram_npm/tdesign-miniprogram/back-top/README.md
index 7e220e4..50b2c28 100644
--- a/miniprogram_npm/tdesign-miniprogram/back-top/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/back-top/README.md
@@ -18,6 +18,13 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
+
### 基础返回顶部
@@ -25,18 +32,41 @@ isComponent: true
{{ base }}
## API
+
### BackTop Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-external-classes | Array | - | 组件类名,分别用于设置外层元素、图标、文本内容等元素类名。`['t-class', 't-class-icon', 't-class-text']` | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
fixed | Boolean | true | 是否绝对定位固定到屏幕右下方 | N
-icon | String / Boolean / Object / Slot | true | 图标。值为 `false` 表示不显示图标。不传表示使用默认图标 `'backtop'` | N
+icon | String / Boolean / Object / Slot | true | 图标。值为 `false` 表示不显示图标。不传表示使用默认图标 `'backtop'`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+scroll-top | Number | 0 | 页面滚动距离 | N
text | String | '' | 文案 | N
theme | String | round | 预设的样式类型。可选项:round/half-round/round-dark/half-round-dark | N
+visibility-height | Number | 200 | 滚动高度达到此参数值才出现 | N
### BackTop Events
名称 | 参数 | 描述
-- | -- | --
to-top | \- | 点击触发
+### BackTop External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-icon | 图标样式类
+t-class-text | 文本样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-back-top-round-bg-color | @font-white-1 | -
+--td-back-top-round-border-color | @component-border | -
+--td-back-top-round-border-radius | @radius-circle | -
+--td-back-top-round-color | @font-gray-1 | -
+--td-back-top-round-dark-bg-color | @gray-color-14 | -
+--td-back-top-round-dark-color | @font-white-1 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/back-top/back-top.d.ts b/miniprogram_npm/tdesign-miniprogram/back-top/back-top.d.ts
index 90e8f03..ced948c 100644
--- a/miniprogram_npm/tdesign-miniprogram/back-top/back-top.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/back-top/back-top.d.ts
@@ -10,9 +10,11 @@ export default class BackTop extends SuperComponent {
prefix: string;
classPrefix: string;
_icon: any;
+ hidden: boolean;
};
observers: {
icon(): void;
+ scrollTop(value: number): void;
};
lifetimes: {
ready(): void;
diff --git a/miniprogram_npm/tdesign-miniprogram/back-top/back-top.js b/miniprogram_npm/tdesign-miniprogram/back-top/back-top.js
index 8c2ce59..a14d94c 100644
--- a/miniprogram_npm/tdesign-miniprogram/back-top/back-top.js
+++ b/miniprogram_npm/tdesign-miniprogram/back-top/back-top.js
@@ -27,11 +27,16 @@ let BackTop = class BackTop extends SuperComponent {
prefix,
classPrefix: name,
_icon: null,
+ hidden: true,
};
this.observers = {
icon() {
this.setIcon();
},
+ scrollTop(value) {
+ const { visibilityHeight } = this.properties;
+ this.setData({ hidden: value < visibilityHeight });
+ },
};
this.lifetimes = {
ready() {
@@ -50,6 +55,7 @@ let BackTop = class BackTop extends SuperComponent {
this.triggerEvent('to-top');
if (this.$parent) {
(_a = this.$parent) === null || _a === void 0 ? void 0 : _a.setScrollTop(0);
+ this.setData({ hidden: true });
}
else {
wx.pageScrollTo({
diff --git a/miniprogram_npm/tdesign-miniprogram/back-top/back-top.json b/miniprogram_npm/tdesign-miniprogram/back-top/back-top.json
index 049940c..f783dae 100644
--- a/miniprogram_npm/tdesign-miniprogram/back-top/back-top.json
+++ b/miniprogram_npm/tdesign-miniprogram/back-top/back-top.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/back-top/back-top.wxml b/miniprogram_npm/tdesign-miniprogram/back-top/back-top.wxml
index 1d02278..3d119aa 100644
--- a/miniprogram_npm/tdesign-miniprogram/back-top/back-top.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/back-top/back-top.wxml
@@ -6,6 +6,7 @@
class="class {{prefix}}-class {{_.cls(classPrefix, [['fixed', fixed], theme])}}"
bindtap="toTop"
aria-role="button"
+ hidden="{{hidden}}"
>
diff --git a/miniprogram_npm/tdesign-miniprogram/back-top/back-top.wxss b/miniprogram_npm/tdesign-miniprogram/back-top/back-top.wxss
index 3ec2469..7907024 100644
--- a/miniprogram_npm/tdesign-miniprogram/back-top/back-top.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/back-top/back-top.wxss
@@ -39,7 +39,7 @@
.t-back-top--fixed {
position: fixed;
right: var(--td-spacer, 16rpx);
- bottom: var(--td-spacer-2, 32rpx);
+ bottom: calc(var(--td-spacer-2, 32rpx) + env(safe-area-inset-bottom));
}
.t-back-top--round,
.t-back-top--round-dark {
@@ -49,20 +49,22 @@
}
.t-back-top--round,
.t-back-top--half-round {
- color: var(--td-back-top-round-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-back-top-round-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
border: 1rpx solid var(--td-back-top-round-border-color, var(--td-component-border, var(--td-gray-color-4, #dcdcdc)));
- background-color: var(--td-back-top-round-bg-color, var(--td-font-white-1, #ffffff));
+ background-color: var(--td-back-top-round-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
}
.t-back-top--round-dark,
.t-back-top--half-round-dark {
- color: var(--td-back-top-round-dark-color, var(--td-font-white-1, #ffffff));
- background-color: var(--td-back-top-round-dark-bg-color, var(--td-gray-color-14, #181818));
+ color: var(--td-back-top-round-dark-color, var(--td-text-color-anti, var(--td-font-white-1, #ffffff)));
+ background-color: var(--td-back-top-round-dark-bg-color, var(--td-gray-color-13, #242424));
}
.t-back-top--half-round,
.t-back-top--half-round-dark {
width: 120rpx;
height: 80rpx;
- border-radius: var(--td-back-top-half-round-border-radius, var(--td-radius-round, 999px)) 0 0 var(--td-back-top-half-round-border-radius, var(--td-radius-round, 999px));
+ border-radius: 0;
+ border-top-left-radius: var(--td-back-top-half-round-border-radius, var(--td-radius-round, 999px));
+ border-bottom-left-radius: var(--td-back-top-half-round-border-radius, var(--td-radius-round, 999px));
flex-direction: row;
right: 0;
}
@@ -75,7 +77,7 @@
}
.t-back-top__text--half-round,
.t-back-top__text--half-round-dark {
- width: 2em;
+ width: 48rpx;
}
.t-back-top__icon:not(:empty) + .t-back-top__text--half-round,
.t-back-top__icon:not(:empty) + .t-back-top__text--half-round-dark {
diff --git a/miniprogram_npm/tdesign-miniprogram/back-top/props.js b/miniprogram_npm/tdesign-miniprogram/back-top/props.js
index 7becbe4..d6d8121 100644
--- a/miniprogram_npm/tdesign-miniprogram/back-top/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/back-top/props.js
@@ -1,7 +1,4 @@
const props = {
- externalClasses: {
- type: Array,
- },
fixed: {
type: Boolean,
value: true,
@@ -10,6 +7,14 @@ const props = {
type: null,
value: true,
},
+ scrollTop: {
+ type: Number,
+ value: 0,
+ },
+ style: {
+ type: String,
+ value: '',
+ },
text: {
type: String,
value: '',
@@ -18,5 +23,9 @@ const props = {
type: String,
value: 'round',
},
+ visibilityHeight: {
+ type: Number,
+ value: 200,
+ },
};
export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/back-top/type.d.ts b/miniprogram_npm/tdesign-miniprogram/back-top/type.d.ts
index 45b6bae..9071651 100644
--- a/miniprogram_npm/tdesign-miniprogram/back-top/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/back-top/type.d.ts
@@ -1,19 +1,19 @@
export interface TdBackTopProps {
- style?: {
- type: StringConstructor;
- value?: string;
- };
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-icon', 't-class-text'];
- };
fixed?: {
type: BooleanConstructor;
value?: boolean;
};
icon?: {
type: null;
- value?: boolean | string | object;
+ value?: string | boolean | object;
+ };
+ scrollTop?: {
+ type: NumberConstructor;
+ value?: number;
+ };
+ style?: {
+ type: StringConstructor;
+ value?: string;
};
text?: {
type: StringConstructor;
@@ -23,4 +23,8 @@ export interface TdBackTopProps {
type: StringConstructor;
value?: 'round' | 'half-round' | 'round-dark' | 'half-round-dark';
};
+ visibilityHeight?: {
+ type: NumberConstructor;
+ value?: number;
+ };
}
diff --git a/miniprogram_npm/tdesign-miniprogram/badge/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/badge/README.en-US.md
index f592805..05103dc 100644
--- a/miniprogram_npm/tdesign-miniprogram/badge/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/badge/README.en-US.md
@@ -1,17 +1,45 @@
:: BASE_DOC ::
## API
+
### Badge Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
color | String | - | \- | N
content | String | - | \- | N
-count | String / Number / Slot | 0 | \- | N
+count | String / Number / Slot | 0 | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
dot | Boolean | false | \- | N
-external-classes | Array | - | `['t-class', 't-class-content', 't-class-count']` | N
max-count | Number | 99 | \- | N
offset | Array | - | Typescript:`Array` | N
-shape | String | circle | options:circle/round/ribbon/bubble | N
+shape | String | circle | options: circle/square/bubble/ribbon | N
show-zero | Boolean | false | \- | N
-size | String | medium | options:small/medium | N
+size | String | medium | options: medium/large | N
+### Badge External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-content | \-
+t-class-count | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-badge-basic-height | 32rpx | -
+--td-badge-basic-padding | 8rpx | -
+--td-badge-basic-width | 32rpx | -
+--td-badge-bg-color | @error-color | -
+--td-badge-border-radius | 4rpx | -
+--td-badge-bubble-border-radius | 20rpx 20rpx 20rpx 1px | -
+--td-badge-dot-size | 16rpx | -
+--td-badge-font-size | @font-size-xs | -
+--td-badge-font-weight | 600 | -
+--td-badge-large-font-size | @font-size-s | -
+--td-badge-large-height | 40rpx | -
+--td-badge-large-padding | 10rpx | -
+--td-badge-text-color | @font-white-1 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/badge/README.md b/miniprogram_npm/tdesign-miniprogram/badge/README.md
index 7d1bf08..a253b93 100644
--- a/miniprogram_npm/tdesign-miniprogram/badge/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/badge/README.md
@@ -18,6 +18,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
{{ base }}
@@ -30,18 +36,51 @@ isComponent: true
{{ size }}
+## FAQ
+
+### 如何处理由 ribbon 徽标溢出导致页面出现横向滚动?
+角标溢出问题建议从父容器组件处理。如 #3063 ,可以给父容器 `cell` 组件添加 `overflow: hidden`,处理溢出造成页面出现横向滚动的问题。
+
## API
+
### Badge Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
color | String | - | 颜色 | N
content | String | - | 徽标内容,示例:`content='自定义内容'`。也可以使用默认插槽定义 | N
-count | String / Number / Slot | 0 | 徽标右上角内容。可以是数字,也可以是文字。如:'new'/3/99+。特殊:值为空表示使用插槽渲染 | N
+count | String / Number / Slot | 0 | 徽标右上角内容。可以是数字,也可以是文字。如:'new'/3/99+。特殊:值为空表示使用插槽渲染。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
dot | Boolean | false | 是否为红点 | N
-external-classes | Array | - | 组件类名,分别用于设置外层元素、默认内容、右上角内容等元素类名。`['t-class', 't-class-content', 't-class-count']` | N
max-count | Number | 99 | 封顶的数字值 | N
offset | Array | - | 设置状态点的位置偏移,示例:[-10, 20] 或 ['10em', '8rem']。TS 类型:`Array` | N
-shape | String | circle | 形状。可选项:circle/round/ribbon/bubble | N
+shape | String | circle | 形状。可选项:circle/square/bubble/ribbon | N
show-zero | Boolean | false | 当数值为 0 时,是否展示徽标 | N
-size | String | medium | 尺寸。可选项:small/medium | N
+size | String | medium | 尺寸。可选项:medium/large | N
+### Badge External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-content | 内容样式类
+t-class-count | 计数样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-badge-basic-height | 32rpx | -
+--td-badge-basic-padding | 8rpx | -
+--td-badge-basic-width | 32rpx | -
+--td-badge-bg-color | @error-color | -
+--td-badge-border-radius | 4rpx | -
+--td-badge-bubble-border-radius | 20rpx 20rpx 20rpx 1px | -
+--td-badge-dot-size | 16rpx | -
+--td-badge-font-size | @font-size-xs | -
+--td-badge-font-weight | 600 | -
+--td-badge-large-font-size | @font-size-s | -
+--td-badge-large-height | 40rpx | -
+--td-badge-large-padding | 10rpx | -
+--td-badge-text-color | @font-white-1 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/badge/badge.json b/miniprogram_npm/tdesign-miniprogram/badge/badge.json
index a7a3e7a..4f0a3f0 100644
--- a/miniprogram_npm/tdesign-miniprogram/badge/badge.json
+++ b/miniprogram_npm/tdesign-miniprogram/badge/badge.json
@@ -1,5 +1,5 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {}
}
-
diff --git a/miniprogram_npm/tdesign-miniprogram/badge/badge.wxml b/miniprogram_npm/tdesign-miniprogram/badge/badge.wxml
index 51fea40..abc57b7 100644
--- a/miniprogram_npm/tdesign-miniprogram/badge/badge.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/badge/badge.wxml
@@ -1,6 +1,12 @@
+
+
{{content}}
{{ this.getBadgeValue({dot, count, maxCount}) }}
+ aria-label="{{ ariaLabel || _.getBadgeAriaLabel({dot, count, maxCount}) }}"
+ >
+ {{ this.getBadgeValue({dot, count, maxCount}) }}
diff --git a/miniprogram_npm/tdesign-miniprogram/badge/badge.wxs b/miniprogram_npm/tdesign-miniprogram/badge/badge.wxs
index c2aaad9..b3064d8 100644
--- a/miniprogram_npm/tdesign-miniprogram/badge/badge.wxs
+++ b/miniprogram_npm/tdesign-miniprogram/badge/badge.wxs
@@ -26,7 +26,7 @@ var getBadgeStyles = function (props) {
styleStr += 'background:' + props.color + ';';
}
if (props.offset[0]) {
- styleStr += 'right:' + (hasUnit(props.offset[0].toString()) ? props.offset[0] : props.offset[0] + 'px') + ';';
+ styleStr += 'left: calc(100% + ' + (hasUnit(props.offset[0].toString()) ? props.offset[0] : props.offset[0] + 'px') + ');';
}
if (props.offset[1]) {
styleStr += 'top:' + (hasUnit(props.offset[1].toString()) ? props.offset[1] : props.offset[1] + 'px') + ';';
@@ -63,22 +63,8 @@ var isShowBadge = function (props) {
return true;
};
-var getBadgeAriaLabel = function (props) {
- if (props.dot) {
- return '有新的消息';
- }
- if (isNaN(props.count) || isNaN(props.maxCount)) {
- var str = '有' + props.count + '通知';
- return str;
- }
- var str1 = '有' + props.maxCount + '+条消息';
- var str2 = '有' + props.count + '条消息';
- return parseInt(props.count) > props.maxCount ? str1 : str2;
-};
-
module.exports.getBadgeValue = getBadgeValue;
module.exports.getBadgeStyles = getBadgeStyles;
module.exports.getBadgeOuterClass = getBadgeOuterClass;
module.exports.getBadgeInnerClass = getBadgeInnerClass;
-module.exports.getBadgeAriaLabel = getBadgeAriaLabel;
module.exports.isShowBadge = isShowBadge;
diff --git a/miniprogram_npm/tdesign-miniprogram/badge/badge.wxss b/miniprogram_npm/tdesign-miniprogram/badge/badge.wxss
index 5d4ba33..5398f03 100644
--- a/miniprogram_npm/tdesign-miniprogram/badge/badge.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/badge/badge.wxss
@@ -27,14 +27,14 @@
}
.t-badge {
position: relative;
- display: inline-block;
- vertical-align: top;
+ display: inline-flex;
+ align-items: start;
}
.t-badge--basic {
z-index: 100;
padding: 0 var(--td-badge-basic-padding, 8rpx);
font-size: var(--td-badge-font-size, var(--td-font-size-xs, var(--td-font-size, 20rpx)));
- color: var(--td-badge-text-color, var(--td-font-white-1, #ffffff));
+ color: var(--td-badge-text-color, var(--td-text-color-anti, var(--td-font-white-1, #ffffff)));
background-color: var(--td-badge-bg-color, var(--td-error-color, var(--td-error-color-6, #d54941)));
text-align: center;
height: var(--td-badge-basic-height, 32rpx);
@@ -62,28 +62,28 @@
right: 0;
}
.t-badge--ribbon {
+ position: relative;
display: inline-block;
- transform: rotate(45deg);
+ transform-origin: center center;
+ transform: translate(calc(50% - var(--td-badge-basic-height, 32rpx) + 1rpx), calc(-50% + var(--td-badge-basic-height, 32rpx) - 1rpx)) rotate(45deg);
border-radius: 0;
}
-.t-badge--ribbon::before {
- content: '';
- position: absolute;
- width: 0;
- height: 0;
- bottom: 0;
- left: calc(-1 * var(--td-badge-basic-height, 32rpx) + 1rpx);
- border-bottom: var(--td-badge-basic-height, 32rpx) solid var(--td-badge-bg-color, var(--td-error-color, var(--td-error-color-6, #d54941)));
- border-left: var(--td-badge-basic-height, 32rpx) solid transparent;
-}
+.t-badge--ribbon::before,
.t-badge--ribbon::after {
content: '';
position: absolute;
width: 0;
height: 0;
bottom: 0;
- right: calc(-1 * var(--td-badge-basic-height, 32rpx) + 1rpx);
border-bottom: var(--td-badge-basic-height, 32rpx) solid var(--td-badge-bg-color, var(--td-error-color, var(--td-error-color-6, #d54941)));
+ font-size: 0;
+}
+.t-badge--ribbon::before {
+ left: calc(-1 * var(--td-badge-basic-height, 32rpx) + 1rpx);
+ border-left: var(--td-badge-basic-height, 32rpx) solid transparent;
+}
+.t-badge--ribbon::after {
+ right: calc(-1 * var(--td-badge-basic-height, 32rpx) + 1rpx);
border-right: var(--td-badge-basic-height, 32rpx) solid transparent;
}
.t-badge--bubble {
@@ -100,12 +100,14 @@
border-radius: calc(var(--td-badge-large-height, 40rpx) / 2);
}
.t-badge__content:not(:empty) + .t-has-count {
- transform: translate(50%, -50%);
+ transform-origin: center center;
+ transform: translate(-50%, -50%);
position: absolute;
- right: 0;
+ left: 100%;
top: 0;
}
.t-badge__content-text {
display: block;
line-height: 48rpx;
+ color: var(--td-badge-content-text-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
diff --git a/miniprogram_npm/tdesign-miniprogram/badge/type.d.ts b/miniprogram_npm/tdesign-miniprogram/badge/type.d.ts
index 30f00d0..2029271 100644
--- a/miniprogram_npm/tdesign-miniprogram/badge/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/badge/type.d.ts
@@ -11,10 +11,6 @@ export interface TdBadgeProps {
type: null;
value?: string | number;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
dot?: {
type: BooleanConstructor;
value?: boolean;
@@ -33,7 +29,7 @@ export interface TdBadgeProps {
};
shape?: {
type: StringConstructor;
- value?: 'circle' | 'round' | 'ribbon' | 'bubble';
+ value?: 'circle' | 'square' | 'bubble' | 'ribbon';
};
showZero?: {
type: BooleanConstructor;
@@ -41,6 +37,6 @@ export interface TdBadgeProps {
};
size?: {
type: StringConstructor;
- value?: 'small' | 'medium';
+ value?: 'medium' | 'large';
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/button/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/button/README.en-US.md
index ee2b1d7..fbd8440 100644
--- a/miniprogram_npm/tdesign-miniprogram/button/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/button/README.en-US.md
@@ -1,46 +1,233 @@
-:: BASE_DOC ::
+---
+title: Button
+description: Buttons are used to open a closed-loop task, such as "delete" an object, "buy" an item, etc.
+spline: base
+isComponent: true
+---
+
+


+
+
+## Usage
+
+For global import, configure it in `app.json` in the root directory of the miniprogram. For local import, configure it in `index.json` of the page or component that needs to be imported.
+
+```json
+"usingComponents": {
+ "t-button": "tdesign-miniprogram/button/button"
+}
+```
+
+
+## Code Demo
+
+### 01 Component Type
+
+#### Basic Buttons
+
+{{ base }}
+
+#### Icon Button
+
+{{ icon-btn }}
+
+#### Ghost Button
+
+{{ ghost-btn }}
+
+#### Combination Button
+
+{{ group-btn }}
+
+#### Banner Button
+
+{{ block-btn }}
+
+### 02 Component State
+
+#### Buttons for different states
+
+{{ disabled }}
+
+### 03 Component Style
+
+#### Different sizes of buttons
+
+{{ size }}
+
+#### Different shaped buttons
+
+{{ shape }}
+
+#### Different color theme buttons
+
+{{ theme }}
+
+
## API
+
### Button Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+app-parameter | String | - | \- | N
block | Boolean | false | make button to be a block-level element | N
-content | String / Slot | - | button's children elements | N
-custom-dataset | Object | - | Typescript:`any` | N
-disabled | Boolean | false | disable the button, make it can not be clicked | N
-external-classes | Array | - | `['t-class', 't-class-icon', 't-class-loading']` | N
+content | String / Slot | - | button's children elements。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+custom-dataset | any | - | \- | N
+disabled | Boolean | undefined | disable the button, make it can not be clicked | N
ghost | Boolean | false | make background-color to be transparent | N
-icon | String / Object | - | icon name | N
-loading | Boolean | false | set button to be loading state | N
-loading-props | Object | - | Typescript:`LoadingProps`,[Loading API Documents](./loading?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/button/type.ts) | N
-shape | String | rectangle | button shape。options:rectangle/square/round/circle | N
-size | String | medium | a button has three size。options:small/medium/large。Typescript:`SizeEnum` | N
-suffix | Slot | - | \- | N
-theme | String | default | button theme。options:default/primary/danger | N
-type | String | - | type of button element, same as formType of Miniprogram。options:submit/reset | N
-variant | String | base | button variant。options:base/outline/text | N
-open-type | String | - | options:contact/share/getPhoneNumber/getUserInfo/launchApp/openSetting/feedback/chooseAvatar | N
-hover-stop-propagation | Boolean | false | \- | N
+hover-class | String | - | \- | N
hover-start-time | Number | 20 | \- | N
hover-stay-time | Number | 70 | \- | N
-lang | String | en | options:en/zh_CN/zh_TW | N
-session-from | String | - | \- | N
-send-message-title | String | 当前标题 | \- | N
-send-message-path | String | 当前分享路径 | \- | N
+hover-stop-propagation | Boolean | false | \- | N
+icon | String / Object | - | icon name | N
+lang | String | - | message language。options: en/zh_CN/zh_TW | N
+loading | Boolean | false | set button to be loading state | N
+loading-props | Object | - | Typescript:`LoadingProps`,[Loading API Documents](./loading?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/button/type.ts) | N
+open-type | String | - | open type of button, [Miniprogram Button](https://developers.weixin.qq.com/miniprogram/dev/component/button.html)。options: contact/share/getPhoneNumber/getUserInfo/launchApp/openSetting/feedback/chooseAvatar/agreePrivacyAuthorization | N
+phone-number-no-quota-toast | Boolean | true | \- | N
send-message-img | String | 截图 | \- | N
-app-parameter | String | - | \- | N
+send-message-path | String | 当前分享路径 | \- | N
+send-message-title | String | 当前标题 | \- | N
+session-from | String | - | \- | N
+shape | String | rectangle | button shape。options: rectangle/square/round/circle | N
show-message-card | Boolean | false | \- | N
-bindgetuserinfo | Eventhandle | - | \- | N
-bindcontact | Eventhandle | - | \- | N
-bindgetphonenumber | Eventhandle | - | \- | N
-binderror | Eventhandle | - | \- | N
-bindopensetting | Eventhandle | - | \- | N
-bindlaunchapp | Eventhandle | - | \- | N
-bindchooseavatar | Eventhandle | - | \- | N
+size | String | medium | a button has four size。options: extra-small/small/medium/large | N
+suffix | Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+t-id | String | - | id | N
+theme | String | default | button theme。options: default/primary/danger/light | N
+type | String | - | type of button element, same as formType of Miniprogram。options: submit/reset | N
+variant | String | base | variant of button。options: base/outline/dashed/text | N
### Button Events
name | params | description
-- | -- | --
-tap | `(e: MouseEvent)` | trigger on click
+agreeprivacyauthorization | \- | \-
+chooseavatar | \- | \-
+click | `(e: MouseEvent)` | trigger on click
+contact | \- | \-
+createliveactivity | \- | \-
+error | \- | \-
+getphonenumber | \- | \-
+getrealtimephonenumber | \- | \-
+getuserinfo | \- | \-
+launchapp | \- | \-
+opensetting | \- | \-
+tap | `event` | \-
+
+### Button External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-icon | class name of icon
+t-class-loading | class name of loading
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-button-border-radius | @radius-default | -
+--td-button-border-width | 4rpx | -
+--td-button-danger-active-bg-color | @error-color-7 | -
+--td-button-danger-active-border-color | @error-color-7 | -
+--td-button-danger-bg-color | @error-color | -
+--td-button-danger-border-color | @error-color | -
+--td-button-danger-color | @font-white-1 | -
+--td-button-danger-dashed-border-color | @button-danger-dashed-color | -
+--td-button-danger-dashed-color | @error-color | -
+--td-button-danger-dashed-disabled-color | @button-danger-disabled-color | -
+--td-button-danger-disabled-bg | @error-color-3 | -
+--td-button-danger-disabled-border-color | @error-color-3 | -
+--td-button-danger-disabled-color | @error-color-disabled | -
+--td-button-danger-outline-active-bg-color | @bg-color-container-active | -
+--td-button-danger-outline-active-border-color | @error-color-7 | -
+--td-button-danger-outline-border-color | @button-danger-outline-color | -
+--td-button-danger-outline-color | @error-color | -
+--td-button-danger-outline-disabled-color | @error-color-3 | -
+--td-button-danger-text-active-bg-color | @bg-color-container-active | -
+--td-button-danger-text-color | @error-color | -
+--td-button-danger-text-disabled-color | @button-danger-disabled-color | -
+--td-button-default-active-bg-color | @bg-color-component-active | -
+--td-button-default-active-border-color | @bg-color-component-active | -
+--td-button-default-bg-color | @bg-color-component | -
+--td-button-default-border-color | @bg-color-component | -
+--td-button-default-color | @text-color-primary | -
+--td-button-default-disabled-bg | @bg-color-component-disabled | -
+--td-button-default-disabled-border-color | @bg-color-component-disabled | -
+--td-button-default-disabled-color | @text-color-disabled | -
+--td-button-default-outline-active-bg-color | @bg-color-container-active | -
+--td-button-default-outline-active-border-color | @component-border | -
+--td-button-default-outline-border-color | @component-border | -
+--td-button-default-outline-color | @text-color-primary | -
+--td-button-default-outline-disabled-color | @component-border | -
+--td-button-default-text-active-bg-color | @bg-color-container-active | -
+--td-button-extra-small-font-size | @font-size-base | -
+--td-button-extra-small-height | 56rpx | -
+--td-button-extra-small-icon-font-size | 36rpx | -
+--td-button-extra-small-padding-horizontal | 16rpx | -
+--td-button-font-weight | 600 | -
+--td-button-ghost-border-color | @button-ghost-color | -
+--td-button-ghost-color | @bg-color-container | -
+--td-button-ghost-danger-border-color | @error-color | -
+--td-button-ghost-danger-color | @error-color | -
+--td-button-ghost-danger-hover-color | @error-color-active | -
+--td-button-ghost-disabled-color | @font-white-4 | -
+--td-button-ghost-hover-color | @font-white-2 | -
+--td-button-ghost-primary-border-color | @brand-color | -
+--td-button-ghost-primary-color | @brand-color | -
+--td-button-ghost-primary-hover-color | @brand-color-active | -
+--td-button-icon-border-radius | 8rpx | -
+--td-button-icon-spacer | @spacer | -
+--td-button-large-font-size | @font-size-m | -
+--td-button-large-height | 96rpx | -
+--td-button-large-icon-font-size | 48rpx | -
+--td-button-large-padding-horizontal | 40rpx | -
+--td-button-light-active-bg-color | @brand-color-light-active | -
+--td-button-light-active-border-color | @brand-color-light-active | -
+--td-button-light-bg-color | @brand-color-light | -
+--td-button-light-border-color | @brand-color-light | -
+--td-button-light-color | @brand-color | -
+--td-button-light-disabled-bg | @brand-color-light | -
+--td-button-light-disabled-border-color | @brand-color-light | -
+--td-button-light-disabled-color | @brand-color-disabled | -
+--td-button-light-outline-active-bg-color | @brand-color-light-active | -
+--td-button-light-outline-active-border-color | @brand-color-active | -
+--td-button-light-outline-bg-color | @brand-color-light | -
+--td-button-light-outline-border-color | @button-light-outline-color | -
+--td-button-light-outline-color | @brand-color | -
+--td-button-light-outline-disabled-color | @brand-color-disabled | -
+--td-button-light-text-active-bg-color | @bg-color-container-active | -
+--td-button-light-text-color | @brand-color | -
+--td-button-medium-font-size | @font-size-m | -
+--td-button-medium-height | 80rpx | -
+--td-button-medium-icon-font-size | 40rpx | -
+--td-button-medium-padding-horizontal | 32rpx | -
+--td-button-primary-active-bg-color | @brand-color-active | -
+--td-button-primary-active-border-color | @brand-color-active | -
+--td-button-primary-bg-color | @brand-color | -
+--td-button-primary-border-color | @brand-color | -
+--td-button-primary-color | @font-white-1 | -
+--td-button-primary-dashed-border-color | @button-primary-dashed-color | -
+--td-button-primary-dashed-color | @brand-color | -
+--td-button-primary-dashed-disabled-color | @brand-color-disabled | -
+--td-button-primary-disabled-bg | @brand-color-disabled | -
+--td-button-primary-disabled-border-color | @brand-color-disabled | -
+--td-button-primary-disabled-color | @font-white-1 | -
+--td-button-primary-outline-active-bg-color | @bg-color-container-active | -
+--td-button-primary-outline-active-border-color | @brand-color-active | -
+--td-button-primary-outline-border-color | @button-primary-outline-color | -
+--td-button-primary-outline-color | @brand-color | -
+--td-button-primary-outline-disabled-color | @brand-color-disabled | -
+--td-button-primary-text-active-bg-color | @bg-color-container-active | -
+--td-button-primary-text-color | @brand-color | -
+--td-button-primary-text-disabled-color | @brand-color-disabled | -
+--td-button-small-font-size | @font-size-base | -
+--td-button-small-height | 64rpx | -
+--td-button-small-icon-font-size | 36rpx | -
+--td-button-small-padding-horizontal | 24rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/button/README.md b/miniprogram_npm/tdesign-miniprogram/button/README.md
index f318844..ac4fc02 100644
--- a/miniprogram_npm/tdesign-miniprogram/button/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/button/README.md
@@ -18,89 +18,218 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
+
### 01 组件类型
-基础按钮
+#### 基础按钮
{{ base }}
-图标按钮
+#### 图标按钮
{{ icon-btn }}
-幽灵按钮
+#### 幽灵按钮
{{ ghost-btn }}
-组合按钮
+#### 组合按钮
{{ group-btn }}
-通栏按钮
+#### 通栏按钮
{{ block-btn }}
### 02 组件状态
-按钮禁用态
+#### 按钮禁用态
{{ disabled }}
### 03 组件样式
-按钮尺寸
+#### 按钮尺寸
{{ size }}
-按钮形状
+#### 按钮形状
{{ shape }}
-按钮主题
+#### 按钮主题
{{ theme }}
## API
+
### Button Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+app-parameter | String | - | 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 | N
block | Boolean | false | 是否为块级元素 | N
-content | String / Slot | - | 按钮内容 | N
-custom-dataset | Object | - | 自定义 dataset,可通过 event.currentTarget.dataset.custom 获取。TS 类型:`any` | N
-disabled | Boolean | false | 禁用状态 | N
-external-classes | Array | - | 组件类名。`['t-class', 't-class-icon', 't-class-loading']` | N
+content | String / Slot | - | 按钮内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+custom-dataset | any | - | 自定义 dataset,可通过 event.currentTarget.dataset.custom 获取 | N
+disabled | Boolean | undefined | 禁用状态。优先级:Button.disabled > Form.disabled | N
ghost | Boolean | false | 是否为幽灵按钮(镂空按钮) | N
-icon | String / Object | - | 图标名称。值为字符串表示图标名称,值为 `Object` 类型,表示透传至 `icon`。 | N
-loading | Boolean | false | 是否显示为加载状态 | N
-loading-props | Object | - | 透传至 Loading 组件。TS 类型:`LoadingProps`,[Loading API Documents](./loading?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/button/type.ts) | N
-shape | String | rectangle | 按钮形状,有 4 种:长方形、正方形、圆角长方形、圆形。可选项:rectangle/square/round/circle | N
-size | String | medium | 组件尺寸。可选项:extra-small/small/medium/large。TS 类型:`SizeEnum` | N
-suffix | Slot | - | 右侧内容,可用于定义右侧图标 | N
-theme | String | default | 组件风格,依次为品牌色、危险色。可选项:default/primary/danger/light | N
-type | String | - | 同小程序的 formType。可选项:submit/reset | N
-variant | String | base | 按钮形式,基础、线框、文字。可选项:base/outline/dashed/text | N
-open-type | String | - | 微信开放能力。
具体释义:
`contact` 打开客服会话,如果用户在会话中点击消息卡片后返回小程序,可以从 bindcontact 回调中获得具体信息,具体说明 (*小程序插件中不能使用*);
`share` 触发用户转发,使用前建议先阅读使用指引;
`getPhoneNumber` 获取用户手机号,可以从 bindgetphonenumber 回调中获取到用户信息,具体说明 (*小程序插件中不能使用*);
`getUserInfo` 获取用户信息,可以从 bindgetuserinfo 回调中获取到用户信息 (*小程序插件中不能使用*);
`launchApp` 打开APP,可以通过 app-parameter 属性设定向 APP 传的参数具体说明;
`openSetting` 打开授权设置页;
`feedback` 打开“意见反馈”页面,用户可提交反馈内容并上传日志,开发者可以登录小程序管理后台后进入左侧菜单“客服反馈”页面获取到反馈内容;
`chooseAvatar` 获取用户头像,可以从 bindchooseavatar 回调中获取到头像信息。
[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/button.html)。可选项:contact/share/getPhoneNumber/getUserInfo/launchApp/openSetting/feedback/chooseAvatar | N
-hover-stop-propagation | Boolean | false | 指定是否阻止本节点的祖先节点出现点击态 | N
+hover-class | String | - | 指定按钮按下去的样式类,按钮不为加载或禁用状态时有效。当 `hover-class="none"` 时,没有点击态效果 | N
hover-start-time | Number | 20 | 按住后多久出现点击态,单位毫秒 | N
hover-stay-time | Number | 70 | 手指松开后点击态保留时间,单位毫秒 | N
-lang | String | en | 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。。
具体释义:
`en` 英文;
`zh_CN` 简体中文;
`zh_TW` 繁体中文。
[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/button.html)。可选项:en/zh_CN/zh_TW | N
-session-from | String | - | 会话来源,open-type="contact"时有效 | N
-send-message-title | String | 当前标题 | 会话内消息卡片标题,open-type="contact"时有效 | N
-send-message-path | String | 当前分享路径 | 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效 | N
+hover-stop-propagation | Boolean | false | 指定是否阻止本节点的祖先节点出现点击态 | N
+icon | String / Object | - | 图标名称。值为字符串表示图标名称,值为 `Object` 类型,表示透传至 `icon`。 | N
+lang | String | - | 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。。
具体释义:
`en` 英文;
`zh_CN` 简体中文;
`zh_TW` 繁体中文。
[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/button.html)。。可选项:en/zh_CN/zh_TW | N
+loading | Boolean | false | 是否显示为加载状态 | N
+loading-props | Object | - | 透传 Loading 组件全部属性。TS 类型:`LoadingProps`,[Loading API Documents](./loading?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/button/type.ts) | N
+open-type | String | - | 微信开放能力。
具体释义:
`contact` 打开客服会话,如果用户在会话中点击消息卡片后返回小程序,可以从 bindcontact 回调中获得具体信息,具体说明 (*小程序插件中不能使用*);
`share` 触发用户转发,使用前建议先阅读使用指引;
`getPhoneNumber` 获取用户手机号,可以从 bindgetphonenumber 回调中获取到用户信息,具体说明 (*小程序插件中不能使用*);
`getUserInfo` 获取用户信息,可以从 bindgetuserinfo 回调中获取到用户信息 (*小程序插件中不能使用*);
`launchApp` 打开APP,可以通过 app-parameter 属性设定向 APP 传的参数具体说明;
`openSetting` 打开授权设置页;
`feedback` 打开“意见反馈”页面,用户可提交反馈内容并上传日志,开发者可以登录小程序管理后台后进入左侧菜单“客服反馈”页面获取到反馈内容;
`chooseAvatar` 获取用户头像,可以从 bindchooseavatar 回调中获取到头像信息;
`agreePrivacyAuthorization`用户同意隐私协议按钮。用户点击一次此按钮后,所有隐私接口可以正常调用。可通过`bindagreeprivacyauthorization`监听用户同意隐私协议事件。隐私合规开发指南详情可见《小程序隐私协议开发指南》。
[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/button.html)。。可选项:contact/share/getPhoneNumber/getUserInfo/launchApp/openSetting/feedback/chooseAvatar/agreePrivacyAuthorization | N
+phone-number-no-quota-toast | Boolean | true | 原生按钮属性,当手机号快速验证或手机号实时验证额度用尽时,是否对用户展示“申请获取你的手机号,但该功能使用次数已达当前小程序上限,暂时无法使用”的提示,默认展示,open-type="getPhoneNumber" 或 open-type="getRealtimePhoneNumber" 时有效 | N
send-message-img | String | 截图 | 会话内消息卡片图片,open-type="contact"时有效 | N
-app-parameter | String | - | 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 | N
+send-message-path | String | 当前分享路径 | 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效 | N
+send-message-title | String | 当前标题 | 会话内消息卡片标题,open-type="contact"时有效 | N
+session-from | String | - | 会话来源,open-type="contact"时有效 | N
+shape | String | rectangle | 按钮形状,有 4 种:长方形、正方形、圆角长方形、圆形。可选项:rectangle/square/round/circle | N
show-message-card | Boolean | false | 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,open-type="contact"时有效 | N
-bindgetuserinfo | Eventhandle | - | 用户点击该按钮时,会返回获取到的用户信息,回调的 detail 数据与wx.getUserInfo返回的一致,open-type="getUserInfo"时有效 | N
-bindcontact | Eventhandle | - | 客服消息回调,open-type="contact"时有效 | N
-bindgetphonenumber | Eventhandle | - | 获取用户手机号回调,open-type=getPhoneNumber时有效 | N
-binderror | Eventhandle | - | 当使用开放能力时,发生错误的回调,open-type=launchApp时有效 | N
-bindopensetting | Eventhandle | - | 在打开授权设置页后回调,open-type=openSetting时有效 | N
-bindlaunchapp | Eventhandle | - | 打开 APP 成功的回调,open-type=launchApp时有效 | N
-bindchooseavatar | Eventhandle | - | 获取用户头像回调,open-type=chooseAvatar时有效 | N
+size | String | medium | 组件尺寸。可选项:extra-small/small/medium/large | N
+suffix | Slot | - | 右侧内容,可用于定义右侧图标。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+t-id | String | - | 按钮标签id | N
+theme | String | default | 组件风格,依次为品牌色、危险色。可选项:default/primary/danger/light | N
+type | String | - | 同小程序的 formType。。可选项:submit/reset | N
+variant | String | base | 按钮形式,基础、线框、虚线、文字。可选项:base/outline/dashed/text | N
### Button Events
名称 | 参数 | 描述
-- | -- | --
-tap | `event` | 点击时触发
+agreeprivacyauthorization | \- | 原生按钮属性,用户同意隐私协议事件回调,open-type=agreePrivacyAuthorization时有效 (Tips: 如果使用 onNeedPrivacyAuthorization 接口,需要在 bindagreeprivacyauthorization 触发后再调用 resolve({ event: "agree", buttonId }))
+chooseavatar | \- | 原生按钮属性,获取用户头像回调,`open-type=chooseAvatar` 时有效。返回 `e.detail.avatarUrl` 为头像临时文件链接
+click | `(e: MouseEvent)` | 点击时触发
+contact | \- | 原生按钮属性,客服消息回调,`open-type="contact"` 时有效
+createliveactivity | \- | 新的一次性订阅消息下发机制回调,`open-type=liveActivity` 时有效
+error | \- | 原生按钮属性,当使用开放能力时,发生错误的回调,`open-type=launchApp` 时有效
+getphonenumber | \- | 原生按钮属性,手机号快速验证回调,open-type=getPhoneNumber时有效。Tips:在触发 bindgetphonenumber 回调后应立即隐藏手机号按钮组件,或置为 disabled 状态,避免用户重复授权手机号产生额外费用
+getrealtimephonenumber | \- | 原生按钮属性,手机号实时验证回调,open-type=getRealtimePhoneNumber 时有效。Tips:在触发 bindgetrealtimephonenumber 回调后应立即隐藏手机号按钮组件,或置为 disabled 状态,避免用户重复授权手机号产生额外费用
+getuserinfo | \- | 原生按钮属性,用户点击该按钮时,会返回获取到的用户信息,回调的detail数据与wx.getUserInfo返回的一致,open-type="getUserInfo"时有效
+launchapp | \- | 打开 APP 成功的回调,`open-type=launchApp` 时有效
+opensetting | \- | 原生按钮属性,在打开授权设置页后回调,open-type=openSetting时有效
+tap | `event` | 点击按钮,当按钮不为加载或禁用状态时触发
+
+### Button External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-icon | 图标样式类
+t-class-loading | 加载样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-button-border-radius | @radius-default | -
+--td-button-border-width | 4rpx | -
+--td-button-danger-active-bg-color | @error-color-7 | -
+--td-button-danger-active-border-color | @error-color-7 | -
+--td-button-danger-bg-color | @error-color | -
+--td-button-danger-border-color | @error-color | -
+--td-button-danger-color | @font-white-1 | -
+--td-button-danger-dashed-border-color | @button-danger-dashed-color | -
+--td-button-danger-dashed-color | @error-color | -
+--td-button-danger-dashed-disabled-color | @button-danger-disabled-color | -
+--td-button-danger-disabled-bg | @error-color-3 | -
+--td-button-danger-disabled-border-color | @error-color-3 | -
+--td-button-danger-disabled-color | @error-color-disabled | -
+--td-button-danger-outline-active-bg-color | @bg-color-container-active | -
+--td-button-danger-outline-active-border-color | @error-color-7 | -
+--td-button-danger-outline-border-color | @button-danger-outline-color | -
+--td-button-danger-outline-color | @error-color | -
+--td-button-danger-outline-disabled-color | @error-color-3 | -
+--td-button-danger-text-active-bg-color | @bg-color-container-active | -
+--td-button-danger-text-color | @error-color | -
+--td-button-danger-text-disabled-color | @button-danger-disabled-color | -
+--td-button-default-active-bg-color | @bg-color-component-active | -
+--td-button-default-active-border-color | @bg-color-component-active | -
+--td-button-default-bg-color | @bg-color-component | -
+--td-button-default-border-color | @bg-color-component | -
+--td-button-default-color | @text-color-primary | -
+--td-button-default-disabled-bg | @bg-color-component-disabled | -
+--td-button-default-disabled-border-color | @bg-color-component-disabled | -
+--td-button-default-disabled-color | @text-color-disabled | -
+--td-button-default-outline-active-bg-color | @bg-color-container-active | -
+--td-button-default-outline-active-border-color | @component-border | -
+--td-button-default-outline-border-color | @component-border | -
+--td-button-default-outline-color | @text-color-primary | -
+--td-button-default-outline-disabled-color | @component-border | -
+--td-button-default-text-active-bg-color | @bg-color-container-active | -
+--td-button-extra-small-font-size | @font-size-base | -
+--td-button-extra-small-height | 56rpx | -
+--td-button-extra-small-icon-font-size | 36rpx | -
+--td-button-extra-small-padding-horizontal | 16rpx | -
+--td-button-font-weight | 600 | -
+--td-button-ghost-border-color | @button-ghost-color | -
+--td-button-ghost-color | @bg-color-container | -
+--td-button-ghost-danger-border-color | @error-color | -
+--td-button-ghost-danger-color | @error-color | -
+--td-button-ghost-danger-hover-color | @error-color-active | -
+--td-button-ghost-disabled-color | @font-white-4 | -
+--td-button-ghost-hover-color | @font-white-2 | -
+--td-button-ghost-primary-border-color | @brand-color | -
+--td-button-ghost-primary-color | @brand-color | -
+--td-button-ghost-primary-hover-color | @brand-color-active | -
+--td-button-icon-border-radius | 8rpx | -
+--td-button-icon-spacer | @spacer | -
+--td-button-large-font-size | @font-size-m | -
+--td-button-large-height | 96rpx | -
+--td-button-large-icon-font-size | 48rpx | -
+--td-button-large-padding-horizontal | 40rpx | -
+--td-button-light-active-bg-color | @brand-color-light-active | -
+--td-button-light-active-border-color | @brand-color-light-active | -
+--td-button-light-bg-color | @brand-color-light | -
+--td-button-light-border-color | @brand-color-light | -
+--td-button-light-color | @brand-color | -
+--td-button-light-disabled-bg | @brand-color-light | -
+--td-button-light-disabled-border-color | @brand-color-light | -
+--td-button-light-disabled-color | @brand-color-disabled | -
+--td-button-light-outline-active-bg-color | @brand-color-light-active | -
+--td-button-light-outline-active-border-color | @brand-color-active | -
+--td-button-light-outline-bg-color | @brand-color-light | -
+--td-button-light-outline-border-color | @button-light-outline-color | -
+--td-button-light-outline-color | @brand-color | -
+--td-button-light-outline-disabled-color | @brand-color-disabled | -
+--td-button-light-text-active-bg-color | @bg-color-container-active | -
+--td-button-light-text-color | @brand-color | -
+--td-button-medium-font-size | @font-size-m | -
+--td-button-medium-height | 80rpx | -
+--td-button-medium-icon-font-size | 40rpx | -
+--td-button-medium-padding-horizontal | 32rpx | -
+--td-button-primary-active-bg-color | @brand-color-active | -
+--td-button-primary-active-border-color | @brand-color-active | -
+--td-button-primary-bg-color | @brand-color | -
+--td-button-primary-border-color | @brand-color | -
+--td-button-primary-color | @font-white-1 | -
+--td-button-primary-dashed-border-color | @button-primary-dashed-color | -
+--td-button-primary-dashed-color | @brand-color | -
+--td-button-primary-dashed-disabled-color | @brand-color-disabled | -
+--td-button-primary-disabled-bg | @brand-color-disabled | -
+--td-button-primary-disabled-border-color | @brand-color-disabled | -
+--td-button-primary-disabled-color | @font-white-1 | -
+--td-button-primary-outline-active-bg-color | @bg-color-container-active | -
+--td-button-primary-outline-active-border-color | @brand-color-active | -
+--td-button-primary-outline-border-color | @button-primary-outline-color | -
+--td-button-primary-outline-color | @brand-color | -
+--td-button-primary-outline-disabled-color | @brand-color-disabled | -
+--td-button-primary-text-active-bg-color | @bg-color-container-active | -
+--td-button-primary-text-color | @brand-color | -
+--td-button-primary-text-disabled-color | @brand-color-disabled | -
+--td-button-small-font-size | @font-size-base | -
+--td-button-small-height | 64rpx | -
+--td-button-small-icon-font-size | 36rpx | -
+--td-button-small-padding-horizontal | 24rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/button/button.d.ts b/miniprogram_npm/tdesign-miniprogram/button/button.d.ts
index a55a5a2..4e88efd 100644
--- a/miniprogram_npm/tdesign-miniprogram/button/button.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/button/button.d.ts
@@ -6,13 +6,16 @@ export default class Button extends SuperComponent {
externalClasses: string[];
behaviors: string[];
properties: TdButtonProps;
+ options: {
+ multipleSlots: boolean;
+ };
data: {
prefix: string;
className: string;
classPrefix: string;
};
observers: {
- 'theme, size, plain, block, shape, disabled, loading'(): void;
+ 'theme, size, plain, block, shape, disabled, loading, variant'(): void;
icon(icon: any): void;
};
lifetimes: {
@@ -27,6 +30,7 @@ export default class Button extends SuperComponent {
opensetting(e: any): void;
launchapp(e: any): void;
chooseavatar(e: any): void;
+ agreeprivacyauthorization(e: any): void;
handleTap(e: any): void;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/button/button.js b/miniprogram_npm/tdesign-miniprogram/button/button.js
index a457c41..5449818 100644
--- a/miniprogram_npm/tdesign-miniprogram/button/button.js
+++ b/miniprogram_npm/tdesign-miniprogram/button/button.js
@@ -8,7 +8,7 @@ import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
import { canIUseFormFieldButton } from '../common/version';
-import { setIcon } from '../common/utils';
+import { calcIcon } from '../common/utils';
const { prefix } = config;
const name = `${prefix}-button`;
let Button = class Button extends SuperComponent {
@@ -17,18 +17,22 @@ let Button = class Button extends SuperComponent {
this.externalClasses = [`${prefix}-class`, `${prefix}-class-icon`, `${prefix}-class-loading`];
this.behaviors = canIUseFormFieldButton() ? ['wx://form-field-button'] : [];
this.properties = props;
+ this.options = {
+ multipleSlots: true,
+ };
this.data = {
prefix,
className: '',
classPrefix: name,
};
this.observers = {
- 'theme, size, plain, block, shape, disabled, loading'() {
+ 'theme, size, plain, block, shape, disabled, loading, variant'() {
this.setClass();
},
icon(icon) {
- const obj = setIcon('icon', icon, '');
- this.setData(Object.assign({}, obj));
+ this.setData({
+ _icon: calcIcon(icon, ''),
+ });
},
};
this.lifetimes = {
@@ -80,8 +84,11 @@ let Button = class Button extends SuperComponent {
chooseavatar(e) {
this.triggerEvent('chooseavatar', e.detail);
},
+ agreeprivacyauthorization(e) {
+ this.triggerEvent('agreeprivacyauthorization', e.detail);
+ },
handleTap(e) {
- if (this.data.disabled)
+ if (this.data.disabled || this.data.loading)
return;
this.triggerEvent('tap', e);
},
diff --git a/miniprogram_npm/tdesign-miniprogram/button/button.json b/miniprogram_npm/tdesign-miniprogram/button/button.json
index 708bd1b..a32e8cd 100644
--- a/miniprogram_npm/tdesign-miniprogram/button/button.json
+++ b/miniprogram_npm/tdesign-miniprogram/button/button.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon",
"t-loading": "../loading/loading"
diff --git a/miniprogram_npm/tdesign-miniprogram/button/button.wxml b/miniprogram_npm/tdesign-miniprogram/button/button.wxml
index b238985..895b227 100644
--- a/miniprogram_npm/tdesign-miniprogram/button/button.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/button/button.wxml
@@ -2,17 +2,18 @@
@@ -61,10 +62,9 @@
diff --git a/miniprogram_npm/tdesign-miniprogram/calendar/type.d.ts b/miniprogram_npm/tdesign-miniprogram/calendar/type.d.ts
index a751960..9c44a17 100644
--- a/miniprogram_npm/tdesign-miniprogram/calendar/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/calendar/type.d.ts
@@ -8,10 +8,6 @@ export interface TdCalendarProps {
type: null;
value?: string | ButtonProps | null;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
firstDayOfWeek?: {
type: NumberConstructor;
value?: number;
@@ -20,6 +16,10 @@ export interface TdCalendarProps {
type: undefined;
value?: CalendarFormatType;
};
+ localeText?: {
+ type: ObjectConstructor;
+ value?: CalendarLocaleText;
+ };
maxDate?: {
type: NumberConstructor;
value?: number;
@@ -40,6 +40,10 @@ export interface TdCalendarProps {
type: BooleanConstructor;
value?: boolean;
};
+ usingCustomNavbar?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
value?: {
type: null;
value?: number | number[];
@@ -63,3 +67,10 @@ export interface TDate {
prefix?: string;
suffix?: string;
}
+export interface CalendarLocaleText {
+ title?: string;
+ weekdays?: string[];
+ monthTitle?: string;
+ months?: string[];
+ confirm?: string;
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/cascader/README.en-US.md
index 45c9106..19bcfb4 100644
--- a/miniprogram_npm/tdesign-miniprogram/cascader/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/cascader/README.en-US.md
@@ -1,16 +1,20 @@
:: BASE_DOC ::
## API
+
### Cascader Props
name | type | default | description | required
-- | -- | -- | -- | --
-close-btn | Boolean / Slot | true | \- | N
-keys | Object | - | Typescript:`KeysType` | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+close-btn | Boolean / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+keys | Object | - | Typescript:`KeysType`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
options | Array | [] | Typescript:`Array` | N
+placeholder | String | 选择选项 | \- | N
sub-titles | Array | [] | Typescript:`Array` | N
-theme | String | step | options:step/tab | N
-title | String / Slot | - | \- | N
+theme | String | step | options: step/tab | N
+title | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
value | String / Number | null | \- | N
default-value | String / Number | undefined | uncontrolled property | N
visible | Boolean | false | \- | N
@@ -20,5 +24,25 @@ visible | Boolean | false | \- | N
name | params | description
-- | -- | --
change | `(value: string \| number, selectedOptions: string[])` | `1.0.1`
-close | `(trigger: TriggerSource)` | `1.0.1`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/cascader/type.ts)。
`type TriggerSource = 'overlay' \| 'close-btn' \| 'finish'`
-pick | `(value: string \| number, index: number)` | `1.0.1`
+close | `(trigger: CascaderTriggerSource)` | `1.0.1`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/cascader/type.ts)。
`type CascaderTriggerSource = 'overlay' \| 'close-btn' \| 'finish'`
+pick | `(value: string \| number, label: string, index: number, level: number)` | `1.0.1`
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-cascader-active-color | @brand-color | -
+--td-cascader-bg-color | @bg-color-container | -
+--td-cascader-border-color | @component-stroke | -
+--td-cascader-content-height | 78vh | -
+--td-cascader-disabled-color | @text-color-disabled | -
+--td-cascader-options-height | calc(100% - @cascader-step-height) | -
+--td-cascader-options-title-color | @text-color-placeholder | -
+--td-cascader-step-arrow-color | @text-color-placeholder | -
+--td-cascader-step-dot-size | 16rpx | -
+--td-cascader-step-height | 88rpx | -
+--td-cascader-title-color | @text-color-primary | -
+--td-cascader-title-height | 26rpx | -
+--td-cascader-title-padding | @spacer-2 | -
+--td-cascder-title-font-size | 36rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/README.md b/miniprogram_npm/tdesign-miniprogram/cascader/README.md
index a5f543a..5723d59 100644
--- a/miniprogram_npm/tdesign-miniprogram/cascader/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/cascader/README.md
@@ -24,6 +24,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 基础用法
{{ base }}
@@ -47,16 +53,20 @@ isComponent: true
{{ with-title }}
## API
+
### Cascader Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-close-btn | Boolean / Slot | true | 关闭按钮 | N
-keys | Object | - | 用来定义 value / label 在 `options` 中对应的字段别名。TS 类型:`KeysType` | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+close-btn | Boolean / Slot | true | 关闭按钮。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+keys | Object | - | 用来定义 value / label 在 `options` 中对应的字段别名。TS 类型:`KeysType`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
options | Array | [] | 可选项数据源。TS 类型:`Array` | N
+placeholder | String | 选择选项 | 未选中时的提示文案 | N
sub-titles | Array | [] | 每级展示的次标题。TS 类型:`Array` | N
theme | String | step | 展示风格。可选项:step/tab | N
-title | String / Slot | - | 标题 | N
+title | String / Slot | - | 标题。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
value | String / Number | null | 选项值 | N
default-value | String / Number | undefined | 选项值。非受控属性 | N
visible | Boolean | false | 是否展示 | N
@@ -66,5 +76,25 @@ visible | Boolean | false | 是否展示 | N
名称 | 参数 | 描述
-- | -- | --
change | `(value: string \| number, selectedOptions: string[])` | `1.0.1`。值发生变更时触发
-close | `(trigger: TriggerSource)` | `1.0.1`。关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/cascader/type.ts)。
`type TriggerSource = 'overlay' \| 'close-btn' \| 'finish'`
-pick | `(value: string \| number, index: number)` | `1.0.1`。选择后触发
+close | `(trigger: CascaderTriggerSource)` | `1.0.1`。关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/cascader/type.ts)。
`type CascaderTriggerSource = 'overlay' \| 'close-btn' \| 'finish'`
+pick | `(value: string \| number, label: string, index: number, level: number)` | `1.0.1`。选择后触发
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-cascader-active-color | @brand-color | -
+--td-cascader-bg-color | @bg-color-container | -
+--td-cascader-border-color | @component-stroke | -
+--td-cascader-content-height | 78vh | -
+--td-cascader-disabled-color | @text-color-disabled | -
+--td-cascader-options-height | calc(100% - @cascader-step-height) | -
+--td-cascader-options-title-color | @text-color-placeholder | -
+--td-cascader-step-arrow-color | @text-color-placeholder | -
+--td-cascader-step-dot-size | 16rpx | -
+--td-cascader-step-height | 88rpx | -
+--td-cascader-title-color | @text-color-primary | -
+--td-cascader-title-height | 26rpx | -
+--td-cascader-title-padding | @spacer-2 | -
+--td-cascder-title-font-size | 36rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.d.ts b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.d.ts
index 53e061d..a7de69e 100644
--- a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.d.ts
@@ -6,32 +6,53 @@ export interface CascaderProps extends TdCascaderProps {
export default class Cascader extends SuperComponent {
externalClasses: string[];
options: WechatMiniprogram.Component.ComponentOptions;
- properties: TdCascaderProps;
+ properties: TdCascaderProps>;
+ controlledProps: {
+ key: string;
+ event: string;
+ }[];
+ state: {
+ contentHeight: number;
+ stepHeight: number;
+ tabsHeight: number;
+ subTitlesHeight: number;
+ stepsInitHeight: number;
+ };
data: {
prefix: string;
name: string;
stepIndex: number;
selectedIndexes: any[];
selectedValue: any[];
- defaultOptionLabel: string;
scrollTopList: any[];
- steps: string[];
+ steps: any[];
+ _optionsHeight: number;
};
observers: {
visible(v: any): void;
- 'value, options'(): void;
- 'selectedIndexes, options'(): void;
+ value(): void;
+ options(): void;
+ selectedIndexes(): void;
stepIndex(): Promise;
};
methods: {
+ updateOptionsHeight(steps: number): void;
+ initOptionsHeight(steps: number): Promise;
initWithValue(): void;
- getIndexesByValue(options: import("../common/common").TreeOptionData[], value: any): any[];
+ getIndexesByValue(options: import("../common/common").TreeOptionData[], value: any): any[];
updateScrollTop(): void;
hide(trigger: any): void;
onVisibleChange(): void;
onClose(): void;
onStepClick(e: any): void;
onTabChange(e: any): void;
+ genItems(): {
+ selectedValue: any[];
+ steps: any[];
+ items: {
+ [x: string]: any;
+ }[][];
+ };
handleSelect(e: any): void;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.js b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.js
index 4add938..76efb27 100644
--- a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.js
+++ b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.js
@@ -19,56 +19,71 @@ import props from './props';
import { getRect } from '../common/utils';
const { prefix } = config;
const name = `${prefix}-cascader`;
-const defaultOptionLabel = '选择选项';
+function parseOptions(options, keys) {
+ var _a, _b;
+ const label = (_a = keys === null || keys === void 0 ? void 0 : keys.label) !== null && _a !== void 0 ? _a : 'label';
+ const value = (_b = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _b !== void 0 ? _b : 'value';
+ return options.map((item) => {
+ return {
+ [label]: item[label],
+ [value]: item[value],
+ };
+ });
+}
+const defaultState = {
+ contentHeight: 0,
+ stepHeight: 0,
+ tabsHeight: 0,
+ subTitlesHeight: 0,
+ stepsInitHeight: 0,
+};
let Cascader = class Cascader extends SuperComponent {
constructor() {
super(...arguments);
this.externalClasses = [`${prefix}-class`];
this.options = {
multipleSlots: true,
+ pureDataPattern: /^options$/,
};
this.properties = props;
+ this.controlledProps = [
+ {
+ key: 'value',
+ event: 'change',
+ },
+ ];
+ this.state = Object.assign({}, defaultState);
this.data = {
prefix,
name,
stepIndex: 0,
selectedIndexes: [],
selectedValue: [],
- defaultOptionLabel,
scrollTopList: [],
- steps: [defaultOptionLabel],
+ steps: [],
+ _optionsHeight: 0,
};
this.observers = {
visible(v) {
if (v) {
const $tabs = this.selectComponent('#tabs');
$tabs === null || $tabs === void 0 ? void 0 : $tabs.setTrack();
+ $tabs === null || $tabs === void 0 ? void 0 : $tabs.getTabHeight().then((res) => {
+ this.state.tabsHeight = res.height;
+ });
+ this.initOptionsHeight(this.data.steps.length);
this.updateScrollTop();
+ this.initWithValue();
+ }
+ else {
+ this.state = Object.assign({}, defaultState);
}
},
- 'value, options'() {
+ value() {
this.initWithValue();
},
- 'selectedIndexes, options'() {
- var _a, _b, _c, _d;
- const { options, selectedIndexes, keys } = this.data;
- const selectedValue = [];
- const steps = [];
- const items = [options];
- if (options.length > 0) {
- for (let i = 0, size = selectedIndexes.length; i < size; i += 1) {
- const index = selectedIndexes[i];
- const next = items[i][index];
- selectedValue.push(next[(_a = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _a !== void 0 ? _a : 'value']);
- steps.push(next[(_b = keys === null || keys === void 0 ? void 0 : keys.label) !== null && _b !== void 0 ? _b : 'label']);
- if (next[(_c = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _c !== void 0 ? _c : 'children']) {
- items.push(next[(_d = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _d !== void 0 ? _d : 'children']);
- }
- }
- }
- if (steps.length < items.length) {
- steps.push(defaultOptionLabel);
- }
+ options() {
+ const { selectedValue, steps, items } = this.genItems();
this.setData({
steps,
items,
@@ -76,6 +91,22 @@ let Cascader = class Cascader extends SuperComponent {
stepIndex: items.length - 1,
});
},
+ selectedIndexes() {
+ const { visible, theme } = this.properties;
+ const { selectedValue, steps, items } = this.genItems();
+ const setData = {
+ steps,
+ selectedValue,
+ stepIndex: items.length - 1,
+ };
+ if (JSON.stringify(items) !== JSON.stringify(this.data.items)) {
+ Object.assign(setData, { items });
+ }
+ this.setData(setData);
+ if (visible && theme === 'step') {
+ this.updateOptionsHeight(steps.length);
+ }
+ },
stepIndex() {
return __awaiter(this, void 0, void 0, function* () {
const { visible } = this.data;
@@ -86,13 +117,45 @@ let Cascader = class Cascader extends SuperComponent {
},
};
this.methods = {
+ updateOptionsHeight(steps) {
+ const { contentHeight, stepsInitHeight, stepHeight, subTitlesHeight } = this.state;
+ this.setData({
+ _optionsHeight: contentHeight - stepsInitHeight - subTitlesHeight - (steps - 1) * stepHeight,
+ });
+ },
+ initOptionsHeight(steps) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const { theme, subTitles } = this.properties;
+ const { height } = yield getRect(this, `.${name}__content`);
+ this.state.contentHeight = height;
+ if (theme === 'step') {
+ yield Promise.all([getRect(this, `.${name}__steps`), getRect(this, `.${name}__step`)]).then(([stepsRect, stepRect]) => {
+ this.state.stepsInitHeight = stepsRect.height - (steps - 1) * stepRect.height;
+ this.state.stepHeight = stepRect.height;
+ });
+ }
+ if (subTitles.length > 0) {
+ const { height } = yield getRect(this, `.${name}__options-title`);
+ this.state.subTitlesHeight = height;
+ }
+ const optionsInitHeight = this.state.contentHeight - this.state.subTitlesHeight;
+ this.setData({
+ _optionsHeight: theme === 'step'
+ ? optionsInitHeight - this.state.stepsInitHeight - (steps - 1) * this.state.stepHeight
+ : optionsInitHeight - this.state.tabsHeight,
+ });
+ });
+ },
initWithValue() {
- if (this.data.value != null) {
+ if (this.data.value != null && this.data.value !== '') {
const selectedIndexes = this.getIndexesByValue(this.data.options, this.data.value);
if (selectedIndexes) {
this.setData({ selectedIndexes });
}
}
+ else {
+ this.setData({ selectedIndexes: [] });
+ }
},
getIndexesByValue(options, value) {
var _a, _b, _c;
@@ -142,27 +205,78 @@ let Cascader = class Cascader extends SuperComponent {
stepIndex: value,
});
},
+ genItems() {
+ var _a, _b, _c, _d, _e;
+ const { options, selectedIndexes, keys, placeholder } = this.data;
+ const selectedValue = [];
+ const steps = [];
+ const items = [parseOptions(options, keys)];
+ if (options.length > 0) {
+ let current = options;
+ for (let i = 0, size = selectedIndexes.length; i < size; i += 1) {
+ const index = selectedIndexes[i];
+ const next = current[index];
+ current = next[(_a = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _a !== void 0 ? _a : 'children'];
+ selectedValue.push(next[(_b = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _b !== void 0 ? _b : 'value']);
+ steps.push(next[(_c = keys === null || keys === void 0 ? void 0 : keys.label) !== null && _c !== void 0 ? _c : 'label']);
+ if (next[(_d = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _d !== void 0 ? _d : 'children']) {
+ items.push(parseOptions(next[(_e = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _e !== void 0 ? _e : 'children'], keys));
+ }
+ }
+ }
+ if (steps.length < items.length) {
+ steps.push(placeholder);
+ }
+ return {
+ selectedValue,
+ steps,
+ items,
+ };
+ },
handleSelect(e) {
- var _a, _b, _c;
+ var _a, _b, _c, _d, _e;
const { level } = e.target.dataset;
const { value } = e.detail;
- const { selectedIndexes, items, keys } = this.data;
+ const { selectedIndexes, items, keys, options } = this.data;
const index = items[level].findIndex((item) => { var _a; return item[(_a = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _a !== void 0 ? _a : 'value'] === value; });
- const item = items[level][index];
+ let item = selectedIndexes.slice(0, level).reduce((acc, item, index) => {
+ var _a;
+ if (index === 0) {
+ return acc[item];
+ }
+ return acc[(_a = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _a !== void 0 ? _a : 'children'][item];
+ }, options);
+ if (level === 0) {
+ item = item[index];
+ }
+ else {
+ item = item[(_a = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _a !== void 0 ? _a : 'children'][index];
+ }
if (item.disabled) {
return;
}
selectedIndexes[level] = index;
selectedIndexes.length = level + 1;
- this.triggerEvent('pick', { value: item[(_a = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _a !== void 0 ? _a : 'value'], index });
- if ((_c = item === null || item === void 0 ? void 0 : item[(_b = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _b !== void 0 ? _b : 'children']) === null || _c === void 0 ? void 0 : _c.length) {
- this.setData({ selectedIndexes });
+ this.triggerEvent('pick', {
+ value: item[(_b = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _b !== void 0 ? _b : 'value'],
+ label: item[(_c = keys === null || keys === void 0 ? void 0 : keys.label) !== null && _c !== void 0 ? _c : 'label'],
+ index,
+ level,
+ });
+ const { items: newItems } = this.genItems();
+ if ((_e = item === null || item === void 0 ? void 0 : item[(_d = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _d !== void 0 ? _d : 'children']) === null || _e === void 0 ? void 0 : _e.length) {
+ this.setData({
+ selectedIndexes,
+ [`items[${level + 1}]`]: newItems[level + 1],
+ });
}
else {
- this.setData({ selectedIndexes }, () => {
+ this.setData({
+ selectedIndexes,
+ }, () => {
var _a;
const { items } = this.data;
- this.triggerEvent('change', {
+ this._trigger('change', {
value: item[(_a = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _a !== void 0 ? _a : 'value'],
selectedOptions: items.map((item, index) => item[selectedIndexes[index]]),
});
diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.json b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.json
index 9fb1ae8..6f4fec8 100644
--- a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.json
+++ b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon",
"t-popup": "../popup/popup",
diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxml b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxml
index 7e2d46d..cab98bc 100644
--- a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxml
@@ -8,19 +8,19 @@
-
+
{{ item }}
-
+
@@ -43,6 +43,8 @@
class="{{name}}__options"
scroll-y
scroll-top="{{scrollTopList[index]}}"
+ type="list"
+ style="height: {{_optionsHeight}}px"
>
diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxss b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxss
index 72a758b..5845aa2 100644
--- a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxss
@@ -28,49 +28,45 @@
.t-cascader {
display: flex;
flex-direction: column;
- background-color: #fff;
- color: var(--td-cascader-title-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
- border-radius: 24rpx 24rpx 0 0;
+ background-color: var(--td-cascader-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
+ color: var(--td-cascader-title-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
+ border-radius: var(--td-radius-extra-large, 24rpx) var(--td-radius-extra-large, 24rpx) 0 0;
--td-radio-icon-checked-color: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
--td-tab-item-active-color: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
--td-tab-track-color: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
}
.t-cascader__close-btn {
- right: 16px;
- top: 12px;
+ right: 32rpx;
+ top: 24rpx;
position: absolute;
}
.t-cascader__title {
position: relative;
font-weight: 700;
text-align: center;
- line-height: 48px;
+ line-height: var(--td-cascader-title-height, 26rpx);
+ padding: var(--td-cascader-title-padding, var(--td-spacer-2, 32rpx));
font-size: var(--td-cascder-title-font-size, 36rpx);
}
.t-cascader__content {
width: 100%;
- flex: 1;
+ height: var(--td-cascader-content-height, 78vh);
display: flex;
flex-direction: column;
}
.t-cascader__options {
width: 100vw;
- height: var(--td-cascader-options-height, 640rpx);
}
.t-cascader__options-title {
- margin-top: 40rpx;
- color: var(--td-cascader-options-title-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
- font-size: 28rpx;
+ color: var(--td-cascader-options-title-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
+ font-size: var(--td-font-size-base, 28rpx);
line-height: 44rpx;
- padding-left: 16px;
-}
-.t-cascader__options-content {
- flex: 1;
- height: 100%;
- overflow: auto;
- padding-left: 16px;
+ padding-top: 40rpx;
+ padding-left: var(--td-spacer-2, 32rpx);
+ box-sizing: border-box;
}
.t-cascader__options-container {
+ flex: 1;
display: flex;
transition: all ease 0.3s;
}
@@ -91,7 +87,7 @@
bottom: 0;
left: unset;
right: unset;
- background-color: var(--td-cascader-border-color, var(--td-border-color, var(--td-gray-color-3, #e7e7e7)));
+ background-color: var(--td-cascader-border-color, var(--td-component-stroke, var(--td-gray-color-3, #e7e7e7)));
}
.t-cascader__steps::after {
height: 1px;
@@ -104,7 +100,7 @@
width: var(--td-cascader-step-dot-size, 16rpx);
height: var(--td-cascader-step-dot-size, 16rpx);
border-radius: 50%;
- border: 1px solid var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
+ border: 2rpx solid var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
box-sizing: border-box;
}
.t-cascader__step-dot:not(.t-cascader__step-dot--last)::after {
@@ -114,7 +110,7 @@
left: 50%;
top: calc(var(--td-cascader-step-dot-size, 16rpx) + 14rpx);
height: 36rpx;
- width: 1px;
+ width: 2rpx;
background: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
transform: translateX(-50%);
}
@@ -123,14 +119,14 @@
border-color: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
}
.t-cascader__step-label {
- padding-left: 16px;
- font-size: 16px;
+ padding-left: var(--td-spacer-2, 32rpx);
+ font-size: var(--td-font-size-m, 32rpx);
}
.t-cascader__step-label--active {
color: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
font-weight: 600;
}
.t-cascader__step-arrow {
- color: var(--td-cascader-step-arrow-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-cascader-step-arrow-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
margin-left: auto;
}
diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/props.js b/miniprogram_npm/tdesign-miniprogram/cascader/props.js
index d2f12b9..14a99de 100644
--- a/miniprogram_npm/tdesign-miniprogram/cascader/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/cascader/props.js
@@ -10,6 +10,10 @@ const props = {
type: Array,
value: [],
},
+ placeholder: {
+ type: String,
+ value: '选择选项',
+ },
subTitles: {
type: Array,
value: [],
diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/type.d.ts b/miniprogram_npm/tdesign-miniprogram/cascader/type.d.ts
index 624c2c5..9d58f80 100644
--- a/miniprogram_npm/tdesign-miniprogram/cascader/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/cascader/type.d.ts
@@ -12,6 +12,10 @@ export interface TdCascaderProps;
};
+ placeholder?: {
+ type: StringConstructor;
+ value?: string;
+ };
subTitles?: {
type: ArrayConstructor;
value?: Array;
diff --git a/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.d.ts b/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.d.ts
index 0cba376..30d14dc 100644
--- a/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.d.ts
@@ -2,9 +2,6 @@ import { SuperComponent, RelationsOptions } from '../common/src/index';
export default class CellGroup extends SuperComponent {
externalClasses: string[];
relations: RelationsOptions;
- options: {
- addGlobalClass: boolean;
- };
properties: import("./type").TdCellGroupProps;
data: {
prefix: string;
diff --git a/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.js b/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.js
index ef3afc1..966ceec 100644
--- a/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.js
+++ b/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.js
@@ -19,11 +19,11 @@ let CellGroup = class CellGroup extends SuperComponent {
linked() {
this.updateLastChid();
},
+ unlinked() {
+ this.updateLastChid();
+ },
},
};
- this.options = {
- addGlobalClass: true,
- };
this.properties = props;
this.data = {
prefix,
diff --git a/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.json b/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.json
index 467ce29..79f2730 100644
--- a/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.json
+++ b/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.json
@@ -1,3 +1,4 @@
{
- "component": true
+ "component": true,
+ "styleIsolation": "apply-shared"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.wxml b/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.wxml
index 7f19c00..404f3f3 100644
--- a/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.wxml
@@ -3,7 +3,7 @@
{{ title }}
diff --git a/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.wxss b/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.wxss
index f9fc0cc..2076b12 100644
--- a/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/cell-group/cell-group.wxss
@@ -31,7 +31,7 @@
.t-cell-group__title {
font-family: PingFangSC-Regular;
font-size: var(--td-cell-group-title-font-size, 28rpx);
- color: var(--td-cell-group-title-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-cell-group-title-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
text-align: left;
line-height: var(--td-cell-group-title-line-height, 90rpx);
background-color: var(--td-cell-group-title-bg-color, var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3)));
@@ -45,8 +45,10 @@
right: 0;
left: 0;
top: 0;
- border-top: 1px solid var(--td-cell-group-border-color, var(--td-border-color, var(--td-gray-color-3, #e7e7e7)));
+ border-top: 1px solid var(--td-cell-group-border-color, var(--td-component-stroke, var(--td-gray-color-3, #e7e7e7)));
transform: scaleY(0.5);
+ transform-origin: 0 0;
+ transform-origin: top;
z-index: 1;
}
.t-cell-group--bordered::after {
@@ -57,8 +59,9 @@
right: 0;
left: 0;
bottom: 0;
- border-bottom: 1px solid var(--td-cell-group-border-color, var(--td-border-color, var(--td-gray-color-3, #e7e7e7)));
+ border-bottom: 1px solid var(--td-cell-group-border-color, var(--td-component-stroke, var(--td-gray-color-3, #e7e7e7)));
transform: scaleY(0.5);
+ transform-origin: bottom;
z-index: 1;
}
.t-cell-group--card {
diff --git a/miniprogram_npm/tdesign-miniprogram/cell/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/cell/README.en-US.md
index ed037d1..e71073e 100644
--- a/miniprogram_npm/tdesign-miniprogram/cell/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/cell/README.en-US.md
@@ -1,27 +1,81 @@
:: BASE_DOC ::
## API
+
### Cell Props
name | type | default | description | required
-- | -- | -- | -- | --
-align | String | middle | options:top/middle/bottom | N
-arrow | Boolean | false | \- | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+align | String | middle | options: top/middle/bottom | N
+arrow | Boolean / Object | false | \- | N
bordered | Boolean | true | \- | N
-description | String / Slot | - | \- | N
-external-classes | Array | - | `['t-class', 't-class-title', 't-class-note', 't-class-description', 't-class-thumb', 't-class-hover', 't-class-left', 't-class-right']` | N
+description | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
hover | Boolean | - | \- | N
-image | String / Slot | - | \- | N
-jump-type | String | navigateTo | options:switchTab/reLaunch/redirectTo/navigateTo | N
-left-icon | String / Slot | - | \- | N
-note | String / Slot | - | \- | N
+image | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+jump-type | String | navigateTo | options: switchTab/reLaunch/redirectTo/navigateTo | N
+left-icon | String / Object / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+note | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
required | Boolean | false | \- | N
-right-icon | String / Slot | - | \- | N
-title | String / Slot | - | \- | N
+right-icon | String / Object / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+title | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
url | String | - | \- | N
### Cell Events
name | params | description
-- | -- | --
-click | - | \-
+click | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts)
+### Cell External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-center | \-
+t-class-description | \-
+t-class-hover | \-
+t-class-image | \-
+t-class-left | \-
+t-class-left-icon | \-
+t-class-note | \-
+t-class-right | \-
+t-class-right-icon | \-
+t-class-title | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-cell-group-border-color | @border-color | -
+--td-cell-group-title-bg-color | @bg-color-secondarycontainer | -
+--td-cell-group-title-color | @font-gray-3 | -
+--td-cell-group-title-font-size | 28rpx | -
+--td-cell-group-title-line-height | 90rpx | -
+--td-cell-group-title-padding-left | 32rpx | -
+--td-cell-bg-color | @bg-color-container | -
+--td-cell-border-color | @component-stroke | -
+--td-cell-border-width | 1px | -
+--td-cell-border-left-space | @cell-horizontal-padding | -
+--td-cell-border-right-space | 0 | -
+--td-cell-description-color | @font-gray-2 | -
+--td-cell-description-font-size | @font-size-base | -
+--td-cell-description-line-height | 44rpx | -
+--td-cell-height | auto | -
+--td-cell-horizontal-padding | 32rpx | -
+--td-cell-hover-color | @bg-color-secondarycontainer | -
+--td-cell-image-height | 96rpx | -
+--td-cell-image-width | 96rpx | -
+--td-cell-left-icon-color | @brand-color | -
+--td-cell-left-icon-font-size | 48rpx | -
+--td-cell-line-height | 48rpx | -
+--td-cell-note-color | @font-gray-3 | -
+--td-cell-note-font-size | @font-size-m | -
+--td-cell-required-color | @error-color-6 | -
+--td-cell-required-font-size | @font-size-m | -
+--td-cell-right-icon-color | @font-gray-3 | -
+--td-cell-right-icon-font-size | 48rpx | -
+--td-cell-title-color | @font-gray-1 | -
+--td-cell-title-font-size | @font-size-m | -
+--td-cell-vertical-padding | 32rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/cell/README.md b/miniprogram_npm/tdesign-miniprogram/cell/README.md
index fda3de0..6488542 100644
--- a/miniprogram_npm/tdesign-miniprogram/cell/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/cell/README.md
@@ -12,12 +12,19 @@ isComponent: true
```json
"usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell"
+ "t-cell": "tdesign-miniprogram/cell/cell",
+ "t-cell-group": "tdesign-miniprogram/cell-group/cell-group"
}
```
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 类型
单行单元格
@@ -39,36 +46,81 @@ isComponent: true
{{ theme }}
## API
+
### Cell Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
align | String | middle | 内容的对齐方式,默认居中对齐。可选项:top/middle/bottom | N
-arrow | Boolean | false | 是否显示右侧箭头 | N
+arrow | Boolean / Object | false | 是否显示右侧箭头 | N
bordered | Boolean | true | 是否显示下边框 | N
-description | String / Slot | - | 下方内容描述 | N
-external-classes | Array | - | 组件类名,分别用于设置 组件外层类名、标题类名、下方描述内容类名、右侧说明文字类名、激活态类名、图片类名、左侧内容、左侧图标类名、右侧内容、右侧图标类名 等。`['t-class', 't-class-title', 't-class-description', 't-class-note', 't-class-hover', 't-class-image', 't-class-left', 't-class-left-icon', 't-class-right', 't-class-right-icon']` | N
+description | String / Slot | - | 下方内容描述。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
hover | Boolean | - | 是否开启点击反馈 | N
-image | String / Slot | - | 主图 | N
+image | String / Slot | - | 主图。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
jump-type | String | navigateTo | 链接跳转类型。可选项:switchTab/reLaunch/redirectTo/navigateTo | N
-left-icon | String / Slot | - | 左侧图标,出现在单元格标题的左侧 | N
-note | String / Slot | - | 和标题同行的说明文字 | N
+left-icon | String / Object / Slot | - | 左侧图标,出现在单元格标题的左侧。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+note | String / Slot | - | 和标题同行的说明文字。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
required | Boolean | false | 是否显示表单必填星号 | N
-right-icon | String / Slot | - | 最右侧图标 | N
-title | String / Slot | - | 标题 | N
+right-icon | String / Object / Slot | - | 最右侧图标。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+title | String / Slot | - | 标题。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
url | String | - | 点击后跳转链接地址。如果值为空,则表示不需要跳转 | N
### Cell Events
名称 | 参数 | 描述
-- | -- | --
-click | - | 右侧内容
+click | - | 右侧内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts)
+### Cell External Classes
-### CellGroup Props
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-center | 中间(`title`, `description`)内容样式类
+t-class-description | 下方描述内容样式类
+t-class-hover | 悬停样式类
+t-class-image | 图片样式类
+t-class-left | 左侧内容样式类
+t-class-left-icon | 左侧图标样式类
+t-class-note | 右侧说明文字样式类
+t-class-right | 右侧内容样式类
+t-class-right-icon | 右侧图标样式类
+t-class-title | 标题样式类
-名称 | 类型 | 默认值 | 说明 | 必传
--- | -- | -- | -- | --
-bordered | Boolean | - | 是否显示组边框 | N
-external-classes | Array | - | 组件类名。`['t-class']` | N
-theme | String | default | 单元格风格。可选项:default/card | N
-title | String | - | 单元格组标题 | N
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-cell-group-border-color | @component-stroke | -
+--td-cell-group-title-bg-color | @bg-color-secondarycontainer | -
+--td-cell-group-title-color | @font-gray-3 | -
+--td-cell-group-title-font-size | 28rpx | -
+--td-cell-group-title-line-height | 90rpx | -
+--td-cell-group-title-padding-left | 32rpx | -
+--td-cell-bg-color | @bg-color-container | -
+--td-cell-border-color | @component-stroke | -
+--td-cell-border-width | 1px | -
+--td-cell-border-left-space | @cell-horizontal-padding | -
+--td-cell-border-right-space | 0 | -
+--td-cell-description-color | @font-gray-2 | -
+--td-cell-description-font-size | @font-size-base | -
+--td-cell-description-line-height | 44rpx | -
+--td-cell-height | auto | -
+--td-cell-horizontal-padding | 32rpx | -
+--td-cell-hover-color | @bg-color-secondarycontainer | -
+--td-cell-image-height | 96rpx | -
+--td-cell-image-width | 96rpx | -
+--td-cell-left-icon-color | @brand-color | -
+--td-cell-left-icon-font-size | 48rpx | -
+--td-cell-line-height | 48rpx | -
+--td-cell-note-color | @font-gray-3 | -
+--td-cell-note-font-size | @font-size-m | -
+--td-cell-required-color | @error-color-6 | -
+--td-cell-required-font-size | @font-size-m | -
+--td-cell-right-icon-color | @font-gray-3 | -
+--td-cell-right-icon-font-size | 48rpx | -
+--td-cell-title-color | @font-gray-1 | -
+--td-cell-title-font-size | @font-size-m | -
+--td-cell-vertical-padding | 32rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/cell/cell.d.ts b/miniprogram_npm/tdesign-miniprogram/cell/cell.d.ts
index 192b303..d6a8910 100644
--- a/miniprogram_npm/tdesign-miniprogram/cell/cell.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/cell/cell.d.ts
@@ -11,6 +11,12 @@ export default class Cell extends SuperComponent {
classPrefix: string;
isLastChild: boolean;
};
+ observers: {
+ leftIcon(v: any): void;
+ rightIcon(v: any): void;
+ arrow(v: any): void;
+ };
+ setIcon(name: any, value: any, defaultValue: any): void;
onClick(e: any): void;
jumpLink(urlKey?: string, link?: string): void;
}
diff --git a/miniprogram_npm/tdesign-miniprogram/cell/cell.js b/miniprogram_npm/tdesign-miniprogram/cell/cell.js
index 940b3d2..c7c5ec5 100644
--- a/miniprogram_npm/tdesign-miniprogram/cell/cell.js
+++ b/miniprogram_npm/tdesign-miniprogram/cell/cell.js
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
+import { calcIcon } from '../common/utils';
const { prefix } = config;
const name = `${prefix}-cell`;
let Cell = class Cell extends SuperComponent {
@@ -21,6 +22,7 @@ let Cell = class Cell extends SuperComponent {
`${prefix}-class-image`,
`${prefix}-class-left`,
`${prefix}-class-left-icon`,
+ `${prefix}-class-center`,
`${prefix}-class-right`,
`${prefix}-class-right-icon`,
];
@@ -38,6 +40,22 @@ let Cell = class Cell extends SuperComponent {
classPrefix: name,
isLastChild: false,
};
+ this.observers = {
+ leftIcon(v) {
+ this.setIcon('_leftIcon', v, '');
+ },
+ rightIcon(v) {
+ this.setIcon('_rightIcon', v, '');
+ },
+ arrow(v) {
+ this.setIcon('_arrow', v, 'chevron-right');
+ },
+ };
+ }
+ setIcon(name, value, defaultValue) {
+ this.setData({
+ [name]: calcIcon(value, defaultValue),
+ });
}
onClick(e) {
this.triggerEvent('click', e.detail);
diff --git a/miniprogram_npm/tdesign-miniprogram/cell/cell.json b/miniprogram_npm/tdesign-miniprogram/cell/cell.json
index 9a40e60..b7d275d 100644
--- a/miniprogram_npm/tdesign-miniprogram/cell/cell.json
+++ b/miniprogram_npm/tdesign-miniprogram/cell/cell.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon",
"t-image": "../image/image"
diff --git a/miniprogram_npm/tdesign-miniprogram/cell/cell.wxml b/miniprogram_npm/tdesign-miniprogram/cell/cell.wxml
index e154869..c65c9a6 100644
--- a/miniprogram_npm/tdesign-miniprogram/cell/cell.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/cell/cell.wxml
@@ -1,3 +1,4 @@
+
-
-
-
+
+
{{ title}}
@@ -45,13 +46,17 @@
-
-
+
diff --git a/miniprogram_npm/tdesign-miniprogram/cell/cell.wxss b/miniprogram_npm/tdesign-miniprogram/cell/cell.wxss
index 6e6dd17..ffee90a 100644
--- a/miniprogram_npm/tdesign-miniprogram/cell/cell.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/cell/cell.wxss
@@ -30,7 +30,6 @@
display: flex;
box-sizing: border-box;
width: 100%;
- overflow: hidden;
padding: var(--td-cell-vertical-padding, 32rpx) var(--td-cell-horizontal-padding, 32rpx);
line-height: var(--td-cell-line-height, 48rpx);
height: var(--td-cell-height, auto);
@@ -44,10 +43,11 @@
right: 0;
left: 0;
bottom: 0;
- border-bottom: 1px solid var(--td-cell-border-color, var(--td-component-stroke, var(--td-gray-color-3, #e7e7e7)));
+ border-bottom: var(--td-cell-border-width, 1px) solid var(--td-cell-border-color, var(--td-component-stroke, var(--td-gray-color-3, #e7e7e7)));
transform: scaleY(0.5);
- left: var(--td-border-left-space, var(--td-cell-horizontal-padding, 32rpx));
- right: var(--td-border-right-space, 0);
+ transform-origin: bottom;
+ left: var(--td-cell-border-left-space, var(--td-cell-horizontal-padding, 32rpx));
+ right: var(--td-cell-border-right-space, 0);
}
.t-cell--borderless::after {
display: none;
@@ -55,7 +55,7 @@
.t-cell__description {
font-size: var(--td-cell-description-font-size, var(--td-font-size-base, 28rpx));
line-height: var(--td-cell-description-line-height, 44rpx);
- color: var(--td-cell-description-color, var(--td-font-gray-2, rgba(0, 0, 0, 0.6)));
+ color: var(--td-cell-description-color, var(--td-text-color-secondary, var(--td-font-gray-2, rgba(0, 0, 0, 0.6))));
}
.t-cell__description-text {
margin-top: calc(var(--td-spacer, 16rpx) / 2);
@@ -64,8 +64,7 @@
display: flex;
align-items: center;
justify-content: flex-end;
- overflow: hidden;
- color: var(--td-cell-note-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-cell-note-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
font-size: var(--td-cell-note-font-size, var(--td-font-size-m, 32rpx));
}
.t-cell__title,
@@ -79,7 +78,7 @@
.t-cell__title-text {
display: flex;
font-size: var(--td-cell-title-font-size, var(--td-font-size-m, 32rpx));
- color: var(--td-cell-title-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-cell-title-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
font-weight: 400;
}
.t-cell__left,
@@ -102,7 +101,7 @@
margin-left: calc(var(--td-spacer, 16rpx) / 2);
}
.t-cell__right-icon {
- color: var(--td-cell-right-icon-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-cell-right-icon-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
font-size: var(--td-cell-right-icon-font-size, 48rpx);
}
.t-cell--hover {
diff --git a/miniprogram_npm/tdesign-miniprogram/cell/props.js b/miniprogram_npm/tdesign-miniprogram/cell/props.js
index 8e741e8..c538253 100644
--- a/miniprogram_npm/tdesign-miniprogram/cell/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/cell/props.js
@@ -4,7 +4,7 @@ const props = {
value: 'middle',
},
arrow: {
- type: Boolean,
+ type: null,
value: false,
},
bordered: {
@@ -14,9 +14,6 @@ const props = {
description: {
type: String,
},
- externalClasses: {
- type: Array,
- },
hover: {
type: Boolean,
},
@@ -28,7 +25,7 @@ const props = {
value: 'navigateTo',
},
leftIcon: {
- type: String,
+ type: null,
},
note: {
type: String,
@@ -38,7 +35,7 @@ const props = {
value: false,
},
rightIcon: {
- type: String,
+ type: null,
},
title: {
type: String,
diff --git a/miniprogram_npm/tdesign-miniprogram/cell/type.d.ts b/miniprogram_npm/tdesign-miniprogram/cell/type.d.ts
index 4dccb9d..7ba2258 100644
--- a/miniprogram_npm/tdesign-miniprogram/cell/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/cell/type.d.ts
@@ -4,34 +4,17 @@ export interface TdCellProps {
value?: 'top' | 'middle' | 'bottom';
};
arrow?: {
- type: BooleanConstructor;
- value?: boolean;
+ type: null;
+ value?: boolean | object;
};
bordered?: {
type: BooleanConstructor;
value?: boolean;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
description?: {
type: StringConstructor;
value?: string;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: [
- 't-class',
- 't-class-title',
- 't-class-note',
- 't-class-description',
- 't-class-thumb',
- 't-class-hover',
- 't-class-left',
- 't-class-right'
- ];
- };
hover?: {
type: BooleanConstructor;
value?: boolean;
@@ -45,8 +28,8 @@ export interface TdCellProps {
value?: 'switchTab' | 'reLaunch' | 'redirectTo' | 'navigateTo';
};
leftIcon?: {
- type: StringConstructor;
- value?: string;
+ type: null;
+ value?: string | object;
};
note?: {
type: StringConstructor;
@@ -57,8 +40,8 @@ export interface TdCellProps {
value?: boolean;
};
rightIcon?: {
- type: StringConstructor;
- value?: string;
+ type: null;
+ value?: string | object;
};
title?: {
type: StringConstructor;
diff --git a/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.d.ts b/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.d.ts
index 44ab827..cbea034 100644
--- a/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.d.ts
@@ -24,5 +24,6 @@ export default class CheckTag extends SuperComponent {
methods: {
setClass(): void;
onClick(): void;
+ onClose(e: WechatMiniprogram.BaseEvent): void;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.js b/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.js
index c79bc9f..a6eef8c 100644
--- a/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.js
+++ b/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.js
@@ -47,7 +47,7 @@ let CheckTag = class CheckTag extends SuperComponent {
this.methods = {
setClass() {
const { classPrefix } = this.data;
- const { size, variant, disabled, checked } = this.properties;
+ const { size, variant, disabled, checked, shape } = this.properties;
const tagClass = [
classPrefix,
`${classPrefix}--checkable`,
@@ -56,6 +56,7 @@ let CheckTag = class CheckTag extends SuperComponent {
`${classPrefix}--${checked ? 'primary' : 'default'}`,
`${classPrefix}--${size}`,
`${classPrefix}--${variant}`,
+ `${classPrefix}--${shape}`,
];
const className = classNames(tagClass);
this.setData({
@@ -69,6 +70,11 @@ let CheckTag = class CheckTag extends SuperComponent {
this._trigger('click');
this._trigger('change', { checked: !checked });
},
+ onClose(e) {
+ if (this.data.disabled)
+ return;
+ this._trigger('close', e);
+ },
};
}
};
diff --git a/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.json b/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.json
index 049940c..f783dae 100644
--- a/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.json
+++ b/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.wxml b/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.wxml
index 6b67173..7dbdb9a 100644
--- a/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.wxml
@@ -12,4 +12,13 @@
{{checked ? content[0] : content[1]}}
{{content}}
+
diff --git a/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.wxss b/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.wxss
index c4080e7..548240b 100644
--- a/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/check-tag/check-tag.wxss
@@ -88,33 +88,42 @@
.t-tag--extra-large .t-icon-close {
font-size: var(--td-tag-extra-large-icon-size, 32rpx);
}
+.t-tag.t-tag--square {
+ border-radius: var(--td-tag-square-border-radius, 8rpx);
+}
+.t-tag.t-tag--round {
+ border-radius: var(--td-tag-round-border-radius, 999px);
+}
+.t-tag.t-tag--mark {
+ border-radius: 0 var(--td-tag-mark-border-radius, var(--td-tag-round-border-radius, 999px)) var(--td-tag-mark-border-radius, var(--td-tag-round-border-radius, 999px)) 0;
+}
.t-tag--dark.t-tag--default {
- color: var(--td-font-white-1, #ffffff);
+ color: var(--td-text-color-anti, var(--td-font-white-1, #ffffff));
border-color: var(--td-tag-default-color, var(--td-bg-color-component, var(--td-gray-color-3, #e7e7e7)));
background-color: var(--td-tag-default-color, var(--td-bg-color-component, var(--td-gray-color-3, #e7e7e7)));
}
.t-tag--dark.t-tag--primary {
- color: var(--td-font-white-1, #ffffff);
+ color: var(--td-text-color-anti, var(--td-font-white-1, #ffffff));
border-color: var(--td-tag-primary-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
background-color: var(--td-tag-primary-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
}
.t-tag--dark.t-tag--success {
- color: var(--td-font-white-1, #ffffff);
+ color: var(--td-text-color-anti, var(--td-font-white-1, #ffffff));
border-color: var(--td-tag-success-color, var(--td-success-color, var(--td-success-color-5, #2ba471)));
background-color: var(--td-tag-success-color, var(--td-success-color, var(--td-success-color-5, #2ba471)));
}
.t-tag--dark.t-tag--warning {
- color: var(--td-font-white-1, #ffffff);
+ color: var(--td-text-color-anti, var(--td-font-white-1, #ffffff));
border-color: var(--td-tag-warning-color, var(--td-warning-color, var(--td-warning-color-5, #e37318)));
background-color: var(--td-tag-warning-color, var(--td-warning-color, var(--td-warning-color-5, #e37318)));
}
.t-tag--dark.t-tag--danger {
- color: var(--td-font-white-1, #ffffff);
+ color: var(--td-text-color-anti, var(--td-font-white-1, #ffffff));
border-color: var(--td-tag-danger-color, var(--td-error-color, var(--td-error-color-6, #d54941)));
background-color: var(--td-tag-danger-color, var(--td-error-color, var(--td-error-color-6, #d54941)));
}
.t-tag--dark.t-tag--default {
- color: var(--td-tag-default-font-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-tag-default-font-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-tag--outline.t-tag--default {
color: var(--td-tag-default-color, var(--td-bg-color-component, var(--td-gray-color-3, #e7e7e7)));
@@ -142,7 +151,7 @@
background-color: var(--td-tag-danger-light-color, var(--td-error-color-1, #fff0ed));
}
.t-tag--outline.t-tag--default {
- color: var(--td-tag-default-font-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-tag-default-font-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-tag--outline.t-tag--default {
background-color: var(--td-tag-outline-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
@@ -185,7 +194,7 @@
background-color: var(--td-tag-danger-light-color, var(--td-error-color-1, #fff0ed));
}
.t-tag--light.t-tag--default {
- color: var(--td-tag-default-font-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-tag-default-font-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-tag--light-outline.t-tag--default {
color: var(--td-tag-default-color, var(--td-bg-color-component, var(--td-gray-color-3, #e7e7e7)));
@@ -213,12 +222,12 @@
background-color: var(--td-tag-danger-light-color, var(--td-error-color-1, #fff0ed));
}
.t-tag--light-outline.t-tag--default {
- color: var(--td-tag-default-font-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-tag-default-font-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
border-color: var(--td-component-border, var(--td-gray-color-4, #dcdcdc));
}
.t-tag.t-tag--closable.t-tag--disabled {
cursor: not-allowed;
- color: var(--td-tag-disabled-color, var(--td-font-gray-4, rgba(0, 0, 0, 0.26)));
+ color: var(--td-tag-disabled-color, var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26))));
background-color: var(--td-tag-disabled-background-color, var(--td-bg-color-component-disabled, var(--td-gray-color-2, #eeeeee)));
border-color: var(--td-tag-disabled-border-color, var(--td-component-border, var(--td-gray-color-4, #dcdcdc)));
}
diff --git a/miniprogram_npm/tdesign-miniprogram/check-tag/props.js b/miniprogram_npm/tdesign-miniprogram/check-tag/props.js
index e87cc38..cd3a325 100644
--- a/miniprogram_npm/tdesign-miniprogram/check-tag/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/check-tag/props.js
@@ -14,17 +14,10 @@ const props = {
content: {
type: null,
},
- style: {
- type: String,
- value: '',
- },
disabled: {
type: Boolean,
value: false,
},
- externalClasses: {
- type: Array,
- },
icon: {
type: null,
},
diff --git a/miniprogram_npm/tdesign-miniprogram/check-tag/type.d.ts b/miniprogram_npm/tdesign-miniprogram/check-tag/type.d.ts
index efc82b8..c047f1b 100644
--- a/miniprogram_npm/tdesign-miniprogram/check-tag/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/check-tag/type.d.ts
@@ -16,18 +16,10 @@ export interface TdCheckTagProps {
type: null;
value?: string | number | string[];
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class'];
- };
icon?: {
type: null;
value?: string | object;
diff --git a/miniprogram_npm/tdesign-miniprogram/checkbox-group/README.md b/miniprogram_npm/tdesign-miniprogram/checkbox-group/README.md
deleted file mode 100644
index da9a83f..0000000
--- a/miniprogram_npm/tdesign-miniprogram/checkbox-group/README.md
+++ /dev/null
@@ -1,59 +0,0 @@
----
-title: checkbox-group
-description: 组合多选框
-spline: form
-isComponent: true
----
-
-### 特性及兼容性
-
-无
-
-## 引入
-
-### 引入组件
-
-在 `app.json` 或 `page.json` 中引入组件:
-
-```json
-"usingComponents": {
- "t-checkbox": "tdesign-miniprogram/checkbox/checkbox",
- "t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group"
-}
-```
-
-## 用法
-
-### 组件方式
-
-```html
-
-
-
-
-
-```
-
-## API
-
-### `` 组件
-
-组件路径:`tdesign-miniprogram/checkbox-group/checkbox-group`
-
-#### Props
-
-| 属性 | 值类型 | 默认值 | 必传 | 说明 |
-| -------- | --------- | ------ | ---- | ---------------------- |
-| value | `Array` | `[]` | N | 当前选中项的标识符 |
-| name | `String` | - | N | 在表单内提交时的标识符 |
-### Slots
-
-| 名称 | 说明 |
-| ---- | ----------------- |
-| 默认 | `t-checkbox` 组件 |
-
-#### Events
-
-| 事件 | event.detail | 说明 |
-| ----------- | -------------------------- | ------------------------ |
-| bind:change | {names:当前选中项的标识符} | 当绑定值变化时触发的事件 |
diff --git a/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.d.ts b/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.d.ts
index 83d7578..fe1681b 100644
--- a/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.d.ts
@@ -7,45 +7,13 @@ export default class CheckBoxGroup extends SuperComponent {
classPrefix: string;
checkboxOptions: any[];
};
- properties: {
- borderless: {
- type: BooleanConstructor;
- value: boolean;
- };
- style?: {
- type: StringConstructor;
- value?: string;
- };
- disabled?: {
- type: BooleanConstructor;
- value?: boolean;
- };
- max?: {
- type: NumberConstructor;
- value?: number;
- };
- name?: {
- type: StringConstructor;
- value?: string;
- };
- options?: {
- type: ArrayConstructor;
- value?: import("./type").CheckboxOption[];
- };
- value?: {
- type: ArrayConstructor;
- value?: import("./type").CheckboxGroupValue;
- };
- defaultValue?: {
- type: ArrayConstructor;
- value?: import("./type").CheckboxGroupValue;
- };
- };
+ properties: import("./type").TdCheckboxGroupProps;
observers: {
value(): void;
+ options(): void;
+ disabled(v: any): void;
};
lifetimes: {
- attached(): void;
ready(): void;
};
controlledProps: {
@@ -54,12 +22,13 @@ export default class CheckBoxGroup extends SuperComponent {
}[];
$checkAll: any;
methods: {
- getChilds(): any;
+ getChildren(): any;
updateChildren(): void;
- updateValue({ value, checked, checkAll, indeterminate }: {
+ updateValue({ value, checked, checkAll, item, indeterminate }: {
value: any;
checked: any;
checkAll: any;
+ item: any;
indeterminate: any;
}): void;
initWithOptions(): void;
diff --git a/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.js b/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.js
index 0ac5d5a..6d57e56 100644
--- a/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.js
+++ b/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.js
@@ -23,19 +23,26 @@ let CheckBoxGroup = class CheckBoxGroup extends SuperComponent {
classPrefix: name,
checkboxOptions: [],
};
- this.properties = Object.assign(Object.assign({}, props), { borderless: {
- type: Boolean,
- value: false,
- } });
+ this.properties = props;
this.observers = {
value() {
this.updateChildren();
},
- };
- this.lifetimes = {
- attached() {
+ options() {
this.initWithOptions();
},
+ disabled(v) {
+ var _a;
+ if ((_a = this.data.options) === null || _a === void 0 ? void 0 : _a.length) {
+ this.initWithOptions();
+ return;
+ }
+ this.getChildren().forEach((item) => {
+ item.setDisabled(v);
+ });
+ },
+ };
+ this.lifetimes = {
ready() {
this.setCheckall();
},
@@ -48,7 +55,7 @@ let CheckBoxGroup = class CheckBoxGroup extends SuperComponent {
];
this.$checkAll = null;
this.methods = {
- getChilds() {
+ getChildren() {
let items = this.$children;
if (!items.length) {
items = this.selectAllComponents(`.${prefix}-checkbox-option`);
@@ -56,7 +63,7 @@ let CheckBoxGroup = class CheckBoxGroup extends SuperComponent {
return items || [];
},
updateChildren() {
- const items = this.getChilds();
+ const items = this.getChildren();
const { value } = this.data;
if (items.length > 0) {
items.forEach((item) => {
@@ -70,18 +77,20 @@ let CheckBoxGroup = class CheckBoxGroup extends SuperComponent {
}
}
},
- updateValue({ value, checked, checkAll, indeterminate }) {
+ updateValue({ value, checked, checkAll, item, indeterminate }) {
let { value: newValue } = this.data;
const { max } = this.data;
- const keySet = new Set(this.getChilds().map((item) => item.data.value));
+ const keySet = new Set(this.getChildren().map((item) => item.data.value));
newValue = newValue.filter((value) => keySet.has(value));
if (max && checked && newValue.length === max)
return;
if (checkAll) {
- const items = this.getChilds();
+ const items = this.getChildren();
newValue =
!checked && indeterminate
- ? items.map((item) => item.data.value)
+ ? items
+ .filter(({ data }) => !(data.disabled && !newValue.includes(data.value)))
+ .map((item) => item.data.value)
: items
.filter(({ data }) => {
if (data.disabled) {
@@ -98,20 +107,22 @@ let CheckBoxGroup = class CheckBoxGroup extends SuperComponent {
const index = newValue.findIndex((v) => v === value);
newValue.splice(index, 1);
}
- this._trigger('change', { value: newValue });
+ this._trigger('change', { value: newValue, context: item });
},
initWithOptions() {
- const { options } = this.data;
+ const { options, value, keys } = this.data;
if (!(options === null || options === void 0 ? void 0 : options.length) || !Array.isArray(options))
return;
const checkboxOptions = options.map((item) => {
+ var _a, _b, _c;
const isLabel = ['number', 'string'].includes(typeof item);
return isLabel
? {
label: `${item}`,
value: item,
+ checked: value === null || value === void 0 ? void 0 : value.includes(item),
}
- : Object.assign({}, item);
+ : Object.assign(Object.assign({}, item), { label: item[(_a = keys === null || keys === void 0 ? void 0 : keys.label) !== null && _a !== void 0 ? _a : 'label'], value: item[(_b = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _b !== void 0 ? _b : 'value'], checked: value === null || value === void 0 ? void 0 : value.includes(item[(_c = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _c !== void 0 ? _c : 'value']) });
});
this.setData({
checkboxOptions,
@@ -125,17 +136,17 @@ let CheckBoxGroup = class CheckBoxGroup extends SuperComponent {
if (item.checkAll) {
rect.indeterminate = (_a = this.$checkAll) === null || _a === void 0 ? void 0 : _a.data.indeterminate;
}
- this.updateValue(Object.assign(Object.assign(Object.assign({}, item), { checked }), rect));
+ this.updateValue(Object.assign(Object.assign(Object.assign({}, item), { checked, item }), rect));
},
setCheckall() {
- const items = this.getChilds();
+ const items = this.getChildren();
if (!this.$checkAll) {
this.$checkAll = items.find((item) => item.data.checkAll);
}
if (!this.$checkAll)
return;
const { value } = this.data;
- const valueSet = new Set(value.filter((val) => val !== this.$checkAll.data.value));
+ const valueSet = new Set(value === null || value === void 0 ? void 0 : value.filter((val) => val !== this.$checkAll.data.value));
const isCheckall = items.every((item) => (item.data.checkAll ? true : valueSet.has(item.data.value)));
this.$checkAll.setData({
checked: valueSet.size > 0,
diff --git a/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.json b/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.json
index dc01ceb..9d5b437 100644
--- a/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.json
+++ b/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-checkbox": "../checkbox/checkbox"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.wxml b/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.wxml
index da8af6e..7ad58da 100644
--- a/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/checkbox-group/checkbox-group.wxml
@@ -5,13 +5,24 @@
+ placement="{{item.placement || 'left'}}"
+ />
diff --git a/miniprogram_npm/tdesign-miniprogram/checkbox-group/props.js b/miniprogram_npm/tdesign-miniprogram/checkbox-group/props.js
index 9092042..008d05e 100644
--- a/miniprogram_npm/tdesign-miniprogram/checkbox-group/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/checkbox-group/props.js
@@ -1,12 +1,15 @@
const props = {
- style: {
- type: String,
- value: '',
- },
- disabled: {
+ borderless: {
type: Boolean,
value: false,
},
+ disabled: {
+ type: null,
+ value: undefined,
+ },
+ keys: {
+ type: Object,
+ },
max: {
type: Number,
value: undefined,
diff --git a/miniprogram_npm/tdesign-miniprogram/checkbox-group/type.d.ts b/miniprogram_npm/tdesign-miniprogram/checkbox-group/type.d.ts
index 641deb5..568a469 100644
--- a/miniprogram_npm/tdesign-miniprogram/checkbox-group/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/checkbox-group/type.d.ts
@@ -1,12 +1,17 @@
-export interface TdCheckboxGroupProps {
- style?: {
- type: StringConstructor;
- value?: string;
+import { KeysType } from '../common/common';
+export interface TdCheckboxGroupProps {
+ borderless?: {
+ type: BooleanConstructor;
+ value?: boolean;
};
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
+ keys?: {
+ type: ObjectConstructor;
+ value?: KeysType;
+ };
max?: {
type: NumberConstructor;
value?: number;
@@ -21,11 +26,11 @@ export interface TdCheckboxGroupProps {
};
value?: {
type: ArrayConstructor;
- value?: CheckboxGroupValue;
+ value?: T;
};
defaultValue?: {
type: ArrayConstructor;
- value?: CheckboxGroupValue;
+ value?: T;
};
}
export declare type CheckboxOption = string | number | CheckboxOptionObj;
@@ -35,4 +40,4 @@ export interface CheckboxOptionObj {
disabled?: boolean;
checkAll?: true;
}
-export declare type CheckboxGroupValue = Array;
+export declare type CheckboxGroupValue = Array;
diff --git a/miniprogram_npm/tdesign-miniprogram/checkbox/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/checkbox/README.en-US.md
index 9f79403..33355f7 100644
--- a/miniprogram_npm/tdesign-miniprogram/checkbox/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/checkbox/README.en-US.md
@@ -1,47 +1,88 @@
:: BASE_DOC ::
## API
+
### Checkbox Props
name | type | default | description | required
-- | -- | -- | -- | --
-placement | String | left | options:left/right | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
block | Boolean | true | \- | N
+borderless | Boolean | false | \- | N
check-all | Boolean | false | \- | N
checked | Boolean | false | \- | N
default-checked | Boolean | undefined | uncontrolled property | N
-content | String / Slot | - | \- | N
+content | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
content-disabled | Boolean | - | \- | N
disabled | Boolean | undefined | \- | N
-external-classes | Array | - | `['t-class', 't-class-icon', 't-class-label', 't-class-content', 't-class-border']` | N
icon | String / Array | 'circle' | Typescript:`'circle' \| 'line' \| 'rectangle' \| string[]` | N
indeterminate | Boolean | false | \- | N
-label | String / Slot | - | \- | N
+label | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
max-content-row | Number | 5 | \- | N
max-label-row | Number | 3 | \- | N
name | String | - | \- | N
+placement | String | left | options: left/right | N
readonly | Boolean | false | \- | N
-value | String / Number | - | Typescript:`string \| number \| boolean` | N
+value | String / Number / Boolean | - | value of checkbox。Typescript:`string \| number \| boolean` | N
### Checkbox Events
name | params | description
-- | -- | --
-change | `(checked: boolean)` | \-
+change | `(checked: boolean, context: { value: boolean\|number\|string, label: boolean\|number\|string })` | \-
+
+### Checkbox External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-border | \-
+t-class-content | \-
+t-class-icon | \-
+t-class-label | \-
+
### CheckboxGroup Props
name | type | default | description | required
-- | -- | -- | -- | --
-disabled | Boolean | false | \- | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+borderless | Boolean | false | \- | N
+disabled | Boolean | undefined | \- | N
+keys | Object | - | Typescript:`KeysType`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
max | Number | undefined | \- | N
name | String | - | \- | N
options | Array | [] | Typescript:`Array` `type CheckboxOption = string \| number \| CheckboxOptionObj` `interface CheckboxOptionObj { label?: string; value?: string \| number; disabled?: boolean; checkAll?: true }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N
-value | Array | [] | Typescript:`CheckboxGroupValue` `type CheckboxGroupValue = Array`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N
-default-value | Array | undefined | uncontrolled property。Typescript:`CheckboxGroupValue` `type CheckboxGroupValue = Array`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N
+value | Array | [] | Typescript:`T` `type CheckboxGroupValue = Array`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N
+default-value | Array | undefined | uncontrolled property。Typescript:`T` `type CheckboxGroupValue = Array`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N
### CheckboxGroup Events
name | params | description
-- | -- | --
-change | `(value: CheckboxGroupValue, context: CheckboxGroupChangeContext)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts)。
`interface CheckboxGroupChangeContext { e: Event; current: string \| number; option: CheckboxOption \| TdCheckboxProps; type: 'check' \| 'uncheck' }`
+change | `(value: CheckboxGroupValue, context: { value: boolean\|number\|string, label: boolean\|number\|string })` | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-checkbox-bg-color | @bg-color-container | -
+--td-checkbox-border-color | @component-stroke | -
+--td-checkbox-description-color | @text-color-secondary | -
+--td-checkbox-description-disabled-color | @text-color-disabled | -
+--td-checkbox-description-line-height | 44rpx | -
+--td-checkbox-font-size | 32rpx | -
+--td-checkbox-icon-checked-color | @brand-color | -
+--td-checkbox-icon-color | @component-border | -
+--td-checkbox-icon-disabled-bg-color | @bg-color-component-disabled | -
+--td-checkbox-icon-disabled-color | @brand-color-disabled | -
+--td-checkbox-icon-size | 48rpx | -
+--td-checkbox-tag-active-bg-color | @brand-color-light | -
+--td-checkbox-tag-active-color | @brand-color | -
+--td-checkbox-title-color | @text-color-primary | -
+--td-checkbox-title-disabled-color | @text-color-disabled | -
+--td-checkbox-title-line-height | 48rpx | -
+--td-checkbox-vertical-padding | 32rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/checkbox/README.md b/miniprogram_npm/tdesign-miniprogram/checkbox/README.md
index b046eec..f6030c1 100644
--- a/miniprogram_npm/tdesign-miniprogram/checkbox/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/checkbox/README.md
@@ -19,6 +19,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
纵向多选框
@@ -60,47 +66,87 @@ isComponent: true
{{ special }}
## API
+
### Checkbox Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-placement | String | left | 多选框和内容相对位置。可选项:left/right | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
block | Boolean | true | 是否为块级元素 | N
+borderless | Boolean | false | 是否开启无边框模式 | N
check-all | Boolean | false | 用于标识是否为「全选选项」。单独使用无效,需在 CheckboxGroup 中使用 | N
checked | Boolean | false | 是否选中 | N
default-checked | Boolean | undefined | 是否选中。非受控属性 | N
-content | String / Slot | - | 多选框内容 | N
+content | String / Slot | - | 多选框内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
content-disabled | Boolean | - | 是否禁用组件内容(content)触发选中 | N
-disabled | Boolean | undefined | 是否禁用组件 | N
-external-classes | Array | - | 组件类名,分别用于设置 组件外层、多选框图标、主文案、内容 等元素类名。`['t-class', 't-class-icon', 't-class-label', 't-class-content', 't-class-border']` | N
-icon | String / Array | 'circle' | 自定义选中图标和非选中图标。使用 Array 时表示:`[选中态图标,非选中态图标]`。使用 String 时,值为 circle 表示填充圆形图标、值为 line 表示描边型图标、值为 rectangle 表示填充矩形图标。TS 类型:`'circle' \| 'line' \| 'rectangle' \| string[]` | N
+disabled | Boolean | undefined | 是否禁用组件。如果父组件存在 CheckboxGroup,默认值由 CheckboxGroup.disabled 控制。优先级:Checkbox.disabled > CheckboxGroup.disabled > Form.disabled | N
+icon | String / Array | 'circle' | 自定义选中图标和非选中图标。使用 Array 时表示:`[选中态图标,非选中态图标,半选中态图标]`。使用 String 时,值为 circle 表示填充圆形图标、值为 line 表示描边型图标、值为 rectangle 表示填充矩形图标。TS 类型:`'circle' \| 'line' \| 'rectangle' \| string[]` | N
indeterminate | Boolean | false | 是否为半选 | N
-label | String / Slot | - | 主文案 | N
+label | String / Slot | - | 主文案。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
max-content-row | Number | 5 | 内容最大行数限制 | N
max-label-row | Number | 3 | 主文案最大行数限制 | N
name | String | - | HTML 元素原生属性 | N
+placement | String | left | 多选框和内容相对位置。可选项:left/right | N
readonly | Boolean | false | 只读状态 | N
-value | String / Number | - | 多选框的值。TS 类型:`string \| number` | N
+value | String / Number / Boolean | - | 多选框的值。TS 类型:`string \| number \| boolean` | N
### Checkbox Events
名称 | 参数 | 描述
-- | -- | --
-change | `(checked: boolean)` | 值变化时触发
+change | `(checked: boolean, context: { value: boolean\|number\|string, label: boolean\|number\|string })` | 值变化时触发。`context` 表示当前点击项内容。
+
+### Checkbox External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-border | 边框样式类
+t-class-content | 内容样式类
+t-class-icon | 图标样式类
+t-class-label | 标签样式类
+
### CheckboxGroup Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-disabled | Boolean | false | 是否禁用组件 | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+borderless | Boolean | false | 是否开启无边框模式 | N
+disabled | Boolean | undefined | 是否禁用组件。优先级:Form.disabled < CheckboxGroup.disabled < Checkbox.disabled | N
+keys | Object | - | 用来定义 value / label 在 `options` 中对应的字段别名。TS 类型:`KeysType`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
max | Number | undefined | 支持最多选中的数量 | N
name | String | - | 统一设置内部复选框 HTML 属性 | N
options | Array | [] | 以配置形式设置子元素。示例1:`['北京', '上海']` ,示例2: `[{ label: '全选', checkAll: true }, { label: '上海', value: 'shanghai' }]`。checkAll 值为 true 表示当前选项为「全选选项」。TS 类型:`Array` `type CheckboxOption = string \| number \| CheckboxOptionObj` `interface CheckboxOptionObj { label?: string; value?: string \| number; disabled?: boolean; checkAll?: true }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N
-value | Array | [] | 选中值。TS 类型:`CheckboxGroupValue` `type CheckboxGroupValue = Array`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N
-default-value | Array | undefined | 选中值。非受控属性。TS 类型:`CheckboxGroupValue` `type CheckboxGroupValue = Array`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N
+value | Array | [] | 选中值。TS 类型:`T` `type CheckboxGroupValue = Array`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N
+default-value | Array | undefined | 选中值。非受控属性。TS 类型:`T` `type CheckboxGroupValue = Array`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N
### CheckboxGroup Events
名称 | 参数 | 描述
-- | -- | --
-change | `(value: CheckboxGroupValue, context: CheckboxGroupChangeContext)` | 值变化时触发。`context.current` 表示当前变化的数据项,如果是全选则为空;`context.type` 表示引起选中数据变化的是选中或是取消选中,`context.option` 表示当前变化的数据项。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts)。
`interface CheckboxGroupChangeContext { e: Event; current: string \| number; option: CheckboxOption \| TdCheckboxProps; type: 'check' \| 'uncheck' }`
+change | `(value: CheckboxGroupValue, context: { value: boolean\|number\|string, label: boolean\|number\|string })` | 值变化时触发。`context` 表示当前点击项内容。
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-checkbox-bg-color | @bg-color-container | -
+--td-checkbox-border-color | @component-stroke | -
+--td-checkbox-description-color | @text-color-secondary | -
+--td-checkbox-description-disabled-color | @text-color-disabled | -
+--td-checkbox-description-line-height | 44rpx | -
+--td-checkbox-font-size | 32rpx | -
+--td-checkbox-icon-checked-color | @brand-color | -
+--td-checkbox-icon-color | @component-border | -
+--td-checkbox-icon-disabled-bg-color | @bg-color-component-disabled | -
+--td-checkbox-icon-disabled-color | @brand-color-disabled | -
+--td-checkbox-icon-size | 48rpx | -
+--td-checkbox-tag-active-bg-color | @brand-color-light | -
+--td-checkbox-tag-active-color | @brand-color | -
+--td-checkbox-title-color | @text-color-primary | -
+--td-checkbox-title-disabled-color | @text-color-disabled | -
+--td-checkbox-title-line-height | 48rpx | -
+--td-checkbox-vertical-padding | 32rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.d.ts b/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.d.ts
index 8f41b2b..d4d309d 100644
--- a/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.d.ts
@@ -9,18 +9,14 @@ export default class CheckBox extends SuperComponent {
type: StringConstructor;
value: string;
};
- borderless: {
- type: BooleanConstructor;
- value: boolean;
- };
- placement?: {
- type: StringConstructor;
- value?: "left" | "right";
- };
block?: {
type: BooleanConstructor;
value?: boolean;
};
+ borderless?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
checkAll?: {
type: BooleanConstructor;
value?: boolean;
@@ -41,21 +37,13 @@ export default class CheckBox extends SuperComponent {
type: BooleanConstructor;
value?: boolean;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ["t-class", "t-class-icon", "t-class-label", "t-class-content", "t-class-border"];
- };
icon?: {
type: null;
- value?: string[] | "circle" | "rectangle" | "line";
+ value?: string[] | "rectangle" | "circle" | "line";
};
indeterminate?: {
type: BooleanConstructor;
@@ -77,6 +65,10 @@ export default class CheckBox extends SuperComponent {
type: StringConstructor;
value?: string;
};
+ placement?: {
+ type: StringConstructor;
+ value?: "left" | "right";
+ };
readonly?: {
type: BooleanConstructor;
value?: boolean;
@@ -89,12 +81,17 @@ export default class CheckBox extends SuperComponent {
data: {
prefix: string;
classPrefix: string;
+ _disabled: boolean;
+ };
+ observers: {
+ disabled(v: any): void;
};
controlledProps: {
key: string;
event: string;
}[];
methods: {
- onChange(e: WechatMiniprogram.TouchEvent): void;
+ handleTap(e: WechatMiniprogram.TouchEvent): void;
+ setDisabled(disabled: Boolean): void;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.js b/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.js
index 0494989..43c8293 100644
--- a/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.js
+++ b/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.js
@@ -26,13 +26,17 @@ let CheckBox = class CheckBox extends SuperComponent {
linked(parent) {
const { value, disabled, borderless } = parent.data;
const valueSet = new Set(value);
+ const checkedFromParent = valueSet.has(this.data.value);
const data = {
- disabled: disabled || this.data.disabled,
+ _disabled: this.data.disabled == null ? disabled : this.data.disabled,
};
if (borderless) {
data.borderless = true;
}
- data.checked = valueSet.has(this.data.value);
+ data.checked = this.data.checked || checkedFromParent;
+ if (this.data.checked) {
+ parent.updateValue(this.data);
+ }
if (this.data.checkAll) {
data.checked = valueSet.size > 0;
}
@@ -46,13 +50,16 @@ let CheckBox = class CheckBox extends SuperComponent {
this.properties = Object.assign(Object.assign({}, Props), { theme: {
type: String,
value: 'default',
- }, borderless: {
- type: Boolean,
- value: false,
} });
this.data = {
prefix,
classPrefix: name,
+ _disabled: false,
+ };
+ this.observers = {
+ disabled(v) {
+ this.setData({ _disabled: v });
+ },
};
this.controlledProps = [
{
@@ -61,24 +68,26 @@ let CheckBox = class CheckBox extends SuperComponent {
},
];
this.methods = {
- onChange(e) {
- const { disabled, readonly } = this.data;
- if (disabled || readonly)
- return;
+ handleTap(e) {
+ const { _disabled, readonly, contentDisabled } = this.data;
const { target } = e.currentTarget.dataset;
- const { contentDisabled } = this.data;
- if (target === 'text' && contentDisabled) {
+ if (_disabled || readonly || (target === 'text' && contentDisabled))
return;
- }
+ const { value, label } = this.data;
const checked = !this.data.checked;
const parent = this.$parent;
if (parent) {
- parent.updateValue(Object.assign(Object.assign({}, this.data), { checked }));
+ parent.updateValue(Object.assign(Object.assign({}, this.data), { checked, item: { label, value, checked } }));
}
else {
- this._trigger('change', { checked });
+ this._trigger('change', { context: { value, label }, checked });
}
},
+ setDisabled(disabled) {
+ this.setData({
+ _disabled: this.data.disabled || disabled,
+ });
+ },
};
}
};
diff --git a/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.json b/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.json
index dfd59ed..f783dae 100644
--- a/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.json
+++ b/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.json
@@ -1,7 +1,7 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
- "t-cell": "../cell/cell",
"t-icon": "../icon/icon"
}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.wxml b/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.wxml
index 9feb113..eb9db8a 100644
--- a/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/checkbox/checkbox.wxml
@@ -5,16 +5,21 @@
class="{{_.cls(classPrefix, [placement, theme, ['checked', checked], ['block', block]])}} class {{prefix}}-class"
aria-role="checkbox"
aria-checked="{{checked ? (indeterminate ? 'mixed' : true) : false}}"
- aria-disabled="{{disabled ? true : false}}"
- bind:tap="onChange"
+ aria-disabled="{{_disabled ? true : false}}"
+ mut-bind:tap="handleTap"
tabindex="{{tabindex}}"
>
-
-
+
+
+
-
+
- {{label}}
+ {{label}}
{{content}}
+ >
+ {{content}}
+
+
在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
+
+### 组件类型
+
+基础
+
+{{ base }}
+
+
+增加间距
+
+{{ offset }}
+
+
+
+## API
+
+### Col Props
+
+名称 | 类型 | 默认值 | 描述 | 必传
+-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+offset | String / Number | - | 列的偏移量(默认单位px) | N
+span | String / Number | - | 列的宽度(默认单位px) | N
+
+
+### Row Props
+
+名称 | 类型 | 默认值 | 描述 | 必传
+-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+gutter | String / Number | - | 列之间的间距(默认单位px) | N
diff --git a/miniprogram_npm/tdesign-miniprogram/col/col.d.ts b/miniprogram_npm/tdesign-miniprogram/col/col.d.ts
new file mode 100644
index 0000000..ecebf64
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/col/col.d.ts
@@ -0,0 +1,10 @@
+import { SuperComponent, RelationsOptions } from '../common/src/index';
+export default class Col extends SuperComponent {
+ externalClasses: string[];
+ properties: import("./type").TdColProps;
+ data: {
+ prefix: string;
+ classPrefix: string;
+ };
+ relations: RelationsOptions;
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/col/col.js b/miniprogram_npm/tdesign-miniprogram/col/col.js
new file mode 100644
index 0000000..cbaecdd
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/col/col.js
@@ -0,0 +1,31 @@
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+import { SuperComponent, wxComponent } from '../common/src/index';
+import config from '../common/config';
+import props from './props';
+const { prefix } = config;
+const name = `${prefix}-col`;
+let Col = class Col extends SuperComponent {
+ constructor() {
+ super(...arguments);
+ this.externalClasses = [`${prefix}-class`];
+ this.properties = props;
+ this.data = {
+ prefix,
+ classPrefix: name,
+ };
+ this.relations = {
+ '../row/row': {
+ type: 'parent',
+ },
+ };
+ }
+};
+Col = __decorate([
+ wxComponent()
+], Col);
+export default Col;
diff --git a/miniprogram_npm/tdesign-miniprogram/col/col.json b/miniprogram_npm/tdesign-miniprogram/col/col.json
new file mode 100644
index 0000000..4f0a3f0
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/col/col.json
@@ -0,0 +1,5 @@
+{
+ "component": true,
+ "styleIsolation": "apply-shared",
+ "usingComponents": {}
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/col/col.wxml b/miniprogram_npm/tdesign-miniprogram/col/col.wxml
new file mode 100644
index 0000000..cd7f331
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/col/col.wxml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/miniprogram_npm/tdesign-miniprogram/col/col.wxs b/miniprogram_npm/tdesign-miniprogram/col/col.wxs
new file mode 100644
index 0000000..1822c0b
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/col/col.wxs
@@ -0,0 +1,17 @@
+var utils = require('../common/utils.wxs');
+
+function getColStyles(gutter, style, customStyle) {
+ var _style = '';
+ if (gutter) {
+ _style = utils._style({
+ 'padding-right': utils.addUnit(gutter / 2),
+ 'padding-left': utils.addUnit(gutter / 2),
+ });
+ }
+
+ return utils._style([style, customStyle]) + _style;
+}
+
+module.exports = {
+ getColStyles: getColStyles,
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/col/col.wxss b/miniprogram_npm/tdesign-miniprogram/col/col.wxss
new file mode 100644
index 0000000..8d6d0b9
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/col/col.wxss
@@ -0,0 +1,176 @@
+.t-float-left {
+ float: left;
+}
+.t-float-right {
+ float: right;
+}
+@keyframes tdesign-fade-out {
+ from {
+ opacity: 1;
+ }
+ to {
+ opacity: 0;
+ }
+}
+.hotspot-expanded.relative {
+ position: relative;
+}
+.hotspot-expanded::after {
+ content: '';
+ display: block;
+ position: absolute;
+ left: 0;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ transform: scale(1.5);
+}
+.t-col {
+ display: block;
+ box-sizing: border-box;
+ min-height: 1px;
+}
+.t-col--1 {
+ width: 4.16666667%;
+}
+.t-col--offset-1 {
+ margin-left: 4.16666667%;
+}
+.t-col--2 {
+ width: 8.33333333%;
+}
+.t-col--offset-2 {
+ margin-left: 8.33333333%;
+}
+.t-col--3 {
+ width: 12.5%;
+}
+.t-col--offset-3 {
+ margin-left: 12.5%;
+}
+.t-col--4 {
+ width: 16.66666667%;
+}
+.t-col--offset-4 {
+ margin-left: 16.66666667%;
+}
+.t-col--5 {
+ width: 20.83333333%;
+}
+.t-col--offset-5 {
+ margin-left: 20.83333333%;
+}
+.t-col--6 {
+ width: 25%;
+}
+.t-col--offset-6 {
+ margin-left: 25%;
+}
+.t-col--7 {
+ width: 29.16666667%;
+}
+.t-col--offset-7 {
+ margin-left: 29.16666667%;
+}
+.t-col--8 {
+ width: 33.33333333%;
+}
+.t-col--offset-8 {
+ margin-left: 33.33333333%;
+}
+.t-col--9 {
+ width: 37.5%;
+}
+.t-col--offset-9 {
+ margin-left: 37.5%;
+}
+.t-col--10 {
+ width: 41.66666667%;
+}
+.t-col--offset-10 {
+ margin-left: 41.66666667%;
+}
+.t-col--11 {
+ width: 45.83333333%;
+}
+.t-col--offset-11 {
+ margin-left: 45.83333333%;
+}
+.t-col--12 {
+ width: 50%;
+}
+.t-col--offset-12 {
+ margin-left: 50%;
+}
+.t-col--13 {
+ width: 54.16666667%;
+}
+.t-col--offset-13 {
+ margin-left: 54.16666667%;
+}
+.t-col--14 {
+ width: 58.33333333%;
+}
+.t-col--offset-14 {
+ margin-left: 58.33333333%;
+}
+.t-col--15 {
+ width: 62.5%;
+}
+.t-col--offset-15 {
+ margin-left: 62.5%;
+}
+.t-col--16 {
+ width: 66.66666667%;
+}
+.t-col--offset-16 {
+ margin-left: 66.66666667%;
+}
+.t-col--17 {
+ width: 70.83333333%;
+}
+.t-col--offset-17 {
+ margin-left: 70.83333333%;
+}
+.t-col--18 {
+ width: 75%;
+}
+.t-col--offset-18 {
+ margin-left: 75%;
+}
+.t-col--19 {
+ width: 79.16666667%;
+}
+.t-col--offset-19 {
+ margin-left: 79.16666667%;
+}
+.t-col--20 {
+ width: 83.33333333%;
+}
+.t-col--offset-20 {
+ margin-left: 83.33333333%;
+}
+.t-col--21 {
+ width: 87.5%;
+}
+.t-col--offset-21 {
+ margin-left: 87.5%;
+}
+.t-col--22 {
+ width: 91.66666667%;
+}
+.t-col--offset-22 {
+ margin-left: 91.66666667%;
+}
+.t-col--23 {
+ width: 95.83333333%;
+}
+.t-col--offset-23 {
+ margin-left: 95.83333333%;
+}
+.t-col--24 {
+ width: 100%;
+}
+.t-col--offset-24 {
+ margin-left: 100%;
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/col/props.d.ts b/miniprogram_npm/tdesign-miniprogram/col/props.d.ts
new file mode 100644
index 0000000..15de965
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/col/props.d.ts
@@ -0,0 +1,3 @@
+import { TdColProps } from './type';
+declare const props: TdColProps;
+export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/col/props.js b/miniprogram_npm/tdesign-miniprogram/col/props.js
new file mode 100644
index 0000000..05857f3
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/col/props.js
@@ -0,0 +1,9 @@
+const props = {
+ offset: {
+ type: null,
+ },
+ span: {
+ type: null,
+ },
+};
+export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/col/type.d.ts b/miniprogram_npm/tdesign-miniprogram/col/type.d.ts
new file mode 100644
index 0000000..af55fa4
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/col/type.d.ts
@@ -0,0 +1,10 @@
+export interface TdColProps {
+ offset?: {
+ type: null;
+ value?: string | number;
+ };
+ span?: {
+ type: null;
+ value?: string | number;
+ };
+}
diff --git a/pages/home/home.d.ts b/miniprogram_npm/tdesign-miniprogram/col/type.js
similarity index 100%
rename from pages/home/home.d.ts
rename to miniprogram_npm/tdesign-miniprogram/col/type.js
diff --git a/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.d.ts b/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.d.ts
index 5301e80..4ae0ff4 100644
--- a/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.d.ts
@@ -17,9 +17,11 @@ export default class CollapsePanel extends SuperComponent {
ultimateExpandIcon: boolean;
ultimateDisabled: boolean;
};
+ observers: {
+ disabled(v: any): void;
+ };
methods: {
- set(data: Record): Promise;
- updateExpanded(activeValues: any): void;
+ updateExpanded(activeValues?: any[]): void;
updateStyle(expanded: boolean): Promise;
onClick(): void;
};
diff --git a/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.js b/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.js
index 04d9611..27b3214 100644
--- a/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.js
+++ b/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.js
@@ -21,14 +21,12 @@ let CollapsePanel = class CollapsePanel extends SuperComponent {
'../collapse/collapse': {
type: 'ancestor',
linked(target) {
- this.parent = target;
- const { value, defaultExpandAll, expandMutex, expandIcon, disabled } = target.properties;
- const activeValues = defaultExpandAll && !expandMutex ? [this.properties.value] : value;
+ const { value, expandIcon, disabled } = target.properties;
this.setData({
- ultimateExpandIcon: expandIcon || this.properties.expandIcon,
+ ultimateExpandIcon: this.properties.expandIcon == null ? expandIcon : this.properties.expandIcon,
ultimateDisabled: this.properties.disabled == null ? disabled : this.properties.disabled,
});
- this.updateExpanded(activeValues);
+ this.updateExpanded(value);
},
},
};
@@ -41,17 +39,19 @@ let CollapsePanel = class CollapsePanel extends SuperComponent {
ultimateExpandIcon: false,
ultimateDisabled: false,
};
- this.methods = {
- set(data) {
- this.setData(data);
- return new Promise((resolve) => wx.nextTick(resolve));
+ this.observers = {
+ disabled(v) {
+ this.setData({ ultimateDisabled: !!v });
},
- updateExpanded(activeValues) {
- if (!this.parent) {
+ };
+ this.methods = {
+ updateExpanded(activeValues = []) {
+ if (!this.$parent) {
return;
}
const { value } = this.properties;
- const expanded = activeValues.includes(value);
+ const { defaultExpandAll } = this.$parent.data;
+ const expanded = defaultExpandAll ? !this.data.expanded : activeValues.includes(value);
if (expanded === this.properties.expanded)
return;
this.setData({ expanded });
@@ -79,7 +79,12 @@ let CollapsePanel = class CollapsePanel extends SuperComponent {
const { value } = this.properties;
if (ultimateDisabled)
return;
- this.parent.switch(value);
+ if (this.$parent.data.defaultExpandAll) {
+ this.updateExpanded();
+ }
+ else {
+ this.$parent.switch(value);
+ }
},
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.json b/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.json
index 5160a95..e33d33e 100644
--- a/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.json
+++ b/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-cell": "../cell/cell"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.wxml b/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.wxml
index 370e7a9..577ca8e 100644
--- a/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.wxml
@@ -15,6 +15,7 @@
title="{{header}}"
note="{{headerRightContent}}"
bordered
+ left-icon="{{headerLeftIcon}}"
right-icon="{{ ultimateExpandIcon ? (expanded ? 'chevron-up' : 'chevron-down') : '' }}"
t-class="{{_.cls(classPrefix + '__header', [placement, ['expanded', expanded]])}} {{prefix}}-class-header"
t-class-title="class-title {{ultimateDisabled ? 'class-title--disabled' : ''}}"
@@ -22,13 +23,16 @@
t-class-right-icon="class-right-icon {{classPrefix}}__arrow--{{placement}} {{ultimateDisabled ? 'class-right-icon--disabled' : ''}}"
t-class-hover="class-header-hover"
>
+
-
+
{{content}}
diff --git a/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.wxss b/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.wxss
index 5405c83..92cccc6 100644
--- a/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.wxss
@@ -26,25 +26,8 @@
transform: scale(1.5);
}
.t-collapse-panel {
- position: relative;
background-color: var(--td-collapse-panel-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
}
-.t-collapse-panel::after {
- content: '';
- display: block;
- position: absolute;
- top: unset;
- bottom: 0;
- left: unset;
- right: unset;
- background-color: var(--td-collapse-border-color, var(--td-border-color, var(--td-gray-color-3, #e7e7e7)));
-}
-.t-collapse-panel::after {
- height: 1px;
- left: 0;
- right: 0;
- transform: scaleY(0.5);
-}
.t-collapse-panel--disabled {
pointer-events: none;
}
@@ -62,8 +45,8 @@
justify-content: space-between;
align-items: center;
padding-left: var(--td-collapse-horizontal-padding, 32rpx);
- height: var(--td-collapse-header-height, 96rpx);
- color: var(--td-collapse-header-text-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ height: var(--td-collapse-header-height, auto);
+ color: var(--td-collapse-header-text-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-collapse-panel__header--top {
position: relative;
@@ -76,7 +59,7 @@
bottom: unset;
left: unset;
right: unset;
- background-color: var(--td-collapse-border-color, var(--td-border-color, var(--td-gray-color-3, #e7e7e7)));
+ background-color: var(--td-collapse-border-color, var(--td-border-level-1-color, var(--td-gray-color-3, #e7e7e7)));
}
.t-collapse-panel__header--top::after {
height: 1px;
@@ -95,7 +78,7 @@
bottom: 0;
left: unset;
right: unset;
- background-color: var(--td-collapse-border-color, var(--td-border-color, var(--td-gray-color-3, #e7e7e7)));
+ background-color: var(--td-collapse-border-color, var(--td-border-level-1-color, var(--td-gray-color-3, #e7e7e7)));
}
.t-collapse-panel__header--bottom::after {
height: 1px;
@@ -103,13 +86,9 @@
right: 0;
transform: scaleY(0.5);
}
-.t-collapse-panel__header:after {
- display: none;
+.t-collapse-panel__header::after {
left: 32rpx;
}
-.t-collapse-panel__header--expanded:after {
- display: block;
-}
.t-collapse-panel__header-right {
display: inline-flex;
align-items: center;
@@ -136,7 +115,7 @@
bottom: 0;
left: unset;
right: unset;
- background-color: var(--td-collapse-border-color, var(--td-border-color, var(--td-gray-color-3, #e7e7e7)));
+ background-color: var(--td-collapse-border-color, var(--td-border-level-1-color, var(--td-gray-color-3, #e7e7e7)));
}
.t-collapse-panel__body::after {
height: 1px;
@@ -149,11 +128,52 @@
overflow: hidden;
}
.t-collapse-panel__content {
- color: var(--td-collapse-content-text-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-collapse-content-text-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
font-size: var(--td-collapse-content-font-size, var(--td-font-size-base, 28rpx));
padding: var(--td-collapse-content-padding, 32rpx);
line-height: var(--td-collapse-content-line-height, 1.5);
}
+.t-collapse-panel__content--disabled {
+ color: var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26)));
+}
+.t-collapse-panel__content--expanded.t-collapse-panel__content--bottom {
+ position: relative;
+}
+.t-collapse-panel__content--expanded.t-collapse-panel__content--bottom::after {
+ content: '';
+ display: block;
+ position: absolute;
+ top: unset;
+ bottom: 0;
+ left: unset;
+ right: unset;
+ background-color: var(--td-collapse-border-color, var(--td-border-level-1-color, var(--td-gray-color-3, #e7e7e7)));
+}
+.t-collapse-panel__content--expanded.t-collapse-panel__content--bottom::after {
+ height: 1px;
+ left: 0;
+ right: 0;
+ transform: scaleY(0.5);
+}
+.t-collapse-panel__content--expanded.t-collapse-panel__content--top {
+ position: relative;
+}
+.t-collapse-panel__content--expanded.t-collapse-panel__content--top::after {
+ content: '';
+ display: block;
+ position: absolute;
+ top: 0;
+ bottom: unset;
+ left: unset;
+ right: unset;
+ background-color: var(--td-collapse-border-color, var(--td-border-level-1-color, var(--td-gray-color-3, #e7e7e7)));
+}
+.t-collapse-panel__content--expanded.t-collapse-panel__content--top::after {
+ height: 1px;
+ left: 0;
+ right: 0;
+ transform: scaleY(0.5);
+}
.t-collapse-panel__arrow--top {
transform: rotate(180deg);
}
@@ -161,11 +181,11 @@
font-size: var(--td-collapse-title-font-size, var(--td-font-size-m, 32rpx));
}
.class-title--disabled {
- color: var(--td-font-gray-4, rgba(0, 0, 0, 0.26));
+ color: var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26)));
}
.class-note--disabled {
- color: var(--td-font-gray-4, rgba(0, 0, 0, 0.26));
+ color: var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26)));
}
.class-right-icon--disabled {
- color: var(--td-font-gray-4, rgba(0, 0, 0, 0.26));
+ color: var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26)));
}
diff --git a/miniprogram_npm/tdesign-miniprogram/collapse-panel/props.js b/miniprogram_npm/tdesign-miniprogram/collapse-panel/props.js
index 894f32a..429cd0a 100644
--- a/miniprogram_npm/tdesign-miniprogram/collapse-panel/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/collapse-panel/props.js
@@ -3,11 +3,11 @@ const props = {
type: String,
},
disabled: {
- type: Boolean,
+ type: null,
value: undefined,
},
expandIcon: {
- type: Boolean,
+ type: null,
value: undefined,
},
externalClasses: {
@@ -16,6 +16,9 @@ const props = {
header: {
type: String,
},
+ headerLeftIcon: {
+ type: String,
+ },
headerRightContent: {
type: String,
},
diff --git a/miniprogram_npm/tdesign-miniprogram/collapse-panel/type.d.ts b/miniprogram_npm/tdesign-miniprogram/collapse-panel/type.d.ts
index 315131a..9834253 100644
--- a/miniprogram_npm/tdesign-miniprogram/collapse-panel/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/collapse-panel/type.d.ts
@@ -3,10 +3,6 @@ export interface TdCollapsePanelProps {
type: StringConstructor;
value?: string;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
disabled?: {
type: BooleanConstructor;
value?: boolean;
@@ -23,6 +19,10 @@ export interface TdCollapsePanelProps {
type: StringConstructor;
value?: string;
};
+ headerLeftIcon?: {
+ type: StringConstructor;
+ value?: string;
+ };
headerRightContent?: {
type: StringConstructor;
value?: string;
diff --git a/miniprogram_npm/tdesign-miniprogram/collapse/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/collapse/README.en-US.md
index 2e6fc25..f1edbff 100644
--- a/miniprogram_npm/tdesign-miniprogram/collapse/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/collapse/README.en-US.md
@@ -1,15 +1,18 @@
:: BASE_DOC ::
## API
+
### Collapse Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
default-expand-all | Boolean | false | \- | N
disabled | Boolean | - | \- | N
-expand-icon | Boolean / Slot | true | \- | N
+expand-icon | Boolean | true | \- | N
expand-mutex | Boolean | false | \- | N
-theme | String | default | options:default/card | N
+theme | String | default | options: default/card | N
value | Array | [] | Typescript:`CollapseValue` `type CollapseValue = Array`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/collapse/type.ts) | N
default-value | Array | undefined | uncontrolled property。Typescript:`CollapseValue` `type CollapseValue = Array`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/collapse/type.ts) | N
@@ -19,15 +22,44 @@ name | params | description
-- | -- | --
change | `(value: CollapseValue)` | \-
+
### CollapsePanel Props
name | type | default | description | required
-- | -- | -- | -- | --
-content | String / Slot | - | \- | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+content | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
disabled | Boolean | undefined | \- | N
-expand-icon | Boolean / Slot | undefined | \- | N
-external-classes | Array | - | `['t-class', 't-class-header', 't-class-content']` | N
-header | String / Slot | - | \- | N
-header-right-content | String / Slot | - | \- | N
-placement | String | bottom | `0.34.0`。options:bottom/top | N
+expand-icon | Boolean / Slot | undefined | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+header | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+header-left-icon | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+header-right-content | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+placement | String | bottom | `0.34.0`。options: bottom/top | N
value | String / Number | - | \- | N
+### CollapsePanel External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-content | \-
+t-class-header | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-collapse-border-color | @border-level-1-color | -
+--td-collapse-content-font-size | @font-size-base | -
+--td-collapse-content-line-height | 1.5 | -
+--td-collapse-content-padding | 32rpx | -
+--td-collapse-content-text-color | @text-color-primary | -
+--td-collapse-extra-font-size | @font-size-m | -
+--td-collapse-header-height | auto | -
+--td-collapse-header-text-color | @text-color-primary | -
+--td-collapse-header-text-disabled-color | @text-color-disabled | -
+--td-collapse-horizontal-padding | 32rpx | -
+--td-collapse-icon-color | @font-gray-3 | -
+--td-collapse-panel-bg-color | @bg-color-container | -
+--td-collapse-title-font-size | @font-size-m | -
diff --git a/miniprogram_npm/tdesign-miniprogram/collapse/README.md b/miniprogram_npm/tdesign-miniprogram/collapse/README.md
index 84e1212..22a3352 100644
--- a/miniprogram_npm/tdesign-miniprogram/collapse/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/collapse/README.md
@@ -27,6 +27,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 类型
基础折叠面板
@@ -49,13 +55,16 @@ isComponent: true
{{ theme }}
## API
+
### Collapse Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
default-expand-all | Boolean | false | 默认是否展开全部 | N
disabled | Boolean | - | 是否禁用面板展开/收起操作 | N
-expand-icon | Boolean | true | 展开图标。值为 undefined 或 false 则不显示展开图标;值为 true 显示默认图标 | N
+expand-icon | Boolean | true | 展开图标 | N
expand-mutex | Boolean | false | 每个面板互斥展开,每次只展开一个面板 | N
theme | String | default | 折叠面板风格。可选项:default/card | N
value | Array | [] | 展开的面板集合。TS 类型:`CollapseValue` `type CollapseValue = Array`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/collapse/type.ts) | N
@@ -67,15 +76,44 @@ default-value | Array | undefined | 展开的面板集合。非受控属性。TS
-- | -- | --
change | `(value: CollapseValue)` | 切换面板时触发,返回变化的值
+
### CollapsePanel Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-content | String / Slot | - | 折叠面板内容 | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+content | String / Slot | - | 折叠面板内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
disabled | Boolean | undefined | 禁止当前面板展开,优先级大于 Collapse 的同名属性 | N
-expand-icon | Boolean / Slot | undefined | 当前折叠面板展开图标,优先级大于 Collapse 的同名属性 | N
-external-classes | Array | - | 组件类名,用于组件外层元素、标题、内容。`['t-class', 't-class-header', 't-class-content']` | N
-header | String / Slot | - | 面板头内容 | N
-header-right-content | String / Slot | - | 面板头的右侧区域,一般用于呈现面板操作 | N
+expand-icon | Boolean / Slot | undefined | 当前折叠面板展开图标,优先级大于 Collapse 的同名属性。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+header | String / Slot | - | 面板头内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+header-left-icon | String / Slot | - | 面板头左侧图标。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+header-right-content | String / Slot | - | 面板头的右侧区域,一般用于呈现面板操作。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
placement | String | bottom | `0.34.0`。选项卡内容的位置。可选项:bottom/top | N
value | String / Number | - | 当前面板唯一标识,如果值为空则取当前面下标兜底作为唯一标识 | N
+### CollapsePanel External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-content | 内容样式类
+t-class-header | 头部样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-collapse-border-color | @border-level-1-color | -
+--td-collapse-content-font-size | @font-size-base | -
+--td-collapse-content-line-height | 1.5 | -
+--td-collapse-content-padding | 32rpx | -
+--td-collapse-content-text-color | @text-color-primary | -
+--td-collapse-extra-font-size | @font-size-m | -
+--td-collapse-header-height | auto | -
+--td-collapse-header-text-color | @text-color-primary | -
+--td-collapse-header-text-disabled-color | @text-color-disabled | -
+--td-collapse-horizontal-padding | 32rpx | -
+--td-collapse-icon-color | @font-gray-3 | -
+--td-collapse-panel-bg-color | @bg-color-container | -
+--td-collapse-title-font-size | @font-size-m | -
diff --git a/miniprogram_npm/tdesign-miniprogram/collapse/collapse.d.ts b/miniprogram_npm/tdesign-miniprogram/collapse/collapse.d.ts
index 426459f..9fcf0ce 100644
--- a/miniprogram_npm/tdesign-miniprogram/collapse/collapse.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/collapse/collapse.d.ts
@@ -3,9 +3,6 @@ import type { CollapseValue, TdCollapseProps } from './type';
export interface CollapseProps extends TdCollapseProps {
}
export default class Collapse extends SuperComponent {
- options: {
- addGlobalClass: boolean;
- };
externalClasses: string[];
relations: RelationsOptions;
controlledProps: {
diff --git a/miniprogram_npm/tdesign-miniprogram/collapse/collapse.js b/miniprogram_npm/tdesign-miniprogram/collapse/collapse.js
index b7b26eb..cf6631f 100644
--- a/miniprogram_npm/tdesign-miniprogram/collapse/collapse.js
+++ b/miniprogram_npm/tdesign-miniprogram/collapse/collapse.js
@@ -12,16 +12,10 @@ const name = `${prefix}-collapse`;
let Collapse = class Collapse extends SuperComponent {
constructor() {
super(...arguments);
- this.options = {
- addGlobalClass: true,
- };
this.externalClasses = [`${prefix}-class`];
this.relations = {
'../collapse-panel/collapse-panel': {
type: 'descendant',
- linked() {
- this.updateExpanded();
- },
},
};
this.controlledProps = [
diff --git a/miniprogram_npm/tdesign-miniprogram/collapse/collapse.json b/miniprogram_npm/tdesign-miniprogram/collapse/collapse.json
index 467ce29..79f2730 100644
--- a/miniprogram_npm/tdesign-miniprogram/collapse/collapse.json
+++ b/miniprogram_npm/tdesign-miniprogram/collapse/collapse.json
@@ -1,3 +1,4 @@
{
- "component": true
+ "component": true,
+ "styleIsolation": "apply-shared"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/collapse/type.d.ts b/miniprogram_npm/tdesign-miniprogram/collapse/type.d.ts
index b9cff85..8599bc1 100644
--- a/miniprogram_npm/tdesign-miniprogram/collapse/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/collapse/type.d.ts
@@ -1,8 +1,4 @@
export interface TdCollapseProps {
- style?: {
- type: StringConstructor;
- value?: string;
- };
defaultExpandAll?: {
type: BooleanConstructor;
value?: boolean;
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/color-picker/README.en-US.md
new file mode 100644
index 0000000..7c5d2cf
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/README.en-US.md
@@ -0,0 +1,28 @@
+:: BASE_DOC ::
+
+## API
+
+### ColorPicker Props
+
+name | type | default | description | required
+-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+auto-close | Boolean | true | \- | N
+enable-alpha | Boolean | false | \- | N
+format | String | RGB | options: RGB/RGBA/HSL/HSLA/HSB/HSV/HSVA/HEX/CMYK/CSS | N
+popup-props | Object | {} | Typescript:`PopupProps`,[Popup API Documents](./popup?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts) | N
+swatch-colors | Array | - | swatch colors。Typescript:`Array \| null` | N
+type | String | base | options: base/multiple。Typescript:`TypeEnum ` `type TypeEnum = 'base' \| 'multiple'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts) | N
+use-popup | Boolean | false | \- | N
+value | String | - | color value | N
+default-value | String | undefined | color value。uncontrolled property | N
+visible | Boolean | false | \- | N
+
+### ColorPicker Events
+
+name | params | description
+-- | -- | --
+change | `(value: string, context: { color: ColorObject; trigger: ColorPickerChangeTrigger })` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts)。
`type ColorPickerChangeTrigger = 'palette-hue-bar' \| 'palette-alpha-bar' \| 'preset' `
+close | `(trigger: ColorPickerTrigger)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts)。
`type ColorPickerTrigger = 'overlay'`
+palette-bar-change | `(detail: { color: ColorObject })` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts)。
`interface ColorObject { alpha: number; css: string; hex: string; hex8: string; hsl: string; hsla: string; hsv: string; hsva: string; rgb: string; rgba: string; value: number;}`
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/README.md b/miniprogram_npm/tdesign-miniprogram/color-picker/README.md
new file mode 100644
index 0000000..6167715
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/README.md
@@ -0,0 +1,62 @@
+---
+title: ColorPicker 颜色选择器
+description: 用于颜色选择,支持多种格式。
+spline: data
+isComponent: true
+---
+
+


+
+## 引入
+
+全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
+
+```json
+"usingComponents": {
+ "t-color-picker": "tdesign-miniprogram/color-picker/color-picker"
+}
+```
+
+## 代码演示
+
+### 组件类型
+
+#### 基础颜色选择器
+
+{{ base }}
+
+#### 带色板的颜色选择器
+
+{{ multiple }}
+
+### 组件状态
+
+{{ format }}
+
+
+## API
+
+### ColorPicker Props
+
+名称 | 类型 | 默认值 | 描述 | 必传
+-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+auto-close | Boolean | true | 自动关闭。在点击遮罩层时自动关闭,不需要手动设置 visible | N
+enable-alpha | Boolean | false | 是否开启透明通道 | N
+format | String | RGB | 格式化色值。`enableAlpha` 为真时,`RGBA/HSLA/HSVA` 等值有效。可选项:RGB/RGBA/HSL/HSLA/HSB/HSV/HSVA/HEX/CMYK/CSS | N
+popup-props | Object | {} | popupProps透传。TS 类型:`PopupProps`,[Popup API Documents](./popup?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts) | N
+swatch-colors | Array | - | 系统预设的颜色样例,值为 `null` 或 `[]` 则不显示系统色,值为 `undefined` 会显示组件内置的系统默认色。TS 类型:`Array \| null` | N
+type | String | base | 颜色选择器类型。(base 表示仅展示系统预设内容; multiple 表示展示色板和系统预设内容。可选项:base/multiple。TS 类型:`TypeEnum ` `type TypeEnum = 'base' \| 'multiple'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts) | N
+use-popup | Boolean | false | 是否使用弹出层包裹颜色选择器 | N
+value | String | - | 色值 | N
+default-value | String | undefined | 色值。非受控属性 | N
+visible | Boolean | false | 是否显示颜色选择器。`usePopup` 为 true 时有效 | N
+
+### ColorPicker Events
+
+名称 | 参数 | 描述
+-- | -- | --
+change | `(value: string, context: { color: ColorObject; trigger: ColorPickerChangeTrigger })` | 选中的色值发生变化时触发,第一个参数 `value` 表示新色值,`context.color` 表示当前调色板控制器的色值,`context.trigger` 表示触发颜色变化的来源。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts)。
`type ColorPickerChangeTrigger = 'palette-hue-bar' \| 'palette-alpha-bar' \| 'preset' `
+close | `(trigger: ColorPickerTrigger)` | 关闭按钮时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts)。
`type ColorPickerTrigger = 'overlay'`
+palette-bar-change | `(detail: { color: ColorObject })` | 调色板控制器的值变化时触发,`context.color` 指调色板控制器的值。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts)。
`interface ColorObject { alpha: number; css: string; hex: string; hex8: string; hsl: string; hsla: string; hsv: string; hsva: string; rgb: string; rgba: string; value: number;}`
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/color-picker.d.ts b/miniprogram_npm/tdesign-miniprogram/color-picker/color-picker.d.ts
new file mode 100644
index 0000000..bc1f89f
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/color-picker.d.ts
@@ -0,0 +1,98 @@
+import { SuperComponent } from '../common/src/index';
+import type { Coordinate } from './interfaces';
+import { Color } from './utils';
+export default class ColorPicker extends SuperComponent {
+ properties: import("./type").TdColorPickerProps;
+ observers: {
+ format(): void;
+ swatchColors(value: any): void;
+ type(value: any): void;
+ 'usePopup, visible'(usePopup: boolean, visible: boolean): void;
+ };
+ color: Color;
+ data: {
+ prefix: string;
+ classPrefix: string;
+ panelRect: {
+ width: number;
+ height: number;
+ };
+ sliderRect: {
+ width: number;
+ left: number;
+ };
+ saturationInfo: {
+ saturation: number;
+ value: number;
+ };
+ saturationThumbStyle: {
+ left: number;
+ top: number;
+ };
+ sliderInfo: {
+ value: number;
+ };
+ hueSliderStyle: {
+ left: number;
+ };
+ alphaSliderStyle: {
+ left: number;
+ };
+ innerValue: string;
+ showPrimaryColorPreview: boolean;
+ previewColor: string;
+ formatList: any[];
+ innerSwatchList: any;
+ isMultiple: boolean;
+ defaultOverlayProps: {};
+ };
+ lifetimes: {
+ ready(): void;
+ detached(): void;
+ };
+ methods: {
+ init(): void;
+ getEleReact(): void;
+ clickSwatch(e: any): void;
+ setCoreStyle(): void;
+ emitColorChange(trigger: any): void;
+ defaultEmptyColor(): string;
+ updateColor(): void;
+ getSaturationAndValueByCoordinate(coordinate: Coordinate): {
+ saturation: number;
+ value: number;
+ };
+ getSaturationThumbStyle({ saturation, value }: {
+ saturation: any;
+ value: any;
+ }): {
+ color: any;
+ left: string;
+ top: string;
+ };
+ getSliderThumbStyle({ value, maxValue }: {
+ value: any;
+ maxValue: any;
+ }): {
+ left: string;
+ color: any;
+ };
+ onChangeSaturation({ saturation, value }: {
+ saturation: any;
+ value: any;
+ }): void;
+ formatValue(): any;
+ onChangeSlider({ value, isAlpha }: {
+ value: any;
+ isAlpha: any;
+ }): void;
+ handleSaturationDrag(e: any): void;
+ handleSliderDrag(e: any, isAlpha?: boolean): void;
+ handleDiffDrag(e: any): void;
+ onTouchStart(e: any): void;
+ onTouchMove(e: any): void;
+ onTouchEnd(e: any): void;
+ close(trigger: string): void;
+ onVisibleChange(): void;
+ };
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/color-picker.js b/miniprogram_npm/tdesign-miniprogram/color-picker/color-picker.js
new file mode 100644
index 0000000..83565b8
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/color-picker.js
@@ -0,0 +1,331 @@
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+import { SuperComponent, wxComponent } from '../common/src/index';
+import config from '../common/config';
+import props from './props';
+import { SATURATION_PANEL_DEFAULT_HEIGHT, SATURATION_PANEL_DEFAULT_WIDTH, SLIDER_DEFAULT_WIDTH, DEFAULT_COLOR, ALPHA_MAX, HUE_MAX, DEFAULT_SYSTEM_SWATCH_COLORS, } from './constants';
+import { getRect } from '../common/utils';
+import { Color, getColorObject } from './utils';
+const { prefix } = config;
+const name = `${prefix}-color-picker`;
+const getCoordinate = (e, react, isPopup) => {
+ var _a;
+ const { pageX, pageY, clientY } = e.changedTouches[0] || {};
+ const offsetY = isPopup ? react.top : (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.offsetTop;
+ return {
+ x: Math.min(Math.max(0, pageX - react.left), react.width),
+ y: Math.min(Math.max(0, (isPopup ? clientY : pageY) - offsetY), react.height),
+ };
+};
+const getFormatList = (format, color) => {
+ const FORMAT_MAP = {
+ HSV: Object.values(color.getHsva()),
+ HSVA: Object.values(color.getHsva()),
+ HSL: Object.values(color.getHsla()),
+ HSLA: Object.values(color.getHsla()),
+ HSB: Object.values(color.getHsla()),
+ RGB: Object.values(color.getRgba()),
+ RGBA: Object.values(color.getRgba()),
+ CMYK: [...Object.values(color.getCmyk()), 0],
+ CSS: [color.css, 0],
+ HEX: [color.hex, 0],
+ };
+ const cur = FORMAT_MAP[format];
+ if (cur) {
+ return [...cur.slice(0, cur.length - 1), `${color.alpha * 100}%`];
+ }
+ return FORMAT_MAP.RGB;
+};
+const genSwatchList = (prop) => {
+ if (prop === undefined) {
+ return DEFAULT_SYSTEM_SWATCH_COLORS;
+ }
+ if (!prop || !prop.length) {
+ return [];
+ }
+ return prop;
+};
+let ColorPicker = class ColorPicker extends SuperComponent {
+ constructor() {
+ super(...arguments);
+ this.properties = props;
+ this.observers = {
+ format() {
+ this.setCoreStyle();
+ },
+ swatchColors(value) {
+ this.setData({
+ innerSwatchList: genSwatchList(value),
+ });
+ },
+ type(value) {
+ this.setData({
+ isMultiple: value === 'multiple',
+ });
+ },
+ 'usePopup, visible'(usePopup, visible) {
+ if (this.timer) {
+ clearTimeout(this.timer);
+ }
+ if (usePopup && visible) {
+ this.timer = setTimeout(() => {
+ this.getEleReact();
+ }, 350);
+ }
+ },
+ };
+ this.color = new Color(props.defaultValue.value || props.value.value || DEFAULT_COLOR);
+ this.data = {
+ prefix,
+ classPrefix: name,
+ panelRect: {
+ width: SATURATION_PANEL_DEFAULT_WIDTH,
+ height: SATURATION_PANEL_DEFAULT_HEIGHT,
+ },
+ sliderRect: {
+ width: SLIDER_DEFAULT_WIDTH,
+ left: 0,
+ },
+ saturationInfo: {
+ saturation: 0,
+ value: 0,
+ },
+ saturationThumbStyle: {
+ left: 0,
+ top: 0,
+ },
+ sliderInfo: {
+ value: 0,
+ },
+ hueSliderStyle: {
+ left: 0,
+ },
+ alphaSliderStyle: {
+ left: 0,
+ },
+ innerValue: props.defaultValue.value || props.value.value,
+ showPrimaryColorPreview: false,
+ previewColor: props.defaultValue.value || props.value.value,
+ formatList: getFormatList(props.format.value, this.color),
+ innerSwatchList: genSwatchList(props.swatchColors.value),
+ isMultiple: props.type.value === 'multiple',
+ defaultOverlayProps: {},
+ };
+ this.lifetimes = {
+ ready() {
+ this.init();
+ },
+ detached() {
+ clearTimeout(this.timer);
+ },
+ };
+ this.methods = {
+ init() {
+ const { value, defaultValue } = this.properties;
+ const innerValue = value || defaultValue;
+ if (innerValue) {
+ this.setData({
+ innerValue,
+ });
+ }
+ this.color = new Color(innerValue || DEFAULT_COLOR);
+ this.updateColor();
+ this.getEleReact();
+ },
+ getEleReact() {
+ Promise.all([getRect(this, `.${name}__saturation`), getRect(this, `.${name}__slider`)]).then(([saturationRect, sliderRect]) => {
+ this.setData({
+ panelRect: {
+ width: saturationRect.width || SATURATION_PANEL_DEFAULT_WIDTH,
+ height: saturationRect.height || SATURATION_PANEL_DEFAULT_HEIGHT,
+ left: saturationRect.left || 0,
+ top: saturationRect.top || 0,
+ },
+ sliderRect: {
+ left: sliderRect.left || 0,
+ width: sliderRect.width || SLIDER_DEFAULT_WIDTH,
+ },
+ }, () => {
+ this.setCoreStyle();
+ });
+ });
+ },
+ clickSwatch(e) {
+ const swatch = e.currentTarget.dataset.value;
+ this.color.update(swatch);
+ this.emitColorChange('preset');
+ this.setCoreStyle();
+ },
+ setCoreStyle() {
+ this.setData({
+ sliderInfo: {
+ value: this.color.hue,
+ },
+ hueSliderStyle: this.getSliderThumbStyle({ value: this.color.hue, maxValue: HUE_MAX }),
+ alphaSliderStyle: this.getSliderThumbStyle({ value: this.color.alpha * 100, maxValue: ALPHA_MAX }),
+ saturationInfo: {
+ saturation: this.color.saturation,
+ value: this.color.value,
+ },
+ saturationThumbStyle: this.getSaturationThumbStyle({
+ saturation: this.color.saturation,
+ value: this.color.value,
+ }),
+ previewColor: this.color.rgba,
+ formatList: getFormatList(this.properties.format, this.color),
+ });
+ },
+ emitColorChange(trigger) {
+ this.setData({
+ innerValue: this.formatValue(),
+ });
+ this.triggerEvent('change', {
+ value: this.formatValue(),
+ context: {
+ trigger,
+ color: getColorObject(this.color),
+ },
+ });
+ },
+ defaultEmptyColor() {
+ return DEFAULT_COLOR;
+ },
+ updateColor() {
+ const result = this.data.innerValue || this.defaultEmptyColor();
+ this.color.update(result);
+ },
+ getSaturationAndValueByCoordinate(coordinate) {
+ const { width, height } = this.data.panelRect;
+ const { x, y } = coordinate;
+ let saturation = x / width;
+ let value = 1 - y / height;
+ saturation = Math.min(1, Math.max(0, saturation));
+ value = Math.min(1, Math.max(0, value));
+ return {
+ saturation,
+ value,
+ };
+ },
+ getSaturationThumbStyle({ saturation, value }) {
+ const { width, height } = this.data.panelRect;
+ const top = Math.round((1 - value) * height);
+ const left = Math.round(saturation * width);
+ return {
+ color: this.color.rgb,
+ left: `${left}px`,
+ top: `${top}px`,
+ };
+ },
+ getSliderThumbStyle({ value, maxValue }) {
+ const { width } = this.data.sliderRect;
+ if (!width) {
+ return;
+ }
+ const left = Math.round((value / maxValue) * 100);
+ return {
+ left: `${left}%`,
+ color: this.color.rgb,
+ };
+ },
+ onChangeSaturation({ saturation, value }) {
+ const { saturation: sat, value: val } = this.color;
+ let changeTrigger = 'palette-saturation-brightness';
+ if (value !== val && saturation !== sat) {
+ this.color.saturation = saturation;
+ this.color.value = value;
+ changeTrigger = 'palette-saturation-brightness';
+ }
+ else if (saturation !== sat) {
+ this.color.saturation = saturation;
+ changeTrigger = 'palette-saturation';
+ }
+ else if (value !== val) {
+ this.color.value = value;
+ changeTrigger = 'palette-brightness';
+ }
+ else {
+ return;
+ }
+ this.triggerEvent('palette-bar-change', {
+ color: getColorObject(this.color),
+ });
+ this.emitColorChange(changeTrigger);
+ this.setCoreStyle();
+ },
+ formatValue() {
+ return this.color.getFormatsColorMap()[this.properties.format] || this.color.css;
+ },
+ onChangeSlider({ value, isAlpha }) {
+ if (isAlpha) {
+ this.color.alpha = value / 100;
+ }
+ else {
+ this.color.hue = value;
+ }
+ this.emitColorChange(isAlpha ? 'palette-alpha-bar' : 'palette-hue-bar');
+ this.setCoreStyle();
+ },
+ handleSaturationDrag(e) {
+ const coordinate = getCoordinate(e, this.data.panelRect, this.properties.usePopup);
+ const { saturation, value } = this.getSaturationAndValueByCoordinate(coordinate);
+ this.onChangeSaturation({ saturation, value });
+ },
+ handleSliderDrag(e, isAlpha = false) {
+ const { width } = this.data.sliderRect;
+ const coordinate = getCoordinate(e, this.data.sliderRect);
+ const { x } = coordinate;
+ const maxValue = isAlpha ? ALPHA_MAX : HUE_MAX;
+ let value = Math.round((x / width) * maxValue * 100) / 100;
+ if (value < 0)
+ value = 0;
+ if (value > maxValue)
+ value = maxValue;
+ this.onChangeSlider({ value, isAlpha });
+ },
+ handleDiffDrag(e) {
+ const dragType = e.target.dataset.type || e.currentTarget.dataset.type;
+ switch (dragType) {
+ case 'saturation':
+ this.handleSaturationDrag(e);
+ break;
+ case 'hue-slider':
+ this.handleSliderDrag(e);
+ break;
+ case 'alpha-slider':
+ this.handleSliderDrag(e, true);
+ break;
+ default:
+ break;
+ }
+ },
+ onTouchStart(e) {
+ this.handleDiffDrag(e);
+ },
+ onTouchMove(e) {
+ this.handleDiffDrag(e);
+ },
+ onTouchEnd(e) {
+ wx.nextTick(() => {
+ this.handleDiffDrag(e);
+ });
+ },
+ close(trigger) {
+ if (this.properties.autoClose) {
+ this.setData({ visible: false });
+ }
+ this.triggerEvent('close', { trigger });
+ },
+ onVisibleChange() {
+ this.close('overlay');
+ },
+ };
+ }
+};
+ColorPicker = __decorate([
+ wxComponent()
+], ColorPicker);
+export default ColorPicker;
diff --git a/pages/tag/closable/index.json b/miniprogram_npm/tdesign-miniprogram/color-picker/color-picker.json
similarity index 54%
rename from pages/tag/closable/index.json
rename to miniprogram_npm/tdesign-miniprogram/color-picker/color-picker.json
index 32d56d9..b93d975 100644
--- a/pages/tag/closable/index.json
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/color-picker.json
@@ -1,6 +1,6 @@
{
"component": true,
"usingComponents": {
- "t-tag": "tdesign-miniprogram/tag/tag"
+ "t-popup": "../popup/popup"
}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/color-picker.wxml b/miniprogram_npm/tdesign-miniprogram/color-picker/color-picker.wxml
new file mode 100644
index 0000000..64fec9f
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/color-picker.wxml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/color-picker.wxss b/miniprogram_npm/tdesign-miniprogram/color-picker/color-picker.wxss
new file mode 100644
index 0000000..9dae389
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/color-picker.wxss
@@ -0,0 +1,299 @@
+.t-float-left {
+ float: left;
+}
+.t-float-right {
+ float: right;
+}
+@keyframes tdesign-fade-out {
+ from {
+ opacity: 1;
+ }
+ to {
+ opacity: 0;
+ }
+}
+.hotspot-expanded.relative {
+ position: relative;
+}
+.hotspot-expanded::after {
+ content: '';
+ display: block;
+ position: absolute;
+ left: 0;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ transform: scale(1.5);
+}
+.t-color-picker__panel {
+ padding: 0;
+ width: var(--td-color-picker-panel-width, 750rpx);
+ background: var(--td-color-picker-background, #fff);
+ border-top-left-radius: var(--td-color-picker-panel-radius, 24rpx);
+ border-top-right-radius: var(--td-color-picker-panel-radius, 24rpx);
+ user-select: none;
+}
+.t-color-picker__body {
+ padding: var(--td-color-picker-panel-padding, 32rpx);
+ padding-bottom: 56rpx;
+}
+.t-color-picker__thumb {
+ position: absolute;
+ z-index: 1;
+ outline: none;
+ width: var(--td-color-picker-slider-thumb-size, 48rpx);
+ height: var(--td-color-picker-slider-thumb-size, 48rpx);
+ border-radius: var(--td-color-picker-border-radius-circle, 50%);
+ box-shadow: var(--td-shadow-1, 0 1px 10px rgba(0, 0, 0, 0.05), 0 4px 5px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.12));
+ color: var(--td-text-color-brand, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
+ box-sizing: border-box;
+}
+.t-color-picker__thumb::before,
+.t-color-picker__thumb::after {
+ content: '';
+ position: absolute;
+ border-radius: var(--td-color-picker-border-radius-circle, 50%);
+ box-sizing: border-box;
+ display: block;
+ border: 1px solid #dcdcdc;
+}
+.t-color-picker__thumb::before {
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ background-color: #fff;
+}
+.t-color-picker__thumb::after {
+ left: 3px;
+ top: 3px;
+ width: calc(100% - 6px);
+ height: calc(100% - 6px);
+ padding: var(--td-color-picker-slider-thumb-padding, 6rpx);
+ background: currentcolor;
+}
+.t-color-picker__saturation {
+ height: var(--td-color-picker-saturation-height, 288rpx);
+ border-radius: var(--td-color-picker-saturation-radius, 12rpx);
+ position: relative;
+ overflow: hidden;
+ background: transparent;
+}
+.t-color-picker__saturation::before,
+.t-color-picker__saturation::after {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+}
+.t-color-picker__saturation::before {
+ /* stylelint-disable-next-line color-no-hex */
+ background: linear-gradient(90deg, #fff, transparent);
+}
+.t-color-picker__saturation::after {
+ /* stylelint-disable-next-line color-no-hex */
+ background: linear-gradient(0deg, #000, transparent);
+}
+.t-color-picker__saturation .t-color-picker__thumb {
+ width: var(--td-color-picker-saturation-thumb-size, 48rpx);
+ height: var(--td-color-picker-saturation-thumb-size, 48rpx);
+ border-radius: var(--td-color-picker-border-radius-circle, 50%);
+ transform: translate(-50%, -50%);
+}
+.t-color-picker__slider-wrapper {
+ border-radius: calc(var(--td-color-picker-slider-height, 16rpx) / 2);
+ padding: var(--td-color-picker-slider-wrapper-padding, 0 18rpx);
+ position: relative;
+}
+.t-color-picker__slider-wrapper--hue-type {
+ /* stylelint-disable-next-line color-named */
+ background: linear-gradient(90deg, red, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, red);
+ margin: 16rpx 0;
+}
+.t-color-picker__slider-wrapper--alpha-type {
+ background: var(--td-text-color-anti, var(--td-font-white-1, #ffffff));
+ margin: 40rpx 0 16rpx 0;
+ /* stylelint-disable-next-line color-no-hex */
+ background-image: linear-gradient(45deg, #c5c5c5 25%, transparent 0, transparent 75%, #c5c5c5 0, #c5c5c5), linear-gradient(45deg, #c5c5c5 25%, transparent 0, transparent 75%, #c5c5c5 0, #c5c5c5);
+ background-size: 6px 6px;
+ background-position: 0 0, 3px 3px;
+}
+.t-color-picker__slider-wrapper--alpha-type .t-color-picker__rail {
+ background: linear-gradient(to right, transparent, currentcolor);
+}
+.t-color-picker__slider-padding {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: var(--td-color-picker-slider-height, 16rpx);
+ border-radius: calc(var(--td-color-picker-slider-height, 16rpx) / 2);
+}
+.t-color-picker__slider {
+ height: var(--td-color-picker-slider-height, 16rpx);
+ position: relative;
+ border-radius: calc(var(--td-color-picker-slider-height, 16rpx) / 2);
+ color: transparent;
+ outline: none;
+ z-index: 1;
+}
+.t-color-picker__slider .t-color-picker__thumb {
+ transform: translate(var(--td-color-picker-slider-thumb-transform-x, -18rpx), -50%);
+ top: 50%;
+}
+.t-color-picker__slider .t-color-picker__rail {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+ border-radius: inherit;
+}
+.t-color-picker__sliders-wrapper {
+ display: flex;
+ align-items: center;
+ margin: 32rpx 0 40rpx;
+}
+.t-color-picker__sliders {
+ width: 100%;
+}
+.t-color-picker__sliders-preview {
+ flex-shrink: 0;
+ margin-left: var(--td-color-picker-margin, 24rpx);
+ width: var(--td-color-picker-gradient-preview-width, 56rpx);
+ height: var(--td-color-picker-gradient-preview-height, 56rpx);
+ border-radius: var(--td-color-picker-gradient-preview-radius, 6rpx);
+ overflow: hidden;
+ background: var(--td-text-color-anti, var(--td-font-white-1, #ffffff));
+ /* stylelint-disable-next-line color-no-hex */
+ background-image: linear-gradient(45deg, #c5c5c5 25%, transparent 0, transparent 75%, #c5c5c5 0, #c5c5c5), linear-gradient(45deg, #c5c5c5 25%, transparent 0, transparent 75%, #c5c5c5 0, #c5c5c5);
+ background-size: 6px 6px;
+ background-position: 0 0, 3px 3px;
+}
+.t-color-picker__sliders-preview-inner {
+ display: block;
+ width: 100%;
+ height: 100%;
+}
+.t-color-picker__format {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ color: rgba(0, 0, 0, 0.4);
+ font-size: 28rpx;
+ text-align: center;
+ line-height: 56rpx;
+ height: 56rpx;
+ margin: 40rpx 0 56rpx 0;
+}
+.t-color-picker__format-item {
+ background: var(--td-color-picker-format-background-color, var(--td-gray-color-1, #f3f3f3));
+}
+.t-color-picker__format-item--first {
+ flex-shrink: 0;
+ width: 136rpx;
+ border: 1px solid #dcdcdc;
+ border-radius: 12rpx;
+ margin-right: 24rpx;
+}
+.t-color-picker__format-item--second {
+ flex: 1;
+}
+.t-color-picker__format-inputs {
+ display: flex;
+ align-items: center;
+ justify-content: space-around;
+}
+.t-color-picker__format-input {
+ flex: 1;
+ width: 0;
+ margin-left: -1px;
+ border: 1px solid #dcdcdc;
+ border-radius: 12rpx;
+}
+.t-color-picker__format-input:not(:first-child):not(:last-child) {
+ border-radius: 0;
+}
+.t-color-picker__format-input:first-child:not(:last-child) {
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+}
+.t-color-picker__format-input:last-child:not(:first-child) {
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+}
+.t-color-picker__format-input--fixed {
+ flex-shrink: 0;
+ flex-grow: 0;
+ flex-basis: 133rpx;
+}
+.t-color-picker__swatches-wrap {
+ position: relative;
+}
+.t-color-picker__swatches + .t-color-picker__swatches {
+ margin-top: var(--td-color-picker-margin, 24rpx);
+}
+.t-color-picker__swatches-title {
+ font: var(--td-color-picker-swatches-title-font, 32rpx);
+ padding: 0;
+ color: rgba(0, 0, 0, 0.9);
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ height: 48rpx;
+ line-height: 48rpx;
+}
+.t-color-picker__swatches-items {
+ margin-top: 24rpx;
+ width: 100%;
+ list-style: none;
+ display: flex;
+ overflow-x: auto;
+ overflow-y: auto;
+}
+.t-color-picker__swatches-items::-webkit-scrollbar {
+ display: none;
+ width: 0;
+ height: 0;
+ color: transparent;
+}
+.t-color-picker__swatches-item {
+ width: var(--td-color-picker-swatch-width, 48rpx);
+ height: var(--td-color-picker-swatch-height, 48rpx);
+ border-radius: 6rpx;
+ padding: var(--td-color-picker-swatch-padding, 0);
+ overflow: hidden;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ position: relative;
+ transform-origin: center;
+ transition: all var(--td-anim-duration-base, 0.2s) var(--td-anim-time-fn-easing, cubic-bezier(0.38, 0, 0.24, 1));
+ box-sizing: border-box;
+ flex-shrink: 0;
+ margin-right: 24rpx;
+ border-radius: var(--td-color-picker-swatch-border-radius, 6rpx);
+}
+.t-color-picker__swatches-item::after {
+ content: '';
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ left: 0;
+ top: 0;
+ opacity: 0;
+ background: rgba(0, 0, 0, 0.2);
+}
+.t-color-picker__swatches-item:active::after {
+ opacity: 1;
+}
+.t-color-picker__swatches-inner {
+ width: 100%;
+ height: 100%;
+ display: block;
+ border-radius: var(--td-color-picker-swatch-border-radius, 6rpx);
+ position: relative;
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/constants.d.ts b/miniprogram_npm/tdesign-miniprogram/color-picker/constants.d.ts
new file mode 100644
index 0000000..95998fb
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/constants.d.ts
@@ -0,0 +1,7 @@
+export declare const DEFAULT_COLOR = "#001F97";
+export declare const DEFAULT_SYSTEM_SWATCH_COLORS: string[];
+export declare const SATURATION_PANEL_DEFAULT_WIDTH = 343;
+export declare const SATURATION_PANEL_DEFAULT_HEIGHT = 144;
+export declare const SLIDER_DEFAULT_WIDTH = 303;
+export declare const HUE_MAX = 360;
+export declare const ALPHA_MAX = 100;
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/constants.js b/miniprogram_npm/tdesign-miniprogram/color-picker/constants.js
new file mode 100644
index 0000000..ec77e63
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/constants.js
@@ -0,0 +1,18 @@
+export const DEFAULT_COLOR = '#001F97';
+export const DEFAULT_SYSTEM_SWATCH_COLORS = [
+ '#F2F3FF',
+ '#D9E1FF',
+ '#B5C7FF',
+ '#8EABFF',
+ '#618DFF',
+ '#366EF4',
+ '#0052D9',
+ '#003CAB',
+ '#002A7C',
+ '#001A57',
+];
+export const SATURATION_PANEL_DEFAULT_WIDTH = 343;
+export const SATURATION_PANEL_DEFAULT_HEIGHT = 144;
+export const SLIDER_DEFAULT_WIDTH = 303;
+export const HUE_MAX = 360;
+export const ALPHA_MAX = 100;
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/interfaces.d.ts b/miniprogram_npm/tdesign-miniprogram/color-picker/interfaces.d.ts
new file mode 100644
index 0000000..df8e678
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/interfaces.d.ts
@@ -0,0 +1,5 @@
+export interface Coordinate {
+ x: number;
+ y: number;
+}
+export declare type ColorPickerChangeTrigger = 'palette-saturation-brightness' | 'palette-saturation' | 'palette-brightness' | 'palette-hue-bar' | 'palette-alpha-bar' | 'preset';
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/interfaces.js b/miniprogram_npm/tdesign-miniprogram/color-picker/interfaces.js
new file mode 100644
index 0000000..cb0ff5c
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/interfaces.js
@@ -0,0 +1 @@
+export {};
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/props.d.ts b/miniprogram_npm/tdesign-miniprogram/color-picker/props.d.ts
new file mode 100644
index 0000000..177f6e1
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/props.d.ts
@@ -0,0 +1,3 @@
+import { TdColorPickerProps } from './type';
+declare const props: TdColorPickerProps;
+export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/props.js b/miniprogram_npm/tdesign-miniprogram/color-picker/props.js
new file mode 100644
index 0000000..a6129ab
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/props.js
@@ -0,0 +1,42 @@
+const props = {
+ autoClose: {
+ type: Boolean,
+ value: true,
+ },
+ enableAlpha: {
+ type: Boolean,
+ value: false,
+ },
+ format: {
+ type: String,
+ value: 'RGB',
+ },
+ popupProps: {
+ type: Object,
+ value: {},
+ },
+ swatchColors: {
+ type: Array,
+ },
+ type: {
+ type: String,
+ value: 'base',
+ },
+ usePopup: {
+ type: Boolean,
+ value: false,
+ },
+ value: {
+ type: String,
+ value: null,
+ },
+ defaultValue: {
+ type: String,
+ value: '',
+ },
+ visible: {
+ type: Boolean,
+ value: false,
+ },
+};
+export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/template.wxml b/miniprogram_npm/tdesign-miniprogram/color-picker/template.wxml
new file mode 100644
index 0000000..fd92e0d
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/template.wxml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{format}}
+
+
+ {{item}}
+
+
+
+
+
+
+ 系统预设色彩
+
+
+
+
+
+
+
+
+
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/type.d.ts b/miniprogram_npm/tdesign-miniprogram/color-picker/type.d.ts
new file mode 100644
index 0000000..c60be51
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/type.d.ts
@@ -0,0 +1,44 @@
+import { PopupProps } from '../popup/index';
+export interface TdColorPickerProps {
+ autoClose?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+ enableAlpha?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+ format?: {
+ type: StringConstructor;
+ value?: 'RGB' | 'RGBA' | 'HSL' | 'HSLA' | 'HSB' | 'HSV' | 'HSVA' | 'HEX' | 'CMYK' | 'CSS';
+ };
+ popupProps?: {
+ type: ObjectConstructor;
+ value?: PopupProps;
+ };
+ swatchColors?: {
+ type: ArrayConstructor;
+ value?: Array | null;
+ };
+ type?: {
+ type: StringConstructor;
+ value?: TypeEnum;
+ };
+ usePopup?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+ value?: {
+ type: StringConstructor;
+ value?: string;
+ };
+ defaultValue?: {
+ type: StringConstructor;
+ value?: string;
+ };
+ visible?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+}
+export declare type TypeEnum = 'base' | 'multiple';
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/type.js b/miniprogram_npm/tdesign-miniprogram/color-picker/type.js
new file mode 100644
index 0000000..cb0ff5c
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/type.js
@@ -0,0 +1 @@
+export {};
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/utils.d.ts b/miniprogram_npm/tdesign-miniprogram/color-picker/utils.d.ts
new file mode 100644
index 0000000..c985ed7
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/utils.d.ts
@@ -0,0 +1 @@
+export * from '../common/shared/color-picker/index';
diff --git a/miniprogram_npm/tdesign-miniprogram/color-picker/utils.js b/miniprogram_npm/tdesign-miniprogram/color-picker/utils.js
new file mode 100644
index 0000000..c985ed7
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/color-picker/utils.js
@@ -0,0 +1 @@
+export * from '../common/shared/color-picker/index';
diff --git a/miniprogram_npm/tdesign-miniprogram/common/bus.d.ts b/miniprogram_npm/tdesign-miniprogram/common/bus.d.ts
index 0ed92bb..fddbb54 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/bus.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/common/bus.d.ts
@@ -1,5 +1,6 @@
export default class Bus {
listeners: Map;
+ emitted: Set;
constructor();
on(evtName: string, listener: any): void;
emit(evtName: string): void;
diff --git a/miniprogram_npm/tdesign-miniprogram/common/bus.js b/miniprogram_npm/tdesign-miniprogram/common/bus.js
index 5626d27..5a6c889 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/bus.js
+++ b/miniprogram_npm/tdesign-miniprogram/common/bus.js
@@ -1,8 +1,13 @@
export default class Bus {
constructor() {
this.listeners = new Map();
+ this.emitted = new Set();
}
on(evtName, listener) {
+ if (this.emitted.has(evtName)) {
+ listener();
+ return;
+ }
const target = this.listeners.get(evtName) || [];
target.push(listener);
this.listeners.set(evtName, target);
@@ -12,5 +17,6 @@ export default class Bus {
if (listeners) {
listeners.forEach((func) => func());
}
+ this.emitted.add(evtName);
}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/common/common.d.ts b/miniprogram_npm/tdesign-miniprogram/common/common.d.ts
index 44a4e72..12f8f81 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/common.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/common/common.d.ts
@@ -2,18 +2,26 @@ export declare type Classes = Array;
export interface Styles {
[css: string]: string | number;
}
+export declare type ImageEvent = any;
+export declare type PlainObject = {
+ [key: string]: any;
+};
export declare type OptionData = {
label?: string;
value?: string | number;
-} & {
- [key: string]: any;
-};
-export declare type TreeOptionData = {
- children?: Array;
-} & OptionData;
+} & PlainObject;
+export declare type TreeOptionData = {
+ children?: Array> | boolean;
+ label?: string;
+ text?: string;
+ value?: T;
+ content?: string;
+} & PlainObject;
export declare type SizeEnum = 'small' | 'medium' | 'large';
+export declare type ShapeEnum = 'circle' | 'round';
export declare type HorizontalAlignEnum = 'left' | 'center' | 'right';
export declare type VerticalAlignEnum = 'top' | 'middle' | 'bottom';
+export declare type LayoutEnum = 'vertical' | 'horizontal';
export declare type ClassName = {
[className: string]: any;
} | ClassName[] | string;
@@ -21,15 +29,28 @@ export declare type CSSSelector = string;
export interface KeysType {
value?: string;
label?: string;
+ disabled?: string;
+}
+export interface TreeKeysType extends KeysType {
+ children?: string;
}
export interface HTMLElementAttributes {
- [css: string]: string;
+ [attribute: string]: string;
}
-export interface InfinityScroll {
+export interface TScroll {
bufferSize?: number;
isFixedRowHeight?: boolean;
rowHeight?: number;
threshold?: number;
type: 'lazy' | 'virtual';
}
-export declare type TScroll = InfinityScroll;
+export declare type InfinityScroll = TScroll;
+export interface ScrollToElementParams {
+ index?: number;
+ top?: number;
+ time?: number;
+ behavior?: 'auto' | 'smooth';
+}
+export interface ComponentScrollToElementParams extends ScrollToElementParams {
+ key?: string | number;
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/common/shared/calendar/index.d.ts b/miniprogram_npm/tdesign-miniprogram/common/shared/calendar/index.d.ts
index 2a119d1..d9336de 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/shared/calendar/index.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/common/shared/calendar/index.d.ts
@@ -6,9 +6,9 @@ export default class TCalendar {
minDate: Date;
maxDate: Date;
format: (day: TDate) => TDate;
- constructor(options: any);
+ constructor(options?: {});
getTrimValue(): Date | Date[];
- getDays(): any[];
+ getDays(weekdays: string[]): any[];
getMonths(): any[];
select({ cellType, year, month, date }: {
cellType: any;
diff --git a/miniprogram_npm/tdesign-miniprogram/common/shared/calendar/index.js b/miniprogram_npm/tdesign-miniprogram/common/shared/calendar/index.js
index 9de8d65..62fda1f 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/shared/calendar/index.js
+++ b/miniprogram_npm/tdesign-miniprogram/common/shared/calendar/index.js
@@ -1,6 +1,6 @@
import { getDateRect, isSameDate, getMonthDateRect, isValidDate, getDate } from '../date';
export default class TCalendar {
- constructor(options) {
+ constructor(options = {}) {
this.type = 'single';
Object.assign(this, options);
if (!this.minDate)
@@ -27,12 +27,11 @@ export default class TCalendar {
return [];
}
}
- getDays() {
- const raw = '日一二三四五六';
+ getDays(weekdays) {
const ans = [];
let i = this.firstDayOfWeek % 7;
while (ans.length < 7) {
- ans.push(raw[i]);
+ ans.push(weekdays[i]);
i = (i + 1) % 7;
}
return ans;
diff --git a/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/cmyk.d.ts b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/cmyk.d.ts
new file mode 100644
index 0000000..d0e92a8
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/cmyk.d.ts
@@ -0,0 +1,7 @@
+export declare const rgb2cmyk: (red: number, green: number, blue: number) => number[];
+export declare const cmyk2rgb: (cyan: number, magenta: number, yellow: number, black: number) => {
+ r: number;
+ g: number;
+ b: number;
+};
+export declare const cmykInputToColor: (input: string) => string;
diff --git a/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/cmyk.js b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/cmyk.js
new file mode 100644
index 0000000..d6273be
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/cmyk.js
@@ -0,0 +1,57 @@
+export const rgb2cmyk = (red, green, blue) => {
+ let computedC = 0;
+ let computedM = 0;
+ let computedY = 0;
+ let computedK = 0;
+ const r = parseInt(`${red}`.replace(/\s/g, ''), 10);
+ const g = parseInt(`${green}`.replace(/\s/g, ''), 10);
+ const b = parseInt(`${blue}`.replace(/\s/g, ''), 10);
+ if (r === 0 && g === 0 && b === 0) {
+ computedK = 1;
+ return [0, 0, 0, 1];
+ }
+ computedC = 1 - r / 255;
+ computedM = 1 - g / 255;
+ computedY = 1 - b / 255;
+ const minCMY = Math.min(computedC, Math.min(computedM, computedY));
+ computedC = (computedC - minCMY) / (1 - minCMY);
+ computedM = (computedM - minCMY) / (1 - minCMY);
+ computedY = (computedY - minCMY) / (1 - minCMY);
+ computedK = minCMY;
+ return [computedC, computedM, computedY, computedK];
+};
+export const cmyk2rgb = (cyan, magenta, yellow, black) => {
+ let c = cyan / 100;
+ let m = magenta / 100;
+ let y = yellow / 100;
+ const k = black / 100;
+ c = c * (1 - k) + k;
+ m = m * (1 - k) + k;
+ y = y * (1 - k) + k;
+ let r = 1 - c;
+ let g = 1 - m;
+ let b = 1 - y;
+ r = Math.round(255 * r);
+ g = Math.round(255 * g);
+ b = Math.round(255 * b);
+ return {
+ r,
+ g,
+ b,
+ };
+};
+const REG_CMYK_STRING = /cmyk\((\d+%?),(\d+%?),(\d+%?),(\d+%?)\)/;
+const toNumber = (str) => Math.max(0, Math.min(255, parseInt(str, 10)));
+export const cmykInputToColor = (input) => {
+ if (/cmyk/i.test(input)) {
+ const str = input.replace(/\s/g, '');
+ const match = str.match(REG_CMYK_STRING);
+ const c = toNumber(match[1]);
+ const m = toNumber(match[2]);
+ const y = toNumber(match[3]);
+ const k = toNumber(match[4]);
+ const { r, g, b } = cmyk2rgb(c, m, y, k);
+ return `rgb(${r}, ${g}, ${b})`;
+ }
+ return input;
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/color.d.ts b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/color.d.ts
new file mode 100644
index 0000000..49b30fa
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/color.d.ts
@@ -0,0 +1,107 @@
+import tinyColor from 'tinycolor2';
+import { GradientColors, GradientColorPoint } from './gradient';
+export interface ColorObject {
+ alpha: number;
+ css: string;
+ hex: string;
+ hex8: string;
+ hsl: string;
+ hsla: string;
+ hsv: string;
+ hsva: string;
+ rgb: string;
+ rgba: string;
+ saturation: number;
+ value: number;
+ isGradient: boolean;
+ linearGradient?: string;
+}
+interface ColorStates {
+ s: number;
+ v: number;
+ h: number;
+ a: number;
+}
+interface GradientStates {
+ colors: GradientColorPoint[];
+ degree: number;
+ selectedId: string;
+ css?: string;
+}
+export declare const gradientColors2string: (object: GradientColors) => string;
+export declare const getColorWithoutAlpha: (color: string) => string;
+export declare const genId: () => string;
+export declare const genGradientPoint: (left: number, color: string) => GradientColorPoint;
+export declare class Color {
+ states: ColorStates;
+ originColor: string;
+ isGradient: boolean;
+ gradientStates: GradientStates;
+ constructor(input: string);
+ update(input: string): void;
+ get saturation(): number;
+ set saturation(value: number);
+ get value(): number;
+ set value(value: number);
+ get hue(): number;
+ set hue(value: number);
+ get alpha(): number;
+ set alpha(value: number);
+ get rgb(): string;
+ get rgba(): string;
+ get hsv(): string;
+ get hsva(): string;
+ get hsl(): string;
+ get hsla(): string;
+ get hex(): string;
+ get hex8(): string;
+ get cmyk(): string;
+ get css(): string;
+ get linearGradient(): string;
+ get gradientColors(): GradientColorPoint[];
+ set gradientColors(colors: GradientColorPoint[]);
+ get gradientSelectedId(): string;
+ set gradientSelectedId(id: string);
+ get gradientDegree(): number;
+ set gradientDegree(degree: number);
+ get gradientSelectedPoint(): GradientColorPoint;
+ getFormatsColorMap(): {
+ HEX: string;
+ CMYK: string;
+ RGB: string;
+ RGBA: string;
+ HSL: string;
+ HSLA: string;
+ HSV: string;
+ HSVA: string;
+ CSS: string;
+ HEX8: string;
+ };
+ updateCurrentGradientColor(): false | this;
+ updateStates(input: string): void;
+ getRgba(): {
+ r: number;
+ g: number;
+ b: number;
+ a: number;
+ };
+ getCmyk(): {
+ c: number;
+ m: number;
+ y: number;
+ k: number;
+ };
+ getHsva(): tinyColor.ColorFormats.HSVA;
+ getHsla(): tinyColor.ColorFormats.HSLA;
+ equals(color: string): boolean;
+ static isValid(color: string): boolean;
+ static hsva2color(h: number, s: number, v: number, a: number): string;
+ static hsla2color(h: number, s: number, l: number, a: number): string;
+ static rgba2color(r: number, g: number, b: number, a: number): string;
+ static hex2color(hex: string, a: number): string;
+ static object2color(object: any, format: string): string;
+ static isGradientColor: (input: string) => boolean;
+ static compare: (color1: string, color2: string) => boolean;
+}
+export declare const getColorObject: (color: Color) => ColorObject;
+export default Color;
diff --git a/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/color.js b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/color.js
new file mode 100644
index 0000000..847ec5b
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/color.js
@@ -0,0 +1,334 @@
+import tinyColor from 'tinycolor2';
+import { cmykInputToColor, rgb2cmyk } from './cmyk';
+import { parseGradientString, isGradientColor } from './gradient';
+const mathRound = Math.round;
+const hsv2rgba = (states) => tinyColor(states).toRgb();
+const hsv2hsva = (states) => tinyColor(states).toHsv();
+const hsv2hsla = (states) => tinyColor(states).toHsl();
+export const gradientColors2string = (object) => {
+ const { points, degree } = object;
+ const colorsStop = points
+ .sort((pA, pB) => pA.left - pB.left)
+ .map((p) => `${p.color} ${Math.round(p.left * 100) / 100}%`);
+ return `linear-gradient(${degree}deg,${colorsStop.join(',')})`;
+};
+export const getColorWithoutAlpha = (color) => tinyColor(color).setAlpha(1).toHexString();
+export const genId = () => (1 + Math.random() * 4294967295).toString(16);
+export const genGradientPoint = (left, color) => ({
+ id: genId(),
+ left,
+ color,
+});
+export class Color {
+ constructor(input) {
+ this.states = {
+ s: 100,
+ v: 100,
+ h: 100,
+ a: 1,
+ };
+ this.gradientStates = {
+ colors: [],
+ degree: 0,
+ selectedId: null,
+ css: '',
+ };
+ this.update(input);
+ }
+ update(input) {
+ var _a, _b;
+ const gradientColors = parseGradientString(input);
+ if (this.isGradient && !gradientColors) {
+ const colorHsv = tinyColor(input).toHsv();
+ this.states = colorHsv;
+ this.updateCurrentGradientColor();
+ return;
+ }
+ this.originColor = input;
+ this.isGradient = false;
+ let colorInput = input;
+ if (gradientColors) {
+ this.isGradient = true;
+ const object = gradientColors;
+ const points = object.points.map((c) => genGradientPoint(c.left, c.color));
+ this.gradientStates = {
+ colors: points,
+ degree: object.degree,
+ selectedId: ((_a = points[0]) === null || _a === void 0 ? void 0 : _a.id) || null,
+ };
+ this.gradientStates.css = this.linearGradient;
+ colorInput = (_b = this.gradientSelectedPoint) === null || _b === void 0 ? void 0 : _b.color;
+ }
+ this.updateStates(colorInput);
+ }
+ get saturation() {
+ return this.states.s;
+ }
+ set saturation(value) {
+ this.states.s = Math.max(0, Math.min(100, value));
+ this.updateCurrentGradientColor();
+ }
+ get value() {
+ return this.states.v;
+ }
+ set value(value) {
+ this.states.v = Math.max(0, Math.min(100, value));
+ this.updateCurrentGradientColor();
+ }
+ get hue() {
+ return this.states.h;
+ }
+ set hue(value) {
+ this.states.h = Math.max(0, Math.min(360, value));
+ this.updateCurrentGradientColor();
+ }
+ get alpha() {
+ return this.states.a;
+ }
+ set alpha(value) {
+ this.states.a = Math.max(0, Math.min(1, Math.round(value * 100) / 100));
+ this.updateCurrentGradientColor();
+ }
+ get rgb() {
+ const { r, g, b } = hsv2rgba(this.states);
+ return `rgb(${mathRound(r)}, ${mathRound(g)}, ${mathRound(b)})`;
+ }
+ get rgba() {
+ const { r, g, b, a } = hsv2rgba(this.states);
+ return `rgba(${mathRound(r)}, ${mathRound(g)}, ${mathRound(b)}, ${a})`;
+ }
+ get hsv() {
+ const { h, s, v } = this.getHsva();
+ return `hsv(${h}, ${s}%, ${v}%)`;
+ }
+ get hsva() {
+ const { h, s, v, a } = this.getHsva();
+ return `hsva(${h}, ${s}%, ${v}%, ${a})`;
+ }
+ get hsl() {
+ const { h, s, l } = this.getHsla();
+ return `hsl(${h}, ${s}%, ${l}%)`;
+ }
+ get hsla() {
+ const { h, s, l, a } = this.getHsla();
+ return `hsla(${h}, ${s}%, ${l}%, ${a})`;
+ }
+ get hex() {
+ return tinyColor(this.states).toHexString();
+ }
+ get hex8() {
+ return tinyColor(this.states).toHex8String();
+ }
+ get cmyk() {
+ const { c, m, y, k } = this.getCmyk();
+ return `cmyk(${c}, ${m}, ${y}, ${k})`;
+ }
+ get css() {
+ if (this.isGradient) {
+ return this.linearGradient;
+ }
+ return this.rgba;
+ }
+ get linearGradient() {
+ const { gradientColors, gradientDegree } = this;
+ return gradientColors2string({
+ points: gradientColors,
+ degree: gradientDegree,
+ });
+ }
+ get gradientColors() {
+ return this.gradientStates.colors;
+ }
+ set gradientColors(colors) {
+ this.gradientStates.colors = colors;
+ this.gradientStates.css = this.linearGradient;
+ }
+ get gradientSelectedId() {
+ return this.gradientStates.selectedId;
+ }
+ set gradientSelectedId(id) {
+ var _a;
+ if (id === this.gradientSelectedId) {
+ return;
+ }
+ this.gradientStates.selectedId = id;
+ this.updateStates((_a = this.gradientSelectedPoint) === null || _a === void 0 ? void 0 : _a.color);
+ }
+ get gradientDegree() {
+ return this.gradientStates.degree;
+ }
+ set gradientDegree(degree) {
+ this.gradientStates.degree = Math.max(0, Math.min(360, degree));
+ this.gradientStates.css = this.linearGradient;
+ }
+ get gradientSelectedPoint() {
+ const { gradientColors, gradientSelectedId } = this;
+ return gradientColors.find((color) => color.id === gradientSelectedId);
+ }
+ getFormatsColorMap() {
+ return {
+ HEX: this.hex,
+ CMYK: this.cmyk,
+ RGB: this.rgb,
+ RGBA: this.rgba,
+ HSL: this.hsl,
+ HSLA: this.hsla,
+ HSV: this.hsv,
+ HSVA: this.hsva,
+ CSS: this.css,
+ HEX8: this.hex8,
+ };
+ }
+ updateCurrentGradientColor() {
+ const { isGradient, gradientColors, gradientSelectedId } = this;
+ const { length } = gradientColors;
+ const current = this.gradientSelectedPoint;
+ if (!isGradient || length === 0 || !current) {
+ return false;
+ }
+ const index = gradientColors.findIndex((color) => color.id === gradientSelectedId);
+ const newColor = Object.assign(Object.assign({}, current), { color: this.rgba });
+ gradientColors.splice(index, 1, newColor);
+ this.gradientColors = gradientColors.slice();
+ return this;
+ }
+ updateStates(input) {
+ const color = tinyColor(cmykInputToColor(input));
+ const hsva = color.toHsv();
+ this.states = hsva;
+ }
+ getRgba() {
+ const { r, g, b, a } = hsv2rgba(this.states);
+ return {
+ r: mathRound(r),
+ g: mathRound(g),
+ b: mathRound(b),
+ a,
+ };
+ }
+ getCmyk() {
+ const { r, g, b } = this.getRgba();
+ const [c, m, y, k] = rgb2cmyk(r, g, b);
+ return {
+ c: mathRound(c * 100),
+ m: mathRound(m * 100),
+ y: mathRound(y * 100),
+ k: mathRound(k * 100),
+ };
+ }
+ getHsva() {
+ let { h, s, v, a } = hsv2hsva(this.states);
+ h = mathRound(h);
+ s = mathRound(s * 100);
+ v = mathRound(v * 100);
+ a *= 1;
+ return {
+ h,
+ s,
+ v,
+ a,
+ };
+ }
+ getHsla() {
+ let { h, s, l, a } = hsv2hsla(this.states);
+ h = mathRound(h);
+ s = mathRound(s * 100);
+ l = mathRound(l * 100);
+ a *= 1;
+ return {
+ h,
+ s,
+ l,
+ a,
+ };
+ }
+ equals(color) {
+ return tinyColor.equals(this.rgba, color);
+ }
+ static isValid(color) {
+ if (parseGradientString(color)) {
+ return true;
+ }
+ return tinyColor(color).isValid();
+ }
+ static hsva2color(h, s, v, a) {
+ return tinyColor({
+ h,
+ s,
+ v,
+ a,
+ }).toHsvString();
+ }
+ static hsla2color(h, s, l, a) {
+ return tinyColor({
+ h,
+ s,
+ l,
+ a,
+ }).toHslString();
+ }
+ static rgba2color(r, g, b, a) {
+ return tinyColor({
+ r,
+ g,
+ b,
+ a,
+ }).toHsvString();
+ }
+ static hex2color(hex, a) {
+ const color = tinyColor(hex);
+ color.setAlpha(a);
+ return color.toHexString();
+ }
+ static object2color(object, format) {
+ if (format === 'CMYK') {
+ const { c, m, y, k } = object;
+ return `cmyk(${c}, ${m}, ${y}, ${k})`;
+ }
+ const color = tinyColor(object, {
+ format,
+ });
+ return color.toRgbString();
+ }
+}
+Color.isGradientColor = (input) => !!isGradientColor(input);
+Color.compare = (color1, color2) => {
+ const isGradientColor1 = Color.isGradientColor(color1);
+ const isGradientColor2 = Color.isGradientColor(color2);
+ if (isGradientColor1 && isGradientColor2) {
+ const gradientColor1 = gradientColors2string(parseGradientString(color1));
+ const gradientColor2 = gradientColors2string(parseGradientString(color2));
+ return gradientColor1 === gradientColor2;
+ }
+ if (!isGradientColor1 && !isGradientColor2) {
+ return tinyColor.equals(color1, color2);
+ }
+ return false;
+};
+const COLOR_OBJECT_OUTPUT_KEYS = [
+ 'alpha',
+ 'css',
+ 'hex',
+ 'hex8',
+ 'hsl',
+ 'hsla',
+ 'hsv',
+ 'hsva',
+ 'rgb',
+ 'rgba',
+ 'saturation',
+ 'value',
+ 'isGradient',
+];
+export const getColorObject = (color) => {
+ if (!color) {
+ return null;
+ }
+ const colorObject = Object.create(null);
+ COLOR_OBJECT_OUTPUT_KEYS.forEach((key) => (colorObject[key] = color[key]));
+ if (color.isGradient) {
+ colorObject.linearGradient = color.linearGradient;
+ }
+ return colorObject;
+};
+export default Color;
diff --git a/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/gradient.d.ts b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/gradient.d.ts
new file mode 100644
index 0000000..3f496b0
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/gradient.d.ts
@@ -0,0 +1,12 @@
+export interface GradientColorPoint {
+ id?: string;
+ color?: string;
+ left?: number;
+}
+export interface GradientColors {
+ points: GradientColorPoint[];
+ degree: number;
+}
+export declare const isGradientColor: (input: string) => null | RegExpExecArray;
+export declare const parseGradientString: (input: string) => GradientColors | boolean;
+export default parseGradientString;
diff --git a/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/gradient.js b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/gradient.js
new file mode 100644
index 0000000..18eacb2
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/gradient.js
@@ -0,0 +1,119 @@
+import isString from 'lodash/isString';
+import isNull from 'lodash/isNull';
+import tinyColor from 'tinycolor2';
+const combineRegExp = (regexpList, flags) => {
+ let source = '';
+ for (let i = 0; i < regexpList.length; i++) {
+ if (isString(regexpList[i])) {
+ source += regexpList[i];
+ }
+ else {
+ source += regexpList[i].source;
+ }
+ }
+ return new RegExp(source, flags);
+};
+const generateRegExp = () => {
+ const searchFlags = 'gi';
+ const rAngle = /(?:[+-]?\d*\.?\d+)(?:deg|grad|rad|turn)/;
+ const rSideCornerCapture = /to\s+((?:(?:left|right|top|bottom)(?:\s+(?:top|bottom|left|right))?))/;
+ const rComma = /\s*,\s*/;
+ const rColorHex = /#(?:[a-f0-9]{6}|[a-f0-9]{3})/;
+ const rDigits3 = /\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)/;
+ const rDigits4 = /\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*,\s*\d*\.?\d+\)/;
+ const rValue = /(?:[+-]?\d*\.?\d+)(?:%|[a-z]+)?/;
+ const rKeyword = /[_a-z-][_a-z0-9-]*/;
+ const rColor = combineRegExp(['(?:', rColorHex, '|', '(?:rgb|hsl)', rDigits3, '|', '(?:rgba|hsla)', rDigits4, '|', rKeyword, ')'], '');
+ const rColorStop = combineRegExp([rColor, '(?:\\s+', rValue, '(?:\\s+', rValue, ')?)?'], '');
+ const rColorStopList = combineRegExp(['(?:', rColorStop, rComma, ')*', rColorStop], '');
+ const rLineCapture = combineRegExp(['(?:(', rAngle, ')|', rSideCornerCapture, ')'], '');
+ const rGradientSearch = combineRegExp(['(?:(', rLineCapture, ')', rComma, ')?(', rColorStopList, ')'], searchFlags);
+ const rColorStopSearch = combineRegExp(['\\s*(', rColor, ')', '(?:\\s+', '(', rValue, '))?', '(?:', rComma, '\\s*)?'], searchFlags);
+ return {
+ gradientSearch: rGradientSearch,
+ colorStopSearch: rColorStopSearch,
+ };
+};
+const parseGradient = (regExpLib, input) => {
+ let result;
+ let matchColorStop;
+ let stopResult;
+ regExpLib.gradientSearch.lastIndex = 0;
+ const matchGradient = regExpLib.gradientSearch.exec(input);
+ if (!isNull(matchGradient)) {
+ result = {
+ original: matchGradient[0],
+ colorStopList: [],
+ };
+ if (matchGradient[1]) {
+ result.line = matchGradient[1];
+ }
+ if (matchGradient[2]) {
+ result.angle = matchGradient[2];
+ }
+ if (matchGradient[3]) {
+ result.sideCorner = matchGradient[3];
+ }
+ regExpLib.colorStopSearch.lastIndex = 0;
+ matchColorStop = regExpLib.colorStopSearch.exec(matchGradient[4]);
+ while (!isNull(matchColorStop)) {
+ stopResult = {
+ color: matchColorStop[1],
+ };
+ if (matchColorStop[2]) {
+ stopResult.position = matchColorStop[2];
+ }
+ result.colorStopList.push(stopResult);
+ matchColorStop = regExpLib.colorStopSearch.exec(matchGradient[4]);
+ }
+ }
+ return result;
+};
+const REGEXP_LIB = generateRegExp();
+const REG_GRADIENT = /.*gradient\s*\(((?:\([^)]*\)|[^)(]*)*)\)/gim;
+export const isGradientColor = (input) => {
+ REG_GRADIENT.lastIndex = 0;
+ return REG_GRADIENT.exec(input);
+};
+const sideCornerDegreeMap = {
+ top: 0,
+ right: 90,
+ bottom: 180,
+ left: 270,
+ 'top left': 225,
+ 'left top': 225,
+ 'top right': 135,
+ 'right top': 135,
+ 'bottom left': 315,
+ 'left bottom': 315,
+ 'bottom right': 45,
+ 'right bottom': 45,
+};
+export const parseGradientString = (input) => {
+ const match = isGradientColor(input);
+ if (!match) {
+ return false;
+ }
+ const gradientColors = {
+ points: [],
+ degree: 0,
+ };
+ const result = parseGradient(REGEXP_LIB, match[1]);
+ if (result.original.trim() !== match[1].trim()) {
+ return false;
+ }
+ const points = result.colorStopList.map(({ color, position }) => {
+ const point = Object.create(null);
+ point.color = tinyColor(color).toRgbString();
+ point.left = parseFloat(position);
+ return point;
+ });
+ gradientColors.points = points;
+ let degree = parseInt(result.angle, 10);
+ if (Number.isNaN(degree)) {
+ degree = sideCornerDegreeMap[result.sideCorner] || 90;
+ }
+ gradientColors.degree = degree;
+ return gradientColors;
+};
+export default parseGradientString;
diff --git a/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/index.d.ts b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/index.d.ts
new file mode 100644
index 0000000..ad18475
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/index.d.ts
@@ -0,0 +1,3 @@
+export * from './cmyk';
+export * from './color';
+export * from './gradient';
diff --git a/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/index.js b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/index.js
new file mode 100644
index 0000000..ad18475
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/shared/color-picker/index.js
@@ -0,0 +1,3 @@
+export * from './cmyk';
+export * from './color';
+export * from './gradient';
diff --git a/miniprogram_npm/tdesign-miniprogram/common/src/instantiationDecorator.js b/miniprogram_npm/tdesign-miniprogram/common/src/instantiationDecorator.js
index 0e5c3d3..d9b15b7 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/src/instantiationDecorator.js
+++ b/miniprogram_npm/tdesign-miniprogram/common/src/instantiationDecorator.js
@@ -17,7 +17,7 @@ const ComponentNativeProps = [
'definitionFilter',
];
export const toComponent = function toComponent(options) {
- const { relations, behaviors = [], properties, externalClasses = [] } = options;
+ const { relations, behaviors = [], externalClasses = [] } = options;
if (options.properties) {
Object.keys(options.properties).forEach((k) => {
let opt = options.properties[k];
@@ -130,9 +130,6 @@ export const wxComponent = function wxComponent() {
}
const current = new WxComponent();
current.options = current.options || {};
- if (current.options.addGlobalClass === undefined) {
- current.options.addGlobalClass = true;
- }
if (canUseVirtualHost()) {
current.options.virtualHost = true;
}
diff --git a/pages/action-sheet/list/index.wxss b/miniprogram_npm/tdesign-miniprogram/common/style/icons.wxss
similarity index 100%
rename from pages/action-sheet/list/index.wxss
rename to miniprogram_npm/tdesign-miniprogram/common/style/icons.wxss
diff --git a/miniprogram_npm/tdesign-miniprogram/common/style/theme/_components.wxss b/miniprogram_npm/tdesign-miniprogram/common/style/theme/_components.wxss
new file mode 100644
index 0000000..b77525c
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/style/theme/_components.wxss
@@ -0,0 +1,10 @@
+@media (prefers-color-scheme: dark) {
+ page,
+ .page {
+ --td-button-primary-disabled-color: var(--td-font-white-4);
+ --td-skeleton-animation-gradient: rgba(255, 255, 255, 0.06);
+ --td-slider-dot-bg-color: var(--td-gray-color-4);
+ --td-slider-dot-disabled-bg-color: var(--td-gray-color-11);
+ --td-slider-dot-disabled-border-color: var(--td-gray-color-12);
+ }
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/common/style/theme/_dark.wxss b/miniprogram_npm/tdesign-miniprogram/common/style/theme/_dark.wxss
new file mode 100644
index 0000000..5dca755
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/style/theme/_dark.wxss
@@ -0,0 +1,123 @@
+@media (prefers-color-scheme: dark) {
+ page,
+ .page {
+ --td-primary-color-1: #1b2f51;
+ --td-primary-color-2: #173463;
+ --td-primary-color-3: #143975;
+ --td-primary-color-4: #103d88;
+ --td-primary-color-5: #0d429a;
+ --td-primary-color-6: #054bbe;
+ --td-primary-color-7: #2667d4;
+ --td-primary-color-8: #4582e6;
+ --td-primary-color-9: #699ef5;
+ --td-primary-color-10: #96bbf8;
+ --td-warning-color-1: #4f2a1d;
+ --td-warning-color-2: #582f21;
+ --td-warning-color-3: #733c23;
+ --td-warning-color-4: #a75d2b;
+ --td-warning-color-5: #cf6e2d;
+ --td-warning-color-6: #dc7633;
+ --td-warning-color-7: #e8935c;
+ --td-warning-color-8: #ecbf91;
+ --td-warning-color-9: #eed7bf;
+ --td-warning-color-10: #f3e9dc;
+ --td-error-color-1: #472324;
+ --td-error-color-2: #5e2a2d;
+ --td-error-color-3: #703439;
+ --td-error-color-4: #83383e;
+ --td-error-color-5: #a03f46;
+ --td-error-color-6: #c64751;
+ --td-error-color-7: #de6670;
+ --td-error-color-8: #ec888e;
+ --td-error-color-9: #edb1b6;
+ --td-error-color-10: #eeced0;
+ --td-success-color-1: #193a2a;
+ --td-success-color-2: #1a4230;
+ --td-success-color-3: #17533d;
+ --td-success-color-4: #0d7a55;
+ --td-success-color-5: #059465;
+ --td-success-color-6: #43af8a;
+ --td-success-color-7: #46bf96;
+ --td-success-color-8: #80d2b6;
+ --td-success-color-9: #b4e1d3;
+ --td-success-color-10: #deede8;
+ --td-gray-color-1: #f3f3f3;
+ --td-gray-color-2: #eee;
+ --td-gray-color-3: #e8e8e8;
+ --td-gray-color-4: #ddd;
+ --td-gray-color-5: #c6c6c6;
+ --td-gray-color-6: #a6a6a6;
+ --td-gray-color-7: #8b8b8b;
+ --td-gray-color-8: #777;
+ --td-gray-color-9: #5e5e5e;
+ --td-gray-color-10: #4b4b4b;
+ --td-gray-color-11: #383838;
+ --td-gray-color-12: #2c2c2c;
+ --td-gray-color-13: #242424;
+ --td-gray-color-14: #181818;
+ --td-font-white-1: rgba(255, 255, 255, 0.9);
+ --td-font-white-2: rgba(255, 255, 255, 0.55);
+ --td-font-white-3: rgba(255, 255, 255, 0.35);
+ --td-font-white-4: rgba(255, 255, 255, 0.22);
+ --td-font-gray-1: rgba(0, 0, 0, 0.9);
+ --td-font-gray-2: rgba(0, 0, 0, 0.6);
+ --td-font-gray-3: rgba(0, 0, 0, 0.4);
+ --td-font-gray-4: rgba(0, 0, 0, 0.26);
+ --td-brand-color: var(--td-primary-color-8);
+ --td-warning-color: var(--td-warning-color-5);
+ --td-error-color: var(--td-error-color-6);
+ --td-success-color: var(--td-success-color-5);
+ --td-brand-color-focus: var(--td-primary-color-1);
+ --td-brand-color-active: var(--td-primary-color-9);
+ --td-brand-color-disabled: var(--td-primary-color-3);
+ --td-brand-color-light: var(--td-primary-color-1);
+ --td-brand-color-light-active: var(--td-primary-color-2);
+ --td-warning-color-focus: var(--td-warning-color-2);
+ --td-warning-color-active: var(--td-warning-color-4);
+ --td-warning-color-disabled: var(--td-warning-color-3);
+ --td-warning-color-light: var(--td-warning-color-1);
+ --td-warning-color-light-active: var(--td-warning-color-2);
+ --td-error-color-focus: var(--td-error-color-2);
+ --td-error-color-active: var(--td-error-color-5);
+ --td-error-color-disabled: var(--td-error-color-3);
+ --td-error-color-light: var(--td-error-color-1);
+ --td-error-color-light-active: var(--td-error-color-2);
+ --td-success-color-focus: var(--td-success-color-2);
+ --td-success-color-active: var(--td-success-color-4);
+ --td-success-color-disabled: var(--td-success-color-3);
+ --td-success-color-light: var(--td-success-color-1);
+ --td-success-color-light-active: var(--td-success-color-2);
+ --td-mask-active: rgba(0, 0, 0, 0.4);
+ --td-mask-disabled: rgba(0, 0, 0, 0.6);
+ --td-bg-color-page: var(--td-gray-color-14);
+ --td-bg-color-container: var(--td-gray-color-13);
+ --td-bg-color-secondarycontainer: var(--td-gray-color-12);
+ --td-bg-color-component: var(--td-gray-color-11);
+ --td-bg-color-container-active: var(--td-gray-color-12);
+ --td-bg-color-secondarycontainer-active: var(--td-gray-color-11);
+ --td-bg-color-component-active: var(--td-gray-color-10);
+ --td-bg-color-component-disabled: var(--td-gray-color-12);
+ --td-bg-color-specialcomponent: transparent;
+ --td-text-color-primary: var(--td-font-white-1);
+ --td-text-color-secondary: var(--td-font-white-2);
+ --td-text-color-placeholder: var(--td-font-white-3);
+ --td-text-color-disabled: var(--td-font-white-4);
+ --td-text-color-anti: var(--td-font-white-1);
+ --td-text-color-brand: var(--td-primary-color-8);
+ --td-text-color-link: var(--td-primary-color-8);
+ --td-border-level-1-color: var(--td-gray-color-11);
+ --td-component-stroke: var(--td-gray-color-11);
+ --td-border-level-2-color: var(--td-gray-color-9);
+ --td-component-border: var(--td-gray-color-9);
+ --td-shadow-1: 0 4px 6px rgba(0, 0, 0, 0.06), 0 1px 10px rgba(0, 0, 0, 8%), 0 2px 4px rgba(0, 0, 0, 12%);
+ --td-shadow-2: 0 8px 10px rgba(0, 0, 0, 0.12), 0 3px 14px rgba(0, 0, 0, 10%), 0 5px 5px rgba(0, 0, 0, 16%);
+ --td-shadow-3: 0 16px 24px rgba(0, 0, 0, 0.14), 0 6px 30px rgba(0, 0, 0, 12%), 0 8px 10px rgba(0, 0, 0, 20%);
+ --td-shadow-inset-top: inset 0 0.5px 0 #5e5e5e;
+ --td-shadow-inset-right: inset 0.5px 0 0 #5e5e5e;
+ --td-shadow-inset-bottom: inset 0 -0.5px 0 #5e5e5e;
+ --td-shadow-inset-left: inset -0.5px 0 0 #5e5e5e;
+ --td-table-shadow-color: rgba(0, 0, 0, 0.55);
+ --td-scrollbar-color: rgba(255, 255, 255, 0.1);
+ --td-scroll-track-color: #333;
+ }
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/common/style/theme/_font.wxss b/miniprogram_npm/tdesign-miniprogram/common/style/theme/_font.wxss
new file mode 100644
index 0000000..f0cf5a1
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/style/theme/_font.wxss
@@ -0,0 +1,33 @@
+page,
+.page {
+ --td-font-family: PingFang SC, Microsoft YaHei, Arial Regular;
+ --td-font-family-medium: PingFang SC, Microsoft YaHei, Arial Medium;
+ --td-font-size-link-small: 24rpx;
+ --td-font-size-link-medium: 28rpx;
+ --td-font-size-link-large: 32rpx;
+ --td-font-size-mark-extra-small: 20rpx;
+ --td-font-size-mark-small: 24rpx;
+ --td-font-size-mark-medium: 28rpx;
+ --td-font-size-mark-large: 32rpx;
+ --td-font-size-body-extra-small: 20rpx;
+ --td-font-size-body-small: 24rpx;
+ --td-font-size-body-medium: 28rpx;
+ --td-font-size-body-large: 32rpx;
+ --td-font-size-title-small: 28rpx;
+ --td-font-size-title-medium: 32rpx;
+ --td-font-size-title-large: 36rpx;
+ --td-font-size-title-extra-large: 40rpx;
+ --td-font-size-headline-small: 48rpx;
+ --td-font-size-headline-medium: 56rpx;
+ --td-font-size-headline-large: 72rpx;
+ --td-font-size-display-medium: 96rpx;
+ --td-font-size-display-large: 128rpx;
+ --td-font-size: 20rpx;
+ --td-font-size-xs: var(--td-font-size-body-extra-small);
+ --td-font-size-s: var(--td-font-size-body-small);
+ --td-font-size-base: var(--td-font-size-title-small);
+ --td-font-size-m: var(--td-font-size-title-medium);
+ --td-font-size-l: var(--td-font-size-title-large);
+ --td-font-size-xl: var(--td-font-size-title-extra-large);
+ --td-font-size-xxl: var(--td-font-size-headline-large);
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/common/style/theme/_index.wxss b/miniprogram_npm/tdesign-miniprogram/common/style/theme/_index.wxss
index e69de29..c128adf 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/style/theme/_index.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/common/style/theme/_index.wxss
@@ -0,0 +1,313 @@
+@media (prefers-color-scheme: light) {
+ page,
+ .page {
+ --td-primary-color-1: #f2f3ff;
+ --td-primary-color-2: #d9e1ff;
+ --td-primary-color-3: #b5c7ff;
+ --td-primary-color-4: #8eabff;
+ --td-primary-color-5: #618dff;
+ --td-primary-color-6: #366ef4;
+ --td-primary-color-7: #0052d9;
+ --td-primary-color-8: #003cab;
+ --td-primary-color-9: #002a7c;
+ --td-primary-color-10: #001a57;
+ --td-warning-color-1: #fff1e9;
+ --td-warning-color-2: #ffd9c2;
+ --td-warning-color-3: #ffb98c;
+ --td-warning-color-4: #fa9550;
+ --td-warning-color-5: #e37318;
+ --td-warning-color-6: #be5a00;
+ --td-warning-color-7: #954500;
+ --td-warning-color-8: #713300;
+ --td-warning-color-9: #532300;
+ --td-warning-color-10: #3b1700;
+ --td-error-color-1: #fff0ed;
+ --td-error-color-2: #ffd8d2;
+ --td-error-color-3: #ffb9b0;
+ --td-error-color-4: #ff9285;
+ --td-error-color-5: #f6685d;
+ --td-error-color-6: #d54941;
+ --td-error-color-7: #ad352f;
+ --td-error-color-8: #881f1c;
+ --td-error-color-9: #68070a;
+ --td-error-color-10: #490002;
+ --td-success-color-1: #e3f9e9;
+ --td-success-color-2: #c6f3d7;
+ --td-success-color-3: #92dab2;
+ --td-success-color-4: #56c08d;
+ --td-success-color-5: #2ba471;
+ --td-success-color-6: #008858;
+ --td-success-color-7: #006c45;
+ --td-success-color-8: #005334;
+ --td-success-color-9: #003b23;
+ --td-success-color-10: #002515;
+ --td-gray-color-1: #f3f3f3;
+ --td-gray-color-2: #eeeeee;
+ --td-gray-color-3: #e7e7e7;
+ --td-gray-color-4: #dcdcdc;
+ --td-gray-color-5: #c5c5c5;
+ --td-gray-color-6: #a6a6a6;
+ --td-gray-color-7: #8b8b8b;
+ --td-gray-color-8: #777777;
+ --td-gray-color-9: #5e5e5e;
+ --td-gray-color-10: #4b4b4b;
+ --td-gray-color-11: #383838;
+ --td-gray-color-12: #2c2c2c;
+ --td-gray-color-13: #242424;
+ --td-gray-color-14: #181818;
+ --td-font-white-1: #ffffff;
+ --td-font-white-2: rgba(255, 255, 255, 0.55);
+ --td-font-white-3: rgba(255, 255, 255, 0.35);
+ --td-font-white-4: rgba(255, 255, 255, 0.22);
+ --td-font-gray-1: rgba(0, 0, 0, 0.9);
+ --td-font-gray-2: rgba(0, 0, 0, 0.6);
+ --td-font-gray-3: rgba(0, 0, 0, 0.4);
+ --td-font-gray-4: rgba(0, 0, 0, 0.26);
+ --td-brand-color: var(--td-primary-color-7);
+ --td-warning-color: var(--td-warning-color-5);
+ --td-error-color: var(--td-error-color-6);
+ --td-success-color: var(--td-success-color-5);
+ --td-brand-color-focus: var(--td-primary-color-1);
+ --td-brand-color-active: var(--td-primary-color-8);
+ --td-brand-color-disabled: var(--td-primary-color-3);
+ --td-brand-color-light: var(--td-primary-color-1);
+ --td-brand-color-light-active: var(--td-primary-color-2);
+ --td-warning-color-active: var(--td-warning-color-6);
+ --td-warning-color-disabled: var(--td-warning-color-3);
+ --td-warning-color-focus: var(--td-warning-color-2);
+ --td-warning-color-light: var(--td-warning-color-1);
+ --td-warning-color-light-active: var(--td-warning-color-2);
+ --td-error-color-focus: var(--td-error-color-2);
+ --td-error-color-active: var(--td-error-color-7);
+ --td-error-color-disabled: var(--td-error-color-3);
+ --td-error-color-light: var(--td-error-color-1);
+ --td-error-color-light-active: var(--td-error-color-2);
+ --td-success-color-focus: var(--td-success-color-2);
+ --td-success-color-active: var(--td-success-color-6);
+ --td-success-color-disabled: var(--td-success-color-3);
+ --td-success-color-light: var(--td-success-color-1);
+ --td-success-color-light-active: var(--td-success-color-2);
+ --td-mask-active: rgba(0, 0, 0, 0.6);
+ --td-mask-disabled: rgba(255, 255, 255, 0.6);
+ --td-bg-color-page: var(--td-gray-color-1);
+ --td-bg-color-container: var(--td-font-white-1);
+ --td-bg-color-container-active: var(--td-gray-color-3);
+ --td-bg-color-secondarycontainer: var(--td-gray-color-1);
+ --td-bg-color-secondarycontainer-active: var(--td-gray-color-4);
+ --td-bg-color-component: var(--td-gray-color-3);
+ --td-bg-color-component-active: var(--td-gray-color-6);
+ --td-bg-color-component-disabled: var(--td-gray-color-2);
+ --td-bg-color-secondarycomponent: var(--td-gray-color-4);
+ --td-bg-color-secondarycomponent-active: var(--td-gray-color-6);
+ --td-bg-color-specialcomponent: #fff;
+ --td-text-color-primary: var(--td-font-gray-1);
+ --td-text-color-secondary: var(--td-font-gray-2);
+ --td-text-color-placeholder: var(--td-font-gray-3);
+ --td-text-color-disabled: var(--td-font-gray-4);
+ --td-text-color-anti: var(--td-font-white-1);
+ --td-text-color-brand: var(--td-brand-color);
+ --td-text-color-link: var(--td-brand-color);
+ --td-border-level-1-color: var(--td-gray-color-3);
+ --td-component-stroke: var(--td-gray-color-3);
+ --td-border-level-2-color: var(--td-gray-color-4);
+ --td-component-border: var(--td-gray-color-4);
+ --td-shadow-1: 0 1px 10px rgba(0, 0, 0, 0.05), 0 4px 5px rgba(0, 0, 0, 8%), 0 2px 4px -1px rgba(0, 0, 0, 12%);
+ --td-shadow-2: 0 3px 14px 2px rgba(0, 0, 0, 0.05), 0 8px 10px 1px rgba(0, 0, 0, 6%), 0 5px 5px -3px rgba(0, 0, 0, 10%);
+ --td-shadow-3: 0 6px 30px 5px rgba(0, 0, 0, 0.05), 0 16px 24px 2px rgba(0, 0, 0, 4%),
+ 0 8px 10px -5px rgba(0, 0, 0, 8%);
+ --td-shadow-4: 0 2px 8px 0 rgba(0, 0, 0, 0.06);
+ --td-shadow-inset-top: inset 0 0.5px 0 #dcdcdc;
+ --td-shadow-inset-right: inset 0.5px 0 0 #dcdcdc;
+ --td-shadow-inset-bottom: inset 0 -0.5px 0 #dcdcdc;
+ --td-shadow-inset-left: inset -0.5px 0 0 #dcdcdc;
+ --td-table-shadow-color: rgba(0, 0, 0, 0.08);
+ --td-scrollbar-color: rgba(0, 0, 0, 0.1);
+ --td-scrollbar-hover-color: rgba(0, 0, 0, 0.3);
+ --td-scroll-track-color: #fff;
+ }
+}
+@media (prefers-color-scheme: dark) {
+ page,
+ .page {
+ --td-primary-color-1: #1b2f51;
+ --td-primary-color-2: #173463;
+ --td-primary-color-3: #143975;
+ --td-primary-color-4: #103d88;
+ --td-primary-color-5: #0d429a;
+ --td-primary-color-6: #054bbe;
+ --td-primary-color-7: #2667d4;
+ --td-primary-color-8: #4582e6;
+ --td-primary-color-9: #699ef5;
+ --td-primary-color-10: #96bbf8;
+ --td-warning-color-1: #4f2a1d;
+ --td-warning-color-2: #582f21;
+ --td-warning-color-3: #733c23;
+ --td-warning-color-4: #a75d2b;
+ --td-warning-color-5: #cf6e2d;
+ --td-warning-color-6: #dc7633;
+ --td-warning-color-7: #e8935c;
+ --td-warning-color-8: #ecbf91;
+ --td-warning-color-9: #eed7bf;
+ --td-warning-color-10: #f3e9dc;
+ --td-error-color-1: #472324;
+ --td-error-color-2: #5e2a2d;
+ --td-error-color-3: #703439;
+ --td-error-color-4: #83383e;
+ --td-error-color-5: #a03f46;
+ --td-error-color-6: #c64751;
+ --td-error-color-7: #de6670;
+ --td-error-color-8: #ec888e;
+ --td-error-color-9: #edb1b6;
+ --td-error-color-10: #eeced0;
+ --td-success-color-1: #193a2a;
+ --td-success-color-2: #1a4230;
+ --td-success-color-3: #17533d;
+ --td-success-color-4: #0d7a55;
+ --td-success-color-5: #059465;
+ --td-success-color-6: #43af8a;
+ --td-success-color-7: #46bf96;
+ --td-success-color-8: #80d2b6;
+ --td-success-color-9: #b4e1d3;
+ --td-success-color-10: #deede8;
+ --td-gray-color-1: #f3f3f3;
+ --td-gray-color-2: #eee;
+ --td-gray-color-3: #e8e8e8;
+ --td-gray-color-4: #ddd;
+ --td-gray-color-5: #c6c6c6;
+ --td-gray-color-6: #a6a6a6;
+ --td-gray-color-7: #8b8b8b;
+ --td-gray-color-8: #777;
+ --td-gray-color-9: #5e5e5e;
+ --td-gray-color-10: #4b4b4b;
+ --td-gray-color-11: #383838;
+ --td-gray-color-12: #2c2c2c;
+ --td-gray-color-13: #242424;
+ --td-gray-color-14: #181818;
+ --td-font-white-1: rgba(255, 255, 255, 0.9);
+ --td-font-white-2: rgba(255, 255, 255, 0.55);
+ --td-font-white-3: rgba(255, 255, 255, 0.35);
+ --td-font-white-4: rgba(255, 255, 255, 0.22);
+ --td-font-gray-1: rgba(0, 0, 0, 0.9);
+ --td-font-gray-2: rgba(0, 0, 0, 0.6);
+ --td-font-gray-3: rgba(0, 0, 0, 0.4);
+ --td-font-gray-4: rgba(0, 0, 0, 0.26);
+ --td-brand-color: var(--td-primary-color-8);
+ --td-warning-color: var(--td-warning-color-5);
+ --td-error-color: var(--td-error-color-6);
+ --td-success-color: var(--td-success-color-5);
+ --td-brand-color-focus: var(--td-primary-color-1);
+ --td-brand-color-active: var(--td-primary-color-9);
+ --td-brand-color-disabled: var(--td-primary-color-3);
+ --td-brand-color-light: var(--td-primary-color-1);
+ --td-brand-color-light-active: var(--td-primary-color-2);
+ --td-warning-color-focus: var(--td-warning-color-2);
+ --td-warning-color-active: var(--td-warning-color-4);
+ --td-warning-color-disabled: var(--td-warning-color-3);
+ --td-warning-color-light: var(--td-warning-color-1);
+ --td-warning-color-light-active: var(--td-warning-color-2);
+ --td-error-color-focus: var(--td-error-color-2);
+ --td-error-color-active: var(--td-error-color-5);
+ --td-error-color-disabled: var(--td-error-color-3);
+ --td-error-color-light: var(--td-error-color-1);
+ --td-error-color-light-active: var(--td-error-color-2);
+ --td-success-color-focus: var(--td-success-color-2);
+ --td-success-color-active: var(--td-success-color-4);
+ --td-success-color-disabled: var(--td-success-color-3);
+ --td-success-color-light: var(--td-success-color-1);
+ --td-success-color-light-active: var(--td-success-color-2);
+ --td-mask-active: rgba(0, 0, 0, 0.4);
+ --td-mask-disabled: rgba(0, 0, 0, 0.6);
+ --td-bg-color-page: var(--td-gray-color-14);
+ --td-bg-color-container: var(--td-gray-color-13);
+ --td-bg-color-secondarycontainer: var(--td-gray-color-12);
+ --td-bg-color-component: var(--td-gray-color-11);
+ --td-bg-color-container-active: var(--td-gray-color-12);
+ --td-bg-color-secondarycontainer-active: var(--td-gray-color-11);
+ --td-bg-color-component-active: var(--td-gray-color-10);
+ --td-bg-color-component-disabled: var(--td-gray-color-12);
+ --td-bg-color-specialcomponent: transparent;
+ --td-text-color-primary: var(--td-font-white-1);
+ --td-text-color-secondary: var(--td-font-white-2);
+ --td-text-color-placeholder: var(--td-font-white-3);
+ --td-text-color-disabled: var(--td-font-white-4);
+ --td-text-color-anti: var(--td-font-white-1);
+ --td-text-color-brand: var(--td-primary-color-8);
+ --td-text-color-link: var(--td-primary-color-8);
+ --td-border-level-1-color: var(--td-gray-color-11);
+ --td-component-stroke: var(--td-gray-color-11);
+ --td-border-level-2-color: var(--td-gray-color-9);
+ --td-component-border: var(--td-gray-color-9);
+ --td-shadow-1: 0 4px 6px rgba(0, 0, 0, 0.06), 0 1px 10px rgba(0, 0, 0, 8%), 0 2px 4px rgba(0, 0, 0, 12%);
+ --td-shadow-2: 0 8px 10px rgba(0, 0, 0, 0.12), 0 3px 14px rgba(0, 0, 0, 10%), 0 5px 5px rgba(0, 0, 0, 16%);
+ --td-shadow-3: 0 16px 24px rgba(0, 0, 0, 0.14), 0 6px 30px rgba(0, 0, 0, 12%), 0 8px 10px rgba(0, 0, 0, 20%);
+ --td-shadow-inset-top: inset 0 0.5px 0 #5e5e5e;
+ --td-shadow-inset-right: inset 0.5px 0 0 #5e5e5e;
+ --td-shadow-inset-bottom: inset 0 -0.5px 0 #5e5e5e;
+ --td-shadow-inset-left: inset -0.5px 0 0 #5e5e5e;
+ --td-table-shadow-color: rgba(0, 0, 0, 0.55);
+ --td-scrollbar-color: rgba(255, 255, 255, 0.1);
+ --td-scroll-track-color: #333;
+ }
+}
+page,
+.page {
+ --td-radius-small: 6rpx;
+ --td-radius-default: 12rpx;
+ --td-radius-large: 18rpx;
+ --td-radius-extra-large: 24rpx;
+ --td-radius-round: 999px;
+ --td-radius-circle: 50%;
+}
+page,
+.page {
+ --td-font-family: PingFang SC, Microsoft YaHei, Arial Regular;
+ --td-font-family-medium: PingFang SC, Microsoft YaHei, Arial Medium;
+ --td-font-size-link-small: 24rpx;
+ --td-font-size-link-medium: 28rpx;
+ --td-font-size-link-large: 32rpx;
+ --td-font-size-mark-extra-small: 20rpx;
+ --td-font-size-mark-small: 24rpx;
+ --td-font-size-mark-medium: 28rpx;
+ --td-font-size-mark-large: 32rpx;
+ --td-font-size-body-extra-small: 20rpx;
+ --td-font-size-body-small: 24rpx;
+ --td-font-size-body-medium: 28rpx;
+ --td-font-size-body-large: 32rpx;
+ --td-font-size-title-small: 28rpx;
+ --td-font-size-title-medium: 32rpx;
+ --td-font-size-title-large: 36rpx;
+ --td-font-size-title-extra-large: 40rpx;
+ --td-font-size-headline-small: 48rpx;
+ --td-font-size-headline-medium: 56rpx;
+ --td-font-size-headline-large: 72rpx;
+ --td-font-size-display-medium: 96rpx;
+ --td-font-size-display-large: 128rpx;
+ --td-font-size: 20rpx;
+ --td-font-size-xs: var(--td-font-size-body-extra-small);
+ --td-font-size-s: var(--td-font-size-body-small);
+ --td-font-size-base: var(--td-font-size-title-small);
+ --td-font-size-m: var(--td-font-size-title-medium);
+ --td-font-size-l: var(--td-font-size-title-large);
+ --td-font-size-xl: var(--td-font-size-title-extra-large);
+ --td-font-size-xxl: var(--td-font-size-headline-large);
+}
+page,
+.page {
+ --td-spacer: 16rpx;
+ --td-spacer-1: 24rpx;
+ --td-spacer-2: 32rpx;
+ --td-spacer-3: 48rpx;
+ --td-spacer-4: 64rpx;
+ --td-spacer-5: 96rpx;
+ --td-spacer-6: 160rpx;
+}
+@media (prefers-color-scheme: dark) {
+ page,
+ .page {
+ --td-button-primary-disabled-color: var(--td-font-white-4);
+ --td-skeleton-animation-gradient: rgba(255, 255, 255, 0.06);
+ --td-slider-dot-bg-color: var(--td-gray-color-4);
+ --td-slider-dot-disabled-bg-color: var(--td-gray-color-11);
+ --td-slider-dot-disabled-border-color: var(--td-gray-color-12);
+ }
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/common/style/theme/_light.wxss b/miniprogram_npm/tdesign-miniprogram/common/style/theme/_light.wxss
new file mode 100644
index 0000000..a63aa42
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/style/theme/_light.wxss
@@ -0,0 +1,128 @@
+@media (prefers-color-scheme: light) {
+ page,
+ .page {
+ --td-primary-color-1: #f2f3ff;
+ --td-primary-color-2: #d9e1ff;
+ --td-primary-color-3: #b5c7ff;
+ --td-primary-color-4: #8eabff;
+ --td-primary-color-5: #618dff;
+ --td-primary-color-6: #366ef4;
+ --td-primary-color-7: #0052d9;
+ --td-primary-color-8: #003cab;
+ --td-primary-color-9: #002a7c;
+ --td-primary-color-10: #001a57;
+ --td-warning-color-1: #fff1e9;
+ --td-warning-color-2: #ffd9c2;
+ --td-warning-color-3: #ffb98c;
+ --td-warning-color-4: #fa9550;
+ --td-warning-color-5: #e37318;
+ --td-warning-color-6: #be5a00;
+ --td-warning-color-7: #954500;
+ --td-warning-color-8: #713300;
+ --td-warning-color-9: #532300;
+ --td-warning-color-10: #3b1700;
+ --td-error-color-1: #fff0ed;
+ --td-error-color-2: #ffd8d2;
+ --td-error-color-3: #ffb9b0;
+ --td-error-color-4: #ff9285;
+ --td-error-color-5: #f6685d;
+ --td-error-color-6: #d54941;
+ --td-error-color-7: #ad352f;
+ --td-error-color-8: #881f1c;
+ --td-error-color-9: #68070a;
+ --td-error-color-10: #490002;
+ --td-success-color-1: #e3f9e9;
+ --td-success-color-2: #c6f3d7;
+ --td-success-color-3: #92dab2;
+ --td-success-color-4: #56c08d;
+ --td-success-color-5: #2ba471;
+ --td-success-color-6: #008858;
+ --td-success-color-7: #006c45;
+ --td-success-color-8: #005334;
+ --td-success-color-9: #003b23;
+ --td-success-color-10: #002515;
+ --td-gray-color-1: #f3f3f3;
+ --td-gray-color-2: #eeeeee;
+ --td-gray-color-3: #e7e7e7;
+ --td-gray-color-4: #dcdcdc;
+ --td-gray-color-5: #c5c5c5;
+ --td-gray-color-6: #a6a6a6;
+ --td-gray-color-7: #8b8b8b;
+ --td-gray-color-8: #777777;
+ --td-gray-color-9: #5e5e5e;
+ --td-gray-color-10: #4b4b4b;
+ --td-gray-color-11: #383838;
+ --td-gray-color-12: #2c2c2c;
+ --td-gray-color-13: #242424;
+ --td-gray-color-14: #181818;
+ --td-font-white-1: #ffffff;
+ --td-font-white-2: rgba(255, 255, 255, 0.55);
+ --td-font-white-3: rgba(255, 255, 255, 0.35);
+ --td-font-white-4: rgba(255, 255, 255, 0.22);
+ --td-font-gray-1: rgba(0, 0, 0, 0.9);
+ --td-font-gray-2: rgba(0, 0, 0, 0.6);
+ --td-font-gray-3: rgba(0, 0, 0, 0.4);
+ --td-font-gray-4: rgba(0, 0, 0, 0.26);
+ --td-brand-color: var(--td-primary-color-7);
+ --td-warning-color: var(--td-warning-color-5);
+ --td-error-color: var(--td-error-color-6);
+ --td-success-color: var(--td-success-color-5);
+ --td-brand-color-focus: var(--td-primary-color-1);
+ --td-brand-color-active: var(--td-primary-color-8);
+ --td-brand-color-disabled: var(--td-primary-color-3);
+ --td-brand-color-light: var(--td-primary-color-1);
+ --td-brand-color-light-active: var(--td-primary-color-2);
+ --td-warning-color-active: var(--td-warning-color-6);
+ --td-warning-color-disabled: var(--td-warning-color-3);
+ --td-warning-color-focus: var(--td-warning-color-2);
+ --td-warning-color-light: var(--td-warning-color-1);
+ --td-warning-color-light-active: var(--td-warning-color-2);
+ --td-error-color-focus: var(--td-error-color-2);
+ --td-error-color-active: var(--td-error-color-7);
+ --td-error-color-disabled: var(--td-error-color-3);
+ --td-error-color-light: var(--td-error-color-1);
+ --td-error-color-light-active: var(--td-error-color-2);
+ --td-success-color-focus: var(--td-success-color-2);
+ --td-success-color-active: var(--td-success-color-6);
+ --td-success-color-disabled: var(--td-success-color-3);
+ --td-success-color-light: var(--td-success-color-1);
+ --td-success-color-light-active: var(--td-success-color-2);
+ --td-mask-active: rgba(0, 0, 0, 0.6);
+ --td-mask-disabled: rgba(255, 255, 255, 0.6);
+ --td-bg-color-page: var(--td-gray-color-1);
+ --td-bg-color-container: var(--td-font-white-1);
+ --td-bg-color-container-active: var(--td-gray-color-3);
+ --td-bg-color-secondarycontainer: var(--td-gray-color-1);
+ --td-bg-color-secondarycontainer-active: var(--td-gray-color-4);
+ --td-bg-color-component: var(--td-gray-color-3);
+ --td-bg-color-component-active: var(--td-gray-color-6);
+ --td-bg-color-component-disabled: var(--td-gray-color-2);
+ --td-bg-color-secondarycomponent: var(--td-gray-color-4);
+ --td-bg-color-secondarycomponent-active: var(--td-gray-color-6);
+ --td-bg-color-specialcomponent: #fff;
+ --td-text-color-primary: var(--td-font-gray-1);
+ --td-text-color-secondary: var(--td-font-gray-2);
+ --td-text-color-placeholder: var(--td-font-gray-3);
+ --td-text-color-disabled: var(--td-font-gray-4);
+ --td-text-color-anti: var(--td-font-white-1);
+ --td-text-color-brand: var(--td-brand-color);
+ --td-text-color-link: var(--td-brand-color);
+ --td-border-level-1-color: var(--td-gray-color-3);
+ --td-component-stroke: var(--td-gray-color-3);
+ --td-border-level-2-color: var(--td-gray-color-4);
+ --td-component-border: var(--td-gray-color-4);
+ --td-shadow-1: 0 1px 10px rgba(0, 0, 0, 0.05), 0 4px 5px rgba(0, 0, 0, 8%), 0 2px 4px -1px rgba(0, 0, 0, 12%);
+ --td-shadow-2: 0 3px 14px 2px rgba(0, 0, 0, 0.05), 0 8px 10px 1px rgba(0, 0, 0, 6%), 0 5px 5px -3px rgba(0, 0, 0, 10%);
+ --td-shadow-3: 0 6px 30px 5px rgba(0, 0, 0, 0.05), 0 16px 24px 2px rgba(0, 0, 0, 4%),
+ 0 8px 10px -5px rgba(0, 0, 0, 8%);
+ --td-shadow-4: 0 2px 8px 0 rgba(0, 0, 0, 0.06);
+ --td-shadow-inset-top: inset 0 0.5px 0 #dcdcdc;
+ --td-shadow-inset-right: inset 0.5px 0 0 #dcdcdc;
+ --td-shadow-inset-bottom: inset 0 -0.5px 0 #dcdcdc;
+ --td-shadow-inset-left: inset -0.5px 0 0 #dcdcdc;
+ --td-table-shadow-color: rgba(0, 0, 0, 0.08);
+ --td-scrollbar-color: rgba(0, 0, 0, 0.1);
+ --td-scrollbar-hover-color: rgba(0, 0, 0, 0.3);
+ --td-scroll-track-color: #fff;
+ }
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/common/style/theme/_radius.wxss b/miniprogram_npm/tdesign-miniprogram/common/style/theme/_radius.wxss
new file mode 100644
index 0000000..d559d99
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/style/theme/_radius.wxss
@@ -0,0 +1,9 @@
+page,
+.page {
+ --td-radius-small: 6rpx;
+ --td-radius-default: 12rpx;
+ --td-radius-large: 18rpx;
+ --td-radius-extra-large: 24rpx;
+ --td-radius-round: 999px;
+ --td-radius-circle: 50%;
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/common/style/theme/_spacer.wxss b/miniprogram_npm/tdesign-miniprogram/common/style/theme/_spacer.wxss
new file mode 100644
index 0000000..bda90f9
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/style/theme/_spacer.wxss
@@ -0,0 +1,10 @@
+page,
+.page {
+ --td-spacer: 16rpx;
+ --td-spacer-1: 24rpx;
+ --td-spacer-2: 32rpx;
+ --td-spacer-3: 48rpx;
+ --td-spacer-4: 64rpx;
+ --td-spacer-5: 96rpx;
+ --td-spacer-6: 160rpx;
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/common/template/button.wxml b/miniprogram_npm/tdesign-miniprogram/common/template/button.wxml
index 173e8bb..d16a178 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/template/button.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/common/template/button.wxml
@@ -1,11 +1,13 @@
{{content}}
+
+
diff --git a/miniprogram_npm/tdesign-miniprogram/common/template/image.wxml b/miniprogram_npm/tdesign-miniprogram/common/template/image.wxml
index cbbbc2b..43fe524 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/template/image.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/common/template/image.wxml
@@ -1,6 +1,12 @@
diff --git a/miniprogram_npm/tdesign-miniprogram/common/utils.d.ts b/miniprogram_npm/tdesign-miniprogram/common/utils.d.ts
index c045923..6639e87 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/utils.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/common/utils.d.ts
@@ -1,21 +1,29 @@
///
///
+///
+export declare const systemInfo: WechatMiniprogram.WindowInfo | WechatMiniprogram.SystemInfo;
+export declare const appBaseInfo: WechatMiniprogram.AppBaseInfo | WechatMiniprogram.SystemInfo;
+export declare const deviceInfo: WechatMiniprogram.DeviceInfo | WechatMiniprogram.SystemInfo;
declare type Context = WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance;
export declare const debounce: (func: any, wait?: number) => (...rest: any[]) => void;
export declare const throttle: (func: any, wait?: number, options?: any) => (...args: any[]) => void;
export declare const classNames: (...args: any[]) => string;
export declare const styles: (styleObj: any) => string;
-export declare const getAnimationFrame: (context: any, cb: Function) => WechatMiniprogram.NodesRef;
+export declare const getAnimationFrame: (context: any, cb: Function) => any;
export declare const getRect: (context: any, selector: string, needAll?: boolean) => Promise;
export declare const isNumber: (value: any) => boolean;
+export declare const isNull: (value: any) => boolean;
+export declare const isUndefined: (value: any) => boolean;
+export declare const isDef: (value: any) => boolean;
+export declare const isIOS: () => boolean;
export declare const addUnit: (value?: string | number) => string | undefined;
-export declare const getCharacterLength: (type: string, str: string, max?: number) => {
+export declare const getCharacterLength: (type: string, char: string | number, max?: number) => {
length: number;
characters: string;
};
export declare const chunk: (arr: any[], size: number) => any[][];
export declare const getInstance: (context?: Context, selector?: string) => WechatMiniprogram.Component.TrivialInstance;
-export declare const unitConvert: (value: number | string) => number;
+export declare const unitConvert: (value: number | string | null | undefined) => number;
export declare const setIcon: (iconName: any, icon: any, defaultIcon: any) => {
[x: string]: any;
};
@@ -26,4 +34,7 @@ export declare const toCamel: (str: any) => any;
export declare const getCurrentPage: () => T & WechatMiniprogram.OptionalInterface & WechatMiniprogram.Page.InstanceProperties & WechatMiniprogram.Page.InstanceMethods & WechatMiniprogram.Page.Data & WechatMiniprogram.IAnyObject;
export declare const uniqueFactory: (compName: any) => () => string;
export declare const calcIcon: (icon: string | Record, defaultIcon?: string) => string | Record;
+export declare const isOverSize: (size: any, sizeLimit: any) => boolean;
+export declare const rpx2px: (rpx: any) => number;
+export declare const nextTick: () => Promise;
export {};
diff --git a/miniprogram_npm/tdesign-miniprogram/common/utils.js b/miniprogram_npm/tdesign-miniprogram/common/utils.js
index 37a8f57..2ae1bb5 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/utils.js
+++ b/miniprogram_npm/tdesign-miniprogram/common/utils.js
@@ -1,5 +1,8 @@
import { prefix } from './config';
-const systemInfo = wx.getSystemInfoSync();
+import { getWindowInfo, getAppBaseInfo, getDeviceInfo } from './wechat';
+export const systemInfo = getWindowInfo();
+export const appBaseInfo = getAppBaseInfo();
+export const deviceInfo = getDeviceInfo();
export const debounce = function (func, wait = 500) {
let timerId;
return function (...rest) {
@@ -67,9 +70,8 @@ export const styles = function (styleObj) {
.join('; ');
};
export const getAnimationFrame = function (context, cb) {
- return wx
+ return context
.createSelectorQuery()
- .in(context)
.selectViewport()
.boundingClientRect()
.exec(() => {
@@ -78,8 +80,8 @@ export const getAnimationFrame = function (context, cb) {
};
export const getRect = function (context, selector, needAll = false) {
return new Promise((resolve, reject) => {
- wx.createSelectorQuery()
- .in(context)[needAll ? 'selectAll' : 'select'](selector)
+ context
+ .createSelectorQuery()[needAll ? 'selectAll' : 'select'](selector)
.boundingClientRect((rect) => {
if (rect) {
resolve(rect);
@@ -91,12 +93,20 @@ export const getRect = function (context, selector, needAll = false) {
.exec();
});
};
-const isDef = function (value) {
- return value !== undefined && value !== null;
-};
export const isNumber = function (value) {
return /^\d+(\.\d+)?$/.test(value);
};
+export const isNull = function (value) {
+ return value === null;
+};
+export const isUndefined = (value) => typeof value === 'undefined';
+export const isDef = function (value) {
+ return !isUndefined(value) && !isNull(value);
+};
+export const isIOS = function () {
+ var _a;
+ return !!(((_a = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.system) === null || _a === void 0 ? void 0 : _a.toLowerCase().search('ios')) + 1);
+};
export const addUnit = function (value) {
if (!isDef(value)) {
return undefined;
@@ -104,8 +114,9 @@ export const addUnit = function (value) {
value = String(value);
return isNumber(value) ? `${value}px` : value;
};
-export const getCharacterLength = (type, str, max) => {
- if (!str || str.length === 0) {
+export const getCharacterLength = (type, char, max) => {
+ const str = String(char !== null && char !== void 0 ? char : '');
+ if (str.length === 0) {
return {
length: 0,
characters: '',
@@ -168,7 +179,7 @@ export const unitConvert = (value) => {
}
return parseInt(value, 10);
}
- return value;
+ return value !== null && value !== void 0 ? value : 0;
};
export const setIcon = (iconName, icon, defaultIcon) => {
if (icon) {
@@ -209,7 +220,7 @@ export const uniqueFactory = (compName) => {
return () => `${prefix}_${compName}_${number++}`;
};
export const calcIcon = (icon, defaultIcon) => {
- if ((isBool(icon) && icon && defaultIcon) || isString(icon)) {
+ if (icon && ((isBool(icon) && defaultIcon) || isString(icon))) {
return { name: isBool(icon) ? defaultIcon : icon };
}
if (isObject(icon)) {
@@ -217,3 +228,25 @@ export const calcIcon = (icon, defaultIcon) => {
}
return null;
};
+export const isOverSize = (size, sizeLimit) => {
+ var _a;
+ if (!sizeLimit)
+ return false;
+ const base = 1000;
+ const unitMap = {
+ B: 1,
+ KB: base,
+ MB: base * base,
+ GB: base * base * base,
+ };
+ const computedSize = typeof sizeLimit === 'number' ? sizeLimit * base : (sizeLimit === null || sizeLimit === void 0 ? void 0 : sizeLimit.size) * unitMap[(_a = sizeLimit === null || sizeLimit === void 0 ? void 0 : sizeLimit.unit) !== null && _a !== void 0 ? _a : 'KB'];
+ return size > computedSize;
+};
+export const rpx2px = (rpx) => Math.floor((systemInfo.windowWidth * rpx) / 750);
+export const nextTick = () => {
+ return new Promise((resolve) => {
+ wx.nextTick(() => {
+ resolve();
+ });
+ });
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/common/utils.wxs b/miniprogram_npm/tdesign-miniprogram/common/utils.wxs
index c0fea73..1e023eb 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/utils.wxs
+++ b/miniprogram_npm/tdesign-miniprogram/common/utils.wxs
@@ -4,7 +4,7 @@
* addUnit */
// 为 css 添加单位
function addUnit(value) {
- var REGEXP = getRegExp('^\d+(.\d+)?$');
+ var REGEXP = getRegExp('^-?\d+(.\d+)?$');
if (value == null) {
return undefined;
}
@@ -42,7 +42,7 @@ function includes(arr, value) {
function cls(base, arr) {
var res = [base];
var i = 0;
- for (size = arr.length; i < size; i++) {
+ for (var size = arr.length; i < size; i++) {
var item = arr[i];
if (item && item.constructor === 'Array') {
@@ -52,7 +52,7 @@ function cls(base, arr) {
if (value) {
res.push(base + '--' + key);
}
- } else if (typeof item === 'string') {
+ } else if (typeof item === 'string' || typeof item === 'number') {
if (item) {
res.push(base + '--' + item);
}
@@ -61,24 +61,71 @@ function cls(base, arr) {
return res.join(' ');
}
-function endsWith(str, endStr) {
- return str.slice(-endStr.length) === endStr ? true : false;
+function getBadgeAriaLabel(options) {
+ var maxCount = options.maxCount || 99;
+ if (options.dot) {
+ return '有新的消息';
+ }
+ if (options.count === '...') {
+ return '有很多消息';
+ }
+ if (isNaN(options.count)) {
+ return options.count;
+ }
+ var str1 = '有' + maxCount + '+条消息';
+ var str2 = '有' + options.count + '条消息';
+ return Number(options.count) > maxCount ? str1 : str2;
}
-function _style(arr) {
- var res = [];
- var r = arr.filter(function (s) {
- return s && s.trim();
- });
+function endsWith(str, endStr) {
+ return str.slice(-endStr.length) === endStr ? str : str + endStr;
+}
- for (i = 0; i < r.length; i++) {
- if (endsWith(r[i], ';')) {
- res.push(r[i]);
- } else {
- res.push(r[i] + ';');
- }
+function keys(obj) {
+ return JSON.stringify(obj)
+ .replace(getRegExp('{|}|"', 'g'), '')
+ .split(',')
+ .map(function (item) {
+ return item.split(':')[0];
+ });
+}
+
+function kebabCase(str) {
+ return str
+ .replace(getRegExp('[A-Z]', 'g'), function (ele) {
+ return '-' + ele;
+ })
+ .toLowerCase();
+}
+
+function _style(styles) {
+ if (isArray(styles)) {
+ return styles
+ .filter(function (item) {
+ return item != null && item !== '';
+ })
+ .map(function (item) {
+ return isArray(item) ? _style(item) : endsWith(item, ';');
+ })
+ .join(' ');
}
- return res.join(' ');
+
+ if (isObject(styles)) {
+ return keys(styles)
+ .filter(function (key) {
+ return styles[key] != null && styles[key] !== '';
+ })
+ .map(function (key) {
+ return [kebabCase(key), [styles[key]]].join(':');
+ })
+ .join(';');
+ }
+
+ return styles;
+}
+
+function isValidIconName(str) {
+ return getRegExp('^[A-Za-z0-9\-]+$').test(str);
}
module.exports = {
@@ -89,5 +136,7 @@ module.exports = {
isNoEmptyObj: isNoEmptyObj,
includes: includes,
cls: cls,
+ getBadgeAriaLabel: getBadgeAriaLabel,
_style: _style,
+ isValidIconName: isValidIconName,
};
diff --git a/miniprogram_npm/tdesign-miniprogram/common/version.d.ts b/miniprogram_npm/tdesign-miniprogram/common/version.d.ts
index a492558..0f9c6e9 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/version.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/common/version.d.ts
@@ -1,2 +1,3 @@
+export declare function compareVersion(v1: any, v2: any): 0 | 1 | -1;
export declare function canIUseFormFieldButton(): boolean;
export declare function canUseVirtualHost(): boolean;
diff --git a/miniprogram_npm/tdesign-miniprogram/common/version.js b/miniprogram_npm/tdesign-miniprogram/common/version.js
index a4e7619..2dc8e6b 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/version.js
+++ b/miniprogram_npm/tdesign-miniprogram/common/version.js
@@ -1,11 +1,12 @@
+import { getAppBaseInfo } from './wechat';
let systemInfo;
function getSystemInfo() {
if (systemInfo == null) {
- systemInfo = wx.getSystemInfoSync();
+ systemInfo = getAppBaseInfo();
}
return systemInfo;
}
-function compareVersion(v1, v2) {
+export function compareVersion(v1, v2) {
v1 = v1.split('.');
v2 = v2.split('.');
const len = Math.max(v1.length, v2.length);
@@ -32,8 +33,7 @@ function judgeByVersion(version) {
return compareVersion(currentSDKVersion, version) >= 0;
}
export function canIUseFormFieldButton() {
- const version = '2.10.3';
- return judgeByVersion(version);
+ return judgeByVersion('2.10.3');
}
export function canUseVirtualHost() {
return judgeByVersion('2.19.2');
diff --git a/miniprogram_npm/tdesign-miniprogram/common/wechat.d.ts b/miniprogram_npm/tdesign-miniprogram/common/wechat.d.ts
new file mode 100644
index 0000000..db57069
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/wechat.d.ts
@@ -0,0 +1,4 @@
+export declare const getObserver: (context: any, selector: string) => Promise;
+export declare const getWindowInfo: () => WechatMiniprogram.WindowInfo | WechatMiniprogram.SystemInfo;
+export declare const getAppBaseInfo: () => WechatMiniprogram.SystemInfo | WechatMiniprogram.AppBaseInfo;
+export declare const getDeviceInfo: () => WechatMiniprogram.SystemInfo | WechatMiniprogram.DeviceInfo;
diff --git a/miniprogram_npm/tdesign-miniprogram/common/wechat.js b/miniprogram_npm/tdesign-miniprogram/common/wechat.js
new file mode 100644
index 0000000..c776abf
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/common/wechat.js
@@ -0,0 +1,19 @@
+export const getObserver = (context, selector) => {
+ return new Promise((resolve, reject) => {
+ context
+ .createIntersectionObserver(context)
+ .relativeToViewport()
+ .observe(selector, (res) => {
+ resolve(res);
+ });
+ });
+};
+export const getWindowInfo = () => {
+ return wx.getWindowInfo ? wx.getWindowInfo() || wx.getSystemInfoSync() : wx.getSystemInfoSync();
+};
+export const getAppBaseInfo = () => {
+ return wx.getAppBaseInfo ? wx.getAppBaseInfo() || wx.getSystemInfoSync() : wx.getSystemInfoSync();
+};
+export const getDeviceInfo = () => {
+ return wx.getDeviceInfo ? wx.getDeviceInfo() || wx.getSystemInfoSync() : wx.getSystemInfoSync();
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/count-down/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/count-down/README.en-US.md
index 44bca3e..9518e7e 100644
--- a/miniprogram_npm/tdesign-miniprogram/count-down/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/count-down/README.en-US.md
@@ -6,14 +6,16 @@
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
auto-start | Boolean | true | \- | N
-content | String / Slot | 'default' | \- | N
+content | String / Slot | 'default' | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
format | String | HH:mm:ss | \- | N
millisecond | Boolean | false | \- | N
-size | String `v0.5.1` | 'small' | options:small/medium/large | N
-split-with-unit `v0.5.1` | Boolean | false | \- | N
-theme | String `v0.5.1` | 'default' | options:default/round/square | N
-time | Number | - | required | Y
+size | String | 'medium' | `0.5.1`。options: small/medium/large | N
+split-with-unit | Boolean | false | `0.5.1` | N
+theme | String | 'default' | `0.5.1`。options: default/round/square | N
+time | Number | 0 | required | Y
### CountDown Events
@@ -21,3 +23,21 @@ name | params | description
-- | -- | --
change | `(time: TimeData)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/count-down/type.ts)。
`interface TimeData { days: number; hours: number; minutes: number; seconds: number; milliseconds: number }`
finish | \- | \-
+### CountDown External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-count | \-
+t-class-split | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-countdown-bg-color | @error-color-6 | -
+--td-countdown-default-color | @font-gray-1 | -
+--td-countdown-round-border-radius | @radius-circle | -
+--td-countdown-round-color | @font-white-1 | -
+--td-countdown-square-border-radius | @radius-small | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/count-down/README.md b/miniprogram_npm/tdesign-miniprogram/count-down/README.md
index 12cd224..72efb6d 100644
--- a/miniprogram_npm/tdesign-miniprogram/count-down/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/count-down/README.md
@@ -6,6 +6,10 @@ isComponent: true
---



+
+> CountDown 组件用于实时展示倒计时数值。
+如果需要与站点演示一致的数字字体效果,推荐您到 数字字体章节,将 TCloudNumber 字体下载并将包含的 TCloudNumberVF.ttf 做为 TCloudNumber 字体资源引入到具体项目中使用。
+
## 引入
全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
@@ -18,6 +22,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 基础倒计时
{{ base }}
@@ -27,19 +37,21 @@ isComponent: true
{{ size }}
## API
+
### CountDown Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
auto-start | Boolean | true | 是否自动开始倒计时 | N
-content | String / Slot | 'default' | 最终倒计时的展示内容,值为'default'时使用默认的格式,否则使用自定义样式插槽 | N
+content | String / Slot | 'default' | 最终倒计时的展示内容,值为'default'时使用默认的格式,否则使用自定义样式插槽。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
format | String | HH:mm:ss | 时间格式,DD-日,HH-时,mm-分,ss-秒,SSS-毫秒 | N
millisecond | Boolean | false | 是否开启毫秒级渲染 | N
-size | String `v0.5.1` | 'medium' | 倒计时尺寸。可选项:small/medium/large | N
-split-with-unit `v0.5.1` | Boolean | false | 使用时间单位分割 | N
-theme | String `v0.5.1` | 'default' | 倒计时风格。可选项:default/round/square | N
-time | Number | - | 必需。倒计时时长,单位毫秒 | Y
-external-classes | Array | - | 组件类名,分别用于设置 组件外层类名、计时器类型、分隔线类名 等。`['t-class', 't-class-count', 't-class-split']` | N
+size | String | 'medium' | `0.5.1`。倒计时尺寸。可选项:small/medium/large | N
+split-with-unit | Boolean | false | `0.5.1`。使用时间单位分割 | N
+theme | String | 'default' | `0.5.1`。倒计时风格。可选项:default/round/square | N
+time | Number | 0 | 必需。倒计时时长,单位毫秒 | Y
### CountDown Events
@@ -47,3 +59,21 @@ external-classes | Array | - | 组件类名,分别用于设置 组件外层类
-- | -- | --
change | `(time: TimeData)` | 时间变化时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/count-down/type.ts)。
`interface TimeData { days: number; hours: number; minutes: number; seconds: number; milliseconds: number }`
finish | \- | 倒计时结束时触发
+### CountDown External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-count | 计数样式类
+t-class-split | 分隔线样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-countdown-bg-color | @error-color-6 | -
+--td-countdown-default-color | @font-gray-1 | -
+--td-countdown-round-border-radius | @radius-circle | -
+--td-countdown-round-color | @font-white-1 | -
+--td-countdown-square-border-radius | @radius-small | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/count-down/count-down.json b/miniprogram_npm/tdesign-miniprogram/count-down/count-down.json
index 049940c..f783dae 100644
--- a/miniprogram_npm/tdesign-miniprogram/count-down/count-down.json
+++ b/miniprogram_npm/tdesign-miniprogram/count-down/count-down.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/count-down/count-down.wxss b/miniprogram_npm/tdesign-miniprogram/count-down/count-down.wxss
index 6ed1bb9..d774c97 100644
--- a/miniprogram_npm/tdesign-miniprogram/count-down/count-down.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/count-down/count-down.wxss
@@ -101,11 +101,12 @@
font-size: var(--td-font-size-base, 28rpx);
}
.t-count-down {
- font-family: 'DIN Alternate', 'Courier New', Courier, monospace;
+ font-family: TCloudNumber, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Hiragino Sans GB, Microsoft YaHei UI, Microsoft YaHei, Source Han Sans CN, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
+ display: flex;
}
.t-count-down .t-count-down__item,
.t-count-down .t-count-down__split {
- display: inline-flex;
+ display: flex;
align-items: center;
justify-content: center;
}
@@ -115,20 +116,20 @@
}
.t-count-down--square > .t-count-down__split--text,
.t-count-down--round > .t-count-down__split--text {
- color: var(--td-font-gray-1, rgba(0, 0, 0, 0.9));
+ color: var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
}
.t-count-down--default {
- color: var(--td-countdown-default-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-countdown-default-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-count-down--square {
- color: var(--td-countdown-round-color, var(--td-font-white-1, #ffffff));
+ color: var(--td-countdown-round-color, var(--td-text-color-anti, var(--td-font-white-1, #ffffff)));
}
.t-count-down--square > .t-count-down__item {
border-radius: var(--td-countdown-square-border-radius, var(--td-radius-small, 6rpx));
background: var(--td-countdown-bg-color, var(--td-error-color-6, #d54941));
}
.t-count-down--round {
- color: var(--td-countdown-round-color, var(--td-font-white-1, #ffffff));
+ color: var(--td-countdown-round-color, var(--td-text-color-anti, var(--td-font-white-1, #ffffff)));
}
.t-count-down--round > .t-count-down__item {
border-radius: var(--td-countdown-round-border-radius, var(--td-radius-circle, 50%));
diff --git a/miniprogram_npm/tdesign-miniprogram/count-down/props.js b/miniprogram_npm/tdesign-miniprogram/count-down/props.js
index fe871f8..3b67fea 100644
--- a/miniprogram_npm/tdesign-miniprogram/count-down/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/count-down/props.js
@@ -29,6 +29,8 @@ const props = {
},
time: {
type: Number,
+ value: 0,
+ required: true,
},
};
export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/count-down/type.d.ts b/miniprogram_npm/tdesign-miniprogram/count-down/type.d.ts
index 84007d2..2d362a6 100644
--- a/miniprogram_npm/tdesign-miniprogram/count-down/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/count-down/type.d.ts
@@ -7,10 +7,6 @@ export interface TdCountDownProps {
type: StringConstructor;
value?: string;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
format?: {
type: StringConstructor;
value?: string;
@@ -34,5 +30,6 @@ export interface TdCountDownProps {
time: {
type: NumberConstructor;
value?: number;
+ required?: boolean;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/date-time-picker/README.en-US.md
index 7f31cb2..5e74c6e 100644
--- a/miniprogram_npm/tdesign-miniprogram/date-time-picker/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/README.en-US.md
@@ -1,21 +1,29 @@
:: BASE_DOC ::
## API
+
### DateTimePicker Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+auto-close | Boolean | false | \- | N
cancel-btn | String | 取消 | \- | N
confirm-btn | String | - | \- | N
+custom-locale | String | zh | \- | N
end | String / Number | - | \- | N
-external-classes | Array | - | `['t-class', 't-class-confirm', 't-class-cancel', 't-class-title']` | N
-footer | Slot | true | `deprecated` | N
+filter | Function | - | Typescript:`(type: TimeModeValues, columns: DateTimePickerColumn) => DateTimePickerColumn` `type DateTimePickerColumn = DateTimePickerColumnItem[]` `interface DateTimePickerColumnItem { label: string,value: string}`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts) | N
+footer | Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
format | String | 'YYYY-MM-DD HH:mm:ss' | \- | N
-header | Boolean / Slot | true | \- | N
+header | Boolean / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
mode | String / Array | 'date' | Typescript:`DateTimePickerMode` `type DateTimePickerMode = TimeModeValues \| Array ` `type TimeModeValues = 'year' \| 'month' \| 'date' \| 'hour' \| 'minute' \| 'second'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts) | N
+popup-props | Object | {} | popup properties。Typescript:`PopupProps`,[Popup API Documents](./popup?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts) | N
show-week | Boolean | false | \- | N
start | String / Number | - | \- | N
+steps | Object | - | \- | N
title | String | - | title of picker | N
+use-popup | Boolean | true | \- | N
value | String / Number | - | Typescript:`DateValue` `type DateValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts) | N
default-value | String / Number | undefined | uncontrolled property。Typescript:`DateValue` `type DateValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts) | N
visible | Boolean | false | \- | N
@@ -26,6 +34,22 @@ name | params | description
-- | -- | --
cancel | \- | \-
change | `(value: DateValue)` | \-
-close | `(trigger: TriggerSource)` | `1.0.1`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confrim-btn'`
+close | `(trigger: TriggerSource)` | `1.0.1`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confirm-btn'`
confirm | `(value: DateValue)` | `1.0.1`
pick | `(value: DateValue)` | \-
+
+### DateTimePicker External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-cancel | \-
+t-class-confirm | \-
+t-class-title | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-data-time-picker-year-width | 128rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/README.md b/miniprogram_npm/tdesign-miniprogram/date-time-picker/README.md
index df57b82..23e5752 100644
--- a/miniprogram_npm/tdesign-miniprogram/date-time-picker/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/README.md
@@ -18,7 +18,13 @@ isComponent: true
## 代码演示
-### 日期选择器
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
+### 组件类型
#### 年月日选择器
@@ -38,22 +44,40 @@ isComponent: true
{{ date-all }}
+### 组件用法
+
+#### 调整步数
+
+{{ steps }}
+
+#### 不使用 Popup
+
+{{ without-popup }}
+
## API
+
### DateTimePicker Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+auto-close | Boolean | false | 自动关闭;在确认、取消、点击遮罩层自动关闭,不需要手动设置 visible | N
cancel-btn | String | 取消 | 取消按钮文字 | N
confirm-btn | String | - | 确定按钮文字 | N
+custom-locale | String | zh | 组件国际化语言,目前支持: 简体中文(zh)、(tc)、英文(en)、日语(ja)、韩语(ko)、俄语(ru)等六种语言 | N
end | String / Number | - | 选择器的最大可选时间,默认为当前时间+10年 | N
-external-classes | Array | - | 组件类名,分别用于设置组件外层元素、确认按钮、取消按钮、标题等元素类名。`['t-class', 't-class-confirm', 't-class-cancel', 't-class-title']` | N
-footer | Slot | true | 已废弃。底部内容 | N
-format | String | 'YYYY-MM-DD HH:mm:ss' | 用于pick、change、confirm事件参数格式化[详细文档](https://day.js.org/docs/en/display/format) | N
-header | Boolean / Slot | true | 头部内容。值为 true 显示空白头部,值为 false 不显示任何内容,值类型为 TNode 表示自定义头部内容 | N
+filter | Function | - | 列选项过滤函数,支持自定义列内容。(type 值可为: year, month, date, hour, minute, second)。TS 类型:`(type: TimeModeValues, columns: DateTimePickerColumn) => DateTimePickerColumn` `type DateTimePickerColumn = DateTimePickerColumnItem[]` `interface DateTimePickerColumnItem { label: string,value: string}`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts) | N
+footer | Slot | - | 底部内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+format | String | 'YYYY-MM-DD HH:mm:ss' | 用于格式化 pick、change、confirm 事件返回的值,[详细文档](https://day.js.org/docs/en/display/format) | N
+header | Boolean / Slot | true | 头部内容。值为 true 显示空白头部,值为 false 不显示任何内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
mode | String / Array | 'date' | year = 年;month = 年月;date = 年月日;hour = 年月日时; minute = 年月日时分;当类型为数组时,第一个值控制年月日,第二个值控制时分秒。TS 类型:`DateTimePickerMode` `type DateTimePickerMode = TimeModeValues \| Array ` `type TimeModeValues = 'year' \| 'month' \| 'date' \| 'hour' \| 'minute' \| 'second'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts) | N
+popup-props | Object | {} | 透传 `Popup` 组件全部属性。TS 类型:`PopupProps`,[Popup API Documents](./popup?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts) | N
show-week | Boolean | false | 【开发中】是否在日期旁边显示周几(如周一,周二,周日等) | N
start | String / Number | - | 选择器的最小可选时间,默认为当前时间-10年 | N
+steps | Object | - | 时间间隔步数,示例:`{ minute: 5 }` | N
title | String | - | 标题 | N
+use-popup | Boolean | true | 是否使用弹出层包裹 | N
value | String / Number | - | 选中值。TS 类型:`DateValue` `type DateValue = string \| number`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts) | N
default-value | String / Number | undefined | 选中值。非受控属性。TS 类型:`DateValue` `type DateValue = string \| number`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts) | N
visible | Boolean | false | 是否显示 | N
@@ -64,6 +88,22 @@ visible | Boolean | false | 是否显示 | N
-- | -- | --
cancel | \- | 取消按钮点击时触发
change | `(value: DateValue)` | 确认按钮点击时触发
-close | `(trigger: TriggerSource)` | `1.0.1`。关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confrim-btn'`
+close | `(trigger: TriggerSource)` | `1.0.1`。关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confirm-btn'`
confirm | `(value: DateValue)` | `1.0.1`。确认按钮点击时触发
pick | `(value: DateValue)` | 选中值发生变化时触发
+
+### DateTimePicker External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-cancel | 取消样式类
+t-class-confirm | 确认样式类
+t-class-title | 标题样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-data-time-picker-year-width | 128rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.d.ts b/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.d.ts
index 7ee1e1d..6d4da9c 100644
--- a/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.d.ts
@@ -20,6 +20,7 @@ export default class DateTimePicker extends SuperComponent {
};
observers: {
'start, end, value': () => void;
+ customLocale(v: any): void;
mode(m: any): void;
};
date: any;
@@ -29,18 +30,8 @@ export default class DateTimePicker extends SuperComponent {
columns: any[];
columnsValue: any[];
fullModes: any[];
- locale: {
- year: string;
- month: string;
- date: string;
- hour: string;
- minute: string;
- second: string;
- am: string;
- pm: string;
- confirm: string;
- cancel: string;
- };
+ locale: any;
+ dayjsLocale: any;
};
controlledProps: {
key: string;
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.js b/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.js
index 24b7a63..3a6f630 100644
--- a/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.js
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.js
@@ -4,11 +4,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
+var _a, _b;
import dayjs from 'dayjs';
+import localeData from 'dayjs/plugin/localeData';
import config from '../common/config';
import { SuperComponent, wxComponent } from '../common/src/index';
-import defaultLocale from './locale/zh';
import props from './props';
+import dayjsLocaleMap from './locale/dayjs';
+dayjs.extend(localeData);
+dayjs.locale('zh-cn');
+const defaultLocale = ((_a = dayjsLocaleMap[dayjs.locale()]) === null || _a === void 0 ? void 0 : _a.key) || ((_b = dayjsLocaleMap.default) === null || _b === void 0 ? void 0 : _b.key);
const { prefix } = config;
const name = `${prefix}-date-time-picker`;
var ModeItem;
@@ -37,6 +42,14 @@ let DateTimePicker = class DateTimePicker extends SuperComponent {
'start, end, value': function () {
this.updateColumns();
},
+ customLocale(v) {
+ if (!v || !dayjsLocaleMap[v].key)
+ return;
+ this.setData({
+ locale: dayjsLocaleMap[v].i18n,
+ dayjsLocale: dayjsLocaleMap[v].key,
+ });
+ },
mode(m) {
const fullModes = this.getFullModeArray(m);
this.setData({
@@ -52,7 +65,8 @@ let DateTimePicker = class DateTimePicker extends SuperComponent {
columns: [],
columnsValue: [],
fullModes: [],
- locale: defaultLocale,
+ locale: dayjsLocaleMap[defaultLocale].i18n,
+ dayjsLocale: dayjsLocaleMap[defaultLocale].key,
};
this.controlledProps = [
{
@@ -121,24 +135,31 @@ let DateTimePicker = class DateTimePicker extends SuperComponent {
return tempDate.month(month);
},
getColumnOptions() {
- const { fullModes } = this.data;
+ const { fullModes, filter } = this.data;
const columnOptions = [];
fullModes === null || fullModes === void 0 ? void 0 : fullModes.forEach((mode) => {
const columnOption = this.getOptionByType(mode);
- columnOptions.push(columnOption);
+ if (typeof filter === 'function') {
+ columnOptions.push(filter(mode, columnOption));
+ }
+ else {
+ columnOptions.push(columnOption);
+ }
});
return columnOptions;
},
getOptionByType(type) {
- const { locale } = this.data;
+ var _a;
+ const { locale, steps } = this.data;
const options = [];
const minEdge = this.getOptionEdge('min', type);
const maxEdge = this.getOptionEdge('max', type);
- for (let i = minEdge; i <= maxEdge; i += 1) {
- const label = type === 'month' ? i + 1 : i;
+ const step = (_a = steps === null || steps === void 0 ? void 0 : steps[type]) !== null && _a !== void 0 ? _a : 1;
+ const dayjsMonthsShort = dayjs().locale(this.data.dayjsLocale).localeData().monthsShort();
+ for (let i = minEdge; i <= maxEdge; i += step) {
options.push({
value: `${i}`,
- label: `${label + locale[type]}`,
+ label: type === 'month' ? dayjsMonthsShort[i] : `${i + locale[type]}`,
});
}
return options;
@@ -175,14 +196,14 @@ let DateTimePicker = class DateTimePicker extends SuperComponent {
return edge[type][minOrMax === 'min' ? 0 : 1];
},
getMonthOptions() {
- const { locale } = this.data;
const months = [];
const minMonth = this.getOptionEdge('min', 'month');
const maxMonth = this.getOptionEdge('max', 'month');
+ const dayjsMonthsShort = dayjs.monthsShort();
for (let i = minMonth; i <= maxMonth; i += 1) {
months.push({
value: `${i}`,
- label: `${i + 1 + locale.month}`,
+ label: dayjsMonthsShort[i],
});
}
return months;
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.json b/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.json
index 460dcd6..1207def 100644
--- a/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.json
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-picker": "../picker/picker",
"t-picker-item": "../picker-item/picker-item"
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.wxml b/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.wxml
index c8a4ad5..eea4578 100644
--- a/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker.wxml
@@ -1,22 +1,23 @@
-
-
+
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/dayjs.d.ts b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/dayjs.d.ts
new file mode 100644
index 0000000..0d6f6df
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/dayjs.d.ts
@@ -0,0 +1,174 @@
+import enLocale from 'dayjs/locale/en';
+declare const _default: {
+ default: {
+ key: string;
+ label: string;
+ locale: enLocale.Locale;
+ i18n: {
+ year: string;
+ month: string;
+ date: string;
+ hour: string;
+ minute: string;
+ second: string;
+ am: string;
+ pm: string;
+ confirm: string;
+ cancel: string;
+ };
+ };
+ en: {
+ key: string;
+ label: string;
+ locale: enLocale.Locale;
+ i18n: {
+ year: string;
+ month: string;
+ date: string;
+ hour: string;
+ minute: string;
+ second: string;
+ am: string;
+ pm: string;
+ confirm: string;
+ cancel: string;
+ };
+ };
+ 'zh-cn': {
+ key: string;
+ label: string;
+ locale: enLocale.Locale;
+ i18n: {
+ year: string;
+ month: string;
+ date: string;
+ hour: string;
+ minute: string;
+ second: string;
+ am: string;
+ pm: string;
+ confirm: string;
+ cancel: string;
+ };
+ };
+ zh: {
+ key: string;
+ label: string;
+ locale: enLocale.Locale;
+ i18n: {
+ year: string;
+ month: string;
+ date: string;
+ hour: string;
+ minute: string;
+ second: string;
+ am: string;
+ pm: string;
+ confirm: string;
+ cancel: string;
+ };
+ };
+ 'zh-tw': {
+ key: string;
+ label: string;
+ locale: enLocale.Locale;
+ i18n: {
+ year: string;
+ month: string;
+ date: string;
+ hour: string;
+ minute: string;
+ second: string;
+ am: string;
+ pm: string;
+ confirm: string;
+ cancel: string;
+ };
+ };
+ tc: {
+ key: string;
+ label: string;
+ locale: enLocale.Locale;
+ i18n: {
+ year: string;
+ month: string;
+ date: string;
+ hour: string;
+ minute: string;
+ second: string;
+ am: string;
+ pm: string;
+ confirm: string;
+ cancel: string;
+ };
+ };
+ ko: {
+ key: string;
+ label: string;
+ locale: enLocale.Locale;
+ i18n: {
+ year: string;
+ month: string;
+ date: string;
+ hour: string;
+ minute: string;
+ second: string;
+ am: string;
+ pm: string;
+ confirm: string;
+ cancel: string;
+ };
+ };
+ kr: {
+ key: string;
+ label: string;
+ locale: enLocale.Locale;
+ i18n: {
+ year: string;
+ month: string;
+ date: string;
+ hour: string;
+ minute: string;
+ second: string;
+ am: string;
+ pm: string;
+ confirm: string;
+ cancel: string;
+ };
+ };
+ ja: {
+ key: string;
+ label: string;
+ locale: enLocale.Locale;
+ i18n: {
+ year: string;
+ month: string;
+ date: string;
+ hour: string;
+ minute: string;
+ second: string;
+ am: string;
+ pm: string;
+ confirm: string;
+ cancel: string;
+ };
+ };
+ ru: {
+ key: string;
+ label: string;
+ locale: enLocale.Locale;
+ i18n: {
+ year: string;
+ month: string;
+ date: string;
+ hour: string;
+ minute: string;
+ second: string;
+ am: string;
+ pm: string;
+ confirm: string;
+ cancel: string;
+ };
+ };
+};
+export default _default;
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/dayjs.js b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/dayjs.js
new file mode 100644
index 0000000..0bff459
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/dayjs.js
@@ -0,0 +1,74 @@
+import enLocale from 'dayjs/locale/en';
+import zhLocale from 'dayjs/locale/zh-cn';
+import tcLocale from 'dayjs/locale/zh-tw';
+import koLocale from 'dayjs/locale/ko';
+import jaLocale from 'dayjs/locale/ja';
+import ruLocale from 'dayjs/locale/ru';
+import en from './en';
+import zh from './zh';
+import tc from './tc';
+import ko from './ko';
+import ja from './ja';
+import ru from './ru';
+export default {
+ default: {
+ key: 'zh-cn',
+ label: '简体中文',
+ locale: zhLocale,
+ i18n: zh,
+ },
+ en: {
+ key: 'en',
+ label: 'English',
+ locale: enLocale,
+ i18n: en,
+ },
+ 'zh-cn': {
+ key: 'zh-cn',
+ label: '简体中文',
+ locale: zhLocale,
+ i18n: zh,
+ },
+ zh: {
+ key: 'zh-cn',
+ label: '简体中文',
+ locale: zhLocale,
+ i18n: zh,
+ },
+ 'zh-tw': {
+ key: 'zh-tw',
+ label: '繁体中文',
+ locale: tcLocale,
+ i18n: tc,
+ },
+ tc: {
+ key: 'zh-tw',
+ label: '繁体中文',
+ locale: tcLocale,
+ i18n: tc,
+ },
+ ko: {
+ key: 'ko',
+ label: '한국어',
+ locale: koLocale,
+ i18n: ko,
+ },
+ kr: {
+ key: 'ko',
+ label: '한국어',
+ locale: koLocale,
+ i18n: ko,
+ },
+ ja: {
+ key: 'ja',
+ label: '日本語',
+ locale: jaLocale,
+ i18n: ja,
+ },
+ ru: {
+ key: 'ru',
+ label: 'русский',
+ locale: ruLocale,
+ i18n: ru,
+ },
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ja.d.ts b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ja.d.ts
new file mode 100644
index 0000000..9665c2e
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ja.d.ts
@@ -0,0 +1,13 @@
+declare const _default: {
+ year: string;
+ month: string;
+ date: string;
+ hour: string;
+ minute: string;
+ second: string;
+ am: string;
+ pm: string;
+ confirm: string;
+ cancel: string;
+};
+export default _default;
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ja.js b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ja.js
new file mode 100644
index 0000000..7851cab
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ja.js
@@ -0,0 +1,12 @@
+export default {
+ year: '年',
+ month: '月',
+ date: '日',
+ hour: '時',
+ minute: '分',
+ second: '秒',
+ am: '午前',
+ pm: '午後',
+ confirm: '確認',
+ cancel: 'キャンセル',
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ko.d.ts b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ko.d.ts
new file mode 100644
index 0000000..9665c2e
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ko.d.ts
@@ -0,0 +1,13 @@
+declare const _default: {
+ year: string;
+ month: string;
+ date: string;
+ hour: string;
+ minute: string;
+ second: string;
+ am: string;
+ pm: string;
+ confirm: string;
+ cancel: string;
+};
+export default _default;
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ko.js b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ko.js
new file mode 100644
index 0000000..1a9a214
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ko.js
@@ -0,0 +1,12 @@
+export default {
+ year: '년',
+ month: '월',
+ date: '일',
+ hour: '시',
+ minute: '분',
+ second: '초',
+ am: '오전',
+ pm: '오후',
+ confirm: '확인',
+ cancel: '취소',
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ru.d.ts b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ru.d.ts
new file mode 100644
index 0000000..9665c2e
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ru.d.ts
@@ -0,0 +1,13 @@
+declare const _default: {
+ year: string;
+ month: string;
+ date: string;
+ hour: string;
+ minute: string;
+ second: string;
+ am: string;
+ pm: string;
+ confirm: string;
+ cancel: string;
+};
+export default _default;
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ru.js b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ru.js
new file mode 100644
index 0000000..ced8fc2
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/ru.js
@@ -0,0 +1,12 @@
+export default {
+ year: '',
+ month: '',
+ date: '',
+ hour: '',
+ minute: '',
+ second: '',
+ am: 'до полудня',
+ pm: 'после полудня',
+ confirm: 'подтвердить',
+ cancel: 'отменить',
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/tc.d.ts b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/tc.d.ts
new file mode 100644
index 0000000..9665c2e
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/tc.d.ts
@@ -0,0 +1,13 @@
+declare const _default: {
+ year: string;
+ month: string;
+ date: string;
+ hour: string;
+ minute: string;
+ second: string;
+ am: string;
+ pm: string;
+ confirm: string;
+ cancel: string;
+};
+export default _default;
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/tc.js b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/tc.js
new file mode 100644
index 0000000..78a4a4b
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/locale/tc.js
@@ -0,0 +1,12 @@
+export default {
+ year: '年',
+ month: '月',
+ date: '日',
+ hour: '時',
+ minute: '分',
+ second: '秒',
+ am: '上午',
+ pm: '下午',
+ confirm: '確定',
+ cancel: '取消',
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/props.js b/miniprogram_npm/tdesign-miniprogram/date-time-picker/props.js
index d911d56..53688c2 100644
--- a/miniprogram_npm/tdesign-miniprogram/date-time-picker/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/props.js
@@ -1,21 +1,32 @@
const props = {
+ autoClose: {
+ type: Boolean,
+ value: false,
+ },
cancelBtn: {
type: String,
- value: '',
+ value: '取消',
},
confirmBtn: {
type: String,
value: '',
},
+ customLocale: {
+ type: String,
+ value: 'zh',
+ },
end: {
type: null,
},
externalClasses: {
type: Array,
},
+ filter: {
+ type: null,
+ },
format: {
type: String,
- value: '',
+ value: 'YYYY-MM-DD HH:mm:ss',
},
header: {
type: Boolean,
@@ -25,6 +36,10 @@ const props = {
type: null,
value: 'date',
},
+ popupProps: {
+ type: Object,
+ value: {},
+ },
showWeek: {
type: Boolean,
value: false,
@@ -32,10 +47,17 @@ const props = {
start: {
type: null,
},
+ steps: {
+ type: Object,
+ },
title: {
type: String,
value: '',
},
+ usePopup: {
+ type: Boolean,
+ value: true,
+ },
value: {
type: null,
value: null,
diff --git a/miniprogram_npm/tdesign-miniprogram/date-time-picker/type.d.ts b/miniprogram_npm/tdesign-miniprogram/date-time-picker/type.d.ts
index ac95634..55aaa06 100644
--- a/miniprogram_npm/tdesign-miniprogram/date-time-picker/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/date-time-picker/type.d.ts
@@ -1,4 +1,9 @@
+import { PopupProps } from '../popup/index';
export interface TdDateTimePickerProps {
+ autoClose?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
cancelBtn?: {
type: StringConstructor;
value?: string;
@@ -7,6 +12,10 @@ export interface TdDateTimePickerProps {
type: StringConstructor;
value?: string;
};
+ customLocale?: {
+ type: StringConstructor;
+ value?: string;
+ };
end?: {
type: null;
value?: string | number;
@@ -15,6 +24,10 @@ export interface TdDateTimePickerProps {
type: ArrayConstructor;
value?: ['t-class', 't-class-confirm', 't-class-cancel', 't-class-title'];
};
+ filter?: {
+ type: undefined;
+ value?: (type: TimeModeValues, columns: DateTimePickerColumn) => DateTimePickerColumn;
+ };
format?: {
type: StringConstructor;
value?: string;
@@ -27,6 +40,10 @@ export interface TdDateTimePickerProps {
type: null;
value?: DateTimePickerMode;
};
+ popupProps?: {
+ type: ObjectConstructor;
+ value?: PopupProps;
+ };
showWeek?: {
type: BooleanConstructor;
value?: boolean;
@@ -35,10 +52,18 @@ export interface TdDateTimePickerProps {
type: null;
value?: string | number;
};
+ steps?: {
+ type: ObjectConstructor;
+ value?: object;
+ };
title?: {
type: StringConstructor;
value?: string;
};
+ usePopup?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
value?: {
type: null;
value?: DateValue;
@@ -52,6 +77,11 @@ export interface TdDateTimePickerProps {
value?: boolean;
};
}
+export declare type DateTimePickerColumn = DateTimePickerColumnItem[];
+export interface DateTimePickerColumnItem {
+ label: string;
+ value: string;
+}
export declare type DateTimePickerMode = TimeModeValues | Array;
export declare type TimeModeValues = 'year' | 'month' | 'date' | 'hour' | 'minute' | 'second';
export declare type DateValue = string | number;
diff --git a/miniprogram_npm/tdesign-miniprogram/dialog/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/dialog/README.en-US.md
index 2afa1bf..620da0a 100644
--- a/miniprogram_npm/tdesign-miniprogram/dialog/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/dialog/README.en-US.md
@@ -1,22 +1,25 @@
:: BASE_DOC ::
## API
+
### Dialog Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
actions | Array / Slot | - | Typescript:`Array`,[Button API Documents](./button?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/dialog/type.ts) | N
-button-layout | String | horizontal | options:horizontal/vertical | N
-cancel-btn | String / Object / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/dialog/type.ts) | N
-close-btn | Boolean / Object | false | `0.31.0` | N
-close-on-overlay-click | Boolean | undefined | \- | N
-confirm-btn | String / Object / Slot | - | \- | N
-content | String / Slot | - | \- | N
-external-classes | Array | - | `['t-class', 't-class-content', 't-class-confirm', 't-class-cancel']` | N
-overlay-props | Object | {} | \- | N
+button-layout | String | horizontal | options: horizontal/vertical | N
+cancel-btn | String / Object / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/dialog/type.ts) | N
+close-btn | Boolean / Object | false | `0.31.0`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/dialog/type.ts) | N
+close-on-overlay-click | Boolean | false | \- | N
+confirm-btn | String / Object / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+content | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+overlay-props | Object | {} | Typescript:`OverlayProps`,[Overlay API Documents](./overlay?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/dialog/type.ts) | N
prevent-scroll-through | Boolean | true | \- | N
show-overlay | Boolean | true | \- | N
-title | String / Slot | - | \- | N
+title | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+using-custom-navbar | Boolean | false | \- | N
visible | Boolean | - | \- | N
z-index | Number | 11500 | \- | N
@@ -28,3 +31,27 @@ cancel | - | \-
close | `(trigger: DialogEventSource)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/dialog/type.ts)。
`type DialogEventSource = 'cancel' \| 'overlay' \| 'close-btn'`
confirm | - | \-
overlay-click | - | \-
+### Dialog External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-action | \-
+t-class-cancel | \-
+t-class-confirm | \-
+t-class-content | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-dialog-body-max-height | 912rpx | -
+--td-dialog-close-color | @font-gray-3 | -
+--td-dialog-content-color | @font-gray-2 | -
+--td-dialog-content-font-size | 32rpx | -
+--td-dialog-content-line-height | 48rpx | -
+--td-dialog-title-color | @font-gray-1 | -
+--td-dialog-title-font-size | 36rpx | -
+--td-dialog-title-line-height | 52rpx | -
+--td-dialog-width | 622rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/dialog/README.md b/miniprogram_npm/tdesign-miniprogram/dialog/README.md
index f0192d4..259bc8d 100644
--- a/miniprogram_npm/tdesign-miniprogram/dialog/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/dialog/README.md
@@ -18,9 +18,16 @@ isComponent: true
## 代码演示
-按钮的样式,默认使用 `variant = text`,如果任意按钮改变了 `variant`,那么全部按钮都改变成这个。
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
### 组件类型
+
+按钮的样式,默认使用 `variant = text`,如果任意按钮改变了 `variant`,那么全部按钮都改变成这个。
+
#### 反馈类对话框
{{ base }}
@@ -48,29 +55,32 @@ isComponent: true
{{ command }}
-#### 开发能力按钮
+#### 开放能力按钮
当传入的按钮类型为对象时,整个对象都将透传至 `t-button`,因此按钮可以直接使用开放能力
{{ button }}
## API
+
### Dialog Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
actions | Array / Slot | - | 操作栏。TS 类型:`Array`,[Button API Documents](./button?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/dialog/type.ts) | N
button-layout | String | horizontal | 多按钮排列方式。可选项:horizontal/vertical | N
-cancel-btn | String / Object / Slot | - | 取消按钮,可自定义。值为 null 则不显示取消按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 Slot 自定义按钮时,需自行控制取消事件。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/dialog/type.ts) | N
-close-btn | Boolean / Object | false | `0.31.0`。是否展示关闭按钮,值为 `true` 显示默认关闭按钮;值为 `false` 则不显示关闭按钮;使用 Object 时透传至图标组件 | N
-close-on-overlay-click | Boolean | undefined | 点击蒙层时是否触发关闭事件 | N
-confirm-btn | String / Object / Slot | - | 确认按钮。值为 null 则不显示确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 Slot 自定义按钮时,需自行控制确认事件 | N
-content | String / Slot | - | 内容 | N
-external-classes | Array | - | 组件类名,分别用于设置 组件外层元素、组件内容部分、确认按钮、取消按钮 等元素类名。`['t-class', 't-class-content', 't-class-confirm', 't-class-cancel']` | N
-overlay-props | Object | {} | 透传至 Overlay 组件 | N
+cancel-btn | String / Object / Slot | - | 取消按钮,可自定义。值为 null 则不显示取消按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 Slot 自定义按钮时,需自行控制取消事件。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/dialog/type.ts) | N
+close-btn | Boolean / Object | false | `0.31.0`。是否展示关闭按钮,值为 `true` 显示默认关闭按钮;值为 `false` 则不显示关闭按钮;使用 Object 时透传至图标组件。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/dialog/type.ts) | N
+close-on-overlay-click | Boolean | false | 点击蒙层时是否触发关闭事件 | N
+confirm-btn | String / Object / Slot | - | 确认按钮。值为 null 则不显示确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 Slot 自定义按钮时,需自行控制确认事件。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+content | String / Slot | - | 内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+overlay-props | Object | {} | 透传至 Overlay 组件。TS 类型:`OverlayProps`,[Overlay API Documents](./overlay?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/dialog/type.ts) | N
prevent-scroll-through | Boolean | true | 防止滚动穿透 | N
show-overlay | Boolean | true | 是否显示遮罩层 | N
-title | String / Slot | - | 标题 | N
+title | String / Slot | - | 标题。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+using-custom-navbar | Boolean | false | 是否使用了自定义导航栏 | N
visible | Boolean | - | 控制对话框是否显示 | N
z-index | Number | 11500 | 对话框层级,Web 侧样式默认为 2500,移动端样式默认 2500,小程序样式默认为 11500 | N
@@ -82,3 +92,27 @@ cancel | - | 如果“取消”按钮存在,则点击“取消”按钮时触
close | `(trigger: DialogEventSource)` | 关闭事件,点击 取消按钮 或 点击蒙层 时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/dialog/type.ts)。
`type DialogEventSource = 'cancel' \| 'overlay' \| 'close-btn'`
confirm | - | 如果“确认”按钮存在,则点击“确认”按钮时触发
overlay-click | - | 如果蒙层存在,点击蒙层时触发
+### Dialog External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-action | 操作样式类
+t-class-cancel | 取消样式类
+t-class-confirm | 确认样式类
+t-class-content | 内容样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-dialog-body-max-height | 912rpx | -
+--td-dialog-close-color | @font-gray-3 | -
+--td-dialog-content-color | @font-gray-2 | -
+--td-dialog-content-font-size | 32rpx | -
+--td-dialog-content-line-height | 48rpx | -
+--td-dialog-title-color | @font-gray-1 | -
+--td-dialog-title-font-size | 36rpx | -
+--td-dialog-title-line-height | 52rpx | -
+--td-dialog-width | 622rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/dialog/dialog.d.ts b/miniprogram_npm/tdesign-miniprogram/dialog/dialog.d.ts
index b2771b4..4efa470 100644
--- a/miniprogram_npm/tdesign-miniprogram/dialog/dialog.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/dialog/dialog.d.ts
@@ -1,8 +1,8 @@
import { SuperComponent } from '../common/src/index';
export default class Dialog extends SuperComponent {
+ behaviors: string[];
options: {
multipleSlots: boolean;
- addGlobalClass: boolean;
};
externalClasses: string[];
properties: import("./type").TdDialogProps;
diff --git a/miniprogram_npm/tdesign-miniprogram/dialog/dialog.js b/miniprogram_npm/tdesign-miniprogram/dialog/dialog.js
index 367ceb5..fe22be7 100644
--- a/miniprogram_npm/tdesign-miniprogram/dialog/dialog.js
+++ b/miniprogram_npm/tdesign-miniprogram/dialog/dialog.js
@@ -8,14 +8,15 @@ import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
import { isObject, toCamel } from '../common/utils';
+import useCustomNavbar from '../mixins/using-custom-navbar';
const { prefix } = config;
const name = `${prefix}-dialog`;
let Dialog = class Dialog extends SuperComponent {
constructor() {
super(...arguments);
+ this.behaviors = [useCustomNavbar];
this.options = {
multipleSlots: true,
- addGlobalClass: true,
};
this.externalClasses = [
`${prefix}-class`,
@@ -53,6 +54,7 @@ let Dialog = class Dialog extends SuperComponent {
class: [...cls, `${classPrefix}__button--${key}`],
externalClass: [...externalCls, `${prefix}-class-${key}`],
variant: rect.buttonVariant,
+ openType: '',
};
if (key === 'cancel' && rect.buttonVariant === 'base') {
base.theme = 'light';
@@ -63,13 +65,16 @@ let Dialog = class Dialog extends SuperComponent {
else if (btn && typeof btn === 'object') {
rect[`_${key}`] = Object.assign(Object.assign({}, base), btn);
}
+ else {
+ rect[`_${key}`] = null;
+ }
});
this.setData(Object.assign({}, rect));
},
};
this.methods = {
onTplButtonTap(e) {
- var _a, _b;
+ var _a, _b, _c;
const evtType = e.type;
const { type, extra } = e.target.dataset;
const button = this.data[`_${type}`];
@@ -84,12 +89,12 @@ let Dialog = class Dialog extends SuperComponent {
this.close();
}
}
- const hasOpenType = 'openType' in button;
+ const hasOpenType = !!button.openType;
if (!hasOpenType && ['confirm', 'cancel'].includes(type)) {
(_a = this[toCamel(`on-${type}`)]) === null || _a === void 0 ? void 0 : _a.call(this, type);
}
if (evtType !== 'tap') {
- const success = ((_b = e.detail) === null || _b === void 0 ? void 0 : _b.errMsg.indexOf('ok')) > -1;
+ const success = ((_c = (_b = e.detail) === null || _b === void 0 ? void 0 : _b.errMsg) === null || _c === void 0 ? void 0 : _c.indexOf('ok')) > -1;
this.triggerEvent(success ? 'open-type-event' : 'open-type-error-event', e.detail);
}
},
@@ -118,6 +123,7 @@ let Dialog = class Dialog extends SuperComponent {
overlayClick() {
if (this.properties.closeOnOverlayClick) {
this.triggerEvent('close', { trigger: 'overlay' });
+ this.close();
}
this.triggerEvent('overlay-click');
},
diff --git a/miniprogram_npm/tdesign-miniprogram/dialog/dialog.json b/miniprogram_npm/tdesign-miniprogram/dialog/dialog.json
index 5cfe889..95bed64 100644
--- a/miniprogram_npm/tdesign-miniprogram/dialog/dialog.json
+++ b/miniprogram_npm/tdesign-miniprogram/dialog/dialog.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-popup": "../popup/popup",
"t-icon": "../icon/icon",
diff --git a/miniprogram_npm/tdesign-miniprogram/dialog/dialog.wxml b/miniprogram_npm/tdesign-miniprogram/dialog/dialog.wxml
index 5609dde..5d52184 100644
--- a/miniprogram_npm/tdesign-miniprogram/dialog/dialog.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/dialog/dialog.wxml
@@ -15,13 +15,14 @@
overlayProps="{{overlayProps}}"
zIndex="{{zIndex}}"
placement="center"
+ usingCustomNavbar="{{usingCustomNavbar}}"
bind:visible-change="overlayClick"
>
-
+
diff --git a/miniprogram_npm/tdesign-miniprogram/dialog/dialog.wxss b/miniprogram_npm/tdesign-miniprogram/dialog/dialog.wxss
index b38380d..f036ea1 100644
--- a/miniprogram_npm/tdesign-miniprogram/dialog/dialog.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/dialog/dialog.wxss
@@ -35,10 +35,15 @@
position: absolute;
top: 16rpx;
right: 16rpx;
- color: var(--td-dialog-close-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-dialog-close-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
+ z-index: 1;
+ /* skyline适配新增 */
}
.t-dialog__content {
- padding: var(--td-spacer-4, 64rpx) var(--td-spacer-3, 48rpx) 0;
+ padding-top: var(--td-spacer-4, 64rpx);
+ padding-right: var(--td-spacer-3, 48rpx);
+ padding-bottom: 0;
+ padding-left: var(--td-spacer-3, 48rpx);
max-height: var(--td-dialog-body-max-height, 912rpx);
box-sizing: border-box;
display: flex;
@@ -51,7 +56,7 @@
font-weight: bold;
font-size: var(--td-dialog-title-font-size, 36rpx);
line-height: var(--td-dialog-title-line-height, 52rpx);
- color: var(--td-dialog-title-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-dialog-title-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-dialog__header + .t-dialog__body {
margin-top: 16rpx;
@@ -61,7 +66,7 @@
text-align: center;
-webkit-overflow-scrolling: touch;
font-size: var(--td-dialog-content-font-size, 32rpx);
- color: var(--td-dialog-content-color, var(--td-font-gray-2, rgba(0, 0, 0, 0.6)));
+ color: var(--td-dialog-content-color, var(--td-text-color-secondary, var(--td-font-gray-2, rgba(0, 0, 0, 0.6))));
line-height: var(--td-dialog-content-line-height, 48rpx);
}
.t-dialog__body-text {
@@ -111,8 +116,8 @@
box-sizing: border-box;
top: 0;
left: 0;
- border-top: 1px solid var(--td-border-color, var(--td-gray-color-3, #e7e7e7));
- border-left: 1px solid var(--td-border-color, var(--td-gray-color-3, #e7e7e7));
+ border-top: 1px solid var(--td-border-level-1-color, var(--td-gray-color-3, #e7e7e7));
+ border-left: 1px solid var(--td-border-level-1-color, var(--td-gray-color-3, #e7e7e7));
transform: scale(0.5);
transform-origin: 0 0;
width: 200%;
diff --git a/miniprogram_npm/tdesign-miniprogram/dialog/index.d.ts b/miniprogram_npm/tdesign-miniprogram/dialog/index.d.ts
index f0bacf1..46237f9 100644
--- a/miniprogram_npm/tdesign-miniprogram/dialog/index.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/dialog/index.d.ts
@@ -5,7 +5,7 @@ interface DialogAlertOptionsType {
context?: Context;
selector?: string;
title?: string;
- content: string;
+ content?: string;
zIndex?: number;
asyncClose?: boolean;
confirmButtonText?: string;
@@ -33,7 +33,7 @@ interface DialogActionOptionsType {
declare const _default: {
alert(options: DialogAlertOptionsType): Promise;
confirm(options: DialogConfirmOptionsType): Promise;
- close(options: DialogConfirmOptionsType): Promise;
+ close(options?: DialogConfirmOptionsType): Promise;
action(options: DialogActionOptionsType): Promise<{
index: number;
}>;
diff --git a/miniprogram_npm/tdesign-miniprogram/dialog/index.js b/miniprogram_npm/tdesign-miniprogram/dialog/index.js
index 36ccf63..4986b1f 100644
--- a/miniprogram_npm/tdesign-miniprogram/dialog/index.js
+++ b/miniprogram_npm/tdesign-miniprogram/dialog/index.js
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
import props from './props';
import { getInstance } from '../common/utils';
const defaultOptions = {
- actions: false,
+ actions: [],
buttonLayout: props.buttonLayout.value,
cancelBtn: props.cancelBtn.value,
closeOnOverlayClick: props.closeOnOverlayClick.value,
diff --git a/miniprogram_npm/tdesign-miniprogram/dialog/props.js b/miniprogram_npm/tdesign-miniprogram/dialog/props.js
index 656bbad..75472f4 100644
--- a/miniprogram_npm/tdesign-miniprogram/dialog/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/dialog/props.js
@@ -15,7 +15,7 @@ const props = {
},
closeOnOverlayClick: {
type: Boolean,
- value: undefined,
+ value: false,
},
confirmBtn: {
type: null,
@@ -38,6 +38,10 @@ const props = {
type: Boolean,
value: true,
},
+ style: {
+ type: String,
+ value: '',
+ },
title: {
type: String,
},
diff --git a/miniprogram_npm/tdesign-miniprogram/dialog/type.d.ts b/miniprogram_npm/tdesign-miniprogram/dialog/type.d.ts
index cb8107f..ef3c799 100644
--- a/miniprogram_npm/tdesign-miniprogram/dialog/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/dialog/type.d.ts
@@ -1,4 +1,5 @@
import { ButtonProps } from '../button/index';
+import { TdOverlayProps as OverlayProps } from '../overlay/type';
export interface TdDialogProps {
actions?: {
type: ArrayConstructor;
@@ -14,7 +15,7 @@ export interface TdDialogProps {
};
closeBtn?: {
type: null;
- value?: boolean | object;
+ value?: boolean | ButtonProps | null;
};
closeOnOverlayClick?: {
type: BooleanConstructor;
@@ -28,17 +29,13 @@ export interface TdDialogProps {
type: StringConstructor;
value?: string;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
externalClasses?: {
type: ArrayConstructor;
value?: ['t-class', 't-class-content', 't-class-confirm', 't-class-cancel'];
};
overlayProps?: {
type: ObjectConstructor;
- value?: object;
+ value?: OverlayProps;
};
preventScrollThrough?: {
type: BooleanConstructor;
@@ -48,10 +45,18 @@ export interface TdDialogProps {
type: BooleanConstructor;
value?: boolean;
};
+ style?: {
+ type: StringConstructor;
+ value?: string;
+ };
title?: {
type: StringConstructor;
value?: string;
};
+ usingCustomNavbar?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
visible?: {
type: BooleanConstructor;
value?: boolean;
diff --git a/miniprogram_npm/tdesign-miniprogram/divider/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/divider/README.en-US.md
index 51ac50e..08a4d5a 100644
--- a/miniprogram_npm/tdesign-miniprogram/divider/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/divider/README.en-US.md
@@ -1,12 +1,31 @@
:: BASE_DOC ::
## API
+
### Divider Props
name | type | default | description | required
-- | -- | -- | -- | --
-align | String | center | options:left/right/center | N
-content | String / Slot | - | \- | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+align | String | center | options: left/right/center | N
+content | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
dashed | Boolean | false | \- | N
-external-classes | Array | - | `['t-class', 't-class-line', 't-class-content']` | N
-layout | String | horizontal | options:horizontal/vertical | N
+layout | String | horizontal | options: horizontal/vertical | N
+### Divider External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-content | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-divider-color | @bg-color-component | -
+--td-divider-content-color | @font-gray-3 | -
+--td-divider-content-font-size | 24rpx | -
+--td-divider-content-line-height | 40rpx | -
+--td-divider-content-line-style | solid | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/divider/README.md b/miniprogram_npm/tdesign-miniprogram/divider/README.md
index a67dece..d567bcb 100644
--- a/miniprogram_npm/tdesign-miniprogram/divider/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/divider/README.md
@@ -18,6 +18,14 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
+
+
### 基础分割符
分割符主要是由直线和文字组成,通过`slot`传入分割线文案或者其他自定义内容,通过`layout`控制分隔符是垂直还是横向
@@ -29,12 +37,31 @@ isComponent: true
{{ theme }}
## API
+
### Divider Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
align | String | center | 文本位置(仅在水平分割线有效)。可选项:left/right/center | N
-content | String / Slot | - | 子元素 | N
+content | String / Slot | - | 子元素。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
dashed | Boolean | false | 是否虚线(仅在水平分割线有效) | N
-external-classes | Array | - | 组件类名,分别用于设置 组件外层类名、分隔线类名 等。`['t-class', 't-class-line', 't-class-content']` | N
layout | String | horizontal | 分隔线类型有两种:水平和垂直。可选项:horizontal/vertical | N
+### Divider External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-content | 内容样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-divider-color | @bg-color-component | -
+--td-divider-content-color | @font-gray-3 | -
+--td-divider-content-font-size | 24rpx | -
+--td-divider-content-line-height | 40rpx | -
+--td-divider-content-line-style | solid | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/divider/divider.d.ts b/miniprogram_npm/tdesign-miniprogram/divider/divider.d.ts
index d7b8209..d4d837c 100644
--- a/miniprogram_npm/tdesign-miniprogram/divider/divider.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/divider/divider.d.ts
@@ -2,7 +2,6 @@ import { SuperComponent } from '../common/src/index';
export default class Divider extends SuperComponent {
externalClasses: string[];
options: {
- addGlobalClass: boolean;
multipleSlots: boolean;
};
properties: import("./type").TdDividerProps;
diff --git a/miniprogram_npm/tdesign-miniprogram/divider/divider.js b/miniprogram_npm/tdesign-miniprogram/divider/divider.js
index bedaafb..7e3247d 100644
--- a/miniprogram_npm/tdesign-miniprogram/divider/divider.js
+++ b/miniprogram_npm/tdesign-miniprogram/divider/divider.js
@@ -14,7 +14,6 @@ let Divider = class Divider extends SuperComponent {
super(...arguments);
this.externalClasses = [`${prefix}-class`, `${prefix}-class-content`];
this.options = {
- addGlobalClass: true,
multipleSlots: true,
};
this.properties = props;
diff --git a/miniprogram_npm/tdesign-miniprogram/divider/divider.json b/miniprogram_npm/tdesign-miniprogram/divider/divider.json
index 467ce29..79f2730 100644
--- a/miniprogram_npm/tdesign-miniprogram/divider/divider.json
+++ b/miniprogram_npm/tdesign-miniprogram/divider/divider.json
@@ -1,3 +1,4 @@
{
- "component": true
+ "component": true,
+ "styleIsolation": "apply-shared"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/divider/divider.wxml b/miniprogram_npm/tdesign-miniprogram/divider/divider.wxml
index 5f1fa88..fb83e6b 100644
--- a/miniprogram_npm/tdesign-miniprogram/divider/divider.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/divider/divider.wxml
@@ -1,8 +1,8 @@
-
+
diff --git a/miniprogram_npm/tdesign-miniprogram/divider/divider.wxss b/miniprogram_npm/tdesign-miniprogram/divider/divider.wxss
index abfddca..28433f3 100644
--- a/miniprogram_npm/tdesign-miniprogram/divider/divider.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/divider/divider.wxss
@@ -29,7 +29,7 @@
display: flex;
color: var(--td-divider-color, var(--td-bg-color-component, var(--td-gray-color-3, #e7e7e7)));
border-color: var(--td-divider-color, var(--td-bg-color-component, var(--td-gray-color-3, #e7e7e7)));
- border-style: solid;
+ border-style: var(--td-divider-content-line-style, solid);
border-width: 0;
}
.t-divider::before,
@@ -51,19 +51,21 @@
.t-divider--horizontal::after {
border-top-width: 1px;
transform: scaleY(0.5);
+ transform-origin: bottom;
}
.t-divider--horizontal .t-divider__content:not(:empty) {
margin: 0 24rpx;
}
.t-divider--vertical {
flex-direction: column;
- height: 1em;
+ height: 28rpx;
margin: 0 16rpx;
}
.t-divider--vertical::before,
.t-divider--vertical::after {
border-left-width: 1px;
transform: scaleX(0.5);
+ transform-origin: bottom;
}
.t-divider--vertical-center {
align-items: center;
@@ -75,7 +77,7 @@
.t-divider__content {
font-size: var(--td-divider-content-font-size, 24rpx);
line-height: var(--td-divider-content-line-height, 40rpx);
- color: var(--td-divider-content-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-divider-content-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
}
.t-divider--left::before,
.t-divider--right::after {
diff --git a/miniprogram_npm/tdesign-miniprogram/divider/props.js b/miniprogram_npm/tdesign-miniprogram/divider/props.js
index e8d8a73..395a3aa 100644
--- a/miniprogram_npm/tdesign-miniprogram/divider/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/divider/props.js
@@ -6,17 +6,10 @@ const props = {
content: {
type: String,
},
- style: {
- type: String,
- value: '',
- },
dashed: {
type: Boolean,
value: false,
},
- externalClasses: {
- type: Array,
- },
layout: {
type: String,
value: 'horizontal',
diff --git a/miniprogram_npm/tdesign-miniprogram/divider/type.d.ts b/miniprogram_npm/tdesign-miniprogram/divider/type.d.ts
index faed054..424a7b2 100644
--- a/miniprogram_npm/tdesign-miniprogram/divider/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/divider/type.d.ts
@@ -7,18 +7,10 @@ export interface TdDividerProps {
type: StringConstructor;
value?: string;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
dashed?: {
type: BooleanConstructor;
value?: boolean;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-line', 't-class-content'];
- };
layout?: {
type: StringConstructor;
value?: 'horizontal' | 'vertical';
diff --git a/miniprogram_npm/tdesign-miniprogram/drawer/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/drawer/README.en-US.md
index 555fff0..6504ced 100644
--- a/miniprogram_npm/tdesign-miniprogram/drawer/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/drawer/README.en-US.md
@@ -1,17 +1,21 @@
:: BASE_DOC ::
## API
+
### Drawer Props
name | type | default | description | required
-- | -- | -- | -- | --
-close-on-overlay-click | Boolean | undefined | \- | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+close-on-overlay-click | Boolean | true | \- | N
destroy-on-close | Boolean | false | \- | N
-footer | Slot | - | `0.29.0` | N
-items | Array | - | Typescript:`DrawerItem[] ` `interface DrawerItem { title: string; icon: string; }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/drawer/type.ts) | N
-placement | String | right | options:left/right | N
+footer | Slot | - | `0.29.0`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+items | Array | - | Typescript:`DrawerItem[] ` `interface DrawerItem { title: string; icon: string; }。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/drawer/type.ts)`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/drawer/type.ts) | N
+placement | String | right | options: left/right | N
show-overlay | Boolean | true | \- | N
-title | String / Slot | - | `0.29.0` | N
+title | String / Slot | - | `0.29.0`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+using-custom-navbar | Boolean | false | \- | N
visible | Boolean | false | \- | N
z-index | Number | 11500 | \- | N
@@ -19,6 +23,25 @@ z-index | Number | 11500 | \- | N
name | params | description
-- | -- | --
-close | `(trigger: TriggerSource)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/drawer/type.ts)。
`type TriggerSource = 'overlay'`
+close | `(trigger: TriggerSource)` | \-
item-click | `(index: number; item: DrawerItem)` | \-
overlay-click | \- | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-drawer-bg-color | @bg-color-container | -
+--td-drawer-border-color | @border-color | -
+--td-drawer-footer-padding-bottom | 40rpx | -
+--td-drawer-hover-color | @bg-color-secondarycontainer | -
+--td-drawer-item-icon-color | @drawer-title-color
+--td-drawer-item-height | 48rpx | -
+--td-drawer-item-icon-size | 48rpx | -
+--td-drawer-item-padding | 32rpx | -
+--td-drawer-sidebar-height | 70vh | -
+--td-drawer-title-color | @font-gray-1 | -
+--td-drawer-title-font-size | 36rpx | -
+--td-drawer-title-padding | 48rpx 32rpx 16rpx | -
+--td-drawer-width | 560rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/drawer/README.md b/miniprogram_npm/tdesign-miniprogram/drawer/README.md
index 2c04c10..c5fd96f 100644
--- a/miniprogram_npm/tdesign-miniprogram/drawer/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/drawer/README.md
@@ -26,6 +26,13 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
+
### 基础抽屉
{{ base }}
@@ -37,17 +44,21 @@ isComponent: true
## API
+
### Drawer Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
close-on-overlay-click | Boolean | true | 点击蒙层时是否触发抽屉关闭事件 | N
destroy-on-close | Boolean | false | 抽屉关闭时是否销毁节点 | N
-footer | Slot | - | `0.29.0`。抽屉的底部 | N
-items | Array | - | 抽屉里的列表项。TS 类型:`DrawerItem[] ` `interface DrawerItem { title: string; icon: string; }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/drawer/type.ts) | N
+footer | Slot | - | `0.29.0`。抽屉的底部。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+items | Array | - | 抽屉里的列表项。TS 类型:`DrawerItem[] ` `interface DrawerItem { title: string; icon: string; }。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/drawer/type.ts)`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/drawer/type.ts) | N
placement | String | right | 抽屉方向。可选项:left/right | N
show-overlay | Boolean | true | 是否显示遮罩层 | N
-title | String / Slot | - | `0.29.0`。抽屉的标题 | N
+title | String / Slot | - | `0.29.0`。抽屉的标题。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+using-custom-navbar | Boolean | false | 是否使用了自定义导航栏 | N
visible | Boolean | false | 组件是否可见 | N
z-index | Number | 11500 | 抽屉层级,样式默认为 11500 | N
@@ -58,3 +69,22 @@ z-index | Number | 11500 | 抽屉层级,样式默认为 11500 | N
close | `(trigger: TriggerSource)` | 关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/drawer/type.ts)。
`type TriggerSource = 'overlay'`
item-click | `(index: number; item: DrawerItem)` | 点击抽屉里的列表项
overlay-click | \- | 如果蒙层存在,点击蒙层时触发
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-drawer-bg-color | @bg-color-container | -
+--td-drawer-border-color | @border-color | -
+--td-drawer-footer-padding-bottom | 40rpx | -
+--td-drawer-hover-color | @bg-color-secondarycontainer | -
+--td-drawer-item-icon-color | @drawer-title-color
+--td-drawer-item-height | 48rpx | -
+--td-drawer-item-icon-size | 48rpx | -
+--td-drawer-item-padding | 32rpx | -
+--td-drawer-sidebar-height | 70vh | -
+--td-drawer-title-color | @font-gray-1 | -
+--td-drawer-title-font-size | 36rpx | -
+--td-drawer-title-padding | 48rpx 32rpx 16rpx | -
+--td-drawer-width | 560rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/drawer/drawer.d.ts b/miniprogram_npm/tdesign-miniprogram/drawer/drawer.d.ts
index fd81c85..22932ab 100644
--- a/miniprogram_npm/tdesign-miniprogram/drawer/drawer.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/drawer/drawer.d.ts
@@ -1,5 +1,6 @@
import { ComponentsOptionsType, SuperComponent } from '../common/src/index';
export default class Drawer extends SuperComponent {
+ behaviors: string[];
externalClasses: any[];
options: ComponentsOptionsType;
properties: import("./type").TdDrawerProps;
diff --git a/miniprogram_npm/tdesign-miniprogram/drawer/drawer.js b/miniprogram_npm/tdesign-miniprogram/drawer/drawer.js
index 98b0f93..74d8f3d 100644
--- a/miniprogram_npm/tdesign-miniprogram/drawer/drawer.js
+++ b/miniprogram_npm/tdesign-miniprogram/drawer/drawer.js
@@ -7,11 +7,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
+import useCustomNavbar from '../mixins/using-custom-navbar';
const { prefix } = config;
const name = `${prefix}-drawer`;
let Drawer = class Drawer extends SuperComponent {
constructor() {
super(...arguments);
+ this.behaviors = [useCustomNavbar];
this.externalClasses = [];
this.options = {
multipleSlots: true,
@@ -36,9 +38,7 @@ let Drawer = class Drawer extends SuperComponent {
},
itemClick(detail) {
const { index, item } = detail.currentTarget.dataset;
- this.triggerEvent('item-click', {
- sibarItem: { index: index, item: item },
- });
+ this.triggerEvent('item-click', { index, item });
},
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/drawer/drawer.json b/miniprogram_npm/tdesign-miniprogram/drawer/drawer.json
index 95a2238..4d58963 100644
--- a/miniprogram_npm/tdesign-miniprogram/drawer/drawer.json
+++ b/miniprogram_npm/tdesign-miniprogram/drawer/drawer.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-popup": "../popup/popup",
"t-icon": "../icon/icon"
diff --git a/miniprogram_npm/tdesign-miniprogram/drawer/drawer.wxml b/miniprogram_npm/tdesign-miniprogram/drawer/drawer.wxml
index 026f800..a7ff8ac 100644
--- a/miniprogram_npm/tdesign-miniprogram/drawer/drawer.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/drawer/drawer.wxml
@@ -1,24 +1,24 @@
{{title}}
-
-
## API
+
### Image Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-error | String / Slot | 'default' | 加载失败时显示的内容。值为 `default` 则表示使用默认加载失败风格;值为空或者 `slot` 表示使用插槽渲染,插槽名称为 `error`;值为其他则表示普通文本内容,如“加载失败” | N
-external-classes | Array | - | 组件类名,分别用于设置加载组件外层元素,中间内容等元素类名。`['t-class', 't-class-load']` | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+error | String / Slot | 'default' | 加载失败时显示的内容。值为 `default` 则表示使用默认加载失败风格;值为空或者 `slot` 表示使用插槽渲染,插槽名称为 `error`;值为其他则表示普通文本内容,如“加载失败”。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
height | String / Number | - | 高度,默认单位为`px` | N
lazy | Boolean | false | 是否开启图片懒加载 | N
-loading | String / Slot | 'default' | 加载态内容。值为 `default` 则表示使用默认加载中风格;值为空或者 `slot` 表示使用插槽渲染,插槽名称为 `loading`;值为其他则表示普通文本内容,如“加载中” | N
+loading | String / Slot | 'default' | 加载态内容。值为 `default` 则表示使用默认加载中风格;值为其他则表示普通文本内容,如“加载中”。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
mode | String | scaleToFill | 图片裁剪、缩放的模式;[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/image.html)。可选项:scaleToFill/aspectFit/aspectFill/widthFix/heightFix/top/bottom/center/left/right/top left/top right/bottom left/bottom right | N
shape | String | square | 图片圆角类型。可选项:circle/round/square | N
show-menu-by-longpress | Boolean | false | 长按图片显示发送给朋友、收藏、保存图片、搜一搜、打开名片/前往群聊/打开小程序(若图片中包含对应二维码或小程序码)的菜单。 | N
src | String | - | 图片链接 | N
+t-id | String | - | `1.2.10`。图片标签id | N
webp | Boolean | false | 默认不解析 webP 格式,只支持网络资源 | N
width | String / Number | - | 宽度,默认单位为`px` | N
@@ -61,5 +69,23 @@ width | String / Number | - | 宽度,默认单位为`px` | N
名称 | 参数 | 描述
-- | -- | --
-error | \- | 图片加载失败时触发
-load | \- | 图片加载完成时触发
+error | - | 图片加载失败时触发
+load | - | 图片加载完成时触发
+### Image External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-load | 加载样式类
+t-class-image | 图片样式类
+t-class-error | 加载失败样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-image-color | @font-gray-3 | -
+--td-image-loading-bg-color | @bg-color-secondarycontainer | -
+--td-image-loading-color | @font-gray-3 | -
+--td-image-round-radius | @radius-default | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/image/image.d.ts b/miniprogram_npm/tdesign-miniprogram/image/image.d.ts
index e86224a..80f4bf2 100644
--- a/miniprogram_npm/tdesign-miniprogram/image/image.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/image/image.d.ts
@@ -13,15 +13,14 @@ export default class Image extends SuperComponent {
classPrefix: string;
};
preSrc: string;
- lifetimes: {
- attached(): void;
- };
observers: {
src(): void;
+ 'width, height'(width: any, height: any): void;
};
methods: {
onLoaded(e: any): void;
onLoadError(e: any): void;
+ calcSize(width: any, height: any): void;
update(): void;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/image/image.js b/miniprogram_npm/tdesign-miniprogram/image/image.js
index d832d1e..0cc93ca 100644
--- a/miniprogram_npm/tdesign-miniprogram/image/image.js
+++ b/miniprogram_npm/tdesign-miniprogram/image/image.js
@@ -7,13 +7,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
import { SuperComponent, wxComponent } from '../common/src/index';
import ImageProps from './props';
import config from '../common/config';
-import { addUnit, getRect } from '../common/utils';
+import { addUnit, getRect, appBaseInfo } from '../common/utils';
+import { compareVersion } from '../common/version';
const { prefix } = config;
const name = `${prefix}-image`;
let Image = class Image extends SuperComponent {
constructor() {
super(...arguments);
- this.externalClasses = [`${prefix}-class`, `${prefix}-class-load`];
+ this.externalClasses = [`${prefix}-class`, `${prefix}-class-load`, `${prefix}-class-image`, `${prefix}-class-error`];
this.options = {
multipleSlots: true,
};
@@ -26,40 +27,24 @@ let Image = class Image extends SuperComponent {
classPrefix: name,
};
this.preSrc = '';
- this.lifetimes = {
- attached() {
- const { width, height } = this.data;
- let innerStyle = '';
- this.update();
- if (width) {
- innerStyle += `width: ${addUnit(width)};`;
- }
- if (height) {
- innerStyle += `height: ${addUnit(height)};`;
- }
- this.setData({
- innerStyle,
- });
- },
- };
this.observers = {
src() {
if (this.preSrc === this.properties.src)
return;
this.update();
},
+ 'width, height'(width, height) {
+ this.calcSize(width, height);
+ },
};
this.methods = {
onLoaded(e) {
- const sdkVersion = wx.getSystemInfoSync().SDKVersion;
- const versionArray = sdkVersion.split('.').map((v) => parseInt(v, 10));
- const { mode } = this.properties;
- const isInCompatible = versionArray[0] < 2 ||
- (versionArray[0] === 2 && versionArray[1] < 10) ||
- (versionArray[0] === 2 && versionArray[1] === 10 && versionArray[2] < 3);
+ const sdkVersion = appBaseInfo.SDKVersion;
+ const { mode, tId } = this.properties;
+ const isInCompatible = compareVersion(sdkVersion, '2.10.3') < 0;
if (mode === 'heightFix' && isInCompatible) {
const { height: picHeight, width: picWidth } = e.detail;
- getRect(this, '#image').then((rect) => {
+ getRect(this, `#${tId || 'image'}`).then((rect) => {
const { height } = rect;
const resultWidth = ((height / picHeight) * picWidth).toFixed(2);
this.setData({ innerStyle: `height: ${addUnit(height)}; width: ${resultWidth}px;` });
@@ -78,6 +63,18 @@ let Image = class Image extends SuperComponent {
});
this.triggerEvent('error', e.detail);
},
+ calcSize(width, height) {
+ let innerStyle = '';
+ if (width) {
+ innerStyle += `width: ${addUnit(width)};`;
+ }
+ if (height) {
+ innerStyle += `height: ${addUnit(height)};`;
+ }
+ this.setData({
+ innerStyle,
+ });
+ },
update() {
const { src } = this.properties;
this.preSrc = src;
diff --git a/miniprogram_npm/tdesign-miniprogram/image/image.json b/miniprogram_npm/tdesign-miniprogram/image/image.json
index 5de7a66..1c9137b 100644
--- a/miniprogram_npm/tdesign-miniprogram/image/image.json
+++ b/miniprogram_npm/tdesign-miniprogram/image/image.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-loading": "../loading/loading",
"t-icon": "../icon/icon"
diff --git a/miniprogram_npm/tdesign-miniprogram/image/image.wxml b/miniprogram_npm/tdesign-miniprogram/image/image.wxml
index bde7038..be3b850 100644
--- a/miniprogram_npm/tdesign-miniprogram/image/image.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/image/image.wxml
@@ -1,52 +1,56 @@
-
-
-
-
- {{loading}}
+
+
+
+
+
+ {{loading}}
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+ {{error}}
+
+
- {{error}}
-
+
+
-
-
diff --git a/miniprogram_npm/tdesign-miniprogram/image/image.wxss b/miniprogram_npm/tdesign-miniprogram/image/image.wxss
index 1a3c3e1..7d550a0 100644
--- a/miniprogram_npm/tdesign-miniprogram/image/image.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/image/image.wxss
@@ -26,15 +26,22 @@
transform: scale(1.5);
}
.t-image {
- color: var(--td-image-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ position: relative;
+ display: inline-block;
+}
+.t-image__mask,
+.t-image__img {
+ color: var(--td-image-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
vertical-align: top;
+ width: inherit;
+ height: inherit;
}
.t-image__mask {
display: flex;
align-items: center;
justify-content: center;
background-color: var(--td-image-loading-bg-color, var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3)));
- color: var(--td-image-loading-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-image-loading-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
}
.t-image--loading-text {
width: 0;
@@ -44,6 +51,12 @@
width: 100%;
height: 100%;
}
+.t-image--lazy {
+ position: absolute;
+ top: 0;
+ left: 0;
+ z-index: -1;
+}
.t-image--shape-circle {
border-radius: 50%;
overflow: hidden;
diff --git a/miniprogram_npm/tdesign-miniprogram/image/props.js b/miniprogram_npm/tdesign-miniprogram/image/props.js
index 595db41..b2a17da 100644
--- a/miniprogram_npm/tdesign-miniprogram/image/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/image/props.js
@@ -3,9 +3,6 @@ const props = {
type: String,
value: 'default',
},
- externalClasses: {
- type: Array,
- },
height: {
type: null,
},
@@ -33,6 +30,10 @@ const props = {
type: String,
value: '',
},
+ tId: {
+ type: String,
+ value: '',
+ },
webp: {
type: Boolean,
value: false,
diff --git a/miniprogram_npm/tdesign-miniprogram/image/type.d.ts b/miniprogram_npm/tdesign-miniprogram/image/type.d.ts
index 09a454f..4279319 100644
--- a/miniprogram_npm/tdesign-miniprogram/image/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/image/type.d.ts
@@ -1,16 +1,8 @@
export interface TdImageProps {
- style?: {
- type: StringConstructor;
- value?: string;
- };
error?: {
type: StringConstructor;
value?: string;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-load'];
- };
height?: {
type: null;
value?: string | number;
@@ -39,6 +31,10 @@ export interface TdImageProps {
type: StringConstructor;
value?: string;
};
+ tId?: {
+ type: StringConstructor;
+ value?: string;
+ };
webp?: {
type: BooleanConstructor;
value?: boolean;
diff --git a/miniprogram_npm/tdesign-miniprogram/index.d.ts b/miniprogram_npm/tdesign-miniprogram/index.d.ts
new file mode 100644
index 0000000..9af8cc5
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/index.d.ts
@@ -0,0 +1,4 @@
+export { default as ActionSheet, ActionSheetTheme } from './action-sheet/index';
+export { default as Dialog } from './dialog/index';
+export { default as Message } from './message/index';
+export { default as Toast } from './toast/index';
diff --git a/miniprogram_npm/tdesign-miniprogram/index.js b/miniprogram_npm/tdesign-miniprogram/index.js
new file mode 100644
index 0000000..9af8cc5
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/index.js
@@ -0,0 +1,4 @@
+export { default as ActionSheet, ActionSheetTheme } from './action-sheet/index';
+export { default as Dialog } from './dialog/index';
+export { default as Message } from './message/index';
+export { default as Toast } from './toast/index';
diff --git a/miniprogram_npm/tdesign-miniprogram/indexes-anchor/README.md b/miniprogram_npm/tdesign-miniprogram/indexes-anchor/README.md
index dd0003e..43a5deb 100644
--- a/miniprogram_npm/tdesign-miniprogram/indexes-anchor/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/indexes-anchor/README.md
@@ -5,5 +5,9 @@
名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
-external-classes | Array | - | 组件类名,用于设置组件外层元素类名。`['t-class']` | N
index | String / Number | - | 索引字符 | N
+
+### IndexesAnchor 外部样式类
+类名 | 说明
+-- | --
+t-class | 根节点样式类
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/indexes-anchor/indexes-anchor.json b/miniprogram_npm/tdesign-miniprogram/indexes-anchor/indexes-anchor.json
index 467ce29..79f2730 100644
--- a/miniprogram_npm/tdesign-miniprogram/indexes-anchor/indexes-anchor.json
+++ b/miniprogram_npm/tdesign-miniprogram/indexes-anchor/indexes-anchor.json
@@ -1,3 +1,4 @@
{
- "component": true
+ "component": true,
+ "styleIsolation": "apply-shared"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/indexes-anchor/indexes-anchor.wxss b/miniprogram_npm/tdesign-miniprogram/indexes-anchor/indexes-anchor.wxss
index 0addf13..4541456 100644
--- a/miniprogram_npm/tdesign-miniprogram/indexes-anchor/indexes-anchor.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/indexes-anchor/indexes-anchor.wxss
@@ -26,7 +26,7 @@
transform: scale(1.5);
}
.t-indexes-anchor {
- color: var(--td-indexes-anchor-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-indexes-anchor-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
font-size: var(--td-indexes-anchor-font-size, 28rpx);
line-height: var(--td-indexes-anchor-line-height, 44rpx);
}
diff --git a/miniprogram_npm/tdesign-miniprogram/indexes-anchor/props.js b/miniprogram_npm/tdesign-miniprogram/indexes-anchor/props.js
index 47fc176..0f7a053 100644
--- a/miniprogram_npm/tdesign-miniprogram/indexes-anchor/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/indexes-anchor/props.js
@@ -1,7 +1,4 @@
const props = {
- externalClasses: {
- type: Array,
- },
index: {
type: null,
},
diff --git a/miniprogram_npm/tdesign-miniprogram/indexes-anchor/type.d.ts b/miniprogram_npm/tdesign-miniprogram/indexes-anchor/type.d.ts
index acdd553..1e7fe4c 100644
--- a/miniprogram_npm/tdesign-miniprogram/indexes-anchor/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/indexes-anchor/type.d.ts
@@ -1,12 +1,4 @@
export interface TdIndexesAnchorProps {
- style?: {
- type: StringConstructor;
- value?: string;
- };
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class'];
- };
index?: {
type: null;
value?: string | number;
diff --git a/miniprogram_npm/tdesign-miniprogram/indexes/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/indexes/README.en-US.md
index 08ceb79..9aa9137 100644
--- a/miniprogram_npm/tdesign-miniprogram/indexes/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/indexes/README.en-US.md
@@ -1,10 +1,13 @@
:: BASE_DOC ::
## API
+
### Indexes Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
index-list | Array | - | `0.32.0`。Typescript:`string [] \| number[]` | N
list | Array | [] | `deprecated`。Typescript:`ListItem[] ` `interface ListItem { title: string; index: string; children: { title: string; [key: string]: any} [] }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/indexes/type.ts) | N
sticky | Boolean | true | Typescript:`Boolean` | N
@@ -17,9 +20,43 @@ name | params | description
change | `(index: string \| number)` | `0.34.0`
select | `(index: string \| number)` | \-
+
### IndexesAnchor Props
name | type | default | description | required
-- | -- | -- | -- | --
-external-classes | Array | - | `['t-class']` | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
index | String / Number | - | \- | N
+### IndexesAnchor External Classes
+
+className | Description
+-- | --
+t-class | class name of root node
+t-class-sidebar | \-
+t-class-sidebar-item | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-indexes-sidebar-active-bg-color | @brand-color | -
+--td-indexes-sidebar-active-color | @font-white-1 | -
+--td-indexes-sidebar-color | @font-gray-1 | -
+--td-indexes-sidebar-font-size | 24rpx | -
+--td-indexes-sidebar-item-size | 40rpx | -
+--td-indexes-sidebar-line-height | 40rpx | -
+--td-indexes-sidebar-right | 16rpx | -
+--td-indexes-sidebar-tips-bg-color | @brand-color-light | -
+--td-indexes-sidebar-tips-color | @brand-color | -
+--td-indexes-sidebar-tips-font-size | 40rpx | -
+--td-indexes-sidebar-tips-right | calc(100% + 32rpx) | -
+--td-indexes-sidebar-tips-size | 96rpx | -
+--td-indexes-anchor-active-bg-color | @bg-color-container | -
+--td-indexes-anchor-active-color | @brand-color | -
+--td-indexes-anchor-active-font-weight | 600 | -
+--td-indexes-anchor-bg-color | @bg-color-secondarycontainer | -
+--td-indexes-anchor-color | @font-gray-1 | -
+--td-indexes-anchor-font-size | 28rpx | -
+--td-indexes-anchor-line-height | 44rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/indexes/README.md b/miniprogram_npm/tdesign-miniprogram/indexes/README.md
index 0bd7b41..9ddfa1c 100644
--- a/miniprogram_npm/tdesign-miniprogram/indexes/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/indexes/README.md
@@ -28,6 +28,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 基础索引
@@ -38,12 +44,15 @@ isComponent: true
{{ custom }}
### API
+
### Indexes Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
index-list | Array | - | `0.32.0`。索引字符列表。不传默认 `A-Z`。TS 类型:`string [] \| number[]` | N
-list | Array | [] | 已废弃。索引列表的列表数据。每个元素包含三个子元素,index(string):索引值,例如1,2,3,...或A,B,C等;title(string): 索引标题,可不填将默认设为索引值;children(Array<{title: string}>): 子元素列表,title为子元素的展示文案。。TS 类型:`ListItem[] ` `interface ListItem { title: string; index: string; children: { title: string; [key: string]: any} [] }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/indexes/type.ts) | N
+list | Array | [] | 已废弃。索引列表的列表数据。每个元素包含三个子元素,index(string):索引值,例如1,2,3,...或A,B,C等;title(string): 索引标题,可不填将默认设为索引值;children(Array<{title: string}>): 子元素列表,title为子元素的展示文案。TS 类型:`ListItem[] ` `interface ListItem { title: string; index: string; children: { title: string; [key: string]: any} [] }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/indexes/type.ts) | N
sticky | Boolean | true | 索引是否吸顶,默认为true。TS 类型:`Boolean` | N
sticky-offset | Number | 0 | `1.0.0`。锚点吸顶时与顶部的距离 | N
@@ -54,9 +63,43 @@ sticky-offset | Number | 0 | `1.0.0`。锚点吸顶时与顶部的距离 | N
change | `(index: string \| number)` | `0.34.0`。索引发生变更时触发事件
select | `(index: string \| number)` | 点击侧边栏时触发事件
+
### IndexesAnchor Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-external-classes | Array | - | 组件类名,用于设置组件外层元素类名。`['t-class']` | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
index | String / Number | - | 索引字符 | N
+### IndexesAnchor External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-sidebar | 侧边栏样式类
+t-class-sidebar-item | 侧边栏选项样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-indexes-sidebar-active-bg-color | @brand-color | -
+--td-indexes-sidebar-active-color | @font-white-1 | -
+--td-indexes-sidebar-color | @font-gray-1 | -
+--td-indexes-sidebar-font-size | 24rpx | -
+--td-indexes-sidebar-item-size | 40rpx | -
+--td-indexes-sidebar-line-height | 40rpx | -
+--td-indexes-sidebar-right | 16rpx | -
+--td-indexes-sidebar-tips-bg-color | @brand-color-light | -
+--td-indexes-sidebar-tips-color | @brand-color | -
+--td-indexes-sidebar-tips-font-size | 40rpx | -
+--td-indexes-sidebar-tips-right | calc(100% + 32rpx) | -
+--td-indexes-sidebar-tips-size | 96rpx | -
+--td-indexes-anchor-active-bg-color | @bg-color-container | -
+--td-indexes-anchor-active-color | @brand-color | -
+--td-indexes-anchor-active-font-weight | 600 | -
+--td-indexes-anchor-bg-color | @bg-color-secondarycontainer | -
+--td-indexes-anchor-color | @font-gray-1 | -
+--td-indexes-anchor-font-size | 28rpx | -
+--td-indexes-anchor-line-height | 44rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/indexes/indexes.d.ts b/miniprogram_npm/tdesign-miniprogram/indexes/indexes.d.ts
index 900550a..0071d19 100644
--- a/miniprogram_npm/tdesign-miniprogram/indexes/indexes.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/indexes/indexes.d.ts
@@ -16,6 +16,7 @@ export default class Indexes extends SuperComponent {
timer: any;
groupTop: any[];
sidebar: any;
+ currentTouchAnchor: any;
observers: {
indexList(v: any): void;
height(v: any): void;
diff --git a/miniprogram_npm/tdesign-miniprogram/indexes/indexes.js b/miniprogram_npm/tdesign-miniprogram/indexes/indexes.js
index 0e07ea5..aad4eeb 100644
--- a/miniprogram_npm/tdesign-miniprogram/indexes/indexes.js
+++ b/miniprogram_npm/tdesign-miniprogram/indexes/indexes.js
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
-import { getRect, throttle } from '../common/utils';
+import { getRect, throttle, systemInfo } from '../common/utils';
import pageScrollMixin from '../mixins/page-scroll';
const { prefix } = config;
const name = `${prefix}-indexes`;
@@ -30,17 +30,15 @@ let Indexes = class Indexes extends SuperComponent {
type: 'child',
},
};
- this.behaviors = [
- pageScrollMixin(function (event) {
- this.onScroll(event);
- }),
- ];
+ this.behaviors = [pageScrollMixin()];
this.timer = null;
this.groupTop = [];
this.sidebar = null;
+ this.currentTouchAnchor = null;
this.observers = {
indexList(v) {
this.setIndexList(v);
+ this.setHeight(this.data._height);
},
height(v) {
this.setHeight(v);
@@ -48,11 +46,13 @@ let Indexes = class Indexes extends SuperComponent {
};
this.lifetimes = {
ready() {
- var _a;
+ this.timer = null;
+ this.groupTop = [];
+ this.sidebar = null;
if (this.data._height === 0) {
this.setHeight();
}
- if (((_a = this.data._indexList) === null || _a === void 0 ? void 0 : _a.length) === 0) {
+ if (this.data.indexList === null) {
this.setIndexList();
}
},
@@ -60,7 +60,7 @@ let Indexes = class Indexes extends SuperComponent {
this.methods = {
setHeight(height) {
if (!height) {
- const { windowHeight } = wx.getSystemInfoSync();
+ const { windowHeight } = systemInfo;
height = windowHeight;
}
this.setData({
@@ -128,22 +128,21 @@ let Indexes = class Indexes extends SuperComponent {
}
},
setAnchorByIndex(index) {
- if (this.preIndex != null && this.preIndex === index)
- return;
- const { _indexList } = this.data;
+ const { _indexList, stickyOffset } = this.data;
const activeAnchor = _indexList[index];
+ if (this.data.activeAnchor !== null && this.data.activeAnchor === activeAnchor)
+ return;
const target = this.groupTop.find((item) => item.anchor === activeAnchor);
if (target) {
+ this.currentTouchAnchor = activeAnchor;
+ const scrollTop = target.top - stickyOffset;
wx.pageScrollTo({
- scrollTop: target.top,
+ scrollTop,
duration: 0,
});
- }
- this.preIndex = index;
- this.toggleTips(true);
- this.triggerEvent('select', { index: activeAnchor });
- if (activeAnchor !== this.data.activeAnchor) {
- this.triggerEvent('change', { index: activeAnchor });
+ this.toggleTips(true);
+ this.triggerEvent('select', { index: activeAnchor });
+ this.setData({ activeAnchor });
}
},
onClick(e) {
@@ -178,37 +177,46 @@ let Indexes = class Indexes extends SuperComponent {
if (!this.groupTop) {
return;
}
- const { sticky, stickyOffset } = this.data;
+ const { sticky, stickyOffset, activeAnchor } = this.data;
scrollTop += stickyOffset;
const curIndex = this.groupTop.findIndex((group) => scrollTop >= group.top - group.height && scrollTop <= group.top + group.totalHeight - group.height);
if (curIndex === -1)
return;
const curGroup = this.groupTop[curIndex];
- if (this.data.activeAnchor !== curGroup.anchor) {
+ if (this.currentTouchAnchor !== null) {
this.triggerEvent('change', { index: curGroup.anchor });
+ this.currentTouchAnchor = null;
+ }
+ else if (activeAnchor !== curGroup.anchor) {
+ this.triggerEvent('change', { index: curGroup.anchor });
+ this.setData({ activeAnchor: curGroup.anchor });
}
- this.setData({
- activeAnchor: curGroup.anchor,
- });
if (sticky) {
const offset = curGroup.top - scrollTop;
const betwixt = offset < curGroup.height && offset > 0 && scrollTop > stickyOffset;
this.$children.forEach((child, index) => {
if (index === curIndex) {
- child.setData({
- sticky: scrollTop > stickyOffset,
- active: true,
- style: `height: ${curGroup.height}px`,
- anchorStyle: `transform: translate3d(0, ${betwixt ? offset : 0}px, 0); top: ${stickyOffset}px`,
- });
+ const sticky = scrollTop > stickyOffset;
+ const anchorStyle = `transform: translate3d(0, ${betwixt ? offset : 0}px, 0); top: ${stickyOffset}px`;
+ if (anchorStyle !== child.data.anchorStyle || sticky !== child.data.sticky) {
+ child.setData({
+ sticky,
+ active: true,
+ style: `height: ${curGroup.height}px`,
+ anchorStyle,
+ });
+ }
}
else if (index + 1 === curIndex) {
- child.setData({
- sticky: true,
- active: true,
- style: `height: ${curGroup.height}px`,
- anchorStyle: `transform: translate3d(0, ${betwixt ? offset - curGroup.height : 0}px, 0); top: ${stickyOffset}px`,
- });
+ const anchorStyle = `transform: translate3d(0, ${betwixt ? offset - curGroup.height : 0}px, 0); top: ${stickyOffset}px`;
+ if (anchorStyle !== child.data.anchorStyle) {
+ child.setData({
+ sticky: true,
+ active: true,
+ style: `height: ${curGroup.height}px`,
+ anchorStyle,
+ });
+ }
}
else {
child.setData({ active: false, sticky: false, anchorStyle: '' });
diff --git a/miniprogram_npm/tdesign-miniprogram/indexes/indexes.json b/miniprogram_npm/tdesign-miniprogram/indexes/indexes.json
index 49bfc1b..4ae6508 100644
--- a/miniprogram_npm/tdesign-miniprogram/indexes/indexes.json
+++ b/miniprogram_npm/tdesign-miniprogram/indexes/indexes.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon",
"t-cell": "../cell/cell",
diff --git a/miniprogram_npm/tdesign-miniprogram/indexes/indexes.wxml b/miniprogram_npm/tdesign-miniprogram/indexes/indexes.wxml
index 0969d41..1784c21 100644
--- a/miniprogram_npm/tdesign-miniprogram/indexes/indexes.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/indexes/indexes.wxml
@@ -1,4 +1,5 @@
+
-
+
- {{label}}
+ {{label}}
diff --git a/miniprogram_npm/tdesign-miniprogram/input/input.wxss b/miniprogram_npm/tdesign-miniprogram/input/input.wxss
index ca7c8cc..70fa8fa 100644
--- a/miniprogram_npm/tdesign-miniprogram/input/input.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/input/input.wxss
@@ -28,6 +28,7 @@
.t-input {
background-color: var(--td-input-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
display: flex;
+ align-items: center;
flex: 1;
padding: var(--td-input-vertical-padding, 32rpx);
}
@@ -56,21 +57,23 @@
}
.t-input--layout-vertical {
flex-direction: column;
+ align-items: start;
}
.t-input__wrap--prefix {
display: flex;
}
.t-input__icon--prefix {
font-size: 48rpx;
- color: var(--td-input-prefix-icon-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-input-prefix-icon-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-input__label:not(:empty) {
- min-width: 2em;
- max-width: 5em;
+ min-width: var(--td-input-label-min-width, 2em);
+ max-width: var(--td-input-label-max-width, 5em);
font-size: var(--td-font-size-m, 32rpx);
line-height: 48rpx;
- color: var(--td-input-label-text-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-input-label-text-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
margin-right: var(--td-spacer-2, 32rpx);
+ word-wrap: break-word;
}
.t-input--layout-vertical .t-input__label:not(:empty) {
font-size: var(--td-font-size-base, 28rpx);
@@ -79,7 +82,14 @@
.t-input__icon--prefix:not(:empty) + .t-input__label:not(:empty) {
padding-left: 8rpx;
}
+.t-input__label:not(:empty) + .t-input__wrap {
+ margin-left: var(--td-spacer-2, 32rpx);
+}
+.t-input__icon--prefix:not(:empty) + .t-input__label:empty {
+ margin-right: var(--td-spacer-2, 32rpx);
+}
.t-input__wrap {
+ width: 100%;
display: flex;
flex-direction: column;
flex-wrap: wrap;
@@ -89,6 +99,7 @@
}
.t-input__wrap .t-input__content {
display: flex;
+ width: 100%;
align-items: center;
line-height: 48rpx;
font-size: var(--td-font-size-m, 32rpx);
@@ -107,11 +118,11 @@
.t-input__wrap--clearable-icon,
.t-input__wrap--suffix-icon {
font-size: 48rpx;
- color: var(--td-input-suffix-icon-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-input-suffix-icon-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
}
.t-input__wrap--suffix {
font-size: var(--td-font-size-m, 32rpx);
- color: var(--td-input-suffix-text-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-input-suffix-text-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-input__icon--prefix:empty,
.t-input__tips:empty,
@@ -128,7 +139,7 @@
min-height: 48rpx;
margin: 0;
padding: 0;
- color: var(--td-input-default-text-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-input-default-text-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
line-height: inherit;
background-color: transparent;
border: 0;
@@ -155,7 +166,10 @@
}
.t-input__placeholder {
color: var(--td-input-placeholder-text-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
- font-size: var(--td-font-size-m, 32rpx);
+ font-size: var(--td-input-placeholder-text-font-size, var(--td-font-size-m, 32rpx));
+}
+.t-input__placeholder--disabled {
+ color: var(--td-input-disabled-text-color, var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26))));
}
.t-input__tips {
font-size: var(--td-font-size-s, 24rpx);
@@ -163,7 +177,7 @@
padding-top: 8rpx;
}
.t-input--default + .t-input__tips {
- color: var(--td-input-default-tips-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-input-default-tips-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
}
.t-input--success + .t-input__tips {
color: var(--td-input-success-tips-color, var(--td-success-color, var(--td-success-color-5, #2ba471)));
diff --git a/miniprogram_npm/tdesign-miniprogram/input/props.js b/miniprogram_npm/tdesign-miniprogram/input/props.js
index db17441..a710f17 100644
--- a/miniprogram_npm/tdesign-miniprogram/input/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/input/props.js
@@ -1,103 +1,33 @@
const props = {
+ adjustPosition: {
+ type: Boolean,
+ value: true,
+ },
align: {
type: String,
value: 'left',
},
- layout: {
- type: String,
- value: 'horizontal',
- },
- borderless: {
+ alwaysEmbed: {
type: Boolean,
value: false,
},
- clearable: {
- type: null,
- value: false,
- },
- disabled: {
- type: Boolean,
- value: false,
- },
- errorMessage: {
- type: String,
- value: '',
- },
- externalClasses: {
- type: Array,
- },
- format: {
- type: null,
- },
- label: {
- type: String,
- },
- maxcharacter: {
- type: Number,
- },
- maxlength: {
- type: Number,
- },
- placeholder: {
- type: String,
- value: undefined,
- },
- prefixIcon: {
- type: null,
- value: null,
- },
- readonly: {
- type: Boolean,
- value: false,
- },
- size: {
- type: String,
- value: 'medium',
- },
- status: {
- type: String,
- value: 'default',
- },
- suffix: {
- type: String,
- },
- suffixIcon: {
- type: null,
- value: null,
- },
- tips: {
- type: String,
- },
- value: {
- type: String,
- optionalTypes: [Number],
- value: null,
- },
- defaultValue: {
- type: String,
- optionalTypes: [Number],
- },
- type: {
- type: String,
- value: 'text',
- },
- placeholderStyle: {
- type: String,
- value: '',
- },
- placeholderClass: {
- type: String,
- value: 'input-placeholder',
- },
- cursorSpacing: {
- type: Number,
- value: 0,
- },
autoFocus: {
type: Boolean,
value: false,
},
- focus: {
+ borderless: {
+ type: Boolean,
+ value: false,
+ },
+ clearTrigger: {
+ type: String,
+ value: 'always',
+ },
+ clearable: {
+ type: null,
+ value: false,
+ },
+ confirmHold: {
type: Boolean,
value: false,
},
@@ -105,41 +35,76 @@ const props = {
type: String,
value: 'done',
},
- alwaysEmbed: {
- type: Boolean,
- value: false,
- },
- confirmHold: {
- type: Boolean,
- value: false,
- },
cursor: {
type: Number,
+ required: true,
},
- selectionStart: {
+ cursorColor: {
+ type: String,
+ value: '',
+ },
+ cursorSpacing: {
type: Number,
- value: -1,
+ value: 0,
},
- selectionEnd: {
- type: Number,
- value: -1,
+ disabled: {
+ type: null,
+ value: undefined,
},
- adjustPosition: {
+ focus: {
type: Boolean,
- value: true,
+ value: false,
+ },
+ format: {
+ type: null,
},
holdKeyboard: {
type: Boolean,
value: false,
},
+ label: {
+ type: String,
+ },
+ layout: {
+ type: String,
+ value: 'horizontal',
+ },
+ maxcharacter: {
+ type: Number,
+ },
+ maxlength: {
+ type: Number,
+ value: -1,
+ },
+ placeholder: {
+ type: String,
+ value: undefined,
+ },
+ placeholderClass: {
+ type: String,
+ value: 'input-placeholder',
+ },
+ placeholderStyle: {
+ type: String,
+ value: '',
+ required: true,
+ },
+ prefixIcon: {
+ type: null,
+ },
+ readonly: {
+ type: null,
+ value: undefined,
+ },
safePasswordCertPath: {
type: String,
value: '',
},
- safePasswordLength: {
- type: Number,
+ safePasswordCustomHash: {
+ type: String,
+ value: '',
},
- safePasswordTimeStamp: {
+ safePasswordLength: {
type: Number,
},
safePasswordNonce: {
@@ -150,9 +115,36 @@ const props = {
type: String,
value: '',
},
- safePasswordCustomHash: {
+ safePasswordTimeStamp: {
+ type: Number,
+ },
+ selectionEnd: {
+ type: Number,
+ value: -1,
+ },
+ selectionStart: {
+ type: Number,
+ value: -1,
+ },
+ status: {
type: String,
- value: '',
+ value: 'default',
+ },
+ suffix: {
+ type: String,
+ },
+ suffixIcon: {
+ type: null,
+ },
+ tips: {
+ type: String,
+ },
+ type: {
+ type: String,
+ value: 'text',
+ },
+ value: {
+ type: null,
},
};
export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/input/type.d.ts b/miniprogram_npm/tdesign-miniprogram/input/type.d.ts
index 451da4a..5379c3b 100644
--- a/miniprogram_npm/tdesign-miniprogram/input/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/input/type.d.ts
@@ -1,44 +1,77 @@
export interface TdInputProps {
+ adjustPosition?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
align?: {
type: StringConstructor;
value?: 'left' | 'center' | 'right';
};
- layout?: {
- type: StringConstructor;
- value?: 'horizontal' | 'vertical';
+ alwaysEmbed?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+ autoFocus?: {
+ type: BooleanConstructor;
+ value?: boolean;
};
borderless?: {
type: BooleanConstructor;
value?: boolean;
};
+ clearTrigger?: {
+ type: StringConstructor;
+ value?: 'always' | 'focus';
+ };
clearable?: {
type: null;
value?: boolean | object;
};
- style?: {
+ confirmHold?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+ confirmType?: {
+ type: StringConstructor;
+ value?: 'send' | 'search' | 'next' | 'go' | 'done';
+ };
+ cursor: {
+ type: NumberConstructor;
+ value?: number;
+ required?: boolean;
+ };
+ cursorColor?: {
type: StringConstructor;
value?: string;
};
+ cursorSpacing?: {
+ type: NumberConstructor;
+ value?: number;
+ };
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
- errorMessage?: {
- type: StringConstructor;
- value?: string;
- };
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-input', 't-class-placeholder', 't-class-error-msg'];
+ focus?: {
+ type: BooleanConstructor;
+ value?: boolean;
};
format?: {
- type: null;
+ type: undefined;
value?: InputFormatType;
};
+ holdKeyboard?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
label?: {
type: StringConstructor;
value?: string;
};
+ layout?: {
+ type: StringConstructor;
+ value?: 'vertical' | 'horizontal';
+ };
maxcharacter?: {
type: NumberConstructor;
value?: number;
@@ -51,6 +84,15 @@ export interface TdInputProps {
type: StringConstructor;
value?: string;
};
+ placeholderClass?: {
+ type: StringConstructor;
+ value?: string;
+ };
+ placeholderStyle: {
+ type: StringConstructor;
+ value?: string;
+ required?: boolean;
+ };
prefixIcon?: {
type: null;
value?: string | object;
@@ -59,9 +101,37 @@ export interface TdInputProps {
type: BooleanConstructor;
value?: boolean;
};
- size?: {
+ safePasswordCertPath?: {
type: StringConstructor;
- value?: 'medium' | 'small';
+ value?: string;
+ };
+ safePasswordCustomHash?: {
+ type: StringConstructor;
+ value?: string;
+ };
+ safePasswordLength?: {
+ type: NumberConstructor;
+ value?: number;
+ };
+ safePasswordNonce?: {
+ type: StringConstructor;
+ value?: string;
+ };
+ safePasswordSalt?: {
+ type: StringConstructor;
+ value?: string;
+ };
+ safePasswordTimeStamp?: {
+ type: NumberConstructor;
+ value?: number;
+ };
+ selectionEnd?: {
+ type: NumberConstructor;
+ value?: number;
+ };
+ selectionStart?: {
+ type: NumberConstructor;
+ value?: number;
};
status?: {
type: StringConstructor;
@@ -84,91 +154,9 @@ export interface TdInputProps {
value?: 'text' | 'number' | 'idcard' | 'digit' | 'safe-password' | 'password' | 'nickname';
};
value?: {
- type: StringConstructor;
- optionalTypes: Array;
+ type: null;
value?: InputValue;
};
- defaultValue?: {
- type: StringConstructor;
- optionalTypes: Array;
- value?: InputValue;
- };
- placeholderStyle: {
- type: StringConstructor;
- value?: string;
- };
- placeholderClass?: {
- type: StringConstructor;
- value?: string;
- };
- cursorSpacing?: {
- type: NumberConstructor;
- value?: number;
- };
- autoFocus?: {
- type: BooleanConstructor;
- value?: boolean;
- };
- focus?: {
- type: BooleanConstructor;
- value?: boolean;
- };
- confirmType?: {
- type: StringConstructor;
- value?: 'send' | 'search' | 'next' | 'go' | 'done';
- };
- alwaysEmbed?: {
- type: BooleanConstructor;
- value?: boolean;
- };
- confirmHold?: {
- type: BooleanConstructor;
- value?: boolean;
- };
- cursor: {
- type: NumberConstructor;
- value?: number;
- };
- selectionStart?: {
- type: NumberConstructor;
- value?: number;
- };
- selectionEnd?: {
- type: NumberConstructor;
- value?: number;
- };
- adjustPosition?: {
- type: BooleanConstructor;
- value?: boolean;
- };
- holdKeyboard?: {
- type: BooleanConstructor;
- value?: boolean;
- };
- safePasswordCertPath?: {
- type: StringConstructor;
- value?: string;
- };
- safePasswordLength?: {
- type: NumberConstructor;
- value?: number;
- };
- safePasswordTimeStamp?: {
- type: NumberConstructor;
- value?: number;
- };
- safePasswordNonce?: {
- type: StringConstructor;
- value?: string;
- };
- safePasswordSalt?: {
- type: StringConstructor;
- value?: string;
- };
- safePasswordCustomHash?: {
- type: StringConstructor;
- value?: string;
- };
}
-export declare type InputFormatType = (value: InputValue) => number | string;
+export declare type InputFormatType = (value: InputValue) => string;
export declare type InputValue = string | number;
diff --git a/miniprogram_npm/tdesign-miniprogram/link/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/link/README.en-US.md
index 3b01055..6240694 100644
--- a/miniprogram_npm/tdesign-miniprogram/link/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/link/README.en-US.md
@@ -1,19 +1,22 @@
:: BASE_DOC ::
## API
+
### Link Props
name | type | default | description | required
-- | -- | -- | -- | --
-content | String / Slot | - | \- | N
-navigator-props | Object | - | \- | N
-prefix-icon | String / Object / Slot | - | \- | N
-size | String | medium | options:small/medium/large。Typescript:`SizeEnum` | N
-status | String | normal | options:normal/active/disabled | N
-disabled | Boolean | false | \- | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+content | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+disabled | Boolean | false | make link to be disabled | N
hover | Boolean | - | \- | N
-suffix-icon | String / Object / Slot | - | \- | N
-theme | String | default | options:default/primary/danger/warning/success | N
+navigator-props | Object | - | \- | N
+prefix-icon | String / Object / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+size | String | medium | options: small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+status | String | normal | `deprecated`。options: normal/active/disabled | N
+suffix-icon | String / Object / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+theme | String | default | options: default/primary/danger/warning/success | N
underline | Boolean | - | \- | N
### Link Events
@@ -23,3 +26,33 @@ name | params | description
complete | \- | \-
fail | \- | \-
success | \- | \-
+### Link External Classes
+
+className | Description
+-- | --
+t-class | class name of root node
+t-class-content | \-
+t-class-hover | \-
+t-class-prefix-icon | \-
+t-class-suffix-icon | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-link-danger-active-color | @error-color-active | -
+--td-link-danger-color | @error-color | -
+--td-link-danger-disabled-color | @error-color-disabled | -
+--td-link-default-active-color | @brand-color-active | -
+--td-link-default-color | @font-gray-1 | -
+--td-link-default-disabled-color | @text-color-disabled | -
+--td-link-primary-active-color | @brand-color-active | -
+--td-link-primary-color | @brand-color | -
+--td-link-primary-disabled-color | @brand-color-disabled | -
+--td-link-success-active-color | @success-color-active | -
+--td-link-success-color | @success-color | -
+--td-link-success-disabled-color | @success-color-disabled | -
+--td-link-warning-active-color | @warning-color-active | -
+--td-link-warning-color | @warning-color | -
+--td-link-warning-disabled-color | @warning-color-disabled | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/link/README.md b/miniprogram_npm/tdesign-miniprogram/link/README.md
index 0a279a7..d3e5140 100644
--- a/miniprogram_npm/tdesign-miniprogram/link/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/link/README.md
@@ -24,6 +24,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
基础文字链接
@@ -59,21 +65,24 @@ isComponent: true
{{ size }}
## API
+
### Link Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-content | String / Slot | - | 链接内容 | N
-navigator-props | Object | - | 与 navigator 原生组件属性保持一致,具体使用参考:https://developers.weixin.qq.com/miniprogram/dev/component/navigator.html。 | N
-prefix-icon | String / Object / Slot | - | 前置图标 | N
-size | String | medium | 尺寸。可选项:small/medium/large。TS 类型:`SizeEnum` | N
-status | String | normal | 已废弃。组件状态。可选项:normal/active/disabled | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+content | String / Slot | - | 链接内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
disabled | Boolean | false | 是否为禁用态 | N
hover | Boolean | - | 是否开启点击反馈 | N
-suffix-icon | String / Object / Slot | - | 前置图标 | N
+navigator-props | Object | - | 与 navigator 原生组件属性保持一致,具体使用参考:[微信开放文档](https://developers.weixin.qq.com/miniprogram/dev/component/navigator.html)。使用时请将形如 `open-type` 风格的属性名改为 `openType` 风格 | N
+prefix-icon | String / Object / Slot | - | 前置图标。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+size | String | medium | 尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+status | String | normal | 已废弃。组件状态。可选项:normal/active/disabled | N
+suffix-icon | String / Object / Slot | - | 后置图标。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
theme | String | default | 组件风格,依次为默认色、品牌色、危险色、警告色、成功色。可选项:default/primary/danger/warning/success | N
underline | Boolean | - | 是否显示链接下划线 | N
-external-classes | Array | - | 样式类名。`['t-class', 't-class-hover', 't-class-prefix-icon', 't-class-content', 't-class-suffix-icon']` | N
+
### Link Events
名称 | 参数 | 描述
@@ -81,3 +90,33 @@ external-classes | Array | - | 样式类名。`['t-class', 't-class-hover', 't-c
complete | \- | 页面链接执行完成后触发(失败或成功均会触发)
fail | \- | 页面链接跳转失败后触发
success | \- | 页面链接跳转成功后触发
+### Link External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-content | 内容样式类
+t-class-hover | 悬停样式类
+t-class-prefix-icon | 前置图标样式类
+t-class-suffix-icon | 后置图标样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-link-danger-active-color | @error-color-active | -
+--td-link-danger-color | @error-color | -
+--td-link-danger-disabled-color | @error-color-disabled | -
+--td-link-default-active-color | @brand-color-active | -
+--td-link-default-color | @font-gray-1 | -
+--td-link-default-disabled-color | @text-color-disabled | -
+--td-link-primary-active-color | @brand-color-active | -
+--td-link-primary-color | @brand-color | -
+--td-link-primary-disabled-color | @brand-color-disabled | -
+--td-link-success-active-color | @success-color-active | -
+--td-link-success-color | @success-color | -
+--td-link-success-disabled-color | @success-color-disabled | -
+--td-link-warning-active-color | @warning-color-active | -
+--td-link-warning-color | @warning-color | -
+--td-link-warning-disabled-color | @warning-color-disabled | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/link/link.d.ts b/miniprogram_npm/tdesign-miniprogram/link/link.d.ts
index ff0e8cb..ad1b82f 100644
--- a/miniprogram_npm/tdesign-miniprogram/link/link.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/link/link.d.ts
@@ -2,6 +2,9 @@ import { SuperComponent } from '../common/src/index';
export default class Link extends SuperComponent {
externalClasses: string[];
properties: import("./type").TdLinkProps;
+ options: {
+ multipleSlots: boolean;
+ };
data: {
prefix: string;
classPrefix: string;
diff --git a/miniprogram_npm/tdesign-miniprogram/link/link.js b/miniprogram_npm/tdesign-miniprogram/link/link.js
index 9509be3..e02d0d0 100644
--- a/miniprogram_npm/tdesign-miniprogram/link/link.js
+++ b/miniprogram_npm/tdesign-miniprogram/link/link.js
@@ -21,6 +21,9 @@ let Link = class Link extends SuperComponent {
`${prefix}-class-suffix-icon`,
];
this.properties = props;
+ this.options = {
+ multipleSlots: true,
+ };
this.data = {
prefix,
classPrefix: name,
@@ -52,7 +55,8 @@ let Link = class Link extends SuperComponent {
if (underline) {
classList.push(`${name}--underline`);
}
- if ((navigatorProps && !navigatorProps.url) || disabled) {
+ if ((navigatorProps && !navigatorProps.url && !['navigateBack', 'exit'].includes(navigatorProps.openType)) ||
+ disabled) {
classList.push(`${name}--disabled`);
}
this.setData({
diff --git a/miniprogram_npm/tdesign-miniprogram/link/link.json b/miniprogram_npm/tdesign-miniprogram/link/link.json
index 049940c..f783dae 100644
--- a/miniprogram_npm/tdesign-miniprogram/link/link.json
+++ b/miniprogram_npm/tdesign-miniprogram/link/link.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/link/link.wxml b/miniprogram_npm/tdesign-miniprogram/link/link.wxml
index 94acf77..933aa87 100644
--- a/miniprogram_npm/tdesign-miniprogram/link/link.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/link/link.wxml
@@ -5,7 +5,7 @@
class="{{className}} class {{prefix}}-class"
style="{{_._style([style, customStyle])}}"
target="{{navigatorProps.target}}"
- url="{{navigatorProps.url}}"
+ url="{{ !disabled && navigatorProps.url}}"
open-type="{{navigatorProps.openType || 'navigate'}}"
delta="{{navigatorProps.delta}}"
app-id="{{navigatorProps.appId}}"
diff --git a/miniprogram_npm/tdesign-miniprogram/link/link.wxss b/miniprogram_npm/tdesign-miniprogram/link/link.wxss
index 1cae7ee..733a773 100644
--- a/miniprogram_npm/tdesign-miniprogram/link/link.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/link/link.wxss
@@ -95,10 +95,10 @@
border-color: var(--td-link-warning-active-color, var(--td-warning-color-active, var(--td-warning-color-6, #be5a00)));
}
.t-link--default {
- color: var(--td-link-default-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-link-default-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-link--default.t-link--underline::after {
- border-color: var(--td-link-default-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ border-color: var(--td-link-default-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-link--default.t-link--disabled {
color: var(--td-link-default-disabled-color, var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26))));
diff --git a/miniprogram_npm/tdesign-miniprogram/link/props.js b/miniprogram_npm/tdesign-miniprogram/link/props.js
index 6e189d8..8ce30cb 100644
--- a/miniprogram_npm/tdesign-miniprogram/link/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/link/props.js
@@ -2,6 +2,13 @@ const props = {
content: {
type: String,
},
+ disabled: {
+ type: Boolean,
+ value: false,
+ },
+ hover: {
+ type: Boolean,
+ },
navigatorProps: {
type: Object,
},
@@ -12,18 +19,6 @@ const props = {
type: String,
value: 'medium',
},
- status: {
- type: String,
- value: 'normal',
- },
- disabled: {
- type: Boolean,
- value: false,
- },
- hover: {
- type: Boolean,
- value: false,
- },
suffixIcon: {
type: null,
},
diff --git a/miniprogram_npm/tdesign-miniprogram/link/type.d.ts b/miniprogram_npm/tdesign-miniprogram/link/type.d.ts
index 6615084..f261141 100644
--- a/miniprogram_npm/tdesign-miniprogram/link/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/link/type.d.ts
@@ -4,6 +4,14 @@ export interface TdLinkProps {
type: StringConstructor;
value?: string;
};
+ disabled?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+ hover?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
navigatorProps?: {
type: ObjectConstructor;
value?: object;
@@ -16,18 +24,6 @@ export interface TdLinkProps {
type: StringConstructor;
value?: SizeEnum;
};
- status?: {
- type: StringConstructor;
- value?: 'normal' | 'active' | 'disabled';
- };
- disabled?: {
- type: BooleanConstructor;
- value?: boolean;
- };
- hover?: {
- type: BooleanConstructor;
- value?: boolean;
- };
suffixIcon?: {
type: null;
value?: string | object;
diff --git a/miniprogram_npm/tdesign-miniprogram/loading/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/loading/README.en-US.md
index fac34a1..ac1e999 100644
--- a/miniprogram_npm/tdesign-miniprogram/loading/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/loading/README.en-US.md
@@ -6,16 +6,34 @@
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
delay | Number | 0 | \- | N
duration | Number | 800 | \- | N
-external-classes | Array | - | `['t-class', 't-class-text', 't-class-indicator']` | N
-indicator | Boolean | true | \- | N
+indicator | Boolean / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
inherit-color | Boolean | false | \- | N
-layout | String | horizontal | options:horizontal/vertical | N
+layout | String | horizontal | options: horizontal/vertical | N
loading | Boolean | true | \- | N
pause | Boolean | false | \- | N
progress | Number | - | \- | N
reverse | Boolean | - | \- | N
size | String | '40rpx' | \- | N
-text | String / Slot | - | \- | N
-theme | String | circular | options:circular/spinner/bar/error/dots | N
+text | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+theme | String | circular | options: circular/spinner/dots | N
+### Loading External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-indicator | \-
+t-class-text | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-loading-color | @brand-color | -
+--td-loading-text-color | inherit | -
+--td-loading-text-font-size | 24rpx | -
+--td-loading-text-line-height | 40rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/loading/README.md b/miniprogram_npm/tdesign-miniprogram/loading/README.md
index 8cd1459..50dad47 100644
--- a/miniprogram_npm/tdesign-miniprogram/loading/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/loading/README.md
@@ -18,6 +18,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 纯icon
{{ base }}
@@ -51,14 +57,16 @@ isComponent: true
{{ size }}
## API
+
### Loading Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | 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
+indicator | Boolean / Slot | true | 加载指示符,值为 true 显示默认指示符,值为 false 则不显示,也可以自定义指示符。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
inherit-color | Boolean | false | 是否继承父元素颜色 | N
layout | String | horizontal | 对齐方式。可选项:horizontal/vertical | N
loading | Boolean | true | 是否处于加载状态 | N
@@ -66,5 +74,22 @@ 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
+text | String / Slot | - | 加载提示文案。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+theme | String | circular | 加载组件类型。可选项:circular/spinner/dots,skyline 模式下暂不支持枚举值 circular | N
+### Loading External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-indicator | 指示符样式类
+t-class-text | 文本样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-loading-color | @brand-color | -
+--td-loading-text-color | inherit | -
+--td-loading-text-font-size | 24rpx | -
+--td-loading-text-line-height | 40rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/loading/loading.d.ts b/miniprogram_npm/tdesign-miniprogram/loading/loading.d.ts
index 512396e..55dd01b 100644
--- a/miniprogram_npm/tdesign-miniprogram/loading/loading.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/loading/loading.d.ts
@@ -13,10 +13,6 @@ export default class Loading extends SuperComponent {
multipleSlots: boolean;
};
properties: {
- style?: {
- type: StringConstructor;
- value?: string;
- };
delay?: {
type: NumberConstructor;
value?: number;
@@ -67,7 +63,7 @@ export default class Loading extends SuperComponent {
};
theme?: {
type: StringConstructor;
- value?: "error" | "circular" | "spinner" | "bar" | "dots";
+ value?: "circular" | "spinner" | "dots";
};
};
timer: any;
diff --git a/miniprogram_npm/tdesign-miniprogram/loading/loading.json b/miniprogram_npm/tdesign-miniprogram/loading/loading.json
index a89ef4d..4f0a3f0 100644
--- a/miniprogram_npm/tdesign-miniprogram/loading/loading.json
+++ b/miniprogram_npm/tdesign-miniprogram/loading/loading.json
@@ -1,4 +1,5 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/loading/loading.wxml b/miniprogram_npm/tdesign-miniprogram/loading/loading.wxml
index 925b4f3..094ebf1 100644
--- a/miniprogram_npm/tdesign-miniprogram/loading/loading.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/loading/loading.wxml
@@ -1,16 +1,21 @@
-
+
+
+///
+///
+import { MessageProps } from '../message/message.interface';
+declare type Context = WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance;
+interface MessageActionOptionsType extends Optional {
+ context?: Context;
+ selector?: string;
+}
+declare const _default: {
+ info(options: MessageActionOptionsType): WechatMiniprogram.Component.TrivialInstance;
+ success(options: MessageActionOptionsType): WechatMiniprogram.Component.TrivialInstance;
+ warning(options: MessageActionOptionsType): WechatMiniprogram.Component.TrivialInstance;
+ error(options: MessageActionOptionsType): WechatMiniprogram.Component.TrivialInstance;
+ hide(options: MessageActionOptionsType): void;
+};
+export default _default;
diff --git a/miniprogram_npm/tdesign-miniprogram/message-item/index.js b/miniprogram_npm/tdesign-miniprogram/message-item/index.js
new file mode 100644
index 0000000..b35e682
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/message-item/index.js
@@ -0,0 +1,46 @@
+var __rest = (this && this.__rest) || function (s, e) {
+ var t = {};
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
+ t[p] = s[p];
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
+ t[p[i]] = s[p[i]];
+ }
+ return t;
+};
+import { MessageType } from '../message/message.interface';
+import { getInstance } from '../common/utils';
+const showMessage = function (options, theme = MessageType.info) {
+ const { context, selector = '#t-message' } = options, otherOptions = __rest(options, ["context", "selector"]);
+ const instance = getInstance(context, selector);
+ if (instance) {
+ instance.resetData(() => {
+ instance.setData(Object.assign({ theme }, otherOptions), instance.show.bind(instance));
+ });
+ return instance;
+ }
+ console.error('未找到组件,请确认 selector && context 是否正确');
+};
+export default {
+ info(options) {
+ return showMessage(options, MessageType.info);
+ },
+ success(options) {
+ return showMessage(options, MessageType.success);
+ },
+ warning(options) {
+ return showMessage(options, MessageType.warning);
+ },
+ error(options) {
+ return showMessage(options, MessageType.error);
+ },
+ hide(options) {
+ const { context, selector = '#t-message' } = Object.assign({}, options);
+ const instance = getInstance(context, selector);
+ if (!instance) {
+ return;
+ }
+ instance.hide();
+ },
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/message-item/message-item.d.ts b/miniprogram_npm/tdesign-miniprogram/message-item/message-item.d.ts
new file mode 100644
index 0000000..49bdb7e
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/message-item/message-item.d.ts
@@ -0,0 +1,39 @@
+///
+import { SuperComponent, ComponentsOptionsType } from '../common/src/index';
+import { MessageProps } from '../message/message.interface';
+export default class Message extends SuperComponent {
+ externalClasses: string[];
+ options: ComponentsOptionsType;
+ properties: MessageProps;
+ data: {
+ prefix: string;
+ classPrefix: string;
+ loop: number;
+ animation: any[];
+ showAnimation: any[];
+ wrapTop: number;
+ fadeClass: string;
+ };
+ closeTimeoutContext: number;
+ nextAnimationContext: number;
+ resetAnimation: WechatMiniprogram.Animation;
+ observers: {
+ marquee(val: any): void;
+ 'icon, theme'(icon: any, theme: any): void;
+ link(v: any): void;
+ closeBtn(v: any): void;
+ };
+ lifetimes: {
+ ready(): void;
+ detached(): void;
+ };
+ memoInitialData(): void;
+ resetData(cb: () => void): void;
+ checkAnimation(): void;
+ clearMessageAnimation(): void;
+ show(offsetHeight?: number): void;
+ hide(): void;
+ reset(): void;
+ handleClose(): void;
+ handleLinkClick(): void;
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/message-item/message-item.js b/miniprogram_npm/tdesign-miniprogram/message-item/message-item.js
new file mode 100644
index 0000000..2903510
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/message-item/message-item.js
@@ -0,0 +1,187 @@
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+import { SuperComponent, wxComponent } from '../common/src/index';
+import config from '../common/config';
+import props from '../message/props';
+import { getRect, unitConvert, calcIcon, isObject } from '../common/utils';
+const { prefix } = config;
+const name = `${prefix}-message`;
+const SHOW_DURATION = 500;
+const THEME_ICON = {
+ info: 'info-circle-filled',
+ success: 'check-circle-filled',
+ warning: 'info-circle-filled',
+ error: 'error-circle-filled',
+};
+let Message = class Message extends SuperComponent {
+ constructor() {
+ super(...arguments);
+ this.externalClasses = [
+ `${prefix}-class`,
+ `${prefix}-class-content`,
+ `${prefix}-class-icon`,
+ `${prefix}-class-link`,
+ `${prefix}-class-close-btn`,
+ ];
+ this.options = {
+ multipleSlots: true,
+ };
+ this.properties = Object.assign({}, props);
+ this.data = {
+ prefix,
+ classPrefix: name,
+ loop: -1,
+ animation: [],
+ showAnimation: [],
+ wrapTop: -999,
+ fadeClass: '',
+ };
+ this.closeTimeoutContext = 0;
+ this.nextAnimationContext = 0;
+ this.resetAnimation = wx.createAnimation({
+ duration: 0,
+ timingFunction: 'linear',
+ });
+ this.observers = {
+ marquee(val) {
+ if (JSON.stringify(val) === '{}' || JSON.stringify(val) === 'true') {
+ this.setData({
+ marquee: {
+ speed: 50,
+ loop: -1,
+ delay: 0,
+ },
+ });
+ }
+ },
+ 'icon, theme'(icon, theme) {
+ this.setData({
+ _icon: calcIcon(icon, THEME_ICON[theme]),
+ });
+ },
+ link(v) {
+ const _link = isObject(v) ? Object.assign({}, v) : { content: v };
+ this.setData({ _link });
+ },
+ closeBtn(v) {
+ this.setData({
+ _closeBtn: calcIcon(v, 'close'),
+ });
+ },
+ };
+ this.lifetimes = {
+ ready() {
+ this.memoInitialData();
+ },
+ detached() {
+ this.clearMessageAnimation();
+ },
+ };
+ }
+ memoInitialData() {
+ this.initialData = Object.assign(Object.assign({}, this.properties), this.data);
+ }
+ resetData(cb) {
+ this.setData(Object.assign({}, this.initialData), cb);
+ }
+ checkAnimation() {
+ const { marquee } = this.properties;
+ if (!marquee || marquee.loop === 0) {
+ return;
+ }
+ const speeding = marquee.speed;
+ if (this.data.loop > 0) {
+ this.data.loop -= 1;
+ }
+ else if (this.data.loop === 0) {
+ this.setData({ animation: this.resetAnimation.translateX(0).step().export() });
+ return;
+ }
+ if (this.nextAnimationContext) {
+ this.clearMessageAnimation();
+ }
+ const warpID = `#${name}__text-wrap`;
+ const nodeID = `#${name}__text`;
+ Promise.all([getRect(this, nodeID), getRect(this, warpID)]).then(([nodeRect, wrapRect]) => {
+ this.setData({
+ animation: this.resetAnimation.translateX(wrapRect.width).step().export(),
+ }, () => {
+ const durationTime = ((nodeRect.width + wrapRect.width) / speeding) * 1000;
+ const nextAnimation = wx
+ .createAnimation({
+ duration: durationTime,
+ })
+ .translateX(-nodeRect.width)
+ .step()
+ .export();
+ setTimeout(() => {
+ this.nextAnimationContext = setTimeout(this.checkAnimation.bind(this), durationTime);
+ this.setData({ animation: nextAnimation });
+ }, 20);
+ });
+ });
+ }
+ clearMessageAnimation() {
+ clearTimeout(this.nextAnimationContext);
+ this.nextAnimationContext = 0;
+ }
+ show(offsetHeight = 0) {
+ const { duration, marquee, offset, id } = this.properties;
+ this.setData({
+ visible: true,
+ loop: marquee.loop || this.data.loop,
+ fadeClass: `${name}__fade`,
+ wrapTop: unitConvert(offset[0]) + offsetHeight,
+ });
+ this.reset();
+ this.checkAnimation();
+ if (duration && duration > 0) {
+ this.closeTimeoutContext = setTimeout(() => {
+ this.hide();
+ this.triggerEvent('duration-end', { self: this });
+ }, duration);
+ }
+ const wrapID = id ? `#${id}` : `#${name}`;
+ getRect(this, wrapID).then((wrapRect) => {
+ this.setData({ height: wrapRect.height }, () => {
+ this.setData({
+ fadeClass: ``,
+ });
+ });
+ });
+ }
+ hide() {
+ this.reset();
+ this.setData({
+ fadeClass: `${name}__fade`,
+ });
+ setTimeout(() => {
+ this.setData({ visible: false, animation: [] });
+ }, SHOW_DURATION);
+ if (typeof this.onHide === 'function') {
+ this.onHide();
+ }
+ }
+ reset() {
+ if (this.nextAnimationContext) {
+ this.clearMessageAnimation();
+ }
+ clearTimeout(this.closeTimeoutContext);
+ this.closeTimeoutContext = 0;
+ }
+ handleClose() {
+ this.hide();
+ this.triggerEvent('close-btn-click');
+ }
+ handleLinkClick() {
+ this.triggerEvent('link-click');
+ }
+};
+Message = __decorate([
+ wxComponent()
+], Message);
+export default Message;
diff --git a/miniprogram_npm/tdesign-miniprogram/message-item/message-item.json b/miniprogram_npm/tdesign-miniprogram/message-item/message-item.json
new file mode 100644
index 0000000..e98fd68
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/message-item/message-item.json
@@ -0,0 +1,8 @@
+{
+ "component": true,
+ "styleIsolation": "apply-shared",
+ "usingComponents": {
+ "t-icon": "../icon/icon",
+ "t-link": "../link/link"
+ }
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/message-item/message-item.wxml b/miniprogram_npm/tdesign-miniprogram/message-item/message-item.wxml
new file mode 100644
index 0000000..8e92e24
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/message-item/message-item.wxml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{content}}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/miniprogram_npm/tdesign-miniprogram/message/message.wxs b/miniprogram_npm/tdesign-miniprogram/message-item/message-item.wxs
similarity index 68%
rename from miniprogram_npm/tdesign-miniprogram/message/message.wxs
rename to miniprogram_npm/tdesign-miniprogram/message-item/message-item.wxs
index 73d503c..4cf0bd9 100644
--- a/miniprogram_npm/tdesign-miniprogram/message/message.wxs
+++ b/miniprogram_npm/tdesign-miniprogram/message-item/message-item.wxs
@@ -9,12 +9,17 @@ var changeNumToStr = function (arr) {
};
var getMessageStyles = function (zIndex, offset, wrapTop) {
- var arr = changeNumToStr(offset);
- var styleOffset = '';
- styleOffset += 'top:' + changeNumToStr([wrapTop * 2]) + ';';
- styleOffset += 'right:' + arr[1] + ';';
- styleOffset += 'left:' + arr[1] + ';';
+ var arr = changeNumToStr(offset || [0, 0]);
+ var left = arr[1] || 0;
+ var right = arr[1] || 0;
+
var zIndexStyle = zIndex ? 'z-index:' + zIndex + ';' : '';
+ var styleOffset = '';
+
+ styleOffset += 'top:' + wrapTop + 'px;';
+ styleOffset += 'left:' + left + ';';
+ styleOffset += 'right:' + right + ';';
+
return zIndexStyle + styleOffset;
};
diff --git a/miniprogram_npm/tdesign-miniprogram/message-item/message-item.wxss b/miniprogram_npm/tdesign-miniprogram/message-item/message-item.wxss
new file mode 100644
index 0000000..2b0e579
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/message-item/message-item.wxss
@@ -0,0 +1,91 @@
+.t-float-left {
+ float: left;
+}
+.t-float-right {
+ float: right;
+}
+@keyframes tdesign-fade-out {
+ from {
+ opacity: 1;
+ }
+ to {
+ opacity: 0;
+ }
+}
+.hotspot-expanded.relative {
+ position: relative;
+}
+.hotspot-expanded::after {
+ content: '';
+ display: block;
+ position: absolute;
+ left: 0;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ transform: scale(1.5);
+}
+.t-message {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ transition: opacity 0.3s, transform 0.4s, top 0.4s;
+ display: flex;
+ justify-content: flex-start;
+ height: 96rpx;
+ align-items: center;
+ z-index: 15000;
+ padding: 0 32rpx;
+ box-sizing: border-box;
+ border-radius: var(--td-message-border-radius, var(--td-radius-default, 12rpx));
+ line-height: 1;
+ background-color: var(--td-message-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
+ box-shadow: var(--td-message-box-shadow, var(--td-shadow-1, 0 1px 10px rgba(0, 0, 0, 0.05), 0 4px 5px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.12)));
+}
+.t-message__text {
+ display: inline-block;
+ color: var(--td-message-content-font-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
+ font-size: var(--td-font-size-base, 28rpx);
+ line-height: 44rpx;
+}
+.t-message__text-wrap {
+ flex: 1 1 auto;
+ overflow-x: hidden;
+ text-overflow: ellipsis;
+}
+.t-message__text-nowrap {
+ word-break: keep-all;
+ white-space: nowrap;
+}
+.t-message--info {
+ color: var(--td-message-info-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
+}
+.t-message--success {
+ color: var(--td-message-success-color, var(--td-success-color, var(--td-success-color-5, #2ba471)));
+}
+.t-message--warning {
+ color: var(--td-message-warning-color, var(--td-warning-color, var(--td-warning-color-5, #e37318)));
+}
+.t-message--error {
+ color: var(--td-message-error-color, var(--td-error-color, var(--td-error-color-6, #d54941)));
+}
+.t-message__icon--left,
+.t-message__icon--right {
+ font-size: 44rpx;
+}
+.t-message__icon--left:not(:empty) {
+ margin-right: var(--td-spacer, 16rpx);
+}
+.t-message__icon--right {
+ color: var(--td-message-close-icon-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
+}
+.t-message__icon--right:not(:empty),
+.t-message__link {
+ flex: 0 0 auto;
+ margin-left: var(--td-spacer, 16rpx);
+}
+.t-message__fade {
+ opacity: 0;
+ transform: translateY(-100%);
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/message/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/message/README.en-US.md
index dd3225a..b614655 100644
--- a/miniprogram_npm/tdesign-miniprogram/message/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/message/README.en-US.md
@@ -1,22 +1,27 @@
:: BASE_DOC ::
## API
+
### Message Props
name | type | default | description | required
-- | -- | -- | -- | --
-action | String / Slot | - | operation | N
-align | String | left | options:left/center。Typescript:`MessageAlignType` `type MessageAlignType = 'left' \| 'center'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/message/type.ts) | N
-close-btn | String / Boolean / Object / Slot | false | \- | N
-content | String / Slot | - | \- | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+action | String / Slot | - | `deprecated`。operation。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+align | String | left | options: left/center。Typescript:`MessageAlignType` `type MessageAlignType = 'left' \| 'center'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/message/type.ts) | N
+close-btn | String / Boolean / Object / Slot | false | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+content | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
duration | Number | 3000 | \- | N
-external-classes | Array | - | `['t-class', 't-class-content', 't-class-icon', 't-class-link', 't-class-close-btn']` | N
-icon | String / Boolean / Object/ Slot | true | Typescript:`boolean \| 'info' \| 'bell'` | N
-marquee | Boolean / Object | false | Typescript:`boolean \| DrawMarquee` `interface DrawMarquee { speed?: number; loop?: number; delay?: number }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/message/type.ts) | N
+gap | String / Number / Boolean | 12 | \- | N
+icon | String / Boolean / Object / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+link | String / Object / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+marquee | Boolean / Object | false | Typescript:`boolean \| MessageMarquee` `interface MessageMarquee { speed?: number; loop?: number; delay?: number }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/message/type.ts) | N
offset | Array | - | Typescript:`Array` | N
-theme | String | info | options:info/success/warning/error。Typescript:`MessageThemeList` `type MessageThemeList = 'info' \| 'success' \| 'warning' \| 'error'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/message/type.ts) | N
+single | Boolean | true | \- | N
+theme | String | info | options: info/success/warning/error。Typescript:`MessageThemeList` `type MessageThemeList = 'info' \| 'success' \| 'warning' \| 'error'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/message/type.ts) | N
visible | Boolean | false | \- | N
-default-visible | Boolean | false | uncontrolled property | N
+default-visible | Boolean | undefined | uncontrolled property | N
z-index | Number | 15000 | \- | N
### Message Events
@@ -26,4 +31,28 @@ name | params | description
action-btn-click | - | \-
close-btn-click | - | \-
duration-end | \- | \-
-link-click | \- | \-
+link-click | - | \-
+### Message External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-close-btn | \-
+t-class-content | \-
+t-class-icon | \-
+t-class-link | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-message-bg-color | @bg-color-container | -
+--td-message-border-radius | @radius-default | -
+--td-message-box-shadow | @shadow-4 | -
+--td-message-close-icon-color | @font-gray-3 | -
+--td-message-content-font-color | @font-gray-1 | -
+--td-message-error-color | @error-color | -
+--td-message-info-color | @brand-color | -
+--td-message-success-color | @success-color | -
+--td-message-warning-color | @warning-color | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/message/README.md b/miniprogram_npm/tdesign-miniprogram/message/README.md
index 4660f7a..bd52765 100644
--- a/miniprogram_npm/tdesign-miniprogram/message/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/message/README.md
@@ -26,6 +26,12 @@ import Message from 'tdesign-miniprogram/message/index';
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
弹窗内容为纯文本、标题和副标题、带输入框,用 API `Message.info` 方法调用反馈类对话框。
@@ -41,24 +47,29 @@ import Message from 'tdesign-miniprogram/message/index';
{{ theme }}
## API
+
### Message Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-action | String / Slot | - | 已废弃。操作 | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+action | String / Slot | - | 已废弃。操作。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
align | String | left | 文本对齐方式。可选项:left/center。TS 类型:`MessageAlignType` `type MessageAlignType = 'left' \| 'center'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/message/type.ts) | N
-close-btn | String / Boolean / Object / Slot | false | 关闭按钮,可以自定义。值为 true 显示默认关闭按钮,值为 false 不显示关闭按钮。值类型为 string ,如:'user',则显示组件内置图标。值类型为 object ,则会透传至 icon 组件。| N
-content | String / Slot | - | 用于自定义消息弹出内容 | N
+close-btn | String / Boolean / Object / Slot | false | 关闭按钮,可以自定义。值为 true 显示默认关闭按钮,值为 false 不显示关闭按钮。值类型为 string ,如:'user',则显示组件内置图标。值类型为 object ,则会透传至 icon 组件。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+content | String / Slot | - | 用于自定义消息弹出内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
duration | Number | 3000 | 消息内置计时器,计时到达时会触发 duration-end 事件。单位:毫秒。值为 0 则表示没有计时器。 | N
-external-classes | Array | - | 样式类名,分别用于设置 组件外层、消息内容、左侧图标、操作按钮、关闭按钮等元素类名。`['t-class', 't-class-content', 't-class-icon', 't-class-link', 't-class-close-btn']` | N
-icon | String / Boolean / Object / Slot | true | 消息提醒前面的图标,可以自定义。值为 true 则根据 theme 显示对应的图标,值为 false 则不显示图标。值为 true 显示默认关闭按钮,值为 false 不显示关闭按钮。值类型为 string ,如:'info',则显示组件内置图标。值类型为 object ,则会透传至 icon 组件。| 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/message/type.ts) | N
+gap | String / Number / Boolean | 12 | 两条 `message` 之间的间距 | N
+icon | String / Boolean / Object / Slot | true | 消息提醒前面的图标,可以自定义。值为 true 则根据 theme 显示对应的图标,值为 false 则不显示图标。值为 true 显示默认关闭按钮,值为 false 不显示关闭按钮。值类型为 string ,如:'info',则显示组件内置图标。值类型为 object ,则会透传至 icon 组件。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+link | String / Object / Slot | - | 链接名称。值为字符串表示链接名称,值为 `Object` 类型,表示透传至 `Link`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+marquee | Boolean / Object | false | 跑马灯效果。speed 指速度控制;loop 指循环播放次数,值为 -1 表示循环播放,值为 0 表示不循环播放;delay 表示延迟多久开始播放。TS 类型:`boolean \| MessageMarquee` `interface MessageMarquee { speed?: number; loop?: number; delay?: number }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/message/type.ts) | N
offset | Array | - | 相对于 placement 的偏移量,默认单位 rpx。示例:[-10, 20] 或 ['10rpx', '8rpx']。TS 类型:`Array` | N
+single | Boolean | true | 是否保持仅显示一条信息 | N
theme | String | info | 消息组件风格。可选项:info/success/warning/error。TS 类型:`MessageThemeList` `type MessageThemeList = 'info' \| 'success' \| 'warning' \| 'error'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/message/type.ts) | N
visible | Boolean | false | 是否显示,隐藏时默认销毁组件 | N
-default-visible | Boolean | false | 是否显示,隐藏时默认销毁组件。非受控属性 | N
+default-visible | Boolean | undefined | 是否显示,隐藏时默认销毁组件。非受控属性 | N
z-index | Number | 15000 | 元素层级,样式默认为 15000 | N
-link | String / Object / Slot | - | 链接名称。值为字符串表示链接名称,值为 `Object` 类型,表示透传至 `Link`。 | N
+
### Message Events
名称 | 参数 | 描述
@@ -67,3 +78,27 @@ action-btn-click | - | 已废弃。当操作按钮存在时,用户点击操作
close-btn-click | - | 当关闭按钮存在时,用户点击关闭按钮触发
duration-end | \- | 计时结束后触发
link-click | - | 当`link`链接存在时,点击链接文本时触发
+### Message External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-close-btn | 关闭按钮样式类
+t-class-content | 内容样式类
+t-class-icon | 图标样式类
+t-class-link | 链接样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-message-bg-color | @bg-color-container | -
+--td-message-border-radius | @radius-default | -
+--td-message-box-shadow | @shadow-4 | -
+--td-message-close-icon-color | @font-gray-3 | -
+--td-message-content-font-color | @font-gray-1 | -
+--td-message-error-color | @error-color | -
+--td-message-info-color | @brand-color | -
+--td-message-success-color | @success-color | -
+--td-message-warning-color | @warning-color | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/message/index.js b/miniprogram_npm/tdesign-miniprogram/message/index.js
index 02b775a..7438e45 100644
--- a/miniprogram_npm/tdesign-miniprogram/message/index.js
+++ b/miniprogram_npm/tdesign-miniprogram/message/index.js
@@ -14,10 +14,11 @@ import { getInstance } from '../common/utils';
const showMessage = function (options, theme = MessageType.info) {
const { context, selector = '#t-message' } = options, otherOptions = __rest(options, ["context", "selector"]);
const instance = getInstance(context, selector);
+ if (typeof otherOptions.single !== 'boolean') {
+ otherOptions.single = true;
+ }
if (instance) {
- instance.resetData(() => {
- instance.setData(Object.assign({ theme }, otherOptions), instance.show.bind(instance));
- });
+ instance.setMessage(otherOptions, theme);
return instance;
}
console.error('未找到组件,请确认 selector && context 是否正确');
diff --git a/miniprogram_npm/tdesign-miniprogram/message/message.d.ts b/miniprogram_npm/tdesign-miniprogram/message/message.d.ts
index 0f0ef12..e3de7ca 100644
--- a/miniprogram_npm/tdesign-miniprogram/message/message.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/message/message.d.ts
@@ -1,36 +1,37 @@
///
import { SuperComponent, ComponentsOptionsType } from '../common/src/index';
-import { MessageProps } from './message.interface';
+import { MessageType, MessageProps } from './message.interface';
export default class Message extends SuperComponent {
- externalClasses: string[];
options: ComponentsOptionsType;
properties: MessageProps;
data: {
prefix: string;
classPrefix: string;
- loop: number;
- animation: any[];
- showAnimation: any[];
- wrapTop: number;
+ messageList: any[];
};
+ index: number;
+ instances: any[];
+ gap: number;
observers: {
- marquee(val: any): void;
- 'icon, theme'(icon: any, theme: any): void;
- link(v: any): void;
- closeBtn(v: any): void;
+ visible(value: any): void;
};
- closeTimeoutContext: number;
- nextAnimationContext: number;
- resetAnimation: WechatMiniprogram.Animation;
- ready(): void;
- memoInitalData(): void;
- resetData(cb: () => void): void;
- detached(): void;
- checkAnimation(): void;
- clearMessageAnimation(): void;
- show(): void;
- hide(): void;
- reset(): void;
+ pageLifetimes: {
+ show(): void;
+ };
+ lifetimes: {
+ ready(): void;
+ };
+ memoInitialData(): void;
+ setMessage(msg: MessageProps, theme?: MessageType): void;
+ addMessage(msgObj: MessageProps): void;
+ getOffsetHeight(index?: number): number;
+ showMessageItem(options: MessageProps, id: string, offsetHeight: number): WechatMiniprogram.Component.TrivialInstance;
+ close(id: any): void;
+ hide(id?: string): void;
+ hideAll(): void;
+ removeInstance(id: any): void;
+ removeMsg(id: any): void;
handleClose(): void;
handleLinkClick(): void;
+ handleDurationEnd(): void;
}
diff --git a/miniprogram_npm/tdesign-miniprogram/message/message.interface.d.ts b/miniprogram_npm/tdesign-miniprogram/message/message.interface.d.ts
index 9dce180..f633925 100644
--- a/miniprogram_npm/tdesign-miniprogram/message/message.interface.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/message/message.interface.d.ts
@@ -21,4 +21,7 @@ export interface MessageProps {
offset?: object;
duration?: number;
zIndex?: number;
+ id?: string;
+ gap?: string | number;
+ single?: boolean;
}
diff --git a/miniprogram_npm/tdesign-miniprogram/message/message.js b/miniprogram_npm/tdesign-miniprogram/message/message.js
index a7dfe5e..b240baa 100644
--- a/miniprogram_npm/tdesign-miniprogram/message/message.js
+++ b/miniprogram_npm/tdesign-miniprogram/message/message.js
@@ -6,177 +6,167 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
};
import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
+import { MessageType } from './message.interface';
import props from './props';
-import { getRect, unitConvert, calcIcon, isObject } from '../common/utils';
+import { unitConvert } from '../common/utils';
+const SHOW_DURATION = 400;
const { prefix } = config;
const name = `${prefix}-message`;
-const SHOW_DURATION = 500;
-const THEME_ICON = {
- info: 'info-circle-filled',
- success: 'check-circle-filled',
- warning: 'info-circle-filled',
- error: 'error-circle-filled',
-};
let Message = class Message extends SuperComponent {
constructor() {
super(...arguments);
- this.externalClasses = [
- `${prefix}-class`,
- `${prefix}-class-content`,
- `${prefix}-class-icon`,
- `${prefix}-class-action`,
- `${prefix}-class-close-btn`,
- ];
this.options = {
- styleIsolation: 'apply-shared',
multipleSlots: true,
};
this.properties = Object.assign({}, props);
this.data = {
prefix,
classPrefix: name,
- loop: -1,
- animation: [],
- showAnimation: [],
- wrapTop: -999,
+ messageList: [],
};
+ this.index = 0;
+ this.instances = [];
+ this.gap = 12;
this.observers = {
- marquee(val) {
- if (JSON.stringify(val) === '{}') {
+ visible(value) {
+ if (value) {
+ this.setMessage(this.properties, this.properties.theme);
+ }
+ else {
this.setData({
- marquee: {
- speed: 50,
- loop: -1,
- delay: 5000,
- },
+ messageList: [],
});
}
},
- 'icon, theme'(icon, theme) {
- this.setData({
- _icon: calcIcon(icon, THEME_ICON[theme]),
- });
- },
- link(v) {
- const _link = isObject(v) ? Object.assign({}, v) : { content: v };
- this.setData({ _link });
- },
- closeBtn(v) {
- this.setData({
- _closeBtn: calcIcon(v, 'close'),
- });
+ };
+ this.pageLifetimes = {
+ show() {
+ this.hideAll();
+ },
+ };
+ this.lifetimes = {
+ ready() {
+ this.memoInitialData();
},
};
- this.closeTimeoutContext = 0;
- this.nextAnimationContext = 0;
- this.resetAnimation = wx.createAnimation({
- duration: 0,
- timingFunction: 'linear',
- });
}
- ready() {
- this.memoInitalData();
+ memoInitialData() {
+ this.initialData = Object.assign(Object.assign({}, this.properties), this.data);
}
- memoInitalData() {
- this.initalData = Object.assign(Object.assign({}, this.properties), this.data);
- }
- resetData(cb) {
- this.setData(Object.assign({}, this.initalData), cb);
- }
- detached() {
- this.clearMessageAnimation();
- }
- checkAnimation() {
- if (!this.properties.marquee) {
- return;
+ setMessage(msg, theme = MessageType.info) {
+ let id = `${name}_${this.index}`;
+ if (msg.single) {
+ id = name;
}
- const speeding = this.properties.marquee.speed;
- if (this.data.loop > 0) {
- this.data.loop -= 1;
+ this.gap = unitConvert(msg.gap || this.gap);
+ const msgObj = Object.assign(Object.assign({}, msg), { theme,
+ id, gap: this.gap });
+ const instanceIndex = this.instances.findIndex((x) => x.id === id);
+ if (instanceIndex < 0) {
+ this.addMessage(msgObj);
}
- else if (this.data.loop === 0) {
- this.setData({ animation: this.resetAnimation.translateX(0).step().export() });
- return;
- }
- if (this.nextAnimationContext) {
- this.clearMessageAnimation();
- }
- const warpID = `#${name}__text-wrap`;
- const nodeID = `#${name}__text`;
- Promise.all([getRect(this, nodeID), getRect(this, warpID)]).then(([nodeRect, wrapRect]) => {
- this.setData({
- animation: this.resetAnimation.translateX(wrapRect.width).step().export(),
- }, () => {
- const durationTime = ((nodeRect.width + wrapRect.width) / speeding) * 1000;
- const nextAnimation = wx
- .createAnimation({
- duration: durationTime,
- })
- .translateX(-nodeRect.width)
- .step()
- .export();
- setTimeout(() => {
- this.nextAnimationContext = setTimeout(this.checkAnimation.bind(this), durationTime);
- this.setData({ animation: nextAnimation });
- }, 20);
+ else {
+ const instance = this.instances[instanceIndex];
+ const offsetHeight = this.getOffsetHeight(instanceIndex);
+ instance.resetData(() => {
+ instance.setData(msgObj, instance.show.bind(instance, offsetHeight));
+ instance.onHide = () => {
+ this.close(id);
+ };
});
- });
- }
- clearMessageAnimation() {
- clearTimeout(this.nextAnimationContext);
- this.nextAnimationContext = 0;
- }
- show() {
- const { duration, marquee, offset } = this.properties;
- this.setData({ visible: true, loop: marquee.loop });
- this.reset();
- this.checkAnimation();
- if (duration && duration > 0) {
- this.closeTimeoutContext = setTimeout(() => {
- this.hide();
- this.triggerEvent('duration-end', { self: this });
- }, duration);
}
- const wrapID = `#${name}`;
- getRect(this, wrapID).then((wrapRect) => {
- this.setData({ wrapTop: -wrapRect.height }, () => {
- this.setData({
- showAnimation: wx
- .createAnimation({ duration: SHOW_DURATION, timingFunction: 'ease' })
- .translateY(wrapRect.height + unitConvert(offset[0]))
- .step()
- .export(),
- });
- });
- });
}
- hide() {
- this.reset();
+ addMessage(msgObj) {
+ const list = [...this.data.messageList, { id: msgObj.id }];
this.setData({
- showAnimation: wx
- .createAnimation({ duration: SHOW_DURATION, timingFunction: 'ease' })
- .translateY(this.data.wrapTop)
- .step()
- .export(),
+ messageList: list,
+ }, () => {
+ const offsetHeight = this.getOffsetHeight();
+ const instance = this.showMessageItem(msgObj, msgObj.id, offsetHeight);
+ if (this.instances) {
+ this.instances.push(instance);
+ this.index += 1;
+ }
});
- setTimeout(() => {
- this.setData({ visible: false, animation: [] });
- }, SHOW_DURATION);
}
- reset() {
- if (this.nextAnimationContext) {
- this.clearMessageAnimation();
+ getOffsetHeight(index = -1) {
+ let offsetHeight = 0;
+ let len = index;
+ if (len === -1 || len > this.instances.length) {
+ len = this.instances.length;
+ }
+ for (let i = 0; i < len; i += 1) {
+ const instance = this.instances[i];
+ offsetHeight += instance.data.height + instance.data.gap;
+ }
+ return offsetHeight;
+ }
+ showMessageItem(options, id, offsetHeight) {
+ const instance = this.selectComponent(`#${id}`);
+ if (instance) {
+ instance.resetData(() => {
+ instance.setData(options, instance.show.bind(instance, offsetHeight));
+ instance.onHide = () => {
+ this.close(id);
+ };
+ });
+ return instance;
+ }
+ console.error('未找到组件,请确认 selector && context 是否正确');
+ }
+ close(id) {
+ setTimeout(() => {
+ this.removeMsg(id);
+ }, SHOW_DURATION);
+ this.removeInstance(id);
+ }
+ hide(id) {
+ if (!id) {
+ this.hideAll();
+ }
+ const instance = this.instances.find((x) => x.id === id);
+ if (instance) {
+ instance.hide();
+ }
+ }
+ hideAll() {
+ for (let i = 0; i < this.instances.length;) {
+ const instance = this.instances[i];
+ instance.hide();
+ }
+ }
+ removeInstance(id) {
+ const index = this.instances.findIndex((x) => x.id === id);
+ if (index < 0)
+ return;
+ const instance = this.instances[index];
+ const removedHeight = instance.data.height;
+ this.instances.splice(index, 1);
+ for (let i = index; i < this.instances.length; i += 1) {
+ const instance = this.instances[i];
+ instance.setData({
+ wrapTop: instance.data.wrapTop - removedHeight - instance.data.gap,
+ });
+ }
+ }
+ removeMsg(id) {
+ const msgIndex = this.data.messageList.findIndex((x) => x.id === id);
+ if (msgIndex > -1) {
+ this.data.messageList.splice(msgIndex, 1);
+ this.setData({
+ messageList: this.data.messageList,
+ });
}
- clearTimeout(this.closeTimeoutContext);
- this.closeTimeoutContext = 0;
}
handleClose() {
- this.hide();
this.triggerEvent('close-btn-click');
}
handleLinkClick() {
this.triggerEvent('link-click');
}
+ handleDurationEnd() {
+ this.triggerEvent('duration-end');
+ }
};
Message = __decorate([
wxComponent()
diff --git a/miniprogram_npm/tdesign-miniprogram/message/message.json b/miniprogram_npm/tdesign-miniprogram/message/message.json
index 75c11ff..6277a4f 100644
--- a/miniprogram_npm/tdesign-miniprogram/message/message.json
+++ b/miniprogram_npm/tdesign-miniprogram/message/message.json
@@ -1,7 +1,7 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
- "t-icon": "../icon/icon",
- "t-link": "../link/link"
+ "t-message-item": "../message-item/message-item"
}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/message/message.wxml b/miniprogram_npm/tdesign-miniprogram/message/message.wxml
index 1e508c9..75b002c 100644
--- a/miniprogram_npm/tdesign-miniprogram/message/message.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/message/message.wxml
@@ -1,55 +1,14 @@
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
- {{content}}
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/miniprogram_npm/tdesign-miniprogram/message/message.wxss b/miniprogram_npm/tdesign-miniprogram/message/message.wxss
index c782833..e69de29 100644
--- a/miniprogram_npm/tdesign-miniprogram/message/message.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/message/message.wxss
@@ -1,86 +0,0 @@
-.t-float-left {
- float: left;
-}
-.t-float-right {
- float: right;
-}
-@keyframes tdesign-fade-out {
- from {
- opacity: 1;
- }
- to {
- opacity: 0;
- }
-}
-.hotspot-expanded.relative {
- position: relative;
-}
-.hotspot-expanded::after {
- content: '';
- display: block;
- position: absolute;
- left: 0;
- top: 0;
- right: 0;
- bottom: 0;
- transform: scale(1.5);
-}
-.t-message {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- display: flex;
- justify-content: flex-start;
- height: 96rpx;
- align-items: center;
- z-index: 15000;
- padding: 0 32rpx;
- box-sizing: border-box;
- border-radius: var(--td-message-border-radius, var(--td-radius-default, 12rpx));
- line-height: 1;
- background-color: var(--td-message-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
- box-shadow: var(--td-message-box-shadow, var(--td-shadow-4, 0 2px 8px 0 rgba(0, 0, 0, 0.06)));
-}
-.t-message__text {
- display: inline-block;
- color: var(--td-message-content-font-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
- font-size: var(--td-font-size-base, 28rpx);
- line-height: 44rpx;
-}
-.t-message__text-wrap {
- flex: 1 1 auto;
- overflow-x: hidden;
- text-overflow: ellipsis;
-}
-.t-message__text-nowrap {
- word-break: keep-all;
- white-space: nowrap;
-}
-.t-message--info {
- color: var(--td-message-info-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
-}
-.t-message--success {
- color: var(--td-message-success-color, var(--td-success-color, var(--td-success-color-5, #2ba471)));
-}
-.t-message--warning {
- color: var(--td-message-warning-color, var(--td-warning-color, var(--td-warning-color-5, #e37318)));
-}
-.t-message--error {
- color: var(--td-message-error-color, var(--td-error-color, var(--td-error-color-6, #d54941)));
-}
-.t-message__icon--left,
-.t-message__icon--right {
- font-size: 44rpx;
-}
-.t-message__icon--left:not(:empty) {
- margin-right: var(--td-spacer, 16rpx);
-}
-.t-message__icon--right {
- color: var(--td-message-close-icon-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
-}
-.t-message__icon--right:not(:empty),
-.t-message__link {
- flex: 0 0 auto;
- margin-left: var(--td-spacer, 16rpx);
-}
diff --git a/miniprogram_npm/tdesign-miniprogram/message/props.js b/miniprogram_npm/tdesign-miniprogram/message/props.js
index 8a1188a..9d0e022 100644
--- a/miniprogram_npm/tdesign-miniprogram/message/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/message/props.js
@@ -1,7 +1,4 @@
const props = {
- action: {
- type: String,
- },
align: {
type: String,
value: 'left',
@@ -17,13 +14,17 @@ const props = {
type: Number,
value: 3000,
},
- externalClasses: {
- type: Array,
+ gap: {
+ type: null,
+ value: 12,
},
icon: {
type: null,
value: true,
},
+ link: {
+ type: null,
+ },
marquee: {
type: null,
value: false,
@@ -31,6 +32,10 @@ const props = {
offset: {
type: Array,
},
+ single: {
+ type: Boolean,
+ value: true,
+ },
theme: {
type: String,
value: 'info',
@@ -47,8 +52,5 @@ const props = {
type: Number,
value: 15000,
},
- link: {
- type: null,
- },
};
export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/message/type.d.ts b/miniprogram_npm/tdesign-miniprogram/message/type.d.ts
index 10c7570..718bb3a 100644
--- a/miniprogram_npm/tdesign-miniprogram/message/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/message/type.d.ts
@@ -1,44 +1,44 @@
export interface TdMessageProps {
- action?: {
- type: StringConstructor;
- value?: string;
- };
align?: {
type: StringConstructor;
value?: MessageAlignType;
};
closeBtn?: {
type: null;
- value?: string | boolean;
+ value?: string | boolean | object;
};
content?: {
type: StringConstructor;
value?: string;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
duration?: {
type: NumberConstructor;
value?: number;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-content', 't-class-icon', 't-class-action', 't-class-close-btn'];
+ gap?: {
+ type: null;
+ value?: string | number | boolean;
};
icon?: {
type: null;
- value?: boolean | 'info' | 'bell';
+ value?: string | boolean | object;
+ };
+ link?: {
+ type: null;
+ value?: string | object;
};
marquee?: {
type: null;
- value?: boolean | DrawMarquee;
+ value?: boolean | MessageMarquee;
};
offset?: {
type: ArrayConstructor;
value?: Array;
};
+ single?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
theme?: {
type: StringConstructor;
value?: MessageThemeList;
@@ -55,13 +55,9 @@ export interface TdMessageProps {
type: NumberConstructor;
value?: number;
};
- link?: {
- type: null;
- value?: string | object;
- };
}
export declare type MessageAlignType = 'left' | 'center';
-export interface DrawMarquee {
+export interface MessageMarquee {
speed?: number;
loop?: number;
delay?: number;
diff --git a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/dayjs/index.js b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/dayjs/index.js
index ba16e65..61916d8 100644
--- a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/dayjs/index.js
+++ b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/dayjs/index.js
@@ -1 +1 @@
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t)}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return O},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)=2&&n%10<=4&&(n%100<10||n%100>=20)?s[1]:s[2])}var u=function(_,t){return i.test(t)?n[_.month()]:s[_.month()]};u.s=s,u.f=n;var a=function(_,t){return i.test(t)?r[_.month()]:o[_.month()]};a.s=o,a.f=r;var m={name:"ru",weekdays:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),weekdaysShort:"вск_пнд_втр_срд_чтв_птн_сбт".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),months:u,monthsShort:a,weekStart:1,yearStart:4,formats:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., H:mm",LLLL:"dddd, D MMMM YYYY г., H:mm"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",m:d,mm:d,h:"час",hh:d,d:"день",dd:d,M:"месяц",MM:d,y:"год",yy:d},ordinal:function(_){return _},meridiem:function(_){return _<4?"ночи":_<12?"утра":_<17?"дня":"вечера"}};return e.default.locale(m,null,!0),m}));
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/dayjs/locale/zh-cn.js b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/dayjs/locale/zh-cn.js
new file mode 100644
index 0000000..21cf228
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/dayjs/locale/zh-cn.js
@@ -0,0 +1 @@
+!function(e,_){"object"==typeof exports&&"undefined"!=typeof module?module.exports=_(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],_):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_locale_zh_cn=_(e.dayjs)}(this,(function(e){"use strict";function _(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=_(e),d={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(e,_){return"W"===_?e+"周":e+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(e,_){var t=100*e+_;return t<600?"凌晨":t<900?"早上":t<1100?"上午":t<1300?"中午":t<1800?"下午":"晚上"}};return t.default.locale(d,null,!0),d}));
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/dayjs/locale/zh-tw.js b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/dayjs/locale/zh-tw.js
new file mode 100644
index 0000000..5970f17
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/dayjs/locale/zh-tw.js
@@ -0,0 +1 @@
+!function(_,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],e):(_="undefined"!=typeof globalThis?globalThis:_||self).dayjs_locale_zh_tw=e(_.dayjs)}(this,(function(_){"use strict";function e(_){return _&&"object"==typeof _&&"default"in _?_:{default:_}}var t=e(_),d={name:"zh-tw",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(_,e){return"W"===e?_+"週":_+"日"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"},meridiem:function(_,e){var t=100*_+e;return t<600?"凌晨":t<900?"早上":t<1100?"上午":t<1300?"中午":t<1800?"下午":"晚上"}};return t.default.locale(d,null,!0),d}));
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/dayjs/plugin/localeData.js b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/dayjs/plugin/localeData.js
new file mode 100644
index 0000000..55e01ee
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/dayjs/plugin/localeData.js
@@ -0,0 +1 @@
+!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n="undefined"!=typeof globalThis?globalThis:n||self).dayjs_plugin_localeData=e()}(this,(function(){"use strict";return function(n,e,t){var r=e.prototype,o=function(n){return n&&(n.indexOf?n:n.s)},u=function(n,e,t,r,u){var i=n.name?n:n.$locale(),a=o(i[e]),s=o(i[t]),f=a||s.map((function(n){return n.slice(0,r)}));if(!u)return f;var d=i.weekStart;return f.map((function(n,e){return f[(e+(d||0))%7]}))},i=function(){return t.Ls[t.locale()]},a=function(n,e){return n.formats[e]||function(n){return n.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(n,e,t){return e||t.slice(1)}))}(n.formats[e.toUpperCase()])},s=function(){var n=this;return{months:function(e){return e?e.format("MMMM"):u(n,"months")},monthsShort:function(e){return e?e.format("MMM"):u(n,"monthsShort","months",3)},firstDayOfWeek:function(){return n.$locale().weekStart||0},weekdays:function(e){return e?e.format("dddd"):u(n,"weekdays")},weekdaysMin:function(e){return e?e.format("dd"):u(n,"weekdaysMin","weekdays",2)},weekdaysShort:function(e){return e?e.format("ddd"):u(n,"weekdaysShort","weekdays",3)},longDateFormat:function(e){return a(n.$locale(),e)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};r.localeData=function(){return s.bind(this)()},t.localeData=function(){var n=i();return{firstDayOfWeek:function(){return n.weekStart||0},weekdays:function(){return t.weekdays()},weekdaysShort:function(){return t.weekdaysShort()},weekdaysMin:function(){return t.weekdaysMin()},months:function(){return t.months()},monthsShort:function(){return t.monthsShort()},longDateFormat:function(e){return a(n,e)},meridiem:n.meridiem,ordinal:n.ordinal}},t.months=function(){return u(i(),"months")},t.monthsShort=function(){return u(i(),"monthsShort","months",3)},t.weekdays=function(n){return u(i(),"weekdays",null,null,n)},t.weekdaysShort=function(n){return u(i(),"weekdaysShort","weekdays",3,n)},t.weekdaysMin=function(n){return u(i(),"weekdaysMin","weekdays",2,n)}}}));
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_Symbol.js b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_Symbol.js
new file mode 100644
index 0000000..a013f7c
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_Symbol.js
@@ -0,0 +1,6 @@
+var root = require('./_root');
+
+/** Built-in value references. */
+var Symbol = root.Symbol;
+
+module.exports = Symbol;
diff --git a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_baseGetTag.js b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_baseGetTag.js
new file mode 100644
index 0000000..b927ccc
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_baseGetTag.js
@@ -0,0 +1,28 @@
+var Symbol = require('./_Symbol'),
+ getRawTag = require('./_getRawTag'),
+ objectToString = require('./_objectToString');
+
+/** `Object#toString` result references. */
+var nullTag = '[object Null]',
+ undefinedTag = '[object Undefined]';
+
+/** Built-in value references. */
+var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
+
+/**
+ * The base implementation of `getTag` without fallbacks for buggy environments.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @returns {string} Returns the `toStringTag`.
+ */
+function baseGetTag(value) {
+ if (value == null) {
+ return value === undefined ? undefinedTag : nullTag;
+ }
+ return (symToStringTag && symToStringTag in Object(value))
+ ? getRawTag(value)
+ : objectToString(value);
+}
+
+module.exports = baseGetTag;
diff --git a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_freeGlobal.js b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_freeGlobal.js
new file mode 100644
index 0000000..bbec998
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_freeGlobal.js
@@ -0,0 +1,4 @@
+/** Detect free variable `global` from Node.js. */
+var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
+
+module.exports = freeGlobal;
diff --git a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_getRawTag.js b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_getRawTag.js
new file mode 100644
index 0000000..49a95c9
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_getRawTag.js
@@ -0,0 +1,46 @@
+var Symbol = require('./_Symbol');
+
+/** Used for built-in method references. */
+var objectProto = Object.prototype;
+
+/** Used to check objects for own properties. */
+var hasOwnProperty = objectProto.hasOwnProperty;
+
+/**
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+var nativeObjectToString = objectProto.toString;
+
+/** Built-in value references. */
+var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
+
+/**
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @returns {string} Returns the raw `toStringTag`.
+ */
+function getRawTag(value) {
+ var isOwn = hasOwnProperty.call(value, symToStringTag),
+ tag = value[symToStringTag];
+
+ try {
+ value[symToStringTag] = undefined;
+ var unmasked = true;
+ } catch (e) {}
+
+ var result = nativeObjectToString.call(value);
+ if (unmasked) {
+ if (isOwn) {
+ value[symToStringTag] = tag;
+ } else {
+ delete value[symToStringTag];
+ }
+ }
+ return result;
+}
+
+module.exports = getRawTag;
diff --git a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_objectToString.js b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_objectToString.js
new file mode 100644
index 0000000..c614ec0
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_objectToString.js
@@ -0,0 +1,22 @@
+/** Used for built-in method references. */
+var objectProto = Object.prototype;
+
+/**
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+var nativeObjectToString = objectProto.toString;
+
+/**
+ * Converts `value` to a string using `Object.prototype.toString`.
+ *
+ * @private
+ * @param {*} value The value to convert.
+ * @returns {string} Returns the converted string.
+ */
+function objectToString(value) {
+ return nativeObjectToString.call(value);
+}
+
+module.exports = objectToString;
diff --git a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_root.js b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_root.js
new file mode 100644
index 0000000..d2852be
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/_root.js
@@ -0,0 +1,9 @@
+var freeGlobal = require('./_freeGlobal');
+
+/** Detect free variable `self`. */
+var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
+
+/** Used as a reference to the global object. */
+var root = freeGlobal || freeSelf || Function('return this')();
+
+module.exports = root;
diff --git a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/isArray.js b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/isArray.js
new file mode 100644
index 0000000..88ab55f
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/isArray.js
@@ -0,0 +1,26 @@
+/**
+ * Checks if `value` is classified as an `Array` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
+ * @example
+ *
+ * _.isArray([1, 2, 3]);
+ * // => true
+ *
+ * _.isArray(document.body.children);
+ * // => false
+ *
+ * _.isArray('abc');
+ * // => false
+ *
+ * _.isArray(_.noop);
+ * // => false
+ */
+var isArray = Array.isArray;
+
+module.exports = isArray;
diff --git a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/isNull.js b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/isNull.js
new file mode 100644
index 0000000..c0a374d
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/isNull.js
@@ -0,0 +1,22 @@
+/**
+ * Checks if `value` is `null`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
+ * @example
+ *
+ * _.isNull(null);
+ * // => true
+ *
+ * _.isNull(void 0);
+ * // => false
+ */
+function isNull(value) {
+ return value === null;
+}
+
+module.exports = isNull;
diff --git a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/isObjectLike.js b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/isObjectLike.js
new file mode 100644
index 0000000..301716b
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/isObjectLike.js
@@ -0,0 +1,29 @@
+/**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ * @example
+ *
+ * _.isObjectLike({});
+ * // => true
+ *
+ * _.isObjectLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
+ */
+function isObjectLike(value) {
+ return value != null && typeof value == 'object';
+}
+
+module.exports = isObjectLike;
diff --git a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/isString.js b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/isString.js
new file mode 100644
index 0000000..627eb9c
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/lodash/isString.js
@@ -0,0 +1,30 @@
+var baseGetTag = require('./_baseGetTag'),
+ isArray = require('./isArray'),
+ isObjectLike = require('./isObjectLike');
+
+/** `Object#toString` result references. */
+var stringTag = '[object String]';
+
+/**
+ * Checks if `value` is classified as a `String` primitive or object.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a string, else `false`.
+ * @example
+ *
+ * _.isString('abc');
+ * // => true
+ *
+ * _.isString(1);
+ * // => false
+ */
+function isString(value) {
+ return typeof value == 'string' ||
+ (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
+}
+
+module.exports = isString;
diff --git a/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/tinycolor2/index.js b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/tinycolor2/index.js
new file mode 100644
index 0000000..4f584ca
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/miniprogram_npm/tinycolor2/index.js
@@ -0,0 +1,1188 @@
+// This file is autogenerated. It's used to publish CJS to npm.
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.tinycolor = factory());
+})(this, (function () { 'use strict';
+
+ function _typeof(obj) {
+ "@babel/helpers - typeof";
+
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
+ return typeof obj;
+ } : function (obj) {
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
+ }, _typeof(obj);
+ }
+
+ // https://github.com/bgrins/TinyColor
+ // Brian Grinstead, MIT License
+
+ var trimLeft = /^\s+/;
+ var trimRight = /\s+$/;
+ function tinycolor(color, opts) {
+ color = color ? color : "";
+ opts = opts || {};
+
+ // If input is already a tinycolor, return itself
+ if (color instanceof tinycolor) {
+ return color;
+ }
+ // If we are called as a function, call using new instead
+ if (!(this instanceof tinycolor)) {
+ return new tinycolor(color, opts);
+ }
+ var rgb = inputToRGB(color);
+ this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
+ this._gradientType = opts.gradientType;
+
+ // Don't let the range of [0,255] come back in [0,1].
+ // Potentially lose a little bit of precision here, but will fix issues where
+ // .5 gets interpreted as half of the total, instead of half of 1
+ // If it was supposed to be 128, this was already taken care of by `inputToRgb`
+ if (this._r < 1) this._r = Math.round(this._r);
+ if (this._g < 1) this._g = Math.round(this._g);
+ if (this._b < 1) this._b = Math.round(this._b);
+ this._ok = rgb.ok;
+ }
+ tinycolor.prototype = {
+ isDark: function isDark() {
+ return this.getBrightness() < 128;
+ },
+ isLight: function isLight() {
+ return !this.isDark();
+ },
+ isValid: function isValid() {
+ return this._ok;
+ },
+ getOriginalInput: function getOriginalInput() {
+ return this._originalInput;
+ },
+ getFormat: function getFormat() {
+ return this._format;
+ },
+ getAlpha: function getAlpha() {
+ return this._a;
+ },
+ getBrightness: function getBrightness() {
+ //http://www.w3.org/TR/AERT#color-contrast
+ var rgb = this.toRgb();
+ return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
+ },
+ getLuminance: function getLuminance() {
+ //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
+ var rgb = this.toRgb();
+ var RsRGB, GsRGB, BsRGB, R, G, B;
+ RsRGB = rgb.r / 255;
+ GsRGB = rgb.g / 255;
+ BsRGB = rgb.b / 255;
+ if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
+ if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
+ if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
+ return 0.2126 * R + 0.7152 * G + 0.0722 * B;
+ },
+ setAlpha: function setAlpha(value) {
+ this._a = boundAlpha(value);
+ this._roundA = Math.round(100 * this._a) / 100;
+ return this;
+ },
+ toHsv: function toHsv() {
+ var hsv = rgbToHsv(this._r, this._g, this._b);
+ return {
+ h: hsv.h * 360,
+ s: hsv.s,
+ v: hsv.v,
+ a: this._a
+ };
+ },
+ toHsvString: function toHsvString() {
+ var hsv = rgbToHsv(this._r, this._g, this._b);
+ var h = Math.round(hsv.h * 360),
+ s = Math.round(hsv.s * 100),
+ v = Math.round(hsv.v * 100);
+ return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
+ },
+ toHsl: function toHsl() {
+ var hsl = rgbToHsl(this._r, this._g, this._b);
+ return {
+ h: hsl.h * 360,
+ s: hsl.s,
+ l: hsl.l,
+ a: this._a
+ };
+ },
+ toHslString: function toHslString() {
+ var hsl = rgbToHsl(this._r, this._g, this._b);
+ var h = Math.round(hsl.h * 360),
+ s = Math.round(hsl.s * 100),
+ l = Math.round(hsl.l * 100);
+ return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
+ },
+ toHex: function toHex(allow3Char) {
+ return rgbToHex(this._r, this._g, this._b, allow3Char);
+ },
+ toHexString: function toHexString(allow3Char) {
+ return "#" + this.toHex(allow3Char);
+ },
+ toHex8: function toHex8(allow4Char) {
+ return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
+ },
+ toHex8String: function toHex8String(allow4Char) {
+ return "#" + this.toHex8(allow4Char);
+ },
+ toRgb: function toRgb() {
+ return {
+ r: Math.round(this._r),
+ g: Math.round(this._g),
+ b: Math.round(this._b),
+ a: this._a
+ };
+ },
+ toRgbString: function toRgbString() {
+ return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
+ },
+ toPercentageRgb: function toPercentageRgb() {
+ return {
+ r: Math.round(bound01(this._r, 255) * 100) + "%",
+ g: Math.round(bound01(this._g, 255) * 100) + "%",
+ b: Math.round(bound01(this._b, 255) * 100) + "%",
+ a: this._a
+ };
+ },
+ toPercentageRgbString: function toPercentageRgbString() {
+ return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
+ },
+ toName: function toName() {
+ if (this._a === 0) {
+ return "transparent";
+ }
+ if (this._a < 1) {
+ return false;
+ }
+ return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
+ },
+ toFilter: function toFilter(secondColor) {
+ var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
+ var secondHex8String = hex8String;
+ var gradientType = this._gradientType ? "GradientType = 1, " : "";
+ if (secondColor) {
+ var s = tinycolor(secondColor);
+ secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
+ }
+ return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
+ },
+ toString: function toString(format) {
+ var formatSet = !!format;
+ format = format || this._format;
+ var formattedString = false;
+ var hasAlpha = this._a < 1 && this._a >= 0;
+ var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
+ if (needsAlphaFormat) {
+ // Special case for "transparent", all other non-alpha formats
+ // will return rgba when there is transparency.
+ if (format === "name" && this._a === 0) {
+ return this.toName();
+ }
+ return this.toRgbString();
+ }
+ if (format === "rgb") {
+ formattedString = this.toRgbString();
+ }
+ if (format === "prgb") {
+ formattedString = this.toPercentageRgbString();
+ }
+ if (format === "hex" || format === "hex6") {
+ formattedString = this.toHexString();
+ }
+ if (format === "hex3") {
+ formattedString = this.toHexString(true);
+ }
+ if (format === "hex4") {
+ formattedString = this.toHex8String(true);
+ }
+ if (format === "hex8") {
+ formattedString = this.toHex8String();
+ }
+ if (format === "name") {
+ formattedString = this.toName();
+ }
+ if (format === "hsl") {
+ formattedString = this.toHslString();
+ }
+ if (format === "hsv") {
+ formattedString = this.toHsvString();
+ }
+ return formattedString || this.toHexString();
+ },
+ clone: function clone() {
+ return tinycolor(this.toString());
+ },
+ _applyModification: function _applyModification(fn, args) {
+ var color = fn.apply(null, [this].concat([].slice.call(args)));
+ this._r = color._r;
+ this._g = color._g;
+ this._b = color._b;
+ this.setAlpha(color._a);
+ return this;
+ },
+ lighten: function lighten() {
+ return this._applyModification(_lighten, arguments);
+ },
+ brighten: function brighten() {
+ return this._applyModification(_brighten, arguments);
+ },
+ darken: function darken() {
+ return this._applyModification(_darken, arguments);
+ },
+ desaturate: function desaturate() {
+ return this._applyModification(_desaturate, arguments);
+ },
+ saturate: function saturate() {
+ return this._applyModification(_saturate, arguments);
+ },
+ greyscale: function greyscale() {
+ return this._applyModification(_greyscale, arguments);
+ },
+ spin: function spin() {
+ return this._applyModification(_spin, arguments);
+ },
+ _applyCombination: function _applyCombination(fn, args) {
+ return fn.apply(null, [this].concat([].slice.call(args)));
+ },
+ analogous: function analogous() {
+ return this._applyCombination(_analogous, arguments);
+ },
+ complement: function complement() {
+ return this._applyCombination(_complement, arguments);
+ },
+ monochromatic: function monochromatic() {
+ return this._applyCombination(_monochromatic, arguments);
+ },
+ splitcomplement: function splitcomplement() {
+ return this._applyCombination(_splitcomplement, arguments);
+ },
+ // Disabled until https://github.com/bgrins/TinyColor/issues/254
+ // polyad: function (number) {
+ // return this._applyCombination(polyad, [number]);
+ // },
+ triad: function triad() {
+ return this._applyCombination(polyad, [3]);
+ },
+ tetrad: function tetrad() {
+ return this._applyCombination(polyad, [4]);
+ }
+ };
+
+ // If input is an object, force 1 into "1.0" to handle ratios properly
+ // String input requires "1.0" as input, so 1 will be treated as 1
+ tinycolor.fromRatio = function (color, opts) {
+ if (_typeof(color) == "object") {
+ var newColor = {};
+ for (var i in color) {
+ if (color.hasOwnProperty(i)) {
+ if (i === "a") {
+ newColor[i] = color[i];
+ } else {
+ newColor[i] = convertToPercentage(color[i]);
+ }
+ }
+ }
+ color = newColor;
+ }
+ return tinycolor(color, opts);
+ };
+
+ // Given a string or object, convert that input to RGB
+ // Possible string inputs:
+ //
+ // "red"
+ // "#f00" or "f00"
+ // "#ff0000" or "ff0000"
+ // "#ff000000" or "ff000000"
+ // "rgb 255 0 0" or "rgb (255, 0, 0)"
+ // "rgb 1.0 0 0" or "rgb (1, 0, 0)"
+ // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
+ // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
+ // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
+ // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
+ // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
+ //
+ function inputToRGB(color) {
+ var rgb = {
+ r: 0,
+ g: 0,
+ b: 0
+ };
+ var a = 1;
+ var s = null;
+ var v = null;
+ var l = null;
+ var ok = false;
+ var format = false;
+ if (typeof color == "string") {
+ color = stringInputToObject(color);
+ }
+ if (_typeof(color) == "object") {
+ if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
+ rgb = rgbToRgb(color.r, color.g, color.b);
+ ok = true;
+ format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
+ } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
+ s = convertToPercentage(color.s);
+ v = convertToPercentage(color.v);
+ rgb = hsvToRgb(color.h, s, v);
+ ok = true;
+ format = "hsv";
+ } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
+ s = convertToPercentage(color.s);
+ l = convertToPercentage(color.l);
+ rgb = hslToRgb(color.h, s, l);
+ ok = true;
+ format = "hsl";
+ }
+ if (color.hasOwnProperty("a")) {
+ a = color.a;
+ }
+ }
+ a = boundAlpha(a);
+ return {
+ ok: ok,
+ format: color.format || format,
+ r: Math.min(255, Math.max(rgb.r, 0)),
+ g: Math.min(255, Math.max(rgb.g, 0)),
+ b: Math.min(255, Math.max(rgb.b, 0)),
+ a: a
+ };
+ }
+
+ // Conversion Functions
+ // --------------------
+
+ // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
+ //
+
+ // `rgbToRgb`
+ // Handle bounds / percentage checking to conform to CSS color spec
+ //
+ // *Assumes:* r, g, b in [0, 255] or [0, 1]
+ // *Returns:* { r, g, b } in [0, 255]
+ function rgbToRgb(r, g, b) {
+ return {
+ r: bound01(r, 255) * 255,
+ g: bound01(g, 255) * 255,
+ b: bound01(b, 255) * 255
+ };
+ }
+
+ // `rgbToHsl`
+ // Converts an RGB color value to HSL.
+ // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
+ // *Returns:* { h, s, l } in [0,1]
+ function rgbToHsl(r, g, b) {
+ r = bound01(r, 255);
+ g = bound01(g, 255);
+ b = bound01(b, 255);
+ var max = Math.max(r, g, b),
+ min = Math.min(r, g, b);
+ var h,
+ s,
+ l = (max + min) / 2;
+ if (max == min) {
+ h = s = 0; // achromatic
+ } else {
+ var d = max - min;
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
+ switch (max) {
+ case r:
+ h = (g - b) / d + (g < b ? 6 : 0);
+ break;
+ case g:
+ h = (b - r) / d + 2;
+ break;
+ case b:
+ h = (r - g) / d + 4;
+ break;
+ }
+ h /= 6;
+ }
+ return {
+ h: h,
+ s: s,
+ l: l
+ };
+ }
+
+ // `hslToRgb`
+ // Converts an HSL color value to RGB.
+ // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
+ // *Returns:* { r, g, b } in the set [0, 255]
+ function hslToRgb(h, s, l) {
+ var r, g, b;
+ h = bound01(h, 360);
+ s = bound01(s, 100);
+ l = bound01(l, 100);
+ function hue2rgb(p, q, t) {
+ if (t < 0) t += 1;
+ if (t > 1) t -= 1;
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
+ if (t < 1 / 2) return q;
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
+ return p;
+ }
+ if (s === 0) {
+ r = g = b = l; // achromatic
+ } else {
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
+ var p = 2 * l - q;
+ r = hue2rgb(p, q, h + 1 / 3);
+ g = hue2rgb(p, q, h);
+ b = hue2rgb(p, q, h - 1 / 3);
+ }
+ return {
+ r: r * 255,
+ g: g * 255,
+ b: b * 255
+ };
+ }
+
+ // `rgbToHsv`
+ // Converts an RGB color value to HSV
+ // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
+ // *Returns:* { h, s, v } in [0,1]
+ function rgbToHsv(r, g, b) {
+ r = bound01(r, 255);
+ g = bound01(g, 255);
+ b = bound01(b, 255);
+ var max = Math.max(r, g, b),
+ min = Math.min(r, g, b);
+ var h,
+ s,
+ v = max;
+ var d = max - min;
+ s = max === 0 ? 0 : d / max;
+ if (max == min) {
+ h = 0; // achromatic
+ } else {
+ switch (max) {
+ case r:
+ h = (g - b) / d + (g < b ? 6 : 0);
+ break;
+ case g:
+ h = (b - r) / d + 2;
+ break;
+ case b:
+ h = (r - g) / d + 4;
+ break;
+ }
+ h /= 6;
+ }
+ return {
+ h: h,
+ s: s,
+ v: v
+ };
+ }
+
+ // `hsvToRgb`
+ // Converts an HSV color value to RGB.
+ // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
+ // *Returns:* { r, g, b } in the set [0, 255]
+ function hsvToRgb(h, s, v) {
+ h = bound01(h, 360) * 6;
+ s = bound01(s, 100);
+ v = bound01(v, 100);
+ var i = Math.floor(h),
+ f = h - i,
+ p = v * (1 - s),
+ q = v * (1 - f * s),
+ t = v * (1 - (1 - f) * s),
+ mod = i % 6,
+ r = [v, q, p, p, t, v][mod],
+ g = [t, v, v, q, p, p][mod],
+ b = [p, p, t, v, v, q][mod];
+ return {
+ r: r * 255,
+ g: g * 255,
+ b: b * 255
+ };
+ }
+
+ // `rgbToHex`
+ // Converts an RGB color to hex
+ // Assumes r, g, and b are contained in the set [0, 255]
+ // Returns a 3 or 6 character hex
+ function rgbToHex(r, g, b, allow3Char) {
+ var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
+
+ // Return a 3 character hex if possible
+ if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
+ return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
+ }
+ return hex.join("");
+ }
+
+ // `rgbaToHex`
+ // Converts an RGBA color plus alpha transparency to hex
+ // Assumes r, g, b are contained in the set [0, 255] and
+ // a in [0, 1]. Returns a 4 or 8 character rgba hex
+ function rgbaToHex(r, g, b, a, allow4Char) {
+ var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
+
+ // Return a 4 character hex if possible
+ if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
+ return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
+ }
+ return hex.join("");
+ }
+
+ // `rgbaToArgbHex`
+ // Converts an RGBA color to an ARGB Hex8 string
+ // Rarely used, but required for "toFilter()"
+ function rgbaToArgbHex(r, g, b, a) {
+ var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
+ return hex.join("");
+ }
+
+ // `equals`
+ // Can be called with any tinycolor input
+ tinycolor.equals = function (color1, color2) {
+ if (!color1 || !color2) return false;
+ return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
+ };
+ tinycolor.random = function () {
+ return tinycolor.fromRatio({
+ r: Math.random(),
+ g: Math.random(),
+ b: Math.random()
+ });
+ };
+
+ // Modification Functions
+ // ----------------------
+ // Thanks to less.js for some of the basics here
+ //
+
+ function _desaturate(color, amount) {
+ amount = amount === 0 ? 0 : amount || 10;
+ var hsl = tinycolor(color).toHsl();
+ hsl.s -= amount / 100;
+ hsl.s = clamp01(hsl.s);
+ return tinycolor(hsl);
+ }
+ function _saturate(color, amount) {
+ amount = amount === 0 ? 0 : amount || 10;
+ var hsl = tinycolor(color).toHsl();
+ hsl.s += amount / 100;
+ hsl.s = clamp01(hsl.s);
+ return tinycolor(hsl);
+ }
+ function _greyscale(color) {
+ return tinycolor(color).desaturate(100);
+ }
+ function _lighten(color, amount) {
+ amount = amount === 0 ? 0 : amount || 10;
+ var hsl = tinycolor(color).toHsl();
+ hsl.l += amount / 100;
+ hsl.l = clamp01(hsl.l);
+ return tinycolor(hsl);
+ }
+ function _brighten(color, amount) {
+ amount = amount === 0 ? 0 : amount || 10;
+ var rgb = tinycolor(color).toRgb();
+ rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
+ rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
+ rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
+ return tinycolor(rgb);
+ }
+ function _darken(color, amount) {
+ amount = amount === 0 ? 0 : amount || 10;
+ var hsl = tinycolor(color).toHsl();
+ hsl.l -= amount / 100;
+ hsl.l = clamp01(hsl.l);
+ return tinycolor(hsl);
+ }
+
+ // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
+ // Values outside of this range will be wrapped into this range.
+ function _spin(color, amount) {
+ var hsl = tinycolor(color).toHsl();
+ var hue = (hsl.h + amount) % 360;
+ hsl.h = hue < 0 ? 360 + hue : hue;
+ return tinycolor(hsl);
+ }
+
+ // Combination Functions
+ // ---------------------
+ // Thanks to jQuery xColor for some of the ideas behind these
+ //
+
+ function _complement(color) {
+ var hsl = tinycolor(color).toHsl();
+ hsl.h = (hsl.h + 180) % 360;
+ return tinycolor(hsl);
+ }
+ function polyad(color, number) {
+ if (isNaN(number) || number <= 0) {
+ throw new Error("Argument to polyad must be a positive number");
+ }
+ var hsl = tinycolor(color).toHsl();
+ var result = [tinycolor(color)];
+ var step = 360 / number;
+ for (var i = 1; i < number; i++) {
+ result.push(tinycolor({
+ h: (hsl.h + i * step) % 360,
+ s: hsl.s,
+ l: hsl.l
+ }));
+ }
+ return result;
+ }
+ function _splitcomplement(color) {
+ var hsl = tinycolor(color).toHsl();
+ var h = hsl.h;
+ return [tinycolor(color), tinycolor({
+ h: (h + 72) % 360,
+ s: hsl.s,
+ l: hsl.l
+ }), tinycolor({
+ h: (h + 216) % 360,
+ s: hsl.s,
+ l: hsl.l
+ })];
+ }
+ function _analogous(color, results, slices) {
+ results = results || 6;
+ slices = slices || 30;
+ var hsl = tinycolor(color).toHsl();
+ var part = 360 / slices;
+ var ret = [tinycolor(color)];
+ for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
+ hsl.h = (hsl.h + part) % 360;
+ ret.push(tinycolor(hsl));
+ }
+ return ret;
+ }
+ function _monochromatic(color, results) {
+ results = results || 6;
+ var hsv = tinycolor(color).toHsv();
+ var h = hsv.h,
+ s = hsv.s,
+ v = hsv.v;
+ var ret = [];
+ var modification = 1 / results;
+ while (results--) {
+ ret.push(tinycolor({
+ h: h,
+ s: s,
+ v: v
+ }));
+ v = (v + modification) % 1;
+ }
+ return ret;
+ }
+
+ // Utility Functions
+ // ---------------------
+
+ tinycolor.mix = function (color1, color2, amount) {
+ amount = amount === 0 ? 0 : amount || 50;
+ var rgb1 = tinycolor(color1).toRgb();
+ var rgb2 = tinycolor(color2).toRgb();
+ var p = amount / 100;
+ var rgba = {
+ r: (rgb2.r - rgb1.r) * p + rgb1.r,
+ g: (rgb2.g - rgb1.g) * p + rgb1.g,
+ b: (rgb2.b - rgb1.b) * p + rgb1.b,
+ a: (rgb2.a - rgb1.a) * p + rgb1.a
+ };
+ return tinycolor(rgba);
+ };
+
+ // Readability Functions
+ // ---------------------
+ // false
+ // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
+ tinycolor.isReadable = function (color1, color2, wcag2) {
+ var readability = tinycolor.readability(color1, color2);
+ var wcag2Parms, out;
+ out = false;
+ wcag2Parms = validateWCAG2Parms(wcag2);
+ switch (wcag2Parms.level + wcag2Parms.size) {
+ case "AAsmall":
+ case "AAAlarge":
+ out = readability >= 4.5;
+ break;
+ case "AAlarge":
+ out = readability >= 3;
+ break;
+ case "AAAsmall":
+ out = readability >= 7;
+ break;
+ }
+ return out;
+ };
+
+ // `mostReadable`
+ // Given a base color and a list of possible foreground or background
+ // colors for that base, returns the most readable color.
+ // Optionally returns Black or White if the most readable color is unreadable.
+ // *Example*
+ // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
+ // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
+ // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
+ // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
+ tinycolor.mostReadable = function (baseColor, colorList, args) {
+ var bestColor = null;
+ var bestScore = 0;
+ var readability;
+ var includeFallbackColors, level, size;
+ args = args || {};
+ includeFallbackColors = args.includeFallbackColors;
+ level = args.level;
+ size = args.size;
+ for (var i = 0; i < colorList.length; i++) {
+ readability = tinycolor.readability(baseColor, colorList[i]);
+ if (readability > bestScore) {
+ bestScore = readability;
+ bestColor = tinycolor(colorList[i]);
+ }
+ }
+ if (tinycolor.isReadable(baseColor, bestColor, {
+ level: level,
+ size: size
+ }) || !includeFallbackColors) {
+ return bestColor;
+ } else {
+ args.includeFallbackColors = false;
+ return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
+ }
+ };
+
+ // Big List of Colors
+ // ------------------
+ //
+ var names = tinycolor.names = {
+ aliceblue: "f0f8ff",
+ antiquewhite: "faebd7",
+ aqua: "0ff",
+ aquamarine: "7fffd4",
+ azure: "f0ffff",
+ beige: "f5f5dc",
+ bisque: "ffe4c4",
+ black: "000",
+ blanchedalmond: "ffebcd",
+ blue: "00f",
+ blueviolet: "8a2be2",
+ brown: "a52a2a",
+ burlywood: "deb887",
+ burntsienna: "ea7e5d",
+ cadetblue: "5f9ea0",
+ chartreuse: "7fff00",
+ chocolate: "d2691e",
+ coral: "ff7f50",
+ cornflowerblue: "6495ed",
+ cornsilk: "fff8dc",
+ crimson: "dc143c",
+ cyan: "0ff",
+ darkblue: "00008b",
+ darkcyan: "008b8b",
+ darkgoldenrod: "b8860b",
+ darkgray: "a9a9a9",
+ darkgreen: "006400",
+ darkgrey: "a9a9a9",
+ darkkhaki: "bdb76b",
+ darkmagenta: "8b008b",
+ darkolivegreen: "556b2f",
+ darkorange: "ff8c00",
+ darkorchid: "9932cc",
+ darkred: "8b0000",
+ darksalmon: "e9967a",
+ darkseagreen: "8fbc8f",
+ darkslateblue: "483d8b",
+ darkslategray: "2f4f4f",
+ darkslategrey: "2f4f4f",
+ darkturquoise: "00ced1",
+ darkviolet: "9400d3",
+ deeppink: "ff1493",
+ deepskyblue: "00bfff",
+ dimgray: "696969",
+ dimgrey: "696969",
+ dodgerblue: "1e90ff",
+ firebrick: "b22222",
+ floralwhite: "fffaf0",
+ forestgreen: "228b22",
+ fuchsia: "f0f",
+ gainsboro: "dcdcdc",
+ ghostwhite: "f8f8ff",
+ gold: "ffd700",
+ goldenrod: "daa520",
+ gray: "808080",
+ green: "008000",
+ greenyellow: "adff2f",
+ grey: "808080",
+ honeydew: "f0fff0",
+ hotpink: "ff69b4",
+ indianred: "cd5c5c",
+ indigo: "4b0082",
+ ivory: "fffff0",
+ khaki: "f0e68c",
+ lavender: "e6e6fa",
+ lavenderblush: "fff0f5",
+ lawngreen: "7cfc00",
+ lemonchiffon: "fffacd",
+ lightblue: "add8e6",
+ lightcoral: "f08080",
+ lightcyan: "e0ffff",
+ lightgoldenrodyellow: "fafad2",
+ lightgray: "d3d3d3",
+ lightgreen: "90ee90",
+ lightgrey: "d3d3d3",
+ lightpink: "ffb6c1",
+ lightsalmon: "ffa07a",
+ lightseagreen: "20b2aa",
+ lightskyblue: "87cefa",
+ lightslategray: "789",
+ lightslategrey: "789",
+ lightsteelblue: "b0c4de",
+ lightyellow: "ffffe0",
+ lime: "0f0",
+ limegreen: "32cd32",
+ linen: "faf0e6",
+ magenta: "f0f",
+ maroon: "800000",
+ mediumaquamarine: "66cdaa",
+ mediumblue: "0000cd",
+ mediumorchid: "ba55d3",
+ mediumpurple: "9370db",
+ mediumseagreen: "3cb371",
+ mediumslateblue: "7b68ee",
+ mediumspringgreen: "00fa9a",
+ mediumturquoise: "48d1cc",
+ mediumvioletred: "c71585",
+ midnightblue: "191970",
+ mintcream: "f5fffa",
+ mistyrose: "ffe4e1",
+ moccasin: "ffe4b5",
+ navajowhite: "ffdead",
+ navy: "000080",
+ oldlace: "fdf5e6",
+ olive: "808000",
+ olivedrab: "6b8e23",
+ orange: "ffa500",
+ orangered: "ff4500",
+ orchid: "da70d6",
+ palegoldenrod: "eee8aa",
+ palegreen: "98fb98",
+ paleturquoise: "afeeee",
+ palevioletred: "db7093",
+ papayawhip: "ffefd5",
+ peachpuff: "ffdab9",
+ peru: "cd853f",
+ pink: "ffc0cb",
+ plum: "dda0dd",
+ powderblue: "b0e0e6",
+ purple: "800080",
+ rebeccapurple: "663399",
+ red: "f00",
+ rosybrown: "bc8f8f",
+ royalblue: "4169e1",
+ saddlebrown: "8b4513",
+ salmon: "fa8072",
+ sandybrown: "f4a460",
+ seagreen: "2e8b57",
+ seashell: "fff5ee",
+ sienna: "a0522d",
+ silver: "c0c0c0",
+ skyblue: "87ceeb",
+ slateblue: "6a5acd",
+ slategray: "708090",
+ slategrey: "708090",
+ snow: "fffafa",
+ springgreen: "00ff7f",
+ steelblue: "4682b4",
+ tan: "d2b48c",
+ teal: "008080",
+ thistle: "d8bfd8",
+ tomato: "ff6347",
+ turquoise: "40e0d0",
+ violet: "ee82ee",
+ wheat: "f5deb3",
+ white: "fff",
+ whitesmoke: "f5f5f5",
+ yellow: "ff0",
+ yellowgreen: "9acd32"
+ };
+
+ // Make it easy to access colors via `hexNames[hex]`
+ var hexNames = tinycolor.hexNames = flip(names);
+
+ // Utilities
+ // ---------
+
+ // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
+ function flip(o) {
+ var flipped = {};
+ for (var i in o) {
+ if (o.hasOwnProperty(i)) {
+ flipped[o[i]] = i;
+ }
+ }
+ return flipped;
+ }
+
+ // Return a valid alpha value [0,1] with all invalid values being set to 1
+ function boundAlpha(a) {
+ a = parseFloat(a);
+ if (isNaN(a) || a < 0 || a > 1) {
+ a = 1;
+ }
+ return a;
+ }
+
+ // Take input from [0, n] and return it as [0, 1]
+ function bound01(n, max) {
+ if (isOnePointZero(n)) n = "100%";
+ var processPercent = isPercentage(n);
+ n = Math.min(max, Math.max(0, parseFloat(n)));
+
+ // Automatically convert percentage into number
+ if (processPercent) {
+ n = parseInt(n * max, 10) / 100;
+ }
+
+ // Handle floating point rounding errors
+ if (Math.abs(n - max) < 0.000001) {
+ return 1;
+ }
+
+ // Convert into [0, 1] range if it isn't already
+ return n % max / parseFloat(max);
+ }
+
+ // Force a number between 0 and 1
+ function clamp01(val) {
+ return Math.min(1, Math.max(0, val));
+ }
+
+ // Parse a base-16 hex value into a base-10 integer
+ function parseIntFromHex(val) {
+ return parseInt(val, 16);
+ }
+
+ // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
+ //
+ function isOnePointZero(n) {
+ return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
+ }
+
+ // Check to see if string passed in is a percentage
+ function isPercentage(n) {
+ return typeof n === "string" && n.indexOf("%") != -1;
+ }
+
+ // Force a hex value to have 2 characters
+ function pad2(c) {
+ return c.length == 1 ? "0" + c : "" + c;
+ }
+
+ // Replace a decimal with it's percentage value
+ function convertToPercentage(n) {
+ if (n <= 1) {
+ n = n * 100 + "%";
+ }
+ return n;
+ }
+
+ // Converts a decimal to a hex value
+ function convertDecimalToHex(d) {
+ return Math.round(parseFloat(d) * 255).toString(16);
+ }
+ // Converts a hex value to a decimal
+ function convertHexToDecimal(h) {
+ return parseIntFromHex(h) / 255;
+ }
+ var matchers = function () {
+ //
+ var CSS_INTEGER = "[-\\+]?\\d+%?";
+
+ //
+ var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
+
+ // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
+ var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
+
+ // Actual matching.
+ // Parentheses and commas are optional, but not required.
+ // Whitespace can take the place of commas or opening paren
+ var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
+ var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
+ return {
+ CSS_UNIT: new RegExp(CSS_UNIT),
+ rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
+ rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
+ hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
+ hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
+ hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
+ hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
+ hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
+ hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
+ hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
+ hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
+ };
+ }();
+
+ // `isValidCSSUnit`
+ // Take in a single string / number and check to see if it looks like a CSS unit
+ // (see `matchers` above for definition).
+ function isValidCSSUnit(color) {
+ return !!matchers.CSS_UNIT.exec(color);
+ }
+
+ // `stringInputToObject`
+ // Permissive string parsing. Take in a number of formats, and output an object
+ // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
+ function stringInputToObject(color) {
+ color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
+ var named = false;
+ if (names[color]) {
+ color = names[color];
+ named = true;
+ } else if (color == "transparent") {
+ return {
+ r: 0,
+ g: 0,
+ b: 0,
+ a: 0,
+ format: "name"
+ };
+ }
+
+ // Try to match string input using regular expressions.
+ // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
+ // Just return an object and let the conversion functions handle that.
+ // This way the result will be the same whether the tinycolor is initialized with string or object.
+ var match;
+ if (match = matchers.rgb.exec(color)) {
+ return {
+ r: match[1],
+ g: match[2],
+ b: match[3]
+ };
+ }
+ if (match = matchers.rgba.exec(color)) {
+ return {
+ r: match[1],
+ g: match[2],
+ b: match[3],
+ a: match[4]
+ };
+ }
+ if (match = matchers.hsl.exec(color)) {
+ return {
+ h: match[1],
+ s: match[2],
+ l: match[3]
+ };
+ }
+ if (match = matchers.hsla.exec(color)) {
+ return {
+ h: match[1],
+ s: match[2],
+ l: match[3],
+ a: match[4]
+ };
+ }
+ if (match = matchers.hsv.exec(color)) {
+ return {
+ h: match[1],
+ s: match[2],
+ v: match[3]
+ };
+ }
+ if (match = matchers.hsva.exec(color)) {
+ return {
+ h: match[1],
+ s: match[2],
+ v: match[3],
+ a: match[4]
+ };
+ }
+ if (match = matchers.hex8.exec(color)) {
+ return {
+ r: parseIntFromHex(match[1]),
+ g: parseIntFromHex(match[2]),
+ b: parseIntFromHex(match[3]),
+ a: convertHexToDecimal(match[4]),
+ format: named ? "name" : "hex8"
+ };
+ }
+ if (match = matchers.hex6.exec(color)) {
+ return {
+ r: parseIntFromHex(match[1]),
+ g: parseIntFromHex(match[2]),
+ b: parseIntFromHex(match[3]),
+ format: named ? "name" : "hex"
+ };
+ }
+ if (match = matchers.hex4.exec(color)) {
+ return {
+ r: parseIntFromHex(match[1] + "" + match[1]),
+ g: parseIntFromHex(match[2] + "" + match[2]),
+ b: parseIntFromHex(match[3] + "" + match[3]),
+ a: convertHexToDecimal(match[4] + "" + match[4]),
+ format: named ? "name" : "hex8"
+ };
+ }
+ if (match = matchers.hex3.exec(color)) {
+ return {
+ r: parseIntFromHex(match[1] + "" + match[1]),
+ g: parseIntFromHex(match[2] + "" + match[2]),
+ b: parseIntFromHex(match[3] + "" + match[3]),
+ format: named ? "name" : "hex"
+ };
+ }
+ return false;
+ }
+ function validateWCAG2Parms(parms) {
+ // return valid WCAG2 parms for isReadable.
+ // If input parms are invalid, return {"level":"AA", "size":"small"}
+ var level, size;
+ parms = parms || {
+ level: "AA",
+ size: "small"
+ };
+ level = (parms.level || "AA").toUpperCase();
+ size = (parms.size || "small").toLowerCase();
+ if (level !== "AA" && level !== "AAA") {
+ level = "AA";
+ }
+ if (size !== "small" && size !== "large") {
+ size = "small";
+ }
+ return {
+ level: level,
+ size: size
+ };
+ }
+
+ return tinycolor;
+
+}));
diff --git a/miniprogram_npm/tdesign-miniprogram/mixins/page-scroll.d.ts b/miniprogram_npm/tdesign-miniprogram/mixins/page-scroll.d.ts
index 7571f3c..0e9cf2d 100644
--- a/miniprogram_npm/tdesign-miniprogram/mixins/page-scroll.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/mixins/page-scroll.d.ts
@@ -1,6 +1,2 @@
-///
-///
-declare type IPageScrollOption = WechatMiniprogram.Page.IPageScrollOption;
-declare type Scroller = (this: WechatMiniprogram.Component.TrivialInstance, event?: IPageScrollOption) => void;
-declare const _default: (scroller: Scroller) => string;
+declare const _default: (funcName?: string) => string;
export default _default;
diff --git a/miniprogram_npm/tdesign-miniprogram/mixins/page-scroll.js b/miniprogram_npm/tdesign-miniprogram/mixins/page-scroll.js
index b9f1345..1d0dcba 100644
--- a/miniprogram_npm/tdesign-miniprogram/mixins/page-scroll.js
+++ b/miniprogram_npm/tdesign-miniprogram/mixins/page-scroll.js
@@ -4,19 +4,23 @@ const onPageScroll = function (event) {
if (!page)
return;
const { pageScroller } = page;
- pageScroller.forEach((scroller) => {
+ pageScroller === null || pageScroller === void 0 ? void 0 : pageScroller.forEach((scroller) => {
if (typeof scroller === 'function') {
scroller(event);
}
});
};
-export default (scroller) => {
+export default (funcName = 'onScroll') => {
return Behavior({
attached() {
+ var _a;
const page = getCurrentPage();
if (!page)
return;
- const bindScroller = scroller.bind(this);
+ const bindScroller = (_a = this[funcName]) === null || _a === void 0 ? void 0 : _a.bind(this);
+ if (bindScroller) {
+ this._pageScroller = bindScroller;
+ }
if (Array.isArray(page.pageScroller)) {
page.pageScroller.push(bindScroller);
}
@@ -31,7 +35,7 @@ export default (scroller) => {
const page = getCurrentPage();
if (!page)
return;
- page.pageScroller = ((_a = page.pageScroller) === null || _a === void 0 ? void 0 : _a.filter((item) => item !== scroller)) || [];
+ page.pageScroller = ((_a = page.pageScroller) === null || _a === void 0 ? void 0 : _a.filter((item) => item !== this._pageScroller)) || [];
},
});
};
diff --git a/miniprogram_npm/tdesign-miniprogram/mixins/theme-change.d.ts b/miniprogram_npm/tdesign-miniprogram/mixins/theme-change.d.ts
new file mode 100644
index 0000000..4821f37
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/mixins/theme-change.d.ts
@@ -0,0 +1,2 @@
+declare const themeChangeBehavior: string;
+export default themeChangeBehavior;
diff --git a/miniprogram_npm/tdesign-miniprogram/mixins/theme-change.js b/miniprogram_npm/tdesign-miniprogram/mixins/theme-change.js
new file mode 100644
index 0000000..70e44ed
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/mixins/theme-change.js
@@ -0,0 +1,23 @@
+import { appBaseInfo } from '../common/utils';
+const themeChangeBehavior = Behavior({
+ data: {
+ theme: 'light',
+ },
+ attached() {
+ this._initTheme();
+ },
+ methods: {
+ _initTheme() {
+ const that = this;
+ that.setData({
+ theme: appBaseInfo.theme,
+ });
+ wx.onThemeChange((res) => {
+ that.setData({
+ theme: res.theme,
+ });
+ });
+ },
+ },
+});
+export default themeChangeBehavior;
diff --git a/miniprogram_npm/tdesign-miniprogram/mixins/using-custom-navbar.d.ts b/miniprogram_npm/tdesign-miniprogram/mixins/using-custom-navbar.d.ts
new file mode 100644
index 0000000..908f771
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/mixins/using-custom-navbar.d.ts
@@ -0,0 +1,2 @@
+declare const useCustomNavbarBehavior: string;
+export default useCustomNavbarBehavior;
diff --git a/miniprogram_npm/tdesign-miniprogram/mixins/using-custom-navbar.js b/miniprogram_npm/tdesign-miniprogram/mixins/using-custom-navbar.js
new file mode 100644
index 0000000..e9bf8e3
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/mixins/using-custom-navbar.js
@@ -0,0 +1,34 @@
+import { systemInfo } from '../common/utils';
+const useCustomNavbarBehavior = Behavior({
+ properties: {
+ usingCustomNavbar: {
+ type: Boolean,
+ value: false,
+ },
+ customNavbarHeight: {
+ type: Number,
+ value: 0,
+ },
+ },
+ data: {
+ distanceTop: 0,
+ },
+ lifetimes: {
+ attached() {
+ if (this.properties.usingCustomNavbar) {
+ this.calculateCustomNavbarDistanceTop();
+ }
+ },
+ },
+ methods: {
+ calculateCustomNavbarDistanceTop() {
+ const { statusBarHeight } = systemInfo;
+ const menuButton = wx.getMenuButtonBoundingClientRect();
+ const distance = menuButton.top + menuButton.bottom - statusBarHeight;
+ this.setData({
+ distanceTop: Math.max(distance, this.properties.customNavbarHeight + statusBarHeight),
+ });
+ },
+ },
+});
+export default useCustomNavbarBehavior;
diff --git a/miniprogram_npm/tdesign-miniprogram/navbar/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/navbar/README.en-US.md
index 9607f56..500cdbb 100644
--- a/miniprogram_npm/tdesign-miniprogram/navbar/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/navbar/README.en-US.md
@@ -1,18 +1,20 @@
:: BASE_DOC ::
## API
+
### Navbar Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
animation | Boolean | true | \- | N
-capsule | Slot | - | \- | N
+capsule | Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
delta | Number | 1 | \- | N
-external-classes | Array | - | `['t-class', 't-class-title', 't-class-left-icon', 't-class-home-icon', 't-class-capsule']` | N
fixed | Boolean | true | \- | N
-left | Slot | - | `0.26.0` | N
+left | Slot | - | `0.26.0`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
left-arrow | Boolean | false | `0.26.0` | N
-title | String / Slot | - | page title | N
+title | String / Slot | - | page title。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
title-max-length | Number | - | \- | N
visible | Boolean | true | \- | N
@@ -24,3 +26,31 @@ complete | \- | \-
fail | \- | \-
go-back | \- | \-
success | \- | \-
+### Navbar External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-capsule | \-
+t-class-center | \-
+t-class-home-icon | \-
+t-class-left | \-
+t-class-left-icon | \-
+t-class-nav-btn | \-
+t-class-title | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-navbar-bg-color | @bg-color-container | -
+--td-navbar-capsule-border-color | #e3e6ea | -
+--td-navbar-capsule-border-radius | 32rpx | -
+--td-navbar-capsule-height | 64rpx | -
+--td-navbar-capsule-width | 176rpx | -
+--td-navbar-color | @font-gray-1 | -
+--td-navbar-height | 96rpx | -
+--td-navbar-left-arrow-size | 48rpx | -
+--td-navbar-title-font-size | 36rpx | -
+--td-navbar-title-font-weight | 600 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/navbar/README.md b/miniprogram_npm/tdesign-miniprogram/navbar/README.md
index 37126be..ccfad35 100644
--- a/miniprogram_npm/tdesign-miniprogram/navbar/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/navbar/README.md
@@ -18,6 +18,13 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
+
### 基础导航栏
{{ base }}
@@ -43,18 +50,20 @@ isComponent: true
{{ custom-color }}
## API
+
### Navbar Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
animation | Boolean | true | 是否添加动画效果 | N
-capsule | Slot | - | 左侧胶囊区域 | N
+capsule | Slot | - | 左侧胶囊区域。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
delta | Number | 1 | 后退按钮后退层数,含义参考 [wx.navigateBack](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html),特殊的,传入 0 不会发生执行 wx.navigateBack | N
-external-classes | Array | - | 组件类名,分别用于设置组件外层元素、标题、左侧图标、首页图标、胶囊等元素类名。`['t-class', 't-class-title', 't-class-left-icon', 't-class-home-icon', 't-class-capsule']` | N
fixed | Boolean | true | 是否固定在顶部 | N
-left | Slot | - | `0.26.0`。左侧内容区域 | N
+left | Slot | - | `0.26.0`。左侧内容区域。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
left-arrow | Boolean | false | `0.26.0`。是否展示左侧箭头 | N
-title | String / Slot | - | 页面标题 | N
+title | String / Slot | - | 页面标题。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
title-max-length | Number | - | 标题文字最大长度,超出的范围使用 `...` 表示 | N
visible | Boolean | true | 是否显示 | N
@@ -66,3 +75,31 @@ complete | \- | navigateBack 执行完成后触发(失败或成功均会触发
fail | \- | navigateBack 执行失败后触发
go-back | \- | 点击左侧箭头时触发
success | \- | navigateBack 执行成功后触发
+### Navbar External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-capsule | 左侧胶囊区域样式类
+t-class-center | 中间内容样式类
+t-class-home-icon | 首页图标样式类
+t-class-left | 左侧内容样式类
+t-class-left-icon | 左侧图标样式类
+t-class-nav-btn | 导航按钮样式类
+t-class-title | 标题样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-navbar-bg-color | @bg-color-container | -
+--td-navbar-capsule-border-color | #e3e6ea | -
+--td-navbar-capsule-border-radius | 32rpx | -
+--td-navbar-capsule-height | 64rpx | -
+--td-navbar-capsule-width | 176rpx | -
+--td-navbar-color | @font-gray-1 | -
+--td-navbar-height | 96rpx | -
+--td-navbar-left-arrow-size | 48rpx | -
+--td-navbar-title-font-size | 36rpx | -
+--td-navbar-title-font-weight | 600 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/navbar/navbar.d.ts b/miniprogram_npm/tdesign-miniprogram/navbar/navbar.d.ts
index dd7a94d..45e2d20 100644
--- a/miniprogram_npm/tdesign-miniprogram/navbar/navbar.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/navbar/navbar.d.ts
@@ -3,7 +3,6 @@ export default class Navbar extends SuperComponent {
externalClasses: string[];
timer: any;
options: {
- addGlobalClass: boolean;
multipleSlots: boolean;
};
properties: import("./type").TdNavbarProps;
@@ -16,9 +15,13 @@ export default class Navbar extends SuperComponent {
classPrefix: string;
boxStyle: string;
showTitle: string;
+ hideLeft: boolean;
+ hideCenter: boolean;
};
- attached(): void;
+ attached(): Promise;
+ detached(): void;
methods: {
+ queryElements(capsuleRect: any): void;
goBack(): void;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/navbar/navbar.js b/miniprogram_npm/tdesign-miniprogram/navbar/navbar.js
index b222517..32a7cd8 100644
--- a/miniprogram_npm/tdesign-miniprogram/navbar/navbar.js
+++ b/miniprogram_npm/tdesign-miniprogram/navbar/navbar.js
@@ -4,7 +4,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
import { SuperComponent, wxComponent } from '../common/src/index';
+import { getRect, systemInfo } from '../common/utils';
import config from '../common/config';
import props from './props';
const { prefix } = config;
@@ -14,6 +24,8 @@ let Navbar = class Navbar extends SuperComponent {
super(...arguments);
this.externalClasses = [
`${prefix}-class`,
+ `${prefix}-class-placeholder`,
+ `${prefix}-class-content`,
`${prefix}-class-title`,
`${prefix}-class-left`,
`${prefix}-class-center`,
@@ -24,7 +36,6 @@ let Navbar = class Navbar extends SuperComponent {
];
this.timer = null;
this.options = {
- addGlobalClass: true,
multipleSlots: true,
};
this.properties = props;
@@ -62,8 +73,35 @@ let Navbar = class Navbar extends SuperComponent {
classPrefix: name,
boxStyle: '',
showTitle: '',
+ hideLeft: false,
+ hideCenter: false,
};
this.methods = {
+ queryElements(capsuleRect) {
+ Promise.all([
+ getRect(this, `.${this.data.classPrefix}__left`),
+ getRect(this, `.${this.data.classPrefix}__center`),
+ ]).then(([leftRect, centerRect]) => {
+ if (leftRect.right > capsuleRect.left) {
+ this.setData({
+ hideLeft: true,
+ hideCenter: true,
+ });
+ }
+ else if (centerRect.right > capsuleRect.left) {
+ this.setData({
+ hideLeft: false,
+ hideCenter: true,
+ });
+ }
+ else {
+ this.setData({
+ hideLeft: false,
+ hideCenter: false,
+ });
+ }
+ });
+ },
goBack() {
const { delta } = this.data;
const that = this;
@@ -86,31 +124,38 @@ let Navbar = class Navbar extends SuperComponent {
};
}
attached() {
- let rect = null;
- if (wx.getMenuButtonBoundingClientRect) {
- rect = wx.getMenuButtonBoundingClientRect();
- }
- if (!rect)
- return;
- wx.getSystemInfo({
- success: (res) => {
- const boxStyleList = [];
- const { statusBarHeight } = wx.getSystemInfoSync();
- boxStyleList.push(`--td-navbar-padding-top:${statusBarHeight}px`);
- if (rect && (res === null || res === void 0 ? void 0 : res.windowWidth)) {
- boxStyleList.push(`--td-navbar-right:${res.windowWidth - rect.left}px`);
- }
- boxStyleList.push(`--td-navbar-capsule-height: ${rect.height}px`);
- boxStyleList.push(`--td-navbar-capsule-width:${rect.width}px`);
- this.setData({
- boxStyle: `${boxStyleList.join('; ')}`,
- });
- },
- fail: (err) => {
- console.error('navbar 获取系统信息失败', err);
- },
+ return __awaiter(this, void 0, void 0, function* () {
+ let rect = null;
+ if (wx.getMenuButtonBoundingClientRect) {
+ rect = wx.getMenuButtonBoundingClientRect();
+ }
+ if (!rect || !systemInfo)
+ return;
+ const { right } = yield getRect(this, `.${name}__left`);
+ const boxStyleList = [];
+ boxStyleList.push(`--td-navbar-padding-top: ${systemInfo.statusBarHeight}px`);
+ if (rect && (systemInfo === null || systemInfo === void 0 ? void 0 : systemInfo.windowWidth)) {
+ const maxSpacing = Math.max(right, systemInfo.windowWidth - rect.left);
+ boxStyleList.push(`--td-navbar-center-left: ${maxSpacing}px`);
+ boxStyleList.push(`--td-navbar-center-width: ${rect.left - maxSpacing}px`);
+ boxStyleList.push(`--td-navbar-right: ${systemInfo.windowWidth - rect.left}px`);
+ }
+ boxStyleList.push(`--td-navbar-capsule-height: ${rect.height}px`);
+ boxStyleList.push(`--td-navbar-capsule-width: ${rect.width}px`);
+ boxStyleList.push(`--td-navbar-height: ${(rect.top - systemInfo.statusBarHeight) * 2 + rect.height}px`);
+ this.setData({
+ boxStyle: `${boxStyleList.join('; ')}`,
+ });
+ if (wx.onMenuButtonBoundingClientRectWeightChange) {
+ wx.onMenuButtonBoundingClientRectWeightChange((res) => this.queryElements(res));
+ }
});
}
+ detached() {
+ if (wx.offMenuButtonBoundingClientRectWeightChange) {
+ wx.offMenuButtonBoundingClientRectWeightChange((res) => this.queryElements(res));
+ }
+ }
};
Navbar = __decorate([
wxComponent()
diff --git a/miniprogram_npm/tdesign-miniprogram/navbar/navbar.json b/miniprogram_npm/tdesign-miniprogram/navbar/navbar.json
index 049940c..f783dae 100644
--- a/miniprogram_npm/tdesign-miniprogram/navbar/navbar.json
+++ b/miniprogram_npm/tdesign-miniprogram/navbar/navbar.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxml b/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxml
index 5455da7..3ed1f16 100644
--- a/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxml
@@ -1,22 +1,22 @@
-
-
-
+
+
+
-
+
-
+
- {{showTitle}}
+ {{showTitle}}
diff --git a/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxss b/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxss
index cbaed3a..556e75f 100644
--- a/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxss
@@ -46,22 +46,24 @@
display: none;
}
.t-navbar__placeholder {
- height: var(--td-navbar-height, 96rpx);
- padding-top: var(--td-navbar-padding-top, 40rpx);
+ height: var(--td-navbar-height, 48px);
+ padding-top: var(--td-navbar-padding-top, 20px);
position: relative;
visibility: hidden;
+ box-sizing: content-box;
}
.t-navbar__content {
position: relative;
z-index: 1;
- height: var(--td-navbar-height, 96rpx);
- width: calc(100% - var(--td-navbar-right, 190rpx));
- padding-right: var(--td-navbar-right, 190rpx);
- padding-top: var(--td-navbar-padding-top, 40rpx);
- color: var(--td-navbar-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ height: var(--td-navbar-height, 48px);
+ width: calc(100% - var(--td-navbar-right, 95px));
+ padding-right: var(--td-navbar-right, 95px);
+ padding-top: var(--td-navbar-padding-top, 20px);
+ color: var(--td-navbar-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
background-color: var(--td-navbar-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
display: flex;
align-items: center;
+ box-sizing: content-box;
}
.t-navbar__left {
position: relative;
@@ -69,20 +71,25 @@
display: flex;
align-items: center;
margin-left: var(--td-spacer-1, 24rpx);
+ transition: opacity 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}
.t-navbar__left-arrow {
- font-size: var(--td-navbar-left-arrow-size, 48rpx);
+ font-size: var(--td-navbar-left-arrow-size, 24px);
+}
+.t-navbar__left--hide {
+ opacity: 0;
}
.t-navbar__capsule {
box-sizing: border-box;
- width: var(--td-navbar-capsule-width, 176rpx);
- height: var(--td-navbar-capsule-height, 64rpx);
+ width: var(--td-navbar-capsule-width, 88px);
+ height: var(--td-navbar-capsule-height, 32px);
display: flex;
align-items: center;
}
.t-navbar__capsule::before {
content: '';
position: absolute;
+ z-index: -1;
top: 0;
left: 0;
width: 200%;
@@ -90,33 +97,38 @@
transform: scale(0.5);
transform-origin: 0 0;
box-sizing: border-box;
- border-radius: calc(var(--td-navbar-capsule-border-radius, 32rpx) * 2);
- border: 2rpx solid var(--td-navbar-capsule-border-color, #e3e6ea);
+ border-radius: calc(var(--td-navbar-capsule-border-radius, 16px) * 2);
+ border: 2rpx solid var(--td-navbar-capsule-border-color, var(--td-border-level-1-color, var(--td-gray-color-3, #e7e7e7)));
}
.t-navbar__capsule:empty {
display: none;
}
.t-navbar__center {
- font-size: 36rpx;
+ font-size: 18px;
text-align: center;
position: absolute;
- left: var(--td-navbar-right, 190rpx);
- width: calc(100% - var(--td-navbar-right, 190rpx) * 2);
- height: var(--td-navbar-height, 96rpx);
- line-height: var(--td-navbar-height, 96rpx);
+ bottom: 0;
+ left: var(--td-navbar-center-left, var(--td-navbar-right, 95px));
+ width: var(--td-navbar-center-width);
+ height: var(--td-navbar-height, 48px);
+ line-height: var(--td-navbar-height, 48px);
flex: 1;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
+ transition: opacity 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}
.t-navbar__center:empty {
display: none;
}
.t-navbar__center-title {
- font-size: var(--td-navbar-title-font-size, 36rpx);
+ font-size: var(--td-navbar-title-font-size, 18px);
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
font-weight: var(--td-navbar-title-font-weight, 600);
}
+.t-navbar__center--hide {
+ opacity: 0;
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/navbar/props.js b/miniprogram_npm/tdesign-miniprogram/navbar/props.js
index 17e637c..3906316 100644
--- a/miniprogram_npm/tdesign-miniprogram/navbar/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/navbar/props.js
@@ -7,9 +7,6 @@ const props = {
type: Number,
value: 1,
},
- externalClasses: {
- type: Array,
- },
fixed: {
type: Boolean,
value: true,
diff --git a/miniprogram_npm/tdesign-miniprogram/navbar/type.d.ts b/miniprogram_npm/tdesign-miniprogram/navbar/type.d.ts
index 5034319..11a4e77 100644
--- a/miniprogram_npm/tdesign-miniprogram/navbar/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/navbar/type.d.ts
@@ -3,18 +3,10 @@ export interface TdNavbarProps {
type: BooleanConstructor;
value?: boolean;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
delta?: {
type: NumberConstructor;
value?: number;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-title', 't-class-left-icon', 't-class-home-icon', 't-class-capsule'];
- };
fixed?: {
type: BooleanConstructor;
value?: boolean;
diff --git a/miniprogram_npm/tdesign-miniprogram/notice-bar/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/notice-bar/README.en-US.md
index 6d98c4a..e5ecd0e 100644
--- a/miniprogram_npm/tdesign-miniprogram/notice-bar/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/notice-bar/README.en-US.md
@@ -1,23 +1,53 @@
:: BASE_DOC ::
## API
+
### NoticeBar Props
name | type | default | description | required
-- | -- | -- | -- | --
-content | String / Array / Slot | - | \- | N
-direction | String | horizontal | options:horizontal/vertical | N
-external-classes | Array | - | `['t-class', 't-class-content', 't-class-prefix-icon', 't-class-operation', 't-class-suffix-icon']` | N
-operation | String / Slot | - | \- | N
-marquee | Boolean / Object | false | Typescript:`boolean \| DrawMarquee` `interface DrawMarquee { speed?: number; loop?: number; delay?: number }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/notice-bar/type.ts) | N
-prefix-icon | String / Boolean/ Object / Slot | - | \- | N
-suffix-icon | String / Boolean / Object / Slot | - | \- | N
-theme | String | info | options:info/success/warning/error | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+content | String / Array / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+direction | String | horizontal | options: horizontal/vertical | N
+interval | Number | 2000 | \- | N
+marquee | Boolean / Object | false | Typescript:`boolean \| NoticeBarMarquee` `interface NoticeBarMarquee { speed?: number; loop?: number; delay?: number }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/notice-bar/type.ts) | N
+operation | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+prefix-icon | String / Boolean / Object / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+suffix-icon | String / Object / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+theme | String | info | options: info/success/warning/error | N
visible | Boolean | false | \- | N
-default-visible | Boolean | false | uncontrolled property | N
+default-visible | Boolean | undefined | uncontrolled property | N
### NoticeBar Events
name | params | description
-- | -- | --
+change | `(current: number, source: '' \| 'autoplay' \| 'touch')` | \-
click | `(trigger: NoticeBarTrigger)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/notice-bar/type.ts)。
`type NoticeBarTrigger = 'prefix-icon' \| 'content' \| 'operation' \| 'suffix-icon';`
+### NoticeBar External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-content | \-
+t-class-operation | \-
+t-class-prefix-icon | \-
+t-class-suffix-icon | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-notice-bar-error-bg-color | @error-color-1 | -
+--td-notice-bar-error-color | @error-color-6 | -
+--td-notice-bar-font-color | @font-gray-1 | -
+--td-notice-bar-info-bg-color | @brand-color-light | -
+--td-notice-bar-info-color | @brand-color | -
+--td-notice-bar-operation-font-color | @brand-color | -
+--td-notice-bar-success-bg-color | @success-color-1 | -
+--td-notice-bar-success-color | @success-color | -
+--td-notice-bar-suffix-icon-color | @font-gray-3 | -
+--td-notice-bar-warning-bg-color | @warning-color-1 | -
+--td-notice-bar-warning-color | @warning-color | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/notice-bar/README.md b/miniprogram_npm/tdesign-miniprogram/notice-bar/README.md
index d236cec..2806462 100644
--- a/miniprogram_npm/tdesign-miniprogram/notice-bar/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/notice-bar/README.md
@@ -26,6 +26,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 01 组件类型
纯文字的公告栏
@@ -66,23 +72,53 @@ isComponent: true
## API
+
### NoticeBar Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-content | String / Array / Slot | - | 文本内容 | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+content | String / Array / Slot | - | 文本内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
direction | String | horizontal | 滚动方向。可选项:horizontal/vertical | N
-external-classes | Array | - | 组件类名,分别用于设置 组件外层元素、文本内容、前缀图标、右侧额外信息、后缀图标 等元素类名。。`['t-class', 't-class-content', 't-class-prefix-icon', 't-class-operation', 't-class-suffix-icon']` | N
-operation | String / Slot | - | 右侧额外信息 | N
-marquee | Boolean / Object | false | 跑马灯效果。speed 指速度控制;loop 指循环播放次数,值为 -1 表示循环播放,值为 0 表示不循环播放;delay 表示延迟多久开始播放【仅在 direction='horizontal' 有效】。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
-prefix-icon | String / Boolean / Object / Slot | - | 前缀图标。值为字符串表示图标名称,值为 `false` 表示不显示前缀图标,值为 `Object` 类型,表示透传至 `icon`,不传表示使用主题图标。| N
-suffix-icon | String / Object / Slot | - | 后缀图标。值为字符串表示图标名称。值为 `Object` 类型,表示透传至 `icon`,不传表示不显示后缀图标。 | N
+interval | Number | 2000 | 间隔时间【仅在 direction='vertical' 有效】 | N
+marquee | Boolean / Object | false | 跑马灯效果。speed 指速度控制;loop 指循环播放次数,值为 -1 表示循环播放,值为 0 表示不循环播放;delay 表示延迟多久开始播放【仅在 direction='horizontal' 有效】。TS 类型:`boolean \| NoticeBarMarquee` `interface NoticeBarMarquee { speed?: number; loop?: number; delay?: number }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/notice-bar/type.ts) | N
+operation | String / Slot | - | 右侧额外信息。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+prefix-icon | String / Boolean / Object / Slot | true | 前缀图标。值为字符串表示图标名称,值为 `false` 表示不显示前缀图标,值为 `Object` 类型,表示透传至 `icon`,不传表示使用主题图标。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+suffix-icon | String / Object / Slot | - | 后缀图标。值为字符串表示图标名称。值为 `Object` 类型,表示透传至 `icon`,不传表示不显示后缀图标。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
theme | String | info | 内置主题。可选项:info/success/warning/error | N
visible | Boolean | false | 显示/隐藏 | N
-default-visible | Boolean | false | 显示/隐藏。非受控属性 | N
+default-visible | Boolean | undefined | 显示/隐藏。非受控属性 | N
### NoticeBar Events
名称 | 参数 | 描述
-- | -- | --
+change | `(current: number, source: '' \| 'autoplay' \| 'touch')` | 当 `direction="vertical"` 时轮播切换时触发
click | `(trigger: NoticeBarTrigger)` | 点击事件。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/notice-bar/type.ts)。
`type NoticeBarTrigger = 'prefix-icon' \| 'content' \| 'operation' \| 'suffix-icon';`
+### NoticeBar External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-content | 内容样式类
+t-class-operation | 右侧额外信息样式类
+t-class-prefix-icon | 前置图标样式类
+t-class-suffix-icon | 后置图标样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-notice-bar-error-bg-color | @error-color-1 | -
+--td-notice-bar-error-color | @error-color-6 | -
+--td-notice-bar-font-color | @font-gray-1 | -
+--td-notice-bar-info-bg-color | @brand-color-light | -
+--td-notice-bar-info-color | @brand-color | -
+--td-notice-bar-operation-font-color | @brand-color | -
+--td-notice-bar-success-bg-color | @success-color-1 | -
+--td-notice-bar-success-color | @success-color | -
+--td-notice-bar-suffix-icon-color | @font-gray-3 | -
+--td-notice-bar-warning-bg-color | @warning-color-1 | -
+--td-notice-bar-warning-color | @warning-color | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.d.ts b/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.d.ts
index f408942..783c09b 100644
--- a/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.d.ts
@@ -7,6 +7,7 @@ export default class NoticeBar extends SuperComponent {
prefix: string;
classPrefix: string;
loop: number;
+ __ready: boolean;
};
observers: {
marquee(val: any): void;
@@ -26,6 +27,7 @@ export default class NoticeBar extends SuperComponent {
show(): void;
clearNoticeBarAnimation(): void;
setPrefixIcon(v: any): void;
+ onChange(e: WechatMiniprogram.SwiperChange): void;
clickPrefixIcon(): void;
clickContent(): void;
clickSuffixIcon(): void;
diff --git a/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.js b/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.js
index 8d95e10..66a3a0e 100644
--- a/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.js
+++ b/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.js
@@ -27,14 +27,15 @@ let NoticeBar = class NoticeBar extends SuperComponent {
`${prefix}-class-suffix-icon`,
];
this.options = {
- styleIsolation: 'apply-shared',
multipleSlots: true,
+ pureDataPattern: /^__/,
};
this.properties = props;
this.data = {
prefix,
classPrefix: name,
loop: -1,
+ __ready: false,
};
this.observers = {
marquee(val) {
@@ -49,6 +50,8 @@ let NoticeBar = class NoticeBar extends SuperComponent {
}
},
visible(visible) {
+ if (!this.data.__ready)
+ return;
if (visible) {
this.show();
}
@@ -65,6 +68,8 @@ let NoticeBar = class NoticeBar extends SuperComponent {
});
},
content() {
+ if (!this.data.__ready)
+ return;
this.clearNoticeBarAnimation();
this.initAnimation();
},
@@ -81,6 +86,7 @@ let NoticeBar = class NoticeBar extends SuperComponent {
},
ready() {
this.show();
+ this.setData({ __ready: true });
},
};
this.methods = {
@@ -88,7 +94,8 @@ let NoticeBar = class NoticeBar extends SuperComponent {
const warpID = `.${name}__content-wrap`;
const nodeID = `.${name}__content`;
getAnimationFrame(this, () => {
- Promise.all([getRect(this, nodeID), getRect(this, warpID)]).then(([nodeRect, wrapRect]) => {
+ Promise.all([getRect(this, nodeID), getRect(this, warpID)])
+ .then(([nodeRect, wrapRect]) => {
const { marquee } = this.properties;
if (nodeRect == null || wrapRect == null || !nodeRect.width || !wrapRect.width) {
return;
@@ -96,7 +103,6 @@ let NoticeBar = class NoticeBar extends SuperComponent {
if (marquee || wrapRect.width < nodeRect.width) {
const speeding = marquee.speed || 50;
const delaying = marquee.delay || 0;
- const loops = marquee.loop - 1 || -1;
const animationDuration = ((wrapRect.width + nodeRect.width) / speeding) * 1000;
const firstAnimationDuration = (nodeRect.width / speeding) * 1000;
this.setData({
@@ -104,12 +110,13 @@ let NoticeBar = class NoticeBar extends SuperComponent {
nodeWidth: Number(nodeRect.width),
animationDuration: animationDuration,
delay: delaying,
- loop: loops,
+ loop: marquee.loop - 1,
firstAnimationDuration: firstAnimationDuration,
});
- this.startScrollAnimation(true);
+ marquee.loop !== 0 && this.startScrollAnimation(true);
}
- });
+ })
+ .catch(() => { });
});
},
startScrollAnimation(isFirstScroll = false) {
@@ -160,6 +167,10 @@ let NoticeBar = class NoticeBar extends SuperComponent {
_prefixIcon: calcIcon(v, THEME_ICON[theme]),
});
},
+ onChange(e) {
+ const { current, source } = e.detail;
+ this.triggerEvent('change', { current, source });
+ },
clickPrefixIcon() {
this.triggerEvent('click', { trigger: 'prefix-icon' });
},
diff --git a/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.json b/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.json
index ef9e100..f783dae 100644
--- a/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.json
+++ b/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.json
@@ -1,7 +1,7 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
- "t-icon": "../icon/icon",
- "t-button": "../button/button"
+ "t-icon": "../icon/icon"
}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.wxml b/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.wxml
index 5986e43..d61f322 100644
--- a/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.wxml
@@ -24,9 +24,10 @@
autoplay="true"
vertical="true"
circular="true"
- interval="2000"
+ interval="{{interval}}"
display-multiple-items="1"
- class="{{classPrefix}}__content--vertical"
+ class="{{classPrefix}}__content {{classPrefix}}__content--vertical"
+ bindchange="onChange"
>
diff --git a/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.wxss b/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.wxss
index 0116f00..0935ea1 100644
--- a/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.wxss
@@ -35,15 +35,17 @@
flex: 1;
overflow-x: hidden;
line-height: 44rpx;
- color: var(--td-notice-bar-font-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-notice-bar-font-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-notice-bar__content {
+ display: inline-block;
white-space: nowrap;
}
.t-notice-bar__content-wrapable {
white-space: normal;
}
.t-notice-bar__content--vertical {
+ display: block;
height: 44rpx;
line-height: 44rpx;
}
@@ -59,7 +61,7 @@
padding-right: var(--td-spacer, 16rpx);
}
.t-notice-bar__suffix-icon {
- color: var(--td-notice-bar-suffix-icon-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-notice-bar-suffix-icon-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
}
.t-notice-bar__prefix-icon,
.t-notice-bar__suffix-icon {
@@ -71,6 +73,9 @@
color: var(--td-notice-bar-operation-font-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
font-weight: 700;
}
+.t-notice-bar__operation:empty {
+ display: none;
+}
.t-notice-bar__suffix-icon:not(:empty) {
padding-left: var(--td-spacer, 16rpx);
}
diff --git a/miniprogram_npm/tdesign-miniprogram/notice-bar/props.js b/miniprogram_npm/tdesign-miniprogram/notice-bar/props.js
index 57db91a..5b69074 100644
--- a/miniprogram_npm/tdesign-miniprogram/notice-bar/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/notice-bar/props.js
@@ -6,23 +6,23 @@ const props = {
type: String,
value: 'horizontal',
},
- externalClasses: {
- type: Array,
- },
- operation: {
- type: String,
+ interval: {
+ type: Number,
+ value: 2000,
},
marquee: {
type: null,
value: false,
},
+ operation: {
+ type: String,
+ },
prefixIcon: {
type: null,
value: true,
},
suffixIcon: {
type: null,
- value: null,
},
theme: {
type: String,
diff --git a/miniprogram_npm/tdesign-miniprogram/notice-bar/type.d.ts b/miniprogram_npm/tdesign-miniprogram/notice-bar/type.d.ts
index 5e11cd1..61c7ca6 100644
--- a/miniprogram_npm/tdesign-miniprogram/notice-bar/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/notice-bar/type.d.ts
@@ -1,31 +1,27 @@
export interface TdNoticeBarProps {
content?: {
type: null;
- value?: null;
- };
- style?: {
- type: StringConstructor;
- value?: string;
+ value?: string | string[];
};
direction?: {
type: StringConstructor;
value?: 'horizontal' | 'vertical';
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-content', 't-class-prefix-icon', 't-class-operation', 't-class-suffix-icon'];
+ interval?: {
+ type: NumberConstructor;
+ value?: number;
+ };
+ marquee?: {
+ type: null;
+ value?: boolean | NoticeBarMarquee;
};
operation?: {
type: StringConstructor;
value?: string;
};
- marquee?: {
- type: null;
- value?: boolean | DrawMarquee;
- };
prefixIcon?: {
type: null;
- value?: boolean | string | object;
+ value?: string | boolean | object;
};
suffixIcon?: {
type: null;
@@ -44,7 +40,7 @@ export interface TdNoticeBarProps {
value?: boolean;
};
}
-export interface DrawMarquee {
+export interface NoticeBarMarquee {
speed?: number;
loop?: number;
delay?: number;
diff --git a/miniprogram_npm/tdesign-miniprogram/overlay/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/overlay/README.en-US.md
new file mode 100644
index 0000000..e268e09
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/overlay/README.en-US.md
@@ -0,0 +1,31 @@
+
+## API
+
+
+### Overlay Props
+
+name | type | default | description | required
+-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+background-color | String | - | \- | N
+duration | Number | 300 | \- | N
+prevent-scroll-through | Boolean | true | \- | N
+using-custom-navbar | Boolean | false | \- | N
+visible | Boolean | false | \- | N
+z-index | Number | 11000 | \- | N
+
+### Overlay Events
+
+name | params | description
+-- | -- | --
+click | `({ visible: boolean })` | \-
+
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-overlay-bg-color | @font-gray-2 | -
+--td-overlay-transition-duration | 300ms | -
diff --git a/miniprogram_npm/tdesign-miniprogram/overlay/README.md b/miniprogram_npm/tdesign-miniprogram/overlay/README.md
index 8170e5c..b8098af 100644
--- a/miniprogram_npm/tdesign-miniprogram/overlay/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/overlay/README.md
@@ -26,6 +26,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 基础使用
{{ base }}
@@ -34,16 +40,27 @@ isComponent: true
### Overlay Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+background-color | String | - | 遮罩层的背景色 | N
+duration | Number | 300 | 背景色过渡时间,单位毫秒 | N
+prevent-scroll-through | Boolean | true | 防止滚动穿透,即不允许点击和滚动 | N
+using-custom-navbar | Boolean | false | 是否使用了自定义导航栏 | N
visible | Boolean | false | 是否展示 | N
-zIndex | Number | 11000 | 遮罩层及 | N
-duration | Number | 300 | (暂不支持)背景色过渡时间,单位毫秒 | N
-backgroundColor | String | - | 遮罩层的背景色 | N
-preventScrollThrough | Boolean | true | 防止滚动穿透,即不允许点击和滚动 | N
+z-index | Number | 11000 | 遮罩层级 | N
### Overlay Events
名称 | 参数 | 描述
-- | -- | --
click | `({ visible: boolean })` | 点击遮罩时触发
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-overlay-bg-color | @font-gray-2 | -
+--td-overlay-transition-duration | 300ms | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/overlay/index.d.ts b/miniprogram_npm/tdesign-miniprogram/overlay/index.d.ts
new file mode 100644
index 0000000..164efb7
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/overlay/index.d.ts
@@ -0,0 +1,3 @@
+export * from './props';
+export * from './type';
+export * from './overlay';
diff --git a/miniprogram_npm/tdesign-miniprogram/overlay/index.js b/miniprogram_npm/tdesign-miniprogram/overlay/index.js
new file mode 100644
index 0000000..164efb7
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/overlay/index.js
@@ -0,0 +1,3 @@
+export * from './props';
+export * from './type';
+export * from './overlay';
diff --git a/miniprogram_npm/tdesign-miniprogram/overlay/overlay.d.ts b/miniprogram_npm/tdesign-miniprogram/overlay/overlay.d.ts
index ea9b296..98ff36d 100644
--- a/miniprogram_npm/tdesign-miniprogram/overlay/overlay.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/overlay/overlay.d.ts
@@ -1,23 +1,9 @@
import { SuperComponent } from '../common/src/index';
+import { TdOverlayProps } from './type';
+export interface OverlayProps extends TdOverlayProps {
+}
export default class Overlay extends SuperComponent {
- properties: {
- zIndex: {
- type: NumberConstructor;
- value: number;
- };
- duration: {
- type: NumberConstructor;
- value: number;
- };
- backgroundColor: {
- type: StringConstructor;
- value: string;
- };
- preventScrollThrough: {
- type: BooleanConstructor;
- value: boolean;
- };
- };
+ properties: TdOverlayProps;
behaviors: string[];
data: {
prefix: string;
diff --git a/miniprogram_npm/tdesign-miniprogram/overlay/overlay.js b/miniprogram_npm/tdesign-miniprogram/overlay/overlay.js
index 6f98fdc..9e54684 100644
--- a/miniprogram_npm/tdesign-miniprogram/overlay/overlay.js
+++ b/miniprogram_npm/tdesign-miniprogram/overlay/overlay.js
@@ -6,31 +6,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
};
import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
+import props from './props';
import transition from '../mixins/transition';
+import useCustomNavbar from '../mixins/using-custom-navbar';
const { prefix } = config;
const name = `${prefix}-overlay`;
let Overlay = class Overlay extends SuperComponent {
constructor() {
super(...arguments);
- this.properties = {
- zIndex: {
- type: Number,
- value: 11000,
- },
- duration: {
- type: Number,
- value: 300,
- },
- backgroundColor: {
- type: String,
- value: '',
- },
- preventScrollThrough: {
- type: Boolean,
- value: true,
- },
- };
- this.behaviors = [transition()];
+ this.properties = props;
+ this.behaviors = [transition(), useCustomNavbar];
this.data = {
prefix,
classPrefix: name,
@@ -40,7 +25,7 @@ let Overlay = class Overlay extends SuperComponent {
this.observers = {
backgroundColor(v) {
this.setData({
- computedStyle: `background-color: ${v};`,
+ computedStyle: v ? `background-color: ${v};` : '',
});
},
zIndex(v) {
diff --git a/miniprogram_npm/tdesign-miniprogram/overlay/overlay.json b/miniprogram_npm/tdesign-miniprogram/overlay/overlay.json
index 467ce29..79f2730 100644
--- a/miniprogram_npm/tdesign-miniprogram/overlay/overlay.json
+++ b/miniprogram_npm/tdesign-miniprogram/overlay/overlay.json
@@ -1,3 +1,4 @@
{
- "component": true
+ "component": true,
+ "styleIsolation": "apply-shared"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/overlay/overlay.wxml b/miniprogram_npm/tdesign-miniprogram/overlay/overlay.wxml
index 55750dd..90bf385 100644
--- a/miniprogram_npm/tdesign-miniprogram/overlay/overlay.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/overlay/overlay.wxml
@@ -3,7 +3,7 @@
Math.floor((windowWidth * rpx) / 750);
const range = function (num, min, max) {
return Math.min(Math.max(num, min), max);
};
@@ -22,8 +19,20 @@ let PickerItem = class PickerItem extends SuperComponent {
this.relations = {
'../picker/picker': {
type: 'parent',
+ linked(parent) {
+ if ('keys' in parent.data) {
+ const { keys } = parent.data;
+ this.setData({
+ labelAlias: (keys === null || keys === void 0 ? void 0 : keys.label) || 'label',
+ valueAlias: (keys === null || keys === void 0 ? void 0 : keys.value) || 'value',
+ });
+ }
+ },
},
};
+ this.options = {
+ multipleSlots: true,
+ };
this.externalClasses = [`${prefix}-class`];
this.properties = props;
this.observers = {
@@ -38,6 +47,15 @@ let PickerItem = class PickerItem extends SuperComponent {
duration: 0,
value: '',
curIndex: 0,
+ columnIndex: 0,
+ labelAlias: 'label',
+ valueAlias: 'value',
+ };
+ this.lifetimes = {
+ created() {
+ this.StartY = 0;
+ this.StartOffset = 0;
+ },
};
this.methods = {
onTouchStart(event) {
@@ -46,24 +64,25 @@ let PickerItem = class PickerItem extends SuperComponent {
this.setData({ duration: 0 });
},
onTouchMove(event) {
- const { StartY, StartOffset, itemHeight } = this;
+ const { pickItemHeight } = this.data;
+ const { StartY, StartOffset } = this;
const touchDeltaY = event.touches[0].clientY - StartY;
- const deltaY = this.calculateViewDeltaY(touchDeltaY);
+ const deltaY = this.calculateViewDeltaY(touchDeltaY, pickItemHeight);
this.setData({
- offset: range(StartOffset + deltaY, -(this.getCount() * itemHeight), 0),
+ offset: range(StartOffset + deltaY, -(this.getCount() * pickItemHeight), 0),
duration: DefaultDuration,
});
},
onTouchEnd() {
- const { offset } = this.data;
+ const { offset, labelAlias, valueAlias, columnIndex, pickItemHeight } = this.data;
const { options } = this.properties;
if (offset === this.StartOffset) {
return;
}
- const index = range(Math.round(-offset / this.itemHeight), 0, this.getCount() - 1);
+ const index = range(Math.round(-offset / pickItemHeight), 0, this.getCount() - 1);
this.setData({
curIndex: index,
- offset: -index * this.itemHeight,
+ offset: -index * pickItemHeight,
});
if (index === this._selectedIndex) {
return;
@@ -71,26 +90,26 @@ let PickerItem = class PickerItem extends SuperComponent {
wx.nextTick(() => {
var _a, _b, _c;
this._selectedIndex = index;
- this._selectedValue = (_a = options[index]) === null || _a === void 0 ? void 0 : _a.value;
- this._selectedLabel = (_b = options[index]) === null || _b === void 0 ? void 0 : _b.label;
+ this._selectedValue = (_a = options[index]) === null || _a === void 0 ? void 0 : _a[valueAlias];
+ this._selectedLabel = (_b = options[index]) === null || _b === void 0 ? void 0 : _b[labelAlias];
(_c = this.$parent) === null || _c === void 0 ? void 0 : _c.triggerColumnChange({
index,
- column: this.columnIndex || 0,
+ column: columnIndex,
});
});
},
update() {
var _a, _b;
- const { options, value } = this.data;
- const index = options.findIndex((item) => item.value === value);
+ const { options, value, labelAlias, valueAlias, pickItemHeight } = this.data;
+ const index = options.findIndex((item) => item[valueAlias] === value);
const selectedIndex = index > 0 ? index : 0;
this.setData({
- offset: -selectedIndex * this.itemHeight,
+ offset: -selectedIndex * pickItemHeight,
curIndex: selectedIndex,
});
this._selectedIndex = selectedIndex;
- this._selectedValue = (_a = options[selectedIndex]) === null || _a === void 0 ? void 0 : _a.value;
- this._selectedLabel = (_b = options[selectedIndex]) === null || _b === void 0 ? void 0 : _b.label;
+ this._selectedValue = (_a = options[selectedIndex]) === null || _a === void 0 ? void 0 : _a[valueAlias];
+ this._selectedLabel = (_b = options[selectedIndex]) === null || _b === void 0 ? void 0 : _b[labelAlias];
},
resetOrigin() {
this.update();
@@ -101,14 +120,9 @@ let PickerItem = class PickerItem extends SuperComponent {
},
};
}
- calculateViewDeltaY(touchDeltaY) {
+ calculateViewDeltaY(touchDeltaY, itemHeight) {
return Math.abs(touchDeltaY) > itemHeight ? 1.2 * touchDeltaY : touchDeltaY;
}
- created() {
- this.StartY = 0;
- this.StartOffset = 0;
- this.itemHeight = rpx2px(itemHeight);
- }
};
PickerItem = __decorate([
wxComponent()
diff --git a/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.json b/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.json
index a89ef4d..4f0a3f0 100644
--- a/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.json
+++ b/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.json
@@ -1,4 +1,5 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.wxml b/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.wxml
index 805e6e9..2f1fd0a 100644
--- a/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.wxml
@@ -14,12 +14,14 @@
>
- {{option.label}}
+ {{option[labelAlias]}}
+
diff --git a/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.wxss b/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.wxss
index daee0e8..b91038d 100644
--- a/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.wxss
@@ -38,15 +38,16 @@
padding: 144rpx 0;
}
.t-picker-item__item {
- text-align: center;
+ display: flex;
+ justify-content: center;
+ align-items: center;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
- height: var(--td-picker-item-height, 80rpx);
- line-height: var(--td-picker-item-height, 80rpx);
- color: var(--td-picker-item-color, var(--td-font-gray-2, rgba(0, 0, 0, 0.6)));
+ color: var(--td-picker-item-color, var(--td-text-color-secondary, var(--td-font-gray-2, rgba(0, 0, 0, 0.6))));
+ font-size: var(--td-picker-item-font-size, var(--td-font-size-m, 32rpx));
}
.t-picker-item__item--active {
- color: var(--td-picker-item-active-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-picker-item-active-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
font-weight: 600;
}
diff --git a/miniprogram_npm/tdesign-miniprogram/picker/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/picker/README.en-US.md
index 64dbb16..d02c1a0 100644
--- a/miniprogram_npm/tdesign-miniprogram/picker/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/picker/README.en-US.md
@@ -1,18 +1,24 @@
:: BASE_DOC ::
## API
+
### Picker Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
auto-close | Boolean | true | \- | N
cancel-btn | String / Boolean / Object | true | Typescript:`boolean \| string \| ButtonProps` | N
-columns | Array / Function | [] | required。Typescript:`Array \| ((item: Array) => Array)` `type PickerColumn = PickerColumnItem[]` `interface PickerColumnItem { label: string,value: string}`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts) | Y
confirm-btn | String / Boolean / Object | true | Typescript:`boolean \| string \| ButtonProps`,[Button API Documents](./button?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts) | N
-footer | Slot | - | \- | N
-header | Boolean / Slot | true | \- | N
-render-label | String / Function | - | Typescript:`(item: PickerColumnItem) => string` | N
+footer | Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+header | Boolean / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+item-height | Number | 80 | \- | N
+keys | Object | - | Typescript:`KeysType`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+popup-props | Object | {} | popup properties。Typescript:`PopupProps`,[Popup API Documents](./popup?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts) | N
title | String | '' | \- | N
+use-popup | Boolean | true | \- | N
+using-custom-navbar | Boolean | false | \- | N
value | Array | - | Typescript:`Array` `type PickerValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts) | N
default-value | Array | undefined | uncontrolled property。Typescript:`Array` `type PickerValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts) | N
visible | Boolean | false | \- | N
@@ -23,13 +29,40 @@ name | params | description
-- | -- | --
cancel | - | \-
change | `(value: Array, label: string, columns: Array<{ column: number; index: number }> )` | \-
-close | `(trigger: TriggerSource)` | `1.0.1`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confrim-btn'`
+close | `(trigger: TriggerSource)` | `1.0.1`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confirm-btn'`
confirm | `(value: Array, label: string, columns: Array<{ column: number; index: number }> )` | \-
pick | `(value: Array, label: string, column: number, index: number)` | \-
+
### PickerItem Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
format | Function | - | Typescript:`(option: PickerItemOption) => string` | N
options | Array | [] | Typescript:`PickerItemOption[]` `interface PickerItemOption { label: string; value: string \| number }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker-item/type.ts) | N
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-picker-group-height | 400rpx | -
+--td-picker-bg-color | @bg-color-container | -
+--td-picker-border-radius | 24rpx | -
+--td-picker-button-font-size | 32rpx | -
+--td-picker-cancel-color | @font-gray-2 | -
+--td-picker-confirm-color | @brand-color | -
+--td-picker-indicator-bg-color | @bg-color-secondarycontainer | -
+--td-picker-indicator-border-radius | 12rpx | -
+--td-picker-mask-color-bottom | hsla(0, 0%, 100%, 0.4) | -
+--td-picker-mask-color-top | hsla(0, 0%, 100%, 0.92) | -
+--td-picker-title-color | @font-gray-1 | -
+--td-picker-title-font-size | 36rpx | -
+--td-picker-title-font-weight | 600 | -
+--td-picker-title-line-height | 52rpx | -
+--td-picker-toolbar-height | 116rpx | -
+--td-picker-item-active-color | @font-gray-1 | -
+--td-picker-item-color | @font-gray-2 | -
+--td-picker-item-height | 80rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/picker/README.md b/miniprogram_npm/tdesign-miniprogram/picker/README.md
index ce0539d..f623b3f 100644
--- a/miniprogram_npm/tdesign-miniprogram/picker/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/picker/README.md
@@ -19,7 +19,14 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
+
#### 基础选择器
单项和多选选择
@@ -38,19 +45,29 @@ isComponent: true
{{ with-title }}
+### 不使用 Popup
+
+{{ without-popup }}
+
## API
+
### Picker Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
auto-close | Boolean | true | 自动关闭;在确认、取消、点击遮罩层自动关闭,不需要手动设置 visible | N
cancel-btn | String / Boolean / Object | true | 取消按钮文字。TS 类型:`boolean \| string \| ButtonProps` | N
-columns | Array / Function | [] | 必需。配置每一列的选项。TS 类型:`Array \| ((item: Array) => Array)` `type PickerColumn = PickerColumnItem[]` `interface PickerColumnItem { label: string,value: string}`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts) | Y
confirm-btn | String / Boolean / Object | true | 确定按钮文字。TS 类型:`boolean \| string \| ButtonProps`,[Button API Documents](./button?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts) | N
-footer | Slot | - | 已废弃。底部内容 | N
-header | Boolean / Slot | true | 头部内容。值为 true 显示空白头部,值为 false 不显示任何内容,值类型为 TNode 表示自定义头部内容 | N
-render-label | String / Function | - | 自定义label。TS 类型:`(item: PickerColumnItem) => string` | N
+footer | Slot | - | 底部内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+header | Boolean / Slot | true | 头部内容。值为 true 显示空白头部,值为 false 不显示任何内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+item-height | Number | 80 | PickerItem 的子项高度,单位 rpx | N
+keys | Object | - | 用来定义 value / label 在 `options` 中对应的字段别名。TS 类型:`KeysType`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+popup-props | Object | {} | 透传 `Popup` 组件全部属性。TS 类型:`PopupProps`,[Popup API Documents](./popup?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts) | N
title | String | '' | 标题 | N
+use-popup | Boolean | true | 是否使用弹出层包裹 | N
+using-custom-navbar | Boolean | false | 是否使用了自定义导航栏 | N
value | Array | - | 选中值。TS 类型:`Array` `type PickerValue = string \| number`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts) | N
default-value | Array | undefined | 选中值。非受控属性。TS 类型:`Array` `type PickerValue = string \| number`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts) | N
visible | Boolean | false | 是否显示 | N
@@ -61,13 +78,41 @@ visible | Boolean | false | 是否显示 | N
-- | -- | --
cancel | - | 点击取消按钮时触发
change | `(value: Array, label: string, columns: Array<{ column: number; index: number }> )` | 选中变化时候触发,即确认变化时触发
-close | `(trigger: TriggerSource)` | `1.0.1`。关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confrim-btn'`
+close | `(trigger: TriggerSource)` | `1.0.1`。关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker/type.ts)。
`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confirm-btn'`
confirm | `(value: Array, label: string, columns: Array<{ column: number; index: number }> )` | 点击确认按钮时触发
pick | `(value: Array, label: string, column: number, index: number)` | 任何一列选中都会触发,不同的列参数不同。`column` 表示第几列变化,`index` 表示变化那一列的选中项下标
+
### PickerItem Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
format | Function | - | 格式化标签。TS 类型:`(option: PickerItemOption) => string` | N
options | Array | [] | 数据源。TS 类型:`PickerItemOption[]` `interface PickerItemOption { label: string; value: string \| number }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/picker-item/type.ts) | N
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-picker-group-height | 400rpx | -
+--td-picker-bg-color | @bg-color-container | -
+--td-picker-border-radius | 24rpx | -
+--td-picker-button-font-size | 32rpx | -
+--td-picker-cancel-color | @font-gray-2 | -
+--td-picker-confirm-color | @brand-color | -
+--td-picker-indicator-bg-color | @bg-color-secondarycontainer | -
+--td-picker-indicator-border-radius | 12rpx | -
+--td-picker-mask-color-bottom | hsla(0, 0%, 100%, 0.4) | -
+--td-picker-mask-color-top | hsla(0, 0%, 100%, 0.92) | -
+--td-picker-title-color | @font-gray-1 | -
+--td-picker-title-font-size | 36rpx | -
+--td-picker-title-font-weight | 600 | -
+--td-picker-title-line-height | 52rpx | -
+--td-picker-toolbar-height | 116rpx | -
+--td-picker-item-active-color | @font-gray-1 | -
+--td-picker-item-color | @font-gray-2 | -
+--td-picker-item-font-size | @font-size-m | -
+--td-picker-item-height | 80rpx | 已废弃,建议使用 `itemHeight` 属性设置子项高度。
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/picker/picker.d.ts b/miniprogram_npm/tdesign-miniprogram/picker/picker.d.ts
index aecf387..4c215e1 100644
--- a/miniprogram_npm/tdesign-miniprogram/picker/picker.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/picker/picker.d.ts
@@ -1,5 +1,6 @@
import { SuperComponent, RelationsOptions } from '../common/src/index';
export default class Picker extends SuperComponent {
+ behaviors: string[];
properties: import("./type").TdPickerProps;
externalClasses: string[];
options: {
@@ -7,11 +8,20 @@ export default class Picker extends SuperComponent {
};
relations: RelationsOptions;
observers: {
- value(): void;
+ 'value, visible'(): void;
+ keys(obj: any): void;
+ };
+ lifetimes: {
+ attached(): void;
};
data: {
prefix: string;
classPrefix: string;
+ labelAlias: string;
+ valueAlias: string;
+ defaultPopUpProps: {};
+ defaultPopUpzIndex: number;
+ pickItemHeight: number;
};
methods: {
updateChildren(): void;
diff --git a/miniprogram_npm/tdesign-miniprogram/picker/picker.js b/miniprogram_npm/tdesign-miniprogram/picker/picker.js
index 517b321..3e210b7 100644
--- a/miniprogram_npm/tdesign-miniprogram/picker/picker.js
+++ b/miniprogram_npm/tdesign-miniprogram/picker/picker.js
@@ -5,13 +5,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { SuperComponent, wxComponent } from '../common/src/index';
+import { rpx2px } from '../common/utils';
import config from '../common/config';
import props from './props';
+import useCustomNavbar from '../mixins/using-custom-navbar';
const { prefix } = config;
const name = `${prefix}-picker`;
let Picker = class Picker extends SuperComponent {
constructor() {
super(...arguments);
+ this.behaviors = [useCustomNavbar];
this.properties = props;
this.externalClasses = [`${prefix}-class`, `${prefix}-class-confirm`, `${prefix}-class-cancel`, `${prefix}-class-title`];
this.options = {
@@ -26,21 +29,42 @@ let Picker = class Picker extends SuperComponent {
},
};
this.observers = {
- value() {
+ 'value, visible'() {
this.updateChildren();
},
+ keys(obj) {
+ this.setData({
+ labelAlias: (obj === null || obj === void 0 ? void 0 : obj.label) || 'label',
+ valueAlias: (obj === null || obj === void 0 ? void 0 : obj.value) || 'value',
+ });
+ },
+ };
+ this.lifetimes = {
+ attached() {
+ this.setData({
+ pickItemHeight: rpx2px(this.properties.itemHeight),
+ });
+ },
};
this.data = {
prefix,
classPrefix: name,
+ labelAlias: 'label',
+ valueAlias: 'value',
+ defaultPopUpProps: {},
+ defaultPopUpzIndex: 11500,
+ pickItemHeight: 0,
};
this.methods = {
updateChildren() {
- const { value } = this.properties;
+ const { pickItemHeight } = this.data;
+ const { value, defaultValue } = this.properties;
this.$children.forEach((child, index) => {
+ var _a, _b;
child.setData({
- value: (value === null || value === void 0 ? void 0 : value[index]) || '',
- siblingCount: this.$children.length,
+ value: (_b = (_a = value === null || value === void 0 ? void 0 : value[index]) !== null && _a !== void 0 ? _a : defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue[index]) !== null && _b !== void 0 ? _b : '',
+ columnIndex: index,
+ pickItemHeight,
});
child.update();
});
diff --git a/miniprogram_npm/tdesign-miniprogram/picker/picker.json b/miniprogram_npm/tdesign-miniprogram/picker/picker.json
index b93d975..bc013f5 100644
--- a/miniprogram_npm/tdesign-miniprogram/picker/picker.json
+++ b/miniprogram_npm/tdesign-miniprogram/picker/picker.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-popup": "../popup/popup"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/picker/picker.wxml b/miniprogram_npm/tdesign-miniprogram/picker/picker.wxml
index 86e71d8..23aa355 100644
--- a/miniprogram_npm/tdesign-miniprogram/picker/picker.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/picker/picker.wxml
@@ -1,22 +1,17 @@
-
-
-
- {{cancelBtn}}
- {{title}}
- {{confirmBtn}}
-
-
-
-
-
-
-
-
-
+
+
+
+
+
diff --git a/miniprogram_npm/tdesign-miniprogram/picker/picker.wxss b/miniprogram_npm/tdesign-miniprogram/picker/picker.wxss
index 19406e3..962ba87 100644
--- a/miniprogram_npm/tdesign-miniprogram/picker/picker.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/picker/picker.wxss
@@ -28,8 +28,6 @@
.t-picker {
position: relative;
background-color: var(--td-picker-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
border-top-left-radius: var(--td-picker-border-radius, 24rpx);
border-top-right-radius: var(--td-picker-border-radius, 24rpx);
}
@@ -46,7 +44,7 @@
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
- color: var(--td-picker-title-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-picker-title-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
line-height: var(--td-picker-title-line-height, 52rpx);
font-weight: var(--td-picker-title-font-weight, 600);
font-size: var(--td-picker-title-font-size, 36rpx);
@@ -62,7 +60,7 @@
padding: 0 32rpx;
}
.t-picker__cancel {
- color: var(--td-picker-cancel-color, var(--td-font-gray-2, rgba(0, 0, 0, 0.6)));
+ color: var(--td-picker-cancel-color, var(--td-text-color-secondary, var(--td-font-gray-2, rgba(0, 0, 0, 0.6))));
}
.t-picker__confirm {
color: var(--td-picker-confirm-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
@@ -85,15 +83,14 @@
}
.t-picker__mask--top {
top: 0;
- background: linear-gradient(180deg, #fff 0%, rgba(255, 255, 255, 0) 100%);
+ background: linear-gradient(180deg, var(--td-picker-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff))) 0%, rgba(255, 255, 255, 0) 100%);
}
.t-picker__mask--bottom {
bottom: 0;
- background: linear-gradient(180deg, #fff 0%, rgba(255, 255, 255, 0) 100%);
+ background: linear-gradient(180deg, var(--td-picker-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff))) 0%, rgba(255, 255, 255, 0) 100%);
transform: matrix(1, 0, 0, -1, 0, 0);
}
.t-picker__indicator {
- height: var(--td-picker-item-height, 80rpx);
position: absolute;
left: 32rpx;
right: 32rpx;
diff --git a/miniprogram_npm/tdesign-miniprogram/picker/props.js b/miniprogram_npm/tdesign-miniprogram/picker/props.js
index 322e00c..4921846 100644
--- a/miniprogram_npm/tdesign-miniprogram/picker/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/picker/props.js
@@ -7,10 +7,6 @@ const props = {
type: null,
value: true,
},
- columns: {
- type: null,
- value: [],
- },
confirmBtn: {
type: null,
value: true,
@@ -19,13 +15,29 @@ const props = {
type: Boolean,
value: true,
},
- renderLabel: {
- type: null,
+ itemHeight: {
+ type: Number,
+ value: 80,
+ },
+ keys: {
+ type: Object,
+ },
+ popupProps: {
+ type: Object,
+ value: {},
},
title: {
type: String,
value: '',
},
+ usePopup: {
+ type: Boolean,
+ value: true,
+ },
+ usingCustomNavbar: {
+ type: Boolean,
+ value: false,
+ },
value: {
type: Array,
value: null,
diff --git a/miniprogram_npm/tdesign-miniprogram/picker/template.wxml b/miniprogram_npm/tdesign-miniprogram/picker/template.wxml
new file mode 100644
index 0000000..354830c
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/picker/template.wxml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{cancelBtn}}
+ {{title}}
+ {{confirmBtn}}
+
+
+
+
+
+
+
+
+
+
diff --git a/miniprogram_npm/tdesign-miniprogram/picker/type.d.ts b/miniprogram_npm/tdesign-miniprogram/picker/type.d.ts
index 8429b68..ae96123 100644
--- a/miniprogram_npm/tdesign-miniprogram/picker/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/picker/type.d.ts
@@ -1,4 +1,6 @@
import { ButtonProps } from '../button/index';
+import { PopupProps } from '../popup/index';
+import { KeysType } from '../common/common';
export interface TdPickerProps {
autoClose?: {
type: BooleanConstructor;
@@ -8,10 +10,6 @@ export interface TdPickerProps {
type: null;
value?: boolean | string | ButtonProps;
};
- columns: {
- type: ArrayConstructor;
- value?: Array | ((item: Array) => Array);
- };
confirmBtn?: {
type: null;
value?: boolean | string | ButtonProps;
@@ -20,14 +18,30 @@ export interface TdPickerProps {
type: BooleanConstructor;
value?: boolean;
};
- renderLabel?: {
- type: StringConstructor;
- value?: (item: PickerColumnItem) => string;
+ itemHeight?: {
+ type: NumberConstructor;
+ value?: number;
+ };
+ keys?: {
+ type: ObjectConstructor;
+ value?: KeysType;
+ };
+ popupProps?: {
+ type: ObjectConstructor;
+ value?: PopupProps;
};
title?: {
type: StringConstructor;
value?: string;
};
+ usePopup?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+ usingCustomNavbar?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
value?: {
type: ArrayConstructor;
value?: Array;
@@ -41,9 +55,4 @@ export interface TdPickerProps {
value?: boolean;
};
}
-export declare type PickerColumn = PickerColumnItem[];
-export interface PickerColumnItem {
- label: string;
- value: string;
-}
export declare type PickerValue = string | number;
diff --git a/miniprogram_npm/tdesign-miniprogram/popup/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/popup/README.en-US.md
index 3aa395d..286f744 100644
--- a/miniprogram_npm/tdesign-miniprogram/popup/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/popup/README.en-US.md
@@ -1,20 +1,23 @@
:: BASE_DOC ::
## API
+
### Popup Props
name | type | default | description | required
-- | -- | -- | -- | --
-close-btn | Boolean / Slot | - | \- | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+close-btn | Boolean / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
close-on-overlay-click | Boolean | true | \- | N
-content | String / Slot | - | \- | N
+content | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
duration | Number | 240 | \- | N
-external-classes | Array | - | `['t-class', 't-class-overlay', 't-class-content']` | N
-overlay-props | Object | {} | \- | N
-placement | String | top | options:top/left/right/bottom/center | N
+overlay-props | Object | {} | Typescript:`OverlayProps`,[Overlay API Documents](./overlay?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/popup/type.ts) | N
+placement | String | top | options: top/left/right/bottom/center | N
prevent-scroll-through | Boolean | true | \- | N
show-overlay | Boolean | true | \- | N
-visible | Boolean | false | Typescript:`boolean` | N
+using-custom-navbar | Boolean | false | \- | N
+visible | Boolean | - | Typescript:`boolean` | N
default-visible | Boolean | undefined | uncontrolled property。Typescript:`boolean` | N
z-index | Number | 11500 | \- | N
@@ -23,3 +26,18 @@ z-index | Number | 11500 | \- | N
name | params | description
-- | -- | --
visible-change | `(visible: boolean, trigger: PopupSource) ` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/popup/type.ts)。
`type PopupSource = 'close-btn' \| 'overlay'`
+### Popup External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-content | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-popup-bg-color | @bg-color-container | -
+--td-popup-border-radius | @radius-default | -
+--td-popup-close-btn-color | @text-color-primary | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/popup/README.md b/miniprogram_npm/tdesign-miniprogram/popup/README.md
index 620c7f7..6928738 100644
--- a/miniprogram_npm/tdesign-miniprogram/popup/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/popup/README.md
@@ -6,6 +6,7 @@ isComponent: true
---



+
## 引入
全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
@@ -18,6 +19,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
基础弹出层
@@ -33,20 +40,23 @@ isComponent: true
{{ custom-close }}
## API
+
### Popup Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-close-btn | Boolean / Slot | - | 关闭按钮,值类型为 Boolean 时表示是否显示关闭按钮。也可以自定义关闭按钮 | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+close-btn | Boolean / Slot | - | 关闭按钮,值类型为 Boolean 时表示是否显示关闭按钮。也可以自定义关闭按钮。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
close-on-overlay-click | Boolean | true | 点击遮罩层是否关闭 | N
-content | String / Slot | - | 浮层里面的内容 | N
+content | String / Slot | - | 浮层里面的内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
duration | Number | 240 | 动画过渡时间 | N
-external-classes | Array | - | 组件类名,分别用于设置 组件外层元素、遮罩层、浮层内容 等元素类名。`['t-class', 't-class-overlay', 't-class-content']` | N
-overlay-props | Object | {} | 遮罩层的属性,透传至 overlay | N
+overlay-props | Object | {} | 遮罩层的属性,透传至 overlay。TS 类型:`OverlayProps`,[Overlay API Documents](./overlay?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/popup/type.ts) | N
placement | String | top | 浮层出现位置。可选项:top/left/right/bottom/center | N
-prevent-scroll-through | Boolean | true | 防止滚动穿透 | N
+prevent-scroll-through | Boolean | true | 是否阻止背景滚动 | N
show-overlay | Boolean | true | 是否显示遮罩层 | N
-visible | Boolean | false | 是否显示浮层。TS 类型:`boolean` | N
+using-custom-navbar | Boolean | false | 是否使用了自定义导航栏 | N
+visible | Boolean | - | 是否显示浮层。TS 类型:`boolean` | N
default-visible | Boolean | undefined | 是否显示浮层。非受控属性。TS 类型:`boolean` | N
z-index | Number | 11500 | 组件层级,Web 侧样式默认为 5500,移动端样式默认为 1500,小程序样式默认为11500 | N
@@ -55,3 +65,18 @@ z-index | Number | 11500 | 组件层级,Web 侧样式默认为 5500,移动
名称 | 参数 | 描述
-- | -- | --
visible-change | `(visible: boolean, trigger: PopupSource) ` | 当浮层隐藏或显示时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/popup/type.ts)。
`type PopupSource = 'close-btn' \| 'overlay'`
+### Popup External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-content | 内容样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-popup-bg-color | @bg-color-container | -
+--td-popup-border-radius | @radius-default | -
+--td-popup-close-btn-color | @text-color-primary | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/popup/index.d.ts b/miniprogram_npm/tdesign-miniprogram/popup/index.d.ts
new file mode 100644
index 0000000..03c4cf3
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/popup/index.d.ts
@@ -0,0 +1,3 @@
+export * from './props';
+export * from './type';
+export * from './popup';
diff --git a/miniprogram_npm/tdesign-miniprogram/popup/index.js b/miniprogram_npm/tdesign-miniprogram/popup/index.js
new file mode 100644
index 0000000..03c4cf3
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/popup/index.js
@@ -0,0 +1,3 @@
+export * from './props';
+export * from './type';
+export * from './popup';
diff --git a/miniprogram_npm/tdesign-miniprogram/popup/popup.d.ts b/miniprogram_npm/tdesign-miniprogram/popup/popup.d.ts
index 543d354..23dae8c 100644
--- a/miniprogram_npm/tdesign-miniprogram/popup/popup.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/popup/popup.d.ts
@@ -13,7 +13,6 @@ export default class Popup extends SuperComponent {
classPrefix: string;
};
methods: {
- onStopPropagation(): void;
handleOverlayClick(): void;
handleClose(): void;
};
diff --git a/miniprogram_npm/tdesign-miniprogram/popup/popup.js b/miniprogram_npm/tdesign-miniprogram/popup/popup.js
index b38ba13..f679e50 100644
--- a/miniprogram_npm/tdesign-miniprogram/popup/popup.js
+++ b/miniprogram_npm/tdesign-miniprogram/popup/popup.js
@@ -8,6 +8,7 @@ import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
import transition from '../mixins/transition';
+import useCustomNavbar from '../mixins/using-custom-navbar';
delete props.visible;
const { prefix } = config;
const name = `${prefix}-popup`;
@@ -15,7 +16,7 @@ let Popup = class Popup extends SuperComponent {
constructor() {
super(...arguments);
this.externalClasses = [`${prefix}-class`, `${prefix}-class-content`];
- this.behaviors = [transition()];
+ this.behaviors = [transition(), useCustomNavbar];
this.options = {
multipleSlots: true,
};
@@ -25,15 +26,14 @@ let Popup = class Popup extends SuperComponent {
classPrefix: name,
};
this.methods = {
- onStopPropagation() { },
handleOverlayClick() {
const { closeOnOverlayClick } = this.properties;
if (closeOnOverlayClick) {
- this.triggerEvent('visible-change', { visible: false });
+ this.triggerEvent('visible-change', { visible: false, trigger: 'overlay' });
}
},
handleClose() {
- this.triggerEvent('visible-change', { visible: false });
+ this.triggerEvent('visible-change', { visible: false, trigger: 'close-btn' });
},
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/popup/popup.json b/miniprogram_npm/tdesign-miniprogram/popup/popup.json
index 870a7b6..babc8a1 100644
--- a/miniprogram_npm/tdesign-miniprogram/popup/popup.json
+++ b/miniprogram_npm/tdesign-miniprogram/popup/popup.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-overlay": "../overlay/overlay",
"t-icon": "../icon/icon"
diff --git a/miniprogram_npm/tdesign-miniprogram/popup/popup.wxml b/miniprogram_npm/tdesign-miniprogram/popup/popup.wxml
index d58d806..3bb4b94 100644
--- a/miniprogram_npm/tdesign-miniprogram/popup/popup.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/popup/popup.wxml
@@ -1,21 +1,24 @@
-
+
-
+
+
+
+
-
-
@@ -23,9 +26,11 @@
id="popup-overlay"
wx:if="{{showOverlay}}"
visible="{{visible}}"
- class="test"
- z-index="{{overlayProps.zIndex || 11000}}"
- prevent-scroll-through="{{preventScrollThrough || overlayProps.preventScrollThrough}}"
+ usingCustomNavbar="{{usingCustomNavbar}}"
+ z-index="{{overlayProps && overlayProps.zIndex || 11000}}"
+ duration="{{overlayProps && overlayProps.duration || 300}}"
+ background-color="{{overlayProps && overlayProps.backgroundColor || ''}}"
+ prevent-scroll-through="{{preventScrollThrough || (overlayProps ? !!overlayProps.preventScrollThrough : false)}}"
bind:tap="handleOverlayClick"
- style="{{overlayProps.style || ''}}"
+ custom-style="{{overlayProps && overlayProps.style || ''}}"
/>
diff --git a/miniprogram_npm/tdesign-miniprogram/popup/popup.wxs b/miniprogram_npm/tdesign-miniprogram/popup/popup.wxs
index a2da0d0..2486a86 100644
--- a/miniprogram_npm/tdesign-miniprogram/popup/popup.wxs
+++ b/miniprogram_npm/tdesign-miniprogram/popup/popup.wxs
@@ -1,8 +1,18 @@
-function getPopupStyles(zIndex) {
+function getPopupStyles(zIndex, distanceTop, placement) {
var zIndexStyle = zIndex ? 'z-index:' + zIndex + ';' : '';
+ if ((placement === 'top' || placement === 'left' || placement === 'right') && distanceTop) {
+ zIndexStyle = zIndexStyle + 'top:' + distanceTop + 'px;'
+ }
return zIndexStyle;
}
+function onContentTouchMove (e) {
+ if (e.target.dataset.prevention) {
+ return false;
+ };
+}
+
module.exports = {
getPopupStyles: getPopupStyles,
+ onContentTouchMove: onContentTouchMove
};
diff --git a/miniprogram_npm/tdesign-miniprogram/popup/popup.wxss b/miniprogram_npm/tdesign-miniprogram/popup/popup.wxss
index 237cc2b..a4be02c 100644
--- a/miniprogram_npm/tdesign-miniprogram/popup/popup.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/popup/popup.wxss
@@ -30,6 +30,7 @@
z-index: 11500;
max-height: 100vh;
transition: all 300ms ease;
+ background-color: var(--td-popup-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
}
.t-popup__content {
position: relative;
@@ -41,16 +42,23 @@
right: 0;
padding: 20rpx;
line-height: 1;
+ color: var(--td-popup-close-btn-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-popup--top {
top: 0;
left: 0;
width: 100%;
+ border-bottom-left-radius: var(--td-popup-border-radius, var(--td-radius-default, 12rpx));
+ border-bottom-right-radius: var(--td-popup-border-radius, var(--td-radius-default, 12rpx));
}
.t-popup--bottom {
bottom: 0;
left: 0;
- width: 100vw;
+ width: 100%;
+ border-top-left-radius: var(--td-popup-border-radius, var(--td-radius-default, 12rpx));
+ border-top-right-radius: var(--td-popup-border-radius, var(--td-radius-default, 12rpx));
+ padding-bottom: constant(safe-area-inset-bottom);
+ padding-bottom: env(safe-area-inset-bottom);
}
.t-popup--left {
top: 0;
@@ -67,6 +75,7 @@
left: 50%;
transform: scale(1) translate3d(-50%, -50%, 0);
transform-origin: 0% 0%;
+ border-radius: var(--td-popup-border-radius, var(--td-radius-default, 12rpx));
}
.t-popup.t-fade-enter.t-popup--top,
.t-popup.t-fade-leave-to.t-popup--top {
diff --git a/miniprogram_npm/tdesign-miniprogram/popup/props.js b/miniprogram_npm/tdesign-miniprogram/popup/props.js
index dd31f2c..bf5d380 100644
--- a/miniprogram_npm/tdesign-miniprogram/popup/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/popup/props.js
@@ -32,8 +32,9 @@ const props = {
type: Boolean,
value: true,
},
- transitionProps: {
- type: Object,
+ usingCustomNavbar: {
+ type: Boolean,
+ value: false,
},
visible: {
type: Boolean,
@@ -41,7 +42,6 @@ const props = {
},
defaultVisible: {
type: Boolean,
- value: false,
},
zIndex: {
type: Number,
diff --git a/miniprogram_npm/tdesign-miniprogram/popup/type.d.ts b/miniprogram_npm/tdesign-miniprogram/popup/type.d.ts
index fa09661..914749e 100644
--- a/miniprogram_npm/tdesign-miniprogram/popup/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/popup/type.d.ts
@@ -1,4 +1,4 @@
-import { TdTransitionProps } from '../transition/index';
+import { OverlayProps } from '../overlay/index';
export interface TdPopupProps {
closeBtn?: {
type: BooleanConstructor;
@@ -12,10 +12,6 @@ export interface TdPopupProps {
type: StringConstructor;
value?: string;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
duration?: {
type: NumberConstructor;
value?: number;
@@ -26,7 +22,7 @@ export interface TdPopupProps {
};
overlayProps?: {
type: ObjectConstructor;
- value?: object;
+ value?: OverlayProps;
};
placement?: {
type: StringConstructor;
@@ -40,9 +36,9 @@ export interface TdPopupProps {
type: BooleanConstructor;
value?: boolean;
};
- transitionProps?: {
- type: ObjectConstructor;
- value?: TdTransitionProps;
+ usingCustomNavbar?: {
+ type: BooleanConstructor;
+ value?: boolean;
};
visible?: {
type: BooleanConstructor;
@@ -57,6 +53,3 @@ export interface TdPopupProps {
value?: number;
};
}
-export interface PopupVisibleChangeContext {
- trigger: 'close-btn' | 'overlay';
-}
diff --git a/miniprogram_npm/tdesign-miniprogram/progress/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/progress/README.en-US.md
index c4b14b8..238932a 100644
--- a/miniprogram_npm/tdesign-miniprogram/progress/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/progress/README.en-US.md
@@ -1,15 +1,38 @@
:: BASE_DOC ::
## API
+
### Progress Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
color | String / Object / Array | '' | Typescript:`string \| Array \| Record` | N
-external-classes `v0.25.0` | Array | - | `['t-class', 't-class-bar', 't-class-label']` | N
-label | String / Boolean / Slot | true | \- | N
+label | String / Boolean / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
percentage | Number | 0 | \- | N
-status | String | - | options:success/error/warning/active。Typescript:`StatusEnum` `type StatusEnum = 'success' \| 'error' \| 'warning' \| 'active'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
+status | String | - | options: success/error/warning/active。Typescript:`ProgressStatus` `type ProgressStatus = 'success' \| 'error' \| 'warning' \| 'active'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
stroke-width | String / Number | - | \- | N
-theme | String | line | options:line/plump/circle。Typescript:`ThemeEnum` `type ThemeEnum = 'line' \| 'plump' \| 'circle'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
+theme | String | line | options: line/plump/circle。Typescript:`ProgressTheme` `type ProgressTheme = 'line' \| 'plump' \| 'circle'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
track-color | String | '' | \- | N
+### Progress External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-bar | \-
+t-class-label | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-progress-circle-inner-bg-color | @font-white-1 | -
+--td-progress-circle-width | 224rpx | -
+--td-progress-circle-from | 0deg | -
+--td-progress-inner-bg-color | @brand-color | -
+--td-progress-line-stroke-width | 12rpx | -
+--td-progress-stroke-circle-width | 12rpx | -
+--td-progress-stroke-plump-width | 40rpx | -
+--td-progress-track-bg-color | @bg-color-component | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/progress/README.md b/miniprogram_npm/tdesign-miniprogram/progress/README.md
index a95554d..b2e0c32 100644
--- a/miniprogram_npm/tdesign-miniprogram/progress/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/progress/README.md
@@ -28,6 +28,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 01 组件类型
基础进度条
@@ -57,15 +63,38 @@ isComponent: true
{{ circle }}
## API
+
### Progress Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
color | String / Object / Array | '' | 进度条颜色。示例:'#ED7B2F' 或 'orange' 或 `['#f00', '#0ff', '#f0f']` 或 `{ '0%': '#f00', '100%': '#0ff' }` 或 `{ from: '#000', to: '#000' }` 等。TS 类型:`string \| Array \| Record` | N
-external-classes | Array | - | 组件类名,分别用于设置 组件外层、进度文字等元素类名。。`['t-class', 't-class-bar', 't-class-label']` | N
-label | String / Boolean / Slot | true | 进度百分比,可自定义 | N
+label | String / Boolean / Slot | true | 进度百分比,可自定义。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
percentage | Number | 0 | 进度条百分比 | N
-status | String | - | 进度条状态。可选项:success/error/warning/active。TS 类型:`StatusEnum` `type StatusEnum = 'success' \| 'error' \| 'warning' \| 'active'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
-stroke-width | String / Number | - | 进度条线宽,默认单位 `px`。| N
-theme | String | line | 进度条风格。值为 line,标签(label)显示在进度条右侧;值为 plump,标签(label)显示在进度条里面;值为 circle,标签(label)显示在进度条正中间。可选项:line/plump/circle。TS 类型:`ThemeEnum` `type ThemeEnum = 'line' \| 'plump' \| 'circle'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
+status | String | - | 进度条状态。可选项:success/error/warning/active。TS 类型:`ProgressStatus` `type ProgressStatus = 'success' \| 'error' \| 'warning' \| 'active'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
+stroke-width | String / Number | - | 进度条线宽,默认单位 `px` | N
+theme | String | line | 进度条风格。值为 line,标签(label)显示在进度条右侧;值为 plump,标签(label)显示在进度条里面;值为 circle,标签(label)显示在进度条正中间。可选项:line/plump/circle。TS 类型:`ProgressTheme` `type ProgressTheme = 'line' \| 'plump' \| 'circle'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
track-color | String | '' | 进度条未完成部分颜色 | N
+### Progress External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-bar | 进度文字样式类
+t-class-label | 标签样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-progress-circle-inner-bg-color | @font-white-1 | -
+--td-progress-circle-width | 224rpx | -
+--td-progress-circle-from | 0deg | -
+--td-progress-inner-bg-color | @brand-color | -
+--td-progress-line-stroke-width | 12rpx | -
+--td-progress-stroke-circle-width | 12rpx | -
+--td-progress-stroke-plump-width | 40rpx | -
+--td-progress-track-bg-color | @bg-color-component | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/progress/progress.d.ts b/miniprogram_npm/tdesign-miniprogram/progress/progress.d.ts
index c627dc5..ea66946 100644
--- a/miniprogram_npm/tdesign-miniprogram/progress/progress.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/progress/progress.d.ts
@@ -12,15 +12,13 @@ export default class Progress extends SuperComponent {
heightBar: string;
computedStatus: string;
computedProgress: number;
+ isIOS: boolean;
};
+ attached(): void;
observers: {
percentage(percentage: any): void;
color(color: any): void;
strokeWidth(strokeWidth: any): string;
- theme(theme: any): void;
trackColor(trackColor: any): void;
};
- methods: {
- getInnerDiameter(): void;
- };
}
diff --git a/miniprogram_npm/tdesign-miniprogram/progress/progress.js b/miniprogram_npm/tdesign-miniprogram/progress/progress.js
index 4f91512..fae98d5 100644
--- a/miniprogram_npm/tdesign-miniprogram/progress/progress.js
+++ b/miniprogram_npm/tdesign-miniprogram/progress/progress.js
@@ -8,7 +8,7 @@ import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
import { getBackgroundColor } from './utils';
-import { unitConvert, getRect } from '../common/utils';
+import { unitConvert, deviceInfo } from '../common/utils';
const { prefix } = config;
const name = `${prefix}-progress`;
let Progress = class Progress extends SuperComponent {
@@ -26,6 +26,7 @@ let Progress = class Progress extends SuperComponent {
heightBar: '',
computedStatus: '',
computedProgress: 0,
+ isIOS: false,
};
this.observers = {
percentage(percentage) {
@@ -49,30 +50,19 @@ let Progress = class Progress extends SuperComponent {
heightBar: unitConvert(strokeWidth),
});
},
- theme(theme) {
- if (theme === 'circle') {
- this.getInnerDiameter();
- }
- },
trackColor(trackColor) {
this.setData({
bgColorBar: trackColor,
});
},
};
- this.methods = {
- getInnerDiameter() {
- const { strokeWidth } = this.properties;
- const wrapID = `.${name}__canvas--circle`;
- if (strokeWidth) {
- getRect(this, wrapID).then((wrapRect) => {
- this.setData({
- innerDiameter: wrapRect.width - unitConvert(strokeWidth) * 2,
- });
- });
- }
- },
- };
+ }
+ attached() {
+ var _a;
+ const isIOS = !!(((_a = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.system) === null || _a === void 0 ? void 0 : _a.toLowerCase().search('ios')) + 1);
+ this.setData({
+ isIOS,
+ });
}
};
Progress = __decorate([
diff --git a/miniprogram_npm/tdesign-miniprogram/progress/progress.json b/miniprogram_npm/tdesign-miniprogram/progress/progress.json
index 049940c..f783dae 100644
--- a/miniprogram_npm/tdesign-miniprogram/progress/progress.json
+++ b/miniprogram_npm/tdesign-miniprogram/progress/progress.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/progress/progress.wxml b/miniprogram_npm/tdesign-miniprogram/progress/progress.wxml
index d1d02e5..b844690 100644
--- a/miniprogram_npm/tdesign-miniprogram/progress/progress.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/progress/progress.wxml
@@ -4,19 +4,16 @@
@@ -25,7 +22,8 @@
style="background: {{colorBar}}; width: {{computedProgress + '%'}}"
>
-
+
+
{{ _.isString(label)? label: computedProgress + '%' }}
-
+
@@ -57,36 +52,37 @@
{{ _.isString(label)? label: computedProgress + '%' }}
-
+
-
+
{{ _.isString(label)? label: computedProgress + '%' }}
-
+
-
+
{{ _.isString(label)? label: computedProgress + '%' }}
-
+
diff --git a/miniprogram_npm/tdesign-miniprogram/progress/progress.wxs b/miniprogram_npm/tdesign-miniprogram/progress/progress.wxs
index 04d10f4..37f05b2 100644
--- a/miniprogram_npm/tdesign-miniprogram/progress/progress.wxs
+++ b/miniprogram_npm/tdesign-miniprogram/progress/progress.wxs
@@ -23,7 +23,15 @@ var CIRCLE_STATUS_ICON = {
warning: 'error',
};
-var getAriaLabel = function (status) {
+/**
+ *
+ * 1. getIOSAriaLabel, getAndroidAriaLabel 两个函数的初衷是处理progress异常情况的文案识别。
+ * 2. iOS可以识别%,而安卓不会识别%,如 80, iOS可以识别成 80%, 而安卓只会80,因此android部分做了一个% 拼接,后续看是否有更好的方案去解决。
+ * 3. 安卓 talkback 版本为 8.1.0.278818032 ,只会读一次 80, 最新版本talkback 会读 80.0, 80。(目前也是一个痛点,啰嗦了)
+ *
+ */
+
+var getIOSAriaLabel = function (status) {
if (status === 'error') {
return '进度失败';
}
@@ -33,6 +41,16 @@ var getAriaLabel = function (status) {
return '';
};
+var getAndroidAriaLabel = function (status) {
+ if (status === 'error') {
+ return '%' + ',进度失败';
+ }
+ if (status === 'warning') {
+ return '%' + ',进度异常';
+ }
+ return '%';
+};
+
module.exports = {
STATUS: STATUS,
STATUS_TEXT: STATUS_TEXT,
@@ -40,5 +58,6 @@ module.exports = {
STATUS_COLOR: STATUS_COLOR,
LINE_STATUS_ICON: LINE_STATUS_ICON,
CIRCLE_STATUS_ICON: CIRCLE_STATUS_ICON,
- getAriaLabel: getAriaLabel,
+ getAndroidAriaLabel: getAndroidAriaLabel,
+ getIOSAriaLabel: getIOSAriaLabel,
};
diff --git a/miniprogram_npm/tdesign-miniprogram/progress/progress.wxss b/miniprogram_npm/tdesign-miniprogram/progress/progress.wxss
index 8d684f4..135144d 100644
--- a/miniprogram_npm/tdesign-miniprogram/progress/progress.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/progress/progress.wxss
@@ -25,6 +25,11 @@
bottom: 0;
transform: scale(1.5);
}
+.t-progress {
+ --td-progress-inner-bg-color: var(--td-brand-color, var(--td-primary-color-7, #0052d9));
+ --td-progress-track-bg-color: var(--td-bg-color-component, var(--td-gray-color-3, #e7e7e7));
+ --td-progress-circle-from: 0deg;
+}
.t-progress__inner {
position: relative;
height: 100%;
@@ -34,13 +39,14 @@
}
.t-progress__bar {
width: 100%;
- height: 12rpx;
+ height: var(--td-progress-line-stroke-width, 12rpx);
overflow: hidden;
background: var(--td-progress-track-bg-color, var(--td-bg-color-component, var(--td-gray-color-3, #e7e7e7)));
border-radius: var(--td-radius-round, 999px);
}
.t-progress__info {
- margin-left: var(--td-spacer, 16rpx);
+ padding-left: var(--td-spacer, 16rpx);
+ box-sizing: border-box;
color: var(--td-progress-info-dark-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
white-space: nowrap;
display: inline-flex;
@@ -54,8 +60,8 @@
font-size: calc(var(--td-font-size-base, 28rpx) + 2px);
}
.t-progress--plump {
- height: 40rpx;
- border-radius: calc(40rpx / 2);
+ height: var(--td-progress-stroke-plump-width, 40rpx);
+ border-radius: calc(var(--td-progress-stroke-plump-width, 40rpx) / 2);
display: flex;
align-items: center;
}
@@ -66,7 +72,7 @@
position: absolute;
top: 50%;
right: var(--td-spacer, 16rpx);
- color: var(--td-progress-info-light-color, var(--td-font-white-1, #ffffff));
+ color: var(--td-progress-info-light-color, var(--td-text-color-anti, var(--td-font-white-1, #ffffff)));
transform: translateY(-50%);
}
.t-progress--under-ten .t-progress__info,
@@ -78,8 +84,8 @@
}
.t-progress__canvas--circle {
position: relative;
- width: 224rpx;
- height: 224rpx;
+ width: var(--td-progress-circle-width, 224rpx);
+ height: var(--td-progress-circle-width, 224rpx);
border-radius: var(--td-radius-circle, 50%);
}
.t-progress__canvas--circle .t-progress__canvas--inner {
@@ -87,14 +93,14 @@
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
- width: calc(100% - 12rpx*2);
- height: calc(100% - 12rpx*2);
+ width: calc(100% - var(--td-progress-stroke-circle-width, 12rpx)*2);
+ height: calc(100% - var(--td-progress-stroke-circle-width, 12rpx)*2);
border-radius: var(--td-radius-circle, 50%);
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
- background-color: var(--td-progress-circle-inner-bg-color, var(--td-font-white-1, #ffffff));
+ background-color: var(--td-progress-circle-inner-bg-color, var(--td-text-color-anti, var(--td-font-white-1, #ffffff)));
}
.t-progress__canvas--circle .t-progress__info {
margin: 0;
diff --git a/miniprogram_npm/tdesign-miniprogram/progress/props.js b/miniprogram_npm/tdesign-miniprogram/progress/props.js
index d203455..406b7bc 100644
--- a/miniprogram_npm/tdesign-miniprogram/progress/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/progress/props.js
@@ -3,9 +3,6 @@ const props = {
type: null,
value: '',
},
- externalClasses: {
- type: Array,
- },
label: {
type: null,
value: true,
@@ -20,6 +17,10 @@ const props = {
strokeWidth: {
type: null,
},
+ style: {
+ type: String,
+ value: '',
+ },
theme: {
type: String,
value: 'line',
diff --git a/miniprogram_npm/tdesign-miniprogram/progress/type.d.ts b/miniprogram_npm/tdesign-miniprogram/progress/type.d.ts
index d0e3d07..763d3bc 100644
--- a/miniprogram_npm/tdesign-miniprogram/progress/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/progress/type.d.ts
@@ -3,14 +3,6 @@ export interface TdProgressProps {
type: null;
value?: string | Array | Record;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-bar', 't-class-label'];
- };
label?: {
type: null;
value?: string | boolean;
@@ -21,20 +13,24 @@ export interface TdProgressProps {
};
status?: {
type: StringConstructor;
- value?: StatusEnum;
+ value?: ProgressStatus;
};
strokeWidth?: {
type: null;
value?: string | number;
};
+ style?: {
+ type: StringConstructor;
+ value?: string;
+ };
theme?: {
type: StringConstructor;
- value?: ThemeEnum;
+ value?: ProgressTheme;
};
trackColor?: {
type: StringConstructor;
value?: string;
};
}
-export declare type StatusEnum = 'success' | 'error' | 'warning' | 'active';
-export declare type ThemeEnum = 'line' | 'plump' | 'circle';
+export declare type ProgressStatus = 'success' | 'error' | 'warning' | 'active';
+export declare type ProgressTheme = 'line' | 'plump' | 'circle';
diff --git a/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/README.en-US.md
index e4cc94c..88a0f48 100644
--- a/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/README.en-US.md
@@ -1,24 +1,52 @@
:: BASE_DOC ::
## API
+
### PullDownRefresh Props
name | type | default | description | required
-- | -- | -- | -- | --
-external-classes | Array | - | `['t-class', 't-class-loading','t-class-text', 't-class-indicator']` | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+disabled | Boolean | false | disabled pull down refresh | N
+enable-back-to-top | Boolean | true | `1.1.5` | N
+enable-passive | Boolean | false | `1.1.5` | N
+header | Slot | - | `1.2.10`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
loading-bar-height | String / Number | 50 | \- | N
loading-props | Object | - | Typescript:`LoadingProps`,[Loading API Documents](./loading?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/pull-down-refresh/type.ts) | N
loading-texts | Array | [] | Typescript:`string[]` | N
+lower-threshold | String / Number | 50 | `1.1.5` | N
max-bar-height | String / Number | 80 | \- | N
refresh-timeout | Number | 3000 | \- | N
+scroll-into-view | String | - | `1.1.5` | N
+show-scrollbar | Boolean | true | \- | N
+upper-threshold | String / Number | 50 | `1.1.5` | N
value | Boolean | false | \- | N
-default-value | Boolean | false | uncontrolled property | N
+default-value | Boolean | undefined | uncontrolled property | N
### PullDownRefresh Events
name | params | description
-- | -- | --
change | `(value: boolean)` | \-
+dragend | `(scrollTop: number, scrollLeft: number)` | `1.2.10`
+dragging | `(scrollTop: number, scrollLeft: number)` | `1.2.10`
+dragstart | `(scrollTop: number, scrollLeft: number)` | `1.2.10`
refresh | \- | \-
scrolltolower | \- | \-
timeout | \- | \-
+### PullDownRefresh External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-indicator | \-
+t-class-loading | \-
+t-class-text | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-pull-down-refresh-color | @font-gray-3 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/README.md b/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/README.md
index afb61c9..e68e849 100644
--- a/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/README.md
@@ -6,6 +6,7 @@ isComponent: true
---



+
## 引入
全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
@@ -18,35 +19,67 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 顶部下拉刷新
由于组件内无法监听页面滚动,需要由页面获取组件实例,并将页面滚动事件传递到组件。
{{ base }}
-
-
> 在使用 pull-down-refresh 组件的页面,建议开启 `disableScroll: true`
## API
+
### PullDownRefresh Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-external-classes | Array | - | 加载loading样式。`['t-class', 't-class-loading','t-class-text', 't-class-indicator']` | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+disabled | Boolean | false | 是否禁用下拉刷新 | N
+enable-back-to-top | Boolean | true | `1.1.5`。iOS点击顶部状态栏、安卓双击标题栏时,滚动条返回顶部,只支持竖向。自 2.27.3 版本开始,若非显式设置为 false,则在显示尺寸大于屏幕 90% 时自动开启 | N
+enable-passive | Boolean | false | `1.1.5`。开启 passive 特性,能优化一定的滚动性能 | N
+header | Slot | - | `1.2.10`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | 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
+lower-threshold | String / Number | 50 | `1.1.5`。距底部/右边多远时,触发 scrolltolower 事件 | N
max-bar-height | String / Number | 80 | 最大下拉高度,如果值为数字则单位是:'px' | N
refresh-timeout | Number | 3000 | 刷新超时时间 | N
+scroll-into-view | String | - | `1.1.5`。值应为某子元素id(id不能以数字开头)。设置哪个方向可滚动,则在哪个方向滚动到该元素 | N
+show-scrollbar | Boolean | true | 滚动条显隐控制 (同时开启 enhanced 属性后生效) | N
+upper-threshold | String / Number | 50 | `1.1.5`。距顶部/左边多远时,触发 scrolltoupper 事件 | N
value | Boolean | false | 组件状态,值为 `true` 表示下拉状态,值为 `false` 表示收起状态 | N
-default-value | Boolean | false | 组件状态,值为 `true` 表示下拉状态,值为 `false` 表示收起状态。非受控属性 | N
+default-value | Boolean | undefined | 组件状态,值为 `true` 表示下拉状态,值为 `false` 表示收起状态。非受控属性 | N
### PullDownRefresh Events
名称 | 参数 | 描述
-- | -- | --
change | `(value: boolean)` | 下拉或收起时触发,用户手势往下滑动触发下拉状态,手势松开触发收起状态
+dragend | `(scrollTop: number, scrollLeft: number)` | `1.2.10`。滑动结束事件
+dragging | `(scrollTop: number, scrollLeft: number)` | `1.2.10`。滑动事件
+dragstart | `(scrollTop: number, scrollLeft: number)` | `1.2.10`。滑动开始事件
refresh | \- | 结束下拉时触发
scrolltolower | \- | 滚动到页面底部时触发
timeout | \- | 刷新超时触发
+### PullDownRefresh External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-indicator | 指示样式类
+t-class-loading | 加载样式类
+t-class-text | 文本样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-pull-down-refresh-color | @font-gray-3 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/props.js b/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/props.js
index 7921dec..5edf444 100644
--- a/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/props.js
@@ -1,10 +1,21 @@
const props = {
+ disabled: {
+ type: Boolean,
+ value: false,
+ },
+ enableBackToTop: {
+ type: Boolean,
+ value: true,
+ },
+ enablePassive: {
+ type: Boolean,
+ value: false,
+ },
externalClasses: {
type: Array,
},
loadingBarHeight: {
- type: String,
- optionalTypes: [Number],
+ type: null,
value: 50,
},
loadingProps: {
@@ -14,15 +25,30 @@ const props = {
type: Array,
value: [],
},
+ lowerThreshold: {
+ type: null,
+ value: 50,
+ },
maxBarHeight: {
- type: String,
- optionalTypes: [Number],
+ type: null,
value: 80,
},
refreshTimeout: {
type: Number,
value: 3000,
},
+ scrollIntoView: {
+ type: String,
+ value: '',
+ },
+ showScrollbar: {
+ type: Boolean,
+ value: true,
+ },
+ upperThreshold: {
+ type: null,
+ value: 50,
+ },
value: {
type: Boolean,
value: null,
diff --git a/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.d.ts b/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.d.ts
index 7e34668..e76395e 100644
--- a/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.d.ts
@@ -6,13 +6,13 @@ export default class PullDownRefresh extends SuperComponent {
pageY: number;
} | null;
isPulling: boolean;
- maxBarHeight: number;
- loadingBarHeight: number;
maxRefreshAnimateTimeFlag: number;
closingAnimateTimeFlag: number;
+ refreshStatusTimer: any;
externalClasses: string[];
options: {
multipleSlots: boolean;
+ pureDataPattern: RegExp;
};
relations: RelationsOptions;
properties: import("./type").TdPullDownRefreshProps;
@@ -20,10 +20,13 @@ export default class PullDownRefresh extends SuperComponent {
prefix: string;
classPrefix: string;
barHeight: number;
+ tipsHeight: number;
refreshStatus: number;
loosing: boolean;
enableToRefresh: boolean;
scrollTop: number;
+ _maxBarHeight: number;
+ _loadingBarHeight: number;
};
lifetimes: {
attached(): void;
@@ -31,20 +34,23 @@ export default class PullDownRefresh extends SuperComponent {
};
observers: {
value(val: any): void;
- maxBarHeight(val: any): void;
- loadingBarHeight(val: any): void;
+ barHeight(val: any): void;
+ maxBarHeight(v: any): void;
+ loadingBarHeight(v: any): void;
};
methods: {
+ resetTimer(): void;
onScrollToBottom(): void;
onScrollToTop(): void;
onScroll(e: any): void;
onTouchStart(e: WechatMiniprogram.Component.TrivialInstance): void;
onTouchMove(e: WechatMiniprogram.Component.TrivialInstance): void;
onTouchEnd(e: WechatMiniprogram.Component.TrivialInstance): void;
- toRpx(v: number | string): number;
- toPx(v: number): number;
- setRefreshBarHeight(barHeight: number): Promise;
- close(): void;
+ onDragStart(e: WechatMiniprogram.ScrollViewDragStart): void;
+ onDragging(e: WechatMiniprogram.ScrollViewDragging): void;
+ onDragEnd(e: WechatMiniprogram.ScrollViewDragEnd): void;
+ doRefresh(): void;
+ setRefreshBarHeight(value: number): Promise;
setScrollTop(scrollTop: number): void;
scrollToTop(): void;
};
diff --git a/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.js b/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.js
index 31af93d..7fef8b3 100644
--- a/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.js
+++ b/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.js
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
+import { unitConvert, systemInfo } from '../common/utils';
const { prefix } = config;
const name = `${prefix}-pull-down-refresh`;
let PullDownRefresh = class PullDownRefresh extends SuperComponent {
@@ -15,13 +16,13 @@ let PullDownRefresh = class PullDownRefresh extends SuperComponent {
this.pixelRatio = 1;
this.startPoint = null;
this.isPulling = false;
- this.maxBarHeight = 0;
- this.loadingBarHeight = 200;
this.maxRefreshAnimateTimeFlag = 0;
this.closingAnimateTimeFlag = 0;
- this.externalClasses = [`${prefix}-class`, `${prefix}-class-loading`, `${prefix}-class-tex`, `${prefix}-class-indicator`];
+ this.refreshStatusTimer = null;
+ this.externalClasses = [`${prefix}-class`, `${prefix}-class-loading`, `${prefix}-class-text`, `${prefix}-class-indicator`];
this.options = {
multipleSlots: true,
+ pureDataPattern: /^_/,
};
this.relations = {
'../back-top/back-top': {
@@ -33,50 +34,71 @@ let PullDownRefresh = class PullDownRefresh extends SuperComponent {
prefix,
classPrefix: name,
barHeight: 0,
+ tipsHeight: 0,
refreshStatus: -1,
loosing: false,
enableToRefresh: true,
scrollTop: 0,
+ _maxBarHeight: 0,
+ _loadingBarHeight: 0,
};
this.lifetimes = {
attached() {
- const { screenWidth } = wx.getSystemInfoSync();
- const { maxBarHeight, loadingBarHeight } = this.properties;
+ const { screenWidth } = systemInfo;
+ const { loadingTexts, maxBarHeight, loadingBarHeight } = this.properties;
+ this.setData({
+ _maxBarHeight: unitConvert(maxBarHeight),
+ _loadingBarHeight: unitConvert(loadingBarHeight),
+ loadingTexts: Array.isArray(loadingTexts) && loadingTexts.length >= 4
+ ? loadingTexts
+ : ['下拉刷新', '松手刷新', '正在刷新', '刷新完成'],
+ });
this.pixelRatio = 750 / screenWidth;
- if (maxBarHeight) {
- this.maxBarHeight = this.toRpx(maxBarHeight);
- }
- if (loadingBarHeight) {
- this.setData({
- computedLoadingBarHeight: this.toRpx(loadingBarHeight),
- });
- this.loadingBarHeight = this.toRpx(loadingBarHeight);
- }
},
detached() {
clearTimeout(this.maxRefreshAnimateTimeFlag);
clearTimeout(this.closingAnimateTimeFlag);
+ this.resetTimer();
},
};
this.observers = {
value(val) {
if (!val) {
clearTimeout(this.maxRefreshAnimateTimeFlag);
- this.setData({ refreshStatus: 3 });
- this.close();
+ if (this.data.refreshStatus > 0) {
+ this.setData({
+ refreshStatus: 3,
+ });
+ }
+ this.setData({ barHeight: 0 });
+ }
+ else {
+ this.doRefresh();
}
},
- maxBarHeight(val) {
- this.maxBarHeight = this.toRpx(val);
+ barHeight(val) {
+ this.resetTimer();
+ if (val === 0 && this.data.refreshStatus !== -1) {
+ this.refreshStatusTimer = setTimeout(() => {
+ this.setData({ refreshStatus: -1 });
+ }, 240);
+ }
+ this.setData({ tipsHeight: Math.min(val, this.data._loadingBarHeight) });
},
- loadingBarHeight(val) {
- this.setData({
- computedLoadingBarHeight: this.toRpx(val),
- });
- this.loadingBarHeight = this.toRpx(val);
+ maxBarHeight(v) {
+ this.setData({ _maxBarHeight: unitConvert(v) });
+ },
+ loadingBarHeight(v) {
+ this.setData({ _loadingBarHeight: unitConvert(v) });
},
};
this.methods = {
+ resetTimer() {
+ if (this.refreshStatusTimer) {
+ clearTimeout(this.refreshStatusTimer);
+ this.refreshStatusTimer = null;
+ }
+ },
onScrollToBottom() {
this.triggerEvent('scrolltolower');
},
@@ -93,7 +115,7 @@ let PullDownRefresh = class PullDownRefresh extends SuperComponent {
this.triggerEvent('scroll', { scrollTop });
},
onTouchStart(e) {
- if (this.isPulling || !this.data.enableToRefresh)
+ if (this.isPulling || !this.data.enableToRefresh || this.properties.disabled)
return;
const { touches } = e;
if (touches.length !== 1)
@@ -104,63 +126,68 @@ let PullDownRefresh = class PullDownRefresh extends SuperComponent {
this.isPulling = true;
},
onTouchMove(e) {
- if (!this.startPoint)
+ if (!this.startPoint || this.properties.disabled)
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);
- }
- else {
- this.setRefreshBarHeight(barHeight);
- }
+ if (offset > 0) {
+ this.setRefreshBarHeight(offset);
}
},
onTouchEnd(e) {
- if (!this.startPoint)
+ if (!this.startPoint || this.properties.disabled)
return;
const { changedTouches } = e;
if (changedTouches.length !== 1)
return;
const { pageY } = changedTouches[0];
- const barHeight = this.toRpx(pageY - this.startPoint.pageY);
+ const barHeight = pageY - this.startPoint.pageY;
this.startPoint = null;
+ this.isPulling = false;
this.setData({ loosing: true });
- if (barHeight > this.loadingBarHeight) {
- this.setData({
- barHeight: this.loadingBarHeight,
- refreshStatus: 2,
- });
- this.triggerEvent('change', { value: true });
+ if (barHeight > this.data._loadingBarHeight) {
+ this._trigger('change', { value: true });
this.triggerEvent('refresh');
- this.maxRefreshAnimateTimeFlag = setTimeout(() => {
- this.maxRefreshAnimateTimeFlag = null;
- if (this.data.refreshStatus === 2) {
- this.triggerEvent('timeout');
- this.close();
- }
- }, this.properties.refreshTimeout);
}
else {
- this.close();
+ this.setData({ barHeight: 0 });
}
},
- toRpx(v) {
- if (typeof v === 'number')
- return v * this.pixelRatio;
- return parseInt(v, 10);
+ onDragStart(e) {
+ const { scrollTop, scrollLeft } = e.detail;
+ this.triggerEvent('dragstart', { scrollTop, scrollLeft });
},
- toPx(v) {
- return v / this.pixelRatio;
+ onDragging(e) {
+ const { scrollTop, scrollLeft } = e.detail;
+ this.triggerEvent('dragging', { scrollTop, scrollLeft });
},
- setRefreshBarHeight(barHeight) {
+ onDragEnd(e) {
+ const { scrollTop, scrollLeft } = e.detail;
+ this.triggerEvent('dragend', { scrollTop, scrollLeft });
+ },
+ doRefresh() {
+ if (this.properties.disabled)
+ return;
+ this.setData({
+ barHeight: this.data._loadingBarHeight,
+ refreshStatus: 2,
+ loosing: true,
+ });
+ this.maxRefreshAnimateTimeFlag = setTimeout(() => {
+ this.maxRefreshAnimateTimeFlag = null;
+ if (this.data.refreshStatus === 2) {
+ this.triggerEvent('timeout');
+ this._trigger('change', { value: false });
+ }
+ }, this.properties.refreshTimeout);
+ },
+ setRefreshBarHeight(value) {
+ const barHeight = Math.min(value, this.data._maxBarHeight);
const data = { barHeight };
- if (barHeight >= this.loadingBarHeight) {
+ if (barHeight >= this.data._loadingBarHeight) {
data.refreshStatus = 1;
}
else {
@@ -170,16 +197,6 @@ let PullDownRefresh = class PullDownRefresh extends SuperComponent {
this.setData(data, () => resolve(barHeight));
});
},
- close() {
- const animationDuration = 240;
- this.setData({ barHeight: 0 });
- this.triggerEvent('change', { value: false });
- this.closingAnimateTimeFlag = setTimeout(() => {
- this.closingAnimateTimeFlag = null;
- this.setData({ refreshStatus: -1 });
- this.isPulling = false;
- }, animationDuration);
- },
setScrollTop(scrollTop) {
this.setData({ scrollTop });
},
diff --git a/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.json b/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.json
index e570665..f20e164 100644
--- a/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.json
+++ b/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-loading": "../loading/loading"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.wxml b/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.wxml
index 08e0e8b..5bfa68f 100644
--- a/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/pull-down-refresh/pull-down-refresh.wxml
@@ -3,24 +3,40 @@
+
+
-
+
;
+ type: null;
value?: string | number;
};
loadingProps?: {
@@ -21,15 +28,30 @@ export interface TdPullDownRefreshProps {
type: ArrayConstructor;
value?: string[];
};
+ lowerThreshold?: {
+ type: null;
+ value?: string | number;
+ };
maxBarHeight?: {
- type: StringConstructor;
- optionalTypes: Array;
+ type: null;
value?: string | number;
};
refreshTimeout?: {
type: NumberConstructor;
value?: number;
};
+ scrollIntoView?: {
+ type: StringConstructor;
+ value?: string;
+ };
+ showScrollbar?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+ upperThreshold?: {
+ type: null;
+ value?: string | number;
+ };
value?: {
type: BooleanConstructor;
value?: boolean;
diff --git a/miniprogram_npm/tdesign-miniprogram/radio-group/README.md b/miniprogram_npm/tdesign-miniprogram/radio-group/README.md
deleted file mode 100644
index 24b2206..0000000
--- a/miniprogram_npm/tdesign-miniprogram/radio-group/README.md
+++ /dev/null
@@ -1,60 +0,0 @@
----
-title: radio-group
-description: 组合单选框。
-spline: form
-isComponent: true
----
-
-### 特性及兼容性
-
-无
-
-## 引入
-
-### 引入组件
-
-在 `app.json` 或 `page.json` 中引入组件:
-
-```json
-"usingComponents": {
- "t-radio": "tdesign-miniprogram/radio/radio",
- "t-radio-group": "tdesign-miniprogram/radio-group/radio-group"
-}
-```
-
-## 用法
-
-### 组件方式
-
-```html
-
-
-
-
-
-```
-
-## API
-
-### `` 组件
-
-组件路径:`tdesign-miniprogram/radio-group/radio-group`
-
-#### Props
-
-| 属性 | 值类型 | 默认值 | 必传 | 说明 |
-| -------- | --------- | ------ | ---- | ---------------------- |
-| value | `String` | - | N | 当前选中项的标识符 |
-| name | `String` | - | N | 在表单内提交时的标识符 |
-
-### Slots
-
-| 名称 | 说明 |
-| ---- | -------------- |
-| 默认 | `t-radio` 组件 |
-
-#### Events
-
-| 事件 | event.detail | 说明 |
-| ----------- | ------------------------- | ------------------------ |
-| bind:change | {name:当前选中项的标识符} | 当绑定值变化时触发的事件 |
diff --git a/miniprogram_npm/tdesign-miniprogram/radio-group/props.js b/miniprogram_npm/tdesign-miniprogram/radio-group/props.js
index d5a3449..3de9e57 100644
--- a/miniprogram_npm/tdesign-miniprogram/radio-group/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/radio-group/props.js
@@ -1,19 +1,19 @@
const props = {
- placement: {
- type: String,
- value: null,
+ allowUncheck: {
+ type: Boolean,
+ value: false,
},
borderless: {
type: Boolean,
value: false,
},
disabled: {
- type: Boolean,
+ type: null,
value: undefined,
},
icon: {
type: null,
- value: 'fill-circle',
+ value: 'circle',
},
keys: {
type: Object,
@@ -25,6 +25,10 @@ const props = {
options: {
type: Array,
},
+ placement: {
+ type: String,
+ value: 'left',
+ },
value: {
type: null,
value: null,
diff --git a/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.d.ts b/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.d.ts
index 25c81f2..c6141ea 100644
--- a/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.d.ts
@@ -7,7 +7,7 @@ export default class RadioGroup extends SuperComponent {
radioOptions: any[];
};
relations: RelationsOptions;
- properties: import("./type").TdRadioGroupProps;
+ properties: import("./type").TdRadioGroupProps;
controlledProps: {
key: string;
event: string;
@@ -15,9 +15,10 @@ export default class RadioGroup extends SuperComponent {
observers: {
value(v: any): void;
options(): void;
+ disabled(v: any): void;
};
methods: {
- getChilds(): any;
+ getChildren(): any;
updateValue(value: any): void;
handleRadioChange(e: any): void;
initWithOptions(): void;
diff --git a/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.js b/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.js
index a943c70..c142af4 100644
--- a/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.js
+++ b/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.js
@@ -39,7 +39,7 @@ let RadioGroup = class RadioGroup extends SuperComponent {
];
this.observers = {
value(v) {
- this.getChilds().forEach((item) => {
+ this.getChildren().forEach((item) => {
item.setData({
checked: v === item.data.value,
});
@@ -48,9 +48,19 @@ let RadioGroup = class RadioGroup extends SuperComponent {
options() {
this.initWithOptions();
},
+ disabled(v) {
+ var _a;
+ if ((_a = this.data.options) === null || _a === void 0 ? void 0 : _a.length) {
+ this.initWithOptions();
+ return;
+ }
+ this.getChildren().forEach((item) => {
+ item.setDisabled(v);
+ });
+ },
};
this.methods = {
- getChilds() {
+ getChildren() {
let items = this.$children;
if (!(items === null || items === void 0 ? void 0 : items.length)) {
items = this.selectAllComponents(`.${prefix}-radio-option`);
@@ -61,11 +71,12 @@ let RadioGroup = class RadioGroup extends SuperComponent {
this._trigger('change', { value });
},
handleRadioChange(e) {
- const { value, index } = e.target.dataset;
- this._trigger('change', { value, index });
+ const { checked } = e.detail;
+ const { value, index, allowUncheck } = e.target.dataset;
+ this._trigger('change', checked === false && allowUncheck ? { value: null, index } : { value, index });
},
initWithOptions() {
- const { options, value, keys } = this.data;
+ const { options, value, keys, disabled } = this.data;
if (!(options === null || options === void 0 ? void 0 : options.length) || !Array.isArray(options)) {
this.setData({
radioOptions: [],
@@ -82,10 +93,11 @@ let RadioGroup = class RadioGroup extends SuperComponent {
label: `${element}`,
value: element,
checked: value === element,
+ disabled,
});
}
else if (typeName === 'object') {
- optionsValue.push(Object.assign(Object.assign({}, element), { label: element[(_a = keys === null || keys === void 0 ? void 0 : keys.label) !== null && _a !== void 0 ? _a : 'label'], value: element[(_b = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _b !== void 0 ? _b : 'value'], checked: value === element[(_c = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _c !== void 0 ? _c : 'value'] }));
+ optionsValue.push(Object.assign(Object.assign({}, element), { label: element[(_a = keys === null || keys === void 0 ? void 0 : keys.label) !== null && _a !== void 0 ? _a : 'label'], value: element[(_b = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _b !== void 0 ? _b : 'value'], checked: value === element[(_c = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _c !== void 0 ? _c : 'value'], disabled: element.disabled || disabled }));
}
});
this.setData({
diff --git a/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.json b/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.json
index 7994804..c2c7a60 100644
--- a/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.json
+++ b/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-radio": "../radio/radio"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.wxml b/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.wxml
index beff6f6..096c01a 100644
--- a/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/radio-group/radio-group.wxml
@@ -5,14 +5,23 @@
diff --git a/miniprogram_npm/tdesign-miniprogram/radio-group/type.d.ts b/miniprogram_npm/tdesign-miniprogram/radio-group/type.d.ts
index b66c4af..8995b53 100644
--- a/miniprogram_npm/tdesign-miniprogram/radio-group/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/radio-group/type.d.ts
@@ -1,25 +1,20 @@
-import { RadioValue } from '../radio/type';
import { KeysType } from '../common/common';
export interface TdRadioGroupProps {
- placement?: {
- type: StringConstructor;
- value?: 'left' | 'right';
+ allowUncheck?: {
+ type: BooleanConstructor;
+ value?: boolean;
};
borderless?: {
type: BooleanConstructor;
value?: boolean;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
icon?: {
type: null;
- value?: 'fill-circle' | 'stroke-line' | Array;
+ value?: 'circle' | 'line' | 'dot' | Array;
};
keys?: {
type: ObjectConstructor;
@@ -33,6 +28,10 @@ export interface TdRadioGroupProps {
type: ArrayConstructor;
value?: Array;
};
+ placement?: {
+ type: StringConstructor;
+ value?: 'left' | 'right';
+ };
value?: {
type: null;
value?: T;
@@ -46,5 +45,8 @@ export declare type RadioOption = string | number | RadioOptionObj;
export interface RadioOptionObj {
label?: string;
value?: string | number;
+ readonly?: boolean;
disabled?: boolean;
+ allowUncheck?: boolean;
}
+export declare type RadioValue = string | number | boolean;
diff --git a/miniprogram_npm/tdesign-miniprogram/radio/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/radio/README.en-US.md
index c3cb732..2ca4ba3 100644
--- a/miniprogram_npm/tdesign-miniprogram/radio/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/radio/README.en-US.md
@@ -1,25 +1,28 @@
:: BASE_DOC ::
## API
+
### Radio Props
name | type | default | description | required
-- | -- | -- | -- | --
-placement | String | left | options:left/right | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
allow-uncheck | Boolean | false | \- | N
block | Boolean | true | \- | N
checked | Boolean | false | \- | N
default-checked | Boolean | undefined | uncontrolled property | N
-content | String / Slot | - | \- | N
+content | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
content-disabled | Boolean | false | \- | N
disabled | Boolean | undefined | \- | N
-external-classes | Array | - | `['t-class', 't-class-icon', 't-class-label', 't-class-content', 't-class-border']` | N
-icon | String / Array | 'circle' | Typescript:`'circle' \| 'line' \| Array` | N
-label | String / Slot | - | \- | N
+icon | String / Array / Slot | 'circle' | Typescript:`'circle' \| 'line' \| 'dot' \| Array` | N
+label | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
max-content-row | Number | 5 | \- | N
max-label-row | Number | 3 | \- | N
name | String | - | \- | N
-value | String / Number / Boolean | false | Typescript:`T` | N
+placement | String | left | options: left/right | N
+readonly | Boolean | false | \- | N
+value | String / Number / Boolean | false | Typescript:`T` `type RadioValue = string \| number \| boolean`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio/type.ts) | N
### Radio Events
@@ -27,22 +30,60 @@ name | params | description
-- | -- | --
change | `(checked: boolean)` | \-
+### Radio External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-border | \-
+t-class-content | \-
+t-class-icon | \-
+t-class-label | \-
+
+
### RadioGroup Props
name | type | default | description | required
-- | -- | -- | -- | --
-placement | String | left | options:left/right | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+allow-uncheck | Boolean | false | \- | N
borderless | Boolean | false | \- | N
disabled | Boolean | undefined | \- | N
-icon | String / Array | 'circle' | Typescript:`'circle' | 'line' | Array` | N
-keys | Object | - | Typescript:`KeysType` | N
+icon | String / Array | 'circle' | Typescript:`'circle' \| 'line' \| 'dot' \| Array` | N
+keys | Object | - | Typescript:`KeysType`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
name | String | - | \- | N
-options | Array | - | Typescript:`Array` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string; value?: string \| number; disabled?: boolean }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio-group/type.ts) | N
-value | String / Number / Boolean | - | Typescript:`T` | N
-default-value | String / Number / Boolean | undefined | uncontrolled property。Typescript:`T` | N
+options | Array | - | Typescript:`Array` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string; value?: string \| number; readonly?: boolean; disabled?: boolean; allowUncheck?: boolean; }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio-group/type.ts) | N
+placement | String | left | options: left/right | N
+value | String / Number / Boolean | - | Typescript:`T` `type RadioValue = string \| number \| boolean`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio-group/type.ts) | N
+default-value | String / Number / Boolean | undefined | uncontrolled property。Typescript:`T` `type RadioValue = string \| number \| boolean`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio-group/type.ts) | N
### RadioGroup Events
name | params | description
-- | -- | --
-change | `(value: T)` | \-
+change | `(value: RadioValue)` | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-radio-bg-color | @bg-color-container | -
+--td-radio-border-color | @component-stroke | -
+--td-radio-content-checked-color | @font-gray-2 | -
+--td-radio-content-color | @font-gray-2 | -
+--td-radio-content-disabled-color | @font-gray-4 | -
+--td-radio-content-font-size | 28rpx | -
+--td-radio-content-line-height | 44rpx | -
+--td-radio-font-size | 32rpx | -
+--td-radio-icon-checked-color | @brand-color | -
+--td-radio-icon-color | @component-border | -
+--td-radio-icon-disabled-bg-color | @bg-color-component-disabled | -
+--td-radio-icon-disabled-color | @brand-color-disabled | -
+--td-radio-icon-size | 48rpx | -
+--td-radio-label-checked-color | @font-gray-1 | -
+--td-radio-label-color | @font-gray-1 | -
+--td-radio-label-disabled-color | @font-gray-4 | -
+--td-radio-label-line-height | 48rpx | -
+--td-radio-vertical-padding | 32rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/radio/README.md b/miniprogram_npm/tdesign-miniprogram/radio/README.md
index d267dfb..6407843 100644
--- a/miniprogram_npm/tdesign-miniprogram/radio/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/radio/README.md
@@ -19,6 +19,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 纵向单选框
{{ base }}
@@ -48,25 +54,28 @@ isComponent: true
{{ special }}
## API
+
### Radio Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-placement | String | left | 复选框和内容相对位置。可选项:left/right | N
-allow-uncheck | Boolean | false | 【开发中】是否允许取消选中 | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+allow-uncheck | Boolean | false | 是否允许取消选中 | N
block | Boolean | true | 是否为块级元素 | N
checked | Boolean | false | 是否选中 | N
default-checked | Boolean | undefined | 是否选中。非受控属性 | N
-content | String / Slot | - | 单选内容 | N
+content | String / Slot | - | 单选内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
content-disabled | Boolean | false | 是否禁用组件内容(content)触发选中 | N
disabled | Boolean | undefined | 是否为禁用态 | N
-external-classes | Array | - | 组件类名,分别用于设置 组件外层、单选图标、主文案、内容 等元素类名。`['t-class', 't-class-icon', 't-class-label', 't-class-content', 't-class-border']` | N
-icon | String / Array / Slot | 'circle' | 自定义选中图标和非选中图标。使用 Array 时表示:`[选中态图标,非选中态图标]`。使用 String 时,值为 circle 表示填充型图标、值为 line 表示描边型图标、值为 dot 表示圆点图标,值为 slot 时使用插槽。TS 类型:`'circle' | 'line' | 'dot' | Array` | N
-label | String / Slot | - | 主文案 | N
+icon | String / Array / Slot | 'circle' | 自定义选中图标和非选中图标。使用 Array 时表示:`[选中态图标,非选中态图标]`。使用 String 时,值为 circle 表示填充型图标、值为 line 表示描边型图标、值为 dot 表示圆点图标,值为 slot 时使用插槽。TS 类型:`'circle' \| 'line' \| 'dot' \| Array` | N
+label | String / Slot | - | 主文案。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
max-content-row | Number | 5 | 内容最大行数限制 | N
max-label-row | Number | 3 | 主文案最大行数限制 | N
name | String | - | HTML 元素原生属性 | N
-value | String / Number / Boolean | false | 单选按钮的值。TS 类型:`RadioValue` `type RadioValue = string | number | boolean`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio/type.ts) | N
+placement | String | left | 复选框和内容相对位置。可选项:left/right | N
+readonly | Boolean | false | 只读状态 | N
+value | String / Number / Boolean | false | 单选按钮的值。TS 类型:`T` `type RadioValue = string \| number \| boolean`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio/type.ts) | N
### Radio Events
@@ -74,22 +83,60 @@ value | String / Number / Boolean | false | 单选按钮的值。TS 类型:`Ra
-- | -- | --
change | `(checked: boolean)` | 值变化时触发
+### Radio External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-border | 边框样式类
+t-class-content | 内容样式类
+t-class-icon | 图标样式类
+t-class-label | 标签样式类
+
+
### RadioGroup Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-placement | String | null | 复选框和内容相对位置;仅在使用 options 时生效。可选项:left/right | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+allow-uncheck | Boolean | false | 是否允许取消选中 | N
borderless | Boolean | false | 是否开启无边框模式 | N
disabled | Boolean | undefined | 是否禁用全部子单选框 | N
-icon | String / Array | 'fill-circle' | 自定义选中图标和非选中图标。示例:[选中态图标,非选中态图标]。值为 fill-circle 表示图标为填充型图标,值为 stroke-line 表示图标为描边型图标;仅在使用 options 时生效。TS 类型:`'fill-circle' | 'stroke-line' | Array` | N
-keys | Object | - | 用来定义 value / label 在 `options` 中对应的字段别名。TS 类型:`KeysType` | N
+icon | String / Array | 'circle' | 自定义选中图标和非选中图标。示例:[选中态图标,非选中态图标]。使用 String 时,值为 circle 表示填充型图标、值为 line 表示描边型图标、值为 dot 表示圆点图标;仅在使用 options 时生效。TS 类型:`'circle' \| 'line' \| 'dot' \| Array` | N
+keys | Object | - | 用来定义 value / label 在 `options` 中对应的字段别名。TS 类型:`KeysType`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
name | String | - | HTML 元素原生属性 | N
-options | Array | - | 单选组件按钮形式。RadioOption 数据类型为 string 或 number 时,表示 label 和 value 值相同。TS 类型:`Array` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string; value?: string \| number; disabled?: boolean }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio-group/type.ts) | N
-value | String / Number / Boolean | false | 选中的值。TS 类型:`RadioValue` | N
-default-value | String / Number / Boolean | undefined | 选中的值。非受控属性。TS 类型:`RadioValue` | N
+options | Array | - | 单选组件按钮形式。RadioOption 数据类型为 string 或 number 时,表示 label 和 value 值相同。TS 类型:`Array` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string; value?: string \| number; readonly?: boolean; disabled?: boolean; allowUncheck?: boolean; }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio-group/type.ts) | N
+placement | String | left | 复选框和内容相对位置。可选项:left/right | N
+value | String / Number / Boolean | - | 选中的值。TS 类型:`T` `type RadioValue = string \| number \| boolean`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio-group/type.ts) | N
+default-value | String / Number / Boolean | undefined | 选中的值。非受控属性。TS 类型:`T` `type RadioValue = string \| number \| boolean`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio-group/type.ts) | N
### RadioGroup Events
名称 | 参数 | 描述
-- | -- | --
change | `(value: RadioValue)` | 选中值发生变化时触发
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-radio-bg-color | @bg-color-container | -
+--td-radio-border-color | @component-stroke | -
+--td-radio-content-checked-color | @font-gray-2 | -
+--td-radio-content-color | @font-gray-2 | -
+--td-radio-content-disabled-color | @font-gray-4 | -
+--td-radio-content-font-size | 28rpx | -
+--td-radio-content-line-height | 44rpx | -
+--td-radio-font-size | 32rpx | -
+--td-radio-icon-checked-color | @brand-color | -
+--td-radio-icon-color | @component-border | -
+--td-radio-icon-disabled-bg-color | @bg-color-component-disabled | -
+--td-radio-icon-disabled-color | @brand-color-disabled | -
+--td-radio-icon-size | 48rpx | -
+--td-radio-label-checked-color | @font-gray-1 | -
+--td-radio-label-color | @font-gray-1 | -
+--td-radio-label-disabled-color | @font-gray-4 | -
+--td-radio-label-line-height | 48rpx | -
+--td-radio-vertical-padding | 32rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/radio/props.js b/miniprogram_npm/tdesign-miniprogram/radio/props.js
index cae862e..545afe2 100644
--- a/miniprogram_npm/tdesign-miniprogram/radio/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/radio/props.js
@@ -1,8 +1,4 @@
const props = {
- placement: {
- type: String,
- value: 'left',
- },
allowUncheck: {
type: Boolean,
value: false,
@@ -27,12 +23,9 @@ const props = {
value: false,
},
disabled: {
- type: Boolean,
+ type: null,
value: undefined,
},
- externalClasses: {
- type: Array,
- },
icon: {
type: null,
value: 'circle',
@@ -52,6 +45,14 @@ const props = {
type: String,
value: '',
},
+ placement: {
+ type: String,
+ value: 'left',
+ },
+ readonly: {
+ type: Boolean,
+ value: false,
+ },
value: {
type: null,
value: false,
diff --git a/miniprogram_npm/tdesign-miniprogram/radio/radio.d.ts b/miniprogram_npm/tdesign-miniprogram/radio/radio.d.ts
index 7d00745..2539f15 100644
--- a/miniprogram_npm/tdesign-miniprogram/radio/radio.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/radio/radio.d.ts
@@ -2,7 +2,6 @@ import { SuperComponent, RelationsOptions } from '../common/src/index';
export default class Radio extends SuperComponent {
externalClasses: string[];
behaviors: string[];
- parent: any;
relations: RelationsOptions;
options: {
multipleSlots: boolean;
@@ -15,10 +14,6 @@ export default class Radio extends SuperComponent {
type: BooleanConstructor;
value: boolean;
};
- placement?: {
- type: StringConstructor;
- value?: "left" | "right";
- };
allowUncheck?: {
type: BooleanConstructor;
value?: boolean;
@@ -43,21 +38,13 @@ export default class Radio extends SuperComponent {
type: BooleanConstructor;
value?: boolean;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ["t-class", "t-class-icon", "t-class-label", "t-class-content", "t-class-border"];
- };
icon?: {
type: null;
- value?: string[] | "circle" | "line";
+ value?: string[] | "circle" | "line" | "dot";
};
label?: {
type: StringConstructor;
@@ -75,6 +62,14 @@ export default class Radio extends SuperComponent {
type: StringConstructor;
value?: string;
};
+ placement?: {
+ type: StringConstructor;
+ value?: "left" | "right";
+ };
+ readonly?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
value?: {
type: null;
value?: import("./type").RadioValue;
@@ -91,11 +86,16 @@ export default class Radio extends SuperComponent {
slotIcon: boolean;
optionLinked: boolean;
iconVal: any[];
+ _placement: string;
+ _disabled: boolean;
+ };
+ observers: {
+ disabled(v: any): void;
};
methods: {
handleTap(e: any): void;
doChange(): void;
- initStatus(): void;
+ init(): void;
setDisabled(disabled: Boolean): void;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/radio/radio.js b/miniprogram_npm/tdesign-miniprogram/radio/radio.js
index de844a7..bdc4f60 100644
--- a/miniprogram_npm/tdesign-miniprogram/radio/radio.js
+++ b/miniprogram_npm/tdesign-miniprogram/radio/radio.js
@@ -20,15 +20,10 @@ let Radio = class Radio extends SuperComponent {
`${prefix}-class-border`,
];
this.behaviors = ['wx://form-field'];
- this.parent = null;
this.relations = {
'../radio-group/radio-group': {
type: 'ancestor',
linked(parent) {
- this.parent = parent;
- if (parent.data.placement) {
- this.setData({ placement: parent.data.placement });
- }
if (parent.data.borderless) {
this.setData({ borderless: true });
}
@@ -40,7 +35,7 @@ let Radio = class Radio extends SuperComponent {
};
this.lifetimes = {
attached() {
- this.initStatus();
+ this.init();
},
};
this.properties = Object.assign(Object.assign({}, Props), { borderless: {
@@ -60,38 +55,47 @@ let Radio = class Radio extends SuperComponent {
slotIcon: false,
optionLinked: false,
iconVal: [],
+ _placement: '',
+ _disabled: false,
+ };
+ this.observers = {
+ disabled(v) {
+ this.setData({ _disabled: v });
+ },
};
this.methods = {
handleTap(e) {
- if (this.data.disabled)
- return;
+ const { _disabled, readonly, contentDisabled } = this.data;
const { target } = e.currentTarget.dataset;
- if (target === 'text' && this.data.contentDisabled)
+ if (_disabled || readonly || (target === 'text' && contentDisabled))
return;
this.doChange();
},
doChange() {
- const { value, checked } = this.data;
+ var _a;
+ const { value, checked, allowUncheck } = this.data;
+ const isAllowUncheck = Boolean(allowUncheck || ((_a = this.$parent) === null || _a === void 0 ? void 0 : _a.data.allowUncheck));
if (this.$parent) {
- this.$parent.updateValue(value);
+ this.$parent.updateValue(checked && isAllowUncheck ? null : value);
}
else {
- this._trigger('change', { checked: !checked });
+ this._trigger('change', { checked: isAllowUncheck ? !checked : true });
}
},
- initStatus() {
- var _a, _b;
+ init() {
+ var _a, _b, _c, _d, _e, _f;
const { icon } = this.data;
- const isIdArr = Array.isArray(((_a = this.parent) === null || _a === void 0 ? void 0 : _a.icon) || icon);
+ const isIdArr = Array.isArray(((_a = this.$parent) === null || _a === void 0 ? void 0 : _a.icon) || icon);
this.setData({
customIcon: isIdArr,
slotIcon: icon === 'slot',
- iconVal: isIdArr ? ((_b = this.parent) === null || _b === void 0 ? void 0 : _b.icon) || icon : [],
+ iconVal: isIdArr ? ((_b = this.$parent) === null || _b === void 0 ? void 0 : _b.icon) || icon : [],
+ _placement: (_f = (_c = this.data.placement) !== null && _c !== void 0 ? _c : (_e = (_d = this.$parent) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.placement) !== null && _f !== void 0 ? _f : 'left',
});
},
setDisabled(disabled) {
this.setData({
- disabled: this.data.disabled || disabled,
+ _disabled: this.data.disabled || disabled,
});
},
};
diff --git a/miniprogram_npm/tdesign-miniprogram/radio/radio.json b/miniprogram_npm/tdesign-miniprogram/radio/radio.json
index dfd59ed..f783dae 100644
--- a/miniprogram_npm/tdesign-miniprogram/radio/radio.json
+++ b/miniprogram_npm/tdesign-miniprogram/radio/radio.json
@@ -1,7 +1,7 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
- "t-cell": "../cell/cell",
"t-icon": "../icon/icon"
}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/radio/radio.wxml b/miniprogram_npm/tdesign-miniprogram/radio/radio.wxml
index d1d1f9c..6d748ad 100644
--- a/miniprogram_npm/tdesign-miniprogram/radio/radio.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/radio/radio.wxml
@@ -2,17 +2,17 @@
@@ -26,35 +26,35 @@
/>
+ class="{{_.cls(classPrefix + '__icon-circle', [['disabled', _disabled]])}}"
+ />
-
+
- {{label}}
+ {{label}}
- {{content}}
+ {{content}}
-
+
diff --git a/miniprogram_npm/tdesign-miniprogram/radio/radio.wxss b/miniprogram_npm/tdesign-miniprogram/radio/radio.wxss
index 33eec37..f8af3d8 100644
--- a/miniprogram_npm/tdesign-miniprogram/radio/radio.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/radio/radio.wxss
@@ -31,11 +31,11 @@
overflow: hidden;
}
.t-radio {
+ position: relative;
display: inline-flex;
vertical-align: middle;
font-size: var(--td-radio-font-size, 32rpx);
background: var(--td-radio-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
- position: relative;
}
.t-radio:focus {
outline: 0;
@@ -49,6 +49,7 @@
}
.t-radio__icon {
position: relative;
+ margin-top: calc((var(--td-radio-label-line-height, 48rpx) - var(--td-radio-icon-size, 48rpx)) / 2);
width: var(--td-radio-icon-size, 48rpx);
height: var(--td-radio-icon-size, 48rpx);
font-size: var(--td-radio-icon-size, 48rpx);
@@ -69,21 +70,27 @@
color: var(--td-radio-icon-disabled-color, var(--td-brand-color-disabled, var(--td-primary-color-3, #b5c7ff)));
}
.t-radio__icon-circle {
- width: 84rpx;
- height: 84rpx;
- border: 3px solid var(--td-radio-icon-color, var(--td-component-border, var(--td-gray-color-4, #dcdcdc)));
+ width: var(--td-radio-icon-size, 48rpx);
+ height: var(--td-radio-icon-size, 48rpx);
+ box-sizing: border-box;
+}
+.t-radio__icon-circle::after {
+ content: '';
+ width: calc(200% - 6rpx);
+ height: calc(200% - 6rpx);
border-radius: 50%;
+ border: 3px solid var(--td-radio-icon-color, var(--td-component-border, var(--td-gray-color-4, #dcdcdc)));
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(0.5);
box-sizing: border-box;
}
-.t-radio__icon-circle--disabled {
+.t-radio__icon-circle--disabled::after {
background: var(--td-radio-icon-disabled-bg-color, var(--td-bg-color-component-disabled, var(--td-gray-color-2, #eeeeee)));
}
-.t-radio__icon-line:before,
-.t-radio__icon-line:after {
+.t-radio__icon-line::before,
+.t-radio__icon-line::after {
content: '';
display: block;
position: absolute;
@@ -92,7 +99,7 @@
background: var(--td-radio-icon-checked-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
transform-origin: top center;
}
-.t-radio__icon-line:before {
+.t-radio__icon-line::before {
height: 16rpx;
left: 8rpx;
top: 22rpx;
@@ -109,9 +116,9 @@
background: var(--td-radio-icon-disabled-color, var(--td-brand-color-disabled, var(--td-primary-color-3, #b5c7ff)));
}
.t-radio__icon-dot {
- width: 84rpx;
- height: 84rpx;
- border: 3px solid var(--td-radio-icon-checked-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
+ width: calc((var(--td-radio-icon-size, 48rpx) - 6rpx) * 2);
+ height: calc((var(--td-radio-icon-size, 48rpx) - 6rpx) * 2);
+ border: 6rpx solid var(--td-radio-icon-checked-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
border-radius: 50%;
position: absolute;
top: 50%;
@@ -122,11 +129,11 @@
align-items: center;
justify-content: center;
}
-.t-radio__icon-dot:after {
+.t-radio__icon-dot::after {
content: '';
display: block;
- width: 48rpx;
- height: 48rpx;
+ width: var(--td-radio-icon-size, 48rpx);
+ height: var(--td-radio-icon-size, 48rpx);
background: var(--td-radio-icon-checked-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
border-radius: 50%;
}
@@ -154,24 +161,30 @@
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
- color: var(--td-radio-label-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-radio-label-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
line-height: var(--td-radio-label-line-height, 48rpx);
}
+.t-radio__title--checked {
+ color: var(--td-radio-label-checked-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
+}
.t-radio__title--disabled {
cursor: not-allowed;
- color: var(--td-radio-label-disabled-color, var(--td-font-gray-4, rgba(0, 0, 0, 0.26)));
+ color: var(--td-radio-label-disabled-color, var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26))));
}
.t-radio__description {
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
- color: var(--td-radio-content-color, var(--td-font-gray-2, rgba(0, 0, 0, 0.6)));
- font-size: 28rpx;
+ color: var(--td-radio-content-color, var(--td-text-color-secondary, var(--td-font-gray-2, rgba(0, 0, 0, 0.6))));
+ font-size: var(--td-radio-content-font-size, 28rpx);
line-height: var(--td-radio-content-line-height, 44rpx);
}
+.t-radio__description--checked {
+ color: var(--td-radio-content-checked-color, var(--td-text-color-secondary, var(--td-font-gray-2, rgba(0, 0, 0, 0.6))));
+}
.t-radio__description--disabled {
cursor: not-allowed;
- color: var(--td-radio-content-disabled-color, var(--td-font-gray-4, rgba(0, 0, 0, 0.26)));
+ color: var(--td-radio-content-disabled-color, var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26))));
}
.t-radio__description:empty {
display: none;
diff --git a/miniprogram_npm/tdesign-miniprogram/radio/type.d.ts b/miniprogram_npm/tdesign-miniprogram/radio/type.d.ts
index 9a202ac..c39da7f 100644
--- a/miniprogram_npm/tdesign-miniprogram/radio/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/radio/type.d.ts
@@ -1,8 +1,4 @@
export interface TdRadioProps {
- placement?: {
- type: StringConstructor;
- value?: 'left' | 'right';
- };
allowUncheck?: {
type: BooleanConstructor;
value?: boolean;
@@ -27,21 +23,13 @@ export interface TdRadioProps {
type: BooleanConstructor;
value?: boolean;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-icon', 't-class-label', 't-class-content', 't-class-border'];
- };
icon?: {
type: null;
- value?: 'circle' | 'line' | Array;
+ value?: 'circle' | 'line' | 'dot' | Array;
};
label?: {
type: StringConstructor;
@@ -59,6 +47,14 @@ export interface TdRadioProps {
type: StringConstructor;
value?: string;
};
+ placement?: {
+ type: StringConstructor;
+ value?: 'left' | 'right';
+ };
+ readonly?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
value?: {
type: null;
value?: T;
diff --git a/miniprogram_npm/tdesign-miniprogram/rate/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/rate/README.en-US.md
index 0753221..1d6b692 100644
--- a/miniprogram_npm/tdesign-miniprogram/rate/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/rate/README.en-US.md
@@ -1,26 +1,50 @@
:: BASE_DOC ::
## API
+
### Rate Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
allow-half | Boolean | false | \- | N
color | String / Array | '#ED7B2F' | `0.30.0`。Typescript:`string \| Array` | N
count | Number | 5 | \- | N
-disabled | Boolean | - | \- | N
-external-classes | Array | - | `['t-class', 't-class-icon', 't-class-text']` | N
+disabled | Boolean | undefined | \- | N
gap | String / Number | 8 | \- | N
-icon | String / Array | - | Typescript:`string \| string[]` | N
+icon | String / Array | - | `0.30.0`。Typescript:`string \| string[]` | N
+icon-prefix | String | undefined | \- | N
+placement | String | top | options: top / bottom / '' | N
show-text | Boolean | false | \- | N
size | String | 24px | \- | N
texts | Array | [] | Typescript:`Array` | N
value | Number | 0 | \- | N
default-value | Number | undefined | uncontrolled property | N
-variant | String | outline | options:outline/filled | N
+variant | String | outline | options: outline/filled | N
### Rate Events
name | params | description
-- | -- | --
change | `(value: number)` | \-
+### Rate External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-icon | \-
+t-class-text | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-rate-icon-scale | 1.33 | -
+--td-rate-selected-color | @warning-color | -
+--td-rate-text-active-color | @font-gray-1 | -
+--td-rate-text-active-font-weight | 600 | -
+--td-rate-text-color | @font-gray-4 | -
+--td-rate-text-font-size | @font-size-m | -
+--td-rate-unselected-color | @bg-color-secondarycomponent | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/rate/README.md b/miniprogram_npm/tdesign-miniprogram/rate/README.md
index de4e72d..181f687 100644
--- a/miniprogram_npm/tdesign-miniprogram/rate/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/rate/README.md
@@ -20,6 +20,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
实心评分
@@ -58,28 +64,56 @@ isComponent: true
{{ special }}
+自定义图片前缀
+
+{{iconPrefix}}
+
## API
+
### Rate Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
allow-half | Boolean | false | 是否允许半选 | N
color | String / Array | '#ED7B2F' | `0.30.0`。评分图标的颜色,样式中默认为 #ED7B2F。一个值表示设置选中高亮的五角星颜色,示例:[选中颜色]。数组则表示分别设置 选中高亮的五角星颜色 和 未选中暗灰的五角星颜色,[选中颜色,未选中颜色]。示例:['#ED7B2F', '#E3E6EB']。TS 类型:`string \| Array` | N
count | Number | 5 | 评分的数量 | N
-disabled | Boolean | - | 是否禁用评分 | N
-external-classes | Array | - | 组件类名,分别用于设置 组件外层类名、评分图标类名、辅助文字类名。`['t-class', 't-class-icon', 't-class-text']` | N
-gap | Number | 8 | 评分图标的间距 | N
+disabled | Boolean | undefined | 是否禁用评分 | N
+gap | String / Number | 8 | 评分图标的间距 | N
icon | String / Array | - | `0.30.0`。自定义评分图标,[选中图标,未选中图标]。TS 类型:`string \| string[]` | N
+icon-prefix | String | undefined | 定义图标前缀 | N
+placement | String | top | 选择评分弹框的位置,值为空字符表示不显示评分弹框。可选项:top / bottom / '' | N
show-text | Boolean | false | 是否显示对应的辅助文字 | N
size | String | 24px | 评分图标的大小 | N
texts | Array | [] | 评分等级对应的辅助文字。组件内置默认值为:['极差', '失望', '一般', '满意', '惊喜']。自定义值示例:['1分', '2分', '3分', '4分', '5分']。TS 类型:`Array` | N
value | Number | 0 | 选择评分的值 | N
default-value | Number | undefined | 选择评分的值。非受控属性 | N
-variant | String | outline | 废弃。形状类型,有描边类型和填充类型两种。可选项:outline/filled | N
+variant | String | outline | 已废弃。形状类型,有描边类型和填充类型两种。可选项:outline/filled | N
### Rate Events
名称 | 参数 | 描述
-- | -- | --
change | `(value: number)` | 评分数改变时触发
+### Rate External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-icon | 图标样式类
+t-class-text | 文本样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-rate-icon-scale | 1.33 | -
+--td-rate-selected-color | @warning-color | -
+--td-rate-text-active-color | @font-gray-1 | -
+--td-rate-text-active-font-weight | 600 | -
+--td-rate-text-color | @font-gray-4 | -
+--td-rate-text-font-size | @font-size-m | -
+--td-rate-unselected-color | @bg-color-secondarycomponent | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/rate/props.js b/miniprogram_npm/tdesign-miniprogram/rate/props.js
index f5daf59..fb99e43 100644
--- a/miniprogram_npm/tdesign-miniprogram/rate/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/rate/props.js
@@ -12,10 +12,8 @@ const props = {
value: 5,
},
disabled: {
- type: Boolean,
- },
- externalClasses: {
- type: Array,
+ type: null,
+ value: undefined,
},
gap: {
type: null,
@@ -24,6 +22,14 @@ const props = {
icon: {
type: null,
},
+ iconPrefix: {
+ type: String,
+ value: undefined,
+ },
+ placement: {
+ type: String,
+ value: 'top',
+ },
showText: {
type: Boolean,
value: false,
@@ -44,5 +50,9 @@ const props = {
type: Number,
value: 0,
},
+ variant: {
+ type: String,
+ value: 'outline',
+ },
};
export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/rate/rate.d.ts b/miniprogram_npm/tdesign-miniprogram/rate/rate.d.ts
index 3aad047..e6070ab 100644
--- a/miniprogram_npm/tdesign-miniprogram/rate/rate.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/rate/rate.d.ts
@@ -14,6 +14,7 @@ export default class Rate extends SuperComponent {
tipsLeft: number;
actionType: string;
scaleIndex: number;
+ isVisibleToScreenReader: boolean;
};
methods: {
onTouch(e: WechatMiniprogram.TouchEvent, eventType: 'tap' | 'move'): void;
@@ -23,5 +24,6 @@ export default class Rate extends SuperComponent {
onTouchEnd(): void;
hideTips(): void;
onSelect(e: WechatMiniprogram.TouchEvent): void;
+ showAlertText(): void;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/rate/rate.js b/miniprogram_npm/tdesign-miniprogram/rate/rate.js
index a6774a5..fc7bf57 100644
--- a/miniprogram_npm/tdesign-miniprogram/rate/rate.js
+++ b/miniprogram_npm/tdesign-miniprogram/rate/rate.js
@@ -29,11 +29,12 @@ let Rate = class Rate extends SuperComponent {
tipsLeft: 0,
actionType: '',
scaleIndex: -1,
+ isVisibleToScreenReader: false,
};
this.methods = {
onTouch(e, eventType) {
const { count, allowHalf, gap, value: currentValue, size } = this.properties;
- const [touch] = e.touches;
+ const [touch] = e.changedTouches;
const margin = unitConvert(gap);
getRect(this, `.${name}__wrapper`).then((rect) => {
const { width, left } = rect;
@@ -74,6 +75,7 @@ let Rate = class Rate extends SuperComponent {
},
onTouchMove(e) {
this.onTouch(e, 'move');
+ this.showAlertText();
},
onTouchEnd() {
this.touchEnd = true;
@@ -92,6 +94,18 @@ let Rate = class Rate extends SuperComponent {
this._trigger('change', { value });
setTimeout(() => this.setData({ tipsVisible: false, scaleIndex: -1 }), 300);
},
+ showAlertText() {
+ if (this.data.isVisibleToScreenReader === true)
+ return;
+ this.setData({
+ isVisibleToScreenReader: true,
+ });
+ setTimeout(() => {
+ this.setData({
+ isVisibleToScreenReader: false,
+ });
+ }, 2e3);
+ },
};
}
};
diff --git a/miniprogram_npm/tdesign-miniprogram/rate/rate.json b/miniprogram_npm/tdesign-miniprogram/rate/rate.json
index 049940c..f783dae 100644
--- a/miniprogram_npm/tdesign-miniprogram/rate/rate.json
+++ b/miniprogram_npm/tdesign-miniprogram/rate/rate.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/rate/rate.wxml b/miniprogram_npm/tdesign-miniprogram/rate/rate.wxml
index 4d8cefa..19b24ed 100644
--- a/miniprogram_npm/tdesign-miniprogram/rate/rate.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/rate/rate.wxml
@@ -5,26 +5,47 @@
- {{utils.getText(texts,value,defaultTexts)}}
-
+ {{value+'星'}} {{utils.getText(texts,value,defaultTexts)}}
+
{{value}}
diff --git a/miniprogram_npm/tdesign-miniprogram/rate/rate.wxs b/miniprogram_npm/tdesign-miniprogram/rate/rate.wxs
index d799da4..8387b10 100644
--- a/miniprogram_npm/tdesign-miniprogram/rate/rate.wxs
+++ b/miniprogram_npm/tdesign-miniprogram/rate/rate.wxs
@@ -8,7 +8,7 @@ module.exports = {
},
getIconName: function (defaultValue, value, index, icon) {
- var curVal = value ? value : defaultValue;
+ var curVal = value >= 0 ? value : defaultValue;
var name = ['star-filled', 'star-filled'];
if (icon) {
@@ -19,7 +19,7 @@ module.exports = {
},
getIconClass: function (classPrefix, defaultValue, value, index, allowHalf, disabled, scaleIndex) {
- var curVal = value ? value : defaultValue;
+ var curVal = value >= 0 ? value : defaultValue;
var className = [];
if (curVal >= index + 1) {
className.push(classPrefix + '--selected');
diff --git a/miniprogram_npm/tdesign-miniprogram/rate/rate.wxss b/miniprogram_npm/tdesign-miniprogram/rate/rate.wxss
index 99274b2..44db501 100644
--- a/miniprogram_npm/tdesign-miniprogram/rate/rate.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/rate/rate.wxss
@@ -49,23 +49,34 @@
}
.t-rate__icon--selected-half {
color: transparent;
- background: linear-gradient(to right, var(--td-rate-selected-color, var(--td-warning-color, var(--td-warning-color-5, #e37318))) 0%, var(--td-rate-selected-color, var(--td-warning-color, var(--td-warning-color-5, #e37318))) 50%, var(--td-rate-unselected-color, var(--td-bg-color-secondarycomponent, var(--td-gray-color-4, #dcdcdc))) 51%, var(--td-rate-unselected-color, var(--td-bg-color-secondarycomponent, var(--td-gray-color-4, #dcdcdc))) 100%);
+ background: linear-gradient(to right, var(--td-rate-selected-color, var(--td-warning-color, var(--td-warning-color-5, #e37318))) 0%, var(--td-rate-selected-color, var(--td-warning-color, var(--td-warning-color-5, #e37318))) 50%, var(--td-rate-unselected-color, var(--td-component-border, var(--td-gray-color-4, #dcdcdc))) 51%, var(--td-rate-unselected-color, var(--td-component-border, var(--td-gray-color-4, #dcdcdc))) 100%);
-webkit-background-clip: text;
background-clip: text;
}
.t-rate__icon--unselected {
- color: var(--td-rate-unselected-color, var(--td-bg-color-secondarycomponent, var(--td-gray-color-4, #dcdcdc)));
+ color: var(--td-rate-unselected-color, var(--td-component-border, var(--td-gray-color-4, #dcdcdc)));
}
.t-rate__text {
font-size: var(--td-rate-text-font-size, var(--td-font-size-m, 32rpx));
- color: var(--td-rate-text-color, var(--td-font-gray-4, rgba(0, 0, 0, 0.26)));
+ color: var(--td-rate-text-color, var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26))));
margin-left: 32rpx;
vertical-align: middle;
}
.t-rate__text--active {
- color: var(--td-rate-text-active-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-rate-text-active-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
font-weight: var(--td-rate-text-active-font-weight, 600);
}
+.t-rate__text--sr-only {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ padding: 0;
+ overflow: hidden;
+ clip: rect(0, 0, 0, 0);
+ white-space: nowrap;
+ clip-path: inset(50%);
+ border: 0;
+}
.t-rate__tips {
position: absolute;
display: flex;
@@ -77,6 +88,10 @@
background-color: var(--td-bg-color-container, var(--td-font-white-1, #ffffff));
transform: translateX(-50%);
}
+.t-rate__tips--bottom {
+ top: calc(100% + 16rpx);
+ bottom: auto;
+}
.t-rate__tips-item {
display: flex;
flex-direction: column;
@@ -85,7 +100,7 @@
border-radius: 6rpx;
}
.t-rate__tips-item--active {
- background-color: var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3));
+ background-color: var(--td-bg-color-component, var(--td-gray-color-3, #e7e7e7));
}
.t-rate__tips-text {
text-align: center;
diff --git a/miniprogram_npm/tdesign-miniprogram/rate/type.d.ts b/miniprogram_npm/tdesign-miniprogram/rate/type.d.ts
index 8965510..0518e2e 100644
--- a/miniprogram_npm/tdesign-miniprogram/rate/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/rate/type.d.ts
@@ -11,18 +11,10 @@ export interface TdRateProps {
type: NumberConstructor;
value?: number;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-icon', 't-class-text'];
- };
gap?: {
type: null;
value?: string | number;
@@ -31,6 +23,14 @@ export interface TdRateProps {
type: null;
value?: string | string[];
};
+ iconPrefix?: {
+ type: StringConstructor;
+ value?: string;
+ };
+ placement?: {
+ type: StringConstructor;
+ value?: 'top' | 'bottom' | '';
+ };
showText?: {
type: BooleanConstructor;
value?: boolean;
@@ -51,4 +51,8 @@ export interface TdRateProps {
type: NumberConstructor;
value?: number;
};
+ variant?: {
+ type: StringConstructor;
+ value?: 'outline' | 'filled';
+ };
}
diff --git a/miniprogram_npm/tdesign-miniprogram/result/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/result/README.en-US.md
index 813f4d1..b5c763d 100644
--- a/miniprogram_npm/tdesign-miniprogram/result/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/result/README.en-US.md
@@ -6,9 +6,36 @@
name | type | default | description | required
-- | -- | -- | -- | --
-description | String / Slot | - | \- | N
-external-classes | Array | - | \- | N
-icon | String | - | \- | N
-image | String / Slot | - | \- | N
-theme | String | default | \- | N
-title | String / Slot | '' | \- | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+description | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+icon | String / Boolean / Object | true | \- | N
+image | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+theme | String | default | options: default/success/warning/error | N
+title | String / Slot | '' | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+### Result External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-description | \-
+t-class-image | \-
+t-class-title | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-result-description-color | @font-gray-2 | -
+--td-result-description-font-size | @font-size-base | -
+--td-result-description-line-height | 44rpx | -
+--td-result-description-margin-top | @spacer | -
+--td-result-icon-default-color | @brand-color | -
+--td-result-icon-error-color | @error-color | -
+--td-result-icon-success-color | @success-color | -
+--td-result-icon-warning-color | @warning-color | -
+--td-result-title-color | @font-gray-1 | -
+--td-result-title-font-size | @font-size-l | -
+--td-result-title-line-height | 56rpx | -
+--td-result-title-margin-top | @spacer-1 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/result/README.md b/miniprogram_npm/tdesign-miniprogram/result/README.md
index e590f1b..76085fe 100644
--- a/miniprogram_npm/tdesign-miniprogram/result/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/result/README.md
@@ -26,6 +26,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
基础结果
@@ -53,13 +59,41 @@ isComponent: true
## API
+
### Result Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-description | String / Slot | - | 描述文字 | N
-external-classes | Array | - | 组件类名,分别用于设置 组件外层类名、文本描述类名、图片类名、操作按钮类名。`['t-class', 't-class-image', 't-class-title', 't-class-description']` | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+description | String / Slot | - | 描述文字。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
icon | String / Boolean / Object | true | 图标名称。值为字符串表示图标名称,值为 `false` 表示不显示图标,值为 `Object` 类型,表示透传至 `icon`,不传表示使用主题图标。 | N
-image | String / Slot | - | 图片地址 | N
+image | String / Slot | - | 图片地址。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
theme | String | default | 内置主题。可选项:default/success/warning/error | N
-title | String / Slot | '' | 标题 | N
+title | String / Slot | '' | 标题。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+### Result External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-description | 描述样式类
+t-class-image | 图片样式类
+t-class-title | 标题样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-result-description-color | @font-gray-2 | -
+--td-result-description-font-size | @font-size-base | -
+--td-result-description-line-height | 44rpx | -
+--td-result-description-margin-top | @spacer | -
+--td-result-icon-default-color | @brand-color | -
+--td-result-icon-error-color | @error-color | -
+--td-result-icon-success-color | @success-color | -
+--td-result-icon-warning-color | @warning-color | -
+--td-result-title-color | @font-gray-1 | -
+--td-result-title-font-size | @font-size-l | -
+--td-result-title-line-height | 56rpx | -
+--td-result-title-margin-top | @spacer-1 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/result/props.js b/miniprogram_npm/tdesign-miniprogram/result/props.js
index 613f4af..2ede7ba 100644
--- a/miniprogram_npm/tdesign-miniprogram/result/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/result/props.js
@@ -2,9 +2,6 @@ const props = {
description: {
type: String,
},
- externalClasses: {
- type: Array,
- },
icon: {
type: null,
value: true,
diff --git a/miniprogram_npm/tdesign-miniprogram/result/result.json b/miniprogram_npm/tdesign-miniprogram/result/result.json
index 9a40e60..b7d275d 100644
--- a/miniprogram_npm/tdesign-miniprogram/result/result.json
+++ b/miniprogram_npm/tdesign-miniprogram/result/result.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon",
"t-image": "../image/image"
diff --git a/miniprogram_npm/tdesign-miniprogram/result/result.wxss b/miniprogram_npm/tdesign-miniprogram/result/result.wxss
index 746332d..aa282af 100644
--- a/miniprogram_npm/tdesign-miniprogram/result/result.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/result/result.wxss
@@ -35,16 +35,16 @@
}
.t-result__title {
line-height: var(--td-result-title-line-height, 56rpx);
- font-size: var(--td-result-title-font-size, var(--td-font-size-l, 40rpx));
+ font-size: var(--td-result-title-font-size, var(--td-font-size-xl, 40rpx));
font-weight: 700;
- color: var(--td-result-title-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-result-title-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-result__thumb:not(:empty) + .t-result__title:not(:empty) {
margin-top: var(--td-result-title-margin-top, var(--td-spacer-1, 24rpx));
}
.t-result__description {
text-align: center;
- color: var(--td-result-description-color, var(--td-font-gray-2, rgba(0, 0, 0, 0.6)));
+ color: var(--td-result-description-color, var(--td-text-color-secondary, var(--td-font-gray-2, rgba(0, 0, 0, 0.6))));
font-size: var(--td-result-description-font-size, var(--td-font-size-base, 28rpx));
line-height: var(--td-result-description-line-height, 44rpx);
}
diff --git a/miniprogram_npm/tdesign-miniprogram/result/type.d.ts b/miniprogram_npm/tdesign-miniprogram/result/type.d.ts
index bcd1e81..80b4136 100644
--- a/miniprogram_npm/tdesign-miniprogram/result/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/result/type.d.ts
@@ -1,19 +1,11 @@
export interface TdResultProps {
- style?: {
- type: StringConstructor;
- value?: string;
- };
description?: {
type: StringConstructor;
value?: string;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-description', 't-class-image'];
- };
icon?: {
type: null;
- value?: boolean | string | object;
+ value?: string | boolean | object;
};
image?: {
type: StringConstructor;
diff --git a/pages/action-sheet/status/index.wxss b/miniprogram_npm/tdesign-miniprogram/row/README.md
similarity index 100%
rename from pages/action-sheet/status/index.wxss
rename to miniprogram_npm/tdesign-miniprogram/row/README.md
diff --git a/miniprogram_npm/tdesign-miniprogram/row/props.d.ts b/miniprogram_npm/tdesign-miniprogram/row/props.d.ts
new file mode 100644
index 0000000..34bd697
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/row/props.d.ts
@@ -0,0 +1,3 @@
+import { TdRowProps } from './type';
+declare const props: TdRowProps;
+export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/row/props.js b/miniprogram_npm/tdesign-miniprogram/row/props.js
new file mode 100644
index 0000000..2faa498
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/row/props.js
@@ -0,0 +1,6 @@
+const props = {
+ gutter: {
+ type: null,
+ },
+};
+export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/row/row.d.ts b/miniprogram_npm/tdesign-miniprogram/row/row.d.ts
new file mode 100644
index 0000000..136e65c
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/row/row.d.ts
@@ -0,0 +1,15 @@
+import { SuperComponent, RelationsOptions } from '../common/src/index';
+export default class Row extends SuperComponent {
+ externalClasses: any[];
+ properties: import("./type").TdRowProps;
+ data: {
+ prefix: string;
+ };
+ relations: RelationsOptions;
+ observers: {
+ gutter(): void;
+ };
+ methods: {
+ setGutter(): void;
+ };
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/row/row.js b/miniprogram_npm/tdesign-miniprogram/row/row.js
new file mode 100644
index 0000000..a82c5c8
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/row/row.js
@@ -0,0 +1,49 @@
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+import { SuperComponent, wxComponent } from '../common/src/index';
+import config from '../common/config';
+import props from './props';
+const { prefix } = config;
+let Row = class Row extends SuperComponent {
+ constructor() {
+ super(...arguments);
+ this.externalClasses = [];
+ this.properties = props;
+ this.data = {
+ prefix,
+ };
+ this.relations = {
+ '../col/col': {
+ type: 'child',
+ linked(target) {
+ const { gutter } = this.data;
+ if (gutter) {
+ target.setData({ gutter });
+ }
+ },
+ },
+ };
+ this.observers = {
+ gutter() {
+ this.setGutter();
+ },
+ };
+ this.methods = {
+ setGutter() {
+ const { gutter } = this.data;
+ const cols = this.$children;
+ cols.forEach((col) => {
+ col.setData({ gutter });
+ });
+ },
+ };
+ }
+};
+Row = __decorate([
+ wxComponent()
+], Row);
+export default Row;
diff --git a/miniprogram_npm/tdesign-miniprogram/row/row.json b/miniprogram_npm/tdesign-miniprogram/row/row.json
new file mode 100644
index 0000000..4f0a3f0
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/row/row.json
@@ -0,0 +1,5 @@
+{
+ "component": true,
+ "styleIsolation": "apply-shared",
+ "usingComponents": {}
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/row/row.wxml b/miniprogram_npm/tdesign-miniprogram/row/row.wxml
new file mode 100644
index 0000000..6f82c33
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/row/row.wxml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/miniprogram_npm/tdesign-miniprogram/row/row.wxs b/miniprogram_npm/tdesign-miniprogram/row/row.wxs
new file mode 100644
index 0000000..9d83b9d
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/row/row.wxs
@@ -0,0 +1,17 @@
+var utils = require('../common/utils.wxs');
+
+function getRowStyles(gutter, style, customStyle) {
+ var _style = '';
+ if (gutter) {
+ _style = utils._style({
+ 'margin-right': utils.addUnit(-gutter / 2),
+ 'margin-left': utils.addUnit(-gutter / 2),
+ });
+ }
+
+ return utils._style([style, customStyle]) + _style;
+}
+
+module.exports = {
+ getRowStyles: getRowStyles,
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/row/row.wxss b/miniprogram_npm/tdesign-miniprogram/row/row.wxss
new file mode 100644
index 0000000..69fab88
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/row/row.wxss
@@ -0,0 +1,6 @@
+.t-row {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ box-sizing: border-box;
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/row/type.d.ts b/miniprogram_npm/tdesign-miniprogram/row/type.d.ts
new file mode 100644
index 0000000..f151c1c
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/row/type.d.ts
@@ -0,0 +1,6 @@
+export interface TdRowProps {
+ gutter?: {
+ type: null;
+ value?: string | number;
+ };
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/row/type.js b/miniprogram_npm/tdesign-miniprogram/row/type.js
new file mode 100644
index 0000000..cb0ff5c
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/row/type.js
@@ -0,0 +1 @@
+export {};
diff --git a/miniprogram_npm/tdesign-miniprogram/search/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/search/README.en-US.md
new file mode 100644
index 0000000..43926df
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/search/README.en-US.md
@@ -0,0 +1,76 @@
+
+## API
+
+### Search Props
+
+name | type | default | description | required
+-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+action | String / Slot | '' | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+adjust-position | Boolean | true | \- | N
+always-embed | Boolean | false | \- | N
+center | Boolean | false | \- | N
+clearable | Boolean | true | \- | N
+confirm-hold | Boolean | false | \- | N
+confirm-type | String | search | options: send/search/next/go/done | N
+cursor | Number | - | required | Y
+cursor-spacing | Number | 0 | \- | N
+disabled | Boolean | false | \- | N
+focus | Boolean | false | \- | N
+hold-keyboard | Boolean | false | \- | N
+label | String | '' | `deprecated` | N
+left-icon | String / Slot | 'search' | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+maxcharacter | Number | - | \- | N
+maxlength | Number | -1 | \- | N
+placeholder | String | '' | \- | N
+placeholder-class | String | input-placeholder | \- | N
+placeholder-style | String | - | required | Y
+result-list | Array | [] | Typescript:`Array` | N
+right-icon | String / Slot | 'close-circle-filled' | `deprecated`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+selection-end | Number | -1 | \- | N
+selection-start | Number | -1 | \- | N
+shape | String | 'square' | options: square/round | N
+type | String | 'text' | options: text/number/idcard/digit/nickname | N
+value | String | '' | \- | N
+
+### Search Events
+
+name | params | description
+-- | -- | --
+action-click | `({})` | \-
+blur | `({ value: string })` | \-
+change | `({ value: string })` | \-
+clear | `({ value: string })` | \-
+focus | `({ value: string })` | \-
+submit | `({ value: string })` | \-
+### Search External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-action | \-
+t-class-clear | \-
+t-class-input | \-
+t-class-input-container | \-
+t-class-left | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-search-action-color | @brand-color | -
+--td-search-bg-color | @bg-color-secondarycontainer | -
+--td-search-clear-icon-color | @text-color-placeholder | -
+--td-search-clear-icon-font-size | 48rpx | -
+--td-search-font-size | @font-size-m | -
+--td-search-height | 80rpx | -
+--td-search-icon-color | @text-color-placeholder | -
+--td-search-icon-font-size | 48rpx | -
+--td-search-label-color | @text-color-primary | -
+--td-search-padding | 16rpx 24rpx | -
+--td-search-placeholder-color | @text-color-placeholder | -
+--td-search-result-high-light-color | @brand-color | -
+--td-search-square-radius | @radius-default | -
+--td-search-text-color | @text-color-primary | -
diff --git a/miniprogram_npm/tdesign-miniprogram/search/README.md b/miniprogram_npm/tdesign-miniprogram/search/README.md
index 8517271..4e3ca08 100644
--- a/miniprogram_npm/tdesign-miniprogram/search/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/search/README.md
@@ -6,6 +6,7 @@ isComponent: true
---



+
## 引入
全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
@@ -18,6 +19,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 01 组件类型
基础搜索框
@@ -41,21 +48,38 @@ isComponent: true
{{ other }}
## API
+
### Search Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-action | String / Slot | '' | 自定义右侧操作按钮文字 | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+action | String / Slot | '' | 自定义右侧操作按钮文字。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+adjust-position | Boolean | true | 键盘弹起时,是否自动上推页面 | N
+always-embed | Boolean | false | 强制 input 处于同层状态,默认 focus 时 input 会切到非同层状态 (仅在 iOS 下生效) | N
center | Boolean | false | 是否居中 | N
-disabled | Boolean | false | 是否禁用 | N
-external-classes | Array | - | 组件外部样式类名,分别用于设置组件外层类名、输入框类名、输入框容器类名、右侧 cancel 文本类名、左侧图标类名、右侧图标类型。`['t-class', 't-class-input', 't-class-input-container', 't-class-action','t-class-left','t-class-clear']` | N
-focus | Boolean | false | 是否聚焦 | N
-label | String | '' | 已废弃。左侧文本 | N
-left-icon | String / Slot | 'search' | 左侧图标 | N
-placeholder | String | '' | 占位符 | N
-right-icon | String / Slot | 'close-circle-filled' | 已废弃。右侧图标 | N
clearable | Boolean | true | 是否启用清除控件 | N
+confirm-hold | Boolean | false | 点击键盘右下角按钮时是否保持键盘不收起 | N
+confirm-type | String | search | 设置键盘右下角按钮的文字,仅在type='text'时生效。
具体释义:
`send` 右下角按钮为“发送”;
`search` 右下角按钮为“搜索”;
`next` 右下角按钮为“下一个”;
`go` 右下角按钮为“前往”;
`done` 右下角按钮为“完成”。
[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/input.html)。可选项:send/search/next/go/done | N
+cursor | Number | - | 必需。指定 focus 时的光标位置 | Y
+cursor-spacing | Number | 0 | 搜索框聚焦时底部与键盘的距离 | N
+disabled | Boolean | false | 是否禁用 | N
+focus | Boolean | false | 是否聚焦 | N
+hold-keyboard | Boolean | false | focus时,点击页面的时候不收起键盘 | N
+label | String | '' | 已废弃。左侧文本 | N
+left-icon | String / Slot | 'search' | 左侧图标。如果需要使用 `Slot` 进行自定义,必须将该值设置为假值。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+maxcharacter | Number | - | 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度。`maxcharacter` 和 `maxlength` 二选一使用 | N
+maxlength | Number | -1 | 用户最多可以输入的文本长度,一个中文等于一个计数长度。默认为 -1,不限制输入长度。`maxcharacter` 和 `maxlength` 二选一使用 | N
+placeholder | String | '' | 占位符 | N
+placeholder-class | String | input-placeholder | 指定 placeholder 的样式类 | N
+placeholder-style | String | - | 必需。指定 placeholder 的样式 | Y
+result-list | Array | [] | 预览结果列表。TS 类型:`Array` | N
+right-icon | String / Slot | 'close-circle-filled' | 已废弃。右侧图标。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+selection-end | Number | -1 | 光标结束位置,自动聚集时有效,需与 selection-start 搭配使用 | N
+selection-start | Number | -1 | 光标起始位置,自动聚集时有效,需与 selection-end 搭配使用 | N
shape | String | 'square' | 搜索框形状。可选项:square/round | N
+type | String | 'text' | 拉起键盘的类型。可选项:text/number/idcard/digit/nickname | N
value | String | '' | 值 | N
### Search Events
@@ -68,3 +92,33 @@ change | `({ value: string })` | 值发生变化时触发
clear | `({ value: string })` | 点击清除时触发
focus | `({ value: string })` | 聚焦时触发
submit | `({ value: string })` | 提交时触发
+### Search External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-action | 操作按钮样式类
+t-class-clear | 右侧图标样式类
+t-class-input | 输入框样式类
+t-class-input-container | 输入框容器样式类
+t-class-left | 左侧图标样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-search-action-color | @brand-color | -
+--td-search-bg-color | @bg-color-secondarycontainer | -
+--td-search-clear-icon-color | @text-color-placeholder | -
+--td-search-clear-icon-font-size | 48rpx | -
+--td-search-font-size | @font-size-m | -
+--td-search-height | 80rpx | -
+--td-search-icon-color | @text-color-placeholder | -
+--td-search-icon-font-size | 48rpx | -
+--td-search-label-color | @text-color-primary | -
+--td-search-padding | 16rpx 24rpx | -
+--td-search-placeholder-color | @text-color-placeholder | -
+--td-search-result-high-light-color | @brand-color | -
+--td-search-square-radius | @radius-default | -
+--td-search-text-color | @text-color-primary | -
diff --git a/miniprogram_npm/tdesign-miniprogram/search/props.js b/miniprogram_npm/tdesign-miniprogram/search/props.js
index ea64987..61b3da8 100644
--- a/miniprogram_npm/tdesign-miniprogram/search/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/search/props.js
@@ -3,48 +3,101 @@ const props = {
type: String,
value: '',
},
+ adjustPosition: {
+ type: Boolean,
+ value: true,
+ },
+ alwaysEmbed: {
+ type: Boolean,
+ value: false,
+ },
center: {
type: Boolean,
value: false,
},
- disabled: {
- type: Boolean,
- value: false,
- },
- externalClasses: {
- type: Array,
- },
- focus: {
- type: Boolean,
- value: false,
- },
- label: {
- type: String,
- value: '',
- },
- leftIcon: {
- type: String,
- value: 'search',
- },
- placeholder: {
- type: String,
- value: '',
- },
- rightIcon: {
- type: String,
- value: 'close-circle-filled',
- },
- shape: {
- type: String,
- value: 'square',
- },
- value: {
- type: String,
- value: '',
- },
clearable: {
type: Boolean,
value: true,
},
+ confirmHold: {
+ type: Boolean,
+ value: false,
+ },
+ confirmType: {
+ type: String,
+ value: 'search',
+ },
+ cursor: {
+ type: Number,
+ required: true,
+ },
+ cursorSpacing: {
+ type: Number,
+ value: 0,
+ },
+ disabled: {
+ type: Boolean,
+ value: false,
+ },
+ focus: {
+ type: Boolean,
+ value: false,
+ },
+ holdKeyboard: {
+ type: Boolean,
+ value: false,
+ },
+ leftIcon: {
+ type: String,
+ value: 'search',
+ },
+ maxcharacter: {
+ type: Number,
+ },
+ maxlength: {
+ type: Number,
+ value: -1,
+ },
+ placeholder: {
+ type: String,
+ value: '',
+ },
+ placeholderClass: {
+ type: String,
+ value: 'input-placeholder',
+ },
+ placeholderStyle: {
+ type: String,
+ value: '',
+ required: true,
+ },
+ resultList: {
+ type: Array,
+ value: [],
+ },
+ selectionEnd: {
+ type: Number,
+ value: -1,
+ },
+ selectionStart: {
+ type: Number,
+ value: -1,
+ },
+ shape: {
+ type: String,
+ value: 'square',
+ },
+ style: {
+ type: String,
+ value: '',
+ },
+ type: {
+ type: String,
+ value: 'text',
+ },
+ value: {
+ type: String,
+ value: '',
+ },
};
export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/search/search.d.ts b/miniprogram_npm/tdesign-miniprogram/search/search.d.ts
index 61c1cdb..76ab9cb 100644
--- a/miniprogram_npm/tdesign-miniprogram/search/search.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/search/search.d.ts
@@ -6,14 +6,13 @@ export default class Search extends SuperComponent {
};
properties: import("./type").TdSearchProps;
observers: {
- focus(this: Search, nextValue: boolean): void;
+ resultList(val: any): void;
};
data: {
classPrefix: string;
prefix: string;
- localValue: {
- focus: boolean;
- };
+ isShowResultList: boolean;
+ isSelected: boolean;
};
onInput(e: any): void;
onFocus(e: any): void;
@@ -21,4 +20,5 @@ export default class Search extends SuperComponent {
handleClear(): void;
onConfirm(e: any): void;
onActionClick(): void;
+ onSelectResultItem(e: any): void;
}
diff --git a/miniprogram_npm/tdesign-miniprogram/search/search.js b/miniprogram_npm/tdesign-miniprogram/search/search.js
index 6560bb2..bc6e9f6 100644
--- a/miniprogram_npm/tdesign-miniprogram/search/search.js
+++ b/miniprogram_npm/tdesign-miniprogram/search/search.js
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
+import { getCharacterLength } from '../common/utils';
const { prefix } = config;
const name = `${prefix}-search`;
let Search = class Search extends SuperComponent {
@@ -25,36 +26,59 @@ let Search = class Search extends SuperComponent {
};
this.properties = props;
this.observers = {
- focus(nextValue) {
- this.setData({ 'localValue.focus': nextValue });
+ resultList(val) {
+ const { isSelected } = this.data;
+ if (val.length) {
+ if (isSelected) {
+ this.setData({
+ isShowResultList: false,
+ isSelected: false,
+ });
+ }
+ else {
+ this.setData({
+ isShowResultList: true,
+ });
+ }
+ }
+ else {
+ this.setData({
+ isShowResultList: false,
+ });
+ }
},
};
this.data = {
classPrefix: name,
prefix,
- localValue: {
- focus: false,
- },
+ isShowResultList: false,
+ isSelected: false,
};
}
onInput(e) {
- const { value } = e.detail;
- this.setData({ value });
+ let { value } = e.detail;
+ const { maxcharacter } = this.properties;
+ if (maxcharacter && typeof maxcharacter === 'number' && maxcharacter > 0) {
+ const { characters } = getCharacterLength('maxcharacter', value, maxcharacter);
+ value = characters;
+ }
+ this.setData({
+ value,
+ });
this.triggerEvent('change', { value });
}
onFocus(e) {
const { value } = e.detail;
- this.setData({ 'localValue.focus': true });
this.triggerEvent('focus', { value });
}
onBlur(e) {
const { value } = e.detail;
- this.setData({ 'localValue.focus': false });
this.triggerEvent('blur', { value });
}
handleClear() {
this.setData({ value: '' });
this.triggerEvent('clear', { value: '' });
+ this.triggerEvent('change', { value: '' });
}
onConfirm(e) {
const { value } = e.detail;
@@ -63,6 +87,16 @@ let Search = class Search extends SuperComponent {
onActionClick() {
this.triggerEvent('action-click');
}
+ onSelectResultItem(e) {
+ const { index } = e.currentTarget.dataset;
+ const item = this.properties.resultList[index];
+ this.setData({
+ value: item,
+ isSelected: true,
+ });
+ this.triggerEvent('change', { value: item });
+ this.triggerEvent('selectresult', { index, item });
+ }
};
Search = __decorate([
wxComponent()
diff --git a/miniprogram_npm/tdesign-miniprogram/search/search.json b/miniprogram_npm/tdesign-miniprogram/search/search.json
index 049940c..ed5b2b6 100644
--- a/miniprogram_npm/tdesign-miniprogram/search/search.json
+++ b/miniprogram_npm/tdesign-miniprogram/search/search.json
@@ -1,6 +1,8 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
- "t-icon": "../icon/icon"
+ "t-icon": "../icon/icon",
+ "t-cell": "../cell/cell"
}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/search/search.wxml b/miniprogram_npm/tdesign-miniprogram/search/search.wxml
index 92156d5..372b4d3 100644
--- a/miniprogram_npm/tdesign-miniprogram/search/search.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/search/search.wxml
@@ -1,29 +1,40 @@
+
-
+
+
-
+
{{action}}
-
+
+
+
+
+
+
+
diff --git a/miniprogram_npm/tdesign-miniprogram/search/search.wxs b/miniprogram_npm/tdesign-miniprogram/search/search.wxs
new file mode 100644
index 0000000..ac86989
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/search/search.wxs
@@ -0,0 +1,6 @@
+var highLight = function (label, keyword) {
+ return label.replace(keyword, '' + keyword + '');
+};
+module.exports = {
+ highLight: highLight,
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/search/search.wxss b/miniprogram_npm/tdesign-miniprogram/search/search.wxss
index 95e9253..cf32e91 100644
--- a/miniprogram_npm/tdesign-miniprogram/search/search.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/search/search.wxss
@@ -32,7 +32,7 @@
}
.t-search__label {
padding: 8rpx;
- color: var(--search-label-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-search-label-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-search__input-box {
flex: 1;
@@ -59,17 +59,21 @@
.t-search__input-box .t-input__keyword {
display: inline-block;
flex: 1;
- color: var(--td-search-text-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-search-text-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
font-size: var(--td-search-font-size, var(--td-font-size-m, 32rpx));
padding-left: 10rpx;
+ min-height: 48rpx;
+ line-height: 48rpx;
}
.t-search__input-box .t-icon {
- color: var(--td-search-icon-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-search-icon-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
+ font-size: var(--td-search-icon-font-size, 48rpx);
}
.t-search__clear {
position: relative;
margin-left: 10px;
- color: var(--td-search-clear-icon-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ font-size: var(--td-search-clear-icon-font-size, 48rpx);
+ color: var(--td-search-clear-icon-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
}
.t-search__clear.relative {
position: relative;
@@ -90,8 +94,17 @@
color: var(--td-search-action-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
}
.t-search__placeholder {
- color: var(--td-search-placeholder-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-search-placeholder-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
}
.t-search__placeholder--center {
text-align: center;
}
+.t-search__result-item--highLight {
+ color: var(--td-search-result-high-light-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
+}
+.t-search__result-list .t-search__result-item {
+ padding-left: 0;
+}
+.t-search__result-list .t-search__result-item::after {
+ left: 0;
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/search/type.d.ts b/miniprogram_npm/tdesign-miniprogram/search/type.d.ts
index 0977e8a..8b73ffa 100644
--- a/miniprogram_npm/tdesign-miniprogram/search/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/search/type.d.ts
@@ -1,54 +1,104 @@
export interface TdSearchProps {
- style?: {
- type: StringConstructor;
- value?: string;
- };
action?: {
type: StringConstructor;
value?: string;
};
+ adjustPosition?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+ alwaysEmbed?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
center?: {
type: BooleanConstructor;
value?: boolean;
};
- disabled?: {
+ clearable?: {
type: BooleanConstructor;
value?: boolean;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-input', 't-class-input-container', 't-class-cancel', 't-class-left', 't-class-right'];
+ confirmHold?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+ confirmType?: {
+ type: StringConstructor;
+ value?: 'send' | 'search' | 'next' | 'go' | 'done';
+ };
+ cursor: {
+ type: NumberConstructor;
+ value?: number;
+ required?: boolean;
+ };
+ cursorSpacing?: {
+ type: NumberConstructor;
+ value?: number;
+ };
+ disabled?: {
+ type: BooleanConstructor;
+ value?: boolean;
};
focus?: {
type: BooleanConstructor;
value?: boolean;
};
- label?: {
- type: StringConstructor;
- value?: string;
+ holdKeyboard?: {
+ type: BooleanConstructor;
+ value?: boolean;
};
leftIcon?: {
type: StringConstructor;
value?: string;
};
+ maxcharacter?: {
+ type: NumberConstructor;
+ value?: number;
+ };
+ maxlength?: {
+ type: NumberConstructor;
+ value?: number;
+ };
placeholder?: {
type: StringConstructor;
value?: string;
};
- rightIcon?: {
+ placeholderClass?: {
type: StringConstructor;
value?: string;
};
+ placeholderStyle: {
+ type: StringConstructor;
+ value?: string;
+ required?: boolean;
+ };
+ resultList?: {
+ type: ArrayConstructor;
+ value?: Array;
+ };
+ selectionEnd?: {
+ type: NumberConstructor;
+ value?: number;
+ };
+ selectionStart?: {
+ type: NumberConstructor;
+ value?: number;
+ };
shape?: {
type: StringConstructor;
value?: 'square' | 'round';
};
+ style?: {
+ type: StringConstructor;
+ value?: string;
+ };
+ type?: {
+ type: StringConstructor;
+ value?: 'text' | 'number' | 'idcard' | 'digit' | 'nickname';
+ };
value?: {
type: StringConstructor;
value?: string;
};
- clearable: {
- type: BooleanConstructor;
- value?: boolean;
- };
}
diff --git a/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.json b/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.json
index 2c00c37..3c096d3 100644
--- a/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.json
+++ b/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-badge": "../badge/badge",
"t-icon": "../icon/icon"
diff --git a/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.wxml b/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.wxml
index 08a7d1b..a95478e 100644
--- a/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.wxml
@@ -7,7 +7,8 @@
style="{{_._style([style, customStyle])}}"
bind:tap="handleClick"
aria-role="button"
- aria-label="{{ active ? '已选中' + label : label}}"
+ aria-label="{{ active ? '已选中,' + label : label}}"
+ aria-label="{{ ariaLabel || (badgeProps.dot || badgeProps.count ? (active ? '已选中,' + label + _.getBadgeAriaLabel({ ...badgeProps }) : label + _.getBadgeAriaLabel({ ...badgeProps })) : '') }}"
aria-disabled="{{disabled}}"
>
diff --git a/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.wxss b/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.wxss
index d5154f8..d1e4f90 100644
--- a/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.wxss
@@ -32,7 +32,7 @@
position: relative;
padding: 32rpx;
font-size: var(--td-side-bar-font-size, 32rpx);
- color: var(--td-side-bar-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-side-bar-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
background: var(--td-side-bar-bg-color, var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3)));
min-height: var(--td-side-bar-item-height, 112rpx);
box-sizing: border-box;
@@ -42,7 +42,7 @@
.t-side-bar-item--active {
font-weight: 600;
background: var(--td-bg-color-container, var(--td-font-white-1, #ffffff));
- color: var(--td-side-bar-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
+ --td-badge-content-text-color: var(--td-side-bar-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
}
.t-side-bar-item__icon {
font-size: var(--td-side-bar-icon-size, 40rpx);
@@ -53,9 +53,10 @@
z-index: 1;
position: absolute;
right: 0;
- width: calc(var(--td-side-bar-border-radius, 18rpx) * 2);
+ width: 100%;
height: calc(var(--td-side-bar-border-radius, 18rpx) * 2);
- background: #fff;
+ background: var(--td-bg-color-container, var(--td-font-white-1, #ffffff));
+ pointer-events: none;
}
.t-side-bar-item__prefix::after,
.t-side-bar-item__suffix::after {
@@ -78,7 +79,7 @@
border-top-right-radius: var(--td-side-bar-border-radius, 18rpx);
}
.t-side-bar-item--disabled {
- color: var(--td-side-bar-disabled-color, var(--td-font-gray-4, rgba(0, 0, 0, 0.26)));
+ color: var(--td-side-bar-disabled-color, var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26))));
}
.t-side-bar-item__line {
width: 6rpx;
diff --git a/miniprogram_npm/tdesign-miniprogram/side-bar-item/type.d.ts b/miniprogram_npm/tdesign-miniprogram/side-bar-item/type.d.ts
index e5ceead..94aff15 100644
--- a/miniprogram_npm/tdesign-miniprogram/side-bar-item/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/side-bar-item/type.d.ts
@@ -1,7 +1,8 @@
+import { BadgeProps } from '../badge/index';
export interface TdSideBarItemProps {
badgeProps?: {
type: ObjectConstructor;
- value?: object;
+ value?: BadgeProps;
};
disabled?: {
type: BooleanConstructor;
@@ -9,6 +10,7 @@ export interface TdSideBarItemProps {
};
icon?: {
type: null;
+ value?: string | object;
};
label?: {
type: StringConstructor;
diff --git a/miniprogram_npm/tdesign-miniprogram/side-bar/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/side-bar/README.en-US.md
index 46109c9..926da55 100644
--- a/miniprogram_npm/tdesign-miniprogram/side-bar/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/side-bar/README.en-US.md
@@ -1,10 +1,13 @@
:: BASE_DOC ::
## API
+
### SideBar Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
value | String / Number | - | \- | N
default-value | String / Number | undefined | uncontrolled property | N
@@ -15,12 +18,33 @@ name | params | description
change | `(value: number \| string, label: string)` | \-
click | `(value: number \| string, label: string)` | \-
+
### SideBarItem Props
name | type | default | description | required
-- | -- | -- | -- | --
-badge-props | Object | - | \- | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+badge-props | Object | - | Typescript:`BadgeProps`,[Badge API Documents](./badge?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/side-bar-item/type.ts) | N
disabled | Boolean | false | \- | N
-icon | String / Object | - | `1.0.0-rc.1` | N
+icon | String / Object | - | \- | N
label | String | - | \- | N
value | String / Number | - | \- | N
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-side-bar-bg-color | @bg-color-secondarycontainer | -
+--td-side-bar-height | 100% | -
+--td-side-bar-width | 206rpx | -
+--td-side-bar-active-color | @brand-color | -
+--td-side-bar-bg-color | @bg-color-secondarycontainer | -
+--td-side-bar-border-radius | 18rpx | -
+--td-side-bar-color | @font-gray-1 | -
+--td-side-bar-disabled-color | @font-gray-4 | -
+--td-side-bar-font-size | 32rpx | -
+--td-side-bar-icon-size | 40rpx | -
+--td-side-bar-item-height | 112rpx | -
+--td-side-bar-item-line-height | 48rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/side-bar/README.md b/miniprogram_npm/tdesign-miniprogram/side-bar/README.md
index ef10681..c82c353 100644
--- a/miniprogram_npm/tdesign-miniprogram/side-bar/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/side-bar/README.md
@@ -27,6 +27,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 锚点用法
{{ base }}
@@ -44,10 +50,13 @@ isComponent: true
{{ custom }}
## API
+
### SideBar Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
value | String / Number | - | 选项值 | N
default-value | String / Number | undefined | 选项值。非受控属性 | N
@@ -58,12 +67,33 @@ default-value | String / Number | undefined | 选项值。非受控属性 | N
change | `(value: number \| string, label: string)` | 选项值发生变化时触发
click | `(value: number \| string, label: string)` | 点击选项时触发
+
### SideBarItem Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-badge-props | Object | - | 透传至 Badge 组件 | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+badge-props | Object | - | 透传至 Badge 组件。TS 类型:`BadgeProps`,[Badge API Documents](./badge?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/side-bar-item/type.ts) | N
disabled | Boolean | false | 是否禁用 | N
-icon | String / Object | - | `1.0.0-rc.1`。图标,传对象则透传至 Icon | N
+icon | String / Object | - | 图标,传对象则透传至 Icon | N
label | String | - | 展示的标签 | N
value | String / Number | - | 当前选项的值 | N
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-side-bar-bg-color | @bg-color-secondarycontainer | -
+--td-side-bar-height | 100% | -
+--td-side-bar-width | 206rpx | -
+--td-side-bar-active-color | @brand-color | -
+--td-side-bar-bg-color | @bg-color-secondarycontainer | -
+--td-side-bar-border-radius | 18rpx | -
+--td-side-bar-color | @font-gray-1 | -
+--td-side-bar-disabled-color | @font-gray-4 | -
+--td-side-bar-font-size | 32rpx | -
+--td-side-bar-icon-size | 40rpx | -
+--td-side-bar-item-height | 112rpx | -
+--td-side-bar-item-line-height | 48rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/side-bar/side-bar.d.ts b/miniprogram_npm/tdesign-miniprogram/side-bar/side-bar.d.ts
index 2be2070..f5ac06e 100644
--- a/miniprogram_npm/tdesign-miniprogram/side-bar/side-bar.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/side-bar/side-bar.d.ts
@@ -1,7 +1,7 @@
import { SuperComponent, RelationsOptions } from '../common/src/index';
export default class SideBar extends SuperComponent {
externalClasses: string[];
- childs: any[];
+ children: any[];
relations: RelationsOptions;
controlledProps: {
key: string;
diff --git a/miniprogram_npm/tdesign-miniprogram/side-bar/side-bar.js b/miniprogram_npm/tdesign-miniprogram/side-bar/side-bar.js
index 50458f6..c5736f0 100644
--- a/miniprogram_npm/tdesign-miniprogram/side-bar/side-bar.js
+++ b/miniprogram_npm/tdesign-miniprogram/side-bar/side-bar.js
@@ -14,16 +14,16 @@ let SideBar = class SideBar extends SuperComponent {
constructor() {
super(...arguments);
this.externalClasses = [`${prefix}-class`];
- this.childs = [];
+ this.children = [];
this.relations = {
[relationsPath]: {
type: 'child',
linked(child) {
- this.childs.push(child);
+ this.children.push(child);
},
unlinked(child) {
- const index = this.childs.findIndex((item) => item === child);
- this.childs.splice(index, 1);
+ const index = this.children.findIndex((item) => item === child);
+ this.children.splice(index, 1);
},
},
};
diff --git a/miniprogram_npm/tdesign-miniprogram/side-bar/side-bar.json b/miniprogram_npm/tdesign-miniprogram/side-bar/side-bar.json
index a1c9d56..2093b53 100644
--- a/miniprogram_npm/tdesign-miniprogram/side-bar/side-bar.json
+++ b/miniprogram_npm/tdesign-miniprogram/side-bar/side-bar.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-side-bar-item": "../side-bar-item/side-bar-item"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/skeleton/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/skeleton/README.en-US.md
index 34a7592..889a454 100644
--- a/miniprogram_npm/tdesign-miniprogram/skeleton/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/skeleton/README.en-US.md
@@ -1,13 +1,38 @@
:: BASE_DOC ::
## API
+
### Skeleton Props
name | type | default | description | required
-- | -- | -- | -- | --
-animation | String | none | options:gradient/flashed/none | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+animation | String | none | options: gradient/flashed/none | N
delay | Number | 0 | \- | N
-external-classes | Array | - | `['t-class', 't-class-avatar', 't-class-image', 't-class-text']` | N
loading | Boolean | true | \- | N
-row-col | Array | [1, 1, 1, { width: '70%' }] | Typescript:`SkeletonRowCol` `type SkeletonRowCol = Array>` `interface SkeletonRowColObj { width?: string; size?: string;height?: string; marginRight?: string; marginLeft?: string; margin?: string; type?: 'rect' \| 'circle' \| 'text';}`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/skeleton/type.ts) | N
-theme | String | text | options:avatar/image/text/paragraph | N
+row-col | Array | - | Typescript:`SkeletonRowCol` `type SkeletonRowCol = Array>` `interface SkeletonRowColObj { width?: string; size?: string;height?: string; marginRight?: string; marginLeft?: string; margin?: string; type?: 'rect' \| 'circle' \| 'text';}`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/skeleton/type.ts) | N
+theme | String | text | options: avatar/image/text/paragraph | N
+### Skeleton External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-col | \-
+t-class-row | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-skeleton-animation-flashed | rgba(90%, 90%, 90%, 0.3) | -
+--td-skeleton-animation-gradient | rgba(0, 0, 0, 4%) | -
+--td-skeleton-bg-color | @bg-color-page | -
+--td-skeleton-circle-border-radius | @radius-circle | -
+--td-skeleton-circle-height | 96rpx | -
+--td-skeleton-rect-border-radius | @radius-default | -
+--td-skeleton-rect-height | 32rpx | -
+--td-skeleton-row-spacing | @spacer-2 | -
+--td-skeleton-text-border-radius | @radius-small | -
+--td-skeleton-text-height | 32rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/skeleton/README.md b/miniprogram_npm/tdesign-miniprogram/skeleton/README.md
index e426de4..84798e6 100644
--- a/miniprogram_npm/tdesign-miniprogram/skeleton/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/skeleton/README.md
@@ -18,6 +18,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 骨架屏类型
基础骨架屏
@@ -43,13 +49,38 @@ isComponent: true
## API
+
### Skeleton Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
animation | String | none | 动画效果,有「渐变加载动画」和「闪烁加载动画」两种。值为 'none' 则表示没有动画。可选项:gradient/flashed/none | N
-delay | Number | 0 | 【开发中】延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒 | N
-external-classes | Array | - | 组件类名,分别用于设置组件外层元素、头像、图片、文本等元素类名。`['t-class', 't-class-avatar', 't-class-image', 't-class-text']` | N
+delay | Number | 0 | 延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒 | N
loading | Boolean | true | 是否为加载状态,如果是则显示骨架图,如果不是则显示加载完成的内容 | N
-row-col | Array | [1, 1, 1, { width: '70%' }] | 用于设置行列数量、宽度高度、间距等。【示例一】,`[1, 1, 2]` 表示输出三行骨架图,第一行一列,第二行一列,第三行两列。【示例二】,`[1, 1, { width: '100px' }]` 表示自定义第三行的宽度为 `100px`。【示例三】,`[1, 2, [{ width, height }, { width, height, marginLeft }]]` 表示第三行有两列,且自定义宽度、高度和间距。TS 类型:`SkeletonRowCol` `type SkeletonRowCol = Array>` `interface SkeletonRowColObj { width?: string; size?: string;height?: string; marginRight?: string; marginLeft?: string; margin?: string; type?: 'rect' \| 'circle' \| 'text';}`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/skeleton/type.ts) | N
+row-col | Array | - | 高级设置,用于自定义行列数量、宽度高度、间距等。【示例一】,`[1, 1, 2]` 表示输出三行骨架图,第一行一列,第二行一列,第三行两列。【示例二】,`[1, 1, { width: '100px' }]` 表示自定义第三行的宽度为 `100px`。【示例三】,`[1, 2, [{ width, height }, { width, height, marginLeft }]]` 表示第三行有两列,且自定义宽度、高度、尺寸(圆形或方形使用)、间距、内容等。TS 类型:`SkeletonRowCol` `type SkeletonRowCol = Array>` `interface SkeletonRowColObj { width?: string; size?: string;height?: string; marginRight?: string; marginLeft?: string; margin?: string; type?: 'rect' \| 'circle' \| 'text';}`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/skeleton/type.ts) | N
theme | String | text | 骨架图风格,有基础、头像组合等两大类。可选项:avatar/image/text/paragraph | N
+### Skeleton External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-col | 行样式类
+t-class-row | 列样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-skeleton-animation-flashed | rgba(90%, 90%, 90%, 0.3) | -
+--td-skeleton-animation-gradient | rgba(0, 0, 0, 4%) | -
+--td-skeleton-bg-color | @bg-color-page | -
+--td-skeleton-circle-border-radius | @radius-circle | -
+--td-skeleton-circle-height | 96rpx | -
+--td-skeleton-rect-border-radius | @radius-default | -
+--td-skeleton-rect-height | 32rpx | -
+--td-skeleton-row-spacing | @spacer-2 | -
+--td-skeleton-text-border-radius | @radius-small | -
+--td-skeleton-text-height | 32rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/skeleton/props.js b/miniprogram_npm/tdesign-miniprogram/skeleton/props.js
index b3e625f..35c8c48 100644
--- a/miniprogram_npm/tdesign-miniprogram/skeleton/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/skeleton/props.js
@@ -7,9 +7,6 @@ const props = {
type: Number,
value: 0,
},
- externalClasses: {
- type: Array,
- },
loading: {
type: Boolean,
value: true,
diff --git a/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.d.ts b/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.d.ts
index 580711a..f7e1353 100644
--- a/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.d.ts
@@ -11,6 +11,7 @@ export default class Skeleton extends SuperComponent {
};
observers: {
rowCol(): void;
+ 'loading, delay'(): void;
};
lifetimes: {
attached(): void;
@@ -19,5 +20,6 @@ export default class Skeleton extends SuperComponent {
init(): void;
getColItemClass(obj: SkeletonRowColObj): ClassName;
getColItemStyle(obj: SkeletonRowColObj): Styles;
+ isShowSkeleton(): void;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.js b/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.js
index 3356e6c..b098834 100644
--- a/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.js
+++ b/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.js
@@ -36,10 +36,14 @@ let Skeleton = class Skeleton extends SuperComponent {
rowCol() {
this.init();
},
+ 'loading, delay'() {
+ this.isShowSkeleton();
+ },
};
this.lifetimes = {
attached() {
this.init();
+ this.isShowSkeleton();
},
};
this.methods = {
@@ -108,6 +112,20 @@ let Skeleton = class Skeleton extends SuperComponent {
});
return style;
},
+ isShowSkeleton() {
+ const { loading, delay } = this.properties;
+ if (!loading || delay === 0) {
+ this.setData({
+ isShow: loading,
+ });
+ return;
+ }
+ setTimeout(() => {
+ this.setData({
+ isShow: loading,
+ });
+ }, delay);
+ },
};
}
};
diff --git a/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.json b/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.json
index a89ef4d..4f0a3f0 100644
--- a/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.json
+++ b/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.json
@@ -1,4 +1,5 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.wxml b/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.wxml
index 4cb7141..e6919ad 100644
--- a/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.wxml
@@ -1,7 +1,6 @@
-
-
+
diff --git a/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.wxs b/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.wxs
deleted file mode 100644
index faa613e..0000000
--- a/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.wxs
+++ /dev/null
@@ -1,30 +0,0 @@
-var getStyle = function (object) {
- var styleList = [];
- if (object.width) {
- styleList.push('width:' + object.width);
- }
- styleList.push(object.height ? 'height:' + object.height : 'height:16px');
- if (object.background) {
- styleList.push('background:' + object.background);
- }
- if (object.backgroundColor) {
- styleList.push('background-color:' + object.backgroundColor);
- }
- if (object.margin) {
- styleList.push('margin:' + object.margin);
- }
- if (object.marginRight) {
- styleList.push('margin-right:' + object.marginRight);
- }
- if (object.marginLeft) {
- styleList.push('margin-left:' + object.marginLeft);
- }
- if (object.borderRadius) {
- styleList.push('border-radius:' + object.borderRadius);
- }
- return styleList.join(';');
-};
-
-module.exports = {
- getStyle: getStyle,
-};
diff --git a/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.wxss b/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.wxss
index b39b394..f50341e 100644
--- a/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.wxss
@@ -39,7 +39,7 @@
margin-bottom: 0;
}
.t-skeleton__col {
- background-color: var(--td-skeleton-bg-color, var(--td-bg-color-page, var(--td-gray-color-1, #f3f3f3)));
+ background-color: var(--td-skeleton-bg-color, var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3)));
display: flex;
align-items: center;
justify-content: center;
diff --git a/miniprogram_npm/tdesign-miniprogram/skeleton/type.d.ts b/miniprogram_npm/tdesign-miniprogram/skeleton/type.d.ts
index 50b0105..c96ee71 100644
--- a/miniprogram_npm/tdesign-miniprogram/skeleton/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/skeleton/type.d.ts
@@ -3,18 +3,10 @@ export interface TdSkeletonProps {
type: StringConstructor;
value?: 'gradient' | 'flashed' | 'none';
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
delay?: {
type: NumberConstructor;
value?: number;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-avatar', 't-class-image', 't-class-text'];
- };
loading?: {
type: BooleanConstructor;
value?: boolean;
diff --git a/miniprogram_npm/tdesign-miniprogram/slider/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/slider/README.en-US.md
index 5723aee..5076b36 100644
--- a/miniprogram_npm/tdesign-miniprogram/slider/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/slider/README.en-US.md
@@ -1,14 +1,17 @@
:: BASE_DOC ::
## API
+
+
### Slider Props
name | type | default | description | required
-- | -- | -- | -- | --
-colors | Array | [] | Typescript:`Array` | N
-disabled | Boolean | false | \- | N
-disabled-color | Array | [] | Typescript:`Array` | N
-external-classes | Array | - | `['t-class', 't-class-bar', 't-class-bar-active', 't-class-bar-disabled', 't-class-cursor']` | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+colors | Array | [] | `deprecated`。Typescript:`Array` | N
+disabled | Boolean | undefined | \- | N
+disabled-color | Array | [] | `deprecated`。Typescript:`Array` | N
label | String / Boolean | false | Typescript:`string \| boolean` | N
marks | Object / Array | {} | Typescript:`Record \| Array` | N
max | Number | 100 | \- | N
@@ -16,14 +19,48 @@ min | Number | 0 | \- | N
range | Boolean | false | \- | N
show-extreme-value | Boolean | false | \- | N
step | Number | 1 | \- | N
-theme | String | default | `0.30.0`。options:default/capsule | N
+theme | String | default | `0.30.0`。options: default/capsule | N
value | Number / Array | 0 | Typescript:`SliderValue` `type SliderValue = number \| Array`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/slider/type.ts) | N
default-value | Number / Array | undefined | uncontrolled property。Typescript:`SliderValue` `type SliderValue = number \| Array`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/slider/type.ts) | N
+vertical | Boolean | false | \- | N
### Slider Events
name | params | description
-- | -- | --
change | `(value: SliderValue)` | \-
-dragend | \- | \-
-dragstart | \- | \-
+dragend | `(value: SliderValue, e: TouchEvent)` | \-
+dragstart | `(e: TouchEvent)` | \-
+### Slider External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-bar | \-
+t-class-bar-active | \-
+t-class-bar-disabled | \-
+t-class-cursor | \-
+
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-slider-active-color | @brand-color | -
+--td-slider-bar-height | 8rpx | -
+--td-slider-bar-width | 8rpx | -
+--td-slider-capsule-bar-color | @bg-color-component | -
+--td-slider-capsule-bar-heihgt | 48rpx | -
+--td-slider-capsule-bar-width | 48rpx | -
+--td-slider-capsule-line-heihgt | 36rpx | -
+--td-slider-default-color | @bg-color-component | -
+--td-slider-default-color | @bg-color-component-disabled | -
+--td-slider-disabled-color | @brand-color-disabled | -
+--td-slider-disabled-text-color | @text-color-disabled | -
+--td-slider-dot-bg-color | #fff | -
+--td-slider-dot-color | @component-border | -
+--td-slider-dot-disabled-bg-color | #fff | -
+--td-slider-dot-disabled-border-color | #f3f3f3 | -
+--td-slider-dot-size | 40rpx | -
+--td-slider-text-color | @text-color-primary | -
diff --git a/miniprogram_npm/tdesign-miniprogram/slider/README.md b/miniprogram_npm/tdesign-miniprogram/slider/README.md
index 88aa79c..78686e9 100644
--- a/miniprogram_npm/tdesign-miniprogram/slider/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/slider/README.md
@@ -20,6 +20,12 @@ isComponent: true
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
单游标滑块
@@ -50,15 +56,25 @@ isComponent: true
{{ capsule }}
+#### 垂直状态
+
+垂直方向的滑块
+
+{{ vertical }}
+
+
## API
+
+
### Slider Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-colors | Array | [] | 废弃。颜色,[已选择, 未选择]。TS 类型:`Array` | N
-disabled | Boolean | false | 是否禁用组件 | N
-disabled-color | Array | [] | 废弃。禁用状态滑动条的颜色,[已选, 未选]。TS 类型:`Array` | N
-external-classes | Array | - | 组件类名,分别用于设置 组件外层元素、滑道底部、滑道激活态、滑道禁用态、游标 等元素类名。`['t-class', 't-class-bar', 't-class-bar-active', 't-class-bar-disabled', 't-class-cursor']` | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+colors | Array | [] | 已废弃。颜色,[已选择, 未选择]。TS 类型:`Array` | N
+disabled | Boolean | undefined | 是否禁用组件 | N
+disabled-color | Array | [] | 已废弃。禁用状态滑动条的颜色,[已选, 未选]。TS 类型:`Array` | N
label | String / Boolean | false | 滑块当前值文本。
值为 true 显示默认文案;值为 false 不显示滑块当前值文本;
值为 `${value}%` 则表示组件会根据占位符渲染文案;
值类型为函数时,参数 `value` 标识滑块值,参数 `position=start` 表示范围滑块的起始值,参数 `position=end` 表示范围滑块的终点值。TS 类型:`string \| boolean` | N
marks | Object / Array | {} | 刻度标记,示例:`[0, 10, 40, 200]` 或者 `{ 5: '5¥', 10: '10%' }`。TS 类型:`Record \| Array` | N
max | Number | 100 | 滑块范围最大值 | N
@@ -69,11 +85,58 @@ step | Number | 1 | 步长 | N
theme | String | default | `0.30.0`。滑块风格。可选项:default/capsule | N
value | Number / Array | 0 | 滑块值。TS 类型:`SliderValue` `type SliderValue = number \| Array`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/slider/type.ts) | N
default-value | Number / Array | undefined | 滑块值。非受控属性。TS 类型:`SliderValue` `type SliderValue = number \| Array`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/slider/type.ts) | N
+vertical | Boolean | false | 是否是垂直的滑块(渲染垂直滑块时,默认高度为400rpx,可通过修改`--td-slider-bar-height`来自定义高度) | N
### Slider Events
名称 | 参数 | 描述
-- | -- | --
change | `(value: SliderValue)` | 滑块值变化时触发
-dragend | \- | 结束拖动时触发
-dragstart | \- | 开始拖动时触发
+dragend | `(value: SliderValue, e: TouchEvent)` | 结束拖动时触发
+dragstart | `(e: TouchEvent)` | 开始拖动时触发
+### Slider External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-bar | 滑道底部样式类
+t-class-bar-active | 滑道激活态样式类
+t-class-bar-disabled | 滑道禁用态样式类
+t-class-cursor | 游标样式类
+
+## FAQ
+
+当 slider 外层使用 `hidden` 包裹,需要在 `hidden = false` 时,重新调用组件的 `init` 方法,才能正常渲染(在t-popup/t-dialog中同理)。如下:
+
+```html
+
+```
+
+```js
+const $slider = this.selectComponent('#slider');
+
+$slider.init();
+```
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-slider-active-color | @brand-color | -
+--td-slider-bar-height | 8rpx | vertical为true时默认为400rpx
+--td-slider-bar-width | 8rpx | vertical为true时有效
+--td-slider-capsule-bar-color | @bg-color-component | -
+--td-slider-capsule-bar-heihgt | 48rpx | -
+--td-slider-capsule-bar-width | 48rpx | vertical为true时有效
+--td-slider-capsule-line-heihgt | 36rpx | -
+--td-slider-default-color | @bg-color-component | -
+--td-slider-default-color | @bg-color-component-disabled | -
+--td-slider-disabled-color | @brand-color-disabled | -
+--td-slider-disabled-text-color | @text-color-disabled | -
+--td-slider-dot-bg-color | #fff | -
+--td-slider-dot-color | @component-border | -
+--td-slider-dot-disabled-bg-color | #fff | -
+--td-slider-dot-disabled-border-color | #f3f3f3 | -
+--td-slider-dot-size | 40rpx | -
+--td-slider-text-color | @text-color-primary | -
diff --git a/miniprogram_npm/tdesign-miniprogram/slider/props.js b/miniprogram_npm/tdesign-miniprogram/slider/props.js
index 9e327ba..291e43d 100644
--- a/miniprogram_npm/tdesign-miniprogram/slider/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/slider/props.js
@@ -1,10 +1,7 @@
const props = {
disabled: {
- type: Boolean,
- value: false,
- },
- externalClasses: {
- type: Array,
+ type: null,
+ value: undefined,
},
label: {
type: null,
@@ -46,5 +43,9 @@ const props = {
type: null,
value: 0,
},
+ vertical: {
+ type: Boolean,
+ value: false,
+ },
};
export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/slider/slider.d.ts b/miniprogram_npm/tdesign-miniprogram/slider/slider.d.ts
index c331929..df8933d 100644
--- a/miniprogram_npm/tdesign-miniprogram/slider/slider.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/slider/slider.d.ts
@@ -19,9 +19,14 @@ declare type dataType = {
_value: SliderValue;
prefix: string;
isVisibleToScreenReader: boolean;
+ identifier: number[];
+ __inited: boolean;
};
export default class Slider extends SuperComponent {
externalClasses: string[];
+ options: {
+ pureDataPattern: RegExp;
+ };
properties: import("./type").TdSliderProps;
controlledProps: {
key: string;
@@ -37,19 +42,25 @@ export default class Slider extends SuperComponent {
created(): void;
attached(): void;
};
+ injectPageScroll(): void;
+ observerScrollTop(rest: any): void;
+ toggleA11yTips(): void;
+ renderLine(val: any): void;
triggerValue(value?: SliderValue): void;
handlePropsChange(newValue: SliderValue): void;
- handleMask(marks: any): void;
+ handleMark(marks: any): void;
setSingleBarWidth(value: number): void;
- getInitialStyle(): Promise;
+ init(): Promise;
stepValue(value: number): number;
onSingleLineTap(e: WechatMiniprogram.TouchEvent): void;
getSingleChangeValue(e: WechatMiniprogram.TouchEvent): number;
convertPosToValue(posValue: number, dir: 0 | 1): number;
onLineTap(e: WechatMiniprogram.TouchEvent): void;
+ onTouchStart(e: WechatMiniprogram.TouchEvent): void;
onTouchMoveLeft(e: WechatMiniprogram.TouchEvent): void;
onTouchMoveRight(e: WechatMiniprogram.TouchEvent): void;
setLineStyle(left: number, right: number): void;
- onTouchEnd(): void;
+ onTouchEnd(e: WechatMiniprogram.TouchEvent): void;
+ getPagePosition(touch: any): any;
}
export {};
diff --git a/miniprogram_npm/tdesign-miniprogram/slider/slider.js b/miniprogram_npm/tdesign-miniprogram/slider/slider.js
index d75eee5..65e1e5a 100644
--- a/miniprogram_npm/tdesign-miniprogram/slider/slider.js
+++ b/miniprogram_npm/tdesign-miniprogram/slider/slider.js
@@ -31,6 +31,9 @@ let Slider = class Slider extends SuperComponent {
`${prefix}-class-bar-disabled`,
`${prefix}-class-cursor`,
];
+ this.options = {
+ pureDataPattern: /^__/,
+ };
this.properties = props;
this.controlledProps = [
{
@@ -56,38 +59,19 @@ let Slider = class Slider extends SuperComponent {
scaleTextArray: [],
prefix,
isVisibleToScreenReader: false,
+ identifier: [-1, -1],
+ __inited: false,
};
this.observers = {
value(newValue) {
this.handlePropsChange(newValue);
},
_value(newValue) {
- const { min, max, range } = this.properties;
- const { maxRange } = this.data;
- if (range) {
- const left = (maxRange * (newValue[0] - Number(min))) / (Number(max) - Number(min));
- const right = (maxRange * (Number(max) - newValue[1])) / (Number(max) - Number(min));
- this.setLineStyle(left, right);
- }
- else {
- this.setSingleBarWidth(newValue);
- }
- this.setData({
- isVisibleToScreenReader: true,
- });
- setTimeout(() => {
- this.setData({
- isVisibleToScreenReader: false,
- });
- }, 2e3);
+ this.bus.on('initial', () => this.renderLine(newValue));
+ this.toggleA11yTips();
},
marks(val) {
- if (this.data.initialLeft != null) {
- this.handleMask(val);
- }
- else {
- this.bus.on('initial', () => this.handleMask(val));
- }
+ this.bus.on('initial', () => this.handleMark(val));
},
};
this.lifetimes = {
@@ -98,11 +82,58 @@ let Slider = class Slider extends SuperComponent {
const { value } = this.properties;
if (!value)
this.handlePropsChange(0);
- this.getInitialStyle();
+ this.init();
+ this.injectPageScroll();
},
};
}
+ injectPageScroll() {
+ const { range, vertical } = this.properties;
+ if (!range || !vertical)
+ return;
+ const pages = getCurrentPages() || [];
+ let curPage = null;
+ if (pages && pages.length - 1 >= 0) {
+ curPage = pages[pages.length - 1];
+ }
+ if (!curPage)
+ return;
+ const originPageScroll = curPage === null || curPage === void 0 ? void 0 : curPage.onPageScroll;
+ curPage.onPageScroll = (rest) => {
+ originPageScroll === null || originPageScroll === void 0 ? void 0 : originPageScroll.call(this, rest);
+ this.observerScrollTop(rest);
+ };
+ }
+ observerScrollTop(rest) {
+ const { scrollTop } = rest || {};
+ this.pageScrollTop = scrollTop;
+ }
+ toggleA11yTips() {
+ this.setData({
+ isVisibleToScreenReader: true,
+ });
+ setTimeout(() => {
+ this.setData({
+ isVisibleToScreenReader: false,
+ });
+ }, 2000);
+ }
+ renderLine(val) {
+ const { min, max, range } = this.properties;
+ const { maxRange } = this.data;
+ if (range) {
+ const left = (maxRange * (val[0] - Number(min))) / (Number(max) - Number(min));
+ const right = (maxRange * (Number(max) - val[1])) / (Number(max) - Number(min));
+ this.setLineStyle(left, right);
+ }
+ else {
+ this.setSingleBarWidth(val);
+ }
+ }
triggerValue(value) {
+ if (this.preval === value)
+ return;
+ this.preval = value;
this._trigger('change', {
value: trimValue(value, this.properties),
});
@@ -115,19 +146,19 @@ let Slider = class Slider extends SuperComponent {
});
};
if (this.data.maxRange === 0) {
- this.getInitialStyle().then(setValueAndTrigger);
+ this.init().then(setValueAndTrigger);
return;
}
setValueAndTrigger();
}
- handleMask(marks) {
+ handleMark(marks) {
const calcPos = (arr) => {
- const { theme } = this.properties;
+ const { max, theme } = this.properties;
const { blockSize, maxRange } = this.data;
const margin = theme === 'capsule' ? blockSize / 2 : 0;
return arr.map((item) => ({
val: item,
- left: Math.round((item / 100) * maxRange) + margin,
+ left: Math.round((item / Number(max)) * maxRange) + margin,
}));
};
if ((marks === null || marks === void 0 ? void 0 : marks.length) && Array.isArray(marks)) {
@@ -157,15 +188,20 @@ let Slider = class Slider extends SuperComponent {
lineBarWidth: `${width}px`,
});
}
- getInitialStyle() {
+ init() {
return __awaiter(this, void 0, void 0, function* () {
+ if (this.data.__inited)
+ return;
const line = yield getRect(this, '#sliderLine');
const { blockSize } = this.data;
- const { theme } = this.properties;
+ const { theme, vertical } = this.properties;
const halfBlock = Number(blockSize) / 2;
- let maxRange = line.right - line.left;
- let initialLeft = line.left;
- let initialRight = line.right;
+ const { top, bottom, right, left } = line;
+ let maxRange = vertical ? bottom - top : right - left;
+ let initialLeft = vertical ? top : left;
+ let initialRight = vertical ? bottom : right;
+ if (initialLeft === 0 && initialRight === 0)
+ return;
if (theme === 'capsule') {
maxRange = maxRange - Number(blockSize) - 6;
initialLeft -= halfBlock;
@@ -175,30 +211,49 @@ let Slider = class Slider extends SuperComponent {
maxRange,
initialLeft,
initialRight,
+ __inited: true,
});
this.bus.emit('initial');
});
}
stepValue(value) {
const { step, min, max } = this.properties;
- if (Number(step) < 1 || Number(step) > Number(max) - Number(min))
- return value;
- const closestStep = trimSingleValue(Math.round(value / Number(step)) * Number(step), Number(min), Number(max));
+ const decimal = String(step).indexOf('.') > -1 ? String(step).length - String(step).indexOf('.') - 1 : 0;
+ const closestStep = trimSingleValue(Number((Math.round(value / Number(step)) * Number(step)).toFixed(decimal)), Number(min), Number(max));
return closestStep;
}
onSingleLineTap(e) {
const { disabled } = this.properties;
if (disabled)
return;
+ const isSingleLineTap = this.data.identifier[0] === -1;
+ if (isSingleLineTap) {
+ const [touch] = e.changedTouches;
+ this.data.identifier[0] = touch.identifier;
+ }
const value = this.getSingleChangeValue(e);
+ if (isSingleLineTap) {
+ this.data.identifier[0] = -1;
+ }
this.triggerValue(value);
}
getSingleChangeValue(e) {
- const { min, max } = this.properties;
- const { initialLeft, maxRange } = this.data;
- const [touch] = e.changedTouches;
- const { pageX } = touch;
- const currentLeft = pageX - initialLeft;
+ const { min, max, theme, vertical } = this.properties;
+ const { initialLeft, maxRange, blockSize } = this.data;
+ const touch = e.changedTouches.find((item) => item.identifier === this.data.identifier[0]);
+ const pagePosition = this.getPagePosition(touch);
+ let offset = 0;
+ if (theme === 'capsule') {
+ offset = Number(blockSize);
+ if (vertical) {
+ offset *= 2;
+ }
+ offset += 6;
+ }
+ else if (vertical) {
+ offset = Number(blockSize);
+ }
+ const currentLeft = pagePosition - initialLeft - offset;
let value = 0;
if (currentLeft <= 0) {
value = Number(min);
@@ -207,7 +262,7 @@ let Slider = class Slider extends SuperComponent {
value = Number(max);
}
else {
- value = Math.round((currentLeft / maxRange) * (Number(max) - Number(min)) + Number(min));
+ value = (currentLeft / maxRange) * (Number(max) - Number(min)) + Number(min);
}
return this.stepValue(value);
}
@@ -219,53 +274,92 @@ let Slider = class Slider extends SuperComponent {
: Number(max) - (posValue / maxRange) * (Number(max) - Number(min));
}
onLineTap(e) {
- const { disabled, theme } = this.properties;
+ const { disabled, theme, vertical } = this.properties;
const { initialLeft, initialRight, maxRange, blockSize } = this.data;
if (disabled)
return;
const [touch] = e.changedTouches;
- const { pageX } = touch;
+ const pagePosition = this.getPagePosition(touch);
const halfBlock = theme === 'capsule' ? Number(blockSize) / 2 : 0;
- const currentLeft = pageX - initialLeft;
- if (currentLeft < 0 || currentLeft > maxRange + Number(blockSize))
+ const currentLeft = pagePosition - initialLeft;
+ const currentRight = -(pagePosition - initialRight);
+ if (currentLeft < 0 || currentRight > maxRange + Number(blockSize))
return;
Promise.all([getRect(this, '#leftDot'), getRect(this, '#rightDot')]).then(([leftDot, rightDot]) => {
- const distanceLeft = Math.abs(pageX - leftDot.left - halfBlock);
- const distanceRight = Math.abs(rightDot.left - pageX + halfBlock);
+ const pageScrollTop = this.pageScrollTop || 0;
+ const leftDotPosition = vertical ? leftDot.top + pageScrollTop : leftDot.left;
+ const distanceLeft = Math.abs(pagePosition - leftDotPosition - halfBlock);
+ const rightDotPosition = vertical ? rightDot.top + pageScrollTop : rightDot.left;
+ const distanceRight = Math.abs(rightDotPosition - pagePosition + halfBlock);
const isMoveLeft = distanceLeft < distanceRight;
+ let offset = 0;
+ if (theme === 'capsule') {
+ offset = Number(blockSize);
+ if (vertical) {
+ offset *= 2;
+ }
+ offset += 6;
+ }
+ else if (vertical) {
+ offset = Number(blockSize);
+ }
if (isMoveLeft) {
- const left = pageX - initialLeft;
+ const left = pagePosition - initialLeft - offset;
const leftValue = this.convertPosToValue(left, 0);
this.triggerValue([this.stepValue(leftValue), this.data._value[1]]);
}
else {
- const right = -(pageX - initialRight);
+ let right = -(pagePosition - initialRight);
+ if (vertical) {
+ right += offset / 2;
+ }
const rightValue = this.convertPosToValue(right, 1);
this.triggerValue([this.data._value[0], this.stepValue(rightValue)]);
}
});
}
+ onTouchStart(e) {
+ this.triggerEvent('dragstart', { e });
+ const [touch] = e.changedTouches;
+ if (e.currentTarget.id === 'rightDot') {
+ this.data.identifier[1] = touch.identifier;
+ }
+ else {
+ this.data.identifier[0] = touch.identifier;
+ }
+ }
onTouchMoveLeft(e) {
- const { disabled } = this.properties;
- const { initialLeft, _value } = this.data;
+ const { disabled, theme, vertical } = this.properties;
+ const { initialLeft, _value, blockSize } = this.data;
if (disabled)
return;
- const [touch] = e.changedTouches;
- const { pageX } = touch;
- const currentLeft = pageX - initialLeft;
+ const touch = e.changedTouches.find((item) => item.identifier === this.data.identifier[0]);
+ const pagePosition = this.getPagePosition(touch);
+ let offset = 0;
+ if (theme === 'capsule') {
+ offset += Number(blockSize);
+ }
+ if (vertical) {
+ offset += Number(blockSize) + 6;
+ }
+ const currentLeft = pagePosition - initialLeft - offset;
const newData = [..._value];
const leftValue = this.convertPosToValue(currentLeft, 0);
newData[0] = this.stepValue(leftValue);
this.triggerValue(newData);
}
onTouchMoveRight(e) {
- const { disabled } = this.properties;
- const { initialRight, _value } = this.data;
+ const { disabled, vertical } = this.properties;
+ const { initialRight, _value, blockSize } = this.data;
if (disabled)
return;
- const [touch] = e.changedTouches;
- const { pageX } = touch;
- const currentRight = -(pageX - initialRight);
+ const touch = e.changedTouches.find((item) => item.identifier === this.data.identifier[1]);
+ const pagePosition = this.getPagePosition(touch);
+ let offset = 0;
+ if (vertical) {
+ offset += Number(blockSize) / 2 + 6;
+ }
+ const currentRight = -(pagePosition - initialRight - offset);
const newData = [..._value];
const rightValue = this.convertPosToValue(currentRight, 1);
newData[1] = this.stepValue(rightValue);
@@ -293,7 +387,20 @@ let Slider = class Slider extends SuperComponent {
});
}
}
- onTouchEnd() { }
+ onTouchEnd(e) {
+ this.triggerEvent('dragend', { e, value: this.data._value });
+ if (e.currentTarget.id === 'rightDot') {
+ this.data.identifier[1] = -1;
+ }
+ else {
+ this.data.identifier[0] = -1;
+ }
+ }
+ getPagePosition(touch) {
+ const { pageX, pageY } = touch;
+ const { vertical } = this.properties;
+ return vertical ? pageY : pageX;
+ }
};
Slider = __decorate([
wxComponent()
diff --git a/miniprogram_npm/tdesign-miniprogram/slider/slider.json b/miniprogram_npm/tdesign-miniprogram/slider/slider.json
index a89ef4d..4f0a3f0 100644
--- a/miniprogram_npm/tdesign-miniprogram/slider/slider.json
+++ b/miniprogram_npm/tdesign-miniprogram/slider/slider.json
@@ -1,4 +1,5 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/slider/slider.wxml b/miniprogram_npm/tdesign-miniprogram/slider/slider.wxml
index cd73127..8658f19 100644
--- a/miniprogram_npm/tdesign-miniprogram/slider/slider.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/slider/slider.wxml
@@ -3,7 +3,7 @@
@@ -19,24 +19,25 @@
class="{{_.cls(classPrefix + '__scale-item', [['active', _value >= item.val], ['disabled', disabled], theme, ['hidden', (index == 0 || index == scaleArray.length - 1) && theme == 'capsule' || value == item.val]])}}"
wx:for="{{scaleArray}}"
wx:key="index"
- style="left:{{item.left}}px; transform: translateX(-50%);"
+ style="{{vertical ? 'top' : 'left'}}:{{item.left}}px; {{vertical ? 'transform: translate(-50%, -50%);' : 'transform: translateX(-50%);'}}"
aria-hidden="{{true}}"
>
-
+
{{scaleTextArray[index]}}
{
- if (typeof value !== 'number') {
- return min;
- }
if (value < min) {
return min;
}
diff --git a/miniprogram_npm/tdesign-miniprogram/slider/type.d.ts b/miniprogram_npm/tdesign-miniprogram/slider/type.d.ts
index 2d7ef24..099ed6c 100644
--- a/miniprogram_npm/tdesign-miniprogram/slider/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/slider/type.d.ts
@@ -1,16 +1,8 @@
export interface TdSliderProps {
- style?: {
- type: StringConstructor;
- value?: string;
- };
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-bar', 't-class-bar-active', 't-class-bar-disabled', 't-class-cursor'];
- };
label?: {
type: null;
value?: string | boolean;
@@ -51,5 +43,9 @@ export interface TdSliderProps {
type: null;
value?: SliderValue;
};
+ vertical?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
}
export declare type SliderValue = number | Array;
diff --git a/miniprogram_npm/tdesign-miniprogram/step-item/props.js b/miniprogram_npm/tdesign-miniprogram/step-item/props.js
index 3308e91..87c1af0 100644
--- a/miniprogram_npm/tdesign-miniprogram/step-item/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/step-item/props.js
@@ -3,9 +3,6 @@ const props = {
type: String,
value: '',
},
- externalClasses: {
- type: Array,
- },
icon: {
type: String,
},
@@ -13,10 +10,6 @@ const props = {
type: String,
value: 'default',
},
- subStepItems: {
- type: Array,
- value: [],
- },
title: {
type: String,
value: '',
diff --git a/miniprogram_npm/tdesign-miniprogram/step-item/step-item.d.ts b/miniprogram_npm/tdesign-miniprogram/step-item/step-item.d.ts
index b1b81b7..c2f2ecc 100644
--- a/miniprogram_npm/tdesign-miniprogram/step-item/step-item.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/step-item/step-item.d.ts
@@ -14,9 +14,21 @@ export default class StepItem extends SuperComponent {
curStatus: string;
layout: string;
isLastChild: boolean;
+ sequence: string;
+ };
+ observers: {
+ status(value: any): void;
};
methods: {
- updateStatus(current: any, currentStatus: any, index: any, theme: any, layout: any, steps: any): void;
+ updateStatus({ current, currentStatus, index, theme, layout, items, sequence }: {
+ current: any;
+ currentStatus: any;
+ index: any;
+ theme: any;
+ layout: any;
+ items: any;
+ sequence: any;
+ }): void;
onTap(): void;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/step-item/step-item.js b/miniprogram_npm/tdesign-miniprogram/step-item/step-item.js
index 54b0744..71914b1 100644
--- a/miniprogram_npm/tdesign-miniprogram/step-item/step-item.js
+++ b/miniprogram_npm/tdesign-miniprogram/step-item/step-item.js
@@ -36,9 +36,18 @@ let StepItem = class StepItem extends SuperComponent {
curStatus: '',
layout: 'vertical',
isLastChild: false,
+ sequence: 'positive',
+ };
+ this.observers = {
+ status(value) {
+ const { curStatus } = this.data;
+ if (curStatus === '' || value === curStatus)
+ return;
+ this.setData({ curStatus: value });
+ },
};
this.methods = {
- updateStatus(current, currentStatus, index, theme, layout, steps) {
+ updateStatus({ current, currentStatus, index, theme, layout, items, sequence }) {
let curStatus = this.data.status;
if (curStatus === 'default') {
if (index < Number(current)) {
@@ -54,7 +63,8 @@ let StepItem = class StepItem extends SuperComponent {
isDot: theme === 'dot',
layout,
theme,
- isLastChild: steps.length - 1 === index,
+ sequence,
+ isLastChild: index === (sequence === 'positive' ? items.length - 1 : 0),
});
},
onTap() {
diff --git a/miniprogram_npm/tdesign-miniprogram/step-item/step-item.json b/miniprogram_npm/tdesign-miniprogram/step-item/step-item.json
index 049940c..f783dae 100644
--- a/miniprogram_npm/tdesign-miniprogram/step-item/step-item.json
+++ b/miniprogram_npm/tdesign-miniprogram/step-item/step-item.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/step-item/step-item.wxml b/miniprogram_npm/tdesign-miniprogram/step-item/step-item.wxml
index aaeec46..093bdce 100644
--- a/miniprogram_npm/tdesign-miniprogram/step-item/step-item.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/step-item/step-item.wxml
@@ -1,16 +1,20 @@
+
-
+
-
-
+
+
@@ -20,7 +24,10 @@
-
+
{{ title }}
@@ -36,5 +43,9 @@
-
+
diff --git a/miniprogram_npm/tdesign-miniprogram/step-item/step-item.wxs b/miniprogram_npm/tdesign-miniprogram/step-item/step-item.wxs
new file mode 100644
index 0000000..491902c
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/step-item/step-item.wxs
@@ -0,0 +1,7 @@
+function getAriaLabel(index, title, content) {
+ return '第' + (index + 1) + '步,' + title + ',' + content;
+}
+
+module.exports = {
+ getAriaLabel: getAriaLabel,
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/step-item/step-item.wxss b/miniprogram_npm/tdesign-miniprogram/step-item/step-item.wxss
index eec5828..d570736 100644
--- a/miniprogram_npm/tdesign-miniprogram/step-item/step-item.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/step-item/step-item.wxss
@@ -32,20 +32,21 @@
display: flex;
}
.t-steps-item__circle--default {
- color: var(--td-step-item-default-circle-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-step-item-default-circle-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
background-color: var(--td-step-item-default-circle-bg, var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3)));
}
.t-steps-item__title--default {
- color: var(--td-step-item-default-title-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-step-item-default-title-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
}
.t-steps-item__icon--default {
- color: var(--td-step-item-default-icon-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-step-item-default-icon-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
}
.t-steps-item__dot--default {
border-color: var(--td-step-item-default-dot-border-color, var(--td-component-border, var(--td-gray-color-4, #dcdcdc)));
+ background-color: var(--td-step-item-default-dot-border-color, var(--td-component-border, var(--td-gray-color-4, #dcdcdc)));
}
.t-steps-item__circle--process {
- color: var(--td-step-item-process-circle-color, var(--td-font-white-1, #ffffff));
+ color: var(--td-step-item-process-circle-color, var(--td-text-color-anti, var(--td-font-white-1, #ffffff)));
background-color: var(--td-step-item-process-circle-bg, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
}
.t-steps-item__title--process {
@@ -56,19 +57,21 @@
}
.t-steps-item__dot--process {
border-color: var(--td-step-item-process-dot-border-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
+ background-color: var(--td-step-item-process-dot-border-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
}
.t-steps-item__circle--finish {
color: var(--td-step-item-finish-circle-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
background-color: var(--td-step-item-finish-circle-bg, var(--td-brand-color-light, var(--td-primary-color-1, #f2f3ff)));
}
.t-steps-item__title--finish {
- color: var(--td-step-item-finish-title-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-step-item-finish-title-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-steps-item__icon--finish {
color: var(--td-step-item-finish-icon-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
}
.t-steps-item__dot--finish {
border-color: var(--td-step-item-finish-dot-border-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
+ background-color: var(--td-step-item-finish-dot-border-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
}
.t-steps-item__circle--error {
color: var(--td-step-item-error-circle-color, var(--td-error-color, var(--td-error-color-6, #d54941)));
@@ -82,6 +85,7 @@
}
.t-steps-item__dot--error {
border-color: var(--td-step-item-error-dot-border-color, var(--td-error-color, var(--td-error-color-6, #d54941)));
+ background-color: var(--td-step-item-error-dot-border-color, var(--td-error-color, var(--td-error-color-6, #d54941)));
}
.t-steps-item--horizontal {
flex-direction: column;
@@ -113,10 +117,6 @@
font-size: var(--td-font-size-base, 28rpx);
position: relative;
}
-.t-steps-item__icon--finsh,
-.t-steps-item__icon--process {
- color: var(--td-brand-color, var(--td-primary-color-7, #0052d9));
-}
.t-steps-item__dot {
width: var(--td-step-item-dot-size, 16rpx);
height: var(--td-step-item-dot-size, 16rpx);
@@ -125,12 +125,6 @@
border-style: solid;
box-sizing: border-box;
}
-.t-steps-item__dot--finish {
- background-color: var(--td-step-item-process-dot-border-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
-}
-.t-steps-item__dot--error {
- background-color: var(--td-step-item-error-dot-border-color, var(--td-error-color, var(--td-error-color-6, #d54941)));
-}
.t-steps-item__content {
text-align: center;
}
@@ -162,7 +156,7 @@
margin-bottom: 8rpx;
}
.t-steps-item__description {
- color: var(--td-step-item-descrition-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-step-item-description-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
line-height: 40rpx;
font-size: var(--td-font-size-s, 24rpx);
}
@@ -188,7 +182,8 @@
.t-steps-item__line--horizontal.t-steps-item__line--dot {
top: calc(var(--td-step-item-dot-size, 16rpx) / 2);
}
-.t-steps-item__line--finish {
+.t-steps-item__line--finish,
+.t-steps-item__line--reverse.t-steps-item__line--process {
background-color: var(--td-step-item-finish-line-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
}
.t-steps-item__line--vertical {
diff --git a/miniprogram_npm/tdesign-miniprogram/step-item/type.d.ts b/miniprogram_npm/tdesign-miniprogram/step-item/type.d.ts
index c9029fb..ca5e4b4 100644
--- a/miniprogram_npm/tdesign-miniprogram/step-item/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/step-item/type.d.ts
@@ -3,10 +3,6 @@ export interface TdStepItemProps {
type: StringConstructor;
value?: string;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class', 't-class-content', 't-class-title', 't-class-description', 't-class-extra'];
- };
icon?: {
type: StringConstructor;
value?: string;
@@ -15,21 +11,9 @@ export interface TdStepItemProps {
type: StringConstructor;
value?: StepStatus;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
- subStepItems?: {
- type: ArrayConstructor;
- value?: SubStepItem[];
- };
title?: {
type: StringConstructor;
value?: string;
};
}
export declare type StepStatus = 'default' | 'process' | 'finish' | 'error';
-export interface SubStepItem {
- status: StepStatus;
- title: string;
-}
diff --git a/miniprogram_npm/tdesign-miniprogram/stepper/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/stepper/README.en-US.md
index 1529485..8c7326f 100644
--- a/miniprogram_npm/tdesign-miniprogram/stepper/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/stepper/README.en-US.md
@@ -6,14 +6,17 @@
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
disable-input | Boolean | false | \- | N
-disabled | Boolean | false | \- | N
-external-classes | Array | - | `['t-class', 't-class-input', 't-class-add', 't-class-minus']` | N
+disabled | Boolean | undefined | \- | N
input-width | Number | - | \- | N
+integer | Boolean | true | \- | N
max | Number | 100 | \- | N
min | Number | 0 | \- | N
+size | String | medium | options: small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
step | Number | 1 | \- | N
-theme | String | normal | stylish。options:normal/grey | N
+theme | String | normal | stylish。options: normal/filled/outline | N
value | String / Number | 0 | \- | N
default-value | String / Number | undefined | uncontrolled property | N
@@ -24,3 +27,22 @@ name | params | description
blur | `({ type: string \| number })` | \-
change | `({ value: string \| number })` | \-
overlimit | `({type: 'minus' \| 'plus'})` | \-
+
+### Stepper External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-input | \-
+t-class-minus | \-
+t-class-plus | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-stepper-border-color | @component-border | -
+--td-stepper-border-radius | @radius-small | -
+--td-stepper-input-color | @font-gray-1 | -
+--td-stepper-input-disabled-color | @font-gray-4 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/stepper/README.md b/miniprogram_npm/tdesign-miniprogram/stepper/README.md
index 903d9c0..c6ed54c 100644
--- a/miniprogram_npm/tdesign-miniprogram/stepper/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/stepper/README.md
@@ -18,6 +18,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
基础步进器
@@ -46,18 +52,21 @@ isComponent: true
## API
+
### Stepper Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
disable-input | Boolean | false | 禁用输入框 | N
-disabled | Boolean | false | 禁用全部操作 | N
-external-classes | Array | - | 组件类名,分别用于表示组件外层元素、输入框、右侧递增号、左侧递减号等元素类名。`['t-class', 't-class-input', 't-class-add', 't-class-minus']` | N
+disabled | Boolean | undefined | 禁用全部操作 | N
input-width | Number | - | 输入框宽度,默认单位 `px` | N
+integer | Boolean | true | 是否整型 | N
max | Number | 100 | 最大值 | N
min | Number | 0 | 最小值 | N
+size | String | medium | 组件尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
step | Number | 1 | 步长 | N
-size | String | medium | 组件尺寸。可选项:small/medium/large。TS 类型:`SizeEnum` | N
theme | String | normal | 组件风格。可选项:normal/filled/outline | N
value | String / Number | 0 | 值 | N
default-value | String / Number | undefined | 值。非受控属性 | N
@@ -69,3 +78,22 @@ default-value | String / Number | undefined | 值。非受控属性 | N
blur | `({ type: string \| number })` | 输入框失去焦点时触发
change | `({ value: string \| number })` | 数值发生变更时触发
overlimit | `({type: 'minus' \| 'plus'})` | 数值超出限制时触发
+
+### Stepper External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-input | 输入框样式类
+t-class-minus | 左侧递减号样式类
+t-class-plus | 右侧递增号样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-stepper-border-color | @component-border | -
+--td-stepper-border-radius | @radius-small | -
+--td-stepper-input-color | @font-gray-1 | -
+--td-stepper-input-disabled-color | @font-gray-4 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/stepper/props.js b/miniprogram_npm/tdesign-miniprogram/stepper/props.js
index 9a970fe..e4a9351 100644
--- a/miniprogram_npm/tdesign-miniprogram/stepper/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/stepper/props.js
@@ -4,8 +4,8 @@ const props = {
value: false,
},
disabled: {
- type: Boolean,
- value: false,
+ type: null,
+ value: undefined,
},
externalClasses: {
type: Array,
@@ -13,6 +13,10 @@ const props = {
inputWidth: {
type: Number,
},
+ integer: {
+ type: Boolean,
+ value: true,
+ },
max: {
type: Number,
value: 100,
@@ -21,26 +25,24 @@ const props = {
type: Number,
value: 0,
},
- step: {
- type: Number,
- value: 1,
- },
size: {
type: String,
value: 'medium',
},
+ step: {
+ type: Number,
+ value: 1,
+ },
theme: {
type: String,
value: 'normal',
},
value: {
- type: String,
- optionalTypes: [Number],
+ type: null,
value: null,
},
defaultValue: {
- type: String,
- optionalTypes: [Number],
+ type: null,
value: 0,
},
};
diff --git a/miniprogram_npm/tdesign-miniprogram/stepper/stepper.d.ts b/miniprogram_npm/tdesign-miniprogram/stepper/stepper.d.ts
index 65aad00..511e0b4 100644
--- a/miniprogram_npm/tdesign-miniprogram/stepper/stepper.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/stepper/stepper.d.ts
@@ -1,14 +1,7 @@
import { SuperComponent } from '../common/src/index';
export default class Stepper extends SuperComponent {
externalClasses: string[];
- options: {
- addGlobalClass: boolean;
- };
properties: {
- style?: {
- type: StringConstructor;
- value?: string;
- };
disableInput?: {
type: BooleanConstructor;
value?: boolean;
@@ -25,6 +18,10 @@ export default class Stepper extends SuperComponent {
type: NumberConstructor;
value?: number;
};
+ integer?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
max?: {
type: NumberConstructor;
value?: number;
@@ -33,26 +30,24 @@ export default class Stepper extends SuperComponent {
type: NumberConstructor;
value?: number;
};
+ size?: {
+ type: StringConstructor;
+ value?: import("../common/common").SizeEnum;
+ };
step?: {
type: NumberConstructor;
value?: number;
};
- size?: {
- type: StringConstructor;
- value?: string;
- };
theme?: {
type: StringConstructor;
- value?: "outline" | "normal" | "filled";
+ value?: "outline" | "filled" | "normal";
};
value?: {
- type: StringConstructor;
- optionalTypes: NumberConstructor[];
+ type: null;
value?: string | number;
};
defaultValue?: {
- type: StringConstructor;
- optionalTypes: NumberConstructor[];
+ type: null;
value?: string | number;
};
};
@@ -68,14 +63,20 @@ export default class Stepper extends SuperComponent {
classPrefix: string;
prefix: string;
};
- attached(): void;
- isDisabled(type: any): boolean;
- format(value: any): number;
- setValue(value: any): void;
- minusValue(): boolean;
- plusValue(): boolean;
- changeValue(e: any): string | 0;
- focusHandle(e: any): void;
- inputHandle(e: any): void;
- blurHandle(e: any): void;
+ lifetimes: {
+ attached(): void;
+ };
+ methods: {
+ isDisabled(type: any): boolean;
+ getLen(num: number): number;
+ add(a: number, b: number): number;
+ format(value: any): string;
+ setValue(value: any): void;
+ minusValue(): boolean;
+ plusValue(): boolean;
+ filterIllegalChar(value: string | number): string;
+ handleFocus(e: any): void;
+ handleInput(e: any): void;
+ handleBlur(e: any): void;
+ };
}
diff --git a/miniprogram_npm/tdesign-miniprogram/stepper/stepper.js b/miniprogram_npm/tdesign-miniprogram/stepper/stepper.js
index 1c3c167..0aa3447 100644
--- a/miniprogram_npm/tdesign-miniprogram/stepper/stepper.js
+++ b/miniprogram_npm/tdesign-miniprogram/stepper/stepper.js
@@ -13,9 +13,6 @@ let Stepper = class Stepper extends SuperComponent {
constructor() {
super(...arguments);
this.externalClasses = [`${prefix}-class`, `${prefix}-class-input`, `${prefix}-class-minus`, `${prefix}-class-plus`];
- this.options = {
- addGlobalClass: true,
- };
this.properties = Object.assign({}, props);
this.controlledProps = [
{
@@ -25,8 +22,9 @@ let Stepper = class Stepper extends SuperComponent {
];
this.observers = {
value(v) {
+ this.preValue = Number(v);
this.setData({
- currentValue: Number(v),
+ currentValue: this.format(Number(v)),
});
},
};
@@ -35,68 +33,99 @@ let Stepper = class Stepper extends SuperComponent {
classPrefix: name,
prefix,
};
- }
- attached() {
- const { value, min } = this.properties;
- this.setData({
- currentValue: value ? Number(value) : min,
- });
- }
- isDisabled(type) {
- const { min, max, disabled } = this.properties;
- const { currentValue } = this.data;
- if (disabled) {
- return true;
- }
- if (type === 'minus' && currentValue <= min) {
- return true;
- }
- if (type === 'plus' && currentValue >= max) {
- return true;
- }
- return false;
- }
- format(value) {
- const { min, max } = this.properties;
- return Math.max(Math.min(max, value, Number.MAX_SAFE_INTEGER), min, Number.MIN_SAFE_INTEGER);
- }
- setValue(value) {
- this._trigger('change', { value });
- }
- minusValue() {
- if (this.isDisabled('minus')) {
- this.triggerEvent('overlimit', { type: 'minus' });
- return false;
- }
- const { currentValue, step } = this.data;
- this.setValue(this.format(currentValue - step));
- }
- plusValue() {
- if (this.isDisabled('plus')) {
- this.triggerEvent('overlimit', { type: 'plus' });
- return false;
- }
- const { currentValue, step } = this.data;
- this.setValue(this.format(currentValue + step));
- }
- changeValue(e) {
- const value = String(e.detail.value)
- .split('.')[0]
- .replace(/[^-0-9]/g, '') || 0;
- this.setValue(this.format(Number(value)));
- return value;
- }
- focusHandle(e) {
- const value = this.changeValue(e);
- this.triggerEvent('focus', { value });
- }
- inputHandle(e) {
- const value = this.changeValue(e);
- this.triggerEvent('input', { value });
- }
- blurHandle(e) {
- const value = this.changeValue(e);
- this.triggerEvent('blur', { value });
+ this.lifetimes = {
+ attached() {
+ const { value, min } = this.properties;
+ this.setData({
+ currentValue: value ? Number(value) : min,
+ });
+ },
+ };
+ this.methods = {
+ isDisabled(type) {
+ const { min, max, disabled } = this.properties;
+ const { currentValue } = this.data;
+ if (disabled) {
+ return true;
+ }
+ if (type === 'minus' && currentValue <= min) {
+ return true;
+ }
+ if (type === 'plus' && currentValue >= max) {
+ return true;
+ }
+ return false;
+ },
+ getLen(num) {
+ const numStr = num.toString();
+ return numStr.indexOf('.') === -1 ? 0 : numStr.split('.')[1].length;
+ },
+ add(a, b) {
+ const maxLen = Math.max(this.getLen(a), this.getLen(b));
+ const base = Math.pow(10, maxLen);
+ return Math.round(a * base + b * base) / base;
+ },
+ format(value) {
+ const { min, max, step } = this.properties;
+ const len = Math.max(this.getLen(step), this.getLen(value));
+ return Math.max(Math.min(max, value, Number.MAX_SAFE_INTEGER), min, Number.MIN_SAFE_INTEGER).toFixed(len);
+ },
+ setValue(value) {
+ value = this.format(value);
+ if (this.preValue === value)
+ return;
+ this.preValue = value;
+ this._trigger('change', { value: Number(value) });
+ },
+ minusValue() {
+ if (this.isDisabled('minus')) {
+ this.triggerEvent('overlimit', { type: 'minus' });
+ return false;
+ }
+ const { currentValue, step } = this.data;
+ this.setValue(this.add(currentValue, -step));
+ },
+ plusValue() {
+ if (this.isDisabled('plus')) {
+ this.triggerEvent('overlimit', { type: 'plus' });
+ return false;
+ }
+ const { currentValue, step } = this.data;
+ this.setValue(this.add(currentValue, step));
+ },
+ filterIllegalChar(value) {
+ const v = String(value).replace(/[^0-9.]/g, '');
+ const indexOfDot = v.indexOf('.');
+ if (this.properties.integer && indexOfDot !== -1) {
+ return v.split('.')[0];
+ }
+ if (!this.properties.integer && indexOfDot !== -1 && indexOfDot !== v.lastIndexOf('.')) {
+ return v.split('.', 2).join('.');
+ }
+ return v;
+ },
+ handleFocus(e) {
+ const { value } = e.detail;
+ this.triggerEvent('focus', { value });
+ },
+ handleInput(e) {
+ const { value } = e.detail;
+ if (value === '') {
+ return;
+ }
+ const formatted = this.filterIllegalChar(value);
+ this.setData({
+ currentValue: formatted,
+ });
+ this.triggerEvent('input', { value: formatted });
+ },
+ handleBlur(e) {
+ const { value: rawValue } = e.detail;
+ const value = this.format(rawValue);
+ this.setValue(value);
+ this.triggerEvent('blur', { value });
+ },
+ };
}
};
Stepper = __decorate([
diff --git a/miniprogram_npm/tdesign-miniprogram/stepper/stepper.json b/miniprogram_npm/tdesign-miniprogram/stepper/stepper.json
index dfd59ed..a81bbaa 100644
--- a/miniprogram_npm/tdesign-miniprogram/stepper/stepper.json
+++ b/miniprogram_npm/tdesign-miniprogram/stepper/stepper.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-cell": "../cell/cell",
"t-icon": "../icon/icon"
diff --git a/miniprogram_npm/tdesign-miniprogram/stepper/stepper.wxml b/miniprogram_npm/tdesign-miniprogram/stepper/stepper.wxml
index 2e5dbfb..ec5770a 100644
--- a/miniprogram_npm/tdesign-miniprogram/stepper/stepper.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/stepper/stepper.wxml
@@ -13,16 +13,18 @@
>
-
+
;
+ type: null;
value?: string | number;
};
defaultValue?: {
- type: StringConstructor;
- optionalTypes: Array;
+ type: null;
value?: string | number;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/steps/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/steps/README.en-US.md
index 197f123..3e41273 100644
--- a/miniprogram_npm/tdesign-miniprogram/steps/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/steps/README.en-US.md
@@ -1,34 +1,82 @@
:: BASE_DOC ::
## API
+
### Steps Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
current | String / Number | - | \- | N
default-current | String / Number | undefined | uncontrolled property | N
-current-status | String | process | options:default/process/finish/error | N
-external-classes | Array | - | `['t-class']` | N
-layout | String | horizontal | options:horizontal/vertical | N
+current-status | String | process | options: default/process/finish/error | N
+layout | String | horizontal | options: horizontal/vertical | N
readonly | Boolean | false | \- | N
-separator | String | line | options:line/dashed/arrow | N
-style | String | - | \- | N
-theme | String | default | options:default/dot | N
+sequence | String | positive | options: positive/reverse | N
+theme | String | default | options: default/dot | N
### Steps Events
name | params | description
-- | -- | --
change | `({current: string \| number, previous: string \| number})` | \-
+### Steps External Classes
+
+className | Description
+-- | --
+t-class | \-
+
### StepItem Props
name | type | default | description | required
-- | -- | -- | -- | --
-content | String / Slot | '' | \- | N
-external-classes | Array | - | `['t-class', 't-class-content', 't-class-title', 't-class-description', 't-class-extra']` | N
-icon | String / Slot | - | \- | N
-status | String | default | options:default/process/finish/error。Typescript:`StepStatus` `type StepStatus = 'default' \| 'process' \| 'finish' \| 'error'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/step-item/type.ts) | N
-style | String | - | \- | N
-sub-step-items | Array | [] | Typescript:`SubStepItem[]` `interface SubStepItem { status: StepStatus, title: string }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/step-item/type.ts) | N
-title | String / Slot | '' | \- | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+content | String / Slot | '' | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+icon | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+status | String | default | options: default/process/finish/error。Typescript:`StepStatus` `type StepStatus = 'default' \| 'process' \| 'finish' \| 'error'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/step-item/type.ts) | N
+sub-step-items | Array | [] | `deprecated`。Typescript:`SubStepItem[]` `interface SubStepItem { status: StepStatus, title: string }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/step-item/type.ts) | N
+title | String / Slot | '' | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+### StepItem External Classes
+
+className | Description
+-- | --
+t-class | class name of root node
+t-class-content | \-
+t-class-description | \-
+t-class-extra | \-
+t-class-title | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-step-item-circle-font-size | 28rpx | -
+--td-step-item-circle-size | 44rpx | -
+--td-step-item-default-circle-bg | @bg-color-secondarycontainer | -
+--td-step-item-default-circle-color | @font-gray-3 | -
+--td-step-item-default-dot-border-color | @component-border | -
+--td-step-item-default-icon-color | @font-gray-3 | -
+--td-step-item-default-title-color | @font-gray-3 | -
+--td-step-item-description-color | @font-gray-3 | -
+--td-step-item-dot-size | 16rpx | -
+--td-step-item-error-circle-bg | @error-color-1 | -
+--td-step-item-error-circle-color | @error-color | -
+--td-step-item-error-dot-border-color | @error-color | -
+--td-step-item-error-icon-color | @error-color | -
+--td-step-item-error-title-color | @error-color | -
+--td-step-item-finish-circle-bg | @brand-color-light | -
+--td-step-item-finish-circle-color | @brand-color | -
+--td-step-item-finish-dot-border-color | @brand-color | -
+--td-step-item-finish-icon-color | @brand-color | -
+--td-step-item-finish-line-color | @brand-color | -
+--td-step-item-finish-title-color | @font-gray-1 | -
+--td-step-item-line-color | @component-border | -
+--td-step-item-process-circle-bg | @brand-color | -
+--td-step-item-process-circle-color | @font-white-1 | -
+--td-step-item-process-dot-border-color | @brand-color | -
+--td-step-item-process-icon-color | @brand-color | -
+--td-step-item-process-title-color | @brand-color | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/steps/README.md b/miniprogram_npm/tdesign-miniprogram/steps/README.md
index 9f852b8..af1525f 100644
--- a/miniprogram_npm/tdesign-miniprogram/steps/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/steps/README.md
@@ -21,6 +21,12 @@ isComponent: true
步骤条,方向可以横向和纵向,可以自定义步骤条显示内容以及是否可写
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
#### 水平步骤条
@@ -55,18 +61,19 @@ isComponent: true
{{ special }}
## API
+
### Steps Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
current | String / Number | - | 当前步骤,即整个步骤条进度。默认根据步骤下标判断步骤的完成状态,当前步骤为进行中,当前步骤之前的步骤为已完成,当前步骤之后的步骤为未开始。如果每个步骤没有设置 value,current 值为步骤长度则表示所有步骤已完成。如果每个步骤设置了自定义 value,则 current = 'FINISH' 表示所有状态完成 | N
default-current | String / Number | undefined | 当前步骤,即整个步骤条进度。默认根据步骤下标判断步骤的完成状态,当前步骤为进行中,当前步骤之前的步骤为已完成,当前步骤之后的步骤为未开始。如果每个步骤没有设置 value,current 值为步骤长度则表示所有步骤已完成。如果每个步骤设置了自定义 value,则 current = 'FINISH' 表示所有状态完成。非受控属性 | N
current-status | String | process | 用于控制 current 指向的步骤条的状态。可选项:default/process/finish/error | N
-external-classes | Array | - | 组件类名,用于设置组件外层元素元素类名。`['t-class']` | N
layout | String | horizontal | 步骤条方向,有两种:横向和纵向。可选项:horizontal/vertical | N
readonly | Boolean | false | 只读状态 | N
-separator | String | line | 步骤条分割符。可选项:line/dashed/arrow | N
-style | String | - | 自定义组件样式 | N
+sequence | String | positive | 步骤条顺序。可选项:positive/reverse | N
theme | String | default | 步骤条风格。可选项:default/dot | N
### Steps Events
@@ -74,15 +81,62 @@ theme | String | default | 步骤条风格。可选项:default/dot | N
名称 | 参数 | 描述
-- | -- | --
change | `({current: string \| number, previous: string \| number})` | 当前步骤发生变化时触发
+### Steps External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+
### StepItem Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-content | String / Slot | '' | 步骤描述 | N
-external-classes | Array | - | 组件类名,用于设置组件外层元素元素类名。`['t-class', 't-class-content', 't-class-title', 't-class-description', 't-class-extra']` | N
-icon | String / Slot | - | 图标。传入 slot 代表使用插槽,其他字符串代表使用内置图标 | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+content | String / Slot | '' | 步骤描述。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+icon | String / Slot | - | 图标。传入 slot 代表使用插槽,其他字符串代表使用内置图标。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
status | String | default | 当前步骤的状态:默认状态(未开始)、进行中状态、完成状态、错误状态。可选项:default/process/finish/error。TS 类型:`StepStatus` `type StepStatus = 'default' \| 'process' \| 'finish' \| 'error'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/step-item/type.ts) | N
-style | String | - | 自定义组件样式 | N
-sub-step-items | Array | [] | 废弃。子步骤条,仅支持 layout = 'vertical' 时 | N
-title | String / Slot | '' | 标题 | N
+sub-step-items | Array | [] | 已废弃。子步骤条,仅支持 layout = 'vertical' 时。TS 类型:`SubStepItem[]` `interface SubStepItem { status: StepStatus, title: string }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/step-item/type.ts) | N
+title | String / Slot | '' | 标题。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+### StepItem External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-content | 内容样式类
+t-class-description | 描述样式类
+t-class-extra | 额外样式类
+t-class-title | 标题样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-step-item-circle-font-size | 28rpx | -
+--td-step-item-circle-size | 44rpx | -
+--td-step-item-default-circle-bg | @bg-color-secondarycontainer | -
+--td-step-item-default-circle-color | @font-gray-3 | -
+--td-step-item-default-dot-border-color | @component-border | -
+--td-step-item-default-icon-color | @font-gray-3 | -
+--td-step-item-default-title-color | @font-gray-3 | -
+--td-step-item-description-color | @font-gray-3 | -
+--td-step-item-dot-size | 16rpx | -
+--td-step-item-error-circle-bg | @error-color-1 | -
+--td-step-item-error-circle-color | @error-color | -
+--td-step-item-error-dot-border-color | @error-color | -
+--td-step-item-error-icon-color | @error-color | -
+--td-step-item-error-title-color | @error-color | -
+--td-step-item-finish-circle-bg | @brand-color-light | -
+--td-step-item-finish-circle-color | @brand-color | -
+--td-step-item-finish-dot-border-color | @brand-color | -
+--td-step-item-finish-icon-color | @brand-color | -
+--td-step-item-finish-line-color | @brand-color | -
+--td-step-item-finish-title-color | @font-gray-1 | -
+--td-step-item-line-color | @component-border | -
+--td-step-item-process-circle-bg | @brand-color | -
+--td-step-item-process-circle-color | @font-white-1 | -
+--td-step-item-process-dot-border-color | @brand-color | -
+--td-step-item-process-icon-color | @brand-color | -
+--td-step-item-process-title-color | @brand-color | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/steps/props.js b/miniprogram_npm/tdesign-miniprogram/steps/props.js
index 5b2a542..05fa41f 100644
--- a/miniprogram_npm/tdesign-miniprogram/steps/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/steps/props.js
@@ -10,9 +10,6 @@ const props = {
type: String,
value: 'process',
},
- externalClasses: {
- type: Array,
- },
layout: {
type: String,
value: 'horizontal',
@@ -21,9 +18,9 @@ const props = {
type: Boolean,
value: false,
},
- separator: {
+ sequence: {
type: String,
- value: 'line',
+ value: 'positive',
},
theme: {
type: String,
diff --git a/miniprogram_npm/tdesign-miniprogram/steps/steps.js b/miniprogram_npm/tdesign-miniprogram/steps/steps.js
index 5584daf..ebec7fc 100644
--- a/miniprogram_npm/tdesign-miniprogram/steps/steps.js
+++ b/miniprogram_npm/tdesign-miniprogram/steps/steps.js
@@ -46,10 +46,9 @@ let Steps = class Steps extends SuperComponent {
};
this.methods = {
updateChildren() {
- const { current, currentStatus, readonly, theme, layout } = this.data;
const items = this.$children;
items.forEach((item, index) => {
- item.updateStatus(current, currentStatus, index, theme, layout, items, readonly);
+ item.updateStatus(Object.assign({ index, items }, this.data));
});
},
updateLastChid() {
diff --git a/miniprogram_npm/tdesign-miniprogram/steps/steps.json b/miniprogram_npm/tdesign-miniprogram/steps/steps.json
index 94bcc8b..8dd1021 100644
--- a/miniprogram_npm/tdesign-miniprogram/steps/steps.json
+++ b/miniprogram_npm/tdesign-miniprogram/steps/steps.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-step": "../step-item/step-item"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/steps/steps.wxml b/miniprogram_npm/tdesign-miniprogram/steps/steps.wxml
index b2c24b1..5c5c7eb 100644
--- a/miniprogram_npm/tdesign-miniprogram/steps/steps.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/steps/steps.wxml
@@ -2,7 +2,7 @@
diff --git a/miniprogram_npm/tdesign-miniprogram/steps/steps.wxss b/miniprogram_npm/tdesign-miniprogram/steps/steps.wxss
index d0a636c..f14023e 100644
--- a/miniprogram_npm/tdesign-miniprogram/steps/steps.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/steps/steps.wxss
@@ -38,3 +38,9 @@
.t-steps--vertical {
flex-direction: column;
}
+.t-steps--reverse {
+ flex-direction: row-reverse;
+}
+.t-steps--vertical.t-steps--reverse {
+ flex-direction: column-reverse;
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/steps/type.d.ts b/miniprogram_npm/tdesign-miniprogram/steps/type.d.ts
index df12f6f..d0e9147 100644
--- a/miniprogram_npm/tdesign-miniprogram/steps/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/steps/type.d.ts
@@ -11,10 +11,6 @@ export interface TdStepsProps {
type: StringConstructor;
value?: 'default' | 'process' | 'finish' | 'error';
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class'];
- };
layout?: {
type: StringConstructor;
value?: 'horizontal' | 'vertical';
@@ -23,13 +19,9 @@ export interface TdStepsProps {
type: BooleanConstructor;
value?: boolean;
};
- separator?: {
+ sequence?: {
type: StringConstructor;
- value?: 'line' | 'dashed' | 'arrow';
- };
- style?: {
- type: StringConstructor;
- value?: string;
+ value?: 'positive' | 'reverse';
};
theme?: {
type: StringConstructor;
diff --git a/miniprogram_npm/tdesign-miniprogram/sticky/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/sticky/README.en-US.md
index 4b36d15..643e0e6 100644
--- a/miniprogram_npm/tdesign-miniprogram/sticky/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/sticky/README.en-US.md
@@ -6,9 +6,10 @@
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
container | Function | - | \- | N
disabled | Boolean | false | \- | N
-external-classes | Array | - | `['t-class']` | N
offset-top | String / Number | 0 | \- | N
z-index | Number | 99 | \- | N
@@ -16,4 +17,10 @@ z-index | Number | 99 | \- | N
name | params | description
-- | -- | --
-scroll | `(detail: { scrollTop: number, isFixed: boolean })` | \-
+scroll | `(detail: { scrollTop: number, isFixed: boolean })` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts)
+### Sticky External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-content | \-
diff --git a/miniprogram_npm/tdesign-miniprogram/sticky/README.md b/miniprogram_npm/tdesign-miniprogram/sticky/README.md
index aff6695..d96f665 100644
--- a/miniprogram_npm/tdesign-miniprogram/sticky/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/sticky/README.md
@@ -22,6 +22,13 @@ isComponent: true
+
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 基础吸顶
{{ base }}
@@ -38,13 +45,15 @@ isComponent: true
## API
+
### Sticky Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
container | Function | - | 函数返回容器对应的 NodesRef 节点,将对应节点指定为组件的外部容器,滚动时组件会始终保持在容器范围内,当组件即将超出容器底部时,会返回原位置。 | N
disabled | Boolean | false | 是否禁用组件 | N
-external-classes | Array | - | 根结点外部样式。`['t-class']` | N
offset-top | String / Number | 0 | 吸顶时与顶部的距离,单位`px` | N
z-index | Number | 99 | 吸顶时的 z-index | N
@@ -52,4 +61,10 @@ z-index | Number | 99 | 吸顶时的 z-index | N
名称 | 参数 | 描述
-- | -- | --
-scroll | `(detail: { scrollTop: number, isFixed: boolean })` | 滚动时触发,scrollTop: 距离顶部位置,isFixed: 是否吸顶
+scroll | `(detail: { scrollTop: number, isFixed: boolean })` | 滚动时触发,scrollTop: 距离顶部位置,isFixed: 是否吸顶。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts)
+### Sticky External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-content | 内容样式类
diff --git a/miniprogram_npm/tdesign-miniprogram/sticky/props.js b/miniprogram_npm/tdesign-miniprogram/sticky/props.js
index 7e5cb71..6dcdf7c 100644
--- a/miniprogram_npm/tdesign-miniprogram/sticky/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/sticky/props.js
@@ -6,11 +6,8 @@ const props = {
type: Boolean,
value: false,
},
- externalClasses: {
- type: Array,
- },
offsetTop: {
- type: Number,
+ type: null,
value: 0,
},
zIndex: {
diff --git a/miniprogram_npm/tdesign-miniprogram/sticky/sticky.js b/miniprogram_npm/tdesign-miniprogram/sticky/sticky.js
index 9272792..a71da33 100644
--- a/miniprogram_npm/tdesign-miniprogram/sticky/sticky.js
+++ b/miniprogram_npm/tdesign-miniprogram/sticky/sticky.js
@@ -15,13 +15,9 @@ const ContainerClass = `.${name}`;
let Sticky = class Sticky extends SuperComponent {
constructor() {
super(...arguments);
- this.externalClasses = [`${prefix}-class`];
+ this.externalClasses = [`${prefix}-class`, `${prefix}-class-content`];
this.properties = props;
- this.behaviors = [
- pageScrollMixin(function (event) {
- this.onScroll(event);
- }),
- ];
+ this.behaviors = [pageScrollMixin()];
this.observers = {
'offsetTop, disabled, container'() {
this.onScroll();
@@ -89,7 +85,7 @@ let Sticky = class Sticky extends SuperComponent {
let contentStyle = '';
if (isFixed) {
containerStyle += `height:${height}px;`;
- contentStyle += `position:fixed;top:${offsetTop}px;`;
+ contentStyle += `position:fixed;top:${offsetTop}px;left:0;right:0;`;
}
if (transform) {
const translate = `translate3d(0, ${transform}px, 0)`;
diff --git a/miniprogram_npm/tdesign-miniprogram/sticky/sticky.json b/miniprogram_npm/tdesign-miniprogram/sticky/sticky.json
index a89ef4d..4f0a3f0 100644
--- a/miniprogram_npm/tdesign-miniprogram/sticky/sticky.json
+++ b/miniprogram_npm/tdesign-miniprogram/sticky/sticky.json
@@ -1,4 +1,5 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/sticky/sticky.wxml b/miniprogram_npm/tdesign-miniprogram/sticky/sticky.wxml
index 8f0181c..8ca8159 100644
--- a/miniprogram_npm/tdesign-miniprogram/sticky/sticky.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/sticky/sticky.wxml
@@ -2,9 +2,9 @@
-
+
diff --git a/miniprogram_npm/tdesign-miniprogram/sticky/sticky.wxss b/miniprogram_npm/tdesign-miniprogram/sticky/sticky.wxss
index 730de8a..9a1af97 100644
--- a/miniprogram_npm/tdesign-miniprogram/sticky/sticky.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/sticky/sticky.wxss
@@ -28,6 +28,3 @@
.t-sticky {
position: relative;
}
-.t-sticky__content {
- width: 100%;
-}
diff --git a/miniprogram_npm/tdesign-miniprogram/sticky/type.d.ts b/miniprogram_npm/tdesign-miniprogram/sticky/type.d.ts
index 40a7712..36195d9 100644
--- a/miniprogram_npm/tdesign-miniprogram/sticky/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/sticky/type.d.ts
@@ -3,21 +3,13 @@ export interface TdStickyProps {
type: undefined;
value?: null;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class'];
- };
offsetTop?: {
- type: NumberConstructor;
- value?: number;
+ type: null;
+ value?: string | number;
};
zIndex?: {
type: NumberConstructor;
diff --git a/miniprogram_npm/tdesign-miniprogram/swipe-cell/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/swipe-cell/README.en-US.md
index 584359b..125897b 100644
--- a/miniprogram_npm/tdesign-miniprogram/swipe-cell/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/swipe-cell/README.en-US.md
@@ -6,13 +6,17 @@
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
disabled | Boolean | - | \- | N
-opened | Boolean / Array | false | \- | N
left | Array / Slot | - | Typescript:`Array` | N
-right | Array / Slot | - | Typescript:`Array` `interface SwipeActionItem {text?: string; icon?: string | object; className?: string; style?: string; onClick?: () => void; [key: string]: any }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/swipe-cell/type.ts) | N
+opened | Boolean / Array | false | Typescript:`boolean \| Array` | N
+right | Array / Slot | - | Typescript:`Array` `interface SwipeActionItem {text?: string; icon?: string \| object, className?: string; style?: string; onClick?: () => void; [key: string]: any }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/swipe-cell/type.ts) | N
### SwipeCell Events
name | params | description
-- | -- | --
click | `(action: SwipeActionItem, source: SwipeSource)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/swipe-cell/type.ts)。
`type SwipeSource = 'left' \| 'right'`
+dragend | \- | \-
+dragstart | \- | \-
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/swipe-cell/README.md b/miniprogram_npm/tdesign-miniprogram/swipe-cell/README.md
index b0c80d5..8a7f87f 100644
--- a/miniprogram_npm/tdesign-miniprogram/swipe-cell/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/swipe-cell/README.md
@@ -6,6 +6,7 @@ isComponent: true
---



+
## 引入
全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
@@ -16,6 +17,14 @@ isComponent: true
}
```
+## 代码演示
+
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
左滑单操作
@@ -35,13 +44,16 @@ isComponent: true
{{ icon }}
## API
+
### SwipeCell Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
disabled | Boolean | - | 是否禁用滑动 | N
-opened | Boolean / Array | false | 操作项是否呈现为打开态,值为数组时表示分别控制左右滑动的展开和收起状态。TS 类型:`boolean \| Array` | N |
left | Array / Slot | - | 左侧滑动操作项。所有行为同 `right`。TS 类型:`Array` | N
+opened | Boolean / Array | false | 操作项是否呈现为打开态,值为数组时表示分别控制左右滑动的展开和收起状态。TS 类型:`boolean \| Array` | N
right | Array / Slot | - | 右侧滑动操作项。有两种定义方式,一种是使用数组,二种是使用插槽。`right.text` 表示操作文本,`right.className` 表示操作项类名,`right.style` 表示操作项样式,`right.onClick` 表示点击操作项后执行的回调函数。示例:`[{ text: '删除', icon: 'delete', style: 'background-color: red', onClick: () => {} }]`。TS 类型:`Array` `interface SwipeActionItem {text?: string; icon?: string \| object, className?: string; style?: string; onClick?: () => void; [key: string]: any }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/swipe-cell/type.ts) | N
### SwipeCell Events
@@ -49,3 +61,5 @@ right | Array / Slot | - | 右侧滑动操作项。有两种定义方式,一
名称 | 参数 | 描述
-- | -- | --
click | `(action: SwipeActionItem, source: SwipeSource)` | 操作项点击时触发(插槽写法组件不触发,业务侧自定义内容和事件)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/swipe-cell/type.ts)。
`type SwipeSource = 'left' \| 'right'`
+dragend | \- | 滑动结束事件
+dragstart | \- | 滑动开始事件
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/swipe-cell/props.js b/miniprogram_npm/tdesign-miniprogram/swipe-cell/props.js
index 5298eef..da087a2 100644
--- a/miniprogram_npm/tdesign-miniprogram/swipe-cell/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/swipe-cell/props.js
@@ -6,12 +6,15 @@ const props = {
type: Array,
},
opened: {
- type: Boolean,
- optionalTypes: [Array],
+ type: null,
value: false,
},
right: {
type: Array,
},
+ style: {
+ type: String,
+ value: '',
+ },
};
export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.d.ts b/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.d.ts
index b1400ab..c4ef77c 100644
--- a/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.d.ts
@@ -11,10 +11,15 @@ export default class SwiperCell extends SuperComponent {
closed: boolean;
classPrefix: string;
};
- attached(): void;
- ready(): void;
+ observers: {
+ 'left, right'(): void;
+ };
+ lifetimes: {
+ attached(): void;
+ ready(): void;
+ detached(): void;
+ };
setSwipeWidth(): void;
- detached(): void;
open(): void;
close(): void;
closeOther(): void;
diff --git a/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.js b/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.js
index f785d95..b7f12e5 100644
--- a/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.js
+++ b/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.js
@@ -8,6 +8,7 @@ import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
import { getRect } from '../common/utils';
+import { getObserver } from '../common/wechat';
let ARRAY = [];
const { prefix } = config;
const name = `${prefix}-swipe-cell`;
@@ -26,24 +27,37 @@ let SwiperCell = class SwiperCell extends SuperComponent {
closed: true,
classPrefix: name,
};
- }
- attached() {
- ARRAY.push(this);
- }
- ready() {
- this.setSwipeWidth();
+ this.observers = {
+ 'left, right'() {
+ this.setSwipeWidth();
+ },
+ };
+ this.lifetimes = {
+ attached() {
+ ARRAY.push(this);
+ },
+ ready() {
+ this.setSwipeWidth();
+ },
+ detached() {
+ ARRAY = ARRAY.filter((item) => item !== this);
+ },
+ };
}
setSwipeWidth() {
Promise.all([getRect(this, `${ContainerClass}__left`), getRect(this, `${ContainerClass}__right`)]).then(([leftRect, rightRect]) => {
+ if (leftRect.width === 0 && rightRect.width === 0 && !this._hasObserved) {
+ this._hasObserved = true;
+ getObserver(this, `.${name}`).then(() => {
+ this.setSwipeWidth();
+ });
+ }
this.setData({
leftWidth: leftRect.width,
rightWidth: rightRect.width,
});
});
}
- detached() {
- ARRAY = ARRAY.filter((item) => item !== this);
- }
open() {
this.setData({ opened: true });
}
diff --git a/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.json b/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.json
index 049940c..f783dae 100644
--- a/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.json
+++ b/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.wxs b/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.wxs
index dbb7fec..e166240 100644
--- a/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.wxs
+++ b/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.wxs
@@ -28,7 +28,7 @@ var initLeftWidth = function (newVal, oldVal, ownerInstance) {
var initOpen = function (ownerInstance) {
getState(ownerInstance);
if (state.opened.constructor === 'Boolean') {
- // opened为boolen类型,判断默认打开
+ // opened为boolean类型,判断默认打开
if (state.opened && state.rightWidth > 0) {
swipeMove(-state.rightWidth);
} else if (state.opened && state.leftWidth > 0) {
@@ -131,8 +131,12 @@ var onDrag = function (event, ownerInstance) {
if (state.direction !== 'horizontal') {
return;
}
+ if (!state.dragging) {
+ ownerInstance.triggerEvent('dragstart');
+ }
state.dragging = true;
swipeMove(state.startOffset + state.deltaX);
+ return false;
};
var open = function (position) {
@@ -163,6 +167,7 @@ var endDrag = function (event, ownerInstance) {
close();
}
}
+ ownerInstance.triggerEvent('dragend');
};
module.exports = {
diff --git a/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.wxss b/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.wxss
index dd4086f..7ad58b2 100644
--- a/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.wxss
@@ -50,7 +50,7 @@
padding: 0 var(--td-spacer-2, 32rpx);
}
.t-swipe-cell__icon {
- font-size: var(--td-font-size-l, 40rpx);
+ font-size: var(--td-font-size-xl, 40rpx);
}
.t-swipe-cell__icon + .t-swipe-cell__text:not(:empty) {
margin-left: var(--td-spacer, 16rpx);
diff --git a/miniprogram_npm/tdesign-miniprogram/swipe-cell/type.d.ts b/miniprogram_npm/tdesign-miniprogram/swipe-cell/type.d.ts
index 43614d3..de819ce 100644
--- a/miniprogram_npm/tdesign-miniprogram/swipe-cell/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/swipe-cell/type.d.ts
@@ -1,8 +1,4 @@
export interface TdSwipeCellProps {
- style?: {
- type: StringConstructor;
- value?: string;
- };
disabled?: {
type: BooleanConstructor;
value?: boolean;
@@ -12,18 +8,21 @@ export interface TdSwipeCellProps {
value?: Array;
};
opened?: {
- type: BooleanConstructor;
- optionalTypes: Array;
+ type: null;
value?: boolean | Array;
- required?: boolean;
};
right?: {
type: ArrayConstructor;
value?: Array;
};
+ style?: {
+ type: StringConstructor;
+ value?: string;
+ };
}
export interface SwipeActionItem {
- text: string;
+ text?: string;
+ icon?: string | object;
className?: string;
style?: string;
onClick?: () => void;
diff --git a/miniprogram_npm/tdesign-miniprogram/swiper-nav/swiper-nav.json b/miniprogram_npm/tdesign-miniprogram/swiper-nav/swiper-nav.json
index 467ce29..79f2730 100644
--- a/miniprogram_npm/tdesign-miniprogram/swiper-nav/swiper-nav.json
+++ b/miniprogram_npm/tdesign-miniprogram/swiper-nav/swiper-nav.json
@@ -1,3 +1,4 @@
{
- "component": true
+ "component": true,
+ "styleIsolation": "apply-shared"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/swiper-nav/swiper-nav.wxml b/miniprogram_npm/tdesign-miniprogram/swiper-nav/swiper-nav.wxml
index 2067b05..35ed33a 100644
--- a/miniprogram_npm/tdesign-miniprogram/swiper-nav/swiper-nav.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/swiper-nav/swiper-nav.wxml
@@ -1,12 +1,13 @@
+
-
-
+
+
`type SwiperChangeSource = 'autoplay' \| 'touch' \| 'nav'`
click | `(index: number)` | `0.34.0`
+image-load | `(index: number)` | `1.1.4`
+### Swiper External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-image | \-
+t-class-nav | \-
+t-class-next-image | \-
+t-class-prev-image | \-
+
### SwiperNav Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
current | Number | 0 | `0.34.0` | N
-direction | String | horizontal | `0.34.0`。options:horizontal/vertical | N
+direction | String | horizontal | `0.34.0`。options: horizontal/vertical | N
min-show-num | Number | 2 | \- | N
-pagination-position | String | bottom | `0.34.0`。options:top-left/top/top-right/bottom-left/bottom/bottom-right | N
+pagination-position | String | bottom | `0.34.0`。options: top-left/top/top-right/bottom-left/bottom/bottom-right | N
show-controls | Boolean | false | `0.32.0` | N
total | Number | 0 | `0.34.0` | N
type | String | dots | Typescript:`SwiperNavigationType` `type SwiperNavigationType = 'dots' \| 'dots-bar' \| 'fraction'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/swiper-nav/type.ts) | N
+### SwiperNav External Classes
+
+className | Description
+-- | --
+t-class | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-swiper-item-padding | 0 | -
+--td-swiper-radius | @radius-large | -
+--td-swiper-nav-btn-bg-color | @font-gray-3 | -
+--td-swiper-nav-btn-color | @font-white-1 | -
+--td-swiper-nav-btn-size | 48rpx | -
+--td-swiper-nav-dot-active-color | @font-white-1 | -
+--td-swiper-nav-dot-color | @font-white-2 | -
+--td-swiper-nav-dot-size | 12rpx | -
+--td-swiper-nav-dots-bar-active-width | 40rpx | -
+--td-swiper-nav-fraction-bg-color | @font-gray-3 | -
+--td-swiper-nav-fraction-color | @font-white-1 | -
+--td-swiper-nav-fraction-font-size | 24rpx | -
+--td-swiper-nav-fraction-height | 48rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/swiper/README.md b/miniprogram_npm/tdesign-miniprogram/swiper/README.md
index 37bd573..8ddfb4b 100644
--- a/miniprogram_npm/tdesign-miniprogram/swiper/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/swiper/README.md
@@ -27,6 +27,13 @@ isComponent: true
+
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
#### 点状(dots)轮播图
@@ -56,10 +63,13 @@ isComponent: true
{{ vertical }}
## API
+
### Swiper Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
autoplay | Boolean | true | 是否自动播放 | N
current | Number | 0 | 当前轮播在哪一项(下标) | N
direction | String | horizontal | 轮播滑动方向,包括横向滑动和纵向滑动两个方向。可选项:horizontal/vertical | N
@@ -69,7 +79,7 @@ easing-function | String | default | `0.32.0`。指定 swiper 切换缓动动画
height | String / Number | 192 | 轮播的高度;默认单位 `px` | N
image-props | Object | - | `0.34.0`。透传至 Image 组件 | N
interval | Number | 5000 | 轮播间隔时间 | N
-list | Array | - | `0.32.0`。图片列表。TS 类型:`string[]` | N
+list | Array | - | `0.32.0`。图片列表。TS 类型:`string[] \| SwiperList[]` `interface SwiperList { value: string, ariaLabel: string }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/swiper/type.ts) | N
loop | Boolean | true | 是否循环播放 | N
navigation | Boolean / Object / Slot | true | 导航器全部配置,true 的话使用默认配置。TS 类型:`SwiperNavProps \| boolean`,[SwiperNav API Documents](./swiper-nav?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/swiper/type.ts) | N
next-margin | String / Number | 0 | `0.32.0`。后边距,可用于露出后一项的一小部分。默认单位 `px` | N
@@ -83,11 +93,24 @@ snap-to-edge | Boolean | false | `0.32.0`。当 swiper-item 的个数大于等
-- | -- | --
change | `(current: number, source: SwiperChangeSource)` | 轮播切换时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/swiper/type.ts)。
`type SwiperChangeSource = 'autoplay' \| 'touch' \| 'nav'`
click | `(index: number)` | `0.34.0`。点击轮播项时触发
+image-load | `(index: number)` | `1.1.4`。图片加载时触发
+### Swiper External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-image | 当前图片样式类
+t-class-nav | 导航样式类
+t-class-next-image | 下一图片样式类
+t-class-prev-image | 上一图片样式类
+
### SwiperNav Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
current | Number | 0 | `0.34.0`。当前轮播在哪一项(下标) | N
direction | String | horizontal | `0.34.0`。轮播滑动方向,包括横向滑动和纵向滑动两个方向。可选项:horizontal/vertical | N
min-show-num | Number | 2 | 小于这个数字不会显示导航器 | N
@@ -95,3 +118,27 @@ pagination-position | String | bottom | `0.34.0`。页码信息展示位置。
show-controls | Boolean | false | `0.32.0`。是否显示两侧的控制按钮 | N
total | Number | 0 | `0.34.0`。总共的项数 | N
type | String | dots | 导航器类型,点状(dots)、点条状(dots-bar)、分式(fraction)等。TS 类型:`SwiperNavigationType` `type SwiperNavigationType = 'dots' \| 'dots-bar' \| 'fraction'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/swiper-nav/type.ts) | N
+### SwiperNav External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-swiper-item-padding | 0 | -
+--td-swiper-radius | @radius-large | -
+--td-swiper-nav-btn-bg-color | @font-gray-3 | -
+--td-swiper-nav-btn-color | @font-white-1 | -
+--td-swiper-nav-btn-size | 48rpx | -
+--td-swiper-nav-dot-active-color | @font-white-1 | -
+--td-swiper-nav-dot-color | @font-white-2 | -
+--td-swiper-nav-dot-size | 12rpx | -
+--td-swiper-nav-dots-bar-active-width | 40rpx | -
+--td-swiper-nav-fraction-bg-color | @font-gray-3 | -
+--td-swiper-nav-fraction-color | @font-white-1 | -
+--td-swiper-nav-fraction-font-size | 24rpx | -
+--td-swiper-nav-fraction-height | 48rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/swiper/swiper.d.ts b/miniprogram_npm/tdesign-miniprogram/swiper/swiper.d.ts
index 03a5202..e653a57 100644
--- a/miniprogram_npm/tdesign-miniprogram/swiper/swiper.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/swiper/swiper.d.ts
@@ -23,5 +23,6 @@ export default class Swiper extends SuperComponent {
onChange(e: any): void;
onNavBtnChange(e: any): void;
doNavBtnChange(dir: any, source: any): void;
+ onImageLoad(e: any): void;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/swiper/swiper.js b/miniprogram_npm/tdesign-miniprogram/swiper/swiper.js
index 327c7f1..1569741 100644
--- a/miniprogram_npm/tdesign-miniprogram/swiper/swiper.js
+++ b/miniprogram_npm/tdesign-miniprogram/swiper/swiper.js
@@ -92,6 +92,9 @@ let Swiper = class Swiper extends SuperComponent {
});
this.triggerEvent('change', { current: nextPos, source });
},
+ onImageLoad(e) {
+ this.triggerEvent('image-load', { index: e.target.dataset.custom });
+ },
};
}
};
diff --git a/miniprogram_npm/tdesign-miniprogram/swiper/swiper.json b/miniprogram_npm/tdesign-miniprogram/swiper/swiper.json
index e565961..3989ca7 100644
--- a/miniprogram_npm/tdesign-miniprogram/swiper/swiper.json
+++ b/miniprogram_npm/tdesign-miniprogram/swiper/swiper.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-swiper-nav": "../swiper-nav/swiper-nav",
"t-image": "../image/image"
diff --git a/miniprogram_npm/tdesign-miniprogram/swiper/swiper.wxml b/miniprogram_npm/tdesign-miniprogram/swiper/swiper.wxml
index 22add26..8ef02bf 100644
--- a/miniprogram_npm/tdesign-miniprogram/swiper/swiper.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/swiper/swiper.wxml
@@ -23,13 +23,16 @@
@@ -45,5 +48,6 @@
show-controls="{{navigation.showControls || false}}"
bind:nav-btn-change="onNavBtnChange"
/>
+
diff --git a/miniprogram_npm/tdesign-miniprogram/swiper/swiper.wxss b/miniprogram_npm/tdesign-miniprogram/swiper/swiper.wxss
index 4d9e39b..8695eed 100644
--- a/miniprogram_npm/tdesign-miniprogram/swiper/swiper.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/swiper/swiper.wxss
@@ -31,6 +31,7 @@
.t-swiper-host {
border-radius: var(--td-swiper-radius, var(--td-radius-large, 18rpx));
overflow: hidden;
+ transform: translateY(0);
}
.t-swiper__item {
display: flex;
@@ -43,6 +44,5 @@
transition: all 0.3s ease;
}
.t-swiper__image-host {
- display: block;
width: 100%;
}
diff --git a/miniprogram_npm/tdesign-miniprogram/swiper/type.d.ts b/miniprogram_npm/tdesign-miniprogram/swiper/type.d.ts
index 6b6eb8a..2c4a1ce 100644
--- a/miniprogram_npm/tdesign-miniprogram/swiper/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/swiper/type.d.ts
@@ -8,10 +8,6 @@ export interface TdSwiperProps {
type: NumberConstructor;
value?: number;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
direction?: {
type: StringConstructor;
value?: 'horizontal' | 'vertical';
@@ -42,7 +38,7 @@ export interface TdSwiperProps {
};
list?: {
type: ArrayConstructor;
- value?: string[];
+ value?: string[] | SwiperList[];
};
loop?: {
type: BooleanConstructor;
@@ -69,3 +65,7 @@ export interface TdSwiperProps {
value?: boolean;
};
}
+export interface SwiperList {
+ value: string;
+ ariaLabel: string;
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/switch/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/switch/README.en-US.md
index 5785a01..1271e39 100644
--- a/miniprogram_npm/tdesign-miniprogram/switch/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/switch/README.en-US.md
@@ -1,17 +1,19 @@
:: BASE_DOC ::
## API
+
### Switch Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
custom-value | Array | [true, false] | Typescript:`Array` | N
-disabled | Boolean | false | \- | N
-icon | Array | [] | Typescript:`string[]` | N
-label | Array | [] | Typescript:`string[]` | N
-loading | Boolean | false | \- | N
-size | String | medium | options:small/medium/large | N
-style | String | - | \- | N
+disabled | Boolean | undefined | \- | N
+icon | Array | [] | `0.27.0`。Typescript:`string[]` | N
+label | Array | [] | `0.27.0`。Typescript:`string[]` | N
+loading | Boolean | false | `0.27.0` | N
+size | String | medium | `0.27.0`。options: small/medium/large | N
value | String / Number / Boolean | null | Typescript:`SwitchValue` `type SwitchValue = string \| number \| boolean`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/switch/type.ts) | N
default-value | String / Number / Boolean | undefined | uncontrolled property。Typescript:`SwitchValue` `type SwitchValue = string \| number \| boolean`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/switch/type.ts) | N
@@ -20,3 +22,40 @@ default-value | String / Number / Boolean | undefined | uncontrolled property。
name | params | description
-- | -- | --
change | `(value: SwitchValue)` | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-switch-checked-color | @brand-color | -
+--td-switch-checked-disabled-color | @brand-color-disabled | -
+--td-switch-dot-border-color | @bg-color-secondarycontainer | -
+--td-switch-dot-horizontal-margin | 6rpx | -
+--td-switch-dot-large-size | 52rpx | -
+--td-switch-dot-plain-horizontal-margin | 10rpx | -
+--td-switch-dot-plain-large-size | 44rpx | -
+--td-switch-dot-plain-size | 36rpx | -
+--td-switch-dot-plain-small-size | 28rpx | -
+--td-switch-dot-shadow | @shadow-1 | -
+--td-switch-dot-size | 44rpx | -
+--td-switch-dot-small-size | 36rpx | -
+--td-switch-height | 56rpx | -
+--td-switch-icon-large-size | 48rpx | -
+--td-switch-icon-size | 40rpx | -
+--td-switch-icon-small-size | 32rpx | -
+--td-switch-label-checked-color | @switch-checked-color | -
+--td-switch-label-color | @font-gray-4 | -
+--td-switch-label-font-size | 28rpx | -
+--td-switch-label-large-font-size | 32rpx | -
+--td-switch-label-small-font-size | 24rpx | -
+--td-switch-large-height | 64rpx | -
+--td-switch-large-radius | calc(@switch-large-height / 2) | -
+--td-switch-large-width | 104rpx | -
+--td-switch-radius | calc(@switch-height / 2) | -
+--td-switch-small-height | 48rpx | -
+--td-switch-small-radius | calc(@switch-small-height / 2) | -
+--td-switch-small-width | 78rpx | -
+--td-switch-unchecked-color | @font-gray-4 | -
+--td-switch-unchecked-disabled-color | @bg-color-component-disabled | -
+--td-switch-width | 90rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/switch/README.md b/miniprogram_npm/tdesign-miniprogram/switch/README.md
index baa96b2..5bbc9c3 100644
--- a/miniprogram_npm/tdesign-miniprogram/switch/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/switch/README.md
@@ -18,6 +18,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 基础开关
{{ base }}
@@ -39,16 +45,19 @@ isComponent: true
{{ size }}
## API
+
### Switch Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
custom-value | Array | [true, false] | 用于自定义开关的值,[打开时的值,关闭时的值]。默认为 [true, false]。示例:[1, 0]、['open', 'close']。TS 类型:`Array` | N
-disabled | Boolean | false | 是否禁用组件 | N
-icon `v0.27.0` | Array | [] | 开关的图标;[打开时的图标,关闭时的图标]。TS 类型:`string[]` | N
-label `v0.27.0` | Array | [] | 开关的标签;[打开时的标签,关闭时的标签]。TS 类型:`string[]` | N
-loading `v0.27.0` | Boolean | false | 是否处于加载中状态 | N
-size `v0.27.0` | String | medium | 开关尺寸。可选项:small/medium/large | N
+disabled | Boolean | undefined | 是否禁用组件。优先级:Switch.disabled > Form.disabled | N
+icon | Array | [] | `0.27.0`。开关的图标;[打开时的图标,关闭时的图标]。TS 类型:`string[]` | N
+label | Array | [] | `0.27.0`。开关的标签;[打开时的标签,关闭时的标签]。TS 类型:`string[]` | N
+loading | Boolean | false | `0.27.0`。是否处于加载中状态 | N
+size | String | medium | `0.27.0`。开关尺寸。可选项:small/medium/large | N
value | String / Number / Boolean | null | 开关值。TS 类型:`SwitchValue` `type SwitchValue = string \| number \| boolean`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/switch/type.ts) | N
default-value | String / Number / Boolean | undefined | 开关值。非受控属性。TS 类型:`SwitchValue` `type SwitchValue = string \| number \| boolean`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/switch/type.ts) | N
@@ -57,3 +66,40 @@ default-value | String / Number / Boolean | undefined | 开关值。非受控属
名称 | 参数 | 描述
-- | -- | --
change | `(value: SwitchValue)` | 数据发生变化时触发
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-switch-checked-color | @brand-color | -
+--td-switch-checked-disabled-color | @brand-color-disabled | -
+--td-switch-dot-border-color | @bg-color-secondarycontainer | -
+--td-switch-dot-horizontal-margin | 6rpx | -
+--td-switch-dot-large-size | 52rpx | -
+--td-switch-dot-plain-horizontal-margin | 10rpx | -
+--td-switch-dot-plain-large-size | 44rpx | -
+--td-switch-dot-plain-size | 36rpx | -
+--td-switch-dot-plain-small-size | 28rpx | -
+--td-switch-dot-shadow | @shadow-1 | -
+--td-switch-dot-size | 44rpx | -
+--td-switch-dot-small-size | 36rpx | -
+--td-switch-height | 56rpx | -
+--td-switch-icon-large-size | 48rpx | -
+--td-switch-icon-size | 40rpx | -
+--td-switch-icon-small-size | 32rpx | -
+--td-switch-label-checked-color | @switch-checked-color | -
+--td-switch-label-color | @font-gray-4 | -
+--td-switch-label-font-size | 28rpx | -
+--td-switch-label-large-font-size | 32rpx | -
+--td-switch-label-small-font-size | 24rpx | -
+--td-switch-large-height | 64rpx | -
+--td-switch-large-radius | calc(@switch-large-height / 2) | -
+--td-switch-large-width | 104rpx | -
+--td-switch-radius | calc(@switch-height / 2) | -
+--td-switch-small-height | 48rpx | -
+--td-switch-small-radius | calc(@switch-small-height / 2) | -
+--td-switch-small-width | 78rpx | -
+--td-switch-unchecked-color | @font-gray-4 | -
+--td-switch-unchecked-disabled-color | @bg-color-component-disabled | -
+--td-switch-width | 90rpx | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/switch/props.js b/miniprogram_npm/tdesign-miniprogram/switch/props.js
index eb61ffb..c50b128 100644
--- a/miniprogram_npm/tdesign-miniprogram/switch/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/switch/props.js
@@ -4,8 +4,8 @@ const props = {
value: [true, false],
},
disabled: {
- type: Boolean,
- value: false,
+ type: null,
+ value: undefined,
},
icon: {
type: Array,
diff --git a/miniprogram_npm/tdesign-miniprogram/switch/switch.d.ts b/miniprogram_npm/tdesign-miniprogram/switch/switch.d.ts
index 6e43804..7db8002 100644
--- a/miniprogram_npm/tdesign-miniprogram/switch/switch.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/switch/switch.d.ts
@@ -2,7 +2,7 @@ import { SuperComponent } from '../common/src/index';
export default class Switch extends SuperComponent {
externalClasses: string[];
behaviors: string[];
- properties: import("./type").TdSwitchProps;
+ properties: import("./type").TdSwitchProps;
data: {
prefix: string;
classPrefix: string;
diff --git a/miniprogram_npm/tdesign-miniprogram/switch/switch.js b/miniprogram_npm/tdesign-miniprogram/switch/switch.js
index 6702e2a..8f9277e 100644
--- a/miniprogram_npm/tdesign-miniprogram/switch/switch.js
+++ b/miniprogram_npm/tdesign-miniprogram/switch/switch.js
@@ -36,9 +36,9 @@ let Switch = class Switch extends SuperComponent {
};
this.methods = {
handleSwitch() {
- const { disabled, value, customValue } = this.data;
+ const { loading, disabled, value, customValue } = this.data;
const [activeValue, inactiveValue] = customValue;
- if (disabled)
+ if (loading || disabled)
return;
this._trigger('change', {
value: value === activeValue ? inactiveValue : activeValue,
diff --git a/miniprogram_npm/tdesign-miniprogram/switch/switch.json b/miniprogram_npm/tdesign-miniprogram/switch/switch.json
index 708bd1b..a32e8cd 100644
--- a/miniprogram_npm/tdesign-miniprogram/switch/switch.json
+++ b/miniprogram_npm/tdesign-miniprogram/switch/switch.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon",
"t-loading": "../loading/loading"
diff --git a/miniprogram_npm/tdesign-miniprogram/switch/switch.wxml b/miniprogram_npm/tdesign-miniprogram/switch/switch.wxml
index 2cfc9ec..df9f312 100644
--- a/miniprogram_npm/tdesign-miniprogram/switch/switch.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/switch/switch.wxml
@@ -9,7 +9,7 @@
aria-role="switch"
>
- {{checked ? label[1] : label[0]}}
+ {{checked ? label[0] : label[1]}}
diff --git a/miniprogram_npm/tdesign-miniprogram/switch/switch.wxss b/miniprogram_npm/tdesign-miniprogram/switch/switch.wxss
index f69c959..d4f1949 100644
--- a/miniprogram_npm/tdesign-miniprogram/switch/switch.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/switch/switch.wxss
@@ -40,8 +40,8 @@
align-items: center;
justify-content: center;
flex-wrap: nowrap;
- font-size: var(--td-swtich-label-font-size, 28rpx);
- color: var(--td-switch-label-color, var(--td-font-gray-4, rgba(0, 0, 0, 0.26)));
+ font-size: var(--td-switch-label-font-size, 28rpx);
+ color: var(--td-switch-label-color, var(--td-bg-color-secondarycontainer-active, var(--td-gray-color-4, #dcdcdc)));
overflow: hidden;
}
.t-switch__label--checked {
@@ -54,10 +54,10 @@
color: var(--td-switch-checked-disabled-color, var(--td-brand-color-disabled, var(--td-primary-color-3, #b5c7ff)));
}
.t-switch__label--large {
- font-size: var(--td-swtich-label-font-size, 32rpx);
+ font-size: var(--td-switch-label-large-font-size, 32rpx);
}
.t-switch__label--small {
- font-size: var(--td-swtich-label-font-size, 24rpx);
+ font-size: var(--td-switch-label-small-font-size, 24rpx);
}
.t-switch__label:empty {
display: none;
@@ -79,7 +79,7 @@
width: var(--td-switch-width, 90rpx);
height: var(--td-switch-height, 56rpx);
border-radius: var(--td-switch-radius, calc(var(--td-switch-height, 56rpx) / 2));
- background-color: var(--td-switch-unchecked-color, var(--td-font-gray-4, rgba(0, 0, 0, 0.26)));
+ background-color: var(--td-switch-unchecked-color, var(--td-bg-color-secondarycontainer-active, var(--td-gray-color-4, #dcdcdc)));
position: relative;
transition: all 0.3s ease;
overflow: hidden;
@@ -110,7 +110,7 @@
width: var(--td-switch-dot-size, 44rpx);
height: var(--td-switch-dot-size, 44rpx);
border-radius: 50%;
- background-color: var(--td-bg-color-container, var(--td-font-white-1, #ffffff));
+ background-color: var(--td-text-color-anti, var(--td-font-white-1, #ffffff));
transition: all 0.3s;
transform: translateY(-50%);
box-shadow: var(--td-switch-dot-shadow, var(--td-shadow-1, 0 1px 10px rgba(0, 0, 0, 0.05), 0 4px 5px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.12)));
@@ -123,7 +123,7 @@
top: 0;
width: 200%;
height: 200%;
- border: 1px solid var(--td-switch-dot-border-color, var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3)));
+ border: 1px solid var(--td-switch-dot-border-color, var(--td-gray-color-4, #dcdcdc));
border-radius: 50%;
transform: scale(0.5);
transform-origin: 0 0;
diff --git a/miniprogram_npm/tdesign-miniprogram/switch/type.d.ts b/miniprogram_npm/tdesign-miniprogram/switch/type.d.ts
index 8ca8e81..eecf253 100644
--- a/miniprogram_npm/tdesign-miniprogram/switch/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/switch/type.d.ts
@@ -1,4 +1,4 @@
-export interface TdSwitchProps {
+export interface TdSwitchProps {
customValue?: {
type: ArrayConstructor;
value?: Array;
@@ -23,10 +23,6 @@ export interface TdSwitchProps {
type: StringConstructor;
value?: 'small' | 'medium' | 'large';
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
value?: {
type: null;
value?: SwitchValue;
diff --git a/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.json b/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.json
index 69017ce..0603787 100644
--- a/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.json
+++ b/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon",
"t-badge": "../badge/badge"
diff --git a/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxml b/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxml
index a12fa2c..972c508 100644
--- a/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxml
@@ -13,8 +13,13 @@
aria-selected="{{(!hasChildren || !isSpread) && isChecked ? true : false}}"
aria-expanded="{{hasChildren && isSpread ? true : ''}}"
aria-role="{{hasChildren ? 'button' : 'tab'}}"
+ aria-label="{{ ariaLabel || (badgeProps.dot || badgeProps.count ? _.getBadgeAriaLabel({ ...badgeProps }) : '') }}"
>
-
+
-
+
-
+
@@ -49,7 +50,7 @@
wx:for="{{subTabBar}}"
wx:for-item="child"
wx:for-index="index"
- wx:key="index"
+ wx:key="value"
bind:tap="selectChild"
data-value="{{child.value || index}}"
aria-role="tab"
diff --git a/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxss b/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxss
index 1d86356..45b7057 100644
--- a/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxss
@@ -25,6 +25,9 @@
bottom: 0;
transform: scale(1.5);
}
+:host {
+ flex: 1;
+}
.t-tab-bar-item {
flex: 1;
height: var(--td-tab-bar-height, 80rpx);
@@ -38,7 +41,7 @@
.t-tab-bar-item--text-only {
font-size: 32rpx;
}
-.t-tab-bar-item--split:before {
+.t-tab-bar-item--split + .t-tab-bar-item--split::before {
position: absolute;
box-sizing: border-box;
content: ' ';
@@ -65,7 +68,7 @@
align-items: center;
justify-content: center;
border-radius: 16rpx;
- color: var(--td-tab-bar-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-tab-bar-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-tab-bar-item__content--checked {
color: var(--td-tab-bar-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
@@ -77,8 +80,8 @@
.t-tab-bar-item__content--tag.t-tab-bar-item__content--checked {
background-color: var(--td-tab-bar-active-bg, var(--td-brand-color-light, var(--td-primary-color-1, #f2f3ff)));
}
-.t-tab-bar-item .t-badge-class {
- transform: translate(50%, -10%) !important;
+.t-tab-bar-item__icon:empty {
+ display: none;
}
.t-tab-bar-item__text {
display: flex;
@@ -100,7 +103,7 @@
transform: translate3d(0, calc(-100% - 32rpx), 0);
z-index: 1;
border-radius: 12rpx;
- color: var(--td-tab-bar-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-tab-bar-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
box-shadow: var(--td-tab-bar-spread-shadow, var(--td-shadow-3, 0 6px 30px 5px rgba(0, 0, 0, 0.05), 0 16px 24px 2px rgba(0, 0, 0, 0.04), 0 8px 10px -5px rgba(0, 0, 0, 0.08)));
}
.t-tab-bar-item__spread::before {
diff --git a/miniprogram_npm/tdesign-miniprogram/tab-bar-item/type.d.ts b/miniprogram_npm/tdesign-miniprogram/tab-bar-item/type.d.ts
index aa63763..6fbbd6c 100644
--- a/miniprogram_npm/tdesign-miniprogram/tab-bar-item/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/tab-bar-item/type.d.ts
@@ -4,13 +4,9 @@ export interface TdTabBarItemProps {
type: ObjectConstructor;
value?: BadgeProps;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
icon?: {
- type: StringConstructor;
- value?: string;
+ type: null;
+ value?: string | object;
};
subTabBar?: {
type: ArrayConstructor;
diff --git a/miniprogram_npm/tdesign-miniprogram/tab-bar/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/tab-bar/README.en-US.md
index f97ee85..127e5e0 100644
--- a/miniprogram_npm/tdesign-miniprogram/tab-bar/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/tab-bar/README.en-US.md
@@ -1,18 +1,20 @@
:: BASE_DOC ::
## API
+
### TabBar Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
bordered | Boolean | true | \- | N
-external-classes | Array | - | `['t-class']` | N
fixed | Boolean | true | \- | N
safe-area-inset-bottom | Boolean | true | \- | N
-shape | String | normal | options:normal/round | N
+shape | String | normal | options: normal/round | N
split | Boolean | true | \- | N
-theme | String | normal | options:normal/tag | N
-value | String / Number / Array | null | Typescript:`string \| number \| Array` | N
+theme | String | normal | options: normal/tag | N
+value | String / Number / Array | - | Typescript:`string \| number \| Array` | N
default-value | String / Number / Array | undefined | uncontrolled property。Typescript:`string \| number \| Array` | N
### TabBar Events
@@ -20,12 +22,37 @@ default-value | String / Number / Array | undefined | uncontrolled property。Ty
name | params | description
-- | -- | --
change | `(value: string \| number)` | \-
+### TabBar External Classes
+
+className | Description
+-- | --
+t-class | \-
+
### TabBarItem Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
badge-props | Object | - | Typescript:`BadgeProps`,[Badge API Documents](./badge?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-bar-item/type.ts) | N
-icon | String / Slot | - | \- | N
+icon | String / Object / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
sub-tab-bar | Array | - | Typescript:`SubTabBarItem[] ` `interface SubTabBarItem { value: string; label: string }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-bar-item/type.ts) | N
value | String / Number | - | \- | N
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-tab-bar-active-bg | @brand-color-light | -
+--td-tab-bar-active-color | @brand-color | -
+--td-tab-bar-bg-color | @bg-color-container | -
+--td-tab-bar-border-color | @border-color | -
+--td-tab-bar-color | @font-gray-1 | -
+--td-tab-bar-height | 80rpx | -
+--td-tab-bar-hover-bg-color | rgba(0, 0, 0, 0.05) | -
+--td-tab-bar-spread-border-color | @border-color | -
+--td-tab-bar-spread-shadow | @shadow-3 | -
+--td-tab-bar-border-color | @border-color | -
+--td-tab-bar-round-shadow | @shadow-3 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/tab-bar/README.md b/miniprogram_npm/tdesign-miniprogram/tab-bar/README.md
index 69aa9f3..be4f7e0 100644
--- a/miniprogram_npm/tdesign-miniprogram/tab-bar/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/tab-bar/README.md
@@ -19,6 +19,13 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
+
### 组件类型
#### 纯文本标签栏
@@ -30,7 +37,7 @@ isComponent: true
#### 纯图标标签栏
-{{ text-only }}
+{{ icon-only }}
#### 双层级纯文本标签栏
@@ -51,18 +58,20 @@ isComponent: true
{{ custom }}
## API
+
### TabBar Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
bordered | Boolean | true | 是否显示外边框 | N
-external-classes | Array | - | 组件类名,用于设置外层元素类名。`['t-class']` | N
fixed | Boolean | true | 是否固定在底部 | N
safe-area-inset-bottom | Boolean | true | 是否为 iPhoneX 留出底部安全距离 | N
shape | String | normal | 标签栏的形状。可选项:normal/round | N
split | Boolean | true | 是否需要分割线 | N
theme | String | normal | 选项风格。可选项:normal/tag | N
-value | String / Number / Array | null | 当前选中标签的索引。TS 类型:`string \| number \| Array` | N
+value | String / Number / Array | - | 当前选中标签的索引。TS 类型:`string \| number \| Array` | N
default-value | String / Number / Array | undefined | 当前选中标签的索引。非受控属性。TS 类型:`string \| number \| Array` | N
### TabBar Events
@@ -70,12 +79,37 @@ default-value | String / Number / Array | undefined | 当前选中标签的索
名称 | 参数 | 描述
-- | -- | --
change | `(value: string \| number)` | 选中标签切换时触发
+### TabBar External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+
### TabBarItem Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
badge-props | Object | - | 图标右上角提示信息。TS 类型:`BadgeProps`,[Badge API Documents](./badge?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-bar-item/type.ts) | N
-icon | String / Object / Slot | - | 图标名称。传入对象时透传至 Icon 组件 | N
+icon | String / Object / Slot | - | 图标名称。传入对象时透传至 Icon 组件。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
sub-tab-bar | Array | - | 二级菜单。TS 类型:`SubTabBarItem[] ` `interface SubTabBarItem { value: string; label: string }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-bar-item/type.ts) | N
value | String / Number | - | 标识符 | N
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-tab-bar-active-bg | @brand-color-light | -
+--td-tab-bar-active-color | @brand-color | -
+--td-tab-bar-bg-color | @bg-color-container | -
+--td-tab-bar-border-color | @border-color | -
+--td-tab-bar-color | @font-gray-1 | -
+--td-tab-bar-height | 80rpx | -
+--td-tab-bar-hover-bg-color | rgba(0, 0, 0, 0.05) | -
+--td-tab-bar-spread-border-color | @border-color | -
+--td-tab-bar-spread-shadow | @shadow-3 | -
+--td-tab-bar-border-color | @border-color | -
+--td-tab-bar-round-shadow | @shadow-3 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/tab-bar/props.js b/miniprogram_npm/tdesign-miniprogram/tab-bar/props.js
index 85d7f7f..1f26596 100644
--- a/miniprogram_npm/tdesign-miniprogram/tab-bar/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/tab-bar/props.js
@@ -32,7 +32,6 @@ const props = {
},
defaultValue: {
type: null,
- value: null,
},
};
export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.json b/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.json
index a89ef4d..4f0a3f0 100644
--- a/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.json
+++ b/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.json
@@ -1,4 +1,5 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.wxss b/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.wxss
index 4c44250..8b7f4c7 100644
--- a/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.wxss
@@ -43,8 +43,9 @@
right: 0;
left: 0;
top: 0;
- border-top: 1px solid var(--td-tab-bar-border-color, var(--td-border-color, var(--td-gray-color-3, #e7e7e7)));
+ border-top: 1px solid var(--td-tab-bar-border-color, var(--td-border-level-1-color, var(--td-gray-color-3, #e7e7e7)));
transform: scaleY(0.5);
+ transform-origin: 0 0;
}
.t-tab-bar--fixed {
position: fixed;
@@ -66,7 +67,3 @@
bottom: constant(safe-area-inset-bottom);
bottom: env(safe-area-inset-bottom);
}
-.t-tab-bar--fixed.t-tab-bar--round.t-tab-bar--safe {
- bottom: constant(safe-area-inset-bottom);
- bottom: env(safe-area-inset-bottom);
-}
diff --git a/miniprogram_npm/tdesign-miniprogram/tab-bar/type.d.ts b/miniprogram_npm/tdesign-miniprogram/tab-bar/type.d.ts
index 39e05ee..32ec1d8 100644
--- a/miniprogram_npm/tdesign-miniprogram/tab-bar/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/tab-bar/type.d.ts
@@ -3,10 +3,6 @@ export interface TdTabBarProps {
type: BooleanConstructor;
value?: boolean;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
externalClasses?: {
type: ArrayConstructor;
value?: ['t-class'];
diff --git a/miniprogram_npm/tdesign-miniprogram/tab-panel/props.js b/miniprogram_npm/tdesign-miniprogram/tab-panel/props.js
index b9e29e0..36216ca 100644
--- a/miniprogram_npm/tdesign-miniprogram/tab-panel/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/tab-panel/props.js
@@ -1,11 +1,6 @@
const props = {
badgeProps: {
type: Object,
- value: null,
- },
- destroyOnHide: {
- type: Boolean,
- value: true,
},
disabled: {
type: Boolean,
diff --git a/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.d.ts b/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.d.ts
index 54836de..c146e28 100644
--- a/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.d.ts
@@ -1,7 +1,11 @@
+///
import { SuperComponent, RelationsOptions } from '../common/src/index';
export default class TabPanel extends SuperComponent {
externalClasses: string[];
relations: RelationsOptions;
+ options: {
+ multipleSlots: boolean;
+ };
properties: import("./type").TdTabPanelProps;
data: {
prefix: string;
@@ -16,5 +20,5 @@ export default class TabPanel extends SuperComponent {
};
getComputedName(): string;
update(): void;
- render(active: Boolean, parent: any): void;
+ render(active: Boolean, parent: WechatMiniprogram.Component.TrivialInstance): void;
}
diff --git a/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.js b/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.js
index 9db61e6..22d5c3d 100644
--- a/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.js
+++ b/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.js
@@ -18,6 +18,9 @@ let TabPanel = class TabPanel extends SuperComponent {
type: 'ancestor',
},
};
+ this.options = {
+ multipleSlots: true,
+ };
this.properties = props;
this.data = {
prefix,
@@ -46,9 +49,10 @@ let TabPanel = class TabPanel extends SuperComponent {
(_a = this.$parent) === null || _a === void 0 ? void 0 : _a.updateTabs();
}
render(active, parent) {
+ this.initialized = this.initialized || active;
this.setData({
active,
- hide: !parent.animated && !active,
+ hide: !parent.data.animation && !active,
});
}
};
diff --git a/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.json b/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.json
index a89ef4d..4f0a3f0 100644
--- a/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.json
+++ b/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.json
@@ -1,4 +1,5 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.wxml b/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.wxml
index 7bcb902..5327c0e 100644
--- a/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.wxml
@@ -1,7 +1,7 @@
`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N
-external-classes | Array | - | `['t-class', 't-class-item', 't-class-active', 't-class-track']` | N
+middle | Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
show-bottom-line | Boolean | true | \- | N
space-evenly | Boolean | true | \- | N
+split | Boolean | true | \- | N
sticky | Boolean | false | \- | N
sticky-props | Object | - | Typescript:`StickyProps`,[Sticky API Documents](./sticky?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N
swipeable | Boolean | true | \- | N
-theme | String | line | options:line/tag/card | N
+theme | String | line | options: line/tag/card | N
value | String / Number | - | Typescript:`TabValue` `type TabValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N
default-value | String / Number | undefined | uncontrolled property。Typescript:`TabValue` `type TabValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N
@@ -23,15 +27,49 @@ name | params | description
change | `(value: TabValue, label: string)` | \-
click | `(value: TabValue, label: string)` | \-
scroll | `(scrollTop: number, isFixed: boolean)` | \-
+### Tabs External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-active | \-
+t-class-content | \-
+t-class-item | \-
+t-class-track | \-
+
### TabPanel Props
name | type | default | description | required
-- | -- | -- | -- | --
-badge-props | Object | null | \- | N
-destroy-on-hide | Boolean | true | \- | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+badge-props | Object | - | \- | N
disabled | Boolean | false | \- | N
-icon | String / Object | - | `1.0.0-rc.1` | N
+icon | String / Object | - | \- | N
label | String | - | \- | N
-panel | String / Slot | - | \- | N
+panel | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
value | String / Number | - | Typescript:`TabValue`,[Tabs API Documents](./tabs?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-panel/type.ts) | N
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-tab-border-color | @component-stroke | -
+--td-tab-font-size | 28rpx | -
+--td-tab-icon-size | 36rpx | -
+--td-tab-item-active-color | @brand-color | -
+--td-tab-item-color | @font-gray-1 | -
+--td-tab-item-disabled-color | @font-gray-4 | -
+--td-tab-item-height | 96rpx | -
+--td-tab-item-tag-active-bg | @brand-color-light | -
+--td-tab-item-tag-bg | @bg-color-secondarycontainer | -
+--td-tab-item-tag-height | 64rpx | -
+--td-tab-item-vertical-height | 108rpx | -
+--td-tab-item-vertical-width | 208rpx | -
+--td-tab-nav-bg-color | @bg-color-container | -
+--td-tab-track-color | @brand-color | -
+--td-tab-track-radius | 8rpx | -
+--td-tab-track-thickness | 6rpx | -
+--td-tab-track-width | 32rpx | -
diff --git a/miniprogram_npm/tdesign-miniprogram/tabs/README.md b/miniprogram_npm/tdesign-miniprogram/tabs/README.md
index e95887f..9a60ce7 100644
--- a/miniprogram_npm/tdesign-miniprogram/tabs/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/tabs/README.md
@@ -19,6 +19,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 基础选项卡
{{ base }}
@@ -108,14 +114,18 @@ Page({
```
## API
+
### Tabs Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-animation | Object | - | 动画效果设置。其中 duration 表示动画时长。TS 类型:`TabAnimation` `type TabAnimation = { duration: number } & Record`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N
-external-classes | Array | - | 组件类名,分别用于设置 组件外层元素、选项卡单项、选项卡激活态、滚动条样式类名 等类名。`['t-class', 't-class-item', 't-class-active', 't-class-track']` | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+animation | Object | - | 动画效果设置。其中 duration 表示动画时长。(单位:秒)。TS 类型:`TabAnimation` `type TabAnimation = { duration: number } & Record`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N
+middle | Slot | - | 中间内容,介于头部和内容之间。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
show-bottom-line | Boolean | true | 是否展示底部激活线条 | N
space-evenly | Boolean | true | 选项卡头部空间是否均分 | N
+split | Boolean | true | `1.1.10`。是否展示分割线 | N
sticky | Boolean | false | 是否开启粘性布局 | N
sticky-props | Object | - | 透传至 Sticky 组件。TS 类型:`StickyProps`,[Sticky API Documents](./sticky?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N
swipeable | Boolean | true | 是否可以滑动切换 | N
@@ -130,15 +140,49 @@ default-value | String / Number | undefined | 激活的选项卡值。非受控
change | `(value: TabValue, label: string)` | 激活的选项卡发生变化时触发
click | `(value: TabValue, label: string)` | 点击选项卡时触发
scroll | `(scrollTop: number, isFixed: boolean)` | 页面滚动时触发
+### Tabs External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-active | 激活态样式类
+t-class-content | 内容样式类
+t-class-item | 选项样式类
+t-class-track | 滚动条样式类
+
### TabPanel Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-badge-props | Object | null | 透传至 Badge 组件 | N
-destroy-on-hide | Boolean | true | 【实现有误,暂不支持】选项卡内容隐藏时是否销毁 | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+badge-props | Object | - | 透传至 Badge 组件 | N
disabled | Boolean | false | 是否禁用当前选项卡 | N
icon | String / Object | - | `1.0.0-rc.1`。图标,传对象则透传至 Icon | N
label | String | - | 选项卡名称 | N
-panel | String / Slot | - | 用于自定义选项卡面板内容 | N
+panel | String / Slot | - | 用于自定义选项卡面板内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
value | String / Number | - | 选项卡的值,唯一标识。TS 类型:`TabValue`,[Tabs API Documents](./tabs?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tab-panel/type.ts) | N
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-tab-border-color | @component-stroke | -
+--td-tab-font-size | 28rpx | -
+--td-tab-icon-size | 36rpx | -
+--td-tab-item-active-color | @brand-color | -
+--td-tab-item-color | @font-gray-1 | -
+--td-tab-item-disabled-color | @font-gray-4 | -
+--td-tab-item-height | 96rpx | -
+--td-tab-item-tag-active-bg | @brand-color-light | -
+--td-tab-item-tag-bg | @bg-color-secondarycontainer | -
+--td-tab-item-tag-height | 64rpx | -
+--td-tab-item-vertical-height | 108rpx | -
+--td-tab-item-vertical-width | 208rpx | -
+--td-tab-nav-bg-color | @bg-color-container | -
+--td-tab-track-color | @brand-color | -
+--td-tab-track-radius | 8rpx | -
+--td-tab-track-thickness | 6rpx | -
+--td-tab-track-width | 32rpx | -
diff --git a/miniprogram_npm/tdesign-miniprogram/tabs/props.js b/miniprogram_npm/tdesign-miniprogram/tabs/props.js
index 9d515f7..9caa438 100644
--- a/miniprogram_npm/tdesign-miniprogram/tabs/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/tabs/props.js
@@ -13,6 +13,10 @@ const props = {
type: Boolean,
value: true,
},
+ split: {
+ type: Boolean,
+ value: true,
+ },
sticky: {
type: Boolean,
value: false,
diff --git a/miniprogram_npm/tdesign-miniprogram/tabs/tabs.d.ts b/miniprogram_npm/tdesign-miniprogram/tabs/tabs.d.ts
index 65f61ae..1efdbf6 100644
--- a/miniprogram_npm/tdesign-miniprogram/tabs/tabs.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/tabs/tabs.d.ts
@@ -3,6 +3,9 @@ import { TdTabsProps } from './type';
export interface TabsProps extends TdTabsProps {
}
export default class Tabs extends SuperComponent {
+ options: {
+ pureDataPattern: RegExp;
+ };
behaviors: string[];
externalClasses: string[];
relations: RelationsOptions;
@@ -18,11 +21,11 @@ export default class Tabs extends SuperComponent {
prefix: string;
classPrefix: string;
tabs: any[];
+ currentLabels: any[];
currentIndex: number;
trackStyle: string;
- isScrollX: boolean;
- direction: string;
offset: number;
+ scrollLeft: number;
tabID: string;
placement: string;
};
@@ -32,11 +35,13 @@ export default class Tabs extends SuperComponent {
};
initChildId(): void;
methods: {
+ onScroll(e: any): void;
updateTabs(cb: any): void;
setCurrentIndexByName(name: any): void;
setCurrentIndex(index: number): void;
getCurrentName(): any;
calcScrollOffset(containerWidth: number, targetLeft: number, targetWidth: number, offset: number): number;
+ getTabHeight(): Promise;
getTrackSize(): Promise;
setTrack(): Promise;
onTabTap(event: any): void;
diff --git a/miniprogram_npm/tdesign-miniprogram/tabs/tabs.js b/miniprogram_npm/tdesign-miniprogram/tabs/tabs.js
index 77c8b7d..25efd5a 100644
--- a/miniprogram_npm/tdesign-miniprogram/tabs/tabs.js
+++ b/miniprogram_npm/tdesign-miniprogram/tabs/tabs.js
@@ -18,14 +18,24 @@ import props from './props';
import config from '../common/config';
import touch from '../mixins/touch';
import { getRect, uniqueFactory } from '../common/utils';
+import { getObserver } from '../common/wechat';
const { prefix } = config;
const name = `${prefix}-tabs`;
const getUniqueID = uniqueFactory('tabs');
let Tabs = class Tabs extends SuperComponent {
constructor() {
super(...arguments);
+ this.options = {
+ pureDataPattern: /^currentLabels$/,
+ };
this.behaviors = [touch];
- this.externalClasses = [`${prefix}-class`, `${prefix}-class-item`, `${prefix}-class-active`, `${prefix}-class-track`];
+ this.externalClasses = [
+ `${prefix}-class`,
+ `${prefix}-class-item`,
+ `${prefix}-class-active`,
+ `${prefix}-class-track`,
+ `${prefix}-class-content`,
+ ];
this.relations = {
'../tab-panel/tab-panel': {
type: 'descendant',
@@ -60,11 +70,11 @@ let Tabs = class Tabs extends SuperComponent {
prefix,
classPrefix: name,
tabs: [],
+ currentLabels: [],
currentIndex: -1,
trackStyle: '',
- isScrollX: true,
- direction: 'X',
offset: 0,
+ scrollLeft: 0,
tabID: '',
placement: 'top',
};
@@ -85,6 +95,12 @@ let Tabs = class Tabs extends SuperComponent {
},
};
this.methods = {
+ onScroll(e) {
+ const { scrollLeft } = e.detail;
+ this.setData({
+ scrollLeft,
+ });
+ },
updateTabs(cb) {
const { children } = this;
const tabs = children.map((child) => child.data);
@@ -106,18 +122,23 @@ let Tabs = class Tabs extends SuperComponent {
setCurrentIndex(index) {
if (index <= -1 || index >= this.children.length)
return;
+ const Labels = [];
this.children.forEach((child, idx) => {
const isActive = index === idx;
- if (isActive !== child.data.active) {
+ if (isActive !== child.data.active || !child.initialized) {
child.render(isActive, this);
}
+ Labels.push(child.data.label);
});
- if (this.data.currentIndex === index)
+ const { currentIndex, currentLabels } = this.data;
+ if (currentIndex === index && currentLabels.join('') === Labels.join(''))
return;
this.setData({
currentIndex: index,
+ currentLabels: Labels,
+ }, () => {
+ this.setTrack();
});
- this.setTrack();
},
getCurrentName() {
if (this.children) {
@@ -130,28 +151,31 @@ let Tabs = class Tabs extends SuperComponent {
calcScrollOffset(containerWidth, targetLeft, targetWidth, offset) {
return offset + targetLeft - (1 / 2) * containerWidth + targetWidth / 2;
},
+ getTabHeight() {
+ return getRect(this, `.${name}`);
+ },
getTrackSize() {
- return new Promise((resolve) => {
+ return new Promise((resolve, reject) => {
if (this.trackWidth) {
resolve(this.trackWidth);
return;
}
- getRect(this, `.${prefix}-tabs__track`).then((res) => {
+ getRect(this, `.${prefix}-tabs__track`)
+ .then((res) => {
if (res) {
this.trackWidth = res.width;
resolve(this.trackWidth);
}
- });
+ })
+ .catch(reject);
});
},
setTrack() {
return __awaiter(this, void 0, void 0, function* () {
- if (!this.properties.showBottomLine)
- return;
const { children } = this;
if (!children)
return;
- const { currentIndex, isScrollX, direction } = this.data;
+ const { currentIndex } = this.data;
if (currentIndex <= -1)
return;
try {
@@ -164,30 +188,30 @@ let Tabs = class Tabs extends SuperComponent {
let totalSize = 0;
res.forEach((item) => {
if (count < currentIndex) {
- distance += isScrollX ? item.width : item.height;
+ distance += item.width;
count += 1;
}
- totalSize += isScrollX ? item.width : item.height;
+ totalSize += item.width;
});
if (this.containerWidth) {
- const offset = this.calcScrollOffset(this.containerWidth, rect.left, rect.width, this.data.offset);
+ const offset = this.calcScrollOffset(this.containerWidth, rect.left, rect.width, this.data.scrollLeft);
const maxOffset = totalSize - this.containerWidth;
this.setData({
offset: Math.min(Math.max(offset, 0), maxOffset),
});
}
- if (isScrollX) {
+ else if (!this._hasObserved) {
+ this._hasObserved = true;
+ getObserver(this, `.${name}`).then(() => this.setTrack());
+ }
+ if (this.data.theme === 'line') {
const trackLineWidth = yield this.getTrackSize();
distance += (rect.width - trackLineWidth) / 2;
}
- let trackStyle = `-webkit-transform: translate${direction}(${distance}px);
- transform: translate${direction}(${distance}px);
- `;
- if (!isScrollX) {
- trackStyle += `height: ${rect.height}px;`;
- }
this.setData({
- trackStyle,
+ trackStyle: `-webkit-transform: translateX(${distance}px);
+ transform: translateX(${distance}px);
+ `,
});
}
catch (err) {
@@ -238,8 +262,13 @@ let Tabs = class Tabs extends SuperComponent {
const len = tabs.length;
for (let i = step; currentIndex + step >= 0 && currentIndex + step < len; i += step) {
const newIndex = currentIndex + i;
- if (newIndex >= 0 && newIndex < len && tabs[newIndex] && !tabs[newIndex].disabled) {
- return newIndex;
+ if (newIndex >= 0 && newIndex < len && tabs[newIndex]) {
+ if (!tabs[newIndex].disabled) {
+ return newIndex;
+ }
+ }
+ else {
+ return currentIndex;
}
}
return -1;
diff --git a/miniprogram_npm/tdesign-miniprogram/tabs/tabs.json b/miniprogram_npm/tdesign-miniprogram/tabs/tabs.json
index 0570f9a..f9b94db 100644
--- a/miniprogram_npm/tdesign-miniprogram/tabs/tabs.json
+++ b/miniprogram_npm/tdesign-miniprogram/tabs/tabs.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-sticky": "../sticky/sticky",
"t-badge": "../badge/badge",
diff --git a/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxml b/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxml
index b271aff..9008e9b 100644
--- a/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxml
@@ -14,14 +14,19 @@
>
-
+
-
+
@@ -52,6 +61,7 @@
+
diff --git a/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxs b/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxs
index cb51149..b3f1e42 100644
--- a/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxs
+++ b/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxs
@@ -5,11 +5,7 @@ function animate(options) {
if (options.duration) {
result.push('transition-duration: ' + options.duration + 's');
- result.push(
- options.direction === 'Y'
- ? ';transform: translate3d( 0,' + -100 * options.currentIndex + '%, 0)'
- : ';transform: translate3d( ' + -100 * options.currentIndex + '%,0, 0)',
- );
+ result.push('transform: translate3d( ' + -100 * options.currentIndex + '%,0, 0)');
}
return result.join(';');
diff --git a/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxss b/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxss
index b408dce..8cc591b 100644
--- a/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxss
@@ -27,8 +27,9 @@
}
.t-tabs {
position: relative;
- font-size: var(--tab-font-size, 28rpx);
+ font-size: var(--td-tab-font-size, 28rpx);
background: var(--td-tab-nav-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
+ flex-wrap: wrap;
}
.t-tabs__wrapper {
display: flex;
@@ -36,7 +37,7 @@
background: var(--td-tab-nav-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
}
.t-tabs__wrapper--card {
- background: var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3));
+ background: var(--td-tab-item-tag-bg, var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3)));
--td-tab-border-color: transparent;
}
.t-tabs__item {
@@ -46,25 +47,22 @@
align-items: center;
justify-content: center;
font-weight: 400;
- color: var(--td-tab-item-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
- padding: 0 32rpx;
+ color: var(--td-tab-item-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
+ padding: 0 var(--td-spacer-2, 32rpx);
box-sizing: border-box;
white-space: nowrap;
overflow: hidden;
+ height: var(--td-tab-item-height, 96rpx);
}
.t-tabs__item--active {
font-weight: 600;
color: var(--td-tab-item-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
}
.t-tabs__item--disabled {
- color: var(--td-tab-item-disabled-color, var(--td-font-gray-4, rgba(0, 0, 0, 0.26)));
+ color: var(--td-tab-item-disabled-color, var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26))));
}
.t-tabs__item--evenly {
- flex: 1;
-}
-.t-tabs__item--top,
-.t-tabs__item--bottom {
- height: var(--td-tab-item-height, 96rpx);
+ flex: 1 0 auto;
}
.t-tabs__item-inner {
display: flex;
@@ -74,7 +72,7 @@
.t-tabs__item-inner--tag {
width: 100%;
text-align: center;
- padding: 0 32rpx;
+ padding: 0 var(--td-spacer-2, 32rpx);
line-height: var(--td-tab-item-tag-height, 64rpx);
border-radius: calc(var(--td-tab-item-tag-height, 64rpx) / 2);
background-color: var(--td-tab-item-tag-bg, var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3)));
@@ -83,20 +81,20 @@
background-color: var(--td-tab-item-tag-active-bg, var(--td-brand-color-light, var(--td-primary-color-1, #f2f3ff)));
}
.t-tabs__item--tag:not(.t-tabs__item--evenly) {
- padding: 0 8rpx;
+ padding: 0 calc(var(--td-spacer, 16rpx) / 2);
}
.t-tabs__item--tag:not(.t-tabs__item--evenly):first-child {
- margin-left: 16rpx;
+ margin-left: var(--td-spacer, 16rpx);
}
.t-tabs__item--tag:not(.t-tabs__item--evenly):last-child {
- padding-right: 24rpx;
+ padding-right: var(--td-spacer-1, 24rpx);
}
.t-tabs__item--tag {
- padding: 0 16rpx;
+ padding: 0 var(--td-spacer, 16rpx);
}
.t-tabs__item--card.t-tabs__item--active {
- background-color: var(--td-bg-color-container, var(--td-font-white-1, #ffffff));
- border-radius: 18rpx 18rpx 0 0;
+ background-color: var(--td-tab-nav-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
+ border-radius: var(--td-radius-large, 18rpx) var(--td-radius-large, 18rpx) 0 0;
}
.t-tabs__item--card.t-tabs__item--active:first-child {
border-top-left-radius: 0;
@@ -105,15 +103,15 @@
border-top-right-radius: 0;
}
.t-tabs__item--card.t-tabs__item--pre {
- border-bottom-right-radius: 18rpx;
+ border-bottom-right-radius: var(--td-radius-large, 18rpx);
}
.t-tabs__item-prefix,
.t-tabs__item-suffix {
position: absolute;
bottom: 0;
- width: 36rpx;
- height: 36rpx;
- background: #fff;
+ width: 18rpx;
+ height: 18rpx;
+ background-color: var(--td-tab-nav-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
}
.t-tabs__item-prefix::after,
.t-tabs__item-suffix::after {
@@ -121,23 +119,23 @@
display: block;
width: 100%;
height: 100%;
- background-color: var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3));
+ background-color: var(--td-tab-item-tag-bg, var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3)));
}
.t-tabs__item-prefix {
right: 0;
}
.t-tabs__item-prefix::after {
- border-bottom-right-radius: 18rpx;
+ border-bottom-right-radius: var(--td-radius-large, 18rpx);
}
.t-tabs__item-suffix {
left: 0;
}
.t-tabs__item-suffix::after {
- border-bottom-left-radius: 18rpx;
+ border-bottom-left-radius: var(--td-radius-large, 18rpx);
}
.t-tabs__icon {
font-size: var(--td-tab-icon-size, 36rpx);
- margin-right: 4rpx;
+ margin-right: calc(var(--td-spacer, 16rpx) / 4);
}
.t-tabs__content {
overflow: hidden;
@@ -145,35 +143,33 @@
.t-tabs__nav {
position: relative;
user-select: none;
- width: 100%;
display: flex;
flex-wrap: nowrap;
align-items: center;
}
+.t-tabs__nav.t-tabs__nav--evenly {
+ width: 100%;
+}
.t-tabs__track {
position: absolute;
font-weight: 600;
z-index: 1;
transition-duration: 0.3s;
background-color: var(--td-tab-track-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
-}
-.t-tabs__track--top,
-.t-tabs__track--bottom {
left: 0;
bottom: 1rpx;
width: var(--td-tab-track-width, 32rpx);
height: var(--td-tab-track-thickness, 6rpx);
border-radius: var(--td-tab-track-radius, 8rpx);
}
-.t-tabs__scroll--top,
-.t-tabs__scroll--bottom {
+.t-tabs__scroll {
+ position: relative;
height: var(--td-tab-item-height, 96rpx);
+}
+.t-tabs__scroll--split {
position: relative;
}
-.t-tabs__scroll--top {
- position: relative;
-}
-.t-tabs__scroll--top::after {
+.t-tabs__scroll--split::after {
content: '';
display: block;
position: absolute;
@@ -183,25 +179,22 @@
right: unset;
background-color: var(--td-tab-border-color, var(--td-component-stroke, var(--td-gray-color-3, #e7e7e7)));
}
-.t-tabs__scroll--top::after {
+.t-tabs__scroll--split::after {
height: 1px;
left: 0;
right: 0;
transform: scaleY(0.5);
}
+.t-tabs__scroll::-webkit-scrollbar {
+ display: none;
+}
+.t-tabs__content {
+ width: 100%;
+}
.t-tabs__content-inner {
display: block;
}
-.t-tabs--top,
-.t-tabs--bottom {
- flex-wrap: wrap;
-}
-.t-tabs--top .t-tabs__content,
-.t-tabs--bottom .t-tabs__content {
- width: 100%;
-}
-.t-tabs--top .t-tabs__content--animated .t-tabs__content-inner,
-.t-tabs--bottom .t-tabs__content--animated .t-tabs__content-inner {
+.t-tabs__content--animated .t-tabs__content-inner {
position: relative;
width: 100%;
height: 100%;
@@ -209,6 +202,3 @@
will-change: left;
transition-property: transform;
}
-.t-tabs--bottom {
- flex-direction: column-reverse;
-}
diff --git a/miniprogram_npm/tdesign-miniprogram/tabs/type.d.ts b/miniprogram_npm/tdesign-miniprogram/tabs/type.d.ts
index d3343bb..2e0a946 100644
--- a/miniprogram_npm/tdesign-miniprogram/tabs/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/tabs/type.d.ts
@@ -4,10 +4,6 @@ export interface TdTabsProps {
type: ObjectConstructor;
value?: TabAnimation;
};
- style?: {
- type: StringConstructor;
- value?: string;
- };
externalClasses?: {
type: ArrayConstructor;
value?: ['t-class', 't-class-item', 't-class-active', 't-class-track'];
@@ -20,6 +16,10 @@ export interface TdTabsProps {
type: BooleanConstructor;
value?: boolean;
};
+ split?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
sticky?: {
type: BooleanConstructor;
value?: boolean;
diff --git a/miniprogram_npm/tdesign-miniprogram/tag/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/tag/README.en-US.md
index 99fa354..27af848 100644
--- a/miniprogram_npm/tdesign-miniprogram/tag/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/tag/README.en-US.md
@@ -1,19 +1,21 @@
:: BASE_DOC ::
## API
+
### Tag Props
name | type | default | description | required
-- | -- | -- | -- | --
-closable | Boolean | false | \- | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+closable | Boolean / Object / Slot | false | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
disabled | Boolean | false | \- | N
-external-classes | Array | - | `['t-class']` | N
-icon | String / Object / Slot | - | \- | N
+icon | String / Object / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
max-width | String / Number | - | \- | N
-shape | String | square | options:square/round/mark | N
-size | String | medium | options:small/medium/large/extra-large。Typescript:`SizeEnum` | N
-theme | String | default | options:default/primary/warning/danger/success | N
-variant | String | dark | options:dark/light/outline/light-outline | N
+shape | String | square | options: square/round/mark | N
+size | String | medium | options: small/medium/large/extra-large | N
+theme | String | default | options: default/primary/warning/danger/success | N
+variant | String | dark | options: dark/light/outline/light-outline | N
### Tag Events
@@ -21,21 +23,28 @@ name | params | description
-- | -- | --
click | - | \-
close | - | \-
+### Tag External Classes
+
+className | Description
+-- | --
+t-class | \-
+
### CheckTag Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
checked | Boolean | undefined | \- | N
default-checked | Boolean | undefined | uncontrolled property | N
-closable | Boolean | false | `deprecated` | N
+closable | Boolean | false | \- | N
content | String / Number / Array / Slot | - | Typescript:`string \| number \| string[]` | N
disabled | Boolean | false | \- | N
-external-classes | Array | - | `['t-class']` | N
-icon | String / Object / Slot | - | \- | N
-shape | String | square | `deprecated`。options:square/round/mark | N
-size | String | medium | options:small/medium/large。Typescript:`SizeEnum` | N
-variant | String | dark | `0.26.0`。options:dark/light/outline/light-outline | N
+icon | String / Object / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+shape | String | square | options: square/round/mark | N
+size | String | medium | options: small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+variant | String | dark | `0.26.0`。options: dark/light/outline/light-outline | N
### CheckTag Events
@@ -43,3 +52,49 @@ name | params | description
-- | -- | --
change | `(checked: boolean)` | \-
click | - | \-
+close | \- | \-
+### CheckTag External Classes
+
+className | Description
+-- | --
+t-class | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-tag-close-icon-color | @font-gray-3 | -
+--td-tag-danger-color | @error-color | -
+--td-tag-danger-light-color | @error-color-1 | -
+--td-tag-default-color | @bg-color-component | -
+--td-tag-default-font-color | @font-gray-1 | -
+--td-tag-default-light-color | @bg-color-secondarycontainer | -
+--td-tag-disabled-background-color | @bg-color-component-disabled | -
+--td-tag-disabled-border-color | @component-border | -
+--td-tag-disabled-color | @font-gray-4 | -
+--td-tag-extra-large-font-size | @font-size-base | -
+--td-tag-extra-large-height | 80rpx | -
+--td-tag-extra-large-icon-size | 32rpx | -
+--td-tag-extra-large-padding | 32rpx - 1px | -
+--td-tag-large-font-size | @font-size-base | -
+--td-tag-large-height | 56rpx | -
+--td-tag-large-icon-size | 32rpx | -
+--td-tag-large-padding | 16rpx - 1px | -
+--td-tag-mark-border-radius | @tag-round-border-radius | -
+--td-tag-medium-font-size | @font-size-s | -
+--td-tag-medium-height | 48rpx | -
+--td-tag-medium-icon-size | 28rpx | -
+--td-tag-medium-padding | 16rpx - 1px | -
+--td-tag-outline-bg-color | @bg-color-container | -
+--td-tag-primary-color | @brand-color | -
+--td-tag-primary-light-color | @brand-color-light | -
+--td-tag-round-border-radius | 999px | -
+--td-tag-small-font-size | @font-size | -
+--td-tag-small-height | 40rpx | -
+--td-tag-small-icon-size | 24rpx | -
+--td-tag-small-padding | 12rpx - 1px | -
+--td-tag-square-border-radius | 8rpx | -
+--td-tag-success-color | @success-color | -
+--td-tag-success-light-color | @success-color-1 | -
+--td-tag-warning-color | @warning-color | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/tag/README.md b/miniprogram_npm/tdesign-miniprogram/tag/README.md
index fe426df..2f21c3d 100644
--- a/miniprogram_npm/tdesign-miniprogram/tag/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/tag/README.md
@@ -19,6 +19,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
{{ type }}
@@ -43,17 +49,19 @@ isComponent: true
## API
+
### Tag Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-closable | Boolean | false | 标签是否可关闭 | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+closable | Boolean / Object / Slot | false | 标签是否可关闭。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
disabled | Boolean | false | 标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态 | N
-external-classes | Array | - | 组件类名,用于设置 组件外层元素元素类名。`['t-class']` | N
-icon | String / Object / Slot | - | 标签中的图标,可自定义图标呈现 | N
+icon | String / Object / Slot | - | 标签中的图标,可自定义图标呈现。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
max-width | String / Number | - | 标签最大宽度,宽度超出后会出现省略号。示例:'50px' / 80 | N
shape | String | square | 标签类型,有三种:方形、圆角方形、标记型。可选项:square/round/mark | N
-size | String | medium | 标签尺寸。可选项:small/medium/large/extra-large。TS 类型:`SizeEnum` | N
+size | String | medium | 标签尺寸。可选项:small/medium/large/extra-large | N
theme | String | default | 组件风格,用于描述组件不同的应用场景。可选项:default/primary/warning/danger/success | N
variant | String | dark | 标签风格变体。可选项:dark/light/outline/light-outline | N
@@ -63,20 +71,27 @@ variant | String | dark | 标签风格变体。可选项:dark/light/outline/li
-- | -- | --
click | - | 点击时触发
close | - | 如果关闭按钮存在,点击关闭按钮时触发
+### Tag External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+
### CheckTag Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
checked | Boolean | undefined | 标签选中的状态,默认风格(theme=default)才有选中态 | N
default-checked | Boolean | undefined | 标签选中的状态,默认风格(theme=default)才有选中态。非受控属性 | N
-closable | Boolean | false | 已废弃。标签是否可关闭 | N
+closable | Boolean | false | 标签是否可关闭 | N
content | String / Number / Array / Slot | - | 组件子元素;传入数组时:[选中内容,非选中内容]。TS 类型:`string \| number \| string[]` | N
disabled | Boolean | false | 标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态 | N
-external-classes | Array | - | 组件类名,用于设置 组件外层元素元素类名。`['t-class']` | N
-icon | String / Object / Slot | - | 标签图标 | N
-shape | String | square | 已废弃。标签类型,有三种:方形、圆角方形、标记型。可选项:square/round/mark | N
-size | String | medium | 标签尺寸。可选项:small/medium/large。TS 类型:`SizeEnum` | N
+icon | String / Object / Slot | - | 标签图标。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+shape | String | square | 标签类型,有三种:方形、圆角方形、标记型。可选项:square/round/mark | N
+size | String | medium | 标签尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
variant | String | dark | `0.26.0`。标签风格变体。可选项:dark/light/outline/light-outline | N
### CheckTag Events
@@ -85,3 +100,49 @@ variant | String | dark | `0.26.0`。标签风格变体。可选项:dark/light
-- | -- | --
change | `(checked: boolean)` | 状态切换时触发
click | - | 点击标签时触发
+close | \- | 如果关闭按钮存在,点击关闭按钮时触发
+### CheckTag External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-tag-close-icon-color | @font-gray-3 | -
+--td-tag-danger-color | @error-color | -
+--td-tag-danger-light-color | @error-color-1 | -
+--td-tag-default-color | @bg-color-component | -
+--td-tag-default-font-color | @font-gray-1 | -
+--td-tag-default-light-color | @bg-color-secondarycontainer | -
+--td-tag-disabled-background-color | @bg-color-component-disabled | -
+--td-tag-disabled-border-color | @component-border | -
+--td-tag-disabled-color | @font-gray-4 | -
+--td-tag-extra-large-font-size | @font-size-base | -
+--td-tag-extra-large-height | 80rpx | -
+--td-tag-extra-large-icon-size | 32rpx | -
+--td-tag-extra-large-padding | 32rpx - 1px | -
+--td-tag-large-font-size | @font-size-base | -
+--td-tag-large-height | 56rpx | -
+--td-tag-large-icon-size | 32rpx | -
+--td-tag-large-padding | 16rpx - 1px | -
+--td-tag-mark-border-radius | @tag-round-border-radius | -
+--td-tag-medium-font-size | @font-size-s | -
+--td-tag-medium-height | 48rpx | -
+--td-tag-medium-icon-size | 28rpx | -
+--td-tag-medium-padding | 16rpx - 1px | -
+--td-tag-outline-bg-color | @bg-color-container | -
+--td-tag-primary-color | @brand-color | -
+--td-tag-primary-light-color | @brand-color-light | -
+--td-tag-round-border-radius | 999px | -
+--td-tag-small-font-size | @font-size | -
+--td-tag-small-height | 40rpx | -
+--td-tag-small-icon-size | 24rpx | -
+--td-tag-small-padding | 12rpx - 1px | -
+--td-tag-square-border-radius | 8rpx | -
+--td-tag-success-color | @success-color | -
+--td-tag-success-light-color | @success-color-1 | -
+--td-tag-warning-color | @warning-color | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/tag/props.js b/miniprogram_npm/tdesign-miniprogram/tag/props.js
index 39d5453..37b936b 100644
--- a/miniprogram_npm/tdesign-miniprogram/tag/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/tag/props.js
@@ -1,6 +1,6 @@
const props = {
closable: {
- type: Boolean,
+ type: null,
value: false,
},
disabled: {
diff --git a/miniprogram_npm/tdesign-miniprogram/tag/tag.d.ts b/miniprogram_npm/tdesign-miniprogram/tag/tag.d.ts
index ca813c5..2c86ef0 100644
--- a/miniprogram_npm/tdesign-miniprogram/tag/tag.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/tag/tag.d.ts
@@ -17,6 +17,7 @@ export default class Tag extends SuperComponent {
'size, shape, theme, variant, closable, disabled'(): void;
maxWidth(): void;
icon(v: any): void;
+ closable(v: any): void;
};
methods: {
setClass(): void;
diff --git a/miniprogram_npm/tdesign-miniprogram/tag/tag.js b/miniprogram_npm/tdesign-miniprogram/tag/tag.js
index 777a81c..da271cd 100644
--- a/miniprogram_npm/tdesign-miniprogram/tag/tag.js
+++ b/miniprogram_npm/tdesign-miniprogram/tag/tag.js
@@ -23,7 +23,6 @@ let Tag = class Tag extends SuperComponent {
this.externalClasses = [`${prefix}-class`];
this.options = {
multipleSlots: true,
- styleIsolation: 'apply-shared',
};
this.lifetimes = {
attached() {
@@ -43,6 +42,11 @@ let Tag = class Tag extends SuperComponent {
_icon: calcIcon(v),
});
},
+ closable(v) {
+ this.setData({
+ _closable: calcIcon(v, 'close'),
+ });
+ },
};
this.methods = {
setClass() {
diff --git a/miniprogram_npm/tdesign-miniprogram/tag/tag.json b/miniprogram_npm/tdesign-miniprogram/tag/tag.json
index fc075a1..6f15f57 100644
--- a/miniprogram_npm/tdesign-miniprogram/tag/tag.json
+++ b/miniprogram_npm/tdesign-miniprogram/tag/tag.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": ".././icon/icon"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/tag/tag.wxml b/miniprogram_npm/tdesign-miniprogram/tag/tag.wxml
index f107a8c..ac356cc 100644
--- a/miniprogram_npm/tdesign-miniprogram/tag/tag.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/tag/tag.wxml
@@ -13,13 +13,11 @@
-
+
diff --git a/miniprogram_npm/tdesign-miniprogram/tag/tag.wxss b/miniprogram_npm/tdesign-miniprogram/tag/tag.wxss
index 95e7e21..6d60d28 100644
--- a/miniprogram_npm/tdesign-miniprogram/tag/tag.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/tag/tag.wxss
@@ -47,7 +47,7 @@
align-items: center;
}
.t-tag__icon-close {
- color: var(--td-tag-close-icon-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-tag-close-icon-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
}
.t-tag__icon:not(:empty) + .t-tag__text:not(:empty),
.t-tag__text:not(:empty) + .t-tag__icon-close:not(:empty) {
@@ -104,35 +104,37 @@
border-radius: var(--td-tag-round-border-radius, 999px);
}
.t-tag.t-tag--mark {
- border-radius: 0 var(--td-tag-mark-border-radius, var(--td-tag-round-border-radius, 999px)) var(--td-tag-mark-border-radius, var(--td-tag-round-border-radius, 999px)) 0;
+ border-radius: 0;
+ border-top-right-radius: var(--td-tag-mark-border-radius, var(--td-tag-round-border-radius, 999px));
+ border-bottom-right-radius: var(--td-tag-mark-border-radius, var(--td-tag-round-border-radius, 999px));
}
.t-tag--dark.t-tag--default {
- color: var(--td-font-white-1, #ffffff);
+ color: var(--td-text-color-anti, var(--td-font-white-1, #ffffff));
border-color: var(--td-tag-default-color, var(--td-bg-color-component, var(--td-gray-color-3, #e7e7e7)));
background-color: var(--td-tag-default-color, var(--td-bg-color-component, var(--td-gray-color-3, #e7e7e7)));
}
.t-tag--dark.t-tag--primary {
- color: var(--td-font-white-1, #ffffff);
+ color: var(--td-text-color-anti, var(--td-font-white-1, #ffffff));
border-color: var(--td-tag-primary-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
background-color: var(--td-tag-primary-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
}
.t-tag--dark.t-tag--success {
- color: var(--td-font-white-1, #ffffff);
+ color: var(--td-text-color-anti, var(--td-font-white-1, #ffffff));
border-color: var(--td-tag-success-color, var(--td-success-color, var(--td-success-color-5, #2ba471)));
background-color: var(--td-tag-success-color, var(--td-success-color, var(--td-success-color-5, #2ba471)));
}
.t-tag--dark.t-tag--warning {
- color: var(--td-font-white-1, #ffffff);
+ color: var(--td-text-color-anti, var(--td-font-white-1, #ffffff));
border-color: var(--td-tag-warning-color, var(--td-warning-color, var(--td-warning-color-5, #e37318)));
background-color: var(--td-tag-warning-color, var(--td-warning-color, var(--td-warning-color-5, #e37318)));
}
.t-tag--dark.t-tag--danger {
- color: var(--td-font-white-1, #ffffff);
+ color: var(--td-text-color-anti, var(--td-font-white-1, #ffffff));
border-color: var(--td-tag-danger-color, var(--td-error-color, var(--td-error-color-6, #d54941)));
background-color: var(--td-tag-danger-color, var(--td-error-color, var(--td-error-color-6, #d54941)));
}
.t-tag--dark.t-tag--default {
- color: var(--td-tag-default-font-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-tag-default-font-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-tag--outline.t-tag--default {
color: var(--td-tag-default-color, var(--td-bg-color-component, var(--td-gray-color-3, #e7e7e7)));
@@ -160,7 +162,7 @@
background-color: var(--td-tag-danger-light-color, var(--td-error-color-1, #fff0ed));
}
.t-tag--outline.t-tag--default {
- color: var(--td-tag-default-font-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-tag-default-font-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-tag--outline.t-tag--default {
background-color: var(--td-tag-outline-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
@@ -203,7 +205,7 @@
background-color: var(--td-tag-danger-light-color, var(--td-error-color-1, #fff0ed));
}
.t-tag--light.t-tag--default {
- color: var(--td-tag-default-font-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-tag-default-font-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-tag--light-outline.t-tag--default {
color: var(--td-tag-default-color, var(--td-bg-color-component, var(--td-gray-color-3, #e7e7e7)));
@@ -231,12 +233,12 @@
background-color: var(--td-tag-danger-light-color, var(--td-error-color-1, #fff0ed));
}
.t-tag--light-outline.t-tag--default {
- color: var(--td-tag-default-font-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
+ color: var(--td-tag-default-font-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
border-color: var(--td-component-border, var(--td-gray-color-4, #dcdcdc));
}
.t-tag.t-tag--closable.t-tag--disabled {
cursor: not-allowed;
- color: var(--td-tag-disabled-color, var(--td-font-gray-4, rgba(0, 0, 0, 0.26)));
+ color: var(--td-tag-disabled-color, var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26))));
background-color: var(--td-tag-disabled-background-color, var(--td-bg-color-component-disabled, var(--td-gray-color-2, #eeeeee)));
border-color: var(--td-tag-disabled-border-color, var(--td-component-border, var(--td-gray-color-4, #dcdcdc)));
}
diff --git a/miniprogram_npm/tdesign-miniprogram/tag/type.d.ts b/miniprogram_npm/tdesign-miniprogram/tag/type.d.ts
index c256e91..bd1147d 100644
--- a/miniprogram_npm/tdesign-miniprogram/tag/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/tag/type.d.ts
@@ -1,12 +1,7 @@
-import { SizeEnum } from '../common/common';
export interface TdTagProps {
closable?: {
- type: BooleanConstructor;
- value?: boolean;
- };
- style?: {
- type: StringConstructor;
- value?: string;
+ type: null;
+ value?: boolean | object;
};
disabled?: {
type: BooleanConstructor;
@@ -30,7 +25,7 @@ export interface TdTagProps {
};
size?: {
type: StringConstructor;
- value?: SizeEnum;
+ value?: 'small' | 'medium' | 'large' | 'extra-large';
};
theme?: {
type: StringConstructor;
diff --git a/miniprogram_npm/tdesign-miniprogram/textarea/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/textarea/README.en-US.md
index 2e6a5b7..be6f401 100644
--- a/miniprogram_npm/tdesign-miniprogram/textarea/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/textarea/README.en-US.md
@@ -1,32 +1,67 @@
:: BASE_DOC ::
## API
+
### Textarea Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
adjust-position | Boolean | true | \- | N
autofocus | Boolean | false | \- | N
-autosize | Boolean | false | \- | N
+autosize | Boolean / Object | false | Typescript:`boolean \| { maxHeight?: number, minHeight?: number }` | N
+bordered | Boolean | false | \- | N
confirm-hold | Boolean | false | \- | N
-confirm-type | String | done | options:send/search/next/go/done。Typescript:`'send' \| 'search' \| 'next' \| 'go' \| 'done'` | N
+confirm-type | String | return | options: return/send/search/next/go/done。Typescript:`'return' \| 'send' \| 'search' \| 'next' \| 'go' \| 'done'` | N
+cursor | Number | -1 | \- | N
cursor-spacing | Number | 0 | \- | N
-disabled | Boolean | false | \- | N
-external-classes | Array | - | `['t-class', 't-class-textarea', 't-class-label']` | N
+disable-default-padding | Boolean | false | \- | N
+disabled | Boolean | undefined | \- | N
+fixed | Boolean | false | \- | N
focus | Boolean | false | \- | N
-label | String / Slot | - | \- | N
+hold-keyboard | Boolean | false | \- | N
+indicator | Boolean | false | \- | N
+label | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
maxcharacter | Number | - | \- | N
-maxlength | Number | - | \- | N
+maxlength | Number | -1 | \- | N
placeholder | String | undefined | \- | N
-value | String | - | \- | N
-default-value | String | undefined | uncontrolled property | N
+placeholder-style | String | - | \- | N
+selection-end | Number | -1 | \- | N
+selection-start | Number | -1 | \- | N
+show-confirm-bar | Boolean | true | \- | N
+value | String / Number | - | Typescript:`TextareaValue` `type TextareaValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/textarea/type.ts) | N
+default-value | String / Number | undefined | uncontrolled property。Typescript:`TextareaValue` `type TextareaValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/textarea/type.ts) | N
### Textarea Events
name | params | description
-- | -- | --
-blur | `(value: TextareaValue)` | \-
-change | `(value: TextareaValue)` | \-
+blur | `(value: TextareaValue, cursor: number)` | \-
+change | `(value: TextareaValue, cursor: number)` | \-
enter | `(value: TextareaValue)` | \-
focus | `(value: TextareaValue)` | \-
+keyboardheightchange | `(height: number, duration: number)` | \-
line-change | `(value: TextareaValue)` | \-
+### Textarea External Classes
+
+className | Description
+-- | --
+t-class | \-
+t-class-indicator | \-
+t-class-label | \-
+t-class-textarea | \-
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-textarea-background-color | @bg-color-container | -
+--td-textarea-border-color | rgba(220, 220, 220, 1) | -
+--td-textarea-border-radius | @radius-default | -
+--td-textarea-disabled-text-color | @font-gray-4 | -
+--td-textarea-indicator-text-color | @font-gray-3 | -
+--td-textarea-label-color | @font-gray-1 | -
+--td-textarea-placeholder-color | @font-gray-3 | -
+--td-textarea-text-color | @font-gray-1 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/textarea/README.md b/miniprogram_npm/tdesign-miniprogram/textarea/README.md
index 74ad736..3a2d9c9 100644
--- a/miniprogram_npm/tdesign-miniprogram/textarea/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/textarea/README.md
@@ -6,6 +6,7 @@ isComponent: true
---



+
## 引入
全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
@@ -18,6 +19,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
基础多行文本框
@@ -57,43 +64,67 @@ isComponent: true
- 如果需要在页面中调整 `textarea` 中 `placeholder` 样式,请使用名称为`t-textarea__placeholder`的Class选择器,直接覆盖组件内部样式(注意权重)。
## API
+
### Textarea Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
adjust-position | Boolean | true | 键盘弹起时,是否自动上推页面 | N
autofocus | Boolean | false | 自动聚焦,拉起键盘 | N
-autosize | Boolean | false | 是否自动增高,值为 autosize 时,style.height 不生效 | N
-confirm-hold | Boolean | false | 点击键盘右下角按钮时是否保持键盘不收起点 | N
-confirm-type | String | done | 设置键盘右下角按钮的文字,仅在 type='text'时生效。可选项:send/search/next/go/done。TS 类型:`'return' \| 'send' \| 'search' \| 'next' \| 'go' \| 'done'` | N
-cursor-spacing | Number | 0 | 指定光标与键盘的距离。取textarea距离底部的距离和cursor-spacing指定的距离的最小值作为光标与键盘的距离 | N
-disabled | Boolean | false | 是否禁用文本框 | N
-external-classes | Array | - | 组件类名,分别用于表示组件外层元素、输入框、占位符、标签名等元素类名。`['t-class', 't-class-textarea', 't-class-label, 't-class-indicator]` | N
-focus | Boolean | false | 自动聚焦 | N
-label | String / Slot | - | 左侧文本 | N
-maxcharacter | Number | - | 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度 | N
-maxlength | Number | -1 | 用户最多可以输入的字符个数。默认为 -1,不限制输入长度 | N
-indicator | Boolean | false | 显示文本计数器,如 0/140。当 `maxlength < 0 && maxcharacter < 0` 成立时, indicator无效 | N
-placeholder | String | undefined | 占位符 | N
-placeholderStyle | String | '' | 指定 placeholder 的样式,目前仅支持 color ,font-size和font-weight | N
-value | String | - | 文本框值 | N
-default-value | String | undefined | 文本框值。非受控属性 | N
-fixed | Boolean | false | 如果 textarea 是在一个 `position:fixed` 的区域,需要显示指定属性 fixed 为 true | N
+autosize | Boolean / Object | false | 是否自动增高,值为 true 时,style.height 不生效。支持传入对象,如 { maxHeight: 120, minHeight: 20 }。TS 类型:`boolean \| { maxHeight?: number, minHeight?: number }` | N
bordered | Boolean | false | 是否显示外边框 | N
+confirm-hold | Boolean | false | 点击键盘右下角按钮时是否保持键盘不收起点 | N
+confirm-type | String | return | 设置键盘右下角按钮的文字,仅在 type='text'时生效。可选项:return/send/search/next/go/done。TS 类型:`'return' \| 'send' \| 'search' \| 'next' \| 'go' \| 'done'` | N
cursor | Number | -1 | 指定 focus 时的光标位置 | N
+cursor-spacing | Number | 0 | 指定光标与键盘的距离。取textarea距离底部的距离和cursor-spacing指定的距离的最小值作为光标与键盘的距离 | N
disable-default-padding | Boolean | false | 是否去掉 iOS 下的默认内边距 | N
-show-confirm-bar | Boolean | true | 是否显示键盘上方带有”完成“按钮那一栏 | N
-selection-start | Number | -1 | 光标起始位置,自动聚集时有效,需与 selection-end 搭配使用 | N
-selection-end | Number | -1 | 光标结束位置,自动聚集时有效,需与 selection-start 搭配使用 | N
+disabled | Boolean | undefined | 是否禁用文本框 | N
+fixed | Boolean | false | 如果 textarea 是在一个 `position:fixed` 的区域,需要显示指定属性 fixed 为 true | N
+focus | Boolean | false | 自动聚焦 | N
hold-keyboard | Boolean | false | focus时,点击页面的时候不收起键盘 | N
+indicator | Boolean | false | 显示文本计数器,如 0/140。当 `maxlength < 0 && maxcharacter < 0` 成立时, indicator无效 | N
+label | String / Slot | - | 左侧文本。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+maxcharacter | Number | - | 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度 | N
+maxlength | Number | -1 | 用户最多可以输入的字符个数,值为 -1 的时候不限制最大长度 | N
+placeholder | String | undefined | 占位符 | N
+placeholder-style | String | - | 指定 placeholder 的样式,目前仅支持 color ,font-size和font-weight | N
+selection-end | Number | -1 | 光标结束位置,自动聚集时有效,需与 selection-start 搭配使用 | N
+selection-start | Number | -1 | 光标起始位置,自动聚集时有效,需与 selection-end 搭配使用 | N
+show-confirm-bar | Boolean | true | 是否显示键盘上方带有”完成“按钮那一栏 | N
+value | String / Number | - | 文本框值。TS 类型:`TextareaValue` `type TextareaValue = string \| number`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/textarea/type.ts) | N
+default-value | String / Number | undefined | 文本框值。非受控属性。TS 类型:`TextareaValue` `type TextareaValue = string \| number`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/textarea/type.ts) | N
### Textarea Events
名称 | 参数 | 描述
-- | -- | --
-blur | `(value: TextareaValue)` | 失去焦点时触发
-change | `(value: TextareaValue)` | 输入内容变化时触发
+blur | `(value: TextareaValue, cursor: number)` | 失去焦点时触发
+change | `(value: TextareaValue, cursor: number)` | 输入内容变化时触发
enter | `(value: TextareaValue)` | 点击完成时触发
focus | `(value: TextareaValue)` | 获得焦点时触发
-line-change | `(value: TextareaValue)` | 行高发生变化时触发
keyboardheightchange | `(height: number, duration: number)` | 键盘高度发生变化的时候触发此事件
+line-change | `(value: TextareaValue)` | 行高发生变化时触发
+### Textarea External Classes
+
+类名 | 描述
+-- | --
+t-class | 根节点样式类
+t-class-indicator | 计数器样式类
+t-class-label | 左侧文本样式类
+t-class-textarea | 占位符样式类
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-textarea-background-color | @bg-color-container | -
+--td-textarea-border-color | rgba(220, 220, 220, 1) | -
+--td-textarea-border-radius | @radius-default | -
+--td-textarea-disabled-text-color | @font-gray-4 | -
+--td-textarea-indicator-text-color | @font-gray-3 | -
+--td-textarea-label-color | @font-gray-1 | -
+--td-textarea-placeholder-color | @font-gray-3 | -
+--td-textarea-text-color | @font-gray-1 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/textarea/props.js b/miniprogram_npm/tdesign-miniprogram/textarea/props.js
index 448b8df..49f7b98 100644
--- a/miniprogram_npm/tdesign-miniprogram/textarea/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/textarea/props.js
@@ -8,6 +8,10 @@ const props = {
value: false,
},
autosize: {
+ type: null,
+ value: false,
+ },
+ bordered: {
type: Boolean,
value: false,
},
@@ -19,28 +23,45 @@ const props = {
type: String,
value: 'return',
},
+ cursor: {
+ type: Number,
+ value: -1,
+ },
cursorSpacing: {
type: Number,
value: 0,
},
- disabled: {
+ disableDefaultPadding: {
type: Boolean,
value: false,
},
- externalClasses: {
- type: Array,
+ disabled: {
+ type: null,
+ value: undefined,
+ },
+ fixed: {
+ type: Boolean,
+ value: null,
+ },
+ defaultFixed: {
+ type: Boolean,
+ value: false,
},
focus: {
type: Boolean,
value: false,
},
- label: {
- type: String,
- },
- fixed: {
+ holdKeyboard: {
type: Boolean,
value: false,
},
+ indicator: {
+ type: Boolean,
+ value: false,
+ },
+ label: {
+ type: String,
+ },
maxcharacter: {
type: Number,
},
@@ -56,23 +77,11 @@ const props = {
type: String,
value: '',
},
- value: {
- type: String,
- value: null,
+ selectionEnd: {
+ type: Number,
+ value: -1,
},
- defaultValue: {
- type: String,
- value: '',
- },
- bordered: {
- type: Boolean,
- value: false,
- },
- indicator: {
- type: Boolean,
- value: false,
- },
- cursor: {
+ selectionStart: {
type: Number,
value: -1,
},
@@ -80,21 +89,12 @@ const props = {
type: Boolean,
value: true,
},
- selectionStart: {
- type: Number,
- value: -1,
+ value: {
+ type: null,
+ value: null,
},
- selectionEnd: {
- type: Number,
- value: -1,
- },
- disableDefaultPadding: {
- type: Boolean,
- value: false,
- },
- holdKeyboard: {
- type: Boolean,
- value: false,
+ defaultValue: {
+ type: null,
},
};
export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/textarea/textarea.js b/miniprogram_npm/tdesign-miniprogram/textarea/textarea.js
index 6dc87dc..06b26a5 100644
--- a/miniprogram_npm/tdesign-miniprogram/textarea/textarea.js
+++ b/miniprogram_npm/tdesign-miniprogram/textarea/textarea.js
@@ -31,13 +31,14 @@ let Textarea = class Textarea extends SuperComponent {
};
this.observers = {
value(val) {
- this.updateCount(val);
+ this.updateCount(val !== null && val !== void 0 ? val : this.properties.defaultValue);
},
};
this.lifetimes = {
ready() {
- const { value } = this.properties;
- this.updateValue(value == null ? '' : value);
+ var _a;
+ const { value, defaultValue } = this.properties;
+ this.updateValue((_a = value !== null && value !== void 0 ? value : defaultValue) !== null && _a !== void 0 ? _a : '');
},
};
this.methods = {
@@ -77,9 +78,9 @@ let Textarea = class Textarea extends SuperComponent {
};
},
onInput(event) {
- const { value } = event.detail;
+ const { value, cursor } = event.detail;
this.updateValue(value);
- this.triggerEvent('change', { value: this.data.value });
+ this.triggerEvent('change', { value: this.data.value, cursor });
},
onFocus(event) {
this.triggerEvent('focus', Object.assign({}, event.detail));
diff --git a/miniprogram_npm/tdesign-miniprogram/textarea/textarea.json b/miniprogram_npm/tdesign-miniprogram/textarea/textarea.json
index a89ef4d..4f0a3f0 100644
--- a/miniprogram_npm/tdesign-miniprogram/textarea/textarea.json
+++ b/miniprogram_npm/tdesign-miniprogram/textarea/textarea.json
@@ -1,4 +1,5 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/textarea/textarea.wxml b/miniprogram_npm/tdesign-miniprogram/textarea/textarea.wxml
index 1403b3c..5d2515c 100644
--- a/miniprogram_npm/tdesign-miniprogram/textarea/textarea.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/textarea/textarea.wxml
@@ -1,4 +1,5 @@
+
diff --git a/miniprogram_npm/tdesign-miniprogram/toast/toast.wxss b/miniprogram_npm/tdesign-miniprogram/toast/toast.wxss
index cb4c126..a927e1a 100644
--- a/miniprogram_npm/tdesign-miniprogram/toast/toast.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/toast/toast.wxss
@@ -36,7 +36,7 @@
background-color: var(--td-toast-bg-color, var(--td-font-gray-2, rgba(0, 0, 0, 0.6)));
border-radius: var(--td-toast-radius, 8rpx);
font-size: 28rpx;
- color: var(--td-toast-color, var(--td-font-white-1, #ffffff));
+ color: var(--td-toast-color, var(--td-text-color-anti, var(--td-font-white-1, #ffffff)));
max-width: var(--td-toast-max-width, 374rpx);
width: fit-content;
box-sizing: border-box;
diff --git a/miniprogram_npm/tdesign-miniprogram/toast/type.d.ts b/miniprogram_npm/tdesign-miniprogram/toast/type.d.ts
index 82eeba6..b93d02c 100644
--- a/miniprogram_npm/tdesign-miniprogram/toast/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/toast/type.d.ts
@@ -1,8 +1,5 @@
+import { OverlayProps } from '../overlay/index';
export interface TdToastProps {
- style?: {
- type: StringConstructor;
- value?: string;
- };
direction?: {
type: StringConstructor;
value?: 'row' | 'column';
@@ -11,13 +8,9 @@ export interface TdToastProps {
type: NumberConstructor;
value?: number;
};
- externalClasses?: {
- type: ArrayConstructor;
- value?: ['t-class'];
- };
icon?: {
type: null;
- value?: string;
+ value?: string | object;
};
message?: {
type: StringConstructor;
@@ -25,7 +18,7 @@ export interface TdToastProps {
};
overlayProps?: {
type: ObjectConstructor;
- value?: object;
+ value?: OverlayProps;
};
placement?: {
type: StringConstructor;
@@ -43,4 +36,8 @@ export interface TdToastProps {
type: StringConstructor;
value?: 'loading' | 'success' | 'error';
};
+ usingCustomNavbar?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
}
diff --git a/miniprogram_npm/tdesign-miniprogram/transition/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/transition/README.en-US.md
new file mode 100644
index 0000000..4bb6d13
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/transition/README.en-US.md
@@ -0,0 +1,15 @@
+:: BASE_DOC ::
+
+## API
+
+### Transition Props
+
+name | type | default | description | required
+-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+appear | Boolean | false | \- | N
+destory-on-hide | Boolean | false | \- | N
+durations | Number / Array | - | Typescript:`number \| number[]` | N
+name | String | t-transition | \- | N
+visible | Boolean | false | \- | N
diff --git a/miniprogram_npm/tdesign-miniprogram/transition/README.md b/miniprogram_npm/tdesign-miniprogram/transition/README.md
index c262753..27e1b41 100644
--- a/miniprogram_npm/tdesign-miniprogram/transition/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/transition/README.md
@@ -33,21 +33,14 @@ isComponent: true
## API
-### `` 组件
+### Transition Props
-组件路径:`tdesign-miniprogram/transition/transition`
-
-### 过渡类名
-
-过渡类名指定格式同 vue,enter/enter-to leave/leave-to
-
-#### Props
-
-| 属性 | 值类型 | 默认值 | 说明 |
-| ------------- | ---------------- | -------------- | --------------------------- |
-| name | String | 't-transition' | 过渡类名,类似 vue 过渡类名 |
-| visible | Boolean | false | 是否显示 |
-| customClass | String | false | 自定义容器类名 |
-| destoryOnHide | Boolean | false | 隐藏之后是否渲染 slot 内容 |
-| appear | Boolean | false | 首次出现是否展示动画 |
-| durations | Number / Boolean | | 手动指定过渡时间 |
+名称 | 类型 | 默认值 | 描述 | 必传
+-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+appear | Boolean | false | 首次出现是否展示动画 | N
+destory-on-hide | Boolean | false | 隐藏时是否销毁内容 | N
+durations | Number / Array | - | 指定过渡时间。TS 类型:`number \| number[]` | N
+name | String | t-transition | 过渡类名 | N
+visible | Boolean | false | 是否显示 | N
diff --git a/miniprogram_npm/tdesign-miniprogram/transition/props.js b/miniprogram_npm/tdesign-miniprogram/transition/props.js
index d79a9a9..6a7619a 100644
--- a/miniprogram_npm/tdesign-miniprogram/transition/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/transition/props.js
@@ -3,16 +3,12 @@ const props = {
type: Boolean,
value: false,
},
- customClass: {
- type: String,
- value: '',
- },
- destoryOnClose: {
+ destoryOnHide: {
type: Boolean,
value: false,
},
- duration: {
- type: Number,
+ durations: {
+ type: null,
},
name: {
type: String,
diff --git a/miniprogram_npm/tdesign-miniprogram/transition/transition.json b/miniprogram_npm/tdesign-miniprogram/transition/transition.json
index a89ef4d..4f0a3f0 100644
--- a/miniprogram_npm/tdesign-miniprogram/transition/transition.json
+++ b/miniprogram_npm/tdesign-miniprogram/transition/transition.json
@@ -1,4 +1,5 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/transition/type.d.ts b/miniprogram_npm/tdesign-miniprogram/transition/type.d.ts
index f9996e5..998100c 100644
--- a/miniprogram_npm/tdesign-miniprogram/transition/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/transition/type.d.ts
@@ -3,17 +3,13 @@ export interface TdTransitionProps {
type: BooleanConstructor;
value?: boolean;
};
- customClass?: {
- type: StringConstructor;
- value?: string;
- };
- destoryOnClose?: {
+ destoryOnHide?: {
type: BooleanConstructor;
value?: boolean;
};
- duration?: {
- type: NumberConstructor;
- value?: number;
+ durations?: {
+ type: null;
+ value?: number | number[];
};
name?: {
type: StringConstructor;
diff --git a/miniprogram_npm/tdesign-miniprogram/transition/type.js b/miniprogram_npm/tdesign-miniprogram/transition/type.js
index 95da36c..cb0ff5c 100644
--- a/miniprogram_npm/tdesign-miniprogram/transition/type.js
+++ b/miniprogram_npm/tdesign-miniprogram/transition/type.js
@@ -1,2 +1 @@
-;
export {};
diff --git a/miniprogram_npm/tdesign-miniprogram/tree-select/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/tree-select/README.en-US.md
index 2622720..209d797 100644
--- a/miniprogram_npm/tdesign-miniprogram/tree-select/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/tree-select/README.en-US.md
@@ -1,12 +1,15 @@
:: BASE_DOC ::
## API
+
### TreeSelect Props
name | type | default | description | required
-- | -- | -- | -- | --
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
height | String / Number | 336 | \- | N
-keys | Object | - | Typescript:`KeysType` | N
+keys | Object | - | alias filed name in data。Typescript:`KeysType`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
multiple | Boolean | false | \- | N
options | Array | [] | Typescript:`Array` | N
value | String / Number / Array | - | Typescript:`TreeSelectValue` `type TreeSelectValue = string \| number \| Array`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tree-select/type.ts) | N
@@ -16,4 +19,16 @@ default-value | String / Number / Array | undefined | uncontrolled property。Ty
name | params | description
-- | -- | --
-change | `(value: TreeSelectValue, level: TreeLevel) ` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tree-select/type.ts)。
`type TreeLevel: 0 \| 1 \| 2`
+change | `(value: TreeSelectValue, level: TreeLevel) ` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tree-select/type.ts)。
`type TreeLevel = 0 \| 1 \| 2`
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-tree-bg-color | @bg-color-container | -
+--td-tree-colum-width | 206rpx | -
+--td-tree-item-active-color | @brand-color | -
+--td-tree-item-font-size | 32rpx | -
+--td-tree-item-height | 112rpx | -
+--td-tree-root-bg-color | @bg-color-secondarycontainer | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/tree-select/README.md b/miniprogram_npm/tdesign-miniprogram/tree-select/README.md
index 0faf9ab..3564fbf 100644
--- a/miniprogram_npm/tdesign-miniprogram/tree-select/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/tree-select/README.md
@@ -24,6 +24,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 组件类型
#### 基础树形选择
@@ -41,13 +47,16 @@ isComponent: true
{{ normal }}
## API
+
### TreeSelect Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
height | String / Number | 336 | 高度,默认单位为 px | N
-keys | Object | - | 用来定义 value / label 在 `options` 中对应的字段别名。TS 类型:`KeysType` | N
-multiple | Boolean | false | 是否多选 | N
+keys | Object | - | 用来定义 value / label 在 `options` 中对应的字段别名。TS 类型:`KeysType`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+multiple | Boolean | false | 是否允许多选 | N
options | Array | [] | 选项。TS 类型:`Array` | N
value | String / Number / Array | - | 选中值。TS 类型:`TreeSelectValue` `type TreeSelectValue = string \| number \| Array`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tree-select/type.ts) | N
default-value | String / Number / Array | undefined | 选中值。非受控属性。TS 类型:`TreeSelectValue` `type TreeSelectValue = string \| number \| Array`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tree-select/type.ts) | N
@@ -56,4 +65,16 @@ default-value | String / Number / Array | undefined | 选中值。非受控属
名称 | 参数 | 描述
-- | -- | --
-change | `(value: TreeSelectValue, level: TreeLevel) ` | 点击任何节点均会触发;level 代表当前点击的层级,0 代表最左侧,依次递进。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tree-select/type.ts)。
`type TreeLevel: 0 \| 1 \| 2`
+change | `(value: TreeSelectValue, level: TreeLevel) ` | 点击任何节点均会触发;level 代表当前点击的层级,0 代表最左侧,依次递进。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tree-select/type.ts)。
`type TreeLevel = 0 \| 1 \| 2`
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-tree-bg-color | @bg-color-container | -
+--td-tree-colum-width | 206rpx | -
+--td-tree-item-active-color | @brand-color | -
+--td-tree-item-font-size | 32rpx | -
+--td-tree-item-height | 112rpx | -
+--td-tree-root-bg-color | @bg-color-secondarycontainer | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.d.ts b/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.d.ts
index b887c92..fa978fa 100644
--- a/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.d.ts
@@ -1,4 +1,5 @@
import { SuperComponent } from '../common/src/index';
+import type { TreeOptionData } from '../common/common';
export default class TreeSelect extends SuperComponent {
externalClasses: string[];
options: {
@@ -7,17 +8,14 @@ export default class TreeSelect extends SuperComponent {
data: {
prefix: string;
classPrefix: string;
- labelAlias: string;
- valueAlias: string;
};
- properties: import("./type").TdTreeSelectProps;
+ properties: import("./type").TdTreeSelectProps>;
controlledProps: {
key: string;
event: string;
}[];
observers: {
- value(): void;
- keys(obj: any): void;
+ 'value, options, keys, multiple'(): void;
};
methods: {
buildTreeOptions(): void;
diff --git a/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.js b/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.js
index ecebade..c5672da 100644
--- a/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.js
+++ b/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.js
@@ -19,8 +19,6 @@ let TreeSelect = class TreeSelect extends SuperComponent {
this.data = {
prefix,
classPrefix: name,
- labelAlias: 'label',
- valueAlias: 'value',
};
this.properties = props;
this.controlledProps = [
@@ -30,25 +28,25 @@ let TreeSelect = class TreeSelect extends SuperComponent {
},
];
this.observers = {
- value() {
+ 'value, options, keys, multiple'() {
this.buildTreeOptions();
},
- keys(obj) {
- this.setData({
- labelAlias: obj.label || 'label',
- valueAlias: obj.value || 'value',
- });
- },
};
this.methods = {
buildTreeOptions() {
- const { options, value, multiple } = this.data;
+ const { options, value, multiple, keys } = this.data;
const treeOptions = [];
let level = -1;
let node = { children: options };
+ if (options.length === 0 || (Array.isArray(value) && value.length === 0))
+ return;
while (node && node.children) {
level += 1;
- const list = node.children;
+ const list = node.children.map((item) => ({
+ label: item[(keys === null || keys === void 0 ? void 0 : keys.label) || 'label'],
+ value: item[(keys === null || keys === void 0 ? void 0 : keys.value) || 'value'],
+ children: item.children,
+ }));
const thisValue = value === null || value === void 0 ? void 0 : value[level];
treeOptions.push([...list]);
if (thisValue == null) {
@@ -63,7 +61,7 @@ let TreeSelect = class TreeSelect extends SuperComponent {
const leafLevel = Math.max(0, level);
if (multiple) {
const finalValue = this.data.value || this.data.defaultValue;
- if (!Array.isArray(finalValue[leafLevel])) {
+ if (finalValue[leafLevel] != null && !Array.isArray(finalValue[leafLevel])) {
throw TypeError('应传入数组类型的 value');
}
}
diff --git a/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.json b/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.json
index 0083bb1..cad65bd 100644
--- a/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.json
+++ b/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.json
@@ -1,5 +1,6 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-radio": "../radio/radio",
"t-radio-group": "../radio-group/radio-group",
diff --git a/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.wxml b/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.wxml
index 898e9e4..31725cc 100644
--- a/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.wxml
@@ -20,21 +20,21 @@
- {{item[labelAlias]}}
+ {{item.label}}
{{item[labelAlias]}}{{item.label}}
{{item[labelAlias]}}{{item.label}}
diff --git a/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.wxss b/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.wxss
index 8e5cb32..8886161 100644
--- a/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/tree-select/tree-select.wxss
@@ -31,6 +31,7 @@
}
.t-tree-select__column {
width: var(--td-tree-colum-width, 206rpx);
+ color: var(--td-tree-colum-text-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
}
.t-tree-select__column--left {
background: var(--td-tree-root-bg-color, var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3)));
@@ -38,13 +39,18 @@
.t-tree-select__column--right {
flex: 1;
}
-.t-tree-select__column ::-webkit-scrollbar {
+.t-tree-select__column::-webkit-scrollbar {
display: none;
width: 0;
height: 0;
color: transparent;
}
.t-tree-select__item {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ -webkit-line-clamp: 1;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
height: var(--td-tree-item-height, 112rpx);
line-height: var(--td-tree-item-height, 112rpx);
font-size: var(--td-tree-item-font-size, 32rpx);
@@ -56,4 +62,5 @@
}
.t-tree-select-column {
width: 100%;
+ height: auto;
}
diff --git a/miniprogram_npm/tdesign-miniprogram/tree-select/type.d.ts b/miniprogram_npm/tdesign-miniprogram/tree-select/type.d.ts
index d0a4b7d..de289dc 100644
--- a/miniprogram_npm/tdesign-miniprogram/tree-select/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/tree-select/type.d.ts
@@ -1,9 +1,5 @@
import { TreeOptionData, KeysType } from '../common/common';
export interface TdTreeSelectProps {
- style?: {
- type: StringConstructor;
- value?: string;
- };
height?: {
type: null;
value?: string | number;
diff --git a/miniprogram_npm/tdesign-miniprogram/upload/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/upload/README.en-US.md
index 2fc525d..152c161 100644
--- a/miniprogram_npm/tdesign-miniprogram/upload/README.en-US.md
+++ b/miniprogram_npm/tdesign-miniprogram/upload/README.en-US.md
@@ -1,32 +1,53 @@
:: BASE_DOC ::
## API
+
### Upload Props
name | type | default | description | required
-- | -- | -- | -- | --
-add-content | String / Slot | - | \- | N
-allow-upload-duplicate-file | Boolean | false | \- | N
+style | Object | - | CSS(Cascading Style Sheets) | N
+custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
+add-content | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+allow-upload-duplicate-file | Boolean | false | `暂不支持`。allow to upload duplicate name files | N
config | Object | - | Typescript:`UploadMpConfig` `type UploadMpConfig = ImageConfig \| VideoConfig` `interface ImageConfig { count?: number; sizeType?: Array; sourceType?: Array }` `type SizeTypeValues = 'original' \| 'compressed'` `type SourceTypeValues = 'album' \| 'camera'` `interface VideoConfig { sourceType?: Array; compressed?: boolean; maxDuration?: number; camera?: 'back' \| 'front' }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
-file-list-display | Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
+disabled | Boolean | undefined | make upload to be disabled | N
+draggable | Boolean / Object | - | Typescript:`boolean \| {vibrate?: boolean; collisionVibrate?: boolean}` | N
files | Array | - | Typescript:`Array` `interface UploadFile { url: string; name?: string; size?: number; type?: 'image' \| 'video'; percent?: number; status: 'loading' \| 'reload' \| 'failed' \| 'done' }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
default-files | Array | undefined | uncontrolled property。Typescript:`Array` `interface UploadFile { url: string; name?: string; size?: number; type?: 'image' \| 'video'; percent?: number; status: 'loading' \| 'reload' \| 'failed' \| 'done' }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
grid-config | Object | - | Typescript:`{column?: number; width?: number; height?: number;}` | N
gutter | Number | 16 | \- | N
image-props | Object | - | Typescript:`ImageProps`,[Image API Documents](./image?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
-max | Number | 0 | \- | N
+max | Number | 0 | max count of files limit | N
media-type | Array | ['image', 'video'] | Typescript:`Array` `type MediaType = 'image' \| 'video'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
request-method | Function | - | \- | N
-size-limit | Number / Object | - | Typescript:`number \| SizeLimitObj` `interface SizeLimitObj { size: number; unit: SizeUnit ; message?: string }` `type SizeUnitArray = ['B', 'KB', 'MB', 'GB']` `type SizeUnit = SizeUnitArray[number]`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
-source | String | media | options:media/messageFile | N
+size-limit | Number / Object | - | files size limit。Typescript:`number \| SizeLimitObj` `interface SizeLimitObj { size: number; unit: SizeUnit ; message?: string }` `type SizeUnitArray = ['B', 'KB', 'MB', 'GB']` `type SizeUnit = SizeUnitArray[number]`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
+source | String | media | options: media/messageFile | N
+transition | Object | { backTransition: true, duration: 300, timingFunction: 'ease' } | Typescript:`Transition` `interface Transition { backTransition?: boolean, duration?: number, timingFunction?: string }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
### Upload Events
name | params | description
-- | -- | --
add | `(files: MediaContext)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts)。
`type MediaContext = VideoContext[] \| ImageContext[]`
`interface VideoContext { name?: string; type?: string; url?: string; duration?: number; size?: number; width?: number; height?: number; thumb: string; progress: number }`
`interface ImageContext { name: string; type: string; url: string; size: number; width: number; height: number; progress: number }`
+click | `(file: VideoContext \| ImageContext)` | \-
complete | \- | \-
+drop | `(files: MediaContext) ` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts)。
`type MediaContext = VideoContext[] \| ImageContext[]; interface VideoContext { name?: string; type?: string; url?: string; duration?: number; size?: number; width?: number; height?: number; thumb: string; progress: number }; interface ImageContext { name: string; type: string; url: string; size: number; width: number; height: number; progress: number}`
fail | \- | \-
remove | `(index: number; file: UploadFile)` | \-
-select-change | `(currentSelectedFiles: MediaContext[])` | \-
+select-change | `(files: MediaContext[]; currentSelectedFiles: MediaContext[])` | \-
success | `(files: MediaContext)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts)。
`type MediaContext = VideoContext[] \| ImageContext[]`
`interface VideoContext { name?: string; type?: string; url?: string; duration?: number; size?: number; width?: number; height?: number; thumb: string; progress: number }`
`interface ImageContext { name: string; type: string; url: string; size: number; width: number; height: number; progress: number }`
+
+### CSS Variables
+
+The component provides the following CSS variables, which can be used to customize styles.
+Name | Default Value | Description
+-- | -- | --
+--td-upload-add-bg-color | @bg-color-secondarycontainer | -
+--td-upload-add-color | @font-gray-3 | -
+--td-upload-add-disabled-bg-color | @bg-color-component-disabled | -
+--td-upload-add-icon-disabled-color | @text-color-disabled | -
+--td-upload-add-icon-font-size | 56rpx | -
+--td-upload-disabled-mask | rgba(255, 255, 255, 0.55) | -
+--td-upload-radius | @radius-default | -
+--td-upload-drag-z-index | 999 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/upload/README.md b/miniprogram_npm/tdesign-miniprogram/upload/README.md
index 746b9ef..bcb4deb 100644
--- a/miniprogram_npm/tdesign-miniprogram/upload/README.md
+++ b/miniprogram_npm/tdesign-miniprogram/upload/README.md
@@ -18,6 +18,12 @@ isComponent: true
## 代码演示
+ 在开发者工具中预览效果
+
+
+Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"
+
+
### 单选上传图片
图片上传有两种方式:
@@ -32,6 +38,10 @@ isComponent: true
{{ multiple }}
+### 长按拖拽排序图片
+
+{{ drag }}
+
### 加载状态
支持多种状态:`loading`、`reload`、`failed`;
@@ -47,14 +57,18 @@ isComponent: true
{{ messageFile }}
## API
+
### Upload Props
-名称 | 类型 | 默认值 | 说明 | 必传
+名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
-add-content | String / Slot | - | 添加按钮内容 | N
-allow-upload-duplicate-file | Boolean | false | 【开发中】是否允许重复上传相同文件名的文件 | N
+style | Object | - | 样式 | N
+custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
+add-content | String / Slot | - | 添加按钮内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
+allow-upload-duplicate-file | Boolean | false | `暂不支持`。是否允许重复上传相同文件名的文件 | N
config | Object | - | 图片上传配置,视频上传配置,文件上传配置等,包含图片尺寸、图片来源、视频来源、视频拍摄最长时间等。更多细节查看小程序官网。[图片上传](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)。TS 类型:`UploadMpConfig` `type UploadMpConfig = ImageConfig \| VideoConfig` `interface ImageConfig { count?: number; sizeType?: Array; sourceType?: Array }` `type SizeTypeValues = 'original' \| 'compressed'` `type SourceTypeValues = 'album' \| 'camera'` `interface VideoConfig { sourceType?: Array; compressed?: boolean; maxDuration?: number; camera?: 'back' \| 'front' }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
-file-list-display | Slot | - | 【开发中】用于完全自定义文件列表内容。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
+disabled | Boolean | undefined | 是否禁用组件 | N
+draggable | Boolean / Object | - | 是否支持拖拽排序。长按时是否振动,碰撞时是否振动。示例一:`true`。示例二:`{ vibrate: true, collisionVibrate: true }`。TS 类型:`boolean \| {vibrate?: boolean; collisionVibrate?: boolean}` | N
files | Array | - | 已上传文件列表。TS 类型:`Array` `interface UploadFile { url: string; name?: string; size?: number; type?: 'image' \| 'video'; percent?: number; status: 'loading' \| 'reload' \| 'failed' \| 'done' }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
default-files | Array | undefined | 已上传文件列表。非受控属性。TS 类型:`Array` `interface UploadFile { url: string; name?: string; size?: number; type?: 'image' \| 'video'; percent?: number; status: 'loading' \| 'reload' \| 'failed' \| 'done' }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
grid-config | Object | - | upload组件每行上传图片列数以及图片的宽度和高度。TS 类型:`{column?: number; width?: number; height?: number;}` | N
@@ -63,17 +77,33 @@ image-props | Object | - | 透传 Image 组件全部属性。TS 类型:`ImageP
max | Number | 0 | 用于控制文件上传数量,值为 0 则不限制 | N
media-type | Array | ['image', 'video'] | 支持上传的文件类型,图片或视频。TS 类型:`Array` `type MediaType = 'image' \| 'video'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
request-method | Function | - | 自定义上传方法 | N
-size-limit | Number / Object | - | 图片文件大小限制,单位 KB。可选单位有:`'B' \| 'KB' \| 'MB' \| 'GB'`。示例一:`1000`。示例二:`{ size: 2, unit: 'MB', message: '图片大小不超过 {sizeLimit} MB' }`。TS 类型:`number \| SizeLimitObj` `interface SizeLimitObj { size: number; unit: SizeUnit ; message?: string }` `type SizeUnitArray = ['B', 'KB', 'MB', 'GB']` `type SizeUnit = SizeUnitArray[number]`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
+size-limit | Number / Object | - | 图片文件大小限制,默认单位 KB。可选单位有:`'B' \| 'KB' \| 'MB' \| 'GB'`。示例一:`1000`。示例二:`{ size: 2, unit: 'MB', message: '图片大小不超过 {sizeLimit} MB' }`。TS 类型:`number \| SizeLimitObj` `interface SizeLimitObj { size: number; unit: SizeUnit ; message?: string }` `type SizeUnitArray = ['B', 'KB', 'MB', 'GB']` `type SizeUnit = SizeUnitArray[number]`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
source | String | media | 来源。可选项:media/messageFile | N
+transition | Object | { backTransition: true, duration: 300, timingFunction: 'ease' } | 拖拽位置移动时的过渡参数,`duration`单位为ms。TS 类型:`Transition` `interface Transition { backTransition?: boolean, duration?: number, timingFunction?: string }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts) | N
### Upload Events
名称 | 参数 | 描述
-- | -- | --
add | `(files: MediaContext)` | 选择后触发,仅包含本次选择的照片;`url` 表示选定视频的临时文件路径 (本地路径)。`duration` 表示选定视频的时间长度。`size`选定视频的数据量大小。更多描述参考 wx.chooseMedia 小程序官网描述。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts)。
`type MediaContext = VideoContext[] \| ImageContext[]`
`interface VideoContext { name?: string; type?: string; url?: string; duration?: number; size?: number; width?: number; height?: number; thumb: string; progress: number }`
`interface ImageContext { name: string; type: string; url: string; size: number; width: number; height: number; progress: number }`
+click | `(file: VideoContext \| ImageContext)` | 点击已选文件时触发;常用于重新上传
complete | \- | 上传成功或失败后触发
+drop | `(files: MediaContext) ` | 拖拽结束后触发,包含所有上传的文件(拖拽后的文件顺序);`url` 表示选定视频的临时文件路径 (本地路径)。`duration` 表示选定视频的时间长度。`size` 选定视频的数据量大小。更多描述参考 wx.chooseMedia 小程序官网描述。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts)。
`type MediaContext = VideoContext[] \| ImageContext[]; interface VideoContext { name?: string; type?: string; url?: string; duration?: number; size?: number; width?: number; height?: number; thumb: string; progress: number }; interface ImageContext { name: string; type: string; url: string; size: number; width: number; height: number; progress: number}`
fail | \- | 上传失败后触发
remove | `(index: number; file: UploadFile)` | 移除文件时触发
select-change | `(files: MediaContext[]; currentSelectedFiles: MediaContext[])` | 选择文件或图片之后,上传之前,触发该事件。
`files` 表示之前已经上传完成的文件列表。
`currentSelectedFiles` 表示本次上传选中的文件列表
success | `(files: MediaContext)` | 上传成功后触发,包含所有上传的文件;`url` 表示选定视频的临时文件路径 (本地路径)。`duration` 表示选定视频的时间长度。`size`选定视频的数据量大小。更多描述参考 wx.chooseMedia 小程序官网描述。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/upload/type.ts)。
`type MediaContext = VideoContext[] \| ImageContext[]`
`interface VideoContext { name?: string; type?: string; url?: string; duration?: number; size?: number; width?: number; height?: number; thumb: string; progress: number }`
`interface ImageContext { name: string; type: string; url: string; size: number; width: number; height: number; progress: number }`
-click | `(file: VideoContext | ImageContext)` | 点击已选文件时触发;常用于重新上传
+
+### CSS Variables
+
+组件提供了下列 CSS 变量,可用于自定义样式。
+名称 | 默认值 | 描述
+-- | -- | --
+--td-upload-add-bg-color | @bg-color-secondarycontainer | -
+--td-upload-add-color | @font-gray-3 | -
+--td-upload-add-disabled-bg-color | @bg-color-component-disabled | -
+--td-upload-add-icon-disabled-color | @text-color-disabled | -
+--td-upload-add-icon-font-size | 56rpx | -
+--td-upload-disabled-mask | rgba(255, 255, 255, 0.55) | -
+--td-upload-radius | @radius-default | -
+--td-upload-drag-z-index | 999 | -
\ No newline at end of file
diff --git a/miniprogram_npm/tdesign-miniprogram/upload/drag.wxs b/miniprogram_npm/tdesign-miniprogram/upload/drag.wxs
new file mode 100644
index 0000000..a136b58
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/upload/drag.wxs
@@ -0,0 +1,238 @@
+var classPrefix = '';
+var startIndex = 0;
+var endIndex = 0;
+var dragCollisionList = [];
+
+var isOutRange = function (x1, y1, x2, y2, x3, y3) {
+ return x1 < 0 || x1 >= y1 || x2 < 0 || x2 >= y2 || x3 < 0 || x3 >= y3;
+};
+
+var sortCore = function (sKey, eKey, st) {
+ var _ = st.dragBaseData;
+
+ var excludeFix = function (cKey, type) {
+ if (st.list[cKey].fixed) {
+ // fixed 元素位置不会变化, 这里直接用 cKey(sortKey) 获取, 更加快捷
+ type ? --cKey : ++cKey;
+ return excludeFix(cKey, type);
+ }
+ return cKey;
+ };
+
+ // 先获取到 endKey 对应的 realKey, 防止下面排序过程中该 realKey 被修改
+ var endRealKey = -1;
+ st.list.forEach(function (item) {
+ if (item.sortKey === eKey) endRealKey = item.realKey;
+ });
+
+ return st.list.map(function (item) {
+ if (item.fixed) return item;
+ var cKey = item.sortKey;
+ var rKey = item.realKey;
+
+ if (sKey < eKey) {
+ // 正序拖动
+ if (cKey > sKey && cKey <= eKey) {
+ --rKey;
+ cKey = excludeFix(--cKey, true);
+ } else if (cKey === sKey) {
+ rKey = endRealKey;
+ cKey = eKey;
+ }
+ } else if (sKey > eKey) {
+ // 倒序拖动
+ if (cKey >= eKey && cKey < sKey) {
+ ++rKey;
+ cKey = excludeFix(++cKey, false);
+ } else if (cKey === sKey) {
+ rKey = endRealKey;
+ cKey = eKey;
+ }
+ }
+
+ if (item.sortKey !== cKey) {
+ item.tranX = (cKey % _.columns) * 100 + '%';
+ item.tranY = Math.floor(cKey / _.columns) * 100 + '%';
+ item.sortKey = cKey;
+ item.realKey = rKey;
+ }
+ return item;
+ });
+};
+
+var triggerCustomEvent = function (list, type, ins) {
+ var _list = [],
+ listData = [];
+
+ list.forEach(function (item) {
+ _list[item.sortKey] = item;
+ });
+
+ _list.forEach(function (item) {
+ if (!item.extraNode) {
+ listData.push(item.data);
+ }
+ });
+
+ ins.triggerEvent(type, { listData: listData });
+};
+
+var longPress = function (event, ownerInstance) {
+ var ins = event.instance;
+ var st = ownerInstance.getState();
+ var _ = st.dragBaseData;
+
+ var sTouch = event.changedTouches[0];
+ if (!sTouch) return;
+
+ st.cur = ins.getDataset().index;
+ longPressIndex = st.cur;
+
+ // 初始项是固定项则返回
+ var item = st.list[st.cur];
+ if (item && item.fixed) return;
+
+ // 如果已经在 drag 中则返回, 防止多指触发 drag 动作, touchstart 事件中有效果
+ if (st.dragging) return;
+ st.dragging = true;
+ ownerInstance.callMethod('dragStatusChange', { dragging: true });
+
+ // 计算X,Y轴初始位移, 使 item 中心移动到点击处, 单列时候X轴初始不做位移
+ st.tranX = _.columns === 1 ? 0 : sTouch.pageX - (_.itemWidth / 2 + _.wrapLeft);
+ st.tranY = sTouch.pageY - (_.itemHeight / 2 + _.wrapTop);
+ st.sId = sTouch.identifier;
+ ins.setStyle({
+ transform: 'translate3d(' + st.tranX + 'px, ' + st.tranY + 'px, 0)',
+ });
+ st.itemsInstance.forEach(function (item, index) {
+ item.removeClass(classPrefix + '__drag--tran').removeClass(classPrefix + '__drag--cur');
+ item.addClass(index === st.cur ? classPrefix + '__drag--cur' : classPrefix + '__drag--tran');
+ });
+ ownerInstance.callMethod('dragVibrate', { vibrateType: 'longPress' });
+};
+
+var touchMove = function (event, ownerInstance) {
+ var ins = event.instance;
+ var st = ownerInstance.getState();
+ var _ = st.dragBaseData;
+
+ var mTouch = event.changedTouches[0];
+ if (!mTouch) return;
+
+ if (!st.dragging) return;
+
+ // 如果不是同一个触发点则返回
+ if (st.sId !== mTouch.identifier) return;
+
+ // 计算X,Y轴位移, 单列时候X轴初始不做位移
+ var tranX = _.columns === 1 ? 0 : mTouch.pageX - (_.itemWidth / 2 + _.wrapLeft);
+ var tranY = mTouch.pageY - (_.itemHeight / 2 + _.wrapTop);
+
+ // 到顶到底自动滑动
+ if (mTouch.clientY > _.windowHeight - _.itemHeight - _.realBottomSize) {
+ // 当前触摸点pageY + item高度 - (屏幕高度 - 底部固定区域高度)
+ ownerInstance.callMethod('pageScroll', {
+ scrollTop: mTouch.pageY + _.itemHeight - (_.windowHeight - _.realBottomSize),
+ });
+ } else if (mTouch.clientY < _.itemHeight + _.realTopSize) {
+ // 当前触摸点pageY - item高度 - 顶部固定区域高度
+ ownerInstance.callMethod('pageScroll', {
+ scrollTop: mTouch.pageY - _.itemHeight - _.realTopSize,
+ });
+ }
+
+ // 设置当前激活元素偏移量
+ ins.setStyle({
+ transform: 'translate3d(' + tranX + 'px, ' + tranY + 'px, 0)',
+ });
+
+ var startKey = st.list[st.cur].sortKey;
+ var curX = Math.round(tranX / _.itemWidth);
+ var curY = Math.round(tranY / _.itemHeight);
+ var endKey = curX + _.columns * curY;
+
+ // 目标项是固定项则返回
+ var item = st.list[endKey];
+ if (item && item.fixed) return;
+
+ // X轴或Y轴超出范围则返回
+ if (isOutRange(curX, _.columns, curY, _.rows, endKey, st.list.length)) return;
+
+ // 防止拖拽过程中发生乱序问题
+ if (startKey === endKey || startKey === st.preStartKey) return;
+ st.preStartKey = startKey;
+
+ dragCollisionList = sortCore(startKey, endKey, st);
+ startIndex = startKey;
+ endIndex = endKey;
+ st.itemsInstance.forEach(function (itemIns, index) {
+ var item = dragCollisionList[index];
+ if (index !== st.cur) {
+ itemIns.setStyle({
+ transform: 'translate3d(' + item.tranX + ',' + item.tranY + ', 0)',
+ });
+ }
+ });
+
+ ownerInstance.callMethod('dragVibrate', { vibrateType: 'touchMove' });
+ ownerInstance.callMethod('dragCollision', {
+ dragCollisionList: dragCollisionList,
+ startIndex: startIndex,
+ endIndex: endIndex,
+ });
+ triggerCustomEvent(dragCollisionList, 'change', ownerInstance);
+};
+
+var touchEnd = function (event, ownerInstance) {
+ var ins = event.instance;
+ var st = ownerInstance.getState();
+
+ if (!st.dragging) return;
+ triggerCustomEvent(st.list, 'sortend', ownerInstance);
+ ins.addClass(classPrefix + '__drag--tran');
+ ins.setStyle({
+ transform: 'translate3d(' + st.list[st.cur].tranX + ',' + st.list[st.cur].tranY + ', 0)',
+ });
+ st.preStartKey = -1;
+ st.dragging = false;
+ ownerInstance.callMethod('dragStatusChange', { dragging: false });
+ ownerInstance.callMethod('dragEnd', {
+ dragCollisionList: dragCollisionList,
+ startIndex: startIndex,
+ endIndex: endIndex,
+ });
+ st.cur = -1;
+ st.tranX = 0;
+ st.tranY = 0;
+};
+
+var baseDataObserver = function (newVal, oldVal, ownerInstance, ins) {
+ var st = ownerInstance.getState();
+ st.dragBaseData = newVal;
+ classPrefix = newVal.classPrefix;
+};
+
+var listObserver = function (newVal, oldVal, ownerInstance, ins) {
+ var st = ownerInstance.getState();
+ st.itemsInstance = ownerInstance.selectAllComponents('.' + classPrefix + '__drag-item');
+ st.list = newVal || [];
+ st.list.forEach(function (item, index) {
+ var itemIns = st.itemsInstance[index];
+ if (item && itemIns) {
+ itemIns.removeClass(classPrefix + '__drag--tran');
+ itemIns.setStyle({
+ transform: 'translate3d(' + item.tranX + ',' + item.tranY + ', 0)',
+ });
+ if (item.fixed) itemIns.addClass(classPrefix + '__drag--fixed');
+ }
+ });
+ dragCollisionList = [];
+};
+
+module.exports = {
+ longPress: longPress,
+ touchMove: touchMove,
+ touchEnd: touchEnd,
+ baseDataObserver: baseDataObserver,
+ listObserver: listObserver,
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/upload/props.js b/miniprogram_npm/tdesign-miniprogram/upload/props.js
index fbf07c3..f130336 100644
--- a/miniprogram_npm/tdesign-miniprogram/upload/props.js
+++ b/miniprogram_npm/tdesign-miniprogram/upload/props.js
@@ -9,6 +9,13 @@ const props = {
config: {
type: Object,
},
+ disabled: {
+ type: null,
+ value: undefined,
+ },
+ draggable: {
+ type: null,
+ },
files: {
type: Array,
value: null,
@@ -44,5 +51,9 @@ const props = {
type: String,
value: 'media',
},
+ transition: {
+ type: Object,
+ value: { backTransition: true, duration: 300, timingFunction: 'ease' },
+ },
};
export default props;
diff --git a/miniprogram_npm/tdesign-miniprogram/upload/type.d.ts b/miniprogram_npm/tdesign-miniprogram/upload/type.d.ts
index d06319f..4aa0e45 100644
--- a/miniprogram_npm/tdesign-miniprogram/upload/type.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/upload/type.d.ts
@@ -12,9 +12,16 @@ export interface TdUploadProps {
type: ObjectConstructor;
value?: UploadMpConfig;
};
- style?: {
- type: StringConstructor;
- value?: string;
+ disabled?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+ draggable?: {
+ type: null;
+ value?: boolean | {
+ vibrate?: boolean;
+ collisionVibrate?: boolean;
+ };
};
files?: {
type: ArrayConstructor;
@@ -49,7 +56,7 @@ export interface TdUploadProps {
value?: Array;
};
requestMethod?: {
- type: null;
+ type: undefined;
value?: null;
};
sizeLimit?: {
@@ -60,6 +67,10 @@ export interface TdUploadProps {
type: StringConstructor;
value?: 'media' | 'messageFile';
};
+ transition?: {
+ type: ObjectConstructor;
+ value?: Transition;
+ };
}
export declare type UploadMpConfig = ImageConfig | VideoConfig;
export interface ImageConfig {
@@ -75,12 +86,6 @@ export interface VideoConfig {
maxDuration?: number;
camera?: 'back' | 'front';
}
-export interface UploadDisplayDragEvents {
- onDrop?: (event: DragEvent) => void;
- onDragenter?: (event: DragEvent) => void;
- onDragover?: (event: DragEvent) => void;
- onDragleave?: (event: DragEvent) => void;
-}
export interface UploadFile {
url: string;
name?: string;
@@ -97,3 +102,8 @@ export interface SizeLimitObj {
}
export declare type SizeUnitArray = ['B', 'KB', 'MB', 'GB'];
export declare type SizeUnit = SizeUnitArray[number];
+export interface Transition {
+ backTransition?: boolean;
+ duration?: number;
+ timingFunction?: string;
+}
diff --git a/miniprogram_npm/tdesign-miniprogram/upload/upload.d.ts b/miniprogram_npm/tdesign-miniprogram/upload/upload.d.ts
index 3dcc153..6c3225a 100644
--- a/miniprogram_npm/tdesign-miniprogram/upload/upload.d.ts
+++ b/miniprogram_npm/tdesign-miniprogram/upload/upload.d.ts
@@ -13,6 +13,12 @@ export default class Upload extends SuperComponent {
customFiles: UploadFile[];
customLimit: number;
column: number;
+ dragBaseData: {};
+ rows: number;
+ dragWrapStyle: string;
+ dragList: any[];
+ dragging: boolean;
+ dragLayout: boolean;
};
properties: import("./type").TdUploadProps;
controlledProps: {
@@ -20,8 +26,7 @@ export default class Upload extends SuperComponent {
event: string;
}[];
observers: {
- files(files: UploadFile): void;
- max(max: any): void;
+ 'files, max, draggable'(files: UploadFile, max: number): void;
gridConfig(): void;
};
lifetimes: {
@@ -37,6 +42,9 @@ export default class Upload extends SuperComponent {
onDelete(e: any): void;
deleteHandle(index: number): void;
updateGrid(): void;
+ initDragLayout(): void;
+ initDragList(): void;
+ initDragBaseData(): void;
methods: {
uploadFiles(files: UploadFile[]): Promise;
startUpload(files: UploadFile[]): any;
@@ -44,5 +52,9 @@ export default class Upload extends SuperComponent {
chooseMedia(mediaType: any): void;
chooseMessageFile(mediaType: any): void;
afterSelect(files: any): void;
+ dragVibrate(e: any): void;
+ dragStatusChange(e: any): void;
+ dragEnd(e: any): void;
+ triggerDropEvent(files: any): void;
};
}
diff --git a/miniprogram_npm/tdesign-miniprogram/upload/upload.js b/miniprogram_npm/tdesign-miniprogram/upload/upload.js
index dd5cf77..f115238 100644
--- a/miniprogram_npm/tdesign-miniprogram/upload/upload.js
+++ b/miniprogram_npm/tdesign-miniprogram/upload/upload.js
@@ -18,6 +18,7 @@ var __rest = (this && this.__rest) || function (s, e) {
import { isObject, SuperComponent, wxComponent } from '../common/src/index';
import props from './props';
import config from '../common/config';
+import { isOverSize } from '../common/utils';
const { prefix } = config;
const name = `${prefix}-upload`;
let Upload = class Upload extends SuperComponent {
@@ -35,6 +36,12 @@ let Upload = class Upload extends SuperComponent {
customFiles: [],
customLimit: 0,
column: 4,
+ dragBaseData: {},
+ rows: 0,
+ dragWrapStyle: '',
+ dragList: [],
+ dragging: true,
+ dragLayout: false,
};
this.properties = props;
this.controlledProps = [
@@ -44,11 +51,8 @@ let Upload = class Upload extends SuperComponent {
},
];
this.observers = {
- files(files) {
- this.handleLimit(files, this.data.max);
- },
- max(max) {
- this.handleLimit(this.data.customFiles, max);
+ 'files, max, draggable'(files, max) {
+ this.handleLimit(files, max);
},
gridConfig() {
this.updateGrid();
@@ -88,7 +92,9 @@ let Upload = class Upload extends SuperComponent {
return Promise.resolve();
},
onAddTap() {
- const { mediaType, source } = this.properties;
+ const { disabled, mediaType, source } = this.properties;
+ if (disabled)
+ return;
if (source === 'media') {
this.chooseMedia(mediaType);
}
@@ -97,13 +103,17 @@ let Upload = class Upload extends SuperComponent {
}
},
chooseMedia(mediaType) {
- const { config, sizeLimit, max } = this.data;
- wx.chooseMedia(Object.assign(Object.assign({ count: max === 0 ? 9 : max, mediaType }, config), { success: (res) => {
+ const { config, sizeLimit, customLimit } = this.data;
+ wx.chooseMedia(Object.assign(Object.assign({ count: customLimit, mediaType }, config), { success: (res) => {
const files = [];
res.tempFiles.forEach((temp) => {
const { size, fileType, tempFilePath, width, height, duration, thumbTempFilePath } = temp, res = __rest(temp, ["size", "fileType", "tempFilePath", "width", "height", "duration", "thumbTempFilePath"]);
- if (sizeLimit && size > sizeLimit) {
- wx.showToast({ icon: 'none', title: `${fileType === 'image' ? '图片' : '视频'}大小超过限制` });
+ if (isOverSize(size, sizeLimit)) {
+ let title = `${fileType === 'image' ? '图片' : '视频'}大小超过限制`;
+ if (typeof sizeLimit !== 'number') {
+ title = sizeLimit.message.replace('{sizeLimit}', sizeLimit === null || sizeLimit === void 0 ? void 0 : sizeLimit.size);
+ }
+ wx.showToast({ icon: 'none', title });
return;
}
const name = this.getRandFileName(tempFilePath);
@@ -122,8 +132,12 @@ let Upload = class Upload extends SuperComponent {
const files = [];
res.tempFiles.forEach((temp) => {
const { size, type: fileType, path: tempFilePath } = temp, res = __rest(temp, ["size", "type", "path"]);
- if (sizeLimit && size > sizeLimit) {
- wx.showToast({ icon: 'none', title: `${fileType === 'image' ? '图片' : '视频'}大小超过限制` });
+ if (isOverSize(size, sizeLimit)) {
+ let title = `${fileType === 'image' ? '图片' : '视频'}大小超过限制`;
+ if (typeof sizeLimit !== 'number') {
+ title = sizeLimit.message.replace('{sizeLimit}', sizeLimit === null || sizeLimit === void 0 ? void 0 : sizeLimit.size);
+ }
+ wx.showToast({ icon: 'none', title });
return;
}
const name = this.getRandFileName(tempFilePath);
@@ -140,10 +154,56 @@ let Upload = class Upload extends SuperComponent {
this._trigger('add', { files });
this.startUpload(files);
},
+ dragVibrate(e) {
+ var _a;
+ const { vibrateType } = e;
+ const { draggable } = this.data;
+ const dragVibrate = (_a = draggable === null || draggable === void 0 ? void 0 : draggable.vibrate) !== null && _a !== void 0 ? _a : true;
+ const dragCollisionVibrate = draggable === null || draggable === void 0 ? void 0 : draggable.collisionVibrate;
+ if ((dragVibrate && vibrateType === 'longPress') || (dragCollisionVibrate && vibrateType === 'touchMove')) {
+ wx.vibrateShort({
+ type: 'light',
+ });
+ }
+ },
+ dragStatusChange(e) {
+ const { dragging } = e;
+ this.setData({ dragging });
+ },
+ dragEnd(e) {
+ const { dragCollisionList } = e;
+ let files = [];
+ if (dragCollisionList.length === 0) {
+ files = this.data.customFiles;
+ }
+ else {
+ files = dragCollisionList.reduce((list, item) => {
+ const { realKey, data, fixed } = item;
+ if (!fixed) {
+ list[realKey] = Object.assign({}, data);
+ }
+ return list;
+ }, []);
+ }
+ this.triggerDropEvent(files);
+ },
+ triggerDropEvent(files) {
+ const { transition } = this.properties;
+ if (transition.backTransition) {
+ const timer = setTimeout(() => {
+ this.triggerEvent('drop', { files });
+ clearTimeout(timer);
+ }, transition.duration);
+ }
+ else {
+ this.triggerEvent('drop', { files });
+ }
+ },
};
}
onProofTap(e) {
var _a;
+ this.onFileClick(e);
const { index } = e.currentTarget.dataset;
wx.previewImage({
urls: this.data.customFiles.filter((file) => file.percent !== -1).map((file) => file.url),
@@ -151,20 +211,15 @@ let Upload = class Upload extends SuperComponent {
});
}
handleLimit(customFiles, max) {
- while (max !== 0 && customFiles.length - max > 0) {
- customFiles.pop();
+ if (max === 0) {
+ max = 20;
}
- const proofs = [];
- customFiles.forEach((item) => {
- if (item.type !== 'video') {
- proofs.push(item.url);
- }
- });
this.setData({
- customFiles,
- proofs,
- customLimit: max === 0 ? Number.MAX_SAFE_INTEGER : max - customFiles.length,
+ customFiles: customFiles.length > max ? customFiles.slice(0, max) : customFiles,
+ customLimit: max - customFiles.length,
+ dragging: true,
});
+ this.initDragLayout();
}
triggerSuccessEvent(files) {
this._trigger('success', { files: [...this.data.customFiles, ...files] });
@@ -214,6 +269,82 @@ let Upload = class Upload extends SuperComponent {
column: column,
});
}
+ initDragLayout() {
+ const { draggable, disabled } = this.properties;
+ if (!draggable || disabled)
+ return;
+ this.initDragList();
+ this.initDragBaseData();
+ }
+ initDragList() {
+ let i = 0;
+ const { column, customFiles, customLimit } = this.data;
+ const dragList = [];
+ customFiles.forEach((item, index) => {
+ dragList.push({
+ realKey: i,
+ sortKey: index,
+ tranX: `${(index % column) * 100}%`,
+ tranY: `${Math.floor(index / column) * 100}%`,
+ data: Object.assign({}, item),
+ });
+ i += 1;
+ });
+ if (customLimit > 0) {
+ const listLength = dragList.length;
+ dragList.push({
+ realKey: listLength,
+ sortKey: listLength,
+ tranX: `${(listLength % column) * 100}%`,
+ tranY: `${Math.floor(listLength / column) * 100}%`,
+ fixed: true,
+ });
+ }
+ this.data.rows = Math.ceil(dragList.length / column);
+ this.setData({
+ dragList,
+ });
+ }
+ initDragBaseData() {
+ const { classPrefix, rows, column, customFiles } = this.data;
+ if (customFiles.length === 0) {
+ this.setData({
+ dragBaseData: {},
+ dragWrapStyle: '',
+ dragLayout: false,
+ });
+ return;
+ }
+ const query = this.createSelectorQuery();
+ const selectorGridItem = `.${classPrefix} >>> .t-grid-item`;
+ const selectorGrid = `.${classPrefix} >>> .t-grid`;
+ query.select(selectorGridItem).boundingClientRect();
+ query.select(selectorGrid).boundingClientRect();
+ query.selectViewport().scrollOffset();
+ query.exec((res) => {
+ const [{ width, height }, { left, top }, { scrollTop }] = res;
+ const dragBaseData = {
+ rows,
+ classPrefix,
+ itemWidth: width,
+ itemHeight: height,
+ wrapLeft: left,
+ wrapTop: top + scrollTop,
+ columns: column,
+ };
+ const dragWrapStyle = `height: ${rows * height}px`;
+ this.setData({
+ dragBaseData,
+ dragWrapStyle,
+ dragLayout: true,
+ }, () => {
+ const timer = setTimeout(() => {
+ this.setData({ dragging: false });
+ clearTimeout(timer);
+ }, 0);
+ });
+ });
+ }
};
Upload = __decorate([
wxComponent()
diff --git a/miniprogram_npm/tdesign-miniprogram/upload/upload.json b/miniprogram_npm/tdesign-miniprogram/upload/upload.json
index 5c0921d..1ac0a3b 100644
--- a/miniprogram_npm/tdesign-miniprogram/upload/upload.json
+++ b/miniprogram_npm/tdesign-miniprogram/upload/upload.json
@@ -1,9 +1,9 @@
{
"component": true,
+ "styleIsolation": "apply-shared",
"usingComponents": {
"t-grid": "../grid/grid",
"t-grid-item": "../grid-item/grid-item",
- "t-popup": "../popup/popup",
"t-icon": "../icon/icon",
"t-image": "../image/image"
}
diff --git a/miniprogram_npm/tdesign-miniprogram/upload/upload.wxml b/miniprogram_npm/tdesign-miniprogram/upload/upload.wxml
index ee1bbe1..d018bd5 100644
--- a/miniprogram_npm/tdesign-miniprogram/upload/upload.wxml
+++ b/miniprogram_npm/tdesign-miniprogram/upload/upload.wxml
@@ -1,76 +1,227 @@
+
+
-
-
-
-
-
-
-
+
+
+
+
-
-
- {{file.percent ? file.percent + '%' : '上传中...'}}
-
-
- {{file.status == 'reload' ? '重新上传' : '上传失败'}}
+
+
+
+
+
+ {{file.percent ? file.percent + '%' : '上传中...'}}
+
+
+
+ {{file.status == 'reload' ? '重新上传' : '上传失败'}}
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+ {{addContent}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{file.percent ? file.percent + '%' : '上传中...'}}
+
+
+
+ {{file.status == 'reload' ? '重新上传' : '上传失败'}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{addContent}}
+
+
+
+
+
-
-
-
-
-
- {{addContent}}
-
-
-
-
-
+
diff --git a/miniprogram_npm/tdesign-miniprogram/upload/upload.wxs b/miniprogram_npm/tdesign-miniprogram/upload/upload.wxs
new file mode 100644
index 0000000..03b321f
--- /dev/null
+++ b/miniprogram_npm/tdesign-miniprogram/upload/upload.wxs
@@ -0,0 +1,15 @@
+module.exports.getWrapperAriaRole = function (file) {
+ return file.status && file.status != 'done' ? 'text' : 'button';
+};
+
+module.exports.getWrapperAriaLabel = function (file) {
+ if (file.status && file.status != 'done') {
+ if (file.status == 'loading') {
+ return file.percent ? '上传中:' + file.percent + '%' : '上传中';
+ } else {
+ return file.status == 'reload' ? '重新上传' : '上传失败';
+ }
+ } else {
+ return file.type === 'video' ? '视频' : '图像';
+ }
+};
diff --git a/miniprogram_npm/tdesign-miniprogram/upload/upload.wxss b/miniprogram_npm/tdesign-miniprogram/upload/upload.wxss
index cd82c55..07556b7 100644
--- a/miniprogram_npm/tdesign-miniprogram/upload/upload.wxss
+++ b/miniprogram_npm/tdesign-miniprogram/upload/upload.wxss
@@ -25,6 +25,9 @@
bottom: 0;
transform: scale(1.5);
}
+.t-upload {
+ position: relative;
+}
.t-upload__grid-content {
padding: 0;
}
@@ -39,9 +42,13 @@
justify-content: center;
font-size: var(--td-upload-add-icon-font-size, 56rpx);
background-color: var(--td-upload-add-bg-color, var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3)));
- color: var(--td-upload-add-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
+ color: var(--td-upload-add-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))));
border-radius: var(--td-upload-radius, var(--td-radius-default, 12rpx));
}
+.t-upload__add-icon--disabled {
+ background-color: var(--td-upload-add-disabled-bg-color, var(--td-bg-color-component-disabled, var(--td-gray-color-2, #eeeeee)));
+ color: var(--td-upload-add-icon-disabled-color, var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26))));
+}
.t-upload__add-icon:only-child {
display: flex;
}
@@ -56,6 +63,16 @@
border-radius: var(--td-upload-radius, var(--td-radius-default, 12rpx));
overflow: hidden;
}
+.t-upload__wrapper--disabled::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ background-color: var(--td-upload-disabled-mask, rgba(0, 0.6));
+ z-index: 1;
+}
.t-upload__close-btn {
position: absolute;
top: 0;
@@ -75,13 +92,15 @@
top: 0;
width: 100%;
height: 100%;
- background-color: var(--td-font-gray-3, rgba(0, 0, 0, 0.4));
+ background-color: var(--td-font-gray-2, rgba(0, 0, 0, 0.6));
display: flex;
flex-direction: column;
align-items: center;
+ justify-content: center;
border-radius: var(--td-upload-radius, var(--td-radius-default, 12rpx));
- color: var(--td-font-white-1, #ffffff);
+ color: var(--td-text-color-anti, var(--td-font-white-1, #ffffff));
padding: 32rpx 0;
+ box-sizing: border-box;
}
.t-upload__progress-text {
font-size: 24rpx;
@@ -91,6 +110,30 @@
.t-upload__progress-loading {
animation: spin infinite linear 0.6s;
}
+.t-upload__drag {
+ position: relative;
+ width: 100%;
+ --td-grid-item-bg-color: transparent;
+}
+.t-upload__drag-item {
+ position: absolute;
+ z-index: 1;
+ top: 0px;
+ left: 0px;
+ height: auto;
+ width: 100%;
+}
+.t-upload__drag--fixed {
+ z-index: 0;
+}
+.t-upload__drag--tran {
+ transition-property: transform;
+ transition-duration: var(--td-upload-drag-transition-duration);
+ transition-timing-function: var(--td-upload-drag-transition-timing-function);
+}
+.t-upload__drag--cur {
+ z-index: var(--td-upload-drag-z-index, 999);
+}
@keyframes spin {
0% {
transform: rotate(0deg);
diff --git a/miniprogram_npm/tinycolor2/index.js b/miniprogram_npm/tinycolor2/index.js
new file mode 100644
index 0000000..e02ac56
--- /dev/null
+++ b/miniprogram_npm/tinycolor2/index.js
@@ -0,0 +1,1201 @@
+module.exports = (function() {
+var __MODS__ = {};
+var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
+var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
+var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
+var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
+__DEFINE__(1731653753939, function(require, module, exports) {
+// This file is autogenerated. It's used to publish CJS to npm.
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.tinycolor = factory());
+})(this, (function () {
+
+ function _typeof(obj) {
+ "@babel/helpers - typeof";
+
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
+ return typeof obj;
+ } : function (obj) {
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
+ }, _typeof(obj);
+ }
+
+ // https://github.com/bgrins/TinyColor
+ // Brian Grinstead, MIT License
+
+ var trimLeft = /^\s+/;
+ var trimRight = /\s+$/;
+ function tinycolor(color, opts) {
+ color = color ? color : "";
+ opts = opts || {};
+
+ // If input is already a tinycolor, return itself
+ if (color instanceof tinycolor) {
+ return color;
+ }
+ // If we are called as a function, call using new instead
+ if (!(this instanceof tinycolor)) {
+ return new tinycolor(color, opts);
+ }
+ var rgb = inputToRGB(color);
+ this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
+ this._gradientType = opts.gradientType;
+
+ // Don't let the range of [0,255] come back in [0,1].
+ // Potentially lose a little bit of precision here, but will fix issues where
+ // .5 gets interpreted as half of the total, instead of half of 1
+ // If it was supposed to be 128, this was already taken care of by `inputToRgb`
+ if (this._r < 1) this._r = Math.round(this._r);
+ if (this._g < 1) this._g = Math.round(this._g);
+ if (this._b < 1) this._b = Math.round(this._b);
+ this._ok = rgb.ok;
+ }
+ tinycolor.prototype = {
+ isDark: function isDark() {
+ return this.getBrightness() < 128;
+ },
+ isLight: function isLight() {
+ return !this.isDark();
+ },
+ isValid: function isValid() {
+ return this._ok;
+ },
+ getOriginalInput: function getOriginalInput() {
+ return this._originalInput;
+ },
+ getFormat: function getFormat() {
+ return this._format;
+ },
+ getAlpha: function getAlpha() {
+ return this._a;
+ },
+ getBrightness: function getBrightness() {
+ //http://www.w3.org/TR/AERT#color-contrast
+ var rgb = this.toRgb();
+ return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
+ },
+ getLuminance: function getLuminance() {
+ //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
+ var rgb = this.toRgb();
+ var RsRGB, GsRGB, BsRGB, R, G, B;
+ RsRGB = rgb.r / 255;
+ GsRGB = rgb.g / 255;
+ BsRGB = rgb.b / 255;
+ if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
+ if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
+ if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
+ return 0.2126 * R + 0.7152 * G + 0.0722 * B;
+ },
+ setAlpha: function setAlpha(value) {
+ this._a = boundAlpha(value);
+ this._roundA = Math.round(100 * this._a) / 100;
+ return this;
+ },
+ toHsv: function toHsv() {
+ var hsv = rgbToHsv(this._r, this._g, this._b);
+ return {
+ h: hsv.h * 360,
+ s: hsv.s,
+ v: hsv.v,
+ a: this._a
+ };
+ },
+ toHsvString: function toHsvString() {
+ var hsv = rgbToHsv(this._r, this._g, this._b);
+ var h = Math.round(hsv.h * 360),
+ s = Math.round(hsv.s * 100),
+ v = Math.round(hsv.v * 100);
+ return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
+ },
+ toHsl: function toHsl() {
+ var hsl = rgbToHsl(this._r, this._g, this._b);
+ return {
+ h: hsl.h * 360,
+ s: hsl.s,
+ l: hsl.l,
+ a: this._a
+ };
+ },
+ toHslString: function toHslString() {
+ var hsl = rgbToHsl(this._r, this._g, this._b);
+ var h = Math.round(hsl.h * 360),
+ s = Math.round(hsl.s * 100),
+ l = Math.round(hsl.l * 100);
+ return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
+ },
+ toHex: function toHex(allow3Char) {
+ return rgbToHex(this._r, this._g, this._b, allow3Char);
+ },
+ toHexString: function toHexString(allow3Char) {
+ return "#" + this.toHex(allow3Char);
+ },
+ toHex8: function toHex8(allow4Char) {
+ return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
+ },
+ toHex8String: function toHex8String(allow4Char) {
+ return "#" + this.toHex8(allow4Char);
+ },
+ toRgb: function toRgb() {
+ return {
+ r: Math.round(this._r),
+ g: Math.round(this._g),
+ b: Math.round(this._b),
+ a: this._a
+ };
+ },
+ toRgbString: function toRgbString() {
+ return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
+ },
+ toPercentageRgb: function toPercentageRgb() {
+ return {
+ r: Math.round(bound01(this._r, 255) * 100) + "%",
+ g: Math.round(bound01(this._g, 255) * 100) + "%",
+ b: Math.round(bound01(this._b, 255) * 100) + "%",
+ a: this._a
+ };
+ },
+ toPercentageRgbString: function toPercentageRgbString() {
+ return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
+ },
+ toName: function toName() {
+ if (this._a === 0) {
+ return "transparent";
+ }
+ if (this._a < 1) {
+ return false;
+ }
+ return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
+ },
+ toFilter: function toFilter(secondColor) {
+ var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
+ var secondHex8String = hex8String;
+ var gradientType = this._gradientType ? "GradientType = 1, " : "";
+ if (secondColor) {
+ var s = tinycolor(secondColor);
+ secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
+ }
+ return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
+ },
+ toString: function toString(format) {
+ var formatSet = !!format;
+ format = format || this._format;
+ var formattedString = false;
+ var hasAlpha = this._a < 1 && this._a >= 0;
+ var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
+ if (needsAlphaFormat) {
+ // Special case for "transparent", all other non-alpha formats
+ // will return rgba when there is transparency.
+ if (format === "name" && this._a === 0) {
+ return this.toName();
+ }
+ return this.toRgbString();
+ }
+ if (format === "rgb") {
+ formattedString = this.toRgbString();
+ }
+ if (format === "prgb") {
+ formattedString = this.toPercentageRgbString();
+ }
+ if (format === "hex" || format === "hex6") {
+ formattedString = this.toHexString();
+ }
+ if (format === "hex3") {
+ formattedString = this.toHexString(true);
+ }
+ if (format === "hex4") {
+ formattedString = this.toHex8String(true);
+ }
+ if (format === "hex8") {
+ formattedString = this.toHex8String();
+ }
+ if (format === "name") {
+ formattedString = this.toName();
+ }
+ if (format === "hsl") {
+ formattedString = this.toHslString();
+ }
+ if (format === "hsv") {
+ formattedString = this.toHsvString();
+ }
+ return formattedString || this.toHexString();
+ },
+ clone: function clone() {
+ return tinycolor(this.toString());
+ },
+ _applyModification: function _applyModification(fn, args) {
+ var color = fn.apply(null, [this].concat([].slice.call(args)));
+ this._r = color._r;
+ this._g = color._g;
+ this._b = color._b;
+ this.setAlpha(color._a);
+ return this;
+ },
+ lighten: function lighten() {
+ return this._applyModification(_lighten, arguments);
+ },
+ brighten: function brighten() {
+ return this._applyModification(_brighten, arguments);
+ },
+ darken: function darken() {
+ return this._applyModification(_darken, arguments);
+ },
+ desaturate: function desaturate() {
+ return this._applyModification(_desaturate, arguments);
+ },
+ saturate: function saturate() {
+ return this._applyModification(_saturate, arguments);
+ },
+ greyscale: function greyscale() {
+ return this._applyModification(_greyscale, arguments);
+ },
+ spin: function spin() {
+ return this._applyModification(_spin, arguments);
+ },
+ _applyCombination: function _applyCombination(fn, args) {
+ return fn.apply(null, [this].concat([].slice.call(args)));
+ },
+ analogous: function analogous() {
+ return this._applyCombination(_analogous, arguments);
+ },
+ complement: function complement() {
+ return this._applyCombination(_complement, arguments);
+ },
+ monochromatic: function monochromatic() {
+ return this._applyCombination(_monochromatic, arguments);
+ },
+ splitcomplement: function splitcomplement() {
+ return this._applyCombination(_splitcomplement, arguments);
+ },
+ // Disabled until https://github.com/bgrins/TinyColor/issues/254
+ // polyad: function (number) {
+ // return this._applyCombination(polyad, [number]);
+ // },
+ triad: function triad() {
+ return this._applyCombination(polyad, [3]);
+ },
+ tetrad: function tetrad() {
+ return this._applyCombination(polyad, [4]);
+ }
+ };
+
+ // If input is an object, force 1 into "1.0" to handle ratios properly
+ // String input requires "1.0" as input, so 1 will be treated as 1
+ tinycolor.fromRatio = function (color, opts) {
+ if (_typeof(color) == "object") {
+ var newColor = {};
+ for (var i in color) {
+ if (color.hasOwnProperty(i)) {
+ if (i === "a") {
+ newColor[i] = color[i];
+ } else {
+ newColor[i] = convertToPercentage(color[i]);
+ }
+ }
+ }
+ color = newColor;
+ }
+ return tinycolor(color, opts);
+ };
+
+ // Given a string or object, convert that input to RGB
+ // Possible string inputs:
+ //
+ // "red"
+ // "#f00" or "f00"
+ // "#ff0000" or "ff0000"
+ // "#ff000000" or "ff000000"
+ // "rgb 255 0 0" or "rgb (255, 0, 0)"
+ // "rgb 1.0 0 0" or "rgb (1, 0, 0)"
+ // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
+ // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
+ // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
+ // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
+ // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
+ //
+ function inputToRGB(color) {
+ var rgb = {
+ r: 0,
+ g: 0,
+ b: 0
+ };
+ var a = 1;
+ var s = null;
+ var v = null;
+ var l = null;
+ var ok = false;
+ var format = false;
+ if (typeof color == "string") {
+ color = stringInputToObject(color);
+ }
+ if (_typeof(color) == "object") {
+ if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
+ rgb = rgbToRgb(color.r, color.g, color.b);
+ ok = true;
+ format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
+ } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
+ s = convertToPercentage(color.s);
+ v = convertToPercentage(color.v);
+ rgb = hsvToRgb(color.h, s, v);
+ ok = true;
+ format = "hsv";
+ } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
+ s = convertToPercentage(color.s);
+ l = convertToPercentage(color.l);
+ rgb = hslToRgb(color.h, s, l);
+ ok = true;
+ format = "hsl";
+ }
+ if (color.hasOwnProperty("a")) {
+ a = color.a;
+ }
+ }
+ a = boundAlpha(a);
+ return {
+ ok: ok,
+ format: color.format || format,
+ r: Math.min(255, Math.max(rgb.r, 0)),
+ g: Math.min(255, Math.max(rgb.g, 0)),
+ b: Math.min(255, Math.max(rgb.b, 0)),
+ a: a
+ };
+ }
+
+ // Conversion Functions
+ // --------------------
+
+ // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
+ //
+
+ // `rgbToRgb`
+ // Handle bounds / percentage checking to conform to CSS color spec
+ //
+ // *Assumes:* r, g, b in [0, 255] or [0, 1]
+ // *Returns:* { r, g, b } in [0, 255]
+ function rgbToRgb(r, g, b) {
+ return {
+ r: bound01(r, 255) * 255,
+ g: bound01(g, 255) * 255,
+ b: bound01(b, 255) * 255
+ };
+ }
+
+ // `rgbToHsl`
+ // Converts an RGB color value to HSL.
+ // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
+ // *Returns:* { h, s, l } in [0,1]
+ function rgbToHsl(r, g, b) {
+ r = bound01(r, 255);
+ g = bound01(g, 255);
+ b = bound01(b, 255);
+ var max = Math.max(r, g, b),
+ min = Math.min(r, g, b);
+ var h,
+ s,
+ l = (max + min) / 2;
+ if (max == min) {
+ h = s = 0; // achromatic
+ } else {
+ var d = max - min;
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
+ switch (max) {
+ case r:
+ h = (g - b) / d + (g < b ? 6 : 0);
+ break;
+ case g:
+ h = (b - r) / d + 2;
+ break;
+ case b:
+ h = (r - g) / d + 4;
+ break;
+ }
+ h /= 6;
+ }
+ return {
+ h: h,
+ s: s,
+ l: l
+ };
+ }
+
+ // `hslToRgb`
+ // Converts an HSL color value to RGB.
+ // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
+ // *Returns:* { r, g, b } in the set [0, 255]
+ function hslToRgb(h, s, l) {
+ var r, g, b;
+ h = bound01(h, 360);
+ s = bound01(s, 100);
+ l = bound01(l, 100);
+ function hue2rgb(p, q, t) {
+ if (t < 0) t += 1;
+ if (t > 1) t -= 1;
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
+ if (t < 1 / 2) return q;
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
+ return p;
+ }
+ if (s === 0) {
+ r = g = b = l; // achromatic
+ } else {
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
+ var p = 2 * l - q;
+ r = hue2rgb(p, q, h + 1 / 3);
+ g = hue2rgb(p, q, h);
+ b = hue2rgb(p, q, h - 1 / 3);
+ }
+ return {
+ r: r * 255,
+ g: g * 255,
+ b: b * 255
+ };
+ }
+
+ // `rgbToHsv`
+ // Converts an RGB color value to HSV
+ // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
+ // *Returns:* { h, s, v } in [0,1]
+ function rgbToHsv(r, g, b) {
+ r = bound01(r, 255);
+ g = bound01(g, 255);
+ b = bound01(b, 255);
+ var max = Math.max(r, g, b),
+ min = Math.min(r, g, b);
+ var h,
+ s,
+ v = max;
+ var d = max - min;
+ s = max === 0 ? 0 : d / max;
+ if (max == min) {
+ h = 0; // achromatic
+ } else {
+ switch (max) {
+ case r:
+ h = (g - b) / d + (g < b ? 6 : 0);
+ break;
+ case g:
+ h = (b - r) / d + 2;
+ break;
+ case b:
+ h = (r - g) / d + 4;
+ break;
+ }
+ h /= 6;
+ }
+ return {
+ h: h,
+ s: s,
+ v: v
+ };
+ }
+
+ // `hsvToRgb`
+ // Converts an HSV color value to RGB.
+ // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
+ // *Returns:* { r, g, b } in the set [0, 255]
+ function hsvToRgb(h, s, v) {
+ h = bound01(h, 360) * 6;
+ s = bound01(s, 100);
+ v = bound01(v, 100);
+ var i = Math.floor(h),
+ f = h - i,
+ p = v * (1 - s),
+ q = v * (1 - f * s),
+ t = v * (1 - (1 - f) * s),
+ mod = i % 6,
+ r = [v, q, p, p, t, v][mod],
+ g = [t, v, v, q, p, p][mod],
+ b = [p, p, t, v, v, q][mod];
+ return {
+ r: r * 255,
+ g: g * 255,
+ b: b * 255
+ };
+ }
+
+ // `rgbToHex`
+ // Converts an RGB color to hex
+ // Assumes r, g, and b are contained in the set [0, 255]
+ // Returns a 3 or 6 character hex
+ function rgbToHex(r, g, b, allow3Char) {
+ var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
+
+ // Return a 3 character hex if possible
+ if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
+ return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
+ }
+ return hex.join("");
+ }
+
+ // `rgbaToHex`
+ // Converts an RGBA color plus alpha transparency to hex
+ // Assumes r, g, b are contained in the set [0, 255] and
+ // a in [0, 1]. Returns a 4 or 8 character rgba hex
+ function rgbaToHex(r, g, b, a, allow4Char) {
+ var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
+
+ // Return a 4 character hex if possible
+ if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
+ return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
+ }
+ return hex.join("");
+ }
+
+ // `rgbaToArgbHex`
+ // Converts an RGBA color to an ARGB Hex8 string
+ // Rarely used, but required for "toFilter()"
+ function rgbaToArgbHex(r, g, b, a) {
+ var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
+ return hex.join("");
+ }
+
+ // `equals`
+ // Can be called with any tinycolor input
+ tinycolor.equals = function (color1, color2) {
+ if (!color1 || !color2) return false;
+ return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
+ };
+ tinycolor.random = function () {
+ return tinycolor.fromRatio({
+ r: Math.random(),
+ g: Math.random(),
+ b: Math.random()
+ });
+ };
+
+ // Modification Functions
+ // ----------------------
+ // Thanks to less.js for some of the basics here
+ //
+
+ function _desaturate(color, amount) {
+ amount = amount === 0 ? 0 : amount || 10;
+ var hsl = tinycolor(color).toHsl();
+ hsl.s -= amount / 100;
+ hsl.s = clamp01(hsl.s);
+ return tinycolor(hsl);
+ }
+ function _saturate(color, amount) {
+ amount = amount === 0 ? 0 : amount || 10;
+ var hsl = tinycolor(color).toHsl();
+ hsl.s += amount / 100;
+ hsl.s = clamp01(hsl.s);
+ return tinycolor(hsl);
+ }
+ function _greyscale(color) {
+ return tinycolor(color).desaturate(100);
+ }
+ function _lighten(color, amount) {
+ amount = amount === 0 ? 0 : amount || 10;
+ var hsl = tinycolor(color).toHsl();
+ hsl.l += amount / 100;
+ hsl.l = clamp01(hsl.l);
+ return tinycolor(hsl);
+ }
+ function _brighten(color, amount) {
+ amount = amount === 0 ? 0 : amount || 10;
+ var rgb = tinycolor(color).toRgb();
+ rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
+ rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
+ rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
+ return tinycolor(rgb);
+ }
+ function _darken(color, amount) {
+ amount = amount === 0 ? 0 : amount || 10;
+ var hsl = tinycolor(color).toHsl();
+ hsl.l -= amount / 100;
+ hsl.l = clamp01(hsl.l);
+ return tinycolor(hsl);
+ }
+
+ // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
+ // Values outside of this range will be wrapped into this range.
+ function _spin(color, amount) {
+ var hsl = tinycolor(color).toHsl();
+ var hue = (hsl.h + amount) % 360;
+ hsl.h = hue < 0 ? 360 + hue : hue;
+ return tinycolor(hsl);
+ }
+
+ // Combination Functions
+ // ---------------------
+ // Thanks to jQuery xColor for some of the ideas behind these
+ //
+
+ function _complement(color) {
+ var hsl = tinycolor(color).toHsl();
+ hsl.h = (hsl.h + 180) % 360;
+ return tinycolor(hsl);
+ }
+ function polyad(color, number) {
+ if (isNaN(number) || number <= 0) {
+ throw new Error("Argument to polyad must be a positive number");
+ }
+ var hsl = tinycolor(color).toHsl();
+ var result = [tinycolor(color)];
+ var step = 360 / number;
+ for (var i = 1; i < number; i++) {
+ result.push(tinycolor({
+ h: (hsl.h + i * step) % 360,
+ s: hsl.s,
+ l: hsl.l
+ }));
+ }
+ return result;
+ }
+ function _splitcomplement(color) {
+ var hsl = tinycolor(color).toHsl();
+ var h = hsl.h;
+ return [tinycolor(color), tinycolor({
+ h: (h + 72) % 360,
+ s: hsl.s,
+ l: hsl.l
+ }), tinycolor({
+ h: (h + 216) % 360,
+ s: hsl.s,
+ l: hsl.l
+ })];
+ }
+ function _analogous(color, results, slices) {
+ results = results || 6;
+ slices = slices || 30;
+ var hsl = tinycolor(color).toHsl();
+ var part = 360 / slices;
+ var ret = [tinycolor(color)];
+ for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
+ hsl.h = (hsl.h + part) % 360;
+ ret.push(tinycolor(hsl));
+ }
+ return ret;
+ }
+ function _monochromatic(color, results) {
+ results = results || 6;
+ var hsv = tinycolor(color).toHsv();
+ var h = hsv.h,
+ s = hsv.s,
+ v = hsv.v;
+ var ret = [];
+ var modification = 1 / results;
+ while (results--) {
+ ret.push(tinycolor({
+ h: h,
+ s: s,
+ v: v
+ }));
+ v = (v + modification) % 1;
+ }
+ return ret;
+ }
+
+ // Utility Functions
+ // ---------------------
+
+ tinycolor.mix = function (color1, color2, amount) {
+ amount = amount === 0 ? 0 : amount || 50;
+ var rgb1 = tinycolor(color1).toRgb();
+ var rgb2 = tinycolor(color2).toRgb();
+ var p = amount / 100;
+ var rgba = {
+ r: (rgb2.r - rgb1.r) * p + rgb1.r,
+ g: (rgb2.g - rgb1.g) * p + rgb1.g,
+ b: (rgb2.b - rgb1.b) * p + rgb1.b,
+ a: (rgb2.a - rgb1.a) * p + rgb1.a
+ };
+ return tinycolor(rgba);
+ };
+
+ // Readability Functions
+ // ---------------------
+ // false
+ // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
+ tinycolor.isReadable = function (color1, color2, wcag2) {
+ var readability = tinycolor.readability(color1, color2);
+ var wcag2Parms, out;
+ out = false;
+ wcag2Parms = validateWCAG2Parms(wcag2);
+ switch (wcag2Parms.level + wcag2Parms.size) {
+ case "AAsmall":
+ case "AAAlarge":
+ out = readability >= 4.5;
+ break;
+ case "AAlarge":
+ out = readability >= 3;
+ break;
+ case "AAAsmall":
+ out = readability >= 7;
+ break;
+ }
+ return out;
+ };
+
+ // `mostReadable`
+ // Given a base color and a list of possible foreground or background
+ // colors for that base, returns the most readable color.
+ // Optionally returns Black or White if the most readable color is unreadable.
+ // *Example*
+ // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
+ // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
+ // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
+ // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
+ tinycolor.mostReadable = function (baseColor, colorList, args) {
+ var bestColor = null;
+ var bestScore = 0;
+ var readability;
+ var includeFallbackColors, level, size;
+ args = args || {};
+ includeFallbackColors = args.includeFallbackColors;
+ level = args.level;
+ size = args.size;
+ for (var i = 0; i < colorList.length; i++) {
+ readability = tinycolor.readability(baseColor, colorList[i]);
+ if (readability > bestScore) {
+ bestScore = readability;
+ bestColor = tinycolor(colorList[i]);
+ }
+ }
+ if (tinycolor.isReadable(baseColor, bestColor, {
+ level: level,
+ size: size
+ }) || !includeFallbackColors) {
+ return bestColor;
+ } else {
+ args.includeFallbackColors = false;
+ return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
+ }
+ };
+
+ // Big List of Colors
+ // ------------------
+ //
+ var names = tinycolor.names = {
+ aliceblue: "f0f8ff",
+ antiquewhite: "faebd7",
+ aqua: "0ff",
+ aquamarine: "7fffd4",
+ azure: "f0ffff",
+ beige: "f5f5dc",
+ bisque: "ffe4c4",
+ black: "000",
+ blanchedalmond: "ffebcd",
+ blue: "00f",
+ blueviolet: "8a2be2",
+ brown: "a52a2a",
+ burlywood: "deb887",
+ burntsienna: "ea7e5d",
+ cadetblue: "5f9ea0",
+ chartreuse: "7fff00",
+ chocolate: "d2691e",
+ coral: "ff7f50",
+ cornflowerblue: "6495ed",
+ cornsilk: "fff8dc",
+ crimson: "dc143c",
+ cyan: "0ff",
+ darkblue: "00008b",
+ darkcyan: "008b8b",
+ darkgoldenrod: "b8860b",
+ darkgray: "a9a9a9",
+ darkgreen: "006400",
+ darkgrey: "a9a9a9",
+ darkkhaki: "bdb76b",
+ darkmagenta: "8b008b",
+ darkolivegreen: "556b2f",
+ darkorange: "ff8c00",
+ darkorchid: "9932cc",
+ darkred: "8b0000",
+ darksalmon: "e9967a",
+ darkseagreen: "8fbc8f",
+ darkslateblue: "483d8b",
+ darkslategray: "2f4f4f",
+ darkslategrey: "2f4f4f",
+ darkturquoise: "00ced1",
+ darkviolet: "9400d3",
+ deeppink: "ff1493",
+ deepskyblue: "00bfff",
+ dimgray: "696969",
+ dimgrey: "696969",
+ dodgerblue: "1e90ff",
+ firebrick: "b22222",
+ floralwhite: "fffaf0",
+ forestgreen: "228b22",
+ fuchsia: "f0f",
+ gainsboro: "dcdcdc",
+ ghostwhite: "f8f8ff",
+ gold: "ffd700",
+ goldenrod: "daa520",
+ gray: "808080",
+ green: "008000",
+ greenyellow: "adff2f",
+ grey: "808080",
+ honeydew: "f0fff0",
+ hotpink: "ff69b4",
+ indianred: "cd5c5c",
+ indigo: "4b0082",
+ ivory: "fffff0",
+ khaki: "f0e68c",
+ lavender: "e6e6fa",
+ lavenderblush: "fff0f5",
+ lawngreen: "7cfc00",
+ lemonchiffon: "fffacd",
+ lightblue: "add8e6",
+ lightcoral: "f08080",
+ lightcyan: "e0ffff",
+ lightgoldenrodyellow: "fafad2",
+ lightgray: "d3d3d3",
+ lightgreen: "90ee90",
+ lightgrey: "d3d3d3",
+ lightpink: "ffb6c1",
+ lightsalmon: "ffa07a",
+ lightseagreen: "20b2aa",
+ lightskyblue: "87cefa",
+ lightslategray: "789",
+ lightslategrey: "789",
+ lightsteelblue: "b0c4de",
+ lightyellow: "ffffe0",
+ lime: "0f0",
+ limegreen: "32cd32",
+ linen: "faf0e6",
+ magenta: "f0f",
+ maroon: "800000",
+ mediumaquamarine: "66cdaa",
+ mediumblue: "0000cd",
+ mediumorchid: "ba55d3",
+ mediumpurple: "9370db",
+ mediumseagreen: "3cb371",
+ mediumslateblue: "7b68ee",
+ mediumspringgreen: "00fa9a",
+ mediumturquoise: "48d1cc",
+ mediumvioletred: "c71585",
+ midnightblue: "191970",
+ mintcream: "f5fffa",
+ mistyrose: "ffe4e1",
+ moccasin: "ffe4b5",
+ navajowhite: "ffdead",
+ navy: "000080",
+ oldlace: "fdf5e6",
+ olive: "808000",
+ olivedrab: "6b8e23",
+ orange: "ffa500",
+ orangered: "ff4500",
+ orchid: "da70d6",
+ palegoldenrod: "eee8aa",
+ palegreen: "98fb98",
+ paleturquoise: "afeeee",
+ palevioletred: "db7093",
+ papayawhip: "ffefd5",
+ peachpuff: "ffdab9",
+ peru: "cd853f",
+ pink: "ffc0cb",
+ plum: "dda0dd",
+ powderblue: "b0e0e6",
+ purple: "800080",
+ rebeccapurple: "663399",
+ red: "f00",
+ rosybrown: "bc8f8f",
+ royalblue: "4169e1",
+ saddlebrown: "8b4513",
+ salmon: "fa8072",
+ sandybrown: "f4a460",
+ seagreen: "2e8b57",
+ seashell: "fff5ee",
+ sienna: "a0522d",
+ silver: "c0c0c0",
+ skyblue: "87ceeb",
+ slateblue: "6a5acd",
+ slategray: "708090",
+ slategrey: "708090",
+ snow: "fffafa",
+ springgreen: "00ff7f",
+ steelblue: "4682b4",
+ tan: "d2b48c",
+ teal: "008080",
+ thistle: "d8bfd8",
+ tomato: "ff6347",
+ turquoise: "40e0d0",
+ violet: "ee82ee",
+ wheat: "f5deb3",
+ white: "fff",
+ whitesmoke: "f5f5f5",
+ yellow: "ff0",
+ yellowgreen: "9acd32"
+ };
+
+ // Make it easy to access colors via `hexNames[hex]`
+ var hexNames = tinycolor.hexNames = flip(names);
+
+ // Utilities
+ // ---------
+
+ // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
+ function flip(o) {
+ var flipped = {};
+ for (var i in o) {
+ if (o.hasOwnProperty(i)) {
+ flipped[o[i]] = i;
+ }
+ }
+ return flipped;
+ }
+
+ // Return a valid alpha value [0,1] with all invalid values being set to 1
+ function boundAlpha(a) {
+ a = parseFloat(a);
+ if (isNaN(a) || a < 0 || a > 1) {
+ a = 1;
+ }
+ return a;
+ }
+
+ // Take input from [0, n] and return it as [0, 1]
+ function bound01(n, max) {
+ if (isOnePointZero(n)) n = "100%";
+ var processPercent = isPercentage(n);
+ n = Math.min(max, Math.max(0, parseFloat(n)));
+
+ // Automatically convert percentage into number
+ if (processPercent) {
+ n = parseInt(n * max, 10) / 100;
+ }
+
+ // Handle floating point rounding errors
+ if (Math.abs(n - max) < 0.000001) {
+ return 1;
+ }
+
+ // Convert into [0, 1] range if it isn't already
+ return n % max / parseFloat(max);
+ }
+
+ // Force a number between 0 and 1
+ function clamp01(val) {
+ return Math.min(1, Math.max(0, val));
+ }
+
+ // Parse a base-16 hex value into a base-10 integer
+ function parseIntFromHex(val) {
+ return parseInt(val, 16);
+ }
+
+ // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
+ //
+ function isOnePointZero(n) {
+ return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
+ }
+
+ // Check to see if string passed in is a percentage
+ function isPercentage(n) {
+ return typeof n === "string" && n.indexOf("%") != -1;
+ }
+
+ // Force a hex value to have 2 characters
+ function pad2(c) {
+ return c.length == 1 ? "0" + c : "" + c;
+ }
+
+ // Replace a decimal with it's percentage value
+ function convertToPercentage(n) {
+ if (n <= 1) {
+ n = n * 100 + "%";
+ }
+ return n;
+ }
+
+ // Converts a decimal to a hex value
+ function convertDecimalToHex(d) {
+ return Math.round(parseFloat(d) * 255).toString(16);
+ }
+ // Converts a hex value to a decimal
+ function convertHexToDecimal(h) {
+ return parseIntFromHex(h) / 255;
+ }
+ var matchers = function () {
+ //
+ var CSS_INTEGER = "[-\\+]?\\d+%?";
+
+ //
+ var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
+
+ // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
+ var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
+
+ // Actual matching.
+ // Parentheses and commas are optional, but not required.
+ // Whitespace can take the place of commas or opening paren
+ var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
+ var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
+ return {
+ CSS_UNIT: new RegExp(CSS_UNIT),
+ rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
+ rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
+ hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
+ hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
+ hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
+ hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
+ hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
+ hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
+ hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
+ hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
+ };
+ }();
+
+ // `isValidCSSUnit`
+ // Take in a single string / number and check to see if it looks like a CSS unit
+ // (see `matchers` above for definition).
+ function isValidCSSUnit(color) {
+ return !!matchers.CSS_UNIT.exec(color);
+ }
+
+ // `stringInputToObject`
+ // Permissive string parsing. Take in a number of formats, and output an object
+ // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
+ function stringInputToObject(color) {
+ color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
+ var named = false;
+ if (names[color]) {
+ color = names[color];
+ named = true;
+ } else if (color == "transparent") {
+ return {
+ r: 0,
+ g: 0,
+ b: 0,
+ a: 0,
+ format: "name"
+ };
+ }
+
+ // Try to match string input using regular expressions.
+ // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
+ // Just return an object and let the conversion functions handle that.
+ // This way the result will be the same whether the tinycolor is initialized with string or object.
+ var match;
+ if (match = matchers.rgb.exec(color)) {
+ return {
+ r: match[1],
+ g: match[2],
+ b: match[3]
+ };
+ }
+ if (match = matchers.rgba.exec(color)) {
+ return {
+ r: match[1],
+ g: match[2],
+ b: match[3],
+ a: match[4]
+ };
+ }
+ if (match = matchers.hsl.exec(color)) {
+ return {
+ h: match[1],
+ s: match[2],
+ l: match[3]
+ };
+ }
+ if (match = matchers.hsla.exec(color)) {
+ return {
+ h: match[1],
+ s: match[2],
+ l: match[3],
+ a: match[4]
+ };
+ }
+ if (match = matchers.hsv.exec(color)) {
+ return {
+ h: match[1],
+ s: match[2],
+ v: match[3]
+ };
+ }
+ if (match = matchers.hsva.exec(color)) {
+ return {
+ h: match[1],
+ s: match[2],
+ v: match[3],
+ a: match[4]
+ };
+ }
+ if (match = matchers.hex8.exec(color)) {
+ return {
+ r: parseIntFromHex(match[1]),
+ g: parseIntFromHex(match[2]),
+ b: parseIntFromHex(match[3]),
+ a: convertHexToDecimal(match[4]),
+ format: named ? "name" : "hex8"
+ };
+ }
+ if (match = matchers.hex6.exec(color)) {
+ return {
+ r: parseIntFromHex(match[1]),
+ g: parseIntFromHex(match[2]),
+ b: parseIntFromHex(match[3]),
+ format: named ? "name" : "hex"
+ };
+ }
+ if (match = matchers.hex4.exec(color)) {
+ return {
+ r: parseIntFromHex(match[1] + "" + match[1]),
+ g: parseIntFromHex(match[2] + "" + match[2]),
+ b: parseIntFromHex(match[3] + "" + match[3]),
+ a: convertHexToDecimal(match[4] + "" + match[4]),
+ format: named ? "name" : "hex8"
+ };
+ }
+ if (match = matchers.hex3.exec(color)) {
+ return {
+ r: parseIntFromHex(match[1] + "" + match[1]),
+ g: parseIntFromHex(match[2] + "" + match[2]),
+ b: parseIntFromHex(match[3] + "" + match[3]),
+ format: named ? "name" : "hex"
+ };
+ }
+ return false;
+ }
+ function validateWCAG2Parms(parms) {
+ // return valid WCAG2 parms for isReadable.
+ // If input parms are invalid, return {"level":"AA", "size":"small"}
+ var level, size;
+ parms = parms || {
+ level: "AA",
+ size: "small"
+ };
+ level = (parms.level || "AA").toUpperCase();
+ size = (parms.size || "small").toLowerCase();
+ if (level !== "AA" && level !== "AAA") {
+ level = "AA";
+ }
+ if (size !== "small" && size !== "large") {
+ size = "small";
+ }
+ return {
+ level: level,
+ size: size
+ };
+ }
+
+ return tinycolor;
+
+}));
+
+}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
+return __REQUIRE__(1731653753939);
+})()
+//miniprogram-npm-outsideDeps=[]
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/miniprogram_npm/tinycolor2/index.js.map b/miniprogram_npm/tinycolor2/index.js.map
new file mode 100644
index 0000000..b315216
--- /dev/null
+++ b/miniprogram_npm/tinycolor2/index.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["tinycolor.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["// This file is autogenerated. It's used to publish CJS to npm.\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.tinycolor = factory());\n})(this, (function () { \n\n function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n }\n\n // https://github.com/bgrins/TinyColor\n // Brian Grinstead, MIT License\n\n var trimLeft = /^\\s+/;\n var trimRight = /\\s+$/;\n function tinycolor(color, opts) {\n color = color ? color : \"\";\n opts = opts || {};\n\n // If input is already a tinycolor, return itself\n if (color instanceof tinycolor) {\n return color;\n }\n // If we are called as a function, call using new instead\n if (!(this instanceof tinycolor)) {\n return new tinycolor(color, opts);\n }\n var rgb = inputToRGB(color);\n this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;\n this._gradientType = opts.gradientType;\n\n // Don't let the range of [0,255] come back in [0,1].\n // Potentially lose a little bit of precision here, but will fix issues where\n // .5 gets interpreted as half of the total, instead of half of 1\n // If it was supposed to be 128, this was already taken care of by `inputToRgb`\n if (this._r < 1) this._r = Math.round(this._r);\n if (this._g < 1) this._g = Math.round(this._g);\n if (this._b < 1) this._b = Math.round(this._b);\n this._ok = rgb.ok;\n }\n tinycolor.prototype = {\n isDark: function isDark() {\n return this.getBrightness() < 128;\n },\n isLight: function isLight() {\n return !this.isDark();\n },\n isValid: function isValid() {\n return this._ok;\n },\n getOriginalInput: function getOriginalInput() {\n return this._originalInput;\n },\n getFormat: function getFormat() {\n return this._format;\n },\n getAlpha: function getAlpha() {\n return this._a;\n },\n getBrightness: function getBrightness() {\n //http://www.w3.org/TR/AERT#color-contrast\n var rgb = this.toRgb();\n return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;\n },\n getLuminance: function getLuminance() {\n //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef\n var rgb = this.toRgb();\n var RsRGB, GsRGB, BsRGB, R, G, B;\n RsRGB = rgb.r / 255;\n GsRGB = rgb.g / 255;\n BsRGB = rgb.b / 255;\n if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);\n if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);\n if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);\n return 0.2126 * R + 0.7152 * G + 0.0722 * B;\n },\n setAlpha: function setAlpha(value) {\n this._a = boundAlpha(value);\n this._roundA = Math.round(100 * this._a) / 100;\n return this;\n },\n toHsv: function toHsv() {\n var hsv = rgbToHsv(this._r, this._g, this._b);\n return {\n h: hsv.h * 360,\n s: hsv.s,\n v: hsv.v,\n a: this._a\n };\n },\n toHsvString: function toHsvString() {\n var hsv = rgbToHsv(this._r, this._g, this._b);\n var h = Math.round(hsv.h * 360),\n s = Math.round(hsv.s * 100),\n v = Math.round(hsv.v * 100);\n return this._a == 1 ? \"hsv(\" + h + \", \" + s + \"%, \" + v + \"%)\" : \"hsva(\" + h + \", \" + s + \"%, \" + v + \"%, \" + this._roundA + \")\";\n },\n toHsl: function toHsl() {\n var hsl = rgbToHsl(this._r, this._g, this._b);\n return {\n h: hsl.h * 360,\n s: hsl.s,\n l: hsl.l,\n a: this._a\n };\n },\n toHslString: function toHslString() {\n var hsl = rgbToHsl(this._r, this._g, this._b);\n var h = Math.round(hsl.h * 360),\n s = Math.round(hsl.s * 100),\n l = Math.round(hsl.l * 100);\n return this._a == 1 ? \"hsl(\" + h + \", \" + s + \"%, \" + l + \"%)\" : \"hsla(\" + h + \", \" + s + \"%, \" + l + \"%, \" + this._roundA + \")\";\n },\n toHex: function toHex(allow3Char) {\n return rgbToHex(this._r, this._g, this._b, allow3Char);\n },\n toHexString: function toHexString(allow3Char) {\n return \"#\" + this.toHex(allow3Char);\n },\n toHex8: function toHex8(allow4Char) {\n return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);\n },\n toHex8String: function toHex8String(allow4Char) {\n return \"#\" + this.toHex8(allow4Char);\n },\n toRgb: function toRgb() {\n return {\n r: Math.round(this._r),\n g: Math.round(this._g),\n b: Math.round(this._b),\n a: this._a\n };\n },\n toRgbString: function toRgbString() {\n return this._a == 1 ? \"rgb(\" + Math.round(this._r) + \", \" + Math.round(this._g) + \", \" + Math.round(this._b) + \")\" : \"rgba(\" + Math.round(this._r) + \", \" + Math.round(this._g) + \", \" + Math.round(this._b) + \", \" + this._roundA + \")\";\n },\n toPercentageRgb: function toPercentageRgb() {\n return {\n r: Math.round(bound01(this._r, 255) * 100) + \"%\",\n g: Math.round(bound01(this._g, 255) * 100) + \"%\",\n b: Math.round(bound01(this._b, 255) * 100) + \"%\",\n a: this._a\n };\n },\n toPercentageRgbString: function toPercentageRgbString() {\n return this._a == 1 ? \"rgb(\" + Math.round(bound01(this._r, 255) * 100) + \"%, \" + Math.round(bound01(this._g, 255) * 100) + \"%, \" + Math.round(bound01(this._b, 255) * 100) + \"%)\" : \"rgba(\" + Math.round(bound01(this._r, 255) * 100) + \"%, \" + Math.round(bound01(this._g, 255) * 100) + \"%, \" + Math.round(bound01(this._b, 255) * 100) + \"%, \" + this._roundA + \")\";\n },\n toName: function toName() {\n if (this._a === 0) {\n return \"transparent\";\n }\n if (this._a < 1) {\n return false;\n }\n return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;\n },\n toFilter: function toFilter(secondColor) {\n var hex8String = \"#\" + rgbaToArgbHex(this._r, this._g, this._b, this._a);\n var secondHex8String = hex8String;\n var gradientType = this._gradientType ? \"GradientType = 1, \" : \"\";\n if (secondColor) {\n var s = tinycolor(secondColor);\n secondHex8String = \"#\" + rgbaToArgbHex(s._r, s._g, s._b, s._a);\n }\n return \"progid:DXImageTransform.Microsoft.gradient(\" + gradientType + \"startColorstr=\" + hex8String + \",endColorstr=\" + secondHex8String + \")\";\n },\n toString: function toString(format) {\n var formatSet = !!format;\n format = format || this._format;\n var formattedString = false;\n var hasAlpha = this._a < 1 && this._a >= 0;\n var needsAlphaFormat = !formatSet && hasAlpha && (format === \"hex\" || format === \"hex6\" || format === \"hex3\" || format === \"hex4\" || format === \"hex8\" || format === \"name\");\n if (needsAlphaFormat) {\n // Special case for \"transparent\", all other non-alpha formats\n // will return rgba when there is transparency.\n if (format === \"name\" && this._a === 0) {\n return this.toName();\n }\n return this.toRgbString();\n }\n if (format === \"rgb\") {\n formattedString = this.toRgbString();\n }\n if (format === \"prgb\") {\n formattedString = this.toPercentageRgbString();\n }\n if (format === \"hex\" || format === \"hex6\") {\n formattedString = this.toHexString();\n }\n if (format === \"hex3\") {\n formattedString = this.toHexString(true);\n }\n if (format === \"hex4\") {\n formattedString = this.toHex8String(true);\n }\n if (format === \"hex8\") {\n formattedString = this.toHex8String();\n }\n if (format === \"name\") {\n formattedString = this.toName();\n }\n if (format === \"hsl\") {\n formattedString = this.toHslString();\n }\n if (format === \"hsv\") {\n formattedString = this.toHsvString();\n }\n return formattedString || this.toHexString();\n },\n clone: function clone() {\n return tinycolor(this.toString());\n },\n _applyModification: function _applyModification(fn, args) {\n var color = fn.apply(null, [this].concat([].slice.call(args)));\n this._r = color._r;\n this._g = color._g;\n this._b = color._b;\n this.setAlpha(color._a);\n return this;\n },\n lighten: function lighten() {\n return this._applyModification(_lighten, arguments);\n },\n brighten: function brighten() {\n return this._applyModification(_brighten, arguments);\n },\n darken: function darken() {\n return this._applyModification(_darken, arguments);\n },\n desaturate: function desaturate() {\n return this._applyModification(_desaturate, arguments);\n },\n saturate: function saturate() {\n return this._applyModification(_saturate, arguments);\n },\n greyscale: function greyscale() {\n return this._applyModification(_greyscale, arguments);\n },\n spin: function spin() {\n return this._applyModification(_spin, arguments);\n },\n _applyCombination: function _applyCombination(fn, args) {\n return fn.apply(null, [this].concat([].slice.call(args)));\n },\n analogous: function analogous() {\n return this._applyCombination(_analogous, arguments);\n },\n complement: function complement() {\n return this._applyCombination(_complement, arguments);\n },\n monochromatic: function monochromatic() {\n return this._applyCombination(_monochromatic, arguments);\n },\n splitcomplement: function splitcomplement() {\n return this._applyCombination(_splitcomplement, arguments);\n },\n // Disabled until https://github.com/bgrins/TinyColor/issues/254\n // polyad: function (number) {\n // return this._applyCombination(polyad, [number]);\n // },\n triad: function triad() {\n return this._applyCombination(polyad, [3]);\n },\n tetrad: function tetrad() {\n return this._applyCombination(polyad, [4]);\n }\n };\n\n // If input is an object, force 1 into \"1.0\" to handle ratios properly\n // String input requires \"1.0\" as input, so 1 will be treated as 1\n tinycolor.fromRatio = function (color, opts) {\n if (_typeof(color) == \"object\") {\n var newColor = {};\n for (var i in color) {\n if (color.hasOwnProperty(i)) {\n if (i === \"a\") {\n newColor[i] = color[i];\n } else {\n newColor[i] = convertToPercentage(color[i]);\n }\n }\n }\n color = newColor;\n }\n return tinycolor(color, opts);\n };\n\n // Given a string or object, convert that input to RGB\n // Possible string inputs:\n //\n // \"red\"\n // \"#f00\" or \"f00\"\n // \"#ff0000\" or \"ff0000\"\n // \"#ff000000\" or \"ff000000\"\n // \"rgb 255 0 0\" or \"rgb (255, 0, 0)\"\n // \"rgb 1.0 0 0\" or \"rgb (1, 0, 0)\"\n // \"rgba (255, 0, 0, 1)\" or \"rgba 255, 0, 0, 1\"\n // \"rgba (1.0, 0, 0, 1)\" or \"rgba 1.0, 0, 0, 1\"\n // \"hsl(0, 100%, 50%)\" or \"hsl 0 100% 50%\"\n // \"hsla(0, 100%, 50%, 1)\" or \"hsla 0 100% 50%, 1\"\n // \"hsv(0, 100%, 100%)\" or \"hsv 0 100% 100%\"\n //\n function inputToRGB(color) {\n var rgb = {\n r: 0,\n g: 0,\n b: 0\n };\n var a = 1;\n var s = null;\n var v = null;\n var l = null;\n var ok = false;\n var format = false;\n if (typeof color == \"string\") {\n color = stringInputToObject(color);\n }\n if (_typeof(color) == \"object\") {\n if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {\n rgb = rgbToRgb(color.r, color.g, color.b);\n ok = true;\n format = String(color.r).substr(-1) === \"%\" ? \"prgb\" : \"rgb\";\n } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {\n s = convertToPercentage(color.s);\n v = convertToPercentage(color.v);\n rgb = hsvToRgb(color.h, s, v);\n ok = true;\n format = \"hsv\";\n } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {\n s = convertToPercentage(color.s);\n l = convertToPercentage(color.l);\n rgb = hslToRgb(color.h, s, l);\n ok = true;\n format = \"hsl\";\n }\n if (color.hasOwnProperty(\"a\")) {\n a = color.a;\n }\n }\n a = boundAlpha(a);\n return {\n ok: ok,\n format: color.format || format,\n r: Math.min(255, Math.max(rgb.r, 0)),\n g: Math.min(255, Math.max(rgb.g, 0)),\n b: Math.min(255, Math.max(rgb.b, 0)),\n a: a\n };\n }\n\n // Conversion Functions\n // --------------------\n\n // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:\n // \n\n // `rgbToRgb`\n // Handle bounds / percentage checking to conform to CSS color spec\n // \n // *Assumes:* r, g, b in [0, 255] or [0, 1]\n // *Returns:* { r, g, b } in [0, 255]\n function rgbToRgb(r, g, b) {\n return {\n r: bound01(r, 255) * 255,\n g: bound01(g, 255) * 255,\n b: bound01(b, 255) * 255\n };\n }\n\n // `rgbToHsl`\n // Converts an RGB color value to HSL.\n // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]\n // *Returns:* { h, s, l } in [0,1]\n function rgbToHsl(r, g, b) {\n r = bound01(r, 255);\n g = bound01(g, 255);\n b = bound01(b, 255);\n var max = Math.max(r, g, b),\n min = Math.min(r, g, b);\n var h,\n s,\n l = (max + min) / 2;\n if (max == min) {\n h = s = 0; // achromatic\n } else {\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n h /= 6;\n }\n return {\n h: h,\n s: s,\n l: l\n };\n }\n\n // `hslToRgb`\n // Converts an HSL color value to RGB.\n // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]\n // *Returns:* { r, g, b } in the set [0, 255]\n function hslToRgb(h, s, l) {\n var r, g, b;\n h = bound01(h, 360);\n s = bound01(s, 100);\n l = bound01(l, 100);\n function hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n }\n if (s === 0) {\n r = g = b = l; // achromatic\n } else {\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n return {\n r: r * 255,\n g: g * 255,\n b: b * 255\n };\n }\n\n // `rgbToHsv`\n // Converts an RGB color value to HSV\n // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]\n // *Returns:* { h, s, v } in [0,1]\n function rgbToHsv(r, g, b) {\n r = bound01(r, 255);\n g = bound01(g, 255);\n b = bound01(b, 255);\n var max = Math.max(r, g, b),\n min = Math.min(r, g, b);\n var h,\n s,\n v = max;\n var d = max - min;\n s = max === 0 ? 0 : d / max;\n if (max == min) {\n h = 0; // achromatic\n } else {\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n h /= 6;\n }\n return {\n h: h,\n s: s,\n v: v\n };\n }\n\n // `hsvToRgb`\n // Converts an HSV color value to RGB.\n // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]\n // *Returns:* { r, g, b } in the set [0, 255]\n function hsvToRgb(h, s, v) {\n h = bound01(h, 360) * 6;\n s = bound01(s, 100);\n v = bound01(v, 100);\n var i = Math.floor(h),\n f = h - i,\n p = v * (1 - s),\n q = v * (1 - f * s),\n t = v * (1 - (1 - f) * s),\n mod = i % 6,\n r = [v, q, p, p, t, v][mod],\n g = [t, v, v, q, p, p][mod],\n b = [p, p, t, v, v, q][mod];\n return {\n r: r * 255,\n g: g * 255,\n b: b * 255\n };\n }\n\n // `rgbToHex`\n // Converts an RGB color to hex\n // Assumes r, g, and b are contained in the set [0, 255]\n // Returns a 3 or 6 character hex\n function rgbToHex(r, g, b, allow3Char) {\n var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n return hex.join(\"\");\n }\n\n // `rgbaToHex`\n // Converts an RGBA color plus alpha transparency to hex\n // Assumes r, g, b are contained in the set [0, 255] and\n // a in [0, 1]. Returns a 4 or 8 character rgba hex\n function rgbaToHex(r, g, b, a, allow4Char) {\n var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];\n\n // Return a 4 character hex if possible\n if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);\n }\n return hex.join(\"\");\n }\n\n // `rgbaToArgbHex`\n // Converts an RGBA color to an ARGB Hex8 string\n // Rarely used, but required for \"toFilter()\"\n function rgbaToArgbHex(r, g, b, a) {\n var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];\n return hex.join(\"\");\n }\n\n // `equals`\n // Can be called with any tinycolor input\n tinycolor.equals = function (color1, color2) {\n if (!color1 || !color2) return false;\n return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();\n };\n tinycolor.random = function () {\n return tinycolor.fromRatio({\n r: Math.random(),\n g: Math.random(),\n b: Math.random()\n });\n };\n\n // Modification Functions\n // ----------------------\n // Thanks to less.js for some of the basics here\n // \n\n function _desaturate(color, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl = tinycolor(color).toHsl();\n hsl.s -= amount / 100;\n hsl.s = clamp01(hsl.s);\n return tinycolor(hsl);\n }\n function _saturate(color, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl = tinycolor(color).toHsl();\n hsl.s += amount / 100;\n hsl.s = clamp01(hsl.s);\n return tinycolor(hsl);\n }\n function _greyscale(color) {\n return tinycolor(color).desaturate(100);\n }\n function _lighten(color, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl = tinycolor(color).toHsl();\n hsl.l += amount / 100;\n hsl.l = clamp01(hsl.l);\n return tinycolor(hsl);\n }\n function _brighten(color, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var rgb = tinycolor(color).toRgb();\n rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));\n rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));\n rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));\n return tinycolor(rgb);\n }\n function _darken(color, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl = tinycolor(color).toHsl();\n hsl.l -= amount / 100;\n hsl.l = clamp01(hsl.l);\n return tinycolor(hsl);\n }\n\n // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.\n // Values outside of this range will be wrapped into this range.\n function _spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n }\n\n // Combination Functions\n // ---------------------\n // Thanks to jQuery xColor for some of the ideas behind these\n // \n\n function _complement(color) {\n var hsl = tinycolor(color).toHsl();\n hsl.h = (hsl.h + 180) % 360;\n return tinycolor(hsl);\n }\n function polyad(color, number) {\n if (isNaN(number) || number <= 0) {\n throw new Error(\"Argument to polyad must be a positive number\");\n }\n var hsl = tinycolor(color).toHsl();\n var result = [tinycolor(color)];\n var step = 360 / number;\n for (var i = 1; i < number; i++) {\n result.push(tinycolor({\n h: (hsl.h + i * step) % 360,\n s: hsl.s,\n l: hsl.l\n }));\n }\n return result;\n }\n function _splitcomplement(color) {\n var hsl = tinycolor(color).toHsl();\n var h = hsl.h;\n return [tinycolor(color), tinycolor({\n h: (h + 72) % 360,\n s: hsl.s,\n l: hsl.l\n }), tinycolor({\n h: (h + 216) % 360,\n s: hsl.s,\n l: hsl.l\n })];\n }\n function _analogous(color, results, slices) {\n results = results || 6;\n slices = slices || 30;\n var hsl = tinycolor(color).toHsl();\n var part = 360 / slices;\n var ret = [tinycolor(color)];\n for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {\n hsl.h = (hsl.h + part) % 360;\n ret.push(tinycolor(hsl));\n }\n return ret;\n }\n function _monochromatic(color, results) {\n results = results || 6;\n var hsv = tinycolor(color).toHsv();\n var h = hsv.h,\n s = hsv.s,\n v = hsv.v;\n var ret = [];\n var modification = 1 / results;\n while (results--) {\n ret.push(tinycolor({\n h: h,\n s: s,\n v: v\n }));\n v = (v + modification) % 1;\n }\n return ret;\n }\n\n // Utility Functions\n // ---------------------\n\n tinycolor.mix = function (color1, color2, amount) {\n amount = amount === 0 ? 0 : amount || 50;\n var rgb1 = tinycolor(color1).toRgb();\n var rgb2 = tinycolor(color2).toRgb();\n var p = amount / 100;\n var rgba = {\n r: (rgb2.r - rgb1.r) * p + rgb1.r,\n g: (rgb2.g - rgb1.g) * p + rgb1.g,\n b: (rgb2.b - rgb1.b) * p + rgb1.b,\n a: (rgb2.a - rgb1.a) * p + rgb1.a\n };\n return tinycolor(rgba);\n };\n\n // Readability Functions\n // ---------------------\n // false\n // tinycolor.isReadable(\"#000\", \"#111\",{level:\"AA\",size:\"large\"}) => false\n tinycolor.isReadable = function (color1, color2, wcag2) {\n var readability = tinycolor.readability(color1, color2);\n var wcag2Parms, out;\n out = false;\n wcag2Parms = validateWCAG2Parms(wcag2);\n switch (wcag2Parms.level + wcag2Parms.size) {\n case \"AAsmall\":\n case \"AAAlarge\":\n out = readability >= 4.5;\n break;\n case \"AAlarge\":\n out = readability >= 3;\n break;\n case \"AAAsmall\":\n out = readability >= 7;\n break;\n }\n return out;\n };\n\n // `mostReadable`\n // Given a base color and a list of possible foreground or background\n // colors for that base, returns the most readable color.\n // Optionally returns Black or White if the most readable color is unreadable.\n // *Example*\n // tinycolor.mostReadable(tinycolor.mostReadable(\"#123\", [\"#124\", \"#125\"],{includeFallbackColors:false}).toHexString(); // \"#112255\"\n // tinycolor.mostReadable(tinycolor.mostReadable(\"#123\", [\"#124\", \"#125\"],{includeFallbackColors:true}).toHexString(); // \"#ffffff\"\n // tinycolor.mostReadable(\"#a8015a\", [\"#faf3f3\"],{includeFallbackColors:true,level:\"AAA\",size:\"large\"}).toHexString(); // \"#faf3f3\"\n // tinycolor.mostReadable(\"#a8015a\", [\"#faf3f3\"],{includeFallbackColors:true,level:\"AAA\",size:\"small\"}).toHexString(); // \"#ffffff\"\n tinycolor.mostReadable = function (baseColor, colorList, args) {\n var bestColor = null;\n var bestScore = 0;\n var readability;\n var includeFallbackColors, level, size;\n args = args || {};\n includeFallbackColors = args.includeFallbackColors;\n level = args.level;\n size = args.size;\n for (var i = 0; i < colorList.length; i++) {\n readability = tinycolor.readability(baseColor, colorList[i]);\n if (readability > bestScore) {\n bestScore = readability;\n bestColor = tinycolor(colorList[i]);\n }\n }\n if (tinycolor.isReadable(baseColor, bestColor, {\n level: level,\n size: size\n }) || !includeFallbackColors) {\n return bestColor;\n } else {\n args.includeFallbackColors = false;\n return tinycolor.mostReadable(baseColor, [\"#fff\", \"#000\"], args);\n }\n };\n\n // Big List of Colors\n // ------------------\n // \n var names = tinycolor.names = {\n aliceblue: \"f0f8ff\",\n antiquewhite: \"faebd7\",\n aqua: \"0ff\",\n aquamarine: \"7fffd4\",\n azure: \"f0ffff\",\n beige: \"f5f5dc\",\n bisque: \"ffe4c4\",\n black: \"000\",\n blanchedalmond: \"ffebcd\",\n blue: \"00f\",\n blueviolet: \"8a2be2\",\n brown: \"a52a2a\",\n burlywood: \"deb887\",\n burntsienna: \"ea7e5d\",\n cadetblue: \"5f9ea0\",\n chartreuse: \"7fff00\",\n chocolate: \"d2691e\",\n coral: \"ff7f50\",\n cornflowerblue: \"6495ed\",\n cornsilk: \"fff8dc\",\n crimson: \"dc143c\",\n cyan: \"0ff\",\n darkblue: \"00008b\",\n darkcyan: \"008b8b\",\n darkgoldenrod: \"b8860b\",\n darkgray: \"a9a9a9\",\n darkgreen: \"006400\",\n darkgrey: \"a9a9a9\",\n darkkhaki: \"bdb76b\",\n darkmagenta: \"8b008b\",\n darkolivegreen: \"556b2f\",\n darkorange: \"ff8c00\",\n darkorchid: \"9932cc\",\n darkred: \"8b0000\",\n darksalmon: \"e9967a\",\n darkseagreen: \"8fbc8f\",\n darkslateblue: \"483d8b\",\n darkslategray: \"2f4f4f\",\n darkslategrey: \"2f4f4f\",\n darkturquoise: \"00ced1\",\n darkviolet: \"9400d3\",\n deeppink: \"ff1493\",\n deepskyblue: \"00bfff\",\n dimgray: \"696969\",\n dimgrey: \"696969\",\n dodgerblue: \"1e90ff\",\n firebrick: \"b22222\",\n floralwhite: \"fffaf0\",\n forestgreen: \"228b22\",\n fuchsia: \"f0f\",\n gainsboro: \"dcdcdc\",\n ghostwhite: \"f8f8ff\",\n gold: \"ffd700\",\n goldenrod: \"daa520\",\n gray: \"808080\",\n green: \"008000\",\n greenyellow: \"adff2f\",\n grey: \"808080\",\n honeydew: \"f0fff0\",\n hotpink: \"ff69b4\",\n indianred: \"cd5c5c\",\n indigo: \"4b0082\",\n ivory: \"fffff0\",\n khaki: \"f0e68c\",\n lavender: \"e6e6fa\",\n lavenderblush: \"fff0f5\",\n lawngreen: \"7cfc00\",\n lemonchiffon: \"fffacd\",\n lightblue: \"add8e6\",\n lightcoral: \"f08080\",\n lightcyan: \"e0ffff\",\n lightgoldenrodyellow: \"fafad2\",\n lightgray: \"d3d3d3\",\n lightgreen: \"90ee90\",\n lightgrey: \"d3d3d3\",\n lightpink: \"ffb6c1\",\n lightsalmon: \"ffa07a\",\n lightseagreen: \"20b2aa\",\n lightskyblue: \"87cefa\",\n lightslategray: \"789\",\n lightslategrey: \"789\",\n lightsteelblue: \"b0c4de\",\n lightyellow: \"ffffe0\",\n lime: \"0f0\",\n limegreen: \"32cd32\",\n linen: \"faf0e6\",\n magenta: \"f0f\",\n maroon: \"800000\",\n mediumaquamarine: \"66cdaa\",\n mediumblue: \"0000cd\",\n mediumorchid: \"ba55d3\",\n mediumpurple: \"9370db\",\n mediumseagreen: \"3cb371\",\n mediumslateblue: \"7b68ee\",\n mediumspringgreen: \"00fa9a\",\n mediumturquoise: \"48d1cc\",\n mediumvioletred: \"c71585\",\n midnightblue: \"191970\",\n mintcream: \"f5fffa\",\n mistyrose: \"ffe4e1\",\n moccasin: \"ffe4b5\",\n navajowhite: \"ffdead\",\n navy: \"000080\",\n oldlace: \"fdf5e6\",\n olive: \"808000\",\n olivedrab: \"6b8e23\",\n orange: \"ffa500\",\n orangered: \"ff4500\",\n orchid: \"da70d6\",\n palegoldenrod: \"eee8aa\",\n palegreen: \"98fb98\",\n paleturquoise: \"afeeee\",\n palevioletred: \"db7093\",\n papayawhip: \"ffefd5\",\n peachpuff: \"ffdab9\",\n peru: \"cd853f\",\n pink: \"ffc0cb\",\n plum: \"dda0dd\",\n powderblue: \"b0e0e6\",\n purple: \"800080\",\n rebeccapurple: \"663399\",\n red: \"f00\",\n rosybrown: \"bc8f8f\",\n royalblue: \"4169e1\",\n saddlebrown: \"8b4513\",\n salmon: \"fa8072\",\n sandybrown: \"f4a460\",\n seagreen: \"2e8b57\",\n seashell: \"fff5ee\",\n sienna: \"a0522d\",\n silver: \"c0c0c0\",\n skyblue: \"87ceeb\",\n slateblue: \"6a5acd\",\n slategray: \"708090\",\n slategrey: \"708090\",\n snow: \"fffafa\",\n springgreen: \"00ff7f\",\n steelblue: \"4682b4\",\n tan: \"d2b48c\",\n teal: \"008080\",\n thistle: \"d8bfd8\",\n tomato: \"ff6347\",\n turquoise: \"40e0d0\",\n violet: \"ee82ee\",\n wheat: \"f5deb3\",\n white: \"fff\",\n whitesmoke: \"f5f5f5\",\n yellow: \"ff0\",\n yellowgreen: \"9acd32\"\n };\n\n // Make it easy to access colors via `hexNames[hex]`\n var hexNames = tinycolor.hexNames = flip(names);\n\n // Utilities\n // ---------\n\n // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`\n function flip(o) {\n var flipped = {};\n for (var i in o) {\n if (o.hasOwnProperty(i)) {\n flipped[o[i]] = i;\n }\n }\n return flipped;\n }\n\n // Return a valid alpha value [0,1] with all invalid values being set to 1\n function boundAlpha(a) {\n a = parseFloat(a);\n if (isNaN(a) || a < 0 || a > 1) {\n a = 1;\n }\n return a;\n }\n\n // Take input from [0, n] and return it as [0, 1]\n function bound01(n, max) {\n if (isOnePointZero(n)) n = \"100%\";\n var processPercent = isPercentage(n);\n n = Math.min(max, Math.max(0, parseFloat(n)));\n\n // Automatically convert percentage into number\n if (processPercent) {\n n = parseInt(n * max, 10) / 100;\n }\n\n // Handle floating point rounding errors\n if (Math.abs(n - max) < 0.000001) {\n return 1;\n }\n\n // Convert into [0, 1] range if it isn't already\n return n % max / parseFloat(max);\n }\n\n // Force a number between 0 and 1\n function clamp01(val) {\n return Math.min(1, Math.max(0, val));\n }\n\n // Parse a base-16 hex value into a base-10 integer\n function parseIntFromHex(val) {\n return parseInt(val, 16);\n }\n\n // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1\n // \n function isOnePointZero(n) {\n return typeof n == \"string\" && n.indexOf(\".\") != -1 && parseFloat(n) === 1;\n }\n\n // Check to see if string passed in is a percentage\n function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf(\"%\") != -1;\n }\n\n // Force a hex value to have 2 characters\n function pad2(c) {\n return c.length == 1 ? \"0\" + c : \"\" + c;\n }\n\n // Replace a decimal with it's percentage value\n function convertToPercentage(n) {\n if (n <= 1) {\n n = n * 100 + \"%\";\n }\n return n;\n }\n\n // Converts a decimal to a hex value\n function convertDecimalToHex(d) {\n return Math.round(parseFloat(d) * 255).toString(16);\n }\n // Converts a hex value to a decimal\n function convertHexToDecimal(h) {\n return parseIntFromHex(h) / 255;\n }\n var matchers = function () {\n // \n var CSS_INTEGER = \"[-\\\\+]?\\\\d+%?\";\n\n // \n var CSS_NUMBER = \"[-\\\\+]?\\\\d*\\\\.\\\\d+%?\";\n\n // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.\n var CSS_UNIT = \"(?:\" + CSS_NUMBER + \")|(?:\" + CSS_INTEGER + \")\";\n\n // Actual matching.\n // Parentheses and commas are optional, but not required.\n // Whitespace can take the place of commas or opening paren\n var PERMISSIVE_MATCH3 = \"[\\\\s|\\\\(]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")\\\\s*\\\\)?\";\n var PERMISSIVE_MATCH4 = \"[\\\\s|\\\\(]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")\\\\s*\\\\)?\";\n return {\n CSS_UNIT: new RegExp(CSS_UNIT),\n rgb: new RegExp(\"rgb\" + PERMISSIVE_MATCH3),\n rgba: new RegExp(\"rgba\" + PERMISSIVE_MATCH4),\n hsl: new RegExp(\"hsl\" + PERMISSIVE_MATCH3),\n hsla: new RegExp(\"hsla\" + PERMISSIVE_MATCH4),\n hsv: new RegExp(\"hsv\" + PERMISSIVE_MATCH3),\n hsva: new RegExp(\"hsva\" + PERMISSIVE_MATCH4),\n hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,\n hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,\n hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,\n hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/\n };\n }();\n\n // `isValidCSSUnit`\n // Take in a single string / number and check to see if it looks like a CSS unit\n // (see `matchers` above for definition).\n function isValidCSSUnit(color) {\n return !!matchers.CSS_UNIT.exec(color);\n }\n\n // `stringInputToObject`\n // Permissive string parsing. Take in a number of formats, and output an object\n // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`\n function stringInputToObject(color) {\n color = color.replace(trimLeft, \"\").replace(trimRight, \"\").toLowerCase();\n var named = false;\n if (names[color]) {\n color = names[color];\n named = true;\n } else if (color == \"transparent\") {\n return {\n r: 0,\n g: 0,\n b: 0,\n a: 0,\n format: \"name\"\n };\n }\n\n // Try to match string input using regular expressions.\n // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]\n // Just return an object and let the conversion functions handle that.\n // This way the result will be the same whether the tinycolor is initialized with string or object.\n var match;\n if (match = matchers.rgb.exec(color)) {\n return {\n r: match[1],\n g: match[2],\n b: match[3]\n };\n }\n if (match = matchers.rgba.exec(color)) {\n return {\n r: match[1],\n g: match[2],\n b: match[3],\n a: match[4]\n };\n }\n if (match = matchers.hsl.exec(color)) {\n return {\n h: match[1],\n s: match[2],\n l: match[3]\n };\n }\n if (match = matchers.hsla.exec(color)) {\n return {\n h: match[1],\n s: match[2],\n l: match[3],\n a: match[4]\n };\n }\n if (match = matchers.hsv.exec(color)) {\n return {\n h: match[1],\n s: match[2],\n v: match[3]\n };\n }\n if (match = matchers.hsva.exec(color)) {\n return {\n h: match[1],\n s: match[2],\n v: match[3],\n a: match[4]\n };\n }\n if (match = matchers.hex8.exec(color)) {\n return {\n r: parseIntFromHex(match[1]),\n g: parseIntFromHex(match[2]),\n b: parseIntFromHex(match[3]),\n a: convertHexToDecimal(match[4]),\n format: named ? \"name\" : \"hex8\"\n };\n }\n if (match = matchers.hex6.exec(color)) {\n return {\n r: parseIntFromHex(match[1]),\n g: parseIntFromHex(match[2]),\n b: parseIntFromHex(match[3]),\n format: named ? \"name\" : \"hex\"\n };\n }\n if (match = matchers.hex4.exec(color)) {\n return {\n r: parseIntFromHex(match[1] + \"\" + match[1]),\n g: parseIntFromHex(match[2] + \"\" + match[2]),\n b: parseIntFromHex(match[3] + \"\" + match[3]),\n a: convertHexToDecimal(match[4] + \"\" + match[4]),\n format: named ? \"name\" : \"hex8\"\n };\n }\n if (match = matchers.hex3.exec(color)) {\n return {\n r: parseIntFromHex(match[1] + \"\" + match[1]),\n g: parseIntFromHex(match[2] + \"\" + match[2]),\n b: parseIntFromHex(match[3] + \"\" + match[3]),\n format: named ? \"name\" : \"hex\"\n };\n }\n return false;\n }\n function validateWCAG2Parms(parms) {\n // return valid WCAG2 parms for isReadable.\n // If input parms are invalid, return {\"level\":\"AA\", \"size\":\"small\"}\n var level, size;\n parms = parms || {\n level: \"AA\",\n size: \"small\"\n };\n level = (parms.level || \"AA\").toUpperCase();\n size = (parms.size || \"small\").toLowerCase();\n if (level !== \"AA\" && level !== \"AAA\") {\n level = \"AA\";\n }\n if (size !== \"small\" && size !== \"large\") {\n size = \"small\";\n }\n return {\n level: level,\n size: size\n };\n }\n\n return tinycolor;\n\n}));\n"]}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..0535b89
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,121 @@
+{
+ "name": "zhihuixiang",
+ "version": "1.0.0",
+ "lockfileVersion": 2,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "zhihuixiang",
+ "version": "1.0.0",
+ "license": "ISC",
+ "dependencies": {
+ "miniprogram-computed": "^5.1.0",
+ "signalr-for-wx": "^1.1.6",
+ "tdesign-miniprogram": "^1.7.1"
+ }
+ },
+ "node_modules/dayjs": {
+ "version": "1.11.13",
+ "resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz",
+ "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg=="
+ },
+ "node_modules/fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmmirror.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
+ },
+ "node_modules/miniprogram-api-typings": {
+ "version": "3.12.3",
+ "resolved": "https://registry.npmmirror.com/miniprogram-api-typings/-/miniprogram-api-typings-3.12.3.tgz",
+ "integrity": "sha512-o7bOfrU28MEMCBWo83nXv0ROQSBFxJcfCl4f2wTYqah64ipC5RGqLJfvWJTWhlQt2ECVwspSzM8LgvnfMo7TEQ=="
+ },
+ "node_modules/miniprogram-computed": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmmirror.com/miniprogram-computed/-/miniprogram-computed-5.1.0.tgz",
+ "integrity": "sha512-sA2Kx9N8xYnZtOlZogSzCUdy+e6wTztnnAzbY2yRksdXL5Zo2Zs2BGzHMTLvn1JlDyyS5K9QD0L4ksohfxNOYg==",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.3",
+ "miniprogram-api-typings": "^3.12.2",
+ "rfdc": "^1.3.1"
+ }
+ },
+ "node_modules/rfdc": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmmirror.com/rfdc/-/rfdc-1.4.1.tgz",
+ "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA=="
+ },
+ "node_modules/signalr-for-wx": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmmirror.com/signalr-for-wx/-/signalr-for-wx-1.1.6.tgz",
+ "integrity": "sha512-TvVjblzG/uAUE9dyRNU7CLQBR77+fsIrIo24TK+gwp+7WQbvjGfrBEzBXroipsRc4/B+Sc7bTeuktT3ZYtEcBA==",
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/tdesign-miniprogram": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmmirror.com/tdesign-miniprogram/-/tdesign-miniprogram-1.8.0.tgz",
+ "integrity": "sha512-/ecDMkcrA6J1ocJ30N4AAxdPTbRz2gpigW1NEHu1TwTXHx0STG0FOpgJGoU1WYCyJRPv72kgYfF9VgZjZqxJMg==",
+ "dependencies": {
+ "dayjs": "^1.10.7",
+ "tinycolor2": "^1.4.2"
+ }
+ },
+ "node_modules/tinycolor2": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmmirror.com/tinycolor2/-/tinycolor2-1.6.0.tgz",
+ "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw=="
+ }
+ },
+ "dependencies": {
+ "dayjs": {
+ "version": "1.11.13",
+ "resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz",
+ "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg=="
+ },
+ "fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmmirror.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
+ },
+ "miniprogram-api-typings": {
+ "version": "3.12.3",
+ "resolved": "https://registry.npmmirror.com/miniprogram-api-typings/-/miniprogram-api-typings-3.12.3.tgz",
+ "integrity": "sha512-o7bOfrU28MEMCBWo83nXv0ROQSBFxJcfCl4f2wTYqah64ipC5RGqLJfvWJTWhlQt2ECVwspSzM8LgvnfMo7TEQ=="
+ },
+ "miniprogram-computed": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmmirror.com/miniprogram-computed/-/miniprogram-computed-5.1.0.tgz",
+ "integrity": "sha512-sA2Kx9N8xYnZtOlZogSzCUdy+e6wTztnnAzbY2yRksdXL5Zo2Zs2BGzHMTLvn1JlDyyS5K9QD0L4ksohfxNOYg==",
+ "requires": {
+ "fast-deep-equal": "^3.1.3",
+ "miniprogram-api-typings": "^3.12.2",
+ "rfdc": "^1.3.1"
+ }
+ },
+ "rfdc": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmmirror.com/rfdc/-/rfdc-1.4.1.tgz",
+ "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA=="
+ },
+ "signalr-for-wx": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmmirror.com/signalr-for-wx/-/signalr-for-wx-1.1.6.tgz",
+ "integrity": "sha512-TvVjblzG/uAUE9dyRNU7CLQBR77+fsIrIo24TK+gwp+7WQbvjGfrBEzBXroipsRc4/B+Sc7bTeuktT3ZYtEcBA=="
+ },
+ "tdesign-miniprogram": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmmirror.com/tdesign-miniprogram/-/tdesign-miniprogram-1.8.0.tgz",
+ "integrity": "sha512-/ecDMkcrA6J1ocJ30N4AAxdPTbRz2gpigW1NEHu1TwTXHx0STG0FOpgJGoU1WYCyJRPv72kgYfF9VgZjZqxJMg==",
+ "requires": {
+ "dayjs": "^1.10.7",
+ "tinycolor2": "^1.4.2"
+ }
+ },
+ "tinycolor2": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmmirror.com/tinycolor2/-/tinycolor2-1.6.0.tgz",
+ "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw=="
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..412cefc
--- /dev/null
+++ b/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "zhihuixiang",
+ "version": "1.0.0",
+ "description": "",
+ "main": ".eslintrc.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "dependencies": {
+ "miniprogram-computed": "^5.1.0",
+ "signalr-for-wx": "^1.1.6",
+ "tdesign-miniprogram": "^1.7.1"
+ }
+}
diff --git a/pages/action-sheet/action-sheet.d.ts b/pages/action-sheet/action-sheet.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/action-sheet/action-sheet.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/action-sheet/action-sheet.js b/pages/action-sheet/action-sheet.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/action-sheet/action-sheet.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/action-sheet/action-sheet.json b/pages/action-sheet/action-sheet.json
deleted file mode 100644
index 8407e42..0000000
--- a/pages/action-sheet/action-sheet.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "navigationBarTitleText": "ActionSheet",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "t-toast": "tdesign-miniprogram/toast/toast",
- "list": "./list",
- "status": "./status",
- "grid": "./grid",
- "align": "./align"
- }
-}
diff --git a/pages/action-sheet/action-sheet.wxml b/pages/action-sheet/action-sheet.wxml
deleted file mode 100644
index d410aec..0000000
--- a/pages/action-sheet/action-sheet.wxml
+++ /dev/null
@@ -1,19 +0,0 @@
-
- ActionSheet 动作面板
- 从底部弹出的模态框,提供和当前场景相关的操作动作,也支持提供信息输入和描述。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/action-sheet/action-sheet.wxss b/pages/action-sheet/action-sheet.wxss
deleted file mode 100644
index 346f6bb..0000000
--- a/pages/action-sheet/action-sheet.wxss
+++ /dev/null
@@ -1,6 +0,0 @@
-page {
- background-color: #fff;
-}
-page .t-button {
- margin-top: 32rpx;
-}
diff --git a/pages/action-sheet/align/index.js b/pages/action-sheet/align/index.js
deleted file mode 100644
index 1262b48..0000000
--- a/pages/action-sheet/align/index.js
+++ /dev/null
@@ -1,36 +0,0 @@
-import ActionSheet, { ActionSheetTheme } from 'tdesign-miniprogram/action-sheet/index';
-
-Component({
- methods: {
- handleAction() {
- ActionSheet.show({
- theme: ActionSheetTheme.List,
- selector: '#t-action-sheet',
- context: this,
- align: 'left',
- description: '动作面板描述文字',
- items: [
- {
- label: '选项一',
- icon: 'app',
- },
- {
- label: '选项二',
- icon: 'app',
- },
- {
- label: '选项三',
- icon: 'app',
- },
- {
- label: '选项四',
- icon: 'app',
- },
- ],
- });
- },
- handleSelected(e) {
- console.log(e.detail);
- },
- },
-});
diff --git a/pages/action-sheet/align/index.json b/pages/action-sheet/align/index.json
deleted file mode 100644
index be68511..0000000
--- a/pages/action-sheet/align/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-action-sheet": "tdesign-miniprogram/action-sheet/action-sheet"
- }
-}
diff --git a/pages/action-sheet/align/index.wxml b/pages/action-sheet/align/index.wxml
deleted file mode 100644
index fbae887..0000000
--- a/pages/action-sheet/align/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-左对齐列表型
diff --git a/pages/action-sheet/grid/index.js b/pages/action-sheet/grid/index.js
deleted file mode 100644
index 8049b70..0000000
--- a/pages/action-sheet/grid/index.js
+++ /dev/null
@@ -1,65 +0,0 @@
-import ActionSheet, { ActionSheetTheme } from 'tdesign-miniprogram/action-sheet/index';
-
-const firstGrid = [
- {
- label: '微信',
- image: 'https://tdesign.gtimg.com/miniprogram/logo/wechat.png',
- },
- {
- label: '朋友圈',
- image: 'https://tdesign.gtimg.com/miniprogram/logo/times.png',
- },
- {
- label: 'QQ',
- image: 'https://tdesign.gtimg.com/miniprogram/logo/qq.png',
- },
- {
- label: '企业微信',
- image: 'https://tdesign.gtimg.com/miniprogram/logo/wecom.png',
- },
- {
- label: '收藏',
- icon: 'star',
- },
- {
- label: '刷新',
- icon: 'refresh',
- },
- {
- label: '下载',
- icon: 'download',
- },
- {
- label: '复制',
- icon: 'queue',
- },
-];
-
-Component({
- methods: {
- handleAction() {
- ActionSheet.show({
- theme: ActionSheetTheme.Grid,
- selector: '#t-action-sheet',
- context: this,
- items: firstGrid,
- });
- },
- handleMultiAction() {
- ActionSheet.show({
- theme: ActionSheetTheme.Grid,
- selector: '#t-action-sheet',
- context: this,
- items: firstGrid.concat(
- new Array(8).fill({
- label: '标题文字',
- icon: 'image',
- }),
- ),
- });
- },
- handleSelected(e) {
- console.log(e.detail);
- },
- },
-});
diff --git a/pages/action-sheet/grid/index.json b/pages/action-sheet/grid/index.json
deleted file mode 100644
index be68511..0000000
--- a/pages/action-sheet/grid/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-action-sheet": "tdesign-miniprogram/action-sheet/action-sheet"
- }
-}
diff --git a/pages/action-sheet/grid/index.wxml b/pages/action-sheet/grid/index.wxml
deleted file mode 100644
index 292ac95..0000000
--- a/pages/action-sheet/grid/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-常规宫格型
-
-带翻页宫格型
diff --git a/pages/action-sheet/list/index.js b/pages/action-sheet/list/index.js
deleted file mode 100644
index 90ce60d..0000000
--- a/pages/action-sheet/list/index.js
+++ /dev/null
@@ -1,74 +0,0 @@
-import ActionSheet, { ActionSheetTheme } from 'tdesign-miniprogram/action-sheet/index';
-
-Component({
- methods: {
- handleAction() {
- ActionSheet.show({
- theme: ActionSheetTheme.List,
- selector: '#t-action-sheet',
- context: this,
- items: [
- {
- label: '选项一',
- },
- {
- label: '选项二',
- },
- {
- label: '选项三',
- },
- {
- label: '选项四',
- },
- ],
- });
- },
- showDescAction() {
- ActionSheet.show({
- theme: ActionSheetTheme.List,
- selector: '#t-action-sheet',
- context: this,
- description: '动作面板描述文字',
- items: [
- {
- label: '选项一',
- },
- {
- label: '选项二',
- },
- {
- label: '选项三',
- },
- ],
- });
- },
- showIconAction() {
- ActionSheet.show({
- theme: ActionSheetTheme.List,
- selector: '#t-action-sheet',
- context: this,
- items: [
- {
- label: '选项一',
- icon: 'app',
- },
- {
- label: '选项二',
- icon: 'app',
- },
- {
- label: '选项三',
- icon: 'app',
- },
- {
- label: '选项四',
- icon: 'app',
- },
- ],
- });
- },
- handleSelected(e) {
- console.log(e.detail);
- },
- },
-});
diff --git a/pages/action-sheet/list/index.json b/pages/action-sheet/list/index.json
deleted file mode 100644
index be68511..0000000
--- a/pages/action-sheet/list/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-action-sheet": "tdesign-miniprogram/action-sheet/action-sheet"
- }
-}
diff --git a/pages/action-sheet/list/index.wxml b/pages/action-sheet/list/index.wxml
deleted file mode 100644
index fb32fcf..0000000
--- a/pages/action-sheet/list/index.wxml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-列表型
-
-带描述列表型
-
-带图标列表型
diff --git a/pages/action-sheet/status/index.js b/pages/action-sheet/status/index.js
deleted file mode 100644
index ff47373..0000000
--- a/pages/action-sheet/status/index.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import ActionSheet, { ActionSheetTheme } from 'tdesign-miniprogram/action-sheet/index';
-
-Component({
- methods: {
- handleAction() {
- ActionSheet.show({
- theme: ActionSheetTheme.List,
- selector: '#t-action-sheet',
- context: this,
- items: [
- {
- label: '默认选项',
- icon: 'app',
- },
- {
- label: '自定义选项',
- icon: 'app',
- color: '#0052D9',
- },
- {
- label: '失效选项',
- disabled: true,
- icon: 'app',
- },
- {
- label: '警告选项',
- color: '#e34d59',
- icon: 'app',
- },
- ],
- });
- },
- handleSelected(e) {
- console.log(e.detail);
- },
- },
-});
diff --git a/pages/action-sheet/status/index.json b/pages/action-sheet/status/index.json
deleted file mode 100644
index be68511..0000000
--- a/pages/action-sheet/status/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-action-sheet": "tdesign-miniprogram/action-sheet/action-sheet"
- }
-}
diff --git a/pages/action-sheet/status/index.wxml b/pages/action-sheet/status/index.wxml
deleted file mode 100644
index 482b0aa..0000000
--- a/pages/action-sheet/status/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-列表型选项状态
diff --git a/pages/avatar/action/index.js b/pages/avatar/action/index.js
deleted file mode 100644
index c098f17..0000000
--- a/pages/avatar/action/index.js
+++ /dev/null
@@ -1,18 +0,0 @@
-Component({
- data: {
- pics: [
- 'https://tdesign.gtimg.com/miniprogram/images/avatar1.png',
- 'https://tdesign.gtimg.com/miniprogram/images/avatar2.png',
- 'https://tdesign.gtimg.com/miniprogram/images/avatar3.png',
- 'https://tdesign.gtimg.com/miniprogram/images/avatar4.png',
- 'https://tdesign.gtimg.com/miniprogram/images/avatar5.png',
- 'https://tdesign.gtimg.com/miniprogram/images/avatar1.png',
- ],
- },
-
- methods: {
- onAddTap() {
- wx.showToast({ title: '您按下了添加', icon: 'none', duration: 1000 });
- },
- },
-});
diff --git a/pages/avatar/action/index.json b/pages/avatar/action/index.json
deleted file mode 100644
index 14db02f..0000000
--- a/pages/avatar/action/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-avatar": "tdesign-miniprogram/avatar/avatar",
- "t-avatar-group": "tdesign-miniprogram/avatar-group/avatar-group"
- }
-}
diff --git a/pages/avatar/action/index.wxml b/pages/avatar/action/index.wxml
deleted file mode 100644
index bd0b5fa..0000000
--- a/pages/avatar/action/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/avatar/action/index.wxss b/pages/avatar/action/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/avatar/avatar.d.ts b/pages/avatar/avatar.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/avatar/avatar.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/avatar/avatar.js b/pages/avatar/avatar.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/avatar/avatar.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/avatar/avatar.json b/pages/avatar/avatar.json
deleted file mode 100644
index 86d1878..0000000
--- a/pages/avatar/avatar.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "navigationBarTitleText": "Avatar",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "imageAvatar": "./image-avatar",
- "characterAvatar": "./character-avatar",
- "iconAvatar": "./icon-avatar",
- "badgeAvatar": "./badge-avatar",
- "size": "./size",
- "exhibition": "./exhibition",
- "action": "./action"
- }
-}
diff --git a/pages/avatar/avatar.wxml b/pages/avatar/avatar.wxml
deleted file mode 100644
index 01c3f1c..0000000
--- a/pages/avatar/avatar.wxml
+++ /dev/null
@@ -1,27 +0,0 @@
-
- Avatar 头像
- 用于告知用户,该区域的状态变化或者待处理任务的数量。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/avatar/avatar.wxss b/pages/avatar/avatar.wxss
deleted file mode 100644
index a1ffdec..0000000
--- a/pages/avatar/avatar.wxss
+++ /dev/null
@@ -1,12 +0,0 @@
-page {
- background: #fff;
-}
-.demo-avatar {
- margin: 0 32rpx;
-}
-.desc {
- margin: 10rpx 32rpx;
- color: #999;
- font-size: 26rpx;
- line-height: 36rpx;
-}
diff --git a/pages/avatar/badge-avatar/index.js b/pages/avatar/badge-avatar/index.js
deleted file mode 100644
index 7e6a975..0000000
--- a/pages/avatar/badge-avatar/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- image: 'https://tdesign.gtimg.com/miniprogram/images/avatar1.png',
- },
-});
diff --git a/pages/avatar/badge-avatar/index.json b/pages/avatar/badge-avatar/index.json
deleted file mode 100644
index bbacd2e..0000000
--- a/pages/avatar/badge-avatar/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-avatar": "tdesign-miniprogram/avatar/avatar"
- }
-}
diff --git a/pages/avatar/badge-avatar/index.wxml b/pages/avatar/badge-avatar/index.wxml
deleted file mode 100644
index e7cd52f..0000000
--- a/pages/avatar/badge-avatar/index.wxml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-A
-
diff --git a/pages/avatar/badge-avatar/index.wxss b/pages/avatar/badge-avatar/index.wxss
deleted file mode 100644
index 8f7d1c7..0000000
--- a/pages/avatar/badge-avatar/index.wxss
+++ /dev/null
@@ -1,9 +0,0 @@
-.avatar-example:not(:last-child) {
- margin-right: 64rpx;
-}
-
-.external-class-content {
- color: #fff;
- background-color: #0052d9;
- font-weight: 400;
-}
diff --git a/pages/avatar/character-avatar/index.js b/pages/avatar/character-avatar/index.js
deleted file mode 100644
index 7e6a975..0000000
--- a/pages/avatar/character-avatar/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- image: 'https://tdesign.gtimg.com/miniprogram/images/avatar1.png',
- },
-});
diff --git a/pages/avatar/character-avatar/index.json b/pages/avatar/character-avatar/index.json
deleted file mode 100644
index bbacd2e..0000000
--- a/pages/avatar/character-avatar/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-avatar": "tdesign-miniprogram/avatar/avatar"
- }
-}
diff --git a/pages/avatar/character-avatar/index.wxml b/pages/avatar/character-avatar/index.wxml
deleted file mode 100644
index d772a2a..0000000
--- a/pages/avatar/character-avatar/index.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
-A
-A
diff --git a/pages/avatar/character-avatar/index.wxss b/pages/avatar/character-avatar/index.wxss
deleted file mode 100644
index 8f7d1c7..0000000
--- a/pages/avatar/character-avatar/index.wxss
+++ /dev/null
@@ -1,9 +0,0 @@
-.avatar-example:not(:last-child) {
- margin-right: 64rpx;
-}
-
-.external-class-content {
- color: #fff;
- background-color: #0052d9;
- font-weight: 400;
-}
diff --git a/pages/avatar/exhibition/index.js b/pages/avatar/exhibition/index.js
deleted file mode 100644
index fea4625..0000000
--- a/pages/avatar/exhibition/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-Component({
- data: {
- pics: [
- 'https://tdesign.gtimg.com/miniprogram/images/avatar1.png',
- 'https://tdesign.gtimg.com/miniprogram/images/avatar2.png',
- 'https://tdesign.gtimg.com/miniprogram/images/avatar3.png',
- 'https://tdesign.gtimg.com/miniprogram/images/avatar4.png',
- 'https://tdesign.gtimg.com/miniprogram/images/avatar5.png',
- 'https://tdesign.gtimg.com/miniprogram/images/avatar1.png',
- ],
- },
-});
diff --git a/pages/avatar/exhibition/index.json b/pages/avatar/exhibition/index.json
deleted file mode 100644
index 14db02f..0000000
--- a/pages/avatar/exhibition/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-avatar": "tdesign-miniprogram/avatar/avatar",
- "t-avatar-group": "tdesign-miniprogram/avatar-group/avatar-group"
- }
-}
diff --git a/pages/avatar/exhibition/index.wxml b/pages/avatar/exhibition/index.wxml
deleted file mode 100644
index aae9678..0000000
--- a/pages/avatar/exhibition/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/avatar/exhibition/index.wxss b/pages/avatar/exhibition/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/avatar/icon-avatar/index.js b/pages/avatar/icon-avatar/index.js
deleted file mode 100644
index 7e6a975..0000000
--- a/pages/avatar/icon-avatar/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- image: 'https://tdesign.gtimg.com/miniprogram/images/avatar1.png',
- },
-});
diff --git a/pages/avatar/icon-avatar/index.json b/pages/avatar/icon-avatar/index.json
deleted file mode 100644
index bbacd2e..0000000
--- a/pages/avatar/icon-avatar/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-avatar": "tdesign-miniprogram/avatar/avatar"
- }
-}
diff --git a/pages/avatar/icon-avatar/index.wxml b/pages/avatar/icon-avatar/index.wxml
deleted file mode 100644
index cf71cdd..0000000
--- a/pages/avatar/icon-avatar/index.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/pages/avatar/icon-avatar/index.wxss b/pages/avatar/icon-avatar/index.wxss
deleted file mode 100644
index 9dedc8a..0000000
--- a/pages/avatar/icon-avatar/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.avatar-example:not(:last-child) {
- margin-right: 64rpx;
-}
diff --git a/pages/avatar/image-avatar/index.js b/pages/avatar/image-avatar/index.js
deleted file mode 100644
index 7e6a975..0000000
--- a/pages/avatar/image-avatar/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- image: 'https://tdesign.gtimg.com/miniprogram/images/avatar1.png',
- },
-});
diff --git a/pages/avatar/image-avatar/index.json b/pages/avatar/image-avatar/index.json
deleted file mode 100644
index bbacd2e..0000000
--- a/pages/avatar/image-avatar/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-avatar": "tdesign-miniprogram/avatar/avatar"
- }
-}
diff --git a/pages/avatar/image-avatar/index.wxml b/pages/avatar/image-avatar/index.wxml
deleted file mode 100644
index 4a6237f..0000000
--- a/pages/avatar/image-avatar/index.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/pages/avatar/image-avatar/index.wxss b/pages/avatar/image-avatar/index.wxss
deleted file mode 100644
index a65f65d..0000000
--- a/pages/avatar/image-avatar/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.avatar-example {
- margin-right: 64rpx;
-}
diff --git a/pages/avatar/size/index.js b/pages/avatar/size/index.js
deleted file mode 100644
index 7e6a975..0000000
--- a/pages/avatar/size/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- image: 'https://tdesign.gtimg.com/miniprogram/images/avatar1.png',
- },
-});
diff --git a/pages/avatar/size/index.json b/pages/avatar/size/index.json
deleted file mode 100644
index bbacd2e..0000000
--- a/pages/avatar/size/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-avatar": "tdesign-miniprogram/avatar/avatar"
- }
-}
diff --git a/pages/avatar/size/index.wxml b/pages/avatar/size/index.wxml
deleted file mode 100644
index 61e449f..0000000
--- a/pages/avatar/size/index.wxml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- A
-
-
-
-
-
- A
-
-
-
-
-
- A
-
-
diff --git a/pages/avatar/size/index.wxss b/pages/avatar/size/index.wxss
deleted file mode 100644
index 3a30eab..0000000
--- a/pages/avatar/size/index.wxss
+++ /dev/null
@@ -1,22 +0,0 @@
-.avatar-example {
- display: flex;
- margin-bottom: 32rpx;
-}
-
-.external-class-content {
- color: #fff;
- background-color: #0052d9;
- font-weight: 400;
-}
-
-.avatar-example--small:not(:last-child) {
- margin-right: 112rpx;
-}
-
-.avatar-example--medium:not(:last-child) {
- margin-right: 96rpx;
-}
-
-.avatar-example--large:not(:last-child) {
- margin-right: 64rpx;
-}
diff --git a/pages/back-top/back-top.d.ts b/pages/back-top/back-top.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/back-top/back-top.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/back-top/back-top.js b/pages/back-top/back-top.js
deleted file mode 100644
index 7479323..0000000
--- a/pages/back-top/back-top.js
+++ /dev/null
@@ -1,17 +0,0 @@
-Page({
- data: {
- type: 'round',
- showBackTop: false,
- rowCol: [{ size: '327rpx', borderRadius: '24rpx' }, 1, { width: '61%' }],
- },
- onPageScroll(e) {
- this.setData({ showBackTop: e.scrollTop > 100 });
- },
- onBtnClick(e) {
- const { source: type } = e.currentTarget.dataset;
- this.setData({
- type,
- });
- wx.pageScrollTo({ duration: 300, scrollTop: 1000 });
- },
-});
diff --git a/pages/back-top/back-top.json b/pages/back-top/back-top.json
deleted file mode 100644
index 8226096..0000000
--- a/pages/back-top/back-top.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "navigationBarTitleText": "BackTop",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-skeleton": "tdesign-miniprogram/skeleton/skeleton",
- "base": "./base",
- "half-round": "./half-round"
- }
-}
diff --git a/pages/back-top/back-top.wxml b/pages/back-top/back-top.wxml
deleted file mode 100644
index 34a21f1..0000000
--- a/pages/back-top/back-top.wxml
+++ /dev/null
@@ -1,30 +0,0 @@
-
- BackTop 返回顶部
- 用于当页面过长往下滑动时,帮助用户快速回到页面顶部。
-
-
-
- 圆形返回顶部
-
-
-
-
- 半圆形返回顶部
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/back-top/back-top.wxss b/pages/back-top/back-top.wxss
deleted file mode 100644
index a26d59b..0000000
--- a/pages/back-top/back-top.wxss
+++ /dev/null
@@ -1,12 +0,0 @@
-page {
- background: #fff;
-}
-page .skeleton-item {
- padding-bottom: 48rpx;
-}
-page .container-flex {
- display: flex;
- justify-content: space-between;
- margin-top: 48rpx;
- flex-wrap: wrap;
-}
diff --git a/pages/back-top/base/index.js b/pages/back-top/base/index.js
deleted file mode 100644
index 87173b1..0000000
--- a/pages/back-top/base/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-Component({
- data: {
- backTopTheme: 'round',
- backTopText: '顶部',
- },
- methods: {
- onToTop(e) {
- console.log('backToTop', e);
- },
- },
-});
diff --git a/pages/back-top/base/index.json b/pages/back-top/base/index.json
deleted file mode 100644
index 712dec7..0000000
--- a/pages/back-top/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-back-top": "tdesign-miniprogram/back-top/back-top"
- }
-}
diff --git a/pages/back-top/base/index.wxml b/pages/back-top/base/index.wxml
deleted file mode 100644
index d75a667..0000000
--- a/pages/back-top/base/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/back-top/base/index.wxss b/pages/back-top/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/back-top/half-round/index.js b/pages/back-top/half-round/index.js
deleted file mode 100644
index 8007e38..0000000
--- a/pages/back-top/half-round/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-Component({
- data: {
- backTopTheme: 'half-round-dark',
- backTopText: '返回顶部',
- },
- methods: {
- onToTop(e) {
- console.log('backToTop', e);
- },
- },
-});
diff --git a/pages/back-top/half-round/index.json b/pages/back-top/half-round/index.json
deleted file mode 100644
index 712dec7..0000000
--- a/pages/back-top/half-round/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-back-top": "tdesign-miniprogram/back-top/back-top"
- }
-}
diff --git a/pages/back-top/half-round/index.wxml b/pages/back-top/half-round/index.wxml
deleted file mode 100644
index d75a667..0000000
--- a/pages/back-top/half-round/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/back-top/half-round/index.wxss b/pages/back-top/half-round/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/badge/api.md b/pages/badge/api.md
deleted file mode 100644
index 859bc03..0000000
--- a/pages/badge/api.md
+++ /dev/null
@@ -1,14 +0,0 @@
-### Badge Props
-
-| 名称 | 类型 | 默认值 | 说明 | 必传 |
-| --------------- | ---------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | --- |
-| color | String | - | 颜色 | N |
-| content | String | - | 徽标内容,示例:`content='自定义内容'`。也可以使用默认插槽定义 | N |
-| count | String / Number / Slot | 0 | 徽标右上角内容。可以是数字,也可以是文字。如:'new'/3/99+。特殊:值为空表示使用插槽渲染。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N |
-| dot | Boolean | false | 是否为红点 | N |
-| externalClasses | Array | - | 组件类名,分别用于设置外层元素、默认内容、右上角内容等元素类名。`['t-class', 't-class-content', 't-class-count']` | N |
-| maxCount | Number | 99 | 封顶的数字值 | N |
-| offset | Array | [0,0] | 设置状态点的位置偏移,示例:[-10, 20] 或 ['10em', '8rem']。TS 类型:`Array` | N |
-| shape | String | circle | 形状。可选值:circle/square/round/ribbon | N |
-| size | String | medium | 尺寸。可选值:small/medium | N |
-| visible | Boolean | false | 当数值为 0 时,是否展示徽标 | N |
diff --git a/pages/badge/badge.d.ts b/pages/badge/badge.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/badge/badge.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/badge/badge.js b/pages/badge/badge.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/badge/badge.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/badge/badge.json b/pages/badge/badge.json
deleted file mode 100644
index df5378e..0000000
--- a/pages/badge/badge.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "navigationBarTitleText": "Badge",
- "usingComponents": {
- "base": "./base",
- "theme": "./theme",
- "size": "./size"
- }
-}
diff --git a/pages/badge/badge.wxml b/pages/badge/badge.wxml
deleted file mode 100644
index 05f93e6..0000000
--- a/pages/badge/badge.wxml
+++ /dev/null
@@ -1,11 +0,0 @@
-Badge 徽标
-用于告知用户,该区域的状态变化或者待处理任务的数量。
-
-
-
-
-
-
-
-
-
diff --git a/pages/badge/badge.wxss b/pages/badge/badge.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/badge/base/index.js b/pages/badge/base/index.js
deleted file mode 100644
index 2dc2188..0000000
--- a/pages/badge/base/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
-});
diff --git a/pages/badge/base/index.json b/pages/badge/base/index.json
deleted file mode 100644
index d500b2f..0000000
--- a/pages/badge/base/index.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-badge": "tdesign-miniprogram/badge/badge",
- "t-icon": "tdesign-miniprogram/icon/icon",
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/badge/base/index.wxml b/pages/badge/base/index.wxml
deleted file mode 100644
index 1ccd67f..0000000
--- a/pages/badge/base/index.wxml
+++ /dev/null
@@ -1,28 +0,0 @@
-红点徽标
-
-
-
-
-
-
- 按钮
-
-
-
-数字徽标
-
-
-
-
-
-
- 按钮
-
-
-
-自定义徽标
-
-
-
-
-
diff --git a/pages/badge/base/index.wxss b/pages/badge/base/index.wxss
deleted file mode 100644
index 8c09546..0000000
--- a/pages/badge/base/index.wxss
+++ /dev/null
@@ -1,11 +0,0 @@
-.wrapper {
- margin-right: 48px;
-}
-
-.demo-wrapper {
- display: flex;
- margin-left: 32rpx;
- margin-top: 28px;
- margin-bottom: 24px;
- align-items: center;
-}
diff --git a/pages/badge/size/index.js b/pages/badge/size/index.js
deleted file mode 100644
index 2dc2188..0000000
--- a/pages/badge/size/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
-});
diff --git a/pages/badge/size/index.json b/pages/badge/size/index.json
deleted file mode 100644
index b0e3808..0000000
--- a/pages/badge/size/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-badge": "tdesign-miniprogram/badge/badge",
- "t-avatar": "tdesign-miniprogram/avatar/avatar"
- }
-}
diff --git a/pages/badge/size/index.wxml b/pages/badge/size/index.wxml
deleted file mode 100644
index 753a182..0000000
--- a/pages/badge/size/index.wxml
+++ /dev/null
@@ -1,11 +0,0 @@
-Large
-
-
-
-
-
-Middle
-
-
-
-
diff --git a/pages/badge/size/index.wxss b/pages/badge/size/index.wxss
deleted file mode 100644
index ebaedc4..0000000
--- a/pages/badge/size/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.block {
- padding: 32rpx 32rpx 48rpx;
-}
\ No newline at end of file
diff --git a/pages/badge/theme/index.js b/pages/badge/theme/index.js
deleted file mode 100644
index 2dc2188..0000000
--- a/pages/badge/theme/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
-});
diff --git a/pages/badge/theme/index.json b/pages/badge/theme/index.json
deleted file mode 100644
index b4018fd..0000000
--- a/pages/badge/theme/index.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-badge": "tdesign-miniprogram/badge/badge",
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-icon": "tdesign-miniprogram/icon/icon"
- }
-}
diff --git a/pages/badge/theme/index.wxml b/pages/badge/theme/index.wxml
deleted file mode 100644
index c217c4e..0000000
--- a/pages/badge/theme/index.wxml
+++ /dev/null
@@ -1,25 +0,0 @@
-圆形徽标
-
-
-
-
-
-
-方形徽标
-
-
-
-
-
-
-气泡徽标
-
-
-
-
-
-
-角标
-
-
-
diff --git a/pages/badge/theme/index.wxss b/pages/badge/theme/index.wxss
deleted file mode 100644
index 93c21e7..0000000
--- a/pages/badge/theme/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.demo-wrapper {
- display: flex;
- margin-left: 32rpx;
- margin-top: 28px;
- margin-bottom: 24px;
- align-items: center;
-}
\ No newline at end of file
diff --git a/pages/button/base/index.js b/pages/button/base/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/button/base/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/button/base/index.json b/pages/button/base/index.json
deleted file mode 100644
index 75d1e24..0000000
--- a/pages/button/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/button/base/index.wxml b/pages/button/base/index.wxml
deleted file mode 100644
index 77a7d53..0000000
--- a/pages/button/base/index.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
- 填充按钮
- 填充按钮
- 填充按钮
-
-
-
- 描边按钮
- 文字按钮
-
diff --git a/pages/button/base/index.wxss b/pages/button/base/index.wxss
deleted file mode 100644
index c8c5064..0000000
--- a/pages/button/base/index.wxss
+++ /dev/null
@@ -1,10 +0,0 @@
-.button-example {
- margin: 0 32rpx;
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- gap: 32rpx;
-}
-
-.button-example:not(:last-child) {
- margin-bottom: 32rpx;
-}
diff --git a/pages/button/block-btn/index.js b/pages/button/block-btn/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/button/block-btn/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/button/block-btn/index.json b/pages/button/block-btn/index.json
deleted file mode 100644
index 75d1e24..0000000
--- a/pages/button/block-btn/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/button/block-btn/index.wxml b/pages/button/block-btn/index.wxml
deleted file mode 100644
index d6cbb19..0000000
--- a/pages/button/block-btn/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- 填充按钮
-
diff --git a/pages/button/block-btn/index.wxss b/pages/button/block-btn/index.wxss
deleted file mode 100644
index 3ec14ea..0000000
--- a/pages/button/block-btn/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.button-example {
- margin: 0 32rpx;
-}
diff --git a/pages/button/button.d.ts b/pages/button/button.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/button/button.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/button/button.js b/pages/button/button.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/button/button.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/button/button.json b/pages/button/button.json
deleted file mode 100644
index 1d0a053..0000000
--- a/pages/button/button.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "navigationBarTitleText": "Button",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "base": "./base",
- "size": "./size",
- "icon-btn": "./icon-btn",
- "group-btn": "./group-btn",
- "block-btn": "./block-btn",
- "ghost-btn": "./ghost-btn",
- "shape": "./shape",
- "theme": "./theme",
- "disabled": "./disabled"
- }
-}
diff --git a/pages/button/button.wxml b/pages/button/button.wxml
deleted file mode 100644
index 7d2a8f2..0000000
--- a/pages/button/button.wxml
+++ /dev/null
@@ -1,39 +0,0 @@
-
- Button 按钮
- 用于开启一个闭环的操作任务,如“删除”对象、“购买”商品等。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/button/button.wxss b/pages/button/button.wxss
deleted file mode 100644
index 23062cc..0000000
--- a/pages/button/button.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-page {
- background-color: #fff;
-}
diff --git a/pages/button/disabled/index.js b/pages/button/disabled/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/button/disabled/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/button/disabled/index.json b/pages/button/disabled/index.json
deleted file mode 100644
index 75d1e24..0000000
--- a/pages/button/disabled/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/button/disabled/index.wxml b/pages/button/disabled/index.wxml
deleted file mode 100644
index 373e423..0000000
--- a/pages/button/disabled/index.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
- 填充按钮
- 填充按钮
- 填充按钮
-
-
-
- 描边按钮
- 文字按钮
-
diff --git a/pages/button/disabled/index.wxss b/pages/button/disabled/index.wxss
deleted file mode 100644
index c8c5064..0000000
--- a/pages/button/disabled/index.wxss
+++ /dev/null
@@ -1,10 +0,0 @@
-.button-example {
- margin: 0 32rpx;
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- gap: 32rpx;
-}
-
-.button-example:not(:last-child) {
- margin-bottom: 32rpx;
-}
diff --git a/pages/button/ghost-btn/index.js b/pages/button/ghost-btn/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/button/ghost-btn/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/button/ghost-btn/index.json b/pages/button/ghost-btn/index.json
deleted file mode 100644
index 75d1e24..0000000
--- a/pages/button/ghost-btn/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/button/ghost-btn/index.wxml b/pages/button/ghost-btn/index.wxml
deleted file mode 100644
index 34b8f5d..0000000
--- a/pages/button/ghost-btn/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
- 幽灵按钮
- 幽灵按钮
- 幽灵按钮
-
diff --git a/pages/button/ghost-btn/index.wxss b/pages/button/ghost-btn/index.wxss
deleted file mode 100644
index 5e3df87..0000000
--- a/pages/button/ghost-btn/index.wxss
+++ /dev/null
@@ -1,6 +0,0 @@
-.button-example {
- display: flex;
- justify-content: space-between;
- background-color: #181818;
- padding: 32rpx;
-}
diff --git a/pages/button/group-btn/index.js b/pages/button/group-btn/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/button/group-btn/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/button/group-btn/index.json b/pages/button/group-btn/index.json
deleted file mode 100644
index 75d1e24..0000000
--- a/pages/button/group-btn/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/button/group-btn/index.wxml b/pages/button/group-btn/index.wxml
deleted file mode 100644
index a09311c..0000000
--- a/pages/button/group-btn/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
- 填充按钮
- 填充按钮
-
diff --git a/pages/button/group-btn/index.wxss b/pages/button/group-btn/index.wxss
deleted file mode 100644
index 1855838..0000000
--- a/pages/button/group-btn/index.wxss
+++ /dev/null
@@ -1,6 +0,0 @@
-.button-example {
- margin: 0 32rpx;
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: 32rpx;
-}
diff --git a/pages/button/icon-btn/index.js b/pages/button/icon-btn/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/button/icon-btn/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/button/icon-btn/index.json b/pages/button/icon-btn/index.json
deleted file mode 100644
index 75d1e24..0000000
--- a/pages/button/icon-btn/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/button/icon-btn/index.wxml b/pages/button/icon-btn/index.wxml
deleted file mode 100644
index cf1312f..0000000
--- a/pages/button/icon-btn/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- 加载中
-
-
diff --git a/pages/button/icon-btn/index.wxss b/pages/button/icon-btn/index.wxss
deleted file mode 100644
index f49de8f..0000000
--- a/pages/button/icon-btn/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.margin {
- margin-left: 32rpx;
-}
diff --git a/pages/button/shape/index.js b/pages/button/shape/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/button/shape/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/button/shape/index.json b/pages/button/shape/index.json
deleted file mode 100644
index 75d1e24..0000000
--- a/pages/button/shape/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/button/shape/index.wxml b/pages/button/shape/index.wxml
deleted file mode 100644
index c799ec0..0000000
--- a/pages/button/shape/index.wxml
+++ /dev/null
@@ -1,8 +0,0 @@
-
- 填充按钮
-
- 填充按钮
-
-
-
-填充按钮
diff --git a/pages/button/shape/index.wxss b/pages/button/shape/index.wxss
deleted file mode 100644
index 1b13ea7..0000000
--- a/pages/button/shape/index.wxss
+++ /dev/null
@@ -1,9 +0,0 @@
-.button-example {
- display: flex;
- justify-content: space-between;
- margin: 0 32rpx 32rpx;
-}
-
-.external-class {
- border-radius: 0 !important;
-}
diff --git a/pages/button/size/index.js b/pages/button/size/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/button/size/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/button/size/index.json b/pages/button/size/index.json
deleted file mode 100644
index 75d1e24..0000000
--- a/pages/button/size/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/button/size/index.wxml b/pages/button/size/index.wxml
deleted file mode 100644
index 7357df4..0000000
--- a/pages/button/size/index.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
- 按钮48
- 按钮40
- 按钮32
- 按钮28
-
diff --git a/pages/button/size/index.wxss b/pages/button/size/index.wxss
deleted file mode 100644
index b01bc1c..0000000
--- a/pages/button/size/index.wxss
+++ /dev/null
@@ -1,6 +0,0 @@
-.button-example {
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- margin: 0 32rpx;
-}
diff --git a/pages/button/theme/index.js b/pages/button/theme/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/button/theme/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/button/theme/index.json b/pages/button/theme/index.json
deleted file mode 100644
index 75d1e24..0000000
--- a/pages/button/theme/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/button/theme/index.wxml b/pages/button/theme/index.wxml
deleted file mode 100644
index 1317a39..0000000
--- a/pages/button/theme/index.wxml
+++ /dev/null
@@ -1,23 +0,0 @@
-
- 填充按钮
- 描边按钮
- 文字按钮
-
-
-
- 填充按钮
- 描边按钮
- 文字按钮
-
-
-
- 填充按钮
- 描边按钮
- 文字按钮
-
-
-
- 填充按钮
- 描边按钮
- 文字按钮
-
diff --git a/pages/button/theme/index.wxss b/pages/button/theme/index.wxss
deleted file mode 100644
index c8c5064..0000000
--- a/pages/button/theme/index.wxss
+++ /dev/null
@@ -1,10 +0,0 @@
-.button-example {
- margin: 0 32rpx;
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- gap: 32rpx;
-}
-
-.button-example:not(:last-child) {
- margin-bottom: 32rpx;
-}
diff --git a/pages/calendar/base/index.js b/pages/calendar/base/index.js
deleted file mode 100644
index 24ae36e..0000000
--- a/pages/calendar/base/index.js
+++ /dev/null
@@ -1,25 +0,0 @@
-Component({
- data: {
- visible: false,
- note: '',
- },
- methods: {
- handleCalendar() {
- this.setData({ visible: true });
- },
- handleConfirm(e) {
- const { value } = e.detail;
- const format = (val) => {
- const date = new Date(val);
- return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
- };
-
- this.setData({
- note: format(value),
- });
- },
- onClose({ detail }) {
- console.log(detail.trigger);
- },
- },
-});
diff --git a/pages/calendar/base/index.json b/pages/calendar/base/index.json
deleted file mode 100644
index 617193f..0000000
--- a/pages/calendar/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-calendar": "tdesign-miniprogram/calendar/calendar",
- "t-cell": "tdesign-miniprogram/cell/cell"
- }
-}
diff --git a/pages/calendar/base/index.wxml b/pages/calendar/base/index.wxml
deleted file mode 100644
index 08935f6..0000000
--- a/pages/calendar/base/index.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/pages/calendar/base/index.wxss b/pages/calendar/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/calendar/calendar.js b/pages/calendar/calendar.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/calendar/calendar.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/calendar/calendar.json b/pages/calendar/calendar.json
deleted file mode 100644
index e6991fc..0000000
--- a/pages/calendar/calendar.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "navigationBarTitleText": "Calendar",
- "usingComponents": {
- "base": "./base",
- "multiple": "./multiple",
- "range": "./range",
- "custom-text": "./custom-text",
- "custom-range": "./custom-range",
- "custom-button": "./custom-button",
- "without-popup": "./without-popup"
- }
-}
diff --git a/pages/calendar/calendar.wxml b/pages/calendar/calendar.wxml
deleted file mode 100644
index c4b7e48..0000000
--- a/pages/calendar/calendar.wxml
+++ /dev/null
@@ -1,17 +0,0 @@
-
- Calendar 日历
- 按照日历形式展示数据或日期的容器
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/calendar/calendar.wxss b/pages/calendar/calendar.wxss
deleted file mode 100644
index a9c8f7e..0000000
--- a/pages/calendar/calendar.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.is-holiday:not(.t-calendar__dates-item--selected) {
- color: #e34d59 !important;
-}
\ No newline at end of file
diff --git a/pages/calendar/custom-button/index.js b/pages/calendar/custom-button/index.js
deleted file mode 100644
index 736e24b..0000000
--- a/pages/calendar/custom-button/index.js
+++ /dev/null
@@ -1,23 +0,0 @@
-Component({
- data: {
- visible: false,
- min: new Date(2022, 0, 2).getTime(),
- note: '',
- },
- methods: {
- handleCalendar() {
- this.setData({ visible: true });
- },
- onChange(e) {
- const { value } = e.detail;
- const format = (val) => {
- const date = new Date(val);
- return `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日`;
- };
-
- this.setData({
- note: `${format(value)}`,
- });
- },
- },
-});
diff --git a/pages/calendar/custom-button/index.json b/pages/calendar/custom-button/index.json
deleted file mode 100644
index 617193f..0000000
--- a/pages/calendar/custom-button/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-calendar": "tdesign-miniprogram/calendar/calendar",
- "t-cell": "tdesign-miniprogram/cell/cell"
- }
-}
diff --git a/pages/calendar/custom-button/index.wxml b/pages/calendar/custom-button/index.wxml
deleted file mode 100644
index 3c960e1..0000000
--- a/pages/calendar/custom-button/index.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/pages/calendar/custom-button/index.wxss b/pages/calendar/custom-button/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/calendar/custom-range/index.js b/pages/calendar/custom-range/index.js
deleted file mode 100644
index 8353c10..0000000
--- a/pages/calendar/custom-range/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-Component({
- data: {
- visible: false,
- value: new Date(2022, 4, 15).getTime(),
- minDate: new Date(2022, 1, 1).getTime(),
- maxDate: new Date(2022, 10, 27).getTime(),
- },
- methods: {
- handleCalendar() {
- this.setData({ visible: true });
- },
- handleConfirm(e) {
- const { value } = e.detail;
-
- this.setData({ value });
- console.log(value);
- },
- },
-});
diff --git a/pages/calendar/custom-range/index.json b/pages/calendar/custom-range/index.json
deleted file mode 100644
index 844d5e7..0000000
--- a/pages/calendar/custom-range/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-calendar": "tdesign-miniprogram/calendar/calendar"
- }
-}
diff --git a/pages/calendar/custom-range/index.wxml b/pages/calendar/custom-range/index.wxml
deleted file mode 100644
index 84d190f..0000000
--- a/pages/calendar/custom-range/index.wxml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
diff --git a/pages/calendar/custom-range/index.wxss b/pages/calendar/custom-range/index.wxss
deleted file mode 100644
index a9c8f7e..0000000
--- a/pages/calendar/custom-range/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.is-holiday:not(.t-calendar__dates-item--selected) {
- color: #e34d59 !important;
-}
\ No newline at end of file
diff --git a/pages/calendar/custom-text/index.js b/pages/calendar/custom-text/index.js
deleted file mode 100644
index 02e7f1d..0000000
--- a/pages/calendar/custom-text/index.js
+++ /dev/null
@@ -1,43 +0,0 @@
-Component({
- data: {
- visible: false,
- value: new Date(2022, 1, 15).getTime(),
- minDate: new Date(2022, 1, 1).getTime(),
- maxDate: new Date(2022, 2, 15).getTime(),
- format(day) {
- const { date } = day;
- const year = date.getFullYear();
- const month = date.getMonth() + 1;
- const curDate = date.getDate();
-
- day.suffix = '¥60';
-
- if (year === 2022) {
- if (month === 2) {
- const map = {
- 1: '初一',
- 2: '初二',
- 3: '初三',
- 14: '情人节',
- 15: '元宵节',
- };
- if (curDate in map) {
- day.prefix = map[curDate];
- day.suffix = '¥100';
- day.className = 'is-holiday';
- }
- }
- }
-
- return day;
- },
- },
- methods: {
- handleCalendar() {
- this.setData({ visible: true });
- },
- handleConfirm(e) {
- console.log(e.detail.value);
- },
- },
-});
diff --git a/pages/calendar/custom-text/index.json b/pages/calendar/custom-text/index.json
deleted file mode 100644
index 844d5e7..0000000
--- a/pages/calendar/custom-text/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-calendar": "tdesign-miniprogram/calendar/calendar"
- }
-}
diff --git a/pages/calendar/custom-text/index.wxml b/pages/calendar/custom-text/index.wxml
deleted file mode 100644
index 36163d0..0000000
--- a/pages/calendar/custom-text/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
diff --git a/pages/calendar/custom-text/index.wxss b/pages/calendar/custom-text/index.wxss
deleted file mode 100644
index a9c8f7e..0000000
--- a/pages/calendar/custom-text/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.is-holiday:not(.t-calendar__dates-item--selected) {
- color: #e34d59 !important;
-}
\ No newline at end of file
diff --git a/pages/calendar/multiple/index.js b/pages/calendar/multiple/index.js
deleted file mode 100644
index cb09f47..0000000
--- a/pages/calendar/multiple/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-Component({
- data: {
- visible: false,
- },
- methods: {
- handleCalendar() {
- this.setData({ visible: true });
- },
- handleConfirm(e) {
- console.log(e.detail.value);
- },
- },
-});
diff --git a/pages/calendar/multiple/index.json b/pages/calendar/multiple/index.json
deleted file mode 100644
index 844d5e7..0000000
--- a/pages/calendar/multiple/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-calendar": "tdesign-miniprogram/calendar/calendar"
- }
-}
diff --git a/pages/calendar/multiple/index.wxml b/pages/calendar/multiple/index.wxml
deleted file mode 100644
index 13b9bc2..0000000
--- a/pages/calendar/multiple/index.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/pages/calendar/multiple/index.wxss b/pages/calendar/multiple/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/calendar/range/index.js b/pages/calendar/range/index.js
deleted file mode 100644
index cb09f47..0000000
--- a/pages/calendar/range/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-Component({
- data: {
- visible: false,
- },
- methods: {
- handleCalendar() {
- this.setData({ visible: true });
- },
- handleConfirm(e) {
- console.log(e.detail.value);
- },
- },
-});
diff --git a/pages/calendar/range/index.json b/pages/calendar/range/index.json
deleted file mode 100644
index 844d5e7..0000000
--- a/pages/calendar/range/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-calendar": "tdesign-miniprogram/calendar/calendar"
- }
-}
diff --git a/pages/calendar/range/index.wxml b/pages/calendar/range/index.wxml
deleted file mode 100644
index 07c4584..0000000
--- a/pages/calendar/range/index.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/pages/calendar/range/index.wxss b/pages/calendar/range/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/calendar/without-popup/index.js b/pages/calendar/without-popup/index.js
deleted file mode 100644
index e5ca91d..0000000
--- a/pages/calendar/without-popup/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
- methods: {
- handleSelect(e) {
- const { value, entireValue } = e.detail;
-
- console.log(value);
- console.log(entireValue);
- },
- },
-});
diff --git a/pages/calendar/without-popup/index.json b/pages/calendar/without-popup/index.json
deleted file mode 100644
index 5b1def7..0000000
--- a/pages/calendar/without-popup/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-calendar": "tdesign-miniprogram/calendar/calendar"
- }
-}
diff --git a/pages/calendar/without-popup/index.wxml b/pages/calendar/without-popup/index.wxml
deleted file mode 100644
index 22ff4fe..0000000
--- a/pages/calendar/without-popup/index.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
-不使用 Popup
-
diff --git a/pages/calendar/without-popup/index.wxss b/pages/calendar/without-popup/index.wxss
deleted file mode 100644
index b5fab94..0000000
--- a/pages/calendar/without-popup/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.demo-desc {
- margin-top: 32rpx;
- margin-bottom: 32rpx;
-}
\ No newline at end of file
diff --git a/pages/cascader/base/index.js b/pages/cascader/base/index.js
deleted file mode 100644
index e3f5eb0..0000000
--- a/pages/cascader/base/index.js
+++ /dev/null
@@ -1,80 +0,0 @@
-const data = {
- areaList: [
- {
- label: '北京市',
- value: '110000',
- children: [
- {
- value: '110100',
- label: '北京市',
- children: [
- { value: '110101', label: '东城区' },
- { value: '110102', label: '西城区' },
- { value: '110105', label: '朝阳区' },
- { value: '110106', label: '丰台区' },
- { value: '110107', label: '石景山区' },
- { value: '110108', label: '海淀区' },
- { value: '110109', label: '门头沟区' },
- { value: '110111', label: '房山区' },
- { value: '110112', label: '通州区' },
- { value: '110113', label: '顺义区' },
- { value: '110114', label: '昌平区' },
- { value: '110115', label: '大兴区' },
- { value: '110116', label: '怀柔区' },
- { value: '110117', label: '平谷区' },
- { value: '110118', label: '密云区' },
- { value: '110119', label: '延庆区' },
- ],
- },
- ],
- },
- {
- label: '天津市',
- value: '120000',
- children: [
- {
- value: '120100',
- label: '天津市',
- children: [
- { value: '120101', label: '和平区' },
- { value: '120102', label: '河东区' },
- { value: '120103', label: '河西区' },
- { value: '120104', label: '南开区' },
- { value: '120105', label: '河北区' },
- { value: '120106', label: '红桥区' },
- { value: '120110', label: '东丽区' },
- { value: '120111', label: '西青区' },
- { value: '120112', label: '津南区' },
- { value: '120113', label: '北辰区' },
- { value: '120114', label: '武清区' },
- { value: '120115', label: '宝坻区' },
- { value: '120116', label: '滨海新区' },
- { value: '120117', label: '宁河区' },
- { value: '120118', label: '静海区' },
- { value: '120119', label: '蓟州区' },
- ],
- },
- ],
- },
- ],
-};
-
-Component({
- data: {
- options: data.areaList,
- note: '请选择地址',
- visible: false,
- },
- methods: {
- showCascader() {
- this.setData({ visible: true });
- },
- onChange(e) {
- const { selectedOptions } = e.detail;
-
- this.setData({
- note: selectedOptions.map((item) => item.label).join('/'),
- });
- },
- },
-});
diff --git a/pages/cascader/base/index.json b/pages/cascader/base/index.json
deleted file mode 100644
index 64b0031..0000000
--- a/pages/cascader/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-cascader": "tdesign-miniprogram/cascader/cascader"
- }
-}
diff --git a/pages/cascader/base/index.wxml b/pages/cascader/base/index.wxml
deleted file mode 100644
index 3380c00..0000000
--- a/pages/cascader/base/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/cascader/base/index.wxss b/pages/cascader/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/cascader/cascader.js b/pages/cascader/cascader.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/cascader/cascader.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/cascader/cascader.json b/pages/cascader/cascader.json
deleted file mode 100644
index afe1437..0000000
--- a/pages/cascader/cascader.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "navigationBarTitleText": "Cascader",
- "usingComponents": {
- "base": "./base",
- "theme-tab": "./theme-tab",
- "keys": "./keys",
- "with-value": "./with-value",
- "with-title": "./with-title"
- }
-}
diff --git a/pages/cascader/cascader.wxml b/pages/cascader/cascader.wxml
deleted file mode 100644
index 962c9b5..0000000
--- a/pages/cascader/cascader.wxml
+++ /dev/null
@@ -1,23 +0,0 @@
-
- Cascader 级联选择器
- 用于多层级数据的逐级选择。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/cascader/cascader.wxss b/pages/cascader/cascader.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/cascader/keys/index.js b/pages/cascader/keys/index.js
deleted file mode 100644
index 75d9a31..0000000
--- a/pages/cascader/keys/index.js
+++ /dev/null
@@ -1,85 +0,0 @@
-const data = {
- areaList: [
- {
- name: '北京市',
- id: '110000',
- sub: [
- {
- id: '110100',
- name: '北京市',
- sub: [
- { id: '110101', name: '东城区' },
- { id: '110102', name: '西城区' },
- { id: '110105', name: '朝阳区' },
- { id: '110106', name: '丰台区' },
- { id: '110107', name: '石景山区' },
- { id: '110108', name: '海淀区' },
- { id: '110109', name: '门头沟区' },
- { id: '110111', name: '房山区' },
- { id: '110112', name: '通州区' },
- { id: '110113', name: '顺义区' },
- { id: '110114', name: '昌平区' },
- { id: '110115', name: '大兴区' },
- { id: '110116', name: '怀柔区' },
- { id: '110117', name: '平谷区' },
- { id: '110118', name: '密云区' },
- { id: '110119', name: '延庆区' },
- ],
- },
- ],
- },
- {
- name: '天津市',
- id: '120000',
- sub: [
- {
- id: '120100',
- name: '天津市',
- sub: [
- { id: '120101', name: '和平区' },
- { id: '120102', name: '河东区' },
- { id: '120103', name: '河西区' },
- { id: '120104', name: '南开区' },
- { id: '120105', name: '河北区' },
- { id: '120106', name: '红桥区' },
- { id: '120110', name: '东丽区' },
- { id: '120111', name: '西青区' },
- { id: '120112', name: '津南区' },
- { id: '120113', name: '北辰区' },
- { id: '120114', name: '武清区' },
- { id: '120115', name: '宝坻区' },
- { id: '120116', name: '滨海新区' },
- { id: '120117', name: '宁河区' },
- { id: '120118', name: '静海区' },
- { id: '120119', name: '蓟州区' },
- ],
- },
- ],
- },
- ],
-};
-
-Component({
- data: {
- options: data.areaList,
- note: '请选择地址',
- visible: false,
- keys: {
- label: 'name',
- value: 'id',
- children: 'sub',
- },
- },
- methods: {
- showCascader() {
- this.setData({ visible: true });
- },
- onChange(e) {
- const { selectedOptions } = e.detail;
-
- this.setData({
- note: selectedOptions.map((item) => item.name).join('/'),
- });
- },
- },
-});
diff --git a/pages/cascader/keys/index.json b/pages/cascader/keys/index.json
deleted file mode 100644
index 64b0031..0000000
--- a/pages/cascader/keys/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-cascader": "tdesign-miniprogram/cascader/cascader"
- }
-}
diff --git a/pages/cascader/keys/index.wxml b/pages/cascader/keys/index.wxml
deleted file mode 100644
index ff29880..0000000
--- a/pages/cascader/keys/index.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
diff --git a/pages/cascader/keys/index.wxss b/pages/cascader/keys/index.wxss
deleted file mode 100644
index cd5f344..0000000
--- a/pages/cascader/keys/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-page .demo {
- --td-cascader-active-color: green;
-}
\ No newline at end of file
diff --git a/pages/cascader/theme-tab/index.js b/pages/cascader/theme-tab/index.js
deleted file mode 100644
index e3f5eb0..0000000
--- a/pages/cascader/theme-tab/index.js
+++ /dev/null
@@ -1,80 +0,0 @@
-const data = {
- areaList: [
- {
- label: '北京市',
- value: '110000',
- children: [
- {
- value: '110100',
- label: '北京市',
- children: [
- { value: '110101', label: '东城区' },
- { value: '110102', label: '西城区' },
- { value: '110105', label: '朝阳区' },
- { value: '110106', label: '丰台区' },
- { value: '110107', label: '石景山区' },
- { value: '110108', label: '海淀区' },
- { value: '110109', label: '门头沟区' },
- { value: '110111', label: '房山区' },
- { value: '110112', label: '通州区' },
- { value: '110113', label: '顺义区' },
- { value: '110114', label: '昌平区' },
- { value: '110115', label: '大兴区' },
- { value: '110116', label: '怀柔区' },
- { value: '110117', label: '平谷区' },
- { value: '110118', label: '密云区' },
- { value: '110119', label: '延庆区' },
- ],
- },
- ],
- },
- {
- label: '天津市',
- value: '120000',
- children: [
- {
- value: '120100',
- label: '天津市',
- children: [
- { value: '120101', label: '和平区' },
- { value: '120102', label: '河东区' },
- { value: '120103', label: '河西区' },
- { value: '120104', label: '南开区' },
- { value: '120105', label: '河北区' },
- { value: '120106', label: '红桥区' },
- { value: '120110', label: '东丽区' },
- { value: '120111', label: '西青区' },
- { value: '120112', label: '津南区' },
- { value: '120113', label: '北辰区' },
- { value: '120114', label: '武清区' },
- { value: '120115', label: '宝坻区' },
- { value: '120116', label: '滨海新区' },
- { value: '120117', label: '宁河区' },
- { value: '120118', label: '静海区' },
- { value: '120119', label: '蓟州区' },
- ],
- },
- ],
- },
- ],
-};
-
-Component({
- data: {
- options: data.areaList,
- note: '请选择地址',
- visible: false,
- },
- methods: {
- showCascader() {
- this.setData({ visible: true });
- },
- onChange(e) {
- const { selectedOptions } = e.detail;
-
- this.setData({
- note: selectedOptions.map((item) => item.label).join('/'),
- });
- },
- },
-});
diff --git a/pages/cascader/theme-tab/index.json b/pages/cascader/theme-tab/index.json
deleted file mode 100644
index 64b0031..0000000
--- a/pages/cascader/theme-tab/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-cascader": "tdesign-miniprogram/cascader/cascader"
- }
-}
diff --git a/pages/cascader/theme-tab/index.wxml b/pages/cascader/theme-tab/index.wxml
deleted file mode 100644
index cbfa89b..0000000
--- a/pages/cascader/theme-tab/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/pages/cascader/theme-tab/index.wxss b/pages/cascader/theme-tab/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/cascader/with-title/index.js b/pages/cascader/with-title/index.js
deleted file mode 100644
index 8d29f0b..0000000
--- a/pages/cascader/with-title/index.js
+++ /dev/null
@@ -1,81 +0,0 @@
-const data = {
- areaList: [
- {
- label: '北京市',
- value: '110000',
- children: [
- {
- value: '110100',
- label: '北京市',
- children: [
- { value: '110101', label: '东城区' },
- { value: '110102', label: '西城区' },
- { value: '110105', label: '朝阳区' },
- { value: '110106', label: '丰台区' },
- { value: '110107', label: '石景山区' },
- { value: '110108', label: '海淀区' },
- { value: '110109', label: '门头沟区' },
- { value: '110111', label: '房山区' },
- { value: '110112', label: '通州区' },
- { value: '110113', label: '顺义区' },
- { value: '110114', label: '昌平区' },
- { value: '110115', label: '大兴区' },
- { value: '110116', label: '怀柔区' },
- { value: '110117', label: '平谷区' },
- { value: '110118', label: '密云区' },
- { value: '110119', label: '延庆区' },
- ],
- },
- ],
- },
- {
- label: '天津市',
- value: '120000',
- children: [
- {
- value: '120100',
- label: '天津市',
- children: [
- { value: '120101', label: '和平区' },
- { value: '120102', label: '河东区' },
- { value: '120103', label: '河西区' },
- { value: '120104', label: '南开区' },
- { value: '120105', label: '河北区' },
- { value: '120106', label: '红桥区' },
- { value: '120110', label: '东丽区' },
- { value: '120111', label: '西青区' },
- { value: '120112', label: '津南区' },
- { value: '120113', label: '北辰区' },
- { value: '120114', label: '武清区' },
- { value: '120115', label: '宝坻区' },
- { value: '120116', label: '滨海新区' },
- { value: '120117', label: '宁河区' },
- { value: '120118', label: '静海区' },
- { value: '120119', label: '蓟州区' },
- ],
- },
- ],
- },
- ],
-};
-
-Component({
- data: {
- options: data.areaList,
- note: '请选择地址',
- visible: false,
- subTitles: ['请选择省份', '请选择城市', '请选择区/县'],
- },
- methods: {
- showCascader() {
- this.setData({ visible: true });
- },
- onChange(e) {
- const { selectedOptions } = e.detail;
-
- this.setData({
- note: selectedOptions.map((item) => item.label).join('/'),
- });
- },
- },
-});
diff --git a/pages/cascader/with-title/index.json b/pages/cascader/with-title/index.json
deleted file mode 100644
index 64b0031..0000000
--- a/pages/cascader/with-title/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-cascader": "tdesign-miniprogram/cascader/cascader"
- }
-}
diff --git a/pages/cascader/with-title/index.wxml b/pages/cascader/with-title/index.wxml
deleted file mode 100644
index fc785f5..0000000
--- a/pages/cascader/with-title/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/pages/cascader/with-title/index.wxss b/pages/cascader/with-title/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/cascader/with-value/index.js b/pages/cascader/with-value/index.js
deleted file mode 100644
index e3f5eb0..0000000
--- a/pages/cascader/with-value/index.js
+++ /dev/null
@@ -1,80 +0,0 @@
-const data = {
- areaList: [
- {
- label: '北京市',
- value: '110000',
- children: [
- {
- value: '110100',
- label: '北京市',
- children: [
- { value: '110101', label: '东城区' },
- { value: '110102', label: '西城区' },
- { value: '110105', label: '朝阳区' },
- { value: '110106', label: '丰台区' },
- { value: '110107', label: '石景山区' },
- { value: '110108', label: '海淀区' },
- { value: '110109', label: '门头沟区' },
- { value: '110111', label: '房山区' },
- { value: '110112', label: '通州区' },
- { value: '110113', label: '顺义区' },
- { value: '110114', label: '昌平区' },
- { value: '110115', label: '大兴区' },
- { value: '110116', label: '怀柔区' },
- { value: '110117', label: '平谷区' },
- { value: '110118', label: '密云区' },
- { value: '110119', label: '延庆区' },
- ],
- },
- ],
- },
- {
- label: '天津市',
- value: '120000',
- children: [
- {
- value: '120100',
- label: '天津市',
- children: [
- { value: '120101', label: '和平区' },
- { value: '120102', label: '河东区' },
- { value: '120103', label: '河西区' },
- { value: '120104', label: '南开区' },
- { value: '120105', label: '河北区' },
- { value: '120106', label: '红桥区' },
- { value: '120110', label: '东丽区' },
- { value: '120111', label: '西青区' },
- { value: '120112', label: '津南区' },
- { value: '120113', label: '北辰区' },
- { value: '120114', label: '武清区' },
- { value: '120115', label: '宝坻区' },
- { value: '120116', label: '滨海新区' },
- { value: '120117', label: '宁河区' },
- { value: '120118', label: '静海区' },
- { value: '120119', label: '蓟州区' },
- ],
- },
- ],
- },
- ],
-};
-
-Component({
- data: {
- options: data.areaList,
- note: '请选择地址',
- visible: false,
- },
- methods: {
- showCascader() {
- this.setData({ visible: true });
- },
- onChange(e) {
- const { selectedOptions } = e.detail;
-
- this.setData({
- note: selectedOptions.map((item) => item.label).join('/'),
- });
- },
- },
-});
diff --git a/pages/cascader/with-value/index.json b/pages/cascader/with-value/index.json
deleted file mode 100644
index 64b0031..0000000
--- a/pages/cascader/with-value/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-cascader": "tdesign-miniprogram/cascader/cascader"
- }
-}
diff --git a/pages/cascader/with-value/index.wxml b/pages/cascader/with-value/index.wxml
deleted file mode 100644
index 3e0102f..0000000
--- a/pages/cascader/with-value/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/pages/cascader/with-value/index.wxss b/pages/cascader/with-value/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/cell-group/api.md b/pages/cell-group/api.md
deleted file mode 100644
index d299e31..0000000
--- a/pages/cell-group/api.md
+++ /dev/null
@@ -1,7 +0,0 @@
-### CellGroup Props
-
-| 名称 | 类型 | 默认值 | 说明 | 必传 |
-| ---------------- | ------- | ------ | ----------------------- | ---- |
-| bordered | Boolean | - | 是否显示组边框 | N |
-| external-classes | Array | - | 组件类名。`['t-class']` | N |
-| title | String | - | 必需。单元格组标题 | Y |
diff --git a/pages/cell-group/cell-group.d.ts b/pages/cell-group/cell-group.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/cell-group/cell-group.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/cell-group/cell-group.js b/pages/cell-group/cell-group.js
deleted file mode 100644
index 8ec6995..0000000
--- a/pages/cell-group/cell-group.js
+++ /dev/null
@@ -1,3 +0,0 @@
-Page({
- data: {},
-});
diff --git a/pages/cell-group/cell-group.json b/pages/cell-group/cell-group.json
deleted file mode 100644
index 1cc0734..0000000
--- a/pages/cell-group/cell-group.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "navigationBarTitleText": "cell-group 组合单元格",
- "usingComponents": {}
-}
diff --git a/pages/cell-group/cell-group.wxml b/pages/cell-group/cell-group.wxml
deleted file mode 100644
index a4b6482..0000000
--- a/pages/cell-group/cell-group.wxml
+++ /dev/null
@@ -1,13 +0,0 @@
-
- Cell-group 组合单元格
- cell的组合单元格
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/cell-group/cell-group.wxss b/pages/cell-group/cell-group.wxss
deleted file mode 100644
index 155b2ca..0000000
--- a/pages/cell-group/cell-group.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-page .t-cell-group__title {
- line-height: 104rpx;
- font-size: 24rpx;
-}
diff --git a/pages/cell/base/index.js b/pages/cell/base/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/cell/base/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/cell/base/index.json b/pages/cell/base/index.json
deleted file mode 100644
index 323d4f8..0000000
--- a/pages/cell/base/index.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-badge": "tdesign-miniprogram/badge/badge",
- "t-switch": "tdesign-miniprogram/switch/switch",
- "t-icon": "tdesign-miniprogram/icon/icon"
- }
-}
diff --git a/pages/cell/base/index.wxml b/pages/cell/base/index.wxml
deleted file mode 100644
index bd0709b..0000000
--- a/pages/cell/base/index.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/cell/base/index.wxss b/pages/cell/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/cell/cell.d.ts b/pages/cell/cell.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/cell/cell.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/cell/cell.js b/pages/cell/cell.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/cell/cell.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/cell/cell.json b/pages/cell/cell.json
deleted file mode 100644
index 67ddec4..0000000
--- a/pages/cell/cell.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "navigationBarTitleText": "Cell",
- "usingComponents": {
- "base": "./base",
- "multiple": "./multiple",
- "theme": "./theme"
- }
-}
diff --git a/pages/cell/cell.wxml b/pages/cell/cell.wxml
deleted file mode 100644
index 5f5da01..0000000
--- a/pages/cell/cell.wxml
+++ /dev/null
@@ -1,13 +0,0 @@
-
- Cell 单元格
- 用于各个类别行的信息展示。
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/cell/cell.wxss b/pages/cell/cell.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/cell/multiple/index.js b/pages/cell/multiple/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/cell/multiple/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/cell/multiple/index.json b/pages/cell/multiple/index.json
deleted file mode 100644
index 97d6847..0000000
--- a/pages/cell/multiple/index.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-icon": "tdesign-miniprogram/icon/icon",
- "t-switch": "tdesign-miniprogram/switch/switch"
- }
-}
diff --git a/pages/cell/multiple/index.wxml b/pages/cell/multiple/index.wxml
deleted file mode 100644
index 4f13a89..0000000
--- a/pages/cell/multiple/index.wxml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/cell/multiple/index.wxss b/pages/cell/multiple/index.wxss
deleted file mode 100644
index aa92aaa..0000000
--- a/pages/cell/multiple/index.wxss
+++ /dev/null
@@ -1,6 +0,0 @@
-.avatar {
- width: 96rpx;
- height: 96rpx;
- border-radius: 50%;
- overflow: hidden;
-}
diff --git a/pages/cell/theme/index.js b/pages/cell/theme/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/cell/theme/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/cell/theme/index.json b/pages/cell/theme/index.json
deleted file mode 100644
index 6926edf..0000000
--- a/pages/cell/theme/index.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-icon": "tdesign-miniprogram/icon/icon"
- }
-}
diff --git a/pages/cell/theme/index.wxml b/pages/cell/theme/index.wxml
deleted file mode 100644
index 7456ce4..0000000
--- a/pages/cell/theme/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/cell/theme/index.wxss b/pages/cell/theme/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/checkbox/all/index.js b/pages/checkbox/all/index.js
deleted file mode 100644
index 868cf1b..0000000
--- a/pages/checkbox/all/index.js
+++ /dev/null
@@ -1,24 +0,0 @@
-Component({
- data: {
- options: [
- { label: '全选', checkAll: true },
- { label: '多选', value: 1 },
- { label: '多选', value: 2 },
- {
- label: '多选',
- value: 3,
- content: '单选描述信息单选描述信息单选描述信息单选描述信息单选描述信息单选描述信息单选描述信息',
- },
- ],
- checkAllValues: [1, 2, 3, ''],
- },
-
- methods: {
- onCheckAllChange(event) {
- console.log('checkbox', event.detail.value);
- this.setData({
- checkAllValues: event.detail,
- });
- },
- },
-});
diff --git a/pages/checkbox/all/index.json b/pages/checkbox/all/index.json
deleted file mode 100644
index f937612..0000000
--- a/pages/checkbox/all/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group"
- }
-}
diff --git a/pages/checkbox/all/index.wxml b/pages/checkbox/all/index.wxml
deleted file mode 100644
index 8f6767b..0000000
--- a/pages/checkbox/all/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/pages/checkbox/all/index.wxss b/pages/checkbox/all/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/checkbox/base/index.js b/pages/checkbox/base/index.js
deleted file mode 100644
index 9362543..0000000
--- a/pages/checkbox/base/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-Component({
- data: {
- demoCheckbox1: ['checkbox1', 'checkbox2'],
- },
-
- methods: {
- handleGroupChange(event) {
- console.log('group', event.detail.value);
- this.setData({
- demoCheckbox1: event.detail.value,
- });
- },
- },
-});
diff --git a/pages/checkbox/base/index.json b/pages/checkbox/base/index.json
deleted file mode 100644
index ca35eb6..0000000
--- a/pages/checkbox/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group",
- "t-checkbox": "tdesign-miniprogram/checkbox/checkbox"
- }
-}
diff --git a/pages/checkbox/base/index.wxml b/pages/checkbox/base/index.wxml
deleted file mode 100644
index 47aa464..0000000
--- a/pages/checkbox/base/index.wxml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
diff --git a/pages/checkbox/base/index.wxss b/pages/checkbox/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/checkbox/card/index.js b/pages/checkbox/card/index.js
deleted file mode 100644
index d56c2aa..0000000
--- a/pages/checkbox/card/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-Component({
- /**
- * 组件的初始数据
- */
- data: {
- checked: true,
- },
-
- /**
- * 组件的方法列表
- */
- methods: {
- changeChecked(e) {
- this.setData({
- checked: e.detail.checked,
- });
- },
- },
-});
diff --git a/pages/checkbox/card/index.json b/pages/checkbox/card/index.json
deleted file mode 100644
index ca35eb6..0000000
--- a/pages/checkbox/card/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group",
- "t-checkbox": "tdesign-miniprogram/checkbox/checkbox"
- }
-}
diff --git a/pages/checkbox/card/index.wxml b/pages/checkbox/card/index.wxml
deleted file mode 100644
index eaf962a..0000000
--- a/pages/checkbox/card/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/checkbox/card/index.wxss b/pages/checkbox/card/index.wxss
deleted file mode 100644
index cb0cbc9..0000000
--- a/pages/checkbox/card/index.wxss
+++ /dev/null
@@ -1,5 +0,0 @@
-.theme-card {
- border-radius: 24rpx;
- margin: 32rpx;
- overflow: hidden;
-}
\ No newline at end of file
diff --git a/pages/checkbox/checkbox.d.ts b/pages/checkbox/checkbox.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/checkbox/checkbox.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/checkbox/checkbox.js b/pages/checkbox/checkbox.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/checkbox/checkbox.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/checkbox/checkbox.json b/pages/checkbox/checkbox.json
deleted file mode 100644
index ddf7032..0000000
--- a/pages/checkbox/checkbox.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "navigationBarTitleText": "Checkbox",
- "usingComponents": {
- "base": "./base",
- "right": "./right",
- "all": "./all",
- "horizontal": "./horizontal",
- "status": "./status",
- "type": "./type",
- "special": "./special",
- "card": "./card"
- }
-}
diff --git a/pages/checkbox/checkbox.wxml b/pages/checkbox/checkbox.wxml
deleted file mode 100644
index 2e9aa0d..0000000
--- a/pages/checkbox/checkbox.wxml
+++ /dev/null
@@ -1,35 +0,0 @@
-
- Checkbox 多选框
- 用于预设的一组选项中执行多项选择,并呈现选择结果。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/checkbox/checkbox.wxss b/pages/checkbox/checkbox.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/checkbox/horizontal/index.js b/pages/checkbox/horizontal/index.js
deleted file mode 100644
index 8766b06..0000000
--- a/pages/checkbox/horizontal/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-Component({
- /**
- * 组件的初始数据
- */
- data: {
- demoCheckboxMax: ['checkbox1', 'checkbox2'],
- },
-
- /**
- * 组件的方法列表
- */
- methods: {
- onChange(event) {
- console.log('checkbox', event.detail.value);
- },
- },
-});
diff --git a/pages/checkbox/horizontal/index.json b/pages/checkbox/horizontal/index.json
deleted file mode 100644
index ca35eb6..0000000
--- a/pages/checkbox/horizontal/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group",
- "t-checkbox": "tdesign-miniprogram/checkbox/checkbox"
- }
-}
diff --git a/pages/checkbox/horizontal/index.wxml b/pages/checkbox/horizontal/index.wxml
deleted file mode 100644
index d1d4ad0..0000000
--- a/pages/checkbox/horizontal/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/checkbox/horizontal/index.wxss b/pages/checkbox/horizontal/index.wxss
deleted file mode 100644
index 4896825..0000000
--- a/pages/checkbox/horizontal/index.wxss
+++ /dev/null
@@ -1,6 +0,0 @@
-.box {
- padding: 32rpx;
- display: flex;
- justify-content: space-between;
- background-color: #fff;
-}
\ No newline at end of file
diff --git a/pages/checkbox/right/index.js b/pages/checkbox/right/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/checkbox/right/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/checkbox/right/index.json b/pages/checkbox/right/index.json
deleted file mode 100644
index ca35eb6..0000000
--- a/pages/checkbox/right/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group",
- "t-checkbox": "tdesign-miniprogram/checkbox/checkbox"
- }
-}
diff --git a/pages/checkbox/right/index.wxml b/pages/checkbox/right/index.wxml
deleted file mode 100644
index f0ab0ef..0000000
--- a/pages/checkbox/right/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/checkbox/right/index.wxss b/pages/checkbox/right/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/checkbox/special/index.js b/pages/checkbox/special/index.js
deleted file mode 100644
index 2c980b7..0000000
--- a/pages/checkbox/special/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
- data: {
- value: [0, 1],
- value1: [0, 1],
- },
- methods: {
- onChange(e) {
- this.setData({ value: e.detail.value });
- },
- onChange1(e) {
- this.setData({ value1: e.detail.value });
- },
- },
-});
diff --git a/pages/checkbox/special/index.json b/pages/checkbox/special/index.json
deleted file mode 100644
index ca35eb6..0000000
--- a/pages/checkbox/special/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group",
- "t-checkbox": "tdesign-miniprogram/checkbox/checkbox"
- }
-}
diff --git a/pages/checkbox/special/index.wxml b/pages/checkbox/special/index.wxml
deleted file mode 100644
index 35aca97..0000000
--- a/pages/checkbox/special/index.wxml
+++ /dev/null
@@ -1,23 +0,0 @@
- module.exports.contain = function(arr, key) { return arr.indexOf(key) > -1 }
-
-
-
-
-
-
-
-
-横向卡片多选框
-
-
-
-
-
-
-
diff --git a/pages/checkbox/special/index.wxss b/pages/checkbox/special/index.wxss
deleted file mode 100644
index ba8425c..0000000
--- a/pages/checkbox/special/index.wxss
+++ /dev/null
@@ -1,57 +0,0 @@
-.card {
- position: relative;
- margin: 32rpx;
- border-radius: 12rpx;
- overflow: hidden;
- box-sizing: border-box;
- border: 3rpx solid #fff;
-}
-
-.card--active {
- border-color: #0052d9;
-}
-
-.card--active::after {
- content: '';
- display: block;
- position: absolute;
- left: 0;
- top: 0;
- width: 0;
- border: 14px solid #0052d9;
- border-bottom-color: transparent;
- border-right-color: transparent;
-}
-
-.card__icon {
- color: #fff;
- position: absolute;
- left: 1.5px;
- top: 1.5px;
- z-index: 1;
-}
-
-/* 横向布局 */
-.horizontal-box {
- width: calc(100% - 64rpx);
- display: flex;
- align-items: center;
- margin: 32rpx;
-}
-
-.horizontal-box .card {
- flex: 1;
- margin: 0;
-}
-
-.horizontal-box .card + .card {
- margin-left: 24rpx;
-}
-
-.horizontal-box .card::after {
- border-width: 12px;
-}
-
-.horizontal-box .card__icon {
- font-size: 12px;
-}
diff --git a/pages/checkbox/status/index.js b/pages/checkbox/status/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/checkbox/status/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/checkbox/status/index.json b/pages/checkbox/status/index.json
deleted file mode 100644
index ca35eb6..0000000
--- a/pages/checkbox/status/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group",
- "t-checkbox": "tdesign-miniprogram/checkbox/checkbox"
- }
-}
diff --git a/pages/checkbox/status/index.wxml b/pages/checkbox/status/index.wxml
deleted file mode 100644
index e89172a..0000000
--- a/pages/checkbox/status/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/pages/checkbox/status/index.wxss b/pages/checkbox/status/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/checkbox/type/index.js b/pages/checkbox/type/index.js
deleted file mode 100644
index 03c99cb..0000000
--- a/pages/checkbox/type/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-Component({
- /**
- * 组件的初始数据
- */
- data: {
- demoCheckbox2: ['checkbox2', 'checkbox3'],
- activeImage: 'https://tdesign.gtimg.com/miniprogram/checkbox-checked.png',
- inActiveImage: 'https://tdesign.gtimg.com/miniprogram/checkbox.png',
- },
-
- /**
- * 组件的方法列表
- */
- methods: {
- onChange(event) {
- console.log('checkbox', event.detail.value);
- },
- },
-});
diff --git a/pages/checkbox/type/index.json b/pages/checkbox/type/index.json
deleted file mode 100644
index ca35eb6..0000000
--- a/pages/checkbox/type/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group",
- "t-checkbox": "tdesign-miniprogram/checkbox/checkbox"
- }
-}
diff --git a/pages/checkbox/type/index.wxml b/pages/checkbox/type/index.wxml
deleted file mode 100644
index 78d86c9..0000000
--- a/pages/checkbox/type/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/pages/checkbox/type/index.wxss b/pages/checkbox/type/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/collapse/accordion/index.js b/pages/collapse/accordion/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/collapse/accordion/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/collapse/accordion/index.json b/pages/collapse/accordion/index.json
deleted file mode 100644
index 00865f9..0000000
--- a/pages/collapse/accordion/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-collapse": "tdesign-miniprogram/collapse/collapse",
- "t-collapse-panel": "tdesign-miniprogram/collapse-panel/collapse-panel"
- }
-}
diff --git a/pages/collapse/accordion/index.wxml b/pages/collapse/accordion/index.wxml
deleted file mode 100644
index bcccbc2..0000000
--- a/pages/collapse/accordion/index.wxml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- 此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容
-
-
- 此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容
-
-
- 此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容
-
-
- 此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容
-
-
diff --git a/pages/collapse/accordion/index.wxss b/pages/collapse/accordion/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/collapse/action/index.js b/pages/collapse/action/index.js
deleted file mode 100644
index 40ca5f0..0000000
--- a/pages/collapse/action/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-Component({
- data: {
- activeValues: [0],
- },
- methods: {
- handleChange(e) {
- this.setData({
- activeValues: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/collapse/action/index.json b/pages/collapse/action/index.json
deleted file mode 100644
index 00865f9..0000000
--- a/pages/collapse/action/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-collapse": "tdesign-miniprogram/collapse/collapse",
- "t-collapse-panel": "tdesign-miniprogram/collapse-panel/collapse-panel"
- }
-}
diff --git a/pages/collapse/action/index.wxml b/pages/collapse/action/index.wxml
deleted file mode 100644
index 35b2494..0000000
--- a/pages/collapse/action/index.wxml
+++ /dev/null
@@ -1,13 +0,0 @@
- module.exports.contains = function(arr, target) { return arr.indexOf(target) > -1; }
-
-
-
- 此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容
-
-
-
diff --git a/pages/collapse/action/index.wxss b/pages/collapse/action/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/collapse/base/index.js b/pages/collapse/base/index.js
deleted file mode 100644
index 40ca5f0..0000000
--- a/pages/collapse/base/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-Component({
- data: {
- activeValues: [0],
- },
- methods: {
- handleChange(e) {
- this.setData({
- activeValues: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/collapse/base/index.json b/pages/collapse/base/index.json
deleted file mode 100644
index 00865f9..0000000
--- a/pages/collapse/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-collapse": "tdesign-miniprogram/collapse/collapse",
- "t-collapse-panel": "tdesign-miniprogram/collapse-panel/collapse-panel"
- }
-}
diff --git a/pages/collapse/base/index.wxml b/pages/collapse/base/index.wxml
deleted file mode 100644
index 7bfb0c9..0000000
--- a/pages/collapse/base/index.wxml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
- 此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容
-
-
-
diff --git a/pages/collapse/base/index.wxss b/pages/collapse/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/collapse/collapse.d.ts b/pages/collapse/collapse.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/collapse/collapse.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/collapse/collapse.js b/pages/collapse/collapse.js
deleted file mode 100644
index d832733..0000000
--- a/pages/collapse/collapse.js
+++ /dev/null
@@ -1,10 +0,0 @@
-Page({
- data: {
- activeValues: [0],
- },
- handleChange(e) {
- this.setData({
- activeValues: e.detail.value,
- });
- },
-});
diff --git a/pages/collapse/collapse.json b/pages/collapse/collapse.json
deleted file mode 100644
index 3b2cb9b..0000000
--- a/pages/collapse/collapse.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "navigationBarTitleText": "Collapse",
- "usingComponents": {
- "base": "./base",
- "placement": "./placement",
- "action": "./action",
- "accordion": "./accordion",
- "theme": "./theme"
- }
-}
diff --git a/pages/collapse/collapse.wxml b/pages/collapse/collapse.wxml
deleted file mode 100644
index e52f596..0000000
--- a/pages/collapse/collapse.wxml
+++ /dev/null
@@ -1,24 +0,0 @@
-
- Collapse 折叠面板
- 用于对复杂区域进行分组和隐藏 常用于订单信息展示等
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/collapse/collapse.wxss b/pages/collapse/collapse.wxss
deleted file mode 100644
index 031c8a9..0000000
--- a/pages/collapse/collapse.wxss
+++ /dev/null
@@ -1,39 +0,0 @@
-.flex {
- display: flex;
- align-items: center;
- justify-content: space-between;
-}
-.collapse-content-item {
- margin: 16rpx 0;
-}
-.collapse-content-item-title {
- width: 176rpx;
- display: inline-flex;
- font-size: 28rpx;
- color: #666;
-}
-.collapse-content-item-val {
- display: inline-flex;
- justify-content: right;
- font-size: 28rpx;
- color: #333;
- align-items: center;
-}
-.copy-button {
- margin-left: 16rpx;
-}
-.copy-button .t-btn {
- width: 80rpx !important;
- height: 40rpx !important;
- display: inline-flex !important;
- align-items: center !important;
- border: 2rpx solid #ddd !important;
- font-size: 24rpx !important;
- color: #333 !important;
- border-radius: 24rpx !important;
- background-color: #fff !important;
- white-space: nowrap;
-}
-.collapse-demo {
- margin-top: 32rpx;
-}
diff --git a/pages/collapse/placement/index.js b/pages/collapse/placement/index.js
deleted file mode 100644
index 40ca5f0..0000000
--- a/pages/collapse/placement/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-Component({
- data: {
- activeValues: [0],
- },
- methods: {
- handleChange(e) {
- this.setData({
- activeValues: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/collapse/placement/index.json b/pages/collapse/placement/index.json
deleted file mode 100644
index 00865f9..0000000
--- a/pages/collapse/placement/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-collapse": "tdesign-miniprogram/collapse/collapse",
- "t-collapse-panel": "tdesign-miniprogram/collapse-panel/collapse-panel"
- }
-}
diff --git a/pages/collapse/placement/index.wxml b/pages/collapse/placement/index.wxml
deleted file mode 100644
index 45972d0..0000000
--- a/pages/collapse/placement/index.wxml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
- 此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容
-
-
-
diff --git a/pages/collapse/placement/index.wxss b/pages/collapse/placement/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/collapse/theme/index.js b/pages/collapse/theme/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/collapse/theme/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/collapse/theme/index.json b/pages/collapse/theme/index.json
deleted file mode 100644
index 00865f9..0000000
--- a/pages/collapse/theme/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-collapse": "tdesign-miniprogram/collapse/collapse",
- "t-collapse-panel": "tdesign-miniprogram/collapse-panel/collapse-panel"
- }
-}
diff --git a/pages/collapse/theme/index.wxml b/pages/collapse/theme/index.wxml
deleted file mode 100644
index 3079b20..0000000
--- a/pages/collapse/theme/index.wxml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- 此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容
-
-
- 此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容
-
-
- 此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容
-
-
- 此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容
-
-
diff --git a/pages/collapse/theme/index.wxss b/pages/collapse/theme/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/count-down/base/index.js b/pages/count-down/base/index.js
deleted file mode 100644
index d07c6c4..0000000
--- a/pages/count-down/base/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- time: 96 * 60 * 1000,
- },
-});
diff --git a/pages/count-down/base/index.json b/pages/count-down/base/index.json
deleted file mode 100644
index 662fded..0000000
--- a/pages/count-down/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-count-down": "tdesign-miniprogram/count-down/count-down"
- }
-}
diff --git a/pages/count-down/base/index.wxml b/pages/count-down/base/index.wxml
deleted file mode 100644
index dbfa409..0000000
--- a/pages/count-down/base/index.wxml
+++ /dev/null
@@ -1,47 +0,0 @@
-
- 时分秒
-
-
-
-
-
-
- 带毫秒
-
-
-
-
-
-
- 带方形底
-
-
-
-
-
-
- 带圆形底
-
-
-
-
-
-
- 带单位
-
-
-
-
-
-
- 无底色带单位
-
-
-
-
diff --git a/pages/count-down/base/index.wxss b/pages/count-down/base/index.wxss
deleted file mode 100644
index 61d6461..0000000
--- a/pages/count-down/base/index.wxss
+++ /dev/null
@@ -1,20 +0,0 @@
-.demo-count-down-desc {
- color: rgba(0, 0, 0, 0.6);
- font-size: 28rpx;
-}
-
-.demo-count-down-content {
- margin: 32rpx 0 48rpx;
-}
-
-.external-count {
- color: #e34d59;
- font-size: 36rpx;
- line-height: 48rpx;
- vertical-align: middle;
-}
-
-.external-split {
- font-size: 20rpx;
- margin: 0 10rpx;
-}
diff --git a/pages/count-down/count-down.d.ts b/pages/count-down/count-down.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/count-down/count-down.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/count-down/count-down.js b/pages/count-down/count-down.js
deleted file mode 100644
index cac9f4a..0000000
--- a/pages/count-down/count-down.js
+++ /dev/null
@@ -1,35 +0,0 @@
-Page({
- data: {
- time: 96 * 60 * 1000,
- time1: 46 * 60 * 1000,
- timeData: {},
- counting: false,
- },
- onChange(e) {
- this.setData({
- timeData: e.detail,
- });
- },
- start() {
- const countDown = this.selectComponent('.control-count-down');
- if (!countDown.counting) {
- countDown.start();
- this.setData({ counting: true });
- }
- else {
- countDown.pause();
- this.setData({ counting: false });
- }
- },
- reset() {
- const countDown = this.selectComponent('.control-count-down');
- countDown.reset();
- },
- finished() {
- wx.showToast({
- icon: 'none',
- title: '倒计时结束',
- });
- this.setData({ counting: false });
- },
-});
diff --git a/pages/count-down/count-down.json b/pages/count-down/count-down.json
deleted file mode 100644
index 16e774a..0000000
--- a/pages/count-down/count-down.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "navigationBarTitleText": "CountDown",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "base": "./base",
- "size": "./size"
- }
-}
diff --git a/pages/count-down/count-down.wxml b/pages/count-down/count-down.wxml
deleted file mode 100644
index 839f794..0000000
--- a/pages/count-down/count-down.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-CountDown 倒计时
-用于实时展示倒计时数值。
-
-
-
-
-
-
-
-
diff --git a/pages/count-down/count-down.wxss b/pages/count-down/count-down.wxss
deleted file mode 100644
index 06ed92e..0000000
--- a/pages/count-down/count-down.wxss
+++ /dev/null
@@ -1,41 +0,0 @@
-page {
- background: #fff;
-}
-.flex {
- display: flex;
- align-items: center;
-}
-.base-time {
- margin-top: 52rpx;
- justify-content: space-between;
-}
-.base-time-text {
- font-size: 20rpx;
- color: rgba(0, 0, 0, 0.4);
- width: 60%;
-}
-.base-time-cls {
- color: #333;
- font-weight: 700;
-}
-.spec-item {
- justify-content: space-between;
- margin-top: 32rpx;
-}
-.spec-item-right {
- width: 236rpx;
-}
-.spec-item-left {
- width: 352rpx;
-}
-.spec-item-after {
- font-size: 20rpx;
- color: rgba(0, 0, 0, 0.4);
- justify-content: center;
- display: inline-flex;
- align-items: center;
- width: 30%;
-}
-.last-padding {
- padding-bottom: 80rpx;
-}
diff --git a/pages/count-down/size/index.js b/pages/count-down/size/index.js
deleted file mode 100644
index d07c6c4..0000000
--- a/pages/count-down/size/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- time: 96 * 60 * 1000,
- },
-});
diff --git a/pages/count-down/size/index.json b/pages/count-down/size/index.json
deleted file mode 100644
index 662fded..0000000
--- a/pages/count-down/size/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-count-down": "tdesign-miniprogram/count-down/count-down"
- }
-}
diff --git a/pages/count-down/size/index.wxml b/pages/count-down/size/index.wxml
deleted file mode 100644
index 6fb7ee8..0000000
--- a/pages/count-down/size/index.wxml
+++ /dev/null
@@ -1,64 +0,0 @@
-
- 时分秒
-
-
-
-
-
-
-
-
-
-
-
-
- 带毫秒
-
-
-
-
-
-
-
-
-
-
-
-
- 带方形底
-
-
-
-
-
-
-
-
-
-
-
-
- 带圆形底
-
-
-
-
-
-
-
-
-
-
-
-
- 带单位
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/count-down/size/index.wxss b/pages/count-down/size/index.wxss
deleted file mode 100644
index e75a1b6..0000000
--- a/pages/count-down/size/index.wxss
+++ /dev/null
@@ -1,12 +0,0 @@
-.demo-count-down {
- padding-bottom: 32rpx;
-}
-
-.demo-count-down-desc {
- color: rgba(0, 0, 0, 0.6);
- font-size: 28rpx;
-}
-
-.demo-count-down-content {
- margin: 24rpx 0;
-}
diff --git a/pages/date-time-picker/date-all/index.js b/pages/date-time-picker/date-all/index.js
deleted file mode 100644
index 3b8b1d5..0000000
--- a/pages/date-time-picker/date-all/index.js
+++ /dev/null
@@ -1,38 +0,0 @@
-Page({
- data: {
- mode: '',
- datetimeVisible: false,
- datetime: new Date('2021-12-23').getTime(),
- datetimeText: '',
- },
- showPicker(e) {
- const { mode } = e?.currentTarget?.dataset;
- this.setData({
- mode,
- [`${mode}Visible`]: true,
- });
- },
- hidePicker() {
- const { mode } = this.data;
- this.setData({
- [`${mode}Visible`]: false,
- });
- },
- onConfirm(e) {
- const { value } = e?.detail;
- const { mode } = this.data;
-
- console.log('confim', value);
-
- this.setData({
- [mode]: value,
- [`${mode}Text`]: value,
- });
-
- this.hidePicker();
- },
-
- onColumnChange(e) {
- console.log('pick', e?.detail?.value);
- },
-});
diff --git a/pages/date-time-picker/date-all/index.json b/pages/date-time-picker/date-all/index.json
deleted file mode 100644
index 4e08dec..0000000
--- a/pages/date-time-picker/date-all/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker"
- }
-}
diff --git a/pages/date-time-picker/date-all/index.wxml b/pages/date-time-picker/date-all/index.wxml
deleted file mode 100644
index 434fe11..0000000
--- a/pages/date-time-picker/date-all/index.wxml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
diff --git a/pages/date-time-picker/date-all/index.wxss b/pages/date-time-picker/date-all/index.wxss
deleted file mode 100644
index b55ebb7..0000000
--- a/pages/date-time-picker/date-all/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.pannel-item {
- margin-bottom: 32rpx;
-}
diff --git a/pages/date-time-picker/date-time-picker.d.ts b/pages/date-time-picker/date-time-picker.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/date-time-picker/date-time-picker.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/date-time-picker/date-time-picker.js b/pages/date-time-picker/date-time-picker.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/date-time-picker/date-time-picker.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/date-time-picker/date-time-picker.json b/pages/date-time-picker/date-time-picker.json
deleted file mode 100644
index e9987b8..0000000
--- a/pages/date-time-picker/date-time-picker.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarTitleText": "DateTimePicker",
- "usingComponents": {
- "year-month-date": "./year-month-date",
- "year-month": "./year-month",
- "time": "./time",
- "date-all": "./date-all"
- }
-}
diff --git a/pages/date-time-picker/date-time-picker.wxml b/pages/date-time-picker/date-time-picker.wxml
deleted file mode 100644
index 9cce85c..0000000
--- a/pages/date-time-picker/date-time-picker.wxml
+++ /dev/null
@@ -1,15 +0,0 @@
-
- DateTimePicker 时间选择器
- 用于选择一个时间点或者一个时间段。
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/date-time-picker/date-time-picker.wxss b/pages/date-time-picker/date-time-picker.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/date-time-picker/time/index.js b/pages/date-time-picker/time/index.js
deleted file mode 100644
index 890e6f5..0000000
--- a/pages/date-time-picker/time/index.js
+++ /dev/null
@@ -1,42 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
- data: {
- mode: '',
- second: '10:00:00',
- minute: '23:59',
- },
- methods: {
- showPicker(e) {
- const { mode } = e.currentTarget.dataset;
- this.setData({
- mode,
- [`${mode}Visible`]: true,
- });
- },
- hidePicker() {
- const { mode } = this.data;
- this.setData({
- [`${mode}Visible`]: false,
- });
- },
- onConfirm(e) {
- const { value } = e.detail;
- const { mode } = this.data;
-
- console.log('confim', value);
-
- this.setData({
- [mode]: value,
- [`${mode}Text`]: value,
- });
-
- this.hidePicker();
- },
-
- onColumnChange(e) {
- console.log('pick', e.detail.value);
- },
- },
-});
diff --git a/pages/date-time-picker/time/index.json b/pages/date-time-picker/time/index.json
deleted file mode 100644
index 4e08dec..0000000
--- a/pages/date-time-picker/time/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker"
- }
-}
diff --git a/pages/date-time-picker/time/index.wxml b/pages/date-time-picker/time/index.wxml
deleted file mode 100644
index 2e2fa80..0000000
--- a/pages/date-time-picker/time/index.wxml
+++ /dev/null
@@ -1,45 +0,0 @@
-时分秒选择器
-
-
-时分选择器
-
-
-
-
-
-
-
diff --git a/pages/date-time-picker/time/index.wxss b/pages/date-time-picker/time/index.wxss
deleted file mode 100644
index 4536838..0000000
--- a/pages/date-time-picker/time/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.pannel-item {
- margin: 32rpx 0;
-}
diff --git a/pages/date-time-picker/year-month-date/index.js b/pages/date-time-picker/year-month-date/index.js
deleted file mode 100644
index 2396ead..0000000
--- a/pages/date-time-picker/year-month-date/index.js
+++ /dev/null
@@ -1,42 +0,0 @@
-Page({
- data: {
- mode: '',
- dateVisible: false,
- date: new Date('2021-12-23').getTime(), // 支持时间戳传入
- dateText: '',
-
- // 指定选择区间起始值
- start: '2000-01-01 00:00:00',
- end: '2030-09-09 12:12:12',
- },
- showPicker(e) {
- const { mode } = e.currentTarget.dataset;
- this.setData({
- mode,
- [`${mode}Visible`]: true,
- });
- },
- hidePicker() {
- const { mode } = this.data;
- this.setData({
- [`${mode}Visible`]: false,
- });
- },
- onConfirm(e) {
- const { value } = e.detail;
- const { mode } = this.data;
-
- console.log('confim', value);
-
- this.setData({
- [mode]: value,
- [`${mode}Text`]: value,
- });
-
- this.hidePicker();
- },
-
- onColumnChange(e) {
- console.log('pick', e.detail.value);
- },
-});
diff --git a/pages/date-time-picker/year-month-date/index.json b/pages/date-time-picker/year-month-date/index.json
deleted file mode 100644
index 4e08dec..0000000
--- a/pages/date-time-picker/year-month-date/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker"
- }
-}
diff --git a/pages/date-time-picker/year-month-date/index.wxml b/pages/date-time-picker/year-month-date/index.wxml
deleted file mode 100644
index 38efbeb..0000000
--- a/pages/date-time-picker/year-month-date/index.wxml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
diff --git a/pages/date-time-picker/year-month-date/index.wxss b/pages/date-time-picker/year-month-date/index.wxss
deleted file mode 100644
index 93662c1..0000000
--- a/pages/date-time-picker/year-month-date/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.pannel-item {
- margin-bottom: 32rpx;
-}
-
-.pannel-item::after {
- border: 0;
-}
diff --git a/pages/date-time-picker/year-month/index.js b/pages/date-time-picker/year-month/index.js
deleted file mode 100644
index 8609772..0000000
--- a/pages/date-time-picker/year-month/index.js
+++ /dev/null
@@ -1,42 +0,0 @@
-Page({
- data: {
- mode: '',
- monthVisible: false,
- month: '2021-09',
- monthText: '',
-
- // 指定选择区间起始值
- start: '2000-01-01 00:00:00',
- end: '2030-09-09 12:12:12',
- },
- showPicker(e) {
- const { mode } = e.currentTarget.dataset;
- this.setData({
- mode,
- [`${mode}Visible`]: true,
- });
- },
- hidePicker() {
- const { mode } = this.data;
- this.setData({
- [`${mode}Visible`]: false,
- });
- },
- onConfirm(e) {
- const { value } = e.detail;
- const { mode } = this.data;
-
- console.log('confim', value);
-
- this.setData({
- [mode]: value,
- [`${mode}Text`]: value,
- });
-
- this.hidePicker();
- },
-
- onColumnChange(e) {
- console.log('pick', e.detail.value);
- },
-});
diff --git a/pages/date-time-picker/year-month/index.json b/pages/date-time-picker/year-month/index.json
deleted file mode 100644
index 4e08dec..0000000
--- a/pages/date-time-picker/year-month/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker"
- }
-}
diff --git a/pages/date-time-picker/year-month/index.wxml b/pages/date-time-picker/year-month/index.wxml
deleted file mode 100644
index ec99fee..0000000
--- a/pages/date-time-picker/year-month/index.wxml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
diff --git a/pages/date-time-picker/year-month/index.wxss b/pages/date-time-picker/year-month/index.wxss
deleted file mode 100644
index b55ebb7..0000000
--- a/pages/date-time-picker/year-month/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.pannel-item {
- margin-bottom: 32rpx;
-}
diff --git a/pages/dialog/base/index.js b/pages/dialog/base/index.js
deleted file mode 100644
index b7cf02c..0000000
--- a/pages/dialog/base/index.js
+++ /dev/null
@@ -1,21 +0,0 @@
-Component({
- data: {
- confirmBtn: { content: '知道了', variant: 'base' },
- dialogKey: '',
- showText: false,
- showMultiText: false,
- showTextAndTitle: false,
- showMultiTextAndTitle: false,
- },
- methods: {
- showDialog(e) {
- const { key } = e.currentTarget.dataset;
- this.setData({ [key]: true, dialogKey: key });
- },
-
- closeDialog() {
- const { dialogKey } = this.data;
- this.setData({ [dialogKey]: false });
- },
- },
-});
diff --git a/pages/dialog/base/index.json b/pages/dialog/base/index.json
deleted file mode 100644
index 2a4435c..0000000
--- a/pages/dialog/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-dialog": "tdesign-miniprogram/dialog/dialog"
- }
-}
diff --git a/pages/dialog/base/index.wxml b/pages/dialog/base/index.wxml
deleted file mode 100644
index c2c197e..0000000
--- a/pages/dialog/base/index.wxml
+++ /dev/null
@@ -1,65 +0,0 @@
-
- 反馈类-基础
-
-
-
-
- 反馈类-无标题
-
-
-
-
- 反馈类-内容超长
-
-
-
- 这里是辅助内容文案,这里是辅助内容文案,这里是辅助内容文案,这里是辅助内容文案
- 这里是辅助内容文案,这里是辅助内容文案,这里是辅助内容文案,这里是辅助内容文案
- 这里是辅助内容文案,这里是辅助内容文案,这里是辅助内容文案,这里是辅助内容文案
- 这里是辅助内容文案,这里是辅助内容文案,这里是辅助内容文案,这里是辅助内容文案
- 这里是辅助内容文案,这里是辅助内容文案,这里是辅助内容文案,这里是辅助内容文案
- 这里是辅助内容文案,这里是辅助内容文案,这里是辅助内容文案,这里是辅助内容文案
-
-
-
diff --git a/pages/dialog/base/index.wxss b/pages/dialog/base/index.wxss
deleted file mode 100644
index 88ad6b8..0000000
--- a/pages/dialog/base/index.wxss
+++ /dev/null
@@ -1,14 +0,0 @@
-.wrapper {
- margin-bottom: 32rpx;
-}
-
-.long-content {
- height: 576rpx;
- margin-top: 16rpx;
- font-size: 32rpx;
- color: #888;
-}
-
-.long-content .content-container {
- white-space: pre-line;
-}
diff --git a/pages/dialog/button/index.js b/pages/dialog/button/index.js
deleted file mode 100644
index 1fd6413..0000000
--- a/pages/dialog/button/index.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import Dialog from 'tdesign-miniprogram/dialog/index';
-
-Component({
- methods: {
- showDialog() {
- const dialogConfig = {
- context: this,
- title: '弹窗标题',
- content: '告知当前状态、信息和解决方法等内容。',
- cancelBtn: '取消',
- confirmBtn: {
- openType: 'getPhoneNumber',
- content: '获取手机',
- bindgetphonenumber({ detail }) {
- console.log(detail);
- if (detail.errMsg.includes('fail')) {
- console.log('获取失败');
- return false; // 不关闭弹窗
- }
- return true; // 关闭弹窗
- },
- },
- };
-
- Dialog.confirm(dialogConfig)
- .then(() => {
- console.log('点击确定');
- })
- .catch(() => {
- console.log('点击取消');
- });
- },
- },
-});
diff --git a/pages/dialog/button/index.json b/pages/dialog/button/index.json
deleted file mode 100644
index 2a4435c..0000000
--- a/pages/dialog/button/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-dialog": "tdesign-miniprogram/dialog/dialog"
- }
-}
diff --git a/pages/dialog/button/index.wxml b/pages/dialog/button/index.wxml
deleted file mode 100644
index 9b74394..0000000
--- a/pages/dialog/button/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
- 开放能力按钮
-
-
diff --git a/pages/dialog/button/index.wxss b/pages/dialog/button/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/dialog/command/index.js b/pages/dialog/command/index.js
deleted file mode 100644
index 96c7698..0000000
--- a/pages/dialog/command/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import Dialog from 'tdesign-miniprogram/dialog/index';
-
-Component({
- methods: {
- showDialog() {
- const dialogConfig = {
- context: this,
- title: '弹窗标题',
- content: '告知当前状态、信息和解决方法等内容。',
- confirmBtn: '确定',
- cancelBtn: '取消',
- };
-
- Dialog.confirm(dialogConfig)
- .then(() => console.log('点击了确定'))
- .catch(() => console.log('点击了取消'))
- .finally(() => Dialog.close());
- },
- },
-});
diff --git a/pages/dialog/command/index.json b/pages/dialog/command/index.json
deleted file mode 100644
index 2a4435c..0000000
--- a/pages/dialog/command/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-dialog": "tdesign-miniprogram/dialog/dialog"
- }
-}
diff --git a/pages/dialog/command/index.wxml b/pages/dialog/command/index.wxml
deleted file mode 100644
index 825c363..0000000
--- a/pages/dialog/command/index.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
- 命令行操作
-
diff --git a/pages/dialog/command/index.wxss b/pages/dialog/command/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/dialog/confirm/index.js b/pages/dialog/confirm/index.js
deleted file mode 100644
index a5a37d9..0000000
--- a/pages/dialog/confirm/index.js
+++ /dev/null
@@ -1,26 +0,0 @@
-Component({
- data: {
- confirmBtn: { content: '确定', variant: 'base' },
- dialogKey: '',
- showConfirm: false,
- showWarnConfirm: false,
- showTooLongBtnContent: false,
- showMultiBtn: false,
- multiBtnList: [
- { content: '次要按钮', theme: 'light' },
- { content: '次要按钮', theme: 'light' },
- { content: '主要按钮', theme: 'primary' },
- ],
- },
- methods: {
- showDialog(e) {
- const { key } = e.currentTarget.dataset;
- this.setData({ [key]: true, dialogKey: key });
- },
-
- closeDialog() {
- const { dialogKey } = this.data;
- this.setData({ [dialogKey]: false });
- },
- },
-});
diff --git a/pages/dialog/confirm/index.json b/pages/dialog/confirm/index.json
deleted file mode 100644
index 2a4435c..0000000
--- a/pages/dialog/confirm/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-dialog": "tdesign-miniprogram/dialog/dialog"
- }
-}
diff --git a/pages/dialog/confirm/index.wxml b/pages/dialog/confirm/index.wxml
deleted file mode 100644
index 80fb1db..0000000
--- a/pages/dialog/confirm/index.wxml
+++ /dev/null
@@ -1,40 +0,0 @@
-
- 确认类-带标题
-
-
-
-
- 确认类-无标题
-
-
diff --git a/pages/dialog/confirm/index.wxss b/pages/dialog/confirm/index.wxss
deleted file mode 100644
index 0eba499..0000000
--- a/pages/dialog/confirm/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.wrapper {
- margin-bottom: 32rpx;
-}
diff --git a/pages/dialog/dialog.d.ts b/pages/dialog/dialog.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/dialog/dialog.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/dialog/dialog.js b/pages/dialog/dialog.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/dialog/dialog.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/dialog/dialog.json b/pages/dialog/dialog.json
deleted file mode 100644
index ccd21bf..0000000
--- a/pages/dialog/dialog.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "navigationBarTitleText": "Dialog",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "base": "./base",
- "confirm": "./confirm",
- "with-input": "./with-input",
- "with-image": "./with-image",
- "command": "./command",
- "status": "./status",
- "buttonDemo": "./button"
- }
-}
diff --git a/pages/dialog/dialog.wxml b/pages/dialog/dialog.wxml
deleted file mode 100644
index 2185bc8..0000000
--- a/pages/dialog/dialog.wxml
+++ /dev/null
@@ -1,31 +0,0 @@
-
- Dialog 对话框
- 用于显示重要提示或请求用户进行重要操作,一种打断当前操作的模态视图。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/dialog/dialog.wxss b/pages/dialog/dialog.wxss
deleted file mode 100644
index 23062cc..0000000
--- a/pages/dialog/dialog.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-page {
- background-color: #fff;
-}
diff --git a/pages/dialog/status/index.js b/pages/dialog/status/index.js
deleted file mode 100644
index bb54ffa..0000000
--- a/pages/dialog/status/index.js
+++ /dev/null
@@ -1,29 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
- data: {
- confirmBtn: { content: '确定', variant: 'base' },
- dialogKey: '',
- showConfirm: false,
- showWarnConfirm: false,
- showTooLongBtnContent: false,
- showMultiBtn: false,
- multiBtnList: [
- { content: '次要按钮', theme: 'light' },
- { content: '次要按钮', theme: 'light' },
- { content: '主要按钮', theme: 'primary' },
- ],
- },
- methods: {
- showDialog(e) {
- const { key } = e.currentTarget.dataset;
- this.setData({ [key]: true, dialogKey: key });
- },
-
- closeDialog() {
- const { dialogKey } = this.data;
- this.setData({ [dialogKey]: false });
- },
- },
-});
diff --git a/pages/dialog/status/index.json b/pages/dialog/status/index.json
deleted file mode 100644
index 2a4435c..0000000
--- a/pages/dialog/status/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-dialog": "tdesign-miniprogram/dialog/dialog"
- }
-}
diff --git a/pages/dialog/status/index.wxml b/pages/dialog/status/index.wxml
deleted file mode 100644
index 20b5861..0000000
--- a/pages/dialog/status/index.wxml
+++ /dev/null
@@ -1,109 +0,0 @@
-文字按钮
-
- 文字按钮
-
-
-
-水平基础按钮
-
- 水平基础按钮
-
-
-
-垂直基础按钮
-
- 垂直基础按钮
-
-
-
-多按钮
-
- 多按钮
-
-
-
-带关闭按钮
-
- 带关闭按钮
-
-
diff --git a/pages/dialog/status/index.wxss b/pages/dialog/status/index.wxss
deleted file mode 100644
index 43b2aef..0000000
--- a/pages/dialog/status/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.demo-desc {
- margin: 0 0 32rpx;
-}
-
-.wrapper {
- margin-bottom: 32rpx;
-}
diff --git a/pages/dialog/with-image/index.js b/pages/dialog/with-image/index.js
deleted file mode 100644
index 667c8ee..0000000
--- a/pages/dialog/with-image/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-Component({
- data: {
- dialogKey: '',
- },
- methods: {
- showDialog(e) {
- const { key } = e.currentTarget.dataset;
- this.setData({ [key]: true, dialogKey: key });
- },
-
- closeDialog() {
- const { dialogKey } = this.data;
- this.setData({ [dialogKey]: false });
- },
- },
-});
diff --git a/pages/dialog/with-image/index.json b/pages/dialog/with-image/index.json
deleted file mode 100644
index d91ef9f..0000000
--- a/pages/dialog/with-image/index.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-image": "tdesign-miniprogram/image/image",
- "t-dialog": "tdesign-miniprogram/dialog/dialog"
- }
-}
diff --git a/pages/dialog/with-image/index.wxml b/pages/dialog/with-image/index.wxml
deleted file mode 100644
index 13c5ff5..0000000
--- a/pages/dialog/with-image/index.wxml
+++ /dev/null
@@ -1,49 +0,0 @@
-
- 图片置顶
-
-
-
-
-
-
- 图片居中
-
-
-
-
diff --git a/pages/dialog/with-image/index.wxss b/pages/dialog/with-image/index.wxss
deleted file mode 100644
index 42d9fb9..0000000
--- a/pages/dialog/with-image/index.wxss
+++ /dev/null
@@ -1,13 +0,0 @@
-.wrapper {
- margin-bottom: 32rpx;
-}
-
-.dialog-image {
- width: 100%;
- height: 160px;
-}
-
-.image-host {
- display: block;
- margin-top: 48rpx;
-}
diff --git a/pages/dialog/with-input/index.js b/pages/dialog/with-input/index.js
deleted file mode 100644
index 40d8c0c..0000000
--- a/pages/dialog/with-input/index.js
+++ /dev/null
@@ -1,18 +0,0 @@
-Component({
- data: {
- dialogKey: '',
- showWithInput: false,
- showTextAndTitleWithInput: false,
- },
- methods: {
- showDialog(e) {
- const { key } = e.currentTarget.dataset;
- this.setData({ [key]: true, dialogKey: key });
- },
-
- closeDialog() {
- const { dialogKey } = this.data;
- this.setData({ [dialogKey]: false });
- },
- },
-});
diff --git a/pages/dialog/with-input/index.json b/pages/dialog/with-input/index.json
deleted file mode 100644
index 00c7aa0..0000000
--- a/pages/dialog/with-input/index.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-input": "tdesign-miniprogram/input/input",
- "t-dialog": "tdesign-miniprogram/dialog/dialog"
- }
-}
diff --git a/pages/dialog/with-input/index.wxml b/pages/dialog/with-input/index.wxml
deleted file mode 100644
index 633551b..0000000
--- a/pages/dialog/with-input/index.wxml
+++ /dev/null
@@ -1,57 +0,0 @@
-
- 输入类-无描述
-
-
-
-
-
-输入类-带描述
-
-
-
diff --git a/pages/dialog/with-input/index.wxss b/pages/dialog/with-input/index.wxss
deleted file mode 100644
index 28ec76a..0000000
--- a/pages/dialog/with-input/index.wxss
+++ /dev/null
@@ -1,26 +0,0 @@
-.wrapper {
- margin-bottom: 32rpx;
-}
-
-.placeholder {
- color: rgba(0, 0, 0, 0.26);
- line-height: 96rpx;
- height: 96rpx !important;
- display: flex;
- align-items: center;
-}
-
-.dialog-input {
- padding-top: 12px;
- padding-bottom: 12px;
- text-align: left;
- margin-top: 32rpx;
- border-radius: 8rpx;
- background-color: #f3f3f3;
- box-sizing: border-box;
-}
-
-.placeholder {
- color: rgba(0, 0, 0, 0.4);
- line-height: 96rpx;
-}
\ No newline at end of file
diff --git a/pages/divider/base/index.js b/pages/divider/base/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/divider/base/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/divider/base/index.json b/pages/divider/base/index.json
deleted file mode 100644
index caea895..0000000
--- a/pages/divider/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-divider": "tdesign-miniprogram/divider/divider"
- }
-}
diff --git a/pages/divider/base/index.wxml b/pages/divider/base/index.wxml
deleted file mode 100644
index 1d055f2..0000000
--- a/pages/divider/base/index.wxml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-带文字水平分割线
-
-
-
-
-
-垂直分割线
-
-
- 文字信息
-
- 文字信息
-
- 文字信息
-
diff --git a/pages/divider/base/index.wxss b/pages/divider/base/index.wxss
deleted file mode 100644
index da233ae..0000000
--- a/pages/divider/base/index.wxss
+++ /dev/null
@@ -1,14 +0,0 @@
-.divider-demo__title {
- font-size: 28rpx;
- color: rgba(0, 0, 0, 0.6);
- padding: 16rpx 32rpx;
- line-height: 40rpx;
-}
-
-.divider-wrapper {
- display: flex;
- align-items: center;
- font-size: 28rpx;
- color: rgba(0, 0, 0, 0.9);
- padding-left: 32rpx;
-}
\ No newline at end of file
diff --git a/pages/divider/divider.d.ts b/pages/divider/divider.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/divider/divider.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/divider/divider.js b/pages/divider/divider.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/divider/divider.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/divider/divider.json b/pages/divider/divider.json
deleted file mode 100644
index f0e6ab1..0000000
--- a/pages/divider/divider.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "navigationBarTitleText": "Divider",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "base": "./base",
- "theme": "./theme"
- }
-}
diff --git a/pages/divider/divider.wxml b/pages/divider/divider.wxml
deleted file mode 100644
index 948b9cb..0000000
--- a/pages/divider/divider.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
- Divider 分割线
- 用于分割、组织、细化有一定逻辑的组织元素内容和页面结构。
-
-
-
-
-
-
-
diff --git a/pages/divider/divider.wxss b/pages/divider/divider.wxss
deleted file mode 100644
index 23062cc..0000000
--- a/pages/divider/divider.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-page {
- background-color: #fff;
-}
diff --git a/pages/divider/theme/index.js b/pages/divider/theme/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/divider/theme/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/divider/theme/index.json b/pages/divider/theme/index.json
deleted file mode 100644
index caea895..0000000
--- a/pages/divider/theme/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-divider": "tdesign-miniprogram/divider/divider"
- }
-}
diff --git a/pages/divider/theme/index.wxml b/pages/divider/theme/index.wxml
deleted file mode 100644
index 367874b..0000000
--- a/pages/divider/theme/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/pages/divider/theme/index.wxss b/pages/divider/theme/index.wxss
deleted file mode 100644
index 10d83b7..0000000
--- a/pages/divider/theme/index.wxss
+++ /dev/null
@@ -1,10 +0,0 @@
-.divider-demo__title {
- font-size: 24rpx;
- color: rgba(0, 0, 0, 0.4);
- padding: 0 32rpx 16rpx;
- line-height: 40rpx;
-}
-
-.demo-5 {
- margin: 0 32rpx;
-}
diff --git a/pages/drawer/base/index.js b/pages/drawer/base/index.js
deleted file mode 100644
index d9fcf7f..0000000
--- a/pages/drawer/base/index.js
+++ /dev/null
@@ -1,52 +0,0 @@
-Component({
- data: {
- placement: 'left',
- sidebar: [],
- baseSidebar: [
- {
- title: '菜单一',
- },
- {
- title: '菜单二',
- },
- {
- title: '菜单三',
- },
- {
- title: '菜单四',
- },
- {
- title: '菜单五',
- },
- {
- title: '菜单六',
- },
- {
- title: '菜单七',
- },
- {
- title: '菜单八',
- },
- ],
- },
-
- /**
- * 组件的方法列表
- */
- methods: {
- openDrawerBase() {
- this.setData({
- visible: true,
- sidebar: this.data.baseSidebar,
- });
- },
-
- itemClick(e) {
- console.log(e.detail);
- },
-
- overlayClick(e) {
- console.log(e.detail);
- },
- },
-});
diff --git a/pages/drawer/base/index.json b/pages/drawer/base/index.json
deleted file mode 100644
index 57bb751..0000000
--- a/pages/drawer/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-drawer": "tdesign-miniprogram/drawer/drawer"
- }
-}
diff --git a/pages/drawer/base/index.wxml b/pages/drawer/base/index.wxml
deleted file mode 100644
index 96ca60e..0000000
--- a/pages/drawer/base/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-基础抽屉
-
-
diff --git a/pages/drawer/base/index.wxss b/pages/drawer/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/drawer/drawer.d.ts b/pages/drawer/drawer.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/drawer/drawer.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/drawer/drawer.js b/pages/drawer/drawer.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/drawer/drawer.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/drawer/drawer.json b/pages/drawer/drawer.json
deleted file mode 100644
index f070374..0000000
--- a/pages/drawer/drawer.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "navigationBarTitleText": "Drawer",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "base": "./base",
- "title": "./title",
- "icon-drawer": "./icon-drawer",
- "footer": "./footer"
- }
-}
diff --git a/pages/drawer/drawer.wxml b/pages/drawer/drawer.wxml
deleted file mode 100644
index f14dcee..0000000
--- a/pages/drawer/drawer.wxml
+++ /dev/null
@@ -1,16 +0,0 @@
-
- Drawer 抽屉
- 用作一组平行关系页面/内容的切换器,相较于Tab,同屏可展示更多的选项数量。
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/drawer/drawer.wxss b/pages/drawer/drawer.wxss
deleted file mode 100644
index 23062cc..0000000
--- a/pages/drawer/drawer.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-page {
- background-color: #fff;
-}
diff --git a/pages/drawer/footer/index.js b/pages/drawer/footer/index.js
deleted file mode 100644
index b9b2f47..0000000
--- a/pages/drawer/footer/index.js
+++ /dev/null
@@ -1,65 +0,0 @@
-Component({
- data: {
- visible: false,
- placement: 'left',
- sidebar: [],
- baseSidebar: [
- {
- title: '菜单一',
- },
- {
- title: '菜单二',
- },
- {
- title: '菜单三',
- },
- {
- title: '菜单四',
- },
- {
- title: '菜单五',
- },
- {
- title: '菜单六',
- },
- {
- title: '菜单七',
- },
- {
- title: '菜单八',
- },
- {
- title: '菜单四',
- },
- {
- title: '菜单五',
- },
- {
- title: '菜单六',
- },
- {
- title: '菜单七',
- },
- {
- title: '菜单八',
- },
- ],
- },
-
- methods: {
- openDrawerBase() {
- this.setData({
- visible: true,
- sidebar: this.data.baseSidebar,
- });
- },
-
- itemClick(e) {
- console.log(e.detail);
- },
-
- overlayClick(e) {
- console.log(e.detail);
- },
- },
-});
diff --git a/pages/drawer/footer/index.json b/pages/drawer/footer/index.json
deleted file mode 100644
index 57bb751..0000000
--- a/pages/drawer/footer/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-drawer": "tdesign-miniprogram/drawer/drawer"
- }
-}
diff --git a/pages/drawer/footer/index.wxml b/pages/drawer/footer/index.wxml
deleted file mode 100644
index cc444eb..0000000
--- a/pages/drawer/footer/index.wxml
+++ /dev/null
@@ -1,14 +0,0 @@
-带底部插槽
-
-
-
- 操作
-
-
diff --git a/pages/drawer/footer/index.wxss b/pages/drawer/footer/index.wxss
deleted file mode 100644
index 226804d..0000000
--- a/pages/drawer/footer/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.button-host {
- margin: 0 32rpx;
- margin-top: auto;
-}
diff --git a/pages/drawer/icon-drawer/index.js b/pages/drawer/icon-drawer/index.js
deleted file mode 100644
index c7763e5..0000000
--- a/pages/drawer/icon-drawer/index.js
+++ /dev/null
@@ -1,60 +0,0 @@
-Component({
- data: {
- placement: 'left',
- sidebar: [],
- iconSidebar: [
- {
- title: '菜单一',
- icon: 'app',
- },
- {
- title: '菜单二',
- icon: 'app',
- },
- {
- title: '菜单三',
- icon: 'app',
- },
- {
- title: '菜单四',
- icon: 'app',
- },
- {
- title: '菜单五',
- icon: 'app',
- },
- {
- title: '菜单六',
- icon: 'app',
- },
- {
- title: '菜单七',
- icon: 'app',
- },
- {
- title: '菜单八',
- icon: 'app',
- },
- ],
- },
-
- /**
- * 组件的方法列表
- */
- methods: {
- openDrawerIcon() {
- this.setData({
- visible: true,
- sidebar: this.data.iconSidebar,
- });
- },
-
- itemClick(e) {
- console.log(e.detail);
- },
-
- overlayClick(e) {
- console.log(e.detail);
- },
- },
-});
diff --git a/pages/drawer/icon-drawer/index.json b/pages/drawer/icon-drawer/index.json
deleted file mode 100644
index 57bb751..0000000
--- a/pages/drawer/icon-drawer/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-drawer": "tdesign-miniprogram/drawer/drawer"
- }
-}
diff --git a/pages/drawer/icon-drawer/index.wxml b/pages/drawer/icon-drawer/index.wxml
deleted file mode 100644
index 6598058..0000000
--- a/pages/drawer/icon-drawer/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-带图标抽屉
-
-
diff --git a/pages/drawer/icon-drawer/index.wxss b/pages/drawer/icon-drawer/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/drawer/title/index.js b/pages/drawer/title/index.js
deleted file mode 100644
index c478a4d..0000000
--- a/pages/drawer/title/index.js
+++ /dev/null
@@ -1,49 +0,0 @@
-Component({
- data: {
- placement: 'left',
- sidebar: [],
- baseSidebar: [
- {
- title: '菜单一',
- },
- {
- title: '菜单二',
- },
- {
- title: '菜单三',
- },
- {
- title: '菜单四',
- },
- {
- title: '菜单五',
- },
- {
- title: '菜单六',
- },
- {
- title: '菜单七',
- },
- {
- title: '菜单八',
- },
- ],
- },
-
- methods: {
- openDrawerBase() {
- this.setData({
- visible: true,
- sidebar: this.data.baseSidebar,
- });
- },
-
- itemClick(e) {
- console.log(e.detail);
- },
-
- overlayClick(e) {
- console.log(e.detail);
- },
- },
-});
diff --git a/pages/drawer/title/index.json b/pages/drawer/title/index.json
deleted file mode 100644
index 57bb751..0000000
--- a/pages/drawer/title/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-drawer": "tdesign-miniprogram/drawer/drawer"
- }
-}
diff --git a/pages/drawer/title/index.wxml b/pages/drawer/title/index.wxml
deleted file mode 100644
index 77262b9..0000000
--- a/pages/drawer/title/index.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-带标题抽屉
-
-
diff --git a/pages/drawer/title/index.wxss b/pages/drawer/title/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/dropdown-menu/dropdown-menu.d.ts b/pages/dropdown-menu/dropdown-menu.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/dropdown-menu/dropdown-menu.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/dropdown-menu/dropdown-menu.js b/pages/dropdown-menu/dropdown-menu.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/dropdown-menu/dropdown-menu.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/dropdown-menu/dropdown-menu.json b/pages/dropdown-menu/dropdown-menu.json
deleted file mode 100644
index 1138fd2..0000000
--- a/pages/dropdown-menu/dropdown-menu.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarTitleText": "Dropdown Menu 下拉菜单",
- "usingComponents": {
- "t-dropdown-menu": "tdesign-miniprogram/dropdown-menu/dropdown-menu",
- "t-dropdown-item": "tdesign-miniprogram/dropdown-item/dropdown-item",
- "single": "./single",
- "multi": "./multi"
- }
-}
diff --git a/pages/dropdown-menu/dropdown-menu.wxml b/pages/dropdown-menu/dropdown-menu.wxml
deleted file mode 100644
index c6ea058..0000000
--- a/pages/dropdown-menu/dropdown-menu.wxml
+++ /dev/null
@@ -1,22 +0,0 @@
-
- DropdownMenu 下拉菜单
- 菜单呈现数个并列的选项类目,用于整个页面的内容筛选,由菜单面板和菜单选项组成。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/dropdown-menu/dropdown-menu.wxss b/pages/dropdown-menu/dropdown-menu.wxss
deleted file mode 100644
index e2f3550..0000000
--- a/pages/dropdown-menu/dropdown-menu.wxss
+++ /dev/null
@@ -1,8 +0,0 @@
-.wrapper {
- width: 100%;
- height: 300px;
-}
-.buttons .t-button {
- display: flex;
- margin: 30rpx;
-}
diff --git a/pages/dropdown-menu/multi/index.js b/pages/dropdown-menu/multi/index.js
deleted file mode 100644
index a01ce64..0000000
--- a/pages/dropdown-menu/multi/index.js
+++ /dev/null
@@ -1,56 +0,0 @@
-const chineseNumber = '一二三四五六七八九十'.split('');
-
-const singleSelectOptions = new Array(8).fill(null).map((_, i) => ({
- label: `选项${chineseNumber[i]}`,
- value: `option_${i + 1}`,
- disabled: false,
-}));
-
-singleSelectOptions.push({
- label: '禁用选项',
- value: 'disabled',
- disabled: true,
-});
-
-const doubleColumnsOptions = [
- ...singleSelectOptions,
- {
- label: '禁用选项',
- value: 'disabled',
- disabled: true,
- },
-];
-
-const tripleColumnsOptions = [
- ...doubleColumnsOptions,
- {
- label: '禁用选项',
- value: 'disabled',
- disabled: true,
- },
-];
-
-tripleColumnsOptions.splice(8, 0, {
- label: `选项${chineseNumber[8]}`,
- value: `option_${9}`,
- disabled: false,
-});
-
-Component({
- data: {
- multipleSelect: {
- value: ['option_1'],
- options: singleSelectOptions,
- },
- doubleColumnsOptions,
- tripleColumnsOptions,
- },
-
- methods: {
- handleMultipleSelect(e) {
- this.setData({
- 'multipleSelect.value': e.detail.value,
- });
- },
- },
-});
diff --git a/pages/dropdown-menu/multi/index.json b/pages/dropdown-menu/multi/index.json
deleted file mode 100644
index ecc6c41..0000000
--- a/pages/dropdown-menu/multi/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-dropdown-menu": "tdesign-miniprogram/dropdown-menu/dropdown-menu",
- "t-dropdown-item": "tdesign-miniprogram/dropdown-item/dropdown-item"
- }
-}
diff --git a/pages/dropdown-menu/multi/index.wxml b/pages/dropdown-menu/multi/index.wxml
deleted file mode 100644
index 10774ec..0000000
--- a/pages/dropdown-menu/multi/index.wxml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
diff --git a/pages/dropdown-menu/multi/index.wxss b/pages/dropdown-menu/multi/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/dropdown-menu/single/index.js b/pages/dropdown-menu/single/index.js
deleted file mode 100644
index 0e28f67..0000000
--- a/pages/dropdown-menu/single/index.js
+++ /dev/null
@@ -1,41 +0,0 @@
-Component({
- data: {
- product: {
- value: 'all',
- options: [
- {
- value: 'all',
- label: '全部产品',
- },
- {
- value: 'new',
- label: '最新产品',
- },
- {
- value: 'hot',
- label: '最火产品',
- },
- ],
- },
- sorter: {
- value: 'default',
- options: [
- {
- value: 'default',
- label: '默认排序',
- },
- {
- value: 'price',
- label: '价格从高到低',
- },
- ],
- },
- },
- methods: {
- onChange(e) {
- this.setData({
- 'product.value': e.detail.value,
- });
- },
- },
-});
diff --git a/pages/dropdown-menu/single/index.json b/pages/dropdown-menu/single/index.json
deleted file mode 100644
index ecc6c41..0000000
--- a/pages/dropdown-menu/single/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-dropdown-menu": "tdesign-miniprogram/dropdown-menu/dropdown-menu",
- "t-dropdown-item": "tdesign-miniprogram/dropdown-item/dropdown-item"
- }
-}
diff --git a/pages/dropdown-menu/single/index.wxml b/pages/dropdown-menu/single/index.wxml
deleted file mode 100644
index 5a3ee8e..0000000
--- a/pages/dropdown-menu/single/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/pages/dropdown-menu/single/index.wxss b/pages/dropdown-menu/single/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/dropdown-menu/tree/index.js b/pages/dropdown-menu/tree/index.js
deleted file mode 100644
index dd0f8a7..0000000
--- a/pages/dropdown-menu/tree/index.js
+++ /dev/null
@@ -1,41 +0,0 @@
-const chineseNumber = '一二三四五六七八九十'.split('');
-
-const generateTree = function (deep = 0, count = 10, prefix) {
- const ans = [];
-
- for (let i = 0; i < count; i += 1) {
- const value = prefix ? `${prefix}-${i}` : `${i}`;
- const rect = {
- label: `选项${chineseNumber[i]}`,
- value,
- };
-
- if (deep > 0) {
- rect.options = generateTree(deep - 1, 10, value);
- }
- ans.push(rect);
- }
-
- return ans;
-};
-
-Component({
- data: {
- doubleColumnsTree: {
- options: generateTree(1),
- value: ['0', '0-0'],
- },
- tripleColumnsTree: {
- options: generateTree(2),
- value: ['0', '0-0', ['0-0-0', '0-0-1']],
- },
- },
-
- methods: {
- handleTreeSelect(e) {
- this.setData({
- 'doubleColumnsTree.value': e.detail.value,
- });
- },
- },
-});
diff --git a/pages/dropdown-menu/tree/index.json b/pages/dropdown-menu/tree/index.json
deleted file mode 100644
index ecc6c41..0000000
--- a/pages/dropdown-menu/tree/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-dropdown-menu": "tdesign-miniprogram/dropdown-menu/dropdown-menu",
- "t-dropdown-item": "tdesign-miniprogram/dropdown-item/dropdown-item"
- }
-}
diff --git a/pages/dropdown-menu/tree/index.wxml b/pages/dropdown-menu/tree/index.wxml
deleted file mode 100644
index 33b509a..0000000
--- a/pages/dropdown-menu/tree/index.wxml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
diff --git a/pages/dropdown-menu/tree/index.wxss b/pages/dropdown-menu/tree/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/empty/base/index.js b/pages/empty/base/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/empty/base/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/empty/base/index.json b/pages/empty/base/index.json
deleted file mode 100644
index f9cde94..0000000
--- a/pages/empty/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-empty": "tdesign-miniprogram/empty/empty"
- }
-}
diff --git a/pages/empty/base/index.wxml b/pages/empty/base/index.wxml
deleted file mode 100644
index 1b1bf5e..0000000
--- a/pages/empty/base/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/empty/base/index.wxss b/pages/empty/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/empty/buttonEmpty/index.js b/pages/empty/buttonEmpty/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/empty/buttonEmpty/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/empty/buttonEmpty/index.json b/pages/empty/buttonEmpty/index.json
deleted file mode 100644
index 257a755..0000000
--- a/pages/empty/buttonEmpty/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-empty": "tdesign-miniprogram/empty/empty",
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/empty/buttonEmpty/index.wxml b/pages/empty/buttonEmpty/index.wxml
deleted file mode 100644
index 5372808..0000000
--- a/pages/empty/buttonEmpty/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- 操作按钮
-
diff --git a/pages/empty/buttonEmpty/index.wxss b/pages/empty/buttonEmpty/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/empty/empty.d.ts b/pages/empty/empty.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/empty/empty.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/empty/empty.js b/pages/empty/empty.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/empty/empty.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/empty/empty.json b/pages/empty/empty.json
deleted file mode 100644
index a6f98ec..0000000
--- a/pages/empty/empty.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarTitleText": "Empty",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "base": "./base",
- "imageEmpty": "./imageEmpty",
- "buttonEmpty": "./buttonEmpty"
- }
-}
diff --git a/pages/empty/empty.wxml b/pages/empty/empty.wxml
deleted file mode 100644
index 5f8f546..0000000
--- a/pages/empty/empty.wxml
+++ /dev/null
@@ -1,13 +0,0 @@
-
- Empty 空状态
- 用于空状态时的占位提示。
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/empty/empty.wxss b/pages/empty/empty.wxss
deleted file mode 100644
index e81280c..0000000
--- a/pages/empty/empty.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-page {
- background: #fff;
-}
diff --git a/pages/empty/imageEmpty/index.js b/pages/empty/imageEmpty/index.js
deleted file mode 100644
index df1133c..0000000
--- a/pages/empty/imageEmpty/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- image: 'https://tdesign.gtimg.com/miniprogram/images/empty1.png',
- },
-});
diff --git a/pages/empty/imageEmpty/index.json b/pages/empty/imageEmpty/index.json
deleted file mode 100644
index f9cde94..0000000
--- a/pages/empty/imageEmpty/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-empty": "tdesign-miniprogram/empty/empty"
- }
-}
diff --git a/pages/empty/imageEmpty/index.wxml b/pages/empty/imageEmpty/index.wxml
deleted file mode 100644
index 69d8a16..0000000
--- a/pages/empty/imageEmpty/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/empty/imageEmpty/index.wxss b/pages/empty/imageEmpty/index.wxss
deleted file mode 100644
index 54e3ba2..0000000
--- a/pages/empty/imageEmpty/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.t-empty__image {
- width: 240rpx !important;
- height: 240rpx !important;
-}
diff --git a/pages/fab/advance/index.js b/pages/fab/advance/index.js
deleted file mode 100644
index eff4945..0000000
--- a/pages/fab/advance/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-Component({
- data: {
- fabButton: {
- icon: 'call',
- openType: 'getPhoneNumber',
- },
- },
- methods: {
- handleClick(e) {
- console.log(e);
- },
- },
-});
diff --git a/pages/fab/advance/index.json b/pages/fab/advance/index.json
deleted file mode 100644
index 76f1d49..0000000
--- a/pages/fab/advance/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-fab": "tdesign-miniprogram/fab/fab"
- }
-}
diff --git a/pages/fab/advance/index.wxml b/pages/fab/advance/index.wxml
deleted file mode 100644
index f529447..0000000
--- a/pages/fab/advance/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/fab/advance/index.wxss b/pages/fab/advance/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/fab/base/index.js b/pages/fab/base/index.js
deleted file mode 100644
index 3aa5b9f..0000000
--- a/pages/fab/base/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Component({
- methods: {
- handleClick(e) {
- console.log(e);
- },
- },
-});
diff --git a/pages/fab/base/index.json b/pages/fab/base/index.json
deleted file mode 100644
index 76f1d49..0000000
--- a/pages/fab/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-fab": "tdesign-miniprogram/fab/fab"
- }
-}
diff --git a/pages/fab/base/index.wxml b/pages/fab/base/index.wxml
deleted file mode 100644
index 93272d1..0000000
--- a/pages/fab/base/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/fab/base/index.wxss b/pages/fab/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/fab/fab.d.ts b/pages/fab/fab.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/fab/fab.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/fab/fab.js b/pages/fab/fab.js
deleted file mode 100644
index b51d1e4..0000000
--- a/pages/fab/fab.js
+++ /dev/null
@@ -1,10 +0,0 @@
-Page({
- data: {
- type: 'base',
- },
- handleChange(e) {
- this.setData({
- type: e.target.dataset.type,
- });
- },
-});
diff --git a/pages/fab/fab.json b/pages/fab/fab.json
deleted file mode 100644
index 78d58bb..0000000
--- a/pages/fab/fab.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarTitleText": "Fab",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "base": "./base",
- "advance": "./advance"
- }
-}
diff --git a/pages/fab/fab.wxml b/pages/fab/fab.wxml
deleted file mode 100644
index 2160f56..0000000
--- a/pages/fab/fab.wxml
+++ /dev/null
@@ -1,19 +0,0 @@
-Fab 悬浮按钮
-当功能使用图标即可表意清楚时,可使用纯图标悬浮按钮,例如:添加、发布
-
-
-
- 纯图标悬浮按钮
-
-
-
-
-
-
- 图标加文字悬浮按钮
-
-
-
-
-
-
diff --git a/pages/fab/fab.wxss b/pages/fab/fab.wxss
deleted file mode 100644
index caa92a4..0000000
--- a/pages/fab/fab.wxss
+++ /dev/null
@@ -1,6 +0,0 @@
-page {
- background-color: #fff;
-}
-.wrapper {
- padding: 0 32rpx;
-}
diff --git a/pages/footer/base/index.js b/pages/footer/base/index.js
deleted file mode 100644
index ff52d3c..0000000
--- a/pages/footer/base/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- text: 'Copyright © 2021-2031 TD.All Rights Reserved.',
- },
-});
diff --git a/pages/footer/base/index.json b/pages/footer/base/index.json
deleted file mode 100644
index 71bc577..0000000
--- a/pages/footer/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-footer": "tdesign-miniprogram/footer/footer"
- }
-}
diff --git a/pages/footer/base/index.wxml b/pages/footer/base/index.wxml
deleted file mode 100644
index 12f05dd..0000000
--- a/pages/footer/base/index.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/pages/footer/base/index.wxss b/pages/footer/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/footer/footer.d.ts b/pages/footer/footer.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/footer/footer.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/footer/footer.js b/pages/footer/footer.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/footer/footer.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/footer/footer.json b/pages/footer/footer.json
deleted file mode 100644
index ef99a61..0000000
--- a/pages/footer/footer.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarTitleText": "Footer",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "base": "./base",
- "link": "./link",
- "logo": "./logo"
- }
-}
diff --git a/pages/footer/footer.wxml b/pages/footer/footer.wxml
deleted file mode 100644
index 8607c08..0000000
--- a/pages/footer/footer.wxml
+++ /dev/null
@@ -1,11 +0,0 @@
-Footer 页脚
-用于基础列表展示,可附带文字、品牌logo、操作,常用商详、个人中心、设置等页面。
-
-
-
-
-
-
-
-
-
diff --git a/pages/footer/footer.wxss b/pages/footer/footer.wxss
deleted file mode 100644
index e81280c..0000000
--- a/pages/footer/footer.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-page {
- background: #fff;
-}
diff --git a/pages/footer/link/index.js b/pages/footer/link/index.js
deleted file mode 100644
index 97a768c..0000000
--- a/pages/footer/link/index.js
+++ /dev/null
@@ -1,26 +0,0 @@
-Component({
- data: {
- text: 'Copyright © 2021-2031 TD.All Rights Reserved.',
- links: [
- [
- {
- name: '底部链接',
- url: '/pages/index',
- openType: 'navigate',
- },
- ],
- [
- {
- name: '底部链接',
- url: '/pages/index',
- openType: 'navigate',
- },
- {
- name: '底部链接',
- url: '',
- openType: 'navigateBack',
- },
- ],
- ],
- },
-});
diff --git a/pages/footer/link/index.json b/pages/footer/link/index.json
deleted file mode 100644
index 71bc577..0000000
--- a/pages/footer/link/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-footer": "tdesign-miniprogram/footer/footer"
- }
-}
diff --git a/pages/footer/link/index.wxml b/pages/footer/link/index.wxml
deleted file mode 100644
index 1234755..0000000
--- a/pages/footer/link/index.wxml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
diff --git a/pages/footer/link/index.wxss b/pages/footer/link/index.wxss
deleted file mode 100644
index 819a54e..0000000
--- a/pages/footer/link/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.footer-example {
- padding: 8rpx 0;
-}
-
-.footer-example:not(:last-child) {
- margin-bottom: 32rpx;
-}
diff --git a/pages/footer/logo/index.js b/pages/footer/logo/index.js
deleted file mode 100644
index 2d40a5f..0000000
--- a/pages/footer/logo/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-Component({
- data: {
- logoList: [
- {
- icon: 'https://tdesign.gtimg.com/miniprogram/images/logo2.png',
- title: '品牌名称',
- },
- {
- url: 'https://tdesign.gtimg.com/miniprogram/images/logo1.png',
- },
- ],
- },
-});
diff --git a/pages/footer/logo/index.json b/pages/footer/logo/index.json
deleted file mode 100644
index 71bc577..0000000
--- a/pages/footer/logo/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-footer": "tdesign-miniprogram/footer/footer"
- }
-}
diff --git a/pages/footer/logo/index.wxml b/pages/footer/logo/index.wxml
deleted file mode 100644
index 421ab0c..0000000
--- a/pages/footer/logo/index.wxml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
diff --git a/pages/footer/logo/index.wxss b/pages/footer/logo/index.wxss
deleted file mode 100644
index 819a54e..0000000
--- a/pages/footer/logo/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.footer-example {
- padding: 8rpx 0;
-}
-
-.footer-example:not(:last-child) {
- margin-bottom: 32rpx;
-}
diff --git a/pages/form/index.json b/pages/form/index.json
new file mode 100644
index 0000000..3928faa
--- /dev/null
+++ b/pages/form/index.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/pages/form/index.scss b/pages/form/index.scss
new file mode 100644
index 0000000..d1e6580
--- /dev/null
+++ b/pages/form/index.scss
@@ -0,0 +1,13 @@
+/* pages/form/index.wxss */
+.form {
+ background-color: rgb(244, 244, 244);
+ height: 100vh;
+ display: flex;
+ flex-direction: column;
+
+ &-content {
+ padding: 20rpx 0 0 0;
+ flex-grow: 1;
+ overflow-y: auto;
+ }
+}
\ No newline at end of file
diff --git a/pages/form/index.ts b/pages/form/index.ts
new file mode 100644
index 0000000..11e2d41
--- /dev/null
+++ b/pages/form/index.ts
@@ -0,0 +1,163 @@
+import { GetCheckoutRoomNum, PostAnonLogin, GetAgoraConf, GetRoomRtcToken } from '../../api/form/index'
+import { getUUID } from '../../utils/utils'
+import { Message } from 'tdesign-miniprogram';
+import { onStop, startSignalr } from '../../utils/singlr';
+import { agora } from '../../utils/agora'
+Page({
+ data: {
+ meetingForm: {
+ roomNum: '27413452',
+ roomName: '杨杨',
+ },
+ isRecord: false,
+ isCamera: false,
+ },
+ onShow() {
+ onStop()
+ },
+ onLoad() {
+ wx.authorize({
+ scope: 'scope.record',
+ success: () => {
+ this.setData({
+ isRecord: true,
+ })
+ },
+ fail: () => {
+ this.setData({
+ isRecord: false,
+ })
+ }
+ });
+ wx.authorize({
+ scope: 'scope.camera',
+ success: () => {
+ this.setData({
+ isCamera: true,
+ })
+ },
+ fail: () => {
+ this.setData({
+ isCamera: false,
+ })
+ }
+ });
+ },
+ async getRoomRtcToken(roomNum: string, callBack: Function): Promise {
+ Promise.all([GetRoomRtcToken(roomNum), GetRoomRtcToken(roomNum + 'a'), GetAgoraConf()]).then(res => {
+ if (res[0].code === 200 && res[1].code === 200 && res[2].code === 200) {
+ callBack({
+ token: res[0].data,
+ tokenA: res[1].data,
+ appid: res[2].data
+ })
+ }
+ })
+ },
+ joinMeeting() {
+ const navigateToMeeting = async (deviceId: string): Promise => {
+ await PostAnonLogin({
+ deviceId,
+ nickName: this.data.meetingForm.roomName,
+ roomNum: this.data.meetingForm.roomNum,
+ }).then(res => {
+ if (res.code === 200) {
+ wx.setStorage({
+ key: "user",
+ data: res.data
+ })
+ startSignalr(() => {
+ this.getRoomRtcToken(this.data.meetingForm.roomNum, (option) => {
+ agora.setOption({
+ token: option.token,
+ tokenA: option.tokenA,
+ channelId: this.data.meetingForm.roomNum,
+ appId: option.appid,
+ uid: res.data.uid,
+ screenShareId: res.data.screenShareId,
+ })
+ wx.navigateTo({
+ url: `/pages/meeting/index?roomNum=${this.data.meetingForm.roomNum}`
+ })
+ })
+ })
+ }
+ })
+ }
+ if (!this.data.meetingForm.roomNum) {
+ Message.error({
+ context: this,
+ offset: [90, 32],
+ duration: 3000,
+ content: '请输入会议号!',
+ });
+ return
+ }
+ if (!this.data.meetingForm.roomName) {
+ Message.error({
+ context: this,
+ offset: [90, 32],
+ duration: 3000,
+ content: '请输入入会名称!',
+ });
+ return
+ }
+ GetCheckoutRoomNum(this.data.meetingForm.roomNum).then(res => {
+ if (res.code === 200) {
+ if (res.data) {
+ wx.getStorage({
+ key: "deviceId",
+ success(res: any) {
+ navigateToMeeting(res.data)
+ },
+ fail() {
+ const uuid = getUUID()
+ wx.setStorage({
+ key: "deviceId",
+ data: uuid
+ })
+ navigateToMeeting(uuid)
+ }
+ })
+ } else {
+ Message.error({
+ context: this,
+ offset: [90, 32],
+ duration: 3000,
+ content: '房间号不存在!',
+ });
+ }
+ }
+ })
+ },
+ setting() {
+ wx.openSetting({
+ success: (res) => {
+ this.setData({
+ isCamera: res.authSetting['scope.camera'],
+ isRecord: res.authSetting['scope.record'],
+ })
+ }
+ })
+ },
+ changeMeetingForm(e) {
+ switch (e.target.dataset.type) {
+ case 'roomNum':
+ this.setData({
+ meetingForm: {
+ roomNum: e.type === 'clear' ? '' : e.detail.value,
+ roomName: this.data.meetingForm.roomName,
+ }
+ })
+ break;
+ case 'roomName':
+ this.setData({
+ meetingForm: {
+ roomNum: this.data.meetingForm.roomNum,
+ roomName: e.type === 'clear' ? '' : e.detail.value,
+ }
+ })
+ break;
+ }
+ }
+})
\ No newline at end of file
diff --git a/pages/form/index.wxml b/pages/form/index.wxml
new file mode 100644
index 0000000..77430c7
--- /dev/null
+++ b/pages/form/index.wxml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+ 加入会议
+
+ 点击开启摄像头麦克风
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/grid/badge/index.js b/pages/grid/badge/index.js
deleted file mode 100644
index ca32b14..0000000
--- a/pages/grid/badge/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Component({
- data: {
- img1: 'https://tdesign.gtimg.com/miniprogram/images/example1.png',
- img2: 'https://tdesign.gtimg.com/miniprogram/images/example2.png',
- img3: 'https://tdesign.gtimg.com/miniprogram/images/example3.png',
- },
-});
diff --git a/pages/grid/badge/index.json b/pages/grid/badge/index.json
deleted file mode 100644
index 56ec2f9..0000000
--- a/pages/grid/badge/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-grid": "tdesign-miniprogram/grid/grid",
- "t-grid-item": "tdesign-miniprogram/grid-item/grid-item"
- }
-}
diff --git a/pages/grid/badge/index.wxml b/pages/grid/badge/index.wxml
deleted file mode 100644
index 8d77631..0000000
--- a/pages/grid/badge/index.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/pages/grid/badge/index.wxss b/pages/grid/badge/index.wxss
deleted file mode 100644
index ac9708c..0000000
--- a/pages/grid/badge/index.wxss
+++ /dev/null
@@ -1,43 +0,0 @@
-.external-class-content {
- padding: 32rpx 0 !important;
-}
-
-.text {
- font-size: 24rpx !important;
- line-height: 40rpx !important;
- padding-top: 20rpx !important;
-}
-.image {
- width: 64rpx !important;
- height: 64rpx !important;
-}
-.image-icon {
- width: 64rpx;
- height: 64rpx;
-}
-
-.badge-circle {
- display: flex;
- justify-content: center;
- background-color: #e34d59;
- border-radius: 15rpx;
- width: 36rpx;
- height: 32rpx;
- align-items: center;
- position: absolute;
- top: -15rpx;
- left: 46rpx;
-}
-
-.circle {
- width: 4rpx;
- height: 4rpx;
- border-radius: 2rpx;
- background-color: white;
- margin-left: 4rpx;
-}
-
-.badge-circle-container {
- margin-left: -4rpx;
- display: flex;
-}
diff --git a/pages/grid/base/index.js b/pages/grid/base/index.js
deleted file mode 100644
index ca32b14..0000000
--- a/pages/grid/base/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Component({
- data: {
- img1: 'https://tdesign.gtimg.com/miniprogram/images/example1.png',
- img2: 'https://tdesign.gtimg.com/miniprogram/images/example2.png',
- img3: 'https://tdesign.gtimg.com/miniprogram/images/example3.png',
- },
-});
diff --git a/pages/grid/base/index.json b/pages/grid/base/index.json
deleted file mode 100644
index 56ec2f9..0000000
--- a/pages/grid/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-grid": "tdesign-miniprogram/grid/grid",
- "t-grid-item": "tdesign-miniprogram/grid-item/grid-item"
- }
-}
diff --git a/pages/grid/base/index.wxml b/pages/grid/base/index.wxml
deleted file mode 100644
index 535a7bf..0000000
--- a/pages/grid/base/index.wxml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/grid/base/index.wxss b/pages/grid/base/index.wxss
deleted file mode 100644
index 1a87553..0000000
--- a/pages/grid/base/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.block {
- display: block;
- margin-bottom: 32rpx;
-}
\ No newline at end of file
diff --git a/pages/grid/border/index.js b/pages/grid/border/index.js
deleted file mode 100644
index 2735d0e..0000000
--- a/pages/grid/border/index.js
+++ /dev/null
@@ -1,10 +0,0 @@
-Component({
- data: {
- img1: 'https://tdesign.gtimg.com/miniprogram/images/example1.png',
- img2: 'https://tdesign.gtimg.com/miniprogram/images/example2.png',
- img3: 'https://tdesign.gtimg.com/miniprogram/images/example3.png',
- border: {
- color: '#f6f6f6',
- },
- },
-});
diff --git a/pages/grid/border/index.json b/pages/grid/border/index.json
deleted file mode 100644
index 56ec2f9..0000000
--- a/pages/grid/border/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-grid": "tdesign-miniprogram/grid/grid",
- "t-grid-item": "tdesign-miniprogram/grid-item/grid-item"
- }
-}
diff --git a/pages/grid/border/index.wxml b/pages/grid/border/index.wxml
deleted file mode 100644
index 853e0c9..0000000
--- a/pages/grid/border/index.wxml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/grid/border/index.wxss b/pages/grid/border/index.wxss
deleted file mode 100644
index 1a87553..0000000
--- a/pages/grid/border/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.block {
- display: block;
- margin-bottom: 32rpx;
-}
\ No newline at end of file
diff --git a/pages/grid/card/index.js b/pages/grid/card/index.js
deleted file mode 100644
index ca32b14..0000000
--- a/pages/grid/card/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Component({
- data: {
- img1: 'https://tdesign.gtimg.com/miniprogram/images/example1.png',
- img2: 'https://tdesign.gtimg.com/miniprogram/images/example2.png',
- img3: 'https://tdesign.gtimg.com/miniprogram/images/example3.png',
- },
-});
diff --git a/pages/grid/card/index.json b/pages/grid/card/index.json
deleted file mode 100644
index 56ec2f9..0000000
--- a/pages/grid/card/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-grid": "tdesign-miniprogram/grid/grid",
- "t-grid-item": "tdesign-miniprogram/grid-item/grid-item"
- }
-}
diff --git a/pages/grid/card/index.wxml b/pages/grid/card/index.wxml
deleted file mode 100644
index 698e450..0000000
--- a/pages/grid/card/index.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/grid/card/index.wxss b/pages/grid/card/index.wxss
deleted file mode 100644
index 1a87553..0000000
--- a/pages/grid/card/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.block {
- display: block;
- margin-bottom: 32rpx;
-}
\ No newline at end of file
diff --git a/pages/grid/description/index.js b/pages/grid/description/index.js
deleted file mode 100644
index ca32b14..0000000
--- a/pages/grid/description/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Component({
- data: {
- img1: 'https://tdesign.gtimg.com/miniprogram/images/example1.png',
- img2: 'https://tdesign.gtimg.com/miniprogram/images/example2.png',
- img3: 'https://tdesign.gtimg.com/miniprogram/images/example3.png',
- },
-});
diff --git a/pages/grid/description/index.json b/pages/grid/description/index.json
deleted file mode 100644
index 56ec2f9..0000000
--- a/pages/grid/description/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-grid": "tdesign-miniprogram/grid/grid",
- "t-grid-item": "tdesign-miniprogram/grid-item/grid-item"
- }
-}
diff --git a/pages/grid/description/index.wxml b/pages/grid/description/index.wxml
deleted file mode 100644
index 14daae5..0000000
--- a/pages/grid/description/index.wxml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/grid/description/index.wxss b/pages/grid/description/index.wxss
deleted file mode 100644
index 1a87553..0000000
--- a/pages/grid/description/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.block {
- display: block;
- margin-bottom: 32rpx;
-}
\ No newline at end of file
diff --git a/pages/grid/grid.d.ts b/pages/grid/grid.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/grid/grid.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/grid/grid.js b/pages/grid/grid.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/grid/grid.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/grid/grid.json b/pages/grid/grid.json
deleted file mode 100644
index eb9be04..0000000
--- a/pages/grid/grid.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "navigationBarTitleText": "Grid",
- "usingComponents": {
- "base": "./base",
- "border": "./border",
- "description": "./description",
- "badge": "./badge",
- "scroll": "./scroll",
- "multiple": "./multiple",
- "card": "./card",
- "icon-grid": "./icon-grid"
- }
-}
diff --git a/pages/grid/grid.wxml b/pages/grid/grid.wxml
deleted file mode 100644
index 6155371..0000000
--- a/pages/grid/grid.wxml
+++ /dev/null
@@ -1,28 +0,0 @@
-
- Grid 宫格
- 用于功能入口布局,将页面或特定区域切分成若干等大的区块,形成若干功能入口。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/grid/grid.wxss b/pages/grid/grid.wxss
deleted file mode 100644
index 8f3aba2..0000000
--- a/pages/grid/grid.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-page .demo {
- min-height: 100vh;
- overflow: hidden;
-}
-page .demo-section__wrapper {
- margin: 32rpx 0;
-}
diff --git a/pages/grid/icon-grid/index.js b/pages/grid/icon-grid/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/grid/icon-grid/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/grid/icon-grid/index.json b/pages/grid/icon-grid/index.json
deleted file mode 100644
index 56ec2f9..0000000
--- a/pages/grid/icon-grid/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-grid": "tdesign-miniprogram/grid/grid",
- "t-grid-item": "tdesign-miniprogram/grid-item/grid-item"
- }
-}
diff --git a/pages/grid/icon-grid/index.wxml b/pages/grid/icon-grid/index.wxml
deleted file mode 100644
index 9fa82e5..0000000
--- a/pages/grid/icon-grid/index.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/pages/grid/icon-grid/index.wxss b/pages/grid/icon-grid/index.wxss
deleted file mode 100644
index 1a87553..0000000
--- a/pages/grid/icon-grid/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.block {
- display: block;
- margin-bottom: 32rpx;
-}
\ No newline at end of file
diff --git a/pages/grid/multiple/index.js b/pages/grid/multiple/index.js
deleted file mode 100644
index ca32b14..0000000
--- a/pages/grid/multiple/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Component({
- data: {
- img1: 'https://tdesign.gtimg.com/miniprogram/images/example1.png',
- img2: 'https://tdesign.gtimg.com/miniprogram/images/example2.png',
- img3: 'https://tdesign.gtimg.com/miniprogram/images/example3.png',
- },
-});
diff --git a/pages/grid/multiple/index.json b/pages/grid/multiple/index.json
deleted file mode 100644
index 56ec2f9..0000000
--- a/pages/grid/multiple/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-grid": "tdesign-miniprogram/grid/grid",
- "t-grid-item": "tdesign-miniprogram/grid-item/grid-item"
- }
-}
diff --git a/pages/grid/multiple/index.wxml b/pages/grid/multiple/index.wxml
deleted file mode 100644
index 14ff281..0000000
--- a/pages/grid/multiple/index.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/grid/multiple/index.wxss b/pages/grid/multiple/index.wxss
deleted file mode 100644
index 1a87553..0000000
--- a/pages/grid/multiple/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.block {
- display: block;
- margin-bottom: 32rpx;
-}
\ No newline at end of file
diff --git a/pages/grid/scroll/index.js b/pages/grid/scroll/index.js
deleted file mode 100644
index fb7b05f..0000000
--- a/pages/grid/scroll/index.js
+++ /dev/null
@@ -1,30 +0,0 @@
-Component({
- data: {
- gridItemList: [
- {
- text: '标题文字',
- img: 'https://tdesign.gtimg.com/miniprogram/images/example1.png',
- },
- {
- text: '标题文字',
- img: 'https://tdesign.gtimg.com/miniprogram/images/example2.png',
- },
- {
- text: '标题文字',
- img: 'https://tdesign.gtimg.com/miniprogram/images/example3.png',
- },
- {
- text: '最多五个字',
- img: 'https://tdesign.gtimg.com/miniprogram/images/example1.png',
- },
- {
- text: '最多五个字',
- img: 'https://tdesign.gtimg.com/miniprogram/images/example2.png',
- },
- {
- text: '最多五个字',
- img: 'https://tdesign.gtimg.com/miniprogram/images/example3.png',
- },
- ],
- },
-});
diff --git a/pages/grid/scroll/index.json b/pages/grid/scroll/index.json
deleted file mode 100644
index 56ec2f9..0000000
--- a/pages/grid/scroll/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-grid": "tdesign-miniprogram/grid/grid",
- "t-grid-item": "tdesign-miniprogram/grid-item/grid-item"
- }
-}
diff --git a/pages/grid/scroll/index.wxml b/pages/grid/scroll/index.wxml
deleted file mode 100644
index 81edde8..0000000
--- a/pages/grid/scroll/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/grid/scroll/index.wxss b/pages/grid/scroll/index.wxss
deleted file mode 100644
index 1a87553..0000000
--- a/pages/grid/scroll/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.block {
- display: block;
- margin-bottom: 32rpx;
-}
\ No newline at end of file
diff --git a/pages/gulp-error/index.d.ts b/pages/gulp-error/index.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/gulp-error/index.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/gulp-error/index.js b/pages/gulp-error/index.js
deleted file mode 100644
index 08fa4d7..0000000
--- a/pages/gulp-error/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-Page({
- data: {
- gulpError: '',
- },
- onLoad({ gulpError }) {
- this.setData({ gulpError });
- },
-});
diff --git a/pages/gulp-error/index.json b/pages/gulp-error/index.json
deleted file mode 100644
index 6a202bc..0000000
--- a/pages/gulp-error/index.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "navigationBarTitleText": "gulp编译错误"
-}
diff --git a/pages/gulp-error/index.wxml b/pages/gulp-error/index.wxml
deleted file mode 100644
index 65a9a36..0000000
--- a/pages/gulp-error/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-gulp编译错误: {{gulpError}}
diff --git a/pages/gulp-error/index.wxss b/pages/gulp-error/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/home/data/base.d.ts b/pages/home/data/base.d.ts
deleted file mode 100644
index a9d79fa..0000000
--- a/pages/home/data/base.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-declare const base: {
- name: string;
- icon: string;
- childArr: {
- name: string;
- label: string;
- }[];
-};
-export default base;
diff --git a/pages/home/data/base.js b/pages/home/data/base.js
deleted file mode 100644
index 94c70b1..0000000
--- a/pages/home/data/base.js
+++ /dev/null
@@ -1,27 +0,0 @@
-const base = {
- name: '基础',
- icon: 'app',
- childArr: [
- {
- name: 'Button',
- label: '按钮',
- },
- {
- name: 'Divider',
- label: '分割线',
- },
- {
- name: 'Fab',
- label: '悬浮按钮',
- },
- {
- name: 'Icon',
- label: '图标',
- },
- {
- name: 'Link',
- label: '链接',
- },
- ],
-};
-export default base;
diff --git a/pages/home/data/display.d.ts b/pages/home/data/display.d.ts
deleted file mode 100644
index 52743c5..0000000
--- a/pages/home/data/display.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-declare const display: {
- name: string;
- icon: string;
- childArr: {
- name: string;
- label: string;
- }[];
-};
-export default display;
diff --git a/pages/home/data/display.js b/pages/home/data/display.js
deleted file mode 100644
index fa4f7d5..0000000
--- a/pages/home/data/display.js
+++ /dev/null
@@ -1,71 +0,0 @@
-const display = {
- name: '数据展示',
- icon: 'image',
- childArr: [
- {
- name: 'Avatar',
- label: '头像',
- },
- {
- name: 'Badge',
- label: '徽标',
- },
- {
- name: 'Cell',
- label: '单元格',
- },
- {
- name: 'Collapse',
- label: '折叠面板',
- },
- {
- name: 'CountDown',
- label: '倒计时',
- },
- {
- name: 'Empty',
- label: '空状态',
- },
- {
- name: 'Footer',
- label: '页脚',
- },
- {
- name: 'Grid',
- label: '宫格',
- },
- {
- name: 'Image',
- label: '图片',
- },
- {
- name: 'ImageViewer',
- label: '图片预览',
- },
- {
- name: 'Progress',
- label: '进度条',
- },
- {
- name: 'Result',
- label: '结果',
- },
- {
- name: 'Skeleton',
- label: '骨架屏',
- },
- {
- name: 'Sticky',
- label: '吸顶',
- },
- {
- name: 'Swiper',
- label: '轮播图',
- },
- {
- name: 'Tag',
- label: '标签',
- },
- ],
-};
-export default display;
diff --git a/pages/home/data/form.d.ts b/pages/home/data/form.d.ts
deleted file mode 100644
index 5c2fd3d..0000000
--- a/pages/home/data/form.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-declare const form: {
- name: string;
- icon: string;
- childArr: {
- name: string;
- label: string;
- }[];
-};
-export default form;
diff --git a/pages/home/data/form.js b/pages/home/data/form.js
deleted file mode 100644
index 6d459e4..0000000
--- a/pages/home/data/form.js
+++ /dev/null
@@ -1,67 +0,0 @@
-const form = {
- name: '输入',
- icon: 'bulletpoint',
- childArr: [
- {
- name: 'Calendar',
- label: '日历',
- },
- {
- name: 'Cascader',
- label: '级联选择器',
- },
- {
- name: 'Checkbox',
- label: '多选框',
- },
- {
- name: 'DateTimePicker',
- label: '时间选择器',
- },
- {
- name: 'Input',
- label: '输入框',
- },
- {
- name: 'Picker',
- label: '选择器',
- },
- {
- name: 'Radio',
- label: '单选框',
- },
- {
- name: 'Rate',
- label: '评分',
- },
- {
- name: 'Search',
- label: '搜索框',
- },
- {
- name: 'Slider',
- label: '滑动选择器',
- },
- {
- name: 'Stepper',
- label: '步进器',
- },
- {
- name: 'Switch',
- label: '开关',
- },
- {
- name: 'Textarea',
- label: '多行文本框',
- },
- {
- name: 'TreeSelect',
- label: '树形选择器',
- },
- {
- name: 'Upload',
- label: '上传',
- },
- ],
-};
-export default form;
diff --git a/pages/home/data/index.d.ts b/pages/home/data/index.d.ts
deleted file mode 100644
index 4ec7641..0000000
--- a/pages/home/data/index.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-declare const _default: {
- name: string;
- icon: string;
- childArr: {
- name: string;
- label: string;
- }[];
-}[];
-export default _default;
diff --git a/pages/home/data/index.js b/pages/home/data/index.js
deleted file mode 100644
index e401aac..0000000
--- a/pages/home/data/index.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import base from './base';
-import nav from './nav';
-import display from './display';
-import form from './form';
-import ux from './ux';
-export default [base, nav, form, display, ux];
diff --git a/pages/home/data/nav.d.ts b/pages/home/data/nav.d.ts
deleted file mode 100644
index 7aec11e..0000000
--- a/pages/home/data/nav.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-declare const nav: {
- name: string;
- icon: string;
- childArr: {
- name: string;
- label: string;
- }[];
-};
-export default nav;
diff --git a/pages/home/data/nav.js b/pages/home/data/nav.js
deleted file mode 100644
index a0dbbe8..0000000
--- a/pages/home/data/nav.js
+++ /dev/null
@@ -1,39 +0,0 @@
-const nav = {
- name: ' 导航',
- icon: 'view-module',
- childArr: [
- {
- name: 'BackTop',
- label: '返回顶部',
- },
- {
- name: 'Drawer',
- label: '抽屉',
- },
- {
- name: 'Indexes',
- label: '索引',
- },
- {
- name: 'Navbar',
- label: '导航栏',
- },
- {
- name: 'SideBar',
- label: '侧边栏',
- },
- {
- name: 'Steps',
- label: '步骤条',
- },
- {
- name: 'TabBar',
- label: '标签栏',
- },
- {
- name: 'Tabs',
- label: '选项卡',
- },
- ],
-};
-export default nav;
diff --git a/pages/home/data/ux.d.ts b/pages/home/data/ux.d.ts
deleted file mode 100644
index f0cb497..0000000
--- a/pages/home/data/ux.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-declare const ux: {
- name: string;
- icon: string;
- childArr: {
- name: string;
- label: string;
- }[];
-};
-export default ux;
diff --git a/pages/home/data/ux.js b/pages/home/data/ux.js
deleted file mode 100644
index 93d5455..0000000
--- a/pages/home/data/ux.js
+++ /dev/null
@@ -1,51 +0,0 @@
-const ux = {
- name: '反馈',
- icon: 'chat',
- childArr: [
- {
- name: 'ActionSheet',
- label: '动作面板',
- },
- {
- name: 'Dialog',
- label: '对话框',
- },
- {
- name: 'DropdownMenu',
- label: '下拉菜单',
- },
- {
- name: 'Loading',
- label: '加载',
- },
- {
- name: 'Message',
- label: '消息通知',
- },
- {
- name: 'NoticeBar',
- label: '公告栏',
- },
- {
- name: 'Overlay',
- label: '遮罩层',
- },
- {
- name: 'Popup',
- label: '弹出层',
- },
- {
- name: 'PullDownRefresh',
- label: '下拉刷新',
- },
- {
- name: 'SwipeCell',
- label: '滑动操作',
- },
- {
- name: 'Toast',
- label: '轻提示',
- },
- ],
-};
-export default ux;
diff --git a/pages/home/home.js b/pages/home/home.js
deleted file mode 100644
index fcab38a..0000000
--- a/pages/home/home.js
+++ /dev/null
@@ -1,58 +0,0 @@
-import list from './data/index';
-Page({
- data: {
- list,
- },
- onLoad(options) {
- const { path, q } = options;
- console.log(path);
- if (q) {
- const str = this.getQueryByUrl(decodeURIComponent(q));
- console.log(str, str.page);
- wx.navigateTo({
- url: `/pages/${str.page}/${str.page}`,
- });
- }
- },
- clickHandle(e) {
- let { name, path = '' } = e.detail.item;
- if (!path) {
- name = name.replace(/^[A-Z]/, (match) => `${match}`.toLocaleLowerCase());
- name = name.replace(/[A-Z]/g, (match) => {
- return `-${match.toLowerCase()}`;
- });
- path = `/pages/${name}/${name}`;
- }
- wx.navigateTo({
- url: path,
- fail: () => {
- wx.navigateTo({
- url: '/pages/home/navigateFail/navigateFail',
- });
- },
- });
- },
- onShareAppMessage() {
- return {
- title: 'TDesign UI',
- path: '/pages/home/home',
- };
- },
- getQueryByUrl(url) {
- const data = {};
- const queryArr = `${url}`.match(/([^=?]+)=[^]+/g) || [];
- if (queryArr.length) {
- queryArr.forEach((para) => {
- const d = para.split('=');
- const val = decodeURIComponent(d[1]);
- if (data[d[0]] !== undefined) {
- data[d[0]] += `,${val}`;
- }
- else {
- data[d[0]] = val;
- }
- });
- }
- return data;
- },
-});
diff --git a/pages/home/home.json b/pages/home/home.json
deleted file mode 100644
index f96706e..0000000
--- a/pages/home/home.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "usingComponents": {
- "pull-down-list": "../../components/pull-down-list/index"
- },
- "navigationBarTitleText": "TDesign UI",
- "navigationBarBackgroundColor": "#f6f6f6",
- "navigationBarTextStyle": "black",
- "backgroundColor": "#f6f6f6"
-}
diff --git a/pages/home/home.wxml b/pages/home/home.wxml
deleted file mode 100644
index bc9b40d..0000000
--- a/pages/home/home.wxml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- TDesign 适配微信小程序的组件库
-
-
diff --git a/pages/home/home.wxss b/pages/home/home.wxss
deleted file mode 100644
index 2e47fa3..0000000
--- a/pages/home/home.wxss
+++ /dev/null
@@ -1,32 +0,0 @@
-page {
- background-color: #f6f6f6;
-}
-.main {
- width: 100%;
- box-sizing: border-box;
- padding-left: 32rpx;
- padding-right: 32rpx;
- padding-top: 48rpx;
- padding-bottom: 240rpx;
-}
-.title-wrap {
- display: flex;
- align-items: center;
- justify-content: flex-start;
- padding-left: 16rpx;
- padding-right: 16rpx;
-}
-.title-icon {
- width: 296rpx;
- height: 80rpx;
-}
-.desc {
- color: rgba(0, 0, 0, 0.4);
- margin-top: 32rpx;
- font-size: 28rpx;
- font-weight: 400;
- line-height: 44rpx;
- margin-bottom: 48rpx;
- padding-left: 16rpx;
- padding-right: 16rpx;
-}
diff --git a/pages/home/navigateFail/navigateFail.d.ts b/pages/home/navigateFail/navigateFail.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/home/navigateFail/navigateFail.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/home/navigateFail/navigateFail.js b/pages/home/navigateFail/navigateFail.js
deleted file mode 100644
index 22c7014..0000000
--- a/pages/home/navigateFail/navigateFail.js
+++ /dev/null
@@ -1,10 +0,0 @@
-Page({
- data: {
- failImage: 'error-circle-filled',
- },
- toHome() {
- wx.reLaunch({
- url: '/pages/home/home',
- });
- },
-});
diff --git a/pages/home/navigateFail/navigateFail.json b/pages/home/navigateFail/navigateFail.json
deleted file mode 100644
index 9e26dfe..0000000
--- a/pages/home/navigateFail/navigateFail.json
+++ /dev/null
@@ -1 +0,0 @@
-{}
\ No newline at end of file
diff --git a/pages/home/navigateFail/navigateFail.wxml b/pages/home/navigateFail/navigateFail.wxml
deleted file mode 100644
index 22010d1..0000000
--- a/pages/home/navigateFail/navigateFail.wxml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
- 页面加载错误
- 回到首页
-
-
diff --git a/pages/home/navigateFail/navigateFail.wxss b/pages/home/navigateFail/navigateFail.wxss
deleted file mode 100644
index 2b64b5e..0000000
--- a/pages/home/navigateFail/navigateFail.wxss
+++ /dev/null
@@ -1,22 +0,0 @@
-.demo {
- display: flex;
- align-items: center;
- justify-content: center;
- height: 1000rpx;
-}
-.demo .fail-error {
- margin-top: 48rpx;
- margin-bottom: 96rpx;
- width: 100%;
- color: rgba(0, 0, 0, 0.4);
- font-size: 28rpx;
- font-weight: 400;
- text-align: center;
-}
-.demo .t-button--default {
- width: 320rpx;
- height: 80rpx;
- color: rgba(0, 0, 0, 0.9);
- font-weight: 700;
- font-size: 28rpx;
-}
diff --git a/pages/icon/base/index.js b/pages/icon/base/index.js
deleted file mode 100644
index 5317cf3..0000000
--- a/pages/icon/base/index.js
+++ /dev/null
@@ -1,256 +0,0 @@
-Component({
- data: {
- icons: [
- 'add-circle',
- 'add-rectangle',
- 'add',
- 'app',
- 'arrow-down-rectangle',
- 'arrow-down',
- 'arrow-left',
- 'arrow-right',
- 'arrow-up',
- 'attach',
- 'backtop-rectangle',
- 'backtop',
- 'backward',
- 'barcode',
- 'books',
- 'browse-off',
- 'browse',
- 'bulletpoint',
- 'calendar',
- 'call',
- 'caret-down-small',
- 'caret-down',
- 'caret-left-small',
- 'caret-left',
- 'caret-right-small',
- 'caret-right',
- 'caret-up-small',
- 'caret-up',
- 'cart',
- 'chart-bar',
- 'chart-bubble',
- 'chart-pie',
- 'chart',
- 'chat',
- 'check-circle-filled',
- 'check-circle',
- 'check-rectangle-filled',
- 'check-rectangle',
- 'check',
- 'chevron-down-circle',
- 'chevron-down-rectangle',
- 'chevron-down',
- 'chevron-left-circle',
- 'chevron-left-double',
- 'chevron-left-rectangle',
- 'chevron-left',
- 'chevron-right-circle',
- 'chevron-right-double',
- 'chevron-right-rectangle',
- 'chevron-right',
- 'chevron-up-circle',
- 'chevron-up-rectangle',
- 'chevron-up',
- 'circle',
- 'clear',
- 'close-circle-filled',
- 'close-circle',
- 'close-rectangle',
- 'close',
- 'cloud-download',
- 'cloud-upload',
- 'cloud',
- 'code',
- 'control-platform',
- 'creditcard',
- 'dashboard',
- 'delete',
- 'desktop',
- 'discount-filled',
- 'discount',
- 'download',
- 'edit-1',
- 'edit',
- 'ellipsis',
- 'enter',
- 'error-circle-filled',
- 'error-circle',
- 'error',
- 'file-add',
- 'file-copy',
- 'file-excel',
- 'file-icon',
- 'file-image',
- 'file-paste',
- 'file-pdf',
- 'file-powerpoint',
- 'file-unknown',
- 'file-word',
- 'file',
- 'filter-clear',
- 'filter',
- 'flag',
- 'folder-add',
- 'folder-open',
- 'folder',
- 'fork',
- 'format-horizontal-align-bottom',
- 'format-horizontal-align-center',
- 'format-horizontal-align-top',
- 'format-vertical-align-center',
- 'format-vertical-align-left',
- 'format-vertical-align-right',
- 'forward',
- 'fullscreen-exit',
- 'fullscreen',
- 'gender-female',
- 'gender-male',
- 'gift',
- 'heart-filled',
- 'heart',
- 'help-circle-filled',
- 'help-circle',
- 'help',
- 'history',
- 'home',
- 'hourglass',
- 'image-error',
- 'image',
- 'info-circle-filled',
- 'info-circle',
- 'internet',
- 'jump',
- 'laptop',
- 'layers',
- 'link-unlink',
- 'link',
- 'loading',
- 'location',
- 'lock-off',
- 'lock-on',
- 'login',
- 'logo-android',
- 'logo-apple-filled',
- 'logo-apple',
- 'logo-chrome-filled',
- 'logo-chrome',
- 'logo-codepen',
- 'logo-github-filled',
- 'logo-github',
- 'logo-ie-filled',
- 'logo-ie',
- 'logo-qq',
- 'logo-wechat',
- 'logo-wecom',
- 'logo-windows-filled',
- 'logo-windows',
- 'logout',
- 'mail',
- 'menu-fold',
- 'menu-unfold',
- 'minus-circle-filled',
- 'minus-circle',
- 'minus-rectangle',
- 'mirror',
- 'mobile-vibrate',
- 'mobile',
- 'money-circle',
- 'more',
- 'move',
- 'next',
- 'notification-filled',
- 'notification',
- 'order-adjustment-column',
- 'order-ascending',
- 'order-descending',
- 'page-first',
- 'page-last',
- 'pause-circle-filled',
- 'photo',
- 'pin-filled',
- 'pin',
- 'play-circle-filled',
- 'play-circle-stroke',
- 'play-circle',
- 'play',
- 'poweroff',
- 'precise-monitor',
- 'previous',
- 'print',
- 'qrcode',
- 'queue',
- 'rectangle',
- 'refresh',
- 'relativity',
- 'remove',
- 'rollback',
- 'rollfront',
- 'root-list',
- 'rotation',
- 'round',
- 'save',
- 'scan',
- 'search',
- 'secured',
- 'server',
- 'service',
- 'setting',
- 'share',
- 'shop',
- 'slash',
- 'sound',
- 'star-filled',
- 'star',
- 'stop-circle-1',
- 'stop-circle-filled',
- 'stop-circle',
- 'stop',
- 'swap-left',
- 'swap-right',
- 'swap',
- 'thumb-down',
- 'thumb-up',
- 'time-filled',
- 'time',
- 'tips',
- 'tools',
- 'unfold-less',
- 'unfold-more',
- 'upload',
- 'usb',
- 'user-add',
- 'user-avatar',
- 'user-circle',
- 'user-clear',
- 'user-talk',
- 'user',
- 'usergroup-add',
- 'usergroup-clear',
- 'usergroup',
- 'video',
- 'view-column',
- 'view-list',
- 'view-module',
- 'wallet',
- 'wifi',
- 'zoom-in',
- 'zoom-out',
- ],
- },
-
- methods: {
- onIconTap(event) {
- console.log();
- const { name, type } = event.currentTarget.dataset;
- if (type === 'prefix') {
- return;
- }
- wx.setClipboardData({
- data: name,
- });
- },
- },
-});
diff --git a/pages/icon/base/index.json b/pages/icon/base/index.json
deleted file mode 100644
index 3fb9848..0000000
--- a/pages/icon/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-icon": "tdesign-miniprogram/icon/icon"
- }
-}
diff --git a/pages/icon/base/index.wxml b/pages/icon/base/index.wxml
deleted file mode 100644
index dd26af1..0000000
--- a/pages/icon/base/index.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- {{item}}
-
-
diff --git a/pages/icon/base/index.wxss b/pages/icon/base/index.wxss
deleted file mode 100644
index dc9f7c4..0000000
--- a/pages/icon/base/index.wxss
+++ /dev/null
@@ -1,16 +0,0 @@
-.demo__list {
- display: flex;
- flex-wrap: wrap;
- padding: 16rpx 32rpx;
-}
-
-.demo__card {
- flex: 0 0 25%;
- text-align: center;
- margin-bottom: 30rpx;
-}
-
-.demo__card-name {
- font-size: 24rpx;
- color: #999;
-}
diff --git a/pages/icon/custom/index.js b/pages/icon/custom/index.js
deleted file mode 100644
index 562bf2f..0000000
--- a/pages/icon/custom/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-Component({
- data: {
- prefixIcons: ['a-0', 'a-1h', 'a-2h', 'a-3h'],
- },
- methods: {
- onIconTap(event) {
- const { name, type } = event.currentTarget.dataset;
- if (type === 'prefix') {
- return;
- }
- wx.setClipboardData({
- data: name,
- });
- },
- },
-});
diff --git a/pages/icon/custom/index.json b/pages/icon/custom/index.json
deleted file mode 100644
index 3fb9848..0000000
--- a/pages/icon/custom/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-icon": "tdesign-miniprogram/icon/icon"
- }
-}
diff --git a/pages/icon/custom/index.wxml b/pages/icon/custom/index.wxml
deleted file mode 100644
index 8403204..0000000
--- a/pages/icon/custom/index.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- {{item}}
-
-
diff --git a/pages/icon/custom/index.wxss b/pages/icon/custom/index.wxss
deleted file mode 100644
index afeb9d8..0000000
--- a/pages/icon/custom/index.wxss
+++ /dev/null
@@ -1,48 +0,0 @@
-.demo__list {
- display: flex;
- flex-wrap: wrap;
- padding: 16rpx 32rpx;
-}
-
-.demo__card {
- flex: 0 0 25%;
- text-align: center;
-}
-
-.demo__card-name {
- font-size: 24rpx;
- color: #999;
-}
-
-/* 自定义图标 */
-@font-face {
- font-family: 'icon'; /* Project id 3144196 */
- src: url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAPUAAsAAAAACGAAAAOFAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACDGgqEPIQBATYCJAMUCwwABCAFhDcHQhtVBxHVmy/JfhzGjunMd9u7ZdNoJGL95+B5ckPfvzsIgZjoVHHRKe1qNlEdfUoAPFpzlgKhvLdV7dpf4MyYhRbmw1+ObxM9+wDSmJP2okWn0XkEe1sWSOAJJR4mYA3TSx7kD48ggEsZ9VFNm7ftSsjYQVPHk4DBlwpUtTJ21IhBONyBmagVHAR76U6DbMQCtUo9BzZk75cfVIgDCkvjn9NxeLOhPPTb+R31wtqF6PckEgQ4WwEWoIGih7mk93SgK7pIF6FxhwKGPDTZIOB3rK312yWKZ//hgaDQGBAbvzoIgIYwY8BvFxEI+O0JFPgdCDT4HVVfpN0CwAWWfQ68w1yWUQUvFRUUEJMZ0zBmzKILZ26suXbqHGrh2ZNXV18/fV68hafWnInRi06vPskQ3VV6eKqH9vB2nPDWbNu2C1xZtH31VhgiPfbE7kmo2ba78+R9oy6cueOtuXVuHwt3+kNEdfVYNWfEmhMii067q3cK6kYqetu26F2w6GjUtlO79uXprVE7b7r38YsHl62wxmwPBrvdDvyl7A2Os2v65berseOS461n/fL6PbPim4dlpFSGJIdmpmSGMm3NvmaVrZtVNPePPcwtGCU9i0KcX3dKyKGCTUFnY9aHrCNjTeN5PzcGxQd6498Eh4WH5zXPjbbvdIxJHLz4dnx4QLNlC4Y/nd98/MZvwLSjqfOTGoRGhEX8dfOa50XbtyfEJHVbM+JAnW7F8SnLQr7+lxVUpFRN6PF4ZnpY62/ZybnNs8Ki0qIimiWf7HroYciPBM85E3+uGqdmAKjPamomzPiEAAJN2zkJA0Lr/nY8A8DHwLJq4DAszzgoYIrfbuy7UNRYGTKaoc7Ih2BddD9goQJcXKDWj0Tw8RhT5OIkCKahZFAEEAuNIYUyXAYsPHJgYyiHSyHV+z0iGYhGTCCQwxQAwWEXFCEcgsbhAmW4G7CI4QFsHF7AxXn+ZQ85QYZDxpFxgekHag6eQj1npVcULztmKY8ST8xFwTh0dVvPXdBjXrOmvEXPTEA5ODhvvQ+tDRBz0DhzLZnjvmlo6Cn1HNzqkHFkXIDpB6g5eEos3Fx+RfGyYx5QZ74nQl3hclgPdNS0E9TF4Ce7XrS+vEUPMwFkq4MDzlf70AbpAMThaRpnrpEbknFPg8RoqaG+1uTekpz14a+2RIkWI5bYbAdV7S6ydTKm+/ggVysAAAA=')
- format('woff2'),
- url('//at.alicdn.com/t/font_3144196_s14ifjx2cyi.woff?t=1642299317916') format('woff'),
- url('//at.alicdn.com/t/font_3144196_s14ifjx2cyi.ttf?t=1642299317916') format('truetype');
-}
-
-.icon {
- font-family: 'icon' !important;
- font-size: 16px;
- font-style: normal;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
-
-.icon-a-0:before {
- content: '\e64d';
-}
-
-.icon-a-1h:before {
- content: '\e64e';
-}
-
-.icon-a-2h:before {
- content: '\e64f';
-}
-
-.icon-a-3h:before {
- content: '\e650';
-}
diff --git a/pages/icon/data.js b/pages/icon/data.js
deleted file mode 100644
index c8de41a..0000000
--- a/pages/icon/data.js
+++ /dev/null
@@ -1,240 +0,0 @@
-const icons = [
- 'add-circle',
- 'add-rectangle',
- 'add',
- 'app',
- 'arrow-down-rectangle',
- 'arrow-down',
- 'arrow-left',
- 'arrow-right',
- 'arrow-up',
- 'attach',
- 'backtop-rectangle',
- 'backtop',
- 'backward',
- 'barcode',
- 'books',
- 'browse-off',
- 'browse',
- 'bulletpoint',
- 'calendar',
- 'call',
- 'caret-down-small',
- 'caret-down',
- 'caret-left-small',
- 'caret-left',
- 'caret-right-small',
- 'caret-right',
- 'caret-up-small',
- 'caret-up',
- 'cart',
- 'chart-bar',
- 'chart-bubble',
- 'chart-pie',
- 'chart',
- 'chat',
- 'check-circle-filled',
- 'check-circle',
- 'check-rectangle-filled',
- 'check-rectangle',
- 'check',
- 'chevron-down-circle',
- 'chevron-down-rectangle',
- 'chevron-down',
- 'chevron-left-circle',
- 'chevron-left-double',
- 'chevron-left-rectangle',
- 'chevron-left',
- 'chevron-right-circle',
- 'chevron-right-double',
- 'chevron-right-rectangle',
- 'chevron-right',
- 'chevron-up-circle',
- 'chevron-up-rectangle',
- 'chevron-up',
- 'circle',
- 'clear',
- 'close-circle-filled',
- 'close-circle',
- 'close-rectangle',
- 'close',
- 'cloud-download',
- 'cloud-upload',
- 'cloud',
- 'code',
- 'control-platform',
- 'creditcard',
- 'dashboard',
- 'delete',
- 'desktop',
- 'discount-filled',
- 'discount',
- 'download',
- 'edit-1',
- 'edit',
- 'ellipsis',
- 'enter',
- 'error-circle-filled',
- 'error-circle',
- 'error',
- 'file-add',
- 'file-copy',
- 'file-excel',
- 'file-icon',
- 'file-image',
- 'file-paste',
- 'file-pdf',
- 'file-powerpoint',
- 'file-unknown',
- 'file-word',
- 'file',
- 'filter-clear',
- 'filter',
- 'flag',
- 'folder-add',
- 'folder-open',
- 'folder',
- 'fork',
- 'format-horizontal-align-bottom',
- 'format-horizontal-align-center',
- 'format-horizontal-align-top',
- 'format-vertical-align-center',
- 'format-vertical-align-left',
- 'format-vertical-align-right',
- 'forward',
- 'fullscreen-exit',
- 'fullscreen',
- 'gender-female',
- 'gender-male',
- 'gift',
- 'heart-filled',
- 'heart',
- 'help-circle-filled',
- 'help-circle',
- 'help',
- 'history',
- 'home',
- 'hourglass',
- 'image-error',
- 'image',
- 'info-circle-filled',
- 'info-circle',
- 'internet',
- 'jump',
- 'laptop',
- 'layers',
- 'link-unlink',
- 'link',
- 'loading',
- 'location',
- 'lock-off',
- 'lock-on',
- 'login',
- 'logo-android',
- 'logo-apple-filled',
- 'logo-apple',
- 'logo-chrome-filled',
- 'logo-chrome',
- 'logo-codepen',
- 'logo-github-filled',
- 'logo-github',
- 'logo-ie-filled',
- 'logo-ie',
- 'logo-qq',
- 'logo-wechat',
- 'logo-wecom',
- 'logo-windows-filled',
- 'logo-windows',
- 'logout',
- 'mail',
- 'menu-fold',
- 'menu-unfold',
- 'minus-circle-filled',
- 'minus-circle',
- 'minus-rectangle',
- 'mirror',
- 'mobile-vibrate',
- 'mobile',
- 'money-circle',
- 'more',
- 'move',
- 'next',
- 'notification-filled',
- 'notification',
- 'order-adjustment-column',
- 'order-ascending',
- 'order-descending',
- 'page-first',
- 'page-last',
- 'pause-circle-filled',
- 'photo',
- 'pin-filled',
- 'pin',
- 'play-circle-filled',
- 'play-circle-stroke',
- 'play-circle',
- 'play',
- 'poweroff',
- 'precise-monitor',
- 'previous',
- 'print',
- 'qrcode',
- 'queue',
- 'rectangle',
- 'refresh',
- 'relativity',
- 'remove',
- 'rollback',
- 'rollfront',
- 'root-list',
- 'rotation',
- 'round',
- 'save',
- 'scan',
- 'search',
- 'secured',
- 'server',
- 'service',
- 'setting',
- 'share',
- 'shop',
- 'slash',
- 'sound',
- 'star-filled',
- 'star',
- 'stop-circle-1',
- 'stop-circle-filled',
- 'stop-circle',
- 'stop',
- 'swap-left',
- 'swap-right',
- 'swap',
- 'thumb-down',
- 'thumb-up',
- 'time-filled',
- 'time',
- 'tips',
- 'tools',
- 'unfold-less',
- 'unfold-more',
- 'upload',
- 'usb',
- 'user-add',
- 'user-avatar',
- 'user-circle',
- 'user-clear',
- 'user-talk',
- 'user',
- 'usergroup-add',
- 'usergroup-clear',
- 'usergroup',
- 'video',
- 'view-column',
- 'view-list',
- 'view-module',
- 'wallet',
- 'wifi',
- 'zoom-in',
- 'zoom-out',
-];
-export default icons;
diff --git a/pages/icon/icon.d.ts b/pages/icon/icon.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/icon/icon.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/icon/icon.js b/pages/icon/icon.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/icon/icon.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/icon/icon.json b/pages/icon/icon.json
deleted file mode 100644
index fe2df22..0000000
--- a/pages/icon/icon.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarTitleText": "Icon",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "base": "./base",
- "custom": "./custom",
- "iconImage": "./iconImage"
- }
-}
diff --git a/pages/icon/icon.wxml b/pages/icon/icon.wxml
deleted file mode 100644
index 52176f5..0000000
--- a/pages/icon/icon.wxml
+++ /dev/null
@@ -1,15 +0,0 @@
-
- Icon 图标
- 用于界面中的操作、入口、功能、服务等视觉表达,icon风格与品牌风格需要保持一致的感受,从而增加一致性
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/icon/icon.wxss b/pages/icon/icon.wxss
deleted file mode 100644
index fb7db68..0000000
--- a/pages/icon/icon.wxss
+++ /dev/null
@@ -1,27 +0,0 @@
-@font-face {
- font-family: 'icon';
- /* Project id 3144196 */
- src: url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAPUAAsAAAAACGAAAAOFAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACDGgqEPIQBATYCJAMUCwwABCAFhDcHQhtVBxHVmy/JfhzGjunMd9u7ZdNoJGL95+B5ckPfvzsIgZjoVHHRKe1qNlEdfUoAPFpzlgKhvLdV7dpf4MyYhRbmw1+ObxM9+wDSmJP2okWn0XkEe1sWSOAJJR4mYA3TSx7kD48ggEsZ9VFNm7ftSsjYQVPHk4DBlwpUtTJ21IhBONyBmagVHAR76U6DbMQCtUo9BzZk75cfVIgDCkvjn9NxeLOhPPTb+R31wtqF6PckEgQ4WwEWoIGih7mk93SgK7pIF6FxhwKGPDTZIOB3rK312yWKZ//hgaDQGBAbvzoIgIYwY8BvFxEI+O0JFPgdCDT4HVVfpN0CwAWWfQ68w1yWUQUvFRUUEJMZ0zBmzKILZ26suXbqHGrh2ZNXV18/fV68hafWnInRi06vPskQ3VV6eKqH9vB2nPDWbNu2C1xZtH31VhgiPfbE7kmo2ba78+R9oy6cueOtuXVuHwt3+kNEdfVYNWfEmhMii067q3cK6kYqetu26F2w6GjUtlO79uXprVE7b7r38YsHl62wxmwPBrvdDvyl7A2Os2v65berseOS461n/fL6PbPim4dlpFSGJIdmpmSGMm3NvmaVrZtVNPePPcwtGCU9i0KcX3dKyKGCTUFnY9aHrCNjTeN5PzcGxQd6498Eh4WH5zXPjbbvdIxJHLz4dnx4QLNlC4Y/nd98/MZvwLSjqfOTGoRGhEX8dfOa50XbtyfEJHVbM+JAnW7F8SnLQr7+lxVUpFRN6PF4ZnpY62/ZybnNs8Ki0qIimiWf7HroYciPBM85E3+uGqdmAKjPamomzPiEAAJN2zkJA0Lr/nY8A8DHwLJq4DAszzgoYIrfbuy7UNRYGTKaoc7Ih2BddD9goQJcXKDWj0Tw8RhT5OIkCKahZFAEEAuNIYUyXAYsPHJgYyiHSyHV+z0iGYhGTCCQwxQAwWEXFCEcgsbhAmW4G7CI4QFsHF7AxXn+ZQ85QYZDxpFxgekHag6eQj1npVcULztmKY8ST8xFwTh0dVvPXdBjXrOmvEXPTEA5ODhvvQ+tDRBz0DhzLZnjvmlo6Cn1HNzqkHFkXIDpB6g5eEos3Fx+RfGyYx5QZ74nQl3hclgPdNS0E9TF4Ce7XrS+vEUPMwFkq4MDzlf70AbpAMThaRpnrpEbknFPg8RoqaG+1uTekpz14a+2RIkWI5bYbAdV7S6ydTKm+/ggVysAAAA=') format('woff2'), url('//at.alicdn.com/t/font_3144196_s14ifjx2cyi.woff?t=1642299317916') format('woff'), url('//at.alicdn.com/t/font_3144196_s14ifjx2cyi.ttf?t=1642299317916') format('truetype');
-}
-.icon {
- font-family: 'icon' !important;
- font-size: 16px;
- font-style: normal;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
-.icon-a-0:before {
- content: '\e64d';
-}
-.icon-a-1h:before {
- content: '\e64e';
-}
-.icon-a-2h:before {
- content: '\e64f';
-}
-.icon-a-3h:before {
- content: '\e650';
-}
-page {
- background: #fff;
-}
diff --git a/pages/icon/iconImage/index.js b/pages/icon/iconImage/index.js
deleted file mode 100644
index 3ea373a..0000000
--- a/pages/icon/iconImage/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-Component({
- data: {
- imageIconList: [
- 'https://tdesign.gtimg.com/miniprogram/images/icon1.png',
- 'https://tdesign.gtimg.com/miniprogram/images/icon2.png',
- ],
- },
-
- methods: {
- onIconTap(event) {
- const { name, type } = event.currentTarget.dataset;
- if (type === 'prefix') {
- return;
- }
- wx.setClipboardData({
- data: name,
- });
- },
- },
-});
diff --git a/pages/icon/iconImage/index.json b/pages/icon/iconImage/index.json
deleted file mode 100644
index 3fb9848..0000000
--- a/pages/icon/iconImage/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-icon": "tdesign-miniprogram/icon/icon"
- }
-}
diff --git a/pages/icon/iconImage/index.wxml b/pages/icon/iconImage/index.wxml
deleted file mode 100644
index b14294b..0000000
--- a/pages/icon/iconImage/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/icon/iconImage/index.wxss b/pages/icon/iconImage/index.wxss
deleted file mode 100644
index 81b1f28..0000000
--- a/pages/icon/iconImage/index.wxss
+++ /dev/null
@@ -1,12 +0,0 @@
-.demo__list {
- display: flex;
- flex-wrap: wrap;
- padding: 16rpx 32rpx;
-}
-
-.demo__card {
- flex: 0 0 25%;
- display: flex;
- justify-content: center;
- text-align: center;
-}
diff --git a/pages/icon/iconfont.wxss b/pages/icon/iconfont.wxss
deleted file mode 100644
index 85f8b20..0000000
--- a/pages/icon/iconfont.wxss
+++ /dev/null
@@ -1,31 +0,0 @@
-@font-face {
- font-family: 'icon'; /* Project id 3144196 */
- src: url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAPUAAsAAAAACGAAAAOFAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACDGgqEPIQBATYCJAMUCwwABCAFhDcHQhtVBxHVmy/JfhzGjunMd9u7ZdNoJGL95+B5ckPfvzsIgZjoVHHRKe1qNlEdfUoAPFpzlgKhvLdV7dpf4MyYhRbmw1+ObxM9+wDSmJP2okWn0XkEe1sWSOAJJR4mYA3TSx7kD48ggEsZ9VFNm7ftSsjYQVPHk4DBlwpUtTJ21IhBONyBmagVHAR76U6DbMQCtUo9BzZk75cfVIgDCkvjn9NxeLOhPPTb+R31wtqF6PckEgQ4WwEWoIGih7mk93SgK7pIF6FxhwKGPDTZIOB3rK312yWKZ//hgaDQGBAbvzoIgIYwY8BvFxEI+O0JFPgdCDT4HVVfpN0CwAWWfQ68w1yWUQUvFRUUEJMZ0zBmzKILZ26suXbqHGrh2ZNXV18/fV68hafWnInRi06vPskQ3VV6eKqH9vB2nPDWbNu2C1xZtH31VhgiPfbE7kmo2ba78+R9oy6cueOtuXVuHwt3+kNEdfVYNWfEmhMii067q3cK6kYqetu26F2w6GjUtlO79uXprVE7b7r38YsHl62wxmwPBrvdDvyl7A2Os2v65berseOS461n/fL6PbPim4dlpFSGJIdmpmSGMm3NvmaVrZtVNPePPcwtGCU9i0KcX3dKyKGCTUFnY9aHrCNjTeN5PzcGxQd6498Eh4WH5zXPjbbvdIxJHLz4dnx4QLNlC4Y/nd98/MZvwLSjqfOTGoRGhEX8dfOa50XbtyfEJHVbM+JAnW7F8SnLQr7+lxVUpFRN6PF4ZnpY62/ZybnNs8Ki0qIimiWf7HroYciPBM85E3+uGqdmAKjPamomzPiEAAJN2zkJA0Lr/nY8A8DHwLJq4DAszzgoYIrfbuy7UNRYGTKaoc7Ih2BddD9goQJcXKDWj0Tw8RhT5OIkCKahZFAEEAuNIYUyXAYsPHJgYyiHSyHV+z0iGYhGTCCQwxQAwWEXFCEcgsbhAmW4G7CI4QFsHF7AxXn+ZQ85QYZDxpFxgekHag6eQj1npVcULztmKY8ST8xFwTh0dVvPXdBjXrOmvEXPTEA5ODhvvQ+tDRBz0DhzLZnjvmlo6Cn1HNzqkHFkXIDpB6g5eEos3Fx+RfGyYx5QZ74nQl3hclgPdNS0E9TF4Ce7XrS+vEUPMwFkq4MDzlf70AbpAMThaRpnrpEbknFPg8RoqaG+1uTekpz14a+2RIkWI5bYbAdV7S6ydTKm+/ggVysAAAA=')
- format('woff2'),
- url('//at.alicdn.com/t/font_3144196_s14ifjx2cyi.woff?t=1642299317916') format('woff'),
- url('//at.alicdn.com/t/font_3144196_s14ifjx2cyi.ttf?t=1642299317916') format('truetype');
-}
-
-.icon {
- font-family: 'icon' !important;
- font-size: 16px;
- font-style: normal;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
-
-.icon-a-0:before {
- content: '\e64d';
-}
-
-.icon-a-1h:before {
- content: '\e64e';
-}
-
-.icon-a-2h:before {
- content: '\e64f';
-}
-
-.icon-a-3h:before {
- content: '\e650';
-}
diff --git a/pages/image-viewer/base/index.js b/pages/image-viewer/base/index.js
deleted file mode 100644
index fc90fe4..0000000
--- a/pages/image-viewer/base/index.js
+++ /dev/null
@@ -1,69 +0,0 @@
-import Toast from 'tdesign-miniprogram/toast/index';
-
-Component({
- data: {
- visible: false,
- showIndex: false,
- closeBtn: false,
- deleteBtn: false,
- images: [],
- },
- methods: {
- clickHandle() {
- this.setData({
- images: [
- 'https://tdesign.gtimg.com/miniprogram/images/preview6.png',
- 'https://tdesign.gtimg.com/miniprogram/images/preview1.png',
- 'https://tdesign.gtimg.com/miniprogram/images/preview2.png',
- 'https://tdesign.gtimg.com/miniprogram/images/preview3.png',
- 'https://tdesign.gtimg.com/miniprogram/images/preview4.png',
- ],
- showIndex: true,
- visible: true,
- });
- },
- onChange(e) {
- const {
- detail: { index },
- } = e;
- Toast({
- context: this,
- selector: '#t-toast',
- message: `翻到第${index + 1}个`,
- });
- },
-
- onDelete(e) {
- const {
- detail: { index },
- } = e;
- Toast({
- context: this,
- selector: '#t-toast',
- message: `删除第${index + 1}个`,
- });
- },
-
- onClose(e) {
- const {
- 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: false,
- });
- },
- },
-});
diff --git a/pages/image-viewer/base/index.json b/pages/image-viewer/base/index.json
deleted file mode 100644
index 88fcfec..0000000
--- a/pages/image-viewer/base/index.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-toast": "tdesign-miniprogram/toast/toast",
- "t-image-viewer": "tdesign-miniprogram/image-viewer/image-viewer"
- }
-}
diff --git a/pages/image-viewer/base/index.wxml b/pages/image-viewer/base/index.wxml
deleted file mode 100644
index 67c4861..0000000
--- a/pages/image-viewer/base/index.wxml
+++ /dev/null
@@ -1,12 +0,0 @@
-基础图片预览
-
-
diff --git a/pages/image-viewer/base/index.wxss b/pages/image-viewer/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/image-viewer/delete/index.js b/pages/image-viewer/delete/index.js
deleted file mode 100644
index 4dfcd50..0000000
--- a/pages/image-viewer/delete/index.js
+++ /dev/null
@@ -1,72 +0,0 @@
-import Toast from 'tdesign-miniprogram/toast/index';
-
-Component({
- data: {
- visible: false,
- showIndex: false,
- closeBtn: false,
- deleteBtn: false,
- images: [],
- },
- methods: {
- clickHandle() {
- this.setData({
- images: [
- 'https://tdesign.gtimg.com/miniprogram/images/preview6.png',
- 'https://tdesign.gtimg.com/miniprogram/images/preview5.png',
- 'https://tdesign.gtimg.com/miniprogram/images/preview1.png',
- 'https://tdesign.gtimg.com/miniprogram/images/preview2.png',
- 'https://tdesign.gtimg.com/miniprogram/images/preview3.png',
- 'https://tdesign.gtimg.com/miniprogram/images/preview4.png',
- ],
- showIndex: true,
- visible: true,
- closeBtn: true,
- deleteBtn: true,
- });
- },
- onChange(e) {
- const {
- detail: { index },
- } = e;
- Toast({
- context: this,
- selector: '#t-toast',
- message: `翻到第${index + 1}个`,
- });
- },
-
- onDelete(e) {
- const {
- detail: { index },
- } = e;
- Toast({
- context: this,
- selector: '#t-toast',
- message: `删除第${index + 1}个`,
- });
- },
-
- onClose(e) {
- const {
- 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: false,
- });
- },
- },
-});
diff --git a/pages/image-viewer/delete/index.json b/pages/image-viewer/delete/index.json
deleted file mode 100644
index 88fcfec..0000000
--- a/pages/image-viewer/delete/index.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-toast": "tdesign-miniprogram/toast/toast",
- "t-image-viewer": "tdesign-miniprogram/image-viewer/image-viewer"
- }
-}
diff --git a/pages/image-viewer/delete/index.wxml b/pages/image-viewer/delete/index.wxml
deleted file mode 100644
index 6f9e821..0000000
--- a/pages/image-viewer/delete/index.wxml
+++ /dev/null
@@ -1,12 +0,0 @@
-带操作图片预览
-
-
diff --git a/pages/image-viewer/delete/index.wxss b/pages/image-viewer/delete/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/image-viewer/image-viewer.d.ts b/pages/image-viewer/image-viewer.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/image-viewer/image-viewer.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/image-viewer/image-viewer.js b/pages/image-viewer/image-viewer.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/image-viewer/image-viewer.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/image-viewer/image-viewer.json b/pages/image-viewer/image-viewer.json
deleted file mode 100644
index d76076b..0000000
--- a/pages/image-viewer/image-viewer.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "navigationBarTitleText": "ImageViewer",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "base": "./base",
- "delete": "./delete"
- }
-}
diff --git a/pages/image-viewer/image-viewer.wxml b/pages/image-viewer/image-viewer.wxml
deleted file mode 100644
index 9841e24..0000000
--- a/pages/image-viewer/image-viewer.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
- ImageViewer 图片预览
- 用于图片内容的缩略展示与查看。
-
-
-
-
-
-
-
diff --git a/pages/image-viewer/image-viewer.wxss b/pages/image-viewer/image-viewer.wxss
deleted file mode 100644
index 23062cc..0000000
--- a/pages/image-viewer/image-viewer.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-page {
- background-color: #fff;
-}
diff --git a/pages/image/base/index.js b/pages/image/base/index.js
deleted file mode 100644
index 16597da..0000000
--- a/pages/image/base/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- imageSrc: 'https://tdesign.gtimg.com/miniprogram/images/image1.jpeg',
- },
-});
diff --git a/pages/image/base/index.json b/pages/image/base/index.json
deleted file mode 100644
index 4f4285c..0000000
--- a/pages/image/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-image": "tdesign-miniprogram/image/image"
- }
-}
diff --git a/pages/image/base/index.wxml b/pages/image/base/index.wxml
deleted file mode 100644
index e9cd91e..0000000
--- a/pages/image/base/index.wxml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
- 裁切
-
-
-
- 适应高
-
-
-
- 拉伸
-
-
-
-
-
-
- 方形
-
-
-
- 圆角方形
-
-
-
- 圆形
-
-
-
diff --git a/pages/image/base/index.wxss b/pages/image/base/index.wxss
deleted file mode 100644
index 916b353..0000000
--- a/pages/image/base/index.wxss
+++ /dev/null
@@ -1,18 +0,0 @@
-.tr {
- display: flex;
-}
-
-.col {
- margin: 0 32rpx;
-}
-
-.tr + .tr {
- margin-top: 48rpx;
-}
-
-.text {
- font-size: 28rpx;
- color: rgba(0, 0, 0, .6);
- line-height: 44rpx;
- margin-bottom: 32rpx;
-}
diff --git a/pages/image/image.d.ts b/pages/image/image.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/image/image.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/image/image.js b/pages/image/image.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/image/image.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/image/image.json b/pages/image/image.json
deleted file mode 100644
index 305edf3..0000000
--- a/pages/image/image.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "navigationBarTitleText": "Image",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "t-image": "tdesign-miniprogram/image/image",
- "base": "./base",
- "status": "./status",
- "size": "./size"
- }
-}
diff --git a/pages/image/image.wxml b/pages/image/image.wxml
deleted file mode 100644
index 26cc605..0000000
--- a/pages/image/image.wxml
+++ /dev/null
@@ -1,11 +0,0 @@
-
- Image 图片
- 用于展示效果,主要为上下左右居中裁切、拉伸、平铺等方式。
-
-
-
-
-
-
-
-
diff --git a/pages/image/image.wxss b/pages/image/image.wxss
deleted file mode 100644
index 43f4cec..0000000
--- a/pages/image/image.wxss
+++ /dev/null
@@ -1,48 +0,0 @@
-page {
- background: #fff;
-}
-.title {
- margin: 0rpx 32rpx;
- padding-top: 48rpx;
- font-size: 44rpx;
- font-weight: bold;
- line-height: 64rpx;
-}
-.desc {
- margin-top: 10rpx;
- margin-bottom: 10rpx;
- margin-left: 32rpx;
- margin-right: 32rpx;
- color: #999;
- font-size: 26rpx;
- line-height: 36rpx;
-}
-.row {
- display: flex;
- align-items: flex-end;
-}
-.gutter-row {
- height: 32rpx;
-}
-.gutter-column-24 {
- width: 48rpx;
- display: inline-block;
-}
-.gutter-column-32 {
- width: 64rpx;
- display: inline-block;
-}
-.image-example {
- display: flex;
- align-items: center;
- flex-direction: column;
-}
-.image-example .text {
- margin-top: 16rpx;
- font-size: 24rpx;
- color: rgba(0, 0, 0, 0.4);
-}
-.bottom-row {
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
-}
diff --git a/pages/image/size/index.js b/pages/image/size/index.js
deleted file mode 100644
index 2411ca3..0000000
--- a/pages/image/size/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-Component({
- properties: {
- size: {
- type: String,
- value: 'l',
- },
- },
-
- data: {
- imageSrc: 'https://tdesign.gtimg.com/miniprogram/images/image1.jpeg',
- },
-});
diff --git a/pages/image/size/index.json b/pages/image/size/index.json
deleted file mode 100644
index 4f4285c..0000000
--- a/pages/image/size/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-image": "tdesign-miniprogram/image/image"
- }
-}
diff --git a/pages/image/size/index.wxml b/pages/image/size/index.wxml
deleted file mode 100644
index abfe290..0000000
--- a/pages/image/size/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/image/size/index.wxss b/pages/image/size/index.wxss
deleted file mode 100644
index f05fac4..0000000
--- a/pages/image/size/index.wxss
+++ /dev/null
@@ -1,29 +0,0 @@
-.size-xl {
- width: 120px;
- height: 120px;
-}
-
-.size-l {
- width: 72px;
- height: 72px;
-}
-
-.size-m {
- width: 56px;
- height: 56px;
-}
-
-.size-s {
- width: 48px;
- height: 48px;
-}
-
-.size-xs {
- width: 32px;
- height: 32px;
-}
-
-.size-xss {
- width: 24px;
- height: 24px;
-}
diff --git a/pages/image/status/index.js b/pages/image/status/index.js
deleted file mode 100644
index eb281d4..0000000
--- a/pages/image/status/index.js
+++ /dev/null
@@ -1,21 +0,0 @@
-Component({
- pageLifetimes: {
- show: function () {
- const $ele1 = this.selectComponent('#loading-img');
- const $ele2 = this.selectComponent('#loading-img-custom');
-
- this.setLoadingStatus($ele1);
- this.setLoadingStatus($ele2);
- },
- },
- methods: {
- setLoadingStatus(ele) {
- ele.onLoadError = null;
- ele.onLoaded = null;
- ele.setData({
- isLoading: true,
- isFailed: false,
- });
- },
- },
-});
diff --git a/pages/image/status/index.json b/pages/image/status/index.json
deleted file mode 100644
index ed33d97..0000000
--- a/pages/image/status/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-image": "tdesign-miniprogram/image/image",
- "t-loading": "tdesign-miniprogram/loading/loading"
- }
-}
diff --git a/pages/image/status/index.wxml b/pages/image/status/index.wxml
deleted file mode 100644
index 9c5a34a..0000000
--- a/pages/image/status/index.wxml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
- 加载默认提示
-
-
-
- 加载自定义提示
-
-
-
-
-
-
-
-
- 失败默认提示
-
-
-
- 失败自定义提示
-
- 加载失败
-
-
-
diff --git a/pages/image/status/index.wxss b/pages/image/status/index.wxss
deleted file mode 100644
index 3fe637a..0000000
--- a/pages/image/status/index.wxss
+++ /dev/null
@@ -1,23 +0,0 @@
-.tr {
- display: flex;
-}
-
-.col {
- margin: 0 32rpx;
-}
-
-.tr + .tr {
- margin-top: 48rpx;
-}
-
-.text {
- font-size: 28rpx;
- color: rgba(0, 0, 0, .6);
- line-height: 44rpx;
- margin-bottom: 32rpx;
-}
-
-.error-text {
- font-size: 20rpx;
- font-weight: 400;
-}
\ No newline at end of file
diff --git a/pages/indexes/base/index.js b/pages/indexes/base/index.js
deleted file mode 100644
index 5e7a1a4..0000000
--- a/pages/indexes/base/index.js
+++ /dev/null
@@ -1,104 +0,0 @@
-Page({
- data: {
- indexList: [],
- list: [
- {
- index: 'A',
- children: ['阿坝', '阿拉善', '阿里', '安康', '安庆', '鞍山', '安顺', '安阳', '澳门'],
- },
- {
- index: 'B',
- children: [
- '北京',
- '白银',
- '保定',
- '宝鸡',
- '保山',
- '包头',
- '巴中',
- '北海',
- '蚌埠',
- '本溪',
- '毕节',
- '滨州',
- '百色',
- '亳州',
- ],
- },
- {
- index: 'C',
- children: [
- '重庆',
- '成都',
- '长沙',
- '长春',
- '沧州',
- '常德',
- '昌都',
- '长治',
- '常州',
- '巢湖',
- '潮州',
- '承德',
- '郴州',
- '赤峰',
- '池州',
- '崇左',
- '楚雄',
- '滁州',
- '朝阳',
- ],
- },
- {
- index: 'D',
- children: [
- '大连',
- '东莞',
- '大理',
- '丹东',
- '大庆',
- '大同',
- '大兴安岭',
- '德宏',
- '德阳',
- '德州',
- '定西',
- '迪庆',
- '东营',
- ],
- },
- {
- index: 'E',
- children: ['鄂尔多斯', '恩施', '鄂州'],
- },
- {
- index: 'F',
- children: ['福州', '防城港', '佛山', '抚顺', '抚州', '阜新', '阜阳'],
- },
- {
- index: 'G',
- children: ['广州', '桂林', '贵阳', '甘南', '赣州', '甘孜', '广安', '广元', '贵港', '果洛'],
- },
- {
- index: 'J',
- children: ['揭阳', '吉林', '晋江', '吉安', '胶州', '嘉兴', '济南', '鸡西', '荆州', '江门', '基隆'],
- },
- {
- index: 'K',
- children: ['昆明', '开封', '康定', '喀什'],
- },
- ],
- },
-
- onReady() {
- this.setData({
- indexList: this.data.list.map((item) => item.index),
- });
- },
-
- onSelect(e) {
- const { index } = e.detail;
-
- console.log(index);
- },
-});
diff --git a/pages/indexes/base/index.json b/pages/indexes/base/index.json
deleted file mode 100644
index 9a69268..0000000
--- a/pages/indexes/base/index.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-indexes": "tdesign-miniprogram/indexes/indexes",
- "t-indexes-anchor": "tdesign-miniprogram/indexes-anchor/indexes-anchor",
- "t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
- "t-cell": "tdesign-miniprogram/cell/cell"
- }
-}
diff --git a/pages/indexes/base/index.wxml b/pages/indexes/base/index.wxml
deleted file mode 100644
index f962db5..0000000
--- a/pages/indexes/base/index.wxml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/pages/indexes/base/index.wxss b/pages/indexes/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/indexes/custom/index.js b/pages/indexes/custom/index.js
deleted file mode 100644
index 6f7e6ea..0000000
--- a/pages/indexes/custom/index.js
+++ /dev/null
@@ -1,49 +0,0 @@
-const children = new Array(5).fill('列表内容');
-
-const list = [
- {
- index: 1,
- children,
- },
- {
- index: 3,
- children,
- },
- {
- index: 5,
- children,
- },
- {
- index: 7,
- children,
- },
- {
- index: 8,
- children,
- },
- {
- index: 10,
- children,
- },
- {
- index: '#',
- children,
- },
-];
-
-Page({
- data: {
- list,
- indexList: list.map((item) => item.index),
- curIndex: '',
- },
-
- onChange(e) {
- const { index } = e.detail;
-
- console.log(index);
- this.setData({
- curIndex: index,
- });
- },
-});
diff --git a/pages/indexes/custom/index.json b/pages/indexes/custom/index.json
deleted file mode 100644
index 9a69268..0000000
--- a/pages/indexes/custom/index.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-indexes": "tdesign-miniprogram/indexes/indexes",
- "t-indexes-anchor": "tdesign-miniprogram/indexes-anchor/indexes-anchor",
- "t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
- "t-cell": "tdesign-miniprogram/cell/cell"
- }
-}
diff --git a/pages/indexes/custom/index.wxml b/pages/indexes/custom/index.wxml
deleted file mode 100644
index a78d734..0000000
--- a/pages/indexes/custom/index.wxml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- {{item.index}}
-
-
-
-
-
-
diff --git a/pages/indexes/custom/index.wxss b/pages/indexes/custom/index.wxss
deleted file mode 100644
index 3b628e3..0000000
--- a/pages/indexes/custom/index.wxss
+++ /dev/null
@@ -1,24 +0,0 @@
-page {
- background-color: #fff;
-}
-
-.capsule {
- margin: 0 8px;
- height: 30px;
- border-radius: 15px;
- background-color: #f3f3f3;
- padding-left: 32rpx;
- display: flex;
- align-items: center;
- font-size: 14px;
- box-sizing: border-box;
-}
-
-.capsule--active {
- background: #fff;
- border: 1px solid #e7e7e7;
-}
-
-.wrapper {
- padding-top: 8px;
-}
\ No newline at end of file
diff --git a/pages/indexes/indexes.d.ts b/pages/indexes/indexes.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/indexes/indexes.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/indexes/indexes.js b/pages/indexes/indexes.js
deleted file mode 100644
index 00cda7d..0000000
--- a/pages/indexes/indexes.js
+++ /dev/null
@@ -1,8 +0,0 @@
-Page({
- toBase() {
- wx.navigateTo({ url: '/pages/indexes/base/index' });
- },
- toCustom() {
- wx.navigateTo({ url: '/pages/indexes/custom/index' });
- },
-});
diff --git a/pages/indexes/indexes.json b/pages/indexes/indexes.json
deleted file mode 100644
index 4026106..0000000
--- a/pages/indexes/indexes.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "navigationBarTitleText": "Indexes",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/indexes/indexes.wxml b/pages/indexes/indexes.wxml
deleted file mode 100644
index 8729d19..0000000
--- a/pages/indexes/indexes.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
- Indexes 索引
- 用于页面中信息快速检索,可以根据目录中的页码快速找到所需的内容。
-
- 基础用法
-
-
- 胶囊索引
-
-
diff --git a/pages/indexes/indexes.wxss b/pages/indexes/indexes.wxss
deleted file mode 100644
index f77ae37..0000000
--- a/pages/indexes/indexes.wxss
+++ /dev/null
@@ -1,6 +0,0 @@
-page {
- background-color: #fff;
-}
-.t-button {
- margin-top: 32rpx;
-}
diff --git a/pages/input/align/index.js b/pages/input/align/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/input/align/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/input/align/index.json b/pages/input/align/index.json
deleted file mode 100644
index 1ca6b82..0000000
--- a/pages/input/align/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-input": "tdesign-miniprogram/input/input"
- }
-}
diff --git a/pages/input/align/index.wxml b/pages/input/align/index.wxml
deleted file mode 100644
index 8ec04aa..0000000
--- a/pages/input/align/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/input/align/index.wxss b/pages/input/align/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/input/banner/index.js b/pages/input/banner/index.js
deleted file mode 100644
index 2348cb7..0000000
--- a/pages/input/banner/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- style: 'border-radius: 12rpx;',
- },
-});
diff --git a/pages/input/banner/index.json b/pages/input/banner/index.json
deleted file mode 100644
index 1ca6b82..0000000
--- a/pages/input/banner/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-input": "tdesign-miniprogram/input/input"
- }
-}
diff --git a/pages/input/banner/index.wxml b/pages/input/banner/index.wxml
deleted file mode 100644
index 9740e65..0000000
--- a/pages/input/banner/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/input/banner/index.wxss b/pages/input/banner/index.wxss
deleted file mode 100644
index 9024343..0000000
--- a/pages/input/banner/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.input-example {
- margin: 0 32rpx;
-}
diff --git a/pages/input/base/index.js b/pages/input/base/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/input/base/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/input/base/index.json b/pages/input/base/index.json
deleted file mode 100644
index 1ca6b82..0000000
--- a/pages/input/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-input": "tdesign-miniprogram/input/input"
- }
-}
diff --git a/pages/input/base/index.wxml b/pages/input/base/index.wxml
deleted file mode 100644
index 3492908..0000000
--- a/pages/input/base/index.wxml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/pages/input/base/index.wxss b/pages/input/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/input/bordered/index.js b/pages/input/bordered/index.js
deleted file mode 100644
index 12644dc..0000000
--- a/pages/input/bordered/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- style: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx;',
- },
-});
diff --git a/pages/input/bordered/index.json b/pages/input/bordered/index.json
deleted file mode 100644
index 1ca6b82..0000000
--- a/pages/input/bordered/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-input": "tdesign-miniprogram/input/input"
- }
-}
diff --git a/pages/input/bordered/index.wxml b/pages/input/bordered/index.wxml
deleted file mode 100644
index 4fafe5d..0000000
--- a/pages/input/bordered/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
- 标签文字
-
-
diff --git a/pages/input/bordered/index.wxss b/pages/input/bordered/index.wxss
deleted file mode 100644
index 0b09d9f..0000000
--- a/pages/input/bordered/index.wxss
+++ /dev/null
@@ -1,13 +0,0 @@
-.input-example {
- --td-input-vertical-padding: 24rpx;
-
- background-color: #fff;
- padding: 32rpx 32rpx 16rpx;
-}
-
-.input-example__label {
- color: rgba(0, 0, 0, 0.9);
- font-size: 24rpx;
- line-height: 40rpx;
- margin: 0 8rpx 16rpx;
-}
diff --git a/pages/input/custom/index.js b/pages/input/custom/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/input/custom/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/input/custom/index.json b/pages/input/custom/index.json
deleted file mode 100644
index 1ca6b82..0000000
--- a/pages/input/custom/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-input": "tdesign-miniprogram/input/input"
- }
-}
diff --git a/pages/input/custom/index.wxml b/pages/input/custom/index.wxml
deleted file mode 100644
index 604448d..0000000
--- a/pages/input/custom/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/input/custom/index.wxss b/pages/input/custom/index.wxss
deleted file mode 100644
index 803ff0d..0000000
--- a/pages/input/custom/index.wxss
+++ /dev/null
@@ -1,11 +0,0 @@
-.input-example {
- padding-bottom: 48rpx;
-}
-
-.custom-theme {
- --td-input-bg-color: rgba(44, 44, 44, 1);
- --td-input-border-color: rgba(75, 75, 75, 1);
- --td-input-default-text-color: rgba(255, 255, 255, 1);
- --td-input-placeholder-text-color: rgba(255, 255, 255, 0.35);
- --td-input-label-text-color: rgba(255, 255, 255, 1);
-}
diff --git a/pages/input/input.d.ts b/pages/input/input.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/input/input.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/input/input.js b/pages/input/input.js
deleted file mode 100644
index f258c35..0000000
--- a/pages/input/input.js
+++ /dev/null
@@ -1,28 +0,0 @@
-Page({
- data: {
- firstValue: '',
- textPassword: '123456',
- phoneError: false,
- phoneNumber: '17600600600',
- price: '10.2',
- priceError: false,
- },
- onPhoneInput(e) {
- const { phoneError } = this.data;
- const isPhoneNumber = /^[1][3,4,5,7,8,9][0-9]{9}$/.test(e.detail.value);
- if (phoneError === isPhoneNumber) {
- this.setData({
- phoneError: !isPhoneNumber,
- });
- }
- },
- onPriceInput(e) {
- const { priceError } = this.data;
- const isNumber = /^\d+(\.\d+)?$/.test(e.detail.value);
- if (priceError === isNumber) {
- this.setData({
- priceError: !isNumber,
- });
- }
- },
-});
diff --git a/pages/input/input.json b/pages/input/input.json
deleted file mode 100644
index a11ea3d..0000000
--- a/pages/input/input.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "navigationBarTitleText": "Input",
- "usingComponents": {
- "t-input": "tdesign-miniprogram/input/input",
- "base": "./base",
- "suffix": "./suffix",
- "prefix": "./prefix",
- "layout": "./layout",
- "bordered": "./bordered",
- "size": "./size",
- "align": "./align",
- "maxlength": "./maxlength",
- "special": "./special",
- "status": "./status",
- "custom": "./custom",
- "labelDemo": "./label",
- "banner": "./banner"
- }
-}
diff --git a/pages/input/input.wxml b/pages/input/input.wxml
deleted file mode 100644
index b7b250f..0000000
--- a/pages/input/input.wxml
+++ /dev/null
@@ -1,42 +0,0 @@
-
- Input 输入框
- 用于单行文本信息输入。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/input/input.wxss b/pages/input/input.wxss
deleted file mode 100644
index bc03f3c..0000000
--- a/pages/input/input.wxss
+++ /dev/null
@@ -1,9 +0,0 @@
-.input-example {
- padding-bottom: constant(safe-area-inset-bottom);
- /* 兼容 iOS < 11.2 */
- padding-bottom: env(safe-area-inset-bottom);
- /* 兼容 iOS >= 11.2 */
-}
-.t-input {
- margin-bottom: 32rpx;
-}
diff --git a/pages/input/label/index.js b/pages/input/label/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/input/label/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/input/label/index.json b/pages/input/label/index.json
deleted file mode 100644
index 1ca6b82..0000000
--- a/pages/input/label/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-input": "tdesign-miniprogram/input/input"
- }
-}
diff --git a/pages/input/label/index.wxml b/pages/input/label/index.wxml
deleted file mode 100644
index 7eebad5..0000000
--- a/pages/input/label/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/input/label/index.wxss b/pages/input/label/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/input/layout/index.js b/pages/input/layout/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/input/layout/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/input/layout/index.json b/pages/input/layout/index.json
deleted file mode 100644
index 1ca6b82..0000000
--- a/pages/input/layout/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-input": "tdesign-miniprogram/input/input"
- }
-}
diff --git a/pages/input/layout/index.wxml b/pages/input/layout/index.wxml
deleted file mode 100644
index 2c5d5a6..0000000
--- a/pages/input/layout/index.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
diff --git a/pages/input/layout/index.wxss b/pages/input/layout/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/input/maxlength/index.js b/pages/input/maxlength/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/input/maxlength/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/input/maxlength/index.json b/pages/input/maxlength/index.json
deleted file mode 100644
index 1ca6b82..0000000
--- a/pages/input/maxlength/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-input": "tdesign-miniprogram/input/input"
- }
-}
diff --git a/pages/input/maxlength/index.wxml b/pages/input/maxlength/index.wxml
deleted file mode 100644
index cc685a9..0000000
--- a/pages/input/maxlength/index.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/pages/input/maxlength/index.wxss b/pages/input/maxlength/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/input/prefix/index.js b/pages/input/prefix/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/input/prefix/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/input/prefix/index.json b/pages/input/prefix/index.json
deleted file mode 100644
index 1ca6b82..0000000
--- a/pages/input/prefix/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-input": "tdesign-miniprogram/input/input"
- }
-}
diff --git a/pages/input/prefix/index.wxml b/pages/input/prefix/index.wxml
deleted file mode 100644
index a5d40b0..0000000
--- a/pages/input/prefix/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/input/prefix/index.wxss b/pages/input/prefix/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/input/size/index.js b/pages/input/size/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/input/size/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/input/size/index.json b/pages/input/size/index.json
deleted file mode 100644
index 1ca6b82..0000000
--- a/pages/input/size/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-input": "tdesign-miniprogram/input/input"
- }
-}
diff --git a/pages/input/size/index.wxml b/pages/input/size/index.wxml
deleted file mode 100644
index 5274eca..0000000
--- a/pages/input/size/index.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/pages/input/size/index.wxss b/pages/input/size/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/input/special/index.js b/pages/input/special/index.js
deleted file mode 100644
index b7e746d..0000000
--- a/pages/input/special/index.js
+++ /dev/null
@@ -1,30 +0,0 @@
-Component({
- data: {
- textPassword: '123456',
- phoneError: false,
- phoneNumber: '17600600600',
- priceError: false,
- },
-
- methods: {
- onPhoneInput(e) {
- const { phoneError } = this.data;
- const isPhoneNumber = /^[1][3,4,5,7,8,9][0-9]{9}$/.test(e.detail.value);
- if (phoneError === isPhoneNumber) {
- this.setData({
- phoneError: !isPhoneNumber,
- });
- }
- },
-
- onPriceInput(e) {
- const { priceError } = this.data;
- const isNumber = /^\d+(\.\d+)?$/.test(e.detail.value);
- if (priceError === isNumber) {
- this.setData({
- priceError: !isNumber,
- });
- }
- },
- },
-});
diff --git a/pages/input/special/index.json b/pages/input/special/index.json
deleted file mode 100644
index 1ca6b82..0000000
--- a/pages/input/special/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-input": "tdesign-miniprogram/input/input"
- }
-}
diff --git a/pages/input/special/index.wxml b/pages/input/special/index.wxml
deleted file mode 100644
index 2548767..0000000
--- a/pages/input/special/index.wxml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- 发送验证码
-
-
-
-
-
-
diff --git a/pages/input/special/index.wxss b/pages/input/special/index.wxss
deleted file mode 100644
index 6f51980..0000000
--- a/pages/input/special/index.wxss
+++ /dev/null
@@ -1,27 +0,0 @@
-.suffix {
- display: flex;
- align-items: center;
-}
-.suffix--line {
- width: 1px;
- height: 24px;
- background-color: #f6f6f6;
- margin-right: 16px;
-}
-
-.image {
- width: 72px;
- height: 36px;
- display: block;
- margin-top: -6px;
- margin-bottom: -6px;
-}
-
-.tips {
- text-align: right !important;
-}
-
-.verify {
- color: rgba(0, 82, 217, 1);
- font-size: 32rpx;
-}
diff --git a/pages/input/status/index.js b/pages/input/status/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/input/status/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/input/status/index.json b/pages/input/status/index.json
deleted file mode 100644
index 1ca6b82..0000000
--- a/pages/input/status/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-input": "tdesign-miniprogram/input/input"
- }
-}
diff --git a/pages/input/status/index.wxml b/pages/input/status/index.wxml
deleted file mode 100644
index 436e8e7..0000000
--- a/pages/input/status/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/input/status/index.wxss b/pages/input/status/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/input/suffix/index.js b/pages/input/suffix/index.js
deleted file mode 100644
index 030d2c7..0000000
--- a/pages/input/suffix/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-Component({
- methods: {
- click(e) {
- const { trigger } = e.detail;
- console.log('click: ', trigger);
- },
- },
-});
diff --git a/pages/input/suffix/index.json b/pages/input/suffix/index.json
deleted file mode 100644
index 2195580..0000000
--- a/pages/input/suffix/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-input": "tdesign-miniprogram/input/input"
- }
-}
diff --git a/pages/input/suffix/index.wxml b/pages/input/suffix/index.wxml
deleted file mode 100644
index ab7f2b5..0000000
--- a/pages/input/suffix/index.wxml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- 操作按钮
-
-
-
diff --git a/pages/input/suffix/index.wxss b/pages/input/suffix/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/link/content/index.js b/pages/link/content/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/link/content/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/link/content/index.json b/pages/link/content/index.json
deleted file mode 100644
index f606017..0000000
--- a/pages/link/content/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-link": "tdesign-miniprogram/link/link"
- }
-}
diff --git a/pages/link/content/index.wxml b/pages/link/content/index.wxml
deleted file mode 100644
index 1bf3ca3..0000000
--- a/pages/link/content/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/pages/link/content/index.wxss b/pages/link/content/index.wxss
deleted file mode 100644
index 965eec2..0000000
--- a/pages/link/content/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.link-example {
- display: flex;
- align-items: center;
- justify-content: space-evenly;
- height: 96rpx;
- background-color: #fff;
-}
diff --git a/pages/link/disabled/index.js b/pages/link/disabled/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/link/disabled/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/link/disabled/index.json b/pages/link/disabled/index.json
deleted file mode 100644
index f606017..0000000
--- a/pages/link/disabled/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-link": "tdesign-miniprogram/link/link"
- }
-}
diff --git a/pages/link/disabled/index.wxml b/pages/link/disabled/index.wxml
deleted file mode 100644
index eb49e1a..0000000
--- a/pages/link/disabled/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/pages/link/disabled/index.wxss b/pages/link/disabled/index.wxss
deleted file mode 100644
index 671099d..0000000
--- a/pages/link/disabled/index.wxss
+++ /dev/null
@@ -1,11 +0,0 @@
-.link-example {
- display: flex;
- align-items: center;
- justify-content: space-evenly;
- height: 96rpx;
- background-color: #fff;
-}
-
-.link-example:not(:last-child) {
- margin-bottom: 32rpx;
-}
diff --git a/pages/link/link.d.ts b/pages/link/link.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/link/link.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/link/link.js b/pages/link/link.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/link/link.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/link/link.json b/pages/link/link.json
deleted file mode 100644
index 662a25a..0000000
--- a/pages/link/link.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "navigationBarTitleText": "Link",
- "usingComponents": {
- "content": "./content",
- "underline": "./underline",
- "prefix": "./prefix",
- "suffix": "./suffix",
- "theme": "./theme",
- "disabled": "./disabled",
- "size": "./size"
- }
-}
diff --git a/pages/link/link.wxml b/pages/link/link.wxml
deleted file mode 100644
index 0123a79..0000000
--- a/pages/link/link.wxml
+++ /dev/null
@@ -1,25 +0,0 @@
-
- Link 链接
- 文字超链接用于跳转一个新页面,如当前项目跳转,友情链接等。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/link/link.wxss b/pages/link/link.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/link/prefix/index.js b/pages/link/prefix/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/link/prefix/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/link/prefix/index.json b/pages/link/prefix/index.json
deleted file mode 100644
index f606017..0000000
--- a/pages/link/prefix/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-link": "tdesign-miniprogram/link/link"
- }
-}
diff --git a/pages/link/prefix/index.wxml b/pages/link/prefix/index.wxml
deleted file mode 100644
index fe479df..0000000
--- a/pages/link/prefix/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/pages/link/prefix/index.wxss b/pages/link/prefix/index.wxss
deleted file mode 100644
index 965eec2..0000000
--- a/pages/link/prefix/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.link-example {
- display: flex;
- align-items: center;
- justify-content: space-evenly;
- height: 96rpx;
- background-color: #fff;
-}
diff --git a/pages/link/size/index.js b/pages/link/size/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/link/size/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/link/size/index.json b/pages/link/size/index.json
deleted file mode 100644
index f606017..0000000
--- a/pages/link/size/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-link": "tdesign-miniprogram/link/link"
- }
-}
diff --git a/pages/link/size/index.wxml b/pages/link/size/index.wxml
deleted file mode 100644
index e7a3f2e..0000000
--- a/pages/link/size/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/link/size/index.wxss b/pages/link/size/index.wxss
deleted file mode 100644
index 965eec2..0000000
--- a/pages/link/size/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.link-example {
- display: flex;
- align-items: center;
- justify-content: space-evenly;
- height: 96rpx;
- background-color: #fff;
-}
diff --git a/pages/link/suffix/index.js b/pages/link/suffix/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/link/suffix/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/link/suffix/index.json b/pages/link/suffix/index.json
deleted file mode 100644
index f606017..0000000
--- a/pages/link/suffix/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-link": "tdesign-miniprogram/link/link"
- }
-}
diff --git a/pages/link/suffix/index.wxml b/pages/link/suffix/index.wxml
deleted file mode 100644
index d6153d3..0000000
--- a/pages/link/suffix/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/pages/link/suffix/index.wxss b/pages/link/suffix/index.wxss
deleted file mode 100644
index 965eec2..0000000
--- a/pages/link/suffix/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.link-example {
- display: flex;
- align-items: center;
- justify-content: space-evenly;
- height: 96rpx;
- background-color: #fff;
-}
diff --git a/pages/link/theme/index.js b/pages/link/theme/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/link/theme/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/link/theme/index.json b/pages/link/theme/index.json
deleted file mode 100644
index f606017..0000000
--- a/pages/link/theme/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-link": "tdesign-miniprogram/link/link"
- }
-}
diff --git a/pages/link/theme/index.wxml b/pages/link/theme/index.wxml
deleted file mode 100644
index ff97f4a..0000000
--- a/pages/link/theme/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/pages/link/theme/index.wxss b/pages/link/theme/index.wxss
deleted file mode 100644
index 671099d..0000000
--- a/pages/link/theme/index.wxss
+++ /dev/null
@@ -1,11 +0,0 @@
-.link-example {
- display: flex;
- align-items: center;
- justify-content: space-evenly;
- height: 96rpx;
- background-color: #fff;
-}
-
-.link-example:not(:last-child) {
- margin-bottom: 32rpx;
-}
diff --git a/pages/link/underline/index.js b/pages/link/underline/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/link/underline/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/link/underline/index.json b/pages/link/underline/index.json
deleted file mode 100644
index f606017..0000000
--- a/pages/link/underline/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-link": "tdesign-miniprogram/link/link"
- }
-}
diff --git a/pages/link/underline/index.wxml b/pages/link/underline/index.wxml
deleted file mode 100644
index d289c1a..0000000
--- a/pages/link/underline/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/pages/link/underline/index.wxss b/pages/link/underline/index.wxss
deleted file mode 100644
index 965eec2..0000000
--- a/pages/link/underline/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.link-example {
- display: flex;
- align-items: center;
- justify-content: space-evenly;
- height: 96rpx;
- background-color: #fff;
-}
diff --git a/pages/loading/base/index.js b/pages/loading/base/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/loading/base/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/loading/base/index.json b/pages/loading/base/index.json
deleted file mode 100644
index dc12aaf..0000000
--- a/pages/loading/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "components": true,
- "usingComponents": {
- "t-loading": "tdesign-miniprogram/loading/loading"
- }
-}
diff --git a/pages/loading/base/index.wxml b/pages/loading/base/index.wxml
deleted file mode 100644
index f50b0db..0000000
--- a/pages/loading/base/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/loading/base/index.wxss b/pages/loading/base/index.wxss
deleted file mode 100644
index e22e585..0000000
--- a/pages/loading/base/index.wxss
+++ /dev/null
@@ -1,8 +0,0 @@
-.loading-container-flex {
- display: flex;
- align-items: center;
-}
-
-.wrapper {
- margin-right: 40px;
-}
diff --git a/pages/loading/duration/index.js b/pages/loading/duration/index.js
deleted file mode 100644
index 61a404b..0000000
--- a/pages/loading/duration/index.js
+++ /dev/null
@@ -1,10 +0,0 @@
-Component({
- data: {
- duration: 800,
- },
- methods: {
- durationChange(e) {
- this.setData({ duration: e.detail.value });
- },
- },
-});
diff --git a/pages/loading/duration/index.json b/pages/loading/duration/index.json
deleted file mode 100644
index 81c1cd8..0000000
--- a/pages/loading/duration/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "components": true,
- "usingComponents": {
- "t-loading": "tdesign-miniprogram/loading/loading",
- "t-slider": "tdesign-miniprogram/slider/slider"
- }
-}
diff --git a/pages/loading/duration/index.wxml b/pages/loading/duration/index.wxml
deleted file mode 100644
index 3c4da17..0000000
--- a/pages/loading/duration/index.wxml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
diff --git a/pages/loading/duration/index.wxss b/pages/loading/duration/index.wxss
deleted file mode 100644
index ee0784d..0000000
--- a/pages/loading/duration/index.wxss
+++ /dev/null
@@ -1,9 +0,0 @@
-.slider-container {
- display: flex;
- align-items: center;
- width: 718rpx;
-}
-
-.slider-class {
- flex-grow: 1;
-}
diff --git a/pages/loading/horizontal/index.js b/pages/loading/horizontal/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/loading/horizontal/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/loading/horizontal/index.json b/pages/loading/horizontal/index.json
deleted file mode 100644
index dc12aaf..0000000
--- a/pages/loading/horizontal/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "components": true,
- "usingComponents": {
- "t-loading": "tdesign-miniprogram/loading/loading"
- }
-}
diff --git a/pages/loading/horizontal/index.wxml b/pages/loading/horizontal/index.wxml
deleted file mode 100644
index 50e490f..0000000
--- a/pages/loading/horizontal/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/pages/loading/horizontal/index.wxss b/pages/loading/horizontal/index.wxss
deleted file mode 100644
index c0707c4..0000000
--- a/pages/loading/horizontal/index.wxss
+++ /dev/null
@@ -1,10 +0,0 @@
-.loading-container-flex {
- display: flex;
- align-items: center;
- color: #000;
-}
-
-.wrapper {
- display: flex;
- margin-right: 64px;
-}
diff --git a/pages/loading/loading.d.ts b/pages/loading/loading.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/loading/loading.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/loading/loading.js b/pages/loading/loading.js
deleted file mode 100644
index 5485047..0000000
--- a/pages/loading/loading.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Page({
- goToProgress() {
- wx.redirectTo({
- url: '/pages/loading/loadingProgress/index',
- });
- },
-});
diff --git a/pages/loading/loading.json b/pages/loading/loading.json
deleted file mode 100644
index 6127448..0000000
--- a/pages/loading/loading.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "navigationBarTitleText": "Loading",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "base": "./base",
- "horizontal": "./horizontal",
- "vertical": "./vertical",
- "text": "./text",
- "status": "./status",
- "duration": "./duration",
- "size": "./size"
- }
-}
diff --git a/pages/loading/loading.wxml b/pages/loading/loading.wxml
deleted file mode 100644
index 093fa97..0000000
--- a/pages/loading/loading.wxml
+++ /dev/null
@@ -1,30 +0,0 @@
-
- Loading 加载
- 用于表示页面或操作的加载状态,给予用户反馈的同时减缓等待的焦虑感,由一个或一组反馈动效组成。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/loading/loading.wxss b/pages/loading/loading.wxss
deleted file mode 100644
index 23062cc..0000000
--- a/pages/loading/loading.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-page {
- background-color: #fff;
-}
diff --git a/pages/loading/size/index.js b/pages/loading/size/index.js
deleted file mode 100644
index 2dc2188..0000000
--- a/pages/loading/size/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
-});
diff --git a/pages/loading/size/index.json b/pages/loading/size/index.json
deleted file mode 100644
index dc12aaf..0000000
--- a/pages/loading/size/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "components": true,
- "usingComponents": {
- "t-loading": "tdesign-miniprogram/loading/loading"
- }
-}
diff --git a/pages/loading/size/index.wxml b/pages/loading/size/index.wxml
deleted file mode 100644
index ce41b48..0000000
--- a/pages/loading/size/index.wxml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
- 中尺寸
-
-
-
- 小尺寸
-
-
-
diff --git a/pages/loading/size/index.wxss b/pages/loading/size/index.wxss
deleted file mode 100644
index 541a5e9..0000000
--- a/pages/loading/size/index.wxss
+++ /dev/null
@@ -1,11 +0,0 @@
-.large {
- --td-loading-text-font-size: 32rpx;
-}
-
-.middle {
- --td-loading-text-font-size: 28rpx;
-}
-
-.demo-desc {
- margin: 48rpx 0 32rpx;
-}
\ No newline at end of file
diff --git a/pages/loading/status/index.js b/pages/loading/status/index.js
deleted file mode 100644
index c457b86..0000000
--- a/pages/loading/status/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-Component({
- data: {
- isCheck: false,
- },
- methods: {
- switchChange() {
- const { isCheck } = this.data;
- this.setData({ isCheck: !isCheck });
- },
- },
-});
diff --git a/pages/loading/status/index.json b/pages/loading/status/index.json
deleted file mode 100644
index 6de40e5..0000000
--- a/pages/loading/status/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "components": true,
- "usingComponents": {
- "t-loading": "tdesign-miniprogram/loading/loading",
- "t-switch": "tdesign-miniprogram/switch/switch"
- }
-}
diff --git a/pages/loading/status/index.wxml b/pages/loading/status/index.wxml
deleted file mode 100644
index 0c59fb2..0000000
--- a/pages/loading/status/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- {{isCheck?'请求发起,延迟显示loading加载':'请求结束,隐藏loading加载'}}
-
-
diff --git a/pages/loading/status/index.wxss b/pages/loading/status/index.wxss
deleted file mode 100644
index 63911a6..0000000
--- a/pages/loading/status/index.wxss
+++ /dev/null
@@ -1,11 +0,0 @@
-.loading-container-flex {
- display: flex;
- align-items: center;
- font-size: 24rpx;
- margin-bottom: 32rpx;
-}
-
-.text-info {
- margin-left: 24rpx;
- color: rgba(0, 0, 0, 0.4);
-}
diff --git a/pages/loading/text/index.js b/pages/loading/text/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/loading/text/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/loading/text/index.json b/pages/loading/text/index.json
deleted file mode 100644
index dc12aaf..0000000
--- a/pages/loading/text/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "components": true,
- "usingComponents": {
- "t-loading": "tdesign-miniprogram/loading/loading"
- }
-}
diff --git a/pages/loading/text/index.wxml b/pages/loading/text/index.wxml
deleted file mode 100644
index f7942e9..0000000
--- a/pages/loading/text/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/loading/text/index.wxss b/pages/loading/text/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/loading/vertical/index.js b/pages/loading/vertical/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/loading/vertical/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/loading/vertical/index.json b/pages/loading/vertical/index.json
deleted file mode 100644
index dc12aaf..0000000
--- a/pages/loading/vertical/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "components": true,
- "usingComponents": {
- "t-loading": "tdesign-miniprogram/loading/loading"
- }
-}
diff --git a/pages/loading/vertical/index.wxml b/pages/loading/vertical/index.wxml
deleted file mode 100644
index 1ea27fc..0000000
--- a/pages/loading/vertical/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/pages/loading/vertical/index.wxss b/pages/loading/vertical/index.wxss
deleted file mode 100644
index 8756623..0000000
--- a/pages/loading/vertical/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.box {
- display: flex;
-}
-
-.wrapper {
- margin-right: 64px;
-}
\ No newline at end of file
diff --git a/pages/meeting/index.json b/pages/meeting/index.json
new file mode 100644
index 0000000..8692885
--- /dev/null
+++ b/pages/meeting/index.json
@@ -0,0 +1,5 @@
+{
+ "usingComponents": {},
+ "navigationBarTextStyle": "white",
+ "pageOrientation": "landscape"
+}
\ No newline at end of file
diff --git a/pages/meeting/index.scss b/pages/meeting/index.scss
new file mode 100644
index 0000000..9c06719
--- /dev/null
+++ b/pages/meeting/index.scss
@@ -0,0 +1,292 @@
+/* pages/meeting/index.wxss */
+@mixin user () {
+ &-user {
+ display: flex;
+ align-items: center;
+ position: absolute;
+ z-index: 1;
+ left: 6rpx;
+ background-color: rgba(0, 0, 0, 0.4);
+ border-radius: 4rpx;
+ padding: 2rpx;
+ bottom: 4rpx;
+
+ &-view {
+ width: 16rpx;
+ height: 16rpx;
+ border-radius: 4rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-shrink: 0;
+
+ &-image {
+ width: 60%;
+ height: 60%;
+ }
+ }
+
+ &-image {
+ width: 16rpx;
+ height: 16rpx;
+ flex-shrink: 0;
+ }
+
+ &-text {
+ color: white;
+ font-size: 12rpx;
+ }
+ }
+}
+
+.meeting {
+ background-color: rgb(44, 48, 51);
+ height: 100vh;
+ display: flex;
+ flex-direction: column;
+
+ &-content {
+ flex-grow: 1;
+ display: flex;
+ position: relative;
+ box-sizing: border-box;
+
+ &-noAdmin {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ background-color: black;
+ z-index: 2;
+
+ &-image {
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%);
+ width: calc(370rpx / 2);
+ height: calc(330rpx / 2);
+ }
+ }
+
+ &-video {
+ flex-grow: 1;
+ position: relative;
+
+ &-avatar {
+ position: absolute;
+ left: 0%;
+ top: 0%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ height: 100%;
+ background-color: black;
+ }
+
+ &-canvas {
+ width: 100%;
+ height: 100%;
+ background-color: black;
+
+ #player {
+ height: 100%;
+ width: 100%;
+ box-sizing: border-box;
+ }
+ }
+
+ @include user();
+ }
+
+ &-smallvideo {
+ width: 20%;
+ overflow-y: auto;
+
+ &-box {
+ height: calc(100% / 3);
+ position: relative;
+ padding: 2rpx 4rpx;
+ box-sizing: border-box;
+
+ &-view {
+ height: 100%;
+ background-color: black;
+ border: 1px solid #7B96FF;
+ box-shadow: 0 0 13rpx #7b96ff;
+ box-sizing: border-box;
+
+ &-avatar {
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%) scale(0.4);
+ }
+
+ &-canvas {
+ width: 100%;
+ height: 100%;
+ background-color: black;
+
+ &-play {
+ height: 100%;
+ width: 100%;
+ box-sizing: border-box;
+ }
+ }
+
+ @include user();
+
+ &-share {
+ position: absolute;
+ left: 50%;
+ top: 6%;
+ z-index: 2;
+ transform: translate(-50%, 0%);
+ background-color: rgba(0, 0, 0, 0.5);
+ color: white;
+ font-size: 10rpx;
+ padding: 2rpx 4rpx;
+ white-space: nowrap;
+ }
+ }
+ }
+
+ .active {
+ border: 1px solid #0fa01b !important;
+ }
+ }
+ }
+
+ &-footer {
+ flex-shrink: 0;
+ background-color: rgb(35, 36, 38);
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+
+ &-left {
+ display: flex;
+ align-items: center;
+ margin-left: 30rpx;
+
+ &-view {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 4rpx 0;
+ width: 70rpx;
+ box-sizing: border-box;
+
+ &-image {
+ width: 32rpx;
+ height: 32rpx;
+ }
+
+ &-text {
+ font-size: 12rpx;
+ color: white;
+ }
+ }
+ }
+
+ &-right {
+ color: red;
+ font-size: 16rpx;
+ margin-right: 30rpx;
+ }
+ }
+}
+
+.user-popup {
+ width: 30vw;
+ height: 100vh;
+ background-color: #16191E;
+ padding: 10rpx;
+ box-sizing: border-box;
+ overflow-y: auto;
+
+ &-view {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 4rpx 0;
+
+ &-avatar {
+ display: flex;
+ align-items: center;
+ flex-grow: 1;
+
+ &-text {
+ flex-grow: 1;
+ color: white;
+ font-size: 14rpx;
+ margin: 0 2rpx;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ width: 0;
+ }
+ }
+
+ &-image {
+ display: flex;
+ align-items: center;
+ flex-shrink: 0;
+
+ &-icon {
+ width: 16rpx;
+ height: 16rpx;
+ }
+ }
+ }
+}
+
+.chat-popup {
+ width: 40vw;
+ height: 100vh;
+ background-color: #16191E;
+ padding: 10rpx;
+ box-sizing: border-box;
+ display: flex;
+ flex-direction: column;
+
+ &-list {
+ flex-grow: 1;
+ overflow-y: auto;
+
+ &-view {
+ color: white;
+ font-size: 14rpx;
+ margin-bottom: 4rpx;
+ }
+ }
+
+ &-input {
+ flex-shrink: 0;
+ display: flex;
+ align-items: center;
+ margin-top: 10rpx;
+
+ &-text {
+ flex-grow: 1;
+ background-color: black;
+ color: white;
+ font-size: 14rpx;
+ padding: 6rpx 4rpx;
+ }
+
+ &-submit {
+ color: white;
+ font-size: 14rpx;
+ margin-left: 4rpx;
+ background-color: #5575F2;
+ padding: 6rpx 10rpx;
+ border-radius: 4rpx;
+ }
+ }
+}
+
+.t-message {
+ transform: scale(0.4);
+}
\ No newline at end of file
diff --git a/pages/meeting/index.ts b/pages/meeting/index.ts
new file mode 100644
index 0000000..c98f398
--- /dev/null
+++ b/pages/meeting/index.ts
@@ -0,0 +1,670 @@
+import { GetRoomInfo, GetRoomUser, GetShowUser, GetApplySpeak, PostMuteAll, PostOpenMicr, PostOpenCamera, DeleteRoomManager } from '../../api/meeting/index'
+import { agora } from '../../utils/agora'
+import { onInvoke, onSignalr } from '../../utils/singlr'
+import { role, getStorage } from '../../utils/utils'
+import { Message } from 'tdesign-miniprogram';
+const computedBehavior = require('miniprogram-computed').behavior;
+Page({
+ behaviors: [computedBehavior],
+ data: {
+ footerList: [
+ {
+ title: '关闭听筒',
+ titleActive: '开启听筒',
+ active: true,
+ icon: '/assets/icon1.png',
+ iconActive: '/assets/icon1-active.png',
+ },
+ {
+ title: '静音',
+ titleActive: '解除静音',
+ active: false,
+ icon: '/assets/icon2.png',
+ iconActive: '/assets/icon2-active.png',
+ },
+ {
+ title: '关闭视频',
+ titleActive: '打开视频',
+ active: false,
+ icon: '/assets/icon3.png',
+ iconActive: '/assets/icon3-active.png',
+ },
+ {
+ title: '翻转',
+ titleActive: '翻转',
+ active: true,
+ icon: '/assets/icon4.png',
+ iconActive: '/assets/icon4.png',
+ },
+ {
+ title: '聊天',
+ titleActive: '聊天',
+ active: true,
+ icon: '/assets/icon5.png',
+ iconActive: '/assets/icon5.png',
+ },
+ {
+ title: '成员',
+ titleActive: '成员',
+ active: true,
+ icon: '/assets/icon6.png',
+ iconActive: '/assets/icon6.png',
+ },
+ {
+ title: '申请发言',
+ titleActive: '结束发言',
+ active: true,
+ icon: '/assets/icon7.png',
+ iconActive: '/assets/icon7-active.png',
+ },
+ ],
+ channelId: '',
+ roomInfo: '',
+ roomUserList: [],
+ chatList: [],
+ isAdmin: 0,
+ currentUid: '',
+ currentUser: '',
+ userNumer: 0,
+ noViewChatList: 0,
+ applySpeakDialog: false,
+ userPopupVisible: false,
+ chatPopupVisible: false,
+ devicePosition: true,
+ muted: false,
+ currentRequestSpeakType: '',
+ user: '',
+ messageStr: ''
+ },
+ watch: {
+ 'roomUserList.**': function (roomUserList) {
+ this.setData({
+ isAdmin: roomUserList.filter((item: any) => (role.ID.includes(item.roleId) || item.isRoomManager) && item.isRoom).length,
+ userNumer: roomUserList.filter((item: any) => item.isRoom).length,
+ })
+ },
+ 'isClicked': function (isClicked) {
+ if (isClicked) {
+ let timer = setTimeout(() => {
+ this.setData({
+ isClicked: false,
+ })
+ clearTimeout(timer)
+ }, 10000);
+ }
+ }
+ },
+ async onLoad(option) {
+ this.setData({
+ channelId: option.roomNum,
+ user: await getStorage('user')
+ })
+ await this.joinChannel()
+ await this.getRoomUser()
+ await this.getShowUser()
+ this.startClientEvent()
+ this.startSignalr()
+ await this.getRoomInfo()
+ },
+ startSignalr() {
+ onSignalr(async (item) => {
+ const userInfo: any = await getStorage('user')
+ switch (item.key) {
+ // 聊天
+ case 'ReceiveMessage':
+ if (!this.data.chatPopupVisible) {
+ this.setData({
+ noViewChatList: this.data.noViewChatList += 1
+ })
+ }
+ this.setData({
+ chatList: [...this.data.chatList, item]
+ })
+ break;
+ // 扩展操作
+ case 'Operation':
+ // 4:屏幕共享
+ break;
+ // 全员离开房间
+ case 'AllLeave':
+ this.message('管理员已结束会议!').success()
+ this.back()
+ break;
+ // 移出会议
+ case 'ForceExitRoom':
+ this.message('管理员已将你移出会议!').success()
+ this.back()
+ break;
+ // 更新视图模式
+ case 'RefreshView':
+
+ break;
+ // 全员看他
+ case 'ShowUser':
+ if (item.operUid && item.operUserName) {
+ if (item.operUid !== userInfo.uid) {
+ if (item.uid === userInfo.uid) {
+ this.message(`${item.operUserName}设置全员看你`).success()
+ } else {
+ this.message(`${item.operUserName}设置全员看${item.uname}`).success()
+ }
+ }
+ }
+ this.getShowUser()
+ break;
+ // 用户加入频道回调
+ case 'UserJoined':
+ this.setAllUserListData('UserJoined', item)
+ break;
+ // 用户退出频道回调
+ case 'UserLeave':
+ this.setAllUserListData('UserLeave', item)
+ break;
+ // 所有用户开闭麦
+ case 'OperAllMicr':
+ this.setAllUserListData('OperAllMicr', item)
+ break;
+ // 用户关闭开启麦克风
+ case 'OperMicr':
+ if (item.operUid !== userInfo.uid) {
+ if (item.user.uid === userInfo.uid) {
+ this.message(item.user.enableMicr ? '管理员已取消你的静音' : '你已被管理员静音').success()
+ }
+ }
+ this.setAllUserListData('OperMicr', item)
+ break;
+ // 用户开启关闭摄像头
+ case 'OperCamera':
+ if (item.operUid !== userInfo.uid) {
+ if (item.user.uid === userInfo.uid) {
+ this.message(item.user.enableCamera ? '管理员已开启你的摄像头' : '管理员已关闭你摄像头').success()
+ }
+ }
+ this.setAllUserListData('OperCamera', item)
+ break;
+ // 发言人用户信息刷新
+ case 'ManagerRefresh':
+ this.setAllUserListData('ManagerRefresh', item, async () => {
+ if (item.user.uid === item.uid) {
+ if (item.user.uid === userInfo.uid) {
+ // await agora.allLeaveChannelEx()
+ this.message(`操作成功`).success()
+ await agora.setRole(item.user.isRoomManager, (url: string) => {
+ const roomUserListTemp = [...this.data.roomUserList]
+ const itemUser = roomUserListTemp.find(row => row.uid == userInfo.uid)
+ itemUser.src = url
+ this.setData({
+ roomUserList: roomUserListTemp,
+ })
+ })
+ await this.postOpenMicrApi(item.user.isRoomManager, userInfo.uid, false)
+ await this.postOpenCameraApi(false, userInfo.uid) // 不管身份如何改变都关闭摄像头
+ } else {
+ this.message(`${item.user.userName}已结束发言`).success()
+ }
+ } else {
+ if (item.user.uid === userInfo.uid) {
+ if (item.user.isRoomManager) {
+ // await agora.allLeaveChannelEx()
+ }
+ this.message(`管理员${item.user.isRoomManager ? '设置' : '取消'}您为发言人`).success()
+ await agora.setRole(item.user.isRoomManager, (url: string) => {
+ const roomUserListTemp = [...this.data.roomUserList]
+ const itemUser = roomUserListTemp.find(row => row.uid == userInfo.uid)
+ itemUser.src = url
+ this.setData({
+ roomUserList: roomUserListTemp,
+ })
+ })
+ if (this.data.currentRequestSpeakType === 'video') {
+ await this.postOpenCameraApi(item.user.isRoomManager, userInfo.uid)
+ } else if (this.data.currentRequestSpeakType === 'audio') {
+ await this.postOpenMicrApi(item.user.isRoomManager, userInfo.uid, false)
+ } else {
+ await this.postOpenMicrApi(item.user.isRoomManager, userInfo.uid, false)
+ await this.postOpenCameraApi(false, userInfo.uid)
+ }
+ } else {
+ this.message(`管理员${item.user.isRoomManager ? '设置' : '取消'}${item.user.userName}为发言人`).success()
+ }
+ }
+ })
+ break;
+ // 申请发言
+ case 'ApplyToSpeak':
+
+ break;
+ // 管理员查看随机用户
+ case 'Watch':
+ if (!role.ID.includes(userInfo.roleId)) {
+ let userId = item.watchUids.find((uid: any) => uid === userInfo.uid)
+ if (userId) {
+ // await agora.allJoinChannelEx()
+ } else {
+ // await agora.allLeaveChannelEx()
+ }
+ }
+ break;
+ // 设备列表
+ case 'DriverList':
+
+ break;
+ // 设置设备
+ case 'SaveDriver':
+
+ break;
+ // 显示设备列表
+ case 'ShowDriverList':
+
+ break;
+ }
+ })
+ },
+ startClientEvent() {
+ agora.clientEvent({
+ streamAdded: async (url: string, uid: number | string) => {
+ const roomUserListTemp = [...this.data.roomUserList]
+ const item = roomUserListTemp.find(row => row.uid == uid || row.screenShareId == uid)
+ if (item) {
+ if (String(uid).length === 9) {
+ item.shareSrc = url
+ } else {
+ item.src = url
+ }
+ }
+ this.setData({
+ roomUserList: roomUserListTemp,
+ currentUser: item,
+ })
+ },
+ streamRemoved: (uid) => {
+ const roomUserListTemp = [...this.data.roomUserList]
+ uid.forEach(id => {
+ if (String(id).length === 9) {
+ const item = roomUserListTemp.find(row => row.uid == id || row.screenShareId == id)
+ item.shareSrc = ''
+ this.setData({
+ roomUserList: roomUserListTemp,
+ currentUser: item,
+ })
+ }
+ });
+ }
+ })
+ },
+ async getRoomUser(): Promise {
+ await GetRoomUser(this.data.channelId).then(res => {
+ if (res.code === 200) {
+ res.data.forEach((item) => {
+ item.isRoom = true;
+ item.isAdmin = role.ID.includes(item.roleId) || item.isRoomManager
+ item.avatarName = item.userName?.slice(-2)
+ })
+ this.setData({
+ roomUserList: res.data
+ })
+ }
+ })
+ },
+ async getShowUser(): Promise {
+ await GetShowUser(this.data.channelId).then(async (res) => {
+ if (res.code === 200 && res.data) {
+ const currentUser = this.data.roomUserList.find(row => row.uid == res.data || row.screenShareId == res.data)
+ this.setData({
+ currentUid: res.data,
+ currentUser,
+ })
+ }
+ })
+ },
+ async getRoomInfo(): Promise {
+ await GetRoomInfo(this.data.channelId).then(async (res) => {
+ if (res.code === 200) {
+ this.setData({
+ roomInfo: res.data,
+ })
+ }
+ })
+ },
+ async joinChannel(): Promise {
+ await onInvoke('joinChannel', {
+ roomNum: this.data.channelId,
+ enableMicr: this.data.footerList[1].active,
+ enableCamera: this.data.footerList[2].active,
+ })
+ await agora.joinChannel()
+ },
+ async setAllUserListData(key: string, item: any, callBack?: Function): Promise {
+ const { roomUserList } = this.data;
+ const userInfo: any = await getStorage('user')
+ switch (key) {
+ case 'OperMicr':
+ case 'OperCamera':
+ case 'ManagerRefresh':
+ let userItem = roomUserList.find((row: any) => row.uid === item.user.uid)
+ if (userItem) {
+ for (const keys in item.user) {
+ if (keys !== 'enableCamera' && keys !== 'enableMicr') {
+ userItem[keys] = item.user[keys];
+ }
+ }
+ if (key === 'OperCamera') {
+ userItem.enableCamera = item.user.enableCamera;
+ if (userItem.uid === userInfo.uid) {
+ // userItem.enableCamera ? agora.startCameraCapture() : agora.stopCameraCapture()
+ }
+ }
+ if (key === 'OperMicr') {
+ userItem.enableMicr = item.user.enableMicr;
+ }
+ userItem.isAdmin = role.ID.includes(item.user.roleId) || item.user.isRoomManager;
+ this.setData({
+ roomUserList
+ })
+ }
+ if (key === 'ManagerRefresh') {
+ callBack && callBack()
+ }
+ break;
+ case 'UserJoined':
+ let userJoinedItem = roomUserList.find((row: any) => row.uid === item.user.uid)
+ if (userJoinedItem) {
+ for (const key in item.user) {
+ userJoinedItem[key] = item.user[key];
+ }
+ userJoinedItem.isRoom = true;
+ userJoinedItem.isAdmin = role.ID.includes(item.user.roleId) || item.user.isRoomManager;
+ this.setData({
+ roomUserList
+ })
+ } else {
+ item.user.isRoom = true;
+ item.user.isAdmin = role.ID.includes(item.user.roleId) || item.user.isRoomManager;
+ item.user.avatarName = item.user.userName?.slice(-2)
+ this.setData({
+ roomUserList: [...roomUserList, item.user]
+ })
+ }
+ break;
+ case 'UserLeave':
+ let userLeaveItem = roomUserList.find((row: any) => row.uid === item.uid)
+ if (userLeaveItem) {
+ userLeaveItem.isRoom = false
+ userLeaveItem.isAdmin = false
+ this.setData({
+ roomUserList
+ })
+ }
+ break;
+ case 'OperAllMicr':
+ roomUserList.forEach((row: any) => {
+ if (row.uid !== item.uid) {
+ row.enableMicr = item.enableMicr
+ }
+ })
+ this.setData({
+ roomUserList
+ })
+ break;
+ }
+ this.setData({
+ currentUser: roomUserList.find(row => row.uid == this.data.currentUid || row.screenShareId == this.data.currentUid)
+ })
+ this.changeAgoraDevice()
+ },
+ async changeFooterList(e): Promise {
+ const userInfo: any = await getStorage('user')
+ const { index } = e.currentTarget.dataset;
+ const { footerList } = this.data;
+ const footerListTemplate = [...footerList]
+ const item = footerListTemplate[index];
+ let title = item.active ? item.title : item.titleActive;
+ switch (title) {
+ case '关闭听筒':
+ case '开启听筒':
+ item.active = !item.active
+ this.setData({
+ muted: !this.data.muted,
+ footerList: footerListTemplate
+ })
+ break;
+ case '解除静音':
+ case '静音':
+ if (item.active) {
+ // 静音
+ await this.postOpenMicrApi(false, userInfo.uid, false, true)
+ } else {
+ // 解除静音
+ await this.getUserRoomInfo().then(async (res) => {
+ if (res) {
+ await this.postOpenMicrApi(true, userInfo.uid, false, true)
+ } else {
+ if (!this.data.isClicked) {
+ this.setData({
+ applySpeakDialog: true,
+ currentRequestSpeakType: 'audio'
+ })
+ } else {
+ this.message('申请太频繁了,请稍后重试!').error();
+ }
+ }
+ })
+ }
+ break;
+ case '关闭视频':
+ case '打开视频':
+ if (item.active) {
+ // 关闭视频
+ await this.postOpenCameraApi(false, userInfo.uid, true)
+ } else {
+ // 打开视频
+ await this.getUserRoomInfo().then(async (res) => {
+ if (res) {
+ await this.postOpenCameraApi(true, userInfo.uid, true)
+ } else {
+ if (!this.data.isClicked) {
+ this.setData({
+ applySpeakDialog: true,
+ currentRequestSpeakType: 'video'
+ })
+ } else {
+ this.message('申请太频繁了,请稍后重试!').error();
+ }
+ }
+ })
+ }
+ break;
+ case '申请发言':
+ case '结束发言':
+ if (item.active) {
+ // 申请发言
+ if (!this.data.isClicked) {
+ this.setData({
+ applySpeakDialog: true,
+ currentRequestSpeakType: ''
+ })
+ } else {
+ this.message('申请太频繁了,请稍后重试!').error();
+ }
+ } else {
+ // 结束发言
+ DeleteRoomManager({
+ roomId: this.data.roomInfo.id,
+ roomNum: this.data.channelId,
+ userId: userInfo.uid
+ })
+ }
+ break;
+ case '翻转':
+ await this.getUserRoomInfo().then(async (res) => {
+ if (res) {
+ this.setData({
+ devicePosition: !this.data.devicePosition
+ })
+ wx.createLivePusherContext().switchCamera()
+ } else {
+ this.message('暂无权限').error();
+ }
+ })
+ break;
+ case '聊天':
+ this.setData({
+ chatPopupVisible: true,
+ noViewChatList: 0
+ })
+ break;
+ case '成员':
+ this.setData({
+ userPopupVisible: true
+ })
+ break;
+ }
+ },
+ async postOpenMicrApi(enableMicr: boolean, uid: string, isAll: boolean, isMessage: boolean = false): Promise {
+ if (isAll) {
+ await PostMuteAll({
+ roomNum: this.data.channelId,
+ enableMicr
+ })
+ } else {
+ await PostOpenMicr({
+ roomNum: this.data.channelId,
+ uid,
+ enableMicr
+ })
+ }
+ if (isMessage) {
+ this.message('操作成功').success()
+ }
+ },
+ async postOpenCameraApi(enableCamera: boolean, uid: string, isMessage: boolean = false): Promise {
+ if (enableCamera) {
+ // await agora.startCameraCapture()
+ } else {
+ // await agora.stopCameraCapture();
+ }
+ await PostOpenCamera({
+ roomNum: this.data.channelId,
+ uid,
+ enableCamera
+ })
+ if (isMessage) {
+ this.message('操作成功').success()
+ }
+ },
+ closeDialog(e) {
+ const { type } = e.currentTarget.dataset;
+ switch (e.type) {
+ case "confirm":
+ switch (type) {
+ case "applySpeakDialog":
+ GetApplySpeak(this.data.channelId).then(res => {
+ if (res.code === 200) {
+ this.setData({
+ isClicked: true,
+ [type]: false,
+ })
+ this.message('申请发言成功').success()
+ }
+ })
+ break;
+ }
+ break;
+ case "cancel":
+ this.setData({
+ [type]: false
+ })
+ break;
+ }
+ },
+ playerStateChange(e) {
+ // console.log(e);
+ },
+ recorderStateChange(e) {
+ // console.log(e);
+ },
+ clickChangeVideo(e) {
+ const { item } = e.currentTarget.dataset;
+ this.setData({
+ currentUser: item,
+ currentUid: item.uid
+ })
+ },
+ message(content: string) {
+ return {
+ success: () => {
+ Message.success({
+ context: this,
+ offset: [20, 32],
+ duration: 2000,
+ content,
+ });
+ },
+ error: () => {
+ Message.error({
+ context: this,
+ offset: [20, 32],
+ duration: 2000,
+ content,
+ });
+ }
+ }
+ },
+ async getUserRoomInfo(): Promise {
+ const userInfo: any = await getStorage('user')
+ return new Promise((resolve, _reject) => {
+ let userItem = this.data.roomUserList.find((item: any) => item.uid === userInfo.uid)
+ if (userItem && (role.ID.includes(userItem.roleId) || userItem.isRoomManager)) {
+ resolve(userItem)
+ } else {
+ resolve('')
+ }
+ })
+ },
+ async changeAgoraDevice(): Promise {
+ const userInfo: any = await getStorage('user')
+ this.data.roomUserList.forEach(async (item: any) => {
+ if (item.uid == userInfo.uid) {
+ const footerListTemplate = [...this.data.footerList]
+ footerListTemplate[1].active = item.enableMicr
+ footerListTemplate[2].active = item.enableCamera
+ item.enableMicr ? await agora.unmuteLocal('audio') : await agora.muteLocal('audio')
+ item.enableCamera ? await agora.unmuteLocal('video') : await agora.muteLocal('video')
+ if (!role.ID.includes(userInfo.roleId)) {
+ footerListTemplate[6].active = !item.isRoomManager;
+ }
+ this.setData({
+ footerList: footerListTemplate
+ })
+ }
+ });
+ },
+ back() {
+ wx.navigateBack()
+ },
+ onVisibleChange() {
+ this.setData({
+ userPopupVisible: false,
+ chatPopupVisible: false,
+ })
+ },
+ changeMessageStr(e) {
+ this.setData({
+ messageStr: e.detail.value
+ })
+ },
+ async sendMeg() {
+ await onInvoke('sendChannelMsg', {
+ roomNum: this.data.channelId,
+ msg: this.data.messageStr
+ })
+ this.setData({
+ chatList: [...this.data.chatList, {
+ userName: this.data.user.userName,
+ message: this.data.messageStr,
+ me: true
+ }],
+ messageStr: ''
+ })
+ }
+})
\ No newline at end of file
diff --git a/pages/meeting/index.wxml b/pages/meeting/index.wxml
new file mode 100644
index 0000000..38c1925
--- /dev/null
+++ b/pages/meeting/index.wxml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+ {{currentUser.avatarName}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{currentUser.userName}}
+
+
+
+
+
+
+ {{item.avatarName}}
+
+
+
+
+
+
+
+
+
+
+ {{item.userName}}
+
+
+ 屏幕分享中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/message/base/index.js b/pages/message/base/index.js
deleted file mode 100644
index 28168f4..0000000
--- a/pages/message/base/index.js
+++ /dev/null
@@ -1,62 +0,0 @@
-import Message from 'tdesign-miniprogram/message/index';
-
-Component({
- methods: {
- showTextMessage() {
- Message.info({
- context: this,
- offset: [20, 32],
- duration: 5000,
- icon: false,
- content: '这是一条纯文字的消息通知 5s消失',
- });
- },
-
- showIconMessage() {
- Message.info({
- context: this,
- offset: ['20rpx', '32rpx'],
- duration: 5000,
- content: '这是一条带图标的消息通知 5s消失',
- });
- },
-
- showCloseMessage() {
- Message.info({
- context: this,
- offset: ['20rpx', 32],
- content: '这是一条带关闭的消息通知',
- duration: -1,
- action: '按钮',
- closeBtn: true,
- });
- },
-
- showScrollMessage() {
- Message.info({
- context: this,
- offset: [20, 32],
- marquee: { speed: 50, loop: -1, delay: 5000 },
- icon: false,
- content: '这是一条滚动的通知信息',
- duration: -1,
- });
- },
-
- showBtnMessage() {
- Message.info({
- context: this,
- offset: [20, 32],
- icon: 'notification-filled',
- content: '这是一条带操作的消息通知',
- duration: -1,
- link: {
- content: '链接',
- navigatorProps: {
- url: '/page/xxx/xxx',
- },
- },
- });
- },
- },
-});
diff --git a/pages/message/base/index.json b/pages/message/base/index.json
deleted file mode 100644
index 6edd815..0000000
--- a/pages/message/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-message": "tdesign-miniprogram/message/message"
- }
-}
diff --git a/pages/message/base/index.wxml b/pages/message/base/index.wxml
deleted file mode 100644
index ab71bac..0000000
--- a/pages/message/base/index.wxml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
- 纯文字的通知
-
- 带图标的通知
-
- 带关闭的通知
-
- 可滚动多通知
-
- 带按钮的通知
-
diff --git a/pages/message/base/index.wxss b/pages/message/base/index.wxss
deleted file mode 100644
index b951596..0000000
--- a/pages/message/base/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.message-example {
- margin: 32rpx;
-}
-
-.external-class {
- margin: 0 0 32rpx 0;
-}
diff --git a/pages/message/message.d.ts b/pages/message/message.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/message/message.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/message/message.js b/pages/message/message.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/message/message.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/message/message.json b/pages/message/message.json
deleted file mode 100644
index de3a6c4..0000000
--- a/pages/message/message.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "navigationBarTitleText": "Message",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "base": "./base",
- "theme": "./theme"
- }
-}
diff --git a/pages/message/message.wxml b/pages/message/message.wxml
deleted file mode 100644
index 0e22c58..0000000
--- a/pages/message/message.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
- Message 消息通知
- 用于轻量级反馈或提示,不会打断用户操作。
-
-
-
-
-
-
-
diff --git a/pages/message/message.wxss b/pages/message/message.wxss
deleted file mode 100644
index d396855..0000000
--- a/pages/message/message.wxss
+++ /dev/null
@@ -1,6 +0,0 @@
-page {
- background: #fff;
-}
-.demo-block__oper {
- padding: 0 32rpx;
-}
diff --git a/pages/message/theme/index.js b/pages/message/theme/index.js
deleted file mode 100644
index cc74981..0000000
--- a/pages/message/theme/index.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import Message from 'tdesign-miniprogram/message/index';
-
-Component({
- methods: {
- showInfoMessage() {
- Message.info({
- context: this,
- offset: [20, 32],
- duration: 5000,
- content: '这是一条普通通知信息',
- });
- },
-
- showWarnMessage() {
- Message.warning({
- context: this,
- offset: [20, 32],
- duration: 5000,
- content: '这是一条需要用户关注到的警示通知',
- });
- },
-
- showSuccessMessage() {
- Message.success({
- context: this,
- offset: [20, 32],
- duration: 5000,
- content: '这是一条成功的提示消息',
- });
- },
-
- showErrorMessage() {
- Message.error({
- context: this,
- offset: [20, 32],
- duration: 5000,
- content: '这是一条错误提示通知',
- });
- },
- },
-});
diff --git a/pages/message/theme/index.json b/pages/message/theme/index.json
deleted file mode 100644
index 6edd815..0000000
--- a/pages/message/theme/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-message": "tdesign-miniprogram/message/message"
- }
-}
diff --git a/pages/message/theme/index.wxml b/pages/message/theme/index.wxml
deleted file mode 100644
index b7c5944..0000000
--- a/pages/message/theme/index.wxml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
- 普通通知
-
- 成功通知
-
- 警示通知
-
- 错误通知
-
diff --git a/pages/message/theme/index.wxss b/pages/message/theme/index.wxss
deleted file mode 100644
index b951596..0000000
--- a/pages/message/theme/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.message-example {
- margin: 32rpx;
-}
-
-.external-class {
- margin: 0 0 32rpx 0;
-}
diff --git a/pages/navbar/back-home/index.js b/pages/navbar/back-home/index.js
deleted file mode 100644
index c5bac4f..0000000
--- a/pages/navbar/back-home/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-Component({
- methods: {
- onBack() {
- wx.navigateBack();
- },
- onGoHome() {
- wx.reLaunch({
- url: '/pages/home/home',
- });
- },
- },
-});
diff --git a/pages/navbar/back-home/index.json b/pages/navbar/back-home/index.json
deleted file mode 100644
index 7566be0..0000000
--- a/pages/navbar/back-home/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-navbar": "tdesign-miniprogram/navbar/navbar",
- "t-icon": "tdesign-miniprogram/icon/icon"
- }
-}
diff --git a/pages/navbar/back-home/index.wxml b/pages/navbar/back-home/index.wxml
deleted file mode 100644
index 4d52c70..0000000
--- a/pages/navbar/back-home/index.wxml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
diff --git a/pages/navbar/back-home/index.wxss b/pages/navbar/back-home/index.wxss
deleted file mode 100644
index 78c64df..0000000
--- a/pages/navbar/back-home/index.wxss
+++ /dev/null
@@ -1,23 +0,0 @@
-.custom-capsule {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.custom-capsule__icon {
- flex: 1;
- position: relative;
-}
-
-.custom-capsule__icon + .custom-capsule__icon:before {
- content: '';
- display: block;
- position: absolute;
- left: -1px;
- top: 50%;
- transform: translateY(-50%);
- width: 1px;
- height: 36rpx;
- background: #e7e7e7;
-}
\ No newline at end of file
diff --git a/pages/navbar/base/index.js b/pages/navbar/base/index.js
deleted file mode 100644
index e5540ef..0000000
--- a/pages/navbar/base/index.js
+++ /dev/null
@@ -1,10 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
- methods: {
- handleBack() {
- console.log('go back');
- },
- },
-});
diff --git a/pages/navbar/base/index.json b/pages/navbar/base/index.json
deleted file mode 100644
index 857cc20..0000000
--- a/pages/navbar/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-navbar": "tdesign-miniprogram/navbar/navbar"
- }
-}
diff --git a/pages/navbar/base/index.wxml b/pages/navbar/base/index.wxml
deleted file mode 100644
index bfa02c4..0000000
--- a/pages/navbar/base/index.wxml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/pages/navbar/base/index.wxss b/pages/navbar/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/navbar/custom-color/index.js b/pages/navbar/custom-color/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/navbar/custom-color/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/navbar/custom-color/index.json b/pages/navbar/custom-color/index.json
deleted file mode 100644
index 857cc20..0000000
--- a/pages/navbar/custom-color/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-navbar": "tdesign-miniprogram/navbar/navbar"
- }
-}
diff --git a/pages/navbar/custom-color/index.wxml b/pages/navbar/custom-color/index.wxml
deleted file mode 100644
index 88b6833..0000000
--- a/pages/navbar/custom-color/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/navbar/custom-color/index.wxss b/pages/navbar/custom-color/index.wxss
deleted file mode 100644
index 0b66212..0000000
--- a/pages/navbar/custom-color/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.custom-navbar {
- --td-navbar-color: #fff;
- --td-navbar-bg-color: #0052d9;
-}
\ No newline at end of file
diff --git a/pages/navbar/img/index.js b/pages/navbar/img/index.js
deleted file mode 100644
index 2a72331..0000000
--- a/pages/navbar/img/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- image: 'https://tdesign.gtimg.com/miniprogram/images/logo1.png',
- },
-});
diff --git a/pages/navbar/img/index.json b/pages/navbar/img/index.json
deleted file mode 100644
index 610da8c..0000000
--- a/pages/navbar/img/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-navbar": "tdesign-miniprogram/navbar/navbar",
- "t-image": "tdesign-miniprogram/image/image"
- }
-}
diff --git a/pages/navbar/img/index.wxml b/pages/navbar/img/index.wxml
deleted file mode 100644
index 76e44ec..0000000
--- a/pages/navbar/img/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/navbar/img/index.wxss b/pages/navbar/img/index.wxss
deleted file mode 100644
index 3294750..0000000
--- a/pages/navbar/img/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.custom-image {
- height: 48rpx;
- width: 204rpx;
-}
diff --git a/pages/navbar/left-title/index.js b/pages/navbar/left-title/index.js
deleted file mode 100644
index 2dc2188..0000000
--- a/pages/navbar/left-title/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
-});
diff --git a/pages/navbar/left-title/index.json b/pages/navbar/left-title/index.json
deleted file mode 100644
index 857cc20..0000000
--- a/pages/navbar/left-title/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-navbar": "tdesign-miniprogram/navbar/navbar"
- }
-}
diff --git a/pages/navbar/left-title/index.wxml b/pages/navbar/left-title/index.wxml
deleted file mode 100644
index 05c572d..0000000
--- a/pages/navbar/left-title/index.wxml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
- 标题左对齐
-
-
-标题尺寸
-
-
- 返回
-
-
diff --git a/pages/navbar/left-title/index.wxss b/pages/navbar/left-title/index.wxss
deleted file mode 100644
index 0de67ba..0000000
--- a/pages/navbar/left-title/index.wxss
+++ /dev/null
@@ -1,30 +0,0 @@
-.custom-title {
- margin-left: 16rpx;
- font-size: 36rpx;
- font-weight: 600;
-}
-
-.block {
- display: block;
- margin-bottom: 48rpx;
-}
-
-.demo-desc {
- margin-top: 48rpx;
- margin-bottom: 32rpx;
-}
-
-.left-text {
- display: block;
- margin-left: 8rpx;
- font-size: 16px;
-}
-
-.header-title {
- font-size: 28px;
- line-height: 36px;
- padding: 8rpx 32rpx 16rpx;
- background-color: #fff;
- font-weight: 600;
- color: rgba(0, 0, 0 .9);
-}
\ No newline at end of file
diff --git a/pages/navbar/navbar.d.ts b/pages/navbar/navbar.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/navbar/navbar.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/navbar/navbar.js b/pages/navbar/navbar.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/navbar/navbar.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/navbar/navbar.json b/pages/navbar/navbar.json
deleted file mode 100644
index 991873b..0000000
--- a/pages/navbar/navbar.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "navigationBarTitleText": "NavBar",
- "usingComponents": {
- "base": "./base",
- "search": "./search",
- "back-home": "./back-home",
- "img": "./img",
- "left-title": "./left-title",
- "custom-color": "./custom-color"
- }
-}
diff --git a/pages/navbar/navbar.wxml b/pages/navbar/navbar.wxml
deleted file mode 100644
index 9a2f57e..0000000
--- a/pages/navbar/navbar.wxml
+++ /dev/null
@@ -1,20 +0,0 @@
-
- NavBar 导航栏
- 用于不同页面之间切换或者跳转,位于内容区的上方,系统状态栏的下方。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/navbar/navbar.wxss b/pages/navbar/navbar.wxss
deleted file mode 100644
index c3edc25..0000000
--- a/pages/navbar/navbar.wxss
+++ /dev/null
@@ -1,13 +0,0 @@
-.t-navbar--fixed .t-navbar__content {
- position: relative !important;
- padding-top: 0;
-}
-.t-navbar__placeholder {
- display: none !important;
-}
-.block {
- display: block;
-}
-.block + .block {
- margin-top: 48rpx;
-}
diff --git a/pages/navbar/search/index.js b/pages/navbar/search/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/navbar/search/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/navbar/search/index.json b/pages/navbar/search/index.json
deleted file mode 100644
index b885123..0000000
--- a/pages/navbar/search/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-navbar": "tdesign-miniprogram/navbar/navbar",
- "t-search": "tdesign-miniprogram/search/search"
- }
-}
diff --git a/pages/navbar/search/index.wxml b/pages/navbar/search/index.wxml
deleted file mode 100644
index e134d19..0000000
--- a/pages/navbar/search/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/navbar/search/index.wxss b/pages/navbar/search/index.wxss
deleted file mode 100644
index d199fd5..0000000
--- a/pages/navbar/search/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.search-box {
- --td-search-height: 64rpx;
- width: 252px;
-}
diff --git a/pages/notice-bar/base/index.js b/pages/notice-bar/base/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/notice-bar/base/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/notice-bar/base/index.json b/pages/notice-bar/base/index.json
deleted file mode 100644
index 11b8f9c..0000000
--- a/pages/notice-bar/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-notice-bar": "tdesign-miniprogram/notice-bar/notice-bar"
- }
-}
diff --git a/pages/notice-bar/base/index.wxml b/pages/notice-bar/base/index.wxml
deleted file mode 100644
index f51c25f..0000000
--- a/pages/notice-bar/base/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/notice-bar/base/index.wxss b/pages/notice-bar/base/index.wxss
deleted file mode 100644
index 8b13789..0000000
--- a/pages/notice-bar/base/index.wxss
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/notice-bar/custom/index.js b/pages/notice-bar/custom/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/notice-bar/custom/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/notice-bar/custom/index.json b/pages/notice-bar/custom/index.json
deleted file mode 100644
index 11b8f9c..0000000
--- a/pages/notice-bar/custom/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-notice-bar": "tdesign-miniprogram/notice-bar/notice-bar"
- }
-}
diff --git a/pages/notice-bar/custom/index.wxml b/pages/notice-bar/custom/index.wxml
deleted file mode 100644
index 3273fdc..0000000
--- a/pages/notice-bar/custom/index.wxml
+++ /dev/null
@@ -1,8 +0,0 @@
-
diff --git a/pages/notice-bar/custom/index.wxss b/pages/notice-bar/custom/index.wxss
deleted file mode 100644
index 5710cfe..0000000
--- a/pages/notice-bar/custom/index.wxss
+++ /dev/null
@@ -1,8 +0,0 @@
-.external-class {
- opacity: 1 !important;
- background: rgba(243, 243, 243, 1) !important;
-}
-
-.external-class-prefix-icon {
- color: rgba(0, 0, 0, 0.9) !important;
-}
diff --git a/pages/notice-bar/customization/index.js b/pages/notice-bar/customization/index.js
deleted file mode 100644
index 19c3b8c..0000000
--- a/pages/notice-bar/customization/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Component({
- data: {
- navigatorProps: {
- url: '/pages/xxx/xxx',
- },
- },
-});
diff --git a/pages/notice-bar/customization/index.json b/pages/notice-bar/customization/index.json
deleted file mode 100644
index 0c9127d..0000000
--- a/pages/notice-bar/customization/index.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-notice-bar": "tdesign-miniprogram/notice-bar/notice-bar",
- "t-link": "tdesign-miniprogram/link/link",
- "t-icon": "tdesign-miniprogram/icon/icon"
- }
-}
diff --git a/pages/notice-bar/customization/index.wxml b/pages/notice-bar/customization/index.wxml
deleted file mode 100644
index 16f66bd..0000000
--- a/pages/notice-bar/customization/index.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- 提示文字描述提示文字描述提示文字描述提示文字描述提示文字描述提示文字描述
-
-
-
diff --git a/pages/notice-bar/customization/index.wxss b/pages/notice-bar/customization/index.wxss
deleted file mode 100644
index 282a765..0000000
--- a/pages/notice-bar/customization/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.inline {
- display: inline;
-}
diff --git a/pages/notice-bar/event/index.js b/pages/notice-bar/event/index.js
deleted file mode 100644
index d33868b..0000000
--- a/pages/notice-bar/event/index.js
+++ /dev/null
@@ -1,15 +0,0 @@
-Component({
- data: {
- visible: true,
- navigatorProps: {
- url: '/pages/xxx/xxx',
- },
- },
-
- methods: {
- click(e) {
- const { trigger } = e.detail;
- console.log(`click on the ${trigger} area`);
- },
- },
-});
diff --git a/pages/notice-bar/event/index.json b/pages/notice-bar/event/index.json
deleted file mode 100644
index b6c4b35..0000000
--- a/pages/notice-bar/event/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-notice-bar": "tdesign-miniprogram/notice-bar/notice-bar",
- "t-link": "tdesign-miniprogram/link/link"
- }
-}
diff --git a/pages/notice-bar/event/index.wxml b/pages/notice-bar/event/index.wxml
deleted file mode 100644
index 5c137df..0000000
--- a/pages/notice-bar/event/index.wxml
+++ /dev/null
@@ -1,11 +0,0 @@
-
- 这是一条普通的通知信息
-
-
-
-
diff --git a/pages/notice-bar/event/index.wxss b/pages/notice-bar/event/index.wxss
deleted file mode 100644
index 282a765..0000000
--- a/pages/notice-bar/event/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.inline {
- display: inline;
-}
diff --git a/pages/notice-bar/iconDemo/index.js b/pages/notice-bar/iconDemo/index.js
deleted file mode 100644
index 8a3cef2..0000000
--- a/pages/notice-bar/iconDemo/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- visible: true,
- },
-});
diff --git a/pages/notice-bar/iconDemo/index.json b/pages/notice-bar/iconDemo/index.json
deleted file mode 100644
index 7d3314c..0000000
--- a/pages/notice-bar/iconDemo/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-notice-bar": "tdesign-miniprogram/notice-bar/notice-bar",
- "t-icon": "tdesign-miniprogram/icon/icon"
- }
-}
diff --git a/pages/notice-bar/iconDemo/index.wxml b/pages/notice-bar/iconDemo/index.wxml
deleted file mode 100644
index 8087adf..0000000
--- a/pages/notice-bar/iconDemo/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/notice-bar/iconDemo/index.wxss b/pages/notice-bar/iconDemo/index.wxss
deleted file mode 100644
index 8b13789..0000000
--- a/pages/notice-bar/iconDemo/index.wxss
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/notice-bar/notice-bar.d.ts b/pages/notice-bar/notice-bar.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/notice-bar/notice-bar.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/notice-bar/notice-bar.js b/pages/notice-bar/notice-bar.js
deleted file mode 100644
index 308afe2..0000000
--- a/pages/notice-bar/notice-bar.js
+++ /dev/null
@@ -1,4 +0,0 @@
-Page({
- onReady() {
- },
-});
diff --git a/pages/notice-bar/notice-bar.json b/pages/notice-bar/notice-bar.json
deleted file mode 100644
index 49238f2..0000000
--- a/pages/notice-bar/notice-bar.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "navigationBarTitleText": "NoticeBar",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "t-notice-bar": "tdesign-miniprogram/notice-bar/notice-bar",
- "base": "./base",
- "iconDemo": "./iconDemo",
- "suffixIcon": "./suffixIcon",
- "event": "./event",
- "custom": "./custom",
- "theme": "./theme",
- "scrolling": "./scrolling",
- "customization": "./customization"
- }
-}
diff --git a/pages/notice-bar/notice-bar.wxml b/pages/notice-bar/notice-bar.wxml
deleted file mode 100644
index 025cfe1..0000000
--- a/pages/notice-bar/notice-bar.wxml
+++ /dev/null
@@ -1,30 +0,0 @@
-
- NoticeBar 公告栏
- 在导航栏下方,用于给用户显示提示消息。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/notice-bar/notice-bar.wxss b/pages/notice-bar/notice-bar.wxss
deleted file mode 100644
index 0513823..0000000
--- a/pages/notice-bar/notice-bar.wxss
+++ /dev/null
@@ -1,6 +0,0 @@
-page {
- background-color: #fff;
-}
-.t-notice-bar {
- margin-bottom: 32rpx;
-}
diff --git a/pages/notice-bar/scrolling/index.js b/pages/notice-bar/scrolling/index.js
deleted file mode 100644
index a0a1ae4..0000000
--- a/pages/notice-bar/scrolling/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-Component({
- data: {
- visible: true,
- marquee1: {
- speed: 80,
- loop: -1,
- delay: 0,
- },
- marquee2: {
- speed: 60,
- loop: -1,
- delay: 0,
- },
- content: ['君不见', '高堂明镜悲白发', '朝如青丝暮成雪', '人生得意须尽欢', '莫使金樽空对月'],
- },
-});
diff --git a/pages/notice-bar/scrolling/index.json b/pages/notice-bar/scrolling/index.json
deleted file mode 100644
index 11b8f9c..0000000
--- a/pages/notice-bar/scrolling/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-notice-bar": "tdesign-miniprogram/notice-bar/notice-bar"
- }
-}
diff --git a/pages/notice-bar/scrolling/index.wxml b/pages/notice-bar/scrolling/index.wxml
deleted file mode 100644
index 8a877cc..0000000
--- a/pages/notice-bar/scrolling/index.wxml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
diff --git a/pages/notice-bar/scrolling/index.wxss b/pages/notice-bar/scrolling/index.wxss
deleted file mode 100644
index 8b13789..0000000
--- a/pages/notice-bar/scrolling/index.wxss
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/notice-bar/suffixIcon/index.js b/pages/notice-bar/suffixIcon/index.js
deleted file mode 100644
index 32c296c..0000000
--- a/pages/notice-bar/suffixIcon/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-Component({
- data: {
- visible: true,
- },
-
- methods: {
- click(e) {
- const { trigger } = e.detail;
- console.log(`click on the ${trigger} area`);
- },
- },
-});
diff --git a/pages/notice-bar/suffixIcon/index.json b/pages/notice-bar/suffixIcon/index.json
deleted file mode 100644
index 11b8f9c..0000000
--- a/pages/notice-bar/suffixIcon/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-notice-bar": "tdesign-miniprogram/notice-bar/notice-bar"
- }
-}
diff --git a/pages/notice-bar/suffixIcon/index.wxml b/pages/notice-bar/suffixIcon/index.wxml
deleted file mode 100644
index 7612dd4..0000000
--- a/pages/notice-bar/suffixIcon/index.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
diff --git a/pages/notice-bar/suffixIcon/index.wxss b/pages/notice-bar/suffixIcon/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/notice-bar/theme/index.js b/pages/notice-bar/theme/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/notice-bar/theme/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/notice-bar/theme/index.json b/pages/notice-bar/theme/index.json
deleted file mode 100644
index 11b8f9c..0000000
--- a/pages/notice-bar/theme/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-notice-bar": "tdesign-miniprogram/notice-bar/notice-bar"
- }
-}
diff --git a/pages/notice-bar/theme/index.wxml b/pages/notice-bar/theme/index.wxml
deleted file mode 100644
index 0b8c0f7..0000000
--- a/pages/notice-bar/theme/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/pages/notice-bar/theme/index.wxss b/pages/notice-bar/theme/index.wxss
deleted file mode 100644
index 8b13789..0000000
--- a/pages/notice-bar/theme/index.wxss
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/overlay/base/index.js b/pages/overlay/base/index.js
deleted file mode 100644
index a9dbede..0000000
--- a/pages/overlay/base/index.js
+++ /dev/null
@@ -1,15 +0,0 @@
-Component({
- data: {
- visible: false,
- },
- methods: {
- handleClick() {
- this.setData({ visible: true });
- },
- handleOverlayClick(e) {
- this.setData({
- visible: e.detail.visible,
- });
- },
- },
-});
diff --git a/pages/overlay/base/index.json b/pages/overlay/base/index.json
deleted file mode 100644
index 278bd77..0000000
--- a/pages/overlay/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-overlay": "tdesign-miniprogram/overlay/overlay",
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/overlay/base/index.wxml b/pages/overlay/base/index.wxml
deleted file mode 100644
index 745f894..0000000
--- a/pages/overlay/base/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-基础用法
diff --git a/pages/overlay/base/index.wxss b/pages/overlay/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/overlay/overlay.d.ts b/pages/overlay/overlay.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/overlay/overlay.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/overlay/overlay.js b/pages/overlay/overlay.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/overlay/overlay.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/overlay/overlay.json b/pages/overlay/overlay.json
deleted file mode 100644
index 53cf7fd..0000000
--- a/pages/overlay/overlay.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "navigationBarTitleText": "Overlay",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "base": "./base"
- }
-}
diff --git a/pages/overlay/overlay.wxml b/pages/overlay/overlay.wxml
deleted file mode 100644
index 50ea05c..0000000
--- a/pages/overlay/overlay.wxml
+++ /dev/null
@@ -1,7 +0,0 @@
-
- Overlay 遮罩层
- 通过遮罩层,可以强调部分内容
-
-
-
-
diff --git a/pages/overlay/overlay.wxss b/pages/overlay/overlay.wxss
deleted file mode 100644
index 23062cc..0000000
--- a/pages/overlay/overlay.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-page {
- background-color: #fff;
-}
diff --git a/pages/picker/area/index.js b/pages/picker/area/index.js
deleted file mode 100644
index 876fb79..0000000
--- a/pages/picker/area/index.js
+++ /dev/null
@@ -1,168 +0,0 @@
-const areaList = {
- provinces: {
- 110000: '北京市',
- 440000: '广东省',
- },
- cities: {
- 110100: '北京市',
- 440100: '广州市',
- 440200: '韶关市',
- 440300: '深圳市',
- 440400: '珠海市',
- 440500: '汕头市',
- 440600: '佛山市',
- },
- counties: {
- 110101: '东城区',
- 110102: '西城区',
- 110105: '朝阳区',
- 110106: '丰台区',
- 110107: '石景山区',
- 110108: '海淀区',
- 110109: '门头沟区',
- 110111: '房山区',
- 110112: '通州区',
- 110113: '顺义区',
- 110114: '昌平区',
- 110115: '大兴区',
- 110116: '怀柔区',
- 110117: '平谷区',
- 110118: '密云区',
- 110119: '延庆区',
- 440103: '荔湾区',
- 440104: '越秀区',
- 440105: '海珠区',
- 440106: '天河区',
- 440111: '白云区',
- 440112: '黄埔区',
- 440113: '番禺区',
- 440114: '花都区',
- 440115: '南沙区',
- 440117: '从化区',
- 440118: '增城区',
- 440203: '武江区',
- 440204: '浈江区',
- 440205: '曲江区',
- 440222: '始兴县',
- 440224: '仁化县',
- 440229: '翁源县',
- 440232: '乳源瑶族自治县',
- 440233: '新丰县',
- 440281: '乐昌市',
- 440282: '南雄市',
- 440303: '罗湖区',
- 440304: '福田区',
- 440305: '南山区',
- 440306: '宝安区',
- 440307: '龙岗区',
- 440308: '盐田区',
- 440309: '龙华区',
- 440310: '坪山区',
- 440311: '光明区',
- 440402: '香洲区',
- 440403: '斗门区',
- 440404: '金湾区',
- 440507: '龙湖区',
- 440511: '金平区',
- 440512: '濠江区',
- 440513: '潮阳区',
- 440514: '潮南区',
- 440515: '澄海区',
- 440523: '南澳县',
- 440604: '禅城区',
- 440605: '南海区',
- 440606: '顺德区',
- 440607: '三水区',
- 440608: '高明区',
- },
-};
-
-const getOptions = (obj, filter) => {
- const res = Object.keys(obj).map((key) => ({ value: key, label: obj[key] }));
-
- if (filter) {
- return res.filter(filter);
- }
-
- return res;
-};
-
-const match = (v1, v2, size) => v1.toString().slice(0, size) === v2.toString().slice(0, size);
-
-Component({
- data: {
- areaText: '',
- areaValue: [],
- provinces: getOptions(areaList.provinces),
- cities: [],
- counties: [],
- },
-
- lifetimes: {
- ready() {
- const { provinces } = this.data;
- const { cities, counties } = this.getCities(provinces[0].value);
-
- this.setData({ cities, counties });
- },
- },
-
- methods: {
- onColumnChange(e) {
- console.log('pick:', e.detail);
- const { column, index } = e.detail;
- const { provinces, cities } = this.data;
-
- if (column === 0) {
- // 更改省份
- const { cities, counties } = this.getCities(provinces[index].value);
-
- this.setData({ cities, counties });
- }
-
- if (column === 1) {
- // 更改城市
- const counties = this.getCounties(cities[index].value);
-
- this.setData({ counties });
- }
-
- if (column === 2) {
- // 更改区县
- }
- },
-
- getCities(provinceValue) {
- const cities = getOptions(areaList.cities, (city) => match(city.value, provinceValue, 2));
- const counties = this.getCounties(cities[0].value);
-
- return { cities, counties };
- },
-
- getCounties(cityValue) {
- return getOptions(areaList.counties, (county) => match(county.value, cityValue, 4));
- },
-
- onPickerChange(e) {
- const { value, label } = e.detail;
-
- console.log('picker confirm:', e.detail);
- this.setData({
- areaVisible: false,
- areaValue: value,
- areaText: label.join(' '),
- });
- },
-
- onPickerCancel(e) {
- console.log('picker cancel', e.detail);
- this.setData({
- areaVisible: false,
- });
- },
-
- onAreaPicker() {
- this.setData({ areaVisible: true });
- },
- },
-});
diff --git a/pages/picker/area/index.json b/pages/picker/area/index.json
deleted file mode 100644
index 37838ec..0000000
--- a/pages/picker/area/index.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-picker": "tdesign-miniprogram/picker/picker",
- "t-picker-item": "tdesign-miniprogram/picker-item/picker-item"
- }
-}
diff --git a/pages/picker/area/index.wxml b/pages/picker/area/index.wxml
deleted file mode 100644
index e95d06f..0000000
--- a/pages/picker/area/index.wxml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
diff --git a/pages/picker/area/index.wxss b/pages/picker/area/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/picker/base/index.js b/pages/picker/base/index.js
deleted file mode 100644
index caec5cb..0000000
--- a/pages/picker/base/index.js
+++ /dev/null
@@ -1,61 +0,0 @@
-Component({
- data: {
- cityText: '',
- cityValue: [],
- dateText: '',
- dateValue: [],
- citys: [
- { label: '北京市', value: '北京市' },
- { label: '上海市', value: '上海市' },
- { label: '广州市', value: '广州市' },
- { label: '深圳市', value: '深圳市' },
- { label: '成都市', value: '成都市' },
- ],
- years: [
- { label: '2021年', value: '2021' },
- { label: '2020年', value: '2020' },
- { label: '2019年', value: '2019' },
- ],
- seasons: [
- { label: '春', value: '春' },
- { label: '夏', value: '夏' },
- { label: '秋', value: '秋' },
- { label: '冬', value: '冬' },
- ],
- },
-
- methods: {
- onColumnChange(e) {
- console.log('picker pick:', e);
- },
-
- onPickerChange(e) {
- const { key } = e.currentTarget.dataset;
- const { value } = e.detail;
-
- console.log('picker change:', e.detail);
- this.setData({
- [`${key}Visible`]: false,
- [`${key}Value`]: value,
- [`${key}Text`]: value.join(' '),
- });
- },
-
- onPickerCancel(e) {
- const { key } = e.currentTarget.dataset;
- console.log(e, '取消');
- console.log('picker1 cancel:');
- this.setData({
- [`${key}Visible`]: false,
- });
- },
-
- onCityPicker() {
- this.setData({ cityVisible: true });
- },
-
- onSeasonPicker() {
- this.setData({ dateVisible: true });
- },
- },
-});
diff --git a/pages/picker/base/index.json b/pages/picker/base/index.json
deleted file mode 100644
index 37838ec..0000000
--- a/pages/picker/base/index.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-picker": "tdesign-miniprogram/picker/picker",
- "t-picker-item": "tdesign-miniprogram/picker-item/picker-item"
- }
-}
diff --git a/pages/picker/base/index.wxml b/pages/picker/base/index.wxml
deleted file mode 100644
index 7ed081d..0000000
--- a/pages/picker/base/index.wxml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/picker/base/index.wxss b/pages/picker/base/index.wxss
deleted file mode 100644
index 9b27e9b..0000000
--- a/pages/picker/base/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.mb-16 {
- margin-bottom: 32rpx;
-}
diff --git a/pages/picker/picker.d.ts b/pages/picker/picker.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/picker/picker.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/picker/picker.js b/pages/picker/picker.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/picker/picker.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/picker/picker.json b/pages/picker/picker.json
deleted file mode 100644
index d108bd6..0000000
--- a/pages/picker/picker.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "navigationBarTitleText": "Picker",
- "usingComponents": {
- "base": "./base",
- "with-title": "./with-title",
- "area": "./area"
- }
-}
diff --git a/pages/picker/picker.wxml b/pages/picker/picker.wxml
deleted file mode 100644
index 2868a16..0000000
--- a/pages/picker/picker.wxml
+++ /dev/null
@@ -1,11 +0,0 @@
-
- Picker 选择器
- 用于一组预设数据中的选择。
-
-
-
-
-
-
-
-
diff --git a/pages/picker/picker.wxss b/pages/picker/picker.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/picker/with-title/index.js b/pages/picker/with-title/index.js
deleted file mode 100644
index 7945f15..0000000
--- a/pages/picker/with-title/index.js
+++ /dev/null
@@ -1,52 +0,0 @@
-Component({
- data: {
- cityText: '',
- city2Text: '',
- cityValue: [],
- city2Value: [],
- cityTitle: '',
- city2Title: '',
- citys: [
- { label: '北京市', value: '北京市' },
- { label: '上海市', value: '上海市' },
- { label: '广州市', value: '广州市' },
- { label: '深圳市', value: '深圳市' },
- { label: '成都市', value: '成都市' },
- ],
- },
-
- methods: {
- onColumnChange(e) {
- console.log('picker pick:', e);
- },
-
- onPickerChange(e) {
- const { key } = e.currentTarget.dataset;
- const { value } = e.detail;
-
- console.log('picker change:', e.detail);
- this.setData({
- [`${key}Visible`]: false,
- [`${key}Value`]: value,
- [`${key}Text`]: value.join(' '),
- });
- },
-
- onPickerCancel(e) {
- const { key } = e.currentTarget.dataset;
- console.log(e, '取消');
- console.log('picker1 cancel:');
- this.setData({
- [`${key}Visible`]: false,
- });
- },
-
- onTitlePicker() {
- this.setData({ cityVisible: true, cityTitle: '选择城市' });
- },
-
- onWithoutTitlePicker() {
- this.setData({ city2Visible: true, city2Title: '' });
- },
- },
-});
diff --git a/pages/picker/with-title/index.json b/pages/picker/with-title/index.json
deleted file mode 100644
index 37838ec..0000000
--- a/pages/picker/with-title/index.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-picker": "tdesign-miniprogram/picker/picker",
- "t-picker-item": "tdesign-miniprogram/picker-item/picker-item"
- }
-}
diff --git a/pages/picker/with-title/index.wxml b/pages/picker/with-title/index.wxml
deleted file mode 100644
index e08d878..0000000
--- a/pages/picker/with-title/index.wxml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/picker/with-title/index.wxss b/pages/picker/with-title/index.wxss
deleted file mode 100644
index 9b27e9b..0000000
--- a/pages/picker/with-title/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.mb-16 {
- margin-bottom: 32rpx;
-}
diff --git a/pages/popup/base/index.js b/pages/popup/base/index.js
deleted file mode 100644
index f24ed9f..0000000
--- a/pages/popup/base/index.js
+++ /dev/null
@@ -1,31 +0,0 @@
-Component({
- data: {
- cur: {},
- position: [
- { value: 'top', text: '顶部弹出' },
- { value: 'left', text: '左侧弹出' },
- { value: 'center', text: '中间弹出' },
- { value: 'bottom', text: '底部弹出' },
- { value: 'right', text: '右侧弹出' },
- ],
- },
- methods: {
- handlePopup(e) {
- const { item } = e.currentTarget.dataset;
-
- this.setData(
- {
- cur: item,
- },
- () => {
- this.setData({ visible: true });
- },
- );
- },
- onVisibleChange(e) {
- this.setData({
- visible: e.detail.visible,
- });
- },
- },
-});
diff --git a/pages/popup/base/index.json b/pages/popup/base/index.json
deleted file mode 100644
index 5d3569f..0000000
--- a/pages/popup/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-popup": "tdesign-miniprogram/popup/popup",
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/popup/base/index.wxml b/pages/popup/base/index.wxml
deleted file mode 100644
index afd9a94..0000000
--- a/pages/popup/base/index.wxml
+++ /dev/null
@@ -1,16 +0,0 @@
-
- {{cur.text}}
-
-
-{{item.text}}
diff --git a/pages/popup/base/index.wxss b/pages/popup/base/index.wxss
deleted file mode 100644
index 604ec50..0000000
--- a/pages/popup/base/index.wxss
+++ /dev/null
@@ -1,28 +0,0 @@
-.block {
- background: #fff;
- color: #333;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.block--top,
-.block--bottom {
- width: 100vw;
- height: 240px;
-}
-
-.block--left,
-.block--right {
- width: 280px;
- height: 100vh;
-}
-
-.block--center {
- width: 240px;
- height: 240px;
-}
-
-.wrapper + .wrapper {
- margin-top: 32rpx;
-}
\ No newline at end of file
diff --git a/pages/popup/custom-close/index.js b/pages/popup/custom-close/index.js
deleted file mode 100644
index 3e27215..0000000
--- a/pages/popup/custom-close/index.js
+++ /dev/null
@@ -1,36 +0,0 @@
-Component({
- data: {
- cur: {},
- position: [
- { value: 'top', text: '顶部弹出' },
- { value: 'left', text: '左侧弹出' },
- { value: 'center', text: '中间弹出' },
- { value: 'bottom', text: '底部弹出' },
- { value: 'right', text: '右侧弹出' },
- ],
- },
- methods: {
- handlePopup(e) {
- const { item } = e.currentTarget.dataset;
-
- this.setData(
- {
- cur: item,
- },
- () => {
- this.setData({ visible: true });
- },
- );
- },
- onVisibleChange(e) {
- this.setData({
- visible: e.detail.visible,
- });
- },
- onClose() {
- this.setData({
- visible: false,
- });
- },
- },
-});
diff --git a/pages/popup/custom-close/index.json b/pages/popup/custom-close/index.json
deleted file mode 100644
index 5d3569f..0000000
--- a/pages/popup/custom-close/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-popup": "tdesign-miniprogram/popup/popup",
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/popup/custom-close/index.wxml b/pages/popup/custom-close/index.wxml
deleted file mode 100644
index b3904cc..0000000
--- a/pages/popup/custom-close/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-居中弹出层-带自定义关闭按钮
diff --git a/pages/popup/custom-close/index.wxss b/pages/popup/custom-close/index.wxss
deleted file mode 100644
index ead91ff..0000000
--- a/pages/popup/custom-close/index.wxss
+++ /dev/null
@@ -1,19 +0,0 @@
-.block {
- position: relative;
- width: 240px;
- height: 240px;
- background: #fff;
- border-radius: 16rpx;
-}
-
-.close-btn {
- position: absolute;
- left: 50%;
- margin-left: -32rpx;
- bottom: calc(-1 * (48rpx + 64rpx));
-}
-
-.wrapper {
- margin: 32rpx;
- display: block;
-}
\ No newline at end of file
diff --git a/pages/popup/popup.d.ts b/pages/popup/popup.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/popup/popup.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/popup/popup.js b/pages/popup/popup.js
deleted file mode 100644
index 97efb06..0000000
--- a/pages/popup/popup.js
+++ /dev/null
@@ -1,24 +0,0 @@
-Page({
- placement: '',
- data: {
- bottom: false,
- center: false,
- left: false,
- right: false,
- },
- handlePopup(e) {
- const placement = e.currentTarget.dataset.type;
- this.placement = placement;
- this.setData({
- [placement]: true,
- });
- },
- onVisibleChange({ detail }) {
- const { visible } = detail;
- if (this.placement) {
- this.setData({
- [this.placement]: visible,
- });
- }
- },
-});
diff --git a/pages/popup/popup.json b/pages/popup/popup.json
deleted file mode 100644
index cb4d476..0000000
--- a/pages/popup/popup.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarTitleText": "Popup",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "base": "./base/index",
- "with-title": "./with-title/index",
- "custom-close": "./custom-close/index"
- }
-}
diff --git a/pages/popup/popup.wxml b/pages/popup/popup.wxml
deleted file mode 100644
index a5c6c2f..0000000
--- a/pages/popup/popup.wxml
+++ /dev/null
@@ -1,11 +0,0 @@
-Popup 弹出层
-由其他控件触发,屏幕滑出或弹出一块自定义内容区域。
-
diff --git a/pages/popup/popup.wxss b/pages/popup/popup.wxss
deleted file mode 100644
index 4d5e590..0000000
--- a/pages/popup/popup.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-page {
- background: #fff;
- padding-bottom: 48rpx;
-}
diff --git a/pages/popup/with-title/index.js b/pages/popup/with-title/index.js
deleted file mode 100644
index f24ed9f..0000000
--- a/pages/popup/with-title/index.js
+++ /dev/null
@@ -1,31 +0,0 @@
-Component({
- data: {
- cur: {},
- position: [
- { value: 'top', text: '顶部弹出' },
- { value: 'left', text: '左侧弹出' },
- { value: 'center', text: '中间弹出' },
- { value: 'bottom', text: '底部弹出' },
- { value: 'right', text: '右侧弹出' },
- ],
- },
- methods: {
- handlePopup(e) {
- const { item } = e.currentTarget.dataset;
-
- this.setData(
- {
- cur: item,
- },
- () => {
- this.setData({ visible: true });
- },
- );
- },
- onVisibleChange(e) {
- this.setData({
- visible: e.detail.visible,
- });
- },
- },
-});
diff --git a/pages/popup/with-title/index.json b/pages/popup/with-title/index.json
deleted file mode 100644
index 5d3569f..0000000
--- a/pages/popup/with-title/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-popup": "tdesign-miniprogram/popup/popup",
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/popup/with-title/index.wxml b/pages/popup/with-title/index.wxml
deleted file mode 100644
index 2037921..0000000
--- a/pages/popup/with-title/index.wxml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-底部弹出层-带标题及操作
diff --git a/pages/popup/with-title/index.wxss b/pages/popup/with-title/index.wxss
deleted file mode 100644
index 91c3621..0000000
--- a/pages/popup/with-title/index.wxss
+++ /dev/null
@@ -1,38 +0,0 @@
-.block {
- width: 100vw;
- height: 240px;
- background: #fff;
- border-top-left-radius: 16rpx;
- border-top-right-radius: 16rpx;
-}
-
-.wrapper {
- margin: 32rpx;
- display: block;
-}
-
-.header {
- display: flex;
- align-items: center;
- height: 116rpx;
-}
-
-.title {
- flex: 1;
- text-align: center;
- font-weight: 600;
- font-size: 36rpx;
-}
-
-.btn {
- font-size: 32rpx;
- padding: 32rpx;
-}
-
-.btn--cancel {
- color: rgba(0, 0, 0, .6);
-}
-
-.btn--confirm {
- color: #0052d9;
-}
\ No newline at end of file
diff --git a/pages/progress/base/index.js b/pages/progress/base/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/progress/base/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/progress/base/index.json b/pages/progress/base/index.json
deleted file mode 100644
index f830356..0000000
--- a/pages/progress/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-progress": "tdesign-miniprogram/progress/progress"
- }
-}
diff --git a/pages/progress/base/index.wxml b/pages/progress/base/index.wxml
deleted file mode 100644
index 713df09..0000000
--- a/pages/progress/base/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/progress/base/index.wxss b/pages/progress/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/progress/circle/index.js b/pages/progress/circle/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/progress/circle/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/progress/circle/index.json b/pages/progress/circle/index.json
deleted file mode 100644
index f830356..0000000
--- a/pages/progress/circle/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-progress": "tdesign-miniprogram/progress/progress"
- }
-}
diff --git a/pages/progress/circle/index.wxml b/pages/progress/circle/index.wxml
deleted file mode 100644
index 2a347f3..0000000
--- a/pages/progress/circle/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/pages/progress/circle/index.wxss b/pages/progress/circle/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/progress/custom/index.js b/pages/progress/custom/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/progress/custom/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/progress/custom/index.json b/pages/progress/custom/index.json
deleted file mode 100644
index f830356..0000000
--- a/pages/progress/custom/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-progress": "tdesign-miniprogram/progress/progress"
- }
-}
diff --git a/pages/progress/custom/index.wxml b/pages/progress/custom/index.wxml
deleted file mode 100644
index d300db2..0000000
--- a/pages/progress/custom/index.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/pages/progress/custom/index.wxss b/pages/progress/custom/index.wxss
deleted file mode 100644
index 17ebe4b..0000000
--- a/pages/progress/custom/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.external-class-label {
- color: #d504d9;
-}
-
-.external-class-bar {
- border-radius: 20rpx;
-}
diff --git a/pages/progress/line/index.js b/pages/progress/line/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/progress/line/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/progress/line/index.json b/pages/progress/line/index.json
deleted file mode 100644
index f830356..0000000
--- a/pages/progress/line/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-progress": "tdesign-miniprogram/progress/progress"
- }
-}
diff --git a/pages/progress/line/index.wxml b/pages/progress/line/index.wxml
deleted file mode 100644
index b180a98..0000000
--- a/pages/progress/line/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/pages/progress/line/index.wxss b/pages/progress/line/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/progress/plump/index.js b/pages/progress/plump/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/progress/plump/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/progress/plump/index.json b/pages/progress/plump/index.json
deleted file mode 100644
index f830356..0000000
--- a/pages/progress/plump/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-progress": "tdesign-miniprogram/progress/progress"
- }
-}
diff --git a/pages/progress/plump/index.wxml b/pages/progress/plump/index.wxml
deleted file mode 100644
index 9290a30..0000000
--- a/pages/progress/plump/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/pages/progress/plump/index.wxss b/pages/progress/plump/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/progress/progress.d.ts b/pages/progress/progress.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/progress/progress.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/progress/progress.js b/pages/progress/progress.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/progress/progress.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/progress/progress.json b/pages/progress/progress.json
deleted file mode 100644
index d75306c..0000000
--- a/pages/progress/progress.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "navigationBarTitleText": "Progress",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "base": "./base",
- "transition": "./transition",
- "custom": "./custom",
- "line": "./line",
- "plump": "./plump",
- "circle": "./circle"
- }
-}
diff --git a/pages/progress/progress.wxml b/pages/progress/progress.wxml
deleted file mode 100644
index 61bfc4d..0000000
--- a/pages/progress/progress.wxml
+++ /dev/null
@@ -1,22 +0,0 @@
-
- Progress 进度条
- 在导航栏下方,用于给用户显示提示消息
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/progress/progress.wxss b/pages/progress/progress.wxss
deleted file mode 100644
index 1fa0ddf..0000000
--- a/pages/progress/progress.wxss
+++ /dev/null
@@ -1,6 +0,0 @@
-page {
- background-color: #fff;
-}
-.t-progress {
- margin-top: 32rpx;
-}
diff --git a/pages/progress/transition/index.js b/pages/progress/transition/index.js
deleted file mode 100644
index d76d031..0000000
--- a/pages/progress/transition/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-Component({
- data: {
- percentage: 88,
- },
-
- methods: {
- clickAdd() {
- this.setData({
- percentage: Math.min(this.data.percentage + 10, 100),
- });
- },
-
- clickReduce() {
- this.setData({
- percentage: Math.max(0, this.data.percentage - 10),
- });
- },
- },
-});
diff --git a/pages/progress/transition/index.json b/pages/progress/transition/index.json
deleted file mode 100644
index bf52a9d..0000000
--- a/pages/progress/transition/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-progress": "tdesign-miniprogram/progress/progress",
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/progress/transition/index.wxml b/pages/progress/transition/index.wxml
deleted file mode 100644
index dab9138..0000000
--- a/pages/progress/transition/index.wxml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
- 减少
-
- 增加
-
diff --git a/pages/progress/transition/index.wxss b/pages/progress/transition/index.wxss
deleted file mode 100644
index 09a9411..0000000
--- a/pages/progress/transition/index.wxss
+++ /dev/null
@@ -1,8 +0,0 @@
-.button-group {
- display: flex;
- justify-content: center;
-}
-
-.button-group .space {
- width: 32rpx;
-}
diff --git a/pages/pull-down-refresh/base/index.js b/pages/pull-down-refresh/base/index.js
deleted file mode 100644
index 2c71064..0000000
--- a/pages/pull-down-refresh/base/index.js
+++ /dev/null
@@ -1,28 +0,0 @@
-Component({
- data: {
- baseRefresh: {
- value: false,
- },
- loadingProps: {
- size: '50rpx',
- },
- rowCol1: [{ width: '100%', height: '342rpx', borderRadius: '24rpx' }],
- rowCol2: [[{ width: '327rpx' }], [{ width: '200rpx' }], [{ size: '327rpx', borderRadius: '24rpx' }]],
- backTopVisible: false,
- },
-
- methods: {
- onPullDownRefresh() {
- setTimeout(() => {
- this.setData({ 'baseRefresh.value': false });
- }, 1500);
- },
- onScroll(e) {
- const { scrollTop } = e.detail;
-
- this.setData({
- backTopVisible: scrollTop > 100,
- });
- },
- },
-});
diff --git a/pages/pull-down-refresh/base/index.json b/pages/pull-down-refresh/base/index.json
deleted file mode 100644
index 7a0281a..0000000
--- a/pages/pull-down-refresh/base/index.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-pull-down-refresh": "tdesign-miniprogram/pull-down-refresh/pull-down-refresh",
- "t-skeleton": "tdesign-miniprogram/skeleton/skeleton",
- "t-back-top": "tdesign-miniprogram/back-top/back-top"
- }
-}
diff --git a/pages/pull-down-refresh/base/index.wxml b/pages/pull-down-refresh/base/index.wxml
deleted file mode 100644
index 26b61a2..0000000
--- a/pages/pull-down-refresh/base/index.wxml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
- PullDownRefresh 下拉刷新
- 用于快速刷新页面信息,刷新可以是整页刷新也可以是页面的局部刷新。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 拖拽该区域演示 顶部下拉刷新
-
-
-
-
diff --git a/pages/pull-down-refresh/base/index.wxss b/pages/pull-down-refresh/base/index.wxss
deleted file mode 100644
index 91aa2ff..0000000
--- a/pages/pull-down-refresh/base/index.wxss
+++ /dev/null
@@ -1,40 +0,0 @@
-.demo {
- padding-bottom: 56rpx;
-}
-
-.demo-title {
- font-size: 48rpx;
- font-weight: 700;
- line-height: 64rpx;
- margin: 48rpx 32rpx 0;
- color: rgba(0, 0, 0, 0.9);
-}
-
-.demo-desc {
- font-size: 28rpx;
- color: rgba(0, 0, 0, 0.6);
- margin: 16rpx 32rpx 0;
- line-height: 44rpx;
-}
-
-.pulldown-reflesh__content {
- margin: 64rpx 32rpx 0;
- position: relative;
-}
-
-.row {
- display: flex;
- justify-content: space-between;
- margin-top: 32rpx;
-}
-
-.text {
- position: absolute;
- top: 152rpx;
- left: 50%;
- transform: translateX(-50%);
- text-align: center;
- font-size: 32rpx;
- color: rgba(0, 0, 0, 0.26);
- width: 686rpx;
-}
diff --git a/pages/pull-down-refresh/pull-down-refresh.d.ts b/pages/pull-down-refresh/pull-down-refresh.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/pull-down-refresh/pull-down-refresh.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/pull-down-refresh/pull-down-refresh.js b/pages/pull-down-refresh/pull-down-refresh.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/pull-down-refresh/pull-down-refresh.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/pull-down-refresh/pull-down-refresh.json b/pages/pull-down-refresh/pull-down-refresh.json
deleted file mode 100644
index a1f544d..0000000
--- a/pages/pull-down-refresh/pull-down-refresh.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarTitleText": "PullDownRefresh",
- "navigationBarBackgroundColor": "#fff",
- "backgroundColor": "#fff",
- "disableScroll": true,
- "usingComponents": {
- "base": "./base"
- }
-}
diff --git a/pages/pull-down-refresh/pull-down-refresh.wxml b/pages/pull-down-refresh/pull-down-refresh.wxml
deleted file mode 100644
index ac87129..0000000
--- a/pages/pull-down-refresh/pull-down-refresh.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/pull-down-refresh/pull-down-refresh.wxss b/pages/pull-down-refresh/pull-down-refresh.wxss
deleted file mode 100644
index 23062cc..0000000
--- a/pages/pull-down-refresh/pull-down-refresh.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-page {
- background-color: #fff;
-}
diff --git a/pages/radio/align/index.js b/pages/radio/align/index.js
deleted file mode 100644
index 473405d..0000000
--- a/pages/radio/align/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-Component({
- /**
- * 组件的属性列表
- */
- properties: {},
-
- /**
- * 组件的初始数据
- */
- data: {},
-
- /**
- * 组件的方法列表
- */
- methods: {
- onChange(event) {
- console.log('radio', event.detail);
- },
- },
-});
diff --git a/pages/radio/align/index.json b/pages/radio/align/index.json
deleted file mode 100644
index b9cde8d..0000000
--- a/pages/radio/align/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-radio": "tdesign-miniprogram/radio/radio"
- }
-}
diff --git a/pages/radio/align/index.wxml b/pages/radio/align/index.wxml
deleted file mode 100644
index eb51f7d..0000000
--- a/pages/radio/align/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/radio/align/index.wxss b/pages/radio/align/index.wxss
deleted file mode 100644
index 8948334..0000000
--- a/pages/radio/align/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.block {
- height: 32rpx;
-}
\ No newline at end of file
diff --git a/pages/radio/base/index.js b/pages/radio/base/index.js
deleted file mode 100644
index 473405d..0000000
--- a/pages/radio/base/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-Component({
- /**
- * 组件的属性列表
- */
- properties: {},
-
- /**
- * 组件的初始数据
- */
- data: {},
-
- /**
- * 组件的方法列表
- */
- methods: {
- onChange(event) {
- console.log('radio', event.detail);
- },
- },
-});
diff --git a/pages/radio/base/index.json b/pages/radio/base/index.json
deleted file mode 100644
index e9c7cb3..0000000
--- a/pages/radio/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-radio-group": "tdesign-miniprogram/radio-group/radio-group",
- "t-radio": "tdesign-miniprogram/radio/radio"
- }
-}
diff --git a/pages/radio/base/index.wxml b/pages/radio/base/index.wxml
deleted file mode 100644
index 6373e4c..0000000
--- a/pages/radio/base/index.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
diff --git a/pages/radio/base/index.wxss b/pages/radio/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/radio/card/index.js b/pages/radio/card/index.js
deleted file mode 100644
index ad73dfe..0000000
--- a/pages/radio/card/index.js
+++ /dev/null
@@ -1,18 +0,0 @@
-Component({
- /**
- * 组件的属性列表
- */
- properties: {},
-
- /**
- * 组件的初始数据
- */
- data: {},
-
- /**
- * 组件的方法列表
- */
- methods: {
- onChange() {},
- },
-});
diff --git a/pages/radio/card/index.json b/pages/radio/card/index.json
deleted file mode 100644
index e9c7cb3..0000000
--- a/pages/radio/card/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-radio-group": "tdesign-miniprogram/radio-group/radio-group",
- "t-radio": "tdesign-miniprogram/radio/radio"
- }
-}
diff --git a/pages/radio/card/index.wxml b/pages/radio/card/index.wxml
deleted file mode 100644
index 92e45ef..0000000
--- a/pages/radio/card/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/radio/card/index.wxss b/pages/radio/card/index.wxss
deleted file mode 100644
index cb0cbc9..0000000
--- a/pages/radio/card/index.wxss
+++ /dev/null
@@ -1,5 +0,0 @@
-.theme-card {
- border-radius: 24rpx;
- margin: 32rpx;
- overflow: hidden;
-}
\ No newline at end of file
diff --git a/pages/radio/horizontal/index.js b/pages/radio/horizontal/index.js
deleted file mode 100644
index 8c3938a..0000000
--- a/pages/radio/horizontal/index.js
+++ /dev/null
@@ -1,10 +0,0 @@
-Page({
- data: {
- checked: false,
- },
- handleChange(e) {
- this.setData({
- checked: e.detail.checked,
- });
- },
-});
diff --git a/pages/radio/horizontal/index.json b/pages/radio/horizontal/index.json
deleted file mode 100644
index e9c7cb3..0000000
--- a/pages/radio/horizontal/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-radio-group": "tdesign-miniprogram/radio-group/radio-group",
- "t-radio": "tdesign-miniprogram/radio/radio"
- }
-}
diff --git a/pages/radio/horizontal/index.wxml b/pages/radio/horizontal/index.wxml
deleted file mode 100644
index 07b0dce..0000000
--- a/pages/radio/horizontal/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/radio/horizontal/index.wxss b/pages/radio/horizontal/index.wxss
deleted file mode 100644
index 4896825..0000000
--- a/pages/radio/horizontal/index.wxss
+++ /dev/null
@@ -1,6 +0,0 @@
-.box {
- padding: 32rpx;
- display: flex;
- justify-content: space-between;
- background-color: #fff;
-}
\ No newline at end of file
diff --git a/pages/radio/radio.d.ts b/pages/radio/radio.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/radio/radio.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/radio/radio.js b/pages/radio/radio.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/radio/radio.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/radio/radio.json b/pages/radio/radio.json
deleted file mode 100644
index 10e4890..0000000
--- a/pages/radio/radio.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "navigationBarTitleText": "Radio",
- "usingComponents": {
- "horizontal": "./horizontal",
- "base": "./base",
- "align": "./align",
- "card": "./card",
- "status": "./status",
- "theme": "./theme",
- "special": "./special"
- }
-}
diff --git a/pages/radio/radio.wxml b/pages/radio/radio.wxml
deleted file mode 100644
index eea6e18..0000000
--- a/pages/radio/radio.wxml
+++ /dev/null
@@ -1,31 +0,0 @@
-
- Radio 单选框
- 用于在预设的一组选项中执行单项选择,并呈现选择结果。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/radio/radio.wxss b/pages/radio/radio.wxss
deleted file mode 100644
index 64e6843..0000000
--- a/pages/radio/radio.wxss
+++ /dev/null
@@ -1,9 +0,0 @@
-.t-radio-padding {
- padding: 24rpx 32rpx !important;
-}
-.t-radio-demo {
- margin-top: 16px;
-}
-.disable-border {
- display: none;
-}
diff --git a/pages/radio/special/index.js b/pages/radio/special/index.js
deleted file mode 100644
index f577a25..0000000
--- a/pages/radio/special/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
- data: {
- value: 0,
- value1: 0,
- },
- methods: {
- onChange(e) {
- this.setData({ value: e.detail.value });
- },
- onChange1(e) {
- this.setData({ value1: e.detail.value });
- },
- },
-});
diff --git a/pages/radio/special/index.json b/pages/radio/special/index.json
deleted file mode 100644
index e9c7cb3..0000000
--- a/pages/radio/special/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-radio-group": "tdesign-miniprogram/radio-group/radio-group",
- "t-radio": "tdesign-miniprogram/radio/radio"
- }
-}
diff --git a/pages/radio/special/index.wxml b/pages/radio/special/index.wxml
deleted file mode 100644
index 87e2269..0000000
--- a/pages/radio/special/index.wxml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-横向卡片单选框
-
-
-
-
-
-
-
diff --git a/pages/radio/special/index.wxss b/pages/radio/special/index.wxss
deleted file mode 100644
index 8042dc1..0000000
--- a/pages/radio/special/index.wxss
+++ /dev/null
@@ -1,49 +0,0 @@
-.card {
- position: relative;
- margin: 32rpx;
- border-radius: 12rpx;
- overflow: hidden;
- box-sizing: border-box;
- border: 3rpx solid #fff;
-}
-
-.card--active {
- border-color: #0052d9;
-}
-
-.card--active::after {
- content: '';
- display: block;
- position: absolute;
- left: 0;
- top: 0;
- width: 0;
- border: 14px solid #0052d9;
- border-bottom-color: transparent;
- border-right-color: transparent;
-}
-
-.card__icon {
- color: #fff;
- position: absolute;
- left: 1.5px;
- top: 1.5px;
- z-index: 1;
-}
-
-/* 横向布局 */
-.horizontal-box {
- width: calc(100% - 64rpx);
- display: flex;
- align-items: center;
- margin: 32rpx;
-}
-
-.horizontal-box .card {
- flex: 1;
- margin: 0;
-}
-
-.horizontal-box .card + .card {
- margin-left: 24rpx;
-}
diff --git a/pages/radio/status/index.js b/pages/radio/status/index.js
deleted file mode 100644
index e68dbfb..0000000
--- a/pages/radio/status/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-Component({
- /**
- * 组件的属性列表
- */
- properties: {},
-
- /**
- * 组件的初始数据
- */
- data: {},
-
- /**
- * 组件的方法列表
- */
- methods: {},
-});
diff --git a/pages/radio/status/index.json b/pages/radio/status/index.json
deleted file mode 100644
index e9c7cb3..0000000
--- a/pages/radio/status/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-radio-group": "tdesign-miniprogram/radio-group/radio-group",
- "t-radio": "tdesign-miniprogram/radio/radio"
- }
-}
diff --git a/pages/radio/status/index.wxml b/pages/radio/status/index.wxml
deleted file mode 100644
index 9a6d0bd..0000000
--- a/pages/radio/status/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/pages/radio/status/index.wxss b/pages/radio/status/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/radio/theme/index.js b/pages/radio/theme/index.js
deleted file mode 100644
index e68dbfb..0000000
--- a/pages/radio/theme/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-Component({
- /**
- * 组件的属性列表
- */
- properties: {},
-
- /**
- * 组件的初始数据
- */
- data: {},
-
- /**
- * 组件的方法列表
- */
- methods: {},
-});
diff --git a/pages/radio/theme/index.json b/pages/radio/theme/index.json
deleted file mode 100644
index b9cde8d..0000000
--- a/pages/radio/theme/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-radio": "tdesign-miniprogram/radio/radio"
- }
-}
diff --git a/pages/radio/theme/index.wxml b/pages/radio/theme/index.wxml
deleted file mode 100644
index fd242ec..0000000
--- a/pages/radio/theme/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/radio/theme/index.wxss b/pages/radio/theme/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/rate/action/index.js b/pages/rate/action/index.js
deleted file mode 100644
index 49f0c0e..0000000
--- a/pages/rate/action/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
- data: {
- value: 3.5,
- },
- methods: {
- onChange(e) {
- const { value } = e.detail;
- this.setData({
- value,
- });
- },
- },
-});
diff --git a/pages/rate/action/index.json b/pages/rate/action/index.json
deleted file mode 100644
index 724692f..0000000
--- a/pages/rate/action/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-rate": "tdesign-miniprogram/rate/rate"
- }
-}
diff --git a/pages/rate/action/index.wxml b/pages/rate/action/index.wxml
deleted file mode 100644
index 5d11fd4..0000000
--- a/pages/rate/action/index.wxml
+++ /dev/null
@@ -1,13 +0,0 @@
-只可选全星时
-
-
- 点击或滑动
-
-
-
-只可选半星时
-
-
- 点击或滑动
-
-
diff --git a/pages/rate/action/index.wxss b/pages/rate/action/index.wxss
deleted file mode 100644
index d5dae82..0000000
--- a/pages/rate/action/index.wxss
+++ /dev/null
@@ -1,18 +0,0 @@
-.demo-rate {
- background-color: #fff;
- height: 96rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 32rpx;
- border-bottom: solid 1rpx #f0f0f0;
- border-top: solid 1rpx #f0f0f0;
- margin-top: 32rpx;
- margin-bottom: 32rpx;
-}
-
-.demo-rate__transparent {
- background-color: transparent;
- padding-left: 32rpx;
- border: 0;
-}
diff --git a/pages/rate/base/index.js b/pages/rate/base/index.js
deleted file mode 100644
index 5a116c0..0000000
--- a/pages/rate/base/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-Component({
- data: {
- value: 3,
- },
- methods: {
- onChange(e) {
- const { value } = e.detail;
- this.setData({
- value,
- });
- },
- },
-});
diff --git a/pages/rate/base/index.json b/pages/rate/base/index.json
deleted file mode 100644
index 724692f..0000000
--- a/pages/rate/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-rate": "tdesign-miniprogram/rate/rate"
- }
-}
diff --git a/pages/rate/base/index.wxml b/pages/rate/base/index.wxml
deleted file mode 100644
index 96e1572..0000000
--- a/pages/rate/base/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
- 实心评分
-
-
-
diff --git a/pages/rate/base/index.wxss b/pages/rate/base/index.wxss
deleted file mode 100644
index 285bffb..0000000
--- a/pages/rate/base/index.wxss
+++ /dev/null
@@ -1,22 +0,0 @@
-.demo-rate {
- background-color: #fff;
- height: 96rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 32rpx;
- border-bottom: solid 1rpx #f0f0f0;
- border-top: solid 1rpx #f0f0f0;
- margin-top: 32rpx;
- margin-bottom: 32rpx;
-}
-
-.demo-rate__title {
- width: 200rpx;
-}
-
-.demo-rate__transparent {
- background-color: transparent;
- padding-left: 32rpx;
- border: 0;
-}
diff --git a/pages/rate/color/index.js b/pages/rate/color/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/rate/color/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/rate/color/index.json b/pages/rate/color/index.json
deleted file mode 100644
index 724692f..0000000
--- a/pages/rate/color/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-rate": "tdesign-miniprogram/rate/rate"
- }
-}
diff --git a/pages/rate/color/index.wxml b/pages/rate/color/index.wxml
deleted file mode 100644
index df6548e..0000000
--- a/pages/rate/color/index.wxml
+++ /dev/null
@@ -1,8 +0,0 @@
-
- 填充评分
-
-
-
- 线描评分
-
-
diff --git a/pages/rate/color/index.wxss b/pages/rate/color/index.wxss
deleted file mode 100644
index bd33f3a..0000000
--- a/pages/rate/color/index.wxss
+++ /dev/null
@@ -1,28 +0,0 @@
-.custom-color {
- --td-rate-selected-color: #f96102;
- --td-rate-unselected-color: #bbbbbb;
-}
-
-.demo-rate {
- background-color: #fff;
-
- height: 96rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 32rpx;
- border-bottom: solid 1rpx #f0f0f0;
- border-top: solid 1rpx #f0f0f0;
- margin-top: 32rpx;
- margin-bottom: 32rpx;
-}
-
-.demo-rate__title {
- width: 200rpx;
-}
-
-.demo-rate__transparent {
- background-color: transparent;
- padding-left: 32rpx;
- border: 0;
-}
diff --git a/pages/rate/count/index.js b/pages/rate/count/index.js
deleted file mode 100644
index 0341b9f..0000000
--- a/pages/rate/count/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-Component({
- data: {
- value: 2,
- },
-
- methods: {
- onChange(e) {
- const { value } = e.detail;
- this.setData({
- value,
- });
- },
- },
-});
diff --git a/pages/rate/count/index.json b/pages/rate/count/index.json
deleted file mode 100644
index 724692f..0000000
--- a/pages/rate/count/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-rate": "tdesign-miniprogram/rate/rate"
- }
-}
diff --git a/pages/rate/count/index.wxml b/pages/rate/count/index.wxml
deleted file mode 100644
index d3ed8a3..0000000
--- a/pages/rate/count/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
- 自定义评分数量
-
-
-
diff --git a/pages/rate/count/index.wxss b/pages/rate/count/index.wxss
deleted file mode 100644
index d5dae82..0000000
--- a/pages/rate/count/index.wxss
+++ /dev/null
@@ -1,18 +0,0 @@
-.demo-rate {
- background-color: #fff;
- height: 96rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 32rpx;
- border-bottom: solid 1rpx #f0f0f0;
- border-top: solid 1rpx #f0f0f0;
- margin-top: 32rpx;
- margin-bottom: 32rpx;
-}
-
-.demo-rate__transparent {
- background-color: transparent;
- padding-left: 32rpx;
- border: 0;
-}
diff --git a/pages/rate/custom/index.js b/pages/rate/custom/index.js
deleted file mode 100644
index 5a116c0..0000000
--- a/pages/rate/custom/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-Component({
- data: {
- value: 3,
- },
- methods: {
- onChange(e) {
- const { value } = e.detail;
- this.setData({
- value,
- });
- },
- },
-});
diff --git a/pages/rate/custom/index.json b/pages/rate/custom/index.json
deleted file mode 100644
index 724692f..0000000
--- a/pages/rate/custom/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-rate": "tdesign-miniprogram/rate/rate"
- }
-}
diff --git a/pages/rate/custom/index.wxml b/pages/rate/custom/index.wxml
deleted file mode 100644
index e2f7346..0000000
--- a/pages/rate/custom/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
- 自定义评分
-
-
diff --git a/pages/rate/custom/index.wxss b/pages/rate/custom/index.wxss
deleted file mode 100644
index 285bffb..0000000
--- a/pages/rate/custom/index.wxss
+++ /dev/null
@@ -1,22 +0,0 @@
-.demo-rate {
- background-color: #fff;
- height: 96rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 32rpx;
- border-bottom: solid 1rpx #f0f0f0;
- border-top: solid 1rpx #f0f0f0;
- margin-top: 32rpx;
- margin-bottom: 32rpx;
-}
-
-.demo-rate__title {
- width: 200rpx;
-}
-
-.demo-rate__transparent {
- background-color: transparent;
- padding-left: 32rpx;
- border: 0;
-}
diff --git a/pages/rate/rate.d.ts b/pages/rate/rate.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/rate/rate.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/rate/rate.js b/pages/rate/rate.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/rate/rate.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/rate/rate.json b/pages/rate/rate.json
deleted file mode 100644
index edab627..0000000
--- a/pages/rate/rate.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "navigationBarTitleText": "Rate",
- "usingComponents": {
- "base": "./base",
- "custom": "./custom",
- "special": "./special",
- "un-filled": "./un-filled",
- "count": "./count",
- "action": "./action",
- "show-text": "./show-text",
- "color": "./color",
- "size": "./size"
- }
-}
diff --git a/pages/rate/rate.wxml b/pages/rate/rate.wxml
deleted file mode 100644
index add2692..0000000
--- a/pages/rate/rate.wxml
+++ /dev/null
@@ -1,32 +0,0 @@
-
- Rate 评分
- 用于对某行为/事物进行打分。
-
- 实心评分
-
-
- 自定义评分
-
-
- 自定义评分数量
-
-
- 带描述评分
-
-
-
-
-
-
-
-
- 评分大小
-
-
- 设置评分颜色
-
-
-
-
-
-
diff --git a/pages/rate/rate.wxss b/pages/rate/rate.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/rate/show-text/index.js b/pages/rate/show-text/index.js
deleted file mode 100644
index 3e0d463..0000000
--- a/pages/rate/show-text/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-Component({
- data: {
- value: [3, 3, 0],
- texts: ['1分', '2分', '3分', '4分', '5分'],
- },
-
- methods: {
- onChange(e) {
- const { index } = e.currentTarget.dataset;
- const { value } = e.detail;
- this.setData({
- [`value[${index}]`]: value,
- });
- },
- },
-});
diff --git a/pages/rate/show-text/index.json b/pages/rate/show-text/index.json
deleted file mode 100644
index 724692f..0000000
--- a/pages/rate/show-text/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-rate": "tdesign-miniprogram/rate/rate"
- }
-}
diff --git a/pages/rate/show-text/index.wxml b/pages/rate/show-text/index.wxml
deleted file mode 100644
index 9cf3223..0000000
--- a/pages/rate/show-text/index.wxml
+++ /dev/null
@@ -1,15 +0,0 @@
-
- 带描述评分
-
-
-
-
- 带描述评分
-
-
-
-
-
- 带描述评分
-
-
diff --git a/pages/rate/show-text/index.wxss b/pages/rate/show-text/index.wxss
deleted file mode 100644
index fa9dce3..0000000
--- a/pages/rate/show-text/index.wxss
+++ /dev/null
@@ -1,23 +0,0 @@
-.demo-rate {
- background-color: #fff;
-
- height: 96rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 32rpx;
- border-bottom: solid 1rpx #f0f0f0;
- border-top: solid 1rpx #f0f0f0;
- margin-top: 32rpx;
- margin-bottom: 32rpx;
-}
-
-.demo-rate__title {
- width: 200rpx;
-}
-
-.demo-rate__transparent {
- background-color: transparent;
- padding-left: 32rpx;
- border: 0;
-}
diff --git a/pages/rate/size/index.js b/pages/rate/size/index.js
deleted file mode 100644
index 73dcc10..0000000
--- a/pages/rate/size/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-Component({
- data: {
- value: [3, 3],
- },
- methods: {
- onChange(e) {
- const { index } = e.currentTarget.dataset;
- const { value } = e.detail;
- this.setData({
- [`value[${index}]`]: value,
- });
- },
- },
-});
diff --git a/pages/rate/size/index.json b/pages/rate/size/index.json
deleted file mode 100644
index 724692f..0000000
--- a/pages/rate/size/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-rate": "tdesign-miniprogram/rate/rate"
- }
-}
diff --git a/pages/rate/size/index.wxml b/pages/rate/size/index.wxml
deleted file mode 100644
index 610b7ac..0000000
--- a/pages/rate/size/index.wxml
+++ /dev/null
@@ -1,8 +0,0 @@
-
- 大尺寸 24
-
-
-
- 小尺寸 20
-
-
diff --git a/pages/rate/size/index.wxss b/pages/rate/size/index.wxss
deleted file mode 100644
index fa9dce3..0000000
--- a/pages/rate/size/index.wxss
+++ /dev/null
@@ -1,23 +0,0 @@
-.demo-rate {
- background-color: #fff;
-
- height: 96rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 32rpx;
- border-bottom: solid 1rpx #f0f0f0;
- border-top: solid 1rpx #f0f0f0;
- margin-top: 32rpx;
- margin-bottom: 32rpx;
-}
-
-.demo-rate__title {
- width: 200rpx;
-}
-
-.demo-rate__transparent {
- background-color: transparent;
- padding-left: 32rpx;
- border: 0;
-}
diff --git a/pages/rate/special/index.js b/pages/rate/special/index.js
deleted file mode 100644
index 99c6ba6..0000000
--- a/pages/rate/special/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-Component({
- data: {
- value: 4,
- texts: ['非常糟糕', '有些糟糕', '可以尝试', '可以前往', '推荐前往'],
- },
- methods: {
- onChange(e) {
- const { value } = e.detail;
- this.setData({
- value,
- });
- },
- },
-});
diff --git a/pages/rate/special/index.json b/pages/rate/special/index.json
deleted file mode 100644
index 724692f..0000000
--- a/pages/rate/special/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-rate": "tdesign-miniprogram/rate/rate"
- }
-}
diff --git a/pages/rate/special/index.wxml b/pages/rate/special/index.wxml
deleted file mode 100644
index c801a16..0000000
--- a/pages/rate/special/index.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
- {{texts[value - 1]}}
-
diff --git a/pages/rate/special/index.wxss b/pages/rate/special/index.wxss
deleted file mode 100644
index 13a22d0..0000000
--- a/pages/rate/special/index.wxss
+++ /dev/null
@@ -1,23 +0,0 @@
-.demo-rate {
- background-color: #fff;
- padding: 32rpx;
- border-bottom: solid 1rpx #f0f0f0;
- border-top: solid 1rpx #f0f0f0;
- margin-top: 32rpx;
- margin-bottom: 32rpx;
-}
-
-.rate-wrapper {
- display: flex;
- justify-content: center;
-}
-
-.desc {
- text-align: center;
- margin-top: 24rpx;
-}
-
-.desc--active {
- color: #ED7B2F;
- font-weight: 600;
-}
\ No newline at end of file
diff --git a/pages/rate/un-filled/index.js b/pages/rate/un-filled/index.js
deleted file mode 100644
index 5a116c0..0000000
--- a/pages/rate/un-filled/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-Component({
- data: {
- value: 3,
- },
- methods: {
- onChange(e) {
- const { value } = e.detail;
- this.setData({
- value,
- });
- },
- },
-});
diff --git a/pages/rate/un-filled/index.json b/pages/rate/un-filled/index.json
deleted file mode 100644
index 724692f..0000000
--- a/pages/rate/un-filled/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-rate": "tdesign-miniprogram/rate/rate"
- }
-}
diff --git a/pages/rate/un-filled/index.wxml b/pages/rate/un-filled/index.wxml
deleted file mode 100644
index 63c426f..0000000
--- a/pages/rate/un-filled/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
- 请点击评分
-
-
-
diff --git a/pages/rate/un-filled/index.wxss b/pages/rate/un-filled/index.wxss
deleted file mode 100644
index fa9dce3..0000000
--- a/pages/rate/un-filled/index.wxss
+++ /dev/null
@@ -1,23 +0,0 @@
-.demo-rate {
- background-color: #fff;
-
- height: 96rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 32rpx;
- border-bottom: solid 1rpx #f0f0f0;
- border-top: solid 1rpx #f0f0f0;
- margin-top: 32rpx;
- margin-bottom: 32rpx;
-}
-
-.demo-rate__title {
- width: 200rpx;
-}
-
-.demo-rate__transparent {
- background-color: transparent;
- padding-left: 32rpx;
- border: 0;
-}
diff --git a/pages/result/custom/index.js b/pages/result/custom/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/result/custom/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/result/custom/index.json b/pages/result/custom/index.json
deleted file mode 100644
index 62ae93f..0000000
--- a/pages/result/custom/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-result": "tdesign-miniprogram/result/result"
- }
-}
diff --git a/pages/result/custom/index.wxml b/pages/result/custom/index.wxml
deleted file mode 100644
index ab392c3..0000000
--- a/pages/result/custom/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
- 自定义结果
- 描述文字
-
diff --git a/pages/result/custom/index.wxss b/pages/result/custom/index.wxss
deleted file mode 100644
index a2b5e93..0000000
--- a/pages/result/custom/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.external-class-image {
- width: 100px;
- height: 80px;
-}
diff --git a/pages/result/description/index.js b/pages/result/description/index.js
deleted file mode 100644
index c12d8f5..0000000
--- a/pages/result/description/index.js
+++ /dev/null
@@ -1,26 +0,0 @@
-Component({
- data: {
- resultList: [
- {
- title: '成功状态',
- theme: 'success',
- description: '描述文字',
- },
- {
- title: '失败状态',
- theme: 'error',
- description: '描述文字',
- },
- {
- title: '警示状态',
- theme: 'warning',
- description: '描述文字',
- },
- {
- title: '默认状态',
- theme: 'default',
- description: '描述文字',
- },
- ],
- },
-});
diff --git a/pages/result/description/index.json b/pages/result/description/index.json
deleted file mode 100644
index 62ae93f..0000000
--- a/pages/result/description/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-result": "tdesign-miniprogram/result/result"
- }
-}
diff --git a/pages/result/description/index.wxml b/pages/result/description/index.wxml
deleted file mode 100644
index 8597e58..0000000
--- a/pages/result/description/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/result/description/index.wxss b/pages/result/description/index.wxss
deleted file mode 100644
index 40d7b8c..0000000
--- a/pages/result/description/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.demo-section__content {
- margin-bottom: 96rpx;
-}
diff --git a/pages/result/result-page.d.ts b/pages/result/result-page.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/result/result-page.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/result/result-page.js b/pages/result/result-page.js
deleted file mode 100644
index 1faf107..0000000
--- a/pages/result/result-page.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Page({
- goBack() {
- wx.navigateBack({ delta: 1 });
- },
-});
diff --git a/pages/result/result-page.json b/pages/result/result-page.json
deleted file mode 100644
index cd4c326..0000000
--- a/pages/result/result-page.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "navigationBarTitleText": "Result Page",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-result": "tdesign-miniprogram/result/result"
- }
-}
diff --git a/pages/result/result-page.wxml b/pages/result/result-page.wxml
deleted file mode 100644
index a0073fe..0000000
--- a/pages/result/result-page.wxml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
- 返回
-
-
diff --git a/pages/result/result-page.wxss b/pages/result/result-page.wxss
deleted file mode 100644
index 2d488d4..0000000
--- a/pages/result/result-page.wxss
+++ /dev/null
@@ -1,6 +0,0 @@
-page {
- background-color: #fff;
-}
-page .demo-section__wrapper {
- padding: 48rpx 32rpx;
-}
diff --git a/pages/result/result.d.ts b/pages/result/result.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/result/result.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/result/result.js b/pages/result/result.js
deleted file mode 100644
index 0ad7262..0000000
--- a/pages/result/result.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Page({
- goResultPage() {
- wx.navigateTo({ url: './result-page' });
- },
-});
diff --git a/pages/result/result.json b/pages/result/result.json
deleted file mode 100644
index e178d0a..0000000
--- a/pages/result/result.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "navigationBarTitleText": "Result",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "theme": "./theme",
- "description": "./description",
- "custom": "./custom"
- }
-}
diff --git a/pages/result/result.wxml b/pages/result/result.wxml
deleted file mode 100644
index 937a94a..0000000
--- a/pages/result/result.wxml
+++ /dev/null
@@ -1,18 +0,0 @@
-
- Result 结果
- 用于反馈不同结果的展示。
-
-
-
-
-
-
-
-
-
-
-
- 页面示例
-
-
-
diff --git a/pages/result/result.wxss b/pages/result/result.wxss
deleted file mode 100644
index eb52c36..0000000
--- a/pages/result/result.wxss
+++ /dev/null
@@ -1,6 +0,0 @@
-page {
- background-color: #fff;
-}
-page .demo-section__wrapper {
- padding: 0 32rpx;
-}
diff --git a/pages/result/theme/index.js b/pages/result/theme/index.js
deleted file mode 100644
index 45c02b5..0000000
--- a/pages/result/theme/index.js
+++ /dev/null
@@ -1,22 +0,0 @@
-Component({
- data: {
- resultList: [
- {
- title: '成功状态',
- theme: 'success',
- },
- {
- title: '失败状态',
- theme: 'error',
- },
- {
- title: '警示状态',
- theme: 'warning',
- },
- {
- title: '默认状态',
- theme: 'default',
- },
- ],
- },
-});
diff --git a/pages/result/theme/index.json b/pages/result/theme/index.json
deleted file mode 100644
index 62ae93f..0000000
--- a/pages/result/theme/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-result": "tdesign-miniprogram/result/result"
- }
-}
diff --git a/pages/result/theme/index.wxml b/pages/result/theme/index.wxml
deleted file mode 100644
index bf60b0b..0000000
--- a/pages/result/theme/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/result/theme/index.wxss b/pages/result/theme/index.wxss
deleted file mode 100644
index 40d7b8c..0000000
--- a/pages/result/theme/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.demo-section__content {
- margin-bottom: 96rpx;
-}
diff --git a/pages/search/action/index.js b/pages/search/action/index.js
deleted file mode 100644
index 99c9a5f..0000000
--- a/pages/search/action/index.js
+++ /dev/null
@@ -1,34 +0,0 @@
-Component({
- data: {
- value: '',
- actionText: '',
- },
-
- methods: {
- changeHandle(e) {
- const { value } = e.detail;
- this.setData({
- value,
- });
- },
-
- focusHandle() {
- this.setData({
- actionText: '取消',
- });
- },
-
- blurHandle() {
- this.setData({
- actionText: '',
- });
- },
-
- actionHandle() {
- this.setData({
- value: '',
- actionText: '',
- });
- },
- },
-});
diff --git a/pages/search/action/index.json b/pages/search/action/index.json
deleted file mode 100644
index 3d604b8..0000000
--- a/pages/search/action/index.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "usingComponents": {
- "t-search": "tdesign-miniprogram/search/search"
- }
-}
diff --git a/pages/search/action/index.wxml b/pages/search/action/index.wxml
deleted file mode 100644
index 12cb35e..0000000
--- a/pages/search/action/index.wxml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
diff --git a/pages/search/action/index.wxss b/pages/search/action/index.wxss
deleted file mode 100644
index a5f17d7..0000000
--- a/pages/search/action/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.example-search {
- background-color: #fff;
- padding: 16rpx 32rpx;
-}
diff --git a/pages/search/base/index.js b/pages/search/base/index.js
deleted file mode 100644
index d6ebd8e..0000000
--- a/pages/search/base/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- value: '',
- },
-});
diff --git a/pages/search/base/index.json b/pages/search/base/index.json
deleted file mode 100644
index 3d604b8..0000000
--- a/pages/search/base/index.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "usingComponents": {
- "t-search": "tdesign-miniprogram/search/search"
- }
-}
diff --git a/pages/search/base/index.wxml b/pages/search/base/index.wxml
deleted file mode 100644
index 5ec1800..0000000
--- a/pages/search/base/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/search/base/index.wxss b/pages/search/base/index.wxss
deleted file mode 100644
index a5f17d7..0000000
--- a/pages/search/base/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.example-search {
- background-color: #fff;
- padding: 16rpx 32rpx;
-}
diff --git a/pages/search/other/index.js b/pages/search/other/index.js
deleted file mode 100644
index e3d9a5c..0000000
--- a/pages/search/other/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-Component({
- data: {
- value: '',
- },
-
- methods: {
- onChange({ detail }) {
- console.log(`modelValue: ${detail.value}`);
- },
- },
-});
diff --git a/pages/search/other/index.json b/pages/search/other/index.json
deleted file mode 100644
index 3d604b8..0000000
--- a/pages/search/other/index.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "usingComponents": {
- "t-search": "tdesign-miniprogram/search/search"
- }
-}
diff --git a/pages/search/other/index.wxml b/pages/search/other/index.wxml
deleted file mode 100644
index 16e76ec..0000000
--- a/pages/search/other/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/search/other/index.wxss b/pages/search/other/index.wxss
deleted file mode 100644
index a5f17d7..0000000
--- a/pages/search/other/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.example-search {
- background-color: #fff;
- padding: 16rpx 32rpx;
-}
diff --git a/pages/search/search.d.ts b/pages/search/search.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/search/search.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/search/search.js b/pages/search/search.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/search/search.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/search/search.json b/pages/search/search.json
deleted file mode 100644
index 989a605..0000000
--- a/pages/search/search.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarTitleText": "Search",
- "usingComponents": {
- "base": "./base",
- "action": "./action",
- "shape": "./shape",
- "other": "./other"
- }
-}
diff --git a/pages/search/search.wxml b/pages/search/search.wxml
deleted file mode 100644
index e1edc7e..0000000
--- a/pages/search/search.wxml
+++ /dev/null
@@ -1,16 +0,0 @@
-
- Search 搜索框
- 用于用户输入搜索信息,并进行页面内容搜索。
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/search/search.wxss b/pages/search/search.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/search/shape/index.js b/pages/search/shape/index.js
deleted file mode 100644
index d8541fe..0000000
--- a/pages/search/shape/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
- data: {
- value: '',
- },
- methods: {
- onChange(e) {
- console.log(e.detail.value);
- },
- },
-});
diff --git a/pages/search/shape/index.json b/pages/search/shape/index.json
deleted file mode 100644
index 3d604b8..0000000
--- a/pages/search/shape/index.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "usingComponents": {
- "t-search": "tdesign-miniprogram/search/search"
- }
-}
diff --git a/pages/search/shape/index.wxml b/pages/search/shape/index.wxml
deleted file mode 100644
index 1e5e644..0000000
--- a/pages/search/shape/index.wxml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/pages/search/shape/index.wxss b/pages/search/shape/index.wxss
deleted file mode 100644
index 6bdbfed..0000000
--- a/pages/search/shape/index.wxss
+++ /dev/null
@@ -1,8 +0,0 @@
-.example-search {
- background-color: #fff;
- padding: 16rpx 32rpx;
-}
-
-.example-search:not(:last-child) {
- margin-bottom: 32rpx;
-}
diff --git a/pages/side-bar/base/index.js b/pages/side-bar/base/index.js
deleted file mode 100644
index 50b43a7..0000000
--- a/pages/side-bar/base/index.js
+++ /dev/null
@@ -1,78 +0,0 @@
-const image = 'https://tdesign.gtimg.com/miniprogram/images/example2.png';
-const items = new Array(12).fill({ label: '标题文字', image }, 0, 12);
-
-Page({
- offsetTopList: [],
- data: {
- sideBarIndex: 1,
- scrollTop: 0,
- categories: [
- {
- label: '选项一',
- title: '标题一',
- badgeProps: {},
- items,
- },
- {
- label: '选项二',
- title: '标题二',
- badgeProps: {
- dot: true,
- },
- items: items.slice(0, 9),
- },
- {
- label: '选项三',
- title: '标题三',
- badgeProps: {},
- items: items.slice(0, 9),
- },
- {
- label: '选项四',
- title: '标题四',
- badgeProps: {
- count: 6,
- },
- items: items.slice(0, 6),
- },
- {
- label: '选项五',
- title: '标题五',
- badgeProps: {},
- items: items.slice(0, 3),
- },
- ],
- },
- onLoad() {
- const query = wx.createSelectorQuery().in(this);
- const { sideBarIndex } = this.data;
-
- query
- .selectAll('.title')
- .boundingClientRect((rects) => {
- this.offsetTopList = rects.map((item) => item.top);
- this.setData({ scrollTop: rects[sideBarIndex].top });
- })
- .exec();
- },
- onSideBarChange(e) {
- const { value } = e.detail;
-
- this.setData({ sideBarIndex: value, scrollTop: this.offsetTopList[value] });
- },
- onScroll(e) {
- const { scrollTop } = e.detail;
- const threshold = 50; // 下一个标题与顶部的距离
-
- if (scrollTop < threshold) {
- this.setData({ sideBarIndex: 0 });
- return;
- }
-
- const index = this.offsetTopList.findIndex((top) => top > scrollTop && top - scrollTop <= threshold);
-
- if (index > -1) {
- this.setData({ sideBarIndex: index });
- }
- },
-});
diff --git a/pages/side-bar/base/index.json b/pages/side-bar/base/index.json
deleted file mode 100644
index eb9d73f..0000000
--- a/pages/side-bar/base/index.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "t-side-bar": "tdesign-miniprogram/side-bar/side-bar",
- "t-side-bar-item": "tdesign-miniprogram/side-bar-item/side-bar-item",
- "t-grid": "tdesign-miniprogram/grid/grid",
- "t-grid-item": "tdesign-miniprogram/grid-item/grid-item"
- }
-}
diff --git a/pages/side-bar/base/index.wxml b/pages/side-bar/base/index.wxml
deleted file mode 100644
index 0201c1d..0000000
--- a/pages/side-bar/base/index.wxml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
- {{item.title || item.label}}
-
-
-
-
-
-
-
-
-
diff --git a/pages/side-bar/base/index.wxss b/pages/side-bar/base/index.wxss
deleted file mode 100644
index fe68d7a..0000000
--- a/pages/side-bar/base/index.wxss
+++ /dev/null
@@ -1,31 +0,0 @@
-page {
- background-color: #fff;
-}
-
-page .round-image {
- border-radius: 12rpx;
-}
-
-.side-bar-wrapper {
- display: flex;
- height: 100vh;
-}
-
-.side-bar-wrapper .content {
- flex: 1;
-}
-
-.side-bar-wrapper .section {
- padding: 32rpx 0;
-}
-
-.side-bar-wrapper .title {
- padding-left: 40rpx;
- margin-bottom: 8rpx;
- line-height: 52rpx;
-}
-
-.side-bar-wrapper .image {
- width: 96rpx;
- height: 96rpx;
-}
diff --git a/pages/side-bar/custom/index.js b/pages/side-bar/custom/index.js
deleted file mode 100644
index 0c8a087..0000000
--- a/pages/side-bar/custom/index.js
+++ /dev/null
@@ -1,78 +0,0 @@
-const image = 'https://tdesign.gtimg.com/miniprogram/images/example1.png';
-const items = new Array(12).fill({ label: '标题文字', image }, 0, 12);
-
-Page({
- offsetTopList: [],
- data: {
- sideBarIndex: 1,
- scrollTop: 0,
- categories: [
- {
- label: '选项一',
- title: '标题一',
- badgeProps: {},
- items,
- },
- {
- label: '选项二',
- title: '标题二',
- badgeProps: {
- dot: true,
- },
- items: items.slice(0, 9),
- },
- {
- label: '选项三',
- title: '标题三',
- badgeProps: {},
- items: items.slice(0, 9),
- },
- {
- label: '选项四',
- title: '标题四',
- badgeProps: {
- count: 6,
- },
- items: items.slice(0, 6),
- },
- {
- label: '选项五',
- title: '标题五',
- badgeProps: {},
- items: items.slice(0, 3),
- },
- ],
- },
- onLoad() {
- const query = wx.createSelectorQuery().in(this);
- const { sideBarIndex } = this.data;
-
- query
- .selectAll('.title')
- .boundingClientRect((rects) => {
- this.offsetTopList = rects.map((item) => item.top);
- this.setData({ scrollTop: rects[sideBarIndex].top });
- })
- .exec();
- },
- onSideBarChange(e) {
- const { value } = e.detail;
-
- this.setData({ sideBarIndex: value, scrollTop: this.offsetTopList[value] });
- },
- onScroll(e) {
- const { scrollTop } = e.detail;
- const threshold = 50; // 下一个标题与顶部的距离
-
- if (scrollTop < threshold) {
- this.setData({ sideBarIndex: 0 });
- return;
- }
-
- const index = this.offsetTopList.findIndex((top) => top > scrollTop && top - scrollTop <= threshold);
-
- if (index > -1) {
- this.setData({ sideBarIndex: index });
- }
- },
-});
diff --git a/pages/side-bar/custom/index.json b/pages/side-bar/custom/index.json
deleted file mode 100644
index eb9d73f..0000000
--- a/pages/side-bar/custom/index.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "t-side-bar": "tdesign-miniprogram/side-bar/side-bar",
- "t-side-bar-item": "tdesign-miniprogram/side-bar-item/side-bar-item",
- "t-grid": "tdesign-miniprogram/grid/grid",
- "t-grid-item": "tdesign-miniprogram/grid-item/grid-item"
- }
-}
diff --git a/pages/side-bar/custom/index.wxml b/pages/side-bar/custom/index.wxml
deleted file mode 100644
index 0201c1d..0000000
--- a/pages/side-bar/custom/index.wxml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
- {{item.title || item.label}}
-
-
-
-
-
-
-
-
-
diff --git a/pages/side-bar/custom/index.wxss b/pages/side-bar/custom/index.wxss
deleted file mode 100644
index 9ba9734..0000000
--- a/pages/side-bar/custom/index.wxss
+++ /dev/null
@@ -1,36 +0,0 @@
-page {
- background-color: #fff;
-}
-
-page .round-image {
- border-radius: 12rpx;
-}
-
-.side-bar-wrapper {
- display: flex;
- height: 100vh;
-}
-
-.side-bar-wrapper .content {
- flex: 1;
-}
-
-.side-bar-wrapper .section {
- padding: 32rpx 0;
-}
-
-.side-bar-wrapper .title {
- padding-left: 40rpx;
- margin-bottom: 8rpx;
- line-height: 52rpx;
-}
-
-.side-bar-wrapper .image {
- width: 96rpx;
- height: 96rpx;
-}
-
-page .side-bar-wrapper {
- --td-side-bar-border-radius: 6px;
- --td-side-bar-active-color: green;
-}
\ No newline at end of file
diff --git a/pages/side-bar/side-bar.js b/pages/side-bar/side-bar.js
deleted file mode 100644
index dc7dea6..0000000
--- a/pages/side-bar/side-bar.js
+++ /dev/null
@@ -1,9 +0,0 @@
-Page({
- toNavigation(e) {
- const { target } = e.target.dataset;
-
- wx.navigateTo({
- url: `./${target}/index`,
- });
- },
-});
diff --git a/pages/side-bar/side-bar.json b/pages/side-bar/side-bar.json
deleted file mode 100644
index b552469..0000000
--- a/pages/side-bar/side-bar.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "navigationBarTitleText": "SideBar",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {}
-}
diff --git a/pages/side-bar/side-bar.wxml b/pages/side-bar/side-bar.wxml
deleted file mode 100644
index b466162..0000000
--- a/pages/side-bar/side-bar.wxml
+++ /dev/null
@@ -1,23 +0,0 @@
-SideBar 侧边栏
-用于内容分类后的展示切换。
-
-
- 锚点用法
-
-
-
- 切页用法
-
-
-
-
-
- 带图标侧边导航
-
-
-
-
-
- 自定义样式
-
-
diff --git a/pages/side-bar/side-bar.wxss b/pages/side-bar/side-bar.wxss
deleted file mode 100644
index c6f5637..0000000
--- a/pages/side-bar/side-bar.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-page {
- background-color: #fff;
-}
-
-.t-button {
- margin-top: 32rpx;
-}
diff --git a/pages/side-bar/switch/index.js b/pages/side-bar/switch/index.js
deleted file mode 100644
index 7445a6c..0000000
--- a/pages/side-bar/switch/index.js
+++ /dev/null
@@ -1,52 +0,0 @@
-const image = 'https://tdesign.gtimg.com/miniprogram/images/example2.png';
-const items = new Array(12).fill({ label: '标题文字', image }, 0, 12);
-
-Page({
- offsetTopList: [],
- data: {
- sideBarIndex: 1,
- scrollTop: 0,
- categories: [
- {
- label: '选项一',
- title: '标题一',
- badgeProps: {},
- items,
- },
- {
- label: '选项二',
- title: '标题二',
- badgeProps: {
- dot: true,
- },
- items: items.slice(0, 10),
- },
- {
- label: '选项三',
- title: '标题三',
- badgeProps: {},
- items: items.slice(0, 6),
- },
- {
- label: '选项四',
- title: '标题四',
- badgeProps: {
- count: 8,
- },
- items: items.slice(0, 8),
- },
- {
- label: '选项五',
- title: '标题五',
- badgeProps: {},
- disabled: true,
- items: [],
- },
- ],
- },
- onSideBarChange(e) {
- const { value } = e.detail;
-
- this.setData({ sideBarIndex: value });
- },
-});
diff --git a/pages/side-bar/switch/index.json b/pages/side-bar/switch/index.json
deleted file mode 100644
index ee7a25f..0000000
--- a/pages/side-bar/switch/index.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "t-side-bar": "tdesign-miniprogram/side-bar/side-bar",
- "t-side-bar-item": "tdesign-miniprogram/side-bar-item/side-bar-item",
- "t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-image": "tdesign-miniprogram/image/image"
- }
-}
diff --git a/pages/side-bar/switch/index.wxml b/pages/side-bar/switch/index.wxml
deleted file mode 100644
index 94a35c7..0000000
--- a/pages/side-bar/switch/index.wxml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
- {{item.title || item.label}}
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/side-bar/switch/index.wxss b/pages/side-bar/switch/index.wxss
deleted file mode 100644
index 045c02b..0000000
--- a/pages/side-bar/switch/index.wxss
+++ /dev/null
@@ -1,35 +0,0 @@
-page {
- background-color: #fff;
-}
-
-page .round-image {
- border-radius: 12rpx;
-}
-
-.side-bar-wrapper {
- display: flex;
- height: 100vh;
- overflow: hidden;
-}
-
-.side-bar-wrapper .content {
- flex: 1;
- transition: transform 0.3s ease;
-}
-
-.side-bar-wrapper .section {
- padding: 32rpx 0;
- box-sizing: border-box;
- height: 100%;
-}
-
-.side-bar-wrapper .title {
- padding-left: 40rpx;
- margin-bottom: 8rpx;
-}
-
-.side-bar-wrapper .image {
- width: 96rpx;
- height: 96rpx;
- border: 2rpx solid #e7e7e7;
-}
diff --git a/pages/side-bar/with-icon/index.js b/pages/side-bar/with-icon/index.js
deleted file mode 100644
index 27679c6..0000000
--- a/pages/side-bar/with-icon/index.js
+++ /dev/null
@@ -1,83 +0,0 @@
-const image = 'https://tdesign.gtimg.com/miniprogram/images/example2.png';
-const items = new Array(12).fill({ label: '标题文字', image }, 0, 12);
-
-Page({
- offsetTopList: [],
- data: {
- sideBarIndex: 1,
- scrollTop: 0,
- categories: [
- {
- label: '选项一',
- title: '标题一',
- icon: 'app',
- badgeProps: {},
- items,
- },
- {
- label: '选项二',
- title: '标题二',
- icon: 'app',
- badgeProps: {
- dot: true,
- },
- items: items.slice(0, 9),
- },
- {
- label: '选项三',
- title: '标题三',
- icon: 'app',
- badgeProps: {},
- items: items.slice(0, 9),
- },
- {
- label: '选项四',
- title: '标题四',
- icon: 'app',
- badgeProps: {
- count: 6,
- },
- items: items.slice(0, 6),
- },
- {
- label: '选项五',
- title: '标题五',
- icon: 'app',
- badgeProps: {},
- items: items.slice(0, 3),
- },
- ],
- },
- onLoad() {
- const query = wx.createSelectorQuery().in(this);
- const { sideBarIndex } = this.data;
-
- query
- .selectAll('.title')
- .boundingClientRect((rects) => {
- this.offsetTopList = rects.map((item) => item.top);
- this.setData({ scrollTop: rects[sideBarIndex].top });
- })
- .exec();
- },
- onSideBarChange(e) {
- const { value } = e.detail;
-
- this.setData({ sideBarIndex: value, scrollTop: this.offsetTopList[value] });
- },
- onScroll(e) {
- const { scrollTop } = e.detail;
- const threshold = 50; // 下一个标题与顶部的距离
-
- if (scrollTop < threshold) {
- this.setData({ sideBarIndex: 0 });
- return;
- }
-
- const index = this.offsetTopList.findIndex((top) => top > scrollTop && top - scrollTop <= threshold);
-
- if (index > -1) {
- this.setData({ sideBarIndex: index });
- }
- },
-});
diff --git a/pages/side-bar/with-icon/index.json b/pages/side-bar/with-icon/index.json
deleted file mode 100644
index eb9d73f..0000000
--- a/pages/side-bar/with-icon/index.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "t-side-bar": "tdesign-miniprogram/side-bar/side-bar",
- "t-side-bar-item": "tdesign-miniprogram/side-bar-item/side-bar-item",
- "t-grid": "tdesign-miniprogram/grid/grid",
- "t-grid-item": "tdesign-miniprogram/grid-item/grid-item"
- }
-}
diff --git a/pages/side-bar/with-icon/index.wxml b/pages/side-bar/with-icon/index.wxml
deleted file mode 100644
index 36ff341..0000000
--- a/pages/side-bar/with-icon/index.wxml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
- {{item.title || item.label}}
-
-
-
-
-
-
-
-
-
diff --git a/pages/side-bar/with-icon/index.wxss b/pages/side-bar/with-icon/index.wxss
deleted file mode 100644
index fe68d7a..0000000
--- a/pages/side-bar/with-icon/index.wxss
+++ /dev/null
@@ -1,31 +0,0 @@
-page {
- background-color: #fff;
-}
-
-page .round-image {
- border-radius: 12rpx;
-}
-
-.side-bar-wrapper {
- display: flex;
- height: 100vh;
-}
-
-.side-bar-wrapper .content {
- flex: 1;
-}
-
-.side-bar-wrapper .section {
- padding: 32rpx 0;
-}
-
-.side-bar-wrapper .title {
- padding-left: 40rpx;
- margin-bottom: 8rpx;
- line-height: 52rpx;
-}
-
-.side-bar-wrapper .image {
- width: 96rpx;
- height: 96rpx;
-}
diff --git a/pages/skeleton/animation/index.js b/pages/skeleton/animation/index.js
deleted file mode 100644
index ce5e1cd..0000000
--- a/pages/skeleton/animation/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-Component({
- data: {
- animationList: [
- {
- title: '渐变加载效果',
- value: 'gradient',
- loading: true,
- },
- {
- title: '闪烁加载效果',
- value: 'flashed',
- loading: true,
- },
- ],
- },
-});
diff --git a/pages/skeleton/animation/index.json b/pages/skeleton/animation/index.json
deleted file mode 100644
index ce39d3a..0000000
--- a/pages/skeleton/animation/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-skeleton": "tdesign-miniprogram/skeleton/skeleton"
- }
-}
diff --git a/pages/skeleton/animation/index.wxml b/pages/skeleton/animation/index.wxml
deleted file mode 100644
index 8c09794..0000000
--- a/pages/skeleton/animation/index.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
- {{animationItem.title}}
-
-
-
-
diff --git a/pages/skeleton/animation/index.wxss b/pages/skeleton/animation/index.wxss
deleted file mode 100644
index b451d5a..0000000
--- a/pages/skeleton/animation/index.wxss
+++ /dev/null
@@ -1,11 +0,0 @@
-.demo-section__desc {
- font-size: 28rpx;
- color: rgba(0, 0, 0, 0.4);
- margin-top: 16rpx;
- line-height: 44rpx;
-}
-
-.demo-section__content {
- margin-top: 32rpx;
- margin-bottom: 48rpx;
-}
diff --git a/pages/skeleton/cell-group/index.js b/pages/skeleton/cell-group/index.js
deleted file mode 100644
index 25422a1..0000000
--- a/pages/skeleton/cell-group/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Component({
- data: {
- rowColsAvater: [{ size: '48px', type: 'circle' }],
- rowColsImage: [{ size: '48px', type: 'rect' }],
- rowColsContent: [{ width: '50%' }, { width: '100%' }],
- },
-});
diff --git a/pages/skeleton/cell-group/index.json b/pages/skeleton/cell-group/index.json
deleted file mode 100644
index ce39d3a..0000000
--- a/pages/skeleton/cell-group/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-skeleton": "tdesign-miniprogram/skeleton/skeleton"
- }
-}
diff --git a/pages/skeleton/cell-group/index.wxml b/pages/skeleton/cell-group/index.wxml
deleted file mode 100644
index 4f67db3..0000000
--- a/pages/skeleton/cell-group/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/pages/skeleton/cell-group/index.wxss b/pages/skeleton/cell-group/index.wxss
deleted file mode 100644
index 7dfbc78..0000000
--- a/pages/skeleton/cell-group/index.wxss
+++ /dev/null
@@ -1,13 +0,0 @@
-.group {
- display: flex;
- align-items: center;
- margin-top: 32rpx;
-}
-
-.group-avatar {
- margin-right: 24rpx;
-}
-
-.group-content {
- width: 566rpx;
-}
diff --git a/pages/skeleton/grid/index.js b/pages/skeleton/grid/index.js
deleted file mode 100644
index 5554e46..0000000
--- a/pages/skeleton/grid/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-Component({
- data: {
- grid: [
- [
- { width: '48px', height: '48px', borderRadius: '6px' },
- { width: '48px', height: '48px', borderRadius: '6px' },
- { width: '48px', height: '48px', borderRadius: '6px' },
- { width: '48px', height: '48px', borderRadius: '6px' },
- { width: '48px', height: '48px', borderRadius: '6px' },
- ],
- [
- { width: '48px', height: '16px', borderRadius: '3px' },
- { width: '48px', height: '16px', borderRadius: '3px' },
- { width: '48px', height: '16px', borderRadius: '3px' },
- { width: '48px', height: '16px', borderRadius: '3px' },
- { width: '48px', height: '16px', borderRadius: '3px' },
- ],
- ],
- },
-});
diff --git a/pages/skeleton/grid/index.json b/pages/skeleton/grid/index.json
deleted file mode 100644
index ce39d3a..0000000
--- a/pages/skeleton/grid/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-skeleton": "tdesign-miniprogram/skeleton/skeleton"
- }
-}
diff --git a/pages/skeleton/grid/index.wxml b/pages/skeleton/grid/index.wxml
deleted file mode 100644
index 0389908..0000000
--- a/pages/skeleton/grid/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/skeleton/grid/index.wxss b/pages/skeleton/grid/index.wxss
deleted file mode 100644
index 021b42f..0000000
--- a/pages/skeleton/grid/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.wrapper {
- --td-skeleton-row-spacing: 20rpx;
- margin-top: 32rpx;
-}
diff --git a/pages/skeleton/image-group/index.js b/pages/skeleton/image-group/index.js
deleted file mode 100644
index a8172f4..0000000
--- a/pages/skeleton/image-group/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- rowCol: [{ size: '163.5px', borderRadius: '12px' }, 1, { width: '61%' }],
- },
-});
diff --git a/pages/skeleton/image-group/index.json b/pages/skeleton/image-group/index.json
deleted file mode 100644
index ce39d3a..0000000
--- a/pages/skeleton/image-group/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-skeleton": "tdesign-miniprogram/skeleton/skeleton"
- }
-}
diff --git a/pages/skeleton/image-group/index.wxml b/pages/skeleton/image-group/index.wxml
deleted file mode 100644
index 095abed..0000000
--- a/pages/skeleton/image-group/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/pages/skeleton/image-group/index.wxss b/pages/skeleton/image-group/index.wxss
deleted file mode 100644
index 1ba397a..0000000
--- a/pages/skeleton/image-group/index.wxss
+++ /dev/null
@@ -1,5 +0,0 @@
-.group {
- display: flex;
- justify-content: space-between;
- margin-top: 32rpx;
-}
diff --git a/pages/skeleton/skeleton.d.ts b/pages/skeleton/skeleton.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/skeleton/skeleton.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/skeleton/skeleton.js b/pages/skeleton/skeleton.js
deleted file mode 100644
index 9eeb530..0000000
--- a/pages/skeleton/skeleton.js
+++ /dev/null
@@ -1,26 +0,0 @@
-Page({
- data: {
- themeList: [
- {
- title: '头像骨架屏',
- value: 'avatar',
- loading: true,
- },
- {
- title: '图片骨架屏',
- value: 'image',
- loading: true,
- },
- {
- title: '文本骨架屏',
- value: 'text',
- loading: true,
- },
- {
- title: '段落骨架屏',
- value: 'paragraph',
- loading: true,
- },
- ],
- },
-});
diff --git a/pages/skeleton/skeleton.json b/pages/skeleton/skeleton.json
deleted file mode 100644
index 4165b42..0000000
--- a/pages/skeleton/skeleton.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "navigationBarTitleText": "Skeleton",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "t-skeleton": "tdesign-miniprogram/skeleton/skeleton",
- "theme": "./theme",
- "grid": "./grid",
- "cell-group": "./cell-group",
- "image-group": "./image-group",
- "animation": "./animation"
- }
-}
diff --git a/pages/skeleton/skeleton.wxml b/pages/skeleton/skeleton.wxml
deleted file mode 100644
index f4f19c5..0000000
--- a/pages/skeleton/skeleton.wxml
+++ /dev/null
@@ -1,23 +0,0 @@
-
- Skeleton 骨架屏
- 用于等待加载内容所展示的占位图形组合,有动态效果加载效果,减少用户等待焦虑。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/skeleton/skeleton.wxss b/pages/skeleton/skeleton.wxss
deleted file mode 100644
index 23062cc..0000000
--- a/pages/skeleton/skeleton.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-page {
- background-color: #fff;
-}
diff --git a/pages/skeleton/theme/index.js b/pages/skeleton/theme/index.js
deleted file mode 100644
index 7d12426..0000000
--- a/pages/skeleton/theme/index.js
+++ /dev/null
@@ -1,26 +0,0 @@
-Component({
- data: {
- themeList: [
- {
- title: '头像骨架屏',
- value: 'avatar',
- loading: true,
- },
- {
- title: '图片骨架屏',
- value: 'image',
- loading: true,
- },
- {
- title: '文本骨架屏',
- value: 'text',
- loading: true,
- },
- {
- title: '段落骨架屏',
- value: 'paragraph',
- loading: true,
- },
- ],
- },
-});
diff --git a/pages/skeleton/theme/index.json b/pages/skeleton/theme/index.json
deleted file mode 100644
index ce39d3a..0000000
--- a/pages/skeleton/theme/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-skeleton": "tdesign-miniprogram/skeleton/skeleton"
- }
-}
diff --git a/pages/skeleton/theme/index.wxml b/pages/skeleton/theme/index.wxml
deleted file mode 100644
index 79b9b7d..0000000
--- a/pages/skeleton/theme/index.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
- {{themeItem.title}}
-
-
-
-
diff --git a/pages/skeleton/theme/index.wxss b/pages/skeleton/theme/index.wxss
deleted file mode 100644
index b451d5a..0000000
--- a/pages/skeleton/theme/index.wxss
+++ /dev/null
@@ -1,11 +0,0 @@
-.demo-section__desc {
- font-size: 28rpx;
- color: rgba(0, 0, 0, 0.4);
- margin-top: 16rpx;
- line-height: 44rpx;
-}
-
-.demo-section__content {
- margin-top: 32rpx;
- margin-bottom: 48rpx;
-}
diff --git a/pages/slider/base/index.js b/pages/slider/base/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/slider/base/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/slider/base/index.json b/pages/slider/base/index.json
deleted file mode 100644
index 0a25073..0000000
--- a/pages/slider/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-slider": "tdesign-miniprogram/slider/slider"
- }
-}
diff --git a/pages/slider/base/index.wxml b/pages/slider/base/index.wxml
deleted file mode 100644
index 6973914..0000000
--- a/pages/slider/base/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/slider/base/index.wxss b/pages/slider/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/slider/capsule/index.js b/pages/slider/capsule/index.js
deleted file mode 100644
index 6fbfda9..0000000
--- a/pages/slider/capsule/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-Component({
- data: {
- marks: {
- 0: '0',
- 20: '20',
- 40: '40',
- 60: '60',
- 80: '80',
- 100: '100',
- },
- },
-});
diff --git a/pages/slider/capsule/index.json b/pages/slider/capsule/index.json
deleted file mode 100644
index 0a25073..0000000
--- a/pages/slider/capsule/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-slider": "tdesign-miniprogram/slider/slider"
- }
-}
diff --git a/pages/slider/capsule/index.wxml b/pages/slider/capsule/index.wxml
deleted file mode 100644
index b74b693..0000000
--- a/pages/slider/capsule/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/pages/slider/capsule/index.wxss b/pages/slider/capsule/index.wxss
deleted file mode 100644
index 6e9c8ed..0000000
--- a/pages/slider/capsule/index.wxss
+++ /dev/null
@@ -1,10 +0,0 @@
-.label {
- display: flex;
- align-items: center;
- width: 718rpx;
- padding-left: 32rpx;
-}
-
-.label-class {
- flex-grow: 1;
-}
diff --git a/pages/slider/disabled/index.js b/pages/slider/disabled/index.js
deleted file mode 100644
index 6fbfda9..0000000
--- a/pages/slider/disabled/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-Component({
- data: {
- marks: {
- 0: '0',
- 20: '20',
- 40: '40',
- 60: '60',
- 80: '80',
- 100: '100',
- },
- },
-});
diff --git a/pages/slider/disabled/index.json b/pages/slider/disabled/index.json
deleted file mode 100644
index 0a25073..0000000
--- a/pages/slider/disabled/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-slider": "tdesign-miniprogram/slider/slider"
- }
-}
diff --git a/pages/slider/disabled/index.wxml b/pages/slider/disabled/index.wxml
deleted file mode 100644
index 5783651..0000000
--- a/pages/slider/disabled/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/pages/slider/disabled/index.wxss b/pages/slider/disabled/index.wxss
deleted file mode 100644
index 1fcb3e3..0000000
--- a/pages/slider/disabled/index.wxss
+++ /dev/null
@@ -1,5 +0,0 @@
-.wrapper {
- margin-top: 32rpx;
- background: #fff;
- padding-top: 40rpx;
-}
\ No newline at end of file
diff --git a/pages/slider/label/index.js b/pages/slider/label/index.js
deleted file mode 100644
index 55ef36d..0000000
--- a/pages/slider/label/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
-
- data: {
- value: 35,
- },
-
- methods: {
- handleChange(e) {
- this.setData({
- value: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/slider/label/index.json b/pages/slider/label/index.json
deleted file mode 100644
index 0a25073..0000000
--- a/pages/slider/label/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-slider": "tdesign-miniprogram/slider/slider"
- }
-}
diff --git a/pages/slider/label/index.wxml b/pages/slider/label/index.wxml
deleted file mode 100644
index bae5b48..0000000
--- a/pages/slider/label/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-带数值双游标滑块
-
-
-
-
diff --git a/pages/slider/label/index.wxss b/pages/slider/label/index.wxss
deleted file mode 100644
index 91db4a0..0000000
--- a/pages/slider/label/index.wxss
+++ /dev/null
@@ -1,9 +0,0 @@
-.demo-desc {
- margin-top: 24px;
- margin-bottom: 16px;
-}
-
-.wrapper {
- background: #fff;
- padding-top: 40rpx;
-}
\ No newline at end of file
diff --git a/pages/slider/max/index.js b/pages/slider/max/index.js
deleted file mode 100644
index d7c824d..0000000
--- a/pages/slider/max/index.js
+++ /dev/null
@@ -1,6 +0,0 @@
-Component({
- data: {
- /** 滑动条的颜色 */
- colors: ['#0052D9', '#E7E7E7'],
- },
-});
diff --git a/pages/slider/max/index.json b/pages/slider/max/index.json
deleted file mode 100644
index 0a25073..0000000
--- a/pages/slider/max/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-slider": "tdesign-miniprogram/slider/slider"
- }
-}
diff --git a/pages/slider/max/index.wxml b/pages/slider/max/index.wxml
deleted file mode 100644
index 5521f60..0000000
--- a/pages/slider/max/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/slider/max/index.wxss b/pages/slider/max/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/slider/range/index.js b/pages/slider/range/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/slider/range/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/slider/range/index.json b/pages/slider/range/index.json
deleted file mode 100644
index 0a25073..0000000
--- a/pages/slider/range/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-slider": "tdesign-miniprogram/slider/slider"
- }
-}
diff --git a/pages/slider/range/index.wxml b/pages/slider/range/index.wxml
deleted file mode 100644
index dd5b5f3..0000000
--- a/pages/slider/range/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/slider/range/index.wxss b/pages/slider/range/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/slider/slider.d.ts b/pages/slider/slider.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/slider/slider.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/slider/slider.js b/pages/slider/slider.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/slider/slider.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/slider/slider.json b/pages/slider/slider.json
deleted file mode 100644
index a927edc..0000000
--- a/pages/slider/slider.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "navigationBarTitleText": "Slider",
- "usingComponents": {
- "base": "./base",
- "label": "./label",
- "max": "./max",
- "step": "./step",
- "range": "./range",
- "disabled": "./disabled",
- "capsule": "./capsule"
- }
-}
diff --git a/pages/slider/slider.wxml b/pages/slider/slider.wxml
deleted file mode 100644
index 1126f27..0000000
--- a/pages/slider/slider.wxml
+++ /dev/null
@@ -1,31 +0,0 @@
-
- Slider 滑动选择器
- 用于选择横轴上的数值、区间、档位。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/slider/slider.wxss b/pages/slider/slider.wxss
deleted file mode 100644
index 43fbd98..0000000
--- a/pages/slider/slider.wxss
+++ /dev/null
@@ -1,15 +0,0 @@
-page {
- padding-bottom: 32rpx;
-}
-.t-slider {
- display: flex;
- align-items: center;
- background: #fff;
- padding: 32rpx 0;
-}
-.t-slider {
- flex: 1;
-}
-.t-slider + .t-slider {
- margin-top: 32rpx;
-}
diff --git a/pages/slider/step/index.js b/pages/slider/step/index.js
deleted file mode 100644
index aae9ba6..0000000
--- a/pages/slider/step/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
- data: {
- marks: {
- 0: '0',
- 20: '20',
- 40: '40',
- 60: '60',
- 80: '80',
- 100: '100',
- },
- },
- methods: {
- handleChange(e) {
- console.log(e);
- },
- },
-});
diff --git a/pages/slider/step/index.json b/pages/slider/step/index.json
deleted file mode 100644
index 0a25073..0000000
--- a/pages/slider/step/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-slider": "tdesign-miniprogram/slider/slider"
- }
-}
diff --git a/pages/slider/step/index.wxml b/pages/slider/step/index.wxml
deleted file mode 100644
index 66c1558..0000000
--- a/pages/slider/step/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-带刻度双游标滑块
-
-
-
-
diff --git a/pages/slider/step/index.wxss b/pages/slider/step/index.wxss
deleted file mode 100644
index 91db4a0..0000000
--- a/pages/slider/step/index.wxss
+++ /dev/null
@@ -1,9 +0,0 @@
-.demo-desc {
- margin-top: 24px;
- margin-bottom: 16px;
-}
-
-.wrapper {
- background: #fff;
- padding-top: 40rpx;
-}
\ No newline at end of file
diff --git a/pages/stepper/base/index.js b/pages/stepper/base/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/stepper/base/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/stepper/base/index.json b/pages/stepper/base/index.json
deleted file mode 100644
index cef723b..0000000
--- a/pages/stepper/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-stepper": "tdesign-miniprogram/stepper/stepper"
- }
-}
diff --git a/pages/stepper/base/index.wxml b/pages/stepper/base/index.wxml
deleted file mode 100644
index 819c2f8..0000000
--- a/pages/stepper/base/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/stepper/base/index.wxss b/pages/stepper/base/index.wxss
deleted file mode 100644
index edea138..0000000
--- a/pages/stepper/base/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.stepper-example {
- padding: 32rpx;
- background-color: #fff;
-}
diff --git a/pages/stepper/min-max/index.js b/pages/stepper/min-max/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/stepper/min-max/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/stepper/min-max/index.json b/pages/stepper/min-max/index.json
deleted file mode 100644
index cef723b..0000000
--- a/pages/stepper/min-max/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-stepper": "tdesign-miniprogram/stepper/stepper"
- }
-}
diff --git a/pages/stepper/min-max/index.wxml b/pages/stepper/min-max/index.wxml
deleted file mode 100644
index a109e71..0000000
--- a/pages/stepper/min-max/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/stepper/min-max/index.wxss b/pages/stepper/min-max/index.wxss
deleted file mode 100644
index 558c765..0000000
--- a/pages/stepper/min-max/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.stepper-example {
- padding: 32rpx;
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- gap: 64rpx;
- background-color: #fff;
-}
diff --git a/pages/stepper/size/index.js b/pages/stepper/size/index.js
deleted file mode 100644
index 4691773..0000000
--- a/pages/stepper/size/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-Component({
- data: {
- value: 3,
- },
-
- methods: {
- handleChange(e) {
- const { value } = e.detail;
-
- console.log(value);
- this.setData({
- value,
- });
- },
- },
-});
diff --git a/pages/stepper/size/index.json b/pages/stepper/size/index.json
deleted file mode 100644
index 480ad0d..0000000
--- a/pages/stepper/size/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-stepper": "tdesign-miniprogram/stepper/stepper"
- }
-}
diff --git a/pages/stepper/size/index.wxml b/pages/stepper/size/index.wxml
deleted file mode 100644
index 5d41abe..0000000
--- a/pages/stepper/size/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/stepper/size/index.wxss b/pages/stepper/size/index.wxss
deleted file mode 100644
index 2d8c496..0000000
--- a/pages/stepper/size/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.stepper-example {
- padding: 32rpx;
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- gap: 48rpx;
- background-color: #fff;
-}
diff --git a/pages/stepper/status/index.js b/pages/stepper/status/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/stepper/status/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/stepper/status/index.json b/pages/stepper/status/index.json
deleted file mode 100644
index cef723b..0000000
--- a/pages/stepper/status/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-stepper": "tdesign-miniprogram/stepper/stepper"
- }
-}
diff --git a/pages/stepper/status/index.wxml b/pages/stepper/status/index.wxml
deleted file mode 100644
index 59a842c..0000000
--- a/pages/stepper/status/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/stepper/status/index.wxss b/pages/stepper/status/index.wxss
deleted file mode 100644
index edea138..0000000
--- a/pages/stepper/status/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.stepper-example {
- padding: 32rpx;
- background-color: #fff;
-}
diff --git a/pages/stepper/stepper.d.ts b/pages/stepper/stepper.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/stepper/stepper.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/stepper/stepper.js b/pages/stepper/stepper.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/stepper/stepper.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/stepper/stepper.json b/pages/stepper/stepper.json
deleted file mode 100644
index 035c322..0000000
--- a/pages/stepper/stepper.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "navigationBarTitleText": "Stepper",
- "usingComponents": {
- "base": "./base",
- "min-max": "./min-max",
- "status": "./status",
- "theme": "./theme",
- "size": "./size"
- }
-}
diff --git a/pages/stepper/stepper.wxml b/pages/stepper/stepper.wxml
deleted file mode 100644
index ec7ecbe..0000000
--- a/pages/stepper/stepper.wxml
+++ /dev/null
@@ -1,19 +0,0 @@
-
- Stepper 步进器
- 用于数量的增减。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/stepper/stepper.wxss b/pages/stepper/stepper.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/stepper/theme/index.js b/pages/stepper/theme/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/stepper/theme/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/stepper/theme/index.json b/pages/stepper/theme/index.json
deleted file mode 100644
index cef723b..0000000
--- a/pages/stepper/theme/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-stepper": "tdesign-miniprogram/stepper/stepper"
- }
-}
diff --git a/pages/stepper/theme/index.wxml b/pages/stepper/theme/index.wxml
deleted file mode 100644
index b38db26..0000000
--- a/pages/stepper/theme/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/stepper/theme/index.wxss b/pages/stepper/theme/index.wxss
deleted file mode 100644
index 558c765..0000000
--- a/pages/stepper/theme/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.stepper-example {
- padding: 32rpx;
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- gap: 64rpx;
- background-color: #fff;
-}
diff --git a/pages/steps/horizontal/index.js b/pages/steps/horizontal/index.js
deleted file mode 100644
index 2fc6ee7..0000000
--- a/pages/steps/horizontal/index.js
+++ /dev/null
@@ -1,23 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
-
- data: {
- first: 1,
- second: 1,
- third: 1,
- },
-
- methods: {
- onFirstChange(e) {
- this.setData({ first: e.detail.current });
- },
- onSecondChange(e) {
- this.setData({ second: e.detail.current });
- },
- onThirdChange(e) {
- this.setData({ third: e.detail.current });
- },
- },
-});
diff --git a/pages/steps/horizontal/index.json b/pages/steps/horizontal/index.json
deleted file mode 100644
index 332e4f4..0000000
--- a/pages/steps/horizontal/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-steps": "tdesign-miniprogram/steps/steps",
- "t-step-item": "tdesign-miniprogram/step-item/step-item"
- }
-}
diff --git a/pages/steps/horizontal/index.wxml b/pages/steps/horizontal/index.wxml
deleted file mode 100644
index 4fc3443..0000000
--- a/pages/steps/horizontal/index.wxml
+++ /dev/null
@@ -1,27 +0,0 @@
-水平带序号步骤条
-
- module.exports.getText = function(value, curr) { if (value > curr) return '已完成'; if (value == curr)
- return'当前步骤'; return '未完成'; }
-
-
-
-
-
-
-
-
-水平带图标步骤条
-
-
-
-
-
-
-
-水平简略步骤条
-
-
-
-
-
-
diff --git a/pages/steps/horizontal/index.wxss b/pages/steps/horizontal/index.wxss
deleted file mode 100644
index 1d773f0..0000000
--- a/pages/steps/horizontal/index.wxss
+++ /dev/null
@@ -1,5 +0,0 @@
-.block {
- background-color: #fff;
- padding: 32rpx 0;
- margin: 32rpx 0 48rpx;
-}
\ No newline at end of file
diff --git a/pages/steps/special/index.js b/pages/steps/special/index.js
deleted file mode 100644
index cf0ec66..0000000
--- a/pages/steps/special/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
- data: {
- count: 4,
- },
- methods: {
- toNext() {
- this.setData({ count: this.data.count + 1 });
- },
- onCascader(e) {
- const { current } = e.detail;
-
- this.setData({
- count: current + 1,
- });
- },
- },
-});
diff --git a/pages/steps/special/index.json b/pages/steps/special/index.json
deleted file mode 100644
index 866db68..0000000
--- a/pages/steps/special/index.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-steps": "tdesign-miniprogram/steps/steps",
- "t-step-item": "tdesign-miniprogram/step-item/step-item",
- "t-icon": "tdesign-miniprogram/icon/icon"
- }
-}
diff --git a/pages/steps/special/index.wxml b/pages/steps/special/index.wxml
deleted file mode 100644
index 99bc8bb..0000000
--- a/pages/steps/special/index.wxml
+++ /dev/null
@@ -1,24 +0,0 @@
-
- module.exports.getText = function(value, curr) { if (value > curr) return '已完成步骤'; if (value == curr)
- return'当前步骤'; return '未完成步骤'; }
-
-
-垂直自定义步骤条
-
-
-
-
-
-
-
-
- 下一步
-
-
-纯展示步骤条
-
-
-
-
-
-
diff --git a/pages/steps/special/index.wxss b/pages/steps/special/index.wxss
deleted file mode 100644
index 6113fbd..0000000
--- a/pages/steps/special/index.wxss
+++ /dev/null
@@ -1,5 +0,0 @@
-.block {
- background-color: #fff;
- padding: 32rpx;
- margin: 32rpx 0 48rpx;
-}
\ No newline at end of file
diff --git a/pages/steps/status/index.js b/pages/steps/status/index.js
deleted file mode 100644
index 2fc6ee7..0000000
--- a/pages/steps/status/index.js
+++ /dev/null
@@ -1,23 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
-
- data: {
- first: 1,
- second: 1,
- third: 1,
- },
-
- methods: {
- onFirstChange(e) {
- this.setData({ first: e.detail.current });
- },
- onSecondChange(e) {
- this.setData({ second: e.detail.current });
- },
- onThirdChange(e) {
- this.setData({ third: e.detail.current });
- },
- },
-});
diff --git a/pages/steps/status/index.json b/pages/steps/status/index.json
deleted file mode 100644
index 332e4f4..0000000
--- a/pages/steps/status/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-steps": "tdesign-miniprogram/steps/steps",
- "t-step-item": "tdesign-miniprogram/step-item/step-item"
- }
-}
diff --git a/pages/steps/status/index.wxml b/pages/steps/status/index.wxml
deleted file mode 100644
index 2bb0351..0000000
--- a/pages/steps/status/index.wxml
+++ /dev/null
@@ -1,22 +0,0 @@
-
- module.exports.getText = function(value, curr) { if (value > curr) return '已完成'; if (value == curr)
- return'错误步骤'; return '未完成'; }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/steps/status/index.wxss b/pages/steps/status/index.wxss
deleted file mode 100644
index 1d773f0..0000000
--- a/pages/steps/status/index.wxss
+++ /dev/null
@@ -1,5 +0,0 @@
-.block {
- background-color: #fff;
- padding: 32rpx 0;
- margin: 32rpx 0 48rpx;
-}
\ No newline at end of file
diff --git a/pages/steps/steps.d.ts b/pages/steps/steps.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/steps/steps.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/steps/steps.js b/pages/steps/steps.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/steps/steps.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/steps/steps.json b/pages/steps/steps.json
deleted file mode 100644
index ec9a649..0000000
--- a/pages/steps/steps.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarTitleText": "Steps",
- "usingComponents": {
- "horizontal": "./horizontal",
- "vertical": "./vertical",
- "special": "./special",
- "status": "./status"
- }
-}
diff --git a/pages/steps/steps.wxml b/pages/steps/steps.wxml
deleted file mode 100644
index bc18eb5..0000000
--- a/pages/steps/steps.wxml
+++ /dev/null
@@ -1,18 +0,0 @@
-
- Steps 步骤条
- 用于任务步骤展示或任务进度展示。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/steps/steps.wxss b/pages/steps/steps.wxss
deleted file mode 100644
index d297000..0000000
--- a/pages/steps/steps.wxss
+++ /dev/null
@@ -1,10 +0,0 @@
-.demo-steps {
- padding-top: 80rpx;
-}
-.group {
- padding-bottom: 80rpx;
- margin-top: 32rpx;
-}
-.group + .demo-section__desc {
- margin-top: 32rpx;
-}
diff --git a/pages/steps/vertical/index.js b/pages/steps/vertical/index.js
deleted file mode 100644
index 2fc6ee7..0000000
--- a/pages/steps/vertical/index.js
+++ /dev/null
@@ -1,23 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
-
- data: {
- first: 1,
- second: 1,
- third: 1,
- },
-
- methods: {
- onFirstChange(e) {
- this.setData({ first: e.detail.current });
- },
- onSecondChange(e) {
- this.setData({ second: e.detail.current });
- },
- onThirdChange(e) {
- this.setData({ third: e.detail.current });
- },
- },
-});
diff --git a/pages/steps/vertical/index.json b/pages/steps/vertical/index.json
deleted file mode 100644
index 332e4f4..0000000
--- a/pages/steps/vertical/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-steps": "tdesign-miniprogram/steps/steps",
- "t-step-item": "tdesign-miniprogram/step-item/step-item"
- }
-}
diff --git a/pages/steps/vertical/index.wxml b/pages/steps/vertical/index.wxml
deleted file mode 100644
index 580b7f7..0000000
--- a/pages/steps/vertical/index.wxml
+++ /dev/null
@@ -1,51 +0,0 @@
-
- module.exports.getText = function(value, curr) { if (value > curr) return '已完成步骤'; if (value == curr)
- return'当前步骤'; return '未完成步骤'; }
-
-
-垂直带序号步骤条
-
-
-
-
-
-
-
-垂直带图标步骤条
-
-
-
-
-
-
-
-垂直简略步骤条
-
-
-
-
-
-
-
-垂直带自定义内容步骤条
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/steps/vertical/index.wxss b/pages/steps/vertical/index.wxss
deleted file mode 100644
index 6113fbd..0000000
--- a/pages/steps/vertical/index.wxss
+++ /dev/null
@@ -1,5 +0,0 @@
-.block {
- background-color: #fff;
- padding: 32rpx;
- margin: 32rpx 0 48rpx;
-}
\ No newline at end of file
diff --git a/pages/sticky/base/index.js b/pages/sticky/base/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/sticky/base/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/sticky/base/index.json b/pages/sticky/base/index.json
deleted file mode 100644
index 61aa440..0000000
--- a/pages/sticky/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-sticky": "tdesign-miniprogram/sticky/sticky",
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/sticky/base/index.wxml b/pages/sticky/base/index.wxml
deleted file mode 100644
index 992b51c..0000000
--- a/pages/sticky/base/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- 基础吸顶
-
diff --git a/pages/sticky/base/index.wxss b/pages/sticky/base/index.wxss
deleted file mode 100644
index 104c2da..0000000
--- a/pages/sticky/base/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.external-class {
- width: 208rpx;
-}
diff --git a/pages/sticky/container/index.js b/pages/sticky/container/index.js
deleted file mode 100644
index 151edb9..0000000
--- a/pages/sticky/container/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-Component({
- data: {
- container: null,
- },
-
- lifetimes: {
- ready: function () {
- this.setData({
- container: () => this.createSelectorQuery().select('.wrapper'),
- });
- },
- },
-});
diff --git a/pages/sticky/container/index.json b/pages/sticky/container/index.json
deleted file mode 100644
index 61aa440..0000000
--- a/pages/sticky/container/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-sticky": "tdesign-miniprogram/sticky/sticky",
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/sticky/container/index.wxml b/pages/sticky/container/index.wxml
deleted file mode 100644
index 37285ac..0000000
--- a/pages/sticky/container/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- 指定容器
-
-
diff --git a/pages/sticky/container/index.wxss b/pages/sticky/container/index.wxss
deleted file mode 100644
index 93f8949..0000000
--- a/pages/sticky/container/index.wxss
+++ /dev/null
@@ -1,15 +0,0 @@
-.wrapper {
- width: 100%;
- height: 150px;
- background-color: rgba(255, 255, 255, 1);
-}
-
-.external-class {
- width: 208rpx;
- margin-left: 512rpx;
-}
-
-.green-button {
- background-color: rgba(0, 168, 112, 1) !important;
- color: #fff !important;
-}
diff --git a/pages/sticky/offset/index.js b/pages/sticky/offset/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/sticky/offset/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/sticky/offset/index.json b/pages/sticky/offset/index.json
deleted file mode 100644
index 61aa440..0000000
--- a/pages/sticky/offset/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-sticky": "tdesign-miniprogram/sticky/sticky",
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/sticky/offset/index.wxml b/pages/sticky/offset/index.wxml
deleted file mode 100644
index 3b42ca9..0000000
--- a/pages/sticky/offset/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- 吸顶距离
-
diff --git a/pages/sticky/offset/index.wxss b/pages/sticky/offset/index.wxss
deleted file mode 100644
index 3543d8d..0000000
--- a/pages/sticky/offset/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.external-class {
- width: 208rpx;
- margin-left: 272rpx;
-}
diff --git a/pages/sticky/sticky.d.ts b/pages/sticky/sticky.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/sticky/sticky.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/sticky/sticky.js b/pages/sticky/sticky.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/sticky/sticky.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/sticky/sticky.json b/pages/sticky/sticky.json
deleted file mode 100644
index 1d65853..0000000
--- a/pages/sticky/sticky.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "navigationBarTitleText": "Sticky",
- "usingComponents": {
- "base": "./base",
- "offset": "./offset",
- "container": "./container"
- }
-}
diff --git a/pages/sticky/sticky.wxml b/pages/sticky/sticky.wxml
deleted file mode 100644
index 744c789..0000000
--- a/pages/sticky/sticky.wxml
+++ /dev/null
@@ -1,13 +0,0 @@
-
- Sticky 吸顶
- 用于常驻页面顶部的信息、操作展示。
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/sticky/sticky.wxss b/pages/sticky/sticky.wxss
deleted file mode 100644
index 8e47f8d..0000000
--- a/pages/sticky/sticky.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.tdesign-demo-sticky-base {
- height: 3000rpx;
-}
diff --git a/pages/swipe-cell/double/index.js b/pages/swipe-cell/double/index.js
deleted file mode 100644
index 19500ea..0000000
--- a/pages/swipe-cell/double/index.js
+++ /dev/null
@@ -1,22 +0,0 @@
-Component({
- data: {
- right: [
- {
- text: '删除',
- className: 'btn delete-btn',
- },
- ],
- left: [
- {
- text: '选择',
- className: 'btn favor-btn',
- },
- ],
- },
-
- methods: {
- onActionClick({ detail }) {
- wx.showToast({ title: `你点击了${detail.text}`, icon: 'none' });
- },
- },
-});
diff --git a/pages/swipe-cell/double/index.json b/pages/swipe-cell/double/index.json
deleted file mode 100644
index b2f7915..0000000
--- a/pages/swipe-cell/double/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell",
- "t-cell": "tdesign-miniprogram/cell/cell"
- }
-}
diff --git a/pages/swipe-cell/double/index.wxml b/pages/swipe-cell/double/index.wxml
deleted file mode 100644
index e35d6f5..0000000
--- a/pages/swipe-cell/double/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/swipe-cell/double/index.wxss b/pages/swipe-cell/double/index.wxss
deleted file mode 100644
index da4a239..0000000
--- a/pages/swipe-cell/double/index.wxss
+++ /dev/null
@@ -1,16 +0,0 @@
-.btn {
- display: inline-flex;
- justify-content: center;
- align-items: center;
- width: 120rpx;
- height: 100%;
- color: white;
-}
-
-.favor-btn {
- background-color: #0052d9;
-}
-
-.delete-btn {
- background-color: #e34d59;
-}
diff --git a/pages/swipe-cell/icon/index.js b/pages/swipe-cell/icon/index.js
deleted file mode 100644
index 8aecbdf..0000000
--- a/pages/swipe-cell/icon/index.js
+++ /dev/null
@@ -1,50 +0,0 @@
-Component({
- data: {
- right: [
- {
- text: '编辑',
- icon: {
- name: 'edit',
- size: 16,
- },
- className: 'btn edit-btn',
- },
- {
- text: '删除',
- icon: {
- name: 'delete',
- size: 16,
- },
- className: 'btn delete-btn',
- },
- ],
- rightIcon: [
- {
- icon: 'edit',
- className: 'btn edit-btn',
- },
- {
- icon: 'delete',
- className: 'btn delete-btn',
- },
- ],
- },
- methods: {
- onActionClick({ detail }) {
- wx.showToast({ title: `你点击了${detail.text}`, icon: 'none' });
- },
-
- onDelete() {
- wx.showToast({ title: '你点击了删除', icon: 'none' });
- },
- onEdit() {
- wx.showToast({ title: '你点击了编辑', icon: 'none' });
- },
- onFavor() {
- wx.showToast({ title: '你点击了收藏', icon: 'none' });
- },
- onChoice() {
- wx.showToast({ title: '你点击了选择', icon: 'none' });
- },
- },
-});
diff --git a/pages/swipe-cell/icon/index.json b/pages/swipe-cell/icon/index.json
deleted file mode 100644
index fe1c707..0000000
--- a/pages/swipe-cell/icon/index.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell",
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-icon": "tdesign-miniprogram/icon/icon"
- }
-}
diff --git a/pages/swipe-cell/icon/index.wxml b/pages/swipe-cell/icon/index.wxml
deleted file mode 100644
index ab63973..0000000
--- a/pages/swipe-cell/icon/index.wxml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- 编辑
-
-
-
- 删除
-
-
-
diff --git a/pages/swipe-cell/icon/index.wxss b/pages/swipe-cell/icon/index.wxss
deleted file mode 100644
index 4f079fe..0000000
--- a/pages/swipe-cell/icon/index.wxss
+++ /dev/null
@@ -1,32 +0,0 @@
-.btn-wrapper {
- height: 100%;
-}
-
-.btn {
- display: inline-flex;
- justify-content: center;
- align-items: center;
- width: 120rpx;
- height: 100%;
- color: white;
-}
-
-.delete-btn {
- background-color: #e34d59;
-}
-
-.edit-btn {
- background-color: #ed7b2f;
-}
-
-.favor-btn {
- background-color: #0052d9;
-}
-
-.column {
- flex-direction: column;
-}
-
-.padding-bottom {
- padding-bottom: 8rpx;
-}
diff --git a/pages/swipe-cell/left/index.js b/pages/swipe-cell/left/index.js
deleted file mode 100644
index 786736b..0000000
--- a/pages/swipe-cell/left/index.js
+++ /dev/null
@@ -1,32 +0,0 @@
-Component({
- data: {
- right: [
- {
- text: '编辑',
- className: 'btn edit-btn',
- },
- {
- text: '删除',
- className: 'btn delete-btn',
- },
- ],
- },
- methods: {
- onActionClick({ detail }) {
- wx.showToast({ title: `你点击了${detail.text}`, icon: 'none' });
- },
-
- onDelete() {
- wx.showToast({ title: '你点击了删除', icon: 'none' });
- },
- onEdit() {
- wx.showToast({ title: '你点击了编辑', icon: 'none' });
- },
- onFavor() {
- wx.showToast({ title: '你点击了收藏', icon: 'none' });
- },
- onChoice() {
- wx.showToast({ title: '你点击了选择', icon: 'none' });
- },
- },
-});
diff --git a/pages/swipe-cell/left/index.json b/pages/swipe-cell/left/index.json
deleted file mode 100644
index b2f7915..0000000
--- a/pages/swipe-cell/left/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell",
- "t-cell": "tdesign-miniprogram/cell/cell"
- }
-}
diff --git a/pages/swipe-cell/left/index.wxml b/pages/swipe-cell/left/index.wxml
deleted file mode 100644
index 2d26661..0000000
--- a/pages/swipe-cell/left/index.wxml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- 删除
-
-
-
-
- 删除
-
-
-
-
-
-
-
-
-
- 收藏
- 编辑
- 删除
-
-
diff --git a/pages/swipe-cell/left/index.wxss b/pages/swipe-cell/left/index.wxss
deleted file mode 100644
index 6e657b9..0000000
--- a/pages/swipe-cell/left/index.wxss
+++ /dev/null
@@ -1,24 +0,0 @@
-.btn-wrapper {
- height: 100%;
-}
-
-.btn {
- display: inline-flex;
- justify-content: center;
- align-items: center;
- width: 120rpx;
- height: 100%;
- color: white;
-}
-
-.delete-btn {
- background-color: #e34d59;
-}
-
-.edit-btn {
- background-color: #ed7b2f;
-}
-
-.favor-btn {
- background-color: #0052d9;
-}
diff --git a/pages/swipe-cell/right/index.js b/pages/swipe-cell/right/index.js
deleted file mode 100644
index fe88330..0000000
--- a/pages/swipe-cell/right/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Component({
- methods: {
- onChoice() {
- wx.showToast({ title: '你点击了选择', icon: 'none' });
- },
- },
-});
diff --git a/pages/swipe-cell/right/index.json b/pages/swipe-cell/right/index.json
deleted file mode 100644
index b2f7915..0000000
--- a/pages/swipe-cell/right/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell",
- "t-cell": "tdesign-miniprogram/cell/cell"
- }
-}
diff --git a/pages/swipe-cell/right/index.wxml b/pages/swipe-cell/right/index.wxml
deleted file mode 100644
index 558250d..0000000
--- a/pages/swipe-cell/right/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- 选择
-
diff --git a/pages/swipe-cell/right/index.wxss b/pages/swipe-cell/right/index.wxss
deleted file mode 100644
index 3cbb660..0000000
--- a/pages/swipe-cell/right/index.wxss
+++ /dev/null
@@ -1,12 +0,0 @@
-.btn {
- display: inline-flex;
- justify-content: center;
- align-items: center;
- width: 120rpx;
- height: 100%;
- color: white;
-}
-
-.favor-btn {
- background-color: #0052d9;
-}
diff --git a/pages/swipe-cell/swipe-cell.d.ts b/pages/swipe-cell/swipe-cell.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/swipe-cell/swipe-cell.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/swipe-cell/swipe-cell.js b/pages/swipe-cell/swipe-cell.js
deleted file mode 100644
index 5df3614..0000000
--- a/pages/swipe-cell/swipe-cell.js
+++ /dev/null
@@ -1,29 +0,0 @@
-Page({
- data: {
- right: [
- {
- text: '编辑',
- className: 't-swipe-cell-demo-btn edit-btn',
- },
- {
- text: '删除',
- className: 't-swipe-cell-demo-btn delete-btn',
- },
- ],
- },
- onActionClick({ detail }) {
- wx.showToast({ title: `你点击了${detail.text}`, icon: 'none' });
- },
- onDelete() {
- wx.showToast({ title: '你点击了删除', icon: 'none' });
- },
- onEdit() {
- wx.showToast({ title: '你点击了编辑', icon: 'none' });
- },
- onFavor() {
- wx.showToast({ title: '你点击了收藏', icon: 'none' });
- },
- onChoice() {
- wx.showToast({ title: '你点击了选择', icon: 'none' });
- },
-});
diff --git a/pages/swipe-cell/swipe-cell.json b/pages/swipe-cell/swipe-cell.json
deleted file mode 100644
index 39945e4..0000000
--- a/pages/swipe-cell/swipe-cell.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarTitleText": "SwipeCell",
- "usingComponents": {
- "left": "./left",
- "right": "./right",
- "double": "./double",
- "iconDemo": "./icon"
- }
-}
diff --git a/pages/swipe-cell/swipe-cell.wxml b/pages/swipe-cell/swipe-cell.wxml
deleted file mode 100644
index dce112c..0000000
--- a/pages/swipe-cell/swipe-cell.wxml
+++ /dev/null
@@ -1,16 +0,0 @@
-
- SwipeCell 滑动操作
- 用于承载列表中的更多操作,通过左右滑动来展示,按钮的宽度固定高度根据列表高度而变化。
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/swipe-cell/swipe-cell.wxss b/pages/swipe-cell/swipe-cell.wxss
deleted file mode 100644
index dad58fd..0000000
--- a/pages/swipe-cell/swipe-cell.wxss
+++ /dev/null
@@ -1,16 +0,0 @@
-.btn {
- height: 100%;
- color: white;
-}
-.delete-btn {
- background-color: #e34d59;
-}
-.edit-btn {
- background-color: #ed7b2f;
-}
-.favor-btn {
- background-color: #0052d9;
-}
-.t-swipe-cell {
- margin-bottom: 32rpx;
-}
diff --git a/pages/swiper/base/index.js b/pages/swiper/base/index.js
deleted file mode 100644
index 2bbb7a9..0000000
--- a/pages/swiper/base/index.js
+++ /dev/null
@@ -1,31 +0,0 @@
-const imageCdn = 'https://tdesign.gtimg.com/miniprogram/images';
-const swiperList = [
- `${imageCdn}/swiper1.png`,
- `${imageCdn}/swiper2.png`,
- `${imageCdn}/swiper1.png`,
- `${imageCdn}/swiper2.png`,
- `${imageCdn}/swiper1.png`,
-];
-
-Component({
- data: {
- current: 0,
- autoplay: false,
- duration: 500,
- interval: 5000,
- swiperList,
- },
-
- methods: {
- onTap(e) {
- const { index } = e.detail;
-
- console.log(index);
- },
- onChange(e) {
- const { current, source } = e.detail;
-
- console.log(current, source);
- },
- },
-});
diff --git a/pages/swiper/base/index.json b/pages/swiper/base/index.json
deleted file mode 100644
index 6d12904..0000000
--- a/pages/swiper/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-swiper": "tdesign-miniprogram/swiper/swiper"
- }
-}
diff --git a/pages/swiper/base/index.wxml b/pages/swiper/base/index.wxml
deleted file mode 100644
index 1034ca8..0000000
--- a/pages/swiper/base/index.wxml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
diff --git a/pages/swiper/base/index.wxss b/pages/swiper/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/swiper/cards/index.js b/pages/swiper/cards/index.js
deleted file mode 100644
index 5b6b8f9..0000000
--- a/pages/swiper/cards/index.js
+++ /dev/null
@@ -1,27 +0,0 @@
-const imageCdn = 'https://tdesign.gtimg.com/miniprogram/images';
-const swiperList = [
- `${imageCdn}/swiper1.png`,
- `${imageCdn}/swiper2.png`,
- `${imageCdn}/swiper1.png`,
- `${imageCdn}/swiper2.png`,
- `${imageCdn}/swiper1.png`,
-];
-
-Component({
- data: {
- current: 0,
- autoplay: false,
- duration: 500,
- interval: 5000,
- swiperList,
- },
-
- methods: {
- onChange(e) {
- const {
- detail: { current, source },
- } = e;
- console.log(current, source);
- },
- },
-});
diff --git a/pages/swiper/cards/index.json b/pages/swiper/cards/index.json
deleted file mode 100644
index 6d12904..0000000
--- a/pages/swiper/cards/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-swiper": "tdesign-miniprogram/swiper/swiper"
- }
-}
diff --git a/pages/swiper/cards/index.wxml b/pages/swiper/cards/index.wxml
deleted file mode 100644
index 5cabc9d..0000000
--- a/pages/swiper/cards/index.wxml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
diff --git a/pages/swiper/cards/index.wxss b/pages/swiper/cards/index.wxss
deleted file mode 100644
index a8146e0..0000000
--- a/pages/swiper/cards/index.wxss
+++ /dev/null
@@ -1,18 +0,0 @@
-
-.card-theme {
- --td-swiper-radius: 0;
- --td-swiper-item-padding: 0 12rpx;
- --td-swiper-nav-dot-color: #e7e7e7;
- --td-swiper-nav-dot-active-color: #0052d9;
-
- padding-bottom: 18px;
-}
-
-.card-theme .card-theme-nav {
- bottom: -18px;
-}
-
-.scale-candidate {
- height: 126px !important;
-}
-
diff --git a/pages/swiper/custom/index.js b/pages/swiper/custom/index.js
deleted file mode 100644
index 7e16ce1..0000000
--- a/pages/swiper/custom/index.js
+++ /dev/null
@@ -1,18 +0,0 @@
-const imageCdn = 'https://tdesign.gtimg.com/miniprogram/images';
-const swiperList = [
- `${imageCdn}/swiper1.png`,
- `${imageCdn}/swiper2.png`,
- `${imageCdn}/swiper1.png`,
- `${imageCdn}/swiper2.png`,
- `${imageCdn}/swiper1.png`,
-];
-
-Component({
- data: {
- current: 1,
- autoplay: true,
- duration: 500,
- interval: 5000,
- swiperList,
- },
-});
diff --git a/pages/swiper/custom/index.json b/pages/swiper/custom/index.json
deleted file mode 100644
index 6d12904..0000000
--- a/pages/swiper/custom/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-swiper": "tdesign-miniprogram/swiper/swiper"
- }
-}
diff --git a/pages/swiper/custom/index.wxml b/pages/swiper/custom/index.wxml
deleted file mode 100644
index 14c5b78..0000000
--- a/pages/swiper/custom/index.wxml
+++ /dev/null
@@ -1,8 +0,0 @@
-
diff --git a/pages/swiper/custom/index.wxss b/pages/swiper/custom/index.wxss
deleted file mode 100644
index c78a032..0000000
--- a/pages/swiper/custom/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.img {
- width: 100%;
- height: 100%;
-}
diff --git a/pages/swiper/fraction/index.js b/pages/swiper/fraction/index.js
deleted file mode 100644
index 8018cfa..0000000
--- a/pages/swiper/fraction/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-const imageCdn = 'https://tdesign.gtimg.com/miniprogram/images';
-const swiperList = [
- `${imageCdn}/swiper1.png`,
- `${imageCdn}/swiper2.png`,
- `${imageCdn}/swiper1.png`,
- `${imageCdn}/swiper2.png`,
- `${imageCdn}/swiper1.png`,
-];
-
-Component({
- data: {
- current: 2,
- autoplay: true,
- duration: 500,
- interval: 5000,
- paginationPosition: 'bottom-right',
- swiperList,
- navigation: { type: 'fraction' },
- },
-});
diff --git a/pages/swiper/fraction/index.json b/pages/swiper/fraction/index.json
deleted file mode 100644
index 6d12904..0000000
--- a/pages/swiper/fraction/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-swiper": "tdesign-miniprogram/swiper/swiper"
- }
-}
diff --git a/pages/swiper/fraction/index.wxml b/pages/swiper/fraction/index.wxml
deleted file mode 100644
index 02e59c9..0000000
--- a/pages/swiper/fraction/index.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
diff --git a/pages/swiper/fraction/index.wxss b/pages/swiper/fraction/index.wxss
deleted file mode 100644
index c78a032..0000000
--- a/pages/swiper/fraction/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.img {
- width: 100%;
- height: 100%;
-}
diff --git a/pages/swiper/nav-btn/index.js b/pages/swiper/nav-btn/index.js
deleted file mode 100644
index 5f55da4..0000000
--- a/pages/swiper/nav-btn/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-const imageCdn = 'https://tdesign.gtimg.com/miniprogram/images';
-const swiperList = [
- `${imageCdn}/swiper1.png`,
- `${imageCdn}/swiper2.png`,
- `${imageCdn}/swiper1.png`,
- `${imageCdn}/swiper2.png`,
- `${imageCdn}/swiper1.png`,
-];
-
-Component({
- data: {
- current: 3,
- autoplay: true,
- duration: 500,
- interval: 5000,
- swiperList,
- navigation: { type: '', showControls: true },
- },
-});
diff --git a/pages/swiper/nav-btn/index.json b/pages/swiper/nav-btn/index.json
deleted file mode 100644
index 6d12904..0000000
--- a/pages/swiper/nav-btn/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-swiper": "tdesign-miniprogram/swiper/swiper"
- }
-}
diff --git a/pages/swiper/nav-btn/index.wxml b/pages/swiper/nav-btn/index.wxml
deleted file mode 100644
index 52a1b0c..0000000
--- a/pages/swiper/nav-btn/index.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
diff --git a/pages/swiper/nav-btn/index.wxss b/pages/swiper/nav-btn/index.wxss
deleted file mode 100644
index c78a032..0000000
--- a/pages/swiper/nav-btn/index.wxss
+++ /dev/null
@@ -1,4 +0,0 @@
-.img {
- width: 100%;
- height: 100%;
-}
diff --git a/pages/swiper/swiper.d.ts b/pages/swiper/swiper.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/swiper/swiper.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/swiper/swiper.js b/pages/swiper/swiper.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/swiper/swiper.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/swiper/swiper.json b/pages/swiper/swiper.json
deleted file mode 100644
index 03a9aa6..0000000
--- a/pages/swiper/swiper.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "navigationBarTitleText": "Swiper",
- "navigationBarBackgroundColor": "#fff",
- "backgroundColor": "#fff",
- "usingComponents": {
- "base": "./base",
- "fraction": "./fraction",
- "nav-btn": "./nav-btn",
- "custom": "./custom",
- "cards": "./cards",
- "vertical": "./vertical"
- }
-}
diff --git a/pages/swiper/swiper.wxml b/pages/swiper/swiper.wxml
deleted file mode 100644
index df27494..0000000
--- a/pages/swiper/swiper.wxml
+++ /dev/null
@@ -1,30 +0,0 @@
-
- Swiper 轮播图
- 用于循环轮播一组图片或内容,也可以滑动进行切换,轮播动效时间可以设置。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/swiper/swiper.wxss b/pages/swiper/swiper.wxss
deleted file mode 100644
index e81280c..0000000
--- a/pages/swiper/swiper.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-page {
- background: #fff;
-}
diff --git a/pages/swiper/vertical/index.js b/pages/swiper/vertical/index.js
deleted file mode 100644
index 16706b5..0000000
--- a/pages/swiper/vertical/index.js
+++ /dev/null
@@ -1,44 +0,0 @@
-const imageCdn = 'https://tdesign.gtimg.com/miniprogram/images';
-const swiperList = [
- `${imageCdn}/swiper1.png`,
- `${imageCdn}/swiper2.png`,
- `${imageCdn}/swiper1.png`,
- `${imageCdn}/swiper2.png`,
- `${imageCdn}/swiper1.png`,
-];
-
-Component({
- data: {
- current: 1,
- autoplay: true,
- duration: 500,
- interval: 5000,
- swiperList,
- navigation: { type: 'dots-bar' },
- paginationPosition: 'right',
- },
-
- methods: {
- onChange(e) {
- const {
- detail: { current, source },
- } = e;
- console.log(current, source);
- },
- onAutoplayChange(e) {
- this.setData({
- autoplay: e.detail.value,
- });
- },
- onIntervalChange(e) {
- this.setData({
- interval: e.detail.value,
- });
- },
- onDurationChange(e) {
- this.setData({
- duration: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/swiper/vertical/index.json b/pages/swiper/vertical/index.json
deleted file mode 100644
index a8ba774..0000000
--- a/pages/swiper/vertical/index.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-swiper": "tdesign-miniprogram/swiper/swiper",
- "t-switch": "tdesign-miniprogram/switch/switch",
- "t-slider": "tdesign-miniprogram/slider/slider"
- }
-}
diff --git a/pages/swiper/vertical/index.wxml b/pages/swiper/vertical/index.wxml
deleted file mode 100644
index 48171a6..0000000
--- a/pages/swiper/vertical/index.wxml
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
-
-
-
- 自动播放
-
-
- {{autoplay?'开':'关'}}
-
-
-
- 自动播放间隔时间(单位毫秒)
-
-
- {{interval}}
-
-
-
- 动画持续时间(单位毫秒)
-
-
- {{duration}}
-
-
-
diff --git a/pages/swiper/vertical/index.wxss b/pages/swiper/vertical/index.wxss
deleted file mode 100644
index 9685e78..0000000
--- a/pages/swiper/vertical/index.wxss
+++ /dev/null
@@ -1,63 +0,0 @@
-.swiper-box {
- margin: 0 32rpx 32rpx;
- border-radius: 16rpx;
- overflow: hidden;
- transform: translateY(0);
-}
-
-.swiper-box .img {
- width: 100%;
- height: 100%;
-}
-
-.swiper-switch {
- margin: 22rpx 0;
-}
-
-.swiper-switch .t-switch__label {
- display: none;
-}
-
-.cell {
- padding: 10rpx 0;
- font-size: 28rpx;
- color: #999;
-}
-.cell.row {
- display: flex;
- flex-direction: row;
-}
-
-.cell .label {
- color: #999;
- margin-right: 20rpx;
-}
-
-.cell .option {
- display: flex;
- flex-direction: row;
- justify-content: start;
- align-items: center;
-}
-
-.cell .option-desc {
- width: 68rpx;
- padding-left: 32rpx;
-}
-
-.cell .swiper-slider {
- flex: 1;
-}
-
-.swiper-box-vertical .item {
- line-height: 400rpx;
-}
-
-.swiper-box-option {
- overflow: visible;
- border-radius: 0;
-}
-
-.external-class-bar {
- margin: 0 !important;
-}
diff --git a/pages/switch/base/index.js b/pages/switch/base/index.js
deleted file mode 100644
index 1da549d..0000000
--- a/pages/switch/base/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-Component({
- data: {
- defaultVal: true,
- },
- methods: {
- handleChange(e) {
- this.setData({
- defaultVal: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/switch/base/index.json b/pages/switch/base/index.json
deleted file mode 100644
index 86e6892..0000000
--- a/pages/switch/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-switch": "tdesign-miniprogram/switch/switch"
- }
-}
diff --git a/pages/switch/base/index.wxml b/pages/switch/base/index.wxml
deleted file mode 100644
index d60654a..0000000
--- a/pages/switch/base/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/switch/base/index.wxss b/pages/switch/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/switch/color/index.js b/pages/switch/color/index.js
deleted file mode 100644
index 1da549d..0000000
--- a/pages/switch/color/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-Component({
- data: {
- defaultVal: true,
- },
- methods: {
- handleChange(e) {
- this.setData({
- defaultVal: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/switch/color/index.json b/pages/switch/color/index.json
deleted file mode 100644
index 86e6892..0000000
--- a/pages/switch/color/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-switch": "tdesign-miniprogram/switch/switch"
- }
-}
diff --git a/pages/switch/color/index.wxml b/pages/switch/color/index.wxml
deleted file mode 100644
index 60b0484..0000000
--- a/pages/switch/color/index.wxml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
diff --git a/pages/switch/color/index.wxss b/pages/switch/color/index.wxss
deleted file mode 100644
index a95922a..0000000
--- a/pages/switch/color/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.custom-color {
- --td-switch-checked-color: #00A870;
-}
\ No newline at end of file
diff --git a/pages/switch/label/index.js b/pages/switch/label/index.js
deleted file mode 100644
index 1da549d..0000000
--- a/pages/switch/label/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-Component({
- data: {
- defaultVal: true,
- },
- methods: {
- handleChange(e) {
- this.setData({
- defaultVal: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/switch/label/index.json b/pages/switch/label/index.json
deleted file mode 100644
index 86e6892..0000000
--- a/pages/switch/label/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-switch": "tdesign-miniprogram/switch/switch"
- }
-}
diff --git a/pages/switch/label/index.wxml b/pages/switch/label/index.wxml
deleted file mode 100644
index 56bb549..0000000
--- a/pages/switch/label/index.wxml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/pages/switch/label/index.wxss b/pages/switch/label/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/switch/size/index.js b/pages/switch/size/index.js
deleted file mode 100644
index 1da549d..0000000
--- a/pages/switch/size/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-Component({
- data: {
- defaultVal: true,
- },
- methods: {
- handleChange(e) {
- this.setData({
- defaultVal: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/switch/size/index.json b/pages/switch/size/index.json
deleted file mode 100644
index 86e6892..0000000
--- a/pages/switch/size/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-switch": "tdesign-miniprogram/switch/switch"
- }
-}
diff --git a/pages/switch/size/index.wxml b/pages/switch/size/index.wxml
deleted file mode 100644
index 9a81142..0000000
--- a/pages/switch/size/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/pages/switch/size/index.wxss b/pages/switch/size/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/switch/status/index.js b/pages/switch/status/index.js
deleted file mode 100644
index 2dc2188..0000000
--- a/pages/switch/status/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- options: {
- styleIsolation: 'apply-shared',
- },
-});
diff --git a/pages/switch/status/index.json b/pages/switch/status/index.json
deleted file mode 100644
index 86e6892..0000000
--- a/pages/switch/status/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-cell": "tdesign-miniprogram/cell/cell",
- "t-switch": "tdesign-miniprogram/switch/switch"
- }
-}
diff --git a/pages/switch/status/index.wxml b/pages/switch/status/index.wxml
deleted file mode 100644
index b733975..0000000
--- a/pages/switch/status/index.wxml
+++ /dev/null
@@ -1,21 +0,0 @@
-加载状态
-
-
-
-
-
-
-
-
-
-
-禁用状态
-
-
-
-
-
-
-
-
-
diff --git a/pages/switch/status/index.wxss b/pages/switch/status/index.wxss
deleted file mode 100644
index 1611d4e..0000000
--- a/pages/switch/status/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.group {
- margin-top: 32rpx;
-}
-
-.group + .demo-desc {
- margin-top: 48rpx;
-}
diff --git a/pages/switch/switch.d.ts b/pages/switch/switch.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/switch/switch.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/switch/switch.js b/pages/switch/switch.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/switch/switch.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/switch/switch.json b/pages/switch/switch.json
deleted file mode 100644
index 884d1c2..0000000
--- a/pages/switch/switch.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "navigationBarTitleText": "Switch",
- "usingComponents": {
- "t-demo": "../../components/demo-block",
- "base": "./base",
- "label": "./label",
- "color": "./color",
- "status": "./status",
- "size": "./size"
- }
-}
diff --git a/pages/switch/switch.wxml b/pages/switch/switch.wxml
deleted file mode 100644
index 712c8ff..0000000
--- a/pages/switch/switch.wxml
+++ /dev/null
@@ -1,24 +0,0 @@
-
- Switch 开关
- 用于控制某个功能的开启和关闭。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/switch/switch.wxss b/pages/switch/switch.wxss
deleted file mode 100644
index f1d2965..0000000
--- a/pages/switch/switch.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-page {
- --td-cell-height: 112rpx;
-}
diff --git a/pages/tab-bar/badge/index.js b/pages/tab-bar/badge/index.js
deleted file mode 100644
index f4399f8..0000000
--- a/pages/tab-bar/badge/index.js
+++ /dev/null
@@ -1,10 +0,0 @@
-Component({
- data: {
- list: [
- { value: 'label_1', label: '文字', icon: 'home' },
- { value: 'label_2', label: '文字', icon: 'app' },
- { value: 'label_3', label: '文字', icon: 'chat' },
- { value: 'label_4', label: '文字', icon: 'user' },
- ],
- },
-});
diff --git a/pages/tab-bar/badge/index.json b/pages/tab-bar/badge/index.json
deleted file mode 100644
index e16a2dd..0000000
--- a/pages/tab-bar/badge/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tab-bar": "tdesign-miniprogram/tab-bar/tab-bar",
- "t-tab-bar-item": "tdesign-miniprogram/tab-bar-item/tab-bar-item"
- }
-}
diff --git a/pages/tab-bar/badge/index.wxml b/pages/tab-bar/badge/index.wxml
deleted file mode 100644
index a35c7fb..0000000
--- a/pages/tab-bar/badge/index.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
- 首页
- 软件
- 聊天
- 我的
-
diff --git a/pages/tab-bar/badge/index.wxss b/pages/tab-bar/badge/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/tab-bar/base/index.js b/pages/tab-bar/base/index.js
deleted file mode 100644
index d20c927..0000000
--- a/pages/tab-bar/base/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-Component({
- data: {
- value: 'label_1',
- list: [
- { value: 'label_1', label: '首页', icon: 'home' },
- { value: 'label_2', label: '应用', icon: 'app' },
- { value: 'label_3', label: '聊天', icon: 'chat' },
- { value: 'label_4', label: '我的', icon: 'user' },
- ],
- },
-
- methods: {
- onChange(e) {
- this.setData({
- value: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/tab-bar/base/index.json b/pages/tab-bar/base/index.json
deleted file mode 100644
index e16a2dd..0000000
--- a/pages/tab-bar/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tab-bar": "tdesign-miniprogram/tab-bar/tab-bar",
- "t-tab-bar-item": "tdesign-miniprogram/tab-bar-item/tab-bar-item"
- }
-}
diff --git a/pages/tab-bar/base/index.wxml b/pages/tab-bar/base/index.wxml
deleted file mode 100644
index 765635b..0000000
--- a/pages/tab-bar/base/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- {{item.label}}
-
-
diff --git a/pages/tab-bar/base/index.wxss b/pages/tab-bar/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/tab-bar/custom/index.js b/pages/tab-bar/custom/index.js
deleted file mode 100644
index 7d84ad8..0000000
--- a/pages/tab-bar/custom/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-Component({
- data: {
- value: 'label_1',
- list: [
- { value: 'label_1', icon: 'home', ariaLabel: '首页' },
- { value: 'label_2', icon: 'app', ariaLabel: '软件' },
- { value: 'label_3', icon: 'chat', ariaLabel: '聊天' },
- { value: 'label_4', icon: 'user', ariaLabel: '我的' },
- ],
- },
-
- methods: {
- onChange(e) {
- this.setData({
- value: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/tab-bar/custom/index.json b/pages/tab-bar/custom/index.json
deleted file mode 100644
index e16a2dd..0000000
--- a/pages/tab-bar/custom/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tab-bar": "tdesign-miniprogram/tab-bar/tab-bar",
- "t-tab-bar-item": "tdesign-miniprogram/tab-bar-item/tab-bar-item"
- }
-}
diff --git a/pages/tab-bar/custom/index.wxml b/pages/tab-bar/custom/index.wxml
deleted file mode 100644
index 348f8d7..0000000
--- a/pages/tab-bar/custom/index.wxml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
diff --git a/pages/tab-bar/custom/index.wxss b/pages/tab-bar/custom/index.wxss
deleted file mode 100644
index a2ca3dc..0000000
--- a/pages/tab-bar/custom/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.wrapper {
- --td-tab-bar-border-color: #e7e7e7;
- --td-tab-bar-bg-color: #eee;
- --td-tab-bar-hover-color: #ddd;
- --td-tab-bar-item-color: #bbb;
- --td-tab-bar-item-active-color: #333;
-}
\ No newline at end of file
diff --git a/pages/tab-bar/icon-only/index.js b/pages/tab-bar/icon-only/index.js
deleted file mode 100644
index 7d84ad8..0000000
--- a/pages/tab-bar/icon-only/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-Component({
- data: {
- value: 'label_1',
- list: [
- { value: 'label_1', icon: 'home', ariaLabel: '首页' },
- { value: 'label_2', icon: 'app', ariaLabel: '软件' },
- { value: 'label_3', icon: 'chat', ariaLabel: '聊天' },
- { value: 'label_4', icon: 'user', ariaLabel: '我的' },
- ],
- },
-
- methods: {
- onChange(e) {
- this.setData({
- value: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/tab-bar/icon-only/index.json b/pages/tab-bar/icon-only/index.json
deleted file mode 100644
index e16a2dd..0000000
--- a/pages/tab-bar/icon-only/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tab-bar": "tdesign-miniprogram/tab-bar/tab-bar",
- "t-tab-bar-item": "tdesign-miniprogram/tab-bar-item/tab-bar-item"
- }
-}
diff --git a/pages/tab-bar/icon-only/index.wxml b/pages/tab-bar/icon-only/index.wxml
deleted file mode 100644
index 806d83b..0000000
--- a/pages/tab-bar/icon-only/index.wxml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/pages/tab-bar/icon-only/index.wxss b/pages/tab-bar/icon-only/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/tab-bar/round/index.js b/pages/tab-bar/round/index.js
deleted file mode 100644
index 7d84ad8..0000000
--- a/pages/tab-bar/round/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-Component({
- data: {
- value: 'label_1',
- list: [
- { value: 'label_1', icon: 'home', ariaLabel: '首页' },
- { value: 'label_2', icon: 'app', ariaLabel: '软件' },
- { value: 'label_3', icon: 'chat', ariaLabel: '聊天' },
- { value: 'label_4', icon: 'user', ariaLabel: '我的' },
- ],
- },
-
- methods: {
- onChange(e) {
- this.setData({
- value: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/tab-bar/round/index.json b/pages/tab-bar/round/index.json
deleted file mode 100644
index e16a2dd..0000000
--- a/pages/tab-bar/round/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tab-bar": "tdesign-miniprogram/tab-bar/tab-bar",
- "t-tab-bar-item": "tdesign-miniprogram/tab-bar-item/tab-bar-item"
- }
-}
diff --git a/pages/tab-bar/round/index.wxml b/pages/tab-bar/round/index.wxml
deleted file mode 100644
index 2ce6aff..0000000
--- a/pages/tab-bar/round/index.wxml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- {{item.label}}
-
-
diff --git a/pages/tab-bar/round/index.wxss b/pages/tab-bar/round/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/tab-bar/sub/index.js b/pages/tab-bar/sub/index.js
deleted file mode 100644
index e3e406b..0000000
--- a/pages/tab-bar/sub/index.js
+++ /dev/null
@@ -1,38 +0,0 @@
-const list = [
- {
- value: 'home',
- label: '首页',
- icon: 'home',
- children: [],
- },
- {
- value: 'app',
- label: '应用',
- icon: 'app',
- children: [],
- },
- {
- value: 'user',
- label: '我的',
- children: [
- {
- value: 'info',
- label: '基本信息',
- },
- {
- value: 'home-page',
- label: '个人主页',
- },
- {
- value: 'setting',
- label: '设置',
- },
- ],
- },
-];
-
-Component({
- data: {
- list,
- },
-});
diff --git a/pages/tab-bar/sub/index.json b/pages/tab-bar/sub/index.json
deleted file mode 100644
index e16a2dd..0000000
--- a/pages/tab-bar/sub/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tab-bar": "tdesign-miniprogram/tab-bar/tab-bar",
- "t-tab-bar-item": "tdesign-miniprogram/tab-bar-item/tab-bar-item"
- }
-}
diff --git a/pages/tab-bar/sub/index.wxml b/pages/tab-bar/sub/index.wxml
deleted file mode 100644
index e4386ab..0000000
--- a/pages/tab-bar/sub/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- {{item.label}}
-
-
diff --git a/pages/tab-bar/sub/index.wxss b/pages/tab-bar/sub/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/tab-bar/tab-bar.d.ts b/pages/tab-bar/tab-bar.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/tab-bar/tab-bar.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/tab-bar/tab-bar.js b/pages/tab-bar/tab-bar.js
deleted file mode 100644
index a6aa7a2..0000000
--- a/pages/tab-bar/tab-bar.js
+++ /dev/null
@@ -1,8 +0,0 @@
-Page({
- data: {
- value: 'label_1',
- },
- onChange(event) {
- console.log(event.detail);
- },
-});
diff --git a/pages/tab-bar/tab-bar.json b/pages/tab-bar/tab-bar.json
deleted file mode 100644
index 6f46c01..0000000
--- a/pages/tab-bar/tab-bar.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "navigationBarTitleText": "TabBar",
- "usingComponents": {
- "text-only": "./text-only/index",
- "icon-only": "./icon-only/index",
- "base": "./base/index",
- "sub": "./sub/index",
- "badge": "./badge/index",
- "round": "./round/index",
- "custom": "./custom/index"
- }
-}
diff --git a/pages/tab-bar/tab-bar.wxml b/pages/tab-bar/tab-bar.wxml
deleted file mode 100644
index c8e64b9..0000000
--- a/pages/tab-bar/tab-bar.wxml
+++ /dev/null
@@ -1,31 +0,0 @@
-
- TabBar 标签栏
- 用于在不同功能模块之间进行快速切换,位于页面底部。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/tab-bar/tab-bar.wxss b/pages/tab-bar/tab-bar.wxss
deleted file mode 100644
index 3cadf69..0000000
--- a/pages/tab-bar/tab-bar.wxss
+++ /dev/null
@@ -1,12 +0,0 @@
-.demo .mb-12 {
- margin-bottom: 24rpx;
- display: block;
-}
-.demo .mg-16 {
- margin: 32rpx;
-}
-.demo .t-tab-bar {
- position: relative;
- padding-bottom: 0 !important;
- bottom: 0 !important;
-}
diff --git a/pages/tab-bar/text-only/index.js b/pages/tab-bar/text-only/index.js
deleted file mode 100644
index 02a1328..0000000
--- a/pages/tab-bar/text-only/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-Component({
- data: {
- value: 'home',
- list: [
- { value: 'home', label: '首页' },
- { value: 'app', label: '应用' },
- { value: 'chat', label: '聊天' },
- { value: 'user', label: '我的' },
- ],
- },
-
- methods: {
- onChange(e) {
- this.setData({
- value: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/tab-bar/text-only/index.json b/pages/tab-bar/text-only/index.json
deleted file mode 100644
index e16a2dd..0000000
--- a/pages/tab-bar/text-only/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tab-bar": "tdesign-miniprogram/tab-bar/tab-bar",
- "t-tab-bar-item": "tdesign-miniprogram/tab-bar-item/tab-bar-item"
- }
-}
diff --git a/pages/tab-bar/text-only/index.wxml b/pages/tab-bar/text-only/index.wxml
deleted file mode 100644
index 87d04f3..0000000
--- a/pages/tab-bar/text-only/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- {{item.label}}
-
diff --git a/pages/tab-bar/text-only/index.wxss b/pages/tab-bar/text-only/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/tabs/base/index.js b/pages/tabs/base/index.js
deleted file mode 100644
index f7defa2..0000000
--- a/pages/tabs/base/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-Component({
- data: {
- stickyProps: {
- zIndex: 2,
- },
- },
- methods: {
- onTabsChange(event) {
- console.log(`Change tab, tab-panel value is ${event.detail.value}.`);
- },
-
- onTabsClick(event) {
- console.log(`Click tab, tab-panel value is ${event.detail.value}.`);
- },
-
- onStickyScroll(event) {
- console.log(event.detail);
- },
- },
-});
diff --git a/pages/tabs/base/index.json b/pages/tabs/base/index.json
deleted file mode 100644
index 3950250..0000000
--- a/pages/tabs/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tabs": "tdesign-miniprogram/tabs/tabs",
- "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel"
- }
-}
diff --git a/pages/tabs/base/index.wxml b/pages/tabs/base/index.wxml
deleted file mode 100644
index e058b43..0000000
--- a/pages/tabs/base/index.wxml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/tabs/base/index.wxss b/pages/tabs/base/index.wxss
deleted file mode 100644
index bb78b99..0000000
--- a/pages/tabs/base/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.custom-tabs {
- margin-bottom: 32rpx;
-}
diff --git a/pages/tabs/scroll/index.js b/pages/tabs/scroll/index.js
deleted file mode 100644
index 23547f9..0000000
--- a/pages/tabs/scroll/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-Component({
- methods: {
- onTabsChange(event) {
- console.log(`Change tab, tab-panel value is ${event.detail.value}.`);
- },
-
- onTabsClick(event) {
- console.log(`Click tab, tab-panel value is ${event.detail.value}.`);
- },
- },
-});
diff --git a/pages/tabs/scroll/index.json b/pages/tabs/scroll/index.json
deleted file mode 100644
index 3950250..0000000
--- a/pages/tabs/scroll/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tabs": "tdesign-miniprogram/tabs/tabs",
- "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel"
- }
-}
diff --git a/pages/tabs/scroll/index.wxml b/pages/tabs/scroll/index.wxml
deleted file mode 100644
index f238eab..0000000
--- a/pages/tabs/scroll/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/tabs/scroll/index.wxss b/pages/tabs/scroll/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/tabs/size/index.js b/pages/tabs/size/index.js
deleted file mode 100644
index 23547f9..0000000
--- a/pages/tabs/size/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-Component({
- methods: {
- onTabsChange(event) {
- console.log(`Change tab, tab-panel value is ${event.detail.value}.`);
- },
-
- onTabsClick(event) {
- console.log(`Click tab, tab-panel value is ${event.detail.value}.`);
- },
- },
-});
diff --git a/pages/tabs/size/index.json b/pages/tabs/size/index.json
deleted file mode 100644
index 3950250..0000000
--- a/pages/tabs/size/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tabs": "tdesign-miniprogram/tabs/tabs",
- "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel"
- }
-}
diff --git a/pages/tabs/size/index.wxml b/pages/tabs/size/index.wxml
deleted file mode 100644
index 0d9dd54..0000000
--- a/pages/tabs/size/index.wxml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/tabs/size/index.wxss b/pages/tabs/size/index.wxss
deleted file mode 100644
index 9ecfe7c..0000000
--- a/pages/tabs/size/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.bigger {
- --tab-font-size: 32rpx;
-}
\ No newline at end of file
diff --git a/pages/tabs/status/index.js b/pages/tabs/status/index.js
deleted file mode 100644
index 7843182..0000000
--- a/pages/tabs/status/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-Component({
- data: {
- value: '0',
- },
- methods: {
- onTabsChange(event) {
- this.setData({
- value: event.detail.value,
- });
- console.log(`Change tab, tab-panel value is ${event.detail.value}.`);
- },
-
- onTabsClick(event) {
- console.log(`Click tab, tab-panel value is ${event.detail.value}.`);
- },
- },
-});
diff --git a/pages/tabs/status/index.json b/pages/tabs/status/index.json
deleted file mode 100644
index 3950250..0000000
--- a/pages/tabs/status/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tabs": "tdesign-miniprogram/tabs/tabs",
- "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel"
- }
-}
diff --git a/pages/tabs/status/index.wxml b/pages/tabs/status/index.wxml
deleted file mode 100644
index 05ee3f2..0000000
--- a/pages/tabs/status/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/tabs/status/index.wxss b/pages/tabs/status/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/tabs/tabs.d.ts b/pages/tabs/tabs.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/tabs/tabs.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/tabs/tabs.js b/pages/tabs/tabs.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/tabs/tabs.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/tabs/tabs.json b/pages/tabs/tabs.json
deleted file mode 100644
index 2057b43..0000000
--- a/pages/tabs/tabs.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "navigationBarTitleText": "Tabs",
- "usingComponents": {
- "base": "./base",
- "scroll": "./scroll",
- "size": "./size",
- "status": "./status",
- "with-icon": "./with-icon",
- "with-badge": "./with-badge",
- "theme": "./theme",
- "with-content": "./with-content"
- }
-}
diff --git a/pages/tabs/tabs.wxml b/pages/tabs/tabs.wxml
deleted file mode 100644
index 2025a62..0000000
--- a/pages/tabs/tabs.wxml
+++ /dev/null
@@ -1,28 +0,0 @@
-
- Tabs 选项卡
- 用于内容分类后的展示切换。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/tabs/tabs.wxss b/pages/tabs/tabs.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/tabs/theme/index.js b/pages/tabs/theme/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/tabs/theme/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/tabs/theme/index.json b/pages/tabs/theme/index.json
deleted file mode 100644
index 3950250..0000000
--- a/pages/tabs/theme/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tabs": "tdesign-miniprogram/tabs/tabs",
- "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel"
- }
-}
diff --git a/pages/tabs/theme/index.wxml b/pages/tabs/theme/index.wxml
deleted file mode 100644
index eb90cc5..0000000
--- a/pages/tabs/theme/index.wxml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/tabs/theme/index.wxss b/pages/tabs/theme/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/tabs/with-badge/index.js b/pages/tabs/with-badge/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/tabs/with-badge/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/tabs/with-badge/index.json b/pages/tabs/with-badge/index.json
deleted file mode 100644
index 3950250..0000000
--- a/pages/tabs/with-badge/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tabs": "tdesign-miniprogram/tabs/tabs",
- "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel"
- }
-}
diff --git a/pages/tabs/with-badge/index.wxml b/pages/tabs/with-badge/index.wxml
deleted file mode 100644
index 6d800f4..0000000
--- a/pages/tabs/with-badge/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pages/tabs/with-badge/index.wxss b/pages/tabs/with-badge/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/tabs/with-content/index.js b/pages/tabs/with-content/index.js
deleted file mode 100644
index cf8ce55..0000000
--- a/pages/tabs/with-content/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-Component({
- data: {
- tabPanelstyle: 'display:flex;justify-content:center;align-items:center;min-height: 120px',
- },
- methods: {
- onTabsChange(event) {
- console.log(`Change tab, tab-panel value is ${event.detail.value}.`);
- },
-
- onTabsClick(event) {
- console.log(`Click tab, tab-panel value is ${event.detail.value}.`);
- },
- },
-});
diff --git a/pages/tabs/with-content/index.json b/pages/tabs/with-content/index.json
deleted file mode 100644
index 3950250..0000000
--- a/pages/tabs/with-content/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tabs": "tdesign-miniprogram/tabs/tabs",
- "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel"
- }
-}
diff --git a/pages/tabs/with-content/index.wxml b/pages/tabs/with-content/index.wxml
deleted file mode 100644
index 0ecf7e8..0000000
--- a/pages/tabs/with-content/index.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
- 选项一内容
- 选项二内容
- 选项三内容
- 选项四内容
-
diff --git a/pages/tabs/with-content/index.wxss b/pages/tabs/with-content/index.wxss
deleted file mode 100644
index bb78b99..0000000
--- a/pages/tabs/with-content/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.custom-tabs {
- margin-bottom: 32rpx;
-}
diff --git a/pages/tabs/with-icon/index.js b/pages/tabs/with-icon/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/tabs/with-icon/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/tabs/with-icon/index.json b/pages/tabs/with-icon/index.json
deleted file mode 100644
index 3950250..0000000
--- a/pages/tabs/with-icon/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tabs": "tdesign-miniprogram/tabs/tabs",
- "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel"
- }
-}
diff --git a/pages/tabs/with-icon/index.wxml b/pages/tabs/with-icon/index.wxml
deleted file mode 100644
index a95bc69..0000000
--- a/pages/tabs/with-icon/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/pages/tabs/with-icon/index.wxss b/pages/tabs/with-icon/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/tag/checkable/index.js b/pages/tag/checkable/index.js
deleted file mode 100644
index ca7dc11..0000000
--- a/pages/tag/checkable/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- items: ['light', 'dark', 'outline', 'light-outline'],
- },
-});
diff --git a/pages/tag/checkable/index.json b/pages/tag/checkable/index.json
deleted file mode 100644
index 6d2d9be..0000000
--- a/pages/tag/checkable/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-check-tag": "tdesign-miniprogram/check-tag/check-tag"
- }
-}
diff --git a/pages/tag/checkable/index.wxml b/pages/tag/checkable/index.wxml
deleted file mode 100644
index 05d516f..0000000
--- a/pages/tag/checkable/index.wxml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
- {{item}}
-
-
-
-
-
diff --git a/pages/tag/checkable/index.wxss b/pages/tag/checkable/index.wxss
deleted file mode 100644
index 11bffef..0000000
--- a/pages/tag/checkable/index.wxss
+++ /dev/null
@@ -1,34 +0,0 @@
-.wrapper {
- flex-wrap: wrap;
- margin: 0 32rpx;
-}
-
-.wrapper t-check-tag {
- display: block;
-}
-
-.block {
- display: flex;
- font-size: 14px;
- align-items: center;
- line-height: 76rpx;
- color: rgba(0, 0, 0, 0.4);
-}
-
-.block text {
- display: block;
- width: 160rpx;
- margin-right: 32rpx;
-}
-
-/* .block t-check-tag {
- margin-right: 32rpx;
-} */
-
-.block + .block {
- margin-top: 32rpx;
-}
-
-.block .margin-16:not(:last-child) {
- margin-right: 32rpx;
-}
diff --git a/pages/tag/closable/index.js b/pages/tag/closable/index.js
deleted file mode 100644
index 3823523..0000000
--- a/pages/tag/closable/index.js
+++ /dev/null
@@ -1,18 +0,0 @@
-Component({
- data: {
- show: [true, true],
- },
-
- methods: {
- handleClose0() {
- this.setData({
- [`show[0]`]: false,
- });
- },
- handleClose1() {
- this.setData({
- [`show[1]`]: false,
- });
- },
- },
-});
diff --git a/pages/tag/closable/index.wxml b/pages/tag/closable/index.wxml
deleted file mode 100644
index c779ce5..0000000
--- a/pages/tag/closable/index.wxml
+++ /dev/null
@@ -1,4 +0,0 @@
-
- 文字标签
- 文字标签
-
diff --git a/pages/tag/closable/index.wxss b/pages/tag/closable/index.wxss
deleted file mode 100644
index 40a3607..0000000
--- a/pages/tag/closable/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.demo {
- margin-left: 32rpx;
-}
-
-.demo .margin-16:not(:last-child) {
- margin-right: 32rpx;
-}
diff --git a/pages/tag/size/index.js b/pages/tag/size/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/tag/size/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/tag/size/index.json b/pages/tag/size/index.json
deleted file mode 100644
index 32d56d9..0000000
--- a/pages/tag/size/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tag": "tdesign-miniprogram/tag/tag"
- }
-}
diff --git a/pages/tag/size/index.wxml b/pages/tag/size/index.wxml
deleted file mode 100644
index 882d7af..0000000
--- a/pages/tag/size/index.wxml
+++ /dev/null
@@ -1,13 +0,0 @@
-
- 加大尺寸
- 大尺寸
- 中尺寸
- 小尺寸
-
-
-
- 加大尺寸
- 大尺寸
- 中尺寸
- 小尺寸
-
diff --git a/pages/tag/size/index.wxss b/pages/tag/size/index.wxss
deleted file mode 100644
index a8436c9..0000000
--- a/pages/tag/size/index.wxss
+++ /dev/null
@@ -1,20 +0,0 @@
-.block {
- margin: 0 32rpx;
-}
-
-.block + .block {
- margin-top: 32rpx;
-}
-
-.block .margin-16,
-.block .margin-8 {
- vertical-align: top;
-}
-
-.block .margin-16:not(:last-child) {
- margin-right: 32rpx;
-}
-
-.block .margin-8:not(:last-child) {
- margin-right: 16rpx;
-}
diff --git a/pages/tag/tag.d.ts b/pages/tag/tag.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/tag/tag.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/tag/tag.js b/pages/tag/tag.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/tag/tag.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/tag/tag.json b/pages/tag/tag.json
deleted file mode 100644
index f67425a..0000000
--- a/pages/tag/tag.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "navigationBarTitleText": "Tag",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "theme": "./theme",
- "size": "./size",
- "type": "./type",
- "closable": "./closable",
- "checkable": "./checkable"
- }
-}
diff --git a/pages/tag/tag.wxml b/pages/tag/tag.wxml
deleted file mode 100644
index 3e83e0d..0000000
--- a/pages/tag/tag.wxml
+++ /dev/null
@@ -1,19 +0,0 @@
-
- Tag 标签
- 用于表明主体的类目,属性或状态。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/tag/tag.wxss b/pages/tag/tag.wxss
deleted file mode 100644
index e81280c..0000000
--- a/pages/tag/tag.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-page {
- background: #fff;
-}
diff --git a/pages/tag/theme/index.js b/pages/tag/theme/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/tag/theme/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/tag/theme/index.json b/pages/tag/theme/index.json
deleted file mode 100644
index 32d56d9..0000000
--- a/pages/tag/theme/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tag": "tdesign-miniprogram/tag/tag"
- }
-}
diff --git a/pages/tag/theme/index.wxml b/pages/tag/theme/index.wxml
deleted file mode 100644
index 45c62ac..0000000
--- a/pages/tag/theme/index.wxml
+++ /dev/null
@@ -1,31 +0,0 @@
-
- 默认
- 主要
- 警告
- 危险
- 成功
-
-
-
- 默认
- 主要
- 警告
- 危险
- 成功
-
-
-
- 默认
- 主要
- 警告
- 危险
- 成功
-
-
-
- 默认
- 主要
- 警告
- 危险
- 成功
-
diff --git a/pages/tag/theme/index.wxss b/pages/tag/theme/index.wxss
deleted file mode 100644
index fb0cd0a..0000000
--- a/pages/tag/theme/index.wxss
+++ /dev/null
@@ -1,11 +0,0 @@
-.block {
- margin: 0 32rpx;
-}
-
-.block + .block {
- margin-top: 48rpx;
-}
-
-.block .margin-16:not(:last-child) {
- margin-right: 32rpx;
-}
diff --git a/pages/tag/type/index.js b/pages/tag/type/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/tag/type/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/tag/type/index.json b/pages/tag/type/index.json
deleted file mode 100644
index 32d56d9..0000000
--- a/pages/tag/type/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tag": "tdesign-miniprogram/tag/tag"
- }
-}
diff --git a/pages/tag/type/index.wxml b/pages/tag/type/index.wxml
deleted file mode 100644
index b0ca48d..0000000
--- a/pages/tag/type/index.wxml
+++ /dev/null
@@ -1,27 +0,0 @@
-
- 基础标签
-
- 标签文字
- 标签文字
-
-
-
- 圆弧标签
-
- 标签文字
- 标签文字
- 标签文字
-
-
-
- 带图标的标签
-
- 标签文字
- 标签文字
-
-
-
- 超长省略文本标签
-
- 超长省略文本标签超长省略文本标签
-
diff --git a/pages/tag/type/index.wxss b/pages/tag/type/index.wxss
deleted file mode 100644
index b098281..0000000
--- a/pages/tag/type/index.wxss
+++ /dev/null
@@ -1,17 +0,0 @@
-.demo {
- padding: 0 32rpx 48rpx;
-}
-
-.demo:last-child {
- padding-bottom: 0;
-}
-
-.demo-desc {
- font-size: 14px;
- color: rgba(0, 0, 0, 0.6);
- margin-bottom: 32rpx;
-}
-
-.demo .margin-16:not(:last-child) {
- margin-right: 32rpx;
-}
diff --git a/pages/textarea/autosize/index.js b/pages/textarea/autosize/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/textarea/autosize/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/textarea/autosize/index.json b/pages/textarea/autosize/index.json
deleted file mode 100644
index 8969b79..0000000
--- a/pages/textarea/autosize/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-textarea": "tdesign-miniprogram/textarea/textarea"
- }
-}
diff --git a/pages/textarea/autosize/index.wxml b/pages/textarea/autosize/index.wxml
deleted file mode 100644
index f1130cb..0000000
--- a/pages/textarea/autosize/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/textarea/autosize/index.wxss b/pages/textarea/autosize/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/textarea/base/index.js b/pages/textarea/base/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/textarea/base/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/textarea/base/index.json b/pages/textarea/base/index.json
deleted file mode 100644
index 8969b79..0000000
--- a/pages/textarea/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-textarea": "tdesign-miniprogram/textarea/textarea"
- }
-}
diff --git a/pages/textarea/base/index.wxml b/pages/textarea/base/index.wxml
deleted file mode 100644
index 6d7e30c..0000000
--- a/pages/textarea/base/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/textarea/base/index.wxss b/pages/textarea/base/index.wxss
deleted file mode 100644
index 40db6e5..0000000
--- a/pages/textarea/base/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.external-class {
- height: 256rpx;
-}
diff --git a/pages/textarea/card/index.js b/pages/textarea/card/index.js
deleted file mode 100644
index a0cc7fd..0000000
--- a/pages/textarea/card/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- style: 'border-radius: 18rpx;',
- },
-});
diff --git a/pages/textarea/card/index.json b/pages/textarea/card/index.json
deleted file mode 100644
index 8969b79..0000000
--- a/pages/textarea/card/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-textarea": "tdesign-miniprogram/textarea/textarea"
- }
-}
diff --git a/pages/textarea/card/index.wxml b/pages/textarea/card/index.wxml
deleted file mode 100644
index f0d76ae..0000000
--- a/pages/textarea/card/index.wxml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
diff --git a/pages/textarea/card/index.wxss b/pages/textarea/card/index.wxss
deleted file mode 100644
index 3ec1bd2..0000000
--- a/pages/textarea/card/index.wxss
+++ /dev/null
@@ -1,9 +0,0 @@
-.textarea-example {
- margin: 0 32rpx;
- background-color: #fff;
- border-radius: 18rpx;
-}
-
-.external-class {
- height: 312rpx;
-}
diff --git a/pages/textarea/custom/index.js b/pages/textarea/custom/index.js
deleted file mode 100644
index 03cfe14..0000000
--- a/pages/textarea/custom/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Component({
- data: {
- style: 'height: 248rpx',
- },
-});
diff --git a/pages/textarea/custom/index.json b/pages/textarea/custom/index.json
deleted file mode 100644
index 8969b79..0000000
--- a/pages/textarea/custom/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-textarea": "tdesign-miniprogram/textarea/textarea"
- }
-}
diff --git a/pages/textarea/custom/index.wxml b/pages/textarea/custom/index.wxml
deleted file mode 100644
index b98e085..0000000
--- a/pages/textarea/custom/index.wxml
+++ /dev/null
@@ -1,12 +0,0 @@
-
- 标签文字
-
-
diff --git a/pages/textarea/custom/index.wxss b/pages/textarea/custom/index.wxss
deleted file mode 100644
index 2877c01..0000000
--- a/pages/textarea/custom/index.wxss
+++ /dev/null
@@ -1,17 +0,0 @@
-.textarea-example {
- padding: 32rpx 32rpx 48rpx;
- background-color: #fff;
-}
-
-.external-class {
- padding-top: 24rpx !important;
- padding-bottom: 24rpx !important;
-}
-
-.textarea-example__label {
- display: block;
- color: rgba(0, 0, 0, 0.9);
- font-size: 24rpx;
- line-height: 40rpx;
- padding-bottom: 16rpx;
-}
diff --git a/pages/textarea/disabled/index.js b/pages/textarea/disabled/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/textarea/disabled/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/textarea/disabled/index.json b/pages/textarea/disabled/index.json
deleted file mode 100644
index 8969b79..0000000
--- a/pages/textarea/disabled/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-textarea": "tdesign-miniprogram/textarea/textarea"
- }
-}
diff --git a/pages/textarea/disabled/index.wxml b/pages/textarea/disabled/index.wxml
deleted file mode 100644
index 8547fb3..0000000
--- a/pages/textarea/disabled/index.wxml
+++ /dev/null
@@ -1,8 +0,0 @@
-
diff --git a/pages/textarea/disabled/index.wxss b/pages/textarea/disabled/index.wxss
deleted file mode 100644
index 40db6e5..0000000
--- a/pages/textarea/disabled/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.external-class {
- height: 256rpx;
-}
diff --git a/pages/textarea/label/index.js b/pages/textarea/label/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/textarea/label/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/textarea/label/index.json b/pages/textarea/label/index.json
deleted file mode 100644
index 8969b79..0000000
--- a/pages/textarea/label/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-textarea": "tdesign-miniprogram/textarea/textarea"
- }
-}
diff --git a/pages/textarea/label/index.wxml b/pages/textarea/label/index.wxml
deleted file mode 100644
index 1885bf9..0000000
--- a/pages/textarea/label/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/textarea/label/index.wxss b/pages/textarea/label/index.wxss
deleted file mode 100644
index 40db6e5..0000000
--- a/pages/textarea/label/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.external-class {
- height: 256rpx;
-}
diff --git a/pages/textarea/maxcharacter/index.js b/pages/textarea/maxcharacter/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/textarea/maxcharacter/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/textarea/maxcharacter/index.json b/pages/textarea/maxcharacter/index.json
deleted file mode 100644
index 8969b79..0000000
--- a/pages/textarea/maxcharacter/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-textarea": "tdesign-miniprogram/textarea/textarea"
- }
-}
diff --git a/pages/textarea/maxcharacter/index.wxml b/pages/textarea/maxcharacter/index.wxml
deleted file mode 100644
index 67bf5a7..0000000
--- a/pages/textarea/maxcharacter/index.wxml
+++ /dev/null
@@ -1,8 +0,0 @@
-
diff --git a/pages/textarea/maxcharacter/index.wxss b/pages/textarea/maxcharacter/index.wxss
deleted file mode 100644
index 890510d..0000000
--- a/pages/textarea/maxcharacter/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.external-class {
- height: 324rpx;
-}
diff --git a/pages/textarea/maxlength/index.js b/pages/textarea/maxlength/index.js
deleted file mode 100644
index b79c512..0000000
--- a/pages/textarea/maxlength/index.js
+++ /dev/null
@@ -1 +0,0 @@
-Component({});
diff --git a/pages/textarea/maxlength/index.json b/pages/textarea/maxlength/index.json
deleted file mode 100644
index 8969b79..0000000
--- a/pages/textarea/maxlength/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-textarea": "tdesign-miniprogram/textarea/textarea"
- }
-}
diff --git a/pages/textarea/maxlength/index.wxml b/pages/textarea/maxlength/index.wxml
deleted file mode 100644
index 0303e4a..0000000
--- a/pages/textarea/maxlength/index.wxml
+++ /dev/null
@@ -1,8 +0,0 @@
-
diff --git a/pages/textarea/maxlength/index.wxss b/pages/textarea/maxlength/index.wxss
deleted file mode 100644
index 890510d..0000000
--- a/pages/textarea/maxlength/index.wxss
+++ /dev/null
@@ -1,3 +0,0 @@
-.external-class {
- height: 324rpx;
-}
diff --git a/pages/textarea/textarea.d.ts b/pages/textarea/textarea.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/textarea/textarea.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/textarea/textarea.js b/pages/textarea/textarea.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/textarea/textarea.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/textarea/textarea.json b/pages/textarea/textarea.json
deleted file mode 100644
index f5be04f..0000000
--- a/pages/textarea/textarea.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "navigationBarTitleText": "Textarea",
- "usingComponents": {
- "base": "./base",
- "label": "./label",
- "autosize": "./autosize",
- "disabled": "./disabled",
- "maxcharacter": "./maxcharacter",
- "maxlength": "./maxlength",
- "card": "./card",
- "custom": "./custom"
- }
-}
diff --git a/pages/textarea/textarea.wxml b/pages/textarea/textarea.wxml
deleted file mode 100644
index c645954..0000000
--- a/pages/textarea/textarea.wxml
+++ /dev/null
@@ -1,28 +0,0 @@
-
- Textarea 多行文本框
- 用于多行文本信息输入。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/textarea/textarea.wxss b/pages/textarea/textarea.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/toast/base/index.js b/pages/toast/base/index.js
deleted file mode 100644
index 8142ed2..0000000
--- a/pages/toast/base/index.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import Toast from 'tdesign-miniprogram/toast/index';
-
-Page({
- showText() {
- Toast({
- context: this,
- selector: '#t-toast',
- message: '轻提示文字内容',
- });
- },
-
- showMultiText() {
- Toast({
- context: this,
- selector: '#t-toast',
- message: '最多一行展示十个汉字宽度限制最多不超过三行文字',
- });
- },
-
- showHorizontalText() {
- Toast({
- context: this,
- selector: '#t-toast',
- message: '带横向图标',
- icon: 'check-circle',
- });
- },
-
- showVerticalText() {
- Toast({
- context: this,
- selector: '#t-toast',
- message: '带竖向图标',
- icon: 'check-circle',
- direction: 'column',
- });
- },
-
- showLoading() {
- Toast({
- context: this,
- selector: '#t-toast',
- message: '加载中...',
- theme: 'loading',
- direction: 'column',
- });
- },
-});
diff --git a/pages/toast/base/index.json b/pages/toast/base/index.json
deleted file mode 100644
index cad2b36..0000000
--- a/pages/toast/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-toast": "tdesign-miniprogram/toast/toast",
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/toast/base/index.wxml b/pages/toast/base/index.wxml
deleted file mode 100644
index 4bc7a1a..0000000
--- a/pages/toast/base/index.wxml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-纯文本
-多行文字
-带横向图标
-带竖向图标
-加载状态
diff --git a/pages/toast/base/index.wxss b/pages/toast/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/toast/close/index.js b/pages/toast/close/index.js
deleted file mode 100644
index 13a2727..0000000
--- a/pages/toast/close/index.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import Toast, { hideToast } from 'tdesign-miniprogram/toast/index';
-
-Page({
- handleShow() {
- Toast({
- context: this,
- selector: '#t-toast',
- duration: -1,
- message: '轻提示文字内容',
- });
- },
- handleHide() {
- hideToast({
- context: this,
- selector: '#t-toast',
- });
- },
-});
diff --git a/pages/toast/close/index.json b/pages/toast/close/index.json
deleted file mode 100644
index 1237a61..0000000
--- a/pages/toast/close/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-toast": "tdesign-miniprogram/toast/toast"
- }
-}
diff --git a/pages/toast/close/index.wxml b/pages/toast/close/index.wxml
deleted file mode 100644
index 894bfac..0000000
--- a/pages/toast/close/index.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- 显示提示
- 关闭提示
-
diff --git a/pages/toast/close/index.wxss b/pages/toast/close/index.wxss
deleted file mode 100644
index b11ddd7..0000000
--- a/pages/toast/close/index.wxss
+++ /dev/null
@@ -1,7 +0,0 @@
-.toast-example {
- text-align: center;
-}
-
-.margin-16 {
- margin-right: 32rpx;
-}
diff --git a/pages/toast/cover/index.js b/pages/toast/cover/index.js
deleted file mode 100644
index d99a026..0000000
--- a/pages/toast/cover/index.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import Toast from 'tdesign-miniprogram/toast/index';
-
-Page({
- handleToast() {
- Toast({
- context: this,
- selector: '#t-toast',
- message: '禁止滑动和点击',
- direction: 'column',
- duration: 3000,
- preventScrollThrough: true,
- icon: 'poweroff',
- });
- },
-});
diff --git a/pages/toast/cover/index.json b/pages/toast/cover/index.json
deleted file mode 100644
index 1237a61..0000000
--- a/pages/toast/cover/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-toast": "tdesign-miniprogram/toast/toast"
- }
-}
diff --git a/pages/toast/cover/index.wxml b/pages/toast/cover/index.wxml
deleted file mode 100644
index 2c984bc..0000000
--- a/pages/toast/cover/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-禁止滑动和点击
diff --git a/pages/toast/cover/index.wxss b/pages/toast/cover/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/toast/display/index.js b/pages/toast/display/index.js
deleted file mode 100644
index 366df60..0000000
--- a/pages/toast/display/index.js
+++ /dev/null
@@ -1,50 +0,0 @@
-import Toast from 'tdesign-miniprogram/toast/index';
-
-Page({
- toast(option) {
- Toast({
- context: this,
- selector: '#t-toast',
- ...option,
- });
- },
- handleToast(e) {
- switch (e.target.dataset.type) {
- case 'topShow': {
- this.toast({
- message: '顶部-展示1秒',
- direction: 'column',
- placement: 'top',
- duration: 1000,
- icon: 'star',
- });
- break;
- }
- case 'middleShow': {
- this.toast({
- message: '中间-展示2秒',
- direction: 'column',
- duration: 2000,
- icon: 'star',
- });
- break;
- }
- case 'bottomShow': {
- this.toast({
- message: '底部-展示3秒',
- direction: 'column',
- placement: 'bottom',
- duration: 3000,
- icon: 'star',
- });
- break;
- }
-
- default: {
- this.toast({
- message: '未知点击事件',
- });
- }
- }
- },
-});
diff --git a/pages/toast/display/index.json b/pages/toast/display/index.json
deleted file mode 100644
index 1237a61..0000000
--- a/pages/toast/display/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-toast": "tdesign-miniprogram/toast/toast"
- }
-}
diff --git a/pages/toast/display/index.wxml b/pages/toast/display/index.wxml
deleted file mode 100644
index 17a3d34..0000000
--- a/pages/toast/display/index.wxml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-顶部展示1秒
-中间展示2秒
-底部展示3秒
diff --git a/pages/toast/display/index.wxss b/pages/toast/display/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/toast/theme/index.js b/pages/toast/theme/index.js
deleted file mode 100644
index 91444cf..0000000
--- a/pages/toast/theme/index.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import Toast from 'tdesign-miniprogram/toast/index';
-
-Page({
- showSuccessToast() {
- Toast({
- context: this,
- selector: '#t-toast',
- message: '成功文案',
- theme: 'success',
- direction: 'column',
- });
- },
-
- showWarningToast() {
- Toast({
- context: this,
- selector: '#t-toast',
- message: '警告文案',
- theme: 'warning',
- direction: 'column',
- });
- },
-
- showErrorToast() {
- Toast({
- context: this,
- selector: '#t-toast',
- message: '错误文案',
- theme: 'error',
- direction: 'column',
- });
- },
-});
diff --git a/pages/toast/theme/index.json b/pages/toast/theme/index.json
deleted file mode 100644
index cad2b36..0000000
--- a/pages/toast/theme/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-toast": "tdesign-miniprogram/toast/toast",
- "t-button": "tdesign-miniprogram/button/button"
- }
-}
diff --git a/pages/toast/theme/index.wxml b/pages/toast/theme/index.wxml
deleted file mode 100644
index cee53bc..0000000
--- a/pages/toast/theme/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-成功提示
-警告提示
-错误提示
diff --git a/pages/toast/theme/index.wxss b/pages/toast/theme/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/toast/toast.d.ts b/pages/toast/toast.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/toast/toast.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/toast/toast.js b/pages/toast/toast.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/toast/toast.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/toast/toast.json b/pages/toast/toast.json
deleted file mode 100644
index 582718d..0000000
--- a/pages/toast/toast.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "navigationBarTitleText": "Toast",
- "navigationBarBackgroundColor": "#fff",
- "usingComponents": {
- "base": "./base",
- "theme": "./theme",
- "display": "./display",
- "cover": "./cover",
- "close": "./close"
- }
-}
diff --git a/pages/toast/toast.wxml b/pages/toast/toast.wxml
deleted file mode 100644
index 1ffbbb5..0000000
--- a/pages/toast/toast.wxml
+++ /dev/null
@@ -1,16 +0,0 @@
-
- Toast 轻提示
- 用于轻量级反馈或提示,不会打断用户操作。
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/toast/toast.wxss b/pages/toast/toast.wxss
deleted file mode 100644
index 3b5e1a1..0000000
--- a/pages/toast/toast.wxss
+++ /dev/null
@@ -1,11 +0,0 @@
-.demo .t-button {
- margin-bottom: 32rpx;
-}
-.demo .box {
- display: block;
- box-sizing: border-box;
- padding: 0 32rpx;
-}
-page {
- background-color: #fff !important;
-}
diff --git a/pages/transition/api.md b/pages/transition/api.md
deleted file mode 100644
index 0eaec76..0000000
--- a/pages/transition/api.md
+++ /dev/null
@@ -1,10 +0,0 @@
-
-### Transition Props
-名称 | 类型 | 默认值 | 说明 | 必传
--- | -- | -- | -- | --
-appear | Boolean | false | 首次出现是否展示动画 | N
-customClass | String | '' | 自定义容器类名 | N
-destoryOnClose | Boolean | false | 隐藏时是否销毁内容 | N
-duration | Number | - | 指定过渡时间 | N
-name | String | 't-transition' | 过渡类名 | N
-visible | Boolean | false | 是否显示 | N
\ No newline at end of file
diff --git a/pages/transition/appear/index.d.ts b/pages/transition/appear/index.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/transition/appear/index.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/transition/appear/index.js b/pages/transition/appear/index.js
deleted file mode 100644
index ed11cc5..0000000
--- a/pages/transition/appear/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-Component({
- options: {
- addGlobalClass: true,
- },
- data: {
- visible: false,
- },
- methods: {
- onTriggerClick() {
- this.setData({
- visible: !this.data.visible,
- });
- },
- onClose() {
- this.setData({
- visible: false,
- });
- },
- },
-});
diff --git a/pages/transition/appear/index.json b/pages/transition/appear/index.json
deleted file mode 100644
index 146fc02..0000000
--- a/pages/transition/appear/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-transition": "tdesign-miniprogram/transition/transition"
- }
-}
diff --git a/pages/transition/appear/index.wxml b/pages/transition/appear/index.wxml
deleted file mode 100644
index ab2c941..0000000
--- a/pages/transition/appear/index.wxml
+++ /dev/null
@@ -1,7 +0,0 @@
-Toggle attach
-
-
-
-
-
-
diff --git a/pages/transition/base/index.d.ts b/pages/transition/base/index.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/transition/base/index.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/transition/base/index.js b/pages/transition/base/index.js
deleted file mode 100644
index 3c73119..0000000
--- a/pages/transition/base/index.js
+++ /dev/null
@@ -1,22 +0,0 @@
-Component({
- options: {
- addGlobalClass: true,
- },
- data: {
- visible: false,
- style: 'display:none',
- customStyle: 'font-size: 9px',
- },
- methods: {
- onTriggerClick() {
- this.setData({
- visible: !this.data.visible,
- });
- },
- onClose() {
- this.setData({
- visible: false,
- });
- },
- },
-});
diff --git a/pages/transition/base/index.json b/pages/transition/base/index.json
deleted file mode 100644
index 146fc02..0000000
--- a/pages/transition/base/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-transition": "tdesign-miniprogram/transition/transition"
- }
-}
diff --git a/pages/transition/base/index.wxml b/pages/transition/base/index.wxml
deleted file mode 100644
index 41718c1..0000000
--- a/pages/transition/base/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-Toggle
-
-
-
-
diff --git a/pages/transition/custom/index.d.ts b/pages/transition/custom/index.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/transition/custom/index.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/transition/custom/index.js b/pages/transition/custom/index.js
deleted file mode 100644
index ed11cc5..0000000
--- a/pages/transition/custom/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-Component({
- options: {
- addGlobalClass: true,
- },
- data: {
- visible: false,
- },
- methods: {
- onTriggerClick() {
- this.setData({
- visible: !this.data.visible,
- });
- },
- onClose() {
- this.setData({
- visible: false,
- });
- },
- },
-});
diff --git a/pages/transition/custom/index.json b/pages/transition/custom/index.json
deleted file mode 100644
index 146fc02..0000000
--- a/pages/transition/custom/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-transition": "tdesign-miniprogram/transition/transition"
- }
-}
diff --git a/pages/transition/custom/index.wxml b/pages/transition/custom/index.wxml
deleted file mode 100644
index b9ac8e6..0000000
--- a/pages/transition/custom/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-Toggle
-
-
-
-
diff --git a/pages/transition/custom/index.wxss b/pages/transition/custom/index.wxss
deleted file mode 100644
index 1a6cb5d..0000000
--- a/pages/transition/custom/index.wxss
+++ /dev/null
@@ -1,18 +0,0 @@
-.translate-enter {
- opacity: 0;
- transform: translateX(100%);
-}
-.translate-enter-to {
- opacity: 1;
- transform: translateX(0%);
- transition: all 1s;
-}
-.translate-leave {
- opacity: 1;
- transform: translateX(0%);
-}
-.translate-leave-to {
- opacity: 0;
- transform: translateX(100%);
- transition: all 1s;
-}
diff --git a/pages/transition/destroy/index.d.ts b/pages/transition/destroy/index.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/transition/destroy/index.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/transition/destroy/index.js b/pages/transition/destroy/index.js
deleted file mode 100644
index ed11cc5..0000000
--- a/pages/transition/destroy/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-Component({
- options: {
- addGlobalClass: true,
- },
- data: {
- visible: false,
- },
- methods: {
- onTriggerClick() {
- this.setData({
- visible: !this.data.visible,
- });
- },
- onClose() {
- this.setData({
- visible: false,
- });
- },
- },
-});
diff --git a/pages/transition/destroy/index.json b/pages/transition/destroy/index.json
deleted file mode 100644
index 146fc02..0000000
--- a/pages/transition/destroy/index.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-button": "tdesign-miniprogram/button/button",
- "t-transition": "tdesign-miniprogram/transition/transition"
- }
-}
diff --git a/pages/transition/destroy/index.wxml b/pages/transition/destroy/index.wxml
deleted file mode 100644
index 2922fbb..0000000
--- a/pages/transition/destroy/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-Toggle attach
-
-
-
-
diff --git a/pages/transition/transition.d.ts b/pages/transition/transition.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/transition/transition.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/transition/transition.js b/pages/transition/transition.js
deleted file mode 100644
index cad664b..0000000
--- a/pages/transition/transition.js
+++ /dev/null
@@ -1,10 +0,0 @@
-Page({
- data: {
- visible: false,
- },
- onTriggerClick() {
- this.setData({
- visible: !this.data.visible,
- });
- },
-});
diff --git a/pages/transition/transition.json b/pages/transition/transition.json
deleted file mode 100644
index b4c2005..0000000
--- a/pages/transition/transition.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarTitleText": "Transition 过渡",
- "usingComponents": {
- "base": "./base",
- "custom": "./custom",
- "destroy": "./destroy",
- "appear": "./appear"
- }
-}
diff --git a/pages/transition/transition.wxml b/pages/transition/transition.wxml
deleted file mode 100644
index 587539d..0000000
--- a/pages/transition/transition.wxml
+++ /dev/null
@@ -1,16 +0,0 @@
-
- Transition 过渡
- 过渡。
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/transition/transition.wxss b/pages/transition/transition.wxss
deleted file mode 100644
index e6894da..0000000
--- a/pages/transition/transition.wxss
+++ /dev/null
@@ -1,24 +0,0 @@
-.block {
- margin-top: 10px;
- width: 100px;
- height: 100px;
- background: #0052d9;
-}
-.translate-enter {
- opacity: 0;
- transform: translateX(40px);
-}
-.translate-enter-to {
- opacity: 1;
- transform: translateY(0%);
- transition: all 1s;
-}
-.translate-leave {
- opacity: 1;
- transform: translateY(0%);
-}
-.translate-leave-to {
- opacity: 0;
- transform: translateX(40px);
- transition: all 1s;
-}
diff --git a/pages/tree-select/base/index.js b/pages/tree-select/base/index.js
deleted file mode 100644
index 090ab38..0000000
--- a/pages/tree-select/base/index.js
+++ /dev/null
@@ -1,35 +0,0 @@
-const chineseNumber = '一二三四五六七八九十'.split('');
-
-const generateTree = function (deep = 0, count = 10, prefix) {
- const ans = [];
-
- for (let i = 0; i < count; i += 1) {
- const value = prefix ? `${prefix}-${i}` : `${i}`;
- const rect = {
- label: `选项${chineseNumber[i]}`,
- value,
- };
-
- if (deep > 0) {
- rect.children = generateTree(deep - 1, 10, value);
- }
- ans.push(rect);
- }
-
- return ans;
-};
-
-Component({
- data: {
- options: generateTree(1),
- value: ['0', '0-0'],
- },
-
- methods: {
- onChange(e) {
- this.setData({
- value: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/tree-select/base/index.json b/pages/tree-select/base/index.json
deleted file mode 100644
index caaf40d..0000000
--- a/pages/tree-select/base/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tree-select": "tdesign-miniprogram/tree-select/tree-select"
- }
-}
diff --git a/pages/tree-select/base/index.wxml b/pages/tree-select/base/index.wxml
deleted file mode 100644
index d71ae70..0000000
--- a/pages/tree-select/base/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/tree-select/base/index.wxss b/pages/tree-select/base/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/tree-select/multiple/index.js b/pages/tree-select/multiple/index.js
deleted file mode 100644
index 5c36d4f..0000000
--- a/pages/tree-select/multiple/index.js
+++ /dev/null
@@ -1,35 +0,0 @@
-const chineseNumber = '一二三四五六七八九十'.split('');
-
-const generateTree = function (deep = 0, count = 10, prefix) {
- const ans = [];
-
- for (let i = 0; i < count; i += 1) {
- const value = prefix ? `${prefix}-${i}` : `${i}`;
- const rect = {
- label: `选项${chineseNumber[i]}`,
- value,
- };
-
- if (deep > 0) {
- rect.children = generateTree(deep - 1, 10, value);
- }
- ans.push(rect);
- }
-
- return ans;
-};
-
-Component({
- data: {
- options: generateTree(1),
- value: ['0', ['0-0', '0-1']],
- },
-
- methods: {
- onChange(e) {
- this.setData({
- value: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/tree-select/multiple/index.json b/pages/tree-select/multiple/index.json
deleted file mode 100644
index caaf40d..0000000
--- a/pages/tree-select/multiple/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tree-select": "tdesign-miniprogram/tree-select/tree-select"
- }
-}
diff --git a/pages/tree-select/multiple/index.wxml b/pages/tree-select/multiple/index.wxml
deleted file mode 100644
index a526014..0000000
--- a/pages/tree-select/multiple/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/tree-select/multiple/index.wxss b/pages/tree-select/multiple/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/tree-select/normal/index.js b/pages/tree-select/normal/index.js
deleted file mode 100644
index d90a5b5..0000000
--- a/pages/tree-select/normal/index.js
+++ /dev/null
@@ -1,134 +0,0 @@
-const areaList = {
- provinces: {
- 110000: '北京市',
- 440000: '广东省',
- },
- cities: {
- 110100: '北京市',
- 440100: '广州市',
- 440200: '韶关市',
- 440300: '深圳市',
- 440400: '珠海市',
- 440500: '汕头市',
- 440600: '佛山市',
- },
- counties: {
- 110101: '东城区',
- 110102: '西城区',
- 110105: '朝阳区',
- 110106: '丰台区',
- 110107: '石景山区',
- 110108: '海淀区',
- 110109: '门头沟区',
- 110111: '房山区',
- 110112: '通州区',
- 110113: '顺义区',
- 110114: '昌平区',
- 110115: '大兴区',
- 110116: '怀柔区',
- 110117: '平谷区',
- 110118: '密云区',
- 110119: '延庆区',
- 440103: '荔湾区',
- 440104: '越秀区',
- 440105: '海珠区',
- 440106: '天河区',
- 440111: '白云区',
- 440112: '黄埔区',
- 440113: '番禺区',
- 440114: '花都区',
- 440115: '南沙区',
- 440117: '从化区',
- 440118: '增城区',
- 440203: '武江区',
- 440204: '浈江区',
- 440205: '曲江区',
- 440222: '始兴县',
- 440224: '仁化县',
- 440229: '翁源县',
- 440232: '乳源瑶族自治县',
- 440233: '新丰县',
- 440281: '乐昌市',
- 440282: '南雄市',
- 440303: '罗湖区',
- 440304: '福田区',
- 440305: '南山区',
- 440306: '宝安区',
- 440307: '龙岗区',
- 440308: '盐田区',
- 440309: '龙华区',
- 440310: '坪山区',
- 440311: '光明区',
- 440402: '香洲区',
- 440403: '斗门区',
- 440404: '金湾区',
- 440507: '龙湖区',
- 440511: '金平区',
- 440512: '濠江区',
- 440513: '潮阳区',
- 440514: '潮南区',
- 440515: '澄海区',
- 440523: '南澳县',
- 440604: '禅城区',
- 440605: '南海区',
- 440606: '顺德区',
- 440607: '三水区',
- 440608: '高明区',
- },
-};
-
-const generateTree = () => {
- const { provinces, cities, counties } = areaList;
- const options = [];
- const eachObj = (obj, cb) => Object.keys(obj).forEach(cb);
- const match = (v1, v2, base) => parseInt(v1 / base, 10) === parseInt(v2 / base, 10);
-
- eachObj(provinces, (prov) => {
- const cityList = [];
-
- eachObj(cities, (city) => {
- const countyList = [];
-
- if (match(city, prov, 10000)) {
- eachObj(counties, (county) => {
- if (match(county, city, 100)) {
- countyList.push({
- label: counties[county],
- value: county,
- });
- }
- });
- cityList.push({
- label: cities[city],
- value: city,
- children: countyList,
- });
- }
- });
-
- const item = {
- label: provinces[prov],
- value: prov,
- children: cityList,
- };
-
- options.push(item);
- });
-
- return options;
-};
-
-Component({
- data: {
- options: generateTree(),
- value: ['110000', '110100', '110101'],
- },
-
- methods: {
- onChange(e) {
- this.setData({
- value: e.detail.value,
- });
- },
- },
-});
diff --git a/pages/tree-select/normal/index.json b/pages/tree-select/normal/index.json
deleted file mode 100644
index caaf40d..0000000
--- a/pages/tree-select/normal/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-tree-select": "tdesign-miniprogram/tree-select/tree-select"
- }
-}
diff --git a/pages/tree-select/normal/index.wxml b/pages/tree-select/normal/index.wxml
deleted file mode 100644
index d71ae70..0000000
--- a/pages/tree-select/normal/index.wxml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/tree-select/normal/index.wxss b/pages/tree-select/normal/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/tree-select/tree-select.js b/pages/tree-select/tree-select.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/tree-select/tree-select.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/tree-select/tree-select.json b/pages/tree-select/tree-select.json
deleted file mode 100644
index e38141d..0000000
--- a/pages/tree-select/tree-select.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "navigationBarTitleText": "TreeSelect",
- "usingComponents": {
- "base": "./base",
- "normal": "./normal",
- "multiple": "./multiple"
- }
-}
diff --git a/pages/tree-select/tree-select.wxml b/pages/tree-select/tree-select.wxml
deleted file mode 100644
index 8def822..0000000
--- a/pages/tree-select/tree-select.wxml
+++ /dev/null
@@ -1,15 +0,0 @@
-
- TreeSelect 树形选择
- 适用于选择树形的数据结构。
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/tree-select/tree-select.wxss b/pages/tree-select/tree-select.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/upload/messageFile/index.js b/pages/upload/messageFile/index.js
deleted file mode 100644
index 543ac5a..0000000
--- a/pages/upload/messageFile/index.js
+++ /dev/null
@@ -1,35 +0,0 @@
-Component({
- data: {
- originFiles: [
- {
- url: 'https://tdesign.gtimg.com/miniprogram/images/example4.png',
- name: 'uploaded1.png',
- type: 'image',
- },
- ],
- gridConfig: {
- column: 4,
- width: 160,
- height: 160,
- },
- config: {
- count: 1,
- },
- },
- methods: {
- handleSuccess(e) {
- const { files } = e.detail;
- this.setData({
- originFiles: files,
- });
- },
- handleRemove(e) {
- const { index } = e.detail;
- const { originFiles } = this.data;
- originFiles.splice(index, 1);
- this.setData({
- originFiles,
- });
- },
- },
-});
diff --git a/pages/upload/messageFile/index.json b/pages/upload/messageFile/index.json
deleted file mode 100644
index b2b7fb8..0000000
--- a/pages/upload/messageFile/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-upload": "tdesign-miniprogram/upload/upload"
- }
-}
diff --git a/pages/upload/messageFile/index.wxml b/pages/upload/messageFile/index.wxml
deleted file mode 100644
index 21e54ee..0000000
--- a/pages/upload/messageFile/index.wxml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
diff --git a/pages/upload/messageFile/index.wxss b/pages/upload/messageFile/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/upload/multiple/index.js b/pages/upload/multiple/index.js
deleted file mode 100644
index 20452ab..0000000
--- a/pages/upload/multiple/index.js
+++ /dev/null
@@ -1,48 +0,0 @@
-Component({
- data: {
- originFiles: [
- {
- url: 'https://tdesign.gtimg.com/miniprogram/images/example4.png',
- name: 'uploaded1.png',
- type: 'image',
- },
- {
- url: 'https://tdesign.gtimg.com/miniprogram/images/example6.png',
- name: 'uploaded2.png',
- type: 'image',
- },
- {
- url: 'https://tdesign.gtimg.com/miniprogram/images/example5.png',
- name: 'uploaded1.png',
- type: 'image',
- },
- ],
- gridConfig: {
- column: 4,
- width: 160,
- height: 160,
- },
- config: {
- count: 1,
- },
- },
- methods: {
- handleSuccess(e) {
- const { files } = e.detail;
- this.setData({
- originFiles: files,
- });
- },
- handleRemove(e) {
- const { index } = e.detail;
- const { originFiles } = this.data;
- originFiles.splice(index, 1);
- this.setData({
- originFiles,
- });
- },
- handleClick(e) {
- console.log(e.detail.file);
- },
- },
-});
diff --git a/pages/upload/multiple/index.json b/pages/upload/multiple/index.json
deleted file mode 100644
index b2b7fb8..0000000
--- a/pages/upload/multiple/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-upload": "tdesign-miniprogram/upload/upload"
- }
-}
diff --git a/pages/upload/multiple/index.wxml b/pages/upload/multiple/index.wxml
deleted file mode 100644
index 47c70b4..0000000
--- a/pages/upload/multiple/index.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
diff --git a/pages/upload/multiple/index.wxss b/pages/upload/multiple/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/upload/single/index.js b/pages/upload/single/index.js
deleted file mode 100644
index c4c2f36..0000000
--- a/pages/upload/single/index.js
+++ /dev/null
@@ -1,53 +0,0 @@
-Component({
- data: {
- fileList: [],
- },
- methods: {
- handleAdd(e) {
- const { fileList } = this.data;
- const { files } = e.detail;
-
- // 方法1:选择完所有图片之后,统一上传,因此选择完就直接展示
- this.setData({
- fileList: [...fileList, ...files], // 此时设置了 fileList 之后才会展示选择的图片
- });
-
- // 方法2:每次选择图片都上传,展示每次上传图片的进度
- // files.forEach(file => this.uploadFile(file))
- },
- onUpload(file) {
- const { fileList } = this.data;
-
- this.setData({
- fileList: [...fileList, { ...file, status: 'loading' }],
- });
- const { length } = fileList;
-
- const task = wx.uploadFile({
- url: 'https://example.weixin.qq.com/upload', // 仅为示例,非真实的接口地址
- filePath: file.url,
- name: 'file',
- formData: { user: 'test' },
- success: () => {
- this.setData({
- [`fileList[${length}].status`]: 'done',
- });
- },
- });
- task.onProgressUpdate((res) => {
- this.setData({
- [`fileList[${length}].percent`]: res.progress,
- });
- });
- },
- handleRemove(e) {
- const { index } = e.detail;
- const { fileList } = this.data;
-
- fileList.splice(index, 1);
- this.setData({
- fileList,
- });
- },
- },
-});
diff --git a/pages/upload/single/index.json b/pages/upload/single/index.json
deleted file mode 100644
index b2b7fb8..0000000
--- a/pages/upload/single/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-upload": "tdesign-miniprogram/upload/upload"
- }
-}
diff --git a/pages/upload/single/index.wxml b/pages/upload/single/index.wxml
deleted file mode 100644
index 9ca622f..0000000
--- a/pages/upload/single/index.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
diff --git a/pages/upload/single/index.wxss b/pages/upload/single/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/upload/status/index.js b/pages/upload/status/index.js
deleted file mode 100644
index fe5abf6..0000000
--- a/pages/upload/status/index.js
+++ /dev/null
@@ -1,58 +0,0 @@
-Component({
- data: {
- originFiles: [
- {
- url: 'https://tdesign.gtimg.com/miniprogram/images/example4.png',
- name: 'uploaded1.png',
- type: 'image',
- status: 'loading',
- },
- {
- url: 'https://tdesign.gtimg.com/miniprogram/images/example7.png',
- name: 'uploaded2.png',
- type: 'image',
- percent: 68,
- status: 'loading',
- },
- {
- url: 'https://tdesign.gtimg.com/miniprogram/images/example6.png',
- name: 'uploaded3.png',
- type: 'image',
- status: 'reload',
- },
- {
- url: 'https://tdesign.gtimg.com/miniprogram/images/example5.png',
- name: 'uploaded4.png',
- type: 'image',
- status: 'failed',
- },
- ],
- gridConfig: {
- column: 4,
- width: 160,
- height: 160,
- },
- config: {
- count: 1,
- },
- },
- methods: {
- handleSuccess(e) {
- const { files } = e.detail;
- this.setData({
- originFiles: files,
- });
- },
- handleRemove(e) {
- const { index } = e.detail;
- const { originFiles } = this.data;
- originFiles.splice(index, 1);
- this.setData({
- originFiles,
- });
- },
- handleClick(e) {
- console.log(e.detail.file);
- },
- },
-});
diff --git a/pages/upload/status/index.json b/pages/upload/status/index.json
deleted file mode 100644
index b2b7fb8..0000000
--- a/pages/upload/status/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- "t-upload": "tdesign-miniprogram/upload/upload"
- }
-}
diff --git a/pages/upload/status/index.wxml b/pages/upload/status/index.wxml
deleted file mode 100644
index 47c70b4..0000000
--- a/pages/upload/status/index.wxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
diff --git a/pages/upload/status/index.wxss b/pages/upload/status/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/upload/upload.d.ts b/pages/upload/upload.d.ts
deleted file mode 100644
index 8b13789..0000000
--- a/pages/upload/upload.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pages/upload/upload.js b/pages/upload/upload.js
deleted file mode 100644
index 560d44d..0000000
--- a/pages/upload/upload.js
+++ /dev/null
@@ -1 +0,0 @@
-Page({});
diff --git a/pages/upload/upload.json b/pages/upload/upload.json
deleted file mode 100644
index f64e2ee..0000000
--- a/pages/upload/upload.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarTitleText": "Upload",
- "usingComponents": {
- "single": "./single",
- "multiple": "./multiple",
- "status": "./status",
- "messageFile": "./messageFile"
- }
-}
diff --git a/pages/upload/upload.wxml b/pages/upload/upload.wxml
deleted file mode 100644
index 5a6cb00..0000000
--- a/pages/upload/upload.wxml
+++ /dev/null
@@ -1,28 +0,0 @@
-
- Upload 上传
- 用于相册读取或拉起拍照的图片上传功能。
-
-
- 上传图片
-
-
-
-
-
- 上传图片
-
-
-
-
-
- 上传图片
-
-
-
-
-
- 上传图片
-
-
-
-
diff --git a/pages/upload/upload.wxss b/pages/upload/upload.wxss
deleted file mode 100644
index 19af201..0000000
--- a/pages/upload/upload.wxss
+++ /dev/null
@@ -1,10 +0,0 @@
-.upload-demo {
- background-color: #fff;
- box-sizing: border-box;
- padding: 32rpx;
-}
-.upload-demo__title {
- font-size: 32rpx;
- color: rgba(0, 0, 0, 0.9);
- padding-bottom: 32rpx;
-}
diff --git a/project.config.json b/project.config.json
index fade88e..09a86d8 100644
--- a/project.config.json
+++ b/project.config.json
@@ -27,350 +27,19 @@
"ignore": [],
"disablePlugins": [],
"outputPath": ""
- }
+ },
+ "useCompilerPlugins": [
+ "typescript",
+ "sass"
+ ]
},
"compileType": "miniprogram",
"libVersion": "2.20.2",
- "appid": "wx649f442f889176c1",
- "projectname": "TDesign",
+ "appid": "wx99885b1c181cda72",
+ "projectname": "ZhiHuiXiang",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
- "condition": {
- "miniprogram": {
- "list": [
- {
- "name": "action-sheet",
- "pathName": "pages/action-sheet/action-sheet",
- "query": "",
- "scene": null
- },
- {
- "name": "avatar",
- "pathName": "pages/avatar/avatar",
- "query": "",
- "scene": null
- },
- {
- "name": "badge",
- "pathName": "pages/badge/badge",
- "query": "",
- "scene": null
- },
- {
- "name": "back-top",
- "pathName": "pages/back-top/back-top",
- "query": "",
- "scene": null
- },
- {
- "name": "button",
- "pathName": "pages/button/button",
- "query": "",
- "scene": null
- },
- {
- "name": "calendar",
- "pathName": "pages/calendar/calendar",
- "query": "",
- "scene": null
- },
- {
- "name": "cascader",
- "pathName": "pages/cascader/cascader",
- "query": "",
- "scene": null
- },
- {
- "name": "cell",
- "pathName": "pages/cell/cell",
- "query": "",
- "scene": null
- },
- {
- "name": "collapse",
- "pathName": "pages/collapse/collapse",
- "query": "",
- "scene": null
- },
- {
- "name": "count-down",
- "pathName": "pages/count-down/count-down",
- "query": "",
- "scene": null
- },
- {
- "name": "checkbox",
- "pathName": "pages/checkbox/checkbox",
- "query": "",
- "scene": null
- },
- {
- "name": "dialog",
- "pathName": "pages/dialog/dialog",
- "query": "",
- "scene": null
- },
- {
- "name": "divider",
- "pathName": "pages/divider/divider",
- "query": "",
- "scene": null
- },
- {
- "name": "date-time-picker",
- "pathName": "pages/date-time-picker/date-time-picker",
- "query": "",
- "scene": null
- },
- {
- "name": "drawer",
- "pathName": "pages/drawer/drawer",
- "query": "",
- "scene": null
- },
- {
- "name": "dropdown-menu",
- "pathName": "pages/dropdown-menu/dropdown-menu",
- "query": "",
- "scene": null
- },
- {
- "name": "empty",
- "pathName": "pages/empty/empty",
- "query": "",
- "scene": null
- },
- {
- "name": "fab",
- "pathName": "pages/fab/fab",
- "query": "",
- "scene": null
- },
- {
- "name": "footer",
- "pathName": "pages/footer/footer",
- "query": "",
- "scene": null
- },
- {
- "name": "grid",
- "pathName": "pages/grid/grid",
- "query": "",
- "scene": null
- },
- {
- "name": "icon",
- "pathName": "pages/icon/icon",
- "query": "",
- "scene": null
- },
- {
- "name": "image",
- "pathName": "pages/image/image",
- "query": "",
- "scene": null
- },
- {
- "name": "image-viewer",
- "pathName": "pages/image-viewer/image-viewer",
- "query": "",
- "scene": null
- },
- {
- "name": "input",
- "pathName": "pages/input/input",
- "query": "",
- "scene": null
- },
- {
- "name": "link",
- "pathName": "pages/link/link",
- "query": "",
- "scene": null
- },
- {
- "name": "message",
- "pathName": "pages/message/message",
- "query": "",
- "scene": null
- },
- {
- "name": "navbar",
- "pathName": "pages/navbar/navbar",
- "query": "",
- "scene": null
- },
- {
- "name": "notice-bar",
- "pathName": "pages/notice-bar/notice-bar",
- "query": "",
- "scene": null
- },
- {
- "name": "loading",
- "pathName": "pages/loading/loading",
- "query": "",
- "scene": null
- },
- {
- "name": "indexes",
- "pathName": "pages/indexes/indexes",
- "query": "",
- "scene": null
- },
- {
- "name": "progress",
- "pathName": "pages/progress/progress",
- "query": "",
- "scene": null
- },
- {
- "name": "overlay",
- "pathName": "pages/overlay/overlay",
- "query": "",
- "scene": null
- },
- {
- "name": "picker",
- "pathName": "pages/picker/picker",
- "query": "",
- "scene": null
- },
- {
- "name": "popup",
- "pathName": "pages/popup/popup",
- "query": "",
- "scene": null
- },
- {
- "name": "pull-down-refresh",
- "pathName": "pages/pull-down-refresh/pull-down-refresh",
- "query": "",
- "scene": null
- },
- {
- "name": "radio",
- "pathName": "pages/radio/radio",
- "query": "",
- "scene": null
- },
- {
- "name": "rate",
- "pathName": "pages/rate/rate",
- "query": "",
- "scene": null
- },
- {
- "name": "result",
- "pathName": "pages/result/result",
- "query": "",
- "scene": null
- },
- {
- "name": "search",
- "pathName": "pages/search/search",
- "query": "",
- "scene": null
- },
- {
- "name": "slider",
- "pathName": "pages/slider/slider",
- "query": "",
- "scene": null
- },
- {
- "name": "side-bar",
- "pathName": "pages/side-bar/side-bar",
- "query": "",
- "scene": null
- },
- {
- "name": "skeleton",
- "pathName": "pages/skeleton/skeleton",
- "query": "",
- "scene": null
- },
- {
- "name": "steps",
- "pathName": "pages/steps/steps",
- "query": "",
- "scene": null
- },
- {
- "name": "stepper",
- "pathName": "pages/stepper/stepper",
- "query": "",
- "scene": null
- },
- {
- "name": "sticky",
- "pathName": "pages/sticky/sticky",
- "query": "",
- "scene": null
- },
- {
- "name": "switch",
- "pathName": "pages/switch/switch",
- "query": "",
- "scene": null
- },
- {
- "name": "swiper",
- "pathName": "pages/swiper/swiper",
- "query": "",
- "scene": null
- },
- {
- "name": "swipe-cell",
- "pathName": "pages/swipe-cell/swipe-cell",
- "query": "",
- "scene": null
- },
- {
- "name": "tab-bar",
- "pathName": "pages/tab-bar/tab-bar",
- "query": "",
- "scene": null
- },
- {
- "name": "tabs",
- "pathName": "pages/tabs/tabs",
- "query": "",
- "scene": null
- },
- {
- "name": "tag",
- "pathName": "pages/tag/tag",
- "query": "",
- "scene": null
- },
- {
- "name": "textarea",
- "pathName": "pages/textarea/textarea",
- "query": "",
- "scene": null
- },
- {
- "name": "toast",
- "pathName": "pages/toast/toast",
- "query": "",
- "scene": null
- },
- {
- "name": "tree-select",
- "pathName": "pages/tree-select/tree-select",
- "query": "",
- "scene": null
- },
- {
- "name": "upload",
- "pathName": "pages/upload/upload",
- "query": "",
- "scene": null
- }
- ]
- }
- },
+ "condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 4
diff --git a/project.private.config.json b/project.private.config.json
index 53ee1f6..7fc66f3 100644
--- a/project.private.config.json
+++ b/project.private.config.json
@@ -2,6 +2,7 @@
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "ZhiHuiXiang",
"setting": {
- "compileHotReLoad": true
+ "compileHotReLoad": true,
+ "urlCheck": true
}
}
\ No newline at end of file
diff --git a/utils/agora.ts b/utils/agora.ts
new file mode 100644
index 0000000..e0000e9
--- /dev/null
+++ b/utils/agora.ts
@@ -0,0 +1,69 @@
+const AgoraMiniappSDK = require("../lib/agora-miniapp-sdk.js");
+const option = {
+ appId: '',
+ token: '',
+ tokenA: '',
+ channelId: '',
+ screenShareId: '',
+ uid: 0
+}
+let client: any = '';
+export const agora = {
+ // 初始化
+ init: async () => {
+ client = new AgoraMiniappSDK.Client();
+ await client.init(option.appId);
+ },
+ // 销毁
+ destroy: async () => {
+ if (client) {
+ await client.destroy()
+ client = '';
+ }
+ },
+ // 设置角色
+ setRole: async (isRoomManager: boolean, callBack?: Function) => {
+ await client.setRole(isRoomManager ? 'broadcaster' : 'audience')
+ if (isRoomManager) {
+ client.publish((url: string) => {
+ callBack && callBack(url)
+ })
+ }
+ },
+ // 设置频道参数
+ setOption: async (data) => {
+ option.token = data.token;
+ option.tokenA = data.tokenA;
+ option.channelId = data.channelId;
+ option.appId = data.appId;
+ option.uid = Number(data.uid);
+ option.screenShareId = data.screenShareId;
+ await agora.init()
+ },
+ // 加入频道
+ joinChannel: () => {
+ client.join(option.token, option.channelId, option.uid, () => {
+ agora.setRole(false)
+ })
+ },
+ clientEvent: ({ streamAdded, streamRemoved }) => {
+ client.on("stream-added", async e => {
+ await agora.subscribe(e.uid, (url: string, uid: number | string) => {
+ streamAdded(url, uid)
+ })
+ });
+ client.on("stream-removed", async e => {
+ streamRemoved(e.uid)
+ });
+ },
+ subscribe: async (uid: number | string, callBack: Function) => {
+ const { url, rotation } = await client.subscribe(uid)
+ callBack(url, uid)
+ },
+ muteLocal: async (target: string) => {
+ client.muteLocal(target)
+ },
+ unmuteLocal: async (target: string) => {
+ client.unmuteLocal(target)
+ },
+}
\ No newline at end of file
diff --git a/utils/gulpError.js b/utils/gulpError.js
deleted file mode 100644
index 1f66bb5..0000000
--- a/utils/gulpError.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/* eslint-disable */
-const gulpError = `gulpErrorPlaceHolder`;
-export default gulpError;
diff --git a/utils/request.js b/utils/request.js
new file mode 100644
index 0000000..ae62c66
--- /dev/null
+++ b/utils/request.js
@@ -0,0 +1,50 @@
+const apiBase = "https://meeting-api.23544.com/pc"
+
+export const Request = (params) => {
+ return new Promise((resolve, reject) => {
+ wx.getStorage({
+ key: "user",
+ success(res) {
+ requestMethods({
+ params,
+ token: res.data.token
+ }, (status, res) => {
+ if (status === 'success') {
+ resolve(res.data)
+ } else {
+ reject(res)
+ }
+ })
+ },
+ fail() {
+ requestMethods({
+ params,
+ token: ''
+ }, (status, res) => {
+ if (status === 'success') {
+ resolve(res.data)
+ } else {
+ reject(res)
+ }
+ })
+ }
+ })
+ })
+}
+
+function requestMethods(obj, callback) {
+ wx.request({
+ ...obj.params,
+ url: apiBase + obj.params.url,
+ header: {
+ 'content-type': 'application/json',
+ 'Authorization': `Bearer ${obj.token}`
+ },
+ success: res => {
+ callback('success', res)
+ },
+ fail: res => {
+ callback('fail', res)
+ },
+ })
+}
\ No newline at end of file
diff --git a/utils/singlr.ts b/utils/singlr.ts
new file mode 100644
index 0000000..8e29a18
--- /dev/null
+++ b/utils/singlr.ts
@@ -0,0 +1,259 @@
+let connection = '' as any;
+import * as signalR from "signalr-for-wx";
+import { agora } from "./agora";
+export const startSignalr = async (callBack: Function) => {
+ wx.getStorage({
+ key: "user",
+ success(res: any) {
+ connection = new signalR.HubConnectionBuilder()
+ .withUrl(`https://meeting-api.23544.com/pc/session-manage`, {
+ skipNegotiation: true,
+ transport: signalR.HttpTransportType.WebSockets,
+ accessTokenFactory: () => res.data.token
+ })
+ .build();
+ connection.start().then(() => {
+ callBack()
+ })
+ connection.onclose(() => {
+ wx.setStorage({
+ key: "reconnect",
+ data: false
+ })
+ startConnection()
+ });
+ }
+ })
+ function startConnection() {
+ const routes = getCurrentPages()
+ if (connection.state !== signalR.HubConnectionState.Connected && routes[routes.length - 1].route === 'pages/meeting/index') {
+ connection.start().then(() => {
+ wx.setStorage({
+ key: "reconnect",
+ data: true
+ })
+ }).catch(err => {
+ setTimeout(startConnection, 3000);
+ });
+ }
+ }
+}
+export const onInvoke = async (str: string, data: any) => {
+ switch (str) {
+ case 'sendChannelMsg':
+ await connection.invoke(str, data.roomNum, data.msg)
+ break;
+ case 'sendOper':
+ // 4:屏幕共享
+ await connection.invoke(str, data.roomNum, data.type)
+ break;
+ case 'getDrivers':
+ // 获取某个人的设备列表
+ await connection.invoke(str, data.uid)
+ break;
+ case 'sendDrivers':
+ // 发送设备列表给某个人
+ await connection.invoke(str, data.uid, data.driversJsonString)
+ break;
+ case 'setDrivers':
+ // 设置某个人的设备列表
+ await connection.invoke(str, data.uid, data.driversJsonString)
+ break;
+ case 'joinChannel':
+ // 加入房间
+ await connection.invoke(str, data.roomNum, data.enableMicr, data.enableCamera, data.isRoomManager || false)
+ break;
+ case 'levelChannel':
+ // 离开房间
+ await connection.invoke(str, data.roomNum)
+ break;
+ }
+}
+export const onSignalr = (callBack: Function) => {
+ if (connection) {
+ // 聊天
+ connection.on("ReceiveMessage", (uid: string, userName: string, message: string, timestamp: string) => {
+ callBack({
+ key: 'ReceiveMessage',
+ uid, message, userName, timestamp
+ })
+ });
+ // 扩展操作
+ connection.on("Operation", (type: number) => {
+ callBack({
+ key: 'Operation',
+ type
+ })
+ });
+ // 移出会议
+ connection.on("ForceExitRoom", () => {
+ callBack({
+ key: 'ForceExitRoom',
+ })
+ });
+ // 全员离开房间
+ connection.on("AllLeave", () => {
+ callBack({
+ key: 'AllLeave',
+ })
+ });
+ // 全员看他
+ connection.on("ShowUser", (uid: string, uname: string, operUid: string, operUserName: string) => {
+ callBack({
+ key: 'ShowUser',
+ uid,
+ uname,
+ operUid,
+ operUserName,
+ })
+ });
+ // 更新视图模式
+ connection.on("RefreshView", (type: string) => {
+ callBack({
+ key: 'RefreshView',
+ type
+ })
+ });
+ // 用户加入频道回调
+ connection.on("UserJoined", (user: any) => {
+ callBack({
+ key: 'UserJoined',
+ user,
+ })
+ });
+ // 用户退出频道回调
+ connection.on("UserLeave", (uid: string,) => {
+ callBack({
+ key: 'UserLeave',
+ uid,
+ })
+ });
+ // 所有用户开闭麦
+ connection.on("OperAllMicr", (enableMicr: boolean, uid: string) => {
+ callBack({
+ key: 'OperAllMicr',
+ enableMicr,
+ uid
+ })
+ });
+ // 用户关闭开启麦克风
+ connection.on("OperMicr", (user: any, operUid: string) => {
+ callBack({
+ key: 'OperMicr',
+ user,
+ operUid
+ })
+ });
+ // 用户开启关闭摄像头
+ connection.on("OperCamera", (user: any, operUid: string) => {
+ callBack({
+ key: 'OperCamera',
+ user,
+ operUid
+ })
+ });
+ // 发言人用户信息刷新
+ connection.on("ManagerRefresh", (user: any, uid: string) => {
+ callBack({
+ key: 'ManagerRefresh',
+ user,
+ uid
+ })
+ });
+ // 申请发言
+ connection.on("ApplyToSpeak", (uid: string, uname: string) => {
+ callBack({
+ key: 'ApplyToSpeak',
+ uid,
+ uname
+ })
+ });
+ // 管理员查看随机用户
+ connection.on("Watch", (watchUids: string[]) => {
+ callBack({
+ key: 'Watch',
+ watchUids
+ })
+ });
+ // 设备列表
+ connection.on("DriverList", (callerUid: string) => {
+ callBack({
+ key: 'DriverList',
+ callerUid
+ })
+ });
+ // 设置设备
+ connection.on("SaveDriver", (driver: string) => {
+ callBack({
+ key: 'SaveDriver',
+ driver
+ })
+ });
+ // 显示设备列表
+ connection.on("ShowDriverList", (driversJsonString: string) => {
+ callBack({
+ key: 'ShowDriverList',
+ driversJsonString
+ })
+ });
+ }
+}
+export const onStop = async () => {
+ wx.setStorage({
+ key: "reconnect",
+ data: false
+ })
+ agora.destroy();
+ if (connection) {
+ connection.stop()
+ connection = '';
+ }
+}
+
+
+
+
+
+
+
+
+export const onOtherSignalr = (callBack: Function) => {
+ if (connection) {
+ // 邀请
+ connection.on("Invitation", (roomNum: string, roomName: string, InviterName: string) => {
+ callBack({
+ key: 'Invitation',
+ roomNum, roomName, InviterName
+ })
+ });
+ // 退出
+ connection.on("ForceLogout", (msg: string) => {
+ callBack({
+ key: 'ForceLogout',
+ msg
+ })
+ });
+ }
+}
+export const offSignalr = () => {
+ if (connection) {
+ connection.off('ReceiveMessage');
+ connection.off('Operation');
+ connection.off('ForceExitRoom');
+ connection.off('AllLeave');
+ connection.off('ShowUser');
+ connection.off('RefreshView');
+ connection.off('UserJoined');
+ connection.off('UserLeave');
+ connection.off('OperAllMicr');
+ connection.off('OperMicr');
+ connection.off('OperCamera');
+ connection.off('ManagerRefresh');
+ connection.off('ApplyToSpeak');
+ connection.off('Watch');
+ connection.off('DriverList');
+ connection.off('SetDriver');
+ connection.off('ShowDriverList');
+ }
+}
+
diff --git a/utils/utils.ts b/utils/utils.ts
new file mode 100644
index 0000000..b9970e2
--- /dev/null
+++ b/utils/utils.ts
@@ -0,0 +1,26 @@
+export const role = {
+ ID: ['1', '3']
+}
+
+export const getUUID = (): string => {
+ var s = [] as any;
+ var hexDigits = "0123456789abcdef";
+ for (var i = 0; i < 36; i++) {
+ s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
+ }
+ s[14] = "4";
+ s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
+ s[8] = s[13] = s[18] = s[23] = "-";
+ return s.join("")
+}
+
+export const getStorage = async (key: string): Promise => {
+ return new Promise((resolve, reject) => {
+ wx.getStorage({
+ key,
+ success(res: any) {
+ resolve(res.data)
+ }
+ })
+ })
+}
\ No newline at end of file