dolphin-weex-ui 2.1.8 → 2.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dolphin-weex-ui",
3
- "version": "2.1.8",
3
+ "version": "2.2.0",
4
4
  "description": "inteligense cross platform frame",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -8,7 +8,7 @@
8
8
  <slot></slot>
9
9
  </div>
10
10
  <div class="dof-card-header-arrow-wrapper" v-if="collapsable" @click="onCollapse">
11
- <dof-switch v-if="_isColmo" :checked="!collapsed_" @dof-change="onCollapse"> </dof-switch>
11
+ <dof-switch v-if="_isColmo" :checked="!collapsed_" @dofChange="onCollapse"> </dof-switch>
12
12
  <image v-else ref="arrow" class="dof-card-header-arrow" :src="arrowUp"></image>
13
13
  </div>
14
14
  </div>
@@ -149,6 +149,8 @@ export default {
149
149
  this.bodyHeight = res.size.height
150
150
  if (this.collapsed_) {
151
151
  this.collapseBody(0)
152
+ } else {
153
+ this.expandeBody()
152
154
  }
153
155
  })
154
156
  })
@@ -42,12 +42,7 @@
42
42
  :style="
43
43
  Object.assign(
44
44
  {
45
- backgroundColor: bgColor,
46
- // 'background-color': touchActive === i ? touchColor : bgColor,
47
- 'border-left-color': touchActive === i ? touchColor : 'transparent',
48
- 'border-right-color': touchActive - 1 === i ? touchColor : 'transparent',
49
- 'border-left-width': !(tabActive === i || tabActive - 1 === i) ? '0px' : '2px',
50
- 'border-right-width': !(tabActive === i || tabActive - 1 === i) ? '0px' : '3px'
45
+ backgroundColor: bgColor
51
46
  },
52
47
  tabLineStyle
53
48
  )
@@ -58,7 +53,6 @@
58
53
  :style="
59
54
  Object.assign(
60
55
  {
61
- 'border-color': tabActive === i || tabActive - 1 === i ? activeBorderColor : 'transparent',
62
56
  'background-color': touchActive - 1 === i ? touchColor : bgColor
63
57
  },
64
58
  maskStyle
@@ -79,9 +73,9 @@
79
73
  <div
80
74
  class="border-top"
81
75
  :style="{
82
- 'border-color': tabActive === i ? activeBorderColor : borderColor,
76
+ 'border-color': tabActive === i ? activeBorderColor : borderColor
83
77
  // 优化边缘显示
84
- width: tabActive - 1 === i ? itemHeight / 4 - 1 + 'px' : itemHeight / 4 + 3 + 'px'
78
+ // width: tabActive - 1 === i ? itemHeight / 4 - 1 + 'px' : itemHeight / 4 + 3 + 'px'
85
79
  }"
86
80
  ></div>
87
81
  <div
@@ -90,11 +84,18 @@
90
84
  Object.assign(
91
85
  {
92
86
  'background-color': tabActive - 1 === i ? activeBorderColor : borderColor
93
- },
94
- fakeBorderStyle
87
+ }
88
+ // fakeBorderStyle
95
89
  )
96
90
  "
97
91
  ></div>
92
+ <div
93
+ class="slash"
94
+ :style="{
95
+ left: itemHeight / 8 - 1 + 'px',
96
+ 'background-color': tabActive === i || tabActive - 1 === i ? activeBorderColor : 'transparent'
97
+ }"
98
+ ></div>
98
99
  </div>
99
100
  </div>
100
101
  </div>
@@ -303,7 +304,7 @@ export default {
303
304
  position: absolute;
304
305
  right: 0;
305
306
  top: 0;
306
- border-top-width: 2px;
307
+ /* border-top-width: 2px; */
307
308
  transform: rotateZ(-77deg);
308
309
  transform-origin: right top;
309
310
  }
@@ -324,6 +325,7 @@ export default {
324
325
  border-top-width: 4px;
325
326
  top: -2px;
326
327
  left: -3px;
328
+ right: -3px;
327
329
  position: absolute;
328
330
  }
