forked from 0x2620/oxjs
add InfoList (draft)
This commit is contained in:
parent
f464e82541
commit
676cb72101
5 changed files with 202 additions and 32 deletions
|
|
@ -46,6 +46,7 @@ Ox.IconList = function(options, self) {
|
|||
selected: [],
|
||||
size: 128,
|
||||
sort: [],
|
||||
unique: ''
|
||||
})
|
||||
.options(options || {});
|
||||
|
||||
|
|
@ -60,6 +61,7 @@ Ox.IconList = function(options, self) {
|
|||
|
||||
that.$element = Ox.List({
|
||||
centered: self.options.centered,
|
||||
// fixme: change all occurences of construct to render
|
||||
construct: constructItem,
|
||||
draggable: self.options.draggable,
|
||||
id: self.options.id,
|
||||
|
|
@ -71,24 +73,16 @@ Ox.IconList = function(options, self) {
|
|||
min: self.options.min,
|
||||
orientation: self.options.orientation,
|
||||
selected: self.options.selected,
|
||||
size: self.options.size,
|
||||
sort: self.options.sort,
|
||||
type: 'icon',
|
||||
unique: self.options.unique
|
||||
}, $.extend({}, self)) // pass event handler
|
||||
.addClass('OxIconList Ox' + Ox.toTitleCase(self.options.orientation))
|
||||
.click(click)
|
||||
.dblclick(dblclick)
|
||||
.scroll(scroll);
|
||||
.addClass('OxIconList Ox' + Ox.toTitleCase(self.options.orientation));
|
||||
|
||||
updateKeys();
|
||||
|
||||
function click() {
|
||||
|
||||
}
|
||||
|
||||
function constructItem(data) {
|
||||
var isEmpty = Ox.isEmpty(data);
|
||||
var isEmpty = Ox.isEmpty(data),
|
||||
data = !isEmpty
|
||||
? self.options.item(data, self.options.sort, self.options.size)
|
||||
: {
|
||||
|
|
@ -99,7 +93,7 @@ Ox.IconList = function(options, self) {
|
|||
self.options.defaultRatio <= 1 ? 1 : self.options.defaultRatio
|
||||
))
|
||||
};
|
||||
return self.options.itemConstructor($.extend(data, {
|
||||
return self.options.itemConstructor(Ox.extend(data, {
|
||||
borderRadius: self.options.borderRadius,
|
||||
iconHeight: self.iconHeight,
|
||||
iconWidth: self.iconWidth,
|
||||
|
|
@ -113,14 +107,6 @@ Ox.IconList = function(options, self) {
|
|||
}));
|
||||
}
|
||||
|
||||
function dblclick() {
|
||||
|
||||
}
|
||||
|
||||
function scroll() {
|
||||
|
||||
}
|
||||
|
||||
function updateKeys() {
|
||||
self.options.keys = Ox.unique($.merge(self.options.keys, [self.options.sort[0].key]));
|
||||
that.$element.options({
|
||||
|
|
@ -130,13 +116,11 @@ Ox.IconList = function(options, self) {
|
|||
|
||||
/*@
|
||||
setOption <f> set key/value
|
||||
(key, value) -> <u> set eky in options to value
|
||||
(key, value) -> <u> set key in options to value
|
||||
@*/
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'items') {
|
||||
that.$element.options(key, value);
|
||||
} else if (key == 'paste') {
|
||||
that.$element.options(key, value);
|
||||
} else if (key == 'selected') {
|
||||
that.$element.options(key, value);
|
||||
} else if (key == 'sort') {
|
||||
|
|
@ -177,6 +161,7 @@ Ox.IconList = function(options, self) {
|
|||
@*/
|
||||
that.scrollToSelection = function() {
|
||||
that.$element.scrollToSelection();
|
||||
return that;
|
||||
};
|
||||
|
||||
/*@
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue