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.
Files changed (48) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/index.native.js +3802 -1588
  3. package/dist/index.native.js.map +1 -1
  4. package/dist/index.web.js +4388 -1726
  5. package/dist/index.web.js.map +1 -1
  6. package/index.js +24 -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 +138 -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 +24 -0
  16. package/packages/dof-col/index.js +1 -0
  17. package/packages/dof-col/index.vue +34 -0
  18. package/packages/dof-gear/index.js +1 -0
  19. package/packages/dof-gear/index.vue +206 -0
  20. package/packages/dof-gear/range.js +26 -0
  21. package/packages/dof-icon-button/index.js +1 -0
  22. package/packages/dof-icon-button/index.vue +88 -0
  23. package/packages/dof-progress/index.vue +53 -56
  24. package/packages/dof-row/index.js +1 -0
  25. package/packages/dof-row/index.vue +21 -0
  26. package/packages/dof-slider/index.js +1 -0
  27. package/packages/dof-slider/index.vue +251 -0
  28. package/packages/dof-slider-scale/index.js +1 -0
  29. package/packages/dof-slider-scale/index.vue +52 -0
  30. package/packages/dof-step-action/index.js +1 -0
  31. package/packages/dof-step-action/index.vue +113 -0
  32. package/packages/dof-switch/index.vue +45 -7
  33. package/packages/dof-tag/index.js +1 -1
  34. package/packages/dof-tag/index.vue +56 -127
  35. package/packages/dof-tag-group/index.js +1 -0
  36. package/packages/dof-tag-group/index.vue +19 -0
  37. package/packages/dof-taged/index.js +1 -0
  38. package/packages/dof-taged/index.vue +140 -0
  39. package/packages/utils/direction.js +7 -0
  40. package/packages/utils/dom.js +11 -0
  41. package/packages/utils/math-extension.js +3 -0
  42. package/packages/utils/mix-child.js +57 -0
  43. package/packages/utils/mix-parent.js +14 -0
  44. package/packages/utils/mix-selectable-child.js +69 -0
  45. package/packages/utils/mix-selectable-parent.js +29 -0
  46. package/packages/utils/touch.js +76 -0
  47. package/packages/utils/transition.js +130 -0
  48. package/packages/utils/vue-extension.js +32 -0
@@ -0,0 +1 @@
1
+ export { default } from './index.vue'
@@ -0,0 +1,206 @@
1
+ <template>
2
+ <div class="dof-gear" ref="root">
3
+ <template v-for="(v, i) in ranges">
4
+ <div :key="i" class="dof-gear-item" @click="() => onClick(v)">
5
+ <div v-if="!readonly" class="dof-gear-item-anchor">
6
+ <div class="dof-gear-item-anchor-angle" :style="getAngleStyle(v)"></div>
7
+ </div>
8
+ <div class="dof-gear-item-track" :style="trackStyle">
9
+ <div class="dof-gear-item-bar" :style="getBarStyle(v)"></div>
10
+ </div>
11
+ <text v-if="v.gear" class="dof-gear-item-gear" :style="gearStyle">{{ v.gear }}</text>
12
+ </div>
13
+ <div v-if="!isLast(i)" class="dof-gear-gap" :key="`gap-${i}`"></div>
14
+ </template>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ import { Range } from './range.js'
20
+ export default {
21
+ props: {
22
+ barWidth: {
23
+ type: Number,
24
+ default: 16
25
+ },
26
+ height: {
27
+ type: Number,
28
+ default: 96
29
+ },
30
+ color: {
31
+ type: String,
32
+ default: '#F2F2F2'
33
+ },
34
+ fullColor: {
35
+ type: String,
36
+ default: '#1A4FB6'
37
+ },
38
+ setColor: {
39
+ type: String,
40
+ default: '#FF3B30'
41
+ },
42
+ ranges: {
43
+ type: Array,
44
+ default: () => Range.Default
45
+ },
46
+ value: {
47
+ type: Number,
48
+ default: 0
49
+ },
50
+ gear: {
51
+ type: Number,
52
+ default: 1
53
+ },
54
+ readonly: {
55
+ type: Boolean,
56
+ default: true
57
+ },
58
+ grow: {
59
+ type: Number,
60
+ default: 42
61
+ }
62
+ },
63
+ model: {
64
+ prop: 'gear',
65
+ event: 'change'
66
+ },
67
+ data() {
68
+ return {
69
+ width: 0
70
+ }
71
+ },
72
+ computed: {
73
+ gearRanges() {
74
+ return this.ranges.filter(x => x.gear)
75
+ },
76
+ minGearRange() {
77
+ return this.gearRanges[0]
78
+ },
79
+ maxGearRange() {
80
+ return this.gearRanges[this.gearRanges.length - 1]
81
+ },
82
+ gearRange() {
83
+ return this.gearRanges.find(x => x.gear === this.gear)
84
+ },
85
+ trackStyle() {
86
+ const style = {
87
+ width: `${this.barWidth}px`,
88
+ height: `${this.height}px`,
89
+ borderRadius: `${this.barWidth / 2}px`
90
+ }
91
+ if (!this.readonly) {
92
+ style.height = `${this.height + this.grow}px`
93
+ }
94
+ return style
95
+ },
96
+ gearStyle() {
97
+ const style = {
98
+ color: this.fullColor
99
+ }
100
+ return style
101
+ }
102
+ },
103
+ methods: {
104
+ isLast(index) {
105
+ return index >= this.ranges.length - 1
106
+ },
107
+ isSet(range) {
108
+ return range.gear == this.gearRange.gear
109
+ },
110
+ isPreserve(range) {
111
+ return range.min >= this.gearRange.max
112
+ },
113
+ isWaiting(range) {
114
+ return range.min > this.value && range.max <= this.gearRange.min
115
+ },
116
+ isFull(range) {
117
+ return range.min <= this.value
118
+ },
119
+ getBarStyle(range) {
120
+ const style = {
121
+ width: `${this.barWidth}px`,
122
+ height: `${this.height}px`,
123
+ borderRadius: `${this.barWidth / 2}px`,
124
+ opacity: 1
125
+ }
126
+ if (!this.readonly && this.isSet(range)) {
127
+ style.height = `${this.height + this.grow}px`
128
+ }
129
+ if (this.isFull(range)) {
130
+ style.backgroundColor = this.fullColor
131
+ }
132
+ if (this.isWaiting(range)) {
133
+ style.backgroundColor = this.fullColor
134
+ style.opacity = 0.3
135
+ }
136
+ if (!this.isFull(range) && this.isSet(range)) {
137
+ style.backgroundColor = this.setColor
138
+ this.readonly && (style.opacity = 0.3)
139
+ }
140
+ if (this.isPreserve(range)) {
141
+ style.backgroundColor = this.color
142
+ }
143
+ return style
144
+ },
145
+ getAngleStyle(range) {
146
+ const style = {}
147
+ if (this.isSet(range)) {
148
+ style.backgroundColor = this.setColor
149
+ }
150
+ return style
151
+ },
152
+ onClick(range) {
153
+ if (this.readonly || !range.gear || range.min <= this.value) {
154
+ return
155
+ }
156
+ this.triggerChange(range.gear)
157
+ },
158
+ triggerChange(gear) {
159
+ this.$emit('change', gear)
160
+ }
161
+ }
162
+ }
163
+ </script>
164
+
165
+ <style scoped>
166
+ .dof-gear {
167
+ flex-direction: row;
168
+ align-items: flex-start;
169
+ }
170
+ .dof-gear-gap {
171
+ flex: 1;
172
+ height: 1px;
173
+ }
174
+ .dof-gear-item {
175
+ flex-direction: column;
176
+ align-items: center;
177
+ }
178
+ .dof-gear-item-anchor {
179
+ position: relative;
180
+ width: 40px;
181
+ height: 20px;
182
+ overflow: hidden;
183
+ }
184
+ .dof-gear-item-anchor-angle {
185
+ left: 0px;
186
+ top: -28.284271247px;
187
+ width: 40px;
188
+ height: 40px;
189
+ transform-origin: center;
190
+ transform: rotateZ(45deg);
191
+ }
192
+ .dof-gear-item-track {
193
+ position: relative;
194
+ }
195
+ .dof-gear-item-bar {
196
+ position: absolute;
197
+ bottom: 0;
198
+ }
199
+ .dof-gear-item-gear {
200
+ margin-top: 16px;
201
+ font-size: 24px;
202
+ font-family: Helvetica;
203
+ max-lines: 1;
204
+ text-overflow: ellipsis;
205
+ }
206
+ </style>
@@ -0,0 +1,26 @@
1
+ export class Range {
2
+ static Default = [
3
+ new Range(0, 7),
4
+ new Range(7, 14),
5
+ new Range(14, 21),
6
+ new Range(21, 28),
7
+ new Range(28, 35),
8
+ new Range(35, 42),
9
+ new Range(42, 50, 1),
10
+ new Range(50, 55),
11
+ new Range(55, 60),
12
+ new Range(60, 65, 2),
13
+ new Range(65, 70),
14
+ new Range(70, 75),
15
+ new Range(75, 82, 3),
16
+ new Range(82, 88),
17
+ new Range(88, 94),
18
+ new Range(94, 100, 4)
19
+ ]
20
+
21
+ constructor(min = 0, max = 100, gear = 0) {
22
+ this.min = min
23
+ this.max = max
24
+ this.gear = gear
25
+ }
26
+ }
@@ -0,0 +1 @@
1
+ export { default } from './index.vue'
@@ -0,0 +1,88 @@
1
+ <template>
2
+ <div class="dof-icon-button" @click="onClick">
3
+ <image :class="['dof-icon-button-img', round && 'dof-icon-button-img--round']" :src="src" :style="style"></image>
4
+ <slot>
5
+ <text v-if="text" class="dof-icon-button-text">{{ text }}</text>
6
+ </slot>
7
+ </div>
8
+ </template>
9
+
10
+ <script>
11
+ export default {
12
+ props: {
13
+ active: {
14
+ type: Boolean,
15
+ default: false
16
+ },
17
+ img: {
18
+ type: String,
19
+ required: true
20
+ },
21
+ color: {
22
+ type: String,
23
+ default: '#f2f2f2'
24
+ },
25
+ activeImg: {
26
+ type: String,
27
+ default: ''
28
+ },
29
+ activeColor: {
30
+ type: String,
31
+ default: '#267AFF'
32
+ },
33
+ round: {
34
+ type: Boolean,
35
+ default: true
36
+ },
37
+ text: {
38
+ type: String,
39
+ default: ''
40
+ }
41
+ },
42
+ model: {
43
+ prop: 'active',
44
+ event: 'change'
45
+ },
46
+ computed: {
47
+ src() {
48
+ const res = this.active ? this.activeImg : this.img
49
+ return res || this.img
50
+ },
51
+ style() {
52
+ const res = {
53
+ backgroundColor: this.active ? this.activeColor : this.color
54
+ }
55
+ return res
56
+ }
57
+ },
58
+ methods: {
59
+ onClick() {
60
+ this.$emit('change', !this.active)
61
+ }
62
+ }
63
+ }
64
+ </script>
65
+
66
+ <style scoped>
67
+ .dof-icon-button {
68
+ align-items: center;
69
+ }
70
+
71
+ .dof-icon-button-img {
72
+ width: 96px;
73
+ height: 96px;
74
+ }
75
+
76
+ .dof-icon-button-img--round {
77
+ border-radius: 48px;
78
+ }
79
+
80
+ .dof-icon-button-text {
81
+ margin-top: 24px;
82
+ font-family: PingFangSC-Regular;
83
+ font-size: 24px;
84
+ color: #000000;
85
+ text-align: center;
86
+ font-weight: 400;
87
+ }
88
+ </style>
@@ -1,71 +1,68 @@
1
1
  <template>
2
- <div class="dof-progress"
3
- :style="runWayStyle"
4
- :accessible="true"
5
- :aria-label="`进度为百分之${value}`">
2
+ <div class="dof-progress" :style="runWayStyle" :accessible="true" :aria-label="`进度为百分之${value}`">
6
3
  <div class="progress" :style="progressStyle"></div>
7
4
  </div>
8
5
  </template>
9
6
 
10
7
  <style scoped>
11
- .dof-progress {
12
- background-color: #f2f3f4;
13
- }
8
+ .dof-progress {
9
+ background-color: #f2f3f4;
10
+ }
14
11
 
15
- .progress {
16
- position: absolute;
17
- background-color: #29c3ff;
18
- }
12
+ .progress {
13
+ position: absolute;
14
+ background-color: #29c3ff;
15
+ }
19
16
  </style>
20
17
 
21
18
  <script>
22
- export default {
23
- props: {
24
- barColor: {
25
- type: String,
26
- default: '#267aff'
27
- },
28
- barWidth: {
29
- type: Number,
30
- default: 600
31
- },
32
- barHeight: {
33
- type: Number,
34
- default: 8
35
- },
36
- barRadius: {
37
- type: Number,
38
- default: 0
39
- },
40
- value: {
41
- type: Number,
42
- default: 0
43
- },
44
- backgroundColor: {
45
- type: String,
46
- default: '#f2f3f4'
19
+ export default {
20
+ props: {
21
+ barColor: {
22
+ type: String,
23
+ default: '#267aff'
24
+ },
25
+ barWidth: {
26
+ type: Number,
27
+ default: 600
28
+ },
29
+ barHeight: {
30
+ type: Number,
31
+ default: 8
32
+ },
33
+ barRadius: {
34
+ type: Number,
35
+ default: 0
36
+ },
37
+ value: {
38
+ type: Number,
39
+ default: 0
40
+ },
41
+ backgroundColor: {
42
+ type: String,
43
+ default: '#f2f3f4'
44
+ }
45
+ },
46
+ computed: {
47
+ runWayStyle() {
48
+ const { barWidth, barHeight, barRadius, backgroundColor } = this
49
+ return {
50
+ width: barWidth + 'px',
51
+ height: barHeight + 'px',
52
+ borderRadius: barRadius + 'px',
53
+ backgroundColor
47
54
  }
48
55
  },
49
- computed: {
50
- runWayStyle () {
51
- const { barWidth, barHeight, barRadius, backgroundColor } = this;
52
- return {
53
- width: barWidth + 'px',
54
- height: barHeight + 'px',
55
- borderRadius: barRadius + 'px',
56
- backgroundColor
57
- };
58
- },
59
- progressStyle () {
60
- const { value, barWidth, barHeight, barColor, barRadius } = this;
61
- const newValue = value < 0 ? 0 : (value > 100 ? 100 : value);
62
- return {
63
- backgroundColor: barColor,
64
- borderRadius: barRadius + 'px',
65
- height: barHeight + 'px',
66
- width: newValue / 100 * barWidth + 'px'
67
- };
56
+ progressStyle() {
57
+ const { value, barWidth, barHeight, barColor, barRadius } = this
58
+ const newValue = value < 0 ? 0 : value > 100 ? 100 : value
59
+ return {
60
+ backgroundColor: barColor,
61
+ borderRadius: barRadius + 'px',
62
+ height: barHeight + 'px',
63
+ width: (newValue / 100) * barWidth + 'px'
68
64
  }
69
65
  }
70
- };
66
+ }
67
+ }
71
68
  </script>
@@ -0,0 +1 @@
1
+ export { default } from './index.vue'
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <div class="dof-row">
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ import { mixParent } from '../utils/mix-parent.js'
9
+
10
+ export default {
11
+ mixins: [mixParent('dof-row')]
12
+ }
13
+ </script>
14
+
15
+ <style scoped>
16
+ .dof-row {
17
+ flex-direction: row;
18
+ flex-wrap: nowrap;
19
+ overflow: hidden;
20
+ }
21
+ </style>
@@ -0,0 +1 @@
1
+ export { default } from './index.vue'