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,80 +1,80 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
v-masonry
|
|
4
|
-
class="sh-waterfall"
|
|
5
|
-
:transition-duration="duration"
|
|
6
|
-
:item-selector="selector"
|
|
7
|
-
:origin-left="originLeft"
|
|
8
|
-
:origin-top="originTop"
|
|
9
|
-
:fit-width="fitWidth"
|
|
10
|
-
:stamp="stamp"
|
|
11
|
-
:gutter="gutter"
|
|
12
|
-
:horizontal-order="horizontalOrder">
|
|
13
|
-
<div v-for="(item, itemindex) in dataSourse" :key="itemindex" v-masonry-tile class="sh-water-item" :class="itemClassName">
|
|
14
|
-
<slot name="item" :item="item" :index="itemindex"></slot>
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script>
|
|
20
|
-
import { defineComponent, computed, getCurrentInstance, ref, watch, onBeforeMount } from 'vue'
|
|
21
|
-
export default defineComponent({
|
|
22
|
-
name: 'ShWaterFall',
|
|
23
|
-
props: {
|
|
24
|
-
id: {
|
|
25
|
-
type: String,
|
|
26
|
-
default: 'containerId'
|
|
27
|
-
},
|
|
28
|
-
dataSourse: {
|
|
29
|
-
type: Array,
|
|
30
|
-
default() {
|
|
31
|
-
return []
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
itemClassName: {
|
|
35
|
-
type: String
|
|
36
|
-
},
|
|
37
|
-
duration: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: '0.3s'
|
|
40
|
-
},
|
|
41
|
-
selector: {
|
|
42
|
-
type: String,
|
|
43
|
-
default: '.sh-water-item'
|
|
44
|
-
},
|
|
45
|
-
fitWidth: {
|
|
46
|
-
type: Boolean,
|
|
47
|
-
default: false
|
|
48
|
-
},
|
|
49
|
-
originLeft: {
|
|
50
|
-
type: Boolean,
|
|
51
|
-
default: true
|
|
52
|
-
},
|
|
53
|
-
originTop: {
|
|
54
|
-
type: Boolean,
|
|
55
|
-
default: true
|
|
56
|
-
},
|
|
57
|
-
horizontalOrder: {
|
|
58
|
-
type: Boolean,
|
|
59
|
-
default: true
|
|
60
|
-
},
|
|
61
|
-
stamp: {
|
|
62
|
-
type: String,
|
|
63
|
-
default: ''
|
|
64
|
-
},
|
|
65
|
-
gutter: {
|
|
66
|
-
type: [String, Number],
|
|
67
|
-
default: 10
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
})
|
|
71
|
-
</script>
|
|
72
|
-
|
|
73
|
-
<style lang="scss" scoped>
|
|
74
|
-
.sh-waterfall {
|
|
75
|
-
width: 100%;
|
|
76
|
-
margin: auto;
|
|
77
|
-
.sh-list-item {
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
v-masonry
|
|
4
|
+
class="sh-waterfall"
|
|
5
|
+
:transition-duration="duration"
|
|
6
|
+
:item-selector="selector"
|
|
7
|
+
:origin-left="originLeft"
|
|
8
|
+
:origin-top="originTop"
|
|
9
|
+
:fit-width="fitWidth"
|
|
10
|
+
:stamp="stamp"
|
|
11
|
+
:gutter="gutter"
|
|
12
|
+
:horizontal-order="horizontalOrder">
|
|
13
|
+
<div v-for="(item, itemindex) in dataSourse" :key="itemindex" v-masonry-tile class="sh-water-item" :class="itemClassName">
|
|
14
|
+
<slot name="item" :item="item" :index="itemindex"></slot>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import { defineComponent, computed, getCurrentInstance, ref, watch, onBeforeMount } from 'vue'
|
|
21
|
+
export default defineComponent({
|
|
22
|
+
name: 'ShWaterFall',
|
|
23
|
+
props: {
|
|
24
|
+
id: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: 'containerId'
|
|
27
|
+
},
|
|
28
|
+
dataSourse: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default() {
|
|
31
|
+
return []
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
itemClassName: {
|
|
35
|
+
type: String
|
|
36
|
+
},
|
|
37
|
+
duration: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: '0.3s'
|
|
40
|
+
},
|
|
41
|
+
selector: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '.sh-water-item'
|
|
44
|
+
},
|
|
45
|
+
fitWidth: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
originLeft: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: true
|
|
52
|
+
},
|
|
53
|
+
originTop: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: true
|
|
56
|
+
},
|
|
57
|
+
horizontalOrder: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: true
|
|
60
|
+
},
|
|
61
|
+
stamp: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: ''
|
|
64
|
+
},
|
|
65
|
+
gutter: {
|
|
66
|
+
type: [String, Number],
|
|
67
|
+
default: 10
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<style lang="scss" scoped>
|
|
74
|
+
.sh-waterfall {
|
|
75
|
+
width: 100%;
|
|
76
|
+
margin: auto;
|
|
77
|
+
.sh-list-item {
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="rootRef" class="sh-water-mark">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
import { defineComponent, computed, getCurrentInstance, ref, watch, onMounted } from 'vue'
|
|
9
|
-
export default defineComponent({
|
|
10
|
-
name: 'ShWaterMark',
|
|
11
|
-
props: {
|
|
12
|
-
content: String,
|
|
13
|
-
font: {
|
|
14
|
-
type: String,
|
|
15
|
-
default: '1.5em Arial'
|
|
16
|
-
},
|
|
17
|
-
color: {
|
|
18
|
-
type: String,
|
|
19
|
-
default: 'rgba(0,0,0,0.4)'
|
|
20
|
-
},
|
|
21
|
-
rotate: {
|
|
22
|
-
type: Number,
|
|
23
|
-
default: -45
|
|
24
|
-
},
|
|
25
|
-
height: {
|
|
26
|
-
type: Number,
|
|
27
|
-
default: 150
|
|
28
|
-
},
|
|
29
|
-
width: {
|
|
30
|
-
type: Number,
|
|
31
|
-
default: 150
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
setup(props, context) {
|
|
35
|
-
const { proxy } = getCurrentInstance()
|
|
36
|
-
const { $vUtils } = proxy
|
|
37
|
-
const { emit, slots } = context
|
|
38
|
-
|
|
39
|
-
const rootRef = ref()
|
|
40
|
-
let content = null
|
|
41
|
-
|
|
42
|
-
const initWaterMark = () => {
|
|
43
|
-
if (!rootRef.value) return
|
|
44
|
-
const parentElement = rootRef.value
|
|
45
|
-
const watermarkCanvas = document.createElement('canvas')
|
|
46
|
-
watermarkCanvas.setAttribute('width', `${props.width}`)
|
|
47
|
-
watermarkCanvas.setAttribute('height', `${props.height}`)
|
|
48
|
-
const ctx = watermarkCanvas.getContext('2d')
|
|
49
|
-
ctx.font = `${props.font}`
|
|
50
|
-
ctx.fillStyle = props.color
|
|
51
|
-
ctx.textAlign = 'center'
|
|
52
|
-
ctx.translate(props.width / 2, props.height / 2)
|
|
53
|
-
ctx.rotate((Math.PI / 180) * props.rotate)
|
|
54
|
-
ctx.fillText(props.content, 0, 0)
|
|
55
|
-
const base64Url = watermarkCanvas.toDataURL()
|
|
56
|
-
if (content) content.remove()
|
|
57
|
-
content = document.createElement('div')
|
|
58
|
-
const styles = `position: absolute;
|
|
59
|
-
pointer-events: none;
|
|
60
|
-
z-index: 9999;
|
|
61
|
-
inset: 0;
|
|
62
|
-
mix-blend-mode: multiply;
|
|
63
|
-
background-repeat:repeat;
|
|
64
|
-
background-size: ${props.width}px, ${props.height}px;
|
|
65
|
-
background-image:url('${base64Url}');
|
|
66
|
-
`
|
|
67
|
-
content.setAttribute('style', styles)
|
|
68
|
-
content.classList.add('sh-watermark-box')
|
|
69
|
-
parentElement.appendChild(content)
|
|
70
|
-
const observer = new MutationObserver(() => {
|
|
71
|
-
const wortmarkBox = parentElement.querySelector('.sh-watermark-box')
|
|
72
|
-
if (!wortmarkBox) {
|
|
73
|
-
parentElement.appendChild(content)
|
|
74
|
-
} else if (wortmarkBox.getAttribute('style') !== styles) {
|
|
75
|
-
wortmarkBox.setAttribute('style', styles)
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
observer.observe(parentElement, { attributes: true, subtree: true, childList: true })
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
onMounted(() => {
|
|
82
|
-
initWaterMark()
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
rootRef
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
</script>
|
|
91
|
-
|
|
92
|
-
<style scoped lang="scss">
|
|
93
|
-
.sh-water-mark {
|
|
94
|
-
position: relative;
|
|
95
|
-
}
|
|
96
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="rootRef" class="sh-water-mark">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import { defineComponent, computed, getCurrentInstance, ref, watch, onMounted } from 'vue'
|
|
9
|
+
export default defineComponent({
|
|
10
|
+
name: 'ShWaterMark',
|
|
11
|
+
props: {
|
|
12
|
+
content: String,
|
|
13
|
+
font: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: '1.5em Arial'
|
|
16
|
+
},
|
|
17
|
+
color: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: 'rgba(0,0,0,0.4)'
|
|
20
|
+
},
|
|
21
|
+
rotate: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default: -45
|
|
24
|
+
},
|
|
25
|
+
height: {
|
|
26
|
+
type: Number,
|
|
27
|
+
default: 150
|
|
28
|
+
},
|
|
29
|
+
width: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 150
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
setup(props, context) {
|
|
35
|
+
const { proxy } = getCurrentInstance()
|
|
36
|
+
const { $vUtils } = proxy
|
|
37
|
+
const { emit, slots } = context
|
|
38
|
+
|
|
39
|
+
const rootRef = ref()
|
|
40
|
+
let content = null
|
|
41
|
+
|
|
42
|
+
const initWaterMark = () => {
|
|
43
|
+
if (!rootRef.value) return
|
|
44
|
+
const parentElement = rootRef.value
|
|
45
|
+
const watermarkCanvas = document.createElement('canvas')
|
|
46
|
+
watermarkCanvas.setAttribute('width', `${props.width}`)
|
|
47
|
+
watermarkCanvas.setAttribute('height', `${props.height}`)
|
|
48
|
+
const ctx = watermarkCanvas.getContext('2d')
|
|
49
|
+
ctx.font = `${props.font}`
|
|
50
|
+
ctx.fillStyle = props.color
|
|
51
|
+
ctx.textAlign = 'center'
|
|
52
|
+
ctx.translate(props.width / 2, props.height / 2)
|
|
53
|
+
ctx.rotate((Math.PI / 180) * props.rotate)
|
|
54
|
+
ctx.fillText(props.content, 0, 0)
|
|
55
|
+
const base64Url = watermarkCanvas.toDataURL()
|
|
56
|
+
if (content) content.remove()
|
|
57
|
+
content = document.createElement('div')
|
|
58
|
+
const styles = `position: absolute;
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
z-index: 9999;
|
|
61
|
+
inset: 0;
|
|
62
|
+
mix-blend-mode: multiply;
|
|
63
|
+
background-repeat:repeat;
|
|
64
|
+
background-size: ${props.width}px, ${props.height}px;
|
|
65
|
+
background-image:url('${base64Url}');
|
|
66
|
+
`
|
|
67
|
+
content.setAttribute('style', styles)
|
|
68
|
+
content.classList.add('sh-watermark-box')
|
|
69
|
+
parentElement.appendChild(content)
|
|
70
|
+
const observer = new MutationObserver(() => {
|
|
71
|
+
const wortmarkBox = parentElement.querySelector('.sh-watermark-box')
|
|
72
|
+
if (!wortmarkBox) {
|
|
73
|
+
parentElement.appendChild(content)
|
|
74
|
+
} else if (wortmarkBox.getAttribute('style') !== styles) {
|
|
75
|
+
wortmarkBox.setAttribute('style', styles)
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
observer.observe(parentElement, { attributes: true, subtree: true, childList: true })
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
onMounted(() => {
|
|
82
|
+
initWaterMark()
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
rootRef
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<style scoped lang="scss">
|
|
93
|
+
.sh-water-mark {
|
|
94
|
+
position: relative;
|
|
95
|
+
}
|
|
96
|
+
</style>
|
package/packages/css/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './theme.scss'
|
|
2
|
-
import './loader.scss'
|
|
3
|
-
import './main.scss'
|
|
4
|
-
import './animated.scss'
|
|
1
|
+
import './theme.scss'
|
|
2
|
+
import './loader.scss'
|
|
3
|
+
import './main.scss'
|
|
4
|
+
import './animated.scss'
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import draggable from './module/draggable'
|
|
2
|
-
import resize from './module/resize'
|
|
3
|
-
import lineClamp from './module/line-clamp'
|
|
4
|
-
import preventClick from './module/prevent-click'
|
|
5
|
-
import clickOut from './module/click-out'
|
|
6
|
-
import ripple from './module/ripple'
|
|
7
|
-
|
|
8
|
-
const index = {
|
|
9
|
-
install(Vue) {
|
|
10
|
-
Vue.directive('draggable', draggable)
|
|
11
|
-
Vue.directive('resize', resize)
|
|
12
|
-
Vue.directive('lineClamp', lineClamp)
|
|
13
|
-
Vue.directive('debounce', preventClick)
|
|
14
|
-
Vue.directive('clickout', clickOut)
|
|
15
|
-
Vue.directive('ripple', ripple)
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default index
|
|
1
|
+
import draggable from './module/draggable'
|
|
2
|
+
import resize from './module/resize'
|
|
3
|
+
import lineClamp from './module/line-clamp'
|
|
4
|
+
import preventClick from './module/prevent-click'
|
|
5
|
+
import clickOut from './module/click-out'
|
|
6
|
+
import ripple from './module/ripple'
|
|
7
|
+
|
|
8
|
+
const index = {
|
|
9
|
+
install(Vue) {
|
|
10
|
+
Vue.directive('draggable', draggable)
|
|
11
|
+
Vue.directive('resize', resize)
|
|
12
|
+
Vue.directive('lineClamp', lineClamp)
|
|
13
|
+
Vue.directive('debounce', preventClick)
|
|
14
|
+
Vue.directive('clickout', clickOut)
|
|
15
|
+
Vue.directive('ripple', ripple)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default index
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
beforeMount(el, binding, vnode) {
|
|
3
|
-
function clickHandler(e) {
|
|
4
|
-
if (el.contains(e.target)) return false
|
|
5
|
-
binding.value(e)
|
|
6
|
-
}
|
|
7
|
-
el.__vueClickOutside__ = clickHandler
|
|
8
|
-
document.addEventListener('click', clickHandler)
|
|
9
|
-
},
|
|
10
|
-
unmounted(el, binding) {
|
|
11
|
-
document.removeEventListener('click', el.__vueClickOutside__)
|
|
12
|
-
delete el.__vueClickOutside__
|
|
13
|
-
}
|
|
14
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
beforeMount(el, binding, vnode) {
|
|
3
|
+
function clickHandler(e) {
|
|
4
|
+
if (el.contains(e.target)) return false
|
|
5
|
+
binding.value(e)
|
|
6
|
+
}
|
|
7
|
+
el.__vueClickOutside__ = clickHandler
|
|
8
|
+
document.addEventListener('click', clickHandler)
|
|
9
|
+
},
|
|
10
|
+
unmounted(el, binding) {
|
|
11
|
+
document.removeEventListener('click', el.__vueClickOutside__)
|
|
12
|
+
delete el.__vueClickOutside__
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { utils } from 'sh-tools'
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
mounted: (el, binding, vnode) => {
|
|
5
|
-
let triggerDom = document.querySelector(binding.value.trigger)
|
|
6
|
-
triggerDom.style.cursor = 'move'
|
|
7
|
-
let bodyDom = document.querySelector(binding.value.body)
|
|
8
|
-
let pageX = 0
|
|
9
|
-
let pageY = 0
|
|
10
|
-
let transformX = 0
|
|
11
|
-
let transformY = 0
|
|
12
|
-
let canMove = false
|
|
13
|
-
const handleMousedown = e => {
|
|
14
|
-
let transform = /\(.*\)/.exec(bodyDom.style.transform)
|
|
15
|
-
if (transform) {
|
|
16
|
-
transform = transform[0].slice(1, transform[0].length - 1)
|
|
17
|
-
let splitxy = transform.split('px, ')
|
|
18
|
-
transformX = parseFloat(splitxy[0])
|
|
19
|
-
transformY = parseFloat(splitxy[1].split('px')[0])
|
|
20
|
-
}
|
|
21
|
-
pageX = e.pageX
|
|
22
|
-
pageY = e.pageY
|
|
23
|
-
canMove = true
|
|
24
|
-
}
|
|
25
|
-
const handleMousemove = e => {
|
|
26
|
-
let xOffset = e.pageX - pageX + transformX
|
|
27
|
-
let yOffset = e.pageY - pageY + transformY
|
|
28
|
-
if (canMove) bodyDom.style.transform = `translate(${xOffset}px, ${yOffset}px)`
|
|
29
|
-
}
|
|
30
|
-
const handleMouseup = e => {
|
|
31
|
-
canMove = false
|
|
32
|
-
}
|
|
33
|
-
utils.on(triggerDom, 'mousedown', handleMousedown)
|
|
34
|
-
utils.on(document, 'mousemove', handleMousemove)
|
|
35
|
-
utils.on(document, 'mouseup', handleMouseup)
|
|
36
|
-
},
|
|
37
|
-
updated: (el, binding, vnode) => {
|
|
38
|
-
if (!binding.value.recover) return
|
|
39
|
-
let bodyDom = document.querySelector(binding.value.body)
|
|
40
|
-
bodyDom.style.transform = ''
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
import { utils } from 'sh-tools'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
mounted: (el, binding, vnode) => {
|
|
5
|
+
let triggerDom = document.querySelector(binding.value.trigger)
|
|
6
|
+
triggerDom.style.cursor = 'move'
|
|
7
|
+
let bodyDom = document.querySelector(binding.value.body)
|
|
8
|
+
let pageX = 0
|
|
9
|
+
let pageY = 0
|
|
10
|
+
let transformX = 0
|
|
11
|
+
let transformY = 0
|
|
12
|
+
let canMove = false
|
|
13
|
+
const handleMousedown = e => {
|
|
14
|
+
let transform = /\(.*\)/.exec(bodyDom.style.transform)
|
|
15
|
+
if (transform) {
|
|
16
|
+
transform = transform[0].slice(1, transform[0].length - 1)
|
|
17
|
+
let splitxy = transform.split('px, ')
|
|
18
|
+
transformX = parseFloat(splitxy[0])
|
|
19
|
+
transformY = parseFloat(splitxy[1].split('px')[0])
|
|
20
|
+
}
|
|
21
|
+
pageX = e.pageX
|
|
22
|
+
pageY = e.pageY
|
|
23
|
+
canMove = true
|
|
24
|
+
}
|
|
25
|
+
const handleMousemove = e => {
|
|
26
|
+
let xOffset = e.pageX - pageX + transformX
|
|
27
|
+
let yOffset = e.pageY - pageY + transformY
|
|
28
|
+
if (canMove) bodyDom.style.transform = `translate(${xOffset}px, ${yOffset}px)`
|
|
29
|
+
}
|
|
30
|
+
const handleMouseup = e => {
|
|
31
|
+
canMove = false
|
|
32
|
+
}
|
|
33
|
+
utils.on(triggerDom, 'mousedown', handleMousedown)
|
|
34
|
+
utils.on(document, 'mousemove', handleMousemove)
|
|
35
|
+
utils.on(document, 'mouseup', handleMouseup)
|
|
36
|
+
},
|
|
37
|
+
updated: (el, binding, vnode) => {
|
|
38
|
+
if (!binding.value.recover) return
|
|
39
|
+
let bodyDom = document.querySelector(binding.value.body)
|
|
40
|
+
bodyDom.style.transform = ''
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 限制文本最多显示几行,以...结束,仅适用于 webkit 内核浏览器
|
|
3
|
-
* */
|
|
4
|
-
import { utils } from 'sh-tools'
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
mounted(el, binding) {
|
|
8
|
-
if (binding.value) {
|
|
9
|
-
utils.addClass(el, 'sh-line-clamp')
|
|
10
|
-
el.style['-webkit-line-clamp'] = binding.value
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
updated(el, binding) {
|
|
14
|
-
if (binding.value) {
|
|
15
|
-
el.style['-webkit-line-clamp'] = binding.value
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
unmounted(el) {
|
|
19
|
-
utils.removeClass(el, 'sh-line-clamp')
|
|
20
|
-
el.style['-webkit-line-clamp'] = null
|
|
21
|
-
}
|
|
22
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 限制文本最多显示几行,以...结束,仅适用于 webkit 内核浏览器
|
|
3
|
+
* */
|
|
4
|
+
import { utils } from 'sh-tools'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
mounted(el, binding) {
|
|
8
|
+
if (binding.value) {
|
|
9
|
+
utils.addClass(el, 'sh-line-clamp')
|
|
10
|
+
el.style['-webkit-line-clamp'] = binding.value
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
updated(el, binding) {
|
|
14
|
+
if (binding.value) {
|
|
15
|
+
el.style['-webkit-line-clamp'] = binding.value
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
unmounted(el) {
|
|
19
|
+
utils.removeClass(el, 'sh-line-clamp')
|
|
20
|
+
el.style['-webkit-line-clamp'] = null
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { utils } from 'sh-tools'
|
|
2
|
-
|
|
3
|
-
let preventClass = 'sh-prevent--disabled'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
mounted(el, binding) {
|
|
7
|
-
el.addEventListener('click', () => {
|
|
8
|
-
if (!el.disabled) {
|
|
9
|
-
el.disabled = true
|
|
10
|
-
if (!utils.hasClass(el, preventClass)) utils.addClass(el, preventClass)
|
|
11
|
-
setTimeout(() => {
|
|
12
|
-
el.disabled = false
|
|
13
|
-
if (utils.hasClass(el, preventClass)) utils.removeClass(el, preventClass)
|
|
14
|
-
}, binding.value || 1500)
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
import { utils } from 'sh-tools'
|
|
2
|
+
|
|
3
|
+
let preventClass = 'sh-prevent--disabled'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
mounted(el, binding) {
|
|
7
|
+
el.addEventListener('click', () => {
|
|
8
|
+
if (!el.disabled) {
|
|
9
|
+
el.disabled = true
|
|
10
|
+
if (!utils.hasClass(el, preventClass)) utils.addClass(el, preventClass)
|
|
11
|
+
setTimeout(() => {
|
|
12
|
+
el.disabled = false
|
|
13
|
+
if (utils.hasClass(el, preventClass)) utils.removeClass(el, preventClass)
|
|
14
|
+
}, binding.value || 1500)
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { createResizeEvent, XEResizeObserver } from '../../utils/resize'
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
beforeMount(el, binding) {
|
|
5
|
-
const _callback = binding.value
|
|
6
|
-
el.__observer__ = createResizeEvent(_callback)
|
|
7
|
-
el.__observer__.observe(el)
|
|
8
|
-
},
|
|
9
|
-
unmounted(el, binding) {
|
|
10
|
-
if (!el.__observer__) return
|
|
11
|
-
el.__observer__.unobserve(el)
|
|
12
|
-
delete el.__observer__
|
|
13
|
-
}
|
|
14
|
-
}
|
|
1
|
+
import { createResizeEvent, XEResizeObserver } from '../../utils/resize'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
beforeMount(el, binding) {
|
|
5
|
+
const _callback = binding.value
|
|
6
|
+
el.__observer__ = createResizeEvent(_callback)
|
|
7
|
+
el.__observer__.observe(el)
|
|
8
|
+
},
|
|
9
|
+
unmounted(el, binding) {
|
|
10
|
+
if (!el.__observer__) return
|
|
11
|
+
el.__observer__.unobserve(el)
|
|
12
|
+
delete el.__observer__
|
|
13
|
+
}
|
|
14
|
+
}
|