@tdesign/uniapp 0.7.3 → 0.8.0

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 (197) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +1 -1
  3. package/dist/action-sheet/README.md +1 -1
  4. package/dist/action-sheet/action-sheet.vue +158 -150
  5. package/dist/action-sheet/props.ts +2 -2
  6. package/dist/action-sheet/type.ts +1 -1
  7. package/dist/avatar/avatar.vue +89 -87
  8. package/dist/avatar-group/avatar-group.vue +69 -67
  9. package/dist/back-top/back-top.vue +60 -58
  10. package/dist/badge/badge.vue +69 -59
  11. package/dist/button/button.vue +121 -116
  12. package/dist/button/props.ts +2 -2
  13. package/dist/button/type.ts +1 -1
  14. package/dist/calendar/calendar-header.vue +4 -4
  15. package/dist/calendar/calendar.vue +308 -297
  16. package/dist/calendar/template.vue +1 -1
  17. package/dist/cascader/README.en-US.md +2 -1
  18. package/dist/cascader/README.md +2 -1
  19. package/dist/cascader/cascader.vue +340 -328
  20. package/dist/cascader/props.ts +6 -1
  21. package/dist/cascader/type.ts +6 -0
  22. package/dist/cell/cell.vue +127 -121
  23. package/dist/cell-group/cell-group.vue +32 -30
  24. package/dist/check-tag/check-tag.vue +73 -71
  25. package/dist/checkbox/checkbox.vue +127 -127
  26. package/dist/checkbox/props.ts +6 -6
  27. package/dist/checkbox/type.ts +3 -3
  28. package/dist/checkbox-group/checkbox-group.vue +175 -173
  29. package/dist/checkbox-group/props.ts +6 -6
  30. package/dist/checkbox-group/type.ts +4 -4
  31. package/dist/col/col.vue +26 -24
  32. package/dist/collapse/collapse.vue +83 -81
  33. package/dist/collapse-panel/collapse-panel.vue +121 -119
  34. package/dist/collapse-panel/props.ts +4 -4
  35. package/dist/collapse-panel/type.ts +2 -2
  36. package/dist/color-picker/README.md +1 -1
  37. package/dist/color-picker/color-picker.vue +324 -322
  38. package/dist/color-picker/props.ts +2 -2
  39. package/dist/color-picker/template.vue +14 -10
  40. package/dist/common/common.ts +1 -0
  41. package/dist/common/style/theme/index.css +5 -5
  42. package/dist/common/utils.js +7 -2
  43. package/dist/common/validator.js +172 -0
  44. package/dist/config-provider/README.en-US.md +184 -0
  45. package/dist/config-provider/README.md +234 -0
  46. package/dist/config-provider/config-provider.vue +105 -0
  47. package/dist/config-provider/config-store.js +70 -0
  48. package/dist/config-provider/props.ts +16 -0
  49. package/dist/config-provider/reactive-state.js +39 -0
  50. package/dist/config-provider/type.ts +401 -0
  51. package/dist/config-provider/use-config.js +29 -0
  52. package/dist/config-provider/utils.js +29 -0
  53. package/dist/count-down/count-down.vue +98 -97
  54. package/dist/date-time-picker/date-time-picker.vue +410 -395
  55. package/dist/demo/demo.vue +1 -0
  56. package/dist/dialog/dialog.vue +175 -173
  57. package/dist/divider/divider.vue +38 -36
  58. package/dist/draggable/draggable.vue +60 -58
  59. package/dist/drawer/README.md +1 -1
  60. package/dist/drawer/drawer.vue +48 -46
  61. package/dist/dropdown-item/dropdown-item.vue +209 -207
  62. package/dist/dropdown-item/props.ts +4 -4
  63. package/dist/dropdown-item/type.ts +3 -3
  64. package/dist/dropdown-menu/dropdown-menu.vue +93 -99
  65. package/dist/empty/empty.vue +43 -42
  66. package/dist/fab/fab.vue +88 -86
  67. package/dist/footer/footer.vue +36 -34
  68. package/dist/form/README.en-US.md +17 -24
  69. package/dist/form/README.md +18 -25
  70. package/dist/form/form.css +1 -166
  71. package/dist/form/form.vue +251 -236
  72. package/dist/form/props.ts +2 -21
  73. package/dist/form/type.ts +7 -70
  74. package/dist/form-item/README.en-US.md +4 -5
  75. package/dist/form-item/README.md +4 -5
  76. package/dist/form-item/form-item.css +69 -96
  77. package/dist/form-item/form-item.vue +315 -336
  78. package/dist/form-item/form-model.ts +125 -173
  79. package/dist/form-item/props.ts +4 -17
  80. package/dist/form-item/type.ts +43 -1
  81. package/dist/grid/grid.vue +53 -51
  82. package/dist/grid-item/grid-item.vue +121 -119
  83. package/dist/guide/README.md +1 -1
  84. package/dist/guide/guide.vue +281 -277
  85. package/dist/icon/README.md +2 -4
  86. package/dist/icon/icon.vue +78 -76
  87. package/dist/image/README.md +1 -1
  88. package/dist/image/image.vue +103 -101
  89. package/dist/image-viewer/image-viewer.vue +160 -158
  90. package/dist/image-viewer/props.ts +2 -2
  91. package/dist/image-viewer/type.ts +1 -1
  92. package/dist/index.js +3 -0
  93. package/dist/indexes/indexes.vue +264 -267
  94. package/dist/indexes-anchor/indexes-anchor.vue +41 -41
  95. package/dist/input/input.vue +192 -192
  96. package/dist/input/props.ts +6 -6
  97. package/dist/input/type.ts +3 -3
  98. package/dist/link/link.vue +73 -71
  99. package/dist/loading/loading.vue +59 -59
  100. package/dist/locale/ar_KW.ts +157 -0
  101. package/dist/locale/en_US.ts +146 -0
  102. package/dist/locale/it_IT.ts +145 -0
  103. package/dist/locale/ja_JP.ts +132 -0
  104. package/dist/locale/ko_KR.ts +132 -0
  105. package/dist/locale/ru_RU.ts +157 -0
  106. package/dist/locale/zh_CN.ts +133 -0
  107. package/dist/locale/zh_TW.ts +132 -0
  108. package/dist/message/message.vue +181 -173
  109. package/dist/message/props.ts +2 -2
  110. package/dist/message/type.ts +1 -1
  111. package/dist/message-item/message-item.vue +192 -184
  112. package/dist/mixins/using-config.js +39 -0
  113. package/dist/navbar/navbar.vue +201 -199
  114. package/dist/notice-bar/notice-bar.vue +175 -171
  115. package/dist/notice-bar/props.ts +2 -2
  116. package/dist/notice-bar/type.ts +1 -1
  117. package/dist/npm/dayjs/esm/locale/ar.js +81 -0
  118. package/dist/npm/dayjs/esm/locale/it.js +39 -0
  119. package/dist/overlay/overlay.vue +50 -48
  120. package/dist/picker/picker.vue +168 -161
  121. package/dist/picker-item/picker-item.vue +269 -269
  122. package/dist/popover/README.md +1 -1
  123. package/dist/popover/popover.vue +262 -261
  124. package/dist/popover/props.ts +4 -4
  125. package/dist/popover/type.ts +2 -2
  126. package/dist/popup/popup.vue +46 -45
  127. package/dist/progress/README.md +1 -1
  128. package/dist/progress/progress.vue +76 -76
  129. package/dist/pull-down-refresh/props.ts +2 -2
  130. package/dist/pull-down-refresh/pull-down-refresh.vue +240 -234
  131. package/dist/pull-down-refresh/type.ts +1 -1
  132. package/dist/qrcode/README.md +1 -1
  133. package/dist/qrcode/components/qrcode-canvas/qrcode-canvas.vue +340 -338
  134. package/dist/qrcode/components/qrcode-status/qrcode-status.vue +6 -6
  135. package/dist/qrcode/qrcode.vue +93 -87
  136. package/dist/radio/props.ts +6 -6
  137. package/dist/radio/radio.vue +118 -120
  138. package/dist/radio/type.ts +3 -3
  139. package/dist/radio-group/props.ts +4 -4
  140. package/dist/radio-group/radio-group.vue +136 -134
  141. package/dist/radio-group/type.ts +4 -4
  142. package/dist/rate/computed.js +2 -2
  143. package/dist/rate/props.ts +4 -4
  144. package/dist/rate/rate.vue +155 -154
  145. package/dist/rate/type.ts +2 -2
  146. package/dist/result/result.vue +41 -39
  147. package/dist/row/row.vue +38 -36
  148. package/dist/scroll-view/scroll-view.vue +24 -22
  149. package/dist/search/props.ts +2 -2
  150. package/dist/search/search.vue +127 -125
  151. package/dist/search/type.ts +1 -1
  152. package/dist/side-bar/side-bar.vue +57 -55
  153. package/dist/side-bar-item/side-bar-item.vue +86 -86
  154. package/dist/skeleton/skeleton.vue +126 -124
  155. package/dist/slider/README.md +1 -1
  156. package/dist/slider/props.ts +2 -2
  157. package/dist/slider/slider.vue +457 -457
  158. package/dist/slider/type.ts +1 -1
  159. package/dist/step-item/step-item.vue +77 -75
  160. package/dist/stepper/props.ts +2 -2
  161. package/dist/stepper/stepper.vue +168 -149
  162. package/dist/stepper/type.ts +1 -1
  163. package/dist/steps/props.ts +2 -2
  164. package/dist/steps/steps.vue +83 -81
  165. package/dist/steps/type.ts +1 -1
  166. package/dist/sticky/sticky.vue +104 -102
  167. package/dist/swipe-cell/swipe-cell.vue +91 -89
  168. package/dist/swiper/README.md +1 -1
  169. package/dist/swiper/swiper.vue +91 -89
  170. package/dist/swiper-nav/swiper-nav.vue +38 -36
  171. package/dist/switch/props.ts +2 -2
  172. package/dist/switch/switch.vue +62 -62
  173. package/dist/switch/type.ts +1 -1
  174. package/dist/tab-bar/tab-bar.vue +88 -86
  175. package/dist/tab-bar-item/tab-bar-item.vue +85 -82
  176. package/dist/tab-panel/tab-panel.vue +66 -64
  177. package/dist/tabs/tabs.vue +294 -287
  178. package/dist/tag/tag.vue +79 -77
  179. package/dist/textarea/props.ts +6 -6
  180. package/dist/textarea/textarea.vue +127 -126
  181. package/dist/textarea/type.ts +3 -3
  182. package/dist/toast/toast.vue +107 -106
  183. package/dist/transition/transition.vue +30 -28
  184. package/dist/tree-select/tree-select.vue +151 -151
  185. package/dist/types/config-provider.d.ts +7 -0
  186. package/dist/types/index.d.ts +2 -0
  187. package/dist/types/popover.d.ts +7 -0
  188. package/dist/upload/README.en-US.md +13 -14
  189. package/dist/upload/README.md +11 -12
  190. package/dist/upload/props.ts +2 -4
  191. package/dist/upload/type.ts +12 -11
  192. package/dist/upload/upload.css +1 -1
  193. package/dist/upload/upload.vue +672 -512
  194. package/dist/watermark/watermark.vue +151 -149
  195. package/global.d.ts +2 -0
  196. package/package.json +15 -3
  197. package/dist/form/form-item-props.ts +0 -56
