dolphin-weex-ui 0.2.13 → 0.2.15

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 (45) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/index.native.js +3812 -1591
  3. package/dist/index.native.js.map +1 -1
  4. package/dist/index.web.js +4387 -1725
  5. package/dist/index.web.js.map +1 -1
  6. package/index.js +22 -0
  7. package/package.json +1 -1
  8. package/packages/dof-board/index.js +1 -0
  9. package/packages/dof-board/index.vue +63 -0
  10. package/packages/dof-card/index.js +1 -1
  11. package/packages/dof-card/index.vue +140 -411
  12. package/packages/dof-card-group/index.js +1 -0
  13. package/packages/dof-card-group/index.vue +18 -0
  14. package/packages/dof-card-item/index.js +1 -0
  15. package/packages/dof-card-item/index.vue +29 -0
  16. package/packages/dof-col/index.js +1 -0
  17. package/packages/dof-col/index.vue +23 -0
  18. package/packages/dof-icon-button/index.js +1 -0
  19. package/packages/dof-icon-button/index.vue +88 -0
  20. package/packages/dof-progress/index.vue +53 -56
  21. package/packages/dof-row/index.js +1 -0
  22. package/packages/dof-row/index.vue +21 -0
  23. package/packages/dof-slider/index.js +1 -0
  24. package/packages/dof-slider/index.vue +256 -0
  25. package/packages/dof-slider-scale/index.js +1 -0
  26. package/packages/dof-slider-scale/index.vue +52 -0
  27. package/packages/dof-step-action/index.js +1 -0
  28. package/packages/dof-step-action/index.vue +113 -0
  29. package/packages/dof-switch/index.vue +45 -7
  30. package/packages/dof-tag/index.js +1 -1
  31. package/packages/dof-tag/index.vue +60 -127
  32. package/packages/dof-tag-group/index.js +1 -0
  33. package/packages/dof-tag-group/index.vue +19 -0
  34. package/packages/dof-taged/index.js +1 -0
  35. package/packages/dof-taged/index.vue +140 -0
  36. package/packages/utils/direction.js +7 -0
  37. package/packages/utils/dom.js +11 -0
  38. package/packages/utils/math-extension.js +3 -0
  39. package/packages/utils/mix-child.js +57 -0
  40. package/packages/utils/mix-parent.js +14 -0
  41. package/packages/utils/mix-selectable-child.js +69 -0
  42. package/packages/utils/mix-selectable-parent.js +29 -0
  43. package/packages/utils/touch.js +76 -0
  44. package/packages/utils/transition.js +130 -0
  45. package/packages/utils/vue-extension.js +32 -0
