forked from 0x2620/oxjs
simpler text list column head elements, better column drag
This commit is contained in:
parent
7bf42e5b0b
commit
0ba258281f
12 changed files with 461 additions and 330 deletions
|
|
@ -61,8 +61,8 @@ Ox.MainMenu = function(options, self) {
|
|||
|
||||
function click(event) {
|
||||
var $target = $(event.target),
|
||||
position = typeof $target.data('position') != 'undefined' ?
|
||||
$target.data('position') : -1;
|
||||
position = typeof $target.data('position') != 'undefined'
|
||||
? $target.data('position') : -1;
|
||||
clickTitle(position);
|
||||
}
|
||||
|
||||
|
|
@ -84,8 +84,8 @@ Ox.MainMenu = function(options, self) {
|
|||
function mousemove(event) {
|
||||
var $target = $(event.target),
|
||||
focused,
|
||||
position = typeof $target.data('position') != 'undefined' ?
|
||||
$target.data('position') : -1;
|
||||
position = typeof $target.data('position') != 'undefined'
|
||||
? $target.data('position') : -1;
|
||||
if (self.focused && position != self.selected) {
|
||||
if (position > -1) {
|
||||
clickTitle(position);
|
||||
|
|
@ -125,25 +125,23 @@ Ox.MainMenu = function(options, self) {
|
|||
itemId = ids.pop(),
|
||||
menuId = ids.join('_');
|
||||
that.getMenu(menuId).checkItem(itemId);
|
||||
return that;
|
||||
};
|
||||
|
||||
/*@
|
||||
disableItem <f> disableItem
|
||||
@*/
|
||||
that.disableItem = function(id) {
|
||||
that.getItem(id).options({
|
||||
disabled: true
|
||||
});
|
||||
that.getItem(id).options({disabled: true});
|
||||
return that;
|
||||
};
|
||||
|
||||
/*@
|
||||
enableItem <f> enableItem
|
||||
@*/
|
||||
that.enableItem = function(id) {
|
||||
Ox.print('ENABLE ITEM', id)
|
||||
that.getItem(id).options({
|
||||
disabled: false
|
||||
});
|
||||
that.getItem(id).options({disabled: false});
|
||||
return that;
|
||||
};
|
||||
|
||||
/*@
|
||||
|
|
@ -180,7 +178,6 @@ Ox.MainMenu = function(options, self) {
|
|||
} else {
|
||||
menu = that.getMenu(ids.shift()).getSubmenu(ids.join('_'));
|
||||
}
|
||||
//Ox.print('getMenu', id, menu);
|
||||
return menu;
|
||||
};
|
||||
|
||||
|
|
@ -195,6 +192,7 @@ Ox.MainMenu = function(options, self) {
|
|||
if (self.selected < self.options.menus.length - 1) {
|
||||
clickTitle(self.selected + 1);
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
||||
/*@
|
||||
|
|
@ -204,15 +202,15 @@ Ox.MainMenu = function(options, self) {
|
|||
if (self.selected) {
|
||||
clickTitle(self.selected - 1);
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
||||
/*@
|
||||
uncheckItem <f> uncheckItem
|
||||
@*/
|
||||
that.uncheckItem = function(id) {
|
||||
that.getItem(id).options({
|
||||
checked: false
|
||||
});
|
||||
that.getItem(id).options({checked: false});
|
||||
return that;
|
||||
};
|
||||
|
||||
return that;
|
||||
|
|
|
|||
|
|
@ -178,8 +178,8 @@ Ox.Menu = function(options, self) {
|
|||
self.optionGroups = {};
|
||||
items.forEach(function(item, i) {
|
||||
if (item.group) {
|
||||
items[i] = $.map(item.items, function(v, i) {
|
||||
return $.extend(v, {
|
||||
items[i] = item.items.map(function(v, i) {
|
||||
return Ox.extend(v, {
|
||||
group: item.group
|
||||
});
|
||||
});
|
||||
|
|
@ -196,7 +196,7 @@ Ox.Menu = function(options, self) {
|
|||
items.forEach(function(item) {
|
||||
var position;
|
||||
if ('id' in item) {
|
||||
that.items.push(Ox.MenuItem($.extend(item, {
|
||||
that.items.push(Ox.MenuItem(Ox.extend(item, {
|
||||
menu: that,
|
||||
position: position = that.items.length
|
||||
})).data('position', position).appendTo(that.$content)); // fixme: jquery bug when passing {position: position}? does not return the object?;
|
||||
|
|
@ -281,10 +281,7 @@ Ox.Menu = function(options, self) {
|
|||
|
||||
function constructSpace() {
|
||||
return $('<tr>').append(
|
||||
$('<td>', {
|
||||
'class': 'OxSpace',
|
||||
colspan: 5
|
||||
})
|
||||
$('<td>', {'class': 'OxSpace', colspan: 5})
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -720,10 +717,10 @@ Ox.Menu = function(options, self) {
|
|||
};
|
||||
|
||||
/*@
|
||||
toggelMenu <f> toggleMenu
|
||||
toggleMenu <f> toggleMenu
|
||||
@*/
|
||||
that.toggleMenu = function() {
|
||||
that.is(':hidden') ? that.showMenu() : that.hideMenu();
|
||||
return that.is(':hidden') ? that.showMenu() : that.hideMenu();
|
||||
};
|
||||
|
||||
return that;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ Ox.MenuItem = function(options, self) {
|
|||
position: 0,
|
||||
title: [],
|
||||
})
|
||||
.options($.extend(options, {
|
||||
.options(Ox.extend(options, {
|
||||
keyboard: parseKeyboard(options.keyboard || self.defaults.keyboard),
|
||||
title: Ox.toArray(options.title || self.defaults.title)
|
||||
}))
|
||||
|
|
@ -63,10 +63,8 @@ Ox.MenuItem = function(options, self) {
|
|||
that.$icon = $('<td>', {
|
||||
'class': 'OxCell OxIcon'
|
||||
})
|
||||
.append(self.options.icon ?
|
||||
$('<img>', {
|
||||
src: self.options.icon
|
||||
}) : null
|
||||
.append(self.options.icon
|
||||
? $('<img>', {src: self.options.icon}) : null
|
||||
)
|
||||
)
|
||||
.append(
|
||||
|
|
@ -78,17 +76,19 @@ Ox.MenuItem = function(options, self) {
|
|||
.append(
|
||||
$('<td>', {
|
||||
'class': 'OxCell OxModifiers',
|
||||
html: $.map(self.options.keyboard.modifiers, function(modifier) {
|
||||
html: self.options.keyboard.modifiers.map(function(modifier) {
|
||||
return Ox.UI.symbols[modifier];
|
||||
}).join('')
|
||||
})
|
||||
)
|
||||
.append(
|
||||
$('<td>', {
|
||||
'class': 'OxCell Ox' + (self.options.items.length ? 'Submenu' : 'Key'),
|
||||
html: self.options.items.length ? Ox.UI.symbols.triangle_right :
|
||||
Ox.UI.symbols[self.options.keyboard.key] ||
|
||||
self.options.keyboard.key.toUpperCase()
|
||||
'class': 'OxCell Ox'
|
||||
+ (self.options.items.length ? 'Submenu' : 'Key'),
|
||||
html: self.options.items.length
|
||||
? Ox.UI.symbols.triangle_right
|
||||
: Ox.UI.symbols[self.options.keyboard.key]
|
||||
|| self.options.keyboard.key.toUpperCase()
|
||||
})
|
||||
);
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ Ox.MenuItem = function(options, self) {
|
|||
if (key == 'checked') {
|
||||
that.$status.html(value ? Ox.UI.symbols.check : '')
|
||||
} else if (key == 'disabled') {
|
||||
that.toggleClass('OxDisabled'); // fixme: this will only work if onChange is only invoked on actual change
|
||||
that.toggleClass('OxDisabled');
|
||||
} else if (key == 'title') {
|
||||
self.options.title = Ox.toArray(value);
|
||||
that.$title.html(self.options.title[0]);
|
||||
|
|
@ -120,12 +120,11 @@ Ox.MenuItem = function(options, self) {
|
|||
};
|
||||
|
||||
/*@
|
||||
toggelChecked <f> toggleChecked
|
||||
toggleChecked <f> toggleChecked
|
||||
@*/
|
||||
that.toggleChecked = function() {
|
||||
that.options({
|
||||
checked: !self.options.checked
|
||||
});
|
||||
that.options({checked: !self.options.checked});
|
||||
return that;
|
||||
};
|
||||
|
||||
that.toggleDisabled = function() {
|
||||
|
|
@ -133,13 +132,11 @@ Ox.MenuItem = function(options, self) {
|
|||
};
|
||||
|
||||
/*@
|
||||
toggelTitle <f> toggleTitle
|
||||
toggleTitle <f> toggleTitle
|
||||
@*/
|
||||
that.toggleTitle = function() {
|
||||
//Ox.print('s.o.t', self.options.title)
|
||||
that.options({
|
||||
title: self.options.title.reverse()
|
||||
});
|
||||
that.options({title: self.options.title.reverse()});
|
||||
return that;
|
||||
};
|
||||
|
||||
return that;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue