ai.touchui-vue 1.32.0 → 1.32.2

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 (38) hide show
  1. package/lib/ai.touchui-vue.common.js +76 -50
  2. package/lib/float.js +31 -10
  3. package/lib/index.js +1 -1
  4. package/lib/tab.js +34 -29
  5. package/lib/theme/css/theme/B-Design.css +1 -1
  6. package/lib/theme/css/theme/aiplan.css +1 -1
  7. package/lib/theme/css/theme/aiplangd.css +1 -1
  8. package/lib/theme/css/theme/chbn.css +1 -1
  9. package/lib/theme/css/theme/default.css +1 -1
  10. package/lib/theme/css/theme/dt.css +1 -1
  11. package/lib/theme/css/theme/ecloud.css +1 -1
  12. package/lib/theme/css/theme/hongkong.css +1 -1
  13. package/lib/theme/css/theme/narrow.css +1 -1
  14. package/lib/theme/css/theme/sdpf.css +1 -1
  15. package/lib/theme/css/theme/upc.css +1 -1
  16. package/lib/theme/css/theme/website.css +1 -1
  17. package/lib/theme/css/theme/zj.css +1 -1
  18. package/package.json +1 -1
  19. package/packages/float/src/main.vue +29 -8
  20. package/packages/tab/src/tab-item.vue +5 -4
  21. package/packages/tab/src/tab.vue +10 -15
  22. package/packages/theme/lib/css/theme/B-Design.css +1 -1
  23. package/packages/theme/lib/css/theme/aiplan.css +1 -1
  24. package/packages/theme/lib/css/theme/aiplangd.css +1 -1
  25. package/packages/theme/lib/css/theme/chbn.css +1 -1
  26. package/packages/theme/lib/css/theme/default.css +1 -1
  27. package/packages/theme/lib/css/theme/dt.css +1 -1
  28. package/packages/theme/lib/css/theme/ecloud.css +1 -1
  29. package/packages/theme/lib/css/theme/hongkong.css +1 -1
  30. package/packages/theme/lib/css/theme/narrow.css +1 -1
  31. package/packages/theme/lib/css/theme/sdpf.css +1 -1
  32. package/packages/theme/lib/css/theme/upc.css +1 -1
  33. package/packages/theme/lib/css/theme/website.css +1 -1
  34. package/packages/theme/lib/css/theme/zj.css +1 -1
  35. package/packages/theme/src/less/component/float.less +7 -1
  36. package/packages/theme/src/less/component/tab.less +3 -2
  37. package/packages/theme/src/less/element/dis.less +1 -1
  38. package/src/index.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai.touchui-vue",
3
- "version": "1.32.0",
3
+ "version": "1.32.2",
4
4
  "description": "TouchUI Component Library for Vue.js.",
5
5
  "main": "lib/ai.touchui-vue.common.js",
