@tdesign/uniapp 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +43 -34
  3. package/dist/action-sheet/README.md +8 -3
  4. package/dist/avatar/README.md +3 -1
  5. package/dist/back-top/README.md +3 -1
  6. package/dist/badge/README.md +3 -1
  7. package/dist/button/README.md +3 -1
  8. package/dist/calendar/README.md +3 -1
  9. package/dist/cascader/README.md +3 -1
  10. package/dist/cell/README.md +3 -1
  11. package/dist/checkbox/README.md +3 -1
  12. package/dist/col/README.md +3 -1
  13. package/dist/collapse/README.md +3 -1
  14. package/dist/color-picker/README.md +3 -1
  15. package/dist/common/common.ts +121 -5
  16. package/dist/common/src/index.js +0 -1
  17. package/dist/common/validator.ts +496 -0
  18. package/dist/config-provider/README.md +3 -1
  19. package/dist/count-down/README.md +3 -1
  20. package/dist/date-time-picker/README.md +3 -1
  21. package/dist/dialog/README.md +3 -1
  22. package/dist/divider/README.md +3 -1
  23. package/dist/drawer/README.md +3 -1
  24. package/dist/dropdown-menu/README.md +2 -2
  25. package/dist/empty/README.md +3 -1
  26. package/dist/fab/README.md +3 -1
  27. package/dist/footer/README.md +3 -1
  28. package/dist/form/README.en-US.md +2 -2
  29. package/dist/form/README.md +5 -3
  30. package/dist/form/form.vue +1 -1
  31. package/dist/form/type.ts +3 -3
  32. package/dist/form-item/form-item.css +4 -0
  33. package/dist/form-item/form-item.vue +2 -3
  34. package/dist/form-item/type.ts +2 -2
  35. package/dist/grid/README.md +3 -1
  36. package/dist/guide/README.md +3 -1
  37. package/dist/icon/README.md +10 -7
  38. package/dist/icon/icon.css +1633 -1624
  39. package/dist/image/README.md +3 -1
  40. package/dist/image-viewer/README.md +3 -1
  41. package/dist/index.js +13 -0
  42. package/dist/indexes/README.md +3 -1
  43. package/dist/input/README.md +3 -1
  44. package/dist/input/input.vue +1 -27
  45. package/dist/link/README.md +3 -1
  46. package/dist/loading/README.md +3 -1
  47. package/dist/message/README.md +8 -3
  48. package/dist/mixins/page-scroll.d.ts +19 -0
  49. package/dist/mixins/skyline.js +1 -1
  50. package/dist/navbar/README.md +3 -1
  51. package/dist/notice-bar/README.md +3 -1
  52. package/dist/overlay/README.md +3 -1
  53. package/dist/picker/README.md +3 -1
  54. package/dist/popover/README.md +3 -1
  55. package/dist/popup/README.md +3 -1
  56. package/dist/progress/README.md +2 -2
  57. package/dist/pull-down-refresh/README.md +3 -1
  58. package/dist/qrcode/README.md +3 -1
  59. package/dist/radio/README.md +3 -1
  60. package/dist/rate/README.md +3 -1
  61. package/dist/rate/rate.css +1 -0
  62. package/dist/result/README.md +3 -1
  63. package/dist/script/postinstall.js +49 -24
  64. package/dist/search/README.md +3 -1
  65. package/dist/side-bar/README.md +3 -1
  66. package/dist/skeleton/README.md +3 -1
  67. package/dist/slider/README.md +3 -1
  68. package/dist/stepper/README.md +3 -1
  69. package/dist/steps/README.md +3 -1
  70. package/dist/sticky/README.md +3 -1
  71. package/dist/swipe-cell/README.md +3 -1
  72. package/dist/swiper/README.md +3 -1
  73. package/dist/switch/README.md +3 -1
  74. package/dist/tab-bar/README.md +3 -1
  75. package/dist/tabs/README.md +3 -1
  76. package/dist/tag/README.md +3 -1
  77. package/dist/textarea/README.md +3 -1
  78. package/dist/textarea/textarea.vue +1 -25
  79. package/dist/theme.css +467 -0
  80. package/dist/theme.css.d.ts +2 -0
  81. package/dist/theme.less +1 -0
  82. package/dist/theme.less.d.ts +2 -0
  83. package/dist/toast/README.md +3 -1
  84. package/dist/transition/README.md +4 -6
  85. package/dist/tree-select/README.md +3 -1
  86. package/dist/types/index.d.ts +15 -0
  87. package/dist/upload/README.md +3 -1
  88. package/dist/watermark/README.md +3 -1
  89. package/package.json +37 -3
  90. package/dist/common/src/superComponent.js +0 -5
  91. package/dist/common/validator.js +0 -210
