renusify 1.4.0 → 1.4.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.
- 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 +18 -18
- 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
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
}"
|
|
15
15
|
>{{ alt }}
|
|
16
16
|
</div>
|
|
17
|
-
<img v-if="load &&!isSvg" ref="img" :
|
|
18
|
-
:height="size.height>0?size.height:'auto'"
|
|
19
|
-
:style="{'height':size.height>0?undefined:'auto',
|
|
17
|
+
<img v-if="load &&!isSvg" ref="img" :alt="alt" :height="size.height>0?size.height:'auto'" :src="link" :style="{'height':size.height>0?undefined:'auto',
|
|
20
18
|
'width':size.width>0?undefined:'auto'
|
|
21
|
-
}"
|
|
19
|
+
}"
|
|
20
|
+
:width="size.width>0?size.width:'auto'"
|
|
21
|
+
draggable="false"/>
|
|
22
22
|
<svg-img v-else-if="load &&isSvg&&link" :link="link" :size="size">
|
|
23
23
|
</svg-img>
|
|
24
24
|
</div>
|
|
@@ -119,21 +119,21 @@ export default {
|
|
|
119
119
|
if (this.height) {
|
|
120
120
|
res["height"] = this.height
|
|
121
121
|
}
|
|
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
|
|
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
132
|
}
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
if(wPH) {
|
|
136
|
+
if (wPH) {
|
|
137
137
|
if (res['width'] !== 0 && res['height'] === 0) {
|
|
138
138
|
res['height'] = res['width'] / wPH
|
|
139
139
|
}
|
|
@@ -141,7 +141,7 @@ export default {
|
|
|
141
141
|
res['width'] = res['height'] * wPH
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
if (res['width'] !== 0||res['height']!== 0) {
|
|
144
|
+
if (res['width'] !== 0 || res['height'] !== 0) {
|
|
145
145
|
return this.size = res
|
|
146
146
|
}
|
|
147
147
|
|
|
@@ -152,7 +152,7 @@ export default {
|
|
|
152
152
|
let w = parseFloat((parseFloat(cs.getPropertyValue('width')) - paddingX - borderX).toFixed(2));
|
|
153
153
|
return this.size = {
|
|
154
154
|
width: w,
|
|
155
|
-
height: wPH?w / wPH:0
|
|
155
|
+
height: wPH ? w / wPH : 0
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
return false
|
|
@@ -160,7 +160,7 @@ export default {
|
|
|
160
160
|
},
|
|
161
161
|
activate() {
|
|
162
162
|
this.getSize()
|
|
163
|
-
if (this.size.width !== 0||this.size.height) {
|
|
163
|
+
if (this.size.width !== 0 || this.size.height) {
|
|
164
164
|
this.load = true
|
|
165
165
|
} else {
|
|
166
166
|
clearTimeout(this.time_id)
|
|
@@ -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
|
|