This commit is contained in:
paolo@pialorsi.com 2018-02-17 16:27:54 +01:00
commit 42c1712f83
2261 changed files with 230600 additions and 776411 deletions

View File

@ -1,3 +1,9 @@
#### Important
Use the following form to submit an issue only if it's related to samples in this repo. If you have an issue related to the SharePoint Framework or its documentation, please submit the issue at [https://github.com/SharePoint/sp-dev-docs/issues/new](https://github.com/SharePoint/sp-dev-docs/issues/new). This will help us respond to your issue faster.
----
Thank you for reporting an issue or suggesting an enhancement. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you.
#### Category

2
.gitignore vendored
View File

@ -31,3 +31,5 @@ obj
# Styles Generated Code
*.scss.ts
packages/

View File

@ -4,6 +4,13 @@ This repository contains the samples that demonstrate different usage patterns f
SharePoint client-side web parts are controls that appear inside a SharePoint page but run locally in the browser. They're the building blocks of pages that appear on a SharePoint site. You can build client-side web parts using modern script development tools and the SharePoint workbench (a development test surface), and you can deploy your client-side web parts to classic web part pages in Office 365 tenants. In addition to plain JavaScript projects, you can build web parts alongside common scripting frameworks, such as AngularJS and React. For example, you can use React along with components from Office UI Fabric React to quickly create experiences based on the same components used in Office 365
# Have issues or questions?
Please use following logic on submitting your questions or issues to right location to ensure that they are noticed and addressed as soon as possible.
* You have general question or challenge with SPFx - use [sp-dev-docs repository issue list](https://github.com/SharePoint/sp-dev-docs/issues).
* You have issue on specific web part or sample - use [issue list in this repository](https://github.com/SharePoint/sp-dev-fx-webparts/issues).
# Additional resources
* [Overview of the SharePoint Framework](http://dev.office.com/sharepoint/docs/spfx/sharepoint-framework-overview)

View File

@ -0,0 +1,3 @@
{
"rulesDirectory": "./config"
}

View File

@ -0,0 +1,3 @@
{
"rulesDirectory": "./config"
}

View File

@ -2,7 +2,7 @@
## Summary
Sample Angular application before and after migration to a SharePoint Framework client-side web part.
This is a sample Angular application before and after it has been migrated to a SharePoint Framework client-side web part.
Application before migration:
![Angular todo application](./assets/angular-todo-preview.png)

View File

@ -0,0 +1,3 @@
{
"rulesDirectory": "./config"
}

View File

@ -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
}
}

View File

@ -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"
]
}
]
}

View File

@ -1,7 +0,0 @@
{
"@microsoft/generator-sharepoint": {
"libraryName": "angular-mostpopularitems",
"libraryId": "b6f56625-d2f4-4527-86bb-655d221a586a",
"framework": "none"
}
}

View File

@ -1,56 +0,0 @@
# Most Popular Items WebPart using Angular & ngOfficeUIFabric
## Summary
This Web Part displays the Most Popular Items from the given Site/Document Library URL using search API.
![Most Popular Items WebPart built using Angular and ngOfficeUIFabric](./assets/preview.png)
## Used SharePoint Framework Version
![drop](https://img.shields.io/badge/drop-drop5-red.svg)
## Applies to
* [SharePoint Framework Developer Preview](https://github.com/SharePoint/sp-dev-docs/wiki)
* [Office 365 developer tenant](https://github.com/SharePoint/sp-dev-docs/wiki/Setup-SharePoint-Tenant)
## Solution
Solution|Author(s)
--------|---------
angular-mostpopularitems|Joseph Velliah (SPRIDER, @sprider)
## Version history
Version|Date|Comments
-------|----|--------
1.0|November 10, 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 Most Popular Items 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 for building SharePoint Framework Client-Side Web Parts
- using ngOfficeUIFabric for styling Angular Client-Side Web Parts
- including Angular and ngOfficeUIFabric in the Web Part bundle
- using a newer version of ngOfficeUIFabric for styling Client-Side Web Parts
- using non-reactive Web Part Property Pane and custom Properties
- 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-mostpopularitems" />

View File

@ -1,86 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Gulp" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{b6f56625-d2f4-4527-86bb-655d221a586a}</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="Gulp">
<Message Text="Running gulp2vs.js" Importance="normal" />
<Exec Command="node.exe &quot;$(MSBuildThisFileDirectory)\node_modules\@microsoft\npmx-lib\lib\gulp2vs.js&quot;" />
</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: 95 KiB

View File

@ -1,21 +0,0 @@
{
"entries": [
{
"entry": "./lib/webparts/mostPopularItems/MostPopularItemsWebPart.js",
"manifest": "./src/webparts/mostPopularItems/MostPopularItemsWebPart.manifest.json",
"outputPath": "./dist/most-popular-items.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"
},
"localizedResources": {
"mostPopularItemsStrings": "webparts/mostPopularItems/loc/{locale}.js"
}
}

View File

@ -1,10 +0,0 @@
{
"solution": {
"name": "angular-mostpopularitems-client-side-solution",
"id": "b6f56625-d2f4-4527-86bb-655d221a586a",
"version": "1.0.0.0"
},
"paths": {
"zippedPackage": "solution/angular-mostpopularitems.spapp"
}
}

View File

@ -1,4 +0,0 @@
{
//"cdnBasePath": "<!-- PATH TO CDN -->"
"cdnBasePath": "https://o365jv.sharepoint.com/sites/spfx/CDN/Microsoft/SPFX/angular-mostpopularitems"
}

View File

@ -1,25 +0,0 @@
{
"name": "angular-mostpopularitems",
"version": "0.0.1",
"private": true,
"engines": {
"node": ">=0.10.0"
},
"dependencies": {
"@microsoft/sp-client-base": "~0.4.0",
"@microsoft/sp-client-preview": "~0.5.0",
"angular": "^1.5.8",
"ng-office-ui-fabric": "^0.12.9"
},
"devDependencies": {
"@microsoft/sp-build-web": "~0.7.0",
"@microsoft/sp-module-interfaces": "~0.4.0",
"@microsoft/sp-webpart-workbench": "~0.5.0",
"gulp": "~3.9.1"
},
"scripts": {
"build": "gulp bundle",
"clean": "gulp nuke",
"test": "gulp test"
}
}

View File

@ -1,5 +0,0 @@
var context = require.context('.', true, /.+\.test\.js?$/);
context.keys().forEach(context);
module.exports = context;

View File

@ -1,4 +0,0 @@
export interface IMostPopularItemsWebPartProps {
url: string;
numberOfItems: number;
}

View File

@ -1,31 +0,0 @@
export default class LandingTemplate {
public static templateHtml: string = `
<div data-ng-controller="controller_home">
<div ng-show="isLoading">
<uif-spinner>Loading...</uif-spinner>
</div>
<div ng-show="needsconfig">
<p>Please configure this webpart.</p>
</div>
<uif-list ng-show="isLoading === false && (PopularItems).length > 0">
<uif-list-item ng-repeat="PopularItem in PopularItems | orderBy : '-ViewsLifeTime' | limitTo: numberOfItems" uif-item="PopularItem" uif-type="itemWithImage">
<uif-list-item-image>
{{PopularItem.ViewsLifeTime}}
</uif-list-item-image>
<uif-list-item-primary-text>{{PopularItem.Title}}</uif-list-item-primary-text>
<uif-list-item-secondary-text>{{PopularItem.Author}}</uif-list-item-secondary-text>
<uif-list-item-tertiary-text>{{PopularItem.LastModifiedTime | date : 'shortDate'}}</uif-list-item-tertiary-text>
<uif-list-item-optional-text>{{PopularItem.FileExtension}}</uif-list-item-optional-text>
</uif-list-item>
</uif-list>
<div ng-show="isLoading === false && (PopularItems).length <= 0 && !error">
<p>No records found.</p>
</div>
<div ng-if="error">
<p>{{error}}</p>
</div>
</div>
`;
}

View File

@ -1,7 +0,0 @@
.poll {
.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);
}
}

View File

@ -1,73 +0,0 @@
import {
BaseClientSideWebPart,
IPropertyPaneSettings,
IWebPartContext,
PropertyPaneTextField,
PropertyPaneSlider
} from '@microsoft/sp-client-preview';
import * as angular from 'angular';
import 'ng-office-ui-fabric';
import ModuleLoader from '@microsoft/sp-module-loader';
import { EnvironmentType } from '@microsoft/sp-client-base';
import * as strings from 'mostPopularItemsStrings';
import { IMostPopularItemsWebPartProps } from './IMostPopularItemsWebPartProps';
import styles from './MostPopularItems.module.scss';
import LandingTemplate from './LandingTemplate';
export default class MostPopularItemsWebPart extends BaseClientSideWebPart<IMostPopularItemsWebPartProps> {
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 = LandingTemplate.templateHtml;
require('./app/controller_home.js');
this.$injector = angular.bootstrap(this.domElement, ['app_MostPopularItems']);
}
this.$injector.get('$rootScope').$broadcast('configurationChanged', {
url: this.properties.url,
numberOfItems: this.properties.numberOfItems
});
}
protected get propertyPaneSettings(): IPropertyPaneSettings {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: [
PropertyPaneTextField('url', {
label: strings.UrlFieldLabel
}),
PropertyPaneSlider('numberOfItems', {
label: strings.NumberOfItemsFieldLabel,
min: 5,
max: 25,
step: 1
})
]
}
]
}
]
};
}
protected get disableReactivePropertyChanges(): boolean {
return true;
}
}

View File

