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 pathorientation.js
More file actions
183 lines (183 loc) · 11.1 KB
/
orientation.js
File metadata and controls
183 lines (183 loc) · 11.1 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
"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 property_pane_1 = require("../common/property-pane");
var ej2_react_navigations_1 = require("@syncfusion/ej2-react-navigations");
var ej2_react_dropdowns_1 = require("@syncfusion/ej2-react-dropdowns");
var ej2_react_lists_1 = require("@syncfusion/ej2-react-lists");
var sample_base_1 = require("../common/sample-base");
require("./tab.component.css");
var Orientation = (function (_super) {
__extends(Orientation, _super);
function Orientation() {
var _this = _super !== null && _super.apply(this, arguments) || this;
// Mapping ListView component dataSource property
_this.romeEmployees = [
{ id: '1', name: 'Anne Dodsworth', role: 'Product Manager' },
{ id: '2', name: 'Laura Callahan', role: 'Team Lead' },
{ id: '3', name: 'Andrew Fuller', role: 'Developer' }
];
// Mapping ListView component dataSource property
_this.parisEmployees = [
{ id: '4', name: 'Robert King', role: 'Team Lead' },
{ id: '5', name: 'Michael Suyama', role: 'Developer' },
{ id: '6', name: 'Margaret Peacock', role: 'Developer' }
];
// Mapping ListView component dataSource property
_this.londonEmployees = [
{ id: '7', name: 'Janet Leverling', role: 'CEO' },
{ id: '8', name: 'Steven Buchanan', role: 'HR' },
{ id: '9', name: 'Nancy Davolio', role: 'Product Manager' }
];
// Mapping DropDownList dataSource property
_this.oData = [
{ 'value': 'top', 'text': 'Top' }, { 'value': 'bottom', 'text': 'Bottom' }
];
// Mapping DropDownList fields property
_this.fields = { text: 'text', value: 'value' };
//Map the appropriate columns to fields property
_this.listfields = { text: 'name', id: 'id' };
// Mapping DropDownList value property
_this.orientVal = 'top';
// Mapping DropDownList dataSource property
_this.hData = [
{ 'value': 'default', 'text': 'Default' }, { 'value': 'fill', 'text': 'Fill' }, { 'value': 'accent', 'text': 'Accent' }
];
// Mapping DropDownList value property
_this.hdrVal = 'default';
return _this;
}
// Change event funtion for DropDownList component
Orientation.prototype.changeOrientationMode = function (e) {
var placement = document.getElementById('orientation').value;
if (placement === 'Bottom') {
this.tabObj.headerPlacement = 'Bottom';
}
else {
this.tabObj.headerPlacement = 'Top';
}
this.tabObj.dataBind();
};
// Change event funtion for DropDownList component
Orientation.prototype.changeHeaderStyles = function (e) {
this.removeStyleClass();
var name = document.getElementById('headerStyles').value;
if (name === 'Fill') {
this.tabObj.element.classList.add('e-fill');
}
else if (name === 'Accent') {
this.tabObj.element.classList.add('e-background');
this.tabObj.element.classList.add('e-accent');
}
};
Orientation.prototype.removeStyleClass = function () {
this.tabObj.element.classList.remove('e-fill');
this.tabObj.element.classList.remove('e-background');
this.tabObj.element.classList.remove('e-accent');
};
Orientation.prototype.templateString = function (data) {
return (React.createElement("div", { className: "template-container" },
React.createElement("div", { className: "left" },
React.createElement("img", { className: 'empImg', src: "src/tab/Employees/" + data.id + ".png", alt: '${data.id}' }),
React.createElement("div", { className: "left info-div" },
React.createElement("div", { className: "name" },
" ",
data.name),
React.createElement("div", { className: "role" },
" ",
data.role)))));
};
Orientation.prototype.render = function () {
var _this = this;
function template1() {
return (React.createElement(ej2_react_lists_1.ListViewComponent, { id: "rome", dataSource: this.romeEmployees, template: this.templateString }));
}
function template2() {
return (React.createElement(ej2_react_lists_1.ListViewComponent, { id: "paris", dataSource: this.parisEmployees, template: this.templateString }));
}
function template3() {
return (React.createElement(ej2_react_lists_1.ListViewComponent, { id: "london", dataSource: this.londonEmployees, template: this.templateString }));
}
// Mapping Tab items Header property
var headertext;
headertext = [{ text: "Rome" }, { text: "Paris" }, { text: "London" }];
return (React.createElement("div", { className: 'control-pane' },
React.createElement("div", { className: 'control-section tab-control-section row' },
React.createElement("div", { className: 'col-lg-8' },
React.createElement(ej2_react_navigations_1.TabComponent, { ref: function (tab) { _this.tabObj = tab; }, showCloseButton: true, heightAdjustMode: 'None', height: 320 },
React.createElement(ej2_react_navigations_1.TabItemsDirective, null,
React.createElement(ej2_react_navigations_1.TabItemDirective, { header: headertext[0], content: template1.bind(this) }),
React.createElement(ej2_react_navigations_1.TabItemDirective, { header: headertext[1], content: template2.bind(this) }),
React.createElement(ej2_react_navigations_1.TabItemDirective, { header: headertext[2], content: template3.bind(this) })))),
React.createElement("div", { className: 'col-lg-4 property-section' },
React.createElement(property_pane_1.PropertyPane, { title: 'Properties' },
React.createElement("table", { id: 'property', title: 'Properties', className: 'property-panel-table' },
React.createElement("tbody", null,
React.createElement("tr", null,
React.createElement("td", { style: { width: '50%' } },
React.createElement("div", null, "Header Placement")),
React.createElement("td", { style: { width: '50%' } },
React.createElement("div", null,
React.createElement(ej2_react_dropdowns_1.DropDownListComponent, { id: 'orientation', dataSource: this.oData, fields: this.fields, value: this.orientVal, width: '90%', change: this.changeOrientationMode.bind(this) })))),
React.createElement("tr", null,
React.createElement("td", { style: { width: '50%' } },
React.createElement("div", null, "Header Styles")),
React.createElement("td", { style: { width: '50%' } },
React.createElement("div", null,
React.createElement(ej2_react_dropdowns_1.DropDownListComponent, { id: 'headerStyles', dataSource: this.hData, fields: this.fields, value: this.hdrVal, width: '90%', change: this.changeHeaderStyles.bind(this) }))))))))),
React.createElement("div", { id: "action-description" },
React.createElement("p", null,
"This sample demonstrates the ",
React.createElement("code", null, "header"),
" orientation of the ",
React.createElement("code", null, "Tab"),
". Select option from drop-downs to switch header placement and changing the header style in properties panel.")),
React.createElement("div", { id: "description" },
React.createElement("p", null,
"The ",
React.createElement("code", null, "Tab"),
" allows to place the header section inside the Tab component either at",
React.createElement("code", null, "top / bottom"),
" position by using ",
React.createElement("code", null, "headerPlacement"),
" property."),
React.createElement("p", null,
"This sample illustrates the use of header placement and ",
React.createElement("code", null, "showCloseButton"),
" property. Users can change the header position by changing the drop-down value options and can close the Tab item by clicking close icon in header.",
React.createElement("br", null),
React.createElement("br", null),
"The User can also view different header styles of Tab component by selecting options from `Header Styles` drop-down. Header styles changed by adding predefined classes in Tab root element and it class names listed below",
React.createElement("br", null),
React.createElement("ul", null,
React.createElement("li", null,
"Material and Fabric theme differentiates all the available tab header styles such as ",
React.createElement("code", null, "e-fill"),
", ",
React.createElement("code", null, "e-background e-accent"),
"."),
React.createElement("li", null,
"In bootstrap theme, all the styles such as ",
React.createElement("code", null, "e-fill"),
" & ",
React.createElement("code", null, "e-background e-accent"),
" will have the same look with no difference.")),
"If above classes not included in root element default style will applied in Tab component."),
React.createElement("p", null,
"More information about Tab can be found in this ",
React.createElement("a", { target: "_blank", href: "http://ej2.syncfusion.com/react/documentation/tab/getting-started.html" }, "documentation"),
" section."))));
};
return Orientation;
}(sample_base_1.SampleBase));
exports.Orientation = Orientation;