UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

218 lines (217 loc) 7.03 kB
/* THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE: https://www.infragistics.com/legal/license/igultimate-la https://www.infragistics.com/legal/license/igultimate-eula GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company. */ import { __extends } from "tslib"; import { Base, INotifyPropertyChanged_$type, PropertyChangedEventArgs, Point_$type, markType } from "igniteui-react-core"; import { IDragger_$type } from "./IDragger"; import { DraggerView } from "./DraggerView"; import { DragSelectEventArgs } from "./DragSelectEventArgs"; import { NativeUI } from "igniteui-react-core"; /** * @hidden */ var Dragger = /** @class */ /*@__PURE__*/ (function (_super) { __extends(Dragger, _super); function Dragger() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.q = null; _this.d = false; _this.h = 0; _this.i = 0; _this.c = null; _this.b = 4; _this.e = false; _this.a = null; _this.j = null; _this.g = 0; _this.f = 0; _this.onDrag = null; _this.onDragEnd = null; _this.propertyChanged = null; return _this; } Object.defineProperty(Dragger.prototype, "view", { get: function () { if (this.c == null) { this.c = new DraggerView(this); } return this.c; }, set: function (a) { this.c = a; }, enumerable: false, configurable: true }); Object.defineProperty(Dragger.prototype, "dragType", { get: function () { return this.b; }, enumerable: false, configurable: true }); Object.defineProperty(Dragger.prototype, "isDragActive", { get: function () { return this.e; }, enumerable: false, configurable: true }); Object.defineProperty(Dragger.prototype, "cellPath", { get: function () { return this.a; }, enumerable: false, configurable: true }); Object.defineProperty(Dragger.prototype, "cloneCell", { get: function () { return this.j; }, set: function (a) { var b = this.j; this.j = a; if (b != this.j) { this.o("CloneCell", b, this.j); } }, enumerable: false, configurable: true }); Object.defineProperty(Dragger.prototype, "viewportWidth", { get: function () { return this.g; }, set: function (a) { var b = this.g; this.g = a; if (b != this.g) { this.o("ViewportWidth", b, this.g); } }, enumerable: false, configurable: true }); Object.defineProperty(Dragger.prototype, "viewportHeight", { get: function () { return this.f; }, set: function (a) { var b = this.f; this.f = a; if (b != this.f) { this.o("ViewportHeight", b, this.f); } }, enumerable: false, configurable: true }); Dragger.prototype.o = function (a, b, c) { if (this.propertyChanged != null) { this.propertyChanged(this, new PropertyChangedEventArgs(a)); } this.p(a, b, c); }; Dragger.prototype.onDetachedFromUI = function () { this.view.onDetachedFromUI(); }; Dragger.prototype.onAttachedToUI = function () { this.view.onAttachedToUI(); }; Dragger.prototype.provideContainer = function (a) { this.view.provideContainer(a); }; Dragger.prototype.onMouseMove = function (a, b) { var _this = this; if (this.e) { if (this.onDrag != null) { this.onDrag(this, ((function () { var $ret = new DragSelectEventArgs(); $ret.startX = _this.q.x; $ret.startY = _this.q.y; $ret.currentX = a; $ret.currentY = b; $ret.controlPressed = _this.d; return $ret; })())); } if (this.cloneCell != null) { var c = this.i; var d = this.h; var e = this.view.getWindowScrollPos(); c += e[0]; d += e[1]; NativeUI.v(this.cloneCell, a + d); NativeUI.ae(this.cloneCell, b + c); } } }; Dragger.prototype.onMouseUp = function (a, b) { if (this.e) { this.view.releaseMouse(); this.e = false; if (this.onDragEnd != null) { this.onDragEnd(this, new DragSelectEventArgs()); } this.b = 4; if (this.cloneCell != null) { this.view.removeCloneCellFromDom(); this.cloneCell = null; } } }; Dragger.prototype.dragStart = function (a, b, c, d, e, f, g) { if (!this.e) { this.q = this.view.transformPoint(a, b); this.q = { $type: Point_$type, x: this.q.x + c, y: this.q.y + d }; this.e = true; this.d = g; this.b = e; this.a = f; this.view.captureMouse(); if (this.cloneCell != null) { var h = this.i; var i = this.h; var j = this.view.getWindowScrollPos(); h += j[0]; i += j[1]; NativeUI.v(this.cloneCell, a + i); NativeUI.ae(this.cloneCell, b + h); } } }; Dragger.prototype.cancel = function () { this.e = false; this.b = 4; }; Dragger.prototype.n = function () { if (this.cloneCell != null) { var a = new Array(2); a[0] = 0; a[1] = 0; a = this.view.getTopAndLeft(); var b = NativeUI.d(this.cloneCell) / 2; this.i = a[0] - b; var c = NativeUI.k(this.cloneCell) / 2; this.h = a[1] - c; } }; Dragger.prototype.p = function (a, b, c) { switch (a) { case "ViewportWidth": case "ViewportHeight": this.view.onViewportSizeChanged(this.g, this.f); break; case "CloneCell": this.view.addCloneCellToDom(); this.n(); break; } }; Dragger.$t = markType(Dragger, 'Dragger', Base.$, [IDragger_$type, INotifyPropertyChanged_$type]); return Dragger; }(Base)); export { Dragger };