renusify 2.5.2 → 3.0.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.
- package/components/app/index.vue +74 -22
- package/components/app/toast/index.vue +76 -71
- package/components/app/toast/toast.vue +62 -44
- package/components/avatar/index.vue +208 -84
- package/components/button/buttonConfirm.vue +53 -26
- package/components/button/buttonGroup.js +0 -2
- package/components/button/buttonGroup.vue +310 -62
- package/components/button/index.vue +584 -100
- package/components/calendar/index.js +0 -2
- package/components/calendar/index.vue +326 -262
- package/components/calendar/month.vue +64 -55
- package/components/calendar/year.vue +30 -25
- package/components/card/index.vue +139 -59
- package/components/codeEditor/highlightCss.vue +38 -39
- package/components/codeEditor/highlightHtml.vue +64 -64
- package/components/codeEditor/highlightJs.vue +37 -38
- package/components/codeEditor/index.vue +129 -79
- package/components/codeEditor/run.vue +225 -39
- package/components/codeEditor/useCodeFormatter.js +150 -0
- package/components/confirm/index.vue +139 -80
- package/components/container/col.vue +5 -4
- package/components/container/divider.vue +28 -19
- package/components/container/index.vue +34 -15
- package/components/container/row.vue +26 -9
- package/components/container/spacer.vue +2 -4
- package/components/container/style.scss +3 -0
- package/components/content/index.vue +49 -32
- package/components/cropper/index.vue +401 -244
- package/components/float/index.vue +542 -415
- package/components/form/addressInput/index.vue +184 -109
- package/components/form/camInput/index.vue +370 -244
- package/components/form/checkInput/index.vue +138 -71
- package/components/form/checkboxInput/index.vue +87 -47
- package/components/form/colorInput/Alpha.vue +81 -83
- package/components/form/colorInput/Hue.vue +91 -68
- package/components/form/colorInput/Preview.vue +43 -47
- package/components/form/colorInput/Saturation.vue +101 -86
- package/components/form/colorInput/index.vue +71 -39
- package/components/form/colorInput/picker.vue +111 -106
- package/components/form/colorInput/useColor.js +153 -0
- package/components/form/dateInput/index.vue +691 -356
- package/components/form/dateInput/month.vue +63 -54
- package/components/form/dateInput/year.vue +35 -25
- package/components/form/fileInput/index.js +0 -1
- package/components/form/fileInput/index.vue +263 -106
- package/components/form/fileInput/single.vue +323 -164
- package/components/form/groupInput/index.vue +199 -101
- package/components/form/index.vue +189 -83
- package/components/form/input/index.vue +416 -377
- package/components/form/jsonInput/JsonView.vue +54 -56
- package/components/form/jsonInput/index.vue +247 -165
- package/components/form/maskInput/index.vue +252 -132
- package/components/form/numberInput/index.js +0 -1
- package/components/form/numberInput/index.vue +226 -117
- package/components/form/passwordInput/index.js +2 -1
- package/components/form/passwordInput/index.vue +269 -102
- package/components/form/radioInput/index.vue +143 -72
- package/components/form/rangeInput/index.vue +280 -167
- package/components/form/ratingInput/index.vue +57 -57
- package/components/form/selectInput/index.js +1 -3
- package/components/form/selectInput/index.vue +584 -296
- package/components/form/switchInput/index.vue +73 -59
- package/components/form/telInput/index.js +0 -1
- package/components/form/telInput/index.vue +238 -135
- package/components/form/textArea/index.vue +72 -35
- package/components/form/textEditor/index.vue +739 -0
- package/components/form/{text-editor → textEditor}/style.scss +8 -16
- package/components/form/textInput/index.vue +54 -32
- package/components/form/timeInput/index.vue +82 -55
- package/components/form/timeInput/range.vue +115 -94
- package/components/form/timeInput/timepicker.vue +382 -449
- package/components/form/uniqueInput/index.vue +105 -48
- package/components/form/unitInput/index.vue +139 -84
- package/components/formCreator/index.js +0 -1
- package/components/formCreator/index.vue +314 -148
- package/components/highlight/index.vue +41 -25
- package/components/highlight/style.scss +2 -2
- package/components/highlight/{mixin.js → useHighlight.js} +181 -160
- package/components/icon/index.vue +79 -33
- package/components/img/index.vue +249 -147
- package/components/img/preview.vue +180 -198
- package/components/img/svgImg.vue +42 -39
- package/components/index.js +5 -20
- package/components/infinite/index.js +1 -2
- package/components/infinite/index.vue +248 -66
- package/components/map/index.vue +428 -261
- package/components/map/route.vue +794 -487
- package/components/map/select.vue +118 -58
- package/components/menu/index.vue +201 -91
- package/components/meta/meta.js +26 -3
- package/components/modal/index.vue +382 -156
- package/components/notify/index.vue +204 -86
- package/components/notify/notification.vue +38 -55
- package/components/progress/circle.vue +189 -70
- package/components/progress/line.vue +266 -46
- package/components/searchBox/index.js +1 -3
- package/components/searchBox/index.vue +194 -101
- package/components/skeleton/index.vue +45 -20
- package/components/slider/index.vue +318 -156
- package/components/swiper/index.vue +254 -106
- package/components/table/crud/footer.vue +77 -53
- package/components/table/crud/header.vue +71 -72
- package/components/table/crud/index.vue +629 -399
- package/components/table/index.vue +721 -278
- package/components/timeAgo/index.vue +145 -96
- package/components/tour/index.vue +338 -235
- package/components/tree/index.vue +235 -89
- package/components/tree/tree-element.vue +106 -106
- package/directive/animate/index.js +77 -0
- package/directive/clickOutSide/index.js +98 -0
- package/directive/drag/index.js +153 -0
- package/directive/index.js +11 -13
- package/directive/intersect/index.js +263 -0
- package/directive/mask/index.js +67 -0
- package/directive/parallax/index.js +78 -0
- package/directive/ripple/index.js +14 -0
- package/directive/scroll/index.js +244 -0
- package/directive/sortable/index.js +274 -0
- package/directive/title/index.js +75 -0
- package/directive/touch/index.js +268 -0
- package/index.js +10 -8
- package/package.json +5 -2
- package/plugins/validation/Validate.js +88 -79
- package/scripts/generate-docs.mjs +226 -0
- package/scripts/menu.mjs +240 -0
- package/scripts/parser.mjs +1086 -0
- package/style/_index.scss +7 -0
- package/style/app.scss +13 -65
- package/style/colors.scss +5 -22
- package/style/functions/index.scss +8 -0
- package/style/mixins/index.scss +17 -5
- package/style/variables/base.scss +154 -175
- package/style/variables/color.scss +0 -12
- package/style/variables/utilities.scss +0 -180
- package/tools/helper.js +0 -8
- package/tools/icons.js +6 -1
- package/tools/root.js +71 -0
- package/components/app/style.scss +0 -41
- package/components/app/toast/style.scss +0 -20
- package/components/avatar/style.scss +0 -32
- package/components/bar/bottomNav.js +0 -1
- package/components/bar/bottomNav.vue +0 -28
- package/components/bar/bottomNavigationCircle.js +0 -2
- package/components/bar/bottomNavigationCircle.vue +0 -99
- package/components/bar/scss/bottomNav.scss +0 -67
- package/components/bar/scss/toolbar.scss +0 -174
- package/components/bar/toolbar/index.js +0 -8
- package/components/bar/toolbar/index.vue +0 -35
- package/components/bar/toolbar/laptop.vue +0 -33
- package/components/bar/toolbar/menuChilds.vue +0 -41
- package/components/bar/toolbar/menuLaptop.vue +0 -41
- package/components/bar/toolbar/menuMob.vue +0 -39
- package/components/bar/toolbar/mixin.js +0 -43
- package/components/bar/toolbar/mobile.vue +0 -34
- package/components/breadcrumb/bredcrumbItem.vue +0 -39
- package/components/breadcrumb/index.js +0 -3
- package/components/breadcrumb/index.vue +0 -71
- package/components/breadcrumb/style.scss +0 -51
- package/components/button/style.scss +0 -411
- package/components/card/style.scss +0 -86
- package/components/chart/chart.js +0 -1
- package/components/chart/chart.vue +0 -69
- package/components/chart/worldMap.js +0 -2
- package/components/chart/worldMap.vue +0 -1112
- package/components/chat/MessageList.vue +0 -163
- package/components/chat/chatInput.vue +0 -150
- package/components/chat/chatMsg.vue +0 -276
- package/components/chat/index.js +0 -11
- package/components/chat/index.vue +0 -113
- package/components/chip/index.js +0 -3
- package/components/chip/index.vue +0 -77
- package/components/chip/style.scss +0 -199
- package/components/codeEditor/mixin.js +0 -145
- package/components/countdown/index.js +0 -1
- package/components/countdown/index.vue +0 -105
- package/components/form/colorInput/mixin.js +0 -132
- package/components/form/fileInput/file.js +0 -148
- package/components/form/telInput/assets/flags.png +0 -0
- package/components/form/telInput/assets/flags@2x.png +0 -0
- package/components/form/text-editor/index.vue +0 -705
- package/components/icon/style.scss +0 -17
- package/components/infinite/div.js +0 -6
- package/components/infinite/div.vue +0 -193
- package/components/infinite/page.js +0 -3
- package/components/infinite/page.vue +0 -105
- package/components/list/index.js +0 -3
- package/components/list/index.vue +0 -122
- package/components/list/style.scss +0 -66
- package/components/message/index.js +0 -4
- package/components/message/index.vue +0 -40
- package/components/modal/style.scss +0 -146
- package/components/nestable/NestableItem.vue +0 -307
- package/components/nestable/editable.js +0 -44
- package/components/nestable/index.js +0 -1
- package/components/nestable/index.vue +0 -226
- package/components/nestable/methods.js +0 -416
- package/components/progress/style.scss +0 -229
- package/components/table/style.scss +0 -338
- package/components/tabs/index.js +0 -3
- package/components/tabs/index.vue +0 -151
- package/components/timeline/index.js +0 -6
- package/components/timeline/index.vue +0 -76
- package/directive/resize/index.js +0 -30
- package/directive/skeleton/index.js +0 -27
- package/directive/skeleton/style.scss +0 -37
- package/plugins/request/Request.js +0 -68
- package/style/animation.scss +0 -94
- package/style/style.scss +0 -8
- package/tools/rootable.js +0 -75
- /package/components/form/{text-editor → textEditor}/index.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.vue +0 -0
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
<r-icon v-html="tab==='month'?$r.icons.chevron_up:$r.icons.chevron_down"></r-icon>
|
|
14
14
|
{{
|
|
15
15
|
$d(new
|
|
16
|
-
Date(currentPeriod.year, currentPeriod.month, 1, 0,
|
|
16
|
+
Date(currentPeriod.year, currentPeriod.month, 1, 0, langZoneOffset - timezoneOffset), 'month', locale)
|
|
17
17
|
}}
|
|
18
18
|
</r-btn>
|
|
19
19
|
<r-btn text @click.prevent="tab==='year'?tab='day':tab='year'">
|
|
20
20
|
<r-icon v-html="tab==='year'?$r.icons.chevron_up:$r.icons.chevron_down"></r-icon>
|
|
21
21
|
{{
|
|
22
22
|
$d(new
|
|
23
|
-
Date(currentPeriod.year, currentPeriod.month, 1, 0,
|
|
23
|
+
Date(currentPeriod.year, currentPeriod.month, 1, 0, langZoneOffset - timezoneOffset), 'year', locale)
|
|
24
24
|
}}
|
|
25
25
|
</r-btn>
|
|
26
26
|
</r-col>
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
<thead>
|
|
37
37
|
<tr>
|
|
38
38
|
<th class="headCell" v-for="(weekday, weekdayIndex) in weekDays" :key="weekdayIndex">
|
|
39
|
-
<span class="headCellContent">{{ weekday }}</span>
|
|
39
|
+
<span class="headCellContent label-1">{{ weekday }}</span>
|
|
40
40
|
</th>
|
|
41
41
|
</tr>
|
|
42
42
|
</thead>
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
class="cellContent"
|
|
61
61
|
v-if="item.date!==0"
|
|
62
62
|
>
|
|
63
|
+
<!-- Default slot for custom date cell content. Provides date scoped prop -->
|
|
63
64
|
<slot :date="item.date">
|
|
64
65
|
<div class="pa-2">{{ $d(item.date, 'day', locale) }}</div>
|
|
65
66
|
</slot>
|
|
@@ -72,314 +73,377 @@
|
|
|
72
73
|
|
|
73
74
|
<r-modal :model-value="tab!=='day'" @update:model-value="tab='day'">
|
|
74
75
|
<div class="py-5">
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
></
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
></
|
|
76
|
+
<year v-if="tab==='year'"
|
|
77
|
+
:model-value='currentPeriod.year'
|
|
78
|
+
@update:model-value="(tab='month',incrementYear($event))"
|
|
79
|
+
:timezoneOffset="langZoneOffset-timezoneOffset"
|
|
80
|
+
:locale="locale"
|
|
81
|
+
:month="currentPeriod.month"
|
|
82
|
+
></year>
|
|
83
|
+
<month v-if="tab==='month'"
|
|
84
|
+
:model-value='currentPeriod.month'
|
|
85
|
+
@update:model-value="(tab='day',setMonth($event))"
|
|
86
|
+
:timezoneOffset="langZoneOffset-timezoneOffset"
|
|
87
|
+
:locale="locale"
|
|
88
|
+
:month="currentPeriod.month"
|
|
89
|
+
:year="currentPeriod.year"
|
|
90
|
+
></month>
|
|
90
91
|
</div>
|
|
91
92
|
</r-modal>
|
|
92
93
|
</div>
|
|
93
94
|
|
|
94
95
|
</template>
|
|
95
96
|
|
|
96
|
-
<script>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
97
|
+
<script setup>
|
|
98
|
+
import {ref, computed, watch, inject} from 'vue'
|
|
99
|
+
import Year from "./year.vue";
|
|
100
|
+
import Month from "./month.vue";
|
|
101
|
+
|
|
102
|
+
const props = defineProps({
|
|
103
|
+
/**
|
|
104
|
+
* Language/locale for calendar display
|
|
105
|
+
* @type {String}
|
|
106
|
+
*/
|
|
107
|
+
lang: String,
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Makes the calendar read-only
|
|
111
|
+
* @type {Boolean}
|
|
112
|
+
*/
|
|
113
|
+
readonly: Boolean,
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Shows calendar headers with navigation controls
|
|
117
|
+
* @type {Boolean}
|
|
118
|
+
* @default true
|
|
119
|
+
*/
|
|
120
|
+
showHeaders: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: true
|
|
113
123
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Function to determine if a date should be disabled
|
|
127
|
+
* @type {Function}
|
|
128
|
+
* @default () => false
|
|
129
|
+
* @param {Date} date - Date to check
|
|
130
|
+
* @returns {Boolean} - Whether date is disabled
|
|
131
|
+
*/
|
|
132
|
+
isDateDisabled: {
|
|
133
|
+
type: Function,
|
|
134
|
+
default: () => false
|
|
124
135
|
},
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Initial year to display
|
|
139
|
+
* @type {Number}
|
|
140
|
+
*/
|
|
141
|
+
year: Number,
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Initial month to display (0-11)
|
|
145
|
+
* @type {Number}
|
|
146
|
+
*/
|
|
147
|
+
month: Number,
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
const emit = defineEmits([
|
|
151
|
+
/**
|
|
152
|
+
* Emitted when the visible period changes
|
|
153
|
+
* @param {Object} range - Date range object
|
|
154
|
+
* @param {Date} range.start - Start date of visible period
|
|
155
|
+
* @param {Date} range.end - End date of visible period
|
|
156
|
+
*/
|
|
157
|
+
'change',
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Emitted when a date is selected
|
|
161
|
+
* @param {String} dateString - ISO string of selected date
|
|
162
|
+
*/
|
|
163
|
+
'select'
|
|
164
|
+
])
|
|
165
|
+
|
|
166
|
+
const {$dateTime, $helper, $r, $d} = inject('renusify')
|
|
167
|
+
|
|
168
|
+
const tab = ref('day')
|
|
169
|
+
const direction = ref(undefined)
|
|
170
|
+
const currentPeriod = ref({
|
|
171
|
+
month: props.month ? props.month : new Date().getMonth(),
|
|
172
|
+
year: props.year ? props.year : new Date().getFullYear()
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
const locale = computed(() => props.lang || $r?.lang || 'en')
|
|
176
|
+
const today = computed(() => new Date())
|
|
177
|
+
|
|
178
|
+
const firstDayOfWeek = computed(() => {
|
|
179
|
+
return $helper.ifHas($dateTime.langs, 0, locale.value, 'first_day') || 0
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
const timezoneOffset = computed(() => {
|
|
183
|
+
return new Date(currentPeriod.value.year, currentPeriod.value.month, 10).getTimezoneOffset()
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
const langZoneOffset = computed(() => {
|
|
187
|
+
return ($helper.ifHas($dateTime.langs, 0, locale.value, 'time_zone_offset') || 0) * -1
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
const rangeLocalDate = computed(() => {
|
|
191
|
+
const {year, month} = currentPeriod.value
|
|
192
|
+
|
|
193
|
+
const firstDayOfMonth = new Date(year, month, 1, 0, langZoneOffset.value - timezoneOffset.value, 0)
|
|
194
|
+
const firstDayWeekday = parseInt($d(firstDayOfMonth, 'de', locale.value))
|
|
195
|
+
const calendarStart = new Date(year, month, 1 - firstDayWeekday + 1, 0, langZoneOffset.value - timezoneOffset.value, 0)
|
|
196
|
+
|
|
197
|
+
const firstDayNextMonth = new Date(year, month + 1, 1, 0, langZoneOffset.value - timezoneOffset.value, 0)
|
|
198
|
+
const firstDayNextMonthWeekday = parseInt($d(firstDayNextMonth, 'de', locale.value))
|
|
199
|
+
const calendarEnd = new Date(year, month + 1, 1 - firstDayNextMonthWeekday, 23, 59 + langZoneOffset.value - timezoneOffset.value, 59)
|
|
200
|
+
|
|
201
|
+
return {start: calendarStart, end: calendarEnd}
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
const weekDaysBeforeFirstDayOfTheMonth = computed(() => {
|
|
205
|
+
const weekDay = rangeLocalDate.value.start.getDay()
|
|
206
|
+
return (weekDay - parseInt(firstDayOfWeek.value) + 7) % 7
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
const weekDays = computed(() => {
|
|
210
|
+
const first = parseInt(firstDayOfWeek.value)
|
|
211
|
+
return createRange(7).map(i =>
|
|
212
|
+
$d(new Date(2025, 2, first + i + 23, 0, langZoneOffset.value - timezoneOffset.value, 0), 'narrow', locale.value)
|
|
213
|
+
)
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
const currentPeriodDates = computed(() => {
|
|
217
|
+
const {start, end} = rangeLocalDate.value
|
|
218
|
+
const weeks = []
|
|
219
|
+
let currentDate = new Date(start)
|
|
220
|
+
|
|
221
|
+
let rows = Array.from({length: weekDaysBeforeFirstDayOfTheMonth.value}, () => ({
|
|
222
|
+
date: 0,
|
|
223
|
+
disabled: true,
|
|
224
|
+
today: false
|
|
225
|
+
}))
|
|
226
|
+
|
|
227
|
+
while (currentDate <= end) {
|
|
228
|
+
const date = new Date(currentDate)
|
|
229
|
+
rows.push({
|
|
230
|
+
date,
|
|
231
|
+
disabled: props.isDateDisabled(date),
|
|
232
|
+
today: areSameDates(date, today.value)
|
|
139
233
|
})
|
|
140
234
|
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if (this.rangeLocalDate.end < this.today) {
|
|
145
|
-
this.incrementMonth(1)
|
|
235
|
+
if (rows.length % 7 === 0) {
|
|
236
|
+
weeks.push(rows)
|
|
237
|
+
rows = []
|
|
146
238
|
}
|
|
147
|
-
},
|
|
148
|
-
computed: {
|
|
149
|
-
firstDayOfWeek() {
|
|
150
|
-
return this.$helper.ifHas(this.$dateTime.langs, 0, this.locale, 'first_day')
|
|
151
|
-
},
|
|
152
|
-
locale() {
|
|
153
|
-
return this.lang || this.$r.lang
|
|
154
|
-
},
|
|
155
|
-
today() {
|
|
156
|
-
return new Date()
|
|
157
|
-
},
|
|
158
|
-
weekDays() {
|
|
159
|
-
const first = parseInt(this.firstDayOfWeek, 10)
|
|
160
|
-
|
|
161
|
-
return this.createRange(7).map(i => this.$d(new Date(2025, 2, first + i + 23, 0, this.lang_zone_offset - this.timezoneOffset, 0), 'narrow', this.locale)) // 2017-02-02 is Sunday
|
|
162
|
-
},
|
|
163
|
-
rangeLocalDate() {
|
|
164
|
-
const {year, month} = this.currentPeriod
|
|
165
|
-
let firstDay = 1
|
|
166
|
-
let firstmonth = month
|
|
167
|
-
let firstyear = year
|
|
168
|
-
let first = new Date(firstyear, firstmonth, firstDay, 0, this.lang_zone_offset - this.timezoneOffset, 0)
|
|
169
|
-
let lc = parseInt(this.$d(first, 'de', this.locale))
|
|
170
|
-
first = new Date(firstyear, firstmonth, firstDay - lc + 1, 0, this.lang_zone_offset - this.timezoneOffset, 0)
|
|
171
|
-
|
|
172
|
-
firstDay = 1
|
|
173
|
-
firstmonth = month + 1
|
|
174
|
-
firstyear = year
|
|
175
|
-
let last = new Date(firstyear, firstmonth, firstDay, 0, this.lang_zone_offset - this.timezoneOffset, 0)
|
|
176
|
-
lc = parseInt(this.$d(last, 'de', this.locale))
|
|
177
|
-
last = new Date(firstyear, firstmonth, firstDay - lc, 23, 59 + this.lang_zone_offset - this.timezoneOffset, 59)
|
|
178
|
-
|
|
179
|
-
return {start: first, end: last}
|
|
180
|
-
},
|
|
181
|
-
weekDaysBeforeFirstDayOfTheMonth() {
|
|
182
|
-
const {start} = this.rangeLocalDate
|
|
183
|
-
const weekDay = start.getDay()
|
|
184
|
-
return (weekDay - parseInt(this.firstDayOfWeek) + 7) % 7
|
|
185
|
-
},
|
|
186
|
-
currentPeriodDates() {
|
|
187
|
-
const {start, end} = this.rangeLocalDate
|
|
188
|
-
const children = []
|
|
189
|
-
let firstday = start.getDate()
|
|
190
|
-
let firstmonth = start.getMonth()
|
|
191
|
-
let firstyear = start.getFullYear()
|
|
192
|
-
let rows = []
|
|
193
|
-
let day = this.weekDaysBeforeFirstDayOfTheMonth
|
|
194
|
-
|
|
195
|
-
while (day--) {
|
|
196
|
-
rows.push({
|
|
197
|
-
date: 0,
|
|
198
|
-
disabled: true,
|
|
199
|
-
today: false
|
|
200
|
-
})
|
|
201
|
-
}
|
|
202
|
-
let doJob = true
|
|
203
|
-
while (doJob) {
|
|
204
|
-
const date = new Date(firstyear, firstmonth, 1, 24, this.lang_zone_offset - this.timezoneOffset, 0)
|
|
205
|
-
date.setDate(firstday)
|
|
206
|
-
firstmonth = date.getMonth()
|
|
207
|
-
firstyear = date.getFullYear()
|
|
208
|
-
firstday = date.getDate() + 1
|
|
209
|
-
if (date.getTime() > end.getTime()) {
|
|
210
|
-
doJob = false
|
|
211
|
-
} else {
|
|
212
|
-
rows.push({
|
|
213
|
-
date: date,
|
|
214
|
-
disabled: this.isDateDisabled(date),
|
|
215
|
-
today: this.areSameDates(date, this.today)
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
if (rows.length % 7 === 0) {
|
|
219
|
-
children.push(rows)
|
|
220
|
-
rows = []
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
239
|
|
|
225
|
-
|
|
240
|
+
currentDate.setDate(currentDate.getDate() + 1)
|
|
241
|
+
}
|
|
226
242
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
243
|
+
if (rows.length > 0) {
|
|
244
|
+
const remainingDays = 7 - (rows.length % 7)
|
|
245
|
+
rows.push(...Array.from({length: remainingDays}, () => ({
|
|
246
|
+
date: 0,
|
|
247
|
+
disabled: true,
|
|
248
|
+
today: false
|
|
249
|
+
})))
|
|
250
|
+
weeks.push(rows)
|
|
251
|
+
}
|
|
234
252
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
253
|
+
return weeks
|
|
254
|
+
})
|
|
238
255
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
return (new Date(this.currentPeriod.year, this.currentPeriod.month, 10)).getTimezoneOffset()
|
|
243
|
-
},
|
|
244
|
-
lang_zone_offset() {
|
|
245
|
-
return this.$helper.ifHas(this.$dateTime.langs, 0, this.locale, 'time_zone_offset') * -1
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
watch: {
|
|
249
|
-
currentPeriod(currentPeriod, oldPeriod) {
|
|
250
|
-
const currentDate = new Date(currentPeriod.year, currentPeriod.month).getTime()
|
|
251
|
-
const oldDate = new Date(oldPeriod.year, oldPeriod.month).getTime()
|
|
252
|
-
this.direction = currentDate !== oldDate
|
|
253
|
-
? (currentDate > oldDate ? 'next' : 'prev')
|
|
254
|
-
: undefined
|
|
255
|
-
setTimeout(() => {
|
|
256
|
-
this.$emit('change', this.rangeLocalDate)
|
|
257
|
-
}, 10)
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
methods: {
|
|
261
|
-
createRange(number) {
|
|
262
|
-
const res = []
|
|
263
|
-
for (let i = 0; i < number; i++) {
|
|
264
|
-
res.push(i)
|
|
265
|
-
}
|
|
266
|
-
return res
|
|
267
|
-
},
|
|
268
|
-
incrementMonth(increment = 1) {
|
|
269
|
-
const incrementDate = new Date(this.currentPeriod.year, this.currentPeriod.month + increment)
|
|
270
|
-
this.currentPeriod = {
|
|
271
|
-
month: incrementDate.getMonth(),
|
|
272
|
-
year: incrementDate.getFullYear()
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
incrementYear(increment = 1) {
|
|
276
|
-
const incrementDate = new Date(this.currentPeriod.year + increment, this.currentPeriod.month)
|
|
277
|
-
this.currentPeriod = {
|
|
278
|
-
month: incrementDate.getMonth(),
|
|
279
|
-
year: incrementDate.getFullYear()
|
|
280
|
-
}
|
|
281
|
-
},
|
|
282
|
-
setMonth(increment) {
|
|
283
|
-
const incrementDate = new Date(this.currentPeriod.year, increment)
|
|
284
|
-
this.currentPeriod = {
|
|
285
|
-
month: incrementDate.getMonth(),
|
|
286
|
-
year: incrementDate.getFullYear()
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
|
-
selectDateItem(item) {
|
|
290
|
-
if (!item.disabled) {
|
|
291
|
-
this.$emit('select', item.date.toISOString())
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
areSameDates(date1, date2) {
|
|
295
|
-
if (typeof date1.getDate === 'function' && typeof date2.getDate === 'function') {
|
|
296
|
-
return (date1.getDate() === date2.getDate()) &&
|
|
297
|
-
(date1.getMonth() === date2.getMonth()) &&
|
|
298
|
-
(date1.getFullYear() === date2.getFullYear())
|
|
299
|
-
}
|
|
300
|
-
return false
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
256
|
+
watch(currentPeriod, (newPeriod, oldPeriod) => {
|
|
257
|
+
const currentDate = new Date(newPeriod.year, newPeriod.month).getTime()
|
|
258
|
+
const oldDate = new Date(oldPeriod.year, oldPeriod.month).getTime()
|
|
304
259
|
|
|
305
|
-
|
|
260
|
+
direction.value = currentDate !== oldDate
|
|
261
|
+
? (currentDate > oldDate ? 'next' : 'prev')
|
|
262
|
+
: undefined
|
|
306
263
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
264
|
+
setTimeout(() => {
|
|
265
|
+
emit('change', rangeLocalDate.value)
|
|
266
|
+
}, 10)
|
|
267
|
+
}, {deep: true})
|
|
310
268
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
font-size: 10px;
|
|
315
|
-
overflow-x: auto;
|
|
316
|
-
max-width: 100%;
|
|
269
|
+
const createRange = (number) => {
|
|
270
|
+
return Array.from({length: number}, (_, i) => i)
|
|
271
|
+
}
|
|
317
272
|
|
|
318
|
-
|
|
319
|
-
|
|
273
|
+
/**
|
|
274
|
+
* Increments or decrements the current month
|
|
275
|
+
* @param {Number} increment - Number of months to increment (negative for decrement)
|
|
276
|
+
*/
|
|
277
|
+
const incrementMonth = (increment = 1) => {
|
|
278
|
+
const incrementDate = new Date(currentPeriod.value.year, currentPeriod.value.month + increment)
|
|
279
|
+
currentPeriod.value = {
|
|
280
|
+
month: incrementDate.getMonth(),
|
|
281
|
+
year: incrementDate.getFullYear()
|
|
320
282
|
}
|
|
283
|
+
}
|
|
321
284
|
|
|
322
|
-
|
|
285
|
+
/**
|
|
286
|
+
* Increments or decrements the current year
|
|
287
|
+
* @param {Number} increment - Number of years to increment (negative for decrement)
|
|
288
|
+
*/
|
|
289
|
+
const incrementYear = (increment = 1) => {
|
|
290
|
+
const incrementDate = new Date(currentPeriod.value.year + increment, currentPeriod.value.month)
|
|
291
|
+
currentPeriod.value = {
|
|
292
|
+
month: incrementDate.getMonth(),
|
|
293
|
+
year: incrementDate.getFullYear()
|
|
294
|
+
}
|
|
295
|
+
}
|
|
323
296
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
297
|
+
/**
|
|
298
|
+
* Sets the current month
|
|
299
|
+
* @param {Number} monthIndex - Month index (0-11)
|
|
300
|
+
*/
|
|
301
|
+
const setMonth = (monthIndex) => {
|
|
302
|
+
const incrementDate = new Date(currentPeriod.value.year, monthIndex)
|
|
303
|
+
currentPeriod.value = {
|
|
304
|
+
month: incrementDate.getMonth(),
|
|
305
|
+
year: incrementDate.getFullYear()
|
|
306
|
+
}
|
|
307
|
+
}
|
|
329
308
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
309
|
+
/**
|
|
310
|
+
* Handles date selection
|
|
311
|
+
* @param {Object} item - Date item object
|
|
312
|
+
* @param {Date} item.date - Date object
|
|
313
|
+
*/
|
|
314
|
+
const selectDateItem = (item) => {
|
|
315
|
+
if (!item.disabled && item.date) {
|
|
316
|
+
emit('select', item.date.toISOString())
|
|
317
|
+
}
|
|
318
|
+
}
|
|
335
319
|
|
|
320
|
+
/**
|
|
321
|
+
* Compares two dates for equality (ignoring time)
|
|
322
|
+
* @param {Date} date1 - First date
|
|
323
|
+
* @param {Date} date2 - Second date
|
|
324
|
+
* @returns {Boolean} - Whether dates are the same day
|
|
325
|
+
*/
|
|
326
|
+
const areSameDates = (date1, date2) => {
|
|
327
|
+
if (!date1 || !date2 || typeof date1.getDate !== 'function' || typeof date2.getDate !== 'function') {
|
|
328
|
+
return false
|
|
336
329
|
}
|
|
330
|
+
return date1.getDate() === date2.getDate() &&
|
|
331
|
+
date1.getMonth() === date2.getMonth() &&
|
|
332
|
+
date1.getFullYear() === date2.getFullYear()
|
|
333
|
+
}
|
|
337
334
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
335
|
+
$dateTime.set_format({
|
|
336
|
+
'de': {
|
|
337
|
+
day: 'numeric',
|
|
338
|
+
numberingSystem: 'latn'
|
|
339
|
+
},
|
|
340
|
+
'me': {
|
|
341
|
+
month: 'numeric',
|
|
342
|
+
numberingSystem: 'latn'
|
|
343
|
+
},
|
|
344
|
+
'ye': {
|
|
345
|
+
year: 'numeric',
|
|
346
|
+
numberingSystem: 'latn'
|
|
341
347
|
}
|
|
348
|
+
})
|
|
349
|
+
|
|
350
|
+
if (rangeLocalDate.value.start > today.value) {
|
|
351
|
+
incrementMonth(-1)
|
|
352
|
+
}
|
|
353
|
+
if (rangeLocalDate.value.end < today.value) {
|
|
354
|
+
incrementMonth(1)
|
|
355
|
+
}
|
|
356
|
+
</script>
|
|
342
357
|
|
|
358
|
+
<style lang="scss">
|
|
359
|
+
@use "../../style" as *;
|
|
360
|
+
|
|
361
|
+
.#{$prefix}calendar {
|
|
362
|
+
position: relative;
|
|
363
|
+
display: inline-block;
|
|
364
|
+
font-family: inherit;
|
|
365
|
+
overflow-x: auto;
|
|
366
|
+
max-width: 100%;
|
|
367
|
+
background-color: var(--color-sheet-container-lowest);
|
|
368
|
+
border-radius: 8px;
|
|
369
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
|
343
370
|
|
|
344
371
|
.table {
|
|
345
372
|
width: 100%;
|
|
346
373
|
position: relative;
|
|
347
374
|
z-index: 1;
|
|
348
375
|
border-collapse: collapse;
|
|
349
|
-
@include
|
|
376
|
+
@include media-breakpoint-up('lg') {
|
|
350
377
|
table-layout: fixed;
|
|
351
378
|
}
|
|
352
379
|
}
|
|
353
380
|
|
|
354
|
-
.cell, .headCell {
|
|
355
|
-
box-sizing: border-box;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
381
|
.headCell {
|
|
359
|
-
|
|
360
|
-
padding: 0 0.5em;
|
|
382
|
+
padding: 12px 8px;
|
|
361
383
|
text-align: center;
|
|
384
|
+
border-bottom: 1px solid var(--color-border-low);
|
|
385
|
+
background-color: var(--color-sheet-container-low);
|
|
362
386
|
}
|
|
363
387
|
|
|
364
388
|
.headCellContent {
|
|
365
|
-
|
|
366
|
-
|
|
389
|
+
color: var(--color-on-sheet-2);
|
|
390
|
+
letter-spacing: 0.05em;
|
|
367
391
|
}
|
|
368
392
|
|
|
369
|
-
.
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
transition:
|
|
374
|
-
|
|
393
|
+
.cell {
|
|
394
|
+
padding: 0;
|
|
395
|
+
height: 60px;
|
|
396
|
+
border: 1px solid var(--color-border-low);
|
|
397
|
+
transition: all 0.2s ease;
|
|
398
|
+
position: relative;
|
|
399
|
+
vertical-align: top;
|
|
375
400
|
|
|
376
|
-
|
|
377
|
-
|
|
401
|
+
&:hover:not(.disabled) {
|
|
402
|
+
background-color: var(--color-sheet-container-low);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
&.today {
|
|
406
|
+
.cellContent {
|
|
407
|
+
font-weight: 600;
|
|
408
|
+
color: var(--color-one);
|
|
409
|
+
border: 1px solid var(--color-one);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
&.selectable {
|
|
414
|
+
cursor: pointer;
|
|
415
|
+
|
|
416
|
+
&:hover {
|
|
417
|
+
.cellContent {
|
|
418
|
+
color: var(--color-one);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
&.disabled {
|
|
424
|
+
background-color: var(--color-sheet-container);
|
|
425
|
+
opacity: 0.5;
|
|
426
|
+
pointer-events: none;
|
|
427
|
+
}
|
|
378
428
|
}
|
|
379
429
|
|
|
380
|
-
.
|
|
381
|
-
|
|
430
|
+
.cellContent {
|
|
431
|
+
display: flex;
|
|
432
|
+
align-items: center;
|
|
433
|
+
justify-content: center;
|
|
434
|
+
height: 100%;
|
|
435
|
+
min-height: 60px;
|
|
436
|
+
padding: 8px;
|
|
437
|
+
transition: all 0.2s ease;
|
|
438
|
+
color: var(--color-on-sheet);
|
|
439
|
+
position: relative;
|
|
382
440
|
}
|
|
383
441
|
|
|
442
|
+
.cell.outOfRange {
|
|
443
|
+
.cellContent {
|
|
444
|
+
color: var(--color-border);
|
|
445
|
+
opacity: 0.6;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
384
448
|
}
|
|
385
449
|
</style>
|