renusify 1.1.4 → 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.
@@ -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 {
@@ -50,6 +50,8 @@
50
50
  :items="genItems"
51
51
  :multiple="multiple"
52
52
  :modelValue="chips"
53
+ :text="text"
54
+ :val="value"
53
55
  @update:modelValue="listInput"
54
56
  checked>
55
57
  <template v-slot="props">
@@ -99,7 +101,8 @@ export default {
99
101
  justValue: Boolean,
100
102
  openToTop: Boolean,
101
103
  translate: Boolean,
102
- firstSelect: Boolean
104
+ firstSelect: Boolean,
105
+ headers: Object
103
106
  },
104
107
  data() {
105
108
  return {
@@ -170,7 +173,8 @@ export default {
170
173
  return this.$axios.get(this.searchLink, {
171
174
  params: {
172
175
  s: (this.inputVal === null ? '' : this.inputVal)
173
- }
176
+ },
177
+ headers: this.headers
174
178
  }).then(({data}) => {
175
179
  this.apiData = data
176
180
  this.loading = false
@@ -117,6 +117,7 @@
117
117
  <r-file-input v-model="image"
118
118
  :label="$t('image','renusify')"
119
119
  :size="1"
120
+ :headers="headers"
120
121
  :upload-link="uploadLink"
121
122
  accept="image/*"></r-file-input>
122
123
  <r-text-input v-model="img_alt"
@@ -152,6 +153,7 @@
152
153
  <r-file-input v-model="video"
153
154
  :label="$t('video','renusify')"
154
155
  :size="1"
156
+ :headers="headers"
155
157
  :upload-link="uploadLink"
156
158
  accept="video/mp4,video/webm"></r-file-input>
157
159
  <r-number-input v-model="img_width" :label="$t('width','renusify')"
@@ -187,15 +189,16 @@
187
189
  name: 'r-text-editor',
188
190
  inheritAttrs: false,
189
191
  props: {
190
- uploadLink: {type: String, default: '/storage'},
191
- modelValue: {
192
- type: [Object, String], default: () => {
193
- return {
194
- text: '',
195
- files: []
196
- }
197
- }
192
+ uploadLink: {type: String, default: '/storage'},
193
+ modelValue: {
194
+ type: [Object, String], default: () => {
195
+ return {
196
+ text: '',
197
+ files: []
198
+ }
198
199
  }
200
+ },
201
+ headers: Object
199
202
  },
200
203
  data() {
201
204
  return {
@@ -393,7 +396,8 @@
393
396
  deleteImage(img, i) {
394
397
  this.$axios.delete(this.uploadLink,
395
398
  {
396
- data: {link: img}
399
+ data: {link: img},
400
+ headers: this.headers
397
401
  }
398
402
  ).then(() => {
399
403
  this.files.splice(i, 1)
@@ -22,6 +22,7 @@ export default {
22
22
  default: null,
23
23
  type: String
24
24
  },
25
+ headers: Object
25
26
  },
26
27
  data() {
27
28
  return {
@@ -40,7 +41,7 @@ export default {
40
41
  if (this.item) {
41
42
  this.$axios.post(this.link, {
42
43
  'unique_name': this.item
43
- })
44
+ }, {headers: this.headers})
44
45
  .then((res) => {
45
46
  if (res.data) {
46
47
  this.color = 'color-success-text'
@@ -64,7 +64,8 @@ export default {
64
64
  return {}
65
65
  },
66
66
  type: Object
67
- }
67
+ },
68
+ headers: Object
68
69
  },
69
70
  data() {
70
71
  return {
@@ -180,7 +181,7 @@ export default {
180
181
  return
181
182
  }
182
183
  this.loading = true
183
- this.$axios[this.method](this.url, this.editedItem)
184
+ this.$axios[this.method](this.url, this.editedItem, {headers: this.headers})
184
185
  .then(() => {
185
186
  this.close()
186
187
  }, (error) => {
@@ -14,12 +14,17 @@
14
14
  }"
15
15
  >{{ alt }}
16
16
  </div>
17
- <img v-if="load" ref="img" :src="link" :alt="alt" draggable="false" :width="size.width" :height="size.height"/>
17
+ <img v-if="load &&!isSvg" ref="img" :src="link" :alt="alt" draggable="false" :width="size.width"
18
+ :height="size.height"/>
19
+ <svg-img v-else-if="load &&isSvg&&link" :link="link" :size="size">
20
+ </svg-img>
18
21
  </div>
19
22
  </template>
20
23
  <script>
24
+ import SvgImg from "./svgImg";
21
25
  export default {
22
26
  name: 'r-img',
27
+ components: {SvgImg},
23
28
  props: {
24
29
  src: {
25
30
  type: String,
@@ -53,6 +58,8 @@ export default {
53
58
  titleVs: Boolean,
54
59
  titleVc: Boolean,
55
60
  titleVe: Boolean,
61
+ isSvg: Boolean,
62
+ svgCache: {type: Number, default: 86400},
56
63
  wPH: {
57
64
  type: Number,
58
65
  default: 1
@@ -85,7 +92,10 @@ export default {
85
92
  if (this.query) {
86
93
  res += this.query
87
94
  }
88
- if ((this.autoSize && this.size.width > 0) || this.width) {
95
+ if (this.isSvg && this.svgCache) {
96
+ res += 'c=' + this.svgCache
97
+ }
98
+ if (!this.isSvg && ((this.autoSize && this.size.width > 0) || this.width)) {
89
99
  res += `&w=${this.size.width}&h=${this.size.height}`
90
100
  }
91
101
  return res
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <span ref="img"></span>
3
+ </template>
4
+ <script>
5
+ export default {
6
+ name: "svgImg",
7
+ props: {
8
+ link: String,
9
+ size: Object
10
+ },
11
+ created() {
12
+ this.ImgToSvg()
13
+ },
14
+ methods: {
15
+ replace(svg) {
16
+ if (!this.$refs.img) {
17
+ setTimeout(() => {
18
+ this.replace(svg)
19
+ }, 10)
20
+ return
21
+ }
22
+ this.$refs.img.replaceWith(svg)
23
+ },
24
+ ImgToSvg() {
25
+ const that = this
26
+ fetch(this.link).then(x => {
27
+ x.text().then((d) => {
28
+ const el = document.createElement('div')
29
+ el.innerHTML = d
30
+ let svg = el.querySelector('svg')
31
+ svg.setAttribute('width', that.size.width + 'px')
32
+ svg.setAttribute('height', that.size.height + 'px')
33
+ that.replace(svg)
34
+ })
35
+ })
36
+ }
37
+ }
38
+ }
39
+ </script>
40
+
41
+ <style lang="scss">
42
+ @import "~renusify/style/include";
43
+ </style>
@@ -50,6 +50,7 @@ export default {
50
50
  default: 10000,
51
51
  type: Number
52
52
  },
53
+ headers: Object
53
54
  },
54
55
  data() {
55
56
  return {
@@ -110,7 +111,7 @@ export default {
110
111
  Object.assign(par, this.query)
111
112
 
112
113
  }
113
- this.$axios.get(this.url, {params: par}).then(
114
+ this.$axios.get(this.url, {params: par, headers: this.headers}).then(
114
115
  (res) => {
115
116
  this.push(res.data.data, end)
116
117
  this.total = res.data.total
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="infinite-page">
3
3
  <div class="infinite-page-container" v-scroll="onScroll">
4
- <slot :items="datacollection"></slot>
4
+ <slot :items="datacollection" :total="total"></slot>
5
5
  </div>
6
6
  <r-progress-line color="color-two"
7
7
  v-show="loading"
@@ -23,17 +23,18 @@ export default {
23
23
  required: true,
24
24
  type: String
25
25
  },
26
- query: {
27
- type: Object
28
- },
29
- noItemMsg: {
30
- type: String,
31
- default: 'ITEMS NOT FOUND'
32
- },
33
- distanceLoad: {
34
- type: Number,
35
- default: 150
36
- }
26
+ query: {
27
+ type: Object
28
+ },
29
+ noItemMsg: {
30
+ type: String,
31
+ default: 'ITEMS NOT FOUND'
32
+ },
33
+ distanceLoad: {
34
+ type: Number,
35
+ default: 150
36
+ },
37
+ headers: Object
37
38
  },
38
39
  data() {
39
40
  return {
@@ -75,17 +76,17 @@ export default {
75
76
  if (typeof this.query==='object') {
76
77
  Object.assign(par,{},this.query)
77
78
  }
78
- this.$axios.get(this.url,{params:par}).then(
79
- (res) => {
80
- this.push(res.data.data)
81
- this.total = res.data.total
82
- if (this.total === 0) {
83
- this.noItem = true
84
- }
85
- this.loading = false
86
- }, () => {
87
- this.loading = false
88
- })
79
+ this.$axios.get(this.url, {params: par, headers: this.headers}).then(
80
+ (res) => {
81
+ this.push(res.data.data)
82
+ this.total = res.data.total
83
+ if (this.total === 0) {
84
+ this.noItem = true
85
+ }
86
+ this.loading = false
87
+ }, () => {
88
+ this.loading = false
89
+ })
89
90
  },
90
91
  push(data) {
91
92
  const lng=data.length
@@ -1,16 +1,18 @@
1
1
  <template>
2
2
  <div :class="classes">
3
- <div :class="`list-item h-space-between ${$helper.searchArray(list,text,item_value[text])!==false?'list-item-active color-one-text':''}`"
4
- :key="item_key"
5
- @click.prevent="handle(item_value)"
6
- v-for="(item_value,item_key) in genItems"
7
- v-ripple
8
- >
9
- <slot :item="item_value">
10
- <div class="list-title">{{ item_value[text] }}</div>
11
- <transition name="fade">
12
- <r-icon class="pe-1"
13
- exact
3
+ <div
4
+ class="list-item h-space-between"
5
+ :class="{'list-item-active color-one-text':$helper.searchArray(list,text,item_value[text])!==false}"
6
+ :key="item_key"
7
+ @click.prevent="handle(item_value)"
8
+ v-for="(item_value,item_key) in genItems"
9
+ v-ripple
10
+ >
11
+ <slot :item="item_value">
12
+ <div class="list-title">{{ item_value[text] }}</div>
13
+ <transition name="fade">
14
+ <r-icon class="pe-1"
15
+ exact
14
16
  v-html="$r.icons.check"
15
17
  v-if="(checked&&$helper.searchArray(list,text,item_value[text])!==false)"
16
18
  ></r-icon>
@@ -21,30 +23,29 @@
21
23
  </template>
22
24
 
23
25
  <script>
24
- import './style.scss'
26
+ import './style.scss'
27
+ import Ripple from '../../directive/ripple/index'
25
28
 
26
29
  export default {
27
- name: 'r-list',
28
- props: {
29
- disabled: Boolean,
30
- multiple: Boolean,
31
- min: {type: Number, default: 0},
32
- text: {type: String, default: 'name'},
33
- val: {type: String, default: 'value'},
34
- flat: Boolean,
35
- rounded: Boolean,
36
- subheader: Boolean,
37
- checked: Boolean,
38
- filter: String,
39
- items: Array,
40
- modelValue: {type:[Array, Object]}
41
- },
30
+ name: 'r-list',
31
+ directives: {ripple: Ripple},
32
+ props: {
33
+ disabled: Boolean,
34
+ multiple: Boolean,
35
+ min: {type: Number, default: 0},
36
+ text: {type: String, default: 'name'},
37
+ value: {type: String, default: 'value'},
38
+ flat: Boolean,
39
+ rounded: Boolean,
40
+ subheader: Boolean,
41
+ checked: Boolean,
42
+ filter: String,
43
+ items: Array,
44
+ modelValue: {type: [Array, Object]}
45
+ },
42
46
  computed: {
43
47
  list() {
44
48
  if (this.modelValue) {
45
- if (!this.multiple&&this.modelValue[0]) {
46
- return [this.modelValue[0]]
47
- }
48
49
  return this.modelValue
49
50
  }
50
51
  return []
@@ -96,6 +97,7 @@
96
97
  return
97
98
  }
98
99
  let val = this.list
100
+
99
101
  const index = this.$helper.searchArray(val, this.text, item[this.text])
100
102
 
101
103
  if (index !== false) {