renusify 2.5.2 → 3.0.1

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 (212) hide show
  1. package/components/app/index.vue +74 -22
  2. package/components/app/toast/index.vue +76 -71
  3. package/components/app/toast/toast.vue +62 -44
  4. package/components/avatar/index.vue +207 -84
  5. package/components/button/buttonConfirm.vue +53 -26
  6. package/components/button/buttonGroup.js +0 -2
  7. package/components/button/buttonGroup.vue +310 -62
  8. package/components/button/index.vue +584 -100
  9. package/components/calendar/index.js +0 -2
  10. package/components/calendar/index.vue +326 -262
  11. package/components/calendar/month.vue +64 -55
  12. package/components/calendar/year.vue +30 -25
  13. package/components/card/index.vue +139 -59
  14. package/components/codeEditor/highlightCss.vue +38 -39
  15. package/components/codeEditor/highlightHtml.vue +64 -64
  16. package/components/codeEditor/highlightJs.vue +37 -38
  17. package/components/codeEditor/index.vue +129 -79
  18. package/components/codeEditor/run.vue +225 -39
  19. package/components/codeEditor/useCodeFormatter.js +150 -0
  20. package/components/confirm/index.vue +139 -80
  21. package/components/container/col.vue +5 -4
  22. package/components/container/divider.vue +28 -19
  23. package/components/container/index.vue +34 -15
  24. package/components/container/row.vue +26 -9
  25. package/components/container/spacer.vue +2 -4
  26. package/components/container/style.scss +3 -0
  27. package/components/content/index.vue +49 -32
  28. package/components/cropper/index.vue +401 -244
  29. package/components/float/index.vue +542 -415
  30. package/components/form/addressInput/index.vue +184 -109
  31. package/components/form/camInput/index.vue +370 -244
  32. package/components/form/checkInput/index.vue +138 -71
  33. package/components/form/checkboxInput/index.vue +93 -49
  34. package/components/form/colorInput/Alpha.vue +81 -83
  35. package/components/form/colorInput/Hue.vue +91 -68
  36. package/components/form/colorInput/Preview.vue +43 -47
  37. package/components/form/colorInput/Saturation.vue +101 -86
  38. package/components/form/colorInput/index.vue +71 -39
  39. package/components/form/colorInput/picker.vue +111 -106
  40. package/components/form/colorInput/useColor.js +153 -0
  41. package/components/form/dateInput/index.vue +691 -356
  42. package/components/form/dateInput/month.vue +63 -54
  43. package/components/form/dateInput/year.vue +35 -25
  44. package/components/form/fileInput/index.js +0 -1
  45. package/components/form/fileInput/index.vue +263 -106
  46. package/components/form/fileInput/single.vue +332 -168
  47. package/components/form/groupInput/index.vue +199 -101
  48. package/components/form/index.vue +189 -83
  49. package/components/form/input/index.vue +416 -377
  50. package/components/form/jsonInput/JsonView.vue +54 -56
  51. package/components/form/jsonInput/index.vue +247 -165
  52. package/components/form/maskInput/index.vue +252 -132
  53. package/components/form/numberInput/index.js +0 -1
  54. package/components/form/numberInput/index.vue +226 -117
  55. package/components/form/passwordInput/index.js +2 -1
  56. package/components/form/passwordInput/index.vue +269 -102
  57. package/components/form/radioInput/index.vue +143 -72
  58. package/components/form/rangeInput/index.vue +280 -167
  59. package/components/form/ratingInput/index.vue +57 -57
  60. package/components/form/selectInput/index.js +1 -3
  61. package/components/form/selectInput/index.vue +584 -296
  62. package/components/form/switchInput/index.vue +73 -59
  63. package/components/form/telInput/index.js +0 -1
  64. package/components/form/telInput/index.vue +238 -135
  65. package/components/form/textArea/index.vue +72 -35
  66. package/components/form/textEditor/index.vue +739 -0
  67. package/components/form/{text-editor → textEditor}/style.scss +8 -16
  68. package/components/form/textInput/index.vue +54 -32
  69. package/components/form/timeInput/index.vue +82 -55
  70. package/components/form/timeInput/range.vue +115 -94
  71. package/components/form/timeInput/timepicker.vue +382 -449
  72. package/components/form/uniqueInput/index.vue +105 -48
  73. package/components/form/unitInput/index.vue +139 -84
  74. package/components/formCreator/index.js +0 -1
  75. package/components/formCreator/index.vue +314 -148
  76. package/components/highlight/index.vue +41 -25
  77. package/components/highlight/style.scss +2 -2
  78. package/components/highlight/{mixin.js → useHighlight.js} +181 -160
  79. package/components/icon/index.vue +79 -33
  80. package/components/img/index.vue +250 -147
  81. package/components/img/preview.vue +180 -198
  82. package/components/img/svgImg.vue +42 -39
  83. package/components/index.js +5 -20
  84. package/components/infinite/index.js +3 -3
  85. package/components/infinite/index.vue +290 -66
  86. package/components/map/index.vue +428 -261
  87. package/components/map/route.vue +794 -487
  88. package/components/map/select.vue +118 -58
  89. package/components/menu/index.vue +206 -94
  90. package/components/meta/meta.js +26 -3
  91. package/components/modal/index.vue +382 -156
  92. package/components/notify/index.vue +204 -86
  93. package/components/notify/notification.vue +38 -55
  94. package/components/progress/circle.vue +189 -70
  95. package/components/progress/line.vue +266 -46
  96. package/components/searchBox/index.js +1 -3
  97. package/components/searchBox/index.vue +194 -101
  98. package/components/skeleton/index.vue +45 -20
  99. package/components/slider/index.vue +319 -156
  100. package/components/swiper/index.vue +237 -108
  101. package/components/table/crud/footer.vue +77 -53
  102. package/components/table/crud/header.vue +71 -72
  103. package/components/table/crud/index.vue +629 -399
  104. package/components/table/index.vue +721 -278
  105. package/components/timeAgo/index.vue +145 -96
  106. package/components/tour/index.vue +338 -235
  107. package/components/tree/index.vue +235 -89
  108. package/components/tree/tree-element.vue +106 -106
  109. package/directive/animate/index.js +77 -0
  110. package/directive/clickOutSide/index.js +98 -0
  111. package/directive/drag/index.js +153 -0
  112. package/directive/index.js +11 -13
  113. package/directive/intersect/index.js +263 -0
  114. package/directive/mask/index.js +67 -0
  115. package/directive/parallax/index.js +78 -0
  116. package/directive/ripple/index.js +14 -0
  117. package/directive/scroll/index.js +272 -24
  118. package/directive/sortable/index.js +274 -0
  119. package/directive/title/index.js +75 -0
  120. package/directive/touch/index.js +268 -0
  121. package/index.js +11 -19
  122. package/package.json +5 -2
  123. package/plugins/validation/Validate.js +88 -79
  124. package/scripts/generate-docs.mjs +226 -0
  125. package/scripts/menu.mjs +240 -0
  126. package/scripts/parser.mjs +1086 -0
  127. package/style/_index.scss +7 -0
  128. package/style/app.scss +13 -65
  129. package/style/colors.scss +5 -22
  130. package/style/functions/index.scss +8 -0
  131. package/style/mixins/index.scss +17 -5
  132. package/style/variables/base.scss +155 -178
  133. package/style/variables/color.scss +0 -12
  134. package/style/variables/utilities.scss +0 -180
  135. package/tools/helper.js +0 -8
  136. package/tools/icons.js +7 -2
  137. package/tools/root.js +71 -0
  138. package/components/app/style.scss +0 -41
  139. package/components/app/toast/style.scss +0 -20
  140. package/components/avatar/style.scss +0 -32
  141. package/components/bar/bottomNav.js +0 -1
  142. package/components/bar/bottomNav.vue +0 -28
  143. package/components/bar/bottomNavigationCircle.js +0 -2
  144. package/components/bar/bottomNavigationCircle.vue +0 -99
  145. package/components/bar/scss/bottomNav.scss +0 -67
  146. package/components/bar/scss/toolbar.scss +0 -174
  147. package/components/bar/toolbar/index.js +0 -8
  148. package/components/bar/toolbar/index.vue +0 -35
  149. package/components/bar/toolbar/laptop.vue +0 -33
  150. package/components/bar/toolbar/menuChilds.vue +0 -41
  151. package/components/bar/toolbar/menuLaptop.vue +0 -41
  152. package/components/bar/toolbar/menuMob.vue +0 -39
  153. package/components/bar/toolbar/mixin.js +0 -43
  154. package/components/bar/toolbar/mobile.vue +0 -34
  155. package/components/breadcrumb/bredcrumbItem.vue +0 -39
  156. package/components/breadcrumb/index.js +0 -3
  157. package/components/breadcrumb/index.vue +0 -71
  158. package/components/breadcrumb/style.scss +0 -51
  159. package/components/button/style.scss +0 -411
  160. package/components/card/style.scss +0 -86
  161. package/components/chart/chart.js +0 -1
  162. package/components/chart/chart.vue +0 -69
  163. package/components/chart/worldMap.js +0 -2
  164. package/components/chart/worldMap.vue +0 -1112
  165. package/components/chat/MessageList.vue +0 -163
  166. package/components/chat/chatInput.vue +0 -150
  167. package/components/chat/chatMsg.vue +0 -276
  168. package/components/chat/index.js +0 -11
  169. package/components/chat/index.vue +0 -113
  170. package/components/chip/index.js +0 -3
  171. package/components/chip/index.vue +0 -77
  172. package/components/chip/style.scss +0 -199
  173. package/components/codeEditor/mixin.js +0 -145
  174. package/components/countdown/index.js +0 -1
  175. package/components/countdown/index.vue +0 -105
  176. package/components/form/colorInput/mixin.js +0 -132
  177. package/components/form/fileInput/file.js +0 -148
  178. package/components/form/telInput/assets/flags.png +0 -0
  179. package/components/form/telInput/assets/flags@2x.png +0 -0
  180. package/components/form/text-editor/index.vue +0 -705
  181. package/components/icon/style.scss +0 -17
  182. package/components/infinite/div.js +0 -6
  183. package/components/infinite/div.vue +0 -193
  184. package/components/infinite/page.js +0 -3
  185. package/components/infinite/page.vue +0 -105
  186. package/components/list/index.js +0 -3
  187. package/components/list/index.vue +0 -122
  188. package/components/list/style.scss +0 -66
  189. package/components/message/index.js +0 -4
  190. package/components/message/index.vue +0 -40
  191. package/components/modal/style.scss +0 -146
  192. package/components/nestable/NestableItem.vue +0 -307
  193. package/components/nestable/editable.js +0 -44
  194. package/components/nestable/index.js +0 -1
  195. package/components/nestable/index.vue +0 -226
  196. package/components/nestable/methods.js +0 -416
  197. package/components/progress/style.scss +0 -229
  198. package/components/table/style.scss +0 -338
  199. package/components/tabs/index.js +0 -3
  200. package/components/tabs/index.vue +0 -151
  201. package/components/timeline/index.js +0 -6
  202. package/components/timeline/index.vue +0 -76
  203. package/directive/resize/index.js +0 -30
  204. package/directive/skeleton/index.js +0 -27
  205. package/directive/skeleton/style.scss +0 -37
  206. package/plugins/request/Request.js +0 -68
  207. package/style/animation.scss +0 -94
  208. package/style/style.scss +0 -8
  209. package/tools/rootable.js +0 -75
  210. /package/components/form/{text-editor → textEditor}/index.js +0 -0
  211. /package/components/form/{text-editor → textEditor}/preview.js +0 -0
  212. /package/components/form/{text-editor → textEditor}/preview.vue +0 -0
@@ -1,16 +1,16 @@
1
1
  <template>
2
2
  <div :class="`${$r.prefix}timepicker-clock`">
3
3
  <transition mode="out-in" name="scale">
4
- <div :key="show" ref="clock" class="clock ltr">
5
- <div ref="center" class="center"></div>
6
- <div ref="hand" :class="{ 'is-small': isSmall }" class="clock-item-hand hour"></div>
4
+ <div :key="show" ref="clockRef" class="clock ltr">
5
+ <div ref="centerRef" class="center"></div>
6
+ <div ref="handRef" :class="{ 'is-small': isSmall }" class="clock-item-hand hour"></div>
7
7
  <div
8
8
  v-for="(num, i) in nums"
9
9
  :key="i"
10
- ref="number"
10
+ ref="numbersRef"
11
11
  :class="['number' + i,{'number-disabled':disableTime(parseInt(i),show,hour,min,sec)}]"
12
12
  class="number"
13
- @click.prevent="set(i)"
13
+ @click.prevent="selectNumber(i)"
14
14
  >
15
15
  {{ num }}
16
16
  </div>
@@ -19,17 +19,17 @@
19
19
  <div class="text-meridiem ltr" v-if="!is24Hour">
20
20
  <div
21
21
  :class="{ 'meridiem-active': meridiem === 'AM' }"
