React Custom Property Pane Control updated to GA build. refactor custom control and standard dropdown properties with dynamic data. Refactor data services (#212)

This commit is contained in:
Eric Overfield 2017-06-11 23:56:36 -07:00 committed by Vesa Juvonen
parent bdad08e5db
commit 1aebcd4bc7
64 changed files with 852 additions and 28625 deletions

View File

@ -1,7 +0,0 @@
{
"@microsoft/generator-sharepoint": {
"libraryName": "react-custompropertypanecontrols",
"libraryId": "21ba0db9-71ef-4f6b-8463-ce29e77e19f4",
"framework": "react"
}
}

View File

@ -36,6 +36,7 @@ react-custompropertypanecontrols|Waldek Mastykarz (MVP, Rencore, @waldekm)
Version|Date|Comments Version|Date|Comments
-------|----|-------- -------|----|--------
2.0.1|May 1, 2017|Updated to SPFx GA
2.0.0|November 22, 2016|Added new sample web part (Dropdown with remote data (without custom controls)) 2.0.0|November 22, 2016|Added new sample web part (Dropdown with remote data (without custom controls))
1.0.0|October 17, 2016|Initial release 1.0.0|October 17, 2016|Initial release

View File

@ -12,13 +12,6 @@
} }
], ],
"externals": { "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": { "localizedResources": {
"dropdownWithRemoteDataStrings": "webparts/dropdownWithRemoteData/loc/{locale}.js", "dropdownWithRemoteDataStrings": "webparts/dropdownWithRemoteData/loc/{locale}.js",

View File

@ -0,0 +1,3 @@
{
"deployCdnPath": "temp/deploy"
}

View File

@ -2,9 +2,9 @@
"solution": { "solution": {
"name": "react-custompropertypanecontrols-client-side-solution", "name": "react-custompropertypanecontrols-client-side-solution",
"id": "21ba0db9-71ef-4f6b-8463-ce29e77e19f4", "id": "21ba0db9-71ef-4f6b-8463-ce29e77e19f4",
"version": "2.0.0.0" "version": "2.0.1.0"
}, },
"paths": { "paths": {
"zippedPackage": "solution/react-custompropertypanecontrols.spapp" "zippedPackage": "solution/react-custompropertypanecontrols.sppkg"
} }
} }

View File

@ -16,13 +16,11 @@
"export-name": false, "export-name": false,
"forin": false, "forin": false,
"label-position": false, "label-position": false,
"label-undefined": false,
"member-access": true, "member-access": true,
"no-arg": false, "no-arg": false,
"no-console": false, "no-console": false,
"no-construct": false, "no-construct": false,
"no-duplicate-case": true, "no-duplicate-case": true,
"no-duplicate-key": false,
"no-duplicate-variable": true, "no-duplicate-variable": true,
"no-eval": false, "no-eval": false,
"no-function-expression": true, "no-function-expression": true,
@ -32,8 +30,6 @@
"no-unnecessary-semicolons": true, "no-unnecessary-semicolons": true,
"no-unused-expression": true, "no-unused-expression": true,
"no-unused-imports": true, "no-unused-imports": true,
"no-unused-variable": true,
"no-unreachable": true,
"no-use-before-declare": true, "no-use-before-declare": true,
"no-with-statement": true, "no-with-statement": true,
"semicolon": true, "semicolon": true,
@ -43,9 +39,7 @@
"use-named-parameter": true, "use-named-parameter": true,
"valid-typeof": true, "valid-typeof": true,
"variable-name": false, "variable-name": false,
"whitespace": false, "whitespace": false
"prefer-const": true,
"a11y-role": true
} }
} }
} }

View File

@ -1,771 +0,0 @@
{
"name": "react-custompropertypanecontrols",
"version": "2.0.0",
"dependencies": {
"@microsoft/load-themed-styles": {
"version": "1.2.2",
"from": "@microsoft/load-themed-styles@>=1.2.2 <1.3.0",
"resolved": "https://registry.npmjs.org/@microsoft/load-themed-styles/-/load-themed-styles-1.2.2.tgz"
},
"@microsoft/office-ui-fabric-react-bundle": {
"version": "0.3.0",
"from": "@microsoft/office-ui-fabric-react-bundle@>=0.3.0 <0.4.0",
"resolved": "https://registry.npmjs.org/@microsoft/office-ui-fabric-react-bundle/-/office-ui-fabric-react-bundle-0.3.0.tgz",
"dependencies": {
"office-ui-fabric-react": {
"version": "0.52.0",
"from": "office-ui-fabric-react@0.52.0",
"resolved": "https://registry.npmjs.org/office-ui-fabric-react/-/office-ui-fabric-react-0.52.0.tgz"
}
}
},
"@microsoft/sp-client-base": {
"version": "0.3.0",
"from": "@microsoft/sp-client-base@>=0.3.0 <0.4.0",
"resolved": "https://registry.npmjs.org/@microsoft/sp-client-base/-/sp-client-base-0.3.0.tgz"
},
"@microsoft/sp-client-preview": {
"version": "0.4.0",
"from": "@microsoft/sp-client-preview@>=0.4.0 <0.5.0",
"resolved": "https://registry.npmjs.org/@microsoft/sp-client-preview/-/sp-client-preview-0.4.0.tgz",
"dependencies": {
"office-ui-fabric-react": {
"version": "0.52.0",
"from": "office-ui-fabric-react@0.52.0",
"resolved": "https://registry.npmjs.org/office-ui-fabric-react/-/office-ui-fabric-react-0.52.0.tgz"
}
}
},
"@microsoft/sp-lodash-subset": {
"version": "0.3.0",
"from": "@microsoft/sp-lodash-subset@>=0.3.0 <0.4.0",
"resolved": "https://registry.npmjs.org/@microsoft/sp-lodash-subset/-/sp-lodash-subset-0.3.0.tgz"
},
"@microsoft/sp-module-interfaces": {
"version": "0.3.0",
"from": "@microsoft/sp-module-interfaces@>=0.3.0 <0.4.0",
"resolved": "https://registry.npmjs.org/@microsoft/sp-module-interfaces/-/sp-module-interfaces-0.3.0.tgz"
},
"@microsoft/sp-module-loader": {
"version": "0.3.0",
"from": "@microsoft/sp-module-loader@>=0.3.0 <0.4.0",
"resolved": "https://registry.npmjs.org/@microsoft/sp-module-loader/-/sp-module-loader-0.3.0.tgz"
},
"acorn": {
"version": "3.3.0",
"from": "acorn@>=3.1.0 <4.0.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz"
},
"amdefine": {
"version": "1.0.1",
"from": "amdefine@>=0.0.4",
"resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz"
},
"ansi-regex": {
"version": "2.0.0",
"from": "ansi-regex@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz"
},
"ansi-styles": {
"version": "2.2.1",
"from": "ansi-styles@>=2.2.1 <3.0.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz"
},
"asap": {
"version": "2.0.5",
"from": "asap@>=2.0.3 <2.1.0",
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.5.tgz"
},
"asn1": {
"version": "0.2.3",
"from": "asn1@>=0.2.3 <0.3.0",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz"
},
"assert-plus": {
"version": "0.2.0",
"from": "assert-plus@>=0.2.0 <0.3.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz"
},
"ast-types": {
"version": "0.9.2",
"from": "ast-types@0.9.2",
"resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.2.tgz"
},
"asynckit": {
"version": "0.4.0",
"from": "asynckit@>=0.4.0 <0.5.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz"
},
"aws-sign2": {
"version": "0.6.0",
"from": "aws-sign2@>=0.6.0 <0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz"
},
"aws4": {
"version": "1.5.0",
"from": "aws4@>=1.2.1 <2.0.0",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.5.0.tgz"
},
"balanced-match": {
"version": "0.4.2",
"from": "balanced-match@>=0.4.1 <0.5.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz"
},
"base62": {
"version": "1.1.2",
"from": "base62@>=1.1.0 <2.0.0",
"resolved": "https://registry.npmjs.org/base62/-/base62-1.1.2.tgz"
},
"bcrypt-pbkdf": {
"version": "1.0.0",
"from": "bcrypt-pbkdf@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.0.tgz",
"optional": true
},
"boom": {
"version": "2.10.1",
"from": "boom@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz"
},
"brace-expansion": {
"version": "1.1.6",
"from": "brace-expansion@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz"
},
"caseless": {
"version": "0.11.0",
"from": "caseless@>=0.11.0 <0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz"
},
"chalk": {
"version": "1.1.3",
"from": "chalk@>=1.1.1 <2.0.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz"
},
"clone": {
"version": "1.0.2",
"from": "clone@>=1.0.2 <1.1.0",
"resolved": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz"
},
"color-functions": {
"version": "1.1.0",
"from": "color-functions@1.1.0",
"resolved": "https://registry.npmjs.org/color-functions/-/color-functions-1.1.0.tgz"
},
"combined-stream": {
"version": "1.0.5",
"from": "combined-stream@>=1.0.5 <1.1.0",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz"
},
"combokeys": {
"version": "2.4.6",
"from": "combokeys@2.4.6",
"resolved": "https://registry.npmjs.org/combokeys/-/combokeys-2.4.6.tgz"
},
"commander": {
"version": "2.9.0",
"from": "commander@>=2.7.1 <3.0.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz"
},
"commoner": {
"version": "0.10.8",
"from": "commoner@>=0.10.1 <0.11.0",
"resolved": "https://registry.npmjs.org/commoner/-/commoner-0.10.8.tgz"
},
"concat-map": {
"version": "0.0.1",
"from": "concat-map@0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
},
"core-js": {
"version": "1.2.7",
"from": "core-js@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz"
},
"cryptiles": {
"version": "2.0.5",
"from": "cryptiles@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz"
},
"dashdash": {
"version": "1.14.0",
"from": "dashdash@>=1.12.0 <2.0.0",
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.0.tgz",
"dependencies": {
"assert-plus": {
"version": "1.0.0",
"from": "assert-plus@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz"
}
}
},
"deep-equal": {
"version": "1.0.1",
"from": "deep-equal@>=1.0.1 <1.1.0",
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz"
},
"defined": {
"version": "1.0.0",
"from": "defined@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz"
},
"delayed-stream": {
"version": "1.0.0",
"from": "delayed-stream@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz"
},
"detective": {
"version": "4.3.2",
"from": "detective@>=4.3.1 <5.0.0",
"resolved": "https://registry.npmjs.org/detective/-/detective-4.3.2.tgz"
},
"ecc-jsbn": {
"version": "0.1.1",
"from": "ecc-jsbn@>=0.1.1 <0.2.0",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",
"optional": true
},
"encoding": {
"version": "0.1.12",
"from": "encoding@>=0.1.11 <0.2.0",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz"
},
"envify": {
"version": "3.4.1",
"from": "envify@>=3.0.0 <4.0.0",
"resolved": "https://registry.npmjs.org/envify/-/envify-3.4.1.tgz"
},
"es6-collections": {
"version": "0.5.6",
"from": "es6-collections@0.5.6",
"resolved": "https://registry.npmjs.org/es6-collections/-/es6-collections-0.5.6.tgz"
},
"es6-promise": {
"version": "3.1.2",
"from": "es6-promise@3.1.2",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.1.2.tgz"
},
"escape-string-regexp": {
"version": "1.0.5",
"from": "escape-string-regexp@>=1.0.2 <2.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz"
},
"esprima-fb": {
"version": "15001.1.0-dev-harmony-fb",
"from": "esprima-fb@>=15001.1.0-dev-harmony-fb <15002.0.0",
"resolved": "https://registry.npmjs.org/esprima-fb/-/esprima-fb-15001.1.0-dev-harmony-fb.tgz"
},
"eventemitter3": {
"version": "1.2.0",
"from": "eventemitter3@>=1.2.0 <1.3.0",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.2.0.tgz"
},
"extend": {
"version": "3.0.0",
"from": "extend@>=3.0.0 <3.1.0",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz"
},
"extsprintf": {
"version": "1.0.2",
"from": "extsprintf@1.0.2",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz"
},
"fast-diff": {
"version": "1.1.1",
"from": "fast-diff@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.1.1.tgz"
},
"fbemitter": {
"version": "2.1.1",
"from": "fbemitter@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/fbemitter/-/fbemitter-2.1.1.tgz",
"dependencies": {
"fbjs": {
"version": "0.8.6",
"from": "fbjs@>=0.8.4 <0.9.0",
"resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.6.tgz"
}
}
},
"fbjs": {
"version": "0.1.0-alpha.7",
"from": "fbjs@0.1.0-alpha.7",
"resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.1.0-alpha.7.tgz",
"dependencies": {
"whatwg-fetch": {
"version": "0.9.0",
"from": "whatwg-fetch@>=0.9.0 <0.10.0",
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-0.9.0.tgz"
}
}
},
"flux": {
"version": "2.1.1",
"from": "flux@2.1.1",
"resolved": "https://registry.npmjs.org/flux/-/flux-2.1.1.tgz"
},
"forever-agent": {
"version": "0.6.1",
"from": "forever-agent@>=0.6.1 <0.7.0",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz"
},
"form-data": {
"version": "2.1.2",
"from": "form-data@>=2.1.1 <2.2.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.2.tgz"
},
"generate-function": {
"version": "2.0.0",
"from": "generate-function@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz"
},
"generate-object-property": {
"version": "1.2.0",
"from": "generate-object-property@>=1.1.0 <2.0.0",
"resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz"
},
"getpass": {
"version": "0.1.6",
"from": "getpass@>=0.1.1 <0.2.0",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.6.tgz",
"dependencies": {
"assert-plus": {
"version": "1.0.0",
"from": "assert-plus@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz"
}
}
},
"glob": {
"version": "5.0.15",
"from": "glob@>=5.0.15 <6.0.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz"
},
"graceful-fs": {
"version": "4.1.10",
"from": "graceful-fs@>=4.1.2 <5.0.0",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.10.tgz"
},
"graceful-readlink": {
"version": "1.0.1",
"from": "graceful-readlink@>=1.0.0",
"resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz"
},
"har-validator": {
"version": "2.0.6",
"from": "har-validator@>=2.0.6 <2.1.0",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz"
},
"has-ansi": {
"version": "2.0.0",
"from": "has-ansi@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz"
},
"hawk": {
"version": "3.1.3",
"from": "hawk@>=3.1.3 <3.2.0",
"resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz"
},
"hoek": {
"version": "2.16.3",
"from": "hoek@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz"
},
"http-signature": {
"version": "1.1.1",
"from": "http-signature@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz"
},
"iconv-lite": {
"version": "0.4.14",
"from": "iconv-lite@>=0.4.13 <0.5.0",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.14.tgz"
},
"immutable": {
"version": "3.8.1",
"from": "immutable@>=3.7.4 <4.0.0",
"resolved": "https://registry.npmjs.org/immutable/-/immutable-3.8.1.tgz"
},
"inflight": {
"version": "1.0.6",
"from": "inflight@>=1.0.4 <2.0.0",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz"
},
"inherits": {
"version": "2.0.3",
"from": "inherits@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"
},
"is-my-json-valid": {
"version": "2.15.0",
"from": "is-my-json-valid@>=2.12.4 <3.0.0",
"resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.15.0.tgz"
},
"is-property": {
"version": "1.0.2",
"from": "is-property@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz"
},
"is-stream": {
"version": "1.1.0",
"from": "is-stream@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz"
},
"is-typedarray": {
"version": "1.0.0",
"from": "is-typedarray@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz"
},
"isomorphic-fetch": {
"version": "2.2.1",
"from": "isomorphic-fetch@>=2.1.1 <3.0.0",
"resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz"
},
"isstream": {
"version": "0.1.2",
"from": "isstream@>=0.1.2 <0.2.0",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz"
},
"jodid25519": {
"version": "1.0.2",
"from": "jodid25519@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/jodid25519/-/jodid25519-1.0.2.tgz",
"optional": true
},
"js-tokens": {
"version": "2.0.0",
"from": "js-tokens@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-2.0.0.tgz"
},
"jsbn": {
"version": "0.1.0",
"from": "jsbn@>=0.1.0 <0.2.0",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.0.tgz",
"optional": true
},
"json-schema": {
"version": "0.2.3",
"from": "json-schema@0.2.3",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz"
},
"json-stringify-safe": {
"version": "5.0.1",
"from": "json-stringify-safe@>=5.0.1 <5.1.0",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz"
},
"jsonpointer": {
"version": "4.0.0",
"from": "jsonpointer@>=4.0.0 <5.0.0",
"resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.0.tgz"
},
"jsprim": {
"version": "1.3.1",
"from": "jsprim@>=1.2.2 <2.0.0",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.3.1.tgz"
},
"jstransform": {
"version": "11.0.3",
"from": "jstransform@>=11.0.3 <12.0.0",
"resolved": "https://registry.npmjs.org/jstransform/-/jstransform-11.0.3.tgz",
"dependencies": {
"object-assign": {
"version": "2.1.1",
"from": "object-assign@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-2.1.1.tgz"
}
}
},
"load-themed-styles": {
"version": "1.1.0",
"from": "load-themed-styles@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/load-themed-styles/-/load-themed-styles-1.1.0.tgz"
},
"lodash": {
"version": "4.15.0",
"from": "lodash@>=4.15.0 <4.16.0",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.15.0.tgz"
},
"lodash.get": {
"version": "4.4.2",
"from": "lodash.get@>=4.1.2 <5.0.0",
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz"
},
"loose-envify": {
"version": "1.3.0",
"from": "loose-envify@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.0.tgz"
},
"mime-db": {
"version": "1.25.0",
"from": "mime-db@>=1.25.0 <1.26.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.25.0.tgz"
},
"mime-types": {
"version": "2.1.13",
"from": "mime-types@>=2.1.7 <2.2.0",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.13.tgz"
},
"minimatch": {
"version": "3.0.3",
"from": "minimatch@>=2.0.0 <3.0.0||>=3.0.0 <4.0.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz"
},
"minimist": {
"version": "0.0.8",
"from": "minimist@0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz"
},
"mkdirp": {
"version": "0.5.1",
"from": "mkdirp@>=0.5.0 <0.6.0",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz"
},
"mobservable": {
"version": "1.2.5",
"from": "mobservable@1.2.5",
"resolved": "https://registry.npmjs.org/mobservable/-/mobservable-1.2.5.tgz"
},
"mobservable-react": {
"version": "2.1.5",
"from": "mobservable-react@2.1.5",
"resolved": "https://registry.npmjs.org/mobservable-react/-/mobservable-react-2.1.5.tgz"
},
"node-fetch": {
"version": "1.6.3",
"from": "node-fetch@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.6.3.tgz"
},
"oauth-sign": {
"version": "0.8.2",
"from": "oauth-sign@>=0.8.1 <0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz"
},
"object-assign": {
"version": "4.1.0",
"from": "object-assign@>=4.1.0 <5.0.0",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz"
},
"office-ui-fabric-react": {
"version": "0.36.0",
"from": "office-ui-fabric-react@0.36.0",
"resolved": "https://registry.npmjs.org/office-ui-fabric-react/-/office-ui-fabric-react-0.36.0.tgz"
},
"once": {
"version": "1.4.0",
"from": "once@>=1.3.0 <2.0.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz"
},
"parchment": {
"version": "1.0.0-rc.2",
"from": "parchment@1.0.0-rc.2",
"resolved": "https://registry.npmjs.org/parchment/-/parchment-1.0.0-rc.2.tgz"
},
"path-is-absolute": {
"version": "1.0.1",
"from": "path-is-absolute@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz"
},
"pinkie": {
"version": "2.0.4",
"from": "pinkie@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz"
},
"pinkie-promise": {
"version": "2.0.1",
"from": "pinkie-promise@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz"
},
"private": {
"version": "0.1.6",
"from": "private@>=0.1.6 <0.2.0",
"resolved": "https://registry.npmjs.org/private/-/private-0.1.6.tgz"
},
"promise": {
"version": "7.1.1",
"from": "promise@>=7.1.1 <8.0.0",
"resolved": "https://registry.npmjs.org/promise/-/promise-7.1.1.tgz"
},
"punycode": {
"version": "1.4.1",
"from": "punycode@>=1.4.1 <2.0.0",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz"
},
"q": {
"version": "1.4.1",
"from": "q@>=1.1.2 <2.0.0",
"resolved": "https://registry.npmjs.org/q/-/q-1.4.1.tgz"
},
"qs": {
"version": "6.3.0",
"from": "qs@>=6.3.0 <6.4.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.3.0.tgz"
},
"quill": {
"version": "1.0.0",
"from": "quill@1.0.0",
"resolved": "https://registry.npmjs.org/quill/-/quill-1.0.0.tgz"
},
"react": {
"version": "0.14.8",
"from": "react@0.14.8",
"resolved": "https://registry.npmjs.org/react/-/react-0.14.8.tgz",
"dependencies": {
"fbjs": {
"version": "0.6.1",
"from": "fbjs@>=0.6.1 <0.7.0",
"resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.6.1.tgz"
},
"whatwg-fetch": {
"version": "0.9.0",
"from": "whatwg-fetch@>=0.9.0 <0.10.0",
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-0.9.0.tgz"
}
}
},
"react-dom": {
"version": "0.14.8",
"from": "react-dom@0.14.8",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-0.14.8.tgz"
},
"recast": {
"version": "0.11.17",
"from": "recast@>=0.11.17 <0.12.0",
"resolved": "https://registry.npmjs.org/recast/-/recast-0.11.17.tgz",
"dependencies": {
"esprima": {
"version": "3.1.1",
"from": "esprima@>=3.1.0 <3.2.0",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.1.tgz"
},
"source-map": {
"version": "0.5.6",
"from": "source-map@>=0.5.0 <0.6.0",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz"
}
}
},
"request": {
"version": "2.79.0",
"from": "request@>=2.54.0 <3.0.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz"
},
"rich-text": {
"version": "3.0.2",
"from": "rich-text@>=3.0.2 <3.1.0",
"resolved": "https://registry.npmjs.org/rich-text/-/rich-text-3.0.2.tgz"
},
"sntp": {
"version": "1.0.9",
"from": "sntp@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz"
},
"source-map": {
"version": "0.4.4",
"from": "source-map@>=0.4.2 <0.5.0",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz"
},
"sshpk": {
"version": "1.10.1",
"from": "sshpk@>=1.7.0 <2.0.0",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.10.1.tgz",
"dependencies": {
"assert-plus": {
"version": "1.0.0",
"from": "assert-plus@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz"
}
}
},
"stringstream": {
"version": "0.0.5",
"from": "stringstream@>=0.0.4 <0.1.0",
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz"
},
"strip-ansi": {
"version": "3.0.1",
"from": "strip-ansi@>=3.0.0 <4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz"
},
"supports-color": {
"version": "2.0.0",
"from": "supports-color@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz"
},
"systemjs": {
"version": "0.19.25",
"from": "systemjs@0.19.25",
"resolved": "https://registry.npmjs.org/systemjs/-/systemjs-0.19.25.tgz"
},
"through": {
"version": "2.3.8",
"from": "through@>=2.3.4 <2.4.0",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz"
},
"tiny-sha256": {
"version": "1.0.2",
"from": "tiny-sha256@1.0.2",
"resolved": "https://registry.npmjs.org/tiny-sha256/-/tiny-sha256-1.0.2.tgz"
},
"tough-cookie": {
"version": "2.3.2",
"from": "tough-cookie@>=2.3.0 <2.4.0",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz"
},
"tunnel-agent": {
"version": "0.4.3",
"from": "tunnel-agent@>=0.4.1 <0.5.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz"
},
"tweetnacl": {
"version": "0.14.3",
"from": "tweetnacl@>=0.14.0 <0.15.0",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.3.tgz",
"optional": true
},
"ua-parser-js": {
"version": "0.7.12",
"from": "ua-parser-js@>=0.7.9 <0.8.0",
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.12.tgz"
},
"uuid": {
"version": "3.0.0",
"from": "uuid@>=3.0.0 <4.0.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.0.tgz"
},
"validator": {
"version": "5.7.0",
"from": "validator@>=5.0.0 <6.0.0",
"resolved": "https://registry.npmjs.org/validator/-/validator-5.7.0.tgz"
},
"verror": {
"version": "1.3.6",
"from": "verror@1.3.6",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.3.6.tgz"
},
"whatwg-fetch": {
"version": "0.11.0",
"from": "whatwg-fetch@0.11.0",
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-0.11.0.tgz"
},
"when": {
"version": "3.7.7",
"from": "when@>=3.7.5 <4.0.0",
"resolved": "https://registry.npmjs.org/when/-/when-3.7.7.tgz"
},
"wrappy": {
"version": "1.0.2",
"from": "wrappy@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"
},
"xtend": {
"version": "4.0.1",
"from": "xtend@>=4.0.0 <5.0.0",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz"
},
"z-schema": {
"version": "3.17.0",
"from": "z-schema@3.17.0",
"resolved": "https://registry.npmjs.org/z-schema/-/z-schema-3.17.0.tgz"
}
}
}

View File

@ -1,26 +1,35 @@
{ {
"name": "react-custompropertypanecontrols", "name": "react-custompropertypanecontrols",
"version": "2.0.0", "version": "2.0.1",
"private": true, "private": true,
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
}, },
"dependencies": { "dependencies": {
"@microsoft/sp-client-base": "~0.3.0", "@microsoft/sp-client-base": "~1.0.0",
"@microsoft/sp-client-preview": "~0.4.0", "@microsoft/sp-core-library": "~1.0.0",
"office-ui-fabric-react": "0.36.0", "@microsoft/sp-webpart-base": "~1.0.0",
"react": "0.14.8", "@types/react": "0.14.46",
"react-dom": "0.14.8" "@types/react-addons-shallow-compare": "0.14.17",
"@types/react-addons-test-utils": "0.14.15",
"@types/react-addons-update": "0.14.14",
"@types/react-dom": "0.14.18",
"@types/webpack-env": ">=1.12.1 <1.14.0",
"react": "15.4.2",
"react-addons-update": "^15.5.2",
"react-dom": "15.4.2"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/sp-build-web": "~0.6.0", "@microsoft/sp-build-web": "~1.0.1",
"@microsoft/sp-module-interfaces": "~0.3.0", "@microsoft/sp-module-interfaces": "~1.0.0",
"@microsoft/sp-webpart-workbench": "~0.4.0", "@microsoft/sp-webpart-workbench": "~1.0.0",
"gulp": "~3.9.1" "gulp": "~3.9.1",
"@types/chai": ">=3.4.34 <3.6.0",
"@types/mocha": ">=2.2.33 <2.6.0"
}, },
"scripts": { "scripts": {
"build": "gulp bundle", "build": "gulp bundle",
"clean": "gulp nuke", "clean": "gulp clean",
"test": "gulp test" "test": "gulp test"
} }
} }

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>{21ba0db9-71ef-4f6b-8463-ce29e77e19f4}</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="CMD.EXE /c node $(MSBuildThisFileDirectory)\node_modules\gulp\bin\gulp.js bundle" />
</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>

View File

