renusify 1.4.0 → 1.4.2
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/chart/worldMap.vue +851 -0
- package/components/form/check-input.vue +3 -2
- package/components/form/group-input.vue +2 -1
- package/components/form/input.vue +1 -1
- package/components/form/json/JsonView.vue +3 -3
- package/components/form/json/index.vue +9 -9
- package/components/form/rating.vue +9 -7
- package/components/img/index.vue +5 -4
- package/components/index.js +1 -0
- package/components/slider/index.vue +37 -16
- package/directive/animate/style.scss +9 -6
- package/directive/sortable/index.js +1 -1
- package/directive/sortable/style.scss +7 -4
- package/directive/title/style.scss +1 -1
- package/index.js +4 -4
- package/package.json +1 -1
- package/plugins/trans/Currency.js +11 -10
- package/plugins/trans/DateTime.js +2 -2
- package/plugins/trans/Translate.js +21 -21
- package/plugins/validation/Validate.js +25 -24
- package/tools/helper.js +2 -2
|
@@ -20,8 +20,9 @@
|
|
|
20
20
|
:rounded="$attrs.tile===undefined||$attrs.tile===false"
|
|
21
21
|
:loading="loading" @click.prevent="check()" class="elevation-none mx-1">
|
|
22
22
|
{{ $t('check', 'renusify') }}
|
|
23
|
-
<r-icon
|
|
24
|
-
|
|
23
|
+
<r-icon v-if="pass!==null && pass!==false" class="color-success-text" exact height="20" width="20"
|
|
24
|
+
v-html="$r.icons.check"></r-icon>
|
|
25
|
+
<r-icon v-if=" pass===false" class="color-error-text" height="20" width="20" v-html="$r.icons.close"></r-icon>
|
|
25
26
|
</r-btn>
|
|
26
27
|
</div>
|
|
27
28
|
</r-input>
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
<slot :item="item" :index="i" :disableDel="disDel">
|
|
10
10
|
<div v-if="template" class="d-flex flex-wrap pt-5 v-start">
|
|
11
11
|
<template v-for="(v,k) in item" :key="i+'-'+k">
|
|
12
|
-
<component
|
|
12
|
+
<component :is="template[k]['type']" v-if="template[k]&&template[k]['type']" v-model="item[k]"
|
|
13
|
+
:label="t(k)"
|
|
13
14
|
class="flex-grow-0 me-1" v-bind="template[k]['props']"></component>
|
|
14
15
|
</template>
|
|
15
16
|
</div>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
:class="{
|
|
4
4
|
[`${$r.prefix}input-container`]:true,
|
|
5
5
|
[c_color]:c_color&&!isDisabled,
|
|
6
|
-
'color-error-text':hasError
|
|
6
|
+
'color-error-text':hasError&&genMessages.length>0,
|
|
7
7
|
'hide-detail':c_hide,
|
|
8
8
|
'input-focused':active,
|
|
9
9
|
'input-disabled':isDisabled,
|
|
@@ -45,7 +45,7 @@ export default {
|
|
|
45
45
|
disableAdd: Boolean,
|
|
46
46
|
disableDel: Boolean,
|
|
47
47
|
tile: Boolean,
|
|
48
|
-
translate:Boolean
|
|
48
|
+
translate: Boolean
|
|
49
49
|
},
|
|
50
50
|
emits: ['update:modelValue'],
|
|
51
51
|
data() {
|
|
@@ -59,8 +59,8 @@ export default {
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
methods: {
|
|
62
|
-
t(key){
|
|
63
|
-
if(this.translate){
|
|
62
|
+
t(key) {
|
|
63
|
+
if (this.translate) {
|
|
64
64
|
return this.$t(key)
|
|
65
65
|
}
|
|
66
66
|
return key
|
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
:translate="translate"
|
|
39
39
|
@update:model-value="info.value=null"
|
|
40
40
|
firstSelect></r-select-input>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
</div>
|
|
42
|
+
<r-text-input v-if="info.type==='text'"
|
|
43
|
+
:tile="tile"
|
|
44
|
+
:label="valueLabel||$t('value','renusify')"
|
|
45
|
+
v-model="info.value"></r-text-input>
|
|
46
46
|
<r-number-input v-else-if="info.type==='number'"
|
|
47
47
|
:tile="tile"
|
|
48
|
-
:label="valueLabel||$t('value','renusify')"
|
|
48
|
+
v-model="info.value" :label="valueLabel||$t('value','renusify')"></r-number-input>
|
|
49
49
|
<r-switch-input v-else-if="info.type==='boolean'"
|
|
50
50
|
:tile="tile"
|
|
51
|
-
:label="valueLabel||$t('value','renusify')"
|
|
51
|
+
v-model="info.value" :label="valueLabel||$t('value','renusify')"></r-switch-input>
|
|
52
52
|
<r-btn @click.prevent="add" class="ms-1 color-success" rounded>{{ $t('add', 'renusify') }}</r-btn>
|
|
53
53
|
</div>
|
|
54
54
|
</div>
|
|
@@ -163,8 +163,8 @@ export default {
|
|
|
163
163
|
d.push(Object.assign({}, {}, this.template))
|
|
164
164
|
this.$emit('update:modelValue', d)
|
|
165
165
|
} else {
|
|
166
|
-
if(this.valueType){
|
|
167
|
-
this.info.type=this.valueType
|
|
166
|
+
if (this.valueType) {
|
|
167
|
+
this.info.type = this.valueType
|
|
168
168
|
}
|
|
169
169
|
this.show = true
|
|
170
170
|
}
|
|
@@ -45,12 +45,13 @@ export default {
|
|
|
45
45
|
</script>
|
|
46
46
|
<style lang="scss">
|
|
47
47
|
@import "../../style/include";
|
|
48
|
+
|
|
48
49
|
$btn-sizes: (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
'x-small': 20,
|
|
51
|
+
'small': 25,
|
|
52
|
+
'default': 30,
|
|
53
|
+
'large': 35,
|
|
54
|
+
'x-large': 40
|
|
54
55
|
) !default;
|
|
55
56
|
.#{$prefix}rating {
|
|
56
57
|
max-width: 100%;
|
|
@@ -60,11 +61,12 @@ $btn-sizes: (
|
|
|
60
61
|
|
|
61
62
|
@each $name, $size in $btn-sizes {
|
|
62
63
|
&.size-#{$name} {
|
|
63
|
-
.#{$prefix}btn{
|
|
64
|
+
.#{$prefix}btn {
|
|
64
65
|
height: #{$size}px;
|
|
65
66
|
width: #{$size}px
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
+
|
|
69
|
+
.#{$prefix}icon {
|
|
68
70
|
height: #{$size - 4px};
|
|
69
71
|
width: #{$size - 4px}
|
|
70
72
|
}
|
package/components/img/index.vue
CHANGED
|
@@ -135,12 +135,13 @@ export default {
|
|
|
135
135
|
}
|
|
136
136
|
if(wPH) {
|
|
137
137
|
if (res['width'] !== 0 && res['height'] === 0) {
|
|
138
|
-
res['height'] = res['width'] / wPH
|
|
138
|
+
res['height'] = parseInt(res['width'] / wPH)
|
|
139
139
|
}
|
|
140
140
|
if (res['width'] === 0 && res['height'] !== 0) {
|
|
141
|
-
res['width'] = res['height'] * wPH
|
|
141
|
+
res['width'] = parseInt(res['height'] * wPH)
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
+
|
|
144
145
|
if (res['width'] !== 0||res['height']!== 0) {
|
|
145
146
|
return this.size = res
|
|
146
147
|
}
|
|
@@ -149,10 +150,10 @@ export default {
|
|
|
149
150
|
let cs = window.getComputedStyle(this.$refs.rImg.parentElement)
|
|
150
151
|
let paddingX = parseFloat(cs.paddingLeft) + parseFloat(cs.paddingRight);
|
|
151
152
|
let borderX = parseFloat(cs.borderLeftWidth) + parseFloat(cs.borderRightWidth);
|
|
152
|
-
let w =
|
|
153
|
+
let w = parseInt(parseFloat(cs.getPropertyValue('width')) - paddingX - borderX);
|
|
153
154
|
return this.size = {
|
|
154
155
|
width: w,
|
|
155
|
-
height: wPH?w / wPH:0
|
|
156
|
+
height: parseInt(wPH?w / wPH:0)
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
return false
|
package/components/index.js
CHANGED
|
@@ -23,6 +23,7 @@ const list = {
|
|
|
23
23
|
},
|
|
24
24
|
'r-card': {'p': 'card/index.vue', 'c': [], 'd': ['ripple']},
|
|
25
25
|
'r-chart': {'p': 'chart/chart.vue', 'c': [], 'd': []},
|
|
26
|
+
'r-world-map': {'p': 'chart/worldMap.vue', 'c': [], 'd': []},
|
|
26
27
|
'r-chat': {
|
|
27
28
|
'p': 'chat/index.vue',
|
|
28
29
|
'c': ['r-btn', 'r-icon', 'r-progress-circle', 'r-img'],
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="slider-container"
|
|
3
|
+
:style="{
|
|
4
|
+
width:width+'px',
|
|
5
|
+
height:(width/wPH)+'px'
|
|
6
|
+
}"
|
|
3
7
|
ref="slider"
|
|
4
8
|
v-touch="{
|
|
5
9
|
'left':$r.rtl?prev:next,
|
|
6
10
|
'right':$r.rtl?next:prev
|
|
7
11
|
}">
|
|
8
|
-
|
|
12
|
+
|
|
9
13
|
<r-btn v-if="arrow" icon @click="prev" class="btn-left-arrow">
|
|
10
14
|
<r-icon v-html="$r.icons.chevron_left"></r-icon>
|
|
11
15
|
</r-btn>
|
|
12
16
|
<r-btn v-if="arrow" icon @click="next" class="btn-right-arrow">
|
|
13
17
|
<r-icon v-html="$r.icons.chevron_right"></r-icon>
|
|
14
18
|
</r-btn>
|
|
15
|
-
<transition :name="direction" mode="
|
|
19
|
+
<transition :name="direction" :mode="mode" :appear="appear">
|
|
16
20
|
<div :key="`slider-${currentIndex}`"
|
|
17
|
-
:class="{'slide-loaded':loaded,'slide-loading':!loaded}"
|
|
18
|
-
class="slider-slides"
|
|
19
|
-
|
|
20
|
-
height:(width/wPH)+'px'
|
|
21
|
-
}">
|
|
21
|
+
:class="[[slidesClass],{'slide-loaded':loaded,'slide-loading':!loaded}]"
|
|
22
|
+
class="slider-slides" >
|
|
23
|
+
<r-progress-line v-if="autoplay&&progress" class="slider-progress" :model-value="remain" color="color-one"></r-progress-line>
|
|
22
24
|
<slot v-if="width>0" :item="currentSlide" :width="width" :height="width/wPH">
|
|
23
25
|
{{ currentSlide }}
|
|
24
26
|
</slot>
|
|
@@ -58,6 +60,10 @@ export default {
|
|
|
58
60
|
type: Number,
|
|
59
61
|
default: 2
|
|
60
62
|
},
|
|
63
|
+
startIndex: {
|
|
64
|
+
type: Number,
|
|
65
|
+
default: 0
|
|
66
|
+
},
|
|
61
67
|
autoplay: {
|
|
62
68
|
type: Boolean,
|
|
63
69
|
default: false
|
|
@@ -73,14 +79,22 @@ export default {
|
|
|
73
79
|
dots: {
|
|
74
80
|
type: Boolean,
|
|
75
81
|
default: true
|
|
76
|
-
}
|
|
82
|
+
},
|
|
83
|
+
appear: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: true
|
|
86
|
+
},
|
|
87
|
+
slidesClass:{type:String,default:'out-in'},
|
|
88
|
+
mode:{type:String,default:'out-in'},
|
|
89
|
+
transitionRight:{type:String,default:'slider-right'},
|
|
90
|
+
transitionLeft:{type:String,default:'slider-left'}
|
|
77
91
|
},
|
|
78
92
|
emits:['index'],
|
|
79
93
|
data() {
|
|
80
94
|
return {
|
|
81
|
-
direction:
|
|
95
|
+
direction: this.transitionRight,
|
|
82
96
|
loaded: false,
|
|
83
|
-
currentIndex:
|
|
97
|
+
currentIndex: this.startIndex,
|
|
84
98
|
loaded_timer: null,
|
|
85
99
|
timer: null,
|
|
86
100
|
width: null,
|
|
@@ -113,7 +127,7 @@ export default {
|
|
|
113
127
|
toggle() {
|
|
114
128
|
clearInterval(this.timer)
|
|
115
129
|
this.loaded = false
|
|
116
|
-
|
|
130
|
+
clearTimeout(this.loaded_timer)
|
|
117
131
|
this.loaded_timer = setTimeout(() => {
|
|
118
132
|
this.loaded = true
|
|
119
133
|
}, 500)
|
|
@@ -128,7 +142,7 @@ export default {
|
|
|
128
142
|
|
|
129
143
|
next: function () {
|
|
130
144
|
this.toggle()
|
|
131
|
-
this.direction =
|
|
145
|
+
this.direction = this.transitionRight
|
|
132
146
|
if (this.currentIndex > this.slides.length - 2) {
|
|
133
147
|
this.currentIndex = 0
|
|
134
148
|
} else {
|
|
@@ -138,7 +152,7 @@ export default {
|
|
|
138
152
|
},
|
|
139
153
|
prev: function () {
|
|
140
154
|
this.toggle()
|
|
141
|
-
this.direction =
|
|
155
|
+
this.direction = this.transitionLeft
|
|
142
156
|
if (this.currentIndex === 0) {
|
|
143
157
|
this.currentIndex = this.slides.length - 1
|
|
144
158
|
} else {
|
|
@@ -149,9 +163,9 @@ export default {
|
|
|
149
163
|
goToSlide(i) {
|
|
150
164
|
this.toggle()
|
|
151
165
|
if (i < this.currentIndex) {
|
|
152
|
-
this.direction =
|
|
166
|
+
this.direction = this.transitionLeft
|
|
153
167
|
} else {
|
|
154
|
-
this.direction =
|
|
168
|
+
this.direction = this.transitionRight
|
|
155
169
|
}
|
|
156
170
|
|
|
157
171
|
this.currentIndex = i
|
|
@@ -165,13 +179,20 @@ export default {
|
|
|
165
179
|
}
|
|
166
180
|
},
|
|
167
181
|
beforeUnmount() {
|
|
182
|
+
clearInterval(this.timer)
|
|
183
|
+
clearTimeout(this.loaded_timer)
|
|
168
184
|
clearInterval(this.remain_id)
|
|
169
185
|
}
|
|
170
186
|
}
|
|
171
187
|
</script>
|
|
172
188
|
<style lang="scss">
|
|
173
189
|
@import '../../style/include';
|
|
174
|
-
|
|
190
|
+
.slider-progress{
|
|
191
|
+
width: 100%;
|
|
192
|
+
position: absolute;
|
|
193
|
+
top: 0;
|
|
194
|
+
z-index: 1;
|
|
195
|
+
}
|
|
175
196
|
.btn-left-arrow {
|
|
176
197
|
position: absolute;
|
|
177
198
|
top: 50%;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
@import '../../style/include';
|
|
2
2
|
|
|
3
|
-
.r-directive-animate{
|
|
4
|
-
transition-timing-function: map_get($transition,'swing');
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
.r-directive-animate {
|
|
4
|
+
transition-timing-function: map_get($transition, 'swing');
|
|
5
|
+
transition-property: opacity, transform;
|
|
6
|
+
|
|
7
|
+
&.fade {
|
|
7
8
|
opacity: 0;
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
&.animate {
|
|
9
11
|
opacity: 1;
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
|
-
|
|
14
|
+
|
|
15
|
+
&.scaleIn {
|
|
13
16
|
transform: scale(.5);
|
|
14
17
|
&.animate{
|
|
15
18
|
transform:translateZ(0) scale(1);
|
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
.r-directive-sortable {
|
|
4
4
|
position: relative;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
.dragable {
|
|
7
|
+
.grab {
|
|
7
8
|
cursor: grab;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
&.grab {
|
|
10
12
|
cursor: grab;
|
|
11
13
|
}
|
|
12
14
|
}
|
|
13
|
-
|
|
15
|
+
|
|
16
|
+
.sortable-holder {
|
|
14
17
|
background-color: rgba(20, 200, 255, 0.5);
|
|
15
18
|
}
|
|
16
19
|
.on-drag {
|
package/index.js
CHANGED
|
@@ -107,14 +107,14 @@ export default {
|
|
|
107
107
|
// renusify helper
|
|
108
108
|
app.config.globalProperties.$helper = helper
|
|
109
109
|
// renusify translate
|
|
110
|
-
app.config.globalProperties.$translate = new Translate(app.config.globalProperties.$r,app.config.globalProperties.$storage)
|
|
111
|
-
app.config.globalProperties.$dateTime = new DateTime(app.config.globalProperties.$r,app.config.globalProperties.$r.langs)
|
|
110
|
+
app.config.globalProperties.$translate = new Translate(app.config.globalProperties.$r, app.config.globalProperties.$storage)
|
|
111
|
+
app.config.globalProperties.$dateTime = new DateTime(app.config.globalProperties.$r, app.config.globalProperties.$r.langs)
|
|
112
112
|
app.config.globalProperties.$t = (key, package_name = null, lang = null) => app.config.globalProperties.$translate.get(key, package_name, lang)
|
|
113
113
|
app.config.globalProperties.$d = (value, key = 'long', local = null) => app.config.globalProperties.$dateTime.formatLocal(value, key, local)
|
|
114
|
-
const c=new Currency(app.config.globalProperties.$r)
|
|
114
|
+
const c = new Currency(app.config.globalProperties.$r)
|
|
115
115
|
app.config.globalProperties.$n = (value) => c.formatLocal(value)
|
|
116
116
|
// renusify validation
|
|
117
|
-
const v=new valid(app.config.globalProperties.$t)
|
|
117
|
+
const v = new valid(app.config.globalProperties.$t)
|
|
118
118
|
app.config.globalProperties.$v = (names) => v.checkType(names)
|
|
119
119
|
|
|
120
120
|
// install components
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export default class Currency {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
constructor($r) {
|
|
3
|
+
this.$r = $r
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
formatLocal(value) {
|
|
7
|
+
try {
|
|
8
|
+
return new Intl.NumberFormat(this.$r.lang).format(value);
|
|
9
|
+
} catch (e) {
|
|
10
|
+
console.error(e)
|
|
11
|
+
return value
|
|
12
|
+
}
|
|
11
13
|
}
|
|
12
|
-
}
|
|
13
14
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Axios from 'axios';
|
|
2
2
|
|
|
3
3
|
export default class Translate {
|
|
4
|
-
constructor($r
|
|
5
|
-
this.$r
|
|
6
|
-
this.$storage
|
|
4
|
+
constructor($r, $storage) {
|
|
5
|
+
this.$r = $r
|
|
6
|
+
this.$storage = $storage
|
|
7
7
|
this._count = 0;
|
|
8
8
|
this._failed_messages = {};
|
|
9
9
|
this._messages = {};
|
|
@@ -57,7 +57,7 @@ export default class Translate {
|
|
|
57
57
|
key = key[0]
|
|
58
58
|
if (!variable) {
|
|
59
59
|
console.error(
|
|
60
|
-
|
|
60
|
+
'object key must have variables. key:' + key + ' variable:' + variable
|
|
61
61
|
)
|
|
62
62
|
this._failed_messages[key] = true
|
|
63
63
|
return key
|
|
@@ -66,7 +66,7 @@ export default class Translate {
|
|
|
66
66
|
|
|
67
67
|
if (package_name && typeof package_name !== 'string') {
|
|
68
68
|
console.error(
|
|
69
|
-
|
|
69
|
+
'package name must be string. key:' + key + ' package_name:' + package_name
|
|
70
70
|
)
|
|
71
71
|
this._failed_messages[key] = true
|
|
72
72
|
return key
|
|
@@ -138,24 +138,24 @@ export default class Translate {
|
|
|
138
138
|
locale = this.$storage.get("lang");
|
|
139
139
|
}
|
|
140
140
|
Axios.get(`/translate/${pack}/${locale}`).then(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
141
|
+
res => {
|
|
142
|
+
if (res.data.length !== 0) {
|
|
143
|
+
const lang = {};
|
|
144
|
+
const lng = res.data.length
|
|
145
|
+
for (let i = 0; i < lng; i++) {
|
|
146
|
+
lang[res.data[i].key] = res.data[i][locale];
|
|
147
|
+
}
|
|
148
|
+
this.local = locale;
|
|
149
|
+
this.setMessages(lang);
|
|
150
|
+
} else {
|
|
151
|
+
this.local = locale;
|
|
152
|
+
this.setMessages({});
|
|
147
153
|
}
|
|
148
|
-
this.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
this.
|
|
152
|
-
this.setMessages({});
|
|
154
|
+
this.$r.store['langs_loaded'][pack] = true;
|
|
155
|
+
},
|
|
156
|
+
() => {
|
|
157
|
+
this.$r.store['langs_loaded'][pack] = true;
|
|
153
158
|
}
|
|
154
|
-
this.$r.store['langs_loaded'][pack] = true;
|
|
155
|
-
},
|
|
156
|
-
() => {
|
|
157
|
-
this.$r.store['langs_loaded'][pack] = true;
|
|
158
|
-
}
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
161
|
}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
export default class Validate {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
required() {
|
|
6
|
-
let msg = this.$t('required_error','renusify');
|
|
7
|
-
return (v) => !!(v !== undefined && v !== null && v !== '') || msg
|
|
8
|
-
}
|
|
2
|
+
constructor($t) {
|
|
3
|
+
this.$t = $t
|
|
4
|
+
}
|
|
9
5
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
required() {
|
|
7
|
+
let msg = this.$t('required_error', 'renusify');
|
|
8
|
+
return (v) => !!(v !== undefined && v !== null && v !== '') || msg
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
requiredArray() {
|
|
12
|
+
return (v) => (v !== undefined && v !== null && v.length > 0) || this.$t('required_error', 'renusify');
|
|
13
|
+
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
email() {
|
|
16
|
+
return (v) => (v && v.length > 0 ? /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) : true) || this.$t('validate_email', 'renusify');
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
url() {
|
|
19
|
-
|
|
20
|
+
return (v) => (v && v.length > 0 ? /^((https?|ftp|smtp):\/\/)?(www.)?[a-z0-9]+\.[a-z]+(\/[a-zA-Z0-9#]+\/?)*$/.test(v) : true) || this.$t('validate_url', 'renusify');
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
match(val) {
|
|
@@ -24,49 +25,49 @@ export default class Validate {
|
|
|
24
25
|
if (v == val) {
|
|
25
26
|
return true
|
|
26
27
|
} else {
|
|
27
|
-
|
|
28
|
+
return this.$t(['validate_match', [val]], 'renusify');
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
phone() {
|
|
33
|
-
|
|
34
|
+
return (v) => (v && v.length > 0 ? /^[+]?[(]?[0-9]{3}[)]?[-\s.]?[0-9]{3}[-\s.]?[0-9]{4}$/.test(v) : true) || this.$t('validate_phone', 'renusify');
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
number() {
|
|
37
|
-
|
|
38
|
+
return (v) => (v && v.length > 0 ? /^([0-9.])*$/.test(v) : true) || this.$t('numeric_error', 'renusify');
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
english() {
|
|
41
|
-
|
|
42
|
+
return (v) => (v && v.length > 0 ? /^([0-9a-zA-Z])*$/.test(v) : true) || this.$t('english_error', 'renusify');
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
min_len(num) {
|
|
45
|
-
|
|
46
|
+
return v => (v && v.length > 0 ? v.length >= parseInt(num) ? true : this.$t(['min_len_error', [num, v.length]], 'renusify') : true)
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
max_len(num) {
|
|
49
|
-
|
|
50
|
+
return v => (v && v.length > 0 ? v.length <= parseInt(num) ? true : this.$t(['max_len_error', [num, v.length]], 'renusify') : true)
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
len(num) {
|
|
53
|
-
|
|
54
|
+
return v => (v && v.length > 0 ? v.length === parseInt(num) ? true : this.$t(['len_error', [num, v.length]], 'renusify') : true) || msg
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
min(num) {
|
|
57
|
-
|
|
58
|
+
return v => (v ? parseFloat(v) >= parseFloat(num) ? true : this.$t(['min_error', [num, parseFloat(v)]], 'renusify') : true)
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
max(num) {
|
|
61
|
-
|
|
62
|
+
return v => (v ? parseFloat(v) <= parseFloat(num) ? true : this.$t(['max_error', [num, parseFloat(v)]], 'renusify') : true)
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
eq(num) {
|
|
65
|
-
|
|
66
|
+
return v => (v ? parseFloat(v) === parseFloat(num) : true) || this.$t(['validate_eq', [num]], 'renusify');
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
notDefined(name) {
|
|
69
|
-
|
|
70
|
+
return v => this.$t(['validate_notDefined', [name]], 'renusify');
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
checkType(names) {
|
package/tools/helper.js
CHANGED
|
@@ -35,9 +35,9 @@ export function copy(text, msg = null) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
navigator.clipboard.writeText(text).then(function () {
|
|
38
|
-
Toast.show(msg ||'
|
|
38
|
+
Toast.show(msg || 'text copied.', {type: 'success'});
|
|
39
39
|
}, function () {
|
|
40
|
-
Toast.show(
|
|
40
|
+
Toast.show('text not copied.', {type: 'error'});
|
|
41
41
|
})
|
|
42
42
|
}
|
|
43
43
|
|