com.phloxui
Version:
PhloxUI Ng2+ Framework
1,224 lines • 117 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
import * as tslib_1 from "tslib";
import { Component, ElementRef, Input, EventEmitter, Output } from '@angular/core';
import { I18N, Option } from '../../decorator/decorators';
import { Draggable } from '../../directive/Draggable.directive';
import { DefaultTableRow } from './DefaultTableRow.component';
import { NeedFocusService } from '../../service/NeedFocusService.service';
var /** @type {?} */ TYPE_NAME = "phx-expandable-table-row";
var /** @type {?} */ DEFAULT_DRAG_AUTO_EXPAND_ENABLED = true;
var /** @type {?} */ DEFAULT_DRAG_AUTO_EXPAND_DELAY = 600;
var /** @type {?} */ DEFAULT_DRAG_AUTO_EXPAND_EFFECT_CLASS = 'auto-expand';
var /** @type {?} */ DEFAULT_DRAG_AUTO_EXPAND_EFFECT_DURATION = 300;
var /** @type {?} */ DEFAULT_DRAG_AUTO_EXPAND_CONTRACT_ON_LEAVE = true;
var /** @type {?} */ DEFAULT_DRAG_AUTO_EXPAND_CONTRACT_DELAY = 600;
var /** @type {?} */ DEFAULT_DRAG_EFFECT_MOVE_OUT_CLASS = 'move-out';
var /** @type {?} */ DEFAULT_DRAG_EFFECT_MOVE_OUT_DURATION = 300;
var /** @type {?} */ DEFAULT_DRAG_EFFECT_MOVE_IN_CLASS = 'move-in';
var /** @type {?} */ DEFAULT_DRAG_EFFECT_MOVE_IN_DURATION = 2000;
var ExpandableTableRow = /** @class */ (function (_super) {
tslib_1.__extends(ExpandableTableRow, _super);
function ExpandableTableRow(elRef, needFocusService) {
var _this = _super.call(this, elRef, needFocusService) || this;
_this.showing = true;
_this.autoExpanding = false;
return _this;
}
/**
* @return {?}
*/
ExpandableTableRow.prototype.ngOnInit = /**
* @return {?}
*/
function () {
_super.prototype.ngOnInit.call(this);
// Set default option values
if (this.dragAutoExpandEnabled === null || typeof this.dragAutoExpandEnabled === 'undefined') {
this.dragAutoExpandEnabled = DEFAULT_DRAG_AUTO_EXPAND_ENABLED;
}
if (this.dragAutoExpandDelay === null || typeof this.dragAutoExpandDelay === 'undefined') {
this.dragAutoExpandDelay = DEFAULT_DRAG_AUTO_EXPAND_DELAY;
}
if (this.dragAutoExpandEffectClass === null || typeof this.dragAutoExpandEffectClass === 'undefined') {
this.dragAutoExpandEffectClass = DEFAULT_DRAG_AUTO_EXPAND_EFFECT_CLASS;
}
if (this.dragAutoExpandEffectDuration === null || typeof this.dragAutoExpandEffectDuration === 'undefined') {
this.dragAutoExpandEffectDuration = DEFAULT_DRAG_AUTO_EXPAND_EFFECT_DURATION;
}
if (this.dragAutoExpandContractOnLeave === null || typeof this.dragAutoExpandContractOnLeave === 'undefined') {
this.dragAutoExpandContractOnLeave = DEFAULT_DRAG_AUTO_EXPAND_CONTRACT_ON_LEAVE;
}
if (this.dragAutoExpandContractDelay === null || typeof this.dragAutoExpandContractDelay === 'undefined') {
this.dragAutoExpandContractDelay = DEFAULT_DRAG_AUTO_EXPAND_CONTRACT_DELAY;
}
if (this.dragEffectMoveOutClass === null || typeof this.dragEffectMoveOutClass === 'undefined') {
this.dragEffectMoveOutClass = DEFAULT_DRAG_EFFECT_MOVE_OUT_CLASS;
}
if (this.dragEffectMoveOutDuration === null || typeof this.dragEffectMoveOutDuration === 'undefined') {
this.dragEffectMoveOutDuration = DEFAULT_DRAG_EFFECT_MOVE_OUT_DURATION;
}
if (this.dragEffectMoveInClass === null || typeof this.dragEffectMoveInClass === 'undefined') {
this.dragEffectMoveInClass = DEFAULT_DRAG_EFFECT_MOVE_IN_CLASS;
}
if (this.dragEffectMoveInDuration === null || typeof this.dragEffectMoveInDuration === 'undefined') {
this.dragEffectMoveInDuration = DEFAULT_DRAG_EFFECT_MOVE_IN_DURATION;
}
this._initialParentConroller = this.getParent();
this._init();
};
/**
* @return {?}
*/
ExpandableTableRow.prototype._init = /**
* @return {?}
*/
function () {
// Check that it should be shown or not by checking its ascendants, if one of its ascendants is
// not expanding, so, this node should be hidden.
var /** @type {?} */ parent = this.controller.getParent();
while (parent !== null && typeof parent !== 'undefined') {
if (!parent.isExpanding()) {
// It should be hidden
this.setShowing(false);
break;
}
parent = parent.getParent();
}
// Check that its descendants should be shown or not by checking that this node is being expanded
// or not, if not, all of its descendants should be hidden.
if (!this.isExpanding()) {
this.contract();
}
// See that its parent or one of its ancestors' parent has been changed or not.
// If yes, it means that this node is being moved or relocated.
// So, play move-in effect.
if (this._isBeingRelocated()) {
this.playMoveInEffect();
}
};
/**
* @return {?}
*/
ExpandableTableRow.prototype._isBeingRelocated = /**
* @return {?}
*/
function () {
// This method will return true if this node is being relocated.
// (Its position in entire tree is being changed)
// Meaning that its parent or one of its ascendants' parent is being changed.
// Check that this node's parent is being changed or not
var /** @type {?} */ oldState = this.getOldState();
if (oldState !== null && typeof oldState !== 'undefined') {
var /** @type {?} */ oldParentData = null;
if (oldState.getComponentInstance() !== null && typeof oldState.getComponentInstance() !== 'undefined') {
// If there is a component instance, obtain old parent data from the
// component itself directly.
if (oldState.getComponentInstance()['_initialParentConroller'] !== null && typeof oldState.getComponentInstance()['_initialParentConroller'] !== 'undefined') {
oldParentData = oldState.getComponentInstance()['_initialParentConroller'].getData();
}
}
else {
if (oldState.getParent() !== null && typeof oldState.getParent() !== 'undefined') {
oldParentData = oldState.getParent().getData();
}
}
var /** @type {?} */ newParentData = null;
if (this.getParent() !== null && typeof this.getParent() !== 'undefined') {
newParentData = this.getParent().getData();
}
if (this.table.getRowGenerator().compareRowData(newParentData, oldParentData) !== 0) {
// Its parent is being changed
return true;
}
}
// Check for one of its ascendants' parent is being changed or not.
if (this.getParent() !== null && typeof this.getParent() !== 'undefined') {
if (this.getParent().getComponentInstance() !== null && typeof this.getParent().getComponentInstance() !== 'undefined') {
if (typeof this.getParent().getComponentInstance()._isBeingRelocated === 'function') {
return this.getParent().getComponentInstance()._isBeingRelocated();
}
}
}
return false;
};
// This method should be overridden by sub class to make data changes.
/**
* @param {?} movedRow
* @return {?}
*/
ExpandableTableRow.prototype.onMoveFrom = /**
* @param {?} movedRow
* @return {?}
*/
function (movedRow) {
};
// This method should be overridden by sub class to make data changes.
/**
* @return {?}
*/
ExpandableTableRow.prototype.onMoveToRoot = /**
* @return {?}
*/
function () {
};
/**
* @param {?} show
* @return {?}
*/
ExpandableTableRow.prototype.setShowing = /**
* @param {?} show
* @return {?}
*/
function (show) {
this.showing = show;
if (this.showing) {
$(this.elementRef.nativeElement).css('display', '');
}
else {
$(this.elementRef.nativeElement).css('display', 'none');
}
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.isShowing = /**
* @return {?}
*/
function () {
return this.showing;
};
/**
* @param {?} className
* @param {?=} parentRow
* @return {?}
*/
ExpandableTableRow.prototype.addStyleClassToDescendants = /**
* @param {?} className
* @param {?=} parentRow
* @return {?}
*/
function (className, parentRow) {
if (parentRow === undefined) {
parentRow = /** @type {?} */ (this);
}
if (!parentRow.getChildren()) {
return;
}
try {
for (var _a = tslib_1.__values(parentRow.getChildren()), _b = _a.next(); !_b.done; _b = _a.next()) {
var child = _b.value;
if (!child) {
continue;
}
if (child.getComponentInstance() && child.getComponentInstance()['elementRef']) {
$(child.getComponentInstance()['elementRef'].nativeElement).addClass(className);
}
this.addStyleClassToDescendants(className, child);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
}
finally { if (e_1) throw e_1.error; }
}
var e_1, _c;
};
/**
* @param {?} className
* @param {?=} parentRow
* @return {?}
*/
ExpandableTableRow.prototype.removeStyleClassFromDescendants = /**
* @param {?} className
* @param {?=} parentRow
* @return {?}
*/
function (className, parentRow) {
if (parentRow === undefined) {
parentRow = /** @type {?} */ (this);
}
if (!parentRow.getChildren()) {
return;
}
try {
for (var _a = tslib_1.__values(parentRow.getChildren()), _b = _a.next(); !_b.done; _b = _a.next()) {
var child = _b.value;
if (!child) {
continue;
}
if (child.getComponentInstance() && child.getComponentInstance()['elementRef']) {
$(child.getComponentInstance()['elementRef'].nativeElement).removeClass(className);
}
this.removeStyleClassFromDescendants(className, child);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
}
finally { if (e_2) throw e_2.error; }
}
var e_2, _c;
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.setAutoExpandContractTimer = /**
* @return {?}
*/
function () {
var _this = this;
if (!this.autoExpanding) {
// We'll auto contract this node if it was auto expanded only.
return;
}
if (this.dragAutoExpandContractTimer !== null && typeof this.dragAutoExpandContractTimer !== 'undefined') {
// The timeout is ticking
return;
}
this.dragAutoExpandContractTimer = setTimeout(function () {
_this.dragAutoExpandContractTimer = null;
_this._contract();
_this.autoExpanding = false;
}, this.dragAutoExpandContractDelay);
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.cancelAutoExpandContractTimer = /**
* @return {?}
*/
function () {
if (this.dragAutoExpandContractTimer !== null && typeof this.dragAutoExpandContractTimer !== 'undefined') {
clearTimeout(this.dragAutoExpandContractTimer);
this.dragAutoExpandContractTimer = null;
}
};
/**
* @return {?}
*/
ExpandableTableRow.prototype._expand = /**
* @return {?}
*/
function () {
if (this.controller === null || typeof this.controller === 'undefined') {
return;
}
// Delegate method call to controller
this.controller.expand();
};
/**
* @return {?}
*/
ExpandableTableRow.prototype._contract = /**
* @return {?}
*/
function () {
if (this.controller === null || typeof this.controller === 'undefined') {
return;
}
// Delegate method call to controller
this.controller.contract();
};
/**
* @return {?}
*/
ExpandableTableRow.prototype._toggleExpand = /**
* @return {?}
*/
function () {
if (this.controller === null || typeof this.controller === 'undefined') {
return;
}
// Delegate method call to controller
this.controller.toggleExpand();
};
/**
* @param {?} expand
* @return {?}
*/
ExpandableTableRow.prototype._setExpanding = /**
* @param {?} expand
* @return {?}
*/
function (expand) {
if (this.controller === null || typeof this.controller === 'undefined') {
return;
}
// Delegate method call to controller
this.controller.setExpanding(expand);
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.playMoveInEffect = /**
* @return {?}
*/
function () {
var _this = this;
// We do not chain playMoveInEffect() into its descendants here (like playMoveOutEffect()).
// Since, usually, this method will be called during ngOnInit(), so, its descendants'
// componentInstance should not be fully initialized.
return new Promise(function (resolve, reject) {
if (_this.dragMoveInEffectTimer !== null && typeof _this.dragMoveInEffectTimer !== 'undefined') {
clearTimeout(_this.dragMoveInEffectTimer);
}
if (_this.dragMoveInEffectResolve !== null && typeof _this.dragMoveInEffectResolve !== 'undefined') {
_this.dragMoveInEffectResolve(false);
}
// Add move-in style class
if (_this.elementRef !== null && typeof _this.elementRef !== 'undefined') {
$(_this.elementRef.nativeElement).addClass(_this.dragEffectMoveInClass);
}
_this.dragMoveInEffectTimer = setTimeout(function () {
try {
_this.dragMoveInEffectTimer = null;
_this.dragMoveInEffectResolve = null;
// Remove move-in style class
if (_this.elementRef !== null && typeof _this.elementRef !== 'undefined') {
$(_this.elementRef.nativeElement).removeClass(_this.dragEffectMoveInClass);
}
resolve(true);
}
catch (/** @type {?} */ e) {
reject(e);
}
}, _this.dragEffectMoveInDuration);
_this.dragMoveInEffectResolve = resolve;
});
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.playMoveOutEffect = /**
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ promises = [];
promises.push(new Promise(function (resolve, reject) {
if (_this.dragMoveOutEffectTimer !== null && typeof _this.dragMoveOutEffectTimer !== 'undefined') {
clearTimeout(_this.dragMoveOutEffectTimer);
}
if (_this.dragMoveOutEffectResolve !== null && typeof _this.dragMoveOutEffectResolve !== 'undefined') {
_this.dragMoveOutEffectResolve(false);
}
// Add move-in style class
if (_this.elementRef !== null && typeof _this.elementRef !== 'undefined') {
$(_this.elementRef.nativeElement).addClass(_this.dragEffectMoveOutClass);
}
_this.dragMoveOutEffectTimer = setTimeout(function () {
try {
_this.dragMoveOutEffectTimer = null;
_this.dragMoveOutEffectResolve = null;
// Remove move-in style class
if (_this.elementRef !== null && typeof _this.elementRef !== 'undefined') {
$(_this.elementRef.nativeElement).removeClass(_this.dragEffectMoveOutClass);
}
resolve(true);
}
catch (/** @type {?} */ e) {
reject(e);
}
}, _this.dragEffectMoveOutDuration);
_this.dragMoveOutEffectResolve = resolve;
}));
try {
// Chain this effect into its descendants
for (var _a = tslib_1.__values(this.getChildren()), _b = _a.next(); !_b.done; _b = _a.next()) {
var child = _b.value;
if (child.getComponentInstance() !== null || typeof child.getComponentInstance() !== 'undefined') {
if (typeof child.getComponentInstance().playMoveOutEffect === 'function') {
promises.push(child.getComponentInstance().playMoveOutEffect());
}
}
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
}
finally { if (e_3) throw e_3.error; }
}
return Promise.all(promises).then(function (result) {
if (result !== null && Array.isArray(result) && result.length > 0) {
return result[0];
}
return false;
});
var e_3, _c;
};
/**
* @param {?} controller
* @return {?}
*/
ExpandableTableRow.prototype.setController = /**
* @param {?} controller
* @return {?}
*/
function (controller) {
// Check that the given "controller" is an instance of ExpandableTableRowController or not?
if (controller !== null && typeof controller !== 'undefined') {
if (typeof controller['expand'] !== 'function') {
throw new Error('The given "controller" is not an instance of IExpandableTableRowController: ' + controller.constructor.name);
}
}
_super.prototype.setController.call(this, controller);
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.isAutoExpanding = /**
* @return {?}
*/
function () {
return this.autoExpanding;
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.getExpandLevel = /**
* @return {?}
*/
function () {
var /** @type {?} */ result = 0;
if (this.controller !== null && typeof this.controller !== 'undefined') {
result = this.controller.getExpandLevel();
}
return result;
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.expand = /**
* @return {?}
*/
function () {
this.autoExpanding = false;
this._expand();
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.contract = /**
* @return {?}
*/
function () {
this.autoExpanding = false;
this._contract();
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.toggleExpand = /**
* @return {?}
*/
function () {
this.autoExpanding = false;
this._toggleExpand();
};
/**
* @param {?} expand
* @return {?}
*/
ExpandableTableRow.prototype.setExpanding = /**
* @param {?} expand
* @return {?}
*/
function (expand) {
this.autoExpanding = false;
this._setExpanding(expand);
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.isExpanding = /**
* @return {?}
*/
function () {
if (this.controller === null || typeof this.controller === 'undefined') {
return true;
}
// Delegate method call to controller
return this.controller.isExpanding();
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.getParent = /**
* @return {?}
*/
function () {
if (this.controller === null || typeof this.controller === 'undefined') {
return null;
}
// Delegate method call to controller
return this.controller.getParent();
};
/**
* @param {?} parent
* @return {?}
*/
ExpandableTableRow.prototype.setParent = /**
* @param {?} parent
* @return {?}
*/
function (parent) {
if (this.controller === null || typeof this.controller === 'undefined') {
return;
}
// Delegate method call to controller
if (parent instanceof ExpandableTableRow) {
this.controller.setParent((/** @type {?} */ (parent)).getController());
}
else {
this.controller.setParent(parent);
}
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.getChildren = /**
* @return {?}
*/
function () {
if (this.controller === null || typeof this.controller === 'undefined') {
return [];
}
// Delegate method call to controller
return this.controller.getChildren();
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.hasChildren = /**
* @return {?}
*/
function () {
if (this.controller === null || typeof this.controller === 'undefined') {
return false;
}
// Delegate method call to controller
return this.controller.hasChildren();
};
/**
* @param {?} child
* @return {?}
*/
ExpandableTableRow.prototype.hasChild = /**
* @param {?} child
* @return {?}
*/
function (child) {
if (this.controller === null || typeof this.controller === 'undefined') {
return false;
}
// Delegate method call to controller
return this.controller.hasChild(child);
};
/**
* @param {?} event
* @return {?}
*/
ExpandableTableRow.prototype.onDragStart = /**
* @param {?} event
* @return {?}
*/
function (event) {
_super.prototype.onDragStart.call(this, event);
// Mark all of its descendants as dragging (add class ".dragging").
this.addStyleClassToDescendants(Draggable.CLASS_NAME_DRAGGING);
};
/**
* @param {?} event
* @return {?}
*/
ExpandableTableRow.prototype.onDragEnd = /**
* @param {?} event
* @return {?}
*/
function (event) {
_super.prototype.onDragEnd.call(this, event);
// Remove .dragging class from its descendants
this.removeStyleClassFromDescendants(Draggable.CLASS_NAME_DRAGGING);
};
/**
* @param {?} event
* @return {?}
*/
ExpandableTableRow.prototype.onDragOver = /**
* @param {?} event
* @return {?}
*/
function (event) {
var _this = this;
_super.prototype.onDragOver.call(this, event);
if (this.dragAutoExpandEnabled) {
if (this.autoExpanding) {
// If the mouse was leaved but re-enter this node again before contract delay was reached,
// we've to cancel contract dela timer to make this node still open.
this.cancelAutoExpandContractTimer();
}
// If the mouse was entered into descendant node auto expaned by its ancestors, we've to cancel
// auto contract timer from all of its ancestors.
if (this.controller !== null && typeof this.controller !== 'undefined') {
var /** @type {?} */ parent_1 = this.controller.getParent();
while (parent_1 !== null && typeof parent_1 !== 'undefined') {
// If this ancestor is auto expanding, cancel its contract timer.
if (parent_1.getComponentInstance() &&
typeof parent_1.getComponentInstance().isAutoExpanding === 'function' &&
parent_1.getComponentInstance().isAutoExpanding()) {
if (typeof parent_1.getComponentInstance().cancelAutoExpandContractTimer === 'function') {
parent_1.getComponentInstance().cancelAutoExpandContractTimer();
}
}
parent_1 = parent_1.getParent();
}
}
// We're going to auto expand this row if it is contracting.
if (!this.isExpanding() && this.hasChildren()) {
// We'll auto expand it if it is not being auto expanded.
if (!this.autoExpanding && (this.dragAutoExpandTimer === null || typeof this.dragAutoExpandTimer === 'undefined')) {
// Wait for auto expand delay
this.dragAutoExpandTimer = setTimeout(function () {
_this.dragAutoExpandTimer = null;
// Mark this node as autoExpanding
// Mark this node as autoExpanding
_this.autoExpanding = true;
if (_this.elementRef !== null && typeof _this.elementRef !== 'undefined') {
// Play effect (default: blink)
$(_this.elementRef.nativeElement).addClass(_this.dragAutoExpandEffectClass);
// Play until duration end then reset it
// Play until duration end then reset it
_this.dragAutoExpandEffectResetTimer = setTimeout(function () {
_this.dragAutoExpandEffectResetTimer = null;
// Reset effect
$(_this.elementRef.nativeElement).removeClass(_this.dragAutoExpandEffectClass);
// Then, auto expand this node
// Then, auto expand this node
_this._expand();
}, _this.dragAutoExpandEffectDuration);
}
else {
// Auto expand this node immediately (no effect will be played)
// Auto expand this node immediately (no effect will be played)
_this._expand();
}
}, this.dragAutoExpandDelay);
}
}
}
};
/**
* @param {?} event
* @return {?}
*/
ExpandableTableRow.prototype.onDragLeave = /**
* @param {?} event
* @return {?}
*/
function (event) {
_super.prototype.onDragLeave.call(this, event);
if (this.dragAutoExpandEnabled) {
if (this.autoExpanding) {
// Auto contract this node after delay timer reached.
this.setAutoExpandContractTimer();
}
else {
// If this node was leaved before auto expand delay timer reached out, cancel it.
if (this.dragAutoExpandTimer !== null && typeof this.dragAutoExpandTimer !== 'undefined') {
clearTimeout(this.dragAutoExpandTimer);
this.dragAutoExpandTimer = null;
}
}
// If this node is descendant of auto expanding ancestors, we've to tell all of its ancestors to
// auto contract themselves.
if (this.controller !== null && typeof this.controller !== 'undefined') {
var /** @type {?} */ parent_2 = this.controller.getParent();
while (parent_2 !== null && typeof parent_2 !== 'undefined') {
// If this ancestor is auto expanding, set its auto contract timer.
if (parent_2.getComponentInstance() &&
typeof parent_2.getComponentInstance().isAutoExpanding === 'function' &&
parent_2.getComponentInstance().isAutoExpanding()) {
if (typeof parent_2.getComponentInstance().setAutoExpandContractTimer === 'function') {
parent_2.getComponentInstance().setAutoExpandContractTimer();
}
}
parent_2 = parent_2.getParent();
}
}
}
};
/**
* @param {?} event
* @param {?} data
* @return {?}
*/
ExpandableTableRow.prototype.onDropAccepted = /**
* @param {?} event
* @param {?} data
* @return {?}
*/
function (event, data) {
_super.prototype.onDropAccepted.call(this, event, data);
// Find dragged row in this table
var /** @type {?} */ dragRow = /** @type {?} */ (this.table.findRow(data));
if (dragRow === null || typeof dragRow === 'undefined') {
return;
}
dragRow.getComponentInstance().moveTo(this);
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.moveToRoot = /**
* @return {?}
*/
function () {
return this.moveTo(null);
};
/**
* @param {?} toRow
* @return {?}
*/
ExpandableTableRow.prototype.moveTo = /**
* @param {?} toRow
* @return {?}
*/
function (toRow) {
var _this = this;
// Passing "toRow" = null mean moving to ROOT level
if (typeof toRow === 'undefined') {
toRow = null;
}
return this.playMoveOutEffect().then(function (result) {
if (!result) {
return false;
}
// Set new parent to this row
// toRow = null means maving to ROOT
// Set new parent to this row
// toRow = null means maving to ROOT
_this.setParent(toRow);
if (toRow !== null) {
// Trigger onMoveFrom event handler from new parent's sub class
toRow.onMoveFrom(_this);
}
else {
// Trigger onMoveToRoot event handler from this node's sub class
// Trigger onMoveToRoot event handler from this node's sub class
_this.onMoveToRoot();
}
// Then, re-render the table
// Then, re-render the table
_this.table.rerender(true);
return true;
});
};
/**
* @return {?}
*/
ExpandableTableRow.prototype.getOldState = /**
* @return {?}
*/
function () {
return /** @type {?} */ (_super.prototype.getOldState.call(this));
};
ExpandableTableRow.TYPE_NAME = TYPE_NAME;
ExpandableTableRow.DEFAULT_DRAG_AUTO_EXPAND_ENABLED = DEFAULT_DRAG_AUTO_EXPAND_ENABLED;
ExpandableTableRow.DEFAULT_DRAG_AUTO_EXPAND_DELAY = DEFAULT_DRAG_AUTO_EXPAND_DELAY;
ExpandableTableRow.DEFAULT_DRAG_AUTO_EXPAND_EFFECT_CLASS = DEFAULT_DRAG_AUTO_EXPAND_EFFECT_CLASS;
ExpandableTableRow.DEFAULT_DRAG_AUTO_EXPAND_EFFECT_DURATION = DEFAULT_DRAG_AUTO_EXPAND_EFFECT_DURATION;
ExpandableTableRow.DEFAULT_DRAG_AUTO_EXPAND_CONTRACT_ON_LEAVE = DEFAULT_DRAG_AUTO_EXPAND_CONTRACT_ON_LEAVE;
ExpandableTableRow.DEFAULT_DRAG_AUTO_EXPAND_CONTRACT_DELAY = DEFAULT_DRAG_AUTO_EXPAND_CONTRACT_DELAY;
ExpandableTableRow.DEFAULT_DRAG_EFFECT_MOVE_OUT_CLASS = DEFAULT_DRAG_EFFECT_MOVE_OUT_CLASS;
ExpandableTableRow.DEFAULT_DRAG_EFFECT_MOVE_OUT_DURATION = DEFAULT_DRAG_EFFECT_MOVE_OUT_DURATION;
ExpandableTableRow.DEFAULT_DRAG_EFFECT_MOVE_IN_CLASS = DEFAULT_DRAG_EFFECT_MOVE_OUT_CLASS;
ExpandableTableRow.DEFAULT_DRAG_EFFECT_MOVE_IN_DURATION = DEFAULT_DRAG_EFFECT_MOVE_OUT_DURATION;
ExpandableTableRow.decorators = [
{ type: Component, args: [{
moduleId: module.id,
selector: TYPE_NAME,
template: "<ng-template [ngIf]=\"getTable() !== undefined\">\n <div *ngFor=\"let cell of getTable().getModel().getRowModel().getCellModels(); let idx = index\"\n [style.width]=\"getTable().getModel().getColumnModels()[idx].getWidth()\"\n [style.max-width]=\"getTable().getModel().getColumnModels()[idx].getWidth()\"\n [attr.class]=\"'phx-table-cell' + (cell.getCSSClass() ? ' ' + cell.getCSSClass() : '')\"\n [phxDroppable]=\"this\" (click)=\"onTableRowCellClicked($event, idx)\" (dblclick)=\"onTableRowCellDblClicked($event, idx)\">\n <phx-component-wrapper [type]=\"cell.getComponentType()\"\n [options]=\"cell.getComponentOptions()\"\n [handler]=\"_getWrapperHandler(idx)\"\n [dataParent]=\"this\"\n [data]=\"getData()\"\n *ngIf=\"!isCellEditingMode(idx)\">\n </phx-component-wrapper>\n <phx-component-wrapper [type]=\"cell.getEditorComponentType()\"\n [options]=\"cell.getEditorComponentOptions()\"\n [handler]=\"_getWrapperHandler(idx)\"\n [dataParent]=\"this\"\n [data]=\"getData()\"\n *ngIf=\"isCellEditingMode(idx)\">\n </phx-component-wrapper>\n </div>\n</ng-template>\n"
},] },
];
/** @nocollapse */
ExpandableTableRow.ctorParameters = function () { return [
{ type: ElementRef, },
{ type: NeedFocusService, },
]; };
ExpandableTableRow.propDecorators = {
"dataParent": [{ type: Input },],
"ignoreParentData": [{ type: Input },],
"data": [{ type: Input },],
"ignoreParentDisabled": [{ type: Input },],
"delegateHistory": [{ type: Input },],
"onDisabled": [{ type: Input },],
"onEnabled": [{ type: Input },],
"loadingEnabled": [{ type: Input },],
"i18nKey": [{ type: Input },],
"bypass": [{ type: Input, args: ['i18nBypass',] },],
"options": [{ type: Input },],
"disabled": [{ type: Input },],
"help": [{ type: Input },],
"dropEffectRejectClass": [{ type: Input },],
"dropEffectRejectDuration": [{ type: Input },],
"dropDataTransferDropEffect": [{ type: Input },],
"dragDataTransferEffectAllowed": [{ type: Input },],
"beforeCellClickEvent": [{ type: Output, args: ['phxBeforeCellClick',] },],
"beforeCellDblClickEvent": [{ type: Output, args: ['phxBeforeCellDblClick',] },],
"beforeCellLostFocusEvent": [{ type: Output, args: ['phxBeforeCellLostFocus',] },],
"beforeCellFocusEvent": [{ type: Output, args: ['phxBeforeCellFocus',] },],
"cellClickEvent": [{ type: Output, args: ['phxCellClick',] },],
"cellDblClickEvent": [{ type: Output, args: ['phxCellDblClick',] },],
"cellLostFocusEvent": [{ type: Output, args: ['phxCellLostFocus',] },],
"cellFocusEvent": [{ type: Output, args: ['phxCellFocus',] },],
"rowDragEvent": [{ type: Output, args: ['phxRowDrag',] },],
"rowDragStartEvent": [{ type: Output, args: ['phxRowDragStart',] },],
"rowDragEndEvent": [{ type: Output, args: ['phxRowDragEnd',] },],
"rowDragEnterEvent": [{ type: Output, args: ['phxRowDragEnter',] },],
"rowDragOverEvent": [{ type: Output, args: ['phxRowDragOver',] },],
"rowDragLeaveEvent": [{ type: Output, args: ['phxRowDragLeave',] },],
"rowDropEvent": [{ type: Output, args: ['phxRowDrop',] },],
"rowDropAcceptedEvent": [{ type: Output, args: ['phxRowDropAccepted',] },],
"rowDropRejectedEvent": [{ type: Output, args: ['phxRowDropRejected',] },],
"changeEvent": [{ type: Output, args: ['phxChange',] },],
"beforeChangeEvent": [{ type: Output, args: ['phxBeforeChange',] },],
"dragAutoExpandEnabled": [{ type: Input },],
"dragAutoExpandDelay": [{ type: Input },],
"dragAutoExpandEffectClass": [{ type: Input },],
"dragAutoExpandEffectDuration": [{ type: Input },],
"dragAutoExpandContractOnLeave": [{ type: Input },],
"dragAutoExpandContractDelay": [{ type: Input },],
"dragEffectMoveOutClass": [{ type: Input },],
"dragEffectMoveOutDuration": [{ type: Input },],
"dragEffectMoveInClass": [{ type: Input },],
"dragEffectMoveInDuration": [{ type: Input },],
};
tslib_1.__decorate([
Option(),
tslib_1.__metadata("design:type", Object)
], ExpandableTableRow.prototype, "dataParent", void 0);
tslib_1.__decorate([
Option(),
tslib_1.__metadata("design:type", Boolean)
], ExpandableTableRow.prototype, "ignoreParentData", void 0);
tslib_1.__decorate([
Option(),
tslib_1.__metadata("design:type", Object)
], ExpandableTableRow.prototype, "data", void 0);
tslib_1.__decorate([
Option(),
tslib_1.__metadata("design:type", Boolean)
], ExpandableTableRow.prototype, "ignoreParentDisabled", void 0);
tslib_1.__decorate([
Option(),
tslib_1.__metadata("design:type", Boolean)
], ExpandableTableRow.prototype, "delegateHistory", void 0);
tslib_1.__decorate([
Option(),
tslib_1.__metadata("design:type", Function)
], ExpandableTableRow.prototype, "onDisabled", void 0);
tslib_1.__decorate([
Option(),
tslib_1.__metadata("design:type", Function)
], ExpandableTableRow.prototype, "onEnabled", void 0);
tslib_1.__decorate([
Option(),
tslib_1.__metadata("design:type", Boolean)
], ExpandableTableRow.prototype, "loadingEnabled", void 0);
tslib_1.__decorate([
Option(),
tslib_1.__metadata("design:type", String)
], ExpandableTableRow.prototype, "i18nKey", void 0);
tslib_1.__decorate([
Option('i18nBypass'),
tslib_1.__metadata("design:type", Boolean)
], ExpandableTableRow.prototype, "bypass", void 0);
tslib_1.__decorate([
Option(),
tslib_1.__metadata("design:type", Boolean)
], ExpandableTableRow.prototype, "disabled", void 0);
tslib_1.__decorate([
I18N(),
Option(),
tslib_1.__metadata("design:type", Object)
], ExpandableTableRow.prototype, "help", void 0);
tslib_1.__decorate([
Option('drop.effect.reject.class'),
tslib_1.__metadata("design:type", String)
], ExpandableTableRow.prototype, "dropEffectRejectClass", void 0);
tslib_1.__decorate([
Option('drop.effect.reject.duration'),
tslib_1.__metadata("design:type", Number)
], ExpandableTableRow.prototype, "dropEffectRejectDuration", void 0);
tslib_1.__decorate([
Option('drop.dataTransfer.dropEffect'),
tslib_1.__metadata("design:type", String)
], ExpandableTableRow.prototype, "dropDataTransferDropEffect", void 0);
tslib_1.__decorate([
Option('drag.dataTransfer.effectAllowed'),
tslib_1.__metadata("design:type", String)
], ExpandableTableRow.prototype, "dragDataTransferEffectAllowed", void 0);
tslib_1.__decorate([
Option('beforeCellClick'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "beforeCellClickEvent", void 0);
tslib_1.__decorate([
Option('beforeCellDblClick'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "beforeCellDblClickEvent", void 0);
tslib_1.__decorate([
Option('beforeCellLostFocus'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "beforeCellLostFocusEvent", void 0);
tslib_1.__decorate([
Option('beforeCellFocus'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "beforeCellFocusEvent", void 0);
tslib_1.__decorate([
Option('cellClick'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "cellClickEvent", void 0);
tslib_1.__decorate([
Option('cellDblClick'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "cellDblClickEvent", void 0);
tslib_1.__decorate([
Option('cellLostFocus'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "cellLostFocusEvent", void 0);
tslib_1.__decorate([
Option('cellFocus'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "cellFocusEvent", void 0);
tslib_1.__decorate([
Option('rowDrag'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "rowDragEvent", void 0);
tslib_1.__decorate([
Option('rowDragStart'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "rowDragStartEvent", void 0);
tslib_1.__decorate([
Option('rowDragEnd'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "rowDragEndEvent", void 0);
tslib_1.__decorate([
Option('rowDragEnter'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "rowDragEnterEvent", void 0);
tslib_1.__decorate([
Option('rowDragOver'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "rowDragOverEvent", void 0);
tslib_1.__decorate([
Option('rowDragLeave'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "rowDragLeaveEvent", void 0);
tslib_1.__decorate([
Option('rowDrop'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "rowDropEvent", void 0);
tslib_1.__decorate([
Option('rowDropAccepted'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "rowDropAcceptedEvent", void 0);
tslib_1.__decorate([
Option('rowDropRejected'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "rowDropRejectedEvent", void 0);
tslib_1.__decorate([
Option('change'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "changeEvent", void 0);
tslib_1.__decorate([
Option('beforeChange'),
tslib_1.__metadata("design:type", EventEmitter)
], ExpandableTableRow.prototype, "beforeChangeEvent", void 0);
tslib_1.__decorate([
Option('drag.autoExpand.enabled'),
tslib_1.__metadata("design:type", Boolean)
], ExpandableTableRow.prototype, "dragAutoExpandEnabled", void 0);
tslib_1.__decorate([
Option('drag.autoExpand.delay'),
tslib_1.__metadata("design:type", Number)
], ExpandableTableRow.prototype, "dragAutoExpandDelay", void 0);
tslib_1.__decorate([
Option('drag.autoExpand.effect.class'),
tslib_1.__metadata("design:type", String)
], ExpandableTableRow.prototype, "dragAutoExpandEffectClass", void 0);
tslib_1.__decorate([
Option('drag.autoExpand.effect.duration'),
tslib_1.__metadata("design:type", Number)
], ExpandableTableRow.prototype, "dragAutoExpandEffectDuration", void 0);
tslib_1.__decorate([
Option('drag.autoExpand.contractOnLeave'),
tslib_1.__metadata("design:type", Boolean)
], ExpandableTableRow.prototype, "dragAutoExpandContractOnLeave", void 0);
tslib_1.__decorate([
Option('drag.autoExpand.contractDelay'),
tslib_1.__metadata("design:type", Number)
], ExpandableTableRow.prototype, "dragAutoExpandContractDelay", void 0);
tslib_1.__decorate([
Option('drag.effect.moveOut.class'),
tslib_1.__metadata("design:type", String)
], ExpandableTableRow.prototype, "dragEffectMoveOutClass", void 0);
tslib_1.__decorate([
Option('drag.effect.moveOut.duration'),
tslib_1.__metadata("design:type", Number)
], ExpandableTableRow.prototype, "dragEffectMoveOutDuration", void 0);
tslib_1.__decorate([
Option('drag.effect.moveIn.class'),
tslib_1.__metadata("design:type", String)
], ExpandableTableRow.prototype, "dragEffectMoveInClass", void 0);
tslib_1.__decorate([
Option('drag.effect.moveIn.duration'),
tslib_1.__metadata("design:type", Number)
], ExpandableTableRow.prototype, "dragEffectMoveInDuration", void 0);
return ExpandableTableRow;
}(DefaultTableRow));
export { ExpandableTableRow };
function ExpandableTableRow_tsickle_Closure_declarations() {
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
ExpandableTableRow.decorators;
/**
* @nocollapse
* @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}
*/
ExpandableTableRow.ctorParameters;
/** @type {!Object<string,!Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
ExpandableTableRow.propDecorators;
/** @type {?} */
ExpandableTableRow.TYPE_NAME;
/** @type {?} */
ExpandableTableRow.DEFAULT_DRAG_AUTO_EXPAND_ENABLED;
/** @type {?} */
ExpandableTableRow.DEFAULT_DRAG_AUTO_EXPAND_DELAY;
/** @type {?} */
ExpandableTableRow.DEFAULT_DRAG_AUTO_EXPAND_EFFECT_CLASS;
/** @type {?} */
ExpandableTableRow.DEFAULT_DRAG_AUTO_EXPAND_EFFECT_DURATION;
/** @type {?} */
ExpandableTableRow.DEFAULT_DRAG_AUTO_EXPAND_CONTRACT_ON_LEAVE;
/** @type {?} */
ExpandableTableRow.DEFAULT_DRAG_AUTO_EXPAND_CONTRACT_DELAY;
/** @type {?} */
ExpandableTableRow.DEFAULT_DRAG_EFFECT_MOVE_OUT_CLASS;
/** @type {?} */
ExpandableTableRow.DEFAULT_DRAG_EFFECT_MOVE_OUT_DURATION;
/** @type {?} */
ExpandableTableRow.DEFAULT_DRAG_EFFECT_MOVE_IN_CLASS;
/** @type {?} */
ExpandableTableRow.DEFAULT_DRAG_EFFECT_MOVE_IN_DURATION;
/** @type {?} */
ExpandableTableRow.prototype.dataParent;
/** @type {?} */
ExpandableTableRow.prototype.ignoreParentData;
/** @type {?} */
ExpandableTableRow.prototype.data;
/** @type {?} */
ExpandableTableRow.prototype.ignoreParentDisabled;
/** @type {?} */
ExpandableTableRow.prototype.delegateHistory;
/** @type {?} */
ExpandableTableRow.prototype.onDisabled;
/** @type {?} */
ExpandableTableRow.prototype.onEnabled;
/** @type {?} */
ExpandableTableRow.prototype.loadingEnabled;
/** @type {?} */
ExpandableTableRow.prototype.i18nKey;
/** @type {?} */
ExpandableTableRow.prototype.bypass;
/** @type {?} */
ExpandableTableRow.prototype.options;
/** @type {?} */
ExpandableTableRow.prototype.disabled;
/** @type {?} */
ExpandableTableRow.prototype.help;
/** @type {?} */
ExpandableTableRow.prototype.dropEffectRejectClass;
/** @type {?} */
ExpandableTableRow.prototype.dropEffectRejectDuration;
/** @type {?} */
ExpandableTableRow.prototype.dropDataTransferDropEffect;
/** @type {?} */
ExpandableTableRow.prototype.dragDataTransferEffectAllowed;
/** @type {?} */
ExpandableTableRow.prototype.beforeCellClickEvent;
/** @type {?} */
ExpandableTableRow.prototype.beforeCellDblClickEvent;
/** @type {?} */
ExpandableTableRow.prototype.beforeCellLostFocusEvent;
/** @type {?} */
ExpandableTableRow.prototype.beforeCellFocusEvent;
/** @type {?} */
ExpandableTableRow.prototype.cellClickEvent;
/** @type {?} */
ExpandableTableRow.prototype.cellDblClickEvent;
/** @type {?} */
ExpandableTableRow.prototype.cellLostFocusEvent;
/** @type {?} */
ExpandableTableRow.prototype.cellFocusEvent;
/** @type {?} */
ExpandableTableRow.prototype.rowDragEvent;
/** @type {?} */
ExpandableTableRow.prototype.rowDragStartEvent;
/** @type {?} */
ExpandableTableRow.prototype.rowDragEndEvent;
/** @type {?} */
ExpandableTableRow.prototype.rowDragEnterEvent;
/** @type {?} */
ExpandableTableRow.prototype.rowDragOverEvent;
/** @type {?} */
ExpandableTableRow.prototype.rowDragLeaveEvent;
/** @type {?} */
ExpandableTableRow.prototype.rowDropEvent;
/** @type {?} */
ExpandableTableRow.prototype.rowDropAcceptedEvent;
/** @type {?} */
ExpandableTableRow.prototype.rowDropRejectedEvent;
/** @type {?} */
ExpandableTableRow.prototype.changeEvent;
/** @type {?} */
ExpandableTableRow.prototype.beforeChangeEvent;
/** @type {?} */
ExpandableTableRow.prototype.dragAutoExpandEnabled;
/** @type {?} */
ExpandableTableRow.prototype.dragAutoExpandDelay;
/** @type {?} */
ExpandableTableRow.prototype.dragAutoExpandEffectClass;
/** @type {?} */
ExpandableTableRow.prototype.dragAutoExpandEffectDuration;
/** @type {?} */
ExpandableTableRow.prototype.dragAutoExpandContractOnLeave;
/** @type {?} */
ExpandableTableRow.prototype.dragAutoExpandContractDelay;
/** @type {?} */
ExpandableTableRow.prototype.dragEffectMoveOutClass;
/** @type {?} */
ExpandableTableRow.prototype.dragEffectMoveOutDuration;
/** @type {?} */
ExpandableTableRow.prototype.dragEffectMoveInClass;
/** @type {?} */
ExpandableTableRow.prototype.dragEffectMoveInDuration;
/** @type {?} */
ExpandableTableRow.prototype.controller;
/** @type {?} */
ExpandableTableRow.prototype.showing;
/** @type {?} */
ExpandableTableRow.prototype.dragAutoExpandTimer;
/** @type {?} */
ExpandableTableRow.prototype.dragAutoExpandEffectResetTimer;
/** @type {?} */
ExpandableTableRow.prototype.dragAutoExpandContractTimer;
/** @type {?} */
ExpandableTableRow.prototype.autoE