@mixd-id/web-scaffold 0.1.230406038 → 0.1.230406040

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406038",
4
+ "version": "0.1.230406040",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -6,6 +6,7 @@
6
6
  <div></div>
7
7
  <div></div>
8
8
  </div>
9
+ <div v-if="display >= 4" class="mr-2" :style="labelStyle">hari</div>
9
10
 
10
11
  <slot v-if="display >= 3 && $slots.hour" name="hour" :hour="hour"></slot>
11
12
  <div ref="hour" v-else-if="display >= 3" :class="$style.lap">
@@ -13,7 +14,7 @@
13
14
  <div></div>
14
15
  </div>
15
16
 
16
- <div>:</div>
17
+ <div :style="labelStyle">:</div>
17
18
 
18
19
  <slot v-if="display >= 2 && $slots.minute" name="minute" :minute="minute"></slot>
19
20
  <div ref="minute" v-else-if="display >= 2" :class="$style.lap">
@@ -21,7 +22,7 @@
21
22
  <div></div>
22
23
  </div>
23
24
 
24
- <div>:</div>
25
+ <div :style="labelStyle">:</div>
25
26
 
26
27
  <slot v-if="display >= 1 && $slots.second" name="second" :second="second"></slot>
27
28
  <div ref="second" v-else-if="display >= 1" :class="$style.lap">
@@ -34,8 +35,6 @@
34
35
 
35
36
  <script>
36
37
 
37
- import debounce from "lodash/debounce";
38
-
39
38
  export default{
40
39
 
41
40
  props: {
@@ -45,7 +44,9 @@ export default{
45
44
  default: 3
46
45
  },
47
46
 
48
- value: [ String, Number ] // value in second
47
+ value: [ String, Number ], // value in second,
48
+
49
+ labelStyle: Object
49
50
 
50
51
  },
51
52
 
@@ -75,13 +76,13 @@ export default{
75
76
  timeoutId: null,
76
77
  beforeSecond: null,
77
78
  afterSecond: null,
78
- tick: false
79
+ tick: false,
80
+ state: [ 0, 0, 0, 0 ]
79
81
  }
80
82
  },
81
83
 