@@ -1,21 +1,19 @@
1
1
  <template>
2
2
  <view
3
3
  :class="classPrefix + ' ' + tClass"
4
- :style="tools._style([customStyle])"
4
+ :style="'' + tools._style([customStyle])"
5
5
  >
6
6
  <view
7
- :class="
8
- tools.cls(classPrefix + '__wrapper', [
9
- ['sticky', sticky],
10
- ['active', active]
11
- ])
12
- "
7
+ :class="'' + tools.cls(classPrefix + '__wrapper', [
8
+ ['sticky', sticky],
9
+ ['active', active]
10
+ ])"
13
11
  :style="anchorStyle"
14
12
  >
15
13
  <view :class="classPrefix + '__slot'">
16
14
  <slot />
17
15
  </view>
18
- <view :class="tools.cls(classPrefix + '__header', [['active', active]])">
16
+ <view :class="'' + tools.cls(classPrefix + '__header', [['active', active]])">
19
17
  {{ index }}
20
18
  </view>
21
19
  </view>
@@ -32,40 +30,42 @@ import { ChildrenMixin, RELATION_MAP } from '../common/relation';
32
30
  const name = `${prefix}-indexes-anchor`;
33
31
 
34
32
 
35
- export default uniComponent({
36
- name,
37
- options: {
38
- styleIsolation: 'shared',
39
- },
40
- externalClasses: [
41
- `${prefix}-class`,
42
- ],
43
- mixins: [
44
- ChildrenMixin(RELATION_MAP.IndexesAnchor, {
45
- indexKey: 'tIndex',
46
- }),
47
- ],
48
- props: {
49
- ...props,
50
- },
51
- data() {
52
- return {
53
- prefix,
54
- classPrefix: name,
55
- anchorStyle: '',
56
- sticky: false,
57
- active: false,
58
- tools,
59
- };
60
- },
61
- watch: {
62
- },
63
- mounted() {
33
+ export default {
34
+ ...uniComponent({
35
+ name,
36
+ options: {
37
+ styleIsolation: 'shared',
38
+ },
39
+ externalClasses: [
40
+ `${prefix}-class`,
41
+ ],
42
+ mixins: [
43
+ ChildrenMixin(RELATION_MAP.IndexesAnchor, {
44
+ indexKey: 'tIndex',
45
+ }),
46
+ ],
47
+ props: {
48
+ ...props,
49
+ },
50
+ data() {
51
+ return {
52
+ prefix,
53
+ classPrefix: name,
54
+ anchorStyle: '',
55
+ sticky: false,
56
+ active: false,
57
+ tools,
58
+ };
59
+ },
60
+ watch: {
61
+ },
62
+ mounted() {
64
63
 
65
- },
66
- methods: {
64
+ },
65
+ methods: {
67
66
 
68
- },
69
- });
67
+ },
68
+ }),
69
+ };
70
70
  </script>
