@worktile/gantt 12.0.1 → 12.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/README.md +13 -116
- package/bundles/worktile-gantt.umd.js +3303 -0
- package/bundles/worktile-gantt.umd.js.map +1 -0
- package/class/date-point.d.ts +15 -0
- package/{packages/gantt/src/class/event.ts → class/event.d.ts} +6 -12
- package/class/group.d.ts +22 -0
- package/{packages/gantt/src/class/index.ts → class/index.d.ts} +0 -0
- package/class/item.d.ts +70 -0
- package/class/view-type.d.ts +7 -0
- package/components/bar/bar-drag.d.ts +37 -0
- package/components/bar/bar.component.d.ts +26 -0
- package/components/calendar/calendar.component.d.ts +28 -0
- package/components/drag-backdrop/drag-backdrop.component.d.ts +9 -0
- package/components/icon/icon.component.d.ts +13 -0
- package/components/icon/icons.d.ts +8 -0
- package/components/links/links.component.d.ts +47 -0
- package/components/main/gantt-main.component.d.ts +21 -0
- package/components/range/range.component.d.ts +13 -0
- package/components/table/gantt-table.component.d.ts +36 -0
- package/esm2015/class/date-point.js +10 -0
- package/esm2015/class/event.js +13 -0
- package/esm2015/class/group.js +17 -0
- package/esm2015/class/index.js +6 -0
- package/esm2015/class/item.js +78 -0
- package/esm2015/class/view-type.js +9 -0
- package/esm2015/components/bar/bar-drag.js +264 -0
- package/esm2015/components/bar/bar.component.js +98 -0
- package/esm2015/components/calendar/calendar.component.js +86 -0
- package/esm2015/components/drag-backdrop/drag-backdrop.component.js +21 -0
- package/esm2015/components/icon/icon.component.js +38 -0
- package/esm2015/components/icon/icons.js +87 -0
- package/esm2015/components/links/links.component.js +213 -0
- package/esm2015/components/main/gantt-main.component.js +53 -0
- package/esm2015/components/range/range.component.js +37 -0
- package/esm2015/components/table/gantt-table.component.js +146 -0
- package/esm2015/gantt-abstract.js +3 -0
- package/esm2015/gantt-dom.service.js +103 -0
- package/esm2015/gantt-drag-container.js +59 -0
- package/esm2015/gantt-item-upper.js +58 -0
- package/esm2015/gantt-print.service.js +94 -0
- package/esm2015/gantt-upper.js +254 -0
- package/esm2015/gantt.component.js +131 -0
- package/esm2015/gantt.module.js +74 -0
- package/esm2015/gantt.pipe.js +43 -0
- package/esm2015/gantt.styles.js +15 -0
- package/esm2015/public-api.js +18 -0
- package/esm2015/root.component.js +123 -0
- package/esm2015/table/gantt-column.component.js +37 -0
- package/esm2015/table/gantt-table.component.js +20 -0
- package/esm2015/utils/date.js +160 -0
- package/esm2015/utils/helpers.js +55 -0
- package/esm2015/views/day.js +54 -0
- package/esm2015/views/factory.js +23 -0
- package/esm2015/views/month.js +48 -0
- package/esm2015/views/quarter.js +51 -0
- package/esm2015/views/view.js +121 -0
- package/esm2015/views/week.js +49 -0
- package/esm2015/views/year.js +50 -0
- package/esm2015/worktile-gantt.js +5 -0
- package/fesm2015/worktile-gantt.js +2637 -0
- package/fesm2015/worktile-gantt.js.map +1 -0
- package/{packages/gantt/src/gantt-abstract.ts → gantt-abstract.d.ts} +1 -3
- package/gantt-dom.service.d.ts +32 -0
- package/gantt-drag-container.d.ts +23 -0
- package/gantt-item-upper.d.ts +20 -0
- package/gantt-print.service.d.ts +13 -0
- package/gantt-upper.d.ts +64 -0
- package/gantt.component.d.ts +29 -0
- package/gantt.module.d.ts +21 -0
- package/gantt.pipe.d.ts +18 -0
- package/gantt.styles.d.ts +15 -0
- package/main.bundle.scss +645 -0
- package/package.json +16 -113
- package/{packages/gantt/src/public-api.ts → public-api.d.ts} +0 -4
- package/root.component.d.ts +28 -0
- package/table/gantt-column.component.d.ts +15 -0
- package/table/gantt-table.component.d.ts +10 -0
- package/utils/date.d.ts +59 -0
- package/utils/helpers.d.ts +12 -0
- package/views/day.d.ts +14 -0
- package/views/factory.d.ts +8 -0
- package/views/month.d.ts +12 -0
- package/views/quarter.d.ts +12 -0
- package/views/view.d.ts +56 -0
- package/views/week.d.ts +12 -0
- package/views/year.d.ts +12 -0
- package/worktile-gantt.d.ts +5 -0
- package/.all-contributorsrc +0 -53
- package/.angulardoc.json +0 -4
- package/.circleci/config.yml +0 -17
- package/.coveralls.yml +0 -1
- package/.docgenirc.js +0 -64
- package/.editorconfig +0 -22
- package/.prettierrc +0 -24
- package/.travis.yml +0 -23
- package/CHANGELOG.md +0 -564
- package/Dockerfile +0 -4
- package/LICENSE +0 -21
- package/angular.json +0 -136
- package/docs/guides/basic/components.md +0 -54
- package/docs/guides/basic/event.md +0 -70
- package/docs/guides/basic/index.md +0 -4
- package/docs/guides/basic/style.md +0 -68
- package/docs/guides/basic/type.md +0 -70
- package/docs/guides/basic/usage.md +0 -189
- package/docs/guides/index.md +0 -5
- package/docs/guides/intro/getting-started.md +0 -79
- package/docs/guides/intro/index.md +0 -51
- package/docs/index.md +0 -0
- package/example/browserslist +0 -12
- package/example/src/app/app-routing.module.ts +0 -26
- package/example/src/app/app.component.html +0 -2
- package/example/src/app/app.component.ts +0 -11
- package/example/src/app/app.module.ts +0 -57
- package/example/src/app/components/components.component.html +0 -6
- package/example/src/app/components/components.component.ts +0 -33
- package/example/src/app/configuration/parameters/api/zh-cn.js +0 -350
- package/example/src/app/configuration/parameters/doc/zh-cn.md +0 -5
- package/example/src/app/gantt/gantt.component.html +0 -51
- package/example/src/app/gantt/gantt.component.ts +0 -119
- package/example/src/app/gantt-advanced/component/flat.component.html +0 -30
- package/example/src/app/gantt-advanced/component/flat.component.ts +0 -72
- package/example/src/app/gantt-advanced/component/flat.scss +0 -31
- package/example/src/app/gantt-advanced/gantt-advanced.component.html +0 -32
- package/example/src/app/gantt-advanced/gantt-advanced.component.ts +0 -34
- package/example/src/app/gantt-advanced/mocks.ts +0 -158
- package/example/src/app/gantt-groups/gantt-groups.component.html +0 -42
- package/example/src/app/gantt-groups/gantt-groups.component.ts +0 -62
- package/example/src/app/gantt-range/gantt-range.component.html +0 -66
- package/example/src/app/gantt-range/gantt-range.component.ts +0 -67
- package/example/src/app/gantt-range/mocks.ts +0 -150
- package/example/src/app/helper.ts +0 -38
- package/example/src/assets/.gitkeep +0 -0
- package/example/src/environments/environment.prod.ts +0 -3
- package/example/src/environments/environment.ts +0 -16
- package/example/src/favicon.ico +0 -0
- package/example/src/index.html +0 -13
- package/example/src/main.ts +0 -12
- package/example/src/polyfills.ts +0 -63
- package/example/src/styles.scss +0 -56
- package/example/tsconfig.app.json +0 -18
- package/nginx.conf +0 -17
- package/packages/gantt/README.md +0 -24
- package/packages/gantt/karma.conf.js +0 -46
- package/packages/gantt/ng-package.json +0 -7
- package/packages/gantt/ng-package.prod.json +0 -7
- package/packages/gantt/package.json +0 -16
- package/packages/gantt/src/class/date-point.ts +0 -14
- package/packages/gantt/src/class/group.ts +0 -36
- package/packages/gantt/src/class/item.ts +0 -129
- package/packages/gantt/src/class/test/group.spec.ts +0 -21
- package/packages/gantt/src/class/test/item.spec.ts +0 -102
- package/packages/gantt/src/class/view-type.ts +0 -7
- package/packages/gantt/src/components/bar/bar-drag.ts +0 -298
- package/packages/gantt/src/components/bar/bar.component.html +0 -17
- package/packages/gantt/src/components/bar/bar.component.scss +0 -169
- package/packages/gantt/src/components/bar/bar.component.ts +0 -109
- package/packages/gantt/src/components/bar/test/bar.component.spec.ts +0 -54
- package/packages/gantt/src/components/bar/test/bar.drag.spec.ts +0 -196
- package/packages/gantt/src/components/calendar/calendar.component.html +0 -52
- package/packages/gantt/src/components/calendar/calendar.component.scss +0 -77
- package/packages/gantt/src/components/calendar/calendar.component.ts +0 -100
- package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.html +0 -6
- package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.scss +0 -48
- package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.ts +0 -13
- package/packages/gantt/src/components/icon/icon.component.scss +0 -13
- package/packages/gantt/src/components/icon/icon.component.ts +0 -28
- package/packages/gantt/src/components/icon/icons.ts +0 -86
- package/packages/gantt/src/components/links/links.component.html +0 -19
- package/packages/gantt/src/components/links/links.component.scss +0 -27
- package/packages/gantt/src/components/links/links.component.ts +0 -263
- package/packages/gantt/src/components/main/gantt-main.component.html +0 -35
- package/packages/gantt/src/components/main/gantt-main.component.ts +0 -35
- package/packages/gantt/src/components/range/range.component.html +0 -8
- package/packages/gantt/src/components/range/range.component.scss +0 -35
- package/packages/gantt/src/components/range/range.component.ts +0 -27
- package/packages/gantt/src/components/range/test/range.component.spec.ts +0 -80
- package/packages/gantt/src/components/table/gantt-table.component.html +0 -105
- package/packages/gantt/src/components/table/gantt-table.component.scss +0 -144
- package/packages/gantt/src/components/table/gantt-table.component.ts +0 -166
- package/packages/gantt/src/components/table/test/table.spec.ts +0 -129
- package/packages/gantt/src/gantt-dom.service.ts +0 -134
- package/packages/gantt/src/gantt-drag-container.ts +0 -73
- package/packages/gantt/src/gantt-item-upper.ts +0 -50
- package/packages/gantt/src/gantt-print.service.ts +0 -104
- package/packages/gantt/src/gantt-upper.ts +0 -289
- package/packages/gantt/src/gantt.component.html +0 -18
- package/packages/gantt/src/gantt.component.scss +0 -77
- package/packages/gantt/src/gantt.component.ts +0 -134
- package/packages/gantt/src/gantt.module.ts +0 -47
- package/packages/gantt/src/gantt.pipe.ts +0 -31
- package/packages/gantt/src/gantt.styles.ts +0 -28
- package/packages/gantt/src/root.component.html +0 -12
- package/packages/gantt/src/root.component.ts +0 -121
- package/packages/gantt/src/styles/index.scss +0 -9
- package/packages/gantt/src/styles/variables.scss +0 -46
- package/packages/gantt/src/table/gantt-column.component.ts +0 -25
- package/packages/gantt/src/table/gantt-table.component.ts +0 -14
- package/packages/gantt/src/table/test/table.spec.ts +0 -56
- package/packages/gantt/src/test/gantt.component.spec.ts +0 -404
- package/packages/gantt/src/test/mocks/data.ts +0 -303
- package/packages/gantt/src/test.ts +0 -21
- package/packages/gantt/src/utils/date.ts +0 -276
- package/packages/gantt/src/utils/helpers.ts +0 -66
- package/packages/gantt/src/utils/test/date.spec.ts +0 -105
- package/packages/gantt/src/utils/test/helpers.spec.ts +0 -73
- package/packages/gantt/src/utils/testing.ts +0 -64
- package/packages/gantt/src/views/day.ts +0 -74
- package/packages/gantt/src/views/factory.ts +0 -25
- package/packages/gantt/src/views/month.ts +0 -66
- package/packages/gantt/src/views/quarter.ts +0 -68
- package/packages/gantt/src/views/test/day.spec.ts +0 -45
- package/packages/gantt/src/views/test/factory.spec.ts +0 -41
- package/packages/gantt/src/views/test/mock.ts +0 -14
- package/packages/gantt/src/views/test/month.spec.ts +0 -45
- package/packages/gantt/src/views/test/quarter.spec.ts +0 -45
- package/packages/gantt/src/views/test/view.spec.ts +0 -144
- package/packages/gantt/src/views/test/week.spec.ts +0 -45
- package/packages/gantt/src/views/test/year.spec.ts +0 -45
- package/packages/gantt/src/views/view.ts +0 -186
- package/packages/gantt/src/views/week.ts +0 -66
- package/packages/gantt/src/views/year.ts +0 -62
- package/packages/gantt/tsconfig.lib.json +0 -20
- package/packages/gantt/tsconfig.lib.prod.json +0 -9
- package/packages/gantt/tsconfig.schematics.json +0 -25
- package/packages/gantt/tsconfig.spec.json +0 -17
- package/packages/gantt/tslint.json +0 -18
- package/scss-bundle.config.json +0 -7
- package/tsconfig.json +0 -26
- package/tslint.json +0 -51
package/angular.json
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
3
|
-
"version": 1,
|
|
4
|
-
"newProjectRoot": "projects",
|
|
5
|
-
"projects": {
|
|
6
|
-
"gantt": {
|
|
7
|
-
"projectType": "library",
|
|
8
|
-
"root": "packages/gantt",
|
|
9
|
-
"sourceRoot": "packages/gantt/src",
|
|
10
|
-
"prefix": "ngx",
|
|
11
|
-
"architect": {
|
|
12
|
-
"build": {
|
|
13
|
-
"builder": "@angular-devkit/build-angular:ng-packagr",
|
|
14
|
-
"options": {
|
|
15
|
-
"tsConfig": "packages/gantt/tsconfig.lib.json",
|
|
16
|
-
"project": "packages/gantt/ng-package.json"
|
|
17
|
-
},
|
|
18
|
-
"configurations": {
|
|
19
|
-
"production": {
|
|
20
|
-
"tsConfig": "packages/gantt/tsconfig.lib.prod.json"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"test": {
|
|
25
|
-
"builder": "@angular-devkit/build-angular:karma",
|
|
26
|
-
"options": {
|
|
27
|
-
"main": "packages/gantt/src/test.ts",
|
|
28
|
-
"tsConfig": "packages/gantt/tsconfig.spec.json",
|
|
29
|
-
"codeCoverage": true,
|
|
30
|
-
"karmaConfig": "packages/gantt/karma.conf.js"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"lint": {
|
|
34
|
-
"builder": "@angular-devkit/build-angular:tslint",
|
|
35
|
-
"options": {
|
|
36
|
-
"tsConfig": [
|
|
37
|
-
"packages/gantt/tsconfig.lib.json",
|
|
38
|
-
"packages/gantt/tsconfig.spec.json"
|
|
39
|
-
],
|
|
40
|
-
"exclude": [
|
|
41
|
-
"**/node_modules/**"
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"example": {
|
|
48
|
-
"projectType": "application",
|
|
49
|
-
"schematics": {
|
|
50
|
-
"@schematics/angular:component": {
|
|
51
|
-
"style": "scss"
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
"root": "example",
|
|
55
|
-
"sourceRoot": "example/src",
|
|
56
|
-
"prefix": "example",
|
|
57
|
-
"architect": {
|
|
58
|
-
"build": {
|
|
59
|
-
"builder": "@angular-devkit/build-angular:browser",
|
|
60
|
-
"options": {
|
|
61
|
-
"outputPath": "dist/example",
|
|
62
|
-
"index": "example/src/index.html",
|
|
63
|
-
"main": "example/src/main.ts",
|
|
64
|
-
"polyfills": "example/src/polyfills.ts",
|
|
65
|
-
"tsConfig": "example/tsconfig.app.json",
|
|
66
|
-
"assets": [
|
|
67
|
-
"example/src/favicon.ico",
|
|
68
|
-
"example/src/assets"
|
|
69
|
-
],
|
|
70
|
-
"styles": [
|
|
71
|
-
"example/src/styles.scss"
|
|
72
|
-
],
|
|
73
|
-
"scripts": [],
|
|
74
|
-
"vendorChunk": true,
|
|
75
|
-
"extractLicenses": false,
|
|
76
|
-
"buildOptimizer": false,
|
|
77
|
-
"sourceMap": true,
|
|
78
|
-
"optimization": false,
|
|
79
|
-
"namedChunks": true
|
|
80
|
-
},
|
|
81
|
-
"configurations": {
|
|
82
|
-
"production": {
|
|
83
|
-
"fileReplacements": [
|
|
84
|
-
{
|
|
85
|
-
"replace": "example/src/environments/environment.ts",
|
|
86
|
-
"with": "example/src/environments/environment.prod.ts"
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
"optimization": true,
|
|
90
|
-
"outputHashing": "all",
|
|
91
|
-
"sourceMap": false,
|
|
92
|
-
"namedChunks": false,
|
|
93
|
-
"extractLicenses": true,
|
|
94
|
-
"vendorChunk": false,
|
|
95
|
-
"buildOptimizer": true,
|
|
96
|
-
"budgets": [
|
|
97
|
-
{
|
|
98
|
-
"type": "initial",
|
|
99
|
-
"maximumWarning": "2mb",
|
|
100
|
-
"maximumError": "5mb"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
"type": "anyComponentStyle",
|
|
104
|
-
"maximumWarning": "6kb",
|
|
105
|
-
"maximumError": "10kb"
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
"defaultConfiguration": ""
|
|
111
|
-
},
|
|
112
|
-
"serve": {
|
|
113
|
-
"builder": "@angular-devkit/build-angular:dev-server",
|
|
114
|
-
"options": {
|
|
115
|
-
"browserTarget": "example:build"
|
|
116
|
-
},
|
|
117
|
-
"configurations": {
|
|
118
|
-
"production": {
|
|
119
|
-
"browserTarget": "example:build:production"
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
"extract-i18n": {
|
|
124
|
-
"builder": "@angular-devkit/build-angular:extract-i18n",
|
|
125
|
-
"options": {
|
|
126
|
-
"browserTarget": "example:build"
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
"defaultProject": "example",
|
|
133
|
-
"cli": {
|
|
134
|
-
"analytics": "7595d21d-c10d-4b06-8050-b8e56319939c"
|
|
135
|
-
}
|
|
136
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 组件说明
|
|
3
|
-
path: 'components'
|
|
4
|
-
order: 20
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
`NgxGanttModule` 导出了多个组件,基础的组件有 `ngx-gantt`、`ngx-gantt-table`、`ngx-gantt-column`,同时还导出了一些适用于自定义扩展的高级组件 `ngx-gantt-root`、`ngx-gantt-bar`、 `ngx-gantt-range`。
|
|
8
|
-
|
|
9
|
-
# 基础组件
|
|
10
|
-
|
|
11
|
-
## ngx-gantt
|
|
12
|
-
|
|
13
|
-
`ngx-gantt` 甘特图的根组件。
|
|
14
|
-
|
|
15
|
-
## ngx-gantt-table
|
|
16
|
-
|
|
17
|
-
`ngx-gantt-table`组件是指甘特图左侧的表格,该组件在`ngx-gantt`组件内部使用。
|
|
18
|
-
|
|
19
|
-
## ngx-gantt-column
|
|
20
|
-
|
|
21
|
-
`ngx-gantt-column`组件指甘特图左侧的表格中的列,该组件在`ngx-gantt-table`组件内部使用。
|
|
22
|
-
|
|
23
|
-
```html
|
|
24
|
-
<ngx-gantt>
|
|
25
|
-
<ngx-gantt-table>
|
|
26
|
-
<ngx-gantt-column> ... </ngx-gantt-column>
|
|
27
|
-
</ngx-gantt-table>
|
|
28
|
-
</ngx-gantt>
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
# 扩展高级组件
|
|
32
|
-
|
|
33
|
-
## ngx-gantt-root
|
|
34
|
-
|
|
35
|
-
`ngx-gantt-root` 与 `ngx-gantt` 组件类似,参数也基本一致,基于 `ngx-gantt-root` 组件我们可以自定义左侧与右侧区域的内容,一般用于有自定义需求的甘特图基于此组件做二次封装。
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# ngx-gantt-bar
|
|
39
|
-
|
|
40
|
-
`ngx-gantt-bar`组件指甘特图右侧水平的条形图,常用于表示项目下的任务。在无其他特殊需求,仅作为展示的情况下是用不到该组件的。该组件可在`ngx-gantt-root`组件内部使用,以满足一些自定义甘特图的场景。
|
|
41
|
-
|
|
42
|
-
# ngx-gantt-range
|
|
43
|
-
|
|
44
|
-
`ngx-gantt-range`组件和`ngx-gantt-bar`是相似的,区别在于`ngx-gantt-bar`是条形图展示而`ngx-gantt-range`组件是范围区间展示,常用于表示时间范围区间。
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
```html
|
|
48
|
-
<ngx-gantt-root>
|
|
49
|
-
<ng-template #sideTemplate></ng-template>
|
|
50
|
-
<ng-template #mainTemplate>
|
|
51
|
-
<ngx-gantt-bar></ngx-gantt-bar>
|
|
52
|
-
</ng-template>
|
|
53
|
-
</ngx-gantt-root>
|
|
54
|
-
```
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 事件类型
|
|
3
|
-
path: 'event'
|
|
4
|
-
order: 40
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# GanttDragEvent
|
|
8
|
-
|
|
9
|
-
数据项拖拽事件类,用于拖拽开始后或结束后传递数据项
|
|
10
|
-
|
|
11
|
-
```ts
|
|
12
|
-
export class GanttDragEvent<T = unknown> {
|
|
13
|
-
item: GanttItem<T>;
|
|
14
|
-
}
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
# GanttTableEvent
|
|
18
|
-
|
|
19
|
-
左侧表格列数或拖拽改变列宽时传递当前所有列的信息
|
|
20
|
-
|
|
21
|
-
```ts
|
|
22
|
-
export class GanttTableEvent {
|
|
23
|
-
columns: QueryList<NgxGanttTableColumnComponent>;
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
# GanttLinkDragEvent
|
|
28
|
-
|
|
29
|
-
拖拽数据项与其他数据项建立关联关系时传递当前数据项与目标数据项信息
|
|
30
|
-
|
|
31
|
-
```ts
|
|
32
|
-
export class GanttLinkDragEvent<T = unknown> {
|
|
33
|
-
source: GanttItem<T>;
|
|
34
|
-
target?: GanttItem<T>;
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
# GanttLoadOnScrollEvent
|
|
39
|
-
|
|
40
|
-
左右滚动时传递滚动后的时间区间,便于使用方加载数据
|
|
41
|
-
|
|
42
|
-
```ts
|
|
43
|
-
export class GanttLoadOnScrollEvent {
|
|
44
|
-
start: number;
|
|
45
|
-
end: number;
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
# GanttLineClickEvent
|
|
50
|
-
|
|
51
|
-
点击两个建立关联关系的数据项的关联线时传递鼠标事件和两个数据项
|
|
52
|
-
|
|
53
|
-
```ts
|
|
54
|
-
export class GanttLineClickEvent<T = unknown> {
|
|
55
|
-
event: MouseEvent;
|
|
56
|
-
source: GanttItem<T>;
|
|
57
|
-
target: GanttItem<T>;
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
# GanttBarClickEvent
|
|
62
|
-
|
|
63
|
-
点击数据项时传递数据项信息
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
export class GanttBarClickEvent<T = unknown> {
|
|
67
|
-
event: Event;
|
|
68
|
-
item: GanttItem<T>;
|
|
69
|
-
}
|
|
70
|
-
```
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 样式重写
|
|
3
|
-
path: 'style'
|
|
4
|
-
order: 50
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
`ngx-gantt` 使用了 `css` 预处理器 `scss`,支持重写组件的大部分的色值和部分layout样式。
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
```scss
|
|
11
|
-
// basic
|
|
12
|
-
$gantt-color: #333 !default;
|
|
13
|
-
$gantt-header-height: 44px !default;
|
|
14
|
-
$gantt-border-color: #eee !default;
|
|
15
|
-
$gantt-bg-color: #fff !default;
|
|
16
|
-
$gantt-side-shadow: 12px 0 16px -10px rgba(0, 0, 0, 0.15) !default;
|
|
17
|
-
$gantt-container-background-color: #fafafa !default;
|
|
18
|
-
$gantt-item-height: 44px !default;
|
|
19
|
-
$gantt-group-background-color: rgba(
|
|
20
|
-
$color: #f3f3f3,
|
|
21
|
-
$alpha: 0.5
|
|
22
|
-
) !default;
|
|
23
|
-
$gantt-group-height: 44px !default;
|
|
24
|
-
$gantt-table-td-padding: 0 15px !default;
|
|
25
|
-
|
|
26
|
-
// calendar
|
|
27
|
-
$gantt-date-primary-color: #888 !default;
|
|
28
|
-
$gantt-date-primary-font-size: 14px !default;
|
|
29
|
-
$gantt-date-primary-border: #ddd !default;
|
|
30
|
-
$gantt-date-secondary-color: #333 !default;
|
|
31
|
-
$gantt-date-secondary-font-size: 14px !default;
|
|
32
|
-
$gantt-date-secondary-weekend-color: #aaa !default;
|
|
33
|
-
$gantt-date-week-backdrop-bg: rgba(
|
|
34
|
-
$color: #f3f3f3,
|
|
35
|
-
$alpha: 0.5
|
|
36
|
-
) !default;
|
|
37
|
-
$gantt-date-today-color: #ff9f73 !default;
|
|
38
|
-
$gantt-date-today-text-color: #fff !default;
|
|
39
|
-
|
|
40
|
-
// bar
|
|
41
|
-
$gantt-bar-bg: #fff !default;
|
|
42
|
-
$gantt-bar-layer-bg: #fff !default;
|
|
43
|
-
$gantt-bar-handle-color: #cacaca !default;
|
|
44
|
-
$gantt-bar-handle-height: 12px !default;
|
|
45
|
-
$gantt-bar-background-color: #348fe4 !default;
|
|
46
|
-
|
|
47
|
-
// drag
|
|
48
|
-
$gantt-item-drag-mask-color: #348fe4 !default;
|
|
49
|
-
$gantt-link-dragging-line-color: #348fe4 !default;
|
|
50
|
-
|
|
51
|
-
// link
|
|
52
|
-
$gantt-link-line-color: #348fe4 !default;
|
|
53
|
-
|
|
54
|
-
// table
|
|
55
|
-
$gantt-table-header-drag-line-width: 3px !default;
|
|
56
|
-
$gantt-table-header-drag-line-color: #348fe4 !default;
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
示例:
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
$gantt-color: #000;
|
|
64
|
-
$gantt-bg-color: #fafafa;
|
|
65
|
-
|
|
66
|
-
@import '~@worktile/gantt/main.bundle.scss';
|
|
67
|
-
|
|
68
|
-
```
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 数据类型
|
|
3
|
-
path: 'data-type'
|
|
4
|
-
order: 30
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
`ngx-gantt` 组件接收两种数据输入类型 `GanttItem`和`GanttGroup`。`GanttItem` 指甘特图数据项格式,`GanttGroup`指分组数据格式,具体类型定义如下:
|
|
8
|
-
|
|
9
|
-
# GanttItem
|
|
10
|
-
|
|
11
|
-
```ts
|
|
12
|
-
export interface GanttItem<T = unknown> {
|
|
13
|
-
id: string;
|
|
14
|
-
title: string;
|
|
15
|
-
start?: number;
|
|
16
|
-
end?: number;
|
|
17
|
-
group_id?: string;
|
|
18
|
-
links?: string[];
|
|
19
|
-
draggable?: boolean;
|
|
20
|
-
linkable?: boolean;
|
|
21
|
-
expandable?: boolean;
|
|
22
|
-
expanded?: boolean;
|
|
23
|
-
children?: GanttItem[];
|
|
24
|
-
color?: string;
|
|
25
|
-
barStyle?: Partial<CSSStyleDeclaration>;
|
|
26
|
-
origin?: T;
|
|
27
|
-
type?: GanttItemType;
|
|
28
|
-
progress?: number;
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
| Name | Type | Default | Description |
|
|
34
|
-
| ---------- | ------------------------------ | ------- | -------------------------------------- |
|
|
35
|
-
| id | `string` | `-` | 唯一标识 |
|
|
36
|
-
| title | `string` | `-` | 名称 |
|
|
37
|
-
| start | `number` | `-` | 开始时间 |
|
|
38
|
-
| end | `number` | `-` | 截止时间 |
|
|
39
|
-
| group_id | `string` | `-` | 对应分组的 Id |
|
|
40
|
-
| links | `string[]` | `-` | 具有关联关系的`GanttItem`的`id`集合 |
|
|
41
|
-
| draggable | `boolean` | `-` | 设置是否可拖拽 |
|
|
42
|
-
| linkable | `boolean` | `-` | 设置是否可关联/被关联 |
|
|
43
|
-
| expandable | `boolean` | `-` | 设置是否可展开/收起 |
|
|
44
|
-
| expanded | `boolean` | `false` | 设置是否展开/收起 |
|
|
45
|
-
| children | `GanttItem[]` | `-` | 设置子数据 |
|
|
46
|
-
| color | `string` | `-` | 设置颜色 |
|
|
47
|
-
| barStyle | `Partial<CSSStyleDeclaration>` | `-` | 设置样式 |
|
|
48
|
-
| origin | `T` | `-` | 设置原始数据 |
|
|
49
|
-
| type | `GanttItemType` | `-` | 设置数据展示方式(区间展示和普通展示) |
|
|
50
|
-
| progress | `number` | `-` | 设置进度 |
|
|
51
|
-
|
|
52
|
-
# GanttGroup
|
|
53
|
-
|
|
54
|
-
```ts
|
|
55
|
-
export interface GanttGroup<T = unknown> {
|
|
56
|
-
id: string;
|
|
57
|
-
title: string;
|
|
58
|
-
expanded?: boolean;
|
|
59
|
-
origin?: T;
|
|
60
|
-
class?: string;
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
| Name | Type | Default | Description |
|
|
65
|
-
| -------- | --------- | ------- | ----------------- |
|
|
66
|
-
| id | `string` | `-` | 唯一标识 |
|
|
67
|
-
| title | `string` | `-` | 名称 |
|
|
68
|
-
| expanded | `boolean` | `true` | 设置是否展开/收起 |
|
|
69
|
-
| origin | `T` | `-` | 设置原始数据 |
|
|
70
|
-
| class | `string` | `-` | 设置`class` |
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 如何使用
|
|
3
|
-
path: usage
|
|
4
|
-
order: 10
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 基本使用
|
|
8
|
-
|
|
9
|
-
一般情况下最基本的使用我们只需要定义 `items` 数据传入组件中,如需要左侧的表格展示,则还需要定义表格的 column
|
|
10
|
-
|
|
11
|
-
```html
|
|
12
|
-
<ngx-gantt #gantt [items]="items">
|
|
13
|
-
<ngx-gantt-table>
|
|
14
|
-
<ngx-gantt-column name="标题" width="300px">
|
|
15
|
-
<ng-template #cell let-item="item"> {{ item.title }} </ng-template>
|
|
16
|
-
</ngx-gantt-column>
|
|
17
|
-
</ngx-gantt-table>
|
|
18
|
-
</ngx-gantt>
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
```javascript
|
|
22
|
-
export class AppGanttExampleComponent {
|
|
23
|
-
items: GanttItem[] = [
|
|
24
|
-
{ id: '000000', title: 'Task 0', start: 1627729997, end: 1628421197, expandable: true },
|
|
25
|
-
{ id: '000001', title: 'Task 1', start: 1617361997, end: 1625483597, links: ['000003', '000004', '000000'], expandable: true },
|
|
26
|
-
{ id: '000002', title: 'Task 2', start: 1610536397, end: 1610622797 },
|
|
27
|
-
{ id: '000003', title: 'Task 3', start: 1628507597, end: 1633345997, expandable: true }
|
|
28
|
-
];
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## 如何设置分组
|
|
33
|
-
|
|
34
|
-
分组模式下我们还需要传入一个 `groups` 的数组,并且保证我们传入的 `items` 数据中设置了每个数据项的 `group_id`
|
|
35
|
-
|
|
36
|
-
```html
|
|
37
|
-
<ngx-gantt #gantt [groups]="groups" [items]="items">
|
|
38
|
-
<ngx-gantt-table>
|
|
39
|
-
<ngx-gantt-column name="标题" width="300px">
|
|
40
|
-
<ng-template #cell let-item="item"> {{ item.title }} </ng-template>
|
|
41
|
-
</ngx-gantt-column>
|
|
42
|
-
</ngx-gantt-table>
|
|
43
|
-
</ngx-gantt>
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
```javascript
|
|
47
|
-
export class AppGanttExampleComponent {
|
|
48
|
-
groups: GanttGroup[] = [
|
|
49
|
-
{ id: '000000', title: 'Group-0' },
|
|
50
|
-
{ id: '000001', title: 'Group-1' }
|
|
51
|
-
];
|
|
52
|
-
items: GanttItem[] = [
|
|
53
|
-
{ id: '000000', title: 'Task 0', start: 1627729997, end: 1628421197, group_id: '000000' },
|
|
54
|
-
{ id: '000001', title: 'Task 1', start: 1617361997, end: 1625483597, group_id: '000001' }
|
|
55
|
-
];
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## 树形结构展示
|
|
60
|
-
|
|
61
|
-
`GanttItem` 类型包含 `children` 属性,默认情况下只要我们传入了 `children` 属性则就就会展示为树形结构。
|
|
62
|
-
|
|
63
|
-
```javascript
|
|
64
|
-
export class AppGanttExampleComponent {
|
|
65
|
-
items: GanttItem[] = [
|
|
66
|
-
{
|
|
67
|
-
id: '000000',
|
|
68
|
-
title: 'Task 0',
|
|
69
|
-
children: [
|
|
70
|
-
{ id: '000000-01', title: 'Task 0-1' },
|
|
71
|
-
{ id: '000000-02', title: 'Task 0-2' }
|
|
72
|
-
]
|
|
73
|
-
}
|
|
74
|
-
];
|
|
75
|
-
}
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
如果需要异步加载子数据,我们需要设置将组件的 `async` 设置为 `true` 然后设置加载子数据的 Resolve 函数 `childrenResolve`,最后我们还需要指定哪些数据是可展开的。
|
|
79
|
-
|
|
80
|
-
```html
|
|
81
|
-
<ngx-gantt #gantt [items]="items" [async]="true" [childrenResolve]="childrenResolve"> ... </ngx-gantt>
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
```javascript
|
|
85
|
-
export class AppGanttExampleComponent {
|
|
86
|
-
// 设置 expandable 为true 指定数据是可展开的
|
|
87
|
-
items: GanttItem[] = [
|
|
88
|
-
{ id: '000000', title: 'Task 0', start: 1627729997, end: 1628421197, expandable: true },
|
|
89
|
-
{ id: '000001', title: 'Task 1', start: 1617361997, end: 1625483597, expandable: true }
|
|
90
|
-
];
|
|
91
|
-
|
|
92
|
-
// 设置加载子数据的 Resolve 函数,返回值必须是一个可观察对象 Observable
|
|
93
|
-
childrenResolve = (item: GanttItem) => {
|
|
94
|
-
const children = randomItems(random(1, 5), item);
|
|
95
|
-
return of(children).pipe(delay(1000));
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## 依赖
|
|
101
|
-
|
|
102
|
-
如果我们需要展示数据项的依赖关系,则需要设置 `GanttItem` 中的 `links` 属性,设置需要关联的 id,如果需要拖拽创建关联关系,则需要设置 `[linkable] = true`,在某些场景下可能我们需要设置某一条数据开启拖拽创建关联,我们也可以通过设置 item 数据的 `linkable` 来实现。
|
|
103
|
-
|
|
104
|
-
```html
|
|
105
|
-
<ngx-gantt #gantt [items]="items" [linkable]="true" (linkDragEnded)="linkDragEnded($event)"> ... </ngx-gantt>
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
```javascript
|
|
109
|
-
export class AppGanttExampleComponent {
|
|
110
|
-
items: GanttItem[] = [
|
|
111
|
-
{ id: '000000', title: 'Task 0', start: 1627729997, end: 1628421197, links: ['000001', '000002'] },
|
|
112
|
-
{ id: '000001', title: 'Task 1', start: 1617361997, end: 1625483597, links: ['000003'] },
|
|
113
|
-
{ id: '000002', title: 'Task 2', start: 1617361997, end: 1625483597, linkable: false }
|
|
114
|
-
];
|
|
115
|
-
|
|
116
|
-
linkDragEnded($event: GanttLinkDragEvent) {
|
|
117
|
-
this.http
|
|
118
|
-
.post(`/api/item/deps`, {
|
|
119
|
-
source: event.source,
|
|
120
|
-
target: event.target
|
|
121
|
-
})
|
|
122
|
-
.subscribe((items) => {});
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## 滚动加载
|
|
128
|
-
|
|
129
|
-
为了保证组件的性能,默认情况下只会展示一定周期的时间(不同的视图周期不同),所以组件默认开启了滚动加载。如果不需要滚动加载可以通过设置 `[disabledLoadOnScroll]=true` 来禁用。
|
|
130
|
-
|
|
131
|
-
```html
|
|
132
|
-
<ngx-gantt #gantt [items]="items" (loadOnScroll)="loadOnScroll($event)"> ... </ngx-gantt>
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
```javascript
|
|
136
|
-
export class AppGanttExampleComponent {
|
|
137
|
-
items: GanttItem[] = [
|
|
138
|
-
{ id: '000000', title: 'Task 0', start: 1627729997, end: 1628421197 },
|
|
139
|
-
{ id: '000001', title: 'Task 1', start: 1617361997, end: 1625483597 },
|
|
140
|
-
{ id: '000002', title: 'Task 2', start: 1617361997, end: 1625483597 }
|
|
141
|
-
];
|
|
142
|
-
|
|
143
|
-
loadOnScroll(event: GanttLoadOnScrollEvent) {
|
|
144
|
-
this.http.get(`/api/items?start=${event.start}&end=${event.end}`).subscribe((items) => {
|
|
145
|
-
this.items = [...this.items, ...items];
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
## 拖拽
|
|
152
|
-
|
|
153
|
-
通过设置 `[draggable]=true` 来启用拖拽功能,支持 `(dragStarted)`、`(dragEnded)` 事件。
|
|
154
|
-
|
|
155
|
-
```html
|
|
156
|
-
<ngx-gantt #gantt [items]="items" [draggable]="true" (dragEnded)="dragEnded($event)"> ... </ngx-gantt>
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
```javascript
|
|
160
|
-
export class AppGanttExampleComponent {
|
|
161
|
-
dragEnded($event: GanttDragEvent) {
|
|
162
|
-
this.http
|
|
163
|
-
.put(`/api/item/${$event.item.id}`, {
|
|
164
|
-
start: $event.item.start,
|
|
165
|
-
end: $event.item.end
|
|
166
|
-
})
|
|
167
|
-
.subscribe((items) => {});
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
## 导出为图片
|
|
173
|
-
|
|
174
|
-
如需要导出图片功能,我们需要在使用组件时注入图片打印服务 `GanttPrintService`
|
|
175
|
-
|
|
176
|
-
```javascript
|
|
177
|
-
@Component({
|
|
178
|
-
selector: 'app-gantt-example',
|
|
179
|
-
templateUrl: './gantt.component.html',
|
|
180
|
-
providers: [GanttPrintService]
|
|
181
|
-
})
|
|
182
|
-
export class AppGanttExampleComponent {
|
|
183
|
-
@ViewChild('gantt') ganttComponent: NgxGanttComponent;
|
|
184
|
-
|
|
185
|
-
exportImage() {
|
|
186
|
-
ganttComponent.print('image name');
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
```
|
package/docs/guides/index.md
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 快速开始
|
|
3
|
-
path: 'getting-started'
|
|
4
|
-
order: 2
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# 安装
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
$ npm i @worktile/gantt --save
|
|
11
|
-
# or
|
|
12
|
-
$ yarn add @worktile/gantt
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
# 使用
|
|
16
|
-
|
|
17
|
-
### 导入模块
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
import { NgModule } from '@angular/core';
|
|
21
|
-
import { NgxGanttModule } from '@worktile/gantt';
|
|
22
|
-
|
|
23
|
-
@NgModule({
|
|
24
|
-
...
|
|
25
|
-
imports: [ NgxGanttModule, ... ]
|
|
26
|
-
...
|
|
27
|
-
})
|
|
28
|
-
export class AppModule {
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
<br/>
|
|
34
|
-
|
|
35
|
-
### 引入样式
|
|
36
|
-
在 angular.json 中引入
|
|
37
|
-
```json
|
|
38
|
-
{
|
|
39
|
-
"styles": [
|
|
40
|
-
"node_modules/@worktile/gantt/main.bundle.scss"
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
在style.scss中引入预构建样式文件
|
|
45
|
-
```
|
|
46
|
-
@import "~@worktile/gantt/main.bundle.scss";
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### 组件中使用
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
```html
|
|
53
|
-
<!-- component.html -->
|
|
54
|
-
<ngx-gantt #gantt [items]="items">
|
|
55
|
-
<ngx-gantt-table>
|
|
56
|
-
<ngx-gantt-column name="标题" width="300px">
|
|
57
|
-
<ng-template #cell let-item="item"> {{ item.title }} </ng-template>
|
|
58
|
-
</ngx-gantt-column>
|
|
59
|
-
</ngx-gantt-table>
|
|
60
|
-
</ngx-gantt>
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
```javascript
|
|
64
|
-
// component.ts
|
|
65
|
-
@Component({
|
|
66
|
-
selector: 'app-gantt-example',
|
|
67
|
-
templateUrl: './gantt.component.html'
|
|
68
|
-
})
|
|
69
|
-
export class AppGanttExampleComponent {
|
|
70
|
-
items: GanttItem[] = [
|
|
71
|
-
{ id: '000000', title: 'Task 0', start: 1627729997, end: 1628421197, expandable: true },
|
|
72
|
-
{ id: '000001', title: 'Task 1', start: 1617361997, end: 1625483597, links: ['000003', '000004', '000000'], expandable: true },
|
|
73
|
-
{ id: '000002', title: 'Task 2', start: 1610536397, end: 1610622797 },
|
|
74
|
-
{ id: '000003', title: 'Task 3', start: 1628507597, end: 1633345997, expandable: true }
|
|
75
|
-
];
|
|
76
|
-
|
|
77
|
-
constructor() {}
|
|
78
|
-
}
|
|
79
|
-
```
|