aprila-wizard
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -26,3 +26,3 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"uWh2":[function(require,module,exports) { | ||
},{"./utils.js":"FOZT","lit-html":"SPDu"}],"FOZT":[function(require,module,exports) { | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getValue=c,exports.countNextPages=s,exports.countPrevPages=l,exports.getCurrentStepInPercent=f,exports.getTotalNumberOfPages=p,exports.validateEmail=d,exports.validatePhone=h,exports.reRender=v,exports.routeChange=b,exports.checkPageValidation=x,exports.submitData=P,exports.typeOf=m,exports.classnames=y,exports.getVisibleBlocks=w,exports.getAllVisiblePages=j,exports.flattenBlocks=k,exports.getAllVisibleQuestions=V,exports.validateBlocks=E,exports.schemaToFlatState=Q,exports.schemaToFlatValidations=A,exports.ObservedObject=S,exports.renderBlocks=C,exports.blockTypes=exports.router=void 0;var e=require("./blocks.js");function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(o,!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(o).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}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 o(e){return i(e)||u(e)||a()}function a(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function u(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function i(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}function c(e,t){return"function"==typeof e?e(t):e}function s(e){var t=e.state,n=e.schema,r=e.page,o=e.count,a=void 0===o?0:o,u=r.nextPage?c(r.nextPage,t):null;if(u){var i=n.find(function(e){return e.path===u});return i?s({state:t,schema:n,page:i,count:a+1}):a}return a}function l(e){var t=e.state,n=e.schema,r=e.page,o=e.count,a=void 0===o?0:o,u=r.previousPage?c(r.previousPage,t):null;if(u){var i=n.find(function(e){return e.path===u});return i?l({state:t,schema:n,page:i,count:a+1}):a}return a}function f(e){var t=e.schema.find(function(t){return t.path===e.currentPage}),n=s({schema:e.schema,state:e.state,page:t,count:0}),r=l({schema:e.schema,state:e.state,page:t,count:0});return r/(n+r)*100}function p(e){var t=e.schema.find(function(t){return t.path===e.currentPage});return s({schema:e.schema,state:e.state,page:t,count:0})+l({schema:e.schema,state:e.state,page:t,count:0})+1}function d(e){return/^.+@.+\..+$/.test(e)}function h(e){return/^[\s\d+()-]{8,}$/.test(e)}var g={goTo:function(e){return window.history.pushState({},e,window.location.origin+e)},currentPath:function(){return window.location.pathname}};function v(){window.dispatchEvent(new CustomEvent("rerender"))}function b(e){window.dispatchEvent(new CustomEvent("routechange",{detail:e}))}function x(e){window.dispatchEvent(new CustomEvent("checkpagevalidation"))}function P(e){window.dispatchEvent(new CustomEvent("wizard-submit",{detail:Object.freeze(e)}))}function m(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function y(e){return Object.keys(e).filter(function(t){return e[t]}).reduce(function(e,t,n){return e.concat(n>0?" ".concat(t):"".concat(t))},"")}function w(e,t){return e.children?e.children.reduce(function(r,a){if(void 0===a.show||("function"===m(a.show)?a.show(t.state):a.show)){var u=a.children?w(a,t):[];return[].concat(o(r),[n({},a,{path:e.path})],o(u))}return r},[]):[]}exports.router=g;var O=function(e){return{checkbox:{isQuestion:!0,defaultValue:!1},textarea:{isQuestion:!0,defaultValue:null},range:{isQuestion:!0,defaultValue:null},radio:{isQuestion:!0,defaultValue:null},input:{isQuestion:!0,defaultValue:null},file:{isQuestion:!0,defaultValue:[]},"multi-checkbox":{isQuestion:!0,defaultValue:[]},autocomplete:e.multiple?{isQuestion:!0,defaultValue:[]}:{isQuestion:!0,defaultValue:null}}};function j(e){return e.schema.reduce(function(t,r,a){var u=0===a?r:e.schema.find(function(e){return e.path===t.nextPagePath}),i=u.nextPage?c(u.nextPage,e.state):null;return i?n({},t,{pages:[].concat(o(t.pages),[n({},u)]),nextPagePath:i}):t},{pages:[],nextPagePath:""}).pages.filter(function(e){return"page"===e.type})}function k(e){return e.reduce(function(e,t){var r=t.children?k(t.children):{};return[].concat(o(e),[n({},t)],o(r))},[])}function V(e){return e.schema.reduce(function(t,r,a){var u=0===a?r:e.schema.find(function(e){return e.path===t.nextPagePath}),i=u.nextPage?c(u.nextPage,e.state):null;return i?n({},t,{blocks:[].concat(o(t.blocks),o(w(u,e))),nextPagePath:i}):t},{blocks:[],nextPagePath:""}).blocks.filter(function(e){return O(e)[e.type]&&O(e)[e.type].isQuestion})}function E(e,t){return e.every(function(e){var n=!0,r="function"==typeof e.validate,o=void 0===t.state[e.id]||null===t.state[e.id]||""===t.state[e.id]||Array.isArray(t.state[e.id])&&t.state[e.id].length<1,a=!!e.required;return(r||a)&&(r?n="function"===m(e.validate)?e.validate(t.state[e.id]):e.validate:a&&(n=!o)),n})}function Q(e){return e.reduce(function(e,t){var o=t.children?Q(t.children):{},a=O(t)[t.type]&&O(t)[t.type].defaultValue;return n({},e,r({},t.id,a),o)},{})}function A(e){return e.reduce(function(e,t){var o=t.children?A(t.children):{};return n({},e,r({},t.id,void 0),o)},{})}function S(e){var t=this,n=function(n){Object.defineProperty(t,n,{get:function(){return"object"===m(e[n])?new S(e[n]):e[n]},set:function(t){e[n]!==t&&(e[n]=t,x(),v())},enumerable:!0})};for(var r in e)n(r)}function C(t){var n=t.blocks,r=t.store;return n.reduce(function(t,n){var a=!n.hasOwnProperty("show")||n.show(r.state)?e.blocks[n.type]({block:n,store:r}):null;return[].concat(o(t),[a])},[])}exports.blockTypes=O; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getValue=c,exports.countNextPages=s,exports.countPrevPages=l,exports.getCurrentStepInPercent=f,exports.getTotalNumberOfPages=p,exports.validateEmail=d,exports.validatePhone=h,exports.reRender=v,exports.routeChange=b,exports.checkPageValidation=x,exports.submitData=P,exports.typeOf=m,exports.classnames=y,exports.getVisibleBlocks=w,exports.getAllVisiblePages=j,exports.flattenBlocks=k,exports.getAllVisibleQuestions=V,exports.validateBlocks=E,exports.schemaToFlatState=Q,exports.schemaToFlatValidations=A,exports.ObservedObject=S,exports.renderBlocks=C,exports.blockTypes=exports.router=void 0;var e=require("./blocks.js");function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(o,!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(o).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}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 o(e){return i(e)||u(e)||a()}function a(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function u(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function i(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}function c(e,t){return"function"==typeof e?e(t):e}function s(e){var t=e.state,n=e.schema,r=e.page,o=e.count,a=void 0===o?0:o,u=r.nextPage?c(r.nextPage,t):null;if(u){var i=n.find(function(e){return e.path===u});return i?s({state:t,schema:n,page:i,count:a+1}):a}return a}function l(e){var t=e.state,n=e.schema,r=e.page,o=e.count,a=void 0===o?0:o,u=r.previousPage?c(r.previousPage,t):null;if(u){var i=n.find(function(e){return e.path===u});return i?l({state:t,schema:n,page:i,count:a+1}):a}return a}function f(e){var t=e.schema.find(function(t){return t.path===e.currentPage}),n=s({schema:e.schema,state:e.state,page:t,count:0}),r=l({schema:e.schema,state:e.state,page:t,count:0});return r/(n+r)*100}function p(e){var t=e.schema.find(function(t){return t.path===e.currentPage});return s({schema:e.schema,state:e.state,page:t,count:0})+l({schema:e.schema,state:e.state,page:t,count:0})+1}function d(e){return/^.+@.+\..+$/.test(e)}function h(e){return/^[\s\d+()-]{8,}$/.test(e)}var g={goTo:function(e){return window.history.pushState({},e,window.location.origin+e)},currentPath:function(){return window.location.pathname}};function v(){window.dispatchEvent(new CustomEvent("rerender"))}function b(e){window.dispatchEvent(new CustomEvent("routechange",{detail:e}))}function x(e){window.dispatchEvent(new CustomEvent("checkpagevalidation"))}function P(e){window.dispatchEvent(new CustomEvent("wizard-submit",{detail:Object.freeze(e)}))}function m(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function y(e){return Object.keys(e).filter(function(t){return e[t]}).reduce(function(e,t,n){return e.concat(n>0?" ".concat(t):"".concat(t))},"")}function w(e,t){return e.children?e.children.reduce(function(r,a){if(void 0===a.show||("function"===m(a.show)?a.show(t.state):a.show)){var u=a.children?w(a,t):[];return[].concat(o(r),[n({},a,{path:e.path})],o(u))}return r},[]):[]}exports.router=g;var O=function(e){return{checkbox:{isQuestion:!0,defaultValue:!1},textarea:{isQuestion:!0,defaultValue:null},range:{isQuestion:!0,defaultValue:null},radio:{isQuestion:!0,defaultValue:null},"radio-tabs":{isQuestion:!0,defaultValue:null},input:{isQuestion:!0,defaultValue:null},file:{isQuestion:!0,defaultValue:[]},"multi-checkbox":{isQuestion:!0,defaultValue:[]},autocomplete:e.multiple?{isQuestion:!0,defaultValue:[]}:{isQuestion:!0,defaultValue:null}}};function j(e){return e.schema.reduce(function(t,r,a){var u=0===a?r:e.schema.find(function(e){return e.path===t.nextPagePath}),i=u.nextPage?c(u.nextPage,e.state):null;return i?n({},t,{pages:[].concat(o(t.pages),[n({},u)]),nextPagePath:i}):t},{pages:[],nextPagePath:""}).pages.filter(function(e){return"page"===e.type})}function k(e){return e.reduce(function(e,t){var r=t.children?k(t.children):{};return[].concat(o(e),[n({},t)],o(r))},[])}function V(e){return e.schema.reduce(function(t,r,a){var u=0===a?r:e.schema.find(function(e){return e.path===t.nextPagePath}),i=u.nextPage?c(u.nextPage,e.state):null;return i?n({},t,{blocks:[].concat(o(t.blocks),o(w(u,e))),nextPagePath:i}):t},{blocks:[],nextPagePath:""}).blocks.filter(function(e){return O(e)[e.type]&&O(e)[e.type].isQuestion})}function E(e,t){return e.every(function(e){var n=!0,r="function"==typeof e.validate,o=void 0===t.state[e.id]||null===t.state[e.id]||""===t.state[e.id]||Array.isArray(t.state[e.id])&&t.state[e.id].length<1,a=!!e.required;return(r||a)&&(r?n="function"===m(e.validate)?e.validate(t.state[e.id]):e.validate:a&&(n=!o)),n})}function Q(e){return e.reduce(function(e,t){var o=t.children?Q(t.children):{},a=O(t)[t.type]&&O(t)[t.type].defaultValue;return n({},e,r({},t.id,a),o)},{})}function A(e){return e.reduce(function(e,t){var o=t.children?A(t.children):{};return n({},e,r({},t.id,void 0),o)},{})}function S(e){var t=this,n=function(n){Object.defineProperty(t,n,{get:function(){return"object"===m(e[n])?new S(e[n]):e[n]},set:function(t){e[n]!==t&&(e[n]=t,x(),v())},enumerable:!0})};for(var r in e)n(r)}function C(t){var n=t.blocks,r=t.store;return n.reduce(function(t,n){var a=!n.hasOwnProperty("show")||n.show(r.state)?e.blocks[n.type]({block:n,store:r}):null;return[].concat(o(t),[a])},[])}exports.blockTypes=O; | ||
},{"./blocks.js":"X1ux"}],"Focm":[function(require,module,exports) { | ||
@@ -29,0 +29,0 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=s;var e=require("lit-html"),t=require("./utils.js");function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(n,!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i={};function o(e){return e.reduce(function(e,t){return"page"===t.type?n({},e,a({},t.id,!1)):e},{})}function c(e){var r=e.schema,a=e.initialState,c=e.el,u=(e.useRouter,{el:c,schema:r,confirmedPages:o(r),validations:(0,t.schemaToFlatValidations)(r),currentPage:r[0].path,hadReachedSummary:!1,currentPageIsValidated:!1,state:n({},(0,t.schemaToFlatState)(r),{},a)});i=new t.ObservedObject(u)}function u(r){var n=r.useRouter;window.addEventListener("rerender",function(){var r=(0,t.renderBlocks)({blocks:i.schema,store:i});(0,e.render)(r,document.querySelector(i.el))}),window.addEventListener("routechange",function(e){i.currentPage=e.detail,n&&t.router.goTo(e.detail),(0,t.reRender)()}),window.addEventListener("checkpagevalidation",function(){var e=i.schema.find(function(e){return e.path===i.currentPage}),r=(0,t.getVisibleBlocks)(e,i),n=(0,t.validateBlocks)(r,i);i.currentPageIsValidated!==n&&(i.currentPageIsValidated=n)}),window.addEventListener("popstate",function(){(0,t.routeChange)(t.router.currentPath())},!1)}function s(e){var r=e.initialState,n=void 0===r?{}:r,a=e.schema,i=void 0===a?{}:a,o=e.el,s=void 0===o?"#app":o,d=e.useRouter,l=void 0!==d&&d;c({schema:i,initialState:n,el:s,useRouter:l}),u({useRouter:l}),(0,t.checkPageValidation)(),(0,t.reRender)()} |
{ | ||
"name": "aprila-wizard", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
173808
0