davinci.js
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -16,2 +16,3 @@ /// <reference types="angular" /> | ||
import { IVMScope as _IVMScope, ICalcCubeElement as _ICalcCubeElement, IDomContainer as _IDomContainer, IMenuElement as _IMenuElement, IRegisterDirective as _IRegisterDirective } from "./utils/interfaces"; | ||
import { RootSingleList as _RootSingleList } from "./utils/rootclasses"; | ||
declare const version: string; | ||
@@ -30,2 +31,3 @@ declare namespace utils { | ||
const Q2gListObject: typeof _Q2gListObject; | ||
const RootSingleList: typeof _RootSingleList; | ||
const checkEqualityOfArrays: typeof _checkEqualityOfArrays; | ||
@@ -32,0 +34,0 @@ const checkDirectiveIsRegistrated: typeof _checkDirectiveIsRegistrated; |
@@ -13,3 +13,4 @@ import { logging } from "./utils/logger"; | ||
import { StatusTextDirectiveFactory as _StatusTextDirectiveFactory } from "./directives/statusText"; | ||
var version = "1.2.0+0+master+bfa8afa572f81eac022f8f5547392dd61c125843"; | ||
import { RootSingleList as _RootSingleList } from "./utils/rootclasses"; | ||
var version = "1.3.0+0+master+d4195996a4dcafae95db99bc62c536b59aa9e59c"; | ||
var utils; | ||
@@ -28,2 +29,3 @@ (function (utils) { | ||
utils.Q2gListObject = _Q2gListObject; | ||
utils.RootSingleList = _RootSingleList; | ||
utils.checkEqualityOfArrays = _checkEqualityOfArrays; | ||
@@ -30,0 +32,0 @@ utils.checkDirectiveIsRegistrated = _checkDirectiveIsRegistrated; |
@@ -6,2 +6,3 @@ /// <reference types="angular" /> | ||
event?: JQueryKeyEventObject; | ||
index?: number; | ||
} | ||
@@ -8,0 +9,0 @@ export interface IDataModelItem { |
//#region Imports | ||
import { logging } from "../utils/logger"; | ||
import { qStatusFilter } from "../filter/statusFilter"; | ||
import { qStatusFilter, qSelectedFilter } from "../filter/statusFilter"; | ||
import { ShortCutDirectiveFactory } from "./shortcut"; | ||
@@ -22,2 +22,3 @@ import { templateReplacer, checkDirectiveIsRegistrated } from "../utils/utils"; | ||
this.showScrollBar = false; | ||
this.itemPxWidthCalculated = 0; | ||
//#endregion | ||
@@ -36,2 +37,3 @@ //#region itemsPageTop | ||
_this.elementHeight = _this.element.height(); | ||
_this.elementWidth = _this.element.width(); | ||
}); | ||
@@ -42,2 +44,16 @@ } | ||
}; | ||
Object.defineProperty(ListViewController.prototype, "splitColumn", { | ||
get: function () { | ||
return this._splitColumn; | ||
}, | ||
set: function (v) { | ||
if (typeof (this.element) !== "undefined") { | ||
this._splitColumn = v; | ||
this._itemsPageSize = Math.floor((this.horizontalMode ? this.element.width() : this.element.height()) / this.itemPxHeight) * (this.splitColumn ? this.splitColumn : 1); | ||
this.itemPxWidthCalculated = this.calcWidthOfElement(); | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(ListViewController.prototype, "itemPxHeight", { | ||
@@ -53,2 +69,6 @@ get: function () { | ||
this._itemPxHeight = v; | ||
if (this.horizontalMode) { | ||
this.itemsPageSize = Math.floor(this.elementWidth / this.itemPxHeight); | ||
} | ||
this.itemsPageSize = Math.floor(this.elementHeight / this.itemPxHeight); | ||
} | ||
@@ -59,2 +79,23 @@ }, | ||
}); | ||
Object.defineProperty(ListViewController.prototype, "horizontalMode", { | ||
get: function () { | ||
if (this._horizontalMode) { | ||
return this._horizontalMode; | ||
} | ||
return false; | ||
}, | ||
set: function (value) { | ||
if (value !== this._horizontalMode) { | ||
this._horizontalMode = value; | ||
if (this.horizontalMode) { | ||
this.itemsPageSize = Math.floor(this.elementWidth / this.itemPxHeight); | ||
} | ||
else { | ||
this.itemsPageSize = Math.floor(this.elementHeight / this.itemPxHeight); | ||
} | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(ListViewController.prototype, "itemsCount", { | ||
@@ -109,3 +150,6 @@ get: function () { | ||
this._elementHeight = v; | ||
this.itemsPageSize = Math.floor(v / this.itemPxHeight); | ||
if (!this.horizontalMode) { | ||
this.itemsPageSize = Math.floor(v / this.itemPxHeight); | ||
this.itemPxWidthCalculated = this.calcWidthOfElement(); | ||
} | ||
}, | ||
@@ -115,2 +159,16 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(ListViewController.prototype, "elementWidth", { | ||
get: function () { | ||
return this._elementWidth; | ||
}, | ||
set: function (v) { | ||
this._elementWidth = v; | ||
if (this.horizontalMode) { | ||
this.itemsPageSize = Math.floor(v / this.itemPxHeight); | ||
this.itemPxWidthCalculated = this.calcWidthOfElement(); | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(ListViewController.prototype, "itemFocused", { | ||
@@ -133,3 +191,16 @@ get: function () { | ||
set: function (value) { | ||
this._items = value; | ||
if (typeof (value) !== "undefined") { | ||
try { | ||
if (this.splitMode) { | ||
this._items = value; | ||
this.splitColumn = value.length; | ||
return; | ||
} | ||
this._items = [value]; | ||
this.splitColumn = 1; | ||
} | ||
catch (e) { | ||
this.logger.error("ERROR in setter of items: ", e); | ||
} | ||
} | ||
}, | ||
@@ -154,2 +225,17 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(ListViewController.prototype, "splitMode", { | ||
get: function () { | ||
if (this._splitMode) { | ||
return this._splitMode; | ||
} | ||
return false; | ||
}, | ||
set: function (value) { | ||
if (value !== this._splitMode) { | ||
this._splitMode = value; | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(ListViewController.prototype, "logger", { | ||
@@ -179,3 +265,8 @@ get: function () { | ||
if (typeof (v) !== "undefined" && this._itemsPageSize !== v) { | ||
this._itemsPageSize = v; | ||
if (v > Math.floor(((this.horizontalMode ? this.elementWidth : this.elementHeight) * (this.splitColumn ? this.splitColumn : 1)) | ||
/ this.itemPxHeight)) { | ||
return; | ||
} | ||
this._itemsPageSize = v * (this.splitColumn ? this.splitColumn : 1); | ||
this.itemPxWidthCalculated = this.calcWidthOfElement(); | ||
} | ||
@@ -234,2 +325,10 @@ }, | ||
}; | ||
ListViewController.prototype.calcWidthOfElement = function () { | ||
try { | ||
return (this.elementWidth / (this.itemsPageSize / this.splitColumn)); | ||
} | ||
catch (error) { | ||
return this.itemPxHeight; | ||
} | ||
}; | ||
/** | ||
@@ -311,5 +410,5 @@ * manage all shortcut events on this directive | ||
*/ | ||
ListViewController.prototype.selectItem = function (index, event) { | ||
ListViewController.prototype.selectItem = function (index, event, indexSplit) { | ||
if (this.callbackListviewObjects) { | ||
this.callbackListviewObjects({ pos: index, event: event }); | ||
this.callbackListviewObjects({ pos: index, event: event, index: indexSplit }); | ||
} | ||
@@ -340,5 +439,7 @@ }; | ||
showFocused: "<?", | ||
horizontalMode: "<?", | ||
callbackListviewObjects: "&", | ||
overrideShortcuts: "<?", | ||
theme: "<?" | ||
theme: "<?", | ||
splitMode: "<?" | ||
}, | ||
@@ -349,2 +450,3 @@ compile: function () { | ||
$registrationProvider.filter("qstatusfilter", qStatusFilter); | ||
$registrationProvider.filter("qselectedfilter", qSelectedFilter); | ||
} | ||
@@ -351,0 +453,0 @@ }; |
@@ -13,3 +13,3 @@ //#region Imports | ||
*/ | ||
function DragableBar(element) { | ||
function DragableBar(element, horizontalMode) { | ||
this.position = 0; | ||
@@ -19,6 +19,8 @@ this.height = 0; | ||
this.elementDragable = this.element.children().children(); | ||
this.elementDragable[0].style.height = "12px"; | ||
this.elementDragable[0].style.display = "normal"; | ||
this.elementDragable[0].style.top = "0px"; | ||
this.height = element.children().height(); | ||
this.horizontalMode = false; | ||
if (typeof (horizontalMode) !== "undefined") { | ||
this.horizontalMode = horizontalMode; | ||
} | ||
this.height = this.horizontalMode ? element.children().width() : element.children().height(); | ||
this.watchResize(40); | ||
@@ -41,2 +43,20 @@ } | ||
}); | ||
Object.defineProperty(DragableBar.prototype, "horizontalMode", { | ||
get: function () { | ||
return this._horizontalMode; | ||
}, | ||
set: function (v) { | ||
if (v !== this._horizontalMode) { | ||
this._horizontalMode = v; | ||
if (v) { | ||
this.setHorizontalProperties(); | ||
} | ||
else { | ||
this.setVerticalProperties(); | ||
} | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -49,5 +69,5 @@ * checks the size of the container and resets it | ||
setInterval(function () { | ||
if (_this.element.children().height() !== _this.height) { | ||
if (_this.horizontalMode ? _this.element.children().width() : _this.element.children().height() !== _this.height) { | ||
try { | ||
_this.height = _this.element.children().height(); | ||
_this.height = _this.horizontalMode ? _this.element.children().width() : _this.element.children().height(); | ||
} | ||
@@ -67,8 +87,27 @@ catch (err) { | ||
if (height < 12) { | ||
this.elementDragable[0].style.height = 12 + "px"; | ||
if (this.horizontalMode) { | ||
this.elementDragable[0].style.width = 12 + "px"; | ||
this.elementDragable[0].style.height = 11 + "px"; | ||
} | ||
else { | ||
this.elementDragable[0].style.height = 12 + "px"; | ||
this.elementDragable[0].style.width = 11 + "px"; | ||
} | ||
} | ||
else { | ||
this.elementDragable[0].style.height = height + "px"; | ||
if (this.horizontalMode) { | ||
this.elementDragable[0].style.width = height + "px"; | ||
this.elementDragable[0].style.height = 11 + "px"; | ||
} | ||
else { | ||
this.elementDragable[0].style.height = height + "px"; | ||
this.elementDragable[0].style.width = 11 + "px"; | ||
} | ||
} | ||
return this.elementDragable[0].style.height; | ||
if (this.horizontalMode) { | ||
return this.elementDragable[0].style.width; | ||
} | ||
else { | ||
return this.elementDragable[0].style.height; | ||
} | ||
} | ||
@@ -84,3 +123,8 @@ catch (e) { | ||
try { | ||
return +this.elementDragable[0].style.height.replace("px", ""); | ||
if (this.horizontalMode) { | ||
return +this.elementDragable[0].style.width.replace("px", ""); | ||
} | ||
else { | ||
return +this.elementDragable[0].style.height.replace("px", ""); | ||
} | ||
} | ||
@@ -119,7 +163,17 @@ catch (err) { | ||
else if (this.position + posMove < 0) { | ||
this.elementDragable[0].style.top = "0px"; | ||
if (this.horizontalMode) { | ||
this.elementDragable[0].style.left = "0px"; | ||
} | ||
else { | ||
this.elementDragable[0].style.top = "0px"; | ||
} | ||
this.position = 0; | ||
} | ||
else if (this.position + posMove > this.height - this.getHeight()) { | ||
this.elementDragable[0].style.top = this.height - this.getHeight() + "px"; | ||
if (this.horizontalMode) { | ||
this.elementDragable[0].style.left = this.height - this.getHeight() + "px"; | ||
} | ||
else { | ||
this.elementDragable[0].style.top = this.height - this.getHeight() + "px"; | ||
} | ||
this.position = this.height - this.getHeight(); | ||
@@ -129,3 +183,8 @@ } | ||
this.position += posMove; | ||
this.elementDragable[0].style.top = this.position + "px"; | ||
if (this.horizontalMode) { | ||
this.elementDragable[0].style.left = this.position + "px"; | ||
} | ||
else { | ||
this.elementDragable[0].style.top = this.position + "px"; | ||
} | ||
} | ||
@@ -138,7 +197,12 @@ } | ||
/** | ||
* returns the top space as number | ||
* returns the top/left space as number | ||
*/ | ||
DragableBar.prototype.getTop = function () { | ||
try { | ||
return parseInt(this.elementDragable[0].style.top.substring(0, this.elementDragable[0].style.top.length - 2), 10); | ||
if (this.horizontalMode) { | ||
return parseInt(this.elementDragable[0].style.left.substring(0, this.elementDragable[0].style.left.length - 2), 10); | ||
} | ||
else { | ||
return parseInt(this.elementDragable[0].style.top.substring(0, this.elementDragable[0].style.top.length - 2), 10); | ||
} | ||
} | ||
@@ -151,7 +215,25 @@ catch (err) { | ||
/** | ||
* reset height to childreen heigt | ||
* name | ||
*/ | ||
DragableBar.prototype.resetHeight = function () { | ||
this.height = this.element.children().height(); | ||
DragableBar.prototype.setHorizontalProperties = function () { | ||
try { | ||
this.elementDragable[0].style.width = "11px"; | ||
this.elementDragable[0].style.left = "0px"; | ||
} | ||
catch (error) { | ||
this.logger.error("Error in setHorizontalProperties", error); | ||
} | ||
}; | ||
/** | ||
* name | ||
*/ | ||
DragableBar.prototype.setVerticalProperties = function () { | ||
try { | ||
this.elementDragable[0].style.height = "12px"; | ||
this.elementDragable[0].style.top = "0px"; | ||
} | ||
catch (error) { | ||
this.logger.error("Error in setVerticalProperties", error); | ||
} | ||
}; | ||
return DragableBar; | ||
@@ -168,2 +250,3 @@ }()); | ||
var _this = this; | ||
this.toggleSetPositionBar = true; | ||
//#endregion | ||
@@ -190,4 +273,9 @@ //#region itemsPageTop | ||
try { | ||
startY = event.screenY; | ||
topPositionOfDragElement = parseInt(_this.dragElement[0].style.top.substring(0, _this.dragElement[0].style.top.length - 2), 10); | ||
startY = _this.horizontalMode ? event.screenX : event.screenY; | ||
if (_this.horizontalMode) { | ||
topPositionOfDragElement = parseInt(_this.dragElement[0].style.left.substring(0, _this.dragElement[0].style.left.length - 2), 10); | ||
} | ||
else { | ||
topPositionOfDragElement = parseInt(_this.dragElement[0].style.top.substring(0, _this.dragElement[0].style.top.length - 2), 10); | ||
} | ||
} | ||
@@ -208,2 +296,20 @@ catch (err) { | ||
}; | ||
Object.defineProperty(ScrollBarController.prototype, "horizontalMode", { | ||
get: function () { | ||
if (this._horizontalMode) { | ||
return this._horizontalMode; | ||
} | ||
return false; | ||
}, | ||
set: function (value) { | ||
if (value !== this._horizontalMode) { | ||
this._horizontalMode = value; | ||
if (typeof (this.dragableBarElement) !== "undefined") { | ||
this.dragableBarElement.horizontalMode = value; | ||
} | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(ScrollBarController.prototype, "itemsPageTop", { | ||
@@ -227,5 +333,9 @@ get: function () { | ||
if (this.element) { | ||
var newPostion = (this.element.height() - this.dragableBarElement.getHeight()) / | ||
(this.itemsCount - this.itemsPageSize) * (value - oldVal); | ||
this.dragableBarElement.setPosition(newPostion); | ||
var newPostion = ((this.horizontalMode ? this.element.width() : this.element.height()) | ||
- this.dragableBarElement.getHeight()) | ||
/ (this.itemsCount - this.itemsPageSize) * (value - oldVal); | ||
if (this.toggleSetPositionBar) { | ||
this.dragableBarElement.setPosition(newPostion); | ||
} | ||
this.toggleSetPositionBar = true; | ||
} | ||
@@ -318,3 +428,5 @@ if (this.timeout) { | ||
_this.dragableBarElement.setVisible(_this.itemsCount > _this.itemsPageSize); | ||
_this.dragableBarElement.setHeight(_this.element.height() * _this.itemsPageSize / _this.itemsCount); | ||
_this.dragableBarElement.setHeight((_this.horizontalMode ? _this.element.width() : _this.element.height()) | ||
* _this.itemsPageSize | ||
/ _this.itemsCount); | ||
} | ||
@@ -330,10 +442,13 @@ catch (err) { | ||
* @param upOrMove hint if mouse is moved or mouse up | ||
* @param startY start position of the mouse Movement | ||
* @param top the top position of the dragable element | ||
* @param startPosition start position of the mouse Movement | ||
* @param startDiff the top position of the dragable element | ||
*/ | ||
ScrollBarController.prototype.mousehandle = function (event, upOrMove, startY, top) { | ||
ScrollBarController.prototype.mousehandle = function (event, upOrMove, startPosition, startDiff) { | ||
try { | ||
this.dragableBarElement.setPosition((event.screenY - startY) - top); | ||
this.dragableBarElement.setPosition(((this.horizontalMode ? event.screenX : event.screenY) - startPosition) - startDiff); | ||
var newPosition = (this.dragableBarElement.getTop() / | ||
((this.element.height() - this.dragableBarElement.getHeight()) / (this.itemsCount - this.itemsPageSize))); | ||
(((this.horizontalMode ? this.element.width() : this.element.height()) | ||
- this.dragableBarElement.getHeight()) | ||
/ (this.itemsCount - this.itemsPageSize))); | ||
this.toggleSetPositionBar = false; | ||
this.itemsPageTop = Math.round(newPosition); | ||
@@ -378,3 +493,3 @@ if (upOrMove === "mouseup") { | ||
itemsPageSize: "<", | ||
vertical: "<", | ||
horizontalMode: "<?", | ||
show: "<", | ||
@@ -381,0 +496,0 @@ theme: "<?" |
@@ -5,1 +5,5 @@ /** | ||
export declare function qStatusFilter(): (elementStatus: string) => "optional" | "selected" | "alternative" | "excluded" | "selectedExcluded" | "locked" | "option"; | ||
/** | ||
* Filter to check which item is selected | ||
*/ | ||
export declare function qSelectedFilter(): (elementStatus: string) => boolean; |
@@ -24,1 +24,17 @@ /** | ||
} | ||
/** | ||
* Filter to check which item is selected | ||
*/ | ||
export function qSelectedFilter() { | ||
"use strict"; | ||
return function (elementStatus) { | ||
switch (elementStatus) { | ||
case "S": | ||
return true; | ||
case "XS": | ||
return true; | ||
default: | ||
return false; | ||
} | ||
}; | ||
} |
@@ -235,3 +235,3 @@ var __extends = (this && this.__extends) || (function () { | ||
.catch(function (e) { | ||
_this.logger.error("ERROR", e); | ||
_this.logger.error("ERROR in getDataPage", e); | ||
reject(e); | ||
@@ -252,3 +252,3 @@ }); | ||
}).catch(function (e) { | ||
_this.logger.error("error", e); | ||
_this.logger.error("error in searchFor", e); | ||
reject(); | ||
@@ -316,3 +316,3 @@ }); | ||
.catch(function (e) { | ||
_this.logger.error("ERROR", e); | ||
_this.logger.error("ERROR in getDataPage", e); | ||
reject(e); | ||
@@ -333,3 +333,3 @@ }); | ||
}).catch(function (e) { | ||
_this.logger.error("error", e); | ||
_this.logger.error("error in searchFor", e); | ||
reject(); | ||
@@ -336,0 +336,0 @@ }); |
@@ -395,2 +395,2 @@ var __extends = (this && this.__extends) || (function () { | ||
export { StateMachineInput }; | ||
//#endregion | ||
//#endregion |
@@ -16,2 +16,3 @@ /// <reference types="angular" /> | ||
import { IVMScope as _IVMScope, ICalcCubeElement as _ICalcCubeElement, IDomContainer as _IDomContainer, IMenuElement as _IMenuElement, IRegisterDirective as _IRegisterDirective } from "./utils/interfaces"; | ||
import { RootSingleList as _RootSingleList } from "./utils/rootclasses"; | ||
declare const version: string; | ||
@@ -30,2 +31,3 @@ declare namespace utils { | ||
const Q2gListObject: typeof _Q2gListObject; | ||
const RootSingleList: typeof _RootSingleList; | ||
const checkEqualityOfArrays: typeof _checkEqualityOfArrays; | ||
@@ -32,0 +34,0 @@ const checkDirectiveIsRegistrated: typeof _checkDirectiveIsRegistrated; |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./utils/logger", "./utils/utils", "./utils/object", "./services/registration", "./services/translate", "./directives/extensionHeader", "./directives/identifier", "./directives/inputBar", "./directives/listview", "./directives/scrollBar", "./directives/shortcut", "./directives/statusText"], factory); | ||
define(["require", "exports", "./utils/logger", "./utils/utils", "./utils/object", "./services/registration", "./services/translate", "./directives/extensionHeader", "./directives/identifier", "./directives/inputBar", "./directives/listview", "./directives/scrollBar", "./directives/shortcut", "./directives/statusText", "./utils/rootclasses"], factory); | ||
} | ||
@@ -26,3 +26,4 @@ })(function (require, exports) { | ||
var statusText_1 = require("./directives/statusText"); | ||
var version = "1.2.0+0+master+bfa8afa572f81eac022f8f5547392dd61c125843"; | ||
var rootclasses_1 = require("./utils/rootclasses"); | ||
var version = "1.3.0+0+master+d4195996a4dcafae95db99bc62c536b59aa9e59c"; | ||
exports.version = version; | ||
@@ -42,2 +43,3 @@ var utils; | ||
utils.Q2gListObject = object_1.Q2gListObject; | ||
utils.RootSingleList = rootclasses_1.RootSingleList; | ||
utils.checkEqualityOfArrays = utils_1.checkEqualityOfArrays; | ||
@@ -44,0 +46,0 @@ utils.checkDirectiveIsRegistrated = utils_1.checkDirectiveIsRegistrated; |
@@ -6,2 +6,3 @@ /// <reference types="angular" /> | ||
event?: JQueryKeyEventObject; | ||
index?: number; | ||
} | ||
@@ -8,0 +9,0 @@ export interface IDataModelItem { |
@@ -33,2 +33,3 @@ (function (factory) { | ||
this.showScrollBar = false; | ||
this.itemPxWidthCalculated = 0; | ||
//#endregion | ||
@@ -47,2 +48,3 @@ //#region itemsPageTop | ||
_this.elementHeight = _this.element.height(); | ||
_this.elementWidth = _this.element.width(); | ||
}); | ||
@@ -53,2 +55,16 @@ } | ||
}; | ||
Object.defineProperty(ListViewController.prototype, "splitColumn", { | ||
get: function () { | ||
return this._splitColumn; | ||
}, | ||
set: function (v) { | ||
if (typeof (this.element) !== "undefined") { | ||
this._splitColumn = v; | ||
this._itemsPageSize = Math.floor((this.horizontalMode ? this.element.width() : this.element.height()) / this.itemPxHeight) * (this.splitColumn ? this.splitColumn : 1); | ||
this.itemPxWidthCalculated = this.calcWidthOfElement(); | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(ListViewController.prototype, "itemPxHeight", { | ||
@@ -64,2 +80,6 @@ get: function () { | ||
this._itemPxHeight = v; | ||
if (this.horizontalMode) { | ||
this.itemsPageSize = Math.floor(this.elementWidth / this.itemPxHeight); | ||
} | ||
this.itemsPageSize = Math.floor(this.elementHeight / this.itemPxHeight); | ||
} | ||
@@ -70,2 +90,23 @@ }, | ||
}); | ||
Object.defineProperty(ListViewController.prototype, "horizontalMode", { | ||
get: function () { | ||
if (this._horizontalMode) { | ||
return this._horizontalMode; | ||
} | ||
return false; | ||
}, | ||
set: function (value) { | ||
if (value !== this._horizontalMode) { | ||
this._horizontalMode = value; | ||
if (this.horizontalMode) { | ||
this.itemsPageSize = Math.floor(this.elementWidth / this.itemPxHeight); | ||
} | ||
else { | ||
this.itemsPageSize = Math.floor(this.elementHeight / this.itemPxHeight); | ||
} | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(ListViewController.prototype, "itemsCount", { | ||
@@ -120,3 +161,6 @@ get: function () { | ||
this._elementHeight = v; | ||
this.itemsPageSize = Math.floor(v / this.itemPxHeight); | ||
if (!this.horizontalMode) { | ||
this.itemsPageSize = Math.floor(v / this.itemPxHeight); | ||
this.itemPxWidthCalculated = this.calcWidthOfElement(); | ||
} | ||
}, | ||
@@ -126,2 +170,16 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(ListViewController.prototype, "elementWidth", { | ||
get: function () { | ||
return this._elementWidth; | ||
}, | ||
set: function (v) { | ||
this._elementWidth = v; | ||
if (this.horizontalMode) { | ||
this.itemsPageSize = Math.floor(v / this.itemPxHeight); | ||
this.itemPxWidthCalculated = this.calcWidthOfElement(); | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(ListViewController.prototype, "itemFocused", { | ||
@@ -144,3 +202,16 @@ get: function () { | ||
set: function (value) { | ||
this._items = value; | ||
if (typeof (value) !== "undefined") { | ||
try { | ||
if (this.splitMode) { | ||
this._items = value; | ||
this.splitColumn = value.length; | ||
return; | ||
} | ||
this._items = [value]; | ||
this.splitColumn = 1; | ||
} | ||
catch (e) { | ||
this.logger.error("ERROR in setter of items: ", e); | ||
} | ||
} | ||
}, | ||
@@ -165,2 +236,17 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(ListViewController.prototype, "splitMode", { | ||
get: function () { | ||
if (this._splitMode) { | ||
return this._splitMode; | ||
} | ||
return false; | ||
}, | ||
set: function (value) { | ||
if (value !== this._splitMode) { | ||
this._splitMode = value; | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(ListViewController.prototype, "logger", { | ||
@@ -190,3 +276,8 @@ get: function () { | ||
if (typeof (v) !== "undefined" && this._itemsPageSize !== v) { | ||
this._itemsPageSize = v; | ||
if (v > Math.floor(((this.horizontalMode ? this.elementWidth : this.elementHeight) * (this.splitColumn ? this.splitColumn : 1)) | ||
/ this.itemPxHeight)) { | ||
return; | ||
} | ||
this._itemsPageSize = v * (this.splitColumn ? this.splitColumn : 1); | ||
this.itemPxWidthCalculated = this.calcWidthOfElement(); | ||
} | ||
@@ -245,2 +336,10 @@ }, | ||
}; | ||
ListViewController.prototype.calcWidthOfElement = function () { | ||
try { | ||
return (this.elementWidth / (this.itemsPageSize / this.splitColumn)); | ||
} | ||
catch (error) { | ||
return this.itemPxHeight; | ||
} | ||
}; | ||
/** | ||
@@ -322,5 +421,5 @@ * manage all shortcut events on this directive | ||
*/ | ||
ListViewController.prototype.selectItem = function (index, event) { | ||
ListViewController.prototype.selectItem = function (index, event, indexSplit) { | ||
if (this.callbackListviewObjects) { | ||
this.callbackListviewObjects({ pos: index, event: event }); | ||
this.callbackListviewObjects({ pos: index, event: event, index: indexSplit }); | ||
} | ||
@@ -351,5 +450,7 @@ }; | ||
showFocused: "<?", | ||
horizontalMode: "<?", | ||
callbackListviewObjects: "&", | ||
overrideShortcuts: "<?", | ||
theme: "<?" | ||
theme: "<?", | ||
splitMode: "<?" | ||
}, | ||
@@ -360,2 +461,3 @@ compile: function () { | ||
$registrationProvider.filter("qstatusfilter", statusFilter_1.qStatusFilter); | ||
$registrationProvider.filter("qselectedfilter", statusFilter_1.qSelectedFilter); | ||
} | ||
@@ -362,0 +464,0 @@ }; |
@@ -24,3 +24,3 @@ (function (factory) { | ||
*/ | ||
function DragableBar(element) { | ||
function DragableBar(element, horizontalMode) { | ||
this.position = 0; | ||
@@ -30,6 +30,8 @@ this.height = 0; | ||
this.elementDragable = this.element.children().children(); | ||
this.elementDragable[0].style.height = "12px"; | ||
this.elementDragable[0].style.display = "normal"; | ||
this.elementDragable[0].style.top = "0px"; | ||
this.height = element.children().height(); | ||
this.horizontalMode = false; | ||
if (typeof (horizontalMode) !== "undefined") { | ||
this.horizontalMode = horizontalMode; | ||
} | ||
this.height = this.horizontalMode ? element.children().width() : element.children().height(); | ||
this.watchResize(40); | ||
@@ -52,2 +54,20 @@ } | ||
}); | ||
Object.defineProperty(DragableBar.prototype, "horizontalMode", { | ||
get: function () { | ||
return this._horizontalMode; | ||
}, | ||
set: function (v) { | ||
if (v !== this._horizontalMode) { | ||
this._horizontalMode = v; | ||
if (v) { | ||
this.setHorizontalProperties(); | ||
} | ||
else { | ||
this.setVerticalProperties(); | ||
} | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -60,5 +80,5 @@ * checks the size of the container and resets it | ||
setInterval(function () { | ||
if (_this.element.children().height() !== _this.height) { | ||
if (_this.horizontalMode ? _this.element.children().width() : _this.element.children().height() !== _this.height) { | ||
try { | ||
_this.height = _this.element.children().height(); | ||
_this.height = _this.horizontalMode ? _this.element.children().width() : _this.element.children().height(); | ||
} | ||
@@ -78,8 +98,27 @@ catch (err) { | ||
if (height < 12) { | ||
this.elementDragable[0].style.height = 12 + "px"; | ||
if (this.horizontalMode) { | ||
this.elementDragable[0].style.width = 12 + "px"; | ||
this.elementDragable[0].style.height = 11 + "px"; | ||
} | ||
else { | ||
this.elementDragable[0].style.height = 12 + "px"; | ||
this.elementDragable[0].style.width = 11 + "px"; | ||
} | ||
} | ||
else { | ||
this.elementDragable[0].style.height = height + "px"; | ||
if (this.horizontalMode) { | ||
this.elementDragable[0].style.width = height + "px"; | ||
this.elementDragable[0].style.height = 11 + "px"; | ||
} | ||
else { | ||
this.elementDragable[0].style.height = height + "px"; | ||
this.elementDragable[0].style.width = 11 + "px"; | ||
} | ||
} | ||
return this.elementDragable[0].style.height; | ||
if (this.horizontalMode) { | ||
return this.elementDragable[0].style.width; | ||
} | ||
else { | ||
return this.elementDragable[0].style.height; | ||
} | ||
} | ||
@@ -95,3 +134,8 @@ catch (e) { | ||
try { | ||
return +this.elementDragable[0].style.height.replace("px", ""); | ||
if (this.horizontalMode) { | ||
return +this.elementDragable[0].style.width.replace("px", ""); | ||
} | ||
else { | ||
return +this.elementDragable[0].style.height.replace("px", ""); | ||
} | ||
} | ||
@@ -130,7 +174,17 @@ catch (err) { | ||
else if (this.position + posMove < 0) { | ||
this.elementDragable[0].style.top = "0px"; | ||
if (this.horizontalMode) { | ||
this.elementDragable[0].style.left = "0px"; | ||
} | ||
else { | ||
this.elementDragable[0].style.top = "0px"; | ||
} | ||
this.position = 0; | ||
} | ||
else if (this.position + posMove > this.height - this.getHeight()) { | ||
this.elementDragable[0].style.top = this.height - this.getHeight() + "px"; | ||
if (this.horizontalMode) { | ||
this.elementDragable[0].style.left = this.height - this.getHeight() + "px"; | ||
} | ||
else { | ||
this.elementDragable[0].style.top = this.height - this.getHeight() + "px"; | ||
} | ||
this.position = this.height - this.getHeight(); | ||
@@ -140,3 +194,8 @@ } | ||
this.position += posMove; | ||
this.elementDragable[0].style.top = this.position + "px"; | ||
if (this.horizontalMode) { | ||
this.elementDragable[0].style.left = this.position + "px"; | ||
} | ||
else { | ||
this.elementDragable[0].style.top = this.position + "px"; | ||
} | ||
} | ||
@@ -149,7 +208,12 @@ } | ||
/** | ||
* returns the top space as number | ||
* returns the top/left space as number | ||
*/ | ||
DragableBar.prototype.getTop = function () { | ||
try { | ||
return parseInt(this.elementDragable[0].style.top.substring(0, this.elementDragable[0].style.top.length - 2), 10); | ||
if (this.horizontalMode) { | ||
return parseInt(this.elementDragable[0].style.left.substring(0, this.elementDragable[0].style.left.length - 2), 10); | ||
} | ||
else { | ||
return parseInt(this.elementDragable[0].style.top.substring(0, this.elementDragable[0].style.top.length - 2), 10); | ||
} | ||
} | ||
@@ -162,7 +226,25 @@ catch (err) { | ||
/** | ||
* reset height to childreen heigt | ||
* name | ||
*/ | ||
DragableBar.prototype.resetHeight = function () { | ||
this.height = this.element.children().height(); | ||
DragableBar.prototype.setHorizontalProperties = function () { | ||
try { | ||
this.elementDragable[0].style.width = "11px"; | ||
this.elementDragable[0].style.left = "0px"; | ||
} | ||
catch (error) { | ||
this.logger.error("Error in setHorizontalProperties", error); | ||
} | ||
}; | ||
/** | ||
* name | ||
*/ | ||
DragableBar.prototype.setVerticalProperties = function () { | ||
try { | ||
this.elementDragable[0].style.height = "12px"; | ||
this.elementDragable[0].style.top = "0px"; | ||
} | ||
catch (error) { | ||
this.logger.error("Error in setVerticalProperties", error); | ||
} | ||
}; | ||
return DragableBar; | ||
@@ -179,2 +261,3 @@ }()); | ||
var _this = this; | ||
this.toggleSetPositionBar = true; | ||
//#endregion | ||
@@ -201,4 +284,9 @@ //#region itemsPageTop | ||
try { | ||
startY = event.screenY; | ||
topPositionOfDragElement = parseInt(_this.dragElement[0].style.top.substring(0, _this.dragElement[0].style.top.length - 2), 10); | ||
startY = _this.horizontalMode ? event.screenX : event.screenY; | ||
if (_this.horizontalMode) { | ||
topPositionOfDragElement = parseInt(_this.dragElement[0].style.left.substring(0, _this.dragElement[0].style.left.length - 2), 10); | ||
} | ||
else { | ||
topPositionOfDragElement = parseInt(_this.dragElement[0].style.top.substring(0, _this.dragElement[0].style.top.length - 2), 10); | ||
} | ||
} | ||
@@ -219,2 +307,20 @@ catch (err) { | ||
}; | ||
Object.defineProperty(ScrollBarController.prototype, "horizontalMode", { | ||
get: function () { | ||
if (this._horizontalMode) { | ||
return this._horizontalMode; | ||
} | ||
return false; | ||
}, | ||
set: function (value) { | ||
if (value !== this._horizontalMode) { | ||
this._horizontalMode = value; | ||
if (typeof (this.dragableBarElement) !== "undefined") { | ||
this.dragableBarElement.horizontalMode = value; | ||
} | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(ScrollBarController.prototype, "itemsPageTop", { | ||
@@ -238,5 +344,9 @@ get: function () { | ||
if (this.element) { | ||
var newPostion = (this.element.height() - this.dragableBarElement.getHeight()) / | ||
(this.itemsCount - this.itemsPageSize) * (value - oldVal); | ||
this.dragableBarElement.setPosition(newPostion); | ||
var newPostion = ((this.horizontalMode ? this.element.width() : this.element.height()) | ||
- this.dragableBarElement.getHeight()) | ||
/ (this.itemsCount - this.itemsPageSize) * (value - oldVal); | ||
if (this.toggleSetPositionBar) { | ||
this.dragableBarElement.setPosition(newPostion); | ||
} | ||
this.toggleSetPositionBar = true; | ||
} | ||
@@ -329,3 +439,5 @@ if (this.timeout) { | ||
_this.dragableBarElement.setVisible(_this.itemsCount > _this.itemsPageSize); | ||
_this.dragableBarElement.setHeight(_this.element.height() * _this.itemsPageSize / _this.itemsCount); | ||
_this.dragableBarElement.setHeight((_this.horizontalMode ? _this.element.width() : _this.element.height()) | ||
* _this.itemsPageSize | ||
/ _this.itemsCount); | ||
} | ||
@@ -341,10 +453,13 @@ catch (err) { | ||
* @param upOrMove hint if mouse is moved or mouse up | ||
* @param startY start position of the mouse Movement | ||
* @param top the top position of the dragable element | ||
* @param startPosition start position of the mouse Movement | ||
* @param startDiff the top position of the dragable element | ||
*/ | ||
ScrollBarController.prototype.mousehandle = function (event, upOrMove, startY, top) { | ||
ScrollBarController.prototype.mousehandle = function (event, upOrMove, startPosition, startDiff) { | ||
try { | ||
this.dragableBarElement.setPosition((event.screenY - startY) - top); | ||
this.dragableBarElement.setPosition(((this.horizontalMode ? event.screenX : event.screenY) - startPosition) - startDiff); | ||
var newPosition = (this.dragableBarElement.getTop() / | ||
((this.element.height() - this.dragableBarElement.getHeight()) / (this.itemsCount - this.itemsPageSize))); | ||
(((this.horizontalMode ? this.element.width() : this.element.height()) | ||
- this.dragableBarElement.getHeight()) | ||
/ (this.itemsCount - this.itemsPageSize))); | ||
this.toggleSetPositionBar = false; | ||
this.itemsPageTop = Math.round(newPosition); | ||
@@ -389,3 +504,3 @@ if (upOrMove === "mouseup") { | ||
itemsPageSize: "<", | ||
vertical: "<", | ||
horizontalMode: "<?", | ||
show: "<", | ||
@@ -392,0 +507,0 @@ theme: "<?" |
@@ -5,1 +5,5 @@ /** | ||
export declare function qStatusFilter(): (elementStatus: string) => "optional" | "selected" | "alternative" | "excluded" | "selectedExcluded" | "locked" | "option"; | ||
/** | ||
* Filter to check which item is selected | ||
*/ | ||
export declare function qSelectedFilter(): (elementStatus: string) => boolean; |
@@ -36,2 +36,19 @@ (function (factory) { | ||
exports.qStatusFilter = qStatusFilter; | ||
/** | ||
* Filter to check which item is selected | ||
*/ | ||
function qSelectedFilter() { | ||
"use strict"; | ||
return function (elementStatus) { | ||
switch (elementStatus) { | ||
case "S": | ||
return true; | ||
case "XS": | ||
return true; | ||
default: | ||
return false; | ||
} | ||
}; | ||
} | ||
exports.qSelectedFilter = qSelectedFilter; | ||
}); |
@@ -246,3 +246,3 @@ var __extends = (this && this.__extends) || (function () { | ||
.catch(function (e) { | ||
_this.logger.error("ERROR", e); | ||
_this.logger.error("ERROR in getDataPage", e); | ||
reject(e); | ||
@@ -263,3 +263,3 @@ }); | ||
}).catch(function (e) { | ||
_this.logger.error("error", e); | ||
_this.logger.error("error in searchFor", e); | ||
reject(); | ||
@@ -327,3 +327,3 @@ }); | ||
.catch(function (e) { | ||
_this.logger.error("ERROR", e); | ||
_this.logger.error("ERROR in getDataPage", e); | ||
reject(e); | ||
@@ -344,3 +344,3 @@ }); | ||
}).catch(function (e) { | ||
_this.logger.error("error", e); | ||
_this.logger.error("error in searchFor", e); | ||
reject(); | ||
@@ -347,0 +347,0 @@ }); |
@@ -413,2 +413,2 @@ var __extends = (this && this.__extends) || (function () { | ||
}); | ||
//#endregion | ||
//#endregion |
{ | ||
"name": "davinci.js", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"license": "MIT", | ||
@@ -18,3 +18,3 @@ "description": "Framework for visualisation extensions", | ||
"devDependencies": { | ||
"@types/angular": "1.6.41", | ||
"@types/angular": "1.6.43", | ||
"@types/chai": "^4.1.1", | ||
@@ -21,0 +21,0 @@ "@types/jquery": "3.3.0", |
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
325133
89
7838
0