@studio-west/component-sw 0.12.23 → 0.12.25
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/README.md +0 -2
- package/dist/{SwAlert-DdNME1KV.js → SwAlert-CU7nEnO-.js} +1 -1
- package/dist/{SwDropdownItem-BQ0sWjy3.js → SwDropdownItem-CKOTwhTf.js} +1 -1
- package/dist/{SwGide-T8VMbn6F.js → SwGide-Ie6XCPUn.js} +1 -1
- package/dist/{SwIcon-jPY932qp.js → SwIcon-D6FCTrgR.js} +2 -2
- package/dist/{SwInput-BvqWmT5t.js → SwInput-u7kS3lQn.js} +1 -1
- package/dist/{SwMessage-T2PdfXm1.js → SwMessage-DRjFGSK3.js} +1 -1
- package/dist/component-sw.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/package.json +2 -5
- package/src/Alert.ts +0 -70
- package/src/components/SwAlert.vue +0 -70
- package/src/components/SwButton.vue +0 -57
- package/src/components/SwButtonGroup.vue +0 -68
- package/src/components/SwCollapse.vue +0 -13
- package/src/components/SwDatePicker.vue +0 -375
- package/src/components/SwDropdown.vue +0 -195
- package/src/components/SwDropdownItem.vue +0 -26
- package/src/components/SwDropdownNew.vue +0 -175
- package/src/components/SwFormItem.vue +0 -21
- package/src/components/SwGide.vue +0 -128
- package/src/components/SwIcon.vue +0 -35
- package/src/components/SwInput.vue +0 -106
- package/src/components/SwMenu.vue +0 -217
- package/src/components/SwMessage.vue +0 -53
- package/src/components/SwSection.vue +0 -17
- package/src/components/SwSelect.vue +0 -153
- package/src/components/SwSkeleton.vue +0 -13
- package/src/components/SwSkeletonItem.vue +0 -27
- package/src/components/SwSlider.vue +0 -281
- package/src/components/SwSwitch.vue +0 -53
- package/src/components/SwTable.vue +0 -481
- package/src/components/SwTableColumn.vue +0 -88
- package/src/components/SwTabs.vue +0 -42
- package/src/components/SwTabsPane.vue +0 -44
- package/src/index.ts +0 -38
- package/src/utils/index.ts +0 -149
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, h, resolveComponent, getCurrentInstance, type VNode, type Component } from 'vue'
|
|
3
|
-
|
|
4
|
-
// Типы для конфигурации компонента
|
|
5
|
-
interface ComponentConfig {
|
|
6
|
-
[key: string]: any
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface MenuItemConfig {
|
|
10
|
-
slot?: string | ComponentConfig | Array<any>
|
|
11
|
-
[key: string]: any
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface MenuItemsObject {
|
|
15
|
-
[componentName: string]: MenuItemConfig | MenuItemConfig[]
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
type MenuItems = MenuItemsObject | Array<{ [componentName: string]: MenuItemConfig }>
|
|
19
|
-
|
|
20
|
-
interface Props {
|
|
21
|
-
menuItems: MenuItems
|
|
22
|
-
class?: string
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
26
|
-
class: ''
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
const model = defineModel<boolean[]>()
|
|
30
|
-
const emit = defineEmits<{
|
|
31
|
-
click: [{ index: number; componentName: string; event: Event; value?: boolean }]
|
|
32
|
-
change: [{ index: number; componentName: string; event?: Event; value?: boolean }]
|
|
33
|
-
}>()
|
|
34
|
-
|
|
35
|
-
const instance = getCurrentInstance()
|
|
36
|
-
|
|
37
|
-
// Рекурсивная функция для создания компонента со слотами
|
|
38
|
-
const createComponentWithSlots = (
|
|
39
|
-
componentName: string | Component,
|
|
40
|
-
config: MenuItemConfig,
|
|
41
|
-
index: number | null = null
|
|
42
|
-
): VNode => {
|
|
43
|
-
let component: Component | string | undefined
|
|
44
|
-
let resolvedComponent: any = null
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
if (typeof componentName === 'string') {
|
|
48
|
-
// Сначала ищем в глобально зарегистрированных компонентах
|
|
49
|
-
component = instance?.appContext?.components?.[componentName]
|
|
50
|
-
if (!component) {
|
|
51
|
-
try {
|
|
52
|
-
resolvedComponent = resolveComponent(componentName)
|
|
53
|
-
// Если это async компонент, нужно получить его определение
|
|
54
|
-
if (resolvedComponent && typeof resolvedComponent === 'object') {
|
|
55
|
-
component = resolvedComponent as Component
|
|
56
|
-
}
|
|
57
|
-
} catch (e) {
|
|
58
|
-
console.warn(`Failed to resolve component: ${componentName}`, e)
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (!component || typeof component === 'string') {
|
|
62
|
-
console.error(`Component "${componentName}" NOT FOUND`)
|
|
63
|
-
return h('div', { class: 'error' }, `Component "${componentName}" not found`)
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
component = componentName
|
|
67
|
-
}
|
|
68
|
-
} catch (e) {
|
|
69
|
-
console.warn(`Component "${componentName}" not found`, e)
|
|
70
|
-
return h('div', { class: 'error' }, `Component "${componentName}" not found`)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (typeof config === 'object' && config !== null && !Array.isArray(config)) {
|
|
74
|
-
const slots: Record<string, () => any> = {}
|
|
75
|
-
const componentProps: Record<string, any> = {}
|
|
76
|
-
|
|
77
|
-
for (const [key, value] of Object.entries(config)) {
|
|
78
|
-
if (key === 'slot') {
|
|
79
|
-
slots.default = () => {
|
|
80
|
-
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
81
|
-
if ('text' in value) {
|
|
82
|
-
return h('span', { textContent: value.text })
|
|
83
|
-
}
|
|
84
|
-
if ('html' in value) {
|
|
85
|
-
return h('span', { innerHTML: value.html })
|
|
86
|
-
}
|
|
87
|
-
return Object.entries(value).map(([compName, compConfig]) => {
|
|
88
|
-
if (Array.isArray(compConfig)) {
|
|
89
|
-
return compConfig.map(item => createComponentWithSlots(compName, item))
|
|
90
|
-
} else {
|
|
91
|
-
return createComponentWithSlots(compName, compConfig as MenuItemConfig)
|
|
92
|
-
}
|
|
93
|
-
}).flat()
|
|
94
|
-
}
|
|
95
|
-
if (Array.isArray(value)) {
|
|
96
|
-
return value.map(item => {
|
|
97
|
-
if (typeof item === 'object' && !Array.isArray(item)) {
|
|
98
|
-
const [nestedComponentName, nestedConfig] = Object.entries(item)[0]
|
|
99
|
-
return createComponentWithSlots(nestedComponentName, nestedConfig as MenuItemConfig)
|
|
100
|
-
}
|
|
101
|
-
return item
|
|
102
|
-
})
|
|
103
|
-
}
|
|
104
|
-
return value
|
|
105
|
-
}
|
|
106
|
-
} else if (key.startsWith('slot.')) {
|
|
107
|
-
const slotName = key.substring(5)
|
|
108
|
-
slots[slotName] = () => {
|
|
109
|
-
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
110
|
-
if ('text' in value) {
|
|
111
|
-
return h('span', { textContent: value.text })
|
|
112
|
-
}
|
|
113
|
-
if ('html' in value) {
|
|
114
|
-
return h('span', { innerHTML: value.html })
|
|
115
|
-
}
|
|
116
|
-
return Object.entries(value).map(([compName, compConfig]) => {
|
|
117
|
-
if (Array.isArray(compConfig)) {
|
|
118
|
-
return compConfig.map(item => createComponentWithSlots(compName, item))
|
|
119
|
-
} else {
|
|
120
|
-
return createComponentWithSlots(compName, compConfig as MenuItemConfig)
|
|
121
|
-
}
|
|
122
|
-
}).flat()
|
|
123
|
-
}
|
|
124
|
-
if (Array.isArray(value)) {
|
|
125
|
-
return value.map(item => {
|
|
126
|
-
if (typeof item === 'object' && !Array.isArray(item)) {
|
|
127
|
-
const [nestedComponentName, nestedConfig] = Object.entries(item)[0]
|
|
128
|
-
return createComponentWithSlots(nestedComponentName, nestedConfig as MenuItemConfig)
|
|
129
|
-
}
|
|
130
|
-
return item
|
|
131
|
-
})
|
|
132
|
-
}
|
|
133
|
-
return value
|
|
134
|
-
}
|
|
135
|
-
} else {
|
|
136
|
-
componentProps[key] = value
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Назначаем двустороннюю привязку (v-model) всем компонентам первого уровня
|
|
141
|
-
if (index !== null) {
|
|
142
|
-
// Добавляем обработчики событий click и change
|
|
143
|
-
componentProps.onClick = (event: Event) => {
|
|
144
|
-
emit('click', { index, componentName: String(componentName), event, value: model.value?.[index] })
|
|
145
|
-
}
|
|
146
|
-
componentProps.onChange = (event: Event) => {
|
|
147
|
-
emit('change', { index, componentName: String(componentName), event, value: model.value?.[index] })
|
|
148
|
-
}
|
|
149
|
-
componentProps['onUpdate:modelValue'] = (value: boolean) => {
|
|
150
|
-
// Инициализируем model.value если он undefined
|
|
151
|
-
if (!model.value) {
|
|
152
|
-
model.value = []
|
|
153
|
-
}
|
|
154
|
-
const newValues = [...model.value]
|
|
155
|
-
// Расширяем массив если нужно
|
|
156
|
-
while (newValues.length <= index) {
|
|
157
|
-
newValues.push(false)
|
|
158
|
-
}
|
|
159
|
-
newValues[index] = value
|
|
160
|
-
model.value = newValues
|
|
161
|
-
// Эмитим событие change при изменении значения
|
|
162
|
-
emit('change', { index, componentName: String(componentName), value })
|
|
163
|
-
}
|
|
164
|
-
// Используем значение из model или false по умолчанию
|
|
165
|
-
const currentValue = model.value && index < model.value.length ? model.value[index] : false
|
|
166
|
-
componentProps.modelValue = currentValue
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (Object.keys(slots).length > 0) {
|
|
170
|
-
return h(component as Component, componentProps, slots)
|
|
171
|
-
}
|
|
172
|
-
return h(component as Component, componentProps)
|
|
173
|
-
}
|
|
174
|
-
return h(component as Component, config)
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const menuComponents = computed(() => {
|
|
178
|
-
const components: Array<{ render: () => VNode }> = []
|
|
179
|
-
|
|
180
|
-
if (Array.isArray(props.menuItems)) {
|
|
181
|
-
props.menuItems.forEach((item, index) => {
|
|
182
|
-
if (typeof item === 'object' && item !== null) {
|
|
183
|
-
const [componentName, config] = Object.entries(item)[0]
|
|
184
|
-
components.push({
|
|
185
|
-
render: () => createComponentWithSlots(componentName, config as MenuItemConfig, index)
|
|
186
|
-
})
|
|
187
|
-
}
|
|
188
|
-
})
|
|
189
|
-
} else {
|
|
190
|
-
let index = 0
|
|
191
|
-
for (const [componentName, params] of Object.entries(props.menuItems)) {
|
|
192
|
-
if (Array.isArray(params)) {
|
|
193
|
-
params.forEach((param) => {
|
|
194
|
-
components.push({
|
|
195
|
-
render: () => createComponentWithSlots(componentName, param, index++)
|
|
196
|
-
})
|
|
197
|
-
})
|
|
198
|
-
} else if (typeof params === 'object' && params !== null) {
|
|
199
|
-
components.push({
|
|
200
|
-
render: () => createComponentWithSlots(componentName, params, index)
|
|
201
|
-
})
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return components
|
|
206
|
-
})
|
|
207
|
-
</script>
|
|
208
|
-
|
|
209
|
-
<template>
|
|
210
|
-
<nav :class="'sw-menu ' + props.class">
|
|
211
|
-
<component
|
|
212
|
-
v-for="(item, index) in menuComponents"
|
|
213
|
-
:key="index"
|
|
214
|
-
:is="item.render"
|
|
215
|
-
/>
|
|
216
|
-
</nav>
|
|
217
|
-
</template>
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<dialog :class="'sw-message ' + props.class" ref="messageRef" >
|
|
3
|
-
<header v-if="props.name.length > 0 || !!slots?.header" ><slot name="header">{{ props.name }} <sw-button link type="primary" @click="model = false"><sw-icon :icon-class="props.iconAfter" /></sw-button></slot></header>
|
|
4
|
-
<slot></slot>
|
|
5
|
-
<footer><slot name="footer"></slot></footer>
|
|
6
|
-
</dialog>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script setup>
|
|
10
|
-
import {nextTick, onUnmounted, ref, watch, useSlots} from "vue"
|
|
11
|
-
import SwButton from "./SwButton.vue"
|
|
12
|
-
import SwIcon from "./SwIcon.vue"
|
|
13
|
-
|
|
14
|
-
const model = defineModel()
|
|
15
|
-
const props = defineProps({
|
|
16
|
-
name: {type: String, default: ''},
|
|
17
|
-
class: {type:String, default: ''},
|
|
18
|
-
iconAfter: {type:String, default: ''}
|
|
19
|
-
})
|
|
20
|
-
const messageRef = ref(null)
|
|
21
|
-
const slots = useSlots();
|
|
22
|
-
const handleClickOutside = (e) => {
|
|
23
|
-
if (messageRef.value && model.value) {
|
|
24
|
-
const dialogRect = messageRef.value.getBoundingClientRect()
|
|
25
|
-
const isClickInsideDialog = (
|
|
26
|
-
e.clientX >= dialogRect.left &&
|
|
27
|
-
e.clientX <= dialogRect.right &&
|
|
28
|
-
e.clientY >= dialogRect.top &&
|
|
29
|
-
e.clientY <= dialogRect.bottom
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
// Если клик вне диалога, закрываем его
|
|
33
|
-
if (!isClickInsideDialog) {
|
|
34
|
-
model.value = false
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
// Когда модель становится true — добавляем обработчик
|
|
39
|
-
watch(() => model.value, (newVal) => {
|
|
40
|
-
if (newVal) {
|
|
41
|
-
messageRef.value.showModal()
|
|
42
|
-
|
|
43
|
-
nextTick() // ждём, пока DOM обновится
|
|
44
|
-
window.addEventListener('click', handleClickOutside, true)
|
|
45
|
-
} else {
|
|
46
|
-
messageRef.value.close()
|
|
47
|
-
window.removeEventListener('click', handleClickOutside)
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
onUnmounted(() => {
|
|
51
|
-
window.removeEventListener('click', handleClickOutside)
|
|
52
|
-
})
|
|
53
|
-
</script>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
const props = defineProps({
|
|
3
|
-
name: {type: String, default: ''},
|
|
4
|
-
class: {type:String, default: ''},
|
|
5
|
-
iconAfter: {type:String, default: ''}
|
|
6
|
-
})
|
|
7
|
-
const emit = defineEmits(['header'])
|
|
8
|
-
const header = () => {emit('header')}
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<template>
|
|
12
|
-
<section :class="'sw-section ' + props.class">
|
|
13
|
-
<header @click="header"><slot name="header">{{ props.name }} <svg-icon :icon-class="props.iconAfter" /></slot></header>
|
|
14
|
-
<slot></slot>
|
|
15
|
-
<footer><slot name="footer"></slot></footer>
|
|
16
|
-
</section>
|
|
17
|
-
</template>
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { ref, watch } from "vue"
|
|
3
|
-
import axios from 'axios'
|
|
4
|
-
|
|
5
|
-
// Define types
|
|
6
|
-
interface AddressData {
|
|
7
|
-
fullText: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface Suggestion {
|
|
11
|
-
value: string
|
|
12
|
-
data: {
|
|
13
|
-
geo_lat: string
|
|
14
|
-
geo_lon: string
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface GeoData {
|
|
19
|
-
text: string
|
|
20
|
-
coords: [number, number]
|
|
21
|
-
suggestion: any
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const address = ref<AddressData>({ fullText: '' })
|
|
25
|
-
const visible = ref<boolean>(false)
|
|
26
|
-
const options = ref<Suggestion[]>([])
|
|
27
|
-
|
|
28
|
-
const model = defineModel<GeoData>()
|
|
29
|
-
|
|
30
|
-
interface Props {
|
|
31
|
-
class?: string
|
|
32
|
-
size?: 'large' | 'small'
|
|
33
|
-
placeholder?: string
|
|
34
|
-
token?: string
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
38
|
-
class: '',
|
|
39
|
-
size: 'large',
|
|
40
|
-
placeholder: '',
|
|
41
|
-
token: ''
|
|
42
|
-
})
|
|
43
|
-
watch(() => model.value?.text, (newValue) => {
|
|
44
|
-
if (newValue && newValue.length > 3) address.value.fullText = newValue
|
|
45
|
-
})
|
|
46
|
-
watch(() => address.value.fullText, (newValue, oldValue) => {
|
|
47
|
-
visible.value = (newValue.length > 3 && newValue.length > oldValue.length)
|
|
48
|
-
if (newValue.length >3) getDadata()
|
|
49
|
-
})
|
|
50
|
-
const getDadata = () => {
|
|
51
|
-
let url='https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/address'
|
|
52
|
-
console.log(address.value.fullText)
|
|
53
|
-
axios.post(url, {
|
|
54
|
-
query: address.value.fullText },
|
|
55
|
-
{
|
|
56
|
-
headers: {
|
|
57
|
-
"Content-Type": "application/json",
|
|
58
|
-
"Accept": "application/json",
|
|
59
|
-
"Authorization": 'Token ' + props.token
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
.then(response => {
|
|
63
|
-
console.log(response.data.suggestions)
|
|
64
|
-
options.value = response.data.suggestions
|
|
65
|
-
// this.visible = (this.options.length > 1)
|
|
66
|
-
if (options.value.length === 1) clickLi(options.value[0])
|
|
67
|
-
// this.geo.coords = [Number(response.data.result[0]), Number(response.data.result[1])]
|
|
68
|
-
})
|
|
69
|
-
.catch(error => {
|
|
70
|
-
// handle error
|
|
71
|
-
console.log(error);
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
const clickLi = (item: Suggestion) => {
|
|
75
|
-
address.value.fullText = item.value
|
|
76
|
-
visible.value = false
|
|
77
|
-
const geo: GeoData = {
|
|
78
|
-
text: item.value,
|
|
79
|
-
coords: [Number(item.data.geo_lat), Number(item.data.geo_lon)],
|
|
80
|
-
suggestion: item.data
|
|
81
|
-
}
|
|
82
|
-
model.value = geo
|
|
83
|
-
}
|
|
84
|
-
</script>
|
|
85
|
-
|
|
86
|
-
<template>
|
|
87
|
-
<div class="popup">
|
|
88
|
-
<sw-input
|
|
89
|
-
name="address"
|
|
90
|
-
:size="props.size"
|
|
91
|
-
v-model="address.fullText"
|
|
92
|
-
:placeholder="props.placeholder"
|
|
93
|
-
/>
|
|
94
|
-
<div class="wrapper" v-show="visible">
|
|
95
|
-
<ul class="scrollbar">
|
|
96
|
-
<li tabindex="1" v-for="(item, key) in options" :key="key" @click="clickLi(item)">{{ item.value }}</li>
|
|
97
|
-
</ul>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
</template>
|
|
101
|
-
|
|
102
|
-
<style lang="scss">
|
|
103
|
-
.popup{
|
|
104
|
-
position: relative;
|
|
105
|
-
.wrapper{
|
|
106
|
-
position: absolute;
|
|
107
|
-
z-index: 1;
|
|
108
|
-
list-style: none;
|
|
109
|
-
font-size: .8rem;
|
|
110
|
-
line-height: 1.2;
|
|
111
|
-
word-break: break-word;
|
|
112
|
-
padding: 0;
|
|
113
|
-
margin: 10px 0 0;
|
|
114
|
-
:before{
|
|
115
|
-
content: '';
|
|
116
|
-
border-bottom-color: transparent !important;
|
|
117
|
-
border-left-color: transparent !important;
|
|
118
|
-
border: 1px solid var(--el-border-color-light);
|
|
119
|
-
background: var(--el-bg-color-overlay);
|
|
120
|
-
right: 50%;
|
|
121
|
-
top: -6px;
|
|
122
|
-
position: absolute;
|
|
123
|
-
width: 10px;
|
|
124
|
-
height: 10px;
|
|
125
|
-
z-index: 1;
|
|
126
|
-
transform: rotate(-45deg);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
.scrollbar {
|
|
130
|
-
box-shadow: 0 0 0 1px var(--el-border-color);
|
|
131
|
-
border-radius: var(--el-border-radius-base);
|
|
132
|
-
background: #ffffff;
|
|
133
|
-
padding: .5rem 0;
|
|
134
|
-
margin: 0;
|
|
135
|
-
li{display: flex;
|
|
136
|
-
align-items: start;
|
|
137
|
-
white-space: nowrap;
|
|
138
|
-
list-style: none;
|
|
139
|
-
line-height: 22px;
|
|
140
|
-
padding: 5px 16px;
|
|
141
|
-
margin:0;
|
|
142
|
-
font-size: var(--sw-font-size);
|
|
143
|
-
color: var(--sw-text-color-secondary);
|
|
144
|
-
cursor:pointer;
|
|
145
|
-
outline: none;
|
|
146
|
-
&:not(.is-disabled):focus{
|
|
147
|
-
background: var(--el-dropdown-menuItem-hover-fill);
|
|
148
|
-
color:var(--el-dropdown-menuItem-hover-color);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
</style>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<slot v-if="props.visual"></slot>
|
|
3
|
-
<div v-else class="sw-skeleton" :class="props.class"><slot name="skeleton" ><sw-skeleton-item animate size="small"/></slot></div>
|
|
4
|
-
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup>
|
|
8
|
-
import SwSkeletonItem from "./SwSkeletonItem.vue"
|
|
9
|
-
const props = defineProps({
|
|
10
|
-
class: {type:String, default: ''},
|
|
11
|
-
visual: {type:Boolean, default: false}
|
|
12
|
-
})
|
|
13
|
-
</script>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="c" :style="s"><template v-if="props.animate"><div /></template></div>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script setup>
|
|
6
|
-
import {computed} from "vue";
|
|
7
|
-
|
|
8
|
-
const props = defineProps({
|
|
9
|
-
width: {type: String, default: '100'},
|
|
10
|
-
class: {type:String, default: ''},
|
|
11
|
-
animate: {type:Boolean, default: false},
|
|
12
|
-
size: {type:String, default: ''}
|
|
13
|
-
})
|
|
14
|
-
const c = computed(() =>{
|
|
15
|
-
let s = ['sw-skeleton-item']
|
|
16
|
-
if(props.size.length > 0) s.push('sw-' + props.size)
|
|
17
|
-
if(props.animate) s.push('sw-animate')
|
|
18
|
-
if(props.class.length > 0) s.push(props.class)
|
|
19
|
-
return s
|
|
20
|
-
}
|
|
21
|
-
)
|
|
22
|
-
const s = computed(() =>{
|
|
23
|
-
return {
|
|
24
|
-
width: props.width + '%'
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
</script>
|