@@ -0,0 +1,76 @@
1
+ import { Direction } from './direction.js'
2
+
3
+ export class Touch {
4
+ static MIN_DISTANCE = 10
5
+
6
+ static Create() {
7
+ return new Touch()
8
+ }
9
+
10
+ constructor() {
11
+ this.startX = 0
12
+ this.startY = 0
13
+ this.deltaX = 0
14
+ this.deltaY = 0
15
+
16
+ this.direction = Direction.NONE
17
+ }
18
+
19
+ get offsetX() {
20
+ return Math.abs(this.deltaX)
21
+ }
22
+
23
+ get offsetY() {
24
+ return Math.abs(this.deltaY)
25
+ }
26
+
27
+ get isHorizental() {
28
+ return this.direction === Direction.HOR
29
+ }
30
+
31
+ get isVertical() {
32
+ return this.direction === Direction.VER
33
+ }
34
+
35
+ get isUndetermined() {
36
+ return this.direction === Direction.NONE
37
+ }
38
+
39
+ resolveDirection(x, y) {
40
+ if (x > y && x > Touch.MIN_DISTANCE) {
41
+ return Direction.HOR
42
+ }
43
+ if (y > x && y > Touch.MIN_DISTANCE) {
44
+ return Direction.VER
45
+ }
46
+ return Direction.NONE
47
+ }
48
+
49
+ reset() {
50
+ this.startX = 0
51
+ this.startY = 0
52
+ this.deltaX = 0
53
+ this.deltaY = 0
54
+ this.direction = Direction.NONE
55
+ }
56
+
57
+ getTouchByEvent(e) {
58
+ return e.changedTouches[0]
59
+ }
60
+
61
+ start(evt) {
62
+ const e = this.getTouchByEvent(evt)
63
+ this.reset()
64
+ this.startX = e.screenX
65
+ this.startY = e.screenY
66
+ }
67
+
68
+ move(evt) {
69
+ const e = this.getTouchByEvent(evt)
70
+ this.deltaX = e.screenX - this.startX
71
+ this.deltaY = e.screenY - this.startY
72
+ if (this.isUndetermined) {
73
+ this.direction = this.resolveDirection(this.offsetX, this.offsetY)
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,130 @@
1
+ const animation = weex.requireModule('animation')
2
+
3
+ export class Transition {
4
+ static Create() {
5
+ return new Transition()
6
+ }
7
+
8
+ static Default() {
9
+ return this.Create()
10
+ .duration(360)
11
+ .delay(0)
12
+ .needLayout(false)
13
+ .timing('cubic-bezier(0.25, 0.46, 0.45, 0.94)')
14
+ }
15
+
16
+ constructor() {
17
+ this.options = {}
18
+ this.styles = {}
19
+ this.configureTransform = []
20
+ }
21
+
22
+ width(width) {
23
+ this.styles.width = `${width}px`
24
+ return this
25
+ }
26
+
27
+ height(height) {
28
+ this.styles.height = `${height}px`
29
+ return this
30
+ }
31
+
32
+ backgroundColor(color) {
33
+ this.styles.backgroundColor = color
34
+ return this
35
+ }
36
+
37
+ opacity(opacity) {
38
+ this.styles.opacity = opacity
39
+ return this
40
+ }
41
+
42
+ translate(x, y, z) {
43
+ this.configureTransform.push(`translate(${x},${y},${z})`)
44
+ return this
45
+ }
46
+
47
+ translateX(x) {
48
+ this.configureTransform.push(`translateX(${x})`)
49
+ return this
50
+ }
51
+
52
+ translateY(y) {
53
+ this.configureTransform.push(`translateY(${y})`)
54
+ return this
55
+ }
56
+
57
+ rotate(x, y, z) {
58
+ this.configureTransform.push(`rotate(${x}deg,${y}deg,${z}deg)`)
59
+ return this
60
+ }
61
+
62
+ rotateX(x) {
63
+ this.configureTransform.push(`rotateX(${x}deg)`)
64
+ return this
65
+ }
66
+
67
+ rotateY(y) {
68
+ this.configureTransform.push(`rotateY(${y}deg)`)
69
+ return this
70
+ }
71
+
72
+ rotateZ(z) {
73
+ this.configureTransform.push(`rotateZ(${z}deg)`)
74
+ return this
75
+ }
76
+
77
+ perspective(pers) {
78
+ this.configureTransform.push(`perspective(${pers})`)
79
+ return this
80
+ }
81
+
82
+ scale(x, y, z) {
83
+ this.configureTransform.push(`scale(${x},${y},${z})`)
84
+ return this
85
+ }
86
+
87
+ scaleX(x) {
88
+ this.configureTransform.push(`scaleX(${x})`)
89
+ return this
90
+ }
91
+
92
+ scaleY(y) {
93
+ this.configureTransform.push(`scaleY(${y})`)
94
+ return this
95
+ }
96
+
97
+ transformOrigin(origin) {
98
+ this.styles.transformOrigin = origin
99
+ return this
100
+ }
101
+
102
+ duration(duration) {
103
+ this.options.duration = duration
104
+ return this
105
+ }
106
+
107
+ delay(delay) {
108
+ this.options.delay = delay
109
+ return this
110
+ }
111
+
112
+ needLayout(layout) {
113
+ this.options.needLayout = layout
114
+ return this
115
+ }
116
+
117
+ timing(timing) {
118
+ this.options.timingFunction = timing
119
+ return this
120
+ }
121
+
122
+ run(element, func) {
123
+ const styles = { ...this.styles }
124
+ if (this.configureTransform.length) {
125
+ styles.transform = this.configureTransform.join(' ')
126
+ }
127
+ const opts = Object.assign({}, this.options, { styles })
128
+ animation.transition(element, opts, func)
129
+ }
130
+ }
@@ -0,0 +1,32 @@
1
+ export function traverseVNode(vnodes) {
2
+ const res = []
3
+ for (const vnode of vnodes) {
4
+ res.push(vnode)
5
+
6
+ if (vnode.componentInstance) {
7
+ res.push(...traverseVNode(vnode.componentInstance.$children.map(x => x.$vnode)))
8
+ }
9
+
10
+ if (vnode.children) {
11
+ res.push(...traverseVNode(vnode.children))
12
+ }
13
+ }
14
+ return res
15
+ }
16
+
17
+ export function flattenVNode(vnodes) {
18
+ return traverseVNode(vnodes)
19
+ }
20
+
21
+ export function sortComponent(children, parent) {
22
+ const { componentOptions } = parent.$vnode
23
+
24
+ if (!componentOptions || !componentOptions.children || !componentOptions.children.length) {
25
+ return
26
+ }
27
+
28
+ const vnodes = flattenVNode(componentOptions.children)
29
+ children.sort((a, b) => vnodes.indexOf(a.$vode) - vnodes.indexOf(b.$vode))
30
+
31
+ return children
32
+ }