diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Core/CoreStyleContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Core/CoreStyleContributor.cs new file mode 100644 index 0000000000..94f2e81694 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Core/CoreStyleContributor.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using Volo.Abp.AspNetCore.Mvc.UI.Bundling; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.Core +{ + public class CoreStyleContributor : BundleContributor + { + public override void ConfigureBundle(BundleConfigurationContext context) + { + context.Files.AddIfNotContains("/libs/abp/core/abp.css"); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FreezeUi/FreezeUiScriptContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FreezeUi/FreezeUiScriptContributor.cs deleted file mode 100644 index 2c8095290b..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FreezeUi/FreezeUiScriptContributor.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections.Generic; -using Volo.Abp.AspNetCore.Mvc.UI.Bundling; -using Volo.Abp.AspNetCore.Mvc.UI.Packages.Core; -using Volo.Abp.Modularity; - -namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.FreezeUi -{ - [DependsOn(typeof(CoreScriptContributor))] - public class FreezeUiScriptContributor : BundleContributor - { - public override void ConfigureBundle(BundleConfigurationContext context) - { - context.Files.AddIfNotContains("/libs/freeze-ui/freeze-ui.min.js"); - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FreezeUi/FreezeUiStyleContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FreezeUi/FreezeUiStyleContributor.cs deleted file mode 100644 index 96f4996663..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FreezeUi/FreezeUiStyleContributor.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections.Generic; -using Volo.Abp.AspNetCore.Mvc.UI.Bundling; -using Volo.Abp.AspNetCore.Mvc.UI.Packages.Bootstrap; -using Volo.Abp.Modularity; - -namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.FreezeUi -{ - [DependsOn(typeof(BootstrapStyleContributor))] - public class FreezeUiStyleContributor : BundleContributor - { - public override void ConfigureBundle(BundleConfigurationContext context) - { - context.Files.AddIfNotContains("/libs/freeze-ui/freeze-ui.min.css"); - } - } -} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalScriptContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalScriptContributor.cs index 8271c0e05a..81870fe1d7 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalScriptContributor.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalScriptContributor.cs @@ -1,15 +1,10 @@ using Volo.Abp.AspNetCore.Mvc.UI.Bundling; -using Volo.Abp.AspNetCore.Mvc.UI.Packages.Anchor; using Volo.Abp.AspNetCore.Mvc.UI.Packages.Bootstrap; -using Volo.Abp.AspNetCore.Mvc.UI.Packages.Clipboard; using Volo.Abp.AspNetCore.Mvc.UI.Packages.DatatablesNetBs4; -using Volo.Abp.AspNetCore.Mvc.UI.Packages.FreezeUi; using Volo.Abp.AspNetCore.Mvc.UI.Packages.JQuery; using Volo.Abp.AspNetCore.Mvc.UI.Packages.JQueryForm; using Volo.Abp.AspNetCore.Mvc.UI.Packages.JQueryValidationUnobtrusive; using Volo.Abp.AspNetCore.Mvc.UI.Packages.Lodash; -using Volo.Abp.AspNetCore.Mvc.UI.Packages.MalihuCustomScrollbar; -using Volo.Abp.AspNetCore.Mvc.UI.Packages.Popper; using Volo.Abp.AspNetCore.Mvc.UI.Packages.Select2; using Volo.Abp.AspNetCore.Mvc.UI.Packages.SweetAlert; using Volo.Abp.AspNetCore.Mvc.UI.Packages.Timeago; @@ -28,8 +23,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling typeof(DatatablesNetBs4ScriptContributor), typeof(SweetalertScriptContributor), typeof(ToastrScriptBundleContributor), - typeof(TimeagoScriptContributor), - typeof(FreezeUiScriptContributor))] + typeof(TimeagoScriptContributor) + )] public class SharedThemeGlobalScriptContributor : BundleContributor { public override void ConfigureBundle(BundleConfigurationContext context) @@ -42,8 +37,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling "/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js", "/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js", "/libs/abp/aspnetcore-mvc-ui-theme-shared/sweetalert/abp-sweetalert.js", - "/libs/abp/aspnetcore-mvc-ui-theme-shared/toastr/abp-toastr.js", - "/libs/abp/aspnetcore-mvc-ui-theme-shared/freeze-ui/abp-freeze-ui.js" + "/libs/abp/aspnetcore-mvc-ui-theme-shared/toastr/abp-toastr.js" }); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalStyleContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalStyleContributor.cs index 7fb8181373..779231802d 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalStyleContributor.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalStyleContributor.cs @@ -1,8 +1,8 @@ using Volo.Abp.AspNetCore.Mvc.UI.Bundling; using Volo.Abp.AspNetCore.Mvc.UI.Packages.Bootstrap; +using Volo.Abp.AspNetCore.Mvc.UI.Packages.Core; using Volo.Abp.AspNetCore.Mvc.UI.Packages.DatatablesNetBs4; using Volo.Abp.AspNetCore.Mvc.UI.Packages.FontAwesome; -using Volo.Abp.AspNetCore.Mvc.UI.Packages.FreezeUi; using Volo.Abp.AspNetCore.Mvc.UI.Packages.Select2; using Volo.Abp.AspNetCore.Mvc.UI.Packages.Toastr; using Volo.Abp.Modularity; @@ -10,12 +10,12 @@ using Volo.Abp.Modularity; namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling { [DependsOn( + typeof(CoreStyleContributor), typeof(BootstrapStyleContributor), typeof(FontAwesomeStyleContributor), typeof(ToastrStyleBundleContributor), typeof(Select2StyleContributor), - typeof(DatatablesNetBs4StyleContributor), - typeof(FreezeUiStyleContributor) + typeof(DatatablesNetBs4StyleContributor) )] public class SharedThemeGlobalStyleContributor : BundleContributor { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/freeze-ui/abp-freeze-ui.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/freeze-ui/abp-freeze-ui.js deleted file mode 100644 index 309765a482..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/freeze-ui/abp-freeze-ui.js +++ /dev/null @@ -1,46 +0,0 @@ -var abp = abp || {}; -(function ($) { - if (!window.FreezeUI || !$) { - return; - } - - /* MESSAGE **************************************************/ - /*Package from https://alexradulescu.github.io/freeze-ui/*/ - - abp.ui = abp.ui || {}; - - /* UI BLOCK */ - - abp.ui.block = function (elm) { - if (elm) { - window.FreezeUI({ selector: elm }); - } else { - window.FreezeUI(); - } - }; - - abp.ui.unblock = function () { - window.UnFreezeUI(); - }; - - /* UI BUSY */ - - abp.ui.setBusy = function (element, text, freezeDelay) { - var opt = { text : text ? text : ' ' }; - - if (element) { - opt.element = element; - } - - if (freezeDelay) { - opt.freezeDelay = freezeDelay; - } - - window.FreezeUI(opt); - }; - - abp.ui.clearBusy = function () { - window.UnFreezeUI(); - }; - -})(jQuery); \ No newline at end of file diff --git a/npm/packs/aspnetcore.mvc.ui.theme.shared/package.json b/npm/packs/aspnetcore.mvc.ui.theme.shared/package.json index 0a41fedae2..d4ce036ea8 100644 --- a/npm/packs/aspnetcore.mvc.ui.theme.shared/package.json +++ b/npm/packs/aspnetcore.mvc.ui.theme.shared/package.json @@ -9,7 +9,6 @@ "@abp/bootstrap": "^0.6.2", "@abp/datatables.net-bs4": "^0.6.2", "@abp/font-awesome": "^0.6.2", - "@abp/freeze-ui": "^0.6.2", "@abp/jquery-form": "^0.6.2", "@abp/jquery-validation-unobtrusive": "^0.6.2", "@abp/lodash": "^0.6.2", diff --git a/npm/packs/core/abp.resourcemapping.js b/npm/packs/core/abp.resourcemapping.js index 4b7dc7e532..d531399b68 100644 --- a/npm/packs/core/abp.resourcemapping.js +++ b/npm/packs/core/abp.resourcemapping.js @@ -1,5 +1,5 @@ module.exports = { mappings: { - "@node_modules/@abp/core/src/abp.js": "@libs/abp/core/" + "@node_modules/@abp/core/src/*": "@libs/abp/core/" } } \ No newline at end of file diff --git a/npm/packs/core/src/abp.css b/npm/packs/core/src/abp.css new file mode 100644 index 0000000000..1d3af876c7 --- /dev/null +++ b/npm/packs/core/src/abp.css @@ -0,0 +1,56 @@ +@keyframes spin { + 0% { + transform: translateZ(0) rotate(0deg); + } + + 100% { + transform: translateZ(0) rotate(360deg); + } +} + +.abp-block-area { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 999999999; + background-color: #fff; + opacity: .8; + transition: opacity .25s; +} + + .abp-block-area.abp-block-area-disappearing { + opacity: 0; + } + + .abp-block-area.abp-block-area-busy:after { + content: attr(data-text); + display: block; + max-width: 125px; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + font-size: 20px; + font-family: sans-serif; + color: #343a40; + text-align: center; + text-transform: uppercase; + } + + .abp-block-area.abp-block-area-busy:before { + content: ""; + display: block; + width: 150px; + height: 150px; + border-radius: 50%; + border-width: 2px; + border-style: solid; + border-color: transparent #228ae6 #228ae6 #228ae6; + position: absolute; + top: calc(50% - 75px); + left: calc(50% - 75px); + will-change: transform; + animation: spin .75s infinite ease-in-out; + } diff --git a/npm/packs/core/src/abp.js b/npm/packs/core/src/abp.js index 7e44e6256e..730db8bc97 100644 --- a/npm/packs/core/src/abp.js +++ b/npm/packs/core/src/abp.js @@ -166,7 +166,7 @@ var abp = abp || {}; abp.setting = abp.setting || {}; abp.setting.values = abp.setting.values || {}; - + abp.setting.get = function (name) { return abp.setting.values[name]; }; @@ -179,7 +179,7 @@ var abp = abp || {}; abp.setting.getInt = function (name) { return parseInt(abp.setting.values[name]); }; - + /* NOTIFICATION *********************************************/ //Defines Notification API, not implements it @@ -246,25 +246,96 @@ var abp = abp || {}; abp.ui = abp.ui || {}; /* UI BLOCK */ - //Defines UI Block API, not implements it + //Defines UI Block API and implements basically + + var $abpBlockArea = document.createElement('div'); + $abpBlockArea.classList.add('abp-block-area'); + + /* opts: { //Can be an object with options or a string for query a selector + * elm: a query selector (optional - default: document.body) + * busy: boolean (optional - default: false) + * promise: A promise with always or finally handler (optional - auto unblocks the ui if provided) + * } + */ + abp.ui.block = function (opts) { + if (!opts) { + opts = {}; + } else if (typeof opts == 'string') { + opts = { + elm: opts + }; + } + + var $elm = document.querySelector(opts.elm) || document.body; + + if (opts.busy) { + $abpBlockArea.classList.add('abp-block-area-busy'); + } else { + $abpBlockArea.classList.remove('abp-block-area-busy'); + } - abp.ui.block = function (elm) { - abp.log.warn('abp.ui.block is not implemented!'); + if (document.querySelector(opts.elm)) { + $abpBlockArea.style.position = 'absolute'; + } else { + $abpBlockArea.style.position = 'fixed'; + } + + $elm.appendChild($abpBlockArea); + + if (opts.promise) { + if (opts.promise.always) { //jQuery.Deferred style + opts.promise.always(function () { + abp.ui.unblock({ + $elm: opts.elm + }); + }); + } else if (opts.promise['finally']) { //Q style + opts.promise['finally'](function () { + abp.ui.unblock({ + $elm: opts.elm + }); + }); + } + } }; - abp.ui.unblock = function (elm) { - abp.log.warn('abp.ui.unblock is not implemented!'); + /* opts: { + * + * } + */ + abp.ui.unblock = function (opts) { + var element = document.querySelector('.abp-block-area'); + if (element) { + element.classList.add('abp-block-area-disappearing'); + setTimeout(function () { + if (element) { + element.classList.remove('abp-block-area-disappearing'); + element.parentElement.removeChild(element); + } + }, 250); + } }; /* UI BUSY */ //Defines UI Busy API, not implements it - abp.ui.setBusy = function (elm, optionsOrPromise) { - abp.log.warn('abp.ui.setBusy is not implemented!'); + abp.ui.setBusy = function (opts) { + if (!opts) { + opts = { + busy: true + }; + } else if (typeof opts == 'string') { + opts = { + elm: opts, + busy: true + }; + } + + abp.ui.block(opts); }; - abp.ui.clearBusy = function (elm) { - abp.log.warn('abp.ui.clearBusy is not implemented!'); + abp.ui.clearBusy = function (opts) { + abp.ui.unblock(opts); }; /* SIMPLE EVENT BUS *****************************************/ diff --git a/npm/packs/freeze-ui/abp.resourcemapping.js b/npm/packs/freeze-ui/abp.resourcemapping.js deleted file mode 100644 index b027f07c88..0000000000 --- a/npm/packs/freeze-ui/abp.resourcemapping.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - mappings: { - "@node_modules/@abp/freeze-ui/lib/freeze-ui.min.js": "@libs/freeze-ui/", - "@node_modules/@abp/freeze-ui/lib/freeze-ui.min.css": "@libs/freeze-ui/" - } -} \ No newline at end of file diff --git a/npm/packs/freeze-ui/lib/freeze-ui.min.css b/npm/packs/freeze-ui/lib/freeze-ui.min.css deleted file mode 100644 index 0f85b42513..0000000000 --- a/npm/packs/freeze-ui/lib/freeze-ui.min.css +++ /dev/null @@ -1 +0,0 @@ -@keyframes spin{0%{transform:translateZ(0) rotate(0)}100%{transform:translateZ(0) rotate(360deg)}}.freeze-ui{position:fixed;top:0;left:0;width:100%;height:100%;z-index:999999999;background-color:#fff;opacity:.8;transition:opacity .25s}.freeze-ui.is-unfreezing{opacity:0}.freeze-ui:after{content:attr(data-text);display:block;max-width:125px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:20px;font-family:sans-serif;color:#343a40;text-align:center;text-transform:uppercase}.freeze-ui:before{content:"";display:block;width:150px;height:150px;border-radius:50%;border-width:2px;border-style:solid;border-color:transparent #228ae6 #228ae6;position:absolute;top:calc(50% - 75px);left:calc(50% - 75px);will-change:transform;animation:spin .75s infinite ease-in-out} \ No newline at end of file diff --git a/npm/packs/freeze-ui/lib/freeze-ui.min.js b/npm/packs/freeze-ui/lib/freeze-ui.min.js deleted file mode 100644 index 991416917c..0000000000 --- a/npm/packs/freeze-ui/lib/freeze-ui.min.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{let a=document.createElement('div');a.classList.add('freeze-ui'),window.FreezeUI=(b={})=>{let c=document.querySelector(b.selector)||document.body;a.setAttribute('data-text',b.text||'Loading'),document.querySelector(b.selector)&&(a.style.position='absolute'),c.appendChild(a)},window.UnFreezeUI=()=>{let b=document.querySelector('.freeze-ui');b&&(b.classList.add('is-unfreezing'),setTimeout(()=>{b&&(b.classList.remove('is-unfreezing'),b.parentElement.removeChild(b))},250))}})(); \ No newline at end of file diff --git a/npm/packs/freeze-ui/package.json b/npm/packs/freeze-ui/package.json deleted file mode 100644 index ec9b01090e..0000000000 --- a/npm/packs/freeze-ui/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "0.6.2", - "name": "@abp/freeze-ui", - "publishConfig": { - "access": "public" - }, - "dependencies": { - "@abp/core": "^0.5.3" - }, - "gitHead": "824de4c615c1d4d1d7f07d6ec1e8d0cb3a303c72" -}