메뉴 탭 수정

main
이범준 6 months ago
parent 9052f28c6f
commit 7dc4463d4f

@ -64,8 +64,8 @@
</c:set>
<script>
let sticky = {id: -1, index: "dashboard", name: "대시보드", url: "/dashboard.do", parentID: null, description: "대시보드"},
mainTabs = new TabControl({
let sticky = {id: -1, index: "dashboard", name: "대시보드", url: "/dashboard.do", parentID: null, description: "대시보드"};
let mainTabs = new TabControl({
sticky: sticky,
getMenu: (url) => menuSupport.getMenu(url),
onDatasetChange: tabs => {

@ -369,7 +369,6 @@ class Dataset {
* <li>{@link Dataset#onModify onModify}</li>
* <li>{@link Dataset#onReplace onReplace}</li>
* <li>{@link Dataset#onRemove onRemove}</li>
* <li>{@link Dataset#onErase onErase}</li>
* <li>{@link Dataset#onDirtiesChange onDirtiesChange}</li>
* </ul>
* </li>
@ -396,7 +395,6 @@ class Dataset {
"onModify",
"onReplace",
"onRemove",
"onErase",
"onDirtiesChange"
].forEach(on => {
let handler = conf[on]
@ -1045,8 +1043,7 @@ class Dataset {
/**Erases user data associated with the key.
* After user data removal, the methods
* <ul> <li>{@link Dataset#onErase}</li>
* <li>{@link Dataset#onCurrentChange}</li>
* <ul> <li>{@link Dataset#onCurrentChange}</li>
* <li>{@link Dataset#onSelectionChange}</li>
* <li>{@link Dataset#onDirtiesChange}(if the Dataset gets dirty or not dirty)</li>
* </ul>
@ -1097,7 +1094,7 @@ class Dataset {
}
this._items = this._items.filter(function(item){return !erased.includes(item);});
this.onErase(erased);
this.onRemove(erased);
this.setState(state);
let after = this.dirty;
if (before != after)
@ -1217,11 +1214,6 @@ class Dataset {
*/
onRemove(removed) {this.log("Data removed", removed)}
/**Called back when user data are erased.
* @param {array} erased array of erased dataItems
*/
onErase(erased) {this.log("Data erased", erased)}
/**Called back when the Dataset gets dirty or not dirty.
* @param {boolean} dirty
* <ul> <li>true if the Dataset is dirty</li>

@ -272,9 +272,10 @@ class TabControl extends Dataset {
if (!menu)
throw "Menu not found for " + url;
if (this._items.length == this.maxCount) {
let index = isEmpty(this.sticky.url) ? 0 : 1;
this._remove(this._items[index]);
if (this.length == this.maxCount) {
let index = isEmpty(this.sticky) ? 0 : 1,
first = this._items[index];
this.close(first.data.url)
}
menu.content = resp;
@ -285,23 +286,7 @@ class TabControl extends Dataset {
}
close(url) {
let removed = this._remove(this.getTab(url));
if (removed)
this.setState();
}
_remove(tab) {
if (!tab || this._items.length < 1)
return false;
let index = this._items.indexOf(tab);
if (index < 0)
return false;
this._items.splice(index, 1);
index = tab.data.index;
delete this._byKeys["key-" + index];
this.onRemove([tab]);
return true;
let tab = this.getTab(url);
this.erase(tab.data.index);
}
}
Loading…
Cancel
Save