mirror of
https://bitbucket.org/bellord13/kit.git
synced 2026-11-13 19:06:11 +03:00
fix
This commit is contained in:
@@ -57,11 +57,22 @@
|
|||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.toast-container--default {
|
.toast-container--default {
|
||||||
z-index: 10000;
|
z-index: 10000;
|
||||||
position: fixed!important;
|
position: fixed!important;
|
||||||
bottom: 0!important;
|
bottom: 0!important;
|
||||||
right: 0!important;
|
right: 0!important;
|
||||||
padding: 1rem !important;
|
padding: 1rem !important;
|
||||||
|
}
|
||||||
|
.toast--error .toast-icon svg {
|
||||||
|
fill: var(--kit-color-error, red);
|
||||||
|
}
|
||||||
|
.toast--warning .toast-icon svg {
|
||||||
|
fill: var(--kit-color-warning, orange);
|
||||||
|
}
|
||||||
|
.toast--info .toast-icon svg {
|
||||||
|
fill: var(--kit-color-primary, dodgerblue);
|
||||||
|
}
|
||||||
|
.toast--success .toast-icon svg {
|
||||||
|
fill: var(--kit-color-success, green);
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@ __PluginManager__.register('bsToastService', function(require, exports, module,
|
|||||||
delay: 4000,
|
delay: 4000,
|
||||||
};
|
};
|
||||||
this.closeTemplate = '<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Закрыть"/>';
|
this.closeTemplate = '<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Закрыть"/>';
|
||||||
this.iconTemplate = '<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" preserveAspectRatio="xMidYMid slice" focusable="false"><rect width="100%" height="100%" fill="#007aff"/></svg>';
|
this.iconTemplate = '<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" preserveAspectRatio="xMidYMid slice" focusable="false"><rect width="100%" height="100%"/></svg>';
|
||||||
/**
|
/**
|
||||||
* @type {HTMLElement}
|
* @type {HTMLElement}
|
||||||
*/
|
*/
|
||||||
@@ -43,14 +43,30 @@ __PluginManager__.register('bsToastService', function(require, exports, module,
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Service.prototype.getToastNode = function (title, message, desc = '') {
|
Service.prototype.getToastNode = function (title, message, desc = '', htmlClass = '') {
|
||||||
var closeTemplate = this.close?this.closeTemplate:'';
|
var closeTemplate = this.close?this.closeTemplate:'';
|
||||||
var toastTemplate = '<div class="toast fade hide" role="alert" aria-live="assertive" aria-atomic="true"><div class="toast-header"><div class="kit-icon toast-icon">'+this.iconTemplate+'</div><strong class="toast-title">'+title+'</strong><small class="toast-desc">' + desc+ '</small>'+closeTemplate+'</div><div class="toast-body">'+message+'</div></div>';
|
var toastTemplate = '<div class="toast fade hide ' + htmlClass + '" role="alert" aria-live="assertive" aria-atomic="true"><div class="toast-header"><div class="kit-icon toast-icon">'+this.iconTemplate+'</div><strong class="toast-title">'+title+'</strong><small class="toast-desc">' + desc+ '</small>'+closeTemplate+'</div><div class="toast-body">'+message+'</div></div>';
|
||||||
return support.makeNode(toastTemplate);
|
return support.makeNode(toastTemplate);
|
||||||
};
|
};
|
||||||
|
|
||||||
Service.prototype.info = function (title, message, desc = '') {
|
Service.prototype.info = function (title, message, desc = '') {
|
||||||
var toastNode = this.getToastNode(title, message, desc);
|
this.__show(title, message, desc, 'toast--info');
|
||||||
|
};
|
||||||
|
|
||||||
|
Service.prototype.success = function (title, message, desc = '') {
|
||||||
|
this.__show(title, message, desc, 'toast--success');
|
||||||
|
};
|
||||||
|
|
||||||
|
Service.prototype.warning = function (title, message, desc = '') {
|
||||||
|
this.__show(title, message, desc, 'toast--warning');
|
||||||
|
};
|
||||||
|
|
||||||
|
Service.prototype.error = function (title, message, desc = '') {
|
||||||
|
this.__show(title, message, desc, 'toast--error');
|
||||||
|
};
|
||||||
|
|
||||||
|
Service.prototype.__show = function (title, message, desc = '', htmlClass = '') {
|
||||||
|
var toastNode = this.getToastNode(title, message, desc, htmlClass);
|
||||||
var toast = new bsToast(toastNode, this.option);
|
var toast = new bsToast(toastNode, this.option);
|
||||||
toast.data = {
|
toast.data = {
|
||||||
title: title,
|
title: title,
|
||||||
|
|||||||
+1
-1
@@ -561,7 +561,7 @@ kit.config = kit.config || {};
|
|||||||
script.onerror = function() {
|
script.onerror = function() {
|
||||||
var error = new Error(`Ошибка загрузки скрипта ${src}`);
|
var error = new Error(`Ошибка загрузки скрипта ${src}`);
|
||||||
self.errors.push(error);
|
self.errors.push(error);
|
||||||
console.log(`%cPlugin.load(${self.id}): error load script!`, "color: red;");
|
console.log(`%cPlugin.load(${self.id}): error load script ${src}!`, "color: red;");
|
||||||
reject(error);
|
reject(error);
|
||||||
};
|
};
|
||||||
document.head.append(script);
|
document.head.append(script);
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -377,10 +377,10 @@ __PluginManager__.register('support', function(require, exports, module, global)
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function args2array(arguments) {
|
function args2array(_args) {
|
||||||
var args = [];
|
var args = [];
|
||||||
for (var i = 0; i < arguments.length; i++) {
|
for (var i = 0; i < _args.length; i++) {
|
||||||
args.push(arguments[i]);
|
args.push(_args[i]);
|
||||||
}
|
}
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
@@ -477,13 +477,25 @@ __PluginManager__.register('support', function(require, exports, module, global)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function arrayToObject(ar){
|
||||||
|
return Object.assign({}, ar);
|
||||||
|
}
|
||||||
|
|
||||||
function namespace(namespace, parent = window){
|
function namespace(namespace, parent = window){
|
||||||
var parts=namespace.split(".");
|
if(isArray(namespace)){
|
||||||
for(var i=0;i<parts.length;i++){
|
var parts=namespace;
|
||||||
if(typeof parent[parts[i]]==="undefined"){parent[parts[i]]={};}
|
} else {
|
||||||
parent=parent[parts[i]];
|
var parts=namespace.split(".");
|
||||||
}
|
}
|
||||||
return parent;
|
var cursor = parent;
|
||||||
|
for(var i=0;i<parts.length;i++){
|
||||||
|
if(typeof cursor[parts[i]]==="undefined"){cursor[parts[i]]={};}
|
||||||
|
if(Array.isArray(cursor[parts[i]])){
|
||||||
|
cursor[parts[i]] = arrayToObject(cursor[parts[i]]);
|
||||||
|
}
|
||||||
|
cursor=cursor[parts[i]];
|
||||||
|
}
|
||||||
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user