22
- class="time-meridiem overflow-hidden"
23
- @click.prevent="(meridiem = 'AM'),emit()"
22
+ class="time-meridiem"
23
+ @click.prevent="(meridiem = 'AM'),emitTime()"
24
24
  >
25
- {{ $t('timepicker_am', 'renusify') }}
25
+ AM
26
26
  </div>
27
27
  <div
28
28
  :class="{ 'meridiem-active': meridiem === 'PM' }"
29
- class="time-meridiem overflow-hidden"
30
- @click.prevent="(meridiem = 'PM'),emit()"
29
+ class="time-meridiem"
30
+ @click.prevent="(meridiem = 'PM'),emitTime()"
31
31
  >
32
- {{ $t('timepicker_pm', 'renusify') }}
32
+ PM
33
33
  </div>
34
34
  </div>
35
35
  <div class="text-time ltr">
@@ -41,9 +41,9 @@
41
41
  }"
42
42
  class="time-show"
43
43
  placeholder="00"
44
- @input="emit"
45
- @update:model-value="handle_hour()"
46
- @click.prevent.stop="handle_hour(false)"
44
+ @input="emitTime()"
45
+ @update:model-value="handleHour()"
46
+ @click.prevent.stop="handleHour(false)"
47
47
  />
48
48
  <div class="t-text">:</div>
49
49
  <input
@@ -54,9 +54,9 @@
54
54
  }"
55
55
  class="time-show"
56
56
  placeholder="00"
57
- @input="emit"
58
- @update:model-value="handle_min()"
59
- @click.prevent.stop="handle_min(false)"
57
+ @input="emitTime()"
58
+ @update:model-value="handleMin()"
59
+ @click.prevent.stop="handleMin(false)"
60
60
  />
61
61
  <div class="t-text" v-if="withSec">:</div>
62
62
  <input
@@ -68,455 +68,386 @@
68
68
  }"
69
69
  class="time-show"
70
70
  placeholder="00"
71
- @input="emit"
72
- @update:model-value="handle_sec()"
73
- @click.prevent.stop="handle_sec(false)"
71
+ @input="emitTime()"
72
+ @update:model-value="handleSec()"
73
+ @click.prevent.stop="handleSec(false)"
74
74
  />
75
75
  </div>
76
76
  </div>
77
77
  </template>
78
78
 
