vxe-gantt 0.0.2 → 4.0.0-beta.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/README.md +27 -1
- package/es/gantt/src/emits.js +4 -0
- package/es/gantt/src/gantt-body.js +103 -0
- package/es/gantt/src/gantt-chart.js +77 -0
- package/es/gantt/src/gantt-header.js +70 -0
- package/es/gantt/src/gantt-view.js +768 -0
- package/es/gantt/src/gantt.js +1707 -22
- package/es/gantt/src/grid-emits.js +16 -0
- package/es/gantt/src/grid-props.js +7 -0
- package/es/gantt/src/props.js +2 -0
- package/es/gantt/src/table-emits.js +97 -0
- package/es/gantt/src/table-props.js +298 -0
- package/es/gantt/src/util.js +12 -0
- package/es/gantt/style.css +599 -0
- package/es/gantt/style.min.css +1 -0
- package/es/style.css +1 -0
- package/es/style.min.css +1 -0
- package/es/ui/index.js +47 -3
- package/es/ui/src/dom.js +44 -105
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/utils.js +18 -17
- package/es/ui/src/vn.js +1 -32
- package/es/vxe-gantt/style.css +599 -0
- package/es/vxe-gantt/style.min.css +1 -0
- package/lib/gantt/src/emits.js +8 -0
- package/lib/gantt/src/emits.min.js +1 -0
- package/lib/gantt/src/gantt-body.js +118 -0
- package/lib/gantt/src/gantt-body.min.js +1 -0
- package/lib/gantt/src/gantt-chart.js +94 -0
- package/lib/gantt/src/gantt-chart.min.js +1 -0
- package/lib/gantt/src/gantt-header.js +78 -0
- package/lib/gantt/src/gantt-header.min.js +1 -0
- package/lib/gantt/src/gantt-view.js +810 -0
- package/lib/gantt/src/gantt-view.min.js +1 -0
- package/lib/gantt/src/gantt.js +1945 -20
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/src/grid-emits.js +8 -0
- package/lib/gantt/src/grid-emits.min.js +1 -0
- package/lib/gantt/src/grid-props.js +24 -0
- package/lib/gantt/src/grid-props.min.js +1 -0
- package/lib/gantt/src/props.js +13 -0
- package/lib/gantt/src/props.min.js +1 -0
- package/lib/gantt/src/table-emits.js +7 -0
- package/lib/gantt/src/table-emits.min.js +1 -0
- package/lib/gantt/src/table-props.js +306 -0
- package/lib/gantt/src/table-props.min.js +1 -0
- package/lib/gantt/src/util.js +19 -0
- package/lib/gantt/src/util.min.js +1 -0
- package/lib/gantt/style/style.css +599 -0
- package/lib/gantt/style/style.min.css +1 -0
- package/lib/index.umd.js +6554 -140
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -0
- package/lib/style.min.css +1 -0
- package/lib/ui/index.js +47 -3
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +50 -110
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/utils.js +24 -20
- package/lib/ui/src/utils.min.js +1 -1
- package/lib/ui/src/vn.js +1 -43
- package/lib/ui/src/vn.min.js +0 -1
- package/lib/vxe-gantt/style/style.css +599 -0
- package/lib/vxe-gantt/style/style.min.css +1 -0
- package/package.json +4 -4
- package/packages/gantt/src/emits.ts +7 -0
- package/packages/gantt/src/gantt-body.ts +119 -0
- package/packages/gantt/src/gantt-chart.ts +97 -0
- package/packages/gantt/src/gantt-header.ts +79 -0
- package/packages/gantt/src/gantt-view.ts +840 -0
- package/packages/gantt/src/gantt.ts +1806 -24
- package/packages/gantt/src/grid-emits.ts +19 -0
- package/packages/gantt/src/grid-props.ts +23 -0
- package/packages/gantt/src/props.ts +13 -0
- package/packages/gantt/src/table-emits.ts +109 -0
- package/packages/gantt/src/table-props.ts +304 -0
- package/packages/gantt/src/util.ts +15 -0
- package/packages/ui/index.ts +48 -2
- package/packages/ui/src/dom.ts +53 -110
- package/packages/ui/src/log.ts +1 -1
- package/packages/ui/src/utils.ts +22 -21
- package/packages/ui/src/vn.ts +0 -37
- package/styles/components/gantt-module/all.scss +1 -0
- package/styles/components/gantt-module/gantt-chart.scss +46 -0
- package/styles/components/gantt.scss +586 -0
- package/styles/helpers/baseMixin.scss +96 -0
- package/styles/helpers/baseVar.scss +4 -0
- package/styles/helpers/placement.scss +39 -0
- package/styles/theme/base.scss +7 -0
- package/styles/theme/dark.scss +5 -0
- package/styles/theme/light.scss +5 -0
package/packages/ui/src/dom.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils'
|
|
2
2
|
|
|
3
|
+
const reClsMap: { [key: string]: any } = {}
|
|
4
|
+
|
|
3
5
|
let tpImgEl: HTMLImageElement | undefined
|
|
4
6
|
|
|
5
7
|
export function initTpImg () {
|
|
@@ -17,7 +19,9 @@ export function getTpImg () {
|
|
|
17
19
|
return tpImgEl
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
export function getPropClass (property: any, params: any) {
|
|
23
|
+
return property ? XEUtils.isFunction(property) ? property(params) : property : ''
|
|
24
|
+
}
|
|
21
25
|
|
|
22
26
|
function getClsRE (cls: any) {
|
|
23
27
|
if (!reClsMap[cls]) {
|
|
@@ -71,13 +75,20 @@ export function hasControlKey (evnt: KeyboardEvent | MouseEvent | DragEvent) {
|
|
|
71
75
|
return evnt.ctrlKey || evnt.metaKey
|
|
72
76
|
}
|
|
73
77
|
|
|
74
|
-
export function toCssUnit (val?: number | string
|
|
78
|
+
export function toCssUnit (val?: number | string, unit = 'px') {
|
|
75
79
|
if (XEUtils.isNumber(val) || /^\d+$/.test(`${val}`)) {
|
|
76
80
|
return `${val}${unit}`
|
|
77
81
|
}
|
|
78
82
|
return `${val || ''}`
|
|
79
83
|
}
|
|
80
84
|
|
|
85
|
+
export function queryElement (elem: HTMLTableCellElement, selector: string) {
|
|
86
|
+
if (elem) {
|
|
87
|
+
return elem.querySelector<HTMLElement>(selector)
|
|
88
|
+
}
|
|
89
|
+
return null
|
|
90
|
+
}
|
|
91
|
+
|
|
81
92
|
export function getDomNode () {
|
|
82
93
|
const documentElement = document.documentElement
|
|
83
94
|
const bodyElem = document.body
|
|
@@ -89,6 +100,46 @@ export function getDomNode () {
|
|
|
89
100
|
}
|
|
90
101
|
}
|
|
91
102
|
|
|
103
|
+
export function getOffsetHeight (elem?: HTMLElement) {
|
|
104
|
+
return elem ? elem.offsetHeight : 0
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function getPaddingTopBottomSize (elem: HTMLElement) {
|
|
108
|
+
if (elem) {
|
|
109
|
+
const computedStyle = getComputedStyle(elem)
|
|
110
|
+
const paddingTop = XEUtils.toNumber(computedStyle.paddingTop)
|
|
111
|
+
const paddingBottom = XEUtils.toNumber(computedStyle.paddingBottom)
|
|
112
|
+
return paddingTop + paddingBottom
|
|
113
|
+
}
|
|
114
|
+
return 0
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function setScrollTop (elem: HTMLElement | null | undefined, scrollTop: number) {
|
|
118
|
+
if (elem) {
|
|
119
|
+
elem.scrollTop = scrollTop
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function setScrollLeft (elem: HTMLElement | null | undefined, scrollLeft: number) {
|
|
124
|
+
if (elem) {
|
|
125
|
+
elem.scrollLeft = scrollLeft
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// export function setScrollLeftAndTop (elem: HTMLElement | null, scrollLeft: number, scrollTop: number) {
|
|
130
|
+
// if (elem) {
|
|
131
|
+
// elem.scrollLeft = scrollLeft
|
|
132
|
+
// elem.scrollTop = scrollTop
|
|
133
|
+
// }
|
|
134
|
+
// }
|
|
135
|
+
|
|
136
|
+
export function updateCellTitle (overflowElem: any, column: any) {
|
|
137
|
+
const content = column.type === 'html' ? overflowElem.innerText : overflowElem.textContent
|
|
138
|
+
if (overflowElem.getAttribute('title') !== content) {
|
|
139
|
+
overflowElem.setAttribute('title', content)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
92
143
|
/**
|
|
93
144
|
* 检查触发源是否属于目标节点
|
|
94
145
|
*/
|
|
@@ -121,16 +172,6 @@ export function getAbsolutePos (elem: any) {
|
|
|
121
172
|
return { boundingTop, top: scrollTop + boundingTop, boundingLeft, left: scrollLeft + boundingLeft, visibleHeight, visibleWidth }
|
|
122
173
|
}
|
|
123
174
|
|
|
124
|
-
export function getPaddingTopBottomSize (elem: HTMLElement) {
|
|
125
|
-
if (elem) {
|
|
126
|
-
const computedStyle = getComputedStyle(elem)
|
|
127
|
-
const paddingTop = XEUtils.toNumber(computedStyle.paddingTop)
|
|
128
|
-
const paddingBottom = XEUtils.toNumber(computedStyle.paddingBottom)
|
|
129
|
-
return paddingTop + paddingBottom
|
|
130
|
-
}
|
|
131
|
-
return 0
|
|
132
|
-
}
|
|
133
|
-
|
|
134
175
|
const scrollIntoViewIfNeeded = 'scrollIntoViewIfNeeded'
|
|
135
176
|
const scrollIntoView = 'scrollIntoView'
|
|
136
177
|
|
|
@@ -153,101 +194,3 @@ export function triggerEvent (targetElem: Element, type: string) {
|
|
|
153
194
|
export function isNodeElement (elem: any): elem is HTMLElement {
|
|
154
195
|
return elem && elem.nodeType === 1
|
|
155
196
|
}
|
|
156
|
-
|
|
157
|
-
export function updatePanelPlacement (targetElem: HTMLElement | null | undefined, panelElem: HTMLElement | null | undefined, options: {
|
|
158
|
-
placement?: '' | 'top' | 'bottom' | null
|
|
159
|
-
teleportTo?: boolean
|
|
160
|
-
marginSize?: number
|
|
161
|
-
}) {
|
|
162
|
-
const { placement, teleportTo, marginSize } = Object.assign({ teleportTo: false, marginSize: 32 }, options)
|
|
163
|
-
let panelPlacement: 'top' | 'bottom' = 'bottom'
|
|
164
|
-
let top: number | '' = ''
|
|
165
|
-
let bottom: number | '' = ''
|
|
166
|
-
let left: number | '' = ''
|
|
167
|
-
const right: number | '' = ''
|
|
168
|
-
let minWidth: number | '' = ''
|
|
169
|
-
const stys: Record<string, string> = {}
|
|
170
|
-
if (panelElem && targetElem) {
|
|
171
|
-
const documentElement = document.documentElement
|
|
172
|
-
const bodyElem = document.body
|
|
173
|
-
const targetHeight = targetElem.offsetHeight
|
|
174
|
-
const panelHeight = panelElem.offsetHeight
|
|
175
|
-
const panelWidth = panelElem.offsetWidth
|
|
176
|
-
|
|
177
|
-
const panelRect = panelElem.getBoundingClientRect()
|
|
178
|
-
const targetRect = targetElem.getBoundingClientRect()
|
|
179
|
-
const visibleHeight = documentElement.clientHeight || bodyElem.clientHeight
|
|
180
|
-
const visibleWidth = documentElement.clientWidth || bodyElem.clientWidth
|
|
181
|
-
minWidth = targetElem.offsetWidth
|
|
182
|
-
if (teleportTo) {
|
|
183
|
-
left = targetRect.left
|
|
184
|
-
top = targetRect.top + targetHeight
|
|
185
|
-
if (placement === 'top') {
|
|
186
|
-
panelPlacement = 'top'
|
|
187
|
-
top = targetRect.top - panelHeight
|
|
188
|
-
} else if (!placement) {
|
|
189
|
-
// 如果下面不够放,则向上
|
|
190
|
-
if (top + panelHeight + marginSize > visibleHeight) {
|
|
191
|
-
panelPlacement = 'top'
|
|
192
|
-
top = targetRect.top - panelHeight
|
|
193
|
-
}
|
|
194
|
-
// 如果上面不够放,则向下(优先)
|
|
195
|
-
if (top < marginSize) {
|
|
196
|
-
panelPlacement = 'bottom'
|
|
197
|
-
top = targetRect.top + targetHeight
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
// 如果溢出右边
|
|
201
|
-
if (left + panelWidth + marginSize > visibleWidth) {
|
|
202
|
-
left -= left + panelWidth + marginSize - visibleWidth
|
|
203
|
-
}
|
|
204
|
-
// 如果溢出左边
|
|
205
|
-
if (left < marginSize) {
|
|
206
|
-
left = marginSize
|
|
207
|
-
}
|
|
208
|
-
} else {
|
|
209
|
-
if (placement === 'top') {
|
|
210
|
-
panelPlacement = 'top'
|
|
211
|
-
bottom = targetHeight
|
|
212
|
-
} else if (!placement) {
|
|
213
|
-
// 如果下面不够放,则向上
|
|
214
|
-
top = targetHeight
|
|
215
|
-
if (targetRect.top + targetRect.height + marginSize > visibleHeight) {
|
|
216
|
-
// 如果上面不够放,则向下(优先)
|
|
217
|
-
if (targetRect.top - targetHeight - panelHeight > marginSize) {
|
|
218
|
-
panelPlacement = 'top'
|
|
219
|
-
top = ''
|
|
220
|
-
bottom = targetHeight
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
// 是否超出右侧
|
|
225
|
-
if (panelRect.left + panelRect.width + marginSize > visibleWidth) {
|
|
226
|
-
left = -(panelRect.left + panelRect.width + marginSize - visibleWidth)
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
if (XEUtils.isNumber(top)) {
|
|
230
|
-
stys.top = toCssUnit(top)
|
|
231
|
-
}
|
|
232
|
-
if (XEUtils.isNumber(bottom)) {
|
|
233
|
-
stys.bottom = toCssUnit(bottom)
|
|
234
|
-
}
|
|
235
|
-
if (XEUtils.isNumber(left)) {
|
|
236
|
-
stys.left = toCssUnit(left)
|
|
237
|
-
}
|
|
238
|
-
if (XEUtils.isNumber(right)) {
|
|
239
|
-
stys.right = toCssUnit(right)
|
|
240
|
-
}
|
|
241
|
-
if (XEUtils.isNumber(minWidth)) {
|
|
242
|
-
stys.minWidth = toCssUnit(minWidth)
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
return {
|
|
246
|
-
top: top || 0,
|
|
247
|
-
bottom: bottom || 0,
|
|
248
|
-
left: left || 0,
|
|
249
|
-
right: right || 0,
|
|
250
|
-
style: stys,
|
|
251
|
-
placement: panelPlacement
|
|
252
|
-
}
|
|
253
|
-
}
|
package/packages/ui/src/log.ts
CHANGED
package/packages/ui/src/utils.ts
CHANGED
|
@@ -1,49 +1,50 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils'
|
|
2
|
-
import {
|
|
2
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
3
3
|
import DomZIndex from 'dom-zindex'
|
|
4
4
|
|
|
5
5
|
export function isEnableConf (conf: any): boolean {
|
|
6
6
|
return conf && conf.enabled !== false
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export function
|
|
10
|
-
return
|
|
9
|
+
export function isEmptyValue (cellValue: any) {
|
|
10
|
+
return cellValue === null || cellValue === undefined || cellValue === ''
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export function
|
|
14
|
-
|
|
13
|
+
export function parseFile (file: File) {
|
|
14
|
+
const name = file.name
|
|
15
|
+
const tIndex = XEUtils.lastIndexOf(name, '.')
|
|
16
|
+
const type = name.substring(tIndex + 1, name.length).toLowerCase()
|
|
17
|
+
const filename = name.substring(0, tIndex)
|
|
18
|
+
return { filename, type }
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
export function
|
|
18
|
-
return DomZIndex.
|
|
21
|
+
export function nextZIndex () {
|
|
22
|
+
return DomZIndex.getNext()
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
export function
|
|
22
|
-
return DomZIndex.
|
|
25
|
+
export function getLastZIndex () {
|
|
26
|
+
return DomZIndex.getCurrent()
|
|
23
27
|
}
|
|
24
28
|
|
|
25
|
-
export function
|
|
26
|
-
|
|
27
|
-
return globalValue
|
|
28
|
-
}
|
|
29
|
-
return value
|
|
29
|
+
export function hasChildrenList (item: any) {
|
|
30
|
+
return item && item.children && item.children.length > 0
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
export function getFuncText (content
|
|
33
|
+
export function getFuncText (content?: string | number | boolean | null, args?: any) {
|
|
33
34
|
if (content) {
|
|
34
|
-
const translate = getConfig().translate
|
|
35
|
+
const translate = VxeUI.getConfig().translate
|
|
35
36
|
return XEUtils.toValueString(translate ? translate('' + content, args) : content)
|
|
36
37
|
}
|
|
37
38
|
return ''
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
export function formatText (value: any, placeholder?: any) {
|
|
42
|
+
return '' + (isEmptyValue(value) ? (placeholder ? VxeUI.getConfig().emptyCell : '') : value)
|
|
43
|
+
}
|
|
44
|
+
|
|
40
45
|
/**
|
|
41
46
|
* 判断值为:'' | null | undefined 时都属于空值
|
|
42
47
|
*/
|
|
43
48
|
export function eqEmptyValue (cellValue: any) {
|
|
44
|
-
return cellValue ===
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function handleBooleanDefaultValue (value: boolean | undefined | null) {
|
|
48
|
-
return XEUtils.isBoolean(value) ? value : null
|
|
49
|
+
return cellValue === '' || XEUtils.eqNull(cellValue)
|
|
49
50
|
}
|
package/packages/ui/src/vn.ts
CHANGED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import XEUtils from 'xe-utils'
|
|
2
|
-
import { VxeComponentSlotType } from '@vxe-ui/core'
|
|
3
|
-
|
|
4
|
-
export function getOnName (type: string) {
|
|
5
|
-
return 'on' + type.substring(0, 1).toLocaleUpperCase() + type.substring(1)
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function getModelEvent (name: string) {
|
|
9
|
-
switch (name) {
|
|
10
|
-
case 'input':
|
|
11
|
-
case 'textarea':
|
|
12
|
-
return 'input'
|
|
13
|
-
case 'select':
|
|
14
|
-
return 'change'
|
|
15
|
-
}
|
|
16
|
-
return 'update:modelValue'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function getChangeEvent (name: string) {
|
|
20
|
-
switch (name) {
|
|
21
|
-
case 'input':
|
|
22
|
-
case 'textarea':
|
|
23
|
-
case 'VxeInput':
|
|
24
|
-
case 'VxeTextarea':
|
|
25
|
-
case '$input':// 已废弃
|
|
26
|
-
case '$textarea':// 已废弃
|
|
27
|
-
return 'input'
|
|
28
|
-
}
|
|
29
|
-
return 'change'
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function getSlotVNs (vns: VxeComponentSlotType | VxeComponentSlotType[] | undefined) {
|
|
33
|
-
if (XEUtils.isArray(vns)) {
|
|
34
|
-
return vns
|
|
35
|
-
}
|
|
36
|
-
return vns ? [vns] : []
|
|
37
|
-
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@use './gantt-chart.scss'
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.vxe-gantt-view--chart-wrapper {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
pointer-events: none;
|
|
6
|
+
}
|
|
7
|
+
.vxe-gantt-view--chart-row {
|
|
8
|
+
position: relative;
|
|
9
|
+
}
|
|
10
|
+
.vxe-gantt-view--chart-bar {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
position: absolute;
|
|
14
|
+
width: 0;
|
|
15
|
+
top: 50%;
|
|
16
|
+
left: 0;
|
|
17
|
+
color: #ffffff;
|
|
18
|
+
transform: translateY(-50%);
|
|
19
|
+
border-radius: var(--vxe-ui-base-border-radius);
|
|
20
|
+
height: var(--vxe-ui-gantt-view-chart-bar-height);
|
|
21
|
+
background-color: var(--vxe-ui-font-primary-lighten-color);
|
|
22
|
+
pointer-events: all;
|
|
23
|
+
&:hover {
|
|
24
|
+
&::after {
|
|
25
|
+
content: "";
|
|
26
|
+
position: absolute;
|
|
27
|
+
top: 0;
|
|
28
|
+
left: 0;
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 100%;
|
|
31
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
32
|
+
border-radius: var(--vxe-ui-base-border-radius);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
.vxe-gantt-view--chart-progress {
|
|
37
|
+
flex-shrink: 0;
|
|
38
|
+
width: 40px;
|
|
39
|
+
text-align: left;
|
|
40
|
+
border-radius: var(--vxe-ui-base-border-radius) 0 0 var(--vxe-ui-base-border-radius);
|
|
41
|
+
background-color: var(--vxe-ui-font-primary-color);
|
|
42
|
+
}
|
|
43
|
+
.vxe-gantt-view--chart-content {
|
|
44
|
+
flex-grow: 1;
|
|
45
|
+
text-align: right;
|
|
46
|
+
}
|