329
331
  .border-bottom {
@@ -331,6 +333,16 @@ export default {
331
333
  height: 4px;
332
334
  bottom: -2px;
333
335
  position: absolute;
336
+ left: -3px;
337
+ right: -3px;
338
+ }
339
+ .slash {
340
+ width: 2px;
341
+ position: absolute;
342
+ top: 0px;
343
+ bottom: 0px;
344
+ transform-origin: center center;
345
+ transform: rotate(13deg);
334
346
  }
335
347
  .flex-1 {
336
348
  flex: 1;
@@ -213,7 +213,7 @@
213
213
  flex-direction: columns;
214
214
  align-items: center;
215
215
  justify-content: center;
216
- flex: 1;
216
+ /* flex: 1; */
217
217
  height: 90px;
218
218
  /* border-top-color: #c8c7cc; */
219
219
  border-top-width: 1px;
@@ -1,10 +1,11 @@
1
1
  @media screen and (weex-theme: colmo) {
2
2
  .g-popover {
3
- box-shadow: 0px 6px 6px 0px rgba(0, 0, 0, 0.4);
3
+ /* box-shadow: 0px 6px 6px 0px rgba(0, 0, 0, 0.4); */
4
4
  }
5
5
  .content-inner {
6
6
  border-radius: 0px;
7
7
  padding: 32px;
8
+ box-shadow: 0px 6px 6px 0px rgba(0, 0, 0, 0.4);
8
9
  }
9
10
  .u-popover-arrow {
10
11
  background-color: #292b2f;
@@ -10,7 +10,6 @@
10
10
  <div ref="dof-popover" class="g-popover" v-if="show && buttons.length" :style="contentStyle">
11
11
  <div :class="['u-popover-arrow', theme !== 'white' && 'u-popover-theme-dark']" :style="arrowStyle"></div>
12
12
  <scroller
13
- scroll-direction="horizontal"
14
13
  show-scrollbar="false"
15
14
  :class="['u-popover-inner', theme !== 'white' && 'u-popover-theme-dark']"
16
15
  :style="popoverInnerStyle"
@@ -51,15 +51,20 @@
51
51
  <div class="dof-slider-scales" v-if="$slots.default">
52
52
  <slot></slot>
53
53
  </div>
54
- <div class="dof-slider-disabled-mask" v-if="isGradientBar && disabled" @touchstart="() => {}"></div>
54
+ <div class="dof-slider-disabled-mask" v-if="isGradientBar && disabled" @touchstart="maskTouchStart"></div>
55
55
  </div>
56
56
  </template>
57
57
 
58
58
  <script>
59
- import { getBoundingClientRect } from '../utils/dom.js'
59
+ // import { getBoundingClientRect } from '../utils/dom.js'
60
60
  import { clamp } from '../utils/math-extension.js'
61
61
  import { Touch } from '../utils/touch.js'
62
62
  import ColmoMixin from '../../mixins/colmo'
63
+ const dom = weex.requireModule('dom')
64
+
65
+ const getBoundingClientRect = (element, func, delay = 50) => {
66
+ setTimeout(() => dom && dom.getComponentRect(element, func), delay)
67
+ }
63
68
 
64
69
  export default {
65
70
  mixins: [ColmoMixin],
@@ -135,7 +140,8 @@ export default {
135
140
  startRight: null,
136
141
  prevScreenX: null,
137
142
  isTouching: false,
138
- isShow: false
143
+ isShow: false,
144
+ getWidthRectTime: 0
139
145
  }
140
146
  },
141
147
  watch: {
@@ -228,7 +234,7 @@ export default {
228
234
  top: `${(this._trackHeight - this.trackHeight) / 2}px`,
229
235
  left: `${buttonPadding}px`,
230
236
  right: `${buttonPadding}px`,
231
- height: this.trackHeight,
237
+ height: `${this.trackHeight}px`,
232
238
  borderRadius: `${this.trackHeight / 2}px`
233
239
  }
234
240
  if (this.barColor) {
@@ -287,18 +293,28 @@ export default {
287
293
  }
288
294
  },
289
295
  mounted() {
290
- getBoundingClientRect(
291
- this.$refs.track,
292
- res => {
293
- if (res.result) {
294
- // 实际可滑动长度(可变化范围)= bar宽度 - btn宽度
295
- this.width = res.size.width - this._trackHeight
296
- }
297
- },
298
- this.delay
299
- )
296
+ this.getRect()
300
297
  },
301
298
  methods: {
299
+ getRect() {
300
+ getBoundingClientRect(
301
+ this.$refs.track,
302
+ res => {
303
+ if (res.result && res.size.width !== 0) {
304
+ // 实际可滑动长度(可变化范围)= bar宽度 - btn宽度
305
+ this.width = res.size.width - this._trackHeight
306
+ } else {
307
+ this.getWidthRectTime < 6
308
+ ? setTimeout(() => {
309
+ this.getWidthRectTime++
310
+ this.getRect()
311
+ }, 50)
312
+ : (this.width = res.size.width - this._trackHeight)
313
+ }
314
+ },
315
+ this.delay
316
+ )
317
+ },
302
318
  async onTouchStart(e) {
303
319
  if (!this.interactive) {
304
320
  return
@@ -337,9 +353,10 @@ export default {
337
353
  const diff = (delta / total) * this.scope
338
354
 
339
355
  this.current = this.startValue + diff
356
+ this.prevScreenX = e.changedTouches[0].screenX
340
357
 
358
+ if (delta === 0) return
341
359
  this.update(this.current)
342
- this.prevScreenX = e.changedTouches[0].screenX
343
360
  },
344
361
  async onTouchEnd(e) {
345
362
  if (!this.interactive) {
@@ -403,7 +420,8 @@ export default {
403
420
  0
404
421
  )
405
422
  })
406
- }
423
+ },
424
+ maskTouchStart() {}
407
425
  }
408
426
  }
409
427
  </script>
@@ -1,13 +1,13 @@
1
1
  <template>
2
2
  <div>
3
- <div v-if="isAndroid" class="container" :style="{ width: _cellWidth + 'px', 'padding-right': padding + 'px' }">
3
+ <div v-if="!isIOS" class="container" :style="{ width: _cellWidth + 'px', 'padding-right': padding + 'px' }">
4
4
  <div
5
5
  class="itemWrap"
6
6
  ref="menuItem"
7
7
  :style="{ width: _cellWidth + rightWidth(item) + 'px' }"
8
8
  v-for="(item, index) in listData"
9
9
  :key="index"
10
- @swipe="slideMenu($event, index, item.rightItem.length)"
10
+ @swipe="slideMenu($event, index, item)"
11
11
  @touchend="touchend"
12
12
  >
13
13
  <div v-if="padding" :style="{ width: padding + 'px' }"></div>
@@ -51,11 +51,10 @@
51
51
  :key="'skid-' + index"
52
52
  class="dof-skid"
53
53
  :style="{ width: _cellWidth + rightWidth(item) + 'px' }"
54
- @horizontalpan="e => !isAndroid && onPanStart(e, item, index, item.rightItem ? item.rightItem.length : 0)"
55
- @panend="e => onPanEnd(e, item, index)"
54
+ @horizontalpan="handleHorizontalpan(event, item, index)"
55
+ @panend="handlePanEnd(event, item, index)"
56
56
  >
57
57
  <div v-if="padding" :style="{ width: padding + 'px' }"></div>
58
- <!-- 由于dofcell组件没有设置宽度,所以需要处理 -->
59
58
  <div class="cellBox">
60
59
  <dof-cell
61
60
  ref="cell"
@@ -274,6 +273,12 @@ export default {
274
273
  }
275
274
  },
276
275
 
276
+ handleHorizontalpan(e, item, index) {
277
+ !this.isAndroid && this.onPanStart(e, item, index, item.rightItem ? item.rightItem.length : 0)
278
+ },
279
+ handlePanEnd(e, item, index) {
280
+ this.onPanEnd(e, item, index)
281
+ },
277
282
  // 使用官方的pan事件解决某些ios设备使用@swipe不能滑动的问题
278
283
  onPanStart: function(e, node, i, len) {
279
284
  const { saveIdx } = this
@@ -284,8 +289,9 @@ export default {
284
289
  this.mobileX = 0
285
290
  }
286
291
  this.saveIdx = i
287
- !Utils.env.isWeb() ? this.mobile(e, node, i, len) : this.web(e, node, i)
288
- e.stopPropagation()
292
+ this.mobile(e, node, i, len)
293
+ // !Utils.env.isWeb() ? this.mobile(e, node, i, len) : this.web(e, node, i)
294
+ // e.stopPropagation()
289
295
  },
290
296
  web(e, node, i) {
291
297
  this.webStarX = e.changedTouches[0].pageX
@@ -353,7 +359,8 @@ export default {
353
359
  }, 100)
354
360
  },
355
361
 
356
- slideMenu(e, index, length) {
362
+ slideMenu(e, index, item) {
363
+ let length = item.rightItem.length
357
364
  this.cellCanClick = false
358
365
  let listItems = this.$refs.menuItem
359
366
  let ele = this.$refs.menuItem[index]
@@ -98,6 +98,8 @@ import { throttle } from '../../helper/utils'
98
98
  import ColmoMixin from '../../mixins/colmo'
99
99
  import { STYLE_MAP } from './style'
100
100
  import DofSpinner from '../dof-spinner'
101
+ import Utils from '../utils'
102
+
101
103
  export default {
102
104
  components: { DofSpinner },
103
105
  mixins: [ColmoMixin],
@@ -212,6 +214,7 @@ export default {
212
214
  rightDotStyle() {
213
215
  let offset = 46
214
216
  if ((this._isColmo && this.type === 'default') || this.type === 'colmo') offset = 50
217
+ if (Utils.env.isWeb()) offset = 46
215
218
  return {
216
219
  backgroundColor: this._dotColor,
217
220
  transform: `translateX(${offset}px) scale(2.25)`
@@ -215,7 +215,7 @@ export default {
215
215
  isActiveTitleBold: false,
216
216
  bgColor: '#151617',
217
217
  titleColor: 'rgba(255,255,255,0.4)',
218
- activeTitleColor: 'rgba(255,255,255,0.8);',
218
+ activeTitleColor: 'rgba(255,255,255,0.8)',
219
219
  boxBgColor: '#151617',
220
220
  activeBoxBgColor: '#151617',
221
221
  activeBottomColor: '#B35336',