Commit e4dd73d7 authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

cardcontrol

parent 823fa5b5
......@@ -465,6 +465,21 @@ var STWkit;
}
}
};
CardControl.prototype.clear = function () {
var self = this;
self.id = undefined;
var c = 1;
for (var i in self.cardMap) {
if (self.cardMap.hasOwnProperty(i)) {
var card = self.cardMap[i];
card.clear();
card.defaults();
if (c > 1)
card.hide();
c++;
}
}
};
CardControl.prototype.openCard = function (id, open) {
var self = this;
for (var i in self.cardMap) {
......@@ -482,6 +497,57 @@ var STWkit;
}
}
};
CardControl.prototype.getNextCardId = function (chain, id) {
var self = this;
var nextId = '';
for (var i in self.cardMap) {
if (self.cardMap.hasOwnProperty(i)) {
var card = self.cardMap[i];
if ((!card.status) && (card.visible())) {
nextId = i;
break;
}
}
}
if (nextId == '') {
nextId = chain[id];
if (nextId !== '' && self.cardMap[nextId].disabled)
nextId = self.getNextCardId(chain, nextId);
}
return nextId;
};
;
CardControl.prototype.showNext = function (chain, startDiv, id) {
var self = this;
if (self.cardMap[id].status) {
var nextId = self.getNextCardId(chain, id);
if (nextId !== '') {
self.cardMap[id].nextId = nextId;
self.cardMap[nextId].show();
}
else {
startDiv.style.display = 'block';
delete self.cardMap[id].nextId;
}
}
};
;
CardControl.prototype.callback = function (chain, startDiv, accordion, id, gonext) {
var self = this;
if (self.cardMap[id].status) {
self.updateBadgeStatus();
if (gonext) {
self.showNext(chain, startDiv, id);
accordion.toggleItem($("#" + id).data('wrapper'), true, true);
(self.cardMap[id].nextId && accordion.toggleItem($("#" + self.cardMap[id].nextId).data('wrapper'), true, true));
}
}
else {
self.updateBadgeStatus();
startDiv.style.display = 'none';
}
};
;
return CardControl;
}(L.Control));
STWkit.CardControl = CardControl;
......
This diff is collapsed.
......@@ -451,8 +451,9 @@ module STWkit {
}
export class CardControl extends L.Control {
export class CardControl extends L.Control {
private id: any;
private lang: string;
private langData: any;
private domain: string;
......@@ -511,6 +512,23 @@ module STWkit {
}
}
}
private clear() {
var self = this;
self.id = undefined;
var c = 1;
for (var i in self.cardMap) {
if (self.cardMap.hasOwnProperty(i)) {
var card = self.cardMap[i];
card.clear();
card.defaults();
if (c > 1) card.hide();
c++;
}
}
}
private openCard(id, open) {
var self = this;
......@@ -529,8 +547,54 @@ module STWkit {
}
}
}
private getNextCardId(chain, id) {
var self = this;
var nextId = '';
for (var i in self.cardMap) {
if (self.cardMap.hasOwnProperty(i)) {
var card = self.cardMap[i];
if ((!card.status) && (card.visible())) {
nextId = i;
break;
}
}
}
if (nextId == '') {
nextId = chain[id];
if (nextId !== '' && self.cardMap[nextId].disabled) nextId = self.getNextCardId(chain, nextId);
}
return nextId;
};
private showNext(chain, startDiv, id) {
var self = this;
if (self.cardMap[id].status) {
var nextId = self.getNextCardId(chain, id);
if (nextId !== '') {
self.cardMap[id].nextId = nextId;
self.cardMap[nextId].show();
} else {
startDiv.style.display = 'block';
delete self.cardMap[id].nextId;
}
}
};
public callback(chain, startDiv, accordion, id, gonext) {
var self = this;
if (self.cardMap[id].status) {
self.updateBadgeStatus();
if (gonext) {
self.showNext(chain, startDiv, id);
accordion.toggleItem($("#" + id).data('wrapper'), true, true);
(self.cardMap[id].nextId && accordion.toggleItem($("#" + self.cardMap[id].nextId).data('wrapper'), true, true))
}
} else {
self.updateBadgeStatus();
startDiv.style.display = 'none'
}
};
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment