├── .editorconfig ├── .eslintrc.js ├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── custom.md │ └── feature_request.md ├── .gitignore ├── .prettierrc.js ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── _config.yml ├── cypress.json ├── dist ├── GanttElastic.common.js ├── GanttElastic.common.js.map ├── GanttElastic.common.min.js ├── GanttElastic.umd.js ├── GanttElastic.umd.js.map ├── GanttElastic.umd.min.js └── bundle.js ├── examples ├── from-readme.html ├── index.html ├── vue.edit.html ├── vue.html └── vue.max-rows.html ├── gantt-elastic.gif ├── gantt-elastic.jpg ├── grab-scroll.gif ├── package-lock.json ├── package.json ├── src ├── GanttElastic.standalone.vue ├── GanttElastic.vue ├── bundle.js ├── components │ ├── Calendar │ │ ├── Calendar.vue │ │ └── CalendarRow.vue │ ├── Chart │ │ ├── Chart.vue │ │ ├── DaysHighlight.vue │ │ ├── DependencyLines.vue │ │ ├── Grid.vue │ │ ├── ProgressBar.vue │ │ ├── Row │ │ │ ├── Milestone.vue │ │ │ ├── Project.vue │ │ │ ├── Task.mixin.js │ │ │ └── Task.vue │ │ └── Text.vue │ ├── Expander.vue │ ├── MainView.vue │ └── TaskList │ │ ├── ItemColumn.vue │ │ ├── TaskList.vue │ │ ├── TaskListHeader.vue │ │ └── TaskListItem.vue └── style.js ├── tests ├── .eslintrc.js ├── assets │ ├── standalone.html │ └── umd.html ├── fixtures │ └── example.json ├── integration │ └── basic_spec.js ├── plugins │ └── index.js └── support │ ├── commands.js │ └── index.js ├── webpack.config.js └── webpack.dev.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true, 5 | jest: true 6 | }, 7 | extends: ['plugin:vue/essential', 'plugin:prettier/recommended', '@vue/prettier'], 8 | rules: { 9 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 10 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 11 | }, 12 | parserOptions: { 13 | parser: 'babel-eslint' 14 | }, 15 | globals: { 16 | page: true, 17 | browser: true, 18 | context: true, 19 | jestPuppeteer: true 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | #github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | #patreon: # Replace with a single Patreon username 5 | #open_collective: # Replace with a single Open Collective username 6 | #ko_fi: # Replace with a single Ko-fi username 7 | #tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | #community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | #liberapay: # Replace with a single Liberapay username 10 | issuehunt: neuronetio 11 | #otechie: # Replace with a single Otechie username 12 | #custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | labels: 5 | 6 | --- 7 | 8 | **Describe the bug** 9 | A clear and concise description of what the bug is. 10 | 11 | **To Reproduce** 12 | Steps to reproduce the behavior: 13 | 1. Go to '...' 14 | 2. Click on '....' 15 | 3. Scroll down to '....' 16 | 4. See error 17 | 18 | **Expected behavior** 19 | A clear and concise description of what you expected to happen. 20 | 21 | **Screenshots** 22 | If applicable, add screenshots to help explain your problem. 23 | 24 | **Desktop (please complete the following information):** 25 | - OS: [e.g. iOS] 26 | - Browser [e.g. chrome, safari] 27 | - Version [e.g. 22] 28 | 29 | **Smartphone (please complete the following information):** 30 | - Device: [e.g. iPhone6] 31 | - OS: [e.g. iOS8.1] 32 | - Browser [e.g. stock browser, safari] 33 | - Version [e.g. 22] 34 | 35 | **Additional context** 36 | Add any other context about the problem here. 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Custom issue template 3 | about: Describe this issue template's purpose here. 4 | labels: 5 | 6 | --- 7 | 8 | 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | labels: 5 | 6 | --- 7 | 8 | **Is your feature request related to a problem? Please describe.** 9 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 10 | 11 | **Describe the solution you'd like** 12 | A clear and concise description of what you want to happen. 13 | 14 | **Describe alternatives you've considered** 15 | A clear and concise description of any alternative solutions or features you've considered. 16 | 17 | **Additional context** 18 | Add any other context or screenshots about the feature request here. 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | .sonarlint/ 3 | node_modules/ 4 | .history 5 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | singleQuote: true, 3 | semi: true, 4 | printWidth: 120 5 | }; 6 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at neuronet.io@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 neuronet.io 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Gantt-elastic - Javascript Gantt Chart (editable, responsive)

2 |

Javascript Gantt Chart for vue, jquery, vanilla js and other frameworks

3 | 4 |
5 |

Project moved as next major version to gantt-schedule-timeline-calendar



6 |
7 | 8 | This project is not suitable for use in a production environment as it runs very slowly even in standard medium projects. This project has been completely rewritten and built with super performance in mind and is available in the new repository as a gantt-schedule-timeline-calendar. 9 | 10 | 11 |

Gantt-elastic demo here

12 | 13 | ![preview img](https://github.com/neuronetio/gantt-elastic/raw/master/gantt-elastic.jpg) 14 | ![preview gif](https://github.com/neuronetio/gantt-elastic/raw/master/gantt-elastic.gif) 15 | ![preview gif](https://github.com/neuronetio/gantt-elastic/raw/master/grab-scroll.gif) 16 | 17 | ## Gantt-elastic 18 | 19 | is a vue component but it could be used in other frameworks or even with jQuery (vue is kind of elastic and lightweight framework). 20 | 21 | [WIKI](https://github.com/neuronetio/gantt-elastic/wiki) 22 | 23 | [Vue Example](https://github.com/neuronetio/vue-gantt-elastic) 24 | 25 | ### Installation 26 | 27 | `npm install --save gantt-elastic` or download zip from github / clone repo 28 | 29 | and if you want default header 30 | 31 | `npm install --save gantt-elastic-header` 32 | 33 | ### Usage 34 | 35 | ```html 36 | 37 | 38 | 39 | 40 | 41 | GanttElastic editor demo 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
51 |
52 | 53 | 54 | 55 | 56 |
57 |
58 | 59 | 300 | 301 | 302 | ``` 303 | 304 | ### gantt-elastic as vue component 305 | 306 | Take a look at the `vue.html` inside [examples folder](https://github.com/neuronetio/gantt-elastic/tree/master/examples) file to see how you could add gantt-elastic inside ` 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 | 18 | 19 | 20 | 21 |
22 |
23 | 24 | 250 | 251 | 252 | -------------------------------------------------------------------------------- /examples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Gangtt-elastic demo 7 | 8 | 9 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 303 | 304 | 305 | -------------------------------------------------------------------------------- /examples/vue.edit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | GanttElastic editor demo 7 | 8 | 9 | 12 | 15 | 16 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | modify task
30 |
31 | 32 | 33 | 34 |
35 | 36 | 37 |
38 | 45 |
46 | 47 |
48 |
49 | 50 | 512 | 513 | 514 | -------------------------------------------------------------------------------- /examples/vue.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | GanttElastic demo 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |
17 |
18 | 19 | 20 | 21 |
22 |
23 | 24 | 295 | 296 | 297 | -------------------------------------------------------------------------------- /examples/vue.max-rows.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | GanttElastic editor demo 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 |
19 | 20 | 21 | 22 |
23 |
24 | 25 | modify task
26 | 27 | 28 | 29 |
30 | 31 | 32 |
33 | 40 |
41 | 42 |
43 | 44 | 229 | 230 | 231 | -------------------------------------------------------------------------------- /gantt-elastic.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neuronetio/gantt-elastic/b37fe08e4134d10d344d528ba6b8f9b2606d23c9/gantt-elastic.gif -------------------------------------------------------------------------------- /gantt-elastic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neuronetio/gantt-elastic/b37fe08e4134d10d344d528ba6b8f9b2606d23c9/gantt-elastic.jpg -------------------------------------------------------------------------------- /grab-scroll.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neuronetio/gantt-elastic/b37fe08e4134d10d344d528ba6b8f9b2606d23c9/grab-scroll.gif -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gantt-elastic", 3 | "version": "1.0.12", 4 | "description": "Gantt chart. Elastic javascript gantt chart. Vue gantt. Project manager responsive gantt. jquery gantt.", 5 | "main": "src/GanttElastic.vue", 6 | "dependencies": { 7 | "dayjs": "^1.8.16", 8 | "resize-observer-polyfill": "^1.5.1", 9 | "vue": "^2.6.10" 10 | }, 11 | "devDependencies": { 12 | "@types/chai": "^4.2.2", 13 | "@types/cypress": "^1.1.3", 14 | "@types/mocha": "^5.2.7", 15 | "@vue/cli-plugin-eslint": "^3.11.0", 16 | "@vue/cli-service": "^3.11.0", 17 | "@vue/eslint-config-prettier": "^4.0.1", 18 | "babel-core": "^6.26.3", 19 | "babel-jest": "^24.9.0", 20 | "babel-preset-env": "^1.7.0", 21 | "css-loader": "^1.0.1", 22 | "cypress": "^3.4.1", 23 | "eslint": "^5.16.0", 24 | "eslint-plugin-cypress": "^2.6.1", 25 | "vue-loader": "^15.7.1", 26 | "vue-slider-component": "^3.0.40", 27 | "vue-switches": "^2.0.1", 28 | "vue-template-compiler": "^2.6.10", 29 | "webpack": "^4.39.3", 30 | "webpack-cli": "^3.3.8", 31 | "webpack-dev-server": "^3.8.0" 32 | }, 33 | "scripts": { 34 | "test": "npx cypress run --browser chrome", 35 | "build": "webpack", 36 | "dev": "webpack --config webpack.dev.js --watch" 37 | }, 38 | "repository": { 39 | "type": "git", 40 | "url": "git+https://github.com/neuronetio/gantt-elastic.git" 41 | }, 42 | "keywords": [ 43 | "gantt", 44 | "gantt js", 45 | "gantt chart", 46 | "gantt elastic", 47 | "javascript gantt", 48 | "javascript gantt chart", 49 | "jQuery gantt", 50 | "vue gantt", 51 | "js gantt", 52 | "gantt-chart", 53 | "responsive", 54 | "vue", 55 | "vue-gantt", 56 | "javascript gantt", 57 | "project gantt", 58 | "project manger", 59 | "responsive gantt", 60 | "gantt component", 61 | "javascript gantt", 62 | "project", 63 | "task" 64 | ], 65 | "author": "Rafal Pospiech (https://neuronet.io)", 66 | "license": "MIT", 67 | "bugs": { 68 | "url": "https://github.com/neuronetio/gantt-elastic/issues" 69 | }, 70 | "postcss": { 71 | "plugins": { 72 | "autoprefixer": {} 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/GanttElastic.standalone.vue: -------------------------------------------------------------------------------- 1 | 9 | 15 | 32 | -------------------------------------------------------------------------------- /src/bundle.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Bundle main entry file 3 | * @license MIT 4 | * @author Rafal Pospiech 5 | * @package GanttElasticStandalone 6 | */ 7 | import Vue from 'vue'; 8 | import { mergeDeep } from './GanttElastic.vue'; 9 | import GanttElasticStandalone from './GanttElastic.standalone.vue'; 10 | 11 | window.GanttElastic = { 12 | component: GanttElasticStandalone, 13 | mount(config) { 14 | const ready = typeof config.ready === 'function' ? config.ready : () => {}; 15 | const cfg = mergeDeep({}, config); 16 | if (typeof cfg.dynamicStyle === 'undefined') { 17 | cfg.dynamicStyle = {}; 18 | } 19 | const ganttElastic = { ...GanttElasticStandalone }; 20 | for (let prop in cfg) { 21 | if (['el', 'ready'].includes(prop)) { 22 | continue; 23 | } 24 | if (typeof ganttElastic[prop] !== 'undefined') { 25 | ganttElastic[prop] = { ...ganttElastic[prop], ...cfg[prop] }; 26 | continue; 27 | } 28 | ganttElastic[prop] = cfg[prop]; 29 | } 30 | return new Vue(ganttElastic).$on('gantt-elastic-ready', ready).$mount(cfg.el); 31 | } 32 | }; 33 | export default GanttElasticStandalone; 34 | -------------------------------------------------------------------------------- /src/components/Calendar/Calendar.vue: -------------------------------------------------------------------------------- 1 | 9 | 21 | 22 | 340 | -------------------------------------------------------------------------------- /src/components/Calendar/CalendarRow.vue: -------------------------------------------------------------------------------- 1 | 9 | 33 | 34 | 104 | -------------------------------------------------------------------------------- /src/components/Chart/Chart.vue: -------------------------------------------------------------------------------- 1 | 9 | 70 | 71 | 119 | -------------------------------------------------------------------------------- /src/components/Chart/DaysHighlight.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 28 | 29 | 79 | -------------------------------------------------------------------------------- /src/components/Chart/DependencyLines.vue: -------------------------------------------------------------------------------- 1 | 9 | 30 | 31 | 120 | -------------------------------------------------------------------------------- /src/components/Chart/Grid.vue: -------------------------------------------------------------------------------- 1 | 9 | 52 | 53 | 172 | -------------------------------------------------------------------------------- /src/components/Chart/ProgressBar.vue: -------------------------------------------------------------------------------- 1 | 9 | 61 | 62 | 118 | -------------------------------------------------------------------------------- /src/components/Chart/Row/Milestone.vue: -------------------------------------------------------------------------------- 1 | 9 | 74 | 75 | 125 | -------------------------------------------------------------------------------- /src/components/Chart/Row/Project.vue: -------------------------------------------------------------------------------- 1 | 9 | 74 | 75 | 139 | -------------------------------------------------------------------------------- /src/components/Chart/Row/Task.mixin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Task mixin 3 | * @license MIT 4 | * @author Rafal Pospiech 5 | * @package GanttElastic 6 | */ 7 | 8 | export default { 9 | computed: { 10 | /** 11 | * Get view box 12 | * 13 | * @returns {string} 14 | */ 15 | getViewBox() { 16 | const task = this.task; 17 | return `0 0 ${task.width} ${task.height}`; 18 | }, 19 | 20 | /** 21 | * Get group transform 22 | * 23 | * @returns {string} 24 | */ 25 | getGroupTransform() { 26 | return `translate(${this.task.x} ${this.task.y})`; 27 | }, 28 | 29 | /** 30 | * Should we display expander? 31 | * 32 | * @returns {boolean} 33 | */ 34 | displayExpander() { 35 | const expander = this.root.state.options.chart.expander; 36 | return expander.display || (expander.displayIfTaskListHidden && !this.root.state.options.taskList.display); 37 | } 38 | }, 39 | methods: { 40 | /** 41 | * Emit event 42 | * 43 | * @param {string} eventName 44 | * @param {Event} event 45 | */ 46 | emitEvent(eventName, event) { 47 | if (!this.root.state.options.scroll.scrolling) { 48 | this.root.$emit(`chart-${this.task.type}-${eventName}`, { event, data: this.task }); 49 | } 50 | } 51 | } 52 | }; 53 | -------------------------------------------------------------------------------- /src/components/Chart/Row/Task.vue: -------------------------------------------------------------------------------- 1 | 9 | 74 | 75 | 115 | -------------------------------------------------------------------------------- /src/components/Chart/Text.vue: -------------------------------------------------------------------------------- 1 | 9 | 49 | 50 | 107 | -------------------------------------------------------------------------------- /src/components/Expander.vue: -------------------------------------------------------------------------------- 1 | 9 | 50 | 51 | 134 | -------------------------------------------------------------------------------- /src/components/MainView.vue: -------------------------------------------------------------------------------- 1 | 9 | 91 | 92 | 290 | -------------------------------------------------------------------------------- /src/components/TaskList/ItemColumn.vue: -------------------------------------------------------------------------------- 1 | 9 | 53 | 54 | 130 | -------------------------------------------------------------------------------- /src/components/TaskList/TaskList.vue: -------------------------------------------------------------------------------- 1 | 9 | 28 | 29 | 53 | -------------------------------------------------------------------------------- /src/components/TaskList/TaskListHeader.vue: -------------------------------------------------------------------------------- 1 | 9 | 71 | 72 | 171 | -------------------------------------------------------------------------------- /src/components/TaskList/TaskListItem.vue: -------------------------------------------------------------------------------- 1 | 9 | 21 | 43 | -------------------------------------------------------------------------------- /src/style.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Styles for gantt-elastic 3 | * @license MIT 4 | * @author Rafal Pospiech 5 | * @package GanttElastic 6 | */ 7 | 8 | export default function getStyle(fontSize = '12px', fontFamily = 'Arial, sans-serif') { 9 | return { 10 | fontSize, 11 | fontFamily, 12 | 'main-view': { 13 | background: '#FFFFFF' 14 | }, 15 | 'main-container-wrapper': { 16 | overflow: 'hidden', 17 | 'border-top': '1px solid #eee', 18 | 'border-bottom': '1px solid #eee' 19 | }, 20 | 'main-container': { 21 | float: 'left', 22 | 'max-width': '100%' 23 | }, 24 | 'main-view-container': {}, 25 | container: { 26 | display: 'flex', 27 | 'max-width': '100%', 28 | height: '100%' 29 | }, 30 | 'calendar-wrapper': { 31 | 'user-select': 'none' 32 | }, 33 | calendar: { 34 | width: '100%', 35 | background: '#f3f5f7', 36 | display: 'block' 37 | }, 38 | 'calendar-row': { 39 | display: 'flex', 40 | 'justify-content': 'space-evenly' 41 | }, 42 | 'calendar-row--month': {}, 43 | 'calendar-row--day': {}, 44 | 'calendar-row--hour': { 45 | 'border-bottom': '1px solid #eee' 46 | }, 47 | 'calendar-row-rect': { 48 | background: 'transparent', 49 | display: 'flex' 50 | }, 51 | 'calendar-row-rect--month': {}, 52 | 'calendar-row-rect--day': {}, 53 | 'calendar-row-rect--hour': {}, 54 | 'calendar-row-rect-child': { 55 | display: 'block', 56 | 'border-right-width': '1px', // Calendar 57 | 'border-right-color': '#dadada', 58 | 'border-right-style': 'solid', 59 | position: 'relative' 60 | }, 61 | 'calendar-row-rect-child--month': {}, 62 | 'calendar-row-rect-child--day': { 'text-align': 'center' }, 63 | 'calendar-row-rect-child--hour': { 'text-align': 'center' }, 64 | 'calendar-row-text': { 65 | 'font-family': fontFamily, // GanttElastic 66 | 'font-size': fontSize, //GanttElastic 67 | color: '#606060', 68 | display: 'inline-block', 69 | position: 'relative' 70 | }, 71 | 'calendar-row-text--month': {}, 72 | 'calendar-row-text--day': {}, 73 | 'calendar-row-text--hour': {}, 74 | 'task-list-wrapper': {}, 75 | 'task-list': { background: 'transparent', 'border-color': '#eee' }, 76 | 'task-list-header': { 77 | display: 'flex', 78 | 'user-select': 'none', 79 | 'vertical-align': 'middle', 80 | 'border-bottom': '1px solid #eee', 81 | 'border-left': '1px solid #eee' 82 | }, 83 | 'task-list-header-column': { 84 | 'border-left': '1px solid #00000050', 85 | 'box-sizing': 'border-box', 86 | display: 'flex', 87 | background: '#f3f5f7', 88 | 'border-color': 'transparent' 89 | }, 90 | 'task-list-expander-wrapper': { 91 | display: 'inline-flex', 92 | 'flex-shrink': '0', 93 | 'box-sizing': 'border-box', 94 | margin: '0 0 0 10px' 95 | }, 96 | 'task-list-expander-content': { 97 | display: 'inline-flex', 98 | cursor: 'pointer', 99 | margin: 'auto 0px', 100 | 'box-sizing': 'border-box', 101 | 'user-select': 'none' 102 | }, 103 | 'task-list-expander-line': { 104 | fill: 'transparent', 105 | stroke: '#000000', 106 | 'stroke-width': '1', 107 | 'stroke-linecap': 'round' 108 | }, 109 | 'task-list-expander-border': { 110 | fill: '#ffffffa0', 111 | stroke: '#000000A0' 112 | }, 113 | 'chart-expander-wrapper': { 114 | display: 'block', 115 | 'line-height': '1', 116 | 'box-sizing': 'border-box', 117 | margin: '0' 118 | }, 119 | 'chart-expander-content': { 120 | display: 'inline-flex', 121 | cursor: 'pointer', 122 | margin: 'auto 0px', 123 | 'box-sizing': 'border-box', 124 | 'user-select': 'none' 125 | }, 126 | 'chart-expander-line': { 127 | fill: 'transparent', 128 | stroke: '#000000', 129 | 'stroke-width': '1', 130 | 'stroke-linecap': 'round' 131 | }, 132 | 'chart-expander-border': { 133 | fill: '#ffffffa0', 134 | stroke: '#000000A0' 135 | }, 136 | 'task-list-container': {}, 137 | 'task-list-header-label': { 138 | overflow: 'hidden', 139 | 'text-overflow': 'ellipsis', 140 | 'font-family': fontFamily, 141 | 'font-size': fontSize, 142 | 'box-sizing': 'border-box', 143 | margin: 'auto 6px', 144 | 'flex-grow': '1', 145 | 'vertical-align': 'middle' 146 | }, 147 | 'task-list-header-resizer-wrapper': { 148 | background: 'transparent', 149 | height: '100%', 150 | width: '6px', 151 | cursor: 'col-resize', 152 | display: 'inline-flex', 153 | 'vertical-align': 'center' 154 | }, 155 | 'task-list-header-resizer': { margin: 'auto 0px' }, 156 | 'task-list-header-resizer-dot': { 157 | width: '3px', 158 | height: '3px', 159 | background: '#ddd', 160 | 'border-radius': '100%', 161 | margin: '4px 0px' 162 | }, 163 | 'task-list-items': { 164 | overflow: 'hidden' 165 | }, 166 | 'task-list-item': { 167 | 'border-top': '1px solid #eee', 168 | 'border-right': '1px solid #eee', 169 | 'box-sizing': 'border-box', 170 | display: 'flex', 171 | background: 'transparent' 172 | }, 173 | 'task-list-item-column': { 174 | display: 'inline-flex', 175 | 'flex-shrink': '0', 176 | 'border-left': '1px solid #00000050', 177 | 'box-sizing': 'border-box', 178 | 'border-color': '#eee' 179 | }, 180 | 'task-list-item-value-wrapper': { 181 | overflow: 'hidden', 182 | display: 'flex', 183 | width: '100%' 184 | }, 185 | 'task-list-item-value-container': { 186 | margin: 'auto 0px', 187 | overflow: 'hidden' 188 | }, 189 | 'task-list-item-value': { 190 | display: 'block', 191 | 'flex-shrink': '100', 192 | 'font-family': fontFamily, 193 | 'font-size': fontSize, 194 | 'margin-top': 'auto', 195 | 'margin-bottom': 'auto', 196 | 'margin-left': '6px', // TaskList 197 | 'margin-right': '6px', 198 | overflow: 'hidden', 199 | 'text-overflow': 'ellipsis', 200 | 'line-height': '1.5em', 201 | 'word-break': 'keep-all', 202 | 'white-space': 'nowrap', 203 | color: '#606060', 204 | background: '#FFFFFF' 205 | }, 206 | 'grid-lines': {}, 207 | 'grid-line-horizontal': { 208 | stroke: '#00000010', 209 | 'stroke-width': 1 210 | }, 211 | 'grid-line-vertical': { 212 | stroke: '#00000010', 213 | 'stroke-width': 1 214 | }, 215 | 'grid-line-time': { 216 | stroke: '#FF000080', 217 | 'stroke-width': 1 218 | }, 219 | chart: { 220 | 'user-select': 'none', 221 | overflow: 'hidden' 222 | }, 223 | 'chart-calendar-container': { 224 | 'user-select': 'none', 225 | overflow: 'hidden', 226 | 'max-width': '100%', 227 | 'border-right': '1px solid #eee' 228 | }, 229 | 'chart-graph-container': { 230 | 'user-select': 'none', 231 | overflow: 'hidden', 232 | 'max-width': '100%', 233 | 'border-right': '1px solid #eee' 234 | }, 235 | 'chart-area': {}, 236 | 'chart-graph': { 237 | overflow: 'hidden' 238 | }, 239 | 'chart-row-text-wrapper': {}, 240 | 'chart-row-text': { 241 | background: '#ffffffa0', 242 | 'border-radius': '10px', 243 | 'font-family': fontFamily, 244 | 'font-size': fontSize, 245 | 'font-weight': 'normal', 246 | color: '#000000a0', 247 | height: '100%', 248 | display: 'inline-block' 249 | }, 250 | 'chart-row-text-content': { 251 | padding: '0px 6px' 252 | }, 253 | 'chart-row-text-content--text': {}, 254 | 'chart-row-text-content--html': {}, 255 | 'chart-row-wrapper': {}, 256 | 'chart-row-bar-wrapper': {}, 257 | 'chart-row-bar': {}, 258 | 'chart-row-bar-polygon': { 259 | stroke: '#E74C3C', 260 | 'stroke-width': 1, 261 | fill: '#F75C4C' 262 | }, 263 | 'chart-row-project-wrapper': {}, 264 | 'chart-row-project': {}, 265 | 'chart-row-project-polygon': {}, 266 | 'chart-row-milestone-wrapper': {}, 267 | 'chart-row-milestone': {}, 268 | 'chart-row-milestone-polygon': {}, 269 | 'chart-row-task-wrapper': {}, 270 | 'chart-row-task': {}, 271 | 'chart-row-task-polygon': {}, 272 | 'chart-row-progress-bar-wrapper': {}, 273 | 'chart-row-progress-bar': {}, 274 | 'chart-row-progress-bar-line': { 275 | stroke: '#ffffff25', 276 | 'stroke-width': 20 277 | }, 278 | 'chart-row-progress-bar-solid': { 279 | fill: '#0EAC51', 280 | height: '20%' 281 | }, 282 | 'chart-row-progress-bar-pattern': { 283 | fill: 'url(#diagonalHatch)', 284 | transform: 'translateY(0.1) scaleY(0.8)' 285 | }, 286 | 'chart-row-progress-bar-outline': { 287 | stroke: '#E74C3C', 288 | 'stroke-width': 1 289 | }, 290 | 'chart-dependency-lines-wrapper': {}, 291 | 'chart-dependency-lines-path': { 292 | fill: 'transparent', 293 | stroke: '#FFa00090', 294 | 'stroke-width': 2 295 | }, 296 | 'chart-scroll-container': {}, 297 | 'chart-scroll-container--horizontal': { 298 | overflow: 'auto', 299 | 'max-width': '100%' 300 | }, 301 | 'chart-scroll-container--vertical': { 302 | 'overflow-y': 'auto', 303 | 'overflow-x': 'hidden', 304 | 'max-height': '100%', 305 | float: 'right' 306 | }, 307 | 'chart-days-highlight-rect': { 308 | fill: '#f3f5f780' 309 | }, 310 | 'slot-header-beforeOptions': { 311 | display: 'inline-block' 312 | } 313 | }; 314 | } 315 | -------------------------------------------------------------------------------- /tests/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: false, 3 | env: { 4 | node: true, 5 | 'cypress/globals': true, 6 | jest: true 7 | }, 8 | extends: ['plugin:vue/essential', 'plugin:prettier/recommended', '@vue/prettier', 'plugin:cypress/recommended'], 9 | rules: { 10 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 11 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 12 | }, 13 | parserOptions: { 14 | parser: 'babel-eslint' 15 | }, 16 | plugins: ['cypress'], 17 | globals: { 18 | page: true, 19 | browser: true, 20 | context: true, 21 | jestPuppeteer: true 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /tests/assets/standalone.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Gangtt-elastic demo 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 |
17 |
18 | 19 | 438 | 439 | 440 | -------------------------------------------------------------------------------- /tests/assets/umd.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | GanttElastic editor demo 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | modify task
24 | 25 | 26 | 27 |
28 | 29 | 30 |
31 | 38 |
39 | 40 |
41 |
42 | 43 | 476 | 477 | 478 | -------------------------------------------------------------------------------- /tests/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io", 4 | "body": "Fixtures are a great way to mock data for responses to routes" 5 | } -------------------------------------------------------------------------------- /tests/integration/basic_spec.js: -------------------------------------------------------------------------------- 1 | function expectIsMounted(url) { 2 | cy.viewport(1440, 900) 3 | .document() 4 | .then(doc => { 5 | doc.body.innerHtml = ''; 6 | }) 7 | .visit(url, { timeout: 10000 }) 8 | .then(window => { 9 | expect(typeof window.GanttElastic).to.equal('object'); 10 | expect(typeof window.app).to.equal('object'); 11 | }) 12 | .get('.gantt-elastic') 13 | .should('be.visible'); 14 | } 15 | 16 | function expectTimeZoomChange(url) { 17 | cy.viewport(1440, 900) 18 | .document() 19 | .then(doc => { 20 | doc.body.innerHtml = ''; 21 | }) 22 | .visit(url, { timeout: 10000 }) 23 | .then(window => { 24 | const timeZoomSelector = '.gantt-elastic__header-options > label:nth-child(2) .vue-slider-dot'; 25 | const $timeZoom = Cypress.$(timeZoomSelector); 26 | const offset = $timeZoom.offset(); 27 | cy.wrap($timeZoom).as('timeZoom'); 28 | expect(typeof window.app).to.equal('object'); 29 | expect(typeof window.app.$children).to.equal('object'); 30 | const gantt = window.app.$children[0]; 31 | expect(gantt.state.options.times.timeZoom).to.equal(17); 32 | cy.get('@timeZoom').should('be.visible'); 33 | cy.get(timeZoomSelector) 34 | .trigger('mousedown', { which: 1 }) 35 | .trigger('mousemove', { 36 | which: 1, 37 | pageX: offset.left - 14, 38 | pageY: offset.top 39 | }) 40 | .trigger('mouseup', { force: true }) 41 | .wait(100) 42 | .then(() => { 43 | expect(gantt.state.options.times.timeZoom).to.equal(12); 44 | }); 45 | }); 46 | } 47 | 48 | function expectAddTask(url) { 49 | cy.viewport(1440, 900) 50 | .document() 51 | .then(doc => { 52 | doc.body.innerHtml = ''; 53 | }) 54 | .visit(url, { timeout: 10000 }) 55 | .then(window => { 56 | const gantt = window.app.$children[0]; 57 | expect(gantt).to.equal(window.ganttInstance); 58 | expect(gantt.state.tasks.length).to.equal(15); 59 | expect(typeof gantt.getTask).to.equal('function'); 60 | const task = gantt.getTask(7); 61 | expect(task.children.length).to.equal(1); 62 | expect(task.allChildren.length).to.equal(2); 63 | expect(task.children[0]).to.equal(8); 64 | expect(gantt.getTask(2).collapsed).to.equal(true); 65 | expect(gantt.state.options.times.timeZoom).to.equal(17); 66 | gantt.state.options.times.timeZoom = 10; 67 | expect(gantt.state.options.times.timeZoom).to.equal(10); 68 | cy.get( 69 | 'div.gantt-elastic__task-list-items > div:nth-child(2) > div:nth-child(2) > div > div.gantt-elastic__task-list-expander-wrapper > svg' 70 | ) 71 | .click() 72 | .wait(100) 73 | .then(() => { 74 | expect(gantt.getTask(2).collapsed).to.equal(false); 75 | return cy.get('#btn-add'); 76 | }) 77 | .click() 78 | .wait(100) 79 | .then(() => { 80 | const task = gantt.getTask(7); 81 | expect(task.children.length).to.equal(2); 82 | expect(task.allChildren.length).to.equal(3); 83 | expect(task.children[1]).to.equal(88); 84 | expect(gantt.getTask(2).collapsed).to.equal(false); 85 | expect(gantt.state.options.times.timeZoom).to.equal(10); 86 | }); 87 | }); 88 | } 89 | 90 | function expectCollapseExpandTask(url) { 91 | cy.viewport(1440, 900) 92 | .document() 93 | .then(doc => { 94 | doc.body.innerHtml = ''; 95 | }) 96 | .visit(url, { timeout: 10000 }) 97 | .then(window => { 98 | const gantt = window.app.$children[0]; 99 | expect(gantt.state.tasks.length).to.equal(15); 100 | expect(typeof gantt.getTask).to.equal('function'); 101 | const task = gantt.getTask(2); 102 | expect(task.collapsed).to.equal(true); 103 | // get task 2 104 | cy.get( 105 | 'div.gantt-elastic__task-list-items > div:nth-child(2) > div:nth-child(2) > div > div.gantt-elastic__task-list-expander-wrapper > svg' 106 | ) 107 | .click() 108 | .wait(50) 109 | .then(() => { 110 | expect(gantt.getTask(2).collapsed).to.equal(false); 111 | expect(gantt.getTask(7).collapsed).to.equal(true); 112 | // return task 7 113 | return cy.get( 114 | '.gantt-elastic__task-list-items > div:nth-child(4) > div:nth-child(2) > div > div.gantt-elastic__task-list-expander-wrapper > svg' 115 | ); 116 | }) 117 | .click() 118 | .wait(50) 119 | .then(() => { 120 | expect(gantt.getTask(2).collapsed).to.equal(false); 121 | expect(gantt.getTask(7).collapsed).to.equal(false); 122 | expect(gantt.getTask(8).collapsed).to.equal(false); 123 | // return task 7 again 124 | return cy.get( 125 | '.gantt-elastic__task-list-items > div:nth-child(4) > div:nth-child(2) > div > div.gantt-elastic__task-list-expander-wrapper > svg' 126 | ); 127 | }) 128 | .click() 129 | .wait(50) 130 | .then(() => { 131 | expect(gantt.getTask(2).collapsed).to.equal(false); 132 | expect(gantt.getTask(7).collapsed).to.equal(true); 133 | expect(gantt.getTask(8).collapsed).to.equal(false); 134 | // return task 2 135 | return cy.get( 136 | '.gantt-elastic__task-list-items > div:nth-child(2) > div:nth-child(2) > div > div.gantt-elastic__task-list-expander-wrapper > svg' 137 | ); 138 | }) 139 | .click() 140 | .wait(50) 141 | .then(() => { 142 | expect(gantt.getTask(2).collapsed).to.equal(true); 143 | expect(gantt.getTask(7).collapsed).to.equal(true); 144 | expect(gantt.getTask(8).collapsed).to.equal(false); 145 | // return task 2 again 146 | return cy.get( 147 | '.gantt-elastic__task-list-items > div:nth-child(2) > div:nth-child(2) > div > div.gantt-elastic__task-list-expander-wrapper > svg' 148 | ); 149 | }) 150 | .click() 151 | .wait(50) 152 | .then(() => { 153 | expect(gantt.getTask(2).collapsed).to.equal(false); 154 | expect(gantt.getTask(7).collapsed).to.equal(true); 155 | expect(gantt.getTask(8).collapsed).to.equal(false); 156 | }); 157 | }); 158 | } 159 | 160 | const umd = '/tests/assets/umd.html'; 161 | const standalone = '/tests/assets/standalone.html'; 162 | 163 | describe('Basic', () => { 164 | it('should mount gantt-elastic - umd', () => { 165 | expectIsMounted(umd); 166 | }); 167 | it('should mount gantt-elastic - standalone', () => { 168 | expectIsMounted(standalone); 169 | }); 170 | 171 | it('should change time-zoom - umd', () => { 172 | expectTimeZoomChange(umd); 173 | }); 174 | it('should change time-zoom - standalone', () => { 175 | expectTimeZoomChange(standalone); 176 | }); 177 | 178 | it('should add task - umd', () => { 179 | expectAddTask(umd); 180 | }); 181 | it('should add task - standalone', () => { 182 | expectAddTask(standalone); 183 | }); 184 | 185 | it('should collapse and expand task umd', () => { 186 | expectCollapseExpandTask(umd); 187 | }); 188 | it('should collapse and expand task standalone', () => { 189 | expectCollapseExpandTask(standalone); 190 | }); 191 | }); 192 | -------------------------------------------------------------------------------- /tests/plugins/index.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example plugins/index.js can be used to load plugins 3 | // 4 | // You can change the location of this file or turn off loading 5 | // the plugins file with the 'pluginsFile' configuration option. 6 | // 7 | // You can read more here: 8 | // https://on.cypress.io/plugins-guide 9 | // *********************************************************** 10 | 11 | // This function is called when a project is opened or re-opened (e.g. due to 12 | // the project's config changing) 13 | 14 | module.exports = (on, config) => { 15 | // `on` is used to hook into various events Cypress emits 16 | // `config` is the resolved Cypress config 17 | } 18 | -------------------------------------------------------------------------------- /tests/support/commands.js: -------------------------------------------------------------------------------- 1 | // *********************************************** 2 | // This example commands.js shows you how to 3 | // create various custom commands and overwrite 4 | // existing commands. 5 | // 6 | // For more comprehensive examples of custom 7 | // commands please read more here: 8 | // https://on.cypress.io/custom-commands 9 | // *********************************************** 10 | // 11 | // 12 | // -- This is a parent command -- 13 | // Cypress.Commands.add("login", (email, password) => { ... }) 14 | // 15 | // 16 | // -- This is a child command -- 17 | // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) 18 | // 19 | // 20 | // -- This is a dual command -- 21 | // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) 22 | // 23 | // 24 | // -- This is will overwrite an existing command -- 25 | // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) 26 | -------------------------------------------------------------------------------- /tests/support/index.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands'; 18 | // Alternatively you can use CommonJS syntax: 19 | // require('./commands') 20 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const { VueLoaderPlugin } = require('vue-loader'); 3 | const TerserPlugin = require('terser-webpack-plugin'); 4 | 5 | module.exports = [ 6 | { 7 | mode: 'production', 8 | entry: './src/bundle.js', 9 | output: { 10 | path: path.resolve(__dirname, 'dist'), 11 | filename: 'bundle.js' 12 | }, 13 | devtool: 'source-map', 14 | externals: { 15 | vue: 'Vue' 16 | //vuex: 'Vuex' 17 | //dayjs: 'dayjs' 18 | }, 19 | optimization: { 20 | minimize: true, 21 | namedModules: false, 22 | minimizer: [ 23 | new TerserPlugin({ 24 | terserOptions: { 25 | mangle: false 26 | } 27 | }) 28 | ] 29 | }, 30 | /*resolve: { 31 | alias: { 32 | vue$: 'vue/dist/vue.esm.js' 33 | } 34 | },*/ 35 | module: { 36 | rules: [ 37 | { 38 | test: /\.vue$/, 39 | use: 'vue-loader' 40 | }, 41 | { 42 | test: /\.css$/, 43 | use: ['vue-style-loader', 'css-loader'] 44 | } 45 | ] 46 | }, 47 | plugins: [new VueLoaderPlugin()] 48 | }, 49 | { 50 | mode: 'production', 51 | optimization: { 52 | minimize: false, 53 | minimizer: [ 54 | new TerserPlugin({ 55 | terserOptions: { 56 | mangle: false 57 | } 58 | }) 59 | ] 60 | }, 61 | entry: './src/GanttElastic.vue', 62 | output: { 63 | path: path.resolve(__dirname, 'dist'), 64 | filename: 'GanttElastic.umd.js', 65 | library: 'GanttElastic', 66 | libraryTarget: 'umd', 67 | libraryExport: 'default' 68 | }, 69 | devtool: 'source-map', 70 | externals: { 71 | vue: 'Vue' 72 | //vuex: 'Vuex' 73 | //dayjs: 'dayjs' 74 | }, 75 | module: { 76 | rules: [ 77 | { 78 | test: /\.vue$/, 79 | use: 'vue-loader' 80 | }, 81 | { 82 | test: /\.css$/, 83 | use: ['vue-style-loader', 'css-loader'] 84 | } 85 | ] 86 | }, 87 | plugins: [new VueLoaderPlugin()] 88 | }, 89 | { 90 | mode: 'production', 91 | optimization: { 92 | minimize: true, 93 | namedModules: true, 94 | minimizer: [ 95 | new TerserPlugin({ 96 | terserOptions: { 97 | mangle: false 98 | } 99 | }) 100 | ] 101 | }, 102 | entry: './src/GanttElastic.vue', 103 | devtool: 'source-map', 104 | output: { 105 | path: path.resolve(__dirname, 'dist'), 106 | filename: 'GanttElastic.umd.min.js', 107 | library: 'GanttElastic', 108 | libraryTarget: 'umd', 109 | libraryExport: 'default' 110 | }, 111 | externals: { 112 | vue: 'Vue' 113 | //vuex: 'Vuex' 114 | //dayjs: 'dayjs' 115 | }, 116 | module: { 117 | rules: [ 118 | { 119 | test: /\.vue$/, 120 | use: 'vue-loader' 121 | }, 122 | { 123 | test: /\.css$/, 124 | use: ['vue-style-loader', 'css-loader'] 125 | } 126 | ] 127 | }, 128 | plugins: [new VueLoaderPlugin()] 129 | }, 130 | { 131 | mode: 'production', 132 | optimization: { 133 | minimize: false 134 | }, 135 | entry: './src/GanttElastic.vue', 136 | devtool: 'source-map', 137 | output: { 138 | path: path.resolve(__dirname, 'dist'), 139 | filename: 'GanttElastic.common.js', 140 | library: 'GanttElastic', 141 | libraryTarget: 'commonjs2', 142 | libraryExport: 'default' 143 | }, 144 | externals: { 145 | vue: 'Vue' 146 | //vuex: 'Vuex' 147 | //dayjs: 'dayjs' 148 | }, 149 | module: { 150 | rules: [ 151 | { 152 | test: /\.vue$/, 153 | use: 'vue-loader' 154 | }, 155 | { 156 | test: /\.css$/, 157 | use: ['vue-style-loader', 'css-loader'] 158 | } 159 | ] 160 | }, 161 | plugins: [new VueLoaderPlugin()] 162 | }, 163 | { 164 | mode: 'production', 165 | optimization: { 166 | minimize: true, 167 | namedModules: true, 168 | minimizer: [ 169 | new TerserPlugin({ 170 | terserOptions: { 171 | mangle: false 172 | } 173 | }) 174 | ] 175 | }, 176 | entry: './src/GanttElastic.vue', 177 | devtool: 'source-map', 178 | output: { 179 | path: path.resolve(__dirname, 'dist'), 180 | filename: 'GanttElastic.common.min.js', 181 | library: 'GanttElastic', 182 | libraryTarget: 'commonjs2', 183 | libraryExport: 'default' 184 | }, 185 | externals: { 186 | vue: 'Vue' 187 | //vuex: 'Vuex' 188 | //dayjs: 'dayjs' 189 | }, 190 | module: { 191 | rules: [ 192 | { 193 | test: /\.vue$/, 194 | use: 'vue-loader' 195 | }, 196 | { 197 | test: /\.css$/, 198 | use: ['vue-style-loader', 'css-loader'] 199 | } 200 | ] 201 | }, 202 | plugins: [new VueLoaderPlugin()] 203 | } 204 | ]; 205 | -------------------------------------------------------------------------------- /webpack.dev.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const { VueLoaderPlugin } = require('vue-loader'); 3 | 4 | module.exports = { 5 | /*devServer: { 6 | publicPath: path.join(__dirname, 'dist'), 7 | compress: false, 8 | port: 9000, 9 | openPage: '/examples/vue.edit.html' 10 | },*/ 11 | devtool: 'inline-source-map', 12 | mode: 'development', 13 | entry: './src/GanttElastic.vue', 14 | output: { 15 | path: path.resolve(__dirname, 'dist'), 16 | filename: 'GanttElastic.umd.js', 17 | library: 'GanttElastic', 18 | libraryTarget: 'umd', 19 | libraryExport: 'default' 20 | }, 21 | externals: ['vue'], 22 | resolve: { 23 | alias: { 24 | vue$: 'vue/dist/vue.esm.js' 25 | } 26 | }, 27 | module: { 28 | rules: [ 29 | { 30 | test: /\.vue$/, 31 | use: 'vue-loader' 32 | }, 33 | { 34 | test: /\.css$/, 35 | use: ['vue-style-loader', 'css-loader'] 36 | } 37 | ] 38 | }, 39 | plugins: [new VueLoaderPlugin()] 40 | }; 41 | --------------------------------------------------------------------------------