renusify 1.1.5 → 1.2.0

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 (78) hide show
  1. package/components/app/notify/notification.vue +2 -1
  2. package/components/app/toast/index.vue +7 -2
  3. package/components/app/toast/toast.vue +2 -0
  4. package/components/bar/bottomNavigationCircle.vue +1 -0
  5. package/components/bar/scss/bottomNav.scss +1 -1
  6. package/components/bar/toolbar/laptop.vue +4 -4
  7. package/components/bar/toolbar/mixin.js +1 -2
  8. package/components/bar/toolbar/mobile.vue +5 -4
  9. package/components/breadcrumb/index.vue +1 -0
  10. package/components/button/buttonConfirm.vue +1 -1
  11. package/components/button/buttonGroup.vue +1 -0
  12. package/components/button/style.scss +1 -0
  13. package/components/calendar/index.vue +1 -0
  14. package/components/calendar/month.vue +1 -0
  15. package/components/calendar/year.vue +1 -0
  16. package/components/chat/chatInput.vue +1 -0
  17. package/components/chat/chatMsg.vue +1 -0
  18. package/components/chat/index.vue +1 -0
  19. package/components/chip/index.vue +1 -0
  20. package/components/codeEditor/index.vue +0 -2
  21. package/components/confirm/index.vue +1 -0
  22. package/components/countdown/index.vue +1 -0
  23. package/components/float/index.vue +1 -0
  24. package/components/form/address.vue +2 -1
  25. package/components/form/camInput.vue +2 -1
  26. package/components/form/check-input.vue +1 -1
  27. package/components/form/checkbox.vue +1 -1
  28. package/components/form/colorPicker/index.vue +1 -0
  29. package/components/form/colorPicker/picker.vue +1 -0
  30. package/components/form/datePicker/index.vue +349 -348
  31. package/components/form/datePicker/month.vue +1 -0
  32. package/components/form/datePicker/year.vue +1 -0
  33. package/components/form/fileUploader/index.vue +1 -0
  34. package/components/form/fileUploader/single.vue +1 -0
  35. package/components/form/form.vue +1 -0
  36. package/components/form/group-input.vue +5 -4
  37. package/components/form/input.vue +253 -1
  38. package/components/form/inputTel/index.vue +1 -0
  39. package/components/form/json/JsonView.vue +95 -94
  40. package/components/form/json/index.vue +2 -0
  41. package/components/form/mask-input.vue +1 -0
  42. package/components/form/number.vue +1 -0
  43. package/components/form/password.vue +121 -121
  44. package/components/form/radioInput.vue +1 -0
  45. package/components/form/range.vue +1 -0
  46. package/components/form/rating.vue +13 -1
  47. package/components/form/select.vue +61 -2
  48. package/components/form/switch.vue +64 -2
  49. package/components/form/text-area.vue +1 -1
  50. package/components/form/text-editor/index.vue +5 -2
  51. package/components/form/text-input.vue +1 -1
  52. package/components/form/timepicker/index.vue +2 -1
  53. package/components/form/timepicker/range.vue +2 -1
  54. package/components/form/timepicker/timepicker.vue +2 -1
  55. package/components/form/unique/index.vue +1 -0
  56. package/components/form/unit-input.vue +2 -1
  57. package/components/formCreator/index.vue +5 -4
  58. package/components/html2pdf/index.vue +1 -0
  59. package/components/list/index.vue +3 -2
  60. package/components/map/index.vue +1 -0
  61. package/components/map/route.vue +1 -0
  62. package/components/map/select.vue +1 -0
  63. package/components/menu/index.vue +1 -0
  64. package/components/modal/index.vue +1 -0
  65. package/components/searchBox/index.vue +1 -1
  66. package/components/slider/index.vue +1 -0
  67. package/components/table/crud/footer.vue +1 -1
  68. package/components/table/crud/header.vue +10 -4
  69. package/components/table/crud/index.vue +1 -0
  70. package/components/tabs/index.vue +1 -0
  71. package/components/tree/index.vue +2 -1
  72. package/components/tree/tree-element.vue +3 -2
  73. package/package.json +1 -1
  74. package/style/colors.scss +1 -1
  75. package/components/form/scss/input.scss +0 -249
  76. package/components/form/scss/rating.scss +0 -9
  77. package/components/form/scss/select.scss +0 -55
  78. package/components/form/scss/switch.scss +0 -68
