Merge branch 'dev'
This commit is contained in:
commit
6fa69075cc
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
// The number of spaces a tab is equal to.
|
|
||||||
"editor.tabSize": 2,
|
|
||||||
|
|
||||||
// When enabled, will trim trailing whitespace when you save a file.
|
|
||||||
"files.trimTrailingWhitespace": true,
|
|
||||||
|
|
||||||
// Controls if the editor should automatically close brackets after opening them
|
|
||||||
"editor.autoClosingBrackets": false,
|
|
||||||
|
|
||||||
// Configure glob patterns for excluding files and folders.
|
|
||||||
"search.exclude": {
|
|
||||||
"**/bower_components": true,
|
|
||||||
"**/node_modules": true,
|
|
||||||
"coverage": true,
|
|
||||||
"dist": true,
|
|
||||||
"lib-amd": true,
|
|
||||||
"lib": true,
|
|
||||||
"temp": true
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
{
|
|
||||||
// See http://go.microsoft.com/fwlink/?LinkId=733558
|
|
||||||
// for the documentation about the tasks.json format
|
|
||||||
"version": "0.1.0",
|
|
||||||
"command": "gulp",
|
|
||||||
"isShellCommand": true,
|
|
||||||
"showOutput": "always",
|
|
||||||
"args": [
|
|
||||||
"--no-color"
|
|
||||||
],
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"taskName": "bundle",
|
|
||||||
"isBuildCommand": true,
|
|
||||||
"problemMatcher": [
|
|
||||||
"$tsc"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"taskName": "test",
|
|
||||||
"isTestCommand": true,
|
|
||||||
"problemMatcher": [
|
|
||||||
"$tsc"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"taskName": "serve",
|
|
||||||
"isWatching": true,
|
|
||||||
"problemMatcher": [
|
|
||||||
"$tsc"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,59 +0,0 @@
|
||||||
# Angular & ngOfficeUIFabric Client-Side Web Part
|
|
||||||
|
|
||||||
## Summary
|
|
||||||
|
|
||||||
Sample Web Part illustrating using Angular and [ngOfficeUIFabric](http://ngofficeuifabric.com/) with the SharePoint Framework.
|
|
||||||
You can find a video recording walk-through this sample from [SharePoint PnP YouTube channel](https://www.youtube.com/watch?v=FS-_0KENJkI).
|
|
||||||
|
|
||||||
![Sample To do SharePoint Framework Client-Side Web Part built using Angular and ngOfficeUIFabric](./assets/preview.png)
|
|
||||||
|
|
||||||
## Used SharePoint Framework Version
|
|
||||||
![drop](https://img.shields.io/badge/drop-drop2-red.svg)
|
|
||||||
|
|
||||||
## Applies to
|
|
||||||
|
|
||||||
* [SharePoint Framework Developer Preview](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)
|
|
||||||
|
|
||||||
## Solution
|
|
||||||
|
|
||||||
Solution|Author(s)
|
|
||||||
--------|---------
|
|
||||||
angular-ngofficeuifabric-todo|Waldek Mastykarz (MVP, Rencore, @waldekm)
|
|
||||||
|
|
||||||
## Version history
|
|
||||||
|
|
||||||
Version|Date|Comments
|
|
||||||
-------|----|--------
|
|
||||||
1.1|September 9, 2016|Updated sample to SPFx v0.2.0 and changed to loading Angular and ngOfficeUIFabric from CDN
|
|
||||||
1.0|August 29, 2016|Initial release
|
|
||||||
|
|
||||||
## 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 repo
|
|
||||||
- in the command line run:
|
|
||||||
- `npm i`
|
|
||||||
- `tsd install`
|
|
||||||
- `gulp serve`
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
The To do Web Part is a sample Client-Side Web Part built on the SharePoint Framework built using Angular and ngOfficeUIFabric.
|
|
||||||
|
|
||||||
This Web Part illustrates the following concepts on top of the SharePoint Framework:
|
|
||||||
|
|
||||||
- using Angular v1.x with TypeScript for building SharePoint Framework Client-Side Web Parts
|
|
||||||
- using ngOfficeUIFabric for styling Angular v1.x Client-Side Web Parts
|
|
||||||
- including Angular and ngOfficeUIFabric in the Web Part bundle
|
|
||||||
- using a newer version of Office UI Fabric for styling Client-Side Web Parts
|
|
||||||
- loading CSS stylesheets from CDN
|
|
||||||
- using non-reactive Web Part Property Pane
|
|
||||||
- using conditional rendering for one-time Web Part setup
|
|
||||||
- passing Web Part configuration to Angular and reacting to configuration changes
|
|
||||||
|
|
||||||
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/samples/angular-ngofficeuifabric-todo" />
|
|
|
@ -1,86 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="GulpToVs" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{662c096d-0963-46c1-a7cd-5cafa9ccb405}</ProjectGuid>
|
|
||||||
<ProjectHome />
|
|
||||||
<ProjectView>ProjectFiles</ProjectView>
|
|
||||||
<StartupFile>node_modules\gulp\bin\gulp.js</StartupFile>
|
|
||||||
<WorkingDirectory>.</WorkingDirectory>
|
|
||||||
<OutputPath>.</OutputPath>
|
|
||||||
<ProjectTypeGuids>{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}</ProjectTypeGuids>
|
|
||||||
<TypeScriptSourceMap>true</TypeScriptSourceMap>
|
|
||||||
<TypeScriptModuleKind>CommonJS</TypeScriptModuleKind>
|
|
||||||
<EnableTypeScript>false</EnableTypeScript>
|
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
|
||||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
|
||||||
<ScriptArguments>serve</ScriptArguments>
|
|
||||||
<StartWebBrowser>True</StartWebBrowser>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'" />
|
|
||||||
<Target Name="GulpToVs">
|
|
||||||
<Message Text="Running gulp2vs.js" Importance="normal" />
|
|
||||||
<Exec Command="CMD.EXE /c node $(MSBuildThisFileDirectory)\node_modules\@microsoft\npmx\lib\gulp2vs.js" />
|
|
||||||
</Target>
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="*.js" />
|
|
||||||
<Content Include="*.json" />
|
|
||||||
<Content Include="*.md" />
|
|
||||||
<Content Include="config\**\*.json" />
|
|
||||||
<Content Include="docs\*.md" />
|
|
||||||
<Content Include="sharepoint\feature_xml\**\*.*" />
|
|
||||||
<Content Include="src\**\*.html" />
|
|
||||||
<Content Include="src\**\*.js" />
|
|
||||||
<Content Include="src\**\*.json" />
|
|
||||||
<Content Include="src\**\*.less" />
|
|
||||||
<Content Include="src\**\*.resx" />
|
|
||||||
<Content Include="src\**\*.scss" />
|
|
||||||
<Content Include="src\**\*.ts" />
|
|
||||||
<Content Include="src\**\*.tsx" />
|
|
||||||
<Content Include="typings\**\*.ts" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<!--Do not delete the following Import Project. While this appears to do nothing it is a marker for setting TypeScript properties before our import that depends on them.-->
|
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="False" />
|
|
||||||
<Import Project="$(VSToolsPath)\Node.js Tools\Microsoft.NodejsTools.targets" />
|
|
||||||
<ProjectExtensions>
|
|
||||||
<VisualStudio>
|
|
||||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
|
||||||
<WebProjectProperties>
|
|
||||||
<UseIIS>False</UseIIS>
|
|
||||||
<AutoAssignPort>True</AutoAssignPort>
|
|
||||||
<DevelopmentServerPort>0</DevelopmentServerPort>
|
|
||||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
|
||||||
<IISUrl>http://localhost:48022/</IISUrl>
|
|
||||||
<NTLMAuthentication>False</NTLMAuthentication>
|
|
||||||
<UseCustomServer>True</UseCustomServer>
|
|
||||||
<CustomServerUrl>http://localhost:1337</CustomServerUrl>
|
|
||||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
|
||||||
</WebProjectProperties>
|
|
||||||
</FlavorProperties>
|
|
||||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}" User="">
|
|
||||||
<WebProjectProperties>
|
|
||||||
<StartPageUrl>
|
|
||||||
</StartPageUrl>
|
|
||||||
<StartAction>CurrentPage</StartAction>
|
|
||||||
<AspNetDebugging>True</AspNetDebugging>
|
|
||||||
<SilverlightDebugging>False</SilverlightDebugging>
|
|
||||||
<NativeDebugging>False</NativeDebugging>
|
|
||||||
<SQLDebugging>False</SQLDebugging>
|
|
||||||
<ExternalProgram>
|
|
||||||
</ExternalProgram>
|
|
||||||
<StartExternalURL>
|
|
||||||
</StartExternalURL>
|
|
||||||
<StartCmdLineArguments>
|
|
||||||
</StartCmdLineArguments>
|
|
||||||
<StartWorkingDirectory>
|
|
||||||
</StartWorkingDirectory>
|
|
||||||
<EnableENC>False</EnableENC>
|
|
||||||
<AlwaysStartWebServerOnDebug>False</AlwaysStartWebServerOnDebug>
|
|
||||||
</WebProjectProperties>
|
|
||||||
</FlavorProperties>
|
|
||||||
</VisualStudio>
|
|
||||||
</ProjectExtensions>
|
|
||||||
</Project>
|
|
Binary file not shown.
Before Width: | Height: | Size: 48 KiB |
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
"entries": [
|
|
||||||
{
|
|
||||||
"entry": "./lib/webparts/toDo/ToDoWebPart.js",
|
|
||||||
"manifest": "./src/webparts/toDo/ToDoWebPart.manifest.json",
|
|
||||||
"outputPath": "./dist/to-do.bundle.js"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"externals": {
|
|
||||||
"@microsoft/sp-client-base": "node_modules/@microsoft/sp-client-base/dist/sp-client-base.js",
|
|
||||||
"@microsoft/sp-client-preview": "node_modules/@microsoft/sp-client-preview/dist/sp-client-preview.js",
|
|
||||||
"@microsoft/sp-lodash-subset": "node_modules/@microsoft/sp-lodash-subset/dist/sp-lodash-subset.js",
|
|
||||||
"office-ui-fabric-react": "node_modules/office-ui-fabric-react/dist/office-ui-fabric-react.js",
|
|
||||||
"react": "node_modules/react/dist/react.min.js",
|
|
||||||
"react-dom": "node_modules/react-dom/dist/react-dom.min.js",
|
|
||||||
"react-dom/server": "node_modules/react-dom/dist/react-dom-server.min.js",
|
|
||||||
"angular": {
|
|
||||||
"path": "https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.min.js",
|
|
||||||
"globalName": "angular"
|
|
||||||
},
|
|
||||||
"ng-office-ui-fabric": "https://cdnjs.cloudflare.com/ajax/libs/ngOfficeUiFabric/0.12.3/ngOfficeUiFabric.js"
|
|
||||||
},
|
|
||||||
"localizedResources": {
|
|
||||||
"toDoStrings": "webparts/toDo/loc/{locale}.js"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"solution": {
|
|
||||||
"name": "angular-ngofficeuifabric-todo-client-side-solution",
|
|
||||||
"id": "662c096d-0963-46c1-a7cd-5cafa9ccb405",
|
|
||||||
"version": "1.0.0.0"
|
|
||||||
},
|
|
||||||
"paths": {
|
|
||||||
"zippedPackage": "angular-ngofficeuifabric-todo.spapp"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"textMatch": ["src/**/*.template.html"]
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
"lintConfig": {
|
|
||||||
"rules": {
|
|
||||||
"comment-format": false,
|
|
||||||
"curly": false,
|
|
||||||
"indent": false,
|
|
||||||
"interface-name": false,
|
|
||||||
"max-line-length": false,
|
|
||||||
"member-ordering": false,
|
|
||||||
"no-any": false,
|
|
||||||
"no-bitwise": false,
|
|
||||||
"no-consecutive-blank-lines": false,
|
|
||||||
"no-constant-condition": false,
|
|
||||||
"no-debugger": false,
|
|
||||||
"no-empty": false,
|
|
||||||
"no-null-keyword": false,
|
|
||||||
"no-string-literal": false,
|
|
||||||
"no-trailing-whitespace": false,
|
|
||||||
"no-var-keyword": false,
|
|
||||||
"one-line": false,
|
|
||||||
"quotemark": false,
|
|
||||||
"radix": false,
|
|
||||||
"triple-equals": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-ngofficeuifabric-todo",
|
|
||||||
"version": "1.1.0",
|
|
||||||
"private": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.10.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@microsoft/sp-client-base": "~0.2.0",
|
|
||||||
"@microsoft/sp-client-preview": "~0.2.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@microsoft/sp-build-web": "~0.5.0",
|
|
||||||
"@microsoft/sp-module-interfaces": "~0.2.0",
|
|
||||||
"@microsoft/sp-webpart-workbench": "~0.2.0",
|
|
||||||
"gulp": "~3.9.1"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build": "gulp bundle",
|
|
||||||
"clean": "gulp nuke",
|
|
||||||
"test": "gulp test"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
var context = require.context('.', true, /.+\.test\.js?$/);
|
|
||||||
|
|
||||||
context.keys().forEach(context);
|
|
||||||
|
|
||||||
module.exports = context;
|
|
|
@ -1,10 +0,0 @@
|
||||||
.toDoWebPart {
|
|
||||||
.loading {
|
|
||||||
margin: 0 auto;
|
|
||||||
width: 6em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.done [class=ms-ListItem-primaryText] {
|
|
||||||
text-decoration: line-through;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,90 +0,0 @@
|
||||||
import {
|
|
||||||
BaseClientSideWebPart,
|
|
||||||
IPropertyPaneSettings,
|
|
||||||
IWebPartContext,
|
|
||||||
PropertyPaneToggle
|
|
||||||
} from '@microsoft/sp-client-preview';
|
|
||||||
|
|
||||||
import ModuleLoader from '@microsoft/sp-module-loader';
|
|
||||||
|
|
||||||
import styles from './ToDo.module.scss';
|
|
||||||
import * as strings from 'toDoStrings';
|
|
||||||
import { IToDoWebPartProps } from './IToDoWebPartProps';
|
|
||||||
|
|
||||||
import * as angular from 'angular';
|
|
||||||
import './app/app-module';
|
|
||||||
|
|
||||||
export default class ToDoWebPart extends BaseClientSideWebPart<IToDoWebPartProps> {
|
|
||||||
private $injector: ng.auto.IInjectorService;
|
|
||||||
|
|
||||||
public constructor(context: IWebPartContext) {
|
|
||||||
super(context);
|
|
||||||
|
|
||||||
ModuleLoader.loadCss('https://appsforoffice.microsoft.com/fabric/2.6.1/fabric.min.css');
|
|
||||||
ModuleLoader.loadCss('https://appsforoffice.microsoft.com/fabric/2.6.1/fabric.components.min.css');
|
|
||||||
}
|
|
||||||
|
|
||||||
public render(): void {
|
|
||||||
if (this.renderedOnce === false) {
|
|
||||||
this.domElement.innerHTML = `
|
|
||||||
<div class="${styles.toDoWebPart}">
|
|
||||||
<div data-ng-controller="HomeController as vm">
|
|
||||||
<div class="${styles.loading}" ng-show="vm.isLoading">
|
|
||||||
<uif-spinner>Loading...</uif-spinner>
|
|
||||||
</div>
|
|
||||||
<div id="entryform" ng-show="vm.isLoading === false">
|
|
||||||
<uif-textfield uif-label="New to do:" uif-underlined ng-model="vm.newItem" ng-keydown="vm.todoKeyDown($event)"></uif-textfield>
|
|
||||||
</div>
|
|
||||||
<uif-list id="items" ng-show="vm.isLoading === false" >
|
|
||||||
<uif-list-item ng-repeat="todo in vm.todoCollection" uif-item="todo" ng-class="{'${styles.done}': todo.done}">
|
|
||||||
<uif-list-item-primary-text>{{todo.title}}</uif-list-item-primary-text>
|
|
||||||
<uif-list-item-actions>
|
|
||||||
<uif-list-item-action ng-click="vm.completeTodo(todo)" ng-show="todo.done === false">
|
|
||||||
<uif-icon uif-type="check"></uif-icon>
|
|
||||||
</uif-list-item-action>
|
|
||||||
<uif-list-item-action ng-click="vm.undoTodo(todo)" ng-show="todo.done">
|
|
||||||
<uif-icon uif-type="reactivate"></uif-icon>
|
|
||||||
</uif-list-item-action>
|
|
||||||
<uif-list-item-action ng-click="vm.deleteTodo(todo)">
|
|
||||||
<uif-icon uif-type="trash"></uif-icon>
|
|
||||||
</uif-list-item-action>
|
|
||||||
</uif-list-item-actions>
|
|
||||||
</uif-list-item>
|
|
||||||
</uif-list>
|
|
||||||
</div>
|
|
||||||
</div>`;
|
|
||||||
|
|
||||||
this.$injector = angular.bootstrap(this.domElement, ['todoapp']);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$injector.get('$rootScope').$broadcast('configurationChanged', {
|
|
||||||
hideFinishedTasks: this.properties.hideFinishedTasks
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected get propertyPaneSettings(): IPropertyPaneSettings {
|
|
||||||
return {
|
|
||||||
pages: [
|
|
||||||
{
|
|
||||||
header: {
|
|
||||||
description: strings.PropertyPaneDescription
|
|
||||||
},
|
|
||||||
groups: [
|
|
||||||
{
|
|
||||||
groupName: strings.ViewGroupName,
|
|
||||||
groupFields: [
|
|
||||||
PropertyPaneToggle('hideFinishedTasks', {
|
|
||||||
label: strings.HideFinishedTasksFieldLabel
|
|
||||||
})
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected get disableReactivePropertyChanges(): boolean {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es5",
|
|
||||||
"module": "commonjs",
|
|
||||||
"jsx": "react",
|
|
||||||
"declaration": true,
|
|
||||||
"sourceMap": true
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"version": "v4",
|
|
||||||
"repo": "borisyankov/DefinitelyTyped",
|
|
||||||
"ref": "master",
|
|
||||||
"path": "typings",
|
|
||||||
"bundle": "typings/tsd.d.ts",
|
|
||||||
"installed": {
|
|
||||||
"angularjs/angular.d.ts": {
|
|
||||||
"commit": "5d1623c5cce5a01f8e55dece86e06fe2c32dc763"
|
|
||||||
},
|
|
||||||
"jquery/jquery.d.ts": {
|
|
||||||
"commit": "5d1623c5cce5a01f8e55dece86e06fe2c32dc763"
|
|
||||||
},
|
|
||||||
"combokeys/combokeys.d.ts": {
|
|
||||||
"commit": "5d1623c5cce5a01f8e55dece86e06fe2c32dc763"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Type definitions for webpack in Microsoft ODSP projects
|
|
||||||
// Project: ODSP-WEBPACK
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This definition of webpack require overrides all other definitions of require in our toolchain
|
|
||||||
* Make sure all other definitions of require are commented out e.g. in node.d.ts
|
|
||||||
*/
|
|
||||||
declare var require: {
|
|
||||||
(path: string): any;
|
|
||||||
(paths: string[], callback: (...modules: any[]) => void): void;
|
|
||||||
resolve: (id: string) => string;
|
|
||||||
ensure: (paths: string[], callback: (require: <T>(path: string) => T) => void, path: string) => void;
|
|
||||||
};
|
|
|
@ -1,10 +0,0 @@
|
||||||
// Type definitions for Microsoft ODSP projects
|
|
||||||
// Project: ODSP
|
|
||||||
|
|
||||||
/// <reference path="odsp-webpack.d.ts" />
|
|
||||||
|
|
||||||
/* Global definition for DEBUG builds */
|
|
||||||
declare const DEBUG: boolean;
|
|
||||||
|
|
||||||
/* Global definition for UNIT_TEST builds */
|
|
||||||
declare const UNIT_TEST: boolean;
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,15 +0,0 @@
|
||||||
// Type definitions for assertion-error 1.0.0
|
|
||||||
// Project: https://github.com/chaijs/assertion-error
|
|
||||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
declare module 'assertion-error' {
|
|
||||||
class AssertionError implements Error {
|
|
||||||
constructor(message: string, props?: any, ssf?: Function);
|
|
||||||
name: string;
|
|
||||||
message: string;
|
|
||||||
showDiff: boolean;
|
|
||||||
stack: string;
|
|
||||||
}
|
|
||||||
export = AssertionError;
|
|
||||||
}
|
|
|
@ -1,388 +0,0 @@
|
||||||
// Type definitions for chai 3.2.0
|
|
||||||
// Project: http://chaijs.com/
|
|
||||||
// Definitions by: Jed Mao <https://github.com/jedmao/>,
|
|
||||||
// Bart van der Schoor <https://github.com/Bartvds>,
|
|
||||||
// Andrew Brown <https://github.com/AGBrown>,
|
|
||||||
// Olivier Chevet <https://github.com/olivr70>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
// <reference path="../assertion-error/assertion-error.d.ts"/>
|
|
||||||
|
|
||||||
declare module Chai {
|
|
||||||
|
|
||||||
interface ChaiStatic {
|
|
||||||
expect: ExpectStatic;
|
|
||||||
should(): Should;
|
|
||||||
/**
|
|
||||||
* Provides a way to extend the internals of Chai
|
|
||||||
*/
|
|
||||||
use(fn: (chai: any, utils: any) => void): any;
|
|
||||||
assert: AssertStatic;
|
|
||||||
config: Config;
|
|
||||||
AssertionError: AssertionError;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ExpectStatic extends AssertionStatic {
|
|
||||||
fail(actual?: any, expected?: any, message?: string, operator?: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AssertStatic extends Assert {
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AssertionStatic {
|
|
||||||
(target: any, message?: string): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ShouldAssertion {
|
|
||||||
equal(value1: any, value2: any, message?: string): void;
|
|
||||||
Throw: ShouldThrow;
|
|
||||||
throw: ShouldThrow;
|
|
||||||
exist(value: any, message?: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Should extends ShouldAssertion {
|
|
||||||
not: ShouldAssertion;
|
|
||||||
fail(actual: any, expected: any, message?: string, operator?: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ShouldThrow {
|
|
||||||
(actual: Function): void;
|
|
||||||
(actual: Function, expected: string|RegExp, message?: string): void;
|
|
||||||
(actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
|
|
||||||
not: Assertion;
|
|
||||||
deep: Deep;
|
|
||||||
any: KeyFilter;
|
|
||||||
all: KeyFilter;
|
|
||||||
a: TypeComparison;
|
|
||||||
an: TypeComparison;
|
|
||||||
include: Include;
|
|
||||||
includes: Include;
|
|
||||||
contain: Include;
|
|
||||||
contains: Include;
|
|
||||||
ok: Assertion;
|
|
||||||
true: Assertion;
|
|
||||||
false: Assertion;
|
|
||||||
null: Assertion;
|
|
||||||
undefined: Assertion;
|
|
||||||
NaN: Assertion;
|
|
||||||
exist: Assertion;
|
|
||||||
empty: Assertion;
|
|
||||||
arguments: Assertion;
|
|
||||||
Arguments: Assertion;
|
|
||||||
equal: Equal;
|
|
||||||
equals: Equal;
|
|
||||||
eq: Equal;
|
|
||||||
eql: Equal;
|
|
||||||
eqls: Equal;
|
|
||||||
property: Property;
|
|
||||||
ownProperty: OwnProperty;
|
|
||||||
haveOwnProperty: OwnProperty;
|
|
||||||
ownPropertyDescriptor: OwnPropertyDescriptor;
|
|
||||||
haveOwnPropertyDescriptor: OwnPropertyDescriptor;
|
|
||||||
length: Length;
|
|
||||||
lengthOf: Length;
|
|
||||||
match: Match;
|
|
||||||
matches: Match;
|
|
||||||
string(string: string, message?: string): Assertion;
|
|
||||||
keys: Keys;
|
|
||||||
key(string: string): Assertion;
|
|
||||||
throw: Throw;
|
|
||||||
throws: Throw;
|
|
||||||
Throw: Throw;
|
|
||||||
respondTo: RespondTo;
|
|
||||||
respondsTo: RespondTo;
|
|
||||||
itself: Assertion;
|
|
||||||
satisfy: Satisfy;
|
|
||||||
satisfies: Satisfy;
|
|
||||||
closeTo(expected: number, delta: number, message?: string): Assertion;
|
|
||||||
members: Members;
|
|
||||||
increase: PropertyChange;
|
|
||||||
increases: PropertyChange;
|
|
||||||
decrease: PropertyChange;
|
|
||||||
decreases: PropertyChange;
|
|
||||||
change: PropertyChange;
|
|
||||||
changes: PropertyChange;
|
|
||||||
extensible: Assertion;
|
|
||||||
sealed: Assertion;
|
|
||||||
frozen: Assertion;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
interface LanguageChains {
|
|
||||||
to: Assertion;
|
|
||||||
be: Assertion;
|
|
||||||
been: Assertion;
|
|
||||||
is: Assertion;
|
|
||||||
that: Assertion;
|
|
||||||
which: Assertion;
|
|
||||||
and: Assertion;
|
|
||||||
has: Assertion;
|
|
||||||
have: Assertion;
|
|
||||||
with: Assertion;
|
|
||||||
at: Assertion;
|
|
||||||
of: Assertion;
|
|
||||||
same: Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface NumericComparison {
|
|
||||||
above: NumberComparer;
|
|
||||||
gt: NumberComparer;
|
|
||||||
greaterThan: NumberComparer;
|
|
||||||
least: NumberComparer;
|
|
||||||
gte: NumberComparer;
|
|
||||||
below: NumberComparer;
|
|
||||||
lt: NumberComparer;
|
|
||||||
lessThan: NumberComparer;
|
|
||||||
most: NumberComparer;
|
|
||||||
lte: NumberComparer;
|
|
||||||
within(start: number, finish: number, message?: string): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface NumberComparer {
|
|
||||||
(value: number, message?: string): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface TypeComparison {
|
|
||||||
(type: string, message?: string): Assertion;
|
|
||||||
instanceof: InstanceOf;
|
|
||||||
instanceOf: InstanceOf;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface InstanceOf {
|
|
||||||
(constructor: Object, message?: string): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Deep {
|
|
||||||
equal: Equal;
|
|
||||||
include: Include;
|
|
||||||
property: Property;
|
|
||||||
members: Members;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KeyFilter {
|
|
||||||
keys: Keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Equal {
|
|
||||||
(value: any, message?: string): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Property {
|
|
||||||
(name: string, value?: any, message?: string): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface OwnProperty {
|
|
||||||
(name: string, message?: string): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface OwnPropertyDescriptor {
|
|
||||||
(name: string, descriptor: PropertyDescriptor, message?: string): Assertion;
|
|
||||||
(name: string, message?: string): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Length extends LanguageChains, NumericComparison {
|
|
||||||
(length: number, message?: string): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Include {
|
|
||||||
(value: Object, message?: string): Assertion;
|
|
||||||
(value: string, message?: string): Assertion;
|
|
||||||
(value: number, message?: string): Assertion;
|
|
||||||
keys: Keys;
|
|
||||||
members: Members;
|
|
||||||
any: KeyFilter;
|
|
||||||
all: KeyFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Match {
|
|
||||||
(regexp: RegExp|string, message?: string): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Keys {
|
|
||||||
(...keys: string[]): Assertion;
|
|
||||||
(keys: any[]): Assertion;
|
|
||||||
(keys: Object): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Throw {
|
|
||||||
(): Assertion;
|
|
||||||
(expected: string, message?: string): Assertion;
|
|
||||||
(expected: RegExp, message?: string): Assertion;
|
|
||||||
(constructor: Error, expected?: string, message?: string): Assertion;
|
|
||||||
(constructor: Error, expected?: RegExp, message?: string): Assertion;
|
|
||||||
(constructor: Function, expected?: string, message?: string): Assertion;
|
|
||||||
(constructor: Function, expected?: RegExp, message?: string): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RespondTo {
|
|
||||||
(method: string, message?: string): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Satisfy {
|
|
||||||
(matcher: Function, message?: string): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Members {
|
|
||||||
(set: any[], message?: string): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PropertyChange {
|
|
||||||
(object: Object, prop: string, msg?: string): Assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Assert {
|
|
||||||
/**
|
|
||||||
* @param expression Expression to test for truthiness.
|
|
||||||
* @param message Message to display on error.
|
|
||||||
*/
|
|
||||||
(expression: any, message?: string): void;
|
|
||||||
|
|
||||||
fail(actual?: any, expected?: any, msg?: string, operator?: string): void;
|
|
||||||
|
|
||||||
ok(val: any, msg?: string): void;
|
|
||||||
isOk(val: any, msg?: string): void;
|
|
||||||
notOk(val: any, msg?: string): void;
|
|
||||||
isNotOk(val: any, msg?: string): void;
|
|
||||||
|
|
||||||
equal(act: any, exp: any, msg?: string): void;
|
|
||||||
notEqual(act: any, exp: any, msg?: string): void;
|
|
||||||
|
|
||||||
strictEqual(act: any, exp: any, msg?: string): void;
|
|
||||||
notStrictEqual(act: any, exp: any, msg?: string): void;
|
|
||||||
|
|
||||||
deepEqual(act: any, exp: any, msg?: string): void;
|
|
||||||
notDeepEqual(act: any, exp: any, msg?: string): void;
|
|
||||||
|
|
||||||
isTrue(val: any, msg?: string): void;
|
|
||||||
isFalse(val: any, msg?: string): void;
|
|
||||||
|
|
||||||
isNull(val: any, msg?: string): void;
|
|
||||||
isNotNull(val: any, msg?: string): void;
|
|
||||||
|
|
||||||
isUndefined(val: any, msg?: string): void;
|
|
||||||
isDefined(val: any, msg?: string): void;
|
|
||||||
|
|
||||||
isNaN(val: any, msg?: string): void;
|
|
||||||
isNotNaN(val: any, msg?: string): void;
|
|
||||||
|
|
||||||
isAbove(val: number, abv: number, msg?: string): void;
|
|
||||||
isBelow(val: number, blw: number, msg?: string): void;
|
|
||||||
|
|
||||||
isFunction(val: any, msg?: string): void;
|
|
||||||
isNotFunction(val: any, msg?: string): void;
|
|
||||||
|
|
||||||
isObject(val: any, msg?: string): void;
|
|
||||||
isNotObject(val: any, msg?: string): void;
|
|
||||||
|
|
||||||
isArray(val: any, msg?: string): void;
|
|
||||||
isNotArray(val: any, msg?: string): void;
|
|
||||||
|
|
||||||
isString(val: any, msg?: string): void;
|
|
||||||
isNotString(val: any, msg?: string): void;
|
|
||||||
|
|
||||||
isNumber(val: any, msg?: string): void;
|
|
||||||
isNotNumber(val: any, msg?: string): void;
|
|
||||||
|
|
||||||
isBoolean(val: any, msg?: string): void;
|
|
||||||
isNotBoolean(val: any, msg?: string): void;
|
|
||||||
|
|
||||||
typeOf(val: any, type: string, msg?: string): void;
|
|
||||||
notTypeOf(val: any, type: string, msg?: string): void;
|
|
||||||
|
|
||||||
instanceOf(val: any, type: Function, msg?: string): void;
|
|
||||||
notInstanceOf(val: any, type: Function, msg?: string): void;
|
|
||||||
|
|
||||||
include(exp: string, inc: any, msg?: string): void;
|
|
||||||
include(exp: any[], inc: any, msg?: string): void;
|
|
||||||
|
|
||||||
notInclude(exp: string, inc: any, msg?: string): void;
|
|
||||||
notInclude(exp: any[], inc: any, msg?: string): void;
|
|
||||||
|
|
||||||
match(exp: any, re: RegExp, msg?: string): void;
|
|
||||||
notMatch(exp: any, re: RegExp, msg?: string): void;
|
|
||||||
|
|
||||||
property(obj: Object, prop: string, msg?: string): void;
|
|
||||||
notProperty(obj: Object, prop: string, msg?: string): void;
|
|
||||||
deepProperty(obj: Object, prop: string, msg?: string): void;
|
|
||||||
notDeepProperty(obj: Object, prop: string, msg?: string): void;
|
|
||||||
|
|
||||||
propertyVal(obj: Object, prop: string, val: any, msg?: string): void;
|
|
||||||
propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void;
|
|
||||||
|
|
||||||
deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void;
|
|
||||||
deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void;
|
|
||||||
|
|
||||||
lengthOf(exp: any, len: number, msg?: string): void;
|
|
||||||
//alias frenzy
|
|
||||||
throw(fn: Function, msg?: string): void;
|
|
||||||
throw(fn: Function, regExp: RegExp): void;
|
|
||||||
throw(fn: Function, errType: Function, msg?: string): void;
|
|
||||||
throw(fn: Function, errType: Function, regExp: RegExp): void;
|
|
||||||
|
|
||||||
throws(fn: Function, msg?: string): void;
|
|
||||||
throws(fn: Function, regExp: RegExp): void;
|
|
||||||
throws(fn: Function, errType: Function, msg?: string): void;
|
|
||||||
throws(fn: Function, errType: Function, regExp: RegExp): void;
|
|
||||||
|
|
||||||
Throw(fn: Function, msg?: string): void;
|
|
||||||
Throw(fn: Function, regExp: RegExp): void;
|
|
||||||
Throw(fn: Function, errType: Function, msg?: string): void;
|
|
||||||
Throw(fn: Function, errType: Function, regExp: RegExp): void;
|
|
||||||
|
|
||||||
doesNotThrow(fn: Function, msg?: string): void;
|
|
||||||
doesNotThrow(fn: Function, regExp: RegExp): void;
|
|
||||||
doesNotThrow(fn: Function, errType: Function, msg?: string): void;
|
|
||||||
doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void;
|
|
||||||
|
|
||||||
operator(val: any, operator: string, val2: any, msg?: string): void;
|
|
||||||
closeTo(act: number, exp: number, delta: number, msg?: string): void;
|
|
||||||
|
|
||||||
sameMembers(set1: any[], set2: any[], msg?: string): void;
|
|
||||||
sameDeepMembers(set1: any[], set2: any[], msg?: string): void;
|
|
||||||
includeMembers(superset: any[], subset: any[], msg?: string): void;
|
|
||||||
|
|
||||||
ifError(val: any, msg?: string): void;
|
|
||||||
|
|
||||||
isExtensible(obj: {}, msg?: string): void;
|
|
||||||
extensible(obj: {}, msg?: string): void;
|
|
||||||
isNotExtensible(obj: {}, msg?: string): void;
|
|
||||||
notExtensible(obj: {}, msg?: string): void;
|
|
||||||
|
|
||||||
isSealed(obj: {}, msg?: string): void;
|
|
||||||
sealed(obj: {}, msg?: string): void;
|
|
||||||
isNotSealed(obj: {}, msg?: string): void;
|
|
||||||
notSealed(obj: {}, msg?: string): void;
|
|
||||||
|
|
||||||
isFrozen(obj: Object, msg?: string): void;
|
|
||||||
frozen(obj: Object, msg?: string): void;
|
|
||||||
isNotFrozen(obj: Object, msg?: string): void;
|
|
||||||
notFrozen(obj: Object, msg?: string): void;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Config {
|
|
||||||
includeStack: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class AssertionError {
|
|
||||||
constructor(message: string, _props?: any, ssf?: Function);
|
|
||||||
name: string;
|
|
||||||
message: string;
|
|
||||||
showDiff: boolean;
|
|
||||||
stack: string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var chai: Chai.ChaiStatic;
|
|
||||||
|
|
||||||
declare module "chai" {
|
|
||||||
export = chai;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Object {
|
|
||||||
should: Chai.Assertion;
|
|
||||||
}
|
|
|
@ -1,107 +0,0 @@
|
||||||
// Type definitions for Combokeys v2.4.6
|
|
||||||
// Project: https://github.com/PolicyStat/combokeys
|
|
||||||
// Definitions by: Ian Clanton-Thuon <https://github.com/iclanton>
|
|
||||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
||||||
|
|
||||||
declare namespace Combokeys {
|
|
||||||
interface CombokeysStatic {
|
|
||||||
new (element: Element): Combokeys;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* all instances of Combokeys
|
|
||||||
*/
|
|
||||||
instances: Combokeys[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* reset all instances
|
|
||||||
*/
|
|
||||||
reset(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Combokeys {
|
|
||||||
element: Element;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* binds an event to Combokeys
|
|
||||||
*
|
|
||||||
* can be a single key, a combination of keys separated with +,
|
|
||||||
* an array of keys, or a sequence of keys separated by spaces
|
|
||||||
*
|
|
||||||
* be sure to list the modifier keys first to make sure that the
|
|
||||||
* correct key ends up getting bound (the last key in the pattern)
|
|
||||||
*
|
|
||||||
* @param {keys} key combination or combinations
|
|
||||||
* @param {callback} callback function
|
|
||||||
* @param {handler} optional - one of "keypress", "keydown", or "keyup"
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
bind(keys: string | string[], callback: () => void, action?: string): void;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* binds multiple combinations to the same callback
|
|
||||||
*
|
|
||||||
* @param {keys} key combinations
|
|
||||||
* @param {callback} callback function
|
|
||||||
* @param {handler} optional - one of "keypress", "keydown", or "keyup"
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
bindMultiple(keys: string[], callback: () => void, action?: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* unbinds an event to Combokeys
|
|
||||||
*
|
|
||||||
* the unbinding sets the callback function of the specified key combo
|
|
||||||
* to an empty function and deletes the corresponding key in the
|
|
||||||
* directMap dict.
|
|
||||||
*
|
|
||||||
* the keycombo+action has to be exactly the same as
|
|
||||||
* it was defined in the bind method
|
|
||||||
*
|
|
||||||
* @param {keys} key combination or combinations
|
|
||||||
* @param {action} optional - one of "keypress", "keydown", or "keyup"
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
unbind(keys: string | string[], action?: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* triggers an event that has already been bound
|
|
||||||
*
|
|
||||||
* @param {keys} key combination
|
|
||||||
* @param {action} optional - one of "keypress", "keydown", or "keyup"
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
trigger(keys: string, action?: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* resets the library back to its initial state. This is useful
|
|
||||||
* if you want to clear out the current keyboard shortcuts and bind
|
|
||||||
* new ones - for example if you switch to another page
|
|
||||||
*
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
reset(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* should we stop this event before firing off callbacks
|
|
||||||
*
|
|
||||||
* @param {e} event
|
|
||||||
* @param {element} bound element
|
|
||||||
* @return {boolean}
|
|
||||||
*/
|
|
||||||
stopCallback(e: Event, element: Element): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* detach all listners from the bound element
|
|
||||||
*
|
|
||||||
* @return {void}
|
|
||||||
*/
|
|
||||||
detach(): void;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var combokeys: Combokeys.CombokeysStatic;
|
|
||||||
|
|
||||||
declare module "combokeys" {
|
|
||||||
export = combokeys;
|
|
||||||
}
|
|
|
@ -1,113 +0,0 @@
|
||||||
// Type definitions for es6-collections v0.5.1
|
|
||||||
// Project: https://github.com/WebReflection/es6-collections/
|
|
||||||
// Definitions by: Ron Buckton <http://github.com/rbuckton>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
/* *****************************************************************************
|
|
||||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
||||||
this file except in compliance with the License. You may obtain a copy of the
|
|
||||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
||||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
||||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
||||||
|
|
||||||
See the Apache Version 2.0 License for specific language governing permissions
|
|
||||||
and limitations under the License.
|
|
||||||
***************************************************************************** */
|
|
||||||
|
|
||||||
interface IteratorResult<T> {
|
|
||||||
done: boolean;
|
|
||||||
value?: T;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Iterator<T> {
|
|
||||||
next(value?: any): IteratorResult<T>;
|
|
||||||
return?(value?: any): IteratorResult<T>;
|
|
||||||
throw?(e?: any): IteratorResult<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ForEachable<T> {
|
|
||||||
forEach(callbackfn: (value: T) => void): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Map<K, V> {
|
|
||||||
clear(): void;
|
|
||||||
delete(key: K): boolean;
|
|
||||||
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
|
|
||||||
get(key: K): V;
|
|
||||||
has(key: K): boolean;
|
|
||||||
set(key: K, value?: V): Map<K, V>;
|
|
||||||
entries(): Iterator<[K, V]>;
|
|
||||||
keys(): Iterator<K>;
|
|
||||||
values(): Iterator<V>;
|
|
||||||
size: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MapConstructor {
|
|
||||||
new <K, V>(): Map<K, V>;
|
|
||||||
new <K, V>(iterable: ForEachable<[K, V]>): Map<K, V>;
|
|
||||||
prototype: Map<any, any>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Map: MapConstructor;
|
|
||||||
|
|
||||||
interface Set<T> {
|
|
||||||
add(value: T): Set<T>;
|
|
||||||
clear(): void;
|
|
||||||
delete(value: T): boolean;
|
|
||||||
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
|
|
||||||
has(value: T): boolean;
|
|
||||||
entries(): Iterator<[T, T]>;
|
|
||||||
keys(): Iterator<T>;
|
|
||||||
values(): Iterator<T>;
|
|
||||||
size: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SetConstructor {
|
|
||||||
new <T>(): Set<T>;
|
|
||||||
new <T>(iterable: ForEachable<T>): Set<T>;
|
|
||||||
prototype: Set<any>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Set: SetConstructor;
|
|
||||||
|
|
||||||
interface WeakMap<K, V> {
|
|
||||||
delete(key: K): boolean;
|
|
||||||
clear(): void;
|
|
||||||
get(key: K): V;
|
|
||||||
has(key: K): boolean;
|
|
||||||
set(key: K, value?: V): WeakMap<K, V>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface WeakMapConstructor {
|
|
||||||
new <K, V>(): WeakMap<K, V>;
|
|
||||||
new <K, V>(iterable: ForEachable<[K, V]>): WeakMap<K, V>;
|
|
||||||
prototype: WeakMap<any, any>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var WeakMap: WeakMapConstructor;
|
|
||||||
|
|
||||||
interface WeakSet<T> {
|
|
||||||
delete(value: T): boolean;
|
|
||||||
clear(): void;
|
|
||||||
add(value: T): WeakSet<T>;
|
|
||||||
has(value: T): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface WeakSetConstructor {
|
|
||||||
new <T>(): WeakSet<T>;
|
|
||||||
new <T>(iterable: ForEachable<T>): WeakSet<T>;
|
|
||||||
prototype: WeakSet<any>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var WeakSet: WeakSetConstructor;
|
|
||||||
|
|
||||||
declare module "es6-collections" {
|
|
||||||
var Map: MapConstructor;
|
|
||||||
var Set: SetConstructor;
|
|
||||||
var WeakMap: WeakMapConstructor;
|
|
||||||
var WeakSet: WeakSetConstructor;
|
|
||||||
}
|
|
|
@ -1,74 +0,0 @@
|
||||||
// Type definitions for es6-promise
|
|
||||||
// Project: https://github.com/jakearchibald/ES6-Promise
|
|
||||||
// Definitions by: François de Campredon <https://github.com/fdecampredon/>, vvakame <https://github.com/vvakame>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
interface Thenable<R> {
|
|
||||||
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
|
||||||
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
|
|
||||||
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare class Promise<R> implements Thenable<R> {
|
|
||||||
/**
|
|
||||||
* If you call resolve in the body of the callback passed to the constructor,
|
|
||||||
* your promise is fulfilled with result object passed to resolve.
|
|
||||||
* If you call reject your promise is rejected with the object passed to reject.
|
|
||||||
* For consistency and debugging (eg stack traces), obj should be an instanceof Error.
|
|
||||||
* Any errors thrown in the constructor callback will be implicitly passed to reject().
|
|
||||||
*/
|
|
||||||
constructor(callback: (resolve : (value?: R | Thenable<R>) => void, reject: (error?: any) => void) => void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
|
|
||||||
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
|
|
||||||
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
|
|
||||||
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
|
|
||||||
* If an error is thrown in the callback, the returned promise rejects with that error.
|
|
||||||
*
|
|
||||||
* @param onFulfilled called when/if "promise" resolves
|
|
||||||
* @param onRejected called when/if "promise" rejects
|
|
||||||
*/
|
|
||||||
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
|
|
||||||
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sugar for promise.then(undefined, onRejected)
|
|
||||||
*
|
|
||||||
* @param onRejected called when/if "promise" rejects
|
|
||||||
*/
|
|
||||||
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module Promise {
|
|
||||||
/**
|
|
||||||
* Make a new promise from the thenable.
|
|
||||||
* A thenable is promise-like in as far as it has a "then" method.
|
|
||||||
*/
|
|
||||||
function resolve<R>(value?: R | Thenable<R>): Promise<R>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
|
|
||||||
*/
|
|
||||||
function reject(error: any): Promise<any>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
|
|
||||||
* the array passed to all can be a mixture of promise-like objects and other objects.
|
|
||||||
* The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
|
|
||||||
*/
|
|
||||||
function all<R>(promises: (R | Thenable<R>)[]): Promise<R[]>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
|
|
||||||
*/
|
|
||||||
function race<R>(promises: (R | Thenable<R>)[]): Promise<R>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'es6-promise' {
|
|
||||||
var foo: typeof Promise; // Temp variable to reference Promise in local context
|
|
||||||
module rsvp {
|
|
||||||
export var Promise: typeof foo;
|
|
||||||
}
|
|
||||||
export = rsvp;
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,631 +0,0 @@
|
||||||
// Type definitions for Knockout v3.2.0
|
|
||||||
// Project: http://knockoutjs.com
|
|
||||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Igor Oleinikov <https://github.com/Igorbek/>, Clément Bourgeois <https://github.com/moonpyk/>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
|
|
||||||
interface KnockoutSubscribableFunctions<T> {
|
|
||||||
[key: string]: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
notifySubscribers(valueToWrite?: T, event?: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutComputedFunctions<T> {
|
|
||||||
[key: string]: KnockoutBindingHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutObservableFunctions<T> {
|
|
||||||
[key: string]: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
equalityComparer(a: any, b: any): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutObservableArrayFunctions<T> {
|
|
||||||
// General Array functions
|
|
||||||
indexOf(searchElement: T, fromIndex?: number): number;
|
|
||||||
slice(start: number, end?: number): T[];
|
|
||||||
splice(start: number): T[];
|
|
||||||
splice(start: number, deleteCount: number, ...items: T[]): T[];
|
|
||||||
pop(): T;
|
|
||||||
push(...items: T[]): void;
|
|
||||||
shift(): T;
|
|
||||||
unshift(...items: T[]): number;
|
|
||||||
reverse(): KnockoutObservableArray<T>;
|
|
||||||
sort(): KnockoutObservableArray<T>;
|
|
||||||
sort(compareFunction: (left: T, right: T) => number): KnockoutObservableArray<T>;
|
|
||||||
|
|
||||||
// Ko specific
|
|
||||||
[key: string]: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
replace(oldItem: T, newItem: T): void;
|
|
||||||
|
|
||||||
remove(item: T): T[];
|
|
||||||
remove(removeFunction: (item: T) => boolean): T[];
|
|
||||||
removeAll(items: T[]): T[];
|
|
||||||
removeAll(): T[];
|
|
||||||
|
|
||||||
destroy(item: T): void;
|
|
||||||
destroy(destroyFunction: (item: T) => boolean): void;
|
|
||||||
destroyAll(items: T[]): void;
|
|
||||||
destroyAll(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutSubscribableStatic {
|
|
||||||
fn: KnockoutSubscribableFunctions<any>;
|
|
||||||
|
|
||||||
new <T>(): KnockoutSubscribable<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutSubscription {
|
|
||||||
dispose(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutSubscribable<T> extends KnockoutSubscribableFunctions<T> {
|
|
||||||
subscribe(callback: (newValue: T) => void, target?: any, event?: string): KnockoutSubscription;
|
|
||||||
subscribe<TEvent>(callback: (newValue: TEvent) => void, target: any, event: string): KnockoutSubscription;
|
|
||||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutSubscribable<T>;
|
|
||||||
getSubscriptionsCount(): number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutComputedStatic {
|
|
||||||
fn: KnockoutComputedFunctions<any>;
|
|
||||||
|
|
||||||
<T>(): KnockoutComputed<T>;
|
|
||||||
<T>(func: () => T, context?: any, options?: any): KnockoutComputed<T>;
|
|
||||||
<T>(def: KnockoutComputedDefine<T>, context?: any): KnockoutComputed<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutComputed<T> extends KnockoutObservable<T>, KnockoutComputedFunctions<T> {
|
|
||||||
fn: KnockoutComputedFunctions<any>;
|
|
||||||
|
|
||||||
dispose(): void;
|
|
||||||
isActive(): boolean;
|
|
||||||
getDependenciesCount(): number;
|
|
||||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutComputed<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutObservableArrayStatic {
|
|
||||||
fn: KnockoutObservableArrayFunctions<any>;
|
|
||||||
|
|
||||||
<T>(value?: T[]): KnockoutObservableArray<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutObservableArray<T> extends KnockoutObservable<T[]>, KnockoutObservableArrayFunctions<T> {
|
|
||||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutObservableArray<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutObservableStatic {
|
|
||||||
fn: KnockoutObservableFunctions<any>;
|
|
||||||
|
|
||||||
<T>(value?: T): KnockoutObservable<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutObservable<T> extends KnockoutSubscribable<T>, KnockoutObservableFunctions<T> {
|
|
||||||
(): T;
|
|
||||||
(value: T): void;
|
|
||||||
|
|
||||||
peek(): T;
|
|
||||||
valueHasMutated?:{(): void;};
|
|
||||||
valueWillMutate?:{(): void;};
|
|
||||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutObservable<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutComputedDefine<T> {
|
|
||||||
read(): T;
|
|
||||||
write? (value: T): void;
|
|
||||||
disposeWhenNodeIsRemoved?: Node;
|
|
||||||
disposeWhen? (): boolean;
|
|
||||||
owner?: any;
|
|
||||||
deferEvaluation?: boolean;
|
|
||||||
pure?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutBindingContext {
|
|
||||||
$parent: any;
|
|
||||||
$parents: any[];
|
|
||||||
$root: any;
|
|
||||||
$data: any;
|
|
||||||
$rawData: any | KnockoutObservable<any>;
|
|
||||||
$index?: KnockoutObservable<number>;
|
|
||||||
$parentContext?: KnockoutBindingContext;
|
|
||||||
$component: any;
|
|
||||||
$componentTemplateNodes: Node[];
|
|
||||||
|
|
||||||
extend(properties: any): any;
|
|
||||||
createChildContext(dataItemOrAccessor: any, dataItemAlias?: any, extendCallback?: Function): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutAllBindingsAccessor {
|
|
||||||
(): any;
|
|
||||||
get(name: string): any;
|
|
||||||
has(name: string): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutBindingHandler {
|
|
||||||
after?: Array<string>;
|
|
||||||
init?: (element: any, valueAccessor: () => any, allBindingsAccessor?: KnockoutAllBindingsAccessor, viewModel?: any, bindingContext?: KnockoutBindingContext) => void | { controlsDescendantBindings: boolean; };
|
|
||||||
update?: (element: any, valueAccessor: () => any, allBindingsAccessor?: KnockoutAllBindingsAccessor, viewModel?: any, bindingContext?: KnockoutBindingContext) => void;
|
|
||||||
options?: any;
|
|
||||||
preprocess?: (value: string, name: string, addBindingCallback?: (name: string, value: string) => void) => string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutBindingHandlers {
|
|
||||||
[bindingHandler: string]: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
// Controlling text and appearance
|
|
||||||
visible: KnockoutBindingHandler;
|
|
||||||
text: KnockoutBindingHandler;
|
|
||||||
html: KnockoutBindingHandler;
|
|
||||||
css: KnockoutBindingHandler;
|
|
||||||
style: KnockoutBindingHandler;
|
|
||||||
attr: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
// Control Flow
|
|
||||||
foreach: KnockoutBindingHandler;
|
|
||||||
if: KnockoutBindingHandler;
|
|
||||||
ifnot: KnockoutBindingHandler;
|
|
||||||
with: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
// Working with form fields
|
|
||||||
click: KnockoutBindingHandler;
|
|
||||||
event: KnockoutBindingHandler;
|
|
||||||
submit: KnockoutBindingHandler;
|
|
||||||
enable: KnockoutBindingHandler;
|
|
||||||
disable: KnockoutBindingHandler;
|
|
||||||
value: KnockoutBindingHandler;
|
|
||||||
textInput: KnockoutBindingHandler;
|
|
||||||
hasfocus: KnockoutBindingHandler;
|
|
||||||
checked: KnockoutBindingHandler;
|
|
||||||
options: KnockoutBindingHandler;
|
|
||||||
selectedOptions: KnockoutBindingHandler;
|
|
||||||
uniqueName: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
// Rendering templates
|
|
||||||
template: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
// Components (new for v3.2)
|
|
||||||
component: KnockoutBindingHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutMemoization {
|
|
||||||
memoize(callback: () => string): string;
|
|
||||||
unmemoize(memoId: string, callbackParams: any[]): boolean;
|
|
||||||
unmemoizeDomNodeAndDescendants(domNode: any, extraCallbackParamsArray: any[]): boolean;
|
|
||||||
parseMemoText(memoText: string): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutVirtualElement {}
|
|
||||||
|
|
||||||
interface KnockoutVirtualElements {
|
|
||||||
allowedBindings: { [bindingName: string]: boolean; };
|
|
||||||
emptyNode(node: KnockoutVirtualElement ): void;
|
|
||||||
firstChild(node: KnockoutVirtualElement ): KnockoutVirtualElement;
|
|
||||||
insertAfter( container: KnockoutVirtualElement, nodeToInsert: Node, insertAfter: Node ): void;
|
|
||||||
nextSibling(node: KnockoutVirtualElement): Node;
|
|
||||||
prepend(node: KnockoutVirtualElement, toInsert: Node ): void;
|
|
||||||
setDomNodeChildren(node: KnockoutVirtualElement, newChildren: { length: number;[index: number]: Node; } ): void;
|
|
||||||
childNodes(node: KnockoutVirtualElement ): Node[];
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutExtenders {
|
|
||||||
throttle(target: any, timeout: number): KnockoutComputed<any>;
|
|
||||||
notify(target: any, notifyWhen: string): any;
|
|
||||||
|
|
||||||
rateLimit(target: any, timeout: number): any;
|
|
||||||
rateLimit(target: any, options: { timeout: number; method?: string; }): any;
|
|
||||||
|
|
||||||
trackArrayChanges(target: any): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// NOTE TO MAINTAINERS AND CONTRIBUTORS : pay attention to only include symbols that are
|
|
||||||
// publicly exported in the minified version of ko, without that you can give the false
|
|
||||||
// impression that some functions will be available in production builds.
|
|
||||||
//
|
|
||||||
interface KnockoutUtils {
|
|
||||||
//////////////////////////////////
|
|
||||||
// utils.domData.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
domData: {
|
|
||||||
get (node: Element, key: string): any;
|
|
||||||
|
|
||||||
set (node: Element, key: string, value: any): void;
|
|
||||||
|
|
||||||
getAll(node: Element, createIfNotFound: boolean): any;
|
|
||||||
|
|
||||||
clear(node: Element): boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// utils.domNodeDisposal.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
domNodeDisposal: {
|
|
||||||
addDisposeCallback(node: Element, callback: Function): void;
|
|
||||||
|
|
||||||
removeDisposeCallback(node: Element, callback: Function): void;
|
|
||||||
|
|
||||||
cleanNode(node: Node): Element;
|
|
||||||
|
|
||||||
removeNode(node: Node): void;
|
|
||||||
};
|
|
||||||
|
|
||||||
addOrRemoveItem<T>(array: T[] | KnockoutObservable<T>, value: T, included: T): void;
|
|
||||||
|
|
||||||
arrayFilter<T>(array: T[], predicate: (item: T) => boolean): T[];
|
|
||||||
|
|
||||||
arrayFirst<T>(array: T[], predicate: (item: T) => boolean, predicateOwner?: any): T;
|
|
||||||
|
|
||||||
arrayForEach<T>(array: T[], action: (item: T, index: number) => void): void;
|
|
||||||
|
|
||||||
arrayGetDistinctValues<T>(array: T[]): T[];
|
|
||||||
|
|
||||||
arrayIndexOf<T>(array: T[], item: T): number;
|
|
||||||
|
|
||||||
arrayMap<T, U>(array: T[], mapping: (item: T) => U): U[];
|
|
||||||
|
|
||||||
arrayPushAll<T>(array: T[] | KnockoutObservableArray<T>, valuesToPush: T[]): T[];
|
|
||||||
|
|
||||||
arrayRemoveItem(array: any[], itemToRemove: any): void;
|
|
||||||
|
|
||||||
compareArrays<T>(a: T[], b: T[]): Array<KnockoutArrayChange<T>>;
|
|
||||||
|
|
||||||
extend(target: Object, source: Object): Object;
|
|
||||||
|
|
||||||
fieldsIncludedWithJsonPost: any[];
|
|
||||||
|
|
||||||
getFormFields(form: any, fieldName: string): any[];
|
|
||||||
|
|
||||||
objectForEach(obj: any, action: (key: any, value: any) => void): void;
|
|
||||||
|
|
||||||
parseHtmlFragment(html: string): any[];
|
|
||||||
|
|
||||||
parseJson(jsonString: string): any;
|
|
||||||
|
|
||||||
postJson(urlOrForm: any, data: any, options: any): void;
|
|
||||||
|
|
||||||
peekObservable<T>(value: KnockoutObservable<T>): T;
|
|
||||||
|
|
||||||
range(min: any, max: any): any;
|
|
||||||
|
|
||||||
registerEventHandler(element: any, eventType: any, handler: Function): void;
|
|
||||||
|
|
||||||
setHtml(node: Element, html: () => string): void;
|
|
||||||
|
|
||||||
setHtml(node: Element, html: string): void;
|
|
||||||
|
|
||||||
setTextContent(element: any, textContent: string | KnockoutObservable<string>): void;
|
|
||||||
|
|
||||||
stringifyJson(data: any, replacer?: Function, space?: string): string;
|
|
||||||
|
|
||||||
toggleDomNodeCssClass(node: any, className: string, shouldHaveClass: boolean): void;
|
|
||||||
|
|
||||||
triggerEvent(element: any, eventType: any): void;
|
|
||||||
|
|
||||||
unwrapObservable<T>(value: KnockoutObservable<T> | T): T;
|
|
||||||
|
|
||||||
// NOT PART OF THE MINIFIED API SURFACE (ONLY IN knockout-{version}.debug.js) https://github.com/SteveSanderson/knockout/issues/670
|
|
||||||
// forceRefresh(node: any): void;
|
|
||||||
// ieVersion: number;
|
|
||||||
// isIe6: boolean;
|
|
||||||
// isIe7: boolean;
|
|
||||||
// jQueryHtmlParse(html: string): any[];
|
|
||||||
// makeArray(arrayLikeObject: any): any[];
|
|
||||||
// moveCleanedNodesToContainerElement(nodes: any[]): HTMLElement;
|
|
||||||
// replaceDomNodes(nodeToReplaceOrNodeArray: any, newNodesArray: any[]): void;
|
|
||||||
// setDomNodeChildren(domNode: any, childNodes: any[]): void;
|
|
||||||
// setElementName(element: any, name: string): void;
|
|
||||||
// setOptionNodeSelectionState(optionNode: any, isSelected: boolean): void;
|
|
||||||
// simpleHtmlParse(html: string): any[];
|
|
||||||
// stringStartsWith(str: string, startsWith: string): boolean;
|
|
||||||
// stringTokenize(str: string, delimiter: string): string[];
|
|
||||||
// stringTrim(str: string): string;
|
|
||||||
// tagNameLower(element: any): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutArrayChange<T> {
|
|
||||||
status: string;
|
|
||||||
value: T;
|
|
||||||
index: number;
|
|
||||||
moved?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// templateSources.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
interface KnockoutTemplateSourcesDomElement {
|
|
||||||
text(): any;
|
|
||||||
text(value: any): void;
|
|
||||||
|
|
||||||
data(key: string): any;
|
|
||||||
data(key: string, value: any): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutTemplateAnonymous extends KnockoutTemplateSourcesDomElement {
|
|
||||||
nodes(): any;
|
|
||||||
nodes(value: any): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutTemplateSources {
|
|
||||||
|
|
||||||
domElement: {
|
|
||||||
prototype: KnockoutTemplateSourcesDomElement
|
|
||||||
new (element: Element): KnockoutTemplateSourcesDomElement
|
|
||||||
};
|
|
||||||
|
|
||||||
anonymousTemplate: {
|
|
||||||
prototype: KnockoutTemplateAnonymous;
|
|
||||||
new (element: Element): KnockoutTemplateAnonymous;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// nativeTemplateEngine.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
interface KnockoutNativeTemplateEngine {
|
|
||||||
|
|
||||||
renderTemplateSource(templateSource: Object, bindingContext?: KnockoutBindingContext, options?: Object): any[];
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// templateEngine.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
interface KnockoutTemplateEngine extends KnockoutNativeTemplateEngine {
|
|
||||||
|
|
||||||
createJavaScriptEvaluatorBlock(script: string): string;
|
|
||||||
|
|
||||||
makeTemplateSource(template: any, templateDocument?: Document): any;
|
|
||||||
|
|
||||||
renderTemplate(template: any, bindingContext: KnockoutBindingContext, options: Object, templateDocument: Document): any;
|
|
||||||
|
|
||||||
isTemplateRewritten(template: any, templateDocument: Document): boolean;
|
|
||||||
|
|
||||||
rewriteTemplate(template: any, rewriterCallback: Function, templateDocument: Document): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
|
|
||||||
interface KnockoutStatic {
|
|
||||||
utils: KnockoutUtils;
|
|
||||||
memoization: KnockoutMemoization;
|
|
||||||
|
|
||||||
bindingHandlers: KnockoutBindingHandlers;
|
|
||||||
getBindingHandler(handler: string): KnockoutBindingHandler;
|
|
||||||
|
|
||||||
virtualElements: KnockoutVirtualElements;
|
|
||||||
extenders: KnockoutExtenders;
|
|
||||||
|
|
||||||
applyBindings(viewModelOrBindingContext?: any, rootNode?: any): void;
|
|
||||||
applyBindingsToDescendants(viewModelOrBindingContext: any, rootNode: any): void;
|
|
||||||
applyBindingAccessorsToNode(node: Node, bindings: (bindingContext: KnockoutBindingContext, node: Node) => {}, bindingContext: KnockoutBindingContext): void;
|
|
||||||
applyBindingAccessorsToNode(node: Node, bindings: {}, bindingContext: KnockoutBindingContext): void;
|
|
||||||
applyBindingAccessorsToNode(node: Node, bindings: (bindingContext: KnockoutBindingContext, node: Node) => {}, viewModel: any): void;
|
|
||||||
applyBindingAccessorsToNode(node: Node, bindings: {}, viewModel: any): void;
|
|
||||||
applyBindingsToNode(node: Node, bindings: any, viewModelOrBindingContext?: any): any;
|
|
||||||
|
|
||||||
subscribable: KnockoutSubscribableStatic;
|
|
||||||
observable: KnockoutObservableStatic;
|
|
||||||
|
|
||||||
computed: KnockoutComputedStatic;
|
|
||||||
pureComputed<T>(evaluatorFunction: () => T, context?: any): KnockoutComputed<T>;
|
|
||||||
pureComputed<T>(options: KnockoutComputedDefine<T>, context?: any): KnockoutComputed<T>;
|
|
||||||
|
|
||||||
observableArray: KnockoutObservableArrayStatic;
|
|
||||||
|
|
||||||
contextFor(node: any): any;
|
|
||||||
isSubscribable(instance: any): boolean;
|
|
||||||
toJSON(viewModel: any, replacer?: Function, space?: any): string;
|
|
||||||
toJS(viewModel: any): any;
|
|
||||||
isObservable(instance: any): boolean;
|
|
||||||
isWriteableObservable(instance: any): boolean;
|
|
||||||
isComputed(instance: any): boolean;
|
|
||||||
dataFor(node: any): any;
|
|
||||||
removeNode(node: Element): void;
|
|
||||||
cleanNode(node: Element): Element;
|
|
||||||
renderTemplate(template: Function, viewModel: any, options?: any, target?: any, renderMode?: any): any;
|
|
||||||
renderTemplate(template: string, viewModel: any, options?: any, target?: any, renderMode?: any): any;
|
|
||||||
unwrap<T>(value: KnockoutObservable<T> | T): T;
|
|
||||||
|
|
||||||
computedContext: KnockoutComputedContext;
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// templateSources.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
templateSources: KnockoutTemplateSources;
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// templateEngine.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
templateEngine: {
|
|
||||||
|
|
||||||
prototype: KnockoutTemplateEngine;
|
|
||||||
|
|
||||||
new (): KnockoutTemplateEngine;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// templateRewriting.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
templateRewriting: {
|
|
||||||
|
|
||||||
ensureTemplateIsRewritten(template: Node, templateEngine: KnockoutTemplateEngine, templateDocument: Document): any;
|
|
||||||
ensureTemplateIsRewritten(template: string, templateEngine: KnockoutTemplateEngine, templateDocument: Document): any;
|
|
||||||
|
|
||||||
memoizeBindingAttributeSyntax(htmlString: string, templateEngine: KnockoutTemplateEngine): any;
|
|
||||||
|
|
||||||
applyMemoizedBindingsToNextSibling(bindings: any, nodeName: string): string;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// nativeTemplateEngine.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
nativeTemplateEngine: {
|
|
||||||
|
|
||||||
prototype: KnockoutNativeTemplateEngine;
|
|
||||||
|
|
||||||
new (): KnockoutNativeTemplateEngine;
|
|
||||||
|
|
||||||
instance: KnockoutNativeTemplateEngine;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// jqueryTmplTemplateEngine.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
jqueryTmplTemplateEngine: {
|
|
||||||
|
|
||||||
prototype: KnockoutTemplateEngine;
|
|
||||||
|
|
||||||
renderTemplateSource(templateSource: Object, bindingContext: KnockoutBindingContext, options: Object): Node[];
|
|
||||||
|
|
||||||
createJavaScriptEvaluatorBlock(script: string): string;
|
|
||||||
|
|
||||||
addTemplate(templateName: string, templateMarkup: string): void;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// templating.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
setTemplateEngine(templateEngine: KnockoutNativeTemplateEngine): void;
|
|
||||||
|
|
||||||
renderTemplate(template: Function, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
|
||||||
renderTemplate(template: any, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
|
||||||
renderTemplate(template: Function, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
|
||||||
renderTemplate(template: any, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
|
||||||
renderTemplate(template: Function, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
|
||||||
renderTemplate(template: any, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
|
||||||
renderTemplate(template: Function, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
|
||||||
renderTemplate(template: any, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
|
||||||
|
|
||||||
renderTemplateForEach(template: Function, arrayOrObservableArray: any[], options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
|
||||||
renderTemplateForEach(template: any, arrayOrObservableArray: any[], options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
|
||||||
renderTemplateForEach(template: Function, arrayOrObservableArray: KnockoutObservable<any>, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
|
||||||
renderTemplateForEach(template: any, arrayOrObservableArray: KnockoutObservable<any>, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
|
||||||
|
|
||||||
expressionRewriting: {
|
|
||||||
bindingRewriteValidators: any;
|
|
||||||
parseObjectLiteral: { (objectLiteralString: string): any[] }
|
|
||||||
};
|
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
|
|
||||||
bindingProvider: {
|
|
||||||
instance: KnockoutBindingProvider;
|
|
||||||
new (): KnockoutBindingProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
// selectExtensions.js
|
|
||||||
/////////////////////////////////
|
|
||||||
|
|
||||||
selectExtensions: {
|
|
||||||
|
|
||||||
readValue(element: HTMLElement): any;
|
|
||||||
|
|
||||||
writeValue(element: HTMLElement, value: any): void;
|
|
||||||
};
|
|
||||||
|
|
||||||
components: KnockoutComponents;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutBindingProvider {
|
|
||||||
nodeHasBindings(node: Node): boolean;
|
|
||||||
getBindings(node: Node, bindingContext: KnockoutBindingContext): {};
|
|
||||||
getBindingAccessors?(node: Node, bindingContext: KnockoutBindingContext): { [key: string]: string; };
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutComputedContext {
|
|
||||||
getDependenciesCount(): number;
|
|
||||||
isInitial: () => boolean;
|
|
||||||
isSleeping: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// refactored types into a namespace to reduce global pollution
|
|
||||||
// and used Union Types to simplify overloads (requires TypeScript 1.4)
|
|
||||||
//
|
|
||||||
declare module KnockoutComponentTypes {
|
|
||||||
|
|
||||||
interface Config {
|
|
||||||
viewModel?: ViewModelFunction | ViewModelSharedInstance | ViewModelFactoryFunction | AMDModule;
|
|
||||||
template: string | Node[]| DocumentFragment | TemplateElement | AMDModule;
|
|
||||||
synchronous?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ComponentConfig {
|
|
||||||
viewModel?: ViewModelFunction | ViewModelSharedInstance | ViewModelFactoryFunction | AMDModule;
|
|
||||||
template: any;
|
|
||||||
createViewModel?: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface EmptyConfig {
|
|
||||||
}
|
|
||||||
|
|
||||||
// common AMD type
|
|
||||||
interface AMDModule {
|
|
||||||
require: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
// viewmodel types
|
|
||||||
interface ViewModelFunction {
|
|
||||||
(params?: any): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ViewModelSharedInstance {
|
|
||||||
instance: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ViewModelFactoryFunction {
|
|
||||||
createViewModel: (params?: any, componentInfo?: ComponentInfo) => any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ComponentInfo {
|
|
||||||
element: Node;
|
|
||||||
templateNodes: Node[];
|
|
||||||
}
|
|
||||||
|
|
||||||
interface TemplateElement {
|
|
||||||
element: string | Node;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Loader {
|
|
||||||
getConfig? (componentName: string, callback: (result: ComponentConfig) => void): void;
|
|
||||||
loadComponent? (componentName: string, config: ComponentConfig, callback: (result: Definition) => void): void;
|
|
||||||
loadTemplate? (componentName: string, templateConfig: any, callback: (result: Node[]) => void): void;
|
|
||||||
loadViewModel? (componentName: string, viewModelConfig: any, callback: (result: any) => void): void;
|
|
||||||
suppressLoaderExceptions?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Definition {
|
|
||||||
template: Node[];
|
|
||||||
createViewModel? (params: any, options: { element: Node; }): any;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutComponents {
|
|
||||||
// overloads for register method:
|
|
||||||
register(componentName: string, config: KnockoutComponentTypes.Config | KnockoutComponentTypes.EmptyConfig): void;
|
|
||||||
|
|
||||||
isRegistered(componentName: string): boolean;
|
|
||||||
unregister(componentName: string): void;
|
|
||||||
get(componentName: string, callback: (definition: KnockoutComponentTypes.Definition) => void): void;
|
|
||||||
clearCachedDefinition(componentName: string): void
|
|
||||||
defaultLoader: KnockoutComponentTypes.Loader;
|
|
||||||
loaders: KnockoutComponentTypes.Loader[];
|
|
||||||
getComponentNameForNode(node: Node): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var ko: KnockoutStatic;
|
|
||||||
|
|
||||||
declare module "knockout" {
|
|
||||||
export = ko;
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,214 +0,0 @@
|
||||||
// Type definitions for mocha 2.2.5
|
|
||||||
// Project: http://mochajs.org/
|
|
||||||
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>, otiai10 <https://github.com/otiai10>, jt000 <https://github.com/jt000>, Vadim Macagon <https://github.com/enlight>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
interface MochaSetupOptions {
|
|
||||||
//milliseconds to wait before considering a test slow
|
|
||||||
slow?: number;
|
|
||||||
|
|
||||||
// timeout in milliseconds
|
|
||||||
timeout?: number;
|
|
||||||
|
|
||||||
// ui name "bdd", "tdd", "exports" etc
|
|
||||||
ui?: string;
|
|
||||||
|
|
||||||
//array of accepted globals
|
|
||||||
globals?: any[];
|
|
||||||
|
|
||||||
// reporter instance (function or string), defaults to `mocha.reporters.Spec`
|
|
||||||
reporter?: any;
|
|
||||||
|
|
||||||
// bail on the first test failure
|
|
||||||
bail?: boolean;
|
|
||||||
|
|
||||||
// ignore global leaks
|
|
||||||
ignoreLeaks?: boolean;
|
|
||||||
|
|
||||||
// grep string or regexp to filter tests with
|
|
||||||
grep?: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MochaDone {
|
|
||||||
(error?: Error): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var mocha: Mocha;
|
|
||||||
declare var describe: Mocha.IContextDefinition;
|
|
||||||
declare var xdescribe: Mocha.IContextDefinition;
|
|
||||||
// alias for `describe`
|
|
||||||
declare var context: Mocha.IContextDefinition;
|
|
||||||
// alias for `describe`
|
|
||||||
declare var suite: Mocha.IContextDefinition;
|
|
||||||
declare var it: Mocha.ITestDefinition;
|
|
||||||
declare var xit: Mocha.ITestDefinition;
|
|
||||||
// alias for `it`
|
|
||||||
declare var test: Mocha.ITestDefinition;
|
|
||||||
|
|
||||||
declare function before(action: () => void): void;
|
|
||||||
|
|
||||||
declare function before(action: (done: MochaDone) => void): void;
|
|
||||||
|
|
||||||
declare function setup(action: () => void): void;
|
|
||||||
|
|
||||||
declare function setup(action: (done: MochaDone) => void): void;
|
|
||||||
|
|
||||||
declare function after(action: () => void): void;
|
|
||||||
|
|
||||||
declare function after(action: (done: MochaDone) => void): void;
|
|
||||||
|
|
||||||
declare function teardown(action: () => void): void;
|
|
||||||
|
|
||||||
declare function teardown(action: (done: MochaDone) => void): void;
|
|
||||||
|
|
||||||
declare function beforeEach(action: () => void): void;
|
|
||||||
|
|
||||||
declare function beforeEach(action: (done: MochaDone) => void): void;
|
|
||||||
|
|
||||||
declare function suiteSetup(action: () => void): void;
|
|
||||||
|
|
||||||
declare function suiteSetup(action: (done: MochaDone) => void): void;
|
|
||||||
|
|
||||||
declare function afterEach(action: () => void): void;
|
|
||||||
|
|
||||||
declare function afterEach(action: (done: MochaDone) => void): void;
|
|
||||||
|
|
||||||
declare function suiteTeardown(action: () => void): void;
|
|
||||||
|
|
||||||
declare function suiteTeardown(action: (done: MochaDone) => void): void;
|
|
||||||
|
|
||||||
declare class Mocha {
|
|
||||||
constructor(options?: {
|
|
||||||
grep?: RegExp;
|
|
||||||
ui?: string;
|
|
||||||
reporter?: string;
|
|
||||||
timeout?: number;
|
|
||||||
bail?: boolean;
|
|
||||||
});
|
|
||||||
|
|
||||||
/** Setup mocha with the given options. */
|
|
||||||
setup(options: MochaSetupOptions): Mocha;
|
|
||||||
bail(value?: boolean): Mocha;
|
|
||||||
addFile(file: string): Mocha;
|
|
||||||
/** Sets reporter by name, defaults to "spec". */
|
|
||||||
reporter(name: string): Mocha;
|
|
||||||
/** Sets reporter constructor, defaults to mocha.reporters.Spec. */
|
|
||||||
reporter(reporter: (runner: Mocha.IRunner, options: any) => any): Mocha;
|
|
||||||
ui(value: string): Mocha;
|
|
||||||
grep(value: string): Mocha;
|
|
||||||
grep(value: RegExp): Mocha;
|
|
||||||
invert(): Mocha;
|
|
||||||
ignoreLeaks(value: boolean): Mocha;
|
|
||||||
checkLeaks(): Mocha;
|
|
||||||
/** Enables growl support. */
|
|
||||||
growl(): Mocha;
|
|
||||||
globals(value: string): Mocha;
|
|
||||||
globals(values: string[]): Mocha;
|
|
||||||
useColors(value: boolean): Mocha;
|
|
||||||
useInlineDiffs(value: boolean): Mocha;
|
|
||||||
timeout(value: number): Mocha;
|
|
||||||
slow(value: number): Mocha;
|
|
||||||
enableTimeouts(value: boolean): Mocha;
|
|
||||||
asyncOnly(value: boolean): Mocha;
|
|
||||||
noHighlighting(value: boolean): Mocha;
|
|
||||||
/** Runs tests and invokes `onComplete()` when finished. */
|
|
||||||
run(onComplete?: (failures: number) => void): Mocha.IRunner;
|
|
||||||
}
|
|
||||||
|
|
||||||
// merge the Mocha class declaration with a module
|
|
||||||
declare module Mocha {
|
|
||||||
/** Partial interface for Mocha's `Runnable` class. */
|
|
||||||
interface IRunnable {
|
|
||||||
title: string;
|
|
||||||
fn: Function;
|
|
||||||
async: boolean;
|
|
||||||
sync: boolean;
|
|
||||||
timedOut: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Partial interface for Mocha's `Suite` class. */
|
|
||||||
interface ISuite {
|
|
||||||
parent: ISuite;
|
|
||||||
title: string;
|
|
||||||
|
|
||||||
fullTitle(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Partial interface for Mocha's `Test` class. */
|
|
||||||
interface ITest extends IRunnable {
|
|
||||||
parent: ISuite;
|
|
||||||
pending: boolean;
|
|
||||||
|
|
||||||
fullTitle(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Partial interface for Mocha's `Runner` class. */
|
|
||||||
interface IRunner {}
|
|
||||||
|
|
||||||
interface IContextDefinition {
|
|
||||||
(description: string, spec: () => void): ISuite;
|
|
||||||
only(description: string, spec: () => void): ISuite;
|
|
||||||
skip(description: string, spec: () => void): void;
|
|
||||||
timeout(ms: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ITestDefinition {
|
|
||||||
(expectation: string, assertion?: () => void): ITest;
|
|
||||||
(expectation: string, assertion?: (done: MochaDone) => void): ITest;
|
|
||||||
only(expectation: string, assertion?: () => void): ITest;
|
|
||||||
only(expectation: string, assertion?: (done: MochaDone) => void): ITest;
|
|
||||||
skip(expectation: string, assertion?: () => void): void;
|
|
||||||
skip(expectation: string, assertion?: (done: MochaDone) => void): void;
|
|
||||||
timeout(ms: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export module reporters {
|
|
||||||
export class Base {
|
|
||||||
stats: {
|
|
||||||
suites: number;
|
|
||||||
tests: number;
|
|
||||||
passes: number;
|
|
||||||
pending: number;
|
|
||||||
failures: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor(runner: IRunner);
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Doc extends Base {}
|
|
||||||
export class Dot extends Base {}
|
|
||||||
export class HTML extends Base {}
|
|
||||||
export class HTMLCov extends Base {}
|
|
||||||
export class JSON extends Base {}
|
|
||||||
export class JSONCov extends Base {}
|
|
||||||
export class JSONStream extends Base {}
|
|
||||||
export class Landing extends Base {}
|
|
||||||
export class List extends Base {}
|
|
||||||
export class Markdown extends Base {}
|
|
||||||
export class Min extends Base {}
|
|
||||||
export class Nyan extends Base {}
|
|
||||||
export class Progress extends Base {
|
|
||||||
/**
|
|
||||||
* @param options.open String used to indicate the start of the progress bar.
|
|
||||||
* @param options.complete String used to indicate a complete test on the progress bar.
|
|
||||||
* @param options.incomplete String used to indicate an incomplete test on the progress bar.
|
|
||||||
* @param options.close String used to indicate the end of the progress bar.
|
|
||||||
*/
|
|
||||||
constructor(runner: IRunner, options?: {
|
|
||||||
open?: string;
|
|
||||||
complete?: string;
|
|
||||||
incomplete?: string;
|
|
||||||
close?: string;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
export class Spec extends Base {}
|
|
||||||
export class TAP extends Base {}
|
|
||||||
export class XUnit extends Base {
|
|
||||||
constructor(runner: IRunner, options?: any);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "mocha" {
|
|
||||||
export = Mocha;
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,19 +0,0 @@
|
||||||
// Type definitions for React v0.14 (react-addons-css-transition-group)
|
|
||||||
// Project: http://facebook.github.io/react/
|
|
||||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
|
||||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
||||||
|
|
||||||
/// <reference path="react.d.ts" />
|
|
||||||
|
|
||||||
declare namespace __React {
|
|
||||||
namespace __Addons {
|
|
||||||
export function shallowCompare<P, S>(
|
|
||||||
component: __React.Component<P, S>,
|
|
||||||
nextProps: P,
|
|
||||||
nextState: S): boolean;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-addons-shallow-compare" {
|
|
||||||
export = __React.__Addons.shallowCompare;
|
|
||||||
}
|
|
|
@ -1,155 +0,0 @@
|
||||||
// Type definitions for React v0.14 (react-addons-test-utils)
|
|
||||||
// Project: http://facebook.github.io/react/
|
|
||||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
/// <reference path="react.d.ts" />
|
|
||||||
|
|
||||||
declare namespace __React {
|
|
||||||
interface SyntheticEventData {
|
|
||||||
altKey?: boolean;
|
|
||||||
button?: number;
|
|
||||||
buttons?: number;
|
|
||||||
clientX?: number;
|
|
||||||
clientY?: number;
|
|
||||||
changedTouches?: TouchList;
|
|
||||||
charCode?: boolean;
|
|
||||||
clipboardData?: DataTransfer;
|
|
||||||
ctrlKey?: boolean;
|
|
||||||
deltaMode?: number;
|
|
||||||
deltaX?: number;
|
|
||||||
deltaY?: number;
|
|
||||||
deltaZ?: number;
|
|
||||||
detail?: number;
|
|
||||||
getModifierState?(key: string): boolean;
|
|
||||||
key?: string;
|
|
||||||
keyCode?: number;
|
|
||||||
locale?: string;
|
|
||||||
location?: number;
|
|
||||||
metaKey?: boolean;
|
|
||||||
pageX?: number;
|
|
||||||
pageY?: number;
|
|
||||||
relatedTarget?: EventTarget;
|
|
||||||
repeat?: boolean;
|
|
||||||
screenX?: number;
|
|
||||||
screenY?: number;
|
|
||||||
shiftKey?: boolean;
|
|
||||||
targetTouches?: TouchList;
|
|
||||||
touches?: TouchList;
|
|
||||||
view?: AbstractView;
|
|
||||||
which?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface EventSimulator {
|
|
||||||
(element: Element, eventData?: SyntheticEventData): void;
|
|
||||||
(component: Component<any, any>, eventData?: SyntheticEventData): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MockedComponentClass {
|
|
||||||
new(): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ShallowRenderer {
|
|
||||||
getRenderOutput<E extends ReactElement<any>>(): E;
|
|
||||||
getRenderOutput(): ReactElement<any>;
|
|
||||||
render(element: ReactElement<any>, context?: any): void;
|
|
||||||
unmount(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace __Addons {
|
|
||||||
namespace TestUtils {
|
|
||||||
namespace Simulate {
|
|
||||||
export var blur: EventSimulator;
|
|
||||||
export var change: EventSimulator;
|
|
||||||
export var click: EventSimulator;
|
|
||||||
export var cut: EventSimulator;
|
|
||||||
export var doubleClick: EventSimulator;
|
|
||||||
export var drag: EventSimulator;
|
|
||||||
export var dragEnd: EventSimulator;
|
|
||||||
export var dragEnter: EventSimulator;
|
|
||||||
export var dragExit: EventSimulator;
|
|
||||||
export var dragLeave: EventSimulator;
|
|
||||||
export var dragOver: EventSimulator;
|
|
||||||
export var dragStart: EventSimulator;
|
|
||||||
export var drop: EventSimulator;
|
|
||||||
export var focus: EventSimulator;
|
|
||||||
export var input: EventSimulator;
|
|
||||||
export var keyDown: EventSimulator;
|
|
||||||
export var keyPress: EventSimulator;
|
|
||||||
export var keyUp: EventSimulator;
|
|
||||||
export var mouseDown: EventSimulator;
|
|
||||||
export var mouseEnter: EventSimulator;
|
|
||||||
export var mouseLeave: EventSimulator;
|
|
||||||
export var mouseMove: EventSimulator;
|
|
||||||
export var mouseOut: EventSimulator;
|
|
||||||
export var mouseOver: EventSimulator;
|
|
||||||
export var mouseUp: EventSimulator;
|
|
||||||
export var paste: EventSimulator;
|
|
||||||
export var scroll: EventSimulator;
|
|
||||||
export var submit: EventSimulator;
|
|
||||||
export var touchCancel: EventSimulator;
|
|
||||||
export var touchEnd: EventSimulator;
|
|
||||||
export var touchMove: EventSimulator;
|
|
||||||
export var touchStart: EventSimulator;
|
|
||||||
export var wheel: EventSimulator;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function renderIntoDocument(
|
|
||||||
element: DOMElement<any>): Element;
|
|
||||||
export function renderIntoDocument<P>(
|
|
||||||
element: ReactElement<P>): Component<P, any>;
|
|
||||||
export function renderIntoDocument<C extends Component<any, any>>(
|
|
||||||
element: ReactElement<any>): C;
|
|
||||||
|
|
||||||
export function mockComponent(
|
|
||||||
mocked: MockedComponentClass, mockTagName?: string): typeof TestUtils;
|
|
||||||
|
|
||||||
export function isElementOfType(
|
|
||||||
element: ReactElement<any>, type: ReactType): boolean;
|
|
||||||
export function isDOMComponent(instance: ReactInstance): boolean;
|
|
||||||
export function isCompositeComponent(instance: ReactInstance): boolean;
|
|
||||||
export function isCompositeComponentWithType(
|
|
||||||
instance: ReactInstance,
|
|
||||||
type: ComponentClass<any>): boolean;
|
|
||||||
|
|
||||||
export function findAllInRenderedTree(
|
|
||||||
root: Component<any, any>,
|
|
||||||
fn: (i: ReactInstance) => boolean): ReactInstance[];
|
|
||||||
|
|
||||||
export function scryRenderedDOMComponentsWithClass(
|
|
||||||
root: Component<any, any>,
|
|
||||||
className: string): Element[];
|
|
||||||
export function findRenderedDOMComponentWithClass(
|
|
||||||
root: Component<any, any>,
|
|
||||||
className: string): Element;
|
|
||||||
|
|
||||||
export function scryRenderedDOMComponentsWithTag(
|
|
||||||
root: Component<any, any>,
|
|
||||||
tagName: string): Element[];
|
|
||||||
export function findRenderedDOMComponentWithTag(
|
|
||||||
root: Component<any, any>,
|
|
||||||
tagName: string): Element;
|
|
||||||
|
|
||||||
export function scryRenderedComponentsWithType<P>(
|
|
||||||
root: Component<any, any>,
|
|
||||||
type: ComponentClass<P>): Component<P, {}>[];
|
|
||||||
export function scryRenderedComponentsWithType<C extends Component<any, any>>(
|
|
||||||
root: Component<any, any>,
|
|
||||||
type: ComponentClass<any>): C[];
|
|
||||||
|
|
||||||
export function findRenderedComponentWithType<P>(
|
|
||||||
root: Component<any, any>,
|
|
||||||
type: ComponentClass<P>): Component<P, {}>;
|
|
||||||
export function findRenderedComponentWithType<C extends Component<any, any>>(
|
|
||||||
root: Component<any, any>,
|
|
||||||
type: ComponentClass<any>): C;
|
|
||||||
|
|
||||||
export function createRenderer(): ShallowRenderer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-addons-test-utils" {
|
|
||||||
import TestUtils = __React.__Addons.TestUtils;
|
|
||||||
export = TestUtils;
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
// Type definitions for React v0.14 (react-addons-update)
|
|
||||||
// Project: http://facebook.github.io/react/
|
|
||||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
|
||||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
||||||
|
|
||||||
/// <reference path="react.d.ts" />
|
|
||||||
|
|
||||||
declare namespace __React {
|
|
||||||
interface UpdateSpecCommand {
|
|
||||||
$set?: any;
|
|
||||||
$merge?: {};
|
|
||||||
$apply?(value: any): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface UpdateSpecPath {
|
|
||||||
[key: string]: UpdateSpec;
|
|
||||||
}
|
|
||||||
|
|
||||||
type UpdateSpec = UpdateSpecCommand | UpdateSpecPath;
|
|
||||||
|
|
||||||
interface UpdateArraySpec extends UpdateSpecCommand {
|
|
||||||
$push?: any[];
|
|
||||||
$unshift?: any[];
|
|
||||||
$splice?: any[][];
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace __Addons {
|
|
||||||
export function update(value: any[], spec: UpdateArraySpec): any[];
|
|
||||||
export function update(value: {}, spec: UpdateSpec): any;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-addons-update" {
|
|
||||||
export = __React.__Addons.update;
|
|
||||||
}
|
|
|
@ -1,66 +0,0 @@
|
||||||
// Type definitions for React v0.14 (react-dom)
|
|
||||||
// Project: http://facebook.github.io/react/
|
|
||||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
/// <reference path="react.d.ts" />
|
|
||||||
|
|
||||||
declare namespace __React {
|
|
||||||
namespace __DOM {
|
|
||||||
function findDOMNode<E extends Element>(instance: ReactInstance): E;
|
|
||||||
function findDOMNode(instance: ReactInstance): Element;
|
|
||||||
|
|
||||||
function render<P>(
|
|
||||||
element: DOMElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (element: Element) => any): Element;
|
|
||||||
function render<P, S>(
|
|
||||||
element: ClassicElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
|
|
||||||
function render<P, S>(
|
|
||||||
element: ReactElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
|
||||||
|
|
||||||
function unmountComponentAtNode(container: Element): boolean;
|
|
||||||
|
|
||||||
var version: string;
|
|
||||||
|
|
||||||
function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
|
|
||||||
function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
|
||||||
function unstable_batchedUpdates(callback: () => any): void;
|
|
||||||
|
|
||||||
function unstable_renderSubtreeIntoContainer<P>(
|
|
||||||
parentComponent: Component<any, any>,
|
|
||||||
nextElement: DOMElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (element: Element) => any): Element;
|
|
||||||
function unstable_renderSubtreeIntoContainer<P, S>(
|
|
||||||
parentComponent: Component<any, any>,
|
|
||||||
nextElement: ClassicElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
|
|
||||||
function unstable_renderSubtreeIntoContainer<P, S>(
|
|
||||||
parentComponent: Component<any, any>,
|
|
||||||
nextElement: ReactElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace __DOMServer {
|
|
||||||
function renderToString(element: ReactElement<any>): string;
|
|
||||||
function renderToStaticMarkup(element: ReactElement<any>): string;
|
|
||||||
var version: string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-dom" {
|
|
||||||
import DOM = __React.__DOM;
|
|
||||||
export = DOM;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-dom/server" {
|
|
||||||
import DOMServer = __React.__DOMServer;
|
|
||||||
export = DOMServer;
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,21 +0,0 @@
|
||||||
// Type definitions for System.js 0.18.4
|
|
||||||
// Project: https://github.com/systemjs/systemjs
|
|
||||||
// Definitions by: Ludovic HENIN <https://github.com/ludohenin/>, Nathan Walker <https://github.com/NathanWalker/>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
interface System {
|
|
||||||
import(name: string): any;
|
|
||||||
defined: any;
|
|
||||||
amdDefine: () => void;
|
|
||||||
amdRequire: () => void;
|
|
||||||
baseURL: string;
|
|
||||||
paths: { [key: string]: string };
|
|
||||||
meta: { [key: string]: Object };
|
|
||||||
config: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var System: System;
|
|
||||||
|
|
||||||
declare module "systemjs" {
|
|
||||||
export = System;
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
/// <reference path="@ms/odsp.d.ts" />
|
|
||||||
/// <reference path="@ms/odsp-webpack.d.ts" />
|
|
||||||
/// <reference path="assertion-error/assertion-error.d.ts" />
|
|
||||||
/// <reference path="chai/chai.d.ts" />
|
|
||||||
/// <reference path="es6-collections/es6-collections.d.ts" />
|
|
||||||
/// <reference path="es6-promise/es6-promise.d.ts" />
|
|
||||||
/// <reference path="lodash/lodash.d.ts" />
|
|
||||||
/// <reference path="mocha/mocha.d.ts" />
|
|
||||||
/// <reference path="node/node.d.ts" />
|
|
||||||
/// <reference path="react/react.d.ts" />
|
|
||||||
/// <reference path="react/react-addons-shallow-compare.d.ts" />
|
|
||||||
/// <reference path="react/react-addons-test-utils.d.ts" />
|
|
||||||
/// <reference path="react/react-addons-update.d.ts" />
|
|
||||||
/// <reference path="react/react-dom.d.ts" />
|
|
||||||
/// <reference path="systemjs/systemjs.d.ts" />
|
|
||||||
/// <reference path="whatwg-fetch/whatwg-fetch.d.ts" />
|
|
||||||
/// <reference path="knockout/knockout.d.ts" />
|
|
||||||
/// <reference path="angularjs/angular.d.ts" />
|
|
||||||
/// <reference path="jquery/jquery.d.ts" />
|
|
||||||
/// <reference path="combokeys/combokeys.d.ts" />
|
|
|
@ -1,87 +0,0 @@
|
||||||
// Type definitions for fetch API
|
|
||||||
// Project: https://github.com/github/fetch
|
|
||||||
// Definitions by: Ryan Graham <https://github.com/ryan-codingintrigue>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
/// <reference path="../es6-promise/es6-promise.d.ts" />
|
|
||||||
|
|
||||||
declare class Request extends Body {
|
|
||||||
constructor(input: string|Request, init?:RequestInit);
|
|
||||||
method: string;
|
|
||||||
url: string;
|
|
||||||
headers: Headers;
|
|
||||||
context: string|RequestContext;
|
|
||||||
referrer: string;
|
|
||||||
mode: string|RequestMode;
|
|
||||||
credentials: string|RequestCredentials;
|
|
||||||
cache: string|RequestCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RequestInit {
|
|
||||||
method?: string;
|
|
||||||
headers?: HeaderInit|{ [index: string]: string };
|
|
||||||
body?: BodyInit;
|
|
||||||
mode?: string|RequestMode;
|
|
||||||
credentials?: string|RequestCredentials;
|
|
||||||
cache?: string|RequestCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare enum RequestContext {
|
|
||||||
"audio", "beacon", "cspreport", "download", "embed", "eventsource", "favicon", "fetch",
|
|
||||||
"font", "form", "frame", "hyperlink", "iframe", "image", "imageset", "import",
|
|
||||||
"internal", "location", "manifest", "object", "ping", "plugin", "prefetch", "script",
|
|
||||||
"serviceworker", "sharedworker", "subresource", "style", "track", "video", "worker",
|
|
||||||
"xmlhttprequest", "xslt"
|
|
||||||
}
|
|
||||||
declare enum RequestMode { "same-origin", "no-cors", "cors" }
|
|
||||||
declare enum RequestCredentials { "omit", "same-origin", "include" }
|
|
||||||
declare enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" }
|
|
||||||
|
|
||||||
declare class Headers {
|
|
||||||
append(name: string, value: string): void;
|
|
||||||
delete(name: string):void;
|
|
||||||
get(name: string): string;
|
|
||||||
getAll(name: string): Array<string>;
|
|
||||||
has(name: string): boolean;
|
|
||||||
set(name: string, value: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare class Body {
|
|
||||||
bodyUsed: boolean;
|
|
||||||
arrayBuffer(): Promise<ArrayBuffer>;
|
|
||||||
blob(): Promise<Blob>;
|
|
||||||
formData(): Promise<FormData>;
|
|
||||||
json(): Promise<any>;
|
|
||||||
json<T>(): Promise<T>;
|
|
||||||
text(): Promise<string>;
|
|
||||||
}
|
|
||||||
declare class Response extends Body {
|
|
||||||
constructor(body?: BodyInit, init?: ResponseInit);
|
|
||||||
error(): Response;
|
|
||||||
redirect(url: string, status: number): Response;
|
|
||||||
type: string|ResponseType;
|
|
||||||
url: string;
|
|
||||||
status: number;
|
|
||||||
ok: boolean;
|
|
||||||
statusText: string;
|
|
||||||
headers: Headers;
|
|
||||||
clone(): Response;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare enum ResponseType { "basic", "cors", "default", "error", "opaque" }
|
|
||||||
|
|
||||||
interface ResponseInit {
|
|
||||||
status: number;
|
|
||||||
statusText?: string;
|
|
||||||
headers?: HeaderInit;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare type HeaderInit = Headers|Array<string>;
|
|
||||||
declare type BodyInit = Blob|FormData|string;
|
|
||||||
declare type RequestInfo = Request|string;
|
|
||||||
|
|
||||||
interface Window {
|
|
||||||
fetch(url: string|Request, init?: RequestInit): Promise<Response>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var fetch: typeof window.fetch;
|
|
|
@ -3,9 +3,6 @@ logs
|
||||||
*.log
|
*.log
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
|
|
||||||
# Yeoman configuration files
|
|
||||||
.yo-rc.json
|
|
||||||
|
|
||||||
# Dependency directories
|
# Dependency directories
|
||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
|
@ -14,6 +11,7 @@ dist
|
||||||
lib
|
lib
|
||||||
solution
|
solution
|
||||||
temp
|
temp
|
||||||
|
*.sppkg
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
# Coverage directory used by tools like istanbul
|
||||||
coverage
|
coverage
|
|
@ -2,7 +2,7 @@
|
||||||
.vscode
|
.vscode
|
||||||
coverage
|
coverage
|
||||||
node_modules
|
node_modules
|
||||||
solution
|
sharepoint
|
||||||
src
|
src
|
||||||
temp
|
temp
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"@microsoft/generator-sharepoint": {
|
||||||
|
"libraryName": "angular-todo",
|
||||||
|
"framework": "none",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"libraryId": "c6037b1c-ea11-44f6-8663-2ea42c9a64ab"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
# Angular client-side web part
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
Sample Web Part illustrating using Angular with the SharePoint Framework.
|
||||||
|
|
||||||
|
![Sample To do SharePoint Framework client-side web part built using Angular](./assets/preview.png)
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
||||||
|
## Solution
|
||||||
|
|
||||||
|
Solution|Author(s)
|
||||||
|
--------|---------
|
||||||
|
angular-todo|Waldek Mastykarz (MVP, Rencore, @waldekm)
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
Version|Date|Comments
|
||||||
|
-------|----|--------
|
||||||
|
1.0|March 10, 2017|Initial release
|
||||||
|
|
||||||
|
## 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 repo
|
||||||
|
* in the command line run:
|
||||||
|
* `npm i`
|
||||||
|
* `gulp serve`
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
The To do web part is a sample client-side web part built on the SharePoint Framework built using Angular.
|
||||||
|
|
||||||
|
This web part illustrates the following concepts on top of the SharePoint Framework:
|
||||||
|
|
||||||
|
* using Angular v1.x with TypeScript for building SharePoint Framework client-side web parts
|
||||||
|
* loading Angular from CDN
|
||||||
|
* using Office UI Fabric CSS styles in a SharePoint Framework client-side web part
|
||||||
|
* using non-reactive web part property pane
|
||||||
|
* using conditional rendering for one-time web part setup
|
||||||
|
* passing web part configuration to Angular and reacting to configuration changes
|
||||||
|
|
||||||
|
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/samples/angular-todo" />
|
Binary file not shown.
After Width: | Height: | Size: 43 KiB |
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"entry": "./lib/webparts/toDo/ToDoWebPart.js",
|
||||||
|
"manifest": "./src/webparts/toDo/ToDoWebPart.manifest.json",
|
||||||
|
"outputPath": "./dist/to-do.bundle.js"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"externals": {
|
||||||
|
"angular": {
|
||||||
|
"path": "https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.min.js",
|
||||||
|
"globalName": "angular"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"localizedResources": {
|
||||||
|
"toDoStrings": "webparts/toDo/loc/{locale}.js"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"workingDir": "./temp/deploy/",
|
"workingDir": "./temp/deploy/",
|
||||||
"account": "<!-- STORAGE ACCOUNT NAME -->",
|
"account": "<!-- STORAGE ACCOUNT NAME -->",
|
||||||
"container": "angular-ngofficeuifabric-todo",
|
"container": "angular-todo",
|
||||||
"accessKey": "<!-- ACCESS KEY -->"
|
"accessKey": "<!-- ACCESS KEY -->"
|
||||||
}
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"solution": {
|
||||||
|
"name": "angular-todo-client-side-solution",
|
||||||
|
"id": "c6037b1c-ea11-44f6-8663-2ea42c9a64ab",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
"paths": {
|
||||||
|
"zippedPackage": "solution/angular-todo.sppkg"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"port": 4321,
|
"port": 4321,
|
||||||
"initialPage": "http://localhost:5432/workbench",
|
"initialPage": "https://localhost:5432/workbench",
|
||||||
|
"https": true,
|
||||||
"api": {
|
"api": {
|
||||||
"port": 5432,
|
"port": 5432,
|
||||||
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
|
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
|
|
@ -0,0 +1,46 @@
|
||||||
|
{
|
||||||
|
// 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,
|
||||||
|
"prefer-const": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
"name": "angular-todo",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"private": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"name": "Waldek Mastykarz",
|
||||||
|
"url": "https://rencore.com"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@microsoft/sp-client-base": "~1.0.0",
|
||||||
|
"@microsoft/sp-core-library": "~1.0.0",
|
||||||
|
"@microsoft/sp-webpart-base": "~1.0.0",
|
||||||
|
"@types/webpack-env": ">=1.12.1 <1.14.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@microsoft/sp-build-web": "~1.0.0",
|
||||||
|
"@microsoft/sp-module-interfaces": "~1.0.0",
|
||||||
|
"@microsoft/sp-webpart-workbench": "~1.0.0",
|
||||||
|
"@types/angular": "^1.6.9",
|
||||||
|
"@types/chai": ">=3.4.34 <3.6.0",
|
||||||
|
"@types/mocha": ">=2.2.33 <2.6.0",
|
||||||
|
"gulp": "~3.9.1"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "gulp bundle",
|
||||||
|
"clean": "gulp clean",
|
||||||
|
"test": "gulp test"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,239 @@
|
||||||
|
.toDoWebPart {
|
||||||
|
.loading {
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 6em;
|
||||||
|
|
||||||
|
.spinner {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 10px 0;
|
||||||
|
|
||||||
|
@-webkit-keyframes spinnerSpin {
|
||||||
|
0% {
|
||||||
|
-webkit-transform:rotate(0);
|
||||||
|
transform:rotate(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-webkit-transform:rotate(360deg);
|
||||||
|
transform:rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes spinnerSpin {
|
||||||
|
0% {
|
||||||
|
-webkit-transform:rotate(0);
|
||||||
|
transform:rotate(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-webkit-transform:rotate(360deg);
|
||||||
|
transform:rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.spinnerCircle {
|
||||||
|
margin: auto;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border: 1.5px solid #c7e0f4;
|
||||||
|
border-top-color: #0078d7;
|
||||||
|
-webkit-animation: spinnerSpin 1.3s infinite cubic-bezier(.53, .21, .29, .67);
|
||||||
|
animation: spinnerSpin 1.3s infinite cubic-bezier(.53, .21, .29, .67);
|
||||||
|
|
||||||
|
&.spinnerLarge {
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.spinnerLabel {
|
||||||
|
color: #0078d7;
|
||||||
|
margin-top: 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
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;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
color: #333333;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: block;
|
||||||
|
padding: 5px 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.textField {
|
||||||
|
font-family: "Segoe UI WestEuropean", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
color: #333333;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
|
||||||
|
&.underlined {
|
||||||
|
border-bottom: 1px solid #c8c8c8;
|
||||||
|
display: table;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: #767676;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.isActive, &:active {
|
||||||
|
border-color: #0078d7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field {
|
||||||
|
border: 0;
|
||||||
|
display: table-cell;
|
||||||
|
padding-top: 8px;
|
||||||
|
padding-bottom: 3px
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
padding-right: 0;
|
||||||
|
padding-left: 12px;
|
||||||
|
margin-right: 8px;
|
||||||
|
font-size: 14px;
|
||||||
|
display: table-cell;
|
||||||
|
vertical-align: top;
|
||||||
|
padding-top: 9px;
|
||||||
|
height: 32px;
|
||||||
|
width: 1%;
|
||||||
|
white-space: nowrap;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field {
|
||||||
|
text-align: left;
|
||||||
|
float: left;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
font-family: "Segoe UI WestEuropean", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
border: 1px solid #c8c8c8;
|
||||||
|
border-radius: 0;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333333;
|
||||||
|
height: 32px;
|
||||||
|
padding: 0 12px 0 12px;
|
||||||
|
width: 100%;
|
||||||
|
outline: 0;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field:hover {
|
||||||
|
border-color: #767676;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.listItem {
|
||||||
|
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;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
padding: 9px 28px 3px;
|
||||||
|
position: relative;
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
display: table;
|
||||||
|
content: "";
|
||||||
|
line-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
display: table;
|
||||||
|
content: "";
|
||||||
|
line-height: 0;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.listItemPrimaryText {
|
||||||
|
font-family: "Segoe UI WestEuropean", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
font-size: 21px;
|
||||||
|
font-weight: 100;
|
||||||
|
padding-right: 80px;
|
||||||
|
position: relative;
|
||||||
|
top: -4px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.listItemActions {
|
||||||
|
max-width: 80px;
|
||||||
|
position: absolute;
|
||||||
|
right: 30px;
|
||||||
|
text-align: right;
|
||||||
|
top: 10px;
|
||||||
|
|
||||||
|
.listItemAction {
|
||||||
|
color: #a6a6a6;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 15px;
|
||||||
|
position: relative;
|
||||||
|
text-align: center;
|
||||||
|
top: 3px;
|
||||||
|
cursor: pointer;
|
||||||
|
height: 16px;
|
||||||
|
width: 16px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #666666;
|
||||||
|
outline: 1px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.done {
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
display: inline-block;
|
||||||
|
font-family: FabricMDL2Icons;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
speak: none;
|
||||||
|
|
||||||
|
&.iconCheckMark::before {
|
||||||
|
content: "\E73E";
|
||||||
|
}
|
||||||
|
|
||||||
|
&.iconUndo::before {
|
||||||
|
content: "\E7A7";
|
||||||
|
}
|
||||||
|
|
||||||
|
&.iconRecycleBin::before {
|
||||||
|
content: "\EF87";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,13 +1,14 @@
|
||||||
{
|
{
|
||||||
"$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json",
|
"$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json",
|
||||||
|
|
||||||
"id": "46f8b70d-55c4-4b4e-8454-053ff5e426fa",
|
"id": "4894c03a-593c-4033-ae5a-afb4d4d47f27",
|
||||||
|
"alias": "ToDoWebPart",
|
||||||
"componentType": "WebPart",
|
"componentType": "WebPart",
|
||||||
"version": "0.0.2",
|
"version": "0.0.1",
|
||||||
"manifestVersion": 2,
|
"manifestVersion": 2,
|
||||||
|
|
||||||
"preconfiguredEntries": [{
|
"preconfiguredEntries": [{
|
||||||
"groupId": "46f8b70d-55c4-4b4e-8454-053ff5e426fa",
|
"groupId": "4894c03a-593c-4033-ae5a-afb4d4d47f27",
|
||||||
"group": { "default": "Productivity" },
|
"group": { "default": "Productivity" },
|
||||||
"title": { "default": "To do" },
|
"title": { "default": "To do" },
|
||||||
"description": { "default": "Simple management of to do tasks" },
|
"description": { "default": "Simple management of to do tasks" },
|
|
@ -0,0 +1,93 @@
|
||||||
|
import { Version } from '@microsoft/sp-core-library';
|
||||||
|
import {
|
||||||
|
BaseClientSideWebPart,
|
||||||
|
IPropertyPaneConfiguration,
|
||||||
|
PropertyPaneToggle
|
||||||
|
} from '@microsoft/sp-webpart-base';
|
||||||
|
|
||||||
|
import styles from './ToDo.module.scss';
|
||||||
|
import * as strings from 'toDoStrings';
|
||||||
|
import { IToDoWebPartProps } from './IToDoWebPartProps';
|
||||||
|
|
||||||
|
import * as angular from 'angular';
|
||||||
|
import './app/app-module';
|
||||||
|
|
||||||
|
export default class ToDoWebPart extends BaseClientSideWebPart<IToDoWebPartProps> {
|
||||||
|
private $injector: angular.auto.IInjectorService;
|
||||||
|
|
||||||
|
public render(): void {
|
||||||
|
if (this.renderedOnce === false) {
|
||||||
|
this.domElement.innerHTML = `
|
||||||
|
<div class="${styles.toDoWebPart}">
|
||||||
|
<div data-ng-controller="HomeController as vm">
|
||||||
|
<div class="${styles.loading}" ng-show="vm.isLoading">
|
||||||
|
<div class="${styles.spinner}">
|
||||||
|
<div class="${styles.spinnerCircle} ${styles.spinnerLarge}"></div>
|
||||||
|
<div class="${styles.spinnerLabel}">Loading...</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div ng-show="vm.isLoading === false">
|
||||||
|
<div class="${styles.textField} ${styles.underlined}" ng-class="{'${styles.isActive}': vm.newToDoActive}">
|
||||||
|
<label for="newToDo" class="${styles.label}">New to do:</label>
|
||||||
|
<input type="text" label="New to do:" id="newToDo" value="" class="${styles.field}" aria-invalid="false" ng-model="vm.newItem" ng-keydown="vm.todoKeyDown($event)" ng-focus="vm.newToDoActive = true" ng-blur="vm.newToDoActive = false">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="list" ng-show="vm.isLoading === false">
|
||||||
|
<div class="listSurface">
|
||||||
|
<div class="listPage">
|
||||||
|
<div class="listCell" ng-repeat="todo in vm.todoCollection" uif-item="todo" ng-class="{'${styles.done}': todo.done}">
|
||||||
|
<div class="${styles.listItem}">
|
||||||
|
<span class="${styles.listItemPrimaryText}">{{todo.title}}</span>
|
||||||
|
<div class="${styles.listItemActions}">
|
||||||
|
<div class="${styles.listItemAction}" ng-click="vm.completeTodo(todo)" ng-show="todo.done === false">
|
||||||
|
<i class="${styles.icon} ${styles.iconCheckMark}"></i>
|
||||||
|
</div>
|
||||||
|
<div class="${styles.listItemAction}" ng-click="vm.undoTodo(todo)" ng-show="todo.done">
|
||||||
|
<i class="${styles.icon} ${styles.iconUndo}"></i>
|
||||||
|
</div>
|
||||||
|
<div class="${styles.listItemAction}" ng-click="vm.deleteTodo(todo)">
|
||||||
|
<i class="${styles.icon} ${styles.iconRecycleBin}"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
this.$injector = angular.bootstrap(this.domElement, ['todoapp']);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$injector.get('$rootScope').$broadcast('configurationChanged', {
|
||||||
|
hideFinishedTasks: this.properties.hideFinishedTasks
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected get dataVersion(): Version {
|
||||||
|
return Version.parse('1.0');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
|
||||||
|
return {
|
||||||
|
pages: [
|
||||||
|
{
|
||||||
|
header: {
|
||||||
|
description: strings.PropertyPaneDescription
|
||||||
|
},
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
groupName: strings.ViewGroupName,
|
||||||
|
groupFields: [
|
||||||
|
PropertyPaneToggle('hideFinishedTasks', {
|
||||||
|
label: strings.HideFinishedTasksFieldLabel
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,10 +5,10 @@ export interface ITodo {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDataService {
|
export interface IDataService {
|
||||||
getTodos(hideFinishedTasks: boolean): ng.IPromise<ITodo[]>;
|
getTodos(hideFinishedTasks: boolean): angular.IPromise<ITodo[]>;
|
||||||
addTodo(todo: string): ng.IPromise<{}>;
|
addTodo(todo: string): angular.IPromise<{}>;
|
||||||
deleteTodo(todo: ITodo): ng.IPromise<{}>;
|
deleteTodo(todo: ITodo): angular.IPromise<{}>;
|
||||||
setTodoStatus(todo: ITodo, done: boolean): ng.IPromise<{}>;
|
setTodoStatus(todo: ITodo, done: boolean): angular.IPromise<{}>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class DataService implements IDataService {
|
export default class DataService implements IDataService {
|
||||||
|
@ -33,11 +33,11 @@ export default class DataService implements IDataService {
|
||||||
];
|
];
|
||||||
private nextId: number = 4;
|
private nextId: number = 4;
|
||||||
|
|
||||||
constructor(private $q: ng.IQService) {
|
constructor(private $q: angular.IQService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getTodos(hideFinishedTasks: boolean): ng.IPromise<ITodo[]> {
|
public getTodos(hideFinishedTasks: boolean): angular.IPromise<ITodo[]> {
|
||||||
const deferred: ng.IDeferred<ITodo[]> = this.$q.defer();
|
const deferred: angular.IDeferred<ITodo[]> = this.$q.defer();
|
||||||
|
|
||||||
const todos: ITodo[] = [];
|
const todos: ITodo[] = [];
|
||||||
for (let i: number = 0; i < this.items.length; i++) {
|
for (let i: number = 0; i < this.items.length; i++) {
|
||||||
|
@ -53,8 +53,8 @@ export default class DataService implements IDataService {
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public addTodo(todo: string): ng.IPromise<{}> {
|
public addTodo(todo: string): angular.IPromise<{}> {
|
||||||
const deferred: ng.IDeferred<{}> = this.$q.defer();
|
const deferred: angular.IDeferred<{}> = this.$q.defer();
|
||||||
|
|
||||||
this.items.push({
|
this.items.push({
|
||||||
id: this.nextId++,
|
id: this.nextId++,
|
||||||
|
@ -67,8 +67,8 @@ export default class DataService implements IDataService {
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteTodo(todo: ITodo): ng.IPromise<{}> {
|
public deleteTodo(todo: ITodo): angular.IPromise<{}> {
|
||||||
const deferred: ng.IDeferred<{}> = this.$q.defer();
|
const deferred: angular.IDeferred<{}> = this.$q.defer();
|
||||||
|
|
||||||
let pos: number = -1;
|
let pos: number = -1;
|
||||||
for (let i: number = 0; i < this.items.length; i++) {
|
for (let i: number = 0; i < this.items.length; i++) {
|
||||||
|
@ -89,8 +89,8 @@ export default class DataService implements IDataService {
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setTodoStatus(todo: ITodo, done: boolean): ng.IPromise<{}> {
|
public setTodoStatus(todo: ITodo, done: boolean): angular.IPromise<{}> {
|
||||||
const deferred: ng.IDeferred<{}> = this.$q.defer();
|
const deferred: angular.IDeferred<{}> = this.$q.defer();
|
||||||
|
|
||||||
for (let i: number = 0; i < this.items.length; i++) {
|
for (let i: number = 0; i < this.items.length; i++) {
|
||||||
if (this.items[i].id === todo.id) {
|
if (this.items[i].id === todo.id) {
|
|
@ -3,16 +3,17 @@ import { IDataService, ITodo } from './DataService';
|
||||||
export default class HomeController {
|
export default class HomeController {
|
||||||
public isLoading: boolean = false;
|
public isLoading: boolean = false;
|
||||||
public newItem: string = null;
|
public newItem: string = null;
|
||||||
|
public newToDoActive: boolean = false;
|
||||||
public todoCollection: any[] = [];
|
public todoCollection: any[] = [];
|
||||||
private hideFinishedTasks: boolean = false;
|
private hideFinishedTasks: boolean = false;
|
||||||
|
|
||||||
public static $inject: string[] = ['DataService', '$window', '$rootScope'];
|
public static $inject: string[] = ['DataService', '$window', '$rootScope'];
|
||||||
|
|
||||||
constructor(private dataService: IDataService, private $window: ng.IWindowService, private $rootScope: ng.IRootScopeService) {
|
constructor(private dataService: IDataService, private $window: angular.IWindowService, private $rootScope: angular.IRootScopeService) {
|
||||||
const vm: HomeController = this;
|
const vm: HomeController = this;
|
||||||
this.init();
|
this.init();
|
||||||
|
|
||||||
$rootScope.$on('configurationChanged', (event: ng.IAngularEvent, args: { hideFinishedTasks: boolean }): void => {
|
$rootScope.$on('configurationChanged', (event: angular.IAngularEvent, args: { hideFinishedTasks: boolean }): void => {
|
||||||
vm.init(args.hideFinishedTasks);
|
vm.init(args.hideFinishedTasks);
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -2,12 +2,7 @@ import * as angular from 'angular';
|
||||||
import HomeController from './HomeController';
|
import HomeController from './HomeController';
|
||||||
import DataService from './DataService';
|
import DataService from './DataService';
|
||||||
|
|
||||||
import 'ng-office-ui-fabric';
|
const todoapp: angular.IModule = angular.module('todoapp', []);
|
||||||
|
|
||||||
const todoapp: ng.IModule = angular.module('todoapp', [
|
|
||||||
'officeuifabric.core',
|
|
||||||
'officeuifabric.components'
|
|
||||||
]);
|
|
||||||
|
|
||||||
todoapp
|
todoapp
|
||||||
.controller('HomeController', HomeController)
|
.controller('HomeController', HomeController)
|
|
@ -1,4 +1,6 @@
|
||||||
import * as assert from 'assert';
|
/// <reference types="mocha" />
|
||||||
|
|
||||||
|
import { assert } from 'chai';
|
||||||
|
|
||||||
describe('ToDoWebPart', () => {
|
describe('ToDoWebPart', () => {
|
||||||
it('should do something', () => {
|
it('should do something', () => {
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es5",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"module": "commonjs",
|
||||||
|
"jsx": "react",
|
||||||
|
"declaration": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"types": [
|
||||||
|
"es6-promise",
|
||||||
|
"es6-collections",
|
||||||
|
"webpack-env"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
// 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;
|
|
@ -0,0 +1 @@
|
||||||
|
/// <reference path="@ms/odsp.d.ts" />
|
|
@ -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 @@
|
||||||
|
* text=auto
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Folders
|
||||||
|
.vscode
|
||||||
|
coverage
|
||||||
|
node_modules
|
||||||
|
sharepoint
|
||||||
|
src
|
||||||
|
temp
|
||||||
|
|
||||||
|
# Files
|
||||||
|
*.csproj
|
||||||
|
.git*
|
||||||
|
.yo-rc.json
|
||||||
|
gulpfile.js
|
||||||
|
tsconfig.json
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"vsicons.presets.angular": false
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"@microsoft/generator-sharepoint": {
|
||||||
|
"libraryName": "modern-charts",
|
||||||
|
"framework": "react",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"libraryId": "f8a78a9a-a93e-4843-89e5-7b871d9b9fa2"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
# Modern Charts
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
This webpart uses the Chart.js library to visualize SharePoint list data.
|
||||||
|
|
||||||
|
Built in Chart Types:
|
||||||
|
-Bar
|
||||||
|
-Horizontal Bar
|
||||||
|
-Doughnut
|
||||||
|
-Line
|
||||||
|
-Pie
|
||||||
|
-Polar
|
||||||
|
-Radar
|
||||||
|
|
||||||
|
Each chart is uniquely themed with the built-in color theme generator (color-scheme), continue generating a theme until you find one to your liking.
|
||||||
|
|
||||||
|
New charts are populated with Sample data, select a site (or define a custom path with the Other option), a list data source, label column, data column and which column indicates a unique value in your list. See the demo below for an example.
|
||||||
|
|
||||||
|
Current Data Functions:
|
||||||
|
-Average
|
||||||
|
-Count
|
||||||
|
-Sum
|
||||||
|
|
||||||
|
## Media
|
||||||
|
![](https://raw.githubusercontent.com/jcoleman-pcprofessional/Modern-Charts/master/assets/modern-chart2.png)
|
||||||
|
![](https://raw.githubusercontent.com/jcoleman-pcprofessional/Modern-Charts/master/assets/modern-charts.png)
|
||||||
|
![](https://raw.githubusercontent.com/jcoleman-pcprofessional/Modern-Charts/master/assets/Modern-Charts.gif)
|
||||||
|
|
||||||
|
### Working with
|
||||||
|
|
||||||
|
Built with SharePoint Framework GA, Office Graph, React and Chart.JS
|
||||||
|
|
||||||
|
## Used SharePoint Framework Version
|
||||||
|
![drop](https://img.shields.io/badge/version-GA-green.svg)
|
||||||
|
|
||||||
|
## Applies to
|
||||||
|
|
||||||
|
* [SharePoint Framework Developer Preview](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)
|
||||||
|
|
||||||
|
## Solution
|
||||||
|
|
||||||
|
Solution|Author(s)
|
||||||
|
--------|---------
|
||||||
|
react-modern-charts|Jeremy Coleman (MCP, PC Professional, Inc.)
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
Version|Date|Comments
|
||||||
|
-------|----|--------
|
||||||
|
1.0.0.0|February 11, 2017|Initial release
|
||||||
|
|
||||||
|
## 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.**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- SharePoint Online tenant with Office Graph content enabled
|
||||||
|
|
||||||
|
## Minimal Path to Awesome
|
||||||
|
|
||||||
|
- clone this repo
|
||||||
|
- `$ npm i`
|
||||||
|
- `$ gulp serve`
|
||||||
|
- if deploying to Office 365, upadte the CDN path in write-manifests.json
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
Sample Web Parts in this solution illustrate the following concepts on top of the SharePoint Framework:
|
||||||
|
|
||||||
|
- using React for building SharePoint Framework Client-Side Web Parts
|
||||||
|
- using Office UI Fabric React components for building user experience consistent with SharePoint and Office
|
||||||
|
- communicating with SharePoint using its REST API
|
||||||
|
- passing Web Part properties to React components
|
||||||
|
- building dynamic web part properties
|
||||||
|
|
||||||
|
![](https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/samples/react-modern-charts)
|
Binary file not shown.
After Width: | Height: | Size: 718 KiB |
Binary file not shown.
After Width: | Height: | Size: 240 KiB |
Binary file not shown.
After Width: | Height: | Size: 131 KiB |
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"entry": "./lib/webparts/modernCharts/ModernChartsWebPart.js",
|
||||||
|
"manifest": "./src/webparts/modernCharts/ModernChartsWebPart.manifest.json",
|
||||||
|
"outputPath": "./dist/modern-charts.bundle.js"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"externals": {},
|
||||||
|
"localizedResources": {
|
||||||
|
"modernChartsStrings": "webparts/modernCharts/loc/{locale}.js"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"workingDir": "./temp/deploy/",
|
||||||
|
"account": "<!-- STORAGE ACCOUNT NAME -->",
|
||||||
|
"container": "modern-charts",
|
||||||
|
"accessKey": "<!-- ACCESS KEY -->"
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"solution": {
|
||||||
|
"name": "modern-charts-client-side-solution",
|
||||||
|
"id": "f8a78a9a-a93e-4843-89e5-7b871d9b9fa2",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
"paths": {
|
||||||
|
"zippedPackage": "solution/modern-charts.sppkg"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"port": 4321,
|
||||||
|
"initialPage": "https://localhost:5432/workbench",
|
||||||
|
"https": true,
|
||||||
|
"api": {
|
||||||
|
"port": 5432,
|
||||||
|
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
{
|
||||||
|
// 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,
|
||||||
|
"prefer-const": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"cdnBasePath": "<!-- PATH TO CDN -->"
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const gulp = require('gulp');
|
||||||
|
const build = require('@microsoft/sp-build-web');
|
||||||
|
|
||||||
|
build.initialize(gulp);
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
"name": "modern-charts",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"private": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@microsoft/sp-client-base": "~1.0.0",
|
||||||
|
"@microsoft/sp-core-library": "~1.0.0",
|
||||||
|
"@microsoft/sp-webpart-base": "~1.0.0",
|
||||||
|
"@types/chart.js": "0.0.14",
|
||||||
|
"@types/react": "0.14.46",
|
||||||
|
"@types/react-addons-shallow-compare": "0.14.17",
|
||||||
|
"@types/react-addons-test-utils": "0.14.15",
|
||||||
|
"@types/react-addons-update": "0.14.14",
|
||||||
|
"@types/react-dom": "0.14.18",
|
||||||
|
"@types/webpack-env": ">=1.12.1 <1.14.0",
|
||||||
|
"chart.js": "^2.5.0",
|
||||||
|
"color-scheme": "0.0.5",
|
||||||
|
"react": "15.4.2",
|
||||||
|
"react-chartjs-2": "^2.0.5",
|
||||||
|
"react-dom": "15.4.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@microsoft/sp-build-web": "~1.0.0",
|
||||||
|
"@microsoft/sp-module-interfaces": "~1.0.0",
|
||||||
|
"@microsoft/sp-webpart-workbench": "~1.0.0",
|
||||||
|
"gulp": "~3.9.1",
|
||||||
|
"@types/chai": ">=3.4.34 <3.6.0",
|
||||||
|
"@types/mocha": ">=2.2.33 <2.6.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "gulp bundle",
|
||||||
|
"clean": "gulp clean",
|
||||||
|
"test": "gulp test"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
export interface Theme {
|
||||||
|
name: string;
|
||||||
|
bgColors: Array<string>;
|
||||||
|
hoverColors: Array<string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
import * as cs from 'color-scheme/lib/color-scheme';
|
||||||
|
import { MChart } from './IModernChartsWebPartProps';
|
||||||
|
|
||||||
|
export default class ChartOptions {
|
||||||
|
|
||||||
|
public static _sampleData: Array<number> = [100, 50, 275, 100];
|
||||||
|
public static _sampleCols: Array<string> = ['UPS','FedEx','USPS','OnTrac'];
|
||||||
|
|
||||||
|
public static Options(): Object{
|
||||||
|
return {
|
||||||
|
legend: {
|
||||||
|
display: true,
|
||||||
|
layout: {
|
||||||
|
padding: 5
|
||||||
|
},
|
||||||
|
position: 'bottom',
|
||||||
|
labels: {
|
||||||
|
fontColor: 'rgba(100, 100, 100, 1.0)'
|
||||||
|
},
|
||||||
|
scales: {
|
||||||
|
yAxes: [{
|
||||||
|
ticks: {
|
||||||
|
beginAtZero: true
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
public static Data(chart: MChart) {
|
||||||
|
return {
|
||||||
|
labels: chart.labels,
|
||||||
|
datasets: [{
|
||||||
|
data: chart.data,
|
||||||
|
backgroundColor: chart.config.bgColors,
|
||||||
|
hoverBackgroundColor: chart.config.hoverColors
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RandomColors(): Object {
|
||||||
|
var colors = {bgColors: [], hoverColors: []};
|
||||||
|
var colorTheme = new cs;
|
||||||
|
var colorHue = Math.floor(Math.random() * 360);
|
||||||
|
var colorPalette = colorTheme.from_hue(colorHue).scheme('analogic').variation('default');
|
||||||
|
colors.bgColors = this.shuffleArray(colorPalette.add_complement(true).colors());
|
||||||
|
colors.hoverColors = this.shuffleArray((colorPalette.add_complement(true).colors()).splice(6,6));
|
||||||
|
colors.bgColors.forEach((hex,i)=> { colors.bgColors[i] = '#' + hex; });
|
||||||
|
colors.hoverColors.forEach((hex,i)=> { colors.hoverColors[i] = '#' + hex; });
|
||||||
|
|
||||||
|
return colors;
|
||||||
|
}
|
||||||
|
public static SampleData() {
|
||||||
|
var theme = this.RandomColors();
|
||||||
|
return {
|
||||||
|
labels: [
|
||||||
|
'Red',
|
||||||
|
'Green',
|
||||||
|
'Yellow',
|
||||||
|
'??'
|
||||||
|
],
|
||||||
|
datasets: [{
|
||||||
|
data: [100, 50, 275, 100],
|
||||||
|
backgroundColor: theme['bgColors'],
|
||||||
|
hoverBackgroundColor: theme['hoverColors']
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static shuffleArray(array){
|
||||||
|
var currentIndex = array.length, temporaryValue, randomIndex ;
|
||||||
|
while (0 !== currentIndex) {
|
||||||
|
randomIndex = Math.floor(Math.random() * currentIndex);
|
||||||
|
currentIndex -= 1;
|
||||||
|
temporaryValue = array[currentIndex];
|
||||||
|
array[currentIndex] = array[randomIndex];
|
||||||
|
array[randomIndex] = temporaryValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
export interface ChartConfiguration {
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
other: boolean;
|
||||||
|
dataUrlDisabled: boolean;
|
||||||
|
colsDisabled: boolean;
|
||||||
|
listsDisabled: boolean;
|
||||||
|
type: string;
|
||||||
|
url: string;
|
||||||
|
dataurl: string;
|
||||||
|
list: string;
|
||||||
|
col1: string;
|
||||||
|
col2: string;
|
||||||
|
act: string;
|
||||||
|
unique: string;
|
||||||
|
size: number;
|
||||||
|
options: Object;
|
||||||
|
columns: Array<any>;
|
||||||
|
lists: Array<any>;
|
||||||
|
theme: string;
|
||||||
|
bgColors: Array<string>;
|
||||||
|
hoverColors: Array<string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IModernChartsWebPartProps {
|
||||||
|
description: string;
|
||||||
|
numCharts: number;
|
||||||
|
chartConfig: Array<ChartConfiguration>;
|
||||||
|
state: boolean;
|
||||||
|
firstLoad: boolean;
|
||||||
|
siteOptions: Array<any>;
|
||||||
|
listOptions: Array<any>;
|
||||||
|
url: string;
|
||||||
|
other: boolean;
|
||||||
|
maxResults: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IModernChartsProps {
|
||||||
|
description: string;
|
||||||
|
title: string;
|
||||||
|
state: boolean;
|
||||||
|
config: Object;
|
||||||
|
context: any;
|
||||||
|
data: Object;
|
||||||
|
charts: Array<MChart>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MChart {
|
||||||
|
data: Array<number>;
|
||||||
|
labels: Array<string>;
|
||||||
|
config: ChartConfiguration;
|
||||||
|
key: number;
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json",
|
||||||
|
|
||||||
|
"id": "50dbeca0-48ed-4459-800f-b75b13159b21",
|
||||||
|
"alias": "ModernChartsWebPart",
|
||||||
|
"componentType": "WebPart",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"manifestVersion": 2,
|
||||||
|
|
||||||
|
"preconfiguredEntries": [{
|
||||||
|
"groupId": "50dbeca0-48ed-4459-800f-b75b13159b21",
|
||||||
|
"group": { "default": "Modern Web Parts" },
|
||||||
|
"title": { "default": "ModernCharts" },
|
||||||
|
"description": { "default": "Modern Charts Sample" },
|
||||||
|
"officeFabricIconFontName": "Chart",
|
||||||
|
"properties": {
|
||||||
|
"description": "ModernCharts",
|
||||||
|
"numCharts": 1,
|
||||||
|
"state": false,
|
||||||
|
"maxResults": 25,
|
||||||
|
"listOptions": []
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
|
@ -0,0 +1,497 @@
|
||||||
|
import * as React from 'react';
|
||||||
|
import * as ReactDom from 'react-dom';
|
||||||
|
import { Version } from '@microsoft/sp-core-library';
|
||||||
|
import {
|
||||||
|
BaseClientSideWebPart,
|
||||||
|
IPropertyPaneConfiguration,
|
||||||
|
PropertyPaneTextField,
|
||||||
|
IWebPartContext,
|
||||||
|
PropertyPaneSlider,
|
||||||
|
PropertyPaneDropdown,
|
||||||
|
IPropertyPaneDropdownOption,
|
||||||
|
PropertyPaneButton
|
||||||
|
} from '@microsoft/sp-webpart-base';
|
||||||
|
import * as strings from 'modernChartsStrings';
|
||||||
|
import ModernCharts from './components/ModernCharts';
|
||||||
|
import { IModernChartsProps } from './IModernChartsWebPartProps';
|
||||||
|
import { MChart } from './IModernChartsWebPartProps';
|
||||||
|
import { IModernChartsWebPartProps } from './IModernChartsWebPartProps';
|
||||||
|
import { ChartConfiguration } from './IModernChartsWebPartProps';
|
||||||
|
import ChartOptions from './ChartOptions';
|
||||||
|
import {
|
||||||
|
SPHttpClient,
|
||||||
|
SPHttpClientResponse
|
||||||
|
} from '@microsoft/sp-http';
|
||||||
|
|
||||||
|
export interface ISPLists {
|
||||||
|
value: ISPList[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ISPList {
|
||||||
|
Title: string;
|
||||||
|
Id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class ModernChartsWebPart extends BaseClientSideWebPart<IModernChartsWebPartProps> {
|
||||||
|
|
||||||
|
private reactCharts: React.ReactElement<IModernChartsProps>;
|
||||||
|
|
||||||
|
// Columns Enable / Disable
|
||||||
|
private colsDisabled: boolean = true;
|
||||||
|
private listDisabled: boolean = true;
|
||||||
|
private urlTextDisabled: boolean = true;
|
||||||
|
|
||||||
|
//Property Dropdown Options
|
||||||
|
private _chartThemeOptions: IPropertyPaneDropdownOption[] = [];
|
||||||
|
private _siteOptions: IPropertyPaneDropdownOption[] = [];
|
||||||
|
private _dropdownOptions: IPropertyPaneDropdownOption[] = [];
|
||||||
|
private _columnOptions: IPropertyPaneDropdownOption[] = [];
|
||||||
|
private _ListColumnOptions: Array<IPropertyPaneDropdownOption> = [];
|
||||||
|
private _chartSizeOptions: IPropertyPaneDropdownOption[] = [
|
||||||
|
{key: 3, text:'Small'},
|
||||||
|
{key: 6, text:'Medium'},
|
||||||
|
{key: 9, text: 'Medium-Large'},
|
||||||
|
{key: 12, text: 'Large'}
|
||||||
|
];
|
||||||
|
private _chartTypeOptions: IPropertyPaneDropdownOption[] = [
|
||||||
|
{key: 'bar', text:'Bar'},
|
||||||
|
{key: 'horizontalbar', text:'Horizontal Bar'},
|
||||||
|
{key: 'doughnut', text: 'Doughnut'},
|
||||||
|
{key: 'line', text: 'Line'},
|
||||||
|
{key: 'pie', text: 'Pie'},
|
||||||
|
{key: 'polar', text:'Polar'},
|
||||||
|
{key: 'radar', text:'Radar'}
|
||||||
|
];
|
||||||
|
private _chartColActions: IPropertyPaneDropdownOption[] = [
|
||||||
|
{key: 'average', text: 'Average'},
|
||||||
|
{key: 'count', text: 'Count'},
|
||||||
|
{key: 'sum', text: 'Sum'}
|
||||||
|
];
|
||||||
|
|
||||||
|
public constructor(context: IWebPartContext) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
private ChartThemes: ChartOptions;
|
||||||
|
|
||||||
|
private defaultOptions: Object = {
|
||||||
|
legend: {
|
||||||
|
display: false,
|
||||||
|
layout: {
|
||||||
|
padding: 10
|
||||||
|
},
|
||||||
|
position: 'bottom',
|
||||||
|
labels: {
|
||||||
|
fontColor: 'rgba(100, 100, 100, 1.0)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public defaultChartConfig(chartDesc: string): ChartConfiguration {
|
||||||
|
var defConfig = {
|
||||||
|
title: 'Chart Title',
|
||||||
|
description: chartDesc,
|
||||||
|
type: 'doughnut',
|
||||||
|
list: null,
|
||||||
|
dataurl: this.context.pageContext.web.absoluteUrl,
|
||||||
|
url: this.context.pageContext.web.absoluteUrl,
|
||||||
|
other: true,
|
||||||
|
dataUrlDisabled: true,
|
||||||
|
colsDisabled: true,
|
||||||
|
listsDisabled: false,
|
||||||
|
col1: '',
|
||||||
|
col2: '',
|
||||||
|
act: '',
|
||||||
|
unique: '',
|
||||||
|
size: 12,
|
||||||
|
options: ChartOptions.Options(),
|
||||||
|
columns: [],
|
||||||
|
lists: this.properties.listOptions,
|
||||||
|
theme: "Random",
|
||||||
|
bgColors: ChartOptions.RandomColors()['bgColors'],
|
||||||
|
hoverColors: ChartOptions.RandomColors()['bgColors']
|
||||||
|
};
|
||||||
|
|
||||||
|
return defConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(): void {
|
||||||
|
//Initialize first demo chart
|
||||||
|
if (!this.properties.state){
|
||||||
|
this.properties.state = true;
|
||||||
|
this.properties.firstLoad = true;
|
||||||
|
this.properties.numCharts = 1;
|
||||||
|
this.properties.chartConfig = [];
|
||||||
|
const firstChartConfig = this.defaultChartConfig;
|
||||||
|
this.properties.chartConfig.push(this.defaultChartConfig('Demo Chart, Edit Web Part to Customize'));
|
||||||
|
}
|
||||||
|
this.getChartData();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected get dataVersion(): Version {
|
||||||
|
return Version.parse('1.0');
|
||||||
|
}
|
||||||
|
|
||||||
|
private getChartData(): void{
|
||||||
|
const _chartData: Array<MChart> = [];
|
||||||
|
var _count = 0;
|
||||||
|
this.properties.chartConfig.forEach((cfg,i) => {
|
||||||
|
if (cfg.list != null){
|
||||||
|
this.getData(cfg).then((response) => {
|
||||||
|
const chart = this.calculateData(response.value, cfg);
|
||||||
|
const _chart: MChart = {data:chart['data'],labels:chart['labels'],config:cfg,key: i};
|
||||||
|
_chartData[i] = _chart;
|
||||||
|
if (++_count == this.properties.chartConfig.length){ this.getCharts(_chartData); }
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const _chart: MChart = {data:ChartOptions._sampleData,labels:ChartOptions._sampleCols,config:cfg,key: i};
|
||||||
|
_chartData[i] = _chart;
|
||||||
|
if (++_count == this.properties.chartConfig.length){ this.getCharts(_chartData); }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private getCharts(charts: Array<MChart>): void{
|
||||||
|
const chartArea: React.ReactElement<IModernChartsProps> = React.createElement(ModernCharts,{
|
||||||
|
description: this.properties.description,
|
||||||
|
title: this.properties.description,
|
||||||
|
state: this.properties.state,
|
||||||
|
config: {},
|
||||||
|
context: this.context,
|
||||||
|
data: {},
|
||||||
|
charts: charts
|
||||||
|
});
|
||||||
|
ReactDom.render(chartArea,this.domElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
private calculateData(data: Array<Object>,config:ChartConfiguration): Object {
|
||||||
|
var values: Array<number> = [];
|
||||||
|
var labels: Object = this.getUnique(data, config);
|
||||||
|
var dataVal: Array<Array<any>> = this.getValues(data,labels['unique'],config);
|
||||||
|
|
||||||
|
switch(config.act) {
|
||||||
|
case 'sum':
|
||||||
|
dataVal.forEach((vals,i) => {
|
||||||
|
values[i] = 0;
|
||||||
|
vals.forEach((val) => {
|
||||||
|
values[i]+=parseFloat(val);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'average':
|
||||||
|
dataVal.forEach((vals,i) => {
|
||||||
|
values[i] = 0;
|
||||||
|
vals.forEach((val) => {
|
||||||
|
values[i]+=parseFloat(val);
|
||||||
|
});
|
||||||
|
if (values[i] != 0) {
|
||||||
|
values[i] = values[i] / vals.length;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'count':
|
||||||
|
dataVal.forEach((vals) => {
|
||||||
|
values.push(vals.length);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
values = [100,250,90,300];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return { data:values, labels:labels['labels'] };
|
||||||
|
}
|
||||||
|
|
||||||
|
private getUnique(data: Array<Object>,config:ChartConfiguration): Object {
|
||||||
|
const chLabels: Object = { unique:[], labels:[] };
|
||||||
|
data.forEach((item) => {
|
||||||
|
if (chLabels['unique'].indexOf(item[config.unique]) == -1 && item[config.unique] != null && item[config.unique] != ""){
|
||||||
|
chLabels['unique'].push(item[config.unique]);
|
||||||
|
chLabels['labels'].push(item[config.col1]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return chLabels;
|
||||||
|
}
|
||||||
|
|
||||||
|
private getValues(data: Array<Object>,unique: Array<string>, config: ChartConfiguration): Array<Array<any>>{
|
||||||
|
|
||||||
|
const values: Object = {};
|
||||||
|
const vals: Array<Array<any>> = [[]];
|
||||||
|
unique.forEach((col,i) => {
|
||||||
|
values[col] = [];
|
||||||
|
vals[i] = [];
|
||||||
|
data.forEach((item, _i) => {
|
||||||
|
if (item[config.unique] == col){
|
||||||
|
vals[i].push(item[config.col2]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return vals;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onPropertyPaneFieldChanged(propertyPath: string, oldValue: any, newValue: any): void {
|
||||||
|
var pPath = propertyPath;
|
||||||
|
var pPathInd = propertyPath[12];
|
||||||
|
|
||||||
|
if (pPath === 'numCharts' && oldValue != newValue) {
|
||||||
|
if (this.properties.chartConfig.length < newValue){
|
||||||
|
while (this.properties.chartConfig.length < newValue) {
|
||||||
|
this.properties.chartConfig.push(this.defaultChartConfig('Chart Description'));
|
||||||
|
}
|
||||||
|
} else if (this.properties.chartConfig.length > newValue) {
|
||||||
|
while (newValue < this.properties.chartConfig.length) {
|
||||||
|
this.properties.chartConfig.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (propertyPath.indexOf('[') != -1) {
|
||||||
|
pPath = propertyPath.substring(16).replace('\"]','');
|
||||||
|
}
|
||||||
|
if (pPath === 'url' && newValue == 'other' && (oldValue != newValue)){
|
||||||
|
this.urlTextDisabled = false;
|
||||||
|
this.properties.chartConfig[pPathInd].dataUrlDisabled = false;
|
||||||
|
this.properties.chartConfig[pPathInd].dataurl = oldValue;
|
||||||
|
}
|
||||||
|
if (pPath === 'url' && newValue != 'other' && (oldValue != newValue)){
|
||||||
|
this.properties.chartConfig[pPathInd].dataurl = newValue;
|
||||||
|
this.properties.chartConfig[pPathInd].dataUrlDisabled = true;
|
||||||
|
}
|
||||||
|
if ( (pPath === 'url' && (newValue != oldValue)) || (pPath === 'dataurl' && (newValue != oldValue)) ){
|
||||||
|
this._updateListTitles(newValue,this.properties.chartConfig[pPathInd]);
|
||||||
|
this.properties.chartConfig[pPathInd]['other'] = true;
|
||||||
|
this.properties.state = true;
|
||||||
|
}
|
||||||
|
if (pPath === 'list' && (newValue != oldValue)){
|
||||||
|
var siteUrl = this.properties.chartConfig[pPathInd]['dataurl'];
|
||||||
|
this._updateListColumns(siteUrl,newValue,this.properties.chartConfig[pPathInd]);
|
||||||
|
this.properties.chartConfig[pPathInd].colsDisabled = false;
|
||||||
|
}
|
||||||
|
if (pPath === 'theme' && (newValue != oldValue)){
|
||||||
|
const newTheme = ChartOptions.RandomColors();
|
||||||
|
this.properties.chartConfig[pPathInd].bgColors = newTheme['bgColors'];
|
||||||
|
this.properties.chartConfig[pPathInd].hoverColors = newTheme['hoverColors'];
|
||||||
|
}
|
||||||
|
this.context.propertyPane.refresh();
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onPropertyPaneConfigurationStart(): void {
|
||||||
|
|
||||||
|
if (this.properties.firstLoad || this.properties.chartConfig[0].columns.length <= 0 || this.properties.chartConfig[0].list.length <= 0){
|
||||||
|
this.context.statusRenderer.displayLoadingIndicator(this.domElement, 'First Time Configuration');
|
||||||
|
|
||||||
|
this.properties.firstLoad = false;
|
||||||
|
this._getSiteRootWeb()
|
||||||
|
.then((response0) => {
|
||||||
|
this._getSites(response0['Url'])
|
||||||
|
.then((response) => {
|
||||||
|
var sites: IPropertyPaneDropdownOption[] = [];
|
||||||
|
sites.push({key:this.context.pageContext.web.absoluteUrl, text:'This Site'});
|
||||||
|
sites.push({key:'other', text:'Other Site (Specify Url)'});
|
||||||
|
for (var _key in response.value) {
|
||||||
|
if (this.context.pageContext.web.absoluteUrl != response.value[_key]['Url']){
|
||||||
|
sites.push({key: response.value[_key]['Url'], text: response.value[_key]['Title']});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._siteOptions = sites;
|
||||||
|
this.properties.siteOptions = sites;
|
||||||
|
|
||||||
|
this._getListTitles(this.properties.chartConfig[0].dataurl)
|
||||||
|
.then((response2) => {
|
||||||
|
this.properties.listOptions = response2.value.map((list: ISPList) => {
|
||||||
|
return {
|
||||||
|
key: list.Title,
|
||||||
|
text: list.Title
|
||||||
|
};
|
||||||
|
});
|
||||||
|
this.properties.chartConfig[0].lists = this.properties.listOptions;
|
||||||
|
this._getListColumns(this.properties.chartConfig[0].list,this.properties.chartConfig[0].url)
|
||||||
|
.then((response3) => {
|
||||||
|
var col: IPropertyPaneDropdownOption[] = [];
|
||||||
|
for (var __key in response3.value) {
|
||||||
|
col.push({key: response3.value[__key]['InternalName'], text: response3.value[__key]['Title']});
|
||||||
|
}
|
||||||
|
this._columnOptions = col;
|
||||||
|
this.colsDisabled = false;
|
||||||
|
this.listDisabled = false;
|
||||||
|
this.context.propertyPane.refresh();
|
||||||
|
this.context.statusRenderer.clearLoadingIndicator(this.domElement);
|
||||||
|
this.render();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
|
||||||
|
let columnPropertyOptions: any;
|
||||||
|
|
||||||
|
columnPropertyOptions = [
|
||||||
|
{
|
||||||
|
groupName: 'General Options',
|
||||||
|
groupFields: [
|
||||||
|
PropertyPaneTextField('description', {
|
||||||
|
label: 'Web Part Title'
|
||||||
|
}),
|
||||||
|
PropertyPaneSlider('numCharts', {
|
||||||
|
label: 'Number of Charts',
|
||||||
|
min: 1,
|
||||||
|
max: 10
|
||||||
|
}),
|
||||||
|
PropertyPaneSlider('maxResults', {
|
||||||
|
label: 'Max # of list items',
|
||||||
|
min: 1,
|
||||||
|
max: 1000
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
for (var _i = 0; _i < this.properties.numCharts; _i++) {
|
||||||
|
columnPropertyOptions.push(
|
||||||
|
{
|
||||||
|
groupName: "Chart " + (_i + 1) + " Configuration",
|
||||||
|
groupFields:[
|
||||||
|
PropertyPaneTextField('chartConfig[' + _i + ']["title"]', {
|
||||||
|
label: "Chart Title"
|
||||||
|
}),
|
||||||
|
PropertyPaneTextField('chartConfig[' + _i + ']["description"]', {
|
||||||
|
label: "Description "
|
||||||
|
}),
|
||||||
|
PropertyPaneDropdown('chartConfig[' + _i + ']["type"]', {
|
||||||
|
label: 'Chart Type',
|
||||||
|
options: this._chartTypeOptions
|
||||||
|
}),
|
||||||
|
PropertyPaneDropdown('chartConfig[' + _i + ']["size"]', {
|
||||||
|
label: 'Chart Size',
|
||||||
|
options: this._chartSizeOptions
|
||||||
|
}),
|
||||||
|
PropertyPaneButton('chartConfig[' + _i + ']["theme"]', {
|
||||||
|
buttonType: 0,
|
||||||
|
text: 'Generate Theme',
|
||||||
|
icon: 'Color',
|
||||||
|
onClick: ((val) => {
|
||||||
|
return new Date().valueOf();
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
PropertyPaneDropdown('chartConfig[' + _i + ']["url"]', {
|
||||||
|
label: 'Chart Data Source',
|
||||||
|
options: this.properties.siteOptions
|
||||||
|
}),
|
||||||
|
PropertyPaneTextField('chartConfig[' + _i + ']["dataurl"]', {
|
||||||
|
label: 'Chart Site Url (i.e. https://contoso.sharepoint.com/path)',
|
||||||
|
disabled: this.properties.chartConfig[_i].dataUrlDisabled
|
||||||
|
}),
|
||||||
|
PropertyPaneDropdown('chartConfig[' + _i + ']["list"]', {
|
||||||
|
label: 'List Data Source',
|
||||||
|
options: this.properties.chartConfig[_i].lists,
|
||||||
|
disabled: this.properties.chartConfig[_i].listsDisabled
|
||||||
|
}),
|
||||||
|
PropertyPaneDropdown('chartConfig[' + _i + ']["col1"]', {
|
||||||
|
label: 'Label Column',
|
||||||
|
options: this.properties.chartConfig[_i].columns,
|
||||||
|
disabled: this.properties.chartConfig[_i].colsDisabled
|
||||||
|
}),
|
||||||
|
PropertyPaneDropdown('chartConfig[' + _i + ']["col2"]', {
|
||||||
|
label: 'Data Column',
|
||||||
|
options: this.properties.chartConfig[_i].columns,
|
||||||
|
disabled: this.properties.chartConfig[_i].colsDisabled
|
||||||
|
}),
|
||||||
|
PropertyPaneDropdown('chartConfig[' + _i + ']["unique"]', {
|
||||||
|
label: 'Unique Identifier',
|
||||||
|
options: this.properties.chartConfig[_i].columns,
|
||||||
|
disabled: this.properties.chartConfig[_i].colsDisabled
|
||||||
|
}),
|
||||||
|
PropertyPaneDropdown('chartConfig[' + _i + ']["act"]', {
|
||||||
|
label: 'Operation',
|
||||||
|
options: this._chartColActions,
|
||||||
|
disabled: this.properties.chartConfig[_i].colsDisabled
|
||||||
|
})
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
pages: [
|
||||||
|
{
|
||||||
|
header: {
|
||||||
|
description: strings.PropertyPaneDescription
|
||||||
|
},
|
||||||
|
groups: columnPropertyOptions
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onPropertyPaneConfigurationComplete(){
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
private _getSiteRootWeb(): Promise<string[]> {
|
||||||
|
|
||||||
|
return this.context.spHttpClient.get(this.context.pageContext.web.absoluteUrl + `/_api/Site/RootWeb?$select=Title,Url`, SPHttpClient.configurations.v1)
|
||||||
|
.then((response: SPHttpClientResponse) => {
|
||||||
|
return response.json();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private _getSites(rootWebUrl: string): Promise<ISPLists> {
|
||||||
|
return this.context.spHttpClient.get(rootWebUrl + `/_api/web/webs?$select=Title,Url`, SPHttpClient.configurations.v1)
|
||||||
|
.then((response: SPHttpClientResponse) => {
|
||||||
|
return response.json();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private _getListTitles(site: string): Promise<ISPLists> {
|
||||||
|
return this.context.spHttpClient.get(site + `/_api/web/lists?$filter=Hidden eq false and BaseType eq 0`, SPHttpClient.configurations.v1)
|
||||||
|
.then((response: SPHttpClientResponse) => {
|
||||||
|
return response.json();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private _getListColumns(listName: string,listsite: string): Promise<any> {
|
||||||
|
return this.context.spHttpClient.get(listsite + `/_api/web/lists/GetByTitle('${listName}')/Fields?$filter=Hidden eq false and ReadOnlyField eq false and TypeAsString ne 'User' and TypeAsString ne 'Lookup'`, SPHttpClient.configurations.v1)
|
||||||
|
.then((response: SPHttpClientResponse) => {
|
||||||
|
return response.json();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public getData(chartConfig: Object){
|
||||||
|
return this.context.spHttpClient.get(chartConfig['dataurl'] + `/_api/web/lists/GetByTitle(\'${chartConfig['list']}\')/items?$orderby=Id desc&$limit=10&$top=${this.properties.maxResults}`, SPHttpClient.configurations.v1)
|
||||||
|
.then((response: SPHttpClientResponse) => {
|
||||||
|
return response.json();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private _updateListTitles(siteUrl: string,_chartConfig: ChartConfiguration): void {
|
||||||
|
this._getListTitles(siteUrl).then((response) => {
|
||||||
|
var respLists: IPropertyPaneDropdownOption[] = [];
|
||||||
|
for (var _key in response.value) {
|
||||||
|
respLists.push({key: response.value[_key]['Title'], text: response.value[_key]['Title']});
|
||||||
|
}
|
||||||
|
this._dropdownOptions = respLists;
|
||||||
|
_chartConfig.lists = respLists;
|
||||||
|
this.context.propertyPane.refresh();
|
||||||
|
}).catch((err) => {
|
||||||
|
this.context.statusRenderer.clearLoadingIndicator(this.domElement);
|
||||||
|
this.context.statusRenderer.renderError(this.domElement,"There was an error loading your list, please verify the selected list has Calendar Events or choose a new list.");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private _updateListColumns(siteUrl: string, listName: string, _chartConfig: ChartConfiguration): void {
|
||||||
|
this._getListColumns(listName,siteUrl).then((response) => {
|
||||||
|
var respLists: IPropertyPaneDropdownOption[] = [];
|
||||||
|
console.log(response.value);
|
||||||
|
for (var _key in response.value) {
|
||||||
|
respLists.push({key: response.value[_key]['InternalName'], text: response.value[_key]['Title']});
|
||||||
|
}
|
||||||
|
this._columnOptions = respLists;
|
||||||
|
_chartConfig.columns = respLists;
|
||||||
|
this.context.propertyPane.refresh();
|
||||||
|
}).catch((err) => {
|
||||||
|
this.context.statusRenderer.clearLoadingIndicator(this.domElement);
|
||||||
|
this.context.statusRenderer.renderError(this.domElement,"There was an error loading your list, please verify the selected list has Calendar Events or choose a new list.");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
export interface IModernChartsProps {
|
||||||
|
description: string;
|
||||||
|
title: string;
|
||||||
|
state: boolean;
|
||||||
|
config: Object;
|
||||||
|
context: any;
|
||||||
|
data: Object;
|
||||||
|
charts: Array<MChart>;
|
||||||
|
}
|
||||||
|
export interface MChart {
|
||||||
|
size: number;
|
||||||
|
data: Object;
|
||||||
|
config: Object;
|
||||||
|
key: number;
|
||||||
|
}
|
|
@ -0,0 +1,117 @@
|
||||||
|
.charts {
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.chartjs {
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
.chartCard{
|
||||||
|
border-bottom: 2px solid #a6a6a6;
|
||||||
|
position: relative;
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
border-bottom-color: rgb(206, 75, 31);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
canvas {
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
.docContainer {
|
||||||
|
max-width: none;
|
||||||
|
min-width: initial;
|
||||||
|
padding-left: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
display:inherit;
|
||||||
|
}
|
||||||
|
.legend{
|
||||||
|
display:initial;
|
||||||
|
}
|
||||||
|
@media (min-width: 640px){
|
||||||
|
.docContainer6 {
|
||||||
|
max-width: 48%;
|
||||||
|
margin-left: 1%;
|
||||||
|
margin-right: 1%;
|
||||||
|
margin-top:5px;
|
||||||
|
margin-bottom:5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#modernChart {
|
||||||
|
.chartCard{
|
||||||
|
border-bottom: 2px solid #a6a6a6;
|
||||||
|
position: relative;
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
border-bottom-color: rgb(206, 75, 31);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
canvas {
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
.docContainer {
|
||||||
|
max-width: none;
|
||||||
|
min-width: initial;
|
||||||
|
padding-left: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
display:inherit;
|
||||||
|
}
|
||||||
|
.legend{
|
||||||
|
display:initial;
|
||||||
|
}
|
||||||
|
@media (min-width: 640px){
|
||||||
|
.docContainer6 {
|
||||||
|
max-width: 48%;
|
||||||
|
margin-left: 1%;
|
||||||
|
margin-right: 1%;
|
||||||
|
margin-top:5px;
|
||||||
|
margin-bottom:5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
import * as React from 'react';
|
||||||
|
import styles from './ModernCharts.module.scss';
|
||||||
|
import { IModernChartsProps } from '../IModernChartsWebPartProps';
|
||||||
|
import { MChart } from '../IModernChartsWebPartProps';
|
||||||
|
import 'chart.js';
|
||||||
|
import { Doughnut } from 'react-chartjs-2';
|
||||||
|
import { Line } from 'react-chartjs-2';
|
||||||
|
import { Pie } from 'react-chartjs-2';
|
||||||
|
import { Bar } from 'react-chartjs-2';
|
||||||
|
import { HorizontalBar } from 'react-chartjs-2';
|
||||||
|
import { Radar } from 'react-chartjs-2';
|
||||||
|
import { Polar } from 'react-chartjs-2';
|
||||||
|
import ChartOptions from '../ChartOptions';
|
||||||
|
import {
|
||||||
|
DocumentCard,
|
||||||
|
DocumentCardTitle,
|
||||||
|
DocumentCardLocation,
|
||||||
|
DocumentCardPreview,
|
||||||
|
IDocumentCardPreviewProps
|
||||||
|
} from 'office-ui-fabric-react/lib/DocumentCard';
|
||||||
|
|
||||||
|
export default class ModernCharts extends React.Component<IModernChartsProps, void> {
|
||||||
|
|
||||||
|
public render(): JSX.Element {
|
||||||
|
const charts: JSX.Element[] = this.props.charts.map((chart: MChart, i: number) => {
|
||||||
|
return (
|
||||||
|
<DocumentCard onClickHref='#' className={styles.docContainer + ' ms-Grid-col ms-u-sm12 ms-u-md12 ms-u-lg' + chart.config.size} key={chart.key}>
|
||||||
|
<div className={styles.chartCard}>
|
||||||
|
{this.chart(ChartOptions.Data(chart),ChartOptions.Options(),chart.config.type)}
|
||||||
|
</div>
|
||||||
|
<DocumentCardLocation location={chart.config.description}/>
|
||||||
|
<DocumentCardTitle title={chart.config.title}/>
|
||||||
|
</DocumentCard>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.chartjs + ' ms-Grid'}>
|
||||||
|
<div className={'ms-Grid-row'}>
|
||||||
|
{charts}
|
||||||
|
</div>
|
||||||
|
<div style={{clear: 'both'}}/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public chart(data: Object, options: Object, type: string) {
|
||||||
|
var tChart: any;
|
||||||
|
switch (type) {
|
||||||
|
case 'doughnut':
|
||||||
|
tChart = <Doughnut data={data} options={options} />;
|
||||||
|
return tChart;
|
||||||
|
case 'line':
|
||||||
|
tChart = <Line data={data} options={options} />;
|
||||||
|
return tChart;
|
||||||
|
case 'pie':
|
||||||
|
tChart = <Pie data={data} options={options} />;
|
||||||
|
return tChart;
|
||||||
|
case 'bar':
|
||||||
|
tChart = <Bar data={data} options={options} />;
|
||||||
|
return tChart;
|
||||||
|
case 'horizontalbar':
|
||||||
|
tChart = <HorizontalBar data={data} options={options} />;
|
||||||
|
return tChart;
|
||||||
|
case 'radar':
|
||||||
|
tChart = <Radar data={data} options={options} />;
|
||||||
|
return tChart;
|
||||||
|
case 'polar':
|
||||||
|
tChart = <Polar data={data} options={options} />;
|
||||||
|
return tChart;
|
||||||
|
default:
|
||||||
|
tChart = <Line data={data} options={options} />;
|
||||||
|
return tChart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
export interface ChartJSProps {
|
||||||
|
title: string;
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
define([], function() {
|
||||||
|
return {
|
||||||
|
"PropertyPaneDescription": "Description",
|
||||||
|
"BasicGroupName": "Group Name",
|
||||||
|
"DescriptionFieldLabel": "Description Field"
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,10 @@
|
||||||
|
declare interface IModernChartsStrings {
|
||||||
|
PropertyPaneDescription: string;
|
||||||
|
BasicGroupName: string;
|
||||||
|
DescriptionFieldLabel: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'modernChartsStrings' {
|
||||||
|
const strings: IModernChartsStrings;
|
||||||
|
export = strings;
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
/// <reference types="mocha" />
|
||||||
|
|
||||||
|
import { assert } from 'chai';
|
||||||
|
|
||||||
|
describe('ModernChartsWebPart', () => {
|
||||||
|
it('should do something', () => {
|
||||||
|
assert.ok(true);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es5",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"module": "commonjs",
|
||||||
|
"jsx": "react",
|
||||||
|
"declaration": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"types": [
|
||||||
|
"es6-promise",
|
||||||
|
"es6-collections",
|
||||||
|
"webpack-env"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
// 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;
|
|
@ -0,0 +1 @@
|
||||||
|
/// <reference path="@ms/odsp.d.ts" />
|
|
@ -3,9 +3,6 @@ logs
|
||||||
*.log
|
*.log
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
|
|
||||||
# Yeoman configuration files
|
|
||||||
.yo-rc.json
|
|
||||||
|
|
||||||
# Dependency directories
|
# Dependency directories
|
||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
|
@ -14,7 +11,7 @@ dist
|
||||||
lib
|
lib
|
||||||
solution
|
solution
|
||||||
temp
|
temp
|
||||||
*.spapp
|
*.sppkg
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
# Coverage directory used by tools like istanbul
|
||||||
coverage
|
coverage
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
.vscode
|
.vscode
|
||||||
coverage
|
coverage
|
||||||
node_modules
|
node_modules
|
||||||
solution
|
sharepoint
|
||||||
src
|
src
|
||||||
temp
|
temp
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,3 @@
|
||||||
{
|
{
|
||||||
// The number of spaces a tab is equal to.
|
"vsicons.presets.angular": false
|
||||||
"editor.tabSize": 2,
|
}
|
||||||
|
|
||||||
// When enabled, will trim trailing whitespace when you save a file.
|
|
||||||
"files.trimTrailingWhitespace": true,
|
|
||||||
|
|
||||||
// Controls if the editor should automatically close brackets after opening them
|
|
||||||
"editor.autoClosingBrackets": false,
|
|
||||||
|
|
||||||
// Configure glob patterns for excluding files and folders.
|
|
||||||
"search.exclude": {
|
|
||||||
"**/bower_components": true,
|
|
||||||
"**/node_modules": true,
|
|
||||||
"coverage": true,
|
|
||||||
"dist": true,
|
|
||||||
"lib-amd": true,
|
|
||||||
"lib": true,
|
|
||||||
"temp": true
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue