├── .gitignore ├── LICENSE ├── README.md ├── babel.config.js ├── package-lock.json ├── package.json ├── public ├── favicon.ico └── index.html └── src ├── App.vue ├── components ├── OrganizationChartContainer.vue ├── OrganizationChartNode.vue └── index.js └── main.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw* 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Xuebin Dong 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 | ![OrgChart](http://dabeng.github.io/OrgChart/img/heading.svg) 2 | 3 | # [jQuery Version](https://github.com/dabeng/OrgChart) 4 | # [ES6 Version](http://github.com/dabeng/OrgChart.js) 5 | # [Web Components Version](http://github.com/dabeng/OrgChart-Webcomponents) 6 | # [Angular Version -- the most space-saving solution](https://github.com/dabeng/ng-orgchart) 7 | # [React Version](https://github.com/dabeng/react-orgchart) 8 | 9 | ## Foreword 10 | - First of all, thanks a lot for [wesnolte](https://github.com/wesnolte)'s great work:blush: -- [jOrgChart](https://github.com/wesnolte/jOrgChart). The thought that using nested tables to build out the tree-like orgonization chart is amazing. This idea is more simple and direct than its counterparts based on svg 11 | - Unfortunately, it's long time not to see the update of jOrgChart. on the other hand, I got some interesting ideas to add, so I choose to create a new repo. 12 | 13 | ## Features 14 | - For now, just static organization chart 15 | 16 | # Installation 17 | ``` 18 | npm install vue-organization-chart -S 19 | ``` 20 | # [Demos](https://codesandbox.io/dashboard/sandboxes/Vue%20OrgChart) 21 | 22 | # Usage 23 | ```html 24 | 29 | 30 | 66 | ``` 67 | 68 | # Attributes 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 |
NameTypeRequiredDefaultDescription
datasourcejsonyesdatasource usded to build out structure of orgchart. It could be a json object.
panbooleannofalseUsers could pan the orgchart by mouse drag&drop if they enable this attribute.
zoombooleannofalseUsers could zoomin/zoomout the orgchart by mouse wheel if they enable this attribute.
zoomin-limitnumberno7Users are allowed to set a zoom-in limit.
zoomout-limitnumberno0.5Users are allowed to set a zoom-out limit.
91 | 92 | # Events 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 |
NameParametersDescription
node-clicknode datatriggers when user clicks the node.
103 | 104 | # Scoped Slots 105 | ```html 106 | 109 | ``` 110 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-organization-chart", 3 | "version": "1.1.6", 4 | "description": "organization chart component based vuejs", 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "build-component": "vue-cli-service build --target lib --name orgchart ./src/components/index.js", 9 | "lint": "vue-cli-service lint" 10 | }, 11 | "main": "./dist/orgchart.umd.min.js", 12 | "files": [ 13 | "dist" 14 | ], 15 | "repository": { 16 | "type": "git", 17 | "url": "https://github.com/dabeng/vue-orgchart.git" 18 | }, 19 | "keywords": [ 20 | "vuejs", 21 | "organization", 22 | "chart", 23 | "orgchart", 24 | "tree", 25 | "tree-like", 26 | "tree-view" 27 | ], 28 | "author": "dabeng ", 29 | "license": "MIT", 30 | "dependencies": { 31 | "jquery": "^3.3.1", 32 | "vue": "^2.5.17" 33 | }, 34 | "devDependencies": { 35 | "@vue/cli-plugin-babel": "^3.0.4", 36 | "@vue/cli-plugin-eslint": "^3.0.4", 37 | "@vue/cli-service": "^3.0.4", 38 | "vue-template-compiler": "^2.5.17" 39 | }, 40 | "eslintConfig": { 41 | "root": true, 42 | "env": { 43 | "node": true 44 | }, 45 | "extends": [ 46 | "plugin:vue/essential", 47 | "eslint:recommended" 48 | ], 49 | "rules": {}, 50 | "parserOptions": { 51 | "parser": "babel-eslint" 52 | } 53 | }, 54 | "postcss": { 55 | "plugins": { 56 | "autoprefixer": {} 57 | } 58 | }, 59 | "browserslist": [ 60 | "> 1%", 61 | "last 2 versions", 62 | "not ie <= 8" 63 | ] 64 | } 65 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dabeng/vue-orgchart/a5999f29a5503e2cbe5927e243e4a0411a2b1cce/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | vue-orgchart 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 51 | 52 | 61 | -------------------------------------------------------------------------------- /src/components/OrganizationChartContainer.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 163 | 164 | 615 | -------------------------------------------------------------------------------- /src/components/OrganizationChartNode.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 56 | 57 | 59 | -------------------------------------------------------------------------------- /src/components/index.js: -------------------------------------------------------------------------------- 1 | import OrgChart from './OrganizationChartContainer.vue' 2 | 3 | OrgChart.install = (Vue) => { 4 | Vue.component('OrgChart', OrgChart) 5 | } 6 | 7 | export default OrgChart 8 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | 4 | Vue.config.productionTip = false 5 | 6 | new Vue({ 7 | render: h => h(App) 8 | }).$mount('#app') 9 | --------------------------------------------------------------------------------