Upgrade to SPFX RC0 (#119)
* rc0 * rc0 * more rc0 * rc0 * RC0 Done * cleanup manifest
This commit is contained in:
parent
aaa088761a
commit
1654fc8f8f
|
@ -7,14 +7,6 @@
|
|||
}
|
||||
],
|
||||
"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-webpart-base": "node_modules/@microsoft/sp-webpart-base/dist/sp-webpart-base.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": {
|
||||
"spfxReactGridStrings": "webparts/spfxReactGrid/loc/{locale}.js"
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
test/
|
||||
.travis.yml
|
|
@ -0,0 +1,126 @@
|
|||
2.4.0 / 2016-09-15
|
||||
------------------
|
||||
### Changed
|
||||
- added optional support for `graceful-fs` [#62]
|
||||
|
||||
2.3.1 / 2016-05-13
|
||||
------------------
|
||||
- fix to support BOM. [#45][#45]
|
||||
|
||||
2.3.0 / 2016-04-16
|
||||
------------------
|
||||
- add `throws` to `readFile()`. See [#39][#39]
|
||||
- add support for any arbitrary `fs` module. Useful with [mock-fs](https://www.npmjs.com/package/mock-fs)
|
||||
|
||||
2.2.3 / 2015-10-14
|
||||
------------------
|
||||
- include file name in parse error. See: https://github.com/jprichardson/node-jsonfile/pull/34
|
||||
|
||||
2.2.2 / 2015-09-16
|
||||
------------------
|
||||
- split out tests into separate files
|
||||
- fixed `throws` when set to `true` in `readFileSync()`. See: https://github.com/jprichardson/node-jsonfile/pull/33
|
||||
|
||||
2.2.1 / 2015-06-25
|
||||
------------------
|
||||
- fixed regression when passing in string as encoding for options in `writeFile()` and `writeFileSync()`. See: https://github.com/jprichardson/node-jsonfile/issues/28
|
||||
|
||||
2.2.0 / 2015-06-25
|
||||
------------------
|
||||
- added `options.spaces` to `writeFile()` and `writeFileSync()`
|
||||
|
||||
2.1.2 / 2015-06-22
|
||||
------------------
|
||||
- fixed if passed `readFileSync(file, 'utf8')`. See: https://github.com/jprichardson/node-jsonfile/issues/25
|
||||
|
||||
2.1.1 / 2015-06-19
|
||||
------------------
|
||||
- fixed regressions if `null` is passed for options. See: https://github.com/jprichardson/node-jsonfile/issues/24
|
||||
|
||||
2.1.0 / 2015-06-19
|
||||
------------------
|
||||
- cleanup: JavaScript Standard Style, rename files, dropped terst for assert
|
||||
- methods now support JSON revivers/replacers
|
||||
|
||||
2.0.1 / 2015-05-24
|
||||
------------------
|
||||
- update license attribute https://github.com/jprichardson/node-jsonfile/pull/21
|
||||
|
||||
2.0.0 / 2014-07-28
|
||||
------------------
|
||||
* added `\n` to end of file on write. [#14](https://github.com/jprichardson/node-jsonfile/pull/14)
|
||||
* added `options.throws` to `readFileSync()`
|
||||
* dropped support for Node v0.8
|
||||
|
||||
1.2.0 / 2014-06-29
|
||||
------------------
|
||||
* removed semicolons
|
||||
* bugfix: passed `options` to `fs.readFile` and `fs.readFileSync`. This technically changes behavior, but
|
||||
changes it according to docs. [#12][#12]
|
||||
|
||||
1.1.1 / 2013-11-11
|
||||
------------------
|
||||
* fixed catching of callback bug (ffissore / #5)
|
||||
|
||||
1.1.0 / 2013-10-11
|
||||
------------------
|
||||
* added `options` param to methods, (seanodell / #4)
|
||||
|
||||
1.0.1 / 2013-09-05
|
||||
------------------
|
||||
* removed `homepage` field from package.json to remove NPM warning
|
||||
|
||||
1.0.0 / 2013-06-28
|
||||
------------------
|
||||
* added `.npmignore`, #1
|
||||
* changed spacing default from `4` to `2` to follow Node conventions
|
||||
|
||||
0.0.1 / 2012-09-10
|
||||
------------------
|
||||
* Initial release.
|
||||
|
||||
[#45]: https://github.com/jprichardson/node-jsonfile/issues/45 "Reading of UTF8-encoded (w/ BOM) files fails"
|
||||
[#44]: https://github.com/jprichardson/node-jsonfile/issues/44 "Extra characters in written file"
|
||||
[#43]: https://github.com/jprichardson/node-jsonfile/issues/43 "Prettyfy json when written to file"
|
||||
[#42]: https://github.com/jprichardson/node-jsonfile/pull/42 "Moved fs.readFileSync within the try/catch"
|
||||
[#41]: https://github.com/jprichardson/node-jsonfile/issues/41 "Linux: Hidden file not working"
|
||||
[#40]: https://github.com/jprichardson/node-jsonfile/issues/40 "autocreate folder doesnt work from Path-value"
|
||||
[#39]: https://github.com/jprichardson/node-jsonfile/pull/39 "Add `throws` option for readFile (async)"
|
||||
[#38]: https://github.com/jprichardson/node-jsonfile/pull/38 "Update README.md writeFile[Sync] signature"
|
||||
[#37]: https://github.com/jprichardson/node-jsonfile/pull/37 "support append file"
|
||||
[#36]: https://github.com/jprichardson/node-jsonfile/pull/36 "Add typescript definition file."
|
||||
[#35]: https://github.com/jprichardson/node-jsonfile/pull/35 "Add typescript definition file."
|
||||
[#34]: https://github.com/jprichardson/node-jsonfile/pull/34 "readFile JSON parse error includes filename"
|
||||
[#33]: https://github.com/jprichardson/node-jsonfile/pull/33 "fix throw->throws typo in readFileSync()"
|
||||
[#32]: https://github.com/jprichardson/node-jsonfile/issues/32 "readFile & readFileSync can possible have strip-comments as an option?"
|
||||
[#31]: https://github.com/jprichardson/node-jsonfile/pull/31 "[Modify] Support string include is unicode escape string"
|
||||
[#30]: https://github.com/jprichardson/node-jsonfile/issues/30 "How to use Jsonfile package in Meteor.js App?"
|
||||
[#29]: https://github.com/jprichardson/node-jsonfile/issues/29 "writefile callback if no error?"
|
||||
[#28]: https://github.com/jprichardson/node-jsonfile/issues/28 "writeFile options argument broken "
|
||||
[#27]: https://github.com/jprichardson/node-jsonfile/pull/27 "Use svg instead of png to get better image quality"
|
||||
[#26]: https://github.com/jprichardson/node-jsonfile/issues/26 "Breaking change to fs-extra"
|
||||
[#25]: https://github.com/jprichardson/node-jsonfile/issues/25 "support string encoding param for read methods"
|
||||
[#24]: https://github.com/jprichardson/node-jsonfile/issues/24 "readFile: Passing in null options with a callback throws an error"
|
||||
[#23]: https://github.com/jprichardson/node-jsonfile/pull/23 "Add appendFile and appendFileSync"
|
||||
[#22]: https://github.com/jprichardson/node-jsonfile/issues/22 "Default value for spaces in readme.md is outdated"
|
||||
[#21]: https://github.com/jprichardson/node-jsonfile/pull/21 "Update license attribute"
|
||||
[#20]: https://github.com/jprichardson/node-jsonfile/issues/20 "Add simple caching functionallity"
|
||||
[#19]: https://github.com/jprichardson/node-jsonfile/pull/19 "Add appendFileSync method"
|
||||
[#18]: https://github.com/jprichardson/node-jsonfile/issues/18 "Add updateFile and updateFileSync methods"
|
||||
[#17]: https://github.com/jprichardson/node-jsonfile/issues/17 "seem read & write sync has sequentially problem"
|
||||
[#16]: https://github.com/jprichardson/node-jsonfile/pull/16 "export spaces defaulted to null"
|
||||
[#15]: https://github.com/jprichardson/node-jsonfile/issues/15 "`jsonfile.spaces` should default to `null`"
|
||||
[#14]: https://github.com/jprichardson/node-jsonfile/pull/14 "Add EOL at EOF"
|
||||
[#13]: https://github.com/jprichardson/node-jsonfile/issues/13 "Add a final newline"
|
||||
[#12]: https://github.com/jprichardson/node-jsonfile/issues/12 "readFile doesn't accept options"
|
||||
[#11]: https://github.com/jprichardson/node-jsonfile/pull/11 "Added try,catch to readFileSync"
|
||||
[#10]: https://github.com/jprichardson/node-jsonfile/issues/10 "No output or error from writeFile"
|
||||
[#9]: https://github.com/jprichardson/node-jsonfile/pull/9 "Change 'js' to 'jf' in example."
|
||||
[#8]: https://github.com/jprichardson/node-jsonfile/pull/8 "Updated forgotten module.exports to me."
|
||||
[#7]: https://github.com/jprichardson/node-jsonfile/pull/7 "Add file name in error message"
|
||||
[#6]: https://github.com/jprichardson/node-jsonfile/pull/6 "Use graceful-fs when possible"
|
||||
[#5]: https://github.com/jprichardson/node-jsonfile/pull/5 "Jsonfile doesn't behave nicely when used inside a test suite."
|
||||
[#4]: https://github.com/jprichardson/node-jsonfile/pull/4 "Added options parameter to writeFile and writeFileSync"
|
||||
[#3]: https://github.com/jprichardson/node-jsonfile/issues/3 "test2"
|
||||
[#2]: https://github.com/jprichardson/node-jsonfile/issues/2 "homepage field must be a string url. Deleted."
|
||||
[#1]: https://github.com/jprichardson/node-jsonfile/pull/1 "adding an `.npmignore` file"
|
|
@ -0,0 +1,15 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012-2015, JP Richardson <jprichardson@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
|
||||
(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
|
||||
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
||||
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,162 @@
|
|||
Node.js - jsonfile
|
||||
================
|
||||
|
||||
Easily read/write JSON files.
|
||||
|
||||
[![npm Package](https://img.shields.io/npm/v/jsonfile.svg?style=flat-square)](https://www.npmjs.org/package/jsonfile)
|
||||
[![build status](https://secure.travis-ci.org/jprichardson/node-jsonfile.svg)](http://travis-ci.org/jprichardson/node-jsonfile)
|
||||
[![windows Build status](https://img.shields.io/appveyor/ci/jprichardson/node-jsonfile/master.svg?label=windows%20build)](https://ci.appveyor.com/project/jprichardson/node-jsonfile/branch/master)
|
||||
|
||||
<a href="https://github.com/feross/standard"><img src="https://cdn.rawgit.com/feross/standard/master/sticker.svg" alt="Standard JavaScript" width="100"></a>
|
||||
|
||||
Why?
|
||||
----
|
||||
|
||||
Writing `JSON.stringify()` and then `fs.writeFile()` and `JSON.parse()` with `fs.readFile()` enclosed in `try/catch` blocks became annoying.
|
||||
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
npm install --save jsonfile
|
||||
|
||||
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
### readFile(filename, [options], callback)
|
||||
|
||||
`options` (`object`, default `undefined`): Pass in any `fs.readFile` options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse).
|
||||
- `throws` (`boolean`, default: `true`). If `JSON.parse` throws an error, pass this error to the callback.
|
||||
If `false`, returns `null` for the object.
|
||||
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
var file = '/tmp/data.json'
|
||||
jsonfile.readFile(file, function(err, obj) {
|
||||
console.dir(obj)
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
### readFileSync(filename, [options])
|
||||
|
||||
`options` (`object`, default `undefined`): Pass in any `fs.readFileSync` options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse).
|
||||
- `throws` (`boolean`, default: `true`). If `JSON.parse` throws an error, throw the error.
|
||||
If `false`, returns `null` for the object.
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
var file = '/tmp/data.json'
|
||||
|
||||
console.dir(jsonfile.readFileSync(file))
|
||||
```
|
||||
|
||||
|
||||
### writeFile(filename, obj, [options], callback)
|
||||
|
||||
`options`: Pass in any `fs.writeFile` options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces`.
|
||||
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
|
||||
var file = '/tmp/data.json'
|
||||
var obj = {name: 'JP'}
|
||||
|
||||
jsonfile.writeFile(file, obj, function (err) {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
||||
**formatting with spaces:**
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
|
||||
var file = '/tmp/data.json'
|
||||
var obj = {name: 'JP'}
|
||||
|
||||
jsonfile.writeFile(file, obj, {spaces: 2}, function(err) {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
### writeFileSync(filename, obj, [options])
|
||||
|
||||
`options`: Pass in any `fs.writeFileSync` options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces`.
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
|
||||
var file = '/tmp/data.json'
|
||||
var obj = {name: 'JP'}
|
||||
|
||||
jsonfile.writeFileSync(file, obj)
|
||||
```
|
||||
|
||||
**formatting with spaces:**
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
|
||||
var file = '/tmp/data.json'
|
||||
var obj = {name: 'JP'}
|
||||
|
||||
jsonfile.writeFileSync(file, obj, {spaces: 2})
|
||||
```
|
||||
|
||||
|
||||
|
||||
### spaces
|
||||
|
||||
Global configuration to set spaces to indent JSON files.
|
||||
|
||||
**default:** `null`
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
|
||||
jsonfile.spaces = 4
|
||||
|
||||
var file = '/tmp/data.json'
|
||||
var obj = {name: 'JP'}
|
||||
|
||||
// json file has four space indenting now
|
||||
jsonfile.writeFile(file, obj, function (err) {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
||||
Note, it's bound to `this.spaces`. So, if you do this:
|
||||
|
||||
```js
|
||||
var myObj = {}
|
||||
myObj.writeJsonSync = jsonfile.writeFileSync
|
||||
// => this.spaces = null
|
||||
```
|
||||
|
||||
Could do the following:
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
jsonfile.spaces = 4
|
||||
jsonfile.writeFileSync(file, obj) // will have 4 spaces indentation
|
||||
|
||||
var myCrazyObj = {spaces: 32}
|
||||
myCrazyObj.writeJsonSync = jsonfile.writeFileSync
|
||||
myCrazyObj.writeJsonSync(file, obj) // will have 32 space indentation
|
||||
myCrazyObj.writeJsonSync(file, obj, {spaces: 2}) // will have only 2
|
||||
```
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
(MIT License)
|
||||
|
||||
Copyright 2012-2016, JP Richardson <jprichardson@gmail.com>
|
|
@ -0,0 +1,28 @@
|
|||
# Test against this version of Node.js
|
||||
environment:
|
||||
matrix:
|
||||
# node.js
|
||||
- nodejs_version: "0.10"
|
||||
- nodejs_version: "0.12"
|
||||
- nodejs_version: "4"
|
||||
- nodejs_version: "5"
|
||||
- nodejs_version: "6"
|
||||
|
||||
# Install scripts. (runs after repo cloning)
|
||||
install:
|
||||
# Get the latest stable version of Node.js or io.js
|
||||
- ps: Install-Product node $env:nodejs_version
|
||||
# install modules
|
||||
- npm config set loglevel warn
|
||||
- npm install --silent
|
||||
|
||||
# Post-install test scripts.
|
||||
test_script:
|
||||
# Output useful info for debugging.
|
||||
- node --version
|
||||
- npm --version
|
||||
# run tests
|
||||
- npm test
|
||||
|
||||
# Don't actually build.
|
||||
build: off
|
|
@ -0,0 +1,133 @@
|
|||
var _fs
|
||||
try {
|
||||
_fs = require('graceful-fs')
|
||||
} catch (_) {
|
||||
_fs = require('fs')
|
||||
}
|
||||
|
||||
function readFile (file, options, callback) {
|
||||
if (callback == null) {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
if (typeof options === 'string') {
|
||||
options = {encoding: options}
|
||||
}
|
||||
|
||||
options = options || {}
|
||||
var fs = options.fs || _fs
|
||||
|
||||
var shouldThrow = true
|
||||
// DO NOT USE 'passParsingErrors' THE NAME WILL CHANGE!!!, use 'throws' instead
|
||||
if ('passParsingErrors' in options) {
|
||||
shouldThrow = options.passParsingErrors
|
||||
} else if ('throws' in options) {
|
||||
shouldThrow = options.throws
|
||||
}
|
||||
|
||||
fs.readFile(file, options, function (err, data) {
|
||||
if (err) return callback(err)
|
||||
|
||||
data = stripBom(data)
|
||||
|
||||
var obj
|
||||
try {
|
||||
obj = JSON.parse(data, options ? options.reviver : null)
|
||||
} catch (err2) {
|
||||
if (shouldThrow) {
|
||||
err2.message = file + ': ' + err2.message
|
||||
return callback(err2)
|
||||
} else {
|
||||
return callback(null, null)
|
||||
}
|
||||
}
|
||||
|
||||
callback(null, obj)
|
||||
})
|
||||
}
|
||||
|
||||
function readFileSync (file, options) {
|
||||
options = options || {}
|
||||
if (typeof options === 'string') {
|
||||
options = {encoding: options}
|
||||
}
|
||||
|
||||
var fs = options.fs || _fs
|
||||
|
||||
var shouldThrow = true
|
||||
// DO NOT USE 'passParsingErrors' THE NAME WILL CHANGE!!!, use 'throws' instead
|
||||
if ('passParsingErrors' in options) {
|
||||
shouldThrow = options.passParsingErrors
|
||||
} else if ('throws' in options) {
|
||||
shouldThrow = options.throws
|
||||
}
|
||||
|
||||
var content = fs.readFileSync(file, options)
|
||||
content = stripBom(content)
|
||||
|
||||
try {
|
||||
return JSON.parse(content, options.reviver)
|
||||
} catch (err) {
|
||||
if (shouldThrow) {
|
||||
err.message = file + ': ' + err.message
|
||||
throw err
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function writeFile (file, obj, options, callback) {
|
||||
if (callback == null) {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
options = options || {}
|
||||
var fs = options.fs || _fs
|
||||
|
||||
var spaces = typeof options === 'object' && options !== null
|
||||
? 'spaces' in options
|
||||
? options.spaces : this.spaces
|
||||
: this.spaces
|
||||
|
||||
var str = ''
|
||||
try {
|
||||
str = JSON.stringify(obj, options ? options.replacer : null, spaces) + '\n'
|
||||
} catch (err) {
|
||||
if (callback) return callback(err, null)
|
||||
}
|
||||
|
||||
fs.writeFile(file, str, options, callback)
|
||||
}
|
||||
|
||||
function writeFileSync (file, obj, options) {
|
||||
options = options || {}
|
||||
var fs = options.fs || _fs
|
||||
|
||||
var spaces = typeof options === 'object' && options !== null
|
||||
? 'spaces' in options
|
||||
? options.spaces : this.spaces
|
||||
: this.spaces
|
||||
|
||||
var str = JSON.stringify(obj, options.replacer, spaces) + '\n'
|
||||
// not sure if fs.writeFileSync returns anything, but just in case
|
||||
return fs.writeFileSync(file, str, options)
|
||||
}
|
||||
|
||||
function stripBom (content) {
|
||||
// we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified
|
||||
if (Buffer.isBuffer(content)) content = content.toString('utf8')
|
||||
content = content.replace(/^\uFEFF/, '')
|
||||
return content
|
||||
}
|
||||
|
||||
var jsonfile = {
|
||||
spaces: null,
|
||||
readFile: readFile,
|
||||
readFileSync: readFileSync,
|
||||
writeFile: writeFile,
|
||||
writeFileSync: writeFileSync
|
||||
}
|
||||
|
||||
module.exports = jsonfile
|
|
@ -0,0 +1,105 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"name": "jsonfile",
|
||||
"raw": "jsonfile@^2.1.0",
|
||||
"rawSpec": "^2.1.0",
|
||||
"scope": null,
|
||||
"spec": ">=2.1.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"D:\\sp-dev-fx-webparts\\samples\\react-multilist-grid\\node_modules\\fs-extra"
|
||||
]
|
||||
],
|
||||
"_from": "jsonfile@>=2.1.0 <3.0.0",
|
||||
"_id": "jsonfile@2.4.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/jsonfile",
|
||||
"_nodeVersion": "6.1.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/jsonfile-2.4.0.tgz_1473989978270_0.6271681792568415"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "jprichardson@gmail.com",
|
||||
"name": "jprichardson"
|
||||
},
|
||||
"_npmVersion": "3.8.6",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "jsonfile",
|
||||
"raw": "jsonfile@^2.1.0",
|
||||
"rawSpec": "^2.1.0",
|
||||
"scope": null,
|
||||
"spec": ">=2.1.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@microsoft/gulp-core-build/fs-extra",
|
||||
"/browser-sync/fs-extra",
|
||||
"/fs-extra",
|
||||
"/phantomjs-prebuilt/fs-extra"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
|
||||
"_shasum": "3736a2b428b87bbda0cc83b53fa3d633a35c2ae8",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "jsonfile@^2.1.0",
|
||||
"_where": "D:\\sp-dev-fx-webparts\\samples\\react-multilist-grid\\node_modules\\fs-extra",
|
||||
"author": {
|
||||
"email": "jprichardson@gmail.com",
|
||||
"name": "JP Richardson"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jprichardson/node-jsonfile/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.1.6"
|
||||
},
|
||||
"description": "Easily read/write JSON files.",
|
||||
"devDependencies": {
|
||||
"mocha": "2.x",
|
||||
"mock-fs": "^3.8.0",
|
||||
"rimraf": "^2.4.0",
|
||||
"standard": "^6.0.8"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "3736a2b428b87bbda0cc83b53fa3d633a35c2ae8",
|
||||
"tarball": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz"
|
||||
},
|
||||
"gitHead": "00b3983ac4aade79c64c7a8c2ced257078625c6d",
|
||||
"homepage": "https://github.com/jprichardson/node-jsonfile#readme",
|
||||
"keywords": [
|
||||
"read",
|
||||
"write",
|
||||
"file",
|
||||
"json",
|
||||
"fs",
|
||||
"fs-extra"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"email": "jprichardson@gmail.com",
|
||||
"name": "jprichardson"
|
||||
}
|
||||
],
|
||||
"name": "jsonfile",
|
||||
"optionalDependencies": {
|
||||
"graceful-fs": "^4.1.6"
|
||||
},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/jprichardson/node-jsonfile.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "standard",
|
||||
"test": "npm run lint && npm run unit",
|
||||
"unit": "mocha"
|
||||
},
|
||||
"version": "2.4.0"
|
||||
}
|
|
@ -6,10 +6,11 @@
|
|||
"node": ">=0.10.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/sp-client-base": "~0.4.0",
|
||||
"@microsoft/sp-client-preview": "~0.5.0",
|
||||
"@microsoft/sp-webpart-base": "^0.1.0",
|
||||
"office-ui-fabric-react": "^0.36.0",
|
||||
"@microsoft/sp-client-base": "~0.7.0",
|
||||
"@microsoft/sp-core-library": "~0.1.2",
|
||||
"@microsoft/sp-webpart-base": "^0.4.0",
|
||||
"@types/webpack-env": ">=1.12.1 <1.14.0",
|
||||
"office-ui-fabric-react": "^1.5.0",
|
||||
"react": "0.14.8",
|
||||
"react-data-grid": "^1.0.62",
|
||||
"react-dom": "0.14.8",
|
||||
|
@ -21,18 +22,22 @@
|
|||
"redux-logger": "^2.6.0",
|
||||
"redux-promise-middleware": "^4.1.0",
|
||||
"redux-thunk": "^2.1.0",
|
||||
"sp-pnp-js": "^1.0.6",
|
||||
"sp-pnp-js": "2.0.0",
|
||||
"typescript": "^2.1.5",
|
||||
"underscore": "^1.8.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@microsoft/sp-build-web": "~0.7.0",
|
||||
"@microsoft/sp-module-interfaces": "~0.4.0",
|
||||
"@microsoft/sp-webpart-workbench": "~0.5.0",
|
||||
"gulp": "~3.9.1"
|
||||
"@microsoft/sp-build-web": "~0.9.0",
|
||||
"@microsoft/sp-module-interfaces": "~0.7.0",
|
||||
"@microsoft/sp-webpart-workbench": "~0.8.0",
|
||||
"@types/chai": ">=3.4.34 <3.6.0",
|
||||
"@types/mocha": ">=2.2.33 <2.6.0",
|
||||
"gulp": "~3.9.1",
|
||||
"typescript": "^2.1.5"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "gulp bundle",
|
||||
"clean": "gulp nuke",
|
||||
"clean": "gulp clean",
|
||||
"test": "gulp test"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,26 @@
|
|||
{
|
||||
"$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json",
|
||||
|
||||
"id": "72ac17a3-8735-43ff-9a3c-3be22ac2ca00",
|
||||
"alias": "multilistgrid",
|
||||
"componentType": "WebPart",
|
||||
"version": "0.0.1",
|
||||
"manifestVersion": 2,
|
||||
|
||||
"preconfiguredEntries": [{
|
||||
"groupId": "72ac17a3-8735-43ff-9a3c-3be22ac2ca00",
|
||||
"group": { "default": "Under Development" },
|
||||
"title": { "default": "SPFX React Grid" },
|
||||
"description": { "default": "react grid sample" },
|
||||
"officeFabricIconFontName": "Page",
|
||||
"properties": {
|
||||
"description": "SPFX React Grid"
|
||||
"preconfiguredEntries": [
|
||||
{
|
||||
"groupId": "72ac17a3-8735-43ff-9a3c-3be22ac2ca00",
|
||||
"group": {
|
||||
"default": "Under Development"
|
||||
},
|
||||
"title": {
|
||||
"default": "React multi-list Grid"
|
||||
},
|
||||
"description": {
|
||||
"default": "A webpart that allows one to edit list items from multiple lists in deferrent sites in a single grid"
|
||||
},
|
||||
"officeFabricIconFontName": "Page",
|
||||
"properties": {
|
||||
"description": "SPFX React Grid"
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -2,18 +2,21 @@ import * as React from "react";
|
|||
import * as ReactDom from "react-dom";
|
||||
import { Provider } from "react-redux";
|
||||
import configureStore from "./store/configure-store";
|
||||
const { Router, createMemoryHistory } = require("react-router");
|
||||
//const { Router, createMemoryHistory } = require("react-router");
|
||||
import { Router, createMemoryHistory } from "react-router";
|
||||
import * as Redux from "redux";
|
||||
import { addColumns, removeAllColumns } from "./actions/columnActions";
|
||||
import { addLists, removeAllLists } from "./actions/listActions";
|
||||
import { PropertyFieldColumnDefinitions, IPropertyFieldColumnDefinitionsProps } from "./containers/PropertyFieldColumnDefinitions";
|
||||
import { PropertyFieldListDefinitions, IPropertyFieldListDefinitionsProps } from "./containers/PropertyFieldListDefinitions";
|
||||
import {
|
||||
BaseClientSideWebPart,
|
||||
IPropertyPaneSettings,
|
||||
IPropertyPaneConfiguration,
|
||||
IWebPartContext,
|
||||
PropertyPaneTextField
|
||||
} from "@microsoft/sp-webpart-base";
|
||||
import { Log } from "@microsoft/sp-client-base";
|
||||
debugger;
|
||||
import { Log } from "@microsoft/sp-core-library";
|
||||
import routes from "./store/routes";
|
||||
import * as strings from "spfxReactGridStrings";
|
||||
import { ISpfxReactGridWebPartProps } from "./ISpfxReactGridWebPartProps";
|
||||
|
@ -30,31 +33,32 @@ export default class SpfxReactGridWebPart extends BaseClientSideWebPart<ISpfxRea
|
|||
|
||||
private cdProps: IPropertyFieldColumnDefinitionsProps;
|
||||
private ldProps: IPropertyFieldListDefinitionsProps;
|
||||
public constructor(context: IWebPartContext) {
|
||||
super(context);
|
||||
public constructor() {
|
||||
debugger;
|
||||
super();
|
||||
this.onPropertyChange = this.onPropertyChange.bind(this);
|
||||
|
||||
this.cdProps = {
|
||||
label: strings.ColumnDefinitionFieldLabel,
|
||||
onPropertyChange: this.onPropertyChange,
|
||||
getColumnDefinitions: ()=>{
|
||||
return this.properties.columns||[];
|
||||
},
|
||||
};
|
||||
this.ldProps = {
|
||||
label: strings.ListDefinitionFieldLabel,
|
||||
onPropertyChange: this.onPropertyChange,
|
||||
getColumnDefinitions: ()=>{
|
||||
return this.properties.columns||[];
|
||||
},
|
||||
getListDefinitions:() =>{
|
||||
return this.properties.lists||[];
|
||||
},
|
||||
PageContext: this.context.pageContext
|
||||
};
|
||||
this.cdProps = {
|
||||
label: strings.ColumnDefinitionFieldLabel,
|
||||
onPropertyChange: this.onPropertyChange,
|
||||
getColumnDefinitions: () => {
|
||||
return this.properties.columns || [];
|
||||
},
|
||||
};
|
||||
this.ldProps = {
|
||||
label: strings.ListDefinitionFieldLabel,
|
||||
onPropertyChange: this.onPropertyChange,
|
||||
getColumnDefinitions: () => {
|
||||
return this.properties.columns || [];
|
||||
},
|
||||
getListDefinitions: () => {
|
||||
return this.properties.lists || [];
|
||||
},
|
||||
// PageContext: this.context.pageContext// not available in constructor
|
||||
PageContext: null
|
||||
};
|
||||
}
|
||||
public onInit<T>(): Promise<T> {
|
||||
|
||||
this.ldProps.PageContext = this.context.pageContext;
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
public render(): void {
|
||||
|
@ -63,11 +67,11 @@ export default class SpfxReactGridWebPart extends BaseClientSideWebPart<ISpfxRea
|
|||
store.dispatch(addColumns(this.properties.columns));
|
||||
|
||||
Log.verbose("SpfxReactGridWebPart", "In render of SpfxReactGridWebPart");
|
||||
ReactDom.render(App(), this.domElement);
|
||||
ReactDom.render(App(null), this.domElement);
|
||||
}
|
||||
|
||||
private onPropertyChange(propertyPath: string, oldValue: any, newValue: any) {
|
||||
|
||||
|
||||
switch (propertyPath) {
|
||||
case "ColumnDefinitions":
|
||||
this.properties.columns = newValue;
|
||||
|
@ -78,13 +82,13 @@ export default class SpfxReactGridWebPart extends BaseClientSideWebPart<ISpfxRea
|
|||
this.properties.lists = newValue;
|
||||
store.dispatch(removeAllLists());
|
||||
store.dispatch(addLists(this.properties.lists));
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
protected get propertyPaneSettings(): IPropertyPaneSettings {
|
||||
|
||||
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
|
||||
|
||||
Log.verbose("SpfxReactGridWebPart", "In propertyPaneSettings of SpfxReactGridWebPart");
|
||||
return {
|
||||
pages: [
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
} from "../constants";
|
||||
import "whatwg-fetch";
|
||||
import * as utils from "../utils/utils";
|
||||
|
||||
import * as _ from "lodash";
|
||||
import { Web, TypedHash } from "sp-pnp-js";
|
||||
import ListItem from "../model/ListItem";
|
||||
import GridRowStatus from "../Model/GridRowStatus";
|
||||
|
|
|
@ -4,6 +4,7 @@ import {
|
|||
GET_LOOKUPOPTIONS_ERROR,
|
||||
} from "../constants";
|
||||
import "whatwg-fetch";
|
||||
import * as _ from "underscore";
|
||||
import { Web } from "sp-pnp-js";
|
||||
import { LookupOptions, LookupOption, LookupOptionStatus } from "../model/LookupOptions";
|
||||
export function getLookupOptionAction(dispatch: any, lookupSite: string, lookupWebId: string, lookupListId: string, lookupField: string): any {
|
||||
|
|
|
@ -9,6 +9,7 @@ import {
|
|||
} from "../constants";
|
||||
import "whatwg-fetch";
|
||||
import * as utils from "../utils/utils";
|
||||
import * as _ from "underscore";
|
||||
import { Web as SPWeb } from "sp-pnp-js";
|
||||
import { Site as SPSite } from "sp-pnp-js";
|
||||
import { Web, WebList, WebListField } from "../model/Site";
|
||||
|
|
|
@ -5,6 +5,7 @@ import {
|
|||
} from "../constants";
|
||||
import "whatwg-fetch";
|
||||
import { Site } from "sp-pnp-js";
|
||||
import * as _ from "underscore";
|
||||
import { SiteUser, SiteUsers, SiteUsersStatus } from "../model/SiteUsers";
|
||||
export function getSiteUsersAction(dispatch: any, siteUrl: string): any {
|
||||
let siteUsers = new SiteUsers(siteUrl);
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import * as React from "react";
|
||||
import { SharePointLookupCellFormatter } from "../components/SharePointFormatters";
|
||||
const connect = require("react-redux").connect;
|
||||
//const connect = require("react-redux").connect;
|
||||
import {connect} from "react-redux";
|
||||
import * as _ from "lodash";
|
||||
import { addColumn, removeColumn, removeAllColumns, moveCulumnUp, moveCulumnDown } from "../actions/columnActions";
|
||||
import ColumnDefinition from "../model/ColumnDefinition";
|
||||
import { Button, ButtonType, TextField, CommandBar, Dropdown, IDropdownOption, Toggle } from "office-ui-fabric-react";
|
||||
import Container from "../components/container";
|
||||
import { Guid, Log } from "@microsoft/sp-client-base";
|
||||
import { Guid, Log } from "@microsoft/sp-core-library";
|
||||
/** NOTE:
|
||||
* To enable other column types
|
||||
* 1. Uncomment it here
|
||||
|
@ -15,7 +17,7 @@ import { Guid, Log } from "@microsoft/sp-client-base";
|
|||
* 4. If any other data is needed to render the contents in an editable mode (maybe Managed Metadata) Add a case in the Containers\ListItemContaine\toggleEditing
|
||||
* method to get the data. Also will need to add another enitity to the store (actions, reducers, etc.)
|
||||
* 5. Special logic may be needed when moving an item between lists (as in the cas of Users ). Add this to Containers\ListItemContaine\mapOldListFieldsToNewListFields
|
||||
*
|
||||
*
|
||||
*/
|
||||
const fieldTypes: Array<IDropdownOption> = [
|
||||
{ key: null, text: "(Selecte one)" },
|
||||
|
@ -57,7 +59,7 @@ export interface IColumnsPageProps extends React.Props<any> {
|
|||
save: () => void;
|
||||
}
|
||||
interface IContextMenu extends React.Props<any> {
|
||||
onRowDelete: AdazzleReactDataGrid.ColumnEventCallback;
|
||||
// onRowDelete: AdazzleReactDataGrid.ColumnEventCallback;
|
||||
}
|
||||
function mapStateToProps(state) {
|
||||
return {
|
||||
|
@ -156,8 +158,8 @@ export class ColumnDefinitionContainerNative extends React.Component<IColumnsPag
|
|||
}
|
||||
private handleCellUpdated(value) { // Office UI Fabric does not use events. It just calls this method with the new value
|
||||
let {entityid, columnid} = this.state.editing;
|
||||
const entity: ColumnDefinition = this.props.columns.find((temp) => temp.guid === entityid);
|
||||
const column = this.gridColulumns.find(temp => temp.id === columnid);
|
||||
const entity: ColumnDefinition =_.find( this.props.columns,(temp) => temp.guid === entityid);
|
||||
const column = _.find(this.gridColulumns,(temp )=> temp.id === columnid);
|
||||
entity[column.name] = value;
|
||||
// this.props.saveColumn(entity);
|
||||
|
||||
|
@ -169,7 +171,7 @@ export class ColumnDefinitionContainerNative extends React.Component<IColumnsPag
|
|||
const target = this.getParent(event.target, "TD");
|
||||
const attributes: NamedNodeMap = target.attributes;
|
||||
const entityId = attributes.getNamedItem("data-entityid").value;
|
||||
const column: ColumnDefinition = this.props.columns.find(cd => cd.guid === entityId);
|
||||
const column: ColumnDefinition =_.find( this.props.columns,cd => cd.guid === entityId);
|
||||
this.props.moveColumnUp(column);
|
||||
return;
|
||||
}
|
||||
|
@ -179,7 +181,7 @@ export class ColumnDefinitionContainerNative extends React.Component<IColumnsPag
|
|||
const target = this.getParent(event.target, "TD");
|
||||
const attributes: NamedNodeMap = target.attributes;
|
||||
const entityId = attributes.getNamedItem("data-entityid").value;
|
||||
const column: ColumnDefinition = this.props.columns.find(cd => cd.guid === entityId);
|
||||
const column: ColumnDefinition = _.find(this.props.columns,cd => cd.guid === entityId);
|
||||
this.props.moveColumnDown(column);
|
||||
return;
|
||||
}
|
||||
|
@ -189,7 +191,7 @@ export class ColumnDefinitionContainerNative extends React.Component<IColumnsPag
|
|||
const target = this.getParent(event.target, "TD");
|
||||
const attributes: NamedNodeMap = target.attributes;
|
||||
const entityId = attributes.getNamedItem("data-entityid").value;
|
||||
const column: ColumnDefinition = this.props.columns.find(cd => cd.guid === entityId);
|
||||
const column: ColumnDefinition = _.find(this.props.columns,cd => cd.guid === entityId);
|
||||
this.props.removeColumn(column);
|
||||
return;
|
||||
}
|
||||
|
@ -207,7 +209,7 @@ export class ColumnDefinitionContainerNative extends React.Component<IColumnsPag
|
|||
const columnid = attributes.getNamedItem("data-columnid").value;
|
||||
this.setState({ "editing": { entityid: entityid, columnid: columnid } });
|
||||
}
|
||||
public CellContentsEditable(props: { entity: ColumnDefinition, gridColumn: GridColumn, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent) => void; }): JSX.Element {
|
||||
public CellContentsEditable(props: { entity: ColumnDefinition, gridColumn: GridColumn, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent<any>) => void; }): JSX.Element {
|
||||
const {entity, gridColumn, cellUpdated, cellUpdatedEvent} = props;
|
||||
if (!gridColumn.editable) {
|
||||
return (<span>
|
||||
|
@ -274,7 +276,7 @@ export class ColumnDefinitionContainerNative extends React.Component<IColumnsPag
|
|||
);
|
||||
}
|
||||
}
|
||||
public TableRow(props: { isFirst: boolean, isLast: boolean, entity: ColumnDefinition, columns: Array<GridColumn>, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent) => void; }): JSX.Element {
|
||||
public TableRow(props: { isFirst: boolean, isLast: boolean, entity: ColumnDefinition, columns: Array<GridColumn>, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent<any>) => void; }): JSX.Element {
|
||||
const {entity, columns, cellUpdated, cellUpdatedEvent, isLast, isFirst} = props;
|
||||
return (
|
||||
<tr>
|
||||
|
@ -303,7 +305,7 @@ export class ColumnDefinitionContainerNative extends React.Component<IColumnsPag
|
|||
</td>
|
||||
</tr>);
|
||||
};
|
||||
public TableRows(props: { entities: Array<ColumnDefinition>, columns: Array<GridColumn>, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent) => void; }): JSX.Element {
|
||||
public TableRows(props: { entities: Array<ColumnDefinition>, columns: Array<GridColumn>, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent<any>) => void; }): JSX.Element {
|
||||
const {entities, columns, cellUpdated, cellUpdatedEvent} = props;
|
||||
return (
|
||||
<tbody>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import * as React from "react";
|
||||
import * as utils from "../utils/utils";
|
||||
const connect = require("react-redux").connect;
|
||||
//const connect = require("react-redux").connect;
|
||||
import {connect} from "react-redux";
|
||||
import * as _ from "lodash";
|
||||
import { SharePointLookupCellFormatter } from "../components/SharePointFormatters";
|
||||
import WebEditor from "../components/WebEditor";
|
||||
import ListEditor from "../components/ListEditor";
|
||||
|
@ -13,7 +15,8 @@ import { ColumnReference } from "../model/ListDefinition";
|
|||
import { Site, Web, WebList, WebListField } from "../model/Site";
|
||||
import ColumnDefinition from "../model/ColumnDefinition";
|
||||
import Container from "../components/container";
|
||||
import { Guid, Log, PageContext } from "@microsoft/sp-client-base";
|
||||
import { Guid, Log } from "@microsoft/sp-core-library";
|
||||
import { PageContext } from "@microsoft/sp-page-context";
|
||||
export class GridColumn {
|
||||
constructor(
|
||||
public id: string,
|
||||
|
@ -192,8 +195,8 @@ export class ListDefinitionContainerNative extends React.Component<IListViewPage
|
|||
}
|
||||
private handleCellUpdated(value) { // Office UI Fabric does not use events. It just calls this method with the new value
|
||||
const {entityid, columnid} = this.state.editing;
|
||||
const entity: ListDefinition = this.props.lists.find((temp) => temp.guid === entityid);
|
||||
const column = this.extendedColumns.find(temp => temp.id === columnid);
|
||||
const entity: ListDefinition = _.find(this.props.lists,(temp) => temp.guid === entityid);
|
||||
const column = _.find(this.extendedColumns,temp => temp.id === columnid);
|
||||
// if it is a default column, just set its value , otheriwse update it in the list of extended columns (i.e. sharepoint columns)
|
||||
if (this.isdeafaultColumn(columnid)) {
|
||||
/** need to save the web url if the web column was updated
|
||||
|
@ -221,7 +224,7 @@ export class ListDefinitionContainerNative extends React.Component<IListViewPage
|
|||
const target = this.getParent(event.target, "TD");
|
||||
const attributes: NamedNodeMap = target.attributes;
|
||||
const entity = attributes.getNamedItem("data-entityid").value;
|
||||
const list: ListDefinition = this.props.lists.find(temp => temp.guid === entity);
|
||||
const list: ListDefinition = _.find(this.props.lists,temp => temp.guid === entity);
|
||||
this.props.removeList(list);
|
||||
return;
|
||||
}
|
||||
|
@ -306,7 +309,7 @@ export class ListDefinitionContainerNative extends React.Component<IListViewPage
|
|||
const columnid = attributes.getNamedItem("data-columnid").value;
|
||||
this.setState({ "editing": { entityid: entityid, columnid: columnid } });
|
||||
}
|
||||
public CellContentsEditable(props: { entity: ListDefinition, column: GridColumn, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent) => void; }): JSX.Element {
|
||||
public CellContentsEditable(props: { entity: ListDefinition, column: GridColumn, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent<any>) => void; }): JSX.Element {
|
||||
const {entity, column, cellUpdated, cellUpdatedEvent} = props;
|
||||
let columnValue;
|
||||
if (this.isdeafaultColumn(column.id)) {
|
||||
|
@ -323,7 +326,7 @@ export class ListDefinitionContainerNative extends React.Component<IListViewPage
|
|||
switch (column.editor) {
|
||||
|
||||
case "WebEditor":
|
||||
|
||||
|
||||
let webs = this.getWebsForSite(entity);
|
||||
return (<WebEditor webs={webs} selectedValue={columnValue} onChange={cellUpdated} />);
|
||||
case "ListEditor":
|
||||
|
@ -359,7 +362,7 @@ export class ListDefinitionContainerNative extends React.Component<IListViewPage
|
|||
);
|
||||
}
|
||||
else {
|
||||
const colref = entity.columnReferences.find(cr => cr.columnDefinitionId === column.id);
|
||||
const colref = _.find(entity.columnReferences,cr => cr.columnDefinitionId === column.id);
|
||||
let displaytext = "";
|
||||
if (colref != null) {
|
||||
displaytext = utils.ParseSPField(colref.name).value;
|
||||
|
@ -372,7 +375,7 @@ export class ListDefinitionContainerNative extends React.Component<IListViewPage
|
|||
}
|
||||
}
|
||||
|
||||
public TableDetail(props: { entity: ListDefinition, column: GridColumn, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent) => void; }): JSX.Element {
|
||||
public TableDetail(props: { entity: ListDefinition, column: GridColumn, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent<any>) => void; }): JSX.Element {
|
||||
const {entity, column, cellUpdated, cellUpdatedEvent} = props;
|
||||
|
||||
if (this.state && this.state.editing && this.state.editing.entityid === entity.guid && this.state.editing.columnid === column.id) {
|
||||
|
@ -387,7 +390,7 @@ export class ListDefinitionContainerNative extends React.Component<IListViewPage
|
|||
);
|
||||
}
|
||||
}
|
||||
public TableRow(props: { entity: ListDefinition, columns: Array<GridColumn>, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent) => void; }): JSX.Element {
|
||||
public TableRow(props: { entity: ListDefinition, columns: Array<GridColumn>, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent<any>) => void; }): JSX.Element {
|
||||
const {entity, columns, cellUpdated, cellUpdatedEvent} = props;
|
||||
|
||||
return (
|
||||
|
@ -408,7 +411,7 @@ export class ListDefinitionContainerNative extends React.Component<IListViewPage
|
|||
</td>
|
||||
</tr>);
|
||||
};
|
||||
public TableRows(props: { entities: Array<ListDefinition>, columns: Array<GridColumn>, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent) => void; }): JSX.Element {
|
||||
public TableRows(props: { entities: Array<ListDefinition>, columns: Array<GridColumn>, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent<any>) => void; }): JSX.Element {
|
||||
const {entities, columns, cellUpdated, cellUpdatedEvent} = props;
|
||||
return (
|
||||
<tbody>
|
||||
|
@ -424,7 +427,7 @@ export class ListDefinitionContainerNative extends React.Component<IListViewPage
|
|||
}
|
||||
|
||||
public render() {
|
||||
|
||||
|
||||
return (
|
||||
<Container testid="columns" size={2} center>
|
||||
<CommandBar items={[{
|
||||
|
@ -455,7 +458,7 @@ export class ListDefinitionContainerNative extends React.Component<IListViewPage
|
|||
onClick: this.props.save
|
||||
}]} />
|
||||
|
||||
<table border="1">
|
||||
<table >
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import * as utils from "../utils/utils";
|
||||
import * as React from "react";
|
||||
|
||||
const connect = require("react-redux").connect;
|
||||
//const connect = require("react-redux").connect;
|
||||
import {connect} from "react-redux";
|
||||
import * as _ from "lodash";
|
||||
import {
|
||||
addListItem, removeListItem, getListItemsAction, saveListItemAction,
|
||||
undoListItemChangesAction, updateListItemAction,
|
||||
|
@ -20,7 +22,7 @@ import { CommandBar } from "office-ui-fabric-react/lib/CommandBar";
|
|||
import { DatePicker, IDatePickerStrings } from "office-ui-fabric-react/lib/DatePicker";
|
||||
|
||||
import Container from "../components/container";
|
||||
import { Log } from "@microsoft/sp-client-base";
|
||||
import { Log } from "@microsoft/sp-core-library";
|
||||
|
||||
interface IListViewPageProps extends React.Props<any> {
|
||||
/** An array of ListItems fetched from sharepoint */
|
||||
|
@ -156,7 +158,7 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
const parentTD = this.getParent(event.target, "TD");
|
||||
const attributes: NamedNodeMap = parentTD.attributes;
|
||||
const entityid = attributes.getNamedItem("data-entityid").value; // theid of the SPListItem
|
||||
const listItem: ListItem = this.props.listItems.find((temp) => temp.GUID === entityid); // the listItemItself
|
||||
const listItem: ListItem = _.find( this.props.listItems,(temp) => temp.GUID === entityid); // the listItemItself
|
||||
const listDef = this.getListDefinition(listItem.__metadata__ListDefinitionId);// The list Definition this item is associated with.
|
||||
this.props.removeListItem(listItem, listDef);
|
||||
}
|
||||
|
@ -206,10 +208,10 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
/**
|
||||
* Need to fire events here to get data needed for the rerender
|
||||
*/
|
||||
const listitem = this.props.listItems.find(li => li.GUID === entityid);
|
||||
const listitem =_.find( this.props.listItems,li => li.GUID === entityid);
|
||||
const listDef = this.getListDefinition(listitem.__metadata__ListDefinitionId);
|
||||
if (listDef) {// if user just added an item we may not hava a lisdef yest
|
||||
const colref = listDef.columnReferences.find(cr => cr.columnDefinitionId === columnid);
|
||||
const colref = _.find(listDef.columnReferences,cr => cr.columnDefinitionId === columnid);
|
||||
if (colref) {// Listname does not have a columnReference
|
||||
|
||||
switch (colref.fieldDefinition.TypeAsString) {
|
||||
|
@ -247,7 +249,7 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
const attributes: NamedNodeMap = parentTD.attributes;
|
||||
const entityitem = attributes.getNamedItem("data-entityid");
|
||||
const entityid = entityitem.value;
|
||||
const entity: ListItem = this.props.listItems.find((temp) => temp.GUID === entityid);
|
||||
const entity: ListItem = _.find(this.props.listItems,(temp) => temp.GUID === entityid);
|
||||
this.props.undoItemChanges(entity);
|
||||
}
|
||||
/**
|
||||
|
@ -258,7 +260,7 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
const parentTD = this.getParent(event.target, "TD");
|
||||
const attributes: NamedNodeMap = parentTD.attributes;
|
||||
const entityid = attributes.getNamedItem("data-entityid").value; // theid of the SPListItem
|
||||
const entity: ListItem = this.props.listItems.find((temp) => temp.GUID === entityid);
|
||||
const entity: ListItem = _.find(this.props.listItems,(temp) => temp.GUID === entityid);
|
||||
const listDef: ListDefinition = this.getListDefinition(entity.__metadata__ListDefinitionId);
|
||||
if (entity.__metadata__ListDefinitionId === entity.__metadata__OriginalValues.__metadata__ListDefinitionId
|
||||
|| entity.__metadata__GridRowStatus === GridRowStatus.new) {// List not changed
|
||||
|
@ -292,7 +294,7 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
const oldListDef = this.getListDefinition(listItem.__metadata__OriginalValues.__metadata__ListDefinitionId);
|
||||
for (const newColRef of newListDef.columnReferences) {
|
||||
// find the old columnReference
|
||||
const oldColRef = oldListDef.columnReferences.find(cr => cr.columnDefinitionId === newColRef.columnDefinitionId);
|
||||
const oldColRef = _.find(oldListDef.columnReferences,cr => cr.columnDefinitionId === newColRef.columnDefinitionId);
|
||||
const newFieldName = utils.ParseSPField(newColRef.name).id;
|
||||
const oldFieldName = utils.ParseSPField(oldColRef.name).id;
|
||||
switch (newColRef.fieldDefinition.TypeAsString) {
|
||||
|
@ -300,8 +302,8 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
// should male a local copy befor i start messing with these.// fieldd names may overlap on old and new
|
||||
// const name = listItem.__metadata__OriginalValues[oldFieldName].Name;// the user login name
|
||||
const name = listItem[oldFieldName].Name;// the user login name
|
||||
const siteUsersOnNewSite = this.props.siteUsers.find(su => su.siteUrl === newListDef.siteUrl);
|
||||
const newUser = siteUsersOnNewSite.siteUser.find(user => user.loginName === name);
|
||||
const siteUsersOnNewSite = _.find(this.props.siteUsers,su => su.siteUrl === newListDef.siteUrl);
|
||||
const newUser =_.find( siteUsersOnNewSite.siteUser,user => user.loginName === name);
|
||||
if (newUser) {
|
||||
listItem[newFieldName].Id = newUser.id;
|
||||
listItem[newFieldName].Name = newUser.loginName;
|
||||
|
@ -329,9 +331,9 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
private handleCellUpdated(value) {
|
||||
|
||||
const {entityid, columnid} = this.state.editing;
|
||||
const entity: ListItem = this.props.listItems.find((temp) => temp.GUID === entityid);
|
||||
const entity: ListItem = _.find(this.props.listItems,(temp) => temp.GUID === entityid);
|
||||
const listDef = this.getListDefinition(entity.__metadata__ListDefinitionId);
|
||||
const titleColumn = this.props.columns.find(c => { return c.type === "__LISTDEFINITIONTITLE__"; });
|
||||
const titleColumn =_.find( this.props.columns,c => { return c.type === "__LISTDEFINITIONTITLE__"; });
|
||||
if (titleColumn) {
|
||||
if (columnid === titleColumn.guid) { // user just changed the listDef,
|
||||
if (entity.__metadata__GridRowStatus === GridRowStatus.pristine) {
|
||||
|
@ -352,7 +354,7 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
return;
|
||||
}
|
||||
}
|
||||
const columnReference = listDef.columnReferences.find(cr => cr.columnDefinitionId === columnid);
|
||||
const columnReference = _.find(listDef.columnReferences,cr => cr.columnDefinitionId === columnid);
|
||||
const internalName = utils.ParseSPField(columnReference.name).id;
|
||||
if (!entity.__metadata__OriginalValues) { //SAVE orgininal values so we can undo;
|
||||
entity.__metadata__OriginalValues = _.cloneDeep(entity); // need deep if we have lookup values
|
||||
|
@ -401,7 +403,7 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
*/
|
||||
public ensureSiteUsers(siteUrl: string): SiteUsers {
|
||||
// see if the options are in the store, if so, return them, otherwoise dispatch an action to get them
|
||||
const siteUsers = this.props.siteUsers.find(x => {
|
||||
const siteUsers = _.find(this.props.siteUsers,x => {
|
||||
return (x.siteUrl === siteUrl);
|
||||
});
|
||||
if (siteUsers === undefined) {
|
||||
|
@ -416,7 +418,7 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
*/
|
||||
public getSiteUsers(siteUrl: string): SiteUsers {
|
||||
// see if the options are in the store, if so, return them, otherwoise dispatch an action to get them
|
||||
const siteUsers = this.props.siteUsers.find(x => {
|
||||
const siteUsers = _.find(this.props.siteUsers,x => {
|
||||
return (x.siteUrl === siteUrl);
|
||||
});
|
||||
return siteUsers;
|
||||
|
@ -427,7 +429,7 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
*/
|
||||
public ensureLookupOptions(lookupSite: string, lookupWebId: string, lookupListId: string, lookupField: string): LookupOptions {
|
||||
// see if the options are in the store, if so, return them, otherwoise dispatch an action to get them
|
||||
const lookupoptions = this.props.lookupOptions.find(x => {
|
||||
const lookupoptions =_.find( this.props.lookupOptions,x => {
|
||||
return (x.lookupField === lookupField) &&
|
||||
(x.lookupListId === lookupListId) &&
|
||||
(x.lookupSite === lookupSite) &&
|
||||
|
@ -445,7 +447,7 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
*/
|
||||
public getLookupOptions(lookupSite: string, lookupWebId: string, lookupListId: string, lookupField: string): LookupOptions {
|
||||
// see if the options are in the store, if so, return them, otherwoise dispatch an action to get them
|
||||
let lookupoptions = this.props.lookupOptions.find(x => {
|
||||
let lookupoptions = _.find(this.props.lookupOptions,x => {
|
||||
return (x.lookupField === lookupField) &&
|
||||
(x.lookupListId === lookupListId) &&
|
||||
(x.lookupSite === lookupSite) &&
|
||||
|
@ -461,12 +463,12 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
/** The id of the list definition to be retrieved */
|
||||
listdefid: string
|
||||
): ListDefinition {
|
||||
return this.props.listDefinitions.find(ld => ld.guid === listdefid);
|
||||
return _.find(this.props.listDefinitions,ld => ld.guid === listdefid);
|
||||
}
|
||||
/**
|
||||
* This method renders the contents of an individual cell in an editable format.
|
||||
*/
|
||||
public CellContentsEditable(props: { entity: ListItem, column: ColumnDefinition, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent) => void; }): JSX.Element {
|
||||
public CellContentsEditable(props: { entity: ListItem, column: ColumnDefinition, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent<any>) => void; }): JSX.Element {
|
||||
|
||||
const {entity, column, cellUpdated, cellUpdatedEvent} = props;
|
||||
|
||||
|
@ -485,7 +487,7 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
);
|
||||
}
|
||||
const listDef = this.getListDefinition(entity.__metadata__ListDefinitionId);
|
||||
const colref = listDef.columnReferences.find(cr => cr.columnDefinitionId === column.guid);
|
||||
const colref = _.find(listDef.columnReferences,cr => cr.columnDefinitionId === column.guid);
|
||||
const internalName = utils.ParseSPField(colref.name).id;
|
||||
const columnValue = entity[internalName];
|
||||
switch (colref.fieldDefinition.TypeAsString) {
|
||||
|
@ -646,7 +648,7 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
</a>
|
||||
);
|
||||
}
|
||||
const colref = listDef.columnReferences.find(cr => cr.columnDefinitionId === column.guid);
|
||||
const colref =_.find( listDef.columnReferences,cr => cr.columnDefinitionId === column.guid);
|
||||
if (colref === undefined) { //Column has not been configured for this list
|
||||
return (<a href="#" onFocus={this.toggleEditing} style={{ textDecoration: "none" }} >
|
||||
'Column Not Defined'
|
||||
|
@ -725,7 +727,7 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
* It calls CellContentsEditable or CellContents based on whether the cell is being edited.
|
||||
* It determines if the cell is being edited by looking at this,props.editing(which got set by ToggleEditing).
|
||||
*/
|
||||
public TableDetail(props: { entity: ListItem, column: ColumnDefinition, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent) => void; }): JSX.Element {
|
||||
public TableDetail(props: { entity: ListItem, column: ColumnDefinition, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent<any>) => void; }): JSX.Element {
|
||||
|
||||
const {entity, column, cellUpdated, cellUpdatedEvent} = props;
|
||||
if (this.state && this.state.editing && this.state.editing.entityid === entity.GUID && this.state.editing.columnid === column.guid && column.editable) {
|
||||
|
@ -743,7 +745,7 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
/**
|
||||
* This method renders a tableRow for an individual listitem
|
||||
*/
|
||||
public TableRow(props: { entity: ListItem, columns: Array<ColumnDefinition>, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent) => void; }): JSX.Element {
|
||||
public TableRow(props: { entity: ListItem, columns: Array<ColumnDefinition>, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent<any>) => void; }): JSX.Element {
|
||||
const {entity, columns, cellUpdated, cellUpdatedEvent} = props;
|
||||
return (
|
||||
<tr>
|
||||
|
@ -778,7 +780,7 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
/**
|
||||
* Render rows for the listItems
|
||||
*/
|
||||
public TableRows(props: { entities: Array<ListItem>, columns: Array<ColumnDefinition>, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent) => void; }): JSX.Element {
|
||||
public TableRows(props: { entities: Array<ListItem>, columns: Array<ColumnDefinition>, cellUpdated: (newValue) => void, cellUpdatedEvent: (event: React.SyntheticEvent<any>) => void; }): JSX.Element {
|
||||
const {entities, columns, cellUpdated, cellUpdatedEvent} = props;
|
||||
return (
|
||||
<tbody>
|
||||
|
@ -821,7 +823,7 @@ class ListItemContainer extends React.Component<IListViewPageProps, IGridState>
|
|||
|
||||
}]} />
|
||||
|
||||
<table border="1">
|
||||
<table >
|
||||
<thead>
|
||||
<tr>
|
||||
{this.props.columns.map((column) => {
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as React from 'react';
|
|||
import * as ReactDom from 'react-dom';
|
||||
import {
|
||||
IPropertyPaneField,
|
||||
IPropertyPaneFieldType,
|
||||
// IPropertyPaneFieldType,
|
||||
IPropertyPaneCustomFieldProps
|
||||
} from '@microsoft/sp-webpart-base';
|
||||
import PropertyFieldColumnDefinitionsHost, { IPropertyFieldColumnDefinitionsHostProps } from './PropertyFieldColumnDefinitionsHost';
|
||||
|
@ -25,11 +25,12 @@ export interface IPropertyFieldColumnDefinitionsPropsInternal extends IPropertyP
|
|||
}
|
||||
class PropertyFieldColumnDefinitionsBuilder implements IPropertyPaneField<IPropertyFieldColumnDefinitionsPropsInternal> {
|
||||
//Properties defined by IPropertyPaneField
|
||||
public type: IPropertyPaneFieldType = 1;//IPropertyPaneFieldType.Custom;
|
||||
public type = 1;//IPropertyPaneFieldType.Custom;
|
||||
public targetProperty: string;
|
||||
public properties: IPropertyFieldColumnDefinitionsPropsInternal;
|
||||
//Custom properties
|
||||
private label: string;
|
||||
|
||||
private onPropertyChange: (propertyPath: string, oldValue: any, newValue: any) => void;
|
||||
private customProperties: any;
|
||||
public constructor(_targetProperty: string, _properties: IPropertyFieldColumnDefinitionsPropsInternal) {
|
||||
|
@ -59,6 +60,7 @@ export function PropertyFieldColumnDefinitions(targetProperty: string, propertie
|
|||
var newProperties: IPropertyFieldColumnDefinitionsPropsInternal = {
|
||||
label: properties.label,
|
||||
targetProperty: targetProperty,
|
||||
key: targetProperty,
|
||||
initialValue: properties.initialValue,
|
||||
onPropertyChange: properties.onPropertyChange,
|
||||
columnDefinitions: properties.getColumnDefinitions(),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Guid } from "@microsoft/sp-client-base";
|
||||
import { Guid } from "@microsoft/sp-core-library";
|
||||
import * as _ from "underscore";
|
||||
import { ColumnDefinitionContainerNative } from "./ColumnDefinitionContainer";
|
||||
import ColumnDefinition from "../model/ColumnDefinition";
|
||||
import * as React from 'react';
|
||||
|
|
|
@ -4,11 +4,10 @@ import * as React from 'react';
|
|||
import * as ReactDom from 'react-dom';
|
||||
import {
|
||||
IPropertyPaneField,
|
||||
IPropertyPaneFieldType,
|
||||
IPropertyPaneCustomFieldProps
|
||||
IPropertyPaneCustomFieldProps
|
||||
} from '@microsoft/sp-webpart-base';
|
||||
import PropertyFieldListDefinitionsHost, { IPropertyFieldListDefinitionsHostProps } from './PropertyFieldListDefinitionsHost';
|
||||
import { PageContext } from "@microsoft/sp-client-base";
|
||||
import { PageContext } from "@microsoft/sp-page-context";
|
||||
export interface IPropertyFieldListDefinitionsProps {
|
||||
label: string;
|
||||
initialValue?: Array<ListDefinition>;
|
||||
|
@ -19,6 +18,7 @@ export interface IPropertyFieldListDefinitionsProps {
|
|||
}
|
||||
export interface IPropertyFieldListDefinitionsPropsInternal extends IPropertyPaneCustomFieldProps {
|
||||
label: string;
|
||||
key:string; // new for rc0
|
||||
initialValue?: Array<ListDefinition>;
|
||||
targetProperty: string;
|
||||
onRender(elem: HTMLElement): void;
|
||||
|
@ -31,7 +31,7 @@ export interface IPropertyFieldListDefinitionsPropsInternal extends IPropertyPan
|
|||
class PropertyFieldListDefinitionsBuilder implements IPropertyPaneField<IPropertyFieldListDefinitionsPropsInternal> {
|
||||
|
||||
//Properties defined by IPropertyPaneField
|
||||
public type: IPropertyPaneFieldType = 1;//IPropertyPaneFieldType.Custom;
|
||||
public type = 1;//IPropertyPaneFieldType.Custom;
|
||||
public targetProperty: string;
|
||||
public properties: IPropertyFieldListDefinitionsPropsInternal;
|
||||
|
||||
|
@ -40,7 +40,7 @@ class PropertyFieldListDefinitionsBuilder implements IPropertyPaneField<IPropert
|
|||
private onPropertyChange: (propertyPath: string, oldValue: any, newValue: any) => void;
|
||||
private customProperties: any;
|
||||
public constructor(_targetProperty: string, _properties: IPropertyFieldListDefinitionsPropsInternal) {
|
||||
|
||||
|
||||
this.render = this.render.bind(this);
|
||||
this.properties = _properties;
|
||||
this.label = _properties.label;
|
||||
|
@ -49,7 +49,7 @@ class PropertyFieldListDefinitionsBuilder implements IPropertyPaneField<IPropert
|
|||
this.onPropertyChange = _properties.onPropertyChange;
|
||||
}
|
||||
private render(elem: HTMLElement): void {
|
||||
|
||||
|
||||
const ldProps: IPropertyFieldListDefinitionsHostProps = {
|
||||
label: this.label,
|
||||
getColumnDefinitions: this.properties.getColumnDefinitions,
|
||||
|
@ -70,6 +70,7 @@ export function PropertyFieldListDefinitions(targetProperty: string, properties:
|
|||
//Create an internal properties object from the given properties
|
||||
var newProperties: IPropertyFieldListDefinitionsPropsInternal = {
|
||||
label: properties.label,
|
||||
key:targetProperty,
|
||||
targetProperty: targetProperty,
|
||||
initialValue: properties.initialValue,
|
||||
onPropertyChange: properties.onPropertyChange,
|
||||
|
|
|
@ -3,6 +3,7 @@ import { ListDefinitionContainerNative } from "./ListDefinitionContainer";
|
|||
import ListDefinition from "../model/ListDefinition";
|
||||
import ColumnDefinition from "../model/ColumnDefinition";
|
||||
import { Site, Web, WebList, WebListField } from "../model/Site";
|
||||
import * as _ from "underscore";
|
||||
import * as React from 'react';
|
||||
import { Label } from 'office-ui-fabric-react/lib/Label';
|
||||
import { Button } from 'office-ui-fabric-react/lib/Button';
|
||||
|
@ -11,8 +12,8 @@ import * as strings from "spfxReactGridStrings";
|
|||
import * as utils from "../utils/utils";
|
||||
import { Web as SPWeb } from "sp-pnp-js";
|
||||
import { Site as SPSite } from "sp-pnp-js";
|
||||
import { Guid, PageContext } from "@microsoft/sp-client-base";
|
||||
|
||||
import { Guid } from "@microsoft/sp-core-library";
|
||||
import { PageContext } from "@microsoft/sp-page-context";
|
||||
export interface IPropertyFieldListDefinitionsHostProps {
|
||||
label: string;
|
||||
initialValue?: Array<ListDefinition>;
|
||||
|
@ -29,7 +30,7 @@ export interface IPropertyFieldListDefinitionsHostState {
|
|||
export default class PropertyFieldListDefinitionsHost extends React.Component<IPropertyFieldListDefinitionsHostProps, IPropertyFieldListDefinitionsHostState> {
|
||||
|
||||
constructor(props: IPropertyFieldListDefinitionsHostProps) {
|
||||
|
||||
|
||||
super(props);
|
||||
this.onOpenPanel = this.onOpenPanel.bind(this);
|
||||
this.onClosePanel = this.onClosePanel.bind(this);
|
||||
|
@ -69,7 +70,7 @@ export default class PropertyFieldListDefinitionsHost extends React.Component<IP
|
|||
}
|
||||
|
||||
private getListsForWeb(webUrl: string): any {
|
||||
|
||||
|
||||
const spWeb = new SPWeb(webUrl);
|
||||
const promise = spWeb.lists.orderBy("Title").get()
|
||||
.then((response) => {
|
||||
|
@ -94,7 +95,7 @@ export default class PropertyFieldListDefinitionsHost extends React.Component<IP
|
|||
}
|
||||
|
||||
private getFieldsForList(webUrl: string, listId: string): any {
|
||||
|
||||
|
||||
const spWeb = new SPWeb(webUrl);
|
||||
const promise = spWeb.lists.getById(listId).fields.filter("Hidden eq false").orderBy("Title").get()
|
||||
.then((response) => {
|
||||
|
|
|
@ -3,7 +3,9 @@ import {
|
|||
MessageBar,
|
||||
MessageBarType
|
||||
} from "office-ui-fabric-react";
|
||||
const connect = require("react-redux").connect;
|
||||
//const connect = require("react-redux").connect;
|
||||
import * as redux from "react-redux";
|
||||
const connect = redux.connect;
|
||||
import SystemStatus from "../model/SystemStatus";
|
||||
import Content from "../components/content";
|
||||
interface IAppProps extends React.Props<any> {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// for eac of the columns to be displayed, which field in this list should we use
|
||||
import { Guid } from '@microsoft/sp-client-base';
|
||||
import { Guid } from '@microsoft/sp-core-library';
|
||||
|
||||
export class FieldDefinition {
|
||||
/** The type of field to dispay */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import GridRowStatus from "./GridRowStatus";
|
||||
import { Guid } from '@microsoft/sp-client-base';
|
||||
import { Guid } from '@microsoft/sp-core-library';
|
||||
export default class ListItem {
|
||||
/** The listDefinition this item came from. Need this to get to columnMappings */
|
||||
public __metadata__ListDefinitionId;
|
||||
|
|
|
@ -38,7 +38,7 @@ function listItemReducer(state = INITIAL_STATE, action: any = { type: "" }) {
|
|||
case SAVE_COLUMN:
|
||||
|
||||
let newarray2 = _.clone(state);
|
||||
let item = newarray2.find(item => item.guid === action.payload.column.guid);
|
||||
let item = _.find(newarray2,item => item.guid === action.payload.column.guid);
|
||||
item = action.payload.column;
|
||||
return newarray2;
|
||||
case REMOVE_COLUMN:
|
||||
|
|
|
@ -66,11 +66,11 @@ function relpaceItemInStore(state: Array<ListItem>, action: { payload: { listIte
|
|||
*/
|
||||
function saveListItem(state: Array<ListItem>, action: { payload: { listItem: ListItem } }) {
|
||||
let newarray2 = _.cloneDeep(state);
|
||||
let item = newarray2.find(i => i.GUID === action.payload.listItem.GUID);
|
||||
let item = _.find(newarray2, i => i.GUID === action.payload.listItem.GUID);
|
||||
item = action.payload.listItem;
|
||||
|
||||
if (!item.__metadata__OriginalValues) {
|
||||
item.__metadata__OriginalValues = state.find(i => i.GUID === action.payload.listItem.GUID);
|
||||
item.__metadata__OriginalValues = _.find(state, i => i.GUID === action.payload.listItem.GUID);
|
||||
}
|
||||
return newarray2;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ function listReducer(state: Array<ListDefinition> = INITIAL_STATE, action: any =
|
|||
return newarray;
|
||||
case SAVE_LIST:
|
||||
let newarray2 = _.clone(state);
|
||||
let item = newarray2.find(item => item.guid === action.payload.list.guid);
|
||||
let item =_.find( newarray2,item => item.guid === action.payload.list.guid);
|
||||
item = action.payload.list;
|
||||
return newarray2;
|
||||
case REMOVE_LIST:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { LookupOptions } from "../Model/LookupOptions";
|
||||
import { Log } from "@microsoft/sp-client-base";
|
||||
import { Log } from "@microsoft/sp-core-library";
|
||||
import * as _ from "lodash";
|
||||
import {
|
||||
GET_LOOKUPOPTIONS,
|
||||
|
|
|
@ -7,7 +7,7 @@ import LookupOptionsReducer from "./LookupOptionsReducer";
|
|||
import SiteReducer from "./SiteReducer";
|
||||
import SiteUserReducer from "./SiteUsersReducer";
|
||||
import SystemStatus from "./SystemStatus";
|
||||
const { routerReducer } = require("react-router-redux");
|
||||
import { routerReducer } from "react-router-redux";
|
||||
export function RootReducer(state, action) {
|
||||
const combinedReducers = combineReducers(
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { SiteUsers } from "../Model/SiteUsers";
|
||||
import { Log } from "@microsoft/sp-client-base";
|
||||
import { Log } from "@microsoft/sp-core-library";
|
||||
import * as _ from "lodash";
|
||||
import {
|
||||
GET_SITE_USERS,
|
||||
|
|
|
@ -4,7 +4,8 @@ const defaultStatus: SystemStatus = {
|
|||
currentAction: "",
|
||||
fetchStatus: ""
|
||||
};
|
||||
import { Log } from "@microsoft/sp-client-base";
|
||||
import * as _ from "lodash";
|
||||
import { Log } from "@microsoft/sp-core-library";
|
||||
export default function SystemStatusReducer(state: SystemStatus = defaultStatus, action: any = { type: "" }) {
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -8,9 +8,9 @@ import { fromJS } from "immutable";
|
|||
import { createMemoryHistory } from "react-router";
|
||||
import { routerMiddleware } from "react-router-redux";
|
||||
import thunk from "redux-thunk";
|
||||
|
||||
import {Store} from "redux"
|
||||
import promiseMiddleware from "redux-promise-middleware";
|
||||
import logger from "./logger";
|
||||
|
||||
import { RootReducer } from "../reducers/rootReducer";
|
||||
const __DEV__: boolean = true; // from webpack
|
||||
function configureStore(initialState) {
|
||||
|
@ -35,7 +35,7 @@ function _getMiddleware(): Middleware[] {
|
|||
thunk,
|
||||
];
|
||||
if (__DEV__) {
|
||||
middleware = [...middleware, logger];
|
||||
middleware = [...middleware];
|
||||
}
|
||||
return middleware;
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
const createLogger = require('redux-logger');
|
||||
import immutableToJS from '../utils/immutable-to-js';
|
||||
// const createLogger = require('redux-logger');
|
||||
// import immutableToJS from '../utils/immutable-to-js';
|
||||
|
||||
// import * as createLogger from "redux-logger"
|
||||
// const logger = createLogger({
|
||||
// collapsed: true,
|
||||
// stateTransformer: (state) => {
|
||||
// return immutableToJS(state);
|
||||
// },
|
||||
// predicate: (getState, { type }) => {
|
||||
// return type !== 'redux-form/BLUR' &&
|
||||
// type !== 'redux-form/CHANGE' &&
|
||||
// type !== 'redux-form/FOCUS' &&
|
||||
// type !== 'redux-form/TOUCH';
|
||||
// },
|
||||
// });
|
||||
|
||||
|
||||
const logger = createLogger({
|
||||
collapsed: true,
|
||||
stateTransformer: (state) => {
|
||||
return immutableToJS(state);
|
||||
},
|
||||
predicate: (getState, { type }) => {
|
||||
return type !== 'redux-form/BLUR' &&
|
||||
type !== 'redux-form/CHANGE' &&
|
||||
type !== 'redux-form/FOCUS' &&
|
||||
type !== 'redux-form/TOUCH';
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
export default logger;
|
||||
// export default logger;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import * as React from "react";
|
||||
const { IndexRoute, Route } = require("react-router");
|
||||
//const { IndexRoute, Route } = require("react-router");
|
||||
import { IndexRoute, Route } from "react-router";
|
||||
import App from "../containers/app";
|
||||
import ListDefinitionContainer from "../containers/ListDefinitionContainer";
|
||||
import ColumnDefinitionContainer from "../containers/ColumnDefinitionContainer";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Log } from "@microsoft/sp-client-base";
|
||||
import { Log } from "@microsoft/sp-core-library";
|
||||
export class ParsedSPField {
|
||||
constructor(public id: string, public value: string
|
||||
) { }
|
||||
|
|
|
@ -5,8 +5,14 @@
|
|||
"jsx": "react",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
|
||||
"types": [ "webpack-env" ] ,
|
||||
"experimentalDecorators": true
|
||||
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"globalDependencies": {
|
||||
"react-data-grid": "registry:dt/react-data-grid#1.0.4+20161116100048",
|
||||
"redux": "registry:dt/redux#3.5.2+20160703092728",
|
||||
"redux-promise-middleware": "registry:dt/redux-promise-middleware#0.0.0+20160108032528"
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -1,498 +0,0 @@
|
|||
// Generated by typings
|
||||
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/896d675b6d9dae75656e499a80ae733d904350bb/react-data-grid/react-data-grid.d.ts
|
||||
declare namespace AdazzleReactDataGrid {
|
||||
import React = __React;
|
||||
|
||||
interface SelectionParams {
|
||||
rowIdx: number,
|
||||
row: any
|
||||
}
|
||||
|
||||
interface GridProps {
|
||||
/**
|
||||
* Gets the data to render in each row. Required.
|
||||
* Can be an array or a function that takes an index and returns an object.
|
||||
*/
|
||||
rowGetter: Array<Object> | ((rowIdx: number) => Object)
|
||||
/**
|
||||
* The total number of rows to render. Required.
|
||||
*/
|
||||
rowsCount: number
|
||||
/**
|
||||
* The columns to render.
|
||||
*/
|
||||
columns?: Array<Column>
|
||||
|
||||
/**
|
||||
* Invoked when the user changes the value of a single cell.
|
||||
* Should update that cell's value.
|
||||
* @param e Information about the event
|
||||
*/
|
||||
onRowUpdated?: (e: RowUpdateEvent) => void
|
||||
/**
|
||||
* Invoked when the user pulls down the drag handle of an editable cell.
|
||||
* Should update the values of the selected cells.
|
||||
* @param e Information about the event
|
||||
*/
|
||||
onCellsDragged?: (e: CellDragEvent) => void
|
||||
/**
|
||||
* Invoked when the user double clicks on the drag handle of an editable cell.
|
||||
* Should update the values of the cells beneath the selected cell.
|
||||
* @param e Information about the event
|
||||
*/
|
||||
onDragHandleDoubleClick?: (e: DragHandleDoubleClickEvent) => void
|
||||
/**
|
||||
* Invoked when the user copies a value from one cell and pastes it into another (in the same column).
|
||||
* Should update the value of the cell in row e.toRow.
|
||||
* @param e Information about the event
|
||||
*/
|
||||
onCellCopyPaste?: (e: CellCopyPasteEvent) => void
|
||||
/**
|
||||
* Invoked after the user updates the grid rows in any way.
|
||||
* @param e Information about the event
|
||||
*/
|
||||
onGridRowsUpdated?: (e: GridRowsUpdatedEvent) => void
|
||||
|
||||
/**
|
||||
* A toolbar to display above the grid.
|
||||
* Consider using the toolbar included in "react-data-grid/addons".
|
||||
*/
|
||||
toolbar?: React.ReactElement<any>
|
||||
/**
|
||||
* A context menu to disiplay when the user right-clicks a cell.
|
||||
* Consider using "react-contextmenu", included in "react-data-grid/addons".
|
||||
*/
|
||||
contextMenu?: React.ReactElement<any>
|
||||
/**
|
||||
* A react component to customize how rows are rendered.
|
||||
* If you want to define your own, consider extending ReactDataGrid.Row.
|
||||
*/
|
||||
rowRenderer?: React.ReactElement<any> | React.ComponentClass<any> | React.StatelessComponent<any>
|
||||
/**
|
||||
* A component to display when there are no rows to render.
|
||||
*/
|
||||
emptyRowsView?: React.ComponentClass<any> | React.StatelessComponent<any>
|
||||
|
||||
/**
|
||||
* The minimum width of the entire grid in pixels.
|
||||
*/
|
||||
minWidth?: number
|
||||
/**
|
||||
* The minimum height of the entire grid in pixels.
|
||||
* @default 350
|
||||
*/
|
||||
minHeight?: number
|
||||
/**
|
||||
* The height of each individual row in pixels.
|
||||
* @default 35
|
||||
*/
|
||||
rowHeight?: number
|
||||
/**
|
||||
* The height of the header row in pixels.
|
||||
* @default rowHeight
|
||||
*/
|
||||
headerRowHeight?: number
|
||||
/**
|
||||
* The minimum width of each column in pixels.
|
||||
* @default 80
|
||||
*/
|
||||
minColumnWidth?: number
|
||||
/**
|
||||
* Invoked when a column has been resized.
|
||||
* @param index The index of the column
|
||||
* @param width The new width of the column
|
||||
*/
|
||||
onColumnResize?: (index: number, width: number) => void
|
||||
|
||||
/**
|
||||
* Controls what happens when the user navigates beyond the first or last cells.
|
||||
* 'loopOverRow' will navigate to the beginning/end of the current row.
|
||||
* 'changeRow' will navigate to the beginning of the next row or the end of the last.
|
||||
* 'none' will do nothing.
|
||||
* @default none
|
||||
*/
|
||||
cellNavigationMode?: 'none' | 'loopOverRow' | 'changeRow'
|
||||
|
||||
/**
|
||||
* Called when the user sorts the grid by some column.
|
||||
* Should update the order of the rows returned by rowGetter.
|
||||
* @param sortColumn The name of the column being sorted by
|
||||
* @param sortDirection The direction to sort ('ASC'/'DESC'/'NONE')
|
||||
*/
|
||||
onGridSort?: (sortColumn: string, sortDirection: 'ASC' | 'DESC' | 'NONE') => void
|
||||
/**
|
||||
* Called when the user filters a column by some value.
|
||||
* Should restrict the rows in rowGetter to only things that match the filter.
|
||||
* @param filter The filter being added
|
||||
*/
|
||||
onAddFilter?: (filter: Filter) => void
|
||||
/**
|
||||
* Called when the user clears all filters.
|
||||
* Should restore the rows in rowGetter to their original state.
|
||||
*/
|
||||
onClearFilters?: () => void
|
||||
|
||||
/**
|
||||
* When set to true or 'multi', enables multiple row select.
|
||||
* When set to 'single', enables single row select.
|
||||
* When set to false or not set, disables row select.
|
||||
* @default false
|
||||
*/
|
||||
enableRowSelect?: boolean | 'single' | 'multi'
|
||||
/**
|
||||
* Called when a row is selected.
|
||||
* @param rows The (complete) current selection of rows.
|
||||
*/
|
||||
onRowSelect?: (rows: Array<Object>) => void
|
||||
/**
|
||||
* A property that's unique to every row.
|
||||
* This property is required to enable row selection.
|
||||
* @default 'id'
|
||||
*/
|
||||
rowKey?: string
|
||||
|
||||
/**
|
||||
* Enables cells to be selected when clicked.
|
||||
* @default false
|
||||
*/
|
||||
enableCellSelect?: boolean
|
||||
/**
|
||||
* Called when a cell is selected.
|
||||
* @param coordinates The row and column indices of the selected cell.
|
||||
*/
|
||||
onCellSelected?: (coordinates: {rowIdx: number, idx: number}) => void
|
||||
/**
|
||||
* Called when a cell is deselected.
|
||||
* @param coordinates The row and column indices of the deselected cell.
|
||||
*/
|
||||
onCellDeSelected?: (coordinates: {rowIdx: number, idx: number}) => void
|
||||
|
||||
/**
|
||||
* How long to wait before rendering a new row while scrolling in milliseconds.
|
||||
* @default 0
|
||||
*/
|
||||
rowScrollTimeout?: number
|
||||
/**
|
||||
* Options object for selecting rows
|
||||
*/
|
||||
rowSelection?: {
|
||||
showCheckbox?: boolean
|
||||
enableShiftSelect?: boolean
|
||||
onRowsSelected?: (rows: Array<SelectionParams>) => void,
|
||||
onRowsDeselected?: (rows: Array<SelectionParams>) => void,
|
||||
selectBy?: {
|
||||
indexes?: Array<number>;
|
||||
keys?: { rowKey: string, values: Array<any> };
|
||||
isSelectedKey?: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about a specific column to be rendered.
|
||||
*/
|
||||
interface Column {
|
||||
/**
|
||||
* A unique key for this column. Required.
|
||||
* Each row should have a property with this name, which contains this column's value.
|
||||
*/
|
||||
key: string
|
||||
/**
|
||||
* This column's display name. Required.
|
||||
*/
|
||||
name: string
|
||||
/**
|
||||
* A custom width for this specific column.
|
||||
* @default minColumnWidth from the ReactDataGrid
|
||||
*/
|
||||
width?: number
|
||||
/**
|
||||
* Whether this column can be resized by the user.
|
||||
* @default false
|
||||
*/
|
||||
resizable?: boolean
|
||||
/**
|
||||
* Whether this column should stay fixed on the left as the user scrolls horizontally.
|
||||
* @default false
|
||||
*/
|
||||
locked?: boolean
|
||||
/**
|
||||
* Whether this column can be edited.
|
||||
* @default false
|
||||
*/
|
||||
editable?: boolean
|
||||
/**
|
||||
* Whether the rows in the grid can be sorted by this column.
|
||||
* @default false
|
||||
*/
|
||||
sortable?: boolean
|
||||
/**
|
||||
* Whether the rows in the grid can be filtered by this column.
|
||||
* @default false
|
||||
*/
|
||||
filterable?: boolean
|
||||
/**
|
||||
* The editor for this column. Several editors are available in "react-data-grid/addons".
|
||||
* @default A simple text editor
|
||||
*/
|
||||
editor?: React.ReactElement<any>
|
||||
/**
|
||||
* A custom read-only formatter for this column. An image formatter is available in "react-data-grid/addons".
|
||||
*/
|
||||
formatter?: React.ReactElement<any> | React.ComponentClass<any> | React.StatelessComponent<any>
|
||||
/**
|
||||
* A custom formatter for this column's header.
|
||||
*/
|
||||
headerRenderer?: React.ReactElement<any> | React.ComponentClass<any> | React.StatelessComponent<any>
|
||||
/**
|
||||
* Events to be bound to the cells in this specific column.
|
||||
* Each event must respect this standard in order to work correctly:
|
||||
* @example
|
||||
* function onXxx(ev :SyntheticEvent, (rowIdx, idx, name): args)
|
||||
*/
|
||||
events?: {
|
||||
[name: string]: ColumnEventCallback
|
||||
}
|
||||
}
|
||||
|
||||
interface ColumnEventCallback {
|
||||
/**
|
||||
* A callback for a native react event on a specific cell.
|
||||
* @param ev The react event
|
||||
* @param args The row and column coordinates of the cell, and the name of the event.
|
||||
*/
|
||||
(ev: React.SyntheticEvent, args: {rowIdx: number, idx: number, name: string}): void
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about a row update
|
||||
*/
|
||||
interface RowUpdateEvent {
|
||||
/**
|
||||
* The index of the updated row.
|
||||
*/
|
||||
rowIdx: number
|
||||
/**
|
||||
* The columns that were updated and their values.
|
||||
*/
|
||||
updated: Object
|
||||
/**
|
||||
* The name of the column that was updated.
|
||||
*/
|
||||
cellKey: string
|
||||
/**
|
||||
* The name of the key pressed to trigger the event ('Tab', 'Enter', etc.).
|
||||
*/
|
||||
key: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about a cell drag
|
||||
*/
|
||||
interface CellDragEvent {
|
||||
/**
|
||||
* The name of the column that was dragged.
|
||||
*/
|
||||
cellKey: string
|
||||
/**
|
||||
* The row where the drag began.
|
||||
*/
|
||||
fromRow: number
|
||||
/**
|
||||
* The row where the drag ended.
|
||||
*/
|
||||
toRow: number
|
||||
/**
|
||||
* The value of the cell that was dragged.
|
||||
*/
|
||||
value: any
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about a drag handle double click
|
||||
*/
|
||||
interface DragHandleDoubleClickEvent {
|
||||
/**
|
||||
* The row where the double click occurred.
|
||||
*/
|
||||
rowIdx: number
|
||||
/**
|
||||
* The column where the double click occurred.
|
||||
*/
|
||||
idx: number
|
||||
/**
|
||||
* The values of the row.
|
||||
*/
|
||||
rowData: Object
|
||||
/**
|
||||
* The double click event.
|
||||
*/
|
||||
e: React.SyntheticEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about a copy paste
|
||||
*/
|
||||
interface CellCopyPasteEvent {
|
||||
/**
|
||||
* The row that was pasted to.
|
||||
*/
|
||||
rowIdx: number
|
||||
/**
|
||||
* The value that was pasted.
|
||||
*/
|
||||
value: any
|
||||
/**
|
||||
* The row that was copied from.
|
||||
*/
|
||||
fromRow: number
|
||||
/**
|
||||
* The row that was pasted to.
|
||||
*/
|
||||
toRow: number
|
||||
/**
|
||||
* The key of the column where the copy paste occurred.
|
||||
*/
|
||||
cellKey: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about some update to the grid's contents
|
||||
*/
|
||||
interface GridRowsUpdatedEvent {
|
||||
/**
|
||||
* The key of the column where the event occurred.
|
||||
*/
|
||||
cellKey: string
|
||||
/**
|
||||
* The top row affected by the event.
|
||||
*/
|
||||
fromRow: number
|
||||
/**
|
||||
* The bottom row affected by the event.
|
||||
*/
|
||||
toRow: number
|
||||
/**
|
||||
* The columns that were updated and their values.
|
||||
*/
|
||||
updated: Object
|
||||
/**
|
||||
* The action that occurred to trigger this event.
|
||||
* One of 'cellUpdate', 'cellDrag', 'columnFill', or 'copyPaste'.
|
||||
*/
|
||||
action: 'cellUpdate' | 'cellDrag' | 'columnFill' | 'copyPaste'
|
||||
}
|
||||
|
||||
/**
|
||||
* Some filter to be applied to the grid's contents
|
||||
*/
|
||||
interface Filter {
|
||||
/**
|
||||
* The key of the column being filtered.
|
||||
*/
|
||||
columnKey: string
|
||||
/**
|
||||
* The term to filter by.
|
||||
*/
|
||||
filterTerm: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Excel-like grid component built with React, with editors, keyboard navigation, copy & paste, and the like
|
||||
* http://adazzle.github.io/react-data-grid/
|
||||
*/
|
||||
export class ReactDataGrid extends React.Component<GridProps, {}> { }
|
||||
export namespace ReactDataGrid {
|
||||
// Useful types
|
||||
export import Column = AdazzleReactDataGrid.Column;
|
||||
export import Filter = AdazzleReactDataGrid.Filter;
|
||||
|
||||
// Various events
|
||||
export import RowUpdateEvent = AdazzleReactDataGrid.RowUpdateEvent;
|
||||
export import SelectionParams = AdazzleReactDataGrid.SelectionParams;
|
||||
export import CellDragEvent = AdazzleReactDataGrid.CellDragEvent;
|
||||
export import DragHandleDoubleClickEvent = AdazzleReactDataGrid.DragHandleDoubleClickEvent;
|
||||
export import CellCopyPasteEvent = AdazzleReactDataGrid.CellCopyPasteEvent;
|
||||
export import GridRowsUpdatedEvent = AdazzleReactDataGrid.GridRowsUpdatedEvent;
|
||||
|
||||
// Actual classes exposed on module.exports
|
||||
/**
|
||||
* A react component that renders a row of the grid
|
||||
*/
|
||||
export class Row extends React.Component<any, any> { }
|
||||
/**
|
||||
* A react coponent that renders a cell of the grid
|
||||
*/
|
||||
export class Cell extends React.Component<any, any> { }
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace AdazzleReactDataGridPlugins {
|
||||
import React = __React;
|
||||
|
||||
// TODO: refine types for these addons
|
||||
export namespace Editors {
|
||||
export class AutoComplete extends React.Component<any, {}> { }
|
||||
export class DropDownEditor extends React.Component<any, {}> { }
|
||||
export class SimpleTextEditor extends React.Component<any, {}> { }
|
||||
export class CheckboxEditor extends React.Component<any, {}> { }
|
||||
}
|
||||
export namespace Formatters {
|
||||
export class ImageFormatter extends React.Component<any, {}> { }
|
||||
export class DropDownFormatter extends React.Component<any, {}> { }
|
||||
}
|
||||
export class Toolbar extends React.Component<any, any> {}
|
||||
// TODO: re-export the react-contextmenu typings once those exist
|
||||
// https://github.com/vkbansal/react-contextmenu/issues/10
|
||||
export namespace Menu {
|
||||
export class ContextMenu extends React.Component<any, {}> { }
|
||||
export class MenuHeader extends React.Component<any, {}> { }
|
||||
export class MenuItem extends React.Component<any, {}> { }
|
||||
export class SubMenu extends React.Component<any, {}> { }
|
||||
export const monitor: {
|
||||
getItem(): any
|
||||
getPosition(): any
|
||||
hideMenu(): void
|
||||
};
|
||||
export function connect(Menu: any): any;
|
||||
export function ContextMenuLayer(
|
||||
identifier: any,
|
||||
configure?: (props: any) => any
|
||||
): (Component: any) => any
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-data-grid" {
|
||||
import ReactDataGrid = AdazzleReactDataGrid.ReactDataGrid;
|
||||
|
||||
// commonjs export
|
||||
export = ReactDataGrid;
|
||||
}
|
||||
|
||||
declare module "react-data-grid/addons" {
|
||||
import Plugins = AdazzleReactDataGridPlugins;
|
||||
import Editors = Plugins.Editors;
|
||||
import Formatters = Plugins.Formatters;
|
||||
import Toolbar = Plugins.Toolbar;
|
||||
import Menu = Plugins.Menu;
|
||||
|
||||
// ES6 named exports
|
||||
export {
|
||||
Editors,
|
||||
Formatters,
|
||||
Toolbar,
|
||||
Menu
|
||||
}
|
||||
|
||||
// attach to window
|
||||
global {
|
||||
interface Window {
|
||||
ReactDataGridPlugins: {
|
||||
Editors: typeof Editors
|
||||
Formatters: typeof Formatters
|
||||
Toolbar: typeof Toolbar
|
||||
Menu: typeof Menu
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"resolution": "main",
|
||||
"tree": {
|
||||
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/896d675b6d9dae75656e499a80ae733d904350bb/react-data-grid/react-data-grid.d.ts",
|
||||
"raw": "registry:dt/react-data-grid#1.0.4+20161116100048",
|
||||
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/896d675b6d9dae75656e499a80ae733d904350bb/react-data-grid/react-data-grid.d.ts"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,230 @@
|
|||
// Generated by typings
|
||||
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/d20a983f78abfcda79fc85c66a5f0736e45ab99f/webpack-env/index.d.ts
|
||||
declare namespace __WebpackModuleApi {
|
||||
interface RequireContext {
|
||||
keys(): string[];
|
||||
<T>(id: string): T;
|
||||
resolve(id: string): string;
|
||||
}
|
||||
|
||||
interface RequireFunction {
|
||||
/**
|
||||
* Returns the exports from a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available.
|
||||
*/
|
||||
<T>(path: string): T;
|
||||
/**
|
||||
* Behaves similar to require.ensure, but the callback is called with the exports of each dependency in the paths array. There is no option to provide a chunk name.
|
||||
*/
|
||||
(paths: string[], callback: (...modules: any[]) => void): void;
|
||||
/**
|
||||
* Download additional dependencies on demand. The paths array lists modules that should be available. When they are, callback is called. If the callback is a function expression, dependencies in that source part are extracted and also loaded on demand. A single request is fired to the server, except if all modules are already available.
|
||||
*
|
||||
* This creates a chunk. The chunk can be named. If a chunk with this name already exists, the dependencies are merged into that chunk and that chunk is used.
|
||||
*/
|
||||
ensure: (paths: string[], callback: (require: <T>(path: string) => T) => void, chunkName?: string) => void;
|
||||
context: (path: string, deep?: boolean, filter?: RegExp) => RequireContext;
|
||||
/**
|
||||
* Returns the module id of a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available.
|
||||
*
|
||||
* The module id is a number in webpack (in contrast to node.js where it is a string, the filename).
|
||||
*/
|
||||
resolve(path: string): number | string;
|
||||
/**
|
||||
* Like require.resolve, but doesn’t include the module into the bundle. It’s a weak dependency.
|
||||
*/
|
||||
resolveWeak(path: string): number;
|
||||
/**
|
||||
* Ensures that the dependency is available, but don’t execute it. This can be use for optimizing the position of a module in the chunks.
|
||||
*/
|
||||
include(path: string): void;
|
||||
/**
|
||||
* Multiple requires to the same module result in only one module execution and only one export. Therefore a cache in the runtime exists. Removing values from this cache cause new module execution and a new export. This is only needed in rare cases (for compatibility!).
|
||||
*/
|
||||
cache: {
|
||||
[id: string]: any;
|
||||
}
|
||||
}
|
||||
|
||||
interface Module {
|
||||
exports: any;
|
||||
require(id: string): any;
|
||||
id: string;
|
||||
filename: string;
|
||||
loaded: boolean;
|
||||
parent: any;
|
||||
children: any[];
|
||||
hot: Hot;
|
||||
}
|
||||
type ModuleId = string|number;
|
||||
|
||||
interface Hot {
|
||||
/**
|
||||
* Accept code updates for the specified dependencies. The callback is called when dependencies were replaced.
|
||||
* @param dependencies
|
||||
* @param callback
|
||||
*/
|
||||
accept(dependencies: string[], callback: (updatedDependencies: ModuleId[]) => void): void;
|
||||
/**
|
||||
* Accept code updates for the specified dependencies. The callback is called when dependencies were replaced.
|
||||
* @param dependency
|
||||
* @param callback
|
||||
*/
|
||||
accept(dependency: string, callback: () => void): void;
|
||||
/**
|
||||
* Accept code updates for this module without notification of parents.
|
||||
* This should only be used if the module doesn’t export anything.
|
||||
* The errHandler can be used to handle errors that occur while loading the updated module.
|
||||
* @param errHandler
|
||||
*/
|
||||
accept(errHandler?: (err: Error) => void): void;
|
||||
/**
|
||||
* Do not accept updates for the specified dependencies. If any dependencies is updated, the code update fails with code "decline".
|
||||
*/
|
||||
decline(dependencies: string[]): void;
|
||||
/**
|
||||
* Do not accept updates for the specified dependencies. If any dependencies is updated, the code update fails with code "decline".
|
||||
*/
|
||||
decline(dependency: string): void;
|
||||
/**
|
||||
* Flag the current module as not update-able. If updated the update code would fail with code "decline".
|
||||
*/
|
||||
decline(): void;
|
||||
/**
|
||||
* Add a one time handler, which is executed when the current module code is replaced.
|
||||
* Here you should destroy/remove any persistent resource you have claimed/created.
|
||||
* If you want to transfer state to the new module, add it to data object.
|
||||
* The data will be available at module.hot.data on the new module.
|
||||
* @param callback
|
||||
*/
|
||||
dispose<T>(callback: (data: T) => void): void;
|
||||
/**
|
||||
* Add a one time handler, which is executed when the current module code is replaced.
|
||||
* Here you should destroy/remove any persistent resource you have claimed/created.
|
||||
* If you want to transfer state to the new module, add it to data object.
|
||||
* The data will be available at module.hot.data on the new module.
|
||||
* @param callback
|
||||
*/
|
||||
addDisposeHandler<T>(callback: (data: T) => void): void;
|
||||
/**
|
||||
* Remove a handler.
|
||||
* This can useful to add a temporary dispose handler. You could i. e. replace code while in the middle of a multi-step async function.
|
||||
* @param callback
|
||||
*/
|
||||
removeDisposeHandler<T>(callback: (data: T) => void): void;
|
||||
/**
|
||||
* Throws an exceptions if status() is not idle.
|
||||
* Check all currently loaded modules for updates and apply updates if found.
|
||||
* If no update was found, the callback is called with null.
|
||||
* If autoApply is truthy the callback will be called with all modules that were disposed.
|
||||
* apply() is automatically called with autoApply as options parameter.
|
||||
* If autoApply is not set the callback will be called with all modules that will be disposed on apply().
|
||||
* @param autoApply
|
||||
* @param callback
|
||||
*/
|
||||
check(autoApply: boolean, callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
|
||||
/**
|
||||
* Throws an exceptions if status() is not idle.
|
||||
* Check all currently loaded modules for updates and apply updates if found.
|
||||
* If no update was found, the callback is called with null.
|
||||
* The callback will be called with all modules that will be disposed on apply().
|
||||
* @param callback
|
||||
*/
|
||||
check(callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
|
||||
/**
|
||||
* If status() != "ready" it throws an error.
|
||||
* Continue the update process.
|
||||
* @param options
|
||||
* @param callback
|
||||
*/
|
||||
apply(options: AcceptOptions, callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
|
||||
/**
|
||||
* If status() != "ready" it throws an error.
|
||||
* Continue the update process.
|
||||
* @param callback
|
||||
*/
|
||||
apply(callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
|
||||
/**
|
||||
* Return one of idle, check, watch, watch-delay, prepare, ready, dispose, apply, abort or fail.
|
||||
*/
|
||||
status(): string;
|
||||
/** Register a callback on status change. */
|
||||
status(callback: (status: string) => void): void;
|
||||
/** Register a callback on status change. */
|
||||
addStatusHandler(callback: (status: string) => void): void;
|
||||
/**
|
||||
* Remove a registered status change handler.
|
||||
* @param callback
|
||||
*/
|
||||
removeStatusHandler(callback: (status: string) => void): void;
|
||||
|
||||
active: boolean;
|
||||
data: {};
|
||||
}
|
||||
|
||||
interface AcceptOptions {
|
||||
/**
|
||||
* If true the update process continues even if some modules are not accepted (and would bubble to the entry point).
|
||||
*/
|
||||
ignoreUnaccepted?: boolean;
|
||||
/**
|
||||
* Indicates that apply() is automatically called by check function
|
||||
*/
|
||||
autoApply?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
interface NodeRequire extends __WebpackModuleApi.RequireFunction {
|
||||
}
|
||||
|
||||
declare var require: NodeRequire;
|
||||
|
||||
/**
|
||||
* The resource query of the current module.
|
||||
*
|
||||
* e.g. __resourceQuery === "?test" // Inside "file.js?test"
|
||||
*/
|
||||
declare var __resourceQuery: string;
|
||||
|
||||
/**
|
||||
* Equals the config options output.publicPath.
|
||||
*/
|
||||
declare var __webpack_public_path__: string;
|
||||
|
||||
/**
|
||||
* The raw require function. This expression isn’t parsed by the Parser for dependencies.
|
||||
*/
|
||||
declare var __webpack_require__: any;
|
||||
|
||||
/**
|
||||
* The internal chunk loading function
|
||||
*
|
||||
* @param chunkId The id for the chunk to load.
|
||||
* @param callback A callback function called once the chunk is loaded.
|
||||
*/
|
||||
declare var __webpack_chunk_load__: (chunkId: any, callback: (require: (id: string) => any) => void) => void;
|
||||
|
||||
/**
|
||||
* Access to the internal object of all modules.
|
||||
*/
|
||||
declare var __webpack_modules__: any[];
|
||||
|
||||
/**
|
||||
* Access to the hash of the compilation.
|
||||
*
|
||||
* Only available with the HotModuleReplacementPlugin or the ExtendedAPIPlugin
|
||||
*/
|
||||
declare var __webpack_hash__: any;
|
||||
|
||||
/**
|
||||
* Generates a require function that is not parsed by webpack. Can be used to do cool stuff with a global require function if available.
|
||||
*/
|
||||
declare var __non_webpack_require__: any;
|
||||
|
||||
/**
|
||||
* Equals the config option debug
|
||||
*/
|
||||
declare var DEBUG: boolean;
|
||||
|
||||
interface NodeModule extends __WebpackModuleApi.Module {}
|
||||
|
||||
declare var module: NodeModule;
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"resolution": "main",
|
||||
"tree": {
|
||||
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/d20a983f78abfcda79fc85c66a5f0736e45ab99f/webpack-env/index.d.ts",
|
||||
"raw": "registry:dt/webpack-env#1.13.0+20170105061735",
|
||||
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/d20a983f78abfcda79fc85c66a5f0736e45ab99f/webpack-env/index.d.ts"
|
||||
}
|
||||
}
|
|
@ -1,8 +1 @@
|
|||
/// <reference path="globals/react-data-grid/index.d.ts" />
|
||||
/// <reference path="globals/redux-promise-middleware/index.d.ts" />
|
||||
/// <reference path="globals/redux/index.d.ts" />
|
||||
/// <reference path="modules/react-redux/index.d.ts" />
|
||||
/// <reference path="modules/react-router-redux/index.d.ts" />
|
||||
/// <reference path="modules/react-router/index.d.ts" />
|
||||
/// <reference path="modules/react-select/index.d.ts" />
|
||||
/// <reference path="modules/redux-thunk/index.d.ts" />
|
||||
|
||||
|
|
|
@ -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
|
@ -9,11 +9,9 @@
|
|||
"src": "https://raw.githubusercontent.com/andrew-w-ross/typings-redux/master/typings.json",
|
||||
"raw": "github:andrew-w-ross/typings-redux",
|
||||
"main": "redux.d.ts",
|
||||
"name": "redux",
|
||||
"type": "typings"
|
||||
"name": "redux"
|
||||
}
|
||||
},
|
||||
"name": "react-redux",
|
||||
"type": "typings"
|
||||
"name": "react-redux"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,18 +9,15 @@
|
|||
"src": "https://raw.githubusercontent.com/andrew-w-ross/typings-history/master/typings.json",
|
||||
"raw": "github:andrew-w-ross/typings-history",
|
||||
"main": "history.d.ts",
|
||||
"name": "history",
|
||||
"type": "typings"
|
||||
"name": "history"
|
||||
},
|
||||
"redux": {
|
||||
"src": "https://raw.githubusercontent.com/andrew-w-ross/typings-redux/master/typings.json",
|
||||
"raw": "github:andrew-w-ross/typings-redux",
|
||||
"main": "redux.d.ts",
|
||||
"name": "redux",
|
||||
"type": "typings"
|
||||
"name": "redux"
|
||||
}
|
||||
},
|
||||
"name": "react-router-redux",
|
||||
"type": "typings"
|
||||
"name": "react-router-redux"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,9 @@
|
|||
"src": "https://raw.githubusercontent.com/andrew-w-ross/typings-history/master/typings.json",
|
||||
"raw": "github:andrew-w-ross/typings-history",
|
||||
"main": "history.d.ts",
|
||||
"name": "history",
|
||||
"type": "typings"
|
||||
"name": "history"
|
||||
}
|
||||
},
|
||||
"name": "react-router",
|
||||
"type": "typings"
|
||||
"name": "react-router"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,9 @@
|
|||
"src": "https://raw.githubusercontent.com/andrew-w-ross/typings-redux/master/typings.json",
|
||||
"raw": "github:andrew-w-ross/typings-redux",
|
||||
"main": "redux.d.ts",
|
||||
"name": "redux",
|
||||
"type": "typings"
|
||||
"name": "redux"
|
||||
}
|
||||
},
|
||||
"name": "redux-thunk",
|
||||
"type": "typings"
|
||||
"name": "redux-thunk"
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,19 +0,0 @@
|
|||
// Type definitions for React v0.14 (react-addons-css-transition-group)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
namespace __Addons {
|
||||
export function shallowCompare<P, S>(
|
||||
component: __React.Component<P, S>,
|
||||
nextProps: P,
|
||||
nextState: S): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-addons-shallow-compare" {
|
||||
export = __React.__Addons.shallowCompare;
|
||||
}
|
|
@ -1,155 +0,0 @@
|
|||
// Type definitions for React v0.14 (react-addons-test-utils)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
interface SyntheticEventData {
|
||||
altKey?: boolean;
|
||||
button?: number;
|
||||
buttons?: number;
|
||||
clientX?: number;
|
||||
clientY?: number;
|
||||
changedTouches?: TouchList;
|
||||
charCode?: boolean;
|
||||
clipboardData?: DataTransfer;
|
||||
ctrlKey?: boolean;
|
||||
deltaMode?: number;
|
||||
deltaX?: number;
|
||||
deltaY?: number;
|
||||
deltaZ?: number;
|
||||
detail?: number;
|
||||
getModifierState?(key: string): boolean;
|
||||
key?: string;
|
||||
keyCode?: number;
|
||||
locale?: string;
|
||||
location?: number;
|
||||
metaKey?: boolean;
|
||||
pageX?: number;
|
||||
pageY?: number;
|
||||
relatedTarget?: EventTarget;
|
||||
repeat?: boolean;
|
||||
screenX?: number;
|
||||
screenY?: number;
|
||||
shiftKey?: boolean;
|
||||
targetTouches?: TouchList;
|
||||
touches?: TouchList;
|
||||
view?: AbstractView;
|
||||
which?: number;
|
||||
}
|
||||
|
||||
interface EventSimulator {
|
||||
(element: Element, eventData?: SyntheticEventData): void;
|
||||
(component: Component<any, any>, eventData?: SyntheticEventData): void;
|
||||
}
|
||||
|
||||
interface MockedComponentClass {
|
||||
new(): any;
|
||||
}
|
||||
|
||||
class ShallowRenderer {
|
||||
getRenderOutput<E extends ReactElement<any>>(): E;
|
||||
getRenderOutput(): ReactElement<any>;
|
||||
render(element: ReactElement<any>, context?: any): void;
|
||||
unmount(): void;
|
||||
}
|
||||
|
||||
namespace __Addons {
|
||||
namespace TestUtils {
|
||||
namespace Simulate {
|
||||
export var blur: EventSimulator;
|
||||
export var change: EventSimulator;
|
||||
export var click: EventSimulator;
|
||||
export var cut: EventSimulator;
|
||||
export var doubleClick: EventSimulator;
|
||||
export var drag: EventSimulator;
|
||||
export var dragEnd: EventSimulator;
|
||||
export var dragEnter: EventSimulator;
|
||||
export var dragExit: EventSimulator;
|
||||
export var dragLeave: EventSimulator;
|
||||
export var dragOver: EventSimulator;
|
||||
export var dragStart: EventSimulator;
|
||||
export var drop: EventSimulator;
|
||||
export var focus: EventSimulator;
|
||||
export var input: EventSimulator;
|
||||
export var keyDown: EventSimulator;
|
||||
export var keyPress: EventSimulator;
|
||||
export var keyUp: EventSimulator;
|
||||
export var mouseDown: EventSimulator;
|
||||
export var mouseEnter: EventSimulator;
|
||||
export var mouseLeave: EventSimulator;
|
||||
export var mouseMove: EventSimulator;
|
||||
export var mouseOut: EventSimulator;
|
||||
export var mouseOver: EventSimulator;
|
||||
export var mouseUp: EventSimulator;
|
||||
export var paste: EventSimulator;
|
||||
export var scroll: EventSimulator;
|
||||
export var submit: EventSimulator;
|
||||
export var touchCancel: EventSimulator;
|
||||
export var touchEnd: EventSimulator;
|
||||
export var touchMove: EventSimulator;
|
||||
export var touchStart: EventSimulator;
|
||||
export var wheel: EventSimulator;
|
||||
}
|
||||
|
||||
export function renderIntoDocument(
|
||||
element: DOMElement<any>): Element;
|
||||
export function renderIntoDocument<P>(
|
||||
element: ReactElement<P>): Component<P, any>;
|
||||
export function renderIntoDocument<C extends Component<any, any>>(
|
||||
element: ReactElement<any>): C;
|
||||
|
||||
export function mockComponent(
|
||||
mocked: MockedComponentClass, mockTagName?: string): typeof TestUtils;
|
||||
|
||||
export function isElementOfType(
|
||||
element: ReactElement<any>, type: ReactType): boolean;
|
||||
export function isDOMComponent(instance: ReactInstance): boolean;
|
||||
export function isCompositeComponent(instance: ReactInstance): boolean;
|
||||
export function isCompositeComponentWithType(
|
||||
instance: ReactInstance,
|
||||
type: ComponentClass<any>): boolean;
|
||||
|
||||
export function findAllInRenderedTree(
|
||||
root: Component<any, any>,
|
||||
fn: (i: ReactInstance) => boolean): ReactInstance[];
|
||||
|
||||
export function scryRenderedDOMComponentsWithClass(
|
||||
root: Component<any, any>,
|
||||
className: string): Element[];
|
||||
export function findRenderedDOMComponentWithClass(
|
||||
root: Component<any, any>,
|
||||
className: string): Element;
|
||||
|
||||
export function scryRenderedDOMComponentsWithTag(
|
||||
root: Component<any, any>,
|
||||
tagName: string): Element[];
|
||||
export function findRenderedDOMComponentWithTag(
|
||||
root: Component<any, any>,
|
||||
tagName: string): Element;
|
||||
|
||||
export function scryRenderedComponentsWithType<P>(
|
||||
root: Component<any, any>,
|
||||
type: ComponentClass<P>): Component<P, {}>[];
|
||||
export function scryRenderedComponentsWithType<C extends Component<any, any>>(
|
||||
root: Component<any, any>,
|
||||
type: ComponentClass<any>): C[];
|
||||
|
||||
export function findRenderedComponentWithType<P>(
|
||||
root: Component<any, any>,
|
||||
type: ComponentClass<P>): Component<P, {}>;
|
||||
export function findRenderedComponentWithType<C extends Component<any, any>>(
|
||||
root: Component<any, any>,
|
||||
type: ComponentClass<any>): C;
|
||||
|
||||
export function createRenderer(): ShallowRenderer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-addons-test-utils" {
|
||||
import TestUtils = __React.__Addons.TestUtils;
|
||||
export = TestUtils;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
// Type definitions for React v0.14 (react-addons-update)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
interface UpdateSpecCommand {
|
||||
$set?: any;
|
||||
$merge?: {};
|
||||
$apply?(value: any): any;
|
||||
}
|
||||
|
||||
interface UpdateSpecPath {
|
||||
[key: string]: UpdateSpec;
|
||||
}
|
||||
|
||||
type UpdateSpec = UpdateSpecCommand | UpdateSpecPath;
|
||||
|
||||
interface UpdateArraySpec extends UpdateSpecCommand {
|
||||
$push?: any[];
|
||||
$unshift?: any[];
|
||||
$splice?: any[][];
|
||||
}
|
||||
|
||||
namespace __Addons {
|
||||
export function update(value: any[], spec: UpdateArraySpec): any[];
|
||||
export function update(value: {}, spec: UpdateSpec): any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-addons-update" {
|
||||
export = __React.__Addons.update;
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
// Type definitions for React v0.14 (react-dom)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
namespace __DOM {
|
||||
function findDOMNode<E extends Element>(instance: ReactInstance): E;
|
||||
function findDOMNode(instance: ReactInstance): Element;
|
||||
|
||||
function render<P>(
|
||||
element: DOMElement<P>,
|
||||
container: Element,
|
||||
callback?: (element: Element) => any): Element;
|
||||
function render<P, S>(
|
||||
element: ClassicElement<P>,
|
||||
container: Element,
|
||||
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
|
||||
function render<P, S>(
|
||||
element: ReactElement<P>,
|
||||
container: Element,
|
||||
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
||||
|
||||
function unmountComponentAtNode(container: Element): boolean;
|
||||
|
||||
var version: string;
|
||||
|
||||
function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
|
||||
function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
||||
function unstable_batchedUpdates(callback: () => any): void;
|
||||
|
||||
function unstable_renderSubtreeIntoContainer<P>(
|
||||
parentComponent: Component<any, any>,
|
||||
nextElement: DOMElement<P>,
|
||||
container: Element,
|
||||
callback?: (element: Element) => any): Element;
|
||||
function unstable_renderSubtreeIntoContainer<P, S>(
|
||||
parentComponent: Component<any, any>,
|
||||
nextElement: ClassicElement<P>,
|
||||
container: Element,
|
||||
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
|
||||
function unstable_renderSubtreeIntoContainer<P, S>(
|
||||
parentComponent: Component<any, any>,
|
||||
nextElement: ReactElement<P>,
|
||||
container: Element,
|
||||
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
||||
}
|
||||
|
||||
namespace __DOMServer {
|
||||
function renderToString(element: ReactElement<any>): string;
|
||||
function renderToStaticMarkup(element: ReactElement<any>): string;
|
||||
var version: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-dom" {
|
||||
import DOM = __React.__DOM;
|
||||
export = DOM;
|
||||
}
|
||||
|
||||
declare module "react-dom/server" {
|
||||
import DOMServer = __React.__DOMServer;
|
||||
export = DOMServer;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,18 +1,7 @@
|
|||
/// <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="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="knockout/knockout.d.ts" />
|
||||
/// <reference path="combokeys/combokeys.d.ts" />
|
||||
|
|
Loading…
Reference in New Issue