@ -1,108 +0,0 @@
var AppMostPopularItems = angular.module('app_MostPopularItems', ['officeuifabric.core', 'officeuifabric.components']);
AppMostPopularItems.controller("controller_home", ["$rootScope", "$scope", "$http", "$location", "$window",
function ($rootScope, $scope, $http, $location, $window) {
$scope.PopularItems = [];
$scope.isLoading = true;
$scope.url = null;
$scope.numberOfItems = 5;
$scope.needsconfig = true;
$scope.error = '';
$rootScope.$on('configurationChanged', function (event, args) {
$scope.PopularItems = [];
$scope.isLoading = true;
$scope.error = '';
if (args.url != null && args.url.length > 0) {
$scope.url = args.url;
$scope.numberOfItems = args.numberOfItems;
if (_spPageContextInfo.siteAbsoluteUrl == "https://wwww.contoso.com/") {
$scope.loadMockupMessages();
}
else {
$scope.loadMessages();
}
$scope.needsconfig = false;
$scope.$apply();
}
else {
$scope.needsconfig = true;
$scope.$apply();
}
});
$scope.loadMessages = function () {
var endpointurl = _spPageContextInfo.siteAbsoluteUrl + "/_api/search/query?querytext='path:" + $scope.url + "'&rowlimit=500&sortlist='ViewsLifeTime:descending'";
$http({
method: 'GET',
url: endpointurl,
headers: { "Accept": "application/json;odata=verbose" }
}).success(function (data, status, headers, config) {
var results = data.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results;
if (results.length > 0) {
for (var i = 0; i < results.length; i++) {
// Note - result value index are subjected to change based on the environment
var ViewsLifeTime = 0;
var ViewsRecent = 0;
if (results[i].Cells.results[21].Value) {
ViewsLifeTime = parseInt(results[i].Cells.results[21].Value);
}
if (results[i].Cells.results[21].Value) {
ViewsRecent = parseInt(results[i].Cells.results[22].Value);
}
$scope.PopularItems.push({
Title: results[i].Cells.results[3].Value,
Path: results[i].Cells.results[6].Value,
Author: results[i].Cells.results[4].Value,
Write: results[i].Cells.results[8].Value,
LastModifiedTime: results[i].Cells.results[9].Value,
FileExtension: results[i].Cells.results[18].Value,
ViewsLifeTime: ViewsLifeTime,
ViewsRecent: ViewsRecent
});
}
}
$scope.isLoading = false;
}).error(function (data, status, headers, config) {
$scope.isLoading = false;
$scope.error = 'Unable to load the details.';
});
};
$scope.loadMockupMessages = function () {
$scope.PopularItems = [
{
Title: 'Sample',
Path: 'Sample Status',
Author: 'Joseph Velliah',
Write: '2015-08-12T07:00:00Z',
LastModifiedTime: '2016-08-12T07:00:00Z',
FileExtension: 'aspx',
ViewsLifeTime: 200,
ViewsRecent: 30
}
];
$scope.isLoading = false;
};
}]);

View File

@ -1,8 +0,0 @@
define([], function() {
return {
"PropertyPaneDescription": "Displays the most popular items from the given Site/Document Library",
"BasicGroupName": "Configuration",
"UrlFieldLabel": "Site/Document Library Url",
"NumberOfItemsFieldLabel": "Number of Items to Display"
}
});

View File

@ -1,11 +0,0 @@
declare interface IMostPopularItemsStrings {
PropertyPaneDescription: string;
BasicGroupName: string;
UrlFieldLabel: string;
NumberOfItemsFieldLabel: string;
}
declare module 'mostPopularItemsStrings' {
const strings: IMostPopularItemsStrings;
export = strings;
}

View File

@ -1,7 +0,0 @@
import * as assert from 'assert';
describe('MostPopularItemsWebPart', () => {
it('should do something', () => {
assert.ok(true);
});
});

View File

@ -1,9 +0,0 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"jsx": "react",
"declaration": true,
"sourceMap": true
}
}

View File

@ -1,15 +0,0 @@
{
"version": "v4",
"repo": "borisyankov/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"angularjs/angular.d.ts": {
"commit": "e977422734717ae20f8adf4f22adfec680e9ffbd"
},
"jquery/jquery.d.ts": {
"commit": "e977422734717ae20f8adf4f22adfec680e9ffbd"
}
}
}

View File

@ -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;
};

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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="combokeys/combokeys.d.ts" />
/// <reference path="angularjs/angular.d.ts" />
/// <reference path="jquery/jquery.d.ts" />

View File

@ -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;

View File

@ -1,9 +1,9 @@
## Angular MS Graph Web Part Built with Angular v1.x
## Angular MS Graph Web Part Built with Angular v1.x
## Summary
Sample MS Graph Web Part that connects to the Microsoft Graph and pull SharePoint information from your
tenant. It will first pull the Root Site Collection (currently a limitation by Microsoft Graph). Then will
display all the Lists associated with the site. Then all the items inside the List.
This is a sample MS Graph web part that connects to Microsoft Graph and pulls SharePoint information from your
tenant. It will first pull the root site collection (currently a limitation by Microsoft Graph), then it will
display all the lists associated with the site followed by all the items inside the list.
![First Screen](./assets/Connect.png)
@ -16,7 +16,7 @@ display all the Lists associated with the site. Then all the items inside the Li
![Announcement List Items](./assets/Items.png)
> Note: I currently only have models developed for the Announcements List. All other lists will currently generate errors.
> Note: I currently only have models developed for the Announcements list. All other lists will currently generate errors.
## Used SharePoint Framework Version
![drop](https://img.shields.io/badge/drop-ga-green.svg)

View File

@ -0,0 +1,3 @@
{
"rulesDirectory": "./config"
}

View File

@ -1,12 +1,12 @@
# Angular multi-page client-side web part
# Angular multi-page client-side web part
## Summary
Sample SharePoint Framework client-side web parts built using Angular illustrating building multi-page web parts.
This is a sample SharePoint Framework client-side web part built using Angular, illustrating building multi-page web parts.
### Poll
Sample poll web part allowing users to vote and view the results.
This sample contains a poll web part allowing users to vote and view the results.
![Poll web part built on the SharePoint Framework using Angular](./assets/poll-preview.gif)

View File

@ -0,0 +1,3 @@
{
"rulesDirectory": "./config"
}

View File

@ -3,7 +3,7 @@
## Summary
File Update/Delete webpart using AngularJs and ngOfficeUIFabric with the SharePoint Framework.
![File Upload using Angular](./assets/NG File Upload.png)
![File Upload using Angular](http://i.imgur.com/U5qg4II.png)
Edit webpart properties to set Document library Name. Initially, It has been set to `Documents`.
@ -27,6 +27,7 @@ Version|Date|Comments
-------|----|--------
1.0|November 24, 2016|Initial release
2.0|May 26, 2017|GA release
2.1|July 19, 2017|Bug fix
## 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.**
@ -48,4 +49,4 @@ This Web Part illustrates the following concepts on top of the SharePoint Framew
- `CustomFileChange`: It's a custom Angular directive. It binds the file with model on file change event.
- `IsoToDateString`: It's a custom Angular filter. It formats ISO date string to `{0:yyyy}-{0:MM}-{0:dd}` format.
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/samples/angular-ngofficeuifabric-file-upload" />
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/samples/angular-ngofficeuifabric-file-upload" />

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
.angularFileUpload_fa6efb43 .container_fa6efb43{max-width:700px;margin:0 auto;box-shadow:0 2px 4px 0 rgba(0,0,0,.2),0 25px 50px 0 rgba(0,0,0,.1)}.angularFileUpload_fa6efb43 .row_fa6efb43{padding:20px}.angularFileUpload_fa6efb43 .listItem_fa6efb43{max-width:715px;margin:5px auto 5px auto;box-shadow:0 0 4px 0 rgba(0,0,0,.2),0 25px 50px 0 rgba(0,0,0,.1)}.angularFileUpload_fa6efb43 .button_fa6efb43{text-decoration:none}.angularFileUpload_fa6efb43 .headerBackground_fa6efb43{background:#006f94}.angularFileUpload_fa6efb43 .whiteBackground_fa6efb43{background:#fff}.angularFileUpload_fa6efb43 .textAlignCenter_fa6efb43{text-align:center}.angularFileUpload_fa6efb43 .cursorPointer_fa6efb43{cursor:pointer}
.angularFileUpload_18abd87a .container_18abd87a{max-width:700px;margin:0 auto;box-shadow:0 2px 4px 0 rgba(0,0,0,.2),0 25px 50px 0 rgba(0,0,0,.1)}.angularFileUpload_18abd87a .row_18abd87a{padding:20px}.angularFileUpload_18abd87a .listItem_18abd87a{max-width:715px;margin:5px auto 5px auto;box-shadow:0 0 4px 0 rgba(0,0,0,.2),0 25px 50px 0 rgba(0,0,0,.1)}.angularFileUpload_18abd87a .button_18abd87a{text-decoration:none}.angularFileUpload_18abd87a .headerBackground_18abd87a{background:#006f94}.angularFileUpload_18abd87a .whiteBackground_18abd87a{background:#fff}.angularFileUpload_18abd87a .textAlignCenter_18abd87a{text-align:center}.angularFileUpload_18abd87a .cursorPointer_18abd87a{cursor:pointer}

View File

@ -2,15 +2,15 @@
/* tslint:disable */
require('./AngularFileUpload.module.css');
var styles = {
angularFileUpload: 'angularFileUpload_fa6efb43',
container: 'container_fa6efb43',
row: 'row_fa6efb43',
listItem: 'listItem_fa6efb43',
button: 'button_fa6efb43',
headerBackground: 'headerBackground_fa6efb43',
whiteBackground: 'whiteBackground_fa6efb43',
textAlignCenter: 'textAlignCenter_fa6efb43',
cursorPointer: 'cursorPointer_fa6efb43',
angularFileUpload: 'angularFileUpload_18abd87a',
container: 'container_18abd87a',
row: 'row_18abd87a',
listItem: 'listItem_18abd87a',
button: 'button_18abd87a',
headerBackground: 'headerBackground_18abd87a',
whiteBackground: 'whiteBackground_18abd87a',
textAlignCenter: 'textAlignCenter_18abd87a',
cursorPointer: 'cursorPointer_18abd87a',
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = styles;

View File

@ -1 +1 @@
{"version":3,"sources":["webparts/angularFileUpload/AngularFileUpload.module.scss.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,OAAO,CAAC,gCAAgC,CAAC,CAAC;AAC1C,IAAM,MAAM,GAAG;IACb,iBAAiB,EAAE,4BAA4B;IAC/C,SAAS,EAAE,oBAAoB;IAC/B,GAAG,EAAE,cAAc;IACnB,QAAQ,EAAE,mBAAmB;IAC7B,MAAM,EAAE,iBAAiB;IACzB,gBAAgB,EAAE,2BAA2B;IAC7C,eAAe,EAAE,0BAA0B;IAC3C,eAAe,EAAE,0BAA0B;IAC3C,aAAa,EAAE,wBAAwB;CACxC,CAAC;;AAEF,kBAAe,MAAM,CAAC;AACtB,mBAAmB","file":"webparts/angularFileUpload/AngularFileUpload.module.scss.js","sourcesContent":["/* tslint:disable */\r\nrequire('./AngularFileUpload.module.css');\r\nconst styles = {\r\n angularFileUpload: 'angularFileUpload_fa6efb43',\r\n container: 'container_fa6efb43',\r\n row: 'row_fa6efb43',\r\n listItem: 'listItem_fa6efb43',\r\n button: 'button_fa6efb43',\r\n headerBackground: 'headerBackground_fa6efb43',\r\n whiteBackground: 'whiteBackground_fa6efb43',\r\n textAlignCenter: 'textAlignCenter_fa6efb43',\r\n cursorPointer: 'cursorPointer_fa6efb43',\r\n};\r\n\r\nexport default styles;\r\n/* tslint:enable */"],"sourceRoot":"..\\..\\..\\src"}
{"version":3,"sources":["webparts/angularFileUpload/AngularFileUpload.module.scss.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,OAAO,CAAC,gCAAgC,CAAC,CAAC;AAC1C,IAAM,MAAM,GAAG;IACb,iBAAiB,EAAE,4BAA4B;IAC/C,SAAS,EAAE,oBAAoB;IAC/B,GAAG,EAAE,cAAc;IACnB,QAAQ,EAAE,mBAAmB;IAC7B,MAAM,EAAE,iBAAiB;IACzB,gBAAgB,EAAE,2BAA2B;IAC7C,eAAe,EAAE,0BAA0B;IAC3C,eAAe,EAAE,0BAA0B;IAC3C,aAAa,EAAE,wBAAwB;CACxC,CAAC;;AAEF,kBAAe,MAAM,CAAC;AACtB,mBAAmB","file":"webparts/angularFileUpload/AngularFileUpload.module.scss.js","sourcesContent":["/* tslint:disable */\r\nrequire('./AngularFileUpload.module.css');\r\nconst styles = {\r\n angularFileUpload: 'angularFileUpload_18abd87a',\r\n container: 'container_18abd87a',\r\n row: 'row_18abd87a',\r\n listItem: 'listItem_18abd87a',\r\n button: 'button_18abd87a',\r\n headerBackground: 'headerBackground_18abd87a',\r\n whiteBackground: 'whiteBackground_18abd87a',\r\n textAlignCenter: 'textAlignCenter_18abd87a',\r\n cursorPointer: 'cursorPointer_18abd87a',\r\n};\r\n\r\nexport default styles;\r\n/* tslint:enable */"],"sourceRoot":"..\\..\\..\\src"}

View File

@ -1,11 +1,13 @@
import { Version } from '@microsoft/sp-core-library';
import { BaseClientSideWebPart, IPropertyPaneConfiguration, IWebPartContext } from '@microsoft/sp-webpart-base';
import './app/FileUploadModule';
import { IAngularFileUploadWebPartProps } from './IAngularFileUploadWebPartProps';
import 'ng-office-ui-fabric';
export default class AngularFileUploadWebPart extends BaseClientSideWebPart<IAngularFileUploadWebPartProps> {
context: IWebPartContext;
private $injector;
constructor(context: IWebPartContext);
render(): void;
protected initAngularApp(pageContext: any): void;
protected readonly dataVersion: Version;
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration;
protected readonly disableReactivePropertyChanges: boolean;

View File

@ -7,10 +7,15 @@ var __extends = (this && this.__extends) || function (d, b) {
var sp_core_library_1 = require("@microsoft/sp-core-library");
var sp_webpart_base_1 = require("@microsoft/sp-webpart-base");
var sp_loader_1 = require("@microsoft/sp-loader");
var angular = require("angular");
require("./app/FileUploadModule");
var AngularFileUpload_module_scss_1 = require("./AngularFileUpload.module.scss");
var strings = require("angularFileUploadStrings");
var angular = require("angular");
require("ng-office-ui-fabric");
var baseSvc_1 = require("./app/services/baseSvc");
var fileUploadSvc_1 = require("./app/services/fileUploadSvc");
var fileUploadCtrl_1 = require("./app/controllers/fileUploadCtrl");
var customFileChange_1 = require("./app/directives/customFileChange");
var isoToDateString_1 = require("./app/filters/isoToDateString");
var AngularFileUploadWebPart = (function (_super) {
__extends(AngularFileUploadWebPart, _super);
function AngularFileUploadWebPart(context) {
@ -22,13 +27,28 @@ var AngularFileUploadWebPart = (function (_super) {
AngularFileUploadWebPart.prototype.render = function () {
if (this.renderedOnce === false) {
this.domElement.innerHTML = "\n <div class=\"" + AngularFileUpload_module_scss_1.default.angularFileUpload + "\">\n <div class=\"" + AngularFileUpload_module_scss_1.default.container + "\" data-ng-controller=\"fileUploadCtrl as vm\">\n <div class=\"ms-Grid ms-fontColor-white " + AngularFileUpload_module_scss_1.default.row + " " + AngularFileUpload_module_scss_1.default.headerBackground + "\">\n <div class=\"ms-Grid-row\">\n <div class=\"ms-Grid-col ms-u-sm12 ms-u-md12 ms-u-lg12\">\n <h1 class=\"ms-fontSize-su ms-fontColor-white " + AngularFileUpload_module_scss_1.default.textAlignCenter + "\">Welcome to Angular File Upload!</h1>\n </div>\n </div>\n <div class=\"ms-Grid-row " + AngularFileUpload_module_scss_1.default.whiteBackground + " " + AngularFileUpload_module_scss_1.default.row + "\">\n <div class=\"ms-Grid-col ms-u-sm5 ms-u-md7 ms-u-lg7 ms-fontColor-black\"><input type=\"file\" value=\"vm.file.fileName\" data-custom-file-change=\"vm.file\" /></div>\n <div class=\"ms-Grid-col ms-u-sm2 ms-u-md2 ms-u-lg2\"><uif-spinner data-ng-if=\"vm.isUploading\"></uif-spinner></div>\n <div class=\"ms-Grid-col ms-u-sm5 ms-u-md3 ms-u-lg3\"><uif-button uif-type=\"primary\" data-ng-click=\"vm.upload()\">Upload</uif-button></div>\n </div>\n\n <div class=\"ms-Grid-row\">\n <div class=\"ms-Grid-col ms-u-sm12 ms-u-md12 ms-u-lg12\">\n <h1 class=\"ms-fontSize-su ms-fontColor-white " + AngularFileUpload_module_scss_1.default.textAlignCenter + "\">{{vm.libraryTitle}}: Files uploaded by You</h1>\n </div>\n </div>\n\n <div class=\"ms-Grid-row " + AngularFileUpload_module_scss_1.default.whiteBackground + " " + AngularFileUpload_module_scss_1.default.row + "\">\n <div class=\"ms-Grid-col ms-u-sm12 ms-u-md12 ms-u-lg12\">\n <uif-spinner data-ng-if=\"vm.isRemoving\">Removing .....</uif-spinner>\n </div>\n </div>\n\n <div class=\"ms-Grid-row " + AngularFileUpload_module_scss_1.default.whiteBackground + " " + AngularFileUpload_module_scss_1.default.row + "\">\n <div class=\"ms-Grid-col ms-u-sm12 ms-u-md12 ms-u-lg12\">\n <uif-table>\n <uif-table-head>\n <uif-table-row>\n <uif-table-header>File Name</uif-table-header>\n <uif-table-header>Modified</uif-table-header>\n <uif-table-header>Action</uif-table-header>\n </uif-table-row>\n </uif-table-head>\n <uif-table-body>\n <uif-table-row data-ng-repeat=\"fileItem in vm.allFiles\">\n <uif-table-cell>{{fileItem.FileLeafRef}}</uif-table-cell>\n <uif-table-cell>{{fileItem.Modified | isoToDateString}}</uif-table-cell>\n <uif-table-cell><i class=\"ms-Icon ms-Icon--Delete " + AngularFileUpload_module_scss_1.default.cursorPointer + "\" aria-hidden=\"true\" data-ng-click=\"vm.deleteFile(fileItem)\"></i></uif-table-cell>\n </uif-table-row>\n </uif-table-body>\n </uif-table>\n </div>\n </div>\n </div>\n </div>\n </div>";
this.$injector = angular.bootstrap(this.domElement, ['fileUploadApp']);
var context = this.context.pageContext;
this.initAngularApp(context);
}
this.$injector.get('$rootScope').$broadcast('configurationChanged', {
libraryTitle: this.properties.libraryTitle,
rowLimit: this.properties.rowLimit
});
};
AngularFileUploadWebPart.prototype.initAngularApp = function (pageContext) {
var fileUploadApp = angular.module('fileUploadApp', [
'officeuifabric.core',
'officeuifabric.components'
]);
fileUploadApp
.constant("pageContext", pageContext)
.service("baseService", baseSvc_1.BaseService)
.service("fileUploadService", fileUploadSvc_1.FileUploadService)
.controller("fileUploadCtrl", fileUploadCtrl_1.FileUploadCtrl)
.filter("isoToDateString", isoToDateString_1.IsoToDateString.filter)
.directive("customFileChange", customFileChange_1.CustomFileChange.factory());
this.$injector = angular.bootstrap(this.domElement, ['fileUploadApp']);
};
Object.defineProperty(AngularFileUploadWebPart.prototype, "dataVersion", {
get: function () {
return sp_core_library_1.Version.parse('1.0');

View File

@ -1 +1 @@
{"version":3,"sources":["webparts/angularFileUpload/app/FileUploadModule.ts"],"names":[],"mappings":";AAAA,iCAAmC;AACnC,+BAA6B;AAC7B,8CAAiD;AACjD,0DAA6D;AAC7D,+DAA8D;AAC9D,kEAAiE;AACjE,6DAA4D;AAE5D,IAAM,aAAa,GAAe,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE;IAChE,qBAAqB;IACrB,2BAA2B;CAC5B,CAAC,CAAC;AAEH,aAAa;KACV,OAAO,CAAC,aAAa,EAAE,qBAAW,CAAC;KACnC,OAAO,CAAC,mBAAmB,EAAE,iCAAiB,CAAC;KAC/C,UAAU,CAAC,gBAAgB,EAAE,+BAAc,CAAC;KAC5C,MAAM,CAAC,iBAAiB,EAAE,iCAAe,CAAC,MAAM,CAAC;KACjD,SAAS,CAAC,kBAAkB,EAAE,mCAAgB,CAAC,OAAO,EAAE,CAAC,CAAC","file":"webparts/angularFileUpload/app/FileUploadModule.js","sourcesContent":["import * as angular from 'angular';\nimport 'ng-office-ui-fabric';\nimport { BaseService } from './services/baseSvc';\nimport { FileUploadService } from './services/fileUploadSvc';\nimport { FileUploadCtrl } from './controllers/fileUploadCtrl';\nimport { CustomFileChange } from './directives/customFileChange';\nimport { IsoToDateString } from './filters/isoToDateString';\n\nconst fileUploadApp: ng.IModule = angular.module('fileUploadApp', [\n 'officeuifabric.core',\n 'officeuifabric.components'\n]);\n\nfileUploadApp\n .service(\"baseService\", BaseService)\n .service(\"fileUploadService\", FileUploadService)\n .controller(\"fileUploadCtrl\", FileUploadCtrl)\n .filter(\"isoToDateString\", IsoToDateString.filter)\n .directive(\"customFileChange\", CustomFileChange.factory());\n\n"],"sourceRoot":"..\\..\\..\\..\\src"}
{"version":3,"sources":["webparts/angularFileUpload/app/FileUploadModule.ts"],"names":[],"mappings":";AAAA,iCAAmC;AACnC,+BAA6B;AAC7B,8CAAiD;AACjD,0DAA6D;AAC7D,+DAA8D;AAC9D,kEAAiE;AACjE,6DAA4D;AAE5D,IAAM,aAAa,GAAe,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE;IAChE,qBAAqB;IACrB,2BAA2B;CAC5B,CAAC,CAAC;AAEH,aAAa;KACV,OAAO,CAAC,aAAa,EAAE,qBAAW,CAAC;KACnC,OAAO,CAAC,mBAAmB,EAAE,iCAAiB,CAAC;KAC/C,UAAU,CAAC,gBAAgB,EAAE,+BAAc,CAAC;KAC5C,MAAM,CAAC,iBAAiB,EAAE,iCAAe,CAAC,MAAM,CAAC;KACjD,SAAS,CAAC,kBAAkB,EAAE,mCAAgB,CAAC,OAAO,EAAE,CAAC,CAAC","file":"webparts/angularFileUpload/app/FileUploadModule.js","sourcesContent":["import * as angular from 'angular';\r\nimport 'ng-office-ui-fabric';\r\nimport { BaseService } from './services/baseSvc';\r\nimport { FileUploadService } from './services/fileUploadSvc';\r\nimport { FileUploadCtrl } from './controllers/fileUploadCtrl';\r\nimport { CustomFileChange } from './directives/customFileChange';\r\nimport { IsoToDateString } from './filters/isoToDateString';\r\n\r\nconst fileUploadApp: ng.IModule = angular.module('fileUploadApp', [\r\n 'officeuifabric.core',\r\n 'officeuifabric.components'\r\n]);\r\n\r\nfileUploadApp\r\n .service(\"baseService\", BaseService)\r\n .service(\"fileUploadService\", FileUploadService)\r\n .controller(\"fileUploadCtrl\", FileUploadCtrl)\r\n .filter(\"isoToDateString\", IsoToDateString.filter)\r\n .directive(\"customFileChange\", CustomFileChange.factory());\r\n\r\n"],"sourceRoot":"..\\..\\..\\..\\src"}

View File

@ -26,6 +26,9 @@ var FileUploadCtrl = (function () {
};
FileUploadCtrl.prototype.upload = function () {
var _this = this;
if (!this.file) {
return;
}
this.isUploading = true;
this.fileUploadService.uploadFile(this.libraryTitle, this.file)
.then(function (response) {

View File

@ -1 +1 @@
{"version":3,"sources":["webparts/angularFileUpload/app/controllers/fileUploadCtrl.ts"],"names":[],"mappings":";AAKA;IASE,wBAAoB,iBAAoC,EAAU,UAAgC;QAAlG,iBAUC;QAVmB,sBAAiB,GAAjB,iBAAiB,CAAmB;QAAU,eAAU,GAAV,UAAU,CAAsB;QAH3F,gBAAW,GAAY,KAAK,CAAC;QAC7B,eAAU,GAAY,KAAK,CAAC;QAGjC,IAAM,EAAE,GAAmB,IAAI,CAAC;QAChC,UAAU,CAAC,GAAG,CAAC,sBAAsB,EACnC,UAAC,KAAuB,EAAE,IAAS;YACjC,KAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;YACtC,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACxC,EAAE,CAAA,CAAC,KAAI,CAAC,YAAY,CAAC,CAAA,CAAC;gBACpB,KAAI,CAAC,IAAI,EAAE,CAAC;YACd,CAAC;QACH,CAAC,CAAC,CAAC;IACP,CAAC;IACO,6BAAI,GAAZ;QAAA,iBAOC;QANC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC;aAC9D,IAAI,CAAC,UAAC,QAA0B;YAC/B,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,CAAC,EAAE,UAAC,KAAa;YACf,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,+BAAM,GAAb;QAAA,iBAWC;QAVC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC;aAC5D,IAAI,CAAC,UAAC,QAAmB;YACxB,KAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAChC,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,KAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,CAAC,EAAE,UAAC,KAAa;YACf,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACrB,KAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,mCAAU,GAAjB,UAAkB,QAAmB;QAArC,iBAYC;QAXC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,iBAAiB;aACnB,UAAU,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,EAAE,CAAC;aAC1C,IAAI,CAAC,UAAC,QAAa;YAClB,IAAI,aAAa,GAAW,KAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC5D,KAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;YACvC,KAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAC1B,CAAC,EAAE,UAAC,KAAa;YACf,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACrB,KAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAC1B,CAAC,CAAC,CAAC;IACP,CAAC;IACH,qBAAC;AAAD,CAvDA,AAuDC;AAtDe,sBAAO,GAAa,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;AAD3D,wCAAc","file":"webparts/angularFileUpload/app/controllers/fileUploadCtrl.js","sourcesContent":["import { FileUploadService } from '../services/fileUploadSvc';\nimport { IFileItem } from \"../../interfaces/IFileItem\";\nimport { IFile } from \"../../interfaces/IFile\";\nimport { IError } from \"../../interfaces/IError\";\n\nexport class FileUploadCtrl {\n public static $inject: string[] = ['fileUploadService', '$rootScope'];\n public allFiles: Array<IFileItem>;\n public file: IFile;\n public libraryTitle: string;\n public rowLimit: number;\n public isUploading: boolean = false;\n public isRemoving: boolean = false;\n\n constructor(private fileUploadService: FileUploadService, private $rootScope: ng.IRootScopeService) {\n const vm: FileUploadCtrl = this;\n $rootScope.$on('configurationChanged',\n (event: ng.IAngularEvent, args: any): void => {\n this.libraryTitle = args.libraryTitle;\n this.rowLimit = parseInt(args.rowLimit);\n if(this.libraryTitle){\n this.init();\n }\n });\n }\n private init(): void {\n this.fileUploadService.getFiles(this.libraryTitle, this.rowLimit)\n .then((response: Array<IFileItem>): void => {\n this.allFiles = response;\n }, (error: IError): void => {\n alert(error.message);\n });\n }\n\n public upload(): void {\n this.isUploading = true;\n this.fileUploadService.uploadFile(this.libraryTitle, this.file)\n .then((response: IFileItem): void => {\n this.allFiles.unshift(response);\n this.file = null;\n this.isUploading = false;\n }, (error: IError): void => {\n alert(error.message);\n this.isUploading = false;\n });\n }\n\n public deleteFile(fileItem: IFileItem): void {\n this.isRemoving = true;\n this.fileUploadService\n .deleteFile(this.libraryTitle, fileItem.Id)\n .then((response: any): void => {\n var fileItemIndex: number = this.allFiles.indexOf(fileItem);\n this.allFiles.splice(fileItemIndex, 1);\n this.isRemoving = false;\n }, (error: IError): void => {\n alert(error.message);\n this.isRemoving = false;\n });\n }\n}\n"],"sourceRoot":"..\\..\\..\\..\\..\\src"}
{"version":3,"sources":["webparts/angularFileUpload/app/controllers/fileUploadCtrl.ts"],"names":[],"mappings":";AAKA;IASE,wBAAoB,iBAAoC,EAAU,UAAgC;QAAlG,iBAUC;QAVmB,sBAAiB,GAAjB,iBAAiB,CAAmB;QAAU,eAAU,GAAV,UAAU,CAAsB;QAH3F,gBAAW,GAAY,KAAK,CAAC;QAC7B,eAAU,GAAY,KAAK,CAAC;QAGjC,IAAM,EAAE,GAAmB,IAAI,CAAC;QAChC,UAAU,CAAC,GAAG,CAAC,sBAAsB,EACnC,UAAC,KAAuB,EAAE,IAAS;YACjC,KAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;YACtC,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACxC,EAAE,CAAA,CAAC,KAAI,CAAC,YAAY,CAAC,CAAA,CAAC;gBACpB,KAAI,CAAC,IAAI,EAAE,CAAC;YACd,CAAC;QACH,CAAC,CAAC,CAAC;IACP,CAAC;IACO,6BAAI,GAAZ;QAAA,iBAOC;QANC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC;aAC9D,IAAI,CAAC,UAAC,QAA0B;YAC/B,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,CAAC,EAAE,UAAC,KAAa;YACf,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,+BAAM,GAAb;QAAA,iBAcC;QAbC,EAAE,CAAA,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAC;YACb,MAAM,CAAC;QACT,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC;aAC5D,IAAI,CAAC,UAAC,QAAmB;YACxB,KAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAChC,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,KAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,CAAC,EAAE,UAAC,KAAa;YACf,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACrB,KAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,mCAAU,GAAjB,UAAkB,QAAmB;QAArC,iBAYC;QAXC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,iBAAiB;aACnB,UAAU,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,EAAE,CAAC;aAC1C,IAAI,CAAC,UAAC,QAAa;YAClB,IAAI,aAAa,GAAW,KAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC5D,KAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;YACvC,KAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAC1B,CAAC,EAAE,UAAC,KAAa;YACf,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACrB,KAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAC1B,CAAC,CAAC,CAAC;IACP,CAAC;IACH,qBAAC;AAAD,CA1DA,AA0DC;AAzDe,sBAAO,GAAa,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;AAD3D,wCAAc","file":"webparts/angularFileUpload/app/controllers/fileUploadCtrl.js","sourcesContent":["import { FileUploadService } from '../services/fileUploadSvc';\r\nimport { IFileItem } from \"../../interfaces/IFileItem\";\r\nimport { IFile } from \"../../interfaces/IFile\";\r\nimport { IError } from \"../../interfaces/IError\";\r\n\r\nexport class FileUploadCtrl {\r\n public static $inject: string[] = ['fileUploadService', '$rootScope'];\r\n public allFiles: Array<IFileItem>;\r\n public file: IFile;\r\n public libraryTitle: string;\r\n public rowLimit: number;\r\n public isUploading: boolean = false;\r\n public isRemoving: boolean = false;\r\n\r\n constructor(private fileUploadService: FileUploadService, private $rootScope: ng.IRootScopeService) {\r\n const vm: FileUploadCtrl = this;\r\n $rootScope.$on('configurationChanged',\r\n (event: ng.IAngularEvent, args: any): void => {\r\n this.libraryTitle = args.libraryTitle;\r\n this.rowLimit = parseInt(args.rowLimit);\r\n if(this.libraryTitle){\r\n this.init();\r\n }\r\n });\r\n }\r\n private init(): void {\r\n this.fileUploadService.getFiles(this.libraryTitle, this.rowLimit)\r\n .then((response: Array<IFileItem>): void => {\r\n this.allFiles = response;\r\n }, (error: IError): void => {\r\n alert(error.message);\r\n });\r\n }\r\n\r\n public upload(): void {\r\n if(!this.file){\r\n return;\r\n }\r\n this.isUploading = true;\r\n this.fileUploadService.uploadFile(this.libraryTitle, this.file)\r\n .then((response: IFileItem): void => {\r\n this.allFiles.unshift(response);\r\n this.file = null;\r\n this.isUploading = false;\r\n }, (error: IError): void => {\r\n alert(error.message);\r\n this.isUploading = false;\r\n });\r\n }\r\n\r\n public deleteFile(fileItem: IFileItem): void {\r\n this.isRemoving = true;\r\n this.fileUploadService\r\n .deleteFile(this.libraryTitle, fileItem.Id)\r\n .then((response: any): void => {\r\n var fileItemIndex: number = this.allFiles.indexOf(fileItem);\r\n this.allFiles.splice(fileItemIndex, 1);\r\n this.isRemoving = false;\r\n }, (error: IError): void => {\r\n alert(error.message);\r\n this.isRemoving = false;\r\n });\r\n }\r\n}\r\n"],"sourceRoot":"..\\..\\..\\..\\..\\src"}

View File

@ -1 +1 @@
{"version":3,"sources":["webparts/angularFileUpload/app/directives/customFileChange.ts"],"names":[],"mappings":";AACA;IACE,0BAAoB,MAAwB;QAA5C,iBAEC;QAFmB,WAAM,GAAN,MAAM,CAAkB;QAItC,aAAQ,GAAG,GAAG,CAAC;QACf,SAAI,GAAG,UAAC,KAAgB,EAAE,OAAY,EAAE,KAAU;YACtD,IAAM,KAAK,GAAG,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YAClD,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE;gBACrB,KAAK,CAAC,MAAM,CAAC;oBACX,IAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;oBAEhC,MAAM,CAAC,MAAM,GAAG,UAAC,KAAU;wBACzB,IAAM,SAAS,GAAU;4BACvB,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI;4BAClC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM;yBAClC,CAAC;wBACF,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;oBAChC,CAAC,CAAC;oBAEF,MAAM,CAAC,OAAO,GAAG,UAAC,KAAU;wBAC1B,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBAC5B,CAAC,CAAC;oBACF,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAChD,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IAxBF,CAAC;IA0BY,wBAAO,GAArB;QACG,IAAM,SAAS,GAAG,UAAC,MAAwB,IAAK,OAAA,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAA5B,CAA4B,CAAC;QAC7E,SAAS,CAAC,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC/B,MAAM,CAAC,SAAS,CAAC;IACnB,CAAC;IACH,uBAAC;AAAD,CAlCA,AAkCC,IAAA;AAlCY,4CAAgB","file":"webparts/angularFileUpload/app/directives/customFileChange.js","sourcesContent":["import { IFile } from \"../../interfaces/IFile\";\nexport class CustomFileChange implements ng.IDirective {\n constructor(private $parse: ng.IParseService) {\n\n }\n\n public restrict = \"A\";\n public link = (scope: ng.IScope, element: any, attrs: any) => {\n const model = this.$parse(attrs.customFileChange);\n const modelSetter = model.assign;\n element.bind(\"change\", (): void => {\n scope.$apply((): void => {\n const reader = new FileReader();\n\n reader.onload = (event: any): void => {\n const fileModel: IFile = {\n fileName: element[0].files[0].name, \n fileAsBuffer: event.target.result\n };\n modelSetter(scope, fileModel);\n };\n\n reader.onerror = (event: any): void => {\n alert(event.target.error);\n };\n reader.readAsArrayBuffer(element[0].files[0]);\n });\n });\n };\n\n public static factory(): ng.IDirectiveFactory {\n const directive = ($parse: ng.IParseService) => new CustomFileChange($parse);\n directive.$inject = ['$parse'];\n return directive;\n }\n}"],"sourceRoot":"..\\..\\..\\..\\..\\src"}
{"version":3,"sources":["webparts/angularFileUpload/app/directives/customFileChange.ts"],"names":[],"mappings":";AACA;IACE,0BAAoB,MAAwB;QAA5C,iBAEC;QAFmB,WAAM,GAAN,MAAM,CAAkB;QAItC,aAAQ,GAAG,GAAG,CAAC;QACf,SAAI,GAAG,UAAC,KAAgB,EAAE,OAAY,EAAE,KAAU;YACtD,IAAM,KAAK,GAAG,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YAClD,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE;gBACrB,KAAK,CAAC,MAAM,CAAC;oBACX,IAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;oBAEhC,MAAM,CAAC,MAAM,GAAG,UAAC,KAAU;wBACzB,IAAM,SAAS,GAAU;4BACvB,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI;4BAClC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM;yBAClC,CAAC;wBACF,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;oBAChC,CAAC,CAAC;oBAEF,MAAM,CAAC,OAAO,GAAG,UAAC,KAAU;wBAC1B,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBAC5B,CAAC,CAAC;oBACF,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAChD,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IAxBF,CAAC;IA0BY,wBAAO,GAArB;QACG,IAAM,SAAS,GAAG,UAAC,MAAwB,IAAK,OAAA,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAA5B,CAA4B,CAAC;QAC7E,SAAS,CAAC,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC/B,MAAM,CAAC,SAAS,CAAC;IACnB,CAAC;IACH,uBAAC;AAAD,CAlCA,AAkCC,IAAA;AAlCY,4CAAgB","file":"webparts/angularFileUpload/app/directives/customFileChange.js","sourcesContent":["import { IFile } from \"../../interfaces/IFile\";\r\nexport class CustomFileChange implements ng.IDirective {\r\n constructor(private $parse: ng.IParseService) {\r\n\r\n }\r\n\r\n public restrict = \"A\";\r\n public link = (scope: ng.IScope, element: any, attrs: any) => {\r\n const model = this.$parse(attrs.customFileChange);\r\n const modelSetter = model.assign;\r\n element.bind(\"change\", (): void => {\r\n scope.$apply((): void => {\r\n const reader = new FileReader();\r\n\r\n reader.onload = (event: any): void => {\r\n const fileModel: IFile = {\r\n fileName: element[0].files[0].name, \r\n fileAsBuffer: event.target.result\r\n };\r\n modelSetter(scope, fileModel);\r\n };\r\n\r\n reader.onerror = (event: any): void => {\r\n alert(event.target.error);\r\n };\r\n reader.readAsArrayBuffer(element[0].files[0]);\r\n });\r\n });\r\n };\r\n\r\n public static factory(): ng.IDirectiveFactory {\r\n const directive = ($parse: ng.IParseService) => new CustomFileChange($parse);\r\n directive.$inject = ['$parse'];\r\n return directive;\r\n }\r\n}"],"sourceRoot":"..\\..\\..\\..\\..\\src"}

View File

@ -1 +1 @@
{"version":3,"sources":["webparts/angularFileUpload/app/filters/isoToDateString.ts"],"names":[],"mappings":";AAAA;IAAA;IAMA,CAAC;IALc,sBAAM,GAApB;QACG,MAAM,CAAC,UAAC,KAAa;YACnB,MAAM,CAAO,MAAO,CAAC,MAAM,CAAC,wBAAwB,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACzE,CAAC,CAAC;IACJ,CAAC;IACH,sBAAC;AAAD,CANA,AAMC,IAAA;AANY,0CAAe","file":"webparts/angularFileUpload/app/filters/isoToDateString.js","sourcesContent":["export class IsoToDateString {\n public static filter() {\n return (value: string): string => {\n return (<any>String).format(\"{0:yyyy}-{0:MM}-{0:dd}\", new Date(value));\n };\n }\n}"],"sourceRoot":"..\\..\\..\\..\\..\\src"}
{"version":3,"sources":["webparts/angularFileUpload/app/filters/isoToDateString.ts"],"names":[],"mappings":";AAAA;IAAA;IAMA,CAAC;IALc,sBAAM,GAApB;QACG,MAAM,CAAC,UAAC,KAAa;YACnB,MAAM,CAAO,MAAO,CAAC,MAAM,CAAC,wBAAwB,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACzE,CAAC,CAAC;IACJ,CAAC;IACH,sBAAC;AAAD,CANA,AAMC,IAAA;AANY,0CAAe","file":"webparts/angularFileUpload/app/filters/isoToDateString.js","sourcesContent":["export class IsoToDateString {\r\n public static filter() {\r\n return (value: string): string => {\r\n return (<any>String).format(\"{0:yyyy}-{0:MM}-{0:dd}\", new Date(value));\r\n };\r\n }\r\n}"],"sourceRoot":"..\\..\\..\\..\\..\\src"}

View File

@ -1,9 +1,10 @@
export declare class BaseService {
private $http;
private $q;
private pageContext;
static $inject: string[];
baseUrl: string;
constructor($http: ng.IHttpService, $q: ng.IQService);
constructor($http: ng.IHttpService, $q: ng.IQService, pageContext: any);
getRequest(query?: string, endPoint?: string): ng.IPromise<any>;
postRequest(url: string, requestBody: any, endPoint?: string): ng.IPromise<any>;
updateRequest(url: string, requestBody: any, eTag: string, endPoint?: string): ng.IPromise<{}>;

View File

@ -1,10 +1,11 @@
"use strict";
var angular = require("angular");
var BaseService = (function () {
function BaseService($http, $q) {
function BaseService($http, $q, pageContext) {
this.$http = $http;
this.$q = $q;
this.baseUrl = window._spPageContextInfo.webAbsoluteUrl;
this.pageContext = pageContext;
this.baseUrl = pageContext.web.absoluteUrl;
}
BaseService.prototype.getRequest = function (query, endPoint) {
var deferred = this.$q.defer();
@ -172,7 +173,7 @@ var BaseService = (function () {
};
return BaseService;
}());
BaseService.$inject = ["$http", "$q"];
BaseService.$inject = ["$http", "$q", "pageContext"];
exports.BaseService = BaseService;
//# sourceMappingURL=BaseSvc.js.map
//# sourceMappingURL=baseSvc.js.map

View File

@ -1,4 +1,4 @@
import { BaseService } from "./BaseSvc";
import { BaseService } from "./baseSvc";
import { IFileItem } from "../../interfaces/IFileItem";
import { IFile } from "../../interfaces/IFile";
export declare class FileUploadService {

View File

@ -21,7 +21,7 @@ var FileUploadService = (function () {
return deferred.promise;
};
FileUploadService.prototype.getFiles = function (libraryName, rowLimit) {
var url = "/_api/Web/lists/getbytitle('" + libraryName + "')/items?$select=Id,Modified,FileLeafRef,Author/Id&$expand=Author&$orderby=Modified desc&$top=" + rowLimit + "&$filter=Author/Id eq " + window._spPageContextInfo.userId;
var url = "/_api/Web/lists/getbytitle('" + libraryName + "')/items?$select=Id,Modified,FileLeafRef,Author/Id&$expand=Author&$orderby=Modified desc&$top=" + rowLimit;
return this.baseService.getRequest(url);
};
FileUploadService.prototype.deleteFile = function (libraryName, id) {

View File

@ -1 +1 @@
{"version":3,"sources":["webparts/angularFileUpload/app/services/fileUploadSvc.ts"],"names":[],"mappings":";AAIA;IAEE,2BAAoB,WAAwB,EAAU,EAAgB;QAAlD,gBAAW,GAAX,WAAW,CAAa;QAAU,OAAE,GAAF,EAAE,CAAc;IACtE,CAAC;IAEM,sCAAU,GAAjB,UAAkB,WAAmB,EAAE,IAAW;QAAlD,iBAcC;QAbC,IAAM,QAAQ,GAA4B,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAC1D,IAAI,SAAS,GAAG,iCAA+B,WAAW,0EAAqE,IAAI,CAAC,QAAQ,MAAG,CAAC;QAChJ,IAAI,CAAC,WAAW;aACb,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;aACzC,IAAI,CAAC,UAAC,QAAa;YAClB,MAAM,CAAC,KAAI,CAAC,WAAW;iBACpB,UAAU,CAAC,IAAI,EAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,GAAG,qCAAkC,CAAC,CAAC;QACxG,CAAC,CAAC,CAAC,IAAI,CAAC,UAAC,QAAmB;YAC1B,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC,EAAE,UAAC,KAAU;YACZ,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QACL,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IAEM,oCAAQ,GAAf,UAAgB,WAAmB,EAAE,QAAgB;QACnD,IAAM,GAAG,GAAW,iCAA+B,WAAW,sGAAiG,QAAQ,8BAA+B,MAAO,CAAC,kBAAkB,CAAC,MAAQ,CAAC;QAC1O,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;IAEM,sCAAU,GAAjB,UAAkB,WAAmB,EAAE,EAAU;QAC/C,IAAM,GAAG,GAAW,iCAA+B,WAAW,iBAAY,EAAE,MAAG,CAAC;QAChF,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;IACH,wBAAC;AAAD,CA9BA,AA8BC;AA7Be,yBAAO,GAAa,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AAD7C,8CAAiB","file":"webparts/angularFileUpload/app/services/fileUploadSvc.js","sourcesContent":["import { BaseService } from \"./BaseSvc\";\nimport { IFileItem } from \"../../interfaces/IFileItem\";\nimport { IFile } from \"../../interfaces/IFile\";\n\nexport class FileUploadService {\n public static $inject: string[] = [\"baseService\", \"$q\"];\n constructor(private baseService: BaseService, private $q: ng.IQService) {\n }\n\n public uploadFile(libraryName: string, file: IFile): ng.IPromise<IFileItem> {\n const deferred: ng.IDeferred<IFileItem> = this.$q.defer();\n var uploadUrl = `/_api/web/lists/getbytitle('${libraryName}')/rootfolder/files/add(url=@filename, overwrite=true)?@filename='${file.fileName}'`;\n this.baseService\n .postRequest(uploadUrl, file.fileAsBuffer)\n .then((response: any): ng.IPromise<IFileItem> => {\n return this.baseService\n .getRequest(null, `${response.d.ListItemAllFields.__deferred.uri}?$select=Id,Modified,FileLeafRef`);\n }).then((response: IFileItem): void => {\n deferred.resolve(response);\n }, (error: any): void => {\n deferred.reject(error);\n });\n return deferred.promise;\n }\n\n public getFiles(libraryName: string, rowLimit: number): ng.IPromise<Array<IFileItem>> {\n const url: string = `/_api/Web/lists/getbytitle('${libraryName}')/items?$select=Id,Modified,FileLeafRef,Author/Id&$expand=Author&$orderby=Modified desc&$top=${rowLimit}&$filter=Author/Id eq ${(<any>window)._spPageContextInfo.userId}`;\n return this.baseService.getRequest(url);\n }\n\n public deleteFile(libraryName: string, id: number): ng.IPromise<any> {\n const url: string = `/_api/Web/lists/getbytitle('${libraryName}')/items(${id})`;\n return this.baseService.deleteRequest(url, \"*\");\n }\n}"],"sourceRoot":"..\\..\\..\\..\\..\\src"}
{"version":3,"sources":["webparts/angularFileUpload/app/services/fileUploadSvc.ts"],"names":[],"mappings":";AAIA;IAEE,2BAAoB,WAAwB,EAAU,EAAgB;QAAlD,gBAAW,GAAX,WAAW,CAAa;QAAU,OAAE,GAAF,EAAE,CAAc;IACtE,CAAC;IAEM,sCAAU,GAAjB,UAAkB,WAAmB,EAAE,IAAW;QAAlD,iBAcC;QAbC,IAAM,QAAQ,GAA4B,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAC1D,IAAI,SAAS,GAAG,iCAA+B,WAAW,0EAAqE,IAAI,CAAC,QAAQ,MAAG,CAAC;QAChJ,IAAI,CAAC,WAAW;aACb,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;aACzC,IAAI,CAAC,UAAC,QAAa;YAClB,MAAM,CAAC,KAAI,CAAC,WAAW;iBACpB,UAAU,CAAC,IAAI,EAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,GAAG,qCAAkC,CAAC,CAAC;QACxG,CAAC,CAAC,CAAC,IAAI,CAAC,UAAC,QAAmB;YAC1B,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC,EAAE,UAAC,KAAU;YACZ,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QACL,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IAEM,oCAAQ,GAAf,UAAgB,WAAmB,EAAE,QAAgB;QACnD,IAAM,GAAG,GAAW,iCAA+B,WAAW,sGAAiG,QAAU,CAAC;QAC1K,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;IAEM,sCAAU,GAAjB,UAAkB,WAAmB,EAAE,EAAU;QAC/C,IAAM,GAAG,GAAW,iCAA+B,WAAW,iBAAY,EAAE,MAAG,CAAC;QAChF,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;IACH,wBAAC;AAAD,CA9BA,AA8BC;AA7Be,yBAAO,GAAa,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AAD7C,8CAAiB","file":"webparts/angularFileUpload/app/services/fileUploadSvc.js","sourcesContent":["import { BaseService } from \"./baseSvc\";\r\nimport { IFileItem } from \"../../interfaces/IFileItem\";\r\nimport { IFile } from \"../../interfaces/IFile\";\r\n\r\nexport class FileUploadService {\r\n public static $inject: string[] = [\"baseService\", \"$q\"];\r\n constructor(private baseService: BaseService, private $q: ng.IQService) {\r\n }\r\n\r\n public uploadFile(libraryName: string, file: IFile): ng.IPromise<IFileItem> {\r\n const deferred: ng.IDeferred<IFileItem> = this.$q.defer();\r\n var uploadUrl = `/_api/web/lists/getbytitle('${libraryName}')/rootfolder/files/add(url=@filename, overwrite=true)?@filename='${file.fileName}'`;\r\n this.baseService\r\n .postRequest(uploadUrl, file.fileAsBuffer)\r\n .then((response: any): ng.IPromise<IFileItem> => {\r\n return this.baseService\r\n .getRequest(null, `${response.d.ListItemAllFields.__deferred.uri}?$select=Id,Modified,FileLeafRef`);\r\n }).then((response: IFileItem): void => {\r\n deferred.resolve(response);\r\n }, (error: any): void => {\r\n deferred.reject(error);\r\n });\r\n return deferred.promise;\r\n }\r\n\r\n public getFiles(libraryName: string, rowLimit: number): ng.IPromise<Array<IFileItem>> {\r\n const url: string = `/_api/Web/lists/getbytitle('${libraryName}')/items?$select=Id,Modified,FileLeafRef,Author/Id&$expand=Author&$orderby=Modified desc&$top=${rowLimit}`;\r\n return this.baseService.getRequest(url);\r\n }\r\n\r\n public deleteFile(libraryName: string, id: number): ng.IPromise<any> {\r\n const url: string = `/_api/Web/lists/getbytitle('${libraryName}')/items(${id})`;\r\n return this.baseService.deleteRequest(url, \"*\");\r\n }\r\n}"],"sourceRoot":"..\\..\\..\\..\\..\\src"}

View File

@ -1,16 +0,0 @@
/* tslint:disable */
require('./AngularFileUpload.module.css');
const styles = {
angularFileUpload: 'angularFileUpload_fa6efb43',
container: 'container_fa6efb43',
row: 'row_fa6efb43',
listItem: 'listItem_fa6efb43',
button: 'button_fa6efb43',
headerBackground: 'headerBackground_fa6efb43',
whiteBackground: 'whiteBackground_fa6efb43',
textAlignCenter: 'textAlignCenter_fa6efb43',
cursorPointer: 'cursorPointer_fa6efb43',
};
export default styles;
/* tslint:enable */

View File

@ -7,16 +7,21 @@ import {
} from '@microsoft/sp-webpart-base';
import { escape } from '@microsoft/sp-lodash-subset';
import { SPComponentLoader } from '@microsoft/sp-loader';
import * as angular from 'angular';
import './app/FileUploadModule';
import styles from './AngularFileUpload.module.scss';
import * as strings from 'angularFileUploadStrings';
import { IAngularFileUploadWebPartProps } from './IAngularFileUploadWebPartProps';
export default class AngularFileUploadWebPart extends BaseClientSideWebPart<IAngularFileUploadWebPartProps> {
import * as angular from 'angular';
import 'ng-office-ui-fabric';
import { BaseService } from './app/services/baseSvc';
import { FileUploadService } from './app/services/fileUploadSvc';
import { FileUploadCtrl } from './app/controllers/fileUploadCtrl';
import { CustomFileChange } from './app/directives/customFileChange';
import { IsoToDateString } from './app/filters/isoToDateString';
export default class AngularFileUploadWebPart extends BaseClientSideWebPart<IAngularFileUploadWebPartProps> {
public context: IWebPartContext;
private $injector: ng.auto.IInjectorService;
public constructor(context: IWebPartContext) {
super();
@ -25,6 +30,7 @@ export default class AngularFileUploadWebPart extends BaseClientSideWebPart<IAng
}
public render(): void {
if (this.renderedOnce === false) {
this.domElement.innerHTML = `
<div class="${styles.angularFileUpload}">
@ -76,8 +82,9 @@ export default class AngularFileUploadWebPart extends BaseClientSideWebPart<IAng
</div>
</div>
</div>`;
var context = this.context.pageContext;
this.$injector = angular.bootstrap(this.domElement, ['fileUploadApp']);
this.initAngularApp(context);
}
this.$injector.get('$rootScope').$broadcast('configurationChanged', {
libraryTitle: this.properties.libraryTitle,
@ -85,6 +92,24 @@ export default class AngularFileUploadWebPart extends BaseClientSideWebPart<IAng
});
}
protected initAngularApp(pageContext: any) {
const fileUploadApp: ng.IModule = angular.module('fileUploadApp', [
'officeuifabric.core',
'officeuifabric.components'
]);
fileUploadApp
.constant("pageContext", pageContext)
.service("baseService", BaseService)
.service("fileUploadService", FileUploadService)
.controller("fileUploadCtrl", FileUploadCtrl)
.filter("isoToDateString", IsoToDateString.filter)
.directive("customFileChange", CustomFileChange.factory());
this.$injector = angular.bootstrap(this.domElement, ['fileUploadApp']);
}
protected get dataVersion(): Version {
return Version.parse('1.0');
}

View File

@ -1,20 +0,0 @@
import * as angular from 'angular';
import 'ng-office-ui-fabric';
import { BaseService } from './services/baseSvc';
import { FileUploadService } from './services/fileUploadSvc';
import { FileUploadCtrl } from './controllers/fileUploadCtrl';
import { CustomFileChange } from './directives/customFileChange';
import { IsoToDateString } from './filters/isoToDateString';
const fileUploadApp: ng.IModule = angular.module('fileUploadApp', [
'officeuifabric.core',
'officeuifabric.components'
]);
fileUploadApp
.service("baseService", BaseService)
.service("fileUploadService", FileUploadService)
.controller("fileUploadCtrl", FileUploadCtrl)
.filter("isoToDateString", IsoToDateString.filter)
.directive("customFileChange", CustomFileChange.factory());

View File

@ -33,6 +33,9 @@ export class FileUploadCtrl {
}
public upload(): void {
if(!this.file){
return;
}
this.isUploading = true;
this.fileUploadService.uploadFile(this.libraryTitle, this.file)
.then((response: IFileItem): void => {

View File

@ -1,4 +1,4 @@
import { BaseService } from "./BaseSvc";
import { BaseService } from "./baseSvc";
import { IFileItem } from "../../interfaces/IFileItem";
import { IFile } from "../../interfaces/IFile";
@ -24,7 +24,7 @@ export class FileUploadService {
}
public getFiles(libraryName: string, rowLimit: number): ng.IPromise<Array<IFileItem>> {
const url: string = `/_api/Web/lists/getbytitle('${libraryName}')/items?$select=Id,Modified,FileLeafRef,Author/Id&$expand=Author&$orderby=Modified desc&$top=${rowLimit}&$filter=Author/Id eq ${(<any>window)._spPageContextInfo.userId}`;
const url: string = `/_api/Web/lists/getbytitle('${libraryName}')/items?$select=Id,Modified,FileLeafRef,Author/Id&$expand=Author&$orderby=Modified desc&$top=${rowLimit}`;
return this.baseService.getRequest(url);
}

View File

@ -0,0 +1,3 @@
{
"rulesDirectory": "./config"
}

View File

@ -0,0 +1,59 @@
# Angular & ngOfficeUIFabric Client-Side Web Part
## Summary
this is a sample web part that illustrates the use of 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 a 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" />

View File

@ -1,10 +1,10 @@
# Search Client-Side Web Part Built with Angular v1.x
# Search Client-Side Web Part Built with Angular v1.x
## Summary
Sample Search Web Part that illustrates how you can use Angular within the new SharePoint Framework
This is a sample search web part that illustrates how you can use Angular within the new SharePoint Framework
![Sample of the search web part](./assets/angularSearch.png)
This app uses SharePoint's Search REST API endpoint to query listitems of a specific content type and displays the results to the end user.
This app uses the SharePoint Search REST API endpoint to query listitems of a specific content type and displays the results to the end user.
Ideally instead of selecting a content type for the search you would want to select a Result Source, but currently Result Sources are not
available through SharePoint's REST API.
@ -52,9 +52,9 @@ Version|Date|Comments
- Publishing features on site collection
- Publishing features on site
> Note: The Content Types that I pull for the search come from the Publishing Content Type which only
> Note: The content types that are pulled by the search come from the publishing content type which are only
> available when the Publishing Features are enabled on the site. I'm also searching by content type name
> and not by id becauase then I would get everything that inherits from that content type. I only want the
> and not by id because then I would get everything that inherits from that content type. I only want the
> the results for a specific content type and not everything that inherits that content type as well
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/samples/angular-search" />

View File

@ -1,4 +1,4 @@
import { ISPCType } from './AngularSearchWebPart'
import { ISPCType } from './AngularSearchWebPart';
export default class MockHttpClient {
private static _items: ISPCType[] = [

View File

@ -1,4 +1,4 @@
import { ISearchResults } from './../models/ISearchResults'
import { ISearchResults } from './../models/ISearchResults';
export interface IDataService {
getSearchResults(webUrl: string, contentType: string): angular.IPromise<ISearchResults>;

View File

@ -0,0 +1,3 @@
{
"rulesDirectory": "./config"
}

View File

@ -0,0 +1,3 @@
{
"rulesDirectory": "./config"
}

View File

@ -1,8 +0,0 @@
{
"@microsoft/generator-sharepoint": {
"libraryName": "angular-yammer",
"framework": "none",
"version": "1.0.0",
"libraryId": "f3f740d2-5a08-4e10-8f7c-b64846dc4f23"
}
}

View File

@ -1,56 +0,0 @@
# Yammer Feed WebPart using Angular
## Summary
This Web Part displays the feeds from yammer using https://c64.assets-yammer.com/assets/platform_embed.js.
![Yammer Feed WebPart using Angular](./assets/feed.PNG)
![Yammer Feed WebPart Properties](./assets/properties.PNG)
## Used SharePoint Framework Version
![drop](https://img.shields.io/badge/version-GA-green.svg)
## Applies to
* [SharePoint Framework](https://dev.office.com/sharepoint/docs/spfx/sharepoint-framework-overview)
* [SharePoint Online Tenant](https://dev.office.com/sharepoint/docs/spfx/set-up-your-developer-tenant)
## Solution
Solution|Author(s)
--------|---------
angular-yammer|Joseph Velliah (SPRIDER, @sprider)
## Version history
Version|Date|Comments
-------|----|--------
1.0|March 03, 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`
- `tsd install`
- `gulp serve`
## Features
The Yammer Feed is a sample Client-Side Web Part built on the SharePoint Framework using Angular.
This Web Part illustrates the following concepts on top of the SharePoint Framework:
- using Angular for building SharePoint Framework Client-Side Web Parts
- including Angular in the Web Part bundle
- using non-reactive Web Part Property Pane and custom Properties
- using conditional rendering for one-time Web Part setup
- passing Web Part configuration to Angular and reacting to configuration changes
- display the yammer feed based on configuration changes
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/samples/angular-yammer" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,13 +0,0 @@
{
"entries": [
{
"entry": "./lib/webparts/angularYammer/AngularYammerWebPart.js",
"manifest": "./src/webparts/angularYammer/AngularYammerWebPart.manifest.json",
"outputPath": "./dist/angular-yammer.bundle.js"
}
],
"externals": {},
"localizedResources": {
"angularYammerStrings": "webparts/angularYammer/loc/{locale}.js"
}
}

View File

@ -1,10 +0,0 @@
{
"solution": {
"name": "angular-yammer-client-side-solution",
"id": "f3f740d2-5a08-4e10-8f7c-b64846dc4f23",
"version": "1.0.0.0"
},
"paths": {
"zippedPackage": "solution/angular-yammer.sppkg"
}
}

View File

@ -1,26 +0,0 @@
{
"$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json",
"id": "0d6ed52f-59a5-452e-aeb5-856d59a5105e",
"alias": "AngularYammerWebPart",
"componentType": "WebPart",
"version": "0.0.1",
"manifestVersion": 2,
"preconfiguredEntries": [{
"groupId": "0d6ed52f-59a5-452e-aeb5-856d59a5105e",
"group": { "default": "Under Development" },
"title": { "default": "angular-yammer" },
"description": { "default": "Yammer Feed Add-in" },
"officeFabricIconFontName": "Page",
"properties": {
"network": "domain.com",
"feedType": "group",
"defaultGroupId": 10869974,
"showOpenGraphPreview": false,
"promptText": "Your thoughts?",
"header": false,
"footer": false
}
}]
}

View File

@ -1,101 +0,0 @@
import { Version } from '@microsoft/sp-core-library';
import {
BaseClientSideWebPart,
IPropertyPaneConfiguration,
PropertyPaneTextField,
PropertyPaneToggle,
PropertyPaneSlider,
PropertyPaneDropdown,
IWebPartContext
} from '@microsoft/sp-webpart-base';
import { escape } from '@microsoft/sp-lodash-subset';
import { Environment, EnvironmentType } from '@microsoft/sp-core-library';
import styles from './AngularYammer.module.scss';
import * as strings from 'angularYammerStrings';
import { IAngularYammerWebPartProps } from './IAngularYammerWebPartProps';
import * as angular from 'angular';
export default class AngularYammerWebPart extends BaseClientSideWebPart<IAngularYammerWebPartProps> {
private $injector: angular.auto.IInjectorService;
public render(): void {
if (this.renderedOnce === false) {
require('./app/home.controller.js');
this.domElement.innerHTML = `
<div data-ng-controller="homeController">
<div id="{{yamfeedid}}" style="height:400px;width:100%">
</div>
</div>`;
this.$injector = angular.bootstrap(this.domElement, ['yammerApp']);
}
this.$injector.get('$rootScope').$broadcast('configurationChanged', {
network : escape(this.properties.network),
feedType : escape(this.properties.feedType),
defaultGroupId: this.properties.defaultGroupId,
showOpenGraphPreview: this.properties.showOpenGraphPreview,
promptText: escape(this.properties.promptText),
header: this.properties.header,
footer: this.properties.footer,
environment: Environment.type,
environmentType: EnvironmentType,
domElement: this.domElement
});
}
protected get dataVersion(): Version {
return Version.parse('1.0');
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: [
PropertyPaneTextField('network', {
label: strings.NetworkFieldLabel
}),
PropertyPaneTextField('feedtype', {
label: strings.FeedTypeFieldLabel
}),
PropertyPaneTextField('defaultGroupId', {
label: strings.DefaultGroupIdFieldLabel
}),
PropertyPaneToggle('showOpenGraphPreview', {
label: strings.ShowOpenGraphPreviewFieldLabel,
onText: 'On',
offText: 'Off'
}),
PropertyPaneTextField('promptText', {
label: strings.PromptTextFieldLabel
}),
PropertyPaneToggle('header', {
label: strings.HeaderFieldLabel,
onText: 'On',
offText: 'Off'
}),
PropertyPaneToggle('footer', {
label: strings.FooterFieldLabel,
onText: 'On',
offText: 'Off'
})
]
}
]
}
]
};
}
protected get disableReactivePropertyChanges(): boolean {
return true;
}
}

View File

@ -1,9 +0,0 @@
export interface IAngularYammerWebPartProps {
network: string;
feedType: string;
defaultGroupId: number;
showOpenGraphPreview: boolean;
promptText: string;
header: boolean;
footer: boolean;
}

View File

@ -1,69 +0,0 @@
(function () {
'use strict';
var yammerApp = angular.module('yammerApp', []);
yammerApp.controller('homeController', ['$rootScope', '$scope', '$http', '$location', '$window', homeController]);
function homeController($rootScope, $scope, $http, $location, $window) {
$scope.yamfeedid = 'yamfeed' + generateGuid();
function generateGuid() {
var d = new Date().getTime();
var uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c === "x" ? r : (r & 0x3 | 0x8)).toString(16);
});
return uuid;
};
$rootScope.$on('configurationChanged', function(event, args) {
$scope.network = args.network;
$scope.feedType = args.feedType;
$scope.defaultGroupId = args.defaultGroupId;
$scope.showOpenGraphPreview = args.showOpenGraphPreview;
$scope.promptText = args.promptText;
$scope.header = args.header;
$scope.footer = args.footer;
$scope.environment = args.environment;
$scope.environmentType = args.environmentType;
var currentfeedcontainer = args.domElement.querySelector("#"+$scope.yamfeedid);
var feedparentNode = currentfeedcontainer.parentElement;
if(currentfeedcontainer)
{
currentfeedcontainer.remove();
feedparentNode.innerHTML += '<div id="'+$scope.yamfeedid+'" style="height:400px;width:100%"></div>';
}
$scope.loadFeeds();
});
$scope.loadFeeds = function () {
var feedOptions = {
container: '#'+$scope.yamfeedid,
network: $scope.network,
feedType: $scope.feedtype,
config: {
defaultGroupId: $scope.defaultgroupid,
showOpenGraphPreview: $scope.showopengraphpreview,
promptText: $scope.prompttext,
header: $scope.header,
footer: $scope.footer
}
};
yam.connect.embedFeed(feedOptions);
}
}
})();
!function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="https://s0.assets-yammer.com/assets/",b(0)}([function(a,b,c){c(1),c(2),a.exports=c(3)},function(a,b){"use strict";window.yam=window.yam||{config:function a(b){return Object.keys(b||{}).forEach(function(a){yam._configData[a]=b[a]}),yam._configData},_configData:{}}},function(a,b){"use strict";var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};!function(){function a(a){window.console&&"function"==typeof console.log&&console.log("[yammer] "+a)}function b(a,b,c){a.addEventListener?a.addEventListener(b,c):a.attachEvent("on"+b,function(b){c.call(a,b)})}function d(a){function b(a,e){Object.keys(a||{}).forEach(function(f){if(Object.prototype.hasOwnProperty.call(a,f)){var g=""===e?f:e+"["+f+"]";"object"===c(a[f])?b(a[f],g):d[g]=a[f]}})}var d={};b(a,"");var e=[];return Object.keys(d||{}).forEach(function(a){Object.prototype.hasOwnProperty.call(d,a)&&e.push(encodeURIComponent(a)+"="+encodeURIComponent(d[a]))}),e.join("&")}function e(a){a=a||{};var b=a.style||j,c=document.createElement("iframe");return c.id=a.id,c.name=a.name||a.id,c.frameBorder="none",c.scrolling="no",Object.keys(b||{}).forEach(function(a){Object.prototype.hasOwnProperty.call(b,a)&&(c.style[a]=b[a])}),c.src="javascript://",c}function f(a){var b=a.objectProperties||{};b.url||(b.url=document.location.href,a.objectProperties=b)}function g(b){var c=b||document.body;return"string"==typeof c&&(c=document.querySelector(c)),c?c:void a("Could not find container to embed in")}function h(a){a=a||{};var c=Date.now().toString(),h=g(a.container);if(h){a.feedType&&"open-graph"===a.feedType&&f(a);var i=e({id:"embed-feed"});i.className="yj-embed-widget yj-embed-feed",h.appendChild(i),b(window,"message",function(a){if(a.origin===yam.config().baseURI){var b=JSON.parse(a.data),d=b.data;d&&"yam.trigger"===d.method&&d.uniqueToken===c&&yam.trigger(d.eventId,d.msg)}}),a.network&&(a.network_permalink=a.network),a.bust=c;var j=d(a),k=yam.config().baseURI+"/embed-feed?"+j;i.src=k}}function i(a){a=a||{};var c=Date.now().toString(),h=g(a.container);if(h){f(a);var i=e({id:"embed-button"+k++});i.style.width=h.clientWidth+"px",i.style.height=h.clientHeight+"px",i.className="yj-embed-widget yj-embed-button",h.appendChild(i),b(window,"message",function(a){if(a.origin===yam.config().baseURI){var b=JSON.parse(a.data),d=b.data;d&&d.uniqueToken===c&&("yam.resize"===d.method?(i.style.width=d.width+"px",i.style.height=d.height+"px"):"yam.trigger"===d.method&&yam.trigger(d.eventId,d.msg))}}),a.bust=c;var j=d(a);i.src=yam.config().baseURI+"/platform_embed/button?"+j}}var j={border:"0px",overflow:"hidden","min-height":"26px",width:"100%",height:"100%"},k=0;if("function"!=typeof yam.on){var l={},m=function a(b,c){var d=l[b];if(d)for(var e=0,f=d.length;e<f;e++){var g=d[e];g.fn.apply(g.ctx,c)}};yam.trigger=function(a){var b=[].slice.call(arguments,1);m(a,b),m("all",arguments)},yam.on=function(a,b,c){l[a]||(l[a]=[]),l[a].push({fn:b,ctx:c||null})},yam.off=function(a,b,c){var d=l[a];if(c=c||null,d){for(var e=-1,f=0,g=d.length;f<g&&e===-1;f++)d[f].fn===b&&d[f].ctx===c&&(e=f);e!==-1&&d.splice(e,1)}}}yam.connect=yam.connect||{},yam.connect.actionButton=i,yam.connect.embedFeed=h}()},function(a,b,c){var d;d=function(a){var b=c(4);yam.config(b)}.call(b,c,b,a),!(void 0!==d&&(a.exports=d))},function(a,b){a.exports={assetHost:"https://s0.assets-yammer.com",cdnAssetHost:"https://s0.assets-yammer.com",mugshotHost:"https://www.yammer.com/mugshot",cdnMugshotHost:"https://mug0.assets-yammer.com/mugshot",polarisHost:"https://polaris.yammer.com/",baseURI:"https://www.yammer.com",apiBaseURI:"https://api.yammer.com",videoStreamingUri:"rtmpt://s1fqyiixzut1oy.cloudfront.net:80/cfx/st",reportAuthorizationHeader:"Receiver MTosLDIzQTBEMTA1LTM4RUItNDcyMS05RTM2LTQxNEY5QUI1RTQ3MyA=",reportPerfRequestUri:"https://receiver.yamalytics.yammer.com/prod/web_ui",filesHost:"https://files.yammer.com/v2/files",paddieHost:"https://pad0.assets-yammer.com",msgraphUri:"https://msgraph.yammer.com",yammer_environment:"production"}}]);

View File

@ -1,13 +0,0 @@
define([], function() {
return {
"PropertyPaneDescription": "Settings",
"BasicGroupName": "Personalization",
"NetworkFieldLabel": "Network",
"FeedTypeFieldLabel": "Feed Type",
"DefaultGroupIdFieldLabel": "Default Group Id",
"ShowOpenGraphPreviewFieldLabel": "Show Open Graph Preview",
"PromptTextFieldLabel": "Prompt Text",
"HeaderFieldLabel": "Header",
"FooterFieldLabel": "Footer"
}
});

View File

@ -1,16 +0,0 @@
declare interface IAngularYammerStrings {
PropertyPaneDescription: string;
BasicGroupName: string;
NetworkFieldLabel: string;
FeedTypeFieldLabel: string;
DefaultGroupIdFieldLabel: string;
ShowOpenGraphPreviewFieldLabel: string;
PromptTextFieldLabel: string;
HeaderFieldLabel: string;
FooterFieldLabel: string;
}
declare module 'angularYammerStrings' {
const strings: IAngularYammerStrings;
export = strings;
}

View File

@ -1,8 +1,8 @@
# Angular2 Web Part Prototype
# Angular2 Web Part Prototype
## Note to developers
> This web part sample is currently in prototype phase and subject to change.
This sample is not currently supported for use in production enviornments as unexpected behavior may occur.
This sample is not currently supported for use in production environments as unexpected behavior may occur.
It is provided as guidance for building Angular2 web parts in the SharePoint Framework environment.
This sample is a work in progress and it will be updated as advances in stability are made.

View File

@ -0,0 +1,3 @@
{
"rulesDirectory": "./config"
}

View File

@ -0,0 +1,3 @@
{
"rulesDirectory": "./config"
}

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