82
84
  mounted() {
83
85
  this.start()
84
-
85
86
  if(this.$refs.second) this.$refs.second.addEventListener('transitionend', this.onSecondEnd)
86
87
  if(this.$refs.minute) this.$refs.minute.addEventListener('transitionend', this.onMinuteEnd)
87
88
  if(this.$refs.hour) this.$refs.hour.addEventListener('transitionend', this.onHourEnd)
@@ -90,32 +91,40 @@ export default{
90
91
 
91
92
  methods: {
92
93
 
93
- onSecondEnd: debounce(function (e){
94
+ onDayEnd:function (e){
95
+ if(this.state[0] !== 1) return
96
+ this.$refs.day.insertBefore(this.$refs.day.childNodes[1], this.$refs.day.childNodes[0])
97
+ this.$refs.day.classList.remove(this.$style.tick)
98
+ this.$refs.day.childNodes[0].innerHTML = ''
99
+ this.state[0] = 0
100
+ },
101
+
102
+ onHourEnd: function (e){
103
+ if(this.state[1] !== 1) return
104
+ this.$refs.hour.insertBefore(this.$refs.hour.childNodes[1], this.$refs.hour.childNodes[0])
105
+ this.$refs.hour.classList.remove(this.$style.tick)
106
+ this.$refs.hour.childNodes[0].innerHTML = ''
107
+ this.state[1] = 0
108
+ },
109
+
110
+ onMinuteEnd: function (e){
111
+ if(this.state[2] !== 1) return
112
+ this.$refs.minute.insertBefore(this.$refs.minute.childNodes[1], this.$refs.minute.childNodes[0])
113
+ this.$refs.minute.classList.remove(this.$style.tick)
114
+ this.$refs.minute.childNodes[0].innerHTML = ''
115
+ this.state[2] = 0
116
+ },
117
+
118
+ onSecondEnd: function (e){
119
+ if(this.state[3] !== 1) return
94
120
  this.$refs.second.insertBefore(this.$refs.second.childNodes[1], this.$refs.second.childNodes[0])
95
121
  this.$refs.second.classList.remove(this.$style.tick)
96
122
  this.$refs.second.childNodes[0].innerHTML = ''
97
- }, 100),
98
-
99
- onMinuteEnd: debounce(function (e){
100
- this.$refs.minute.insertBefore(this.$refs.minute.childNodes[1], this.$refs.minute.childNodes[0])
101
- this.$refs.minute.classList.remove(this.$style.tick)
102
- this.$refs.minute.childNodes[0].innerHTML = ''
103
- }, 100),
104
-
105
- onHourEnd: debounce(function (e){
106
- this.$refs.hour.insertBefore(this.$refs.hour.childNodes[1], this.$refs.hour.childNodes[0])
107
- this.$refs.hour.classList.remove(this.$style.tick)
108
- this.$refs.hour.childNodes[0].innerHTML = ''
109
- }, 100),
110
-
111
- onDayEnd: debounce(function (e){
112
- this.$refs.day.insertBefore(this.$refs.day.childNodes[1], this.$refs.day.childNodes[0])
113
- this.$refs.day.classList.remove(this.$style.tick)
114
- this.$refs.day.childNodes[0].innerHTML = ''
115
- }, 100),
123
+ this.state[3] = 0
124
+ },
116
125
 
117
126
  setInitial(){
118
- if(this.$refs.day) this.$refs.day.lastElementChild.innerHTML = '1 hari'
127
+ if(this.$refs.day) this.$refs.day.lastElementChild.innerHTML = '1'
119
128
  if(this.$refs.hour) this.$refs.hour.lastElementChild.innerHTML = (Math.floor(this.timer / 3600) % 24).toString().padStart(2, '0')
120
129
  if(this.$refs.minute) this.$refs.minute.lastElementChild.innerHTML = (Math.floor(this.timer / 60) % 60).toString().padStart(2, '0')
121
130
  if(this.$refs.second) this.$refs.second.lastElementChild.innerHTML = (this.timer % 60).toString().padStart(2, '0')
@@ -141,7 +150,7 @@ export default{
141
150
 
142
151
  watch: {
143
152
 
144
- value(to){
153
+ value(){
145
154
  this.start()
146
155
  },
147
156
 
@@ -150,6 +159,7 @@ export default{
150
159
  this.$refs.day.firstElementChild.innerHTML = to > 0 ? to + ' hari' : ''
151
160
  this.$refs.day.lastElementChild.innerHTML = from + ' hari'
152
161
  this.$refs.day.classList.add(this.$style.tick)
162
+ this.state[0] = 1
153
163
  },
154
164
 
155
165
  hour(to, from){
@@ -157,6 +167,7 @@ export default{
157
167
  this.$refs.hour.firstElementChild.innerHTML = to
158
168
  this.$refs.hour.lastElementChild.innerHTML = from
159
169
  this.$refs.hour.classList.add(this.$style.tick)
170
+ this.state[1] = 1
160
171
  },
161
172
 
162
173
  minute(to, from){
@@ -164,6 +175,7 @@ export default{
164
175
  this.$refs.minute.firstElementChild.innerHTML = to
165
176
  this.$refs.minute.lastElementChild.innerHTML = from
166
177
  this.$refs.minute.classList.add(this.$style.tick)
178
+ this.state[2] = 1
167
179
  },
168
180
 
169
181
  second(to, from){
@@ -171,6 +183,7 @@ export default{
171
183
  this.$refs.second.firstElementChild.innerHTML = to
172
184
  this.$refs.second.lastElementChild.innerHTML = from
173
185
  this.$refs.second.classList.add(this.$style.tick)
186
+ this.state[3] = 1
174
187
  }
175
188
  }
176
189
 
@@ -210,4 +223,4 @@ export default{
210
223
  transform: translate3d(0, 1.3rem, 0);
211
224
  }
212
225
 
213
- </style>
226
+ </style>