renusify 2.5.1 → 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.
Files changed (212) hide show
  1. package/components/app/index.vue +74 -22
  2. package/components/app/toast/index.vue +76 -71
  3. package/components/app/toast/toast.vue +62 -44
  4. package/components/avatar/index.vue +208 -84
  5. package/components/button/buttonConfirm.vue +53 -26
  6. package/components/button/buttonGroup.js +0 -2
  7. package/components/button/buttonGroup.vue +310 -62
  8. package/components/button/index.vue +584 -100
  9. package/components/calendar/index.js +0 -2
  10. package/components/calendar/index.vue +326 -262
  11. package/components/calendar/month.vue +64 -55
  12. package/components/calendar/year.vue +30 -25
  13. package/components/card/index.vue +139 -59
  14. package/components/codeEditor/highlightCss.vue +38 -39
  15. package/components/codeEditor/highlightHtml.vue +64 -64
  16. package/components/codeEditor/highlightJs.vue +37 -38
  17. package/components/codeEditor/index.vue +129 -79
  18. package/components/codeEditor/run.vue +225 -39
  19. package/components/codeEditor/useCodeFormatter.js +150 -0
  20. package/components/confirm/index.vue +140 -81
  21. package/components/container/col.vue +5 -4
  22. package/components/container/divider.vue +28 -19
  23. package/components/container/index.vue +34 -15
  24. package/components/container/row.vue +26 -9
  25. package/components/container/spacer.vue +2 -4
  26. package/components/container/style.scss +3 -0
  27. package/components/content/index.vue +49 -32
  28. package/components/cropper/index.vue +401 -244
  29. package/components/float/index.vue +542 -415
  30. package/components/form/addressInput/index.vue +184 -109
  31. package/components/form/camInput/index.vue +370 -244
  32. package/components/form/checkInput/index.vue +138 -71
  33. package/components/form/checkboxInput/index.vue +87 -47
  34. package/components/form/colorInput/Alpha.vue +81 -83
  35. package/components/form/colorInput/Hue.vue +91 -68
  36. package/components/form/colorInput/Preview.vue +43 -47
  37. package/components/form/colorInput/Saturation.vue +101 -86
  38. package/components/form/colorInput/index.vue +72 -40
  39. package/components/form/colorInput/picker.vue +111 -106
  40. package/components/form/colorInput/useColor.js +153 -0
  41. package/components/form/dateInput/index.vue +691 -356
  42. package/components/form/dateInput/month.vue +63 -54
  43. package/components/form/dateInput/year.vue +35 -25
  44. package/components/form/fileInput/index.js +0 -1
  45. package/components/form/fileInput/index.vue +263 -106
  46. package/components/form/fileInput/single.vue +323 -164
  47. package/components/form/groupInput/index.vue +199 -101
  48. package/components/form/index.vue +189 -83
  49. package/components/form/input/index.vue +416 -377
  50. package/components/form/jsonInput/JsonView.vue +54 -56
  51. package/components/form/jsonInput/index.vue +247 -165
  52. package/components/form/maskInput/index.vue +252 -132
  53. package/components/form/numberInput/index.js +0 -1
  54. package/components/form/numberInput/index.vue +226 -117
  55. package/components/form/passwordInput/index.js +2 -1
  56. package/components/form/passwordInput/index.vue +269 -102
  57. package/components/form/radioInput/index.vue +143 -72
  58. package/components/form/rangeInput/index.vue +280 -167
  59. package/components/form/ratingInput/index.vue +57 -57
  60. package/components/form/selectInput/index.js +1 -3
  61. package/components/form/selectInput/index.vue +584 -296
  62. package/components/form/switchInput/index.vue +73 -59
  63. package/components/form/telInput/index.js +0 -1
  64. package/components/form/telInput/index.vue +238 -135
  65. package/components/form/textArea/index.vue +72 -35
  66. package/components/form/textEditor/index.vue +739 -0
  67. package/components/form/{text-editor → textEditor}/style.scss +8 -16
  68. package/components/form/textInput/index.vue +54 -32
  69. package/components/form/timeInput/index.vue +83 -56
  70. package/components/form/timeInput/range.vue +116 -95
  71. package/components/form/timeInput/timepicker.vue +382 -449
  72. package/components/form/uniqueInput/index.vue +105 -48
  73. package/components/form/unitInput/index.vue +139 -84
  74. package/components/formCreator/index.js +0 -1
  75. package/components/formCreator/index.vue +314 -148
  76. package/components/highlight/index.vue +41 -25
  77. package/components/highlight/style.scss +2 -2
  78. package/components/highlight/{mixin.js → useHighlight.js} +181 -160
  79. package/components/icon/index.vue +79 -33
  80. package/components/img/index.vue +249 -147
  81. package/components/img/preview.vue +180 -198
  82. package/components/img/svgImg.vue +42 -39
  83. package/components/index.js +5 -20
  84. package/components/infinite/index.js +1 -2
  85. package/components/infinite/index.vue +248 -66
  86. package/components/map/index.vue +428 -261
  87. package/components/map/route.vue +794 -487
  88. package/components/map/select.vue +118 -58
  89. package/components/menu/index.vue +201 -91
  90. package/components/meta/meta.js +26 -3
  91. package/components/modal/index.vue +383 -158
  92. package/components/notify/index.vue +204 -86
  93. package/components/notify/notification.vue +38 -55
  94. package/components/progress/circle.vue +189 -70
  95. package/components/progress/line.vue +266 -46
  96. package/components/searchBox/index.js +1 -3
  97. package/components/searchBox/index.vue +194 -101
  98. package/components/skeleton/index.vue +45 -20
  99. package/components/slider/index.vue +318 -156
  100. package/components/swiper/index.vue +254 -106
  101. package/components/table/crud/footer.vue +77 -53
  102. package/components/table/crud/header.vue +71 -72
  103. package/components/table/crud/index.vue +631 -401
  104. package/components/table/index.vue +721 -278
  105. package/components/timeAgo/index.vue +145 -96
  106. package/components/tour/index.vue +338 -235
  107. package/components/tree/index.vue +235 -89
  108. package/components/tree/tree-element.vue +107 -106
  109. package/directive/animate/index.js +77 -0
  110. package/directive/clickOutSide/index.js +98 -0
  111. package/directive/drag/index.js +153 -0
  112. package/directive/index.js +11 -13
  113. package/directive/intersect/index.js +263 -0
  114. package/directive/mask/index.js +67 -0
  115. package/directive/parallax/index.js +78 -0
  116. package/directive/ripple/index.js +14 -0
  117. package/directive/scroll/index.js +244 -0
  118. package/directive/sortable/index.js +274 -0
  119. package/directive/title/index.js +75 -0
  120. package/directive/touch/index.js +268 -0
  121. package/index.js +10 -8
  122. package/package.json +5 -2
  123. package/plugins/validation/Validate.js +88 -79
  124. package/scripts/generate-docs.mjs +226 -0
  125. package/scripts/menu.mjs +240 -0
  126. package/scripts/parser.mjs +1086 -0
  127. package/style/_index.scss +7 -0
  128. package/style/app.scss +13 -65
  129. package/style/colors.scss +5 -22
  130. package/style/functions/index.scss +8 -0
  131. package/style/mixins/index.scss +17 -5
  132. package/style/variables/base.scss +154 -175
  133. package/style/variables/color.scss +0 -12
  134. package/style/variables/utilities.scss +0 -180
  135. package/tools/helper.js +0 -8
  136. package/tools/icons.js +6 -1
  137. package/tools/root.js +71 -0
  138. package/components/app/style.scss +0 -41
  139. package/components/app/toast/style.scss +0 -20
  140. package/components/avatar/style.scss +0 -32
  141. package/components/bar/bottomNav.js +0 -1
  142. package/components/bar/bottomNav.vue +0 -28
  143. package/components/bar/bottomNavigationCircle.js +0 -2
  144. package/components/bar/bottomNavigationCircle.vue +0 -99
  145. package/components/bar/scss/bottomNav.scss +0 -67
  146. package/components/bar/scss/toolbar.scss +0 -174
  147. package/components/bar/toolbar/index.js +0 -8
  148. package/components/bar/toolbar/index.vue +0 -35
  149. package/components/bar/toolbar/laptop.vue +0 -33
  150. package/components/bar/toolbar/menuChilds.vue +0 -41
  151. package/components/bar/toolbar/menuLaptop.vue +0 -41
  152. package/components/bar/toolbar/menuMob.vue +0 -39
  153. package/components/bar/toolbar/mixin.js +0 -43
  154. package/components/bar/toolbar/mobile.vue +0 -34
  155. package/components/breadcrumb/bredcrumbItem.vue +0 -39
  156. package/components/breadcrumb/index.js +0 -3
  157. package/components/breadcrumb/index.vue +0 -71
  158. package/components/breadcrumb/style.scss +0 -51
  159. package/components/button/style.scss +0 -411
  160. package/components/card/style.scss +0 -86
  161. package/components/chart/chart.js +0 -1
  162. package/components/chart/chart.vue +0 -69
  163. package/components/chart/worldMap.js +0 -2
  164. package/components/chart/worldMap.vue +0 -1112
  165. package/components/chat/MessageList.vue +0 -163
  166. package/components/chat/chatInput.vue +0 -150
  167. package/components/chat/chatMsg.vue +0 -276
  168. package/components/chat/index.js +0 -11
  169. package/components/chat/index.vue +0 -113
  170. package/components/chip/index.js +0 -3
  171. package/components/chip/index.vue +0 -77
  172. package/components/chip/style.scss +0 -199
  173. package/components/codeEditor/mixin.js +0 -145
  174. package/components/countdown/index.js +0 -1
  175. package/components/countdown/index.vue +0 -105
  176. package/components/form/colorInput/mixin.js +0 -132
  177. package/components/form/fileInput/file.js +0 -148
  178. package/components/form/telInput/assets/flags.png +0 -0
  179. package/components/form/telInput/assets/flags@2x.png +0 -0
  180. package/components/form/text-editor/index.vue +0 -710
  181. package/components/icon/style.scss +0 -17
  182. package/components/infinite/div.js +0 -6
  183. package/components/infinite/div.vue +0 -193
  184. package/components/infinite/page.js +0 -3
  185. package/components/infinite/page.vue +0 -105
  186. package/components/list/index.js +0 -3
  187. package/components/list/index.vue +0 -122
  188. package/components/list/style.scss +0 -66
  189. package/components/message/index.js +0 -4
  190. package/components/message/index.vue +0 -40
  191. package/components/modal/style.scss +0 -146
  192. package/components/nestable/NestableItem.vue +0 -307
  193. package/components/nestable/editable.js +0 -44
  194. package/components/nestable/index.js +0 -1
  195. package/components/nestable/index.vue +0 -226
  196. package/components/nestable/methods.js +0 -416
  197. package/components/progress/style.scss +0 -229
  198. package/components/table/style.scss +0 -338
  199. package/components/tabs/index.js +0 -3
  200. package/components/tabs/index.vue +0 -151
  201. package/components/timeline/index.js +0 -6
  202. package/components/timeline/index.vue +0 -76
  203. package/directive/resize/index.js +0 -30
  204. package/directive/skeleton/index.js +0 -27
  205. package/directive/skeleton/style.scss +0 -37
  206. package/plugins/request/Request.js +0 -68
  207. package/style/animation.scss +0 -94
  208. package/style/style.scss +0 -8
  209. package/tools/rootable.js +0 -75
  210. /package/components/form/{text-editor → textEditor}/index.js +0 -0
  211. /package/components/form/{text-editor → textEditor}/preview.js +0 -0
  212. /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, lang_zone_offset - timezoneOffset), 'month', locale)
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, lang_zone_offset - timezoneOffset), 'year', locale)
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
- <r-calendar-year-tab v-if="tab==='year'"
76
- :model-value='currentPeriod.year'
77
- @update:model-value="(tab='month',incrementYear($event))"
78
- :timezoneOffset="lang_zone_offset-timezoneOffset"
79
- :locale="locale"
80
- :month="currentPeriod.month"
81
- ></r-calendar-year-tab>
82
- <r-calendar-month-tab v-if="tab==='month'"
83
- :model-value='currentPeriod.month'
84
- @update:model-value="(tab='day',setMonth($event))"
85
- :timezoneOffset="lang_zone_offset-timezoneOffset"
86
- :locale="locale"
87
- :month="currentPeriod.month"
88
- :year="currentPeriod.year"
89
- ></r-calendar-month-tab>
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
- export default {
99
- name: 'calendar',
100
- inheritAttrs: false,
101
- props: {
102
- lang: {
103
- type: String
104
- },
105
- readonly: Boolean,
106
- showHeaders: {type: Boolean, default: true},
107
- isDateDisabled: {
108
- type: Function,
109
- default: () => false
110
- },
111
- year: Number,
112
- month: Number,
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
- emits: ['change', 'select'],
115
- data() {
116
- return {
117
- tab: 'day',
118
- direction: undefined,
119
- currentPeriod: {
120
- month: (new Date()).getMonth() + 1,
121
- year: (new Date()).getFullYear()
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
- created() {
126
- this.$dateTime.set_format({
127
- 'de': {
128
- day: 'numeric',
129
- numberingSystem: 'latn'
130
- },
131
- 'me': {
132
- month: 'numeric',
133
- numberingSystem: 'latn'
134
- },
135
- 'ye': {
136
- year: 'numeric',
137
- numberingSystem: 'latn'
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 (this.rangeLocalDate.start > this.today) {
142
- this.incrementMonth(-1)
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
- day = 7 - rows.length % 7
240
+ currentDate.setDate(currentDate.getDate() + 1)
241
+ }
226
242
 
227
- while (day--) {
228
- rows.push({
229
- date: 0,
230
- disabled: true,
231
- today: false
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
- if (rows.length) {
236
- children.push(rows)
237
- }
253
+ return weeks
254
+ })
238
255
 
239
- return children
240
- },
241
- timezoneOffset() {
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
- </script>
260
+ direction.value = currentDate !== oldDate
261
+ ? (currentDate > oldDate ? 'next' : 'prev')
262
+ : undefined
306
263
 
307
- <style lang="scss">
308
- @use "../../style/variables/base";
309
- @use "../../style/mixins/container" as mixins;
264
+ setTimeout(() => {
265
+ emit('change', rangeLocalDate.value)
266
+ }, 10)
267
+ }, {deep: true})
310
268
 
311
- .#{base.$prefix}calendar {
312
- position: relative;
313
- display: inline-block;
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
- .cell, .headCell {
319
- border: 1px solid var(--color-border);
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
- .cell {
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
- &.today {
325
- .cellContent {
326
- border: solid 1px var(--color-one);
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
- &.selectable:hover {
331
- .cellContent {
332
- border: solid 1px var(--color-one);
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
- .cell.disabled {
339
- background-color: var(--color-border);
340
- opacity: 0.3;
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 mixins.media-breakpoint-up('lg') {
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
- font-weight: bold;
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
- font-size: 1.3em;
366
- color: #848484;
389
+ color: var(--color-on-sheet-2);
390
+ letter-spacing: 0.05em;
367
391
  }
368
392
 
369
- .cellContent {
370
- font-size: 1.4em;
371
- min-width: 100px;
372
- min-height: 100px;
373
- transition: background 0.1s, color 0.1s;
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
- .cell.outOfRange {
377
- color: #c7c7c7;
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
- .cell.selectable {
381
- cursor: pointer;
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>