renusify 1.1.3 → 1.1.5

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.
Files changed (33) hide show
  1. package/components/avatar/index.vue +29 -23
  2. package/components/bar/bottomNavigationCircle.vue +7 -3
  3. package/components/form/address.vue +7 -2
  4. package/components/form/camInput.vue +8 -2
  5. package/components/form/check-input.vue +94 -93
  6. package/components/form/checkbox.vue +1 -1
  7. package/components/form/datePicker/index.vue +20 -20
  8. package/components/form/fileUploader/file.js +21 -3
  9. package/components/form/fileUploader/index.vue +12 -2
  10. package/components/form/fileUploader/single.vue +3 -2
  11. package/components/form/group-input.vue +45 -35
  12. package/components/form/input.vue +5 -4
  13. package/components/form/inputTel/index.vue +175 -161
  14. package/components/form/mask-input.vue +12 -11
  15. package/components/form/number.vue +24 -12
  16. package/components/form/range.vue +25 -1
  17. package/components/form/select.vue +17 -11
  18. package/components/form/text-editor/index.vue +13 -9
  19. package/components/form/unique/index.vue +2 -1
  20. package/components/formCreator/index.vue +60 -6
  21. package/components/img/index.vue +12 -2
  22. package/components/img/svgImg.vue +43 -0
  23. package/components/infinite/div.vue +2 -1
  24. package/components/infinite/page.vue +24 -23
  25. package/components/list/index.vue +32 -30
  26. package/components/map/index.vue +323 -306
  27. package/components/searchBox/index.vue +4 -2
  28. package/components/table/crud/footer.vue +2 -1
  29. package/components/table/crud/header.vue +2 -2
  30. package/components/table/crud/index.vue +462 -457
  31. package/components/tree/index.vue +13 -12
  32. package/components/tree/tree-element.vue +5 -2
  33. package/package.json +1 -1
@@ -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&&genMessages.length>0,
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[0] }}</div>
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
- return [this.msg]
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,195 @@
1
1
  <template>
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" @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
- :rules="[required&&'required']"
33
- v-model="tel.phone"
34
- >
35
- </r-text-input>
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 ms-1"
24
+ :rounded="!c_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="c_tile"
32
+ :readonly="readonly"
33
+ :rules="required?['required','number']:['number']"
34
+ v-model="tel.phone"
35
+ >
36
+ </r-text-input>
36
37
 
37
- </div>
38
+ </div>
38
39
  </template>
39
40
 
40
41
  <script>
41
- import allCountries from './assets/all-countries.js'
42
+ import allCountries from './assets/all-countries.js'
42
43
 
43
- export default {
44
- name: 'inputTel',
45
- props: {
46
- label: {
47
- type: String
48
- },
49
- modelValue: {
50
- type: Object,
51
- default: () => {
52
- return {
53
- 'phone': '',
54
- 'country_code': ''
55
- }
56
- }
57
- },
58
- defaultCountry: {
59
- // Default country code, ie: 'AU'
60
- // Will override the current country of user
61
- type: String,
62
- default: ''
63
- },
64
- tile: Boolean,
65
- required: Boolean,
66
- select: {
67
- type: Boolean,
68
- default: false
69
- }
70
-
71
- },
72
- data() {
73
- return {
74
- tel: this.modelValue,
75
- search: '',
76
- countries: [],
77
- activeCountry: {iso2: 'US', dialCode: '1'},
78
- open: false
79
- }
80
- },
81
- mounted() {
82
- this.initializeCountry()
83
- this.countries = allCountries
84
- },
85
- created() {
86
- if (this.modelValue) {
87
- this.activeCountry.dialCode = this.modelValue.country_code
88
- }
89
- },
90
- methods: {
91
- initializeCountry() {
92
- /**
93
- * 1. Use default country if passed from parent
94
- */
95
- if (this.defaultCountry) {
96
- const defaultCountry = this.findCountry(this.defaultCountry)
97
- if (defaultCountry) {
98
- this.activeCountry = defaultCountry
99
- return
100
- }
101
- }
102
- /**
103
- * 2. Check if fetching country based on user's IP is allowed, set it as the default country
104
- */
105
- fetch('http://ip-api.com/json/', {
106
- method: 'get'
107
- }).then((response) => {
108
- const that = this
109
- response.json().then(function (data) {
110
- that.activeCountry = that.findCountry(data.countryCode) || that.activeCountry
111
- })
112
- }).catch((error) => {
113
- return Promise.reject(error)
114
- })
115
- },
116
- /**
117
- * Get the list of countries from the list of iso2 code
118
- */
119
- getCountries(list = []) {
120
- return list
121
- .map(countryCode => this.findCountry(countryCode))
122
- .filter(Boolean)
123
- },
124
- findCountry(iso = '') {
125
- return allCountries.find(country => country.iso2 === iso)
126
- },
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: {type: Boolean, default: undefined},
60
+ required: Boolean,
61
+ readonly: Boolean,
62
+ select: {
63
+ type: Boolean,
64
+ default: false
65
+ }
127
66
 
128
- choose(country) {
129
- this.activeCountry = country
130
- this.emit()
131
- this.reset()
132
- },
133
- reset() {
134
- this.search = ''
135
- this.countries = allCountries
136
- this.open = false
137
- },
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
+ computed: {
93
+ c_tile() {
94
+ if (this.tile === undefined && this.$r.inputs.tile) {
95
+ return this.$r.inputs.tile
96
+ }
97
+ return this.tile
98
+ },
99
+ },
100
+ methods: {
101
+ initializeCountry() {
102
+ /**
103
+ * 1. Use default country if passed from parent
104
+ */
105
+ if (this.defaultCountry) {
106
+ const defaultCountry = this.findCountry(this.defaultCountry)
107
+ if (defaultCountry) {
108
+ this.activeCountry = defaultCountry
109
+ return
110
+ }
111
+ }
112
+ /**
113
+ * 2. Check if fetching country based on user's IP is allowed, set it as the default country
114
+ */
115
+ fetch('http://ip-api.com/json/', {
116
+ method: 'get'
117
+ }).then((response) => {
118
+ const that = this
119
+ response.json().then(function (data) {
120
+ that.activeCountry = that.findCountry(data.countryCode) || that.activeCountry
121
+ })
122
+ }).catch((error) => {
123
+ return Promise.reject(error)
124
+ })
125
+ },
126
+ /**
127
+ * Get the list of countries from the list of iso2 code
128
+ */
129
+ getCountries(list = []) {
130
+ return list
131
+ .map(countryCode => this.findCountry(countryCode))
132
+ .filter(Boolean)
133
+ },
134
+ findCountry(iso = '') {
135
+ return allCountries.find(country => country.iso2 === iso)
136
+ },
138
137
 
139
- emit(e) {
140
- this.tel.country_code = this.activeCountry.dialCode
141
- if (this.tel.phone.startsWith('0')) {
142
- setTimeout(() => {
143
- this.tel.phone = this.tel.phone.substr(1, this.tel.phone.length)
144
- this.$emit('update:modelValue', this.tel)
145
- }, 1)
146
- } else {
147
- this.$emit('update:modelValue', this.tel)
138
+ choose(country) {
139
+ this.activeCountry = country
140
+ this.emit()
141
+ this.reset()
142
+ },
143
+ reset() {
144
+ this.search = ''
145
+ this.countries = allCountries
146
+ this.open = false
147
+ },
148
148
 
149
- }
149
+ emit(e) {
150
+ if (this.readonly) {
151
+ return
152
+ }
153
+ this.tel.country_code = this.activeCountry.dialCode
150
154
 
151
- },
152
- toggleDropdown() {
153
- this.open = !this.open
154
- },
155
- clickedOutside() {
156
- this.open = false
157
- }
155
+ setTimeout(() => {
156
+ this.tel.phone = this.$helper.replacer(this.tel.phone, ' ', '')
157
+ if (this.tel.phone.startsWith('0')) {
158
+ this.tel.phone = this.tel.phone.substr(1, this.tel.phone.length)
159
+ this.$emit('update:modelValue', this.tel.country_code + ' ' + this.tel.phone)
160
+ } else {
161
+ this.$emit('update:modelValue', this.tel.country_code + ' ' + this.tel.phone)
158
162
  }
163
+ }, 10)
164
+
165
+ },
166
+ toggleDropdown() {
167
+ this.open = !this.open
168
+ },
169
+ clickedOutside() {
170
+ this.open = false
159
171
  }
172
+ }
173
+ }
160
174
  </script>
161
175
 
162
176
  <style src="./assets/sprite.css"></style>
163
177
  <style lang="scss">
164
- @import "../../../style/include";
178
+ @import "../../../style/include";
165
179
 
166
- .#{$prefix}input-tel {
167
- display: flex;
168
- align-items: baseline;
169
- direction: ltr;
180
+ .#{$prefix}input-tel {
181
+ display: flex;
182
+ align-items: baseline;
183
+ direction: ltr;
170
184
 
171
- .btn-country {
172
- width: 120px;
173
- border-color: var(--color-border)
185
+ .btn-country {
186
+ width: 120px;
187
+ border-color: var(--color-border)
174
188
 
175
- }
189
+ }
176
190
 
177
- .input-phone {
178
- width: calc(100% - 120px);
179
- }
180
- }
181
- </style>
191
+ .input-phone {
192
+ width: calc(100% - 120px);
193
+ }
194
+ }
195
+ </style>
@@ -1,15 +1,16 @@
1
1
  <template>
