|
@@ -904,23 +904,25 @@ export function createToolbarHtml() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var eventscount = 0;
|
|
var eventscount = 0;
|
|
|
|
+ var kcount = 0; // 两个分割线之间显示的按钮数
|
|
for (let i = 0; i < defaultToolbar.length; i++) {
|
|
for (let i = 0; i < defaultToolbar.length; i++) {
|
|
let key = defaultToolbar[i];
|
|
let key = defaultToolbar[i];
|
|
- if (!config[key] && key !== '|') {
|
|
|
|
- // 如果当前元素隐藏 按照之前的规则 后面紧跟的 | 分割也不需要显示了
|
|
|
|
- if (defaultToolbar[i + 1] === '|') {
|
|
|
|
- i++;
|
|
|
|
- }
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- if (key === '|' && i>0) {
|
|
|
|
|
|
+ // if (!config[key] && key !== '|') {
|
|
|
|
+ // // 如果当前元素隐藏 按照之前的规则 后面紧跟的 | 分割也不需要显示了
|
|
|
|
+ // if (defaultToolbar[i + 1] === '|') {
|
|
|
|
+ // i++;
|
|
|
|
+ // }
|
|
|
|
+ // continue;
|
|
|
|
+ // }
|
|
|
|
+ if (kcount >0 && key === '|' && i>0) {
|
|
const nameKeys = defaultToolbar[i - 1]
|
|
const nameKeys = defaultToolbar[i - 1]
|
|
if(nameKeys !== '|') {
|
|
if(nameKeys !== '|') {
|
|
buttonHTML.push(
|
|
buttonHTML.push(
|
|
`<div id="toolbar-separator-${camel2split(nameKeys)}" class="luckysheet-toolbar-separator luckysheet-inline-block" style="user-select: none;"></div>`
|
|
`<div id="toolbar-separator-${camel2split(nameKeys)}" class="luckysheet-toolbar-separator luckysheet-inline-block" style="user-select: none;"></div>`
|
|
);
|
|
);
|
|
|
|
+ kcount = 0;
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
|
|
+ } else if (config[key]) {
|
|
if(typeof(config[key]) === "object") {
|
|
if(typeof(config[key]) === "object") {
|
|
var events = "";
|
|
var events = "";
|
|
for(var eventname in config[key].on){
|
|
for(var eventname in config[key].on){
|
|
@@ -937,9 +939,10 @@ export function createToolbarHtml() {
|
|
.replaceAll(`data-tips=""`, `data-tips="`+config[key].tips+`"`+events+``)
|
|
.replaceAll(`data-tips=""`, `data-tips="`+config[key].tips+`"`+events+``)
|
|
.replaceAll(`luckysheet-iconfont-`, config[key].icon)
|
|
.replaceAll(`luckysheet-iconfont-`, config[key].icon)
|
|
);
|
|
);
|
|
-
|
|
|
|
|
|
+ } else {
|
|
|
|
+ buttonHTML.push(htmlMap[key]);
|
|
}
|
|
}
|
|
- buttonHTML.push(htmlMap[key]);
|
|
|
|
|
|
+ kcount++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return buttonHTML.join('');
|
|
return buttonHTML.join('');
|