sh-view 2.8.1 → 2.8.2
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,166 +1,166 @@
|
|
|
1
|
-
function magnitude(x1, y1, x2, y2) {
|
|
2
|
-
const deltaX = x1 - x2
|
|
3
|
-
const deltaY = y1 - y2
|
|
4
|
-
return Math.sqrt(deltaX * deltaX + deltaY * deltaY)
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const RIPPLE_COUNT = 'vRippleCountInternal'
|
|
8
|
-
function setRippleCount(el, count) {
|
|
9
|
-
el.dataset[RIPPLE_COUNT] = count.toString()
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function getRippleCount(el) {
|
|
13
|
-
return parseInt(el.dataset[RIPPLE_COUNT] ?? '0', 10)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function incrementRippleCount(el) {
|
|
17
|
-
const count = getRippleCount(el)
|
|
18
|
-
setRippleCount(el, count + 1)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function decrementRippleCount(el) {
|
|
22
|
-
const count = getRippleCount(el)
|
|
23
|
-
setRippleCount(el, count - 1)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function deleteRippleCount(el) {
|
|
27
|
-
delete el.dataset[RIPPLE_COUNT]
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const getRelativePointer = ({ x, y }, { top, left }) => ({ x: x - left, y: y - top })
|
|
31
|
-
|
|
32
|
-
const getDistanceToFurthestCorner = (x, y, { width, height }) => {
|
|
33
|
-
// 获取点击目标的位置到块级作用域边界的距离
|
|
34
|
-
const topLeft = magnitude(x, y, 0, 0)
|
|
35
|
-
const topRight = magnitude(x, y, width, 0)
|
|
36
|
-
const bottomLeft = magnitude(x, y, 0, height)
|
|
37
|
-
const bottomRight = magnitude(x, y, width, height)
|
|
38
|
-
return Math.max(topLeft, topRight, bottomLeft, bottomRight)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const createContainer = ({ borderTopLeftRadius, borderTopRightRadius, borderBottomLeftRadius, borderBottomRightRadius }) => {
|
|
42
|
-
const rippleContainer = document.createElement('div')
|
|
43
|
-
rippleContainer.style.top = '0'
|
|
44
|
-
rippleContainer.style.left = '0'
|
|
45
|
-
rippleContainer.style.width = '100%'
|
|
46
|
-
rippleContainer.style.height = '100%'
|
|
47
|
-
rippleContainer.style.position = 'absolute'
|
|
48
|
-
rippleContainer.style.borderRadius = `${borderTopLeftRadius} ${borderTopRightRadius} ${borderBottomRightRadius} ${borderBottomLeftRadius}`
|
|
49
|
-
rippleContainer.style.overflow = 'hidden'
|
|
50
|
-
rippleContainer.style.pointerEvents = 'none'
|
|
51
|
-
// 兼容 ie 苹果
|
|
52
|
-
rippleContainer.style.webkitMaskImage = '-webkit-radial-gradient(white, black)'
|
|
53
|
-
return rippleContainer
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const createrippleElement = (x, y, size, options) => {
|
|
57
|
-
const rippleElement = document.createElement('div')
|
|
58
|
-
rippleElement.style.position = 'absolute'
|
|
59
|
-
rippleElement.style.width = `${size}px`
|
|
60
|
-
rippleElement.style.height = `${size}px`
|
|
61
|
-
rippleElement.style.top = `${y}px`
|
|
62
|
-
rippleElement.style.left = `${x}px`
|
|
63
|
-
rippleElement.style.background = options.color
|
|
64
|
-
rippleElement.style.borderRadius = '50%'
|
|
65
|
-
rippleElement.style.opacity = `${options.initialOpacity}`
|
|
66
|
-
rippleElement.style.transform = `translate(-50%,-50%) scale(0)`
|
|
67
|
-
rippleElement.style.transition = `transform ${options.duration / 1000}s ${options.easing}, opacity ${options.duration / 1000}s ${options.easing}`
|
|
68
|
-
return rippleElement
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const MULTIPLE_NUMBER = 2.05
|
|
72
|
-
|
|
73
|
-
const ripple = (event, el, options) => {
|
|
74
|
-
const rect = el.getBoundingClientRect()
|
|
75
|
-
const computedStyles = window.getComputedStyle(el)
|
|
76
|
-
const { x, y } = getRelativePointer(event, rect)
|
|
77
|
-
const size = MULTIPLE_NUMBER * getDistanceToFurthestCorner(x, y, rect)
|
|
78
|
-
|
|
79
|
-
const rippleContainer = createContainer(computedStyles)
|
|
80
|
-
const rippleEl = createrippleElement(x, y, size, options)
|
|
81
|
-
let originalPositionValue = ''
|
|
82
|
-
let shouldDissolveripple = false
|
|
83
|
-
let token = null
|
|
84
|
-
function dissolveripple() {
|
|
85
|
-
rippleEl.style.transition = 'opacity 150ms linear'
|
|
86
|
-
rippleEl.style.opacity = '0'
|
|
87
|
-
setTimeout(() => {
|
|
88
|
-
rippleContainer.remove()
|
|
89
|
-
decrementRippleCount(el)
|
|
90
|
-
if (getRippleCount(el) === 0) {
|
|
91
|
-
deleteRippleCount(el)
|
|
92
|
-
el.style.position = originalPositionValue
|
|
93
|
-
}
|
|
94
|
-
}, 150)
|
|
95
|
-
}
|
|
96
|
-
function releaseripple(e) {
|
|
97
|
-
if (typeof e !== 'undefined') {
|
|
98
|
-
document.removeEventListener('pointerup', releaseripple)
|
|
99
|
-
document.removeEventListener('pointercancel', releaseripple)
|
|
100
|
-
}
|
|
101
|
-
if (shouldDissolveripple) {
|
|
102
|
-
dissolveripple()
|
|
103
|
-
} else {
|
|
104
|
-
shouldDissolveripple = true
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
function cancelripple() {
|
|
108
|
-
clearTimeout(token)
|
|
109
|
-
rippleContainer.remove()
|
|
110
|
-
document.removeEventListener('pointerup', releaseripple)
|
|
111
|
-
document.removeEventListener('pointercancel', releaseripple)
|
|
112
|
-
document.removeEventListener('pointercancel', cancelripple)
|
|
113
|
-
}
|
|
114
|
-
incrementRippleCount(el)
|
|
115
|
-
if (computedStyles.position === 'static') {
|
|
116
|
-
if (el.style.position) {
|
|
117
|
-
originalPositionValue = el.style.position
|
|
118
|
-
}
|
|
119
|
-
el.style.position = 'relative'
|
|
120
|
-
}
|
|
121
|
-
rippleContainer.appendChild(rippleEl)
|
|
122
|
-
el.appendChild(rippleContainer)
|
|
123
|
-
document.addEventListener('pointerup', releaseripple)
|
|
124
|
-
document.addEventListener('pointercancel', releaseripple)
|
|
125
|
-
token = setTimeout(() => {
|
|
126
|
-
document.removeEventListener('pointercancel', cancelripple)
|
|
127
|
-
requestAnimationFrame(() => {
|
|
128
|
-
rippleEl.style.transform = `translate(-50%,-50%) scale(1)`
|
|
129
|
-
rippleEl.style.opacity = `${options.finalOpacity}`
|
|
130
|
-
setTimeout(() => releaseripple(), options.duration)
|
|
131
|
-
})
|
|
132
|
-
}, options.delay)
|
|
133
|
-
document.addEventListener('pointercancel', cancelripple)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const defaultOptions = {
|
|
137
|
-
directive: 'ripple',
|
|
138
|
-
color: 'currentColor', // 你可以设置 ·currentColor· to 能够自动使用元素的文本颜色
|
|
139
|
-
initialOpacity: 0.2, // 第一次出现的透明度
|
|
140
|
-
finalOpacity: 0.1, // 在透明度 结束的时候 stopped 的时候 我们设置透明度的大小
|
|
141
|
-
duration: 400, // 动画持续时间
|
|
142
|
-
easing: 'ease-out', // css 动画 从开始到结束 以相同的时间来执行动画
|
|
143
|
-
delay: 75, // 类似于 debounceTime
|
|
144
|
-
disabled: false // 类似于 点击禁止ripple效果
|
|
145
|
-
}
|
|
146
|
-
export default {
|
|
147
|
-
mounted(el, binding) {
|
|
148
|
-
el.addEventListener('pointerdown', event => {
|
|
149
|
-
const options = binding.value || {}
|
|
150
|
-
// 必须确保disabled 属性存在 否则指令终止报错
|
|
151
|
-
if (binding.value && binding.value.disabled) {
|
|
152
|
-
return
|
|
153
|
-
}
|
|
154
|
-
if (options === false) {
|
|
155
|
-
return
|
|
156
|
-
}
|
|
157
|
-
ripple(event, el, {
|
|
158
|
-
...defaultOptions,
|
|
159
|
-
...options
|
|
160
|
-
})
|
|
161
|
-
})
|
|
162
|
-
},
|
|
163
|
-
updated(el, binding) {
|
|
164
|
-
binding.value = {}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
1
|
+
function magnitude(x1, y1, x2, y2) {
|
|
2
|
+
const deltaX = x1 - x2
|
|
3
|
+
const deltaY = y1 - y2
|
|
4
|
+
return Math.sqrt(deltaX * deltaX + deltaY * deltaY)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const RIPPLE_COUNT = 'vRippleCountInternal'
|
|
8
|
+
function setRippleCount(el, count) {
|
|
9
|
+
el.dataset[RIPPLE_COUNT] = count.toString()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function getRippleCount(el) {
|
|
13
|
+
return parseInt(el.dataset[RIPPLE_COUNT] ?? '0', 10)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function incrementRippleCount(el) {
|
|
17
|
+
const count = getRippleCount(el)
|
|
18
|
+
setRippleCount(el, count + 1)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function decrementRippleCount(el) {
|
|
22
|
+
const count = getRippleCount(el)
|
|
23
|
+
setRippleCount(el, count - 1)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function deleteRippleCount(el) {
|
|
27
|
+
delete el.dataset[RIPPLE_COUNT]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const getRelativePointer = ({ x, y }, { top, left }) => ({ x: x - left, y: y - top })
|
|
31
|
+
|
|
32
|
+
const getDistanceToFurthestCorner = (x, y, { width, height }) => {
|
|
33
|
+
// 获取点击目标的位置到块级作用域边界的距离
|
|
34
|
+
const topLeft = magnitude(x, y, 0, 0)
|
|
35
|
+
const topRight = magnitude(x, y, width, 0)
|
|
36
|
+
const bottomLeft = magnitude(x, y, 0, height)
|
|
37
|
+
const bottomRight = magnitude(x, y, width, height)
|
|
38
|
+
return Math.max(topLeft, topRight, bottomLeft, bottomRight)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const createContainer = ({ borderTopLeftRadius, borderTopRightRadius, borderBottomLeftRadius, borderBottomRightRadius }) => {
|
|
42
|
+
const rippleContainer = document.createElement('div')
|
|
43
|
+
rippleContainer.style.top = '0'
|
|
44
|
+
rippleContainer.style.left = '0'
|
|
45
|
+
rippleContainer.style.width = '100%'
|
|
46
|
+
rippleContainer.style.height = '100%'
|
|
47
|
+
rippleContainer.style.position = 'absolute'
|
|
48
|
+
rippleContainer.style.borderRadius = `${borderTopLeftRadius} ${borderTopRightRadius} ${borderBottomRightRadius} ${borderBottomLeftRadius}`
|
|
49
|
+
rippleContainer.style.overflow = 'hidden'
|
|
50
|
+
rippleContainer.style.pointerEvents = 'none'
|
|
51
|
+
// 兼容 ie 苹果
|
|
52
|
+
rippleContainer.style.webkitMaskImage = '-webkit-radial-gradient(white, black)'
|
|
53
|
+
return rippleContainer
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const createrippleElement = (x, y, size, options) => {
|
|
57
|
+
const rippleElement = document.createElement('div')
|
|
58
|
+
rippleElement.style.position = 'absolute'
|
|
59
|
+
rippleElement.style.width = `${size}px`
|
|
60
|
+
rippleElement.style.height = `${size}px`
|
|
61
|
+
rippleElement.style.top = `${y}px`
|
|
62
|
+
rippleElement.style.left = `${x}px`
|
|
63
|
+
rippleElement.style.background = options.color
|
|
64
|
+
rippleElement.style.borderRadius = '50%'
|
|
65
|
+
rippleElement.style.opacity = `${options.initialOpacity}`
|
|
66
|
+
rippleElement.style.transform = `translate(-50%,-50%) scale(0)`
|
|
67
|
+
rippleElement.style.transition = `transform ${options.duration / 1000}s ${options.easing}, opacity ${options.duration / 1000}s ${options.easing}`
|
|
68
|
+
return rippleElement
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const MULTIPLE_NUMBER = 2.05
|
|
72
|
+
|
|
73
|
+
const ripple = (event, el, options) => {
|
|
74
|
+
const rect = el.getBoundingClientRect()
|
|
75
|
+
const computedStyles = window.getComputedStyle(el)
|
|
76
|
+
const { x, y } = getRelativePointer(event, rect)
|
|
77
|
+
const size = MULTIPLE_NUMBER * getDistanceToFurthestCorner(x, y, rect)
|
|
78
|
+
|
|
79
|
+
const rippleContainer = createContainer(computedStyles)
|
|
80
|
+
const rippleEl = createrippleElement(x, y, size, options)
|
|
81
|
+
let originalPositionValue = ''
|
|
82
|
+
let shouldDissolveripple = false
|
|
83
|
+
let token = null
|
|
84
|
+
function dissolveripple() {
|
|
85
|
+
rippleEl.style.transition = 'opacity 150ms linear'
|
|
86
|
+
rippleEl.style.opacity = '0'
|
|
87
|
+
setTimeout(() => {
|
|
88
|
+
rippleContainer.remove()
|
|
89
|
+
decrementRippleCount(el)
|
|
90
|
+
if (getRippleCount(el) === 0) {
|
|
91
|
+
deleteRippleCount(el)
|
|
92
|
+
el.style.position = originalPositionValue
|
|
93
|
+
}
|
|
94
|
+
}, 150)
|
|
95
|
+
}
|
|
96
|
+
function releaseripple(e) {
|
|
97
|
+
if (typeof e !== 'undefined') {
|
|
98
|
+
document.removeEventListener('pointerup', releaseripple)
|
|
99
|
+
document.removeEventListener('pointercancel', releaseripple)
|
|
100
|
+
}
|
|
101
|
+
if (shouldDissolveripple) {
|
|
102
|
+
dissolveripple()
|
|
103
|
+
} else {
|
|
104
|
+
shouldDissolveripple = true
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function cancelripple() {
|
|
108
|
+
clearTimeout(token)
|
|
109
|
+
rippleContainer.remove()
|
|
110
|
+
document.removeEventListener('pointerup', releaseripple)
|
|
111
|
+
document.removeEventListener('pointercancel', releaseripple)
|
|
112
|
+
document.removeEventListener('pointercancel', cancelripple)
|
|
113
|
+
}
|
|
114
|
+
incrementRippleCount(el)
|
|
115
|
+
if (computedStyles.position === 'static') {
|
|
116
|
+
if (el.style.position) {
|
|
117
|
+
originalPositionValue = el.style.position
|
|
118
|
+
}
|
|
119
|
+
el.style.position = 'relative'
|
|
120
|
+
}
|
|
121
|
+
rippleContainer.appendChild(rippleEl)
|
|
122
|
+
el.appendChild(rippleContainer)
|
|
123
|
+
document.addEventListener('pointerup', releaseripple)
|
|
124
|
+
document.addEventListener('pointercancel', releaseripple)
|
|
125
|
+
token = setTimeout(() => {
|
|
126
|
+
document.removeEventListener('pointercancel', cancelripple)
|
|
127
|
+
requestAnimationFrame(() => {
|
|
128
|
+
rippleEl.style.transform = `translate(-50%,-50%) scale(1)`
|
|
129
|
+
rippleEl.style.opacity = `${options.finalOpacity}`
|
|
130
|
+
setTimeout(() => releaseripple(), options.duration)
|
|
131
|
+
})
|
|
132
|
+
}, options.delay)
|
|
133
|
+
document.addEventListener('pointercancel', cancelripple)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const defaultOptions = {
|
|
137
|
+
directive: 'ripple',
|
|
138
|
+
color: 'currentColor', // 你可以设置 ·currentColor· to 能够自动使用元素的文本颜色
|
|
139
|
+
initialOpacity: 0.2, // 第一次出现的透明度
|
|
140
|
+
finalOpacity: 0.1, // 在透明度 结束的时候 stopped 的时候 我们设置透明度的大小
|
|
141
|
+
duration: 400, // 动画持续时间
|
|
142
|
+
easing: 'ease-out', // css 动画 从开始到结束 以相同的时间来执行动画
|
|
143
|
+
delay: 75, // 类似于 debounceTime
|
|
144
|
+
disabled: false // 类似于 点击禁止ripple效果
|
|
145
|
+
}
|
|
146
|
+
export default {
|
|
147
|
+
mounted(el, binding) {
|
|
148
|
+
el.addEventListener('pointerdown', event => {
|
|
149
|
+
const options = binding.value || {}
|
|
150
|
+
// 必须确保disabled 属性存在 否则指令终止报错
|
|
151
|
+
if (binding.value && binding.value.disabled) {
|
|
152
|
+
return
|
|
153
|
+
}
|
|
154
|
+
if (options === false) {
|
|
155
|
+
return
|
|
156
|
+
}
|
|
157
|
+
ripple(event, el, {
|
|
158
|
+
...defaultOptions,
|
|
159
|
+
...options
|
|
160
|
+
})
|
|
161
|
+
})
|
|
162
|
+
},
|
|
163
|
+
updated(el, binding) {
|
|
164
|
+
binding.value = {}
|
|
165
|
+
}
|
|
166
|
+
}
|
package/packages/index.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import packageConfig from '../package.json'
|
|
2
|
-
import { utils, notice } from 'sh-tools'
|
|
3
|
-
import { VueMasonryPlugin } from 'vue-masonry'
|
|
4
|
-
import directive from './directive/index'
|
|
5
|
-
import vxeTable from './vxeTable/index'
|
|
6
|
-
import components from './components/index'
|
|
7
|
-
import mixin from './mixin/index'
|
|
8
|
-
import './css/index'
|
|
9
|
-
|
|
10
|
-
// 全局公共封装组件
|
|
11
|
-
const install = function (root, option = {}) {
|
|
12
|
-
if (install.installed) return
|
|
13
|
-
root.config.globalProperties.$vUtils = utils
|
|
14
|
-
root.config.globalProperties.$Notice = notice
|
|
15
|
-
root.mixin(mixin)
|
|
16
|
-
root.use(VueMasonryPlugin, option)
|
|
17
|
-
root.use(directive)
|
|
18
|
-
root.use(vxeTable, option)
|
|
19
|
-
root.use(components, option)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const ShUI = {
|
|
23
|
-
name: packageConfig.name,
|
|
24
|
-
version: packageConfig.version,
|
|
25
|
-
install
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
let consInfo = ''
|
|
29
|
-
let defaultBg = 'padding: 5px; color: #111; background: #f5f7f9; font-weight: bold;'
|
|
30
|
-
let tagBg1 = 'padding: 5px; color: #fff; background: #8e2eff; font-weight: bold;'
|
|
31
|
-
let tagBg2 = 'padding: 5px; color: #333; background: #ffee2e; font-weight: bold;'
|
|
32
|
-
if ((window.navigator.language || window.navigator.browserLanguage).toLowerCase() === 'zh-cn') {
|
|
33
|
-
consInfo = `%c由%c${ShUI.name}%c提供技术支持,版本%c${ShUI.version}%c`
|
|
34
|
-
} else {
|
|
35
|
-
consInfo = `%cPowered by%c${ShUI.name}%c,version%c${ShUI.version}%c`
|
|
36
|
-
}
|
|
37
|
-
console.info(consInfo, defaultBg, tagBg1, defaultBg, tagBg2, defaultBg)
|
|
38
|
-
|
|
39
|
-
export default ShUI
|
|
1
|
+
import packageConfig from '../package.json'
|
|
2
|
+
import { utils, notice } from 'sh-tools'
|
|
3
|
+
import { VueMasonryPlugin } from 'vue-masonry'
|
|
4
|
+
import directive from './directive/index'
|
|
5
|
+
import vxeTable from './vxeTable/index'
|
|
6
|
+
import components from './components/index'
|
|
7
|
+
import mixin from './mixin/index'
|
|
8
|
+
import './css/index'
|
|
9
|
+
|
|
10
|
+
// 全局公共封装组件
|
|
11
|
+
const install = function (root, option = {}) {
|
|
12
|
+
if (install.installed) return
|
|
13
|
+
root.config.globalProperties.$vUtils = utils
|
|
14
|
+
root.config.globalProperties.$Notice = notice
|
|
15
|
+
root.mixin(mixin)
|
|
16
|
+
root.use(VueMasonryPlugin, option)
|
|
17
|
+
root.use(directive)
|
|
18
|
+
root.use(vxeTable, option)
|
|
19
|
+
root.use(components, option)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const ShUI = {
|
|
23
|
+
name: packageConfig.name,
|
|
24
|
+
version: packageConfig.version,
|
|
25
|
+
install
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let consInfo = ''
|
|
29
|
+
let defaultBg = 'padding: 5px; color: #111; background: #f5f7f9; font-weight: bold;'
|
|
30
|
+
let tagBg1 = 'padding: 5px; color: #fff; background: #8e2eff; font-weight: bold;'
|
|
31
|
+
let tagBg2 = 'padding: 5px; color: #333; background: #ffee2e; font-weight: bold;'
|
|
32
|
+
if ((window.navigator.language || window.navigator.browserLanguage).toLowerCase() === 'zh-cn') {
|
|
33
|
+
consInfo = `%c由%c${ShUI.name}%c提供技术支持,版本%c${ShUI.version}%c`
|
|
34
|
+
} else {
|
|
35
|
+
consInfo = `%cPowered by%c${ShUI.name}%c,version%c${ShUI.version}%c`
|
|
36
|
+
}
|
|
37
|
+
console.info(consInfo, defaultBg, tagBg1, defaultBg, tagBg2, defaultBg)
|
|
38
|
+
|
|
39
|
+
export default ShUI
|
package/packages/mixin/index.js
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
const msgDefault = {
|
|
2
|
-
title: '',
|
|
3
|
-
className: 'globalMessageBox',
|
|
4
|
-
draggable: false
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const mixin = {
|
|
8
|
-
methods: {
|
|
9
|
-
// 全局msg提示方法
|
|
10
|
-
msg(options) {
|
|
11
|
-
return this.$vTable.modal.message(options)
|
|
12
|
-
},
|
|
13
|
-
msginfo(options) {
|
|
14
|
-
let opts = Object.assign({}, msgDefault, typeof options === 'string' ? { content: options, status: 'info' } : options)
|
|
15
|
-
return this.msg(opts)
|
|
16
|
-
},
|
|
17
|
-
msgsuccess(options) {
|
|
18
|
-
let opts = Object.assign({}, msgDefault, typeof options === 'string' ? { content: options, status: 'success' } : options)
|
|
19
|
-
return this.msg(opts)
|
|
20
|
-
},
|
|
21
|
-
msgwarning(options) {
|
|
22
|
-
let opts = Object.assign({}, msgDefault, typeof options === 'string' ? { content: options, status: 'warning' } : options)
|
|
23
|
-
return this.msg(opts)
|
|
24
|
-
},
|
|
25
|
-
msgerror(options) {
|
|
26
|
-
let opts = Object.assign({}, msgDefault, typeof options === 'string' ? { content: options, status: 'error' } : options)
|
|
27
|
-
return this.msg(opts)
|
|
28
|
-
},
|
|
29
|
-
msgconfirm(options) {
|
|
30
|
-
return new Promise(async resolve => {
|
|
31
|
-
let opts = Object.assign({}, typeof options === 'string' ? { content: options } : options)
|
|
32
|
-
let type = await this.$vTable.modal.confirm({
|
|
33
|
-
showHeader: Boolean(opts.title),
|
|
34
|
-
...opts
|
|
35
|
-
})
|
|
36
|
-
if (type === 'confirm') resolve(type)
|
|
37
|
-
})
|
|
38
|
-
},
|
|
39
|
-
// 全局路由跳
|
|
40
|
-
routerTo(route) {
|
|
41
|
-
let { name, params, query } = {}
|
|
42
|
-
if (typeof route === 'string') name = route
|
|
43
|
-
else {
|
|
44
|
-
name = route.name
|
|
45
|
-
params = route.params
|
|
46
|
-
query = route.query
|
|
47
|
-
}
|
|
48
|
-
if (name.indexOf('isTurnByHref_') > -1) {
|
|
49
|
-
window.open(name.split('_')[1])
|
|
50
|
-
return
|
|
51
|
-
}
|
|
52
|
-
try {
|
|
53
|
-
this.$router.push({ name, params, query })
|
|
54
|
-
} catch (e) {
|
|
55
|
-
this.$router.replace({ path: '/401' })
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
// 全局路由返回上一页
|
|
59
|
-
routerback() {
|
|
60
|
-
this.$router.back()
|
|
61
|
-
},
|
|
62
|
-
// 全局判断是否有子节点
|
|
63
|
-
hasChildren(item, name = 'children') {
|
|
64
|
-
return item && item[name] && Array.isArray(item[name]) && item[name].length > 0
|
|
65
|
-
},
|
|
66
|
-
// 全局格式化名称
|
|
67
|
-
formatTitle(item) {
|
|
68
|
-
let { title, __titleIsFunction__ } = item.meta || {}
|
|
69
|
-
if (!title) return false
|
|
70
|
-
if (this.$config.useI18n) {
|
|
71
|
-
if (title.includes('{{') && title.includes('}}')) title = title.replace(/({{[\s\S]+?}})/, (m, str) => str.replace(/{{([\s\S]*)}}/, (m, _) => this.$t(_.trim())))
|
|
72
|
-
else if (__titleIsFunction__) title = item.meta.title
|
|
73
|
-
else title = this.$t(item.name)
|
|
74
|
-
} else title = (item.meta && item.meta.title) || item.name
|
|
75
|
-
return title
|
|
76
|
-
},
|
|
77
|
-
// 配置继承方法
|
|
78
|
-
getExtendConfig(config = {}, name, module) {
|
|
79
|
-
let moduleConfig = config[module] || config.default || {}
|
|
80
|
-
let nameConfig = moduleConfig[name]
|
|
81
|
-
return this.$vUtils.clone(nameConfig, true)
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export default mixin
|
|
1
|
+
const msgDefault = {
|
|
2
|
+
title: '',
|
|
3
|
+
className: 'globalMessageBox',
|
|
4
|
+
draggable: false
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const mixin = {
|
|
8
|
+
methods: {
|
|
9
|
+
// 全局msg提示方法
|
|
10
|
+
msg(options) {
|
|
11
|
+
return this.$vTable.modal.message(options)
|
|
12
|
+
},
|
|
13
|
+
msginfo(options) {
|
|
14
|
+
let opts = Object.assign({}, msgDefault, typeof options === 'string' ? { content: options, status: 'info' } : options)
|
|
15
|
+
return this.msg(opts)
|
|
16
|
+
},
|
|
17
|
+
msgsuccess(options) {
|
|
18
|
+
let opts = Object.assign({}, msgDefault, typeof options === 'string' ? { content: options, status: 'success' } : options)
|
|
19
|
+
return this.msg(opts)
|
|
20
|
+
},
|
|
21
|
+
msgwarning(options) {
|
|
22
|
+
let opts = Object.assign({}, msgDefault, typeof options === 'string' ? { content: options, status: 'warning' } : options)
|
|
23
|
+
return this.msg(opts)
|
|
24
|
+
},
|
|
25
|
+
msgerror(options) {
|
|
26
|
+
let opts = Object.assign({}, msgDefault, typeof options === 'string' ? { content: options, status: 'error' } : options)
|
|
27
|
+
return this.msg(opts)
|
|
28
|
+
},
|
|
29
|
+
msgconfirm(options) {
|
|
30
|
+
return new Promise(async resolve => {
|
|
31
|
+
let opts = Object.assign({}, typeof options === 'string' ? { content: options } : options)
|
|
32
|
+
let type = await this.$vTable.modal.confirm({
|
|
33
|
+
showHeader: Boolean(opts.title),
|
|
34
|
+
...opts
|
|
35
|
+
})
|
|
36
|
+
if (type === 'confirm') resolve(type)
|
|
37
|
+
})
|
|
38
|
+
},
|
|
39
|
+
// 全局路由跳
|
|
40
|
+
routerTo(route) {
|
|
41
|
+
let { name, params, query } = {}
|
|
42
|
+
if (typeof route === 'string') name = route
|
|
43
|
+
else {
|
|
44
|
+
name = route.name
|
|
45
|
+
params = route.params
|
|
46
|
+
query = route.query
|
|
47
|
+
}
|
|
48
|
+
if (name.indexOf('isTurnByHref_') > -1) {
|
|
49
|
+
window.open(name.split('_')[1])
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
this.$router.push({ name, params, query })
|
|
54
|
+
} catch (e) {
|
|
55
|
+
this.$router.replace({ path: '/401' })
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
// 全局路由返回上一页
|
|
59
|
+
routerback() {
|
|
60
|
+
this.$router.back()
|
|
61
|
+
},
|
|
62
|
+
// 全局判断是否有子节点
|
|
63
|
+
hasChildren(item, name = 'children') {
|
|
64
|
+
return item && item[name] && Array.isArray(item[name]) && item[name].length > 0
|
|
65
|
+
},
|
|
66
|
+
// 全局格式化名称
|
|
67
|
+
formatTitle(item) {
|
|
68
|
+
let { title, __titleIsFunction__ } = item.meta || {}
|
|
69
|
+
if (!title) return false
|
|
70
|
+
if (this.$config.useI18n) {
|
|
71
|
+
if (title.includes('{{') && title.includes('}}')) title = title.replace(/({{[\s\S]+?}})/, (m, str) => str.replace(/{{([\s\S]*)}}/, (m, _) => this.$t(_.trim())))
|
|
72
|
+
else if (__titleIsFunction__) title = item.meta.title
|
|
73
|
+
else title = this.$t(item.name)
|
|
74
|
+
} else title = (item.meta && item.meta.title) || item.name
|
|
75
|
+
return title
|
|
76
|
+
},
|
|
77
|
+
// 配置继承方法
|
|
78
|
+
getExtendConfig(config = {}, name, module) {
|
|
79
|
+
let moduleConfig = config[module] || config.default || {}
|
|
80
|
+
let nameConfig = moduleConfig[name]
|
|
81
|
+
return this.$vUtils.clone(nameConfig, true)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export default mixin
|