6
6
  "files": [
@@ -10,6 +10,10 @@
10
10
  export default {
11
11
  name: 'ToFloat',
12
12
  props: {
13
+ color: {
14
+ type: String,
15
+ default: ''
16
+ },
13
17
  slide: Boolean,
14
18
  lazy: {
15
19
  type: Boolean,
@@ -75,6 +79,15 @@ export default {
75
79
  beforeClose: {
76
80
  type: Function,
77
81
  default: null
82
+ },
83
+ // 偏移量
84
+ dx: {
85
+ type: [String, Number],
86
+ default: 0
87
+ },
88
+ dy: {
89
+ type: [String, Number],
90
+ default: 0
78
91
  }
79
92
  },
80
93
  data() {
@@ -97,6 +110,9 @@ export default {
97
110
  if (this.show) {
98
111
  arr.push('to-float-show')
99
112
  }
113
+ if (this.color) {
114
+ arr.push(`to-float-color-${this.color}`)
115
+ }
100
116
  if (this.slide) {
101
117
  arr.push('to-float-slide')
102
118
  } else {
@@ -273,6 +289,8 @@ export default {
273
289
  let leftSpace; // 左侧空间宽度
274
290
  let rightSpace; // 右侧空间宽度
275
291
  let useSpace // 使用的空间高度
292
+ let dx = Number(this.dx) * this.$TouchUI.em() // 横坐标偏移
293
+ let dy = Number(this.dy) * this.$TouchUI.em() // 纵坐标偏移
276
294
 
277
295
  // 传入的是触点
278
296
  if (link.clientX || link.touches) {
@@ -349,35 +367,38 @@ export default {
349
367
  // 设置显示位置
350
368
  if (this.iposition === 'top') {
351
369
  this.$el.style.top = ''
352
- this.$el.style.bottom = bottomSpace + linkHeight - 1 + 'px'
370
+ this.$el.style.bottom = bottomSpace + linkHeight - 1 - dy + 'px'
353
371
  }
354
372
  if (this.iposition === 'bottom') {
355
- this.$el.style.top = topSpace + linkHeight - 1 + 'px'
373
+ this.$el.style.top = topSpace + linkHeight - 1 + dy + 'px'
356
374
  this.$el.style.bottom = ''
357
375
  }
358
376
  if (this.iposition === 'top' || this.iposition === 'bottom') {
359
377
  if (this.ialign === 'left') {
360
- this.$el.style.left = leftSpace + 'px'
378
+ this.$el.style.left = leftSpace + dx + 'px'
379
+ this.$el.style.right = ''
380
+ } else if (this.ialign === 'center') {
381
+ this.$el.style.left = leftSpace - contentWidth / 2 + linkWidth / 2 + 'px'
361
382
  this.$el.style.right = ''
362
383
  } else {
363
- this.$el.style.right = rightSpace + 'px'
384
+ this.$el.style.right = rightSpace - dx + 'px'
364
385
  this.$el.style.left = ''
365
386
  }
366
387
  }
367
388
  if (this.iposition === 'left') {
368
- this.$el.style.right = rightSpace + linkWidth - 1 + 'px'
389
+ this.$el.style.right = rightSpace + linkWidth - dx - 1 + 'px'
369
390
  this.$el.style.left = ''
370
391
  }
371
392
  if (this.iposition === 'right') {
372
- this.$el.style.left = leftSpace + linkWidth - 1 + 'px'
393
+ this.$el.style.left = leftSpace + linkWidth + dx - 1 + 'px'
373
394
  this.$el.style.right = ''
374
395
  }
375
396
  if (this.iposition === 'left' || this.iposition === 'right') {
376
397
  if (this.ialign === 'bottom') {
377
398
  this.$el.style.top = ''
378
- this.$el.style.bottom = bottomSpace + 'px'
399
+ this.$el.style.bottom = bottomSpace - dy + 'px'
379
400
  } else {
380
- this.$el.style.top = topSpace + 'px'
401
+ this.$el.style.top = topSpace + dy + 'px'
381
402
  this.$el.style.bottom = ''
382
403
  }
383
404
  }
@@ -33,7 +33,8 @@ export default {
33
33
  default: ''
34
34
  },
35
35
  lazy: Boolean,
36
- on: Boolean
36
+ on: Boolean,
37
+ disabled: Boolean
37
38
  },
38
39
  data() {
39
40
  return {
@@ -49,8 +50,8 @@ export default {
49
50
  }
50
51
  },
51
52
  listenChange() {
52
- const { value, label, icon, deletable, number, pic, on, data } = this;
53
- return { value, label, icon, deletable, number, pic, on, data };
53
+ const { value, label, icon, deletable, number, pic, on, data, disabled } = this;
54
+ return { value, label, icon, deletable, number, pic, on, data, disabled };
54
55
  }
55
56
  },
56
57
  watch: {
@@ -78,7 +79,7 @@ export default {
78
79
  if (this.$parent.data.length === 0) {
79
80
  this.$parent.generateTabsFromSubTabItem();
80
81
  }
81
- });
82
+ })
82
83
  }
83
84
  }
84
85
  };
@@ -7,7 +7,10 @@
7
7
  <div ref="list" class="list">
8
8
  <ul ref="ul" class="to-tab-ul" :style="setUlStyle" @mouseleave="taboutHandle" @mouseover="isOnTab = true">
9
9
  <template v-for="(item, index) in itabs">
10
- <li v-if="item.label" :key="index" :style="setTabStyle(item)" :class="{ on: item.value === iValue, deletable }" @click="changeTab(item, index, 'click')" @mouseover="changeTab(item, index, 'mouseover')">
10
+ <li v-if="$slots.center && Math.floor(itabs.length / 2) === index" :key="index" class="center">
11
+ <slot name="center"></slot>
12
+ </li>
13
+ <li v-else :key="index" :style="setTabStyle(item)" :class="{ on: item.value === iValue, deletable, disabled: item.disabled}" @click="changeTab(item, index, 'click')" @mouseover="changeTab(item, index, 'mouseover')">
11
14
  <div class="content">
12
15
  <slot name="item" :item="item">
13
16
  <div v-if="item.pic" class="pic">
@@ -30,11 +33,11 @@
30
33
  </ul>
31
34
  </div>
32
35
  <div v-if="$slots.fn || overSize" class="fn">
33
- <template v-if="position==='top'&&tabOver === 'control'&&overSize && !$phone">
36
+ <template v-if="(position==='top' || position === 'bottom')&&tabOver === 'control'&&overSize && !$phone">
34
37
  <to-button v-dis="left >= 0" mode="none" color="primary" icon="back" fillet="normal" @mousedown.native="moveToLeft" @mouseout.native="moveStop" @mouseup.native="moveStop"></to-button>
35
38
  <to-button v-dis="left <= dis * -1" mode="none" color="primary" icon="next" fillet="normal" @mousedown.native="moveToRight" @mouseout.native="moveStop" @mouseup.native="moveStop"></to-button>
36
39
  </template>
37
- <template v-if="position==='top'&&tabOver === 'float'&&overSize&&moreTabs.length">
40
+ <template v-if="(position==='top' || position === 'bottom')&&tabOver === 'float'&&overSize&&moreTabs.length">
38
41
  <to-button ref="more" icon="unfold" color="primary" mode="none" fillet="normal" @click="$refs.float.toggle('more')"></to-button>
39
42
  </template>
40
43
  <slot name="fn"></slot>
@@ -158,7 +161,6 @@ export default {
158
161
  tabs: [],
159
162
  em: 0,
160
163
  moreTabs: [],
161
- timestamp: 0,
162
164
  currentUlWidth: 0
163
165
  };
164
166
  },
@@ -173,10 +175,6 @@ export default {
173
175
  return {
174
176
  width: this.tabWidth + 'em'
175
177
  }
176
- } else if (item.label) {
177
- // return {
178
- // width: item.label.length*2 + 'em'
179
- // };
180
178
  } else {
181
179
  return '';
182
180
  }
@@ -281,12 +279,7 @@ export default {
281
279
 
282
280
  // 点击层外关闭
283
281
  document.body.addEventListener('click', this.blur)
284
-
285
- // 默认隐藏 page
286
- // this.showPage = false
287
282
  }
288
- this.em = this.$TouchUI.getRatio() * 12
289
- this.timestamp = Math.round(new Date())
290
283
  },
291
284
  beforeDestroy() {
292
285
  if (this.contentType === 'float') {
@@ -390,6 +383,7 @@ export default {
390
383
  },
391
384
  changeTab(item, index, event) {
392
385
  if (event === 'click') {
386
+ if (item.disabled) return
393
387
  this.$emit('tab-click', item.value, item, index)
394
388
  }
395
389
  if (event === 'mouseover') {
@@ -529,7 +523,7 @@ export default {
529
523
  tabsItem.map(({ componentOptions = { propsData: {} } }) => {
530
524
  const {
531
525
  tag,
532
- propsData: { label, value, icon, pic, number, on, data }
526
+ propsData: { label, value, icon, pic, number, on, data, disabled}
533
527
  } = componentOptions;
534
528
  if (String(tag) === 'to-tab-item') {
535
529
  tabs.push({
@@ -538,7 +532,8 @@ export default {
538
532
  icon,
539
533
  pic,
540
534
  number,
541
- data
535
+ data,
536
+ disabled: disabled !== undefined
542
537
  });
543
538
  }
544
539
  if (on === '' || on === true) {