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.
@@ -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 class="color-success-text" v-if="pass!==null && pass!==false" v-html="$r.icons.check" exact width="20" height="20"></r-icon>
24
- <r-icon class="color-error-text" v-if=" pass===false" v-html="$r.icons.close" width="20" height="20"></r-icon>
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 v-if="template[k]&&template[k]['type']" :is="template[k]['type']" v-model="item[k]" :label="t(k)"
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||validations.length>0,
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
- </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>
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')" v-model="info.value"></r-number-input>
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')" v-model="info.value"></r-switch-input>
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
- 'x-small': 20,
50
- 'small': 25,
51
- 'default': 30,
52
- 'large': 35,
53
- 'x-large': 40
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
- .#{$prefix}icon{
68
+
69
+ .#{$prefix}icon {
68
70
  height: #{$size - 4px};
69
71
  width: #{$size - 4px}
70
72
  }
@@ -14,11 +14,11 @@
14
14
  }"
15
15
  >{{ alt }}
16
16
  </div>
17
- <img v-if="load &&!isSvg" ref="img" :src="link" :alt="alt" draggable="false" :width="size.width>0?size.width:'auto'"
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
- transition-property: opacity,transform;
6
- &.fade{
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
- &.animate{
9
+
10
+ &.animate {
9
11
  opacity: 1;
10
12
  }
11
13
  }
12
- &.scaleIn{
14
+
15
+ &.scaleIn {
13
16
  transform: scale(.5);
14
17
  &.animate{
15
18
  transform:translateZ(0) scale(1);
@@ -1,5 +1,5 @@
1
1
  import './style.scss'
2
- import {keys, ifHas, cleanArray} from '../../tools/helper'
2
+ import {cleanArray, ifHas, keys} from '../../tools/helper'
3
3
 
4
4
  let scopeObj;
5
5
 
@@ -2,15 +2,18 @@
2
2
 
3
3
  .r-directive-sortable {
4
4
  position: relative;
5
- .dragable{
6
- .grab{
5
+
6
+ .dragable {
7
+ .grab {
7
8
  cursor: grab;
8
9
  }
9
- &.grab{
10
+
11
+ &.grab {
10
12
  cursor: grab;
11
13
  }
12
14
  }
13
- .sortable-holder{
15
+
16
+ .sortable-holder {
14
17
  background-color: rgba(20, 200, 255, 0.5);
15
18
  }
16
19
  .on-drag {
@@ -9,7 +9,7 @@
9
9
  position: fixed;
10
10
  border-radius: map-get($borders, 'sm');
11
11
  font-size: 14px;
12
- font-family: fontOne;
12
+ font-family: inherit;
13
13
  transform: translateX(-50%);
14
14
  z-index: 50;
15
15
  opacity: 0;
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,6 +1,6 @@
1
1
  {
2
2
  "name": "renusify",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Vue3 Framework",
5
5
  "keywords": [
6
6
  "vuejs",
@@ -1,13 +1,14 @@
1
1
  export default class Currency {
2
- constructor($r) {
3
- this.$r=$r
4
- }
5
- formatLocal (value) {
6
- try {
7
- return new Intl.NumberFormat(this.$r.lang).format(value);
8
- }catch (e) {
9
- console.error(e)
10
- return value
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,6 +1,6 @@
1
1
  export default class DateTime {
2
- constructor($r,langs) {
3
- this.$r=$r
2
+ constructor($r, langs) {
3
+ this.$r = $r
4
4
  this.format = {
5
5
  narrow: {
6
6
  weekday: 'narrow'
@@ -1,9 +1,9 @@
1
1
  import Axios from 'axios';
2
2
 
3
3
  export default class Translate {
4
- constructor($r,$storage) {
5
- this.$r=$r
6
- this.$storage=$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
- 'object key must have variables. key:' + key + ' variable:' + variable
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
- 'package name must be string. key:' + key + ' package_name:' + package_name
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
- 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];
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.local = locale;
149
- this.setMessages(lang);
150
- } else {
151
- this.local = locale;
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
- constructor($t) {
3
- this.$t=$t
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
- requiredArray() {
11
- return (v) => (v !== undefined && v !== null && v.length > 0) || this.$t('required_error','renusify');
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
- email() {
15
- return (v) => (v && v.length > 0 ? /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) : true) || this.$t('validate_email','renusify');
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
- 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
+ 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
- return this.$t(['validate_match', [val]],'renusify');
28
+ return this.$t(['validate_match', [val]], 'renusify');
28
29
  }
29
30
  }
30
31
  }
31
32
 
32
33
  phone() {
33
- 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
+ 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
- return (v) => (v && v.length > 0 ? /^([0-9.])*$/.test(v) : true) || this.$t('numeric_error','renusify');
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
- return (v) => (v && v.length > 0 ? /^([0-9a-zA-Z])*$/.test(v) : true) || this.$t('english_error','renusify');
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
- return v => (v && v.length > 0 ? v.length >= parseInt(num)?true: this.$t(['min_len_error', [num,v.length]],'renusify') : true)
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
- return v => (v && v.length > 0 ? v.length <= parseInt(num)?true: this.$t(['max_len_error', [num,v.length]],'renusify') : true)
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
- return v => (v && v.length > 0 ? v.length === parseInt(num)?true: this.$t(['len_error', [num,v.length]],'renusify') : true) || msg
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
- return v => (v ? parseFloat(v) >= parseFloat(num)?true: this.$t(['min_error', [num,parseFloat(v)]],'renusify') : true)
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
- return v => (v ? parseFloat(v) <= parseFloat(num)?true: this.$t(['max_error', [num,parseFloat(v)]],'renusify') : true)
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
- return v => (v ? parseFloat(v) === parseFloat(num) : true) || this.$t(['validate_eq', [num]],'renusify');
66
+ return v => (v ? parseFloat(v) === parseFloat(num) : true) || this.$t(['validate_eq', [num]], 'renusify');
66
67
  }
67
68
 
68
69
  notDefined(name) {
69
- return v => this.$t(['validate_notDefined', [name]],'renusify');
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 ||'copy_text_to_clipboard', {type: 'success'});
38
+ Toast.show(msg || 'text copied.', {type: 'success'});
39
39
  }, function () {
40
- Toast.show(msg ||'text_not_copied', {type: 'error'});
40
+ Toast.show('text not copied.', {type: 'error'});
41
41
  })
42
42
  }
43
43