package/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ toc: false
5
5
  docClass: timeline
6
6
  ---
7
7
 
8
+ ## 🌈 0.8.1 `2026-04-09`
9
+
10
+ ### 🚀 Features
11
+
12
+ - `Icon`: 新增 `divider-1`, `voice-wave` 和 `keyboard-1` 图标 @uyarn ([#4395](https://github.com/Tencent/tdesign-miniprogram/pull/4395))
13
+
14
+ ### 🐞 Bug Fixes
15
+
16
+ - `Form`: 修复 `FormItem` 右侧箭头深色模式颜色错误 @anlyyao ([#4384](https://github.com/Tencent/tdesign-miniprogram/pull/4384))
17
+ - `Rate`: 修复提示框层级不够被覆盖的问题 @liweijie0812 ([#4386](https://github.com/Tencent/tdesign-miniprogram/pull/4386))
18
+
8
19
  ## 🌈 0.8.0 `2026-03-23`
9
20
 
10
21
  ### 🚨 Breaking Changes
package/README.md CHANGED
@@ -51,47 +51,37 @@ npm i @tdesign/uniapp
51
51
 
52
52
  ## 使用
53
53
 
54
- 1. 在 `main.ts` 中引入样式文件
54
+ ### 步骤一:引入样式文件
55
55
 
56
- ```js
57
- // CLI 模式
58
- import '@tdesign/uniapp/common/style/theme/index.css';
59
-
60
- // HBuilderX 模式
61
- // import './uni_modules/tdesign-uniapp/components/common/style/theme/index.css';
62
- ```
56
+ 在 `main.ts` 中引入组件库样式:
63
57
 
64
- 也可以引入 `rpx` 单位的 `less` 文件,该文件与 `tdesign-miniprogram` 完全一致。
58
+ #### CLI 模式
65
59
 
66
60
  ```js
67
- // CLI 模式
68
- import '@tdesign/uniapp/common/style/theme/index.less';
61
+ // Less(推荐,rpx 单位,与 tdesign-miniprogram 完全一致)
62
+ import '@tdesign/uniapp/theme.less';
69
63
 
70
- // HBuilderX 模式
71
- // import './uni_modules/tdesign-uniapp/components/common/style/theme/index.less';
64
+ // 或者引入编译后的 CSS 文件
65
+ import '@tdesign/uniapp/theme.css';
72
66
  ```
73
67
 
74
- 2. 在文件中使用
68
+ #### HBuilderX 模式
75
69
 
76
- ```html
77
- <template>
78
- <t-loading />
79
- </template>
70
+ ```js
71
+ // Less(推荐,rpx 单位,与 tdesign-miniprogram 完全一致)
72
+ import './uni_modules/tdesign-uniapp/components/theme.less';
80
73
 
81
- <script lang="ts" setup>
82
- import TLoading from '@tdesign/uniapp/loading/loading.vue';
83
- </script>
74
+ // 或者引入编译后的 CSS 文件
75
+ import './uni_modules/tdesign-uniapp/components/theme.css';
84
76
  ```
85
77
 
86
- 只提供按需导入方式,不支持全量导入(全量导入在小程序下有兼容性问题)。
78
+ ### 步骤二:注册组件
87
79
 
88
- ## 自动导入
80
+ #### 自动导入(推荐)
89
81
 
90
- 在 `pages.json` 配置 [easycom](https://uniapp.dcloud.net.cn/collocation/pages.html#easycom),可实现自动导入。
82
+ 配置 [easycom](https://uniapp.dcloud.net.cn/collocation/pages.html#easycom) 后,无需手动引入组件即可直接在模板中使用,在 `pages.json` 中添加以下配置:
91
83
 
92
- ### CLI 模式
93
-
94
- 使用 CLI 模式,即使用 `node_modules` 下的 `@tdesign/uniapp` 时,配置如下。
84
+ **CLI 模式**:使用 `node_modules` 下的 `@tdesign/uniapp` 时,配置如下。
95
85
 
96
86
  ```json
97
87
  {
@@ -103,9 +93,7 @@ import TLoading from '@tdesign/uniapp/loading/loading.vue';
103
93
  }
104
94
  ```
105
95
 
106
- ### UNI_MODULES 模式
107
-
108
- 使用 `uni_modules` 下的 `tdesign-uniapp` 时,配置如下。
96
+ **HBuilderX 模式**:使用 `uni_modules` 下的 `tdesign-uniapp` 时,配置如下。
109
97
 
110
98
  ```json
111
99
  {
@@ -117,11 +105,33 @@ import TLoading from '@tdesign/uniapp/loading/loading.vue';
117
105
  }
118
106
  ```
119
107
 
120
- ## 编辑器提示
108
+ 配置完成后,可以直接在模板中使用组件:
121
109
 
122
- 安装注册 TDesign 之后,在开发项目时,可以配合插件在VSCode等主流编辑器中达到提示组件名及API的效果。
110
+ ```html
111
+ <template>
112
+ <t-loading />
113
+ </template>
114
+ ```
115
+
116
+ #### 手动导入
117
+
118
+ 如果不使用 easycom,也可以在 `<script>` 中手动导入组件:
119
+
120
+ ```html
121
+ <template>
122
+ <t-loading />
123
+ </template>
123
124
 
124
- 推荐安装 [Vue (Official)](https://marketplace.visualstudio.com/items?itemName=Vue.volar) 插件,并在项目的 `tsconfig.json` 的 `compilerOptions.types` 属性中增加 `@tdesign/uniapp/global`,即可实现提示效果。
125
+ <script lang="ts" setup>
126
+ import TLoading from '@tdesign/uniapp/loading/loading.vue';
127
+ </script>
128
+ ```
129
+
130
+ > 只提供按需导入方式,不支持全量导入(全量导入在小程序下有兼容性问题)。
131
+
132
+ ### 步骤三:配置编辑器提示(可选)
133
+
134
+ 推荐安装 [Vue (Official)](https://marketplace.visualstudio.com/items?itemName=Vue.volar) 插件,并在项目的 `tsconfig.json` 的 `compilerOptions.types` 属性中增加 `@tdesign/uniapp/global`,即可在 VSCode 等主流编辑器中获得组件名及 API 的智能提示。
125
135
 
126
136
  ```json
127
137
  {
@@ -162,7 +172,6 @@ import TLoading from '@tdesign/uniapp/loading/loading.vue';
162
172
  | [TDesign UniApp Starter Vue3 HX](https://github.com/TDesignOteam/tdesign-uniapp-starter-vue3-hx/) | Vue3 + HBuilderX 模式模板 | <img src="https://cdn.uwayfly.com/tdesign-uniapp/image/tdesign-uniapp-starter-vue3-hx-h5.png" height="100" /> |
163
173
  | [TDesign UniApp Starter Vue2 CLI](https://github.com/TDesignOteam/tdesign-uniapp-starter-vue2-cli/) | Vue2 + CLI 模式模板 | <img src="https://cdn.uwayfly.com/tdesign-uniapp/image/tdesign-uniapp-starter-vue2-cli-h5.png" height="100" /> |
164
174
  | [TDesign UniApp Starter Vue2 HX](https://github.com/TDesignOteam/tdesign-uniapp-starter-vue2-hx/) | Vue2 + HBuilderX 模式模板 |<img src="https://cdn.uwayfly.com/tdesign-uniapp/image/tdesign-uniapp-starter-vue2-hx-h5.png" height="100" /> |
165
-
166
175
  ## 反馈
167
176
 
168
177
  有任何问题,建议通过 [Github issues](https://github.com/Tencent/tdesign-miniprogram/issues) 反馈或扫码加入用户微信群。
@@ -8,7 +8,9 @@ isComponent: true
8
8
 
9
9
  ## 引入
10
10
 
11
- 可在 `main.ts` 或在需要使用的页面或组件中引入。
11
+ 推荐使用 easycom 模式引入组件,配置后无需手动 import 即可直接在模板中使用 `<t-action-sheet />`。详细配置请参考 [快速开始](../getting-started)。
12
+
13
+ 如需手动引入:
12
14
 
13
15
  ```js
14
16
  import TActionSheet from '@tdesign/uniapp/action-sheet/action-sheet.vue';
@@ -40,7 +42,10 @@ import TActionSheet from '@tdesign/uniapp/action-sheet/action-sheet.vue';
40
42
  ### 支持指令调用
41
43
 
42
44
  ```javascript
43
- import ActionSheet, { ActionSheetTheme } from '@tdesign/uniapp/action-sheet/index';
45
+ // ActionSheetPlugin ActionSheet 均可使用
46
+ import { ActionSheetPlugin, ActionSheetTheme } from '@tdesign/uniapp';
47
+ // 或
48
+ // import { ActionSheet, ActionSheetTheme } from '@tdesign/uniapp';
44
49
 
45
50
  // 指令调用不同于组件引用不需要传入visible
46
51
  const basicListOption: ActionSheetShowOption = {
@@ -61,7 +66,7 @@ const basicListOption: ActionSheetShowOption = {
61
66
  ],
62
67
  };
63
68
 
64
- const handler = ActionSheet.show(basicListOption);
69
+ const handler = ActionSheetPlugin.show(basicListOption);
65
70
  ```
66
71
 
67
72
  指令调用的关闭如下
@@ -8,7 +8,9 @@ isComponent: true
8
8
 
9
9
  ## 引入
10
10
 
11
- 可在 `main.ts` 或在需要使用的页面或组件中引入。
11
+ 推荐使用 easycom 模式引入组件,配置后无需手动 import 即可直接在模板中使用 `<t-avatar />`。详细配置请参考 [快速开始](../getting-started)。
12
+
13
+ 如需手动引入:
12
14
 
13
15
  ```js
14
16
  import TAvatar from '@tdesign/uniapp/avatar/avatar.vue';
@@ -8,7 +8,9 @@ isComponent: true
8
8
 
9
9
  ## 引入
10
10
 
11
- 可在 `main.ts` 或在需要使用的页面或组件中引入。
11
+ 推荐使用 easycom 模式引入组件,配置后无需手动 import 即可直接在模板中使用 `<t-back-top />`。详细配置请参考 [快速开始](../getting-started)。
12
+
13
+ 如需手动引入:
12
14
 
13
15
  ```js
14
16
  import TBackTop from '@tdesign/uniapp/back-top/back-top.vue';
@@ -8,7 +8,9 @@ isComponent: true
8
8
 
9
9
  ## 引入
10
10
 
11
- 可在 `main.ts` 或在需要使用的页面或组件中引入。
11
+ 推荐使用 easycom 模式引入组件,配置后无需手动 import 即可直接在模板中使用 `<t-badge />`。详细配置请参考 [快速开始](../getting-started)。
12
+
13
+ 如需手动引入:
12
14
 
13
15
  ```js
14
16
  import TBadge from '@tdesign/uniapp/badge/badge.vue';
@@ -8,7 +8,9 @@ isComponent: true
8
8
 
9
9
  ## 引入
10
10
 
11
- 可在 `main.ts` 或在需要使用的页面或组件中引入。
11
+ 推荐使用 easycom 模式引入组件,配置后无需手动 import 即可直接在模板中使用 `<t-button />`。详细配置请参考 [快速开始](../getting-started)。
12
+
13
+ 如需手动引入:
12
14
 
13
15
  ```js
14
16
  import TButton from '@tdesign/uniapp/button/button.vue';
@@ -8,7 +8,9 @@ isComponent: true
8
8
 
9
9
  ## 引入
10
10
 
11
- 可在 `main.ts` 或在需要使用的页面或组件中引入。
11
+ 推荐使用 easycom 模式引入组件,配置后无需手动 import 即可直接在模板中使用 `<t-calendar />`。详细配置请参考 [快速开始](../getting-started)。
12
+
13
+ 如需手动引入:
12
14
 
13
15
  ```js
14
16
  import TCalendar from '@tdesign/uniapp/calendar/calendar.vue';
@@ -8,7 +8,9 @@ isComponent: true
8
8
 
9
9
  ## 引入
10
10
 
11
- 可在 `main.ts` 或在需要使用的页面或组件中引入。
11
+ 推荐使用 easycom 模式引入组件,配置后无需手动 import 即可直接在模板中使用 `<t-cascader />`。详细配置请参考 [快速开始](../getting-started)。
12
+
13
+ 如需手动引入:
12
14
 
13
15
  ```js
14
16
  import TCascader from '@tdesign/uniapp/cascader/cascader.vue';
@@ -8,7 +8,9 @@ isComponent: true
8
8
 
9
9
  ## 引入
10
10
 
11
- 可在 `main.ts` 或在需要使用的页面或组件中引入。
11
+ 推荐使用 easycom 模式引入组件,配置后无需手动 import 即可直接在模板中使用 `<t-cell />`。详细配置请参考 [快速开始](../getting-started)。
12
+
13
+ 如需手动引入:
12
14
 
13
15
  ```js
14
16
  import TCell from '@tdesign/uniapp/cell/cell.vue';
@@ -8,7 +8,9 @@ isComponent: true
8
8
 
9
9
  ## 引入
10
10
 
11
- 可在 `main.ts` 或在需要使用的页面或组件中引入。
11
+ 推荐使用 easycom 模式引入组件,配置后无需手动 import 即可直接在模板中使用 `<t-checkbox />`。详细配置请参考 [快速开始](../getting-started)。
12
+
13
+ 如需手动引入:
12
14
 
13
15
  ```js
14
16
  import TCheckbox from '@tdesign/uniapp/checkbox/checkbox.vue';
@@ -8,7 +8,9 @@ isComponent: true
8
8
 
9
9
  ## 引入
10
10
 
11
- 可在 `main.ts` 或在需要使用的页面或组件中引入。
11
+ 推荐使用 easycom 模式引入组件,配置后无需手动 import 即可直接在模板中使用 `<t-col />`。详细配置请参考 [快速开始](../getting-started)。
12
+
13
+ 如需手动引入:
12
14
 
13
15
 
14
16
  ```js
@@ -9,7 +9,9 @@ isComponent: true
9
9
 
10
10
  ## 引入
11
11
 
12
- 可在 `main.ts` 或在需要使用的页面或组件中引入。
12
+ 推荐使用 easycom 模式引入组件,配置后无需手动 import 即可直接在模板中使用 `<t-collapse />`。详细配置请参考 [快速开始](../getting-started)。
13
+
14
+ 如需手动引入:
13
15
 
14
16
  ```js
15
17
  import TCollapse from '@tdesign/uniapp/collapse/collapse.vue';
@@ -9,7 +9,9 @@ isComponent: true
9
9
 
10
10
  ## 引入
11
11
 
12
- 可在 `main.ts` 或在需要使用的页面或组件中引入。
12
+ 推荐使用 easycom 模式引入组件,配置后无需手动 import 即可直接在模板中使用 `<t-color-picker />`。详细配置请参考 [快速开始](../getting-started)。
13
+
14
+ 如需手动引入:
13
15
 
14
16
  ```js
15
17
  import TColorPicker from '@tdesign/uniapp/color-picker/color-picker.vue';
@@ -70,33 +70,149 @@ export type ExtractNonOnProps<T> = {
70
70
  [K in keyof T as K extends `on${string}` ? never : K]: T[K]
71
71
  };
72
72
 
73
+ /**
74
+ * 邮箱校验选项
75
+ */
73
76
  export interface IsEmailOptions {
77
+ /**
78
+ * 是否允许显示名称格式,如 `Display Name <email>`
79
+ * @default false
80
+ */
74
81
  allow_display_name?: boolean;
82
+ /**
83
+ * 是否要求必须包含显示名称格式
84
+ * @default false
85
+ */
75
86
  require_display_name?: boolean;
87
+ /**
88
+ * 是否允许本地部分使用 UTF8 字符
89
+ * @default true
90
+ */
76
91
  allow_utf8_local_part?: boolean;
92
+ /**
93
+ * 是否要求域名包含顶级域名
94
+ * @default true
95
+ */
77
96
  require_tld?: boolean;
78
- allow_ip_dot?: boolean;
79
- domain_specific_validation?: boolean;
80
- host_blacklist?: string[];
97
+ /**
98
+ * 是否忽略邮箱最大长度限制
99
+ * @default false
100
+ */
81
101
  ignore_max_length?: boolean;
102
+ /**
103
+ * 是否允许 IP 地址作为域名部分
104
+ * @default false
105
+ */
106
+ allow_ip_domain?: boolean;
107
+ /**
108
+ * 是否启用特定域名的额外校验(如 GMail 规则)
109
+ * @default false
110
+ */
111
+ domain_specific_validation?: boolean;
112
+ /**
113
+ * 是否允许下划线
114
+ * @default false
115
+ */
116
+ allow_underscores?: boolean;
117
+ /**
118
+ * 域名黑名单
119
+ */
120
+ host_blacklist?: Array<string | RegExp>;
121
+ /**
122
+ * 域名白名单
123
+ */
124
+ host_whitelist?: Array<string | RegExp>;
125
+ /**
126
+ * 拒绝包含指定字符的邮箱名
127
+ */
128
+ blacklisted_chars?: string;
82
129
  }
83
130
 
131
+ /**
132
+ * URL 校验选项
133
+ */
84
134
  export interface IsURLOptions {
135
+ /**
136
+ * 允许的协议
137
+ * @default ['http','https','ftp']
138
+ */
85
139
  protocols?: string[];
140
+ /**
141
+ * 是否要求顶级域名
142
+ * @default true
143
+ */
86
144
  require_tld?: boolean;
145
+ /**
146
+ * 是否要求协议
147
+ * @default false
148
+ */
87
149
  require_protocol?: boolean;
150
+ /**
151
+ * 是否要求主机名
152
+ * @default true
153
+ */
88
154
  require_host?: boolean;
155
+ /**
156
+ * 是否要求端口
157
+ * @default false
158
+ */
89
159
  require_port?: boolean;
160
+ /**
161
+ * 是否要求有效协议
162
+ * @default true
163
+ */
90
164
  require_valid_protocol?: boolean;
165
+ /**
166
+ * 是否允许下划线
167
+ * @default false
168
+ */
91
169
  allow_underscores?: boolean;
92
- host_whitelist?: (string | RegExp)[];
93
- host_blacklist?: (string | RegExp)[];
170
+ /**
171
+ * 主机名白名单
172
+ */
173
+ host_whitelist?: Array<string | RegExp>;
174
+ /**
175
+ * 主机名黑名单
176
+ */
177
+ host_blacklist?: Array<string | RegExp>;
178
+ /**
179
+ * 是否允许末尾的点
180
+ * @default false
181
+ */
94
182
  allow_trailing_dot?: boolean;
183
+ /**
184
+ * 是否允许协议相对 URL
185
+ * @default false
186
+ */
95
187
  allow_protocol_relative_urls?: boolean;
188
+ /**
189
+ * 是否禁止认证信息
190
+ * @default false
191
+ */
96
192
  disallow_auth?: boolean;
193
+ /**
194
+ * 是否允许片段(hash)
195
+ * @default true
196
+ */
197
+ allow_fragments?: boolean;
198
+ /**
199
+ * 是否允许查询参数
200
+ * @default true
201
+ */
202
+ allow_query_components?: boolean;
203
+ /**
204
+ * 是否校验长度
205
+ * @default true
206
+ */
97
207
  validate_length?: boolean;
208
+ /**
209
+ * 最大允许长度
210
+ * @default 2084
211
+ */
212
+ max_allowed_length?: number | false;
98
213
  }
99
214
 
215
+
100
216
  /**
101
217
  * 通用全局类型
102
218
  * */
@@ -1,4 +1,3 @@
1
- export * from './superComponent';
2
1
  export * from './flatTool';
3
2
  export * from './instantiationDecorator';
4
3
  export * from './control';