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 | 1×
1×
1×
13×
13×
13×
13×
6×
6×
7×
7×
13×
11×
2×
2×
2×
1×
1×
1×
1×
1×
1×
12×
12×
12×
12×
1×
1×
11×
11×
12×
12×
6×
6×
6×
6×
12×
1×
26×
9×
9×
8×
8×
8×
8×
1×
1×
1×
| define(["require", "exports", "@syncfusion/ej2-base", "./v-scroll", "./h-scroll"], function (require, exports, ej2_base_1, v_scroll_1, h_scroll_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function addScrolling(createElement, container, content, scrollType, enableRtl, offset) {
var containerOffset;
var contentOffset;
var parentElem = container.parentElement;
if (scrollType === 'vscroll') {
containerOffset = offset || container.getBoundingClientRect().height;
contentOffset = content.getBoundingClientRect().height;
}
else {
containerOffset = container.getBoundingClientRect().width;
contentOffset = content.getBoundingClientRect().width;
}
if (containerOffset < contentOffset) {
return createScrollbar(createElement, container, content, scrollType, enableRtl, offset);
}
else Eif (parentElem) {
var width = parentElem.getBoundingClientRect().width;
if (width < containerOffset && scrollType === 'hscroll') {
contentOffset = width;
container.style.maxWidth = width + 'px';
return createScrollbar(createElement, container, content, scrollType, enableRtl, offset);
}
return content;
}
else {
return content;
}
}
exports.addScrolling = addScrolling;
function createScrollbar(createElement, container, content, scrollType, enableRtl, offset) {
var scrollEle = createElement('div', { className: 'e-menu-' + scrollType });
container.appendChild(scrollEle);
scrollEle.appendChild(content);
if (offset) {
scrollEle.style.overflow = 'hidden';
scrollEle.style.height = offset + 'px';
}
else {
scrollEle.style.maxHeight = container.style.maxHeight;
container.style.overflow = 'hidden';
}
var scrollObj;
if (scrollType === 'vscroll') {
scrollObj = new v_scroll_1.VScroll({ enableRtl: enableRtl }, scrollEle);
scrollObj.scrollStep = ej2_base_1.select('.e-' + scrollType + '-bar', container).offsetHeight / 2;
}
else {
scrollObj = new h_scroll_1.HScroll({ enableRtl: enableRtl }, scrollEle);
scrollObj.scrollStep = ej2_base_1.select('.e-' + scrollType + '-bar', container).offsetWidth;
}
return scrollEle;
}
function destroyScroll(scrollObj, element, skipEle) {
if (scrollObj) {
var menu = ej2_base_1.select('.e-menu-parent', element);
if (menu) {
Eif (!skipEle || skipEle === menu) {
scrollObj.destroy();
element.parentElement.appendChild(menu);
ej2_base_1.detach(element);
}
}
else {
scrollObj.destroy();
ej2_base_1.detach(element);
}
}
}
exports.destroyScroll = destroyScroll;
});
|