Browse Source

Implemented blockui & setBusy APIs natively

pull/1286/head
Halil İbrahim Kalkan 7 years ago
parent
commit
e93e6661fa
  1. 13
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Core/CoreStyleContributor.cs
  2. 16
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FreezeUi/FreezeUiScriptContributor.cs
  3. 16
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FreezeUi/FreezeUiStyleContributor.cs
  4. 12
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalScriptContributor.cs
  5. 6
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalStyleContributor.cs
  6. 46
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/freeze-ui/abp-freeze-ui.js
  7. 1
      npm/packs/aspnetcore.mvc.ui.theme.shared/package.json
  8. 2
      npm/packs/core/abp.resourcemapping.js
  9. 56
      npm/packs/core/src/abp.css
  10. 93
      npm/packs/core/src/abp.js
  11. 6
      npm/packs/freeze-ui/abp.resourcemapping.js
  12. 1
      npm/packs/freeze-ui/lib/freeze-ui.min.css
  13. 1
      npm/packs/freeze-ui/lib/freeze-ui.min.js
  14. 11
      npm/packs/freeze-ui/package.json

13
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");
}
}
}

16
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FreezeUi/FreezeUiScriptContributor.cs

@ -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");
}
}
}

16
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FreezeUi/FreezeUiStyleContributor.cs

@ -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");
}
}
}

12
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"
});
}
}

6
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
{

46
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/freeze-ui/abp-freeze-ui.js

@ -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);

1
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",

2
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/"
}
}

56
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;
}

93
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 *****************************************/

6
npm/packs/freeze-ui/abp.resourcemapping.js

@ -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/"
}
}

1
npm/packs/freeze-ui/lib/freeze-ui.min.css

@ -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}

1
npm/packs/freeze-ui/lib/freeze-ui.min.js

@ -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))}})();

11
npm/packs/freeze-ui/package.json

@ -1,11 +0,0 @@
{
"version": "0.6.2",
"name": "@abp/freeze-ui",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@abp/core": "^0.5.3"
},
"gitHead": "824de4c615c1d4d1d7f07d6ec1e8d0cb3a303c72"
}
Loading…
Cancel
Save