@@ -1,109 +1,109 @@
1
1
  <template>
2
- <r-input v-bind="$attrs" :readonly="readonly" :model-value="modelValue" @click.prevent="show=true">
3
- <input
4
- :value="modelValue?$d(modelValueDate,withTime?'long':'medium',locale):null"
5
- />
6
- </r-input>
7
- <r-modal :model-value="show" @update:model-value="close()" :closebtn="false" closable class="text-center">
8
- <div v-if="!showTime" :class="`${$r.prefix}date-input`">
9
- <div class="sheet">
10
- <r-container>
11
- <r-row>
12
- <r-col class="col-auto">
13
- <r-btn v-if="tab!=='month'" icon
14
- @click.prevent="tab==='day'?incrementMonth(-1):incrementYear(-12)">
15
- <r-icon v-html="$r.icons.arrow_left"></r-icon>
16
- </r-btn>
17
- </r-col>
18
- <r-col class="text-center">
19
- <r-btn class="me-2" text @click.prevent="tab==='month'?tab='day':tab='month'">
20
- <r-icon v-html="tab==='month'?$r.icons.chevron_up:$r.icons.chevron_down"></r-icon>
21
- {{
22
- $d(new
23
- Date(currentPeriod.year, currentPeriod.month, 1, 0, lang_zone_offset - timezoneOffset), 'month', locale)
24
- }}
25
- </r-btn>
26
-
27
- <r-btn text @click.prevent="tab==='year'?tab='day':tab='year'">
28
- <r-icon v-html="tab==='year'?$r.icons.chevron_up:$r.icons.chevron_down"></r-icon>
29
- {{
30
- $d(new
31
- Date(currentPeriod.year, currentPeriod.month, 1, 0, lang_zone_offset - timezoneOffset), 'year', locale)
32
- }}
33
- </r-btn>
34
- </r-col>
35
- <r-col class="col-auto">
36
- <r-btn v-if="tab!=='month'" icon
37
- @click.prevent="tab==='day'?incrementMonth(1):incrementYear(12)">
38
- <r-icon v-html="$r.icons.arrow_right"></r-icon>
39
- </r-btn>
40
- </r-col>
41
- </r-row>
42
- </r-container>
43
- <year-tab v-if="tab==='year'"
44
- :model-value='currentPeriod.year'
45
- @update:model-value="(tab='month',setYear($event))"
46
- :timezoneOffset="lang_zone_offset-timezoneOffset"
47
- :locale="locale"
48
- :month="currentPeriod.month"></year-tab>
49
- <month-tab v-if="tab==='month'"
50
- :model-value='currentPeriod.month'
51
- @update:model-value="(tab='day',setMonth($event))"
52
- :timezoneOffset="lang_zone_offset-timezoneOffset"
53
- :locale="locale"
54
- :year="currentPeriod.year"></month-tab>
55
- <table v-if="tab==='day'" class="table">
56
- <thead>
57
- <tr>
58
- <th class="headCell" v-for="(weekday, weekdayIndex) in weekDays" :key="weekdayIndex">
59
- <span class="headCellContent">{{ weekday }}</span>
60
- </th>
61
- </tr>
62
- </thead>
63
- <transition :name="direction==='next'?'slide-start-to-end':'slide-end-to-start'" mode="out-in">
64
- <tbody
65
- :key="currentPeriod.year + '-' + currentPeriod.month"
66
- >
67
- <tr class="table-row" v-for="(week, weekIndex) in currentPeriodDates" :key="weekIndex">
68
- <td
69
- class="cell"
70
- v-for="item in week"
71
- :class="{
2
+ <r-input v-bind="$attrs" :readonly="readonly" :model-value="modelValue" @click.prevent="show=true">
3
+ <input
4
+ :value="modelValue?$d(modelValueDate,withTime?'long':'medium',locale):null"
5
+ />
6
+ </r-input>
7
+ <r-modal :model-value="show" @update:model-value="close()" :closebtn="false" closable class="text-center">
8
+ <div v-if="!showTime" :class="`${$r.prefix}date-input`">
9
+ <div class="sheet">
10
+ <r-container>
11
+ <r-row>
12
+ <r-col class="col-auto">
13
+ <r-btn v-if="tab!=='month'" icon
14
+ @click.prevent="tab==='day'?incrementMonth(-1):incrementYear(-12)">
15
+ <r-icon v-html="$r.icons.arrow_left"></r-icon>
16
+ </r-btn>
17
+ </r-col>
18
+ <r-col class="text-center">
19
+ <r-btn class="me-2" text @click.prevent="tab==='month'?tab='day':tab='month'">
20
+ <r-icon v-html="tab==='month'?$r.icons.chevron_up:$r.icons.chevron_down"></r-icon>
21
+ {{
22
+ $d(new
23
+ Date(currentPeriod.year, currentPeriod.month, 1, 0, lang_zone_offset - timezoneOffset), 'month', locale)
24
+ }}
25
+ </r-btn>
26
+
27
+ <r-btn text @click.prevent="tab==='year'?tab='day':tab='year'">
28
+ <r-icon v-html="tab==='year'?$r.icons.chevron_up:$r.icons.chevron_down"></r-icon>
29
+ {{
30
+ $d(new
31
+ Date(currentPeriod.year, currentPeriod.month, 1, 0, lang_zone_offset - timezoneOffset), 'year', locale)
32
+ }}
33
+ </r-btn>
34
+ </r-col>
35
+ <r-col class="col-auto">
36
+ <r-btn v-if="tab!=='month'" icon
37
+ @click.prevent="tab==='day'?incrementMonth(1):incrementYear(12)">
38
+ <r-icon v-html="$r.icons.arrow_right"></r-icon>
39
+ </r-btn>
40
+ </r-col>
41
+ </r-row>
42
+ </r-container>
43
+ <year-tab v-if="tab==='year'"
44
+ :model-value='currentPeriod.year'
45
+ @update:model-value="(tab='month',setYear($event))"
46
+ :timezoneOffset="lang_zone_offset-timezoneOffset"
47
+ :locale="locale"
48
+ :month="currentPeriod.month"></year-tab>
49
+ <month-tab v-if="tab==='month'"
50
+ :model-value='currentPeriod.month'
51
+ @update:model-value="(tab='day',setMonth($event))"
52
+ :timezoneOffset="lang_zone_offset-timezoneOffset"
53
+ :locale="locale"
54
+ :year="currentPeriod.year"></month-tab>
55
+ <table v-if="tab==='day'" class="table">
56
+ <thead>
57
+ <tr>
58
+ <th class="headCell" v-for="(weekday, weekdayIndex) in weekDays" :key="weekdayIndex">
59
+ <span class="headCellContent">{{ weekday }}</span>
60
+ </th>
61
+ </tr>
62
+ </thead>
63
+ <transition :name="direction==='next'?'slide-start-to-end':'slide-end-to-start'" mode="out-in">
64
+ <tbody
65
+ :key="currentPeriod.year + '-' + currentPeriod.month"
66
+ >
67
+ <tr class="table-row" v-for="(week, weekIndex) in currentPeriodDates" :key="weekIndex">
68
+ <td
69
+ class="cell"
70
+ v-for="item in week"
71
+ :class="{
72
72
  selectable: !readonly && !item.disabled,
