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 pathapi.js
More file actions
161 lines (161 loc) · 8.87 KB
/
api.js
File metadata and controls
161 lines (161 loc) · 8.87 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
"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_navigations_1 = require("@syncfusion/ej2-react-navigations");
var ej2_react_dropdowns_1 = require("@syncfusion/ej2-react-dropdowns");
var ej2_react_dropdowns_2 = require("@syncfusion/ej2-react-dropdowns");
var ej2_react_buttons_1 = require("@syncfusion/ej2-react-buttons");
var property_pane_1 = require("../common/property-pane");
var sample_base_1 = require("../common/sample-base");
require("./api.css");
var Api = (function (_super) {
__extends(Api, _super);
function Api() {
var _this = _super !== null && _super.apply(this, arguments) || this;
//Menu datasource
_this.data = [
{
header: 'Events',
subItems: [
{ text: 'Conferences' },
{ text: 'Music' },
{ text: 'Workshops' }
]
},
{
header: 'Movies',
subItems: [
{ text: 'Now Showing' },
{ text: 'Coming Soon' }
]
},
{
header: 'Directory',
subItems: [
{ text: 'Media Gallery' },
{ text: 'Newsletters' }
]
},
{
header: 'Queries',
subItems: [
{ text: 'Our Policy' },
{ text: 'Site Map' },
{ text: '24x7 Support' }
]
},
{ header: 'Services' }
];
//Menu fields definition
_this.menuFields = {
iconCss: 'icon',
text: ['header', 'text', 'value'],
children: ['subItems', 'options']
};
//DropDownList datasource
_this.modeData = [
{ text: 'Horizontal', value: 'Horizontal' },
{ text: 'Vertical', value: 'Vertical' }
];
//MultiSelect datasource
_this.headerData = [
{ text: 'Events' }, { text: 'Movies' }, { text: 'Directory' }, { text: 'Queries' }, { text: 'Services' }
];
return _this;
}
Api.prototype.modeChange = function (args) {
this.menuObj.orientation = args.itemData.value;
};
Api.prototype.enabledisableChange = function (args) {
if (args.value) {
this.menuObj.enableItems(['Events', 'Movies', 'Directory', 'Queries', 'Services'], true);
this.menuObj.enableItems(args.value, false);
}
};
//CheckBox change event
Api.prototype.showOnClickChange = function (args) {
this.menuObj.showItemOnClick = args.checked;
};
Api.prototype.render = function () {
var _this = this;
return (React.createElement("div", { className: 'control-pane' },
React.createElement("div", { className: "menu-section control-section" },
React.createElement("div", { className: "col-lg-8 control-section" },
React.createElement("div", { id: "apiMenu" },
React.createElement(ej2_react_navigations_1.MenuComponent, { items: this.data, fields: this.menuFields, ref: function (scope) { _this.menuObj = scope; } }))),
React.createElement("div", { className: "col-lg-4 property-section" },
React.createElement(property_pane_1.PropertyPane, { title: 'Properties' },
React.createElement("table", { id: "property", title: "Properties", style: { width: '100%' } },
React.createElement("tbody", null,
React.createElement("tr", null,
React.createElement("td", { style: { width: '50%', paddingTop: '10px' } },
React.createElement("div", null, "Orientation")),
React.createElement("td", { style: { width: '50%', paddingTop: '10px' } },
React.createElement("div", { style: { maxWidth: '200px' } },
React.createElement(ej2_react_dropdowns_1.DropDownListComponent, { value: 'Horizontal', dataSource: this.modeData, popupHeight: '200px', change: this.modeChange.bind(this) })))),
React.createElement("tr", null,
React.createElement("td", { style: { width: '50%', paddingTop: '10px' } },
React.createElement("div", null, "Enable / Disable item")),
React.createElement("td", { style: { width: '50%', paddingTop: '10px' } },
React.createElement("div", { style: { maxWidth: '200px' } },
React.createElement(ej2_react_dropdowns_2.MultiSelectComponent, { dataSource: this.headerData, popupHeight: '250px', width: '160px', mode: 'CheckBox', placeholder: 'Select item', showDropDownIcon: true, change: this.enabledisableChange.bind(this) },
React.createElement(ej2_react_dropdowns_1.Inject, { services: [ej2_react_dropdowns_2.CheckBoxSelection] }))))),
React.createElement("tr", null,
React.createElement("td", { style: { width: '50%', paddingTop: '15px' } },
React.createElement("div", null, "Show Item on Click")),
React.createElement("td", { style: { width: '50%', paddingTop: '15px' } },
React.createElement(ej2_react_buttons_1.CheckBoxComponent, { checked: false, change: this.showOnClickChange.bind(this) })))))))),
React.createElement("div", { id: "action-description" },
React.createElement("p", null,
"This sample demonstrates the customization of ",
React.createElement("code", null, "menu"),
" component by using its properties from the property pane. Select any combination of properties from the property pane to customize ",
React.createElement("code", null, "menu"),
" component.")),
React.createElement("div", { id: "description" },
React.createElement("p", null, "In this demo, default menu is rendered with minimal configuration."),
React.createElement("p", null,
"This sample can be customized further with the combination of ",
React.createElement("code", null, "menu"),
" properties from the property pane. For example,"),
React.createElement("ul", null,
React.createElement("li", null,
"You can switch to ",
React.createElement("b", null, "Vertical"),
" and ",
React.createElement("b", null, "Horizontal"),
" modes by clicking and selecting the",
React.createElement("code", null, "orientation"),
" mode from ",
React.createElement("i", null, "Orientation"),
" dropdownlist."),
React.createElement("li", null,
"You can enable or disable menu items by clicking and selecting the item from ",
React.createElement("i", null, "Enable item"),
" or ",
React.createElement("i", null, "Disable item"),
" dropdownlists."),
React.createElement("li", null,
"You can also enable the show menu item on mouse click ",
React.createElement("code", null, "showItemOnClick"),
" property by checking the",
React.createElement("i", null, "Show item on Click"),
" checkbox.")),
React.createElement("p", null,
"More information about menu can be found in this ",
React.createElement("a", { target: "_blank", href: "http://ej2.syncfusion.com/react/documentation/menu/api.html" }, "documentation"),
" section."))));
};
return Api;
}(sample_base_1.SampleBase));
exports.Api = Api;