renusify 2.2.2 → 2.2.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.
@@ -316,7 +316,8 @@ $btn-transition: opacity 0.2s map-get($transition, 'ease-in-out') !default;
316
316
 
317
317
  .btn-outlined,
318
318
  .btn-text {
319
- background-color: transparent
319
+ background-color: transparent;
320
+ color: inherit;
320
321
  }
321
322
 
322
323
  .btn-round,
@@ -2,10 +2,10 @@
2
2
  <r-select-input
3
3
  :label="$t('country','renusify')"
4
4
  v-model="country"
5
- v-if="!defaultCountry"
5
+ v-if="!hideCountry||!country"
6
6
  @update:model-value="emit(true,true)"
7
7
  value="id"
8
- :searchLink="`https://codenus.com/api/apps/address?lang=${$r.lang}`"
8
+ :searchLink="`${baseUrl}?lang=${$r.lang}`"
9
9
  :rules="required?['required']:[]"
10
10
  :headers="{'Authorization':''}"
11
11
  :readonly="readonly"
@@ -17,7 +17,7 @@
17
17
  :key="country&&country['id']"
18
18
  v-if="show_state"
19
19
  @update:model-value="emit(false,true)"
20
- :searchLink="country&&`https://codenus.com/api/apps/address/${country['id']}?lang=${$r.lang}`"
20
+ :searchLink="country&&`${baseUrl}/${country['id']}?lang=${$r.lang}`"
21
21
  :rules="required?['required']:[]"
22
22
  value="id"
23
23
  :headers="{'Authorization':''}"
@@ -31,7 +31,7 @@
31
31
  :key="state&&(country['id']+'-'+state['id'])"
32
32
  @update:model-value="emit(false,false)"
33
33
  :label="$t('city','renusify')"
34
- :searchLink="state&&`https://codenus.com/api/apps/address/${country['id']}/${state['id']}?lang=${$r.lang}`"
34
+ :searchLink="state&&`${baseUrl}/${country['id']}/${state['id']}?lang=${$r.lang}`"
35
35
  :rules="required?['required']:[]"
36
36
  value="id"
37
37
  :headers="{'Authorization':''}"
@@ -61,12 +61,14 @@ export default {
61
61
  required: Boolean,
62
62
  stepShow: Boolean,
63
63
  allowCountries: Array,
64
+ hideCountry: Boolean,
64
65
  hideState: Boolean,
65
66
  hideCity: Boolean,
66
67
  hideZipCode: Boolean,
67
68
  hideStreet: Boolean,
68
69
  readonly: Boolean,
69
70
  tile: {type: Boolean, default: undefined},
71
+ baseUrl: {type: String, default: "https://codenus.com/api/apps/address"},
70
72
  defaultCountry: Object,
71
73
  modelValue: Object
72
74
  },
