mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
849b4f3a47
commit
f995891a52
@ -390,19 +390,21 @@ if(typeof(jQuery) != typeof(undefined)){
|
|||||||
// // clear element value on edit...
|
// // clear element value on edit...
|
||||||
// clear_on_edit: false,
|
// clear_on_edit: false,
|
||||||
//
|
//
|
||||||
// // reset value on abort...
|
// // reset value on commit/abort...
|
||||||
|
// // XXX revise default...
|
||||||
|
// reset_on_commit: true,
|
||||||
// reset_on_abort: true,
|
// reset_on_abort: true,
|
||||||
//
|
//
|
||||||
// // blur element on abort/commit...
|
// // blur element on commit/abort...
|
||||||
// blur_on_abort: false,
|
|
||||||
// blur_on_commit: false,
|
// blur_on_commit: false,
|
||||||
|
// blur_on_abort: false,
|
||||||
//
|
//
|
||||||
// // restore focus before disabling the editor...
|
// // restore focus before disabling the editor...
|
||||||
// keep_focus_on_parent: true,
|
// keep_focus_on_parent: true,
|
||||||
//
|
//
|
||||||
// // clear selection on abort/commit...
|
// // clear selection on commit/abort...
|
||||||
// clear_selection_on_abort: true,
|
|
||||||
// clear_selection_on_commit: true,
|
// clear_selection_on_commit: true,
|
||||||
|
// clear_selection_on_abort: true,
|
||||||
//
|
//
|
||||||
// // If false unhandled key events will not be propagated to
|
// // If false unhandled key events will not be propagated to
|
||||||
// // parents...
|
// // parents...
|
||||||
|
|||||||
@ -317,7 +317,7 @@ function(text, options){
|
|||||||
start_on == 'select'
|
start_on == 'select'
|
||||||
&& editable
|
&& editable
|
||||||
.on('edit-abort', function(){ dialog.select(null) })
|
.on('edit-abort', function(){ dialog.select(null) })
|
||||||
|
|
||||||
// edit event handlers...
|
// edit event handlers...
|
||||||
options.editaborted
|
options.editaborted
|
||||||
&& editable.on('edit-abort', options.editaborted)
|
&& editable.on('edit-abort', options.editaborted)
|
||||||
@ -339,6 +339,39 @@ function(text, options){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
// Group items...
|
||||||
|
//
|
||||||
|
// .Group([<item>, ...])
|
||||||
|
// -> <group>
|
||||||
|
//
|
||||||
|
// This will return a group element, to get the items use .children()
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Usage example:
|
||||||
|
// make.Group([
|
||||||
|
// make.Heading('Group'),
|
||||||
|
// make('---'),
|
||||||
|
// make('Group item'),
|
||||||
|
// ])
|
||||||
|
//
|
||||||
|
Items.Group =
|
||||||
|
function(list){
|
||||||
|
var res = []
|
||||||
|
list.forEach(function(e){
|
||||||
|
e instanceof jQuery ? (res = res.concat(e.toArray()))
|
||||||
|
: e instanceof Array ? (res = res.concat(e))
|
||||||
|
: res.push(e)
|
||||||
|
})
|
||||||
|
var group = $('<div>')
|
||||||
|
.addClass('item-group')
|
||||||
|
.appendTo($(res).parent())
|
||||||
|
.append($(res))
|
||||||
|
return group
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// List of elements...
|
// List of elements...
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@ -433,13 +466,9 @@ function(data, options){
|
|||||||
res.push(elem[0])
|
res.push(elem[0])
|
||||||
})
|
})
|
||||||
|
|
||||||
options.groupList
|
return options.groupList ?
|
||||||
&& $(res).parent()
|
make.Group(res).children()
|
||||||
.append($('<div>')
|
: $(res)
|
||||||
.addClass('item-group')
|
|
||||||
.append($(res)))
|
|
||||||
|
|
||||||
return $(res)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -585,6 +614,7 @@ function(data, options){
|
|||||||
// info.
|
// info.
|
||||||
// NOTE: the list must contain strings.
|
// NOTE: the list must contain strings.
|
||||||
//
|
//
|
||||||
|
// XXX should id be the first argument??
|
||||||
Items.EditableList =
|
Items.EditableList =
|
||||||
function(list, options){
|
function(list, options){
|
||||||
var make = this
|
var make = this
|
||||||
@ -879,6 +909,11 @@ function(list, options){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Editable list of pinnable elements...
|
||||||
|
//
|
||||||
|
// This is like .EditableList(..) but adds the ability to pin items to
|
||||||
|
// the top sub-list and maintain that sub-list order independently or
|
||||||
|
// keep it the same as the main list...
|
||||||
//
|
//
|
||||||
// Format:
|
// Format:
|
||||||
// {
|
// {
|
||||||
@ -893,16 +928,9 @@ function(list, options){
|
|||||||
// ...
|
// ...
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
// XXX should id be the first argument??
|
||||||
// XXX should this be a single list or two lists???
|
// XXX should this be a single list or two lists???
|
||||||
// ...with a single list it's simpler to play with items w/o full updates...
|
// ...with a single list it's simpler to play with items w/o full updates...
|
||||||
// XXX add a fast redraw mode to .update(..)
|
|
||||||
// - do not clear items
|
|
||||||
// - if args did not change:
|
|
||||||
// - check if cur item is the same
|
|
||||||
// ...same text, options, signature to make(..)???
|
|
||||||
// - if the same, keep the element
|
|
||||||
// - if different find and place
|
|
||||||
// - if nothing found, create
|
|
||||||
Items.EditablePinnedList =
|
Items.EditablePinnedList =
|
||||||
function(list, pins, options){
|
function(list, pins, options){
|
||||||
var that = this
|
var that = this
|
||||||
@ -924,6 +952,11 @@ function(list, pins, options){
|
|||||||
dialog.__to_remove[id] = dialog.__to_remove[pins_id] = []
|
dialog.__to_remove[id] = dialog.__to_remove[pins_id] = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX redraw....
|
||||||
|
// - sort - within one list this is trivial (history.js)
|
||||||
|
// - pin/unpin - remove item from one list and update the
|
||||||
|
// other... (can we update a sub-list?)
|
||||||
|
|
||||||
//------------------------------------ setup options: main/pins ---
|
//------------------------------------ setup options: main/pins ---
|
||||||
// buttons...
|
// buttons...
|
||||||
var buttons = options.buttons = (options.buttons || []).slice()
|
var buttons = options.buttons = (options.buttons || []).slice()
|
||||||
@ -1162,6 +1195,14 @@ var BrowserClassPrototype = {
|
|||||||
// - navigation (mouse/keyboard)
|
// - navigation (mouse/keyboard)
|
||||||
// - search/filtering
|
// - search/filtering
|
||||||
// - buttons
|
// - buttons
|
||||||
|
// XXX add a fast redraw mode to .update(..) (???)
|
||||||
|
// - do not clear items
|
||||||
|
// - if args did not change:
|
||||||
|
// - check if cur item is the same
|
||||||
|
// ...same text, options, signature to make(..)???
|
||||||
|
// - if the same, keep the element
|
||||||
|
// - if different find and place
|
||||||
|
// - if nothing found, create
|
||||||
var BrowserPrototype = {
|
var BrowserPrototype = {
|
||||||
dom: null,
|
dom: null,
|
||||||
|
|
||||||
@ -3687,6 +3728,22 @@ module.makeList = makeBrowserMaker(List)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************************************************/
|
||||||
|
|
||||||
|
// Make an list/Array editor...
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// For options format see: Items.EditableList(..)
|
||||||
|
var makeListEditor =
|
||||||
|
module.makeListEditor =
|
||||||
|
function(list, options){
|
||||||
|
return makeLister(null,
|
||||||
|
function(path, make){
|
||||||
|
make.EditableList(list, options) },
|
||||||
|
options) }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
// This is similar to List(..) but will parse paths in keys...
|
// This is similar to List(..) but will parse paths in keys...
|
||||||
@ -3932,24 +3989,6 @@ module.makePathList = makeBrowserMaker(PathList)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
|
||||||
|
|
||||||
// Make an list/Array editor...
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// For options format see: List.EditableList(..)
|
|
||||||
var makeListEditor =
|
|
||||||
module.makeListEditor =
|
|
||||||
function(list, options){
|
|
||||||
return makeLister(null,
|
|
||||||
function(path, make){
|
|
||||||
make.EditableList(list, options)
|
|
||||||
},
|
|
||||||
options)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* vim:set ts=4 sw=4 : */ return module })
|
* vim:set ts=4 sw=4 : */ return module })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user