71
71
  <style scoped src="./indexes-anchor.css"></style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <view
3
- :style="tools._style([customStyle])"
4
- :class="tools.cls(classPrefix, [['border', !borderless], ['readonly', readonly], ['disabled', disabled]])
3
+ :style="'' + tools._style([customStyle])"
4
+ :class="'' + tools.cls(classPrefix, [['border', !borderless], ['readonly', readonly], ['disabled', disabled]])
5
5
  + ' ' + classPrefix + '--layout-' + layout + ' ' + tClass"
6
6
  aria-describedby
7
7
  >
@@ -42,7 +42,7 @@
42
42
  @click="onClick"
43
43
  >
44
44
  <input
45
- :class="getInputClass(classPrefix, suffix, align, disabled) + ' ' + tClassInput"
45
+ :class="''+ getInputClass(classPrefix, suffix, align, disabled) + ' ' + tClassInput"
46
46
  :maxlength="allowInputOverMax ? -1 : maxlength"
47
47
  :disabled="disabled || readonly"
48
48
  :placeholder="placeholder"
@@ -157,237 +157,237 @@ import { RELATION_MAP } from '../common/relation/parent-map.js';
157
157
  const name = `${prefix}-input`;
158
158
 
159
159
 
160
- export default uniComponent({
161
- name,
162
- options: {
163
- styleIsolation: 'shared',
164
- },
165
- inject: {
166
- [RELATION_MAP.FormKey]: {
167
- default: null,
168
- },
169
- },
170
- externalClasses: [
171
- `${prefix}-class`,
172
- `${prefix}-class-prefix-icon`,
173
- `${prefix}-class-label`,
174
- `${prefix}-class-input`,
175
- `${prefix}-class-clearable`,
176
- `${prefix}-class-suffix`,
177
- `${prefix}-class-suffix-icon`,
178
- `${prefix}-class-tips`,
179
- ],
160
+ export default {
180
161
  components: {
181
162
  TIcon,
182
163
  },
183
- props: {
184
- ...props,
185
- },
186
- emits: [
187
- 'blur',
188
- 'change',
189
- 'clear',
190
- 'click',
191
- 'enter',
192
- 'focus',
193
- 'keyboardheightchange',
194
- 'nicknamereview',
195
- 'validate',
196
- 'update:value',
197
- ],
198
- data() {
199
- return {
200
- prefix,
201
- classPrefix: name,
202
- classBasePrefix: prefix,
203
- showClearIcon: true,
204
- tools,
164
+ ...uniComponent({
165
+ name,
166
+ options: {
167
+ styleIsolation: 'shared',
168
+ },
169
+ inject: {
170
+ [RELATION_MAP.FormKey]: {
171
+ default: null,
172
+ },
173
+ },
174
+ externalClasses: [
175
+ `${prefix}-class`,
176
+ `${prefix}-class-prefix-icon`,
177
+ `${prefix}-class-label`,
178
+ `${prefix}-class-input`,
179
+ `${prefix}-class-clearable`,
180
+ `${prefix}-class-suffix`,
181
+ `${prefix}-class-suffix-icon`,
182
+ `${prefix}-class-tips`,
183
+ ],
184
+ props: {
185
+ ...props,
186
+ },
187
+ emits: [
188
+ 'blur',
189
+ 'change',
190
+ 'clear',
191
+ 'click',
192
+ 'enter',
193
+ 'focus',
194
+ 'keyboardheightchange',
195
+ 'nicknamereview',
196
+ 'validate',
197
+ 'update:value',
198
+ ],
199
+ data() {
200
+ return {
201
+ prefix,
202
+ classPrefix: name,
203
+ classBasePrefix: prefix,
204
+ showClearIcon: true,
205
+ tools,
205
206
 
206
- dataValue: coalesce(this.value, this.defaultValue),
207
+ dataValue: coalesce(this.value, this.defaultValue),
207
208
 
208
209
  // rawValue: '',
209
210
  // innerMaxLen: -1,
210
- };
211
- },
212
- computed: {
213
- },
214
- watch: {
215
- prefixIcon: {
216
- handler(v) {
217
- this.iPrefixIcon = calcIcon(v);
218
- },
219
- immediate: true,
211
+ };
220
212
  },
213
+ watch: {
214
+ prefixIcon: {
215
+ handler(v) {
216
+ this.iPrefixIcon = calcIcon(v);
217
+ },
218
+ immediate: true,
219
+ },
221
220
 
222
- suffixIcon: {
223
- handler(v) {
224
- this.iSuffixIcon = calcIcon(v);
221
+ suffixIcon: {
222
+ handler(v) {
223
+ this.iSuffixIcon = calcIcon(v);
224
+ },
225
+ immediate: true,
225
226
  },
226
- immediate: true,
227
- },
228
227
 
229
- clearable: {
230
- handler(v) {
231
- this.iClearIcon = calcIcon(v, 'close-circle-filled');
228
+ clearable: {
229
+ handler(v) {
230
+ this.iClearIcon = calcIcon(v, 'close-circle-filled');
231
+ },
232
+ immediate: true,
232
233
  },
233
- immediate: true,
234
- },
235
234
 
236
- clearTrigger: 'updateClearIconVisible',
237
- disabled: 'updateClearIconVisible',
238
- readonly: 'updateClearIconVisible',
235
+ clearTrigger: 'updateClearIconVisible',
236
+ disabled: 'updateClearIconVisible',
237
+ readonly: 'updateClearIconVisible',
239
238
 
240
- value: {
241
- handler(v) {
242
- this.dataValue = v;
243
- nextTick().then(() => {
239
+ value: {
240
+ handler(v) {
244
241
  this.dataValue = v;
242
+ nextTick().then(() => {
243
+ this.dataValue = v;
245
244
 
246
- if (this[RELATION_MAP.FormKey]
245
+ if (this[RELATION_MAP.FormKey]
247
246
  && this[RELATION_MAP.FormKey].onValueChange) {
248
- this[RELATION_MAP.FormKey].onValueChange(v);
249
- }
250
- });
247
+ this[RELATION_MAP.FormKey].onValueChange(v);
248
+ }
249
+ });
250
+ },
251
251
  },
252
252
  },
253
- },
254
- mounted() {
255
- const { value, defaultValue } = this;
256
- this.updateValue(coalesce(value, defaultValue, ''));
253
+ mounted() {
254
+ const { value, defaultValue } = this;
255
+ this.updateValue(coalesce(value, defaultValue, ''));
257
256
 
258
- this.updateClearIconVisible();
259
- },
260
- methods: {
261
- getInputClass,
262
- updateValue(value) {
257
+ this.updateClearIconVisible();
258
+ },
259
+ methods: {
260
+ getInputClass,
261
+ updateValue(value) {
263
262
  // this.rawValue = value;
264
- this.dataValue = value;
263
+ this.dataValue = value;
265
264
 
266
- const { allowInputOverMax, maxcharacter, maxlength } = this;
267
- if (!allowInputOverMax && maxcharacter && maxcharacter > 0 && !Number.isNaN(maxcharacter)) {
268
- const { length, characters } = getCharacterLength('maxcharacter', value, maxcharacter);
269
- nextTick().then(() => {
270
- this.dataValue = characters;
271
- });
272
- this.count = length;
273
- } else if (!allowInputOverMax && maxlength && maxlength > 0 && !Number.isNaN(maxlength)) {
274
- const { length, characters } = getCharacterLength('maxlength', value, maxlength);
275
- nextTick().then(() => {
276
- this.dataValue = characters;
277
- });
278
- this.count = length;
279
- } else {
280
- nextTick().then(() => {
265
+ const { allowInputOverMax, maxcharacter, maxlength } = this;
266
+ if (!allowInputOverMax && maxcharacter && maxcharacter > 0 && !Number.isNaN(maxcharacter)) {
267
+ const { length, characters } = getCharacterLength('maxcharacter', value, maxcharacter);
268
+ nextTick().then(() => {
269
+ this.dataValue = characters;
270
+ });
271
+ this.count = length;
272
+ } else if (!allowInputOverMax && maxlength && maxlength > 0 && !Number.isNaN(maxlength)) {
273
+ const { length, characters } = getCharacterLength('maxlength', value, maxlength);
274
+ nextTick().then(() => {
275
+ this.dataValue = characters;
276
+ });
277
+ this.count = length;
278
+ } else {
279
+ nextTick().then(() => {
280
+ this.dataValue = value;
281
+ });
281
282
  this.dataValue = value;
282
- });
283
- this.dataValue = value;
284
- this.count = isDef(value) ? String(value).length : 0;
285
- }
283
+ this.count = isDef(value) ? String(value).length : 0;
284
+ }
286
285
 
287
286
  // this.updateInnerMaxLen();
288
- },
289
- // updateInnerMaxLen() {
290
- // this.innerMaxLen = this.getInnerMaxLen();
291
- // },
292
- // getInnerMaxLen() {
293
- // const {
294
- // allowInputOverMax,
295
- // maxcharacter,
296
- // maxlength,
297
- // dataValue,
298
- // rawValue,
299
- // count,
300
- // } = this;
301
- // return getInnerMaxLen({
302
- // allowInputOverMax,
303
- // maxcharacter,
304
- // maxlength,
305
- // dataValue,
306
- // rawValue,
307
- // count,
308
- // });
309
- // },
287
+ },
288
+ // updateInnerMaxLen() {
289
+ // this.innerMaxLen = this.getInnerMaxLen();
290
+ // },
291
+ // getInnerMaxLen() {
292
+ // const {
293
+ // allowInputOverMax,
294
+ // maxcharacter,
295
+ // maxlength,
296
+ // dataValue,
297
+ // rawValue,
298
+ // count,
299
+ // } = this;
300
+ // return getInnerMaxLen({
301
+ // allowInputOverMax,
302
+ // maxcharacter,
303
+ // maxlength,
304
+ // dataValue,
305
+ // rawValue,
306
+ // count,
307
+ // });
308
+ // },
310
309
 
311
- updateClearIconVisible(value = false) {
312
- const { clearTrigger, disabled, readonly } = this;
313
- if (disabled || readonly) {
314
- this.showClearIcon = false;
315
- return;
316
- }
317
- this.showClearIcon = value || clearTrigger === 'always';
318
- },
310
+ updateClearIconVisible(value = false) {
311
+ const { clearTrigger, disabled, readonly } = this;
312
+ if (disabled || readonly) {
313
+ this.showClearIcon = false;
314
+ return;
315
+ }
316
+ this.showClearIcon = value || clearTrigger === 'always';
317
+ },
319
318
 
320
- onInput(e) {
321
- const { value, cursor, keyCode } = e.detail;
322
- this.updateValue(value);
323
- this.emitChange({ value: this.dataValue, cursor, keyCode });
324
- },
319
+ onInput(e) {
320
+ const { value, cursor, keyCode } = e.detail;
321
+ this.updateValue(value);
322
+ this.emitChange({ value: this.dataValue, cursor, keyCode });
323
+ },
325
324
 
326
- onChange(e) {
327
- if (this.type !== 'nickname') return;
328
- const { value } = e.detail;
329
- this.updateValue(value);
330
- this.emitChange({ value: this.dataValue });
331
- },
325
+ onChange(e) {
326
+ if (this.type !== 'nickname') return;
327
+ const { value } = e.detail;
328
+ this.updateValue(value);
329
+ this.emitChange({ value: this.dataValue });
330
+ },
332
331
 
333
- emitChange(data) {
334
- this.$emit('change', data);
335
- this.$emit('update:value', data.value);
336
- },
332
+ emitChange(data) {
333
+ this.$emit('change', data);
334
+ this.$emit('update:value', data.value);
335
+ },
337
336
 
338
- onFocus(e) {
339
- this.updateClearIconVisible(true);
340
- this.$emit('focus', e.detail);
341
- },
337
+ onFocus(e) {
338
+ this.updateClearIconVisible(true);
339
+ this.$emit('focus', e.detail);
340
+ },
342
341
 
343
- onBlur(e) {
344
- this.updateClearIconVisible();
342
+ onBlur(e) {
343
+ this.updateClearIconVisible();
345
344
 
346
- if (this[RELATION_MAP.FormKey]
345
+ if (this[RELATION_MAP.FormKey]
347
346
  && this[RELATION_MAP.FormKey].onBlur) {
348
- this[RELATION_MAP.FormKey].onBlur(this.dataValue);
349
- }
347
+ this[RELATION_MAP.FormKey].onBlur(this.dataValue);
348
+ }
350
349
 
351
- // 失焦时处理 format
352
- if (typeof this.format === 'function') {
353
- const v = this.format(e.detail.value);
354
- this.updateValue(v);
355
- this.$emit('blur', { value: this.dataValue, cursor: this.count });
356
- return;
357
- }
358
- this.$emit('blur', e.detail);
359
- },
350
+ // 失焦时处理 format
351
+ if (typeof this.format === 'function') {
352
+ const v = this.format(e.detail.value);
353
+ this.updateValue(v);
354
+ this.$emit('blur', { value: this.dataValue, cursor: this.count });
355
+ return;
356
+ }
357
+ this.$emit('blur', e.detail);
358
+ },
360
359
 
361
- onConfirm(e) {
362
- this.$emit('enter', e.detail);
363
- },
360
+ onConfirm(e) {
361
+ this.$emit('enter', e.detail);
362
+ },
364
363
 
365
- onSuffixClick() {
366
- this.$emit('click', { trigger: 'suffix' });
367
- },
364
+ onSuffixClick() {
365
+ this.$emit('click', { trigger: 'suffix' });
366
+ },
368
367
 
369
- onSuffixIconClick() {
370
- this.$emit('click', { trigger: 'suffix-icon' });
371
- },
368
+ onSuffixIconClick() {
369
+ this.$emit('click', { trigger: 'suffix-icon' });
370
+ },
372
371
 
373
- clearInput(e) {
374
- this.$emit('clear', e.detail);
375
- this.dataValue = '';
376
- },
372
+ clearInput(e) {
373
+ this.$emit('clear', e.detail);
374
+ this.dataValue = '';
375
+ },
377
376
 
378
- onKeyboardHeightChange(e) {
379
- this.$emit('keyboardheightchange', e.detail);
380
- },
377
+ onKeyboardHeightChange(e) {
378
+ this.$emit('keyboardheightchange', e.detail);
379
+ },
381
380
 
382
- onNickNameReview(e) {
383
- this.$emit('nicknamereview', e.detail);
384
- },
381
+ onNickNameReview(e) {
382
+ this.$emit('nicknamereview', e.detail);
383
+ },
385
384
 
386
- onClick() {
387
- this.$emit('click', { trigger: 'input' });
385
+ onClick() {
386
+ this.$emit('click', { trigger: 'input' });
387
+ },
388
388
  },
389
- },
390
- });
389
+ }),
390
+ };
391
391
 
392
392
  </script>
393
393
  <style scoped src="./input.css"></style>
@@ -70,8 +70,8 @@ export default {
70
70
  },
71
71
  /** 是否禁用输入框 */
72
72
  disabled: {
73
- type: Boolean,
74
- default: undefined,
73
+ type: [Boolean, null],
74
+ default: null as TdInputProps['disabled'],
75
75
  },
76
76
  /** 获取焦点 */
77
77
  focus: Boolean,
@@ -105,8 +105,8 @@ export default {
105
105
  },
106
106
  /** 占位符 */
107
107
  placeholder: {
108
- type: String,
109
- default: undefined,
108
+ type: [String, null],
109
+ default: null as TdInputProps['placeholder'],
110
110
  },
111
111
  /** 指定 placeholder 的样式类 */
112
112
  placeholderClass: {
@@ -124,8 +124,8 @@ export default {
124
124
  },
125
125
  /** 只读状态 */
126
126
  readonly: {
127
- type: Boolean,
128
- default: undefined,
127
+ type: [Boolean, null],
128
+ default: null as TdInputProps['readonly'],
129
129
  },
130
130
  /** 安全键盘加密公钥的路径,只支持包内路径 */
131
131
  safePasswordCertPath: {
@@ -73,7 +73,7 @@ export interface TdInputProps {
73
73
  /**
74
74
  * 是否禁用输入框
75
75
  */
76
- disabled?: boolean;
76
+ disabled?: boolean | null;
77
77
  /**
78
78
  * 获取焦点
79
79
  * @default false
@@ -109,7 +109,7 @@ export interface TdInputProps {
109
109
  /**
110
110
  * 占位符
111
111
  */
112
- placeholder?: string;
112
+ placeholder?: string | null;
113
113
  /**
114
114
  * 指定 placeholder 的样式类
115
115
  * @default input-placeholder
@@ -127,7 +127,7 @@ export interface TdInputProps {
127
127
  /**
128
128
  * 只读状态
129
129
  */
130
- readonly?: boolean;
130
+ readonly?: boolean | null;
131
131
  /**
132
132
  * 安全键盘加密公钥的路径,只支持包内路径
133
133
  * @default ''