Refresh tutorial for jQuery FullCalendar

This commit is contained in:
Andrew Connell 2020-06-30 16:53:29 -04:00
parent 0408520320
commit be42842a3d
117 changed files with 68842 additions and 41426 deletions

View File

@ -1,8 +1,12 @@
{ {
"@microsoft/generator-sharepoint": { "@microsoft/generator-sharepoint": {
"version": "1.1.0", "isCreatingSolution": true,
"libraryName": "spfx-js-fullcalendar", "environment": "spo",
"libraryId": "e6a89529-5fef-4883-b84c-c6bc27b0bfb0", "version": "1.10.0",
"environment": "spo" "libraryName": "fullcalendar-taskscalendar",
"libraryId": "c8f6ee3a-f24a-4b6b-b1bf-ce7121f65205",
"packageManager": "npm",
"isDomainIsolated": false,
"componentType": "webpart"
} }
} }

View File

@ -1,18 +1,26 @@
# Tutorial: Migrate jQuery and FullCalendar solution built using Script Editor Web Part to SharePoint Framework ## fullcalendar-taskscalendar
Sample jQuery FullCalendar solution migrated from a Script Editor Web Part to the SharePoint Framework. This is where you include your WebPart documentation.
![jQuery FullCalendar solution built using Script Editor Web Part](https://devofficecdn.azureedge.net/sharepointdocumentation/images/fullcalendar-sewp.png) ### Building the code
More information about the solution is available at [https://docs.microsoft.com/sharepoint/dev/spfx/web-parts/guidance/migrate-jquery-fullcalendar-script-to-spfx](https://docs.microsoft.com/sharepoint/dev/spfx/web-parts/guidance/migrate-jquery-fullcalendar-script-to-spfx). ```bash
git clone the repo
## Minimal Path to Awesome npm i
npm i -g gulp
- In the command line run: gulp
- `npm i` ```
- `gulp serve --nobrowser`
- In the web browser navigate to the hosted version of the SharePoint workbench located in the same site as where the Tasks list is, eg. *https://contoso.sharepoint.com/sites/team/_layouts/15/workbench.aspx*. This package produces the following:
[More information](../README.md) * lib/* - intermediate-stage commonjs build artifacts
* dist/* - the bundled script, along with other resources
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/tutorial-migrate-fullcalendar/01" /> * deploy/* - all resources which should be uploaded to a CDN.
### Build options
gulp clean - TODO
gulp test - TODO
gulp serve - TODO
gulp bundle - TODO
gulp package-solution - TODO

View File

@ -1,17 +1,31 @@
{ {
"entries": [ "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
{ "version": "2.0",
"entry": "./lib/webparts/tasksCalendar/TasksCalendarWebPart.js", "bundles": {
"manifest": "./src/webparts/tasksCalendar/TasksCalendarWebPart.manifest.json", "tasks-calendar-web-part": {
"outputPath": "./dist/tasks-calendar.bundle.js" "components": [
{
"entrypoint": "./lib/webparts/tasksCalendar/TasksCalendarWebPart.js",
"manifest": "./src/webparts/tasksCalendar/TasksCalendarWebPart.manifest.json"
}
]
} }
], },
"externals": { "externals": {
"jquery": "https://code.jquery.com/jquery-1.11.1.min.js", "jquery": {
"moment": "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js", "path": "https://code.jquery.com/jquery-1.11.1.min.js",
"fullcalendar": "https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js" "globalName": "jQuery"
},
"fullcalendar": {
"path": "https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js",
"globalName": "jQuery",
"globalDependencies": [
"jquery"
]
},
"moment": "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"
}, },
"localizedResources": { "localizedResources": {
"tasksCalendarStrings": "webparts/tasksCalendar/loc/{locale}.js" "TasksCalendarWebPartStrings": "lib/webparts/tasksCalendar/loc/{locale}.js"
} }
} }

View File

@ -1,3 +1,4 @@
{ {
"deployCdnPath": "temp/deploy" "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json",
} "deployCdnPath": "temp/deploy"
}

View File

@ -1,6 +1,7 @@
{ {
"workingDir": "./temp/deploy/", "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"account": "<!-- STORAGE ACCOUNT NAME -->", "workingDir": "./temp/deploy/",
"container": "spfx-js-fullcalendar", "account": "<!-- STORAGE ACCOUNT NAME -->",
"accessKey": "<!-- ACCESS KEY -->" "container": "fullcalendar-taskscalendar",
"accessKey": "<!-- ACCESS KEY -->"
} }

View File

@ -1,10 +1,13 @@
{ {
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": { "solution": {
"name": "spfx-js-fullcalendar-client-side-solution", "name": "fullcalendar-taskscalendar-client-side-solution",
"id": "e6a89529-5fef-4883-b84c-c6bc27b0bfb0", "id": "c8f6ee3a-f24a-4b6b-b1bf-ce7121f65205",
"version": "1.0.0.0" "version": "1.0.0.0",
"includeClientSideAssets": true,
"isDomainIsolated": false
}, },
"paths": { "paths": {
"zippedPackage": "solution/spfx-js-fullcalendar.sppkg" "zippedPackage": "solution/fullcalendar-taskscalendar.sppkg"
} }
} }

View File

@ -1,7 +1,8 @@
{ {
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
"port": 4321, "port": 4321,
"initialPage": "https://localhost:5432/workbench",
"https": true, "https": true,
"initialPage": "https://localhost:5432/workbench",
"api": { "api": {
"port": 5432, "port": 5432,
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/" "entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"

View File

@ -1,45 +0,0 @@
{
// Display errors as warnings
"displayAsWarning": true,
// The TSLint task may have been configured with several custom lint rules
// before this config file is read (for example lint rules from the tslint-microsoft-contrib
// project). If true, this flag will deactivate any of these rules.
"removeExistingRules": true,
// When true, the TSLint task is configured with some default TSLint "rules.":
"useDefaultConfigAsBase": false,
// Since removeExistingRules=true and useDefaultConfigAsBase=false, there will be no lint rules
// which are active, other than the list of rules below.
"lintConfig": {
// Opt-in to Lint rules which help to eliminate bugs in JavaScript
"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-case": true,
"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-unused-imports": true,
"no-use-before-declare": true,
"no-with-statement": true,
"semicolon": true,
"trailing-comma": false,
"typedef": false,
"typedef-whitespace": false,
"use-named-parameter": true,
"valid-typeof": true,
"variable-name": false,
"whitespace": false
}
}
}

View File

@ -1,3 +1,4 @@
{ {
"cdnBasePath": "<!-- PATH TO CDN -->" "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->"
} }

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
const gulp = require('gulp'); const build = require('@microsoft/sp-build-web');
const build = require('@microsoft/sp-build-web');
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
build.initialize(gulp);
build.initialize(require('gulp'));

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,34 @@
{ {
"name": "spfx-js-fullcalendar", "name": "fullcalendar-taskscalendar",
"version": "0.0.1", "version": "0.0.1",
"private": true, "private": true,
"main": "lib/index.js",
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
}, },
"author": {
"name": "Waldek Mastykarz",
"url": "https://blog.mastykarz.nl"
},
"dependencies": {
"@microsoft/sp-core-library": "~1.1.0",
"@microsoft/sp-webpart-base": "~1.1.0",
"@types/webpack-env": ">=1.12.1 <1.14.0"
},
"devDependencies": {
"@microsoft/sp-build-web": "~1.1.0",
"@microsoft/sp-module-interfaces": "~1.1.0",
"@microsoft/sp-webpart-workbench": "~1.1.0",
"gulp": "~3.9.1",
"@types/chai": ">=3.4.34 <3.6.0",
"@types/mocha": ">=2.2.33 <2.6.0"
},
"scripts": { "scripts": {
"build": "gulp bundle", "build": "gulp bundle",
"clean": "gulp clean", "clean": "gulp clean",
"test": "gulp test" "test": "gulp test"
},
"dependencies": {
"@microsoft/sp-core-library": "1.10.0",
"@microsoft/sp-property-pane": "1.10.0",
"@microsoft/sp-webpart-base": "1.10.0",
"@microsoft/sp-lodash-subset": "1.10.0",
"@microsoft/sp-office-ui-fabric-core": "1.10.0",
"@types/webpack-env": "1.13.1",
"@types/es6-promise": "0.0.33"
},
"devDependencies": {
"@microsoft/sp-build-web": "1.10.0",
"@microsoft/sp-tslint-rules": "1.10.0",
"@microsoft/sp-module-interfaces": "1.10.0",
"@microsoft/sp-webpart-workbench": "1.10.0",
"@microsoft/rush-stack-compiler-3.3": "0.3.5",
"gulp": "~3.9.1",
"@types/chai": "3.4.34",
"@types/mocha": "2.2.38",
"ajv": "~5.2.2"
} }
} }

View File

@ -0,0 +1 @@
// A file is required to be in the root of the /src directory by the TypeScript compiler

View File

@ -1,3 +0,0 @@
export interface ITasksCalendarWebPartProps {
description: string;
}

View File

@ -1,52 +0,0 @@
.tasksCalendar {
.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 {
padding: 20px;
}
.listItem {
max-width: 715px;
margin: 5px auto 5px auto;
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
}
.button {
// Our button
text-decoration: none;
height: 32px;
// Primary Button
min-width: 80px;
background-color: #0078d7;
border-color: #0078d7;
color: #ffffff;
// 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: 14px;
font-weight: 400;
border-width: 0;
text-align: center;
cursor: pointer;
display: inline-block;
padding: 0 16px;
.label {
font-weight: 600;
font-size: 14px;
height: 32px;
line-height: 32px;
margin: 0 4px;
vertical-align: top;
display: inline-block;
}
}
}

View File

@ -1,26 +1,27 @@
{ {
"$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json", "$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
"id": "4a528e4f-f528-409a-9cd1-da74f488ad63",
"id": "88991757-fd46-4085-bf49-4f75d345554e", "alias": "TasksCalendarWebPart",
"alias": "TasksCalendarWebPart", "componentType": "WebPart",
"componentType": "WebPart",
"version": "*", // The "*" signifies that the version should be taken from the package.json // The "*" signifies that the version should be taken from the package.json
"manifestVersion": 2, "version": "*",
"manifestVersion": 2,
/**
* This property should only be set to true if it is certain that the webpart does not // If true, the component can only be installed on sites where Custom Script is allowed.
* allow arbitrary scripts to be called // 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
"safeWithCustomScriptDisabled": false, "requiresCustomScript": false,
"supportedHosts": ["SharePointWebPart"],
"preconfiguredEntries": [{
"groupId": "88991757-fd46-4085-bf49-4f75d345554e", "preconfiguredEntries": [{
"group": { "default": "Under Development" }, "groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
"title": { "default": "Tasks calendar" }, "group": { "default": "Other" },
"description": { "default": "Shows tasks in calendar view" }, "title": { "default": "Tasks calendar" },
"officeFabricIconFontName": "Calendar", "description": { "default": "Shows tasks in the calendar view" },
"properties": { "officeFabricIconFontName": "Page",
"description": "Tasks calendar" "properties": {
} "description": "Tasks calendar"
}] }
} }]
}

View File

@ -0,0 +1,74 @@
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss';
.tasksCalendar {
.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;
}
}
}

View File

@ -1,55 +1,58 @@
import { Version } from '@microsoft/sp-core-library'; import { Version } from '@microsoft/sp-core-library';
import { import {
BaseClientSideWebPart, IPropertyPaneConfiguration,
IPropertyPaneConfiguration, PropertyPaneTextField
PropertyPaneTextField } from '@microsoft/sp-property-pane';
} from '@microsoft/sp-webpart-base'; import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import { escape } from '@microsoft/sp-lodash-subset'; import { escape } from '@microsoft/sp-lodash-subset';
import styles from './TasksCalendar.module.scss'; import styles from './TasksCalendarWebPart.module.scss';
import * as strings from 'tasksCalendarStrings'; import * as strings from 'TasksCalendarWebPartStrings';
import { ITasksCalendarWebPartProps } from './ITasksCalendarWebPartProps';
export interface ITasksCalendarWebPartProps {
import 'jquery'; description: string;
import 'moment'; }
import 'fullcalendar';
import 'jquery';
export default class TasksCalendarWebPart extends BaseClientSideWebPart<ITasksCalendarWebPartProps> { import 'moment';
import 'fullcalendar';
public render(): void {
this.domElement.innerHTML = ` export default class TasksCalendarWebPart extends BaseClientSideWebPart<ITasksCalendarWebPartProps> {
<div class="${styles.tasksCalendar}">
<link type="text/css" rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.css" /> public render(): void {
<div id="calendar"></div> this.domElement.innerHTML = `
</div>`; <div class="${styles.tasksCalendar}">
<link type="text/css" rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.css" />
(window as any).webAbsoluteUrl = this.context.pageContext.web.absoluteUrl; <div id="calendar"></div>
require('./script'); </div>`;
}
(window as any).webAbsoluteUrl = this.context.pageContext.web.absoluteUrl;
protected get dataVersion(): Version { require('./script');
return Version.parse('1.0'); }
}
protected get dataVersion(): Version {
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration { return Version.parse('1.0');
return { }
pages: [
{ protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
header: { return {
description: strings.PropertyPaneDescription pages: [
}, {
groups: [ header: {
{ description: strings.PropertyPaneDescription
groupName: strings.BasicGroupName, },
groupFields: [ groups: [
PropertyPaneTextField('description', { {
label: strings.DescriptionFieldLabel groupName: strings.BasicGroupName,
}) groupFields: [
] PropertyPaneTextField('description', {
} label: strings.DescriptionFieldLabel
] })
} ]
] }
}; ]
} }
} ]
};
}
}

View File

@ -1,7 +1,7 @@
define([], function() { define([], function() {
return { return {
"PropertyPaneDescription": "Description", "PropertyPaneDescription": "Description",
"BasicGroupName": "Group Name", "BasicGroupName": "Group Name",
"DescriptionFieldLabel": "Description Field" "DescriptionFieldLabel": "Description Field"
} }
}); });

View File

@ -1,10 +1,10 @@
declare interface ITasksCalendarStrings { declare interface ITasksCalendarWebPartStrings {
PropertyPaneDescription: string; PropertyPaneDescription: string;
BasicGroupName: string; BasicGroupName: string;
DescriptionFieldLabel: string; DescriptionFieldLabel: string;
} }
declare module 'tasksCalendarStrings' { declare module 'TasksCalendarWebPartStrings' {
const strings: ITasksCalendarStrings; const strings: ITasksCalendarWebPartStrings;
export = strings; export = strings;
} }

View File

@ -23,18 +23,18 @@ function displayTasks() {
editable: true, editable: true,
timezone: "UTC", timezone: "UTC",
droppable: true, // this allows things to be dropped onto the calendar droppable: true, // this allows things to be dropped onto the calendar
// update the end date when a user drags and drops an event // update the end date when a user drags and drops an event
eventDrop: function (event, delta, revertFunc) { eventDrop: function (event, delta, revertFunc) {
updateTask(event.id, event.start, event.end); updateTask(event.id, event.start, event.end);
}, },
// put the events on the calendar // put the events on the calendar
events: function (start, end, timezone, callback) { events: function (start, end, timezone, callback) {
var startDate = start.format('YYYY-MM-DD'); var startDate = start.format('YYYY-MM-DD');
var endDate = end.format('YYYY-MM-DD'); var endDate = end.format('YYYY-MM-DD');
var restQuery = "/_api/Web/Lists/GetByTitle('" + TASK_LIST + "')/items?$select=ID,Title,\ var restQuery = "/_api/Web/Lists/GetByTitle('" + TASK_LIST + "')/items?$select=ID,Title,\
Status,StartDate,DueDate,AssignedTo/Title&$expand=AssignedTo&\ Status,StartDate,DueDate,AssignedTo/Title&$expand=AssignedTo&\
$filter=((DueDate ge '" + startDate + "' and DueDate le '" + endDate + "')or(StartDate ge '" + startDate + "' and StartDate le '" + endDate + "'))"; $filter=((DueDate ge '" + startDate + "' and DueDate le '" + endDate + "')or(StartDate ge '" + startDate + "' and StartDate le '" + endDate + "'))";
$.ajax({ $.ajax({
url: window.webAbsoluteUrl + restQuery, url: window.webAbsoluteUrl + restQuery,
@ -65,7 +65,7 @@ $filter=((DueDate ge '" + startDate + "' and DueDate le '" + endDate + "')or(Sta
return { return {
title: task.Title + " - " + assignedTo, title: task.Title + " - " + assignedTo,
id: task.ID, id: task.ID,
color: color, // specify the background color and border color can also create a class and use className paramter. color: color, // specify the background color and border color can also create a class and use className parameter.
start: moment.utc(task.StartDate).add("1", "days"), start: moment.utc(task.StartDate).add("1", "days"),
end: moment.utc(task.DueDate).add("1", "days") // add one day to end date so that calendar properly shows event ending on that day end: moment.utc(task.DueDate).add("1", "days") // add one day to end date so that calendar properly shows event ending on that day
}; };
@ -97,7 +97,7 @@ function updateTask(id, startDate, dueDate) {
.then(function (data, textStatus, jqXHR) { .then(function (data, textStatus, jqXHR) {
return $.ajax({ return $.ajax({
url: window.webAbsoluteUrl + url: window.webAbsoluteUrl +
"/_api/Web/Lists/getByTitle('" + TASK_LIST + "')/Items(" + id + ")", "/_api/Web/Lists/getByTitle('" + TASK_LIST + "')/Items(" + id + ")",
type: 'POST', type: 'POST',
data: JSON.stringify({ data: JSON.stringify({
StartDate: sDate, StartDate: sDate,

View File

@ -1,9 +0,0 @@
/// <reference types="mocha" />
import { assert } from 'chai';
describe('TasksCalendarWebPart', () => {
it('should do something', () => {
assert.ok(true);
});
});

View File

@ -1,16 +1,38 @@
{ {
"compilerOptions": { "extends": "./node_modules/@microsoft/rush-stack-compiler-3.3/includes/tsconfig-web.json",
"target": "es5", "compilerOptions": {
"forceConsistentCasingInFileNames": true, "target": "es5",
"module": "commonjs", "forceConsistentCasingInFileNames": true,
"jsx": "react", "module": "esnext",
"declaration": true, "moduleResolution": "node",
"sourceMap": true, "jsx": "react",
"experimentalDecorators": true, "declaration": true,
"types": [ "sourceMap": true,
"es6-promise", "experimentalDecorators": true,
"es6-collections", "skipLibCheck": true,
"webpack-env" "outDir": "lib",
] "inlineSources": false,
} "strictNullChecks": false,
} "noUnusedLocals": false,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft"
],
"types": [
"es6-promise",
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection"
]
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules",
"lib"
]
}

View File

@ -1,3 +1,30 @@
{ {
"rulesDirectory": "./config" "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
}
} }

View File

@ -1,11 +0,0 @@
// Type definitions for Microsoft ODSP projects
// Project: ODSP
/* Global definition for UNIT_TEST builds
Code that is wrapped inside an if(UNIT_TEST) {...}
block will not be included in the final bundle when the
--ship flag is specified */
declare const UNIT_TEST: boolean;
/* Global defintion for SPO builds */
declare const DATACENTER: boolean;

View File

@ -1 +0,0 @@
/// <reference path="@ms/odsp.d.ts" />

View File

@ -1,8 +1,12 @@
{ {
"@microsoft/generator-sharepoint": { "@microsoft/generator-sharepoint": {
"version": "1.1.0", "isCreatingSolution": true,
"libraryName": "spfx-js-fullcalendar", "environment": "spo",
"libraryId": "e6a89529-5fef-4883-b84c-c6bc27b0bfb0", "version": "1.10.0",
"environment": "spo" "libraryName": "fullcalendar-taskscalendar",
"libraryId": "c8f6ee3a-f24a-4b6b-b1bf-ce7121f65205",
"packageManager": "npm",
"isDomainIsolated": false,
"componentType": "webpart"
} }
} }

View File

@ -1,18 +1,26 @@
# Tutorial: Migrate jQuery and FullCalendar solution built using Script Editor Web Part to SharePoint Framework ## fullcalendar-taskscalendar
Sample jQuery FullCalendar solution migrated from a Script Editor Web Part to the SharePoint Framework. This is where you include your WebPart documentation.
![jQuery FullCalendar solution built using Script Editor Web Part](https://devofficecdn.azureedge.net/sharepointdocumentation/images/fullcalendar-sewp.png) ### Building the code
More information about the solution is available at [https://docs.microsoft.com/sharepoint/dev/spfx/web-parts/guidance/migrate-jquery-fullcalendar-script-to-spfx](https://docs.microsoft.com/sharepoint/dev/spfx/web-parts/guidance/migrate-jquery-fullcalendar-script-to-spfx). ```bash
git clone the repo
## Minimal Path to Awesome npm i
npm i -g gulp
- In the command line run: gulp
- `npm i` ```
- `gulp serve --nobrowser`
- In the web browser navigate to the hosted version of the SharePoint workbench located in the same site as where the Tasks list is, eg. *https://contoso.sharepoint.com/sites/team/_layouts/15/workbench.aspx*. This package produces the following:
[More information](../README.md) * lib/* - intermediate-stage commonjs build artifacts
* dist/* - the bundled script, along with other resources
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/tutorial-migrate-fullcalendar/02" /> * deploy/* - all resources which should be uploaded to a CDN.
### Build options
gulp clean - TODO
gulp test - TODO
gulp serve - TODO
gulp bundle - TODO
gulp package-solution - TODO

View File

@ -1,17 +1,31 @@
{ {
"entries": [ "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
{ "version": "2.0",
"entry": "./lib/webparts/tasksCalendar/TasksCalendarWebPart.js", "bundles": {
"manifest": "./src/webparts/tasksCalendar/TasksCalendarWebPart.manifest.json", "tasks-calendar-web-part": {
"outputPath": "./dist/tasks-calendar.bundle.js" "components": [
{
"entrypoint": "./lib/webparts/tasksCalendar/TasksCalendarWebPart.js",
"manifest": "./src/webparts/tasksCalendar/TasksCalendarWebPart.manifest.json"
}
]
} }
], },
"externals": { "externals": {
"jquery": "https://code.jquery.com/jquery-1.11.1.min.js", "jquery": {
"moment": "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js", "path": "https://code.jquery.com/jquery-1.11.1.min.js",
"fullcalendar": "https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js" "globalName": "jQuery"
},
"fullcalendar": {
"path": "https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js",
"globalName": "jQuery",
"globalDependencies": [
"jquery"
]
},
"moment": "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"
}, },
"localizedResources": { "localizedResources": {
"tasksCalendarStrings": "webparts/tasksCalendar/loc/{locale}.js" "TasksCalendarWebPartStrings": "lib/webparts/tasksCalendar/loc/{locale}.js"
} }
} }

View File

@ -1,3 +1,4 @@
{ {
"deployCdnPath": "temp/deploy" "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json",
} "deployCdnPath": "temp/deploy"
}

View File

@ -1,6 +1,7 @@
{ {
"workingDir": "./temp/deploy/", "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"account": "<!-- STORAGE ACCOUNT NAME -->", "workingDir": "./temp/deploy/",
"container": "spfx-js-fullcalendar", "account": "<!-- STORAGE ACCOUNT NAME -->",
"accessKey": "<!-- ACCESS KEY -->" "container": "fullcalendar-taskscalendar",
"accessKey": "<!-- ACCESS KEY -->"
} }

View File

@ -1,10 +1,13 @@
{ {
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": { "solution": {
"name": "spfx-js-fullcalendar-client-side-solution", "name": "fullcalendar-taskscalendar-client-side-solution",
"id": "e6a89529-5fef-4883-b84c-c6bc27b0bfb0", "id": "c8f6ee3a-f24a-4b6b-b1bf-ce7121f65205",
"version": "1.0.0.0" "version": "1.0.0.0",
"includeClientSideAssets": true,
"isDomainIsolated": false
}, },
"paths": { "paths": {
"zippedPackage": "solution/spfx-js-fullcalendar.sppkg" "zippedPackage": "solution/fullcalendar-taskscalendar.sppkg"
} }
} }

View File

@ -1,7 +1,8 @@
{ {
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
"port": 4321, "port": 4321,
"initialPage": "https://localhost:5432/workbench",
"https": true, "https": true,
"initialPage": "https://localhost:5432/workbench",
"api": { "api": {
"port": 5432, "port": 5432,
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/" "entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"

View File

@ -1,45 +0,0 @@
{
// Display errors as warnings
"displayAsWarning": true,
// The TSLint task may have been configured with several custom lint rules
// before this config file is read (for example lint rules from the tslint-microsoft-contrib
// project). If true, this flag will deactivate any of these rules.
"removeExistingRules": true,
// When true, the TSLint task is configured with some default TSLint "rules.":
"useDefaultConfigAsBase": false,
// Since removeExistingRules=true and useDefaultConfigAsBase=false, there will be no lint rules
// which are active, other than the list of rules below.
"lintConfig": {
// Opt-in to Lint rules which help to eliminate bugs in JavaScript
"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-case": true,
"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-unused-imports": true,
"no-use-before-declare": true,
"no-with-statement": true,
"semicolon": true,
"trailing-comma": false,
"typedef": false,
"typedef-whitespace": false,
"use-named-parameter": true,
"valid-typeof": true,
"variable-name": false,
"whitespace": false
}
}
}

View File

@ -1,3 +1,4 @@
{ {
"cdnBasePath": "<!-- PATH TO CDN -->" "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->"
} }

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
const gulp = require('gulp'); const build = require('@microsoft/sp-build-web');
const build = require('@microsoft/sp-build-web');
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
build.initialize(gulp);
build.initialize(require('gulp'));

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,34 @@
{ {
"name": "spfx-js-fullcalendar", "name": "fullcalendar-taskscalendar",
"version": "0.0.1", "version": "0.0.1",
"private": true, "private": true,
"main": "lib/index.js",
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
}, },
"author": {
"name": "Waldek Mastykarz",
"url": "https://blog.mastykarz.nl"
},
"dependencies": {
"@microsoft/sp-core-library": "~1.1.0",
"@microsoft/sp-webpart-base": "~1.1.0",
"@types/webpack-env": ">=1.12.1 <1.14.0"
},
"devDependencies": {
"@microsoft/sp-build-web": "~1.1.0",
"@microsoft/sp-module-interfaces": "~1.1.0",
"@microsoft/sp-webpart-workbench": "~1.1.0",
"gulp": "~3.9.1",
"@types/chai": ">=3.4.34 <3.6.0",
"@types/mocha": ">=2.2.33 <2.6.0"
},
"scripts": { "scripts": {
"build": "gulp bundle", "build": "gulp bundle",
"clean": "gulp clean", "clean": "gulp clean",
"test": "gulp test" "test": "gulp test"
},
"dependencies": {
"@microsoft/sp-core-library": "1.10.0",
"@microsoft/sp-property-pane": "1.10.0",
"@microsoft/sp-webpart-base": "1.10.0",
"@microsoft/sp-lodash-subset": "1.10.0",
"@microsoft/sp-office-ui-fabric-core": "1.10.0",
"@types/webpack-env": "1.13.1",
"@types/es6-promise": "0.0.33"
},
"devDependencies": {
"@microsoft/sp-build-web": "1.10.0",
"@microsoft/sp-tslint-rules": "1.10.0",
"@microsoft/sp-module-interfaces": "1.10.0",
"@microsoft/sp-webpart-workbench": "1.10.0",
"@microsoft/rush-stack-compiler-3.3": "0.3.5",
"gulp": "~3.9.1",
"@types/chai": "3.4.34",
"@types/mocha": "2.2.38",
"ajv": "~5.2.2"
} }
} }

View File

@ -0,0 +1 @@
// A file is required to be in the root of the /src directory by the TypeScript compiler

View File

@ -1,3 +0,0 @@
export interface ITasksCalendarWebPartProps {
listName: string;
}

View File

@ -1,52 +0,0 @@
.tasksCalendar {
.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 {
padding: 20px;
}
.listItem {
max-width: 715px;
margin: 5px auto 5px auto;
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
}
.button {
// Our button
text-decoration: none;
height: 32px;
// Primary Button
min-width: 80px;
background-color: #0078d7;
border-color: #0078d7;
color: #ffffff;
// 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: 14px;
font-weight: 400;
border-width: 0;
text-align: center;
cursor: pointer;
display: inline-block;
padding: 0 16px;
.label {
font-weight: 600;
font-size: 14px;
height: 32px;
line-height: 32px;
margin: 0 4px;
vertical-align: top;
display: inline-block;
}
}
}

View File

@ -1,26 +1,27 @@
{ {
"$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json", "$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
"id": "4a528e4f-f528-409a-9cd1-da74f488ad63",
"id": "88991757-fd46-4085-bf49-4f75d345554e", "alias": "TasksCalendarWebPart",
"alias": "TasksCalendarWebPart", "componentType": "WebPart",
"componentType": "WebPart",
"version": "*", // The "*" signifies that the version should be taken from the package.json // The "*" signifies that the version should be taken from the package.json
"manifestVersion": 2, "version": "*",
"manifestVersion": 2,
/**
* This property should only be set to true if it is certain that the webpart does not // If true, the component can only be installed on sites where Custom Script is allowed.
* allow arbitrary scripts to be called // 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
"safeWithCustomScriptDisabled": false, "requiresCustomScript": false,
"supportedHosts": ["SharePointWebPart"],
"preconfiguredEntries": [{
"groupId": "88991757-fd46-4085-bf49-4f75d345554e", "preconfiguredEntries": [{
"group": { "default": "Under Development" }, "groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
"title": { "default": "Tasks calendar" }, "group": { "default": "Other" },
"description": { "default": "Shows tasks in calendar view" }, "title": { "default": "Tasks calendar" },
"officeFabricIconFontName": "Calendar", "description": { "default": "Shows tasks in the calendar view" },
"properties": { "officeFabricIconFontName": "Page",
"listName": "" "properties": {
} "description": "Tasks calendar"
}] }
} }]
}

View File

@ -0,0 +1,74 @@
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss';
.tasksCalendar {
.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;
}
}
}

View File

@ -1,178 +1,62 @@
import { Version } from '@microsoft/sp-core-library'; import { Version } from '@microsoft/sp-core-library';
import { import {
BaseClientSideWebPart, IPropertyPaneConfiguration,
IPropertyPaneConfiguration, PropertyPaneTextField
PropertyPaneTextField } from '@microsoft/sp-property-pane';
} from '@microsoft/sp-webpart-base'; import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import { escape } from '@microsoft/sp-lodash-subset'; import { escape } from '@microsoft/sp-lodash-subset';
import styles from './TasksCalendar.module.scss'; import styles from './TasksCalendarWebPart.module.scss';
import * as strings from 'tasksCalendarStrings'; import * as strings from 'TasksCalendarWebPartStrings';
import { ITasksCalendarWebPartProps } from './ITasksCalendarWebPartProps';
import 'jquery';
var $: any = require('jquery'); import 'moment';
var moment: any = require('moment'); import 'fullcalendar';
import 'fullcalendar'; export interface ITasksCalendarWebPartProps {
listName: string;
var COLORS = ['#466365', '#B49A67', '#93B7BE', '#E07A5F', '#849483', '#084C61', '#DB3A34']; }
export default class TasksCalendarWebPart extends BaseClientSideWebPart<ITasksCalendarWebPartProps> { export default class TasksCalendarWebPart extends BaseClientSideWebPart<ITasksCalendarWebPartProps> {
public render(): void {
this.domElement.innerHTML = ` public render(): void {
<div class="${styles.tasksCalendar}"> this.domElement.innerHTML = `
<link type="text/css" rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.css" /> <div class="${styles.tasksCalendar}">
<div id="calendar"></div> <link type="text/css" rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.css" />
</div>`; <div id="calendar"></div>
</div>`;
this.displayTasks();
} (window as any).webAbsoluteUrl = this.context.pageContext.web.absoluteUrl;
require('./script');
private displayTasks() { }
$('#calendar').fullCalendar('destroy');
$('#calendar').fullCalendar({ protected get dataVersion(): Version {
weekends: false, return Version.parse('1.0');
header: { }
left: 'prev,next today',
center: 'title', protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
right: 'month,basicWeek,basicDay' return {
}, pages: [
displayEventTime: false, {
// open up the display form when a user clicks on an event header: {
eventClick: (calEvent, jsEvent, view) => { description: strings.PropertyPaneDescription
(window as any).location = this.context.pageContext.web.absoluteUrl + },
"/Lists/" + escape(this.properties.listName) + "/DispForm.aspx?ID=" + calEvent.id; groups: [
}, {
editable: true, groupName: strings.BasicGroupName,
timezone: "UTC", groupFields: [
droppable: true, // this allows things to be dropped onto the calendar PropertyPaneTextField('listName', {
// update the end date when a user drags and drops an event label: strings.ListNameFieldLabel
eventDrop: (event, delta, revertFunc) => { })
this.updateTask(event.id, event.start, event.end); ]
}, }
// put the events on the calendar ]
events: (start, end, timezone, callback) => { }
var startDate = start.format('YYYY-MM-DD'); ]
var endDate = end.format('YYYY-MM-DD'); };
}
var restQuery = "/_api/Web/Lists/GetByTitle('" + escape(this.properties.listName) + "')/items?$select=ID,Title,\
Status,StartDate,DueDate,AssignedTo/Title&$expand=AssignedTo&\ protected get disableReactivePropertyChanges(): boolean {
$filter=((DueDate ge '" + startDate + "' and DueDate le '" + endDate + "')or(StartDate ge '" + startDate + "' and StartDate le '" + endDate + "'))"; return true;
}
$.ajax({ }
url: this.context.pageContext.web.absoluteUrl + restQuery,
type: "GET",
dataType: "json",
headers: {
Accept: "application/json;odata=nometadata"
}
})
.done((data, textStatus, jqXHR) => {
var personColors = {};
var colorNo = 0;
var events = data.value.map((task) => {
var assignedTo = task.AssignedTo.map((person) => {
return person.Title;
}).join(', ');
var color = personColors[assignedTo];
if (!color) {
color = COLORS[colorNo++];
personColors[assignedTo] = color;
}
if (colorNo >= COLORS.length) {
colorNo = 0;
}
return {
title: task.Title + " - " + assignedTo,
id: task.ID,
color: color, // specify the background color and border color can also create a class and use className paramter.
start: moment.utc(task.StartDate).add("1", "days"),
end: moment.utc(task.DueDate).add("1", "days") // add one day to end date so that calendar properly shows event ending on that day
};
});
callback(events);
});
}
});
}
private updateTask(id, startDate, dueDate) {
// subtract the previously added day to the date to store correct date
var sDate = moment.utc(startDate).add("-1", "days").format('YYYY-MM-DD') + "T" +
startDate.format("hh:mm") + ":00Z";
if (!dueDate) {
dueDate = startDate;
}
var dDate = moment.utc(dueDate).add("-1", "days").format('YYYY-MM-DD') + "T" +
dueDate.format("hh:mm") + ":00Z";
$.ajax({
url: this.context.pageContext.web.absoluteUrl + '/_api/contextinfo',
type: 'POST',
headers: {
'Accept': 'application/json;odata=nometadata'
}
})
.then((data, textStatus, jqXHR) => {
return $.ajax({
url: this.context.pageContext.web.absoluteUrl +
"/_api/Web/Lists/getByTitle('" + escape(this.properties.listName) + "')/Items(" + id + ")",
type: 'POST',
data: JSON.stringify({
StartDate: sDate,
DueDate: dDate,
}),
headers: {
Accept: "application/json;odata=nometadata",
"Content-Type": "application/json;odata=nometadata",
"X-RequestDigest": data.FormDigestValue,
"IF-MATCH": "*",
"X-Http-Method": "PATCH"
}
});
})
.done((data, textStatus, jqXHR) => {
alert("Update Successful");
})
.fail((jqXHR, textStatus, errorThrown) => {
alert("Update Failed");
})
.always(() => {
this.displayTasks();
});
}
protected get dataVersion(): Version {
return Version.parse('1.0');
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: [
PropertyPaneTextField('listName', {
label: strings.ListNameFieldLabel
})
]
}
]
}
]
};
}
protected get disableReactivePropertyChanges(): boolean {
return true;
}
}

View File

@ -1,7 +1,7 @@
define([], function() { define([], function() {
return { return {
"PropertyPaneDescription": "Tasks calendar settings", "PropertyPaneDescription": "Description",
"BasicGroupName": "Data", "BasicGroupName": "Group Name",
"ListNameFieldLabel": "List name" "ListNameFieldLabel": "List name"
} }
}); });

View File

@ -1,10 +1,10 @@
declare interface ITasksCalendarStrings { declare interface ITasksCalendarWebPartStrings {
PropertyPaneDescription: string; PropertyPaneDescription: string;
BasicGroupName: string; BasicGroupName: string;
ListNameFieldLabel: string; ListNameFieldLabel: string;
} }
declare module 'tasksCalendarStrings' { declare module 'TasksCalendarWebPartStrings' {
const strings: ITasksCalendarStrings; const strings: ITasksCalendarWebPartStrings;
export = strings; export = strings;
} }

View File

@ -0,0 +1,124 @@
var moment = require('moment');
var PATH_TO_DISPFORM = window.webAbsoluteUrl + "/Lists/Tasks/DispForm.aspx";
var TASK_LIST = "Tasks";
var COLORS = ['#466365', '#B49A67', '#93B7BE', '#E07A5F', '#849483', '#084C61', '#DB3A34'];
displayTasks();
function displayTasks() {
$('#calendar').fullCalendar('destroy');
$('#calendar').fullCalendar({
weekends: false,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
displayEventTime: false,
// open up the display form when a user clicks on an event
eventClick: function (calEvent, jsEvent, view) {
window.location = PATH_TO_DISPFORM + "?ID=" + calEvent.id;
},
editable: true,
timezone: "UTC",
droppable: true, // this allows things to be dropped onto the calendar
// update the end date when a user drags and drops an event
eventDrop: function (event, delta, revertFunc) {
updateTask(event.id, event.start, event.end);
},
// put the events on the calendar
events: function (start, end, timezone, callback) {
var startDate = start.format('YYYY-MM-DD');
var endDate = end.format('YYYY-MM-DD');
var restQuery = "/_api/Web/Lists/GetByTitle('" + TASK_LIST + "')/items?$select=ID,Title,\
Status,StartDate,DueDate,AssignedTo/Title&$expand=AssignedTo&\
$filter=((DueDate ge '" + startDate + "' and DueDate le '" + endDate + "')or(StartDate ge '" + startDate + "' and StartDate le '" + endDate + "'))";
$.ajax({
url: window.webAbsoluteUrl + restQuery,
type: "GET",
dataType: "json",
headers: {
Accept: "application/json;odata=nometadata"
}
})
.done(function (data, textStatus, jqXHR) {
var personColors = {};
var colorNo = 0;
var events = data.value.map(function (task) {
var assignedTo = task.AssignedTo.map(function (person) {
return person.Title;
}).join(', ');
var color = personColors[assignedTo];
if (!color) {
color = COLORS[colorNo++];
personColors[assignedTo] = color;
}
if (colorNo >= COLORS.length) {
colorNo = 0;
}
return {
title: task.Title + " - " + assignedTo,
id: task.ID,
color: color, // specify the background color and border color can also create a class and use className parameter.
start: moment.utc(task.StartDate).add("1", "days"),
end: moment.utc(task.DueDate).add("1", "days") // add one day to end date so that calendar properly shows event ending on that day
};
});
callback(events);
});
}
});
}
function updateTask(id, startDate, dueDate) {
// subtract the previously added day to the date to store correct date
var sDate = moment.utc(startDate).add("-1", "days").format('YYYY-MM-DD') + "T" +
startDate.format("hh:mm") + ":00Z";
if (!dueDate) {
dueDate = startDate;
}
var dDate = moment.utc(dueDate).add("-1", "days").format('YYYY-MM-DD') + "T" +
dueDate.format("hh:mm") + ":00Z";
$.ajax({
url: window.webAbsoluteUrl + '/_api/contextinfo',
type: 'POST',
headers: {
'Accept': 'application/json;odata=nometadata'
}
})
.then(function (data, textStatus, jqXHR) {
return $.ajax({
url: window.webAbsoluteUrl +
"/_api/Web/Lists/getByTitle('" + TASK_LIST + "')/Items(" + id + ")",
type: 'POST',
data: JSON.stringify({
StartDate: sDate,
DueDate: dDate,
}),
headers: {
Accept: "application/json;odata=nometadata",
"Content-Type": "application/json;odata=nometadata",
"X-RequestDigest": data.FormDigestValue,
"IF-MATCH": "*",
"X-Http-Method": "PATCH"
}
});
})
.done(function (data, textStatus, jqXHR) {
alert("Update Successful");
})
.fail(function (jqXHR, textStatus, errorThrown) {
alert("Update Failed");
})
.always(function () {
displayTasks();
});
}

View File

@ -1,9 +0,0 @@
/// <reference types="mocha" />
import { assert } from 'chai';
describe('TasksCalendarWebPart', () => {
it('should do something', () => {
assert.ok(true);
});
});

View File

@ -1,16 +1,38 @@
{ {
"compilerOptions": { "extends": "./node_modules/@microsoft/rush-stack-compiler-3.3/includes/tsconfig-web.json",
"target": "es5", "compilerOptions": {
"forceConsistentCasingInFileNames": true, "target": "es5",
"module": "commonjs", "forceConsistentCasingInFileNames": true,
"jsx": "react", "module": "esnext",
"declaration": true, "moduleResolution": "node",
"sourceMap": true, "jsx": "react",
"experimentalDecorators": true, "declaration": true,
"types": [ "sourceMap": true,
"es6-promise", "experimentalDecorators": true,
"es6-collections", "skipLibCheck": true,
"webpack-env" "outDir": "lib",
] "inlineSources": false,
} "strictNullChecks": false,
} "noUnusedLocals": false,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft"
],
"types": [
"es6-promise",
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection"
]
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules",
"lib"
]
}

View File

@ -1,3 +1,30 @@
{ {
"rulesDirectory": "./config" "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
}
} }

View File

@ -1,11 +0,0 @@
// Type definitions for Microsoft ODSP projects
// Project: ODSP
/* Global definition for UNIT_TEST builds
Code that is wrapped inside an if(UNIT_TEST) {...}
block will not be included in the final bundle when the
--ship flag is specified */
declare const UNIT_TEST: boolean;
/* Global defintion for SPO builds */
declare const DATACENTER: boolean;

View File

@ -1 +0,0 @@
/// <reference path="@ms/odsp.d.ts" />

View File

@ -1,8 +1,12 @@
{ {
"@microsoft/generator-sharepoint": { "@microsoft/generator-sharepoint": {
"version": "1.1.0", "isCreatingSolution": true,
"libraryName": "spfx-js-fullcalendar", "environment": "spo",
"libraryId": "e6a89529-5fef-4883-b84c-c6bc27b0bfb0", "version": "1.10.0",
"environment": "spo" "libraryName": "fullcalendar-taskscalendar",
"libraryId": "c8f6ee3a-f24a-4b6b-b1bf-ce7121f65205",
"packageManager": "npm",
"isDomainIsolated": false,
"componentType": "webpart"
} }
} }

View File

@ -1,18 +1,26 @@
# Tutorial: Migrate jQuery and FullCalendar solution built using Script Editor Web Part to SharePoint Framework ## fullcalendar-taskscalendar
Sample jQuery FullCalendar solution migrated from a Script Editor Web Part to the SharePoint Framework. This is where you include your WebPart documentation.
![jQuery FullCalendar solution built using Script Editor Web Part](https://devofficecdn.azureedge.net/sharepointdocumentation/images/fullcalendar-sewp.png) ### Building the code
More information about the solution is available at [https://docs.microsoft.com/sharepoint/dev/spfx/web-parts/guidance/migrate-jquery-fullcalendar-script-to-spfx](https://docs.microsoft.com/sharepoint/dev/spfx/web-parts/guidance/migrate-jquery-fullcalendar-script-to-spfx). ```bash
git clone the repo
## Minimal Path to Awesome npm i
npm i -g gulp
- In the command line run: gulp
- `npm i` ```
- `gulp serve --nobrowser`
- In the web browser navigate to the hosted version of the SharePoint workbench located in the same site as where the Tasks list is, eg. *https://contoso.sharepoint.com/sites/team/_layouts/15/workbench.aspx*. This package produces the following:
[More information](../README.md) * lib/* - intermediate-stage commonjs build artifacts
* dist/* - the bundled script, along with other resources
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/tutorial-migrate-fullcalendar/03" /> * deploy/* - all resources which should be uploaded to a CDN.
### Build options
gulp clean - TODO
gulp test - TODO
gulp serve - TODO
gulp bundle - TODO
gulp package-solution - TODO

View File

@ -1,17 +1,31 @@
{ {
"entries": [ "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
{ "version": "2.0",
"entry": "./lib/webparts/tasksCalendar/TasksCalendarWebPart.js", "bundles": {
"manifest": "./src/webparts/tasksCalendar/TasksCalendarWebPart.manifest.json", "tasks-calendar-web-part": {
"outputPath": "./dist/tasks-calendar.bundle.js" "components": [
{
"entrypoint": "./lib/webparts/tasksCalendar/TasksCalendarWebPart.js",
"manifest": "./src/webparts/tasksCalendar/TasksCalendarWebPart.manifest.json"
}
]
} }
], },
"externals": { "externals": {
"jquery": "https://code.jquery.com/jquery-1.11.1.min.js", "jquery": {
"moment": "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js", "path": "https://code.jquery.com/jquery-1.11.1.min.js",
"fullcalendar": "https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js" "globalName": "jQuery"
},
"fullcalendar": {
"path": "https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js",
"globalName": "jQuery",
"globalDependencies": [
"jquery"
]
},
"moment": "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"
}, },
"localizedResources": { "localizedResources": {
"tasksCalendarStrings": "webparts/tasksCalendar/loc/{locale}.js" "TasksCalendarWebPartStrings": "lib/webparts/tasksCalendar/loc/{locale}.js"
} }
} }

View File

@ -1,3 +1,4 @@
{ {
"deployCdnPath": "temp/deploy" "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json",
} "deployCdnPath": "temp/deploy"
}

View File

@ -1,6 +1,7 @@
{ {
"workingDir": "./temp/deploy/", "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"account": "<!-- STORAGE ACCOUNT NAME -->", "workingDir": "./temp/deploy/",
"container": "spfx-js-fullcalendar", "account": "<!-- STORAGE ACCOUNT NAME -->",
"accessKey": "<!-- ACCESS KEY -->" "container": "fullcalendar-taskscalendar",
"accessKey": "<!-- ACCESS KEY -->"
} }

View File

@ -1,10 +1,13 @@
{ {
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": { "solution": {
"name": "spfx-js-fullcalendar-client-side-solution", "name": "fullcalendar-taskscalendar-client-side-solution",
"id": "e6a89529-5fef-4883-b84c-c6bc27b0bfb0", "id": "c8f6ee3a-f24a-4b6b-b1bf-ce7121f65205",
"version": "1.0.0.0" "version": "1.0.0.0",
"includeClientSideAssets": true,
"isDomainIsolated": false
}, },
"paths": { "paths": {
"zippedPackage": "solution/spfx-js-fullcalendar.sppkg" "zippedPackage": "solution/fullcalendar-taskscalendar.sppkg"
} }
} }

View File

@ -1,7 +1,8 @@
{ {
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
"port": 4321, "port": 4321,
"initialPage": "https://localhost:5432/workbench",
"https": true, "https": true,
"initialPage": "https://localhost:5432/workbench",
"api": { "api": {
"port": 5432, "port": 5432,
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/" "entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"

View File

@ -1,45 +0,0 @@
{
// Display errors as warnings
"displayAsWarning": true,
// The TSLint task may have been configured with several custom lint rules
// before this config file is read (for example lint rules from the tslint-microsoft-contrib
// project). If true, this flag will deactivate any of these rules.
"removeExistingRules": true,
// When true, the TSLint task is configured with some default TSLint "rules.":
"useDefaultConfigAsBase": false,
// Since removeExistingRules=true and useDefaultConfigAsBase=false, there will be no lint rules
// which are active, other than the list of rules below.
"lintConfig": {
// Opt-in to Lint rules which help to eliminate bugs in JavaScript
"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-case": true,
"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-unused-imports": true,
"no-use-before-declare": true,
"no-with-statement": true,
"semicolon": true,
"trailing-comma": false,
"typedef": false,
"typedef-whitespace": false,
"use-named-parameter": true,
"valid-typeof": true,
"variable-name": false,
"whitespace": false
}
}
}

View File

@ -1,3 +1,4 @@
{ {
"cdnBasePath": "<!-- PATH TO CDN -->" "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->"
} }

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
const gulp = require('gulp'); const build = require('@microsoft/sp-build-web');
const build = require('@microsoft/sp-build-web');
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
build.initialize(gulp);
build.initialize(require('gulp'));

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +1,36 @@
{ {
"name": "spfx-js-fullcalendar", "name": "fullcalendar-taskscalendar",
"version": "0.0.1", "version": "0.0.1",
"private": true, "private": true,
"main": "lib/index.js",
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
}, },
"author": {
"name": "Waldek Mastykarz",
"url": "https://blog.mastykarz.nl"
},
"dependencies": {
"@microsoft/sp-core-library": "~1.1.0",
"@microsoft/sp-webpart-base": "~1.1.0",
"@types/webpack-env": ">=1.12.1 <1.14.0",
"moment": "^2.18.1"
},
"devDependencies": {
"@microsoft/sp-build-web": "~1.1.0",
"@microsoft/sp-module-interfaces": "~1.1.0",
"@microsoft/sp-webpart-workbench": "~1.1.0",
"@types/chai": ">=3.4.34 <3.6.0",
"@types/fullcalendar": "^2.7.44",
"@types/jquery": "^1.10.32",
"@types/mocha": ">=2.2.33 <2.6.0",
"gulp": "~3.9.1"
},
"scripts": { "scripts": {
"build": "gulp bundle", "build": "gulp bundle",
"clean": "gulp clean", "clean": "gulp clean",
"test": "gulp test" "test": "gulp test"
},
"dependencies": {
"@microsoft/sp-core-library": "1.10.0",
"@microsoft/sp-lodash-subset": "1.10.0",
"@microsoft/sp-office-ui-fabric-core": "1.10.0",
"@microsoft/sp-property-pane": "1.10.0",
"@microsoft/sp-webpart-base": "1.10.0",
"@types/es6-promise": "0.0.33",
"@types/webpack-env": "1.13.1",
"moment": "^2.27.0"
},
"devDependencies": {
"@microsoft/rush-stack-compiler-3.3": "0.3.5",
"@microsoft/sp-build-web": "1.10.0",
"@microsoft/sp-module-interfaces": "1.10.0",
"@microsoft/sp-tslint-rules": "1.10.0",
"@microsoft/sp-webpart-workbench": "1.10.0",
"@types/chai": "3.4.34",
"@types/jquery": "^1.10.35",
"@types/mocha": "2.2.38",
"ajv": "~5.2.2",
"gulp": "~3.9.1"
} }
} }

View File

@ -0,0 +1 @@
// A file is required to be in the root of the /src directory by the TypeScript compiler

View File

@ -1,3 +0,0 @@
export interface ITasksCalendarWebPartProps {
listName: string;
}

View File

@ -1,52 +0,0 @@
.tasksCalendar {
.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 {
padding: 20px;
}
.listItem {
max-width: 715px;
margin: 5px auto 5px auto;
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
}
.button {
// Our button
text-decoration: none;
height: 32px;
// Primary Button
min-width: 80px;
background-color: #0078d7;
border-color: #0078d7;
color: #ffffff;
// 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: 14px;
font-weight: 400;
border-width: 0;
text-align: center;
cursor: pointer;
display: inline-block;
padding: 0 16px;
.label {
font-weight: 600;
font-size: 14px;
height: 32px;
line-height: 32px;
margin: 0 4px;
vertical-align: top;
display: inline-block;
}
}
}

View File

@ -1,26 +1,27 @@
{ {
"$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json", "$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
"id": "4a528e4f-f528-409a-9cd1-da74f488ad63",
"id": "88991757-fd46-4085-bf49-4f75d345554e", "alias": "TasksCalendarWebPart",
"alias": "TasksCalendarWebPart", "componentType": "WebPart",
"componentType": "WebPart",
"version": "*", // The "*" signifies that the version should be taken from the package.json // The "*" signifies that the version should be taken from the package.json
"manifestVersion": 2, "version": "*",
"manifestVersion": 2,
/**
* This property should only be set to true if it is certain that the webpart does not // If true, the component can only be installed on sites where Custom Script is allowed.
* allow arbitrary scripts to be called // 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
"safeWithCustomScriptDisabled": false, "requiresCustomScript": false,
"supportedHosts": ["SharePointWebPart"],
"preconfiguredEntries": [{
"groupId": "88991757-fd46-4085-bf49-4f75d345554e", "preconfiguredEntries": [{
"group": { "default": "Under Development" }, "groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
"title": { "default": "Tasks calendar" }, "group": { "default": "Other" },
"description": { "default": "Shows tasks in calendar view" }, "title": { "default": "Tasks calendar" },
"officeFabricIconFontName": "Calendar", "description": { "default": "Shows tasks in the calendar view" },
"properties": { "officeFabricIconFontName": "Page",
"listName": "" "properties": {
} "description": "Tasks calendar"
}] }
} }]
}

View File

@ -0,0 +1,74 @@
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss';
.tasksCalendar {
.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;
}
}
}

View File

@ -1,187 +1,190 @@
import { Version } from '@microsoft/sp-core-library'; import { Version } from '@microsoft/sp-core-library';
import { import {
BaseClientSideWebPart, IPropertyPaneConfiguration,
IPropertyPaneConfiguration, PropertyPaneTextField
PropertyPaneTextField } from '@microsoft/sp-property-pane';
} from '@microsoft/sp-webpart-base'; import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import { escape } from '@microsoft/sp-lodash-subset'; import { escape } from '@microsoft/sp-lodash-subset';
import styles from './TasksCalendar.module.scss'; import styles from './TasksCalendarWebPart.module.scss';
import * as strings from 'tasksCalendarStrings'; import * as strings from 'TasksCalendarWebPartStrings';
import { ITasksCalendarWebPartProps } from './ITasksCalendarWebPartProps';
import * as $ from 'jquery';
import * as $ from 'jquery'; import 'fullcalendar';
import 'fullcalendar'; import * as moment from 'moment';
import * as moment from 'moment';
var COLORS = ['#466365', '#B49A67', '#93B7BE', '#E07A5F', '#849483', '#084C61', '#DB3A34'];
interface ITask {
ID: number; interface ITask {
Title: string; ID: number;
StartDate: string; Title: string;
DueDate: string; StartDate: string;
AssignedTo: [{ Title: string }]; DueDate: string;
} AssignedTo: [{ Title: string }];
}
export default class TasksCalendarWebPart extends BaseClientSideWebPart<ITasksCalendarWebPartProps> {
private readonly colors: string[] = ['#466365', '#B49A67', '#93B7BE', '#E07A5F', '#849483', '#084C61', '#DB3A34']; export interface ITasksCalendarWebPartProps {
listName: string;
public render(): void { }
this.domElement.innerHTML = `
<div class="${styles.tasksCalendar}"> export default class TasksCalendarWebPart extends BaseClientSideWebPart<ITasksCalendarWebPartProps> {
<link type="text/css" rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.css" />
<div id="calendar"></div> public render(): void {
</div>`; this.domElement.innerHTML = `
<div class="${styles.tasksCalendar}">
this.displayTasks(); <link type="text/css" rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.css" />
} <div id="calendar"></div>
</div>`;
private displayTasks(): void {
$('#calendar').fullCalendar('destroy'); this.displayTasks();
$('#calendar').fullCalendar({ }
weekends: false,
header: { protected get dataVersion(): Version {
left: 'prev,next today', return Version.parse('1.0');
center: 'title', }
right: 'month,basicWeek,basicDay'
}, protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
displayEventTime: false, return {
// open up the display form when a user clicks on an event pages: [
eventClick: (calEvent: FC.EventObject, jsEvent: MouseEvent, view: FC.ViewObject): void => { {
(window as any).location = `${this.context.pageContext.web.absoluteUrl}\ header: {
/Lists/${escape(this.properties.listName)}/DispForm.aspx?ID=${calEvent.id}`; description: strings.PropertyPaneDescription
}, },
editable: true, groups: [
timezone: "UTC", {
droppable: true, // this allows things to be dropped onto the calendar groupName: strings.BasicGroupName,
// update the end date when a user drags and drops an event groupFields: [
eventDrop: (event: FC.EventObject, delta: moment.Duration, revertFunc: Function): void => { PropertyPaneTextField('listName', {
this.updateTask(event.id, <moment.Moment>event.start, <moment.Moment>event.end); label: strings.ListNameFieldLabel
}, })
// put the events on the calendar ]
events: (start: moment.Moment, end: moment.Moment, timezone: string, callback: Function): void => { }
const startDate: string = start.format('YYYY-MM-DD'); ]
const endDate: string = end.format('YYYY-MM-DD'); }
]
const restQuery: string = `/_api/Web/Lists/GetByTitle('${escape(this.properties.listName)}')/items?$select=ID,Title,\ };
Status,StartDate,DueDate,AssignedTo/Title&$expand=AssignedTo&\ }
$filter=((DueDate ge '${startDate}' and DueDate le '${endDate}')or(StartDate ge '${startDate}' and StartDate le '${endDate}'))`;
protected get disableReactivePropertyChanges(): boolean {
$.ajax({ return true;
url: this.context.pageContext.web.absoluteUrl + restQuery, }
type: "GET",
dataType: "json", private displayTasks() {
headers: { ($('#calendar') as any).fullCalendar('destroy');
Accept: "application/json;odata=nometadata" ($('#calendar') as any).fullCalendar({
} weekends: false,
}) header: {
.done((data: { value: ITask[] }, textStatus: string, jqXHR: JQueryXHR): void => { left: 'prev,next today',
let personColors: { [person: string]: string; } = {}; center: 'title',
let colorNo: number = 0; right: 'month,basicWeek,basicDay'
},
const events: FC.EventObject[] = data.value.map((task: ITask): FC.EventObject => { displayEventTime: false,
const assignedTo: string = task.AssignedTo.map((person: { Title: string }): string => { // open up the display form when a user clicks on an event
return person.Title; eventClick: (calEvent: any, jsEvent: MouseEvent, view: any): void => {
}).join(', '); (window as any).location = this.context.pageContext.web.absoluteUrl +
"/Lists/" + escape(this.properties.listName) + "/DispForm.aspx?ID=" + calEvent.id;
let color: string = personColors[assignedTo]; },
if (!color) { editable: true,
color = this.colors[colorNo++]; timezone: "UTC",
personColors[assignedTo] = color; droppable: true, // this allows things to be dropped onto the calendar
} // update the end date when a user drags and drops an event
if (colorNo >= this.colors.length) { eventDrop: (event: any, delta: moment.Duration, revertFunc: Function): void => {
colorNo = 0; this.updateTask(<number>event.id, <moment.Moment>event.start, <moment.Moment>event.end);
} },
// put the events on the calendar
return { events: (start: moment.Moment, end: moment.Moment, timezone: string, callback: Function): void => {
title: `${task.Title} - ${assignedTo}`, var startDate = start.format('YYYY-MM-DD');
id: task.ID, var endDate = end.format('YYYY-MM-DD');
// specify the background color and border color can also create a class and use className parameter
color: color, var restQuery = "/_api/Web/Lists/GetByTitle('" + escape(this.properties.listName) + "')/items?$select=ID,Title,\
start: moment.utc(task.StartDate).add("1", "days"), Status,StartDate,DueDate,AssignedTo/Title&$expand=AssignedTo&\
// add one day to end date so that calendar properly shows event ending on that day $filter=((DueDate ge '" + startDate + "' and DueDate le '" + endDate + "')or(StartDate ge '" + startDate + "' and StartDate le '" + endDate + "'))";
end: moment.utc(task.DueDate).add("1", "days")
}; $.ajax({
}); url: this.context.pageContext.web.absoluteUrl + restQuery,
type: "GET",
callback(events); dataType: "json",
}); headers: {
} Accept: "application/json;odata=nometadata"
}); }
} })
.done((data: { value: ITask[] }, textStatus: string, jqXHR: JQueryXHR) => {
private updateTask(id: number, startDate: moment.Moment, dueDate: moment.Moment): void { let personColors: { [person: string]: string; } = {};
// subtract the previously added day to the date to store correct date var colorNo = 0;
const sDate: string = moment.utc(startDate).add("-1", "days").format('YYYY-MM-DD') + "T" +
startDate.format("hh:mm") + ":00Z"; var events = data.value.map((task: ITask): any => {
if (!dueDate) { var assignedTo = task.AssignedTo.map((person: { Title: string }): string => {
dueDate = startDate; return person.Title;
} }).join(', ');
const dDate: string = moment.utc(dueDate).add("-1", "days").format('YYYY-MM-DD') + "T" +
dueDate.format("hh:mm") + ":00Z"; var color = personColors[assignedTo];
if (!color) {
$.ajax({ color = COLORS[colorNo++];
url: this.context.pageContext.web.absoluteUrl + '/_api/contextinfo', personColors[assignedTo] = color;
type: 'POST', }
headers: { if (colorNo >= COLORS.length) {
'Accept': 'application/json;odata=nometadata' colorNo = 0;
} }
})
.then((data: { FormDigestValue: string }, textStatus: string, jqXHR: JQueryXHR): JQueryXHR => { return {
return $.ajax({ title: task.Title + " - " + assignedTo,
url: `${this.context.pageContext.web.absoluteUrl}\ id: task.ID,
/_api/Web/Lists/getByTitle('${escape(this.properties.listName)}')/Items(${id})`, color: color, // specify the background color and border color can also create a class and use className parameter.
type: 'POST', start: moment.utc(task.StartDate).add("1", "days"),
data: JSON.stringify({ end: moment.utc(task.DueDate).add("1", "days") // add one day to end date so that calendar properly shows event ending on that day
StartDate: sDate, };
DueDate: dDate, });
}),
headers: { callback(events);
Accept: "application/json;odata=nometadata", });
"Content-Type": "application/json;odata=nometadata", }
"X-RequestDigest": data.FormDigestValue, });
"IF-MATCH": "*", }
"X-Http-Method": "PATCH"
} private updateTask(id: number, startDate: moment.Moment, dueDate: moment.Moment) {
}); // subtract the previously added day to the date to store correct date
}) var sDate = moment.utc(startDate).add("-1", "days").format('YYYY-MM-DD') + "T" +
.done((data: {}, textStatus: string, jqXHR: JQueryXHR): void => { startDate.format("hh:mm") + ":00Z";
alert("Update Successful"); if (!dueDate) {
}) dueDate = startDate;
.fail((jqXHR: JQueryXHR, textStatus: string, errorThrown: string): void => { }
alert("Update Failed"); var dDate = moment.utc(dueDate).add("-1", "days").format('YYYY-MM-DD') + "T" +
}) dueDate.format("hh:mm") + ":00Z";
.always((): void => {
this.displayTasks(); $.ajax({
}); url: this.context.pageContext.web.absoluteUrl + '/_api/contextinfo',
} type: 'POST',
headers: {
protected get dataVersion(): Version { 'Accept': 'application/json;odata=nometadata'
return Version.parse('1.0'); }
} })
.then((data: { FormDigestValue: string }, textStatus: string, jqXHR: JQueryXHR): JQueryXHR => {
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration { return $.ajax({
return { url: this.context.pageContext.web.absoluteUrl +
pages: [ "/_api/Web/Lists/getByTitle('" + escape(this.properties.listName) + "')/Items(" + id + ")",
{ type: 'POST',
header: { data: JSON.stringify({
description: strings.PropertyPaneDescription StartDate: sDate,
}, DueDate: dDate,
groups: [ }),
{ headers: {
groupName: strings.BasicGroupName, Accept: "application/json;odata=nometadata",
groupFields: [ "Content-Type": "application/json;odata=nometadata",
PropertyPaneTextField('listName', { "X-RequestDigest": data.FormDigestValue,
label: strings.ListNameFieldLabel "IF-MATCH": "*",
}) "X-Http-Method": "PATCH"
] }
} });
] })
} .done((data: {}, textStatus: string, jqXHR: JQueryXHR): void => {
] alert("Update Successful");
}; })
} .fail((jqXHR: JQueryXHR, textStatus: string, errorThrown: string) => {
alert("Update Failed");
protected get disableReactivePropertyChanges(): boolean { })
return true; .always((): void => {
} this.displayTasks();
} });
// ...
}
}

View File

@ -1,7 +1,7 @@
define([], function() { define([], function() {
return { return {
"PropertyPaneDescription": "Tasks calendar settings", "PropertyPaneDescription": "Description",
"BasicGroupName": "Data", "BasicGroupName": "Group Name",
"ListNameFieldLabel": "List name" "ListNameFieldLabel": "List name"
} }
}); });

View File

@ -1,10 +1,10 @@
declare interface ITasksCalendarStrings { declare interface ITasksCalendarWebPartStrings {
PropertyPaneDescription: string; PropertyPaneDescription: string;
BasicGroupName: string; BasicGroupName: string;
ListNameFieldLabel: string; ListNameFieldLabel: string;
} }
declare module 'tasksCalendarStrings' { declare module 'TasksCalendarWebPartStrings' {
const strings: ITasksCalendarStrings; const strings: ITasksCalendarWebPartStrings;
export = strings; export = strings;
} }

View File

@ -0,0 +1,124 @@
var moment = require('moment');
var PATH_TO_DISPFORM = window.webAbsoluteUrl + "/Lists/Tasks/DispForm.aspx";
var TASK_LIST = "Tasks";
var COLORS = ['#466365', '#B49A67', '#93B7BE', '#E07A5F', '#849483', '#084C61', '#DB3A34'];
displayTasks();
function displayTasks() {
$('#calendar').fullCalendar('destroy');
$('#calendar').fullCalendar({
weekends: false,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
displayEventTime: false,
// open up the display form when a user clicks on an event
eventClick: function (calEvent, jsEvent, view) {
window.location = PATH_TO_DISPFORM + "?ID=" + calEvent.id;
},
editable: true,
timezone: "UTC",
droppable: true, // this allows things to be dropped onto the calendar
// update the end date when a user drags and drops an event
eventDrop: function (event, delta, revertFunc) {
updateTask(event.id, event.start, event.end);
},
// put the events on the calendar
events: function (start, end, timezone, callback) {
var startDate = start.format('YYYY-MM-DD');
var endDate = end.format('YYYY-MM-DD');
var restQuery = "/_api/Web/Lists/GetByTitle('" + TASK_LIST + "')/items?$select=ID,Title,\
Status,StartDate,DueDate,AssignedTo/Title&$expand=AssignedTo&\
$filter=((DueDate ge '" + startDate + "' and DueDate le '" + endDate + "')or(StartDate ge '" + startDate + "' and StartDate le '" + endDate + "'))";
$.ajax({
url: window.webAbsoluteUrl + restQuery,
type: "GET",
dataType: "json",
headers: {
Accept: "application/json;odata=nometadata"
}
})
.done(function (data, textStatus, jqXHR) {
var personColors = {};
var colorNo = 0;
var events = data.value.map(function (task) {
var assignedTo = task.AssignedTo.map(function (person) {
return person.Title;
}).join(', ');
var color = personColors[assignedTo];
if (!color) {
color = COLORS[colorNo++];
personColors[assignedTo] = color;
}
if (colorNo >= COLORS.length) {
colorNo = 0;
}
return {
title: task.Title + " - " + assignedTo,
id: task.ID,
color: color, // specify the background color and border color can also create a class and use className parameter.
start: moment.utc(task.StartDate).add("1", "days"),
end: moment.utc(task.DueDate).add("1", "days") // add one day to end date so that calendar properly shows event ending on that day
};
});
callback(events);
});
}
});
}
function updateTask(id, startDate, dueDate) {
// subtract the previously added day to the date to store correct date
var sDate = moment.utc(startDate).add("-1", "days").format('YYYY-MM-DD') + "T" +
startDate.format("hh:mm") + ":00Z";
if (!dueDate) {
dueDate = startDate;
}
var dDate = moment.utc(dueDate).add("-1", "days").format('YYYY-MM-DD') + "T" +
dueDate.format("hh:mm") + ":00Z";
$.ajax({
url: window.webAbsoluteUrl + '/_api/contextinfo',
type: 'POST',
headers: {
'Accept': 'application/json;odata=nometadata'
}
})
.then(function (data, textStatus, jqXHR) {
return $.ajax({
url: window.webAbsoluteUrl +
"/_api/Web/Lists/getByTitle('" + TASK_LIST + "')/Items(" + id + ")",
type: 'POST',
data: JSON.stringify({
StartDate: sDate,
DueDate: dDate,
}),
headers: {
Accept: "application/json;odata=nometadata",
"Content-Type": "application/json;odata=nometadata",
"X-RequestDigest": data.FormDigestValue,
"IF-MATCH": "*",
"X-Http-Method": "PATCH"
}
});
})
.done(function (data, textStatus, jqXHR) {
alert("Update Successful");
})
.fail(function (jqXHR, textStatus, errorThrown) {
alert("Update Failed");
})
.always(function () {
displayTasks();
});
}

View File

@ -1,9 +0,0 @@
/// <reference types="mocha" />
import { assert } from 'chai';
describe('TasksCalendarWebPart', () => {
it('should do something', () => {
assert.ok(true);
});
});

View File

@ -1,16 +1,38 @@
{ {
"compilerOptions": { "extends": "./node_modules/@microsoft/rush-stack-compiler-3.3/includes/tsconfig-web.json",
"target": "es5", "compilerOptions": {
"forceConsistentCasingInFileNames": true, "target": "es5",
"module": "commonjs", "forceConsistentCasingInFileNames": true,
"jsx": "react", "module": "esnext",
"declaration": true, "moduleResolution": "node",
"sourceMap": true, "jsx": "react",
"experimentalDecorators": true, "declaration": true,
"types": [ "sourceMap": true,
"es6-promise", "experimentalDecorators": true,
"es6-collections", "skipLibCheck": true,
"webpack-env" "outDir": "lib",
] "inlineSources": false,
} "strictNullChecks": false,
} "noUnusedLocals": false,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft"
],
"types": [
"es6-promise",
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection"
]
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules",
"lib"
]
}

View File

@ -1,3 +1,30 @@
{ {
"rulesDirectory": "./config" "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
}
} }

View File

@ -1,11 +0,0 @@
// Type definitions for Microsoft ODSP projects
// Project: ODSP
/* Global definition for UNIT_TEST builds
Code that is wrapped inside an if(UNIT_TEST) {...}
block will not be included in the final bundle when the
--ship flag is specified */
declare const UNIT_TEST: boolean;
/* Global defintion for SPO builds */
declare const DATACENTER: boolean;

View File

@ -1 +0,0 @@
/// <reference path="@ms/odsp.d.ts" />

View File

@ -1,8 +1,12 @@
{ {
"@microsoft/generator-sharepoint": { "@microsoft/generator-sharepoint": {
"version": "1.1.0", "isCreatingSolution": true,
"libraryName": "spfx-js-fullcalendar", "environment": "spo",
"libraryId": "e6a89529-5fef-4883-b84c-c6bc27b0bfb0", "version": "1.10.0",
"environment": "spo" "libraryName": "fullcalendar-taskscalendar",
"libraryId": "c8f6ee3a-f24a-4b6b-b1bf-ce7121f65205",
"packageManager": "npm",
"isDomainIsolated": false,
"componentType": "webpart"
} }
} }

View File

@ -1,18 +1,26 @@
# Tutorial: Migrate jQuery and FullCalendar solution built using Script Editor Web Part to SharePoint Framework ## fullcalendar-taskscalendar
Sample jQuery FullCalendar solution migrated from a Script Editor Web Part to the SharePoint Framework. This is where you include your WebPart documentation.
![jQuery FullCalendar solution built using Script Editor Web Part](https://devofficecdn.azureedge.net/sharepointdocumentation/images/fullcalendar-sewp.png) ### Building the code
More information about the solution is available at [https://docs.microsoft.com/sharepoint/dev/spfx/web-parts/guidance/migrate-jquery-fullcalendar-script-to-spfx](https://docs.microsoft.com/sharepoint/dev/spfx/web-parts/guidance/migrate-jquery-fullcalendar-script-to-spfx). ```bash
git clone the repo
## Minimal Path to Awesome npm i
npm i -g gulp
- In the command line run: gulp
- `npm i` ```
- `gulp serve --nobrowser`
- In the web browser navigate to the hosted version of the SharePoint workbench located in the same site as where the Tasks list is, eg. *https://contoso.sharepoint.com/sites/team/_layouts/15/workbench.aspx*. This package produces the following:
[More information](../README.md) * lib/* - intermediate-stage commonjs build artifacts
* dist/* - the bundled script, along with other resources
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/tutorial-migrate-fullcalendar/04" /> * deploy/* - all resources which should be uploaded to a CDN.
### Build options
gulp clean - TODO
gulp test - TODO
gulp serve - TODO
gulp bundle - TODO
gulp package-solution - TODO

View File

@ -1,17 +1,31 @@
{ {
"entries": [ "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
{ "version": "2.0",
"entry": "./lib/webparts/tasksCalendar/TasksCalendarWebPart.js", "bundles": {
"manifest": "./src/webparts/tasksCalendar/TasksCalendarWebPart.manifest.json", "tasks-calendar-web-part": {
"outputPath": "./dist/tasks-calendar.bundle.js" "components": [
{
"entrypoint": "./lib/webparts/tasksCalendar/TasksCalendarWebPart.js",
"manifest": "./src/webparts/tasksCalendar/TasksCalendarWebPart.manifest.json"
}
]
} }
], },
"externals": { "externals": {
"jquery": "https://code.jquery.com/jquery-1.11.1.min.js", "jquery": {
"moment": "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js", "path": "https://code.jquery.com/jquery-1.11.1.min.js",
"fullcalendar": "https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js" "globalName": "jQuery"
},
"fullcalendar": {
"path": "https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js",
"globalName": "jQuery",
"globalDependencies": [
"jquery"
]
},
"moment": "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"
}, },
"localizedResources": { "localizedResources": {
"tasksCalendarStrings": "webparts/tasksCalendar/loc/{locale}.js" "TasksCalendarWebPartStrings": "lib/webparts/tasksCalendar/loc/{locale}.js"
} }
} }

View File

@ -1,3 +1,4 @@
{ {
"deployCdnPath": "temp/deploy" "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json",
} "deployCdnPath": "temp/deploy"
}

View File

@ -1,6 +1,7 @@
{ {
"workingDir": "./temp/deploy/", "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"account": "<!-- STORAGE ACCOUNT NAME -->", "workingDir": "./temp/deploy/",
"container": "spfx-js-fullcalendar", "account": "<!-- STORAGE ACCOUNT NAME -->",
"accessKey": "<!-- ACCESS KEY -->" "container": "fullcalendar-taskscalendar",
"accessKey": "<!-- ACCESS KEY -->"
} }

View File

@ -1,10 +1,13 @@
{ {
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": { "solution": {
"name": "spfx-js-fullcalendar-client-side-solution", "name": "fullcalendar-taskscalendar-client-side-solution",
"id": "e6a89529-5fef-4883-b84c-c6bc27b0bfb0", "id": "c8f6ee3a-f24a-4b6b-b1bf-ce7121f65205",
"version": "1.0.0.0" "version": "1.0.0.0",
"includeClientSideAssets": true,
"isDomainIsolated": false
}, },
"paths": { "paths": {
"zippedPackage": "solution/spfx-js-fullcalendar.sppkg" "zippedPackage": "solution/fullcalendar-taskscalendar.sppkg"
} }
} }

View File

@ -1,7 +1,8 @@
{ {
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
"port": 4321, "port": 4321,
"initialPage": "https://localhost:5432/workbench",
"https": true, "https": true,
"initialPage": "https://localhost:5432/workbench",
"api": { "api": {
"port": 5432, "port": 5432,
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/" "entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"

View File

@ -1,45 +0,0 @@
{
// Display errors as warnings
"displayAsWarning": true,
// The TSLint task may have been configured with several custom lint rules
// before this config file is read (for example lint rules from the tslint-microsoft-contrib
// project). If true, this flag will deactivate any of these rules.
"removeExistingRules": true,
// When true, the TSLint task is configured with some default TSLint "rules.":
"useDefaultConfigAsBase": false,
// Since removeExistingRules=true and useDefaultConfigAsBase=false, there will be no lint rules
// which are active, other than the list of rules below.
"lintConfig": {
// Opt-in to Lint rules which help to eliminate bugs in JavaScript
"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-case": true,
"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-unused-imports": true,
"no-use-before-declare": true,
"no-with-statement": true,
"semicolon": true,
"trailing-comma": false,
"typedef": false,
"typedef-whitespace": false,
"use-named-parameter": true,
"valid-typeof": true,
"variable-name": false,
"whitespace": false
}
}
}

View File

@ -1,3 +1,4 @@
{ {
"cdnBasePath": "<!-- PATH TO CDN -->" "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->"
} }

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
const gulp = require('gulp'); const build = require('@microsoft/sp-build-web');
const build = require('@microsoft/sp-build-web');
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
build.initialize(gulp);
build.initialize(require('gulp'));

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +1,36 @@
{ {
"name": "spfx-js-fullcalendar", "name": "fullcalendar-taskscalendar",
"version": "0.0.1", "version": "0.0.1",
"private": true, "private": true,
"main": "lib/index.js",
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
}, },
"author": {
"name": "Waldek Mastykarz",
"url": "https://blog.mastykarz.nl"
},
"dependencies": {
"@microsoft/sp-core-library": "~1.1.0",
"@microsoft/sp-webpart-base": "~1.1.0",
"@types/webpack-env": ">=1.12.1 <1.14.0",
"moment": "^2.18.1"
},
"devDependencies": {
"@microsoft/sp-build-web": "~1.1.0",
"@microsoft/sp-module-interfaces": "~1.1.0",
"@microsoft/sp-webpart-workbench": "~1.1.0",
"@types/chai": ">=3.4.34 <3.6.0",
"@types/fullcalendar": "^2.7.44",
"@types/jquery": "^1.10.32",
"@types/mocha": ">=2.2.33 <2.6.0",
"gulp": "~3.9.1"
},
"scripts": { "scripts": {
"build": "gulp bundle", "build": "gulp bundle",
"clean": "gulp clean", "clean": "gulp clean",
"test": "gulp test" "test": "gulp test"
},
"dependencies": {
"@microsoft/sp-core-library": "1.10.0",
"@microsoft/sp-lodash-subset": "1.10.0",
"@microsoft/sp-office-ui-fabric-core": "1.10.0",
"@microsoft/sp-property-pane": "1.10.0",
"@microsoft/sp-webpart-base": "1.10.0",
"@types/es6-promise": "0.0.33",
"@types/webpack-env": "1.13.1",
"moment": "^2.27.0"
},
"devDependencies": {
"@microsoft/rush-stack-compiler-3.3": "0.3.5",
"@microsoft/sp-build-web": "1.10.0",
"@microsoft/sp-module-interfaces": "1.10.0",
"@microsoft/sp-tslint-rules": "1.10.0",
"@microsoft/sp-webpart-workbench": "1.10.0",
"@types/chai": "3.4.34",
"@types/jquery": "^1.10.35",
"@types/mocha": "2.2.38",
"ajv": "~5.2.2",
"gulp": "~3.9.1"
} }
} }

Some files were not shown because too many files have changed in this diff Show More