sh-view 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -13
- package/packages/components/global-components/sh-alert/index.vue +175 -173
- package/packages/components/global-components/sh-badge/index.vue +57 -43
- package/packages/components/global-components/sh-card/index.vue +24 -16
- package/packages/components/global-components/sh-code-editor/index.vue +250 -260
- package/packages/components/global-components/sh-col/index.vue +44 -36
- package/packages/components/global-components/sh-corner/index.vue +230 -228
- package/packages/components/global-components/sh-count-to/index.vue +60 -51
- package/packages/components/global-components/sh-drawer/index.vue +209 -182
- package/packages/components/global-components/sh-drawer/scrollbar.js +44 -42
- package/packages/components/global-components/sh-empty/index.vue +0 -1
- package/packages/components/global-components/sh-form/form.vue +110 -0
- package/packages/components/global-components/sh-form/js/props.js +76 -63
- package/packages/components/global-components/sh-form/js/useForm.js +236 -0
- package/packages/components/global-components/sh-form/query.vue +70 -0
- package/packages/components/global-components/sh-header/index.vue +35 -50
- package/packages/components/global-components/sh-icon/css/index.scss +44 -0
- package/packages/components/global-components/sh-icon/index.vue +24 -11
- package/packages/components/global-components/sh-image/index.vue +47 -38
- package/packages/components/global-components/sh-list/index.vue +42 -37
- package/packages/components/global-components/sh-loading/index.vue +12 -8
- package/packages/components/global-components/sh-modal/index.vue +49 -40
- package/packages/components/global-components/sh-noticebar/index.vue +68 -54
- package/packages/components/global-components/sh-poptip/index.vue +247 -130
- package/packages/components/global-components/sh-progress/index.vue +71 -69
- package/packages/components/global-components/sh-pull-refresh/index.vue +156 -157
- package/packages/components/global-components/sh-result/index.vue +37 -28
- package/packages/components/global-components/sh-row/index.vue +21 -18
- package/packages/components/global-components/sh-split/index.vue +115 -109
- package/packages/components/global-components/sh-table/components/importModal.vue +95 -86
- package/packages/components/global-components/sh-table/components/sh-column.vue +54 -0
- package/packages/components/global-components/sh-table/{index.vue → grid.vue} +34 -145
- package/packages/components/global-components/sh-table/js/tableMethods.js +175 -0
- package/packages/components/global-components/sh-table/js/useTable.js +592 -0
- package/packages/components/global-components/sh-table/table.vue +269 -0
- package/packages/components/global-components/sh-tabs/index.vue +118 -93
- package/packages/components/global-components/sh-tag/index.vue +52 -51
- package/packages/components/global-components/sh-toolbar/index.vue +53 -47
- package/packages/components/global-components/sh-tree/components/table-tree.vue +152 -139
- package/packages/components/global-components/sh-tree/index.vue +218 -195
- package/packages/components/global-components/sh-tree/mixin/treeProps.js +118 -120
- package/packages/components/global-components/sh-upload/index.vue +308 -51
- package/packages/components/global-components/sh-water-fall/index.vue +4 -11
- package/packages/components/index.js +5 -3
- package/packages/components/other-components/sh-cron-modal/components/cron-content.vue +140 -129
- package/packages/components/other-components/sh-cron-modal/css/index.scss +0 -5
- package/packages/components/other-components/sh-cron-modal/index.vue +81 -67
- package/packages/components/other-components/sh-cron-modal/mixin/cron-emits.js +1 -0
- package/packages/components/other-components/sh-cron-modal/mixin/cron-hooks.js +179 -0
- package/packages/components/other-components/sh-cron-modal/mixin/cron-props.js +9 -0
- package/packages/components/other-components/sh-cron-modal/tabs/cron-day-box.vue +101 -92
- package/packages/components/other-components/sh-cron-modal/tabs/cron-hour-box.vue +68 -56
- package/packages/components/other-components/sh-cron-modal/tabs/cron-minute-box.vue +68 -56
- package/packages/components/other-components/sh-cron-modal/tabs/cron-month-box.vue +68 -56
- package/packages/components/other-components/sh-cron-modal/tabs/cron-second-box.vue +68 -56
- package/packages/components/other-components/sh-cron-modal/tabs/cron-week-box.vue +126 -115
- package/packages/components/other-components/sh-cron-modal/tabs/cron-year-box.vue +59 -46
- package/packages/components/other-components/sh-menu/index.vue +73 -60
- package/packages/components/other-components/sh-menu/menu-group-content.vue +71 -59
- package/packages/components/other-components/sh-menu/menu-item-content.vue +40 -30
- package/packages/components/other-components/sh-menu-card/index.vue +70 -64
- package/packages/components/other-components/sh-menu-card/menu-box.vue +50 -44
- package/packages/components/other-components/sh-preview/components/sh-excel.vue +182 -0
- package/packages/components/other-components/sh-preview/components/sh-word.vue +73 -0
- package/packages/components/other-components/sh-preview/index.vue +86 -85
- package/packages/components/other-components/sh-preview/js/data-hook.js +37 -0
- package/packages/components/other-components/sh-preview/js/data-props.js +11 -0
- package/packages/components/other-components/sh-system-tip/index.vue +28 -24
- package/packages/css/index.js +4 -4
- package/packages/directive/module/prevent-click.js +1 -1
- package/packages/directive/module/resize.js +11 -154
- package/packages/index.js +39 -39
- package/packages/mixin/index.js +86 -87
- package/packages/vxeTable/render/cell/vxe-render-checkbox.vue +14 -5
- package/packages/vxeTable/render/cell/vxe-render-checkgroup.vue +43 -36
- package/packages/vxeTable/render/cell/vxe-render-code.vue +14 -5
- package/packages/vxeTable/render/cell/vxe-render-goption.vue +34 -24
- package/packages/vxeTable/render/cell/vxe-render-href.vue +21 -11
- package/packages/vxeTable/render/cell/vxe-render-img.vue +16 -10
- package/packages/vxeTable/render/cell/vxe-render-input.vue +83 -79
- package/packages/vxeTable/render/cell/vxe-render-money.vue +14 -6
- package/packages/vxeTable/render/cell/vxe-render-progress.vue +28 -19
- package/packages/vxeTable/render/cell/vxe-render-radio.vue +14 -5
- package/packages/vxeTable/render/cell/vxe-render-radiogroup.vue +43 -36
- package/packages/vxeTable/render/cell/vxe-render-select.vue +44 -36
- package/packages/vxeTable/render/cell/vxe-render-switch.vue +14 -5
- package/packages/vxeTable/render/cell/vxe-render-table.vue +51 -78
- package/packages/vxeTable/render/cell/vxe-render-textarea.vue +14 -5
- package/packages/vxeTable/render/cell/vxe-render-time.vue +23 -13
- package/packages/vxeTable/render/cell/vxe-render-tree.vue +23 -27
- package/packages/vxeTable/render/cell/vxe-render-upload.vue +11 -7
- package/packages/vxeTable/render/filters/vxe-filter-input.vue +25 -43
- package/packages/vxeTable/render/footer/vxe-footer-input.vue +23 -13
- package/packages/vxeTable/render/footer/vxe-footer-money.vue +30 -20
- package/packages/vxeTable/render/globalRenders.jsx +1 -1
- package/packages/vxeTable/render/header/vxe-header-money.vue +31 -21
- package/packages/vxeTable/render/mixin/cell-hooks.js +162 -0
- package/packages/vxeTable/render/mixin/cell-props.js +23 -0
- package/packages/vxeTable/render/mixin/filter-hooks.js +28 -0
- package/packages/components/global-components/sh-form/components/form-item.vue +0 -25
- package/packages/components/global-components/sh-form/css/index.scss +0 -55
- package/packages/components/global-components/sh-form/index.vue +0 -114
- package/packages/components/global-components/sh-form/js/methods.js +0 -146
- package/packages/components/global-components/sh-form/mixin/defaultData.js +0 -32
- package/packages/components/global-components/sh-icon/css/default/index.scss +0 -27
- package/packages/components/global-components/sh-icon/css/font/index.scss +0 -16
- package/packages/components/global-components/sh-icon/icon-default.vue +0 -32
- package/packages/components/global-components/sh-icon/icon-font.vue +0 -32
- package/packages/components/global-components/sh-poptip/popper.js +0 -115
- package/packages/components/global-components/sh-query/index.vue +0 -317
- package/packages/components/global-components/sh-table/js/methods.js +0 -549
- package/packages/components/global-components/sh-table/mixin/defaultData.js +0 -94
- package/packages/components/global-components/sh-upload/js/mixin.js +0 -257
- package/packages/components/other-components/sh-cron-modal/mixin/cron-box.js +0 -169
- package/packages/vxeTable/render/mixin/cell-mixin.js +0 -195
- /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.svg → ionicons.svg} +0 -0
- /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.ttf → ionicons.ttf} +0 -0
- /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.woff → ionicons.woff} +0 -0
- /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.woff2 → ionicons.woff2} +0 -0
- /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.js → iconfont.js} +0 -0
- /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.json → iconfont.json} +0 -0
- /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.ttf → iconfont.ttf} +0 -0
- /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.woff → iconfont.woff} +0 -0
- /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.woff2 → iconfont.woff2} +0 -0
- /package/packages/{assets/css → css}/animated.scss +0 -0
- /package/packages/{assets/css → css}/loader.scss +0 -0
- /package/packages/{assets/css → css}/main.scss +0 -0
- /package/packages/{assets/css → css}/theme.scss +0 -0
|
@@ -1,159 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @return {Boolean} 是否IE浏览器的判断结果
|
|
5
|
-
*/
|
|
6
|
-
function isIE() {
|
|
7
|
-
let _isIE = false
|
|
8
|
-
if (typeof navigator !== 'undefined') {
|
|
9
|
-
_isIE = navigator.userAgent.match(/Trident/) || navigator.userAgent.match(/Edge/)
|
|
10
|
-
}
|
|
11
|
-
return _isIE
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
var lastTime = 0
|
|
15
|
-
var vendors = ['ms', 'moz', 'webkit', 'o']
|
|
16
|
-
if (typeof window === 'undefined') {
|
|
17
|
-
global.window = {}
|
|
18
|
-
}
|
|
19
|
-
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
|
|
20
|
-
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']
|
|
21
|
-
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (!window.requestAnimationFrame) {
|
|
25
|
-
window.requestAnimationFrame = function (callback, element) {
|
|
26
|
-
var currTime = new Date().getTime()
|
|
27
|
-
var timeToCall = Math.max(0, 16 - (currTime - lastTime))
|
|
28
|
-
var id = window.setTimeout(function () {
|
|
29
|
-
callback(currTime + timeToCall)
|
|
30
|
-
}, timeToCall)
|
|
31
|
-
lastTime = currTime + timeToCall
|
|
32
|
-
return id
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (!window.cancelAnimationFrame) {
|
|
37
|
-
window.cancelAnimationFrame = function (id) {
|
|
38
|
-
clearTimeout(id)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* requestAnimationFrame的兼容处理
|
|
44
|
-
*/
|
|
45
|
-
const $requestAnimationFrame = window.requestAnimationFrame
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* cancelAnimationFrame的兼容处理
|
|
49
|
-
*/
|
|
50
|
-
const $cancelAnimationFrame = window.cancelAnimationFrame
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* resize处理器,此处回调元素v-resize的方法
|
|
54
|
-
* @param event {Event} resizeTrigge的resize事件传递,来自{@link registereResizeHandler}方法中产生的事件源
|
|
55
|
-
* @function
|
|
56
|
-
*/
|
|
57
|
-
function resizeHandler(event) {
|
|
58
|
-
event.__currentTarget__ = this.__container__
|
|
59
|
-
this.__resize__handler__.call(
|
|
60
|
-
this,
|
|
61
|
-
{
|
|
62
|
-
width: this.offsetWidth,
|
|
63
|
-
height: this.offsetHeight
|
|
64
|
-
},
|
|
65
|
-
event
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* 优化resize监听
|
|
71
|
-
* @param event {Event} resizeTrigge的resize事件传递,来自{@link registereResizeHandler}方法中产生的事件源
|
|
72
|
-
* @function
|
|
73
|
-
*/
|
|
74
|
-
function resizeTriggerListener(event) {
|
|
75
|
-
const _resizeTrigger = event.currentTarget || event.srcElement
|
|
76
|
-
if (_resizeTrigger.__requestAnimationFrameID__) {
|
|
77
|
-
$cancelAnimationFrame(_resizeTrigger.__requestAnimationFrameID__)
|
|
78
|
-
}
|
|
79
|
-
_resizeTrigger.__requestAnimationFrameID__ = $requestAnimationFrame(resizeHandler.bind(this, event))
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* 注册resize处理方法
|
|
84
|
-
* @function
|
|
85
|
-
*/
|
|
86
|
-
function registereResizeHandler() {
|
|
87
|
-
if (document.attachEvent) {
|
|
88
|
-
this.__container__.attachEvent('onresize', resizeHandler.bind(this))
|
|
89
|
-
} else {
|
|
90
|
-
this.contentDocument.defaultView.addEventListener('resize', resizeTriggerListener.bind(this))
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* 创建resize真正的触发器
|
|
96
|
-
* @function
|
|
97
|
-
*/
|
|
98
|
-
function createResizeTrigger() {
|
|
99
|
-
const object = document.createElement('object')
|
|
100
|
-
object.setAttribute('aria-hidden', 'true')
|
|
101
|
-
object.setAttribute('tabindex', -1)
|
|
102
|
-
const objectStyle = `
|
|
103
|
-
display: block !important;
|
|
104
|
-
position: absolute !important;
|
|
105
|
-
top: 0 !important;
|
|
106
|
-
left: 0 !important;
|
|
107
|
-
width: 100% !important;
|
|
108
|
-
height: 100% !important;
|
|
109
|
-
overflow: hidden !important;
|
|
110
|
-
pointer-events: none !important;
|
|
111
|
-
z-index: -1 !important;
|
|
112
|
-
opacity: 0 !important;
|
|
113
|
-
`
|
|
114
|
-
object.setAttribute('style', objectStyle)
|
|
115
|
-
object.type = 'text/html'
|
|
116
|
-
return object
|
|
117
|
-
}
|
|
1
|
+
import ResizeObserver from 'resize-observer-polyfill'
|
|
2
|
+
import { utils } from 'sh-tools'
|
|
3
|
+
const throttleTime = 200
|
|
118
4
|
|
|
119
5
|
export default {
|
|
120
|
-
beforeMount(el, binding
|
|
121
|
-
|
|
122
|
-
el.
|
|
123
|
-
el.
|
|
124
|
-
el.__resizeTrigger__.__resize__handler__ = binding.value
|
|
125
|
-
el.__resizeTrigger__.onload = registereResizeHandler
|
|
126
|
-
// 将真正的触发器作为子元素添加到当前元素
|
|
127
|
-
const _isIE = isIE()
|
|
128
|
-
_isIE && el.appendChild(el.__resizeTrigger__)
|
|
129
|
-
el.__resizeTrigger__.data = 'about:blank'
|
|
130
|
-
!_isIE && el.appendChild(el.__resizeTrigger__)
|
|
131
|
-
},
|
|
132
|
-
mounted(el, binding, vnode, oldVnode) {
|
|
133
|
-
if (getComputedStyle(el).position === 'static') {
|
|
134
|
-
el.style.setProperty('position', 'relative', 'important')
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
updated(el, binding, vnode, oldVnode) {
|
|
138
|
-
var inserted = false
|
|
139
|
-
for (var i = 0, length = el.children.length; i < length; i++) {
|
|
140
|
-
if (el.children[i] === el.__resizeTrigger__) {
|
|
141
|
-
inserted = true
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
if (!inserted) {
|
|
145
|
-
var _isIE = isIE()
|
|
146
|
-
_isIE && el.appendChild(el.__resizeTrigger__)
|
|
147
|
-
el.__resizeTrigger__.data = 'about:blank'
|
|
148
|
-
!_isIE && el.appendChild(el.__resizeTrigger__)
|
|
149
|
-
}
|
|
6
|
+
beforeMount(el, binding) {
|
|
7
|
+
const _callback = utils.throttle(binding.value, throttleTime)
|
|
8
|
+
el.__observer__ = new ResizeObserver(_callback)
|
|
9
|
+
el.__observer__.observe(el)
|
|
150
10
|
},
|
|
151
|
-
unmounted(el, binding
|
|
152
|
-
if (
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
el.__resizeTrigger__.contentDocument.defaultView.removeEventListener('resize', resizeTriggerListener)
|
|
156
|
-
el.__resizeTrigger__ = !el.removeChild(el.__resizeTrigger__)
|
|
157
|
-
}
|
|
11
|
+
unmounted(el, binding) {
|
|
12
|
+
if (!el.__observer__) return
|
|
13
|
+
el.__observer__.unobserve(el)
|
|
14
|
+
delete el.__observer__
|
|
158
15
|
}
|
|
159
16
|
}
|
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 globalComponents 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(globalComponents, 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 globalComponents 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(globalComponents, 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,87 +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
|
-
|
|
87
|
-
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
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
<span class="vxe-render--inner" :class="{ 'vxe-render--inner--readonly': !redit, 'form-render': rform, 'td-render': !rform }">
|
|
3
3
|
<template v-if="redit || isEditAll">
|
|
4
4
|
<vxe-checkbox v-model="renderValue" v-bind="rprops" :size="rsize" @change="vxeCheckCallBack" />
|
|
5
|
-
<span style="display: none" v-html="renderText"></span>
|
|
6
5
|
</template>
|
|
7
6
|
<template v-else>
|
|
8
7
|
<vxe-checkbox :model-value="renderText" :disabled="true" :size="rsize" v-bind="rprops" />
|
|
@@ -11,9 +10,19 @@
|
|
|
11
10
|
</template>
|
|
12
11
|
|
|
13
12
|
<script>
|
|
14
|
-
import
|
|
15
|
-
|
|
13
|
+
import { defineComponent, getCurrentInstance } from 'vue'
|
|
14
|
+
import cellProps from '../mixin/cell-props'
|
|
15
|
+
import cellHooks from '../mixin/cell-hooks'
|
|
16
|
+
export default defineComponent({
|
|
16
17
|
name: 'VxeRenderCheckbox',
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
props: cellProps,
|
|
19
|
+
setup(props, context) {
|
|
20
|
+
const { proxy } = getCurrentInstance()
|
|
21
|
+
const useCell = cellHooks(props, context, proxy)
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
...useCell
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
})
|
|
19
28
|
</script>
|
|
@@ -1,36 +1,43 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span class="vxe-render--inner" :class="{ 'form-render': rform, 'td-render': !rform }">
|
|
3
|
-
<template v-if="redit || isEditAll">
|
|
4
|
-
<vxe-checkbox-group v-model="renderValue" v-bind="rprops" :size="rsize" @change="vxeCheckCallBack">
|
|
5
|
-
<vxe-checkbox v-for="checkitem in rprops.options" :key="checkitem.value" :label="checkitem.value" :content="checkitem.label" />
|
|
6
|
-
</vxe-checkbox-group>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<span class="vxe-render--inner" :class="{ 'form-render': rform, 'td-render': !rform }">
|
|
3
|
+
<template v-if="redit || isEditAll">
|
|
4
|
+
<vxe-checkbox-group v-model="renderValue" v-bind="rprops" :size="rsize" @change="vxeCheckCallBack">
|
|
5
|
+
<vxe-checkbox v-for="checkitem in rprops.options" :key="checkitem.value" :label="checkitem.value" :content="checkitem.label" />
|
|
6
|
+
</vxe-checkbox-group>
|
|
7
|
+
</template>
|
|
8
|
+
<template v-else-if="!redit && showType">
|
|
9
|
+
<div v-for="roption in rprops.options" :key="roption">
|
|
10
|
+
<sh-tag v-if="roptionShow(roption)" :color="roption.tagColor || rprops.tagColor" :type="roption.tagType || rprops.tagType">{{ roption.label }}</sh-tag>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
<template v-else>
|
|
14
|
+
<span v-html="renderText"></span>
|
|
15
|
+
</template>
|
|
16
|
+
</span>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import { computed, defineComponent, getCurrentInstance } from 'vue'
|
|
21
|
+
import cellProps from '../mixin/cell-props'
|
|
22
|
+
import cellHooks from '../mixin/cell-hooks'
|
|
23
|
+
export default defineComponent({
|
|
24
|
+
name: 'VxeRenderCheckgroup',
|
|
25
|
+
props: cellProps,
|
|
26
|
+
setup(props, context) {
|
|
27
|
+
const { proxy } = getCurrentInstance()
|
|
28
|
+
const useCell = cellHooks(props, context, proxy)
|
|
29
|
+
|
|
30
|
+
const showType = computed(() => props.rprops.showType === 'tag')
|
|
31
|
+
|
|
32
|
+
const roptionShow = roption => {
|
|
33
|
+
return useCell.renderText.value.split(props.rprops.split).includes(roption.label)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
...useCell,
|
|
38
|
+
showType,
|
|
39
|
+
roptionShow
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
</script>
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
<span class="vxe-render--inner" :class="{ 'form-render': rform, 'td-render': !rform }">
|
|
3
3
|
<template v-if="redit || isEditAll">
|
|
4
4
|
<sh-code-editor v-model="renderValue" v-bind="rprops" @change="vxeInputChange" @blur="vxeBlurCallback"></sh-code-editor>
|
|
5
|
-
<span style="display: none" v-html="renderText"></span>
|
|
6
5
|
</template>
|
|
7
6
|
<template v-else>
|
|
8
7
|
<span>{{ renderText }}</span>
|
|
@@ -11,9 +10,19 @@
|
|
|
11
10
|
</template>
|
|
12
11
|
|
|
13
12
|
<script>
|
|
14
|
-
import
|
|
15
|
-
|
|
13
|
+
import { defineComponent, getCurrentInstance } from 'vue'
|
|
14
|
+
import cellProps from '../mixin/cell-props'
|
|
15
|
+
import cellHooks from '../mixin/cell-hooks'
|
|
16
|
+
export default defineComponent({
|
|
16
17
|
name: 'VxeRenderCode',
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
props: cellProps,
|
|
19
|
+
setup(props, context) {
|
|
20
|
+
const { proxy } = getCurrentInstance()
|
|
21
|
+
const useCell = cellHooks(props, context, proxy)
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
...useCell
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
})
|
|
19
28
|
</script>
|
|
@@ -16,17 +16,20 @@
|
|
|
16
16
|
</template>
|
|
17
17
|
|
|
18
18
|
<script>
|
|
19
|
-
import
|
|
20
|
-
|
|
19
|
+
import { computed, defineComponent, getCurrentInstance } from 'vue'
|
|
20
|
+
import cellProps from '../mixin/cell-props'
|
|
21
|
+
import cellHooks from '../mixin/cell-hooks'
|
|
22
|
+
export default defineComponent({
|
|
21
23
|
name: 'VxeRenderGoption',
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
props: cellProps,
|
|
25
|
+
setup(props, context) {
|
|
26
|
+
const { proxy } = getCurrentInstance()
|
|
27
|
+
const { $vUtils } = proxy
|
|
28
|
+
const useCell = cellHooks(props, context, proxy)
|
|
29
|
+
|
|
30
|
+
const renderBtns = computed(() => {
|
|
28
31
|
let renderBtns = []
|
|
29
|
-
let { btnContain, btnsConfig } =
|
|
32
|
+
let { btnContain, btnsConfig } = props.rprops
|
|
30
33
|
if (btnsConfig && Array.isArray(btnsConfig)) {
|
|
31
34
|
renderBtns = btnsConfig
|
|
32
35
|
}
|
|
@@ -38,19 +41,18 @@ export default {
|
|
|
38
41
|
})
|
|
39
42
|
}
|
|
40
43
|
return renderBtns
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
methods: {
|
|
44
|
+
})
|
|
45
|
+
|
|
44
46
|
// 按钮是否显示条件
|
|
45
|
-
isBtnRender
|
|
46
|
-
if (
|
|
47
|
-
let condition =
|
|
48
|
-
return
|
|
47
|
+
const isBtnRender = renderBtn => {
|
|
48
|
+
if ($vUtils.has(renderBtn, 'condition')) {
|
|
49
|
+
let condition = $vUtils.get(renderBtn, 'condition')
|
|
50
|
+
return $vUtils.calculate(condition, props.rdata)
|
|
49
51
|
}
|
|
50
52
|
return true
|
|
51
|
-
}
|
|
53
|
+
}
|
|
52
54
|
// 规定按钮文字
|
|
53
|
-
getBtnContent
|
|
55
|
+
const getBtnContent = renderBtn => {
|
|
54
56
|
let renderContent = ''
|
|
55
57
|
let renderStatus = ''
|
|
56
58
|
let renderIcon = ''
|
|
@@ -81,14 +83,22 @@ export default {
|
|
|
81
83
|
break
|
|
82
84
|
}
|
|
83
85
|
return { content: renderContent, status: renderStatus, icon: renderIcon }
|
|
84
|
-
}
|
|
86
|
+
}
|
|
85
87
|
// 按钮点击回调
|
|
86
|
-
vxeBtnCallback({ $event }, renderBtn) {
|
|
88
|
+
const vxeBtnCallback = ({ $event }, renderBtn) => {
|
|
87
89
|
$event.stopPropagation()
|
|
88
|
-
let
|
|
89
|
-
let renderBtnObj = Object.assign({},
|
|
90
|
-
|
|
90
|
+
let tableComponent = props.rparams.$table.xegrid || props.rparams.$table
|
|
91
|
+
let renderBtnObj = Object.assign({}, getBtnContent(renderBtn), renderBtn)
|
|
92
|
+
tableComponent.context.emit('option-click', renderBtnObj, props.rparams)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
...useCell,
|
|
97
|
+
renderBtns,
|
|
98
|
+
isBtnRender,
|
|
99
|
+
getBtnContent,
|
|
100
|
+
vxeBtnCallback
|
|
91
101
|
}
|
|
92
102
|
}
|
|
93
|
-
}
|
|
103
|
+
})
|
|
94
104
|
</script>
|