@@ -1,147 +1,148 @@
1
1
  export default {
2
- props: {
3
- headers: Object
2
+ props: {
3
+ headers: Object
4
+ },
5
+ data() {
6
+ return {
7
+ imageStatus: 'inProgress',
8
+ CancelTokenSource: this.$axios.CancelToken.source(),
9
+ fileLink: '',
10
+ file: null,
11
+ uploadPercentage: 0,
12
+ }
13
+ },
14
+ methods: {
15
+ addFile() {
16
+ this.CancelTokenSource = this.$axios.CancelToken.source()
17
+ this.file = this.$refs.file.files[0]
18
+ if (!this.wPH) {
19
+ this.checkSave()
20
+ } else {
21
+ this.showCrop = true
22
+ }
23
+ this.showAdd = false
4
24
  },
5
- data() {
6
- return {
7
- imageStatus: 'inProgress',
8
- CancelTokenSource: this.$axios.CancelToken.source(),
9
- fileLink: '',
10
- file: null,
11
- uploadPercentage: 0,
12
- }
25
+ pickFile() {
26
+ this.$refs.file.click()
13
27
  },
14
- methods: {
15
- addFile() {
16
- this.CancelTokenSource = this.$axios.CancelToken.source()
17
- this.file = this.$refs.file.files[0]
18
- if (!this.wPH) {
19
- this.checkSave()
20
- } else {
21
- this.showCrop = true
22
- }
23
- this.showAdd = false
24
- },
25
- pickFile() {
26
- this.$refs.file.click()
27
- },
28
- fileDelete() {
29
- this.CancelTokenSource.cancel()
30
- this.deleteImage()
31
- this.showFile = false
32
- this.$nextTick(() => {
33
- this.showFile = true
34
- })
35
- this.file = null
36
- this.metaList = {}
37
- this.uploadPercentage = 0
38
- this.showAdd = true
39
- this.$emit('delete', true)
40
- this.$emit('file-link', null)
41
- },
42
- checkSave() {
43
- if (this.maxFileSize && this.file.size > this.maxFileSize) {
44
- this.CancelTokenSource.cancel()
45
- console.error('max file size must be:' + this.maxFileSize);
46
- console.error('current file size is:' + this.file.size);
47
- this.$toast(this.$t(['max_allow_size', [this.maxFileSize / 1024]], 'renusify'))
48
- return
49
- }
28
+ fileDelete() {
29
+ this.CancelTokenSource.cancel()
30
+ this.deleteImage().then(() => {
31
+ this.showFile = false
32
+ this.$nextTick(() => {
33
+ this.showFile = true
34
+ })
35
+ this.file = null
36
+ this.metaList = {}
37
+ this.uploadPercentage = 0
38
+ this.showAdd = true
39
+ this.$emit('delete', true)
40
+ this.$emit('file-link', null)
41
+ })
42
+ },
43
+ checkSave() {
44
+ if (this.maxFileSize && this.file.size > this.maxFileSize) {
45
+ this.CancelTokenSource.cancel()
46
+ console.error('max file size must be:' + this.maxFileSize);
47
+ console.error('current file size is:' + this.file.size);
48
+ this.$toast(this.$t(['max_allow_size', [this.maxFileSize / 1024]], 'renusify'))
49
+ return
50
+ }
50
51
 
51
- if (this.wPH) {
52
- let img = new Image();
53
- let objectUrl = URL.createObjectURL(this.file);
54
- let that = this
55
- const is_array = Array.isArray(this.wPH)
56
- let wPH = []
57
- if (is_array) {
58
- this.wPH.forEach((item) => {
59
- item = item.toString().split('/')
60
- if (item.length === 2) {
61
- wPH.push(parseFloat(item[0]) / parseFloat(item[1]))
52
+ if (this.wPH) {
53
+ let img = new Image();
54
+ let objectUrl = URL.createObjectURL(this.file);
55
+ let that = this
56
+ const is_array = Array.isArray(this.wPH)
57
+ let wPH = []
58
+ if (is_array) {
59
+ this.wPH.forEach((item) => {
60
+ item = item.toString().split('/')
61
+ if (item.length === 2) {
62
+ wPH.push(parseFloat(item[0]) / parseFloat(item[1]))
62
63
 
63
- } else {
64
- wPH.push(parseFloat(item[0]))
64
+ } else {
65
+ wPH.push(parseFloat(item[0]))
65
66
 
66
- }
67
- })
68
- } else {
69
- if (typeof this.wPH === 'string') {
70
- let item = this.wPH
71
- item = item.split('/')
72
- if (item.length === 2) {
73
- wPH.push(parseFloat((parseFloat(item[0]) / parseFloat(item[1])).toFixed(4)))
67
+ }
68
+ })
69
+ } else {
70
+ if (typeof this.wPH === 'string') {
71
+ let item = this.wPH
72
+ item = item.split('/')
73
+ if (item.length === 2) {
74
+ wPH.push(parseFloat((parseFloat(item[0]) / parseFloat(item[1])).toFixed(4)))
74
75
 
75
- } else {
76
- wPH.push(parseFloat(item[0]))
76
+ } else {
77
+ wPH.push(parseFloat(item[0]))
77
78
 
78
- }
79
- } else {
80
- wPH.push(this.wPH)
81
- }
79
+ }
80
+ } else {
81
+ wPH.push(this.wPH)
82
+ }
82
83
 
83
- }
84
- img.onload = function () {
85
- const wph = parseFloat((this.width / this.height).toFixed(4))
86
- if (!wPH.includes(wph)) {
87
- that.CancelTokenSource.cancel()
88
- that.$toast(that.$t(['image_w_p_h', [that.wPH]], 'renusify'))
89
- console.error('width per height must be:' + that.wPH, wPH);
90
- console.error('current width per height is:' + wph);
91
- }
84
+ }
85
+ img.onload = function () {
86
+ const wph = parseFloat((this.width / this.height).toFixed(4))
87
+ if (!wPH.includes(wph)) {
88
+ that.CancelTokenSource.cancel()
89
+ that.$toast(that.$t(['image_w_p_h', [that.wPH]], 'renusify'))
90
+ console.error('width per height must be:' + that.wPH, wPH);
91
+ console.error('current width per height is:' + wph);
92
+ }
92
93
 
93
- URL.revokeObjectURL(objectUrl);
94
- that.saveImage()
95
- };
96
- img.src = objectUrl;
97
- return;
98
- }
99
- this.saveImage()
100
- },
101
- saveImage() {
102
- this.imageStatus = 'inProgress'
103
- let fileData = new FormData()
104
- fileData.append('file', this.file, this.file.name)
105
- let headers = this.headers
106
- if (!headers) {
107
- headers = {}
108
- }
109
- headers['Content-Type'] = 'multipart/form-data'
110
- let link = this.uploadLink
111
- if (this.maxFileSize) {
112
- if (link.indexOf('?') === -1) {
113
- link += '?'
114
- } else {
115
- link += '&'
116
- }
117
- link += 'max_size=' + this.maxFileSize
118
- }
119
- this.$axios.post(link, fileData,
120
- {
121
- headers: headers,
122
- onUploadProgress: function (progressEvent) {
123
- this.uploadPercentage = Math.min(parseInt(Math.floor((progressEvent.loaded * 100) / progressEvent.total)), 98)
124
- }.bind(this),
125
- cancelToken: this.CancelTokenSource.token
126
- }
127
- )
128
- .then((res) => {
129
- this.fileLink = res.data.link
130
- this.uploadPercentage = 100
131
- this.emit()
132
- this.imageStatus = 'finished'
133
- }, () => {
134
- this.imageStatus = 'fails'
135
- this.uploadPercentage = 0
136
- })
137
- },
138
- deleteImage() {
139
- this.$axios.delete(this.uploadLink,
140
- {
141
- data: {link: this.fileLink},
142
- headers: this.headers
143
- }
144
- )
145
- },
146
- }
94
+ URL.revokeObjectURL(objectUrl);
95
+ that.saveImage()
96
+ };
97
+ img.src = objectUrl;
98
+ return;
99
+ }
100
+ this.saveImage()
101
+ },
102
+ saveImage() {
103
+ this.imageStatus = 'inProgress'
104
+ let fileData = new FormData()
105
+ fileData.append('file', this.file, this.file.name)
106
+ let headers = this.headers
107
+ if (!headers) {
108
+ headers = {}
109
+ }
110
+ headers['Content-Type'] = 'multipart/form-data'
111
+ let link = this.uploadLink
112
+ if (this.maxFileSize) {
113
+ if (link.indexOf('?') === -1) {
114
+ link += '?'
115
+ } else {
116
+ link += '&'
117
+ }
118
+ link += 'max_size=' + this.maxFileSize
119
+ }
120
+ this.$axios.post(link, fileData,
121
+ {
122
+ headers: headers,
123
+ onUploadProgress: function (progressEvent) {
124
+ this.uploadPercentage = Math.min(parseInt(Math.floor((progressEvent.loaded * 100) / progressEvent.total)), 98)
125
+ }.bind(this),
126
+ cancelToken: this.CancelTokenSource.token
127
+ }
128
+ )
129
+ .then((res) => {
130
+ this.fileLink = res.data.link
131
+ this.uploadPercentage = 100
132
+ this.emit()
133
+ this.imageStatus = 'finished'
134
+ }, () => {
135
+ this.imageStatus = 'fails'
136
+ this.uploadPercentage = 0
137
+ })
138
+ },
139
+ deleteImage() {
140
+ return this.$axios.delete(this.uploadLink,
141
+ {
142
+ data: {link: this.fileLink},
143
+ headers: this.headers
144
+ }
145
+ )
146
+ },
147
+ }
147
148
  }
@@ -14,7 +14,7 @@
14
14
  >
15
15
  {{ `% ${uploadPercentage}` }}
16
16
  </r-progress-circle>
17
- <r-btn :href="'/'+fileLink" class="image-copy" icon target="_blank">
17
+ <r-btn :href="fileLink" class="image-copy" icon target="_blank">
18
18
  <r-icon v-html="$r.icons.eye"></r-icon>
19
19
  </r-btn>
20
20
  <img v-if="isImg()" :class="`image ${imageStatus} `" :src="getUrl(file)">
@@ -89,7 +89,7 @@ export default {
89
89
  methods: {
90
90
  setValue() {
91
91
  if (this.modelValue) {
92
- this.fileLink = this.meta ? this.modelValue['url'] : this.modelValue
92
+ this.fileLink = this.$helper.fix_url(this.meta ? this.modelValue['url'] : this.modelValue)
93
93
  this.metaList = this.meta ? this.modelValue['meta'] : {}
94
94
  this.showAdd = false
95
95
  this.imageStatus = 'finished'
@@ -99,7 +99,7 @@ export default {
99
99
  },
100
100
  getUrl(value) {
101
101
  if (this.modelValue) {
102
- return '/' + this.fileLink
102
+ return this.fileLink
103
103
  } else {
104
104
  return URL.createObjectURL(value)
105
105
  }
@@ -46,7 +46,7 @@
46
46
  width:$refs.select&&$refs.select.getBoundingClientRect().width+'px'
47
47
  }"
48
48
  >
49
- <r-list :filter="inputVal&&inputVal.trim()"
49
+ <r-list :filter="!searchLink?(inputVal&&inputVal.trim()):''"
50
50
  :items="genItems"
51
51
  :multiple="multiple"
52
52
  :modelValue="chips"
@@ -67,6 +67,9 @@ emits:['update:modelValue'],
67
67
  this.$refs.input.focus()
68
68
  },
69
69
  emit() {
70
+ if (this.unit === null) {
71
+ this.unit = this.units[0]
72
+ }
70
73
  this.$emit('update:modelValue', {value: this.lazyValue, unit: this.unit})
71
74
  }
72
75
  }
@@ -94,7 +94,7 @@ export default {
94
94
  res += this.query
95
95
  }
96
96
  if (this.isSvg && this.svgCache) {
97
- res += 'c=' + this.svgCache
97
+ res += '&c=' + this.svgCache
98
98
  }
99
99
  if (!this.isSvg && ((this.autoSize && this.size.width > 0) || this.width)) {
100
100
  res += `&w=${this.size.width}`
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
- <r-container class="container-fluid">
4
- <r-row class="h-start h-space-between">
3
+ <r-container class="container-fluid pa-0 mb-3">
4
+ <r-row class="h-start h-space-between" no-gutter>
5
5
  <r-col class="col-auto">
6
6
  <r-btn v-if="!disableAdd"
7
7
  class="color-success-text"
@@ -30,7 +30,7 @@
30
30
  </r-col>
31
31
  <r-col v-if="!show" class="col-12">
32
32
  <r-text-input :label="$t('search','renusify')"
33
- :model-value="search"
33
+ :model-value="modelValue"
34
34
  @update:modelValue="$emit('update:modelValue',$event)"></r-text-input>
35
35
  </r-col>
36
36
  <r-col v-else class="col-12">
@@ -42,18 +42,18 @@
42
42
  :items="headers[0]"
43
43
  :label="$t('name','renusify')"
44
44
  just-value></r-select-input>
45
- <div v-if="info.key" :key="info.key">
46
- <r-select-input v-model="info.action"
47
- :items="[
45
+
46
+ <r-select-input v-if="info.key" :key="info.key" v-model="info.action"
47
+ :items="[
48
48
  {name:$t('advance_search_equal','renusify'),value:'e'},
49
49
  {name:$t('advance_search_not_equal','renusify'),value:'ne'},
50
50
  {name:$t('advance_search_gt','renusify'),value:'gt'},
51
51
  {name:$t('advance_search_lt','renusify'),value:'lt'}]"
52
- :label="$t('advance_search_operator','renusify')"
53
- disableSearch
54
- firstSelect
55
- justValue></r-select-input>
56
- </div>
52
+ :label="$t('advance_search_operator','renusify')"
53
+ disableSearch
54
+ firstSelect
55
+ justValue></r-select-input>
56
+
57
57
  <div v-if="info.key" :key="info.key">
58
58
  <component :is="headers[1][info.key].type" v-if="headers[1][info.key].type"
59
59
  v-model="info.value"
@@ -92,7 +92,7 @@ export default {
92
92
  advanceSearch: Boolean,
93
93
  mcud: Boolean,
94
94
  newItem: Function,
95
- search: String
95
+ modelValue: String
96
96
  },
97
97
  emits: ['update:modelValue', 'copy', 'edit', 'delete', 'a-search'],
98
98
  data() {
@@ -109,6 +109,9 @@ export default {
109
109
  for (let i = 0; i < this.headerTable.length; i++) {
110
110
  r.push({'name': this.$t(this.headerTable[i].text), 'value': this.headerTable[i].value})
111
111
  r2[this.headerTable[i].value] = this.headerTable[i].option
112
+ if (this.headerTable[i].option.type === 'r-date-input' || this.headerTable[i].option.type === 'r-time-ago') {
113
+ r2[this.headerTable[i].value]['withTime'] = true
114
+ }
112
115
  }
113
116
  return [r, r2]
114
117
  }
@@ -58,7 +58,60 @@
58
58
  @edit="copyHandle('edit')"
59
59
  @update:modelValue="searching()"
60
60
  @a-search="(a_search=$event),(searching())"></manage-header>
61
- <r-table :headers="headerTable" :items="table.data" :key-item="itemId" :responsive="responsive"
61
+ <div v-if="card" class="d-flex overflow-x-auto">
62
+ <div class="d-flex">
63
+ <r-card v-for="(item,i) in table.data" :key="i" :class="{'br-lg':!$r.inputs.tile}" class="pa-3 me-3"
64
+ style="width: 300px">
65
+ <div v-for="(h,j) in headerTable" :key="i+'-'+j" class="d-flex text-no-wrap overflow-x-auto">
66
+ <slot :data="item" :header="h" name="card">
67
+ <div v-if="h['option']['type']==='r-date-input' && item[h['value']]!==undefined" class="py-2">
68
+ {{ h['text'] }}: {{ $d(new Date(item[h['value']]), h['option']['format'] || 'short') }}
69
+ </div>
70
+ <div
71
+ v-else-if="h['option']['type']==='r-time-ago' && item[h['value']]!==undefined" class="py-2">
72
+ {{ h['text'] }}:
73
+ <r-time-ago :time="item[h['value']]"></r-time-ago>
74
+ </div>
75
+ <div v-else-if="h['option']['type']==='r-switch-input'" class="d-flex py-2">
76
+ {{ h['text'] }}:
77
+ <r-switch-input
78
+ :modelValue="item[h['value']]"
79
+ :readonly="h['option']['formInput']===false"
80
+ class="mt-0"
81
+ @update:modelValue="h['option']['formInput']!==false?editItem(item,true,h['value']):''"
82
+ ></r-switch-input>
83
+ </div>
84
+ <div v-else-if="h['option']['type'] === 'r-number-input'" class="py-2">
85
+ {{ h['text'] }}: {{ $n(item[h["value"]]) }}
86
+ </div>
87
+ <div v-else-if="h['option']['type']!=='action'" class="py-2">
88
+ {{ h['text'] }}: {{
89
+ h['value'] in cast ?
90
+ $helper.ifHas(item, '', h['value'], cast[h['value']])
91
+ : item[h['value']]
92
+ }}
93
+ </div>
94
+ </slot>
95
+ <div v-if="h['option']['type']==='action'" class="w-full text-end">
96
+ <r-divider class="mt-3"></r-divider>
97
+ <r-btn v-if="!disableUpdate" class="mx-0 color-success-text"
98
+ icon text @click.prevent="editItem(item)">
99
+ <r-icon exact v-html="$r.icons.edit"></r-icon>
100
+ </r-btn>
101
+ <r-btn v-if="!disableDelete" class="mx-0 color-error-text"
102
+ icon text @click.prevent="deleteItem(item)">
103
+ <r-icon v-html="$r.icons.delete"></r-icon>
104
+ </r-btn>
105
+ <r-btn v-for="(val,index) in actions" :key="index" :class="`color-${val.color}-text`" class="mx-0" icon
106
+ text @click.prevent="$emit(val.name,item)">
107
+ <r-icon exact v-html="val.icon"></r-icon>
108
+ </r-btn>
109
+ </div>
110
+ </div>
111
+ </r-card>
112
+ </div>
113
+ </div>
114
+ <r-table v-else :headers="headerTable" :items="table.data" :key-item="itemId" :responsive="responsive"
62
115
  transition="table-row">
63
116
  <template v-slot:header="{header}">
64
117
  <th v-for="(item,key) in header"
@@ -201,6 +254,7 @@ export default {
201
254
  default: true
202
255
  },
203
256
 
257
+ card: Boolean,
204
258
  disableAdd: Boolean,
205
259
  advanceSearch: {type: Boolean, default: true},
206
260
  disableDelete: Boolean,
@@ -286,7 +286,9 @@ $data-table-regular-header-height: 38px !default;
286
286
 
287
287
  .manage-footer {
288
288
  .btn-page {
289
- border: solid 1px var(--color-border);
289
+ color: var(--color-on-sheet);
290
+ border: solid 1px var(--color-sheet-low);
291
+ background-color: var(--color-sheet-container);
290
292
  }
291
293
  }
292
294
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "renusify",
3
- "version": "2.2.2",
3
+ "version": "2.2.4",
4
4
  "description": "Vue3 Framework",
5
5
  "keywords": [
6
6
  "vuejs",
@@ -155,7 +155,9 @@ export default class Translate {
155
155
  this.local = locale;
156
156
  this.setMessages({});
157
157
  }
158
+ setTimeout(() => {
158
159
  this.$r.store['langs_loaded'][pack] = true;
160
+ }, 50)
159
161
  } else {
160
162
  this.$r.store['langs_loaded'][pack] = true;
161
163
  }
package/style/base.scss CHANGED
@@ -205,6 +205,7 @@ button,
205
205
  input,
206
206
  select,
207
207
  textarea {
208
+ color: currentColor;
208
209
  background-color: transparent;
209
210
  border-style: none;
210
211
  }
package/tools/helper.js CHANGED
@@ -399,3 +399,10 @@ export function changeColor(vars) {
399
399
  css += '}'
400
400
  style.appendChild(document.createTextNode(css));
401
401
  }
402
+
403
+ export function fix_url(url) {
404
+ if (url.startsWith("/") || url.startsWith("http:") || url.startsWith("https:")) {
405
+ return url
406
+ }
407
+ return "/" + url
408
+ }