From ad0f22531be49b76c97d8ffc76af5d2db8d9a570 Mon Sep 17 00:00:00 2001 From: Niko Date: Tue, 14 Jan 2014 13:44:42 +0100 Subject: [PATCH] update to 1.1.2 --- README.md | 6 +- dist/jquery.jsForm-1.1.2.js | 2827 +++++++++++++++++++++++++++++++ dist/jquery.jsForm.1.1.2.min.js | 6 + dist/jquery.jsForm.min.map | 2 +- jsForm.jquery.json | 2 +- package.json | 2 +- src/jquery.jsForm.js | 4 +- 7 files changed, 2841 insertions(+), 8 deletions(-) create mode 100644 dist/jquery.jsForm-1.1.2.js create mode 100644 dist/jquery.jsForm.1.1.2.min.js diff --git a/README.md b/README.md index 8f5050a..4882f02 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,10 @@ You can also check out some [Demos](http://www.gargan.org/jsform/index.jsp). # Download -Current Version: 1.1.1 +Current Version: 1.1.2 -* [Minified](https://github.com/corinis/jsForm/raw/master/dist/jquery.jsForm-1.1.1.min.js) + [map](https://raw.github.com/corinis/jsForm/master/dist/jquery.jsForm.min.map) -* [Source](https://github.com/corinis/jsForm/raw/master/dist/jquery.jsForm-1.1.1.js) +* [Minified](https://github.com/corinis/jsForm/raw/master/dist/jquery.jsForm-1.1.2.min.js) + [map](https://raw.github.com/corinis/jsForm/master/dist/jquery.jsForm.min.map) +* [Source](https://github.com/corinis/jsForm/raw/master/dist/jquery.jsForm-1.1.2.js) # Documentation diff --git a/dist/jquery.jsForm-1.1.2.js b/dist/jquery.jsForm-1.1.2.js new file mode 100644 index 0000000..4ecbc45 --- /dev/null +++ b/dist/jquery.jsForm-1.1.2.js @@ -0,0 +1,2827 @@ +/** + * jquery.jsForm + * ------------- + * JsForm control for handling html UI with json objects + * @version 1.0 + * @class + * @author Niko Berger + * @license MIT License GPL + */ +;(function( $, window, undefined ){ + "use strict"; + + var JSFORM_INIT_FUNCTIONS = {}, // remember initialization functions + JSFORM_MAP = {}; // remember all forms + + + /** + * @param element {Node} the cotnainer node that should be converted to a jsForm + * @param options {object} the configuraton object + * @constructor + */ + function JsForm (element, options) { + var $this = $(element); + + // create the options + this.options = $.extend({}, { + /** + * enable form control rendering (if jsForm.controls is available) and validation + */ + controls: true, + /** + * the object used to fill/collect data + */ + data: null, + /** + * the prefix used to annotate theinput fields + */ + prefix: "data", + /** + * set to null to discourage the tracking of "changed" fields. + * Disabling this will increase performance, but disabled the "changed" functionality. + * This will add the given css class to changed fields. + */ + trackChanges: "changed", + /** + * set to false to only validate visible fields. + * This is discouraged especially when you have tabs or similar elements in your form. + */ + validateHidden: true, + /** + * skip empty values when getting an object + */ + skipEmpty: false, + /** + * an object with callback functions that act as renderer for data fields (class=object). + * ie. { infoRender: function(data){return data.id + ": " + data.name} } + */ + renderer: null, + /** + * an object with callback functions that act as pre-processors for data fields (class=object). + * ie. { idFilter: function(data){return data.id} } + */ + processors: null, + /** + * optional array of elements that should be connected with the form. This + * allows the splitting of the form into different parts of the dom. + */ + connect: null + }, options); + + // read prefix from dom + if($this.attr("data-prefix") && (this.options.prefix === "data" || this.options.prefix === "")) { + if($this.attr("data-prefix") !== "") { + this.options.prefix = $this.attr("data-prefix"); + } + } + + this.element = element; + + this._init(); + } + + /** + * init the portlet - load the config + * @private + */ + JsForm.prototype._init = function() { + // init the basic dom functionality + this._domInit(); + + // enable form controls + if(this.options.controls) { + if($.jsFormControls) { + // handle multiple form parts + $.each(this._getForm(), function(){ + $(this).jsFormControls(); + }); + } else { + try { + if(typeof console !== "undefined") { + console.log("jquery.JsForm.controls not available!"); + } + } catch(ex) { + // ignore + } + } + } + + // fill/init with the first data + this._fill(this.options); + }; + + /** + * Connect a dom element with an already existing form. + * @param ele the new part of the form + */ + JsForm.prototype.connect = function(ele) { + // collection lists with buttons + this._initCollection(ele, this.options.prefix); + // init conditionals + this._initConditional(ele, this.options.prefix, this.options); + + // enable form controls + if(this.options.controls) { + if($.jsFormControls) { + // handle multiple form parts + $(ele).jsFormControls(); + } + } + + this._fillDom(ele); + if(!this.options.connect) + this.options.connect = []; + this.options.connect.push(ele); + }; + + /** + * @return all nodes for this jsform (main + connected) + */ + JsForm.prototype.getNodes = function() { + return this._getForm(); + }; + + /** + * init the dom. This can be called multiple times. + * this will also enable "add", "insert" and "delete" for collections + * @private + */ + JsForm.prototype._domInit = function() { + var that = this; + + // handle multiple form parts + $.each(this._getForm(), function(){ + // collection lists with buttons + that._initCollection(this, that.options.prefix); + // init conditionals + that._initConditional(this, that.options.prefix, that.options); + }); + }; + + /** + * simple debug helper + * @param msg the message to pring + * @private + */ + JsForm.prototype._debug = function(msg, param) { + try { + if (!window.console || !window.console.log) + return; + + var p = null; + if($.isPlainObject(param)) { + p = JSON.stringify(param, null, " "); + } else + p = param; + + if(!p) { + p = ""; + } + + window.console.log(msg + p); + } catch(ex) { + // ignore + } + }; + + /** + * initialize conditionals. + * basic rule is: + * any dom element that has a conditional and either + * a data-show or data-hide attribute or a data-eval attribute + * + * @param form the base dom element + * @param prefix the prefix to check for + * @private + */ + JsForm.prototype._initConditional = function(form, prefix, options) { + var that = this; + var showEvaluator = function(ele, data, fields) { + // if any field has a value -> show + var show = false; + $.each(fields, function(){ + var value = that._getValueWithArrays(data, this); + if(!value || value === "" || value === 0 || value === -1) + return; + show = true; + // skip processing + return false; + }); + if(show) + ele.show(); + else + ele.hide(); + }, hideEvaluator = function(ele, data, fields) { + // if any field has a value -> hide + var show = false; + $.each(fields, function(){ + var value = that._getValueWithArrays(data, this); + if(!value || value === "" || value === 0 || value === -1) + return; + show = true; + // skip processing + return false; + }); + if(show) + ele.hide(); + else + ele.show(); + }; + + // remember the conditionals for faster dom access + this.conditionals = $(form).find(".conditional"); + + this.conditionals.each(function(){ + $(this).data().conditionalEval = []; + var fields = $(this).attr("data-show"); + if(fields && fields.length > 0) { + $(this).data().conditionalEval.push({ + func: showEvaluator, + field: fields.split(" ") + }); + } + fields = $(this).attr("data-hide"); + if(fields && fields.length > 0) { + $(this).data().conditionalEval.push({ + func: hideEvaluator, + field: fields.split(" ") + }); + } + fields = $(this).attr("data-eval"); + if(fields && fields.length > 0) { + // custom evaluator + if(options.conditionals[fields]) + $(this).data().conditionalEval.push({ + func: options.conditionals[fields] + }); + } + }); + }; + + /** + * evaluate conditionals on the form + * @param form the form to search for conditionals + * @param data the data + */ + JsForm.prototype._evaluateConditionals = function(form, data) { + this.conditionals.each(function(){ + var ele = $(this); + // go throguh all evaluation functions + $.each(ele.data().conditionalEval, function() { + this.func(ele, data, this.field); + }); + }); + }; + + /** + * initialize collections + * @param form the base dom element + * @param prefix the prefix to check for + * @private + */ + JsForm.prototype._initCollection = function(form, prefix) { + // all collections + var collectionMap = {}, + that = this; + $(form).data().collections = collectionMap; + + $(".collection", form).each(function() { + var colName = $(this).attr("data-field"); + // skip collections without a data-field mapping + if (!colName || colName.indexOf(prefix + ".") !== 0) { + return; + } + + var container = $(this); + + // remember the collection + var cols = collectionMap[colName]; + if(cols) { + cols.push(container); + } else { + collectionMap[colName] = [container]; + } + + //init the collection + that._initList(container); + + // after adding: check if we want reorder control + if(!container.hasClass("ui-sortable") && container.hasClass("sortable") && container.sortable) { + // get the config object + var config = container.attr("data-sortable"); + if(!config) { + config = {}; + } else { + config = JSON.parse(config); + } + + container.sortable(config); + container.on("sortstop", function( event, ui ) { + that._reorder(container); + }); + } + + }); + + $(".add", form).each(function(){ + var fieldName = $(this).attr("data-field"); + if(!fieldName) { + return; + } + + // only init once + if($(this).data("collections")) { + return; + } + + // add the collection + $(this).data().collections = collectionMap[fieldName]; + + $(this).click(function(ev){ + ev.preventDefault(); + + // search for a collection with that name + $.each($(this).data("collections"), function() { + var tmpl = $(this).data("template"); + // and has a template + if(tmpl) { + var line = tmpl.clone(true); + $(line).addClass("POJO"); + $(line).data().pojo = {}; + $(this).append(line); + + // init controls + that._enableTracking($("input,textarea,select", line)); + // ne wline always has changes + if(that.options.trackChanges) + $("input,textarea,select", line).addClass(that.options.trackChanges); + + that._addCollectionControls(line); + + // trigger a callback + $(this).trigger("addCollection", [line, $(line).data().pojo]); + + // its possible to have "sub" collections + that._initCollection(line, fieldName.substring(fieldName.indexOf('.')+1)); + + // trigger a callback after the data has been rendered) + $(this).trigger("postAddCollection", [line, $(line).data().pojo]); + } + }); + }); + }); + + // insert: similar to add - but works with events + $(".insert", form).each(function(){ + var fieldName = $(this).attr("data-field"); + if(!fieldName) { + return; + } + + // only init once + if($(this).data("collections")) { + return; + } + + // remember the collections + $(this).data("collections", collectionMap[$(this).attr("data-field")]); + + $(this).on("insert", function(ev, pojo){ + if(!pojo) + pojo = $(this).data().pojo; + + // insert only works if there is a pojo + if(!pojo) { + return; + } + var beforeInsertCallback = $(this).data("beforeInsert"); + if(beforeInsertCallback && $.isFunction(beforeInsertCallback)) { + pojo = beforeInsertCallback(pojo); + + // insert only works if there is a pojo + if(!pojo) { + return; + } + } + + // search for a collection with that name + $.each($(this).data("collections"), function() { + var tmpl = $(this).data("template"); + // and has a template + if(tmpl) { + var line = tmpl.clone(true); + // mark that this is a pojo + line.addClass("POJO"); + // add the pojo + line.data().pojo = pojo; + + that._addCollectionControls(line); + + // its possible to have "sub" collections + that._initCollection(line); + + // trigger a callback + $(this).trigger("addCollection", [line, $(line).data().pojo]); + + // the new entry has as index the count of all "lines" + var idx = $(this).children(".POJO").length; + + // fill the "information" + that._fillData(line, pojo, fieldName.substring(fieldName.indexOf('.')+1), idx); + + $(this).append(line); + } + }); + + // empty field + $(this).val(""); + $(this).data().pojo = null; + $(this).focus(); + }); + }); + + // insert: helper button (triggers insert) + $(".insertAction", form).each(function(){ + var fieldName = $(this).attr("data-field"); + if(!fieldName) { + return; + } + + // only init once + if($(this).data("inserter")) { + return; + } + + // find the insert element for this data-field + var inserter = $(this).parent().find(".insert"); + if(!inserter) { + return; + } + + // remember the inserter + $(this).data("inserter", inserter); + + $(this).click(function(ev){ + ev.preventDefault(); + $(this).data("inserter").trigger("insert"); + return false; + }); + + }); + + $("input.object", form).each(function(){ + $(this).on("update", function(evt){ + var pojo = $(this).data().pojo; + if (pojo && $(this).attr("data-display")) { + $(this).val(that._renderObject(pojo, $(this).attr("data-display"))); + } + }); + }); + + // fileupload + $("input.blob", form).each(function(){ + // only available on input type file + if($(this).attr("type") !== "file") { + return; + } + + var blobInput = $(this); + + // bind on change + $(this).on("change", function(evt){ + + //get file name + var fileName = $(this).val().split(/\\/).pop(); + blobInput.data("name", fileName); + + var files = evt.target.files; // FileList object + // Loop through the FileList (and render image files as thumbnails.(skip for ie < 9) + if(files && files.length) { + $.each(files, function() { + var reader = new FileReader(); + + // closure to capture the file information + reader.onload = function(e) { + // get the result + blobInput.data("blob", e.target.result); + }; + + // Read in the image file as a data URL. + reader.readAsDataURL(this); + + $(this).trigger("fileChange"); + }); + } + }); + + + }); + }; + + /** + * init a container that has a tempalate child (first child). + * @param container the contianer element + * @private + */ + JsForm.prototype._initList = function(container) { + // avoid double initialisation + if(container.data("template")) { + return; + } + + // get all children + var tmpl = container.children().detach(); + + // remove an id if there is one + tmpl.removeAttr("id"); + container.data("template", tmpl); + }; + + /** + * generate the array with all dome elements that are conencted with + * the form. + * @private + */ + JsForm.prototype._getForm = function() { + var form = [$(this.element)]; + if(this.options.connect) + $.each(this.options.connect, function(){ + form.push($(this)); + }); + return form; + }; + + /** + * clear/reset a form. The prefix is normally predefined by init + * @param form the form + * @param prefix the optional prefix used to identify fields for this form + */ + JsForm.prototype._clear = function(form, prefix) { + // get the prefix from the form if not given + if(!prefix) { + prefix = this.options.prefix; + } + + $(form).removeData("pojo"); + $("input,select,textarea", form).each(function(){ + var name = $(this).attr("name"); + // empty name - ignore + if (!name || name.indexOf(prefix + ".") !== 0) { + return; + } + // cut away the prefix + name = name.substring((prefix+".").length); + // skip empty + if(name.length < 1) { + return; + } + + // remove all pojos + $(this).removeData("pojo"); + + if($(this).attr("type") === "checkbox") { + $(this).prop("checked", false); + } else { + $(this).val(""); + } + if($(this).hasClass("blob")) { + $(this).removeData("blob"); + } + // special type select box: select the FIRST child + if($(this).is("select")) { + $('option[selected="selected"]', this).prop('selected', false); + $('option:first', this).prop('selected', true); + + $(this).val($("option:first", this).val()).change(); + } + // trigger change + $(this).change(); + }); + + $(".collection", form).each(function() { + var fieldname = $(this).attr("data-field"); + // only collections with the correct prefix + if(!fieldname || fieldname.indexOf(prefix+".") !== 0) { + return; + } + // get rid of all + $(this).empty(); + }); + + }; + /** + * ceate a pojo from a form. Takes special data definition classes into account: + * + * @param start the element to start from (ie. the form or tr) + * @param pojo the pojo to write everything to + * @param prefix a prefix: only fields with the given prefix will be included in the pojo + * @private + */ + JsForm.prototype._createPojoFromInput = function (start, prefix, pojo) { + // check if we have an "original" pojo + var startObj = null; + var that = this; + + // get it from the starting dom element + if($(start).data("pojo")) { + startObj = $(start).data("pojo"); + } + + // if we have an object, use this as base and fill the pojo + if(startObj) { + $.extend(true, pojo, startObj); + } + + $(start).find("input,select,textarea,.jsobject").each(function(){ + var name = $(this).attr("data-name"); + if(!name) { + name = $(this).attr("name"); + } + + // empty name - ignore + if (!name) { + return; + } + + // skip grayed (=calculated) or transient fields + if($(this).hasClass("transient")) { + return; + } + + // must start with prefix + if(name.indexOf(prefix + ".") !== 0) { + return; + } + + $(this).trigger("validate", true); + + // cut away the prefix + name = name.substring((prefix+".").length); + + var val = $(this).val(); + + // jsobject use the pojo data directly - ignore the rest + if($(this).hasClass("jsobject")) { + val = $(this).data("pojo"); + } + else { + // ignore empty values when skipEmpty is set + if(that.options.skipEmpty && (!val || val === "" || val.trim() === "")) { + return; + } + + if($(this).hasClass("emptynull") && (!val || val === "" || val === "null" || val.trim() === "")) { // nullable fields do not send empty string + val = null; + } else if($(this).hasClass("object") || $(this).hasClass("POJO")) { + if($("option:selected", this).data() && $("option:selected", this).data().pojo) { + val = $("option:selected", this).data().pojo; + } else { + val = $(this).data("pojo"); + } + // object can also have a processor + if($.isFunction($(this).data().processor)) { + val = $(this).data().processor(val); + } else { + var processor = $(this).attr("data-processor"); + if(processor && that.options.processors[processor]) { + val = that.options.processors[processor](val); + } + } + } else if($(this).hasClass("blob")) { // file upload blob + val = $(this).data("blob"); + } else + // set empty numbers or dates to null + if(val === "" && ($(this).hasClass("number") || $(this).hasClass("percent") || $(this).hasClass("integer") || $(this).hasClass("dateFilter")|| $(this).hasClass("dateTimeFilter"))) { + val = null; + } + + // check for percentage: this is input / 100 + if ($(this).hasClass("percent")) { + val = that._getNumber(val); + if(isNaN(val)) { + val = 0; + } else { + val /= 100; + } + } + else if ($(this).hasClass("number") || $(this).hasClass("integer")) { + if($(this).hasClass("date") && isNaN(val)) { + if($.format) { + var d = $.format.date(val); + d.setHours(0); + d.setMinutes(0); + d.setSeconds(0); + d.setMilliseconds(0); + val = d.getTime(); + } else + val = new Date(val).getTime(); + } else + val = that._getNumber(val); + if(isNaN(val)) { + val = 0; + } + } + else if($(this).attr("type") === "checkbox" || $(this).attr("type") === "CHECKBOX") { + // a checkbox as an array + if($(this).hasClass("array")) { + // the special case: array+checkbox is handled on the actual setting + val = $(this).val(); + } else + val = $(this).is(':checked'); + } + else if($(this).hasClass("bool")) { + val = ($(this).val() === "true"); + } + } + // handle simple collection + if(name.length < 1) { + pojo = val; + return false; + } + + // check if we have a . - if so split + if (name.indexOf(".") === -1) + { + // this might actually be an array! + if($(this).hasClass("array")) { + // create an array out of this + if(!pojo[name]) { + pojo[name] = []; + } + + if($(this).attr("type") === "checkbox" || $(this).attr("type") === "CHECKBOX") { + // do we want the value of not + var use = $(this).is(":checked"); + var pushVal = true; + $.each(pojo[name], function(data, index){ + if(this == val) { + // dont need to push + pushVal = false; + // we dont use it - remove it + if(!use) + pojo[name].splice(index, 1); + return false; + } + }); + if(pushVal && use) + pojo[name].push(val); + } else { + var num = $(this).attr("data-array"); + if(!num || isNaN(num)) { + num = null; + } else + num = Number(num); + + // no num -> add the array + if(num === null) + pojo[name].push(val); + else + pojo[name][num] = val; + } + } + else + pojo[name] = val; + } + else + { + var parts = name.split("."); + + var d0 = pojo[parts[0]]; + var d1, d2; + + // multiple parts: make sure its an object TODO find a better way to handle multiple levels with auto-create + if (!d0 || !$.isPlainObject(d0)) { + pojo[parts[0]] = {}; + d0 = pojo[parts[0]]; + } + + if (parts.length === 2) { + d0[parts[1]] = val; + } else if (parts.length === 3) { + d1 = d0[parts[1]]; + if(d1 === undefined || d1 === null) { + d1 = {}; + d0[parts[1]] = d1; + } + d1[parts[2]] = val; + } else if (parts.length === 4) + { + d1 = d0[parts[1]]; + if(d1 === null || d1 === undefined) { + d1 = {}; + d0[parts[1]] = d1; + } + d2 = d1[parts[2]]; + if(d2 === undefined || d1 === null) { + d2 = {}; + d1[parts[2]] = d2; + } + d1[parts[2]] = val; + d2[parts[3]] = val; + } + // more should not be necessary + } + }); + + return pojo; + }; + + /** + * helper function to enable tracking on fields + * @param ele the element to track + */ + JsForm.prototype._enableTracking = function(ele) { + var that = this; + if(that.options.trackChanges && !$(ele).data().track) { + $(ele).data().track = true; + $(ele).change(function(){ + if($(this).val() !== $(this).data().orig) { + $(this).addClass(that.options.trackChanges); + }else { + $(this).removeClass(that.options.trackChanges); + } + }); + } + }; + + /** + * fill a dom subtree with data. + * + * @param parent the root of the subtree + * @param data the data + * @param prefix the prefix used to find fields + * @param idx the index - this is only used for collections + * @private + */ + JsForm.prototype._fillData = function (parent, data, prefix, idx) { + var that = this; + var $parent = $(parent); + + // locate all "fields" + $parent.find(".field").each(function() { + var name = $(this).data("name"); + if(!name) { + if(this.nodeName.toUpperCase() === 'A') { + name = $(this).attr("href"); + $(this).attr("href", "#"); + }else if(this.nodeName.toUpperCase() === 'IMG') { + name = $(this).attr("src"); + if(name.indexOf("#") === 0) { + name = name.substring(1); + } + $(this).attr("src", "#"); + }else { + name = $(this).text(); + } + $(this).data("name", name); + $(this).show(); + } + + if(!prefix || name.indexOf(prefix + ".") >= 0) { + var cname = name; + if (prefix) { + cname = cname.substring(prefix.length + 1); + } + var cdata = that._get(data, cname, false, idx); + + if(!cdata) { + cdata = ""; + } + + // check for percentage: this is value * 100 + if ($(this).hasClass("percent") && !isNaN(cdata)) { + cdata = 100 * Number(cdata); + } + + // format the string + if($.jsFormControls) + cdata = $.jsFormControls.Format.format(this, cdata); + + if(this.nodeName.toUpperCase() === 'A') { + $(this).attr("href", cdata); + } else if(this.nodeName.toUpperCase() === 'IMG') { + $(this).attr("src", cdata); + } + else if(this.nodeName.toUpperCase() === "DIV"){ + $(this).html(cdata); + } else { + $(this).text(cdata); + } + } + }); + + $("input, textarea", $parent).each(function() { + var name = $(this).attr("name"); + if(!name) { + return; + } + that._enableTracking(this); + + // ignore file inputs - they cannot be "prefilled" + if($(this).attr("type") == "file") { + return; + } + + if(!prefix || name.indexOf(prefix + ".") >= 0) { + var cname = name; + if (prefix) { + cname = cname.substring(prefix.length + 1); + } + + var cdata = that._get(data, cname, false, idx); + + // check for percentage: this is value * 100 + if ($(this).hasClass("object")) { + $(this).data().pojo = cdata; + $(this).addClass("POJO"); + if($(this).attr("data-display") || $(this).attr("data-render")) { + cdata = that._renderObject(cdata, $(this).attr("data-display"), $(this).attr("data-render")); + } + } else if ($(this).hasClass("jsobject")) { + $(this).data().pojo = cdata; + $(this).addClass("POJO"); + } else if ($(this).hasClass("percent") && !isNaN(cdata)) { + cdata = 100 * Number(cdata); + } else if($.isPlainObject(cdata)) { + $(this).data().pojo = cdata; + $(this).addClass("POJO"); + cdata = that._renderObject(cdata, $(this).attr("data-display"), $(this).attr("data-render")); + } + + + if($(this).attr("type") === "checkbox") { + // array in checkbox + if($(this).hasClass("array")) { + // checkbox: set if any part of the array matches + var cbVal = $(this).val(); + var found = false; + if(cdata) + $.each(cdata, function(){ + if(this == cbVal) { + found = true; + return false; + } + }); + // select + $(this).prop("checked", found); + } else + $(this).prop("checked", (cdata === true || cdata === "true")); + } else { + if(!cdata) { + cdata = ""; + } + + // format the string + if($.jsFormControls) + cdata = $.jsFormControls.Format.format(this, cdata); + + // array handling + if($(this).hasClass("array")) { + // fixed numbers + var num = $(this).attr("data-array"); + if(!num || isNaN(num)) { + num = null; + } else + num = Number(num); + if(num !== null && cdata && cdata.length > num) { + $(this).val(cdata[num]); + } else { + $(this).val(""); + } + } else + $(this).val(cdata); + } + + $(this).data().orig = $(this).val(); + $(this).change(); + $(this).trigger("fill"); + } + }); + + $("select", $parent).each(function() { + var name = $(this).attr("name"); + if(!name) { + return; + } + + if(!prefix || name.indexOf(prefix + ".") >= 0) { + var cname = name; + if (prefix) { + cname = cname.substring(prefix.length + 1); + } + + that._enableTracking(this); + + // remove "old" selected options + $(this).children("option:selected").prop("selected", false); + var pk = $(this).attr("data-key"); + if(!pk) { + pk = "id"; + } + + var value = that._get(data, cname, false, idx); + // try selecting based on the id + if (value[pk] || !isNaN(value[pk])) { + $(this).children("option[value='"+value[pk]+"']").prop("selected", true); + // actually set the value and trigger the change + $(this).val(value[pk]).change(); + return; + } else if($(this).hasClass("bool")) { + value = value ? "true" : "false"; + } + + $(this).children("option[value='"+value+"']").prop("selected", true); + $(this).data().orig = value; + $(this).val(value).change(); + $(this).trigger("fill"); + } + }); + }; + + /** + * ceate a pojo from a form. Takes special data definition classes into account: + * + * @param ignoreInvalid return a pojo, even if fields do not pass client side validation + * @return {Object} a new pojo + */ + JsForm.prototype.get = function(ignoreInvalid) { + var that = this; + var originalPojo = this.options.data; + var prefix = this.options.prefix; + + // get the pojo + var pojo = {}; + if(originalPojo && $.isPlainObject(originalPojo)) { + pojo = $.extend({}, originalPojo); + } + + // check for invalid fields + var invalid = false; + + // go through all form parts + $.each(this._getForm(), function(){ + // fill the base + that._createPojoFromInput(this, prefix, pojo); + + if(!that.options.validateHidden) { + this.find(".invalid").filter(":visible").each(function(){ + invalid = true; + $(this).focus(); + if(!ignoreInvalid) { + that._debug("Found invalid field: " + $(this).attr("name")); + } + return false; + }); + } else { + this.find(".invalid").each(function(){ + invalid = true; + $(this).focus(); + return false; + }); + } + + // get the collection + if(that._getCollection(this, prefix, pojo, ignoreInvalid)) { + invalid = true; + } + }); + + if(!ignoreInvalid && invalid) { + return null; + } + + return pojo; + }; + + /** + * fill a pojo based on collections + * @param form {DOMElement} the base element to start looking for collections + * @param prefix {string} the prefix used + * @param pojo {object} the object to fill + * @param ignoreInvalid {boolean} if true the function will return as soon as an invalid field is found + * @return true if the colelction encountered an invalid field + */ + JsForm.prototype._getCollection = function(form, prefix, pojo, ignoreInvalid) { + var that = this; + // check for invalid fields + var invalid = false; + + form.find(".collection").each(function() { + if(!ignoreInvalid && invalid) { + return; + } + + var fieldname = $(this).attr("data-field"); + // only collections with the correct prefix + if(!fieldname || fieldname.indexOf(prefix+".") !== 0) { + return; + } + + fieldname = fieldname.substring((prefix+".").length); + + var colParent = that._getParent(pojo, fieldname, true); + // get only the last part + if(fieldname.indexOf('.') !== -1) { + fieldname = fieldname.substring(fieldname.lastIndexOf('.') + 1); + } + + // clear the collection + colParent[fieldname] = []; + + // go through all direct childs - each one is an element + $(this).children().each(function(){ + var ele = {}; + ele = that._createPojoFromInput($(this), fieldname, ele); + + // also collect sub-collections + that._getCollection($(this), fieldname, ele, ignoreInvalid); + + // check if the pojo is empty + if(!that._isEmpty(ele)) { + if($(".invalid", this).length > 0) { + invalid = true; + if(!ignoreInvalid) + return false; + } + colParent[fieldname].push(ele); + } else { + $(".invalid", this).removeClass("invalid"); + } + }); + }); + + return invalid; + }; + + /** + * Get the data object used as a base for get(). + * Note that modifying this directly might result into unwanted results + * when working with some functions that rely on this object. + * + * @returns the original data object + */ + JsForm.prototype.getData = function() { + // make srue we do have an object to work with + if(!this.options.data) { + this.options.data = {}; + } + return this.options.data; + }; + + /** + * uses form element and replaces them with "spans" that contain the actual content. + * the original "inputs" are hidden + * @param form the form + * @param enable true: switch inputs with spans, false: switch spans back, undefined: toggle + */ + JsForm.prototype.preventEditing = function(prevent) { + var $this = $(this.element); + + if(typeof prevent === "undefined") { + // get the disable from the form itself + prevent = $this.data("disabled")?false:true; + } else { + // already in that state + if(prevent === $this.data("disabled")) { + return; + } + } + + if (prevent) + { + $this.find("input, textarea").each(function() { + if ($(this).closest("span.form")[0]) + return; + if($(this).attr("type") == "hidden") + return; + var val = $(this).val(); + if (val === "null" || val === null || $(this).attr("type") === "submit") + val = ""; + if($(this).hasClass("trueFalse")) { + if($(this).is(':checked')) + val = 'X'; + else + val = ' '; + } + + // convert \n to brs - escape all other html + val = val.replace(//g, ">").replace(/\n/g, "
"); + var thespan = $(''+val+''); + if($(this).parent().hasClass("ui-wrapper")) + $(this).parent().hide().wrap(thespan); + else + $(this).hide().wrap(thespan); + }); + // selects are handled slightly different + $this.find("select").each(function() { + if ($(this).closest("span.form")[0]) + return; + + var val = $(this).children(":selected").html(); + if (val === "null" || val === null) + val = ""; + + var thespan = $(''+val+''); + + // toggle switches work a little different + if($(this).hasClass("ui-toggle-switch")) { + $(this).prev().hide().wrap(thespan); + } + else { + $(this).hide().wrap(thespan); + } + }); + } + else + { + $this.find("span.form").each(function() { + // remove text and then unwrap + var ele = $(this).children("input,select,textarea,.ui-wrapper,.ui-toggle-switch").show().detach(); + $(this).before(ele); + $(this).remove(); + }); + } + + $this.data("disabled", prevent); + }; + + /** + * validate a given form + * @return true if the form has no invalid fields, false otherwise + */ + JsForm.prototype.validate = function() { + // get the prefix from the form if not given + var valid = true; + + $.each(this._getForm(), function(){ + // validation + $(".required,.regexp,.date,.mandatory,.number,.validate,.integer", this).change(); + // check for invalid fields + if($(".invalid", this).length > 0) { + valid = false; + } + }); + + return valid; + }; + + /** + * fill a form based on a pojo. + * @param form the form + * @param options the options used to fill + * @param prefix the optional prefix used to identify fields for this form + * @private + */ + JsForm.prototype._fill = function() { + var that = this; + $(this.element).addClass("POJO"); + $(this.element).data("pojo", this.options.data); + + // handle multiple form parts + $.each(this._getForm(), function(){ + that._fillDom(this); + }); + }; + + /** + * This is the actual worker function that fills a dom element + * with data. + * @param ele the element to fill + * @private + */ + JsForm.prototype._fillDom = function(ele) { + var that = this; + that._clear(ele, that.options.prefix); + + // fill base + that._fillData(ele, that.options.data, that.options.prefix); + that._fillCollection(ele, that.options.data, that.options.prefix); + // (re-)evaluate all conditionals + that._evaluateConditionals(ele, that.options.data); + }; + + + /** + * @param container the container element + * @param data an array containing the the data + * @param prefix a prefix for each line of data + * @private + */ + JsForm.prototype._fillCollection = function(container, data, prefix) { + var that = this; + // fill collections + $(".collection", container).each(function() { + var container = $(this), + fieldname = $(this).attr("data-field"); + // only collections with the correct prefix + if(!data || !fieldname || fieldname.indexOf(prefix+".") !== 0) { + return; + } + + // data for the collection filling + var colData = null; + + var cname = fieldname; + // remove the prefix + if (prefix) { + cname = cname.substring(prefix.length + 1); + } + colData = that._get(data, cname); + + if(colData) { + // fill the collection + that._fillList(container, colData, cname); + } + }); + }; + + /** + * @param container the container element + * @param data an array containing the the data + * @param prefix a prefix for each line of data + * @param lineFunc function(line,cur) - can return false to skip the line + * @private + */ + JsForm.prototype._fillList = function(container, data, prefix, lineFunc) { + var tmpl = container.data("template"), + that = this; + if(!tmpl) { + return; + } + // clean out previous list + container.empty(); + + // not an array + if(!$.isArray(data)) { + return; + } + + // cut away any prefixes - only the fieldname is used + if(prefix.indexOf('.') !== -1) { + prefix = prefix.substring(prefix.lastIndexOf('.')+1); + } + + + // check if we need to sort the array + if($(container).hasClass("sort")) { + var sortField = $(container).attr("data-sort"); + if(sortField) { + switch($(container).attr("data-sorttype")) { + case 'alpha': + data.sort(); + break; + case 'alphainsensitiv': + data.sort(function(a,b){ + a = a[sortField]; + b = b[sortField]; + if(a) a = a.toLowerCase(); + if(b) b = b.toLowerCase(); + if(ab) + return 1; + return 0; + }); + break; + default: + data.sort(function(a,b){ + return a[sortField] - b[sortField]; + }); + } + // descending: reverse + if($(container).attr("data-sortdesc")) { + data.reverse(); + } + } + } + + if(!lineFunc) { + if($.isFunction(prefix)) { + lineFunc = prefix; + prefix = null; + } + } + + for(var i = 0; i < data.length; i++) { + var cur = data[i]; + var line = tmpl.clone(true); + // save current line + line.data().pojo = cur; + line.addClass("POJO"); + + if(lineFunc) { + if(lineFunc(line, cur) === false) { + continue; + } + } + + that._addCollectionControls(line); + + if(prefix) { + // fill data - including the index + that._fillData(line, cur, prefix, i+1); + // enable collection controls + that._initCollection(line, prefix); + // fill with data + that._fillCollection(line, cur, prefix); + } + container.append(line); + + } + }; + + /** + * add controls into a collection entry(i.e. delete) + * @param line the new collection + * @private + */ + JsForm.prototype._addCollectionControls = function(line) { + var that = this; + + // enable controls on the line + if($.jsFormControls) { + $(line).jsFormControls(); + } + + $(".delete", line).click(function(){ + var ele = $(this).closest(".POJO"); + // trigger a callback + $(this).closest(".collection").trigger("deleteCollection", [ele, $(ele).data().pojo]); + ele.remove(); + }); + $(".sortUp", line).click(function(){ + // check if there is an up + var ele = $(this).closest(".POJO"); + var prev = ele.prev(".POJO"); + if(prev.size() === 0) { + // no previous element - return + return; + } + ele.detach(); + prev.before(ele); + // reorder (if possible) + that._reorder(ele); + }); + $(".sortDown", line).click(function(){ + // check if there is a down + var ele = $(this).closest(".POJO"); + var next = ele.next(".POJO"); + if(next.size() === 0) { + // no next element - return + return; + } + ele.detach(); + next.after(ele); + // reorder (if possible) + that._reorder(ele); + }); + + // if collection is sortable: refresh it + var container = $(line).closest(".collection"); + if(container.hasClass("sortable")&& $(container).sortable) { + container.sortable("refresh"); + } + }; + + /** + * Reorder a collection (actually its fields) + * @param ele one element of the collection or the collection itself + * @private + */ + JsForm.prototype._reorder = function(ele) { + if(!ele.attr("data-sort")) { + ele = ele.closest(".collection"); + } + + // get the field to use for sorting + var sortField = $(ele).attr("data-sort"); + if(!sortField || ($(ele).attr("data-sorttype") && $(ele).attr("data-sorttype") !== "number") || + ($(ele).attr("data-sortdesc") && $(ele).attr("data-sortdesc") !== "false")) { + return; + } + + // go through each child and get the pojo + var prio = 0; + $.each($(ele).children(), function(){ + var data = $(this).data("pojo"); + // no data yet - add one + if(!data) { + data = {}; + $(this).data("pojo", data); + } + + data[sortField] = prio++; + }); + }; + + /** + * render an object based on a string. + * Note: comma is a special char and cannot be used! + * @param obj the object + * @param skin the string to render with (i.e. id, ":", test) + * @private + */ + JsForm.prototype._renderObject = function(obj, skin, renderer) { + if(!obj || (!skin && !renderer)) + return ""; + if(renderer) { + if(this.options.renderer && this.options.renderer[renderer]) + return this.options.renderer[renderer](obj); + this._debug("Unable to find renderer: " + renderer); + return ""; + } + + var that = this; + var ret = ""; + $.each(skin.split(","), function(){ + var val = this.trim(); + if(val.indexOf("'") === 0 || val.indexOf('"') === 0) { + ret += val.substring(1, val.length - 1); + } else { + ret += that._get(obj, val); + } + }); + return ret; + }; + + /** + * Retrieve a value from a given object by using dot-notation + * @param obj the object to start with + * @param expr the child to get (dot notation) + * @param create set to true and non-existant levels will be created (always returns non-null) + * @param idx only filles when filling collection - can be access using $idx + * @private + */ + JsForm.prototype._get = function(obj, expr, create, idx) { + var ret, p, prm = "", i; + if(typeof expr === "function") { + return expr(obj); + } + if (!obj) { + return ""; + } + // reference the object itself + if(expr === "") + return obj; + + // reference to the index + if(expr === "$idx") + return idx; + + ret = obj[expr]; + if(!ret) { + try { + if(typeof expr === "string") { + prm = expr.split('.'); + } + + i = prm.length; + if(i) { + ret = obj; + while(ret && i--) { + p = prm.shift(); + // create the levels + if(create && !ret[p]) { + ret[p] = {}; + } + ret = ret[p]; + } + } + } catch(e) { /* ignore */ } + } + if(ret === null || ret === undefined) { + ret = ""; + } + // trim the return + if(ret.trim) { + return ret.trim(); + } + return ret; + }; + + /** + * Parse a dot notation that includes arrays + * http://stackoverflow.com/questions/13355278/javascript-how-to-convert-json-dot-string-into-object-reference + * @param obj + * @param path a dot notation path to search for. Use format parent[1].child + */ + JsForm.prototype._getValueWithArrays = function(obj, path) { + path = path.split('.'); + var arrayPattern = /(.*)\[(\d+)\]/; + for (var i = 1; i < path.length; i++) { + var match = arrayPattern.exec(path[i]); + try { + if (match) { + obj = obj[match[1]][parseInt(match[2], 10)]; + } else { + obj = obj[path[i]]; + } + } catch(e) { + this._debug(path + " " + e); + } + } + + return obj; + }; + + /** + * get the "parent" object of a given dot-notation. this will not return the actual + * element given in the dot notation but itws parent (i.e.: when using a.b.c -> it will return b) + * @param obj the object to start with + * @param the child to get (dot notation) + * @param create set to true and non-existant levels will be created (always returns non-null) + * @private + */ + JsForm.prototype._getParent = function(obj, expr, create) { + if(expr.indexOf('.') === -1) + return obj; + + expr = expr.substring(0, expr.lastIndexOf('.')); + return this._get(obj, expr, create); + }; + + /** + * helper function to get the number of a value + * @param num the string + * @returns a number or null + * @private + */ + JsForm.prototype._getNumber = function(num) { + if (!num) { + return null; + } + + // check if we have jsForm controls (internationalization) + if($.jsFormControls) + return $.jsFormControls.Format._getNumber(num); + + // remove thousand seperator... + if(num.indexOf(",") != -1) + { + num = num.replace(",", "", "g"); + } + + + return Number(num); + }; + + /** + * checks if a variable is empty. This will check array, and whole objects. If a json object + * only contains empty "elements" then it is considered as empty. + * Empty for a number is 0/-1 + * Empty for a boolena is false + * + * @param pojo the pojo to check + * @returns {Boolean} true if it is empty + * @private + */ + JsForm.prototype._isEmpty = function(pojo) { + // boolean false, null, undefined + if(!pojo) { + return true; + } + + // array + if($.isArray(pojo)) { + // zero length + if(pojo.length === 0) { + return true; + } + + // check each element + for(var i = 0; i < pojo.length; i++) { + if(!this._isEmpty()) { + return false; + } + } + return true; + } + // an object + if($.isPlainObject(pojo)) { + if($.isEmptyObject(pojo)) { + return true; + } + + for(var f in pojo){ + if(!this._isEmpty(pojo[f])) { + return false; + } + } + return true; + } + + // a number + if(!isNaN(pojo)) { + if (Number(pojo) === 0 || Number(pojo) === -1) { + return true; + } + return false; + } + + // a string + return (pojo === "" || pojo === " "); + }; + + /** + * compares two objects. note: empty string or null is the same as not existant + * @param a the object to compare + * @param b the object to compare with + * @param idField if set then used for sub-objects instead of complete compare + * @return true if they contain the same content, false otherwise + */ + JsForm.prototype._equals = function(a, b, idField) + { + // empty arrays + if(!a && b && b.length && b.length === 0) { + return true; + } + if(!b && a && a.length && a.length === 0) { + return true; + } + + if(!a && !b) { + return true; + } + + var p = null; + for(p in a) { + if(typeof(b[p]) === 'undefined' && a[p] !== null && a[p] !== "" && a[p].length !== 0) { + // 0 == undefined + if((a[p] === "0" || a[p] === 0) && !b[p]) + continue; + return false; + } + + if (a[p]) { + switch(typeof(a[p])) { + case 'object': + if(idField && a[p][idField]) { + if (a[p][idField] === b[p][idField]) + continue; + } + // go deep + if (!this._equals(a[p], b[p])) { + return false; + } + break; + case 'function': // skip functions + break; + default: + // both are "false" + if(!a[p] && !b[p]) { + break; + } + + if((a === true || a === false) && a !== b) { + return false; + } + if(!isNaN(a[p]) || !isNaN(b[p])) { + if(Math.abs(Number(a[p]) - Number(b[p])) < 0.0000001) { + break; + } + return false; + } + + if(("" + a[p]).length !== ("" +b[p]).length) { + return false; + } + + if (a[p] !== b[p] && Number(a[p]) !== Number(b[p])) { + return false; + } + } + } else { + if (b[p]) { + return false; + } + } + } + + for(p in b) { + if((!a || typeof(a[p]) === 'undefined') && b[p] !== null && b[p] !== "") { + return false; + } + } + + return true; + }; + + /** + * Compares a pojo with the current generated object + * @param pojo the pojo to compare with + * @return true if any change between formfields and the pojo is found + */ + JsForm.prototype.equals = function(pojo, idField) { + var obj = this.get(false); + return this._equals(obj, pojo, idField); + }; + + /** + * Compares the current form with the last time the form was filled. + * + * @returns {Boolean} true if the form has changed since the last fill + */ + JsForm.prototype.changed = function() { + if(!this.options.trackChanges) + return false; + + var changed = false; + var that = this; + $.each(this._getForm(), function(){ + if($("." + that.options.trackChanges, this).size() > 0) { + changed = true; + return false; + } + }); + + return changed; + }; + + JsForm.prototype._equalsCollection = function(form, prefix, pojo) { + var that = this; + var differs = false; + + $(".collection", form).each(function() { + if(differs) { + return; + } + + var fieldname = $(this).attr("data-field"); + // only collections with the correct prefix + if(!fieldname || fieldname.indexOf(prefix+".") !== 0) { + return; + } + + fieldname = fieldname.substring((prefix+".").length); + if(fieldname.length < 1) { + return; + } + + var childCounter = 0; + // go through all direct childs - each one is an element + $(this).children().each(function(){ + if(differs) { + return; + } + + // check if we have more elements + if(childCounter >= pojo[fieldname].length) { + differs = true; + return; + } + + var ele = pojo[fieldname][childCounter++]; + if(that._pojoDifferFromInput($(this), fieldname, ele)) { + differs = true; + } + + if(!that._equalsCollection($(this), fieldname, ele)) + differs = true; + }); + + if(pojo[fieldname] && childCounter < pojo[fieldname].length) { + differs = true; + } + }); + + // we want to know if its equals -> return not + return !differs; + }; + + /** + * fill the form with data. + * + * @param data {object} the data + */ + JsForm.prototype.fill = function(pojo) { + // set the new data + this.options.data = $.extend({}, pojo); + // fill everything + this._fill(); + }; + + /** + * re-evaluate the conditionals in the form based on the given data. + * if no data is given, the form is serialized + * @param data {object} the data + */ + JsForm.prototype.applyConditions = function(pojo) { + // set the new data + if(!pojo) + pojo = this.get(true); + + // evaluate everything + this._evaluateConditionals(this.element, pojo); + }; + + /** + * reset a form with the last data, overwriting any changes. + */ + JsForm.prototype.reset = function() { + // fill with empty object + this.fill({}); + }; + + /** + * Clear all fields in a form + */ + JsForm.prototype.clear = function() { + var that = this; + $.each(this._getForm(), function(){ + that._clear(this, that.options.prefix); + }); + }; + + /** + * destroy the jsform and its resources. + * @private + */ + JsForm.prototype.destroy = function( ) { + return $(this.element).each(function(){ + $(window).unbind('.jsForm'); + $(this).removeData('jsForm'); + }); + }; + + // init and call methods + $.fn.jsForm = function ( method ) { + // Method calling logic + if ( typeof method === 'object' || ! method ) { + return this.each(function () { + if (!$(this).data('jsForm')) { + $(this).data('jsForm', new JsForm( this, method )); + } + }); + } else { + var args = Array.prototype.slice.call( arguments, 1 ), + jsForm; + // none found + if(this.length === 0) { + return null; + } + // only one - return directly + if(this.length === 1) { + jsForm = $(this).data('jsForm'); + if (jsForm) { + if(method.indexOf("_") !== 0 && jsForm[method]) { + var ret = jsForm[method].apply(jsForm, args); + return ret; + } + + $.error( 'Method ' + method + ' does not exist on jQuery.jsForm' ); + return false; + } + } + + return this.each(function () { + jsForm = $.data(this, 'jsForm'); + if (jsForm) { + if(method.indexOf("_") !== 0 && jsForm[method]) { + return jsForm[method].apply(jsForm, args); + } else { + $.error( 'Method ' + method + ' does not exist on jQuery.jsForm' ); + return false; + } + } + }); + } + }; + + /** + * global jsForm function for intialisation + */ + $.jsForm = function ( name, initFunc ) { + var jsForms = JSFORM_MAP[name]; + // initFunc is a function -> initialize + if($.isFunction(initFunc)) { + // call init if already initialized + if(jsForms) { + $.each(jsForms, function(){ + initFunc(this, $(this.element)); + }); + } + + // remember for future initializations + JSFORM_INIT_FUNCTIONS[name] = initFunc; + } else { + // call init if already initialized + if(jsForms) { + var method = initFunc; + var args = Array.prototype.slice.call( arguments, 2 ); + $.each(portlets, function(){ + this[method].apply(this, args); + }); + } + } + }; + +})( jQuery, window ); + +/** + * jquery.jsForm.controls + * ---------------------- + * UI Controls and Field validation + * @version 1.0 + * @class + * @author Niko Berger + * @license MIT License GPL + */ +;(function( $, window, undefined ){ + "use strict"; + + var JSFORM_INIT_FUNCTIONS = {}, // remember initialization functions + JSFORM_MAP = {}; // remember all forms + + /** + * handlebars extension (+simple date format) + */ + if(typeof Handlebars !== "undefined") { + Handlebars.registerHelper("currency", function(data){ + if(!data) + return "0"; + return $.jsFormControls.Format.currency(data); + }); + Handlebars.registerHelper("dec", function(data){ + if(!data) + return ""; + return $.jsFormControls.Format.decimal(data); + }); + Handlebars.registerHelper("percent", function(data){ + if(!data) + return "0"; + return $.jsFormControls.Format.decimal(data*100); + }); + Handlebars.registerHelper("date", function(data){ + if(!data) + return ""; + return $.jsFormControls.Format.date(data); + }); + Handlebars.registerHelper("time", function(data){ + if(!data) + return ""; + return $.jsFormControls.Format.time(data); + }); + Handlebars.registerHelper("datetime", function(data){ + if(!data) + return ""; + return $.jsFormControls.Format.dateTime(data); + }); + Handlebars.registerHelper("dateTime", function(data){ + if(!data) + return ""; + return $.jsFormControls.Format.dateTime(data); + }); + Handlebars.registerHelper("timespan", function(data){ + if(!data) + return ""; + return $.jsFormControls.Format.humanTime(data); + }); + Handlebars.registerHelper("byte", function(data){ + if(!data) + return ""; + return $.jsFormControls.Format.byte(data); + }); + } + + function JsFormControls(element) { + this.element = element; + + // init the dom functionality + this._domInit(); + } + + /** + * init the dom. This can be called multiple times. + * this will also enable "add", "insert" and "delete" for collections + * @private + */ + JsFormControls.prototype._domInit = function() { + var location = $(this.element); + // validation + // check required (this is the first check) + location.find("input.mandatory,textarea.mandatory").on("keyup", function(){ + // check for "null" as value as well + if($(this).val().length > 0 && $(this).val() !== "null") { + $(this).addClass("valid").removeClass("invalid"); + } else { + $(this).removeClass("valid").addClass("invalid"); + } + }); + + location.find("input.mandatory,textarea.mandatory").on("change", function(){ + if($(this).hasClass("object")) { + if($(this).data().pojo) { + $(this).addClass("valid").removeClass("invalid"); + } else { + $(this).removeClass("valid").addClass("invalid"); + } + return; + } + // check for "null" as value as well + if($(this).val().length > 0 && $(this).val() !== "null") { + $(this).addClass("valid").removeClass("invalid"); + } else { + $(this).removeClass("valid").addClass("invalid"); + } + }).change(); + + location.find("select.mandatory").change(function(){ + // check for "null" as value as well + if($(this).val() !== null && $(this).val() !== "null" && $(this).val().length > 0) { + $(this).addClass("valid").removeClass("invalid"); + } else { + $(this).removeClass("valid").addClass("invalid"); + } + }).change(); + + // show datepicker for all inputs + location.find("input.date").each(function(){ + var format = $(this).attr("data-format"); + // only if jquery ui is available + if($(this).datepicker) { + if(format) + $(this).datepicker({dateFormat: format}); + else + $(this).datepicker(); + } + }); + + + // input validation (number) + var numberRegexp = new RegExp("^[0-9.,-]+$"); + location.find("input.number").keyup(function(){ + var val = $(this).val(); + if(val.length > 0) { + if($(this).hasClass("autoclean")) { + $(this).val(val.replace(/[^0-9.,-]/g, "")); + } + else { + if(numberRegexp.test($(this).val())) { + $(this).addClass("valid").removeClass("invalid"); + } else { + $(this).removeClass("valid").addClass("invalid"); + } + } + } + }).keyup(); + + // currency formatting (add decimal) + location.find("input.currency").change(function(){ + var val = $(this).val(); + if(val.length > 0) { + $(this).val($.jsFormControls.Format.currency($.jsFormControls.Format._getNumber(val))); + } + }); + + location.find("input.percent").change(function(){ + var val = $(this).val(); + if(val.length > 0) { + $(this).val($.jsFormControls.Format.decimal($.jsFormControls.Format._getNumber(val))); + } + }); + + + // decimal formatting (add decimal) + location.find("input.decimal").change(function(){ + var val = $(this).val(); + if(val.length > 0) { + $(this).val($.jsFormControls.Format.decimal($.jsFormControls.Format._getNumber(val))); + } + }); + + var integerRegexp = new RegExp("^[0-9]+$"); + location.find("input.integer").keyup(function(){ + var val = $(this).val(); + if(val.length > 0) { + if($(this).hasClass("autoclean")) { + $(this).val(val.replace(/[^0-9]/g, "")); + } + else { + if(integerRegexp.test($(this).val())) { + $(this).addClass("valid").removeClass("invalid"); + } else { + $(this).removeClass("valid").addClass("invalid"); + } + } + } + }).keyup(); + + // regular expression + location.find("input.regexp").each(function(){ + if($(this).hasClass("autoclean")) { + $(this).data("regexp", new RegExp($(this).attr("data-regexp"), "g")); + } + else { + $(this).data("regexp", new RegExp($(this).attr("data-regexp"))); + } + + $(this).keyup(function(){ + var val = $(this).val(); + if(val.length > 0) { + var regexp = $(this).data("regexp"); + if($(this).hasClass("autoclean")) { + $(this).val(val.replace(regexp, "")); + } + else { + if(regexp.test($(this).val())) { + $(this).addClass("valid").removeClass("invalid"); + } else { + $(this).removeClass("valid").addClass("invalid"); + } + } + } else { + // if not mandatory: nothing is valid + if(!$(this).hasClass("mandatory")) { + $(this).removeClass("invalid").addClass("valid"); + } + } + }).keyup(); + $(this).change(function(){ + $(this).keyup(); + }); + }); + + /* rotatestate stontrol */ + location.find("input.rotatestate").each(function(){ + var states = $(this).attr("data-state-values"); + var defaultClass = $(this).attr("data-state-class"); + // no need to continue if there are no states + if(!states) { + return; + } + + try { + states = JSON.parse(states); + } catch (ex) { + // do not need to continue if we cannot parse the states + return; + } + + var stateControl = $(""); + if($(this).attr("title")) { + stateControl.attr("title", $(this).attr("title")); + } + if($(this).attr("data-state-style")) { + stateControl.attr("style", $(this).attr("data-state-style")); + } + stateControl.data("states", states); + stateControl.data("control", this); + stateControl.data("activeState", null); + $(this).data("control", stateControl); + if(defaultClass) { + stateControl.addClass(defaultClass); + } + + // click on the control starts rotating + stateControl.click(function(){ + var cState = $(this).data().activeState; + var cStates = $(this).data().states; + var control = $(this).data().control; + var newState = null; + + if(cState !== null) { + // go to the 'next' state + for(var i = 0; i < cStates.length; i++) { + if(cStates[i].value === cState.value) { + // last element + if(i === cStates.length - 1) { + newState = cStates[0]; + } else { + newState = cStates[i+1]; + } + break; + } + } + } else { + // no state yet - set the first entry as state + newState = cStates[0]; + } + + $(control).attr("value", newState.value); + // trigger change + $(control).change(); + }); + + // make sure to update state if the value is changed + $(this).change(function(){ + var control = $($(this).data().control); + var cState = control.data().activeState; + var cStates = control.data().states; + + if(cState !== null) { + // remove "old state" + control.removeClass(cState['class']); + } + + // add new State + var val = $(this).val(); + $.each(cStates, function(){ + if(this.value === val) { + control.data().activeState = this; + if(this.title) { + control.attr("title", this.title); + } + control.addClass(this['class']); + return false; + } + }); + }); + + // trigger initial state + $(this).change(); + $(this).after(stateControl); + $(this).hide(); + }); + }; + + + /** + * validate a given form + * @return true if the form has no invalid fields, false otherwise + */ + JsFormControls.prototype.validate = function() { + // validation + $(".required,.regexp,.date,.mandatory,.number,.validate", this.element).change(); + + // check for invalid fields + if($(".invalid", this.element).length > 0) { + return false; + } + + return true; + }; + + // init and call methods + $.fn.jsFormControls = function ( method ) { + // Method calling logic + if ( typeof method === 'object' || ! method ) { + return this.each(function () { + if (!$(this).data('jsFormControls')) { + $(this).data('jsFormControls', new JsFormControls( this, method )); + } + }); + } else { + var args = Array.prototype.slice.call( arguments, 1 ); + + // only one - return directly + if(this.length == 1) { + var jsFormControls = $(this).data('jsFormControls'); + if (jsFormControls) { + if(method.indexOf("_") !== 0 && jsFormControls[method]) { + var ret = jsFormControls[method].apply(jsFormControls, args); + return ret; + } + + $.error( 'Method ' + method + ' does not exist on jQuery.jsFormControls' ); + return false; + } + } + + return this.each(function () { + var jsFormControls = $.data(this, 'jsFormControls'); + if (jsFormControls) { + if(method.indexOf("_") !== 0 && jsFormControls[method]) { + return jsFormControls[method].apply(jsFormControls, args); + } else { + $.error( 'Method ' + method + ' does not exist on jQuery.jsFormControls' ); + return false; + } + } + }); + } + }; + + /** + * global jsForm function for intialisation + */ + $.jsFormControls = function ( name, initFunc ) { + var jsForms; + // initFunc is a function -> initialize + if($.isFunction(initFunc)) { + // call init if already initialized + jsForms = JSFORM_MAP[name]; + if(jsForms) { + $.each(jsForms, function(){ + initFunc(this, $(this.element)); + }); + } + + // remember for future initializations + JSFORM_INIT_FUNCTIONS[name] = initFunc; + } else { + // call init if already initialized + jsForms = JSFORM_MAP[name]; + if(jsForms) { + var method = initFunc; + var args = Array.prototype.slice.call( arguments, 2 ); + $.each(portlets, function(){ + this[method].apply(this, args); + }); + } + } + }; + + $.jsFormControls.Format = { + /** + * format a string based on teh classes in a dom element + */ + format: function(ele, cdata) { + if($(ele).hasClass("dateTime")) { + if(isNaN(cdata)) + return cdata; + return $.jsFormControls.Format.dateTime(cdata); + } if($(ele).hasClass("datetime")) { + if(isNaN(cdata)) + return cdata; + return $.jsFormControls.Format.dateTime(cdata); + } else if($(ele).hasClass("date")) { + if(isNaN(cdata)) + return cdata; + return $.jsFormControls.Format.date(cdata); + } else if($(ele).hasClass("currency")) { + return $.jsFormControls.Format.currency(cdata); + } else if($(ele).hasClass("byte")) { + if(isNaN(cdata)) + return cdata; + return $.jsFormControls.Format.byte(cdata); + } else if($(ele).hasClass("decimal")) { + return $.jsFormControls.Format.decimal(cdata); + } else if($(ele).hasClass("percent")) { + return $.jsFormControls.Format.decimal(cdata); + } + + return cdata; + }, + + /** + * internal function that tries to identify where the value is. + * This is necessary to support direct call, jqGrid and slickGrid + * @param row + * @param cell + * @param value + * @param columnDef + * @param dataContext + * @private + */ + _getValue: function(row, cell, value, columnDef, dataContext) { + // if value is undefined: this is probably a direct call + if(typeof cell === "undefined" && typeof value === "undefined") { + return row; + } + + // check for slickGrid: row/cell/value + if(!isNaN(row) && typeof cell !== "undefined" && typeof value !== "undefined") { + return value; + } + }, + + /** + * format boolean into an ui-icon + * @param value true or false + * @returns the ui-icon span + */ + checkBox: function(row, cell, value, columnDef, dataContext) { + value = $.jsFormControls.Format._getValue(row, cell, value, columnDef); + + if(value) { + return ' '; + } else { + return ' '; + } + + return value; + }, + + + /** + * take a string and convert it into a number + * @private + */ + _getNumber: function(num) { + if (!num) { + return null; + } + + // default number format + var numberformat = { + format: "#,##0.###", + groupingSeparator: ",", + decimalSeparator: "." + }; + + if(typeof i18n !== "undefined") + numberformat = i18n.number; + else if($(document).data().i18n && $(document).data().i18n.number) + numberformat = $(document).data().i18n.number; + // make sure num is a string + num = "" + num; + // get rid of the grouping seperator (if any exist) + if(num.indexOf(numberformat.groupingSeparator) !== -1) + num = num.replace(numberformat.groupingSeparator, "", "g"); + // now convert the decimal seperator into a "real" decimal + if(numberformat.decimalSeparator !== '.' && num.indexOf(numberformat.decimalSeparator) !== -1) { + num = num.replace(numberformat.decimalSeparator, ".", "g"); + } + + return Number(num); + }, + + + /** + * @private + */ + _pad: function(val) { + var o = (val < 10) ? "0" : ""; + o += val; + return o; + }, + + asNumber: function(value) { + return $.jsFormControls.Format._getNumber(value); + }, + + byte: function(bytes) { + if (bytes === "" || !bytes || isNaN(bytes)) { + return bytes; + } + + var unit = 1024; + if (bytes < unit) return bytes + " B"; + var exp = Math.floor(Math.log(bytes) / Math.log(unit)); + var pre = "KMGTPE".charAt(exp-1) + "B"; + return Math.round(bytes*10 / Math.pow(unit, exp))/10 + pre; + }, + + /** + * @private + */ + decimal: function(num) { + if (num === "" || !num || isNaN(num)) { + return num; + } + + // default number format + var numberformat = { + format: "#,##0.###", + groupingSeparator: ",", + decimalSeparator: "." + }; + + if(typeof i18n !== "undefined") + numberformat = i18n.number; + else if($(document).data().i18n && $(document).data().i18n.number) + numberformat = $(document).data().i18n.number; + + var comma = 0; + if (Math.abs(num - Math.floor(num)) > 0.001) { + comma = 2; + } + // convert to a nice number for display + var n = num, + c = isNaN(c = Math.abs(comma)) ? 2 : comma, + d = numberformat.decimalSeparator, // decimal d == undefined ? "," : d, + t = numberformat.groupingSeparator, // thousand: t == undefined ? "." : t, + i = parseInt(n = Math.abs( +n || 0).toFixed(c), 10) + "", + j = (j = i.length) > 3 ? j % 3 : 0; + return (num<0 ? "-" : "") + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); + }, + + + /** + * @private + */ + currency: function(row, cell, value, columnDef, dataContext) { + value = $.jsFormControls.Format._getValue(row, cell, value, columnDef); + + if(!value) { + if(cell) { + return " "; + } + return "0"; + } + + return $.jsFormControls.Format.decimal(value); + }, + + /** + * @private + */ + dateTime: function(row, cell, value, columnDef, dataContext) { + value = $.jsFormControls.Format._getValue(row, cell, value, columnDef); + + if(!value) { + if(cell) { + return " "; + } + return ""; + } + + return (this.date(value) + " " + this.time(value)); + }, + + /** + * @private + */ + date: function(row, cell, value, columnDef, dataContext) { + value = $.jsFormControls.Format._getValue(row, cell, value, columnDef); + if(!value || value === "" || isNaN(value)) { + if(cell) { + return " "; + } + return ""; + } + + var d = new Date(); + d.setTime(value); + var year = d.getYear(); + if(year < 1900) { + year += 1900; + } + + // default number format + var dateformat = null; + + if(typeof i18n !== "undefined") + dateformat = i18n.date; + else if($(document).data().i18n && $(document).data().i18n.date) + dateformat = $(document).data().i18n.date; + + if($.format) + return $.format.date(d, dateformat.shortDateFormat); + else + return this._pad(d.getDate()) + "." + this._pad((d.getMonth()+1)) + "." + this._pad(year); + }, + + /** + * @private + */ + time: function(row, cell, value, columnDef, dataContext) { + value = $.jsFormControls.Format._getValue(row, cell, value, columnDef); + if(!value || value === "" || isNaN(value)) { + if(cell) { + return " "; + } + return ""; + } + + var d = new Date(); + d.setTime(value); + + var timeFormat = "HH:mm"; + if(typeof i18n !== "undefined") { + if(i18n.timeFormat) + timeFormat = i18n.timeFormat; + else if (i18n.date && i18n.date.timeFormat) + timeFormat = i18n.date.timeFormat; + } else if($(document).data().i18n && typeof $(document).data().i18n.timeFormat !== "undefined") + timeFormat = $(document).data().i18n.timeFormat; + + if($.format) + return $.format.date(d, timeFormat); + else + return this._pad(d.getHours()) + ":" + this._pad(d.getMinutes()); // + ":" + pad(d.getSeconds()); don't need seconds + }, + + /** + * + * @param value a string value to format + * @param allowms true to allow komma (i.e. 00.00) + * @return something in the form of 00:00.00 + * @private + */ + timespan: function(row, cell, value, columnDef, dataContext) { + value = $.jsFormControls.Format._getValue(row, cell, value, columnDef); + + var tokens = value.split(":"); + // check each token + for(var i=0; i 0) { + out += h + "h "; + // ignore seconds and milliseconds if we have hours + s = 0; + value = 0; + } + if (m > 0) { + out += m + "m "; + // ignore milliseconds + value = 0; + } + if (s > 0) { + out += s + "s "; + value = 0; + } + + if (value > 0) { + out += value + "ms"; + } + // trim output + return out.trim(); + } + }; + +})( jQuery, window ); + + +/** + * @returns the trimmed string + */ +String.prototype.trim = function() { + return this.replace(/^\s+|\s+$/g, ""); +}; + +/* check start of a string */ +String.prototype.startsWith = function(str) { + if((this === null) || (this.length <= 0)) + return false; + if((str === null) || (str == "null") || (str.length <= 0)) + return false; + if(this.substr(0, str.length) == str) + return true; + return false; +}; + +/* check start of a string */ +String.prototype.startsWithIgnoreCase = function(str) { + if((this === null) || (this.length <= 0)) + return false; + if((str === null) || (str == "null") || (str.length <= 0)) + return false; + if(this.substr(0, str.length).toLowerCase() == str.toLowerCase()) + return true; + return false; +}; + +/* check end of a string */ +String.prototype.endsWith = function(str) { + if((this === null) || (this.length <= 0)) + return false; + if((str === null) || (str == "null") || (str.length <= 0) || (str.length > this.length)) + return false; + if(this.substr(this.length - str.length) == str) + return true; + return false; +}; \ No newline at end of file diff --git a/dist/jquery.jsForm.1.1.2.min.js b/dist/jquery.jsForm.1.1.2.min.js new file mode 100644 index 0000000..65ad2ee --- /dev/null +++ b/dist/jquery.jsForm.1.1.2.min.js @@ -0,0 +1,6 @@ +/*! + * jQuery.jsForm v1.1.2 | (c) 2013 Niko Berger http://www.gargan.org/ + * Usage: https://github.com/corinis/jsForm + */ +(function(t,e,a){"use strict";function i(e,a){var i=t(e);this.options=t.extend({},{controls:!0,data:null,prefix:"data",trackChanges:"changed",validateHidden:!0,skipEmpty:!1,renderer:null,processors:null,connect:null},a),!i.attr("data-prefix")||"data"!==this.options.prefix&&""!==this.options.prefix||""!==i.attr("data-prefix")&&(this.options.prefix=i.attr("data-prefix")),this.element=e,this._init()}var s={},n={};i.prototype._init=function(){if(this._domInit(),this.options.controls)if(t.jsFormControls)t.each(this._getForm(),function(){t(this).jsFormControls()});else try{"undefined"!=typeof console&&console.log("jquery.JsForm.controls not available!")}catch(e){}this._fill(this.options)},i.prototype.connect=function(e){this._initCollection(e,this.options.prefix),this._initConditional(e,this.options.prefix,this.options),this.options.controls&&t.jsFormControls&&t(e).jsFormControls(),this._fillDom(e),this.options.connect||(this.options.connect=[]),this.options.connect.push(e)},i.prototype.getNodes=function(){return this._getForm()},i.prototype._domInit=function(){var e=this;t.each(this._getForm(),function(){e._initCollection(this,e.options.prefix),e._initConditional(this,e.options.prefix,e.options)})},i.prototype._debug=function(a,i){try{if(!e.console||!e.console.log)return;var s=null;s=t.isPlainObject(i)?JSON.stringify(i,null," "):i,s||(s=""),e.console.log(a+s)}catch(n){}},i.prototype._initConditional=function(e,a,i){var s=this,n=function(e,a,i){var n=!1;t.each(i,function(){var t=s._getValueWithArrays(a,this);if(t&&""!==t&&0!==t&&-1!==t)return n=!0,!1}),n?e.show():e.hide()},r=function(e,a,i){var n=!1;t.each(i,function(){var t=s._getValueWithArrays(a,this);if(t&&""!==t&&0!==t&&-1!==t)return n=!0,!1}),n?e.hide():e.show()};this.conditionals=t(e).find(".conditional"),this.conditionals.each(function(){t(this).data().conditionalEval=[];var e=t(this).attr("data-show");e&&e.length>0&&t(this).data().conditionalEval.push({func:n,field:e.split(" ")}),e=t(this).attr("data-hide"),e&&e.length>0&&t(this).data().conditionalEval.push({func:r,field:e.split(" ")}),e=t(this).attr("data-eval"),e&&e.length>0&&i.conditionals[e]&&t(this).data().conditionalEval.push({func:i.conditionals[e]})})},i.prototype._evaluateConditionals=function(e,a){this.conditionals.each(function(){var e=t(this);t.each(e.data().conditionalEval,function(){this.func(e,a,this.field)})})},i.prototype._initCollection=function(e,a){var i={},s=this;t(e).data().collections=i,t(".collection",e).each(function(){var e=t(this).attr("data-field");if(e&&0===e.indexOf(a+".")){var n=t(this),r=i[e];if(r?r.push(n):i[e]=[n],s._initList(n),!n.hasClass("ui-sortable")&&n.hasClass("sortable")&&n.sortable){var o=n.attr("data-sortable");o=o?JSON.parse(o):{},n.sortable(o),n.on("sortstop",function(){s._reorder(n)})}}}),t(".add",e).each(function(){var e=t(this).attr("data-field");e&&(t(this).data("collections")||(t(this).data().collections=i[e],t(this).click(function(a){a.preventDefault(),t.each(t(this).data("collections"),function(){var a=t(this).data("template");if(a){var i=a.clone(!0);t(i).addClass("POJO"),t(i).data().pojo={},t(this).append(i),s._enableTracking(t("input,textarea,select",i)),s.options.trackChanges&&t("input,textarea,select",i).addClass(s.options.trackChanges),s._addCollectionControls(i),t(this).trigger("addCollection",[i,t(i).data().pojo]),s._initCollection(i,e.substring(e.indexOf(".")+1)),t(this).trigger("postAddCollection",[i,t(i).data().pojo])}})})))}),t(".insert",e).each(function(){var e=t(this).attr("data-field");e&&(t(this).data("collections")||(t(this).data("collections",i[t(this).attr("data-field")]),t(this).on("insert",function(a,i){if(i||(i=t(this).data().pojo),i){var n=t(this).data("beforeInsert");n&&t.isFunction(n)&&!(i=n(i))||(t.each(t(this).data("collections"),function(){var a=t(this).data("template");if(a){var n=a.clone(!0);n.addClass("POJO"),n.data().pojo=i,s._addCollectionControls(n),s._initCollection(n),t(this).trigger("addCollection",[n,t(n).data().pojo]);var r=t(this).children(".POJO").length;s._fillData(n,i,e.substring(e.indexOf(".")+1),r),t(this).append(n)}}),t(this).val(""),t(this).data().pojo=null,t(this).focus())}})))}),t(".insertAction",e).each(function(){var e=t(this).attr("data-field");if(e&&!t(this).data("inserter")){var a=t(this).parent().find(".insert");a&&(t(this).data("inserter",a),t(this).click(function(e){return e.preventDefault(),t(this).data("inserter").trigger("insert"),!1}))}}),t("input.object",e).each(function(){t(this).on("update",function(){var e=t(this).data().pojo;e&&t(this).attr("data-display")&&t(this).val(s._renderObject(e,t(this).attr("data-display")))})}),t("input.blob",e).each(function(){if("file"===t(this).attr("type")){var e=t(this);t(this).on("change",function(a){var i=t(this).val().split(/\\/).pop();e.data("name",i);var s=a.target.files;s&&s.length&&t.each(s,function(){var a=new FileReader;a.onload=function(t){e.data("blob",t.target.result)},a.readAsDataURL(this),t(this).trigger("fileChange")})})}})},i.prototype._initList=function(t){if(!t.data("template")){var e=t.children().detach();e.removeAttr("id"),t.data("template",e)}},i.prototype._getForm=function(){var e=[t(this.element)];return this.options.connect&&t.each(this.options.connect,function(){e.push(t(this))}),e},i.prototype._clear=function(e,a){a||(a=this.options.prefix),t(e).removeData("pojo"),t("input,select,textarea",e).each(function(){var e=t(this).attr("name");e&&0===e.indexOf(a+".")&&(e=e.substring((a+".").length),1>e.length||(t(this).removeData("pojo"),"checkbox"===t(this).attr("type")?t(this).prop("checked",!1):t(this).val(""),t(this).hasClass("blob")&&t(this).removeData("blob"),t(this).is("select")&&(t('option[selected="selected"]',this).prop("selected",!1),t("option:first",this).prop("selected",!0),t(this).val(t("option:first",this).val()).change()),t(this).change()))}),t(".collection",e).each(function(){var e=t(this).attr("data-field");e&&0===e.indexOf(a+".")&&t(this).empty()})},i.prototype._createPojoFromInput=function(e,i,s){var n=null,r=this;return t(e).data("pojo")&&(n=t(e).data("pojo")),n&&t.extend(!0,s,n),t(e).find("input,select,textarea,.jsobject").each(function(){var e=t(this).attr("data-name");if(e||(e=t(this).attr("name")),e&&!t(this).hasClass("transient")&&0===e.indexOf(i+".")){t(this).trigger("validate",!0),e=e.substring((i+".").length);var n=t(this).val();if(t(this).hasClass("jsobject"))n=t(this).data("pojo");else{if(r.options.skipEmpty&&(!n||""===n||""===n.trim()))return;if(!t(this).hasClass("emptynull")||n&&""!==n&&"null"!==n&&""!==n.trim())if(t(this).hasClass("object")||t(this).hasClass("POJO"))if(n=t("option:selected",this).data()&&t("option:selected",this).data().pojo?t("option:selected",this).data().pojo:t(this).data("pojo"),t.isFunction(t(this).data().processor))n=t(this).data().processor(n);else{var o=t(this).attr("data-processor");o&&r.options.processors[o]&&(n=r.options.processors[o](n))}else t(this).hasClass("blob")?n=t(this).data("blob"):""===n&&(t(this).hasClass("number")||t(this).hasClass("percent")||t(this).hasClass("integer")||t(this).hasClass("dateFilter")||t(this).hasClass("dateTimeFilter"))&&(n=null);else n=null;if(t(this).hasClass("percent"))n=r._getNumber(n),isNaN(n)?n=0:n/=100;else if(t(this).hasClass("number")||t(this).hasClass("integer")){if(t(this).hasClass("date")&&isNaN(n))if(t.format){var l=t.format.date(n);l.setHours(0),l.setMinutes(0),l.setSeconds(0),l.setMilliseconds(0),n=l.getTime()}else n=new Date(n).getTime();else n=r._getNumber(n);isNaN(n)&&(n=0)}else"checkbox"===t(this).attr("type")||"CHECKBOX"===t(this).attr("type")?n=t(this).hasClass("array")?t(this).val():t(this).is(":checked"):t(this).hasClass("bool")&&(n="true"===t(this).val())}if(1>e.length)return s=n,!1;if(-1===e.indexOf("."))if(t(this).hasClass("array"))if(s[e]||(s[e]=[]),"checkbox"===t(this).attr("type")||"CHECKBOX"===t(this).attr("type")){var h=t(this).is(":checked"),d=!0;t.each(s[e],function(t,i){return this==n?(d=!1,h||s[e].splice(i,1),!1):a}),d&&h&&s[e].push(n)}else{var c=t(this).attr("data-array");c=!c||isNaN(c)?null:Number(c),null===c?s[e].push(n):s[e][c]=n}else s[e]=n;else{var u,f,p=e.split("."),m=s[p[0]];m&&t.isPlainObject(m)||(s[p[0]]={},m=s[p[0]]),2===p.length?m[p[1]]=n:3===p.length?(u=m[p[1]],(u===a||null===u)&&(u={},m[p[1]]=u),u[p[2]]=n):4===p.length&&(u=m[p[1]],(null===u||u===a)&&(u={},m[p[1]]=u),f=u[p[2]],(f===a||null===u)&&(f={},u[p[2]]=f),u[p[2]]=n,f[p[3]]=n)}}}),s},i.prototype._enableTracking=function(e){var a=this;a.options.trackChanges&&!t(e).data().track&&(t(e).data().track=!0,t(e).change(function(){t(this).val()!==t(this).data().orig?t(this).addClass(a.options.trackChanges):t(this).removeClass(a.options.trackChanges)}))},i.prototype._fillData=function(e,i,s,n){var r=this,o=t(e);o.find(".field").each(function(){var e=t(this).data("name");if(e||("A"===this.nodeName.toUpperCase()?(e=t(this).attr("href"),t(this).attr("href","#")):"IMG"===this.nodeName.toUpperCase()?(e=t(this).attr("src"),0===e.indexOf("#")&&(e=e.substring(1)),t(this).attr("src","#")):e=t(this).text(),t(this).data("name",e),t(this).show()),!s||e.indexOf(s+".")>=0){var a=e;s&&(a=a.substring(s.length+1));var o=r._get(i,a,!1,n);o||(o=""),t(this).hasClass("percent")&&!isNaN(o)&&(o=100*Number(o)),t.jsFormControls&&(o=t.jsFormControls.Format.format(this,o)),"A"===this.nodeName.toUpperCase()?t(this).attr("href",o):"IMG"===this.nodeName.toUpperCase()?t(this).attr("src",o):"DIV"===this.nodeName.toUpperCase()?t(this).html(o):t(this).text(o)}}),t("input, textarea",o).each(function(){var e=t(this).attr("name");if(e&&(r._enableTracking(this),"file"!=t(this).attr("type")&&(!s||e.indexOf(s+".")>=0))){var o=e;s&&(o=o.substring(s.length+1));var l=r._get(i,o,!1,n);if(t(this).hasClass("object")?(t(this).data().pojo=l,t(this).addClass("POJO"),(t(this).attr("data-display")||t(this).attr("data-render"))&&(l=r._renderObject(l,t(this).attr("data-display"),t(this).attr("data-render")))):t(this).hasClass("jsobject")?(t(this).data().pojo=l,t(this).addClass("POJO")):t(this).hasClass("percent")&&!isNaN(l)?l=100*Number(l):t.isPlainObject(l)&&(t(this).data().pojo=l,t(this).addClass("POJO"),l=r._renderObject(l,t(this).attr("data-display"),t(this).attr("data-render"))),"checkbox"===t(this).attr("type"))if(t(this).hasClass("array")){var h=t(this).val(),d=!1;l&&t.each(l,function(){return this==h?(d=!0,!1):a}),t(this).prop("checked",d)}else t(this).prop("checked",l===!0||"true"===l);else if(l||(l=""),t.jsFormControls&&(l=t.jsFormControls.Format.format(this,l)),t(this).hasClass("array")){var c=t(this).attr("data-array");c=!c||isNaN(c)?null:Number(c),null!==c&&l&&l.length>c?t(this).val(l[c]):t(this).val("")}else t(this).val(l);t(this).data().orig=t(this).val(),t(this).change(),t(this).trigger("fill")}}),t("select",o).each(function(){var e=t(this).attr("name");if(e&&(!s||e.indexOf(s+".")>=0)){var o=e;s&&(o=o.substring(s.length+1)),r._enableTracking(this),t(this).children("option:selected").prop("selected",!1);var l=t(this).attr("data-key");l||(l="id");var h=r._get(i,o,!1,n);if(h[l]||!isNaN(h[l]))return t(this).children("option[value='"+h[l]+"']").prop("selected",!0),t(this).val(h[l]).change(),a;t(this).hasClass("bool")&&(h=h?"true":"false"),t(this).children("option[value='"+h+"']").prop("selected",!0),t(this).data().orig=h,t(this).val(h).change(),t(this).trigger("fill")}})},i.prototype.get=function(e){var a=this,i=this.options.data,s=this.options.prefix,n={};i&&t.isPlainObject(i)&&(n=t.extend({},i));var r=!1;return t.each(this._getForm(),function(){a._createPojoFromInput(this,s,n),a.options.validateHidden?this.find(".invalid").each(function(){return r=!0,t(this).focus(),!1}):this.find(".invalid").filter(":visible").each(function(){return r=!0,t(this).focus(),e||a._debug("Found invalid field: "+t(this).attr("name")),!1}),a._getCollection(this,s,n,e)&&(r=!0)}),!e&&r?null:n},i.prototype._getCollection=function(e,a,i,s){var n=this,r=!1;return e.find(".collection").each(function(){if(s||!r){var e=t(this).attr("data-field");if(e&&0===e.indexOf(a+".")){e=e.substring((a+".").length);var o=n._getParent(i,e,!0);-1!==e.indexOf(".")&&(e=e.substring(e.lastIndexOf(".")+1)),o[e]=[],t(this).children().each(function(){var a={};if(a=n._createPojoFromInput(t(this),e,a),n._getCollection(t(this),e,a,s),n._isEmpty(a))t(".invalid",this).removeClass("invalid");else{if(t(".invalid",this).length>0&&(r=!0,!s))return!1;o[e].push(a)}})}}}),r},i.prototype.getData=function(){return this.options.data||(this.options.data={}),this.options.data},i.prototype.preventEditing=function(e){var i=t(this.element);if(e===a)e=i.data("disabled")?!1:!0;else if(e===i.data("disabled"))return;e?(i.find("input, textarea").each(function(){if(!t(this).closest("span.form")[0]&&"hidden"!=t(this).attr("type")){var e=t(this).val();("null"===e||null===e||"submit"===t(this).attr("type"))&&(e=""),t(this).hasClass("trueFalse")&&(e=t(this).is(":checked")?"X":" "),e=e.replace(//g,">").replace(/\n/g,"
");var a=t(''+e+"");t(this).parent().hasClass("ui-wrapper")?t(this).parent().hide().wrap(a):t(this).hide().wrap(a)}}),i.find("select").each(function(){if(!t(this).closest("span.form")[0]){var e=t(this).children(":selected").html();("null"===e||null===e)&&(e="");var a=t(''+e+"");t(this).hasClass("ui-toggle-switch")?t(this).prev().hide().wrap(a):t(this).hide().wrap(a)}})):i.find("span.form").each(function(){var e=t(this).children("input,select,textarea,.ui-wrapper,.ui-toggle-switch").show().detach();t(this).before(e),t(this).remove()}),i.data("disabled",e)},i.prototype.validate=function(){var e=!0;return t.each(this._getForm(),function(){t(".required,.regexp,.date,.mandatory,.number,.validate,.integer",this).change(),t(".invalid",this).length>0&&(e=!1)}),e},i.prototype._fill=function(){var e=this;t(this.element).addClass("POJO"),t(this.element).data("pojo",this.options.data),t.each(this._getForm(),function(){e._fillDom(this)})},i.prototype._fillDom=function(t){var e=this;e._clear(t,e.options.prefix),e._fillData(t,e.options.data,e.options.prefix),e._fillCollection(t,e.options.data,e.options.prefix),e._evaluateConditionals(t,e.options.data)},i.prototype._fillCollection=function(e,a,i){var s=this;t(".collection",e).each(function(){var e=t(this),n=t(this).attr("data-field");if(a&&n&&0===n.indexOf(i+".")){var r=null,o=n;i&&(o=o.substring(i.length+1)),r=s._get(a,o),r&&s._fillList(e,r,o)}})},i.prototype._fillList=function(e,a,i,s){var n=e.data("template"),r=this;if(n&&(e.empty(),t.isArray(a))){if(-1!==i.indexOf(".")&&(i=i.substring(i.lastIndexOf(".")+1)),t(e).hasClass("sort")){var o=t(e).attr("data-sort");if(o){switch(t(e).attr("data-sorttype")){case"alpha":a.sort();break;case"alphainsensitiv":a.sort(function(t,e){return t=t[o],e=e[o],t&&(t=t.toLowerCase()),e&&(e=e.toLowerCase()),e>t?-1:t>e?1:0});break;default:a.sort(function(t,e){return t[o]-e[o]})}t(e).attr("data-sortdesc")&&a.reverse()}}s||t.isFunction(i)&&(s=i,i=null);for(var l=0;a.length>l;l++){var h=a[l],d=n.clone(!0);d.data().pojo=h,d.addClass("POJO"),s&&s(d,h)===!1||(r._addCollectionControls(d),i&&(r._fillData(d,h,i,l+1),r._initCollection(d,i),r._fillCollection(d,h,i)),e.append(d))}}},i.prototype._addCollectionControls=function(e){var a=this;t.jsFormControls&&t(e).jsFormControls(),t(".delete",e).click(function(){var e=t(this).closest(".POJO");t(this).closest(".collection").trigger("deleteCollection",[e,t(e).data().pojo]),e.remove()}),t(".sortUp",e).click(function(){var e=t(this).closest(".POJO"),i=e.prev(".POJO");0!==i.size()&&(e.detach(),i.before(e),a._reorder(e))}),t(".sortDown",e).click(function(){var e=t(this).closest(".POJO"),i=e.next(".POJO");0!==i.size()&&(e.detach(),i.after(e),a._reorder(e))});var i=t(e).closest(".collection");i.hasClass("sortable")&&t(i).sortable&&i.sortable("refresh")},i.prototype._reorder=function(e){e.attr("data-sort")||(e=e.closest(".collection"));var a=t(e).attr("data-sort");if(!(!a||t(e).attr("data-sorttype")&&"number"!==t(e).attr("data-sorttype")||t(e).attr("data-sortdesc")&&"false"!==t(e).attr("data-sortdesc"))){var i=0;t.each(t(e).children(),function(){var e=t(this).data("pojo");e||(e={},t(this).data("pojo",e)),e[a]=i++})}},i.prototype._renderObject=function(e,a,i){if(!e||!a&&!i)return"";if(i)return this.options.renderer&&this.options.renderer[i]?this.options.renderer[i](e):(this._debug("Unable to find renderer: "+i),"");var s=this,n="";return t.each(a.split(","),function(){var t=this.trim();n+=0===t.indexOf("'")||0===t.indexOf('"')?t.substring(1,t.length-1):s._get(e,t)}),n},i.prototype._get=function(t,e,i,s){var n,r,o,l="";if("function"==typeof e)return e(t);if(!t)return"";if(""===e)return t;if("$idx"===e)return s;if(n=t[e],!n)try{if("string"==typeof e&&(l=e.split(".")),o=l.length)for(n=t;n&&o--;)r=l.shift(),i&&!n[r]&&(n[r]={}),n=n[r]}catch(h){}return(null===n||n===a)&&(n=""),n.trim?n.trim():n},i.prototype._getValueWithArrays=function(t,e){e=e.split(".");for(var a=/(.*)\[(\d+)\]/,i=1;e.length>i;i++){var s=a.exec(e[i]);try{t=s?t[s[1]][parseInt(s[2],10)]:t[e[i]]}catch(n){this._debug(e+" "+n)}}return t},i.prototype._getParent=function(t,e,a){return-1===e.indexOf(".")?t:(e=e.substring(0,e.lastIndexOf(".")),this._get(t,e,a))},i.prototype._getNumber=function(e){return e?t.jsFormControls?t.jsFormControls.Format._getNumber(e):(-1!=e.indexOf(",")&&(e=e.replace(",","","g")),Number(e)):null},i.prototype._isEmpty=function(e){if(!e)return!0;if(t.isArray(e)){if(0===e.length)return!0;for(var a=0;e.length>a;a++)if(!this._isEmpty())return!1;return!0}if(t.isPlainObject(e)){if(t.isEmptyObject(e))return!0;for(var i in e)if(!this._isEmpty(e[i]))return!1;return!0}return isNaN(e)?""===e||" "===e:0===Number(e)||-1===Number(e)?!0:!1},i.prototype._equals=function(t,e,i){if(!t&&e&&e.length&&0===e.length)return!0;if(!e&&t&&t.length&&0===t.length)return!0;if(!t&&!e)return!0;var s=null;for(s in t){if(e[s]===a&&null!==t[s]&&""!==t[s]&&0!==t[s].length){if(("0"===t[s]||0===t[s])&&!e[s])continue;return!1}if(t[s])switch(typeof t[s]){case"object":if(i&&t[s][i]&&t[s][i]===e[s][i])continue;if(!this._equals(t[s],e[s]))return!1;break;case"function":break;default:if(!t[s]&&!e[s])break;if((t===!0||t===!1)&&t!==e)return!1;if(!isNaN(t[s])||!isNaN(e[s])){if(1e-7>Math.abs(Number(t[s])-Number(e[s])))break;return!1}if((""+t[s]).length!==(""+e[s]).length)return!1;if(t[s]!==e[s]&&Number(t[s])!==Number(e[s]))return!1}else if(e[s])return!1}for(s in e)if((!t||t[s]===a)&&null!==e[s]&&""!==e[s])return!1;return!0},i.prototype.equals=function(t,e){var a=this.get(!1);return this._equals(a,t,e)},i.prototype.changed=function(){if(!this.options.trackChanges)return!1;var e=!1,i=this;return t.each(this._getForm(),function(){return t("."+i.options.trackChanges,this).size()>0?(e=!0,!1):a}),e},i.prototype._equalsCollection=function(e,i,s){var n=this,r=!1;return t(".collection",e).each(function(){if(!r){var e=t(this).attr("data-field");if(e&&0===e.indexOf(i+".")&&(e=e.substring((i+".").length),!(1>e.length))){var o=0;t(this).children().each(function(){if(!r){if(o>=s[e].length)return r=!0,a;var i=s[e][o++];n._pojoDifferFromInput(t(this),e,i)&&(r=!0),n._equalsCollection(t(this),e,i)||(r=!0)}}),s[e]&&s[e].length>o&&(r=!0)}}}),!r},i.prototype.fill=function(e){this.options.data=t.extend({},e),this._fill()},i.prototype.applyConditions=function(t){t||(t=this.get(!0)),this._evaluateConditionals(this.element,t)},i.prototype.reset=function(){this.fill({})},i.prototype.clear=function(){var e=this;t.each(this._getForm(),function(){e._clear(this,e.options.prefix)})},i.prototype.destroy=function(){return t(this.element).each(function(){t(e).unbind(".jsForm"),t(this).removeData("jsForm")})},t.fn.jsForm=function(e){if("object"!=typeof e&&e){var s,n=Array.prototype.slice.call(arguments,1);if(0===this.length)return null;if(1===this.length&&(s=t(this).data("jsForm"))){if(0!==e.indexOf("_")&&s[e]){var r=s[e].apply(s,n);return r}return t.error("Method "+e+" does not exist on jQuery.jsForm"),!1}return this.each(function(){return s=t.data(this,"jsForm"),s?0!==e.indexOf("_")&&s[e]?s[e].apply(s,n):(t.error("Method "+e+" does not exist on jQuery.jsForm"),!1):a})}return this.each(function(){t(this).data("jsForm")||t(this).data("jsForm",new i(this,e))})},t.jsForm=function(e,a){var i=n[e];if(t.isFunction(a))i&&t.each(i,function(){a(this,t(this.element))}),s[e]=a;else if(i){var r=a,o=Array.prototype.slice.call(arguments,2);t.each(portlets,function(){this[r].apply(this,o)})}}})(jQuery,window),function(t){"use strict";function e(t){this.element=t,this._domInit()}var a={},i={};"undefined"!=typeof Handlebars&&(Handlebars.registerHelper("currency",function(e){return e?t.jsFormControls.Format.currency(e):"0"}),Handlebars.registerHelper("dec",function(e){return e?t.jsFormControls.Format.decimal(e):""}),Handlebars.registerHelper("percent",function(e){return e?t.jsFormControls.Format.decimal(100*e):"0"}),Handlebars.registerHelper("date",function(e){return e?t.jsFormControls.Format.date(e):""}),Handlebars.registerHelper("time",function(e){return e?t.jsFormControls.Format.time(e):""}),Handlebars.registerHelper("datetime",function(e){return e?t.jsFormControls.Format.dateTime(e):""}),Handlebars.registerHelper("dateTime",function(e){return e?t.jsFormControls.Format.dateTime(e):""}),Handlebars.registerHelper("timespan",function(e){return e?t.jsFormControls.Format.humanTime(e):""}),Handlebars.registerHelper("byte",function(e){return e?t.jsFormControls.Format.byte(e):""})),e.prototype._domInit=function(){var e=t(this.element);e.find("input.mandatory,textarea.mandatory").on("keyup",function(){t(this).val().length>0&&"null"!==t(this).val()?t(this).addClass("valid").removeClass("invalid"):t(this).removeClass("valid").addClass("invalid")}),e.find("input.mandatory,textarea.mandatory").on("change",function(){return t(this).hasClass("object")?(t(this).data().pojo?t(this).addClass("valid").removeClass("invalid"):t(this).removeClass("valid").addClass("invalid"),undefined):(t(this).val().length>0&&"null"!==t(this).val()?t(this).addClass("valid").removeClass("invalid"):t(this).removeClass("valid").addClass("invalid"),undefined)}).change(),e.find("select.mandatory").change(function(){null!==t(this).val()&&"null"!==t(this).val()&&t(this).val().length>0?t(this).addClass("valid").removeClass("invalid"):t(this).removeClass("valid").addClass("invalid")}).change(),e.find("input.date").each(function(){var e=t(this).attr("data-format");t(this).datepicker&&(e?t(this).datepicker({dateFormat:e}):t(this).datepicker())});var a=RegExp("^[0-9.,-]+$");e.find("input.number").keyup(function(){var e=t(this).val();e.length>0&&(t(this).hasClass("autoclean")?t(this).val(e.replace(/[^0-9.,-]/g,"")):a.test(t(this).val())?t(this).addClass("valid").removeClass("invalid"):t(this).removeClass("valid").addClass("invalid"))}).keyup(),e.find("input.currency").change(function(){var e=t(this).val();e.length>0&&t(this).val(t.jsFormControls.Format.currency(t.jsFormControls.Format._getNumber(e)))}),e.find("input.percent").change(function(){var e=t(this).val();e.length>0&&t(this).val(t.jsFormControls.Format.decimal(t.jsFormControls.Format._getNumber(e)))}),e.find("input.decimal").change(function(){var e=t(this).val();e.length>0&&t(this).val(t.jsFormControls.Format.decimal(t.jsFormControls.Format._getNumber(e)))});var i=RegExp("^[0-9]+$");e.find("input.integer").keyup(function(){var e=t(this).val();e.length>0&&(t(this).hasClass("autoclean")?t(this).val(e.replace(/[^0-9]/g,"")):i.test(t(this).val())?t(this).addClass("valid").removeClass("invalid"):t(this).removeClass("valid").addClass("invalid"))}).keyup(),e.find("input.regexp").each(function(){t(this).hasClass("autoclean")?t(this).data("regexp",RegExp(t(this).attr("data-regexp"),"g")):t(this).data("regexp",RegExp(t(this).attr("data-regexp"))),t(this).keyup(function(){var e=t(this).val();if(e.length>0){var a=t(this).data("regexp");t(this).hasClass("autoclean")?t(this).val(e.replace(a,"")):a.test(t(this).val())?t(this).addClass("valid").removeClass("invalid"):t(this).removeClass("valid").addClass("invalid")}else t(this).hasClass("mandatory")||t(this).removeClass("invalid").addClass("valid")}).keyup(),t(this).change(function(){t(this).keyup()})}),e.find("input.rotatestate").each(function(){var e=t(this).attr("data-state-values"),a=t(this).attr("data-state-class");if(e){try{e=JSON.parse(e)}catch(i){return}var s=t("");t(this).attr("title")&&s.attr("title",t(this).attr("title")),t(this).attr("data-state-style")&&s.attr("style",t(this).attr("data-state-style")),s.data("states",e),s.data("control",this),s.data("activeState",null),t(this).data("control",s),a&&s.addClass(a),s.click(function(){var e=t(this).data().activeState,a=t(this).data().states,i=t(this).data().control,s=null;if(null!==e){for(var n=0;a.length>n;n++)if(a[n].value===e.value){s=n===a.length-1?a[0]:a[n+1];break}}else s=a[0];t(i).attr("value",s.value),t(i).change()}),t(this).change(function(){var e=t(t(this).data().control),a=e.data().activeState,i=e.data().states;null!==a&&e.removeClass(a["class"]);var s=t(this).val();t.each(i,function(){return this.value===s?(e.data().activeState=this,this.title&&e.attr("title",this.title),e.addClass(this["class"]),!1):undefined})}),t(this).change(),t(this).after(s),t(this).hide()}})},e.prototype.validate=function(){return t(".required,.regexp,.date,.mandatory,.number,.validate",this.element).change(),t(".invalid",this.element).length>0?!1:!0},t.fn.jsFormControls=function(a){if("object"!=typeof a&&a){var i=Array.prototype.slice.call(arguments,1);if(1==this.length){var s=t(this).data("jsFormControls");if(s){if(0!==a.indexOf("_")&&s[a]){var n=s[a].apply(s,i);return n}return t.error("Method "+a+" does not exist on jQuery.jsFormControls"),!1}}return this.each(function(){var e=t.data(this,"jsFormControls");return e?0!==a.indexOf("_")&&e[a]?e[a].apply(e,i):(t.error("Method "+a+" does not exist on jQuery.jsFormControls"),!1):undefined})}return this.each(function(){t(this).data("jsFormControls")||t(this).data("jsFormControls",new e(this,a))})},t.jsFormControls=function(e,s){var n;if(t.isFunction(s))n=i[e],n&&t.each(n,function(){s(this,t(this.element))}),a[e]=s;else if(n=i[e]){var r=s,o=Array.prototype.slice.call(arguments,2);t.each(portlets,function(){this[r].apply(this,o)})}},t.jsFormControls.Format={format:function(e,a){return t(e).hasClass("dateTime")?isNaN(a)?a:t.jsFormControls.Format.dateTime(a):t(e).hasClass("datetime")?isNaN(a)?a:t.jsFormControls.Format.dateTime(a):t(e).hasClass("date")?isNaN(a)?a:t.jsFormControls.Format.date(a):t(e).hasClass("currency")?t.jsFormControls.Format.currency(a):t(e).hasClass("byte")?isNaN(a)?a:t.jsFormControls.Format.byte(a):t(e).hasClass("decimal")?t.jsFormControls.Format.decimal(a):t(e).hasClass("percent")?t.jsFormControls.Format.decimal(a):a},_getValue:function(t,e,a){return e===undefined&&a===undefined?t:isNaN(t)||e===undefined||a===undefined?undefined:a},checkBox:function(e,a,i,s){return i=t.jsFormControls.Format._getValue(e,a,i,s),i?' ':' '},_getNumber:function(e){if(!e)return null;var a={format:"#,##0.###",groupingSeparator:",",decimalSeparator:"."};return"undefined"!=typeof i18n?a=i18n.number:t(document).data().i18n&&t(document).data().i18n.number&&(a=t(document).data().i18n.number),e=""+e,-1!==e.indexOf(a.groupingSeparator)&&(e=e.replace(a.groupingSeparator,"","g")),"."!==a.decimalSeparator&&-1!==e.indexOf(a.decimalSeparator)&&(e=e.replace(a.decimalSeparator,".","g")),Number(e)},_pad:function(t){var e=10>t?"0":"";return e+=t},asNumber:function(e){return t.jsFormControls.Format._getNumber(e)},"byte":function(t){if(""===t||!t||isNaN(t))return t;var e=1024;if(e>t)return t+" B";var a=Math.floor(Math.log(t)/Math.log(e)),i="KMGTPE".charAt(a-1)+"B";return Math.round(10*t/Math.pow(e,a))/10+i},decimal:function(e){if(""===e||!e||isNaN(e))return e;var a={format:"#,##0.###",groupingSeparator:",",decimalSeparator:"."};"undefined"!=typeof i18n?a=i18n.number:t(document).data().i18n&&t(document).data().i18n.number&&(a=t(document).data().i18n.number);var i=0;Math.abs(e-Math.floor(e))>.001&&(i=2);var s=e,n=isNaN(n=Math.abs(i))?2:i,r=a.decimalSeparator,o=a.groupingSeparator,l=parseInt(s=Math.abs(+s||0).toFixed(n),10)+"",h=(h=l.length)>3?h%3:0;return(0>e?"-":"")+(h?l.substr(0,h)+o:"")+l.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+o)+(n?r+Math.abs(s-l).toFixed(n).slice(2):"")},currency:function(e,a,i,s){return i=t.jsFormControls.Format._getValue(e,a,i,s),i?t.jsFormControls.Format.decimal(i):a?" ":"0"},dateTime:function(e,a,i,s){return i=t.jsFormControls.Format._getValue(e,a,i,s),i?this.date(i)+" "+this.time(i):a?" ":""},date:function(e,a,i,s){if(i=t.jsFormControls.Format._getValue(e,a,i,s),!i||""===i||isNaN(i))return a?" ":"";var n=new Date;n.setTime(i);var r=n.getYear();1900>r&&(r+=1900);var o=null;return"undefined"!=typeof i18n?o=i18n.date:t(document).data().i18n&&t(document).data().i18n.date&&(o=t(document).data().i18n.date),t.format?t.format.date(n,o.shortDateFormat):this._pad(n.getDate())+"."+this._pad(n.getMonth()+1)+"."+this._pad(r)},time:function(e,a,i,s){if(i=t.jsFormControls.Format._getValue(e,a,i,s),!i||""===i||isNaN(i))return a?" ":"";var n=new Date;n.setTime(i);var r="HH:mm";return"undefined"!=typeof i18n?i18n.timeFormat?r=i18n.timeFormat:i18n.date&&i18n.date.timeFormat&&(r=i18n.date.timeFormat):t(document).data().i18n&&t(document).data().i18n.timeFormat!==undefined&&(r=t(document).data().i18n.timeFormat),t.format?t.format.date(n,r):this._pad(n.getHours())+":"+this._pad(n.getMinutes())},timespan:function(e,a,i,s){i=t.jsFormControls.Format._getValue(e,a,i,s);for(var n=i.split(":"),r=0;n.length>r;r++){var o=Number(n[r]);o&&"NaN"!==o||(o=0),n[r]=this._pad(o)}return 0>=n.length?"0:00":1==n.length?"0:"+this._pad(allowkomma?n[0]:Math.floor(n[0])):2==n.length?allowkomma?n[0]:Math.floor(n[0])+":"+this._pad(allowkomma?n[1]:Math.floor(n[1])):allowkomma?n[0]:Math.floor(n[0])+":"+this._pad(allowkomma?n[1]:Math.floor(n[1]))+":"+pad(allowkomma?n[2]:Math.floor(n[2]))},humanTime:function(e,a,i,s){if(i=t.jsFormControls.Format._getValue(e,a,i,s),isNaN(i))return i&&0!==i.length?i:"-";var n=Math.floor(i/36e5);i-=36e5*n;var r=Math.floor(i/6e4);i-=6e4*r;var o=Math.floor(i/1e3);i-=1e3*o;var l="";return n>0&&(l+=n+"h ",o=0,i=0),r>0&&(l+=r+"m ",i=0),o>0&&(l+=o+"s ",i=0),i>0&&(l+=i+"ms"),l.trim()}}}(jQuery,window),String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")},String.prototype.startsWith=function(t){return null===this||0>=this.length?!1:null===t||"null"==t||0>=t.length?!1:this.substr(0,t.length)==t?!0:!1},String.prototype.startsWithIgnoreCase=function(t){return null===this||0>=this.length?!1:null===t||"null"==t||0>=t.length?!1:this.substr(0,t.length).toLowerCase()==t.toLowerCase()?!0:!1},String.prototype.endsWith=function(t){return null===this||0>=this.length?!1:null===t||"null"==t||0>=t.length||t.length>this.length?!1:this.substr(this.length-t.length)==t?!0:!1}; +//@ sourceMappingURL=dist/jquery.jsForm.min.map \ No newline at end of file diff --git a/dist/jquery.jsForm.min.map b/dist/jquery.jsForm.min.map index 971d0c9..d616986 100644 --- a/dist/jquery.jsForm.min.map +++ b/dist/jquery.jsForm.min.map @@ -1 +1 @@ -{"version":3,"file":"dist/jquery.jsForm.1.1.1.min.js","sources":["dist/jquery.jsForm-1.1.1.js"],"names":["$","window","undefined","JsForm","element","options","$this","this","extend","controls","data","prefix","validateHidden","skipEmpty","processors","attr","_init","JSFORM_INIT_FUNCTIONS","JSFORM_MAP","prototype","_domInit","jsFormControls","console","log","ex","_fill","form","that","_initCollection","_initConditional","_debug","msg","showEvaluator","ele","fields","show","each","value","_getValueWithArrays","hide","hideEvaluator","conditionals","find","conditionalEval","length","push","func","field","split","_evaluateConditionals","collectionMap","collections","colName","indexOf","container","cols","_initList","hasClass","sortable","config","JSON","parse","on","_reorder","fieldName","click","ev","preventDefault","tmpl","line","clone","append","addClass","_addCollectionControls","trigger","pojo","idx","children","_fillData","substring","beforeInsertCallback","isFunction","val","focus","inserter","parent","_renderObject","blobInput","evt","fileName","pop","files","target","reader","FileReader","onload","e","result","readAsDataURL","dataService","collectionList","btn","display","DataUtils","run","select","cur","optionDisplay","j","option","count","id","prop","after","multiselect","autoOpen","open","css","next","offset","top","left","close","remove","multiselectfilter","bind","checkedValues","map","input","_fillList","detach","removeAttr","_clear","removeData","name","is","change","fieldname","empty","_createPojoFromInput","start","startObj","trim","processor","_getNumber","isNaN","use","pushVal","index","splice","num","Number","d1","d2","parts","d0","isPlainObject","$parent","nodeName","toUpperCase","text","cname","cdata","_get","Format","format","html","cbVal","found","pk","get","ignoreInvalid","originalPojo","invalid","filter","_getCollection","colParent","_getParent","lastIndexOf","_isEmpty","removeClass","getData","preventEditing","prevent","closest","replace","thespan","wrap","prev","before","validate","_fillCollection","colData","lineFunc","isArray","sortField","sort","a","b","toLowerCase","reverse","i","size","prio","obj","skin","ret","expr","create","p","prm","shift","path","arrayPattern","match","exec","parseInt","isEmptyObject","f","_pojoDifferFromInput","differs","hasVal","equals","_equalsCollection","childCounter","fill","applyConditions","reset","clear","destroy","unbind","fn","jsForm","method","args","Array","slice","call","arguments","apply","error","initFunc","jsForms","portlets","jQuery","JsFormControls","Handlebars","registerHelper","currency","decimal","date","time","dateTime","humanTime","byte","location","datepicker","dateFormat","numberRegexp","RegExp","keyup","test","integerRegexp","regexp","states","defaultClass","stateControl","cState","activeState","cStates","control","newState","title","_getValue","row","cell","checkBox","columnDef","numberformat","groupingSeparator","decimalSeparator","i18n","number","document","_pad","o","asNumber","bytes","unit","exp","Math","floor","pre","charAt","round","pow","comma","abs","n","c","d","t","toFixed","substr","Date","setTime","year","getYear","dateformat","shortDateFormat","getDate","getMonth","timeFormat","getHours","getMinutes","timespan","tokens","nt","allowkomma","pad","h","m","s","out","String","startsWith","str","startsWithIgnoreCase","endsWith"],"mappings":"CASC,SAAWA,EAAGC,EAAQC,GACtB,YAWA,SAASC,GAAQC,EAASC,GACzB,GAAIC,GAAQN,EAAEI,EAGdG,MAAKF,QAAUL,EAAEQ,WAIhBC,UAAU,EAIVC,KAAM,KAINC,OAAQ,OAKRC,gBAAgB,EAIhBC,WAAW,EAKXC,WAAY,MACVT,IAGAC,EAAMS,KAAK,gBAA2C,SAAxBR,KAAKF,QAAQM,QAA6C,KAAxBJ,KAAKF,QAAQM,QAC9C,KAA9BL,EAAMS,KAAK,iBACbR,KAAKF,QAAQM,OAASL,EAAMS,KAAK,gBAInCR,KAAKH,QAAUA,EAEfG,KAAKS,QAnDN,GAAIC,MACJC,IAyDAf,GAAOgB,UAAUH,MAAQ,WAKxB,GAHAT,KAAKa,WAGFb,KAAKF,QAAQI,SACf,GAAGT,EAAEqB,eACJrB,EAA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G,GAAOH,EAAI,KAEXE,EAAI,EACJ7R,EAAQ,GAEL4R,EAAI,IACPE,GAAOF,EAAI,KAEX5R,EAAQ,GAEL6R,EAAI,IACPC,GAAOD,EAAI,KACX7R,EAAQ,GAGLA,EAAQ,IACX8R,GAAO9R,EAAQ,MAGT8R,EAAIrL,UAIXsG,OAAQnP,QAMZmU,OAAOjT,UAAU2H,KAAO,WACvB,MAAOvI,MAAKkL,QAAQ,aAAc,KAInC2I,OAAOjT,UAAUkT,WAAa,SAASC,GACtC,MAAa,QAAT/T,MAAkC,GAAfA,KAAKqC,QACpB,EACI,OAAR0R,GAAyB,QAAPA,GAAiC,GAAdA,EAAI1R,QACrC,EACLrC,KAAKwS,OAAO,EAAGuB,EAAI1R,SAAW0R,GACzB,GACD,GAIRF,OAAOjT,UAAUoT,qBAAuB,SAASD,GAChD,MAAa,QAAT/T,MAAkC,GAAfA,KAAKqC,QACpB,EACI,OAAR0R,GAAyB,QAAPA,GAAiC,GAAdA,EAAI1R,QACrC,EACLrC,KAAKwS,OAAO,EAAGuB,EAAI1R,QAAQ2J,eAAiB+H,EAAI/H,eAC3C,GACD,GAIR6H,OAAOjT,UAAUqT,SAAW,SAASF,GACpC,MAAa,QAAT/T,MAAkC,GAAfA,KAAKqC,QACpB,EACI,OAAR0R,GAAyB,QAAPA,GAAiC,GAAdA,EAAI1R,QAAiB0R,EAAI1R,OAASrC,KAAKqC,QACxE,EACLrC,KAAKwS,OAAOxS,KAAKqC,OAAS0R,EAAI1R,SAAW0R,GACpC,GACD"} \ No newline at end of file +{"version":3,"file":"dist/jquery.jsForm.1.1.2.min.js","sources":["dist/jquery.jsForm-1.1.2.js"],"names":["$","window","undefined","JsForm","element","options","$this","this","extend","controls","data","prefix","trackChanges","validateHidden","skipEmpty","renderer","processors","connect","attr","_init","JSFORM_INIT_FUNCTIONS","JSFORM_MAP","prototype","_domInit","jsFormControls","each","_getForm","console","log","ex","_fill","ele","_initCollection","_initConditional","_fillDom","push","getNodes","that","_debug","msg","param","p","isPlainObject","JSON","stringify","form","showEvaluator","fields","show","value","_getValueWithArrays","hide","hideEvaluator","conditionals","find","conditionalEval","length","func","field","split","_evaluateConditionals","collectionMap","collections","colName","indexOf","container","cols","_initList","hasClass","sortable","config","parse","on","_reorder","fieldName","click","ev","preventDefault","tmpl","line","clone","addClass","pojo","append","_enableTracking","_addCollectionControls","trigger","substring","beforeInsertCallback","isFunction","idx","children","_fillData","val","focus","inserter","parent","_renderObject","blobInput","evt","fileName","pop","files","target","reader","FileReader","onload","e","result","readAsDataURL","detach","removeAttr","_clear","removeData","name","prop","is","change","fieldname","empty","_createPojoFromInput","start","startObj","trim","processor","_getNumber","isNaN","format","d","date","setHours","setMinutes","setSeconds","setMilliseconds","getTime","Date","use","pushVal","index","splice","num","Number","d1","d2","parts","d0","track","orig","removeClass","$parent","nodeName","toUpperCase","text","cname","cdata","_get","Format","html","cbVal","found","pk","get","ignoreInvalid","originalPojo","invalid","filter","_getCollection","colParent","_getParent","lastIndexOf","_isEmpty","getData","preventEditing","prevent","closest","replace","thespan","wrap","prev","before","remove","validate","valid","_fillCollection","colData","_fillList","lineFunc","isArray","sortField","sort","a","b","toLowerCase","reverse","i","cur","size","next","after","prio","obj","skin","ret","expr","create","prm","shift","path","arrayPattern","match","exec","parseInt","isEmptyObject","f","_equals","idField","Math","abs","equals","changed","_equalsCollection","differs","childCounter","_pojoDifferFromInput","fill","applyConditions","reset","clear","destroy","unbind","fn","jsForm","method","args","Array","slice","call","arguments","apply","error","initFunc","jsForms","portlets","jQuery","JsFormControls","Handlebars","registerHelper","currency","decimal","time","dateTime","humanTime","byte","location","datepicker","dateFormat","numberRegexp","RegExp","keyup","test","integerRegexp","regexp","states","defaultClass","stateControl","cState","activeState","cStates","control","newState","title","_getValue","row","cell","checkBox","columnDef","numberformat","groupingSeparator","decimalSeparator","i18n","number","document","_pad","o","asNumber","bytes","unit","exp","floor","pre","charAt","round","pow","comma","n","c","t","toFixed","j","substr","setTime","year","getYear","dateformat","shortDateFormat","getDate","getMonth","timeFormat","getHours","getMinutes","timespan","tokens","nt","allowkomma","pad","h","m","s","out","String","startsWith","str","startsWithIgnoreCase","endsWith"],"mappings":"CASC,SAAWA,EAAGC,EAAQC,GACtB,YAWA,SAASC,GAAQC,EAASC,GACzB,GAAIC,GAAQN,EAAEI,EAGdG,MAAKF,QAAUL,EAAEQ,WAIhBC,UAAU,EAIVC,KAAM,KAINC,OAAQ,OAMRC,aAAc,UAKdC,gBAAgB,EAIhBC,WAAW,EAKXC,SAAU,KAKVC,WAAY,KAKZC,QAAS,MACPZ,IAGAC,EAAMY,KAAK,gBAA2C,SAAxBX,KAAKF,QAAQM,QAA6C,KAAxBJ,KAAKF,QAAQM,QAC9C,KAA9BL,EAAMY,KAAK,iBACbX,KAAKF,QAAQM,OAASL,EAAMY,KAAK,gBAInCX,KAAKH,QAAUA,EAEfG,KAAKY,QAnEN,GAAIC,MACJC,IAyEAlB,GAAOmB,UAAUH,MAAQ,WAKxB,GAHAZ,KAAKgB,WAGFhB,KAAKF,QAAQI,SACf,GAAGT,EAAEwB,eAEJxB,EAAEyB,KAAKlB,KAAKmB,WAAY,WACvB1B,EAAEO,MAAMiB,uBAGT,KACuB,mBAAZG,UACTA,QAAQC,IAAI,yCAEZ,MAAMC,IAOVtB,KAAKuB,MAAMvB,KAAKF,UAOjBF,EAAOmB,UAAUL,QAAU,SAASc,GAEnCxB,KAAKyB,gBAAgBD,EAAKxB,KAAKF,QAAQM,QAEvCJ,KAAK0B,iBAAiBF,EAAKxB,KAAKF,QAAQM,OAAQJ,KAAKF,SAGlDE,KAAKF,QAAQI,UACZT,EAAEwB,gBAEJxB,EAAE+B,GAAKP,iBAITjB,KAAK2B,SAASH,GACVxB,KAAKF,QAAQY,UAChBV,KAAKF,QAAQY,YACdV,KAAKF,QAAQY,QAAQkB,KAAKJ,IAM3B5B,EAAOmB,UAAUc,SAAW,WAC3B,MAAO7B,MAAKmB,YAQbvB,EAAOmB,UAAUC,SAAW,W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,MAAKwK,QAAQ,aAAc,KAInCgJ,OAAOzS,UAAU0S,WAAa,SAASC,GACtC,MAAa,QAAT1T,MAAkC,GAAfA,KAAKiD,QACpB,EACI,OAARyQ,GAAyB,QAAPA,GAAiC,GAAdA,EAAIzQ,QACrC,EACLjD,KAAKoS,OAAO,EAAGsB,EAAIzQ,SAAWyQ,GACzB,GACD,GAIRF,OAAOzS,UAAU4S,qBAAuB,SAASD,GAChD,MAAa,QAAT1T,MAAkC,GAAfA,KAAKiD,QACpB,EACI,OAARyQ,GAAyB,QAAPA,GAAiC,GAAdA,EAAIzQ,QACrC,EACLjD,KAAKoS,OAAO,EAAGsB,EAAIzQ,QAAQwI,eAAiBiI,EAAIjI,eAC3C,GACD,GAIR+H,OAAOzS,UAAU6S,SAAW,SAASF,GACpC,MAAa,QAAT1T,MAAkC,GAAfA,KAAKiD,QACpB,EACI,OAARyQ,GAAyB,QAAPA,GAAiC,GAAdA,EAAIzQ,QAAiByQ,EAAIzQ,OAASjD,KAAKiD,QACxE,EACLjD,KAAKoS,OAAOpS,KAAKiD,OAASyQ,EAAIzQ,SAAWyQ,GACpC,GACD"} \ No newline at end of file diff --git a/jsForm.jquery.json b/jsForm.jquery.json index d530bb5..c7f5b60 100644 --- a/jsForm.jquery.json +++ b/jsForm.jquery.json @@ -7,7 +7,7 @@ "json", "data" ], - "version": "1.1.1", + "version": "1.1.2", "author": { "name": "Niko Berger" }, diff --git a/package.json b/package.json index 268d710..c02a0e6 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "jquery.jsForm", "title": "jQuery JSON Form - jsForm", "description": "jQuery based form library that allows you to handle data within a javascript object (like from a JSON request) with plain html forms.\nYou can modify all fields/properties by simply creating a html form with the correct naming schema (MVVM Pattern).\n\nThe main features of this library are:\n Full standard html with data available in a js object\n Update an existing js object with changes done within a form\n Provide basic functions for formatting (i.e. date/time, money) using html markup\n Provide form validation functionality\n handle collections (arrays) with subobjects\n provides helper methods to handle array manipulation (add new entry/remove an entry) using only html markup\n Can be used in connection with an autocomplete function to add new array objects", - "version": "1.1.1", + "version": "1.1.2", "homepage": "https://github.com/corinis/jsForm", "author": { "name": "Niko Berger", diff --git a/src/jquery.jsForm.js b/src/jquery.jsForm.js index eb14ab8..18352c1 100644 --- a/src/jquery.jsForm.js +++ b/src/jquery.jsForm.js @@ -166,7 +166,7 @@ JsForm.prototype._debug = function(msg, param) { try { if (!window.console || !window.console.log) - return + return; var p = null; if($.isPlainObject(param)) { @@ -1758,7 +1758,7 @@ var p = null; for(p in a) { - if(typeof(b[p]) === 'undefined' && a[p] !== null && a[p] !== "" && a[p].length != 0) { + if(typeof(b[p]) === 'undefined' && a[p] !== null && a[p] !== "" && a[p].length !== 0) { // 0 == undefined if((a[p] === "0" || a[p] === 0) && !b[p]) continue;