forked from jquense/react-big-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6840e5d
Showing
54 changed files
with
2,668 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"stage": 1, | ||
"loose": [ | ||
"all" | ||
], | ||
"plugins": ["object-assign"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
lib | ||
node_modules | ||
webpack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"node": true | ||
}, | ||
"ecmaFeatures": { | ||
"jsx": true | ||
}, | ||
"parser": "babel-eslint", | ||
"plugins": [ | ||
"react", | ||
"babel" | ||
], | ||
"rules": { | ||
"constructor-super": 2, | ||
"comma-spacing": 2, | ||
"comma-style": 0, | ||
"one-var": 0, | ||
"semi": [0, "never"], | ||
"curly": 0, | ||
"key-spacing": 0, | ||
"no-this-before-super": 2, | ||
"no-underscore-dangle": 0, | ||
"no-unused-expressions": 0, | ||
"no-unused-vars": [2, { "vars": "all", "args": "none" }], | ||
"no-multi-spaces": 0, | ||
"babel/object-shorthand": 2, | ||
"quotes": [2, "single", "avoid-escape"], | ||
"react/display-name": 0, | ||
"react/jsx-boolean-value": [2, "never"], | ||
"react/jsx-no-duplicate-props": 2, | ||
"react/jsx-no-undef": 2, | ||
"react/jsx-uses-react": 2, | ||
"react/no-did-mount-set-state": 2, | ||
"react/no-did-update-set-state": 2, | ||
"react/react-in-jsx-scope": 2, | ||
"react/self-closing-comp": 2, | ||
"react/wrap-multilines": 2, | ||
"react/jsx-uses-vars": 2, | ||
"space-infix-ops": 2, | ||
"strict": [2, "never"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
|
||
# Custom for Visual Studio | ||
*.cs diff=csharp | ||
|
||
# Standard to msysgit | ||
*.doc diff=astextplain | ||
*.DOC diff=astextplain | ||
*.docx diff=astextplain | ||
*.DOCX diff=astextplain | ||
*.dot diff=astextplain | ||
*.DOT diff=astextplain | ||
*.pdf diff=astextplain | ||
*.PDF diff=astextplain | ||
*.rtf diff=astextplain | ||
*.RTF diff=astextplain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
lib/ | ||
|
||
# Logs | ||
logs | ||
*.log | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- "iojs" | ||
before_install: | ||
- export CHROME_BIN=chromium-browser | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 react-bootstrap | ||
|
||
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014 Jason Quense | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react'; | ||
import { render } from 'react-dom'; | ||
|
||
import Button from 'react-bootstrap/lib/Button'; | ||
import { date as localizer } from 'react-widgets-globalize-localizer' | ||
|
||
import { set } from 'react-big-calendar/utils/localizer'; | ||
|
||
set(localizer); | ||
|
||
import BigCalendar from 'react-big-calendar'; | ||
|
||
import 'react-big-calendar/less/styles.less'; | ||
import './styles.less'; | ||
|
||
|
||
const Example = React.createClass({ | ||
|
||
render() { | ||
|
||
return ( | ||
<div className='app row'> | ||
<article className='side-panel col-md-2'> | ||
<ul className='list-unstyled'> | ||
<li><a href='#bigcalendar'>Big Calendar</a></li> | ||
</ul> | ||
</article> | ||
<main className='col-md-10'> | ||
<BigCalendar/> | ||
</main> | ||
</div> | ||
); | ||
} | ||
}); | ||
|
||
render(<Example/>, document.body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
import merge from 'lodash/object/merge'; | ||
import React from 'react'; | ||
|
||
import Label from 'react-bootstrap/lib/Label'; | ||
import Table from 'react-bootstrap/lib/Table'; | ||
|
||
let cleanDocletValue = str => str.trim().replace(/^\{/, '').replace(/\}$/, ''); | ||
|
||
function getPropsData(componentData, metadata){ | ||
let props = componentData.props || {}; | ||
|
||
if (componentData.composes) { | ||
componentData.composes.forEach( other => { | ||
props = merge({}, getPropsData(metadata[other] || {}, metadata), props); | ||
|
||
}); | ||
} | ||
|
||
if (componentData.mixins) { | ||
componentData.mixins.forEach( other => { | ||
if ( componentData.composes.indexOf(other) === -1) { | ||
props = merge({}, getPropsData(metadata[other] || {}, metadata), props); | ||
} | ||
}); | ||
} | ||
|
||
return props; | ||
} | ||
|
||
const PropTable = React.createClass({ | ||
|
||
contextTypes: { | ||
metadata: React.PropTypes.object | ||
}, | ||
|
||
componentWillMount(){ | ||
let componentData = this.props.metadata[this.props.component] || {}; | ||
this.propsData = getPropsData(componentData, this.props.metadata); | ||
}, | ||
|
||
render(){ | ||
let propsData = this.propsData; | ||
let composes = this.props.metadata[this.props.component].composes || []; | ||
|
||
if ( !Object.keys(propsData).length ){ | ||
return <span/>; | ||
} | ||
|
||
return ( | ||
<div> | ||
<h3> | ||
Props | ||
{ !!composes.length && [<br/>, | ||
<small> | ||
{'Also accepts the same props as: '} | ||
<em> | ||
{ composes.reduce( | ||
(arr, name) => arr.concat(<code>{`<${name}/>`}</code>, ' '), []) | ||
} | ||
</em> | ||
</small> | ||
] | ||
} | ||
</h3> | ||
|
||
<Table bordered striped className="prop-table"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Type</th> | ||
<th>Default</th> | ||
<th>Description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{ this._renderRows(propsData) } | ||
</tbody> | ||
</Table> | ||
</div> | ||
); | ||
}, | ||
|
||
_renderRows(propsData){ | ||
|
||
return Object.keys(propsData) | ||
.sort() | ||
.filter(propName => propsData[propName].type && !propsData[propName].doclets.private ) | ||
.map(propName => { | ||
let propData = propsData[propName]; | ||
|
||
return ( | ||
<tr key={propName} className='prop-table-row'> | ||
<td> | ||
{propName} {this.renderRequiredLabel(propData)} | ||
</td> | ||
<td> | ||
<div>{this.getType(propData)}</div> | ||
</td> | ||
<td>{propData.defaultValue}</td> | ||
|
||
<td> | ||
{ propData.doclets.deprecated | ||
&& <div><strong className='text-danger'>{'Deprecated: ' + propData.doclets.deprecated + ' '}</strong></div> | ||
} | ||
<div dangerouslySetInnerHTML={{__html: propData.descHtml }} /> | ||
</td> | ||
</tr> | ||
); | ||
}); | ||
}, | ||
|
||
renderRequiredLabel(prop) { | ||
if (!prop.required) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Label>required</Label> | ||
); | ||
}, | ||
|
||
getType(prop) { | ||
let type = prop.type || {}; | ||
let name = this.getDisplayTypeName(type.name); | ||
let doclets = prop.doclets || {}; | ||
|
||
switch (name) { | ||
case 'object': | ||
return name; | ||
case 'union': | ||
return type.value.reduce((current, val, i, list) => { | ||
let item = this.getType({ type: val }); | ||
if (React.isValidElement(item)) { | ||
item = React.cloneElement(item, {key: i}); | ||
} | ||
current = current.concat(item); | ||
|
||
return i === (list.length - 1) ? current : current.concat(' | '); | ||
}, []); | ||
case 'array': | ||
let child = this.getType({ type: type.value }); | ||
|
||
return <span>{'array<'}{ child }{'>'}</span>; | ||
case 'enum': | ||
return this.renderEnum(type); | ||
case 'custom': | ||
return cleanDocletValue(doclets.type || name); | ||
default: | ||
return name; | ||
} | ||
}, | ||
|
||
getDisplayTypeName(typeName) { | ||
if (typeName === 'func') { | ||
return 'function'; | ||
} else if (typeName === 'bool') { | ||
return 'boolean'; | ||
} else { | ||
return typeName; | ||
} | ||
}, | ||
|
||
renderEnum(enumType) { | ||
const enumValues = enumType.value || []; | ||
|
||
const renderedEnumValues = []; | ||
enumValues.forEach(function renderEnumValue(enumValue, i) { | ||
if (i > 0) { | ||
renderedEnumValues.push( | ||
<span key={`${i}c`}>, </span> | ||
); | ||
} | ||
|
||
renderedEnumValues.push( | ||
<code key={i}>{enumValue}</code> | ||
); | ||
}); | ||
|
||
return ( | ||
<span>one of: {renderedEnumValues}</span> | ||
); | ||
} | ||
}); | ||
|
||
|
||
|
||
export default PropTable; |
Oops, something went wrong.