Merge pull request #867 from serdarketenci/dev
adding vue-js-org-chart sample
This commit is contained in:
commit
586880c41e
|
@ -0,0 +1,25 @@
|
||||||
|
# EditorConfig helps developers define and maintain consistent
|
||||||
|
# coding styles between different editors and IDEs
|
||||||
|
# editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
|
||||||
|
[*]
|
||||||
|
|
||||||
|
# change these settings to your own preference
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
# we recommend you to keep these unchanged
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[{package,bower}.json]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
|
@ -0,0 +1,32 @@
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# Build generated files
|
||||||
|
dist
|
||||||
|
lib
|
||||||
|
solution
|
||||||
|
temp
|
||||||
|
*.sppkg
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# OSX
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Visual Studio files
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
.vs
|
||||||
|
bin
|
||||||
|
obj
|
||||||
|
|
||||||
|
# Resx Generated Code
|
||||||
|
*.resx.ts
|
||||||
|
|
||||||
|
# Styles Generated Code
|
||||||
|
*.scss.ts
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"@microsoft/generator-sharepoint": {
|
||||||
|
"version": "1.8.1",
|
||||||
|
"libraryName": "vue-js-org-chart",
|
||||||
|
"libraryId": "6d311b84-a90e-4090-b632-f4c87624d2f4",
|
||||||
|
"environment": "spo",
|
||||||
|
"packageManager": "npm",
|
||||||
|
"framework": "none",
|
||||||
|
"isCreatingSolution": true,
|
||||||
|
"isDomainIsolated": false,
|
||||||
|
"componentType": "webpart"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
## vue-js-org-chart
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
A simple Organisation Chart webpart using Office UI Fabric, VueJS, REST API.
|
||||||
|
|
||||||
|
![React Org Chart](./assets/preview.gif)
|
||||||
|
|
||||||
|
|
||||||
|
## Used SharePoint Framework Version
|
||||||
|
![drop](https://img.shields.io/badge/drop-GA-green.svg)
|
||||||
|
|
||||||
|
## Applies to
|
||||||
|
|
||||||
|
* [SharePoint Framework](http://dev.office.com/sharepoint/docs/spfx/sharepoint-framework-overview)
|
||||||
|
* [Office 365 developer tenant](http://dev.office.com/sharepoint/docs/spfx/set-up-your-developer-tenant)
|
||||||
|
|
||||||
|
** The SPFx webpart will work in local workbench, but not the assets. They can be provisioned only when the app is deployed since they are SharePoint specific.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Office 365 subscription with SharePoint Online.
|
||||||
|
- SharePoint Framework [development environment](https://dev.office.com/sharepoint/docs/spfx/set-up-your-development-environment) already set up.
|
||||||
|
- Tenant admin access to the Office 365 subscription and [App Catalog](https://support.office.com/en-ie/article/Use-the-App-Catalog-to-make-custom-business-apps-available-for-your-SharePoint-Online-environment-0b6ab336-8b83-423f-a06b-bcc52861cba0) already setup.
|
||||||
|
|
||||||
|
|
||||||
|
## Disclaimer
|
||||||
|
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Minimal Path to Awesome
|
||||||
|
|
||||||
|
- Clone this repository.
|
||||||
|
- Open the command line, navigate to the web part folder and execute:
|
||||||
|
- `npm i`
|
||||||
|
- `gulp serve --nobrowser`
|
||||||
|
- `gulp package-solution`
|
||||||
|
- [Deploy the package](https://dev.office.com/sharepoint/docs/spfx/enterprise-guidance#management-capabilities-of--sharepoint-framework-solutions) to the app catalog
|
||||||
|
- [Add the app](https://support.office.com/en-ie/article/Add-an-app-to-a-site-ef9c0dbd-7fe1-4715-a1b0-fe3bc81317cb?ui=en-US&rs=en-IE&ad=IE) to a site
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
This Web Part illustrates the following concepts on top of the SharePoint Framework:
|
||||||
|
|
||||||
|
- SPFx provisioning based on the following Elements.xml nodes:
|
||||||
|
- Custom List Instance with custom list schema.
|
||||||
|
- Content Types.
|
||||||
|
- Fields.
|
||||||
|
- Pre-populated List Data Rows in the Elements.xml.
|
Binary file not shown.
After Width: | Height: | Size: 2.1 MiB |
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
|
||||||
|
"version": "2.0",
|
||||||
|
"bundles": {
|
||||||
|
"org-chart-web-part": {
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"entrypoint": "./lib/webparts/orgChart/OrgChartWebPart.js",
|
||||||
|
"manifest": "./src/webparts/orgChart/OrgChartWebPart.manifest.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"externals": {
|
||||||
|
"vue": "./node_modules/vue/dist/vue.min.js",
|
||||||
|
"spOrgChart": {
|
||||||
|
"path": "./src/webparts/orgChart/plugins/orgchart.js",
|
||||||
|
"globalName": "spOrgChart"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"localizedResources": {
|
||||||
|
"OrgChartWebPartStrings": "lib/webparts/orgChart/loc/{locale}.js"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json",
|
||||||
|
"deployCdnPath": "temp/deploy"
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"includeExtensions": [
|
||||||
|
"vue"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
|
||||||
|
"workingDir": "./temp/deploy/",
|
||||||
|
"account": "<!-- STORAGE ACCOUNT NAME -->",
|
||||||
|
"container": "vue-js-org-chart",
|
||||||
|
"accessKey": "<!-- ACCESS KEY -->"
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
|
||||||
|
"solution": {
|
||||||
|
"name": "vue-js-org-chart-client-side-solution",
|
||||||
|
"id": "6d311b84-a90e-4090-b632-f4c87624d2f4",
|
||||||
|
"version": "1.0.0.0",
|
||||||
|
"features": [
|
||||||
|
{
|
||||||
|
"title": "provision-employees-list-client-side-solution",
|
||||||
|
"description": "provision-employees-list-client-side-solution",
|
||||||
|
"id": "ce98fa61-31a7-41de-98d9-90feb2c5dc96",
|
||||||
|
"version": "1.0.0.0",
|
||||||
|
"assets": {
|
||||||
|
"elementManifests": [
|
||||||
|
"elements.xml"
|
||||||
|
],
|
||||||
|
"elementFiles": [
|
||||||
|
"schema.xml"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"includeClientSideAssets": true,
|
||||||
|
"skipFeatureDeployment": false,
|
||||||
|
"isDomainIsolated": false
|
||||||
|
},
|
||||||
|
"paths": {
|
||||||
|
"zippedPackage": "solution/vue-js-org-chart.sppkg"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
|
||||||
|
"port": 4321,
|
||||||
|
"https": true,
|
||||||
|
"initialPage": "https://localhost:5432/workbench",
|
||||||
|
"api": {
|
||||||
|
"port": 5432,
|
||||||
|
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
|
||||||
|
"cdnBasePath": "<!-- PATH TO CDN -->"
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
// check if gulp dist was called
|
||||||
|
if (process.argv.indexOf('dist') !== -1) {
|
||||||
|
// add ship options to command call
|
||||||
|
process.argv.push('--ship');
|
||||||
|
}
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const gulp = require('gulp');
|
||||||
|
const build = require('@microsoft/sp-build-web');
|
||||||
|
const gulpSequence = require('gulp-sequence');
|
||||||
|
|
||||||
|
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
|
||||||
|
|
||||||
|
// Create clean distrubution package
|
||||||
|
gulp.task('dist', gulpSequence('clean', 'bundle', 'package-solution'));
|
||||||
|
// Create clean development package
|
||||||
|
gulp.task('dev', gulpSequence('clean', 'bundle', 'package-solution'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom Framework Specific gulp tasks
|
||||||
|
*/
|
||||||
|
// Merge custom loader to web pack configuration
|
||||||
|
|
||||||
|
const VueLoaderPlugin = require('vue-loader/lib/plugin');
|
||||||
|
const vuePlugin = new VueLoaderPlugin();
|
||||||
|
const themedStyleLoader = require.resolve('@microsoft/loader-load-themed-styles');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
build.configureWebpack.mergeConfig({
|
||||||
|
|
||||||
|
additionalConfiguration: (generatedConfiguration) => {
|
||||||
|
|
||||||
|
const loadersConfigs = [{
|
||||||
|
test: /\.vue$/, // vue
|
||||||
|
use: [{
|
||||||
|
loader: 'vue-loader'
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
resourceQuery: /vue&type=script&lang=ts/, // typescript
|
||||||
|
loader: 'ts-loader',
|
||||||
|
options: {
|
||||||
|
appendTsSuffixTo: [/\.vue$/],
|
||||||
|
transpileOnly: true
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
resourceQuery: /vue&type=style.*&lang=scss/, // scss
|
||||||
|
use: [{
|
||||||
|
loader: themedStyleLoader,
|
||||||
|
options: {
|
||||||
|
async: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'css-loader',
|
||||||
|
options: {
|
||||||
|
modules: true,
|
||||||
|
localIdentName: '[local]_[sha1:hash:hex:8]'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'sass-loader'
|
||||||
|
]
|
||||||
|
}];
|
||||||
|
|
||||||
|
generatedConfiguration.plugins.push(vuePlugin);
|
||||||
|
|
||||||
|
generatedConfiguration.module.rules.push(...loadersConfigs);
|
||||||
|
|
||||||
|
return generatedConfiguration;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// register custom watch for Vue.JS files
|
||||||
|
// copy of '.vue' files will be handled by 'copy-static-assets.json'
|
||||||
|
gulp.watch('./src/**/*.vue', event => {
|
||||||
|
// copy empty index.ts onto itself to launch build procees
|
||||||
|
gulp.src('./src/index.ts')
|
||||||
|
.pipe(gulp.dest('./src/'));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
build.initialize(gulp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Continuous Integration
|
||||||
|
*/
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
"name": "vue-js-org-chart",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"private": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "gulp bundle",
|
||||||
|
"clean": "gulp clean",
|
||||||
|
"test": "gulp test",
|
||||||
|
"preversion": "node ./tools/pre-version.js",
|
||||||
|
"postversion": "gulp dist"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@microsoft/sp-core-library": "1.8.1",
|
||||||
|
"@microsoft/sp-lodash-subset": "1.8.1",
|
||||||
|
"@microsoft/sp-office-ui-fabric-core": "1.8.1",
|
||||||
|
"@microsoft/sp-property-pane": "1.8.1",
|
||||||
|
"@microsoft/sp-webpart-base": "1.8.1",
|
||||||
|
"@pnp/common": "^1.3.2",
|
||||||
|
"@pnp/logging": "^1.3.2",
|
||||||
|
"@pnp/odata": "^1.3.2",
|
||||||
|
"@pnp/sp": "^1.3.2",
|
||||||
|
"@types/es6-promise": "0.0.33",
|
||||||
|
"@types/webpack-env": "1.13.1",
|
||||||
|
"office-ui-fabric-vue": "^1.2.0",
|
||||||
|
"vue": "^2.6.10",
|
||||||
|
"vue-class-component": "^7.0.2",
|
||||||
|
"vue-property-decorator": "^8.1.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@microsoft/rush-stack-compiler-2.7": "0.4.0",
|
||||||
|
"@microsoft/sp-build-web": "1.8.1",
|
||||||
|
"@microsoft/sp-module-interfaces": "1.8.1",
|
||||||
|
"@microsoft/sp-tslint-rules": "1.8.1",
|
||||||
|
"@microsoft/sp-webpart-workbench": "1.8.1",
|
||||||
|
"@types/chai": "3.4.34",
|
||||||
|
"@types/mocha": "2.2.38",
|
||||||
|
"ajv": "~5.2.2",
|
||||||
|
"fork-ts-checker-webpack-plugin": "^1.0.3",
|
||||||
|
"gulp": "~3.9.1",
|
||||||
|
"gulp-sequence": "1.0.0",
|
||||||
|
"karma-junit-reporter": "^1.2.0",
|
||||||
|
"sass-loader": "^7.1.0",
|
||||||
|
"ts-loader": "^5.3.3",
|
||||||
|
"vue-loader": "^15.7.0",
|
||||||
|
"vue-template-compiler": "^2.6.10"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
|
||||||
|
|
||||||
|
<Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Type="Text" Name="Title" DisplayName="$Resources:core,Title;" Required="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" MaxLength="255" />
|
||||||
|
<Field Name="ManagerID" ID="{cc01bddf-1b19-4214-861d-45aa39cb707b}" DisplayName="Manager" Type="Lookup" List="Lists/Employees" ShowField="Title" />
|
||||||
|
<Field Name="PhotoUrl" ID="{6346c3e1-4866-4bc8-855a-cd74e3d1fb2a}" DisplayName="Photo URL" Type="Text" />
|
||||||
|
<Field ID="{c4e0f350-52cc-4ede-904c-dd71a3d11f7d}" Name="JobTitle" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="JobTitle" Group="$Resources:core,Person_Event_Columns;" DisplayName="$Resources:core,Job_Title;" Type="Text" />
|
||||||
|
<Field ID="{C814B2CF-84C6-4f56-B4A4-C766938A97C5}" Name="ol_Department" StaticName="ol_Department" SourceID="http://schemas.microsoft.com/sharepoint/v3" DisplayName="$Resources:core,Department_OL;" Group="$Resources:core,Person_Event_Columns;" Type="Text" Sealed="TRUE" AllowDeletion="TRUE" />
|
||||||
|
<Field ID="{26169AB2-4BD2-4870-B077-10F49C8A5822}" Name="Office" StaticName="Office" SourceID="http://schemas.microsoft.com/sharepoint/v3" DisplayName="$Resources:core,Office_OL;" Group="$Resources:core,Person_Event_Columns;" Type="Text" Sealed="TRUE" AllowDeletion="TRUE" />
|
||||||
|
<Field ID="{fd630629-c165-4513-b43c-fdb16b86a14d}" Name="WorkPhone" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="WorkPhone" Group="$Resources:core,Person_Event_Columns;" DisplayName="$Resources:core,Business_Phone;" Type="Text" IMEMode="inactive" />
|
||||||
|
<Field ID="{fce16b4c-fe53-4793-aaab-b4892e736d15}" Name="EMail" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="EMail" Group="$Resources:core,Person_Event_Columns;" DisplayName="$Resources:core,E-Mail;" ReadOnly="FALSE" Type="Text" FromBaseType="TRUE" AllowDeletion="TRUE" />
|
||||||
|
|
||||||
|
<ContentType ID="0x01008b18f3d769d4440f96e903ad1c086192" Name="EmployeeContentType" Group="Employee Content Types" Description="This is the Content Type for Employee Onboarding">
|
||||||
|
<FieldRefs>
|
||||||
|
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" />
|
||||||
|
<FieldRef ID="{cc01bddf-1b19-4214-861d-45aa39cb707b}" Name="ManagerID" />
|
||||||
|
<FieldRef ID="{6346c3e1-4866-4bc8-855a-cd74e3d1fb2a}" Name="PhotoUrl" />
|
||||||
|
<FieldRef ID="{c4e0f350-52cc-4ede-904c-dd71a3d11f7d}" Name="JobTitle" />
|
||||||
|
<FieldRef ID="{C814B2CF-84C6-4f56-B4A4-C766938A97C5}" Name="ol_Department" />
|
||||||
|
<FieldRef ID="{26169AB2-4BD2-4870-B077-10F49C8A5822}" Name="Office" />
|
||||||
|
<FieldRef ID="{fd630629-c165-4513-b43c-fdb16b86a14d}" Name="WorkPhone" />
|
||||||
|
<FieldRef ID="{fce16b4c-fe53-4793-aaab-b4892e736d15}" Name="EMail" />
|
||||||
|
</FieldRefs>
|
||||||
|
</ContentType>
|
||||||
|
<ListInstance CustomSchema="schema.xml" FeatureId="00bfea71-de22-43b2-a848-c05709900100" Title="Employees" Description="Employees List" TemplateType="100" Url="Lists/Employees">
|
||||||
|
<Data>
|
||||||
|
<Rows>
|
||||||
|
<Row>
|
||||||
|
<Field Name="Title">Serdar Ketenci</Field>
|
||||||
|
<Field Name="ManagerID"></Field>
|
||||||
|
<Field Name="PhotoUrl"></Field>
|
||||||
|
<Field Name="JobTitle">Tech Lead</Field>
|
||||||
|
<Field Name="ol_Department">SharePoint</Field>
|
||||||
|
<Field Name="Office">YTU</Field>
|
||||||
|
<Field Name="WorkPhone">545 871 7767</Field>
|
||||||
|
<Field Name="EMail">sketenci@nuevo.com.tr</Field>
|
||||||
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<Field Name="Title">Ahmet Örnekadam</Field>
|
||||||
|
<Field Name="ManagerID">1</Field>
|
||||||
|
<Field Name="PhotoUrl"></Field>
|
||||||
|
<Field Name="JobTitle">Senior Developer</Field>
|
||||||
|
<Field Name="ol_Department">SharePoint</Field>
|
||||||
|
<Field Name="Office">YTU</Field>
|
||||||
|
<Field Name="WorkPhone">545 777 7767</Field>
|
||||||
|
<Field Name="EMail">aornekadam@nuevo.com.tr</Field>
|
||||||
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<Field Name="Title">Yeliz Kurt</Field>
|
||||||
|
<Field Name="ManagerID">1</Field>
|
||||||
|
<Field Name="PhotoUrl"></Field>
|
||||||
|
<Field Name="JobTitle">Senior Developer</Field>
|
||||||
|
<Field Name="ol_Department">SharePoint</Field>
|
||||||
|
<Field Name="Office">YTU</Field>
|
||||||
|
<Field Name="WorkPhone">545 888 7767</Field>
|
||||||
|
<Field Name="EMail">ykurt@nuevo.com.tr</Field>
|
||||||
|
</Row>
|
||||||
|
</Rows>
|
||||||
|
</Data> </ListInstance>
|
||||||
|
</Elements>
|
|
@ -0,0 +1,33 @@
|
||||||
|
<List xmlns:ows="Microsoft SharePoint" Title="Employees" EnableContentTypes="TRUE" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/Employees" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/">
|
||||||
|
<MetaData>
|
||||||
|
<ContentTypes>
|
||||||
|
<ContentTypeRef ID="0x01008b18f3d769d4440f96e903ad1c086192" /> </ContentTypes>
|
||||||
|
<Fields></Fields>
|
||||||
|
<Views>
|
||||||
|
<View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
|
||||||
|
<XslLink Default="TRUE">main.xsl</XslLink>
|
||||||
|
<JSLink>clienttemplates.js</JSLink>
|
||||||
|
<RowLimit Paged="TRUE">30</RowLimit>
|
||||||
|
<Toolbar Type="Standard" />
|
||||||
|
<ViewFields>
|
||||||
|
<FieldRef Name="LinkTitle"></FieldRef>
|
||||||
|
<FieldRef Name="ManagerID" />
|
||||||
|
<FieldRef Name="PhotoUrl" />
|
||||||
|
<FieldRef Name="JobTitle" />
|
||||||
|
<FieldRef Name="ol_Department" />
|
||||||
|
<FieldRef Name="Office" />
|
||||||
|
<FieldRef Name="WorkPhone" />
|
||||||
|
<FieldRef Name="EMail" />
|
||||||
|
</ViewFields>
|
||||||
|
<Query>
|
||||||
|
<OrderBy>
|
||||||
|
<FieldRef Name="ID" /> </OrderBy>
|
||||||
|
</Query>
|
||||||
|
</View>
|
||||||
|
</Views>
|
||||||
|
<Forms>
|
||||||
|
<Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
|
||||||
|
<Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
|
||||||
|
<Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" /> </Forms>
|
||||||
|
</MetaData>
|
||||||
|
</List>
|
|
@ -0,0 +1 @@
|
||||||
|
// A file is required to be in the root of the /src directory by the TypeScript compiler
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
|
||||||
|
"id": "2c273b4d-6f7a-44a9-afc0-22e3282a6002",
|
||||||
|
"alias": "OrgChartWebPart",
|
||||||
|
"componentType": "WebPart",
|
||||||
|
|
||||||
|
// The "*" signifies that the version should be taken from the package.json
|
||||||
|
"version": "*",
|
||||||
|
"manifestVersion": 2,
|
||||||
|
|
||||||
|
// If true, the component can only be installed on sites where Custom Script is allowed.
|
||||||
|
// Components that allow authors to embed arbitrary script code should set this to true.
|
||||||
|
// https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
|
||||||
|
"requiresCustomScript": false,
|
||||||
|
"supportedHosts": ["SharePointWebPart"],
|
||||||
|
|
||||||
|
"preconfiguredEntries": [{
|
||||||
|
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
|
||||||
|
"group": { "default": "Other" },
|
||||||
|
"title": { "default": "OrgChart" },
|
||||||
|
"description": { "default": "OrgChart description" },
|
||||||
|
"officeFabricIconFontName": "Page",
|
||||||
|
"properties": {
|
||||||
|
"description": "OrgChart"
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
import { Version } from '@microsoft/sp-core-library';
|
||||||
|
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
|
||||||
|
import {
|
||||||
|
IPropertyPaneConfiguration,
|
||||||
|
PropertyPaneTextField
|
||||||
|
} from '@microsoft/sp-property-pane';
|
||||||
|
|
||||||
|
import * as strings from 'OrgChartWebPartStrings';
|
||||||
|
|
||||||
|
// Importing Vue.js
|
||||||
|
import Vue from 'vue';
|
||||||
|
// Improting Vue.js SFC
|
||||||
|
import OrgChartComponent from './components/OrgChart.vue';
|
||||||
|
|
||||||
|
import OfficeUIFabricVue from 'office-ui-fabric-vue';
|
||||||
|
|
||||||
|
// import css style
|
||||||
|
import 'office-ui-fabric-vue/dist/index.css';
|
||||||
|
import OrgChartService from './services/OrgChartService';
|
||||||
|
import { setup as pnpSetup } from "@pnp/common";
|
||||||
|
|
||||||
|
export interface IOrgChartWebPartProps {
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class OrgChartWebPart extends BaseClientSideWebPart<IOrgChartWebPartProps> {
|
||||||
|
|
||||||
|
public onInit(): Promise<void> {
|
||||||
|
|
||||||
|
return super.onInit().then(_ => {
|
||||||
|
pnpSetup({spfxContext: this.context});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(): void {
|
||||||
|
const id: string = `wp-${this.instanceId}`;
|
||||||
|
this.domElement.innerHTML = `<div id="${id}"></div>`;
|
||||||
|
|
||||||
|
Vue.use(OfficeUIFabricVue);
|
||||||
|
|
||||||
|
let el = new Vue({
|
||||||
|
el: `#${id}`,
|
||||||
|
render: h => h(OrgChartComponent, {
|
||||||
|
props: {
|
||||||
|
spService: OrgChartService
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected get dataVersion(): Version {
|
||||||
|
return Version.parse('1.0');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
|
||||||
|
return {
|
||||||
|
pages: [
|
||||||
|
{
|
||||||
|
header: {
|
||||||
|
description: strings.PropertyPaneDescription
|
||||||
|
},
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
groupName: strings.BasicGroupName,
|
||||||
|
groupFields: [
|
||||||
|
PropertyPaneTextField('description', {
|
||||||
|
label: strings.DescriptionFieldLabel
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,164 @@
|
||||||
|
<template>
|
||||||
|
<div :class="$style.OrgChart">
|
||||||
|
<div :class="$style.container">
|
||||||
|
<div :class="$style.row">
|
||||||
|
<div :class="$style.column">
|
||||||
|
<div v-if="error">
|
||||||
|
Error: {{error.message}}
|
||||||
|
</div>
|
||||||
|
<ou-spinner v-if="isLoading" type='large' />
|
||||||
|
<div id="tree">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Vue, Component, Prop } from "vue-property-decorator";
|
||||||
|
import { IListService } from "../models/IListService";
|
||||||
|
import Employee from "../models/Employee";
|
||||||
|
|
||||||
|
require("spOrgChart");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component's properties
|
||||||
|
*/
|
||||||
|
export interface IOrgChartProps {
|
||||||
|
spService: IListService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class-component
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
export default class OrgChart extends Vue implements IOrgChartProps {
|
||||||
|
/**
|
||||||
|
* implementing ISimpleWebPartProps interface
|
||||||
|
*/
|
||||||
|
@Prop()
|
||||||
|
public spService: IListService;
|
||||||
|
|
||||||
|
public error?: Error;
|
||||||
|
public isLoading:boolean;
|
||||||
|
public employees:Employee[];
|
||||||
|
|
||||||
|
_getEmployeeItems() {
|
||||||
|
this.spService.getEmployees().then((employees: Employee[]) => {
|
||||||
|
this.isLoading = false;
|
||||||
|
this.employees = employees;
|
||||||
|
this.initiliazeOrgChart(employees);
|
||||||
|
}).catch((err: Error) => {
|
||||||
|
this.isLoading= false;
|
||||||
|
this.error= err;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
initiliazeOrgChart(employees: Employee[]) {
|
||||||
|
var el: any = document.getElementById("tree");
|
||||||
|
if (el) {
|
||||||
|
var chart = new window["OrgChart"](el, {
|
||||||
|
template: "rony",
|
||||||
|
enableSearch: true,
|
||||||
|
nodeBinding: {
|
||||||
|
field_0: "Title",
|
||||||
|
field_1: "JobTitle",
|
||||||
|
field_2: "EMail",
|
||||||
|
img_0: "PhotoUrl"
|
||||||
|
},
|
||||||
|
nodes: employees
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(){
|
||||||
|
this.isLoading = true;
|
||||||
|
this.employees = new Array<Employee>();
|
||||||
|
}
|
||||||
|
|
||||||
|
created(){
|
||||||
|
this._getEmployeeItems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" module>
|
||||||
|
@import "~@microsoft/sp-office-ui-fabric-core/dist/sass/_SPFabricCore.scss";
|
||||||
|
|
||||||
|
.OrgChart {
|
||||||
|
.container {
|
||||||
|
max-width: 700px;
|
||||||
|
margin: 0px auto;
|
||||||
|
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
@include ms-Grid-row;
|
||||||
|
@include ms-fontColor-white;
|
||||||
|
background-color: $ms-color-themeDark;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.column {
|
||||||
|
@include ms-Grid-col;
|
||||||
|
@include ms-lg10;
|
||||||
|
@include ms-xl8;
|
||||||
|
@include ms-xlPush2;
|
||||||
|
@include ms-lgPush1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
@include ms-font-xl;
|
||||||
|
@include ms-fontColor-white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subTitle {
|
||||||
|
@include ms-font-l;
|
||||||
|
@include ms-fontColor-white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.description {
|
||||||
|
@include ms-font-l;
|
||||||
|
@include ms-fontColor-white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
// Our button
|
||||||
|
text-decoration: none;
|
||||||
|
height: 32px;
|
||||||
|
|
||||||
|
// Primary Button
|
||||||
|
min-width: 80px;
|
||||||
|
background-color: $ms-color-themePrimary;
|
||||||
|
border-color: $ms-color-themePrimary;
|
||||||
|
color: $ms-color-white;
|
||||||
|
|
||||||
|
// Basic Button
|
||||||
|
outline: transparent;
|
||||||
|
position: relative;
|
||||||
|
font-family: "Segoe UI WestEuropean", "Segoe UI", -apple-system,
|
||||||
|
BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
font-size: $ms-font-size-m;
|
||||||
|
font-weight: $ms-font-weight-regular;
|
||||||
|
border-width: 0;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0 16px;
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-weight: $ms-font-weight-semibold;
|
||||||
|
font-size: $ms-font-size-m;
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
margin: 0 4px;
|
||||||
|
vertical-align: top;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
define([], function() {
|
||||||
|
return {
|
||||||
|
"PropertyPaneDescription": "Description",
|
||||||
|
"BasicGroupName": "Group Name",
|
||||||
|
"DescriptionFieldLabel": "Description Field"
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,10 @@
|
||||||
|
declare interface IOrgChartWebPartStrings {
|
||||||
|
PropertyPaneDescription: string;
|
||||||
|
BasicGroupName: string;
|
||||||
|
DescriptionFieldLabel: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'OrgChartWebPartStrings' {
|
||||||
|
const strings: IOrgChartWebPartStrings;
|
||||||
|
export = strings;
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
export default class Constants {
|
||||||
|
public static readonly EMPLOYEES_LIST_TITLE = "Employees";
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
export default class Employee {
|
||||||
|
id: number;
|
||||||
|
Title: string;
|
||||||
|
JobTitle: string;
|
||||||
|
PhotoUrl: string;
|
||||||
|
EMail: string;
|
||||||
|
Phone: string;
|
||||||
|
pid?: number; // Manager Id
|
||||||
|
|
||||||
|
constructor(options: Employee) {
|
||||||
|
this.id = options.id;
|
||||||
|
this.Title = options.Title;
|
||||||
|
this.JobTitle = options.JobTitle;
|
||||||
|
this.PhotoUrl = options.PhotoUrl;
|
||||||
|
this.EMail = options.EMail;
|
||||||
|
this.Phone = options.Phone;
|
||||||
|
this.pid = options.pid;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
import Employee from "./Employee";
|
||||||
|
|
||||||
|
export interface IListService {
|
||||||
|
getEmployees(): Promise<Array<Employee>>;
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,47 @@
|
||||||
|
import Employee from '../models/Employee';
|
||||||
|
import { IListService } from '../models/IListService';
|
||||||
|
import { sp } from '@pnp/sp';
|
||||||
|
import Constants from '../models/Constants';
|
||||||
|
|
||||||
|
export class OrgChartService implements IListService {
|
||||||
|
|
||||||
|
private static instance: OrgChartService;
|
||||||
|
|
||||||
|
private constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static getInstance() {
|
||||||
|
if (!OrgChartService.instance) {
|
||||||
|
OrgChartService.instance = new OrgChartService();
|
||||||
|
}
|
||||||
|
return OrgChartService.instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
getEmployees(): Promise<Array<Employee>> {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
sp.web.lists.getByTitle(Constants.EMPLOYEES_LIST_TITLE)
|
||||||
|
.items
|
||||||
|
.select("Id,Title,EMail,JobTitle,WorkPhone,PhotoUrl,ManagerID/Id")
|
||||||
|
.expand("ManagerID")
|
||||||
|
.getAll()
|
||||||
|
.then((data) => {
|
||||||
|
resolve(data.map((item) => {
|
||||||
|
return new Employee({
|
||||||
|
id: item.Id,
|
||||||
|
Title: item.Title,
|
||||||
|
EMail: item.EMail,
|
||||||
|
JobTitle: item.JobTitle,
|
||||||
|
Phone: item.WorkPhone,
|
||||||
|
PhotoUrl: item.PhotoUrl,
|
||||||
|
pid: item.ManagerID ? item.ManagerID.Id : undefined
|
||||||
|
})
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default OrgChartService.getInstance();
|
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -0,0 +1,64 @@
|
||||||
|
/**
|
||||||
|
* This script updates the package-solution version analogue to the
|
||||||
|
* the package.json file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (process.env.npm_package_version === undefined) {
|
||||||
|
|
||||||
|
throw 'Package version cannot be evaluated';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// define path to package-solution file
|
||||||
|
const solution = './config/package-solution.json',
|
||||||
|
teams = './teams/manifest.json';
|
||||||
|
|
||||||
|
// require filesystem instanc
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
// get next automated package version from process variable
|
||||||
|
const nextPkgVersion = process.env.npm_package_version;
|
||||||
|
|
||||||
|
// make sure next build version match
|
||||||
|
const nextVersion = nextPkgVersion.indexOf('-') === -1 ?
|
||||||
|
nextPkgVersion : nextPkgVersion.split('-')[0];
|
||||||
|
|
||||||
|
// Update version in SPFx package-solution if exists
|
||||||
|
if (fs.existsSync(solution)) {
|
||||||
|
|
||||||
|
// read package-solution file
|
||||||
|
const solutionFileContent = fs.readFileSync(solution, 'UTF-8');
|
||||||
|
// parse file as json
|
||||||
|
const solutionContents = JSON.parse(solutionFileContent);
|
||||||
|
|
||||||
|
// set property of version to next version
|
||||||
|
solutionContents.solution.version = nextVersion + '.0';
|
||||||
|
|
||||||
|
// save file
|
||||||
|
fs.writeFileSync(
|
||||||
|
solution,
|
||||||
|
// convert file back to proper json
|
||||||
|
JSON.stringify(solutionContents, null, 2),
|
||||||
|
'UTF-8');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update version in teams manifest if exists
|
||||||
|
if (fs.existsSync(teams)) {
|
||||||
|
|
||||||
|
// read package-solution file
|
||||||
|
const teamsManifestContent = fs.readFileSync(teams, 'UTF-8');
|
||||||
|
// parse file as json
|
||||||
|
const teamsContent = JSON.parse(teamsManifestContent);
|
||||||
|
|
||||||
|
// set property of version to next version
|
||||||
|
teamsContent.version = nextVersion;
|
||||||
|
|
||||||
|
// save file
|
||||||
|
fs.writeFileSync(
|
||||||
|
teams,
|
||||||
|
// convert file back to proper json
|
||||||
|
JSON.stringify(teamsContent, null, 2),
|
||||||
|
'UTF-8');
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
{
|
||||||
|
"extends": "./node_modules/@microsoft/rush-stack-compiler-2.7/includes/tsconfig-web.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es5",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"jsx": "react",
|
||||||
|
"declaration": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"outDir": "lib",
|
||||||
|
"inlineSources": false,
|
||||||
|
"strictNullChecks": false,
|
||||||
|
"noUnusedLocals": false,
|
||||||
|
"typeRoots": [
|
||||||
|
"./node_modules/@types",
|
||||||
|
"./node_modules/@microsoft",
|
||||||
|
"./types"
|
||||||
|
],
|
||||||
|
"types": [
|
||||||
|
"es6-promise",
|
||||||
|
"webpack-env"
|
||||||
|
],
|
||||||
|
"lib": [
|
||||||
|
"es5",
|
||||||
|
"dom",
|
||||||
|
"es2015.collection"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts",
|
||||||
|
"types/**/*.d.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"lib"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"extends": "@microsoft/sp-tslint-rules/base-tslint.json",
|
||||||
|
"rules": {
|
||||||
|
"class-name": false,
|
||||||
|
"export-name": false,
|
||||||
|
"forin": false,
|
||||||
|
"label-position": false,
|
||||||
|
"member-access": true,
|
||||||
|
"no-arg": false,
|
||||||
|
"no-console": false,
|
||||||
|
"no-construct": false,
|
||||||
|
"no-duplicate-variable": true,
|
||||||
|
"no-eval": false,
|
||||||
|
"no-function-expression": true,
|
||||||
|
"no-internal-module": true,
|
||||||
|
"no-shadowed-variable": true,
|
||||||
|
"no-switch-case-fall-through": true,
|
||||||
|
"no-unnecessary-semicolons": true,
|
||||||
|
"no-unused-expression": true,
|
||||||
|
"no-use-before-declare": true,
|
||||||
|
"no-with-statement": true,
|
||||||
|
"semicolon": true,
|
||||||
|
"trailing-comma": false,
|
||||||
|
"typedef": false,
|
||||||
|
"typedef-whitespace": false,
|
||||||
|
"use-named-parameter": true,
|
||||||
|
"variable-name": false,
|
||||||
|
"whitespace": false
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
import Vue, { VNode } from 'vue';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
namespace JSX {
|
||||||
|
// tslint:disable no-empty-interface
|
||||||
|
interface Element extends VNode {}
|
||||||
|
// tslint:disable no-empty-interface
|
||||||
|
interface ElementClass extends Vue {}
|
||||||
|
interface IntrinsicElements {
|
||||||
|
[elem: string]: any;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
declare module '*.vue' {
|
||||||
|
import Vue from 'vue';
|
||||||
|
export default Vue;
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue