@atlassian/aui
Version:
Atlassian User Interface Framework
119 lines • 82.2 kB
JavaScript
/*!!
* @atlassian/aui - Atlassian User Interface Framework
* @version v8.0.0-alpha.1
* @link https://aui.atlassian.com
* @license SEE LICENSE IN LICENSE.md
* @author Atlassian Pty Ltd.
*/
exports.ids=[84],exports.modules={166:
/*!******************************************!*\
!*** ../src/js/aui/restful-table/row.js ***!
\******************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=c(s(/*! ../jquery */0)),o=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e.default=t,e}(s(/*! ../dialog */80)),n=c(s(/*! backbone */11)),r=c(s(/*! ./class-names */37)),a=c(s(/*! ./data-keys */36)),l=c(s(/*! ./events */22)),h=(c(s(/*! ../i18n */10)),c(s(/*! ./throbber */35)));function c(t){return t&&t.__esModule?t:{default:t}}e.default=n.default.View.extend({tagName:"tr",events:{"click .aui-restfultable-editable":"edit"},initialize:function(t){if(t=t||{},this._event=l.default,this.classNames=r.default,this.dataKeys=a.default,this.columns=t.columns,this.allowEdit=t.allowEdit,this.allowDelete=t.allowDelete,!this.events["click .aui-restfultable-editable"])throw new Error("It appears you have overridden the events property. To add events you will need to usea work around. https://github.com/documentcloud/backbone/issues/244");this.index=t.index||0,this.deleteConfirmation=t.deleteConfirmation,this.allowReorder=t.allowReorder,this.$el=(0,i.default)(this.el),this.bind(this._event.CANCEL,function(){this.disabled=!0}).bind(this._event.FOCUS,function(t){this.focus(t)}).bind(this._event.BLUR,function(){this.unfocus()}).bind(this._event.MODAL,function(){this.$el.addClass(this.classNames.ACTIVE)}).bind(this._event.MODELESS,function(){this.$el.removeClass(this.classNames.ACTIVE)})},renderDragHandle:function(){return'<span class="'+this.classNames.DRAG_HANDLE+'"></span></td>'},defaultColumnRenderer:function(t){if(t.value)return document.createTextNode(t.value.toString())},sync:function(t){var e=this;return this.model.addExpand(t),this.showLoading(),this.model.save(t,{success:function(){e.hideLoading().render(),e.trigger(e._event.UPDATED)},error:function(){e.hideLoading()}}),this},refresh:function(t,e){var s=this;return this.showLoading(),this.model.fetch({success:function(){s.hideLoading().render(),t&&t.apply(this,arguments)},error:function(){s.hideLoading(),e&&e.apply(this,arguments)}}),this},hasFocus:function(){return this.$el.hasClass(this.classNames.FOCUSED)},focus:function(){return(0,i.default)(this.el).addClass(this.classNames.FOCUSED),this},unfocus:function(){return(0,i.default)(this.el).removeClass(this.classNames.FOCUSED),this},showLoading:function(){return this.$el.addClass(this.classNames.LOADING),this},hideLoading:function(){return this.$el.removeClass(this.classNames.LOADING),this},edit:function(t){var e;return e=(0,i.default)(t.target).is("."+this.classNames.EDITABLE)?(0,i.default)(t.target).attr("data-field-name"):(0,i.default)(t.target).closest("."+this.classNames.EDITABLE).attr("data-field-name"),this.trigger(this._event.ROW_EDIT,e),this},renderOperations:function(){var t=this;if(!1!==this.allowDelete)return(0,i.default)("<a href='#' class='aui-button' />").addClass(this.classNames.DELETE).text(AJS.I18n.getText("aui.words.delete")).click(function(e){e.preventDefault(),t.destroy()})},destroy:function(){if(this.deleteConfirmation){var t=o.popup(400,200,"delete-entity-"+this.model.get("id"));t.element.html(this.deleteConfirmation(this.model.toJSON())),t.show(),t.element.find(".cancel").click(function(){t.hide()}),t.element.find("form").submit(function(e){t.hide(),this.model.destroy(),e.preventDefault()}.bind(this))}else this.model.destroy()},render:function(){var t=this,e=this.model.toJSON(),s=(0,i.default)("<td class='aui-restfultable-operations' />").append(this.renderOperations({},e)),o=(0,i.default)("<td class='aui-restfultable-status' />").append((0,h.default)());return this.$el.removeClass(this.classNames.DISABLED+" "+this.classNames.FOCUSED+" "+this.classNames.LOADING+" "+this.classNames.EDIT_ROW).addClass(this.classNames.READ_ONLY).empty(),this.allowReorder&&(0,i.default)('<td class="'+this.classNames.ORDER+'" />').append(this.renderDragHandle()).appendTo(t.$el),this.$el.attr("data-id",this.model.id),i.default.each(this.columns,function(s,o){var n,r=(0,i.default)("<td />"),a=e[o.id],l=o.fieldName||o.id,h=[{name:l,value:a,allowEdit:o.allowEdit},e,t.model];if(a&&t.$el.attr("data-"+o.id,a),n=o.readView?new o.readView({model:t.model}).render(h[0]):t.defaultColumnRenderer.apply(t,h),!1!==t.allowEdit&&!1!==o.allowEdit){var c=(0,i.default)("<span />").addClass(t.classNames.EDITABLE).append('<span class="aui-icon aui-icon-small aui-iconfont-edit"></span>').append(n).attr("data-field-name",l);r=(0,i.default)("<td />").append(c).appendTo(t.$el),n&&""!=i.default.trim(n)||(r.addClass(t.classNames.NO_VALUE),c.html((0,i.default)("<em />").text(this.emptyText||AJS.I18n.getText("aui.enter.value"))))}else r.append(n);o.styleClass&&r.addClass(o.styleClass),r.appendTo(t.$el)}),this.$el.append(s).append(o).addClass(this.classNames.ROW+" "+this.classNames.READ_ONLY),this.trigger(this._event.RENDER,this.$el,e),this.$el.trigger(this._event.CONTENT_REFRESHED,[this.$el]),this}}),t.exports=e.default},167:
/*!*******************************!*\
!*** ../src/js/aui/events.js ***!
\*******************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.triggerEvtForInst=e.triggerEvt=e.bindEvt=void 0;var i=r(s(/*! ./jquery */0)),o=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e.default=t,e}(s(/*! ./internal/deprecation */9)),n=r(s(/*! ./internal/globalize */1));function r(t){return t&&t.__esModule?t:{default:t}}var a=document||{},l=(0,i.default)(a);function h(t,e){l.trigger(t,e)}function c(t,e){l.bind(t,e)}function d(t,e,s){(0,i.default)(e).trigger(t,s),h(t,s),e.id&&h(e.id+"-"+t,s)}e.bindEvt=c=o.fn(c,"bindEvt",{sinceVersion:"5.8.0"}),e.triggerEvt=h=o.fn(h,"triggerEvt",{sinceVersion:"5.8.0"}),e.triggerEvtForInst=d=o.fn(d,"triggerEvtForInst",{sinceVersion:"5.8.0"}),(0,n.default)("bindEvt",c),(0,n.default)("triggerEvt",h),(0,n.default)("triggerEvtForInst",d),e.bindEvt=c,e.triggerEvt=h,e.triggerEvtForInst=d},168:
/*!**************************************************!*\
!*** ../src/js/aui/restful-table/entry-model.js ***!
\**************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=h(s(/*! ../jquery */0)),n=s(/*! ../events */167),r=h(s(/*! underscore */15)),a=h(s(/*! backbone */11)),l=h(s(/*! ./events */22));function h(t){return t&&t.__esModule?t:{default:t}}var c=a.default.Model.extend({sync:function(t,e,s){var i=this,o=s.error;return s.error=function(t){i._serverErrorHandler(t,this),o&&o.apply(this,arguments)},a.default.sync.apply(a.default,arguments)},save:function(t,e){var s,i=this,n=(e=e||{}).error,r=e.success;e.error=function(t,e){var s=o.default.parseJSON(e.responseText||e.data);n&&n.call(i,i,s,e)},this.isNew()?a.default.Model.prototype.save.call(this,t,e):t&&((s=new(c.extend({url:this.url()}))({id:this.id})).save=a.default.Model.prototype.save,e.success=function(t,e){i.clear().set(t.toJSON()),r&&r.call(i,i,e)},s.save(t,e))},destroy:function(t){t=t||{};var e,s=this,i=this.url();return t.data&&(e=o.default.param(t.data)),e&&e.length&&(i=i+"?"+e),o.default.ajax({url:i,type:"DELETE",dataType:"json",contentType:"application/json",success:function(e){s.collection&&s.collection.remove(s),t.success&&t.success.call(s,e)},error:function(e){s._serverErrorHandler(e,this),t.error&&t.error.call(s,e)}}),this},changedAttributes:function(t){var e={},s=this.toJSON();if(o.default.each(t,function(t,n){s[t]?s[t]&&s[t]!==n&&("object"===(void 0===n?"undefined":i(n))&&r.default.isEqual(n,s[t])||(e[t]=n)):"string"==typeof n?""!==o.default.trim(n)&&(e[t]=n):o.default.isArray(n)?0!==n.length&&(e[t]=n):e[t]=n}),!r.default.isEmpty(e))return this.addExpand(e),e},addExpand:function(t){},_serverErrorHandler:function(t,e){var s;400!==t.status&&(s=o.default.parseJSON(t.responseText||t.data),(0,n.triggerEvtForInst)(l.default.SERVER_ERROR,this,[s,t,e]))},fetch:function(t){t=t||{},this.clear(),a.default.Model.prototype.fetch.call(this,t)}});e.default=c,t.exports=e.default},169:
/*!****************************************************!*\
!*** ../src/js-vendor/jquery/serializetoobject.js ***!
\****************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){jQuery.fn.serializeObject=function(){var t={};return this.find(":input:not(:button):not(:submit):not(:radio):not('select[multiple]')").each(function(){""!==this.name&&(null===this.value&&(this.value=""),t[this.name]=this.value.match(/^(tru|fals)e$/i)?"true"==this.value.toLowerCase():this.value)}),this.find("input:radio:checked").each(function(){t[this.name]=this.value}),this.find("select[multiple]").each(function(){var e=jQuery(this),s=e.val();e.data("aui-ss")?t[this.name]=s?s[0]:"":t[this.name]=null!==s?s:[]}),t}},170:
/*!***********************************************!*\
!*** ../src/js/aui/restful-table/edit-row.js ***!
\***********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=c(s(/*! ../jquery */0));s(/*! ../../../js-vendor/jquery/serializetoobject */169);var n=c(s(/*! backbone */11)),r=c(s(/*! ./class-names */37)),a=c(s(/*! ./data-keys */36)),l=c(s(/*! ./events */22)),h=(c(s(/*! ../i18n */10)),c(s(/*! ./throbber */35)));function c(t){return t&&t.__esModule?t:{default:t}}var d=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");e.default=n.default.View.extend({tagName:"tr",events:{focusin:"_focus",click:"_focus",keyup:"_handleKeyUpEvent"},initialize:function(t){this.$el=(0,o.default)(this.el),this._event=l.default,this.classNames=r.default,this.dataKeys=a.default,this.columns=t.columns,this.isCreateRow=t.isCreateRow,this.allowReorder=t.allowReorder,this.events["click ."+this.classNames.CANCEL]="_cancel",this.delegateEvents(),t.isUpdateMode?this.isUpdateMode=!0:(this._modelClass=t.model,this.model=new this._modelClass),this.fieldFocusSelector=t.fieldFocusSelector,this.bind(this._event.CANCEL,function(){this.disabled=!0}).bind(this._event.SAVE,function(t){this.disabled||this.submit(t)}).bind(this._event.FOCUS,function(t){this.focus(t)}).bind(this._event.BLUR,function(){this.$el.removeClass(this.classNames.FOCUSED),this.disable()}).bind(this._event.SUBMIT_STARTED,function(){this._submitStarted()}).bind(this._event.SUBMIT_FINISHED,function(){this._submitFinished()})},defaultColumnRenderer:function(t){return!1!==t.allowEdit?(0,o.default)("<input type='text' />").addClass("text").attr({name:t.name,value:t.value}):t.value?document.createTextNode(t.value):void 0},renderDragHandle:function(){return'<span class="'+this.classNames.DRAG_HANDLE+'"></span></td>'},_handleKeyUpEvent:function(t){27===t.keyCode&&this.trigger(this._event.CANCEL)},_cancel:function(t){return this.trigger(this._event.CANCEL),t.preventDefault(),this},_submitStarted:function(){return this.submitting=!0,this.showLoading().disable().delegateEvents({}),this},_submitFinished:function(){return this.submitting=!1,this.hideLoading().enable().delegateEvents(this.events),this},_focus:function(t){return this.hasFocus()||this.trigger(this._event.FOCUS,t.target.name),this},hasFocus:function(){return this.$el.hasClass(this.classNames.FOCUSED)},focus:function(t){var e,s;return this.enable(),e=t?this.$el.find(this.fieldFocusSelector(t)):0===(s=this.$el.find(this.classNames.ERROR+":first")).length?this.$el.find(":input:text:first"):s.parent().find(":input"),this.$el.addClass(this.classNames.FOCUSED),e.focus().trigger("select"),this},disable:function(){var t,e;return d&&(e=this.$el.find(":submit")).length&&(t=(0,o.default)("<input type='submit' class='"+this.classNames.SUBMIT+"' />").addClass(e.attr("class")).val(e.val()).data(this.dataKeys.ENABLED_SUBMIT,e),e.replaceWith(t)),this.$el.addClass(this.classNames.DISABLED).find(":submit").attr("disabled","disabled"),this},enable:function(){var t,e;return d&&(e=(t=this.$el.find(this.classNames.SUBMIT)).data(this.dataKeys.ENABLED_SUBMIT))&&t.length&&t.replaceWith(e),this.$el.removeClass(this.classNames.DISABLED).find(":submit").removeAttr("disabled"),this},showLoading:function(){return this.$el.addClass(this.classNames.LOADING),this},hideLoading:function(){return this.$el.removeClass(this.classNames.LOADING),this},hasUpdates:function(){return!!this.mapSubmitParams(this.serializeObject())},serializeObject:function(){var t=this.$el;return t.serializeObject?t.serializeObject():t.serialize()},mapSubmitParams:function(t){return this.model.changedAttributes(t)},submit:function(t){var e,s=this;if(document.activeElement!==window&&(0,o.default)(document.activeElement).blur(),this.isUpdateMode){if(!(e=this.mapSubmitParams(this.serializeObject())))return s.trigger(s._event.CANCEL)}else this.model.clear(),e=this.mapSubmitParams(this.serializeObject());return this.trigger(this._event.SUBMIT_STARTED),this.model.save(e,{success:function(){s.isUpdateMode?s.trigger(s._event.UPDATED,s.model,t):(s.trigger(s._event.CREATED,s.model.toJSON()),s.model=new s._modelClass,s.render({errors:{},values:{}}),s.trigger(s._event.FOCUS)),s.trigger(s._event.SUBMIT_FINISHED)},error:function(t,e,i){400===i.status&&(s.renderErrors(e.errors),s.trigger(s._event.VALIDATION_ERROR,e.errors)),s.trigger(s._event.SUBMIT_FINISHED)},silent:!0}),this},renderError:function(t,e){return(0,o.default)("<div />").attr("data-field",t).addClass(this.classNames.ERROR).text(e)},renderErrors:function(t){var e=this;return this.$("."+this.classNames.ERROR).remove(),t&&o.default.each(t,function(t,s){e.$el.find("[name='"+t+"']").closest("td").append(e.renderError(t,s))}),this},render:function(t){var e=this;return this.$el.empty(),this.allowReorder&&(0,o.default)('<td class="'+this.classNames.ORDER+'" />').append(this.renderDragHandle()).appendTo(e.$el),o.default.each(this.columns,function(s,n){var r,a,l=t.values[n.id],h=[{name:n.id,value:l,allowEdit:n.allowEdit},t.values,e.model];l&&e.$el.attr("data-"+n.id,l),r=e.isCreateRow&&n.createView?new n.createView({model:e.model}).render(h[0]):n.editView?new n.editView({model:e.model}).render(h[0]):e.defaultColumnRenderer.apply(e,h),a=(0,o.default)("<td />"),"object"===(void 0===r?"undefined":i(r))&&r.done?r.done(function(t){a.append(t)}):a.append(r),n.styleClass&&a.addClass(n.styleClass),a.appendTo(e.$el)}),this.$el.append(this.renderOperations(t.update,t.values)).addClass(this.classNames.ROW+" "+this.classNames.EDIT_ROW),this.trigger(this._event.RENDER,this.$el,t.values),this.$el.trigger(this._event.CONTENT_REFRESHED,[this.$el]),this},renderOperations:function(t){var e=(0,o.default)('<td class="aui-restfultable-operations" />');return t?e.append((0,o.default)('<input class="aui-button" type="submit" />').attr({accesskey:this.submitAccessKey,value:AJS.I18n.getText("aui.words.update")})).append((0,o.default)('<a class="aui-button aui-button-link" href="#" />').addClass(this.classNames.CANCEL).text(AJS.I18n.getText("aui.words.cancel")).attr({accesskey:this.cancelAccessKey})):e.append((0,o.default)('<input class="aui-button" type="submit" />').attr({accesskey:this.submitAccessKey,value:AJS.I18n.getText("aui.words.add")})),e.add((0,o.default)('<td class="aui-restfultable-status" />').append((0,h.default)()))}}),t.exports=e.default},171:
/*!*******************************************************!*\
!*** ../src/js/aui/restful-table/custom-read-view.js ***!
\*******************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=s(/*! backbone */11),n=(i=o)&&i.__esModule?i:{default:i};e.default=n.default.View,t.exports=e.default},172:
/*!*******************************************************!*\
!*** ../src/js/aui/restful-table/custom-edit-view.js ***!
\*******************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=s(/*! backbone */11),n=(i=o)&&i.__esModule?i:{default:i};e.default=n.default.View,t.exports=e.default},173:
/*!*********************************************************!*\
!*** ../src/js/aui/restful-table/custom-create-view.js ***!
\*********************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=s(/*! backbone */11),n=(i=o)&&i.__esModule?i:{default:i};e.default=n.default.View,t.exports=e.default},174:
/*!**************************************!*\
!*** ../src/js/aui/restful-table.js ***!
\**************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=v(s(/*! ./jquery */0));s(/*! ../../js-vendor/jquery/jquery-ui/jquery.ui.core */83),s(/*! ../../js-vendor/jquery/jquery-ui/jquery.ui.widget */82),s(/*! ../../js-vendor/jquery/jquery-ui/jquery.ui.mouse */63),s(/*! ../../js-vendor/jquery/jquery-ui/jquery.ui.draggable */62),s(/*! ../../js-vendor/jquery/jquery-ui/jquery.ui.sortable */61);var o=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e.default=t,e}(s(/*! ./internal/log */6)),n=v(s(/*! backbone */11)),r=v(s(/*! ./restful-table/class-names */37)),a=v(s(/*! ./restful-table/custom-create-view */173)),l=v(s(/*! ./restful-table/custom-edit-view */172)),h=v(s(/*! ./restful-table/custom-read-view */171)),c=v(s(/*! ./restful-table/data-keys */36)),d=v(s(/*! ./restful-table/edit-row */170)),u=v(s(/*! ./restful-table/entry-model */168)),f=v(s(/*! ./restful-table/events */22)),p=v(s(/*! ./internal/globalize */1)),m=(v(s(/*! ./i18n */10)),v(s(/*! ./restful-table/row */166))),g=v(s(/*! ./restful-table/throbber */35));function v(t){return t&&t.__esModule?t:{default:t}}function _(t,e){(0,i.default)(document).trigger(t,e)}function b(t,e,s){(0,i.default)(e).trigger(t,s),_(t,s),e.id&&_(e.id+"_"+t,s)}var w=n.default.View.extend({initialize:function(t){var e=this;if(e.options=i.default.extend(!0,e._getDefaultOptions(t),t),e.id=this.options.id,e._event=f.default,e.classNames=r.default,e.dataKeys=c.default,this.$table=(0,i.default)(t.el).addClass(this.classNames.RESTFUL_TABLE).addClass(this.classNames.ALLOW_HOVER).addClass("aui").addClass(e.classNames.LOADING),this.$table.wrapAll("<form class='aui' action='#' />"),this.$thead=(0,i.default)("<thead/>"),this.$theadRow=(0,i.default)("<tr />").appendTo(this.$thead),this.$tbody=(0,i.default)("<tbody/>"),!this.$table.length)throw new Error("RestfulTable: Init failed! The table you have specified ["+this.$table.selector+"] cannot be found.");if(!this.options.columns)throw new Error("RestfulTable: Init failed! You haven't provided any columns to render.");this.showGlobalLoading(),this.options.columns.forEach(function(t){var s=i.default.isFunction(t.header)?t.header():t.header;void 0===s&&(o.warn("You have not specified [header] for column ["+t.id+"]. Using id for now..."),s=t.id),e.$theadRow.append("<th>"+s+"</th>")}),e.$theadRow.append("<th></th><th></th>"),this._models=this._createCollection(),this._rowClass=this.options.views.row,this.editRows=[],this.$table.closest("form").submit(function(t){e.focusedRow&&e.focusedRow.trigger(e._event.SAVE),t.preventDefault()}),this.options.allowReorder&&(this.$theadRow.prepend("<th />"),this.$tbody.sortable({handle:"."+this.classNames.DRAG_HANDLE,helper:function(t,s){var o=(0,i.default)("<div/>").attr("class",s.attr("class")).addClass(e.classNames.MOVEABLE);return s.children().each(function(t){var e=(0,i.default)(this),s=parseInt(0+e.css("border-left-width"),10),n=parseInt(0+e.css("border-right-width"),10),r=e[0].clientWidth+s+n;o.append((0,i.default)("<div/>").html(e.html()).attr("class",e.attr("class")).width(r))}),o=(0,i.default)("<div class='aui-restfultable-readonly'/>").append(o),o.css({left:s.offset().left}),o.appendTo(document.body),o},start:function(t,s){var o=s.helper[0].clientHeight,n=s.placeholder.find("td");s.item.addClass(e.classNames.MOVEABLE).children().each(function(t){(0,i.default)(this).width(n.eq(t).width())});var r='<td colspan="'+e.getColumnCount()+'"> </td>';s.placeholder.html(r).css({height:o,visibility:"visible"}),e.getRowFromElement(s.item[0]).trigger(e._event.MODAL)},stop:function(t,s){(0,i.default)(s.item[0]).is(":visible")&&(s.item.removeClass(e.classNames.MOVEABLE).children().attr("style",""),s.placeholder.removeClass(e.classNames.ROW),e.getRowFromElement(s.item[0]).trigger(e._event.MODELESS))},update:function(t,s){var i={row:e.getRowFromElement(s.item[0]),item:s.item,nextItem:s.item.next(),prevItem:s.item.prev()};e.move(i)},axis:"y",delay:0,containment:"document",cursor:"move",scroll:!0,zIndex:8e3}),this.$tbody.bind("selectstart mousedown",function(t){return!(0,i.default)(t.target).is("."+e.classNames.DRAG_HANDLE)})),!1!==this.options.allowCreate&&(this._createRow=new this.options.views.editRow({columns:this.options.columns,isCreateRow:!0,model:this.options.model.extend({url:function(){return e.options.resources.self}}),cancelAccessKey:this.options.cancelAccessKey,submitAccessKey:this.options.submitAccessKey,allowReorder:this.options.allowReorder,fieldFocusSelector:this.options.fieldFocusSelector}).bind(this._event.CREATED,function(t){void 0==e.options.addPosition&&"bottom"===e.options.createPosition||"bottom"===e.options.addPosition?e.addRow(t):e.addRow(t,0)}).bind(this._event.VALIDATION_ERROR,function(){this.trigger(e._event.FOCUS)}).render({errors:{},values:{}}),this.$create=(0,i.default)('<tbody class="'+this.classNames.CREATE+'" />').append(this._createRow.el),this._applyFocusCoordinator(this._createRow),this._createRow.trigger(this._event.FOCUS)),this._models.bind("remove",function(t){e.getRows().forEach(function(s){s.model===t&&(s.hasFocus()&&e._createRow&&e._createRow.trigger(e._event.FOCUS),e.removeRow(s))})}),this.fetchInitialResources()},fetchInitialResources:function(){var t=this;i.default.isFunction(this.options.resources.all)?this.options.resources.all(function(e){t.populate(e)}):i.default.get(this.options.resources.all,function(e){t.populate(e)})},move:function(t){var e=this,s=function(t){return t.length?{after:e.getRowFromElement(t).model.url()}:{position:"First"}};if(t.row){var o=e.options.reverseOrder?s(t.nextItem):s(t.prevItem);i.default.ajax({url:t.row.model.url()+"/move",type:"POST",dataType:"json",contentType:"application/json",data:JSON.stringify(o),complete:function(){t.row.hideLoading()},success:function(t){b(e._event.REORDER_SUCCESS,e,[t])},error:function(t){var s=i.default.parseJSON(t.responseText||t.data);b(e._event.SERVER_ERROR,e,[s,t,this])}}),t.row.showLoading()}},_createCollection:function(){var t=this;return new(this.options.Collection.extend({sort:function(e){if(e||(e={}),!this.comparator)throw new Error("Cannot sort a set without a comparator");return this.tableRows=t.getRows(),this.models=this.sortBy(this.comparator,this),this.tableRows=void 0,e.silent||this.trigger("refresh",this,e),this},remove:function(e,s){return this.tableRows=t.getRows(),n.default.Collection.prototype.remove.apply(this,arguments),this.tableRows=void 0,this}}))([],{comparator:function(e){var s;return(this&&void 0!==this.tableRows?this.tableRows:t.getRows()).some(function(t,i){if(t.model.id===e.id)return s=i,!0}),s}})},populate:function(t){this.options.reverseOrder&&t.reverse(),this.hideGlobalLoading(),t&&t.length?(this._models.reset([],{silent:!0}),this.renderRows(t),this.isEmpty()&&this.showNoEntriesMsg()):this.showNoEntriesMsg(),this.$table.append(this.$thead),"bottom"===this.options.createPosition?this.$table.append(this.$tbody).append(this.$create):this.$table.append(this.$create).append(this.$tbody),this.$table.removeClass(this.classNames.LOADING).trigger(this._event.INITIALIZED,[this]),b(this._event.INITIALIZED,this,[this]),this.options.autoFocus&&this.$table.find(":input:text:first").focus()},showGlobalLoading:function(){return this.$loading||(this.$loading=(0,i.default)('<div class="aui-restfultable-init">'+(0,g.default)()+'<span class="aui-restfultable-loading">'+this.options.loadingMsg+"</span></div>")),this.$loading.is(":visible")||this.$loading.insertAfter(this.$table),this},hideGlobalLoading:function(){return this.$loading&&this.$loading.remove(),this},addRow:function(t,e){var s,i;if(!t.id)throw new Error("RestfulTable.addRow: to add a row values object must contain an id. Maybe you are not returning it from your restend point?Recieved:"+JSON.stringify(t));return i=new this.options.model(t),s=this._renderRow(i,e),this._models.add(i),this.removeNoEntriesMsg(),b(this._event.ROW_ADDED,this,[s,this]),this},removeRow:function(t){this._models.remove(t.model),t.remove(),this.isEmpty()&&this.showNoEntriesMsg(),b(this._event.ROW_REMOVED,this,[t,this])},isEmpty:function(){return 0===this._models.length},getModels:function(){return this._models},getTable:function(){return this.$table},getTableBody:function(){return this.$tbody},getCreateRow:function(){return this._createRow},getColumnCount:function(){var t=2;return this.allowReorder&&++t,this.options.columns.length+t},getRowFromElement:function(t){return(0,i.default)(t).data(this.dataKeys.ROW_VIEW)},showNoEntriesMsg:function(){return this.$noEntries&&this.$noEntries.remove(),this.$noEntries=(0,i.default)("<tr>").addClass(this.classNames.NO_ENTRIES).append((0,i.default)("<td>").attr("colspan",this.getColumnCount()).text(this.options.noEntriesMsg)).appendTo(this.$tbody),this},removeNoEntriesMsg:function(){return this.$noEntries&&this._models.length>0&&this.$noEntries.remove(),this},getRows:function(){var t=this,e=[];return this.$tbody.find("."+this.classNames.READ_ONLY).each(function(){var s=(0,i.default)(this).data(t.dataKeys.ROW_VIEW);s&&e.push(s)}),e},_renderRow:function(t,e){var s,i,o=this,n=this.$tbody.find("."+this.classNames.READ_ONLY);return i=new this._rowClass({model:t,columns:this.options.columns,allowEdit:this.options.allowEdit,allowDelete:this.options.allowDelete,allowReorder:this.options.allowReorder,deleteConfirmation:this.options.deleteConfirmation}),this.removeNoEntriesMsg(),i.bind(this._event.ROW_EDIT,function(t){b(this._event.EDIT_ROW,{},[this,o]),o.edit(this,t)}),s=i.render().$el,-1!==e&&("number"==typeof e&&0!==n.length?s.insertBefore(n[e]):this.$tbody.append(s)),s.data(this.dataKeys.ROW_VIEW,i),i.bind(this._event.MODAL,function(){o.$table.removeClass(o.classNames.ALLOW_HOVER),o.$tbody.sortable("disable"),o.getRows().forEach(function(t){o.isRowBeingEdited(t)||t.delegateEvents({})})}),i.bind(this._event.MODELESS,function(){o.$table.addClass(o.classNames.ALLOW_HOVER),o.$tbody.sortable("enable"),o.getRows().forEach(function(t){o.isRowBeingEdited(t)||t.delegateEvents()})}),this._applyFocusCoordinator(i),this.trigger(this._event.ROW_INITIALIZED,i),i},isRowBeingEdited:function(t){var e=!1;return this.editRows.some(function(s){if(s.el===t.el)return e=!0,!0}),e},_applyFocusCoordinator:function(t){var e=this;return t.hasFocusBound||(t.hasFocusBound=!0,t.bind(this._event.FOCUS,function(){e.focusedRow&&e.focusedRow!==t&&e.focusedRow.trigger(e._event.BLUR),e.focusedRow=t,t instanceof m.default&&e._createRow&&e._createRow.enable()})),this},_removeEditRow:function(t){var e=i.default.inArray(t,this.editRows);return this.editRows.splice(e,1),this},_shiftFocusAfterEdit:function(){return this.editRows.length>0?this.editRows[this.editRows.length-1].trigger(this._event.FOCUS):this._createRow&&this._createRow.trigger(this._event.FOCUS),this},_saveEditRowOnBlur:function(){return this.editRows.length<=1},dismissEditRows:function(){this.editRows.forEach(function(t){t.hasUpdates()||t.trigger(this._event.FINISHED_EDITING)},this)},edit:function(t,e){var s=this,i=new this.options.views.editRow({el:t.el,columns:this.options.columns,isUpdateMode:!0,allowReorder:this.options.allowReorder,fieldFocusSelector:this.options.fieldFocusSelector,model:t.model,cancelAccessKey:this.options.cancelAccessKey,submitAccessKey:this.options.submitAccessKey}),o=t.model.toJSON();return o.update=!0,i.render({errors:{},update:!0,values:o}).bind(s._event.UPDATED,function(e,i){s._removeEditRow(this),this.unbind(),t.render().delegateEvents(),t.trigger(s._event.UPDATED),!1!==i&&s._shiftFocusAfterEdit()}).bind(s._event.VALIDATION_ERROR,function(){this.trigger(s._event.FOCUS)}).bind(s._event.FINISHED_EDITING,function(){s._removeEditRow(this),t.render().delegateEvents(),this.unbind()}).bind(s._event.CANCEL,function(){s._removeEditRow(this),this.unbind(),t.render().delegateEvents(),s._shiftFocusAfterEdit()}).bind(s._event.BLUR,function(){s.dismissEditRows(),s._saveEditRowOnBlur()&&this.trigger(s._event.SAVE,!1)}),this._applyFocusCoordinator(i),i.trigger(s._event.FOCUS,e),s._createRow&&s._createRow.disable(),this.editRows.push(i),i},renderRows:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],s=this._models.comparator,i=[];this._models.comparator=void 0;var o=e.map(function(e){var s=new t.options.model(e);return i.push(t._renderRow(s,-1).el),s});return this._models.add(o,{silent:!0}),this._models.comparator=s,this.removeNoEntriesMsg(),this.$tbody.append(i),this},_getDefaultOptions:function(t){return{model:t.model||u.default,allowEdit:!0,views:{editRow:d.default,row:m.default},Collection:n.default.Collection.extend({url:t.resources.self,model:t.model||u.default}),allowReorder:!1,fieldFocusSelector:function(t){return":input[name="+t+"], #"+t},loadingMsg:t.loadingMsg||AJS.I18n.getText("aui.words.loading")}}});w.ClassNames=r.default,w.CustomCreateView=a.default,w.CustomEditView=l.default,w.CustomReadView=h.default,w.DataKeys=c.default,w.EditRow=d.default,w.EntryModel=u.default,w.Events=f.default,w.Row=m.default,w.Throbber=g.default,(0,p.default)("RestfulTable",w),e.default=w,t.exports=e.default},176:
/*!******************************************************!*\
!*** ../src/less/aui-experimental-restfultable.less ***!
\******************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,s){},179:
/*!****************************************!*\
!*** ./aui.component.restful-table.js ***!
\****************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RestfulTable=void 0,s(/*! ./styles/aui.pattern.table */38),s(/*! ./vendor/jquery.ui.base */84),s(/*! @atlassian/aui/src/js-vendor/jquery/jquery-ui/jquery.ui.mouse */63),s(/*! @atlassian/aui/src/js-vendor/jquery/jquery-ui/jquery.ui.draggable */62),s(/*! @atlassian/aui/src/js-vendor/jquery/jquery-ui/jquery.ui.sortable */61),s(/*! @atlassian/aui/src/less/aui-experimental-restfultable.less */176);var i,o=s(/*! @atlassian/aui/src/js/aui/restful-table */174),n=(i=o)&&i.__esModule?i:{default:i};e.RestfulTable=n.default},22:
/*!*********************************************!*\
!*** ../src/js/aui/restful-table/events.js ***!
\*********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={REORDER_SUCCESS:"RestfulTable.reorderSuccess",ROW_ADDED:"RestfulTable.rowAdded",ROW_REMOVED:"RestfulTable.rowRemoved",EDIT_ROW:"RestfulTable.switchedToEditMode",SERVER_ERROR:"RestfulTable.serverError",CREATED:"created",UPDATED:"updated",FOCUS:"focus",BLUR:"blur",SUBMIT:"submit",SAVE:"save",MODAL:"modal",MODELESS:"modeless",CANCEL:"cancel",CONTENT_REFRESHED:"contentRefreshed",RENDER:"render",FINISHED_EDITING:"finishedEditing",VALIDATION_ERROR:"validationError",SUBMIT_STARTED:"submitStarted",SUBMIT_FINISHED:"submitFinished",INITIALIZED:"initialized",ROW_INITIALIZED:"rowInitialized",ROW_EDIT:"editRow"},t.exports=e.default},35:
/*!***********************************************!*\
!*** ../src/js/aui/restful-table/throbber.js ***!
\***********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){return'<span class="aui-restfultable-throbber"></span>'},t.exports=e.default},36:
/*!************************************************!*\
!*** ../src/js/aui/restful-table/data-keys.js ***!
\************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={ENABLED_SUBMIT:"enabledSubmit",ROW_VIEW:"RestfulTable_Row_View"},t.exports=e.default},37:
/*!**************************************************!*\
!*** ../src/js/aui/restful-table/class-names.js ***!
\**************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={NO_VALUE:"aui-restfultable-editable-no-value",NO_ENTRIES:"aui-restfultable-no-entires",RESTFUL_TABLE:"aui-restfultable",ROW:"aui-restfultable-row",READ_ONLY:"aui-restfultable-readonly",ACTIVE:"aui-restfultable-active",ALLOW_HOVER:"aui-restfultable-allowhover",FOCUSED:"aui-restfultable-focused",MOVEABLE:"aui-restfultable-movable",DISABLED:"aui-restfultable-disabled",SUBMIT:"aui-restfultable-submit",CANCEL:"aui-restfultable-cancel",EDIT_ROW:"aui-restfultable-editrow",CREATE:"aui-restfultable-create",DRAG_HANDLE:"aui-restfultable-draghandle",ORDER:"aui-restfultable-order",EDITABLE:"aui-restfultable-editable",ERROR:"error",DELETE:"aui-restfultable-delete",LOADING:"loading"},t.exports=e.default},61:
/*!***************************************************************!*\
!*** ../src/js-vendor/jquery/jquery-ui/jquery.ui.sortable.js ***!
\***************************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){
/*!
* jQuery UI Sortable 1.8.24
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Sortables
*
* Depends:
* jquery.ui.core.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
*/
var s;(s=jQuery).widget("ui.sortable",s.ui.mouse,{widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var t=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=!!this.items.length&&("x"===t.axis||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display"))),this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},destroy:function(){s.Widget.prototype.destroy.call(this),this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_setOption:function(t,e){"disabled"===t?(this.options[t]=e,this.widget()[e?"addClass":"removeClass"]("ui-sortable-disabled")):s.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(t,e){var i=this;if(this.reverting)return!1;if(this.options.disabled||"static"==this.options.type)return!1;this._refreshItems(t);var o=null,n=this;if(s(t.target).parents().each(function(){if(s.data(this,i.widgetName+"-item")==n)return o=s(this),!1}),s.data(t.target,i.widgetName+"-item")==n&&(o=s(t.target)),!o)return!1;if(this.options.handle&&!e){var r=!1;if(s(this.options.handle,o).find("*").andSelf().each(function(){this==t.target&&(r=!0)}),!r)return!1}return this.currentItem=o,this._removeCurrentsFromItems(),!0},_mouseStart:function(t,e,i){var o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},s.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&(s("body").css("cursor")&&(this._storedCursor=s("body").css("cursor")),s("body").css("cursor",o.cursor)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!=document&&"HTML"!=this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!i)for(var n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",t,this._uiHash(this));return s.ui.ddmanager&&(s.ui.ddmanager.current=this),s.ui.ddmanager&&!o.dropBehaviour&&s.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){if(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll){var e=this.options,i=!1;this.scrollParent[0]!=document&&"HTML"!=this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<e.scrollSensitivity?this.scrollParent[0].scrollTop=i=this.scrollParent[0].scrollTop+e.scrollSpeed:t.pageY-this.overflowOffset.top<e.scrollSensitivity&&(this.scrollParent[0].scrollTop=i=this.scrollParent[0].scrollTop-e.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<e.scrollSensitivity?this.scrollParent[0].scrollLeft=i=this.scrollParent[0].scrollLeft+e.scrollSpeed:t.pageX-this.overflowOffset.left<e.scrollSensitivity&&(this.scrollParent[0].scrollLeft=i=this.scrollParent[0].scrollLeft-e.scrollSpeed)):(t.pageY-s(document).scrollTop()<e.scrollSensitivity?i=s(document).scrollTop(s(document).scrollTop()-e.scrollSpeed):s(window).height()-(t.pageY-s(document).scrollTop())<e.scrollSensitivity&&(i=s(document).scrollTop(s(document).scrollTop()+e.scrollSpeed)),t.pageX-s(document).scrollLeft()<e.scrollSensitivity?i=s(document).scrollLeft(s(document).scrollLeft()-e.scrollSpeed):s(window).width()-(t.pageX-s(document).scrollLeft())<e.scrollSensitivity&&(i=s(document).scrollLeft(s(document).scrollLeft()+e.scrollSpeed))),!1!==i&&s.ui.ddmanager&&!e.dropBehaviour&&s.ui.ddmanager.prepareOffsets(this,t)}this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"==this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"==this.options.axis||(this.helper[0].style.top=this.position.top+"px");for(var o=this.items.length-1;o>=0;o--){var n=this.items[o],r=n.item[0],a=this._intersectsWithPointer(n);if(a&&n.instance===this.currentContainer&&!(r==this.currentItem[0]||this.placeholder[1==a?"next":"prev"]()[0]==r||s.ui.contains(this.placeholder[0],r)||"semi-dynamic"==this.options.type&&s.ui.contains(this.element[0],r))){if(this.direction=1==a?"down":"up","pointer"!=this.options.tolerance&&!this._intersectsWithSides(n))break;this._rearrange(t,n),this._trigger("change",t,this._uiHash());break}}return this._contactContainers(t),s.ui.ddmanager&&s.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,e){if(t){if(s.ui.ddmanager&&!this.options.dropBehaviour&&s.ui.ddmanager.drop(this,t),this.options.revert){var i=this,o=i.placeholder.offset();i.reverting=!0,s(this.helper).animate({left:o.left-this.offset.parent.left-i.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:o.top-this.offset.parent.top-i.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){i._clear(t)})}else this._clear(t,e);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"==this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!=this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),s.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?s(this.domPosition.prev).after(this.currentItem):s(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var e=this._getItemsAsjQuery(t&&t.connected),i=[];return t=t||{},s(e).each(function(){var e=(s(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[-=_](.+)/);e&&i.push((t.key||e[1]+"[]")+"="+(t.key&&t.expression?e[1]:e[2]))}),!i.length&&t.key&&i.push(t.key+"="),i.join("&")},toArray:function(t){var e=this._getItemsAsjQuery(t&&t.connected),i=[];return t=t||{},e.each(function(){i.push(s(t.item||this).attr(t.attribute||"id")||"")}),i},_intersectsWith:function(t){var e=this.positionAbs.left,s=e+this.helperProportions.width,i=this.positionAbs.top,o=i+this.helperProportions.height,n=t.left,r=n+t.width,a=t.top,l=a+t.height,h=this.offset.click.top,c=this.offset.click.left,d=i+h>a&&i+h<l&&e+c>n&&e+c<r;return"pointer"==this.options.tolerance||this.options.forcePointerForContainers||"pointer"!=this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?d:n<e+this.helperProportions.width/2&&s-this.helperProportions.width/2<r&&a<i+this.helperProportions.height/2&&o-this.helperProportions.height/2<l},_intersectsWithPointer:function(t){var e="x"===this.options.axis||s.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),i="y"===this.options.axis||s.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),o=e&&i,n=this._getDragVerticalDirection(),r=this._getDragHorizontalDirection();return!!o&&(this.floating?r&&"right"==r||"down"==n?2:1:n&&("down"==n?2:1))},_intersectsWithSides:function(t){var e=s.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=s.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),o=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"==n&&i||"left"==n&&!i:o&&("down"==o&&e||"up"==o&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!=t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!=t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor==String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(t){var e=[],i=[],o=this._connectWith();if(o&&t)for(var n=o.length-1;n>=0;n--)for(var r=s(o[n]),a=r.length-1;a>=0;a--){var l=s.data(r[a],this.widgetName);l&&l!=this&&!l.options.disabled&&i.push([s.isFunction(l.options.items)?l.options.items.call(l.element):s(l.options.items,l.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),l])}for(i.push([s.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):s(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),n=i.length-1;n>=0;n--)i[n][0].each(function(){e.push(this)});return s(e)},_removeCurrentsFromItems:function(){for(var t=this.currentItem.find(":data("+this.widgetName+"-item)"),e=0;e<this.items.length;e++)for(var s=0;s<t.length;s++)t[s]==this.items[e].item[0]&&this.items.splice(e,1)},_refreshItems:function(t){this.items=[],this.containers=[this];var e=this.items,i=[[s.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):s(this.options.items,this.element),this]],o=this._connectWith();if(o&&this.ready)for(var n=o.length-1;n>=0;n--)for(var r=s(o[n]),a=r.length-1;a>=0;a--){var l=s.data(r[a],this.widgetName);l&&l!=this&&!l.options.disabled&&(i.push([s.isFunction(l.options.items)?l.options.items.call(l.element[0],t,{item:this.currentItem}):s(l.options.items,l.element),l]),this.containers.push(l))}for(n=i.length-1;n>=0;n--)for(var h=i[n][1],c=i[n][0],d=(a=0,c.length);a<d;a++){var u=s(c[a]);u.data(this.widgetName+"-item",h),e.push({item:u,instance:h,width:0,height:0,left:0,top:0})}},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());for(var e=this.items.length-1;e>=0;e--){var i=this.items[e];if(i.instance==this.currentContainer||!this.currentContainer||i.item[0]==this.currentItem[0]){var o=this.options.toleranceElement?s(this.options.toleranceElement,i.item):i.item;t||(i.width=o.outerWidth(),i.height=o.outerHeight());var n=o.offset();i.left=n.left,i.top=n.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(e=this.containers.length-1;e>=0;e--)n=this.containers[e].element.offset(),this.containers[e].containerCache.left=n.left,this.containers[e].containerCache.top=n.top,this.containers[e].containerCache.width=this.containers[e].element.outerWidth(),this.containers[e].containerCache.height=this.containers[e].element.outerHeight();return this},_createPlaceholder:function(t){var e=t||this,i=e.options;if(!i.placeholder||i.placeholder.constructor==String){var o=i.placeholder;i.placeholder={element:function(){var t=s(document.createElement(e.currentItem[0].nodeName)).addClass(o||e.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return o||(t.style.visibility="hidden"),t},update:function(t,s){o&&!i.forcePlaceholderSize||(s.height()||s.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),s.width()||s.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}}e.placeholder=s(i.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),i.placeholder.update(e,e.placeholder)},_contactContainers:function(t){for(var e=null,i=null,o=this.containers.length-1;o>=0;o--)if(!s.ui.contains(this.currentItem[0],this.containers[o].element[0]))if(this._intersectsWith(this.containers[o].containerCache)){if(e&&s.ui.contains(this.containers[o].element[0],e.element[0]))continue;e=this.containers[o],i=o}else this.containers[o].containerCache.over&&(this.containers[o]._trigger("out",t,this._uiHash(this)),this.containers[o].containerCache.over=0);if(e)if(1===this.containers.length)this.containers[i]._trigger("over",t,this._uiHash(this)),this.containers[i].containerCache.ove