79
- <script>
80
- export default {
81
- name: "timepicker",
82
- props: {
83
- disableTime: {
84
- type: Function, default: () => {
85
- return false
86
- }
87
- },
88
- withSec: Boolean,
89
- is24Hour: Boolean,
90
- modelValue: String
91
- },
92
- emits: ['update:modelValue', 'finish'],
93
- data() {
94
- return {
95
- show: this.is24Hour ? "hours24" : "hours12",
96
- hour: null,
97
- delay: 350,
98
- meridiem: "AM",
99
- min: null,
100
- sec: null,
101
- isSmall: false,
102
- hours12: {
103
- 1: "1",
104
- 2: "2",
105
- 3: "3",
106
- 4: "4",
107
- 5: "5",
108
- 6: "6",
109
- 7: "7",
110
- 8: "8",
111
- 9: "9",
112
- 10: "10",
113
- 11: "11",
114
- 12: "12"
115
- },
116
- hours24: {
117
- 1: "1",
118
- 2: "2",
119
- 3: "3",
120
- 4: "4",
121
- 5: "5",
122
- 6: "6",
123
- 7: "7",
124
- 8: "8",
125
- 9: "9",
126
- 10: "10",
127
- 11: "11",
128
- 12: "12",
129
- 0: "0",
130
- 13: "13",
131
- 14: "14",
132
- 15: "15",
133
- 16: "16",
134
- 17: "17",
135
- 18: "18",
136
- 19: "19",
137
- 20: "20",
138
- 21: "21",
139
- 22: "22",
140
- 23: "23"
141
- },
142
- mins: {
143
- 0: "0",
144
- 1: "",
145
- 2: "",
146
- 3: "",
147
- 4: "",
148
- 5: "5",
149
- 6: "",
150
- 7: "",
151
- 8: "",
152
- 9: "",
153
- 10: "10",
154
- 11: "",
155
- 12: "",
156
- 13: "",
157
- 14: "",
158
- 15: "15",
159
- 16: "",
160
- 17: "",
161
- 18: "",
162
- 19: "",
163
- 20: "20",
164
- 21: "",
165
- 22: "",
166
- 23: "",
167
- 24: "",
168
- 25: "25",
169
- 26: "",
170
- 27: "",
171
- 28: "",
172
- 29: "",
173
- 30: "30",
174
- 31: "",
175
- 32: "",
176
- 33: "",
177
- 34: "",
178
- 35: "35",
179
- 36: "",
180
- 37: "",
181
- 38: "",
182
- 39: "",
183
- 40: "40",
184
- 41: "",
185
- 42: "",
186
- 43: "",
187
- 44: "",
188
- 45: "45",
189
- 46: "",
190
- 47: "",
191
- 48: "",
192
- 49: "",
193
- 50: "50",
194
- 51: "",
195
- 52: "",
196
- 53: "",
197
- 54: "",
198
- 55: "55",
199
- 56: "",
200
- 57: "",
201
- 58: "",
202
- 59: ""
203
- },
204
- seconds: {
205
- 0: "0",
206
- 1: "",
207
- 2: "",
208
- 3: "",
209
- 4: "",
210
- 5: "5",
211
- 6: "",
212
- 7: "",
213
- 8: "",
214
- 9: "",
215
- 10: "10",
216
- 11: "",
217
- 12: "",
218
- 13: "",
219
- 14: "",
220
- 15: "15",
221
- 16: "",
222
- 17: "",
223
- 18: "",
224
- 19: "",
225
- 20: "20",
226
- 21: "",
227
- 22: "",
228
- 23: "",
229
- 24: "",
230
- 25: "25",
231
- 26: "",
232
- 27: "",
233
- 28: "",
234
- 29: "",
235
- 30: "30",
236
- 31: "",
237
- 32: "",
238
- 33: "",
239
- 34: "",
240
- 35: "35",
241
- 36: "",
242
- 37: "",
243
- 38: "",
244
- 39: "",
245
- 40: "40",
246
- 41: "",
247
- 42: "",
248
- 43: "",
249
- 44: "",
250
- 45: "45",
251
- 46: "",
252
- 47: "",
253
- 48: "",
254
- 49: "",
255
- 50: "50",
256
- 51: "",
257
- 52: "",
258
- 53: "",
259
- 54: "",
260
- 55: "55",
261
- 56: "",
262
- 57: "",
263
- 58: "",
264
- 59: ""
265
- }
266
- };
267
- },
268
- mounted() {
269
- this.setup_hour();
270
- setTimeout(() => {
271
- this.parser(this.modelValue)
272
- }, 100)
79
+ <script setup>
80
+ import {ref, computed, onMounted, nextTick} from 'vue'
81
+
82
+ const props = defineProps({
83
+ disableTime: {
84
+ type: Function,
85
+ default: () => false
273
86
  },
274
- computed: {
275
- nums() {
276
- return this[this.show];
87
+ withSec: Boolean,
88
+ is24Hour: Boolean,
89
+ modelValue: String
90
+ })
91
+
92
+ const emit = defineEmits(['update:modelValue', 'finish'])
93
+
94
+ const show = ref(props.is24Hour ? 'hours24' : 'hours12')
95
+ const hour = ref(null)
96
+ const min = ref(null)
97
+ const sec = ref(null)
98
+ const meridiem = ref('AM')
99
+ const isSmall = ref(false)
100
+
101
+ const handRef = ref(null)
102
+ const clockRef = ref(null)
103
+ const numbersRef = ref([])
104
+
105
+ const delay = 350
106
+
107
+ const hours12 = ref({
108
+ 1: '1', 2: '2', 3: '3', 4: '4', 5: '5', 6: '6',
109
+ 7: '7', 8: '8', 9: '9', 10: '10', 11: '11', 12: '12'
110
+ })
111
+
112
+ const hours24 = ref({
113
+ 1: '1', 2: '2', 3: '3', 4: '4', 5: '5', 6: '6',
114
+ 7: '7', 8: '8', 9: '9', 10: '10', 11: '11', 12: '12',
115
+ 0: '0', 13: '13', 14: '14', 15: '15', 16: '16', 17: '17',
116
+ 18: '18', 19: '19', 20: '20', 21: '21', 22: '22', 23: '23'
117
+ })
118
+
119
+ const mins = ref({
120
+ 0: '0', 5: '5', 10: '10', 15: '15', 20: '20', 25: '25',
121
+ 30: '30', 35: '35', 40: '40', 45: '45', 50: '50', 55: '55',
122
+ ...Array.from({length: 60}, (_, i) => i)
123
+ .filter(i => ![0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55].includes(i))
124
+ .reduce((acc, i) => ({...acc, [i]: ''}), {})
125
+ })
126
+
127
+ const seconds = ref({
128
+ 0: '0', 5: '5', 10: '10', 15: '15', 20: '20', 25: '25',
129
+ 30: '30', 35: '35', 40: '40', 45: '45', 50: '50', 55: '55',
130
+ ...Array.from({length: 60}, (_, i) => i)
131
+ .filter(i => ![0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55].includes(i))
132
+ .reduce((acc, i) => ({...acc, [i]: ''}), {})
133
+ })
134
+
135
+ const nums = computed(() => {
136
+ switch (show.value) {
137
+ case 'hours12':
138
+ return hours12.value
139
+ case 'hours24':
140
+ return hours24.value
141
+ case 'mins':
142
+ return mins.value
143
+ case 'seconds':
144
+ return seconds.value
145
+ default:
146
+ return {}
147
+ }
148
+ })
149
+
150
+ const parser = (txt) => {
151
+ if (!txt) return
152
+
153
+ const parts = txt.split(' ')
154
+ let timeStr = parts[0]
155
+
156
+ if (parts.length === 2) {
157
+ meridiem.value = parts[1]
158
+ }
159
+
160
+ const timeParts = timeStr.split(':')
161
+ hour.value = parseInt(timeParts[0]) || null
162
+ min.value = parseInt(timeParts[1]) || null
163
+
164
+ if (props.withSec && timeParts[2]) {
165
+ sec.value = parseInt(timeParts[2]) || null
166
+ }
167
+
168
+ handleHour(false)
169
+ }
170
+
171
+ const emitTime = () => {
172
+ const h = hour.value || 0
173
+ const m = min.value || 0
174
+ const s = sec.value || 0
175
+
176
+ const formattedHour = h < 10 ? '0' + h : h.toString()
177
+ const formattedMin = m < 10 ? '0' + m : m.toString()
178
+ const formattedSec = s < 10 ? '0' + s : s.toString()
179
+
180
+ let timeStr = formattedHour + ':' + formattedMin
181
+ if (props.withSec) {
182
+ timeStr += ':' + formattedSec
183
+ }
184
+
185
+ if (!props.is24Hour) {
186
+ timeStr += ' ' + meridiem.value
187
+ }
188
+
189
+ emit('update:modelValue', timeStr)
190
+
191
+ let finishedPart = 'hour'
192
+ if (min.value !== null) {
193
+ finishedPart = props.withSec && sec.value === null ? 'minute' : 'second'
194
+ }
195
+ emit('finish', finishedPart)
196
+ }
197
+
198
+ const handleHour = (next = true) => {
199
+ if (hour.value > (props.is24Hour ? 23 : 12)) {
200
+ hour.value = props.is24Hour ? 23 : 12
201
+ }
202
+
203
+ show.value = props.is24Hour ? 'hours24' : 'hours12'
204
+
205
+ setTimeout(() => {
206
+ isSmall.value = false
207
+ setupHour()
208
+ if (hour.value !== null) {
209
+ setNumber(hour.value, next)
277
210
  }
278
- },
279
- methods: {
280
- parser(txt) {
281
- if (!txt) {
282
- return
283
- }
284
- txt = txt.split(' ')
285
- if (txt.length === 2) {
286
- this.meridiem = txt[1]
287
- }
288
- txt = txt[0].split(':')
289
- this.hour = parseInt(txt[0])
290
- this.min = parseInt(txt[1])
291
- if (this.withSec) {
292
- this.sec = parseInt(txt[2])
293
- }
294
- this.handle_hour(false)
295
- },
296
- emit() {
297
- let hour = this.hour || 0
298
- let min = this.min || 0
299
- let sec = this.sec || 0
300
- if (hour < 10) {
301
- hour = '0' + hour;
302
- }
303
- if (min < 10) {
304
- min = '0' + min;
305
- }
306
- if (sec < 10) {
307
- sec = '0' + sec;
308
- }
309
- let n = hour + ":" + min;
310
- if (this.withSec) {
311
- n += ":" + sec;
312
- }
313
- if (!this.is24Hour) {
314
- n += " " + this.meridiem;
315
- }
211
+ }, delay)
212
+ }
316
213
 
317
- this.$emit("update:modelValue", n);
318
- this.$emit("finish", this.min === null ? 'hour' : (this.sec === null ? 'minute' : 'second'));
319
- },
320
- handle_hour(next = true) {
321
- if (this.hour > (this.is24Hour ? 23 : 12)) {
322
- this.hour = this.is24Hour ? 23 : 12;
323
- }
214
+ const handleMin = (next = true) => {
215
+ if (min.value > 59) {
216
+ min.value = 59
217
+ }
324
218
 
325
- this.show = this.is24Hour ? "hours24" : "hours12";
326
- setTimeout(() => {
327
- this.isSmall = false
328
- this.setup_hour();
329
- this.hour && this.set(this.hour, next);
330
- }, this.delay);
331
- },
332
- handle_min(next = true) {
333
- if (this.min > 59) {
334
- this.min = 59;
335
- }
336
- this.show = "mins";
337
- this.setSmall(this.min)
338
- setTimeout(() => {
339
- this.setup_min();
340
- this.min && this.set(this.min, next);
341
- }, this.delay);
342
- },
343
- handle_sec(next = true) {
344
- if (this.sec > 59) {
345
- this.sec = 59;
346
- }
347
- this.show = "seconds";
348
- this.setSmall(this.sec)
349
- setTimeout(() => {
350
- this.setup_min();
351
- this.sec && this.set(this.sec, next);
352
- }, this.delay);
353
- },
354
-
355
- set(h, next = true) {
356
- h = parseInt(h);
357
- let cl = this.$refs["number"][h];
358
- if (this.show === "hours12") {
359
- cl = this.$refs["number"][h - 1];
360
- }
219
+ show.value = 'mins'
220
+ setSmall(min.value)
361
221
 
362
- const hand = this.$refs.hand;
363
- const clock = this.$refs.clock.getBoundingClientRect();
364
-
365
- const b = cl.getBoundingClientRect();
366
-
367
- let ang = this.angle(
368
- b.left + 10,
369
- b.top + 10,
370
- clock.width / 2 + clock.left,
371
- clock.top,
372
- clock.width / 2 + clock.left,
373
- clock.height / 2 + clock.top
374
- );
375
- if (
376
- (this.show === "hours24" || this.show === "hours12") &&
377
- ((h > 6 && h < 13) || (h > 18 && h <= 23))
378
- ) {
379
- ang = 180 + 180 - ang;
380
- } else if (h > 30) {
381
- ang = 180 + 180 - ang;
382
- }
383
- hand.style.transform = "rotate(" + ang + "deg)";
222
+ setTimeout(() => {
223
+ setupMin()
224
+ if (min.value !== null) {
225
+ setNumber(min.value, next)
226
+ }
227
+ }, delay)
228
+ }
384
229
 
385
- if (this.show === "hours24" && (h === 0 || h >= 13)) {
386
- hand.style.height = "70px";
387
- } else {
388
- hand.style.height = "110px";
389
- }
230
+ const handleSec = (next = true) => {
231
+ if (sec.value > 59) {
232
+ sec.value = 59
233
+ }
390
234
 
391
- if (!next) {
392
- if (this.show === "hours24" || this.show === "hours12") {
393
- this.hour = h;
394
- } else if (this.show === "mins") {
395
- this.min = h;
396
- }
397
- this.emit();
398
- return
399
- }
400
- if (this.show === "hours24") {
401
- this.hour = h;
235
+ show.value = 'seconds'
236
+ setSmall(sec.value)
237
+
238
+ setTimeout(() => {
239
+ setupMin()
240
+ if (sec.value !== null) {
241
+ setNumber(sec.value, next)
242
+ }
243
+ }, delay)
244
+ }
245
+
246
+ const setNumber = (value, next = true) => {
247
+ const numValue = parseInt(value)
248
+ let element = null
249
+
250
+ if (show.value === 'hours12') {
251
+ element = numbersRef.value[numValue - 1]
252
+ } else {
253
+ element = numbersRef.value[numValue]
254
+ }
255
+
256
+ if (!element || !handRef.value || !clockRef.value) return
257
+
258
+ const clockRect = clockRef.value.getBoundingClientRect()
259
+ const elementRect = element.getBoundingClientRect()
260
+
261
+ const angle = calculateAngle(
262
+ elementRect.left + 10,
263
+ elementRect.top + 10,
264
+ clockRect.width / 2 + clockRect.left,
265
+ clockRect.top,
266
+ clockRect.width / 2 + clockRect.left,
267
+ clockRect.height / 2 + clockRect.top
268
+ )
269
+
270
+ let finalAngle = angle
271
+ if ((show.value === 'hours24' || show.value === 'hours12') &&
272
+ ((numValue > 6 && numValue < 13) || (numValue > 18 && numValue <= 23))) {
273
+ finalAngle = 180 + 180 - angle
274
+ } else if (numValue > 30) {
275
+ finalAngle = 180 + 180 - angle
276
+ }
277
+
278
+ handRef.value.style.transform = `rotate(${finalAngle}deg)`
279
+
280
+ if (show.value === 'hours24' && (numValue === 0 || numValue >= 13)) {
281
+ handRef.value.style.height = '70px'
282
+ } else {
283
+ handRef.value.style.height = '110px'
284
+ }
285
+
286
+ if (!next) {
287
+ // Just update the value without proceeding to next step
288
+ if (show.value === 'hours24' || show.value === 'hours12') {
289
+ hour.value = numValue
290
+ } else if (show.value === 'mins') {
291
+ min.value = numValue
292
+ } else {
293
+ sec.value = numValue
294
+ }
295
+ emitTime()
296
+ return
297
+ }
298
+
299
+ switch (show.value) {
300
+ case 'hours24':
301
+ case 'hours12':
302
+ hour.value = numValue
303
+ setTimeout(() => {
304
+ show.value = 'mins'
402
305
  setTimeout(() => {
403
- this.show = "mins";
404
- setTimeout(() => {
405
- this.setup_min();
406
- }, this.delay);
407
- }, this.delay);
408
- } else if (this.show === "hours12") {
409
- this.hour = h;
306
+ setupMin()
307
+ }, delay)
308
+ }, delay)
309
+ break
310
+
311
+ case 'mins':
312
+ min.value = numValue
313
+ setSmall(numValue)
314
+ if (props.withSec) {
410
315
  setTimeout(() => {
411
- this.show = "mins";
316
+ show.value = 'seconds'
317
+ isSmall.value = false
412
318
  setTimeout(() => {
413
- this.setup_min();
414
- }, this.delay);
415
- }, this.delay);
416
-
417
- } else if (this.show === "mins") {
418
- this.min = h;
419
- this.setSmall(h)
420
- if (this.withSec) {
421
- setTimeout(() => {
422
- this.show = "seconds";
423
- this.isSmall = false;
424
- setTimeout(() => {
425
- this.setup_min();
426
- }, this.delay);
427
- }, this.delay);
428
- }
429
- } else {
430
- this.setSmall(h)
431
- this.sec = h;
432
- }
433
- this.emit();
434
- },
435
- setSmall(h) {
436
- if ([0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55].includes(h)) {
437
- this.isSmall = false;
438
- } else {
439
- this.isSmall = true;
440
- }
441
- },
442
- angle(p1x, p1y, p2x, p2y, p3x, p3y) {
443
- let p0c = Math.sqrt(Math.pow(p3x - p1x, 2) + Math.pow(p3y - p1y, 2));
444
- let p1c = Math.sqrt(Math.pow(p3x - p2x, 2) + Math.pow(p3y - p2y, 2));
445
- let p0p1 = Math.sqrt(Math.pow(p2x - p1x, 2) + Math.pow(p2y - p1y, 2));
446
- return (
447
- Math.acos((p1c * p1c + p0c * p0c - p0p1 * p0p1) / (2 * p1c * p0c)) *
448
- (180 / Math.PI)
449
- );
450
- },
451
-
452
- movePointAtAngle(point, angle, distance) {
453
- return [
454
- point[0] + Math.sin(angle) * distance,
455
- point[1] - Math.cos(angle) * distance
456
- ];
457
- },
458
-
459
- print_point(n, lng, nums = 12) {
460
- return this.movePointAtAngle([130, 130], ((Math.PI * 2) / nums) * n, lng);
461
- },
462
- setup_hour() {
463
- let cl = null;
464
- let po = null;
465
-
466
- if (this.is24Hour) {
467
- for (let i = 1; i <= 12; i++) {
468
- cl = this.$refs["number"][i];
469
- po = this.print_point(i, 110);
470
- cl.style.left = po[0] - 10 + "px";
471
- cl.style.top = po[1] - 10 + "px";
472
- cl.classList.add('number-show')
473
- }
474
- for (let i = 13; i <= 23; i++) {
475
- cl = this.$refs["number"][i];
476
- po = this.print_point(i, 70);
477
- cl.style.left = po[0] - 10 + "px";
478
- cl.style.top = po[1] - 10 + "px";
479
- cl.classList.add('number-show')
480
- }
481
- cl = this.$refs["number"][0];
482
- po = this.print_point(0, 70);
483
- cl.style.left = po[0] - 10 + "px";
484
- cl.style.top = po[1] - 10 + "px";
485
- cl.classList.add('number-show')
486
- } else {
487
- for (let i = 0; i < 12; i++) {
488
- cl = this.$refs["number"][i];
489
- po = this.print_point(i + 1, 110);
490
- cl.style.left = po[0] - 10 + "px";
491
- cl.style.top = po[1] - 10 + "px";
492
- cl.classList.add('number-show')
493
- }
494
- }
495
- },
496
- setup_min() {
497
- const clock = this.$refs.hand;
498
- clock.style.transform = "rotate(0)";
499
- clock.style.height = "110px";
500
-
501
- let cl = null;
502
- let po = null;
503
- for (let i = 0; i < 60; i++) {
504
- cl = this.$refs["number"][i];
505
- po = this.print_point(i, 110, 60);
506
- cl.style.left = po[0] - 10 + "px";
507
- cl.style.top = po[1] - 10 + "px";
508
- cl.classList.add('number-show')
319
+ setupMin()
320
+ }, delay)
321
+ }, delay)
509
322
  }
323
+ break
324
+
325
+ case 'seconds':
326
+ setSmall(numValue)
327
+ sec.value = numValue
328
+ break
329
+ }
330
+
331
+ emitTime()
332
+ }
333
+
334
+ const setSmall = (value) => {
335
+ const largeValues = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]
336
+ isSmall.value = !largeValues.includes(parseInt(value))
337
+ }
338
+
339
+ const calculateAngle = (p1x, p1y, p2x, p2y, p3x, p3y) => {
340
+ const p0c = Math.sqrt(Math.pow(p3x - p1x, 2) + Math.pow(p3y - p1y, 2))
341
+ const p1c = Math.sqrt(Math.pow(p3x - p2x, 2) + Math.pow(p3y - p2y, 2))
342
+ const p0p1 = Math.sqrt(Math.pow(p2x - p1x, 2) + Math.pow(p2y - p1y, 2))
343
+ return Math.acos((p1c * p1c + p0c * p0c - p0p1 * p0p1) / (2 * p1c * p0c)) * (180 / Math.PI)
344
+ }
345
+
346
+ const movePointAtAngle = (point, angle, distance) => {
347
+ return [
348
+ point[0] + Math.sin(angle) * distance,
349
+ point[1] - Math.cos(angle) * distance
350
+ ]
351
+ }
352
+
353
+ const calculatePointPosition = (n, length, totalNumbers = 12) => {
354
+ return movePointAtAngle([130, 130], ((Math.PI * 2) / totalNumbers) * n, length)
355
+ }
356
+
357
+ const setupHour = () => {
358
+ if (!numbersRef.value.length) return
359
+
360
+ let element = null
361
+ let position = null
362
+
363
+ if (props.is24Hour) {
364
+ for (let i = 1; i <= 12; i++) {
365
+ element = numbersRef.value[i]
366
+ if (!element) continue
367
+
368
+ position = calculatePointPosition(i, 110)
369
+ element.style.left = position[0] - 10 + 'px'
370
+ element.style.top = position[1] - 10 + 'px'
371
+ element.classList.add('number-show')
372
+ }
373
+
374
+ for (let i = 13; i <= 23; i++) {
375
+ element = numbersRef.value[i]
376
+ if (!element) continue
377
+
378
+ position = calculatePointPosition(i, 70)
379
+ element.style.left = position[0] - 10 + 'px'
380
+ element.style.top = position[1] - 10 + 'px'
381
+ element.classList.add('number-show')
382
+ }
383
+
384
+ element = numbersRef.value[0]
385
+ if (element) {
386
+ position = calculatePointPosition(0, 70)
387
+ element.style.left = position[0] - 10 + 'px'
388
+ element.style.top = position[1] - 10 + 'px'
389
+ element.classList.add('number-show')
390
+ }
391
+ } else {
392
+ for (let i = 0; i < 12; i++) {
393
+ element = numbersRef.value[i]
394
+ if (!element) continue
395
+
396
+ position = calculatePointPosition(i + 1, 110)
397
+ element.style.left = position[0] - 10 + 'px'
398
+ element.style.top = position[1] - 10 + 'px'
399
+ element.classList.add('number-show')
510
400
  }
511
401
  }
512
- };
402
+ }
403
+
404
+ const setupMin = () => {
405
+ if (!handRef.value) return
406
+
407
+ handRef.value.style.transform = 'rotate(0)'
408
+ handRef.value.style.height = '110px'
409
+
410
+ let element = null
411
+ let position = null
412
+
413
+ for (let i = 0; i < 60; i++) {
414
+ element = numbersRef.value[i]
415
+ if (!element) continue
416
+
417
+ position = calculatePointPosition(i, 110, 60)
418
+ element.style.left = position[0] - 10 + 'px'
419
+ element.style.top = position[1] - 10 + 'px'
420
+ element.classList.add('number-show')
421
+ }
422
+ }
423
+
424
+
425
+ const selectNumber = (value) => {
426
+ if (props.disableTime && props.disableTime(value, show.value, hour.value, min.value)) {
427
+ return
428
+ }
429
+
430
+ setNumber(value, true)
431
+ }
432
+
433
+
434
+ onMounted(() => {
435
+ nextTick(() => {
436
+ setupHour()
437
+
438
+ setTimeout(() => {
439
+ if (props.modelValue) {
440
+ parser(props.modelValue)
441
+ }
442
+ }, 100)
443
+ })
444
+ })
513
445
  </script>
