@vxe-ui/plugin-render-element 3.0.0 → 3.0.1
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/LICENSE +20 -20
- package/README.md +154 -154
- package/dist/all.common.js +3 -3
- package/dist/form/index.js +1 -1
- package/dist/index.common.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.min.js +1 -1
- package/dist/table/index.js +1 -1
- package/package.json +73 -73
- package/src/form/index.ts +406 -406
- package/src/index.ts +76 -76
- package/src/table/index.ts +628 -627
- package/types/index.d.ts +12 -12
package/src/index.ts
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
import { defineTableRender } from './table'
|
|
2
|
-
import { defineFormRender } from './form'
|
|
3
|
-
|
|
4
|
-
import type { VxeUIPluginObject, VxeGlobalInterceptorHandles } from 'vxe-pc-ui'
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line no-unused-vars
|
|
7
|
-
let ElementPlus: any
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 检查触发源是否属于目标节点
|
|
11
|
-
*/
|
|
12
|
-
function getEventTargetNode (evnt: any, container: HTMLElement, className: string) {
|
|
13
|
-
let targetElem
|
|
14
|
-
let target = evnt.target
|
|
15
|
-
while (target && target.nodeType && target !== document) {
|
|
16
|
-
if (className && target.className && target.className.split && target.className.split(' ').indexOf(className) > -1) {
|
|
17
|
-
targetElem = target
|
|
18
|
-
} else if (target === container) {
|
|
19
|
-
return { flag: className ? !!targetElem : true, container, targetElem: targetElem }
|
|
20
|
-
}
|
|
21
|
-
target = target.parentNode
|
|
22
|
-
}
|
|
23
|
-
return { flag: false }
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 事件兼容性处理
|
|
28
|
-
*/
|
|
29
|
-
function handleClearEvent (params: VxeGlobalInterceptorHandles.InterceptorClearFilterParams | VxeGlobalInterceptorHandles.InterceptorClearEditParams | VxeGlobalInterceptorHandles.InterceptorClearAreasParams) {
|
|
30
|
-
const { $event } = params
|
|
31
|
-
const bodyElem = document.body
|
|
32
|
-
if (
|
|
33
|
-
// 远程搜索
|
|
34
|
-
getEventTargetNode($event, bodyElem, 'el-autocomplete-suggestion').flag ||
|
|
35
|
-
// 下拉框
|
|
36
|
-
getEventTargetNode($event, bodyElem, 'el-select-dropdown').flag ||
|
|
37
|
-
// 级联
|
|
38
|
-
getEventTargetNode($event, bodyElem, 'el-cascader__dropdown').flag ||
|
|
39
|
-
getEventTargetNode($event, bodyElem, 'el-cascader-menus').flag ||
|
|
40
|
-
// 日期
|
|
41
|
-
getEventTargetNode($event, bodyElem, 'el-time-panel').flag ||
|
|
42
|
-
getEventTargetNode($event, bodyElem, 'el-picker-panel').flag ||
|
|
43
|
-
// 颜色
|
|
44
|
-
getEventTargetNode($event, bodyElem, 'el-color-dropdown').flag
|
|
45
|
-
) {
|
|
46
|
-
return false
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export const VxeUIPluginRenderElement: VxeUIPluginObject = {
|
|
51
|
-
install (VxeUI, options?: {
|
|
52
|
-
ElementPlus?: any
|
|
53
|
-
}) {
|
|
54
|
-
ElementPlus = options ? options.ElementPlus : {}
|
|
55
|
-
|
|
56
|
-
// 检查版本
|
|
57
|
-
if (!/^(3)\./.test(VxeUI.uiVersion)) {
|
|
58
|
-
console.error('[
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
defineTableRender(VxeUI)
|
|
62
|
-
defineFormRender(VxeUI)
|
|
63
|
-
|
|
64
|
-
VxeUI.interceptor.add('event.clearFilter', handleClearEvent)
|
|
65
|
-
VxeUI.interceptor.add('event.clearEdit', handleClearEvent)
|
|
66
|
-
VxeUI.interceptor.add('event.clearAreas', handleClearEvent)
|
|
67
|
-
// 兼容老版本
|
|
68
|
-
VxeUI.interceptor.add('event.clearActived', handleClearEvent)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (typeof window !== 'undefined' && window.VxeUI && window.VxeUI.use) {
|
|
73
|
-
window.VxeUI.use(VxeUIPluginRenderElement)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export default VxeUIPluginRenderElement
|
|
1
|
+
import { defineTableRender } from './table'
|
|
2
|
+
import { defineFormRender } from './form'
|
|
3
|
+
|
|
4
|
+
import type { VxeUIPluginObject, VxeGlobalInterceptorHandles } from 'vxe-pc-ui'
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line no-unused-vars
|
|
7
|
+
let ElementPlus: any
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 检查触发源是否属于目标节点
|
|
11
|
+
*/
|
|
12
|
+
function getEventTargetNode (evnt: any, container: HTMLElement, className: string) {
|
|
13
|
+
let targetElem
|
|
14
|
+
let target = evnt.target
|
|
15
|
+
while (target && target.nodeType && target !== document) {
|
|
16
|
+
if (className && target.className && target.className.split && target.className.split(' ').indexOf(className) > -1) {
|
|
17
|
+
targetElem = target
|
|
18
|
+
} else if (target === container) {
|
|
19
|
+
return { flag: className ? !!targetElem : true, container, targetElem: targetElem }
|
|
20
|
+
}
|
|
21
|
+
target = target.parentNode
|
|
22
|
+
}
|
|
23
|
+
return { flag: false }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 事件兼容性处理
|
|
28
|
+
*/
|
|
29
|
+
function handleClearEvent (params: VxeGlobalInterceptorHandles.InterceptorClearFilterParams | VxeGlobalInterceptorHandles.InterceptorClearEditParams | VxeGlobalInterceptorHandles.InterceptorClearAreasParams) {
|
|
30
|
+
const { $event } = params
|
|
31
|
+
const bodyElem = document.body
|
|
32
|
+
if (
|
|
33
|
+
// 远程搜索
|
|
34
|
+
getEventTargetNode($event, bodyElem, 'el-autocomplete-suggestion').flag ||
|
|
35
|
+
// 下拉框
|
|
36
|
+
getEventTargetNode($event, bodyElem, 'el-select-dropdown').flag ||
|
|
37
|
+
// 级联
|
|
38
|
+
getEventTargetNode($event, bodyElem, 'el-cascader__dropdown').flag ||
|
|
39
|
+
getEventTargetNode($event, bodyElem, 'el-cascader-menus').flag ||
|
|
40
|
+
// 日期
|
|
41
|
+
getEventTargetNode($event, bodyElem, 'el-time-panel').flag ||
|
|
42
|
+
getEventTargetNode($event, bodyElem, 'el-picker-panel').flag ||
|
|
43
|
+
// 颜色
|
|
44
|
+
getEventTargetNode($event, bodyElem, 'el-color-dropdown').flag
|
|
45
|
+
) {
|
|
46
|
+
return false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const VxeUIPluginRenderElement: VxeUIPluginObject = {
|
|
51
|
+
install (VxeUI, options?: {
|
|
52
|
+
ElementPlus?: any
|
|
53
|
+
}) {
|
|
54
|
+
ElementPlus = options ? options.ElementPlus : {}
|
|
55
|
+
|
|
56
|
+
// 检查版本
|
|
57
|
+
if (!/^(3)\./.test(VxeUI.uiVersion)) {
|
|
58
|
+
console.error('[VUE_APP_VXE_PLUGIN_VERSION] Requires VUE_APP_VXE_TABLE_VERSION+ version. VUE_APP_VXE_PLUGIN_DESCRIBE')
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
defineTableRender(VxeUI)
|
|
62
|
+
defineFormRender(VxeUI)
|
|
63
|
+
|
|
64
|
+
VxeUI.interceptor.add('event.clearFilter', handleClearEvent)
|
|
65
|
+
VxeUI.interceptor.add('event.clearEdit', handleClearEvent)
|
|
66
|
+
VxeUI.interceptor.add('event.clearAreas', handleClearEvent)
|
|
67
|
+
// 兼容老版本
|
|
68
|
+
VxeUI.interceptor.add('event.clearActived', handleClearEvent)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (typeof window !== 'undefined' && window.VxeUI && window.VxeUI.use) {
|
|
73
|
+
window.VxeUI.use(VxeUIPluginRenderElement)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default VxeUIPluginRenderElement
|