kendo.mobile.splitview.js
8.9 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
/**
* Kendo UI v2016.1.112 (http://www.telerik.com/kendo-ui)
* Copyright 2016 Telerik AD. All rights reserved.
*
* Kendo UI commercial licenses may be obtained at
* http://www.telerik.com/purchase/license-agreement/kendo-ui-complete
* If you do not own a commercial license, this file shall be governed by the trial license terms.
*/
(function (f, define) {
define('kendo.mobile.splitview', ['kendo.mobile.pane'], f);
}(function () {
var __meta__ = {
id: 'mobile.splitview',
name: 'SplitView',
category: 'mobile',
description: 'The mobile SplitView is a tablet-specific view that consists of two or more mobile Pane widgets.',
depends: ['mobile.pane']
};
(function ($, undefined) {
var kendo = window.kendo, ui = kendo.mobile.ui, Widget = ui.Widget, EXPANED_PANE_SHIM = '<div class=\'km-expanded-pane-shim\' />', View = ui.View;
var SplitView = View.extend({
init: function (element, options) {
var that = this, pane, modalViews;
Widget.fn.init.call(that, element, options);
element = that.element;
$.extend(that, options);
that._id();
if (!that.options.$angular) {
that._layout();
that._overlay();
} else {
that._overlay();
}
that._style();
modalViews = element.children(that._locate('modalview'));
if (!that.options.$angular) {
kendo.mobile.init(modalViews);
} else {
modalViews.each(function (idx, element) {
kendo.compileMobileDirective($(element), options.$angular[0]);
});
}
that.panes = [];
that._paramsHistory = [];
if (!that.options.$angular) {
that.content.children(kendo.roleSelector('pane')).each(function () {
pane = kendo.initWidget(this, {}, ui.roles);
that.panes.push(pane);
});
} else {
that.element.children(kendo.directiveSelector('pane')).each(function () {
pane = kendo.compileMobileDirective($(this), options.$angular[0]);
that.panes.push(pane);
});
that.element.children(kendo.directiveSelector('header footer')).each(function () {
kendo.compileMobileDirective($(this), options.$angular[0]);
});
}
that.expandedPaneShim = $(EXPANED_PANE_SHIM).appendTo(that.element);
that._shimUserEvents = new kendo.UserEvents(that.expandedPaneShim, {
fastTap: true,
tap: function () {
that.collapsePanes();
}
});
},
_locate: function (selectors) {
return this.options.$angular ? kendo.directiveSelector(selectors) : kendo.roleSelector(selectors);
},
options: {
name: 'SplitView',
style: 'horizontal'
},
expandPanes: function () {
this.element.addClass('km-expanded-splitview');
},
collapsePanes: function () {
this.element.removeClass('km-expanded-splitview');
},
_layout: function () {
var that = this, element = that.element;
that.transition = kendo.attrValue(element, 'transition');
kendo.mobile.ui.View.prototype._layout.call(this);
kendo.mobile.init(this.header.add(this.footer));
that.element.addClass('km-splitview');
that.content.addClass('km-split-content');
},
_style: function () {
var style = this.options.style, element = this.element, styles;
if (style) {
styles = style.split(' ');
$.each(styles, function () {
element.addClass('km-split-' + this);
});
}
},
showStart: function () {
var that = this;
that.element.css('display', '');
if (!that.inited) {
that.inited = true;
$.each(that.panes, function () {
if (this.options.initial) {
this.navigateToInitial();
} else {
this.navigate('');
}
});
that.trigger('init', { view: that });
} else {
this._invokeNgController();
}
that.trigger('show', { view: that });
}
});
ui.plugin(SplitView);
}(window.kendo.jQuery));
return window.kendo;
}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {
(a3 || a2)();
}));