vxe-gantt 0.0.1 → 0.0.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/LICENSE +21 -0
- package/README.en.md +72 -0
- package/README.ja-JP.md +72 -0
- package/README.md +56 -2
- package/README.zh-TW.md +73 -0
- package/es/components.js +12 -0
- package/es/gantt/index.js +13 -0
- package/es/gantt/src/gantt.js +61 -0
- package/es/gantt/style.css +0 -0
- package/es/gantt/style.min.css +0 -0
- package/es/index.esm.js +3 -0
- package/es/style.css +0 -0
- package/es/style.min.css +0 -0
- package/es/ui/index.js +8 -0
- package/es/ui/src/comp.js +2 -0
- package/es/ui/src/dom.js +230 -0
- package/es/ui/src/log.js +4 -0
- package/es/ui/src/utils.js +40 -0
- package/es/ui/src/vn.js +32 -0
- package/es/ui/style.css +0 -0
- package/es/ui/style.min.css +0 -0
- package/es/vxe-gantt/index.js +3 -0
- package/es/vxe-gantt/style.css +0 -0
- package/es/vxe-gantt/style.min.css +0 -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 +42 -0
- package/lib/components.min.js +1 -0
- package/lib/gantt/index.js +20 -0
- package/lib/gantt/index.min.js +1 -0
- package/lib/gantt/src/gantt.js +72 -0
- package/lib/gantt/src/gantt.min.js +1 -0
- package/lib/gantt/style/index.js +1 -0
- package/lib/gantt/style/style.css +0 -0
- package/lib/gantt/style/style.min.css +0 -0
- package/lib/index.common.js +21 -0
- package/lib/index.umd.js +317 -0
- package/lib/index.umd.min.js +1 -0
- package/lib/style.css +0 -0
- package/lib/style.min.css +0 -0
- package/lib/ui/index.js +25 -0
- package/lib/ui/index.min.js +1 -0
- package/lib/ui/src/comp.js +8 -0
- package/lib/ui/src/comp.min.js +1 -0
- package/lib/ui/src/dom.js +277 -0
- package/lib/ui/src/dom.min.js +1 -0
- package/lib/ui/src/log.js +10 -0
- package/lib/ui/src/log.min.js +1 -0
- package/lib/ui/src/utils.js +55 -0
- package/lib/ui/src/utils.min.js +1 -0
- package/lib/ui/src/vn.js +43 -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-gantt/index.js +21 -0
- package/lib/vxe-gantt/index.min.js +1 -0
- package/lib/vxe-gantt/style/index.js +1 -0
- package/lib/vxe-gantt/style/style.css +0 -0
- package/lib/vxe-gantt/style/style.min.css +0 -0
- package/lib/vxe-ui/index.js +21 -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 +58 -21
- package/packages/components.ts +19 -0
- package/packages/gantt/index.ts +17 -0
- package/packages/gantt/src/gantt.ts +87 -0
- package/packages/index.ts +4 -0
- package/packages/ui/index.ts +12 -0
- package/packages/ui/src/comp.ts +3 -0
- package/packages/ui/src/dom.ts +253 -0
- package/packages/ui/src/log.ts +6 -0
- package/packages/ui/src/utils.ts +49 -0
- package/packages/ui/src/vn.ts +37 -0
- package/styles/all.scss +3 -0
- package/styles/base.scss +2 -0
- package/styles/components/gantt.scss +0 -0
- package/styles/components/ui.scss +0 -0
- package/styles/cssvar.scss +0 -0
- package/styles/theme/dark.scss +2 -0
- package/styles/theme/light.scss +2 -0
- package/styles/variable.scss +0 -0
- package/types/all.d.ts +16 -0
- package/types/index.d.ts +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 xuliangzhan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# vxe-gantt
|
|
2
|
+
|
|
3
|
+
[简体中文](README.md) | [繁體中文](README.zh-TW.md) | English | [日本語](README.ja-JP.md)
|
|
4
|
+
|
|
5
|
+
[](https://gitee.com/x-extends/vxe-gantt/stargazers)
|
|
6
|
+
[](https://www.npmjs.com/package/vxe-gantt)
|
|
7
|
+
[](https://github.com/x-extends/vxe-gantt/actions/workflows/webpack.yml)
|
|
8
|
+
[](https://npm-stat.com/charts.html?package=vxe-gantt)
|
|
9
|
+
[](https://github.com/x-extends/vxe-gantt/issues)
|
|
10
|
+
[](https://github.com/x-extends/vxe-gantt/issues?q=is%3Aissue+is%3Aclosed)
|
|
11
|
+
[](https://github.com/x-extends/vxe-gantt/pulls)
|
|
12
|
+
[](https://github.com/x-extends/vxe-gantt/pulls?q=is%3Apr+is%3Aclosed)
|
|
13
|
+
[](LICENSE)
|
|
14
|
+
|
|
15
|
+
A PC-based Gantt chart component based on [Vxe UI](https://github.com/x-extends/ vxe-pc-ui).
|
|
16
|
+
|
|
17
|
+
## Browser Support
|
|
18
|
+
|
|
19
|
+
 |  |  |  | 
|
|
20
|
+
--- | --- | --- | --- | --- |
|
|
21
|
+
80+ ✔ | 80+ ✔ | 90+ ✔ | 75+ ✔ | 10+ ✔ |
|
|
22
|
+
|
|
23
|
+
## Use
|
|
24
|
+
|
|
25
|
+
版本:[vue](https://www.npmjs.com/package/vue) 3.x
|
|
26
|
+
|
|
27
|
+
```shell
|
|
28
|
+
npm install vxe-gantt
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Get on [unpkg](https://unpkg.com/vxe-gantt/) and [cdnjs](https://cdn.jsdelivr.net/npm/vxe-gantt/)
|
|
32
|
+
|
|
33
|
+
### NPM
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
// ...
|
|
37
|
+
import VxeUIAll from 'vxe-pc-ui'
|
|
38
|
+
import 'vxe-pc-ui/lib/style.css'
|
|
39
|
+
|
|
40
|
+
import VxeUITable from 'vxe-table'
|
|
41
|
+
import 'vxe-table/lib/style.css'
|
|
42
|
+
|
|
43
|
+
import VxeUIGantt from 'vxe-gantt'
|
|
44
|
+
import 'vxe-gantt/lib/style.css'
|
|
45
|
+
// ...
|
|
46
|
+
|
|
47
|
+
createApp(App).use(VxeUIAll).use(VxeUITable).use(VxeUIGantt).mount('#app')
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Run the project
|
|
51
|
+
|
|
52
|
+
Install dependencies
|
|
53
|
+
|
|
54
|
+
```shell
|
|
55
|
+
npm install
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Start local debugging
|
|
59
|
+
|
|
60
|
+
```shell
|
|
61
|
+
npm run serve
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Compile packaging, generated compiled directory: es,lib
|
|
65
|
+
|
|
66
|
+
```shell
|
|
67
|
+
npm run lib
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
[MIT](LICENSE) © 2025-present, Xu Liangzhan
|
package/README.ja-JP.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# vxe-gantt
|
|
2
|
+
|
|
3
|
+
[简体中文](README.md) | [繁體中文](README.zh-TW.md) | [English](README.en.md) | 日本語
|
|
4
|
+
|
|
5
|
+
[](https://gitee.com/x-extends/vxe-gantt/stargazers)
|
|
6
|
+
[](https://www.npmjs.com/package/vxe-gantt)
|
|
7
|
+
[](https://github.com/x-extends/vxe-gantt/actions/workflows/webpack.yml)
|
|
8
|
+
[](https://npm-stat.com/charts.html?package=vxe-gantt)
|
|
9
|
+
[](https://github.com/x-extends/vxe-gantt/issues)
|
|
10
|
+
[](https://github.com/x-extends/vxe-gantt/issues?q=is%3Aissue+is%3Aclosed)
|
|
11
|
+
[](https://github.com/x-extends/vxe-gantt/pulls)
|
|
12
|
+
[](https://github.com/x-extends/vxe-gantt/pulls?q=is%3Apr+is%3Aclosed)
|
|
13
|
+
[](LICENSE)
|
|
14
|
+
|
|
15
|
+
一个基于 [Vxe UI](https://github.com/x-extends/vxe-pc-ui) 的基于 PC 端甘特图组件
|
|
16
|
+
|
|
17
|
+
## ブラウザサポート
|
|
18
|
+
|
|
19
|
+
 |  |  |  | 
|
|
20
|
+
--- | --- | --- | --- | --- |
|
|
21
|
+
80+ ✔ | 80+ ✔ | 90+ ✔ | 75+ ✔ | 10+ ✔ |
|
|
22
|
+
|
|
23
|
+
### テーブルとUIの使用
|
|
24
|
+
|
|
25
|
+
版本:[vue](https://www.npmjs.com/package/vue) 3.x
|
|
26
|
+
|
|
27
|
+
```shell
|
|
28
|
+
npm install vxe-gantt
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Get on [unpkg](https://unpkg.com/vxe-gantt/) and [cdnjs](https://cdn.jsdelivr.net/npm/vxe-gantt/)
|
|
32
|
+
|
|
33
|
+
### NPM
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
// ...
|
|
37
|
+
import VxeUIAll from 'vxe-pc-ui'
|
|
38
|
+
import 'vxe-pc-ui/lib/style.css'
|
|
39
|
+
|
|
40
|
+
import VxeUITable from 'vxe-table'
|
|
41
|
+
import 'vxe-table/lib/style.css'
|
|
42
|
+
|
|
43
|
+
import VxeUIGantt from 'vxe-gantt'
|
|
44
|
+
import 'vxe-gantt/lib/style.css'
|
|
45
|
+
// ...
|
|
46
|
+
|
|
47
|
+
createApp(App).use(VxeUIAll).use(VxeUITable).use(VxeUIGantt).mount('#app')
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## プロジェクトの実行
|
|
51
|
+
|
|
52
|
+
依存関係をインストールする
|
|
53
|
+
|
|
54
|
+
```shell
|
|
55
|
+
npm install
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
ローカルデバッグを開始する
|
|
59
|
+
|
|
60
|
+
```shell
|
|
61
|
+
npm run serve
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
コンパイルパッケージング、生成されたコンパイルディレクトリ: es,lib
|
|
65
|
+
|
|
66
|
+
```shell
|
|
67
|
+
npm run lib
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## ライセンス
|
|
71
|
+
|
|
72
|
+
[MIT](LICENSE) © 2025-present, Xu Liangzhan
|
package/README.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
|
-
#
|
|
1
|
+
# vxe-gantt
|
|
2
|
+
|
|
3
|
+
简体中文 | [繁體中文](README.zh-TW.md) | [English](README.en.md) | [日本語](README.ja-JP.md)
|
|
4
|
+
|
|
5
|
+
[](https://gitee.com/x-extends/vxe-gantt/stargazers)
|
|
6
|
+
[](https://www.npmjs.com/package/vxe-gantt)
|
|
7
|
+
[](https://github.com/x-extends/vxe-gantt/actions/workflows/webpack.yml)
|
|
8
|
+
[](https://npm-stat.com/charts.html?package=vxe-gantt)
|
|
9
|
+
[](https://github.com/x-extends/vxe-gantt/issues)
|
|
10
|
+
[](https://github.com/x-extends/vxe-gantt/issues?q=is%3Aissue+is%3Aclosed)
|
|
11
|
+
[](https://github.com/x-extends/vxe-gantt/pulls)
|
|
12
|
+
[](https://github.com/x-extends/vxe-gantt/pulls?q=is%3Apr+is%3Aclosed)
|
|
13
|
+
[](LICENSE)
|
|
14
|
+
|
|
15
|
+
一个基于 [Vxe UI](https://github.com/x-extends/vxe-pc-ui) 的基于 PC 端甘特图组件
|
|
16
|
+
|
|
17
|
+
* 设计理念
|
|
18
|
+
* 面向现代浏览器,高效的简洁 API 设计
|
|
19
|
+
|
|
20
|
+
* 版本说明
|
|
21
|
+
* **V4**
|
|
22
|
+
* [x] v4.0 基于 vue3.2+,只支持现代浏览器,不支持 IE
|
|
23
|
+
* **V3**
|
|
24
|
+
* [x] v3.0 基于 vue2.6+,只支持现代浏览器,不支持 IE
|
|
25
|
+
* **V2**
|
|
26
|
+
* [x] ~~v2.0 基于 vue2.6+,停止维护~~
|
|
27
|
+
* **V1**
|
|
28
|
+
* [x] ~~v1.0 基于 vue2.6+,停止维护~~
|
|
29
|
+
|
|
30
|
+
## 安装
|
|
31
|
+
|
|
32
|
+
版本:[vue](https://www.npmjs.com/package/vue) 3.x
|
|
33
|
+
|
|
34
|
+
```shell
|
|
35
|
+
npm install vxe-gantt
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Get on [unpkg](https://unpkg.com/vxe-gantt/) and [cdnjs](https://cdn.jsdelivr.net/npm/vxe-gantt/)
|
|
39
|
+
|
|
40
|
+
### NPM
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
// ...
|
|
44
|
+
import VxeUIAll from 'vxe-pc-ui'
|
|
45
|
+
import 'vxe-pc-ui/lib/style.css'
|
|
46
|
+
|
|
47
|
+
import VxeUITable from 'vxe-table'
|
|
48
|
+
import 'vxe-table/lib/style.css'
|
|
49
|
+
|
|
50
|
+
import VxeUIGantt from 'vxe-gantt'
|
|
51
|
+
import 'vxe-gantt/lib/style.css'
|
|
52
|
+
// ...
|
|
53
|
+
|
|
54
|
+
createApp(App).use(VxeUIAll).use(VxeUITable).use(VxeUIGantt).mount('#app')
|
|
55
|
+
```
|
|
2
56
|
|
|
3
57
|
## License
|
|
4
58
|
|
|
5
|
-
[MIT](LICENSE) ©
|
|
59
|
+
[MIT](LICENSE) © 2025-present, Xu Liangzhan
|
package/README.zh-TW.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# vxe-gantt
|
|
2
|
+
|
|
3
|
+
[简体中文](README.md) | 繁體中文 | [English](README.en.md) | [日本語](README.ja-JP.md)
|
|
4
|
+
|
|
5
|
+
[](https://gitee.com/x-extends/vxe-gantt/stargazers)
|
|
6
|
+
[](https://www.npmjs.com/package/vxe-gantt)
|
|
7
|
+
[](https://github.com/x-extends/vxe-gantt/actions/workflows/webpack.yml)
|
|
8
|
+
[](https://npm-stat.com/charts.html?package=vxe-gantt)
|
|
9
|
+
[](https://github.com/x-extends/vxe-gantt/issues)
|
|
10
|
+
[](https://github.com/x-extends/vxe-gantt/issues?q=is%3Aissue+is%3Aclosed)
|
|
11
|
+
[](https://github.com/x-extends/vxe-gantt/pulls)
|
|
12
|
+
[](https://github.com/x-extends/vxe-gantt/pulls?q=is%3Apr+is%3Aclosed)
|
|
13
|
+
[](LICENSE)
|
|
14
|
+
|
|
15
|
+
一个基于 [Vxe UI](https://github.com/x-extends/vxe-pc-ui) 的基于 PC 端甘特图组件
|
|
16
|
+
|
|
17
|
+
## 浏览器支持
|
|
18
|
+
|
|
19
|
+
 |  |  |  | 
|
|
20
|
+
--- | --- | --- | --- | --- |
|
|
21
|
+
80+ ✔ | 80+ ✔ | 90+ ✔ | 75+ ✔ | 10+ ✔ |
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## 安装
|
|
25
|
+
|
|
26
|
+
版本:[vue](https://www.npmjs.com/package/vue) 3.x
|
|
27
|
+
|
|
28
|
+
```shell
|
|
29
|
+
npm install vxe-gantt
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Get on [unpkg](https://unpkg.com/vxe-gantt/) and [cdnjs](https://cdn.jsdelivr.net/npm/vxe-gantt/)
|
|
33
|
+
|
|
34
|
+
### NPM
|
|
35
|
+
|
|
36
|
+
```javascript
|
|
37
|
+
// ...
|
|
38
|
+
import VxeUIAll from 'vxe-pc-ui'
|
|
39
|
+
import 'vxe-pc-ui/lib/style.css'
|
|
40
|
+
|
|
41
|
+
import VxeUITable from 'vxe-table'
|
|
42
|
+
import 'vxe-table/lib/style.css'
|
|
43
|
+
|
|
44
|
+
import VxeUIGantt from 'vxe-gantt'
|
|
45
|
+
import 'vxe-gantt/lib/style.css'
|
|
46
|
+
// ...
|
|
47
|
+
|
|
48
|
+
createApp(App).use(VxeUIAll).use(VxeUITable).use(VxeUIGantt).mount('#app')
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 運行項目
|
|
52
|
+
|
|
53
|
+
安裝依賴
|
|
54
|
+
|
|
55
|
+
```shell
|
|
56
|
+
npm install
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
啓動本地調試
|
|
60
|
+
|
|
61
|
+
```shell
|
|
62
|
+
npm run serve
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
編譯打包,生成編譯後的目錄:es,lib
|
|
66
|
+
|
|
67
|
+
```shell
|
|
68
|
+
npm run lib
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 許可證
|
|
72
|
+
|
|
73
|
+
[MIT](LICENSE) © 2025-present, Xu Liangzhan
|
package/es/components.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { setConfig } from '@vxe-ui/core';
|
|
2
|
+
import VxeGantt from './gantt';
|
|
3
|
+
const components = [
|
|
4
|
+
VxeGantt
|
|
5
|
+
];
|
|
6
|
+
export function install(app, options) {
|
|
7
|
+
setConfig(options);
|
|
8
|
+
components.forEach(component => app.use(component));
|
|
9
|
+
}
|
|
10
|
+
export * from './ui';
|
|
11
|
+
// Components
|
|
12
|
+
export * from './gantt';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { VxeUI } from '@vxe-ui/core';
|
|
2
|
+
import VxeGanttComponent from './src/gantt';
|
|
3
|
+
export const VxeGantt = Object.assign({}, VxeGanttComponent, {
|
|
4
|
+
install(app) {
|
|
5
|
+
app.component(VxeGanttComponent.name, VxeGanttComponent);
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
if (VxeUI.dynamicApp) {
|
|
9
|
+
VxeUI.dynamicApp.use(VxeGantt);
|
|
10
|
+
}
|
|
11
|
+
VxeUI.component(VxeGanttComponent);
|
|
12
|
+
export const Gantt = VxeGantt;
|
|
13
|
+
export default VxeGantt;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ref, h, reactive, onUnmounted } from 'vue';
|
|
2
|
+
import { defineVxeComponent } from '../../ui/src/comp';
|
|
3
|
+
import { getConfig, createEvent } from '../../ui';
|
|
4
|
+
import XEUtils from 'xe-utils';
|
|
5
|
+
function createInternalData() {
|
|
6
|
+
return {};
|
|
7
|
+
}
|
|
8
|
+
export default defineVxeComponent({
|
|
9
|
+
name: 'VxeGantt',
|
|
10
|
+
props: {
|
|
11
|
+
size: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: () => getConfig().gantt.size || getConfig().size
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
emits: [],
|
|
17
|
+
setup(props, context) {
|
|
18
|
+
const { emit } = context;
|
|
19
|
+
const xID = XEUtils.uniqueId();
|
|
20
|
+
const refElem = ref();
|
|
21
|
+
const refTable = ref();
|
|
22
|
+
const reactData = reactive({});
|
|
23
|
+
const internalData = createInternalData();
|
|
24
|
+
const refMaps = {
|
|
25
|
+
refElem,
|
|
26
|
+
refTable
|
|
27
|
+
};
|
|
28
|
+
const computeMaps = {};
|
|
29
|
+
const $xeGantt = {
|
|
30
|
+
xID,
|
|
31
|
+
props,
|
|
32
|
+
context,
|
|
33
|
+
reactData,
|
|
34
|
+
internalData,
|
|
35
|
+
getRefMaps: () => refMaps,
|
|
36
|
+
getComputeMaps: () => computeMaps
|
|
37
|
+
};
|
|
38
|
+
const dispatchEvent = (type, params, evnt) => {
|
|
39
|
+
emit(type, createEvent(evnt, { $gantt: $xeGantt }, params));
|
|
40
|
+
};
|
|
41
|
+
const ganttMethods = {
|
|
42
|
+
dispatchEvent
|
|
43
|
+
};
|
|
44
|
+
const ganttPrivateMethods = {};
|
|
45
|
+
Object.assign($xeGantt, ganttMethods, ganttPrivateMethods);
|
|
46
|
+
const renderVN = () => {
|
|
47
|
+
return h('div', {
|
|
48
|
+
ref: refElem,
|
|
49
|
+
class: 'vxe-gantt'
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
onUnmounted(() => {
|
|
53
|
+
XEUtils.assign(internalData, createInternalData());
|
|
54
|
+
});
|
|
55
|
+
$xeGantt.renderVN = renderVN;
|
|
56
|
+
return $xeGantt;
|
|
57
|
+
},
|
|
58
|
+
render() {
|
|
59
|
+
return this.renderVN();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
File without changes
|
|
File without changes
|
package/es/index.esm.js
ADDED
package/es/style.css
ADDED
|
File without changes
|
package/es/style.min.css
ADDED
|
File without changes
|
package/es/ui/index.js
ADDED
package/es/ui/src/dom.js
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils';
|
|
2
|
+
let tpImgEl;
|
|
3
|
+
export function initTpImg() {
|
|
4
|
+
if (!tpImgEl) {
|
|
5
|
+
tpImgEl = new Image();
|
|
6
|
+
tpImgEl.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
|
|
7
|
+
}
|
|
8
|
+
return tpImgEl;
|
|
9
|
+
}
|
|
10
|
+
export function getTpImg() {
|
|
11
|
+
if (!tpImgEl) {
|
|
12
|
+
return initTpImg();
|
|
13
|
+
}
|
|
14
|
+
return tpImgEl;
|
|
15
|
+
}
|
|
16
|
+
const reClsMap = {};
|
|
17
|
+
function getClsRE(cls) {
|
|
18
|
+
if (!reClsMap[cls]) {
|
|
19
|
+
reClsMap[cls] = new RegExp(`(?:^|\\s)${cls}(?!\\S)`, 'g');
|
|
20
|
+
}
|
|
21
|
+
return reClsMap[cls];
|
|
22
|
+
}
|
|
23
|
+
function getNodeOffset(elem, container, rest) {
|
|
24
|
+
if (elem) {
|
|
25
|
+
const parentElem = elem.parentNode;
|
|
26
|
+
rest.top += elem.offsetTop;
|
|
27
|
+
rest.left += elem.offsetLeft;
|
|
28
|
+
if (parentElem && parentElem !== document.documentElement && parentElem !== document.body) {
|
|
29
|
+
rest.top -= parentElem.scrollTop;
|
|
30
|
+
rest.left -= parentElem.scrollLeft;
|
|
31
|
+
}
|
|
32
|
+
if (container && (elem === container || elem.offsetParent === container) ? 0 : elem.offsetParent) {
|
|
33
|
+
return getNodeOffset(elem.offsetParent, container, rest);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return rest;
|
|
37
|
+
}
|
|
38
|
+
export function isPx(val) {
|
|
39
|
+
return val && /^\d+(px)?$/.test(val);
|
|
40
|
+
}
|
|
41
|
+
export function isScale(val) {
|
|
42
|
+
return val && /^\d+%$/.test(val);
|
|
43
|
+
}
|
|
44
|
+
export function hasClass(elem, cls) {
|
|
45
|
+
return !!(elem && elem.className && elem.className.match && elem.className.match(getClsRE(cls)));
|
|
46
|
+
}
|
|
47
|
+
export function removeClass(elem, cls) {
|
|
48
|
+
if (elem && hasClass(elem, cls)) {
|
|
49
|
+
elem.className = elem.className.replace(getClsRE(cls), '');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export function addClass(elem, cls) {
|
|
53
|
+
if (elem && !hasClass(elem, cls)) {
|
|
54
|
+
removeClass(elem, cls);
|
|
55
|
+
elem.className = `${elem.className} ${cls}`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export function hasControlKey(evnt) {
|
|
59
|
+
return evnt.ctrlKey || evnt.metaKey;
|
|
60
|
+
}
|
|
61
|
+
export function toCssUnit(val, unit = 'px') {
|
|
62
|
+
if (XEUtils.isNumber(val) || /^\d+$/.test(`${val}`)) {
|
|
63
|
+
return `${val}${unit}`;
|
|
64
|
+
}
|
|
65
|
+
return `${val || ''}`;
|
|
66
|
+
}
|
|
67
|
+
export function getDomNode() {
|
|
68
|
+
const documentElement = document.documentElement;
|
|
69
|
+
const bodyElem = document.body;
|
|
70
|
+
return {
|
|
71
|
+
scrollTop: documentElement.scrollTop || bodyElem.scrollTop,
|
|
72
|
+
scrollLeft: documentElement.scrollLeft || bodyElem.scrollLeft,
|
|
73
|
+
visibleHeight: documentElement.clientHeight || bodyElem.clientHeight,
|
|
74
|
+
visibleWidth: documentElement.clientWidth || bodyElem.clientWidth
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 检查触发源是否属于目标节点
|
|
79
|
+
*/
|
|
80
|
+
export function getEventTargetNode(evnt, container, queryCls, queryMethod) {
|
|
81
|
+
let targetElem;
|
|
82
|
+
let target = (evnt.target.shadowRoot && evnt.composed) ? (evnt.composedPath()[0] || evnt.target) : evnt.target;
|
|
83
|
+
while (target && target.nodeType && target !== document) {
|
|
84
|
+
if (queryCls && hasClass(target, queryCls) && (!queryMethod || queryMethod(target))) {
|
|
85
|
+
targetElem = target;
|
|
86
|
+
}
|
|
87
|
+
else if (target === container) {
|
|
88
|
+
return { flag: queryCls ? !!targetElem : true, container, targetElem: targetElem };
|
|
89
|
+
}
|
|
90
|
+
target = target.parentNode;
|
|
91
|
+
}
|
|
92
|
+
return { flag: false };
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* 获取元素相对于 document 的位置
|
|
96
|
+
*/
|
|
97
|
+
export function getOffsetPos(elem, container) {
|
|
98
|
+
return getNodeOffset(elem, container, { left: 0, top: 0 });
|
|
99
|
+
}
|
|
100
|
+
export function getAbsolutePos(elem) {
|
|
101
|
+
const bounding = elem.getBoundingClientRect();
|
|
102
|
+
const boundingTop = bounding.top;
|
|
103
|
+
const boundingLeft = bounding.left;
|
|
104
|
+
const { scrollTop, scrollLeft, visibleHeight, visibleWidth } = getDomNode();
|
|
105
|
+
return { boundingTop, top: scrollTop + boundingTop, boundingLeft, left: scrollLeft + boundingLeft, visibleHeight, visibleWidth };
|
|
106
|
+
}
|
|
107
|
+
export function getPaddingTopBottomSize(elem) {
|
|
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
|
+
const scrollIntoViewIfNeeded = 'scrollIntoViewIfNeeded';
|
|
117
|
+
const scrollIntoView = 'scrollIntoView';
|
|
118
|
+
export function scrollToView(elem) {
|
|
119
|
+
if (elem) {
|
|
120
|
+
if (elem[scrollIntoViewIfNeeded]) {
|
|
121
|
+
elem[scrollIntoViewIfNeeded]();
|
|
122
|
+
}
|
|
123
|
+
else if (elem[scrollIntoView]) {
|
|
124
|
+
elem[scrollIntoView]();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export function triggerEvent(targetElem, type) {
|
|
129
|
+
if (targetElem) {
|
|
130
|
+
targetElem.dispatchEvent(new Event(type));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export function isNodeElement(elem) {
|
|
134
|
+
return elem && elem.nodeType === 1;
|
|
135
|
+
}
|
|
136
|
+
export function updatePanelPlacement(targetElem, panelElem, options) {
|
|
137
|
+
const { placement, teleportTo, marginSize } = Object.assign({ teleportTo: false, marginSize: 32 }, options);
|
|
138
|
+
let panelPlacement = 'bottom';
|
|
139
|
+
let top = '';
|
|
140
|
+
let bottom = '';
|
|
141
|
+
let left = '';
|
|
142
|
+
const right = '';
|
|
143
|
+
let minWidth = '';
|
|
144
|
+
const stys = {};
|
|
145
|
+
if (panelElem && targetElem) {
|
|
146
|
+
const documentElement = document.documentElement;
|
|
147
|
+
const bodyElem = document.body;
|
|
148
|
+
const targetHeight = targetElem.offsetHeight;
|
|
149
|
+
const panelHeight = panelElem.offsetHeight;
|
|
150
|
+
const panelWidth = panelElem.offsetWidth;
|
|
151
|
+
const panelRect = panelElem.getBoundingClientRect();
|
|
152
|
+
const targetRect = targetElem.getBoundingClientRect();
|
|
153
|
+
const visibleHeight = documentElement.clientHeight || bodyElem.clientHeight;
|
|
154
|
+
const visibleWidth = documentElement.clientWidth || bodyElem.clientWidth;
|
|
155
|
+
minWidth = targetElem.offsetWidth;
|
|
156
|
+
if (teleportTo) {
|
|
157
|
+
left = targetRect.left;
|
|
158
|
+
top = targetRect.top + targetHeight;
|
|
159
|
+
if (placement === 'top') {
|
|
160
|
+
panelPlacement = 'top';
|
|
161
|
+
top = targetRect.top - panelHeight;
|
|
162
|
+
}
|
|
163
|
+
else if (!placement) {
|
|
164
|
+
// 如果下面不够放,则向上
|
|
165
|
+
if (top + panelHeight + marginSize > visibleHeight) {
|
|
166
|
+
panelPlacement = 'top';
|
|
167
|
+
top = targetRect.top - panelHeight;
|
|
168
|
+
}
|
|
169
|
+
// 如果上面不够放,则向下(优先)
|
|
170
|
+
if (top < marginSize) {
|
|
171
|
+
panelPlacement = 'bottom';
|
|
172
|
+
top = targetRect.top + targetHeight;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// 如果溢出右边
|
|
176
|
+
if (left + panelWidth + marginSize > visibleWidth) {
|
|
177
|
+
left -= left + panelWidth + marginSize - visibleWidth;
|
|
178
|
+
}
|
|
179
|
+
// 如果溢出左边
|
|
180
|
+
if (left < marginSize) {
|
|
181
|
+
left = marginSize;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
if (placement === 'top') {
|
|
186
|
+
panelPlacement = 'top';
|
|
187
|
+
bottom = targetHeight;
|
|
188
|
+
}
|
|
189
|
+
else if (!placement) {
|
|
190
|
+
// 如果下面不够放,则向上
|
|
191
|
+
top = targetHeight;
|
|
192
|
+
if (targetRect.top + targetRect.height + marginSize > visibleHeight) {
|
|
193
|
+
// 如果上面不够放,则向下(优先)
|
|
194
|
+
if (targetRect.top - targetHeight - panelHeight > marginSize) {
|
|
195
|
+
panelPlacement = 'top';
|
|
196
|
+
top = '';
|
|
197
|
+
bottom = targetHeight;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// 是否超出右侧
|
|
202
|
+
if (panelRect.left + panelRect.width + marginSize > visibleWidth) {
|
|
203
|
+
left = -(panelRect.left + panelRect.width + marginSize - visibleWidth);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (XEUtils.isNumber(top)) {
|
|
207
|
+
stys.top = toCssUnit(top);
|
|
208
|
+
}
|
|
209
|
+
if (XEUtils.isNumber(bottom)) {
|
|
210
|
+
stys.bottom = toCssUnit(bottom);
|
|
211
|
+
}
|
|
212
|
+
if (XEUtils.isNumber(left)) {
|
|
213
|
+
stys.left = toCssUnit(left);
|
|
214
|
+
}
|
|
215
|
+
if (XEUtils.isNumber(right)) {
|
|
216
|
+
stys.right = toCssUnit(right);
|
|
217
|
+
}
|
|
218
|
+
if (XEUtils.isNumber(minWidth)) {
|
|
219
|
+
stys.minWidth = toCssUnit(minWidth);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
top: top || 0,
|
|
224
|
+
bottom: bottom || 0,
|
|
225
|
+
left: left || 0,
|
|
226
|
+
right: right || 0,
|
|
227
|
+
style: stys,
|
|
228
|
+
placement: panelPlacement
|
|
229
|
+
};
|
|
230
|
+
}
|
package/es/ui/src/log.js
ADDED