514
446
 
515
447
  <style lang="scss">
516
- @use "../../../style/variables/base";
517
- @use "../../../style/mixins";
448
+ @use "../../../style" as *;
518
449
 
519
- .#{base.$prefix}timepicker-clock {
450
+ .#{$prefix}timepicker-clock {
520
451
 
521
452
  --color-timepicker: var(--color-one);
522
453
 
@@ -555,17 +486,19 @@ export default {
555
486
  }
556
487
 
557
488
  .meridiem-active {
558
- background-color: var(--color-three-container);
559
- color: var(--color-on-three-container);
489
+ background-color: var(--color-one-container);
490
+ color: var(--color-on-one-container);
560
491
  }
561
492
 
562
493
  .text-meridiem > .time-meridiem {
563
494
  width: 40px;
564
495
  height: 40px;
565
- text-align: center;
496
+ justify-content: center;
566
497
  border-radius: 10px;
567
498
  padding: 12px 5px 5px 5px;
568
- border: 1px solid #e0e0e0;
499
+ border: 1px solid var(--color-border-low);
500
+ display: flex;
501
+ align-items: center;
569
502
  }
570
503
 
571
504
  .text-time > .t-text {
@@ -684,7 +617,7 @@ export default {
684
617
 
685
618
 
686
619
  .number-disabled {
687
- @include mixins.disable-states()
620
+ @include disable-states()
688
621
  }
689
622
  }
690
623
  </style>