renusify 1.1.0 → 1.1.2

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.
@@ -1,15 +1,15 @@
1
1
  <template>
2
- <div :class="`${$r.prefix}avatar ${!flat?'elevation-'+elevation:''} ${tile?'avatar-tile':''}`"
2
+ <div :class="`${$r.prefix}avatar ${tile?'avatar-tile':''}`"
3
3
  :style="`height:${size}px;width:${size}px;`">
4
- <div class="avatar-content" :key="k">
5
- <slot></slot>
6
- </div>
7
- <r-btn :loading="loading" v-if="editable" @click.prevent.stop="pickFile" icon class="avatar-edit color-info">
8
- <r-icon v-html="$r.icons.camera"></r-icon>
9
- </r-btn>
10
- <input v-if="editable" accept="image/*"
11
- @change="addFile()"
12
- ref="file"
4
+ <div class="avatar-content" :class="`${!flat?'elevation-'+elevation:''}`" :key="k">
5
+ <slot></slot>
6
+ </div>
7
+ <r-btn :loading="loading" v-if="editable" @click.prevent.stop="pickFile" icon class="avatar-edit color-info">
8
+ <r-icon v-html="$r.icons.camera"></r-icon>
9
+ </r-btn>
10
+ <input v-if="editable" accept="image/*"
11
+ @change="addFile()"
12
+ ref="file"
13
13
  class="d-none"
14
14
  type="file"
15
15
  >
@@ -72,7 +72,8 @@ $btn-transition: opacity 0.2s map-get($transition, 'ease-in-out') !default;
72
72
  }
73
73
 
74
74
  &:not(.btn-text):not(.btn-outlined) {
75
- background-color: var(--color-sheet)
75
+ background-color: var(--color-sheet);
76
+ color: var(--color-text-primary)
76
77
  }
77
78
 
78
79
  &.btn-outlined.btn-text {
@@ -255,7 +255,9 @@ export default {
255
255
  this.direction = currentDate !== oldDate
256
256
  ? (currentDate > oldDate ? 'next' : 'prev')
257
257
  : undefined
258
- this.$emit('change', this.rangeLocalDate)
258
+ setTimeout(() => {
259
+ this.$emit('change', this.rangeLocalDate)
260
+ }, 10)
259
261
  }
260
262
  },
261
263
  methods: {
@@ -37,7 +37,7 @@ export default {
37
37
  },
38
38
  computed: {
39
39
  classes () {
40
- let c = this.$r.prefix+'chip px-3 chip-size-' + this.size
40
+ let c = this.$r.prefix + 'chip chip-size-' + this.size
41
41
  if (this.selectable) {
42
42
  c += ' chip-selectable'
43
43
  }
@@ -47,7 +47,7 @@ $icon-sizes: (
47
47
  display: inline-flex;
48
48
  line-height: 20px;
49
49
  outline: none;
50
- padding: 0;
50
+ padding: 0 12px;
51
51
  position: relative;
52
52
  text-decoration: none;
53
53
  transition-duration: $chip-transition-duration;
@@ -2,20 +2,60 @@
2
2
  <main :class="{[$r.prefix+'content']:true,
3
3
  'flipped':flipped,
4
4
  'moved':moved,
5
- 'below-header':belowHeader}">
5
+ 'below-header':belowHeader}" :style="{'--belowHeader':belowHeader}">
6
6
  <slot></slot>
7
7
  </main>
8
8
  </template>
9
9
 
10
10
  <script>
11
- import './style.scss'
12
11
 
13
12
  export default {
14
13
  name: 'r-content',
15
14
  props: {
16
- belowHeader: Boolean,
15
+ belowHeader: String,
17
16
  flipped: Boolean,
18
17
  moved: Boolean
19
18
  }
20
19
  }
21
20
  </script>
21
+
22
+ <style lang="scss">
23
+ @import '../../style/_include';
24
+
25
+ .#{$prefix}content {
26
+ --belowHeader: #{$toolbar-height};
27
+ width: 100%;
28
+ max-width: 100%;
29
+ transition: 0.2s map-get($transition, 'fast-out-slow-in');
30
+ position: relative;
31
+ @include firefox() {
32
+ @media print {
33
+ display: block
34
+ }
35
+ }
36
+
37
+ &.flipped {
38
+ @include rtl() {
39
+ padding-right: $navbar-width;
40
+ }
41
+ @include ltr() {
42
+ padding-left: $navbar-width;
43
+ }
44
+ }
45
+
46
+ &.moved {
47
+ width: calc(100% + #{$navbar-width});
48
+ @include rtl() {
49
+ margin-right: $navbar-width;
50
+ }
51
+ @include ltr() {
52
+ margin-left: $navbar-width;
53
+ }
54
+ }
55
+
56
+ &.below-header {
57
+ margin-top: var(--belowHeader);
58
+ }
59
+
60
+ }
61
+ </style>
@@ -104,7 +104,7 @@ export default {
104
104
  is = image[0] === 'image'
105
105
  if (!is) {
106
106
  const p = this.fileLink.split('.')
107
- is = ['jpg', 'jpeg', 'png', 'gif'].includes(p[p.length - 1])
107
+ is = ['jpg', 'jpeg', 'png', 'gif', 'svg'].includes(p[p.length - 1])
108
108
  }
109
109
  return is
110
110
  },
@@ -2,18 +2,18 @@
2
2
  <div
3
3
  :class="{
4
4
  [`${$r.prefix}input-container`]:true,
5
- [color]:color&&!isDisabled,
5
+ [c_color]:c_color&&!isDisabled,
6
6
  'color-error-text':hasError&&genMessages.length>0,
7
- 'hide-detail':hide,
7
+ 'hide-detail':c_hide,
8
8
  'input-focused':active,
9
9
  'input-disabled':isDisabled,
10
- 'input-ltr':ltr
10
+ 'input-ltr':c_ltr
11
11
  }"
12
12
  >
13
- <div ref="input" :class="[inputControlClass,{'input-tile':tile,'ps-8':preIcon}]" class="input-control">
13
+ <div ref="input" :class="[c_inputControlClass,{'input-tile':c_tile,'ps-8':preIcon}]" class="input-control">
14
14
  <label :for="computedId" class="label"
15
15
  v-if="label"
16
- :class="[labelControlClass,
16
+ :class="[c_labelControlClass,
17
17
  {'label-active':labelActive,
18
18
  'ms-5':((preIcon&&!labelActive&&!active))
19
19
  }]"
@@ -28,7 +28,7 @@
28
28
  :class="{
29
29
  'massage-active':genMessages.length>0,
30
30
  }">
31
- <div :class="{'animation-shake-3':msgShake}">{{ genMessages[0] }}</div>
31
+ <div :class="{'animation-shake-3':c_msgShake}">{{ genMessages[0] }}</div>
32
32
 
33
33
  </div>
34
34
  </div>
@@ -50,24 +50,23 @@ export default {
50
50
  msg: String,
51
51
  labelControlClass: [String, Object, Array],
52
52
  inputControlClass: [String, Object, Array],
53
- color: {type: String, default: 'color-one-text'},
53
+ color: String,
54
54
  label: String,
55
55
  modelValue: [String, Boolean, Number, Array, Object],
56
56
  active: Boolean,
57
- hide: Boolean,
58
- tile: Boolean,
57
+ hide: {type: Boolean, default: undefined},
58
+ tile: {type: Boolean, default: undefined},
59
59
  disabled: Boolean,
60
60
  readonly: Boolean,
61
61
  error: Boolean,
62
- ltr: Boolean,
63
- msgShake: {type: Boolean, default: true},
62
+ ltr: {type: Boolean, default: undefined},
63
+ msgShake: {type: Boolean, default: undefined},
64
64
  rules: {
65
65
  type: [Array, Function],
66
66
  default: () => []
67
67
  },
68
- validateOnBlur: Boolean
68
+ validateOnBlur: {type: Boolean, default: undefined}
69
69
  },
70
-
71
70
  data() {
72
71
  return {
73
72
  uid: 'input_' + this.$helper.uniqueId(),
@@ -94,7 +93,6 @@ export default {
94
93
  created() {
95
94
  this.form && this.form.register(this)
96
95
  },
97
-
98
96
  beforeUnmount() {
99
97
  this.form && this.form.unregister(this)
100
98
  },
@@ -123,16 +121,13 @@ export default {
123
121
  hasMessages() {
124
122
  return this.validationTarget.length > 0
125
123
  },
126
-
127
124
  shouldValidate() {
128
125
  if (this.isResetting) return false
129
- return this.validateOnBlur ? this.hasFocused && !this.isFocused : this.hasInput || this.hasFocused
126
+ return this.c_validateOnBlur ? this.hasFocused && !this.isFocused : this.hasInput || this.hasFocused
130
127
  },
131
-
132
128
  validations() {
133
129
  return this.validationTarget.slice(0, 1)
134
130
  },
135
-
136
131
  validationTarget() {
137
132
  if (this.shouldValidate) {
138
133
  return this.errorBucket
@@ -140,6 +135,54 @@ export default {
140
135
  },
141
136
  labelActive() {
142
137
  return (this.lazyValue !== undefined && this.lazyValue !== '' && this.lazyValue !== null)
138
+ },
139
+ c_labelControlClass() {
140
+ if (this.labelControlClass === undefined && this.$r.inputs.labelControlClass) {
141
+ return this.$r.inputs.labelControlClass
142
+ }
143
+ return this.labelControlClass
144
+ },
145
+ c_inputControlClass() {
146
+ if (this.inputControlClass === undefined && this.$r.inputs.inputControlClass) {
147
+ return this.$r.inputs.inputControlClass
148
+ }
149
+ return this.inputControlClass
150
+ },
151
+ c_color() {
152
+ if (this.color === undefined && this.$r.inputs.color) {
153
+ return this.$r.inputs.color
154
+ }
155
+ return this.color || 'color-one-text'
156
+ },
157
+ c_hide() {
158
+ if (this.hide === undefined && this.$r.inputs.hide) {
159
+ return this.$r.inputs.hide
160
+ }
161
+ return this.hide
162
+ },
163
+ c_tile() {
164
+ if (this.tile === undefined && this.$r.inputs.tile) {
165
+ return this.$r.inputs.tile
166
+ }
167
+ return this.tile
168
+ },
169
+ c_ltr() {
170
+ if (this.ltr === undefined && this.$r.inputs.ltr) {
171
+ return this.$r.inputs.ltr
172
+ }
173
+ return this.ltr
174
+ },
175
+ c_msgShake() {
176
+ if (this.msgShake === undefined && this.$r.inputs.msgShake) {
177
+ return this.$r.inputs.msgShake
178
+ }
179
+ return this.msgShake === undefined ? true : this.msgShake
180
+ },
181
+ c_validateOnBlur() {
182
+ if (this.validateOnBlur === undefined && this.$r.inputs.validateOnBlur) {
183
+ return this.$r.inputs.validateOnBlur
184
+ }
185
+ return this.validateOnBlur
143
186
  }
144
187
  },
145
188
  watch: {
@@ -157,7 +200,7 @@ export default {
157
200
  // if disabled
158
201
  if (!val && !this.isDisabled) {
159
202
  this.hasFocused = true
160
- this.validateOnBlur && this.validate()
203
+ this.c_validateOnBlur && this.validate()
161
204
  }
162
205
  },
163
206
 
@@ -12,6 +12,7 @@
12
12
  :close="multiple&&!textChip"
13
13
  :key="key"
14
14
  :text="textChip || !multiple"
15
+ :class="{'px-0':!multiple}"
15
16
  @update:modelValue="handleChip($event,key)"
16
17
  selectable
17
18
  v-for="(item,key) in chips">
@@ -25,6 +25,7 @@
25
25
  <r-card class="pt-3">
26
26
  <timepicker
27
27
  class="mb-2 mx-3"
28
+ :disableTime="disableTime"
28
29
  :is24-hour="is24Hour"
29
30
  :withSec="withSec"
30
31
  v-model="lazyValue"
@@ -57,6 +58,11 @@ export default {
57
58
  name: "r-time-picker",
58
59
  components: {Timepicker},
59
60
  props: {
61
+ disableTime: {
62
+ type: Function, default: () => {
63
+ return false
64
+ }
65
+ },
60
66
  withSec: Boolean,
61
67
  is24Hour: {type: Boolean, default: true},
62
68
  noOverlay: Boolean,
@@ -0,0 +1,166 @@
1
+ <template>
2
+ <div :class="`${$r.prefix}timepicker-range`">
3
+ <r-input
4
+ v-bind="$attrs"
5
+ :active="active"
6
+ :model-value="lazyValue[1]"
7
+ @click.prevent="show_modal = true"
8
+ >
9
+ <input
10
+ type="text"
11
+ @focusin="active = true"
12
+ @focusout="active = false"
13
+ autocomplete="no"
14
+ ref="input"
15
+ :value="strVal"
16
+ />
17
+ </r-input>
18
+ <r-modal
19
+ class="modal-timepicker"
20
+ v-model="show_modal"
21
+ :closebtn="false"
22
+ :no-overlay="noOverlay"
23
+ >
24
+ <r-card class="pt-3">
25
+ <div class="px-2 title">
26
+ <span>{{ $t('from', 'renusify') }}: </span>
27
+ <span v-if="lazyValue[0]">{{ lazyValue[0] }} - </span>
28
+ <span>{{ $t('to', 'renusify') }}: </span>
29
+ <span v-if="lazyValue[1]">{{ lazyValue[1] }}</span>
30
+ </div>
31
+ <timepicker
32
+ v-if="state==='from'"
33
+ class="mb-2 mx-3"
34
+ is24Hour
35
+ :withSec="withSec"
36
+ v-model="lazyValue[0]"
37
+ ></timepicker>
38
+ <timepicker
39
+ v-if="state==='to'"
40
+ class="mb-2 mx-3"
41
+ is24Hour
42
+ :withSec="withSec"
43
+ :disableTime="disableTime"
44
+ v-model="lazyValue[1]"
45
+ ></timepicker>
46
+ <r-btn
47
+ class="color-success-text ml-7 mr-9 mb-3 mt-3"
48
+ outlined
49
+ @click="accept"
50
+ >
51
+ {{ $t('accept', 'renusify') }}
52
+ </r-btn
53
+ >
54
+ <r-btn
55
+ class="color-warning-text mr-7 ml-4 mb-3 mt-3"
56
+ outlined
57
+ @click="(show_modal = false), (lazyValue = []),emit()"
58
+ >
59
+ {{ $t('cancel', 'renusify') }}
60
+ </r-btn
61
+ >
62
+ </r-card>
63
+ </r-modal>
64
+ </div>
65
+ </template>
66
+
67
+ <script>
68
+ import Timepicker from "./timepicker";
69
+
70
+ export default {
71
+ name: "r-time-picker-range",
72
+ components: {Timepicker},
73
+ props: {
74
+ withSec: Boolean,
75
+ noOverlay: Boolean,
76
+ modelValue: Array
77
+ },
78
+ data() {
79
+ return {
80
+ state: 'from',
81
+ active: false,
82
+ show_modal: false,
83
+ lazyValue: this.modelValue || []
84
+ };
85
+ },
86
+ watch: {
87
+ modelValue: function () {
88
+ this.lazyValue = this.modelValue
89
+ }
90
+ },
91
+ computed: {
92
+ strVal() {
93
+ if (this.lazyValue.length > 0) {
94
+ return this.lazyValue[0] + ' - ' + this.lazyValue[1]
95
+ }
96
+ return ''
97
+ },
98
+ fromH() {
99
+ if (!this.lazyValue[0]) {
100
+ return 0
101
+ }
102
+ return this.lazyValue[0].split(':')[0]
103
+ },
104
+ fromM() {
105
+ if (!this.lazyValue[0]) {
106
+ return 0
107
+ }
108
+ return this.lazyValue[0].split(':')[1]
109
+ },
110
+ fromS() {
111
+ if (!this.lazyValue[0]) {
112
+ return 0
113
+ }
114
+ return this.lazyValue[0].split(':')[2]
115
+ }
116
+ },
117
+ methods: {
118
+ disableTime(n, t, h, m) {
119
+ if (t === 'hours24' && n < this.fromH && n > 0) {
120
+ return true
121
+ }
122
+
123
+ if (t === 'mins' && h.toString() === this.fromH && (this.withSec ? n < this.fromM : n <= this.fromM)) {
124
+ return true
125
+ }
126
+
127
+ if (this.withSec) {
128
+ if (t === 'seconds' && h.toString() === this.fromH && m.toString() === this.fromM && n <= this.fromS) {
129
+ return true
130
+ }
131
+ }
132
+ },
133
+ str2int(s) {
134
+ if (!s) {
135
+ return 0
136
+ }
137
+ return parseInt(this.$helper.replacer(s, ':', ''))
138
+ },
139
+ accept() {
140
+ if (this.state === 'to') {
141
+ if (this.lazyValue.length === 2 && this.str2int(this.lazyValue[0]) < this.str2int(this.lazyValue[1])) {
142
+ this.state = 'from'
143
+ this.show_modal = false
144
+ this.emit()
145
+ } else {
146
+ console.error(`from:${this.str2int(this.lazyValue[0])} > to:${this.str2int(this.lazyValue[1])}`)
147
+ }
148
+ } else {
149
+ this.state = 'to'
150
+ }
151
+
152
+ },
153
+ emit() {
154
+ this.$emit("update:model-value", this.lazyValue);
155
+ }
156
+ }
157
+ };
158
+ </script>
159
+
160
+ <style lang="scss">
161
+ .modal-timepicker {
162
+ .modal-mini {
163
+ max-width: 285px !important;
164
+ }
165
+ }
166
+ </style>