From 27f1a7bd6de417c411ce666230197de392d6d301 Mon Sep 17 00:00:00 2001 From: Khoa Tran Date: Tue, 11 Jul 2017 10:56:13 +1000 Subject: [PATCH 1/3] tidy up and fix issue with handling enum values --- docs/demo/demo.d6b863d3d393b27fe6bc.js | 1 + docs/demo/demo.ecab1944e41f85fb710a.js | 1 - docs/demo/index.html | 2 +- ...e9.js => manifest.bab02a0a747dc0f2c8c5.js} | 2 +- src/components/Property/Property.js | 70 +++++++++++-------- 5 files changed, 43 insertions(+), 33 deletions(-) create mode 100644 docs/demo/demo.d6b863d3d393b27fe6bc.js delete mode 100644 docs/demo/demo.ecab1944e41f85fb710a.js rename docs/demo/{manifest.d9e9a07772efbfebb4e9.js => manifest.bab02a0a747dc0f2c8c5.js} (55%) diff --git a/docs/demo/demo.d6b863d3d393b27fe6bc.js b/docs/demo/demo.d6b863d3d393b27fe6bc.js new file mode 100644 index 0000000..cd064a6 --- /dev/null +++ b/docs/demo/demo.d6b863d3d393b27fe6bc.js @@ -0,0 +1 @@ +webpackJsonp([1],{115:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s,c=function(){function e(e,t){for(var n,r=0;r div":{height:"100%"},body:{height:"100%",margin:"0",padding:"0",fontFamily:'-apple-system,BlinkMacSystemFont,"Segoe UI",Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",helvetica,sans-serif;',lineHeight:"1.4",fontSize:"1em"},"ul, ol":{margin:".5rem 0",padding:"0","& li":{marginLeft:"1.5rem"}},"h3, h4, h5, h6":{margin:"0",fontWeight:"400"},a:{color:e.text.link+"",textDecoration:"none","&:hover":{transition:"color .25s",color:(0,a.default)(e.text.link).lighten(.1)+"",textDecoration:"underline"}}}}}.bind(void 0))},121:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0;var r=n(459),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.clone=i.default},225:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(1),o=r(i),a=n(183),u=r(a),l=n(261),s=document.body.appendChild(document.createElement("div"));u.default.render(o.default.createElement(l.Demo,null),s)},226:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}Object.defineProperty(t,"__esModule",{value:!0}),t.styles=void 0;var o=n(7),a=n(23),u=function(e){return e&&e.__esModule?e:{default:e}}(a);t.styles=(0,o.createSheet)(function(e){var t=e.text,n=e.backgrounds,o=e.sizes;return i(void 0,void 0),r({bodyContent:{display:"table",width:"100%",padding:"10px",boxSizing:"border-box"},tabs:{"& > div":{display:"inline-block",padding:"10px 20px",cursor:"pointer","&:not($active)":{color:(0,u.default)(t.default).lighten(.5)+""}}},active:{backgroundColor:n.schema+"",borderRadius:"10px 10px 0 0"}},"@media (max-width: "+o.breakpoint+")",{bodyContent:{padding:"10px 0"}})}.bind(void 0))},227:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}Object.defineProperty(t,"__esModule",{value:!0}),t.styles=void 0;var o=n(7),a=n(76);t.styles=(0,o.createSheet)(function(e){var t,n,o=e.backgrounds,u=e.borders,l=e.sizes;return i(void 0,void 0),n={bodySchema:{width:"100%",borderSpacing:"0",padding:"10px 50px 10px 20px",boxSizing:"border-box",borderRadius:"10px",fontSize:"14.5px"},even:{backgroundColor:o.default+""},odd:{backgroundColor:o.schema+""},subset:(t={},r(t,"& + ."+a.styles.classes.property+":not(."+a.styles.classes.last+")",r({},"& ."+a.styles.classes.name+"::after",{content:'""',borderLeft:"1px solid "+u.default,position:"absolute",bottom:"0",left:"0",height:"100%"})),r(t,"& > td",{borderLeft:"1px solid "+u.default}),r(t,"."+a.styles.classes.last+" + & > td",{borderLeft:"none"}),t),array:{fontFamily:"monospace",padding:"5px 10px"},hasTabs:{borderTopLeftRadius:0}},r(n,"@media (max-width: "+l.breakpoint+")",{bodySchema:{paddingRight:"10px",fontSize:"0.8rem"}}),r(n,"isAdditional",{textAlign:"left",fontStyle:"italic"}),n}.bind(void 0))},228:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;r span":{color:"white",padding:"2px 10px",cursor:"pointer"}},hovered:{"&$buttons":{transition:"all .2s",opacity:"1"}}}}.bind(void 0))},236:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(e,t){for(var n,r=0;r h3":{marginBottom:"15px","& > span":{fontFamily:"monospace",textTransform:"uppercase",marginLeft:"10px","&.get":{color:n.get+""},"&.post":{color:n.post+""},"&.put":{color:n.put+""},"&.delete":{color:n.delete+""}}},"& h4":{fontSize:"smaller",textTransform:"uppercase",color:(0,u.default)(n.default).lighten(.5)+"",borderBottom:"1px solid "+t.default,marginTop:"20px"}}},"@media (max-width: "+o.breakpoint+")",{method:{padding:"1rem",margin:0}})}.bind(void 0))},241:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t div + div",{borderTop:"1px solid "+o.default}),r(t,"& a",{color:u.default+"",padding:".7rem 1rem","&:hover":{color:(0,l.default)(u.default).lighten(.1)+"",transition:"all .2s"}}),t)},"@media (max-width: "+s.breakpoint+")",{navigation:{display:"block",width:"100%",height:"auto",right:"100%",zIndex:"99",transition:"right .5s"},isOpen:{position:"relative",right:0}})}.bind(void 0))},243:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u,l=function(){function e(e,t){for(var n,r=0;r")),d.default.createElement(w.default,{constraints:u,type:r,isRequired:l}),(g&&g.length||s||a)&&d.default.createElement("div",{className:b.additionalInfo},g&&this.renderEnumValues(g,this.state.isEnumReduced),void 0!==s&&this.renderDefaultValue(s),a&&d.default.createElement("div",null,d.default.createElement(v.default,{isInline:!0,description:a})))))}},{key:"renderEnumValues",value:function(e,t){var n=this,r=this.props.classes;return d.default.createElement("div",null,d.default.createElement("span",null,"Valid values:"),e.map(function(e){return i(this,n),d.default.createElement("span",{key:e,className:r.enum},e)}.bind(this)),t&&d.default.createElement("a",{onClick:this.displayAllEnums},"..."))}},{key:"displayAllEnums",value:function(){this.setState({isEnumReduced:!1})}},{key:"renderDefaultValue",value:function(e){var t;return"number"==typeof e||"string"==typeof e?t=e:"boolean"==typeof e?t=e.toString():Array.isArray(e)&&(t="["+e.join(", ")+"]"),d.default.createElement("div",{className:"default"},"Default: ",d.default.createElement("span",null,t))}}]),t}(f.PureComponent))||s;t.default=E,E.propTypes={name:b.default.string.isRequired,type:b.default.arrayOf(b.default.string).isRequired,subtype:b.default.string,title:b.default.string,description:b.default.string,constraints:b.default.shape({format:b.default.string,exclusiveMinimum:b.default.number,exclusiveMaximum:b.default.number,maximum:b.default.number,maxItems:b.default.number,maxLength:b.default.number,maxProperties:b.default.number,minimum:b.default.number,minItems:b.default.number,minLength:b.default.number,minProperties:b.default.number,multipleOf:b.default.number,pattern:b.default.string,uniqueItems:b.default.bool}),enumValues:b.default.array,defaultValue:b.default.any,isRequired:b.default.bool,isOpen:b.default.bool,isLast:b.default.bool,onClick:b.default.func,classes:b.default.object,attributes:b.default.object}},252:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;r=parseInt(e,10)}}]),t}(c.PureComponent))||l;t.default=O,O.propTypes={response:y.default.shape({code:y.default.string,description:y.default.string,schema:y.default.array,examples:y.default.array}),classes:y.default.object,initialSchemaTreeDepth:y.default.number}},254:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}Object.defineProperty(t,"__esModule",{value:!0}),t.styles=void 0;var o=n(7),a=n(75);t.styles=(0,o.createSheet)(function(e){e.shades;return i(void 0,void 0),{response:{marginBottom:"5px",bodyContent:{margin:"10px 0 20px 20px"}},info:r({padding:"10px",fontSize:"0.9rem"},"& "+a.styles.classes.indicator,{marginRight:"10px"}),isClickable:{cursor:"pointer"},code:{paddingRight:"20px"},success:{"& $code":{color:"rgb(76, 204, 79)"}},error:{"& $code":{color:"rgb(235, 15, 40)"}}}}.bind(void 0))},255:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;r li > span":{fontWeight:600}}},"@media (max-width: "+o.breakpoint+")",{securityContainer:{padding:"1rem"}})}.bind(void 0))},257:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;rt?1:0}function i(e,t){var n=e.toUpperCase(),r=t.toUpperCase();return u[n]-u[r]}function o(e,t){return e.type===t.type?r(e.title,t.title):i(e.type,t.type)}function a(e){switch(e){case"alpha":return o;case!1:default:return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.sortByAlphabet=r,t.sortByHttpMethod=i,t.sortByUIMethod=o,t.getSortingFunction=a;var u={GET:1,POST:2,PUT:3,DELETE:4,HEAD:5,OPTIONS:6,TRACE:7,CONNECT:8}},265:function(e,t,n){"use strict";function r(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t "+t):a.push("≤ "+r):a.push("≥ "+i),a}Object.defineProperty(t,"__esModule",{value:!0}),t.getConstraintHints=r},269:function(e,t,n){"use strict";function r(e){if(!e)return[];var t=e.minProperties,n=e.maxProperties,r=[];return void 0!==n&&void 0!==t?n===t?r.push(t+" properties"):r.push(t+"-"+n+" properties"):void 0===t?void 0!==n&&r.push("at most "+n+" properties"):r.push("at least "+t+" properties"),r}Object.defineProperty(t,"__esModule",{value:!0}),t.getConstraintHints=r},270:function(e,t,n){"use strict";function r(e){if(!e)return[];var t=e.pattern,n=e.minLength,r=e.maxLength,i=[];return t&&i.push("/"+t+"/"),void 0!==r&&void 0!==n?r===n?i.push(n+" chars"):i.push(n+"-"+r+" chars"):void 0===n?void 0!==r&&i.push("at most "+r+" chars"):i.push("at least "+n+" chars"),i}Object.defineProperty(t,"__esModule",{value:!0}),t.getConstraintHints=r},271:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t span > span":{padding:"2px",backgroundColor:(0,u.default)(t.default).lighten(.1)+"",marginLeft:"5px"}},property:{"&:first-child":{"& $name::after":{content:'""',borderLeft:"1px solid "+t.default,position:"absolute",bottom:"0",left:"0",height:"51%"}},"&:last-child, &$last":{"& $name::after":{content:'""',borderLeft:"1px solid "+t.default,position:"absolute",top:"0",left:"0",height:"50%"}},"&:only-of-type":{"& $name::after":{border:"none"}},"&:first-child$last":{"& $name::after":{border:"none"}},"& + &":{"& $info":{borderTop:"1px solid "+t.default},"& $name::after":{content:'""',borderLeft:"1px solid "+t.default,position:"absolute",bottom:"0",left:"0",height:"100%"}}},required:{marginLeft:"10px",color:"red"},isClickable:{cursor:"pointer",fontWeight:600},isAdditional:{fontStyle:"italic"},last:{},enum:i({},s),default:i({},s),indicator:{},format:{},subType:{}}}.bind(void 0))}},[641]); \ No newline at end of file diff --git a/docs/demo/demo.ecab1944e41f85fb710a.js b/docs/demo/demo.ecab1944e41f85fb710a.js deleted file mode 100644 index 27ee49c..0000000 --- a/docs/demo/demo.ecab1944e41f85fb710a.js +++ /dev/null @@ -1 +0,0 @@ -webpackJsonp([1],{115:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s,c=function(){function e(e,t){for(var n,r=0;r div":{height:"100%"},body:{height:"100%",margin:"0",padding:"0",fontFamily:'-apple-system,BlinkMacSystemFont,"Segoe UI",Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",helvetica,sans-serif;',lineHeight:"1.4",fontSize:"1em"},"ul, ol":{margin:".5rem 0",padding:"0","& li":{marginLeft:"1.5rem"}},"h3, h4, h5, h6":{margin:"0",fontWeight:"400"},a:{color:e.text.link+"",textDecoration:"none","&:hover":{transition:"color .25s",color:(0,a.default)(e.text.link).lighten(.1)+"",textDecoration:"underline"}}}}}.bind(void 0))},121:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0;var r=n(459),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.clone=i.default},225:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(1),o=r(i),a=n(183),u=r(a),l=n(261),s=document.body.appendChild(document.createElement("div"));u.default.render(o.default.createElement(l.Demo,null),s)},226:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}Object.defineProperty(t,"__esModule",{value:!0}),t.styles=void 0;var o=n(7),a=n(23),u=function(e){return e&&e.__esModule?e:{default:e}}(a);t.styles=(0,o.createSheet)(function(e){var t=e.text,n=e.backgrounds,o=e.sizes;return i(void 0,void 0),r({bodyContent:{display:"table",width:"100%",padding:"10px",boxSizing:"border-box"},tabs:{"& > div":{display:"inline-block",padding:"10px 20px",cursor:"pointer","&:not($active)":{color:(0,u.default)(t.default).lighten(.5)+""}}},active:{backgroundColor:n.schema+"",borderRadius:"10px 10px 0 0"}},"@media (max-width: "+o.breakpoint+")",{bodyContent:{padding:"10px 0"}})}.bind(void 0))},227:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}Object.defineProperty(t,"__esModule",{value:!0}),t.styles=void 0;var o=n(7),a=n(76);t.styles=(0,o.createSheet)(function(e){var t,n,o=e.backgrounds,u=e.borders,l=e.sizes;return i(void 0,void 0),n={bodySchema:{width:"100%",borderSpacing:"0",padding:"10px 50px 10px 20px",boxSizing:"border-box",borderRadius:"10px",fontSize:"14.5px"},even:{backgroundColor:o.default+""},odd:{backgroundColor:o.schema+""},subset:(t={},r(t,"& + ."+a.styles.classes.property+":not(."+a.styles.classes.last+")",r({},"& ."+a.styles.classes.name+"::after",{content:'""',borderLeft:"1px solid "+u.default,position:"absolute",bottom:"0",left:"0",height:"100%"})),r(t,"& > td",{borderLeft:"1px solid "+u.default}),r(t,"."+a.styles.classes.last+" + & > td",{borderLeft:"none"}),t),array:{fontFamily:"monospace",padding:"5px 10px"},hasTabs:{borderTopLeftRadius:0}},r(n,"@media (max-width: "+l.breakpoint+")",{bodySchema:{paddingRight:"10px",fontSize:"0.8rem"}}),r(n,"isAdditional",{textAlign:"left",fontStyle:"italic"}),n}.bind(void 0))},228:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;r span":{color:"white",padding:"2px 10px",cursor:"pointer"}},hovered:{"&$buttons":{transition:"all .2s",opacity:"1"}}}}.bind(void 0))},236:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(e,t){for(var n,r=0;r h3":{marginBottom:"15px","& > span":{fontFamily:"monospace",textTransform:"uppercase",marginLeft:"10px","&.get":{color:n.get+""},"&.post":{color:n.post+""},"&.put":{color:n.put+""},"&.delete":{color:n.delete+""}}},"& h4":{fontSize:"smaller",textTransform:"uppercase",color:(0,u.default)(n.default).lighten(.5)+"",borderBottom:"1px solid "+t.default,marginTop:"20px"}}},"@media (max-width: "+o.breakpoint+")",{method:{padding:"1rem",margin:0}})}.bind(void 0))},241:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t div + div",{borderTop:"1px solid "+o.default}),r(t,"& a",{color:u.default+"",padding:".7rem 1rem","&:hover":{color:(0,l.default)(u.default).lighten(.1)+"",transition:"all .2s"}}),t)},"@media (max-width: "+s.breakpoint+")",{navigation:{display:"block",width:"100%",height:"auto",right:"100%",zIndex:"99",transition:"right .5s"},isOpen:{position:"relative",right:0}})}.bind(void 0))},243:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u,l=function(){function e(e,t){for(var n,r=0;r")),d.default.createElement(w.default,{constraints:u,type:r,isRequired:l}),(j&&j.length||s||a)&&d.default.createElement("div",{className:b.additionalInfo},j&&this.renderEnumValues(j),void 0!==s&&this.renderDefaultValue(s),a&&d.default.createElement("div",null,d.default.createElement(v.default,{isInline:!0,description:a})))))}},{key:"renderEnumValues",value:function(e){var t=this,n=this.props.classes,r=this.state.enumValues,o=!1;return e.length!==r.length&&(o=!0),d.default.createElement("div",null,d.default.createElement("span",null,"Valid values:"),r.map(function(e){return i(this,t),d.default.createElement("span",{key:e,className:n.enum},e)}.bind(this)),o&&d.default.createElement("a",{onClick:this.displayAllEnums},"..."))}},{key:"displayAllEnums",value:function(){this.setState({enumValues:this.props.enumValues})}},{key:"renderDefaultValue",value:function(e){var t;return"number"==typeof e||"string"==typeof e?t=e:"boolean"==typeof e?t=e.toString():Array.isArray(e)&&(t="["+e.join(", ")+"]"),d.default.createElement("div",{className:"default"},"Default: ",d.default.createElement("span",null,t))}}]),t}(f.PureComponent))||s;t.default=E,E.propTypes={name:b.default.string.isRequired,type:b.default.arrayOf(b.default.string).isRequired,subtype:b.default.string,title:b.default.string,description:b.default.string,constraints:b.default.shape({format:b.default.string,exclusiveMinimum:b.default.number,exclusiveMaximum:b.default.number,maximum:b.default.number,maxItems:b.default.number,maxLength:b.default.number,maxProperties:b.default.number,minimum:b.default.number,minItems:b.default.number,minLength:b.default.number,minProperties:b.default.number,multipleOf:b.default.number,pattern:b.default.string,uniqueItems:b.default.bool}),enumValues:b.default.array,defaultValue:b.default.any,isRequired:b.default.bool,isOpen:b.default.bool,isLast:b.default.bool,onClick:b.default.func,classes:b.default.object,attributes:b.default.object}},252:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;r=parseInt(e,10)}}]),t}(c.PureComponent))||l;t.default=O,O.propTypes={response:y.default.shape({code:y.default.string,description:y.default.string,schema:y.default.array,examples:y.default.array}),classes:y.default.object,initialSchemaTreeDepth:y.default.number}},254:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}Object.defineProperty(t,"__esModule",{value:!0}),t.styles=void 0;var o=n(7),a=n(75);t.styles=(0,o.createSheet)(function(e){e.shades;return i(void 0,void 0),{response:{marginBottom:"5px",bodyContent:{margin:"10px 0 20px 20px"}},info:r({padding:"10px",fontSize:"0.9rem"},"& "+a.styles.classes.indicator,{marginRight:"10px"}),isClickable:{cursor:"pointer"},code:{paddingRight:"20px"},success:{"& $code":{color:"rgb(76, 204, 79)"}},error:{"& $code":{color:"rgb(235, 15, 40)"}}}}.bind(void 0))},255:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;r li > span":{fontWeight:600}}},"@media (max-width: "+o.breakpoint+")",{securityContainer:{padding:"1rem"}})}.bind(void 0))},257:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;rt?1:0}function i(e,t){var n=e.toUpperCase(),r=t.toUpperCase();return u[n]-u[r]}function o(e,t){return e.type===t.type?r(e.title,t.title):i(e.type,t.type)}function a(e){switch(e){case"alpha":return o;case!1:default:return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.sortByAlphabet=r,t.sortByHttpMethod=i,t.sortByUIMethod=o,t.getSortingFunction=a;var u={GET:1,POST:2,PUT:3,DELETE:4,HEAD:5,OPTIONS:6,TRACE:7,CONNECT:8}},265:function(e,t,n){"use strict";function r(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t "+t):a.push("≤ "+r):a.push("≥ "+i),a}Object.defineProperty(t,"__esModule",{value:!0}),t.getConstraintHints=r},269:function(e,t,n){"use strict";function r(e){if(!e)return[];var t=e.minProperties,n=e.maxProperties,r=[];return void 0!==n&&void 0!==t?n===t?r.push(t+" properties"):r.push(t+"-"+n+" properties"):void 0===t?void 0!==n&&r.push("at most "+n+" properties"):r.push("at least "+t+" properties"),r}Object.defineProperty(t,"__esModule",{value:!0}),t.getConstraintHints=r},270:function(e,t,n){"use strict";function r(e){if(!e)return[];var t=e.pattern,n=e.minLength,r=e.maxLength,i=[];return t&&i.push("/"+t+"/"),void 0!==r&&void 0!==n?r===n?i.push(n+" chars"):i.push(n+"-"+r+" chars"):void 0===n?void 0!==r&&i.push("at most "+r+" chars"):i.push("at least "+n+" chars"),i}Object.defineProperty(t,"__esModule",{value:!0}),t.getConstraintHints=r},271:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t span > span":{padding:"2px",backgroundColor:(0,u.default)(t.default).lighten(.1)+"",marginLeft:"5px"}},property:{"&:first-child":{"& $name::after":{content:'""',borderLeft:"1px solid "+t.default,position:"absolute",bottom:"0",left:"0",height:"51%"}},"&:last-child, &$last":{"& $name::after":{content:'""',borderLeft:"1px solid "+t.default,position:"absolute",top:"0",left:"0",height:"50%"}},"&:only-of-type":{"& $name::after":{border:"none"}},"&:first-child$last":{"& $name::after":{border:"none"}},"& + &":{"& $info":{borderTop:"1px solid "+t.default},"& $name::after":{content:'""',borderLeft:"1px solid "+t.default,position:"absolute",bottom:"0",left:"0",height:"100%"}}},required:{marginLeft:"10px",color:"red"},isClickable:{cursor:"pointer",fontWeight:600},isAdditional:{fontStyle:"italic"},last:{},enum:i({},s),default:i({},s),indicator:{},format:{},subType:{}}}.bind(void 0))}},[641]); \ No newline at end of file diff --git a/docs/demo/index.html b/docs/demo/index.html index b76dfe5..2019f57 100644 --- a/docs/demo/index.html +++ b/docs/demo/index.html @@ -5,5 +5,5 @@ - + diff --git a/docs/demo/manifest.d9e9a07772efbfebb4e9.js b/docs/demo/manifest.bab02a0a747dc0f2c8c5.js similarity index 55% rename from docs/demo/manifest.d9e9a07772efbfebb4e9.js rename to docs/demo/manifest.bab02a0a747dc0f2c8c5.js index 39aff71..ec907f9 100644 --- a/docs/demo/manifest.d9e9a07772efbfebb4e9.js +++ b/docs/demo/manifest.bab02a0a747dc0f2c8c5.js @@ -1 +1 @@ -!function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r=window.webpackJsonp;window.webpackJsonp=function(t,c,u){for(var a,i,f,l=0,s=[];l 20) { + trimmedEnumValues = enumValues.slice(0, 20) + isEnumTrimmed = true + } } - } - componentWillMount () { - const enumValues = this.state.enumValues - if (enumValues && enumValues.length > 20) { - let updatedValues = enumValues.slice() - updatedValues.length = 20 - this.setState({ enumValues: updatedValues }) + this.state = { + name, + enumValues, + trimmedEnumValues, + isEnumTrimmed } } @@ -41,12 +50,13 @@ export default class Property extends PureComponent { classes } = this.props - let {name, enumValues} = this.props + const name = this.state.name + let enumValues - // If enumValues only has one single value, append the single value to name, and not display enum values - if (enumValues && enumValues.length === 1) { - name = `${name} = "${enumValues[0]}"` - enumValues = [] + if (this.state.isEnumTrimmed) { + enumValues = this.state.trimmedEnumValues + } else { + enumValues = this.state.enumValues } const isClickable = onClick !== undefined @@ -88,11 +98,11 @@ export default class Property extends PureComponent { {((enumValues && enumValues.length) || defaultValue || description) && -
- {enumValues && this.renderEnumValues(enumValues)} - {defaultValue !== undefined && this.renderDefaultValue(defaultValue)} - {description &&
} -
+
+ {enumValues && this.renderEnumValues(enumValues, this.state.isEnumTrimmed)} + {defaultValue !== undefined && this.renderDefaultValue(defaultValue)} + {description &&
} +
} @@ -103,32 +113,32 @@ export default class Property extends PureComponent { * Render enum values * * @param {Array} values + * @param {boolean} isEnumTrimmed */ - renderEnumValues (values) { - const { classes } = this.props - const valuesToDisplay = this.state.enumValues - let isEnumReduced = false - if (values.length !== valuesToDisplay.length) { - isEnumReduced = true - } + renderEnumValues (values, isEnumTrimmed) { + const {classes} = this.props return (
Valid values: - {valuesToDisplay.map(value => { + {values.map(value => { return ( {value} ) })} - {isEnumReduced && - ... + {isEnumTrimmed && + ... }
) } displayAllEnums () { - this.setState({ enumValues: this.props.enumValues }) + this.setState( + { + isEnumTrimmed: false + } + ) } renderDefaultValue (value) { From 2dd48f1c13532b42beb8efc857e0a2c88c0bf3d1 Mon Sep 17 00:00:00 2001 From: Khoa Tran Date: Tue, 11 Jul 2017 11:38:40 +1000 Subject: [PATCH 2/3] PR feedback --- docs/demo/demo.81f8cdaf8e92e7c02fcc.js | 1 + docs/demo/demo.d6b863d3d393b27fe6bc.js | 1 - docs/demo/index.html | 2 +- ...bab02a0a747dc0f2c8c5.js => manifest.64e52d4be3e1405eba34.js} | 2 +- src/components/Property/Property.js | 2 ++ 5 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 docs/demo/demo.81f8cdaf8e92e7c02fcc.js delete mode 100644 docs/demo/demo.d6b863d3d393b27fe6bc.js rename docs/demo/{manifest.bab02a0a747dc0f2c8c5.js => manifest.64e52d4be3e1405eba34.js} (95%) diff --git a/docs/demo/demo.81f8cdaf8e92e7c02fcc.js b/docs/demo/demo.81f8cdaf8e92e7c02fcc.js new file mode 100644 index 0000000..fee65f6 --- /dev/null +++ b/docs/demo/demo.81f8cdaf8e92e7c02fcc.js @@ -0,0 +1 @@ +webpackJsonp([1],{115:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s,c=function(){function e(e,t){for(var n,r=0;r div":{height:"100%"},body:{height:"100%",margin:"0",padding:"0",fontFamily:'-apple-system,BlinkMacSystemFont,"Segoe UI",Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",helvetica,sans-serif;',lineHeight:"1.4",fontSize:"1em"},"ul, ol":{margin:".5rem 0",padding:"0","& li":{marginLeft:"1.5rem"}},"h3, h4, h5, h6":{margin:"0",fontWeight:"400"},a:{color:e.text.link+"",textDecoration:"none","&:hover":{transition:"color .25s",color:(0,a.default)(e.text.link).lighten(.1)+"",textDecoration:"underline"}}}}}.bind(void 0))},121:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0;var r=n(459),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.clone=i.default},225:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(1),o=r(i),a=n(183),u=r(a),l=n(261),s=document.body.appendChild(document.createElement("div"));u.default.render(o.default.createElement(l.Demo,null),s)},226:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}Object.defineProperty(t,"__esModule",{value:!0}),t.styles=void 0;var o=n(7),a=n(23),u=function(e){return e&&e.__esModule?e:{default:e}}(a);t.styles=(0,o.createSheet)(function(e){var t=e.text,n=e.backgrounds,o=e.sizes;return i(void 0,void 0),r({bodyContent:{display:"table",width:"100%",padding:"10px",boxSizing:"border-box"},tabs:{"& > div":{display:"inline-block",padding:"10px 20px",cursor:"pointer","&:not($active)":{color:(0,u.default)(t.default).lighten(.5)+""}}},active:{backgroundColor:n.schema+"",borderRadius:"10px 10px 0 0"}},"@media (max-width: "+o.breakpoint+")",{bodyContent:{padding:"10px 0"}})}.bind(void 0))},227:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}Object.defineProperty(t,"__esModule",{value:!0}),t.styles=void 0;var o=n(7),a=n(76);t.styles=(0,o.createSheet)(function(e){var t,n,o=e.backgrounds,u=e.borders,l=e.sizes;return i(void 0,void 0),n={bodySchema:{width:"100%",borderSpacing:"0",padding:"10px 50px 10px 20px",boxSizing:"border-box",borderRadius:"10px",fontSize:"14.5px"},even:{backgroundColor:o.default+""},odd:{backgroundColor:o.schema+""},subset:(t={},r(t,"& + ."+a.styles.classes.property+":not(."+a.styles.classes.last+")",r({},"& ."+a.styles.classes.name+"::after",{content:'""',borderLeft:"1px solid "+u.default,position:"absolute",bottom:"0",left:"0",height:"100%"})),r(t,"& > td",{borderLeft:"1px solid "+u.default}),r(t,"."+a.styles.classes.last+" + & > td",{borderLeft:"none"}),t),array:{fontFamily:"monospace",padding:"5px 10px"},hasTabs:{borderTopLeftRadius:0}},r(n,"@media (max-width: "+l.breakpoint+")",{bodySchema:{paddingRight:"10px",fontSize:"0.8rem"}}),r(n,"isAdditional",{textAlign:"left",fontStyle:"italic"}),n}.bind(void 0))},228:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;r span":{color:"white",padding:"2px 10px",cursor:"pointer"}},hovered:{"&$buttons":{transition:"all .2s",opacity:"1"}}}}.bind(void 0))},236:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(e,t){for(var n,r=0;r h3":{marginBottom:"15px","& > span":{fontFamily:"monospace",textTransform:"uppercase",marginLeft:"10px","&.get":{color:n.get+""},"&.post":{color:n.post+""},"&.put":{color:n.put+""},"&.delete":{color:n.delete+""}}},"& h4":{fontSize:"smaller",textTransform:"uppercase",color:(0,u.default)(n.default).lighten(.5)+"",borderBottom:"1px solid "+t.default,marginTop:"20px"}}},"@media (max-width: "+o.breakpoint+")",{method:{padding:"1rem",margin:0}})}.bind(void 0))},241:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t div + div",{borderTop:"1px solid "+o.default}),r(t,"& a",{color:u.default+"",padding:".7rem 1rem","&:hover":{color:(0,l.default)(u.default).lighten(.1)+"",transition:"all .2s"}}),t)},"@media (max-width: "+s.breakpoint+")",{navigation:{display:"block",width:"100%",height:"auto",right:"100%",zIndex:"99",transition:"right .5s"},isOpen:{position:"relative",right:0}})}.bind(void 0))},243:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u,l=function(){function e(e,t){for(var n,r=0;r")),d.default.createElement(w.default,{constraints:u,type:r,isRequired:l}),(g&&g.length||s||a)&&d.default.createElement("div",{className:b.additionalInfo},g&&this.renderEnumValues(g,this.state.isEnumTrimmed),void 0!==s&&this.renderDefaultValue(s),a&&d.default.createElement("div",null,d.default.createElement(v.default,{isInline:!0,description:a})))))}},{key:"renderEnumValues",value:function(e,t){var n=this,r=this.props.classes;return d.default.createElement("div",null,d.default.createElement("span",null,"Valid values:"),e.map(function(e){return i(this,n),d.default.createElement("span",{key:e,className:r.enum},e)}.bind(this)),t&&d.default.createElement("a",{onClick:this.displayAllEnums},"..."))}},{key:"displayAllEnums",value:function(){this.setState({isEnumTrimmed:!1})}},{key:"renderDefaultValue",value:function(e){var t;return"number"==typeof e||"string"==typeof e?t=e:"boolean"==typeof e?t=e.toString():Array.isArray(e)&&(t="["+e.join(", ")+"]"),d.default.createElement("div",{className:"default"},"Default: ",d.default.createElement("span",null,t))}}]),t}(f.PureComponent))||s;t.default=E,E.propTypes={name:b.default.string.isRequired,type:b.default.arrayOf(b.default.string).isRequired,subtype:b.default.string,title:b.default.string,description:b.default.string,constraints:b.default.shape({format:b.default.string,exclusiveMinimum:b.default.number,exclusiveMaximum:b.default.number,maximum:b.default.number,maxItems:b.default.number,maxLength:b.default.number,maxProperties:b.default.number,minimum:b.default.number,minItems:b.default.number,minLength:b.default.number,minProperties:b.default.number,multipleOf:b.default.number,pattern:b.default.string,uniqueItems:b.default.bool}),enumValues:b.default.array,defaultValue:b.default.any,isRequired:b.default.bool,isOpen:b.default.bool,isLast:b.default.bool,onClick:b.default.func,classes:b.default.object,attributes:b.default.object}},252:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;r=parseInt(e,10)}}]),t}(c.PureComponent))||l;t.default=O,O.propTypes={response:y.default.shape({code:y.default.string,description:y.default.string,schema:y.default.array,examples:y.default.array}),classes:y.default.object,initialSchemaTreeDepth:y.default.number}},254:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}Object.defineProperty(t,"__esModule",{value:!0}),t.styles=void 0;var o=n(7),a=n(75);t.styles=(0,o.createSheet)(function(e){e.shades;return i(void 0,void 0),{response:{marginBottom:"5px",bodyContent:{margin:"10px 0 20px 20px"}},info:r({padding:"10px",fontSize:"0.9rem"},"& "+a.styles.classes.indicator,{marginRight:"10px"}),isClickable:{cursor:"pointer"},code:{paddingRight:"20px"},success:{"& $code":{color:"rgb(76, 204, 79)"}},error:{"& $code":{color:"rgb(235, 15, 40)"}}}}.bind(void 0))},255:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;r li > span":{fontWeight:600}}},"@media (max-width: "+o.breakpoint+")",{securityContainer:{padding:"1rem"}})}.bind(void 0))},257:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;rt?1:0}function i(e,t){var n=e.toUpperCase(),r=t.toUpperCase();return u[n]-u[r]}function o(e,t){return e.type===t.type?r(e.title,t.title):i(e.type,t.type)}function a(e){switch(e){case"alpha":return o;case!1:default:return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.sortByAlphabet=r,t.sortByHttpMethod=i,t.sortByUIMethod=o,t.getSortingFunction=a;var u={GET:1,POST:2,PUT:3,DELETE:4,HEAD:5,OPTIONS:6,TRACE:7,CONNECT:8}},265:function(e,t,n){"use strict";function r(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t "+t):a.push("≤ "+r):a.push("≥ "+i),a}Object.defineProperty(t,"__esModule",{value:!0}),t.getConstraintHints=r},269:function(e,t,n){"use strict";function r(e){if(!e)return[];var t=e.minProperties,n=e.maxProperties,r=[];return void 0!==n&&void 0!==t?n===t?r.push(t+" properties"):r.push(t+"-"+n+" properties"):void 0===t?void 0!==n&&r.push("at most "+n+" properties"):r.push("at least "+t+" properties"),r}Object.defineProperty(t,"__esModule",{value:!0}),t.getConstraintHints=r},270:function(e,t,n){"use strict";function r(e){if(!e)return[];var t=e.pattern,n=e.minLength,r=e.maxLength,i=[];return t&&i.push("/"+t+"/"),void 0!==r&&void 0!==n?r===n?i.push(n+" chars"):i.push(n+"-"+r+" chars"):void 0===n?void 0!==r&&i.push("at most "+r+" chars"):i.push("at least "+n+" chars"),i}Object.defineProperty(t,"__esModule",{value:!0}),t.getConstraintHints=r},271:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t span > span":{padding:"2px",backgroundColor:(0,u.default)(t.default).lighten(.1)+"",marginLeft:"5px"}},property:{"&:first-child":{"& $name::after":{content:'""',borderLeft:"1px solid "+t.default,position:"absolute",bottom:"0",left:"0",height:"51%"}},"&:last-child, &$last":{"& $name::after":{content:'""',borderLeft:"1px solid "+t.default,position:"absolute",top:"0",left:"0",height:"50%"}},"&:only-of-type":{"& $name::after":{border:"none"}},"&:first-child$last":{"& $name::after":{border:"none"}},"& + &":{"& $info":{borderTop:"1px solid "+t.default},"& $name::after":{content:'""',borderLeft:"1px solid "+t.default,position:"absolute",bottom:"0",left:"0",height:"100%"}}},required:{marginLeft:"10px",color:"red"},isClickable:{cursor:"pointer",fontWeight:600},isAdditional:{fontStyle:"italic"},last:{},enum:i({},s),default:i({},s),indicator:{},format:{},subType:{}}}.bind(void 0))}},[641]); \ No newline at end of file diff --git a/docs/demo/demo.d6b863d3d393b27fe6bc.js b/docs/demo/demo.d6b863d3d393b27fe6bc.js deleted file mode 100644 index cd064a6..0000000 --- a/docs/demo/demo.d6b863d3d393b27fe6bc.js +++ /dev/null @@ -1 +0,0 @@ -webpackJsonp([1],{115:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s,c=function(){function e(e,t){for(var n,r=0;r div":{height:"100%"},body:{height:"100%",margin:"0",padding:"0",fontFamily:'-apple-system,BlinkMacSystemFont,"Segoe UI",Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",helvetica,sans-serif;',lineHeight:"1.4",fontSize:"1em"},"ul, ol":{margin:".5rem 0",padding:"0","& li":{marginLeft:"1.5rem"}},"h3, h4, h5, h6":{margin:"0",fontWeight:"400"},a:{color:e.text.link+"",textDecoration:"none","&:hover":{transition:"color .25s",color:(0,a.default)(e.text.link).lighten(.1)+"",textDecoration:"underline"}}}}}.bind(void 0))},121:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0;var r=n(459),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.clone=i.default},225:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(1),o=r(i),a=n(183),u=r(a),l=n(261),s=document.body.appendChild(document.createElement("div"));u.default.render(o.default.createElement(l.Demo,null),s)},226:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}Object.defineProperty(t,"__esModule",{value:!0}),t.styles=void 0;var o=n(7),a=n(23),u=function(e){return e&&e.__esModule?e:{default:e}}(a);t.styles=(0,o.createSheet)(function(e){var t=e.text,n=e.backgrounds,o=e.sizes;return i(void 0,void 0),r({bodyContent:{display:"table",width:"100%",padding:"10px",boxSizing:"border-box"},tabs:{"& > div":{display:"inline-block",padding:"10px 20px",cursor:"pointer","&:not($active)":{color:(0,u.default)(t.default).lighten(.5)+""}}},active:{backgroundColor:n.schema+"",borderRadius:"10px 10px 0 0"}},"@media (max-width: "+o.breakpoint+")",{bodyContent:{padding:"10px 0"}})}.bind(void 0))},227:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}Object.defineProperty(t,"__esModule",{value:!0}),t.styles=void 0;var o=n(7),a=n(76);t.styles=(0,o.createSheet)(function(e){var t,n,o=e.backgrounds,u=e.borders,l=e.sizes;return i(void 0,void 0),n={bodySchema:{width:"100%",borderSpacing:"0",padding:"10px 50px 10px 20px",boxSizing:"border-box",borderRadius:"10px",fontSize:"14.5px"},even:{backgroundColor:o.default+""},odd:{backgroundColor:o.schema+""},subset:(t={},r(t,"& + ."+a.styles.classes.property+":not(."+a.styles.classes.last+")",r({},"& ."+a.styles.classes.name+"::after",{content:'""',borderLeft:"1px solid "+u.default,position:"absolute",bottom:"0",left:"0",height:"100%"})),r(t,"& > td",{borderLeft:"1px solid "+u.default}),r(t,"."+a.styles.classes.last+" + & > td",{borderLeft:"none"}),t),array:{fontFamily:"monospace",padding:"5px 10px"},hasTabs:{borderTopLeftRadius:0}},r(n,"@media (max-width: "+l.breakpoint+")",{bodySchema:{paddingRight:"10px",fontSize:"0.8rem"}}),r(n,"isAdditional",{textAlign:"left",fontStyle:"italic"}),n}.bind(void 0))},228:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;r span":{color:"white",padding:"2px 10px",cursor:"pointer"}},hovered:{"&$buttons":{transition:"all .2s",opacity:"1"}}}}.bind(void 0))},236:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(e,t){for(var n,r=0;r h3":{marginBottom:"15px","& > span":{fontFamily:"monospace",textTransform:"uppercase",marginLeft:"10px","&.get":{color:n.get+""},"&.post":{color:n.post+""},"&.put":{color:n.put+""},"&.delete":{color:n.delete+""}}},"& h4":{fontSize:"smaller",textTransform:"uppercase",color:(0,u.default)(n.default).lighten(.5)+"",borderBottom:"1px solid "+t.default,marginTop:"20px"}}},"@media (max-width: "+o.breakpoint+")",{method:{padding:"1rem",margin:0}})}.bind(void 0))},241:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t div + div",{borderTop:"1px solid "+o.default}),r(t,"& a",{color:u.default+"",padding:".7rem 1rem","&:hover":{color:(0,l.default)(u.default).lighten(.1)+"",transition:"all .2s"}}),t)},"@media (max-width: "+s.breakpoint+")",{navigation:{display:"block",width:"100%",height:"auto",right:"100%",zIndex:"99",transition:"right .5s"},isOpen:{position:"relative",right:0}})}.bind(void 0))},243:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u,l=function(){function e(e,t){for(var n,r=0;r")),d.default.createElement(w.default,{constraints:u,type:r,isRequired:l}),(g&&g.length||s||a)&&d.default.createElement("div",{className:b.additionalInfo},g&&this.renderEnumValues(g,this.state.isEnumReduced),void 0!==s&&this.renderDefaultValue(s),a&&d.default.createElement("div",null,d.default.createElement(v.default,{isInline:!0,description:a})))))}},{key:"renderEnumValues",value:function(e,t){var n=this,r=this.props.classes;return d.default.createElement("div",null,d.default.createElement("span",null,"Valid values:"),e.map(function(e){return i(this,n),d.default.createElement("span",{key:e,className:r.enum},e)}.bind(this)),t&&d.default.createElement("a",{onClick:this.displayAllEnums},"..."))}},{key:"displayAllEnums",value:function(){this.setState({isEnumReduced:!1})}},{key:"renderDefaultValue",value:function(e){var t;return"number"==typeof e||"string"==typeof e?t=e:"boolean"==typeof e?t=e.toString():Array.isArray(e)&&(t="["+e.join(", ")+"]"),d.default.createElement("div",{className:"default"},"Default: ",d.default.createElement("span",null,t))}}]),t}(f.PureComponent))||s;t.default=E,E.propTypes={name:b.default.string.isRequired,type:b.default.arrayOf(b.default.string).isRequired,subtype:b.default.string,title:b.default.string,description:b.default.string,constraints:b.default.shape({format:b.default.string,exclusiveMinimum:b.default.number,exclusiveMaximum:b.default.number,maximum:b.default.number,maxItems:b.default.number,maxLength:b.default.number,maxProperties:b.default.number,minimum:b.default.number,minItems:b.default.number,minLength:b.default.number,minProperties:b.default.number,multipleOf:b.default.number,pattern:b.default.string,uniqueItems:b.default.bool}),enumValues:b.default.array,defaultValue:b.default.any,isRequired:b.default.bool,isOpen:b.default.bool,isLast:b.default.bool,onClick:b.default.func,classes:b.default.object,attributes:b.default.object}},252:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;r=parseInt(e,10)}}]),t}(c.PureComponent))||l;t.default=O,O.propTypes={response:y.default.shape({code:y.default.string,description:y.default.string,schema:y.default.array,examples:y.default.array}),classes:y.default.object,initialSchemaTreeDepth:y.default.number}},254:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}Object.defineProperty(t,"__esModule",{value:!0}),t.styles=void 0;var o=n(7),a=n(75);t.styles=(0,o.createSheet)(function(e){e.shades;return i(void 0,void 0),{response:{marginBottom:"5px",bodyContent:{margin:"10px 0 20px 20px"}},info:r({padding:"10px",fontSize:"0.9rem"},"& "+a.styles.classes.indicator,{marginRight:"10px"}),isClickable:{cursor:"pointer"},code:{paddingRight:"20px"},success:{"& $code":{color:"rgb(76, 204, 79)"}},error:{"& $code":{color:"rgb(235, 15, 40)"}}}}.bind(void 0))},255:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;r li > span":{fontWeight:600}}},"@media (max-width: "+o.breakpoint+")",{securityContainer:{padding:"1rem"}})}.bind(void 0))},257:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l,s=function(){function e(e,t){for(var n,r=0;rt?1:0}function i(e,t){var n=e.toUpperCase(),r=t.toUpperCase();return u[n]-u[r]}function o(e,t){return e.type===t.type?r(e.title,t.title):i(e.type,t.type)}function a(e){switch(e){case"alpha":return o;case!1:default:return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.sortByAlphabet=r,t.sortByHttpMethod=i,t.sortByUIMethod=o,t.getSortingFunction=a;var u={GET:1,POST:2,PUT:3,DELETE:4,HEAD:5,OPTIONS:6,TRACE:7,CONNECT:8}},265:function(e,t,n){"use strict";function r(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t "+t):a.push("≤ "+r):a.push("≥ "+i),a}Object.defineProperty(t,"__esModule",{value:!0}),t.getConstraintHints=r},269:function(e,t,n){"use strict";function r(e){if(!e)return[];var t=e.minProperties,n=e.maxProperties,r=[];return void 0!==n&&void 0!==t?n===t?r.push(t+" properties"):r.push(t+"-"+n+" properties"):void 0===t?void 0!==n&&r.push("at most "+n+" properties"):r.push("at least "+t+" properties"),r}Object.defineProperty(t,"__esModule",{value:!0}),t.getConstraintHints=r},270:function(e,t,n){"use strict";function r(e){if(!e)return[];var t=e.pattern,n=e.minLength,r=e.maxLength,i=[];return t&&i.push("/"+t+"/"),void 0!==r&&void 0!==n?r===n?i.push(n+" chars"):i.push(n+"-"+r+" chars"):void 0===n?void 0!==r&&i.push("at most "+r+" chars"):i.push("at least "+n+" chars"),i}Object.defineProperty(t,"__esModule",{value:!0}),t.getConstraintHints=r},271:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t span > span":{padding:"2px",backgroundColor:(0,u.default)(t.default).lighten(.1)+"",marginLeft:"5px"}},property:{"&:first-child":{"& $name::after":{content:'""',borderLeft:"1px solid "+t.default,position:"absolute",bottom:"0",left:"0",height:"51%"}},"&:last-child, &$last":{"& $name::after":{content:'""',borderLeft:"1px solid "+t.default,position:"absolute",top:"0",left:"0",height:"50%"}},"&:only-of-type":{"& $name::after":{border:"none"}},"&:first-child$last":{"& $name::after":{border:"none"}},"& + &":{"& $info":{borderTop:"1px solid "+t.default},"& $name::after":{content:'""',borderLeft:"1px solid "+t.default,position:"absolute",bottom:"0",left:"0",height:"100%"}}},required:{marginLeft:"10px",color:"red"},isClickable:{cursor:"pointer",fontWeight:600},isAdditional:{fontStyle:"italic"},last:{},enum:i({},s),default:i({},s),indicator:{},format:{},subType:{}}}.bind(void 0))}},[641]); \ No newline at end of file diff --git a/docs/demo/index.html b/docs/demo/index.html index 2019f57..2f8f947 100644 --- a/docs/demo/index.html +++ b/docs/demo/index.html @@ -5,5 +5,5 @@ - + diff --git a/docs/demo/manifest.bab02a0a747dc0f2c8c5.js b/docs/demo/manifest.64e52d4be3e1405eba34.js similarity index 95% rename from docs/demo/manifest.bab02a0a747dc0f2c8c5.js rename to docs/demo/manifest.64e52d4be3e1405eba34.js index ec907f9..f3190ca 100644 --- a/docs/demo/manifest.bab02a0a747dc0f2c8c5.js +++ b/docs/demo/manifest.64e52d4be3e1405eba34.js @@ -1 +1 @@ -!function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r=window.webpackJsonp;window.webpackJsonp=function(t,c,u){for(var i,a,f,l=0,s=[];l Date: Tue, 11 Jul 2017 12:05:06 +1000 Subject: [PATCH 3/3] more PR feedback --- src/components/Property/Property.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Property/Property.js b/src/components/Property/Property.js index a8b8ef6..49e36f0 100644 --- a/src/components/Property/Property.js +++ b/src/components/Property/Property.js @@ -31,12 +31,12 @@ export default class Property extends PureComponent { } } - this.state = { + this.setState({ name, enumValues, trimmedEnumValues, isEnumTrimmed - } + }) } handleClick () { @@ -52,10 +52,10 @@ export default class Property extends PureComponent { classes } = this.props - const name = this.state.name + const {name, isEnumTrimmed} = this.state let enumValues - if (this.state.isEnumTrimmed) { + if (isEnumTrimmed) { enumValues = this.state.trimmedEnumValues } else { enumValues = this.state.enumValues @@ -101,7 +101,7 @@ export default class Property extends PureComponent { {((enumValues && enumValues.length) || defaultValue || description) &&
- {enumValues && this.renderEnumValues(enumValues, this.state.isEnumTrimmed)} + {enumValues && this.renderEnumValues(enumValues, isEnumTrimmed)} {defaultValue !== undefined && this.renderDefaultValue(defaultValue)} {description &&
}