renusify 1.1.3 → 1.1.4
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/address.vue +3 -1
- package/components/form/checkbox.vue +1 -1
- package/components/form/datePicker/index.vue +20 -20
- package/components/form/group-input.vue +11 -4
- package/components/form/input.vue +5 -4
- package/components/form/inputTel/index.vue +166 -161
- package/components/form/mask-input.vue +12 -11
- package/components/form/select.vue +11 -9
- package/components/formCreator/index.vue +57 -4
- package/components/table/crud/footer.vue +2 -1
- package/components/table/crud/header.vue +2 -2
- package/components/table/crud/index.vue +19 -18
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<r-select-input
|
|
3
3
|
:label="$t('country','renusify')"
|
|
4
4
|
v-model="country"
|
|
5
|
+
v-if="!defaultCountry"
|
|
5
6
|
@update:model-value="emit(true,true)"
|
|
6
7
|
value="id"
|
|
7
8
|
:searchLink="`https://codenus.com/api/apps/address?lang=${$r.lang}`"
|
|
@@ -56,11 +57,12 @@ export default {
|
|
|
56
57
|
hideZipCode: Boolean,
|
|
57
58
|
hideStreet: Boolean,
|
|
58
59
|
tile: Boolean,
|
|
60
|
+
defaultCountry: Object,
|
|
59
61
|
modelValue: Object
|
|
60
62
|
},
|
|
61
63
|
data() {
|
|
62
64
|
return {
|
|
63
|
-
country: this.modelValue ? this.modelValue.country :
|
|
65
|
+
country: this.modelValue ? this.modelValue.country : this.defaultCountry,
|
|
64
66
|
state: this.modelValue ? this.modelValue.state : null,
|
|
65
67
|
city: this.modelValue ? this.modelValue.city : null,
|
|
66
68
|
zip_code: this.modelValue ? this.modelValue.zip_code : null,
|
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
/>
|
|
6
6
|
</r-input>
|
|
7
7
|
<r-modal :model-value="show" @update:model-value="close()" :closebtn="false" closable class="text-center">
|
|
8
|
-
<div v-if="!showTime" :class="`${$r.prefix}date-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
<div v-if="!showTime" :class="`${$r.prefix}date-input`">
|
|
9
|
+
<div class="sheet">
|
|
10
|
+
<r-container>
|
|
11
|
+
<r-row>
|
|
12
|
+
<r-col class="col-auto">
|
|
13
|
+
<r-btn v-if="tab!=='month'" icon
|
|
14
|
+
@click.prevent="tab==='day'?incrementMonth(-1):incrementYear(-12)">
|
|
15
|
+
<r-icon v-html="$r.icons.arrow_left"></r-icon>
|
|
16
|
+
</r-btn>
|
|
17
|
+
</r-col>
|
|
18
|
+
<r-col class="text-center">
|
|
19
19
|
<r-btn class="me-2" text @click.prevent="tab==='month'?tab='day':tab='month'">
|
|
20
20
|
<r-icon v-html="tab==='month'?$r.icons.chevron_up:$r.icons.chevron_down"></r-icon>
|
|
21
21
|
{{
|
|
@@ -370,17 +370,17 @@ export default {
|
|
|
370
370
|
<style lang="scss">
|
|
371
371
|
@import "../../../style/include";
|
|
372
372
|
|
|
373
|
-
.#{$prefix}date-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
373
|
+
.#{$prefix}date-input {
|
|
374
|
+
position: relative;
|
|
375
|
+
display: inline-block;
|
|
376
|
+
font-size: 10px;
|
|
377
|
+
color: #303030;
|
|
378
378
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
379
|
+
.cell {
|
|
380
|
+
&.today {
|
|
381
|
+
color: var(--color-one);
|
|
382
382
|
|
|
383
|
-
|
|
383
|
+
.cellContent {
|
|
384
384
|
border: solid 1px var(--color-one);
|
|
385
385
|
}
|
|
386
386
|
}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
<slot :item="item" :index="i" :disableDel="disDel">
|
|
7
7
|
<div class="d-flex flex-wrap pt-5">
|
|
8
8
|
<template v-for="(v,k) in item" :key="i+'-'+k">
|
|
9
|
-
<r-text-input v-if="typeof v==='string'" class="flex-grow-0 me-1" :label="k"
|
|
9
|
+
<r-text-input v-if="typeof v==='string'" class="flex-grow-0 me-1" :label="t(k)"
|
|
10
10
|
v-model="item[k]"></r-text-input>
|
|
11
|
-
<r-number-input v-else-if="typeof v==='number'" class="flex-grow-0 me-1" :label="k"
|
|
11
|
+
<r-number-input v-else-if="typeof v==='number'" class="flex-grow-0 me-1" :label="t(k)"
|
|
12
12
|
v-model="item[k]"></r-number-input>
|
|
13
|
-
<r-switch-input v-else-if="typeof v==='boolean'" class="flex-grow-0 me-1" :label="k"
|
|
13
|
+
<r-switch-input v-else-if="typeof v==='boolean'" class="flex-grow-0 me-1" :label="t(k)"
|
|
14
14
|
v-model="item[k]"></r-switch-input>
|
|
15
15
|
</template>
|
|
16
16
|
</div>
|
|
@@ -48,6 +48,7 @@ export default {
|
|
|
48
48
|
modelValue: Array,
|
|
49
49
|
size: Number,
|
|
50
50
|
disableAdd: Boolean,
|
|
51
|
+
translate: Boolean,
|
|
51
52
|
template: Object
|
|
52
53
|
},
|
|
53
54
|
data() {
|
|
@@ -68,6 +69,12 @@ export default {
|
|
|
68
69
|
}
|
|
69
70
|
},
|
|
70
71
|
methods: {
|
|
72
|
+
t(k) {
|
|
73
|
+
if (this.translate) {
|
|
74
|
+
return this.$t(k)
|
|
75
|
+
}
|
|
76
|
+
return k
|
|
77
|
+
},
|
|
71
78
|
disDel(value) {
|
|
72
79
|
this.disabledDel[value] = true
|
|
73
80
|
},
|
|
@@ -133,4 +140,4 @@ export default {
|
|
|
133
140
|
}
|
|
134
141
|
}
|
|
135
142
|
}
|
|
136
|
-
</style>
|
|
143
|
+
</style>
|
|
@@ -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,
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
:class="{
|
|
29
29
|
'massage-active':genMessages.length>0,
|
|
30
30
|
}">
|
|
31
|
-
<div :class="{'animation-shake-3':c_msgShake}">{{ genMessages
|
|
31
|
+
<div :class="{'animation-shake-3':c_msgShake}">{{ genMessages.join(',') }}</div>
|
|
32
32
|
|
|
33
33
|
</div>
|
|
34
34
|
</div>
|
|
@@ -113,10 +113,11 @@ export default {
|
|
|
113
113
|
return this.errorBucket.length > 0
|
|
114
114
|
},
|
|
115
115
|
genMessages() {
|
|
116
|
+
let m = []
|
|
116
117
|
if (this.msg) {
|
|
117
|
-
|
|
118
|
+
m = [this.msg]
|
|
118
119
|
}
|
|
119
|
-
return this.hasMessages ? this.validations :
|
|
120
|
+
return this.hasMessages ? this.validations : m
|
|
120
121
|
},
|
|
121
122
|
hasMessages() {
|
|
122
123
|
return this.validationTarget.length > 0
|
|
@@ -1,181 +1,186 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
2
|
+
<div :class="`${$r.prefix}input-tel`">
|
|
3
|
+
<r-modal
|
|
4
|
+
v-model="open"
|
|
5
|
+
>
|
|
6
|
+
<r-card class="pa-2">
|
|
7
|
+
<r-text-input
|
|
8
|
+
:label="$t('search','renusify')"
|
|
9
|
+
v-model="search"
|
|
10
|
+
></r-text-input>
|
|
11
|
+
<r-list :items="countries" :filter="search" @update:model-value="choose">
|
|
12
|
+
<template v-slot="{item}">
|
|
13
|
+
<div
|
|
14
|
+
:class="item.iso2.toLowerCase()"
|
|
15
|
+
class="iti-flag"></div>
|
|
16
|
+
<div class="list-title">{{ item.name }}</div>
|
|
17
|
+
<r-spacer></r-spacer>
|
|
18
|
+
<span class="ltr">+{{ item.dialCode }}</span>
|
|
19
|
+
</template>
|
|
20
|
+
</r-list>
|
|
21
|
+
</r-card>
|
|
22
|
+
</r-modal>
|
|
23
|
+
<r-btn class="btn-country ltr mx-1"
|
|
24
|
+
:rounded="!tile" :disabled="!select||readonly" @click.stop="toggleDropdown" outlined>
|
|
25
|
+
<div :class="activeCountry.iso2.toLowerCase()" class="iti-flag"></div>
|
|
26
|
+
<span class="country-code pa-1"> +{{ activeCountry.dialCode }} </span>
|
|
27
|
+
<span class="dropdown-arrow">{{ open ? "▲" : "▼" }}</span>
|
|
28
|
+
</r-btn>
|
|
29
|
+
<r-text-input class="input-phone" :label="label?label:$t('phone','renusify')"
|
|
30
|
+
@update:model-value="emit"
|
|
31
|
+
:tile="tile"
|
|
32
|
+
:readonly="readonly"
|
|
33
|
+
:rules="required?['required']:[]"
|
|
34
|
+
v-model="tel.phone"
|
|
35
|
+
>
|
|
36
|
+
</r-text-input>
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
</div>
|
|
38
39
|
</template>
|
|
39
40
|
|
|
40
41
|
<script>
|
|
41
|
-
|
|
42
|
+
import allCountries from './assets/all-countries.js'
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
required: Boolean,
|
|
66
|
-
select: {
|
|
67
|
-
type: Boolean,
|
|
68
|
-
default: false
|
|
69
|
-
}
|
|
44
|
+
export default {
|
|
45
|
+
name: 'inputTel',
|
|
46
|
+
props: {
|
|
47
|
+
label: {
|
|
48
|
+
type: String
|
|
49
|
+
},
|
|
50
|
+
modelValue: {
|
|
51
|
+
type: String
|
|
52
|
+
},
|
|
53
|
+
defaultCountry: {
|
|
54
|
+
// Default country code, ie: 'AU'
|
|
55
|
+
// Will override the current country of user
|
|
56
|
+
type: String,
|
|
57
|
+
default: ''
|
|
58
|
+
},
|
|
59
|
+
tile: Boolean,
|
|
60
|
+
required: Boolean,
|
|
61
|
+
readonly: Boolean,
|
|
62
|
+
select: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false
|
|
65
|
+
}
|
|
70
66
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
67
|
+
},
|
|
68
|
+
data() {
|
|
69
|
+
return {
|
|
70
|
+
tel: {
|
|
71
|
+
'phone': '',
|
|
72
|
+
'country_code': ''
|
|
73
|
+
},
|
|
74
|
+
search: '',
|
|
75
|
+
countries: [],
|
|
76
|
+
activeCountry: {iso2: 'US', dialCode: '1'},
|
|
77
|
+
open: false
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
mounted() {
|
|
81
|
+
this.initializeCountry()
|
|
82
|
+
this.countries = allCountries
|
|
83
|
+
},
|
|
84
|
+
created() {
|
|
85
|
+
if (this.modelValue) {
|
|
86
|
+
let a = this.modelValue.split(' ')
|
|
87
|
+
this.tel.country_code = a[0]
|
|
88
|
+
this.tel.phone = a[1]
|
|
89
|
+
this.activeCountry.dialCode = this.tel.country_code
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
methods: {
|
|
93
|
+
initializeCountry() {
|
|
94
|
+
/**
|
|
95
|
+
* 1. Use default country if passed from parent
|
|
96
|
+
*/
|
|
97
|
+
if (this.defaultCountry) {
|
|
98
|
+
const defaultCountry = this.findCountry(this.defaultCountry)
|
|
99
|
+
if (defaultCountry) {
|
|
100
|
+
this.activeCountry = defaultCountry
|
|
101
|
+
return
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 2. Check if fetching country based on user's IP is allowed, set it as the default country
|
|
106
|
+
*/
|
|
107
|
+
fetch('http://ip-api.com/json/', {
|
|
108
|
+
method: 'get'
|
|
109
|
+
}).then((response) => {
|
|
110
|
+
const that = this
|
|
111
|
+
response.json().then(function (data) {
|
|
112
|
+
that.activeCountry = that.findCountry(data.countryCode) || that.activeCountry
|
|
113
|
+
})
|
|
114
|
+
}).catch((error) => {
|
|
115
|
+
return Promise.reject(error)
|
|
116
|
+
})
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* Get the list of countries from the list of iso2 code
|
|
120
|
+
*/
|
|
121
|
+
getCountries(list = []) {
|
|
122
|
+
return list
|
|
123
|
+
.map(countryCode => this.findCountry(countryCode))
|
|
124
|
+
.filter(Boolean)
|
|
125
|
+
},
|
|
126
|
+
findCountry(iso = '') {
|
|
127
|
+
return allCountries.find(country => country.iso2 === iso)
|
|
128
|
+
},
|
|
127
129
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
choose(country) {
|
|
131
|
+
this.activeCountry = country
|
|
132
|
+
this.emit()
|
|
133
|
+
this.reset()
|
|
134
|
+
},
|
|
135
|
+
reset() {
|
|
136
|
+
this.search = ''
|
|
137
|
+
this.countries = allCountries
|
|
138
|
+
this.open = false
|
|
139
|
+
},
|
|
138
140
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
141
|
+
emit(e) {
|
|
142
|
+
if (this.readonly) {
|
|
143
|
+
return
|
|
144
|
+
}
|
|
145
|
+
this.tel.country_code = this.activeCountry.dialCode
|
|
146
|
+
if (this.tel.phone.startsWith('0')) {
|
|
147
|
+
setTimeout(() => {
|
|
148
|
+
this.tel.phone = this.tel.phone.substr(1, this.tel.phone.length)
|
|
149
|
+
this.$emit('update:modelValue', this.tel.country_code + ' ' + this.tel.phone)
|
|
150
|
+
}, 1)
|
|
151
|
+
} else {
|
|
152
|
+
this.$emit('update:modelValue', this.tel.country_code + ' ' + this.tel.phone)
|
|
148
153
|
|
|
149
|
-
|
|
154
|
+
}
|
|
150
155
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
}
|
|
156
|
+
},
|
|
157
|
+
toggleDropdown() {
|
|
158
|
+
this.open = !this.open
|
|
159
|
+
},
|
|
160
|
+
clickedOutside() {
|
|
161
|
+
this.open = false
|
|
159
162
|
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
160
165
|
</script>
|
|
161
166
|
|
|
162
167
|
<style src="./assets/sprite.css"></style>
|
|
163
168
|
<style lang="scss">
|
|
164
|
-
|
|
169
|
+
@import "../../../style/include";
|
|
165
170
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
.#{$prefix}input-tel {
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: baseline;
|
|
174
|
+
direction: ltr;
|
|
170
175
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
176
|
+
.btn-country {
|
|
177
|
+
width: 120px;
|
|
178
|
+
border-color: var(--color-border)
|
|
174
179
|
|
|
175
|
-
|
|
180
|
+
}
|
|
176
181
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
</style>
|
|
182
|
+
.input-phone {
|
|
183
|
+
width: calc(100% - 120px);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
</style>
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<r-input :error="error?true:false" :rules="required?['required']:[]" :msg="error?error:undefined"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
<r-input :error="error?true:false" ltr :rules="required?['required']:[]" :msg="error?error:undefined"
|
|
3
|
+
:modelValue="lazyVal" :active="active">
|
|
4
|
+
<input
|
|
5
|
+
v-model="lazyVal"
|
|
6
|
+
@complete="onComplete"
|
|
7
|
+
@accept="onAccept"
|
|
8
|
+
@backspace="onBackspace"
|
|
9
|
+
autocomplete="no"
|
|
10
|
+
@paste.prevent="onPaste"
|
|
11
|
+
@focusin="active=true"
|
|
12
|
+
@focusout="active=false"
|
|
13
|
+
v-mask="mask"
|
|
13
14
|
/>
|
|
14
15
|
|
|
15
16
|
</r-input>
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
:modelValue="$helper.ifHas(chips,null,0,value)"
|
|
7
7
|
@click.prevent="handleClick()">
|
|
8
8
|
<div class="select-wrap v-center"
|
|
9
|
-
:class="{
|
|
9
|
+
:class="{
|
|
10
|
+
'h-center':disableSearch,
|
|
11
|
+
'flex-nowrap':!multiple
|
|
12
|
+
}">
|
|
10
13
|
<r-chip
|
|
11
14
|
class="my-0 ms-0"
|
|
12
15
|
:close="multiple&&!textChip"
|
|
@@ -20,6 +23,7 @@
|
|
|
20
23
|
</r-chip>
|
|
21
24
|
<span>
|
|
22
25
|
<input :type="type"
|
|
26
|
+
v-if="!disableSearch"
|
|
23
27
|
@focusin="focusInput(true)"
|
|
24
28
|
@focusout="focusInput(false)"
|
|
25
29
|
@keydown.enter="add"
|
|
@@ -85,7 +89,7 @@ export default {
|
|
|
85
89
|
type: String,
|
|
86
90
|
default: 'value'
|
|
87
91
|
},
|
|
88
|
-
|
|
92
|
+
disableSearch: Boolean,
|
|
89
93
|
readonly: Boolean,
|
|
90
94
|
textChip: Boolean,
|
|
91
95
|
items: Array,
|
|
@@ -217,6 +221,8 @@ export default {
|
|
|
217
221
|
handleClick() {
|
|
218
222
|
if (this.$refs.input) {
|
|
219
223
|
this.$refs.input.focus()
|
|
224
|
+
} else {
|
|
225
|
+
this.focusInput(true)
|
|
220
226
|
}
|
|
221
227
|
},
|
|
222
228
|
add() {
|
|
@@ -225,7 +231,7 @@ export default {
|
|
|
225
231
|
if (!this.multiple) {
|
|
226
232
|
this.chips = []
|
|
227
233
|
}
|
|
228
|
-
if (!this.
|
|
234
|
+
if (!this.tags) {
|
|
229
235
|
const exist = this.$helper.searchArray(this.genItems, this.text, val[this.text])
|
|
230
236
|
if (exist !== false) {
|
|
231
237
|
this.chips.push(val)
|
|
@@ -242,8 +248,7 @@ export default {
|
|
|
242
248
|
this.chips = this.$helper.uniqArray(this.chips)
|
|
243
249
|
|
|
244
250
|
let val = this.chips
|
|
245
|
-
|
|
246
|
-
if (this.tags) {
|
|
251
|
+
if (this.justValue) {
|
|
247
252
|
val = []
|
|
248
253
|
for (let i in this.chips) {
|
|
249
254
|
if (this.$helper.hasKey(this.chips, i)) {
|
|
@@ -251,12 +256,9 @@ export default {
|
|
|
251
256
|
}
|
|
252
257
|
}
|
|
253
258
|
}
|
|
254
|
-
if (!this.multiple
|
|
259
|
+
if (!this.multiple) {
|
|
255
260
|
val = val[0]
|
|
256
261
|
if (val) {
|
|
257
|
-
if (this.justValue) {
|
|
258
|
-
val = val[this.value]
|
|
259
|
-
}
|
|
260
262
|
this.closeList()
|
|
261
263
|
}
|
|
262
264
|
}
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
<r-form ref="form" v-model="valid" @submit.prevent="save">
|
|
7
7
|
<r-row>
|
|
8
8
|
<template :key="key" v-for="(item,key) in options">
|
|
9
|
-
<r-col class="col-12" v-if="item['formInput']!==false">
|
|
9
|
+
<r-col class="col-12" v-if="item['formInput']!==false&&iff(options[key])">
|
|
10
10
|
<component
|
|
11
11
|
:is="'r-'+item['type']"
|
|
12
|
-
:label="$t(key
|
|
12
|
+
:label="$t(key)"
|
|
13
13
|
v-model="editedItem[key]"
|
|
14
14
|
v-bind="getAttr(options[key])"
|
|
15
15
|
></component>
|
|
@@ -96,11 +96,64 @@ export default {
|
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
methods: {
|
|
99
|
+
iff(data) {
|
|
100
|
+
const that = this
|
|
101
|
+
|
|
102
|
+
function get(item, key) {
|
|
103
|
+
if (key.toString().startsWith('$')) {
|
|
104
|
+
return that.$helper.ifHas(item, null, ...key.substring(1).split('.'))
|
|
105
|
+
}
|
|
106
|
+
return key
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if ('$if' in data) {
|
|
110
|
+
for (let i = 0; i < data['$if'].length; i++) {
|
|
111
|
+
const item = data['$if'][i]
|
|
112
|
+
let can = true
|
|
113
|
+
const one = get(this.editedItem, item[0])
|
|
114
|
+
const op = item[1]
|
|
115
|
+
const two = get(this.editedItem, item[2])
|
|
116
|
+
if (op === '===' || op === '==') {
|
|
117
|
+
can = one === two
|
|
118
|
+
} else if (op === '>') {
|
|
119
|
+
can = one > two
|
|
120
|
+
} else if (op === '>=') {
|
|
121
|
+
can = one >= two
|
|
122
|
+
} else if (op === '<') {
|
|
123
|
+
can = one < two
|
|
124
|
+
} else if (op === '<=') {
|
|
125
|
+
can = one <= two
|
|
126
|
+
} else if (op === '!=') {
|
|
127
|
+
can = one !== two
|
|
128
|
+
} else if (op === 'in') {
|
|
129
|
+
if (two && typeof two === 'object') {
|
|
130
|
+
can = two.includes(one)
|
|
131
|
+
} else {
|
|
132
|
+
can = false
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
can = false
|
|
136
|
+
console.error(`operator '${op}' is not defined.(form creator)`)
|
|
137
|
+
}
|
|
138
|
+
if (can === false) {
|
|
139
|
+
return false
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return true
|
|
144
|
+
},
|
|
99
145
|
getAttr(data) {
|
|
100
146
|
let res = {}
|
|
101
147
|
for (let i in data) {
|
|
102
|
-
if (this.$helper.hasKey(data, i) && !['formInput', 'sortable', 'type', 'tableShow', 'priority'].includes(i)) {
|
|
103
|
-
|
|
148
|
+
if (this.$helper.hasKey(data, i) && !['formInput', 'sortable', 'type', 'tableShow', 'priority', '$if'].includes(i)) {
|
|
149
|
+
if (i === '$bind') {
|
|
150
|
+
data[i].forEach((item) => {
|
|
151
|
+
res[item[0]] = this.editedItem[item[1]]
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
} else {
|
|
155
|
+
res[i] = data[i]
|
|
156
|
+
}
|
|
104
157
|
}
|
|
105
158
|
}
|
|
106
159
|
return res
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
{name: '100', value: 100},
|
|
11
11
|
{name: '200', value: 200},
|
|
12
12
|
]"
|
|
13
|
+
disable-search
|
|
13
14
|
@update:modelValue="perPageE"
|
|
14
15
|
:modelValue="perPage"></r-select-input>
|
|
15
16
|
</r-col>
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
<r-icon v-html="this.$r.icons.chevron_left"></r-icon>
|
|
23
24
|
|
|
24
25
|
</r-btn>
|
|
25
|
-
|
|
26
|
+
<input name="input-page" type="text" :value="page" @input="pageN" class="input-page text-center">
|
|
26
27
|
<r-btn :disabled="endPage" @click.prevent="pageBtn('next')" class="btn-shaped"
|
|
27
28
|
icon
|
|
28
29
|
text>
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
</r-btn>
|
|
126
126
|
</r-col>
|
|
127
127
|
</r-row>
|
|
128
|
-
<r-row class="v-baseline" v-else-if="['date-
|
|
128
|
+
<r-row class="v-baseline" v-else-if="['date-input','time-ago'].includes(item.option.type)">
|
|
129
129
|
<r-col class="col-5 md-3" :a="item.advance.t='date'">
|
|
130
130
|
<r-select-input v-model="item.advance.action"
|
|
131
131
|
:items="[
|
|
@@ -214,7 +214,7 @@
|
|
|
214
214
|
header() {
|
|
215
215
|
let res = []
|
|
216
216
|
this.headerTable.forEach((item) => {
|
|
217
|
-
if (['text-input', 'text-area', 'number', 'switch', 'select', 'date-
|
|
217
|
+
if (['text-input', 'text-area', 'number', 'switch', 'select', 'date-input', 'time-ago'].includes(item.option.type)) {
|
|
218
218
|
res.push(item)
|
|
219
219
|
}
|
|
220
220
|
})
|
|
@@ -102,24 +102,25 @@
|
|
|
102
102
|
<r-icon v-html="props.opened!==props.key?$r.icons.plus:$r.icons.minus"></r-icon>
|
|
103
103
|
</r-btn>
|
|
104
104
|
<slot name="cell" :value="value" :item="props.item" :editItem="editItem">
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
105
|
+
<div v-if="value['option']['type']==='date-input' && props.item[value['value']]!==undefined">
|
|
106
|
+
{{ $d(new Date(props.item[value['value']]), value['option']['format'] || 'short') }}
|
|
107
|
+
</div>
|
|
108
|
+
<div
|
|
109
|
+
v-else-if="value['option']['type']==='time-ago' && props.item[value['value']]!==undefined">
|
|
110
|
+
<r-time-ago :time="props.item[value['value']]"></r-time-ago>
|
|
111
|
+
</div>
|
|
112
|
+
<div v-else-if="value['option']['type']==='switch-input'">
|
|
113
|
+
<r-switch-input
|
|
114
|
+
:readonly="value['option']['formInput']===false"
|
|
115
|
+
:modelValue="props.item[value['value']]"
|
|
116
|
+
@update:modelValue="value['option']['formInput']!==false?editItem(props.item,true,value['value']):''"
|
|
117
|
+
class="mt-0"
|
|
118
|
+
></r-switch-input>
|
|
119
|
+
</div>
|
|
120
|
+
<div v-else-if="value['option']['type'] === 'number-input'">
|
|
121
|
+
{{ $n(props.item[value["value"]]) }}
|
|
122
|
+
</div>
|
|
123
|
+
<div v-else-if="value['option']['type']!=='action'">
|
|
123
124
|
{{value['value'] in cast?
|
|
124
125
|
$helper.ifHas(props.item,'',value['value'],cast[value['value']])
|
|
125
126
|
:props.item[value['value']]}}
|