mirror of https://github.com/apache/nifi.git
parent
57b4178f19
commit
53f440609b
|
@ -48,7 +48,7 @@
|
||||||
<script type="text/javascript" src="js/jquery/modal/jquery.modal.js?${project.version}"></script>
|
<script type="text/javascript" src="js/jquery/modal/jquery.modal.js?${project.version}"></script>
|
||||||
<script type="text/javascript" src="js/jquery/minicolors/jquery.minicolors.min.js"></script>
|
<script type="text/javascript" src="js/jquery/minicolors/jquery.minicolors.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.0.min.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.2.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.0.min.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.2.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.0.min.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.2.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.0.min.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.2.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.0.min.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.2.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<script type="text/javascript" src="js/jquery/jquery.ellipsis.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.ellipsis.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.0.min.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.2.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.0.min.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.2.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
<script type="text/javascript" src="js/jquery/qtip2/jquery.qtip.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.0.min.js"></script>
|
<script type="text/javascript" src="js/jquery/jquery.event.drag-2.2.min.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellrangeselector.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.cellselectionmodel.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
<script type="text/javascript" src="js/jquery/slickgrid/plugins/slick.rowselectionmodel.js"></script>
|
||||||
|
|
|
@ -1,194 +0,0 @@
|
||||||
/*!
|
|
||||||
* jquery.event.drag - v 2.0.0
|
|
||||||
* Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
|
|
||||||
* Open Source MIT License - http://threedubmedia.com/code/license
|
|
||||||
*/
|
|
||||||
;
|
|
||||||
(function (f) {
|
|
||||||
f.fn.drag = function (b, a, d) {
|
|
||||||
var e = typeof b == "string" ? b : "", k = f.isFunction(b) ? b : f.isFunction(a) ? a : null;
|
|
||||||
if (e.indexOf("drag") !== 0)
|
|
||||||
e = "drag" + e;
|
|
||||||
d = (b == k ? a : d) || {};
|
|
||||||
return k ? this.bind(e, d, k) : this.trigger(e)
|
|
||||||
};
|
|
||||||
var i = f.event, h = i.special, c = h.drag = {defaults: {which: 1, distance: 0, not: ":input", handle: null, relative: false, drop: true, click: false}, datakey: "dragdata", livekey: "livedrag", add: function (b) {
|
|
||||||
var a = f.data(this, c.datakey), d = b.data || {};
|
|
||||||
a.related += 1;
|
|
||||||
if (!a.live && b.selector) {
|
|
||||||
a.live = true;
|
|
||||||
i.add(this, "draginit." + c.livekey, c.delegate)
|
|
||||||
}
|
|
||||||
f.each(c.defaults, function (e) {
|
|
||||||
if (d[e] !== undefined)
|
|
||||||
a[e] = d[e]
|
|
||||||
})
|
|
||||||
}, remove: function () {
|
|
||||||
f.data(this, c.datakey).related -= 1
|
|
||||||
}, setup: function () {
|
|
||||||
if (!f.data(this, c.datakey)) {
|
|
||||||
var b = f.extend({related: 0}, c.defaults);
|
|
||||||
f.data(this, c.datakey, b);
|
|
||||||
i.add(this, "mousedown", c.init, b);
|
|
||||||
this.attachEvent && this.attachEvent("ondragstart", c.dontstart)
|
|
||||||
}
|
|
||||||
}, teardown: function () {
|
|
||||||
if (!f.data(this, c.datakey).related) {
|
|
||||||
f.removeData(this, c.datakey);
|
|
||||||
i.remove(this, "mousedown", c.init);
|
|
||||||
i.remove(this, "draginit", c.delegate);
|
|
||||||
c.textselect(true);
|
|
||||||
this.detachEvent && this.detachEvent("ondragstart", c.dontstart)
|
|
||||||
}
|
|
||||||
}, init: function (b) {
|
|
||||||
var a = b.data, d;
|
|
||||||
if (!(a.which > 0 && b.which != a.which))
|
|
||||||
if (!f(b.target).is(a.not))
|
|
||||||
if (!(a.handle && !f(b.target).closest(a.handle, b.currentTarget).length)) {
|
|
||||||
a.propagates = 1;
|
|
||||||
a.interactions = [c.interaction(this, a)];
|
|
||||||
a.target = b.target;
|
|
||||||
a.pageX = b.pageX;
|
|
||||||
a.pageY = b.pageY;
|
|
||||||
a.dragging = null;
|
|
||||||
d = c.hijack(b, "draginit", a);
|
|
||||||
if (a.propagates) {
|
|
||||||
if ((d = c.flatten(d)) && d.length) {
|
|
||||||
a.interactions = [];
|
|
||||||
f.each(d, function () {
|
|
||||||
a.interactions.push(c.interaction(this, a))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
a.propagates = a.interactions.length;
|
|
||||||
a.drop !== false && h.drop && h.drop.handler(b, a);
|
|
||||||
c.textselect(false);
|
|
||||||
i.add(document, "mousemove mouseup", c.handler, a);
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, interaction: function (b, a) {
|
|
||||||
return{drag: b, callback: new c.callback, droppable: [], offset: f(b)[a.relative ? "position" : "offset"]() || {top: 0, left: 0}}
|
|
||||||
}, handler: function (b) {
|
|
||||||
var a = b.data;
|
|
||||||
switch (b.type) {
|
|
||||||
case !a.dragging && "mousemove":
|
|
||||||
if (Math.pow(b.pageX - a.pageX, 2) + Math.pow(b.pageY - a.pageY, 2) < Math.pow(a.distance, 2))
|
|
||||||
break;
|
|
||||||
b.target = a.target;
|
|
||||||
c.hijack(b, "dragstart", a);
|
|
||||||
if (a.propagates)
|
|
||||||
a.dragging = true;
|
|
||||||
case "mousemove":
|
|
||||||
if (a.dragging) {
|
|
||||||
c.hijack(b, "drag", a);
|
|
||||||
if (a.propagates) {
|
|
||||||
a.drop !== false && h.drop && h.drop.handler(b, a);
|
|
||||||
break
|
|
||||||
}
|
|
||||||
b.type = "mouseup"
|
|
||||||
}
|
|
||||||
case "mouseup":
|
|
||||||
i.remove(document, "mousemove mouseup", c.handler);
|
|
||||||
if (a.dragging) {
|
|
||||||
a.drop !== false && h.drop && h.drop.handler(b, a);
|
|
||||||
c.hijack(b, "dragend", a)
|
|
||||||
}
|
|
||||||
c.textselect(true);
|
|
||||||
if (a.click === false && a.dragging) {
|
|
||||||
jQuery.event.triggered = true;
|
|
||||||
setTimeout(function () {
|
|
||||||
jQuery.event.triggered = false
|
|
||||||
}, 20);
|
|
||||||
a.dragging = false
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}, delegate: function (b) {
|
|
||||||
var a = [], d, e = f.data(this, "events") || {};
|
|
||||||
f.each(e.live || [], function (k, j) {
|
|
||||||
if (j.preType.indexOf("drag") === 0)
|
|
||||||
if (d = f(b.target).closest(j.selector, b.currentTarget)[0]) {
|
|
||||||
i.add(d, j.origType + "." + c.livekey, j.origHandler, j.data);
|
|
||||||
f.inArray(d, a) < 0 && a.push(d)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (!a.length)
|
|
||||||
return false;
|
|
||||||
return f(a).bind("dragend." + c.livekey, function () {
|
|
||||||
i.remove(this, "." + c.livekey)
|
|
||||||
})
|
|
||||||
}, hijack: function (b, a, d, e, k) {
|
|
||||||
if (d) {
|
|
||||||
var j = {event: b.originalEvent, type: b.type}, n = a.indexOf("drop") ? "drag" : "drop", l, o = e || 0, g, m;
|
|
||||||
e = !isNaN(e) ? e : d.interactions.length;
|
|
||||||
b.type = a;
|
|
||||||
b.originalEvent = null;
|
|
||||||
d.results = [];
|
|
||||||
do
|
|
||||||
if (g = d.interactions[o])
|
|
||||||
if (!(a !== "dragend" && g.cancelled)) {
|
|
||||||
m = c.properties(b, d, g);
|
|
||||||
g.results = [];
|
|
||||||
f(k || g[n] || d.droppable).each(function (q, p) {
|
|
||||||
l = (m.target = p) ? i.handle.call(p, b, m) : null;
|
|
||||||
if (l === false) {
|
|
||||||
if (n == "drag") {
|
|
||||||
g.cancelled = true;
|
|
||||||
d.propagates -= 1
|
|
||||||
}
|
|
||||||
if (a == "drop")
|
|
||||||
g[n][q] = null
|
|
||||||
} else if (a == "dropinit")
|
|
||||||
g.droppable.push(c.element(l) || p);
|
|
||||||
if (a == "dragstart")
|
|
||||||
g.proxy = f(c.element(l) || g.drag)[0];
|
|
||||||
g.results.push(l);
|
|
||||||
delete b.result;
|
|
||||||
if (a !== "dropinit")
|
|
||||||
return l
|
|
||||||
});
|
|
||||||
d.results[o] = c.flatten(g.results);
|
|
||||||
if (a == "dropinit")
|
|
||||||
g.droppable = c.flatten(g.droppable);
|
|
||||||
a == "dragstart" && !g.cancelled && m.update()
|
|
||||||
}
|
|
||||||
while (++o < e);
|
|
||||||
b.type = j.type;
|
|
||||||
b.originalEvent = j.event;
|
|
||||||
return c.flatten(d.results)
|
|
||||||
}
|
|
||||||
}, properties: function (b, a, d) {
|
|
||||||
var e = d.callback;
|
|
||||||
e.drag = d.drag;
|
|
||||||
e.proxy = d.proxy || d.drag;
|
|
||||||
e.startX = a.pageX;
|
|
||||||
e.startY = a.pageY;
|
|
||||||
e.deltaX = b.pageX - a.pageX;
|
|
||||||
e.deltaY = b.pageY - a.pageY;
|
|
||||||
e.originalX = d.offset.left;
|
|
||||||
e.originalY = d.offset.top;
|
|
||||||
e.offsetX = b.pageX - (a.pageX - e.originalX);
|
|
||||||
e.offsetY = b.pageY - (a.pageY - e.originalY);
|
|
||||||
e.drop = c.flatten((d.drop || []).slice());
|
|
||||||
e.available = c.flatten((d.droppable || []).slice());
|
|
||||||
return e
|
|
||||||
}, element: function (b) {
|
|
||||||
if (b && (b.jquery || b.nodeType == 1))
|
|
||||||
return b
|
|
||||||
}, flatten: function (b) {
|
|
||||||
return f.map(b, function (a) {
|
|
||||||
return a && a.jquery ? f.makeArray(a) : a && a.length ? c.flatten(a) : a
|
|
||||||
})
|
|
||||||
}, textselect: function (b) {
|
|
||||||
f(document)[b ? "unbind" : "bind"]("selectstart", c.dontstart).attr("unselectable", b ? "off" : "on").css("MozUserSelect", b ? "" : "none")
|
|
||||||
}, dontstart: function () {
|
|
||||||
return false
|
|
||||||
}, callback: function () {
|
|
||||||
}};
|
|
||||||
c.callback.prototype = {update: function () {
|
|
||||||
h.drop && this.available.length && f.each(this.available, function (b) {
|
|
||||||
h.drop.locate(this, b)
|
|
||||||
})
|
|
||||||
}};
|
|
||||||
h.draginit = h.dragstart = h.dragend = c
|
|
||||||
})(jQuery);
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,20 @@
|
||||||
|
Copyright (c) 2010 Michael Leibman, http://github.com/mleibman/slickgrid
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Binary file not shown.
After Width: | Height: | Size: 846 B |
Binary file not shown.
After Width: | Height: | Size: 851 B |
|
@ -31,24 +31,24 @@ classes should alter those!
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-headerrow {
|
.slick-headerrow {
|
||||||
background: #fafafa;
|
background: #fafafa;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-headerrow-column {
|
.slick-headerrow-column {
|
||||||
background: #fafafa;
|
background: #fafafa;
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-row.ui-state-active {
|
.slick-row.ui-state-active {
|
||||||
background: #F5F7D7;
|
background: #F5F7D7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-row {
|
.slick-row {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background: white;
|
background: white;
|
||||||
border: 0px;
|
border: 0px;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-row:hover {
|
.slick-row:hover {
|
||||||
|
@ -56,37 +56,37 @@ classes should alter those!
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-row.selected {
|
.slick-row.selected {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
background: #DFE8F6 !important;
|
background: #DFE8F6 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-cell {
|
.slick-cell {
|
||||||
padding-left: 4px;
|
padding-left: 4px;
|
||||||
padding-right: 4px;
|
padding-right: 4px;
|
||||||
border-style: solid !important;
|
border-style: solid !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-group {
|
.slick-group {
|
||||||
border-bottom: 2px solid silver;
|
border-bottom: 2px solid silver;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-group-toggle {
|
.slick-group-toggle {
|
||||||
width: 9px;
|
width: 9px;
|
||||||
height: 9px;
|
height: 9px;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-group-toggle.expanded {
|
.slick-group-toggle.expanded {
|
||||||
background: url(../../../../images/collapse.gif) no-repeat center center;
|
background: url(images/collapse.gif) no-repeat center center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-group-toggle.collapsed {
|
.slick-group-toggle.collapsed {
|
||||||
background: url(../../../../images/expand.gif) no-repeat center center;
|
background: url(images/expand.gif) no-repeat center center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-group-totals {
|
.slick-group-totals {
|
||||||
color: gray;
|
color: gray;
|
||||||
background: white;
|
background: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-cell.selected {
|
.slick-cell.selected {
|
||||||
|
@ -100,22 +100,36 @@ classes should alter those!
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-sortable-placeholder {
|
.slick-sortable-placeholder {
|
||||||
background: silver !important;
|
background: silver !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-row[row$="1"], .slick-row[row$="3"], .slick-row[row$="5"], .slick-row[row$="7"], .slick-row[row$="9"] {
|
.slick-row.odd {
|
||||||
background: #fafafa;
|
background: #fafafa;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-row.ui-state-active {
|
.slick-row.ui-state-active {
|
||||||
background: #F5F7D7;
|
background: #F5F7D7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-row.loading {
|
.slick-row.loading {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
filter: alpha(opacity = 50);
|
filter: alpha(opacity = 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-cell.invalid {
|
.slick-cell.invalid {
|
||||||
border-color: red;
|
border-color: red;
|
||||||
|
-moz-animation-duration: 0.2s;
|
||||||
|
-webkit-animation-duration: 0.2s;
|
||||||
|
-moz-animation-name: slickgrid-invalid-hilite;
|
||||||
|
-webkit-animation-name: slickgrid-invalid-hilite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@-moz-keyframes slickgrid-invalid-hilite {
|
||||||
|
from { box-shadow: 0 0 6px red; }
|
||||||
|
to { box-shadow: none; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes slickgrid-invalid-hilite {
|
||||||
|
from { box-shadow: 0 0 6px red; }
|
||||||
|
to { box-shadow: none; }
|
||||||
}
|
}
|
|
@ -6,153 +6,152 @@ classes should alter those!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.slick-header.ui-state-default, .slick-headerrow.ui-state-default {
|
.slick-header.ui-state-default, .slick-headerrow.ui-state-default {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-left: 0px;
|
border-left: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-header-columns, .slick-headerrow-columns {
|
.slick-header-columns, .slick-headerrow-columns {
|
||||||
width: 999999px;
|
position: relative;
|
||||||
position: relative;
|
white-space: nowrap;
|
||||||
white-space: nowrap;
|
cursor: default;
|
||||||
cursor: default;
|
overflow: hidden;
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-header-column.ui-state-default {
|
.slick-header-column.ui-state-default {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
-o-text-overflow: ellipsis;
|
||||||
height: 16px;
|
text-overflow: ellipsis;
|
||||||
line-height: 16px;
|
height: 16px;
|
||||||
margin: 0;
|
line-height: 16px;
|
||||||
padding: 4px;
|
margin: 0;
|
||||||
border-right: 1px solid silver;
|
padding: 4px;
|
||||||
border-left: 0px;
|
border-right: 1px solid silver;
|
||||||
border-top: 0px;
|
border-left: 0px;
|
||||||
border-bottom: 0px;
|
border-top: 0px;
|
||||||
float: left;
|
border-bottom: 0px;
|
||||||
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-headerrow-column.ui-state-default {
|
.slick-headerrow-column.ui-state-default {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-header-column-sorted {
|
.slick-header-column-sorted {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-sort-indicator {
|
.slick-sort-indicator {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 8px;
|
width: 8px;
|
||||||
height: 5px;
|
height: 5px;
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
|
margin-top: 6px;
|
||||||
|
/*float: left;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-sort-indicator-desc {
|
.slick-sort-indicator-desc {
|
||||||
background: url(images/sort-desc.gif);
|
background: url(images/sort-desc.gif);
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-sort-indicator-asc {
|
.slick-sort-indicator-asc {
|
||||||
background: url(images/sort-asc.gif);
|
background: url(images/sort-asc.gif);
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-resizable-handle {
|
.slick-resizable-handle {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
font-size: 0.1px;
|
font-size: 0.1px;
|
||||||
display: block;
|
display: block;
|
||||||
cursor: col-resize;
|
cursor: col-resize;
|
||||||
width: 4px;
|
width: 4px;
|
||||||
right: 0px;
|
right: 0px;
|
||||||
top: 0;
|
top: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-sortable-placeholder {
|
.slick-sortable-placeholder {
|
||||||
background: silver;
|
background: silver;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-canvas {
|
.grid-canvas {
|
||||||
position: relative;
|
position: relative;
|
||||||
outline: 0;
|
outline: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-row.ui-widget-content, .slick-row.ui-state-active {
|
.slick-row.ui-widget-content, .slick-row.ui-state-active {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
border: 0px;
|
border: 0px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-cell, .slick-headerrow-column {
|
.slick-cell, .slick-headerrow-column {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
border: 1px solid transparent;
|
||||||
border: 1px solid transparent;
|
border-right: 1px dotted silver;
|
||||||
border-right: 1px dotted silver;
|
border-bottom-color: silver;
|
||||||
border-bottom-color: silver;
|
overflow: hidden;
|
||||||
|
-o-text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
text-overflow: ellipsis;
|
||||||
text-overflow: ellipsis;
|
vertical-align: middle;
|
||||||
white-space: nowrap;
|
z-index: 1;
|
||||||
vertical-align: middle;
|
padding: 1px 2px 2px 1px;
|
||||||
z-index: 1;
|
margin: 0;
|
||||||
padding: 1px 2px 2px 1px;
|
white-space: nowrap;
|
||||||
margin: 0;
|
cursor: default;
|
||||||
|
|
||||||
white-space: nowrap;
|
|
||||||
|
|
||||||
cursor: default;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-group {
|
.slick-group {
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-group-toggle {
|
.slick-group-toggle {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-cell.highlighted {
|
.slick-cell.highlighted {
|
||||||
background: lightskyblue;
|
background: lightskyblue;
|
||||||
background: rgba(0, 0, 255, 0.2);
|
background: rgba(0, 0, 255, 0.2);
|
||||||
-webkit-transition: all 0.5s;
|
-webkit-transition: all 0.5s;
|
||||||
-moz-transition: all 0.5s;
|
-moz-transition: all 0.5s;
|
||||||
transition: all 0.5s;
|
-o-transition: all 0.5s;
|
||||||
|
transition: all 0.5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-cell.flashing {
|
.slick-cell.flashing {
|
||||||
border: 1px solid red !important;
|
border: 1px solid red !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-cell.editable {
|
.slick-cell.editable {
|
||||||
z-index: 11;
|
z-index: 11;
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
background: white;
|
background: white;
|
||||||
border-color: black;
|
border-color: black;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-cell:focus {
|
.slick-cell:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-reorder-proxy {
|
.slick-reorder-proxy {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
background: blue;
|
background: blue;
|
||||||
opacity: 0.15;
|
opacity: 0.15;
|
||||||
filter: alpha(opacity = 15);
|
filter: alpha(opacity = 15);
|
||||||
cursor: move;
|
cursor: move;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-reorder-guide {
|
.slick-reorder-guide {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
height: 2px;
|
height: 2px;
|
||||||
background: blue;
|
background: blue;
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
filter: alpha(opacity = 70);
|
filter: alpha(opacity = 70);
|
||||||
}
|
}
|
||||||
|
|
||||||
.slick-selection {
|
.slick-selection {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
border: 2px dashed black;
|
border: 2px dashed black;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +1,83 @@
|
||||||
(function ($) {
|
(function ($) {
|
||||||
// register namespace
|
// Register namespace
|
||||||
$.extend(true, window, {
|
$.extend(true, window, {
|
||||||
"Slick": {
|
"Slick": {
|
||||||
"AutoTooltips": AutoTooltips
|
"AutoTooltips": AutoTooltips
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
function AutoTooltips(options) {
|
|
||||||
var _grid;
|
|
||||||
var _self = this;
|
|
||||||
var _defaults = {
|
|
||||||
maxToolTipLength: null
|
|
||||||
};
|
|
||||||
|
|
||||||
function init(grid) {
|
|
||||||
options = $.extend(true, {}, _defaults, options);
|
|
||||||
_grid = grid;
|
|
||||||
_grid.onMouseEnter.subscribe(handleMouseEnter);
|
|
||||||
}
|
|
||||||
|
|
||||||
function destroy() {
|
|
||||||
_grid.onMouseEnter.unsubscribe(handleMouseEnter);
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleMouseEnter(e, args) {
|
|
||||||
var cell = _grid.getCellFromEvent(e);
|
|
||||||
if (cell) {
|
|
||||||
var node = _grid.getCellNode(cell.row, cell.cell);
|
|
||||||
if ($(node).innerWidth() < node.scrollWidth) {
|
|
||||||
var text = $.trim($(node).text());
|
|
||||||
if (options.maxToolTipLength && text.length > options.maxToolTipLength) {
|
|
||||||
text = text.substr(0, options.maxToolTipLength - 3) + "...";
|
|
||||||
}
|
|
||||||
$(node).attr("title", text);
|
|
||||||
} else {
|
|
||||||
$(node).attr("title", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$.extend(this, {
|
|
||||||
"init": init,
|
|
||||||
"destroy": destroy
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AutoTooltips plugin to show/hide tooltips when columns are too narrow to fit content.
|
||||||
|
* @constructor
|
||||||
|
* @param {boolean} [options.enableForCells=true] - Enable tooltip for grid cells
|
||||||
|
* @param {boolean} [options.enableForHeaderCells=false] - Enable tooltip for header cells
|
||||||
|
* @param {number} [options.maxToolTipLength=null] - The maximum length for a tooltip
|
||||||
|
*/
|
||||||
|
function AutoTooltips(options) {
|
||||||
|
var _grid;
|
||||||
|
var _self = this;
|
||||||
|
var _defaults = {
|
||||||
|
enableForCells: true,
|
||||||
|
enableForHeaderCells: false,
|
||||||
|
maxToolTipLength: null
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize plugin.
|
||||||
|
*/
|
||||||
|
function init(grid) {
|
||||||
|
options = $.extend(true, {}, _defaults, options);
|
||||||
|
_grid = grid;
|
||||||
|
if (options.enableForCells) _grid.onMouseEnter.subscribe(handleMouseEnter);
|
||||||
|
if (options.enableForHeaderCells) _grid.onHeaderMouseEnter.subscribe(handleHeaderMouseEnter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy plugin.
|
||||||
|
*/
|
||||||
|
function destroy() {
|
||||||
|
if (options.enableForCells) _grid.onMouseEnter.unsubscribe(handleMouseEnter);
|
||||||
|
if (options.enableForHeaderCells) _grid.onHeaderMouseEnter.unsubscribe(handleHeaderMouseEnter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle mouse entering grid cell to add/remove tooltip.
|
||||||
|
* @param {jQuery.Event} e - The event
|
||||||
|
*/
|
||||||
|
function handleMouseEnter(e) {
|
||||||
|
var cell = _grid.getCellFromEvent(e);
|
||||||
|
if (cell) {
|
||||||
|
var $node = $(_grid.getCellNode(cell.row, cell.cell));
|
||||||
|
var text;
|
||||||
|
if ($node.innerWidth() < $node[0].scrollWidth) {
|
||||||
|
text = $.trim($node.text());
|
||||||
|
if (options.maxToolTipLength && text.length > options.maxToolTipLength) {
|
||||||
|
text = text.substr(0, options.maxToolTipLength - 3) + "...";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
text = "";
|
||||||
|
}
|
||||||
|
$node.attr("title", text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle mouse entering header cell to add/remove tooltip.
|
||||||
|
* @param {jQuery.Event} e - The event
|
||||||
|
* @param {object} args.column - The column definition
|
||||||
|
*/
|
||||||
|
function handleHeaderMouseEnter(e, args) {
|
||||||
|
var column = args.column,
|
||||||
|
$node = $(e.target).closest(".slick-header-column");
|
||||||
|
if (!column.toolTip) {
|
||||||
|
$node.attr("title", ($node.innerWidth() < $node[0].scrollWidth) ? column.name : "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Public API
|
||||||
|
$.extend(this, {
|
||||||
|
"init": init,
|
||||||
|
"destroy": destroy
|
||||||
|
});
|
||||||
|
}
|
||||||
})(jQuery);
|
})(jQuery);
|
|
@ -1,64 +1,66 @@
|
||||||
(function ($) {
|
(function ($) {
|
||||||
// register namespace
|
// register namespace
|
||||||
$.extend(true, window, {
|
$.extend(true, window, {
|
||||||
"Slick": {
|
"Slick": {
|
||||||
"CellRangeDecorator": CellRangeDecorator
|
"CellRangeDecorator": CellRangeDecorator
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Displays an overlay on top of a given cell range.
|
|
||||||
*
|
|
||||||
* TODO:
|
|
||||||
* Currently, it blocks mouse events to DOM nodes behind it.
|
|
||||||
* Use FF and WebKit-specific "pointer-events" CSS style, or some kind of event forwarding.
|
|
||||||
* Could also construct the borders separately using 4 individual DIVs.
|
|
||||||
*
|
|
||||||
* @param {Grid} grid
|
|
||||||
* @param {Object} options
|
|
||||||
*/
|
|
||||||
function CellRangeDecorator(grid, options) {
|
|
||||||
var _elem;
|
|
||||||
var _defaults = {
|
|
||||||
selectionCss: {
|
|
||||||
"zIndex": "9999",
|
|
||||||
"border": "2px dashed red"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
options = $.extend(true, {}, _defaults, options);
|
|
||||||
|
|
||||||
|
|
||||||
function show(range) {
|
|
||||||
if (!_elem) {
|
|
||||||
_elem = $("<div></div>", {css: options.selectionCss})
|
|
||||||
.css("position", "absolute")
|
|
||||||
.appendTo(grid.getCanvasNode());
|
|
||||||
}
|
|
||||||
|
|
||||||
var from = grid.getCellNodeBox(range.fromRow, range.fromCell);
|
|
||||||
var to = grid.getCellNodeBox(range.toRow, range.toCell);
|
|
||||||
|
|
||||||
_elem.css({
|
|
||||||
top: from.top - 1,
|
|
||||||
left: from.left - 1,
|
|
||||||
height: to.bottom - from.top - 2,
|
|
||||||
width: to.right - from.left - 2
|
|
||||||
});
|
|
||||||
|
|
||||||
return _elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
function hide() {
|
|
||||||
if (_elem) {
|
|
||||||
_elem.remove();
|
|
||||||
_elem = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$.extend(this, {
|
|
||||||
"show": show,
|
|
||||||
"hide": hide
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})(jQuery);
|
});
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Displays an overlay on top of a given cell range.
|
||||||
|
*
|
||||||
|
* TODO:
|
||||||
|
* Currently, it blocks mouse events to DOM nodes behind it.
|
||||||
|
* Use FF and WebKit-specific "pointer-events" CSS style, or some kind of event forwarding.
|
||||||
|
* Could also construct the borders separately using 4 individual DIVs.
|
||||||
|
*
|
||||||
|
* @param {Grid} grid
|
||||||
|
* @param {Object} options
|
||||||
|
*/
|
||||||
|
function CellRangeDecorator(grid, options) {
|
||||||
|
var _elem;
|
||||||
|
var _defaults = {
|
||||||
|
selectionCssClass: 'slick-range-decorator',
|
||||||
|
selectionCss: {
|
||||||
|
"zIndex": "9999",
|
||||||
|
"border": "2px dashed red"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
options = $.extend(true, {}, _defaults, options);
|
||||||
|
|
||||||
|
|
||||||
|
function show(range) {
|
||||||
|
if (!_elem) {
|
||||||
|
_elem = $("<div></div>", {css: options.selectionCss})
|
||||||
|
.addClass(options.selectionCssClass)
|
||||||
|
.css("position", "absolute")
|
||||||
|
.appendTo(grid.getCanvasNode());
|
||||||
|
}
|
||||||
|
|
||||||
|
var from = grid.getCellNodeBox(range.fromRow, range.fromCell);
|
||||||
|
var to = grid.getCellNodeBox(range.toRow, range.toCell);
|
||||||
|
|
||||||
|
_elem.css({
|
||||||
|
top: from.top - 1,
|
||||||
|
left: from.left - 1,
|
||||||
|
height: to.bottom - from.top - 2,
|
||||||
|
width: to.right - from.left - 2
|
||||||
|
});
|
||||||
|
|
||||||
|
return _elem;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hide() {
|
||||||
|
if (_elem) {
|
||||||
|
_elem.remove();
|
||||||
|
_elem = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$.extend(this, {
|
||||||
|
"show": show,
|
||||||
|
"hide": hide
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})(jQuery);
|
||||||
|
|
|
@ -1,111 +1,113 @@
|
||||||
(function ($) {
|
(function ($) {
|
||||||
// register namespace
|
// register namespace
|
||||||
$.extend(true, window, {
|
$.extend(true, window, {
|
||||||
"Slick": {
|
"Slick": {
|
||||||
"CellRangeSelector": CellRangeSelector
|
"CellRangeSelector": CellRangeSelector
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
function CellRangeSelector(options) {
|
|
||||||
var _grid;
|
|
||||||
var _canvas;
|
|
||||||
var _dragging;
|
|
||||||
var _decorator;
|
|
||||||
var _self = this;
|
|
||||||
var _defaults = {
|
|
||||||
selectionCss: {
|
|
||||||
"border": "2px dashed blue"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function init(grid) {
|
|
||||||
options = $.extend(true, {}, _defaults, options);
|
|
||||||
_decorator = new Slick.CellRangeDecorator(grid, options);
|
|
||||||
_grid = grid;
|
|
||||||
_canvas = _grid.getCanvasNode();
|
|
||||||
_grid.onDragInit.subscribe(handleDragInit);
|
|
||||||
_grid.onDragStart.subscribe(handleDragStart);
|
|
||||||
_grid.onDrag.subscribe(handleDrag);
|
|
||||||
_grid.onDragEnd.subscribe(handleDragEnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
function destroy() {
|
|
||||||
_grid.onDragInit.unsubscribe(handleDragInit);
|
|
||||||
_grid.onDragStart.unsubscribe(handleDragStart);
|
|
||||||
_grid.onDrag.unsubscribe(handleDrag);
|
|
||||||
_grid.onDragEnd.unsubscribe(handleDragEnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleDragInit(e, dd) {
|
|
||||||
// prevent the grid from cancelling drag'n'drop by default
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleDragStart(e, dd) {
|
|
||||||
var cell = _grid.getCellFromEvent(e);
|
|
||||||
if (_self.onBeforeCellRangeSelected.notify(cell) !== false) {
|
|
||||||
if (_grid.canCellBeSelected(cell.row, cell.cell)) {
|
|
||||||
_dragging = true;
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!_dragging) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var start = _grid.getCellFromPoint(
|
|
||||||
dd.startX - $(_canvas).offset().left,
|
|
||||||
dd.startY - $(_canvas).offset().top);
|
|
||||||
|
|
||||||
dd.range = {start: start, end: {}};
|
|
||||||
|
|
||||||
return _decorator.show(new Slick.Range(start.row, start.cell));
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleDrag(e, dd) {
|
|
||||||
if (!_dragging) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
|
|
||||||
var end = _grid.getCellFromPoint(
|
|
||||||
e.pageX - $(_canvas).offset().left,
|
|
||||||
e.pageY - $(_canvas).offset().top);
|
|
||||||
|
|
||||||
if (!_grid.canCellBeSelected(end.row, end.cell)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dd.range.end = end;
|
|
||||||
_decorator.show(new Slick.Range(dd.range.start.row, dd.range.start.cell, end.row, end.cell));
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleDragEnd(e, dd) {
|
|
||||||
if (!_dragging) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_dragging = false;
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
|
|
||||||
_decorator.hide();
|
|
||||||
_self.onCellRangeSelected.notify({
|
|
||||||
range: new Slick.Range(
|
|
||||||
dd.range.start.row,
|
|
||||||
dd.range.start.cell,
|
|
||||||
dd.range.end.row,
|
|
||||||
dd.range.end.cell
|
|
||||||
)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$.extend(this, {
|
|
||||||
"init": init,
|
|
||||||
"destroy": destroy,
|
|
||||||
"onBeforeCellRangeSelected": new Slick.Event(),
|
|
||||||
"onCellRangeSelected": new Slick.Event()
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function CellRangeSelector(options) {
|
||||||
|
var _grid;
|
||||||
|
var _canvas;
|
||||||
|
var _dragging;
|
||||||
|
var _decorator;
|
||||||
|
var _self = this;
|
||||||
|
var _handler = new Slick.EventHandler();
|
||||||
|
var _defaults = {
|
||||||
|
selectionCss: {
|
||||||
|
"border": "2px dashed blue"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function init(grid) {
|
||||||
|
options = $.extend(true, {}, _defaults, options);
|
||||||
|
_decorator = new Slick.CellRangeDecorator(grid, options);
|
||||||
|
_grid = grid;
|
||||||
|
_canvas = _grid.getCanvasNode();
|
||||||
|
_handler
|
||||||
|
.subscribe(_grid.onDragInit, handleDragInit)
|
||||||
|
.subscribe(_grid.onDragStart, handleDragStart)
|
||||||
|
.subscribe(_grid.onDrag, handleDrag)
|
||||||
|
.subscribe(_grid.onDragEnd, handleDragEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroy() {
|
||||||
|
_handler.unsubscribeAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDragInit(e, dd) {
|
||||||
|
// prevent the grid from cancelling drag'n'drop by default
|
||||||
|
e.stopImmediatePropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDragStart(e, dd) {
|
||||||
|
var cell = _grid.getCellFromEvent(e);
|
||||||
|
if (_self.onBeforeCellRangeSelected.notify(cell) !== false) {
|
||||||
|
if (_grid.canCellBeSelected(cell.row, cell.cell)) {
|
||||||
|
_dragging = true;
|
||||||
|
e.stopImmediatePropagation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!_dragging) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_grid.focus();
|
||||||
|
|
||||||
|
var start = _grid.getCellFromPoint(
|
||||||
|
dd.startX - $(_canvas).offset().left,
|
||||||
|
dd.startY - $(_canvas).offset().top);
|
||||||
|
|
||||||
|
dd.range = {start: start, end: {}};
|
||||||
|
|
||||||
|
return _decorator.show(new Slick.Range(start.row, start.cell));
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDrag(e, dd) {
|
||||||
|
if (!_dragging) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e.stopImmediatePropagation();
|
||||||
|
|
||||||
|
var end = _grid.getCellFromPoint(
|
||||||
|
e.pageX - $(_canvas).offset().left,
|
||||||
|
e.pageY - $(_canvas).offset().top);
|
||||||
|
|
||||||
|
if (!_grid.canCellBeSelected(end.row, end.cell)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dd.range.end = end;
|
||||||
|
_decorator.show(new Slick.Range(dd.range.start.row, dd.range.start.cell, end.row, end.cell));
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDragEnd(e, dd) {
|
||||||
|
if (!_dragging) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_dragging = false;
|
||||||
|
e.stopImmediatePropagation();
|
||||||
|
|
||||||
|
_decorator.hide();
|
||||||
|
_self.onCellRangeSelected.notify({
|
||||||
|
range: new Slick.Range(
|
||||||
|
dd.range.start.row,
|
||||||
|
dd.range.start.cell,
|
||||||
|
dd.range.end.row,
|
||||||
|
dd.range.end.cell
|
||||||
|
)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$.extend(this, {
|
||||||
|
"init": init,
|
||||||
|
"destroy": destroy,
|
||||||
|
|
||||||
|
"onBeforeCellRangeSelected": new Slick.Event(),
|
||||||
|
"onCellRangeSelected": new Slick.Event()
|
||||||
|
});
|
||||||
|
}
|
||||||
})(jQuery);
|
})(jQuery);
|
|
@ -1,90 +1,154 @@
|
||||||
(function ($) {
|
(function ($) {
|
||||||
// register namespace
|
// register namespace
|
||||||
$.extend(true, window, {
|
$.extend(true, window, {
|
||||||
"Slick": {
|
"Slick": {
|
||||||
"CellSelectionModel": CellSelectionModel
|
"CellSelectionModel": CellSelectionModel
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
function CellSelectionModel(options) {
|
|
||||||
var _grid;
|
|
||||||
var _canvas;
|
|
||||||
var _ranges = [];
|
|
||||||
var _self = this;
|
|
||||||
var _selector = new Slick.CellRangeSelector({
|
|
||||||
"selectionCss": {
|
|
||||||
"border": "2px solid black"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var _options;
|
|
||||||
var _defaults = {
|
|
||||||
selectActiveCell: true
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function init(grid) {
|
|
||||||
_options = $.extend(true, {}, _defaults, options);
|
|
||||||
_grid = grid;
|
|
||||||
_canvas = _grid.getCanvasNode();
|
|
||||||
_grid.onActiveCellChanged.subscribe(handleActiveCellChange);
|
|
||||||
grid.registerPlugin(_selector);
|
|
||||||
_selector.onCellRangeSelected.subscribe(handleCellRangeSelected);
|
|
||||||
_selector.onBeforeCellRangeSelected.subscribe(handleBeforeCellRangeSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
function destroy() {
|
|
||||||
_grid.onActiveCellChanged.unsubscribe(handleActiveCellChange);
|
|
||||||
_selector.onCellRangeSelected.unsubscribe(handleCellRangeSelected);
|
|
||||||
_selector.onBeforeCellRangeSelected.unsubscribe(handleBeforeCellRangeSelected);
|
|
||||||
_grid.unregisterPlugin(_selector);
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeInvalidRanges(ranges) {
|
|
||||||
var result = [];
|
|
||||||
|
|
||||||
for (var i = 0; i < ranges.length; i++) {
|
|
||||||
var r = ranges[i];
|
|
||||||
if (_grid.canCellBeSelected(r.fromRow, r.fromCell) && _grid.canCellBeSelected(r.toRow, r.toCell)) {
|
|
||||||
result.push(r);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setSelectedRanges(ranges) {
|
|
||||||
_ranges = removeInvalidRanges(ranges);
|
|
||||||
_self.onSelectedRangesChanged.notify(_ranges);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSelectedRanges() {
|
|
||||||
return _ranges;
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleBeforeCellRangeSelected(e, args) {
|
|
||||||
if (_grid.getEditorLock().isActive()) {
|
|
||||||
e.stopPropagation();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleCellRangeSelected(e, args) {
|
|
||||||
setSelectedRanges([args.range]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleActiveCellChange(e, args) {
|
|
||||||
if (_options.selectActiveCell) {
|
|
||||||
setSelectedRanges([new Slick.Range(args.row, args.cell)]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$.extend(this, {
|
|
||||||
"getSelectedRanges": getSelectedRanges,
|
|
||||||
"setSelectedRanges": setSelectedRanges,
|
|
||||||
"init": init,
|
|
||||||
"destroy": destroy,
|
|
||||||
"onSelectedRangesChanged": new Slick.Event()
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})(jQuery);
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function CellSelectionModel(options) {
|
||||||
|
var _grid;
|
||||||
|
var _canvas;
|
||||||
|
var _ranges = [];
|
||||||
|
var _self = this;
|
||||||
|
var _selector = new Slick.CellRangeSelector({
|
||||||
|
"selectionCss": {
|
||||||
|
"border": "2px solid black"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var _options;
|
||||||
|
var _defaults = {
|
||||||
|
selectActiveCell: true
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function init(grid) {
|
||||||
|
_options = $.extend(true, {}, _defaults, options);
|
||||||
|
_grid = grid;
|
||||||
|
_canvas = _grid.getCanvasNode();
|
||||||
|
_grid.onActiveCellChanged.subscribe(handleActiveCellChange);
|
||||||
|
_grid.onKeyDown.subscribe(handleKeyDown);
|
||||||
|
grid.registerPlugin(_selector);
|
||||||
|
_selector.onCellRangeSelected.subscribe(handleCellRangeSelected);
|
||||||
|
_selector.onBeforeCellRangeSelected.subscribe(handleBeforeCellRangeSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroy() {
|
||||||
|
_grid.onActiveCellChanged.unsubscribe(handleActiveCellChange);
|
||||||
|
_grid.onKeyDown.unsubscribe(handleKeyDown);
|
||||||
|
_selector.onCellRangeSelected.unsubscribe(handleCellRangeSelected);
|
||||||
|
_selector.onBeforeCellRangeSelected.unsubscribe(handleBeforeCellRangeSelected);
|
||||||
|
_grid.unregisterPlugin(_selector);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeInvalidRanges(ranges) {
|
||||||
|
var result = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < ranges.length; i++) {
|
||||||
|
var r = ranges[i];
|
||||||
|
if (_grid.canCellBeSelected(r.fromRow, r.fromCell) && _grid.canCellBeSelected(r.toRow, r.toCell)) {
|
||||||
|
result.push(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSelectedRanges(ranges) {
|
||||||
|
_ranges = removeInvalidRanges(ranges);
|
||||||
|
_self.onSelectedRangesChanged.notify(_ranges);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSelectedRanges() {
|
||||||
|
return _ranges;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBeforeCellRangeSelected(e, args) {
|
||||||
|
if (_grid.getEditorLock().isActive()) {
|
||||||
|
e.stopPropagation();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCellRangeSelected(e, args) {
|
||||||
|
setSelectedRanges([args.range]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleActiveCellChange(e, args) {
|
||||||
|
if (_options.selectActiveCell && args.row != null && args.cell != null) {
|
||||||
|
setSelectedRanges([new Slick.Range(args.row, args.cell)]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleKeyDown(e) {
|
||||||
|
/***
|
||||||
|
* Кey codes
|
||||||
|
* 37 left
|
||||||
|
* 38 up
|
||||||
|
* 39 right
|
||||||
|
* 40 down
|
||||||
|
*/
|
||||||
|
var ranges, last;
|
||||||
|
var active = _grid.getActiveCell();
|
||||||
|
|
||||||
|
if ( active && e.shiftKey && !e.ctrlKey && !e.altKey &&
|
||||||
|
(e.which == 37 || e.which == 39 || e.which == 38 || e.which == 40) ) {
|
||||||
|
|
||||||
|
ranges = getSelectedRanges();
|
||||||
|
if (!ranges.length)
|
||||||
|
ranges.push(new Slick.Range(active.row, active.cell));
|
||||||
|
|
||||||
|
// keyboard can work with last range only
|
||||||
|
last = ranges.pop();
|
||||||
|
|
||||||
|
// can't handle selection out of active cell
|
||||||
|
if (!last.contains(active.row, active.cell))
|
||||||
|
last = new Slick.Range(active.row, active.cell);
|
||||||
|
|
||||||
|
var dRow = last.toRow - last.fromRow,
|
||||||
|
dCell = last.toCell - last.fromCell,
|
||||||
|
// walking direction
|
||||||
|
dirRow = active.row == last.fromRow ? 1 : -1,
|
||||||
|
dirCell = active.cell == last.fromCell ? 1 : -1;
|
||||||
|
|
||||||
|
if (e.which == 37) {
|
||||||
|
dCell -= dirCell;
|
||||||
|
} else if (e.which == 39) {
|
||||||
|
dCell += dirCell ;
|
||||||
|
} else if (e.which == 38) {
|
||||||
|
dRow -= dirRow;
|
||||||
|
} else if (e.which == 40) {
|
||||||
|
dRow += dirRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
// define new selection range
|
||||||
|
var new_last = new Slick.Range(active.row, active.cell, active.row + dirRow*dRow, active.cell + dirCell*dCell);
|
||||||
|
if (removeInvalidRanges([new_last]).length) {
|
||||||
|
ranges.push(new_last);
|
||||||
|
var viewRow = dirRow > 0 ? new_last.toRow : new_last.fromRow;
|
||||||
|
var viewCell = dirCell > 0 ? new_last.toCell : new_last.fromCell;
|
||||||
|
_grid.scrollRowIntoView(viewRow);
|
||||||
|
_grid.scrollCellIntoView(viewRow, viewCell);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ranges.push(last);
|
||||||
|
|
||||||
|
setSelectedRanges(ranges);
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$.extend(this, {
|
||||||
|
"getSelectedRanges": getSelectedRanges,
|
||||||
|
"setSelectedRanges": setSelectedRanges,
|
||||||
|
|
||||||
|
"init": init,
|
||||||
|
"destroy": destroy,
|
||||||
|
|
||||||
|
"onSelectedRangesChanged": new Slick.Event()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})(jQuery);
|
||||||
|
|
|
@ -1,184 +1,187 @@
|
||||||
(function ($) {
|
(function ($) {
|
||||||
// register namespace
|
// register namespace
|
||||||
$.extend(true, window, {
|
$.extend(true, window, {
|
||||||
"Slick": {
|
"Slick": {
|
||||||
"RowSelectionModel": RowSelectionModel
|
"RowSelectionModel": RowSelectionModel
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function RowSelectionModel(options) {
|
|
||||||
var _grid;
|
|
||||||
var _ranges = [];
|
|
||||||
var _self = this;
|
|
||||||
var _handler = new Slick.EventHandler();
|
|
||||||
var _inHandler;
|
|
||||||
var _options;
|
|
||||||
var _defaults = {
|
|
||||||
selectActiveRow: true
|
|
||||||
};
|
|
||||||
|
|
||||||
function init(grid) {
|
|
||||||
_options = $.extend(true, {}, _defaults, options);
|
|
||||||
_grid = grid;
|
|
||||||
_handler.subscribe(_grid.onActiveCellChanged,
|
|
||||||
wrapHandler(handleActiveCellChange));
|
|
||||||
_handler.subscribe(_grid.onKeyDown,
|
|
||||||
wrapHandler(handleKeyDown));
|
|
||||||
_handler.subscribe(_grid.onClick,
|
|
||||||
wrapHandler(handleClick));
|
|
||||||
}
|
|
||||||
|
|
||||||
function destroy() {
|
|
||||||
_handler.unsubscribeAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
function wrapHandler(handler) {
|
|
||||||
return function () {
|
|
||||||
if (!_inHandler) {
|
|
||||||
_inHandler = true;
|
|
||||||
handler.apply(this, arguments);
|
|
||||||
_inHandler = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function rangesToRows(ranges) {
|
|
||||||
var rows = [];
|
|
||||||
for (var i = 0; i < ranges.length; i++) {
|
|
||||||
for (var j = ranges[i].fromRow; j <= ranges[i].toRow; j++) {
|
|
||||||
rows.push(j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rows;
|
|
||||||
}
|
|
||||||
|
|
||||||
function rowsToRanges(rows) {
|
|
||||||
var ranges = [];
|
|
||||||
var lastCell = _grid.getColumns().length - 1;
|
|
||||||
for (var i = 0; i < rows.length; i++) {
|
|
||||||
ranges.push(new Slick.Range(rows[i], 0, rows[i], lastCell));
|
|
||||||
}
|
|
||||||
return ranges;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRowsRange(from, to) {
|
|
||||||
var i, rows = [];
|
|
||||||
for (i = from; i <= to; i++) {
|
|
||||||
rows.push(i);
|
|
||||||
}
|
|
||||||
for (i = to; i < from; i++) {
|
|
||||||
rows.push(i);
|
|
||||||
}
|
|
||||||
return rows;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSelectedRows() {
|
|
||||||
return rangesToRows(_ranges);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setSelectedRows(rows) {
|
|
||||||
setSelectedRanges(rowsToRanges(rows));
|
|
||||||
}
|
|
||||||
|
|
||||||
function setSelectedRanges(ranges) {
|
|
||||||
_ranges = ranges;
|
|
||||||
_self.onSelectedRangesChanged.notify(_ranges);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSelectedRanges() {
|
|
||||||
return _ranges;
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleActiveCellChange(e, data) {
|
|
||||||
if (_options.selectActiveRow) {
|
|
||||||
setSelectedRanges([new Slick.Range(data.row, 0, data.row, _grid.getColumns().length - 1)]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleKeyDown(e) {
|
|
||||||
var activeRow = _grid.getActiveCell();
|
|
||||||
if (activeRow && e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey && (e.which == 38 || e.which == 40)) {
|
|
||||||
var selectedRows = getSelectedRows();
|
|
||||||
selectedRows.sort(function (x, y) {
|
|
||||||
return x - y
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!selectedRows.length) {
|
|
||||||
selectedRows = [activeRow.row];
|
|
||||||
}
|
|
||||||
|
|
||||||
var top = selectedRows[0];
|
|
||||||
var bottom = selectedRows[selectedRows.length - 1];
|
|
||||||
var active;
|
|
||||||
|
|
||||||
if (e.which == 40) {
|
|
||||||
active = activeRow.row < bottom || top == bottom ? ++bottom : ++top;
|
|
||||||
} else {
|
|
||||||
active = activeRow.row < bottom ? --bottom : --top;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (active >= 0 && active < _grid.getDataLength()) {
|
|
||||||
_grid.scrollRowIntoView(active);
|
|
||||||
_ranges = rowsToRanges(getRowsRange(top, bottom));
|
|
||||||
setSelectedRanges(_ranges);
|
|
||||||
}
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleClick(e) {
|
|
||||||
var cell = _grid.getCellFromEvent(e);
|
|
||||||
if (!cell || !_grid.canCellBeActive(cell.row, cell.cell)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var selection = rangesToRows(_ranges);
|
|
||||||
var idx = $.inArray(cell.row, selection);
|
|
||||||
|
|
||||||
if (!e.ctrlKey && !e.shiftKey && !e.metaKey) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (_grid.getOptions().multiSelect) {
|
|
||||||
if (idx === -1 && (e.ctrlKey || e.metaKey)) {
|
|
||||||
selection.push(cell.row);
|
|
||||||
_grid.setActiveCell(cell.row, cell.cell);
|
|
||||||
} else if (idx !== -1 && (e.ctrlKey || e.metaKey)) {
|
|
||||||
selection = $.grep(selection, function (o, i) {
|
|
||||||
return (o !== cell.row);
|
|
||||||
});
|
|
||||||
_grid.setActiveCell(cell.row, cell.cell);
|
|
||||||
} else if (selection.length && e.shiftKey) {
|
|
||||||
var last = selection.pop();
|
|
||||||
var from = Math.min(cell.row, last);
|
|
||||||
var to = Math.max(cell.row, last);
|
|
||||||
selection = [];
|
|
||||||
for (var i = from; i <= to; i++) {
|
|
||||||
if (i !== last) {
|
|
||||||
selection.push(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selection.push(last);
|
|
||||||
_grid.setActiveCell(cell.row, cell.cell);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_ranges = rowsToRanges(selection);
|
|
||||||
setSelectedRanges(_ranges);
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.extend(this, {
|
|
||||||
"getSelectedRows": getSelectedRows,
|
|
||||||
"setSelectedRows": setSelectedRows,
|
|
||||||
"getSelectedRanges": getSelectedRanges,
|
|
||||||
"setSelectedRanges": setSelectedRanges,
|
|
||||||
"init": init,
|
|
||||||
"destroy": destroy,
|
|
||||||
"onSelectedRangesChanged": new Slick.Event()
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function RowSelectionModel(options) {
|
||||||
|
var _grid;
|
||||||
|
var _ranges = [];
|
||||||
|
var _self = this;
|
||||||
|
var _handler = new Slick.EventHandler();
|
||||||
|
var _inHandler;
|
||||||
|
var _options;
|
||||||
|
var _defaults = {
|
||||||
|
selectActiveRow: true
|
||||||
|
};
|
||||||
|
|
||||||
|
function init(grid) {
|
||||||
|
_options = $.extend(true, {}, _defaults, options);
|
||||||
|
_grid = grid;
|
||||||
|
_handler.subscribe(_grid.onActiveCellChanged,
|
||||||
|
wrapHandler(handleActiveCellChange));
|
||||||
|
_handler.subscribe(_grid.onKeyDown,
|
||||||
|
wrapHandler(handleKeyDown));
|
||||||
|
_handler.subscribe(_grid.onClick,
|
||||||
|
wrapHandler(handleClick));
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroy() {
|
||||||
|
_handler.unsubscribeAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
function wrapHandler(handler) {
|
||||||
|
return function () {
|
||||||
|
if (!_inHandler) {
|
||||||
|
_inHandler = true;
|
||||||
|
handler.apply(this, arguments);
|
||||||
|
_inHandler = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function rangesToRows(ranges) {
|
||||||
|
var rows = [];
|
||||||
|
for (var i = 0; i < ranges.length; i++) {
|
||||||
|
for (var j = ranges[i].fromRow; j <= ranges[i].toRow; j++) {
|
||||||
|
rows.push(j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
function rowsToRanges(rows) {
|
||||||
|
var ranges = [];
|
||||||
|
var lastCell = _grid.getColumns().length - 1;
|
||||||
|
for (var i = 0; i < rows.length; i++) {
|
||||||
|
ranges.push(new Slick.Range(rows[i], 0, rows[i], lastCell));
|
||||||
|
}
|
||||||
|
return ranges;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRowsRange(from, to) {
|
||||||
|
var i, rows = [];
|
||||||
|
for (i = from; i <= to; i++) {
|
||||||
|
rows.push(i);
|
||||||
|
}
|
||||||
|
for (i = to; i < from; i++) {
|
||||||
|
rows.push(i);
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSelectedRows() {
|
||||||
|
return rangesToRows(_ranges);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSelectedRows(rows) {
|
||||||
|
setSelectedRanges(rowsToRanges(rows));
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSelectedRanges(ranges) {
|
||||||
|
_ranges = ranges;
|
||||||
|
_self.onSelectedRangesChanged.notify(_ranges);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSelectedRanges() {
|
||||||
|
return _ranges;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleActiveCellChange(e, data) {
|
||||||
|
if (_options.selectActiveRow && data.row != null) {
|
||||||
|
setSelectedRanges([new Slick.Range(data.row, 0, data.row, _grid.getColumns().length - 1)]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleKeyDown(e) {
|
||||||
|
var activeRow = _grid.getActiveCell();
|
||||||
|
if (activeRow && e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey && (e.which == 38 || e.which == 40)) {
|
||||||
|
var selectedRows = getSelectedRows();
|
||||||
|
selectedRows.sort(function (x, y) {
|
||||||
|
return x - y
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!selectedRows.length) {
|
||||||
|
selectedRows = [activeRow.row];
|
||||||
|
}
|
||||||
|
|
||||||
|
var top = selectedRows[0];
|
||||||
|
var bottom = selectedRows[selectedRows.length - 1];
|
||||||
|
var active;
|
||||||
|
|
||||||
|
if (e.which == 40) {
|
||||||
|
active = activeRow.row < bottom || top == bottom ? ++bottom : ++top;
|
||||||
|
} else {
|
||||||
|
active = activeRow.row < bottom ? --bottom : --top;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (active >= 0 && active < _grid.getDataLength()) {
|
||||||
|
_grid.scrollRowIntoView(active);
|
||||||
|
_ranges = rowsToRanges(getRowsRange(top, bottom));
|
||||||
|
setSelectedRanges(_ranges);
|
||||||
|
}
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClick(e) {
|
||||||
|
var cell = _grid.getCellFromEvent(e);
|
||||||
|
if (!cell || !_grid.canCellBeActive(cell.row, cell.cell)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_grid.getOptions().multiSelect || (
|
||||||
|
!e.ctrlKey && !e.shiftKey && !e.metaKey)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var selection = rangesToRows(_ranges);
|
||||||
|
var idx = $.inArray(cell.row, selection);
|
||||||
|
|
||||||
|
if (idx === -1 && (e.ctrlKey || e.metaKey)) {
|
||||||
|
selection.push(cell.row);
|
||||||
|
_grid.setActiveCell(cell.row, cell.cell);
|
||||||
|
} else if (idx !== -1 && (e.ctrlKey || e.metaKey)) {
|
||||||
|
selection = $.grep(selection, function (o, i) {
|
||||||
|
return (o !== cell.row);
|
||||||
|
});
|
||||||
|
_grid.setActiveCell(cell.row, cell.cell);
|
||||||
|
} else if (selection.length && e.shiftKey) {
|
||||||
|
var last = selection.pop();
|
||||||
|
var from = Math.min(cell.row, last);
|
||||||
|
var to = Math.max(cell.row, last);
|
||||||
|
selection = [];
|
||||||
|
for (var i = from; i <= to; i++) {
|
||||||
|
if (i !== last) {
|
||||||
|
selection.push(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
selection.push(last);
|
||||||
|
_grid.setActiveCell(cell.row, cell.cell);
|
||||||
|
}
|
||||||
|
|
||||||
|
_ranges = rowsToRanges(selection);
|
||||||
|
setSelectedRanges(_ranges);
|
||||||
|
e.stopImmediatePropagation();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.extend(this, {
|
||||||
|
"getSelectedRows": getSelectedRows,
|
||||||
|
"setSelectedRows": setSelectedRows,
|
||||||
|
|
||||||
|
"getSelectedRanges": getSelectedRanges,
|
||||||
|
"setSelectedRanges": setSelectedRanges,
|
||||||
|
|
||||||
|
"init": init,
|
||||||
|
"destroy": destroy,
|
||||||
|
|
||||||
|
"onSelectedRangesChanged": new Slick.Event()
|
||||||
|
});
|
||||||
|
}
|
||||||
})(jQuery);
|
})(jQuery);
|
|
@ -5,419 +5,463 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function ($) {
|
(function ($) {
|
||||||
// register namespace
|
// register namespace
|
||||||
$.extend(true, window, {
|
$.extend(true, window, {
|
||||||
"Slick": {
|
"Slick": {
|
||||||
"Event": Event,
|
"Event": Event,
|
||||||
"EventData": EventData,
|
"EventData": EventData,
|
||||||
"EventHandler": EventHandler,
|
"EventHandler": EventHandler,
|
||||||
"Range": Range,
|
"Range": Range,
|
||||||
"NonDataRow": NonDataItem,
|
"NonDataRow": NonDataItem,
|
||||||
"Group": Group,
|
"Group": Group,
|
||||||
"GroupTotals": GroupTotals,
|
"GroupTotals": GroupTotals,
|
||||||
"EditorLock": EditorLock,
|
"EditorLock": EditorLock,
|
||||||
/***
|
|
||||||
* A global singleton editor lock.
|
/***
|
||||||
* @class GlobalEditorLock
|
* A global singleton editor lock.
|
||||||
* @static
|
* @class GlobalEditorLock
|
||||||
* @constructor
|
* @static
|
||||||
*/
|
* @constructor
|
||||||
"GlobalEditorLock": new EditorLock()
|
*/
|
||||||
}
|
"GlobalEditorLock": new EditorLock()
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/***
|
||||||
|
* An event object for passing data to event handlers and letting them control propagation.
|
||||||
|
* <p>This is pretty much identical to how W3C and jQuery implement events.</p>
|
||||||
|
* @class EventData
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function EventData() {
|
||||||
|
var isPropagationStopped = false;
|
||||||
|
var isImmediatePropagationStopped = false;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* An event object for passing data to event handlers and letting them control propagation.
|
* Stops event from propagating up the DOM tree.
|
||||||
* <p>This is pretty much identical to how W3C and jQuery implement events.</p>
|
* @method stopPropagation
|
||||||
* @class EventData
|
|
||||||
* @constructor
|
|
||||||
*/
|
*/
|
||||||
function EventData() {
|
this.stopPropagation = function () {
|
||||||
var isPropagationStopped = false;
|
isPropagationStopped = true;
|
||||||
var isImmediatePropagationStopped = false;
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Stops event from propagating up the DOM tree.
|
|
||||||
* @method stopPropagation
|
|
||||||
*/
|
|
||||||
this.stopPropagation = function () {
|
|
||||||
isPropagationStopped = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Returns whether stopPropagation was called on this event object.
|
|
||||||
* @method isPropagationStopped
|
|
||||||
* @return {Boolean}
|
|
||||||
*/
|
|
||||||
this.isPropagationStopped = function () {
|
|
||||||
return isPropagationStopped;
|
|
||||||
};
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Prevents the rest of the handlers from being executed.
|
|
||||||
* @method stopImmediatePropagation
|
|
||||||
*/
|
|
||||||
this.stopImmediatePropagation = function () {
|
|
||||||
isImmediatePropagationStopped = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Returns whether stopImmediatePropagation was called on this event object.\
|
|
||||||
* @method isImmediatePropagationStopped
|
|
||||||
* @return {Boolean}
|
|
||||||
*/
|
|
||||||
this.isImmediatePropagationStopped = function () {
|
|
||||||
return isImmediatePropagationStopped;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***
|
|
||||||
* A simple publisher-subscriber implementation.
|
|
||||||
* @class Event
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
function Event() {
|
|
||||||
var handlers = [];
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Adds an event handler to be called when the event is fired.
|
|
||||||
* <p>Event handler will receive two arguments - an <code>EventData</code> and the <code>data</code>
|
|
||||||
* object the event was fired with.<p>
|
|
||||||
* @method subscribe
|
|
||||||
* @param fn {Function} Event handler.
|
|
||||||
*/
|
|
||||||
this.subscribe = function (fn) {
|
|
||||||
handlers.push(fn);
|
|
||||||
};
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Removes an event handler added with <code>subscribe(fn)</code>.
|
|
||||||
* @method unsubscribe
|
|
||||||
* @param fn {Function} Event handler to be removed.
|
|
||||||
*/
|
|
||||||
this.unsubscribe = function (fn) {
|
|
||||||
for (var i = handlers.length - 1; i >= 0; i--) {
|
|
||||||
if (handlers[i] === fn) {
|
|
||||||
handlers.splice(i, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Fires an event notifying all subscribers.
|
|
||||||
* @method notify
|
|
||||||
* @param args {Object} Additional data object to be passed to all handlers.
|
|
||||||
* @param e {EventData}
|
|
||||||
* Optional.
|
|
||||||
* An <code>EventData</code> object to be passed to all handlers.
|
|
||||||
* For DOM events, an existing W3C/jQuery event object can be passed in.
|
|
||||||
* @param scope {Object}
|
|
||||||
* Optional.
|
|
||||||
* The scope ("this") within which the handler will be executed.
|
|
||||||
* If not specified, the scope will be set to the <code>Event</code> instance.
|
|
||||||
*/
|
|
||||||
this.notify = function (args, e, scope) {
|
|
||||||
e = e || new EventData();
|
|
||||||
scope = scope || this;
|
|
||||||
|
|
||||||
var returnValue;
|
|
||||||
for (var i = 0; i < handlers.length && !(e.isPropagationStopped() || e.isImmediatePropagationStopped()); i++) {
|
|
||||||
returnValue = handlers[i].call(scope, e, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
return returnValue;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function EventHandler() {
|
|
||||||
var handlers = [];
|
|
||||||
|
|
||||||
this.subscribe = function (event, handler) {
|
|
||||||
handlers.push({
|
|
||||||
event: event,
|
|
||||||
handler: handler
|
|
||||||
});
|
|
||||||
event.subscribe(handler);
|
|
||||||
};
|
|
||||||
|
|
||||||
this.unsubscribe = function (event, handler) {
|
|
||||||
var i = handlers.length;
|
|
||||||
while (i--) {
|
|
||||||
if (handlers[i].event === event &&
|
|
||||||
handlers[i].handler === handler) {
|
|
||||||
handlers.splice(i, 1);
|
|
||||||
event.unsubscribe(handler);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.unsubscribeAll = function () {
|
|
||||||
var i = handlers.length;
|
|
||||||
while (i--) {
|
|
||||||
handlers[i].event.unsubscribe(handlers[i].handler);
|
|
||||||
}
|
|
||||||
handlers = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***
|
|
||||||
* A structure containing a range of cells.
|
|
||||||
* @class Range
|
|
||||||
* @constructor
|
|
||||||
* @param fromRow {Integer} Starting row.
|
|
||||||
* @param fromCell {Integer} Starting cell.
|
|
||||||
* @param toRow {Integer} Optional. Ending row. Defaults to <code>fromRow</code>.
|
|
||||||
* @param toCell {Integer} Optional. Ending cell. Defaults to <code>fromCell</code>.
|
|
||||||
*/
|
|
||||||
function Range(fromRow, fromCell, toRow, toCell) {
|
|
||||||
if (toRow === undefined && toCell === undefined) {
|
|
||||||
toRow = fromRow;
|
|
||||||
toCell = fromCell;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***
|
|
||||||
* @property fromRow
|
|
||||||
* @type {Integer}
|
|
||||||
*/
|
|
||||||
this.fromRow = Math.min(fromRow, toRow);
|
|
||||||
|
|
||||||
/***
|
|
||||||
* @property fromCell
|
|
||||||
* @type {Integer}
|
|
||||||
*/
|
|
||||||
this.fromCell = Math.min(fromCell, toCell);
|
|
||||||
|
|
||||||
/***
|
|
||||||
* @property toRow
|
|
||||||
* @type {Integer}
|
|
||||||
*/
|
|
||||||
this.toRow = Math.max(fromRow, toRow);
|
|
||||||
|
|
||||||
/***
|
|
||||||
* @property toCell
|
|
||||||
* @type {Integer}
|
|
||||||
*/
|
|
||||||
this.toCell = Math.max(fromCell, toCell);
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Returns whether a range represents a single row.
|
|
||||||
* @method isSingleRow
|
|
||||||
* @return {Boolean}
|
|
||||||
*/
|
|
||||||
this.isSingleRow = function () {
|
|
||||||
return this.fromRow == this.toRow;
|
|
||||||
};
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Returns whether a range represents a single cell.
|
|
||||||
* @method isSingleCell
|
|
||||||
* @return {Boolean}
|
|
||||||
*/
|
|
||||||
this.isSingleCell = function () {
|
|
||||||
return this.fromRow == this.toRow && this.fromCell == this.toCell;
|
|
||||||
};
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Returns whether a range contains a given cell.
|
|
||||||
* @method contains
|
|
||||||
* @param row {Integer}
|
|
||||||
* @param cell {Integer}
|
|
||||||
* @return {Boolean}
|
|
||||||
*/
|
|
||||||
this.contains = function (row, cell) {
|
|
||||||
return row >= this.fromRow && row <= this.toRow &&
|
|
||||||
cell >= this.fromCell && cell <= this.toCell;
|
|
||||||
};
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Returns a readable representation of a range.
|
|
||||||
* @method toString
|
|
||||||
* @return {String}
|
|
||||||
*/
|
|
||||||
this.toString = function () {
|
|
||||||
if (this.isSingleCell()) {
|
|
||||||
return "(" + this.fromRow + ":" + this.fromCell + ")";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return "(" + this.fromRow + ":" + this.fromCell + " - " + this.toRow + ":" + this.toCell + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
|
||||||
* A base class that all special / non-data rows (like Group and GroupTotals) derive from.
|
|
||||||
* @class NonDataItem
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
function NonDataItem() {
|
|
||||||
this.__nonDataRow = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Information about a group of rows.
|
|
||||||
* @class Group
|
|
||||||
* @extends Slick.NonDataItem
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
function Group() {
|
|
||||||
this.__group = true;
|
|
||||||
this.__updated = false;
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Number of rows in the group.
|
|
||||||
* @property count
|
|
||||||
* @type {Integer}
|
|
||||||
*/
|
|
||||||
this.count = 0;
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Grouping value.
|
|
||||||
* @property value
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
this.value = null;
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Formatted display value of the group.
|
|
||||||
* @property title
|
|
||||||
* @type {String}
|
|
||||||
*/
|
|
||||||
this.title = null;
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Whether a group is collapsed.
|
|
||||||
* @property collapsed
|
|
||||||
* @type {Boolean}
|
|
||||||
*/
|
|
||||||
this.collapsed = false;
|
|
||||||
|
|
||||||
/***
|
|
||||||
* GroupTotals, if any.
|
|
||||||
* @property totals
|
|
||||||
* @type {GroupTotals}
|
|
||||||
*/
|
|
||||||
this.totals = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Group.prototype = new NonDataItem();
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Compares two Group instances.
|
|
||||||
* @method equals
|
|
||||||
* @return {Boolean}
|
|
||||||
* @param group {Group} Group instance to compare to.
|
|
||||||
*/
|
|
||||||
Group.prototype.equals = function (group) {
|
|
||||||
return this.value === group.value &&
|
|
||||||
this.count === group.count &&
|
|
||||||
this.collapsed === group.collapsed;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Information about group totals.
|
* Returns whether stopPropagation was called on this event object.
|
||||||
* An instance of GroupTotals will be created for each totals row and passed to the aggregators
|
* @method isPropagationStopped
|
||||||
* so that they can store arbitrary data in it. That data can later be accessed by group totals
|
* @return {Boolean}
|
||||||
* formatters during the display.
|
|
||||||
* @class GroupTotals
|
|
||||||
* @extends Slick.NonDataItem
|
|
||||||
* @constructor
|
|
||||||
*/
|
*/
|
||||||
function GroupTotals() {
|
this.isPropagationStopped = function () {
|
||||||
this.__groupTotals = true;
|
return isPropagationStopped;
|
||||||
|
};
|
||||||
/***
|
|
||||||
* Parent Group.
|
|
||||||
* @param group
|
|
||||||
* @type {Group}
|
|
||||||
*/
|
|
||||||
this.group = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
GroupTotals.prototype = new NonDataItem();
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* A locking helper to track the active edit controller and ensure that only a single controller
|
* Prevents the rest of the handlers from being executed.
|
||||||
* can be active at a time. This prevents a whole class of state and validation synchronization
|
* @method stopImmediatePropagation
|
||||||
* issues. An edit controller (such as SlickGrid) can query if an active edit is in progress
|
|
||||||
* and attempt a commit or cancel before proceeding.
|
|
||||||
* @class EditorLock
|
|
||||||
* @constructor
|
|
||||||
*/
|
*/
|
||||||
function EditorLock() {
|
this.stopImmediatePropagation = function () {
|
||||||
var activeEditController = null;
|
isImmediatePropagationStopped = true;
|
||||||
|
};
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Returns true if a specified edit controller is active (has the edit lock).
|
* Returns whether stopImmediatePropagation was called on this event object.\
|
||||||
* If the parameter is not specified, returns true if any edit controller is active.
|
* @method isImmediatePropagationStopped
|
||||||
* @method isActive
|
* @return {Boolean}
|
||||||
* @param editController {EditController}
|
*/
|
||||||
* @return {Boolean}
|
this.isImmediatePropagationStopped = function () {
|
||||||
*/
|
return isImmediatePropagationStopped;
|
||||||
this.isActive = function (editController) {
|
|
||||||
return (editController ? activeEditController === editController : activeEditController !== null);
|
|
||||||
};
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Sets the specified edit controller as the active edit controller (acquire edit lock).
|
|
||||||
* If another edit controller is already active, and exception will be thrown.
|
|
||||||
* @method activate
|
|
||||||
* @param editController {EditController} edit controller acquiring the lock
|
|
||||||
*/
|
|
||||||
this.activate = function (editController) {
|
|
||||||
if (editController === activeEditController) { // already activated?
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (activeEditController !== null) {
|
|
||||||
throw "SlickGrid.EditorLock.activate: an editController is still active, can't activate another editController";
|
|
||||||
}
|
|
||||||
if (!editController.commitCurrentEdit) {
|
|
||||||
throw "SlickGrid.EditorLock.activate: editController must implement .commitCurrentEdit()";
|
|
||||||
}
|
|
||||||
if (!editController.cancelCurrentEdit) {
|
|
||||||
throw "SlickGrid.EditorLock.activate: editController must implement .cancelCurrentEdit()";
|
|
||||||
}
|
|
||||||
activeEditController = editController;
|
|
||||||
};
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Unsets the specified edit controller as the active edit controller (release edit lock).
|
|
||||||
* If the specified edit controller is not the active one, an exception will be thrown.
|
|
||||||
* @method deactivate
|
|
||||||
* @param editController {EditController} edit controller releasing the lock
|
|
||||||
*/
|
|
||||||
this.deactivate = function (editController) {
|
|
||||||
if (activeEditController !== editController) {
|
|
||||||
throw "SlickGrid.EditorLock.deactivate: specified editController is not the currently active one";
|
|
||||||
}
|
|
||||||
activeEditController = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Attempts to commit the current edit by calling "commitCurrentEdit" method on the active edit
|
|
||||||
* controller and returns whether the commit attempt was successful (commit may fail due to validation
|
|
||||||
* errors, etc.). Edit controller's "commitCurrentEdit" must return true if the commit has succeeded
|
|
||||||
* and false otherwise. If no edit controller is active, returns true.
|
|
||||||
* @method commitCurrentEdit
|
|
||||||
* @return {Boolean}
|
|
||||||
*/
|
|
||||||
this.commitCurrentEdit = function () {
|
|
||||||
return (activeEditController ? activeEditController.commitCurrentEdit() : true);
|
|
||||||
};
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Attempts to cancel the current edit by calling "cancelCurrentEdit" method on the active edit
|
|
||||||
* controller and returns whether the edit was successfully cancelled. If no edit controller is
|
|
||||||
* active, returns true.
|
|
||||||
* @method cancelCurrentEdit
|
|
||||||
* @return {Boolean}
|
|
||||||
*/
|
|
||||||
this.cancelCurrentEdit = function cancelCurrentEdit() {
|
|
||||||
return (activeEditController ? activeEditController.cancelCurrentEdit() : true);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* A simple publisher-subscriber implementation.
|
||||||
|
* @class Event
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function Event() {
|
||||||
|
var handlers = [];
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Adds an event handler to be called when the event is fired.
|
||||||
|
* <p>Event handler will receive two arguments - an <code>EventData</code> and the <code>data</code>
|
||||||
|
* object the event was fired with.<p>
|
||||||
|
* @method subscribe
|
||||||
|
* @param fn {Function} Event handler.
|
||||||
|
*/
|
||||||
|
this.subscribe = function (fn) {
|
||||||
|
handlers.push(fn);
|
||||||
|
};
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Removes an event handler added with <code>subscribe(fn)</code>.
|
||||||
|
* @method unsubscribe
|
||||||
|
* @param fn {Function} Event handler to be removed.
|
||||||
|
*/
|
||||||
|
this.unsubscribe = function (fn) {
|
||||||
|
for (var i = handlers.length - 1; i >= 0; i--) {
|
||||||
|
if (handlers[i] === fn) {
|
||||||
|
handlers.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Fires an event notifying all subscribers.
|
||||||
|
* @method notify
|
||||||
|
* @param args {Object} Additional data object to be passed to all handlers.
|
||||||
|
* @param e {EventData}
|
||||||
|
* Optional.
|
||||||
|
* An <code>EventData</code> object to be passed to all handlers.
|
||||||
|
* For DOM events, an existing W3C/jQuery event object can be passed in.
|
||||||
|
* @param scope {Object}
|
||||||
|
* Optional.
|
||||||
|
* The scope ("this") within which the handler will be executed.
|
||||||
|
* If not specified, the scope will be set to the <code>Event</code> instance.
|
||||||
|
*/
|
||||||
|
this.notify = function (args, e, scope) {
|
||||||
|
e = e || new EventData();
|
||||||
|
scope = scope || this;
|
||||||
|
|
||||||
|
var returnValue;
|
||||||
|
for (var i = 0; i < handlers.length && !(e.isPropagationStopped() || e.isImmediatePropagationStopped()); i++) {
|
||||||
|
returnValue = handlers[i].call(scope, e, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function EventHandler() {
|
||||||
|
var handlers = [];
|
||||||
|
|
||||||
|
this.subscribe = function (event, handler) {
|
||||||
|
handlers.push({
|
||||||
|
event: event,
|
||||||
|
handler: handler
|
||||||
|
});
|
||||||
|
event.subscribe(handler);
|
||||||
|
|
||||||
|
return this; // allow chaining
|
||||||
|
};
|
||||||
|
|
||||||
|
this.unsubscribe = function (event, handler) {
|
||||||
|
var i = handlers.length;
|
||||||
|
while (i--) {
|
||||||
|
if (handlers[i].event === event &&
|
||||||
|
handlers[i].handler === handler) {
|
||||||
|
handlers.splice(i, 1);
|
||||||
|
event.unsubscribe(handler);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this; // allow chaining
|
||||||
|
};
|
||||||
|
|
||||||
|
this.unsubscribeAll = function () {
|
||||||
|
var i = handlers.length;
|
||||||
|
while (i--) {
|
||||||
|
handlers[i].event.unsubscribe(handlers[i].handler);
|
||||||
|
}
|
||||||
|
handlers = [];
|
||||||
|
|
||||||
|
return this; // allow chaining
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* A structure containing a range of cells.
|
||||||
|
* @class Range
|
||||||
|
* @constructor
|
||||||
|
* @param fromRow {Integer} Starting row.
|
||||||
|
* @param fromCell {Integer} Starting cell.
|
||||||
|
* @param toRow {Integer} Optional. Ending row. Defaults to <code>fromRow</code>.
|
||||||
|
* @param toCell {Integer} Optional. Ending cell. Defaults to <code>fromCell</code>.
|
||||||
|
*/
|
||||||
|
function Range(fromRow, fromCell, toRow, toCell) {
|
||||||
|
if (toRow === undefined && toCell === undefined) {
|
||||||
|
toRow = fromRow;
|
||||||
|
toCell = fromCell;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @property fromRow
|
||||||
|
* @type {Integer}
|
||||||
|
*/
|
||||||
|
this.fromRow = Math.min(fromRow, toRow);
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @property fromCell
|
||||||
|
* @type {Integer}
|
||||||
|
*/
|
||||||
|
this.fromCell = Math.min(fromCell, toCell);
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @property toRow
|
||||||
|
* @type {Integer}
|
||||||
|
*/
|
||||||
|
this.toRow = Math.max(fromRow, toRow);
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @property toCell
|
||||||
|
* @type {Integer}
|
||||||
|
*/
|
||||||
|
this.toCell = Math.max(fromCell, toCell);
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Returns whether a range represents a single row.
|
||||||
|
* @method isSingleRow
|
||||||
|
* @return {Boolean}
|
||||||
|
*/
|
||||||
|
this.isSingleRow = function () {
|
||||||
|
return this.fromRow == this.toRow;
|
||||||
|
};
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Returns whether a range represents a single cell.
|
||||||
|
* @method isSingleCell
|
||||||
|
* @return {Boolean}
|
||||||
|
*/
|
||||||
|
this.isSingleCell = function () {
|
||||||
|
return this.fromRow == this.toRow && this.fromCell == this.toCell;
|
||||||
|
};
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Returns whether a range contains a given cell.
|
||||||
|
* @method contains
|
||||||
|
* @param row {Integer}
|
||||||
|
* @param cell {Integer}
|
||||||
|
* @return {Boolean}
|
||||||
|
*/
|
||||||
|
this.contains = function (row, cell) {
|
||||||
|
return row >= this.fromRow && row <= this.toRow &&
|
||||||
|
cell >= this.fromCell && cell <= this.toCell;
|
||||||
|
};
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Returns a readable representation of a range.
|
||||||
|
* @method toString
|
||||||
|
* @return {String}
|
||||||
|
*/
|
||||||
|
this.toString = function () {
|
||||||
|
if (this.isSingleCell()) {
|
||||||
|
return "(" + this.fromRow + ":" + this.fromCell + ")";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return "(" + this.fromRow + ":" + this.fromCell + " - " + this.toRow + ":" + this.toCell + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* A base class that all special / non-data rows (like Group and GroupTotals) derive from.
|
||||||
|
* @class NonDataItem
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function NonDataItem() {
|
||||||
|
this.__nonDataRow = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Information about a group of rows.
|
||||||
|
* @class Group
|
||||||
|
* @extends Slick.NonDataItem
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function Group() {
|
||||||
|
this.__group = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grouping level, starting with 0.
|
||||||
|
* @property level
|
||||||
|
* @type {Number}
|
||||||
|
*/
|
||||||
|
this.level = 0;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Number of rows in the group.
|
||||||
|
* @property count
|
||||||
|
* @type {Integer}
|
||||||
|
*/
|
||||||
|
this.count = 0;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Grouping value.
|
||||||
|
* @property value
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
this.value = null;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Formatted display value of the group.
|
||||||
|
* @property title
|
||||||
|
* @type {String}
|
||||||
|
*/
|
||||||
|
this.title = null;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Whether a group is collapsed.
|
||||||
|
* @property collapsed
|
||||||
|
* @type {Boolean}
|
||||||
|
*/
|
||||||
|
this.collapsed = false;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* GroupTotals, if any.
|
||||||
|
* @property totals
|
||||||
|
* @type {GroupTotals}
|
||||||
|
*/
|
||||||
|
this.totals = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rows that are part of the group.
|
||||||
|
* @property rows
|
||||||
|
* @type {Array}
|
||||||
|
*/
|
||||||
|
this.rows = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sub-groups that are part of the group.
|
||||||
|
* @property groups
|
||||||
|
* @type {Array}
|
||||||
|
*/
|
||||||
|
this.groups = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A unique key used to identify the group. This key can be used in calls to DataView
|
||||||
|
* collapseGroup() or expandGroup().
|
||||||
|
* @property groupingKey
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
this.groupingKey = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Group.prototype = new NonDataItem();
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Compares two Group instances.
|
||||||
|
* @method equals
|
||||||
|
* @return {Boolean}
|
||||||
|
* @param group {Group} Group instance to compare to.
|
||||||
|
*/
|
||||||
|
Group.prototype.equals = function (group) {
|
||||||
|
return this.value === group.value &&
|
||||||
|
this.count === group.count &&
|
||||||
|
this.collapsed === group.collapsed &&
|
||||||
|
this.title === group.title;
|
||||||
|
};
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Information about group totals.
|
||||||
|
* An instance of GroupTotals will be created for each totals row and passed to the aggregators
|
||||||
|
* so that they can store arbitrary data in it. That data can later be accessed by group totals
|
||||||
|
* formatters during the display.
|
||||||
|
* @class GroupTotals
|
||||||
|
* @extends Slick.NonDataItem
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function GroupTotals() {
|
||||||
|
this.__groupTotals = true;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Parent Group.
|
||||||
|
* @param group
|
||||||
|
* @type {Group}
|
||||||
|
*/
|
||||||
|
this.group = null;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Whether the totals have been fully initialized / calculated.
|
||||||
|
* Will be set to false for lazy-calculated group totals.
|
||||||
|
* @param initialized
|
||||||
|
* @type {Boolean}
|
||||||
|
*/
|
||||||
|
this.initialized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupTotals.prototype = new NonDataItem();
|
||||||
|
|
||||||
|
/***
|
||||||
|
* A locking helper to track the active edit controller and ensure that only a single controller
|
||||||
|
* can be active at a time. This prevents a whole class of state and validation synchronization
|
||||||
|
* issues. An edit controller (such as SlickGrid) can query if an active edit is in progress
|
||||||
|
* and attempt a commit or cancel before proceeding.
|
||||||
|
* @class EditorLock
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function EditorLock() {
|
||||||
|
var activeEditController = null;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Returns true if a specified edit controller is active (has the edit lock).
|
||||||
|
* If the parameter is not specified, returns true if any edit controller is active.
|
||||||
|
* @method isActive
|
||||||
|
* @param editController {EditController}
|
||||||
|
* @return {Boolean}
|
||||||
|
*/
|
||||||
|
this.isActive = function (editController) {
|
||||||
|
return (editController ? activeEditController === editController : activeEditController !== null);
|
||||||
|
};
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Sets the specified edit controller as the active edit controller (acquire edit lock).
|
||||||
|
* If another edit controller is already active, and exception will be thrown.
|
||||||
|
* @method activate
|
||||||
|
* @param editController {EditController} edit controller acquiring the lock
|
||||||
|
*/
|
||||||
|
this.activate = function (editController) {
|
||||||
|
if (editController === activeEditController) { // already activated?
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (activeEditController !== null) {
|
||||||
|
throw "SlickGrid.EditorLock.activate: an editController is still active, can't activate another editController";
|
||||||
|
}
|
||||||
|
if (!editController.commitCurrentEdit) {
|
||||||
|
throw "SlickGrid.EditorLock.activate: editController must implement .commitCurrentEdit()";
|
||||||
|
}
|
||||||
|
if (!editController.cancelCurrentEdit) {
|
||||||
|
throw "SlickGrid.EditorLock.activate: editController must implement .cancelCurrentEdit()";
|
||||||
|
}
|
||||||
|
activeEditController = editController;
|
||||||
|
};
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Unsets the specified edit controller as the active edit controller (release edit lock).
|
||||||
|
* If the specified edit controller is not the active one, an exception will be thrown.
|
||||||
|
* @method deactivate
|
||||||
|
* @param editController {EditController} edit controller releasing the lock
|
||||||
|
*/
|
||||||
|
this.deactivate = function (editController) {
|
||||||
|
if (activeEditController !== editController) {
|
||||||
|
throw "SlickGrid.EditorLock.deactivate: specified editController is not the currently active one";
|
||||||
|
}
|
||||||
|
activeEditController = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Attempts to commit the current edit by calling "commitCurrentEdit" method on the active edit
|
||||||
|
* controller and returns whether the commit attempt was successful (commit may fail due to validation
|
||||||
|
* errors, etc.). Edit controller's "commitCurrentEdit" must return true if the commit has succeeded
|
||||||
|
* and false otherwise. If no edit controller is active, returns true.
|
||||||
|
* @method commitCurrentEdit
|
||||||
|
* @return {Boolean}
|
||||||
|
*/
|
||||||
|
this.commitCurrentEdit = function () {
|
||||||
|
return (activeEditController ? activeEditController.commitCurrentEdit() : true);
|
||||||
|
};
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Attempts to cancel the current edit by calling "cancelCurrentEdit" method on the active edit
|
||||||
|
* controller and returns whether the edit was successfully cancelled. If no edit controller is
|
||||||
|
* active, returns true.
|
||||||
|
* @method cancelCurrentEdit
|
||||||
|
* @return {Boolean}
|
||||||
|
*/
|
||||||
|
this.cancelCurrentEdit = function cancelCurrentEdit() {
|
||||||
|
return (activeEditController ? activeEditController.cancelCurrentEdit() : true);
|
||||||
|
};
|
||||||
|
}
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,55 +1,59 @@
|
||||||
/***
|
/***
|
||||||
* Contains basic SlickGrid formatters.
|
* Contains basic SlickGrid formatters.
|
||||||
|
*
|
||||||
|
* NOTE: These are merely examples. You will most likely need to implement something more
|
||||||
|
* robust/extensible/localizable/etc. for your use!
|
||||||
|
*
|
||||||
* @module Formatters
|
* @module Formatters
|
||||||
* @namespace Slick
|
* @namespace Slick
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function ($) {
|
(function ($) {
|
||||||
// register namespace
|
// register namespace
|
||||||
$.extend(true, window, {
|
$.extend(true, window, {
|
||||||
"Slick": {
|
"Slick": {
|
||||||
"Formatters": {
|
"Formatters": {
|
||||||
"PercentComplete": PercentCompleteFormatter,
|
"PercentComplete": PercentCompleteFormatter,
|
||||||
"PercentCompleteBar": PercentCompleteBarFormatter,
|
"PercentCompleteBar": PercentCompleteBarFormatter,
|
||||||
"YesNo": YesNoFormatter,
|
"YesNo": YesNoFormatter,
|
||||||
"Checkmark": CheckmarkFormatter
|
"Checkmark": CheckmarkFormatter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function PercentCompleteFormatter(row, cell, value, columnDef, dataContext) {
|
function PercentCompleteFormatter(row, cell, value, columnDef, dataContext) {
|
||||||
if (value == null || value === "") {
|
if (value == null || value === "") {
|
||||||
return "-";
|
return "-";
|
||||||
} else if (value < 50) {
|
} else if (value < 50) {
|
||||||
return "<span style='color:red;font-weight:bold;'>" + value + "%</span>";
|
return "<span style='color:red;font-weight:bold;'>" + value + "%</span>";
|
||||||
} else {
|
} else {
|
||||||
return "<span style='color:green'>" + value + "%</span>";
|
return "<span style='color:green'>" + value + "%</span>";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function PercentCompleteBarFormatter(row, cell, value, columnDef, dataContext) {
|
||||||
|
if (value == null || value === "") {
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function PercentCompleteBarFormatter(row, cell, value, columnDef, dataContext) {
|
var color;
|
||||||
if (value == null || value === "") {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
var color;
|
if (value < 30) {
|
||||||
|
color = "red";
|
||||||
if (value < 30) {
|
} else if (value < 70) {
|
||||||
color = "red";
|
color = "silver";
|
||||||
} else if (value < 70) {
|
} else {
|
||||||
color = "silver";
|
color = "green";
|
||||||
} else {
|
|
||||||
color = "green";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "<span class='percent-complete-bar' style='background:" + color + ";width:" + value + "%'></span>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function YesNoFormatter(row, cell, value, columnDef, dataContext) {
|
return "<span class='percent-complete-bar' style='background:" + color + ";width:" + value + "%'></span>";
|
||||||
return value ? "Yes" : "No";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function CheckmarkFormatter(row, cell, value, columnDef, dataContext) {
|
function YesNoFormatter(row, cell, value, columnDef, dataContext) {
|
||||||
return value ? "<img src='../images/tick.png'>" : "";
|
return value ? "Yes" : "No";
|
||||||
}
|
}
|
||||||
})(jQuery);
|
|
||||||
|
function CheckmarkFormatter(row, cell, value, columnDef, dataContext) {
|
||||||
|
return value ? "<img src='../images/tick.png'>" : "";
|
||||||
|
}
|
||||||
|
})(jQuery);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue