@dflex/draggable
Advanced tools
Comparing version 2.10.1 to 2.11.0
@@ -11,3 +11,2 @@ /** | ||
draggedElm: T; | ||
draggedStyleRef: CSSStyleDeclaration; | ||
/** | ||
@@ -26,3 +25,3 @@ * When dragging start, element shouldn't jump from its translate. So, we | ||
tempTranslate: TempTranslate; | ||
draggedStyle: DraggedStyle; | ||
static draggedStyleProps: DraggedStyle; | ||
/** | ||
@@ -29,0 +28,0 @@ * Creates an instance of AbstractDraggable. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var draggedStyleProps = [ | ||
{ | ||
prop: "position", | ||
dragValue: "relative", | ||
afterDragValue: null, | ||
}, | ||
{ | ||
prop: "zIndex", | ||
dragValue: "99", | ||
afterDragValue: null, | ||
}, | ||
{ | ||
prop: "user-select", | ||
dragValue: "none", | ||
afterDragValue: null, | ||
}, | ||
]; | ||
var AbstractDraggable = /** @class */ (function () { | ||
@@ -34,4 +17,3 @@ /** | ||
this.draggedElm = abstractCoreElm; | ||
var _b = this.draggedElm, translateX = _b.translateX, translateY = _b.translateY, draggedStyle = _b.ref.style; | ||
this.draggedStyleRef = draggedStyle; | ||
var _b = this.draggedElm, translateX = _b.translateX, translateY = _b.translateY; | ||
this.outerOffsetX = -initX + translateX; | ||
@@ -43,3 +25,2 @@ this.outerOffsetY = -initY + translateY; | ||
}; | ||
this.draggedStyle = draggedStyleProps; | ||
this.setDragged(true); | ||
@@ -57,8 +38,10 @@ } | ||
if (isActive) { | ||
this.draggedStyle.forEach(function (_a) { | ||
AbstractDraggable.draggedStyleProps.forEach(function (_a) { | ||
var prop = _a.prop, dragValue = _a.dragValue; | ||
// @ts-expect-error | ||
_this.draggedStyleRef[prop] = dragValue; | ||
// TODO: Fix TS error. | ||
// @ts-expect-error. | ||
_this.draggedElm.ref.style[prop] = dragValue; | ||
}); | ||
(_a = getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges(); | ||
this.draggedElm.ref.setAttribute("dragged", "true"); | ||
return; | ||
@@ -69,7 +52,9 @@ } | ||
*/ | ||
this.draggedStyle.forEach(function (_a) { | ||
AbstractDraggable.draggedStyleProps.forEach(function (_a) { | ||
var prop = _a.prop, afterDragValue = _a.afterDragValue; | ||
// @ts-ignore | ||
_this.draggedStyleRef[prop] = afterDragValue; | ||
// TODO: Fix TS error. | ||
// @ts-expect-error. | ||
_this.draggedElm.ref.style[prop] = afterDragValue; | ||
}); | ||
this.draggedElm.ref.removeAttribute("dragged"); | ||
}; | ||
@@ -94,4 +79,21 @@ /** | ||
this.tempTranslate.y = y + this.outerOffsetY; | ||
this.draggedStyleRef.transform = "translate3d(" + this.tempTranslate.x + "px," + this.tempTranslate.y + "px, 0)"; | ||
this.draggedElm.ref.style.transform = "translate3d(" + this.tempTranslate.x + "px," + this.tempTranslate.y + "px, 0)"; | ||
}; | ||
AbstractDraggable.draggedStyleProps = [ | ||
{ | ||
prop: "position", | ||
dragValue: "relative", | ||
afterDragValue: null, | ||
}, | ||
{ | ||
prop: "zIndex", | ||
dragValue: "99", | ||
afterDragValue: null, | ||
}, | ||
{ | ||
prop: "user-select", | ||
dragValue: "none", | ||
afterDragValue: null, | ||
}, | ||
]; | ||
return AbstractDraggable; | ||
@@ -98,0 +100,0 @@ }()); |
@@ -24,5 +24,5 @@ /** | ||
*/ | ||
protected dragAt(x: number, y: number): void; | ||
protected endDragging(): void; | ||
dragAt(x: number, y: number): void; | ||
endDragging(): void; | ||
} | ||
export default Draggable; |
@@ -35,3 +35,3 @@ "use strict"; | ||
var _this = this; | ||
var element = DraggableStoreImp_1.default.getElmById(id); | ||
var element = DraggableStoreImp_1.default.registry[id]; | ||
_this = _super.call(this, element, clickCoordinates) || this; | ||
@@ -38,0 +38,0 @@ return _this; |
@@ -19,3 +19,2 @@ /** | ||
draggedElm: T; | ||
draggedStyleRef: CSSStyleDeclaration; | ||
/** | ||
@@ -34,3 +33,2 @@ * When dragging start, element shouldn't jump from its translate. So, we | ||
tempTranslate: TempTranslate; | ||
draggedStyle: DraggedStyle; | ||
} | ||
@@ -37,0 +35,0 @@ export interface MouseCoordinates { |
{ | ||
"name": "@dflex/draggable", | ||
"version": "2.10.1", | ||
"version": "2.11.0", | ||
"main": "dist/index.js", | ||
@@ -21,4 +21,4 @@ "types": "dist/index.d.ts", | ||
"dependencies": { | ||
"@dflex/core-instance": "^2.10.1", | ||
"@dflex/store": "^2.10.1" | ||
"@dflex/core-instance": "^2.11.0", | ||
"@dflex/store": "^2.11.0" | ||
}, | ||
@@ -45,3 +45,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "858f9fbb06e2a8d0b640c20ebf03759e5f6b4093" | ||
"gitHead": "95c74c26416dbf0e79fbc258d1af301632c178c1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56152
358
Updated@dflex/core-instance@^2.11.0
Updated@dflex/store@^2.11.0