dolphin-weex-ui 0.2.13 → 0.2.17
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/CHANGELOG.md +29 -0
- package/dist/index.native.js +3802 -1588
- package/dist/index.native.js.map +1 -1
- package/dist/index.web.js +4388 -1726
- package/dist/index.web.js.map +1 -1
- package/index.js +24 -0
- package/package.json +1 -1
- package/packages/dof-board/index.js +1 -0
- package/packages/dof-board/index.vue +63 -0
- package/packages/dof-card/index.js +1 -1
- package/packages/dof-card/index.vue +138 -411
- package/packages/dof-card-group/index.js +1 -0
- package/packages/dof-card-group/index.vue +18 -0
- package/packages/dof-card-item/index.js +1 -0
- package/packages/dof-card-item/index.vue +24 -0
- package/packages/dof-col/index.js +1 -0
- package/packages/dof-col/index.vue +34 -0
- package/packages/dof-gear/index.js +1 -0
- package/packages/dof-gear/index.vue +206 -0
- package/packages/dof-gear/range.js +26 -0
- package/packages/dof-icon-button/index.js +1 -0
- package/packages/dof-icon-button/index.vue +88 -0
- package/packages/dof-progress/index.vue +53 -56
- package/packages/dof-row/index.js +1 -0
- package/packages/dof-row/index.vue +21 -0
- package/packages/dof-slider/index.js +1 -0
- package/packages/dof-slider/index.vue +251 -0
- package/packages/dof-slider-scale/index.js +1 -0
- package/packages/dof-slider-scale/index.vue +52 -0
- package/packages/dof-step-action/index.js +1 -0
- package/packages/dof-step-action/index.vue +113 -0
- package/packages/dof-switch/index.vue +45 -7
- package/packages/dof-tag/index.js +1 -1
- package/packages/dof-tag/index.vue +56 -127
- package/packages/dof-tag-group/index.js +1 -0
- package/packages/dof-tag-group/index.vue +19 -0
- package/packages/dof-taged/index.js +1 -0
- package/packages/dof-taged/index.vue +140 -0
- package/packages/utils/direction.js +7 -0
- package/packages/utils/dom.js +11 -0
- package/packages/utils/math-extension.js +3 -0
- package/packages/utils/mix-child.js +57 -0
- package/packages/utils/mix-parent.js +14 -0
- package/packages/utils/mix-selectable-child.js +69 -0
- package/packages/utils/mix-selectable-parent.js +29 -0
- package/packages/utils/touch.js +76 -0
- package/packages/utils/transition.js +130 -0
- package/packages/utils/vue-extension.js +32 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dof-tag-group">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import { mixSelectableParent } from '../utils/mix-selectable-parent.js'
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
mixins: [mixSelectableParent('dof-tag-group')]
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<style scoped>
|
|
16
|
+
.dof-tag-group {
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
}
|
|
19
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './index.vue';
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div v-if="showSolid || showHollow"
|
|
4
|
+
:class="['tag-item','tag-border',showHollow && 'tag-hollow']"
|
|
5
|
+
:style="tagTextStyle">
|
|
6
|
+
<text class="tag-text" :style="{color:fontColor}">{{value}}</text>
|
|
7
|
+
</div>
|
|
8
|
+
<image v-if="showImage"
|
|
9
|
+
:src="img"
|
|
10
|
+
@load="onLoad"
|
|
11
|
+
:aria-hidden="true"
|
|
12
|
+
:style="{ width: imgWidth+'px'}"
|
|
13
|
+
class="tag-image"></image>
|
|
14
|
+
<div class="tag-special tag-border"
|
|
15
|
+
:style="{borderColor:tagColor}"
|
|
16
|
+
:accessible="true"
|
|
17
|
+
:aria-label="value"
|
|
18
|
+
v-if="showSpecial">
|
|
19
|
+
<div class="tag-left" :style="{backgroundColor:tagColor}">
|
|
20
|
+
<image :src="specialIcon" class="left-image"></image>
|
|
21
|
+
</div>
|
|
22
|
+
<text class="tag-text" :style="{color:fontColor}">{{value}}</text>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<style scoped>
|
|
28
|
+
.tag-item {
|
|
29
|
+
height: 24px;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
align-items: center;
|
|
32
|
+
/* hack高度不居中问题,后续版本升级去掉 */
|
|
33
|
+
padding-bottom: 2px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.tag-border {
|
|
37
|
+
border-bottom-left-radius: 4px;
|
|
38
|
+
border-bottom-right-radius: 4px;
|
|
39
|
+
border-top-left-radius: 4px;
|
|
40
|
+
border-top-right-radius: 4px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.tag-hollow {
|
|
44
|
+
border-width: 1px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.tag-image {
|
|
48
|
+
height: 24px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.tag-special {
|
|
52
|
+
border-width: 1px;
|
|
53
|
+
flex-direction: row;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.left-image {
|
|
57
|
+
width: 20px;
|
|
58
|
+
height: 20px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.tag-left {
|
|
62
|
+
width: 24px;
|
|
63
|
+
height: 24px;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.tag-text {
|
|
69
|
+
font-size: 20px;
|
|
70
|
+
height: 22px;
|
|
71
|
+
line-height: 22px;
|
|
72
|
+
padding-left: 6px;
|
|
73
|
+
padding-right: 6px;
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
76
|
+
|
|
77
|
+
<script>
|
|
78
|
+
export default {
|
|
79
|
+
props: {
|
|
80
|
+
type: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: 'solid'
|
|
83
|
+
},
|
|
84
|
+
value: {
|
|
85
|
+
type: [String, Number],
|
|
86
|
+
default: '测试测试'
|
|
87
|
+
},
|
|
88
|
+
tagColor: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: '#ff5000'
|
|
91
|
+
},
|
|
92
|
+
fontColor: {
|
|
93
|
+
type: String,
|
|
94
|
+
default: '#333333'
|
|
95
|
+
},
|
|
96
|
+
specialIcon: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: ''
|
|
99
|
+
},
|
|
100
|
+
img: {
|
|
101
|
+
type: String,
|
|
102
|
+
default: ''
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
computed: {
|
|
106
|
+
showSolid () {
|
|
107
|
+
const { type, value } = this;
|
|
108
|
+
return type === 'solid' && value !== '';
|
|
109
|
+
},
|
|
110
|
+
showHollow () {
|
|
111
|
+
const { type, value } = this;
|
|
112
|
+
return type === 'hollow' && value !== '';
|
|
113
|
+
},
|
|
114
|
+
showSpecial () {
|
|
115
|
+
const { type, value, specialIcon } = this;
|
|
116
|
+
return type === 'special' && value !== '' && specialIcon !== '';
|
|
117
|
+
},
|
|
118
|
+
showImage () {
|
|
119
|
+
const { type, img } = this;
|
|
120
|
+
return type === 'image' && img !== '';
|
|
121
|
+
},
|
|
122
|
+
tagTextStyle () {
|
|
123
|
+
const { tagColor, showSolid } = this;
|
|
124
|
+
return showSolid ? { backgroundColor: tagColor } : { borderColor: tagColor };
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
data: () => ({
|
|
128
|
+
imgWidth: 90
|
|
129
|
+
}),
|
|
130
|
+
methods: {
|
|
131
|
+
onLoad (e) {
|
|
132
|
+
if (e.success && e.size && e.size.naturalWidth > 0) {
|
|
133
|
+
const width = e.size.naturalWidth;
|
|
134
|
+
const height = e.size.naturalHeight;
|
|
135
|
+
this.imgWidth = width * (24 / height);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const dom = weex.requireModule('dom')
|
|
2
|
+
|
|
3
|
+
export function getBoundingClientRect(element, func) {
|
|
4
|
+
setTimeout(() => dom.getComponentRect(element, func), 0)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function getBoundingClientRectAsync(element) {
|
|
8
|
+
return new Promise(resolve => {
|
|
9
|
+
setTimeout(() => dom.getComponentRect(element, res => res.result && resolve(res.size)), 0)
|
|
10
|
+
})
|
|
11
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { sortComponent } from './vue-extension.js'
|
|
2
|
+
|
|
3
|
+
export function mixChild(key, options = {}) {
|
|
4
|
+
const indexKey = options.indexKey || 'index'
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
inject: {
|
|
8
|
+
[key]: {
|
|
9
|
+
default: null
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
computed: {
|
|
13
|
+
parent() {
|
|
14
|
+
if (this.disableBindingRelation) {
|
|
15
|
+
return null
|
|
16
|
+
}
|
|
17
|
+
return this[key]
|
|
18
|
+
},
|
|
19
|
+
[indexKey]() {
|
|
20
|
+
this.bindRelation()
|
|
21
|
+
if (this.parent) {
|
|
22
|
+
return this.parent.children.indexOf(this)
|
|
23
|
+
}
|
|
24
|
+
return null
|
|
25
|
+
},
|
|
26
|
+
isLast() {
|
|
27
|
+
if (this.parent) {
|
|
28
|
+
return this[indexKey] === this.parent.children.length - 1
|
|
29
|
+
}
|
|
30
|
+
return false
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
watch: {
|
|
34
|
+
disableBindingRelation(val) {
|
|
35
|
+
if (!val) {
|
|
36
|
+
this.bindRelation()
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
mounted() {
|
|
41
|
+
this.bindRelation()
|
|
42
|
+
},
|
|
43
|
+
beforeDestroy() {
|
|
44
|
+
if (this.parent) {
|
|
45
|
+
this.parent.children = this.parent.children.filter(x => x !== this)
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
methods: {
|
|
49
|
+
bindRelation() {
|
|
50
|
+
if (!this.parent || this.parent.children.indexOf(this) !== -1) {
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
this.parent.children = sortComponent([...this.parent.children, this], this.parent)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { sortComponent } from './vue-extension.js'
|
|
2
|
+
|
|
3
|
+
export function mixSelectableChild(key, options = {}) {
|
|
4
|
+
const indexKey = options.indexKey || 'index'
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
inject: {
|
|
8
|
+
[key]: {
|
|
9
|
+
default: null
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
props: {
|
|
13
|
+
value: {
|
|
14
|
+
type: [String, Number],
|
|
15
|
+
default: ''
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
computed: {
|
|
19
|
+
parent() {
|
|
20
|
+
if (this.disableBindingRelation) {
|
|
21
|
+
return null
|
|
22
|
+
}
|
|
23
|
+
return this[key]
|
|
24
|
+
},
|
|
25
|
+
[indexKey]() {
|
|
26
|
+
this.bindRelation()
|
|
27
|
+
if (this.parent) {
|
|
28
|
+
return this.parent.children.indexOf(this)
|
|
29
|
+
}
|
|
30
|
+
return null
|
|
31
|
+
},
|
|
32
|
+
isLast() {
|
|
33
|
+
if (this.parent) {
|
|
34
|
+
return this[indexKey] === this.parent.children.length - 1
|
|
35
|
+
}
|
|
36
|
+
return false
|
|
37
|
+
},
|
|
38
|
+
isSelected() {
|
|
39
|
+
if (!this.parent) {
|
|
40
|
+
return false
|
|
41
|
+
}
|
|
42
|
+
return this.value == this.parent.value
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
watch: {
|
|
46
|
+
disableBindingRelation(val) {
|
|
47
|
+
if (!val) {
|
|
48
|
+
this.bindRelation()
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
mounted() {
|
|
53
|
+
this.bindRelation()
|
|
54
|
+
},
|
|
55
|
+
beforeDestroy() {
|
|
56
|
+
if (this.parent) {
|
|
57
|
+
this.parent.children = this.parent.children.filter(x => x !== this)
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
methods: {
|
|
61
|
+
bindRelation() {
|
|
62
|
+
if (!this.parent || this.parent.children.indexOf(this) !== -1) {
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
this.parent.children = sortComponent([...this.parent.children, this], this.parent)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function mixSelectableParent(key) {
|
|
2
|
+
return {
|
|
3
|
+
provide() {
|
|
4
|
+
return {
|
|
5
|
+
[key]: this
|
|
6
|
+
}
|
|
7
|
+
},
|
|
8
|
+
props: {
|
|
9
|
+
value: {
|
|
10
|
+
type: [String, Number],
|
|
11
|
+
required: true
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
model: {
|
|
15
|
+
prop: 'value',
|
|
16
|
+
event: 'change'
|
|
17
|
+
},
|
|
18
|
+
data() {
|
|
19
|
+
return {
|
|
20
|
+
children: []
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
methods: {
|
|
24
|
+
triggerChange(value) {
|
|
25
|
+
this.$emit('change', value)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -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
|
+
}
|