UNPKG

@itexpert-dev/base-universal-table

Version:

base universal table for build tables

53 lines 2.95 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = require("@angular/core"); var tiny_helpers_1 = require("@itexpert-dev/tiny-helpers"); var baseUniversalTableDirective_1 = require("../common/baseUniversalTableDirective"); var angularInputValidator_1 = require("../common/angularInputValidator"); var baseUniversalTableCellDirectiveConfig_const_1 = require("./baseUniversalTableCellDirectiveConfig.const"); var IUniversalTableCellPosition_1 = require("../../../contracts/IUniversalTableCellPosition"); var BaseUniversalTableCellDirective = (function (_super) { __extends(BaseUniversalTableCellDirective, _super); function BaseUniversalTableCellDirective(tableCtrl, componentResolver, viewContainer, injector) { var _this = _super.call(this, componentResolver, viewContainer, tableCtrl) || this; _this.injector = injector; return _this; } BaseUniversalTableCellDirective.prototype.ngOnInit = function () { var validateResult = angularInputValidator_1.AngularInputValidator.checkRequireAttributes({ requireAttributes: ['rowIndex', 'cellIndex', 'cellData'], directiveContext: this, rightExample: baseUniversalTableCellDirectiveConfig_const_1.baseUniversalTableCellDirectiveConfig.selector + "((\"[rowIndex]\"=\"rowIndex\", \"[cellIndex]\"=\"cellIndex\", \"[cellData]\"=\"cellData\")" }); if (!tiny_helpers_1.isNull(validateResult)) { throw validateResult; } var originCell = this.cellData; var cellType = originCell.type; var cellComponent = this.resolveCellByType(cellType); var cellPosition = { cellData: this.cellData, cellIndex: this.cellIndex, rowIndex: this.rowIndex }; var injector = core_1.ReflectiveInjector.resolveAndCreate([{ provide: IUniversalTableCellPosition_1.IUniversalTableCellPosition, useValue: cellPosition }], this.injector); var cell = this.viewContainer.createComponent(cellComponent, 0, injector); originCell.instance = cell.instance; }; return BaseUniversalTableCellDirective; }(baseUniversalTableDirective_1.BaseUniversalTableDirective)); exports.BaseUniversalTableCellDirective = BaseUniversalTableCellDirective; //# sourceMappingURL=BaseUniversalTableCellDirective.js.map