renusify 1.3.1 → 1.4.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/form/check-input.vue +3 -2
- package/components/form/group-input.vue +1 -1
- package/components/form/input.vue +2 -2
- package/components/form/json/JsonView.vue +13 -5
- package/components/form/json/index.vue +16 -16
- package/components/form/rating.vue +22 -5
- package/components/form/timepicker/timepicker.vue +6 -6
- package/components/img/index.vue +34 -15
- package/directive/animate/index.js +1 -1
- package/directive/animate/style.scss +1 -1
- package/directive/sortable/index.js +2 -2
- package/directive/sortable/style.scss +1 -1
- package/directive/title/index.js +6 -8
- package/directive/title/style.scss +2 -2
- package/index.js +11 -9
- package/package.json +1 -1
- package/plugins/trans/Currency.js +5 -6
- package/plugins/trans/DateTime.js +6 -6
- package/plugins/trans/Translate.js +140 -131
- package/plugins/validation/Validate.js +20 -22
- package/tools/helper.js +4 -2
- package/plugins/validation/index.js +0 -10
|
@@ -16,11 +16,12 @@
|
|
|
16
16
|
ref="input"
|
|
17
17
|
/>
|
|
18
18
|
<r-btn size="small"
|
|
19
|
+
:class="{'color-success-text':pass!==null && pass!==false,'color-error-text':pass===false}"
|
|
19
20
|
:rounded="$attrs.tile===undefined||$attrs.tile===false"
|
|
20
21
|
:loading="loading" @click.prevent="check()" class="elevation-none mx-1">
|
|
21
22
|
{{ $t('check', 'renusify') }}
|
|
22
|
-
<r-icon v-if="pass!==null && pass!==false" v-html="$r.icons.check" exact width="20" height="20"></r-icon>
|
|
23
|
-
<r-icon v-if=" pass===false" v-html="$r.icons.close" width="20" height="20"></r-icon>
|
|
23
|
+
<r-icon class="color-success-text" v-if="pass!==null && pass!==false" v-html="$r.icons.check" exact width="20" height="20"></r-icon>
|
|
24
|
+
<r-icon class="color-error-text" v-if=" pass===false" v-html="$r.icons.close" width="20" height="20"></r-icon>
|
|
24
25
|
</r-btn>
|
|
25
26
|
</div>
|
|
26
27
|
</r-input>
|
|
@@ -9,7 +9,7 @@
|
|
|
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 :is="template[k]['type']" v-model="item[k]" :label="t(k)"
|
|
12
|
+
<component v-if="template[k]&&template[k]['type']" :is="template[k]['type']" v-model="item[k]" :label="t(k)"
|
|
13
13
|
class="flex-grow-0 me-1" v-bind="template[k]['props']"></component>
|
|
14
14
|
</template>
|
|
15
15
|
</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||validations.length>0,
|
|
7
7
|
'hide-detail':c_hide,
|
|
8
8
|
'input-focused':active,
|
|
9
9
|
'input-disabled':isDisabled,
|
|
@@ -72,7 +72,7 @@ export default {
|
|
|
72
72
|
uid: 'input_' + this.$helper.uniqueId(),
|
|
73
73
|
lazyValue: this.modelValue,
|
|
74
74
|
focused: false,
|
|
75
|
-
errorBucket:
|
|
75
|
+
errorBucket: [],
|
|
76
76
|
hasColor: false,
|
|
77
77
|
hasFocused: false,
|
|
78
78
|
hasInput: false,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<r-btn v-if="!disableDel" icon class="color-error-text" text @click="del(key)">
|
|
7
7
|
<r-icon v-html="$r.icons.delete"></r-icon>
|
|
8
8
|
</r-btn>
|
|
9
|
-
<div v-if="typeof value==='object'">{{ key }}</div>
|
|
9
|
+
<div v-if="typeof value==='object'">{{ t(key) }}</div>
|
|
10
10
|
</div>
|
|
11
11
|
<div v-if="typeof value==='object'" class="flex-grow-1 w-full ps-10">
|
|
12
12
|
<r-json-input :tile="tile"
|
|
@@ -14,21 +14,22 @@
|
|
|
14
14
|
@update:model-value="emit(key,$event)"
|
|
15
15
|
:disableAdd="disableAdd||template!==undefined"
|
|
16
16
|
:disableDel="disableDel||template!==undefined"
|
|
17
|
+
:translate="translate"
|
|
17
18
|
disableEditKey
|
|
18
19
|
></r-json-input>
|
|
19
20
|
</div>
|
|
20
21
|
<div v-else class="mb-1 flex-grow-1">
|
|
21
22
|
<r-text-input v-if="typeof value==='string'"
|
|
22
23
|
:tile="tile"
|
|
23
|
-
:label="!is_array?key:''"
|
|
24
|
+
:label="!is_array?t(key):''"
|
|
24
25
|
:model-value="value" @update:model-value="emit(key,$event)"></r-text-input>
|
|
25
26
|
<r-number-input v-else-if="typeof value==='number'"
|
|
26
27
|
:tile="tile"
|
|
27
|
-
:label="!is_array?key:''"
|
|
28
|
+
:label="!is_array?t(key):''"
|
|
28
29
|
:model-value="value" @update:model-value="emit(key,$event)"></r-number-input>
|
|
29
30
|
<r-switch-input v-else-if="typeof value==='boolean'"
|
|
30
31
|
:tile="tile"
|
|
31
|
-
:label="!is_array?key:''"
|
|
32
|
+
:label="!is_array?t(key):''"
|
|
32
33
|
:model-value="value" @update:model-value="emit(key,$event)"></r-switch-input>
|
|
33
34
|
|
|
34
35
|
</div>
|
|
@@ -43,7 +44,8 @@ export default {
|
|
|
43
44
|
template: Object,
|
|
44
45
|
disableAdd: Boolean,
|
|
45
46
|
disableDel: Boolean,
|
|
46
|
-
tile: Boolean
|
|
47
|
+
tile: Boolean,
|
|
48
|
+
translate:Boolean
|
|
47
49
|
},
|
|
48
50
|
emits: ['update:modelValue'],
|
|
49
51
|
data() {
|
|
@@ -57,6 +59,12 @@ export default {
|
|
|
57
59
|
}
|
|
58
60
|
},
|
|
59
61
|
methods: {
|
|
62
|
+
t(key){
|
|
63
|
+
if(this.translate){
|
|
64
|
+
return this.$t(key)
|
|
65
|
+
}
|
|
66
|
+
return key
|
|
67
|
+
},
|
|
60
68
|
del(key) {
|
|
61
69
|
let o = this.modelValue
|
|
62
70
|
if (this.is_array) {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
:template="template"
|
|
11
11
|
:disableAdd="disableAdd"
|
|
12
12
|
:disableDel="disableDel"
|
|
13
|
+
:translate="translate"
|
|
13
14
|
:tile="tile"
|
|
14
15
|
></json-view>
|
|
15
16
|
<r-btn
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
<r-text-input
|
|
25
26
|
v-if="!is_array"
|
|
26
27
|
v-model="info.key"
|
|
27
|
-
:label="keyLabel"
|
|
28
|
+
:label="keyLabel||$t('key','renusify')"
|
|
28
29
|
:tile="tile"
|
|
29
30
|
class="w-30 pe-1"></r-text-input>
|
|
30
31
|
<div class="w-20" v-if="!valueType">
|
|
@@ -34,31 +35,32 @@
|
|
|
34
35
|
:items="['text','number','boolean','json','array']"
|
|
35
36
|
just-value
|
|
36
37
|
disableSearch
|
|
38
|
+
:translate="translate"
|
|
37
39
|
@update:model-value="info.value=null"
|
|
38
40
|
firstSelect></r-select-input>
|
|
39
41
|
</div>
|
|
40
|
-
<r-text-input v-if="
|
|
42
|
+
<r-text-input v-if="info.type==='text'"
|
|
41
43
|
:tile="tile"
|
|
42
|
-
:label="valueLabel"
|
|
44
|
+
:label="valueLabel||$t('value','renusify')"
|
|
43
45
|
v-model="info.value"></r-text-input>
|
|
44
|
-
<r-number-input v-else-if="
|
|
46
|
+
<r-number-input v-else-if="info.type==='number'"
|
|
45
47
|
:tile="tile"
|
|
46
|
-
:label="
|
|
47
|
-
<r-switch-input v-else-if="
|
|
48
|
+
:label="valueLabel||$t('value','renusify')" v-model="info.value"></r-number-input>
|
|
49
|
+
<r-switch-input v-else-if="info.type==='boolean'"
|
|
48
50
|
:tile="tile"
|
|
49
|
-
:label="
|
|
51
|
+
:label="valueLabel||$t('value','renusify')" v-model="info.value"></r-switch-input>
|
|
50
52
|
<r-btn @click.prevent="add" class="ms-1 color-success" rounded>{{ $t('add', 'renusify') }}</r-btn>
|
|
51
53
|
</div>
|
|
52
54
|
</div>
|
|
53
55
|
<textarea v-else :class="{'state-error':error}"
|
|
54
|
-
:rows="Object.keys(modelValue).length+5"
|
|
56
|
+
:rows="modelValue?Object.keys(modelValue).length+5:5"
|
|
55
57
|
autocapitalize="off"
|
|
56
58
|
autocomplete="off"
|
|
57
59
|
autocorrect="off"
|
|
58
60
|
class="ltr w-full"
|
|
59
61
|
spellcheck="false"
|
|
60
62
|
@input="emitt"
|
|
61
|
-
@keydown="setTab">{{ JSON.stringify(modelValue, null, 4) }}</textarea>
|
|
63
|
+
@keydown="setTab">{{ JSON.stringify(modelValue||{}, null, 4) }}</textarea>
|
|
62
64
|
</div>
|
|
63
65
|
</template>
|
|
64
66
|
<script>
|
|
@@ -85,7 +87,8 @@ export default {
|
|
|
85
87
|
disableAdd: Boolean,
|
|
86
88
|
tile: Boolean,
|
|
87
89
|
disableEditKey: Boolean,
|
|
88
|
-
disableDel: Boolean
|
|
90
|
+
disableDel: Boolean,
|
|
91
|
+
translate: Boolean
|
|
89
92
|
},
|
|
90
93
|
emits: ['update:modelValue'],
|
|
91
94
|
data() {
|
|
@@ -98,12 +101,6 @@ export default {
|
|
|
98
101
|
}
|
|
99
102
|
},
|
|
100
103
|
computed: {
|
|
101
|
-
val_type() {
|
|
102
|
-
if (this.valueType) {
|
|
103
|
-
return this.valueType
|
|
104
|
-
}
|
|
105
|
-
return this.info.type
|
|
106
|
-
},
|
|
107
104
|
is_array() {
|
|
108
105
|
if (this.baseArray) {
|
|
109
106
|
return true
|
|
@@ -166,6 +163,9 @@ export default {
|
|
|
166
163
|
d.push(Object.assign({}, {}, this.template))
|
|
167
164
|
this.$emit('update:modelValue', d)
|
|
168
165
|
} else {
|
|
166
|
+
if(this.valueType){
|
|
167
|
+
this.info.type=this.valueType
|
|
168
|
+
}
|
|
169
169
|
this.show = true
|
|
170
170
|
}
|
|
171
171
|
},
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="`${$r.prefix}rating `">
|
|
2
|
+
<div :class="`${$r.prefix}rating size-${size} ms-n1`">
|
|
3
3
|
<r-btn :class="`${Math.round(modelValue)>=i?'color-warning-text':''}`" :key="i"
|
|
4
4
|
:readonly="readonly"
|
|
5
|
-
:size="size"
|
|
6
5
|
@click="select(i)"
|
|
7
6
|
icon
|
|
8
7
|
text
|
|
@@ -34,7 +33,7 @@ export default {
|
|
|
34
33
|
emits:['update:modelValue'],
|
|
35
34
|
created(){
|
|
36
35
|
if(!this.$r.icons.star) {
|
|
37
|
-
this.$r.icons.star = '<svg xmlns="http://www.w3.org/2000/svg"
|
|
36
|
+
this.$r.icons.star = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.62L12 2L9.19 8.62L2 9.24l5.45 4.73L5.82 21L12 17.27Z"/></svg>'
|
|
38
37
|
}
|
|
39
38
|
},
|
|
40
39
|
methods: {
|
|
@@ -46,13 +45,31 @@ export default {
|
|
|
46
45
|
</script>
|
|
47
46
|
<style lang="scss">
|
|
48
47
|
@import "../../style/include";
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
$btn-sizes: (
|
|
49
|
+
'x-small': 20,
|
|
50
|
+
'small': 25,
|
|
51
|
+
'default': 30,
|
|
52
|
+
'large': 35,
|
|
53
|
+
'x-large': 40
|
|
54
|
+
) !default;
|
|
51
55
|
.#{$prefix}rating {
|
|
52
56
|
max-width: 100%;
|
|
53
57
|
white-space: nowrap;
|
|
54
58
|
transition: 1s $primary-transition;
|
|
55
59
|
color: var(--color-disabled);
|
|
60
|
+
|
|
61
|
+
@each $name, $size in $btn-sizes {
|
|
62
|
+
&.size-#{$name} {
|
|
63
|
+
.#{$prefix}btn{
|
|
64
|
+
height: #{$size}px;
|
|
65
|
+
width: #{$size}px
|
|
66
|
+
}
|
|
67
|
+
.#{$prefix}icon{
|
|
68
|
+
height: #{$size - 4px};
|
|
69
|
+
width: #{$size - 4px}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
56
73
|
}
|
|
57
74
|
|
|
58
75
|
</style>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
:key="i"
|
|
11
11
|
class="number"
|
|
12
12
|
:class="['number' + i,{'number-disabled':disableTime(parseInt(i),show,hour,min,sec)}]"
|
|
13
|
-
|
|
13
|
+
ref="number"
|
|
14
14
|
@click="set(i)"
|
|
15
15
|
>
|
|
16
16
|
{{ num }}
|
|
@@ -349,7 +349,7 @@ export default {
|
|
|
349
349
|
set(h, next = true) {
|
|
350
350
|
h = parseInt(h);
|
|
351
351
|
const circle = this.$refs.circle;
|
|
352
|
-
const cl = this.$refs["number"
|
|
352
|
+
const cl = this.$refs["number"][h];
|
|
353
353
|
const hand = this.$refs.hand;
|
|
354
354
|
const clock = this.$refs.clock.getBoundingClientRect();
|
|
355
355
|
|
|
@@ -440,7 +440,7 @@ export default {
|
|
|
440
440
|
let cl = null;
|
|
441
441
|
let po = null;
|
|
442
442
|
for (let i = 1; i <= 12; i++) {
|
|
443
|
-
cl = this.$refs["number"
|
|
443
|
+
cl = this.$refs["number"][i];
|
|
444
444
|
po = this.print_point(i, 110);
|
|
445
445
|
cl.style.left = po[0] - 10 + "px";
|
|
446
446
|
cl.style.top = po[1] - 10 + "px";
|
|
@@ -448,13 +448,13 @@ export default {
|
|
|
448
448
|
}
|
|
449
449
|
if (this.is24Hour) {
|
|
450
450
|
for (let i = 13; i <= 23; i++) {
|
|
451
|
-
cl = this.$refs["number"
|
|
451
|
+
cl = this.$refs["number"][i];
|
|
452
452
|
po = this.print_point(i, 70);
|
|
453
453
|
cl.style.left = po[0] - 10 + "px";
|
|
454
454
|
cl.style.top = po[1] - 10 + "px";
|
|
455
455
|
cl.classList.add('number-show')
|
|
456
456
|
}
|
|
457
|
-
cl = this.$refs["
|
|
457
|
+
cl = this.$refs["number"][0];
|
|
458
458
|
po = this.print_point(0, 70);
|
|
459
459
|
cl.style.left = po[0] - 10 + "px";
|
|
460
460
|
cl.style.top = po[1] - 10 + "px";
|
|
@@ -473,7 +473,7 @@ export default {
|
|
|
473
473
|
let cl = null;
|
|
474
474
|
let po = null;
|
|
475
475
|
for (let i = 0; i <= 59; i++) {
|
|
476
|
-
cl = this.$refs["number"
|
|
476
|
+
cl = this.$refs["number"][i];
|
|
477
477
|
po = this.print_point(i, 110, 60);
|
|
478
478
|
cl.style.left = po[0] - 10 + "px";
|
|
479
479
|
cl.style.top = po[1] - 10 + "px";
|
package/components/img/index.vue
CHANGED
|
@@ -14,8 +14,11 @@
|
|
|
14
14
|
}"
|
|
15
15
|
>{{ alt }}
|
|
16
16
|
</div>
|
|
17
|
-
<img v-if="load &&!isSvg" ref="img" :src="link" :alt="alt" draggable="false" :width="size.width"
|
|
18
|
-
:height="size.height"
|
|
17
|
+
<img v-if="load &&!isSvg" ref="img" :src="link" :alt="alt" draggable="false" :width="size.width>0?size.width:'auto'"
|
|
18
|
+
:height="size.height>0?size.height:'auto'"
|
|
19
|
+
:style="{'height':size.height>0?undefined:'auto',
|
|
20
|
+
'width':size.width>0?undefined:'auto'
|
|
21
|
+
}"/>
|
|
19
22
|
<svg-img v-else-if="load &&isSvg&&link" :link="link" :size="size">
|
|
20
23
|
</svg-img>
|
|
21
24
|
</div>
|
|
@@ -61,10 +64,7 @@ export default {
|
|
|
61
64
|
titleVe: Boolean,
|
|
62
65
|
isSvg: Boolean,
|
|
63
66
|
svgCache: {type: Number, default: 86400},
|
|
64
|
-
wPH:
|
|
65
|
-
type: Number,
|
|
66
|
-
default: 1
|
|
67
|
-
},
|
|
67
|
+
wPH: Number
|
|
68
68
|
},
|
|
69
69
|
data() {
|
|
70
70
|
return {
|
|
@@ -97,7 +97,10 @@ export default {
|
|
|
97
97
|
res += 'c=' + this.svgCache
|
|
98
98
|
}
|
|
99
99
|
if (!this.isSvg && ((this.autoSize && this.size.width > 0) || this.width)) {
|
|
100
|
-
res += `&w=${this.size.width}
|
|
100
|
+
res += `&w=${this.size.width}`
|
|
101
|
+
}
|
|
102
|
+
if (!this.isSvg && ((this.autoSize && this.size.height > 0) || this.height)) {
|
|
103
|
+
res += `&h=${this.size.height}`
|
|
101
104
|
}
|
|
102
105
|
return res
|
|
103
106
|
}
|
|
@@ -116,13 +119,29 @@ export default {
|
|
|
116
119
|
if (this.height) {
|
|
117
120
|
res["height"] = this.height
|
|
118
121
|
}
|
|
119
|
-
|
|
120
|
-
|
|
122
|
+
let wPH=this.wPH
|
|
123
|
+
if(!wPH){
|
|
124
|
+
const ls=this.src.split('/')
|
|
125
|
+
if(ls.length>0){
|
|
126
|
+
const p=ls[ls.length-1].split('_')
|
|
127
|
+
if(p.length===3){
|
|
128
|
+
const p0=parseInt(p[0])
|
|
129
|
+
const p1=parseInt(p[1])
|
|
130
|
+
if(p0&&p1){
|
|
131
|
+
wPH=p0/p1
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
121
135
|
}
|
|
122
|
-
if
|
|
123
|
-
res['width']
|
|
136
|
+
if(wPH) {
|
|
137
|
+
if (res['width'] !== 0 && res['height'] === 0) {
|
|
138
|
+
res['height'] = res['width'] / wPH
|
|
139
|
+
}
|
|
140
|
+
if (res['width'] === 0 && res['height'] !== 0) {
|
|
141
|
+
res['width'] = res['height'] * wPH
|
|
142
|
+
}
|
|
124
143
|
}
|
|
125
|
-
if (res['width'] !== 0) {
|
|
144
|
+
if (res['width'] !== 0||res['height']!== 0) {
|
|
126
145
|
return this.size = res
|
|
127
146
|
}
|
|
128
147
|
|
|
@@ -133,7 +152,7 @@ export default {
|
|
|
133
152
|
let w = parseFloat((parseFloat(cs.getPropertyValue('width')) - paddingX - borderX).toFixed(2));
|
|
134
153
|
return this.size = {
|
|
135
154
|
width: w,
|
|
136
|
-
height: w /
|
|
155
|
+
height: wPH?w / wPH:0
|
|
137
156
|
}
|
|
138
157
|
}
|
|
139
158
|
return false
|
|
@@ -141,7 +160,7 @@ export default {
|
|
|
141
160
|
},
|
|
142
161
|
activate() {
|
|
143
162
|
this.getSize()
|
|
144
|
-
if (this.size.width !== 0) {
|
|
163
|
+
if (this.size.width !== 0||this.size.height) {
|
|
145
164
|
this.load = true
|
|
146
165
|
} else {
|
|
147
166
|
clearTimeout(this.time_id)
|
|
@@ -229,4 +248,4 @@ export default {
|
|
|
229
248
|
|
|
230
249
|
}
|
|
231
250
|
}
|
|
232
|
-
</style>
|
|
251
|
+
</style>
|
|
@@ -7,7 +7,7 @@ function mounted(el, binding) {
|
|
|
7
7
|
const duration = value.duration || .5
|
|
8
8
|
const timing = value.timing || null
|
|
9
9
|
const delay = value.delay + 50 || 50
|
|
10
|
-
el.classList.add(
|
|
10
|
+
el.classList.add(`r-directive-animate`)
|
|
11
11
|
names.forEach((name) => {
|
|
12
12
|
el.classList.add(name)
|
|
13
13
|
})
|
|
@@ -134,7 +134,7 @@ function mounted(el, binding) {
|
|
|
134
134
|
end: value.end,
|
|
135
135
|
grab: value.grab
|
|
136
136
|
}
|
|
137
|
-
el.classList.add(
|
|
137
|
+
el.classList.add(`r-directive-sortable`);
|
|
138
138
|
el.eventsHandler = {
|
|
139
139
|
mousedown: e => mousestart(e, wrapper),
|
|
140
140
|
touchstart: e => mousestart(e, wrapper)
|
|
@@ -169,7 +169,7 @@ function unmounted(el, binding) {
|
|
|
169
169
|
let wrapper = {
|
|
170
170
|
grab: value.grab
|
|
171
171
|
}
|
|
172
|
-
el.classList.remove(
|
|
172
|
+
el.classList.remove(`r-directive-sortable`);
|
|
173
173
|
const lng=children.length
|
|
174
174
|
for(let i=0;i<lng;i++){
|
|
175
175
|
let child=children[i]
|
package/directive/title/index.js
CHANGED
|
@@ -8,10 +8,10 @@ function mousestart(el, binding) {
|
|
|
8
8
|
d = binding.arg
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
let $title = document.getElementById(
|
|
11
|
+
let $title = document.getElementById(`r-directive-title`)
|
|
12
12
|
if (!$title) {
|
|
13
13
|
$title = document.createElement('div')
|
|
14
|
-
$title.setAttribute('id',
|
|
14
|
+
$title.setAttribute('id', `r-directive-title`)
|
|
15
15
|
} else {
|
|
16
16
|
mouseleave(el, binding)
|
|
17
17
|
mousestart(el, binding)
|
|
@@ -21,8 +21,7 @@ function mousestart(el, binding) {
|
|
|
21
21
|
var $titleDimension = el.getBoundingClientRect()
|
|
22
22
|
$title.innerHTML = binding.value
|
|
23
23
|
$title.style.opacity = 1
|
|
24
|
-
|
|
25
|
-
app[0].appendChild($title)
|
|
24
|
+
document.body.appendChild($title)
|
|
26
25
|
const h = $title.getBoundingClientRect().height + 5
|
|
27
26
|
const w = $title.getBoundingClientRect().width + 5
|
|
28
27
|
|
|
@@ -48,7 +47,7 @@ function mouseleave(el, binding) {
|
|
|
48
47
|
if (['left', 'right', 'top', 'bottom'].includes(binding.arg)) {
|
|
49
48
|
d = binding.arg
|
|
50
49
|
}
|
|
51
|
-
let elm = document.getElementById(
|
|
50
|
+
let elm = document.getElementById(`r-directive-title`)
|
|
52
51
|
|
|
53
52
|
if (elm === null) {
|
|
54
53
|
return null
|
|
@@ -65,12 +64,11 @@ function mouseleave(el, binding) {
|
|
|
65
64
|
elm.style.left = $titleDimension.left + $titleDimension.width + 'px'
|
|
66
65
|
}
|
|
67
66
|
|
|
68
|
-
elm = document.getElementById(
|
|
67
|
+
elm = document.getElementById(`r-directive-title`)
|
|
69
68
|
if (elm === null) {
|
|
70
69
|
return null
|
|
71
70
|
}
|
|
72
|
-
|
|
73
|
-
app[0].removeChild(elm)
|
|
71
|
+
document.body.removeChild(elm)
|
|
74
72
|
}
|
|
75
73
|
|
|
76
74
|
function createHandlers(el, binding) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@import "../../style/include";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
#r-directive-title {
|
|
4
4
|
transition: all .2s ease-in-out;
|
|
5
5
|
padding: 4px 8px;
|
|
6
6
|
white-space: nowrap;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
position: fixed;
|
|
10
10
|
border-radius: map-get($borders, 'sm');
|
|
11
11
|
font-size: 14px;
|
|
12
|
-
font-family:
|
|
12
|
+
font-family: fontOne;
|
|
13
13
|
transform: translateX(-50%);
|
|
14
14
|
z-index: 50;
|
|
15
15
|
opacity: 0;
|
package/index.js
CHANGED
|
@@ -101,17 +101,21 @@ export default {
|
|
|
101
101
|
app.config.globalProperties.$toast = function (message, options) {
|
|
102
102
|
Toast.show(message, options);
|
|
103
103
|
}
|
|
104
|
+
// renusify storage
|
|
105
|
+
app.config.globalProperties.$storage = Storage
|
|
106
|
+
|
|
104
107
|
// renusify helper
|
|
105
108
|
app.config.globalProperties.$helper = helper
|
|
106
109
|
// renusify translate
|
|
107
|
-
app.config.globalProperties.$translate = Translate
|
|
108
|
-
|
|
109
|
-
app.config.globalProperties.$
|
|
110
|
-
app.config.globalProperties.$
|
|
111
|
-
app.config.globalProperties.$
|
|
112
|
-
app.config.globalProperties.$n = (value) =>
|
|
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
|
+
app.config.globalProperties.$t = (key, package_name = null, lang = null) => app.config.globalProperties.$translate.get(key, package_name, lang)
|
|
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)
|
|
115
|
+
app.config.globalProperties.$n = (value) => c.formatLocal(value)
|
|
113
116
|
// renusify validation
|
|
114
|
-
app.config.globalProperties.$
|
|
117
|
+
const v=new valid(app.config.globalProperties.$t)
|
|
118
|
+
app.config.globalProperties.$v = (names) => v.checkType(names)
|
|
115
119
|
|
|
116
120
|
// install components
|
|
117
121
|
let required_directive = register(app, options['components'] || []);
|
|
@@ -125,8 +129,6 @@ export default {
|
|
|
125
129
|
// install directives
|
|
126
130
|
registers(app, required_directive);
|
|
127
131
|
|
|
128
|
-
// renusify storage
|
|
129
|
-
app.config.globalProperties.$storage = Storage
|
|
130
132
|
|
|
131
133
|
// renusify breakpoint
|
|
132
134
|
function resize() {
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export default class Currency {
|
|
2
|
+
constructor($r) {
|
|
3
|
+
this.$r=$r
|
|
4
|
+
}
|
|
4
5
|
formatLocal (value) {
|
|
5
6
|
try {
|
|
6
|
-
return new Intl.NumberFormat(
|
|
7
|
+
return new Intl.NumberFormat(this.$r.lang).format(value);
|
|
7
8
|
}catch (e) {
|
|
8
9
|
console.error(e)
|
|
9
10
|
return value
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
export default new Currency();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
class DateTime {
|
|
2
|
-
constructor() {
|
|
1
|
+
export default class DateTime {
|
|
2
|
+
constructor($r,langs) {
|
|
3
|
+
this.$r=$r
|
|
3
4
|
this.format = {
|
|
4
5
|
narrow: {
|
|
5
6
|
weekday: 'narrow'
|
|
@@ -33,7 +34,7 @@ class DateTime {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
this.langs =
|
|
37
|
+
this.langs = langs;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
set_lang(name, lang) {
|
|
@@ -54,8 +55,8 @@ class DateTime {
|
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
formatLocal(value, type = 'long', local = null) {
|
|
57
|
-
if (local === null
|
|
58
|
-
local =
|
|
58
|
+
if (local === null) {
|
|
59
|
+
local = this.$r.lang
|
|
59
60
|
}
|
|
60
61
|
if (!(local in this.langs)) {
|
|
61
62
|
console.warn('set local:' + local + ' with this.$dateTime.set_lang("' + local + '",{\n' +
|
|
@@ -79,4 +80,3 @@ class DateTime {
|
|
|
79
80
|
};
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
export default new DateTime();
|
|
@@ -1,152 +1,161 @@
|
|
|
1
1
|
import Axios from 'axios';
|
|
2
2
|
|
|
3
|
-
class Translate {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
export default class Translate {
|
|
4
|
+
constructor($r,$storage) {
|
|
5
|
+
this.$r=$r
|
|
6
|
+
this.$storage=$storage
|
|
7
|
+
this._count = 0;
|
|
8
|
+
this._failed_messages = {};
|
|
9
|
+
this._messages = {};
|
|
10
|
+
this._local = 'en';
|
|
11
|
+
this._package = null;
|
|
12
|
+
this._store = []
|
|
13
|
+
}
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
get messages() {
|
|
16
|
+
return this._messages;
|
|
17
|
+
}
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
get failed_messages() {
|
|
20
|
+
return Object.keys(this._failed_messages);
|
|
21
|
+
}
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
get local() {
|
|
24
|
+
return this._local;
|
|
25
|
+
}
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
set local(value) {
|
|
28
|
+
this._local = value;
|
|
29
|
+
}
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
set package(value) {
|
|
32
|
+
this._package = value;
|
|
33
|
+
}
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
this._messages[this._local][key] = value;
|
|
37
|
-
}
|
|
35
|
+
setMessages(obj, local) {
|
|
36
|
+
this._messages[local || this._local] = Object.assign({}, this._messages[local || this._local], obj);
|
|
37
|
+
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
add(key, value) {
|
|
40
|
+
if (!this._messages[this._local]) {
|
|
41
|
+
this._messages[this._local] = {}
|
|
41
42
|
}
|
|
43
|
+
this._messages[this._local][key] = value;
|
|
44
|
+
}
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
let variable=[]
|
|
48
|
-
if (typeof key ==='object'){
|
|
49
|
-
variable=key[1]
|
|
50
|
-
key=key[0]
|
|
51
|
-
if(!variable){
|
|
52
|
-
console.error(
|
|
53
|
-
'object key must have variables. key:'+key+' variable:'+variable
|
|
54
|
-
)
|
|
55
|
-
return key
|
|
56
|
-
}
|
|
57
|
-
}
|
|
46
|
+
replaceAll(string, search, replace) {
|
|
47
|
+
return string.split(search).join(replace);
|
|
48
|
+
}
|
|
58
49
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
get(key, package_name = null, lang = null) {
|
|
51
|
+
if (key === undefined || key === null) {
|
|
52
|
+
return ''
|
|
53
|
+
}
|
|
54
|
+
let variable = []
|
|
55
|
+
if (typeof key === 'object') {
|
|
56
|
+
variable = key[1]
|
|
57
|
+
key = key[0]
|
|
58
|
+
if (!variable) {
|
|
59
|
+
console.error(
|
|
60
|
+
'object key must have variables. key:' + key + ' variable:' + variable
|
|
61
|
+
)
|
|
62
|
+
this._failed_messages[key] = true
|
|
63
|
+
return key
|
|
64
|
+
}
|
|
65
|
+
}
|
|
69
66
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
val = this.replaceAll(val, '{' + i + '}', variable[i]);
|
|
83
|
-
}
|
|
67
|
+
if (package_name && typeof package_name !== 'string') {
|
|
68
|
+
console.error(
|
|
69
|
+
'package name must be string. key:' + key + ' package_name:' + package_name
|
|
70
|
+
)
|
|
71
|
+
this._failed_messages[key] = true
|
|
72
|
+
return key
|
|
73
|
+
}
|
|
74
|
+
if (typeof key !== 'string') {
|
|
75
|
+
this._failed_messages[key] = true
|
|
76
|
+
return key
|
|
77
|
+
}
|
|
78
|
+
key = key.toLowerCase()
|
|
84
79
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
80
|
+
const local = lang !== null ? lang : this._local
|
|
81
|
+
const pack = package_name !== null ? package_name : this._package
|
|
82
|
+
if (!local) {
|
|
83
|
+
this._failed_messages[key] = true
|
|
84
|
+
return key;
|
|
85
|
+
}
|
|
86
|
+
if (!this._messages[local]) {
|
|
87
|
+
this._failed_messages[key] = true
|
|
88
|
+
return key;
|
|
89
|
+
}
|
|
90
|
+
if (this._messages[local][key]) {
|
|
91
|
+
let val = this._messages[local][key];
|
|
92
|
+
const lng = variable.length
|
|
93
|
+
for (let i = 0; i < lng; i++) {
|
|
94
|
+
val = this.replaceAll(val, '{' + i + '}', variable[i]);
|
|
95
|
+
}
|
|
100
96
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
if (val === null || val === '') {
|
|
98
|
+
this._failed_messages[key] = true
|
|
99
|
+
return key;
|
|
100
|
+
}
|
|
101
|
+
return val;
|
|
102
|
+
} else if (this.$r && this.$r.autoAddTranslate && pack && this._count < 100 && /^([a-z_.])*$/.test(key)) {
|
|
103
|
+
if (!this._store.includes(key)) {
|
|
104
|
+
let url = '/translate/' + pack + '/' + key + '?v=';
|
|
105
|
+
const lng = variable.length
|
|
106
|
+
for (let i = 0; i < lng; i++) {
|
|
107
|
+
url += '{' + i + '}';
|
|
104
108
|
}
|
|
109
|
+
Axios.post(url);
|
|
110
|
+
this._count++;
|
|
111
|
+
this._store.push(key)
|
|
112
|
+
}
|
|
113
|
+
this._failed_messages[key] = true
|
|
114
|
+
return key;
|
|
115
|
+
} else {
|
|
116
|
+
this._failed_messages[key] = true
|
|
117
|
+
return key;
|
|
105
118
|
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
loads(packages = []) {
|
|
122
|
+
packages.forEach((p) => {
|
|
123
|
+
this.load(p)
|
|
124
|
+
})
|
|
125
|
+
}
|
|
106
126
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
127
|
+
load(p) {
|
|
128
|
+
const pack = p || this.$r.package;
|
|
129
|
+
if (!p) {
|
|
130
|
+
this.package = pack;
|
|
111
131
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
this.package = pack;
|
|
120
|
-
}
|
|
121
|
-
if(!window.app.$r.store['langs_loaded']){
|
|
122
|
-
window.app.$r.store['langs_loaded']={}
|
|
123
|
-
}
|
|
124
|
-
window.app.$r.store['langs_loaded'][pack] = false;
|
|
125
|
-
let locale = window.app.$r.lang;
|
|
126
|
-
if (window.app.$storage.get("lang")) {
|
|
127
|
-
locale = window.app.$storage.get("lang");
|
|
128
|
-
}
|
|
129
|
-
Axios.get(`/translate/${pack}/${locale}`).then(
|
|
130
|
-
res => {
|
|
131
|
-
if (res.data.length !== 0) {
|
|
132
|
-
const lang = {};
|
|
133
|
-
const lng=res.data.length
|
|
134
|
-
for (let i = 0; i < lng; i++) {
|
|
135
|
-
lang[res.data[i].key] = res.data[i][locale];
|
|
136
|
-
}
|
|
137
|
-
this.local = locale;
|
|
138
|
-
this.setMessages(lang);
|
|
139
|
-
} else {
|
|
140
|
-
this.local = locale;
|
|
141
|
-
this.setMessages({});
|
|
142
|
-
}
|
|
143
|
-
window.app.$r.store['langs_loaded'][pack] = true;
|
|
144
|
-
},
|
|
145
|
-
() => {
|
|
146
|
-
window.app.$r.store['langs_loaded'][pack] = true;
|
|
147
|
-
}
|
|
148
|
-
);
|
|
132
|
+
if (!this.$r.store['langs_loaded']) {
|
|
133
|
+
this.$r.store['langs_loaded'] = {}
|
|
134
|
+
}
|
|
135
|
+
this.$r.store['langs_loaded'][pack] = false;
|
|
136
|
+
let locale = this.$r.lang;
|
|
137
|
+
if (this.$storage.get("lang")) {
|
|
138
|
+
locale = this.$storage.get("lang");
|
|
149
139
|
}
|
|
140
|
+
Axios.get(`/translate/${pack}/${locale}`).then(
|
|
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({});
|
|
153
|
+
}
|
|
154
|
+
this.$r.store['langs_loaded'][pack] = true;
|
|
155
|
+
},
|
|
156
|
+
() => {
|
|
157
|
+
this.$r.store['langs_loaded'][pack] = true;
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
}
|
|
150
161
|
}
|
|
151
|
-
|
|
152
|
-
export default new Translate();
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export default class Validate {
|
|
2
|
+
constructor($t) {
|
|
3
|
+
this.$t=$t
|
|
4
|
+
}
|
|
5
5
|
required() {
|
|
6
|
-
let msg =
|
|
6
|
+
let msg = this.$t('required_error','renusify');
|
|
7
7
|
return (v) => !!(v !== undefined && v !== null && v !== '') || msg
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
requiredArray() {
|
|
11
|
-
return (v) => (v !== undefined && v !== null && v.length > 0) ||
|
|
11
|
+
return (v) => (v !== undefined && v !== null && v.length > 0) || this.$t('required_error','renusify');
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
email() {
|
|
15
|
-
return (v) => (v && v.length > 0 ? /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) : true) ||
|
|
15
|
+
return (v) => (v && v.length > 0 ? /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) : true) || this.$t('validate_email','renusify');
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
url() {
|
|
19
|
-
return (v) => (v && v.length > 0 ? /^((https?|ftp|smtp):\/\/)?(www.)?[a-z0-9]+\.[a-z]+(\/[a-zA-Z0-9#]+\/?)*$/.test(v) : true) ||
|
|
19
|
+
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
20
|
}
|
|
21
21
|
|
|
22
22
|
match(val) {
|
|
@@ -24,49 +24,49 @@ class Validate {
|
|
|
24
24
|
if (v == val) {
|
|
25
25
|
return true
|
|
26
26
|
} else {
|
|
27
|
-
return
|
|
27
|
+
return this.$t(['validate_match', [val]],'renusify');
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
phone() {
|
|
33
|
-
return (v) => (v && v.length > 0 ? /^[+]?[(]?[0-9]{3}[)]?[-\s.]?[0-9]{3}[-\s.]?[0-9]{4}$/.test(v) : true) ||
|
|
33
|
+
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
34
|
}
|
|
35
35
|
|
|
36
36
|
number() {
|
|
37
|
-
return (v) => (v && v.length > 0 ? /^([0-9.])*$/.test(v) : true) ||
|
|
37
|
+
return (v) => (v && v.length > 0 ? /^([0-9.])*$/.test(v) : true) || this.$t('numeric_error','renusify');
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
english() {
|
|
41
|
-
return (v) => (v && v.length > 0 ? /^([0-9a-zA-Z])*$/.test(v) : true) ||
|
|
41
|
+
return (v) => (v && v.length > 0 ? /^([0-9a-zA-Z])*$/.test(v) : true) || this.$t('english_error','renusify');
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
min_len(num) {
|
|
45
|
-
return v => (v && v.length > 0 ? v.length >= parseInt(num)?true:
|
|
45
|
+
return v => (v && v.length > 0 ? v.length >= parseInt(num)?true: this.$t(['min_len_error', [num,v.length]],'renusify') : true)
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
max_len(num) {
|
|
49
|
-
return v => (v && v.length > 0 ? v.length <= parseInt(num)?true:
|
|
49
|
+
return v => (v && v.length > 0 ? v.length <= parseInt(num)?true: this.$t(['max_len_error', [num,v.length]],'renusify') : true)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
len(num) {
|
|
53
|
-
return v => (v && v.length > 0 ? v.length === parseInt(num)?true:
|
|
53
|
+
return v => (v && v.length > 0 ? v.length === parseInt(num)?true: this.$t(['len_error', [num,v.length]],'renusify') : true) || msg
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
min(num) {
|
|
57
|
-
return v => (v ? parseFloat(v) >= parseFloat(num)?true:
|
|
57
|
+
return v => (v ? parseFloat(v) >= parseFloat(num)?true: this.$t(['min_error', [num,parseFloat(v)]],'renusify') : true)
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
max(num) {
|
|
61
|
-
return v => (v ? parseFloat(v) <= parseFloat(num)?true:
|
|
61
|
+
return v => (v ? parseFloat(v) <= parseFloat(num)?true: this.$t(['max_error', [num,parseFloat(v)]],'renusify') : true)
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
eq(num) {
|
|
65
|
-
return v => (v ? parseFloat(v) === parseFloat(num) : true) ||
|
|
65
|
+
return v => (v ? parseFloat(v) === parseFloat(num) : true) || this.$t(['validate_eq', [num]],'renusify');
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
notDefined(name) {
|
|
69
|
-
return v =>
|
|
69
|
+
return v => this.$t(['validate_notDefined', [name]],'renusify');
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
checkType(names) {
|
|
@@ -92,6 +92,4 @@ class Validate {
|
|
|
92
92
|
}
|
|
93
93
|
return filters
|
|
94
94
|
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export default new Validate()
|
|
95
|
+
}
|
package/tools/helper.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Toast from "../components/app/toast/toast";
|
|
2
|
+
|
|
1
3
|
export function clearProxy(obj) {
|
|
2
4
|
return JSON.parse(JSON.stringify(typeof obj === 'object' ? obj : {}))
|
|
3
5
|
}
|
|
@@ -33,9 +35,9 @@ export function copy(text, msg = null) {
|
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
navigator.clipboard.writeText(text).then(function () {
|
|
36
|
-
|
|
38
|
+
Toast.show(msg ||'copy_text_to_clipboard', {type: 'success'});
|
|
37
39
|
}, function () {
|
|
38
|
-
|
|
40
|
+
Toast.show(msg ||'text_not_copied', {type: 'error'});
|
|
39
41
|
})
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import valid from './Validate'
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
|
|
5
|
-
// The install method will be called with the Vue constructor as the first argument, along with possible options
|
|
6
|
-
install (app, options) {
|
|
7
|
-
// Add $plugin instance method directly to Vue components
|
|
8
|
-
app.config.globalProperties.$v = (names) => valid.checkType(names)
|
|
9
|
-
}
|
|
10
|
-
}
|