@ -1,4 +1,4 @@
import { IPropertyPaneCustomFieldProps } from '@microsoft/sp-client-preview'; import { IPropertyPaneCustomFieldProps } from '@microsoft/sp-webpart-base';
import { IPropertyPaneAsyncDropdownProps } from './IPropertyPaneAsyncDropdownProps'; import { IPropertyPaneAsyncDropdownProps } from './IPropertyPaneAsyncDropdownProps';
export interface IPropertyPaneAsyncDropdownInternalProps extends IPropertyPaneAsyncDropdownProps, IPropertyPaneCustomFieldProps { export interface IPropertyPaneAsyncDropdownInternalProps extends IPropertyPaneAsyncDropdownProps, IPropertyPaneCustomFieldProps {

View File

@ -1,9 +1,10 @@
import { IDropdownOption } from 'office-ui-fabric-react'; import { IDropdownOption } from 'office-ui-fabric-react';
export interface IPropertyPaneAsyncDropdownProps { export interface IPropertyPaneAsyncDropdownProps {
key: string;
label: string; label: string;
loadOptions: () => Promise<IDropdownOption[]>; loadOptions: () => Promise<IDropdownOption[]>;
onPropertyChange: (propertyPath: string, newValue: any) => void; onPropertyChange: (propertyPath: string, oldValue: any, newValue: any) => void;
selectedKey: string | number; selectedKey: string | number;
disabled?: boolean; disabled?: boolean;
} }

View File

@ -2,8 +2,8 @@ import * as React from 'react';
import * as ReactDom from 'react-dom'; import * as ReactDom from 'react-dom';
import { import {
IPropertyPaneField, IPropertyPaneField,
IPropertyPaneFieldType PropertyPaneFieldType
} from '@microsoft/sp-client-preview'; } from '@microsoft/sp-webpart-base';
import { IDropdownOption } from 'office-ui-fabric-react'; import { IDropdownOption } from 'office-ui-fabric-react';
import { IPropertyPaneAsyncDropdownProps } from './IPropertyPaneAsyncDropdownProps'; import { IPropertyPaneAsyncDropdownProps } from './IPropertyPaneAsyncDropdownProps';
import { IPropertyPaneAsyncDropdownInternalProps } from './IPropertyPaneAsyncDropdownInternalProps'; import { IPropertyPaneAsyncDropdownInternalProps } from './IPropertyPaneAsyncDropdownInternalProps';
@ -11,20 +11,26 @@ import AsyncDropdown from './components/AsyncDropdown';
import { IAsyncDropdownProps } from './components/IAsyncDropdownProps'; import { IAsyncDropdownProps } from './components/IAsyncDropdownProps';
export class PropertyPaneAsyncDropdown implements IPropertyPaneField<IPropertyPaneAsyncDropdownProps> { export class PropertyPaneAsyncDropdown implements IPropertyPaneField<IPropertyPaneAsyncDropdownProps> {
public type: IPropertyPaneFieldType = IPropertyPaneFieldType.Custom; public type: PropertyPaneFieldType = PropertyPaneFieldType.Custom;
public targetProperty: string; public targetProperty: string;
public properties: IPropertyPaneAsyncDropdownInternalProps; public properties: IPropertyPaneAsyncDropdownInternalProps;
private elem: HTMLElement; private elem: HTMLElement;
//dirty way to store current value of this property
private storedValue: string;
constructor(targetProperty: string, properties: IPropertyPaneAsyncDropdownProps) { constructor(targetProperty: string, properties: IPropertyPaneAsyncDropdownProps) {
this.storedValue = "";
this.targetProperty = targetProperty; this.targetProperty = targetProperty;
this.properties = { this.properties = {
label: properties.label, key: properties.key,
loadOptions: properties.loadOptions, label: properties.label,
onPropertyChange: properties.onPropertyChange, loadOptions: properties.loadOptions,
selectedKey: properties.selectedKey, onPropertyChange: properties.onPropertyChange,
disabled: properties.disabled, selectedKey: properties.selectedKey,
onRender: this.onRender.bind(this) disabled: properties.disabled,
onRender: this.onRender.bind(this)
}; };
} }
@ -54,6 +60,13 @@ export class PropertyPaneAsyncDropdown implements IPropertyPaneField<IPropertyPa
} }
private onChanged(option: IDropdownOption, index?: number): void { private onChanged(option: IDropdownOption, index?: number): void {
this.properties.onPropertyChange(this.targetProperty, option.key); //set the old value to what was the new value;
var oldValue : any = this.storedValue;
//now reset new to what was just selected
this.storedValue = <string>option.key;
//finally trigger this custom properties on change method
this.properties.onPropertyChange(this.targetProperty, oldValue, this.storedValue);
} }
} }

View File