73
73
  selected: item.selected,
74
74
  disabled: item.disabled,
75
75
  today: item.today
76
76
  }"
77
- :key="item.date"
78
- @click="item.date!==0 &&!readonly&& selectDateItem(item)"
79
- >
80
- <div
81
- class="cellContent d-flex h-center v-center"
82
- v-if="item.date!==0"
83
- >
84
- {{ $d(item.date,'day',locale) }}
85
- </div>
86
- </td>
87
- </tr>
88
- </tbody>
89
- </transition>
90
- </table>
91
- </div>
92
- </div>
93
- <div v-else class="d-flex flex-column h-center v-center pa-5">
94
- <timepicker
95
- is24-hour
96
- withSec
97
- v-model="time"
98
- ></timepicker>
99
- <div class="mt-5">
100
- <r-btn class="color-success mx-5" @click="selectTime">{{$t('ok','renusify')}}</r-btn>
101
- <r-btn class="color-error mx-5" @click="close">{{ $t('cancel', 'renusify') }}</r-btn>
102
- </div>
103
-
104
- </div>
105
-
106
- </r-modal>
77
+ :key="item.date"
78
+ @click="item.date!==0 &&!readonly&& selectDateItem(item)"
79
+ >
80
+ <div
81
+ class="cellContent d-flex h-center v-center"
82
+ v-if="item.date!==0"
83
+ >
84
+ {{ $d(item.date, 'day', locale) }}
85
+ </div>
86
+ </td>
87
+ </tr>
88
+ </tbody>
89
+ </transition>
90
+ </table>
91
+ </div>
92
+ </div>
93
+ <div v-else class="d-flex flex-column h-center v-center pa-5">
94
+ <timepicker
95
+ is24-hour
96
+ withSec
97
+ v-model="time"
98
+ ></timepicker>
99
+ <div class="mt-5">
100
+ <r-btn class="color-success mx-5" @click="selectTime">{{ $t('ok', 'renusify') }}</r-btn>
101
+ <r-btn class="color-error mx-5" @click="close">{{ $t('cancel', 'renusify') }}</r-btn>
102
+ </div>
103
+
104
+ </div>
105
+
106
+ </r-modal>
107
107
 
