├── .all-contributorsrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .importsortrc.js ├── .prettierignore ├── .prettierrc.js ├── .stylelintignore ├── .stylelintrc.js ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── babelrc.config.js ├── jsconfig.json ├── lerna.json ├── package.json ├── packages ├── ibm-gantt-chart-dev │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── activityChart │ │ │ ├── activityChart.html │ │ │ └── activityChart.js │ │ ├── basic │ │ │ ├── basic.html │ │ │ └── basic.js │ │ └── index.js │ └── webpack.config.dev.js ├── ibm-gantt-chart-docs │ ├── README.md │ ├── data │ │ ├── activity_chart │ │ │ ├── activities.json │ │ │ ├── activity_chart.xml │ │ │ ├── constraints.json │ │ │ ├── resas.json │ │ │ └── resources.json │ │ ├── airbus │ │ │ ├── activities.json │ │ │ ├── airbus.json │ │ │ ├── constraints.json │ │ │ └── init.json │ │ ├── house_building │ │ │ ├── init.json │ │ │ └── workers.json │ │ ├── load_chart │ │ │ └── load_chart.xml │ │ └── nurses │ │ │ ├── images │ │ │ ├── anesth.png │ │ │ ├── cardio.png │ │ │ ├── empty.png │ │ │ ├── geriatrcs.png │ │ │ ├── onco.png │ │ │ └── pediatrics.png │ │ │ └── nurses.json │ ├── package.json │ ├── src │ │ ├── docs │ │ │ ├── concepts.md │ │ │ ├── data_accessors.md │ │ │ ├── data_complex_mappings.md │ │ │ ├── data_dates.md │ │ │ ├── data_fetchers.md │ │ │ ├── data_overview.md │ │ │ ├── data_time_window.md │ │ │ ├── docs.stories.js │ │ │ ├── github-markdown.css │ │ │ ├── overview.md │ │ │ ├── palettes.md │ │ │ ├── renderers.md │ │ │ ├── selection.md │ │ │ ├── time_line_activities_layout.md │ │ │ ├── time_line_activity_rendering.md │ │ │ ├── time_line_decorations.md │ │ │ ├── time_line_dragdrop.md │ │ │ └── time_line_overview.md │ │ └── examples │ │ │ ├── activity_chart │ │ │ ├── activity_chart.story.js │ │ │ └── createXMLDataConfig.js │ │ │ ├── basic │ │ │ └── basic.story.js │ │ │ ├── big_data │ │ │ └── big_data.story.js │ │ │ ├── house_building │ │ │ ├── house_building.css │ │ │ └── house_building.story.js │ │ │ ├── load_chart │ │ │ └── load_chart.story.js │ │ │ ├── nurses │ │ │ ├── nurses.css │ │ │ └── nurses.story.js │ │ │ ├── row_layout │ │ │ └── row_layout.story.js │ │ │ └── stories.scss │ ├── storybook │ │ ├── activity_chart │ │ │ ├── activities.json │ │ │ ├── activity_chart.xml │ │ │ ├── constraints.json │ │ │ ├── resas.json │ │ │ └── resources.json │ │ ├── airbus │ │ │ ├── activities.json │ │ │ ├── airbus.json │ │ │ ├── constraints.json │ │ │ └── init.json │ │ ├── favicon.ico │ │ ├── house_building │ │ │ ├── init.json │ │ │ └── workers.json │ │ ├── ibm-gantt-chart-docs-main.css │ │ ├── ibm-gantt-chart-docs-main.css.map │ │ ├── ibm-gantt-chart-docs-vendors~main.css │ │ ├── ibm-gantt-chart-docs-vendors~main.css.map │ │ ├── iframe.html │ │ ├── index.html │ │ ├── load_chart │ │ │ └── load_chart.xml │ │ ├── main.898cbe740b274c903ec0.bundle.js │ │ ├── main.c4fc495beddc146836ff.bundle.js │ │ ├── main.c4fc495beddc146836ff.bundle.js.map │ │ ├── nurses │ │ │ ├── images │ │ │ │ ├── anesth.png │ │ │ │ ├── cardio.png │ │ │ │ ├── empty.png │ │ │ │ ├── geriatrcs.png │ │ │ │ ├── onco.png │ │ │ │ └── pediatrics.png │ │ │ └── nurses.json │ │ ├── runtime~main.286b69a873d49f2f199c.bundle.js │ │ ├── runtime~main.c4fc495beddc146836ff.bundle.js │ │ ├── runtime~main.c4fc495beddc146836ff.bundle.js.map │ │ ├── sb_dll │ │ │ ├── storybook_ui-manifest.json │ │ │ ├── storybook_ui_dll.LICENCE │ │ │ └── storybook_ui_dll.js │ │ ├── static │ │ │ └── media │ │ │ │ ├── addNodeIcon.a1a2d01b.png │ │ │ │ ├── backIcon.dd0baa69.png │ │ │ │ ├── check.7190e4db.png │ │ │ │ ├── connectIcon.d5267b8d.png │ │ │ │ ├── cross.260c9c65.png │ │ │ │ ├── deleteIcon.02d321ed.png │ │ │ │ ├── downArrow.bbfbf2e8.png │ │ │ │ ├── drag-error.3d2cb918.png │ │ │ │ ├── editIcon.d5422321.png │ │ │ │ ├── error.c8314c9f.png │ │ │ │ ├── fontawesome-webfont.674f50d2.eot │ │ │ │ ├── fontawesome-webfont.912ec66d.svg │ │ │ │ ├── fontawesome-webfont.af7ae505.woff2 │ │ │ │ ├── fontawesome-webfont.b06871f2.ttf │ │ │ │ ├── fontawesome-webfont.fee66e71.woff │ │ │ │ ├── leftArrow.8965662a.png │ │ │ │ ├── minus.5a379c46.png │ │ │ │ ├── plus.4c4bf0a1.png │ │ │ │ ├── remove-error-focused.f559e46b.png │ │ │ │ ├── remove-error.0d1b419c.png │ │ │ │ ├── rightArrow.4f88ef17.png │ │ │ │ ├── upArrow.f0aa0566.png │ │ │ │ ├── zoom--in.f6c66cb7.svg │ │ │ │ ├── zoom--out.501eb7d3.svg │ │ │ │ └── zoomExtends.5f78e86f.png │ │ ├── vendors~main.9548b40cca0fab6a61ff.bundle.js │ │ ├── vendors~main.c4fc495beddc146836ff.bundle.js │ │ └── vendors~main.c4fc495beddc146836ff.bundle.js.map │ └── webpack.config.storybook.js ├── ibm-gantt-chart-react │ ├── README.md │ ├── package.json │ ├── src │ │ ├── App.jsx │ │ ├── App.scss │ │ ├── components │ │ │ └── GanttChart │ │ │ │ ├── GanttChart.jsx │ │ │ │ ├── GanttChart.scss │ │ │ │ └── GanttChart.stories.jsx │ │ ├── index.js │ │ └── storybook │ │ │ ├── StoryContainer.jsx │ │ │ └── StoryContainer.scss │ ├── webpack.config.all.js │ ├── webpack.config.dev.js │ ├── webpack.config.lib.js │ ├── webpack.config.lib.min.js │ └── webpack.config.storybook.js └── ibm-gantt-chart │ ├── README.md │ ├── data │ ├── house_building │ │ ├── init.json │ │ └── workers.json │ └── project_activitychart │ │ ├── activities.json │ │ ├── constraints.json │ │ ├── resas.json │ │ └── resources.json │ ├── karma.conf.js │ ├── package.json │ ├── public │ └── examples │ │ ├── basic-jquery │ │ └── index.html │ │ └── basic-standalone │ │ └── index.html │ ├── src │ ├── constraintgraph │ │ ├── constraintgraph.js │ │ ├── constraintgraph.scss │ │ ├── constraintlayout.js │ │ ├── index.js │ │ └── linkrenderer.js │ ├── core │ │ ├── colors.scss │ │ ├── core.js │ │ ├── core.scss │ │ ├── dragdrop.js │ │ ├── filter.js │ │ ├── fonts.scss │ │ ├── palette.js │ │ ├── plugins.js │ │ ├── renderer.js │ │ ├── selection.js │ │ ├── tooltip.js │ │ ├── tooltip.scss │ │ ├── updates.js │ │ └── utils.js │ ├── error │ │ ├── error.scss │ │ ├── images │ │ │ ├── error.png │ │ │ ├── expanded.png │ │ │ ├── remove-error-focused.png │ │ │ └── remove-error.png │ │ └── index.js │ ├── gantt.js │ ├── images │ │ └── svg │ │ │ ├── 16 │ │ │ ├── add--alt.svg │ │ │ ├── filter.svg │ │ │ ├── view.svg │ │ │ ├── zoom--in.svg │ │ │ └── zoom--out.svg │ │ │ └── 32 │ │ │ ├── add--alt.svg │ │ │ ├── filter.svg │ │ │ ├── view.svg │ │ │ ├── zoom--in.svg │ │ │ └── zoom--out.svg │ ├── index-jquery.js │ ├── index.js │ ├── jquery-datatables.js │ ├── jquery │ │ ├── jquery-core.js │ │ ├── split │ │ │ ├── index.js │ │ │ ├── split-pane.scss │ │ │ └── split.js │ │ ├── timeline │ │ │ ├── index.js │ │ │ ├── timeline.js │ │ │ └── timeline.scss │ │ ├── treetable │ │ │ ├── columnrenderer.js │ │ │ ├── datatables.scss │ │ │ ├── index.js │ │ │ ├── rowrenderer.js │ │ │ ├── treetablecontroller.js │ │ │ └── treetablecontroller.scss │ │ └── utils.js │ ├── loadchart │ │ ├── block.js │ │ ├── index.js │ │ ├── loadchart.js │ │ ├── loadchart.scss │ │ └── loadchartctrl.js │ ├── model │ │ └── index.js │ ├── panel │ │ ├── ganttpanel.js │ │ ├── ganttpanel.scss │ │ ├── index.js │ │ └── layoutsynch.js │ ├── timetable │ │ ├── activitylayout.js │ │ ├── activityrenderer.js │ │ ├── css-classes.js │ │ ├── images │ │ │ ├── check.png │ │ │ └── drag-error.png │ │ ├── index.js │ │ ├── rowrenderer.js │ │ ├── timetable.js │ │ └── timetable.scss │ └── toolbar │ │ ├── index.js │ │ └── toolbar.scss │ ├── test │ ├── activitychart │ │ ├── activity-constraints.test.js │ │ ├── activity-model.test.js │ │ └── index.html │ ├── assets │ │ └── images │ │ │ ├── collapsed.png │ │ │ └── expanded.png │ ├── config.js │ ├── core │ │ ├── core.html │ │ ├── core.test.js │ │ ├── filter.test.js │ │ ├── index.html │ │ ├── navigate.test.js │ │ ├── palette.test.js │ │ └── selection.test.js │ ├── css │ │ └── mocha.css │ ├── data │ │ └── house_building │ │ │ └── workers.json │ ├── error │ │ ├── error.html │ │ ├── error.test.js │ │ └── index.html │ ├── table │ │ ├── dummy-table.js │ │ ├── index.html │ │ ├── mem-model.test.js │ │ ├── table-impl.test.js │ │ ├── table-load.test.js │ │ ├── table-sort.test.js │ │ └── table.html │ ├── testbase.js │ └── timetable │ │ ├── activityrenderer.test.js │ │ ├── activitytext.test.js │ │ ├── index.html │ │ ├── milestone.test.js │ │ └── timetable.html │ ├── webpack.common.js │ ├── webpack.config.all.js │ ├── webpack.config.jquery.js │ ├── webpack.config.jquery.min.js │ ├── webpack.config.lib.js │ └── webpack.config.lib.min.js └── yarn.lock /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "@ibm/gantt-chart", 3 | "projectOwner": "IBM", 4 | "repoType": "github", 5 | "repoHost": "https://github.com", 6 | "files": [ 7 | "README.md" 8 | ], 9 | "imageSize": 100, 10 | "commit": false, 11 | "commitConvention": "none", 12 | "contributors": [ 13 | { 14 | "login": "ono70", 15 | "name": "Olivier Noiret", 16 | "avatar_url": "https://avatars2.githubusercontent.com/u/3769170?v=4", 17 | "profile": "https://github.com/ono70", 18 | "contributions": [ 19 | "code", 20 | "doc", 21 | "example", 22 | "platform" 23 | ] 24 | }, 25 | { 26 | "login": "gillesdandrea", 27 | "name": "Gilles d'Andréa", 28 | "avatar_url": "https://avatars1.githubusercontent.com/u/2739003?v=4", 29 | "profile": "https://github.com/gillesdandrea", 30 | "contributions": [ 31 | "code", 32 | "doc", 33 | "example", 34 | "platform" 35 | ] 36 | } 37 | ], 38 | "contributorsPerLine": 7 39 | } 40 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 2 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | end_of_line = lf 12 | # editorconfig-tools is unable to ignore longs strings or urls 13 | max_line_length = null 14 | 15 | [*.md] 16 | trim_trailing_whitespace = false 17 | 18 | [*.py] 19 | indent_size = 4 20 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | # /node_modules/* and /bower_components/* ignored by default 2 | packages/*/node_modules/* 3 | packages/*/dist/* 4 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | // module.exports = require('gda-scripts/config/.eslintrc.js'); 2 | module.exports = { 3 | extends: ['gda-scripts/config/.eslintrc.js'].map(require.resolve), 4 | env: { 5 | mocha: true, 6 | jquery: true, // TODO should be replaced by proper import $ from 'jquery' 7 | }, 8 | globals: { 9 | chai: 'readonly', 10 | NAME: 'readonly', 11 | VERSION: 'readonly', 12 | }, 13 | rules: { 14 | // TODO These rules are turned off until code refactoring makes it useless 15 | 'class-methods-use-this': 0, 16 | 'consistent-return': 0, 17 | 'func-names': 0, // brute force to replace /function\(\) {/\(\) => {/ breaks tests 18 | 'new-cap': 0, 19 | 'no-cond-assign': 0, 20 | 'no-console': 0, 21 | 'no-continue': 0, 22 | 'no-extend-native': 0, 23 | 'no-multi-assign': 0, 24 | 'no-mixed-operators': 0, 25 | 'no-nested-ternary': 0, 26 | 'no-param-reassign': 0, 27 | 'no-plusplus': 0, 28 | 'no-shadow': 0, 29 | 'no-restricted-globals': 0, 30 | 'no-restricted-syntax': 0, 31 | 'no-throw-literal': 0, 32 | 'no-undef': 0, 33 | 'no-underscore-dangle': 0, 34 | 'no-unused-expressions': 0, 35 | 'no-unused-vars': 0, 36 | 'no-use-before-define': 0, 37 | 'no-useless-constructor': 0, 38 | 'no-var': 0, // brute force replacement /var/let/ breaks tests 39 | 'one-var': 0, 40 | 'prefer-destructuring': 0, 41 | 'prefer-promise-reject-errors': 0, 42 | 'prefer-rest-params': 0, 43 | 'prefer-spread': 0, 44 | 'prefer-template': 0, 45 | 'vars-on-top': 0, 46 | }, 47 | }; 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .cache/ 2 | .history/ 3 | .npm/ 4 | dist/ 5 | monitor/ 6 | node_modules/ 7 | .eslintcache 8 | .stylelintcache 9 | *.log 10 | *-debug.log* 11 | *-error.log* 12 | stats.html 13 | stats.json 14 | .DS_Store 15 | .idea/ 16 | packages/ibm-gantt-chart-react/package.json 17 | packages/ibm-gantt-chart/package.json 18 | yarn.lock 19 | *.lock 20 | .npmrc 21 | -------------------------------------------------------------------------------- /.importsortrc.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | module.exports = require('gda-scripts/config/.importsortrc.js'); 3 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .npmrc 2 | lerna.json 3 | package.json 4 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = require('gda-scripts/config/.prettierrc.js'); 2 | -------------------------------------------------------------------------------- /.stylelintignore: -------------------------------------------------------------------------------- 1 | # /node_modules/* and /bower_components/* ignored by default 2 | /packages/*/node_modules/* 3 | /packages/*/dist/* 4 | /**/*.jsx 5 | -------------------------------------------------------------------------------- /.stylelintrc.js: -------------------------------------------------------------------------------- 1 | // module.exports = require('gda-scripts/config/.stylelintrc.js'); 2 | module.exports = { 3 | extends: ['gda-scripts/config/.stylelintrc.js'].map(require.resolve), 4 | rules: { 5 | // TODO These rules are turned off until code refactoring makes it useless 6 | 'no-descending-specificity': null, 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to IBM Gantt Chart 2 | 3 | ### Requirements for development 4 | 5 | - Recent [Node](https://nodejs.org/) and Npm installed. I currently use node v10.10.0 and npm v6.8.0 6 | - Install [yarn](https://yarnpkg.com/) with `npm i -g yarn` 7 | - Install [lerna](https://lernajs.io/) with `npm i -g lerna` 8 | 9 | ### How to develop? 10 | 11 | 1. Install required packages with `yarn install` (Don't pay attention to [unmet peer dependency](https://github.com/yarnpkg/yarn/issues/5810) warnings). 12 | 13 | 1. Link the different packages with `lerna link` 14 | 15 | 1. Go into the dev package. i.e. `cd packages/ibm-gantt-dev` 16 | 17 | 1. Start dev examples `yarn start` 18 | 19 | 1. Open https://localhost:8080/basic.html 20 | 21 | Note: Build relies on [gda-scripts](https://github.com/gillesdandrea/gda-scripts) that provides (kind of) webpack presets and useful scripts (sort of [create-react-app](https://github.com/facebook/create-react-app) for libraries). 22 | 23 | ### How to publish? 24 | 25 | 1. Bump version of all packages with `lerna version` (necessary before building to inject the proper version number) 26 | 27 | 1. Build all packages `lerna run build:all` 28 | 29 | 1. Publish all packages `lerna publish from-package --no-git-reset` 30 | 31 | ### How to follow guidelines? 32 | 33 | This projects follows a quite opinionated convention for formatting and linting. But don't worry, it's all automatic. 34 | Use `yarn check:fix` to properly format your code and fix common issues (i.e. missing , ou ;) or `yarn check:list` to only list issues. 35 | 36 | Note: a pre-commit script will enforce formatting and linting. 37 | 38 | ### Recommended extensions for [VS Code](https://code.visualstudio.com/) 39 | 40 | Use the following extensions to automatically format files on save and display linting errors. Import sorting is manually triggered on `alt+command+o` 41 | 42 | - ESLint [dbaeumer.vscode-eslint](https://github.com/Microsoft/vscode-eslint) 43 | - stylelint [shinnn.stylelint](https://github.com/shinnn/vscode-stylelint) 44 | - Prettier - Code formatter [esbenp.prettier-vscode](https://github.com/prettier/prettier-vscode) 45 | - sort-imports [amatiasq.sort-imports](https://github.com/amatiasq/vsc-sort-imports) 46 | 47 | You may use the following settings to configure the extensions: 48 | 49 | #### settings.json 50 | 51 | ``` 52 | { 53 | "editor.formatOnSave": true, 54 | "editor.rulers": [120], 55 | "editor.tabSize": 2, 56 | "javascript.validate.enable": false, 57 | "eslint.autoFixOnSave": true, 58 | "stylelint.enable": true, 59 | "css.validate": false, 60 | "less.validate": false, 61 | "scss.validate": false, 62 | "prettier.eslintIntegration": true, 63 | "prettier.stylelintIntegration": true, 64 | "prettier.printWidth": 120, 65 | "prettier.singleQuote": true, 66 | "prettier.trailingComma": "es5", 67 | "sort-imports.on-save": false 68 | } 69 | ``` 70 | 71 | #### keybinding.json 72 | 73 | ``` 74 | [ 75 | { 76 | "key": "alt+cmd+o", 77 | "command": "sort-imports.sort" 78 | } 79 | ] 80 | ``` 81 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # @ibm/gantt-chart 2 | 3 | ![npm](https://img.shields.io/npm/v/ibm-gantt-chart.svg) 4 | ![GitHub](https://img.shields.io/github/license/ibm/gantt-chart.svg) 5 | 6 | > IBM Gantt Chart Component, integrable in Vanilla, jQuery, or React Framework. 7 | 8 | ## Getting started 9 | 10 | Documentation and Examples are available as a [storybook](https://ibm.github.io/gantt-chart/packages/ibm-gantt-chart-docs/storybook) 11 | 12 | This project is structured as a [monorepo](https://en.wikipedia.org/wiki/Monorepo): 13 | 14 | | Package | Description | 15 | | ------------------------------------------------------- | ----------------------------------------------- | 16 | | [ibm-gantt-chart](packages/ibm-gantt-chart) | Gantt Chart Library | 17 | | [ibm-gantt-chart-dev](packages/ibm-gantt-chart-dev) | Development Environment for Gantt Chart Library | 18 | | [ibm-gantt-chart-docs](packages/ibm-gantt-chart-docs) | Documentation and examples | 19 | | [ibm-gantt-chart-react](packages/ibm-gantt-chart-react) | The Gantt Chart React Component | 20 | 21 | ## Contributing 22 | 23 | Check out the [Contributing Guide](CONTRIBUTING.md). 24 | 25 | ## Contributors ✨ 26 | 27 | Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)), especially [Olivier Noiret](https://github.com/ono70), creator of the initial project: 28 | 29 | 30 | 31 |
Olivier Noiret
Olivier Noiret

💻 📖 💡 📦
Gilles d'Andréa
Gilles d'Andréa

💻 📖 💡 📦
32 | 33 | 34 | 35 | This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!! 36 | 37 | ## License 38 | 39 | Licensed under the [Apache 2.0 License](LICENSE). 40 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | Please report security issues to 6 | -------------------------------------------------------------------------------- /babelrc.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: 'gda-scripts/config/.babelrc.js', 3 | }; 4 | -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "commonjs", 5 | "allowSyntheticDefaultImports": true, 6 | "experimentalDecorators": true, 7 | "checkJs": false, 8 | "jsx": "preserve" 9 | }, 10 | "include": ["packages/*/src/**/*"] 11 | } 12 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "lerna": "3.3.0", 3 | "packages": [ 4 | "packages/*" 5 | ], 6 | "npmClient": "yarn", 7 | "useWorkspaces": true, 8 | "version": "0.5.33", 9 | "command": { 10 | "publish": { 11 | "gitReset": false, 12 | "gitTagVersion": true, 13 | "push": true 14 | }, 15 | "version": { 16 | "gitTagVersion": false, 17 | "push": false 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@ibm/gantt-chart", 3 | "version": "0.5.0", 4 | "private": true, 5 | "description": "IBM Gantt Chart Component, integrable in Vanilla, jQuery, or React Framework.", 6 | "repository": "https://github.com/ibm/gantt-chart", 7 | "license": "Apache-2.0", 8 | "contributors": [ 9 | "Olivier Noiret (https://github.com/ono70)", 10 | "Gilles d'Andréa (https://github.com/gillesdandrea)" 11 | ], 12 | "workspaces": [ 13 | "packages/*" 14 | ], 15 | "scripts": { 16 | "build": "rimraf node_modules/vis/docs && lerna run build", 17 | "check:fix": "yarn import:fix && yarn prettier:fix && yarn elint:fix && yarn slint:fix", 18 | "check:list": "yarn import:list && yarn prettier:list && yarn elint && yarn slint", 19 | "clean:all": "yarn clean:dist && yarn clean:junk && yarn clean:modules", 20 | "clean:dist": "rimraf packages/*/dist packages/*/stats.html", 21 | "clean:junk": "rimraf *-{debug,error}.log packages/*/*-{debug,error}.log packages/*/stats.html", 22 | "clean:modules": "rimraf node_modules package-lock.json yarn.lock *-{debug,error}.log packages/*/node_modules packages/*/package-lock.json packages/*/yarn.lock packages/*/*-{debug,error}.log", 23 | "elint": "gda-scripts eslint packages/*/{src,test}", 24 | "elint:fix": "gda-scripts eslint packages/*/{src,test} --fix", 25 | "import:fix": "import-sort --write \"packages/*/{src,test}/**/*.{js,jsx}\" \"packages/*/.*.js\" \"packages/*/*.js\" \".*.js\" \"*.js\"", 26 | "import:list": "import-sort --list-different \"packages/*/{src,test}/**/*.{js,jsx}\" \"packages/*/.*.js\" \"packages/*/*.js\" \".*.js\" \"*.js\"", 27 | "lerna:publish": "lerna publish from-package --no-git-tag-version --no-push", 28 | "lerna:version": "lerna version --no-git-tag-version --no-push", 29 | "precommit": "lint-staged", 30 | "prettier:fix": "prettier --write \"packages/*/{src,test}/**/*.{js,jsx,css,scss,json,md}\" \"packages/*/.*.js\" \"packages/*/*.js\" \".*.js\" \"*.js\" \"docs/*.md\" \"*.md\"", 31 | "prettier:list": "prettier -l \"packages/*/{src,test}/**/*.{js,jsx,css,scss,json,md}\" \"packages/*/.*.js\" \"packages/*/*.js\" \".*.js\" \"*.js\" \"docs/*.md\" \"*.md\"", 32 | "slint": "gda-scripts stylelint packages/*/{src,test}", 33 | "slint:fix": "gda-scripts stylelint packages/*/{src,test} --fix", 34 | "start": "cd packages/ibm-gantt-chart-dev && yarn start", 35 | "update": "yarn upgrade-interactive --latest" 36 | }, 37 | "lint-staged": { 38 | "packages/*/{src,test}/**/*.{css,scss}": [ 39 | "prettier --write", 40 | "gda-scripts stylelint --fix", 41 | "git add" 42 | ], 43 | "packages/*/{src,test}/**/*.{js,jsx} packages/*/.*.js packages/*/*.js .*.js *.js": [ 44 | "import-sort --write", 45 | "prettier --write", 46 | "gda-scripts eslint --fix", 47 | "git add" 48 | ], 49 | "packages/*/{src,test}/**/*.{json,md} docs/*.md *.md": [ 50 | "prettier --write", 51 | "git add" 52 | ] 53 | }, 54 | "devDependencies": { 55 | "all-contributors-cli": "^6.26.1", 56 | "gda-scripts": "^0.3.6", 57 | "husky": "^2.4.0", 58 | "lint-staged": "^8.2.0", 59 | "rimraf": "^2.6.3" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-dev/README.md: -------------------------------------------------------------------------------- 1 | # ibm-gantt-chart-dev 2 | 3 | Development Environment for Gantt Chart Library. 4 | 5 | ### Usage 6 | 7 | 1. Start dev examples with `yarn start` 8 | 9 | 1. Open https://localhost:8080/ or directly https://localhost:8080/basic.html 10 | 11 | Changes in [ibm-gantt-chart](../ibm-gantt-chart) are automatically watched and updated in the running examples. 12 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-dev/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ibm-gantt-chart-dev", 3 | "version": "0.5.33", 4 | "private": true, 5 | "description": "IBM Gantt Chart Dev", 6 | "license": "Apache-2.0", 7 | "contributors": [ 8 | "Olivier Noiret (https://github.com/ono70)", 9 | "Gilles d'Andréa (https://github.com/gillesdandrea)" 10 | ], 11 | "main": "dist/ibm-gantt-chart-dev.js", 12 | "module": "dist/ibm-gantt-chart-dev.js", 13 | "scripts": { 14 | "start": "gda-scripts webpack-dev-server dev", 15 | "test": "echo \"Error: no test specified\" && exit 1" 16 | }, 17 | "dependencies": { 18 | "@babel/polyfill": "^7.4.4", 19 | "ibm-gantt-chart": "^0.5.33" 20 | }, 21 | "devDependencies": { 22 | "gda-scripts": "^0.3.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-dev/src/activityChart/activityChart.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Simple Gantt 4 | 5 | 6 | 19 | 20 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-dev/src/activityChart/activityChart.js: -------------------------------------------------------------------------------- 1 | // import '@babel/polyfill'; 2 | 3 | import Gantt from 'ibm-gantt-chart'; 4 | 5 | // useless with mainFields: ['source'], 6 | // import 'ibm-gantt-chart/dist/ibm-gantt-chart.css'; 7 | 8 | var activityData = [ 9 | { 10 | OBJ_ID: 'NURSES+Anne', 11 | NAME: 'Anne', 12 | START: 1646162596336, 13 | END: 1646165596336, 14 | PARENT_ID: null, 15 | COLOR: '#FF0000', 16 | URL: 'https://example.com/?link-to-anne', 17 | }, 18 | { 19 | OBJ_ID: 'NURSES+Bethanie', 20 | NAME: 'Bethanie', 21 | START: 1646163596336, 22 | END: 1646164596336, 23 | PARENT_ID: 'NURSES+Anne', 24 | COLOR: '#0000FF', 25 | URL: 'https://example.com/?link-to-bethanie', 26 | }, 27 | { 28 | OBJ_ID: 'NURSES+Betsy', 29 | NAME: 'Betsy', 30 | START: 1646164596336, 31 | END: 1646165596336, 32 | PARENT_ID: 'NURSES+Bethanie', 33 | COLOR: '#FFA500', 34 | URL: 'https://example.com/?link-to-betsy', 35 | }, 36 | { 37 | OBJ_ID: 'NURSES+Cathy', 38 | NAME: 'Cathy', 39 | START: 1646163596336, 40 | END: 1646165596336, 41 | parent: null, 42 | COLOR: '#008000', 43 | URL: 'https://example.com/?link-to-cathy', 44 | }, 45 | { 46 | OBJ_ID: 'NURSES+Cindy', 47 | NAME: 'Cindy', 48 | START: 1646164596336, 49 | END: 1646165596336, 50 | PARENT_ID: 'NURSES+Cathy', 51 | COLOR: '#FFFF00', 52 | URL: 'https://example.com/?nurse=link-to-cindy', 53 | }, 54 | ]; 55 | 56 | function createActivitiesGanttConfig() { 57 | return { 58 | data: { 59 | activities: { 60 | data: activityData, 61 | parent: 'PARENT_ID', 62 | id: 'OBJ_ID', 63 | name: 'NAME', 64 | start: 'START', 65 | end: 'END', 66 | }, 67 | }, 68 | timeTable: { 69 | renderer: [ 70 | { 71 | background: (a, b) => a.getData().COLOR, 72 | color: (a, b) => '#ffffff', 73 | textOverflow: 'cut', 74 | }, 75 | ], 76 | }, 77 | type: Gantt.type.ACTIVITY_CHART, 78 | toolbar: [ 79 | 'title', 80 | { 81 | type: 'button', 82 | text: 'Refresh', 83 | fontIcon: 'fa fa-refresh fa-lg', 84 | onclick(ctx) { 85 | location.reload(); 86 | }, 87 | }, 88 | 'separator', 89 | 'search', 90 | 'separator', 91 | 'mini', 92 | 'separator', 93 | 'fitToContent', 94 | 'zoomIn', 95 | 'zoomOut', 96 | 'separator', 97 | ], 98 | title: 'Riot Games', 99 | }; 100 | } 101 | 102 | new Gantt('gantt' /* the id of the DOM element to contain the Gantt chart */, createActivitiesGanttConfig()); 103 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-dev/src/basic/basic.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Simple Gantt 4 | 5 | 6 | 19 | 20 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-dev/src/basic/basic.js: -------------------------------------------------------------------------------- 1 | // import '@babel/polyfill'; 2 | 3 | import Gantt from 'ibm-gantt-chart'; 4 | 5 | // useless with mainFields: ['source'], 6 | // import 'ibm-gantt-chart/dist/ibm-gantt-chart.css'; 7 | 8 | const data = [ 9 | { 10 | id: 'NURSES+Anne', 11 | name: 'Anne', 12 | activities: [ 13 | { 14 | id: 'SHIFTS+Emergency+Monday+2+8', 15 | name: 'Emergency', 16 | start: 1474880400000, 17 | end: 1474902000000, 18 | }, 19 | ], 20 | }, 21 | { 22 | id: 'NURSES+Bethanie', 23 | name: 'Bethanie', 24 | activities: [], 25 | }, 26 | { 27 | id: 'NURSES+Betsy', 28 | name: 'Betsy', 29 | activities: [ 30 | { 31 | id: 'SHIFTS+Emergency+Wednesday+12+18', 32 | name: 'Emergency', 33 | start: 1475089200000, 34 | end: 1475110800000, 35 | }, 36 | { 37 | id: 'SHIFTS+Emergency+Saturday+12+20', 38 | name: 'Emergency', 39 | start: 1475348400000, 40 | end: 1475377200000, 41 | }, 42 | { 43 | id: 'SHIFTS+Consultation+Friday+8+12', 44 | name: 'Consultation', 45 | start: 1475247600000, 46 | end: 1475262000000, 47 | }, 48 | ], 49 | }, 50 | { 51 | id: 'NURSES+Cathy', 52 | name: 'Cathy', 53 | activities: [ 54 | { 55 | id: 'SHIFTS+Emergency+Sunday+20+2', 56 | name: 'Emergency', 57 | start: 1475463600000, 58 | end: 1475485200000, 59 | }, 60 | { 61 | id: 'SHIFTS+Emergency+Saturday+12+20', 62 | name: 'Emergency', 63 | start: 1475348400000, 64 | end: 1475377200000, 65 | }, 66 | { 67 | id: 'SHIFTS+Emergency+Monday+18+2', 68 | name: 'Emergency', 69 | start: 1474938000000, 70 | end: 1474966800000, 71 | }, 72 | ], 73 | }, 74 | { 75 | id: 'NURSES+Cindy', 76 | name: 'Cindy', 77 | activities: [ 78 | { 79 | id: 'SHIFTS+Emergency+Saturday+20+2', 80 | name: 'Emergency', 81 | start: 1475377200000, 82 | end: 1475398800000, 83 | }, 84 | { 85 | id: 'SHIFTS+Consultation+Friday+8+12', 86 | name: 'Consultation', 87 | start: 1475247600000, 88 | end: 1475262000000, 89 | }, 90 | { 91 | id: 'SHIFTS+Consultation+Tuesday+8+12', 92 | name: 'Consultation', 93 | start: 1474988400000, 94 | end: 1475002800000, 95 | }, 96 | ], 97 | }, 98 | ]; 99 | const config = { 100 | data: { 101 | // Configures how to fetch resources for the Gantt 102 | resources: { 103 | data, // resources are provided in an array. Instead, we could configure a request to the server. 104 | // Activities of the resources are provided along with the 'activities' property of resource objects. 105 | // Alternatively, they could be listed from the 'data.activities' configuration. 106 | activities: 'activities', 107 | name: 'name', // The name of the resource is provided with the name property of the resource object. 108 | id: 'id', // The id of the resource is provided with the id property of the resource object. 109 | }, 110 | // Configures how to fetch activities for the Gantt 111 | // As activities are provided along with the resources, this section only describes how to create 112 | // activity Gantt properties from the activity model objects. 113 | activities: { 114 | start: 'start', // The start of the activity is provided with the start property of the model object 115 | end: 'end', // The end of the activity is provided with the end property of the model object 116 | name: 'name', // The name of the activity is provided with the name property of the model object 117 | }, 118 | }, 119 | // Configure a toolbar associated with the Gantt 120 | toolbar: [ 121 | 'title', 122 | 'search', 123 | 'separator', 124 | { 125 | type: 'button', 126 | text: 'Refresh', 127 | fontIcon: 'fa fa-refresh fa-lg', 128 | onclick(ctx) { 129 | ctx.gantt.draw(); 130 | }, 131 | }, 132 | 'fitToContent', 133 | 'zoomIn', 134 | 'zoomOut', 135 | ], 136 | title: 'Simple Gantt', // Title for the Gantt to be displayed in the toolbar 137 | }; 138 | 139 | const gantt = new Gantt('gantt' /* the id of the DOM element to contain the Gantt chart */, config); 140 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-dev/src/index.js: -------------------------------------------------------------------------------- 1 | console.log(`[LOADED] ${NAME}@${VERSION}`); 2 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-dev/webpack.config.dev.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const { readdirSync, statSync } = require('fs'); 3 | const { join } = require('path'); 4 | 5 | const HtmlWebpackPlugin = require('html-webpack-plugin'); 6 | 7 | const configure = require('gda-scripts/config/webpack.configure'); 8 | const common = require('ibm-gantt-chart/webpack.common.js'); 9 | const pkg = require('./package.json'); 10 | 11 | // find all subdirectories examples 12 | const getDirectories = p => readdirSync(p).filter(f => statSync(join(p, f)).isDirectory()); 13 | const dirs = getDirectories('./src'); 14 | const input = { 15 | index: './src/index.js', 16 | }; 17 | dirs.forEach(dir => (input[dir] = `./src/${dir}/${dir}.js`)); 18 | 19 | // generate links for each examples for main page 20 | const bodyHtmlSnippet = ` 21 |

${pkg.name}@${pkg.version}

22 | 31 | `; 32 | 33 | const { webpack = {}, styling = {}, html = {}, ...base } = common; 34 | 35 | module.exports = configure(pkg, { 36 | // 'print-config': true, 37 | ...base, 38 | mode: 'development', 39 | input, 40 | outputName: '[name]', 41 | webpack: { 42 | ...webpack, 43 | resolve: { 44 | ...(webpack.resolve || {}), 45 | mainFields: ['source'], // use source instead of compiled library 46 | }, 47 | plugins: [ 48 | ...(webpack.plugins || []), 49 | ...dirs.map( 50 | dir => 51 | new HtmlWebpackPlugin({ 52 | title: `${dir}`, 53 | filename: `${dir}.html`, 54 | template: `./src/${dir}/${dir}.html`, 55 | chunks: [`${dir}`], 56 | }) 57 | ), 58 | ], 59 | copy: [ 60 | ...(webpack.copy || []), 61 | { 62 | from: '../ibm-gantt-chart/data', 63 | to: 'data/', 64 | }, 65 | { 66 | from: '../../node_modules/jquery/dist', 67 | to: 'jquery/', 68 | }, 69 | { 70 | from: '../../node_modules/datatables.net', 71 | to: 'datatables.net/', 72 | }, 73 | { 74 | from: '../../node_modules/datatables.net-dt', 75 | to: 'datatables.net-dt/', 76 | }, 77 | { 78 | from: '../../node_modules/vis/dist', 79 | to: 'vis/', 80 | }, 81 | ], 82 | }, 83 | styling: { 84 | ...styling, 85 | }, 86 | html: { 87 | ...html, 88 | excludeChunks: dirs.map(dir => `${dir}.js`), // TODO does not work with html-webpack-template 89 | bodyHtmlSnippet, 90 | }, 91 | }); 92 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/README.md: -------------------------------------------------------------------------------- 1 | # ibm-gantt-chart-docs 2 | 3 | ## Documentations and Examples 4 | 5 | Documentations and Examples are available as a [Storybook](https://ibm.github.io/gantt-chart/packages/ibm-gantt-chart-docs/storybook) 6 | 7 | ## Usage 8 | 9 | - Start development storybook with `yarn start` 10 | - Build static storybook with `yarn build` 11 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/data/activity_chart/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-docs/data/activity_chart/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-docs/data/activity_chart/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-docs/data/nurses/images/anesth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/data/nurses/images/anesth.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/data/nurses/images/cardio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/data/nurses/images/cardio.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/data/nurses/images/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/data/nurses/images/empty.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/data/nurses/images/geriatrcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/data/nurses/images/geriatrcs.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/data/nurses/images/onco.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/data/nurses/images/onco.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/data/nurses/images/pediatrics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/data/nurses/images/pediatrics.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ibm-gantt-chart-docs", 3 | "version": "0.5.33", 4 | "private": true, 5 | "description": "IBM Gantt Chart, docs and examples.", 6 | "keywords": [ 7 | "chart", 8 | "gantt", 9 | "storybook" 10 | ], 11 | "license": "Apache-2.0", 12 | "contributors": [ 13 | "Olivier Noiret (https://github.com/ono70)", 14 | "Gilles d'Andréa (https://github.com/gillesdandrea)" 15 | ], 16 | "scripts": { 17 | "build": "gda-scripts build-storybook-html -s ./data", 18 | "start": "gda-scripts storybook-html -s ./data", 19 | "test": "echo \"Error: no test specified\" && exit 1" 20 | }, 21 | "dependencies": { 22 | "ibm-gantt-chart": "^0.5.33" 23 | }, 24 | "devDependencies": { 25 | "gda-scripts": "^0.3.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/docs/concepts.md: -------------------------------------------------------------------------------- 1 | ## Concepts 2 | 3 | A **Gantt chart** is a bar chart that shows time along a horizontal axis and activities placed as bars along the time line. Each activity has a start time and an end time. 4 | Gantt charts are often used to depict planning and scheduling information and also in project management to represent work breakdown structures. 5 | 6 | There are two types of Gantt chart: the **Scheduling chart** and the **Activity Chart**. 7 | 8 | **Scheduling charts** show who is doing what and when in your plan. They are used to track simultaneous activities and resources. An **activity** is anything you want to plan, monitor or schedule over time. It has a start and end time (and consequently a duration). A **resource** can be human, machine, equipment or anything you want to use for the activities. A particular assignment of a resource to an activity is called a **reservation**. 9 | 10 | For example, the following diagram shows part of a schedule chart for a building project in August and September. It shows both activities and the resources that are assigned, so that the workload for each resource can be monitored. Different activities (masonry, ceiling, plumbing etc.) are represented as color-coded bars for each resource along a timeline. 11 | Several resources can work simultaneously on the same activity (masonry for example). Some resources work on different activities. Others work only on one type of activity (Steve for example only works on plumbing). The resources section also shows the staff grouped into teams. For example, Jane is responsible for Joe, Jack and Jim but she doesn’t undertake any of the work shown in this scheduling chart. 12 | Any period that is not filled-in is a period where that resource is not used. 13 | 14 | ![alt text](images/concepts_schedule_chart.jpg 'Schedule Chart') 15 | 16 | **Activity charts** also show when things happen, but they are organized according to the activities rather than the resources. Activities can be broken up into tasks and each task is represented as a horizontal bar along a time scale. You might have some restrictions concerning when different activities start or end in relation to each other. These dependencies are depicted by arrows between activities and are called **constraints**. 17 | 18 | The following diagram shows part of an activity chart for a marketing project in March and April. It displays the order and timing in which different activities must take place. Each activity is broken down into tasks (for example, compiling the customer list and contacting customers are two tasks which make up the activity talking to customers). Arrows between the bars indicate dependencies between activities. For example, the first draft must be completed before the second draft of the marketing requirements can be written. This is indicated by an arrow which indicates that the end of the first draft must occur before the beginning of the second draft. This type of precedence constraint is very common in project management. 19 | 20 | ![alt text](images/concepts_activity_chart.jpg 'Activity Chart') 21 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/docs/data_accessors.md: -------------------------------------------------------------------------------- 1 | # Data accessors 2 | 3 | Anywhere in the Gantt configuration that a configuration property can be computed, a data accessor is used to provide greater flexibility in defining how this value is computed. 4 | For example, in the data configuration, the `start` property of activities is dynamically computed from a user object representing the activity. 5 | Using a data accessor, the start property can be computed with a call to a function or by looking for a specified object property. 6 | 7 | Data accessors can be declared with different signatures: 8 | 9 | 10 | 11 | ### string 12 | 13 | The string is a list of property names separated by periods. The first property name is a direct property of the accessed object, the second property name is the name of a property of the property object accessed with the first property name and so on... 14 |
15 | 16 | Example: 17 | 18 | ``` 19 | var dataConfig = { 20 | activities : { 21 | start : "SCHEDULE.START", // Data accessor declared as a string. The start property is provided with the START property of the SCHEDULE property object of a task. 22 | ... 23 | }, 24 | ... 25 | }; 26 | ``` 27 | 28 | 29 | 30 | ### function 31 | 32 | The function is called to compute a value for a configuration property. The first parameter of the function is the contextual object to get the value from. 33 | This contextual object will vary depending on where the data accessor is used in the Gantt configuration. If it is used in the data configuration, the contextual object will be the user object returned from the data fetcher. 34 |
35 | 36 | Example: 37 | 38 | ``` 39 | function computeEnd(task) { 40 | return task.SCHEDULE.START + (task.SCHEDULE.DURATION * 60 * 60 * 1000); 41 | } 42 | var dataConfig = { 43 | activities : { 44 | end : computeEnd, // Data accessor declared as a function. The end property is computed by the function, given a task as the parameter. 45 | ... 46 | }, 47 | ... 48 | }; 49 | ``` 50 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/docs/data_dates.md: -------------------------------------------------------------------------------- 1 | # Dates 2 | 3 | Dates are provided to the Gantt chart as the number of milliseconds since January 1st 1970. 4 | In the data configuration, however, it is possible to provide dates as strings if you specify the date format to be used for parsing the date strings 5 | 6 | The date format is provided with the `dateFormat` data configuration. 7 | 8 |
Example 9 | 10 | ``` 11 | var dataConfig = { 12 | resources : { 13 | }, 14 | activities : { 15 | url : "....", 16 | start : "START" // The START property of user object returned from the given URL provides dates as string with the format "yyyy-MM-dd'T'HH:mm:ss.SSSZ" 17 | }, 18 | dateFormat : "yyyy-MM-dd'T'HH:mm:ss.SSSZ" // Format to parse date strings from. 19 | }; 20 | ``` 21 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/docs/data_time_window.md: -------------------------------------------------------------------------------- 1 | # Time window 2 | 3 | The earliest start date and latest end date which define the time scale of the Gantt chart is processed according to a _time window_ of the Gantt data model, a time frame in which all activities occur. 4 | 5 | By default, this time window is automatically computed looking at the earliest start date and latest end date for the activities of the Gantt chart. 6 | Alternatively, you can specify a time window for the Gantt chart as part of its data, using the `timeWindow` data configuration entry. 7 | The `timeWindow` entry also configures one [data fetcher](./?path=/story/guides-data--data-fetchers) to fetch the time window and two [data accessors](./?path=/story/guides-data--data-accessors) for getting the `start` and `end` of the time window. 8 | 9 |
Example: 10 | 11 | ``` 12 | var dataConfig = { 13 | resources : { 14 | ... 15 | }, 16 | activities : { 17 | ... 18 | }, 19 | timeWindow : { 20 | // Fetch the time window returned as an object with the format 21 | // { 22 | // windowStart : ..., // 23 | // windowEnd : ... // 24 | // } 25 | url : "/examples/timewindow.json", 26 | start : 'windowStart', // The start of the time window is provided with the 'windowStart' property of the returned time window object 27 | end : 'windowEnd', // The end of the time window is provided with the 'windowStart' property of the returned time window object 28 | } 29 | }; 30 | ``` 31 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/docs/docs.stories.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable global-require */ 2 | /* eslint-disable import/no-extraneous-dependencies */ 3 | 4 | import marked from 'marked'; 5 | 6 | import { storiesOf } from '@storybook/html'; 7 | 8 | import './github-markdown.css'; 9 | 10 | const title = 'Guides'; 11 | const chapters = [ 12 | { 13 | title: 'Introduction', 14 | pages: [ 15 | { title: 'Getting started', md: require('../../../ibm-gantt-chart/README.md') }, 16 | { title: 'Overview', md: require('.//overview.md') }, 17 | { title: 'Concepts', md: require('.//concepts.md') }, 18 | ], 19 | }, 20 | { 21 | title: 'Data', 22 | pages: [ 23 | { title: 'Overview', md: require('.//data_overview.md') }, 24 | { title: 'Data Fetchers', md: require('.//data_fetchers.md') }, 25 | { title: 'Data Accessors', md: require('.//data_accessors.md') }, 26 | { title: 'Dates', md: require('.//data_dates.md') }, 27 | { title: 'Complex Mappings', md: require('.//data_complex_mappings.md') }, 28 | { title: 'Time Window', md: require('.//data_time_window.md') }, 29 | ], 30 | }, 31 | { 32 | title: 'Time Line', 33 | pages: [ 34 | { title: 'Overview', md: require('.//time_line_overview.md') }, 35 | { title: 'Activity Rendering', md: require('.//time_line_activity_rendering.md') }, 36 | { title: 'Activities Layout', md: require('.//time_line_activities_layout.md') }, 37 | { title: 'Decorations / break', md: require('.//time_line_decorations.md') }, 38 | { title: 'Drag-n-Drop', md: require('.//time_line_dragdrop.md') }, 39 | ], 40 | }, 41 | { 42 | title: 'Miscellaneous', 43 | pages: [ 44 | { title: 'Handling Selection', md: require('.//selection.md') }, 45 | { title: 'Renderers', md: require('.//renderers.md') }, 46 | { title: 'Palettes', md: require('.//palettes.md') }, 47 | ], 48 | }, 49 | ]; 50 | 51 | chapters.forEach(chapter => { 52 | const story = storiesOf(`${title}|${chapter.title}`, module).addParameters({ options: { showPanel: false } }); 53 | chapter.pages.forEach(page => { 54 | story.add(page.title, () => `
${marked(page.md)}
`); 55 | }); 56 | }); 57 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/docs/overview.md: -------------------------------------------------------------------------------- 1 | ## Overview 2 | 3 | IBM Gantt Chart lets you visualize data in a Gantt chart on your website. 4 | A storybook of examples illustrates powerful features that enable a rich experience when using a Gantt chart, from filtering to formatting the display according to the properties of your data. 5 | 6 | The IBM Gantt Chart is packaged in bundles for different uses: 7 | 8 | 1. As a Vanilla Javascript component 9 | 2. As a React component 10 | 3. As a jQuery component 11 | 12 | For each of these platforms, including a Gantt chart in a website is easy, you just: 13 | 14 | - Load one of the Gantt libraries (Vanilla JS, React, jQuery). 15 | - Create a Gantt Javascript object, giving it a DOM element ID and a configuration object. 16 | The configuration object is mainly used to feed the Gantt chart with data, declare a toolbar or configure the display of activities, resources, constraints, breaks, etc. 17 | - Load some data into the Gantt chart if it is not already specified in the provided configuration object. 18 | - Insert a DOM element in the HTML using the same ID that you gave to the Gantt object. The DOM element then contains the Gantt component. 19 | See [Getting started](./?path=/story/guides-introduction--getting-started) for creating your first Gantt visualization. 20 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/docs/palettes.md: -------------------------------------------------------------------------------- 1 | # Palettes 2 | 3 | Palettes are functions that return a color when given an index. They are used by [renderers](./?path=/story/guides-miscellaneous--renderers) to color display elements according to property values. 4 | If the palette is defined with a finite number of colors and the provided index exceeds this number, the modulo index for the number of colors is used instead. 5 | 6 | Palettes can be declared for each renderer or globally to the Gantt chart, with the `palette` property of the Gantt configuration. 7 | They can be declared with different signatures: 8 | 9 | 1. Array 10 | 11 | The palette is provided as an array of colors 12 | 13 | ``` 14 | var ganttConfig : { 15 | ... 16 | palette: ["#ffffd9", "#edf8b1", "#c7e9b4", "#7fcdbb", "#41b6c4", "#1d91c0", "#225ea8", "#0c2c84"] 17 | } 18 | new Gantt( 'gantt', ganttConfig ); 19 | ``` 20 | 21 | 2. Function 22 | 23 | The palette is configured as a function, taking as a parameter an index and returning a color. 24 | 25 | ``` 26 | var ganttConfig : { 27 | ... 28 | palette: function(index) { return '...'; // Smart code for processing a color based on the given index. 29 | } 30 | new Gantt( 'gantt', ganttConfig ); 31 | ``` 32 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/docs/selection.md: -------------------------------------------------------------------------------- 1 | ## Selection 2 | 3 | TODO... 4 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/docs/time_line_activities_layout.md: -------------------------------------------------------------------------------- 1 | # Layout of activities 2 | 3 | In the timetable, activities are positioned on the horizontal time axis according to the start and end property of the activity. 4 | By default, activities fit the height of their containing row, minus a vertical padding. 5 | 6 | This is usually fine for most user models when a resource can only perform one activity at a time. 7 | For models with resources having parallel activities, however, activities can be partially or fully hidden as all activities in a same row have the same vertical position and a same height. 8 | 9 | To avoid this behavior, the Gantt configuration allows you to change the activity layout to vertically display the activities differently. 10 | 11 | Two alternative activity layouts can be used: 12 | 13 | 1. Logistic layout 14 | 15 | Parallel activities in a same resource are cascaded vertically. This layout does not impact the height of the resource row. 16 | 17 | ![alt text](/images/doc/logistic-layout.png 'Logistic layout') 18 | 19 | 2. Tile layout 20 | 21 | Parallel activities are vertically stacked on top each others. This layout does impact the height of the resource row. 22 | 23 | ![alt text](/images/doc/tile-layout.png 'Tile layout') 24 | 25 | The activity layout is specified with the Gantt configuration `timeTable.layout.strategy` which can be given a `string` that identifies the layout to use or a function returning the same `string`. 26 | 27 | - Use the `string` value `"logistic"` for logistic layout. 28 | - Use the `string` value `"tile"` for tile layout. 29 | - Use an empty `string` value for the default activity layout. 30 | 31 | This code extract is from the [row layout](/examples/rowlayout.html) example that illustrates the change of activity layout with a function: 32 | 33 | ``` 34 | var config { 35 | ... 36 | timeTable: { 37 | layout: { 38 | strategy: function (ctx) { 39 | return ctx.gantt.rowLayoutMode; // Returns either an empty string 40 | } 41 | } 42 | ... 43 | ``` 44 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/docs/time_line_decorations.md: -------------------------------------------------------------------------------- 1 | # Add decorations and breaks to the time line 2 | 3 | The display of timelines can be customized to add different types of visual elements to provide useful information relative to time for the user model such as: 4 | 5 | - Show invalid time zones in which no activity can be performed. This use done by generating global decorations to the time line. 6 | - For each resource, show time frames when the resource cannot perform any activities (breaks). This is done by generating time decorations local to a specific resource. 7 | - Show time markers on the time axis for important dates of the schedule, such as the start date of a project. An API is provided for adding time markers. 8 | - Show time frame markers on the time axis to highlight specific time periods. An API is provided for adding time zone markers. 9 | 10 | ### Decorations. 11 | 12 | Decorations are gray zones displayed in the background of activities to show information such as breaks for a resource or time zones when no activity can be performed. 13 | Decorations can be global to the time line or local to a resource. They have to predefined types: 14 | 15 | - Invalid, displayed by default as an hatched area: 16 | 17 | ![alt text](/images/doc/decoration-invalid.png 'Invalid zone') 18 | 19 | - Break, displayed by default a solid gray area: 20 | 21 | ![alt text](/images/doc/decoration-break.png 'Break zone') 22 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/docs/time_line_dragdrop.md: -------------------------------------------------------------------------------- 1 | # Drag and drop of activities 2 | 3 | TODO... 4 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/docs/time_line_overview.md: -------------------------------------------------------------------------------- 1 | # Timeline 2 | 3 | The timeline is the right panel of a Gantt chart displaying activities in a timeline as illustrated in: 4 | 5 | ![alt text](/images/doc/concepts_schedule_chart.jpg 'Timeline') 6 | 7 | As for all Gantt components, the timeline can initialize without any configuration from the user. 8 | But it can be customized in many ways: 9 | 10 | - [Activity rendering](#?path=/story/guides-time-line--activity-rendering), to customize the display of activities to reflect user model properties. 11 | - [Activities layout](./?path=/story/guides-time-line--activities-layout), to change the layout of activities, typically when several activities in the same row have the same start time. 12 | - [Add decorations/breaks](./?path=/story/guides-time-line--decorations), to add decorations, breaks, or time markers in the time line. 13 | - [Drag and drop of activities](./?path=/story/guides-time-line--drag-n-drop, to implement the drag-and-drop of activities. 14 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/examples/activity_chart/activity_chart.story.js: -------------------------------------------------------------------------------- 1 | import Gantt from 'ibm-gantt-chart'; 2 | 3 | import { storiesOf } from '@storybook/html'; // eslint-disable-line import/no-extraneous-dependencies 4 | 5 | import createXMLDataConfig from './createXMLDataConfig'; 6 | 7 | import '../stories.scss'; 8 | 9 | function createActivitiesGanttConfig() { 10 | const ganttData = createXMLDataConfig('activity_chart/activity_chart.xml'); 11 | return { 12 | data: ganttData, 13 | classes: 'activity-chart-example', 14 | type: Gantt.type.ACTIVITY_CHART, 15 | constraints: { 16 | renderer: [ 17 | { 18 | selector(object, ctx) { 19 | return ctx.gantt.layoutLabelMode === 'right'; 20 | }, 21 | nodeLabelLayout: 'right', 22 | }, 23 | { 24 | selector(object, ctx) { 25 | return ctx.gantt.layoutLabelMode === 'left'; 26 | }, 27 | nodeLabelLayout: 'left', 28 | }, 29 | { 30 | selector(object, ctx) { 31 | return ctx.gantt.layoutLabelMode === 'noLinkCrossing'; 32 | }, 33 | nodeLabelLayout: { 34 | padding: 12, // Horizontal padding between the label and the node or link 35 | // If possible place the node label in a free space between a node/link and a link. 36 | // If several holes are possible, choose the one the closest from the node. 37 | // If not possible, place the text after the last link from the node 38 | startLayout(act, labelWidth, ctx) { 39 | this.closestHole = null; 40 | this.furtherLeft = this.padding; 41 | this.furtherRight = this.padding; 42 | this.w = labelWidth + this.padding; 43 | }, 44 | nextLink(act, left, linkX, previousX, nodeX, ctx) { 45 | if (Math.abs(linkX - previousX) >= this.w) { 46 | const newHole = left 47 | ? -Math.abs(nodeX - previousX) - this.padding 48 | : Math.abs(previousX - nodeX) + this.padding; 49 | if (this.closestHole === null || Math.abs(newHole) < Math.abs(this.closestHole)) { 50 | this.closestHole = newHole + (left ? -this.padding : this.padding); 51 | } 52 | } 53 | // Keep track of the position of the furthest link from the node on this side 54 | else if (left) { 55 | this.furtherLeft = Math.max(Math.abs(nodeX - linkX) + this.padding, this.furtherLeft); 56 | } else { 57 | this.furtherRight = Math.max(Math.abs(linkX - nodeX) + this.padding, this.furtherRight); 58 | } 59 | }, 60 | getNodeToLabelSpacing(act, bbox, textWidth, ctx) { 61 | return this.closestHole !== null 62 | ? this.closestHole 63 | : this.furtherLeft < this.furtherRight 64 | ? -this.furtherLeft 65 | : this.furtherRight; 66 | }, 67 | }, 68 | }, 69 | ], 70 | }, 71 | toolbar: [ 72 | 'title', 73 | 'search', 74 | 'separator', 75 | 'mini', 76 | 'separator', 77 | 'fitToContent', 78 | 'zoomIn', 79 | 'zoomOut', 80 | 'separator', 81 | // User specific label layout 82 | { 83 | type: 'select', 84 | text: 'Show', 85 | options: [ 86 | { value: 'default', text: 'Default' }, 87 | { value: 'right', text: 'Right' }, 88 | { value: 'left', text: 'Left' }, 89 | { value: 'noLinkCrossing', text: 'No link crossing' }, 90 | ], 91 | onchange(value, ctx) { 92 | const { gantt } = ctx; 93 | gantt.layoutLabelMode = value; 94 | gantt.draw(true); 95 | }, 96 | }, 97 | ], 98 | title: 'Activity Chart example', 99 | }; 100 | } 101 | 102 | storiesOf('Storybook|Examples', module).add('Activity Chart', () => { 103 | setTimeout(() => { 104 | new Gantt('gantt', createActivitiesGanttConfig()); // eslint-disable-line no-new 105 | }, 0); 106 | return '
'; 107 | }); 108 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/examples/big_data/big_data.story.js: -------------------------------------------------------------------------------- 1 | import Gantt from 'ibm-gantt-chart'; 2 | 3 | import { storiesOf } from '@storybook/html'; // eslint-disable-line import/no-extraneous-dependencies 4 | 5 | import '../stories.scss'; 6 | 7 | function createAirbusConfig() { 8 | return { 9 | data: { 10 | resources: { 11 | url: 'airbus/airbus.json', 12 | parent: 'ParentID', 13 | id: 'id', 14 | activities: 'tasks', 15 | name: 'name', 16 | }, 17 | activities: { 18 | start: 'from', 19 | end: 'to', 20 | name: 'name', 21 | id: 'id', 22 | }, 23 | }, 24 | classes: 'airbus', 25 | title() { 26 | return 'Airbus'; 27 | }, 28 | }; 29 | } 30 | 31 | storiesOf('Storybook|Performances', module).add('Big Data', () => { 32 | setTimeout(() => { 33 | var startTime = new Date().getTime(); 34 | console.log('Start'); 35 | var gantt = new Gantt('gantt', createAirbusConfig()); 36 | gantt.on(Gantt.events.TIME_LINE_INIT, () => 37 | console.log(`Initialization time: ${new Date().getTime() - startTime} millis`) 38 | ); 39 | }, 0); 40 | return '
'; 41 | }); 42 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/examples/house_building/house_building.css: -------------------------------------------------------------------------------- 1 | .vis-item.vis-background.HouseBackground1 { 2 | background-color: rgba(65, 214, 195, 0.2); 3 | } 4 | .vis-item.vis-background.HouseBackground2 { 5 | z-index: 1; 6 | background-color: rgba(140, 210, 17, 0.2); 7 | } 8 | .vis-item.vis-background.HouseBackground3 { 9 | background-color: rgba(90, 170, 250, 0.2); 10 | } 11 | .vis-item.vis-background.HouseBackground4 { 12 | background-color: rgba(186, 143, 247, 0.2); 13 | } 14 | .vis-item.vis-background.HouseBackground5 { 15 | background-color: rgba(0, 174, 154, 0.2); 16 | } 17 | .vis-item.vis-background.HouseBackground6 { 18 | background-color: rgba(90, 166, 0, 0.2); 19 | } 20 | .vis-item.vis-background.HouseBackground7 { 21 | background-color: rgba(65, 120, 190, 0.2); 22 | } 23 | .vis-item.vis-background.HouseBackground8 { 24 | background-color: rgba(152, 85, 212, 0.2); 25 | } 26 | .vis-item.vis-background.HouseBackground9 { 27 | background-color: rgba(233, 193, 0, 0.2); 28 | } 29 | .vis-item.vis-background.HouseBackground10 { 30 | background-color: rgba(255, 120, 50, 0.2); 31 | } 32 | .vis-item.vis-background.HouseBackground11 { 33 | background-color: rgba(231, 29, 50, 0.2); 34 | } 35 | .vis-item.vis-background.HouseBackground12 { 36 | background-color: rgba(50, 92, 128, 0.2); 37 | } 38 | .vis-item.vis-background.HouseBackground13 { 39 | background-color: rgba(172, 140, 0, 0.2); 40 | } 41 | .vis-item.vis-background.HouseBackground14 { 42 | background-color: rgba(215, 65, 8, 0.2); 43 | } 44 | .vis-item.vis-background.HouseBackground15 { 45 | background-color: rgba(173, 22, 37, 0.2); 46 | } 47 | .vis-item.vis-background.HouseBackground16 { 48 | background-color: rgba(29, 54, 73, 0.2); 49 | } 50 | .vis-item.vis-background.HouseBackground17 { 51 | background-color: rgba(255, 113, 212, 0.2); 52 | } 53 | .vis-item.vis-background.HouseBackground18 { 54 | background-color: rgba(219, 39, 128, 0.2); 55 | } 56 | .vis-item.vis-background.HouseBackground19 { 57 | background-color: rgba(157, 147, 147, 0.2); 58 | } 59 | .vis-item.vis-background.HouseBackground20 { 60 | background-color: rgba(100, 90, 90, 0.2); 61 | } 62 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/examples/nurses/nurses.css: -------------------------------------------------------------------------------- 1 | .unscheduled-area { 2 | /* http://lea.verou.me/css3patterns/#bricks */ 3 | background-color: silver; 4 | background-image: linear-gradient(335deg, #b00 23px, transparent 23px), 5 | linear-gradient(155deg, #d00 23px, transparent 23px), linear-gradient(335deg, #b00 23px, transparent 23px), 6 | linear-gradient(155deg, #d00 23px, transparent 23px); 7 | background-position: 0 2px, 4px 35px, 29px 31px, 34px 6px; 8 | background-size: 58px 58px; 9 | } 10 | 11 | /* Do not highlight week-end */ 12 | .nurses .vis-time-axis .vis-grid.vis-saturday, 13 | .nurses .vis-time-axis .vis-grid.vis-sunday { 14 | color: white; 15 | background: none; 16 | } 17 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/examples/row_layout/row_layout.story.js: -------------------------------------------------------------------------------- 1 | import Gantt from 'ibm-gantt-chart'; 2 | 3 | import { storiesOf } from '@storybook/html'; // eslint-disable-line import/no-extraneous-dependencies 4 | 5 | import '../stories.scss'; 6 | 7 | function createRowLayoutGanttConfig() { 8 | var nowMillis = new Date(2016, 7, 8, 8, 0, 0, 0).getTime(); 9 | 10 | function makeDate(num) { 11 | return nowMillis + num * 12 * 60 * 60 * 1000; 12 | } 13 | 14 | function createActivityDuplicates(workers, ctx) { 15 | var gantt = ctx.gantt; 16 | gantt.rowLayoutMode = null; 17 | var worker, assigns, assign; 18 | var maxSubRows = 3; 19 | var results = []; 20 | for (var i = 0; i < workers.length; i++) { 21 | worker = workers[i]; 22 | results.push(worker); 23 | assigns = worker.ASSIGNMENTS; 24 | var newAssigns = []; 25 | for (var iAssign = 0, assignCount = assigns ? assigns.length : 0; iAssign < assignCount; iAssign++) { 26 | assign = assigns[iAssign]; 27 | newAssigns.push(assign); 28 | for (var iCp = 0, copyCount = maxSubRows - (iAssign % maxSubRows) - 1; iCp < copyCount; iCp++) { 29 | // for(var iCp = 0, copyCount = 1; iCp < copyCount; iCp++) { 30 | newAssigns.push($.extend({}, assign)); 31 | } 32 | } 33 | worker.ASSIGNMENTS = newAssigns; 34 | } 35 | return results; 36 | } 37 | 38 | return { 39 | data: { 40 | resources: { 41 | url: 'house_building/workers.json', 42 | success: createActivityDuplicates, 43 | parent: 'PARENT_ID', 44 | id: 'OBJECT_ID', 45 | activities: 'ASSIGNMENTS', 46 | name: 'NAME', 47 | }, 48 | activities: { 49 | start(assignment) { 50 | return makeDate(assignment.START); 51 | }, 52 | end(assignment) { 53 | return makeDate(assignment.END); 54 | }, 55 | name: 'TASK.NAME', 56 | }, 57 | }, 58 | timeTable: { 59 | layout: { 60 | strategy(ctx) { 61 | return ctx.gantt.rowLayoutMode; // Returns either an empty string for the default layout, "logistic" for the logistic layout or "tile" for the tile layout. 62 | }, 63 | }, 64 | renderer: { 65 | text(activity) { 66 | return activity.TASK.NAME; 67 | }, 68 | background: { 69 | getValue: 'TASK.NAME', 70 | }, 71 | color: 'automatic', 72 | }, 73 | }, 74 | toolbar: [ 75 | 'title', 76 | // User specific toolbar components 77 | { 78 | type: 'select', 79 | text: 'Row layout', 80 | options: [ 81 | { value: '', text: 'Default' }, 82 | { value: 'logistic', text: 'Logistic' }, 83 | { value: 'tile', text: 'Tile' }, 84 | ], 85 | onchange(value, ctx) { 86 | var gantt = ctx.gantt; 87 | gantt.rowLayoutMode = value; 88 | gantt.draw(); 89 | }, 90 | }, 91 | 'separator', 92 | 'search', 93 | 'separator', 94 | 'mini', 95 | 'separator', 96 | 'fitToContent', 97 | 'zoomIn', 98 | 'zoomOut', 99 | ], 100 | title: 'Row layout example', 101 | }; 102 | } 103 | 104 | storiesOf('Storybook|Examples', module).add('Row Layout', () => { 105 | setTimeout(() => { 106 | new Gantt('gantt', createRowLayoutGanttConfig()); // eslint-disable-line no-new 107 | }, 0); 108 | return '
'; 109 | }); 110 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/src/examples/stories.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | html, 4 | body, 5 | #root, 6 | #gantt { 7 | height: 100%; 8 | margin: 0; 9 | padding: 0; 10 | } 11 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/activity_chart/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-docs/storybook/activity_chart/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-docs/storybook/activity_chart/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-docs/storybook/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/favicon.ico -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/iframe.html: -------------------------------------------------------------------------------- 1 | Storybook

No Preview

Sorry, but you either have no stories or none are selected somehow.

  • Please check the Storybook config.
  • Try reloading the page.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

-------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/index.html: -------------------------------------------------------------------------------- 1 | Storybook
-------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/main.898cbe740b274c903ec0.bundle.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[0],{438:function(n,o,p){p(439),p(584),n.exports=p(1102)},512:function(n,o){}},[[438,1,2]]]); -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/main.c4fc495beddc146836ff.bundle.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"main.c4fc495beddc146836ff.bundle.js","sources":["webpack:///main.c4fc495beddc146836ff.bundle.js"],"mappings":"AAAA","sourceRoot":""} -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/nurses/images/anesth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/nurses/images/anesth.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/nurses/images/cardio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/nurses/images/cardio.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/nurses/images/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/nurses/images/empty.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/nurses/images/geriatrcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/nurses/images/geriatrcs.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/nurses/images/onco.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/nurses/images/onco.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/nurses/images/pediatrics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/nurses/images/pediatrics.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/runtime~main.286b69a873d49f2f199c.bundle.js: -------------------------------------------------------------------------------- 1 | !function(e){function r(r){for(var n,l,f=r[0],i=r[1],a=r[2],c=0,s=[];c 34 | * 35 | * Copyright (c) 2014-2017, Jon Schlinkert. 36 | * Released under the MIT License. 37 | */ 38 | 39 | /*! 40 | * https://github.com/paulmillr/es6-shim 41 | * @license es6-shim Copyright 2013-2016 by Paul Miller (http://paulmillr.com) 42 | * and contributors, MIT License 43 | * es6-shim: v0.35.4 44 | * see https://github.com/paulmillr/es6-shim/blob/0.35.3/LICENSE 45 | * Details and documentation: 46 | * https://github.com/paulmillr/es6-shim/ 47 | */ 48 | 49 | /** @license React v16.8.1 50 | * react.production.min.js 51 | * 52 | * Copyright (c) Facebook, Inc. and its affiliates. 53 | * 54 | * This source code is licensed under the MIT license found in the 55 | * LICENSE file in the root directory of this source tree. 56 | */ 57 | 58 | /** @license React v0.13.1 59 | * scheduler.production.min.js 60 | * 61 | * Copyright (c) Facebook, Inc. and its affiliates. 62 | * 63 | * This source code is licensed under the MIT license found in the 64 | * LICENSE file in the root directory of this source tree. 65 | */ 66 | 67 | /* 68 | object-assign 69 | (c) Sindre Sorhus 70 | @license MIT 71 | */ 72 | 73 | /** @license React v16.8.1 74 | * react-dom.production.min.js 75 | * 76 | * Copyright (c) Facebook, Inc. and its affiliates. 77 | * 78 | * This source code is licensed under the MIT license found in the 79 | * LICENSE file in the root directory of this source tree. 80 | */ 81 | 82 | /*! 83 | Copyright (c) 2016 Jed Watson. 84 | Licensed under the MIT License (MIT), see 85 | http://jedwatson.github.io/classnames 86 | */ 87 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/addNodeIcon.a1a2d01b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/addNodeIcon.a1a2d01b.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/backIcon.dd0baa69.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/backIcon.dd0baa69.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/check.7190e4db.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/check.7190e4db.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/connectIcon.d5267b8d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/connectIcon.d5267b8d.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/cross.260c9c65.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/cross.260c9c65.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/deleteIcon.02d321ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/deleteIcon.02d321ed.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/downArrow.bbfbf2e8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/downArrow.bbfbf2e8.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/drag-error.3d2cb918.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/drag-error.3d2cb918.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/editIcon.d5422321.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/editIcon.d5422321.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/error.c8314c9f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/error.c8314c9f.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/fontawesome-webfont.674f50d2.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/fontawesome-webfont.674f50d2.eot -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/fontawesome-webfont.af7ae505.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/fontawesome-webfont.af7ae505.woff2 -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/fontawesome-webfont.b06871f2.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/fontawesome-webfont.b06871f2.ttf -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/fontawesome-webfont.fee66e71.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/fontawesome-webfont.fee66e71.woff -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/leftArrow.8965662a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/leftArrow.8965662a.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/minus.5a379c46.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/minus.5a379c46.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/plus.4c4bf0a1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/plus.4c4bf0a1.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/remove-error-focused.f559e46b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/remove-error-focused.f559e46b.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/remove-error.0d1b419c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/remove-error.0d1b419c.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/rightArrow.4f88ef17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/rightArrow.4f88ef17.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/upArrow.f0aa0566.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/upArrow.f0aa0566.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/zoom--in.f6c66cb7.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/zoom--out.501eb7d3.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/static/media/zoomExtends.5f78e86f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/gantt-chart/6b6fee28f5fde85f3920d7b1da630a28ee17c59e/packages/ibm-gantt-chart-docs/storybook/static/media/zoomExtends.5f78e86f.png -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/storybook/vendors~main.c4fc495beddc146836ff.bundle.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"vendors~main.c4fc495beddc146836ff.bundle.js","sources":["webpack:///vendors~main.c4fc495beddc146836ff.bundle.js"],"mappings":"AAAA;;;;;;;;;;;;;AAofA;;;;;;;;;;;AAogBA;;;;;;;;;;;;;;;;;;;;;;;;AAsgiBA;;;;;;AAm7MA;;;;;AAgmHA;;;;;AAqkEA;;;;;;;;;AAqkBA;;;;;;;AAksXA;;;;;;AAipBA;;;;;;;;AAoiPA;;;;;AA+BA;;;;;;;;AAqNA;;;;AAyiIA","sourceRoot":""} -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-docs/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-react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ibm-gantt-chart-react", 3 | "version": "0.5.33", 4 | "description": "IBM Gantt Chart React Component.", 5 | "repository": "https://github.com/ibm/gantt-chart", 6 | "keywords": [ 7 | "chart", 8 | "gantt", 9 | "react" 10 | ], 11 | "license": "Apache-2.0", 12 | "contributors": [ 13 | "Olivier Noiret (https://github.com/ono70)", 14 | "Gilles d'Andréa (https://github.com/gillesdandrea)" 15 | ], 16 | "main": "dist/ibm-gantt-chart-react.js", 17 | "module": "dist/ibm-gantt-chart-react.js", 18 | "source": "src/index.js", 19 | "style": "dist/ibm-gantt-chart-react.css", 20 | "scripts": { 21 | "build": "gda-scripts webpack lib", 22 | "build:all": "gda-scripts webpack lib", 23 | "build:min": "gda-scripts webpack lib.min", 24 | "build:storybook": "gda-scripts build-storybook", 25 | "start": "gda-scripts webpack-dev-server dev", 26 | "storybook": "gda-scripts storybook", 27 | "test": "echo \"Error: no test specified\" && exit 1" 28 | }, 29 | "dependencies": { 30 | "ibm-gantt-chart": "^0.5.33" 31 | }, 32 | "devDependencies": { 33 | "@hot-loader/react-dom": "^16.8.6", 34 | "gda-scripts": "^0.3.0", 35 | "prop-types": "^15.7.2", 36 | "react": "^16.8.6", 37 | "react-dom": "^16.8.6" 38 | }, 39 | "peerDependencies": { 40 | "ibm-gantt-chart": "^0.5.0", 41 | "prop-types": "^15.7.2", 42 | "react": "16.8.6", 43 | "react-dom": "16.8.6" 44 | }, 45 | "gitHead": "ec24c5000b1c547c1496474106a233103c3d09f5" 46 | } 47 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-react/src/App.jsx: -------------------------------------------------------------------------------- 1 | import '@babel/polyfill'; 2 | import React from 'react'; 3 | import ReactDOM from 'react-dom'; 4 | 5 | import GanttChart from './components/GanttChart/GanttChart'; 6 | 7 | import './App.scss'; 8 | 9 | // useless with mainFields: ['source'], 10 | // import 'ibm-gantt-chart/dist/ibm-gantt-chart.css'; 11 | 12 | const data = [ 13 | { 14 | id: 'NURSES+Anne', 15 | name: 'Anne', 16 | activities: [ 17 | { 18 | id: 'SHIFTS+Emergency+Monday+2+8', 19 | name: 'Emergency', 20 | start: 1474880400000, 21 | end: 1474902000000, 22 | }, 23 | ], 24 | }, 25 | { 26 | id: 'NURSES+Bethanie', 27 | name: 'Bethanie', 28 | activities: [], 29 | }, 30 | { 31 | id: 'NURSES+Betsy', 32 | name: 'Betsy', 33 | activities: [ 34 | { 35 | id: 'SHIFTS+Emergency+Wednesday+12+18', 36 | name: 'Emergency', 37 | start: 1475089200000, 38 | end: 1475110800000, 39 | }, 40 | { 41 | id: 'SHIFTS+Emergency+Saturday+12+20', 42 | name: 'Emergency', 43 | start: 1475348400000, 44 | end: 1475377200000, 45 | }, 46 | { 47 | id: 'SHIFTS+Consultation+Friday+8+12', 48 | name: 'Consultation', 49 | start: 1475247600000, 50 | end: 1475262000000, 51 | }, 52 | ], 53 | }, 54 | { 55 | id: 'NURSES+Cathy', 56 | name: 'Cathy', 57 | activities: [ 58 | { 59 | id: 'SHIFTS+Emergency+Sunday+20+2', 60 | name: 'Emergency', 61 | start: 1475463600000, 62 | end: 1475485200000, 63 | }, 64 | { 65 | id: 'SHIFTS+Emergency+Saturday+12+20', 66 | name: 'Emergency', 67 | start: 1475348400000, 68 | end: 1475377200000, 69 | }, 70 | { 71 | id: 'SHIFTS+Emergency+Monday+18+2', 72 | name: 'Emergency', 73 | start: 1474938000000, 74 | end: 1474966800000, 75 | }, 76 | ], 77 | }, 78 | { 79 | id: 'NURSES+Cindy', 80 | name: 'Cindy', 81 | activities: [ 82 | { 83 | id: 'SHIFTS+Emergency+Saturday+20+2', 84 | name: 'Emergency', 85 | start: 1475377200000, 86 | end: 1475398800000, 87 | }, 88 | { 89 | id: 'SHIFTS+Consultation+Friday+8+12', 90 | name: 'Consultation', 91 | start: 1475247600000, 92 | end: 1475262000000, 93 | }, 94 | { 95 | id: 'SHIFTS+Consultation+Tuesday+8+12', 96 | name: 'Consultation', 97 | start: 1474988400000, 98 | end: 1475002800000, 99 | }, 100 | ], 101 | }, 102 | ]; 103 | const config = { 104 | data: { 105 | // Configures how to fetch resources for the Gantt 106 | resources: { 107 | data, // resources are provided in an array. Instead, we could configure a request to the server. 108 | // Activities of the resources are provided along with the 'activities' property of resource objects. 109 | // Alternatively, they could be listed from the 'data.activities' configuration. 110 | activities: 'activities', 111 | name: 'name', // The name of the resource is provided with the name property of the resource object. 112 | id: 'id', // The id of the resource is provided with the id property of the resource object. 113 | }, 114 | // Configures how to fetch activities for the Gantt 115 | // As activities are provided along with the resources, this section only describes how to create 116 | // activity Gantt properties from the activity model objects. 117 | activities: { 118 | start: 'start', // The start of the activity is provided with the start property of the model object 119 | end: 'end', // The end of the activity is provided with the end property of the model object 120 | name: 'name', // The name of the activity is provided with the name property of the model object 121 | }, 122 | }, 123 | // Configure a toolbar associated with the Gantt 124 | toolbar: [ 125 | 'title', 126 | 'search', 127 | 'separator', 128 | { 129 | type: 'button', 130 | text: 'Refresh', 131 | fontIcon: 'fa fa-refresh fa-lg', 132 | onclick(ctx) { 133 | ctx.gantt.draw(); 134 | }, 135 | }, 136 | 'fitToContent', 137 | 'zoomIn', 138 | 'zoomOut', 139 | ], 140 | title: 'Simple Gantt', // Title for the Gantt to be displayed in the toolbar 141 | }; 142 | 143 | ReactDOM.render(, document.getElementById('root')); 144 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-react/src/App.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | html { 4 | height: 100%; 5 | } 6 | body { 7 | height: 100%; 8 | margin: 0; 9 | padding: 0; 10 | } 11 | #root { 12 | height: 100%; 13 | } 14 | -------------------------------------------------------------------------------- /packages/ibm-gantt-chart-react/src/components/GanttChart/GanttChart.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | 4 | import Gantt from 'ibm-gantt-chart'; 5 | 6 | import './GanttChart.scss'; 7 | 8 | export default class GanttChart extends React.PureComponent { 9 | static propTypes = { 10 | config: PropTypes.shape({}).isRequired, 11 | className: PropTypes.oneOfType([PropTypes.string, PropTypes.array, PropTypes.object]), 12 | style: PropTypes.shape({}), 13 | }; 14 | 15 | static defaultProps = { 16 | className: undefined, 17 | style: undefined, 18 | }; 19 | 20 | componentDidMount() { 21 | this.gantt = new Gantt(this.node, this.props.config); 22 | } 23 | 24 | componentDidUpdate(prevProps, prevState) { 25 | if (prevProps.config !== this.props.config) { 26 | this.node.childNodes.forEach(child => child.remove()); // remove previous Gantt 27 | this.gantt = new Gantt(this.node, this.props.config); 28 | } 29 | } 30 | 31 | componentWillUnmount() { 32 | this.node = undefined; 33 | this.gantt = undefined; 34 | } 35 | 36 | render() { 37 | const { className, style } = this.props; 38 | return ( 39 |
(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 | --------------------------------------------------------------------------------