From e9af3639213768f2ff38ceff37994a5a1cf034f5 Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Wed, 12 Jun 2019 11:14:04 +0300 Subject: [PATCH] add freeze-ui package --- .../FreezeUi/FreezeUiScriptContributor.cs | 16 +++++++ .../FreezeUi/FreezeUiStyleContributor.cs | 16 +++++++ .../SharedThemeGlobalScriptContributor.cs | 7 ++- .../SharedThemeGlobalStyleContributor.cs | 4 +- .../freeze-ui/abp-freeze-ui.js | 46 +++++++++++++++++++ npm/packs/freeze-ui/abp.resourcemapping.js | 6 +++ npm/packs/freeze-ui/lib/freeze-ui.min.css | 1 + npm/packs/freeze-ui/lib/freeze-ui.min.js | 1 + npm/packs/freeze-ui/package.json | 11 +++++ 9 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FreezeUi/FreezeUiScriptContributor.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FreezeUi/FreezeUiStyleContributor.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/freeze-ui/abp-freeze-ui.js create mode 100644 npm/packs/freeze-ui/abp.resourcemapping.js create mode 100644 npm/packs/freeze-ui/lib/freeze-ui.min.css create mode 100644 npm/packs/freeze-ui/lib/freeze-ui.min.js create mode 100644 npm/packs/freeze-ui/package.json 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 new file mode 100644 index 0000000000..ffdd786250 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FreezeUi/FreezeUiScriptContributor.cs @@ -0,0 +1,16 @@ +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.css"); + } + } +} 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 new file mode 100644 index 0000000000..96f4996663 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FreezeUi/FreezeUiStyleContributor.cs @@ -0,0 +1,16 @@ +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 10354b37d0..8271c0e05a 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 @@ -3,6 +3,7 @@ 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; @@ -27,7 +28,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling typeof(DatatablesNetBs4ScriptContributor), typeof(SweetalertScriptContributor), typeof(ToastrScriptBundleContributor), - typeof(TimeagoScriptContributor))] + typeof(TimeagoScriptContributor), + typeof(FreezeUiScriptContributor))] public class SharedThemeGlobalScriptContributor : BundleContributor { public override void ConfigureBundle(BundleConfigurationContext context) @@ -40,7 +42,8 @@ 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/toastr/abp-toastr.js", + "/libs/abp/aspnetcore-mvc-ui-theme-shared/freeze-ui/abp-freeze-ui.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 3402b92e99..7fb8181373 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 @@ -2,6 +2,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Packages.Bootstrap; 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; @@ -13,7 +14,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling typeof(FontAwesomeStyleContributor), typeof(ToastrStyleBundleContributor), typeof(Select2StyleContributor), - typeof(DatatablesNetBs4StyleContributor) + typeof(DatatablesNetBs4StyleContributor), + typeof(FreezeUiStyleContributor) )] 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 new file mode 100644 index 0000000000..309765a482 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/freeze-ui/abp-freeze-ui.js @@ -0,0 +1,46 @@ +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/freeze-ui/abp.resourcemapping.js b/npm/packs/freeze-ui/abp.resourcemapping.js new file mode 100644 index 0000000000..b027f07c88 --- /dev/null +++ b/npm/packs/freeze-ui/abp.resourcemapping.js @@ -0,0 +1,6 @@ +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 new file mode 100644 index 0000000000..0f85b42513 --- /dev/null +++ b/npm/packs/freeze-ui/lib/freeze-ui.min.css @@ -0,0 +1 @@ +@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 new file mode 100644 index 0000000000..991416917c --- /dev/null +++ b/npm/packs/freeze-ui/lib/freeze-ui.min.js @@ -0,0 +1 @@ +(()=>{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 new file mode 100644 index 0000000000..0a150676c1 --- /dev/null +++ b/npm/packs/freeze-ui/package.json @@ -0,0 +1,11 @@ +{ + "version": "0.5.3", + "name": "@abp/freeze-ui", + "publishConfig": { + "access": "public" + }, + "dependencies": { + "@abp/core": "^0.5.3" + }, + "gitHead": "824de4c615c1d4d1d7f07d6ec1e8d0cb3a303c72" +}