react-jsonschema-form-pagination
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.JSONSchemaForm=t(require("react")):e.JSONSchemaForm=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=6)}([function(e,t,n){"use strict";function r(){return!1}function o(e){return Array.isArray(e)?e:[e]}function i(e){return!e||!e.properties||0===Object.keys(e.properties).length}Object.defineProperty(t,"__esModule",{value:!0}),t.isDevelopment=r,t.toArray=o,t.isEmptySchema=i;t.GENERIC_NAV="default",t.UI_ORDER="ui:order",t.toError=function(e){console.error(e)}},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e,t){var n=t.navConf;n=void 0===n?{}:n;var r=n.navs;return(void 0===r?[]:r).find(function(t){return t.nav===e})}function o(e,t){var n=r(e,t);return n||{nav:e}}function i(e,t){var n=t[e]&&t[e][l]?t[e][l]:[];return Array.isArray(n)?n:[n]}function u(e){var t=e.navConf;t=void 0===t?{}:t;var n=t.aliases;return void 0===n?{}:n}function a(e,t){var n=t.navConf;n=void 0===n?{}:n;var r=n.order,o=void 0===r?[]:r;if(!o||0===o.length)return e;var i=e.filter(function(e){return o.includes(e)}).sort(function(e,t){return o.indexOf(e)-o.indexOf(t)});if(0===i.length)return e;if(i.length==e.length)return i;var u=e.filter(function(e){return!i.includes(e)});return i.concat(u)}function c(e,t){return a(e.map(function(e){return e.nav}),t).map(function(t){return e.find(function(e){return e.nav===t})})}function f(e,t,n){return{links:c(Object.keys(e).filter(function(e){return e!==s.GENERIC_NAV}).map(function(e){return o(e,t)}).map(function(e){return Object.assign(e,{isActive:e.nav===n})}),t),activeNav:n}}Object.defineProperty(t,"__esModule",{value:!0}),t.UI_NAV_ID=void 0,t.toNavConf=r,t.toNavConfOrDefault=o,t.findFieldNavs=i,t.getNavAliases=u,t.orderNavByName=a,t.orderNavs=c,t.default=f;var s=n(0),l=t.UI_NAV_ID="nav"},function(e,t,n){"use strict";"function"==typeof Symbol&&Symbol.iterator;e.exports=n(8)()},function(e,t,n){"use strict";function r(e){var t=e.handleClick,n=e.isActive,r=e.name,o=e.icon;return u.default.createElement("li",{onClick:t,className:n?"active":null},u.default.createElement("a",null,o&&u.default.createElement("span",{className:o,"aria-hidden":"true"})," ",r))}function o(e){var t=e.navs.links,n=e.onNavChange,o=t.filter(function(e){return e.nav!==a.GENERIC_NAV});return o.length>0?u.default.createElement("ul",{className:"nav nav-pills"},o.map(function(e,t){var o=e.nav,i=e.name,a=e.icon,c=e.isActive;return u.default.createElement(r,{key:t,name:i||o,icon:a,isActive:c,handleClick:function(){return n(o)}})})):u.default.createElement("div",null)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),u=function(e){return e&&e.__esModule?e:{default:e}}(i),a=n(0);t.default=o},function(e,t,n){"use strict";function r(e,t){return t.reduce(function(e,t){return void 0===e[t]&&(e[t]={}),e[t]},e)}function o(e,t,n){void 0===e[c.GENERIC_NAV]&&(e[c.GENERIC_NAV]={fields:[],aliases:{}}),e[c.GENERIC_NAV].fields.push(t),n&&(e[c.GENERIC_NAV].aliases[t]=n)}function i(e,t,n){Object.keys(e.properties).forEach(function(e){var i=(0,f.findFieldNavs)(e,t);o(r(n,i),e)},{})}function u(e,t){var n=(0,f.getNavAliases)(e);Object.keys(n).forEach(function(i){var u=n[i];(0,c.toArray)(u).forEach(function(n){var u=(0,f.findFieldNavs)(n,e);o(r(t,u),i,n)})})}function a(e,t){var n={};return i(e,t,n),u(t,n),n}Object.defineProperty(t,"__esModule",{value:!0}),t.findRelTree=r,t.extractTree=a;var c=n(0),f=n(2)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=o.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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)}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y.default,n=(0,h.default)(e,t),r=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));a.call(n);var r=n.props,u=r.formData,c=void 0===u?{}:u,f=r.schema,s=r.uiSchema,l=r.activeNav;return l=l?(0,g.toArray)(l):[],n.navTree=(0,_.default)(f,s),n.navTree.updateActiveNav(l,0),n.formData=c,n.state={activeNav:l},n}return u(t,e),c(t,[{key:"diffProps",value:function(e){var t=e.schema,n=e.uiSchema;return!(0,p.default)({schema:t,uiSchema:n},{schema:this.props.schema,uiSchema:this.props.uiSchema})}},{key:"componentWillReceiveProps",value:function(e){if(this.diffProps(e)){var t=e.schema,n=e.uiSchema;this.navTree=(0,_.default)(t,n)}}},{key:"shouldComponentUpdate",value:function(e,t){return!(0,p.default)(t.activeNav,this.state.activeNav)||(!!this.diffProps(e)||!(0,p.default)(this.formData,e.formData))}},{key:"render",value:function(){var e=this.navTree.toSubForms(this.state.activeNav),t=Object.assign({},this.props,{subForms:e,transformErrors:(0,N.default)(this.navTree,this.props.transformErrors),formData:this.formData,onChange:this.handleOnChange,onNavChange:this.handleNavChange});return s.default.createElement(n,t,this.props.children)}}]),t}(f.Component),a=function(){var e=this;this.handleNavChange=function(t){var n=e.state.activeNav;n.length===t.length&&n.every(function(e,n){return e===t[n]})||(e.navTree.updateActiveNav(t),e.setState({activeNav:t}),e.props.onNavChange&&e.props.onNavChange(t,n))},this.handleOnChange=function(t){e.formData=t.formData,e.props.onChange&&e.props.onChange(t)}};return r.propTypes={},r}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.default=a;var f=n(1),s=r(f),l=n(3),d=(r(l),n(12)),p=r(d),v=n(15),h=r(v),m=n(4),y=r(m),b=n(19),_=r(b),g=n(0),O=n(24),N=r(O)},function(e,t,n){"use strict";var r=n(9),o=n(10),i=n(11);e.exports=function(){function e(e,t,n,r,u,a){a!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";function r(e,t,n,r,i,u,a,c){if(o(t),!e){var f;if(void 0===t)f=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,i,u,a,c],l=0;f=new Error(t.replace(/%s/g,function(){return s[l++]})),f.name="Invariant Violation"}throw f.framesToPop=1,f}}var o=function(e){};e.exports=r},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";function r(e){return null===e||void 0===e}function o(e){return!(!e||"object"!==(void 0===e?"undefined":u(e))||"number"!=typeof e.length)&&("function"==typeof e.copy&&"function"==typeof e.slice&&!(e.length>0&&"number"!=typeof e[0]))}function i(e,t,n){var i,l;if(r(e)||r(t))return!1;if(e.prototype!==t.prototype)return!1;if(f(e))return!!f(t)&&(e=a.call(e),t=a.call(t),s(e,t,n));if(o(e)){if(!o(t))return!1;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}try{var d=c(e),p=c(t)}catch(e){return!1}if(d.length!=p.length)return!1;for(d.sort(),p.sort(),i=d.length-1;i>=0;i--)if(d[i]!=p[i])return!1;for(i=d.length-1;i>=0;i--)if(l=d[i],!s(e[l],t[l],n))return!1;return(void 0===e?"undefined":u(e))===(void 0===t?"undefined":u(t))}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=Array.prototype.slice,c=n(13),f=n(14),s=e.exports=function(e,t,n){return n||(n={}),e===t||(e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():!e||!t||"object"!=(void 0===e?"undefined":u(e))&&"object"!=(void 0===t?"undefined":u(t))?n.strict?e===t:e==t:i(e,t,n))}},function(e,t,n){"use strict";function r(e){var t=[];for(var n in e)t.push(n);return t}t=e.exports="function"==typeof Object.keys?Object.keys:r,t.shim=r},function(e,t,n){"use strict";function r(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function o(e){return e&&"object"==(void 0===e?"undefined":i(e))&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();t=e.exports=u?r:o,t.supported=r,t.unsupported=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(16),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=o.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(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 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 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)}function c(e){var t=e.properties;return Object.keys(t).reduce(function(e,t){return e[t]={"ui:widget":"hidden","ui:field":"hidden"},e},{})}function f(e,t){if(t[v.UI_ORDER]&&t[v.UI_ORDER].length>0)return t[v.UI_ORDER][0];var n=e&&e.properties?Object.keys(e.properties):[];return n.length>0?n[0]:void 0}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(1),d=r(l),p=n(3),v=(r(p),n(0)),h=n(4),m=r(h),y=n(17),b=r(y),_=n(18),g=r(_),O=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:m.default,n=function(n){function r(){var e,t,n,o;i(this,r);for(var a=arguments.length,c=Array(a),f=0;f<a;f++)c[f]=arguments[f];return t=n=u(this,(e=r.__proto__||Object.getPrototypeOf(r)).call.apply(e,[this].concat(c))),n.toNavConf=function(e,t){return e&&e.links.length>0?{navs:e,onNavChange:function(e){var r=0===t.length?[e]:t.slice(0,t.length-1).concat([e]);n.props.onNavChange(r)}}:void 0},o=t,u(n,o)}return a(r,n),s(r,[{key:"toUiSchema",value:function(){var e=this,t=this.props,n=t.subForms,r=t.schema,i=c(r),u=n.reduce(function(t,n){var r=n.schema,i=n.uiSchema,u=void 0===i?{}:i,a=n.navs,c=n.navPath,s=t.navConfs,l=void 0===s?[]:s;l=l.concat([e.toNavConf(a,c)]).filter(function(e){return void 0!==e});var d=f(r,u);if(d&&l.length>0){var p,v,h=(p={navConfs:l},o(p,"ui:field","nav"),o(p,"origUiSchema",u[d]),p);return Object.assign(t,u,(v={},o(v,d,h),o(v,"navConfs",[]),v))}return Object.assign(t,u,{navConfs:l})},i);return u[v.UI_ORDER]=this.props.uiSchema[v.UI_ORDER],u}},{key:"render",value:function(){var n=this.props.fields,r=void 0===n?{}:n,o=this.toUiSchema(),i=Object.assign({},this.props,{uiSchema:o,fields:Object.assign({},r,{hidden:b.default,nav:(0,g.default)(t)})});return d.default.createElement(e,i,this.props.children)}}]),r}(l.Component);return n.propTypes={},n};t.default=O},function(e,t,n){"use strict";function r(){return i.default.createElement("div",null)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=n(1),i=function(e){return e&&e.__esModule?e:{default:e}}(o)},function(e,t,n){"use strict";function r(e){var t=e.label,n=e.required,r=e.id;return t?u.default.createElement("label",{className:"control-label",htmlFor:r},n?t+a:t):u.default.createElement("div",null)}function o(e,t,n){var r=t["ui:field"];if("function"==typeof r)return r;if("string"==typeof r&&r in n)return n[r];var o=c[e.type];return o in n?n[o]:function(){return u.default.createElement("h1",null,"Unknown field type ",e.type)}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),u=function(e){return e&&e.__esModule?e:{default:e}}(i),a="*",c={array:"ArrayField",boolean:"BooleanField",integer:"NumberField",number:"NumberField",object:"ObjectField",string:"StringField"},f=function(e){return function(t){var n=t.schema,i=n.type,a=n.title,c=t.uiSchema,f=c.navConfs,s=c.origUiSchema,l=t.registry.fields,d=t.required,p=t.name,v=o(t.schema,s,l),h=Object.assign({},t,{uiSchema:s}),m=s["ui:title"]||a||p,y=s["ui:options"];y=void 0===y?{}:y;var b=y.label,_=void 0===b||b;return"object"===i&&(_=!1),"boolean"!==i||s["ui:widget"]||(_=!1),u.default.createElement("div",null,f.map(function(t,n){return u.default.createElement("div",{className:"col-md-12",key:n},u.default.createElement(e,t),u.default.createElement("br",null))}),u.default.createElement("div",{className:s.classNames},_&&u.default.createElement(r,{label:m,required:d,id:t.idSchema.$id}),u.default.createElement(v,h)))}};t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return new o.default(e,t)};var r=n(20),o=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=n(21),u=function(e){return e&&e.__esModule?e:{default:e}}(i),a=n(2),c=n(5),f=function e(t,n){var i=this;r(this,e),this.pushToTabFromTree=function(e,t){var n=(0,a.orderNavByName)(Object.keys(e),i.uiSchema),r=n.find(function(e){return e!==o.GENERIC_NAV});r&&(t.push(r),i.pushToTabFromTree(e[r],t))},this.updateActiveNav=function(e){var t=(0,c.findRelTree)(i.tree,e);i.pushToTabFromTree(t,e)},this.findActiveNav=function(e){return(0,a.findFieldNavs)(e,i.uiSchema).map(function(e){return(0,a.toNavConfOrDefault)(e,i.uiSchema)})},this.toSubForms=function(e){for(var t=[],n=0;n<=e.length;n++){var r=(0,u.default)(e.slice(0,n),i.tree,i.schema,i.uiSchema);(r.schema||r.navs.links.length>0)&&t.push(r)}return t},this.tree=(0,c.extractTree)(t,n),this.schema=t,this.uiSchema=n};t.default=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=n(5),u=n(22),a=r(u),c=n(23),f=r(c),s=n(2),l=r(s),d=function(e,t,n){if(0===e.length){var r=(0,s.toNavConf)(o.GENERIC_NAV,n);return Object.assign({},{links:[]},r)}var u=e[e.length-1],a=(0,i.findRelTree)(t,e.slice(0,e.length-1)),c=(0,l.default)(a,n,u);if(1===e.length){var f=(0,s.toNavConf)(o.GENERIC_NAV,n);return Object.assign(c,f)}var d=e[e.length-2],p=(0,s.toNavConf)(d,n);return Object.assign({},c,p)},p=function(e,t,n,r){var u=(0,i.findRelTree)(t,e),c=d(e,t,r);if(void 0===u[o.GENERIC_NAV])return{navs:c,navPath:e};var s=u[o.GENERIC_NAV],l=s.fields,p=s.aliases,v=(0,f.default)(l,n),h=(0,a.default)(l,r,p);return 0===e.length&&(v.title=n.title,v.description=n.description),{schema:v,uiSchema:h,navs:c,navPath:e}};t.default=p},function(e,t,n){"use strict";function r(e,t,n){t[a.UI_ORDER]&&e&&(n[a.UI_ORDER]=t[a.UI_ORDER].filter(function(t){return e.includes(t)}))}function o(e,t){var n={};return e.forEach(function(e){n[e]=t[e]}),r(e,t,n),n}function i(e,t,n){Object.keys(n).forEach(function(r){var o=n[r];t[r]=e[o]})}function u(e,t,n){var r=o(e,t);return i(t,r,n),r}Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var a=n(0)},function(e,t,n){"use strict";function r(e,t){var n={type:"object",properties:{}};return e.forEach(function(e){n.properties[e]=t.properties[e]}),t.required&&(n.required=t.required.filter(function(t){return e.includes(t)})),n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){return function(n){var r=n.map(function(t){var n="instance"===t.property?t.argument:t.property.substring(9),r=e.findActiveNav(n);return r&&r.length>0?Object.assign({activeNav:r},t):t});return t?t(r):r}};t.default=r}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.JSONSchemaForm=t(require("react")):e.JSONSchemaForm=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=6)}([function(e,t,n){"use strict";function r(){return!1}function o(e){return Array.isArray(e)?e:[e]}function i(e){return!e||!e.properties||0===Object.keys(e.properties).length}Object.defineProperty(t,"__esModule",{value:!0}),t.isDevelopment=r,t.toArray=o,t.isEmptySchema=i;t.GENERIC_NAV="default",t.UI_ORDER="ui:order",t.toError=function(e){console.error(e)}},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e,t){var n=t.navConf;n=void 0===n?{}:n;var r=n.navs;return(void 0===r?[]:r).find(function(t){return t.nav===e})}function o(e,t){var n=r(e,t);return n||{nav:e}}function i(e,t){var n=t[e]&&t[e][l]?t[e][l]:[];return Array.isArray(n)?n:[n]}function a(e){var t=e.navConf;t=void 0===t?{}:t;var n=t.aliases;return void 0===n?{}:n}function u(e,t){var n=t.navConf;n=void 0===n?{}:n;var r=n.order,o=void 0===r?[]:r;if(!o||0===o.length)return e;var i=e.filter(function(e){return o.includes(e)}).sort(function(e,t){return o.indexOf(e)-o.indexOf(t)});if(0===i.length)return e;if(i.length==e.length)return i;var a=e.filter(function(e){return!i.includes(e)});return i.concat(a)}function c(e,t){return u(e.map(function(e){return e.nav}),t).map(function(t){return e.find(function(e){return e.nav===t})})}function f(e,t,n){return{links:c(Object.keys(e).filter(function(e){return e!==s.GENERIC_NAV}).map(function(e){return o(e,t)}).map(function(e){return Object.assign(e,{isActive:e.nav===n})}),t),activeNav:n}}Object.defineProperty(t,"__esModule",{value:!0}),t.UI_NAV_ID=void 0,t.toNavConf=r,t.toNavConfOrDefault=o,t.findFieldNavs=i,t.getNavAliases=a,t.orderNavByName=u,t.orderNavs=c,t.default=f;var s=n(0),l=t.UI_NAV_ID="nav"},function(e,t,n){"use strict";"function"==typeof Symbol&&Symbol.iterator;e.exports=n(8)()},function(e,t,n){"use strict";function r(e){var t=e.handleClick,n=e.isActive,r=e.name,o=e.icon;return a.default.createElement("li",{onClick:t,className:n?"active":null},a.default.createElement("a",null,o&&a.default.createElement("span",{className:o,"aria-hidden":"true"})," ",r))}function o(e){var t=e.navs.links,n=e.onNavChange,o=t.filter(function(e){return e.nav!==u.GENERIC_NAV});return o.length>0?a.default.createElement("ul",{className:"nav nav-pills"},o.map(function(e,t){var o=e.nav,i=e.name,u=e.icon,c=e.isActive;return a.default.createElement(r,{key:t,name:i||o,icon:u,isActive:c,handleClick:function(){return n(o)}})})):a.default.createElement("div",null)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=function(e){return e&&e.__esModule?e:{default:e}}(i),u=n(0);t.default=o},function(e,t,n){"use strict";function r(e,t){return t.reduce(function(e,t){return void 0===e[t]&&(e[t]={}),e[t]},e)}function o(e,t,n){void 0===e[c.GENERIC_NAV]&&(e[c.GENERIC_NAV]={fields:[],aliases:{}}),e[c.GENERIC_NAV].fields.push(t),n&&(e[c.GENERIC_NAV].aliases[t]=n)}function i(e,t,n){Object.keys(e.properties).forEach(function(e){var i=(0,f.findFieldNavs)(e,t);o(r(n,i),e)},{})}function a(e,t){var n=(0,f.getNavAliases)(e);Object.keys(n).forEach(function(i){var a=n[i];(0,c.toArray)(a).forEach(function(n){var a=(0,f.findFieldNavs)(n,e);o(r(t,a),i,n)})})}function u(e,t){var n={};return i(e,t,n),a(t,n),n}Object.defineProperty(t,"__esModule",{value:!0}),t.findRelTree=r,t.extractTree=u;var c=n(0),f=n(2)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=o.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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)}function u(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y.default,n=(0,h.default)(e,t),r=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));u.call(n);var r=n.props,a=r.formData,c=void 0===a?{}:a,f=r.schema,s=r.uiSchema,l=r.activeNav;return l=l?(0,g.toArray)(l):[],n.navTree=(0,_.default)(f,s),n.navTree.updateActiveNav(l,0),n.formData=c,n.state={activeNav:l},n}return a(t,e),c(t,[{key:"diffProps",value:function(e){var t=e.schema,n=e.uiSchema,r=e.activeNav;return!(0,v.default)({schema:t,uiSchema:n,activeNav:r},{schema:this.props.schema,uiSchema:this.props.uiSchema,activeNav:this.props.activeNav})}},{key:"componentWillReceiveProps",value:function(e){if(this.diffProps(e)){var t=e.schema,n=e.uiSchema,r=e.activeNav;this.navTree=(0,_.default)(t,n),r&&this.setState({activeNav:(0,g.toArray)(r)})}}},{key:"shouldComponentUpdate",value:function(e,t){return!(0,v.default)(t.activeNav,this.state.activeNav)||(!!this.diffProps(e)||e.formData&&!(0,v.default)(this.formData,e.formData))}},{key:"render",value:function(){var e=this.navTree.toSubForms(this.state.activeNav),t=Object.assign({},this.props,{subForms:e,transformErrors:(0,N.default)(this.navTree,this.props.transformErrors),formData:this.formData,onChange:this.handleOnChange,onNavChange:this.handleNavChange});return s.default.createElement(n,t,this.props.children)}}]),t}(f.Component),u=function(){var e=this;this.handleNavChange=function(t){var n=e.state.activeNav;n.length===t.length&&n.every(function(e,n){return e===t[n]})||(e.navTree.updateActiveNav(t),e.setState({activeNav:t}),e.props.onNavChange&&e.props.onNavChange(t,n))},this.handleOnChange=function(t){e.formData=t.formData,e.props.onChange&&e.props.onChange(t)}};return r.propTypes={},r}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.default=u;var f=n(1),s=r(f),l=n(3),d=(r(l),n(12)),v=r(d),p=n(15),h=r(p),m=n(4),y=r(m),b=n(19),_=r(b),g=n(0),O=n(24),N=r(O)},function(e,t,n){"use strict";var r=n(9),o=n(10),i=n(11);e.exports=function(){function e(e,t,n,r,a,u){u!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";function r(e,t,n,r,i,a,u,c){if(o(t),!e){var f;if(void 0===t)f=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,i,a,u,c],l=0;f=new Error(t.replace(/%s/g,function(){return s[l++]})),f.name="Invariant Violation"}throw f.framesToPop=1,f}}var o=function(e){};e.exports=r},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";function r(e){return null===e||void 0===e}function o(e){return!(!e||"object"!==(void 0===e?"undefined":a(e))||"number"!=typeof e.length)&&("function"==typeof e.copy&&"function"==typeof e.slice&&!(e.length>0&&"number"!=typeof e[0]))}function i(e,t,n){var i,l;if(r(e)||r(t))return!1;if(e.prototype!==t.prototype)return!1;if(f(e))return!!f(t)&&(e=u.call(e),t=u.call(t),s(e,t,n));if(o(e)){if(!o(t))return!1;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}try{var d=c(e),v=c(t)}catch(e){return!1}if(d.length!=v.length)return!1;for(d.sort(),v.sort(),i=d.length-1;i>=0;i--)if(d[i]!=v[i])return!1;for(i=d.length-1;i>=0;i--)if(l=d[i],!s(e[l],t[l],n))return!1;return(void 0===e?"undefined":a(e))===(void 0===t?"undefined":a(t))}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=Array.prototype.slice,c=n(13),f=n(14),s=e.exports=function(e,t,n){return n||(n={}),e===t||(e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():!e||!t||"object"!=(void 0===e?"undefined":a(e))&&"object"!=(void 0===t?"undefined":a(t))?n.strict?e===t:e==t:i(e,t,n))}},function(e,t,n){"use strict";function r(e){var t=[];for(var n in e)t.push(n);return t}t=e.exports="function"==typeof Object.keys?Object.keys:r,t.shim=r},function(e,t,n){"use strict";function r(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function o(e){return e&&"object"==(void 0===e?"undefined":i(e))&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();t=e.exports=a?r:o,t.supported=r,t.unsupported=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(16),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=o.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(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 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)}function c(e){var t=e.properties;return Object.keys(t).reduce(function(e,t){return e[t]={"ui:widget":"hidden","ui:field":"hidden"},e},{})}function f(e,t){if(t[p.UI_ORDER]&&t[p.UI_ORDER].length>0)return t[p.UI_ORDER][0];var n=e&&e.properties?Object.keys(e.properties):[];return n.length>0?n[0]:void 0}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(1),d=r(l),v=n(3),p=(r(v),n(0)),h=n(4),m=r(h),y=n(17),b=r(y),_=n(18),g=r(_),O=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:m.default,n=function(n){function r(){var e,t,n,o;i(this,r);for(var u=arguments.length,c=Array(u),f=0;f<u;f++)c[f]=arguments[f];return t=n=a(this,(e=r.__proto__||Object.getPrototypeOf(r)).call.apply(e,[this].concat(c))),n.toNavConf=function(e,t){return e&&e.links.length>0?{navs:e,onNavChange:function(e){var r=0===t.length?[e]:t.slice(0,t.length-1).concat([e]);n.props.onNavChange(r)}}:void 0},o=t,a(n,o)}return u(r,n),s(r,[{key:"toUiSchema",value:function(){var e=this,t=this.props,n=t.subForms,r=t.schema,i=c(r),a=n.reduce(function(t,n){var r=n.schema,i=n.uiSchema,a=void 0===i?{}:i,u=n.navs,c=n.navPath,s=t.navConfs,l=void 0===s?[]:s;l=l.concat([e.toNavConf(u,c)]).filter(function(e){return void 0!==e});var d=f(r,a);if(d&&l.length>0){var v,p,h=(v={navConfs:l},o(v,"ui:field","nav"),o(v,"origUiSchema",a[d]),v);return Object.assign(t,a,(p={},o(p,d,h),o(p,"navConfs",[]),p))}return Object.assign(t,a,{navConfs:l})},i);return a[p.UI_ORDER]=this.props.uiSchema[p.UI_ORDER],a}},{key:"render",value:function(){var n=this.props.fields,r=void 0===n?{}:n,o=this.toUiSchema(),i=Object.assign({},this.props,{uiSchema:o,fields:Object.assign({},r,{hidden:b.default,nav:(0,g.default)(t)})});return d.default.createElement(e,i,this.props.children)}}]),r}(l.Component);return n.propTypes={},n};t.default=O},function(e,t,n){"use strict";function r(){return i.default.createElement("div",null)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=n(1),i=function(e){return e&&e.__esModule?e:{default:e}}(o)},function(e,t,n){"use strict";function r(e){var t=e.label,n=e.required,r=e.id;return t?a.default.createElement("label",{className:"control-label",htmlFor:r},n?t+u:t):a.default.createElement("div",null)}function o(e,t,n){var r=t["ui:field"];if("function"==typeof r)return r;if("string"==typeof r&&r in n)return n[r];var o=c[e.type];return o in n?n[o]:function(){return a.default.createElement("h1",null,"Unknown field type ",e.type)}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=function(e){return e&&e.__esModule?e:{default:e}}(i),u="*",c={array:"ArrayField",boolean:"BooleanField",integer:"NumberField",number:"NumberField",object:"ObjectField",string:"StringField"},f=function(e){return function(t){var n=t.schema,i=n.type,u=n.title,c=t.uiSchema,f=c.navConfs,s=c.origUiSchema,l=t.registry.fields,d=t.required,v=t.name,p=o(t.schema,s,l),h=Object.assign({},t,{uiSchema:s}),m=s["ui:title"]||u||v,y=s["ui:options"];y=void 0===y?{}:y;var b=y.label,_=void 0===b||b;return"object"===i&&(_=!1),"boolean"!==i||s["ui:widget"]||(_=!1),a.default.createElement("div",null,f.map(function(t,n){return a.default.createElement("div",{className:"col-md-12",key:n},a.default.createElement(e,t),a.default.createElement("br",null))}),a.default.createElement("div",{className:s.classNames},_&&a.default.createElement(r,{label:m,required:d,id:t.idSchema.$id}),a.default.createElement(p,h)))}};t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return new o.default(e,t)};var r=n(20),o=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=n(21),a=function(e){return e&&e.__esModule?e:{default:e}}(i),u=n(2),c=n(5),f=function e(t,n){var i=this;r(this,e),this.pushToTabFromTree=function(e,t){var n=(0,u.orderNavByName)(Object.keys(e),i.uiSchema),r=n.find(function(e){return e!==o.GENERIC_NAV});r&&(t.push(r),i.pushToTabFromTree(e[r],t))},this.updateActiveNav=function(e){var t=(0,c.findRelTree)(i.tree,e);i.pushToTabFromTree(t,e)},this.findActiveNav=function(e){return(0,u.findFieldNavs)(e,i.uiSchema).map(function(e){return(0,u.toNavConfOrDefault)(e,i.uiSchema)})},this.toSubForms=function(e){for(var t=[],n=0;n<=e.length;n++){var r=(0,a.default)(e.slice(0,n),i.tree,i.schema,i.uiSchema);(r.schema||r.navs.links.length>0)&&t.push(r)}return t},this.tree=(0,c.extractTree)(t,n),this.schema=t,this.uiSchema=n};t.default=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=n(5),a=n(22),u=r(a),c=n(23),f=r(c),s=n(2),l=r(s),d=function(e,t,n){if(0===e.length){var r=(0,s.toNavConf)(o.GENERIC_NAV,n);return Object.assign({},{links:[]},r)}var a=e[e.length-1],u=(0,i.findRelTree)(t,e.slice(0,e.length-1)),c=(0,l.default)(u,n,a);if(1===e.length){var f=(0,s.toNavConf)(o.GENERIC_NAV,n);return Object.assign(c,f)}var d=e[e.length-2],v=(0,s.toNavConf)(d,n);return Object.assign({},c,v)},v=function(e,t,n,r){var a=(0,i.findRelTree)(t,e),c=d(e,t,r);if(void 0===a[o.GENERIC_NAV])return{navs:c,navPath:e};var s=a[o.GENERIC_NAV],l=s.fields,v=s.aliases,p=(0,f.default)(l,n),h=(0,u.default)(l,r,v);return 0===e.length&&(p.title=n.title,p.description=n.description),{schema:p,uiSchema:h,navs:c,navPath:e}};t.default=v},function(e,t,n){"use strict";function r(e,t,n){t[u.UI_ORDER]&&e&&(n[u.UI_ORDER]=t[u.UI_ORDER].filter(function(t){return e.includes(t)}))}function o(e,t){var n={};return e.forEach(function(e){n[e]=t[e]}),r(e,t,n),n}function i(e,t,n){Object.keys(n).forEach(function(r){var o=n[r];t[r]=e[o]})}function a(e,t,n){var r=o(e,t);return i(t,r,n),r}Object.defineProperty(t,"__esModule",{value:!0}),t.default=a;var u=n(0)},function(e,t,n){"use strict";function r(e,t){var n={type:"object",properties:{}};return e.forEach(function(e){n.properties[e]=t.properties[e]}),t.required&&(n.required=t.required.filter(function(t){return e.includes(t)})),n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){return function(n){var r=n.map(function(t){var n="instance"===t.property?t.argument:t.property.substring(9),r=e.findActiveNav(n);return r&&r.length>0?Object.assign({activeNav:r},t):t});return t?t(r):r}};t.default=r}])}); | ||
//# sourceMappingURL=form-with-pagination.js.map |
@@ -85,7 +85,9 @@ "use strict"; | ||
var schema = _ref.schema, | ||
uiSchema = _ref.uiSchema; | ||
uiSchema = _ref.uiSchema, | ||
activeNav = _ref.activeNav; | ||
return !(0, _deepEqual2.default)({ schema: schema, uiSchema: uiSchema }, { | ||
return !(0, _deepEqual2.default)({ schema: schema, uiSchema: uiSchema, activeNav: activeNav }, { | ||
schema: this.props.schema, | ||
uiSchema: this.props.uiSchema | ||
uiSchema: this.props.uiSchema, | ||
activeNav: this.props.activeNav | ||
}); | ||
@@ -99,5 +101,9 @@ } | ||
var schema = nextProps.schema, | ||
uiSchema = nextProps.uiSchema; | ||
uiSchema = nextProps.uiSchema, | ||
activeNav = nextProps.activeNav; | ||
this.navTree = (0, _splitter2.default)(schema, uiSchema); | ||
if (activeNav) { | ||
this.setState({ activeNav: (0, _utils.toArray)(activeNav) }); | ||
} | ||
} | ||
@@ -116,3 +122,3 @@ } | ||
} | ||
return !(0, _deepEqual2.default)(this.formData, nextProps.formData); | ||
return nextProps.formData && !(0, _deepEqual2.default)(this.formData, nextProps.formData); | ||
} | ||
@@ -119,0 +125,0 @@ }, { |
@@ -6,3 +6,3 @@ { | ||
"author": "mavarazy@gmail.com", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"scripts": { | ||
@@ -9,0 +9,0 @@ "build:lib": "rimraf lib && cross-env NODE_ENV=production babel -d lib/ src/", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
181880
21
858