@coreui/vue-pro 4.7.0-alpha.0 → 4.7.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.
@@ -164,7 +164,7 @@ export const getMonthDetails = (year: number, month: number, firstDayOfWeek: num
164
164
  export const isDisableDateInRange = (
165
165
  startDate?: Date | null,
166
166
  endDate?: Date | null,
167
- dates?: Date[] | Date[][],
167
+ dates?: Date[] | Date[][] | (Date | Date[])[],
168
168
  ) => {
169
169
  if (startDate && endDate) {
170
170
  const date = new Date(startDate)
@@ -188,7 +188,7 @@ export const isDateDisabled = (
188
188
  date: Date,
189
189
  min?: Date | null,
190
190
  max?: Date | null,
191
- dates?: Date[] | Date[][],
191
+ dates?: Date[] | Date[][] | (Date | Date[])[],
192
192
  ) => {
193
193
  let disabled
194
194
  if (dates) {
@@ -1,5 +1,5 @@
1
1
  import getNextSibling from './getNextSibling'
2
2
  import getPreviousSibling from './getPreviousSibling'
3
- import isVisible from './isVisible'
3
+ import isInViewport from './isInViewport'
4
4
 
5
- export { getNextSibling, getPreviousSibling, isVisible }
5
+ export { getNextSibling, getPreviousSibling, isInViewport }
@@ -0,0 +1,11 @@
1
+ const isInViewport = (element: HTMLElement) => {
2
+ const rect = element.getBoundingClientRect()
3
+ return (
4
+ Math.floor(rect.top) >= 0 &&
5
+ Math.floor(rect.left) >= 0 &&
6
+ Math.floor(rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) &&
7
+ Math.floor(rect.right) <= (window.innerWidth || document.documentElement.clientWidth)
8
+ )
9
+ }
10
+
11
+ export default isInViewport
package/src/utils/time.ts CHANGED
@@ -27,10 +27,12 @@ export const getAmPm = (date: Date, locale: string) => {
27
27
  }
28
28
 
29
29
  export const getListOfHours = (locale: string, ampm: 'auto' | boolean = 'auto') =>
30
- Array.from({ length: (ampm === 'auto' && isAmPm(locale)) || ampm ? 12 : 24 }, (_, i) => {
30
+ Array.from({ length: (ampm === 'auto' && isAmPm(locale)) || ampm === true ? 12 : 24 }, (_, i) => {
31
31
  return {
32
- value: (ampm === 'auto' && isAmPm(locale)) || ampm ? i + 1 : i,
33
- label: ((ampm === 'auto' && isAmPm(locale)) || ampm ? i + 1 : i).toLocaleString(locale),
32
+ value: (ampm === 'auto' && isAmPm(locale)) || ampm === true ? i + 1 : i,
33
+ label: ((ampm === 'auto' && isAmPm(locale)) || ampm === true ? i + 1 : i).toLocaleString(
34
+ locale,
35
+ ),
34
36
  }
35
37
  })
36
38
 
@@ -42,12 +44,10 @@ export const getListOfMinutes = (locale: string, valueAsString = false) =>
42
44
  value: valueAsString ? i.toString() : i,
43
45
  label: d
44
46
  .toLocaleTimeString(locale, {
45
- hour: '2-digit',
46
- hour12: false,
47
47
  minute: '2-digit',
48
48
  second: '2-digit',
49
49
  })
50
- .split(':')[1],
50
+ .split(/[^A-Za-z0-9]/)[0],
51
51
  }
52
52
  })
53
53
 
@@ -59,12 +59,10 @@ export const getListOfSeconds = (locale: string, valueAsString = false) =>
59
59
  value: valueAsString ? i.toString() : i,
60
60
  label: d
61
61
  .toLocaleTimeString(locale, {
62
- hour: '2-digit',
63
- hour12: false,
64
62
  minute: '2-digit',
65
63
  second: '2-digit',
66
64
  })
67
- .split(':')[2],
65
+ .split(/[^A-Za-z0-9]/)[1],
68
66
  }
69
67
  })
70
68
 
@@ -74,7 +72,7 @@ export const getSelectedHour = (
74
72
  ampm: 'auto' | boolean = 'auto',
75
73
  ) =>
76
74
  date
77
- ? (ampm === 'auto' && isAmPm(locale)) || ampm
75
+ ? (ampm === 'auto' && isAmPm(locale)) || ampm === true
78
76
  ? convert24hTo12h(date.getHours())
79
77
  : date.getHours()
80
78
  : ''
@@ -1,11 +0,0 @@
1
- const isVisible = (element: HTMLElement) => {
2
- const rect = element.getBoundingClientRect()
3
- return (
4
- rect.top >= 0 &&
5
- rect.left >= 0 &&
6
- rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
7
- rect.right <= (window.innerWidth || document.documentElement.clientWidth)
8
- )
9
- }
10
-
11
- export default isVisible