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 | 1×
1×
1×
241×
241×
4×
4×
4×
4×
11×
4×
4×
4×
4×
4×
4×
4×
241×
1×
1×
6×
6×
6×
5×
5×
5×
1×
1×
1×
57×
56×
56×
56×
56×
168×
1×
3×
1×
1×
1×
1×
72×
72×
72×
1×
72×
2×
1×
1×
5×
5×
5×
5×
1×
5×
1×
5×
3×
3×
3×
5×
5×
1×
5×
5×
2×
2×
2×
2×
5×
1×
1×
9×
5×
5×
5×
1×
1×
165×
2×
1×
| define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base"], function (require, exports, ej2_base_1, ej2_base_2) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function wrapperInitialize(createElement, tag, type, element, WRAPPER, role) {
var input = element;
if (element.tagName === tag) {
var ejInstance = ej2_base_2.getValue('ej2_instances', element);
input = createElement('input', { attrs: { 'type': type } });
var props = ['change', 'cssClass', 'label', 'labelPosition', 'id'];
for (var index = 0, len = element.attributes.length; index < len; index++) {
if (props.indexOf(element.attributes[index].nodeName) === -1) {
input.setAttribute(element.attributes[index].nodeName, element.attributes[index].nodeValue);
}
}
ej2_base_1.attributes(element, { 'class': WRAPPER });
element.appendChild(input);
element.classList.add(role);
element.classList.remove(role);
ej2_base_1.setValue('ej2_instances', ejInstance, input);
ej2_base_2.deleteObject(element, 'ej2_instances');
}
return input;
}
exports.wrapperInitialize = wrapperInitialize;
function getTextNode(element) {
var node;
var childnode = element.childNodes;
for (var i = 0; i < childnode.length; i++) {
node = childnode[i];
Eif (node.nodeType === 3) {
return node;
}
}
return null;
}
exports.getTextNode = getTextNode;
function destroy(ejInst, wrapper, tagName) {
if (tagName === 'INPUT') {
wrapper.parentNode.insertBefore(ejInst.element, wrapper);
ej2_base_1.detach(wrapper);
ejInst.element.checked = false;
['name', 'value', 'disabled'].forEach(function (key) {
ejInst.element.removeAttribute(key);
});
}
else {
['role', 'aria-checked', 'class'].forEach(function (key) {
wrapper.removeAttribute(key);
});
wrapper.innerHTML = '';
ejInst.element = wrapper;
}
}
exports.destroy = destroy;
function preRender(proxy, control, wrapper, element, moduleName) {
element = wrapperInitialize(proxy.createElement, control, 'checkbox', element, wrapper, moduleName);
proxy.element = element;
if (proxy.element.getAttribute('type') !== 'checkbox') {
proxy.element.setAttribute('type', 'checkbox');
}
if (!proxy.element.id) {
proxy.element.id = ej2_base_1.getUniqueID('e-' + moduleName);
}
}
exports.preRender = preRender;
function createCheckBox(createElement, enableRipple, options) {
if (enableRipple === void 0) { enableRipple = false; }
if (options === void 0) { options = {}; }
var wrapper = createElement('div', { className: 'e-checkbox-wrapper e-css' });
if (options.cssClass) {
ej2_base_2.addClass([wrapper], options.cssClass.split(' '));
}
if (options.enableRtl) {
wrapper.classList.add('e-rtl');
}
if (enableRipple) {
var rippleSpan = createElement('span', { className: 'e-ripple-container' });
ej2_base_1.rippleEffect(rippleSpan, { isCenterRipple: true, duration: 400 });
wrapper.appendChild(rippleSpan);
}
var frameSpan = createElement('span', { className: 'e-frame e-icons' });
if (options.checked) {
frameSpan.classList.add('e-check');
}
wrapper.appendChild(frameSpan);
if (options.label) {
var labelSpan = createElement('span', { className: 'e-label' });
Iif (options.disableHtmlEncode) {
labelSpan.textContent = options.label;
}
else {
labelSpan.innerHTML = options.label;
}
wrapper.appendChild(labelSpan);
}
return wrapper;
}
exports.createCheckBox = createCheckBox;
function rippleMouseHandler(e, rippleSpan) {
if (rippleSpan) {
var event_1 = document.createEvent('MouseEvents');
event_1.initEvent(e.type, false, true);
rippleSpan.dispatchEvent(event_1);
}
}
exports.rippleMouseHandler = rippleMouseHandler;
function setHiddenInput(proxy, wrap) {
if (proxy.element.getAttribute('ejs-for')) {
wrap.appendChild(proxy.createElement('input', {
attrs: { 'name': proxy.name || proxy.element.name, 'value': 'false', 'type': 'hidden' }
}));
}
}
exports.setHiddenInput = setHiddenInput;
});
|