From bc860b4e178bbfe122b449176fab65a9c25dd0f7 Mon Sep 17 00:00:00 2001 From: Dipu Raj Date: Sat, 28 May 2022 22:30:02 +0530 Subject: [PATCH 1/7] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index e1de8e4..613c6af 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,6 +1,6 @@ # These are supported funding model platforms -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +github: techlab patreon: # Replace with a single Patreon username open_collective: techlab ko_fi: # Replace with a single Ko-fi username From 26cd7b60dc960bf36879ff14eb09cf8087e01e1b Mon Sep 17 00:00:00 2001 From: Dipu Raj Date: Sat, 2 Jul 2022 20:23:38 +0530 Subject: [PATCH 2/7] Docs updated for CommonJS/Webpack/Babel/ES6 usage --- README.md | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4c0d2ac..569dfc5 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,36 @@ Installation ``` +### Common JS/Webpack +```js +var $ = require( "jquery" ); +require( "smartwizard/dist/css/smart_wizard_all.css"); +const smartWizard = require("smartwizard"); + +$(function() { + $('#smartwizard').smartWizard(); +}); +``` +### ES6/Babel +```js +import $ from "jquery"; +import "smartwizard/dist/css/smart_wizard_all.css"; +import smartWizard from 'smartwizard'; + +$(function() { + $('#smartwizard').smartWizard(); +}); +``` + +#### Note: you may have to install the required dependencies +```bash +npm i jquery +npm i smartwizard + +// If you are using Webpack, install +npm i webpack webpack-cli style-loader css-loader --save-dev +``` + ### Download #### [Download from GitHub](https://github.com/techlab/jquery-smartwizard/archive/master.zip) @@ -169,14 +199,10 @@ Include SmartWizard plugin JavaScript ``` Initialize the SmartWizard -```html - ``` That's it! From 8f58f751dedf75e707d2237915ca69808b39e19d Mon Sep 17 00:00:00 2001 From: Dipu Raj Date: Sat, 2 Jul 2022 20:25:17 +0530 Subject: [PATCH 3/7] 6.0.2 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index f4cd536..aba8cf2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "smartwizard", - "version": "v6.0.1", + "version": "6.0.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "smartwizard", - "version": "v6.0.1", + "version": "6.0.2", "license": "MIT", "devDependencies": { "@babel/core": "^7.18.5", diff --git a/package.json b/package.json index 3e92fb8..96b5487 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "smartwizard", "title": "jQuery Smart Wizard", - "version": "v6.0.1", + "version": "6.0.2", "author": { "name": "Dipu Raj", "email": "hello.techlab@gmail.com", From e76b32b9d9d98b4d259ae607419dc523048d90ac Mon Sep 17 00:00:00 2001 From: Dipu Raj Date: Sat, 30 Jul 2022 18:15:05 +0530 Subject: [PATCH 4/7] Fixes and improvements --- CHANGELOG.md | 5 +++ dist/js/jquery.smartWizard.js | 56 +++++++++++++++++++------------ dist/js/jquery.smartWizard.min.js | 4 +-- package.json | 2 +- src/js/jquery.smartWizard.js | 56 +++++++++++++++++++------------ 5 files changed, 78 insertions(+), 45 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d98174..d49c1b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +v6.0.3 +----- +- **Fixed:** Navigation not properly maintained when navigate fast +- **Changed:** Code optimizations + v6.0.1 ----- - **Added:** Support for jQuery Slim version diff --git a/dist/js/jquery.smartWizard.js b/dist/js/jquery.smartWizard.js index 8c227e7..f0afdcd 100644 --- a/dist/js/jquery.smartWizard.js +++ b/dist/js/jquery.smartWizard.js @@ -9,7 +9,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } /*! -* jQuery SmartWizard v6.0.1 +* jQuery SmartWizard v6.0.3 * The awesome step wizard plugin for jQuery * http://www.techlaboratory.net/jquery-smartwizard * @@ -51,7 +51,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" = selected: 0, // Initial selected step, 0 = first step theme: 'basic', - // theme for the wizard, related css need to include for other than default theme + // Theme for the wizard, related css need to include for other than default theme justified: true, // Nav menu justification. true/false autoAdjustHeight: true, @@ -282,12 +282,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" = value: function _setElements() { var _this2 = this; - // Set the main element - this.main.addClass(this.options.style.mainCss); // Set theme option - + // Set theme option this.main.removeClass(function (i, className) { - return (className.match(/(^|\s)sw-theme-\S+/g) || []).join(' '); - }).addClass(this.options.style.themePrefixCss + this.options.theme); // Set justify option + return (className.match(new RegExp('(^|\\s)' + _this2.options.style.themePrefixCss + '\\S+', 'g')) || []).join(' '); + }).addClass(this.options.style.themePrefixCss + this.options.theme); // Set the main element + + this.main.addClass(this.options.style.mainCss).addClass(this.options.style.themePrefixCss + this.options.theme); // Set justify option this.main.toggleClass(this.options.style.justifiedCss, this.options.justified); // Set the anchor default style @@ -442,20 +442,20 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" = _this4._transit(selPage, curPage, stepDirection, function () { - // Update the current index - _this4.current_index = idx; // Fix height with content + // Fix height with content + _this4._fixHeight(idx); // Trigger "showStep" event - _this4._fixHeight(idx); // Set the buttons based on the step + _this4._triggerEvent("showStep", [selStep, idx, stepDirection, _this4._getStepPosition(idx)]); + }); // Update the current index - _this4._setButtons(idx); // Set the progressbar based on the step + _this4.current_index = idx; // Set the buttons based on the step - _this4._setProgressbar(idx); // Trigger "showStep" event + _this4._setButtons(idx); // Set the progressbar based on the step - _this4._triggerEvent("showStep", [selStep, idx, stepDirection, _this4._getStepPosition(idx)]); - }); + _this4._setProgressbar(idx); }); } }, { @@ -560,6 +560,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" = value: function _transit(elmToShow, elmToHide, stepDirection, callback) { var transitFn = $.fn.smartWizard.transitions[this.options.transition.animation]; + this._stopAnimations(); + if ($.isFunction(transitFn)) { transitFn(elmToShow, elmToHide, stepDirection, this, function (res) { if (res === false) { @@ -575,6 +577,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" = callback(); } } + }, { + key: "_stopAnimations", + value: function _stopAnimations() { + if ($.isFunction(this.container.finish)) { + this.pages.finish(); + this.container.finish(); + } + } }, { key: "_fixHeight", value: function _fixHeight(idx) { @@ -596,19 +606,23 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" = key: "_setAnchor", value: function _setAnchor(idx) { // Current step anchor > Remove other classes and add done class - this.steps.eq(this.current_index).removeClass(this.options.style.anchorActiveCss); + if (this.current_index !== null && this.current_index >= 0) { + var removeCss = this.options.style.anchorActiveCss; + var addCss = ''; - if (this.options.anchor.enableDoneState !== false && this.current_index !== null && this.current_index >= 0) { - this.steps.eq(this.current_index).addClass(this.options.style.anchorDoneCss); + if (this.options.anchor.enableDoneState !== false) { + addCss += this.options.style.anchorDoneCss; - if (this.options.anchor.unDoneOnBackNavigation !== false && this._getStepDirection(idx) === 'backward') { - this.steps.eq(this.current_index).removeClass(this.options.style.anchorDoneCss); + if (this.options.anchor.unDoneOnBackNavigation !== false && this._getStepDirection(idx) === 'backward') { + removeCss += ' ' + this.options.style.anchorDoneCss; + } } + + this.steps.eq(this.current_index).removeClass(removeCss).addClass(addCss); } // Next step anchor > Remove other classes and add active class - this.steps.eq(idx).removeClass(this.options.style.anchorDoneCss); - this.steps.eq(idx).addClass(this.options.style.anchorActiveCss); + this.steps.eq(idx).removeClass(this.options.style.anchorDoneCss).addClass(this.options.style.anchorActiveCss); } }, { key: "_setButtons", diff --git a/dist/js/jquery.smartWizard.min.js b/dist/js/jquery.smartWizard.min.js index 90a8c38..0d42c8b 100644 --- a/dist/js/jquery.smartWizard.min.js +++ b/dist/js/jquery.smartWizard.min.js @@ -1,6 +1,6 @@ "use strict";function _classCallCheck(t,s){if(!(t instanceof s))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,s){for(var e=0;e").addClass("sw-toolbar-elm "+this.options.style.toolbarCss+" "+this.options.style.toolbarPrefixCss+t).attr("role","toolbar"),e=!1!==this.options.toolbar.showNextButton?l("").text(this.options.lang.next).addClass("btn "+this.options.style.btnNextCss+" "+this.options.style.btnCss).attr("type","button"):null,n=!1!==this.options.toolbar.showPreviousButton?l("").text(this.options.lang.previous).addClass("btn "+this.options.style.btnPrevCss+" "+this.options.style.btnCss).attr("type","button"):null;return s.append(n,e,this.options.toolbar.extraHtml)}},{key:"_navigate",value:function(t){this._showStep(this._getShowable(this.current_index,t))}},{key:"_showStep",value:function(n){var i=this;if(-1===n||null===n)return!1;if(n==this.current_index)return!1;if(!this.steps.eq(n))return!1;if(!this._isEnabled(this.steps.eq(n)))return!1;var o=this._getStepDirection(n);if(-1!==this.current_index&&!1===this._triggerEvent("leaveStep",[this._getStepAnchor(this.current_index),this.current_index,n,o]))return!1;this._loadContent(n,function(){var t=i._getStepAnchor(n);i._setURLHash(t.attr("href")),i._setAnchor(n);var s=i._getStepPage(i.current_index),e=i._getStepPage(n);i._transit(e,s,o,function(){i.current_index=n,i._fixHeight(n),i._setButtons(n),i._setProgressbar(n),i._triggerEvent("showStep",[t,n,o,i._getStepPosition(n)])})})}},{key:"_getShowable",value:function(e,n){var i=this,o=null;return("prev"==n?l(this.steps.slice(0,e).get().reverse()):this.steps.slice(e+1)).each(function(t,s){if(i._isEnabled(l(s)))return o="prev"==n?e-(t+1):t+e+1,!1}),o}},{key:"_isShowable",value:function(t){if(!this._isEnabled(t))return!1;var s=t.hasClass(this.options.style.anchorDoneCss);return(!1!==this.options.anchor.enableDoneStateNavigation||!s)&&!(!1===this.options.anchor.enableNavigationAlways&&!s)}},{key:"_isEnabled",value:function(t){return!t.hasClass(this.options.style.anchorDisabledCss)&&!t.hasClass(this.options.style.anchorHiddenCss)}},{key:"_getStepDirection",value:function(t){return this.current_index").addClass("sw-toolbar-elm "+this.options.style.toolbarCss+" "+this.options.style.toolbarPrefixCss+t).attr("role","toolbar"),e=!1!==this.options.toolbar.showNextButton?l("").text(this.options.lang.next).addClass("btn "+this.options.style.btnNextCss+" "+this.options.style.btnCss).attr("type","button"):null,n=!1!==this.options.toolbar.showPreviousButton?l("").text(this.options.lang.previous).addClass("btn "+this.options.style.btnPrevCss+" "+this.options.style.btnCss).attr("type","button"):null;return s.append(n,e,this.options.toolbar.extraHtml)}},{key:"_navigate",value:function(t){this._showStep(this._getShowable(this.current_index,t))}},{key:"_showStep",value:function(n){var i=this;if(-1===n||null===n)return!1;if(n==this.current_index)return!1;if(!this.steps.eq(n))return!1;if(!this._isEnabled(this.steps.eq(n)))return!1;var o=this._getStepDirection(n);if(-1!==this.current_index&&!1===this._triggerEvent("leaveStep",[this._getStepAnchor(this.current_index),this.current_index,n,o]))return!1;this._loadContent(n,function(){var t=i._getStepAnchor(n);i._setURLHash(t.attr("href")),i._setAnchor(n);var s=i._getStepPage(i.current_index),e=i._getStepPage(n);i._transit(e,s,o,function(){i._fixHeight(n),i._triggerEvent("showStep",[t,n,o,i._getStepPosition(n)])}),i.current_index=n,i._setButtons(n),i._setProgressbar(n)})}},{key:"_getShowable",value:function(e,n){var i=this,o=null;return("prev"==n?l(this.steps.slice(0,e).get().reverse()):this.steps.slice(e+1)).each(function(t,s){if(i._isEnabled(l(s)))return o="prev"==n?e-(t+1):t+e+1,!1}),o}},{key:"_isShowable",value:function(t){if(!this._isEnabled(t))return!1;var s=t.hasClass(this.options.style.anchorDoneCss);return(!1!==this.options.anchor.enableDoneStateNavigation||!s)&&!(!1===this.options.anchor.enableNavigationAlways&&!s)}},{key:"_isEnabled",value:function(t){return!t.hasClass(this.options.style.anchorDisabledCss)&&!t.hasClass(this.options.style.anchorHiddenCss)}},{key:"_getStepDirection",value:function(t){return this.current_index { + return (className.match(new RegExp('(^|\\s)' + this.options.style.themePrefixCss + '\\S+','g')) || []).join(' '); }).addClass(this.options.style.themePrefixCss + this.options.theme); + // Set the main element + this.main.addClass(this.options.style.mainCss).addClass(this.options.style.themePrefixCss + this.options.theme); + // Set justify option this.main.toggleClass(this.options.style.justifiedCss, this.options.justified); @@ -377,17 +377,18 @@ const selPage = this._getStepPage(idx); // transit the step this._transit(selPage, curPage, stepDirection, () => { - // Update the current index - this.current_index = idx; // Fix height with content this._fixHeight(idx); - // Set the buttons based on the step - this._setButtons(idx); - // Set the progressbar based on the step - this._setProgressbar(idx); // Trigger "showStep" event this._triggerEvent("showStep", [selStep, idx, stepDirection, this._getStepPosition(idx)]); }); + + // Update the current index + this.current_index = idx; + // Set the buttons based on the step + this._setButtons(idx); + // Set the progressbar based on the step + this._setProgressbar(idx); }); } @@ -468,6 +469,7 @@ _transit(elmToShow, elmToHide, stepDirection, callback) { const transitFn = $.fn.smartWizard.transitions[this.options.transition.animation]; + this._stopAnimations(); if ($.isFunction(transitFn)) { transitFn(elmToShow, elmToHide, stepDirection, this, (res) => { if (res === false) { @@ -483,6 +485,13 @@ } } + _stopAnimations() { + if ($.isFunction(this.container.finish)) { + this.pages.finish(); + this.container.finish(); + } + } + _fixHeight(idx) { if (this.options.autoAdjustHeight === false) return; // Auto adjust height of the container @@ -496,17 +505,22 @@ _setAnchor(idx) { // Current step anchor > Remove other classes and add done class - this.steps.eq(this.current_index).removeClass(this.options.style.anchorActiveCss); - if (this.options.anchor.enableDoneState !== false && this.current_index !== null && this.current_index >= 0) { - this.steps.eq(this.current_index).addClass(this.options.style.anchorDoneCss); - if (this.options.anchor.unDoneOnBackNavigation !== false && this._getStepDirection(idx) === 'backward') { - this.steps.eq(this.current_index).removeClass(this.options.style.anchorDoneCss); + if (this.current_index !== null && this.current_index >= 0) { + let removeCss = this.options.style.anchorActiveCss; + let addCss = ''; + + if (this.options.anchor.enableDoneState !== false) { + addCss += this.options.style.anchorDoneCss; + if (this.options.anchor.unDoneOnBackNavigation !== false && this._getStepDirection(idx) === 'backward') { + removeCss += ' ' + this.options.style.anchorDoneCss; + } } + + this.steps.eq(this.current_index).removeClass(removeCss).addClass(addCss); } // Next step anchor > Remove other classes and add active class - this.steps.eq(idx).removeClass(this.options.style.anchorDoneCss); - this.steps.eq(idx).addClass(this.options.style.anchorActiveCss); + this.steps.eq(idx).removeClass(this.options.style.anchorDoneCss).addClass(this.options.style.anchorActiveCss); } _setButtons(idx) { @@ -811,7 +825,7 @@ elmToShow.css(initCss2); callback(); }); - }, + }, css: (elmToShow, elmToHide, stepDirection, wizardObj, callback) => { if (wizardObj.options.transition.fwdHideCss.length == 0 || wizardObj.options.transition.bckHideCss.length == 0 ) { callback(false); return; } From d8c7e08f664302bb8596d8b092d284dca091fbf0 Mon Sep 17 00:00:00 2001 From: Dipu Raj Date: Sat, 30 Jul 2022 18:32:45 +0530 Subject: [PATCH 5/7] Code improvements --- dist/js/jquery.smartWizard.js | 6 ++---- dist/js/jquery.smartWizard.min.js | 2 +- src/js/jquery.smartWizard.js | 7 ++----- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/dist/js/jquery.smartWizard.js b/dist/js/jquery.smartWizard.js index f0afdcd..f819410 100644 --- a/dist/js/jquery.smartWizard.js +++ b/dist/js/jquery.smartWizard.js @@ -282,12 +282,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" = value: function _setElements() { var _this2 = this; - // Set theme option + // Set the main element classes including theme css this.main.removeClass(function (i, className) { return (className.match(new RegExp('(^|\\s)' + _this2.options.style.themePrefixCss + '\\S+', 'g')) || []).join(' '); - }).addClass(this.options.style.themePrefixCss + this.options.theme); // Set the main element - - this.main.addClass(this.options.style.mainCss).addClass(this.options.style.themePrefixCss + this.options.theme); // Set justify option + }).addClass(this.options.style.mainCss + ' ' + this.options.style.themePrefixCss + this.options.theme); // Set justify option this.main.toggleClass(this.options.style.justifiedCss, this.options.justified); // Set the anchor default style diff --git a/dist/js/jquery.smartWizard.min.js b/dist/js/jquery.smartWizard.min.js index 0d42c8b..d762449 100644 --- a/dist/js/jquery.smartWizard.min.js +++ b/dist/js/jquery.smartWizard.min.js @@ -9,4 +9,4 @@ * Licensed under the terms of the MIT License * https://github.com/techlab/jquery-smartwizard/blob/master/LICENSE */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"===("undefined"==typeof module?"undefined":_typeof(module))&&module.exports?module.exports=function(t,s){return void 0===s&&(s="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(s),s}:e(jQuery)}(function(l){var i={selected:0,theme:"basic",justified:!0,autoAdjustHeight:!0,backButtonSupport:!0,enableUrlHash:!0,transition:{animation:"none",speed:"400",easing:"",prefixCss:"",fwdShowCss:"",fwdHideCss:"",bckShowCss:"",bckHideCss:""},toolbar:{position:"bottom",showNextButton:!0,showPreviousButton:!0,extraHtml:""},anchor:{enableNavigation:!0,enableNavigationAlways:!1,enableDoneState:!0,markPreviousStepsAsDone:!0,unDoneOnBackNavigation:!1,enableDoneStateNavigation:!0},keyboard:{keyNavigation:!0,keyLeft:[37],keyRight:[39]},lang:{next:"Next",previous:"Previous"},style:{mainCss:"sw",navCss:"nav",navLinkCss:"nav-link",contentCss:"tab-content",contentPanelCss:"tab-pane",themePrefixCss:"sw-theme-",anchorDefaultCss:"default",anchorDoneCss:"done",anchorActiveCss:"active",anchorDisabledCss:"disabled",anchorHiddenCss:"hidden",anchorErrorCss:"error",anchorWarningCss:"warning",justifiedCss:"sw-justified",btnCss:"sw-btn",btnNextCss:"sw-btn-next",btnPrevCss:"sw-btn-prev",loaderCss:"sw-loading",progressCss:"progress",progressBarCss:"progress-bar",toolbarCss:"toolbar",toolbarPrefixCss:"toolbar-"},disabledSteps:[],errorSteps:[],warningSteps:[],hiddenSteps:[],getContent:null},e=function(){function n(t,s){var e=this;_classCallCheck(this,n),this.options=l.extend(!0,{},i,s),this.main=l(t),this.nav=this._getFirstDescendant("."+this.options.style.navCss),this.container=this._getFirstDescendant("."+this.options.style.contentCss),this.steps=this.nav.find("."+this.options.style.navLinkCss),this.pages=this.container.children("."+this.options.style.contentPanelCss),this.progressbar=this.main.find("."+this.options.style.progressCss),this.dir=this._getDir(),this.current_index=-1,this.is_init=!1,this._init(),setTimeout(function(){e._load()},0)}return _createClass(n,[{key:"_init",value:function(){if(this._setElements(),this._setToolbar(),!0===this.is_init)return!0;this._setEvents(),this.is_init=!0,this._triggerEvent("initialized")}},{key:"_load",value:function(){this.pages.hide(),this.steps.removeClass([this.options.style.anchorDoneCss,this.options.style.anchorActiveCss]),this.current_index=-1;var t=(t=this._getURLHashIndex())||this.options.selected,s=this._getShowable(t-1,"forward");0<(t=null===s&&0").addClass("sw-toolbar-elm "+this.options.style.toolbarCss+" "+this.options.style.toolbarPrefixCss+t).attr("role","toolbar"),e=!1!==this.options.toolbar.showNextButton?l("").text(this.options.lang.next).addClass("btn "+this.options.style.btnNextCss+" "+this.options.style.btnCss).attr("type","button"):null,n=!1!==this.options.toolbar.showPreviousButton?l("").text(this.options.lang.previous).addClass("btn "+this.options.style.btnPrevCss+" "+this.options.style.btnCss).attr("type","button"):null;return s.append(n,e,this.options.toolbar.extraHtml)}},{key:"_navigate",value:function(t){this._showStep(this._getShowable(this.current_index,t))}},{key:"_showStep",value:function(n){var i=this;if(-1===n||null===n)return!1;if(n==this.current_index)return!1;if(!this.steps.eq(n))return!1;if(!this._isEnabled(this.steps.eq(n)))return!1;var o=this._getStepDirection(n);if(-1!==this.current_index&&!1===this._triggerEvent("leaveStep",[this._getStepAnchor(this.current_index),this.current_index,n,o]))return!1;this._loadContent(n,function(){var t=i._getStepAnchor(n);i._setURLHash(t.attr("href")),i._setAnchor(n);var s=i._getStepPage(i.current_index),e=i._getStepPage(n);i._transit(e,s,o,function(){i._fixHeight(n),i._triggerEvent("showStep",[t,n,o,i._getStepPosition(n)])}),i.current_index=n,i._setButtons(n),i._setProgressbar(n)})}},{key:"_getShowable",value:function(e,n){var i=this,o=null;return("prev"==n?l(this.steps.slice(0,e).get().reverse()):this.steps.slice(e+1)).each(function(t,s){if(i._isEnabled(l(s)))return o="prev"==n?e-(t+1):t+e+1,!1}),o}},{key:"_isShowable",value:function(t){if(!this._isEnabled(t))return!1;var s=t.hasClass(this.options.style.anchorDoneCss);return(!1!==this.options.anchor.enableDoneStateNavigation||!s)&&!(!1===this.options.anchor.enableNavigationAlways&&!s)}},{key:"_isEnabled",value:function(t){return!t.hasClass(this.options.style.anchorDisabledCss)&&!t.hasClass(this.options.style.anchorHiddenCss)}},{key:"_getStepDirection",value:function(t){return this.current_index").addClass("sw-toolbar-elm "+this.options.style.toolbarCss+" "+this.options.style.toolbarPrefixCss+t).attr("role","toolbar"),e=!1!==this.options.toolbar.showNextButton?l("").text(this.options.lang.next).addClass("btn "+this.options.style.btnNextCss+" "+this.options.style.btnCss).attr("type","button"):null,n=!1!==this.options.toolbar.showPreviousButton?l("").text(this.options.lang.previous).addClass("btn "+this.options.style.btnPrevCss+" "+this.options.style.btnCss).attr("type","button"):null;return s.append(n,e,this.options.toolbar.extraHtml)}},{key:"_navigate",value:function(t){this._showStep(this._getShowable(this.current_index,t))}},{key:"_showStep",value:function(n){var i=this;if(-1===n||null===n)return!1;if(n==this.current_index)return!1;if(!this.steps.eq(n))return!1;if(!this._isEnabled(this.steps.eq(n)))return!1;var o=this._getStepDirection(n);if(-1!==this.current_index&&!1===this._triggerEvent("leaveStep",[this._getStepAnchor(this.current_index),this.current_index,n,o]))return!1;this._loadContent(n,function(){var t=i._getStepAnchor(n);i._setURLHash(t.attr("href")),i._setAnchor(n);var s=i._getStepPage(i.current_index),e=i._getStepPage(n);i._transit(e,s,o,function(){i._fixHeight(n),i._triggerEvent("showStep",[t,n,o,i._getStepPosition(n)])}),i.current_index=n,i._setButtons(n),i._setProgressbar(n)})}},{key:"_getShowable",value:function(e,n){var i=this,o=null;return("prev"==n?l(this.steps.slice(0,e).get().reverse()):this.steps.slice(e+1)).each(function(t,s){if(i._isEnabled(l(s)))return o="prev"==n?e-(t+1):t+e+1,!1}),o}},{key:"_isShowable",value:function(t){if(!this._isEnabled(t))return!1;var s=t.hasClass(this.options.style.anchorDoneCss);return(!1!==this.options.anchor.enableDoneStateNavigation||!s)&&!(!1===this.options.anchor.enableNavigationAlways&&!s)}},{key:"_isEnabled",value:function(t){return!t.hasClass(this.options.style.anchorDisabledCss)&&!t.hasClass(this.options.style.anchorHiddenCss)}},{key:"_getStepDirection",value:function(t){return this.current_index { return (className.match(new RegExp('(^|\\s)' + this.options.style.themePrefixCss + '\\S+','g')) || []).join(' '); - }).addClass(this.options.style.themePrefixCss + this.options.theme); - - // Set the main element - this.main.addClass(this.options.style.mainCss).addClass(this.options.style.themePrefixCss + this.options.theme); + }).addClass(this.options.style.mainCss + ' ' + this.options.style.themePrefixCss + this.options.theme); // Set justify option this.main.toggleClass(this.options.style.justifiedCss, this.options.justified); From 095af76c1633859fd1623e609bfe518c46ad55d2 Mon Sep 17 00:00:00 2001 From: Dipu Raj Date: Sat, 30 Jul 2022 18:35:15 +0530 Subject: [PATCH 6/7] Code improvements --- CHANGELOG.md | 4 ++++ dist/js/jquery.smartWizard.js | 2 +- dist/js/jquery.smartWizard.min.js | 2 +- package.json | 2 +- src/js/jquery.smartWizard.js | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d49c1b3..5d70958 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ CHANGELOG ========= +v6.0.4 +----- +- **Changed:** Code optimizations + v6.0.3 ----- - **Fixed:** Navigation not properly maintained when navigate fast diff --git a/dist/js/jquery.smartWizard.js b/dist/js/jquery.smartWizard.js index f819410..226c787 100644 --- a/dist/js/jquery.smartWizard.js +++ b/dist/js/jquery.smartWizard.js @@ -9,7 +9,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } /*! -* jQuery SmartWizard v6.0.3 +* jQuery SmartWizard v6.0.4 * The awesome step wizard plugin for jQuery * http://www.techlaboratory.net/jquery-smartwizard * diff --git a/dist/js/jquery.smartWizard.min.js b/dist/js/jquery.smartWizard.min.js index d762449..32b67ac 100644 --- a/dist/js/jquery.smartWizard.min.js +++ b/dist/js/jquery.smartWizard.min.js @@ -1,6 +1,6 @@ "use strict";function _classCallCheck(t,s){if(!(t instanceof s))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,s){for(var e=0;e Date: Sun, 7 Aug 2022 13:34:45 +0530 Subject: [PATCH 7/7] Fix forunDoneOnBackNavigation not working #146 --- CHANGELOG.md | 5 +++++ dist/js/jquery.smartWizard.js | 4 ++-- dist/js/jquery.smartWizard.min.js | 4 ++-- package.json | 2 +- src/js/jquery.smartWizard.js | 4 ++-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d70958..4f44800 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= + +v6.0.5 +----- +- **Fixed:** unDoneOnBackNavigation not working https://github.com/techlab/jquery-smartwizard/issues/146 + v6.0.4 ----- - **Changed:** Code optimizations diff --git a/dist/js/jquery.smartWizard.js b/dist/js/jquery.smartWizard.js index 226c787..df0e293 100644 --- a/dist/js/jquery.smartWizard.js +++ b/dist/js/jquery.smartWizard.js @@ -9,7 +9,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } /*! -* jQuery SmartWizard v6.0.4 +* jQuery SmartWizard v6.0.5 * The awesome step wizard plugin for jQuery * http://www.techlaboratory.net/jquery-smartwizard * @@ -616,7 +616,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" = } } - this.steps.eq(this.current_index).removeClass(removeCss).addClass(addCss); + this.steps.eq(this.current_index).addClass(addCss).removeClass(removeCss); } // Next step anchor > Remove other classes and add active class diff --git a/dist/js/jquery.smartWizard.min.js b/dist/js/jquery.smartWizard.min.js index 32b67ac..30d5aa8 100644 --- a/dist/js/jquery.smartWizard.min.js +++ b/dist/js/jquery.smartWizard.min.js @@ -1,6 +1,6 @@ "use strict";function _classCallCheck(t,s){if(!(t instanceof s))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,s){for(var e=0;e").addClass("sw-toolbar-elm "+this.options.style.toolbarCss+" "+this.options.style.toolbarPrefixCss+t).attr("role","toolbar"),e=!1!==this.options.toolbar.showNextButton?l("").text(this.options.lang.next).addClass("btn "+this.options.style.btnNextCss+" "+this.options.style.btnCss).attr("type","button"):null,n=!1!==this.options.toolbar.showPreviousButton?l("").text(this.options.lang.previous).addClass("btn "+this.options.style.btnPrevCss+" "+this.options.style.btnCss).attr("type","button"):null;return s.append(n,e,this.options.toolbar.extraHtml)}},{key:"_navigate",value:function(t){this._showStep(this._getShowable(this.current_index,t))}},{key:"_showStep",value:function(n){var i=this;if(-1===n||null===n)return!1;if(n==this.current_index)return!1;if(!this.steps.eq(n))return!1;if(!this._isEnabled(this.steps.eq(n)))return!1;var o=this._getStepDirection(n);if(-1!==this.current_index&&!1===this._triggerEvent("leaveStep",[this._getStepAnchor(this.current_index),this.current_index,n,o]))return!1;this._loadContent(n,function(){var t=i._getStepAnchor(n);i._setURLHash(t.attr("href")),i._setAnchor(n);var s=i._getStepPage(i.current_index),e=i._getStepPage(n);i._transit(e,s,o,function(){i._fixHeight(n),i._triggerEvent("showStep",[t,n,o,i._getStepPosition(n)])}),i.current_index=n,i._setButtons(n),i._setProgressbar(n)})}},{key:"_getShowable",value:function(e,n){var i=this,o=null;return("prev"==n?l(this.steps.slice(0,e).get().reverse()):this.steps.slice(e+1)).each(function(t,s){if(i._isEnabled(l(s)))return o="prev"==n?e-(t+1):t+e+1,!1}),o}},{key:"_isShowable",value:function(t){if(!this._isEnabled(t))return!1;var s=t.hasClass(this.options.style.anchorDoneCss);return(!1!==this.options.anchor.enableDoneStateNavigation||!s)&&!(!1===this.options.anchor.enableNavigationAlways&&!s)}},{key:"_isEnabled",value:function(t){return!t.hasClass(this.options.style.anchorDisabledCss)&&!t.hasClass(this.options.style.anchorHiddenCss)}},{key:"_getStepDirection",value:function(t){return this.current_index").addClass("sw-toolbar-elm "+this.options.style.toolbarCss+" "+this.options.style.toolbarPrefixCss+t).attr("role","toolbar"),e=!1!==this.options.toolbar.showNextButton?l("").text(this.options.lang.next).addClass("btn "+this.options.style.btnNextCss+" "+this.options.style.btnCss).attr("type","button"):null,n=!1!==this.options.toolbar.showPreviousButton?l("").text(this.options.lang.previous).addClass("btn "+this.options.style.btnPrevCss+" "+this.options.style.btnCss).attr("type","button"):null;return s.append(n,e,this.options.toolbar.extraHtml)}},{key:"_navigate",value:function(t){this._showStep(this._getShowable(this.current_index,t))}},{key:"_showStep",value:function(n){var i=this;if(-1===n||null===n)return!1;if(n==this.current_index)return!1;if(!this.steps.eq(n))return!1;if(!this._isEnabled(this.steps.eq(n)))return!1;var o=this._getStepDirection(n);if(-1!==this.current_index&&!1===this._triggerEvent("leaveStep",[this._getStepAnchor(this.current_index),this.current_index,n,o]))return!1;this._loadContent(n,function(){var t=i._getStepAnchor(n);i._setURLHash(t.attr("href")),i._setAnchor(n);var s=i._getStepPage(i.current_index),e=i._getStepPage(n);i._transit(e,s,o,function(){i._fixHeight(n),i._triggerEvent("showStep",[t,n,o,i._getStepPosition(n)])}),i.current_index=n,i._setButtons(n),i._setProgressbar(n)})}},{key:"_getShowable",value:function(e,n){var i=this,o=null;return("prev"==n?l(this.steps.slice(0,e).get().reverse()):this.steps.slice(e+1)).each(function(t,s){if(i._isEnabled(l(s)))return o="prev"==n?e-(t+1):t+e+1,!1}),o}},{key:"_isShowable",value:function(t){if(!this._isEnabled(t))return!1;var s=t.hasClass(this.options.style.anchorDoneCss);return(!1!==this.options.anchor.enableDoneStateNavigation||!s)&&!(!1===this.options.anchor.enableNavigationAlways&&!s)}},{key:"_isEnabled",value:function(t){return!t.hasClass(this.options.style.anchorDisabledCss)&&!t.hasClass(this.options.style.anchorHiddenCss)}},{key:"_getStepDirection",value:function(t){return this.current_index Remove other classes and add active class