react-jsonschema-form-pagination
Advanced tools
Comparing version 0.1.22 to 0.1.23
@@ -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=5)}([function(e,t,n){"use strict";function r(){return!1}function o(e){return!e||!e.properties||0===Object.keys(e.properties).length}function a(e,t){return t&&t[e]&&t[e][v]?t[e][v][0]:d}function i(e,t){var n=Object.keys(e.properties).map(function(e){return a(e,t)}),r=Object.keys(t).map(function(e){return a(e,t)}),o=n.concat(r).concat([d]);return Array.from(new Set(o))}function u(e){Object.keys(e).forEach(function(t){e[t]&&e[t][v]&&!Array.isArray(e[t][v])&&(e[t][v]=[e[t][v]])})}function c(e){e[h]||(e[h]={}),Object.keys(e[h]).forEach(function(t){var n=e[h][t];Array.isArray(n)||(e[h][t]=[n])})}function f(e){e[y]||(e[y]=[])}function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign(e);return u(t),c(t),f(t),t}function l(e){e.required||(e.required=[])}function p(e){var t=Object.assign({},e,{properties:Object.assign({},e.properties)});return l(t),t}Object.defineProperty(t,"__esModule",{value:!0}),t.isDevelopment=r,t.isEmptySchema=o,t.findLayer=a,t.listLayers=i,t.normalizeUiSchema=s,t.normalizeSchema=p;var d=t.GENERIC_TAB="default",v=(t.UI_ORDER="ui:order",t.UI_TAB_ID="ui:tabID"),h=t.UI_TAB_ALIAS="ui:tabAlias",y=t.UI_TAB_ORDER="ui:tabOrder";t.toError=function(e){console.error(e)}},function(t,n){t.exports=e},function(e,t,n){"use strict";"function"==typeof Symbol&&Symbol.iterator;e.exports=n(7)()},function(e,t,n){"use strict";function r(e){var t=e.handleClick,n=e.isActive,r=e.name;return i.default.createElement("li",{onClick:t,className:n?"active":null},i.default.createElement("a",null,r))}function o(e){var t=e.navs,n=t.orientation,o=void 0===n?"horizontal":n,a=t.links,c=e.onNavChange,f=a.filter(function(e){return e.tabID!==u.GENERIC_TAB}),s="vertical"===o?"nav nav-pills nav-stacked":"nav nav-pills";return f.length>0?i.default.createElement("ul",{className:s},f.map(function(e,t){var n=e.tabID,o=e.name,a=e.isActive;return i.default.createElement(r,{key:t,name:o||n,isActive:a,handleClick:function(){return c(n)}})})):i.default.createElement("div",null)}Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),i=function(e){return e&&e.__esModule?e:{default:e}}(a),u=n(0);t.default=o},function(e,t,n){"use strict";function r(e,t){var n=t[e]&&t[e][f.UI_TAB_ID]?t[e][f.UI_TAB_ID]:[];return Array.isArray(n)?n:[n]}function o(e,t){return t.reduce(function(e,t){return void 0===e[t]&&(e[t]={}),e[t]},e)}function a(e,t,n){void 0===e[f.GENERIC_TAB]&&(e[f.GENERIC_TAB]={fields:[],aliases:{}}),e[f.GENERIC_TAB].fields.push(t),n&&(e[f.GENERIC_TAB].aliases[t]=n)}function i(e,t,n){Object.keys(e.properties).forEach(function(e){var i=r(e,t);a(o(n,i),e)},{})}function u(e,t){var n=e[f.UI_TAB_ALIAS];n&&Object.keys(n).forEach(function(i){var u=n[i];(Array.isArray(u)?u:[u]).forEach(function(n){var u=r(n,e);a(o(t,u),i,n)})})}function c(e,t){var n={};return i(e,t,n),u(t,n),n}Object.defineProperty(t,"__esModule",{value:!0}),t.findRelTree=o,t.extractTree=c;var f=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),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 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 i(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]:_.default,n=(0,y.default)(e,t),r=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));u.call(n);var r=n.props,i=r.formData,c=void 0===i?{}:i,f=r.tabData,s=r.schema,l=r.uiSchema,p=[];return n.navTree=(0,O.default)(s,l,f),n.navTree.updateActiveNav(p,0),n.formData=c,n.state={activeNav:p},n}return i(t,e),c(t,[{key:"diffProps",value:function(e){var t=e.tabData,n=e.schema,r=e.uiSchema;return!(0,v.default)({tabData:t,schema:n,uiSchema:r},{tabData:this.props.tabData,schema:this.props.schema,uiSchema:this.props.uiSchema})}},{key:"componentWillReceiveProps",value:function(e){if(this.diffProps(e)){var t=e.tabData,n=e.schema,r=e.uiSchema;this.navTree=(0,O.default)(n,r,t)}}},{key:"shouldComponentUpdate",value:function(e,t){return!(0,v.default)(t.activeNav,this.state.activeNav)||(!!this.diffProps(e)||!(0,v.default)(this.formData,e.formData))}},{key:"render",value:function(){var e=this.navTree.toSubForms(this.state.activeNav);return s.default.createElement("div",null,s.default.createElement(n,{confs:e,formData:this.formData,onChange:this.handleOnChange,onNavChange:this.handleNavChange}),this.props.children)}}]),t}(f.Component),u=function(){var e=this;this.handleNavChange=function(t){var n=e.state.activeNav;e.navTree.updateActiveNav(t),e.setState({activeNav:t}),e.props.onTabChange&&e.props.onTabChange(t,n)},this.handleOnChange=function(t){e.formData=t.formData,e.props.onChange&&e.props.onChange(t)}};return(0,m.isDevelopment)()&&(r.propTypes={schema:p.default.shape({type:function(e,t,n){if("object"!==e[t])return new Error('Only "object" schemas supported by pagination for '+n+".")}}),tabData:p.default.array}),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(2),p=r(l),d=n(11),v=r(d),h=n(14),y=r(h),m=n(0),b=n(3),_=r(b),g=n(15),O=r(g)},function(e,t,n){"use strict";var r=n(8),o=n(9),a=n(10);e.exports=function(){function e(e,t,n,r,i,u){u!==a&&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};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,a,i,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,a,i,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":i(e))||"number"!=typeof e.length)&&("function"==typeof e.copy&&"function"==typeof e.slice&&!(e.length>0&&"number"!=typeof e[0]))}function a(e,t,n){var a,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(a=0;a<e.length;a++)if(e[a]!==t[a])return!1;return!0}try{var p=c(e),d=c(t)}catch(e){return!1}if(p.length!=d.length)return!1;for(p.sort(),d.sort(),a=p.length-1;a>=0;a--)if(p[a]!=d[a])return!1;for(a=p.length-1;a>=0;a--)if(l=p[a],!s(e[l],t[l],n))return!1;return(void 0===e?"undefined":i(e))===(void 0===t?"undefined":i(t))}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=Array.prototype.slice,c=n(12),f=n(13),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":i(e))&&"object"!=(void 0===t?"undefined":i(t))?n.strict?e===t:e==t:a(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":a(e))&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}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},i="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();t=e.exports=i?r:o,t.supported=r,t.unsupported=o},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 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 i(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)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},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}}(),f=n(1),s=r(f),l=n(2),p=r(l),d=n(0),v=n(3),h=r(v),y=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.default,n=function(n){function r(){var n,i,c,f;o(this,r);for(var l=arguments.length,p=Array(l),v=0;v<l;v++)p[v]=arguments[v];return i=c=a(this,(n=r.__proto__||Object.getPrototypeOf(r)).call.apply(n,[this].concat(p))),c.handleNavChange=function(e){var t=c.props.confs[0].navs.links;if(t.some(function(t){return t.tabID===e}))c.props.onNavChange([e]);else{var n=t.find(function(e){return e.tabID,e.isActive});void 0!==n?c.props.onNavChange([n.tabID].concat(e)):c.props.onNavChange(e)}},c.renderNavs=function(){var e=c.props.confs[0].navs;return s.default.createElement(t,{navs:e,onNavChange:c.handleNavChange})},c.renderForm=function(){var t=c.props.confs[0];if((0,d.isEmptySchema)(t.schema))return s.default.createElement("div",null);var n=Object.assign({},t,{formData:c.props.formData});return s.default.createElement(e,u({},n,{onChange:c.props.onChange,onSubmit:c.props.onSubmit}),s.default.createElement("div",null))},c.renderNext=function(){var e=c.props.confs;if(e.length>1){var t=e.slice(1,e.length),n=Object.assign({},c.props,{confs:t,onNavChange:c.handleNavChange});return s.default.createElement(r,n)}return s.default.createElement("div",null)},f=i,a(c,f)}return i(r,n),c(r,[{key:"render",value:function(){var e=this.props.confs[0].navs.orientation;switch(void 0===e?"horizontal":e){case"vertical":return s.default.createElement("div",null,s.default.createElement("div",{className:"col-md-3"},this.renderNavs()),s.default.createElement("div",{className:"col-md-9"},this.renderForm(),this.renderNext()));default:return s.default.createElement("div",null,s.default.createElement("fieldset",null,s.default.createElement("div",{className:"form-group col-md-12"},this.renderNavs())),this.renderForm(),this.renderNext())}}}]),r}(f.Component);return(0,d.isDevelopment)()&&(n.propTypes={navs:p.default.shape({links:p.default.array})}),n};t.default=y},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return new o.default(e,t,n)};var r=n(16),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),a=n(17),i=function(e){return e&&e.__esModule?e:{default:e}}(a),u=n(4),c=function e(t,n){var a=this,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];r(this,e),this.pushToTabFromTree=function(e,t){var n=Object.keys(e).find(function(e){return e!==o.GENERIC_TAB});n&&(t.push(n),a.pushToTabFromTree(e[n],t))},this.updateActiveNav=function(e){var t=(0,u.findRelTree)(a.tree,e);a.pushToTabFromTree(t,e)},this.toSubForms=function(e){for(var t=[],n=0;n<=e.length;n++){var r=(0,i.default)(e.slice(0,n),a.tree,a.schema,a.uiSchema,a.navData);t.push(r)}return t},this.tree=(0,u.extractTree)(t,n),console.dir(this.tree),this.schema=t,this.uiSchema=n,this.navData=c};t.default=c},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),a=n(4),i=n(18),u=r(i),c=n(19),f=r(c),s=n(20),l=r(s),p={schema:{type:"object",properties:{}},uiSchema:{}},d=function(e,t,n,r){if(0==e.length){var i=r.find(function(e){return e.tabID===o.GENERIC_TAB});return Object.assign({},i,{links:[]})}var u=e[e.length-1],c=(0,a.findRelTree)(t,e.slice(0,e.length-1)),f=(0,l.default)(c,n,r,u);if(1==e.length)return f;var s=e[e.length-2],p=r.find(function(e){return e.tabID===s});return Object.assign({},p,f)},v=function(e,t,n,r,i){var c=(0,a.findRelTree)(t,e),s=d(e,t,r,i);if(void 0===c[o.GENERIC_TAB])return Object.assign({},{navs:s},p);var l=c[o.GENERIC_TAB],v=l.fields,h=l.aliases,y=(0,f.default)(v,n),m=(0,u.default)(v,r,h);return 0===e.length&&(y.title=n.title,y.description=n.description),{schema:y,uiSchema:m,navs:s}};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)}),0===t[u.UI_ORDER].length&&delete t[u.UI_ORDER])}function o(e,t){var n={};return e.forEach(function(e){n[e]=t[e]}),r(e,t,n),n}function a(e,t,n){Object.keys(n).forEach(function(r){var o=n[r];t[r]=e[o]})}function i(e,t,n){var r=o(e,t);return a(t,r,n),r}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;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";function r(e,t){if(!t||0===t.length)return e;var n=t.map(function(t){return e.find(function(e){return e.tabID===t})}).filter(function(e){return void 0!==e});if(0===n.length)return e;var r=e.filter(function(e){return!n.includes(e)});return n.concat(r)}function o(e,t){var n=t.find(function(t){return t.tabID===e});return n||{tabID:e}}function a(e,t,n,a){return{links:r(Object.keys(e).filter(function(e){return e!==i.GENERIC_TAB}).map(function(e){return o(e,n)}).map(function(e){return Object.assign(e,{isActive:e.tabID===a})}),t[i.UI_TAB_ORDER])}}Object.defineProperty(t,"__esModule",{value:!0}),t.order=r,t.findNav=o,t.default=a;var i=n(0)}])}); | ||
!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=5)}([function(e,t,n){"use strict";function r(){return!1}function o(e){return!e||!e.properties||0===Object.keys(e.properties).length}function a(e,t){return t&&t[e]&&t[e][v]?t[e][v][0]:d}function i(e,t){var n=Object.keys(e.properties).map(function(e){return a(e,t)}),r=Object.keys(t).map(function(e){return a(e,t)}),o=n.concat(r).concat([d]);return Array.from(new Set(o))}function u(e){Object.keys(e).forEach(function(t){e[t]&&e[t][v]&&!Array.isArray(e[t][v])&&(e[t][v]=[e[t][v]])})}function c(e){e[h]||(e[h]={}),Object.keys(e[h]).forEach(function(t){var n=e[h][t];Array.isArray(n)||(e[h][t]=[n])})}function f(e){e[y]||(e[y]=[])}function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign(e);return u(t),c(t),f(t),t}function l(e){e.required||(e.required=[])}function p(e){var t=Object.assign({},e,{properties:Object.assign({},e.properties)});return l(t),t}Object.defineProperty(t,"__esModule",{value:!0}),t.isDevelopment=r,t.isEmptySchema=o,t.findLayer=a,t.listLayers=i,t.normalizeUiSchema=s,t.normalizeSchema=p;var d=t.GENERIC_TAB="default",v=(t.UI_ORDER="ui:order",t.UI_TAB_ID="ui:tabID"),h=t.UI_TAB_ALIAS="ui:tabAlias",y=t.UI_TAB_ORDER="ui:tabOrder";t.toError=function(e){console.error(e)}},function(t,n){t.exports=e},function(e,t,n){"use strict";"function"==typeof Symbol&&Symbol.iterator;e.exports=n(7)()},function(e,t,n){"use strict";function r(e){var t=e.handleClick,n=e.isActive,r=e.name;return i.default.createElement("li",{onClick:t,className:n?"active":null},i.default.createElement("a",null,r))}function o(e){var t=e.navs,n=t.orientation,o=void 0===n?"horizontal":n,a=t.links,c=e.onNavChange,f=a.filter(function(e){return e.tabID!==u.GENERIC_TAB}),s="vertical"===o?"nav nav-pills nav-stacked":"nav nav-pills";return f.length>0?i.default.createElement("ul",{className:s},f.map(function(e,t){var n=e.tabID,o=e.name,a=e.isActive;return i.default.createElement(r,{key:t,name:o||n,isActive:a,handleClick:function(){return c(n)}})})):i.default.createElement("div",null)}Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),i=function(e){return e&&e.__esModule?e:{default:e}}(a),u=n(0);t.default=o},function(e,t,n){"use strict";function r(e,t){var n=t[e]&&t[e][f.UI_TAB_ID]?t[e][f.UI_TAB_ID]:[];return Array.isArray(n)?n:[n]}function o(e,t){return t.reduce(function(e,t){return void 0===e[t]&&(e[t]={}),e[t]},e)}function a(e,t,n){void 0===e[f.GENERIC_TAB]&&(e[f.GENERIC_TAB]={fields:[],aliases:{}}),e[f.GENERIC_TAB].fields.push(t),n&&(e[f.GENERIC_TAB].aliases[t]=n)}function i(e,t,n){Object.keys(e.properties).forEach(function(e){var i=r(e,t);a(o(n,i),e)},{})}function u(e,t){var n=e[f.UI_TAB_ALIAS];n&&Object.keys(n).forEach(function(i){var u=n[i];(Array.isArray(u)?u:[u]).forEach(function(n){var u=r(n,e);a(o(t,u),i,n)})})}function c(e,t){var n={};return i(e,t,n),u(t,n),n}Object.defineProperty(t,"__esModule",{value:!0}),t.findRelTree=o,t.extractTree=c;var f=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),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 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 i(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]:_.default,n=(0,y.default)(e,t),r=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));u.call(n);var r=n.props,i=r.formData,c=void 0===i?{}:i,f=r.tabData,s=r.schema,l=r.uiSchema,p=[];return n.navTree=(0,O.default)(s,l,f),n.navTree.updateActiveNav(p,0),n.formData=c,n.state={activeNav:p},n}return i(t,e),c(t,[{key:"diffProps",value:function(e){var t=e.tabData,n=e.schema,r=e.uiSchema;return!(0,v.default)({tabData:t,schema:n,uiSchema:r},{tabData:this.props.tabData,schema:this.props.schema,uiSchema:this.props.uiSchema})}},{key:"componentWillReceiveProps",value:function(e){if(this.diffProps(e)){var t=e.tabData,n=e.schema,r=e.uiSchema;this.navTree=(0,O.default)(n,r,t)}}},{key:"shouldComponentUpdate",value:function(e,t){return!(0,v.default)(t.activeNav,this.state.activeNav)||(!!this.diffProps(e)||!(0,v.default)(this.formData,e.formData))}},{key:"render",value:function(){var e=this.navTree.toSubForms(this.state.activeNav),t=Object.assign({},this.props,{formData:this.formData,confs:e,onChange:this.handleOnChange,onNavChange:this.handleNavChange});return s.default.createElement("div",null,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;e.navTree.updateActiveNav(t),e.setState({activeNav:t}),e.props.onTabChange&&e.props.onTabChange(t,n)},this.handleOnChange=function(t){e.formData=t.formData,e.props.onChange&&e.props.onChange(t)}};return(0,m.isDevelopment)()&&(r.propTypes={schema:p.default.shape({type:function(e,t,n){if("object"!==e[t])return new Error('Only "object" schemas supported by pagination for '+n+".")}}),tabData:p.default.array}),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(2),p=r(l),d=n(11),v=r(d),h=n(14),y=r(h),m=n(0),b=n(3),_=r(b),g=n(15),O=r(g)},function(e,t,n){"use strict";var r=n(8),o=n(9),a=n(10);e.exports=function(){function e(e,t,n,r,i,u){u!==a&&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};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,a,i,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,a,i,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":i(e))||"number"!=typeof e.length)&&("function"==typeof e.copy&&"function"==typeof e.slice&&!(e.length>0&&"number"!=typeof e[0]))}function a(e,t,n){var a,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(a=0;a<e.length;a++)if(e[a]!==t[a])return!1;return!0}try{var p=c(e),d=c(t)}catch(e){return!1}if(p.length!=d.length)return!1;for(p.sort(),d.sort(),a=p.length-1;a>=0;a--)if(p[a]!=d[a])return!1;for(a=p.length-1;a>=0;a--)if(l=p[a],!s(e[l],t[l],n))return!1;return(void 0===e?"undefined":i(e))===(void 0===t?"undefined":i(t))}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=Array.prototype.slice,c=n(12),f=n(13),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":i(e))&&"object"!=(void 0===t?"undefined":i(t))?n.strict?e===t:e==t:a(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":a(e))&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}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},i="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();t=e.exports=i?r:o,t.supported=r,t.unsupported=o},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 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 i(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)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},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}}(),f=n(1),s=r(f),l=n(2),p=r(l),d=n(0),v=n(3),h=r(v),y=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.default,n=function(n){function r(){var n,i,c,f;o(this,r);for(var l=arguments.length,p=Array(l),v=0;v<l;v++)p[v]=arguments[v];return i=c=a(this,(n=r.__proto__||Object.getPrototypeOf(r)).call.apply(n,[this].concat(p))),c.handleNavChange=function(e){var t=c.props.confs[0].navs.links;if(t.some(function(t){return t.tabID===e}))c.props.onNavChange([e]);else{var n=t.find(function(e){return e.tabID,e.isActive});void 0!==n?c.props.onNavChange([n.tabID].concat(e)):c.props.onNavChange(e)}},c.renderNavs=function(){var e=c.props.confs[0].navs;return s.default.createElement(t,{navs:e,onNavChange:c.handleNavChange})},c.renderForm=function(){var t=c.props.confs[0];if((0,d.isEmptySchema)(t.schema))return s.default.createElement("div",null);var n=Object.assign({},t,{formData:c.props.formData});return s.default.createElement(e,u({},n,{onChange:c.props.onChange,onSubmit:c.props.onSubmit}),s.default.createElement("div",null))},c.renderNext=function(){var e=c.props.confs;if(e.length>1){var t=e.slice(1,e.length),n=Object.assign({},c.props,{confs:t,onNavChange:c.handleNavChange,children:void 0});return s.default.createElement(r,n)}return s.default.createElement("div",null)},f=i,a(c,f)}return i(r,n),c(r,[{key:"render",value:function(){var e=this.props.confs[0].navs.orientation;switch(void 0===e?"horizontal":e){case"vertical":return s.default.createElement("div",null,s.default.createElement("div",{className:"col-md-3"},this.renderNavs()),s.default.createElement("div",{className:"col-md-9"},this.renderForm(),this.renderNext()),this.props.children);default:return s.default.createElement("div",null,s.default.createElement("fieldset",null,s.default.createElement("div",{className:"form-group col-md-12"},this.renderNavs())),this.renderForm(),this.renderNext(),this.props.children)}}}]),r}(f.Component);return(0,d.isDevelopment)()&&(n.propTypes={navs:p.default.shape({links:p.default.array})}),n};t.default=y},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return new o.default(e,t,n)};var r=n(16),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),a=n(17),i=function(e){return e&&e.__esModule?e:{default:e}}(a),u=n(4),c=function e(t,n){var a=this,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];r(this,e),this.pushToTabFromTree=function(e,t){var n=Object.keys(e).find(function(e){return e!==o.GENERIC_TAB});n&&(t.push(n),a.pushToTabFromTree(e[n],t))},this.updateActiveNav=function(e){var t=(0,u.findRelTree)(a.tree,e);a.pushToTabFromTree(t,e)},this.toSubForms=function(e){for(var t=[],n=0;n<=e.length;n++){var r=(0,i.default)(e.slice(0,n),a.tree,a.schema,a.uiSchema,a.navData);t.push(r)}return t},this.tree=(0,u.extractTree)(t,n),console.dir(this.tree),this.schema=t,this.uiSchema=n,this.navData=c};t.default=c},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),a=n(4),i=n(18),u=r(i),c=n(19),f=r(c),s=n(20),l=r(s),p={schema:{type:"object",properties:{}},uiSchema:{}},d=function(e,t,n,r){if(0==e.length){var i=r.find(function(e){return e.tabID===o.GENERIC_TAB});return Object.assign({},i,{links:[]})}var u=e[e.length-1],c=(0,a.findRelTree)(t,e.slice(0,e.length-1)),f=(0,l.default)(c,n,r,u);if(1==e.length)return f;var s=e[e.length-2],p=r.find(function(e){return e.tabID===s});return Object.assign({},p,f)},v=function(e,t,n,r,i){var c=(0,a.findRelTree)(t,e),s=d(e,t,r,i);if(void 0===c[o.GENERIC_TAB])return Object.assign({},{navs:s},p);var l=c[o.GENERIC_TAB],v=l.fields,h=l.aliases,y=(0,f.default)(v,n),m=(0,u.default)(v,r,h);return 0===e.length&&(y.title=n.title,y.description=n.description),{schema:y,uiSchema:m,navs:s}};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)}),0===t[u.UI_ORDER].length&&delete t[u.UI_ORDER])}function o(e,t){var n={};return e.forEach(function(e){n[e]=t[e]}),r(e,t,n),n}function a(e,t,n){Object.keys(n).forEach(function(r){var o=n[r];t[r]=e[o]})}function i(e,t,n){var r=o(e,t);return a(t,r,n),r}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;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";function r(e,t){if(!t||0===t.length)return e;var n=t.map(function(t){return e.find(function(e){return e.tabID===t})}).filter(function(e){return void 0!==e});if(0===n.length)return e;var r=e.filter(function(e){return!n.includes(e)});return n.concat(r)}function o(e,t){var n=t.find(function(t){return t.tabID===e});return n||{tabID:e}}function a(e,t,n,a){return{links:r(Object.keys(e).filter(function(e){return e!==i.GENERIC_TAB}).map(function(e){return o(e,n)}).map(function(e){return Object.assign(e,{isActive:e.tabID===a})}),t[i.UI_TAB_ORDER])}}Object.defineProperty(t,"__esModule",{value:!0}),t.order=r,t.findNav=o,t.default=a;var i=n(0)}])}); | ||
//# sourceMappingURL=form-with-pagination.js.map |
@@ -118,13 +118,12 @@ "use strict"; | ||
value: function render() { | ||
var subForms = this.navTree.toSubForms(this.state.activeNav); | ||
var confs = this.navTree.toSubForms(this.state.activeNav); | ||
var formConfs = Object.assign({}, this.props, { formData: this.formData, confs: confs, onChange: this.handleOnChange, onNavChange: this.handleNavChange }); | ||
return _react2.default.createElement( | ||
"div", | ||
null, | ||
_react2.default.createElement(FormWithNavs, { | ||
confs: subForms, | ||
formData: this.formData, | ||
onChange: this.handleOnChange, | ||
onNavChange: this.handleNavChange | ||
}), | ||
this.props.children | ||
_react2.default.createElement( | ||
FormWithNavs, | ||
formConfs, | ||
this.props.children | ||
) | ||
); | ||
@@ -131,0 +130,0 @@ } |
@@ -95,6 +95,7 @@ "use strict"; | ||
if (confs.length > 1) { | ||
var subConfs = confs.slice(1, confs.length); | ||
var nextConfs = confs.slice(1, confs.length); | ||
var nextRecProps = Object.assign({}, _this.props, { | ||
confs: subConfs, | ||
onNavChange: _this.handleNavChange | ||
confs: nextConfs, | ||
onNavChange: _this.handleNavChange, | ||
children: undefined | ||
}); | ||
@@ -131,3 +132,4 @@ return _react2.default.createElement(FormWithTabs, nextRecProps); | ||
this.renderNext() | ||
) | ||
), | ||
this.props.children | ||
); | ||
@@ -150,3 +152,4 @@ } | ||
this.renderForm(), | ||
this.renderNext() | ||
this.renderNext(), | ||
this.props.children | ||
); | ||
@@ -153,0 +156,0 @@ } |
@@ -6,3 +6,3 @@ { | ||
"author": "zboldyga@gmail.com", | ||
"version": "0.1.22", | ||
"version": "0.1.23", | ||
"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
165384
744