renusify 2.5.1 → 3.0.0
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/components/app/index.vue +74 -22
- package/components/app/toast/index.vue +76 -71
- package/components/app/toast/toast.vue +62 -44
- package/components/avatar/index.vue +208 -84
- package/components/button/buttonConfirm.vue +53 -26
- package/components/button/buttonGroup.js +0 -2
- package/components/button/buttonGroup.vue +310 -62
- package/components/button/index.vue +584 -100
- package/components/calendar/index.js +0 -2
- package/components/calendar/index.vue +326 -262
- package/components/calendar/month.vue +64 -55
- package/components/calendar/year.vue +30 -25
- package/components/card/index.vue +139 -59
- package/components/codeEditor/highlightCss.vue +38 -39
- package/components/codeEditor/highlightHtml.vue +64 -64
- package/components/codeEditor/highlightJs.vue +37 -38
- package/components/codeEditor/index.vue +129 -79
- package/components/codeEditor/run.vue +225 -39
- package/components/codeEditor/useCodeFormatter.js +150 -0
- package/components/confirm/index.vue +140 -81
- package/components/container/col.vue +5 -4
- package/components/container/divider.vue +28 -19
- package/components/container/index.vue +34 -15
- package/components/container/row.vue +26 -9
- package/components/container/spacer.vue +2 -4
- package/components/container/style.scss +3 -0
- package/components/content/index.vue +49 -32
- package/components/cropper/index.vue +401 -244
- package/components/float/index.vue +542 -415
- package/components/form/addressInput/index.vue +184 -109
- package/components/form/camInput/index.vue +370 -244
- package/components/form/checkInput/index.vue +138 -71
- package/components/form/checkboxInput/index.vue +87 -47
- package/components/form/colorInput/Alpha.vue +81 -83
- package/components/form/colorInput/Hue.vue +91 -68
- package/components/form/colorInput/Preview.vue +43 -47
- package/components/form/colorInput/Saturation.vue +101 -86
- package/components/form/colorInput/index.vue +72 -40
- package/components/form/colorInput/picker.vue +111 -106
- package/components/form/colorInput/useColor.js +153 -0
- package/components/form/dateInput/index.vue +691 -356
- package/components/form/dateInput/month.vue +63 -54
- package/components/form/dateInput/year.vue +35 -25
- package/components/form/fileInput/index.js +0 -1
- package/components/form/fileInput/index.vue +263 -106
- package/components/form/fileInput/single.vue +323 -164
- package/components/form/groupInput/index.vue +199 -101
- package/components/form/index.vue +189 -83
- package/components/form/input/index.vue +416 -377
- package/components/form/jsonInput/JsonView.vue +54 -56
- package/components/form/jsonInput/index.vue +247 -165
- package/components/form/maskInput/index.vue +252 -132
- package/components/form/numberInput/index.js +0 -1
- package/components/form/numberInput/index.vue +226 -117
- package/components/form/passwordInput/index.js +2 -1
- package/components/form/passwordInput/index.vue +269 -102
- package/components/form/radioInput/index.vue +143 -72
- package/components/form/rangeInput/index.vue +280 -167
- package/components/form/ratingInput/index.vue +57 -57
- package/components/form/selectInput/index.js +1 -3
- package/components/form/selectInput/index.vue +584 -296
- package/components/form/switchInput/index.vue +73 -59
- package/components/form/telInput/index.js +0 -1
- package/components/form/telInput/index.vue +238 -135
- package/components/form/textArea/index.vue +72 -35
- package/components/form/textEditor/index.vue +739 -0
- package/components/form/{text-editor → textEditor}/style.scss +8 -16
- package/components/form/textInput/index.vue +54 -32
- package/components/form/timeInput/index.vue +83 -56
- package/components/form/timeInput/range.vue +116 -95
- package/components/form/timeInput/timepicker.vue +382 -449
- package/components/form/uniqueInput/index.vue +105 -48
- package/components/form/unitInput/index.vue +139 -84
- package/components/formCreator/index.js +0 -1
- package/components/formCreator/index.vue +314 -148
- package/components/highlight/index.vue +41 -25
- package/components/highlight/style.scss +2 -2
- package/components/highlight/{mixin.js → useHighlight.js} +181 -160
- package/components/icon/index.vue +79 -33
- package/components/img/index.vue +249 -147
- package/components/img/preview.vue +180 -198
- package/components/img/svgImg.vue +42 -39
- package/components/index.js +5 -20
- package/components/infinite/index.js +1 -2
- package/components/infinite/index.vue +248 -66
- package/components/map/index.vue +428 -261
- package/components/map/route.vue +794 -487
- package/components/map/select.vue +118 -58
- package/components/menu/index.vue +201 -91
- package/components/meta/meta.js +26 -3
- package/components/modal/index.vue +383 -158
- package/components/notify/index.vue +204 -86
- package/components/notify/notification.vue +38 -55
- package/components/progress/circle.vue +189 -70
- package/components/progress/line.vue +266 -46
- package/components/searchBox/index.js +1 -3
- package/components/searchBox/index.vue +194 -101
- package/components/skeleton/index.vue +45 -20
- package/components/slider/index.vue +318 -156
- package/components/swiper/index.vue +254 -106
- package/components/table/crud/footer.vue +77 -53
- package/components/table/crud/header.vue +71 -72
- package/components/table/crud/index.vue +631 -401
- package/components/table/index.vue +721 -278
- package/components/timeAgo/index.vue +145 -96
- package/components/tour/index.vue +338 -235
- package/components/tree/index.vue +235 -89
- package/components/tree/tree-element.vue +107 -106
- package/directive/animate/index.js +77 -0
- package/directive/clickOutSide/index.js +98 -0
- package/directive/drag/index.js +153 -0
- package/directive/index.js +11 -13
- package/directive/intersect/index.js +263 -0
- package/directive/mask/index.js +67 -0
- package/directive/parallax/index.js +78 -0
- package/directive/ripple/index.js +14 -0
- package/directive/scroll/index.js +244 -0
- package/directive/sortable/index.js +274 -0
- package/directive/title/index.js +75 -0
- package/directive/touch/index.js +268 -0
- package/index.js +10 -8
- package/package.json +5 -2
- package/plugins/validation/Validate.js +88 -79
- package/scripts/generate-docs.mjs +226 -0
- package/scripts/menu.mjs +240 -0
- package/scripts/parser.mjs +1086 -0
- package/style/_index.scss +7 -0
- package/style/app.scss +13 -65
- package/style/colors.scss +5 -22
- package/style/functions/index.scss +8 -0
- package/style/mixins/index.scss +17 -5
- package/style/variables/base.scss +154 -175
- package/style/variables/color.scss +0 -12
- package/style/variables/utilities.scss +0 -180
- package/tools/helper.js +0 -8
- package/tools/icons.js +6 -1
- package/tools/root.js +71 -0
- package/components/app/style.scss +0 -41
- package/components/app/toast/style.scss +0 -20
- package/components/avatar/style.scss +0 -32
- package/components/bar/bottomNav.js +0 -1
- package/components/bar/bottomNav.vue +0 -28
- package/components/bar/bottomNavigationCircle.js +0 -2
- package/components/bar/bottomNavigationCircle.vue +0 -99
- package/components/bar/scss/bottomNav.scss +0 -67
- package/components/bar/scss/toolbar.scss +0 -174
- package/components/bar/toolbar/index.js +0 -8
- package/components/bar/toolbar/index.vue +0 -35
- package/components/bar/toolbar/laptop.vue +0 -33
- package/components/bar/toolbar/menuChilds.vue +0 -41
- package/components/bar/toolbar/menuLaptop.vue +0 -41
- package/components/bar/toolbar/menuMob.vue +0 -39
- package/components/bar/toolbar/mixin.js +0 -43
- package/components/bar/toolbar/mobile.vue +0 -34
- package/components/breadcrumb/bredcrumbItem.vue +0 -39
- package/components/breadcrumb/index.js +0 -3
- package/components/breadcrumb/index.vue +0 -71
- package/components/breadcrumb/style.scss +0 -51
- package/components/button/style.scss +0 -411
- package/components/card/style.scss +0 -86
- package/components/chart/chart.js +0 -1
- package/components/chart/chart.vue +0 -69
- package/components/chart/worldMap.js +0 -2
- package/components/chart/worldMap.vue +0 -1112
- package/components/chat/MessageList.vue +0 -163
- package/components/chat/chatInput.vue +0 -150
- package/components/chat/chatMsg.vue +0 -276
- package/components/chat/index.js +0 -11
- package/components/chat/index.vue +0 -113
- package/components/chip/index.js +0 -3
- package/components/chip/index.vue +0 -77
- package/components/chip/style.scss +0 -199
- package/components/codeEditor/mixin.js +0 -145
- package/components/countdown/index.js +0 -1
- package/components/countdown/index.vue +0 -105
- package/components/form/colorInput/mixin.js +0 -132
- package/components/form/fileInput/file.js +0 -148
- package/components/form/telInput/assets/flags.png +0 -0
- package/components/form/telInput/assets/flags@2x.png +0 -0
- package/components/form/text-editor/index.vue +0 -710
- package/components/icon/style.scss +0 -17
- package/components/infinite/div.js +0 -6
- package/components/infinite/div.vue +0 -193
- package/components/infinite/page.js +0 -3
- package/components/infinite/page.vue +0 -105
- package/components/list/index.js +0 -3
- package/components/list/index.vue +0 -122
- package/components/list/style.scss +0 -66
- package/components/message/index.js +0 -4
- package/components/message/index.vue +0 -40
- package/components/modal/style.scss +0 -146
- package/components/nestable/NestableItem.vue +0 -307
- package/components/nestable/editable.js +0 -44
- package/components/nestable/index.js +0 -1
- package/components/nestable/index.vue +0 -226
- package/components/nestable/methods.js +0 -416
- package/components/progress/style.scss +0 -229
- package/components/table/style.scss +0 -338
- package/components/tabs/index.js +0 -3
- package/components/tabs/index.vue +0 -151
- package/components/timeline/index.js +0 -6
- package/components/timeline/index.vue +0 -76
- package/directive/resize/index.js +0 -30
- package/directive/skeleton/index.js +0 -27
- package/directive/skeleton/style.scss +0 -37
- package/plugins/request/Request.js +0 -68
- package/style/animation.scss +0 -94
- package/style/style.scss +0 -8
- package/tools/rootable.js +0 -75
- /package/components/form/{text-editor → textEditor}/index.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.vue +0 -0
|
@@ -2,109 +2,158 @@
|
|
|
2
2
|
<span :key="k">{{ timeAgo(time) }}</span>
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
|
-
<script>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import {ref, onUnmounted, inject} from 'vue'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @example // TimeAgo usage
|
|
10
|
+
* <template>
|
|
11
|
+
* <r-time-ago
|
|
12
|
+
* :time="time"
|
|
13
|
+
* :no-Trans="noTrans"
|
|
14
|
+
* :live-Time="liveTime"
|
|
15
|
+
* :live="live"
|
|
16
|
+
* ></r-time-ago>
|
|
17
|
+
* </template>
|
|
18
|
+
*
|
|
19
|
+
* <script>
|
|
20
|
+
* import { ref } from 'vue'
|
|
21
|
+
*
|
|
22
|
+
* const time = ref(Date.now() - (60 * 60 * 24 * 1000)) // 1 day ago
|
|
23
|
+
* const noTrans = ref(true)
|
|
24
|
+
* const liveTime = ref(2000)
|
|
25
|
+
* const live = ref(false)
|
|
26
|
+
* <//script>
|
|
27
|
+
*
|
|
28
|
+
*
|
|
29
|
+
* */
|
|
30
|
+
const props = defineProps({
|
|
31
|
+
/**
|
|
32
|
+
* The time value to display relative time for
|
|
33
|
+
* @type {Number|String|Date}
|
|
34
|
+
* @required
|
|
35
|
+
*/
|
|
36
|
+
time: {
|
|
37
|
+
required: true
|
|
21
38
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Disables translation, shows English text only
|
|
41
|
+
* @type {Boolean}
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
noTrans: {
|
|
45
|
+
default: false,
|
|
46
|
+
type: Boolean
|
|
27
47
|
},
|
|
28
|
-
|
|
29
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Update interval in milliseconds for live updates
|
|
50
|
+
* @type {Number}
|
|
51
|
+
* @default 5000
|
|
52
|
+
*/
|
|
53
|
+
liveTime: {
|
|
54
|
+
default: 5000,
|
|
55
|
+
type: Number
|
|
30
56
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
case 'string':
|
|
38
|
-
if (time.split('T').length > 1) {
|
|
39
|
-
time = new Date(time)
|
|
40
|
-
} else {
|
|
41
|
-
time = new Date(time + ' UTC')
|
|
42
|
-
}
|
|
43
|
-
break
|
|
44
|
-
case 'object':
|
|
45
|
-
break
|
|
46
|
-
default:
|
|
47
|
-
time = new Date()
|
|
48
|
-
}
|
|
49
|
-
const timeFormats = [
|
|
50
|
-
[60, this.t('seconds'), 1], // 60
|
|
51
|
-
[120, this.t('1_minute_ago'), this.t('1_minute_from_now')], // 60*2
|
|
52
|
-
[3600, this.t('minutes'), 60], // 60*60, 60
|
|
53
|
-
[7200, this.t('1_hour_ago'), this.t('1_hour_from_now')], // 60*60*2
|
|
54
|
-
[86400, this.t('hours'), 3600], // 60*60*24, 60*60
|
|
55
|
-
[172800, this.t('yesterday'), this.t('tomorrow')], // 60*60*24*2
|
|
56
|
-
[604800, this.t('days'), 86400], // 60*60*24*7, 60*60*24
|
|
57
|
-
[1209600, this.t('last_week'), this.t('next_week')], // 60*60*24*7*4*2
|
|
58
|
-
[2419200, this.t('weeks'), 604800], // 60*60*24*7*4, 60*60*24*7
|
|
59
|
-
[4838400, this.t('last_month'), this.t('next_month')], // 60*60*24*7*4*2
|
|
60
|
-
[29030400, this.t('months'), 2419200], // 60*60*24*7*4*12, 60*60*24*7*4
|
|
61
|
-
[58060800, this.t('last_year'), this.t('next_year')], // 60*60*24*7*4*12*2
|
|
62
|
-
[2903040000, this.t('years'), 29030400], // 60*60*24*7*4*12*100, 60*60*24*7*4*12
|
|
63
|
-
[5806080000, this.t('last_century'), this.t('next_century')], // 60*60*24*7*4*12*100*2
|
|
64
|
-
[58060800000, this.t('centuries'), 2903040000] // 60*60*24*7*4*12*100*20, 60*60*24*7*4*12*100
|
|
65
|
-
]
|
|
66
|
-
let seconds = (new Date() - time) / 1000
|
|
67
|
-
let token = this.t('ago')
|
|
68
|
-
let listChoice = 1
|
|
69
|
-
|
|
70
|
-
if (seconds < 0) {
|
|
71
|
-
seconds = Math.abs(seconds) + 1
|
|
72
|
-
token = this.t('from_now')
|
|
73
|
-
listChoice = 2
|
|
74
|
-
}
|
|
57
|
+
/**
|
|
58
|
+
* Enables live time updates
|
|
59
|
+
* @type {Boolean}
|
|
60
|
+
*/
|
|
61
|
+
live: Boolean
|
|
62
|
+
})
|
|
75
63
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (this.live) {
|
|
94
|
-
this.id = setInterval(() => {
|
|
95
|
-
this.k++
|
|
96
|
-
}, this.liveTime)
|
|
64
|
+
const $t = inject('renusify').$t
|
|
65
|
+
|
|
66
|
+
const id = ref(null)
|
|
67
|
+
const k = ref(0)
|
|
68
|
+
|
|
69
|
+
const timeAgo = (time) => {
|
|
70
|
+
let date
|
|
71
|
+
|
|
72
|
+
switch (typeof time) {
|
|
73
|
+
case 'number':
|
|
74
|
+
date = new Date(time)
|
|
75
|
+
break
|
|
76
|
+
case 'string':
|
|
77
|
+
if (time.split('T').length > 1) {
|
|
78
|
+
date = new Date(time)
|
|
79
|
+
} else {
|
|
80
|
+
date = new Date(time + ' UTC')
|
|
97
81
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
82
|
+
break
|
|
83
|
+
case 'object':
|
|
84
|
+
date = time
|
|
85
|
+
break
|
|
86
|
+
default:
|
|
87
|
+
date = new Date()
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const timeFormats = [
|
|
91
|
+
[60, t('seconds'), 1], // 60
|
|
92
|
+
[120, t('1_minute_ago'), t('1_minute_from_now')], // 60*2
|
|
93
|
+
[3600, t('minutes'), 60], // 60*60, 60
|
|
94
|
+
[7200, t('1_hour_ago'), t('1_hour_from_now')], // 60*60*2
|
|
95
|
+
[86400, t('hours'), 3600], // 60*60*24, 60*60
|
|
96
|
+
[172800, t('yesterday'), t('tomorrow')], // 60*60*24*2
|
|
97
|
+
[604800, t('days'), 86400], // 60*60*24*7, 60*60*24
|
|
98
|
+
[1209600, t('last_week'), t('next_week')], // 60*60*24*7*4*2
|
|
99
|
+
[2419200, t('weeks'), 604800], // 60*60*24*7*4, 60*60*24*7
|
|
100
|
+
[4838400, t('last_month'), t('next_month')], // 60*60*24*7*4*2
|
|
101
|
+
[29030400, t('months'), 2419200], // 60*60*24*7*4*12, 60*60*24*7*4
|
|
102
|
+
[58060800, t('last_year'), t('next_year')], // 60*60*24*7*4*12*2
|
|
103
|
+
[2903040000, t('years'), 29030400], // 60*60*24*7*4*12*100, 60*60*24*7*4*12
|
|
104
|
+
[5806080000, t('last_century'), t('next_century')], // 60*60*24*7*4*12*100*2
|
|
105
|
+
[58060800000, t('centuries'), 2903040000] // 60*60*24*7*4*12*100*20, 60*60*24*7*4*12*100
|
|
106
|
+
]
|
|
107
|
+
|
|
108
|
+
let seconds = (new Date() - date) / 1000
|
|
109
|
+
let token = t('ago')
|
|
110
|
+
let listChoice = 1
|
|
111
|
+
|
|
112
|
+
if (seconds < 0) {
|
|
113
|
+
seconds = Math.abs(seconds) + 1
|
|
114
|
+
token = t('from_now')
|
|
115
|
+
listChoice = 2
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (seconds < 5) {
|
|
119
|
+
return t('just_now')
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const lng = timeFormats.length
|
|
123
|
+
for (let i = 0; i < lng; i++) {
|
|
124
|
+
const format = timeFormats[i]
|
|
125
|
+
if (seconds < format[0]) {
|
|
126
|
+
if (typeof format[2] === 'string') {
|
|
127
|
+
return format[listChoice]
|
|
128
|
+
} else {
|
|
129
|
+
return Math.floor(seconds / format[2]) + ' ' + format[1] + ' ' + token
|
|
102
130
|
}
|
|
103
|
-
return this.$t('date_time_' + val, 'renusify')
|
|
104
131
|
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return date
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const t = (val) => {
|
|
138
|
+
if (props.noTrans) {
|
|
139
|
+
return val.replace(/_/g, ' ')
|
|
140
|
+
}
|
|
141
|
+
return $t('date_time_' + val, 'renusify')
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const setup = () => {
|
|
145
|
+
if (props.live) {
|
|
146
|
+
id.value = setInterval(() => {
|
|
147
|
+
k.value++
|
|
148
|
+
}, props.liveTime)
|
|
108
149
|
}
|
|
109
150
|
}
|
|
151
|
+
|
|
152
|
+
setup()
|
|
153
|
+
|
|
154
|
+
onUnmounted(() => {
|
|
155
|
+
if (id.value) {
|
|
156
|
+
clearInterval(id.value)
|
|
157
|
+
}
|
|
158
|
+
})
|
|
110
159
|
</script>
|