@worktile/gantt 11.0.2 → 12.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/.all-contributorsrc +53 -0
- package/.angulardoc.json +4 -0
- package/.circleci/config.yml +17 -0
- package/.coveralls.yml +1 -0
- package/.docgenirc.js +64 -0
- package/.editorconfig +22 -0
- package/.prettierrc +24 -0
- package/.travis.yml +23 -0
- package/CHANGELOG.md +564 -0
- package/Dockerfile +4 -0
- package/LICENSE +21 -0
- package/README.md +116 -13
- package/angular.json +136 -0
- package/docs/guides/basic/components.md +54 -0
- package/docs/guides/basic/event.md +70 -0
- package/docs/guides/basic/index.md +4 -0
- package/docs/guides/basic/style.md +68 -0
- package/docs/guides/basic/type.md +70 -0
- package/docs/guides/basic/usage.md +189 -0
- package/docs/guides/index.md +5 -0
- package/docs/guides/intro/getting-started.md +79 -0
- package/docs/guides/intro/index.md +51 -0
- package/docs/index.md +0 -0
- package/example/browserslist +12 -0
- package/example/src/app/app-routing.module.ts +26 -0
- package/example/src/app/app.component.html +2 -0
- package/example/src/app/app.component.ts +11 -0
- package/example/src/app/app.module.ts +57 -0
- package/example/src/app/components/components.component.html +6 -0
- package/example/src/app/components/components.component.ts +33 -0
- package/example/src/app/configuration/parameters/api/zh-cn.js +350 -0
- package/example/src/app/configuration/parameters/doc/zh-cn.md +5 -0
- package/example/src/app/gantt/gantt.component.html +51 -0
- package/example/src/app/gantt/gantt.component.ts +119 -0
- package/example/src/app/gantt-advanced/component/flat.component.html +30 -0
- package/example/src/app/gantt-advanced/component/flat.component.ts +72 -0
- package/example/src/app/gantt-advanced/component/flat.scss +31 -0
- package/example/src/app/gantt-advanced/gantt-advanced.component.html +32 -0
- package/example/src/app/gantt-advanced/gantt-advanced.component.ts +34 -0
- package/example/src/app/gantt-advanced/mocks.ts +158 -0
- package/example/src/app/gantt-groups/gantt-groups.component.html +42 -0
- package/example/src/app/gantt-groups/gantt-groups.component.ts +62 -0
- package/example/src/app/gantt-range/gantt-range.component.html +66 -0
- package/example/src/app/gantt-range/gantt-range.component.ts +67 -0
- package/example/src/app/gantt-range/mocks.ts +150 -0
- package/example/src/app/helper.ts +38 -0
- package/example/src/assets/.gitkeep +0 -0
- package/example/src/environments/environment.prod.ts +3 -0
- package/example/src/environments/environment.ts +16 -0
- package/example/src/favicon.ico +0 -0
- package/example/src/index.html +13 -0
- package/example/src/main.ts +12 -0
- package/example/src/polyfills.ts +63 -0
- package/example/src/styles.scss +56 -0
- package/example/tsconfig.app.json +18 -0
- package/nginx.conf +17 -0
- package/package.json +113 -17
- package/packages/gantt/README.md +24 -0
- package/packages/gantt/karma.conf.js +46 -0
- package/packages/gantt/ng-package.json +7 -0
- package/packages/gantt/ng-package.prod.json +7 -0
- package/packages/gantt/package.json +16 -0
- package/packages/gantt/src/class/date-point.ts +14 -0
- package/{class/event.d.ts → packages/gantt/src/class/event.ts} +12 -6
- package/packages/gantt/src/class/group.ts +36 -0
- package/{class/index.d.ts → packages/gantt/src/class/index.ts} +0 -0
- package/packages/gantt/src/class/item.ts +129 -0
- package/packages/gantt/src/class/test/group.spec.ts +21 -0
- package/packages/gantt/src/class/test/item.spec.ts +102 -0
- package/packages/gantt/src/class/view-type.ts +7 -0
- package/packages/gantt/src/components/bar/bar-drag.ts +298 -0
- package/packages/gantt/src/components/bar/bar.component.html +17 -0
- package/packages/gantt/src/components/bar/bar.component.scss +169 -0
- package/packages/gantt/src/components/bar/bar.component.ts +109 -0
- package/packages/gantt/src/components/bar/test/bar.component.spec.ts +54 -0
- package/packages/gantt/src/components/bar/test/bar.drag.spec.ts +196 -0
- package/packages/gantt/src/components/calendar/calendar.component.html +52 -0
- package/packages/gantt/src/components/calendar/calendar.component.scss +77 -0
- package/packages/gantt/src/components/calendar/calendar.component.ts +100 -0
- package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.html +6 -0
- package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.scss +48 -0
- package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.ts +13 -0
- package/packages/gantt/src/components/icon/icon.component.scss +13 -0
- package/packages/gantt/src/components/icon/icon.component.ts +28 -0
- package/packages/gantt/src/components/icon/icons.ts +86 -0
- package/packages/gantt/src/components/links/links.component.html +19 -0
- package/packages/gantt/src/components/links/links.component.scss +27 -0
- package/packages/gantt/src/components/links/links.component.ts +263 -0
- package/packages/gantt/src/components/main/gantt-main.component.html +35 -0
- package/packages/gantt/src/components/main/gantt-main.component.ts +35 -0
- package/packages/gantt/src/components/range/range.component.html +8 -0
- package/packages/gantt/src/components/range/range.component.scss +35 -0
- package/packages/gantt/src/components/range/range.component.ts +27 -0
- package/packages/gantt/src/components/range/test/range.component.spec.ts +80 -0
- package/packages/gantt/src/components/table/gantt-table.component.html +105 -0
- package/packages/gantt/src/components/table/gantt-table.component.scss +144 -0
- package/packages/gantt/src/components/table/gantt-table.component.ts +166 -0
- package/packages/gantt/src/components/table/test/table.spec.ts +129 -0
- package/packages/gantt/src/gantt-abstract.ts +14 -0
- package/packages/gantt/src/gantt-dom.service.ts +134 -0
- package/packages/gantt/src/gantt-drag-container.ts +73 -0
- package/packages/gantt/src/gantt-item-upper.ts +50 -0
- package/packages/gantt/src/gantt-print.service.ts +104 -0
- package/packages/gantt/src/gantt-upper.ts +289 -0
- package/packages/gantt/src/gantt.component.html +18 -0
- package/packages/gantt/src/gantt.component.scss +77 -0
- package/packages/gantt/src/gantt.component.ts +134 -0
- package/packages/gantt/src/gantt.module.ts +47 -0
- package/packages/gantt/src/gantt.pipe.ts +31 -0
- package/packages/gantt/src/gantt.styles.ts +28 -0
- package/{public-api.d.ts → packages/gantt/src/public-api.ts} +6 -0
- package/packages/gantt/src/root.component.html +12 -0
- package/packages/gantt/src/root.component.ts +121 -0
- package/packages/gantt/src/styles/index.scss +9 -0
- package/packages/gantt/src/styles/variables.scss +46 -0
- package/packages/gantt/src/table/gantt-column.component.ts +25 -0
- package/packages/gantt/src/table/gantt-table.component.ts +14 -0
- package/packages/gantt/src/table/test/table.spec.ts +56 -0
- package/packages/gantt/src/test/gantt.component.spec.ts +404 -0
- package/packages/gantt/src/test/mocks/data.ts +303 -0
- package/packages/gantt/src/test.ts +21 -0
- package/packages/gantt/src/utils/date.ts +276 -0
- package/packages/gantt/src/utils/helpers.ts +66 -0
- package/packages/gantt/src/utils/test/date.spec.ts +105 -0
- package/packages/gantt/src/utils/test/helpers.spec.ts +73 -0
- package/packages/gantt/src/utils/testing.ts +64 -0
- package/packages/gantt/src/views/day.ts +74 -0
- package/packages/gantt/src/views/factory.ts +25 -0
- package/packages/gantt/src/views/month.ts +66 -0
- package/packages/gantt/src/views/quarter.ts +68 -0
- package/packages/gantt/src/views/test/day.spec.ts +45 -0
- package/packages/gantt/src/views/test/factory.spec.ts +41 -0
- package/packages/gantt/src/views/test/mock.ts +14 -0
- package/packages/gantt/src/views/test/month.spec.ts +45 -0
- package/packages/gantt/src/views/test/quarter.spec.ts +45 -0
- package/packages/gantt/src/views/test/view.spec.ts +144 -0
- package/packages/gantt/src/views/test/week.spec.ts +45 -0
- package/packages/gantt/src/views/test/year.spec.ts +45 -0
- package/packages/gantt/src/views/view.ts +186 -0
- package/packages/gantt/src/views/week.ts +66 -0
- package/packages/gantt/src/views/year.ts +62 -0
- package/packages/gantt/tsconfig.lib.json +20 -0
- package/packages/gantt/tsconfig.lib.prod.json +9 -0
- package/packages/gantt/tsconfig.schematics.json +25 -0
- package/packages/gantt/tsconfig.spec.json +17 -0
- package/packages/gantt/tslint.json +18 -0
- package/scss-bundle.config.json +7 -0
- package/tsconfig.json +26 -0
- package/tslint.json +51 -0
- package/bundles/worktile-gantt.umd.js +0 -3129
- package/bundles/worktile-gantt.umd.js.map +0 -1
- package/bundles/worktile-gantt.umd.min.js +0 -16
- package/bundles/worktile-gantt.umd.min.js.map +0 -1
- package/class/date-point.d.ts +0 -15
- package/class/group.d.ts +0 -22
- package/class/item.d.ts +0 -70
- package/class/view-type.d.ts +0 -7
- package/components/bar/bar-drag.d.ts +0 -34
- package/components/bar/bar.component.d.ts +0 -23
- package/components/calendar/calendar.component.d.ts +0 -25
- package/components/drag-backdrop/drag-backdrop.component.d.ts +0 -6
- package/components/icon/icon.component.d.ts +0 -10
- package/components/icon/icons.d.ts +0 -8
- package/components/links/links.component.d.ts +0 -44
- package/components/main/gantt-main.component.d.ts +0 -18
- package/components/range/range.component.d.ts +0 -10
- package/components/table/gantt-table.component.d.ts +0 -31
- package/esm2015/class/date-point.js +0 -10
- package/esm2015/class/event.js +0 -13
- package/esm2015/class/group.js +0 -17
- package/esm2015/class/index.js +0 -6
- package/esm2015/class/item.js +0 -78
- package/esm2015/class/view-type.js +0 -9
- package/esm2015/components/bar/bar-drag.js +0 -266
- package/esm2015/components/bar/bar.component.js +0 -91
- package/esm2015/components/calendar/calendar.component.js +0 -82
- package/esm2015/components/drag-backdrop/drag-backdrop.component.js +0 -18
- package/esm2015/components/icon/icon.component.js +0 -36
- package/esm2015/components/icon/icons.js +0 -87
- package/esm2015/components/links/links.component.js +0 -207
- package/esm2015/components/main/gantt-main.component.js +0 -35
- package/esm2015/components/range/range.component.js +0 -32
- package/esm2015/components/table/gantt-table.component.js +0 -128
- package/esm2015/gantt-dom.service.js +0 -101
- package/esm2015/gantt-drag-container.js +0 -57
- package/esm2015/gantt-item-upper.js +0 -55
- package/esm2015/gantt-print.service.js +0 -92
- package/esm2015/gantt-upper.js +0 -231
- package/esm2015/gantt.component.js +0 -105
- package/esm2015/gantt.module.js +0 -43
- package/esm2015/gantt.pipe.js +0 -33
- package/esm2015/gantt.styles.js +0 -15
- package/esm2015/public-api.js +0 -16
- package/esm2015/root.component.js +0 -111
- package/esm2015/table/gantt-column.component.js +0 -28
- package/esm2015/table/gantt-table.component.js +0 -18
- package/esm2015/utils/date.js +0 -160
- package/esm2015/utils/helpers.js +0 -45
- package/esm2015/views/day.js +0 -54
- package/esm2015/views/factory.js +0 -23
- package/esm2015/views/month.js +0 -48
- package/esm2015/views/quarter.js +0 -51
- package/esm2015/views/view.js +0 -121
- package/esm2015/views/week.js +0 -49
- package/esm2015/views/year.js +0 -50
- package/esm2015/worktile-gantt.js +0 -16
- package/fesm2015/worktile-gantt.js +0 -2491
- package/fesm2015/worktile-gantt.js.map +0 -1
- package/gantt-dom.service.d.ts +0 -29
- package/gantt-drag-container.d.ts +0 -20
- package/gantt-item-upper.d.ts +0 -17
- package/gantt-print.service.d.ts +0 -10
- package/gantt-upper.d.ts +0 -62
- package/gantt.component.d.ts +0 -28
- package/gantt.module.d.ts +0 -2
- package/gantt.pipe.d.ts +0 -11
- package/gantt.styles.d.ts +0 -15
- package/root.component.d.ts +0 -25
- package/style.scss +0 -645
- package/table/gantt-column.component.d.ts +0 -12
- package/table/gantt-table.component.d.ts +0 -7
- package/utils/date.d.ts +0 -59
- package/utils/helpers.d.ts +0 -11
- package/views/day.d.ts +0 -14
- package/views/factory.d.ts +0 -8
- package/views/month.d.ts +0 -12
- package/views/quarter.d.ts +0 -12
- package/views/view.d.ts +0 -56
- package/views/week.d.ts +0 -12
- package/views/year.d.ts +0 -12
- package/worktile-gantt.d.ts +0 -15
- package/worktile-gantt.metadata.json +0 -1
package/README.md
CHANGED
|
@@ -1,24 +1,127 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ngx-gantt
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://circleci.com/gh/worktile/ngx-gantt)
|
|
4
|
+
[![Coverage Status][coveralls-image]][coveralls-url]
|
|
5
|
+
[](https://www.npmjs.com/package/@worktile/gantt)
|
|
6
|
+
[](https://www.npmjs.com/package/@worktile/gantt)
|
|
7
|
+

|
|
8
|
+
[](#contributors-)
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
[coveralls-image]: https://coveralls.io/repos/github/worktile/ngx-gantt/badge.svg?branch=master
|
|
11
|
+
[coveralls-url]: https://coveralls.io/github/worktile/ngx-gantt
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-
> Note: Don't forget to add `--project gantt` or else it will be added to the default project in your `angular.json` file.
|
|
13
|
+
A modern and powerful gantt component for Angular
|
|
9
14
|
|
|
10
|
-
##
|
|
15
|
+
## Installation
|
|
11
16
|
|
|
12
|
-
|
|
17
|
+
```bash
|
|
18
|
+
$ npm i @worktile/gantt --save
|
|
19
|
+
# or
|
|
20
|
+
$ yarn add @worktile/gantt
|
|
21
|
+
```
|
|
13
22
|
|
|
14
|
-
##
|
|
23
|
+
## Demo
|
|
15
24
|
|
|
16
|
-
|
|
25
|
+
[Try out our live demo](http://gantt.ngnice.com/)
|
|
17
26
|
|
|
18
|
-
##
|
|
27
|
+
## Usage
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
### 1. Import the NgxGanttModule to use into your app.module.ts
|
|
21
30
|
|
|
22
|
-
|
|
31
|
+
```ts
|
|
32
|
+
import { NgModule } from '@angular/core';
|
|
33
|
+
import { NgxGanttModule } from '@worktile/gantt';
|
|
23
34
|
|
|
24
|
-
|
|
35
|
+
@NgModule({
|
|
36
|
+
...
|
|
37
|
+
imports: [ NgxGanttModule, ... ]
|
|
38
|
+
...
|
|
39
|
+
})
|
|
40
|
+
export class AppModule {
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Import style file in angular.json or import style in your style.scss
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"styles": ["node_modules/@worktile/gantt/main.bundle.scss"]
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```scss
|
|
54
|
+
@import '~@worktile/gantt/main.bundle.scss';
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 3. Using component
|
|
58
|
+
|
|
59
|
+
component.html
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<ngx-gantt #gantt [items]="items">
|
|
63
|
+
<ngx-gantt-table>
|
|
64
|
+
<ngx-gantt-column name="Title" width="300px">
|
|
65
|
+
<ng-template #cell let-item="item"> {{ item.title }} </ng-template>
|
|
66
|
+
</ngx-gantt-column>
|
|
67
|
+
</ngx-gantt-table>
|
|
68
|
+
</ngx-gantt>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
component.ts
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
@Component({
|
|
75
|
+
selector: 'app-gantt-example',
|
|
76
|
+
templateUrl: './gantt.component.html'
|
|
77
|
+
})
|
|
78
|
+
export class AppGanttExampleComponent {
|
|
79
|
+
items: GanttItem[] = [
|
|
80
|
+
{ id: '000000', title: 'Task 0', start: 1627729997, end: 1628421197 },
|
|
81
|
+
{ id: '000001', title: 'Task 1', start: 1617361997, end: 1625483597 }
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
constructor() {}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
See [Getting Started](http://gantt.ngnice.com/guides/getting-started) for more details.
|
|
89
|
+
|
|
90
|
+
## Development
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
$ git clone git@github.com:worktile/ngx-gantt.git
|
|
94
|
+
$ cd ngx-gantt
|
|
95
|
+
$ npm install
|
|
96
|
+
$ npm run start
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Roadmap
|
|
100
|
+
|
|
101
|
+
- [ ] virtual scrolling
|
|
102
|
+
|
|
103
|
+
## Contributors ✨
|
|
104
|
+
|
|
105
|
+
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
106
|
+
|
|
107
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
108
|
+
<!-- prettier-ignore-start -->
|
|
109
|
+
<!-- markdownlint-disable -->
|
|
110
|
+
<table>
|
|
111
|
+
<tr>
|
|
112
|
+
<td align="center"><a href="https://github.com/walkerkay"><img src="https://avatars.githubusercontent.com/u/15701592?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Walker</b></sub></a><br /><a href="#question-walkerkay" title="Answering Questions">💬</a> <a href="https://github.com/walkerkay/ngx-gantt/commits?author=walkerkay" title="Code">💻</a> <a href="#design-walkerkay" title="Design">🎨</a> <a href="https://github.com/walkerkay/ngx-gantt/commits?author=walkerkay" title="Documentation">📖</a> <a href="#infra-walkerkay" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-walkerkay" title="Maintenance">🚧</a> <a href="#projectManagement-walkerkay" title="Project Management">📆</a> <a href="https://github.com/walkerkay/ngx-gantt/pulls?q=is%3Apr+reviewed-by%3Awalkerkay" title="Reviewed Pull Requests">👀</a></td>
|
|
113
|
+
<td align="center"><a href="https://github.com/HandsomeButterball"><img src="https://avatars.githubusercontent.com/u/17664721?v=4?s=100" width="100px;" alt=""/><br /><sub><b>zhangwen</b></sub></a><br /><a href="https://github.com/walkerkay/ngx-gantt/commits?author=HandsomeButterball" title="Code">💻</a></td>
|
|
114
|
+
<td align="center"><a href="https://github.com/mengshuicmq"><img src="https://avatars.githubusercontent.com/u/13193164?v=4?s=100" width="100px;" alt=""/><br /><sub><b>cmq</b></sub></a><br /><a href="https://github.com/walkerkay/ngx-gantt/commits?author=mengshuicmq" title="Code">💻</a></td>
|
|
115
|
+
</tr>
|
|
116
|
+
</table>
|
|
117
|
+
|
|
118
|
+
<!-- markdownlint-restore -->
|
|
119
|
+
<!-- prettier-ignore-end -->
|
|
120
|
+
|
|
121
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
122
|
+
|
|
123
|
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
|
124
|
+
|
|
125
|
+
## LICENSE
|
|
126
|
+
|
|
127
|
+
[MIT License](https://github.com/worktile/ngx-gantt/blob/master/LICENSE)
|
package/angular.json
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
```
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
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` |
|