gd-sprest-react
Advanced tools
Comparing version 0.8.0 to 0.8.1
/// <reference types="react" /> | ||
import { Types } from "gd-sprest"; | ||
import { Dropdown, IDropdownOption, PrimaryButton, TextField } from "office-ui-fabric-react"; | ||
@@ -23,3 +24,4 @@ import { IWebPartCfg, IWebPartConfigurationProps, IWebPartConfigurationState } from "../.."; | ||
cfg: IWebPartListCfg; | ||
lists: Array<IDropdownOption>; | ||
lists: Array<Types.IListQueryResult>; | ||
options: Array<IDropdownOption>; | ||
} | ||
@@ -30,2 +32,3 @@ /** | ||
export declare class WebPartListCfg extends WebPartConfigurationPanel<IWebPartListCfgProps, IWebPartListCfgState> { | ||
protected _query: Types.ODataQuery; | ||
protected _listDropdown: Dropdown; | ||
@@ -43,2 +46,4 @@ protected _refreshButton: PrimaryButton; | ||
private loadLists; | ||
onListChanged: (state: IWebPartListCfgState, option?: IDropdownOption, idx?: number) => void; | ||
onListsLoaded: (newState: IWebPartListCfgState) => void; | ||
onRenderFooter: () => void; | ||
@@ -45,0 +50,0 @@ onRenderHeader: () => void; |
@@ -27,2 +27,3 @@ "use strict"; | ||
var _this = _super.call(this, props) || this; | ||
_this._query = null; | ||
_this._listDropdown = null; | ||
@@ -40,6 +41,3 @@ _this._refreshButton = null; | ||
.Lists() | ||
.query({ | ||
OrderBy: ["Title"], | ||
Top: 500 | ||
}) | ||
.query(_this._query) | ||
.execute(function (lists) { | ||
@@ -56,14 +54,23 @@ var options = []; | ||
} | ||
// Set the new state | ||
var newState = { | ||
cfg: cfg, | ||
lists: lists.results, | ||
options: options | ||
}; | ||
// Call the on lists loaded method | ||
_this.onListsLoaded(newState); | ||
// Set the state | ||
_this.setState({ | ||
cfg: cfg, | ||
lists: options | ||
}); | ||
_this.setState(newState); | ||
}); | ||
}; | ||
// Method to render the panel footer content | ||
// The list change event | ||
_this.onListChanged = function (state, option, idx) { }; | ||
// The lists loaded event | ||
_this.onListsLoaded = function (newState) { }; | ||
// The render footer event | ||
_this.onRenderFooter = function () { }; | ||
// Method to render the panel header content | ||
// The render header event | ||
_this.onRenderHeader = function () { }; | ||
// Method to render the panel content | ||
// The render contents event | ||
_this.onRenderContents = function (cfg) { | ||
@@ -102,5 +109,12 @@ return (React.createElement("div", null, | ||
newState.cfg.ListName = option.text; | ||
// Call the change event | ||
_this.onListChanged(newState, option, idx); | ||
// Update the state | ||
_this.setState(newState); | ||
}; | ||
// Set the query | ||
_this._query = { | ||
OrderBy: ["Title"], | ||
Top: 500 | ||
}; | ||
// Load the lists | ||
@@ -107,0 +121,0 @@ _this.loadLists(props.cfg); |
{ | ||
"name": "gd-sprest-react", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"description": "SharePoint react components.", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
Sorry, the diff of this file is not supported yet
271055
4259