108
108
  </template>
109
109
 
@@ -125,11 +125,12 @@ export default {
125
125
  },
126
126
  readonly: Boolean,
127
127
  withTime: Boolean,
128
- isDateDisabled: {
129
- type: Function,
130
- default: () => false
131
- }
128
+ isDateDisabled: {
129
+ type: Function,
130
+ default: () => false
131
+ }
132
132
  },
133
+ emits:['update:modelValue'],
133
134
  data() {
134
135
  return {
135
136
  tab: 'day',
@@ -174,93 +175,93 @@ export default {
174
175
  return this.lang || this.$r.lang
175
176
  },
176
177
  today() {
177
- return new Date()
178
- },
179
- timezoneOffset() {
180
- return (new Date(this.currentPeriod.year, this.currentPeriod.month, 10)).getTimezoneOffset()
181
- },
182
- weekDays() {
183
- const first = parseInt(this.firstDayOfWeek, 10)
184
-
185
- return this.createRange(7).map(i => this.$d(new Date(2020, 2, first + i + 2, 0, this.timezoneOffset, 0), 'narrow', this.locale)) // 2017-02-02 is Sunday
186
- },
187
- modelValueDate() {
188
- if (!this.modelValue || !new Date(this.modelValue)) {
189
- return new Date()
190
- }
191
- return new Date(this.modelValue)
192
- },
193
- rangeLocalDate() {
194
- const {year, month} = this.currentPeriod
195
- let firstDay = 1
196
- let firstmonth = month
197
- let firstyear = year
198
-
199
- let first = new Date(firstyear, firstmonth, firstDay, 0, this.lang_zone_offset - this.timezoneOffset, 0)
200
- let lc = parseInt(this.$d(first, 'de', this.locale))
201
- first = new Date(firstyear, firstmonth, firstDay - lc + 1, 0, this.lang_zone_offset - this.timezoneOffset, 0)
202
-
203
- firstDay = 1
204
- firstmonth = month + 1
205
- firstyear = year
206
- let last = new Date(firstyear, firstmonth, firstDay, 0, this.lang_zone_offset - this.timezoneOffset, 0)
207
- lc = parseInt(this.$d(last, 'de', this.locale))
208
- last = new Date(firstyear, firstmonth, firstDay - lc, 23, 59 + this.lang_zone_offset - this.timezoneOffset, 59)
209
-
210
- return {start: first, end: last}
211
- },
212
- weekDaysBeforeFirstDayOfTheMonth() {
213
- const {start} = this.rangeLocalDate
214
- const weekDay = start.getDay()
215
- return (weekDay - parseInt(this.firstDayOfWeek) + 7) % 7
216
- },
217
- currentPeriodDates() {
218
- const {start, end} = this.rangeLocalDate
219
- const children = []
220
- let firstday = start.getDate()
221
- let firstmonth = start.getMonth()
222
- let firstyear = start.getFullYear()
223
- let rows = []
224
- let day = this.weekDaysBeforeFirstDayOfTheMonth
225
-
226
- while (day--) {
227
- rows.push({
228
- date: 0,
229
- disabled: true,
230
- selected: false,
231
- today: false
232
- })
233
- }
234
- let doJob = true
235
- while (doJob) {
236
- const date = new Date(firstyear, firstmonth, 1, 24, this.lang_zone_offset - this.timezoneOffset, 0)
237
- date.setDate(firstday)
238
- firstmonth = date.getMonth()
239
- firstyear = date.getFullYear()
240
- firstday = date.getDate() + 1
241
- if (date.getTime() > end.getTime()) {
242
- doJob = false
243
- } else {
244
- rows.push({
245
- date: date,
246
- disabled: this.isDateDisabled(date),
247
- selected: this.areSameDates(date, this.modelValueDate),
248
- today: this.areSameDates(date, this.today)
249
- })
250
-
251
- if (rows.length % 7 === 0) {
252
- children.push(rows)
253
- rows = []
254
- }
255
- }
256
- }
257
-
258
- if (rows.length) {
259
- children.push(rows)
260
- }
261
-
262
- return children
263
- },
178
+ return new Date()
179
+ },
180
+ timezoneOffset() {
181
+ return (new Date(this.currentPeriod.year, this.currentPeriod.month, 10)).getTimezoneOffset()
182
+ },
183
+ weekDays() {
184
+ const first = parseInt(this.firstDayOfWeek, 10)
185
+
186
+ return this.createRange(7).map(i => this.$d(new Date(2020, 2, first + i + 2, 0, this.timezoneOffset, 0), 'narrow', this.locale)) // 2017-02-02 is Sunday
187
+ },
188
+ modelValueDate() {
189
+ if (!this.modelValue || !new Date(this.modelValue)) {
190
+ return new Date()
191
+ }
192
+ return new Date(this.modelValue)
193
+ },
194
+ rangeLocalDate() {
195
+ const {year, month} = this.currentPeriod
196
+ let firstDay = 1
197
+ let firstmonth = month
198
+ let firstyear = year
199
+
200
+ let first = new Date(firstyear, firstmonth, firstDay, 0, this.lang_zone_offset - this.timezoneOffset, 0)
201
+ let lc = parseInt(this.$d(first, 'de', this.locale))
202
+ first = new Date(firstyear, firstmonth, firstDay - lc + 1, 0, this.lang_zone_offset - this.timezoneOffset, 0)
203
+
204
+ firstDay = 1
205
+ firstmonth = month + 1
206
+ firstyear = year
207
+ let last = new Date(firstyear, firstmonth, firstDay, 0, this.lang_zone_offset - this.timezoneOffset, 0)
208
+ lc = parseInt(this.$d(last, 'de', this.locale))
209
+ last = new Date(firstyear, firstmonth, firstDay - lc, 23, 59 + this.lang_zone_offset - this.timezoneOffset, 59)
210
+
211
+ return {start: first, end: last}
212
+ },
213
+ weekDaysBeforeFirstDayOfTheMonth() {
214
+ const {start} = this.rangeLocalDate
215
+ const weekDay = start.getDay()
216
+ return (weekDay - parseInt(this.firstDayOfWeek) + 7) % 7
217
+ },
218
+ currentPeriodDates() {
219
+ const {start, end} = this.rangeLocalDate
220
+ const children = []
221
+ let firstday = start.getDate()
222
+ let firstmonth = start.getMonth()
223
+ let firstyear = start.getFullYear()
224
+ let rows = []
225
+ let day = this.weekDaysBeforeFirstDayOfTheMonth
226
+
227
+ while (day--) {
228
+ rows.push({
229
+ date: 0,
230
+ disabled: true,
231
+ selected: false,
232
+ today: false
233
+ })
234
+ }
235
+ let doJob = true
236
+ while (doJob) {
237
+ const date = new Date(firstyear, firstmonth, 1, 24, this.lang_zone_offset - this.timezoneOffset, 0)
238
+ date.setDate(firstday)
239
+ firstmonth = date.getMonth()
240
+ firstyear = date.getFullYear()
241
+ firstday = date.getDate() + 1
242
+ if (date.getTime() > end.getTime()) {
243
+ doJob = false
244
+ } else {
245
+ rows.push({
246
+ date: date,
247
+ disabled: this.isDateDisabled(date),
248
+ selected: this.areSameDates(date, this.modelValueDate),
249
+ today: this.areSameDates(date, this.today)
250
+ })
251
+
252
+ if (rows.length % 7 === 0) {
253
+ children.push(rows)
254
+ rows = []
255
+ }
256
+ }
257
+ }
258
+
259
+ if (rows.length) {
260
+ children.push(rows)
261
+ }
262
+
263
+ return children
264
+ },
264
265
  lang_zone_offset() {
265
266
  let offset = this.$helper.ifHas(this.$dateTime.langs, 0, this.locale, 'time_zone_offset')
266
267
  let dst = this.$helper.ifHas(this.$dateTime.langs, false, this.locale, 'daylight_saving_time')
@@ -272,203 +273,203 @@ export default {
272
273
  return offset * -1
273
274
  }
274
275
  },
275
- watch: {
276
- modelValueDate(newVal) {
277
- this.currentPeriod = {
278
- month: newVal.getMonth() + 1,
279
- year: newVal.getFullYear()
280
- }
281
- if (this.rangeLocalDate.start > this.modelValueDate) {
282
- this.incrementMonth(-1)
283
- }
284
- if (this.rangeLocalDate.end < this.modelValueDate) {
285
- this.incrementMonth(1)
286
- }
287
- },
288
- currentPeriod(currentPeriod, oldPeriod) {
289
- const currentDate = new Date(currentPeriod.year, currentPeriod.month).getTime()
290
- const oldDate = new Date(oldPeriod.year, oldPeriod.month).getTime()
291
- this.direction = currentDate !== oldDate
292
- ? (currentDate > oldDate ? 'next' : 'prev')
293
- : undefined
294
- }
295
- },
296
- methods: {
297
- close() {
298
- this.show = false
299
- this.showTime = false
300
- },
301
- createRange(number) {
302
- const res = []
303
- for (let i = 0; i < number; i++) {
304
- res.push(i)
305
- }
306
- return res
307
- },
308
- incrementMonth(increment = 1) {
309
- const incrementDate = new Date(this.currentPeriod.year, this.currentPeriod.month + increment)
310
- this.currentPeriod = {
311
- month: incrementDate.getMonth(),
312
- year: incrementDate.getFullYear()
313
- }
314
- },
315
- incrementYear(increment = 1) {
316
- const incrementDate = new Date(this.currentPeriod.year + increment, this.currentPeriod.month)
317
- this.currentPeriod = {
318
- month: incrementDate.getMonth(),
319
- year: incrementDate.getFullYear()
320
- }
321
- },
322
- setMonth(increment) {
323
- const incrementDate = new Date(this.currentPeriod.year, increment)
324
- this.currentPeriod = {
325
- month: incrementDate.getMonth(),
326
- year: incrementDate.getFullYear()
327
- }
328
- },
329
- setYear(increment) {
330
- const incrementDate = new Date(increment, this.currentPeriod.month)
331
- this.currentPeriod = {
332
- month: incrementDate.getMonth(),
333
- year: incrementDate.getFullYear()
334
- }
335
- },
336
- selectTime() {
337
- const times = (this.time ? this.time : '00:00:00').split(':')
338
- let d = (new Date(this.date.getFullYear(), this.date.getMonth(), this.date.getDate(),
339
- this.date.getHours() + parseInt(times[0]),
340
- this.date.getMinutes() + parseInt(times[1]),
341
- this.date.getSeconds() + parseInt(times[2])))
342
-
343
- this.$emit('update:modelValue', d.toISOString())
344
- this.close()
345
- },
346
- selectDateItem(item) {
347
- if (!item.disabled) {
348
- if (this.withTime) {
349
- this.date = item.date
350
- this.showTime = true
351
- } else {
352
- this.$emit('update:modelValue', item.date.toISOString())
353
- this.close()
354
- }
355
- }
356
- },
357
- areSameDates(date1, date2) {
358
- if (typeof date1.getDate === 'function' && typeof date2.getDate === 'function') {
359
- return (date1.getDate() === date2.getDate()) &&
360
- (date1.getMonth() === date2.getMonth()) &&
361
- (date1.getFullYear() === date2.getFullYear())
362
- }
363
- return false
364
- }
276
+ watch: {
277
+ modelValueDate(newVal) {
278
+ this.currentPeriod = {
279
+ month: newVal.getMonth() + 1,
280
+ year: newVal.getFullYear()
281
+ }
282
+ if (this.rangeLocalDate.start > this.modelValueDate) {
283
+ this.incrementMonth(-1)
284
+ }
285
+ if (this.rangeLocalDate.end < this.modelValueDate) {
286
+ this.incrementMonth(1)
287
+ }
288
+ },
289
+ currentPeriod(currentPeriod, oldPeriod) {
290
+ const currentDate = new Date(currentPeriod.year, currentPeriod.month).getTime()
291
+ const oldDate = new Date(oldPeriod.year, oldPeriod.month).getTime()
292
+ this.direction = currentDate !== oldDate
293
+ ? (currentDate > oldDate ? 'next' : 'prev')
294
+ : undefined
295
+ }
296
+ },
297
+ methods: {
298
+ close() {
299
+ this.show = false
300
+ this.showTime = false
301
+ },
302
+ createRange(number) {
303
+ const res = []
304
+ for (let i = 0; i < number; i++) {
305
+ res.push(i)
306
+ }
307
+ return res
308
+ },
309
+ incrementMonth(increment = 1) {
310
+ const incrementDate = new Date(this.currentPeriod.year, this.currentPeriod.month + increment)
311
+ this.currentPeriod = {
312
+ month: incrementDate.getMonth(),
313
+ year: incrementDate.getFullYear()
314
+ }
315
+ },
316
+ incrementYear(increment = 1) {
317
+ const incrementDate = new Date(this.currentPeriod.year + increment, this.currentPeriod.month)
318
+ this.currentPeriod = {
319
+ month: incrementDate.getMonth(),
320
+ year: incrementDate.getFullYear()
321
+ }
322
+ },
323
+ setMonth(increment) {
324
+ const incrementDate = new Date(this.currentPeriod.year, increment)
325
+ this.currentPeriod = {
326
+ month: incrementDate.getMonth(),
327
+ year: incrementDate.getFullYear()
328
+ }
329
+ },
330
+ setYear(increment) {
331
+ const incrementDate = new Date(increment, this.currentPeriod.month)
332
+ this.currentPeriod = {
333
+ month: incrementDate.getMonth(),
334
+ year: incrementDate.getFullYear()
335
+ }
336
+ },
337
+ selectTime() {
338
+ const times = (this.time ? this.time : '00:00:00').split(':')
339
+ let d = (new Date(this.date.getFullYear(), this.date.getMonth(), this.date.getDate(),
340
+ this.date.getHours() + parseInt(times[0]),
341
+ this.date.getMinutes() + parseInt(times[1]),
342
+ this.date.getSeconds() + parseInt(times[2])))
343
+
344
+ this.$emit('update:modelValue', d.toISOString())
345
+ this.close()
346
+ },
347
+ selectDateItem(item) {
348
+ if (!item.disabled) {
349
+ if (this.withTime) {
350
+ this.date = item.date
351
+ this.showTime = true
352
+ } else {
353
+ this.$emit('update:modelValue', item.date.toISOString())
354
+ this.close()
365
355
  }
356
+ }
357
+ },
358
+ areSameDates(date1, date2) {
359
+ if (typeof date1.getDate === 'function' && typeof date2.getDate === 'function') {
360
+ return (date1.getDate() === date2.getDate()) &&
361
+ (date1.getMonth() === date2.getMonth()) &&
362
+ (date1.getFullYear() === date2.getFullYear())
363
+ }
364
+ return false
366
365
  }
366
+ }
367
+ }
367
368
 
368
369
  </script>
369
370
 
370
371
  <style lang="scss">
371
- @import "../../../style/include";
372
+ @import "../../../style/include";
372
373
 
373
- .#{$prefix}date-input {
374
- position: relative;
375
- display: inline-block;
376
- font-size: 10px;
377
- color: #303030;
374
+ .#{$prefix}date-input {
375
+ position: relative;
376
+ display: inline-block;
377
+ font-size: 10px;
378
+ color: #303030;
378
379
 
379
- .cell {
380
- &.today {
381
- color: var(--color-one);
380
+ .cell {
381
+ &.today {
382
+ color: var(--color-one);
382
383
 
383
- .cellContent {
384
- border: solid 1px var(--color-one);
385
- }
386
- }
384
+ .cellContent {
385
+ border: solid 1px var(--color-one);
386
+ }
387
+ }
387
388
 
388
- &.selected {
389
- .cellContent {
389
+ &.selected {
390
+ .cellContent {
390
391
 
391
- color: #fff;
392
- background: var(--color-one);
392
+ color: #fff;
393
+ background: var(--color-one);
393
394
 
394
- }
395
- }
395
+ }
396
+ }
396
397
 
397
- &.selectable:hover {
398
- .cellContent {
398
+ &.selectable:hover {
399
+ .cellContent {
399
400
 
400
- color: #fff;
401
- background: var(--color-one);
401
+ color: #fff;
402
+ background: var(--color-one);
402
403
 
403
- }
404
- }
404
+ }
405
+ }
405
406
 
406
- }
407
+ }
407
408
 
408
409
 
409
- .table {
410
+ .table {
410
411
 
411
- width: 100%;
412
- table-layout: fixed;
413
- position: relative;
414
- z-index: 5;
412
+ width: 100%;
413
+ table-layout: fixed;
414
+ position: relative;
415
+ z-index: 5;
415
416
 
416
- }
417
+ }
417
418
 
418
- .cell, .headCell {
419
+ .cell, .headCell {
419
420
 
420
- text-align: center;
421
- box-sizing: border-box;
421
+ text-align: center;
422
+ box-sizing: border-box;
422
423
 
423
- }
424
+ }
424
425
 
425
- .cell {
426
+ .cell {
426
427
 
427
- padding: 0.5em 0;
428
+ padding: 0.5em 0;
428
429
 
429
- }
430
+ }
430
431
 
431
- .headCell {
432
+ .headCell {
432
433
 
433
- padding: 0.3em 0.5em 1.8em;
434
+ padding: 0.3em 0.5em 1.8em;
434
435
 
435
- }
436
+ }
436
437
 
437
- .headCellContent {
438
+ .headCellContent {
438
439
 
439
- font-size: 1.3em;
440
- font-weight: normal;
441
- color: #848484;
440
+ font-size: 1.3em;
441
+ font-weight: normal;
442
+ color: #848484;
442
443
 
443
- }
444
+ }
444
445
 
445
- .cellContent {
446
- padding: 5px;
447
- font-size: 1.4em;
448
- margin: 0 auto;
449
- width: 30px;
450
- height: 30px;
451
- text-align: center;
452
- border-radius: 100%;
453
- transition: background 0.1s, color 0.1s;
446
+ .cellContent {
447
+ padding: 5px;
448
+ font-size: 1.4em;
449
+ margin: 0 auto;
450
+ width: 30px;
451
+ height: 30px;
452
+ text-align: center;
453
+ border-radius: 100%;
454
+ transition: background 0.1s, color 0.1s;
454
455
 
455
- }
456
+ }
456
457
 
457
- .cell.outOfRange {
458
- color: #c7c7c7;
459
- }
458
+ .cell.outOfRange {
459
+ color: #c7c7c7;
460
+ }
460
461
 
461
- .cell.selectable {
462
+ .cell.selectable {
462
463
 
463
- cursor: pointer;
464
+ cursor: pointer;
464
465
 
465
- }
466
+ }
466
467
 
467
- .cell.disabled {
468
+ .cell.disabled {
468
469
 
469
- opacity: 0.5;
470
+ opacity: 0.5;
470
471
 
471
- }
472
+ }
472
473
 
473
- }
474
+ }
474
475
  </style>