parent
1f17c07a14
commit
9d8044c7d7
|
@ -0,0 +1,2 @@
|
|||
[0206/115652:ERROR:tcp_listen_socket.cc(76)] Could not bind socket to 127.0.0.1:6004
|
||||
[0206/115652:ERROR:node_debugger.cc(86)] Cannot start debugger server
|
|
@ -0,0 +1,25 @@
|
|||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
|
||||
[*]
|
||||
|
||||
# change these settings to your own preference
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# we recommend you to keep these unchanged
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[{package,bower}.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
|
@ -0,0 +1 @@
|
|||
* text=auto
|
|
@ -0,0 +1,32 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
|
||||
# Dependency directories
|
||||
node_modules
|
||||
|
||||
# Build generated files
|
||||
dist
|
||||
lib
|
||||
solution
|
||||
temp
|
||||
*.sppkg
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# OSX
|
||||
.DS_Store
|
||||
|
||||
# Visual Studio files
|
||||
.ntvs_analysis.dat
|
||||
.vs
|
||||
bin
|
||||
obj
|
||||
|
||||
# Resx Generated Code
|
||||
*.resx.ts
|
||||
|
||||
# Styles Generated Code
|
||||
*.scss.ts
|
|
@ -0,0 +1,14 @@
|
|||
# Folders
|
||||
.vscode
|
||||
coverage
|
||||
node_modules
|
||||
sharepoint
|
||||
src
|
||||
temp
|
||||
|
||||
# Files
|
||||
*.csproj
|
||||
.git*
|
||||
.yo-rc.json
|
||||
gulpfile.js
|
||||
tsconfig.json
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"@microsoft/generator-sharepoint": {
|
||||
"libraryName": "angular-graph-rc",
|
||||
"libraryId": "0e824f74-7ed5-4612-9e01-64b25af579fe",
|
||||
"framework": "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
## 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.
|
||||
|
||||
![First Screen](./assets/Connect.png)
|
||||
|
||||
![Logged In](./assets/Connected.png)
|
||||
|
||||
![Root Site Collection](./assets/Root.png)
|
||||
|
||||
![Lists in Root Site](./assets/Lists.png)
|
||||
|
||||
![Announcement List Items](./assets/Items.png)
|
||||
|
||||
|
||||
> 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-rc0-green.svg)
|
||||
|
||||
## Applies to
|
||||
|
||||
* [SharePoint Framework Developer Preview](http://dev.office.com/sharepoint/docs/spfx/sharepoint-framework-overview)
|
||||
* [Office 365 developer tenant](http://dev.office.com/sharepoint/docs/spfx/set-up-your-developer-tenant)
|
||||
|
||||
## Solution
|
||||
|
||||
Solution|Author(s)
|
||||
--------|---------
|
||||
angular-msgraph-rc|David Hartman ([Slalom](https://slalom.com))
|
||||
|
||||
## Version history
|
||||
|
||||
Version|Date|Comments
|
||||
-------|----|--------
|
||||
1.0|February 6th, 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.**
|
||||
|
||||
---
|
||||
|
||||
## Configuration Bliss
|
||||
- clone this repo
|
||||
- in the command line run:
|
||||
- `npm i typings -g`
|
||||
- `npm i`
|
||||
- `gulp serve
|
||||
|
||||
## Register the application
|
||||
|
||||
1. Sign into the [App Registration Portal](https://apps.dev.microsoft.com/) using either your personal or work or school account.
|
||||
|
||||
2. Choose **Add an app**.
|
||||
|
||||
3. Enter a name for the app, and choose **Create application**.
|
||||
|
||||
The registration page displays, listing the properties of your app.
|
||||
|
||||
4. Copy the Application Id. This is the unique identifier for your app.
|
||||
|
||||
5. Under **Platforms**, choose **Add Platform**.
|
||||
|
||||
6. Choose **Web**.
|
||||
|
||||
7. Make sure the **Allow Implicit Flow** check box is selected, and enter *http://{Location of SP Workbench}* as the Redirect URI.
|
||||
|
||||
8. Choose **Save**.
|
||||
|
||||
## Configuring the App
|
||||
1. Replace the **aad** and **redirect_uri** placeholder values with the application ID and redirect url of your registered Azure application in the GraphHelper.ts file Under
|
||||
src -> angularMsGraph -> GraphHelper.ts
|
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"entries": [
|
||||
{
|
||||
"entry": "./lib/webparts/angularMsGraph/AngularMsGraphWebPart.js",
|
||||
"manifest": "./src/webparts/angularMsGraph/AngularMsGraphWebPart.manifest.json",
|
||||
"outputPath": "./dist/angular-ms-graph.bundle.js"
|
||||
}
|
||||
],
|
||||
"externals": {},
|
||||
"localizedResources": {
|
||||
"angularMsGraphStrings": "webparts/angularMsGraph/loc/{locale}.js"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"workingDir": "./temp/deploy/",
|
||||
"account": "<!-- STORAGE ACCOUNT NAME -->",
|
||||
"container": "angular-graph-rc",
|
||||
"accessKey": "<!-- ACCESS KEY -->"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"solution": {
|
||||
"name": "angular-graph-rc-client-side-solution",
|
||||
"id": "0e824f74-7ed5-4612-9e01-64b25af579fe",
|
||||
"version": "1.0.0.0"
|
||||
},
|
||||
"paths": {
|
||||
"zippedPackage": "solution/angular-graph-rc.sppkg"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"deployCdnPath": "temp/deploy"
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"port": 4321,
|
||||
"initialPage": "https://localhost:5432/workbench",
|
||||
"https": true,
|
||||
"api": {
|
||||
"port": 5432,
|
||||
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
// Display errors as warnings
|
||||
"displayAsWarning": true,
|
||||
// The TSLint task may have been configured with several custom lint rules
|
||||
// before this config file is read (for example lint rules from the tslint-microsoft-contrib
|
||||
// project). If true, this flag will deactivate any of these rules.
|
||||
"removeExistingRules": true,
|
||||
// When true, the TSLint task is configured with some default TSLint "rules.":
|
||||
"useDefaultConfigAsBase": false,
|
||||
// Since removeExistingRules=true and useDefaultConfigAsBase=false, there will be no lint rules
|
||||
// which are active, other than the list of rules below.
|
||||
"lintConfig": {
|
||||
// Opt-in to Lint rules which help to eliminate bugs in JavaScript
|
||||
"rules": {
|
||||
"class-name": false,
|
||||
"export-name": false,
|
||||
"forin": false,
|
||||
"label-position": false,
|
||||
"label-undefined": false,
|
||||
"member-access": true,
|
||||
"no-arg": false,
|
||||
"no-console": false,
|
||||
"no-construct": false,
|
||||
"no-duplicate-case": true,
|
||||
"no-duplicate-key": false,
|
||||
"no-duplicate-variable": true,
|
||||
"no-eval": false,
|
||||
"no-function-expression": true,
|
||||
"no-internal-module": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-unnecessary-semicolons": true,
|
||||
"no-unused-expression": true,
|
||||
"no-unused-imports": true,
|
||||
"no-unused-variable": true,
|
||||
"no-unreachable": true,
|
||||
"no-use-before-declare": true,
|
||||
"no-with-statement": true,
|
||||
"semicolon": true,
|
||||
"trailing-comma": false,
|
||||
"typedef": false,
|
||||
"typedef-whitespace": false,
|
||||
"use-named-parameter": true,
|
||||
"valid-typeof": true,
|
||||
"variable-name": false,
|
||||
"whitespace": false,
|
||||
"prefer-const": true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"cdnBasePath": "<!-- PATH TO CDN -->"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const gulp = require('gulp');
|
||||
const build = require('@microsoft/sp-build-web');
|
||||
|
||||
build.initialize(gulp);
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"name": "angular-graph-rc",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/sp-client-base": "~0.7.0",
|
||||
"@microsoft/sp-client-preview": "~0.9.0",
|
||||
"@microsoft/sp-core-library": "~0.1.2",
|
||||
"@microsoft/sp-webpart-base": "~0.4.0",
|
||||
"@types/angular": "^1.6.4",
|
||||
"@types/hellojs": "^0.2.31",
|
||||
"@types/webpack-env": ">=1.12.1 <1.14.0",
|
||||
"angular": "^1.5.10",
|
||||
"hellojs": "^1.14.0",
|
||||
"ng-office-ui-fabric": "^0.13.2",
|
||||
"typescript": "^2.1.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@microsoft/sp-build-web": "~0.9.0",
|
||||
"@microsoft/sp-module-interfaces": "~0.7.0",
|
||||
"@microsoft/sp-webpart-workbench": "~0.8.0",
|
||||
"gulp": "~3.9.1",
|
||||
"@types/chai": ">=3.4.34 <3.6.0",
|
||||
"@types/mocha": ">=2.2.33 <2.6.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "gulp bundle",
|
||||
"clean": "gulp clean",
|
||||
"test": "gulp test"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
var context = require.context('.', true, /.+\.test\.js?$/);
|
||||
|
||||
context.keys().forEach(context);
|
||||
|
||||
module.exports = context;
|
|
@ -0,0 +1,39 @@
|
|||
@import "~/office-ui-fabric-react/dist/sass/Fabric.Common";
|
||||
|
||||
.row {
|
||||
@include ms-Grid-row;
|
||||
@include ms-bgColor-themeDark;
|
||||
@include ms-fontColor-white;
|
||||
|
||||
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
|
||||
max-width: 700px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.column {
|
||||
@include ms-Grid-col;
|
||||
@include ms-u-lg10;
|
||||
@include ms-u-xl8;
|
||||
@include ms-u-lgPush1;
|
||||
@include ms-u-xlPush2;
|
||||
}
|
||||
|
||||
.title {
|
||||
@include ms-font-xl;
|
||||
@include ms-fontColor-white;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
@include ms-font-l;
|
||||
@include ms-fontColor-white;
|
||||
}
|
||||
|
||||
.description {
|
||||
@include ms-font-l;
|
||||
@include ms-fontColor-white;
|
||||
}
|
||||
|
||||
.button {
|
||||
text-decoration: none;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json",
|
||||
|
||||
"id": "28f73bab-e0d2-48b4-8611-c1187765331c",
|
||||
"alias": "AngularMsGraphWebPart",
|
||||
"componentType": "WebPart",
|
||||
"version": "0.0.1",
|
||||
"manifestVersion": 2,
|
||||
|
||||
"preconfiguredEntries": [{
|
||||
"groupId": "28f73bab-e0d2-48b4-8611-c1187765331c",
|
||||
"group": { "default": "Under Development" },
|
||||
"title": { "default": "AngularMSGraph" },
|
||||
"description": { "default": "AngularMSGraph description" },
|
||||
"officeFabricIconFontName": "Page",
|
||||
"properties": {
|
||||
"description": "AngularMSGraph"
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
import { Version } from '@microsoft/sp-core-library';
|
||||
import {
|
||||
BaseClientSideWebPart,
|
||||
IPropertyPaneConfiguration,
|
||||
PropertyPaneTextField,
|
||||
IWebPartContext,
|
||||
} from '@microsoft/sp-webpart-base';
|
||||
import { SPComponentLoader } from '@microsoft/sp-loader';
|
||||
import { escape } from '@microsoft/sp-lodash-subset';
|
||||
|
||||
import styles from './AngularMsGraph.module.scss';
|
||||
import * as strings from 'angularMsGraphStrings';
|
||||
import { IAngularMsGraphWebPartProps } from './IAngularMsGraphWebPartProps';
|
||||
|
||||
import * as angular from 'angular';
|
||||
import 'ng-office-ui-fabric';
|
||||
import 'hellojs';
|
||||
import './app/aad';
|
||||
import './app/app.module';
|
||||
|
||||
export default class AngularMsGraphWebPart extends BaseClientSideWebPart<IAngularMsGraphWebPartProps> {
|
||||
private $injector: angular.auto.IInjectorService;
|
||||
|
||||
public constructor(context: IWebPartContext) {
|
||||
super();
|
||||
|
||||
SPComponentLoader.loadCss('https://appsforoffice.microsoft.com/fabric/2.6.1/fabric.min.css');
|
||||
SPComponentLoader.loadCss('https://appsforoffice.microsoft.com/fabric/2.6.1/fabric.components.min.css');
|
||||
}
|
||||
|
||||
public render(): void {
|
||||
if (this.renderedOnce === false) {
|
||||
this.domElement.innerHTML = `<angulargraphapi></angulargraphapi>`;
|
||||
this.$injector = angular.bootstrap(this.domElement, ['angularconnectsp']);
|
||||
}
|
||||
}
|
||||
|
||||
protected get dataVersion(): Version {
|
||||
return Version.parse('1.0');
|
||||
}
|
||||
|
||||
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
|
||||
return {
|
||||
pages: [
|
||||
{
|
||||
header: {
|
||||
description: strings.PropertyPaneDescription
|
||||
},
|
||||
groups: [
|
||||
{
|
||||
groupName: strings.BasicGroupName,
|
||||
groupFields: [
|
||||
PropertyPaneTextField('description', {
|
||||
label: strings.DescriptionFieldLabel
|
||||
})
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
export interface IAngularMsGraphWebPartProps {
|
||||
description: string;
|
||||
}
|
|
@ -0,0 +1,190 @@
|
|||
import { ISiteCollections } from './../models/ISiteCollections';
|
||||
import { IListCollection } from './../models/IListCollection';
|
||||
import { IGenericAnnouncementItem } from './../models/IGenericAnnouncementItem';
|
||||
import { IAnnouncements } from './../models/IAnnouncements';
|
||||
import { IGenericCreateItem } from './../models/IGenericCreateItem';
|
||||
|
||||
export interface IGraphHelper {
|
||||
login(): void;
|
||||
logout(): void;
|
||||
me(): ng.IPromise<Object>;
|
||||
getSites(): ng.IPromise<Array<ISiteCollections>>;
|
||||
getLists(siteId: string): ng.IPromise<Array<IListCollection>>;
|
||||
getListItems(siteId: string, listId: string): ng.IPromise<Array<IAnnouncements>>;
|
||||
createItem(siteId: string, listId: string): ng.IPromise<IGenericCreateItem>;
|
||||
updateItem(siteId: string, listId: string, item: IGenericCreateItem, title: string): ng.IPromise<Object>;
|
||||
deleteItem(siteId: string, listId: string, item: IGenericCreateItem): ng.IPromise<Object>;
|
||||
}
|
||||
|
||||
export default class GraphHelper implements IGraphHelper {
|
||||
public static $inject: string[] = ['$q', '$http', '$log'];
|
||||
public hello: any = require('hellojs');
|
||||
|
||||
constructor(private $q: ng.IQService, private $http: ng.IHttpService, private $log: ng.ILogService) {
|
||||
this.hello.init({
|
||||
aad: '119906a0-9ad3-45d9-90c4-4263450f7ca3'
|
||||
}, {
|
||||
redirect_uri: 'https://localhost:4321/temp/workbench.html',
|
||||
scope: 'user.read sites.read.all sites.readwrite.all'
|
||||
});
|
||||
}
|
||||
|
||||
public login(): void {
|
||||
this.hello('aad').login({
|
||||
display: 'page',
|
||||
response_type: 'token'
|
||||
});
|
||||
}
|
||||
|
||||
public logout(): void {
|
||||
this.hello('aad').logout();
|
||||
localStorage.removeItem('auth');
|
||||
localStorage.removeItem('user');
|
||||
}
|
||||
|
||||
public me(): ng.IPromise<Object> {
|
||||
return this.$http.get('https://graph.microsoft.com/v1.0/me');
|
||||
}
|
||||
|
||||
public getSites(): ng.IPromise<Array<ISiteCollections>> {
|
||||
const deferred: ng.IDeferred<Array<ISiteCollections>> = this.$q.defer();
|
||||
|
||||
this.$http.get('https://graph.microsoft.com/beta/sharePoint/sites')
|
||||
.then((response: ng.IHttpPromiseCallbackArg<any>): void => {
|
||||
if (response != null && response.data != null) {
|
||||
const result: Array<ISiteCollections> = response.data.value;
|
||||
deferred.resolve(result);
|
||||
}
|
||||
else {
|
||||
deferred.reject("problem getting Root Site Collection");
|
||||
}
|
||||
}, (error: any): void => {
|
||||
this.$log.error(error);
|
||||
deferred.reject(error);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
public getLists(siteId: string): ng.IPromise<Array<IListCollection>> {
|
||||
const deferred: ng.IDeferred<Array<IListCollection>> = this.$q.defer();
|
||||
|
||||
this.$http.get(`https://graph.microsoft.com/beta/sharePoint/sites/${siteId}/lists?filter=list/hidden eq false`)
|
||||
.then((response: ng.IHttpPromiseCallbackArg<any>): void => {
|
||||
if (response != null && response.data != null) {
|
||||
const result: Array<IListCollection> = response.data.value;
|
||||
deferred.resolve(result);
|
||||
}
|
||||
else {
|
||||
deferred.reject("problem getting site lists");
|
||||
}
|
||||
}, (error: any): void => {
|
||||
this.$log.error(error);
|
||||
deferred.reject(error);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
public getListItems(siteId: string, listId: string): ng.IPromise<Array<IAnnouncements>> {
|
||||
const deferred: ng.IDeferred<Array<IAnnouncements>> = this.$q.defer();
|
||||
|
||||
this.$http.get(`https://graph.microsoft.com/beta/sharePoint/sites/${siteId}/lists/${listId}/items?expand=columnSet`)
|
||||
.then((response: ng.IHttpPromiseCallbackArg<any>): void => {
|
||||
if (response != null && response.data != null) {
|
||||
const result: Array<IGenericAnnouncementItem> = response.data.value;
|
||||
let itemCollection: Array<IAnnouncements> = new Array<IAnnouncements>();
|
||||
|
||||
result.forEach((item: IGenericAnnouncementItem) => {
|
||||
itemCollection.push(item.columnSet);
|
||||
});
|
||||
deferred.resolve(itemCollection);
|
||||
}
|
||||
else {
|
||||
deferred.reject("problem getting list items");
|
||||
}
|
||||
}, (error: any): void => {
|
||||
this.$log.error(error);
|
||||
deferred.reject(error);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
public createItem(siteId: string, listId: string): ng.IPromise<IGenericCreateItem> {
|
||||
const deferred: ng.IDeferred<IGenericCreateItem> = this.$q.defer();
|
||||
const config: ng.IRequestShortcutConfig = {
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
};
|
||||
|
||||
this.$http.post(
|
||||
`https://graph.microsoft.com/beta/sharePoint/sites/${siteId}/lists/${listId}/items`, '{}', config)
|
||||
.then((response: ng.IHttpPromiseCallbackArg<any>): void => {
|
||||
if (response != null && response.data != null) {
|
||||
const result: IGenericCreateItem = response.data;
|
||||
this.$log.debug(result);
|
||||
deferred.resolve(result);
|
||||
}
|
||||
else {
|
||||
deferred.reject("problem creating the item");
|
||||
}
|
||||
}, (error: any): void => {
|
||||
this.$log.error(error);
|
||||
deferred.reject(error);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
public updateItem(siteId: string, listId: string, item: IGenericCreateItem, title:string): ng.IPromise<Object> {
|
||||
const deferred: ng.IDeferred<Object> = this.$q.defer();
|
||||
const config: ng.IRequestShortcutConfig = {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"if-match": item.eTag
|
||||
}
|
||||
};
|
||||
const data: IAnnouncements = {
|
||||
id: item.listItemId,
|
||||
Title: title
|
||||
};
|
||||
|
||||
this.$http.patch(
|
||||
`https://graph.microsoft.com/beta/sharePoint/sites/${siteId}/lists/${listId}/items/${item.id}/columnSet`,
|
||||
data, config).then((response: ng.IHttpPromiseCallbackArg<any>): void => {
|
||||
if (response != null && response.status == 200) {
|
||||
deferred.resolve("OK");
|
||||
}
|
||||
}, (error: any): void => {
|
||||
this.$log.error(error);
|
||||
deferred.reject(error);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
public deleteItem(siteId: string, listId: string, item: IGenericCreateItem): ng.IPromise<Object> {
|
||||
const deferred: ng.IDeferred<Object> = this.$q.defer();
|
||||
const config: ng.IRequestShortcutConfig = {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"if-match": item.eTag
|
||||
}
|
||||
};
|
||||
|
||||
this.$http.delete(
|
||||
`https://graph.microsoft.com/beta/sharePoint/sites/${siteId}/lists/${listId}/items/${item.id}`,
|
||||
config).then((response: ng.IHttpPromiseCallbackArg<any>): void => {
|
||||
if (response != null && response.status == 204){
|
||||
deferred.resolve("OK");
|
||||
}
|
||||
}, (error: any): void => {
|
||||
this.$log.error(error);
|
||||
deferred.reject(error);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,183 @@
|
|||
import * as angular from 'angular';
|
||||
import { IGraphHelper } from './GraphHelper';
|
||||
import { ISiteCollections } from './../models/ISiteCollections';
|
||||
import { IListCollection } from './../models/IListCollection';
|
||||
import { IAnnouncements } from './../models/IAnnouncements';
|
||||
import { IGenericCreateItem } from './../models/IGenericCreateItem';
|
||||
|
||||
export default class HomeController {
|
||||
public static $inject: string[] = ['$rootScope', '$scope', '$http', 'GraphHelper', '$log'];
|
||||
public hello: any = require('hellojs');
|
||||
|
||||
// public variables
|
||||
public displayName: string;
|
||||
public vwSC: boolean = false;
|
||||
public vwLsts: boolean = false;
|
||||
public vwLstItm: boolean = false;
|
||||
public vwCreateItem: boolean = false;
|
||||
public siteCollection: Array<ISiteCollections>;
|
||||
public listCollection: Array<IListCollection>;
|
||||
public itemCollection: Array<IAnnouncements>;
|
||||
public createItemTitle: string;
|
||||
|
||||
// private variables
|
||||
private _siteId: string;
|
||||
private _listId: string;
|
||||
|
||||
constructor(private $rootScope: angular.IRootScopeService, private $scope: angular.IScope,
|
||||
private $http: angular.IHttpService, private graphHelper: IGraphHelper, private $log: angular.ILogService){
|
||||
this._initAuth();
|
||||
}
|
||||
|
||||
private _initAuth(): void {
|
||||
if (localStorage.getItem('auth')){
|
||||
this._processAuth();
|
||||
}
|
||||
else {
|
||||
let auth: any = this.hello('aad').getAuthResponse();
|
||||
if (auth != null){
|
||||
localStorage.setItem('auth', angular.toJson(auth));
|
||||
this._processAuth();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private _processAuth(){
|
||||
let auth: any = angular.fromJson(localStorage.getItem('auth'));
|
||||
|
||||
let expiration: Date = new Date();
|
||||
expiration.setTime((auth.expires - 300) * 1000);
|
||||
if (expiration > new Date()){
|
||||
this.$http.defaults.headers.common.Authorization = 'Bearer ' + auth.access_token;
|
||||
this.$http.defaults.headers.common.SampleID = 'angular-connect-rest-sharepoint';
|
||||
|
||||
if (localStorage.getItem('user') === null){
|
||||
this.graphHelper.me().then((results: any): void => {
|
||||
let user = results.data;
|
||||
localStorage.setItem('user', angular.toJson(user));
|
||||
|
||||
this.displayName = user.displayName;
|
||||
});
|
||||
}
|
||||
else {
|
||||
let user = angular.fromJson(localStorage.getItem('user'));
|
||||
|
||||
this.displayName = user.displayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public isAuthenticated(): boolean {
|
||||
return localStorage.getItem('user') !== null;
|
||||
}
|
||||
|
||||
public login(): void {
|
||||
this.graphHelper.login();
|
||||
}
|
||||
|
||||
public logout(): void {
|
||||
this.graphHelper.logout();
|
||||
}
|
||||
|
||||
// Get's SharePoint's Root Site Collection for now
|
||||
// until Microsoft Graph is updated. Then it will be a list of sites
|
||||
public getSites(): void {
|
||||
// Check token expiry. If the token is valid for another 5 minutes, we'll use it.
|
||||
let auth: any = angular.fromJson(localStorage.getItem('auth'));
|
||||
let expiration: Date = new Date();
|
||||
expiration.setTime((auth.expires - 300) * 1000);
|
||||
|
||||
if (expiration > new Date()){
|
||||
this.graphHelper.getSites().then((results: Array<ISiteCollections>): void => {
|
||||
this.$log.debug(results);
|
||||
this.vwSC = true;
|
||||
this.siteCollection = results;
|
||||
});
|
||||
}
|
||||
else {
|
||||
// If the token is expired, this sample just redirects the user to sign in.
|
||||
this.graphHelper.login();
|
||||
}
|
||||
}
|
||||
|
||||
public getLists(siteId: string): void {
|
||||
let auth: any = angular.fromJson(localStorage.getItem('auth'));
|
||||
let expiration: Date = new Date();
|
||||
expiration.setTime((auth.expires - 300) * 1000);
|
||||
|
||||
if (expiration > new Date()){
|
||||
this.graphHelper.getLists(siteId).then((results: Array<IListCollection>): void => {
|
||||
this.$log.debug(results);
|
||||
this.vwSC = false;
|
||||
this.vwLsts = true;
|
||||
this.listCollection = results;
|
||||
this._siteId = siteId;
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.graphHelper.login();
|
||||
}
|
||||
}
|
||||
|
||||
public getListItems(listId: string): void {
|
||||
let auth: any = angular.fromJson(localStorage.getItem('auth'));
|
||||
let expiration: Date = new Date();
|
||||
expiration.setTime((auth.expires - 300) * 1000);
|
||||
|
||||
if (expiration > new Date()){
|
||||
this.graphHelper.getListItems(this._siteId, listId).then((results: Array<IAnnouncements>): void => {
|
||||
this.$log.debug(results);
|
||||
this.vwLsts = false;
|
||||
this.vwLstItm = true;
|
||||
this.itemCollection = results;
|
||||
this._listId = listId;
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.graphHelper.login();
|
||||
}
|
||||
}
|
||||
|
||||
public showCreateItemForm(): void {
|
||||
this.vwLstItm = false;
|
||||
this.vwCreateItem = true;
|
||||
}
|
||||
|
||||
public createItem(): void {
|
||||
let auth: any = angular.fromJson(localStorage.getItem('auth'));
|
||||
let expiration: Date = new Date();
|
||||
expiration.setTime((auth.expires - 300) * 1000);
|
||||
|
||||
if (expiration > new Date()){
|
||||
this.graphHelper.createItem(this._siteId, this._listId).then((result: IGenericCreateItem): void => {
|
||||
this.$log.debug(result);
|
||||
this.graphHelper.updateItem(this._siteId, this._listId, result, this.createItemTitle)
|
||||
.then((result: any): void => {
|
||||
// item create was successfull so navigate back to list item view
|
||||
this.getListItems(this._listId);
|
||||
this.vwCreateItem = false;
|
||||
this.vwLstItm = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.graphHelper.login();
|
||||
}
|
||||
}
|
||||
|
||||
public deleteItem(item: IGenericCreateItem): void {
|
||||
let auth: any = angular.fromJson(localStorage.getItem('auth'));
|
||||
let expiration: Date = new Date();
|
||||
expiration.setTime((auth.expires - 300) * 1000);
|
||||
|
||||
if (expiration > new Date()){
|
||||
this.graphHelper.deleteItem(this._siteId, this._listId, item).then((result: any): void => {
|
||||
// delete item was successful so refresh the list items
|
||||
this.getListItems(this._listId);
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.graphHelper.login();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
let hello = require('hellojs');
|
||||
|
||||
hello.init({
|
||||
|
||||
aad: {
|
||||
name: 'Azure Active Directory',
|
||||
oauth: {
|
||||
version: 2,
|
||||
auth: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
|
||||
grant: 'https://login.microsoftonline.com/common/oauth2/v2.0/token'
|
||||
},
|
||||
scope_delim: ' ',
|
||||
form: false
|
||||
}
|
||||
});
|
||||
|
||||
hello.on('auth.login', function (auth){
|
||||
localStorage.auth = angular.toJson(auth.authResponse);
|
||||
});
|
|
@ -0,0 +1,13 @@
|
|||
import * as angular from 'angular';
|
||||
import HomeController from './HomeController';
|
||||
import GraphHelper from './GraphHelper';
|
||||
angular
|
||||
.module('angularconnectsp', [
|
||||
'officeuifabric.core',
|
||||
'officeuifabric.components'])
|
||||
.component('angulargraphapi', {
|
||||
controller: HomeController,
|
||||
controllerAs: 'vm',
|
||||
template: require('./home-template.html').toString()
|
||||
})
|
||||
.service('GraphHelper', GraphHelper);
|
|
@ -0,0 +1,99 @@
|
|||
<div class="ms-Grid">
|
||||
<div>
|
||||
<div class="ms-Grid-row">
|
||||
<div class="ms-NavBar">
|
||||
<ul class="ms-NavBar-items">
|
||||
<li class="navbar-header">Microsoft Graph Connect SharePoint</li>
|
||||
<li class="ms-NavBar-item ms-NavBar-item--right" ng-show="vm.isAuthenticated()" ng-click="vm.logout()">
|
||||
<i class="ms-Icon ms-Icon--x"></i> Disconnect
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="ms-Grid-col ms-u-md-Push1 ms-u-md11 ms-u-lgPush1 ms-u-lg11">
|
||||
<div ng-hide="vm.isAuthenticated()">
|
||||
<p class="ms-font-xl">Use the button below to connect to Microsoft Graph.</p>
|
||||
<button class="ms-Button" ng-click="vm.login()">
|
||||
<span class="ms-Button-label">Connect</span>
|
||||
</button>
|
||||
</div>
|
||||
<div ng-show="vm.isAuthenticated()">
|
||||
<h2 class="ms-font-xxl ms-fontWeight-semibold">Hi, {{ vm.displayName }}!</h2>
|
||||
<p class="ms-font-xl">You're now connected to Microsoft Graph. Click the button below to display you're root site collection using the Microsoft Graph API.</p>
|
||||
<button class="ms-Button" ng-click="vm.getSites()" ng-show="vm.isAuthenticated() && !vm.vwSC && !vm.vwLsts && !vm.vwLstItm && !vm.vwCreateItem">
|
||||
<span class="ms-Button-label">Get SharePoint Site</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ms-Grid-row">
|
||||
<div class="ms-Grid-col ms-u-md12">
|
||||
<div ng-show="vm.isAuthenticated() && vm.vwSC">
|
||||
<uif-table>
|
||||
<uif-table-head>
|
||||
<uif-table-row>
|
||||
<uif-table-header>Site Id</uif-table-header>
|
||||
<uif-table-header>Site Name</uif-table-header>
|
||||
<uif-table-header>Site Url</uif-table-header>
|
||||
<uif-table-header>Actions</uif-table-header>
|
||||
</uif-table-row>
|
||||
</uif-table-head>
|
||||
<uif-table-body>
|
||||
<uif-table-row ng-repeat="s in vm.siteCollection">
|
||||
<uif-table-cell>{{s.siteId}}</uif-table-cell>
|
||||
<uif-table-cell>{{s.name == '' ? 'Root SC' : s.name}}</uif-table-cell>
|
||||
<uif-table-cell>{{s.webUrl}}</uif-table-cell>
|
||||
<uif-table-cell><uif-button uif-type="primary" ng-click="vm.getLists(s.id)">Lists</uif-button></uif-table-cell>
|
||||
</uif-table-row>
|
||||
</uif-table-body>
|
||||
</uif-table>
|
||||
</div>
|
||||
<div ng-show="vm.isAuthenticated() && vm.vwLsts">
|
||||
<uif-table>
|
||||
<uif-table-head>
|
||||
<uif-table-row>
|
||||
<uif-table-header>List Name</uif-table-header>
|
||||
<uif-table-header>List Url </uif-table-header>
|
||||
<uif-table-header></uif-table-header>
|
||||
</uif-table-row>
|
||||
</uif-table-head>
|
||||
<uif-table-body>
|
||||
<uif-table-row ng-repeat="l in vm.listCollection">
|
||||
<uif-table-cell>{{l.name}}</uif-table-cell>
|
||||
<uif-table-cell>{{l.webUrl}}</uif-table-cell>
|
||||
<uif-table-cell><uif-button uif-type="primary" ng-click="vm.getListItems(l.id)">Items</uif-button></uif-table-cell>
|
||||
</uif-table-row>
|
||||
</uif-table-body>
|
||||
</uif-table>
|
||||
</div>
|
||||
<div ng-show="vm.isAuthenticated() && vm.vwLstItm">
|
||||
<uif-button uif-type="primary" ng-click="vm.showCreateItemForm()">New Item Form</uif-button>
|
||||
<uif-table>
|
||||
<uif-table-head>
|
||||
<uif-table-row>
|
||||
<uif-table-header>id</uif-table-header>
|
||||
<uif-table-header>Title</uif-table-header>
|
||||
<uif-table-header>Author</uif-table-header>
|
||||
<uif-table-header></uif-table-header>
|
||||
</uif-table-row>
|
||||
</uif-table-head>
|
||||
<uif-table-body>
|
||||
<uif-table-row ng-repeat="i in vm.itemCollection">
|
||||
<uif-table-cell>{{i.id}}</uif-table-cell>
|
||||
<uif-table-cell>{{i.Title}}</uif-table-cell>
|
||||
<uif-table-cell>{{i.Author}}</uif-table-cell>
|
||||
<uif-table-cell><uif-button uif-type="hero" ng-click="vm.deleteItem(i)"><uif-icon uif-type="x"></uif-icon> Delete</uif-button></uif-table-cell>
|
||||
</uif-table-row>
|
||||
</uif-table-body>
|
||||
</uif-table>
|
||||
</div>
|
||||
<div ng-show="vm.isAuthenticated() && vm.vwCreateItem">
|
||||
<div class="ms-TextField">
|
||||
<label for="itemTitle" class="ms-label">Title</label>
|
||||
<input id="itemTitle" ng-model="vm.createItemTitle" class="ms-TextField-field">
|
||||
</div>
|
||||
<uif-button uif-type="primary" ng-click="vm.createItem()">Create</uif-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,7 @@
|
|||
define([], function() {
|
||||
return {
|
||||
"PropertyPaneDescription": "Description",
|
||||
"BasicGroupName": "Group Name",
|
||||
"DescriptionFieldLabel": "Description Field"
|
||||
}
|
||||
});
|
|
@ -0,0 +1,10 @@
|
|||
declare interface IAngularMsGraphStrings {
|
||||
PropertyPaneDescription: string;
|
||||
BasicGroupName: string;
|
||||
DescriptionFieldLabel: string;
|
||||
}
|
||||
|
||||
declare module 'angularMsGraphStrings' {
|
||||
const strings: IAngularMsGraphStrings;
|
||||
export = strings;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
export interface IAnnouncements {
|
||||
id: number;
|
||||
ContentType?: string;
|
||||
Title: string;
|
||||
Modified?: Date;
|
||||
Created?: Date;
|
||||
Author?: string;
|
||||
AuthorId?: number;
|
||||
Editor?: string;
|
||||
EditorId?: number;
|
||||
_UIVersionString?: number;
|
||||
Attachments?: boolean;
|
||||
Edit?: string;
|
||||
LinkTitleNoMenu?: string;
|
||||
LinkTitle?: string;
|
||||
ItemChildCount?: number;
|
||||
FolderChildCount?: number;
|
||||
Body?: string;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
import { ICreatedBy, IUser } from './IListCollection';
|
||||
import { IAnnouncements } from './IAnnouncements';
|
||||
|
||||
export interface IGenericAnnouncementItem {
|
||||
createdBy: ICreatedBy
|
||||
createdDateTime: Date;
|
||||
eTag: string;
|
||||
id: string;
|
||||
lastModifiedBy: IUser;
|
||||
webUrl: string;
|
||||
listItemId: number;
|
||||
columnSet: IAnnouncements;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
import { ICreatedBy, IUser } from './IListCollection';
|
||||
|
||||
export interface IGenericCreateItem {
|
||||
createdBy: ICreatedBy;
|
||||
createDateTime: Date;
|
||||
eTag: string;
|
||||
id: string;
|
||||
lastModifiedBy: IUser;
|
||||
lastModifiedDateTime: Date;
|
||||
listItemId: number;
|
||||
webUrl: string;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
export interface IListCollection {
|
||||
createdBy: ICreatedBy;
|
||||
createdDateTime: Date;
|
||||
description: string;
|
||||
eTag: string;
|
||||
id: string;
|
||||
lastModifiedDateTime: Date;
|
||||
name: string;
|
||||
webUrl: string;
|
||||
list: IListInfo;
|
||||
}
|
||||
|
||||
export interface ICreatedBy {
|
||||
user: IUser;
|
||||
}
|
||||
|
||||
export interface IUser {
|
||||
displayName: string;
|
||||
}
|
||||
|
||||
export interface IListInfo {
|
||||
hidden: boolean;
|
||||
template: string;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
export interface ISiteCollections {
|
||||
createdDateTime: Date;
|
||||
description: string;
|
||||
id: string;
|
||||
lastModifiedDateTime: Date;
|
||||
name: string;
|
||||
root: Object;
|
||||
siteCollection: ISiteCollection;
|
||||
siteCollectionId: string;
|
||||
siteId: string;
|
||||
webUrl: string;
|
||||
}
|
||||
|
||||
export interface ISiteCollection {
|
||||
hostname: string;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
/// <reference types="mocha" />
|
||||
|
||||
import { assert } from 'chai';
|
||||
|
||||
describe('AngularMsGraphWebPart', () => {
|
||||
it('should do something', () => {
|
||||
assert.ok(true);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "commonjs",
|
||||
"jsx": "react",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"types": [
|
||||
"webpack-env"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
// Type definitions for Microsoft ODSP projects
|
||||
// Project: ODSP
|
||||
|
||||
/* Global definition for UNIT_TEST builds */
|
||||
declare const UNIT_TEST: boolean;
|
|
@ -0,0 +1,15 @@
|
|||
// 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;
|
||||
}
|
|
@ -0,0 +1,631 @@
|
|||
// 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;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
/// <reference path="@ms/odsp.d.ts" />
|
||||
/// <reference path="assertion-error/assertion-error.d.ts" />
|
||||
/// <reference path="knockout/knockout.d.ts" />
|
Loading…
Reference in New Issue