@wildebeest/boxlayout
Advanced tools
Comparing version 0.4.11 to 0.4.12
import { AbsolutePosition } from "../position/AbsolutePosition"; | ||
import { Emitter } from "@wildebeest/common"; | ||
export interface Block { | ||
bind(element: HTMLElement): void; | ||
getPositions(): Array<AbsolutePosition>; | ||
getEmitter(): Emitter; | ||
} |
@@ -5,3 +5,6 @@ import { Block } from "./Block"; | ||
export declare class BlockBlueprint implements Block { | ||
protected config: Array<any>; | ||
protected config: Array<{ | ||
position: AbsolutePosition; | ||
elementProperty: string; | ||
}>; | ||
protected emitter: Emitter; | ||
@@ -11,2 +14,3 @@ constructor(emitter: Emitter, config: Array<any>); | ||
getPositions(): Array<AbsolutePosition>; | ||
getEmitter(): Emitter; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var PixelsBinding_1 = require("../binding/PixelsBinding"); | ||
var CallbackBinding_1 = require("../binding/CallbackBinding"); | ||
var BlockBlueprint = (function () { | ||
@@ -11,7 +10,7 @@ function BlockBlueprint(emitter, config) { | ||
for (var i = 0; i < config.length; i++) { | ||
this.config[i].position.bind(new CallbackBinding_1.CallbackBinding(function () { | ||
_this.emitter.emit('change', { | ||
this.config[i].position.getEmitter().on('afterUpdate', function (event) { | ||
_this.emitter.emit('resize', { | ||
positions: _this.getPositions() | ||
}); | ||
})); | ||
}); | ||
} | ||
@@ -33,2 +32,5 @@ } | ||
}; | ||
BlockBlueprint.prototype.getEmitter = function () { | ||
return this.emitter; | ||
}; | ||
return BlockBlueprint; | ||
@@ -35,0 +37,0 @@ }()); |
@@ -10,2 +10,3 @@ import { Block } from "./Block"; | ||
getPositions(): Array<AbsolutePosition>; | ||
getEmitter(): Emitter; | ||
} |
@@ -25,2 +25,5 @@ "use strict"; | ||
}; | ||
HorizontalBlock.prototype.getEmitter = function () { | ||
return this.blueprint.getEmitter(); | ||
}; | ||
return HorizontalBlock; | ||
@@ -27,0 +30,0 @@ }()); |
@@ -10,2 +10,3 @@ import { Block } from "./Block"; | ||
getPositions(): Array<AbsolutePosition>; | ||
getEmitter(): Emitter; | ||
} |
@@ -29,2 +29,5 @@ "use strict"; | ||
}; | ||
RecktangleBlock.prototype.getEmitter = function () { | ||
return this.blueprint.getEmitter(); | ||
}; | ||
return RecktangleBlock; | ||
@@ -31,0 +34,0 @@ }()); |
@@ -10,2 +10,3 @@ import { Block } from "./Block"; | ||
getPositions(): Array<AbsolutePosition>; | ||
getEmitter(): Emitter; | ||
} |
@@ -25,2 +25,5 @@ "use strict"; | ||
}; | ||
VerticalBlock.prototype.getEmitter = function () { | ||
return this.blueprint.getEmitter(); | ||
}; | ||
return VerticalBlock; | ||
@@ -27,0 +30,0 @@ }()); |
import { EmitterService, Emitter, ViewportService, DomService } from "@wildebeest/common"; | ||
import { HorizontalDeviderBuilder } from "./HorizontalDeviderBuilder"; | ||
import { BlockBlueprint } from "./block/BlockBlueprint"; | ||
import { ComponentBuilder, Component } from "@wildebeest/component"; | ||
@@ -17,3 +16,5 @@ import { VerticalDeviderBuilder } from "./VerticalDeviderBuilder"; | ||
}; | ||
protected blocks: any; | ||
protected blocks: { | ||
[key: string]: Block; | ||
}; | ||
protected emitterService: EmitterService; | ||
@@ -29,3 +30,3 @@ protected emitter: Emitter; | ||
getPositions(): any; | ||
protected createDragableDevider(block: BlockBlueprint, builder: ComponentBuilder): Component; | ||
protected createDragableDevider(block: Block, builder: ComponentBuilder): Component; | ||
bindElement(element: any, blockName: string): Block; | ||
@@ -32,0 +33,0 @@ getBlock(blockName: string): Block; |
@@ -62,6 +62,19 @@ "use strict"; | ||
var _loop_1 = function (key) { | ||
this_1.positions[key].getEmitter().on('afterUpdate', function (event) { | ||
this_1.blocks[key].getEmitter().on('resize', function (event) { | ||
_this.emitter.emit('blockResize', { | ||
blockName: key, | ||
positions: event.positions | ||
}); | ||
}); | ||
}; | ||
var this_1 = this; | ||
for (var _i = 0, _a = ["top", "left", "center", "right", "bottom"]; _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
_loop_1(key); | ||
} | ||
var _loop_2 = function (key) { | ||
this_2.positions[key].getEmitter().on('afterUpdate', function (event) { | ||
_this.emitter.emit('resize', { | ||
position: _this.positions[key], | ||
value: event.vaue, | ||
value: event.value, | ||
min: event.min, | ||
@@ -72,5 +85,5 @@ max: event.max | ||
}; | ||
var this_1 = this; | ||
var this_2 = this; | ||
for (var key in this.positions) { | ||
_loop_1(key); | ||
_loop_2(key); | ||
} | ||
@@ -77,0 +90,0 @@ } |
{ | ||
"name": "@wildebeest/boxlayout", | ||
"version": "0.4.11", | ||
"version": "0.4.12", | ||
"description": "Box Layout module for creating fullscreen admin enviroments", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
import { AbsolutePosition } from "../position/AbsolutePosition"; | ||
import { Emitter } from "@wildebeest/common"; | ||
@@ -7,2 +8,3 @@ export interface Block | ||
getPositions(): Array<AbsolutePosition>; | ||
getEmitter(): Emitter; | ||
} |
@@ -10,3 +10,3 @@ import { Binding } from "../binding/Binding"; | ||
{ | ||
protected config: Array<any>; | ||
protected config: Array<{position: AbsolutePosition, elementProperty: string}>; | ||
protected emitter: Emitter; | ||
@@ -20,7 +20,7 @@ | ||
for (let i = 0; i < config.length; i++) { | ||
this.config[i].position.bind(new CallbackBinding(() => { | ||
this.emitter.emit('change', { | ||
this.config[i].position.getEmitter().on('afterUpdate', (event: any) => { | ||
this.emitter.emit('resize', { | ||
positions: this.getPositions() | ||
}); | ||
})) | ||
}); | ||
} | ||
@@ -46,2 +46,7 @@ } | ||
} | ||
getEmitter(): Emitter | ||
{ | ||
return this.emitter; | ||
} | ||
} |
@@ -35,2 +35,7 @@ import { Block } from "./Block"; | ||
} | ||
getEmitter(): Emitter | ||
{ | ||
return this.blueprint.getEmitter(); | ||
} | ||
} |
@@ -40,2 +40,7 @@ import { Block } from "./Block"; | ||
} | ||
getEmitter(): Emitter | ||
{ | ||
return this.blueprint.getEmitter(); | ||
} | ||
} |
@@ -35,2 +35,7 @@ import { Block } from "./Block"; | ||
} | ||
getEmitter(): Emitter | ||
{ | ||
return this.blueprint.getEmitter(); | ||
} | ||
} |
@@ -27,3 +27,3 @@ import { injectable, inject } from "inversify"; | ||
protected positions: { [key: string]: AbsolutePosition } = {}; | ||
protected blocks: any = {}; | ||
protected blocks: { [key: string]: Block } = {}; | ||
protected emitterService: EmitterService; | ||
@@ -70,2 +70,11 @@ protected emitter: Emitter; | ||
for (let key of ["top", "left", "center", "right", "bottom"]) { | ||
this.blocks[key].getEmitter().on('resize', (event: any) => { | ||
this.emitter.emit('blockResize', { | ||
blockName: key, | ||
positions: event.positions | ||
}); | ||
}); | ||
} | ||
for (let key in this.positions) { | ||
@@ -75,3 +84,3 @@ this.positions[key].getEmitter().on('afterUpdate', (event: any) => { | ||
position: this.positions[key], | ||
value: event.vaue, | ||
value: event.value, | ||
min: event.min, | ||
@@ -112,3 +121,3 @@ max: event.max | ||
protected createDragableDevider(block: BlockBlueprint, builder: ComponentBuilder): Component | ||
protected createDragableDevider(block: Block, builder: ComponentBuilder): Component | ||
{ | ||
@@ -115,0 +124,0 @@ let deviderElement: Component = builder.build({}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
127822
2299