@ -1,8 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import { Dropdown, Spinner } from 'office-ui-fabric-react'; import { Dropdown, Spinner, IDropdownOption } from 'office-ui-fabric-react';
import { IAsyncDropdownProps } from './IAsyncDropdownProps'; import { IAsyncDropdownProps } from './IAsyncDropdownProps';
import { IAsyncDropdownState } from './IAsyncDropdownState'; import { IAsyncDropdownState } from './IAsyncDropdownState';
import { IDropdownOption } from 'office-ui-fabric-react';
export default class AsyncDropdown extends React.Component<IAsyncDropdownProps, IAsyncDropdownState> { export default class AsyncDropdown extends React.Component<IAsyncDropdownProps, IAsyncDropdownState> {
constructor(props: IAsyncDropdownProps, state: IAsyncDropdownState) { constructor(props: IAsyncDropdownProps, state: IAsyncDropdownState) {

View File

@ -2,14 +2,15 @@
"$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json", "$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json",
"id": "e134b73a-b441-43c5-8569-e10b665281af", "id": "e134b73a-b441-43c5-8569-e10b665281af",
"alias":"ReactDropdownWithRemoteData",
"componentType": "WebPart", "componentType": "WebPart",
"version": "0.0.1", "version": "0.0.2",
"manifestVersion": 2, "manifestVersion": 2,
"preconfiguredEntries": [{ "preconfiguredEntries": [{
"groupId": "e134b73a-b441-43c5-8569-e10b665281af", "groupId": "e134b73a-b441-43c5-8569-e10b665281af",
"group": { "default": "Under Development" }, "group": { "default": "Under Development" },
"title": { "default": "Dropdown with remote data" }, "title": { "default": "Dropdown with custom properties" },
"description": { "default": "Sample web part using a property bound to a dropdown control with remote data" }, "description": { "default": "Sample web part using a property bound to a dropdown control with remote data" },
"officeFabricIconFontName": "Page", "officeFabricIconFontName": "Page",
"properties": { "properties": {

View File

@ -1,41 +1,62 @@
import * as React from 'react'; import * as React from 'react';
import * as ReactDom from 'react-dom'; import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import { import {
BaseClientSideWebPart, BaseClientSideWebPart,
IPropertyPaneSettings, IPropertyPaneConfiguration
IWebPartContext, } from '@microsoft/sp-webpart-base';
} from '@microsoft/sp-client-preview'; import {
Environment,
EnvironmentType
} from '@microsoft/sp-core-library';
import { IDropdownOption } from 'office-ui-fabric-react'; import { IDropdownOption } from 'office-ui-fabric-react';
import { update, get } from '@microsoft/sp-lodash-subset';
import * as strings from 'dropdownWithRemoteDataStrings'; import * as strings from 'dropdownWithRemoteDataStrings';
import DropdownWithRemoteData, { IDropdownWithRemoteDataProps } from './components/DropdownWithRemoteData'; import DropdownWithRemoteData from './components/DropdownWithRemoteData';
import { IDropdownWithRemoteDataProps } from './components/IDropdownWithRemoteDataProps';
import { IDropdownWithRemoteDataWebPartProps } from './IDropdownWithRemoteDataWebPartProps'; import { IDropdownWithRemoteDataWebPartProps } from './IDropdownWithRemoteDataWebPartProps';
import { IListInfo } from './IListInfo';
import { IList, IListItem, ListService, MockListService } from './services';
import { PropertyPaneAsyncDropdown } from '../../controls/PropertyPaneAsyncDropdown/PropertyPaneAsyncDropdown'; import { PropertyPaneAsyncDropdown } from '../../controls/PropertyPaneAsyncDropdown/PropertyPaneAsyncDropdown';
export default class DropdownWithRemoteDataWebPart extends BaseClientSideWebPart<IDropdownWithRemoteDataWebPartProps> { export default class DropdownWithRemoteDataWebPart extends BaseClientSideWebPart<IDropdownWithRemoteDataWebPartProps> {
private itemsDropDown: PropertyPaneAsyncDropdown; private itemsDropDown: PropertyPaneAsyncDropdown;
public constructor(context: IWebPartContext) { protected onInit(): Promise<void> {
super(context); this.configureWebPart = this.configureWebPart.bind(this);
return super.onInit();
} }
public render(): void { public render(): void {
const element: React.ReactElement<IDropdownWithRemoteDataProps> = React.createElement(DropdownWithRemoteData, { const element: React.ReactElement<IDropdownWithRemoteDataProps > = React.createElement(
list: this.properties.list, DropdownWithRemoteData,
item: this.properties.item {
}); list: this.properties.list,
item: this.properties.item,
needsConfiguration: this.needsConfiguration(),
displayMode: this.displayMode,
configureWebPart: this.configureWebPart
}
);
ReactDom.render(element, this.domElement); ReactDom.render(element, this.domElement);
} }
protected get propertyPaneSettings(): IPropertyPaneSettings { protected get dataVersion(): Version {
return Version.parse('1.0');
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
// reference to item dropdown needed later after selecting a list // reference to item dropdown needed later after selecting a list
this.itemsDropDown = new PropertyPaneAsyncDropdown('item', { this.itemsDropDown = new PropertyPaneAsyncDropdown('item', {
key: 'asyncUniqueKeyItem',
label: strings.ItemFieldLabel, label: strings.ItemFieldLabel,
loadOptions: this.loadItems.bind(this), loadOptions: this.loadItems.bind(this),
onPropertyChange: this.onPropertyChange.bind(this), onPropertyChange: this.onListItemChange.bind(this),
selectedKey: this.properties.item, selectedKey: this.properties.item,
// should be disabled if no list has been selected // should be disabled if no list has been selected
disabled: !this.properties.list disabled: !this.properties.list
@ -52,6 +73,7 @@ export default class DropdownWithRemoteDataWebPart extends BaseClientSideWebPart
groupName: strings.BasicGroupName, groupName: strings.BasicGroupName,
groupFields: [ groupFields: [
new PropertyPaneAsyncDropdown('list', { new PropertyPaneAsyncDropdown('list', {
key: 'asyncUniqueKeyList',
label: strings.ListFieldLabel, label: strings.ListFieldLabel,
loadOptions: this.loadLists.bind(this), loadOptions: this.loadLists.bind(this),
onPropertyChange: this.onListChange.bind(this), onPropertyChange: this.onListChange.bind(this),
@ -66,40 +88,23 @@ export default class DropdownWithRemoteDataWebPart extends BaseClientSideWebPart
}; };
} }
private loadLists(): Promise<IDropdownOption[]> {
return new Promise<IDropdownOption[]>((resolve: (options: IDropdownOption[]) => void, reject: (error: any) => void) => {
// uncomment to load mock lists
setTimeout(() => {
resolve([{
key: 'sharedDocuments',
text: 'Shared Documents'
},
{
key: 'myDocuments',
text: 'My Documents'
}]);
}, 2000);
// uncomment to load lists from the current web private loadLists(): Promise<IDropdownOption[]> {
// this.context.httpClient.get(this.context.pageContext.web.absoluteUrl + '/_api/web/lists?$select=Id,Title', { const dataService = (Environment.type === EnvironmentType.Test || Environment.type === EnvironmentType.Local) ?
// headers: { new MockListService() :
// 'Accept': 'application/json;odata=nometadata', new ListService(this.context);
// 'odata-version': ''
// } return new Promise<IDropdownOption[]>(resolve => {
// }) dataService.getLists()
// .then((response: Response): Promise<{ value: IListInfo[] }> => { .then((response: IList[]) => {
// return response.json(); var options : IDropdownOption[] = [];
// })
// .then((listsResponse: { value: IListInfo[] }): void => { response.forEach((item: IList) => {
// resolve(listsResponse.value.map((value: IListInfo, index: number, array: IListInfo[]): IDropdownOption => { options.push({"key": item.Id, "text": item.Title});
// return { });
// key: value.Id,
// text: value.Title resolve(options);
// }; });
// }));
// }, (error: any): void => {
// reject(error);
// });
}); });
} }
@ -109,72 +114,68 @@ export default class DropdownWithRemoteDataWebPart extends BaseClientSideWebPart
return Promise.resolve(); return Promise.resolve();
} }
// uncomment to load mock items const dataService = (Environment.type === EnvironmentType.Test || Environment.type === EnvironmentType.Local) ?
const wp: DropdownWithRemoteDataWebPart = this; new MockListService() :
new ListService(this.context);
return new Promise<IDropdownOption[]>((resolve: (options: IDropdownOption[]) => void, reject: (error: any) => void) => { return new Promise<IDropdownOption[]>(resolve => {
// uncomment to load mock items dataService.getList(this.properties.list)
setTimeout(() => { .then((response) => {
const items = { var options : IDropdownOption[] = [];
sharedDocuments: [
{
key: 'spfx_presentation.pptx',
text: 'SPFx for the masses'
},
{
key: 'hello-world.spapp',
text: 'hello-world.spapp'
}
],
myDocuments: [
{
key: 'clippy_cv.docx',
text: 'Clippy CV'
},
{
key: 'clippy_expenses.xlsx',
text: 'Clippy Expenses'
}
]
}
resolve(items[wp.properties.list]);
}, 2000);
// uncomment to load items from the current list response.forEach((item: IListItem) => {
// this.context.httpClient.get(this.context.pageContext.web.absoluteUrl + `/_api/web/lists('${this.properties.list}')/items?$select=Id,Title`, { options.push({"key": item.Id, "text": item.Title});
// headers: { });
// 'Accept': 'application/json;odata=nometadata',
// 'odata-version': '' resolve(options);
// } });
// })
// .then((response: Response): Promise<{ value: IListInfo[] }> => {
// return response.json();
// })
// .then((listsResponse: { value: IListInfo[] }): void => {
// resolve(listsResponse.value.map((value: IListInfo, index: number, array: IListInfo[]): IDropdownOption => {
// return {
// key: value.Id,
// text: value.Title
// };
// }));
// }, (error: any): void => {
// reject(error);
// });
}); });
} }
private onListChange(propertyPath: string, newValue: any): void { private onListChange(propertyPath: string, oldValue: any, newValue: any): void {
// store new value in web part properties //update the property value
this.onPropertyChange(propertyPath, newValue); update(this.properties, propertyPath, (): any => { return newValue; });
// trigger that propertyPath was changed
this.onPropertyPaneFieldChanged(propertyPath, oldValue, newValue);
// reset selected item // reset selected item
const oldItemValue : any = get(this.properties, 'item');
this.properties.item = undefined; this.properties.item = undefined;
update(this.properties, 'item', (): any => { return this.properties.item; });
// store selected item reset in web part properties // store selected item reset in web part properties
this.onPropertyChange('item', this.properties.item); this.onPropertyPaneFieldChanged('item', oldItemValue, this.properties.item);
// reset selected values in item dropdown // reset selected values in item dropdown
this.itemsDropDown.properties.selectedKey = this.properties.item; //this.itemsDropDown.properties.selectedKey = this.properties.item;
this.itemsDropDown.properties.selectedKey = "";
// allow to load items // allow to load items
this.itemsDropDown.properties.disabled = false; this.itemsDropDown.properties.disabled = false;
// load items and re-render items dropdown // load items and re-render items dropdown
this.itemsDropDown.render(); this.itemsDropDown.render();
} }
private onListItemChange(propertyPath: string, oldValue: any, newValue: any): void {
//update the property value
update(this.properties, propertyPath, (): any => { return newValue; });
// store selected item reset in web part properties
this.onPropertyPaneFieldChanged(propertyPath, oldValue, newValue);
}
private needsConfiguration(): boolean {
return this.properties.list === null ||
this.properties.list === undefined ||
this.properties.list.trim().length === 0 ||
this.properties.item === null ||
this.properties.item === undefined ||
this.properties.item.toString().trim().length === 0;
}
private configureWebPart(): void {
this.context.propertyPane.open();
}
} }

View File

@ -0,0 +1,28 @@
import * as React from 'react';
import { Fabric } from 'office-ui-fabric-react';
import { DisplayMode } from '@microsoft/sp-core-library';
import { Placeholder } from '@microsoft/sp-webpart-base';
import { IConfigProps } from './IConfigProps';
export class Config extends React.Component<IConfigProps, {}> {
public render(): JSX.Element {
return (
<Fabric>
{ this.props.displayMode === DisplayMode.Edit &&
<Placeholder
icon="ms-Icon--CheckboxComposite"
iconText="Custom Properties"
description="Set custom properties."
buttonLabel="Configure"
onAdd={ this.props.configure } />
}
{ this.props.displayMode === DisplayMode.Read &&
<Placeholder
icon="ms-ICon--CheckboxComposite"
iconText="Custom Properties"
description="Set custom properties." />
}
</Fabric>
);
}
}

View File

@ -0,0 +1,6 @@
import { DisplayMode } from '@microsoft/sp-core-library';
export interface IConfigProps {
displayMode: DisplayMode;
configure: () => void;
}

View File

@ -0,0 +1,52 @@
.dropdownWithRemoteData {
.container {
max-width: 700px;
margin: 0px auto;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
}
.row {
padding: 20px;
}
.listItem {
max-width: 715px;
margin: 5px auto 5px auto;
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
}
.button {
// Our button
text-decoration: none;
height: 32px;
// Primary Button
min-width: 80px;
background-color: #0078d7;
border-color: #0078d7;
color: #ffffff;
// Basic Button
outline: transparent;
position: relative;
font-family: "Segoe UI WestEuropean","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;
-webkit-font-smoothing: antialiased;
font-size: 14px;
font-weight: 400;
border-width: 0;
text-align: center;
cursor: pointer;
display: inline-block;
padding: 0 16px;
.label {
font-weight: 600;
font-size: 14px;
height: 32px;
line-height: 32px;
margin: 0 4px;
vertical-align: top;
display: inline-block;
}
}
}

View File

@ -1,40 +1,41 @@
import * as React from 'react'; import * as React from 'react';
import { css } from 'office-ui-fabric-react';
import styles from '../DropdownWithRemoteData.module.scss'; import styles from './DropdownWithRemoteData.module.scss';
import { IDropdownWithRemoteDataWebPartProps } from '../IDropdownWithRemoteDataWebPartProps'; import { IDropdownWithRemoteDataProps } from './IDropdownWithRemoteDataProps';
export interface IDropdownWithRemoteDataProps extends IDropdownWithRemoteDataWebPartProps { import { Config } from './Config';
}
export default class DropdownWithRemoteData extends React.Component<IDropdownWithRemoteDataProps, void> {
public render(): React.ReactElement<IDropdownWithRemoteDataProps> {
const { needsConfiguration, configureWebPart} = this.props;
export default class DropdownWithRemoteData extends React.Component<IDropdownWithRemoteDataProps, {}> {
public render(): JSX.Element {
return ( return (
<div className={styles.dropdownWithRemoteData}> <div className={styles.dropdownWithRemoteData}>
<div className={styles.container}> { needsConfiguration &&
<div className={css('ms-Grid-row ms-bgColor-themeDark ms-fontColor-white', styles.row)}> <Config configure={configureWebPart} {...this.props} />
<div className='ms-Grid-col ms-u-lg10 ms-u-xl8 ms-u-xlPush2 ms-u-lgPush1'> }
<span className='ms-font-xl ms-fontColor-white'> { needsConfiguration === false &&
Welcome to SharePoint! <div className={styles.container}>
</span> <div className={`ms-Grid-row ms-bgColor-themeDark ms-fontColor-white ${styles.row}`}>
<p className='ms-font-l ms-fontColor-white'> <div className="ms-Grid-col ms-u-lg10 ms-u-xl8 ms-u-xlPush2 ms-u-lgPush1">
Customize SharePoint experiences using Web Parts. <span className="ms-font-xl ms-fontColor-white">Welcome to SharePoint!</span>
</p> <p className="ms-font-l ms-fontColor-white">Customize SharePoint experiences using Web Parts.</p>
<p className='ms-font-l ms-fontColor-white'>
Selected list ID: {this.props.list || 'no list selected'} <p className='ms-font-l ms-fontColor-white'>
</p> Selected list ID: {this.props.list || 'no list selected'}
<p className='ms-font-l ms-fontColor-white'> </p>
Selected item ID: {this.props.item || 'no item selected'} <p className='ms-font-l ms-fontColor-white'>
</p> Selected item ID: {this.props.item || 'no item selected'}
<a </p>
className={css('ms-Button', styles.button)}
href='https://github.com/SharePoint/sp-dev-docs/wiki' <a href="https://aka.ms/spfx" className={styles.button}>
> <span className={styles.label}>Learn more</span>
<span className='ms-Button-label'>Learn more</span> </a>
</a> </div>
</div> </div>
</div> </div>
</div> }
</div> </div>
); );
} }

View File

@ -0,0 +1,9 @@
import { DisplayMode } from '@microsoft/sp-core-library';
export interface IDropdownWithRemoteDataProps {
list: string;
item: string;
needsConfiguration: boolean;
configureWebPart: () => void;
displayMode: DisplayMode;
}

View File

@ -1,4 +1,4 @@
export interface IListInfo { export interface IList {
Id: string; Id: string;
Title: string; Title: string;
} }

View File

@ -0,0 +1,4 @@
export interface IListItem {
Id: number;
Title: string;
}

View File

@ -0,0 +1,7 @@
import { IList } from './IList';
import { IListItem } from './IListItem';
export interface IListService {
getLists: () => Promise<IList[]>;
getList: (listName: string) => Promise<IListItem[]>;
}

View File

@ -0,0 +1,63 @@
import { IListService, IList, IListItem } from '../services';
import {
SPHttpClient,
ISPHttpClientOptions,
SPHttpClientResponse
} from '@microsoft/sp-http';
import {
IWebPartContext
} from '@microsoft/sp-webpart-base';
export class ListService implements IListService {
constructor(private context: IWebPartContext) {
}
public getLists(): Promise<IList[]> {
var httpClientOptions : ISPHttpClientOptions = {};
httpClientOptions.headers = {
'Accept': 'application/json;odata=nometadata',
'odata-version': ''
};
return new Promise<IList[]>((resolve: (results: IList[]) => void, reject: (error: any) => void): void => {
this.context.spHttpClient.get(this.context.pageContext.web.serverRelativeUrl + `/_api/web/lists?$select=id,title`,
SPHttpClient.configurations.v1,
httpClientOptions
)
.then((response: SPHttpClientResponse): Promise<{ value: IList[] }> => {
return response.json();
})
.then((lists: { value: IList[] }): void => {
resolve(lists.value);
}, (error: any): void => {
reject(error);
});
});
}
public getList(listName: string): Promise<IListItem[]> {
var httpClientOptions : ISPHttpClientOptions = {};
httpClientOptions.headers = {
'Accept': 'application/json;odata=nometadata',
'odata-version': ''
};
return new Promise<IListItem[]>((resolve: (results: IListItem[]) => void, reject: (error: any) => void): void => {
this.context.spHttpClient.get(this.context.pageContext.web.serverRelativeUrl + `/_api/web/lists('${listName}')/items?$select=Id,Title`,
SPHttpClient.configurations.v1,
httpClientOptions
)
.then((response: SPHttpClientResponse): Promise<{ value: IListItem[] }> => {
return response.json();
})
.then((listItems: { value: IListItem[] }): void => {
resolve(listItems.value);
}, (error: any): void => {
reject(error);
});
});
}
}

View File

@ -0,0 +1,60 @@
import { IListService, IList, IListItem } from '../services';
export class MockListService implements IListService {
private lists: IList[];
private items: any;
constructor() {
this.lists = [
{
Id: "sharedDocuments",
Title: 'Shared Documents'
},
{
Id: "myDocuments",
Title: 'My Documents'
}
];
this.items = {
sharedDocuments: [
{
Id: 'spfx_presentation.pptx',
Title: 'SPFx for the masses'
},
{
Id: 'hello-world.spapp',
Title: 'hello-world.spapp'
}
],
myDocuments: [
{
Id: 'clippy_cv.docx',
Title: 'Clippy CV'
},
{
Id: 'clippy_expenses.xlsx',
Title: 'Clippy Expenses'
}
]
};
}
public getLists(): Promise<IList[]> {
return new Promise<IList[]>(resolve => {
setTimeout(() => {
resolve(this.lists);
}, 1000);
});
}
public getList(listName: string): Promise<IListItem[]> {
return new Promise<IListItem[]>(resolve => {
setTimeout(() => {
resolve(this.items[listName]);
}, 1000);
});
}
}

View File

@ -0,0 +1,5 @@
export * from './IListService';
export * from './IList';
export * from './IListItem';
export * from './ListService';
export * from './MockListService';

View File

@ -1,3 +1,5 @@
/// <reference types="mocha" />
import * as assert from 'assert'; import * as assert from 'assert';
describe('DropdownWithRemoteDataWebPart', () => { describe('DropdownWithRemoteDataWebPart', () => {

View File

@ -2,8 +2,9 @@
"$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json", "$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json",
"id": "ec34b5c6-7708-42ad-841e-46f2b75a074e", "id": "ec34b5c6-7708-42ad-841e-46f2b75a074e",
"alias":"ReactDropdownwRemoteDataWOCustomControl",
"componentType": "WebPart", "componentType": "WebPart",
"version": "0.0.1", "version": "0.0.2",
"manifestVersion": 2, "manifestVersion": 2,
"preconfiguredEntries": [{ "preconfiguredEntries": [{

View File

@ -2,54 +2,85 @@ import * as React from 'react';
import * as ReactDom from 'react-dom'; import * as ReactDom from 'react-dom';
import { import {
BaseClientSideWebPart, BaseClientSideWebPart,
IPropertyPaneSettings, IPropertyPaneConfiguration,
IWebPartContext,
PropertyPaneDropdown PropertyPaneDropdown
} from '@microsoft/sp-client-preview'; } from '@microsoft/sp-webpart-base';
import {
Environment,
EnvironmentType
} from '@microsoft/sp-core-library';
import { IDropdownOption } from 'office-ui-fabric-react'; import { IDropdownOption } from 'office-ui-fabric-react';
// import { IListInfo } from './IListInfo';
import * as strings from 'dropdownWithRemoteDataWithoutCustomControlsStrings'; import * as strings from 'dropdownWithRemoteDataWithoutCustomControlsStrings';
import DropdownWithRemoteDataWithoutCustomControls, { IDropdownWithRemoteDataWithoutCustomControlsProps } from './components/DropdownWithRemoteDataWithoutCustomControls'; import DropdownWithRemoteDataWithoutCustomControls from './components/DropdownWithRemoteDataWithoutCustomControls';
import { IDropdownWithRemoteDataWithoutCustomControlsProps } from './components/IDropdownWithRemoteDataWithoutCustomControlsProps';
import { IDropdownWithRemoteDataWithoutCustomControlsWebPartProps } from './IDropdownWithRemoteDataWithoutCustomControlsWebPartProps'; import { IDropdownWithRemoteDataWithoutCustomControlsWebPartProps } from './IDropdownWithRemoteDataWithoutCustomControlsWebPartProps';
import { IList, IListItem, ListService, MockListService } from './services';
export default class DropdownWithRemoteDataWithoutCustomControlsWebPart extends BaseClientSideWebPart<IDropdownWithRemoteDataWithoutCustomControlsWebPartProps> { export default class DropdownWithRemoteDataWithoutCustomControlsWebPart extends BaseClientSideWebPart<IDropdownWithRemoteDataWithoutCustomControlsWebPartProps> {
private lists: IDropdownOption[]; private lists: IDropdownOption[];
private items: IDropdownOption[]; private items: IDropdownOption[];
private itemsDropdownDisabled: boolean;
public constructor(context: IWebPartContext) { //remember if a given list should be disabled or not
super(context); private listsDropdownDisabled: boolean;
} private itemsDropdownDisabled: boolean;
protected onInit(): Promise<void> { protected onInit(): Promise<void> {
this.itemsDropdownDisabled = !this.properties.list; this.itemsDropdownDisabled = !this.properties.list;
this.configureWebPart = this.configureWebPart.bind(this);
return super.onInit();
}
protected onPropertyPaneConfigurationStart(): void {
this.listsDropdownDisabled = !this.lists;
if (this.lists) {
return;
}
this.context.statusRenderer.displayLoadingIndicator(this.domElement, 'lists'); this.context.statusRenderer.displayLoadingIndicator(this.domElement, 'lists');
return this.loadLists() this.loadLists().then((listOptions: IDropdownOption[]) => {
.then((listOptions: IDropdownOption[]): Promise<IDropdownOption[]> => {
this.lists = listOptions; this.lists = listOptions;
return this.loadItems(); this.listsDropdownDisabled = false;
})
.then((itemOptions: IDropdownOption[]): void => { //if the list was already selected, then get columns
this.items = itemOptions; if (this.properties.list) {
this.context.statusRenderer.clearLoadingIndicator(this.domElement); //go and load up dynamic column data
this.loadItems().then((itemOptions: IDropdownOption[]): void => {
this.items = itemOptions;
this.context.propertyPane.refresh();
this.context.statusRenderer.clearLoadingIndicator(this.domElement);
this.render();
});
}
else {
//else no list pre selected, so we can continue
this.context.propertyPane.refresh();
this.context.statusRenderer.clearLoadingIndicator(this.domElement);
this.render();
}
}); });
} }
protected onPropertyChange(propertyPath: string, newValue: any): void { protected onPropertyPaneFieldChanged(propertyPath: string, oldValue: any, newValue: any): void {
if (propertyPath === 'list' && if (propertyPath === 'list' && newValue) {
newValue) {
// push new list value // push new list value
super.onPropertyChange(propertyPath, newValue); super.onPropertyPaneFieldChanged(propertyPath, oldValue, newValue);
// get previously selected item
const previousItem: string = this.properties.item;
// reset selected item // reset selected item
this.properties.item = undefined; this.properties.item = undefined;
// push new item value // push new item value
this.onPropertyChange('item', this.properties.item); this.onPropertyPaneFieldChanged('itemName', previousItem, this.properties.item);
// disable item selector until new items are loaded // disable item selector until new items are loaded
this.itemsDropdownDisabled = true; this.itemsDropdownDisabled = true;
// refresh the item selector control by repainting the property pane // refresh the item selector control by repainting the property pane
this.configureStart(); this.context.propertyPane.refresh();
// communicate loading items // communicate loading items
this.context.statusRenderer.displayLoadingIndicator(this.domElement, 'items'); this.context.statusRenderer.displayLoadingIndicator(this.domElement, 'items');
@ -64,24 +95,27 @@ export default class DropdownWithRemoteDataWithoutCustomControlsWebPart extends
// re-render the web part as clearing the loading indicator removes the web part body // re-render the web part as clearing the loading indicator removes the web part body
this.render(); this.render();
// refresh the item selector control by repainting the property pane // refresh the item selector control by repainting the property pane
this.configureStart(); this.context.propertyPane.refresh();
}); });
} }
else { else {
super.onPropertyChange(propertyPath, newValue); super.onPropertyPaneFieldChanged(propertyPath, oldValue, newValue);
} }
} }
public render(): void { public render(): void {
const element: React.ReactElement<IDropdownWithRemoteDataWithoutCustomControlsProps> = React.createElement(DropdownWithRemoteDataWithoutCustomControls, { const element: React.ReactElement<IDropdownWithRemoteDataWithoutCustomControlsProps> = React.createElement(DropdownWithRemoteDataWithoutCustomControls, {
list: this.properties.list, list: this.properties.list,
item: this.properties.item item: this.properties.item,
needsConfiguration: this.needsConfiguration(),
displayMode: this.displayMode,
configureWebPart: this.configureWebPart
}); });
ReactDom.render(element, this.domElement); ReactDom.render(element, this.domElement);
} }
protected get propertyPaneSettings(): IPropertyPaneSettings { protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return { return {
pages: [ pages: [
{ {
@ -99,7 +133,7 @@ export default class DropdownWithRemoteDataWithoutCustomControlsWebPart extends
PropertyPaneDropdown('item', { PropertyPaneDropdown('item', {
label: strings.ItemFieldLabel, label: strings.ItemFieldLabel,
options: this.items, options: this.items,
isDisabled: this.itemsDropdownDisabled disabled: this.itemsDropdownDisabled
}) })
] ]
} }
@ -110,39 +144,21 @@ export default class DropdownWithRemoteDataWithoutCustomControlsWebPart extends
} }
private loadLists(): Promise<IDropdownOption[]> { private loadLists(): Promise<IDropdownOption[]> {
return new Promise<IDropdownOption[]>((resolve: (options: IDropdownOption[]) => void, reject: (error: any) => void) => { const dataService = (Environment.type === EnvironmentType.Test || Environment.type === EnvironmentType.Local) ?
// uncomment to load mock lists new MockListService() :
setTimeout(() => { new ListService(this.context);
resolve([{
key: 'sharedDocuments',
text: 'Shared Documents'
},
{
key: 'myDocuments',
text: 'My Documents'
}]);
}, 2000);
// uncomment to load lists from the current web return new Promise<IDropdownOption[]>(resolve => {
// this.context.httpClient.get(this.context.pageContext.web.absoluteUrl + '/_api/web/lists?$select=Id,Title', { dataService.getLists()
// headers: { .then((response: IList[]) => {
// 'Accept': 'application/json;odata=nometadata', var options : IDropdownOption[] = [];
// 'odata-version': ''
// } response.forEach((item: IList) => {
// }) options.push({"key": item.Id, "text": item.Title});
// .then((response: Response): Promise<{ value: IListInfo[] }> => { });
// return response.json();
// }) resolve(options);
// .then((listsResponse: { value: IListInfo[] }): void => { });
// resolve(listsResponse.value.map((value: IListInfo, index: number, array: IListInfo[]): IDropdownOption => {
// return {
// key: value.Id,
// text: value.Title
// };
// }));
// }, (error: any): void => {
// reject(error);
// });
}); });
} }
@ -152,57 +168,34 @@ export default class DropdownWithRemoteDataWithoutCustomControlsWebPart extends
return Promise.resolve(); return Promise.resolve();
} }
// uncomment to load mock items const dataService = (Environment.type === EnvironmentType.Test || Environment.type === EnvironmentType.Local) ?
const wp: DropdownWithRemoteDataWithoutCustomControlsWebPart = this; new MockListService() :
new ListService(this.context);
return new Promise<IDropdownOption[]>((resolve: (options: IDropdownOption[]) => void, reject: (error: any) => void) => { return new Promise<IDropdownOption[]>(resolve => {
// uncomment to load mock items dataService.getList(this.properties.list)
setTimeout(() => { .then((response) => {
const items = { var options : IDropdownOption[] = [];
sharedDocuments: [
{
key: 'spfx_presentation.pptx',
text: 'SPFx for the masses'
},
{
key: 'hello-world.spapp',
text: 'hello-world.spapp'
}
],
myDocuments: [
{
key: 'clippy_cv.docx',
text: 'Clippy CV'
},
{
key: 'clippy_expenses.xlsx',
text: 'Clippy Expenses'
}
]
};
resolve(items[wp.properties.list]);
}, 2000);
// uncomment to load items from the current list response.forEach((item: IListItem) => {
// this.context.httpClient.get(this.context.pageContext.web.absoluteUrl + `/_api/web/lists('${this.properties.list}')/items?$select=Id,Title`, { options.push({"key": item.Id, "text": item.Title});
// headers: { });
// 'Accept': 'application/json;odata=nometadata',
// 'odata-version': '' resolve(options);
// } });
// })
// .then((response: Response): Promise<{ value: IListInfo[] }> => {
// return response.json();
// })
// .then((listsResponse: { value: IListInfo[] }): void => {
// resolve(listsResponse.value.map((value: IListInfo, index: number, array: IListInfo[]): IDropdownOption => {
// return {
// key: value.Id,
// text: value.Title
// };
// }));
// }, (error: any): void => {
// reject(error);
// });
}); });
} }
private needsConfiguration(): boolean {
return this.properties.list === null ||
this.properties.list === undefined ||
this.properties.list.trim().length === 0 ||
this.properties.item === null ||
this.properties.item === undefined ||
this.properties.item.toString().trim().length === 0;
}
private configureWebPart(): void {
this.context.propertyPane.open();
}
} }

View File

@ -0,0 +1,28 @@
import * as React from 'react';
import { Fabric } from 'office-ui-fabric-react';
import { DisplayMode } from '@microsoft/sp-core-library';
import { Placeholder } from '@microsoft/sp-webpart-base';
import { IConfigProps } from './IConfigProps';
export class Config extends React.Component<IConfigProps, {}> {
public render(): JSX.Element {
return (
<Fabric>
{ this.props.displayMode === DisplayMode.Edit &&
<Placeholder
icon="ms-Icon--CheckboxComposite"
iconText="Custom Properties"
description="Set custom properties."
buttonLabel="Configure"
onAdd={ this.props.configure } />
}
{ this.props.displayMode === DisplayMode.Read &&
<Placeholder
icon="ms-ICon--CheckboxComposite"
iconText="Custom Properties"
description="Set custom properties." />
}
</Fabric>
);
}
}

View File

@ -0,0 +1,6 @@
import { DisplayMode } from '@microsoft/sp-core-library';
export interface IConfigProps {
displayMode: DisplayMode;
configure: () => void;
}

View File

@ -0,0 +1,41 @@
import * as React from 'react';
import { css } from 'office-ui-fabric-react';
import styles from '../DropdownWithRemoteDataWithoutCustomControls.module.scss';
import { IDropdownWithRemoteDataWithoutCustomControlsWebPartProps } from '../IDropdownWithRemoteDataWithoutCustomControlsWebPartProps';
export interface IDropdownWithRemoteDataWithoutCustomControlsProps extends IDropdownWithRemoteDataWithoutCustomControlsWebPartProps {
}
export default class DropdownWithRemoteDataWithoutCustomControls extends React.Component<IDropdownWithRemoteDataWithoutCustomControlsProps, {}> {
public render(): JSX.Element {
return (
<div className={styles.dropdownWithRemoteDataWithoutCustomControls}>
<div className={styles.container}>
<div className={css('ms-Grid-row ms-bgColor-themeDark ms-fontColor-white', styles.row)}>
<div className='ms-Grid-col ms-u-lg10 ms-u-xl8 ms-u-xlPush2 ms-u-lgPush1'>
<span className='ms-font-xl ms-fontColor-white'>
Welcome to SharePoint!
</span>
<p className='ms-font-l ms-fontColor-white'>
Customize SharePoint experiences using Web Parts.
</p>
<p className='ms-font-l ms-fontColor-white'>
Selected list ID: {this.props.list || 'no list selected'}
</p>
<p className='ms-font-l ms-fontColor-white'>
Selected item ID: {this.props.item || 'no item selected'}
</p>
<a
className={css('ms-Button', styles.button)}
href='https://github.com/SharePoint/sp-dev-docs/wiki'
>
<span className='ms-Button-label'>Learn more</span>
</a>
</div>
</div>
</div>
</div>
);
}
}

View File

@ -0,0 +1,52 @@
.dropdownWithRemoteDataWithoutCustomControls {
.container {
max-width: 700px;
margin: 0px auto;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
}
.row {
padding: 20px;
}
.listItem {
max-width: 715px;
margin: 5px auto 5px auto;
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
}
.button {
// Our button
text-decoration: none;
height: 32px;
// Primary Button
min-width: 80px;
background-color: #0078d7;
border-color: #0078d7;
color: #ffffff;
// Basic Button
outline: transparent;
position: relative;
font-family: "Segoe UI WestEuropean","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;
-webkit-font-smoothing: antialiased;
font-size: 14px;
font-weight: 400;
border-width: 0;
text-align: center;
cursor: pointer;
display: inline-block;
padding: 0 16px;
.label {
font-weight: 600;
font-size: 14px;
height: 32px;
line-height: 32px;
margin: 0 4px;
vertical-align: top;
display: inline-block;
}
}
}

View File

@ -1,40 +1,41 @@
import * as React from 'react'; import * as React from 'react';
import { css } from 'office-ui-fabric-react';
import styles from '../DropdownWithRemoteDataWithoutCustomControls.module.scss'; import styles from './DropdownWithRemoteDataWithoutCustomControls.module.scss';
import { IDropdownWithRemoteDataWithoutCustomControlsWebPartProps } from '../IDropdownWithRemoteDataWithoutCustomControlsWebPartProps'; import { IDropdownWithRemoteDataWithoutCustomControlsProps } from './IDropdownWithRemoteDataWithoutCustomControlsProps';
export interface IDropdownWithRemoteDataWithoutCustomControlsProps extends IDropdownWithRemoteDataWithoutCustomControlsWebPartProps { import { Config } from './Config';
}
export default class DropdownWithRemoteDataWithoutCustomControls extends React.Component<IDropdownWithRemoteDataWithoutCustomControlsProps, void> {
public render(): React.ReactElement<IDropdownWithRemoteDataWithoutCustomControlsProps> {
const { needsConfiguration, configureWebPart} = this.props;
export default class DropdownWithRemoteDataWithoutCustomControls extends React.Component<IDropdownWithRemoteDataWithoutCustomControlsProps, {}> {
public render(): JSX.Element {
return ( return (
<div className={styles.dropdownWithRemoteDataWithoutCustomControls}> <div className={styles.dropdownWithRemoteDataWithoutCustomControls}>
<div className={styles.container}> { needsConfiguration &&
<div className={css('ms-Grid-row ms-bgColor-themeDark ms-fontColor-white', styles.row)}> <Config configure={configureWebPart} {...this.props} />
<div className='ms-Grid-col ms-u-lg10 ms-u-xl8 ms-u-xlPush2 ms-u-lgPush1'> }
<span className='ms-font-xl ms-fontColor-white'> { needsConfiguration === false &&
Welcome to SharePoint! <div className={styles.container}>
</span> <div className={`ms-Grid-row ms-bgColor-themeDark ms-fontColor-white ${styles.row}`}>
<p className='ms-font-l ms-fontColor-white'> <div className="ms-Grid-col ms-u-lg10 ms-u-xl8 ms-u-xlPush2 ms-u-lgPush1">
Customize SharePoint experiences using Web Parts. <span className="ms-font-xl ms-fontColor-white">Welcome to SharePoint!</span>
</p> <p className="ms-font-l ms-fontColor-white">Customize SharePoint experiences using Web Parts.</p>
<p className='ms-font-l ms-fontColor-white'>
Selected list ID: {this.props.list || 'no list selected'} <p className='ms-font-l ms-fontColor-white'>
</p> Selected list ID: {this.props.list || 'no list selected'}
<p className='ms-font-l ms-fontColor-white'> </p>
Selected item ID: {this.props.item || 'no item selected'} <p className='ms-font-l ms-fontColor-white'>
</p> Selected item ID: {this.props.item || 'no item selected'}
<a </p>
className={css('ms-Button', styles.button)}
href='https://github.com/SharePoint/sp-dev-docs/wiki' <a href="https://aka.ms/spfx" className={styles.button}>
> <span className={styles.label}>Learn more</span>
<span className='ms-Button-label'>Learn more</span> </a>
</a> </div>
</div> </div>
</div> </div>
</div> }
</div> </div>
); );
} }

View File

@ -0,0 +1,9 @@
import { DisplayMode } from '@microsoft/sp-core-library';
export interface IDropdownWithRemoteDataWithoutCustomControlsProps {
list: string;
item: string;
needsConfiguration: boolean;
configureWebPart: () => void;
displayMode: DisplayMode;
}

View File

@ -1,4 +1,4 @@
export interface IListInfo { export interface IList {
Id: string; Id: string;
Title: string; Title: string;
} }

View File

@ -0,0 +1,4 @@
export interface IListItem {
Id: number;
Title: string;
}

View File

@ -0,0 +1,7 @@
import { IList } from './IList';
import { IListItem } from './IListItem';
export interface IListService {
getLists: () => Promise<IList[]>;
getList: (listName: string) => Promise<IListItem[]>;
}

View File

@ -0,0 +1,63 @@
import { IListService, IList, IListItem } from '../services';
import {
SPHttpClient,
ISPHttpClientOptions,
SPHttpClientResponse
} from '@microsoft/sp-http';
import {
IWebPartContext
} from '@microsoft/sp-webpart-base';
export class ListService implements IListService {
constructor(private context: IWebPartContext) {
}
public getLists(): Promise<IList[]> {
var httpClientOptions : ISPHttpClientOptions = {};
httpClientOptions.headers = {
'Accept': 'application/json;odata=nometadata',
'odata-version': ''
};
return new Promise<IList[]>((resolve: (results: IList[]) => void, reject: (error: any) => void): void => {
this.context.spHttpClient.get(this.context.pageContext.web.serverRelativeUrl + `/_api/web/lists?$select=id,title`,
SPHttpClient.configurations.v1,
httpClientOptions
)
.then((response: SPHttpClientResponse): Promise<{ value: IList[] }> => {
return response.json();
})
.then((lists: { value: IList[] }): void => {
resolve(lists.value);
}, (error: any): void => {
reject(error);
});
});
}
public getList(listName: string): Promise<IListItem[]> {
var httpClientOptions : ISPHttpClientOptions = {};
httpClientOptions.headers = {
'Accept': 'application/json;odata=nometadata',
'odata-version': ''
};
return new Promise<IListItem[]>((resolve: (results: IListItem[]) => void, reject: (error: any) => void): void => {
this.context.spHttpClient.get(this.context.pageContext.web.serverRelativeUrl + `/_api/web/lists('${listName}')/items?$select=Id,Title`,
SPHttpClient.configurations.v1,
httpClientOptions
)
.then((response: SPHttpClientResponse): Promise<{ value: IListItem[] }> => {
return response.json();
})
.then((listItems: { value: IListItem[] }): void => {
resolve(listItems.value);
}, (error: any): void => {
reject(error);
});
});
}
}

View File

@ -0,0 +1,60 @@
import { IListService, IList, IListItem } from '../services';
export class MockListService implements IListService {
private lists: IList[];
private items: any;
constructor() {
this.lists = [
{
Id: "sharedDocuments",
Title: 'Shared Documents'
},
{
Id: "myDocuments",
Title: 'My Documents'
}
];
this.items = {
sharedDocuments: [
{
Id: 'spfx_presentation.pptx',
Title: 'SPFx for the masses'
},
{
Id: 'hello-world.spapp',
Title: 'hello-world.spapp'
}
],
myDocuments: [
{
Id: 'clippy_cv.docx',
Title: 'Clippy CV'
},
{
Id: 'clippy_expenses.xlsx',
Title: 'Clippy Expenses'
}
]
};
}
public getLists(): Promise<IList[]> {
return new Promise<IList[]>(resolve => {
setTimeout(() => {
resolve(this.lists);
}, 1000);
});
}
public getList(listName: string): Promise<IListItem[]> {
return new Promise<IListItem[]>(resolve => {
setTimeout(() => {
resolve(this.items[listName]);
}, 1000);
});
}
}

View File

@ -0,0 +1,5 @@
export * from './IListService';
export * from './IList';
export * from './IListItem';
export * from './ListService';
export * from './MockListService';

View File

@ -1,3 +1,5 @@
/// <reference types="mocha" />
import * as assert from 'assert'; import * as assert from 'assert';
describe('DropdownWithRemoteDataWithoutCustomControlsWebPart', () => { describe('DropdownWithRemoteDataWithoutCustomControlsWebPart', () => {

View File

@ -1,9 +1,15 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es5",
"forceConsistentCasingInFileNames": true,
"module": "commonjs", "module": "commonjs",
"jsx": "react", "jsx": "react",
"declaration": true, "declaration": true,
"sourceMap": true "sourceMap": true,
"types": [
"es6-promise",
"es6-collections",
"webpack-env"
]
} }
} }

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 +1,8 @@
// Type definitions for Microsoft ODSP projects // Type definitions for Microsoft ODSP projects
// Project: ODSP // Project: ODSP
/// <reference path="odsp-webpack.d.ts" /> /* Global definition for UNIT_TEST builds
Code that is wrapped inside an if(UNIT_TEST) {...}
/* Global definition for DEBUG builds */ block will not be included in the final bundle when the
declare const DEBUG: boolean; --ship flag is specified */
/* Global definition for UNIT_TEST builds */
declare const UNIT_TEST: boolean; declare const UNIT_TEST: boolean;

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

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,18 +1 @@
/// <reference path="@ms/odsp.d.ts" /> /// <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" />

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;