vxe-design 0.0.1 → 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 +21 -0
- package/README.md +48 -0
- package/es/components.js +28 -0
- package/es/flow-design/index.js +15 -0
- package/es/flow-design/src/flow-design.js +50 -0
- package/es/flow-design/src/flow-view.js +50 -0
- package/es/flow-design/style.css +0 -0
- package/es/flow-design/style.min.css +0 -0
- package/es/flow-view/index.js +15 -0
- package/es/flow-view/style.css +0 -0
- package/es/flow-view/style.min.css +0 -0
- package/es/form-design/index.js +15 -0
- package/es/form-design/src/form-design.js +96 -0
- package/es/form-design/src/form-view.js +54 -0
- package/es/form-design/style.css +831 -0
- package/es/form-design/style.min.css +1 -0
- package/es/form-view/index.js +15 -0
- package/es/form-view/style.css +3 -0
- package/es/form-view/style.min.css +1 -0
- package/es/index.esm.js +6 -0
- package/es/list-design/index.js +15 -0
- package/es/list-design/src/list-design.js +55 -0
- package/es/list-design/src/list-view.js +59 -0
- package/es/list-design/style.css +332 -0
- package/es/list-design/style.min.css +1 -0
- package/es/list-view/index.js +15 -0
- package/es/list-view/style.css +15 -0
- package/es/list-view/style.min.css +1 -0
- package/es/style.css +1 -0
- package/es/style.min.css +1 -0
- package/es/ui/index.js +40 -0
- package/es/ui/src/comp.js +1 -0
- package/es/ui/src/depend.js +14 -0
- package/es/ui/src/dom.js +221 -0
- package/es/ui/src/log.js +15 -0
- package/es/ui/src/utils.js +41 -0
- package/es/ui/src/vn.js +45 -0
- package/es/ui/style.css +0 -0
- package/es/ui/style.min.css +0 -0
- package/es/vxe-flow-design/index.js +3 -0
- package/es/vxe-flow-design/style.css +0 -0
- package/es/vxe-flow-design/style.min.css +0 -0
- package/es/vxe-flow-view/index.js +3 -0
- package/es/vxe-flow-view/style.css +0 -0
- package/es/vxe-flow-view/style.min.css +0 -0
- package/es/vxe-form-design/index.js +3 -0
- package/es/vxe-form-design/style.css +831 -0
- package/es/vxe-form-design/style.min.css +1 -0
- package/es/vxe-form-view/index.js +3 -0
- package/es/vxe-form-view/style.css +3 -0
- package/es/vxe-form-view/style.min.css +1 -0
- package/es/vxe-list-design/index.js +3 -0
- package/es/vxe-list-design/style.css +332 -0
- package/es/vxe-list-design/style.min.css +1 -0
- package/es/vxe-list-view/index.js +3 -0
- package/es/vxe-list-view/style.css +15 -0
- package/es/vxe-list-view/style.min.css +1 -0
- package/es/vxe-ui/index.js +3 -0
- package/es/vxe-ui/style.css +0 -0
- package/es/vxe-ui/style.min.css +0 -0
- package/helper/vetur/attributes.json +1 -0
- package/helper/vetur/tags.json +1 -0
- package/lib/components.js +102 -0
- package/lib/components.min.js +1 -0
- package/lib/flow-design/index.js +22 -0
- package/lib/flow-design/index.min.js +1 -0
- package/lib/flow-design/src/flow-design.js +59 -0
- package/lib/flow-design/src/flow-design.min.js +1 -0
- package/lib/flow-design/src/flow-view.js +59 -0
- package/lib/flow-design/src/flow-view.min.js +1 -0
- package/lib/flow-design/style/index.js +1 -0
- package/lib/flow-design/style/style.css +0 -0
- package/lib/flow-design/style/style.min.css +0 -0
- package/lib/flow-view/index.js +22 -0
- package/lib/flow-view/index.min.js +1 -0
- package/lib/flow-view/style/index.js +1 -0
- package/lib/flow-view/style/style.css +0 -0
- package/lib/flow-view/style/style.min.css +0 -0
- package/lib/form-design/index.js +22 -0
- package/lib/form-design/index.min.js +1 -0
- package/lib/form-design/src/form-design.js +120 -0
- package/lib/form-design/src/form-design.min.js +1 -0
- package/lib/form-design/src/form-view.js +63 -0
- package/lib/form-design/src/form-view.min.js +1 -0
- package/lib/form-design/style/index.js +1 -0
- package/lib/form-design/style/style.css +831 -0
- package/lib/form-design/style/style.min.css +1 -0
- package/lib/form-view/index.js +22 -0
- package/lib/form-view/index.min.js +1 -0
- package/lib/form-view/style/index.js +1 -0
- package/lib/form-view/style/style.css +3 -0
- package/lib/form-view/style/style.min.css +1 -0
- package/lib/index.common.js +25 -0
- package/lib/index.umd.js +6236 -0
- package/lib/index.umd.min.js +1 -0
- package/lib/list-design/index.js +22 -0
- package/lib/list-design/index.min.js +1 -0
- package/lib/list-design/src/list-design.js +64 -0
- package/lib/list-design/src/list-design.min.js +1 -0
- package/lib/list-design/src/list-view.js +67 -0
- package/lib/list-design/src/list-view.min.js +1 -0
- package/lib/list-design/style/index.js +1 -0
- package/lib/list-design/style/style.css +332 -0
- package/lib/list-design/style/style.min.css +1 -0
- package/lib/list-view/index.js +22 -0
- package/lib/list-view/index.min.js +1 -0
- package/lib/list-view/style/index.js +1 -0
- package/lib/list-view/style/style.css +15 -0
- package/lib/list-view/style/style.min.css +1 -0
- package/lib/style.css +1 -0
- package/lib/style.min.css +1 -0
- package/lib/ui/index.js +52 -0
- package/lib/ui/index.min.js +1 -0
- package/lib/ui/src/comp.js +9 -0
- package/lib/ui/src/comp.min.js +1 -0
- package/lib/ui/src/depend.js +19 -0
- package/lib/ui/src/depend.min.js +1 -0
- package/lib/ui/src/dom.js +266 -0
- package/lib/ui/src/dom.min.js +1 -0
- package/lib/ui/src/log.js +22 -0
- package/lib/ui/src/log.min.js +1 -0
- package/lib/ui/src/utils.js +56 -0
- package/lib/ui/src/utils.min.js +1 -0
- package/lib/ui/src/vn.js +57 -0
- package/lib/ui/src/vn.min.js +1 -0
- package/lib/ui/style/index.js +1 -0
- package/lib/ui/style/style.css +0 -0
- package/lib/ui/style/style.min.css +0 -0
- package/lib/vxe-flow-design/index.js +22 -0
- package/lib/vxe-flow-design/index.min.js +1 -0
- package/lib/vxe-flow-design/style/index.js +1 -0
- package/lib/vxe-flow-design/style/style.css +0 -0
- package/lib/vxe-flow-design/style/style.min.css +0 -0
- package/lib/vxe-flow-view/index.js +22 -0
- package/lib/vxe-flow-view/index.min.js +1 -0
- package/lib/vxe-flow-view/style/index.js +1 -0
- package/lib/vxe-flow-view/style/style.css +0 -0
- package/lib/vxe-flow-view/style/style.min.css +0 -0
- package/lib/vxe-form-design/index.js +22 -0
- package/lib/vxe-form-design/index.min.js +1 -0
- package/lib/vxe-form-design/style/index.js +1 -0
- package/lib/vxe-form-design/style/style.css +831 -0
- package/lib/vxe-form-design/style/style.min.css +1 -0
- package/lib/vxe-form-view/index.js +22 -0
- package/lib/vxe-form-view/index.min.js +1 -0
- package/lib/vxe-form-view/style/index.js +1 -0
- package/lib/vxe-form-view/style/style.css +3 -0
- package/lib/vxe-form-view/style/style.min.css +1 -0
- package/lib/vxe-list-design/index.js +22 -0
- package/lib/vxe-list-design/index.min.js +1 -0
- package/lib/vxe-list-design/style/index.js +1 -0
- package/lib/vxe-list-design/style/style.css +332 -0
- package/lib/vxe-list-design/style/style.min.css +1 -0
- package/lib/vxe-list-view/index.js +22 -0
- package/lib/vxe-list-view/index.min.js +1 -0
- package/lib/vxe-list-view/style/index.js +1 -0
- package/lib/vxe-list-view/style/style.css +15 -0
- package/lib/vxe-list-view/style/style.min.css +1 -0
- package/lib/vxe-ui/index.js +22 -0
- package/lib/vxe-ui/index.min.js +1 -0
- package/lib/vxe-ui/style/index.js +1 -0
- package/lib/vxe-ui/style/style.css +0 -0
- package/lib/vxe-ui/style/style.min.css +0 -0
- package/package.json +57 -25
- package/packages/components.ts +38 -0
- package/packages/flow-design/index.ts +19 -0
- package/packages/flow-design/src/flow-design.ts +60 -0
- package/packages/flow-design/src/flow-view.ts +60 -0
- package/packages/flow-view/index.ts +19 -0
- package/packages/form-design/index.ts +19 -0
- package/packages/form-design/src/form-design.ts +105 -0
- package/packages/form-design/src/form-view.ts +63 -0
- package/packages/form-view/index.ts +19 -0
- package/packages/index.ts +8 -0
- package/packages/list-design/index.ts +19 -0
- package/packages/list-design/src/list-design.ts +64 -0
- package/packages/list-design/src/list-view.ts +68 -0
- package/packages/list-view/index.ts +19 -0
- package/packages/ui/index.ts +49 -0
- package/packages/ui/src/comp.ts +3 -0
- package/packages/ui/src/depend.ts +14 -0
- package/packages/ui/src/dom.ts +243 -0
- package/packages/ui/src/log.ts +19 -0
- package/packages/ui/src/utils.ts +51 -0
- package/packages/ui/src/vn.ts +53 -0
- package/styles/all.scss +8 -0
- package/styles/base.scss +2 -0
- package/styles/components/flow-design.scss +0 -0
- package/styles/components/flow-view.scss +0 -0
- package/styles/components/form-design.scss +302 -0
- package/styles/components/form-view.scss +3 -0
- package/styles/components/list-design.scss +116 -0
- package/styles/components/list-item/list-item-all.scss +3 -0
- package/styles/components/list-item/list-item-field-column.scss +19 -0
- package/styles/components/list-item/list-item-field-configs.scss +43 -0
- package/styles/components/list-item/list-item-field-search.scss +81 -0
- package/styles/components/list-view.scss +16 -0
- package/styles/components/ui.scss +0 -0
- package/styles/components/widget-form/widget-form-all.scss +6 -0
- package/styles/components/widget-form/widget-form-empty.scss +7 -0
- package/styles/components/widget-form/widget-form-input.scss +0 -0
- package/styles/components/widget-form/widget-form-row.scss +88 -0
- package/styles/components/widget-form/widget-form-select.scss +0 -0
- package/styles/components/widget-form/widget-form-subtable.scss +204 -0
- package/styles/components/widget-form/widget-form-textarea.scss +0 -0
- package/styles/components/widget-item/widget-item-all.scss +4 -0
- package/styles/components/widget-item/widget-item-data-source.scss +110 -0
- package/styles/components/widget-item/widget-item-devices.scss +4 -0
- package/styles/components/widget-item/widget-item-layout.scss +87 -0
- package/styles/components/widget-item/widget-item-prop-list.scss +49 -0
- package/styles/cssvar.scss +0 -0
- package/styles/helpers/baseMixin.scss +105 -0
- package/styles/helpers/baseVar.scss +4 -0
- package/styles/helpers/placement.scss +39 -0
- package/styles/theme/dark.scss +9 -0
- package/styles/theme/light.scss +11 -0
- package/styles/variable.scss +9 -0
- package/types/all.d.ts +59 -0
- package/types/index.d.ts +4 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { VueConstructor } from 'vue'
|
|
2
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
3
|
+
import { checkDependVersion } from '../ui/src/depend'
|
|
4
|
+
import VxeListViewComponent from '../list-design/src/list-view'
|
|
5
|
+
|
|
6
|
+
export const VxeListView = Object.assign(VxeListViewComponent, {
|
|
7
|
+
install (app: VueConstructor) {
|
|
8
|
+
checkDependVersion()
|
|
9
|
+
app.component(VxeListViewComponent.name as string, VxeListViewComponent)
|
|
10
|
+
}
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
if (VxeUI.dynamicApp) {
|
|
14
|
+
VxeUI.dynamicApp.use(VxeListView)
|
|
15
|
+
}
|
|
16
|
+
VxeUI.component(VxeListViewComponent)
|
|
17
|
+
|
|
18
|
+
export const ListView = VxeListView
|
|
19
|
+
export default VxeListView
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
2
|
+
|
|
3
|
+
const { setConfig, setIcon } = VxeUI
|
|
4
|
+
|
|
5
|
+
VxeUI.designVersion = process.env.VUE_APP_VXE_VERSION as string
|
|
6
|
+
|
|
7
|
+
setConfig({
|
|
8
|
+
formDesign: {
|
|
9
|
+
height: 400,
|
|
10
|
+
showHeader: true,
|
|
11
|
+
showPc: true,
|
|
12
|
+
showStyleSetting: false
|
|
13
|
+
},
|
|
14
|
+
formView: {},
|
|
15
|
+
listDesign: {
|
|
16
|
+
height: 400,
|
|
17
|
+
showPc: true
|
|
18
|
+
},
|
|
19
|
+
listView: {}
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const iconPrefix = 'vxe-icon-'
|
|
23
|
+
|
|
24
|
+
setIcon({
|
|
25
|
+
// form-design
|
|
26
|
+
FORM_DESIGN_STYLE_SETTING: iconPrefix + 'layout',
|
|
27
|
+
FORM_DESIGN_PROPS_PC: iconPrefix + 'pc',
|
|
28
|
+
FORM_DESIGN_PROPS_MOBILE: iconPrefix + 'mobile',
|
|
29
|
+
FORM_DESIGN_PROPS_ADD: iconPrefix + 'add',
|
|
30
|
+
FORM_DESIGN_PROPS_EDIT: iconPrefix + 'edit',
|
|
31
|
+
FORM_DESIGN_WIDGET_ADD: iconPrefix + 'square-plus-fill',
|
|
32
|
+
FORM_DESIGN_WIDGET_COPY: iconPrefix + 'copy',
|
|
33
|
+
FORM_DESIGN_WIDGET_DELETE: iconPrefix + 'delete',
|
|
34
|
+
FORM_DESIGN_WIDGET_SWAP_LR: iconPrefix + 'swap',
|
|
35
|
+
FORM_DESIGN_WIDGET_OPTION_DELETE: iconPrefix + 'delete',
|
|
36
|
+
FORM_DESIGN_WIDGET_OPTION_EXPAND_OPEN: iconPrefix + 'square-plus',
|
|
37
|
+
FORM_DESIGN_WIDGET_OPTION_EXPAND_CLOSE: iconPrefix + 'square-minus',
|
|
38
|
+
|
|
39
|
+
// list-design
|
|
40
|
+
LIST_DESIGN_FIELD_SETTING: iconPrefix + 'custom-column',
|
|
41
|
+
LIST_DESIGN_LIST_SETTING: iconPrefix + 'menu',
|
|
42
|
+
LIST_DESIGN_LIST_SETTING_SEARCH_DELETE: iconPrefix + 'delete',
|
|
43
|
+
LIST_DESIGN_LIST_SETTING_ACTIVE_DELETE: iconPrefix + 'delete'
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
VxeUI
|
|
48
|
+
}
|
|
49
|
+
export default VxeUI
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
2
|
+
import { errLog } from './log'
|
|
3
|
+
|
|
4
|
+
export function checkDependVersion () {
|
|
5
|
+
const pVersion = 3
|
|
6
|
+
const sVersion = 13
|
|
7
|
+
if (VxeUI.checkVersion) {
|
|
8
|
+
if (!VxeUI.checkVersion(VxeUI.tableVersion, pVersion, sVersion)) {
|
|
9
|
+
errLog('vxe.error.errorVersion', [`vxe-table@${VxeUI.tableVersion || '?'}`, `vxe-table v${pVersion}.${sVersion}+`])
|
|
10
|
+
}
|
|
11
|
+
} else {
|
|
12
|
+
errLog(`Requires vxe-table v${pVersion}.${sVersion}+`)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
|
|
3
|
+
let tpImgEl: HTMLImageElement | undefined
|
|
4
|
+
|
|
5
|
+
export function initTpImg () {
|
|
6
|
+
if (!tpImgEl) {
|
|
7
|
+
tpImgEl = new Image()
|
|
8
|
+
tpImgEl.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='
|
|
9
|
+
}
|
|
10
|
+
return tpImgEl
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function getTpImg () {
|
|
14
|
+
if (!tpImgEl) {
|
|
15
|
+
return initTpImg()
|
|
16
|
+
}
|
|
17
|
+
return tpImgEl
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const reClsMap: { [key: string]: any } = {}
|
|
21
|
+
|
|
22
|
+
function getClsRE (cls: any) {
|
|
23
|
+
if (!reClsMap[cls]) {
|
|
24
|
+
reClsMap[cls] = new RegExp(`(?:^|\\s)${cls}(?!\\S)`, 'g')
|
|
25
|
+
}
|
|
26
|
+
return reClsMap[cls]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function getNodeOffset (elem: any, container: any, rest: any): any {
|
|
30
|
+
if (elem) {
|
|
31
|
+
const parentElem = elem.parentNode
|
|
32
|
+
rest.top += elem.offsetTop
|
|
33
|
+
rest.left += elem.offsetLeft
|
|
34
|
+
if (parentElem && parentElem !== document.documentElement && parentElem !== document.body) {
|
|
35
|
+
rest.top -= parentElem.scrollTop
|
|
36
|
+
rest.left -= parentElem.scrollLeft
|
|
37
|
+
}
|
|
38
|
+
if (container && (elem === container || elem.offsetParent === container) ? 0 : elem.offsetParent) {
|
|
39
|
+
return getNodeOffset(elem.offsetParent, container, rest)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return rest
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function isPx (val: any) {
|
|
46
|
+
return val && /^\d+(\.\d+)?(px)?$/.test(val)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function isScale (val: any) {
|
|
50
|
+
return val && /^\d+(\.\d+)?%$/.test(val)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function hasClass (elem: any, cls: any) {
|
|
54
|
+
return !!(elem && elem.className && elem.className.match && elem.className.match(getClsRE(cls)))
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function removeClass (elem: any, cls: any) {
|
|
58
|
+
if (elem && hasClass(elem, cls)) {
|
|
59
|
+
elem.className = elem.className.replace(getClsRE(cls), '')
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function addClass (elem: any, cls: string) {
|
|
64
|
+
if (elem && !hasClass(elem, cls)) {
|
|
65
|
+
removeClass(elem, cls)
|
|
66
|
+
elem.className = `${elem.className} ${cls}`
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function hasControlKey (evnt: KeyboardEvent | MouseEvent | DragEvent) {
|
|
71
|
+
return evnt.ctrlKey || evnt.metaKey
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function toCssUnit (val?: number | string | null, unit = 'px') {
|
|
75
|
+
if (XEUtils.isNumber(val) || /^\d+$/.test(`${val}`)) {
|
|
76
|
+
return `${val}${unit}`
|
|
77
|
+
}
|
|
78
|
+
return `${val || ''}`
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function getDomNode () {
|
|
82
|
+
const documentElement = document.documentElement
|
|
83
|
+
const bodyElem = document.body
|
|
84
|
+
return {
|
|
85
|
+
scrollTop: documentElement.scrollTop || bodyElem.scrollTop,
|
|
86
|
+
scrollLeft: documentElement.scrollLeft || bodyElem.scrollLeft,
|
|
87
|
+
visibleHeight: documentElement.clientHeight || bodyElem.clientHeight,
|
|
88
|
+
visibleWidth: documentElement.clientWidth || bodyElem.clientWidth
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 检查触发源是否属于目标节点
|
|
94
|
+
*/
|
|
95
|
+
export function getEventTargetNode (evnt: any, container: any, queryCls?: string, queryMethod?: (target: Element) => boolean) {
|
|
96
|
+
let targetElem
|
|
97
|
+
let target = (evnt.target.shadowRoot && evnt.composed) ? (evnt.composedPath()[0] || evnt.target) : evnt.target
|
|
98
|
+
while (target && target.nodeType && target !== document) {
|
|
99
|
+
if (queryCls && hasClass(target, queryCls) && (!queryMethod || queryMethod(target))) {
|
|
100
|
+
targetElem = target
|
|
101
|
+
} else if (target === container) {
|
|
102
|
+
return { flag: queryCls ? !!targetElem : true, container, targetElem: targetElem }
|
|
103
|
+
}
|
|
104
|
+
target = target.parentNode
|
|
105
|
+
}
|
|
106
|
+
return { flag: false }
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* 获取元素相对于 document 的位置
|
|
111
|
+
*/
|
|
112
|
+
export function getOffsetPos (elem: any, container: any) {
|
|
113
|
+
return getNodeOffset(elem, container, { left: 0, top: 0 })
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function getAbsolutePos (elem: any) {
|
|
117
|
+
const bounding = elem.getBoundingClientRect()
|
|
118
|
+
const boundingTop = bounding.top
|
|
119
|
+
const boundingLeft = bounding.left
|
|
120
|
+
const { scrollTop, scrollLeft, visibleHeight, visibleWidth } = getDomNode()
|
|
121
|
+
return { boundingTop, top: scrollTop + boundingTop, boundingLeft, left: scrollLeft + boundingLeft, visibleHeight, visibleWidth }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const scrollIntoViewIfNeeded = 'scrollIntoViewIfNeeded'
|
|
125
|
+
const scrollIntoView = 'scrollIntoView'
|
|
126
|
+
|
|
127
|
+
export function scrollToView (elem: any) {
|
|
128
|
+
if (elem) {
|
|
129
|
+
if (elem[scrollIntoViewIfNeeded]) {
|
|
130
|
+
elem[scrollIntoViewIfNeeded]()
|
|
131
|
+
} else if (elem[scrollIntoView]) {
|
|
132
|
+
elem[scrollIntoView]()
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function triggerEvent (targetElem: Element, type: string) {
|
|
138
|
+
if (targetElem) {
|
|
139
|
+
targetElem.dispatchEvent(new Event(type))
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function isNodeElement (elem: any): elem is HTMLElement {
|
|
144
|
+
return elem && elem.nodeType === 1
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function updatePanelPlacement (targetElem: HTMLElement | null | undefined, panelElem: HTMLElement | null | undefined, options: {
|
|
148
|
+
placement?: '' | 'top' | 'bottom' | null
|
|
149
|
+
teleportTo?: boolean
|
|
150
|
+
marginSize?: number
|
|
151
|
+
}) {
|
|
152
|
+
const { placement, teleportTo, marginSize } = Object.assign({ teleportTo: false, marginSize: 32 }, options)
|
|
153
|
+
let panelPlacement: 'top' | 'bottom' = 'bottom'
|
|
154
|
+
let top: number | '' = ''
|
|
155
|
+
let bottom: number | '' = ''
|
|
156
|
+
let left: number | '' = ''
|
|
157
|
+
const right: number | '' = ''
|
|
158
|
+
let minWidth: number | '' = ''
|
|
159
|
+
const stys: Record<string, string> = {}
|
|
160
|
+
if (panelElem && targetElem) {
|
|
161
|
+
const documentElement = document.documentElement
|
|
162
|
+
const bodyElem = document.body
|
|
163
|
+
const targetHeight = targetElem.offsetHeight
|
|
164
|
+
const panelHeight = panelElem.offsetHeight
|
|
165
|
+
const panelWidth = panelElem.offsetWidth
|
|
166
|
+
|
|
167
|
+
const panelRect = panelElem.getBoundingClientRect()
|
|
168
|
+
const targetRect = targetElem.getBoundingClientRect()
|
|
169
|
+
const visibleHeight = documentElement.clientHeight || bodyElem.clientHeight
|
|
170
|
+
const visibleWidth = documentElement.clientWidth || bodyElem.clientWidth
|
|
171
|
+
minWidth = targetElem.offsetWidth
|
|
172
|
+
if (teleportTo) {
|
|
173
|
+
left = targetRect.left
|
|
174
|
+
top = targetRect.top + targetHeight
|
|
175
|
+
if (placement === 'top') {
|
|
176
|
+
panelPlacement = 'top'
|
|
177
|
+
top = targetRect.top - panelHeight
|
|
178
|
+
} else if (!placement) {
|
|
179
|
+
// 如果下面不够放,则向上
|
|
180
|
+
if (top + panelHeight + marginSize > visibleHeight) {
|
|
181
|
+
panelPlacement = 'top'
|
|
182
|
+
top = targetRect.top - panelHeight
|
|
183
|
+
}
|
|
184
|
+
// 如果上面不够放,则向下(优先)
|
|
185
|
+
if (top < marginSize) {
|
|
186
|
+
panelPlacement = 'bottom'
|
|
187
|
+
top = targetRect.top + targetHeight
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
// 如果溢出右边
|
|
191
|
+
if (left + panelWidth + marginSize > visibleWidth) {
|
|
192
|
+
left -= left + panelWidth + marginSize - visibleWidth
|
|
193
|
+
}
|
|
194
|
+
// 如果溢出左边
|
|
195
|
+
if (left < marginSize) {
|
|
196
|
+
left = marginSize
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
if (placement === 'top') {
|
|
200
|
+
panelPlacement = 'top'
|
|
201
|
+
bottom = targetHeight
|
|
202
|
+
} else if (!placement) {
|
|
203
|
+
// 如果下面不够放,则向上
|
|
204
|
+
top = targetHeight
|
|
205
|
+
if (targetRect.top + targetRect.height + marginSize > visibleHeight) {
|
|
206
|
+
// 如果上面不够放,则向下(优先)
|
|
207
|
+
if (targetRect.top - targetHeight - panelHeight > marginSize) {
|
|
208
|
+
panelPlacement = 'top'
|
|
209
|
+
top = ''
|
|
210
|
+
bottom = targetHeight
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// 是否超出右侧
|
|
215
|
+
if (panelRect.left + panelRect.width + marginSize > visibleWidth) {
|
|
216
|
+
left = -(panelRect.left + panelRect.width + marginSize - visibleWidth)
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (XEUtils.isNumber(top)) {
|
|
220
|
+
stys.top = toCssUnit(top)
|
|
221
|
+
}
|
|
222
|
+
if (XEUtils.isNumber(bottom)) {
|
|
223
|
+
stys.bottom = toCssUnit(bottom)
|
|
224
|
+
}
|
|
225
|
+
if (XEUtils.isNumber(left)) {
|
|
226
|
+
stys.left = toCssUnit(left)
|
|
227
|
+
}
|
|
228
|
+
if (XEUtils.isNumber(right)) {
|
|
229
|
+
stys.right = toCssUnit(right)
|
|
230
|
+
}
|
|
231
|
+
if (XEUtils.isNumber(minWidth)) {
|
|
232
|
+
stys.minWidth = toCssUnit(minWidth)
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return {
|
|
236
|
+
top: top || 0,
|
|
237
|
+
bottom: bottom || 0,
|
|
238
|
+
left: left || 0,
|
|
239
|
+
right: right || 0,
|
|
240
|
+
style: stys,
|
|
241
|
+
placement: panelPlacement
|
|
242
|
+
}
|
|
243
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
2
|
+
|
|
3
|
+
const { log } = VxeUI
|
|
4
|
+
|
|
5
|
+
const designVersion = `design v${process.env.VUE_APP_VXE_VERSION}`
|
|
6
|
+
|
|
7
|
+
export function createComponentLog (name: string) {
|
|
8
|
+
const uiVersion = VxeUI.uiVersion ? `ui v${VxeUI.uiVersion}` : ''
|
|
9
|
+
const tableVersion = VxeUI.tableVersion ? `table v${VxeUI.tableVersion}` : ''
|
|
10
|
+
const ganttVersion = VxeUI.ganttVersion ? `gantt v${VxeUI.ganttVersion}` : ''
|
|
11
|
+
const versionInfo = [uiVersion, tableVersion, ganttVersion, designVersion].join(' ')
|
|
12
|
+
return {
|
|
13
|
+
warnLog: log.create('warn', versionInfo + '] [' + name),
|
|
14
|
+
errLog: log.create('error', versionInfo + '] [' + name)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const warnLog = log.create('warn', designVersion)
|
|
19
|
+
export const errLog = log.create('error', designVersion)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
3
|
+
import DomZIndex from 'dom-zindex'
|
|
4
|
+
|
|
5
|
+
const { getConfig } = VxeUI
|
|
6
|
+
|
|
7
|
+
export function isEnableConf (conf: any): boolean {
|
|
8
|
+
return conf && conf.enabled !== false
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function nextZIndex () {
|
|
12
|
+
return DomZIndex.getNext()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function getLastZIndex () {
|
|
16
|
+
return DomZIndex.getCurrent()
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function nextSubZIndex () {
|
|
20
|
+
return DomZIndex.getSubNext()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getSubLastZIndex () {
|
|
24
|
+
return DomZIndex.getSubCurrent()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getGlobalDefaultConfig (value: any, globalValue: any) {
|
|
28
|
+
if (XEUtils.eqNull(value)) {
|
|
29
|
+
return globalValue
|
|
30
|
+
}
|
|
31
|
+
return value
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function getFuncText (content: string | number | boolean | null | undefined, args?: any) {
|
|
35
|
+
if (content) {
|
|
36
|
+
const translate = getConfig().translate
|
|
37
|
+
return XEUtils.toValueString(translate ? translate('' + content, args) : content)
|
|
38
|
+
}
|
|
39
|
+
return ''
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 判断值为:'' | null | undefined 时都属于空值
|
|
44
|
+
*/
|
|
45
|
+
export function eqEmptyValue (cellValue: any) {
|
|
46
|
+
return cellValue === null || cellValue === undefined || cellValue === ''
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function handleBooleanDefaultValue (value: boolean | undefined | null) {
|
|
50
|
+
return XEUtils.isBoolean(value) ? value : null
|
|
51
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
|
|
3
|
+
import type { CombinedVueInstance } from 'vue/types/vue'
|
|
4
|
+
import type { VxeComponentSlotType } from 'vxe-pc-ui'
|
|
5
|
+
|
|
6
|
+
export function getOnName (type: string) {
|
|
7
|
+
return XEUtils.kebabCase(type)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function getModelEvent (name: string) {
|
|
11
|
+
switch (name) {
|
|
12
|
+
case 'VxeInput':
|
|
13
|
+
case 'VxeTextarea':
|
|
14
|
+
case 'VxeNumberInput':
|
|
15
|
+
case 'VxeSelect':
|
|
16
|
+
case 'VxeTreeSelect':
|
|
17
|
+
case 'VxeTableSelect':
|
|
18
|
+
case 'VxeDatePicker':
|
|
19
|
+
return 'modelValue'
|
|
20
|
+
case 'select':
|
|
21
|
+
return 'change'
|
|
22
|
+
}
|
|
23
|
+
return 'input'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function getChangeEvent (name: string) {
|
|
27
|
+
switch (name) {
|
|
28
|
+
case 'input':
|
|
29
|
+
case 'textarea':
|
|
30
|
+
case 'VxeInput':
|
|
31
|
+
case 'VxeTextarea':
|
|
32
|
+
case '$input':// 已废弃
|
|
33
|
+
case '$textarea':// 已废弃
|
|
34
|
+
return 'input'
|
|
35
|
+
}
|
|
36
|
+
return 'change'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function getSlotVNs (vns: VxeComponentSlotType | VxeComponentSlotType[] | undefined) {
|
|
40
|
+
if (XEUtils.isArray(vns)) {
|
|
41
|
+
return vns
|
|
42
|
+
}
|
|
43
|
+
return vns ? [vns] : []
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function getEventCaseName (_vm: CombinedVueInstance<any, any, any, any, any>, name: string) {
|
|
47
|
+
const caseName = XEUtils.camelCase(name)
|
|
48
|
+
if (caseName === name) {
|
|
49
|
+
return name
|
|
50
|
+
}
|
|
51
|
+
const _events = _vm ? _vm._events : null
|
|
52
|
+
return _events && _events[caseName] ? caseName : name
|
|
53
|
+
}
|
package/styles/all.scss
ADDED
package/styles/base.scss
ADDED
|
File without changes
|
|
File without changes
|