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 pathticks-customization.js
More file actions
59 lines (59 loc) · 4.01 KB
/
ticks-customization.js
File metadata and controls
59 lines (59 loc) · 4.01 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
"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_inputs_1 = require("@syncfusion/ej2-react-inputs");
var sample_base_1 = require("../common/sample-base");
require("./ticks-customization.css");
var TicksCustomization = (function (_super) {
__extends(TicksCustomization, _super);
function TicksCustomization() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.ticks = { placement: 'Before', largeStep: 20 };
_this.ticksData = { placement: 'Both', largeStep: 20, smallStep: 5 };
return _this;
}
TicksCustomization.prototype.renderingTicks = function (args) {
if (args.tickElement.classList.contains('e-large')) {
args.tickElement.classList.add('e-custom');
}
};
TicksCustomization.prototype.onrenderedSliderTicks = function (args) {
this.li = args.ticksWrapper.getElementsByClassName('e-large');
var remarks = ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good', 'Excellent'];
for (var i = 0; i < this.li.length; ++i) {
this.li[i].querySelectorAll('.e-tick-both')[1].innerText = remarks[i];
}
};
TicksCustomization.prototype.render = function () {
var _this = this;
return (React.createElement("div", { className: 'control-pane' },
React.createElement("div", { className: 'control-section' },
React.createElement("div", { className: "slider-content-wrapper" },
React.createElement("div", { className: "slider_container" },
React.createElement("div", { className: "slider_container", id: "slider_wrapper" },
React.createElement("div", { className: "slider_labelText userselect" }, "Dynamic ticks color"),
React.createElement(ej2_react_inputs_1.SliderComponent, { id: "ticks_slider", value: 20, min: 0, max: 100, step: 5, ticks: this.ticks, type: "MinRange", renderingTicks: this.renderingTicks.bind(this), ref: function (slider) { _this.defaultObj = slider; } })),
React.createElement("div", { className: "slider_container" },
React.createElement("div", { className: "slider_labelText userselect" }, "Ticks with legends"),
React.createElement(ej2_react_inputs_1.SliderComponent, { id: "slider", value: 20, min: 0, max: 100, type: "MinRange", ticks: this.ticksData, ref: function (slider) { _this.sliderObj = slider; }, renderedTicks: this.onrenderedSliderTicks.bind(this) }))))),
React.createElement("div", { id: "action-description" },
React.createElement("p", null, "This sample demonstrates the customization of Slider's Tick. Drag the thumb over the bar for selecting the values between min and max.")),
React.createElement("div", { id: "description" },
React.createElement("p", null, "In this demo, we have demonstrated the following customization of Ticks using CSS."),
React.createElement("ul", null,
React.createElement("li", null, "Dynamic ticks color - In this sample, Ticks has been customized to different colors by adding icon at each Ticks."),
React.createElement("li", null, "Ticks with legends - In this sample, Track has been formatted to display custom text using renderingTicks and renderedTicks events. ")))));
};
return TicksCustomization;
}(sample_base_1.SampleBase));
exports.TicksCustomization = TicksCustomization;