(this.node = node)}
41 | className={className ? `ibm-gantt-chart-react ${className}` : 'ibm-gantt-chart-react'}
42 | style={style}
43 | />
44 | );
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart-react/src/components/GanttChart/GanttChart.scss:
--------------------------------------------------------------------------------
1 | @charset "utf-8";
2 |
3 | .ibm-gantt-chart-react {
4 | width: 100%;
5 | height: 100%;
6 | }
7 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart-react/src/components/GanttChart/GanttChart.stories.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import { storiesOf } from '@storybook/react'; // eslint-disable-line import/no-extraneous-dependencies
4 |
5 | import GanttChart from './GanttChart';
6 |
7 | const data = [
8 | {
9 | id: 'NURSES+Anne',
10 | name: 'Anne',
11 | activities: [
12 | {
13 | id: 'SHIFTS+Emergency+Monday+2+8',
14 | name: 'Emergency',
15 | start: 1474880400000,
16 | end: 1474902000000,
17 | },
18 | ],
19 | },
20 | {
21 | id: 'NURSES+Bethanie',
22 | name: 'Bethanie',
23 | activities: [],
24 | },
25 | {
26 | id: 'NURSES+Betsy',
27 | name: 'Betsy',
28 | activities: [
29 | {
30 | id: 'SHIFTS+Emergency+Wednesday+12+18',
31 | name: 'Emergency',
32 | start: 1475089200000,
33 | end: 1475110800000,
34 | },
35 | {
36 | id: 'SHIFTS+Emergency+Saturday+12+20',
37 | name: 'Emergency',
38 | start: 1475348400000,
39 | end: 1475377200000,
40 | },
41 | {
42 | id: 'SHIFTS+Consultation+Friday+8+12',
43 | name: 'Consultation',
44 | start: 1475247600000,
45 | end: 1475262000000,
46 | },
47 | ],
48 | },
49 | {
50 | id: 'NURSES+Cathy',
51 | name: 'Cathy',
52 | activities: [
53 | {
54 | id: 'SHIFTS+Emergency+Sunday+20+2',
55 | name: 'Emergency',
56 | start: 1475463600000,
57 | end: 1475485200000,
58 | },
59 | {
60 | id: 'SHIFTS+Emergency+Saturday+12+20',
61 | name: 'Emergency',
62 | start: 1475348400000,
63 | end: 1475377200000,
64 | },
65 | {
66 | id: 'SHIFTS+Emergency+Monday+18+2',
67 | name: 'Emergency',
68 | start: 1474938000000,
69 | end: 1474966800000,
70 | },
71 | ],
72 | },
73 | {
74 | id: 'NURSES+Cindy',
75 | name: 'Cindy',
76 | activities: [
77 | {
78 | id: 'SHIFTS+Emergency+Saturday+20+2',
79 | name: 'Emergency',
80 | start: 1475377200000,
81 | end: 1475398800000,
82 | },
83 | {
84 | id: 'SHIFTS+Consultation+Friday+8+12',
85 | name: 'Consultation',
86 | start: 1475247600000,
87 | end: 1475262000000,
88 | },
89 | {
90 | id: 'SHIFTS+Consultation+Tuesday+8+12',
91 | name: 'Consultation',
92 | start: 1474988400000,
93 | end: 1475002800000,
94 | },
95 | ],
96 | },
97 | ];
98 | const config = {
99 | data: {
100 | // Configures how to fetch resources for the Gantt
101 | resources: {
102 | data, // resources are provided in an array. Instead, we could configure a request to the server.
103 | // Activities of the resources are provided along with the 'activities' property of resource objects.
104 | // Alternatively, they could be listed from the 'data.activities' configuration.
105 | activities: 'activities',
106 | name: 'name', // The name of the resource is provided with the name property of the resource object.
107 | id: 'id', // The id of the resource is provided with the id property of the resource object.
108 | },
109 | // Configures how to fetch activities for the Gantt
110 | // As activities are provided along with the resources, this section only describes how to create
111 | // activity Gantt properties from the activity model objects.
112 | activities: {
113 | start: 'start', // The start of the activity is provided with the start property of the model object
114 | end: 'end', // The end of the activity is provided with the end property of the model object
115 | name: 'name', // The name of the activity is provided with the name property of the model object
116 | },
117 | },
118 | // Configure a toolbar associated with the Gantt
119 | toolbar: [
120 | 'title',
121 | 'search',
122 | 'separator',
123 | {
124 | type: 'button',
125 | text: 'Refresh',
126 | fontIcon: 'fa fa-refresh fa-lg',
127 | onclick(ctx) {
128 | ctx.gantt.draw();
129 | },
130 | },
131 | 'fitToContent',
132 | 'zoomIn',
133 | 'zoomOut',
134 | ],
135 | title: 'Simple Gantt', // Title for the Gantt to be displayed in the toolbar
136 | };
137 |
138 | storiesOf('Components|GanttChart', module).add('default', () =>
);
139 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart-react/src/index.js:
--------------------------------------------------------------------------------
1 | export GanttChart from './components/GanttChart/GanttChart';
2 |
3 | export const version = VERSION;
4 | // console.log(`[LOADED] ${NAME}@${VERSION}`);
5 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart-react/src/storybook/StoryContainer.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | import './StoryContainer.scss';
5 |
6 | // useless with mainFields: ['source'],
7 | // import 'ibm-gantt-chart/dist/ibm-gantt-chart.css';
8 |
9 | const propTypes = {
10 | story: PropTypes.func.isRequired,
11 | };
12 |
13 | const defaultProps = {};
14 |
15 | // do nothing just adding StoryContainer.scss globally
16 | const StoryContainer = ({ story }) => story();
17 |
18 | StoryContainer.propTypes = propTypes;
19 | StoryContainer.defaultProps = defaultProps;
20 |
21 | export default StoryContainer;
22 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart-react/src/storybook/StoryContainer.scss:
--------------------------------------------------------------------------------
1 | @charset "utf-8";
2 |
3 | html,
4 | body,
5 | #root {
6 | height: 100%;
7 | margin: 0;
8 | padding: 0;
9 | }
10 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart-react/webpack.config.all.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable global-require */
2 |
3 | module.exports = [require('./webpack.config.lib'), require('./webpack.config.lib.min')];
4 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart-react/webpack.config.dev.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable import/no-extraneous-dependencies */
2 | const configure = require('gda-scripts/config/webpack.configure');
3 | const common = require('ibm-gantt-chart/webpack.common.js');
4 | const pkg = require('./package.json');
5 |
6 | const { webpack = {}, ...base } = common;
7 |
8 | module.exports = configure(pkg, {
9 | // 'print-config': true,
10 | ...base,
11 | mode: 'development',
12 | input: './src/App.jsx',
13 | webpack: {
14 | ...webpack,
15 | resolve: {
16 | ...(webpack.resolve || {}),
17 | mainFields: ['source'], // use source instead of compiled library
18 | },
19 | },
20 | });
21 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart-react/webpack.config.lib.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable import/no-extraneous-dependencies */
2 | const configure = require('gda-scripts/config/webpack.configure');
3 | const pkg = require('./package.json');
4 |
5 | module.exports = configure(pkg, {
6 | mode: 'production',
7 | sourcemap: true,
8 | minimize: false,
9 | babel: {
10 | helpers: true,
11 | },
12 | monitor: false,
13 | });
14 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart-react/webpack.config.lib.min.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable import/no-extraneous-dependencies */
2 | const configure = require('gda-scripts/config/webpack.configure');
3 | const pkg = require('./package.json');
4 |
5 | module.exports = configure(pkg, {
6 | mode: 'production',
7 | sourcemap: true,
8 | minimize: true,
9 | babel: {
10 | helpers: true,
11 | },
12 | monitor: false,
13 | });
14 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart-react/webpack.config.storybook.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable import/no-extraneous-dependencies */
2 | const configure = require('gda-scripts/config/webpack.configure');
3 | const common = require('ibm-gantt-chart/webpack.common.js');
4 | const pkg = require('./package.json');
5 |
6 | const { webpack = {}, ...base } = common;
7 |
8 | module.exports = configure(pkg, {
9 | // 'print-config': true,
10 | ...base,
11 | mode: 'storybook',
12 | webpack: {
13 | ...webpack,
14 | resolve: {
15 | ...(webpack.resolve || {}),
16 | mainFields: ['source'], // use source instead of compiled library
17 | },
18 | },
19 | });
20 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/data/project_activitychart/constraints.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "from": "A-4.2.1",
4 | "to": "A-4.2.2",
5 | "type": 1
6 | },
7 | {
8 | "from": "A-2",
9 | "to": "A-3",
10 | "type": 1
11 | },
12 | {
13 | "from": "A-4.1.1",
14 | "to": "A-4.1.2",
15 | "type": 1
16 | },
17 | {
18 | "from": "A-5.2",
19 | "to": "A-6.1",
20 | "type": 0
21 | },
22 | {
23 | "from": "A-3",
24 | "to": "A-4",
25 | "type": 1
26 | },
27 | {
28 | "from": "A-4.1.2",
29 | "to": "A-4.2.1",
30 | "type": 0
31 | },
32 | {
33 | "from": "A-1.2",
34 | "to": "A-1.3",
35 | "type": 1
36 | },
37 | {
38 | "from": "A-5.2",
39 | "to": "A-5.3",
40 | "type": 1
41 | },
42 | {
43 | "from": "A-1.1.1",
44 | "to": "A-1.1.2",
45 | "type": 1
46 | },
47 | {
48 | "from": "A-2.1",
49 | "to": "A-2.2",
50 | "type": 1
51 | },
52 | {
53 | "from": "A-1.1",
54 | "to": "A-1.2",
55 | "type": 1
56 | },
57 | {
58 | "from": "A-5.1",
59 | "to": "A-5.2",
60 | "type": 1
61 | },
62 | {
63 | "from": "A-1",
64 | "to": "A-2",
65 | "type": 1
66 | },
67 | {
68 | "from": "A-4",
69 | "to": "A-5",
70 | "type": 1
71 | }
72 | ]
73 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/data/project_activitychart/resas.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "activity": "A-1.3",
4 | "resource": "MS"
5 | },
6 | {
7 | "activity": "A-1.1.2",
8 | "resource": "SK"
9 | },
10 | {
11 | "activity": "A-6.1",
12 | "resource": "SL"
13 | },
14 | {
15 | "activity": "A-5.2",
16 | "resource": "LD"
17 | },
18 | {
19 | "activity": "A-4.1.2",
20 | "resource": "GH"
21 | },
22 | {
23 | "activity": "A-1.1.1",
24 | "resource": "MS"
25 | },
26 | {
27 | "activity": "A-4.4",
28 | "resource": "GH"
29 | },
30 | {
31 | "activity": "A-4.2.2",
32 | "resource": "GH"
33 | },
34 | {
35 | "activity": "A-6.1",
36 | "resource": "BR"
37 | },
38 | {
39 | "activity": "A-4.4",
40 | "resource": "LP"
41 | },
42 | {
43 | "activity": "A-2.2",
44 | "resource": "LP"
45 | },
46 | {
47 | "activity": "A-4",
48 | "resource": "LD"
49 | },
50 | {
51 | "activity": "A-4.2",
52 | "resource": "JH"
53 | },
54 | {
55 | "activity": "A-1.1.1",
56 | "resource": "LP"
57 | },
58 | {
59 | "activity": "A-6.3",
60 | "resource": "GH"
61 | },
62 | {
63 | "activity": "A-4.1.2",
64 | "resource": "TM"
65 | },
66 | {
67 | "activity": "A-5",
68 | "resource": "JH"
69 | },
70 | {
71 | "activity": "A-1.3",
72 | "resource": "BM"
73 | },
74 | {
75 | "activity": "A-3",
76 | "resource": "BM"
77 | },
78 | {
79 | "activity": "A-3",
80 | "resource": "JH"
81 | },
82 | {
83 | "activity": "A-2.1",
84 | "resource": "LP"
85 | },
86 | {
87 | "activity": "A-6.2",
88 | "resource": "LD"
89 | },
90 | {
91 | "activity": "A-6.3",
92 | "resource": "SL"
93 | },
94 | {
95 | "activity": "A-5.2",
96 | "resource": "SW"
97 | },
98 | {
99 | "activity": "A-5.3",
100 | "resource": "TM"
101 | },
102 | {
103 | "activity": "A-4.1",
104 | "resource": "SW"
105 | },
106 | {
107 | "activity": "A-1.1",
108 | "resource": "BM"
109 | },
110 | {
111 | "activity": "A-2.1",
112 | "resource": "MS"
113 | },
114 | {
115 | "activity": "A-4.4",
116 | "resource": "TM"
117 | },
118 | {
119 | "activity": "A-1.1.1",
120 | "resource": "SK"
121 | },
122 | {
123 | "activity": "A-3",
124 | "resource": "GH"
125 | },
126 | {
127 | "activity": "A-1.1.2",
128 | "resource": "LP"
129 | },
130 | {
131 | "activity": "A-4.3",
132 | "resource": "TM"
133 | },
134 | {
135 | "activity": "A-5.3",
136 | "resource": "SW"
137 | },
138 | {
139 | "activity": "A-6.2",
140 | "resource": "BR"
141 | },
142 | {
143 | "activity": "A-4.1.1",
144 | "resource": "TM"
145 | },
146 | {
147 | "activity": "A-1.2",
148 | "resource": "MS"
149 | },
150 | {
151 | "activity": "A-6.3",
152 | "resource": "MS"
153 | },
154 | {
155 | "activity": "A-1.3",
156 | "resource": "LD"
157 | },
158 | {
159 | "activity": "A-4.2.1",
160 | "resource": "TM"
161 | },
162 | {
163 | "activity": "A-4.3",
164 | "resource": "SW"
165 | },
166 | {
167 | "activity": "A-5.1",
168 | "resource": "LD"
169 | }
170 | ]
171 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/data/project_activitychart/resources.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": "JCOM",
4 | "name": "JCompany Employees",
5 | "quantity": "1.0",
6 | "parent": null
7 | },
8 | {
9 | "id": "MKT",
10 | "name": "Marketing",
11 | "quantity": "1.0",
12 | "parent": "JCOM"
13 | },
14 | {
15 | "id": "BM",
16 | "name": "Bill McDonald",
17 | "quantity": "1.0",
18 | "parent": "MKT"
19 | },
20 | {
21 | "id": "SK",
22 | "name": "Steve Knoll",
23 | "quantity": "1.0",
24 | "parent": "MKT"
25 | },
26 | {
27 | "id": "MS",
28 | "name": "Michael Smith",
29 | "quantity": "1.0",
30 | "parent": "MKT"
31 | },
32 | {
33 | "id": "LP",
34 | "name": "Luc Dupont",
35 | "quantity": "1.0",
36 | "parent": "MKT"
37 | },
38 | {
39 | "id": "RND",
40 | "name": "Research and Development",
41 | "quantity": "1.0",
42 | "parent": "JCOM"
43 | },
44 | {
45 | "id": "LD",
46 | "name": "Linus Dane",
47 | "quantity": "1.0",
48 | "parent": "RND"
49 | },
50 | {
51 | "id": "JH",
52 | "name": "James Hook",
53 | "quantity": "1.0",
54 | "parent": "RND"
55 | },
56 | {
57 | "id": "SW",
58 | "name": "Scott Washington",
59 | "quantity": "1.0",
60 | "parent": "RND"
61 | },
62 | {
63 | "id": "GH",
64 | "name": "Gill Hopper",
65 | "quantity": "1.0",
66 | "parent": "RND"
67 | },
68 | {
69 | "id": "TM",
70 | "name": "Thomas Monahan",
71 | "quantity": "1.0",
72 | "parent": "RND"
73 | },
74 | {
75 | "id": "DOC",
76 | "name": "Documentation",
77 | "quantity": "1.0",
78 | "parent": "JCOM"
79 | },
80 | {
81 | "id": "SL",
82 | "name": "Sandy Ladd",
83 | "quantity": "1.0",
84 | "parent": "DOC"
85 | },
86 | {
87 | "id": "BR",
88 | "name": "Bob Robertson",
89 | "quantity": "1.0",
90 | "parent": "DOC"
91 | }
92 | ]
93 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration
2 | // Generated on Wed Oct 12 2016 19:10:29 GMT-0700 (Pacific Daylight Time)
3 |
4 | module.exports = function karma(config) {
5 | config.set({
6 | // base path that will be used to resolve all patterns (eg. files, exclude)
7 | basePath: '',
8 |
9 | // frameworks to use
10 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
11 | frameworks: ['mocha'],
12 |
13 | // list of files / patterns to load in the browser
14 | files: [
15 | '../../node_modules/jquery/dist/jquery.min.js',
16 | '../../node_modules/datatables.net/js/jquery.dataTables.js',
17 | '../../node_modules/vis/dist/vis.min.js',
18 | '../../node_modules/mocha/mocha.css',
19 |
20 | 'dist/ibm-gantt-chart-jquery.js',
21 |
22 | // { pattern: 'dist/images/**/*.*', included: false },
23 | { pattern: 'dist/fonts/**/*.*', included: false },
24 | { pattern: 'dist/*.map', included: false },
25 | { pattern: 'data/**/*.*', included: false },
26 | // { pattern: 'images/**/*.*', included: false },
27 | // { pattern: 'test/images/**/*.*', included: false },
28 |
29 | /* http://www.mattjmorrison.com/today-i-learned/2014/09/24/learned.html */
30 | { pattern: '../../node_modules/datatables.net-dt/css/jquery.dataTables.css', included: false },
31 | { pattern: '../../node_modules/datatables.net-dt/images/*.*', included: false },
32 | { pattern: '../../node_modules/vis/dist/vis.min.css', included: false },
33 | { pattern: '../../node_modules/mocha/mocha.css', included: false },
34 | { pattern: 'dist/ibm-gantt-chart-jquery.css', included: false },
35 |
36 | '../../node_modules/chai/chai.js',
37 | 'test/testbase.js',
38 | 'test/table/*.js',
39 | 'test/**/*.test.js',
40 | ],
41 |
42 | // list of files to exclude
43 | exclude: [
44 | /* 'test/node_modules/!**!/!*.test.js', */
45 | 'test/config.js',
46 | ],
47 |
48 | // preprocess matching files before serving them to the browser
49 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
50 | preprocessors: {},
51 |
52 | // test results reporter to use
53 | // possible values: 'dots', 'progress'
54 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter
55 | reporters: ['progress'],
56 |
57 | // web server port
58 | port: 9876,
59 |
60 | // enable / disable colors in the output (reporters and logs)
61 | colors: true,
62 |
63 | // level of logging
64 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
65 | logLevel: config.LOG_INFO,
66 |
67 | // enable / disable watching file and executing tests whenever any file changes
68 | autoWatch: true,
69 |
70 | // start these browsers
71 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
72 | browsers: ['Chrome'],
73 |
74 | // Continuous Integration mode
75 | // if true, Karma captures browsers, runs the tests and exits
76 | singleRun: false,
77 |
78 | // Concurrency level
79 | // how many browser should be started simultaneous
80 | concurrency: Infinity,
81 |
82 | proxies: {
83 | '../../data/': '/base/test/images/',
84 | },
85 | });
86 | };
87 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ibm-gantt-chart",
3 | "version": "0.5.33",
4 | "description": "IBM Gantt Chart Component, integrable in Vanilla, jQuery, or React Framework.",
5 | "repository": "https://github.com/ibm/gantt-chart",
6 | "keywords": [
7 | "chart",
8 | "gantt",
9 | "jquery",
10 | "react"
11 | ],
12 | "license": "Apache-2.0",
13 | "contributors": [
14 | "Olivier Noiret (https://github.com/ono70)",
15 | "Gilles d'Andréa (https://github.com/gillesdandrea)"
16 | ],
17 | "main": "dist/ibm-gantt-chart.js",
18 | "module": "dist/ibm-gantt-chart.js",
19 | "source": "src/index.js",
20 | "style": "dist/ibm-gantt-chart.css",
21 | "scripts": {
22 | "build": "gda-scripts webpack lib",
23 | "build:all": "gda-scripts webpack all",
24 | "build:jquery": "gda-scripts webpack jquery3",
25 | "build:jquery:min": "gda-scripts webpack jquery.min",
26 | "build:min": "gda-scripts webpack lib.min",
27 | "test": "karma start karma.conf.js"
28 | },
29 | "dependencies": {
30 | "datatables.net": "1.11.3",
31 | "datatables.net-dt": "1.11.3",
32 | "es6-promise": "^4.2.6",
33 | "font-awesome": "^4.7.0",
34 | "jquery": "^3.4.1",
35 | "moment": "^2.30.1",
36 | "vis-data": "7.1.8",
37 | "vis-timeline": "7.7.3"
38 | },
39 | "devDependencies": {
40 | "chai": "^4.1.2",
41 | "gda-scripts": "^0.3.0",
42 | "imports-loader": "^0.8.0",
43 | "karma": "^2.0.0",
44 | "karma-chrome-launcher": "^2.2.0",
45 | "karma-mocha": "^1.3.0",
46 | "mocha": "^5.0.4"
47 | },
48 | "gitHead": "ec24c5000b1c547c1496474106a233103c3d09f5"
49 | }
50 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/constraintgraph/constraintgraph.scss:
--------------------------------------------------------------------------------
1 | @import '../core/colors.scss';
2 |
3 | .constraint-link {
4 | color: $link-color;
5 | background-color: $link-color;
6 | }
7 |
8 | .constraint-link-ctnr {
9 | cursor: pointer;
10 |
11 | &.selected .constraint-link {
12 | background-color: $selected-link-color;
13 | box-shadow: 0 0 6px $selected-link-color;
14 | }
15 | }
16 |
17 | .constraint-arrow {
18 | border-color: $link-color;
19 | cursor: pointer;
20 | }
21 |
22 | .constraint-vert-link {
23 | width: 1px;
24 | }
25 |
26 | .constraint-horiz-link {
27 | height: 1px;
28 | }
29 |
30 | .constraint-right-arrow.selected {
31 | border-left-color: $selected-link-color;
32 | }
33 |
34 | .constraint-left-arrow.selected {
35 | border-right-color: $selected-link-color;
36 | }
37 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/constraintgraph/index.js:
--------------------------------------------------------------------------------
1 | import ConstraintsGraph from './constraintgraph';
2 |
3 | import './constraintgraph.scss';
4 |
5 | export default ConstraintsGraph;
6 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/core/colors.scss:
--------------------------------------------------------------------------------
1 | $warmgray10: #383633;
2 | $black5: #929497;
3 | $black0: #f1f1f2;
4 |
5 | $gantt-border-color: lightgrey;
6 | $table-text-color: $warmgray10;
7 |
8 | $background-highlight: #ffeb6d;
9 |
10 | $gantt-header-background: #5fa2dd;
11 | //$background-selection: #FF6700;
12 | $background-selection: #fff3a1;
13 | //$dialog-background: #7D7373; //#464646;
14 | $dialog-background: #1d3649; //#464646;
15 | $dialog-foreground: white;
16 | $dialog-border: #555;
17 | $dialog-highlight-bakcground: #7cc5ff;
18 | $dialog-highlight-foreground: #383633;
19 |
20 | $activity-background: #5aaafa;
21 | //$activity-border: $black5;
22 | $activity-border: white;
23 | $activity-selected-border: $warmgray10;
24 | $milestone-color: #4178be;
25 | $time-table-row-number: darkgrey;
26 | $time-table-row-background-odd: rgba(249, 249, 249, 0.5);
27 | $time-table-row-highlight: $background-highlight;
28 | $activity-dragg-item-color: white;
29 | $activity-dragg-item-invalid-background: #325c80;
30 | $activity-dragg-item-valid-background: #5596e6;
31 | $link-color: #5596e6;
32 | $selected-link-color: #ed9101;
33 |
34 | $time-line-border: #ddd;
35 |
36 | $toolbar-title-color: white;
37 | $toolbar-background: #264a60;
38 | $toolbar-button-background: transparent;
39 | $toolbar-button-border-color: transparent;
40 | $toolbar-button-color: white;
41 | $toolbar-button-hover-background: #7cc7ff;
42 | $toolbar-button-hover-color: white;
43 | $toolbar-button-hover-border: transparent;
44 |
45 | $toolbar-button-selected-background: #7cc5ff;
46 | $toolbar-button-selected-border: white;
47 | $toolbar-button-selected-color: white;
48 | $toolbar-button-selected-hover-border: white;
49 |
50 | $toolbar-select-border-color: white;
51 | $toolbar-input-box-background: white;
52 | $toolbar-input-box-search-color: #dedede;
53 |
54 | $table-header-color: #f4f4f4;
55 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/core/core.scss:
--------------------------------------------------------------------------------
1 | .clearfix::after {
2 | display: block;
3 | clear: both;
4 | height: 0;
5 | font-size: 0;
6 | visibility: hidden;
7 | content: ' ';
8 | }
9 |
10 | .clearfix {
11 | display: inline-block;
12 | }
13 |
14 | /* Todo: Webpack autoprefixer plugin used in postcss-loader manages that, mixin should be removed */
15 | @mixin border-radius($radius) {
16 | -webkit-border-radius: $radius;
17 | -moz-border-radius: $radius;
18 | -ms-border-radius: $radius;
19 | border-radius: $radius;
20 | }
21 |
22 | .g-unselectable {
23 | -ms-user-select: none; /* IE10+ */
24 | -moz-user-select: -moz-none; /* Firefox */
25 | -webkit-user-select: none; /* Chrome/Safari */
26 |
27 | /* For future browser versions */
28 | -o-user-select: none;
29 | user-select: none;
30 | }
31 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/core/plugins.js:
--------------------------------------------------------------------------------
1 | import Gantt from './core';
2 |
3 | Gantt.plugins = {
4 | plugins: [],
5 |
6 | /**
7 | * Registers the list of specified plugins if not already registered.
8 | * @param {Array|Object} plugins plugin instance(s).
9 | */
10 | register(plugins) {
11 | for (let i = 0; i < arguments.length; i++) {
12 | if (this.plugins.indexOf(arguments[i]) === -1) {
13 | this.plugins.push(arguments[i]);
14 | }
15 | }
16 | },
17 |
18 | /**
19 | * Unregisters the specified plugin if registered.
20 | * @param {Array|Object} plugins plugin instance(s).
21 | */
22 | unregister(plugins) {
23 | for (var i = 0, index; i < arguments.length; i++) {
24 | if ((index = this.plugins.indexOf(arguments[i])) !== -1) {
25 | this.plugins.splice(index, 1);
26 | }
27 | }
28 | },
29 |
30 | /**
31 | * Remove all registered plugins.
32 | * @see #register
33 | */
34 | clear() {
35 | this.plugins = [];
36 | },
37 |
38 | /**
39 | * Returns the number of registered plugins.
40 | * @returns {Number}
41 | */
42 | count() {
43 | return this.plugins.length;
44 | },
45 |
46 | /**
47 | * Returns all registered plugin instances.
48 | * @returns {Array} array of plugins.
49 | */
50 | getAll() {
51 | return this.plugins;
52 | },
53 |
54 | /**
55 | * Calls the registermed plugins on the specified method, with the provided args. This
56 | * method immediately returns as soon as a plugin returns a value. The
57 | * returned value can be used, for instance, to interrupt the current action.
58 | * @param {String|Boolean} method boolean to indicate the plugin call order of the name of the plugin method to call.
59 | * @param {...Object} args list to apply to the method call.
60 | * @returns {Object} the value false if any of the plugins return false, otherwise returns true.
61 | */
62 | call(method, ...args) {
63 | let paramsStart;
64 | let reverse;
65 | if (typeof method !== 'string') {
66 | reverse = method;
67 | method = arguments[1];
68 | paramsStart = 2;
69 | } else {
70 | paramsStart = 1;
71 | }
72 | const params = Array.prototype.slice.call(arguments, paramsStart);
73 | for (
74 | let i = reverse ? this.plugins.length - 1 : 0,
75 | inc = reverse ? -1 : 1,
76 | end = reverse ? -1 : this.plugins.length,
77 | result;
78 | i !== end;
79 | i += inc
80 | ) {
81 | const plugin = this.plugins[i];
82 | if (typeof plugin[method] === 'function') {
83 | if ((result = plugin[method].apply(plugin, params)) !== undefined) {
84 | return result;
85 | }
86 | }
87 | }
88 | },
89 | };
90 |
91 | /**
92 | * Plugin extension methods.
93 | * @interface Gantt.PluginBase
94 | */
95 | export default class Plugin {
96 | // Called at start of Gantt init
97 | beforeInit() {}
98 |
99 | // Called at end of Gantt init
100 | afterInit() {}
101 |
102 | // Called at start of update
103 | beforeUpdate() {}
104 |
105 | // Called at end of update
106 | afterUpdate() {}
107 |
108 | // Called at start of draw
109 | beforeDraw() {}
110 |
111 | // Called at end of draw
112 | afterDraw() {}
113 |
114 | // Called during destroy
115 | destroy() {}
116 | }
117 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/core/tooltip.scss:
--------------------------------------------------------------------------------
1 | @import './colors.scss';
2 |
3 | /* Tooltip */
4 |
5 | /* Tooltip container */
6 |
7 | .gantt-tooltip {
8 | z-index: 2;
9 | box-sizing: border-box;
10 | padding: 5px 6px;
11 | color: $dialog-foreground;
12 | font-size: 11px;
13 | font-family: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
14 | text-align: center;
15 | background-color: $dialog-background;
16 |
17 | table {
18 | border: none;
19 |
20 | tr {
21 | padding: 2px 0;
22 | color: white;
23 | }
24 |
25 | td {
26 | padding: 2px 0;
27 | color: white;
28 | font-size: 13px;
29 |
30 | &.tooltip-table-separator {
31 | width: 15px;
32 | }
33 | }
34 |
35 | h4,
36 | h3,
37 | h2 {
38 | margin: 0;
39 | padding: 4px 0;
40 | font-size: 15px;
41 | text-align: left;
42 | }
43 | }
44 | }
45 |
46 | .gantt-tooltip-arrow {
47 | &.bottom-arrow {
48 | top: 100%;
49 | margin-left: -3px;
50 | border-top: 5px solid $dialog-border;
51 | border-right: 5px solid transparent;
52 | border-left: 5px solid transparent;
53 | }
54 |
55 | &.top-arrow {
56 | top: -5px;
57 | margin-left: -3px;
58 | border-right: 5px solid transparent;
59 | border-bottom: 5px solid $dialog-border;
60 | border-left: 5px solid transparent;
61 | }
62 |
63 | &.left-arrow {
64 | border-top: 5px solid transparent;
65 | border-right: 5px solid $dialog-border;
66 | border-bottom: 5px solid transparent;
67 | }
68 |
69 | &.right-arrow {
70 | border-top: 5px solid transparent;
71 | border-bottom: 5px solid transparent;
72 | border-left: 5px solid $dialog-border;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/core/updates.js:
--------------------------------------------------------------------------------
1 | import Gantt from './core';
2 |
3 | class GanttUpdates extends Gantt.components.GanttUpdates {
4 | constructor(parent, proto) {
5 | super(parent);
6 | this.children = [];
7 | this.updates = [];
8 | this.updateLocks = 0;
9 | this._reload = false;
10 | if (parent) {
11 | parent.children.push(this);
12 | }
13 | if (proto) {
14 | Gantt.utils.mergeObjects(this, proto);
15 | }
16 | this._containsRowChanges = false;
17 | this._tableYScrollChanged = false;
18 | }
19 |
20 | reload() {
21 | this._reload = true;
22 | this._containsRowChanges = true;
23 | }
24 |
25 | isReload() {
26 | return this._reload || (this.parent && this.parent.isReload());
27 | }
28 |
29 | rowsChanged(event, rows, rowRef) {
30 | this.addUpdate({ type: event, rows, rowRef });
31 | this._containsRowChanges = true;
32 | }
33 |
34 | addUpdate(update) {
35 | this.updates.push(update);
36 | }
37 |
38 | removeUpdate(update) {
39 | const index = this.updates.indexOf(update);
40 | if (index >= 0) {
41 | this.updates.splice(index, 1);
42 | }
43 |
44 | for (let i = 0, count = this.children ? this.children.length : 0; i < count; i++) {
45 | this.children[i].removeUpdate(update);
46 | }
47 | }
48 |
49 | tableScrollYChanged() {
50 | this._tableYScrollChanged = true;
51 | }
52 |
53 | hasTableScrollYChanged() {
54 | return this._tableYScrollChanged || (this.parent && this.parent.hasTableScrollYChanged());
55 | }
56 |
57 | startUpdating() {
58 | ++this.updateLocks;
59 | }
60 |
61 | stopUpdating() {
62 | if (--this.updateLocks === 0) {
63 | this.applyUpdates();
64 | return true;
65 | }
66 | return false;
67 | }
68 |
69 | applyUpdates() {
70 | this.doApplyUpdates();
71 | this.updates = [];
72 | this._reload = false;
73 | for (let i = 0, count = this.children ? this.children.length : 0; i < count; i++) {
74 | this.children[i].applyUpdates();
75 | }
76 | this._containsRowChanges = false;
77 | }
78 |
79 | containsRowChanges() {
80 | return this._containsRowChanges || (this.parent && this.parent.containsRowChanges());
81 | }
82 |
83 | applyReload() {}
84 |
85 | doApplyUpdates() {
86 | if (this._reload) {
87 | this.applyReload();
88 | } else {
89 | for (let iUpdate = 0, count = this.updates.length; iUpdate < count; iUpdate++) {
90 | this.applyUpdate(this.updates[iUpdate]);
91 | }
92 | }
93 | }
94 |
95 | applyUpdate(update) {}
96 |
97 | destroy() {
98 | for (let i = 0, count = this.children ? this.children.length : 0; i < count; i++) {
99 | this.children[i].destroy();
100 | }
101 | this.children = null;
102 | }
103 | }
104 |
105 | Gantt.components.GanttUpdates.impl = GanttUpdates;
106 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/error/error.scss:
--------------------------------------------------------------------------------
1 | .error-list {
2 | padding: 5px;
3 | list-style-type: none;
4 | }
5 |
6 | .error-component {
7 | margin-bottom: 10px;
8 | padding: 10px 10px 10px 20px;
9 | vertical-align: middle;
10 | background: #fdeaec url('./images/error.png') no-repeat 6px 12px;
11 | border: #d9182d solid 1px;
12 | border-radius: 5px;
13 | }
14 |
15 | .error-content {
16 | width: 100%;
17 | }
18 |
19 | .error-title {
20 | padding: 2px 5px;
21 | color: #d9182d;
22 | }
23 |
24 | .error-details-btn {
25 | margin-right: 12px;
26 | color: #cc8a92;
27 | font-size: 14px;
28 | cursor: pointer;
29 | }
30 |
31 | .error-details-btn:hover {
32 | color: #cc5f6e;
33 | }
34 |
35 | .error-desc {
36 | display: none;
37 | padding-top: 6px;
38 | padding-left: 6px;
39 | color: #d9182d;
40 | font-size: 12px;
41 | }
42 |
43 | .error-expanded .error-desc {
44 | display: block;
45 | }
46 |
47 | .error-bar {
48 | display: inline-block;
49 | float: right;
50 |
51 | .remove-error-btn {
52 | display: inline-block;
53 | width: 11px;
54 | height: 11px;
55 | vertical-align: middle;
56 | background: url('./images/remove-error.png') no-repeat 0 0;
57 | cursor: pointer;
58 | }
59 |
60 | .remove-error-btn:hover {
61 | background-image: url('./images/remove-error-focused.png');
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/error/images/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart/src/error/images/error.png
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/error/images/expanded.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart/src/error/images/expanded.png
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/error/images/remove-error-focused.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart/src/error/images/remove-error-focused.png
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/error/images/remove-error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart/src/error/images/remove-error.png
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/gantt.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright IBM Corp. 2019
3 | *
4 | * This source code is licensed under the Apache-2.0 license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | /* import-sort-ignore */
9 | import './core/plugins';
10 | import './core/selection';
11 | import './core/renderer';
12 | import './model';
13 | import './panel';
14 | import './timetable';
15 | import './loadchart';
16 |
17 | // import P from 'es6-promise/dist/es6-promise.min';
18 |
19 | export default from './core/core';
20 |
21 | // if (typeof Promise === 'undefined' /* && Promise.toString().indexOf("[native code]") !== -1 */) {
22 | // console.log('Use of es6-promise');
23 | // P.polyfill();
24 | // }
25 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/images/svg/16/add--alt.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/images/svg/16/filter.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/images/svg/16/view.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/images/svg/16/zoom--in.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/images/svg/16/zoom--out.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/images/svg/32/add--alt.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/images/svg/32/filter.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/images/svg/32/view.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/images/svg/32/zoom--in.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/images/svg/32/zoom--out.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/index-jquery.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright IBM Corp. 2019
3 | *
4 | * This source code is licensed under the Apache-2.0 license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | /* import-sort-ignore */
9 | import Gantt from './gantt';
10 |
11 | // jQuery modules
12 | import './jquery/jquery-core';
13 | import './jquery/utils';
14 | import './jquery/split';
15 | import './jquery/timeline';
16 | import './jquery/treetable';
17 |
18 | // TODO should be defined in webpack, but there is a .default issue
19 | if (typeof window !== 'undefined') {
20 | window.Gantt = Gantt;
21 | }
22 |
23 | Gantt.version = VERSION;
24 | try {
25 | console.log(`[LOADED] ${NAME}@${VERSION} (jquery@${$().jquery}, datatables.net@${$().DataTable.version})`);
26 | } catch (error) {
27 | // nothig to do
28 | }
29 |
30 | export default Gantt;
31 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright IBM Corp. 2019
3 | *
4 | * This source code is licensed under the Apache-2.0 license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | // embed jquery and datatables.net
9 | import './jquery-datatables';
10 |
11 | export default from './index-jquery';
12 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/jquery-datatables.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright IBM Corp. 2019
3 | *
4 | * This source code is licensed under the Apache-2.0 license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | // initialization of jquery and datatables.net for standalone version
9 |
10 | const $ = require('jquery');
11 |
12 | // console.log(`[LOADED] jquery@${$().jquery}`);
13 |
14 | if (typeof window !== 'undefined') {
15 | window.jQuery = $;
16 | window.$ = $;
17 | }
18 |
19 | // eslint-disable-next-line import/no-webpack-loader-syntax,import/no-unresolved
20 | const datatables = require('imports-loader?define=>false!datatables.net');
21 |
22 | // https://github.com/aurelia/skeleton-navigation/issues/473
23 | datatables(window, $);
24 | // console.log(`[LOADED] datatables.net@${$().DataTable.version}`);
25 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/jquery/jquery-core.js:
--------------------------------------------------------------------------------
1 | import $ from 'jquery';
2 |
3 | import Gantt from '../core/core';
4 |
5 | const allGantts = [];
6 |
7 | const getGantt = node => {
8 | for (let i = 0, count = allGantts.length; i < count; ++i) {
9 | if (allGantts[i].node === node) {
10 | return allGantts[i];
11 | }
12 | }
13 | return null;
14 | };
15 |
16 | const removeGantt = gantt => {
17 | const index = allGantts.indexOf(gantt);
18 | if (index > -1) {
19 | allGantts.splice(index, 1);
20 | }
21 | return gantt;
22 | };
23 |
24 | Gantt.envReady = function() {
25 | return new Promise(function(resolve, reject) {
26 | $(document).ready(resolve);
27 | });
28 | };
29 |
30 | try {
31 | $.fn.Gantt = function(options) {
32 | const gantts = [];
33 | this.each(function() {
34 | let gantt = getGantt(this);
35 | if (gantt) {
36 | if (options) {
37 | gantt.destroy();
38 | removeGantt(gantt);
39 | } else {
40 | // Use the current gantt associated with this node as no configuration change has been specified.
41 | return;
42 | }
43 | }
44 | gantt = new Gantt(this, options);
45 | gantt.disconnect = () => {
46 | removeGantt(this);
47 | };
48 | gantts.push(gantt);
49 | });
50 |
51 | const ganttRef = gantts.length && gantts[0];
52 | const apiRef = (ganttRef && ganttRef.api && ganttRef.api()) || {};
53 | if (gantts.length === 1) {
54 | this.api = function() {
55 | return apiRef;
56 | };
57 | } else if (gantts.length > 0) {
58 | // TODO
59 | } else {
60 | this.api = function() {
61 | return {};
62 | };
63 | }
64 | $.extend(this, apiRef);
65 | return gantts.length && gantts[0];
66 | };
67 | } catch (e) {
68 | console.error(e);
69 | }
70 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/jquery/split/index.js:
--------------------------------------------------------------------------------
1 | import './split';
2 | import './split-pane.scss';
3 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/jquery/split/split-pane.scss:
--------------------------------------------------------------------------------
1 | /*!
2 |
3 | Split Pane v0.5.2
4 |
5 | Copyright (c) 2014 Simon Hagström
6 |
7 | Released under the MIT license
8 | https://raw.github.com/shagstrom/split-pane/master/LICENSE
9 |
10 | */
11 | .split-pane {
12 | position: relative;
13 | width: 100%;
14 | height: 100%;
15 | overflow: hidden;
16 | }
17 |
18 | .split-pane.fixed-top > .split-pane-component,
19 | .split-pane.fixed-bottom > .split-pane-component,
20 | .split-pane.horizontal-percent > .split-pane-component {
21 | position: absolute;
22 | top: auto;
23 | bottom: 0;
24 | left: 0;
25 | z-index: 1;
26 | width: 100%;
27 | overflow: auto;
28 | }
29 |
30 | .split-pane.fixed-top > .split-pane-component:first-child,
31 | .split-pane.fixed-bottom > .split-pane-component:first-child,
32 | .split-pane.horizontal-percent > .split-pane-component:first-child {
33 | top: 0;
34 | bottom: auto;
35 | }
36 |
37 | .split-pane.fixed-bottom > .split-pane-component:first-child {
38 | margin-bottom: 5px;
39 | }
40 |
41 | .split-pane.fixed-top > .split-pane-divider,
42 | .split-pane.fixed-bottom > .split-pane-divider,
43 | .split-pane.horizontal-percent > .split-pane-divider {
44 | position: absolute;
45 | left: 0;
46 | z-index: 2;
47 | width: 100%;
48 | cursor: ns-resize;
49 | }
50 |
51 | .split-pane.fixed-top > .split-pane-divider > .split-pane-divider-inner,
52 | .split-pane.fixed-bottom > .split-pane-divider > .split-pane-divider-inner,
53 | .split-pane.horizontal-percent > .split-pane-divider > .split-pane-divider-inner {
54 | position: absolute;
55 | top: -5px;
56 | left: 0;
57 | box-sizing: content-box;
58 | width: 100%;
59 | height: 100%;
60 | padding: 5px 0;
61 | }
62 |
63 | .split-pane.fixed-left > .split-pane-component,
64 | .split-pane.fixed-right > .split-pane-component,
65 | .split-pane.vertical-percent > .split-pane-component {
66 | position: absolute;
67 | top: 0;
68 | right: 0;
69 | left: auto;
70 | z-index: 1;
71 | height: 100%;
72 | overflow: auto;
73 | }
74 |
75 | .split-pane.fixed-left > .split-pane-component:first-child,
76 | .split-pane.fixed-right > .split-pane-component:first-child,
77 | .split-pane.vertical-percent > .split-pane-component:first-child {
78 | right: auto;
79 | left: 0;
80 | }
81 |
82 | .split-pane.fixed-left > .split-pane-divider,
83 | .split-pane.fixed-right > .split-pane-divider,
84 | .split-pane.vertical-percent > .split-pane-divider {
85 | position: absolute;
86 | top: 0;
87 | z-index: 2;
88 | height: 100%;
89 | cursor: ew-resize;
90 | }
91 |
92 | .split-pane.fixed-left > .split-pane-divider > .split-pane-divider-inner,
93 | .split-pane.fixed-right > .split-pane-divider > .split-pane-divider-inner,
94 | .split-pane.vertical-percent > .split-pane-divider > .split-pane-divider-inner {
95 | position: absolute;
96 | top: 0;
97 | left: -5px;
98 | box-sizing: content-box;
99 | width: 100%;
100 | height: 100%;
101 | padding: 0 5px;
102 | }
103 |
104 | .split-pane-resize-shim {
105 | position: absolute;
106 | top: 0;
107 | left: 0;
108 | z-index: 10000;
109 | display: none;
110 | width: 100%;
111 | height: 100%;
112 | }
113 |
114 | .split-pane.fixed-left > .split-pane-resize-shim,
115 | .split-pane.fixed-right > .split-pane-resize-shim,
116 | .split-pane.vertical-percent > .split-pane-resize-shim {
117 | cursor: ew-resize;
118 | }
119 |
120 | .split-pane.fixed-top > .split-pane-resize-shim,
121 | .split-pane.fixed-bottom > .split-pane-resize-shim,
122 | .split-pane.horizontal-percent > .split-pane-resize-shim {
123 | cursor: ns-resize;
124 | }
125 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/jquery/timeline/index.js:
--------------------------------------------------------------------------------
1 | import Timeline from './timeline';
2 |
3 | export default Timeline;
4 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/jquery/timeline/timeline.scss:
--------------------------------------------------------------------------------
1 | @import '../../core/colors.scss';
2 | @import '../../../../../node_modules/vis-timeline/dist/vis-timeline-graph2d.min.css';
3 |
4 | .gantt-panel .vis-custom-time::before {
5 | display: inline-block;
6 | width: 8px;
7 | height: 8px;
8 | margin-top: -8px;
9 | margin-left: -3px;
10 | background-color: inherit;
11 | border-radius: 8px;
12 | content: '';
13 | }
14 |
15 | $time-line-none-working-day-background: #f5f5f5;
16 | $time-line-none-working-day-color: white;
17 |
18 | .gantt-panel .vis-time-axis .vis-grid.vis-saturday,
19 | .gantt-panel .vis-time-axis .vis-grid.vis-sunday {
20 | color: $time-line-none-working-day-color;
21 | background: $time-line-none-working-day-background;
22 | }
23 |
24 | .gantt-panel .vis-timeline {
25 | font-size: 12px;
26 | border: none;
27 | }
28 |
29 | .gantt-panel .vis-panel.vis-top {
30 | background-color: $table-header-color;
31 | }
32 |
33 | .gantt-panel .vis-timeline .vis-top .vis-minor {
34 | border-top: solid 1px $time-line-border;
35 | }
36 |
37 | // .gantt-panel .vis-timeline .vis-time-axis.vis-foreground {
38 | // }
39 |
40 | // stylelint-disable-next-line no-duplicate-selectors
41 | .gantt-panel .vis-panel.vis-top {
42 | border-bottom: 2px solid $gantt-border-color;
43 | border-bottom: 1px solid #e0e0e0;
44 | }
45 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/jquery/treetable/columnrenderer.js:
--------------------------------------------------------------------------------
1 | import Gantt from '../../core/core';
2 |
3 | const ColumnRendererPrototype = {
4 | createShape(activity, parentElt, ctx) {
5 | return parentElt;
6 | },
7 |
8 | getText(row) {
9 | return row.name;
10 | },
11 |
12 | drawContent(elt, icon, text, object, ctx) {
13 | // Done through the render method
14 | /* if (icon) {
15 | const img = document.createElement('img');
16 | img.className = 'image-content';
17 | img.src = icon;
18 | img.alt = '';
19 | img.style.float = 'left';
20 | elt.appendChild(img);
21 | }
22 |
23 | if (text) {
24 | elt.appendChild(document.createTextNode(text));
25 | } */
26 | },
27 | };
28 | export default ColumnRendererPrototype;
29 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/jquery/treetable/datatables.scss:
--------------------------------------------------------------------------------
1 | @import '../../core/colors.scss';
2 |
3 | .gantt-panel .text-icon {
4 | margin-right: 3px;
5 | vertical-align: bottom;
6 | }
7 |
8 | .gantt-panel {
9 | .dataTables_wrapper * {
10 | box-sizing: border-box;
11 | }
12 |
13 | .dataTables_filter {
14 | display: none;
15 | }
16 |
17 | .dataTables_info {
18 | display: none;
19 | }
20 |
21 | .dataTables_scroll .dataTables_scrollBody {
22 | overflow-x: scroll !important;
23 | overflow-y: hidden !important;
24 | border-bottom: none;
25 | }
26 |
27 | table.dataTable.no-footer {
28 | border-bottom: none;
29 | }
30 |
31 | .dataTables_scrollHead table.dataTable {
32 | border-top: none;
33 | border-right: 1px solid $gantt-border-color;
34 | border-left: none;
35 | border-collapse: separate;
36 | }
37 |
38 | .dataTables_scrollBody table.dataTable {
39 | border: none;
40 | border-right: 1px $gantt-border-color solid;
41 |
42 | tr {
43 | background-color: white;
44 | &.odd {
45 | background-color: #f9f9f9;
46 | }
47 | &:first-child {
48 | td {
49 | border-top: none;
50 | }
51 | }
52 | }
53 | td {
54 | white-space: nowrap;
55 | border-top: 1px solid $gantt-border-color;
56 | }
57 | }
58 |
59 | table.dataTable.gantt-tree-table {
60 | margin: 0;
61 | border-collapse: separate;
62 | border-spacing: 0;
63 | }
64 | }
65 |
66 | .gantt-panel .split-pane.fixed-left > .split-pane-component,
67 | .gantt-panel .split-pane.fixed-right > .split-pane-component,
68 | .gantt-panel .split-pane.vertical-percent > .split-pane-component {
69 | overflow: hidden;
70 | }
71 |
72 | .gantt-panel table.dataTable.gantt-tree-table thead th,
73 | .gantt-panel table.dataTable.gantt-tree-table thead td {
74 | padding: 8px 18px;
75 | color: $table-text-color;
76 | background-color: $table-header-color;
77 | border-bottom: 1px solid #e0e0e0;
78 | }
79 |
80 | .gantt-panel table.dataTable.gantt-tree-table tbody {
81 | td {
82 | padding: 6px 18px;
83 | font-size: 13px;
84 | }
85 | tr.highlight,
86 | tr.selected.highlight {
87 | background-color: $background-highlight;
88 | }
89 |
90 | tr:last-child td {
91 | border-bottom: 1px solid #ddd;
92 | }
93 | }
94 |
95 | .gantt-panel.mini table.dataTable.gantt-tree-table tbody td {
96 | padding: 1px 18px;
97 | }
98 |
99 | .gantt-panel table.dataTable.gantt-tree-table.stripe tbody tr.odd.selected,
100 | .gantt-panel table.dataTable.gantt-tree-table.display tbody tr.odd.selected {
101 | background-color: $background-selection;
102 | }
103 |
104 | .gantt-panel table.dataTable.gantt-tree-table.display tbody tr.odd.selected > .sorting_1,
105 | .gantt-panel table.dataTable.gantt-tree-table.order-column.stripe tbody tr.odd.selected > .sorting_1 {
106 | background-color: $background-selection;
107 | }
108 |
109 | .gantt-panel table.dataTable.gantt-tree-table.display tbody tr.selected,
110 | .gantt-panel table.dataTable.gantt-tree-table.order-column.stripe tbody tr.selected {
111 | background-color: $background-selection;
112 | }
113 |
114 | .gantt-panel table.dataTable.gantt-tree-table.hover tbody tr:hover td {
115 | background-color: $background-highlight;
116 | }
117 |
118 | .gantt-panel table.dataTable.gantt-tree-table tbody tr.selected {
119 | background-color: $background-selection;
120 | }
121 |
122 | .gantt-panel table.dataTable.gantt-tree-table.display tbody tr.even.selected > .sorting_1,
123 | .gantt-panel table.dataTable.gantt-tree-table.order-column.stripe tbody tr.even.selected > .sorting_1 {
124 | background-color: $background-selection;
125 | }
126 |
127 | .gantt-panel table.dataTable thead th {
128 | font-weight: 500;
129 | }
130 |
131 | .gantt-panel .dataTables_empty {
132 | min-width: 200px;
133 | }
134 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/jquery/treetable/rowrenderer.js:
--------------------------------------------------------------------------------
1 | import Gantt from '../../core/core';
2 |
3 | const RowRendererPrototype = {
4 | createShape(activity, parentElt) {
5 | return parentElt;
6 | },
7 | };
8 |
9 | export default RowRendererPrototype;
10 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/jquery/treetable/treetablecontroller.scss:
--------------------------------------------------------------------------------
1 | @import '../../core/colors.scss';
2 |
3 | .gantt-panel {
4 | .tree-node-spacing {
5 | display: inline-block;
6 | width: 16px;
7 | height: 16px;
8 | }
9 |
10 | .leaf-row {
11 | color: $table-text-color;
12 | &.hidden {
13 | display: none;
14 | }
15 | }
16 |
17 | .parent-row {
18 | color: $table-text-color;
19 |
20 | .hierarchy-control {
21 | font-weight: 500;
22 | }
23 | }
24 |
25 | .table-panel:not(.tree-table-flat) {
26 | .leaf-row .tree-node-handle {
27 | display: inline-block;
28 | }
29 |
30 | .parent-row {
31 | &.hidden {
32 | display: none;
33 | }
34 |
35 | .tree-node-handle {
36 | display: inline-block;
37 | width: 20px;
38 | height: 16px;
39 |
40 | i.collapsed {
41 | display: none;
42 | }
43 | }
44 | }
45 |
46 | .parent-row.collapsed .tree-node-handle {
47 | i.collapsed {
48 | display: inherit;
49 | }
50 |
51 | i.expanded {
52 | display: none;
53 | }
54 | }
55 | }
56 |
57 | td.hierarchy-control {
58 | min-width: 150px;
59 |
60 | .tree-node-handle {
61 | cursor: pointer;
62 | }
63 | }
64 |
65 | .tree-node-color {
66 | width: 16px;
67 | height: 16px;
68 | border: 1px solid $warmgray10;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/jquery/utils.js:
--------------------------------------------------------------------------------
1 | import $ from 'jquery';
2 |
3 | import Gantt from '../core/core';
4 |
5 | Gantt.utils = $.extend({}, Gantt.utils, {
6 | closest(elt, selector) {
7 | const res = $(elt).closest(selector);
8 | return (res && res.length && res[0]) || null;
9 | },
10 |
11 | mergeObjects() {
12 | const args = [];
13 | for (let i = 0; i < arguments.length; i++) {
14 | args.push(arguments[i]);
15 | }
16 | return $.extend.apply($, args);
17 | },
18 |
19 | // Triggers security issues
20 | // https://github.ibm.com/IBMDecisionOptimization/dd-gantt-component/issues/21
21 | // html(node, htmlText) {
22 | // $(node).html(htmlText);
23 | // },
24 |
25 | offsetParent(elt) {
26 | const $parent = $(elt).offsetParent();
27 | return ($parent.length && $parent[0]) || null;
28 | },
29 |
30 | ajax(url, params) {
31 | const $params = {
32 | url: url || params.url,
33 | dataType: (params && params.dataType) || 'json',
34 | };
35 | if (params && params.method) {
36 | $params.method = params.method;
37 | }
38 | if (params && params.params) {
39 | $params.data = params.params;
40 | }
41 | if (params && params.customizeRequest) {
42 | $params.beforeSend = params.customizeRequest;
43 | }
44 | const { settings } = params;
45 | if (params && params.success) {
46 | return $.ajax($params).then(function(data, statusText, req) {
47 | if (params.settings) {
48 | params.settings.statusText = statusText;
49 | params.settings.request = req;
50 | }
51 | if (params.context) {
52 | return params.success.call(params.context, data, params.settings);
53 | }
54 | return params.success(data, params.settings);
55 | });
56 | }
57 | return $.ajax($params);
58 | },
59 |
60 | getHeight(elt) {
61 | return $(elt).height();
62 | },
63 | });
64 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/loadchart/index.js:
--------------------------------------------------------------------------------
1 | export LoadResourceChartCtrl from './loadchartctrl';
2 | export LoadResourceChart from './loadchart';
3 |
4 | export const LOAD_RESOURCE_CHART_OPENED = 'load-resource-chart-opened';
5 | export const LOAD_RESOURCE_CHART_CLOSED = 'load-resource-chart-closed';
6 | export const GANTT_LOAD_RESOURCE_CHART = 'gantt-load-resource-chart';
7 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/loadchart/loadchart.scss:
--------------------------------------------------------------------------------
1 | @import '../core/colors.scss';
2 |
3 | .load-resource-chart {
4 | background-color: white;
5 |
6 | .vis-timeline .vis-bottom .vis-minor {
7 | border-bottom: solid 1px $time-line-border;
8 | }
9 |
10 | .vis-panel.vis-bottom {
11 | border-top: 2px solid $gantt-border-color;
12 | }
13 |
14 | .vis-item.vis-background {
15 | background-color: transparent;
16 | .vis-item-content {
17 | height: 100%;
18 | padding: 0;
19 | }
20 | }
21 |
22 | .vis-item {
23 | z-index: 0;
24 | background-color: transparent;
25 | border: none;
26 | }
27 |
28 | .load-resource-chart-left {
29 | padding-left: 6px;
30 | }
31 |
32 | .vertical-expand-panel {
33 | top: 1px;
34 | left: 3px;
35 | z-index: 1;
36 | align-items: center;
37 | justify-content: center;
38 | margin-top: 2px;
39 |
40 | .load-title {
41 | margin-left: 6px;
42 | padding: 0;
43 | font-size: 18px;
44 | }
45 | .vertical-expand-button {
46 | padding: 3px 6px;
47 | border: none;
48 | }
49 | &.collapsed {
50 | top: -53px;
51 | background-color: rgba(255, 255, 255, 0.5);
52 | }
53 | }
54 |
55 | .legend-panel {
56 | top: 5px;
57 | margin-right: 23px;
58 | margin-bottom: 6px;
59 | overflow: auto;
60 | color: $warmgray10;
61 | background-color: $table-header-color;
62 | border: 2px solid $gantt-border-color;
63 | }
64 | .legend-panel.empty-legend {
65 | background-color: transparent;
66 | border: none;
67 | }
68 | .legend {
69 | margin: 0;
70 | padding: 0;
71 | }
72 |
73 | .legend-item {
74 | padding: 6px;
75 | }
76 |
77 | .legend-item-color {
78 | width: 40px;
79 | height: 23px;
80 | border: solid 1px black;
81 | }
82 |
83 | .legend-item-name {
84 | padding-left: 12px;
85 | font-size: 12px;
86 | }
87 |
88 | .y-axis {
89 | font-size: 12px;
90 | border-right: 5px solid $gantt-border-color;
91 | .y-axis-label {
92 | padding-right: 15px;
93 | color: $gantt-border-color;
94 | }
95 | .y-axis-tick {
96 | width: 10px;
97 | border-top: solid 2px $gantt-border-color;
98 | }
99 | }
100 |
101 | .no-selection {
102 | background-color: rgba(192, 192, 192, 0.1);
103 |
104 | .no-selection-message {
105 | padding: 8px 12px;
106 | color: $black5;
107 | background-color: $table-header-color;
108 | border: 2px solid $gantt-border-color;
109 | -webkit-box-shadow: 5px 5px 23px 0 rgba(146, 148, 151, 1);
110 | -moz-box-shadow: 5px 5px 23px 0 rgba(146, 148, 151, 1);
111 | box-shadow: 5px 5px 23px 0 rgba(146, 148, 151, 1);
112 | }
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/panel/ganttpanel.scss:
--------------------------------------------------------------------------------
1 | @import '../core/colors.scss';
2 |
3 | .gantt-panel {
4 | box-sizing: border-box;
5 | font-family: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
6 | * {
7 | box-sizing: border-box;
8 | }
9 |
10 | .h-split-pane-divider {
11 | width: 5px;
12 | background-color: lightgrey;
13 | }
14 |
15 | .v-split-pane-divider {
16 | height: 5px;
17 | background-color: lightgrey;
18 | }
19 |
20 | .gantt-header {
21 | padding: 5px 12px;
22 | color: white;
23 | font-size: 14px;
24 | background-color: $gantt-header-background;
25 | border: solid $gantt-border-color 1px;
26 | }
27 | // .gantt-toolbars {
28 | // }
29 | .gantt-body {
30 | border: solid $gantt-border-color 1px;
31 | }
32 | // .table-panel {
33 | // }
34 | .split-pane {
35 | position: absolute;
36 | top: 0;
37 | right: 0;
38 | bottom: 0;
39 | left: 0;
40 | }
41 | .split-pane-left {
42 | overflow: hidden;
43 |
44 | /* TODO Check we can remove */
45 | }
46 | .split-pane-right {
47 | margin-left: 5px;
48 | overflow: hidden;
49 |
50 | /* TODO Check we can remove */
51 |
52 | /* because of divider width not taken into account */
53 | }
54 | .split-pane-top {
55 | overflow: hidden;
56 |
57 | /* TODO Check we can remove */
58 | }
59 | .split-pane-bottom {
60 | overflow: hidden;
61 |
62 | /* TODO Check we can remove */
63 | }
64 |
65 | .time-panel .vertical-scroller-filler {
66 | border-left: solid 1px #ddd;
67 | }
68 |
69 | /*
70 | * loading panel
71 | */
72 | .loading-panel {
73 | position: relative;
74 | z-index: 3;
75 | background-color: rgba(192, 192, 192, 0.75);
76 |
77 | .label {
78 | color: #a6266e;
79 | }
80 | }
81 |
82 | .loader {
83 | display: flex;
84 | align-items: center;
85 | justify-content: center;
86 | width: 240px;
87 | height: 240px;
88 | border: 16px solid $black0;
89 | border-top: 16px solid #a6266e;
90 | border-radius: 50%;
91 | animation: spin 2s linear infinite;
92 | }
93 |
94 | @keyframes spin {
95 | 0% {
96 | transform: rotate(0deg);
97 | }
98 | 100% {
99 | transform: rotate(360deg);
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/panel/index.js:
--------------------------------------------------------------------------------
1 | export default from './ganttpanel';
2 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/panel/layoutsynch.js:
--------------------------------------------------------------------------------
1 | import Gantt from '../core/core';
2 |
3 | function sameBounds(rect1, rect2) {
4 | if (!rect1 || !rect2) {
5 | return !rect1 === !rect2;
6 | }
7 | return rect1.x === rect2.x && rect1.y === rect2.y && rect1.width === rect2.width && rect1.height === rect2.height;
8 | }
9 |
10 | function bounds(x, y, width, height) {
11 | return {
12 | x,
13 | y,
14 | width,
15 | height,
16 | toString() {
17 | return `{ x = ${this.x}, y = ${this.y}, width = ${this.width}, height = ${this.height} }`;
18 | },
19 | };
20 | }
21 |
22 | export default class LayoutSynchronizer extends Gantt.components.LayoutSynchronizer {
23 | constructor(config, proto) {
24 | super(config, config);
25 | this.timeTableBounds = null;
26 | }
27 |
28 | setConfiguration(config) {
29 | if (config) {
30 | Gantt.utils.mergeObjects(this, config);
31 | }
32 | }
33 |
34 | connect(gantt) {
35 | this.gantt = gantt;
36 | this.resizeHandler = e => {
37 | this.checkBounds();
38 | };
39 | gantt.on([Gantt.events.RESIZED, Gantt.events.SPLIT_RESIZED], this.resizeHandler);
40 |
41 | this.timeWindowChangeListener = (e, start, end) => {
42 | this.timeWindowChanged(start, end);
43 | };
44 | gantt.on(Gantt.events.TIME_WINDOW_CHANGED, this.timeWindowChangeListener);
45 |
46 | this.timeLineSizeListener = (e, width, height) => {
47 | this.timeLineSizeChanged(width, height);
48 | };
49 | gantt.on(Gantt.events.TIME_LINE_SIZE_CHANGED, this.timeLineSizeListener);
50 |
51 | this.timeLineInitializedListener = e => {
52 | this.timeLineInitialized();
53 | };
54 | gantt.on(Gantt.events.TIME_LINE_INIT, this.timeLineInitializedListener);
55 |
56 | this.timeLineScrollListener = (e, x) => {
57 | this.timeLineScrolled(x);
58 | };
59 | gantt.on(Gantt.events.TIME_LINE_SCROLLED, this.timeLineScrollListener);
60 | }
61 |
62 | convertBounds(bounds, elt) {
63 | const parent = Gantt.utils.offsetParent(elt);
64 | const parentBounds = Gantt.utils.getScreenPoint(parent);
65 | parentBounds.x = bounds.x - parentBounds.x;
66 | parentBounds.y = bounds.y - parentBounds.y;
67 | parentBounds.width = bounds.width;
68 | parentBounds.height = bounds.height;
69 | return parentBounds;
70 | }
71 |
72 | //
73 | // Time line methods
74 | //
75 |
76 | getTimeLine() {
77 | return this.gantt.timeLine;
78 | }
79 |
80 | getTimeLineWidth() {
81 | return this.gantt.timeLine.getWidth();
82 | }
83 |
84 | getTimeLineHeight() {
85 | return this.gantt.timeLine.getTimeAxisHeight();
86 | }
87 |
88 | getTimeLineScrollLeft() {
89 | return this.gantt.timeTable.getScroller().scrollLeft;
90 | }
91 |
92 | getTimeAt(x) {
93 | return this.gantt.timeLine.getTimeAt(x);
94 | }
95 |
96 | timeLineInitialized() {}
97 |
98 | timeTableBoundsChanged(bounds) {}
99 |
100 | timeWindowChanged(start, end) {}
101 |
102 | timeLineSizeChanged(width, height) {}
103 |
104 | timeLineScrolled(x) {}
105 |
106 | checkBounds() {
107 | const newBounds = this.getScreenTimeTableScrollerBounds();
108 | if (newBounds) {
109 | if (!sameBounds(this.timeTableBounds, newBounds)) {
110 | this.timeTableBounds = newBounds;
111 | this.timeTableBoundsChanged(newBounds);
112 | }
113 | }
114 | }
115 |
116 | getScreenTimeTableScrollerBounds() {
117 | if (!this.gantt.timeTable) {
118 | // Called from first cycle of the Gantt initialization
119 | return null;
120 | }
121 | const timeTableScroller = this.gantt.timeTable.getScroller();
122 | const pt = Gantt.utils.getScreenPoint(timeTableScroller);
123 | return bounds(pt.x, pt.y, this.gantt.timeTable.getVisibleWidth(), this.gantt.timeTable.getVisibleHeight());
124 | }
125 |
126 | disconnect() {
127 | if (this.gantt) {
128 | this.gantt.off([Gantt.events.RESIZED, Gantt.events.SPLIT_RESIZED], this.resizeHandler);
129 | this.gantt.off(Gantt.events.TIME_WINDOW_CHANGED, this.timeWindowChangeListener);
130 | this.gantt.off(Gantt.events.TIME_LINE_SIZE_CHANGED, this.timeLineSizeListener);
131 | this.gantt.off(Gantt.events.TIME_LINE_INIT, this.timeLineInitializedListener);
132 | this.gantt.off(Gantt.events.TIME_LINE_SCROLLED, this.timeLineScrollListener);
133 | }
134 | }
135 |
136 | destroy() {}
137 | }
138 |
139 | Gantt.components.LayoutSynchronizer.impl = LayoutSynchronizer;
140 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/timetable/css-classes.js:
--------------------------------------------------------------------------------
1 | export const TIME_MARKER_DRAG_ITEM = 'dragg-item';
2 | export const TIME_TABLE_ACTIVITY_CLASSNAME = 'time-table-activity';
3 | export const TIME_TABLE_ROW = 'time-table-row';
4 | export const UNSELECTABLE_CLASSNAME = 'g-unselectable';
5 |
6 | export const DEFAULT_ACTIVITY_CLASSNAME = `${TIME_TABLE_ACTIVITY_CLASSNAME} ${UNSELECTABLE_CLASSNAME}`;
7 | export const MILESTONE_CLASSNAME = `${DEFAULT_ACTIVITY_CLASSNAME} milestone`;
8 | export const PARENT_ACTIVITY_CLASSNAME = `${DEFAULT_ACTIVITY_CLASSNAME} parent-activity`;
9 | export const HIGHLIGHT_CLASS = 'highlight';
10 | export const SELECTION_CLASS = 'selected';
11 | export const SELECT_CONTENT_CLASSNAME = 'select-content';
12 |
13 | export const DECORATION_INVALID_TYPE = 'invalid';
14 | export const DECORATION_INVALID_CLASS = 'time-table-invalid';
15 | export const DECORATION_BREAK_TYPE = 'break';
16 | export const DECORATION_BREAK_CLASS = 'time-table-break';
17 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/timetable/images/check.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart/src/timetable/images/check.png
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/timetable/images/drag-error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart/src/timetable/images/drag-error.png
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/timetable/index.js:
--------------------------------------------------------------------------------
1 | export default from './timetable';
2 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/src/timetable/rowrenderer.js:
--------------------------------------------------------------------------------
1 | import Gantt from '../core/core';
2 |
3 | const RowRendererPrototype = {
4 | createShape(activity, parentElt) {
5 | return parentElt;
6 | },
7 | };
8 |
9 | export default RowRendererPrototype;
10 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/activitychart/activity-model.test.js:
--------------------------------------------------------------------------------
1 | describe('Activity chart model', function() {
2 | it('Should show an empty Gantt', function() {
3 | const memModel = createActivityData({ generateActivities: { activityCounts: [30, 3, 2] } });
4 | return this.createGantt({ data: memModel, type: Gantt.type.ACTIVITY_CHART }).then(function(gantt) {});
5 | });
6 | });
7 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/activitychart/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
activitychart
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/assets/images/collapsed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart/test/assets/images/collapsed.png
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/assets/images/expanded.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart/test/assets/images/expanded.png
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/config.js:
--------------------------------------------------------------------------------
1 | //
2 | // Configure SystemJS
3 | //
4 | SystemJS.config({
5 | // set our baseURL reference path
6 | baseURL: '../../src',
7 | defaultJSExtensions: true,
8 | // Transpilation JS6 to JS5
9 | map: {
10 | '*': '*.js',
11 | 'plugin-babel': '../../../node_modules/systemjs-plugin-babel/plugin-babel.js',
12 | 'add-module-exports': '../../../node_modules/babel-plugin-add-module-exports/lib/index.js',
13 | 'systemjs-babel-build': '../../../node_modules/systemjs-plugin-babel/systemjs-babel-browser.js',
14 | },
15 | meta: {
16 | '*/jquery/dist/*': {
17 | build: false,
18 | },
19 | },
20 | transpiler: 'plugin-babel',
21 | });
22 |
23 | const jqueryReady = new Promise((resolve, reject) => {
24 | $(document).ready(resolve);
25 | });
26 |
27 | const systemJSReady = SystemJS.import('ibm-gantt-chart-jquery')
28 | .then(result => {
29 | // Cannot be done with babel-plugin-add-module-exports as for the webpack build, does not work with system.js..
30 | window.Gantt = result.default;
31 | })
32 | .catch(console.log.bind(console));
33 |
34 | Promise.all([jqueryReady, systemJSReady]).then(() => {
35 | mocha.run();
36 | });
37 |
38 | // To run only one test, just do:
39 | // it.only(...)
40 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/core/core.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Testing Gantt core
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
38 |
39 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/core/core.test.js:
--------------------------------------------------------------------------------
1 | describe('Core', function() {
2 | const { expect } = chai;
3 |
4 | describe('Use minimal table implementation', function() {
5 | it('Should show an empty Gantt', function() {
6 | return this.createGantt().then(function(gantt) {});
7 | });
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/core/filter.test.js:
--------------------------------------------------------------------------------
1 | describe('Filtering', function() {
2 | function createFilterModel() {
3 | const hours = 3600000;
4 | const memModel = createResourceWidthActivitiesData({
5 | generateResources: { resourceCounts: [10, 2] },
6 | createActivities(resId, rowNum) {
7 | return [
8 | {
9 | id: (resId === 'zero' ? 50 : resId) * 1000,
10 | name: rowNum % 2 ? 'Even' : 'Odd', // index 0 if for row displayed as index 1
11 | start: minDate + hours * 24,
12 | end: minDate + hours * 24 + hours * 3,
13 | },
14 | {
15 | id: (resId === 'zero' ? 50 : resId) * 1000 + 1,
16 | name: rowNum % 2 ? 'Even' : 'Odd',
17 | start: minDate + hours * 24 * 4,
18 | end: minDate + hours * 24 * 4 + hours * 3,
19 | },
20 | ];
21 | },
22 | });
23 | return memModel;
24 | }
25 | it('Test filtering of activities and setHideEmptyRows', function() {
26 | return this.createGantt({ data: createFilterModel() }).then(function(gantt) {
27 | expect(gantt.getVisibleRows().length).to.equal(30);
28 | gantt.search('Odd', false, true);
29 | let newCount = gantt.getVisibleRows().length;
30 | expect(newCount).to.equal(30);
31 | gantt.setHideEmptyRows(true);
32 | newCount = gantt.getVisibleRows().length;
33 | expect(newCount).to.equal(20);
34 | });
35 | });
36 |
37 | it('Test config table.hideEmptyRows', function() {
38 | return this.createGantt({ data: createFilterModel(), table: { hideEmptyRows: true } }).then(function(gantt) {
39 | gantt.search('Odd', false, true);
40 | expect(gantt.getVisibleRows().length).to.equal(20);
41 | });
42 | });
43 | });
44 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/core/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
core
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/core/navigate.test.js:
--------------------------------------------------------------------------------
1 | describe('Navigation', function() {
2 | it('Navigate to resources', function() {
3 | const memModel = createResourceWidthActivitiesData({ generateResources: { resourceCounts: [30, 3, 2] } });
4 | return this.createGantt({ data: memModel }).then(function(gantt) {
5 | const test = new GanttTest(gantt);
6 |
7 | let row = gantt.getFirstVisibleRow();
8 | expect(row.id).to.equal('Id_0');
9 | gantt.ensureRowVisible('Id_0_1_0');
10 | row = gantt.getFirstVisibleRow();
11 | expect(row.id).to.equal('Id_0');
12 |
13 | gantt.ensureRowVisible('Id_3_0');
14 | // vertical scrolling is necessary
15 | row = gantt.getFirstVisibleRow();
16 | expect(row.id).to.equal('Id_3_0');
17 |
18 | gantt.toggleCollapseRow('Id_5_0', true);
19 | expect(gantt.isRowVisible('Id_5_0_0')).to.be.false;
20 |
21 | gantt.setFirstVisibleRow('Id_5_0');
22 | row = gantt.getFirstVisibleRow();
23 | expect(row.id).to.equal('Id_5_0');
24 |
25 | gantt.setFirstVisibleRow('Id_2_0');
26 | row = gantt.getFirstVisibleRow();
27 | expect(row.id).to.equal('Id_2_0');
28 |
29 | gantt.ensureRowVisible('Id_5_0_0');
30 | row = gantt.getFirstVisibleRow();
31 | expect(row.id).to.equal('Id_5_0_0');
32 | });
33 | });
34 |
35 | it('Collapse two levels', function() {
36 | const memModel = createResourceWidthActivitiesData({ generateResources: { resourceCounts: [1, 3, 2] } });
37 | return this.createGantt({ data: memModel }).then(function(gantt) {
38 | const test = new GanttTest(gantt);
39 |
40 | const row = gantt.getFirstVisibleRow();
41 | expect(row.id).to.equal('Id_0');
42 | test.checkRowVisible('Id_0', true);
43 | gantt.toggleCollapseRow('Id_0', true);
44 | expect(gantt.isRowVisible('Id_0_0_0')).to.be.false;
45 | test.checkRowVisible('Id_0_0_0', false);
46 | });
47 | });
48 | });
49 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/core/palette.test.js:
--------------------------------------------------------------------------------
1 | describe('Palette', function() {
2 | const colorbrewer = {
3 | YlGn: {
4 | 3: ['#f7fcb9', '#addd8e', '#31a354'],
5 | 4: ['#ffffcc', '#c2e699', '#78c679', '#238443'],
6 | 5: ['#ffffcc', '#c2e699', '#78c679', '#31a354', '#006837'],
7 | 6: ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#31a354', '#006837'],
8 | 7: ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#005a32'],
9 | 8: ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#005a32'],
10 | 9: ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'],
11 | },
12 | YlGnBu: {
13 | 3: ['#edf8b1', '#7fcdbb', '#2c7fb8'],
14 | 4: ['#ffffcc', '#a1dab4', '#41b6c4', '#225ea8'],
15 | 5: ['#ffffcc', '#a1dab4', '#41b6c4', '#2c7fb8', '#253494'],
16 | 6: ['#ffffcc', '#c7e9b4', '#7fcdbb', '#41b6c4', '#2c7fb8', '#253494'],
17 | 7: ['#ffffcc', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#0c2c84'],
18 | 8: ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#0c2c84'],
19 | 9: ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'],
20 | },
21 | };
22 |
23 | function expectSameArrays(ar1, ar2) {
24 | expect(ar1.length).to.equal(ar2.length);
25 | for (let i = 0; i < ar1.length; i++) {
26 | expect(ar1[i]).to.equal(ar2[i]);
27 | }
28 | }
29 |
30 | function createPalette(oarams) {}
31 |
32 | it('Create palette from colorbrewer lib format', function() {
33 | const palette = new (Gantt.components.Palette.impl || Gantt.components.Palette)(colorbrewer.YlGn);
34 |
35 | Object.keys(colorbrewer.YlGn).forEach(function(key) {
36 | const colors = colorbrewer.YlGn[key];
37 | expectSameArrays(colors, palette.getColors(colors.length));
38 | });
39 | expectSameArrays(palette.getColors(10), colorbrewer.YlGn['9'].concat([colorbrewer.YlGn['9'][0]])); // compared result is orig array of size 9 + the first element of the same array. This is the current alog when asking more colors than defined with the palette.
40 | expectSameArrays(palette.getColors(2), ['#f7fcb9', '#addd8e']);
41 | });
42 |
43 | it('Create palette from a color array', function() {
44 | const colorArray = ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#0c2c84'];
45 | const palette = new (Gantt.components.Palette.impl || Gantt.components.Palette)(colorArray);
46 |
47 | expectSameArrays(colorArray, palette.getColors(colorArray.length));
48 | expectSameArrays(colorArray.slice(0, 5), palette.getColors(5));
49 | expectSameArrays(colorArray.slice(0, 1), palette.getColors(1));
50 | expectSameArrays(palette.getColors(10), colorArray.concat(['#ffffd9', '#edf8b1'])); // compared result is orig array of size 8 + 2 first elements of the same array. This is the current alog when asking more colors than defined with the palette.
51 | });
52 |
53 | it('Create palette from a function', function() {
54 | const colorArray = ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#0c2c84'];
55 | const palette = new (Gantt.components.Palette.impl || Gantt.components.Palette)(function(count) {
56 | return count >= 0 && count <= colorArray.length ? colorArray.slice(0, count) : colorArray;
57 | });
58 |
59 | expectSameArrays(colorArray, palette.getColors(colorArray.length));
60 | expectSameArrays(colorArray.slice(0, 5), palette.getColors(5));
61 | expectSameArrays(colorArray.slice(0, 1), palette.getColors(1));
62 | expectSameArrays(palette.getColors(10), colorArray.concat(['#ffffd9', '#edf8b1'])); // compared result is orig array of size 8 + 2 first elements of the same array. This is the current alog when asking more colors than defined with the palette.
63 | });
64 | });
65 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/error/error.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Testing errors
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
32 |
33 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/error/error.test.js:
--------------------------------------------------------------------------------
1 | describe('Error', function() {
2 | const { expect } = chai;
3 |
4 | before(function() {
5 | $('body').prepend(
6 | '
This is some text that should disappear when error is raised
'
7 | );
8 |
9 | // runs before all tests in this block
10 | const errorClass = Gantt.components.ErrorHandler.impl || Gantt.components.ErrorHandler;
11 | this.errors = new errorClass(document.getElementById('errorCtnr'), {});
12 | this.$errorCtnr = $('#errorCtnr');
13 | this.errorNodes = [];
14 | });
15 |
16 | after(function() {
17 | this.$errorCtnr.remove();
18 | });
19 |
20 | function throwError() {
21 | throw 'This is an error message';
22 | }
23 |
24 | function codeError() {
25 | const i = toto.titi;
26 | }
27 |
28 | describe('Adding error', function() {
29 | it('Should show an error in the error list', function() {
30 | expectInDom('initErrorContent', true);
31 | try {
32 | throwError();
33 | } catch (e) {
34 | this.errorNodes.push(this.errors.addError(e, 'My fault'));
35 | }
36 |
37 | expectInDom('initErrorContent', false);
38 | expect(this.$errorCtnr[0].childNodes.length).to.equal(1);
39 | expect(this.errorNodes.length).to.equal(1);
40 | expectNotNull(this.errorNodes[0]);
41 |
42 | try {
43 | throwError();
44 | } catch (e) {
45 | this.errorNodes.push(this.errors.addError(e, 'It is not me its him'));
46 | }
47 |
48 | try {
49 | codeError();
50 | } catch (e) {
51 | this.errorNodes.push(this.errors.addError(e, 'Again my fault'));
52 | }
53 |
54 | expect(this.errorNodes.length).to.equal(3);
55 | expectInDom(this.errorNodes[2], true);
56 |
57 | try {
58 | codeError();
59 | } catch (e) {
60 | this.errorNodes.push(this.errors.addError(e, 'My last one promess'));
61 | }
62 | });
63 | });
64 |
65 | describe('Removing error', function() {
66 | it('Should remove an error by API', function() {
67 | this.errors.removeError(this.errorNodes[0]);
68 | expectInDom(this.errorNodes[0], false);
69 | this.errorNodes.splice(0, 1);
70 | });
71 |
72 | it('Should remove an error from UI', function() {
73 | $(this.errorNodes[0])
74 | .find('.remove-error-btn')
75 | .trigger('click');
76 | expectInDom(this.errorNodes[0], false);
77 | this.errorNodes.splice(0, 1);
78 | });
79 | });
80 |
81 | describe('Show error details', function() {
82 | it('Should collapse error details', function() {
83 | const node = $(this.errorNodes[0]).find('.error-desc');
84 | expectInDom(node, true);
85 | expectVisible(node, true);
86 | $(this.errorNodes[0])
87 | .find('.error-details-btn')
88 | .trigger('click');
89 | expectVisible(node, false);
90 | });
91 |
92 | it('Should expand error details', function() {
93 | const node = $(this.errorNodes[0]).find('.error-desc');
94 | expectInDom(node, true);
95 | expectVisible(node, false);
96 | $(this.errorNodes[0])
97 | .find('.error-details-btn')
98 | .trigger('click');
99 | expectVisible(node, true);
100 | });
101 | });
102 | });
103 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/error/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
error
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/table/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
table
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/table/mem-model.test.js:
--------------------------------------------------------------------------------
1 | describe('Model test', function() {
2 | describe('Use minimal table implementation', function() {
3 | before(function() {
4 | installDummyTable(Gantt);
5 | });
6 |
7 | it('Test resource with activities model', function() {
8 | return this.createGantt({ data: createResourceWidthActivitiesData() }).then(function(gantt) {});
9 | });
10 |
11 | it('Test resource and activities model', function() {
12 | return this.createGantt({ data: createResourceActivityData() }).then(function(gantt) {});
13 | });
14 |
15 | it('Test resource + activities + reservation model', function() {
16 | return this.createGantt({ data: createResourceActivityReservationData() }).then(function(gantt) {});
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/table/table-impl.test.js:
--------------------------------------------------------------------------------
1 | describe('Table implementation', function() {
2 | describe('Use minimal table implementation', function() {
3 | before(function() {
4 | installDummyTable(Gantt);
5 | });
6 | after(function() {
7 | uninstallDummyTable(Gantt);
8 | });
9 | it('Simple', function() {
10 | const memModel = createResourceWidthActivitiesData();
11 | return this.createGantt({ data: memModel }).then(function(gantt) {
12 | expect($(gantt.table.getTableBody()).find('tr').length).to.equal(memModel.resources.data.length);
13 | });
14 | });
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/table/table-load.test.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | describe('Table loading', function() {
3 | describe('Load memory model', function() {
4 | it('Load memory model with resources and activities within resources', function() {
5 | return this.createGantt({ data: createResourceWidthActivitiesData() }).then(function(gantt) {});
6 | });
7 | });
8 |
9 | describe('Load memory model after initialization', function() {
10 | it.skip('Load memory model with resources and activities within resources', function() {
11 | this.timeout(10000);
12 | return this.createGantt({ data: createResourceWidthActivitiesData() }).then(function(gantt) {
13 | var hours = 3600000;
14 | var memModel = createResourceWidthActivitiesData({
15 | generateResources: { resourceCounts: [2, 1] },
16 | createActivities: function(resId, rowNum) {
17 | return [
18 | {
19 | id: (resId === 'zero' ? 50 : resId) * 1000,
20 | name: rowNum % 2 ? 'Even' : 'Odd', // index 0 if for row displayed as index 1
21 | start: minDate + hours * 24,
22 | end: minDate + hours * 24 + hours * 3,
23 | },
24 | {
25 | id: (resId === 'zero' ? 50 : resId) * 1000 + 1,
26 | name: rowNum % 2 ? 'Even' : 'Odd',
27 | start: minDate + hours * 24 * 4,
28 | end: minDate + hours * 24 * 4 + hours * 3,
29 | },
30 | ];
31 | },
32 | });
33 | return new Promise(function(resolve, reject) {
34 | setTimeout(function() {
35 | gantt.load(memModel).then(function(newRows) {
36 | if (newRows.length !== 4) {
37 | reject('Wrong number of rows: ' + newRows.length + ' instead of 4');
38 | }
39 | resolve();
40 | });
41 | }, 500);
42 | });
43 | });
44 | });
45 | });
46 | });
47 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/table/table-sort.test.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | describe('Table sorting', function() {
3 | function createSortingConfig() {
4 | var hours = 3600000;
5 | var getActivityId = function(resId, rowNum, index) {
6 | return 'act' + resId + '_' + index;
7 | };
8 | var getActivityName = function(resId, rowNum, index) {
9 | return resId + '-' + index;
10 | };
11 | var memModel = createResourceWidthActivitiesData({
12 | generateResources: {
13 | resourceCounts: [10, 3],
14 | customizeResource: function(res, parent, level, index) {
15 | res.capacity = index + 1;
16 | return res;
17 | },
18 | },
19 | createActivities: function(resId, rowNum) {
20 | return [
21 | {
22 | id: getActivityId(resId, rowNum, 0),
23 | name: getActivityName(resId, rowNum, 0),
24 | start: minDate + hours * 24,
25 | end: minDate + hours * 24 + hours * 3,
26 | },
27 | {
28 | id: getActivityId(resId, rowNum, 1),
29 | name: getActivityName(resId, rowNum, 1),
30 | start: minDate + hours * 24 * 4,
31 | end: minDate + hours * 24 * 4 + hours * 3,
32 | },
33 | ];
34 | },
35 | });
36 | var tableConfig = {
37 | columns: [
38 | {
39 | title: 'Capacity',
40 | renderer: {
41 | text: 'capacity',
42 | },
43 | /*text : "capacity",*/
44 |
45 | sortComparator: function(a, b) {
46 | if (!a.parent) {
47 | return 0;
48 | } else {
49 | return a.capacity < b.capacity ? -1 : a.capacity > b.capacity ? 1 : 0;
50 | }
51 | },
52 | },
53 | ],
54 | };
55 | return { data: memModel, table: tableConfig };
56 | }
57 |
58 | it('Sort third column', function() {
59 | this.timeout(5000);
60 | return this.createGantt(createSortingConfig()).then(function(gantt) {
61 | var ganttTest = new GanttTest(gantt);
62 | ganttTest.checkRowsDisplayed(['Id_0', 'Id_0_0', 'Id_0_1', 'Id_0_2', 'Id_1', 'Id_1_0']);
63 | ganttTest.sortColumn('Capacity');
64 | ganttTest.checkRowsDisplayed(['Id_0', 'Id_0_0', 'Id_0_1', 'Id_0_2', 'Id_1', 'Id_1_0']);
65 | ganttTest.sortColumn('Capacity');
66 | ganttTest.checkRowsDisplayed(['Id_0', 'Id_0_2', 'Id_0_1', 'Id_0_0', 'Id_1', 'Id_1_2']);
67 | });
68 | });
69 | });
70 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/table/table.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Testing Gantt table
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
36 |
37 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/timetable/activityrenderer.test.js:
--------------------------------------------------------------------------------
1 | describe('Rendering of activities', function() {
2 | it('Define row height', function() {
3 | const memModel = createResourceWidthActivitiesData({ generateResources: { resourceCounts: [30, 3, 2] } });
4 | return this.createGantt({
5 | data: memModel,
6 | timeTable: {
7 | renderer: [
8 | {
9 | rowHeight(row) {
10 | return row.id.length < 6 ? 50 : 23;
11 | },
12 | },
13 | ],
14 | },
15 | }).then(function(gantt) {
16 | const ctnr = getTimeTableRowContainer(gantt);
17 | const timeRows = ctnr.getElementsByClassName(TIME_TABLE_ROW_CLASS);
18 | expect(timeRows).to.have.length.of.at.least(1);
19 |
20 | for (
21 | var i = 0, timeRow, id, l = TIME_TABLE_ROW_ID_PREFIX.length, acts, actNodes, rowHeight;
22 | i < timeRows.length;
23 | i++
24 | ) {
25 | timeRow = timeRows[i];
26 | id = timeRow.id.substring(l);
27 | if (id.length < 6) {
28 | expect(timeRow.offsetHeight).to.equal((rowHeight = 50));
29 | } else {
30 | expect((rowHeight = timeRow.offsetHeight)).to.not.equal(50);
31 | }
32 | actNodes = timeRow.getElementsByClassName(ACTIVITY_CLASS);
33 | if (actNodes.length) {
34 | expect(actNodes[0].offsetHeight).to.equal(rowHeight - 4); // - topMargin - bottomMargin
35 | }
36 | }
37 | });
38 | });
39 |
40 | it('Use row layout', function() {
41 | const idNames = {
42 | '10': 'Jane',
43 | '28': 'Joe',
44 | '29': 'Jack',
45 | };
46 | const rowHeights = {
47 | Jane: 50,
48 | Joe: 32,
49 | Jack: 100,
50 | };
51 | return this.createGantt(
52 | createHouseBuildingConfig({
53 | activitySubRows: 3,
54 | layoutStrategy: 'tile',
55 | rowHeight(row) {
56 | return rowHeights[idNames[row.id]] || 0;
57 | },
58 | })
59 | ).then(function(gantt) {
60 | let row = getTimeTableRow(gantt, '10'); // Jane
61 | expect(row.offsetHeight).to.not.equal(50);
62 | row = getTimeTableRow(gantt, '28'); // Joe
63 | expect(row.offsetHeight).to.not.equal(rowHeights.Joe);
64 | row = getTimeTableRow(gantt, '29'); // Jack
65 | expect(row.offsetHeight).to.not.equal(rowHeights.Jane);
66 | });
67 | });
68 | });
69 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/timetable/activitytext.test.js:
--------------------------------------------------------------------------------
1 | describe('Clipping of activity text', function() {
2 | const ACTIVITY_TEXT_CLASSNAME = 'activity-text';
3 |
4 | function createTextBox(boxText) {
5 | const cont = document.createElement('div');
6 | cont.style.width = '200px';
7 | cont.style.height = '23px';
8 | cont.style.overflow = 'hidden';
9 | cont.style.background = 'yellow';
10 | cont.style.border = '1px solid black';
11 | cont.style.marginBottom = '20px';
12 | cont.style.position = 'relative';
13 |
14 | const marker = document.createElement('span');
15 | marker.style.display = 'inline-block';
16 | marker.style.width = '1px';
17 | marker.style.height = '50px';
18 | marker.style.float = 'left';
19 | cont.appendChild(marker);
20 |
21 | const text = document.createElement('span');
22 | text.style.display = 'inline-block';
23 | text.style.float = 'left';
24 | text.style.whiteSpace = 'nowrap';
25 | text.className = ACTIVITY_TEXT_CLASSNAME;
26 | text.appendChild(document.createTextNode(boxText));
27 | cont.appendChild(text);
28 | return cont;
29 | }
30 |
31 | it('Should show an empty Gantt', function() {
32 | const separator = document.createElement('div');
33 | separator.borderBottom = '2px solid black';
34 | document.body.insertBefore(separator, document.body.childNodes[0]);
35 | const longBox = createTextBox('This is a very very very very super very very long text');
36 | document.body.insertBefore(longBox, separator);
37 |
38 | const shortBox = createTextBox('Short text');
39 | document.body.insertBefore(shortBox, separator);
40 |
41 | expect(longBox.getElementsByClassName(ACTIVITY_TEXT_CLASSNAME)[0].offsetTop > 0).to.be.true;
42 | expect(shortBox.getElementsByClassName(ACTIVITY_TEXT_CLASSNAME)[0].offsetTop > 0).to.be.false;
43 | });
44 | });
45 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/timetable/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
timetable
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/timetable/milestone.test.js:
--------------------------------------------------------------------------------
1 | describe('Milestones', function() {
2 | const { expect } = chai;
3 |
4 | describe('Use minimal table implementation', function() {
5 | it('Should show an empty Gantt', function() {
6 | const memModel = createResourceWidthActivitiesData({
7 | generateResources: { resourceCounts: [10, 2] },
8 | createActivities(resId) {
9 | return [
10 | {
11 | id: (resId === 'zero' ? 50 : resId) * 1000,
12 | name: 'Milestone start',
13 | start: minDate + 1000 * 3600 * 24,
14 | end: minDate + 1000 * 3600 * 24,
15 | },
16 | {
17 | id: (resId === 'zero' ? 50 : resId) * 1000 + 1,
18 | name: 'Milestone end',
19 | start: minDate + 1000 * 3600 * 24 * 4,
20 | end: minDate + 1000 * 3600 * 24 * 4,
21 | },
22 | ];
23 | },
24 | });
25 | return this.createGantt({
26 | data: memModel,
27 | timeTable: {
28 | renderer: [
29 | {
30 | background() {
31 | return '#00ff00';
32 | },
33 | },
34 | ],
35 | },
36 | }).then(function(gantt) {
37 | // noinspection JSUnresolvedVariable
38 | expect(sameColors($('.milestone .shape').css('backgroundColor'), '#00ff00')).to.be.true;
39 | });
40 | });
41 | });
42 | });
43 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/test/timetable/timetable.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
Testing Gantt core
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
37 |
38 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/webpack.common.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable import/no-extraneous-dependencies */
2 | const webpack = require('webpack');
3 |
4 | module.exports = {
5 | webpack: {
6 | resolve: {
7 | alias: {
8 | jquery: 'jquery/dist/jquery.js',
9 | 'datatables.net': 'datatables.net/js/jquery.dataTables.js',
10 | 'datatables.net-dt$': 'datatables.net-dt',
11 | vis: 'vis/dist/vis.min.js',
12 | },
13 | },
14 | plugins: [
15 | new webpack.ProvidePlugin({
16 | $: 'jquery',
17 | jQuery: 'jquery',
18 | 'window.$': 'jquery', // angular 1
19 | 'window.jQuery': 'jquery', // angular 1
20 | }),
21 | ],
22 | },
23 | styling: {
24 | fonts: {
25 | name: 'fonts/[name].[ext]',
26 | },
27 | },
28 | browserslist: ['defaults'], // TODO don't support 'agressive' browserslist from gda-scripts
29 | babel: {
30 | helpers: true,
31 | },
32 | };
33 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/webpack.config.all.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable global-require */
2 |
3 | module.exports = [
4 | require('./webpack.config.lib'),
5 | require('./webpack.config.lib.min'),
6 | require('./webpack.config.jquery'),
7 | require('./webpack.config.jquery.min'),
8 | ];
9 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/webpack.config.jquery.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable import/no-extraneous-dependencies */
2 | const configure = require('gda-scripts/config/webpack.configure');
3 | const common = require('./webpack.common.js');
4 | const pkg = require('./package.json');
5 |
6 | const { webpack = {}, ...base } = common;
7 |
8 | module.exports = configure(pkg, {
9 | ...base,
10 | mode: 'production',
11 | input: './src/index-jquery',
12 | outputSuffix: '-jquery',
13 | // library: 'Gantt', // TODO Gantt.default instead :-(
14 | sourcemap: true,
15 | minimize: false,
16 | webpack: {
17 | ...webpack,
18 | externals: {
19 | ...(webpack.externals || {}),
20 | 'datatables.net': 'datatables.net',
21 | 'datatables.net-dt': 'datatables.net-dt',
22 | jquery: 'jQuery',
23 | vis: 'vis',
24 | },
25 | },
26 | });
27 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/webpack.config.jquery.min.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable import/no-extraneous-dependencies */
2 | const configure = require('gda-scripts/config/webpack.configure');
3 | const common = require('./webpack.common.js');
4 | const pkg = require('./package.json');
5 |
6 | const { webpack = {}, ...base } = common;
7 |
8 | module.exports = configure(pkg, {
9 | ...base,
10 | mode: 'production',
11 | input: './src/index-jquery',
12 | outputSuffix: '-jquery.min',
13 | // library: 'Gantt', // TODO Gantt.default instead :-(
14 | sourcemap: true,
15 | minimize: true,
16 | webpack: {
17 | ...webpack,
18 | externals: {
19 | ...(webpack.externals || {}),
20 | 'datatables.net': 'datatables.net',
21 | 'datatables.net-dt': 'datatables.net-dt',
22 | jquery: 'jQuery',
23 | vis: 'vis',
24 | },
25 | },
26 | });
27 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/webpack.config.lib.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable import/no-extraneous-dependencies */
2 | const configure = require('gda-scripts/config/webpack.configure');
3 | const common = require('./webpack.common.js');
4 | const pkg = require('./package.json');
5 |
6 | module.exports = configure(pkg, {
7 | ...common,
8 | mode: 'production',
9 | // library: 'Gantt', // TODO Gantt.default instead :-(
10 | sourcemap: true,
11 | minimize: false,
12 | });
13 |
--------------------------------------------------------------------------------
/packages/ibm-gantt-chart/webpack.config.lib.min.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable import/no-extraneous-dependencies */
2 | const configure = require('gda-scripts/config/webpack.configure');
3 | const common = require('./webpack.common.js');
4 | const pkg = require('./package.json');
5 |
6 | module.exports = configure(pkg, {
7 | ...common,
8 | mode: 'production',
9 | outputSuffix: '.min',
10 | // library: 'Gantt', // TODO Gantt.default instead :-(
11 | sourcemap: true,
12 | minimize: true,
13 | });
14 |
--------------------------------------------------------------------------------