sh-view 2.8.1 → 2.8.3
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/.eslintrc.js +25 -20
- package/other.js +8 -8
- package/package.json +9 -6
- package/packages/components/index.js +91 -91
- package/packages/components/sh-alert/alert.ts +30 -0
- package/packages/components/sh-alert/index.vue +143 -168
- package/packages/components/sh-badge/index.vue +242 -242
- package/packages/components/sh-calendar/index.vue +650 -650
- package/packages/components/sh-card/index.vue +148 -148
- package/packages/components/sh-code-editor/index.vue +19 -19
- package/packages/components/sh-col/index.vue +92 -92
- package/packages/components/sh-corner/index.vue +230 -230
- package/packages/components/sh-count-to/index.vue +131 -131
- package/packages/components/sh-date/index.vue +301 -301
- package/packages/components/sh-drawer/index.vue +579 -579
- package/packages/components/sh-drawer/scrollbar.js +78 -78
- package/packages/components/sh-empty/index.vue +42 -42
- package/packages/components/sh-form/js/props.js +76 -76
- package/packages/components/sh-form/js/useForm.js +229 -229
- package/packages/components/sh-header/index.vue +261 -260
- package/packages/components/sh-icon/css/default/ionicons.svg +869 -869
- package/packages/components/sh-icon/css/font/iconfont.json +247 -247
- package/packages/components/sh-icon/index.vue +41 -41
- package/packages/components/sh-image/index.vue +133 -133
- package/packages/components/sh-list/index.vue +146 -146
- package/packages/components/sh-loading/index.vue +53 -53
- package/packages/components/sh-modal/index.vue +188 -188
- package/packages/components/sh-noticebar/index.vue +215 -215
- package/packages/components/sh-poptip/index.vue +597 -597
- package/packages/components/sh-progress/index.vue +276 -276
- package/packages/components/sh-pull-refresh/index.vue +289 -289
- package/packages/components/sh-result/index.vue +114 -114
- package/packages/components/sh-row/index.vue +66 -66
- package/packages/components/sh-split/components/trigger.vue +33 -33
- package/packages/components/sh-split/index.vue +342 -342
- package/packages/components/sh-table/components/importModal.vue +363 -363
- package/packages/components/sh-table/components/sh-column.vue +68 -68
- package/packages/components/sh-table/js/excel_to_json.js +313 -313
- package/packages/components/sh-table/js/props.js +305 -305
- package/packages/components/sh-table/js/tableMethods.js +167 -167
- package/packages/components/sh-table/js/useTable.js +636 -636
- package/packages/components/sh-table/table.vue +217 -217
- package/packages/components/sh-tabs/index.vue +426 -426
- package/packages/components/sh-tag/index.vue +168 -168
- package/packages/components/sh-toolbar/index.vue +182 -182
- package/packages/components/sh-tree/components/table-tree.vue +289 -289
- package/packages/components/sh-tree/mixin/treeProps.js +122 -122
- package/packages/components/sh-upload/index.vue +535 -535
- package/packages/components/sh-water-fall/index.vue +80 -80
- package/packages/components/sh-water-mark/index.vue +96 -96
- package/packages/css/index.js +4 -4
- package/packages/directive/index.js +19 -19
- package/packages/directive/module/click-out.js +14 -14
- package/packages/directive/module/draggable.js +42 -42
- package/packages/directive/module/line-clamp.js +22 -22
- package/packages/directive/module/prevent-click.js +18 -18
- package/packages/directive/module/resize.js +14 -14
- package/packages/directive/module/ripple.js +166 -166
- package/packages/index.js +39 -39
- package/packages/mixin/index.js +86 -86
- package/packages/other/sh-cron-modal/components/cron-content.vue +294 -294
- package/packages/other/sh-cron-modal/index.vue +81 -81
- package/packages/other/sh-cron-modal/mixin/cron-emits.js +1 -1
- package/packages/other/sh-cron-modal/mixin/cron-props.js +9 -9
- package/packages/other/sh-cron-modal/tabs/cron-week-box.vue +126 -126
- package/packages/other/sh-menu/index.vue +326 -326
- package/packages/other/sh-menu/menu-group-content.vue +136 -136
- package/packages/other/sh-menu/menu-item-content.vue +71 -71
- package/packages/other/sh-menu-card/index.vue +250 -250
- package/packages/other/sh-menu-card/menu-box.vue +87 -87
- package/packages/other/sh-preview/components/sh-excel.vue +163 -163
- package/packages/other/sh-preview/js/data-hook.js +41 -41
- package/packages/other/sh-preview/js/data-props.js +15 -15
- package/packages/other/sh-system-tip/index.vue +115 -115
- package/packages/utils/resize.js +69 -70
- package/packages/utils/transfer-queue.js +12 -12
- package/packages/vxeTable/index.js +193 -184
- package/packages/vxeTable/plugins/export.js +450 -450
- package/packages/vxeTable/render/cell/vxe-render-img.vue +27 -27
- package/packages/vxeTable/render/cell/vxe-render-table.vue +51 -51
- package/packages/vxeTable/render/cell/vxe-render-time.vue +44 -44
- package/packages/vxeTable/render/cell/vxe-render-tree.vue +70 -70
- package/packages/vxeTable/render/filters/vxe-filter-input.vue +26 -26
- package/packages/vxeTable/render/filters/vxe-filter-time.vue +26 -26
- package/packages/vxeTable/render/globalRenders.jsx +514 -514
- package/packages/vxeTable/render/mixin/cell-hooks.js +198 -198
- package/packages/vxeTable/render/mixin/cell-props.js +23 -23
- package/packages/vxeTable/render/mixin/filter-hooks.js +46 -46
- package/tsconfig.json +25 -0
- package/types/component.d.ts +1 -0
- package/types/index.ts +0 -0
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="sh-image" :style="wrapStyles">
|
|
3
|
-
<div v-if="imageError" class="sh-image-place">
|
|
4
|
-
<slot name="error"><sh-icon type="font-img-error" :size="22" color="#999999"></sh-icon></slot>
|
|
5
|
-
</div>
|
|
6
|
-
<div v-else-if="imageloading" class="sh-image-place">
|
|
7
|
-
<slot name="placeholder"><sh-icon type="ios-image" :size="22"></sh-icon></slot>
|
|
8
|
-
</div>
|
|
9
|
-
<div v-else class="sh-image-inner">
|
|
10
|
-
<img class="sh-image-img" v-bind="imgConfig" @load="onImageLoad" @error="onImageError" />
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script>
|
|
16
|
-
import { defineComponent, computed, ref, watch } from 'vue'
|
|
17
|
-
export default defineComponent({
|
|
18
|
-
name: 'ShImage',
|
|
19
|
-
props: {
|
|
20
|
-
src: {
|
|
21
|
-
type: String,
|
|
22
|
-
default: ''
|
|
23
|
-
},
|
|
24
|
-
alt: {
|
|
25
|
-
type: String,
|
|
26
|
-
default: ''
|
|
27
|
-
},
|
|
28
|
-
preview: {
|
|
29
|
-
type: Boolean,
|
|
30
|
-
default: false
|
|
31
|
-
},
|
|
32
|
-
width: {
|
|
33
|
-
type: [String, Number],
|
|
34
|
-
default: ''
|
|
35
|
-
},
|
|
36
|
-
height: {
|
|
37
|
-
type: [String, Number],
|
|
38
|
-
default: ''
|
|
39
|
-
},
|
|
40
|
-
fit: {
|
|
41
|
-
type: String, // 'fill' | 'contain' | 'cover' | 'none' | 'scale-down'
|
|
42
|
-
default: ''
|
|
43
|
-
},
|
|
44
|
-
lazy: {
|
|
45
|
-
type: Boolean,
|
|
46
|
-
default: false
|
|
47
|
-
},
|
|
48
|
-
referrerPolicy: {
|
|
49
|
-
type: String,
|
|
50
|
-
default: 'no-referrer'
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
emits: ['update:modelValue', 'load', 'error'],
|
|
54
|
-
setup(props, context) {
|
|
55
|
-
const { emit } = context
|
|
56
|
-
const imageloading = ref(false)
|
|
57
|
-
const imageError = ref(false)
|
|
58
|
-
|
|
59
|
-
const wrapStyles = computed(() => {
|
|
60
|
-
return {
|
|
61
|
-
width: typeof props.width === 'number' ? `${props.width}px` : props.width,
|
|
62
|
-
height: typeof props.height === 'number' ? `${props.height}px` : props.height
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
const imgConfig = computed(() => {
|
|
66
|
-
const fitContains = ['fill', 'contain', 'cover', 'none', 'scale-down']
|
|
67
|
-
return {
|
|
68
|
-
alt: props.alt,
|
|
69
|
-
src: props.src,
|
|
70
|
-
referrerPolicy: props.referrerPolicy,
|
|
71
|
-
loading: props.lazy ? 'lazy' : 'eager',
|
|
72
|
-
style: fitContains.includes(props.fit) ? `object-fit:${props.fit};` : ''
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
const onImageLoad = () => {
|
|
77
|
-
imageloading.value = false
|
|
78
|
-
imageError.value = false
|
|
79
|
-
emit('load')
|
|
80
|
-
}
|
|
81
|
-
const onImageError = () => {
|
|
82
|
-
imageloading.value = false
|
|
83
|
-
imageError.value = true
|
|
84
|
-
emit('error')
|
|
85
|
-
}
|
|
86
|
-
const loadImage = () => {
|
|
87
|
-
imageloading.value = true
|
|
88
|
-
imageError.value = false
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
watch(
|
|
92
|
-
() => props.src,
|
|
93
|
-
() => {
|
|
94
|
-
loadImage()
|
|
95
|
-
}
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
return {
|
|
99
|
-
wrapStyles,
|
|
100
|
-
imageError,
|
|
101
|
-
imageloading,
|
|
102
|
-
imgConfig,
|
|
103
|
-
onImageLoad,
|
|
104
|
-
onImageError
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
})
|
|
108
|
-
</script>
|
|
109
|
-
|
|
110
|
-
<style scoped lang="scss">
|
|
111
|
-
.sh-image {
|
|
112
|
-
display: inline-block;
|
|
113
|
-
position: relative;
|
|
114
|
-
&-place {
|
|
115
|
-
display: flex;
|
|
116
|
-
align-items: center;
|
|
117
|
-
justify-content: center;
|
|
118
|
-
width: 100%;
|
|
119
|
-
height: 100%;
|
|
120
|
-
background-color: var(--vxe-table-header-background-color);
|
|
121
|
-
}
|
|
122
|
-
&-inner {
|
|
123
|
-
width: 100%;
|
|
124
|
-
height: 100%;
|
|
125
|
-
position: relative;
|
|
126
|
-
}
|
|
127
|
-
&-img {
|
|
128
|
-
width: 100%;
|
|
129
|
-
height: 100%;
|
|
130
|
-
vertical-align: middle;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sh-image" :style="wrapStyles">
|
|
3
|
+
<div v-if="imageError" class="sh-image-place">
|
|
4
|
+
<slot name="error"><sh-icon type="font-img-error" :size="22" color="#999999"></sh-icon></slot>
|
|
5
|
+
</div>
|
|
6
|
+
<div v-else-if="imageloading" class="sh-image-place">
|
|
7
|
+
<slot name="placeholder"><sh-icon type="ios-image" :size="22"></sh-icon></slot>
|
|
8
|
+
</div>
|
|
9
|
+
<div v-else class="sh-image-inner">
|
|
10
|
+
<img class="sh-image-img" v-bind="imgConfig" @load="onImageLoad" @error="onImageError" />
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
import { defineComponent, computed, ref, watch } from 'vue'
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: 'ShImage',
|
|
19
|
+
props: {
|
|
20
|
+
src: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: ''
|
|
23
|
+
},
|
|
24
|
+
alt: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: ''
|
|
27
|
+
},
|
|
28
|
+
preview: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
width: {
|
|
33
|
+
type: [String, Number],
|
|
34
|
+
default: ''
|
|
35
|
+
},
|
|
36
|
+
height: {
|
|
37
|
+
type: [String, Number],
|
|
38
|
+
default: ''
|
|
39
|
+
},
|
|
40
|
+
fit: {
|
|
41
|
+
type: String, // 'fill' | 'contain' | 'cover' | 'none' | 'scale-down'
|
|
42
|
+
default: ''
|
|
43
|
+
},
|
|
44
|
+
lazy: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
},
|
|
48
|
+
referrerPolicy: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: 'no-referrer'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
emits: ['update:modelValue', 'load', 'error'],
|
|
54
|
+
setup(props, context) {
|
|
55
|
+
const { emit } = context
|
|
56
|
+
const imageloading = ref(false)
|
|
57
|
+
const imageError = ref(false)
|
|
58
|
+
|
|
59
|
+
const wrapStyles = computed(() => {
|
|
60
|
+
return {
|
|
61
|
+
width: typeof props.width === 'number' ? `${props.width}px` : props.width,
|
|
62
|
+
height: typeof props.height === 'number' ? `${props.height}px` : props.height
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
const imgConfig = computed(() => {
|
|
66
|
+
const fitContains = ['fill', 'contain', 'cover', 'none', 'scale-down']
|
|
67
|
+
return {
|
|
68
|
+
alt: props.alt,
|
|
69
|
+
src: props.src,
|
|
70
|
+
referrerPolicy: props.referrerPolicy,
|
|
71
|
+
loading: props.lazy ? 'lazy' : 'eager',
|
|
72
|
+
style: fitContains.includes(props.fit) ? `object-fit:${props.fit};` : ''
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
const onImageLoad = () => {
|
|
77
|
+
imageloading.value = false
|
|
78
|
+
imageError.value = false
|
|
79
|
+
emit('load')
|
|
80
|
+
}
|
|
81
|
+
const onImageError = () => {
|
|
82
|
+
imageloading.value = false
|
|
83
|
+
imageError.value = true
|
|
84
|
+
emit('error')
|
|
85
|
+
}
|
|
86
|
+
const loadImage = () => {
|
|
87
|
+
imageloading.value = true
|
|
88
|
+
imageError.value = false
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
watch(
|
|
92
|
+
() => props.src,
|
|
93
|
+
() => {
|
|
94
|
+
loadImage()
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
wrapStyles,
|
|
100
|
+
imageError,
|
|
101
|
+
imageloading,
|
|
102
|
+
imgConfig,
|
|
103
|
+
onImageLoad,
|
|
104
|
+
onImageError
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<style scoped lang="scss">
|
|
111
|
+
.sh-image {
|
|
112
|
+
display: inline-block;
|
|
113
|
+
position: relative;
|
|
114
|
+
&-place {
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
justify-content: center;
|
|
118
|
+
width: 100%;
|
|
119
|
+
height: 100%;
|
|
120
|
+
background-color: var(--vxe-table-header-background-color);
|
|
121
|
+
}
|
|
122
|
+
&-inner {
|
|
123
|
+
width: 100%;
|
|
124
|
+
height: 100%;
|
|
125
|
+
position: relative;
|
|
126
|
+
}
|
|
127
|
+
&-img {
|
|
128
|
+
width: 100%;
|
|
129
|
+
height: 100%;
|
|
130
|
+
vertical-align: middle;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
</style>
|
|
@@ -1,146 +1,146 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="sh-list">
|
|
3
|
-
<template v-if="slots.header"><slot name="header"></slot></template>
|
|
4
|
-
<vxe-list ref="listRef" :class="{ grid }" v-bind="listConfig">
|
|
5
|
-
<template #default="{ items }">
|
|
6
|
-
<sh-empty v-if="items.length === 0 && !loading" :icon="emptyIcon" :content="emptyText"></sh-empty>
|
|
7
|
-
<template v-if="groupSize">
|
|
8
|
-
<sh-row v-for="(rows, rowsindex) in items" :key="rowsindex" class="sh-list-item" :gutter="grid.gutter" :margin="rowMargin">
|
|
9
|
-
<sh-col v-for="(col, colindex) in rows" :key="colindex" :class="itemClassName" v-bind="grid">
|
|
10
|
-
<slot v-if="slots.item" name="item" v-bind="col"></slot>
|
|
11
|
-
<div v-else :class="itemClassName">{{ col[labelField] }}</div>
|
|
12
|
-
</sh-col>
|
|
13
|
-
</sh-row>
|
|
14
|
-
</template>
|
|
15
|
-
<template v-else-if="grid">
|
|
16
|
-
<sh-row :gutter="grid.gutter" :margin="rowMargin">
|
|
17
|
-
<sh-col v-for="(item, itemindex) in items" :key="itemindex" class="sh-list-item" :class="itemClassName" v-bind="grid">
|
|
18
|
-
<slot v-if="slots.item" name="item" v-bind="item"></slot>
|
|
19
|
-
<div v-else :class="itemClassName">{{ item[labelField] }}</div>
|
|
20
|
-
</sh-col>
|
|
21
|
-
</sh-row>
|
|
22
|
-
</template>
|
|
23
|
-
<template v-else>
|
|
24
|
-
<template v-for="(item, itemindex) in items" :key="itemindex">
|
|
25
|
-
<div class="sh-list-item" :class="itemClassName">
|
|
26
|
-
<slot name="item" v-bind="item">{{ item[labelField] }}</slot>
|
|
27
|
-
</div>
|
|
28
|
-
</template>
|
|
29
|
-
</template>
|
|
30
|
-
</template>
|
|
31
|
-
</vxe-list>
|
|
32
|
-
<template v-if="slots.footer"><slot name="footer"></slot></template>
|
|
33
|
-
<vxe-pager v-if="pagerConfig" v-bind="listPagerConfig" :loading="loading" @page-change="onPageChange"></vxe-pager>
|
|
34
|
-
</div>
|
|
35
|
-
</template>
|
|
36
|
-
|
|
37
|
-
<script>
|
|
38
|
-
import { defineComponent, ref, getCurrentInstance, computed } from 'vue'
|
|
39
|
-
export default defineComponent({
|
|
40
|
-
name: 'ShList',
|
|
41
|
-
props: {
|
|
42
|
-
dataSourse: {
|
|
43
|
-
type: Array,
|
|
44
|
-
default() {
|
|
45
|
-
return []
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
size: {
|
|
49
|
-
type: String
|
|
50
|
-
},
|
|
51
|
-
className: {
|
|
52
|
-
type: String
|
|
53
|
-
},
|
|
54
|
-
itemClassName: {
|
|
55
|
-
type: String
|
|
56
|
-
},
|
|
57
|
-
loading: {
|
|
58
|
-
type: Boolean
|
|
59
|
-
},
|
|
60
|
-
height: {
|
|
61
|
-
type: [String, Number],
|
|
62
|
-
default: 'auto'
|
|
63
|
-
},
|
|
64
|
-
autoResize: {
|
|
65
|
-
type: Boolean
|
|
66
|
-
},
|
|
67
|
-
syncResize: {
|
|
68
|
-
type: [Boolean, String, Number]
|
|
69
|
-
},
|
|
70
|
-
scrollY: {
|
|
71
|
-
type: [Boolean, Object],
|
|
72
|
-
default() {
|
|
73
|
-
return { enabled: true, gt: 30 }
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
pagerConfig: {
|
|
77
|
-
type: [Object, Boolean],
|
|
78
|
-
default: false
|
|
79
|
-
},
|
|
80
|
-
emptyIcon: {
|
|
81
|
-
type: String
|
|
82
|
-
},
|
|
83
|
-
emptyText: {
|
|
84
|
-
type: String
|
|
85
|
-
},
|
|
86
|
-
grid: {
|
|
87
|
-
type: [Object, Boolean],
|
|
88
|
-
default: false
|
|
89
|
-
},
|
|
90
|
-
labelField: {
|
|
91
|
-
type: String,
|
|
92
|
-
default: 'label'
|
|
93
|
-
},
|
|
94
|
-
rowMargin: {
|
|
95
|
-
type: Boolean
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
emits: ['page-change'],
|
|
99
|
-
setup(props, context) {
|
|
100
|
-
const vm = getCurrentInstance()
|
|
101
|
-
const { $vUtils } = vm.proxy
|
|
102
|
-
const { emit, slots } = context
|
|
103
|
-
const listRef = ref()
|
|
104
|
-
|
|
105
|
-
const groupSize = computed(() => {
|
|
106
|
-
return props.grid && +props.grid.span > 0 && +props.grid.span < 24 ? 24 / props.grid.span : 0
|
|
107
|
-
})
|
|
108
|
-
const listConfig = computed(() => {
|
|
109
|
-
return {
|
|
110
|
-
data: groupSize.value ? $vUtils.chunk($vUtils.clone(props.dataSourse, true), groupSize.value) : props.dataSourse,
|
|
111
|
-
size: props.size,
|
|
112
|
-
className: props.className,
|
|
113
|
-
loading: props.loading,
|
|
114
|
-
height: props.height,
|
|
115
|
-
autoResize: props.autoResize,
|
|
116
|
-
syncResize: props.syncResize,
|
|
117
|
-
scrollY: Object.assign({ sItem: 'sh-list-item' }, props.scrollY)
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
const listPagerConfig = computed(() => {
|
|
121
|
-
return Object.assign({ enabled: Boolean(props.pagerConfig), total: 0 }, props.pagerConfig)
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
// 分页变化触发
|
|
125
|
-
const onPageChange = data => {
|
|
126
|
-
emit('page-change', data)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return {
|
|
130
|
-
listRef,
|
|
131
|
-
slots,
|
|
132
|
-
groupSize,
|
|
133
|
-
listConfig,
|
|
134
|
-
listPagerConfig,
|
|
135
|
-
onPageChange
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
})
|
|
139
|
-
</script>
|
|
140
|
-
|
|
141
|
-
<style lang="scss" scoped>
|
|
142
|
-
.sh-list {
|
|
143
|
-
position: relative;
|
|
144
|
-
width: 100%;
|
|
145
|
-
}
|
|
146
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sh-list">
|
|
3
|
+
<template v-if="slots.header"><slot name="header"></slot></template>
|
|
4
|
+
<vxe-list ref="listRef" :class="{ grid }" v-bind="listConfig">
|
|
5
|
+
<template #default="{ items }">
|
|
6
|
+
<sh-empty v-if="items.length === 0 && !loading" :icon="emptyIcon" :content="emptyText"></sh-empty>
|
|
7
|
+
<template v-if="groupSize">
|
|
8
|
+
<sh-row v-for="(rows, rowsindex) in items" :key="rowsindex" class="sh-list-item" :gutter="grid.gutter" :margin="rowMargin">
|
|
9
|
+
<sh-col v-for="(col, colindex) in rows" :key="colindex" :class="itemClassName" v-bind="grid">
|
|
10
|
+
<slot v-if="slots.item" name="item" v-bind="col"></slot>
|
|
11
|
+
<div v-else :class="itemClassName">{{ col[labelField] }}</div>
|
|
12
|
+
</sh-col>
|
|
13
|
+
</sh-row>
|
|
14
|
+
</template>
|
|
15
|
+
<template v-else-if="grid">
|
|
16
|
+
<sh-row :gutter="grid.gutter" :margin="rowMargin">
|
|
17
|
+
<sh-col v-for="(item, itemindex) in items" :key="itemindex" class="sh-list-item" :class="itemClassName" v-bind="grid">
|
|
18
|
+
<slot v-if="slots.item" name="item" v-bind="item"></slot>
|
|
19
|
+
<div v-else :class="itemClassName">{{ item[labelField] }}</div>
|
|
20
|
+
</sh-col>
|
|
21
|
+
</sh-row>
|
|
22
|
+
</template>
|
|
23
|
+
<template v-else>
|
|
24
|
+
<template v-for="(item, itemindex) in items" :key="itemindex">
|
|
25
|
+
<div class="sh-list-item" :class="itemClassName">
|
|
26
|
+
<slot name="item" v-bind="item">{{ item[labelField] }}</slot>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
</template>
|
|
30
|
+
</template>
|
|
31
|
+
</vxe-list>
|
|
32
|
+
<template v-if="slots.footer"><slot name="footer"></slot></template>
|
|
33
|
+
<vxe-pager v-if="pagerConfig" v-bind="listPagerConfig" :loading="loading" @page-change="onPageChange"></vxe-pager>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
import { defineComponent, ref, getCurrentInstance, computed } from 'vue'
|
|
39
|
+
export default defineComponent({
|
|
40
|
+
name: 'ShList',
|
|
41
|
+
props: {
|
|
42
|
+
dataSourse: {
|
|
43
|
+
type: Array,
|
|
44
|
+
default() {
|
|
45
|
+
return []
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
size: {
|
|
49
|
+
type: String
|
|
50
|
+
},
|
|
51
|
+
className: {
|
|
52
|
+
type: String
|
|
53
|
+
},
|
|
54
|
+
itemClassName: {
|
|
55
|
+
type: String
|
|
56
|
+
},
|
|
57
|
+
loading: {
|
|
58
|
+
type: Boolean
|
|
59
|
+
},
|
|
60
|
+
height: {
|
|
61
|
+
type: [String, Number],
|
|
62
|
+
default: 'auto'
|
|
63
|
+
},
|
|
64
|
+
autoResize: {
|
|
65
|
+
type: Boolean
|
|
66
|
+
},
|
|
67
|
+
syncResize: {
|
|
68
|
+
type: [Boolean, String, Number]
|
|
69
|
+
},
|
|
70
|
+
scrollY: {
|
|
71
|
+
type: [Boolean, Object],
|
|
72
|
+
default() {
|
|
73
|
+
return { enabled: true, gt: 30 }
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
pagerConfig: {
|
|
77
|
+
type: [Object, Boolean],
|
|
78
|
+
default: false
|
|
79
|
+
},
|
|
80
|
+
emptyIcon: {
|
|
81
|
+
type: String
|
|
82
|
+
},
|
|
83
|
+
emptyText: {
|
|
84
|
+
type: String
|
|
85
|
+
},
|
|
86
|
+
grid: {
|
|
87
|
+
type: [Object, Boolean],
|
|
88
|
+
default: false
|
|
89
|
+
},
|
|
90
|
+
labelField: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: 'label'
|
|
93
|
+
},
|
|
94
|
+
rowMargin: {
|
|
95
|
+
type: Boolean
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
emits: ['page-change'],
|
|
99
|
+
setup(props, context) {
|
|
100
|
+
const vm = getCurrentInstance()
|
|
101
|
+
const { $vUtils } = vm.proxy
|
|
102
|
+
const { emit, slots } = context
|
|
103
|
+
const listRef = ref()
|
|
104
|
+
|
|
105
|
+
const groupSize = computed(() => {
|
|
106
|
+
return props.grid && +props.grid.span > 0 && +props.grid.span < 24 ? 24 / props.grid.span : 0
|
|
107
|
+
})
|
|
108
|
+
const listConfig = computed(() => {
|
|
109
|
+
return {
|
|
110
|
+
data: groupSize.value ? $vUtils.chunk($vUtils.clone(props.dataSourse, true), groupSize.value) : props.dataSourse,
|
|
111
|
+
size: props.size,
|
|
112
|
+
className: props.className,
|
|
113
|
+
loading: props.loading,
|
|
114
|
+
height: props.height,
|
|
115
|
+
autoResize: props.autoResize,
|
|
116
|
+
syncResize: props.syncResize,
|
|
117
|
+
scrollY: Object.assign({ sItem: 'sh-list-item' }, props.scrollY)
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
const listPagerConfig = computed(() => {
|
|
121
|
+
return Object.assign({ enabled: Boolean(props.pagerConfig), total: 0 }, props.pagerConfig)
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
// 分页变化触发
|
|
125
|
+
const onPageChange = data => {
|
|
126
|
+
emit('page-change', data)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
listRef,
|
|
131
|
+
slots,
|
|
132
|
+
groupSize,
|
|
133
|
+
listConfig,
|
|
134
|
+
listPagerConfig,
|
|
135
|
+
onPageChange
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
</script>
|
|
140
|
+
|
|
141
|
+
<style lang="scss" scoped>
|
|
142
|
+
.sh-list {
|
|
143
|
+
position: relative;
|
|
144
|
+
width: 100%;
|
|
145
|
+
}
|
|
146
|
+
</style>
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div v-if="loading" class="sh-loading" :class="{ 'sh-loading-fix': fix }">
|
|
3
|
-
<div class="loading" :class="`loading${loadingType}`"></div>
|
|
4
|
-
<div v-if="content" class="loadtext">{{ content }}</div>
|
|
5
|
-
</div>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script>
|
|
9
|
-
import { defineComponent, computed } from 'vue'
|
|
10
|
-
export default defineComponent({
|
|
11
|
-
name: 'ShLoading',
|
|
12
|
-
props: {
|
|
13
|
-
type: {
|
|
14
|
-
type: String,
|
|
15
|
-
default: '12'
|
|
16
|
-
},
|
|
17
|
-
loading: Boolean,
|
|
18
|
-
fix: Boolean,
|
|
19
|
-
content: {
|
|
20
|
-
type: [String, Number],
|
|
21
|
-
default: '加载中'
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
setup(props, context) {
|
|
25
|
-
const loadingType = computed(() => {
|
|
26
|
-
return !props.type || props.type > 23 || props.type < 0 ? '12' : props.type
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
loadingType
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
<style scoped lang="scss">
|
|
37
|
-
.sh-loading {
|
|
38
|
-
position: relative;
|
|
39
|
-
z-index: 999;
|
|
40
|
-
background: rgba(255, 255, 255, 0.5);
|
|
41
|
-
padding: 0.5em;
|
|
42
|
-
&-fix {
|
|
43
|
-
position: absolute;
|
|
44
|
-
top: 0;
|
|
45
|
-
bottom: 0;
|
|
46
|
-
left: 0;
|
|
47
|
-
right: 0;
|
|
48
|
-
}
|
|
49
|
-
.loadtext {
|
|
50
|
-
color: var(--vxe-primary-color);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="loading" class="sh-loading" :class="{ 'sh-loading-fix': fix }">
|
|
3
|
+
<div class="loading" :class="`loading${loadingType}`"></div>
|
|
4
|
+
<div v-if="content" class="loadtext">{{ content }}</div>
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import { defineComponent, computed } from 'vue'
|
|
10
|
+
export default defineComponent({
|
|
11
|
+
name: 'ShLoading',
|
|
12
|
+
props: {
|
|
13
|
+
type: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: '12'
|
|
16
|
+
},
|
|
17
|
+
loading: Boolean,
|
|
18
|
+
fix: Boolean,
|
|
19
|
+
content: {
|
|
20
|
+
type: [String, Number],
|
|
21
|
+
default: '加载中'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
setup(props, context) {
|
|
25
|
+
const loadingType = computed(() => {
|
|
26
|
+
return !props.type || props.type > 23 || props.type < 0 ? '12' : props.type
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
loadingType
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<style scoped lang="scss">
|
|
37
|
+
.sh-loading {
|
|
38
|
+
position: relative;
|
|
39
|
+
z-index: 999;
|
|
40
|
+
background: rgba(255, 255, 255, 0.5);
|
|
41
|
+
padding: 0.5em;
|
|
42
|
+
&-fix {
|
|
43
|
+
position: absolute;
|
|
44
|
+
top: 0;
|
|
45
|
+
bottom: 0;
|
|
46
|
+
left: 0;
|
|
47
|
+
right: 0;
|
|
48
|
+
}
|
|
49
|
+
.loadtext {
|
|
50
|
+
color: var(--vxe-primary-color);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
</style>
|