nk-controls
Advanced tools
Comparing version 1.1.11 to 2.1.1
@@ -1,1 +0,1 @@ | ||
export { SortDirectionEnum } from './SortDirectionEnum'; | ||
export * from './public-api'; |
@@ -1,2 +0,7 @@ | ||
export { SortDirectionEnum } from './SortDirectionEnum'; | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./public-api")); | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
export { SortDirectionEnum } from './SortDirectionEnum'; | ||
export * from './public-api'; |
@@ -1,4 +0,4 @@ | ||
export enum SortDirectionEnum { | ||
export enum SortDirectionEnum { | ||
Ascending = 0, | ||
Descending | ||
} |
@@ -1,2 +0,7 @@ | ||
export * from './public-api'; | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./public-api")); | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
export * from './public-api'; | ||
export * from './public-api'; |
@@ -1,20 +0,22 @@ | ||
export var UP_ARROW = 38; | ||
export var DOWN_ARROW = 40; | ||
export var RIGHT_ARROW = 39; | ||
export var LEFT_ARROW = 37; | ||
export var PAGE_UP = 33; | ||
export var PAGE_DOWN = 34; | ||
export var HOME = 36; | ||
export var END = 35; | ||
export var ENTER = 13; | ||
export var SPACE = 32; | ||
export var TAB = 9; | ||
export var ESCAPE = 27; | ||
export var BACKSPACE = 8; | ||
export var DELETE = 46; | ||
export var A = 65; | ||
export var Z = 90; | ||
export var ZERO = 48; | ||
export var NINE = 91; | ||
export var COMMA = 188; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UP_ARROW = 38; | ||
exports.DOWN_ARROW = 40; | ||
exports.RIGHT_ARROW = 39; | ||
exports.LEFT_ARROW = 37; | ||
exports.PAGE_UP = 33; | ||
exports.PAGE_DOWN = 34; | ||
exports.HOME = 36; | ||
exports.END = 35; | ||
exports.ENTER = 13; | ||
exports.SPACE = 32; | ||
exports.TAB = 9; | ||
exports.ESCAPE = 27; | ||
exports.BACKSPACE = 8; | ||
exports.DELETE = 46; | ||
exports.A = 65; | ||
exports.Z = 90; | ||
exports.ZERO = 48; | ||
exports.NINE = 91; | ||
exports.COMMA = 188; | ||
//# sourceMappingURL=keyCodes.js.map |
@@ -1,2 +0,2 @@ | ||
export const UP_ARROW = 38; | ||
export const UP_ARROW = 38; | ||
export const DOWN_ARROW = 40; | ||
@@ -3,0 +3,0 @@ export const RIGHT_ARROW = 39; |
@@ -1,6 +0,13 @@ | ||
export { NkDimensions } from './nkDimensions'; | ||
export { NkOptionsPosition } from './nkOptionsPosition'; | ||
export { NkPositionBuilder } from './nkPositionBuilder'; | ||
export { NkWithinInfo } from './nkWithinInfo'; | ||
export { Offset } from './offset'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var nkDimensions_1 = require("./nkDimensions"); | ||
exports.NkDimensions = nkDimensions_1.NkDimensions; | ||
var nkOptionsPosition_1 = require("./nkOptionsPosition"); | ||
exports.NkOptionsPosition = nkOptionsPosition_1.NkOptionsPosition; | ||
var nkPositionBuilder_1 = require("./nkPositionBuilder"); | ||
exports.NkPositionBuilder = nkPositionBuilder_1.NkPositionBuilder; | ||
var nkWithinInfo_1 = require("./nkWithinInfo"); | ||
exports.NkWithinInfo = nkWithinInfo_1.NkWithinInfo; | ||
var offset_1 = require("./offset"); | ||
exports.Offset = offset_1.Offset; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
export { NkDimensions } from './nkDimensions'; | ||
export { NkDimensions } from './nkDimensions'; | ||
export { NkOptionsPosition } from './nkOptionsPosition'; | ||
@@ -3,0 +3,0 @@ export { NkPositionBuilder } from './nkPositionBuilder'; |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var NkDimensions = /** @class */ (function () { | ||
@@ -9,3 +11,3 @@ function NkDimensions(width, height, offset) { | ||
}()); | ||
export { NkDimensions }; | ||
exports.NkDimensions = NkDimensions; | ||
//# sourceMappingURL=nkDimensions.js.map |
@@ -1,2 +0,2 @@ | ||
import { Offset } from './offset'; | ||
import { Offset } from './offset'; | ||
@@ -3,0 +3,0 @@ export class NkDimensions { |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var NkOptionsPosition = /** @class */ (function () { | ||
@@ -6,3 +8,3 @@ function NkOptionsPosition() { | ||
}()); | ||
export { NkOptionsPosition }; | ||
exports.NkOptionsPosition = NkOptionsPosition; | ||
//# sourceMappingURL=nkOptionsPosition.js.map |
@@ -1,2 +0,2 @@ | ||
export class NkOptionsPosition { | ||
export class NkOptionsPosition { | ||
public within: HTMLElement; | ||
@@ -3,0 +3,0 @@ public at: string; |
@@ -1,4 +0,6 @@ | ||
import { Offset } from './offset'; | ||
import { NkDimensions } from './nkDimensions'; | ||
import { NkWithinInfo } from './nkWithinInfo'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var offset_1 = require("./offset"); | ||
var nkDimensions_1 = require("./nkDimensions"); | ||
var nkWithinInfo_1 = require("./nkWithinInfo"); | ||
var NkPositionBuilder = /** @class */ (function () { | ||
@@ -226,3 +228,3 @@ function NkPositionBuilder(controlElement) { | ||
var el = elem; | ||
return new NkDimensions(el.offsetWidth, el.offsetHeight, new Offset(el.offsetTop, el.offsetLeft)); | ||
return new nkDimensions_1.NkDimensions(el.offsetWidth, el.offsetHeight, new offset_1.Offset(el.offsetTop, el.offsetLeft)); | ||
}; | ||
@@ -248,5 +250,5 @@ ; | ||
} | ||
var offset = new Offset(offsetTop, offsetLeft); | ||
var dimensions = new NkDimensions(offsetWidth, offsetHeight, offset); | ||
var withinInfo = new NkWithinInfo(element, scrollLeft, scrollTop, dimensions); | ||
var offset = new offset_1.Offset(offsetTop, offsetLeft); | ||
var dimensions = new nkDimensions_1.NkDimensions(offsetWidth, offsetHeight, offset); | ||
var withinInfo = new nkWithinInfo_1.NkWithinInfo(element, scrollLeft, scrollTop, dimensions); | ||
return withinInfo; | ||
@@ -274,4 +276,4 @@ }; | ||
var height = hasOverflowX ? this.cachedScrollbarWidth : 0; | ||
var offset = new Offset(0, 0); | ||
var dimensions = new NkDimensions(width, height, offset); | ||
var offset = new offset_1.Offset(0, 0); | ||
var dimensions = new nkDimensions_1.NkDimensions(width, height, offset); | ||
return dimensions; | ||
@@ -301,3 +303,3 @@ }; | ||
}()); | ||
export { NkPositionBuilder }; | ||
exports.NkPositionBuilder = NkPositionBuilder; | ||
//# sourceMappingURL=nkPositionBuilder.js.map |
@@ -1,2 +0,2 @@ | ||
import { Offset } from './offset'; | ||
import { Offset } from './offset'; | ||
import { NkDimensions } from './nkDimensions'; | ||
@@ -3,0 +3,0 @@ import { NkWithinInfo } from './nkWithinInfo'; |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var NkWithinInfo = /** @class */ (function () { | ||
@@ -17,3 +19,3 @@ function NkWithinInfo(element, scrollLeft, scrollTop, dimensions) { | ||
}()); | ||
export { NkWithinInfo }; | ||
exports.NkWithinInfo = NkWithinInfo; | ||
//# sourceMappingURL=nkWithinInfo.js.map |
@@ -1,2 +0,2 @@ | ||
import { NkDimensions } from './nkDimensions'; | ||
import { NkDimensions } from './nkDimensions'; | ||
@@ -3,0 +3,0 @@ export class NkWithinInfo { |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Offset = /** @class */ (function () { | ||
@@ -8,3 +10,3 @@ function Offset(offsetTop, offsetLeft) { | ||
}()); | ||
export { Offset }; | ||
exports.Offset = Offset; | ||
//# sourceMappingURL=offset.js.map |
@@ -1,2 +0,2 @@ | ||
export class Offset { | ||
export class Offset { | ||
public top: number; | ||
@@ -3,0 +3,0 @@ public left: number; |
@@ -1,5 +0,10 @@ | ||
export * from './enums'; | ||
export * from './position'; | ||
export * from './utils'; | ||
export * from './keyCodes'; | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./enums")); | ||
__export(require("./position")); | ||
__export(require("./utils")); | ||
__export(require("./keyCodes")); | ||
//# sourceMappingURL=public-api.js.map |
@@ -0,0 +0,0 @@ export * from './enums'; |
@@ -1,3 +0,7 @@ | ||
export { ObjectHelper } from './objectHelper'; | ||
export { ScrollHelper } from './scrollHelper'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var objectHelper_1 = require("./objectHelper"); | ||
exports.ObjectHelper = objectHelper_1.ObjectHelper; | ||
var scrollHelper_1 = require("./scrollHelper"); | ||
exports.ScrollHelper = scrollHelper_1.ScrollHelper; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
export { ObjectHelper } from './objectHelper'; | ||
export { ObjectHelper } from './objectHelper'; | ||
export { ScrollHelper } from './scrollHelper'; |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var ObjectHelper = /** @class */ (function () { | ||
@@ -68,3 +70,3 @@ function ObjectHelper() { | ||
}()); | ||
export { ObjectHelper }; | ||
exports.ObjectHelper = ObjectHelper; | ||
//# sourceMappingURL=objectHelper.js.map |
@@ -1,2 +0,2 @@ | ||
export class ObjectHelper { | ||
export class ObjectHelper { | ||
@@ -3,0 +3,0 @@ baseExtend(dst:any, objs:any, deep:any):any{ |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var ScrollHelper = /** @class */ (function () { | ||
@@ -36,3 +38,3 @@ function ScrollHelper() { | ||
}()); | ||
export { ScrollHelper }; | ||
exports.ScrollHelper = ScrollHelper; | ||
//# sourceMappingURL=scrollHelper.js.map |
@@ -1,2 +0,2 @@ | ||
export class ScrollHelper { | ||
export class ScrollHelper { | ||
@@ -3,0 +3,0 @@ isRegExp(value: any): boolean { |
@@ -1,2 +0,7 @@ | ||
export * from './public-api'; | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./public-api")); | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
export * from './public-api'; | ||
export * from './public-api'; |
{ | ||
"name": "nk-controls", | ||
"version": "1.1.11", | ||
"version": "2.1.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "angular5 web controls dropDownList ribbon", |
@@ -1,4 +0,9 @@ | ||
export * from './core'; | ||
export * from './select'; | ||
export * from './ribbon'; | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./core")); | ||
__export(require("./select")); | ||
__export(require("./ribbon")); | ||
//# sourceMappingURL=public-api.js.map |
export * from './core'; | ||
export * from './select'; | ||
export * from './ribbon'; |
@@ -1,2 +0,7 @@ | ||
export * from './public-api'; | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./public-api")); | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
export * from './public-api'; | ||
export * from './public-api'; |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
export { IRibbonOrderService } from './iRibbonOrderService'; | ||
export { IRibbonOrderService } from './iRibbonOrderService'; | ||
export { IRibbonService } from './iRibbonService'; |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=iRibbonOrderService.js.map |
@@ -1,4 +0,4 @@ | ||
import { NkRibbonOrder } from './../models/nkRibbon.order'; | ||
import { NkRibbonOrder } from './../models/nkRibbon.order'; | ||
export interface IRibbonOrderService { | ||
applyOrder(sender: NkRibbonOrder): void; | ||
} |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=iRibbonService.js.map |
@@ -1,2 +0,2 @@ | ||
import { NkRibbon } from './../nkRibbon.component'; | ||
import { NkRibbon } from './../nkRibbon.component'; | ||
import { Observable } from 'rxjs/rx'; | ||
@@ -3,0 +3,0 @@ import { UrlTree } from '@angular/router'; |
@@ -1,10 +0,21 @@ | ||
export { NkRibbonBaseSelector } from './nkRibbon.baseSelector'; | ||
export { NkRibbonData } from './nkRibbon.data'; | ||
export { NkRibbonEvents } from './nkRibbon.events'; | ||
export { NkRibbonItem } from './nkRibbon.item'; | ||
export { NkRibbonOptions } from './nkRibbon.options'; | ||
export { NkRibbonOrder } from './nkRibbon.order'; | ||
export { NkRibbonParams } from './nkRibbon.params'; | ||
export { NkRibbonService } from './nkRibbon.service'; | ||
export { NkRibbonSortItem } from './nkRibbon.sortItem'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var nkRibbon_baseSelector_1 = require("./nkRibbon.baseSelector"); | ||
exports.NkRibbonBaseSelector = nkRibbon_baseSelector_1.NkRibbonBaseSelector; | ||
var nkRibbon_data_1 = require("./nkRibbon.data"); | ||
exports.NkRibbonData = nkRibbon_data_1.NkRibbonData; | ||
var nkRibbon_events_1 = require("./nkRibbon.events"); | ||
exports.NkRibbonEvents = nkRibbon_events_1.NkRibbonEvents; | ||
var nkRibbon_item_1 = require("./nkRibbon.item"); | ||
exports.NkRibbonItem = nkRibbon_item_1.NkRibbonItem; | ||
var nkRibbon_options_1 = require("./nkRibbon.options"); | ||
exports.NkRibbonOptions = nkRibbon_options_1.NkRibbonOptions; | ||
var nkRibbon_order_1 = require("./nkRibbon.order"); | ||
exports.NkRibbonOrder = nkRibbon_order_1.NkRibbonOrder; | ||
var nkRibbon_params_1 = require("./nkRibbon.params"); | ||
exports.NkRibbonParams = nkRibbon_params_1.NkRibbonParams; | ||
var nkRibbon_service_1 = require("./nkRibbon.service"); | ||
exports.NkRibbonService = nkRibbon_service_1.NkRibbonService; | ||
var nkRibbon_sortItem_1 = require("./nkRibbon.sortItem"); | ||
exports.NkRibbonSortItem = nkRibbon_sortItem_1.NkRibbonSortItem; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
export { NkRibbonBaseSelector } from './nkRibbon.baseSelector'; | ||
export { NkRibbonBaseSelector } from './nkRibbon.baseSelector'; | ||
export { NkRibbonData } from './nkRibbon.data'; | ||
@@ -3,0 +3,0 @@ export { NkRibbonEvents } from './nkRibbon.events'; |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var NkRibbonBaseSelector = /** @class */ (function () { | ||
@@ -6,3 +8,3 @@ function NkRibbonBaseSelector() { | ||
}()); | ||
export { NkRibbonBaseSelector }; | ||
exports.NkRibbonBaseSelector = NkRibbonBaseSelector; | ||
//# sourceMappingURL=nkRibbon.baseSelector.js.map |
@@ -1,2 +0,2 @@ | ||
import { NkRibbonSortItem } from './nkRibbon.sortItem'; | ||
import { NkRibbonSortItem } from './nkRibbon.sortItem'; | ||
export class NkRibbonBaseSelector { | ||
@@ -3,0 +3,0 @@ public view: string; |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var NkRibbonData = /** @class */ (function () { | ||
@@ -22,3 +24,3 @@ function NkRibbonData(count, items) { | ||
}()); | ||
export { NkRibbonData }; | ||
exports.NkRibbonData = NkRibbonData; | ||
//# sourceMappingURL=nkRibbon.data.js.map |
@@ -1,2 +0,2 @@ | ||
export class NkRibbonData { | ||
export class NkRibbonData { | ||
@@ -3,0 +3,0 @@ private _count: number; |
@@ -1,16 +0,18 @@ | ||
import { EventEmitter } from '@angular/core'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_1 = require("@angular/core"); | ||
var NkRibbonEvents = /** @class */ (function () { | ||
function NkRibbonEvents() { | ||
this.onBeforeLoadData = new EventEmitter(); | ||
this.onAfterLoadData = new EventEmitter(); | ||
this.onErrorLoadData = new EventEmitter(); | ||
this.onSearchApply = new EventEmitter(); | ||
this.onFilterApply = new EventEmitter(); | ||
this.onOrderApply = new EventEmitter(); | ||
this.onInitialize = new EventEmitter(); | ||
this.onScroll = new EventEmitter(); | ||
this.onBeforeLoadData = new core_1.EventEmitter(); | ||
this.onAfterLoadData = new core_1.EventEmitter(); | ||
this.onErrorLoadData = new core_1.EventEmitter(); | ||
this.onSearchApply = new core_1.EventEmitter(); | ||
this.onFilterApply = new core_1.EventEmitter(); | ||
this.onOrderApply = new core_1.EventEmitter(); | ||
this.onInitialize = new core_1.EventEmitter(); | ||
this.onScroll = new core_1.EventEmitter(); | ||
} | ||
return NkRibbonEvents; | ||
}()); | ||
export { NkRibbonEvents }; | ||
exports.NkRibbonEvents = NkRibbonEvents; | ||
//# sourceMappingURL=nkRibbon.events.js.map |
@@ -1,2 +0,2 @@ | ||
import { | ||
import { | ||
EventEmitter | ||
@@ -3,0 +3,0 @@ } from '@angular/core'; |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var NkRibbonItem = /** @class */ (function () { | ||
@@ -48,3 +50,3 @@ function NkRibbonItem(index) { | ||
}()); | ||
export { NkRibbonItem }; | ||
exports.NkRibbonItem = NkRibbonItem; | ||
//# sourceMappingURL=nkRibbon.item.js.map |
@@ -1,2 +0,2 @@ | ||
import { | ||
import { | ||
ElementRef | ||
@@ -3,0 +3,0 @@ } from '@angular/core'; |
export declare class NkRibbonOptions { | ||
private _includeItemTemplate; | ||
includeItemTemplate: string; | ||
private _itemTemplateString; | ||
itemTemplateString: string; | ||
private _isDynamicSize; | ||
@@ -20,15 +16,3 @@ isDynamicSize: boolean; | ||
pageSize: number; | ||
private _loadProgressBarTemplatePath; | ||
loadProgressBarTemplatePath: string; | ||
private _progressBarTemplateString; | ||
progressBarTemplateString: string; | ||
private _noDataTemplatePath; | ||
noDataTemplatePath: string; | ||
private _noDataTemplateString; | ||
noDataTemplateString: string; | ||
private _errorTemplatePath; | ||
errorTemplatePath: string; | ||
private _errorTemplateString; | ||
errorTemplateString: string; | ||
constructor(); | ||
} |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var NkRibbonOptions = /** @class */ (function () { | ||
@@ -5,22 +7,2 @@ function NkRibbonOptions() { | ||
} | ||
Object.defineProperty(NkRibbonOptions.prototype, "includeItemTemplate", { | ||
get: function () { | ||
return this._includeItemTemplate; | ||
}, | ||
set: function (val) { | ||
this._includeItemTemplate = val; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(NkRibbonOptions.prototype, "itemTemplateString", { | ||
get: function () { | ||
return this._itemTemplateString; | ||
}, | ||
set: function (val) { | ||
this._itemTemplateString = val; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(NkRibbonOptions.prototype, "isDynamicSize", { | ||
@@ -96,65 +78,5 @@ get: function () { | ||
}); | ||
Object.defineProperty(NkRibbonOptions.prototype, "loadProgressBarTemplatePath", { | ||
get: function () { | ||
return this._loadProgressBarTemplatePath; | ||
}, | ||
set: function (val) { | ||
this._loadProgressBarTemplatePath = val; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(NkRibbonOptions.prototype, "progressBarTemplateString", { | ||
get: function () { | ||
return this._progressBarTemplateString; | ||
}, | ||
set: function (val) { | ||
this._progressBarTemplateString = val; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(NkRibbonOptions.prototype, "noDataTemplatePath", { | ||
get: function () { | ||
return this._noDataTemplatePath; | ||
}, | ||
set: function (val) { | ||
this._noDataTemplatePath = val; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(NkRibbonOptions.prototype, "noDataTemplateString", { | ||
get: function () { | ||
return this._noDataTemplateString; | ||
}, | ||
set: function (val) { | ||
this._noDataTemplateString = val; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(NkRibbonOptions.prototype, "errorTemplatePath", { | ||
get: function () { | ||
return this._errorTemplatePath; | ||
}, | ||
set: function (val) { | ||
this._errorTemplatePath = val; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(NkRibbonOptions.prototype, "errorTemplateString", { | ||
get: function () { | ||
return this._errorTemplateString; | ||
}, | ||
set: function (val) { | ||
this._errorTemplateString = val; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
return NkRibbonOptions; | ||
}()); | ||
export { NkRibbonOptions }; | ||
exports.NkRibbonOptions = NkRibbonOptions; | ||
//# sourceMappingURL=nkRibbon.options.js.map |
@@ -1,19 +0,3 @@ | ||
export class NkRibbonOptions { | ||
export class NkRibbonOptions { | ||
private _includeItemTemplate: string; | ||
get includeItemTemplate(): string { | ||
return this._includeItemTemplate; | ||
} | ||
set includeItemTemplate(val: string) { | ||
this._includeItemTemplate = val; | ||
} | ||
private _itemTemplateString: string; | ||
get itemTemplateString(): string { | ||
return this._itemTemplateString; | ||
} | ||
set itemTemplateString(val: string) { | ||
this._itemTemplateString = val; | ||
} | ||
private _isDynamicSize: boolean; | ||
@@ -74,51 +58,3 @@ get isDynamicSize(): boolean { | ||
} | ||
private _loadProgressBarTemplatePath: string; | ||
get loadProgressBarTemplatePath(): string { | ||
return this._loadProgressBarTemplatePath; | ||
} | ||
set loadProgressBarTemplatePath(val: string) { | ||
this._loadProgressBarTemplatePath = val; | ||
} | ||
private _progressBarTemplateString: string; | ||
get progressBarTemplateString(): string { | ||
return this._progressBarTemplateString; | ||
} | ||
set progressBarTemplateString(val: string) { | ||
this._progressBarTemplateString = val; | ||
} | ||
private _noDataTemplatePath: string; | ||
get noDataTemplatePath(): string { | ||
return this._noDataTemplatePath; | ||
} | ||
set noDataTemplatePath(val: string) { | ||
this._noDataTemplatePath = val; | ||
} | ||
private _noDataTemplateString: string; | ||
get noDataTemplateString(): string { | ||
return this._noDataTemplateString; | ||
} | ||
set noDataTemplateString(val: string) { | ||
this._noDataTemplateString = val; | ||
} | ||
private _errorTemplatePath: string; | ||
get errorTemplatePath(): string { | ||
return this._errorTemplatePath; | ||
} | ||
set errorTemplatePath(val: string) { | ||
this._errorTemplatePath = val; | ||
} | ||
private _errorTemplateString: string; | ||
get errorTemplateString(): string { | ||
return this._errorTemplateString; | ||
} | ||
set errorTemplateString(val: string) { | ||
this._errorTemplateString = val; | ||
} | ||
constructor() { | ||
@@ -125,0 +61,0 @@ this.isDynamicSize = false; |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var NkRibbonOrder = /** @class */ (function () { | ||
@@ -14,3 +16,3 @@ function NkRibbonOrder() { | ||
}()); | ||
export { NkRibbonOrder }; | ||
exports.NkRibbonOrder = NkRibbonOrder; | ||
//# sourceMappingURL=nkRibbon.order.js.map |
@@ -1,2 +0,2 @@ | ||
import { NkRibbonSortItem } from './nkRibbon.sortItem'; | ||
import { NkRibbonSortItem } from './nkRibbon.sortItem'; | ||
@@ -3,0 +3,0 @@ export class NkRibbonOrder { |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
@@ -11,3 +12,4 @@ var extendStatics = Object.setPrototypeOf || | ||
})(); | ||
import { NkRibbonBaseSelector } from './nkRibbon.baseSelector'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var nkRibbon_baseSelector_1 = require("./nkRibbon.baseSelector"); | ||
var NkRibbonParams = /** @class */ (function (_super) { | ||
@@ -19,4 +21,4 @@ __extends(NkRibbonParams, _super); | ||
return NkRibbonParams; | ||
}(NkRibbonBaseSelector)); | ||
export { NkRibbonParams }; | ||
}(nkRibbon_baseSelector_1.NkRibbonBaseSelector)); | ||
exports.NkRibbonParams = NkRibbonParams; | ||
//# sourceMappingURL=nkRibbon.params.js.map |
@@ -1,4 +0,4 @@ | ||
import { NkRibbonBaseSelector } from './nkRibbon.baseSelector'; | ||
import { NkRibbonBaseSelector } from './nkRibbon.baseSelector'; | ||
export class NkRibbonParams extends NkRibbonBaseSelector { | ||
public filter: any | ||
} |
@@ -1,2 +0,4 @@ | ||
import { Observable } from 'rxjs/rx'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var rx_1 = require("rxjs/rx"); | ||
var NkRibbonService = /** @class */ (function () { | ||
@@ -19,3 +21,3 @@ function NkRibbonService() { | ||
NkRibbonService.prototype.initializeFilter = function (sender) { | ||
return new Observable(function (observer) { observer.next(); }); | ||
return new rx_1.Observable(function (observer) { observer.next(); }); | ||
}; | ||
@@ -32,3 +34,3 @@ ; | ||
}()); | ||
export { NkRibbonService }; | ||
exports.NkRibbonService = NkRibbonService; | ||
//# sourceMappingURL=nkRibbon.service.js.map |
@@ -1,2 +0,2 @@ | ||
import { NkRibbon } from './../nkRibbon.component'; | ||
import { NkRibbon } from './../nkRibbon.component'; | ||
import { Observable } from 'rxjs/rx'; | ||
@@ -3,0 +3,0 @@ import { UrlTree } from '@angular/router'; |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var NkRibbonSortItem = /** @class */ (function () { | ||
@@ -8,3 +10,3 @@ function NkRibbonSortItem(field, rule) { | ||
}()); | ||
export { NkRibbonSortItem }; | ||
exports.NkRibbonSortItem = NkRibbonSortItem; | ||
//# sourceMappingURL=nkRibbon.sortItem.js.map |
@@ -1,2 +0,2 @@ | ||
import { | ||
import { | ||
ElementRef | ||
@@ -3,0 +3,0 @@ } from '@angular/core'; |
@@ -1,2 +0,2 @@ | ||
import { ElementRef, OnInit, Compiler, ViewContainerRef } from '@angular/core'; | ||
import { ElementRef, OnInit, TemplateRef, Compiler, ViewContainerRef } from '@angular/core'; | ||
import { Location } from '@angular/common'; | ||
@@ -28,7 +28,9 @@ import { Http } from '@angular/http'; | ||
private _virtualRepeatHost; | ||
private _virtualRepeatHostInstance; | ||
private _lazyTimer; | ||
private _watchSettings; | ||
private objectHelper; | ||
_includeItemTemplate: string; | ||
itemRibbonTemplate: TemplateRef<any>; | ||
ribbonLoaderTemplate: TemplateRef<any>; | ||
ribbonNoDataTemplate: TemplateRef<any>; | ||
ribbonErrorTemplate: TemplateRef<any>; | ||
_repeatContainerSelector: string; | ||
@@ -42,7 +44,3 @@ _offsetAfter: number; | ||
_isDisableSupportBrowserLine: boolean; | ||
_loadProgressBarTemplatePath: string; | ||
_noDataTemplatePath: string; | ||
_errorTemplatePath: string; | ||
_isDynamicSize: boolean; | ||
_ribbonContainer: any; | ||
private _origin; | ||
@@ -74,2 +72,3 @@ readonly origin: HTMLElement; | ||
readonly events: NkRibbonEvents; | ||
readonly instance: NkRibbon; | ||
constructor(elementRef: ElementRef, http: Http, compiler: Compiler, vcRef: ViewContainerRef, _location: Location); | ||
@@ -104,12 +103,2 @@ ngOnInit(): void; | ||
_encodeFilterForRoute(filter: any): any; | ||
resolveRepeaterComponent(): void; | ||
collectTemplates(): Observable<any>; | ||
getItemRibbonTemplate(): Observable<any>; | ||
getProgressBarTemplate(): Observable<any>; | ||
getNoDataTemplate(): Observable<any>; | ||
getErrorTemplate(): Observable<any>; | ||
createAfterProgressBarTemplate(): Observable<any>; | ||
createBeforeProgressBarTemplate(): Observable<any>; | ||
createNoDataTemplate(): Observable<any>; | ||
createErrorTemplate(): Observable<any>; | ||
isVisibleAfterProgressBar(): boolean; | ||
@@ -120,5 +109,3 @@ isVisibleBeforeProgressBar(): boolean; | ||
_watchSearch(): void; | ||
createDynamicComponentFromHtml(htmlForCompile: string, beforeProgressTemplate: string, afterProgressTemplate: string, noDataTemplate: string, errorTemplate: string): void; | ||
initializeRepeater(componentRef: any): void; | ||
private createDynamicRepeatContainerFactory(injector, itemHtmlTemplate, beforeProgressTemplate, afterProgressTemplate, noDataTemplate, errorTemplate); | ||
initializeRepeater(): void; | ||
} |
@@ -0,21 +1,32 @@ | ||
"use strict"; | ||
// что надо сделать: | ||
//viewControl join viewService | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// что надо сделать(режим фиксированной высоты элемента): | ||
// | ||
// что надо сделать(режим динамической высоты элемента): | ||
import { Component, Input, ElementRef, ReflectiveInjector, Compiler, ViewEncapsulation, ViewContainerRef, ViewChild } from '@angular/core'; | ||
import { Location } from '@angular/common'; | ||
import { DefaultUrlSerializer } from '@angular/router'; | ||
import { Http, URLSearchParams } from '@angular/http'; | ||
import { Observable } from 'rxjs/rx'; | ||
import 'rxjs/add/operator/map'; | ||
import 'rxjs/add/operator/catch'; | ||
import { NkRibbonOptions } from './models/nkRibbon.options'; | ||
import { NkRibbonEvents } from './models/nkRibbon.events'; | ||
import { NkRibbonParams } from './models/nkRibbon.params'; | ||
import { NkRibbonOrder } from './models/nkRibbon.order'; | ||
import { NkRibbonService } from './models/nkRibbon.service'; | ||
import { NkRibbonItem } from './models/nkRibbon.item'; | ||
import { NkRibbonRuntimeRepeaterResolver } from './nkRibbon.runtimeRepeaterResolver'; | ||
import { ObjectHelper } from '../core/utils/objectHelper'; | ||
var core_1 = require("@angular/core"); | ||
var common_1 = require("@angular/common"); | ||
var router_1 = require("@angular/router"); | ||
var http_1 = require("@angular/http"); | ||
var rx_1 = require("rxjs/rx"); | ||
require("rxjs/add/operator/map"); | ||
require("rxjs/add/operator/catch"); | ||
var nkRibbon_options_1 = require("./models/nkRibbon.options"); | ||
var nkRibbon_repeater_1 = require("./nkRibbon.repeater"); | ||
var nkRibbon_events_1 = require("./models/nkRibbon.events"); | ||
var nkRibbon_params_1 = require("./models/nkRibbon.params"); | ||
var nkRibbon_order_1 = require("./models/nkRibbon.order"); | ||
var nkRibbon_service_1 = require("./models/nkRibbon.service"); | ||
var nkRibbon_item_1 = require("./models/nkRibbon.item"); | ||
var objectHelper_1 = require("../core/utils/objectHelper"); | ||
var NkRibbon = /** @class */ (function () { | ||
@@ -28,3 +39,3 @@ function NkRibbon(elementRef, http, compiler, vcRef, _location) { | ||
this.name = 'NkRibbon'; | ||
this.objectHelper = new ObjectHelper(); | ||
this.objectHelper = new objectHelper_1.ObjectHelper(); | ||
this._offsetAfter = 0; | ||
@@ -37,3 +48,4 @@ this._offsetBefore = 0; | ||
this._isDynamicSize = false; | ||
this._URLSearchParams = new URLSearchParams(); | ||
this._URLSearchParams = new http_1.URLSearchParams(); | ||
this._ribbonRepeater = new nkRibbon_repeater_1.NkRibbonRepeater(); | ||
this._after = 0; | ||
@@ -45,6 +57,6 @@ this._before = 0; | ||
this._filter = {}; | ||
this._ribbonService = new NkRibbonService(); | ||
this._events = new NkRibbonEvents(); | ||
this._options = new NkRibbonOptions(); | ||
this._orderBy = new NkRibbonOrder(); | ||
this._ribbonService = new nkRibbon_service_1.NkRibbonService(); | ||
this._events = new nkRibbon_events_1.NkRibbonEvents(); | ||
this._options = new nkRibbon_options_1.NkRibbonOptions(); | ||
this._orderBy = new nkRibbon_order_1.NkRibbonOrder(); | ||
this._origin = elementRef.nativeElement; | ||
@@ -161,5 +173,11 @@ this._watchSettings = { | ||
}); | ||
Object.defineProperty(NkRibbon.prototype, "instance", { | ||
get: function () { | ||
return this; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
//interface OnInit | ||
NkRibbon.prototype.ngOnInit = function () { | ||
this._options.includeItemTemplate = this._includeItemTemplate; | ||
this._options.repeatContainerSelector = this._repeatContainerSelector; | ||
@@ -170,5 +188,2 @@ this._options.offsetAfter = this._offsetAfter; | ||
this._options.scrolledToStartOffset = this._scrolledToStartOffset; | ||
this._options.loadProgressBarTemplatePath = this._loadProgressBarTemplatePath; | ||
this._options.noDataTemplatePath = this._noDataTemplatePath; | ||
this._options.errorTemplatePath = this._errorTemplatePath; | ||
this._options.pageSize = this._pageSize; | ||
@@ -179,2 +194,3 @@ this._options.isDynamicSize = this._isDynamicSize; | ||
NkRibbon.prototype.ngAfterViewInit = function () { | ||
this; | ||
}; | ||
@@ -195,3 +211,3 @@ NkRibbon.prototype.updateOriginalCollection = function (collection) { | ||
if (than.busy) { | ||
return new Observable(function (observer) { }); | ||
return new rx_1.Observable(function (observer) { }); | ||
} | ||
@@ -205,3 +221,3 @@ than.busy = true; | ||
var options = than.getRouteOptions().requestOptions; | ||
var observed = new Observable(function (observer) { | ||
var observed = new rx_1.Observable(function (observer) { | ||
than.getFirstData(options).subscribe(function () { | ||
@@ -224,10 +240,10 @@ if (before > 0) { | ||
if (that.busy) { | ||
return new Observable(function (observer) { }); | ||
return new rx_1.Observable(function (observer) { }); | ||
} | ||
if (that._after >= that._totalCount || that.originalCollection.length == that._totalCount) { | ||
return new Observable(function (observer) { }); | ||
return new rx_1.Observable(function (observer) { }); | ||
} | ||
that.busy = true; | ||
var callOptions = that.getRouteOptions().requestOptions; | ||
var observed = new Observable(function (observer) { | ||
var observed = new rx_1.Observable(function (observer) { | ||
that.getNextData(callOptions).subscribe(function () { | ||
@@ -248,6 +264,6 @@ that._ribbonRepeater.totalCount = that.totalCount; | ||
if (that.busy) { | ||
return new Observable(function (observer) { }); | ||
return new rx_1.Observable(function (observer) { }); | ||
} | ||
if (that._before <= 0) { | ||
return new Observable(function (observer) { }); | ||
return new rx_1.Observable(function (observer) { }); | ||
} | ||
@@ -258,3 +274,3 @@ that.busy = true; | ||
callOptions.offset = callOptions.offset - that.options.pageSize; | ||
var observed = new Observable(function (observer) { | ||
var observed = new rx_1.Observable(function (observer) { | ||
that.getPreviosData(callOptions).subscribe(function () { | ||
@@ -297,3 +313,3 @@ that._before = callOptions.offset; | ||
that.events.onBeforeLoadData.emit({ that: that, options: options }); | ||
var observed = new Observable(function (observer) { | ||
var observed = new rx_1.Observable(function (observer) { | ||
_this._loadItems(options).subscribe(function (response) { | ||
@@ -303,3 +319,3 @@ that.totalCount = response.totalCount; | ||
response.items.forEach(function (item, index) { | ||
var ribbonItem = new NkRibbonItem(options.offset + index); | ||
var ribbonItem = new nkRibbon_item_1.NkRibbonItem(options.offset + index); | ||
that.objectHelper.extend(ribbonItem, item); | ||
@@ -328,7 +344,7 @@ that.originalCollection.push(ribbonItem); | ||
that.events.onBeforeLoadData.emit({ that: that, options: options }); | ||
var observed = new Observable(function (observer) { | ||
var observed = new rx_1.Observable(function (observer) { | ||
_this._loadItems(options).subscribe(function (response) { | ||
_this._totalCount = response.totalCount; | ||
response.items.forEach(function (item, index) { | ||
var ribbonItem = new NkRibbonItem(that._after + index); | ||
var ribbonItem = new nkRibbon_item_1.NkRibbonItem(that._after + index); | ||
that.objectHelper.extend(ribbonItem, item); | ||
@@ -360,7 +376,7 @@ that.originalCollection.push(ribbonItem); | ||
that.events.onBeforeLoadData.emit({ that: that, options: options }); | ||
var observed = new Observable(function (observer) { | ||
var observed = new rx_1.Observable(function (observer) { | ||
that._loadItems(options).subscribe(function (response) { | ||
that.totalCount = response.totalCount; | ||
response.items.reverse().forEach(function (item, index) { | ||
var itemNew = new NkRibbonItem(options.offset + that.options.pageSize - index - 1); | ||
var itemNew = new nkRibbon_item_1.NkRibbonItem(options.offset + that.options.pageSize - index - 1); | ||
that.originalCollection.unshift(itemNew); | ||
@@ -388,3 +404,3 @@ that.objectHelper.extend(itemNew, item); | ||
} | ||
var params = new NkRibbonParams(); | ||
var params = new nkRibbon_params_1.NkRibbonParams(); | ||
params.offset = _offset; | ||
@@ -404,3 +420,3 @@ params.count = this._options.pageSize; | ||
var offset = this._calculateOffsetForRoute(); | ||
var params = new NkRibbonParams(); | ||
var params = new nkRibbon_params_1.NkRibbonParams(); | ||
params.offset = offset; | ||
@@ -425,3 +441,3 @@ params.search = this.textSearch || ''; | ||
} | ||
})[0] || new NkRibbonItem(0); | ||
})[0] || new nkRibbon_item_1.NkRibbonItem(0); | ||
return firstVisibleItem.index || 0; | ||
@@ -464,3 +480,3 @@ }; | ||
var path = this._location.path(); | ||
var routeParams = new DefaultUrlSerializer().parse(path).queryParams; | ||
var routeParams = new router_1.DefaultUrlSerializer().parse(path).queryParams; | ||
return routeParams; | ||
@@ -470,3 +486,5 @@ }; | ||
var _this = this; | ||
this.firstPage().subscribe(function () { return _this.resolveRepeaterComponent(); }, function () { return _this.resolveRepeaterComponent(); }); | ||
this.firstPage().subscribe(function () { | ||
_this.initializeRepeater(); | ||
}); | ||
this.events.onInitialize.emit(this); | ||
@@ -476,3 +494,3 @@ }; | ||
var _this = this; | ||
var observed = new Observable(function (observer) { | ||
var observed = new rx_1.Observable(function (observer) { | ||
if (_this.ribbonService != null) { | ||
@@ -680,3 +698,3 @@ _this.ribbonService.initializeFilter(_this).subscribe(function (value) { | ||
var path = this._location.path(); | ||
var urlSerializer = new DefaultUrlSerializer(); | ||
var urlSerializer = new router_1.DefaultUrlSerializer(); | ||
var urlParsed = urlSerializer.parse(path); | ||
@@ -696,164 +714,2 @@ this.objectHelper.extend(urlParsed.queryParams, newParams); | ||
}; | ||
NkRibbon.prototype.resolveRepeaterComponent = function () { | ||
var _this = this; | ||
this.collectTemplates().subscribe(function (templates) { | ||
_this.createDynamicComponentFromHtml(_this.options.itemTemplateString, templates.beforeProgressTemplate, templates.afterProgressTemplate, templates.noDataTemplate, templates.errorTemplate); | ||
}); | ||
}; | ||
NkRibbon.prototype.collectTemplates = function () { | ||
return Observable.forkJoin(this.getItemRibbonTemplate(), this.createAfterProgressBarTemplate(), this.createBeforeProgressBarTemplate(), this.createNoDataTemplate(), this.createErrorTemplate()).map(function (data) { | ||
return { | ||
afterProgressTemplate: data[1], | ||
beforeProgressTemplate: data[2], | ||
noDataTemplate: data[3], | ||
errorTemplate: data[4] | ||
}; | ||
}); | ||
}; | ||
NkRibbon.prototype.getItemRibbonTemplate = function () { | ||
var _this = this; | ||
var observed = new Observable(function (observer) { | ||
if (!_this._options.includeItemTemplate) { | ||
console.error('nkIncludeItemTemplate is not defined'); | ||
return; | ||
} | ||
_this.http.get(_this._includeItemTemplate) | ||
.catch(function (error) { | ||
console.error('An error occurred', error); | ||
return Observable.throw(error || 'Server error'); | ||
}) | ||
.subscribe(function (response) { | ||
_this.options.itemTemplateString = response.text(); | ||
observer.next(); | ||
observer.complete(); | ||
}); | ||
}); | ||
return observed; | ||
}; | ||
NkRibbon.prototype.getProgressBarTemplate = function () { | ||
var _this = this; | ||
var observed = new Observable(function (observer) { | ||
if (!_this.options.progressBarTemplateString) { | ||
if (_this._options.loadProgressBarTemplatePath) { | ||
_this.http.get(_this._options.loadProgressBarTemplatePath) | ||
.catch(function (error) { | ||
console.error('An error occurred', error); | ||
return Observable.throw(error || 'Server error'); | ||
}) | ||
.subscribe(function (response) { | ||
_this.options.progressBarTemplateString = response.text(); | ||
observer.next(); | ||
}); | ||
} | ||
else { | ||
_this.options.progressBarTemplateString = '<div>Loading data ...</div>'; | ||
observer.next(); | ||
} | ||
} | ||
else { | ||
observer.next(); | ||
} | ||
}); | ||
return observed; | ||
}; | ||
NkRibbon.prototype.getNoDataTemplate = function () { | ||
var _this = this; | ||
var observed = new Observable(function (observer) { | ||
if (!_this.options.noDataTemplateString) { | ||
if (_this._options.noDataTemplatePath) { | ||
_this.http.get(_this._options.noDataTemplatePath) | ||
.catch(function (error) { | ||
console.error('An error occurred', error); | ||
return Observable.throw(error || 'Server error'); | ||
}) | ||
.subscribe(function (response) { | ||
_this.options.noDataTemplateString = response.text(); | ||
observer.next(); | ||
}); | ||
} | ||
else { | ||
_this.options.noDataTemplateString = '<div>No Data</div>'; | ||
observer.next(); | ||
} | ||
} | ||
else { | ||
observer.next(); | ||
} | ||
}); | ||
return observed; | ||
}; | ||
NkRibbon.prototype.getErrorTemplate = function () { | ||
var _this = this; | ||
var observed = new Observable(function (observer) { | ||
if (!_this.options.errorTemplateString) { | ||
if (_this._options.errorTemplatePath) { | ||
_this.http.get(_this._options.errorTemplatePath) | ||
.catch(function (error) { | ||
console.error('An error occurred', error); | ||
return Observable.throw(error || 'Server error'); | ||
}) | ||
.subscribe(function (response) { | ||
_this.options.errorTemplateString = response.text(); | ||
observer.next(); | ||
}); | ||
} | ||
else { | ||
_this.options.errorTemplateString = '<div>Data Error</div>'; | ||
observer.next(); | ||
} | ||
} | ||
else { | ||
observer.next(); | ||
} | ||
}); | ||
return observed; | ||
}; | ||
NkRibbon.prototype.createAfterProgressBarTemplate = function () { | ||
var _this = this; | ||
var bar; | ||
var observed = new Observable(function (observer) { | ||
_this.getProgressBarTemplate().subscribe(function () { | ||
bar = '<div class="js-ribbon-after-progress-bar" [hidden]="!ribbon.isVisibleAfterProgressBar()">' + _this.options.progressBarTemplateString + '</div>'; | ||
observer.next(bar); | ||
observer.complete(); | ||
}); | ||
}); | ||
return observed; | ||
}; | ||
NkRibbon.prototype.createBeforeProgressBarTemplate = function () { | ||
var _this = this; | ||
var bar; | ||
var observed = new Observable(function (observer) { | ||
_this.getProgressBarTemplate().subscribe(function () { | ||
bar = '<div class="js-ribbon-before-progress-bar" [hidden]="!ribbon.isVisibleBeforeProgressBar()">' + _this.options.progressBarTemplateString + '</div>'; | ||
observer.next(bar); | ||
observer.complete(); | ||
}); | ||
}); | ||
return observed; | ||
}; | ||
NkRibbon.prototype.createNoDataTemplate = function () { | ||
var _this = this; | ||
var template; | ||
var observed = new Observable(function (observer) { | ||
_this.getNoDataTemplate().subscribe(function () { | ||
template = '<div class="js-ribbon-noresult" [hidden]="!ribbon.isVisibleNoresult()">' + _this.options.noDataTemplateString + '</div>'; | ||
observer.next(template); | ||
observer.complete(); | ||
}); | ||
}); | ||
return observed; | ||
}; | ||
NkRibbon.prototype.createErrorTemplate = function () { | ||
var _this = this; | ||
var template; | ||
var observed = new Observable(function (observer) { | ||
_this.getErrorTemplate().subscribe(function () { | ||
template = '<div class="js-ribbon-error-result" [hidden]="!ribbon.isVisibleErrorResult()">' + _this.options.errorTemplateString + '</div>'; | ||
observer.next(template); | ||
observer.complete(); | ||
}); | ||
}); | ||
return observed; | ||
}; | ||
NkRibbon.prototype.isVisibleAfterProgressBar = function () { | ||
@@ -947,21 +803,5 @@ if (this.busy && !this._isBeforeLoading) { | ||
//} | ||
NkRibbon.prototype.createDynamicComponentFromHtml = function (htmlForCompile, beforeProgressTemplate, afterProgressTemplate, noDataTemplate, errorTemplate) { | ||
var _this = this; | ||
var injector = ReflectiveInjector.fromResolvedProviders([], this.vcRef.parentInjector); | ||
// Create component factory | ||
this.createDynamicRepeatContainerFactory(injector, htmlForCompile, beforeProgressTemplate, afterProgressTemplate, noDataTemplate, errorTemplate) | ||
.then(function (cmpFactory) { | ||
// Create the component | ||
var componentRef = _this._ribbonContainer.createComponent(cmpFactory, 0, injector, []); | ||
_this.initializeRepeater(componentRef); | ||
componentRef.changeDetectorRef.detectChanges(); | ||
componentRef.onDestroy(function () { | ||
componentRef.changeDetectorRef.detach(); | ||
}); | ||
}); | ||
}; | ||
NkRibbon.prototype.initializeRepeater = function (componentRef) { | ||
var domElem = componentRef.hostView.rootNodes[0]; | ||
this._virtualRepeatHostInstance = componentRef.instance; | ||
this._ribbonRepeater.buildRepeatContainer(domElem); | ||
NkRibbon.prototype.initializeRepeater = function () { | ||
this._ribbonRepeater = new nkRibbon_repeater_1.NkRibbonRepeater(this.origin.firstChild, this.options); | ||
this._ribbonRepeater.buildRepeatContainer(); | ||
var offset = 0; | ||
@@ -974,3 +814,3 @@ if (!this._isDisableSupportBrowserLine) { | ||
this._ribbonRepeater.scrolledToEnd = function () { | ||
return new Observable(function (observer) { | ||
return new rx_1.Observable(function (observer) { | ||
than.nextPage().subscribe(function () { observer.next(); }); | ||
@@ -980,3 +820,3 @@ }); | ||
this._ribbonRepeater.scrolledToStart = function () { | ||
return new Observable(function (observer) { | ||
return new rx_1.Observable(function (observer) { | ||
than.previosPage().subscribe(function () { observer.next(); }); | ||
@@ -989,46 +829,75 @@ }); | ||
}; | ||
NkRibbon.prototype.createDynamicRepeatContainerFactory = function (injector, itemHtmlTemplate, beforeProgressTemplate, afterProgressTemplate, noDataTemplate, errorTemplate) { | ||
return new NkRibbonRuntimeRepeaterResolver().createDynamicRepeatContainerFactory(this.compiler, injector, this, itemHtmlTemplate, beforeProgressTemplate, afterProgressTemplate, noDataTemplate, errorTemplate); | ||
}; | ||
NkRibbon.decorators = [ | ||
{ type: Component, args: [{ | ||
selector: 'nk-ribbon', | ||
encapsulation: ViewEncapsulation.None, | ||
template: '<div #ribbonContainer class="nk-ribbon-container-wrapper"> </div>', | ||
styles: [".nk-ribbon-control{display:block;opacity:1;-webkit-transition:opacity .5s ease-in;transition:opacity .5s ease-in}.nk-repeater-container,.nk-ribbon-container-wrapper{display:block}.nk-ribbon-hidden{opacity:0}"], | ||
host: { | ||
'[class.nk-ribbon-pending]': 'busy', | ||
'[class.nk-ribbon-hidden]': '!isReady', | ||
'class': 'nk-ribbon-control', | ||
}, | ||
exportAs: 'nkRibbon' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
NkRibbon.ctorParameters = function () { return [ | ||
{ type: ElementRef, }, | ||
{ type: Http, }, | ||
{ type: Compiler, }, | ||
{ type: ViewContainerRef, }, | ||
{ type: Location, }, | ||
]; }; | ||
NkRibbon.propDecorators = { | ||
'_includeItemTemplate': [{ type: Input, args: ['nkRibbonIncludeItemTemplate',] },], | ||
'_repeatContainerSelector': [{ type: Input, args: ['nkRibbonRepeatContainerSelector',] },], | ||
'_offsetAfter': [{ type: Input, args: ['nkRibbonOffsetAfter',] },], | ||
'_offsetBefore': [{ type: Input, args: ['nkRibbonOffsetBefore',] },], | ||
'_loadItems': [{ type: Input, args: ['nkRibbonDataSource',] },], | ||
'_scrolledToEndOffset': [{ type: Input, args: ['nkRibbonScrolledToEndOffset',] },], | ||
'_scrolledToStartOffset': [{ type: Input, args: ['nkRibbonScrolledToStartOffset',] },], | ||
'_pageSize': [{ type: Input, args: ['nkRibbonPageSize',] },], | ||
'_isDisableSupportBrowserLine': [{ type: Input, args: ['nkRibbonDisableSupportBrowserLine',] },], | ||
'_loadProgressBarTemplatePath': [{ type: Input, args: ['nkRibbonLoadProgressBarTemplate',] },], | ||
'_noDataTemplatePath': [{ type: Input, args: ['nkRibbonNoDataTemplate',] },], | ||
'_errorTemplatePath': [{ type: Input, args: ['nkRibbonErrorTemplate',] },], | ||
'_isDynamicSize': [{ type: Input, args: ['nkRibbonDynamicSize',] },], | ||
'_ribbonContainer': [{ type: ViewChild, args: ['ribbonContainer', { read: ViewContainerRef },] },], | ||
}; | ||
__decorate([ | ||
core_1.ContentChild('ribbonItemTemplate'), | ||
__metadata("design:type", core_1.TemplateRef) | ||
], NkRibbon.prototype, "itemRibbonTemplate", void 0); | ||
__decorate([ | ||
core_1.ContentChild('ribbonLoader'), | ||
__metadata("design:type", core_1.TemplateRef) | ||
], NkRibbon.prototype, "ribbonLoaderTemplate", void 0); | ||
__decorate([ | ||
core_1.ContentChild('ribbonNoData'), | ||
__metadata("design:type", core_1.TemplateRef) | ||
], NkRibbon.prototype, "ribbonNoDataTemplate", void 0); | ||
__decorate([ | ||
core_1.ContentChild('ribbonError'), | ||
__metadata("design:type", core_1.TemplateRef) | ||
], NkRibbon.prototype, "ribbonErrorTemplate", void 0); | ||
__decorate([ | ||
core_1.Input('nkRibbonRepeatContainerSelector'), | ||
__metadata("design:type", String) | ||
], NkRibbon.prototype, "_repeatContainerSelector", void 0); | ||
__decorate([ | ||
core_1.Input('nkRibbonOffsetAfter'), | ||
__metadata("design:type", Number) | ||
], NkRibbon.prototype, "_offsetAfter", void 0); | ||
__decorate([ | ||
core_1.Input('nkRibbonOffsetBefore'), | ||
__metadata("design:type", Number) | ||
], NkRibbon.prototype, "_offsetBefore", void 0); | ||
__decorate([ | ||
core_1.Input('nkRibbonDataSource'), | ||
__metadata("design:type", Function) | ||
], NkRibbon.prototype, "_loadItems", void 0); | ||
__decorate([ | ||
core_1.Input('nkRibbonScrolledToEndOffset'), | ||
__metadata("design:type", Number) | ||
], NkRibbon.prototype, "_scrolledToEndOffset", void 0); | ||
__decorate([ | ||
core_1.Input('nkRibbonScrolledToStartOffset'), | ||
__metadata("design:type", Number) | ||
], NkRibbon.prototype, "_scrolledToStartOffset", void 0); | ||
__decorate([ | ||
core_1.Input('nkRibbonPageSize'), | ||
__metadata("design:type", Number) | ||
], NkRibbon.prototype, "_pageSize", void 0); | ||
__decorate([ | ||
core_1.Input('nkRibbonDisableSupportBrowserLine'), | ||
__metadata("design:type", Boolean) | ||
], NkRibbon.prototype, "_isDisableSupportBrowserLine", void 0); | ||
__decorate([ | ||
core_1.Input('nkRibbonDynamicSize'), | ||
__metadata("design:type", Boolean) | ||
], NkRibbon.prototype, "_isDynamicSize", void 0); | ||
NkRibbon = __decorate([ | ||
core_1.Component({ | ||
selector: 'nk-ribbon', | ||
templateUrl: './nkRibbon.html', | ||
styleUrls: ['./nkRibbon.css'], | ||
host: { | ||
'[class.nk-ribbon-pending]': 'busy', | ||
'[class.nk-ribbon-hidden]': '!isReady', | ||
'class': 'nk-ribbon-control', | ||
}, | ||
exportAs: 'nkRibbon' | ||
}), | ||
__metadata("design:paramtypes", [core_1.ElementRef, | ||
http_1.Http, | ||
core_1.Compiler, | ||
core_1.ViewContainerRef, | ||
common_1.Location]) | ||
], NkRibbon); | ||
return NkRibbon; | ||
}()); | ||
export { NkRibbon }; | ||
exports.NkRibbon = NkRibbon; | ||
//# sourceMappingURL=nkRibbon.component.js.map |
@@ -1,2 +0,2 @@ | ||
// что надо сделать: | ||
// что надо сделать: | ||
//viewControl join viewService | ||
@@ -66,4 +66,2 @@ | ||
import { NkRibbonItem } from './models/nkRibbon.item'; | ||
import { NkRibbonItemElement } from './nkRibbon.item.directive'; | ||
import { NkRibbonRuntimeRepeaterResolver } from './nkRibbon.runtimeRepeaterResolver'; | ||
import { ObjectHelper } from '../core/utils/objectHelper'; | ||
@@ -75,4 +73,4 @@ import { NkRibbonSortItem } from './models/nkRibbon.sortItem'; | ||
encapsulation: ViewEncapsulation.None, | ||
template: '<div #ribbonContainer class="nk-ribbon-container-wrapper"> </div>', | ||
styles: [`.nk-ribbon-control{display:block;opacity:1;-webkit-transition:opacity .5s ease-in;transition:opacity .5s ease-in}.nk-repeater-container,.nk-ribbon-container-wrapper{display:block}.nk-ribbon-hidden{opacity:0}`], | ||
templateUrl: './nkRibbon.html', | ||
styleUrls: ['./nkRibbon.css'], | ||
host: { | ||
@@ -94,3 +92,2 @@ '[class.nk-ribbon-pending]': 'busy', | ||
private _virtualRepeatHost: HTMLElement; | ||
private _virtualRepeatHostInstance: any; | ||
private _lazyTimer: any; | ||
@@ -100,3 +97,6 @@ private _watchSettings: any; | ||
@Input('nkRibbonIncludeItemTemplate') _includeItemTemplate: string; | ||
@ContentChild('ribbonItemTemplate') itemRibbonTemplate: TemplateRef<any>; | ||
@ContentChild('ribbonLoader') ribbonLoaderTemplate: TemplateRef<any>; | ||
@ContentChild('ribbonNoData') ribbonNoDataTemplate: TemplateRef<any>; | ||
@ContentChild('ribbonError') ribbonErrorTemplate: TemplateRef<any>; | ||
@Input('nkRibbonRepeatContainerSelector') _repeatContainerSelector: string; | ||
@@ -110,10 +110,4 @@ @Input('nkRibbonOffsetAfter') _offsetAfter: number = 0; | ||
@Input('nkRibbonDisableSupportBrowserLine') _isDisableSupportBrowserLine: boolean = false; | ||
@Input('nkRibbonLoadProgressBarTemplate') _loadProgressBarTemplatePath: string; | ||
@Input('nkRibbonNoDataTemplate') _noDataTemplatePath: string; | ||
@Input('nkRibbonErrorTemplate') _errorTemplatePath: string; | ||
@Input('nkRibbonDynamicSize') _isDynamicSize: boolean = false; | ||
@ViewChild('ribbonContainer', { read: ViewContainerRef }) _ribbonContainer: any; | ||
private _origin: HTMLElement; | ||
@@ -131,3 +125,3 @@ get origin(): HTMLElement { | ||
private _ribbonRepeater: NkRibbonRepeater; | ||
private _ribbonRepeater: NkRibbonRepeater = new NkRibbonRepeater(); | ||
get repeater(): NkRibbonRepeater { | ||
@@ -205,2 +199,6 @@ return this._ribbonRepeater; | ||
public get instance(): NkRibbon { | ||
return this; | ||
} | ||
constructor( | ||
@@ -223,3 +221,2 @@ elementRef: ElementRef, | ||
ngOnInit(): void { | ||
this._options.includeItemTemplate = this._includeItemTemplate; | ||
this._options.repeatContainerSelector = this._repeatContainerSelector; | ||
@@ -230,5 +227,2 @@ this._options.offsetAfter = this._offsetAfter; | ||
this._options.scrolledToStartOffset = this._scrolledToStartOffset; | ||
this._options.loadProgressBarTemplatePath = this._loadProgressBarTemplatePath; | ||
this._options.noDataTemplatePath = this._noDataTemplatePath; | ||
this._options.errorTemplatePath = this._errorTemplatePath; | ||
this._options.pageSize = this._pageSize; | ||
@@ -240,3 +234,3 @@ this._options.isDynamicSize = this._isDynamicSize; | ||
ngAfterViewInit(): void { | ||
this | ||
} | ||
@@ -539,5 +533,5 @@ | ||
_initialize(): void { | ||
this.firstPage().subscribe( | ||
() => this.resolveRepeaterComponent(), | ||
() => this.resolveRepeaterComponent()); | ||
this.firstPage().subscribe(() => { | ||
this.initializeRepeater(); | ||
}); | ||
this.events.onInitialize.emit(this); | ||
@@ -780,177 +774,2 @@ } | ||
resolveRepeaterComponent(): void { | ||
this.collectTemplates().subscribe((templates: any) => { | ||
this.createDynamicComponentFromHtml( | ||
this.options.itemTemplateString, | ||
templates.beforeProgressTemplate, | ||
templates.afterProgressTemplate, | ||
templates.noDataTemplate, | ||
templates.errorTemplate); | ||
}); | ||
} | ||
collectTemplates(): Observable<any> { | ||
return Observable.forkJoin( | ||
this.getItemRibbonTemplate(), | ||
this.createAfterProgressBarTemplate(), | ||
this.createBeforeProgressBarTemplate(), | ||
this.createNoDataTemplate(), | ||
this.createErrorTemplate() | ||
).map((data: any[]) => { | ||
return { | ||
afterProgressTemplate: data[1], | ||
beforeProgressTemplate: data[2], | ||
noDataTemplate: data[3], | ||
errorTemplate: data[4] | ||
}; | ||
}); | ||
} | ||
getItemRibbonTemplate(): Observable<any> { | ||
let observed = new Observable((observer: any) => { | ||
if (!this._options.includeItemTemplate) { | ||
console.error('nkIncludeItemTemplate is not defined'); | ||
return; | ||
} | ||
this.http.get(this._includeItemTemplate) | ||
.catch((error: any) => { | ||
console.error('An error occurred', error); | ||
return Observable.throw(error || 'Server error') | ||
}) | ||
.subscribe( | ||
(response) => { | ||
this.options.itemTemplateString = response.text(); | ||
observer.next(); | ||
observer.complete(); | ||
}); | ||
}); | ||
return observed; | ||
} | ||
getProgressBarTemplate(): Observable<any> { | ||
let observed = new Observable((observer: any) => { | ||
if (!this.options.progressBarTemplateString) { | ||
if (this._options.loadProgressBarTemplatePath) { | ||
this.http.get(this._options.loadProgressBarTemplatePath) | ||
.catch((error: any) => { | ||
console.error('An error occurred', error); | ||
return Observable.throw(error || 'Server error') | ||
}) | ||
.subscribe( | ||
(response) => { | ||
this.options.progressBarTemplateString = response.text(); | ||
observer.next(); | ||
}); | ||
} else { | ||
this.options.progressBarTemplateString = '<div>Loading data ...</div>'; | ||
observer.next(); | ||
} | ||
} else { | ||
observer.next(); | ||
} | ||
}); | ||
return observed; | ||
} | ||
getNoDataTemplate(): Observable<any> { | ||
let observed = new Observable((observer: any) => { | ||
if (!this.options.noDataTemplateString) { | ||
if (this._options.noDataTemplatePath) { | ||
this.http.get(this._options.noDataTemplatePath) | ||
.catch((error: any) => { | ||
console.error('An error occurred', error); | ||
return Observable.throw(error || 'Server error') | ||
}) | ||
.subscribe( | ||
(response) => { | ||
this.options.noDataTemplateString = response.text(); | ||
observer.next(); | ||
}); | ||
} else { | ||
this.options.noDataTemplateString = '<div>No Data</div>'; | ||
observer.next(); | ||
} | ||
} else { | ||
observer.next(); | ||
} | ||
}); | ||
return observed; | ||
} | ||
getErrorTemplate(): Observable<any> { | ||
let observed = new Observable((observer: any) => { | ||
if (!this.options.errorTemplateString) { | ||
if (this._options.errorTemplatePath) { | ||
this.http.get(this._options.errorTemplatePath) | ||
.catch((error: any) => { | ||
console.error('An error occurred', error); | ||
return Observable.throw(error || 'Server error') | ||
}) | ||
.subscribe( | ||
(response) => { | ||
this.options.errorTemplateString = response.text(); | ||
observer.next(); | ||
}); | ||
} else { | ||
this.options.errorTemplateString = '<div>Data Error</div>'; | ||
observer.next(); | ||
} | ||
} else { | ||
observer.next(); | ||
} | ||
}); | ||
return observed; | ||
} | ||
createAfterProgressBarTemplate(): Observable<any> { | ||
let bar; | ||
let observed = new Observable((observer: any) => { | ||
this.getProgressBarTemplate().subscribe(() => { | ||
bar = '<div class="js-ribbon-after-progress-bar" [hidden]="!ribbon.isVisibleAfterProgressBar()">' + this.options.progressBarTemplateString + '</div>'; | ||
observer.next(bar); | ||
observer.complete(); | ||
}); | ||
}); | ||
return observed; | ||
} | ||
createBeforeProgressBarTemplate(): Observable<any> { | ||
let bar; | ||
let observed = new Observable((observer: any) => { | ||
this.getProgressBarTemplate().subscribe(() => { | ||
bar = '<div class="js-ribbon-before-progress-bar" [hidden]="!ribbon.isVisibleBeforeProgressBar()">' + this.options.progressBarTemplateString + '</div>'; | ||
observer.next(bar); | ||
observer.complete(); | ||
}); | ||
}); | ||
return observed; | ||
} | ||
createNoDataTemplate(): Observable<any> { | ||
let template; | ||
let observed = new Observable((observer: any) => { | ||
this.getNoDataTemplate().subscribe(() => { | ||
template = '<div class="js-ribbon-noresult" [hidden]="!ribbon.isVisibleNoresult()">' + this.options.noDataTemplateString + '</div>'; | ||
observer.next(template); | ||
observer.complete(); | ||
}); | ||
}); | ||
return observed; | ||
} | ||
createErrorTemplate(): Observable<any> { | ||
let template; | ||
let observed = new Observable((observer: any) => { | ||
this.getErrorTemplate().subscribe(() => { | ||
template = '<div class="js-ribbon-error-result" [hidden]="!ribbon.isVisibleErrorResult()">' + this.options.errorTemplateString + '</div>'; | ||
observer.next(template); | ||
observer.complete(); | ||
}); | ||
}); | ||
return observed; | ||
} | ||
isVisibleAfterProgressBar(): boolean { | ||
@@ -1052,34 +871,5 @@ if (this.busy && !this._isBeforeLoading) { | ||
createDynamicComponentFromHtml( | ||
htmlForCompile: string, | ||
beforeProgressTemplate: string, | ||
afterProgressTemplate: string, | ||
noDataTemplate: string, | ||
errorTemplate: string) { | ||
let injector = ReflectiveInjector.fromResolvedProviders([], this.vcRef.parentInjector); | ||
// Create component factory | ||
this.createDynamicRepeatContainerFactory( | ||
injector, | ||
htmlForCompile, | ||
beforeProgressTemplate, | ||
afterProgressTemplate, | ||
noDataTemplate, | ||
errorTemplate) | ||
.then((cmpFactory: any) => { | ||
// Create the component | ||
let componentRef = this._ribbonContainer.createComponent(cmpFactory, 0, injector, []); | ||
this.initializeRepeater(componentRef); | ||
componentRef.changeDetectorRef.detectChanges(); | ||
componentRef.onDestroy(() => { | ||
componentRef.changeDetectorRef.detach(); | ||
}); | ||
}); | ||
} | ||
initializeRepeater(componentRef: any): void { | ||
const domElem = (componentRef.hostView as EmbeddedViewRef<any>).rootNodes[0] as HTMLElement; | ||
this._virtualRepeatHostInstance = componentRef.instance; | ||
this._ribbonRepeater.buildRepeatContainer(domElem); | ||
initializeRepeater(): void { | ||
this._ribbonRepeater = new NkRibbonRepeater(this.origin.firstChild as HTMLElement, this.options); | ||
this._ribbonRepeater.buildRepeatContainer(); | ||
let offset = 0; | ||
@@ -1106,21 +896,2 @@ if (!this._isDisableSupportBrowserLine) { | ||
private createDynamicRepeatContainerFactory( | ||
injector: ReflectiveInjector, | ||
itemHtmlTemplate: string, | ||
beforeProgressTemplate: string, | ||
afterProgressTemplate: string, | ||
noDataTemplate: string, | ||
errorTemplate: string) { | ||
return new NkRibbonRuntimeRepeaterResolver().createDynamicRepeatContainerFactory( | ||
this.compiler, | ||
injector, | ||
this, | ||
itemHtmlTemplate, | ||
beforeProgressTemplate, | ||
afterProgressTemplate, | ||
noDataTemplate, | ||
errorTemplate); | ||
} | ||
} |
@@ -1,2 +0,15 @@ | ||
import { Directive, Input, ElementRef } from '@angular/core'; | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_1 = require("@angular/core"); | ||
var nkRibbon_component_1 = require("./nkRibbon.component"); | ||
var nkRibbon_item_1 = require("./models/nkRibbon.item"); | ||
var NkRibbonItemElement = /** @class */ (function () { | ||
@@ -33,2 +46,3 @@ function NkRibbonItemElement(elementRef) { | ||
NkRibbonItemElement.prototype.ngAfterViewInit = function () { | ||
this._ribbon.repeater.defaultElementSize = this.elementRef.nativeElement.clientHeight; | ||
this._item.element = this.elementRef; | ||
@@ -53,20 +67,27 @@ this._item.ribbon = this._ribbon; | ||
}; | ||
NkRibbonItemElement.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[nk-ribbon-item]', | ||
exportAs: 'nkRibbonItem', | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
NkRibbonItemElement.ctorParameters = function () { return [ | ||
{ type: ElementRef, }, | ||
]; }; | ||
NkRibbonItemElement.propDecorators = { | ||
'readyNgFor': [{ type: Input, args: ['readyNgFor',] },], | ||
'ribbon': [{ type: Input, args: ['ribbon',] },], | ||
'data': [{ type: Input, args: ['data',] },], | ||
}; | ||
__decorate([ | ||
core_1.Input('readyNgFor'), | ||
__metadata("design:type", Boolean), | ||
__metadata("design:paramtypes", [Boolean]) | ||
], NkRibbonItemElement.prototype, "readyNgFor", null); | ||
__decorate([ | ||
core_1.Input('ribbon'), | ||
__metadata("design:type", nkRibbon_component_1.NkRibbon), | ||
__metadata("design:paramtypes", [nkRibbon_component_1.NkRibbon]) | ||
], NkRibbonItemElement.prototype, "ribbon", null); | ||
__decorate([ | ||
core_1.Input('data'), | ||
__metadata("design:type", nkRibbon_item_1.NkRibbonItem), | ||
__metadata("design:paramtypes", [nkRibbon_item_1.NkRibbonItem]) | ||
], NkRibbonItemElement.prototype, "data", null); | ||
NkRibbonItemElement = __decorate([ | ||
core_1.Directive({ | ||
selector: '[nk-ribbon-item]', | ||
exportAs: 'nkRibbonItem', | ||
}), | ||
__metadata("design:paramtypes", [core_1.ElementRef]) | ||
], NkRibbonItemElement); | ||
return NkRibbonItemElement; | ||
}()); | ||
export { NkRibbonItemElement }; | ||
exports.NkRibbonItemElement = NkRibbonItemElement; | ||
//# sourceMappingURL=nkRibbon.item.directive.js.map |
import { | ||
Directive, | ||
Input, | ||
ElementRef | ||
Directive, | ||
Input, | ||
ElementRef | ||
} from '@angular/core'; | ||
@@ -9,4 +9,4 @@ import { NkRibbon } from './nkRibbon.component'; | ||
@Directive({ | ||
selector: '[nk-ribbon-item]', | ||
exportAs: 'nkRibbonItem', | ||
selector: '[nk-ribbon-item]', | ||
exportAs: 'nkRibbonItem', | ||
@@ -16,52 +16,52 @@ }) | ||
private _last: boolean; | ||
@Input('readyNgFor') | ||
set readyNgFor(isReady: boolean) { | ||
this._last = isReady; | ||
} | ||
private _last: boolean; | ||
@Input('readyNgFor') | ||
set readyNgFor(isReady: boolean) { | ||
this._last = isReady; | ||
} | ||
private _ribbon: NkRibbon; | ||
@Input('ribbon') | ||
set ribbon(value: NkRibbon) { | ||
this._ribbon = value; | ||
} | ||
private _ribbon: NkRibbon; | ||
@Input('ribbon') | ||
set ribbon(value: NkRibbon) { | ||
this._ribbon = value; | ||
} | ||
private _item: NkRibbonItem; | ||
@Input('data') | ||
set data(value: NkRibbonItem) { | ||
this._item = value; | ||
} | ||
private _item: NkRibbonItem; | ||
@Input('data') | ||
set data(value: NkRibbonItem) { | ||
this._item = value; | ||
} | ||
constructor( | ||
private elementRef: ElementRef) { | ||
constructor( | ||
private elementRef: ElementRef) { | ||
} | ||
} | ||
ngOnDestroy(): void { | ||
this._item.element = null; | ||
this._item.ribbon = null; | ||
this._item.correctingScrollTop = delta => { }; | ||
} | ||
ngOnDestroy(): void { | ||
this._item.element = null; | ||
this._item.ribbon = null; | ||
this._item.correctingScrollTop = delta => { }; | ||
ngAfterViewInit(): void { | ||
this._ribbon.repeater.defaultElementSize = this.elementRef.nativeElement.clientHeight; | ||
this._item.element = this.elementRef; | ||
this._item.ribbon = this._ribbon; | ||
let that = this; | ||
if (this._ribbon.repeater.isInitialized) { | ||
this._ribbon.repeater.scrolling(this._item); | ||
this._item.correctingScrollTop.call(this._item.ribbon.repeater, this._item.element.nativeElement.clientHeight); | ||
setTimeout(function () { | ||
that._ribbon.events.onScroll.emit(that._item); | ||
}) | ||
} | ||
ngAfterViewInit(): void { | ||
this._item.element = this.elementRef; | ||
this._item.ribbon = this._ribbon; | ||
let that = this; | ||
if (this._ribbon.repeater.isInitialized) { | ||
this._ribbon.repeater.scrolling(this._item); | ||
this._item.correctingScrollTop.call(this._item.ribbon.repeater, this._item.element.nativeElement.clientHeight); | ||
setTimeout(function () { | ||
that._ribbon.events.onScroll.emit(that._item); | ||
}) | ||
} | ||
//if (this._last) { | ||
// that._ribbon.repeater.onRepeaterReady(); | ||
//} | ||
if (this._last && !this._ribbon.repeater.isInitialized) { | ||
setTimeout(function () { | ||
that._ribbon.repeater.setScrollTopAfterFirstLoad(); | ||
}); | ||
} | ||
//if (this._last) { | ||
// that._ribbon.repeater.onRepeaterReady(); | ||
//} | ||
if (this._last && !this._ribbon.repeater.isInitialized) { | ||
setTimeout(function () { | ||
that._ribbon.repeater.setScrollTopAfterFirstLoad(); | ||
}); | ||
} | ||
} | ||
} |
@@ -1,20 +0,30 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { NkRibbon } from './nkRibbon.component'; | ||
import { CommonModule } from '@angular/common'; | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var nkRibbon_component_1 = require("./nkRibbon.component"); | ||
var nkRibbon_item_directive_1 = require("./nkRibbon.item.directive"); | ||
var common_1 = require("@angular/common"); | ||
var core_1 = require("@angular/core"); | ||
var NkRibbonModule = /** @class */ (function () { | ||
function NkRibbonModule() { | ||
} | ||
NkRibbonModule.decorators = [ | ||
{ type: NgModule, args: [{ | ||
imports: [CommonModule], | ||
exports: [NkRibbon], | ||
declarations: [NkRibbon], | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
NkRibbonModule.ctorParameters = function () { return []; }; | ||
NkRibbonModule = __decorate([ | ||
core_1.NgModule({ | ||
imports: [common_1.CommonModule], | ||
exports: [nkRibbon_component_1.NkRibbon, nkRibbon_item_directive_1.NkRibbonItemElement], | ||
declarations: [nkRibbon_component_1.NkRibbon, nkRibbon_item_directive_1.NkRibbonItemElement] | ||
}) | ||
], NkRibbonModule); | ||
return NkRibbonModule; | ||
}()); | ||
export { NkRibbonModule }; | ||
export * from './nkRibbon.component'; | ||
exports.NkRibbonModule = NkRibbonModule; | ||
__export(require("./nkRibbon.component")); | ||
//# sourceMappingURL=nkRibbon.module.js.map |
@@ -1,9 +0,10 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { NkRibbon } from './nkRibbon.component'; | ||
import { NkRibbon } from './nkRibbon.component'; | ||
import { NkRibbonItemElement } from './nkRibbon.item.directive'; | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule} from '@angular/core'; | ||
@NgModule({ | ||
imports: [CommonModule], | ||
exports: [NkRibbon], | ||
declarations: [NkRibbon], | ||
imports: [CommonModule], | ||
exports: [NkRibbon, NkRibbonItemElement ], | ||
declarations: [NkRibbon, NkRibbonItemElement ] | ||
}) | ||
@@ -10,0 +11,0 @@ export class NkRibbonModule { } |
@@ -16,6 +16,7 @@ import { NkRibbonOptions } from './models/nkRibbon.options'; | ||
private _maxEndIndex; | ||
private _defaultElementSize; | ||
private _beforeLoaderHeight; | ||
private scrollHelper; | ||
private _sizesCumulative; | ||
private _defaultElementSize; | ||
defaultElementSize: number; | ||
private _offsetData; | ||
@@ -40,3 +41,3 @@ offsetData: number; | ||
onScrolling: EventEmitter<NkRibbonItem>; | ||
constructor(repeatContainer: HTMLElement, options: NkRibbonOptions); | ||
constructor(repeatContainer?: HTMLElement, options?: NkRibbonOptions); | ||
initialize(collection: Array<NkRibbonItem>, offsetStart: number, totalCount: number): void; | ||
@@ -48,5 +49,5 @@ refresh(offsetStart?: number): void; | ||
updateOriginalCollection(collection: Array<NkRibbonItem>): void; | ||
buildRepeatContainer(domElem: HTMLElement): void; | ||
createBeforeContentElement(): void; | ||
createAfterContentElement(): void; | ||
buildRepeatContainer(): void; | ||
initializeBeforeContentElement(): void; | ||
initializeAfterContentElement(): void; | ||
getSizeElement(): number; | ||
@@ -53,0 +54,0 @@ getDefaultElementSize(): number; |
@@ -1,3 +0,5 @@ | ||
import { ScrollHelper } from '../core/utils/scrollHelper'; | ||
import { EventEmitter } from '@angular/core'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var scrollHelper_1 = require("../core/utils/scrollHelper"); | ||
var core_1 = require("@angular/core"); | ||
var NkRibbonRepeater = /** @class */ (function () { | ||
@@ -11,6 +13,6 @@ function NkRibbonRepeater(repeatContainer, options) { | ||
this._maxEndIndex = 0; | ||
this._defaultElementSize = 0; | ||
this._beforeLoaderHeight = 0; | ||
this.scrollHelper = new ScrollHelper(); | ||
this.scrollHelper = new scrollHelper_1.ScrollHelper(); | ||
this._sizesCumulative = []; | ||
this._defaultElementSize = 0; | ||
this._offsetData = 0; | ||
@@ -23,9 +25,21 @@ this._totalCount = 0; | ||
this._oldOriginalCount = 0; | ||
this.onScrolling = new EventEmitter(); | ||
this.onScrolling = new core_1.EventEmitter(); | ||
this.$scrollPosition = 0; | ||
this._repeatContainer = repeatContainer; | ||
this._options = options; | ||
this.createBeforeContentElement(); | ||
this.createAfterContentElement(); | ||
if (repeatContainer && options) { | ||
this.initializeBeforeContentElement(); | ||
this.initializeAfterContentElement(); | ||
} | ||
} | ||
Object.defineProperty(NkRibbonRepeater.prototype, "defaultElementSize", { | ||
get: function () { | ||
return this._defaultElementSize; | ||
}, | ||
set: function (val) { | ||
this._defaultElementSize = val; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(NkRibbonRepeater.prototype, "offsetData", { | ||
@@ -119,3 +133,5 @@ get: function () { | ||
NkRibbonRepeater.prototype.destroy = function () { | ||
this._scrollParent.removeEventListener('scroll', this.getScrollHandler()); | ||
if (this._scrollParent) { | ||
this._scrollParent.removeEventListener('scroll', this.getScrollHandler()); | ||
} | ||
}; | ||
@@ -136,3 +152,3 @@ NkRibbonRepeater.prototype.setScrollParent = function () { | ||
NkRibbonRepeater.prototype.updateCollection = function (collection) { | ||
this._vsCollection = []; | ||
this._vsCollection.length = 0; | ||
Array.prototype.push.apply(this._vsCollection, collection); | ||
@@ -143,6 +159,3 @@ }; | ||
}; | ||
NkRibbonRepeater.prototype.buildRepeatContainer = function (domElem) { | ||
this._repeatContainer.appendChild(this._beforeContent); | ||
this._repeatContainer.appendChild(domElem); | ||
this._repeatContainer.appendChild(this._afterContent); | ||
NkRibbonRepeater.prototype.buildRepeatContainer = function () { | ||
var template = this._repeatContainer.querySelector('.js-ribbon-after-progress-bar'); | ||
@@ -166,9 +179,7 @@ if (template) { | ||
}; | ||
NkRibbonRepeater.prototype.createBeforeContentElement = function () { | ||
this._beforeContent = document.createElement('div'); | ||
this._beforeContent.classList.add('nk-repeat-before-content'); | ||
NkRibbonRepeater.prototype.initializeBeforeContentElement = function () { | ||
this._beforeContent = this._repeatContainer.querySelector('.nk-repeat-before-content'); | ||
}; | ||
NkRibbonRepeater.prototype.createAfterContentElement = function () { | ||
this._afterContent = document.createElement('div'); | ||
this._afterContent.classList.add('nk-repeat-after-content'); | ||
NkRibbonRepeater.prototype.initializeAfterContentElement = function () { | ||
this._afterContent = this._repeatContainer.querySelector('.nk-repeat-after-content'); | ||
}; | ||
@@ -180,9 +191,2 @@ NkRibbonRepeater.prototype.getSizeElement = function () { | ||
NkRibbonRepeater.prototype.getDefaultElementSize = function () { | ||
if (this._defaultElementSize == 0) { | ||
var doc = document.createElement('div'); | ||
doc.innerHTML = this.options.itemTemplateString; | ||
this._repeatContainer.insertBefore(doc, this._repeatContainer.childNodes[0]); | ||
this._defaultElementSize = doc.clientHeight; | ||
doc.parentNode.removeChild(doc); | ||
} | ||
return this._defaultElementSize; | ||
@@ -208,4 +212,8 @@ }; | ||
var offset = this.calculateOffset(previosLoadCount, correct); | ||
this._beforeContent.style.minHeight = offset.offsetBefore + 'px'; | ||
this._afterContent.style.minHeight = offset.offsetAfter + 'px'; | ||
if (this._beforeContent) { | ||
this._beforeContent.style.minHeight = offset.offsetBefore + 'px'; | ||
} | ||
if (this._afterContent) { | ||
this._afterContent.style.minHeight = offset.offsetAfter + 'px'; | ||
} | ||
}; | ||
@@ -279,3 +287,3 @@ NkRibbonRepeater.prototype.calculateOffset = function (previosLoadCount, correct) { | ||
triggerIndex = this.options.scrolledToStartOffset; | ||
if (this.startIndex <= triggerIndex && (this._prevStartIndex > triggerIndex || parseInt(this._beforeContent.style.minHeight) <= this.getDefaultElementSize()) && this.scrolledToStart) { | ||
if (this.startIndex <= triggerIndex && (this._prevStartIndex > triggerIndex || (this._beforeContent && parseInt(this._beforeContent.style.minHeight)) <= this.getDefaultElementSize()) && this.scrolledToStart) { | ||
this.scrolledToStart().subscribe(function () { | ||
@@ -480,3 +488,3 @@ _this.updateInnerCollectionAfterPreviosPageLoading(); | ||
}()); | ||
export { NkRibbonRepeater }; | ||
exports.NkRibbonRepeater = NkRibbonRepeater; | ||
//# sourceMappingURL=nkRibbon.repeater.js.map |
@@ -1,6 +0,6 @@ | ||
import { NkRibbonOptions } from './models/nkRibbon.options'; | ||
import { NkRibbonOptions } from './models/nkRibbon.options'; | ||
import { NkRibbonItem } from './models/nkRibbon.item'; | ||
import { ScrollHelper } from '../core/utils/scrollHelper'; | ||
import { | ||
EventEmitter | ||
EventEmitter | ||
} from '@angular/core'; | ||
@@ -11,495 +11,498 @@ import { Observable } from 'rxjs/rx'; | ||
private _beforeContent: HTMLElement; | ||
private _afterContent: HTMLElement; | ||
private _repeatContainer: HTMLElement; | ||
private _scrollParent: any; | ||
private _beforeContent: HTMLElement; | ||
private _afterContent: HTMLElement; | ||
private _repeatContainer: HTMLElement; | ||
private _scrollParent: any; | ||
private startIndex: number = 0; | ||
private endIndex: number = 0; | ||
private startIndex: number = 0; | ||
private endIndex: number = 0; | ||
private _prevStartIndex: number = 0; | ||
private _prevEndIndex: number = 0; | ||
private _minStartIndex: number = 0; | ||
private _maxEndIndex: number = 0; | ||
private _defaultElementSize: number = 0; | ||
private _beforeLoaderHeight: number = 0; | ||
private scrollHelper: ScrollHelper = new ScrollHelper(); | ||
private _sizesCumulative: Array<number> = []; | ||
private _prevStartIndex: number = 0; | ||
private _prevEndIndex: number = 0; | ||
private _minStartIndex: number = 0; | ||
private _maxEndIndex: number = 0; | ||
private _beforeLoaderHeight: number = 0; | ||
private scrollHelper: ScrollHelper = new ScrollHelper(); | ||
private _sizesCumulative: Array<number> = []; | ||
private _offsetData: number = 0; | ||
get offsetData(): number { | ||
return this._offsetData; | ||
} | ||
set offsetData(val: number) { | ||
this._offsetData = val; | ||
} | ||
private _defaultElementSize: number = 0; | ||
get defaultElementSize(): number { | ||
return this._defaultElementSize; | ||
} | ||
set defaultElementSize(val: number) { | ||
this._defaultElementSize = val; | ||
} | ||
private _totalCount: number = 0; | ||
get totalCount(): number { | ||
return this._totalCount; | ||
} | ||
set totalCount(val: number) { | ||
this._totalCount = val; | ||
} | ||
private _offsetData: number = 0; | ||
get offsetData(): number { | ||
return this._offsetData; | ||
} | ||
set offsetData(val: number) { | ||
this._offsetData = val; | ||
} | ||
private _isInitialized: boolean = false; | ||
get isInitialized(): boolean { | ||
return this._isInitialized; | ||
} | ||
private _totalCount: number = 0; | ||
get totalCount(): number { | ||
return this._totalCount; | ||
} | ||
set totalCount(val: number) { | ||
this._totalCount = val; | ||
} | ||
private _vsCollection: Array<NkRibbonItem> = []; | ||
get $vsCollection(): Array<NkRibbonItem> { | ||
return this._vsCollection; | ||
} | ||
set $vsCollection(val: Array<NkRibbonItem>) { | ||
this._vsCollection = val; | ||
} | ||
private _isInitialized: boolean = false; | ||
get isInitialized(): boolean { | ||
return this._isInitialized; | ||
} | ||
private _options: NkRibbonOptions; | ||
get options(): NkRibbonOptions { | ||
return this._options; | ||
} | ||
private _vsCollection: Array<NkRibbonItem> = []; | ||
get $vsCollection(): Array<NkRibbonItem> { | ||
return this._vsCollection; | ||
} | ||
set $vsCollection(val: Array<NkRibbonItem>) { | ||
this._vsCollection = val; | ||
} | ||
public get originalCount(): number { | ||
return this._originalCollection.length; | ||
} | ||
private _options: NkRibbonOptions; | ||
get options(): NkRibbonOptions { | ||
return this._options; | ||
} | ||
private _originalCollection: Array<NkRibbonItem> = []; | ||
public get originalCollection(): Array<NkRibbonItem> { | ||
return this._originalCollection; | ||
} | ||
public set originalCollection(val: Array<NkRibbonItem>) { | ||
this._originalCollection = val; | ||
} | ||
public get originalCount(): number { | ||
return this._originalCollection.length; | ||
} | ||
private get virtualCollectionLength(): number { | ||
return this.$vsCollection.length; | ||
} | ||
private _originalCollection: Array<NkRibbonItem> = []; | ||
public get originalCollection(): Array<NkRibbonItem> { | ||
return this._originalCollection; | ||
} | ||
public set originalCollection(val: Array<NkRibbonItem>) { | ||
this._originalCollection = val; | ||
} | ||
private _oldOriginalCollection: Array<NkRibbonItem> = this._originalCollection; | ||
private _oldOriginalCount = 0; | ||
private get virtualCollectionLength(): number { | ||
return this.$vsCollection.length; | ||
} | ||
public scrolledToEnd: () => Observable<any>; | ||
public scrolledToStart: () => Observable<any>; | ||
public onScrolling: EventEmitter<NkRibbonItem> = new EventEmitter(); | ||
private _oldOriginalCollection: Array<NkRibbonItem> = this._originalCollection; | ||
private _oldOriginalCount = 0; | ||
constructor(repeatContainer: HTMLElement, options: NkRibbonOptions) { | ||
this._repeatContainer = repeatContainer; | ||
this._options = options; | ||
this.createBeforeContentElement(); | ||
this.createAfterContentElement(); | ||
} | ||
public scrolledToEnd: () => Observable<any>; | ||
public scrolledToStart: () => Observable<any>; | ||
public onScrolling: EventEmitter<NkRibbonItem> = new EventEmitter(); | ||
initialize(collection: Array<NkRibbonItem>, offsetStart: number, totalCount: number): void { | ||
this.originalCollection = collection; | ||
this._totalCount = totalCount; | ||
this.setScrollParent(); | ||
this.refresh(offsetStart); | ||
} | ||
constructor(repeatContainer?: HTMLElement, options?: NkRibbonOptions) { | ||
this._repeatContainer = repeatContainer; | ||
this._options = options; | ||
if (repeatContainer && options) { | ||
this.initializeBeforeContentElement(); | ||
this.initializeAfterContentElement(); | ||
} | ||
} | ||
refresh(offsetStart: number = 0): void { | ||
this.offsetData = offsetStart; | ||
this._isInitialized = false; | ||
this._scrollParent.removeEventListener('scroll', this.getScrollHandler()); | ||
if (this._totalCount == 0) { | ||
this._isInitialized = true; | ||
} else { | ||
this.setOffsetAfterFirstLoad(); | ||
} | ||
this._scrollParent.addEventListener('scroll', this.getScrollHandler()); | ||
} | ||
initialize(collection: Array<NkRibbonItem>, offsetStart: number, totalCount: number): void { | ||
this.originalCollection = collection; | ||
this._totalCount = totalCount; | ||
this.setScrollParent(); | ||
this.refresh(offsetStart); | ||
} | ||
destroy(): void { | ||
this._scrollParent.removeEventListener('scroll', this.getScrollHandler()); | ||
refresh(offsetStart: number = 0): void { | ||
this.offsetData = offsetStart; | ||
this._isInitialized = false; | ||
this._scrollParent.removeEventListener('scroll', this.getScrollHandler()); | ||
if (this._totalCount == 0) { | ||
this._isInitialized = true; | ||
} else { | ||
this.setOffsetAfterFirstLoad(); | ||
} | ||
this._scrollParent.addEventListener('scroll', this.getScrollHandler()); | ||
} | ||
setScrollParent(): void { | ||
if (this._options.repeatContainerSelector) { | ||
if (this._options.repeatContainerSelector == 'window') { | ||
this._scrollParent = window; | ||
} else { | ||
this._scrollParent = document.querySelector(this._options.repeatContainerSelector); | ||
} | ||
} else { | ||
this._scrollParent = this._repeatContainer; | ||
} | ||
destroy(): void { | ||
if (this._scrollParent) { | ||
this._scrollParent.removeEventListener('scroll', this.getScrollHandler()); | ||
} | ||
} | ||
updateCollection(collection: Array<NkRibbonItem>): void { | ||
this._vsCollection = []; | ||
Array.prototype.push.apply(this._vsCollection, collection); | ||
setScrollParent(): void { | ||
if (this._options.repeatContainerSelector) { | ||
if (this._options.repeatContainerSelector == 'window') { | ||
this._scrollParent = window; | ||
} else { | ||
this._scrollParent = document.querySelector(this._options.repeatContainerSelector); | ||
} | ||
} else { | ||
this._scrollParent = this._repeatContainer; | ||
} | ||
} | ||
updateOriginalCollection(collection: Array<NkRibbonItem>): void { | ||
this.originalCollection = collection; | ||
} | ||
updateCollection(collection: Array<NkRibbonItem>): void { | ||
this._vsCollection.length = 0; | ||
Array.prototype.push.apply(this._vsCollection, collection); | ||
} | ||
buildRepeatContainer(domElem: HTMLElement): void { | ||
this._repeatContainer.appendChild(this._beforeContent); | ||
this._repeatContainer.appendChild(domElem); | ||
this._repeatContainer.appendChild(this._afterContent); | ||
let template = this._repeatContainer.querySelector('.js-ribbon-after-progress-bar'); | ||
if (template) { | ||
this._afterContent.appendChild(template); | ||
} | ||
template = this._repeatContainer.querySelector('.js-ribbon-before-progress-bar'); | ||
if (template) { | ||
this._beforeContent.appendChild(template); | ||
this._beforeLoaderHeight = template.getBoundingClientRect().height; | ||
} | ||
template = this._repeatContainer.querySelector('.js-ribbon-noresult'); | ||
if (template) { | ||
this._afterContent.appendChild(template); | ||
} | ||
template = this._repeatContainer.querySelector('.js-ribbon-error-result'); | ||
if (template) { | ||
this._afterContent.appendChild(template); | ||
} | ||
} | ||
updateOriginalCollection(collection: Array<NkRibbonItem>): void { | ||
this.originalCollection = collection; | ||
} | ||
createBeforeContentElement(): void { | ||
this._beforeContent = document.createElement('div'); | ||
this._beforeContent.classList.add('nk-repeat-before-content'); | ||
buildRepeatContainer(): void { | ||
let template = this._repeatContainer.querySelector('.js-ribbon-after-progress-bar'); | ||
if (template) { | ||
this._afterContent.appendChild(template); | ||
} | ||
createAfterContentElement(): void { | ||
this._afterContent = document.createElement('div'); | ||
this._afterContent.classList.add('nk-repeat-after-content'); | ||
template = this._repeatContainer.querySelector('.js-ribbon-before-progress-bar'); | ||
if (template) { | ||
this._beforeContent.appendChild(template); | ||
this._beforeLoaderHeight = template.getBoundingClientRect().height; | ||
} | ||
getSizeElement(): number { | ||
var size = this.getDefaultElementSize(); | ||
return size; | ||
template = this._repeatContainer.querySelector('.js-ribbon-noresult'); | ||
if (template) { | ||
this._afterContent.appendChild(template); | ||
} | ||
getDefaultElementSize(): number { | ||
if (this._defaultElementSize == 0) { | ||
let doc = document.createElement('div'); | ||
doc.innerHTML = this.options.itemTemplateString; | ||
this._repeatContainer.insertBefore(doc, this._repeatContainer.childNodes[0]); | ||
this._defaultElementSize = doc.clientHeight; | ||
doc.parentNode.removeChild(doc); | ||
} | ||
return this._defaultElementSize; | ||
template = this._repeatContainer.querySelector('.js-ribbon-error-result'); | ||
if (template) { | ||
this._afterContent.appendChild(template); | ||
} | ||
} | ||
getClientSize(element: any, sizeProp: string): number { | ||
if (element === window) { | ||
return sizeProp === 'clientWidth' ? window.innerWidth : window.innerHeight; | ||
} | ||
else { | ||
return element[sizeProp]; | ||
} | ||
} | ||
initializeBeforeContentElement(): void { | ||
this._beforeContent = this._repeatContainer.querySelector('.nk-repeat-before-content') as HTMLElement; | ||
} | ||
getScrollOffset(vsElement: any, scrollElement: any): number { | ||
let vsPos = vsElement.getBoundingClientRect()['top']; | ||
let scrollPos = scrollElement === window ? 0 : scrollElement.getBoundingClientRect()['top']; | ||
let correction = vsPos - scrollPos + this.scrollHelper.scrollTop(scrollElement); | ||
initializeAfterContentElement(): void { | ||
this._afterContent = this._repeatContainer.querySelector('.nk-repeat-after-content') as HTMLElement; | ||
} | ||
return correction; | ||
getSizeElement(): number { | ||
var size = this.getDefaultElementSize(); | ||
return size; | ||
} | ||
getDefaultElementSize(): number { | ||
return this._defaultElementSize; | ||
} | ||
getClientSize(element: any, sizeProp: string): number { | ||
if (element === window) { | ||
return sizeProp === 'clientWidth' ? window.innerWidth : window.innerHeight; | ||
} | ||
else { | ||
return element[sizeProp]; | ||
} | ||
} | ||
setOffsetViewPort(previosLoadCount: number = 0, correct: number = 0): void { | ||
let offset = this.calculateOffset(previosLoadCount, correct); | ||
this._beforeContent.style.minHeight = offset.offsetBefore + 'px'; | ||
this._afterContent.style.minHeight = offset.offsetAfter + 'px'; | ||
getScrollOffset(vsElement: any, scrollElement: any): number { | ||
let vsPos = vsElement.getBoundingClientRect()['top']; | ||
let scrollPos = scrollElement === window ? 0 : scrollElement.getBoundingClientRect()['top']; | ||
let correction = vsPos - scrollPos + this.scrollHelper.scrollTop(scrollElement); | ||
return correction; | ||
} | ||
setOffsetViewPort(previosLoadCount: number = 0, correct: number = 0): void { | ||
let offset = this.calculateOffset(previosLoadCount, correct); | ||
if (this._beforeContent) { | ||
this._beforeContent.style.minHeight = offset.offsetBefore + 'px'; | ||
} | ||
if (this._afterContent) { | ||
this._afterContent.style.minHeight = offset.offsetAfter + 'px'; | ||
} | ||
} | ||
calculateOffset(previosLoadCount: number, correct: number): any { | ||
let offsetBefore = 0; | ||
let offsetAfter = 0; | ||
let totalSize = 0; | ||
if (this.options.isDynamicSize) { | ||
offsetBefore = this._sizesCumulative[(previosLoadCount + this.startIndex)] + this.options.offsetBefore; | ||
offsetAfter = this._sizesCumulative[(this.virtualCollectionLength + this.startIndex)] + this.options.offsetBefore; | ||
totalSize = this._sizesCumulative[this.originalCount]; | ||
} else { | ||
offsetBefore = (previosLoadCount + this.startIndex) * this.getSizeElement() + this.options.offsetBefore; | ||
offsetAfter = (this.virtualCollectionLength + this.startIndex) * this.getSizeElement() + this.options.offsetBefore; | ||
totalSize = (this.originalCount) * this.getSizeElement(); | ||
} | ||
let total = this.options.offsetBefore + totalSize + this.options.offsetAfter; | ||
return { offsetBefore: offsetBefore, offsetAfter: total - offsetAfter } | ||
calculateOffset(previosLoadCount: number, correct: number): any { | ||
let offsetBefore = 0; | ||
let offsetAfter = 0; | ||
let totalSize = 0; | ||
if (this.options.isDynamicSize) { | ||
offsetBefore = this._sizesCumulative[(previosLoadCount + this.startIndex)] + this.options.offsetBefore; | ||
offsetAfter = this._sizesCumulative[(this.virtualCollectionLength + this.startIndex)] + this.options.offsetBefore; | ||
totalSize = this._sizesCumulative[this.originalCount]; | ||
} else { | ||
offsetBefore = (previosLoadCount + this.startIndex) * this.getSizeElement() + this.options.offsetBefore; | ||
offsetAfter = (this.virtualCollectionLength + this.startIndex) * this.getSizeElement() + this.options.offsetBefore; | ||
totalSize = (this.originalCount) * this.getSizeElement(); | ||
} | ||
let total = this.options.offsetBefore + totalSize + this.options.offsetAfter; | ||
return { offsetBefore: offsetBefore, offsetAfter: total - offsetAfter } | ||
} | ||
private $scrollPosition: number = 0; | ||
private $scrollPosition: number = 0; | ||
updateInnerCollection(): void { | ||
updateInnerCollection(): void { | ||
this.$scrollPosition = this.scrollHelper.scrollTop(this._scrollParent); | ||
let $clientSize = this.getClientSize(this._scrollParent, 'clientHeight'); | ||
this.$scrollPosition = this.scrollHelper.scrollTop(this._scrollParent); | ||
let $clientSize = this.getClientSize(this._scrollParent, 'clientHeight'); | ||
let scrollOffset = this._repeatContainer === this._scrollParent ? 0 : this.getScrollOffset( | ||
this._repeatContainer, | ||
this._scrollParent | ||
); | ||
let _startIndex = this.startIndex; | ||
let _endIndex = this.endIndex; | ||
let excess = 2; | ||
let scrollOffset = this._repeatContainer === this._scrollParent ? 0 : this.getScrollOffset( | ||
this._repeatContainer, | ||
this._scrollParent | ||
); | ||
let _startIndex = this.startIndex; | ||
let _endIndex = this.endIndex; | ||
let excess = 2; | ||
if (this.options.isDynamicSize) { | ||
_startIndex = 0; | ||
while (this._sizesCumulative[_startIndex] < this.$scrollPosition - this.options.offsetBefore - scrollOffset) { | ||
_startIndex++; | ||
} | ||
if (_startIndex > 0) { | ||
_startIndex--; | ||
} | ||
_startIndex = Math.max(Math.floor(_startIndex - excess / 2), 0); | ||
_endIndex = _startIndex; | ||
while (this._sizesCumulative[_endIndex] < this.$scrollPosition - this.options.offsetBefore - scrollOffset + $clientSize) { | ||
_endIndex++; | ||
} | ||
_endIndex = Math.min(Math.ceil(_endIndex + excess / 2), this.originalCount); | ||
} else { | ||
_startIndex = Math.max(Math.floor((this.$scrollPosition - scrollOffset) / this.getSizeElement()) - excess / 2, 0); | ||
_endIndex = Math.min(_startIndex + Math.ceil($clientSize / this.getSizeElement()) + excess, this.originalCount); | ||
} | ||
if (this.options.isDynamicSize) { | ||
_startIndex = 0; | ||
while (this._sizesCumulative[_startIndex] < this.$scrollPosition - this.options.offsetBefore - scrollOffset) { | ||
_startIndex++; | ||
} | ||
if (_startIndex > 0) { | ||
_startIndex--; | ||
} | ||
_startIndex = Math.max(Math.floor(_startIndex - excess / 2), 0); | ||
_endIndex = _startIndex; | ||
while (this._sizesCumulative[_endIndex] < this.$scrollPosition - this.options.offsetBefore - scrollOffset + $clientSize) { | ||
_endIndex++; | ||
} | ||
_endIndex = Math.min(Math.ceil(_endIndex + excess / 2), this.originalCount); | ||
} else { | ||
_startIndex = Math.max(Math.floor((this.$scrollPosition - scrollOffset) / this.getSizeElement()) - excess / 2, 0); | ||
_endIndex = Math.min(_startIndex + Math.ceil($clientSize / this.getSizeElement()) + excess, this.originalCount); | ||
} | ||
this._minStartIndex = Math.min(_startIndex, this._minStartIndex); | ||
this._maxEndIndex = Math.max(_endIndex, this._maxEndIndex); | ||
this._minStartIndex = Math.min(_startIndex, this._minStartIndex); | ||
this._maxEndIndex = Math.max(_endIndex, this._maxEndIndex); | ||
this.startIndex = _startIndex; | ||
this.endIndex = _endIndex; | ||
this.startIndex = _startIndex; | ||
this.endIndex = _endIndex; | ||
let digestRequired = false; | ||
if (this._prevStartIndex == 0) { | ||
digestRequired = true; | ||
} else if (this._prevEndIndex == 0) { | ||
digestRequired = true; | ||
} | ||
let digestRequired = false; | ||
if (this._prevStartIndex == 0) { | ||
digestRequired = true; | ||
} else if (this._prevEndIndex == 0) { | ||
digestRequired = true; | ||
} | ||
if (!digestRequired) { | ||
digestRequired = this.startIndex !== this._prevStartIndex || this.endIndex !== this._prevEndIndex; | ||
} | ||
if (!digestRequired) { | ||
digestRequired = this.startIndex !== this._prevStartIndex || this.endIndex !== this._prevEndIndex; | ||
} | ||
if (digestRequired) { | ||
this.updateCollection(this.originalCollection.slice(this.startIndex, this.endIndex)); | ||
if (digestRequired) { | ||
this.updateCollection(this.originalCollection.slice(this.startIndex, this.endIndex)); | ||
let triggerIndex = this.originalCollection.length - this.options.scrolledToEndOffset; | ||
if ((this.endIndex >= triggerIndex && this._prevEndIndex <= triggerIndex && this.scrolledToEnd)) { | ||
this.scrolledToEnd().subscribe(() => { | ||
this.reinitialize(); | ||
}); | ||
} | ||
let triggerIndex = this.originalCollection.length - this.options.scrolledToEndOffset; | ||
if ((this.endIndex >= triggerIndex && this._prevEndIndex <= triggerIndex && this.scrolledToEnd)) { | ||
this.scrolledToEnd().subscribe(() => { | ||
this.reinitialize(); | ||
}); | ||
} | ||
triggerIndex = this.options.scrolledToStartOffset; | ||
if (this.startIndex <= triggerIndex && (this._prevStartIndex > triggerIndex || parseInt(this._beforeContent.style.minHeight) <= this.getDefaultElementSize()) && this.scrolledToStart) { | ||
this.scrolledToStart().subscribe(() => { | ||
this.updateInnerCollectionAfterPreviosPageLoading(); | ||
}); | ||
} | ||
triggerIndex = this.options.scrolledToStartOffset; | ||
if (this.startIndex <= triggerIndex && (this._prevStartIndex > triggerIndex || (this._beforeContent && parseInt(this._beforeContent.style.minHeight)) <= this.getDefaultElementSize()) && this.scrolledToStart) { | ||
this.scrolledToStart().subscribe(() => { | ||
this.updateInnerCollectionAfterPreviosPageLoading(); | ||
}); | ||
} | ||
this._prevStartIndex = this.startIndex; | ||
this._prevEndIndex = this.endIndex; | ||
this._prevStartIndex = this.startIndex; | ||
this._prevEndIndex = this.endIndex; | ||
} | ||
} | ||
updateInnerCollectionWithDynamicSizesAfterPreviosLoad(withCorrect:boolean = false): void { | ||
} | ||
this.$scrollPosition = this.scrollHelper.scrollTop(this._scrollParent); | ||
let $clientSize = this.getClientSize(this._scrollParent, 'clientHeight'); | ||
updateInnerCollectionWithDynamicSizesAfterPreviosLoad(withCorrect: boolean = false): void { | ||
let scrollOffset = this._repeatContainer === this._scrollParent ? 0 : this.getScrollOffset( | ||
this._repeatContainer, | ||
this._scrollParent | ||
); | ||
let _endIndex = 0; | ||
let excess = 2; | ||
this.$scrollPosition = this.scrollHelper.scrollTop(this._scrollParent); | ||
let $clientSize = this.getClientSize(this._scrollParent, 'clientHeight'); | ||
let _startIndex = 8; | ||
_endIndex = _startIndex; | ||
while (this._sizesCumulative[_endIndex] < this.$scrollPosition - this.options.offsetBefore - scrollOffset + $clientSize) { | ||
_endIndex++; | ||
} | ||
_endIndex = Math.min(Math.ceil(_endIndex + excess / 2), this.originalCount); | ||
let scrollOffset = this._repeatContainer === this._scrollParent ? 0 : this.getScrollOffset( | ||
this._repeatContainer, | ||
this._scrollParent | ||
); | ||
let _endIndex = 0; | ||
let excess = 2; | ||
this.startIndex = _startIndex; | ||
this.endIndex = _endIndex; | ||
let _startIndex = 8; | ||
_endIndex = _startIndex; | ||
while (this._sizesCumulative[_endIndex] < this.$scrollPosition - this.options.offsetBefore - scrollOffset + $clientSize) { | ||
_endIndex++; | ||
} | ||
_endIndex = Math.min(Math.ceil(_endIndex + excess / 2), this.originalCount); | ||
this.updateCollection(this.originalCollection.slice(this.startIndex, this.endIndex)); | ||
if (withCorrect) { | ||
this.$vsCollection[0].correctingScrollTop = this.setScrollTopByItem; | ||
this.$vsCollection[1].correctingScrollTop = this.setScrollTopByItem; | ||
} | ||
this._prevStartIndex = this.startIndex; | ||
this._prevEndIndex = this.endIndex; | ||
this.startIndex = _startIndex; | ||
this.endIndex = _endIndex; | ||
this.updateCollection(this.originalCollection.slice(this.startIndex, this.endIndex)); | ||
if (withCorrect) { | ||
this.$vsCollection[0].correctingScrollTop = this.setScrollTopByItem; | ||
this.$vsCollection[1].correctingScrollTop = this.setScrollTopByItem; | ||
} | ||
this._prevStartIndex = this.startIndex; | ||
this._prevEndIndex = this.endIndex; | ||
private _scrollHandler: any; | ||
getScrollHandler(): any { | ||
if (!this._scrollHandler) { | ||
this._scrollHandler = () => { | ||
this.updateInnerCollection(); | ||
this.setOffsetViewPort(); | ||
}; | ||
} | ||
return this._scrollHandler; | ||
} | ||
} | ||
//watchOriginalCollection(): void { | ||
// if (this._isInitialized) { | ||
// if (this._oldOriginalCollection !== this._originalCollection) { | ||
// this._oldOriginalCollection = this._originalCollection; | ||
// this._oldOriginalCount = this._originalCollection.length; | ||
// //if (this._isInitialized) { | ||
// // this.refresh(); | ||
// //} | ||
// } else { | ||
// let newLength = this._originalCollection.length; | ||
// let old = this._oldOriginalCount; | ||
// if (old !== newLength) { | ||
// this._oldOriginalCount = newLength; | ||
// //this.refresh(); | ||
// //this.setScrollPositionAfterChangedOriginalCollection(); | ||
// } | ||
// } | ||
// } | ||
//} | ||
reinitialize(): void { | ||
if (this.originalCollection.length == 0) { | ||
this.$vsCollection.length = 0; | ||
this._sizesCumulative.length = 0; | ||
} else { | ||
if (this.options.isDynamicSize) { | ||
this.recalculateDynamicSizes(); | ||
} | ||
} | ||
this._prevStartIndex = 0; | ||
this._prevEndIndex = 0; | ||
this._minStartIndex = this.originalCount; | ||
this._maxEndIndex = 0; | ||
private _scrollHandler: any; | ||
getScrollHandler(): any { | ||
if (!this._scrollHandler) { | ||
this._scrollHandler = () => { | ||
this.updateInnerCollection(); | ||
this.setOffsetViewPort(); | ||
}; | ||
} | ||
return this._scrollHandler; | ||
} | ||
setOffsetAfterFirstLoad(): void { | ||
//watchOriginalCollection(): void { | ||
// if (this._isInitialized) { | ||
// if (this._oldOriginalCollection !== this._originalCollection) { | ||
// this._oldOriginalCollection = this._originalCollection; | ||
// this._oldOriginalCount = this._originalCollection.length; | ||
// //if (this._isInitialized) { | ||
// // this.refresh(); | ||
// //} | ||
if (this.offsetData > 0) { | ||
if (this.options.isDynamicSize) { | ||
this.recalculateDynamicSizes(); | ||
} | ||
let excess = 2; | ||
this.startIndex = this.options.pageSize - excess; | ||
let $clientSize = this.getClientSize(this._scrollParent, 'clientHeight'); | ||
this.endIndex = Math.min(this.startIndex + Math.ceil($clientSize / this.getSizeElement()) + excess, this.originalCount); | ||
let than = this; | ||
than.setOffsetViewPort(); | ||
than.updateCollection(than.originalCollection.slice(than.startIndex, than.endIndex)); | ||
} else { | ||
this.reinitialize(); | ||
} | ||
// } else { | ||
// let newLength = this._originalCollection.length; | ||
// let old = this._oldOriginalCount; | ||
// if (old !== newLength) { | ||
// this._oldOriginalCount = newLength; | ||
// //this.refresh(); | ||
// //this.setScrollPositionAfterChangedOriginalCollection(); | ||
// } | ||
// } | ||
// } | ||
//} | ||
reinitialize(): void { | ||
if (this.originalCollection.length == 0) { | ||
this.$vsCollection.length = 0; | ||
this._sizesCumulative.length = 0; | ||
} else { | ||
if (this.options.isDynamicSize) { | ||
this.recalculateDynamicSizes(); | ||
} | ||
} | ||
this._prevStartIndex = 0; | ||
this._prevEndIndex = 0; | ||
this._minStartIndex = this.originalCount; | ||
this._maxEndIndex = 0; | ||
this.updateInnerCollection(); | ||
this.setOffsetViewPort(); | ||
setScrollTopAfterFirstLoad(): void { | ||
let top = 0; | ||
if (this.options.isDynamicSize) { | ||
this.recalculateDynamicSizes(); | ||
if (this._offsetData > 0 && this._offsetData < this.options.pageSize) { | ||
top = this.offsetData * this.getSizeElement(); | ||
this.setScroll(top); | ||
} else if (this._offsetData >= this.options.pageSize) { | ||
top = this._sizesCumulative[this.options.pageSize + 1]; | ||
this.setScroll(top); | ||
} else { | ||
this.setScroll(0); | ||
} | ||
} else { | ||
} | ||
if (this._offsetData > 0 && this._offsetData < this.options.pageSize) { | ||
top = this.offsetData * this.getSizeElement(); | ||
this.setScroll(top); | ||
} else if (this._offsetData >= this.options.pageSize) { | ||
top = this.options.pageSize * this.getSizeElement(); | ||
this.setScroll(top); | ||
} else { | ||
this.setScroll(0); | ||
} | ||
} | ||
setOffsetAfterFirstLoad(): void { | ||
if (this.offsetData > 0) { | ||
if (this.options.isDynamicSize) { | ||
this.recalculateDynamicSizes(); | ||
} | ||
let excess = 2; | ||
this.startIndex = this.options.pageSize - excess; | ||
let $clientSize = this.getClientSize(this._scrollParent, 'clientHeight'); | ||
this.endIndex = Math.min(this.startIndex + Math.ceil($clientSize / this.getSizeElement()) + excess, this.originalCount); | ||
let than = this; | ||
than.setOffsetViewPort(); | ||
than.updateCollection(than.originalCollection.slice(than.startIndex, than.endIndex)); | ||
} else { | ||
this.reinitialize(); | ||
} | ||
} | ||
updateInnerCollectionAfterPreviosPageLoading(): void { | ||
if (this.options.isDynamicSize) { | ||
this._scrollParent.removeEventListener('scroll', this.getScrollHandler()); | ||
let than = this; | ||
than.recalculateDynamicSizes(); | ||
than.setOffsetViewPort(than.options.pageSize - than.options.scrolledToStartOffset); | ||
let scrollPosition = this.scrollHelper.scrollTop(this._scrollParent); | ||
if (scrollPosition < this._sizesCumulative[2]) { | ||
than.scrollHelper.scrollTop(than._scrollParent, this._sizesCumulative[than.options.pageSize - than.options.scrolledToStartOffset] - this._beforeLoaderHeight); | ||
than.updateInnerCollectionWithDynamicSizesAfterPreviosLoad(true); | ||
} else { | ||
than.updateInnerCollectionWithDynamicSizesAfterPreviosLoad(false); | ||
} | ||
than._scrollParent.addEventListener('scroll', than.getScrollHandler()); | ||
setScrollTopAfterFirstLoad(): void { | ||
let top = 0; | ||
if (this.options.isDynamicSize) { | ||
this.recalculateDynamicSizes(); | ||
if (this._offsetData > 0 && this._offsetData < this.options.pageSize) { | ||
top = this.offsetData * this.getSizeElement(); | ||
this.setScroll(top); | ||
} else if (this._offsetData >= this.options.pageSize) { | ||
top = this._sizesCumulative[this.options.pageSize + 1]; | ||
this.setScroll(top); | ||
} else { | ||
this.setScroll(0); | ||
} | ||
} else { | ||
} else { | ||
this._scrollParent.removeEventListener('scroll', this.getScrollHandler()); | ||
this.setOffsetViewPort(this.options.pageSize - this.options.scrolledToStartOffset); | ||
this.updateInnerCollection(); | ||
this.scrollHelper.scrollTop(this._scrollParent, this.getSizeElement() * (this.options.pageSize + this.options.scrolledToStartOffset) - this._beforeLoaderHeight); | ||
this._scrollParent.addEventListener('scroll', this.getScrollHandler()); | ||
} | ||
if (this._offsetData > 0 && this._offsetData < this.options.pageSize) { | ||
top = this.offsetData * this.getSizeElement(); | ||
this.setScroll(top); | ||
} else if (this._offsetData >= this.options.pageSize) { | ||
top = this.options.pageSize * this.getSizeElement(); | ||
this.setScroll(top); | ||
} else { | ||
this.setScroll(0); | ||
} | ||
} | ||
setScroll(top: number) { | ||
let than = this; | ||
let currentTop = this.scrollHelper.scrollTop(this._scrollParent); | ||
if (currentTop == top) { | ||
than._isInitialized = true; | ||
return; | ||
} else { | ||
than.scrollHelper.scrollTop(this._scrollParent, top); | ||
setTimeout(function () { | ||
than.setScroll(top); | ||
}, 100); | ||
} | ||
} | ||
} | ||
scrolling(item: NkRibbonItem): void { | ||
updateInnerCollectionAfterPreviosPageLoading(): void { | ||
if (this.options.isDynamicSize) { | ||
this._scrollParent.removeEventListener('scroll', this.getScrollHandler()); | ||
let than = this; | ||
than.recalculateDynamicSizes(); | ||
than.setOffsetViewPort(than.options.pageSize - than.options.scrolledToStartOffset); | ||
let scrollPosition = this.scrollHelper.scrollTop(this._scrollParent); | ||
if (scrollPosition < this._sizesCumulative[2]) { | ||
than.scrollHelper.scrollTop(than._scrollParent, this._sizesCumulative[than.options.pageSize - than.options.scrolledToStartOffset] - this._beforeLoaderHeight); | ||
than.updateInnerCollectionWithDynamicSizesAfterPreviosLoad(true); | ||
} else { | ||
than.updateInnerCollectionWithDynamicSizesAfterPreviosLoad(false); | ||
} | ||
than._scrollParent.addEventListener('scroll', than.getScrollHandler()); | ||
if (this.options.isDynamicSize) { | ||
let h = item.element.nativeElement.clientHeight; | ||
if (item.clientHeight != h) { | ||
item.clientHeight = h; | ||
this.recalculateDynamicSizes(); | ||
} | ||
} | ||
this.onScrolling.emit(item); | ||
} else { | ||
this._scrollParent.removeEventListener('scroll', this.getScrollHandler()); | ||
this.setOffsetViewPort(this.options.pageSize - this.options.scrolledToStartOffset); | ||
this.updateInnerCollection(); | ||
this.scrollHelper.scrollTop(this._scrollParent, this.getSizeElement() * (this.options.pageSize + this.options.scrolledToStartOffset) - this._beforeLoaderHeight); | ||
this._scrollParent.addEventListener('scroll', this.getScrollHandler()); | ||
} | ||
} | ||
setScrollTopByItem(top:number): void { | ||
let scrollPosition = this.scrollHelper.scrollTop(this._scrollParent); | ||
this.scrollHelper.scrollTop(this._scrollParent, scrollPosition + top); | ||
setScroll(top: number) { | ||
let than = this; | ||
let currentTop = this.scrollHelper.scrollTop(this._scrollParent); | ||
if (currentTop == top) { | ||
than._isInitialized = true; | ||
return; | ||
} else { | ||
than.scrollHelper.scrollTop(this._scrollParent, top); | ||
setTimeout(function () { | ||
than.setScroll(top); | ||
}, 100); | ||
} | ||
} | ||
recalculateDynamicSizes(): void { | ||
let than = this; | ||
let sizes = this.originalCollection.map(function (item) { | ||
let size = item.clientHeight; | ||
if (item.element) { | ||
size = item.element.nativeElement.clientHeight; | ||
} | ||
else if (!size) { | ||
size = than.getDefaultElementSize(); | ||
} | ||
item.clientHeight = size; | ||
return size; | ||
}); | ||
let sum = 0; | ||
this._sizesCumulative = sizes.map(function (size) { | ||
let res = sum; | ||
sum += size; | ||
return res; | ||
}); | ||
this._sizesCumulative.push(sum); | ||
scrolling(item: NkRibbonItem): void { | ||
if (this.options.isDynamicSize) { | ||
let h = item.element.nativeElement.clientHeight; | ||
if (item.clientHeight != h) { | ||
item.clientHeight = h; | ||
this.recalculateDynamicSizes(); | ||
} | ||
} | ||
this.onScrolling.emit(item); | ||
} | ||
setScrollTopByItem(top: number): void { | ||
let scrollPosition = this.scrollHelper.scrollTop(this._scrollParent); | ||
this.scrollHelper.scrollTop(this._scrollParent, scrollPosition + top); | ||
} | ||
recalculateDynamicSizes(): void { | ||
let than = this; | ||
let sizes = this.originalCollection.map(function (item) { | ||
let size = item.clientHeight; | ||
if (item.element) { | ||
size = item.element.nativeElement.clientHeight; | ||
} | ||
else if (!size) { | ||
size = than.getDefaultElementSize(); | ||
} | ||
item.clientHeight = size; | ||
return size; | ||
}); | ||
let sum = 0; | ||
this._sizesCumulative = sizes.map(function (size) { | ||
let res = sum; | ||
sum += size; | ||
return res; | ||
}); | ||
this._sizesCumulative.push(sum); | ||
} | ||
} |
@@ -7,3 +7,1 @@ export * from './interfaces'; | ||
export { NkRibbonRepeater } from './nkRibbon.repeater'; | ||
export { NkRibbonRuntimeRepeaterResolver } from './nkRibbon.runtimeRepeaterResolver'; | ||
export { NkRibbonItemModule } from './nkRibbon.item.module'; |
@@ -1,8 +0,15 @@ | ||
export * from './models'; | ||
export { NkRibbon } from './nkRibbon.component'; | ||
export { NkRibbonItemElement } from './nkRibbon.item.directive'; | ||
export { NkRibbonModule } from './nkRibbon.module'; | ||
export { NkRibbonRepeater } from './nkRibbon.repeater'; | ||
export { NkRibbonRuntimeRepeaterResolver } from './nkRibbon.runtimeRepeaterResolver'; | ||
export { NkRibbonItemModule } from './nkRibbon.item.module'; | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./models")); | ||
var nkRibbon_component_1 = require("./nkRibbon.component"); | ||
exports.NkRibbon = nkRibbon_component_1.NkRibbon; | ||
var nkRibbon_item_directive_1 = require("./nkRibbon.item.directive"); | ||
exports.NkRibbonItemElement = nkRibbon_item_directive_1.NkRibbonItemElement; | ||
var nkRibbon_module_1 = require("./nkRibbon.module"); | ||
exports.NkRibbonModule = nkRibbon_module_1.NkRibbonModule; | ||
var nkRibbon_repeater_1 = require("./nkRibbon.repeater"); | ||
exports.NkRibbonRepeater = nkRibbon_repeater_1.NkRibbonRepeater; | ||
//# sourceMappingURL=public-api.js.map |
@@ -7,4 +7,4 @@ export * from './interfaces'; | ||
export { NkRibbonRepeater } from './nkRibbon.repeater'; | ||
export { NkRibbonRuntimeRepeaterResolver } from './nkRibbon.runtimeRepeaterResolver'; | ||
export { NkRibbonItemModule } from './nkRibbon.item.module'; | ||
@@ -1,2 +0,7 @@ | ||
export * from './public-api'; | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./public-api")); | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
export * from './public-api'; | ||
export * from './public-api'; |
@@ -1,2 +0,4 @@ | ||
import { animate, state, style, transition, trigger, } from '@angular/animations'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var animations_1 = require("@angular/animations"); | ||
/** | ||
@@ -13,4 +15,4 @@ * The following are all the animations for the md-select component, with each | ||
*/ | ||
export var transformPlaceholder = trigger('transformPlaceholder', [ | ||
state('floating-ltr', style({ | ||
exports.transformPlaceholder = animations_1.trigger('transformPlaceholder', [ | ||
animations_1.state('floating-ltr', animations_1.style({ | ||
top: '-22px', | ||
@@ -20,3 +22,3 @@ left: '-2px', | ||
})), | ||
state('floating-rtl', style({ | ||
animations_1.state('floating-rtl', animations_1.style({ | ||
top: '-22px', | ||
@@ -26,3 +28,3 @@ left: '2px', | ||
})), | ||
transition('* => *', animate('400ms cubic-bezier(0.25, 0.8, 0.25, 1)')) | ||
animations_1.transition('* => *', animations_1.animate('400ms cubic-bezier(0.25, 0.8, 0.25, 1)')) | ||
]); | ||
@@ -38,4 +40,4 @@ /** | ||
*/ | ||
export var transformMenu = trigger('transformMenu', [ | ||
state('showing', style({ | ||
exports.transformMenu = animations_1.trigger('transformMenu', [ | ||
animations_1.state('showing', animations_1.style({ | ||
opacity: 1, | ||
@@ -45,3 +47,3 @@ minWidth: 'calc(100%)', | ||
})), | ||
state('showing-multiple', style({ | ||
animations_1.state('showing-multiple', animations_1.style({ | ||
opacity: 1, | ||
@@ -51,4 +53,4 @@ minWidth: 'calc(100% + 64px)', | ||
})), | ||
transition('void => *', [ | ||
style({ | ||
animations_1.transition('void => *', [ | ||
animations_1.style({ | ||
opacity: 0, | ||
@@ -58,6 +60,6 @@ minWidth: '100%', | ||
}), | ||
animate('150ms cubic-bezier(0.25, 0.8, 0.25, 1)') | ||
animations_1.animate('150ms cubic-bezier(0.25, 0.8, 0.25, 1)') | ||
]), | ||
transition('* => void', [ | ||
animate('250ms 100ms linear', style({ opacity: 0 })) | ||
animations_1.transition('* => void', [ | ||
animations_1.animate('250ms 100ms linear', animations_1.style({ opacity: 0 })) | ||
]) | ||
@@ -70,9 +72,9 @@ ]); | ||
*/ | ||
export var fadeInContent = trigger('fadeInContent', [ | ||
state('showing', style({ opacity: 1 })), | ||
transition('void => showing', [ | ||
style({ opacity: 0 }), | ||
animate('150ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)') | ||
exports.fadeInContent = animations_1.trigger('fadeInContent', [ | ||
animations_1.state('showing', animations_1.style({ opacity: 1 })), | ||
animations_1.transition('void => showing', [ | ||
animations_1.style({ opacity: 0 }), | ||
animations_1.animate('150ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)') | ||
]) | ||
]); | ||
//# sourceMappingURL=nkSelect.animation.js.map |
@@ -0,0 +0,0 @@ import { |
@@ -1,10 +0,24 @@ | ||
import { Component, Optional, Input, Output, EventEmitter, ElementRef, Renderer2, Self, ChangeDetectorRef, Attribute, ContentChild, TemplateRef, ViewEncapsulation } from '@angular/core'; | ||
import { DOWN_ARROW, END, ENTER, HOME, SPACE, UP_ARROW, ESCAPE } from '../core/keyCodes'; | ||
import { Http } from '@angular/http'; | ||
import { Observable } from 'rxjs/rx'; | ||
import 'rxjs/add/operator/map'; | ||
import 'rxjs/add/operator/catch'; | ||
import { NgControl, NgModel, Validators } from '@angular/forms'; | ||
import { transformPlaceholder, transformMenu, fadeInContent } from './nkSelect.animation'; | ||
import { NkSelectOptions } from './NkSelect.Options'; | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
var __param = (this && this.__param) || function (paramIndex, decorator) { | ||
return function (target, key) { decorator(target, key, paramIndex); } | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_1 = require("@angular/core"); | ||
var keyCodes_1 = require("../core/keyCodes"); | ||
var http_1 = require("@angular/http"); | ||
var rx_1 = require("rxjs/rx"); | ||
require("rxjs/add/operator/map"); | ||
require("rxjs/add/operator/catch"); | ||
var forms_1 = require("@angular/forms"); | ||
var nkSelect_animation_1 = require("./nkSelect.animation"); | ||
var NkSelect_Options_1 = require("./NkSelect.Options"); | ||
var NkSelect = /** @class */ (function () { | ||
@@ -26,8 +40,8 @@ function NkSelect(_changeDetectorRef, ngModel, renderer, elementRef, _control, tabIndex, required, http) { | ||
//events | ||
this.onSelectItem = new EventEmitter(); | ||
this.onStartLoadData = new EventEmitter(); | ||
this.onEndLoadData = new EventEmitter(); | ||
this.onOpen = new EventEmitter(); | ||
this.onClose = new EventEmitter(); | ||
this.onChange = new EventEmitter(); | ||
this.onSelectItem = new core_1.EventEmitter(); | ||
this.onStartLoadData = new core_1.EventEmitter(); | ||
this.onEndLoadData = new core_1.EventEmitter(); | ||
this.onOpen = new core_1.EventEmitter(); | ||
this.onClose = new core_1.EventEmitter(); | ||
this.onChange = new core_1.EventEmitter(); | ||
this._required = false; | ||
@@ -51,3 +65,3 @@ this._disabled = false; | ||
this._isOpen = false; | ||
this._options = new NkSelectOptions(); | ||
this._options = new NkSelect_Options_1.NkSelectOptions(); | ||
if (this._control) { | ||
@@ -179,3 +193,3 @@ this._control.valueAccessor = this; | ||
var _this = this; | ||
return new Observable(function (observer) { | ||
return new rx_1.Observable(function (observer) { | ||
_this._getData().subscribe(function () { | ||
@@ -256,3 +270,3 @@ observer.next(); | ||
} | ||
return new Observable(function (observer) { | ||
return new rx_1.Observable(function (observer) { | ||
_this._addEmptyValueByRequiredAttribute(); | ||
@@ -268,3 +282,3 @@ _this.onEndLoadData.emit({ eventSource: _this }); | ||
this.isPending = true; | ||
var data = new Observable(function (observer) { | ||
var data = new rx_1.Observable(function (observer) { | ||
_this._request = _this.http.get(_this._options.remoteDataSource, { search: _this._searchParams.toString() }) | ||
@@ -279,3 +293,3 @@ .map(function (res) { | ||
_this._request = null; | ||
return Observable.throw(error.json().error || 'Server error'); | ||
return rx_1.Observable.throw(error.json().error || 'Server error'); | ||
}) | ||
@@ -386,3 +400,3 @@ .subscribe(function (response) { | ||
if (this._required) { | ||
this.ngModel.control.setValidators([Validators.required]); | ||
this.ngModel.control.setValidators([forms_1.Validators.required]); | ||
} | ||
@@ -400,3 +414,3 @@ else { | ||
if (this._required) { | ||
this.ngModel.control.setValidators([Validators.required]); | ||
this.ngModel.control.setValidators([forms_1.Validators.required]); | ||
} | ||
@@ -436,4 +450,4 @@ } | ||
var keyCode = event.keyCode; | ||
var isArrowKey = keyCode === DOWN_ARROW || keyCode === UP_ARROW; | ||
var isOpenKey = keyCode === ENTER || keyCode === SPACE; | ||
var isArrowKey = keyCode === keyCodes_1.DOWN_ARROW || keyCode === keyCodes_1.UP_ARROW; | ||
var isOpenKey = keyCode === keyCodes_1.ENTER || keyCode === keyCodes_1.SPACE; | ||
if (isOpenKey || isArrowKey) { | ||
@@ -446,7 +460,7 @@ event.preventDefault(); | ||
var keyCode = event.keyCode; | ||
var isArrowKey = keyCode === DOWN_ARROW || keyCode === UP_ARROW; | ||
var isCloseKey = keyCode === ESCAPE; | ||
var isSelectKey = keyCode === ENTER || keyCode === SPACE; | ||
var isFirstItem = keyCode === HOME; | ||
var isLastItem = keyCode === END; | ||
var isArrowKey = keyCode === keyCodes_1.DOWN_ARROW || keyCode === keyCodes_1.UP_ARROW; | ||
var isCloseKey = keyCode === keyCodes_1.ESCAPE; | ||
var isSelectKey = keyCode === keyCodes_1.ENTER || keyCode === keyCodes_1.SPACE; | ||
var isFirstItem = keyCode === keyCodes_1.HOME; | ||
var isLastItem = keyCode === keyCodes_1.END; | ||
if (isCloseKey) { | ||
@@ -458,7 +472,7 @@ this.close(); | ||
} | ||
else if (keyCode === HOME) { | ||
else if (keyCode === keyCodes_1.HOME) { | ||
event.preventDefault(); | ||
this._setFirstItemActive(); | ||
} | ||
else if (keyCode === END) { | ||
else if (keyCode === keyCodes_1.END) { | ||
event.preventDefault(); | ||
@@ -476,6 +490,6 @@ this._setLastItemActive(); | ||
switch (event.keyCode) { | ||
case DOWN_ARROW: | ||
case keyCodes_1.DOWN_ARROW: | ||
this._setNextItemActive(); | ||
break; | ||
case UP_ARROW: | ||
case keyCodes_1.UP_ARROW: | ||
this._setPreviousItemActive(); | ||
@@ -529,61 +543,112 @@ break; | ||
}; | ||
NkSelect.decorators = [ | ||
{ type: Component, args: [{ | ||
selector: 'nk-select', | ||
encapsulation: ViewEncapsulation.None, | ||
template: "<div class=\"nk-select-view-wrapper\" [style.width]=\"_width\"><div class=\"nk-select-view-selected\" *ngIf=\"_hasSelectedItem()\"><ng-template [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{ item: selectedItem }\"></ng-template></div><input class=\"nk-select-filter-input\" *ngIf=\"_isFilter && isOpen\" [value]=\"filterValue\" (input)=\"filterValue=$event.target.value\"/> <span class=\"nk-select-view-default\" *ngIf=\"!_hasSelectedItem()\">{{options.displayTextDefault}}</span> <span class=\"nk-select-arrow\"></span></div><span class=\"nk-select-loading\" *ngIf=\"isPending\">{{options.displayTextForLoading}}</span><ng-template nk-select-menu (backdropClick)=\"close()\" [open]=\"isOpen\" [menuAnimateDone]=\"_menuDoneAnimating\" [appendTo]=\"options.appendTo\" [themeClass]=\"options.themeClassMenu\" [controlElement]=\"_origin\"><div class=\"nk-menu-panel\" [style.transformOrigin]=\"transformOrigin\" [@transformMenu]=\"'showing'\" (@transformMenu.done)=\"onMenuDone()\"><div [@fadeInContent]=\"'showing'\" (@fadeInContent.done)=\"_onFadeInDone()\"><div nk-select-menu-item class=\"nk-menu-item\" *ngFor=\"let item of items | nkSelectFilter : filterBy : filterValue\" (click)=\"selectItem(item);\" [item]=\"item\"><ng-template [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{item: item}\"></ng-template><div class=\"mat-ripple-element mat-ripple\"></div></div></div></div></ng-template>", | ||
styles: ["@-webkit-keyframes rotate{0%{transform:rotate(0);-o-transform:rotate(0);-moz-transform:rotate(0);-webkit-transform:rotate(0)}to{transform:rotate(360deg);-o-transform:rotate(360deg);-moz-transform:rotate(360deg);-webkit-transform:rotate(360deg)}}@keyframes rotate{0%{transform:rotate(0);-o-transform:rotate(0);-moz-transform:rotate(0);-webkit-transform:rotate(0)}to{transform:rotate(360deg);-o-transform:rotate(360deg);-moz-transform:rotate(360deg);-webkit-transform:rotate(360deg)}}.nk-menu-item:hover,.nk-select-control:focus .nk-select-view-default,.nk-select-control:focus .nk-select-view-selected{color:#673ab7}.nk-select-control{outline-style:none;-webkit-box-shadow:none;box-shadow:none;border-color:transparent;margin:5px;display:-webkit-box;display:-ms-flexbox;display:flex}.nk-select-control:focus .nk-select-view-wrapper{border-color:#673ab7}.nk-select-control.nk-select-menu-self{position:relative}.nk-select-view-wrapper{border:1px solid gray;border-radius:4px;position:relative;cursor:pointer}.nk-select-view-default{display:block}.nk-select-view-default,.nk-select-view-selected{padding:2px 25px 2px 8px;width:100%}.nk-select-arrow,.nk-select-view-selected{display:inline-block}.nk-menu-container{position:absolute;pointer-events:auto;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:1000;max-width:280px;-webkit-overflow-scrolling:touch;padding-top:0;padding-bottom:0;max-height:256px;min-width:124.28px}.nk-select-arrow{width:0;height:0;margin:auto 4px;vertical-align:middle;border-left:6px solid transparent;border-right:6px solid transparent;border-top:10px solid;-webkit-transform-origin:6px 3px;transform-origin:6px 3px;position:absolute;top:0;bottom:0;right:4px}.nk-select-pending .nk-select-arrow{-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-name:rotate;animation-name:rotate;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-timing-function:linear;animation-timing-function:linear}.nk-select-disabled .nk-select-view-wrapper,.nk-select-pending .nk-select-view-default,.nk-select-pending .nk-select-view-selected{opacity:.3;background:#eeeded}.ng-invalid.ng-touched .nk-select-view-wrapper{border:1px solid red}.nk-menu-panel{-webkit-box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12);box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12);background:#fff;max-height:240px;overflow:auto}.nk-menu-item{cursor:pointer}.nk-select-loading{margin-left:8px}.nk-select-menu-selected{background:rgba(0,0,0,.04)}.nk-select-filter-input{position:absolute;border:0;top:1px;width:100%;padding-right:25px}.nk-select-filter-input:focus{outline:0}"], | ||
host: { | ||
'[attr.tabindex]': 'tabIndex', | ||
'[class.nk-select-disabled]': 'disabled', | ||
'[class.nk-select-pending]': 'isPending', | ||
'[class.nk-select-open-menu]': 'isOpen', | ||
'[class.nk-select-close-menu]': '!isOpen', | ||
'class': 'nk-select-control', | ||
'(click)': 'toggle($event)', | ||
'(blur)': 'onBlur()', | ||
'(keydown)': 'handleKeydown($event)' | ||
}, | ||
animations: [ | ||
transformPlaceholder, | ||
transformMenu, | ||
fadeInContent | ||
], | ||
exportAs: 'nkSelect' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
NkSelect.ctorParameters = function () { return [ | ||
{ type: ChangeDetectorRef, }, | ||
{ type: NgModel, }, | ||
{ type: Renderer2, }, | ||
{ type: ElementRef, }, | ||
{ type: NgControl, decorators: [{ type: Self }, { type: Optional },] }, | ||
{ type: undefined, decorators: [{ type: Attribute, args: ['tabindex',] },] }, | ||
{ type: undefined, decorators: [{ type: Attribute, args: ['required',] },] }, | ||
{ type: Http, }, | ||
]; }; | ||
NkSelect.propDecorators = { | ||
'itemTemplate': [{ type: ContentChild, args: [TemplateRef,] },], | ||
'_appendTo': [{ type: Input, args: ['appendTo',] },], | ||
'_themeClassMenu': [{ type: Input, args: ['themeClassMenu',] },], | ||
'_remoteDataSource': [{ type: Input, args: ['nkSelectRemoteDataSource',] },], | ||
'_primaryKey': [{ type: Input, args: ['nkSelectPrimaryKey',] },], | ||
'_viewValueInitialize': [{ type: Input, args: ['nkSelectViewValue',] },], | ||
'_filterBy': [{ type: Input, args: ['nkSelectFilterBy',] },], | ||
'_dataBindingMode': [{ type: Input, args: ['nkSelectDataBindingMode',] },], | ||
'_isCache': [{ type: Input, args: ['nkSelectCache',] },], | ||
'_width': [{ type: Input, args: ['width',] },], | ||
'onSelectItem': [{ type: Output, args: ['nkSelectOnSelectItem',] },], | ||
'onStartLoadData': [{ type: Output, args: ['nkSelectOnStartLoadData',] },], | ||
'onEndLoadData': [{ type: Output, args: ['nkSelectOnEndLoadData',] },], | ||
'onOpen': [{ type: Output, args: ['nkSelectOnOpen',] },], | ||
'onClose': [{ type: Output, args: ['nkSelectOnClose',] },], | ||
'onChange': [{ type: Output, args: ['nkSelectOnChange',] },], | ||
'tabIndex': [{ type: Input },], | ||
'required': [{ type: Input },], | ||
}; | ||
__decorate([ | ||
core_1.ContentChild(core_1.TemplateRef), | ||
__metadata("design:type", core_1.TemplateRef) | ||
], NkSelect.prototype, "itemTemplate", void 0); | ||
__decorate([ | ||
core_1.Input('appendTo'), | ||
__metadata("design:type", String) | ||
], NkSelect.prototype, "_appendTo", void 0); | ||
__decorate([ | ||
core_1.Input('themeClassMenu'), | ||
__metadata("design:type", String) | ||
], NkSelect.prototype, "_themeClassMenu", void 0); | ||
__decorate([ | ||
core_1.Input('nkSelectRemoteDataSource'), | ||
__metadata("design:type", String) | ||
], NkSelect.prototype, "_remoteDataSource", void 0); | ||
__decorate([ | ||
core_1.Input('nkSelectPrimaryKey'), | ||
__metadata("design:type", String) | ||
], NkSelect.prototype, "_primaryKey", void 0); | ||
__decorate([ | ||
core_1.Input('nkSelectViewValue'), | ||
__metadata("design:type", Object) | ||
], NkSelect.prototype, "_viewValueInitialize", void 0); | ||
__decorate([ | ||
core_1.Input('nkSelectFilterBy'), | ||
__metadata("design:type", String) | ||
], NkSelect.prototype, "_filterBy", void 0); | ||
__decorate([ | ||
core_1.Input('nkSelectDataBindingMode'), | ||
__metadata("design:type", String) | ||
], NkSelect.prototype, "_dataBindingMode", void 0); | ||
__decorate([ | ||
core_1.Input('nkSelectCache'), | ||
__metadata("design:type", Boolean) | ||
], NkSelect.prototype, "_isCache", void 0); | ||
__decorate([ | ||
core_1.Input('width'), | ||
__metadata("design:type", String) | ||
], NkSelect.prototype, "_width", void 0); | ||
__decorate([ | ||
core_1.Output('nkSelectOnSelectItem'), | ||
__metadata("design:type", core_1.EventEmitter) | ||
], NkSelect.prototype, "onSelectItem", void 0); | ||
__decorate([ | ||
core_1.Output('nkSelectOnStartLoadData'), | ||
__metadata("design:type", core_1.EventEmitter) | ||
], NkSelect.prototype, "onStartLoadData", void 0); | ||
__decorate([ | ||
core_1.Output('nkSelectOnEndLoadData'), | ||
__metadata("design:type", core_1.EventEmitter) | ||
], NkSelect.prototype, "onEndLoadData", void 0); | ||
__decorate([ | ||
core_1.Output('nkSelectOnOpen'), | ||
__metadata("design:type", core_1.EventEmitter) | ||
], NkSelect.prototype, "onOpen", void 0); | ||
__decorate([ | ||
core_1.Output('nkSelectOnClose'), | ||
__metadata("design:type", core_1.EventEmitter) | ||
], NkSelect.prototype, "onClose", void 0); | ||
__decorate([ | ||
core_1.Output('nkSelectOnChange'), | ||
__metadata("design:type", core_1.EventEmitter) | ||
], NkSelect.prototype, "onChange", void 0); | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata("design:type", Number), | ||
__metadata("design:paramtypes", [Number]) | ||
], NkSelect.prototype, "tabIndex", null); | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata("design:type", Object), | ||
__metadata("design:paramtypes", [Object]) | ||
], NkSelect.prototype, "required", null); | ||
NkSelect = __decorate([ | ||
core_1.Component({ | ||
selector: 'nk-select', | ||
encapsulation: core_1.ViewEncapsulation.None, | ||
templateUrl: './nkSelect.html', | ||
styleUrls: ['./nkSelect.css'], | ||
host: { | ||
'[attr.tabindex]': 'tabIndex', | ||
'[class.nk-select-disabled]': 'disabled', | ||
'[class.nk-select-pending]': 'isPending', | ||
'[class.nk-select-open-menu]': 'isOpen', | ||
'[class.nk-select-close-menu]': '!isOpen', | ||
'class': 'nk-select-control', | ||
'(click)': 'toggle($event)', | ||
'(blur)': 'onBlur()', | ||
'(keydown)': 'handleKeydown($event)' | ||
}, | ||
animations: [ | ||
nkSelect_animation_1.transformPlaceholder, | ||
nkSelect_animation_1.transformMenu, | ||
nkSelect_animation_1.fadeInContent | ||
], | ||
exportAs: 'nkSelect' | ||
}), | ||
__param(4, core_1.Self()), __param(4, core_1.Optional()), | ||
__param(5, core_1.Attribute('tabindex')), | ||
__param(6, core_1.Attribute('required')), | ||
__metadata("design:paramtypes", [core_1.ChangeDetectorRef, | ||
forms_1.NgModel, | ||
core_1.Renderer2, | ||
core_1.ElementRef, | ||
forms_1.NgControl, String, String, http_1.Http]) | ||
], NkSelect); | ||
return NkSelect; | ||
}()); | ||
export { NkSelect }; | ||
exports.NkSelect = NkSelect; | ||
//# sourceMappingURL=nkSelect.component.js.map |
@@ -46,4 +46,4 @@ import { | ||
encapsulation: ViewEncapsulation.None, | ||
template: `<div class="nk-select-view-wrapper" [style.width]="_width"><div class="nk-select-view-selected" *ngIf="_hasSelectedItem()"><ng-template [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{ item: selectedItem }"></ng-template></div><input class="nk-select-filter-input" *ngIf="_isFilter && isOpen" [value]="filterValue" (input)="filterValue=$event.target.value"/> <span class="nk-select-view-default" *ngIf="!_hasSelectedItem()">{{options.displayTextDefault}}</span> <span class="nk-select-arrow"></span></div><span class="nk-select-loading" *ngIf="isPending">{{options.displayTextForLoading}}</span><ng-template nk-select-menu (backdropClick)="close()" [open]="isOpen" [menuAnimateDone]="_menuDoneAnimating" [appendTo]="options.appendTo" [themeClass]="options.themeClassMenu" [controlElement]="_origin"><div class="nk-menu-panel" [style.transformOrigin]="transformOrigin" [@transformMenu]="'showing'" (@transformMenu.done)="onMenuDone()"><div [@fadeInContent]="'showing'" (@fadeInContent.done)="_onFadeInDone()"><div nk-select-menu-item class="nk-menu-item" *ngFor="let item of items | nkSelectFilter : filterBy : filterValue" (click)="selectItem(item);" [item]="item"><ng-template [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{item: item}"></ng-template><div class="mat-ripple-element mat-ripple"></div></div></div></div></ng-template>`, | ||
styles: [`@-webkit-keyframes rotate{0%{transform:rotate(0);-o-transform:rotate(0);-moz-transform:rotate(0);-webkit-transform:rotate(0)}to{transform:rotate(360deg);-o-transform:rotate(360deg);-moz-transform:rotate(360deg);-webkit-transform:rotate(360deg)}}@keyframes rotate{0%{transform:rotate(0);-o-transform:rotate(0);-moz-transform:rotate(0);-webkit-transform:rotate(0)}to{transform:rotate(360deg);-o-transform:rotate(360deg);-moz-transform:rotate(360deg);-webkit-transform:rotate(360deg)}}.nk-menu-item:hover,.nk-select-control:focus .nk-select-view-default,.nk-select-control:focus .nk-select-view-selected{color:#673ab7}.nk-select-control{outline-style:none;-webkit-box-shadow:none;box-shadow:none;border-color:transparent;margin:5px;display:-webkit-box;display:-ms-flexbox;display:flex}.nk-select-control:focus .nk-select-view-wrapper{border-color:#673ab7}.nk-select-control.nk-select-menu-self{position:relative}.nk-select-view-wrapper{border:1px solid gray;border-radius:4px;position:relative;cursor:pointer}.nk-select-view-default{display:block}.nk-select-view-default,.nk-select-view-selected{padding:2px 25px 2px 8px;width:100%}.nk-select-arrow,.nk-select-view-selected{display:inline-block}.nk-menu-container{position:absolute;pointer-events:auto;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:1000;max-width:280px;-webkit-overflow-scrolling:touch;padding-top:0;padding-bottom:0;max-height:256px;min-width:124.28px}.nk-select-arrow{width:0;height:0;margin:auto 4px;vertical-align:middle;border-left:6px solid transparent;border-right:6px solid transparent;border-top:10px solid;-webkit-transform-origin:6px 3px;transform-origin:6px 3px;position:absolute;top:0;bottom:0;right:4px}.nk-select-pending .nk-select-arrow{-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-name:rotate;animation-name:rotate;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-timing-function:linear;animation-timing-function:linear}.nk-select-disabled .nk-select-view-wrapper,.nk-select-pending .nk-select-view-default,.nk-select-pending .nk-select-view-selected{opacity:.3;background:#eeeded}.ng-invalid.ng-touched .nk-select-view-wrapper{border:1px solid red}.nk-menu-panel{-webkit-box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12);box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12);background:#fff;max-height:240px;overflow:auto}.nk-menu-item{cursor:pointer}.nk-select-loading{margin-left:8px}.nk-select-menu-selected{background:rgba(0,0,0,.04)}.nk-select-filter-input{position:absolute;border:0;top:1px;width:100%;padding-right:25px}.nk-select-filter-input:focus{outline:0}`], | ||
templateUrl: './nkSelect.html', | ||
styleUrls: ['./nkSelect.css'], | ||
host: { | ||
@@ -50,0 +50,0 @@ '[attr.tabindex]': 'tabIndex', |
@@ -1,2 +0,10 @@ | ||
import { Pipe, Injectable } from '@angular/core'; | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_1 = require("@angular/core"); | ||
var NkSelectFilter = /** @class */ (function () { | ||
@@ -12,13 +20,11 @@ function NkSelectFilter() { | ||
}; | ||
NkSelectFilter.decorators = [ | ||
{ type: Pipe, args: [{ | ||
name: 'nkSelectFilter' | ||
},] }, | ||
{ type: Injectable }, | ||
]; | ||
/** @nocollapse */ | ||
NkSelectFilter.ctorParameters = function () { return []; }; | ||
NkSelectFilter = __decorate([ | ||
core_1.Pipe({ | ||
name: 'nkSelectFilter' | ||
}), | ||
core_1.Injectable() | ||
], NkSelectFilter); | ||
return NkSelectFilter; | ||
}()); | ||
export { NkSelectFilter }; | ||
exports.NkSelectFilter = NkSelectFilter; | ||
//# sourceMappingURL=nkSelect.filter.js.map |
@@ -1,2 +0,2 @@ | ||
import { Pipe, PipeTransform, Injectable } from '@angular/core'; | ||
import { Pipe, PipeTransform, Injectable } from '@angular/core'; | ||
@Pipe({ | ||
@@ -3,0 +3,0 @@ name: 'nkSelectFilter' |
@@ -1,25 +0,34 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { NkSelect } from './nkSelect.component'; | ||
import { NkSelectMenuDirective } from './nkSelectMenu.directive'; | ||
import { NkSelectMenuItem } from './nkSelectMenuItem.directive'; | ||
import { NkSelectFilter } from './nkSelect.filter'; | ||
import { CommonModule } from '@angular/common'; | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_1 = require("@angular/core"); | ||
var nkSelect_component_1 = require("./nkSelect.component"); | ||
var nkSelectMenu_directive_1 = require("./nkSelectMenu.directive"); | ||
var nkSelectMenuItem_directive_1 = require("./nkSelectMenuItem.directive"); | ||
var nkSelect_filter_1 = require("./nkSelect.filter"); | ||
var common_1 = require("@angular/common"); | ||
var NkSelectModule = /** @class */ (function () { | ||
function NkSelectModule() { | ||
} | ||
NkSelectModule.decorators = [ | ||
{ type: NgModule, args: [{ | ||
imports: [CommonModule], | ||
exports: [NkSelect, NkSelectMenuDirective, NkSelectMenuItem, NkSelectFilter], | ||
declarations: [NkSelect, NkSelectMenuDirective, NkSelectMenuItem, NkSelectFilter], | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
NkSelectModule.ctorParameters = function () { return []; }; | ||
NkSelectModule = __decorate([ | ||
core_1.NgModule({ | ||
imports: [common_1.CommonModule], | ||
exports: [nkSelect_component_1.NkSelect, nkSelectMenu_directive_1.NkSelectMenuDirective, nkSelectMenuItem_directive_1.NkSelectMenuItem, nkSelect_filter_1.NkSelectFilter], | ||
declarations: [nkSelect_component_1.NkSelect, nkSelectMenu_directive_1.NkSelectMenuDirective, nkSelectMenuItem_directive_1.NkSelectMenuItem, nkSelect_filter_1.NkSelectFilter], | ||
}) | ||
], NkSelectModule); | ||
return NkSelectModule; | ||
}()); | ||
export { NkSelectModule }; | ||
export * from './nkSelect.component'; | ||
export * from './nkSelectMenu.directive'; | ||
export * from './nkSelectMenuItem.directive'; | ||
exports.NkSelectModule = NkSelectModule; | ||
__export(require("./nkSelect.component")); | ||
__export(require("./nkSelectMenu.directive")); | ||
__export(require("./nkSelectMenuItem.directive")); | ||
//# sourceMappingURL=nkSelect.module.js.map |
@@ -1,2 +0,2 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { NgModule } from '@angular/core'; | ||
import { NkSelect } from './nkSelect.component'; | ||
@@ -3,0 +3,0 @@ import { NkSelectMenuDirective } from './nkSelectMenu.directive'; |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var NkSelectOptions = /** @class */ (function () { | ||
@@ -98,3 +100,3 @@ function NkSelectOptions() { | ||
}()); | ||
export { NkSelectOptions }; | ||
exports.NkSelectOptions = NkSelectOptions; | ||
//# sourceMappingURL=NkSelect.Options.js.map |
@@ -1,2 +0,2 @@ | ||
export class NkSelectOptions { | ||
export class NkSelectOptions { | ||
@@ -3,0 +3,0 @@ private _displayTextDefault: string; |
@@ -1,4 +0,15 @@ | ||
import { Directive, Input, Output, ViewContainerRef, TemplateRef, Renderer2, EventEmitter } from '@angular/core'; | ||
import { NkOptionsPosition } from '../core/position/nkOptionsPosition'; | ||
import { NkPositionBuilder } from '../core/position/nkPositionBuilder'; | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_1 = require("@angular/core"); | ||
var nkOptionsPosition_1 = require("../core/position/nkOptionsPosition"); | ||
var nkPositionBuilder_1 = require("../core/position/nkPositionBuilder"); | ||
var NkSelectMenuDirective = /** @class */ (function () { | ||
@@ -13,3 +24,3 @@ function NkSelectMenuDirective(_renderer, templateRef, viewContainerRef) { | ||
this.offsetX = 0; | ||
this.backdropClick = new EventEmitter(); | ||
this.backdropClick = new core_1.EventEmitter(); | ||
this._templateRef = templateRef; | ||
@@ -103,3 +114,3 @@ this._viewContainerRef = viewContainerRef; | ||
NkSelectMenuDirective.prototype._createPositionBuilder = function () { | ||
this._positionBuilder = new NkPositionBuilder(this.controlElement.firstElementChild); | ||
this._positionBuilder = new nkPositionBuilder_1.NkPositionBuilder(this.controlElement.firstElementChild); | ||
}; | ||
@@ -133,3 +144,3 @@ NkSelectMenuDirective.prototype._setElementPosition = function (element) { | ||
//['top', 'bottom', 'left', 'right'].forEach(p => element.style[p] = null); | ||
var positionOptions = new NkOptionsPosition(); | ||
var positionOptions = new nkOptionsPosition_1.NkOptionsPosition(); | ||
positionOptions.my = 'left top'; | ||
@@ -155,27 +166,46 @@ positionOptions.at = 'left bottom'; | ||
}; | ||
NkSelectMenuDirective.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[nk-select-menu]', | ||
exportAs: 'nkSelectMenu', | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
NkSelectMenuDirective.ctorParameters = function () { return [ | ||
{ type: Renderer2, }, | ||
{ type: TemplateRef, }, | ||
{ type: ViewContainerRef, }, | ||
]; }; | ||
NkSelectMenuDirective.propDecorators = { | ||
'open': [{ type: Input, args: ['open',] },], | ||
'menuAnimateDone': [{ type: Input, args: ['menuAnimateDone',] },], | ||
'appendTo': [{ type: Input, args: ['appendTo',] },], | ||
'themeClass': [{ type: Input, args: ['themeClass',] },], | ||
'offsetY': [{ type: Input, args: ['offsetY',] },], | ||
'offsetX': [{ type: Input, args: ['offsetX',] },], | ||
'controlElement': [{ type: Input, args: ['controlElement',] },], | ||
'backdropClick': [{ type: Output },], | ||
}; | ||
__decorate([ | ||
core_1.Input('open'), | ||
__metadata("design:type", Boolean) | ||
], NkSelectMenuDirective.prototype, "open", void 0); | ||
__decorate([ | ||
core_1.Input('menuAnimateDone'), | ||
__metadata("design:type", Boolean) | ||
], NkSelectMenuDirective.prototype, "menuAnimateDone", void 0); | ||
__decorate([ | ||
core_1.Input('appendTo'), | ||
__metadata("design:type", String) | ||
], NkSelectMenuDirective.prototype, "appendTo", void 0); | ||
__decorate([ | ||
core_1.Input('themeClass'), | ||
__metadata("design:type", String) | ||
], NkSelectMenuDirective.prototype, "themeClass", void 0); | ||
__decorate([ | ||
core_1.Input('offsetY'), | ||
__metadata("design:type", Number) | ||
], NkSelectMenuDirective.prototype, "offsetY", void 0); | ||
__decorate([ | ||
core_1.Input('offsetX'), | ||
__metadata("design:type", Number) | ||
], NkSelectMenuDirective.prototype, "offsetX", void 0); | ||
__decorate([ | ||
core_1.Input('controlElement'), | ||
__metadata("design:type", Element) | ||
], NkSelectMenuDirective.prototype, "controlElement", void 0); | ||
__decorate([ | ||
core_1.Output(), | ||
__metadata("design:type", Object) | ||
], NkSelectMenuDirective.prototype, "backdropClick", void 0); | ||
NkSelectMenuDirective = __decorate([ | ||
core_1.Directive({ | ||
selector: '[nk-select-menu]', | ||
exportAs: 'nkSelectMenu', | ||
}), | ||
__metadata("design:paramtypes", [core_1.Renderer2, | ||
core_1.TemplateRef, | ||
core_1.ViewContainerRef]) | ||
], NkSelectMenuDirective); | ||
return NkSelectMenuDirective; | ||
}()); | ||
export { NkSelectMenuDirective }; | ||
exports.NkSelectMenuDirective = NkSelectMenuDirective; | ||
//# sourceMappingURL=nkSelectMenu.directive.js.map |
@@ -0,0 +0,0 @@ import { |
@@ -1,2 +0,13 @@ | ||
import { Directive, Input, Renderer2, ElementRef } from '@angular/core'; | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_1 = require("@angular/core"); | ||
var NkSelectMenuItem = /** @class */ (function () { | ||
@@ -23,22 +34,20 @@ function NkSelectMenuItem(_renderer, _element) { | ||
}; | ||
NkSelectMenuItem.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[nk-select-menu-item]', | ||
exportAs: 'nkSelectMenuItem', | ||
host: { | ||
'[class.nk-select-menu-selected]': 'selected', | ||
}, | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
NkSelectMenuItem.ctorParameters = function () { return [ | ||
{ type: Renderer2, }, | ||
{ type: ElementRef, }, | ||
]; }; | ||
NkSelectMenuItem.propDecorators = { | ||
'item': [{ type: Input, args: ['item',] },], | ||
}; | ||
__decorate([ | ||
core_1.Input('item'), | ||
__metadata("design:type", Object) | ||
], NkSelectMenuItem.prototype, "item", void 0); | ||
NkSelectMenuItem = __decorate([ | ||
core_1.Directive({ | ||
selector: '[nk-select-menu-item]', | ||
exportAs: 'nkSelectMenuItem', | ||
host: { | ||
'[class.nk-select-menu-selected]': 'selected', | ||
}, | ||
}), | ||
__metadata("design:paramtypes", [core_1.Renderer2, | ||
core_1.ElementRef]) | ||
], NkSelectMenuItem); | ||
return NkSelectMenuItem; | ||
}()); | ||
export { NkSelectMenuItem }; | ||
exports.NkSelectMenuItem = NkSelectMenuItem; | ||
//# sourceMappingURL=nkSelectMenuItem.directive.js.map |
@@ -0,0 +0,0 @@ import { |
@@ -1,8 +0,19 @@ | ||
export * from './nkSelect.animation'; | ||
export { NkSelectFilter } from './nkSelect.filter'; | ||
export { NkSelect } from './nkSelect.component'; | ||
export { NkSelectModule } from './nkSelect.module'; | ||
export { NkSelectOptions } from './nkSelect.options'; | ||
export { NkSelectMenuDirective } from './nkSelectMenu.directive'; | ||
export { NkSelectMenuItem } from './nkSelectMenuItem.directive'; | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./nkSelect.animation")); | ||
var nkSelect_filter_1 = require("./nkSelect.filter"); | ||
exports.NkSelectFilter = nkSelect_filter_1.NkSelectFilter; | ||
var nkSelect_component_1 = require("./nkSelect.component"); | ||
exports.NkSelect = nkSelect_component_1.NkSelect; | ||
var nkSelect_module_1 = require("./nkSelect.module"); | ||
exports.NkSelectModule = nkSelect_module_1.NkSelectModule; | ||
var nkSelect_options_1 = require("./nkSelect.options"); | ||
exports.NkSelectOptions = nkSelect_options_1.NkSelectOptions; | ||
var nkSelectMenu_directive_1 = require("./nkSelectMenu.directive"); | ||
exports.NkSelectMenuDirective = nkSelectMenu_directive_1.NkSelectMenuDirective; | ||
var nkSelectMenuItem_directive_1 = require("./nkSelectMenuItem.directive"); | ||
exports.NkSelectMenuItem = nkSelectMenuItem_directive_1.NkSelectMenuItem; | ||
//# sourceMappingURL=public-api.js.map |
@@ -0,0 +0,0 @@ export * from './nkSelect.animation'; |
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
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
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
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1
385473
194
7085