');
this.empty().addClass(a.style.wrapper).append(b), a.width && this.width(a.width), a.border && this.addClass(a.style.border), gj.tree.events.initialized(this)
},
useHtmlDataSource: function(a, b) {
b.dataSource = []
},
render: function(a, b) {
var c;
return b && ("string" == typeof b && JSON && (b = JSON.parse(b)), c = a.data(), c.records = b, c.primaryKey || gj.tree.methods.genAutoId(c, c.records), gj.tree.methods.loadData(a)), a
},
filter: function(a) {
return a.data().dataSource
},
genAutoId: function(a, b) {
var c;
for (c = 0; c < b.length; c++) b[c][a.autoGenFieldName] = a.autoGenId++, b[c][a.childrenField] && b[c][a.childrenField].length && gj.tree.methods.genAutoId(a, b[c][a.childrenField])
},
loadData: function(a) {
var b, c = a.data("records"),
d = a.children("ul");
for (gj.tree.events.dataBinding(a), d.off().empty(), b = 0; b < c.length; b++) gj.tree.methods.appendNode(a, d, c[b], 1);
gj.tree.events.dataBound(a)
},
appendNode: function(a, b, c, d, e) {
var f, g, h, i, j, k = a.data(),
l = k.primaryKey ? c[k.primaryKey] : c[k.autoGenFieldName];
if (g = $('').addClass(k.style.item), $wrapper = $(''), $expander = $('').addClass(k.style.expander), $display = $('' + c[k.textField] + ""), hasChildren = void 0 !== c[k.hasChildrenField] && "true" === c[k.hasChildrenField].toString().toLowerCase(), disabled = void 0 !== c[k.disabledField] && "true" === c[k.disabledField].toString().toLowerCase(), k.indentation && $wrapper.append(''), disabled ? gj.tree.methods.disableNode(a, g) : ($expander.on("click", gj.tree.methods.expanderClickHandler(a)), $display.on("click", gj.tree.methods.displayClickHandler(a))), $wrapper.append($expander), $wrapper.append($display), g.append($wrapper), e ? b.find("li:eq(" + (e - 1) + ")").before(g) : b.append(g), k.imageCssClassField && c[k.imageCssClassField] ? (i = $(''), i.insertBefore($display)) : k.imageUrlField && c[k.imageUrlField] ? (i = $(''), i.insertBefore($display), j = $(''), j.attr("width", i.width()).attr("height", i.height()), i.append(j)) : k.imageHtmlField && c[k.imageHtmlField] && (i = $('' + c[k.imageHtmlField] + ""), i.insertBefore($display)), c[k.childrenField] && c[k.childrenField].length || hasChildren) {
if ($expander.empty().append(k.icons.expand), h = $("
").addClass(k.style.list).addClass("gj-hidden"), g.append(h), c[k.childrenField] && c[k.childrenField].length)
for (f = 0; f < c[k.childrenField].length; f++) gj.tree.methods.appendNode(a, h, c[k.childrenField][f], d + 1)
} else k.style.leafIcon ? $expander.addClass(k.style.leafIcon) : $expander.html(" ");
gj.tree.events.nodeDataBound(a, g, c.id, c)
},
expanderClickHandler: function(a) {
return function(b) {
var c = $(this),
d = c.closest("li");
"close" === c.attr("data-mode") ? a.expand(d) : a.collapse(d)
}
},
expand: function(a, b, c) {
var d, e, f = b.find('>[data-role="wrapper"]>[data-role="expander"]'),
g = a.data(),
h = b.attr("data-id"),
i = b.children("ul");
if (!1 !== gj.tree.events.expand(a, b, h) && i && i.length && (i.show(), f.attr("data-mode", "open"), f.empty().append(g.icons.collapse), c))
for (d = b.find("ul>li"), e = 0; e < d.length; e++) gj.tree.methods.expand(a, $(d[e]), c);
return a
},
collapse: function(a, b, c) {
var d, e, f = b.find('>[data-role="wrapper"]>[data-role="expander"]'),
g = a.data(),
h = b.attr("data-id"),
i = b.children("ul");
if (!1 !== gj.tree.events.collapse(a, b, h) && i && i.length && (i.hide(), f.attr("data-mode", "close"), f.empty().append(g.icons.expand), c))
for (d = b.find("ul>li"), e = 0; e < d.length; e++) gj.tree.methods.collapse(a, $(d[e]), c);
return a
},
expandAll: function(a) {
var b, c = a.find("ul>li");
for (b = 0; b < c.length; b++) gj.tree.methods.expand(a, $(c[b]), !0);
return a
},
collapseAll: function(a) {
var b, c = a.find("ul>li");
for (b = 0; b < c.length; b++) gj.tree.methods.collapse(a, $(c[b]), !0);
return a
},
displayClickHandler: function(a) {
return function(b) {
var c = $(this),
d = c.closest("li"),
e = a.data().cascadeSelection;
"true" === d.attr("data-selected") ? gj.tree.methods.unselect(a, d, e) : ("single" === a.data("selectionType") && gj.tree.methods.unselectAll(a), gj.tree.methods.select(a, d, e))
}
},
selectAll: function(a) {
var b, c = a.find("ul>li");
for (b = 0; b < c.length; b++) gj.tree.methods.select(a, $(c[b]), !0);
return a
},
select: function(a, b, c) {
var d, e, f = a.data();
if ("true" !== b.attr("data-selected") && !1 !== gj.tree.events.select(a, b, b.attr("data-id")) && (b.addClass(f.style.active).attr("data-selected", "true"), c))
for (e = b.find("ul>li"), d = 0; d < e.length; d++) gj.tree.methods.select(a, $(e[d]), c)
},
unselectAll: function(a) {
var b, c = a.find("ul>li");
for (b = 0; b < c.length; b++) gj.tree.methods.unselect(a, $(c[b]), !0);
return a
},
unselect: function(a, b, c) {
var d, e;
a.data();
if ("true" === b.attr("data-selected") && !1 !== gj.tree.events.unselect(a, b, b.attr("data-id")) && (b.removeClass(a.data().style.active).removeAttr("data-selected"), c))
for (e = b.find("ul>li"), d = 0; d < e.length; d++) gj.tree.methods.unselect(a, $(e[d]), c)
},
getSelections: function(a) {
var b, c, d, e = [],
f = a.children("li");
if (f && f.length)
for (b = 0; b < f.length; b++) c = $(f[b]), "true" === c.attr("data-selected") ? e.push(c.attr("data-id")) : c.has("ul") && (d = gj.tree.methods.getSelections(c.children("ul")), d.length && (e = e.concat(d)));
return e
},
getDataById: function(a, b, c) {
var d, e = a.data(),
f = void 0;
for (d = 0; d < c.length; d++) {
if (e.primaryKey && c[d][e.primaryKey] == b) {
f = c[d];
break
}
if (c[d][e.autoGenFieldName] == b) {
f = c[d];
break
}
if (c[d][e.childrenField] && c[d][e.childrenField].length && (f = gj.tree.methods.getDataById(a, b, c[d][e.childrenField]))) break
}
return f
},
getDataByText: function(a, b, c) {
var d, e = void 0,
f = a.data();
for (d = 0; d < c.length; d++) {
if (b === c[d][f.textField]) {
e = c[d];
break
}
if (c[d][f.childrenField] && c[d][f.childrenField].length && (e = gj.tree.methods.getDataByText(a, b, c[d][f.childrenField]))) break
}
return e
},
getNodeById: function(a, b) {
var c, d, e = void 0,
f = a.children("li");
if (f && f.length)
for (c = 0; c < f.length; c++) {
if (d = $(f[c]), b == d.attr("data-id")) {
e = d;
break
}
if (d.has("ul") && (e = gj.tree.methods.getNodeById(d.children("ul"), b))) break
}
return e
},
getNodeByText: function(a, b) {
var c, d, e = void 0,
f = a.children("li");
if (f && f.length)
for (c = 0; c < f.length; c++) {
if (d = $(f[c]), b === d.find('>[data-role="wrapper"]>[data-role="display"]').text()) {
e = d;
break
}
if (d.has("ul") && (e = gj.tree.methods.getNodeByText(d.children("ul"), b))) break
}
return e
},
addNode: function(a, b, c, d) {
var e, f, g = a.data();
return c && c.length ? ("li" === c[0].tagName.toLowerCase() && (0 === c.children("ul").length && (c.find('[data-role="expander"]').empty().append(g.icons.collapse), c.append($("
").addClass(g.style.list))), c = c.children("ul")), f = a.getDataById(c.parent().data("id")), f[g.childrenField] || (f[g.childrenField] = []), f[g.childrenField].push(b)) : (c = a.children("ul"), a.data("records").push(b)), e = c.parentsUntil('[data-type="tree"]', "ul").length + 1, g.primaryKey || gj.tree.methods.genAutoId(g, [b]), gj.tree.methods.appendNode(a, c, b, e, d), a
},
remove: function(a, b) {
return gj.tree.methods.removeDataById(a, b.attr("data-id"), a.data("records")), b.remove(), a
},
removeDataById: function(a, b, c) {
var d, e = a.data();
for (d = 0; d < c.length; d++) {
if (e.primaryKey && c[d][e.primaryKey] == b) {
c.splice(d, 1);
break
}
if (c[d][e.autoGenFieldName] == b) {
c.splice(d, 1);
break
}
c[d][e.childrenField] && c[d][e.childrenField].length && gj.tree.methods.removeDataById(a, b, c[d][e.childrenField])
}
},
update: function(a, b, c) {
var d = a.data(),
e = a.getNodeById(b);
a.getDataById(b);
return c, e.find('>[data-role="wrapper"]>[data-role="display"]').html(c[d.textField]), gj.tree.events.nodeDataBound(a, e, b, c), a
},
getChildren: function(a, b, c) {
var d, e, f = [],
c = void 0 === c || c;
for (e = c ? b.find("ul li") : b.find(">ul>li"), d = 0; d < e.length; d++) f.push($(e[d]).data("id"));
return f
},
enableAll: function(a) {
var b, c = a.find("ul>li");
for (b = 0; b < c.length; b++) gj.tree.methods.enableNode(a, $(c[b]), !0);
return a
},
enableNode: function(a, b, c) {
var d, e, f = b.find('>[data-role="wrapper"]>[data-role="expander"]'),
g = b.find('>[data-role="wrapper"]>[data-role="display"]'),
c = void 0 === c || c;
if (b.removeClass("disabled"), f.on("click", gj.tree.methods.expanderClickHandler(a)), g.on("click", gj.tree.methods.displayClickHandler(a)), gj.tree.events.enable(a, b), c)
for (e = b.find("ul>li"), d = 0; d < e.length; d++) gj.tree.methods.enableNode(a, $(e[d]), c)
},
disableAll: function(a) {
var b, c = a.find("ul>li");
for (b = 0; b < c.length; b++) gj.tree.methods.disableNode(a, $(c[b]), !0);
return a
},
disableNode: function(a, b, c) {
var d, e, f = b.find('>[data-role="wrapper"]>[data-role="expander"]'),
g = b.find('>[data-role="wrapper"]>[data-role="display"]'),
c = void 0 === c || c;
if (b.addClass("disabled"), f.off("click"), g.off("click"), gj.tree.events.disable(a, b), c)
for (e = b.find("ul>li"), d = 0; d < e.length; d++) gj.tree.methods.disableNode(a, $(e[d]), c)
},
destroy: function(a) {
return a.data() && (gj.tree.events.destroying(a), a.xhr && a.xhr.abort(), a.off(), a.removeData(), a.removeAttr("data-type"), a.removeClass().empty()), a
},
pathFinder: function(a, b, c, d) {
var e, f = !1;
for (e = 0; e < b.length; e++) {
if (b[e].id == c) {
f = !0;
break
}
if (gj.tree.methods.pathFinder(a, b[e][a.childrenField], c, d)) {
d.push(b[e].data[a.textField]), f = !0;
break
}
}
return f
}
}, gj.tree.widget = function(a, b) {
var c = this,
d = gj.tree.methods;
return c.reload = function(a) {
return gj.widget.prototype.reload.call(this, a)
}, c.render = function(a) {
return d.render(this, a)
}, c.addNode = function(a, b, c) {
return d.addNode(this, a, b, c)
}, c.removeNode = function(a) {
return d.remove(this, a)
}, c.updateNode = function(a, b) {
return d.update(this, a, b)
}, c.destroy = function() {
return d.destroy(this)
}, c.expand = function(a, b) {
return d.expand(this, a, b)
}, c.collapse = function(a, b) {
return d.collapse(this, a, b)
}, c.expandAll = function() {
return d.expandAll(this)
}, c.collapseAll = function() {
return d.collapseAll(this)
}, c.getDataById = function(a) {
return d.getDataById(this, a, this.data("records"))
}, c.getDataByText = function(a) {
return d.getDataByText(this, a, this.data("records"))
}, c.getNodeById = function(a) {
return d.getNodeById(this.children("ul"), a)
}, c.getNodeByText = function(a) {
return d.getNodeByText(this.children("ul"), a)
}, c.getAll = function() {
return this.data("records")
}, c.select = function(a) {
return d.select(this, a)
}, c.unselect = function(a) {
return d.unselect(this, a)
}, c.selectAll = function() {
return d.selectAll(this)
}, c.unselectAll = function() {
return d.unselectAll(this)
}, c.getSelections = function() {
return d.getSelections(this.children("ul"))
}, c.getChildren = function(a, b) {
return d.getChildren(this, a, b)
}, c.parents = function(a) {
var b = [],
c = this.data();
return d.pathFinder(c, c.records, a, b), b.reverse()
}, c.enable = function(a, b) {
return d.enableNode(this, a, b)
}, c.enableAll = function() {
return d.enableAll(this)
}, c.disable = function(a, b) {
return d.disableNode(this, a, b)
}, c.disableAll = function() {
return d.disableAll(this)
}, $.extend(a, c), "tree" !== a.attr("data-type") && d.init.call(a, b), a
}, gj.tree.widget.prototype = new gj.widget, gj.tree.widget.constructor = gj.tree.widget,
function(a) {
a.fn.tree = function(a) {
var b;
if (this && this.length) {
if ("object" != typeof a && a) {
if (b = new gj.tree.widget(this, null), b[a]) return b[a].apply(this, Array.prototype.slice.call(arguments, 1));
throw "Method " + a + " does not exist."
}
return new gj.tree.widget(this, a)
}
}
}(jQuery), gj.tree.plugins.checkboxes = {
config: {
base: {
checkboxes: void 0,
checkedField: "checked",
cascadeCheck: !0
}
},
private: {
dataBound: function(a) {
var b;
a.data("cascadeCheck") && (b = a.find('li[data-role="node"]'), $.each(b, function() {
var a = $(this),
b = a.find('[data-role="checkbox"] input[type="checkbox"]').checkbox("state");
"checked" === b && (gj.tree.plugins.checkboxes.private.updateChildrenState(a, b), gj.tree.plugins.checkboxes.private.updateParentState(a, b))
}))
},
nodeDataBound: function(a, b, c, d) {
var e, f, g, h, i;
0 === b.find('> [data-role="wrapper"] > [data-role="checkbox"]').length && (e = a.data(), f = b.find('> [data-role="wrapper"] > [data-role="expander"]'), g = $(''), h = $('').append(g), i = void 0 !== d[e.disabledField] && "true" === d[e.disabledField].toString().toLowerCase(), g = g.checkbox({
uiLibrary: e.uiLibrary,
iconsLibrary: e.iconsLibrary,
change: function(c, e) {
gj.tree.plugins.checkboxes.events.checkboxChange(a, b, d, g.state())
}
}), i && g.prop("disabled", !0), d[e.checkedField] && g.state("checked"), g.on("click", function(a) {
var b = g.closest("li"),
c = g.state();
e.cascadeCheck && (gj.tree.plugins.checkboxes.private.updateChildrenState(b, c), gj.tree.plugins.checkboxes.private.updateParentState(b, c))
}), f.after(h))
},
updateParentState: function(a, b) {
var c, d, e, f, g, h;
c = a.parent("ul").parent("li"), 1 === c.length && (d = a.parent("ul").parent("li").find('> [data-role="wrapper"] > [data-role="checkbox"] input[type="checkbox"]'), e = a.siblings().find('> [data-role="wrapper"] > span[data-role="checkbox"] input[type="checkbox"]'), f = "checked" === b, g = "unchecked" === b, h = "indeterminate", $.each(e, function() {
var a = $(this).checkbox("state");
f && "checked" !== a && (f = !1), g && "unchecked" !== a && (g = !1)
}), f && !g && (h = "checked"), !f && g && (h = "unchecked"), d.checkbox("state", h), gj.tree.plugins.checkboxes.private.updateParentState(c, d.checkbox("state")))
},
updateChildrenState: function(a, b) {
var c = a.find('ul li [data-role="wrapper"] [data-role="checkbox"] input[type="checkbox"]');
c.length > 0 && $.each(c, function() {
$(this).checkbox("state", b)
})
},
update: function(a, b, c) {
var d = b.find('[data-role="checkbox"] input[type="checkbox"]').first();
$(d).checkbox("state", c), a.data().cascadeCheck && (gj.tree.plugins.checkboxes.private.updateChildrenState(b, c), gj.tree.plugins.checkboxes.private.updateParentState(b, c))
}
},
public: {
getCheckedNodes: function() {
var a = [],
b = this.find('li [data-role="checkbox"] input[type="checkbox"]');
return $.each(b, function() {
var b = $(this);
"checked" === b.checkbox("state") && a.push(b.closest("li").data("id"))
}), a
},
checkAll: function() {
var a = this.find('li [data-role="checkbox"] input[type="checkbox"]');
return $.each(a, function() {
$(this).checkbox("state", "checked")
}), this
},
uncheckAll: function() {
var a = this.find('li [data-role="checkbox"] input[type="checkbox"]');
return $.each(a, function() {
$(this).checkbox("state", "unchecked")
}), this
},
check: function(a) {
return gj.tree.plugins.checkboxes.private.update(this, a, "checked"), this
},
uncheck: function(a) {
return gj.tree.plugins.checkboxes.private.update(this, a, "unchecked"), this
}
},
events: {
checkboxChange: function(a, b, c, d) {
return a.triggerHandler("checkboxChange", [b, c, d])
}
},
configure: function(a) {
a.data("checkboxes") && gj.checkbox && ($.extend(!0, a, gj.tree.plugins.checkboxes.public), a.on("nodeDataBound", function(b, c, d, e) {
gj.tree.plugins.checkboxes.private.nodeDataBound(a, c, d, e)
}), a.on("dataBound", function() {
gj.tree.plugins.checkboxes.private.dataBound(a)
}), a.on("enable", function(a, b) {
b.find('>[data-role="wrapper"]>[data-role="checkbox"] input[type="checkbox"]').prop("disabled", !1)
}), a.on("disable", function(a, b) {
b.find('>[data-role="wrapper"]>[data-role="checkbox"] input[type="checkbox"]').prop("disabled", !0)
}))
}
}, gj.tree.plugins.dragAndDrop = {
config: {
base: {
dragAndDrop: void 0,
style: {
dragEl: "gj-tree-drag-el gj-tree-md-drag-el",
dropAsChildIcon: "gj-cursor-pointer gj-icon plus",
dropAbove: "gj-tree-drop-above",
dropBelow: "gj-tree-drop-below"
}
},
bootstrap: {
style: {
dragEl: "gj-tree-drag-el gj-tree-bootstrap-drag-el",
dropAsChildIcon: "glyphicon glyphicon-plus",
dropAbove: "drop-above",
dropBelow: "drop-below"
}
},
bootstrap4: {
style: {
dragEl: "gj-tree-drag-el gj-tree-bootstrap-drag-el",
dropAsChildIcon: "gj-cursor-pointer gj-icon plus",
dropAbove: "drop-above",
dropBelow: "drop-below"
}
}
},
private: {
nodeDataBound: function(a, b) {
var c = b.children('[data-role="wrapper"]'),
d = b.find('>[data-role="wrapper"]>[data-role="display"]');
c.length && d.length && (d.on("mousedown", gj.tree.plugins.dragAndDrop.private.createNodeMouseDownHandler(a)), d.on("mousemove", gj.tree.plugins.dragAndDrop.private.createNodeMouseMoveHandler(a, b, d)), d.on("mouseup", gj.tree.plugins.dragAndDrop.private.createNodeMouseUpHandler(a)))
},
createNodeMouseDownHandler: function(a) {
return function(b) {
a.data("dragReady", !0)
}
},
createNodeMouseUpHandler: function(a) {
return function(b) {
a.data("dragReady", !1)
}
},
createNodeMouseMoveHandler: function(a, b, c) {
return function(d) {
if (a.data("dragReady")) {
var e, f, g, h, i = a.data();
a.data("dragReady", !1), e = c.clone().wrap('').closest("div").wrap('').closest("li").wrap('
').closest("ul"), $("body").append(e), e.attr("data-role", "draggable-clone").addClass("gj-unselectable").addClass(i.style.dragEl), e.find('[data-role="wrapper"]').prepend(''), e.draggable({
drag: gj.tree.plugins.dragAndDrop.private.createDragHandler(a, b, c),
stop: gj.tree.plugins.dragAndDrop.private.createDragStopHandler(a, b, c)
}), f = c.parent(), g = c.offset().top, g -= parseInt(f.css("border-top-width")) + parseInt(f.css("margin-top")) + parseInt(f.css("padding-top")), h = c.offset().left, h -= parseInt(f.css("border-left-width")) + parseInt(f.css("margin-left")) + parseInt(f.css("padding-left")), h -= e.find('[data-role="indicator"]').outerWidth(!0), e.css({
position: "absolute",
top: g,
left: h,
width: c.outerWidth(!0)
}), "true" === c.attr("data-droppable") && c.droppable("destroy"), gj.tree.plugins.dragAndDrop.private.getTargetDisplays(a, b, c).each(function() {
var a = $(this);
"true" === a.attr("data-droppable") && a.droppable("destroy"), a.droppable()
}), gj.tree.plugins.dragAndDrop.private.getTargetDisplays(a, b).each(function() {
var a = $(this);
"true" === a.attr("data-droppable") && a.droppable("destroy"), a.droppable()
}), e.trigger("mousedown")
}
}
},
getTargetDisplays: function(a, b, c) {
return a.find('[data-role="display"]').not(c).not(b.find('[data-role="display"]'))
},
getTargetWrappers: function(a, b) {
return a.find('[data-role="wrapper"]').not(b.find('[data-role="wrapper"]'))
},
createDragHandler: function(a, b, c) {
var d = gj.tree.plugins.dragAndDrop.private.getTargetDisplays(a, b, c),
e = gj.tree.plugins.dragAndDrop.private.getTargetWrappers(a, b),
f = a.data();
return function(a, b, c) {
var g = $(this),
h = !1;
d.each(function() {
var a, b = $(this);
if (b.droppable("isOver", c)) return a = g.find('[data-role="indicator"]'), f.style.dropAsChildIcon ? a.addClass(f.style.dropAsChildIcon) : a.text("+"), h = !0, !1;
g.find('[data-role="indicator"]').removeClass(f.style.dropAsChildIcon).empty()
}), e.each(function() {
var a, b = $(this);
!h && b.droppable("isOver", c) ? (a = b.position().top + b.outerHeight() / 2, c.y < a ? b.addClass(f.style.dropAbove).removeClass(f.style.dropBelow) : b.addClass(f.style.dropBelow).removeClass(f.style.dropAbove)) : b.removeClass(f.style.dropAbove).removeClass(f.style.dropBelow)
})
}
},
createDragStopHandler: function(a, b, c) {
var d = gj.tree.plugins.dragAndDrop.private.getTargetDisplays(a, b, c),
e = gj.tree.plugins.dragAndDrop.private.getTargetWrappers(a, b),
f = a.data();
return function(c, g) {
var h, i, j, k, l = !1;
$(this).draggable("destroy").remove(), d.each(function() {
var c, d = $(this);
if (d.droppable("isOver", g)) return i = d.closest("li"), j = b.parent("ul").parent("li"), c = i.children("ul"), 0 === c.length && (c = $("
").addClass(f.style.list), i.append(c)), !1 !== gj.tree.plugins.dragAndDrop.events.nodeDrop(a, b.data("id"), i.data("id"), c.children("li").length + 1) && (c.append(b), h = a.getDataById(b.data("id")), gj.tree.methods.removeDataById(a, b.data("id"), f.records), k = a.getDataById(c.parent().data("id")), void 0 === k[f.childrenField] && (k[f.childrenField] = []), k[f.childrenField].push(h), gj.tree.plugins.dragAndDrop.private.refresh(a, b, i, j)), l = !0, !1;
d.droppable("destroy")
}), l || e.each(function() {
var c, d, e, k = $(this);
if (k.droppable("isOver", g)) return i = k.closest("li"), j = b.parent("ul").parent("li"), c = g.y < k.position().top + k.outerHeight() / 2, e = b.data("id"), d = i.prevAll('li:not([data-id="' + e + '"])').length + (c ? 1 : 2), !1 !== gj.tree.plugins.dragAndDrop.events.nodeDrop(a, e, i.parent("ul").parent("li").data("id"), d) && (h = a.getDataById(b.data("id")), gj.tree.methods.removeDataById(a, b.data("id"), f.records), a.getDataById(i.parent().data("id"))[f.childrenField].splice(i.index() + (c ? 0 : 1), 0, h), c ? b.insertBefore(i) : b.insertAfter(i), gj.tree.plugins.dragAndDrop.private.refresh(a, b, i, j)), !1;
k.droppable("destroy")
})
}
},
refresh: function(a, b, c, d) {
var e = a.data();
gj.tree.plugins.dragAndDrop.private.refreshNode(a, c), gj.tree.plugins.dragAndDrop.private.refreshNode(a, d), gj.tree.plugins.dragAndDrop.private.refreshNode(a, b), b.find('li[data-role="node"]').each(function() {
gj.tree.plugins.dragAndDrop.private.refreshNode(a, $(this))
}), c.children('[data-role="wrapper"]').removeClass(e.style.dropAbove).removeClass(e.style.dropBelow)
},
refreshNode: function(a, b) {
var c = b.children('[data-role="wrapper"]'),
d = c.children('[data-role="expander"]'),
e = c.children('[data-role="spacer"]'),
f = b.children("ul"),
g = a.data(),
h = b.parentsUntil('[data-type="tree"]', "ul").length;
f.length && f.children().length ? f.is(":visible") ? d.empty().append(g.icons.collapse) : d.empty().append(g.icons.expand) : d.empty(), c.removeClass(g.style.dropAbove).removeClass(g.style.dropBelow), e.css("width", g.indentation * (h - 1))
}
},
public: {},
events: {
nodeDrop: function(a, b, c, d) {
return a.triggerHandler("nodeDrop", [b, c, d])
}
},
configure: function(a) {
$.extend(!0, a, gj.tree.plugins.dragAndDrop.public), a.data("dragAndDrop") && gj.draggable && gj.droppable && a.on("nodeDataBound", function(b, c) {
gj.tree.plugins.dragAndDrop.private.nodeDataBound(a, c)
})
}
}, gj.tree.plugins.lazyLoading = {
config: {
base: {
paramNames: {
parentId: "parentId"
},
lazyLoading: !1
}
},
private: {
nodeDataBound: function(a, b, c, d) {
var e = a.data(),
f = b.find('> [data-role="wrapper"] > [data-role="expander"]');
d.hasChildren && f.empty().append(e.icons.expand)
},
createDoneHandler: function(a, b) {
return function(c) {
var d, e, f, g = a.data();
if ("string" == typeof c && JSON && (c = JSON.parse(c)), c && c.length) {
for (f = b.children("ul"), 0 === f.length && (f = $("
").addClass(g.style.list), b.append(f)), d = 0; d < c.length; d++) a.addNode(c[d], f);
e = b.find('>[data-role="wrapper"]>[data-role="expander"]'), e.attr("data-mode", "open"), e.empty().append(g.icons.collapse), gj.tree.events.dataBound(a)
}
}
},
expand: function(a, b, c) {
var d, e = a.data(),
f = {},
g = b.find(">ul>li");
g && g.length || "string" == typeof e.dataSource && (f[e.paramNames.parentId] = c, d = {
url: e.dataSource,
data: f
}, a.xhr && a.xhr.abort(), a.xhr = $.ajax(d).done(gj.tree.plugins.lazyLoading.private.createDoneHandler(a, b)).fail(a.createErrorHandler()))
}
},
public: {},
events: {},
configure: function(a, b, c) {
c.lazyLoading && (a.on("nodeDataBound", function(b, c, d, e) {
gj.tree.plugins.lazyLoading.private.nodeDataBound(a, c, d, e)
}), a.on("expand", function(b, c, d) {
gj.tree.plugins.lazyLoading.private.expand(a, c, d)
}))
}
}, gj.checkbox = {
plugins: {}
}, gj.checkbox.config = {
base: {
uiLibrary: "materialdesign",
iconsLibrary: "materialicons",
style: {
wrapperCssClass: "gj-checkbox-md",
spanCssClass: void 0
}
},
bootstrap: {
style: {
wrapperCssClass: "gj-checkbox-bootstrap"
},
iconsLibrary: "glyphicons"
},
bootstrap4: {
style: {
wrapperCssClass: "gj-checkbox-bootstrap gj-checkbox-bootstrap-4"
},
iconsLibrary: "materialicons"
},
materialicons: {
style: {
iconsCssClass: "gj-checkbox-material-icons",
spanCssClass: "gj-icon"
}
},
glyphicons: {
style: {
iconsCssClass: "gj-checkbox-glyphicons",
spanCssClass: ""
}
},
fontawesome: {
style: {
iconsCssClass: "gj-checkbox-fontawesome",
spanCssClass: "fa"
}
}
}, gj.checkbox.methods = {
init: function(a) {
var b = this;
return gj.widget.prototype.init.call(this, a, "checkbox"), b.attr("data-checkbox", "true"), gj.checkbox.methods.initialize(b), b
},
initialize: function(a) {
var b, c, d = a.data();
d.style.wrapperCssClass && (b = $(''), a.attr("id") && b.attr("for", a.attr("id")), a.wrap(b), c = $(""), d.style.spanCssClass && c.addClass(d.style.spanCssClass), a.parent().append(c))
},
state: function(a, b) {
return b ? ("checked" === b ? (a.prop("indeterminate", !1), a.prop("checked", !0)) : "unchecked" === b ? (a.prop("indeterminate", !1), a.prop("checked", !1)) : "indeterminate" === b && (a.prop("checked", !0), a.prop("indeterminate", !0)), gj.checkbox.events.change(a, b), a) : b = a.prop("indeterminate") ? "indeterminate" : a.prop("checked") ? "checked" : "unchecked"
},
toggle: function(a) {
return "checked" == a.state() ? a.state("unchecked") : a.state("checked"), a
},
destroy: function(a) {
return "true" === a.attr("data-checkbox") && (a.removeData(), a.removeAttr("data-guid"), a.removeAttr("data-checkbox"), a.off(), a.next("span").remove(), a.unwrap()), a
}
}, gj.checkbox.events = {
change: function(a, b) {
return a.triggerHandler("change", [b])
}
}, gj.checkbox.widget = function(a, b) {
var c = this,
d = gj.checkbox.methods;
return c.toggle = function() {
return d.toggle(this)
}, c.state = function(a) {
return d.state(this, a)
}, c.destroy = function() {
return d.destroy(this)
}, $.extend(a, c), "true" !== a.attr("data-checkbox") && d.init.call(a, b), a
}, gj.checkbox.widget.prototype = new gj.widget, gj.checkbox.widget.constructor = gj.checkbox.widget,
function(a) {
a.fn.checkbox = function(a) {
var b;
if (this && this.length) {
if ("object" != typeof a && a) {
if (b = new gj.checkbox.widget(this, null), b[a]) return b[a].apply(this, Array.prototype.slice.call(arguments, 1));
throw "Method " + a + " does not exist."
}
return new gj.checkbox.widget(this, a)
}
}
}(jQuery), gj.editor = {
plugins: {},
messages: {}
}, gj.editor.config = {
base: {
height: 300,
width: void 0,
uiLibrary: "materialdesign",
iconsLibrary: "materialicons",
locale: "en-us",
buttons: void 0,
style: {
wrapper: "gj-editor gj-editor-md",
buttonsGroup: "gj-button-md-group",
button: "gj-button-md",
buttonActive: "active"
}
},
bootstrap: {
style: {
wrapper: "gj-editor gj-editor-bootstrap",
buttonsGroup: "btn-group",
button: "btn btn-default gj-cursor-pointer",
buttonActive: "active"
}
},
bootstrap4: {
style: {
wrapper: "gj-editor gj-editor-bootstrap",
buttonsGroup: "btn-group",
button: "btn btn-outline-secondary gj-cursor-pointer",
buttonActive: "active"
}
},
materialicons: {
icons: {
bold: '',
italic: '',
strikethrough: '',
underline: '',
listBulleted: '',
listNumbered: '',
indentDecrease: '',
indentIncrease: '',
alignLeft: '',
alignCenter: '',
alignRight: '',
alignJustify: '',
undo: '',
redo: ''
}
},
fontawesome: {
icons: {
bold: '',
italic: '',
strikethrough: '',
underline: '',
listBulleted: '',
listNumbered: '',
indentDecrease: '',
indentIncrease: '',
alignLeft: '',
alignCenter: '',
alignRight: '',
alignJustify: '',
undo: '',
redo: ''
}
}
}, gj.editor.methods = {
init: function(a) {
return gj.widget.prototype.init.call(this, a, "editor"), this.attr("data-editor", "true"), gj.editor.methods.initialize(this), this
},
initialize: function(a) {
var b, c, d, e, f, g = this,
h = a.data();
if (a.hide(), "wrapper" !== a[0].parentElement.attributes.role && (d = document.createElement("div"), d.setAttribute("role", "wrapper"), a[0].parentNode.insertBefore(d, a[0]), d.appendChild(a[0])), gj.editor.methods.localization(h), $(d).addClass(h.style.wrapper), h.width && $(d).width(h.width), e = $(d).children('div[role="body"]'), 0 === e.length && (e = $(''), $(d).append(e), a[0].innerText && (e[0].innerHTML = a[0].innerText)), e.attr("contenteditable", !0), e.on("keydown", function(b) {
var c = event.keyCode || event.charCode;
!1 === gj.editor.events.changing(a) && 8 !== c && 46 !== c && b.preventDefault()
}), e.on("mouseup keyup mouseout cut paste", function(b) {
g.updateToolbar(a, f), gj.editor.events.changed(a), a.html(e.html())
}), f = $(d).children('div[role="toolbar"]'), 0 === f.length) {
f = $(''), e.before(f);
for (var i in h.buttons) {
b = $("").addClass(h.style.buttonsGroup);
for (var j in h.buttons[i]) c = $(h.buttons[i][j]), c.on("click", function() {
gj.editor.methods.executeCmd(a, e, f, $(this))
}), b.append(c);
f.append(b)
}
}
e.height(h.height - gj.core.height(f[0], !0))
},
localization: function(a) {
var b = gj.editor.messages[a.locale];
void 0 === a.buttons && (a.buttons = [
['", '", '", '"],
['", '", '", '"],
['", '", '", '"],
['", '"]
])
},
updateToolbar: function(a, b) {
var c = a.data();
$buttons = b.find("[role]").each(function() {
var a = $(this),
b = a.attr("role");
b && document.queryCommandEnabled(b) && "true" === document.queryCommandValue(b) ? a.addClass(c.style.buttonActive) : a.removeClass(c.style.buttonActive)
})
},
executeCmd: function(a, b, c, d) {
b.focus(), document.execCommand(d.attr("role"), !1), gj.editor.methods.updateToolbar(a, c)
},
content: function(a, b) {
var c = a.parent().children('div[role="body"]');
return void 0 === b ? c.html() : c.html(b)
},
destroy: function(a) {
var b;
return "true" === a.attr("data-editor") && (b = a.parent(), b.children('div[role="body"]').remove(), b.children('div[role="toolbar"]').remove(), a.unwrap(), a.removeData(), a.removeAttr("data-guid"), a.removeAttr("data-editor"), a.off(), a.show()), a
}
}, gj.editor.events = {
changing: function(a) {
return a.triggerHandler("changing")
},
changed: function(a) {
return a.triggerHandler("changed")
}
}, gj.editor.widget = function(a, b) {
var c = this,
d = gj.editor.methods;
return c.content = function(a) {
return d.content(this, a)
}, c.destroy = function() {
return d.destroy(this)
}, $.extend(a, c), "true" !== a.attr("data-editor") && d.init.call(a, b), a
}, gj.editor.widget.prototype = new gj.widget, gj.editor.widget.constructor = gj.editor.widget,
function(a) {
a.fn.editor = function(a) {
var b;
if (this && this.length) {
if ("object" != typeof a && a) {
if (b = new gj.editor.widget(this, null), b[a]) return b[a].apply(this, Array.prototype.slice.call(arguments, 1));
throw "Method " + a + " does not exist."
}
return new gj.editor.widget(this, a)
}
}
}(jQuery), gj.editor.messages["en-us"] = {
bold: "Bold",
italic: "Italic",
strikethrough: "Strikethrough",
underline: "Underline",
listBulleted: "List Bulleted",
listNumbered: "List Numbered",
indentDecrease: "Indent Decrease",
indentIncrease: "Indent Increase",
alignLeft: "Align Left",
alignCenter: "Align Center",
alignRight: "Align Right",
alignJustify: "Align Justify",
undo: "Undo",
redo: "Redo"
}, gj.dropdown = {
plugins: {}
}, gj.dropdown.config = {
base: {
dataSource: void 0,
textField: "text",
valueField: "value",
selectedField: "selected",
width: void 0,
maxHeight: "auto",
placeholder: void 0,
fontSize: void 0,
uiLibrary: "materialdesign",
iconsLibrary: "materialicons",
icons: {
dropdown: '',
dropup: ''
},
style: {
wrapper: "gj-dropdown gj-dropdown-md gj-unselectable",
list: "gj-list gj-list-md gj-dropdown-list-md",
active: "gj-list-md-active"
}
},
bootstrap: {
style: {
wrapper: "gj-dropdown gj-dropdown-bootstrap gj-dropdown-bootstrap-3 gj-unselectable",
presenter: "btn btn-default",
list: "gj-list gj-list-bootstrap gj-dropdown-list-bootstrap list-group",
item: "list-group-item",
active: "active"
},
iconsLibrary: "glyphicons"
},
bootstrap4: {
style: {
wrapper: "gj-dropdown gj-dropdown-bootstrap gj-dropdown-bootstrap-4 gj-unselectable",
presenter: "btn btn-outline-secondary",
list: "gj-list gj-list-bootstrap gj-dropdown-list-bootstrap list-group",
item: "list-group-item",
active: "active"
}
},
materialicons: {
style: {
expander: "gj-dropdown-expander-mi"
}
},
fontawesome: {
icons: {
dropdown: '',
dropup: ''
},
style: {
expander: "gj-dropdown-expander-fa"
}
},
glyphicons: {
icons: {
dropdown: '',
dropup: ''
},
style: {
expander: "gj-dropdown-expander-glyphicons"
}
}
}, gj.dropdown.methods = {
init: function(a) {
return gj.widget.prototype.init.call(this, a, "dropdown"), this.attr("data-dropdown", "true"), gj.dropdown.methods.initialize(this), this
},
getHTMLConfig: function() {
var a = gj.widget.prototype.getHTMLConfig.call(this),
b = this[0].attributes;
return b.placeholder && (a.placeholder = b.placeholder.value), a
},
initialize: function(a) {
var b = a.data(),
c = a.parent('div[role="wrapper"]'),
d = $(''),
e = $('' + b.icons.dropdown + "").addClass(b.style.expander),
f = $('').addClass(b.style.presenter),
g = $('
').attr("guid", a.attr("data-guid"));
0 === c.length ? (c = $('').addClass(b.style.wrapper), a.wrap(c)) : c.addClass(b.style.wrapper), b.fontSize && f.css("font-size", b.fontSize), f.on("click", function(b) {
g.is(":visible") ? gj.dropdown.methods.close(a, g) : gj.dropdown.methods.open(a, g)
}), f.on("blur", function(b) {
setTimeout(function() {
gj.dropdown.methods.close(a, g)
}, 500)
}), f.append(d).append(e), a.hide(), a.after(f), $("body").append(g), g.hide(), a.reload()
},
setListPosition: function(a, b, c) {
var d, e, f, g, h = a.getBoundingClientRect(),
i = window.scrollY || window.pageYOffset || 0;
window.scrollX || window.pageXOffset;
b.style.overflow = "", b.style.overflowX = "", b.style.height = "", gj.core.setChildPosition(a, b), d = gj.core.height(b, !0), g = b.getBoundingClientRect(), e = gj.core.height(a, !0), "auto" === c.maxHeight ? h.top < g.top ? h.top + d + e > window.innerHeight && (f = window.innerHeight - h.top - e - 3) : h.top - d - 3 > 0 ? b.style.top = Math.round(h.top + i - d - 3) + "px" : (b.style.top = i + "px", f = h.top - 3) : !isNaN(c.maxHeight) && c.maxHeight < d && (f = c.maxHeight), f && (b.style.overflow = "scroll", b.style.overflowX = "hidden", b.style.height = f + "px")
},
useHtmlDataSource: function(a, b) {
var c, d, e = [],
f = a.find("option");
for (c = 0; c < f.length; c++) d = {}, d[b.valueField] = f[c].value, d[b.textField] = f[c].innerHTML, d[b.selectedField] = a[0].value === f[c].value, e.push(d);
b.dataSource = e
},
filter: function(a) {
var b, c, d = a.data();
if (d.dataSource) {
if ("string" == typeof d.dataSource[0])
for (b = 0; b < d.dataSource.length; b++) c = {}, c[d.valueField] = d.dataSource[b], c[d.textField] = d.dataSource[b], d.dataSource[b] = c
} else d.dataSource = [];
return d.dataSource
},
render: function(a, b) {
var c = [],
d = a.data(),
e = a.parent(),
f = $("body").children('[role="list"][guid="' + a.attr("data-guid") + '"]'),
g = e.children('[role="presenter"]'),
h = (g.children('[role="expander"]'), g.children('[role="display"]'));
if (a.data("records", b), a.empty(), f.empty(), b && b.length)
if ($.each(b, function() {
var b, e = this[d.valueField],
g = this[d.textField],
h = this[d.selectedField] && "true" === this[d.selectedField].toString().toLowerCase();
b = $('
' + g + "
"), b.addClass(d.style.item), b.on("click", function(b) {
gj.dropdown.methods.select(a, e)
}), f.append(b), a.append('"), h && c.push(e)
}), 0 === c.length) a.prepend(''), a[0].selectedIndex = 0, d.placeholder && (h[0].innerHTML = '' + d.placeholder + "");
else
for (i = 0; i < c.length; i++) gj.dropdown.methods.select(a, c[i]);
return d.width && (e.css("width", d.width), g.css("width", d.width)), d.fontSize && f.children("li").css("font-size", d.fontSize), gj.dropdown.events.dataBound(a), a
},
open: function(a, b) {
var c = a.data(),
d = a.parent().find('[role="expander"]'),
e = a.parent().find('[role="presenter"]'),
f = gj.core.getScrollParent(a[0]);
b.css("width", gj.core.width(e[0])), b.show(), gj.dropdown.methods.setListPosition(e[0], b[0], c), d.html(c.icons.dropup), f && (c.parentScrollHandler = function() {
gj.dropdown.methods.setListPosition(e[0], b[0], c)
}, gj.dropdown.methods.addParentsScrollListener(f, c.parentScrollHandler))
},
close: function(a, b) {
var c = a.data(),
d = a.parent().find('[role="expander"]'),
e = gj.core.getScrollParent(a[0]);
d.html(c.icons.dropdown), e && c.parentScrollHandler && gj.dropdown.methods.removeParentsScrollListener(e, c.parentScrollHandler), b.hide()
},
addParentsScrollListener: function(a, b) {
var c = gj.core.getScrollParent(a.parentNode);
a.addEventListener("scroll", b), c && gj.dropdown.methods.addParentsScrollListener(c, b)
},
removeParentsScrollListener: function(a, b) {
var c = gj.core.getScrollParent(a.parentNode);
a.removeEventListener("scroll", b), c && gj.dropdown.methods.removeParentsScrollListener(c, b)
},
select: function(a, b) {
var c = a.data(),
d = $("body").children('[role="list"][guid="' + a.attr("data-guid") + '"]'),
e = d.children('li[value="' + b + '"]'),
f = a.next('[role="presenter"]').find('[role="display"]'),
g = gj.dropdown.methods.getRecordByValue(a, b);
return d.children("li").removeClass(c.style.active), g ? (e.addClass(c.style.active), a[0].value = b, f[0].innerHTML = g[c.textField]) : (c.placeholder && (f[0].innerHTML = '' + c.placeholder + ""), a[0].value = ""), gj.dropdown.events.change(a), gj.dropdown.methods.close(a, d), a
},
getRecordByValue: function(a, b) {
var c, d = a.data(),
e = void 0;
for (c = 0; c < d.records.length; c++)
if (d.records[c][d.valueField] === b) {
e = d.records[c];
break
} return e
},
value: function(a, b) {
return void 0 === b ? a.val() : (gj.dropdown.methods.select(a, b), a)
},
destroy: function(a) {
var b = a.data(),
c = a.parent('div[role="wrapper"]');
return b && (a.xhr && a.xhr.abort(), a.off(), a.removeData(), a.removeAttr("data-type").removeAttr("data-guid").removeAttr("data-dropdown"), a.removeClass(), c.length > 0 && (c.children('[role="presenter"]').remove(), c.children('[role="list"]').remove(), a.unwrap()), a.show()), a
}
}, gj.dropdown.events = {
change: function(a) {
return a.triggerHandler("change")
},
dataBound: function(a) {
return a.triggerHandler("dataBound")
}
}, gj.dropdown.widget = function(a, b) {
var c = this,
d = gj.dropdown.methods;
return c.value = function(a) {
return d.value(this, a)
}, c.enable = function() {
return d.enable(this)
}, c.disable = function() {
return d.disable(this)
}, c.destroy = function() {
return d.destroy(this)
}, $.extend(a, c), "true" !== a.attr("data-dropdown") && d.init.call(a, b), a
}, gj.dropdown.widget.prototype = new gj.widget, gj.dropdown.widget.constructor = gj.dropdown.widget, gj.dropdown.widget.prototype.getHTMLConfig = gj.dropdown.methods.getHTMLConfig,
function(a) {
a.fn.dropdown = function(a) {
var b;
if (this && this.length) {
if ("object" != typeof a && a) {
if (b = new gj.dropdown.widget(this, null), b[a]) return b[a].apply(this, Array.prototype.slice.call(arguments, 1));
throw "Method " + a + " does not exist."
}
return new gj.dropdown.widget(this, a)
}
}
}(jQuery), gj.datepicker = {
plugins: {}
}, gj.datepicker.config = {
base: {
showOtherMonths: !1,
selectOtherMonths: !0,
width: void 0,
minDate: void 0,
maxDate: void 0,
format: "mm/dd/yyyy",
uiLibrary: "materialdesign",
iconsLibrary: "materialicons",
value: void 0,
weekStartDay: 0,
disableDates: void 0,
disableDaysOfWeek: void 0,
calendarWeeks: !1,
keyboardNavigation: !0,
locale: "en-us",
icons: {
rightIcon: 'event',
previousMonth: '',
nextMonth: ''
},
fontSize: void 0,
size: "default",
modal: !1,
header: !1,
footer: !1,
showOnFocus: !0,
showRightIcon: !0,
style: {
modal: "gj-modal",
wrapper: "gj-datepicker gj-datepicker-md gj-unselectable",
input: "gj-textbox-md",
calendar: "gj-picker gj-picker-md datepicker gj-unselectable",
footer: "",
button: "gj-button-md"
}
},
bootstrap: {
style: {
wrapper: "gj-datepicker gj-datepicker-bootstrap gj-unselectable input-group",
input: "form-control",
calendar: "gj-picker gj-picker-bootstrap datepicker gj-unselectable",
footer: "modal-footer",
button: "btn btn-default"
},
iconsLibrary: "glyphicons",
showOtherMonths: !0
},
bootstrap4: {
style: {
wrapper: "gj-datepicker gj-datepicker-bootstrap gj-unselectable input-group",
input: "form-control",
calendar: "gj-picker gj-picker-bootstrap datepicker gj-unselectable",
footer: "modal-footer",
button: "btn btn-default"
},
showOtherMonths: !0
},
fontawesome: {
icons: {
rightIcon: '',
previousMonth: '',
nextMonth: ''
}
},
glyphicons: {
icons: {
rightIcon: '',
previousMonth: '',
nextMonth: ''
}
}
}, gj.datepicker.methods = {
init: function(a) {
return gj.widget.prototype.init.call(this, a, "datepicker"), this.attr("data-datepicker", "true"), gj.datepicker.methods.initialize(this, this.data()), this
},
initialize: function(a, b) {
var c, d, e = a.parent('div[role="wrapper"]');
0 === e.length ? (e = $('').addClass(b.style.wrapper), a.wrap(e)) : e.addClass(b.style.wrapper), e = a.parent('div[role="wrapper"]'), b.width && e.css("width", b.width), a.val(b.value).addClass(b.style.input).attr("role", "input"), b.fontSize && a.css("font-size", b.fontSize), "bootstrap" === b.uiLibrary || "bootstrap4" === b.uiLibrary ? "small" === b.size ? (e.addClass("input-group-sm"), a.addClass("form-control-sm")) : "large" === b.size && (e.addClass("input-group-lg"), a.addClass("form-control-lg")) : "small" === b.size ? e.addClass("small") : "large" === b.size && e.addClass("large"), b.showRightIcon && (d = "bootstrap" === b.uiLibrary ? $('' + b.icons.rightIcon + "") : "bootstrap4" === b.uiLibrary ? $('") : $(b.icons.rightIcon), d.attr("role", "right-icon"), d.on("click", function(c) {
$("body").find('[role="calendar"][guid="' + a.attr("data-guid") + '"]').is(":visible") ? gj.datepicker.methods.close(a) : gj.datepicker.methods.open(a, b)
}), e.append(d)), b.showOnFocus && a.on("focus", function() {
gj.datepicker.methods.open(a, b)
}), c = gj.datepicker.methods.createCalendar(a, b), !0 !== b.footer && (a.on("blur", function() {
a.timeout = setTimeout(function() {
gj.datepicker.methods.close(a)
}, 500)
}), c.mousedown(function() {
return clearTimeout(a.timeout), document.activeElement !== a[0] && a.focus(), !1
}), c.on("click", function() {
clearTimeout(a.timeout), document.activeElement !== a[0] && a.focus()
})), b.keyboardNavigation && $(document).on("keydown", gj.datepicker.methods.createKeyDownHandler(a, c, b))
},
createCalendar: function(a, b) {
var c, d, e, f, g, h = $('').addClass(b.style.calendar).attr("guid", a.attr("data-guid"));
return b.fontSize && h.css("font-size", b.fontSize), c = gj.core.parseDate(b.value, b.format, b.locale), !c || isNaN(c.getTime()) ? c = new Date : a.attr("day", c.getFullYear() + "-" + c.getMonth() + "-" + c.getDate()), h.attr("month", c.getMonth()), h.attr("year", c.getFullYear()), gj.datepicker.methods.renderHeader(a, h, b, c), d = $(''), h.append(d), b.footer && (e = $(''), f = $('"), f.on("click", function() {
a.close()
}), e.append(f), g = $('"), g.on("click", function() {
var c, d, e = h.attr("selectedDay");
e ? (d = e.split("-"), c = new Date(d[0], d[1], d[2], h.attr("hour") || 0, h.attr("minute") || 0), gj.datepicker.methods.change(a, h, b, c)) : a.close()
}), e.append(g), h.append(e)), h.hide(), $("body").append(h), b.modal && (h.wrapAll(''), gj.core.center(h)), h
},
renderHeader: function(a, b, c, d) {
var e, f, g;
c.header && (e = $(''), g = $('').on("click", function() {
gj.datepicker.methods.renderDecade(a, b, c), g.addClass("selected"), f.removeClass("selected")
}), g.html(gj.core.formatDate(d, "yyyy", c.locale)), e.append(g), f = $('').on("click", function() {
gj.datepicker.methods.renderMonth(a, b, c), f.addClass("selected"), g.removeClass("selected")
}), f.html(gj.core.formatDate(d, "ddd, mmm dd", c.locale)), e.append(f), b.append(e))
},
updateHeader: function(a, b, c) {
a.find('[role="header"] [role="year"]').removeClass("selected").html(gj.core.formatDate(c, "yyyy", b.locale)), a.find('[role="header"] [role="date"]').addClass("selected").html(gj.core.formatDate(c, "ddd, mmm dd", b.locale)), a.find('[role="header"] [role="hour"]').removeClass("selected").html(gj.core.formatDate(c, "HH", b.locale)), a.find('[role="header"] [role="minute"]').removeClass("selected").html(gj.core.formatDate(c, "MM", b.locale))
},
createNavigation: function(a, b, c, d) {
var e, f, g = $("");
for (f = $(''), f.append($("
").on("click", gj.datepicker.methods.next(a, d))), b.append(f), e = $('
'), d.calendarWeeks && e.append("
"), i = d.weekStartDay; i < gj.core.messages[d.locale].weekDaysMin.length; i++) e.append("
" + gj.core.messages[d.locale].weekDaysMin[i] + "
");
for (i = 0; i < d.weekStartDay; i++) e.append("
" + gj.core.messages[d.locale].weekDaysMin[i] + "
");
g.append(e), c.append(g)
},
renderMonth: function(a, b, c) {
var d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s = b.children('[role="body"]'),
t = $("
"),
u = $(""),
v = gj.core.messages[c.locale].titleFormat;
for (s.off().empty(), gj.datepicker.methods.createNavigation(a, s, t, c), g = parseInt(b.attr("month"), 10), h = parseInt(b.attr("year"), 10), b.attr("type", "month"), v = v.replace("mmmm", gj.core.messages[c.locale].monthNames[g]).replace("yyyy", h), b.find('div[role="period"]').text(v), i = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31), h % 4 == 0 && 1900 != h && (i[1] = 29), j = i[g], k = (new Date(h, g, 1).getDay() + 7 - c.weekStartDay) % 7, d = 0, $row = $("
"), n = gj.datepicker.methods.getPrevMonth(g, h), l = 1; l <= k; l++) f = i[n.month] - k + l, r = new Date(n.year, n.month, f), c.calendarWeeks && 1 === l && $row.append('
' + gj.datepicker.methods.getWeekNumber(r) + "
"), p = $('
'), c.showOtherMonths && (q = $("
" + f + "
"), p.append(q), c.selectOtherMonths && gj.datepicker.methods.isSelectable(c, r) ? (p.addClass("gj-cursor-pointer").attr("day", f).attr("month", n.month).attr("year", n.year), q.on("click", gj.datepicker.methods.dayClickHandler(a, b, c, r)), q.on("mousedown", function(a) {
a.stopPropagation()
})) : p.addClass("disabled")), $row.append(p), d++;
for (l > 1 && u.append($row), m = new Date, l = 1; l <= j; l++) r = new Date(h, g, l), 0 == d && ($row = $("
"), c.calendarWeeks && $row.append('
' + gj.datepicker.methods.getWeekNumber(r) + "
")), p = $('
'), h === m.getFullYear() && g === m.getMonth() && l === m.getDate() ? p.addClass("today") : p.addClass("current-month"), q = $("
" + l + "
"), gj.datepicker.methods.isSelectable(c, r) ? (p.addClass("gj-cursor-pointer"), q.on("click", gj.datepicker.methods.dayClickHandler(a, b, c, r)), q.on("mousedown", function(a) {
a.stopPropagation()
})) : p.addClass("disabled"), p.append(q), $row.append(p), 7 == ++d && (u.append($row), d = 0);
for (o = gj.datepicker.methods.getNextMonth(g, h), l = 1; 0 != d; l++) r = new Date(o.year, o.month, l), p = $('
'), c.showOtherMonths && (q = $("
" + l + "
"), c.selectOtherMonths && gj.datepicker.methods.isSelectable(c, r) ? (p.addClass("gj-cursor-pointer").attr("day", l).attr("month", o.month).attr("year", o.year), q.on("click", gj.datepicker.methods.dayClickHandler(a, b, c, r)), q.on("mousedown", function(a) {
a.stopPropagation()
})) : p.addClass("disabled"), p.append(q)), $row.append(p), 7 == ++d && (u.append($row), d = 0);
t.append(u), s.append(t), b.attr("selectedDay") && (e = b.attr("selectedDay").split("-"), r = new Date(e[0], e[1], e[2], b.attr("hour") || 0, b.attr("minute") || 0), b.find('tbody td[day="' + e[2] + '"][month="' + e[1] + '"]').addClass("selected"), gj.datepicker.methods.updateHeader(b, c, r))
},
renderYear: function(a, b, c) {
var d, e, f, g, h = b.find('>[role="body"]>table'),
i = h.children("tbody");
for (h.children("thead").hide(), d = parseInt(b.attr("year"), 10), b.attr("type", "year"), b.find('div[role="period"]').text(d), i.empty(), e = 0; e < 3; e++) {
for ($row = $("
").append(g), $row.append($cell);
i.append($row)
}
},
renderDecade: function(a, b, c) {
var d, e, f, g, h, i = b.find('>[role="body"]>table'),
j = i.children("tbody");
for (i.children("thead").hide(), d = parseInt(b.attr("year"), 10), e = d - d % 10, b.attr("type", "decade"), b.find('div[role="period"]').text(e + " - " + (e + 9)), j.empty(), f = e - 1; f <= e + 10; f += 4) {
for ($row = $("
").append(h), $row.append($cell);
j.append($row)
}
},
renderCentury: function(a, b, c) {
var d, e, f, g, h, i = b.find('>[role="body"]>table'),
j = i.children("tbody");
for (i.children("thead").hide(), d = parseInt(b.attr("year"), 10), e = d - d % 100, b.attr("type", "century"), b.find('div[role="period"]').text(e + " - " + (e + 99)), j.empty(), f = e - 10; f < e + 100; f += 40) {
for ($row = $("