@tdesign/uniapp 0.7.0 → 0.7.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.
@@ -80,7 +80,7 @@ value | String | '' | 值 | N
80
80
  -- | -- | --
81
81
  action-click | \- | 点击右侧操作按钮文字时触发
82
82
  blur | `(context: { value: string })` | 失去焦点时触发
83
- change | `(context: { value: string })` | 值发生变化时触发
83
+ change | `(context: { value: string, trigger: 'input-change' \| 'option-click' \| 'clear' })` | 值发生变化时触发
84
84
  clear | `(context: { value: string })` | 点击清除时触发
85
85
  focus | `(context: { value: string })` | 聚焦时触发
86
86
  submit | `(context: { value: string })` | 提交时触发
@@ -88,7 +88,7 @@
88
88
  :t-class="classPrefix + '__result-item'"
89
89
  hover
90
90
  aria-role="option"
91
- @click="onSelectResultItem($event, { index })"
91
+ @click="onSelectOption($event, { index })"
92
92
  >
93
93
  <template
94
94
  #title
@@ -136,7 +136,6 @@ export default uniComponent({
136
136
  ...props,
137
137
  },
138
138
  emits: [
139
- 'selectresult',
140
139
  ],
141
140
  data() {
142
141
  return {
@@ -214,7 +213,10 @@ export default uniComponent({
214
213
 
215
214
  nextTick().then(() => {
216
215
  this.dataValue = value;
217
- this.$emit('change', { value });
216
+ this.$emit('change', {
217
+ value,
218
+ trigger: 'input-change',
219
+ });
218
220
  });
219
221
  // this.updateInnerMaxLen();
220
222
  },
@@ -234,7 +236,10 @@ export default uniComponent({
234
236
  handleClear() {
235
237
  this.dataValue = '';
236
238
  this.$emit('clear', { value: '' });
237
- this.$emit('change', { value: '' });
239
+ this.$emit('change', {
240
+ value: '',
241
+ trigger: 'clear',
242
+ });
238
243
  },
239
244
 
240
245
  onConfirm(e) {
@@ -246,13 +251,15 @@ export default uniComponent({
246
251
  this.$emit('action-click');
247
252
  },
248
253
 
249
- onSelectResultItem(tools, { index }) {
254
+ onSelectOption(tools, { index }) {
250
255
  const item = this.resultList[index];
251
256
  this.dataValue = item;
252
257
  this.isSelected = true;
253
258
 
254
- this.$emit('change', { value: item });
255
- this.$emit('selectresult', { index, item });
259
+ this.$emit('change', {
260
+ value: item,
261
+ trigger: 'option-click',
262
+ });
256
263
  },
257
264
  highLight,
258
265
  // updateInnerMaxLen() {
@@ -149,7 +149,7 @@ export interface TdSearchProps {
149
149
  /**
150
150
  * 值发生变化时触发
151
151
  */
152
- onChange?: (context: { value: string }) => void;
152
+ onChange?: (context: { value: string; trigger: 'input-change' | 'option-click' | 'clear' }) => void;
153
153
  /**
154
154
  * 点击清除时触发
155
155
  */
@@ -31,7 +31,7 @@
31
31
  :key="index"
32
32
  :class="
33
33
  tools.cls(classPrefix + '__scale-item', [
34
- ['active', _value >= item.val],
34
+ ['active', innerValue >= item.val],
35
35
  ['disabled', disabled],
36
36
  theme,
37
37
  ['hidden', ((index == 0 || index == scaleArray.length - 1) && theme == 'capsule') || value == item.val]
@@ -67,7 +67,7 @@
67
67
  aria-live="assertive"
68
68
  :aria-hidden="!isVisibleToScreenReader"
69
69
  >
70
- {{ getValue(label, _value) || _value }}
70
+ {{ getValue(label, innerValue) || innerValue }}
71
71
  </view>
72
72
  <view
73
73
  :class="classPrefix + '__dot-slider'"
@@ -75,8 +75,8 @@
75
75
  :aria-disabled="disabled"
76
76
  :aria-valuemax="max"
77
77
  :aria-valuemin="min"
78
- :aria-valuenow="_value"
79
- :aria-valuetext="getValue(label, _value) || _value"
78
+ :aria-valuenow="innerValue"
79
+ :aria-valuetext="getValue(label, innerValue) || innerValue"
80
80
  />
81
81
  </view>
82
82
  </view>
@@ -240,7 +240,7 @@ export default uniComponent({
240
240
  lineLeft: 0,
241
241
  lineRight: 0,
242
242
  dotTopValue: [0, 0],
243
- _value: 0,
243
+ innerValue: 0,
244
244
  blockSize: 20,
245
245
  isScale: false,
246
246
  scaleArray: [],
@@ -264,7 +264,7 @@ export default uniComponent({
264
264
  // immediate: true,
265
265
  deep: true,
266
266
  },
267
- _value: {
267
+ innerValue: {
268
268
  handler(newValue) {
269
269
  this.bus.on('initial', () => this.renderLine(newValue));
270
270
  this.toggleA11yTips();
@@ -294,7 +294,7 @@ export default uniComponent({
294
294
  this.bus.on('initial', () => this.handleMark(this.marks));
295
295
  this.bus.on('initial', () => {
296
296
  nextTick().then(() => {
297
- this.renderLine(this._value);
297
+ this.renderLine(this.innerValue);
298
298
  });
299
299
  });
300
300
  this.toggleA11yTips();
@@ -371,7 +371,7 @@ export default uniComponent({
371
371
  value: trimmedValue,
372
372
  });
373
373
  if (this._selfControlled) {
374
- this._value = trimmedValue;
374
+ this.innerValue = trimmedValue;
375
375
  }
376
376
  },
377
377
 
@@ -417,7 +417,7 @@ export default uniComponent({
417
417
  }
418
418
 
419
419
  const setValueAndTrigger = () => {
420
- this._value = value;
420
+ this.innerValue = value;
421
421
  this.realLabel = realLabel;
422
422
  };
423
423
 
@@ -609,7 +609,7 @@ export default uniComponent({
609
609
  // 当前leftdot中心 + 左侧偏移量 = 目标左侧中心距离
610
610
  const left = pagePosition - initialLeft - offset;
611
611
  const leftValue = this.convertPosToValue(left, 0);
612
- this.triggerValue([this.stepValue(leftValue), this._value[1]]);
612
+ this.triggerValue([this.stepValue(leftValue), this.innerValue[1]]);
613
613
  } else {
614
614
  let right = -(pagePosition - initialRight);
615
615
  if (vertical) {
@@ -617,7 +617,7 @@ export default uniComponent({
617
617
  }
618
618
  const rightValue = this.convertPosToValue(right, 1);
619
619
 
620
- this.triggerValue([this._value[0], this.stepValue(rightValue)]);
620
+ this.triggerValue([this.innerValue[0], this.stepValue(rightValue)]);
621
621
  }
622
622
  });
623
623
  },
@@ -635,7 +635,7 @@ export default uniComponent({
635
635
 
636
636
  onTouchMoveLeft(e) {
637
637
  const { disabled, theme } = this;
638
- const { initialLeft, _value, blockSize } = this;
638
+ const { initialLeft, innerValue, blockSize } = this;
639
639
  if (disabled) return;
640
640
 
641
641
  const touch = e.changedTouches.find(item => item.identifier === this.identifier[0]);
@@ -647,7 +647,7 @@ export default uniComponent({
647
647
  }
648
648
  const currentLeft = pagePosition - initialLeft - offset;
649
649
 
650
- const newData = [...(_value)];
650
+ const newData = [...(innerValue)];
651
651
  const leftValue = this.convertPosToValue(currentLeft, 0);
652
652
 
653
653
  newData[0] = this.stepValue(leftValue);
@@ -657,7 +657,7 @@ export default uniComponent({
657
657
 
658
658
  onTouchMoveRight(e) {
659
659
  const { disabled, vertical, theme } = this;
660
- const { initialRight, _value } = this;
660
+ const { initialRight, innerValue } = this;
661
661
  if (disabled) return;
662
662
 
663
663
  const touch = e.changedTouches.find(item => item.identifier === this.identifier[1]);
@@ -671,7 +671,7 @@ export default uniComponent({
671
671
  }
672
672
  const currentRight = -(pagePosition - initialRight - offset);
673
673
 
674
- const newData = [...(_value)];
674
+ const newData = [...(innerValue)];
675
675
  const rightValue = this.convertPosToValue(currentRight, 1);
676
676
  newData[1] = this.stepValue(rightValue);
677
677
 
@@ -682,7 +682,7 @@ export default uniComponent({
682
682
  const { theme } = this;
683
683
  const { blockSize, maxRange } = this;
684
684
  const halfBlock = (theme) === 'capsule' ? Number(blockSize) / 2 : 0;
685
- const [a, b] = this._value ;
685
+ const [a, b] = this.innerValue ;
686
686
  const cut = v => parseInt(v, 10);
687
687
 
688
688
  this.dotTopValue = [a, b];
@@ -698,7 +698,7 @@ export default uniComponent({
698
698
  },
699
699
 
700
700
  onTouchEnd(e) {
701
- this.$emit('dragend', { e, value: this._value });
701
+ this.$emit('dragend', { e, value: this.innerValue });
702
702
  if (e.currentTarget.id === 'rightDot') {
703
703
  this.identifier[1] = -1;
704
704
  } else {
@@ -59,7 +59,7 @@ export default {
59
59
  /** 支持上传的文件类型,图片或视频 */
60
60
  mediaType: {
61
61
  type: Array,
62
- default: ['image', 'video'],
62
+ default: () => ['image', 'video'],
63
63
  },
64
64
  /** 是否支持图片预览,文件没有预览 */
65
65
  preview: {
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "@tdesign/uniapp",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "id": "tdesign-uniapp",
5
5
  "title": "tdesign-uniapp",
6
6
  "description": "TDesign Component for UniApp",
7
+ "author": "tdesign",
8
+ "license": "MIT",
7
9
  "keywords": [
8
10
  "tdesign",
9
11
  "miniprogram",
package/dist/.eslintrc.js DELETED
@@ -1,30 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- extends: ['eslint-config-light-vue3'],
4
- globals: {
5
- getCurrentPages: true,
6
- uni: true,
7
- globalThis: true,
8
- qq: true,
9
- weex: true,
10
- plus: true,
11
- getApp: true,
12
- },
13
- parserOptions: {
14
- project: 'tsconfig.eslint.json',
15
- tsconfigRootDir: __dirname,
16
-
17
- ecmaVersion: 'latest',
18
- extraFileExtensions: ['.vue'],
19
- },
20
- rules: {
21
- 'vue/no-v-text-v-html-on-component': 0,
22
- 'vue/component-name-in-template-casing': [
23
- 2,
24
- 'kebab-case',
25
- {
26
- registeredComponentsOnly: true,
27
- },
28
- ],
29
- },
30
- };
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "include": [
4
- "**/*.ts",
5
- "**/*.js",
6
- "./**/*.d.ts",
7
- "./types/**/*.d.ts",
8
- "./**/*.ts",
9
- "./**/*.tsx",
10
- "./**/*.vue",
11
- ".eslintrc.js"
12
- ]
13
- }