|
@ -1580,20 +1580,24 @@ function customLoadingConfig() { |
|
|
const _locale = locale(); |
|
|
const _locale = locale(); |
|
|
const info = _locale.info; |
|
|
const info = _locale.info; |
|
|
const config = { |
|
|
const config = { |
|
|
show: true, |
|
|
enable: true, |
|
|
image: 'image://css/loading.gif', |
|
|
image: 'image://css/loading.gif', |
|
|
text: info.loading, |
|
|
text: info.loading, |
|
|
customClass:'' |
|
|
viewBox: "32 32 64 64", // 只有为path时,才会使用
|
|
|
|
|
|
imageClass: '', |
|
|
|
|
|
textClass: '', |
|
|
|
|
|
customClass: '' |
|
|
} |
|
|
} |
|
|
if (JSON.stringify(luckysheetConfigsetting.loading) !== '{}') { |
|
|
if (JSON.stringify(luckysheetConfigsetting.loading) !== '{}') { |
|
|
Object.assign(config, luckysheetConfigsetting.loading); |
|
|
Object.assign(config, luckysheetConfigsetting.loading); |
|
|
} |
|
|
} |
|
|
luckysheetConfigsetting.loading = config; |
|
|
|
|
|
return config; |
|
|
return config; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const luckysheetloadingImage = function () { |
|
|
const luckysheetloadingImage = function (config) { |
|
|
const config = customLoadingConfig(); |
|
|
if(typeof config.image==="function"){ |
|
|
|
|
|
return config.image() |
|
|
|
|
|
} |
|
|
const regE = new RegExp("^(image|path)://"); |
|
|
const regE = new RegExp("^(image|path)://"); |
|
|
const regResult = regE.exec(config.image); |
|
|
const regResult = regE.exec(config.image); |
|
|
let imageHtml = ''; |
|
|
let imageHtml = ''; |
|
@ -1607,12 +1611,13 @@ const luckysheetloadingImage = function () { |
|
|
break; |
|
|
break; |
|
|
case "path": |
|
|
case "path": |
|
|
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); |
|
|
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); |
|
|
svg.setAttribute("class", "path-type") |
|
|
svg.setAttribute("class", "path-type"); |
|
|
svg.setAttribute("viewBox", "0 0 64 64") |
|
|
svg.setAttribute("viewBox", config.viewBox); |
|
|
const path = document.createElementNS("http://www.w3.org/2000/svg", "path"); |
|
|
const path = document.createElementNS("http://www.w3.org/2000/svg", "path"); |
|
|
path.setAttribute("d", imageStr); |
|
|
path.setAttribute("d", imageStr); |
|
|
|
|
|
path.setAttribute("fill", "currentColor"); |
|
|
svg.appendChild(path); |
|
|
svg.appendChild(path); |
|
|
imageHtml = svg.outerHTML |
|
|
imageHtml = svg.outerHTML; |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
default: |
|
|
break; |
|
|
break; |
|
@ -1621,24 +1626,56 @@ const luckysheetloadingImage = function () { |
|
|
return imageHtml; |
|
|
return imageHtml; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const luckysheetlodingHTML = function () { |
|
|
const luckysheetlodingHTML = function (target, coverConfig) { |
|
|
|
|
|
if (!target) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
const config = customLoadingConfig(); |
|
|
const config = customLoadingConfig(); |
|
|
if (typeof config.show === "boolean" && config.show === false) { |
|
|
if (coverConfig && JSON.stringify(coverConfig) !== "{}") { |
|
|
return ''; |
|
|
Object.assign(config, coverConfig); |
|
|
|
|
|
} |
|
|
|
|
|
if (typeof config.enable === "boolean" && config.enable === false) { |
|
|
|
|
|
return { |
|
|
|
|
|
el: '', |
|
|
|
|
|
show: show, |
|
|
|
|
|
close: close |
|
|
} |
|
|
} |
|
|
const imageHtml = luckysheetloadingImage() |
|
|
} |
|
|
const loadingHtml = `<div id="luckysheetloadingdata" class="luckysheet-loading ${config.customClass}">
|
|
|
const imageHtml = luckysheetloadingImage(config); |
|
|
<div class="luckysheet-loading-mask"> |
|
|
const id = "luckysheet-loading-" + uuid.v4(); |
|
|
|
|
|
const loadingHtml = ` |
|
|
<div class="luckysheet-loading-content"> |
|
|
<div class="luckysheet-loading-content"> |
|
|
<div class="luckysheet-loading-image"> |
|
|
<div class="${config.imageClass} luckysheet-loading-image"> |
|
|
${imageHtml} |
|
|
${imageHtml} |
|
|
</div> |
|
|
</div> |
|
|
<span class="luckysheet-loading-text">${config.text}</span> |
|
|
<div class="${config.textClass} luckysheet-loading-text"> |
|
|
</div> |
|
|
<span>${config.text}</span> |
|
|
</div> |
|
|
</div> |
|
|
</div>` |
|
|
</div>`; |
|
|
return loadingHtml; |
|
|
const loading = document.createElement("div"); |
|
|
|
|
|
loading.id = id; |
|
|
|
|
|
loading.className = "luckysheet-loading-mask " + config.customClass; |
|
|
|
|
|
$(loading).html(loadingHtml); |
|
|
|
|
|
$(target).append(loading); |
|
|
|
|
|
|
|
|
|
|
|
function show() { |
|
|
|
|
|
if(id){ |
|
|
|
|
|
$("#" + id).show(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function close() { |
|
|
|
|
|
if(id){ |
|
|
|
|
|
$("#" + id).hide(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return { |
|
|
|
|
|
el: loading, |
|
|
|
|
|
show: show, |
|
|
|
|
|
close: close |
|
|
|
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// var menusetting = {
|
|
|
// var menusetting = {
|
|
|
// menu_selectall: '<div id="luckysheet-selectall-btn-title"><i class="fa fa-i-cursor"></i> 全选</div>',
|
|
|
// menu_selectall: '<div id="luckysheet-selectall-btn-title"><i class="fa fa-i-cursor"></i> 全选</div>',
|
|
|
// menu_copy: '<div id="luckysheet-copy-btn-title"><i class="fa fa-copy"></i> 复制</div>',
|
|
|
// menu_copy: '<div id="luckysheet-copy-btn-title"><i class="fa fa-copy"></i> 复制</div>',
|
|
|