@studio-west/component-sw 0.12.8 → 0.12.9
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/package.json
CHANGED
package/src/Alert.ts
CHANGED
|
@@ -14,9 +14,14 @@ export interface AlertOptions {
|
|
|
14
14
|
footer?: string | (() => VNode | VNode[])
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
let container: HTMLDivElement | null =
|
|
17
|
+
let container: HTMLDivElement | null = null
|
|
18
18
|
|
|
19
19
|
export function Alert(options: AlertOptions = {}): void {
|
|
20
|
+
if (typeof document === 'undefined') return
|
|
21
|
+
|
|
22
|
+
if (!container) {
|
|
23
|
+
container = document.querySelector("div.sw-alert-wrapper")
|
|
24
|
+
}
|
|
20
25
|
if (!container) {
|
|
21
26
|
container = document.createElement('div')
|
|
22
27
|
container.className = 'sw-alert-wrapper'
|
|
@@ -32,7 +32,7 @@ const days = ref([])
|
|
|
32
32
|
const ind = ref(0)
|
|
33
33
|
const startId = ref(-1)
|
|
34
34
|
const endId = ref(-1)
|
|
35
|
-
const locale = ref(navigator.language || 'ru')
|
|
35
|
+
const locale = ref((typeof navigator !== 'undefined' && navigator.language) || 'ru')
|
|
36
36
|
const iso = (/en|zh|ja|he/.test(locale.value)) ? 0 : 1
|
|
37
37
|
const months = computed(() => {
|
|
38
38
|
return Array.from({ length: 12 }, (_, i) => {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
const tooltipStyle = (index) => {
|
|
74
|
-
const sliderElement = document.querySelector('.sw-slider')
|
|
74
|
+
const sliderElement = typeof document !== 'undefined' ? document.querySelector('.sw-slider') : null
|
|
75
75
|
if (sliderElement) {
|
|
76
76
|
return calculateTooltipPosition(sliderElement, props.vertical)
|
|
77
77
|
}
|