This repository was archived by the owner on Jul 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdraggable.js
More file actions
66 lines (66 loc) · 4.25 KB
/
draggable.js
File metadata and controls
66 lines (66 loc) · 4.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"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 React = require("react");
var ej2_react_popups_1 = require("@syncfusion/ej2-react-popups");
var sample_base_1 = require("../common/sample-base");
require("./draggable.css");
var Draggable = (function (_super) {
__extends(Draggable, _super);
function Draggable(props) {
var _this = _super.call(this, props) || this;
_this.state = {
hideDialog: true
};
_this.buttonElement = null;
_this.buttonRef = function (element) {
_this.buttonElement = element;
};
_this.dialogClose = _this.dialogClose.bind(_this);
_this.dialogOpen = _this.dialogOpen.bind(_this);
_this.animationSettings = { effect: 'None' };
return _this;
}
Draggable.prototype.buttonClick = function (args) {
this.setState({ hideDialog: true });
};
Draggable.prototype.dialogClose = function () {
this.setState({ hideDialog: false });
this.buttonElement.style.display = 'inline-block';
};
Draggable.prototype.dialogOpen = function () {
this.setState({ hideDialog: true });
this.buttonElement.style.display = 'none';
};
Draggable.prototype.render = function () {
var _this = this;
return (React.createElement("div", { className: 'control-pane' },
React.createElement("div", { id: 'target', className: 'col-lg-12 control-section dialog-draggable' },
React.createElement("button", { className: 'e-control e-btn dlgbtn', ref: this.buttonRef, onClick: this.buttonClick.bind(this), id: 'dialogBtn' }, "Open Dialog"),
React.createElement(ej2_react_popups_1.DialogComponent, { id: 'defaultDialog', header: 'Drag Me!!!', isModal: true, showCloseIcon: true, allowDragging: true, animationSettings: this.animationSettings, width: '300px', ref: function (defaultDialog) { return _this.defaultDialogInstance = defaultDialog; }, target: '#target', visible: this.state.hideDialog, open: this.dialogOpen, close: this.dialogClose }, "This is a dialog with draggable support."),
React.createElement("div", { id: "action-description" },
React.createElement("p", null, "This sample demonstrates the drag-and-drop operation of the dialog component. To begin drag-and-drop operation, select a dialog's header using mouse and dropping them in the desired location. The dialog can be draggable within the sample container. Enable the \"open dialog\" button to reopen the dialog if it is closed.")),
React.createElement("div", { id: "description" },
React.createElement("p", null,
"A drag-and-drop operation is enabled using the ",
React.createElement("a", { target: "_blank", href: "https://ej2.syncfusion.com/react/documentation/dialog/api-dialogComponent.html#allowdragging" }, "allowDragging "),
" property. when you configure the ",
React.createElement("a", { target: "_blank", href: "https://ej2.syncfusion.com/react/documentation/dialog/api-dialogComponent.html#target" }, "target"),
" property, the dialog can be draggable within its target container alone. The drag-and-drop feature is used to reposition the dialog dynamically."),
React.createElement("p", null,
"More information on the draggable operation of Dialog can be found in the ",
React.createElement("a", { target: "_blank", href: "https://ej2.syncfusion.com/react/documentation/dialog/getting-started.html#draggable" }, "documentation section"),
".")))));
};
return Draggable;
}(sample_base_1.SampleBase));
exports.Draggable = Draggable;