mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	preparing for header work...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									fa1b936b57
								
							
						
					
					
						commit
						7aef4d6537
					
				| @ -1129,6 +1129,10 @@ var BaseBrowserPrototype = { | |||||||
| 	__list__: function(make, options){ | 	__list__: function(make, options){ | ||||||
| 		throw new Error('.__list__(..): Not implemented.') }, | 		throw new Error('.__list__(..): Not implemented.') }, | ||||||
| 
 | 
 | ||||||
|  | 	// XXX header constructor, same as .__list__(..) but optional...
 | ||||||
|  | 	__header__: null, | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 	// Make extension...
 | 	// Make extension...
 | ||||||
| 	//
 | 	//
 | ||||||
| 	// This is called per item created by make(..) in .__list__(..)
 | 	// This is called per item created by make(..) in .__list__(..)
 | ||||||
| @ -1284,9 +1288,31 @@ var BaseBrowserPrototype = { | |||||||
| 		}.bind(this) | 		}.bind(this) | ||||||
| 		make.__proto__ = Items | 		make.__proto__ = Items | ||||||
| 		make.dialog = this | 		make.dialog = this | ||||||
| 		make.items = items |  | ||||||
| 
 | 
 | ||||||
| 		//var res = this.__list__(make)
 | 		// XXX call .__header__(..) if defined...
 | ||||||
|  | 		// 		...considering that this is exactly the same as .__list__(..)
 | ||||||
|  | 		// 		might be a good idea to loop through:
 | ||||||
|  | 		// 			[['__header__', header],
 | ||||||
|  | 		// 				['__items__', items]]
 | ||||||
|  | 		// 		...might also be good to add some logic to avoid header 
 | ||||||
|  | 		// 		rendering every time we call make...
 | ||||||
|  | 		/*/ XXX | ||||||
|  | 		var header this.header = this.__header__ ?  | ||||||
|  | 			[]  | ||||||
|  | 			: null | ||||||
|  | 		;[...(this.__header__ ?  | ||||||
|  | 					['__header__', header] | ||||||
|  | 					: []), | ||||||
|  | 				['__items__', items]] | ||||||
|  | 			.forEach(function([method, list]){ | ||||||
|  | 				// XXX check that this is enough...
 | ||||||
|  | 				make.items = list | ||||||
|  | 				var res = this[method](make, ..) | ||||||
|  | 				... | ||||||
|  | 			}) | ||||||
|  | 		//*/
 | ||||||
|  | 
 | ||||||
|  | 		make.items = items | ||||||
| 		// XXX not sure about this -- revise options handling...
 | 		// XXX not sure about this -- revise options handling...
 | ||||||
| 		var res = this.__list__(make,  | 		var res = this.__list__(make,  | ||||||
| 			options ?  | 			options ?  | ||||||
| @ -3045,10 +3071,15 @@ var BaseBrowserPrototype = { | |||||||
| 
 | 
 | ||||||
| 	// XXX should we update on init....
 | 	// XXX should we update on init....
 | ||||||
| 	__init__: function(func, options){ | 	__init__: function(func, options){ | ||||||
| 		this.__list__ = func | 		var args = [...arguments] | ||||||
|  | 		this.__list__ = args.shift() | ||||||
|  | 		if(args[0] instanceof Function){ | ||||||
|  | 			this.__header__ = this.__list__ | ||||||
|  | 			this.__list__ = args.shift() | ||||||
|  | 		} | ||||||
| 		this.options = Object.assign( | 		this.options = Object.assign( | ||||||
| 			Object.create(this.options || {}),  | 			Object.create(this.options || {}),  | ||||||
| 			options || {}) | 			args[0] || {}) | ||||||
| 	}, | 	}, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -3921,6 +3952,7 @@ var HTMLBrowserPrototype = { | |||||||
| 		elem.classList.add(...['item'] | 		elem.classList.add(...['item'] | ||||||
| 			// user classes...
 | 			// user classes...
 | ||||||
| 			.concat((item['class'] || item.cls || []) | 			.concat((item['class'] || item.cls || []) | ||||||
|  | 				// parse space-separated class strings...
 | ||||||
| 				.run(function(){ | 				.run(function(){ | ||||||
| 					return this instanceof Array ? | 					return this instanceof Array ? | ||||||
| 						this | 						this | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user