2
- <r-input :error="error?true:false" :rules="required?['required']:[]" :msg="error?error:undefined" :modelValue="lazyVal" :active="active" class="ltr">
3
- <input
4
- v-model="lazyVal"
5
- @complete="onComplete"
6
- @accept="onAccept"
7
- @backspace="onBackspace"
8
- autocomplete="no"
9
- @paste.prevent="onPaste"
10
- @focusin="active=true"
11
- @focusout="active=false"
12
- v-mask="mask"
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>
@@ -5,7 +5,7 @@
5
5
  :active="active"
6
6
  inputControlClass="v-center"
7
7
  >
8
- <r-btn @click.prevent="minus" class="minus" icon :text="btnText">
8
+ <r-btn @click.prevent.stop="minus" class="minus" icon :text="btnText">
9
9
  <r-icon v-html="$r.icons.minus"></r-icon>
10
10
  </r-btn>
11
11
  <input @input="emit"
@@ -13,11 +13,11 @@
13
13
  @focusin="active=true"
14
14
  @focusout="active=false"
15
15
  ref="input"
16
- type="number"
16
+ type="text"
17
17
  autocomplete="no"
18
- v-model.number="number"
18
+ v-model="number"
19
19
  />
20
- <r-btn @click.prevent="plus" class="plus" icon :text="btnText">
20
+ <r-btn @click.prevent.stop="plus" class="plus" icon :text="btnText">
21
21
  <r-icon v-html="$r.icons.plus"></r-icon>
22
22
  </r-btn>
23
23
  </r-input>
@@ -32,6 +32,7 @@ export default {
32
32
  props: {
33
33
  modelValue: Number,
34
34
  step: {type: Number, default: 1},
35
+ split: {type: Number, default: 0},
35
36
  min: {
36
37
  type: Number
37
38
  },
@@ -42,25 +43,38 @@ export default {
42
43
  },
43
44
  data() {
44
45
  return {
45
- number: this.modelValue,
46
+ number: this.setSplit(this.modelValue),
46
47
  active: false
47
48
  }
48
49
  },
49
50
  watch: {
50
51
  'modelValue': function (newVal) {
51
52
  setTimeout(() => {
52
- this.number = newVal
53
+ this.number = this.setSplit(newVal)
53
54
  })
54
55
  }
55
56
  },
56
57
  methods: {
58
+ setSplit(n) {
59
+ if (n && this.split > 0) {
60
+ const x = this.split
61
+ n = n.toString()
62
+ const step = n.indexOf('.')
63
+ const re = '\\d(?=(\\d{' + (x) + '})+' + (step > -1 ? '\\.' : '$') + ')';
64
+ return n.replace(new RegExp(re, 'g'), '$&,');
65
+ }
66
+ return n
67
+ },
68
+ removeSplit(n) {
69
+ return parseFloat(this.$helper.replacer(n.toString(), ',', ''))
70
+ },
57
71
  emit() {
58
72
  if (this.number === '' || this.number === null) {
59
73
  this.number = undefined
60
- this.$emit('update:modelValue', d)
74
+ this.$emit('update:modelValue', this.number)
61
75
  return
62
76
  }
63
- let d = this.number
77
+ let d = this.removeSplit(this.number)
64
78
  if (this.max !== undefined && d > this.max) {
65
79
  d = this.max
66
80
  }
@@ -68,13 +82,11 @@ export default {
68
82
  d = this.min
69
83
  }
70
84
  const n = ((1 / this.step) + '').length - 1
71
- this.number = parseFloat(d.toFixed(n))
72
- this.$emit('update:modelValue', this.number)
73
-
85
+ this.number = this.setSplit(d.toFixed(n))
86
+ this.$emit('update:modelValue', this.removeSplit(this.number))
74
87
  },
75
88
  plus() {
76
89
  let n = this.modelValue || 0
77
-
78
90
  this.number = n + this.step
79
91
  this.emit()
80
92
  },
@@ -94,7 +94,7 @@ export default {
94
94
  this.width = this.$refs.range.getBoundingClientRect().width - 10
95
95
  this.preValue = this.min
96
96
  if (this.isRange && !this.modelValue) {
97
- this.$emit('update:modelValue', [this.min, this.max])
97
+ this.$emit('update:modelValue', [])
98
98
  const r = this.$r.rtl ? -1 : 1
99
99
  this.x2 = this.width * r
100
100
  this.prePosition2 = this.width * r
@@ -241,6 +241,18 @@ export default {
241
241
  height: 10px;
242
242
  border-radius: 50%;
243
243
  cursor: grabbing;
244
+
245
+ &:hover {
246
+ width: 16px;
247
+ height: 16px;
248
+ @include rtl() {
249
+ transform: translate(2px, -2px);
250
+ }
251
+ @include ltr() {
252
+ transform: translate(-2px, -2px);
253
+ }
254
+ border: 3px solid var(--color-two) !important;
255
+ }
244
256
  }
245
257
 
246
258
  .dot-tooltip {
@@ -292,6 +304,18 @@ export default {
292
304
  border-radius: 50%;
293
305
  margin-top: -3px;
294
306
  cursor: grabbing;
307
+
308
+ &:hover {
309
+ width: 16px;
310
+ height: 16px;
311
+ @include rtl() {
312
+ transform: translate(2px, -2px);
313
+ }
314
+ @include ltr {
315
+ transform: translate(-2px, -2px);
316
+ }
317
+ border: 3px solid var(--color-two) !important;
318
+ }
295
319
  }
296
320
 
297
321
  .dot-tooltip {
@@ -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="{'flex-nowrap':!multiple}">
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"
@@ -46,6 +50,8 @@
46
50
  :items="genItems"
47
51
  :multiple="multiple"
48
52
  :modelValue="chips"
53
+ :text="text"
54
+ :val="value"
49
55
  @update:modelValue="listInput"
50
56
  checked>
51
57
  <template v-slot="props">
@@ -85,7 +91,7 @@ export default {
85
91
  type: String,
86
92
  default: 'value'
87
93
  },
88
- combo: Boolean,
94
+ disableSearch: Boolean,
89
95
  readonly: Boolean,
90
96
  textChip: Boolean,
91
97
  items: Array,
@@ -95,7 +101,8 @@ export default {
95
101
  justValue: Boolean,
96
102
  openToTop: Boolean,
97
103
  translate: Boolean,
98
- firstSelect: Boolean
104
+ firstSelect: Boolean,
105
+ headers: Object
99
106
  },
100
107
  data() {
101
108
  return {
@@ -166,7 +173,8 @@ export default {
166
173
  return this.$axios.get(this.searchLink, {
167
174
  params: {
168
175
  s: (this.inputVal === null ? '' : this.inputVal)
169
- }
176
+ },
177
+ headers: this.headers
170
178
  }).then(({data}) => {
171
179
  this.apiData = data
172
180
  this.loading = false
@@ -217,6 +225,8 @@ export default {
217
225
  handleClick() {
218
226
  if (this.$refs.input) {
219
227
  this.$refs.input.focus()
228
+ } else {
229
+ this.focusInput(true)
220
230
  }
221
231
  },
222
232
  add() {
@@ -225,7 +235,7 @@ export default {
225
235
  if (!this.multiple) {
226
236
  this.chips = []
227
237
  }
228
- if (!this.combo && !this.tags) {
238
+ if (!this.tags) {
229
239
  const exist = this.$helper.searchArray(this.genItems, this.text, val[this.text])
230
240
  if (exist !== false) {
231
241
  this.chips.push(val)
@@ -242,8 +252,7 @@ export default {
242
252
  this.chips = this.$helper.uniqArray(this.chips)
243
253
 
244
254
  let val = this.chips
245
-
246
- if (this.tags) {
255
+ if (this.justValue) {
247
256
  val = []
248
257
  for (let i in this.chips) {
249
258
  if (this.$helper.hasKey(this.chips, i)) {
@@ -251,12 +260,9 @@ export default {
251
260
  }
252
261
  }
253
262
  }
254
- if (!this.multiple && !this.tags) {
263
+ if (!this.multiple) {
255
264
  val = val[0]
256
265
  if (val) {
257
- if (this.justValue) {
258
- val = val[this.value]
259
- }
260
266
  this.closeList()
261
267
  }
262
268
  }