From 41d0426ee81a0955df21ad533445ae8ad9eb3d7a Mon Sep 17 00:00:00 2001 From: dongwoo Date: Thu, 4 Feb 2016 10:53:50 +0900 Subject: [PATCH] buil for v1.1.2 --- dist/grid.css | 85 +- dist/grid.js | 2243 +++++++++++++++++++++++++------------- dist/grid.min.css | 4 +- dist/grid.min.js | 12 +- samples/css/grid.css | 85 +- samples/css/grid.min.css | 4 +- samples/js/grid.js | 2243 +++++++++++++++++++++++++------------- samples/js/grid.min.js | 12 +- 8 files changed, 3066 insertions(+), 1622 deletions(-) diff --git a/dist/grid.css b/dist/grid.css index c21d5fc63..a46ee88e0 100644 --- a/dist/grid.css +++ b/dist/grid.css @@ -1,7 +1,7 @@ /** * @fileoverview tui-grid * @author NHN Ent. FE Development Team - * @version 1.1.1 + * @version 1.1.2 * @license MIT * @link https://github.com/nhnent/tui.grid */ @@ -12,13 +12,13 @@ position: relative; border-bottom: solid 1px #ccc; clear: both; - scrollbar-highlight-color: #f2f2f2; - scrollbar-shadow-color: #f2f2f2; + scrollbar-highlight-color: #f5f5f5; + scrollbar-shadow-color: #f5f5f5; scrollbar-arrow-color: #8a8a8a; scrollbar-face-color: #d9d9d9; - scrollbar-3dlight-color: #f2f2f2; - scrollbar-darkshadow-color: #f2f2f2; - scrollbar-track-color: #f2f2f2; + scrollbar-3dlight-color: #f5f5f5; + scrollbar-darkshadow-color: #f5f5f5; + scrollbar-track-color: #f5f5f5; font-size: 12px; font-family: '돋움', Dotum, Helvetica, 'Apple SD Gothic Neo', Sans-serif; } @@ -26,7 +26,7 @@ -webkit-appearance: none; width: 17px; height: 17px; - background-color: #f2f2f2; + background-color: #f5f5f5; border-top: solid 1px #ccc; } .uio_grid ::-webkit-scrollbar-thumb { @@ -157,20 +157,14 @@ .uio_grid .lside_area .data table { *margin-right: -17px; } -.uio_grid .lside_area .data table .meta_column { - background: #f8f8f8; -} -.uio_grid .lside_area .data table .meta_column.selected { - background: #e0e0e0; -} .uio_grid .lside_area .data .selection_layer { display: none; position: absolute; top: 0; width: 0; height: 0; - border: dotted 1px #f00; - background: #ffa500; + border: solid 1px #004082; + background: #4daaf9; opacity: 0.2; filter: alpha(opacity=10); left: 1px; @@ -205,8 +199,8 @@ top: 0; width: 0; height: 0; - border: dotted 1px #f00; - background: #ffa500; + border: solid 1px #004082; + background: #4daaf9; opacity: 0.2; filter: alpha(opacity=10); left: -1px; @@ -219,7 +213,7 @@ right: 0; width: 16px; border: solid 1px #ccc; - background: #f8f8f8; + background: #eee; } .uio_grid .rside_area .scrollbar_border { display: block; @@ -236,9 +230,6 @@ height: 17px; background-color: #f2f2f2; } -.uio_grid .header th { - background: #f8f8f8; -} .uio_grid .header .resize_handle_container { display: none; position: relative; @@ -268,7 +259,7 @@ .uio_grid table { border: 0; table-layout: fixed; - background-color: #ccc; + background-color: #d8d8d8; border-collapse: separate; border-spacing: 1px; margin: 0; @@ -280,6 +271,11 @@ text-align: center; padding: 0; border: 0; + background: #eee; +} +.uio_grid table th.selected { + background: #b0b0b0; + color: #f8f8f8; } .uio_grid table th .sort a { color: #555; @@ -301,51 +297,48 @@ .uio_grid table th .sorting_up { background-position: -10px -60px; } -.uio_grid table tr.selected { - background-color: #f8f8f8; -} .uio_grid table tr.disabled { color: #b0b0b0; } -.uio_grid table tr.invalidated { - background-color: #ffe1e1; -} -.uio_grid table col { - background: #fff; -} -.uio_grid table col.editable { - background-color: #ffffef; -} .uio_grid table td { overflow: hidden; padding: 0 10px; *padding: 1px 10px; border: 0; white-space: nowrap; + background-color: #fbfbfb; *white-space: pre; } +.uio_grid table td.meta_column { + background: #eee; +} +.uio_grid table td.meta_column.dummy { + background: #eee; +} +.uio_grid table td.meta_column.selected { + background: #b0b0b0; + color: #f8f8f8; +} .uio_grid table td.editable { - background-color: #ffffef; + background-color: #fff; } -.uio_grid table td.selected { - background-color: #f8f8f8; - font-weight: bold; +.uio_grid table td.dummy { + background-color: #fff; +} +.uio_grid table td.required { + background-color: #fffdeb; } .uio_grid table td.disabled { color: #b0b0b0; } -.uio_grid table td.invalidated_row { - background: #ffe1e1; -} -.uio_grid table td.invalidated_column, -.uio_grid table td.invalidated_column input, -.uio_grid table td.invalidated_column select { - color: #ff0202; -} .uio_grid table td.focused { padding: 0 9px; border: dotted 1px #190000; } +.uio_grid table td.invalid { + padding: 0 9px; + border: solid 1px #ff8080; +} .uio_grid table td.ellipsis { -o-text-overflow: ellipsis /*Opera 9*/; -moz-binding: url("ellipsis.xml#ellipsis") /* Firefox */; diff --git a/dist/grid.js b/dist/grid.js index 568292725..e740ab8f3 100644 --- a/dist/grid.js +++ b/dist/grid.js @@ -1,7 +1,7 @@ /** * @fileoverview tui-grid * @author NHN Ent. FE Development Team - * @version 1.1.1 + * @version 1.1.2 * @license MIT * @link https://github.com/nhnent/tui.grid */ @@ -58,15 +58,11 @@ var renderStateMap = require('../common/constMap').renderState; /** * Net Addon * @module addon/net + * @mixes module:base/common */ var Net = View.extend(/**@lends module:addon/net.prototype */{ - tagName: 'form', - events: { - submit: '_onSubmit' - }, /** * @constructs - * @mixes module:base/common * @param {object} options * @param {jquery} options.el form 엘리먼트 * @param {boolean} [options.initialRequest=true] Net 인스턴스 생성과 동시에 readData request 요청을 할 지 여부. @@ -138,6 +134,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * net.request('modifyData'); * */ + initialize: function(options) { var defaultOptions, options, pagination; @@ -193,6 +190,12 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ } }, + tagName: 'form', + + events: { + submit: '_onSubmit' + }, + /** * pagination instance 를 초기화 한다. * @private @@ -340,7 +343,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ /** * form 으로 지정된 엘리먼트의 Data 를 반환한다. - * @return {object} formData 데이터 오브젝트 + * @returns {object} formData 데이터 오브젝트 * @private */ _getFormData: function() { @@ -573,8 +576,8 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * @param {boolean} [options.hasDataParam=true] request 데이터에 rowList 관련 데이터가 포함될 지 여부. * @param {boolean} [options.isOnlyModified=true] rowList 관련 데이터 중 수정된 데이터만 포함할 지 여부 * @param {boolean} [options.isOnlyChecked=true] rowList 관련 데이터 중 checked 된 데이터만 포함할 지 여부 - * @return {{count: number, data: {requestType: string, url: string, data: object, type: string, dataType: string}}} - * 옵션 조건에 해당하는 그리드 데이터 정보 + * @returns {{count: number, data: {requestType: string, url: string, data: object, + * type: string, dataType: string}}} 옵션 조건에 해당하는 그리드 데이터 정보 * @private */ _getDataParam: function(requestType, options) { @@ -631,7 +634,8 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * @param {boolean} [options.hasDataParam=true] request 데이터에 rowList 관련 데이터가 포함될 지 여부. * @param {boolean} [options.isOnlyModified=true] rowList 관련 데이터 중 수정된 데이터만 포함할 지 여부 * @param {boolean} [options.isOnlyChecked=true] rowList 관련 데이터 중 checked 된 데이터만 포함할 지 여부 - * @return {{requestType: string, url: string, data: object, type: string, dataType: string}} ajax 호출시 사용될 option 파라미터 + * @returns {{requestType: string, url: string, data: object, type: string, dataType: string}} + * ajax 호출시 사용될 option 파라미터 * @private */ _getRequestParam: function(requestType, options) { @@ -661,7 +665,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * requestType 에 따른 컨펌 메세지를 노출한다. * @param {String} requestType 요청 타입. 'createData|updateData|deleteData|modifyData' 중 하나를 인자로 넘긴다. * @param {Number} count 전송될 데이터 개수 - * @return {boolean} 계속 진행할지 여부를 반환한다. + * @returns {boolean} 계속 진행할지 여부를 반환한다. * @private */ _isConfirmed: function(requestType, count) { @@ -680,7 +684,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * confirm message 를 반환한다. * @param {String} requestType 요청 타입. 'createData|updateData|deleteData|modifyData' 중 하나를 인자로 넘긴다. * @param {Number} count 전송될 데이터 개수 - * @return {string} 생성된 confirm 메세지 + * @returns {string} 생성된 confirm 메세지 * @private */ _getConfirmMessage: function(requestType, count) { @@ -831,11 +835,13 @@ var common = require('./common'); /** * Base class for Collection * @module base/collection + * @mixes module:base/common */ var Collection = Backbone.Collection.extend(/**@lends module:base/collection.prototype */{ /** - * @mixes module:base/common * @constructs + * @param {Array.} models - Models + * @param {Object} options - Options */ initialize: function(models, options) {}, @@ -895,11 +901,11 @@ var common = require('./common'); /** * Base class for Models * @module base/model + * @mixes module:base/common */ var Model = Backbone.Model.extend(/**@lends module:base/model.prototype*/{ /** * @constructs - * @mixes module:base/common * @param {Object} attributes Attributes */ initialize: function(attributes) {} @@ -928,9 +934,10 @@ var common = require('./common'); var Painter = tui.util.defineClass(/**@lends module:base/painter.prototype */{ /** * @constructs + * @param {Object} attrs - Attributes */ - init: function(attributes) { - var grid = attributes && attributes.grid || this.collection && this.collection.grid || null; + init: function(attrs) { + var grid = attrs && attrs.grid || this.collection && this.collection.grid || null; this.setOwnProperties({ grid: grid }); @@ -989,11 +996,11 @@ var common = require('./common'); /** * Base class for Views * @module base/view + * @mixes module:base/common */ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ /** * @constructs - * @mixes module:base/common * @param {Object} attributes Attributes */ initialize: function(attributes) { @@ -1003,7 +1010,7 @@ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ /** * 에러 객체를 반환한다. * @param {String} message - Error message - * @return {error} 에러객체 + * @returns {error} 에러객체 */ error: function(message) { var GridError = function() { @@ -1015,28 +1022,24 @@ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ }, /** - * destroy 시 함께 삭제할 View 를 내부 변수 _children 에 추가한다. - * @param {instance} instance 인스턴스 객체 - * @return {instance} instance 인자로 전달받은 인스턴스 객체 + * Add children views + * @param {(Object|Array)} views - View instance of Array of view instances + * @private */ _addChildren: function(views) { if (!_.isArray(views)) { views = [views]; } - _.each(views, function(view) { - this._children.push(view); - }, this); + [].push.apply(this._children, views); }, /** * Render children and returns thier elements as array. - * @return {array.} An array of element of children + * @returns {array.} An array of element of children */ _renderChildren: function() { - var elements = []; - - _.each(this._children, function(view) { - elements.push(view.render().el); + var elements = _.map(this._children, function(view) { + return view.render().el; }); return elements; }, @@ -1053,7 +1056,7 @@ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ /** * customEvent 에서 사용할 이벤트 객체를 포멧에 맞게 생성하여 반환한다. * @param {Object} data 이벤트 핸들러에 넘길 데이터 - * @return {{_isStopped: boolean, stop: function, param1: param1, param2: param2}} 생성된 커스텀 이벤트 객체 + * @returns {{_isStopped: boolean, stop: function, param1: param1, param2: param2}} 생성된 커스텀 이벤트 객체 */ createEventData: function(data) { var eventData = $.extend({}, data); @@ -1071,7 +1074,7 @@ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ * 등록되어있는 자식 View 들을 제거한다. */ _destroyChildren: function() { - if (_.isArray(this._children)) { + if (this._children) { while (this._children.length > 0) { this._children.pop().destroy(); } @@ -1123,6 +1126,10 @@ module.exports = { LOADING: 'LOADING', DONE: 'DONE', EMPTY: 'EMPTY' + }, + dimension: { + CELL_BORDER_WIDTH: 1, + TABLE_BORDER_WIDTH: 1 } } @@ -1145,11 +1152,9 @@ var formUtil = { setInput: { /** * 배열의 값들을 전부 String 타입으로 변환한다. - * @memberof module:util - * @private - * @alias form.setInput['_changeToStringInArray'] + * @ignore * @param {Array} arr 변환할 배열 - * @return {Array} 변환된 배열 결과 값 + * @returns {Array} 변환된 배열 결과 값 */ '_changeToStringInArray': function(arr) { _.each(arr, function(value, i) { @@ -1160,8 +1165,7 @@ var formUtil = { /** * radio type 의 input 요소의 값을 설정한다. - * @memberof module:util - * @alias form.setInput['radio'] + * @ignore * @param {HTMLElement} targetElement - Target element * @param {String} formValue - Form value */ @@ -1171,8 +1175,8 @@ var formUtil = { /** * radio type 의 input 요소의 값을 설정한다. + * @ignore * @memberof module:util - * @alias form.setInput.checkbox * @param {HTMLElement} targetElement - Target element * @param {String} formValue - Form value */ @@ -1186,8 +1190,7 @@ var formUtil = { /** * select-one type 의 input 요소의 값을 설정한다. - * @memberof module:util - * @alias form.setInput['select-one'] + * @ignore * @param {HTMLElement} targetElement - Target element * @param {String} formValue - Form value */ @@ -1204,8 +1207,7 @@ var formUtil = { /** * select-multiple type 의 input 요소의 값을 설정한다. - * @memberof module:util - * @alias form.setinput['select-multiple'] + * @ignore * @param {HTMLElement} targetElement - Target element * @param {String} formValue - Form value */ @@ -1226,7 +1228,6 @@ var formUtil = { /** * input 요소의 값을 설정하는 default 로직 * @memberof module:util - * @alias form.setinput['defaultAction'] * @param {HTMLElement} targetElement - Target element * @param {String} formValue - Form value */ @@ -1240,7 +1241,7 @@ var formUtil = { * @memberof module:util * @alias form.getFormData * @param {jQuery} $form jQuery()로 감싼 폼엘리먼트 - * @return {object} form 내의 데이터들을 key:value 형태의 DataObject 로 반환한다. + * @returns {object} form 내의 데이터들을 key:value 형태의 DataObject 로 반환한다. **/ getFormData: function($form) { var result = {}, @@ -1267,7 +1268,7 @@ var formUtil = { * @alias form.getFormElement * @param {jQuery} $form jQuery()로 감싼 폼엘리먼트 * @param {String} [elementName] 특정 이름의 인풋 엘리먼트만 가져오고 싶은 경우 전달하며, 생략할 경우 모든 인풋 엘리먼트를 배열 형태로 리턴한다. - * @return {jQuery} jQuery 로 감싼 엘리먼트를 반환한다. + * @returns {jQuery} jQuery 로 감싼 엘리먼트를 반환한다. */ getFormElement: function($form, elementName) { var formElement; @@ -1355,7 +1356,6 @@ var formUtil = { module.exports = formUtil; - },{}],10:[function(require,module,exports){ /** * @fileoverview 유틸리티 메서드 모음 @@ -1373,7 +1373,7 @@ var util = { * HTML Attribute 설정 시 필요한 문자열을 가공한다. * @memberof module:util * @param {{key:value}} attributes 문자열로 가공할 attribute 데이터 - * @return {string} html 마크업에 포함될 문자열 + * @returns {string} html 마크업에 포함될 문자열 * @example var str = util.getAttributesString({ 'class': 'focused disabled', @@ -1396,7 +1396,7 @@ var util = { * 배열의 합을 반환한다. * @memberof module:util * @param {number[]} list 총 합을 구할 number 타입 배열 - * @return {number} 합산한 결과값 + * @returns {number} 합산한 결과값 */ sum: function(list) { return _.reduce(list, function(memo, value) { @@ -1407,8 +1407,8 @@ var util = { /** * Return min and max value in array - * @param {Array} arr - * @returns {{min: number, max: number}} + * @param {Array} arr - Target array + * @returns {{min: number, max: number}} Min and Max * @see {@link http://jsperf.com/getminmax} */ getMinMax: function(arr) { @@ -1423,7 +1423,7 @@ var util = { * @memberof module:util * @param {number} rowCount 행 개수 * @param {number} rowHeight 한 행당 높이 - * @return {number} 계산된 높이 + * @returns {number} 계산된 높이 */ getHeight: function(rowCount, rowHeight) { return rowCount === 0 ? rowCount : rowCount * (rowHeight + 1) + 1; @@ -1434,7 +1434,7 @@ var util = { * @memberof module:util * @param {number} height 테이블 body 높이 * @param {number} rowHeight 한 행당 높이 - * @return {number} 테이블 body 당 보여지는 행 개수 + * @returns {number} 테이블 body 당 보여지는 행 개수 */ getDisplayRowCount: function(height, rowHeight) { return Math.ceil((height - 1) / (rowHeight + 1)); @@ -1445,7 +1445,7 @@ var util = { * @memberof module:util * @param {number} rowCount 행 개수 * @param {number} height 테이블 body 높이 - * @return {number} 한 행당 높이값 + * @returns {number} 한 행당 높이값 */ getRowHeight: function(rowCount, height) { return rowCount === 0 ? 0 : Math.floor(((height - 1) / rowCount)) - 1; @@ -1457,7 +1457,7 @@ var util = { * @memberof module:util * @param {*} target 동등 비교할 target * @param {*} dist 동등 비교할 dist - * @return {boolean} 동일한지 여부 + * @returns {boolean} 동일한지 여부 */ isEqual: function(target, dist) { var isDiff, @@ -1488,7 +1488,7 @@ var util = { * Returns whether the string blank. * @memberof module:util * @param {*} target - target object - * @return {boolean} True if target is undefined or null or '' + * @returns {boolean} True if target is undefined or null or '' */ isBlank: function(target) { if (_.isString(target)) { @@ -1501,7 +1501,7 @@ var util = { * Grid 에서 필요한 형태로 HTML tag 를 제거한다. * @memberof module:util * @param {string} htmlString html 마크업 문자열 - * @return {String} HTML tag 에 해당하는 부분을 제거한 문자열 + * @returns {String} HTML tag 에 해당하는 부분을 제거한 문자열 */ stripTags: function(htmlString) { var matchResult; @@ -1513,7 +1513,9 @@ var util = { } else { htmlString = htmlString.replace(//gi, ''); } - htmlString = $.trim(tui.util.decodeHTMLEntity(htmlString.replace(/<\/?(?:h[1-5]|[a-z]+(?:\:[a-z]+)?)[^>]*>/ig, ''))); + htmlString = $.trim(tui.util.decodeHTMLEntity( + htmlString.replace(/<\/?(?:h[1-5]|[a-z]+(?:\:[a-z]+)?)[^>]*>/ig, '') + )); } return htmlString; }, @@ -1521,7 +1523,7 @@ var util = { /** * Create unique key * @memberof module:util - * @return {number} unique key 를 반환한다. + * @returns {number} unique key 를 반환한다. */ getUniqueKey: function() { this.uniqueId += 1; @@ -1532,7 +1534,7 @@ var util = { * object 를 query string 으로 변경한다. * @memberof module:util * @param {object} dataObj 쿼리 문자열으로 반환할 객체 - * @return {string} 변환된 쿼리 문자열 + * @returns {string} 변환된 쿼리 문자열 */ toQueryString: function(dataObj) { var queryList = []; @@ -1554,7 +1556,7 @@ var util = { * queryString 을 object 형태로 변형한다. * @memberof module:util * @param {String} queryString 쿼리 문자열 - * @return {Object} 변환한 Object + * @returns {Object} 변환한 Object */ toQueryObject: function(queryString) { var queryList = queryString.split('&'), @@ -1585,7 +1587,7 @@ var util = { * @memberof module:util * @param {*} value 컨버팅할 value * @param {String} type 컨버팅 될 타입 - * @return {*} 타입 컨버팅된 value + * @returns {*} 타입 컨버팅된 value */ convertValueType: function(value, type) { if (type === 'string') { @@ -1599,7 +1601,7 @@ var util = { /** * Capitalize first character of the target string. * @param {string} string Target string - * @return {string} Converted new string + * @returns {string} Converted new string */ toUpperCaseFirstLetter: function(string) { return string.charAt(0).toUpperCase() + string.slice(1); @@ -1627,7 +1629,7 @@ var util = { /** * Returns whether the browser is IE7 - * @return {boolean} True if the browser is IE7 + * @returns {boolean} True if the browser is IE7 */ isBrowserIE7: function() { var browser = tui.util.browser; @@ -1661,7 +1663,7 @@ var DomState = tui.util.defineClass(/**@lends module:domState.prototype */{ * Returns the element of the table-cell identified by rowKey and columnName * @param {(Number|String)} rowKey - Row key * @param {String} columnName - Column name - * @return {jQuery} Cell(TD) element + * @returns {jQuery} Cell(TD) element */ getElement: function(rowKey, columnName) { return this.$el.find('tr[key="' + rowKey + '"]').find('td[columnname="' + columnName + '"]'); @@ -1669,7 +1671,7 @@ var DomState = tui.util.defineClass(/**@lends module:domState.prototype */{ /** * Returns the offset of the container element - * @return {{top: Number, left: Number} Offset object + * @returns {{top: Number, left: Number}} Offset object */ getOffset: function() { return this.$el.offset(); @@ -1683,6 +1685,14 @@ var DomState = tui.util.defineClass(/**@lends module:domState.prototype */{ return this.$el.width(); }, + /** + * Returns the height of the parent of container element. + * @returns {Number} Height of the parent of container element + */ + getParentHeight: function() { + return this.$el.parent().height(); + }, + /** * Returns whether there's child element having focus. * @returns {boolean} True if there's child element having focus @@ -1705,53 +1715,98 @@ module.exports = DomState; * Grid public API * * @param {Object} options - * @param {number} [options.columnFixCount=0] - Column index for fixed column. The columns indexed from 0 to this value will always be shown on the left side. {@link tui.Grid#setColumnFixCount|setColumnFixCount} can be used for setting this value dynamically. - * @param {string} [options.selectType=''] - Type of buttons shown next to the _number(rowKey) column. The string value 'checkbox' or 'radiobox' can be used. If not specified, the button column will not be shown. - * @param {boolean} [options.autoNumbering=true] - Specifies whether to assign a auto increasing number to each rows when rendering time. - * @param {number} [options.headerHeight=35] - The height of header area. When rows in header are multiple (merged column), this value must be the total height of rows. + * @param {number} [options.columnFixCount=0] - Column index for fixed column. The columns indexed from 0 to this + * value will always be shown on the left side. {@link tui.Grid#setColumnFixCount|setColumnFixCount} + * can be used for setting this value dynamically. + * @param {string} [options.selectType=''] - Type of buttons shown next to the _number(rowKey) column. + * The string value 'checkbox' or 'radiobox' can be used. + * If not specified, the button column will not be shown. + * @param {boolean} [options.autoNumbering=true] - Specifies whether to assign a auto increasing number + * to each rows when rendering time. + * @param {number} [options.headerHeight=35] - The height of header area. + * When rows in header are multiple (merged column), this value must be the total height of rows. * @param {number} [options.rowHeight=27] - The height of each rows. - * @param {number} [options.displayRowCount=10] - The number of rows to be shown in the table area. Total height of grid will be set based on this value. + * @param {number} [options.displayRowCount=10] - The number of rows to be shown in the table area. + * Total height of grid will be set based on this value. * @param {number} [options.minimumColumnWidth=50] - Minimum width of each columns. - * @param {boolean} [options.useClientSort=true] - If set to true, sorting will be executed by client itself without server. - * @param {boolean} [options.singleClickEdit=false] - If set to true, text-convertible cell will be changed to edit-mode with a single click. + * @param {boolean} [options.useClientSort=true] - If set to true, sorting will be executed by client itself + * without server. + * @param {boolean} [options.singleClickEdit=false] - If set to true, text-convertible cell will be changed to + * edit-mode with a single click. * @param {boolean} [options.scrollX=true] - Specifies whether to show horizontal scrollbar. * @param {boolean} [options.scrollY=true] - Specifies whether to show vertical scrollbar. - * @param {string} [options.keyColumnName=null] - The name of the column to be used to identify each rows. If not specified, unique value for each rows will be created internally. + * @param {boolean} [options.fitToParentHeight=false] - If set to true, the height of the grid will expand to + * fit the height of parent element. + * @param {boolean} [options.showDummyRows=false] - If set to true, empty area will be filled with dummy rows. + * @param {string} [options.keyColumnName=null] - The name of the column to be used to identify each rows. + * If not specified, unique value for each rows will be created internally. * @param {Object} [options.toolbar] - The object for configuring toolbar UI. * @param {boolean} [options.toolbar.hasResizeHandler=true] - Specifies whether to use the resize hendler. * @param {boolean} [options.toolbar.hasControlPanel=true] - Specifies whether to use the control panel. * @param {boolean} [options.toolbar.hasPagination=true] - Specifies whether to use the pagination. * @param {array} options.columnModelList - The configuration of the grid columns. * @param {string} options.columnModelList.columnName - The name of the column. - * @param {boolean} [options.columnModelList.isEllipsis=false] - If set to true, ellipsis will be used for overflowing content. - * @param {string} [options.columnModelList.align=left] - Horizontal alignment of the column content. Available values are 'left', 'center', 'right'. - * @param {string} [options.columnModelList.className] - The name of the class to be used for all cells of the column. + * @param {boolean} [options.columnModelList.isEllipsis=false] - If set to true, ellipsis will be used + * for overflowing content. + * @param {string} [options.columnModelList.align=left] - Horizontal alignment of the column content. + * Available values are 'left', 'center', 'right'. + * @param {string} [options.columnModelList.className] - The name of the class to be used for all cells of + * the column. * @param {string} [options.columnModelList.title] - The title of the column to be shown on the header. * @param {number} [options.columnModelList.width] - The width of the column. The unit is pixel. * @param {boolean} [options.columnModelList.isHidden] - If set to true, the column will not be shown. - * @param {boolean} [options.columnModelList.isFixedWidth=false] - If set to true, the width of the column will not be changed. - * @param {string} [options.columnModelList.defaultValue] - The default value to be shown when the column doesn't have a value. - * @param {function} [options.columnModelList.formatter] - The function that formats the value of the cell. The retrurn value of the function will be shown as the value of the cell. - * @param {boolean} [options.columnModelList.notUseHtmlEntity=false] - If set to true, the value of the cell will not be encoded as HTML entities. - * @param {boolean} [options.columnModelList.isIgnore=false] - If set to true, the value of the column will be ignored when setting up the list of modified rows. - * @param {boolean} [options.columnModelList.isSortable=false] - If set to true, sort button will be shown on the right side of the column header, which executes the sort action when clicked. + * @param {boolean} [options.columnModelList.isFixedWidth=false] - If set to true, the width of the column + * will not be changed. + * @param {boolean} [options.columnModelList.isRequired=false] - If set to true, the data of the column + * will be checked to be not empty whenever data is changed or calling {@link tui.Grid#validate}. + * @param {string} [options.columnModelList.defaultValue] - The default value to be shown when the column + * doesn't have a value. + * @param {function} [options.columnModelList.formatter] - The function that formats the value of the cell. + * The retrurn value of the function will be shown as the value of the cell. + * @param {boolean} [options.columnModelList.notUseHtmlEntity=false] - If set to true, the value of the cell + * will not be encoded as HTML entities. + * @param {boolean} [options.columnModelList.isIgnore=false] - If set to true, the value of the column will be + * ignored when setting up the list of modified rows. + * @param {boolean} [options.columnModelList.isSortable=false] - If set to true, sort button will be shown on + * the right side of the column header, which executes the sort action when clicked. * @param {Array} [options.columnModelList.editOption] - The object for configuring editing UI. - * @param {string} [options.columnModelList.editOption.type='normal'] - The string value that specifies the type of the editing UI. Available values are 'text', 'text-password', 'text-convertible', 'select', 'radio', 'checkbox'. - * @param {Array} [options.columnModelList.editOption.list] - Specifies the option list for the 'select', 'radio', 'checkbox' type. The item of the array must contain properties named 'text' and 'value'. (e.g. [{text: 'option1', value: 1}, {...}]) - * @param {function} [options.columnModelList.editOption.changeBeforeCallback] - The function that will be called before changing the value of the cell. If returns false, the changing will be canceled. - * @param {function} [options.columnModelList.editOption.changeAfterCallback] - The function that will be called after changing the value of the cell. - * @param {string} [options.columnModelList.editOption.beforeText] Deprecated. (replaced with {@link beforeContent}) - * @param {(string|function)} [options.columnModelList.editOption.beforeContent] - The HTML string to be shown left to the value. If it's a function, the return value will be used. - * @param {string} [options.columnModelList.editOption.afterText] Deprecated. (replaced with {@link afterContent}) - * @param {(string|function)} [options.columnModelList.editOption.afterContent] - The HTML string to be shown right to the value. If it's a function, the return value will be used. - * @param {function} [options.columnModelList.editOption.converter] - The function whose return value (HTML) represents the UI of the cell. If the return value is falsy(null|undefined|false), default UI will be shown. This option is available for the 'text', 'text-password', 'select', 'checkbox', 'radio' type. - * @param {Object} [options.columnModelList.editOption.inputEvents] - The object that has an event name as a key and event handler as a value for events on input element. + * @param {string} [options.columnModelList.editOption.type='normal'] - The string value that specifies + * the type of the editing UI. + * Available values are 'text', 'text-password', 'text-convertible', 'select', 'radio', 'checkbox'. + * @param {Array} [options.columnModelList.editOption.list] - Specifies the option list for the + * 'select', 'radio', 'checkbox' type. The item of the array must contain properties named + * 'text' and 'value'. (e.g. [{text: 'option1', value: 1}, {...}]) + * @param {function} [options.columnModelList.editOption.changeBeforeCallback] - The function that will be + * called before changing the value of the cell. If returns false, the changing will be canceled. + * @param {function} [options.columnModelList.editOption.changeAfterCallback] - The function that will be + * called after changing the value of the cell. + * @param {string} [options.columnModelList.editOption.beforeText] Deprecated. + * (replaced with {@link beforeContent}) + * @param {(string|function)} [options.columnModelList.editOption.beforeContent] - The HTML string to be + * shown left to the value. If it's a function, the return value will be used. + * @param {string} [options.columnModelList.editOption.afterText] Deprecated. + * (replaced with {@link afterContent}) + * @param {(string|function)} [options.columnModelList.editOption.afterContent] - The HTML string to be + * shown right to the value. If it's a function, the return value will be used. + * @param {function} [options.columnModelList.editOption.converter] - The function whose + * return value (HTML) represents the UI of the cell. If the return value is + * falsy(null|undefined|false), default UI will be shown. + * This option is available for the 'text', 'text-password', 'select', 'checkbox', 'radio' type. + * @param {Object} [options.columnModelList.editOption.inputEvents] - The object that has an event name + * as a key and event handler as a value for events on input element. * @param {Array} [options.columnModelList.relationList] - Specifies relation between this and other column. * @param {array} [options.columnModelList.relationList.columnList] - Array of the names of target columns. - * @param {function} [options.columnModelList.relationList.isDisabled] - If returns true, target columns will be disabled. - * @param {function} [options.columnModelList.relationList.isEditable] - If returns true, target columns will be editable. - * @param {function} [options.columnModelList.relationList.optionListChange] - The function whose return value specifies the option list for the 'select', 'radio', 'checkbox' type. The options list of target columns will be replaced with the return value of this function. - * @param {array} options.columnMerge - The array that specifies the merged column. This options does not merge the cells of multiple columns into a single cell. This options only effects to the headers of the multiple columns, creates a new parent header that includes the headers of spcified columns, and sets up the hierarchy. + * @param {function} [options.columnModelList.relationList.isDisabled] - If returns true, target columns + * will be disabled. + * @param {function} [options.columnModelList.relationList.isEditable] - If returns true, target columns + * will be editable. + * @param {function} [options.columnModelList.relationList.optionListChange] - The function whose return + * value specifies the option list for the 'select', 'radio', 'checkbox' type. + * The options list of target columns will be replaced with the return value of this function. + * @param {array} options.columnMerge - The array that specifies the merged column. + * This options does not merge the cells of multiple columns into a single cell. + * This options only effects to the headers of the multiple columns, creates a new parent header + * that includes the headers of spcified columns, and sets up the hierarchy. * @constructor tui.Grid * @example
@@ -1764,6 +1819,8 @@ module.exports = DomState; headerHeight: 100, //(default=35) rowHeight: 27, // (default=27) displayRowCount: 10, //(default=10) + fitToParentHeight: true // (default=false) + showDummyRows: false // (default=false) minimumColumnWidth: 50, //(default=50) scrollX: true, //(default:true) scrollY: true, //(default:true) @@ -1841,6 +1898,7 @@ module.exports = DomState; title: 'password input column', columnName: 'column5', width: 100, + isRequired: true, isFixedWidth: true, editOption: { type: 'text-password', @@ -1988,7 +2046,8 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ /** * Creates core model and returns it. * @param {Object} options - Options set by user - * @return {module:model/manager} - New model manager object + * @returns {module:model/manager} - New model manager object + * @private */ _createModelManager: function(options) { var domState = new DomState(this.$el), @@ -2003,7 +2062,8 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ /** * Creates painter manager and returns it - * @return {module:painter/manager} - New painter manager object + * @returns {module:painter/manager} - New painter manager object + * @private */ _createPainterManager: function() { return new PainterManager({ @@ -2014,7 +2074,8 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ /** * Creates container view and returns it * @param {Object} options - Options set by user - * @return {module:view/container} - New container view object + * @returns {module:view/container} - New container view object + * @private */ _createContainerView: function(options) { var viewFactory = new ViewFactory({ @@ -2030,7 +2091,8 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ /** * Creates public event emitter and returns it. - * @return {module:publicEventEmitter} - New public event emitter + * @returns {module:publicEventEmitter} - New public event emitter + * @private */ _createPublicEventEmitter: function() { var emitter = new PublicEventEmitter(this); @@ -2041,6 +2103,22 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ return emitter; }, + /** + * Disables all rows. + * @api + */ + disable: function() { + this.modelManager.dataModel.setDisabled(true); + }, + + /** + * Enables all rows. + * @api + */ + enable: function() { + this.modelManager.dataModel.setDisabled(false); + }, + /** * Disables the row identified by the rowkey. * @api @@ -2049,6 +2127,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ disableRow: function(rowKey) { this.modelManager.dataModel.disableRow(rowKey); }, + /** * Enables the row identified by the rowKey. * @api @@ -2057,23 +2136,25 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ enableRow: function(rowKey) { this.modelManager.dataModel.enableRow(rowKey); }, + /** * Returns the value of the cell identified by the rowKey and columnName. * @api * @param {(number|string)} rowKey - The unique key of the target row. * @param {string} columnName - The name of the column * @param {boolean} [isOriginal] - It set to true, the original value will be return. - * @return {(number|string)} - The value of the cell + * @returns {(number|string)} - The value of the cell */ getValue: function(rowKey, columnName, isOriginal) { return this.modelManager.dataModel.getValue(rowKey, columnName, isOriginal); }, + /** * Returns a list of all values in the specified column. * @api * @param {string} columnName - The name of the column * @param {boolean} [isJsonString=false] - It set to true, return value will be converted to JSON string. - * @return {(Array|string)} - A List of all values in the specified column. (or JSON string of the list) + * @returns {(Array|string)} - A List of all values in the specified column. (or JSON string of the list) */ getColumnValues: function(columnName, isJsonString) { return this.modelManager.dataModel.getColumnValues(columnName, isJsonString); @@ -2084,7 +2165,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ * @api * @param {(number|string)} rowKey - The unique key of the target row * @param {boolean} [isJsonString=false] - If set to true, return value will be converted to JSON string. - * @return {(Object|string)} - The object that contains all values in the row. (or JSON string of the object) + * @returns {(Object|string)} - The object that contains all values in the row. (or JSON string of the object) */ getRow: function(rowKey, isJsonString) { return this.modelManager.dataModel.getRowData(rowKey, isJsonString); @@ -2095,38 +2176,41 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ * @api * @param {number} index - The index of the row * @param {Boolean} [isJsonString=false] - If set to true, return value will be converted to JSON string. - * @return {Object|string} - The object that contains all values in the row. (or JSON string of the object) + * @returns {Object|string} - The object that contains all values in the row. (or JSON string of the object) */ getRowAt: function(index, isJsonString) { - return this.modelManager.dataModel.getRowData(index, isJsonString); + return this.modelManager.dataModel.getRowDataAt(index, isJsonString); }, /** * Returns the total number of the rows. * @api - * @return {number} - The total number of the rows + * @returns {number} - The total number of the rows */ getRowCount: function() { return this.modelManager.dataModel.length; }, + /** * Returns the rowKey of the currently selected row. * @api - * @return {(number|string)} - The rowKey of the row + * @returns {(number|string)} - The rowKey of the row */ getSelectedRowKey: function() { return this.modelManager.focusModel.which().rowKey; }, + /** * Returns the jquery object of the cell identified by the rowKey and columnName. * @api * @param {(number|string)} rowKey - The unique key of the row * @param {string} columnName - The name of the column - * @return {jQuery} - The jquery object of the cell element + * @returns {jQuery} - The jquery object of the cell element */ getElement: function(rowKey, columnName) { return this.modelManager.dataModel.getElement(rowKey, columnName); }, + /** * Sets the value of the cell identified by the specified rowKey and columnName. * @api @@ -2137,6 +2221,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ setValue: function(rowKey, columnName, columnValue) { this.modelManager.dataModel.setValue(rowKey, columnName, columnValue); }, + /** * Sets the all values in the specified column. * @api @@ -2147,6 +2232,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ setColumnValues: function(columnName, columnValue, isCheckCellState) { this.modelManager.dataModel.setColumnValues(columnName, columnValue, isCheckCellState); }, + /** * Replace all rows with the specified list. This will not change the original data. * @api @@ -2155,6 +2241,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ replaceRowList: function(rowList) { this.modelManager.dataModel.replaceRowList(rowList); }, + /** * Replace all rows with the specified list. This will change the original data. * @api @@ -2164,6 +2251,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ setRowList: function(rowList, callback) { this.modelManager.dataModel.setRowList(rowList, true, callback); }, + /** * Sets focus on the cell identified by the specified rowKey and columnName. * @api @@ -2175,6 +2263,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ this.modelManager.focusModel.focusClipboard(); this.modelManager.focusModel.focus(rowKey, columnName, isScrollable); }, + /** * Sets focus on the cell at the specified index of row and column. * @api @@ -2185,6 +2274,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ focusAt: function(rowIndex, columnIndex, isScrollable) { this.modelManager.focusModel.focusAt(rowIndex, columnIndex, isScrollable); }, + /** * Sets focus on the cell at the specified index of row and column and starts to edit. * @api @@ -2195,6 +2285,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ focusIn: function(rowKey, columnName, isScrollable) { this.modelManager.focusModel.focusIn(rowKey, columnName, isScrollable); }, + /** * Sets focus on the cell at the specified index of row and column and starts to edit. * @api @@ -2204,6 +2295,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ focusInAt: function(rowIndex, columnIndex, isScrollable) { this.modelManager.focusModel.focusInAt(rowIndex, columnIndex, isScrollable); }, + /** * Makes view ready to get keyboard input. * @api @@ -2211,6 +2303,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ readyForKeyControl: function() { this.modelManager.focusModel.focusClipboard(); }, + /** * Removes focus from the focused cell. * @api @@ -2218,6 +2311,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ blur: function() { this.modelManager.focusModel.blur(); }, + /** * Checks all rows. * @api @@ -2225,6 +2319,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ checkAll: function() { this.modelManager.dataModel.checkAll(); }, + /** * Checks the row identified by the specified rowKey. * @api @@ -2233,6 +2328,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ check: function(rowKey) { this.modelManager.dataModel.check(rowKey); }, + /** * Unchecks all rows. * @api @@ -2240,6 +2336,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ uncheckAll: function() { this.modelManager.dataModel.uncheckAll(); }, + /** * Unchecks the row identified by the specified rowKey. * @api @@ -2248,6 +2345,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ uncheck: function(rowKey) { this.modelManager.dataModel.uncheck(rowKey); }, + /** * Removes all rows. * @api @@ -2255,13 +2353,16 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ clear: function() { this.modelManager.dataModel.setRowList([]); }, + /** * Removes the row identified by the specified rowKey. * @api * @param {(number|string)} rowKey - The unique key of the row - * @param {(boolean|object)} [options] - Options. If the type is boolean, this value is equivalent to options.removeOriginalData. + * @param {(boolean|object)} [options] - Options. If the type is boolean, this value is equivalent to + * options.removeOriginalData. * @param {boolean} [options.removeOriginalData] - If set to true, the original data will be removed. - * @param {boolean} [options.keepRowSpanData] - If set to true, the value of the merged cells will not be removed although the target is first cell of them. + * @param {boolean} [options.keepRowSpanData] - If set to true, the value of the merged cells will not be + * removed although the target is first cell of them. */ removeRow: function(rowKey, options) { if (tui.util.isBoolean(options) && options) { @@ -2271,14 +2372,15 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ } this.modelManager.dataModel.removeRow(rowKey, options); }, + /** * Removes all checked rows. * @api * @param {boolean} isConfirm - If set to true, confirm message will be shown before remove. - * @return {boolean} - True if there's at least one row removed. + * @returns {boolean} - True if there's at least one row removed. */ removeCheckedRows: function(isConfirm) { - var rowKeyList = this.modelManager.getCheckedRowKeyList(), + var rowKeyList = this.getCheckedRowKeyList(), message = rowKeyList.length + '건의 데이터를 삭제하시겠습니까?'; if (rowKeyList.length > 0 && (!isConfirm || confirm(message))) { @@ -2289,6 +2391,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ } return false; }, + /** * Enables the row identified by the rowKey to be able to check. * @api @@ -2297,6 +2400,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ enableCheck: function(rowKey) { this.modelManager.dataModel.enableCheck(rowKey); }, + /** * Disables the row identified by the spcified rowKey to not be abled to check. * @api @@ -2305,11 +2409,12 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ disableCheck: function(rowKey) { this.modelManager.dataModel.disableCheck(rowKey); }, + /** * Returns a list of the rowKey of checked rows. * @api * @param {Boolean} [isJsonString=false] - If set to true, return value will be converted to JSON string. - * @return {Array|string} - A list of the rowKey. (or JSON string of the list) + * @returns {Array|string} - A list of the rowKey. (or JSON string of the list) */ getCheckedRowKeyList: function(isJsonString) { var checkedRowList = this.modelManager.dataModel.getRowList(true), @@ -2317,11 +2422,12 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ return isJsonString ? $.toJSON(checkedRowKeyList) : checkedRowKeyList; }, + /** * Returns a list of the checked rows. * @api * @param {Boolean} [isJsonString=false] - If set to true, return value will be converted to JSON string. - * @return {Array|string} - A list of the checked rows. (or JSON string of the list) + * @returns {Array|string} - A list of the checked rows. (or JSON string of the list) */ getCheckedRowList: function(isJsonString) { var checkedRowList = this.modelManager.dataModel.getRowList(true); @@ -2332,61 +2438,73 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ /** * Returns a list of the column model. * @api - * @return {Array} - A list of the column model. + * @returns {Array} - A list of the column model. */ getColumnModelList: function() { return this.modelManager.columnModel.get('dataColumnModelList'); }, + /** * Returns the object that contains the lists of changed data compared to the original data. * The object has properties 'createList', 'updateList', 'deleteList'. * @api * @param {Object} [options] Options * @param {boolean} [options.isOnlyChecked=false] - If set to true, only checked rows will be considered. - * @param {boolean} [options.isRaw=false] - If set to true, the data will contains the row data for internal use. - * @param {boolean} [options.isOnlyRowKeyList=false] - If set to true, only keys of the changed rows will be returned. + * @param {boolean} [options.isRaw=false] - If set to true, the data will contains + * the row data for internal use. + * @param {boolean} [options.isOnlyRowKeyList=false] - If set to true, only keys of the changed + * rows will be returned. * @param {Array} [options.filteringColumnList] - A list of column name to be excluded. - * @return {{createList: Array, updateList: Array, deleteList: Array}} - Object that contains the result list. + * @returns {{createList: Array, updateList: Array, deleteList: Array}} - Object that contains the result list. */ getModifiedRowList: function(options) { return this.modelManager.dataModel.getModifiedRowList(options); }, + /** * Insert the new row with specified data to the end of table. * @api * @param {object} [row] - The data for the new row * @param {object} [options] - Options * @param {number} [options.at] - The index at which new row will be inserted - * @param {boolean} [options.extendPrevRowSpan] - If set to true and the previous row at target index has a rowspan data, the new row will extend the existing rowspan data. + * @param {boolean} [options.extendPrevRowSpan] - If set to true and the previous row at target index + * has a rowspan data, the new row will extend the existing rowspan data. + * @param {boolean} [options.focus] - If set to true, move focus to the new row after appending */ appendRow: function(row, options) { this.modelManager.dataModel.append(row, options); }, + /** * Insert the new row with specified data to the beginning of table. * @api * @param {object} [row] - The data for the new row + * @param {object} [options] - Options + * @param {boolean} [options.focus] - If set to true, move focus to the new row after appending */ - prependRow: function(row) { - this.modelManager.dataModel.prepend(row); + prependRow: function(row, options) { + this.modelManager.dataModel.prepend(row, options); }, + /** * Returns true if there are at least one row changed. * @api - * @return {boolean} - True if there are at least one row changed. + * @returns {boolean} - True if there are at least one row changed. */ isChanged: function() { return this.modelManager.dataModel.isChanged(); }, + /** * Returns the instance of specified AddOn. * @api * @param {string} name - The name of the AddOn - * @return {instance} addOn - The instance of the AddOn + * @returns {instance} addOn - The instance of the AddOn */ getAddOn: function(name) { return name ? this.addOn[name] : this.addOn; }, + /** * Restores the data to the original data. * (Original data is set by {@link tui.Grid#setRowList|setRowList} @@ -2395,6 +2513,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ restore: function() { this.modelManager.dataModel.restore(); }, + /** * Selects the row identified by the rowKey. * @api @@ -2403,6 +2522,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ select: function(rowKey) { this.modelManager.focusModel.select(rowKey); }, + /** * Unselects selected rows. * @api @@ -2410,6 +2530,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ unselect: function() { this.modelManager.focusModel.unselect(true); }, + /** * Sets the count of fixed column. * @api @@ -2418,6 +2539,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ setColumnFixCount: function(count) { this.modelManager.columnModel.set('columnFixCount', count); }, + /** * Sets the list of column model. * @api @@ -2426,12 +2548,13 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ setColumnModelList: function(columnModelList) { this.modelManager.columnModel.set('columnModelList', columnModelList); }, + /** * Create an specified AddOn and use it on this instance. * @api * @param {string} name - The name of the AddOn to use. * @param {object} options - The option objects for configuring the AddON. - * @return {tui.Grid} - This instance. + * @returns {tui.Grid} - This instance. */ use: function(name, options) { if (name === 'Net') { @@ -2445,14 +2568,16 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ } return this; }, + /** * Returns a list of all rows. * @api - * @return {Array} - A list of all rows + * @returns {Array} - A list of all rows */ getRowList: function() { return this.modelManager.dataModel.getRowList(); }, + /** * Sorts all rows by the specified column. * @api @@ -2461,6 +2586,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ sort: function(columnName) { this.modelManager.dataModel.sortByField(columnName); }, + /** * Unsorts all rows. (Sorts by rowKey). * @api @@ -2468,6 +2594,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ unSort: function() { this.sort('rowKey'); }, + /** * Adds the specified css class to cell element identified by the rowKey and className * @api @@ -2478,6 +2605,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ addCellClassName: function(rowKey, columnName, className) { this.modelManager.dataModel.get(rowKey).addCellClassName(columnName, className); }, + /** * Adds the specified css class to all cell elements in the row identified by the rowKey * @api @@ -2487,6 +2615,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ addRowClassName: function(rowKey, className) { this.modelManager.dataModel.get(rowKey).addClassName(className); }, + /** * Removes the specified css class from the cell element indentified by the rowKey and columnName. * @api @@ -2497,6 +2626,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ removeCellClassName: function(rowKey, columnName, className) { this.modelManager.dataModel.get(rowKey).removeCellClassName(columnName, className); }, + /** * Removes the specified css class from all cell elements in the row identified by the rowKey. * @api @@ -2506,24 +2636,28 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ removeRowClassName: function(rowKey, className) { this.modelManager.dataModel.get(rowKey).removeClassName(className); }, + /** * Returns the rowspan data of the cell identified by the rowKey and columnName. * @api * @param {(number|string)} rowKey - The unique key of the row * @param {string} columnName - The name of the column + * @returns {Object} - Row span data */ getRowSpanData: function(rowKey, columnName) { return this.modelManager.dataModel.getRowSpanData(rowKey, columnName); }, + /** * Returns the index of the row indentified by the rowKey. * @api * @param {number|string} rowKey - The unique key of the row - * @return {number} - The index of the row + * @returns {number} - The index of the row */ getIndexOfRow: function(rowKey) { return this.modelManager.dataModel.indexOfRowKey(rowKey); }, + /** * Sets the number of rows to be shown in the table area. * @api @@ -2532,6 +2666,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ setDisplayRowCount: function(count) { this.modelManager.dimensionModel.set('displayRowCount', count); }, + /** * Sets the width and height of the dimension. * @api @@ -2541,6 +2676,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ setSize: function(width, height) { this.modelManager.dimensionModel.setSize(width, height); }, + /** * Refresh the layout view. Use this method when the view was rendered while hidden. * @api @@ -2548,6 +2684,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ refreshLayout: function() { this.modelManager.dimensionModel.refreshLayout(); }, + /** * Show columns * @api @@ -2557,6 +2694,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ var args = tui.util.toArray(arguments); this.modelManager.columnModel.setHidden(args, false); }, + /** * Hide columns * @api @@ -2566,6 +2704,43 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ var args = tui.util.toArray(arguments); this.modelManager.columnModel.setHidden(args, true); }, + + /** + * Validates all data and returns the result. + * Return value is an array which contains only rows which have invalid cell data. + * @returns {Array.} An array of error object + * @api + * @example + // return value example + [ + { + rowKey: 1, + errors: [ + { + columnName: 'c1', + errorCode: 'REQUIRED' + }, + { + columnName: 'c2', + errorCode: 'REQUIRED' + } + ] + }, + { + rowKey: 3, + errors: [ + { + columnName: 'c2', + errorCode: 'REQUIRED' + } + ] + } + ] + */ + validate: function() { + return this.modelManager.dataModel.validate(); + }, + /** * Destroys the instance. * @api @@ -2582,13 +2757,13 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ * @api * @static * @param {number} id - ID of the target grid - * @return {tui.Grid} - Grid instance + * @returns {tui.Grid} - Grid instance */ tui.Grid.getInstanceById = function(id) { return instanceMap[id]; }; -},{"./addon/net":2,"./base/view":7,"./common/util":10,"./domState":11,"./model/manager":19,"./painter/manager":36,"./publicEventEmitter":38,"./view/factory":41}],13:[function(require,module,exports){ +},{"./addon/net":2,"./base/view":7,"./common/util":10,"./domState":11,"./model/manager":19,"./painter/manager":37,"./publicEventEmitter":39,"./view/factory":42}],13:[function(require,module,exports){ /** * @fileoverview 컬럼 모델 * @author NHN Ent. FE Development Team @@ -2609,11 +2784,11 @@ var META_COLUMN_LIST = ['_button', '_number']; /** * 컬럼 모델 데이터를 다루는 객체 * @module model/data/columnModel + * @extends module:base/model */ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype */{ /** * @constructs - * @extends module:base/model */ initialize: function() { Model.prototype.initialize.apply(this, arguments); @@ -2643,7 +2818,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 메타컬럼모델들을 초기화한다. * @param {Array} source - 사용자가 입력한 메타컬럼의 셋팅값 - * @return {Array} dset - 초기화가 완료된 메타컬럼 모델 리스트 + * @returns {Array} dset - 초기화가 완료된 메타컬럼 모델 리스트 * @private */ _initializeMetaColumns: function(source) { @@ -2669,7 +2844,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 인자로 넘어온 metaColumnModelList 에 설정값에 맞게 number column 을 추가한다. - * @param {Array} metaColumnModelList + * @param {Array} metaColumnModelList - Meta column model list * @private */ _initializeNumberColumn: function(metaColumnModelList) { @@ -2690,7 +2865,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 인자로 넘어온 metaColumnModelList 에 설정값에 맞게 button column 을 추가한다. - * @param {Array} metaColumnModelList + * @param {Array} metaColumnModelList - Meta column model listt * @private */ _initializeButtonColumn: function(metaColumnModelList) { @@ -2741,7 +2916,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype * index 에 해당하는 columnModel 을 반환한다. * @param {Number} index 조회할 컬럼모델의 인덱스 값 * @param {Boolean} isVisible [isVisible=false] 화면에 노출되는 컬럼모델 기준으로 찾을것인지 여부. - * @return {object} 조회한 컬럼 모델 + * @returns {object} 조회한 컬럼 모델 */ at: function(index, isVisible) { var columnModelList = isVisible ? this.getVisibleColumnModelList() : this.get('dataColumnModelList'); @@ -2752,7 +2927,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype * columnName 에 해당하는 index를 반환한다. * @param {string} columnName 컬럼명 * @param {Boolean} isVisible [isVisible=false] 화면에 노출되는 컬럼모델 기준으로 반환할 것인지 여부. - * @return {number} index 컬럼명에 해당하는 인덱스 값 + * @returns {number} index 컬럼명에 해당하는 인덱스 값 */ indexOfColumnName: function(columnName, isVisible) { var columnModelList; @@ -2768,7 +2943,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * columnName 이 열고정 영역에 있는 column 인지 반환한다. * @param {String} columnName 컬럼명 - * @return {Boolean} 열고정 영역에 존재하는 컬럼인지 여부 + * @returns {Boolean} 열고정 영역에 존재하는 컬럼인지 여부 */ isLside: function(columnName) { var index = this.indexOfColumnName(columnName, true); @@ -2780,7 +2955,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype * 화면에 노출되는 (!isHidden) 컬럼 모델 리스트를 반환한다. * @param {String} [whichSide] 열고정 영역인지, 열고정이 아닌 영역인지 여부. 지정하지 않았을 경우 전체 visibleList를 반환한다. * @param {boolean} [withMeta=false] 메타컬럼 포함 여부. 지정하지 않으면 데이터컬럼리스트 기준으로 반환한다. - * @return {Array} 조회한 컬럼모델 배열 + * @returns {Array} 조회한 컬럼모델 배열 */ getVisibleColumnModelList: function(whichSide, withMeta) { var startIndex = withMeta ? 0 : this.getVisibleMetaColumnCount(), @@ -2817,7 +2992,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 현재 노출되는 컬럼들 중, 고정된 컬럼들(L-side)의 갯수를 반환한다. * @param {boolean} [withMeta=false] 현재 보여지고 있는 메타컬럼의 count를 합칠지 여부 - * @returns {number} + * @returns {number} Visible columnFix count */ getVisibleColumnFixCount: function(withMeta) { var realColumnFixCount = this.get('columnFixCount'), @@ -2839,7 +3014,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 인자로 받은 columnName 에 해당하는 columnModel 을 반환한다. * @param {String} columnName 컬럼명 - * @return {Object} 컬럼명에 해당하는 컬럼모델 + * @returns {Object} 컬럼명에 해당하는 컬럼모델 */ getColumnModel: function(columnName) { return this.get('columnModelMap')[columnName]; @@ -2849,7 +3024,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype * columnName 에 해당하는 컬럼의 타입이 textType 인지 확인한다. * 랜더링시 html 태그 문자열을 제거할때 사용됨. * @param {String} columnName 컬럼명 - * @return {boolean} text 타입인지 여부 + * @returns {boolean} text 타입인지 여부 */ isTextType: function(columnName) { return !!this.textType[this.getEditType(columnName)]; @@ -2858,7 +3033,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 컬럼 모델로부터 editType 을 반환한다. * @param {string} columnName The name of the target column - * @return {string} 해당하는 columnName 의 editType 을 반환한다. + * @returns {string} 해당하는 columnName 의 editType 을 반환한다. */ getEditType: function(columnName) { var columnModel = this.getColumnModel(columnName), @@ -2873,9 +3048,9 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 인자로 받은 컬럼 모델에서 !isHidden 를 만족하는 리스트를 추려서 반환한다. - * @param {Array} dataColumnModelList 데이터 컬럼 모델 리스트 * @param {Array} metaColumnModelList 메타 컬럼 모델 리스트 - * @return {Array} isHidden 이 설정되지 않은 전체 컬럼 모델 리스트 + * @param {Array} dataColumnModelList 데이터 컬럼 모델 리스트 + * @returns {Array} isHidden 이 설정되지 않은 전체 컬럼 모델 리스트 * @private */ _makeVisibleColumnModelList: function(metaColumnModelList, dataColumnModelList) { @@ -2890,7 +3065,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 각 columnModel 의 relationList 를 모아 주체가 되는 columnName 기준으로 relationListMap 를 생성하여 반환한다. * @param {Array} columnModelList - Column Model List - * @return {{}|{columnName1: Array, columnName1: Array}} columnName 기준으로 생성된 relationListMap + * @returns {{}|{columnName1: Array, columnName1: Array}} columnName 기준으로 생성된 relationListMap * @private */ _getRelationListMap: function(columnModelList) { @@ -2908,7 +3083,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * isIgnore 가 true 로 설정된 columnName 의 list 를 반환한다. - * @return {Array} isIgnore 가 true 로 설정된 columnName 배열. + * @returns {Array} isIgnore 가 true 로 설정된 columnName 배열. */ getIgnoredColumnNameList: function() { var columnModelLsit = this.get('dataColumnModelList'), @@ -3061,11 +3236,12 @@ var util = require('../../common/util'); /** * Data 중 각 행의 데이터 모델 (DataSource) * @module data/row + * @extends module:base/model */ var ExtraDataManager = tui.util.defineClass(/**@lends module:model/data/extraData.prototype */{ /** * @constructs - * @extends module:base/model + * @param {Object} data - Data object */ init: function(data) { this.data = data; @@ -3076,7 +3252,7 @@ var ExtraDataManager = tui.util.defineClass(/**@lends module:model/data/extraDat * @param {string} columnName - column name * @param {(number|string)} rowKey - rowKey * @param {boolean} isRowSpanEnable - Boolean value whether row span is enable. - * @return {*|{count: number, isMainRow: boolean, mainRowKey: *}} rowSpan data + * @returns {*|{count: number, isMainRow: boolean, mainRowKey: *}} rowSpan data */ getRowSpanData: function(columnName, rowKey, isRowSpanEnable) { var rowSpanData = null; @@ -3100,7 +3276,7 @@ var ExtraDataManager = tui.util.defineClass(/**@lends module:model/data/extraDat /** * Returns the object that contains rowState info. - * @return {{isDisabled: boolean, isDisabledCheck: boolean, isChecked: boolean}} rowState 정보 + * @returns {{isDisabled: boolean, isDisabledCheck: boolean, isChecked: boolean}} rowState 정보 */ getRowState: function() { var result = { @@ -3191,7 +3367,7 @@ var ExtraDataManager = tui.util.defineClass(/**@lends module:model/data/extraDat /** * Returns the list of className. * @param {String} [columnName] - If specified, the result will only conatins class names of cell. - * @return {Array} - The array of class names. + * @returns {Array} - The array of class names. */ getClassNameList: function(columnName) { var classNameData = this.data.className, @@ -3213,7 +3389,7 @@ var ExtraDataManager = tui.util.defineClass(/**@lends module:model/data/extraDat * className 이 담긴 배열로부터 특정 className 을 제거하여 반환한다. * @param {Array} classNameList 디자인 클래스명 리스트 * @param {String} className 제거할 클래스명 - * @return {Array} 제거된 디자인 클래스명 리스트 + * @returns {Array} 제거된 디자인 클래스명 리스트 * @private */ _removeClassNameFromArray: function(classNameList, className) { @@ -3231,14 +3407,14 @@ var ExtraDataManager = tui.util.defineClass(/**@lends module:model/data/extraDat var classNameData = this.data.className; if (tui.util.pick(classNameData, 'column', columnName)) { - classNameData.column[columnName] = this._removeClassNameFromArray(classNameData.column[columnName], className); + classNameData.column[columnName] = + this._removeClassNameFromArray(classNameData.column[columnName], className); this.data.className = classNameData; } }, /** * rowKey 에 해당하는 행 전체에 CSS className 을 제거한다. - * @param {(Number|String)} rowKey 행 데이터의 고유 rowKey * @param {String} className 지정할 디자인 클래스명 */ removeClassName: function(className) { @@ -3271,20 +3447,24 @@ var PRIVATE_PROPERTIES = [ '_extraData' ]; +// Error code for validtaion +var VALID_ERR_REQUIRED = 'REQUIRED'; + /** * Data 중 각 행의 데이터 모델 (DataSource) * @module model/data/row + * @extends module:base/model */ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * @constructs - * @extends module:base/model */ initialize: function() { Model.prototype.initialize.apply(this, arguments); this.extraDataManager = new ExtraDataManager(this.get('_extraData')); this.columnModel = this.collection.columnModel; + this.validateMap = {}; this.on('change', this._onChange, this); }, @@ -3294,7 +3474,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ * Overrides Backbone's parse method for extraData not to be null. * @override * @param {object} data - initial data - * @return {object} - parsed data + * @returns {object} - parsed data */ parse: function(data) { if (!data._extraData) { @@ -3312,9 +3492,8 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ }, /** - * rowData 변경 이벤트 핸들러. - * changeCallback 과 rowSpanData 에 대한 처리를 담당한다. - * @param {object} row 데이터의 키값 + * Event handler for 'change' event. + * Executes callback functions, sync rowspan data, and validate data. * @private */ _onChange: function() { @@ -3333,17 +3512,57 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ } this.collection.syncRowSpannedData(this, columnName, value); this._executeChangeAfterCallback(columnName); - if (!this.getRowState().isDisabledCheck && !columnModel.isIgnore) { - this.set('_button', true); - } + this.validateCell(columnName, true); }, this); }, + /** + * Validate the cell data of given columnName and returns the error code. + * @param {Object} columnName - Column name + * @returns {String} Error code + * @private + */ + _validateCellData: function(columnName) { + var columnModel = this.columnModel.getColumnModel(columnName), + value = this.get(columnName), + errorCode = ''; + + if (columnModel.isRequired && util.isBlank(value)) { + errorCode = VALID_ERR_REQUIRED; + } + return errorCode; + }, + + /** + * Validate a cell of given columnName. + * If the data is invalid, add 'invalid' class name to the cell. + * @param {String} columnName - Target column name + * @param {Boolean} isDataChanged - True if data is changed (called by onChange handler) + * @returns {String} - Error code + */ + validateCell: function(columnName, isDataChanged) { + var errorCode; + + if (!isDataChanged && (columnName in this.validateMap)) { + return this.validateMap[columnName]; + } + + errorCode = this._validateCellData(columnName); + if (errorCode) { + this.addCellClassName(columnName, 'invalid'); + } else { + this.removeCellClassName(columnName, 'invalid'); + } + this.validateMap[columnName] = errorCode; + + return errorCode; + }, + /** * columnModel 에 정의된 changeCallback 을 수행할 때 전달핼 이벤트 객체를 생성한다. - * @param {object} row row 모델 * @param {String} columnName 컬럼명 - * @return {{rowKey: (number|string), columnName: string, columnData: *, instance: {object}}} changeCallback 에 전달될 이벤트 객체 + * @returns {{rowKey: (number|string), columnName: string, columnData: *, instance: {object}}} + * changeCallback 에 전달될 이벤트 객체 * @private */ _createChangeCallbackEvent: function(columnName) { @@ -3358,10 +3577,8 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * columnModel 에 정의된 changeBeforeCallback 을 수행한다. * changeBeforeCallback 의 결과가 false 일 때, 데이터를 복원후 false 를 반환한다. - * - * @param {object} row row 모델 * @param {String} columnName 컬럼명 - * @return {boolean} changeBeforeCallback 수행 결과값 + * @returns {boolean} changeBeforeCallback 수행 결과값 * @private */ _executeChangeBeforeCallback: function(columnName) { @@ -3387,9 +3604,8 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * columnModel 에 정의된 changeAfterCallback 을 수행한다. - * @param {object} row - row 모델 * @param {String} columnName - 컬럼명 - * @return {boolean} changeAfterCallback 수행 결과값 + * @returns {boolean} changeAfterCallback 수행 결과값 * @private */ _executeChangeAfterCallback: function(columnName) { @@ -3405,7 +3621,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * Returns the Array of private property names - * @return {array} An array of private property names + * @returns {array} An array of private property names */ getPrivateProperties: function() { return PRIVATE_PROPERTIES; @@ -3413,16 +3629,16 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * Returns the object that contains rowState info. - * @return {{isDisabled: boolean, isDisabledCheck: boolean, isChecked: boolean}} rowState 정보 + * @returns {{isDisabled: boolean, isDisabledCheck: boolean, isChecked: boolean}} rowState 정보 */ getRowState: function() { return this.extraDataManager.getRowState(); }, /** - * row의 extraData에 설정된 classNameList 를 반환한다. - * @param {String} [columnName] columnName 이 없을 경우 row 에 정의된 className 만 반환한다. - * @return {Array} css 클래스 이름의 배열 + * Returns an array of all className, related with given columnName. + * @param {String} columnName - Column name + * @returns {Array.} - An array of classNames */ getClassNameList: function(columnName) { var columnModel = this.columnModel.getColumnModel(columnName), @@ -3434,13 +3650,16 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ if (columnModel.isEllipsis) { classNameList.push('ellipsis'); } + if (columnModel.isRequired) { + classNameList.push('required'); + } return this._makeUniqueStringArray(classNameList); }, /** * Returns a new array, which splits all comma-separated strings in the targetList and removes duplicated item. * @param {Array} targetArray - Target array - * @return {Array} - New array + * @returns {Array} - New array */ _makeUniqueStringArray: function(targetArray) { var singleStringArray = _.uniq(targetArray.join(' ').split(' ')); @@ -3450,7 +3669,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * columnName 에 해당하는 셀의 편집 가능여부와 disabled 상태 여부를 반환한다. * @param {String} columnName 컬럼명 - * @return {{isEditable: boolean, isDisabled: boolean}} 편집 가능여부와 disabled 상태 정보 + * @returns {{isEditable: boolean, isDisabled: boolean}} 편집 가능여부와 disabled 상태 정보 */ getCellState: function(columnName) { var notEditableTypeList = ['_number', 'normal'], @@ -3486,7 +3705,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * rowKey 와 columnName 에 해당하는 셀이 편집 가능한지 여부를 반환한다. * @param {String} columnName 컬럼명 - * @return {Boolean} 편집 가능한지 여부 + * @returns {Boolean} 편집 가능한지 여부 */ isEditable: function(columnName) { var notEditableTypeList = ['_number', 'normal'], @@ -3502,7 +3721,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * rowKey 와 columnName 에 해당하는 셀이 disable 상태인지 여부를 반환한다. * @param {String} columnName 컬럼명 - * @return {Boolean} disabled 처리를 할지 여부 + * @returns {Boolean} disabled 처리를 할지 여부 */ isDisabled: function(columnName) { var cellState; @@ -3514,7 +3733,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ * getRowSpanData * rowSpan 설정값을 반환한다. * @param {String} [columnName] 인자가 존재하지 않을 경우, 행 전체의 rowSpanData 를 맵 형태로 반환한다. - * @return {*|{count: number, isMainRow: boolean, mainRowKey: *}} rowSpan 설정값 + * @returns {*|{count: number, isMainRow: boolean, mainRowKey: *}} rowSpan 설정값 */ getRowSpanData: function(columnName) { var isRowSpanEnable = this.collection.isRowSpanEnable(), @@ -3557,7 +3776,6 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * rowKey에 해당하는 행 전체에 CSS className 을 설정한다. - * @param {(Number|String)} rowKey 행 데이터의 고유 rowKey * @param {String} className 지정할 디자인 클래스명 */ addClassName: function(className) { @@ -3577,7 +3795,6 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * rowKey 에 해당하는 행 전체에 CSS className 을 제거한다. - * @param {(Number|String)} rowKey 행 데이터의 고유 rowKey * @param {String} className 지정할 디자인 클래스명 */ removeClassName: function(className) { @@ -3590,7 +3807,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ * columnModel 에 notUseHtmlEntity 가 설정된 경우는 동작하지 않는다. * * @param {String} columnName 컬럼명 - * @return {String} 인코딩된 결과값 + * @returns {String} 인코딩된 결과값 */ getHTMLEncodedString: function(columnName) { var columnModel = this.columnModel.getColumnModel(columnName), @@ -3609,7 +3826,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ * text 로 전환해서 반환할 때 처리를 하여 변환한다. * * @param {String} columnName 컬럼명 - * @return {String} text 형태로 가공된 문자열 + * @returns {String} text 형태로 가공된 문자열 * @private */ _getListTypeVisibleText: function(columnName) { @@ -3642,7 +3859,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ * change 이벤트 발생시 동일한 changed 객체의 public 프라퍼티가 동일한 경우 중복 처리를 막기 위해 사용한다. * 10ms 내에 같은 객체로 함수 호출이 일어나면 true를 반환한다. * @param {object} publicChanged 비교할 객체 - * @return {boolean} 중복이면 true, 아니면 false + * @returns {boolean} 중복이면 true, 아니면 false */ isDuplicatedPublicChanged: function(publicChanged) { if (this._timeoutIdForChanged && _.isEqual(this._lastPublicChanged, publicChanged)) { @@ -3660,7 +3877,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * 복사 기능을 사용할 때 화면에 보여지는 데이터를 반환한다. * @param {String} columnName 컬럼명 - * @return {String} 화면에 보여지는 데이터로 가공된 문자열 + * @returns {String} 화면에 보여지는 데이터로 가공된 문자열 */ getVisibleText: function(columnName) { var columnModel = this.columnModel, @@ -3693,9 +3910,9 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * 컬럼모델에 정의된 relation 들을 수행한 결과를 반환한다. (기존 affectOption) - * - * @param {Array} callbackNameList 반환값의 결과를 확인할 대상 callbackList. (default : ['optionListChange', 'isDisabled', 'isEditable']) - * @return {{}|{columnName: {attribute: *}}} row 의 columnName 에 적용될 속성값. + * @param {Array} callbackNameList 반환값의 결과를 확인할 대상 callbackList. + * (default : ['optionListChange', 'isDisabled', 'isEditable']) + * @returns {{}|{columnName: {attribute: *}}} row 의 columnName 에 적용될 속성값. */ getRelationResult: function(callbackNameList) { var rowData = this.attributes, @@ -3763,13 +3980,12 @@ var Row = require('./row'); * Raw 데이터 RowList 콜렉션. (DataSource) * Grid.setRowList 를 사용하여 콜렉션을 설정한다. * @module model/data/rowList + * @extends module:base/collection */ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */{ - model: Row, /** * @param {Array} models 콜랙션에 추가할 model 리스트 * @param {Object} options 생성자의 option 객체 - * @extends module:base/collection * @constructs */ initialize: function(models, options) { @@ -3786,17 +4002,26 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ columnName: 'rowKey', isAscending: true, useClient: (_.isBoolean(options.useClientSort) ? options.useClientSort : true) - } + }, + + /** + * Whether the all rows are disabled. + * This state is not related to individual state of each rows. + * @type {Boolean} + */ + isDisabled: false }); if (!this.sortOptions.useClient) { this.comparator = null; } }, + model: Row, + /** * Backbone 이 collection 생성 시 내부적으로 parse 를 호출하여 데이터를 포멧에 맞게 파싱한다. * @param {Array} data 원본 데이터 - * @return {Array} 파싱하여 가공된 데이터 + * @returns {Array} 파싱하여 가공된 데이터 */ parse: function(data) { data = data && data['contents'] || data; @@ -3807,7 +4032,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * 데이터의 _extraData 를 분석하여, Model 에서 사용할 수 있도록 가공한다. * _extraData 필드에 rowSpanData 를 추가한다. * @param {Array} data 가공할 데이터 - * @return {Array} 가공된 데이터 + * @returns {Array} 가공된 데이터 * @private */ _formatData: function(data) { @@ -3829,7 +4054,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * * @param {object} row 대상 row 데이터 * @param {number} index 해당 row 의 인덱스 정보. rowKey 를 자동 생성할 경우 사용된다. - * @return {object} 가공된 row 데이터 + * @returns {object} 가공된 row 데이터 * @private */ _baseFormat: function(row) { @@ -3849,8 +4074,9 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * 새로운 rowKey를 생성해서 반환한다. - * @return {number} 생성된 rowKey - // */ + * @returns {number} 생성된 rowKey + * @private + */ _createRowKey: function() { this.lastRowKey += 1; return this.lastRowKey; @@ -3860,7 +4086,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * 랜더링시 사용될 extraData 필드에 rowSpanData 값을 세팅한다. * @param {Array} rowList - 전체 rowList 배열. rowSpan 된 경우 자식 row 의 데이터도 가공해야 하기 때문에 전체 list 를 인자로 넘긴다. * @param {number} index - 해당 배열에서 extraData 를 설정할 배열 - * @return {Array} rowList - 가공된 rowList + * @returns {Array} rowList - 가공된 rowList * @private */ _setExtraRowSpanData: function(rowList, index) { @@ -3910,7 +4136,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * originalRowList 와 originalRowMap 을 생성한다. * @param {Array} [rowList] rowList 가 없을 시 현재 collection 데이터를 originalRowList 로 저장한다. - * @return {Array} format 을 거친 데이터 리스트. + * @returns {Array} format 을 거친 데이터 리스트. */ setOriginalRowList: function(rowList) { this.originalRowList = rowList ? this._formatData(rowList) : this.toJSON(); @@ -3921,7 +4147,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * 원본 데이터 리스트를 반환한다. * @param {boolean} [isClone=true] 데이터 복제 여부. - * @return {Array} 원본 데이터 리스트 배열. + * @returns {Array} 원본 데이터 리스트 배열. */ getOriginalRowList: function(isClone) { isClone = isClone === undefined ? true : isClone; @@ -3931,7 +4157,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * 원본 row 데이터를 반환한다. * @param {(Number|String)} rowKey 데이터의 키값 - * @return {Object} 해당 행의 원본 데이터값 + * @returns {Object} 해당 행의 원본 데이터값 */ getOriginalRow: function(rowKey) { return _.clone(this.originalRowMap[rowKey]); @@ -3941,7 +4167,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * rowKey 와 columnName 에 해당하는 원본 데이터를 반환한다. * @param {(Number|String)} rowKey 데이터의 키값 * @param {String} columnName 컬럼명 - * @return {(Number|String)} rowKey 와 컬럼명에 해당하는 셀의 원본 데이터값 + * @returns {(Number|String)} rowKey 와 컬럼명에 해당하는 셀의 원본 데이터값 */ getOriginal: function(rowKey, columnName) { return _.clone(this.originalRowMap[rowKey][columnName]); @@ -3951,7 +4177,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * mainRowKey 를 반환한다. * @param {(Number|String)} rowKey 데이터의 키값 * @param {String} columnName 컬럼명 - * @return {(Number|String)} rowKey 와 컬럼명에 해당하는 셀의 main row 키값 + * @returns {(Number|String)} rowKey 와 컬럼명에 해당하는 셀의 main row 키값 */ getMainRowKey: function(rowKey, columnName) { var row = this.get(rowKey), @@ -3966,7 +4192,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * rowKey 에 해당하는 index를 반환한다. * @param {(Number|String)} rowKey 데이터의 키값 - * @return {Number} 키값에 해당하는 row의 인덱스 + * @returns {Number} 키값에 해당하는 row의 인덱스 */ indexOfRowKey: function(rowKey) { return this.indexOf(this.get(rowKey)); @@ -3976,7 +4202,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * rowSpan 이 적용되어야 하는지 여부를 반환한다. * 랜더링시 사용된다. * - sorted, 혹은 filterd 된 경우 false 를 리턴한다. - * @return {boolean} 랜더링 시 rowSpan 을 해야하는지 여부 + * @returns {boolean} 랜더링 시 rowSpan 을 해야하는지 여부 */ isRowSpanEnable: function() { return !this.isSortedByField(); @@ -3984,7 +4210,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * 현재 RowKey가 아닌 다른 컬럼에 의해 정렬된 상태인지 여부를 반환한다. - * @return {Boolean} 정렬된 상태인지 여부 + * @returns {Boolean} 정렬된 상태인지 여부 */ isSortedByField: function() { return this.sortOptions.columnName !== 'rowKey'; @@ -4092,7 +4318,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * Backbone 에서 sort() 실행시 내부적으로 사용되는 메소드. * @param {Row} a 비교할 앞의 모델 * @param {Row} b 비교할 뒤의 모델 - * @return {number} a가 b보다 작으면 -1, 같으면 0, 크면 1. 내림차순이면 반대. + * @returns {number} a가 b보다 작으면 -1, 같으면 0, 크면 1. 내림차순이면 반대. */ comparator: function(a, b) { var columnName = this.sortOptions.columnName, @@ -4116,7 +4342,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * rowList 에서 내부에서만 사용하는 property 를 제거하고 반환한다. * @param {Array} rowList 내부에 설정된 rowList 배열 - * @return {Array} private 프로퍼티를 제거한 결과값 + * @returns {Array} private 프로퍼티를 제거한 결과값 * @private */ _removePrivateProp: function(rowList) { @@ -4205,7 +4431,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * append, prepend 시 사용할 dummy row를 생성한다. - * @return {Object} 값이 비어있는 더미 row 데이터 + * @returns {Object} 값이 비어있는 더미 row 데이터 * @private */ _createDummyRow: function() { @@ -4220,11 +4446,14 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ }, /** - * 현재 rowList 중 at 에 해당하는 인덱스에 데이터를 append 한다. - * @param {object|array} rowData - 행 추가할 데이터. Array일 경우 여러행를 동시에 추가한다. - * @param {object} [options] - 옵션 객체 - * @param {number} [options.at] - 데이터를 append 할 index - * @param {boolean} [options.extendPrevRowSpan] - 이전 행의 rowSpan 데이터가 있는 경우 합칠지 여부 + * Insert the new row with specified data to the end of table. + * @param {(Array|Object)} [rowData] - The data for the new row + * @param {Object} [options] - Options + * @param {Number} [options.at] - The index at which new row will be inserted + * @param {Boolean} [options.extendPrevRowSpan] - If set to true and the previous row at target index + * has a rowspan data, the new row will extend the existing rowspan data. + * @param {Boolean} [options.focus] - If set to true, move focus to the new row after appending + * @returns {Array.} Row model list */ append: function(rowData, options) { var modelList = this._createModelList(rowData), @@ -4239,25 +4468,30 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ this.add(modelList, addOptions); this._syncRowSpanDataForAppend(options.at, modelList.length, options.extendPrevRowSpan); - this.trigger('add', modelList, addOptions); + this.trigger('add', modelList, options); + return modelList; }, /** * 현재 rowList 에 최상단에 데이터를 append 한다. * @param {Object} rowData prepend 할 행 데이터 + * @param {object} [options] - Options + * @param {boolean} [options.focus] - If set to true, move focus to the new row after appending + * @returns {Array.} Row model list */ - prepend: function(rowData) { - return this.append(rowData, { - at: 0 - }); + prepend: function(rowData, options) { + options = options || {}; + options.at = 0; + + return this.append(rowData, options); }, /** * rowKey에 해당하는 행의 데이터를 리턴한다. isJsonString을 true로 설정하면 결과를 json객체로 변환하여 리턴한다. * @param {(Number|String)} rowKey 행 데이터의 고유 키 * @param {Boolean} [isJsonString=false] true 일 경우 JSON String 으로 반환한다. - * @return {Object} 행 데이터 + * @returns {Object} 행 데이터 */ getRowData: function(rowKey, isJsonString) { var row = this.get(rowKey), @@ -4270,7 +4504,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * 그리드 전체 데이터 중에서 index에 해당하는 순서의 데이터 객체를 리턴한다. * @param {Number} index 행의 인덱스 * @param {Boolean} [isJsonString=false] true 일 경우 JSON String 으로 반환한다. - * @return {Object} 행 데이터 + * @returns {Object} 행 데이터 */ getRowDataAt: function(index, isJsonString) { var row = this.at(index), @@ -4284,7 +4518,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * @param {(Number|String)} rowKey 행 데이터의 고유 키 * @param {String} columnName 컬럼 이름 * @param {boolean} [isOriginal] 원본 데이터 리턴 여부 - * @return {(Number|String|undefined)} 조회한 셀의 값. + * @returns {(Number|String|undefined)} 조회한 셀의 값. */ getValue: function(rowKey, columnName, isOriginal) { var value, row; @@ -4329,7 +4563,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * columnName에 해당하는 column data list를 리턴한다. * @param {String} columnName 컬럼명 * @param {boolean} [isJsonString=false] true 일 경우 JSON String 으로 반환한다. - * @return {Array} 컬럼명에 해당하는 셀들의 데이터 리스트 + * @returns {Array} 컬럼명에 해당하는 셀들의 데이터 리스트 */ getColumnValues: function(columnName, isJsonString) { var valueList = this.pluck(columnName); @@ -4378,7 +4612,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * Returns true if there are at least one row changed. - * @return {boolean} - True if there are at least one row changed. + * @returns {boolean} - True if there are at least one row changed. */ isChanged: function() { var modifiedRowsArr = _.values(this.getModifiedRowList()); @@ -4388,6 +4622,17 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ }); }, + /** + * Enables or Disables all rows. + * @param {Boolean} isDisabled - Whether disabled or not + */ + setDisabled: function(isDisabled) { + if (this.isDisabled !== isDisabled) { + this.isDisabled = isDisabled; + this.trigger('disabledChanged'); + } + }, + /** * rowKey에 해당하는 행을 활성화시킨다. * @param {(Number|String)} rowKey 행 데이터의 고유 키 @@ -4464,7 +4709,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * 주어진 데이터로 모델 목록을 생성하여 반환한다. * @param {object|array} rowData - 모델을 생성할 데이터. Array일 경우 여러개를 동시에 생성한다. - * @return {Row[]} 생성된 모델 목록 + * @returns {Row[]} 생성된 모델 목록 */ _createModelList: function(rowData) { var modelList = [], @@ -4479,7 +4724,6 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ _.each(rowList, function(row) { var rowData; - row._button = true; rowData = new Row(row, { collection: this, parse: true @@ -4560,7 +4804,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * @param {Object} row - row 데이터 * @param {Object} originalRow - 원본 row 데이터 * @param {Array} filteringColumnList - 비교에서 제외할 컬럼명 - * @return {boolean} - 수정여부 + * @returns {boolean} - 수정여부 */ _isModifiedRow: function(row, originalRow, filteringColumnList) { var filtered = _.omit(row, filteringColumnList); @@ -4581,7 +4825,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * @param {boolean} [options.isRaw=false] true 로 설정된 경우 내부 연산용 데이터 제거 필터링을 거치지 않는다. * @param {boolean} [options.isOnlyRowKeyList=false] true 로 설정된 경우 키값만 저장하여 리턴한다. * @param {Array} [options.filteringColumnList] 행 데이터 중에서 데이터 변경으로 간주하지 않을 컬럼 이름을 배열로 설정한다. - * @return {{createList: Array, updateList: Array, deleteList: Array}} options 조건에 해당하는 수정된 rowList 정보 + * @returns {{createList: Array, updateList: Array, deleteList: Array}} options 조건에 해당하는 수정된 rowList 정보 */ getModifiedRowList: function(options) { var isRaw = options && options.isRaw, @@ -4624,6 +4868,13 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ return result; }, + /** + * Resets data. + * @param {Array} rowList - New data + * @param {Boolean} isParse - parse option of Backbone.Collection.reset + * @param {Function} callback - Callback function + * @private + */ _resetData: function(rowList, isParse, callback) { this.lastRowKey = -1; this.reset(rowList, { @@ -4638,6 +4889,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * rowList 를 설정한다. setRowList 와 다르게 setOriginalRowList 를 호출하여 원본데이터를 갱신하지 않는다. * @param {Array} rowList 설정할 데이터 배열 값 * @param {boolean} [isParse=true] backbone 의 parse 로직을 수행할지 여부 + * @param {Function} [callback] callback function */ replaceRowList: function(rowList, isParse, callback) { if (_.isUndefined(isParse)) { @@ -4692,10 +4944,6 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ if (isDeletableType && cellState.isEditable && !cellState.isDisabled) { this.setValue(mainRowKey, columnName, '', silent); - //silent 의 경우 데이터 모델의 change 이벤트가 발생하지 않기 때문에, 강제로 checkbox 를 세팅한다. - if (silent) { - this.check(mainRowKey, silent); - } } }, @@ -4718,11 +4966,71 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ }); }, + /** + * Validates all data and returns the result. + * Return value is an array which contains only rows which have invalid cell data. + * @returns {Array.} An array of error object + * @example + [ + { + rowKey: 1, + errors: [ + { + columnName: 'c1', + errorCode: 'REQUIRED' + }, + { + columnName: 'c2', + errorCode: 'REQUIRED' + } + ] + }, + { + rowKey: 3, + errors: [ + { + columnName: 'c2', + errorCode: 'REQUIRED' + } + ] + } + ] + */ + validate: function() { + var errorRows = [], + requiredColumnNames = _.chain(this.columnModel.getVisibleColumnModelList()) + .filter(function(columnModel) { + return columnModel.isRequired === true; + }) + .pluck('columnName') + .value(); + + this.each(function(row) { + var errorCells = []; + _.each(requiredColumnNames, function(columnName) { + var errorCode = row.validateCell(columnName); + if (errorCode) { + errorCells.push({ + columnName: columnName, + errorCode: errorCode + }); + } + }); + if (errorCells.length) { + errorRows.push({ + rowKey: row.get('rowKey'), + errors: errorCells + }); + } + }); + return errorRows; + }, + /** * 붙여넣기를 실행할 때 끝점이 될 셀의 인덱스를 반환한다. * @param {Array[]} data - 붙여넣기할 데이터 * @param {{row: number, column: number}} startIdx - 시작점이 될 셀의 인덱스 - * @return {{row: number, column: number}} 행과 열의 인덱스 정보를 가진 객체 + * @returns {{row: number, column: number}} 행과 열의 인덱스 정보를 가진 객체 */ _getEndIndexToPaste: function(data, startIdx) { var columnModelList = this.columnModel.getVisibleColumnModelList(), @@ -4769,7 +5077,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * 내부적으로 자동으로 mainRowKey 를 찾아 반환한다. * @param {(Number|String)} rowKey 행 데이터의 고유 키 * @param {String} columnName 컬럼 이름 - * @return {jQuery} 해당 jQuery Element + * @returns {jQuery} 해당 jQuery Element */ getElement: function(rowKey, columnName) { var rowKey = this.getMainRowKey(rowKey, columnName); @@ -4788,21 +5096,21 @@ module.exports = RowList; var Model = require('../base/model'); var util = require('../common/util'); +var dimensionConstMap = require('../common/constMap').dimension; -// The width of the border of the dimension. -var BORDER_WIDTH = 1; - -// The width of the border of table cell. -var CELL_BORDER_WIDTH = 1; +var TABLE_BORDER_WIDTH = dimensionConstMap.TABLE_BORDER_WIDTH; +var CELL_BORDER_WIDTH = dimensionConstMap.CELL_BORDER_WIDTH; /** * 크기 관련 데이터 저장 * @module model/dimension + * @extends module:base/model */ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** - * @extends module:base/model * @constructs + * @param {Object} attrs - Attributes + * @param {Object} options - Options */ initialize: function(attrs, options) { Model.prototype.initialize.apply(this, arguments); @@ -4829,10 +5137,11 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ this.listenTo(this.dataModel, 'add remove reset', this._resetTotalRowHeight); this.on('change:width', this._onWidthChange, this); - this.on('change:displayRowCount', this._setBodyHeight, this); + this.on('change:bodyHeight', this._resetDisplayRowCount, this); + this.on('change:displayRowCount', this._resetBodyHeight, this); this._initColumnWidthVariables(); - this._setBodyHeight(); + this._resetBodyHeight(); }, models: null, @@ -4860,13 +5169,14 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ displayRowCount: 1, scrollBarSize: 17, scrollX: true, - scrollY: true + scrollY: true, + fitToParentHeight: false }, /** * 전체 넓이에서 스크롤바, border등의 넓이를 제외하고 실제 셀의 넓이에 사용되는 값만 반환한다. * @param {number} columnLength - 컬럼의 개수 - * @return {number} 사용가능한 전체 셀의 넓이 + * @returns {number} 사용가능한 전체 셀의 넓이 * @private */ _getAvailableTotalWidth: function(columnLength) { @@ -4882,7 +5192,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * Makes all width of columns not less than minimumColumnWidth. * @param {number[]} columnWidthList - 컬럼 넓이값 배열 - * @return {number[]} - 수정된 새로운 넓이값 배열 + * @returns {number[]} - 수정된 새로운 넓이값 배열 * @private */ _applyMinimumColumnWidth: function(columnWidthList) { @@ -4899,7 +5209,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ }, /** - * Reset 'totalRowHeight' property. + * Resets the 'totalRowHeight' attribute. + * @private */ _resetTotalRowHeight: function() { var rowHeight = this.get('rowHeight'), @@ -4909,10 +5220,27 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ this.set('totalRowHeight', (rowHeight * rowCount) + totalBorderWidth); }, + /** + * Resets the 'displayRowCount' attribute. + * @private + */ + _resetDisplayRowCount: function() { + var actualBodyHeight, displayRowCount; + + // To prevent recursive call with _resetBodyHeight (called by change:displayRowCount event) + if (_.has(this.changed, 'displayRowCount')) { + return; + } + actualBodyHeight = this.get('bodyHeight') - this.getScrollXHeight(); + displayRowCount = util.getDisplayRowCount(actualBodyHeight, this.get('rowHeight')); + + this.set('displayRowCount', displayRowCount); + }, + /** * Sets the width of columns whose width is not assigned by distributing extra width to them equally. * @param {number[]} columnWidthList - An array of column widths - * @return {number[]} - A new array of column widths + * @returns {number[]} - A new array of column widths * @private */ _fillEmptyColumnWidth: function(columnWidthList) { @@ -4932,7 +5260,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * Adds extra widths of the column equally. * @param {number[]} columnWidthList - An array of column widths * @param {number} totalExtraWidth - Total extra width - * @return {number[]} - A new array of column widths + * @returns {number[]} - A new array of column widths * @private */ _addExtraColumnWidth: function(columnWidthList, totalExtraWidth) { @@ -4951,7 +5279,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * Reduces excess widths of the column equally. * @param {number[]} columnWidthList - An array of column widths * @param {number} totalExcessWidth - Total excess width (negative number) - * @return {number[]} - A new array of column widths + * @returns {number[]} - A new array of column widths * @private */ _reduceExcessColumnWidth: function(columnWidthList, totalExcessWidth) { @@ -4977,7 +5305,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @param {number} totalRemainWidth - Remaining excess width (negative number) * @param {object[]} availableList - An array of infos about available column. * Each item of the array has {index:number, width:number}. - * @return {number[]} - A new array of column widths + * @returns {number[]} - A new array of column widths * @private */ _reduceExcessColumnWidthSub: function(columnWidthList, totalRemainWidth, availableList) { @@ -5007,7 +5335,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @param {number[]} columnWidthList - An array of column width * @param {number} extraWidth - Extra width * @param {number[]} columnIndexes - An array of indexes of target columns - * @return {number[]} - A new array of column widths + * @returns {number[]} - A new array of column widths * @private */ _distributeExtraWidthEqually: function(columnWidthList, extraWidth, columnIndexes) { @@ -5029,7 +5357,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @param {number[]} columnWidthList - An array of column width * @param {boolean} [fitToReducedTotal] - If set to true and the total width is smaller than dimension(width), * the column widths will be reduced. - * @return {number[]} - A new array of column widths + * @returns {number[]} - A new array of column widths * @private */ _adjustColumnWidthList: function(columnWidthList, fitToReducedTotal) { @@ -5093,7 +5421,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * L, R 중 하나를 입력받아 frame 의 너비를 구한다. * @param {String} [whichSide] 지정하지 않을 경우 전체 너비. - * @return {Number} 해당 frame 의 너비 + * @returns {Number} 해당 frame 의 너비 */ getFrameWidth: function(whichSide) { var columnFixCount = this.columnModel.getVisibleColumnFixCount(true), @@ -5109,7 +5437,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * widthList 로부터 보더 값을 포함하여 계산한 frameWidth 를 구한다. * @param {Array} widthList 너비 리스트 배열 - * @return {Number} 계산된 frame 너비값 + * @returns {Number} 계산된 frame 너비값 * @private */ _getFrameWidth: function(widthList) { @@ -5157,7 +5485,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * 열 고정 영역의 minimum width 값을 구한다. - * @return {number} 열고정 영역의 최소 너비값. + * @returns {number} 열고정 영역의 최소 너비값. * @private */ _getMinLeftSideWidth: function() { @@ -5175,7 +5503,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * 열 고정 영역의 maximum width 값을 구한다. - * @return {number} 열고정 영역의 최대 너비값. + * @returns {number} 열고정 영역의 최대 너비값. * @private */ _getMaxLeftSideWidth: function() { @@ -5191,7 +5519,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * 계산한 cell 의 위치를 리턴한다. * @param {Number|String} rowKey - 데이터의 키값 * @param {String} columnName - 칼럼명 - * @return {{top: number, left: number, right: number, bottom: number}} - cell의 위치 + * @returns {{top: number, left: number, right: number, bottom: number}} - cell의 위치 * @todo TC */ getCellPosition: function(rowKey, columnName) { @@ -5246,7 +5574,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * Return scroll position from the received index * @param {Number|String} rowKey - Row-key of target cell * @param {String} columnName - Column name of target cell - * @return {{?scrollLeft: number, ?scrollTop: number}} Position to scroll + * @returns {{scrollLeft: ?Number, scrollTop: ?Number}} Position to scroll */ getScrollPosition: function(rowKey, columnName) { var isRsideColumn = !this.columnModel.isLside(columnName), @@ -5310,7 +5638,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @param {{isUp: boolean, isDown: boolean, isLeft: boolean, isRight: boolean}} scrollDirection - Direction * @param {{top: number, bottom: number, left: number, right: number}} targetPosition - Position of target element * @param {{height: number, rsideWidth: number}} bodySize - Using cached bodySize - * @return {{?scrollLeft: number, ?scrollTop: number}} Position to scroll + * @returns {{scrollLeft: ?Number, scrollTop: ?Number}} Position to scroll * @private */ _makeScrollPosition: function(scrollDirection, targetPosition, bodySize) { @@ -5325,7 +5653,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ if (scrollDirection.isLeft) { pos.scrollLeft = targetPosition.left; } else if (scrollDirection.isRight) { - pos.scrollLeft = targetPosition.right - bodySize.rsideWidth + BORDER_WIDTH; + pos.scrollLeft = targetPosition.right - bodySize.rsideWidth + TABLE_BORDER_WIDTH; } return pos; @@ -5380,7 +5708,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @param {Number} pageX - Mouse X-position based on page * @param {Number} pageY - Mouse Y-position based on page * @param {boolean} [withMeta] - Whether the meta columns go with this calculation - * @return {{row: number, column: number}} Cell index + * @returns {{row: number, column: number}} Cell index */ getIndexFromMousePosition: function(pageX, pageY, withMeta) { var containerPos = this._rebasePositionToContainer(pageX, pageY); @@ -5428,11 +5756,11 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ columnIndex = columnWidthList.length - 1; } else { tui.util.forEachArray(columnWidthList, function(width, index) { - if (cellX <= width) { + if (cellX > width) { + cellX -= width; + } else { columnIndex = index; return false; - } else { - cellX -= width; } }); } @@ -5444,7 +5772,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * 마우스 위치 정보에 해당하는 grid container 기준 pageX 와 pageY 를 반환한다. * @param {Number} pageX 마우스 x 좌표 * @param {Number} pageY 마우스 y 좌표 - * @return {{x: number, y: number}} 그리드 container 기준의 x, y 값 + * @returns {{x: number, y: number}} 그리드 container 기준의 x, y 값 * @private */ _rebasePositionToContainer: function(pageX, pageY) { @@ -5461,7 +5789,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * columnFixCount 가 적용되었을 때, window resize 시 left side 의 너비를 조정한다. * @param {Array} lsideWidthList 열고정 영역의 너비 리스트 배열 * @param {Number} totalWidth grid 전체 너비 - * @return {Array} 열고정 영역의 너비 리스트 + * @returns {Array} 열고정 영역의 너비 리스트 * @private */ _adjustLeftSideWidthList: function(lsideWidthList, totalWidth) { @@ -5484,28 +5812,24 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ }, /** - * 그리드의 body height 를 계산하여 할당한다. + * Resets the 'bodyHeight' attribute. * @private */ - _setBodyHeight: function() { - var height = util.getHeight(this.get('displayRowCount'), this.get('rowHeight')); - - height += this.getScrollXHeight(); - this.set('bodyHeight', height); - }, + _resetBodyHeight: function() { + var rowListHeight; - /** - * 현재 화면에 보이는 row 개수를 반환 - * @return {number} 화면에 보이는 행 개수 - */ - getDisplayRowCount: function() { - return util.getDisplayRowCount(this.get('bodyHeight') - this.getScrollXHeight(), this.get('rowHeight')); + // To prevent recursive call with _resetDisplayRowCount (called by change:bodyHeight event) + if (_.has(this.changed, 'bodyHeight')) { + return; + } + rowListHeight = util.getHeight(this.get('displayRowCount'), this.get('rowHeight')); + this.set('bodyHeight', rowListHeight + this.getScrollXHeight()); }, /** * Return height of X-scrollBar. * If no X-scrollBar, return 0 - * @return {number} Height of X-scrollBar + * @returns {number} Height of X-scrollBar */ getScrollXHeight: function() { return (this.get('scrollX') ? this.get('scrollBarSize') : 0); @@ -5554,16 +5878,16 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * Returns the height of table body. * @param {number} height - The height of the dimension - * @return {number} The height of the table body + * @returns {number} The height of the table body * @private */ _calcRealBodyHeight: function(height) { - return height - this.get('headerHeight') - this.get('toolbarHeight') - BORDER_WIDTH; + return height - this.get('headerHeight') - this.get('toolbarHeight') - TABLE_BORDER_WIDTH; }, /** * Returns the minimum height of table body. - * @return {number} The minimum height of table body + * @returns {number} The minimum height of table body * @private */ _getMinBodyHeight: function() { @@ -5577,7 +5901,6 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ */ _setHeight: function(height) { this.set('bodyHeight', Math.max(this._calcRealBodyHeight(height), this._getMinBodyHeight())); - this.set('displayRowCount', this.getDisplayRowCount(), {silent: true}); }, /** @@ -5597,7 +5920,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * Returns the height of the dimension. - * @return {Number} Height + * @returns {Number} Height */ getHeight: function() { return this.get('bodyHeight') + this.get('headerHeight') + this.get('toolbarHeight'); @@ -5615,6 +5938,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ offsetLeft: offset.left, width: domState.getWidth() }); + + if (this.get('fitToParentHeight')) { + this._setHeight(domState.getParentHeight()); + } }, /** @@ -5629,7 +5956,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * L side 와 R side 에 따른 columnWidthList 를 반환한다. * @param {String} [whichSide] 어느 영역인지 여부. 'L|R' 중 하나를 인자로 넘긴다. 생략시 전체 columnList 반환 - * @return {Array} 조회한 영역의 columnWidthList + * @returns {Array} 조회한 영역의 columnWidthList */ getColumnWidthList: function(whichSide) { var columnFixCount = this.columnModel.getVisibleColumnFixCount(true), @@ -5654,7 +5981,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ module.exports = Dimension; -},{"../base/model":5,"../common/util":10}],18:[function(require,module,exports){ +},{"../base/model":5,"../common/constMap":8,"../common/util":10}],18:[function(require,module,exports){ /** * @fileoverview Focus 관련 데이터 처리름 담당한다. * @author NHN Ent. FE Development Team @@ -5668,11 +5995,13 @@ var Model = require('../base/model'), * Focus model * RowList collection 이 focus class 를 listen 한다. * @module model/focus + * @extends module:base/model */ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** - * @extends module:base/model * @constructs + * @param {Object} attrs - Attributes + * @param {Object} options - Options */ initialize: function(attrs, options) { Model.prototype.initialize.apply(this, arguments); @@ -5683,6 +6012,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ this.renderModel = options.renderModel; this.cellFactory = options.cellFactory; this.domState = options.domState; + + this.listenTo(this.dataModel, 'add', this._onAddData); + this.listenTo(this.dataModel, 'reset', this._onResetData); }, defaults: { @@ -5692,10 +6024,30 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ prevColumnName: '' }, + /** + * Event handler for 'add' event on dataModel. + * @param {Array.} rows - New appended row model + * @param {Object} options - Options. See {@link module:model/data/row#append} + * @private + */ + _onAddData: function(rows, options) { + if (options.focus) { + this.focusAt(options.at, 0); + } + }, + + /** + * Event handler for 'reset' event on dataModel. + * @private + */ + _onResetData: function() { + this.unselect(true); + }, + /** * 이전 focus 정보를 저장한다. * @private - * @return {Model.Focus} This object + * @returns {Model.Focus} This object */ _savePrevious: function() { if (this.get('rowKey') !== null) { @@ -5719,11 +6071,36 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ }, /** - * 행을 select 한다. - * @param {Number|String} rowKey - select 할 행의 키값 - * @returns {Model.Focus} This object + * Returns whether given rowKey is equal to current value + * @param {(Number|String)} rowKey - Row key + * @returns {Boolean} - True if equal + */ + _isCurrentRow: function(rowKey) { + // compare with == operator to avoid strict comparision + // (rowkey can be a number or a string) + return this.get('rowKey') == rowKey; + }, + + /** + * Returns whether given rowKey and columnName is equal to current value + * @param {(Number|String)} rowKey - Row key + * @param {String} columnName - Column name + * @returns {Boolean} - True if equal + */ + _isCurrentCell: function(rowKey, columnName) { + return this._isCurrentRow(rowKey) && this.get('columnName') === columnName; + }, + + /** + * Selects the given row + * @param {Number|String} rowKey - Rowkey of the target row + * @returns {Object} This object */ select: function(rowKey) { + if (this._isCurrentRow(rowKey)) { + return this; + } + this.unselect().set('rowKey', rowKey); if (this.columnModel.get('selectType') === 'radio') { this.dataModel.check(rowKey); @@ -5738,7 +6115,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 행을 unselect 한다. * @param {boolean} blur - The boolean value whether to invoke blur - * @return {Model.Focus} This object + * @returns {Model.Focus} This object */ unselect: function(blur) { if (blur) { @@ -5756,13 +6133,13 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @param {Number|String} rowKey focus 처리할 셀의 rowKey 값 * @param {String} columnName focus 처리할 셀의 컬럼명 * @param {Boolean} isScrollable focus 처리한 영역으로 scroll 위치를 이동할지 여부 - * @return {Model.Focus} This object + * @returns {Model.Focus} This object */ focus: function(rowKey, columnName, isScrollable) { if (util.isBlank(rowKey) || util.isBlank(columnName) || this.columnModel.isMetaColumn(columnName) || - (this.get('rowKey') === rowKey && this.get('columnName') === columnName)) { + this._isCurrentCell(rowKey, columnName)) { return this; } @@ -5857,7 +6234,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 디자인 blur 처리한다. - * @return {Model.Focus} This object + * @returns {Model.Focus} This object */ blur: function() { if (this.has()) { @@ -5872,7 +6249,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 현재 focus 정보를 반환한다. - * @return {{rowKey: (number|string), columnName: string}} 현재 focus 정보에 해당하는 rowKey, columnName + * @returns {{rowKey: (number|string), columnName: string}} 현재 focus 정보에 해당하는 rowKey, columnName */ which: function() { return { @@ -5884,7 +6261,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 현재 focus 정보를 index 기준으로 반환한다. * @param {boolean} isPrevious 이전 focus 정보를 반환할지 여부 - * @return {{row: number, column: number}} The object that contains index info + * @returns {{row: number, column: number}} The object that contains index info */ indexOf: function(isPrevious) { var rowKey = isPrevious ? this.get('prevRowKey') : this.get('rowKey'), @@ -5898,7 +6275,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * Returns whether has focus. - * @return {boolean} True if has focus. + * @returns {boolean} True if has focus. */ has: function() { return this._isValidCell(this.get('rowKey'), this.get('columnName')); @@ -5906,7 +6283,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * Restore previous focus data. - * @return {boolean} True if restored + * @returns {boolean} True if restored */ restore: function() { var prevRowKey = this.get('prevRowKey'), @@ -5922,7 +6299,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * Returns whether the specified cell is exist - * @return {boolean} True if exist + * @param {String|Number} rowKey - Rowkey + * @param {String} columnName - ColumnName + * @returns {boolean} True if exist */ _isValidCell: function(rowKey, columnName) { var isValidRowKey = !util.isBlank(rowKey) && !!this.dataModel.get(rowKey), @@ -5934,14 +6313,19 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 현재 focus 된 row 기준으로 offset 만큼 이동한 rowKey 를 반환한다. * @param {Number} offset 이동할 offset - * @return {Number|String} rowKey offset 만큼 이동한 위치의 rowKey + * @returns {Number|String} rowKey offset 만큼 이동한 위치의 rowKey * @private */ _findRowKey: function(offset) { var index, row, dataModel = this.dataModel; if (this.has()) { - index = Math.max(Math.min(dataModel.indexOfRowKey(this.get('rowKey')) + offset, this.dataModel.length - 1), 0); + index = Math.max( + Math.min( + dataModel.indexOfRowKey(this.get('rowKey')) + offset, + this.dataModel.length - 1 + ), 0 + ); row = dataModel.at(index); return row && row.get('rowKey'); } @@ -5950,7 +6334,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 현재 focus 된 column 기준으로 offset 만큼 이동한 columnName 을 반환한다. * @param {Number} offset 이동할 offset - * @return {String} columnName offset 만큼 이동한 위치의 columnName + * @returns {String} columnName offset 만큼 이동한 위치의 columnName * @private */ _findColumnName: function(offset) { @@ -5969,7 +6353,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * rowSpanData 를 반환한다. * @param {Number|String} rowKey 조회할 데이터의 키값 * @param {String} columnName 컬럼명 - * @return {*|{count: number, isMainRow: boolean, mainRowKey: *}|*} rowSpanData 정보 + * @returns {*|{count: number, isMainRow: boolean, mainRowKey: *}|*} rowSpanData 정보 * @private */ _getRowSpanData: function(rowKey, columnName) { @@ -5979,7 +6363,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * offset 만큼 뒤로 이동한 row 의 index 를 반환한다. * @param {number} offset 이동할 offset - * @return {Number} 이동한 위치의 row index + * @returns {Number} 이동한 위치의 row index */ nextRowIndex: function(offset) { var rowKey = this.nextRowKey(offset); @@ -5989,7 +6373,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * offset 만큼 앞으로 이동한 row의 index를 반환한다. * @param {number} offset 이동할 offset - * @return {Number} 이동한 위치의 row index + * @returns {Number} 이동한 위치의 row index */ prevRowIndex: function(offset) { var rowKey = this.prevRowKey(offset); @@ -5998,7 +6382,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 다음 컬럼의 인덱스를 반환한다. - * @return {Number} 다음 컬럼의 index + * @returns {Number} 다음 컬럼의 index */ nextColumnIndex: function() { var columnName = this.nextColumnName(); @@ -6007,7 +6391,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 이전 컬럼의 인덱스를 반환한다. - * @return {Number} 이전 컬럼의 인덱스 + * @returns {Number} 이전 컬럼의 인덱스 */ prevColumnIndex: function() { var columnName = this.prevColumnName(); @@ -6018,7 +6402,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * keyEvent 발생 시 호출될 메서드로, * rowSpan 정보 까지 계산된 다음 rowKey 를 반환한다. * @param {number} offset 이동할 offset - * @return {Number|String} offset 만큼 이동한 위치의 rowKey + * @returns {Number|String} offset 만큼 이동한 위치의 rowKey */ nextRowKey: function(offset) { var focused = this.which(), @@ -6051,7 +6435,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * keyEvent 발생 시 호출될 메서드로, * rowSpan 정보 까지 계산된 이전 rowKey 를 반환한다. * @param {number} offset 이동할 offset - * @return {Number|String} offset 만큼 이동한 위치의 rowKey + * @returns {Number|String} offset 만큼 이동한 위치의 rowKey */ prevRowKey: function(offset) { var focused = this.which(), @@ -6079,7 +6463,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * keyEvent 발생 시 호출될 메서드로, 다음 columnName 을 반환한다. - * @return {String} 다음 컬럼명 + * @returns {String} 다음 컬럼명 */ nextColumnName: function() { return this._findColumnName(1); @@ -6087,7 +6471,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * keyEvent 발생 시 호출될 메서드로, 이전 columnName 을 반환한다. - * @return {String} 이전 컬럼명 + * @returns {String} 이전 컬럼명 */ prevColumnName: function() { return this._findColumnName(-1); @@ -6095,7 +6479,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 첫번째 row 의 key 를 반환한다. - * @return {(string|number)} 첫번째 row 의 키값 + * @returns {(string|number)} 첫번째 row 의 키값 */ firstRowKey: function() { return this.dataModel.at(0).get('rowKey'); @@ -6103,7 +6487,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 마지막 row의 key 를 반환한다. - * @return {(string|number)} 마지막 row 의 키값 + * @returns {(string|number)} 마지막 row 의 키값 */ lastRowKey: function() { return this.dataModel.at(this.dataModel.length - 1).get('rowKey'); @@ -6111,7 +6495,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 첫번째 columnName 을 반환한다. - * @return {string} 첫번째 컬럼명 + * @returns {string} 첫번째 컬럼명 */ firstColumnName: function() { var columnModelList = this.columnModel.getVisibleColumnModelList(); @@ -6120,7 +6504,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 마지막 columnName 을 반환한다. - * @return {string} 마지막 컬럼명 + * @returns {string} 마지막 컬럼명 */ lastColumnName: function() { var columnModelList = this.columnModel.getVisibleColumnModelList(), @@ -6158,6 +6542,8 @@ var defaultOptions = { autoNumbering: true, headerHeight: 35, rowHeight: 27, + fitToParentHeight: false, + showDummyRows: false, displayRowCount: 10, minimumColumnWidth: 50, notUseSmartRendering: false, @@ -6203,7 +6589,7 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype /** * Creates an instance of column model and returns it. * @param {Object} options - Options - * @return {module:data/columnModel} A new instance + * @returns {module:data/columnModel} A new instance * @private */ _createColumnModel: function(options) { @@ -6221,7 +6607,7 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype * Creates an instance of data model and returns it. * @param {Object} options - Options * @param {module:domState} domState - domState - * @return {module:data/rowList} - A new instance + * @returns {module:data/rowList} - A new instance * @private */ _createDataModel: function(options, domState) { @@ -6236,7 +6622,7 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype /** * Creates an instance of toolbar model and returns it. * @param {Object} options - Options - * @return {module:model/toolbar} - A new instance + * @returns {module:model/toolbar} - A new instance * @private */ _createToolbarModel: function(options) { @@ -6247,13 +6633,14 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype * Creates an instance of dimension model and returns it. * @param {Object} options - Options * @param {module:domState} domState - domState - * @return {module:model/dimension} - A new instance + * @returns {module:model/dimension} - A new instance * @private */ _createDimensionModel: function(options, domState) { var attrs = { headerHeight: options.headerHeight, rowHeight: options.rowHeight, + fitToParentHeight: options.fitToParentHeight, scrollX: !!options.scrollX, scrollY: !!options.scrollY, minimumColumnWidth: options.minimumColumnWidth, @@ -6273,7 +6660,7 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype /** * Creates an instance of focus model and returns it. * @param {module:domState} domState - DomState instance - * @return {module:model/focus} - A new instance + * @returns {module:model/focus} - A new instance * @private */ _createFocusModel: function(domState) { @@ -6288,7 +6675,7 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype /** * Creates an instance of seleciton model and returns it. - * @return {module:model/selection} - A new instance + * @returns {module:model/selection} - A new instance * @private */ _createSelectionModel: function() { @@ -6304,14 +6691,15 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype /** * Creates an instance of render model and returns it. * @param {Object} options - Options - * @return {module:model/render} - A new instance + * @returns {module:model/render} - A new instance * @private */ _createRenderModel: function(options) { var attrs, renderOptions, Constructor; attrs = { - emptyMessage: options.emptyMessage + emptyMessage: options.emptyMessage, + showDummyRows: options.showDummyRows }; renderOptions = { columnModel: this.columnModel, @@ -6355,10 +6743,10 @@ var util = require('../common/util'); * View 에서 Rendering 시 사용할 객체 * Smart Rendering 을 지원한다. * @module model/renderer-smart + * @extends module:model/renderer */ var SmartRenderer = Renderer.extend(/**@lends module:model/renderer-smart.prototype */{ /** - * @extends module:model/renderer * @constructs */ initialize: function() { @@ -6390,7 +6778,7 @@ var SmartRenderer = Renderer.extend(/**@lends module:model/renderer-smart.protot var dimensionModel = this.dimensionModel, dataModel = this.dataModel, rowHeight = dimensionModel.get('rowHeight'), - displayRowCount = dimensionModel.getDisplayRowCount(), + displayRowCount = dimensionModel.get('displayRowCount'), startIndex = Math.max(0, Math.ceil(scrollTop / (rowHeight + 1)) - this.hiddenRowCount), endIndex = Math.min(dataModel.length - 1, startIndex + displayRowCount + (this.hiddenRowCount * 2)), top; @@ -6411,7 +6799,7 @@ var SmartRenderer = Renderer.extend(/**@lends module:model/renderer-smart.protot /** * 렌더링을 시작하는 행에 rowSpan 정보가 있으면, count 값이 가장 작은 행의 값을 반환한다. * @param {number} startIndex 시작하는 행의 Index - * @return {number} rowSpan의 count 값 (0 이하) + * @returns {number} rowSpan의 count 값 (0 이하) * @private */ _getStartRowSpanMinCount: function(startIndex) { @@ -6430,7 +6818,7 @@ var SmartRenderer = Renderer.extend(/**@lends module:model/renderer-smart.protot /** * 렌더링할 마지막 행에 rowSpan 정보가 있으면, count 값이 가장 큰 행의 값을 반환한다. * @param {number} endIndex 마지막 행의 Index - * @return {number} rowSpan의 count 값 (0 이상) + * @returns {number} rowSpan의 count 값 (0 이상) * @private */ _getEndRowSpanMaxCount: function(endIndex) { @@ -6448,7 +6836,7 @@ var SmartRenderer = Renderer.extend(/**@lends module:model/renderer-smart.protot /** * scrollTop 값 에 따라 rendering 해야하는지 판단한다. * @param {Number} scrollTop 랜더링 범위를 결정하기 위한 현재 scrollTop 위치 값 - * @return {boolean} 랜더링 해야할지 여부 + * @returns {boolean} 랜더링 해야할지 여부 * @private */ _isRenderable: function(scrollTop) { @@ -6490,15 +6878,18 @@ module.exports = SmartRenderer; var Model = require('../base/model'); var RowList = require('./rowList'); var renderStateMap = require('../common/constMap').renderState; +var util = require('../common/util'); /** * View 에서 Rendering 시 사용할 객체 * @module model/renderer + * @extends module:base/model */ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ /** - * @extends module:base/model * @constructs + * @param {Object} attrs - Attributes + * @param {Object} options - Options */ initialize: function(attrs, options) { var lside, rside, rowListOptions; @@ -6525,12 +6916,16 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ this.listenTo(this.columnModel, 'all', this._onColumnModelChange) .listenTo(this.dataModel, 'add remove sort reset', this._onRowListChange) .listenTo(this.dataModel, 'beforeReset', this._onBeforeResetData) - .listenTo(lside, 'valueChange', this._onValueChange) - .listenTo(rside, 'valueChange', this._onValueChange) + .listenTo(lside, 'valueChange', this._executeRelation) + .listenTo(rside, 'valueChange', this._executeRelation) .listenTo(this.dimensionModel, 'change:width', this._updateMaxScrollLeft) .listenTo(this.dimensionModel, 'change:totalRowHeight change:scrollBarSize change:bodyHeight', this._updateMaxScrollTop); + if (this.get('showDummyRows')) { + this.listenTo(this.dimensionModel, 'change:displayRowCount', this._resetDummyRows) + } + this._updateMaxScrollLeft(); }, @@ -6545,6 +6940,8 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ startNumber: 1, lside: null, rside: null, + showDummyRows: false, + dummyRowCount: 0, // text that will be shown if no data to render (custom value set by user) emptyMessage: null, @@ -6553,15 +6950,6 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ state: renderStateMap.EMPTY }, - /** - * lside 와 rside collection 에서 value 값이 변경되었을 시 executeRelation 을 수행하기 위한 이벤트 핸들러 - * @param {number} rowIndex row 의 index 값 - * @private - */ - _onValueChange: function(rowIndex) { - this.executeRelation(rowIndex); - }, - /** * Event handler for 'chage:width' event on Dimension. * @private @@ -6577,26 +6965,28 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ */ _updateMaxScrollTop: function() { var dimension = this.dimensionModel, - maxScrollTop = dimension.get('totalRowHeight') - dimension.get('bodyHeight') + dimension.get('scrollBarSize'); + maxScrollTop = dimension.get('totalRowHeight') - dimension.get('bodyHeight') + + dimension.get('scrollBarSize'); this.set('maxScrollTop', maxScrollTop); }, /** * Event handler for 'beforeReset' event on dataModel + * @private */ _onBeforeResetData: function() { this.set('state', renderStateMap.LOADING); }, /** - * 내부 변수를 초기화 한다. + * Initializes own properties. + * (called by module:addon/net) */ initializeVariables: function() { this.set({ top: 0, scrollTop: 0, - $scrollTarget: null, scrollLeft: 0, startIndex: 0, endIndex: 0, @@ -6607,7 +6997,7 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ /** * 열고정 영역 또는 열고정이 아닌 영역에 대한 Render Collection 을 반환한다. * @param {String} [whichSide='R'] 어느 영역인지 여부. 'L|R' 중에 하나의 값을 넘긴다. - * @return {Object} collection 해당 영역의 랜더 데이터 콜랙션 + * @returns {Object} collection 해당 영역의 랜더 데이터 콜랙션 */ getCollection: function(whichSide) { return this.get(tui.util.isString(whichSide) ? whichSide.toLowerCase() + 'side' : 'rside'); @@ -6638,6 +7028,16 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ this.timeoutIdForRefresh = setTimeout($.proxy(this.refresh, this, true), 0); }, + /** + * Resets dummy rows and trigger 'rowListChanged' event. + * @private + */ + _resetDummyRows: function() { + this._clearDummyRows(); + this._fillDummyRows(); + this.trigger('rowListChanged'); + }, + /** * rendering 할 index 범위를 결정한다. * Smart rendering 을 사용하지 않을 경우 전체 범위로 랜더링한다. @@ -6651,79 +7051,140 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ }, /** - * rendering 할 데이터를 생성한다. - * @param {boolean} isDataModelChanged - The boolean value whether dataModel has changed + * Returns the new data object for rendering based on rowDataModel and specified column names. + * @param {Object} rowDataModel - Instance of module:model/data/row + * @param {Array.} columnNames - Column names + * @param {Number} rowNum - Row number + * @returns {Object} - view data object + * @private */ - refresh: function(isDataModelChanged) { - this._setRenderingRange(this.get('scrollTop')); - - //TODO : rendering 해야할 데이터만 가져온다. - //TODO : eslint 에러 수정 - var columnFixCount = this.columnModel.getVisibleColumnFixCount(true), // eslint-disable-line - columnList = this.columnModel.getVisibleColumnModelList(null, true), - columnNameList = _.pluck(columnList, 'columnName'), - - lsideColumnList = columnNameList.slice(0, columnFixCount), - rsideColumnList = columnNameList.slice(columnFixCount), + _createViewDataFromDataModel: function(rowDataModel, columnNames, rowNum) { + var viewData = { + rowKey: rowDataModel.get('rowKey'), + _extraData: rowDataModel.get('_extraData') + }; - lsideRowList = [], - rsideRowList = [], - lsideRow = [], - rsideRow = [], - startIndex = this.get('startIndex'), - endIndex = this.get('endIndex'), - num = this.get('startNumber') + startIndex, - len, - i, - rowModel, - rowKey; - - for (i = startIndex; i < endIndex + 1; i += 1) { - rowModel = this.dataModel.at(i); - if (rowModel) { - rowKey = rowModel.get('rowKey'); + _.each(columnNames, function(columnName) { + var value = rowDataModel.get(columnName); + if (columnName === '_number') { + value = rowNum; + } + viewData[columnName] = value; + }); - //데이터 초기화 - lsideRow = { - '_extraData': rowModel.get('_extraData'), - 'rowKey': rowKey - }; - rsideRow = { - '_extraData': rowModel.get('_extraData'), - 'rowKey': rowKey - }; + return viewData; + }, - //lside 데이터 먼저 채운다. - _.each(lsideColumnList, function (columnName) { // eslint-disable-line - if (columnName === '_number') { - lsideRow[columnName] = num++; // eslint-disable-line - } else { - lsideRow[columnName] = rowModel.get(columnName); - } - }); + /** + * Returns the object that contains two array of column names splitted by columnFixCount. + * @returns {{lside: Array, rside: Array}} - Column names map + * @private + */ + _getColumnNamesOfEachSide: function() { + var columnFixCount = this.columnModel.getVisibleColumnFixCount(true), + columnModels = this.columnModel.getVisibleColumnModelList(null, true), + columnNames = _.pluck(columnModels, 'columnName'); - _.each(rsideColumnList, function (columnName) { // eslint-disable-line - if (columnName === '_number') { - rsideRow[columnName] = num++; // eslint-disable-line - } else { - rsideRow[columnName] = rowModel.get(columnName); - } - }); - lsideRowList.push(lsideRow); - rsideRowList.push(rsideRow); - } + return { + lside: columnNames.slice(0, columnFixCount), + rside: columnNames.slice(columnFixCount) } + }, - this.get('lside').clear().reset(lsideRowList, { - parse: true - }); - this.get('rside').clear().reset(rsideRowList, { + /** + * Resets specified view model list. + * @param {String} attrName - 'lside' or 'rside' + * @param {Object} viewData - Converted data for rendering view + * @private + */ + _resetViewModelList: function(attrName, viewData) { + this.get(attrName).clear().reset(viewData, { parse: true }); + }, - len = rsideRowList.length + startIndex; - for (i = startIndex; i < len; i += 1) { - this.executeRelation(i); + /** + * Resets both sides(lside, rside) of view model list with given range of data model list. + * @param {Number} startIndex - Start index + * @param {Number} endIndex - End index + * @private + */ + _resetAllViewModelListWithRange: function(startIndex, endIndex) { + var columnNamesMap = this._getColumnNamesOfEachSide(), + rowNum = this.get('startNumber') + startIndex, + lsideData = [], + rsideData = [], + rowDataModel, i, len; + + for (i = startIndex; i <= endIndex; i += 1) { + rowDataModel = this.dataModel.at(i); + lsideData.push(this._createViewDataFromDataModel(rowDataModel, columnNamesMap.lside, rowNum)); + rsideData.push(this._createViewDataFromDataModel(rowDataModel, columnNamesMap.rside)); + rowNum += 1; + } + + this._resetViewModelList('lside', lsideData); + this._resetViewModelList('rside', rsideData); + }, + + /** + * Returns the count of rows (except dummy rows) in view model list + * @returns {Number} Count of rows + * @private + */ + _getActualRowCount: function() { + return this.get('endIndex') - this.get('startIndex') + 1; + }, + + /** + * Removes all dummy rows in the view model list. + * @private + */ + _clearDummyRows: function() { + var dataRowCount = this.get('endIndex') - this.get('startIndex') + 1; + + _.each(['lside', 'rside'], function(attrName) { + var rowList = this.get(attrName); + while (rowList.length > dataRowCount) { + rowList.pop(); + } + }, this); + }, + + /** + * fills the empty area with dummy rows. + * @private + */ + _fillDummyRows: function() { + var displayRowCount = this.dimensionModel.get('displayRowCount'), + actualRowCount = this._getActualRowCount(), + dummyRowCount = Math.max(displayRowCount - actualRowCount, 0); + + _.times(dummyRowCount, function() { + this.get('lside').add({}); + this.get('rside').add({}); + }, this); + this.set('dummyRowCount', dummyRowCount); + }, + + /** + * Refreshes the rendering range and the list of view models, and triggers events. + * @param {Boolean} isDataModelChanged - The boolean value whether dataModel has changed + */ + refresh: function(isDataModelChanged) { + var startIndex, endIndex, i; + + this._setRenderingRange(this.get('scrollTop')); + startIndex = this.get('startIndex'); + endIndex = this.get('endIndex'); + + this._resetAllViewModelListWithRange(startIndex, endIndex); + if (this.get('showDummyRows')) { + this._fillDummyRows(); + } + + for (i = startIndex; i <= endIndex; i += 1) { + this._executeRelation(i); } if (this.isColumnModelChanged) { @@ -6738,6 +7199,7 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ /** * Set state value based on the DataModel.length + * @private */ _refreshState: function() { if (this.dataModel.length) { @@ -6750,7 +7212,7 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ /** * columnName 으로 lside 와 rside rendering collection 중 하나를 반환한다. * @param {String} columnName 컬럼명 - * @return {Collection} 컬럼명에 해당하는 영역의 콜랙션 + * @returns {Collection} 컬럼명에 해당하는 영역의 콜랙션 * @private */ _getCollectionByColumnName: function(columnName) { @@ -6769,7 +7231,7 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * 셀 데이터를 반환한다. * @param {number} rowKey 데이터의 키값 * @param {String} columnName 컬럼명 - * @return {object} cellData 셀 데이터 + * @returns {object} cellData 셀 데이터 * @example => { @@ -6795,13 +7257,15 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ }, /** - * rowIndex 에 해당하는 relation 을 수행한다. - * @param {Number} rowIndex row 의 index 값 + * Executes the relation of the row identified by rowIndex + * @param {Number} rowIndex - Row index + * @private */ - executeRelation: function(rowIndex) { + _executeRelation: function(rowIndex) { var row = this.dataModel.at(rowIndex), renderIdx = rowIndex - this.get('startIndex'), rowModel, relationResult; + relationResult = row.getRelationResult(); _.each(relationResult, function(changes, columnName) { @@ -6823,9 +7287,9 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ module.exports = Renderer; -},{"../base/model":5,"../common/constMap":8,"./rowList":23}],22:[function(require,module,exports){ +},{"../base/model":5,"../common/constMap":8,"../common/util":10,"./rowList":23}],22:[function(require,module,exports){ /** - * @fileoverview RowList 클래스파일 + * @fileoverview Row Model for Rendering (View Model) * @author NHN Ent. FE Development Team */ 'use strict'; @@ -6836,31 +7300,33 @@ var util = require('../common/util'); /** * Row Model * @module model/row + * @extends module:base/model */ var Row = Model.extend(/**@lends module:model/row.prototype */{ /** * @constructs - * @extends module:base/model * @param {object} attributes - Attributes * @param {object} options - Options */ - initialize: function(attributes, options) { // eslint-disable-line no-unused-vars - var rowKey, rowData; - - rowKey = attributes && attributes['rowKey']; - rowData = this.collection.dataModel.get(rowKey); + initialize: function(attributes, options) { + var rowKey = attributes && attributes['rowKey'], + rowListData = this.collection.dataModel, + rowData = rowListData.get(rowKey); if (rowData) { this.listenTo(rowData, 'change restore', this._onDataModelChange); this.listenTo(rowData, 'extraDataChanged', this._setRowExtraData); + this.listenTo(rowListData, 'disabledChanged', this._onDataModelDisabledChanged); + + this.rowData = rowData; } }, idAttribute: 'rowKey', /** - * dataModel 이 변경시 model 데이터를 함께 업데이트 하는 핸들러 - * @param {Object} model 변경이 발생한 row 모델 + * Event handler for 'change restore' event on rowData model + * @param {Object} model - RowData model on which event occurred * @private */ _onDataModelChange: function(model) { @@ -6872,29 +7338,68 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ }, /** - * extra data 를 토대로 rowSpanned 된 render model 의 정보를 업데이트 한다. + * Returns an array of visible column names. + * @returns {Array.} Visible column names + * @private + */ + _getColumnNameList: function() { + var columnModels = this.collection.columnModel.getVisibleColumnModelList(null, true); + + return _.pluck(columnModels, 'columnName'); + }, + + /** + * Returns whether the state of specified column is disabled. + * @param {String} columnName - Column name + * @param {{isDisabledCheck: Boolean, isDisabled: Boolean, isChecked: Boolean}} rowState - Row state + * @returns {Boolean} - True if disabled + * @private + */ + _isDisabled: function(columnName, rowState) { + var isDisabled = this.collection.dataModel.isDisabled; + + if (!isDisabled) { + isDisabled = (columnName === '_button') ? rowState.isDisabledCheck : rowState.isDisabled; + } + return isDisabled; + }, + + /** + * Event handler for 'disabledChanged' event on dataModel + */ + _onDataModelDisabledChanged: function() { + var columnNames = this._getColumnNameList(), + rowState = this.rowData.getRowState(); + + _.each(columnNames, function(columnName) { + this.setCell(columnName, { + isDisabled: this._isDisabled(columnName, rowState) + }); + }, this); + }, + + /** + * Sets the 'isDisabled', 'isEditable', 'className' property of each cell data. * @private */ _setRowExtraData: function() { var dataModel = this.collection.dataModel, - row = dataModel.get(this.get('rowKey')), - columnModelList = this.collection.columnModel.getVisibleColumnModelList(null, true), - rowState = row.getRowState(), + columnNames = this._getColumnNameList(), + rowState = this.rowData.getRowState(), param; if (tui.util.isUndefined(this.collection)) { return; } - _.each(columnModelList, function(columnModel) { - var columnName = columnModel['columnName'], - cellData = this.get(columnName), + _.each(columnNames, function(columnName) { + var cellData = this.get(columnName), rowModel = this, isEditable, isDisabled; if (!tui.util.isUndefined(cellData)) { - isEditable = row.isEditable(columnName); - isDisabled = (columnName === '_button') ? rowState.isDisabledCheck : rowState.isDisabled; + isEditable = this.rowData.isEditable(columnName); + isDisabled = this._isDisabled(columnName, rowState); if (dataModel.isRowSpanEnable() && !cellData['isMainRow']) { rowModel = this.collection.get(cellData['mainRowKey']); } @@ -6902,7 +7407,7 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ param = { isDisabled: isDisabled, isEditable: isEditable, - className: row.getClassNameList(columnName).join(' ') + className: this.rowData.getClassNameList(columnName).join(' ') }; rowModel.setCell(columnName, param); } @@ -6911,29 +7416,36 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ }, /** - * Backbone 이 collection 생성 시 내부적으로 parse 를 호출하여 데이터를 형식에 맞게 가공한다. - * @param {Array} data 원본 데이터 - * @return {Array} 형식에 맞게 가공된 데이터 + * Overrides Backbone.Model.parse + * (this method is called before initialize method) + * @param {Array} data - Original data + * @param {Object} options - Options + * @returns {Array} - Converted data. + * @override */ parse: function(data, options) { return this._formatData(data, options.collection.dataModel); }, /** - * 데이터를 View 에서 사용할 수 있도록 가공한다. - * @param {Array} data 원본 데이터 - * @return {Array} 가공된 데이터 + * Convert the original data to rendering data. + * @param {Array} data - Original data + * @param {module:model/data/rowList} dataModel - Data model + * @returns {Array} - Converted data * @private */ _formatData: function(data, dataModel) { - var rowKey = data['rowKey'], - row = dataModel.get(rowKey), - rowState = row.getRowState(), - isDisabled = rowState.isDisabled; + var rowKey = data.rowKey, + row, rowState; + + if (_.isUndefined(rowKey)) { + return data; + } + row = dataModel.get(rowKey), + rowState = row.getRowState(); _.each(data, function(value, columnName) { - var rowSpanData, - isEditable = row.isEditable(columnName); + var rowSpanData; if (columnName !== 'rowKey' && columnName !== '_extraData') { if (dataModel.isRowSpanEnable() && @@ -6947,23 +7459,18 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ isMainRow: true }; } - isDisabled = (columnName === '_button') ? rowState.isDisabledCheck : isDisabled; - data[columnName] = { rowKey: rowKey, columnName: columnName, value: value, - //Rendering properties rowSpan: rowSpanData.count, isMainRow: rowSpanData.isMainRow, mainRowKey: rowSpanData.mainRowKey, - //Change attribute properties - isEditable: isEditable, - isDisabled: isDisabled, - optionList: [], + isEditable: row.isEditable(columnName), + isDisabled: this._isDisabled(columnName, rowState), className: row.getClassNameList(columnName).join(' '), - - changed: [] //변경된 프로퍼티 목록들 + optionList: [], // for list type column (select, checkbox, radio) + changed: [] //changed property names }; } }, this); @@ -6971,10 +7478,11 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ }, /** - * Cell 의 값을 변경한다. - * - 참조형 데이터 타입이기 때문에 change 이벤트 발생을 위해 이 method 를 사용하여 값 변경을 수행한다. - * @param {String} columnName 컬럼명 - * @param {{key: value}} param key:value 로 이루어진 셀에서 변경할 프로퍼티 목록 + * Sets the cell data. + * (Each cell data is reference type, so do not change the cell data directly and + * use this method to trigger change event) + * @param {String} columnName - Column name + * @param {Object} param - Key-Value pair of the data to change */ setCell: function(columnName, param) { var isValueChanged = false, @@ -7023,17 +7531,19 @@ var Row = require('./row'); /** * View Model rowList collection * @module model/rowList + * @extends module:base/collection */ var RowList = Collection.extend(/**@lends module:model/rowList.prototype */{ model: Row, /** * @constructs - * @extends module:base/collection + * @param {Object} rawData - Raw data + * @param {Object} options - Options */ initialize: function(rawData, options) { this.setOwnProperties({ dataModel: options.dataModel, - columnModel: options.columnModel + columnModel: options.columnModel }); } }); @@ -7055,21 +7565,24 @@ var Model = require('../base/model'), * @const * @type {{cell: string, row: string, column: string}} * @desc - * Selection states + * Selection states */ var SELECTION_STATE = { cell: 'cell', row: 'row', column: 'column' }; + /** - * Selection Model class - * @module model/selection + * Selection Model class + * @module model/selection + * @extends module:base/view */ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * @constructs - * @extends module:base/view + * @param {Object} attr - Attributes + * @param {Object} options - Options */ initialize: function(attr, options) { Model.prototype.initialize.apply(this, arguments); @@ -7143,7 +7656,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * Returns whether the selection is enabled. - * @return {boolean} True if the selection is enabled. + * @returns {boolean} True if the selection is enabled. */ isEnabled: function() { return this._isEnabled; @@ -7296,6 +7809,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * Select all data in a row + * @param {Number} rowIndex - Row idnex */ selectRow: function(rowIndex) { if (this._isEnabled) { @@ -7307,6 +7821,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * Select all data in a column + * @param {Number} columnIdx - Column index */ selectColumn: function(columnIdx) { if (this._isEnabled) { @@ -7328,7 +7843,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * Returns the row and column indexes of the starting position. - * @return {{row: number, column: number}} Objects containing indexes + * @returns {{row: number, column: number}} Objects containing indexes */ getStartIndex: function() { var range = this.get('range'); @@ -7340,7 +7855,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * Returns the row and column indexes of the ending position. - * @return {{row: number, column: number}} Objects containing indexes + * @returns {{row: number, column: number}} Objects containing indexes */ getEndIndex: function() { var range = this.get('range'); @@ -7352,19 +7867,34 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * selection 데이터가 존재하는지 확인한다. - * @return {boolean} selection 데이터 존재여부 + * @returns {boolean} selection 데이터 존재여부 */ hasSelection: function() { return !!this.get('range'); }, + /** + * Returns whether given range is a single cell. (include merged cell) + * @param {Array.} columnNameList - columnNameList + * @param {Array.} rowList - rowList + * @returns {Boolean} + */ + _isSingleCell: function(columnNameList, rowList) { + var isSingleColumn = columnNameList.length === 1, + isSingleRow = rowList.length === 1, + isSingleMergedCell = isSingleColumn && !isSingleRow && + (rowList[0].getRowSpanData(columnNameList[0]).count === rowList.length); + + return (isSingleColumn && isSingleRow) || isSingleMergedCell; + }, + /** * Returns the string value of all cells in the selection range as a single string. - * @return {String} string of values + * @returns {String} string of values */ getValuesToString: function() { var range = this.get('range'), - columnModelList, rowList, columnNameList, rowValues; + columnModelList, rowList, columnNameList, rowValues, result; columnModelList = this.columnModel.getVisibleColumnModelList().slice(range.column[0], range.column[1] + 1); rowList = this.dataModel.slice(range.row[0], range.row[1] + 1); @@ -7377,6 +7907,9 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ return tmpString.join('\t'); }); + if (this._isSingleCell(columnNameList, rowList)) { + return rowValues[0]; + } return rowValues.join('\n'); }, @@ -7384,7 +7917,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * 마우스 드래그로 selection 선택 시 auto scroll 조건에 해당하는지 반환한다. * @param {Number} overflowX 가로축 기준 영역 overflow 값 * @param {Number} overflowY 세로축 기준 영역 overflow 값 - * @return {boolean} overflow 되었는지 여부 + * @returns {boolean} overflow 되었는지 여부 * @private */ _isAutoScrollable: function(overflowX, overflowY) { @@ -7448,7 +7981,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * Expands the 'this.inputRange' if rowspan data exists, and resets the 'range' attributes to the value. - * @param {{column: number[], row: number[]}} [inputRange = this.inputRange] - Input range + * @param {{column: number[], row: number[]}} [inputRange] - Input range. Default is this.inputRange * @private */ _resetRangeAttribute: function(inputRange) { @@ -7647,11 +8180,11 @@ var Model = require('../base/model'), /** * Toolbar Model * @module model/toolbar + * @extends module:base/model */ var Toolbar = Model.extend(/**@lends module:model/toolbar.prototype */{ /** * @constructs - * @extends module:base/model * @param {object} options - Options */ initialize: function(options) { @@ -7674,7 +8207,7 @@ var Toolbar = Model.extend(/**@lends module:model/toolbar.prototype */{ /** * Returns whether the toolbar is visible - * @return {Boolean} True if the toolbar is visible + * @returns {Boolean} True if the toolbar is visible */ isVisible: function() { return this.get('hasControlPanel') || this.get('hasPagination') || this.get('hasResizeHandler'); @@ -7697,11 +8230,11 @@ var keyNameMap = require('../common/constMap').keyName; /** * Cell Painter Base * @module painter/cell + * @extends module:base/painter */ var Cell = tui.util.defineClass(Painter, /**@lends module:painter/cell.prototype */{ /** * @constructs - * @extends module:base/painter */ init: function() { Painter.apply(this, arguments); @@ -7719,7 +8252,7 @@ var Cell = tui.util.defineClass(Painter, /**@lends module:painter/cell.prototype * Markup template * If use '<%=class%>' key word, an error occurs. * So use '<%=className%>' instead of '<%=class%>' - * @return {string} template + * @returns {string} template */ template: _.template( ' 안에 들아갈 html string 을 반환한다. * redrawAttributes 에 해당하는 프로퍼티가 변경되었을 때 수행될 로직을 구현한다. * @param {object} cellData 모델의 셀 데이터 - * @return {string} html 마크업 문자열 + * @returns {string} html 마크업 문자열 * @example * var html = this.getContentHtml(); * @@ -8325,7 +8868,7 @@ var ButtonCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/but /** * 다음 input 에 focus 한다 * @param {jQuery} $currentInput 현재 input jQuery 엘리먼트 - * @return {boolean} 다음 엘리먼트에 focus 되었는지 여부 + * @returns {boolean} 다음 엘리먼트에 focus 되었는지 여부 * @private */ _focusNextInput: function($currentInput) { @@ -8335,7 +8878,7 @@ var ButtonCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/but /** * 이전 input 에 focus 한다. * @param {jQuery} $currentInput 현재 input jQuery 엘리먼트 - * @return {boolean} 다음 엘리먼트에 focus 되었는지 여부 + * @returns {boolean} 다음 엘리먼트에 focus 되었는지 여부 * @private */ _focusPrevInput: function($currentInput) { @@ -8346,7 +8889,7 @@ var ButtonCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/but * 이전 혹은 다음 input 에 focus 한다. * @param {jQuery} $currentInput 현재 input jQuery 엘리먼트 * @param {string} direction 방향 'next|prev' - * @return {boolean} 해당 엘리먼트에 focus 되었는지 여부 + * @returns {boolean} 해당 엘리먼트에 focus 되었는지 여부 * @private */ _focusTargetInput: function($currentInput, direction) { @@ -8378,7 +8921,7 @@ var ButtonCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/but /** * check 된 button 의 값들을 가져온다. onChange 이벤트 핸들러에서 호출한다. * @param {jQuery} $target 이벤트가 발생한 targetElement - * @return {Array} check 된 값들의 결과 배열 + * @returns {Array} check 된 값들의 결과 배열 * @private */ _getCheckedValueList: function($target) { @@ -8400,7 +8943,18 @@ var ButtonCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/but _onChange: function(changeEvent) { var $target = $(changeEvent.target), cellAddress = this._getCellAddress($target); - this.grid.dataModel.setValue(cellAddress.rowKey, cellAddress.columnName, this._getCheckedValueList($target).join(',')); + this.grid.dataModel.setValue(cellAddress.rowKey, cellAddress.columnName, + this._getCheckedValueList($target).join(',')); + }, + + /** + * Event handler for 'blur' event on input element + * @param {Event} ev - Blur event + * @private + */ + _onBlur: function(ev) { + var cellAddr = this._getCellAddress($(ev.target)); + this._validateData(cellAddr.rowKey, cellAddr.columnName); } }); @@ -8418,11 +8972,11 @@ var Cell = require('../cell'); /** * editOption 에 list 를 가지고 있는 형태의 Base 클래스 * @module painter/cell/list + * @extends module:painter/cell */ var ListCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/list.prototype */{ /** * @constructs - * @extends module:painter/cell */ init: function() { Cell.apply(this, arguments); @@ -8435,7 +8989,7 @@ var ListCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/list.prot /* eslint-disable */ /** * 자기 자신의 인스턴스의 editType 을 반환한다. - * @return {String} editType 'normal|button|select|button|text|text-password|text-convertible' + * @returns {String} editType 'normal|button|select|button|text|text-password|text-convertible' */ getEditType: function() {}, @@ -8449,7 +9003,7 @@ var ListCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/list.prot * Cell data 를 인자로 받아 안에 들아갈 html string 을 반환한다. * redrawAttributes 에 해당하는 프로퍼티가 변경되었을 때 수행될 로직을 구현한다. * @param {object} cellData 모델의 셀 데이터 - * @return {string} html 마크업 문자열 + * @returns {string} html 마크업 문자열 * @example * var html = this.getContentHtml(); * @@ -8614,7 +9168,7 @@ var MainButtonCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/mai /** * getHtml 으로 마크업 생성시 td에 포함될 attribute object 를 반환한다. - * @return {Object} td 에 지정할 attribute 데이터 + * @returns {Object} td 에 지정할 attribute 데이터 */ getAttributes: function() { return { @@ -8660,11 +9214,11 @@ var Cell = require('../cell'); /** * editOption 이 적용되지 않은 cell 의 Painter * @module painter/cell/normal + * @extends module:painter/cell */ var NormalCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/normal.prototype */{ /** * @constructs - * @extends module:painter/cell */ init: function() { Cell.apply(this, arguments); @@ -8672,7 +9226,7 @@ var NormalCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/normal. /** * 자기 자신의 인스턴스의 editType 을 반환한다. - * @return {string} editType 'normal|select|button|text|text-convertible' + * @returns {string} editType 'normal|select|button|text|text-convertible' */ getEditType: function() { return 'normal'; @@ -8682,7 +9236,7 @@ var NormalCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/normal. * Cell data 를 인자로 받아 안에 들아갈 html string 을 반환한다. * redrawAttributes 에 해당하는 프로퍼티가 변경되었을 때 수행될 로직을 구현한다. * @param {object} cellData 모델의 셀 데이터 - * @return {string} html 마크업 문자열 + * @returns {string} html 마크업 문자열 * @example * var html = this.getContentHtml(); * @@ -8790,11 +9344,11 @@ var util = require('../../common/util'); /** * Painter class for the select cell * @module painter/cell/select + * @extends module:painter/cell/list */ var SelectCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/select.prototype */{ /** * @constructs - * @extends module:painter/cell/list */ init: function() { ListCell.apply(this, arguments); @@ -8811,12 +9365,13 @@ var SelectCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/sel eventHandler: { 'change select': '_onChange', - 'keydown select': '_onKeyDown' + 'keydown select': '_onKeyDown', + 'blur select': '_onBlurSelect' }, /** * Content markup template - * @return {string} html + * @returns {string} html */ contentTemplate: _.template( '' ), + /** + * Event handler for 'blur' event on select element + * @param {Event} ev - Event object + */ + _onBlurSelect: function(ev) { + var cellAddr = this._getCellAddress($(ev.target)); + this._validateData(cellAddr.rowKey, cellAddr.columnName); + }, + /** * 자기 자신의 인스턴스의 editType 을 반환한다. - * @return {String} editType 'normal|button|select|button|text|text-password|text-convertible' + * @returns {String} editType 'normal|button|select|button|text|text-password|text-convertible' */ getEditType: function() { return 'select'; @@ -8867,7 +9432,7 @@ var SelectCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/sel * Cell data 를 인자로 받아 안에 들아갈 html string 을 반환한다. * redrawAttributes 에 해당하는 프로퍼티가 변경되었을 때 수행될 로직을 구현한다. * @param {object} cellData 모델의 셀 데이터 - * @return {string} html 마크업 문자열 + * @returns {string} html 마크업 문자열 * @example * var html = this.getContentHtml(); * @@ -9107,7 +9672,7 @@ var ConvertibleCell = tui.util.defineClass(TextCell,/**@lends module:painter/cel * 컬럼모델의 defaultValue, beforeText, afterText 를 적용한 content html 마크업 스트링 을 반환한다. * (상태에 따라 Text나 Base의 함수를 선택해서 사용해야 하기 때문에, 추가로 override 해서 prototype을 이용해 실행) * @param {object} cellData Model의 셀 데이터 - * @return {string} 컬럼모델의 defaultValue, beforeText, afterText 를 적용한 content html 마크업 스트링 + * @returns {string} 컬럼모델의 defaultValue, beforeText, afterText 를 적용한 content html 마크업 스트링 * @private * @override */ @@ -9126,12 +9691,13 @@ var ConvertibleCell = tui.util.defineClass(TextCell,/**@lends module:painter/cel /** * 현재 편집중인 셀인지 여부를 반환한다. * @param {object} cellData Model의 셀 데이터 - * @return {boolean} - 편집중이면 true, 아니면 false + * @returns {boolean} - 편집중이면 true, 아니면 false * @private */ _isEditingCell: function(cellData) { var editingCell = this.editingCell; - return !!(editingCell.rowKey === cellData.rowKey.toString() && editingCell.columnName === cellData.columnName.toString()); + return (editingCell.rowKey === cellData.rowKey.toString() && + editingCell.columnName === cellData.columnName.toString()); }, /** @@ -9155,6 +9721,7 @@ var ConvertibleCell = tui.util.defineClass(TextCell,/**@lends module:painter/cel this._onBlur(blurEvent); this._endEdit($td); + this._validateData(this.getRowKey($td), this.getColumnName($td)); _.defer(function() { focusModel.refreshState(); @@ -9167,15 +9734,16 @@ var ConvertibleCell = tui.util.defineClass(TextCell,/**@lends module:painter/cel * @private */ _startEdit: function($td) { - var $input, rowKey, columnName, cellState; + var dataModel = this.grid.dataModel, + $input, rowKey, columnName, cellState; this._blurEditingCell(); rowKey = this.getRowKey($td); columnName = this.getColumnName($td); - cellState = this.grid.dataModel.get(rowKey).getCellState(columnName); + cellState = dataModel.get(rowKey).getCellState(columnName); - if (cellState.isEditable && !cellState.isDisabled) { + if (cellState.isEditable && !dataModel.isDisabled && !cellState.isDisabled) { this.editingCell = { rowKey: rowKey, columnName: columnName @@ -9267,11 +9835,11 @@ var TextCell = require('./text'); /** * Password 타입의 cell renderer * @module painter/cell/text-password + * @extends module:painter/cell/text */ var PasswordCell = tui.util.defineClass(TextCell,/**@lends module:painter/cell/text-password.prototype */{ /** * @construct - * @extends module:painter/cell/text * @param {object} attributes Attributes * @param {object} options Options */ @@ -9281,7 +9849,7 @@ var PasswordCell = tui.util.defineClass(TextCell,/**@lends module:painter/cell/t /** * input type 을 반환한다. - * @return {string} input 타입 + * @returns {string} input 타입 * @private */ _getInputType: function() { @@ -9290,7 +9858,7 @@ var PasswordCell = tui.util.defineClass(TextCell,/**@lends module:painter/cell/t /** * 자기 자신의 인스턴스의 editType 을 반환한다. - * @return {String} editType 'normal|button|select|button|text|text-password|text-convertible' + * @returns {String} editType 'normal|button|select|button|text|text-password|text-convertible' */ getEditType: function() { return 'text-password'; @@ -9313,11 +9881,11 @@ var formUtil = require('../../common/formUtil'); /** * Painter class for the text cell * @module painter/cell/text + * @extends module:painter/cell */ var TextCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/text.prototype */{ /** * @constructs - * @extends module:painter/cell * @param {object} attributes Attributes * @param {object} options Options */ @@ -9353,7 +9921,7 @@ var TextCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/text.prot /** * Content markup template - * @return {string} html + * @returns {string} html */ contentTemplate: _.template( ' 안에 들아갈 html string 을 반환한다. * redrawAttributes 에 해당하는 프로퍼티가 변경되었을 때 수행될 로직을 구현한다. * @param {object} cellData 모델의 셀 데이터 - * @return {string} html 마크업 문자열 + * @returns {string} html 마크업 문자열 * @example * var html = this.getContentHtml(); * ':"radio"===e?i.title="선택":i.isHidden=!0,this._extendColumnList(i,t)},_extendColumnList:function(t,e){var i=t.columnName,n=_.findIndex(e,{columnName:i});-1===n?e.push(t):e[n]=$.extend(e[n],t)},at:function(t,e){var i=e?this.getVisibleColumnModelList():this.get("dataColumnModelList");return i[t]},indexOfColumnName:function(t,e){var i;return i=e?this.getVisibleColumnModelList():this.get("dataColumnModelList"),_.findIndex(i,{columnName:t})},isLside:function(t){var e=this.indexOfColumnName(t,!0);return e>-1&&e=e?!1:void(t.isHidden&&(i-=1))}),t?i+this.getVisibleMetaColumnCount():i},getColumnModel:function(t){return this.get("columnModelMap")[t]},isTextType:function(t){return!!this.textType[this.getEditType(t)]},getEditType:function(t){var e=this.getColumnModel(t),i="normal";return"_button"===t||"_number"===t?i=t:e&&e.editOption&&e.editOption.type&&(i=e.editOption.type),i},_makeVisibleColumnModelList:function(t,e){return t=t||this.get("metaColumnModelList"),e=e||this.get("dataColumnModelList"),_.filter(t.concat(e),function(t){return!t.isHidden})},_getRelationListMap:function(t){var e,i={};return _.each(t,function(t){e=t.columnName,t.relationList&&(i[e]=t.relationList)}),i},getIgnoredColumnNameList:function(){var t=this.get("dataColumnModelList"),e=[];return _.each(t,function(t){t.isIgnore&&e.push(t.columnName)}),e},_setColumnModelList:function(t,e){var i,n,o,s,a;t=$.extend(!0,[],t),tui.util.isUndefined(e)&&(e=this.get("columnFixCount")),i=_.partition(t,function(t){return this.isMetaColumn(t.columnName)},this),s=this._initializeMetaColumns(i[0]),a=i[1],n=this._getRelationListMap(a),o=this._makeVisibleColumnModelList(s,a),this.set({metaColumnModelList:s,dataColumnModelList:a,columnModelMap:_.indexBy(s.concat(a),"columnName"),relationListMap:n,columnFixCount:Math.max(0,e),visibleList:o},{silent:!0}),this.unset("columnModelList",{silent:!0}),this.trigger("columnModelChange")},_onChange:function(t){var e=t.changed,i=e.columnFixCount,n=e.columnModelList;n||(n=this.get("dataColumnModelList")),this._setColumnModelList(n,i)},setHidden:function(t,e){for(var i,n,o,s;t.length;)i=t.shift(),o=this.getColumnModel(i),o?o.isHidden=e:(n=this.getUnitColumnNamesIfMerged(i),t.push.apply(t,n));s=this._makeVisibleColumnModelList(this.get("metaColumnModelList"),this.get("dataColumnModelList")),this.set("visibleList",s,{silent:!0}),this.trigger("columnModelChange")},getUnitColumnNamesIfMerged:function(t){var e,i,n,o=this.get("columnMerge"),s=[],a=[];for(s.push(t);s.length;)e=s.shift(),i=this.getColumnModel(e),i?a.push(e):(n=_.findWhere(o,{columnName:e}),n&&s.push.apply(s,n.columnNameList));return _.uniq(a)},isMetaColumn:function(t){return _.indexOf(o,t)>=0}});e.exports=s},{"../../base/model":5}],14:[function(t,e,i){"use strict";var n=(t("../../base/model"),t("../../common/util"),tui.util.defineClass({init:function(t){this.data=t},getRowSpanData:function(t,e,i){var n=null;return i&&(n=this.data.rowSpanData,t&&n&&(n=n[t])),!n&&t&&(n={count:0,isMainRow:!0,mainRowKey:e}),n},getRowState:function(){var t={isDisabledCheck:!1,isDisabled:!1,isChecked:!1};switch(this.data.rowState){case"DISABLED":t.isDisabled=!0;case"DISABLED_CHECK":t.isDisabledCheck=!0;break;case"CHECKED":t.isChecked=!0}return t},setRowState:function(t){this.data.rowState=t},setRowSpanData:function(t,e){var i=_.assign({},this.data.rowSpanData);t&&(e?i[t]=e:i[t]&&delete i[t],this.data.rowSpanData=i)},addCellClassName:function(t,e){var i,n;i=this.data.className||{},i.column=i.column||{},n=i.column[t]||[],_.contains(n,e)||(n.push(e),i.column[t]=n,this.data.className=i)},addClassName:function(t){var e,i;e=this.data.className||{},i=e.row||[],-1===tui.util.inArray(t,i)&&(i.push(t),e.row=i,this.data.className=e)},getClassNameList:function(t){var e=this.data.className,i=Array.prototype.push,n=[];return e&&(e.row&&i.apply(n,e.row),t&&e.column&&e.column[t]&&i.apply(n,e.column[t])),n},_removeClassNameFromArray:function(t,e){var i=t.join(" ").split(" ");return _.without(i,e)},removeCellClassName:function(t,e){var i=this.data.className;tui.util.pick(i,"column",t)&&(i.column[t]=this._removeClassNameFromArray(i.column[t],e),this.data.className=i)},removeClassName:function(t){var e=this.data.className;e&&e.row&&(e.row=this._removeClassNameFromArray(e.row,t),this.className=e)}}));e.exports=n},{"../../base/model":5,"../../common/util":10}],15:[function(t,e,i){"use strict";var n=t("../../base/model"),o=t("./extraDataManager"),s=t("../../common/util"),a=["_button","_number","_extraData"],l=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.extraDataManager=new o(this.get("_extraData")),this.columnModel=this.collection.columnModel,this.on("change",this._onChange,this)},idAttribute:"rowKey",parse:function(t){return t._extraData||(t._extraData={}),t},_triggerExtraDataChangeEvent:function(){this.trigger("extraDataChanged",this.get("_extraData"))},_onChange:function(){var t=_.omit(this.changed,a);this.isDuplicatedPublicChanged(t)||_.each(t,function(t,e){var i=this.columnModel.getColumnModel(e);i&&this._executeChangeBeforeCallback(e)&&(this.collection.syncRowSpannedData(this,e,t),this._executeChangeAfterCallback(e),this.getRowState().isDisabledCheck||i.isIgnore||this.set("_button",!0))},this)},_createChangeCallbackEvent:function(t){return{rowKey:this.get("rowKey"),columnName:t,value:this.get(t),instance:tui.Grid.getInstanceById(this.collection.gridId)}},_executeChangeBeforeCallback:function(t){var e,i,n=this.columnModel.getColumnModel(t);return n.editOption&&n.editOption.changeBeforeCallback&&(e=this._createChangeCallbackEvent(t),n.editOption.changeBeforeCallback(e)===!1)?(i={},i[t]=this.previous(t),this.set(i),this.trigger("restore",{changed:i}),!1):!0},_executeChangeAfterCallback:function(t){var e,i=this.columnModel.getColumnModel(t);return i.editOption&&i.editOption.changeAfterCallback?(e=this._createChangeCallbackEvent(t),!!i.editOption.changeAfterCallback(e)):!0},getPrivateProperties:function(){return a},getRowState:function(){return this.extraDataManager.getRowState()},getClassNameList:function(t){var e=this.columnModel.getColumnModel(t),i=this.extraDataManager.getClassNameList(t);return e.className&&i.push(e.className),e.isEllipsis&&i.push("ellipsis"),this._makeUniqueStringArray(i)},_makeUniqueStringArray:function(t){var e=_.uniq(t.join(" ").split(" "));return _.without(e,"")},getCellState:function(t){var e,i,n=["_number","normal"],o=this.columnModel,s=!1,a=!0,l=o.getEditType(t);return i=this.getRelationResult(["isDisabled","isEditable"])[t],e=this.getRowState(),s="_button"===t?e.isDisabledCheck:e.isDisabled,s=s||!(!i||!i.isDisabled),a=-1!==$.inArray(l,n)?!1:!(i&&i.isEditable===!1),{isEditable:a,isDisabled:s}},isEditable:function(t){var e=["_number","normal"],i=this.columnModel.getEditType(t),n=!1;return-1===$.inArray(i,e)&&(n=this.getCellState(t).isEditable),n},isDisabled:function(t){var e;return e=this.getCellState(t),e.isDisabled},getRowSpanData:function(t){var e=this.collection.isRowSpanEnable(),i=this.get("rowKey");return this.extraDataManager.getRowSpanData(t,i,e)},setRowSpanData:function(t,e){this.extraDataManager.setRowSpanData(t,e),this._triggerExtraDataChangeEvent()},setRowState:function(t,e){this.extraDataManager.setRowState(t),e||this._triggerExtraDataChangeEvent()},addCellClassName:function(t,e){this.extraDataManager.addCellClassName(t,e),this._triggerExtraDataChangeEvent()},addClassName:function(t){this.extraDataManager.addClassName(t),this._triggerExtraDataChangeEvent()},removeCellClassName:function(t,e){this.extraDataManager.removeCellClassName(t,e),this._triggerExtraDataChangeEvent()},removeClassName:function(t){this.extraDataManager.removeClassName(t),this._triggerExtraDataChangeEvent()},getHTMLEncodedString:function(t){var e=this.columnModel.getColumnModel(t),i=this.columnModel.isTextType(t),n=this.get(t),o=e.notUseHtmlEntity;return!o&&i&&tui.util.hasEncodableString(n)&&(n=tui.util.encodeHTMLEntity(n)),n},_getListTypeVisibleText:function(t){var e,i,n,o,a=this.get(t),l=this.columnModel.getColumnModel(t);return tui.util.isExisty(tui.util.pick(l,"editOption","list"))?(e=this.getRelationResult(["optionListChange"])[t],i=e&&e.optionList?e.optionList:l.editOption.list,n=typeof i[0].value,o=a.toString().split(","),n!==typeof o[0]&&(o=_.map(o,function(t){return s.convertValueType(t,n)})),_.each(o,function(t,e){var n=_.findWhere(i,{value:t});o[e]=n&&n.text||""},this),o.join(",")):void 0},isDuplicatedPublicChanged:function(t){return this._timeoutIdForChanged&&_.isEqual(this._lastPublicChanged,t)?!0:(clearTimeout(this._timeoutIdForChanged),this._timeoutIdForChanged=setTimeout(_.bind(function(){this._timeoutIdForChanged=null},this),10),this._lastPublicChanged=t,!1)},getVisibleText:function(t){var e,i,n=this.columnModel,o=this.get(t),a={select:!0,radio:!0,checkbox:!0};if(n)if(e=n.getEditType(t),i=n.getColumnModel(t),a[e]){if(!tui.util.isExisty(tui.util.pick(i,"editOption","list",0,"value")))throw this.error('Check "'+t+"\"'s editOption.list property out in your ColumnModel.");o=this._getListTypeVisibleText(t)}else _.isFunction(i.formatter)&&(o=s.stripTags(i.formatter(this.getHTMLEncodedString(t),this.toJSON(),i)));return o=tui.util.isUndefined(o)?o:o.toString()},getRelationResult:function(t){var e,i,n,o,s=this.attributes,a=this.columnModel.get("relationListMap"),l={},r=this.getRowState();return t=t&&t.length?t:["optionListChange","isDisabled","isEditable"],_.each(a,function(a,u){o=s[u],_.each(a,function(a){n=a.columnList,_.each(t,function(t){r.isDisabled&&"isDisabled"===t||(e=a[t],"function"==typeof e&&(i="","optionListChange"===t?i="optionList":"isDisabled"===t?i="isDisabled":"isEditable"===t&&(i="isEditable"),i&&_.each(n,function(t){l[t]=l[t]||{},l[t][i]=e(o,s)},this)))},this)},this)},this),l}},{privateProperties:a});e.exports=l},{"../../base/model":5,"../../common/util":10,"./extraDataManager":14}],16:[function(t,e,i){"use strict";var n=t("../../base/collection"),o=t("./row"),s=n.extend({model:o,initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({columnModel:e.columnModel,domState:e.domState,gridId:e.gridId,lastRowKey:-1,originalRowList:[],originalRowMap:{},startIndex:e.startIndex||1,sortOptions:{columnName:"rowKey",isAscending:!0,useClient:_.isBoolean(e.useClientSort)?e.useClientSort:!0}}),this.sortOptions.useClient||(this.comparator=null); -},parse:function(t){return t=t&&t.contents||t,this._formatData(t)},_formatData:function(t){var e=_.filter(t,_.isObject);return _.each(e,function(t,i){e[i]=this._baseFormat(e[i]),this.isRowSpanEnable()&&this._setExtraRowSpanData(e,i)},this),e},_baseFormat:function(t){var e={rowSpan:null,rowSpanData:null,rowState:null},i=this.columnModel.get("keyColumnName"),n=null===i?this._createRowKey():t[i];return t._extraData=$.extend(e,t._extraData),t._button="CHECKED"===t._extraData.rowState,t.rowKey=n,t},_createRowKey:function(){return this.lastRowKey+=1,this.lastRowKey},_setExtraRowSpanData:function(t,e){function i(t,e){var i=t._extraData;return!(!i.rowSpanData||!i.rowSpanData[e])}function n(t,e,i){var n=t._extraData;return n.rowSpanData=n&&n.rowSpanData||{},n.rowSpanData[e]=i,n}var o,s,a,l=t[e],r=l&&l._extraData&&l._extraData.rowSpan,u=l&&l.rowKey;return r&&_.each(r,function(r,d){if(!i(l,d))for(n(l,d,{count:r,isMainRow:!0,mainRowKey:u}),o=-1,a=e+1;e+r>a;a+=1)s=t[a],s[d]=l[d],s._extraData=s._extraData||{},n(s,d,{count:o,isMainRow:!1,mainRowKey:u}),o-=1}),t},setOriginalRowList:function(t){return this.originalRowList=t?this._formatData(t):this.toJSON(),this.originalRowMap=_.indexBy(this.originalRowList,"rowKey"),this.originalRowList},getOriginalRowList:function(t){return t=void 0===t?!0:t,t?_.clone(this.originalRowList):this.originalRowList},getOriginalRow:function(t){return _.clone(this.originalRowMap[t])},getOriginal:function(t,e){return _.clone(this.originalRowMap[t][e])},getMainRowKey:function(t,e){var i,n=this.get(t);return this.isRowSpanEnable()&&(i=n&&n.getRowSpanData(e),t=i?i.mainRowKey:t),t},indexOfRowKey:function(t){return this.indexOf(this.get(t))},isRowSpanEnable:function(){return!this.isSortedByField()},isSortedByField:function(){return"rowKey"!==this.sortOptions.columnName},setSortOptionValues:function(t,e,i){var n=this.sortOptions,o=!1;_.isUndefined(t)&&(t="rowKey"),_.isUndefined(e)&&(e=!0),(n.columnName!==t||n.isAscending!==e)&&(o=!0),n.columnName=t,n.isAscending=e,o&&this.trigger("sortChanged",{columnName:t,isAscending:e,isRequireFetch:i})},sortByField:function(t,e){var i=this.sortOptions;_.isUndefined(e)&&(e=i.columnName===t?!i.isAscending:!0),this.setSortOptionValues(t,e,!i.useClient),i.useClient&&this.sort()},getRowList:function(t,e){var i,n;return t?(n=this.where({_button:!0}),i=[],_.each(n,function(t){i.push(t.attributes)},this)):i=this.toJSON(),e?i:this._removePrivateProp(i)},syncRowSpannedData:function(t,e,i){var n,o,s;if(this.isRowSpanEnable())if(o=t.getRowSpanData(e),o.isMainRow)for(n=this.indexOfRowKey(t.get("rowKey")),s=0;so?a=-1:o>s&&(a=1),n||(a=-a),a},_removePrivateProp:function(t){return _.map(t,function(t){return _.omit(t,o.privateProperties)})},removeRow:function(t,e){var i,n,o,s=this.get(t);s&&(e&&e.keepRowSpanData&&(o=_.clone(s.attributes)),i=_.clone(s.getRowSpanData()),n=this.at(this.indexOf(s)+1),this.remove(s,{silent:!0}),this._syncRowSpanDataForRemove(i,n,o),e&&e.removeOriginalData&&this.setOriginalRowList(),this.trigger("remove"))},_syncRowSpanDataForRemove:function(t,e,i){t&&_.each(t,function(t,n){var o,s,a,l={};if(t.isMainRow){if(1===t.count)return;o=e,a=t.count-1,s=1,a>1&&(l.mainRowKey=o.get("rowKey"),l.isMainRow=!0),o.set(n,i?i[n]:"",{silent:!0})}else o=this.get(t.mainRowKey),a=o.getRowSpanData(n).count-1,s=-t.count;a>1?(l.count=a,o.setRowSpanData(n,l),this._updateSubRowSpanData(o,n,s,a)):o.setRowSpanData(n,null)},this)},_createDummyRow:function(){var t=this.columnModel.get("dataColumnModelList"),e={};return _.each(t,function(t){e[t.columnName]=""},this),e},append:function(t,e){var i,n=this._createModelList(t);return e=_.extend({at:this.length},e),i={at:e.at,add:!0,silent:!0},this.add(n,i),this._syncRowSpanDataForAppend(e.at,n.length,e.extendPrevRowSpan),this.trigger("add",n,i),n},prepend:function(t){return this.append(t,{at:0})},getRowData:function(t,e){var i=this.get(t),n=i?i.toJSON():null;return e?$.toJSON(n):n},getRowDataAt:function(t,e){var i=this.at(t),n=i?i.toJSON():null;return e?$.toJSON(i):n},getValue:function(t,e,i){var n,o;return i?n=this.getOriginal(t,e):(o=this.get(t),n=o&&o.get(e)),n},setValue:function(t,e,i,n){var o,s=this.get(t),a={};return i=_.isString(i)?$.trim(i):i,s?(a[e]=i,s.set(a,{silent:n}),o=!0):o=!1,o},getColumnValues:function(t,e){var i=this.pluck(t);return e?$.toJSON(i):i},setColumnValues:function(t,e,i,n){var o={},s={isDisabled:!1,isEditable:!0};o[t]=e,i=void 0===i?!0:i,this.forEach(function(e){i&&(s=e.getCellState(t)),!s.isDisabled&&s.isEditable&&e.set(o,{silent:n})},this)},getRowSpanData:function(t,e){var i=this.get(t);return i?i.getRowSpanData(e):null},isChanged:function(){var t=_.values(this.getModifiedRowList());return _.some(t,function(t){return t.length>0})},enableRow:function(t){this.get(t).setRowState("")},disableRow:function(t){this.get(t).setRowState("DISABLED")},enableCheck:function(t){this.get(t).setRowState("")},disableCheck:function(t){this.get(t).setRowState("DISABLED_CHECK")},check:function(t,e){var i=this.get(t).getRowState().isDisabledCheck,n=this.columnModel.get("selectType");!i&&n&&("radio"===n&&this.uncheckAll(),this.setValue(t,"_button",!0,e))},uncheck:function(t,e){this.setValue(t,"_button",!1,e)},checkAll:function(){this.setColumnValues("_button",!0)},uncheckAll:function(){this.setColumnValues("_button",!1)},_createModelList:function(t){var e,i=[];return t=t||this._createDummyRow(),_.isArray(t)||(t=[t]),e=this._formatData(t),_.each(e,function(t){var e;t._button=!0,e=new o(t,{collection:this,parse:!0}),i.push(e)},this),i},_syncRowSpanDataForAppend:function(t,e,i){var n=this.at(t-1);n&&_.each(n.getRowSpanData(),function(t,o){var s,a,l,r;0!==t.count&&(t.isMainRow?(s=n,a=t,l=1):(s=this.get(t.mainRowKey),a=s.getRowSpanData()[o],l=-t.count+1),(a.count>l||i)&&(a.count+=e,r=a.count,this._updateSubRowSpanData(s,o,l,r)))},this)},_updateSubRowSpanData:function(t,e,i,n){var o,s,a=this.indexOf(t),l=t.get("rowKey");for(s=i;n>s;s+=1)o=this.at(a+s),o.set(e,t.get(e),{silent:!0}),o.setRowSpanData(e,{count:-s,mainRowKey:l,isMainRow:!1})},_isModifiedRow:function(t,e,i){var n=_.omit(t,i),o=_.some(n,function(t,i){return"object"==typeof t?$.toJSON(t)!==$.toJSON(e[i]):t!==e[i]},this);return o},getModifiedRowList:function(t){var e=t&&t.isRaw,i=t&&t.isOnlyChecked,n=t&&t.isOnlyRowKeyList,o=e?this.originalRowList:this._removePrivateProp(this.originalRowList),s=e?this.toJSON():this._removePrivateProp(this.toJSON()),a=t&&t.filteringColumnList,l={createList:[],updateList:[],deleteList:[]};return o=_.indexBy(o,"rowKey"),s=_.indexBy(s,"rowKey"),a=_.union(a,this.columnModel.getIgnoredColumnNameList()),_.each(s,function(t,e){var s=o[e],r=n?t.rowKey:t;(!i||i&&this.get(e).get("_button"))&&(s?this._isModifiedRow(t,s,a)&&l.updateList.push(r):l.createList.push(r))},this),_.each(o,function(t,e){var i=n?t.rowKey:t;s[e]||l.deleteList.push(i)},this),l},_resetData:function(t,e,i){this.lastRowKey=-1,this.reset(t,{parse:e}),_.isFunction(i)&&i()},replaceRowList:function(t,e,i){_.isUndefined(e)&&(e=!0),this.trigger("beforeReset"),t&&t.length>500?_.defer(_.bind(this._resetData,this,t,e,i)):this._resetData(t,e,i)},setRowList:function(t,e,i){var n=_.bind(function(){this.setOriginalRowList(),_.isFunction(i)&&i()},this);this.replaceRowList(t,e,n)},restore:function(){var t=this.getOriginalRowList();this.replaceRowList(t,!0)},del:function(t,e,i){var n=this.getMainRowKey(t,e),o=this.get(n).getCellState(e),s=this.columnModel.getEditType(e),a=_.contains(["text","text-convertible","text-password"],s);a&&o.isEditable&&!o.isDisabled&&(this.setValue(n,e,"",i),i&&this.check(n,i))},paste:function(t,e){var i=this._getEndIndexToPaste(t,e);_.each(t,function(t,n){this._setValueForPaste(t,e.row+n,e.column,i.column)},this),this.trigger("paste",{startIdx:e,endIdx:i})},_getEndIndexToPaste:function(t,e){var i=this.columnModel.getVisibleColumnModelList(),n=t.length+e.row-1,o=Math.min(t[0].length+e.column,i.length)-1;return{row:n,column:o}},_setValueForPaste:function(t,e,i,n){var o,s,a,l,r=this.at(e),u=this.columnModel,d={};for(r||(r=this.append({})[0]),o=i;n>=o;o+=1)s=u.at(o,!0).columnName,a=r.getCellState(s),l=r.getRowSpanData(s),a.isEditable&&!a.isDisabled&&(!l||l.count>=0)&&(d[s]=t[o-i]);r.set(d)},getElement:function(t,e){var t=this.getMainRowKey(t,e);return this.domState.getElement(t,e)}});e.exports=s},{"../../base/collection":3,"./row":15}],17:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=1,a=1,l=n.extend({initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this._columnWidthFixedFlags=null,this._minColumnWidthList=null,this.columnModel=e.columnModel,this.dataModel=e.dataModel,this.domState=e.domState,this.listenTo(this.columnModel,"columnModelChange",this._initColumnWidthVariables),this.listenTo(this.dataModel,"add remove reset",this._resetTotalRowHeight),this.on("change:width",this._onWidthChange,this),this.on("change:displayRowCount",this._setBodyHeight,this),this._initColumnWidthVariables(),this._setBodyHeight()},models:null,columnModel:null,defaults:{offsetLeft:0,offsetTop:0,width:0,headerHeight:0,bodyHeight:0,toolbarHeight:65,rowHeight:0,totalRowHeight:0,rsideWidth:0,lsideWidth:0,columnWidthList:[],minimumColumnWidth:0,displayRowCount:1,scrollBarSize:17,scrollX:!0,scrollY:!0},_getAvailableTotalWidth:function(t){var e=this.get("width"),i=e-this.getScrollYWidth()-t-1;return this.columnModel.getVisibleColumnFixCount(!0)>0&&(i-=a),i},_applyMinimumColumnWidth:function(t){var e=this._minColumnWidthList,i=_.clone(t);return _.each(i,function(t,n){var o=e[n];o>t&&(i[n]=o)}),i},_resetTotalRowHeight:function(){var t=this.get("rowHeight"),e=this.dataModel.length,i=e+1;this.set("totalRowHeight",t*e+i)},_fillEmptyColumnWidth:function(t){var e=this._getAvailableTotalWidth(t.length),i=e-o.sum(t),n=[];return _.each(t,function(t,e){t||n.push(e)}),this._distributeExtraWidthEqually(t,i,n)},_addExtraColumnWidth:function(t,e){var i=this._columnWidthFixedFlags,n=[];return _.each(i,function(t,e){t||n.push(e)}),this._distributeExtraWidthEqually(t,e,n)},_reduceExcessColumnWidth:function(t,e){var i=this._minColumnWidthList,n=this._columnWidthFixedFlags,o=[];return _.each(t,function(t,e){n[e]||o.push({index:e,width:t-i[e]})}),this._reduceExcessColumnWidthSub(_.clone(t),e,o)},_reduceExcessColumnWidthSub:function(t,e,i){var n,o=Math.round(e/i.length),s=[];return _.each(i,function(i){i.widths.length?this._reduceExcessColumnWidthSub(t,e,s):(n=_.pluck(i,"index"),this._distributeExtraWidthEqually(t,e,n))},_distributeExtraWidthEqually:function(t,e,i){var n=i.length,o=Math.round(e/n),s=o*n-e,a=_.clone(t);return _.each(i,function(t){a[t]+=o}),a[_.last(i)]-=s,a},_adjustColumnWidthList:function(t,e){var i,n=t.length,s=this._getAvailableTotalWidth(n),a=s-o.sum(t),l=_.filter(this._columnWidthFixedFlags).length;return a>0?n>l?i=this._addExtraColumnWidth(t,a):(i=_.clone(t),i[n-1]+=a):i=e&&0>a?this._reduceExcessColumnWidth(t,a):t,i},_initColumnWidthVariables:function(){var t,e=this.columnModel.getVisibleColumnModelList(null,!0),i=this.get("minimumColumnWidth"),n=[],o=[],s=[];_.each(e,function(t){var e=t.width>0?t.width:0,a=Math.max(e,i);n.push(e?a:0),s.push(a),o.push(!!t.isFixedWidth)}),this._columnWidthFixedFlags=o,this._minColumnWidthList=s,t=_.compose(this._adjustColumnWidthList,this._applyMinimumColumnWidth,this._fillEmptyColumnWidth),this._setColumnWidthVariables(t.call(this,n),!0)},getFrameWidth:function(t){var e=this.columnModel.getVisibleColumnFixCount(!0),i=this.getColumnWidthList(t),n=this._getFrameWidth(i);return tui.util.isUndefined(t)&&e>0&&(n+=1),n},_getFrameWidth:function(t){var e=0;return t.length&&(e=o.sum(t)+(t.length+1)*a),e},_setColumnWidthVariables:function(t,e){var i,n,o,s,a=this.get("width"),l=this.columnModel.getVisibleColumnFixCount(!0),r=this._getMaxLeftSideWidth();o=t.slice(0,l),s=t.slice(l),n=this._getFrameWidth(o),r&&n>r&&(o=this._adjustLeftSideWidthList(o,r),n=this._getFrameWidth(o),t=o.concat(s)),i=a-n,this.set({columnWidthList:t,rsideWidth:i,lsideWidth:n}),e&&this.set("originalWidthList",_.clone(t)),this.trigger("columnWidthChanged")},_getMinLeftSideWidth:function(){var t,e=this.get("minimumColumnWidth"),i=this.columnModel.getVisibleColumnFixCount(!0),n=0;return i&&(t=(i+1)*a,n=t+e*i),n},_getMaxLeftSideWidth:function(){var t=Math.ceil(.9*this.get("width"));return t&&(t=Math.max(t,this._getMinLeftSideWidth())),t},getCellPosition:function(t,e){var i,n,s,l,r,u,d,c,h=this.dataModel,m=this.columnModel,g=this.get("rowHeight"),f=h.get(t),p=m.getVisibleMetaColumnCount(),M=this.get("columnWidthList").slice(p),_=m.getVisibleColumnFixCount(),w=m.indexOfColumnName(e,!0);if(!f)return{};for(i=h.get(t).getRowSpanData(e),i.isMainRow||(t=i.mainRowKey,i=h.get(t).getRowSpanData(e)),s=i.count||1,n=h.indexOfRowKey(t),l=o.getHeight(n,g),d=l+o.getHeight(s,g)-a,r=c=0,w>=_&&(c=_);w>c;c+=1)r+=M[c]+a;return u=r+M[c]+a,{top:l,left:r,right:u,bottom:d}},getScrollPosition:function(t,e){var i=!this.columnModel.isLside(e),n=this.getCellPosition(t,e),o=this._getBodySize(),s=this._judgeScrollDirection(n,i,o);return this._makeScrollPosition(s,n,o)},_getBodySize:function(){var t=this.get("lsideWidth"),e=this.get("rsideWidth")-this.getScrollYWidth(),i=this.get("bodyHeight")-this.getScrollXHeight();return{height:i,rsideWidth:e,totalWidth:t+e}},_judgeScrollDirection:function(t,e,i){var n,o,s,a,l=this.renderModel,r=l.get("scrollTop"),u=l.get("scrollLeft");return n=t.topr+i.height,e?(s=t.leftu+i.rsideWidth-1):s=a=!1,{isUp:n,isDown:o,isLeft:s,isRight:a}},_makeScrollPosition:function(t,e,i){var n={};return t.isUp?n.scrollTop=e.top:t.isDown&&(n.scrollTop=e.bottom-i.height),t.isLeft?n.scrollLeft=e.left:t.isRight&&(n.scrollLeft=e.right-i.rsideWidth+s),n},getOverflowFromMousePosition:function(t,e){var i=this._rebasePositionToContainer(t,e),n=this._getBodySize();return this._judgeOverflow(i,n)},_judgeOverflow:function(t,e){var i=t.x,n=t.y,o=0,s=0;return 0>n?o=-1:n>e.height&&(o=1),0>i?s=-1:i>e.totalWidth&&(s=1),{x:s,y:o}},getIndexFromMousePosition:function(t,e,i){var n=this._rebasePositionToContainer(t,e);return{row:this._calcRowIndexFromPositionY(n.y),column:this._calcColumnIndexFromPositionX(n.x,i)}},_calcRowIndexFromPositionY:function(t){var e=t+this.renderModel.get("scrollTop"),i=Math.floor(e/(this.get("rowHeight")+a)),n=0,s=Math.max(n,this.dataModel.length-1);return o.clamp(i,n,s)},_calcColumnIndexFromPositionX:function(t,e){var i=this.getColumnWidthList(),n=this.getFrameWidth(),o=t,s=t>=this.get("lsideWidth"),a=e?0:this.columnModel.getVisibleMetaColumnCount(),l=0;return s&&(o+=this.renderModel.get("scrollLeft")),o>=n?l=i.length-1:tui.util.forEachArray(i,function(t,e){return t>=o?(l=e,!1):void(o-=t)}),Math.max(0,l-a)},_rebasePositionToContainer:function(t,e){var i=t-this.get("offsetLeft"),n=e-(this.get("offsetTop")+this.get("headerHeight")+2);return{x:i,y:n}},_adjustLeftSideWidthList:function(t,e){var i,n=t.length-1,o=this.get("minimumColumnWidth"),s=this._getFrameWidth(t),a=s-e;if(a>0)for(;n>=0&&a>0;)i=Math.max(o,t[n]-a),a-=t[n]-i,t[n]=i,n-=1;else 0>a&&(t[n]+=Math.abs(a));return t},_setBodyHeight:function(){var t=o.getHeight(this.get("displayRowCount"),this.get("rowHeight"));t+=this.getScrollXHeight(),this.set("bodyHeight",t)},getDisplayRowCount:function(){return o.getDisplayRowCount(this.get("bodyHeight")-this.getScrollXHeight(),this.get("rowHeight"))},getScrollXHeight:function(){return this.get("scrollX")?this.get("scrollBarSize"):0},getScrollYWidth:function(){return this.get("scrollY")?this.get("scrollBarSize"):0},_onWidthChange:function(){var t=this._adjustColumnWidthList(this.get("columnWidthList"),!0);this._setColumnWidthVariables(t)},setColumnWidth:function(t,e){var i,n=this.get("columnWidthList"),o=this._columnWidthFixedFlags,s=this._minColumnWidthList[t];!o[t]&&n[t]&&(n[t]=Math.max(e,s),o[t]=!0,i=this._adjustColumnWidthList(n),o[t]=!1,this._setColumnWidthVariables(i))},_calcRealBodyHeight:function(t){return t-this.get("headerHeight")-this.get("toolbarHeight")-s},_getMinBodyHeight:function(){return this.get("rowHeight")+2*a+this.getScrollXHeight()},_setHeight:function(t){this.set("bodyHeight",Math.max(this._calcRealBodyHeight(t),this._getMinBodyHeight())),this.set("displayRowCount",this.getDisplayRowCount(),{silent:!0})},setSize:function(t,e){t>0&&this.set("width",t),e>0&&this._setHeight(e),this.trigger("setSize")},getHeight:function(){return this.get("bodyHeight")+this.get("headerHeight")+this.get("toolbarHeight")},refreshLayout:function(){var t=this.domState,e=t.getOffset();this.set({offsetTop:e.top,offsetLeft:e.left,width:t.getWidth()})},restoreColumnWidth:function(t){var e=this.get("originalWidthList")[t];this.setColumnWidth(t,e)},getColumnWidthList:function(t){var e=this.columnModel.getVisibleColumnFixCount(!0),i=[];switch(t){case"l":case"L":i=this.get("columnWidthList").slice(0,e);break;case"r":case"R":i=this.get("columnWidthList").slice(e);break;default:i=this.get("columnWidthList")}return i}});e.exports=l},{"../base/model":5,"../common/util":10}],18:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=n.extend({initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this.dataModel=e.dataModel,this.columnModel=e.columnModel,this.dimensionModel=e.dimensionModel,this.renderModel=e.renderModel,this.cellFactory=e.cellFactory,this.domState=e.domState},defaults:{rowKey:null,columnName:"",prevRowKey:null,prevColumnName:""},_savePrevious:function(){return null!==this.get("rowKey")&&this.set("prevRowKey",this.get("rowKey")),this.get("columnName")&&this.set("prevColumnName",this.get("columnName")),this},_clearPrevious:function(){this.set({prevRowKey:null,prevColumnName:""})},select:function(t){return this.unselect().set("rowKey",t),"radio"===this.columnModel.get("selectType")&&this.dataModel.check(t),this.trigger("select",{rowKey:t,rowData:this.dataModel.getRowData(t)}),this},unselect:function(t){return t&&this.blur(),this.trigger("unselect",this.get("rowKey")),this.set({rowKey:null}),this},focus:function(t,e,i){return o.isBlank(t)||o.isBlank(e)||this.columnModel.isMetaColumn(e)||this.get("rowKey")===t&&this.get("columnName")===e?this:(this.blur().select(t).set("columnName",e).trigger("focus",t,e),i&&this.scrollToFocus(),this)},focusAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0);n&&o&&this.focus(n.get("rowKey"),o.columnName,i)},focusIn:function(t,e,i){this.focus(t,e,i),t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t).isEditable(e)?this.trigger("focusIn",t,e):this.focusClipboard()},focusInAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0);n&&o&&this.focusIn(n.get("rowKey"),o.columnName,i)},focusClipboard:function(){this.trigger("focusClipboard")},refreshState:function(){this.domState.hasFocusedElement()?this.has()||this.restore()||this.focusAt(0,0):this.blur()},scrollToFocus:function(){var t=this.get("rowKey"),e=this.get("columnName"),i=this.dimensionModel.getScrollPosition(t,e);tui.util.isEmpty(i)||this.renderModel.set(i)},blur:function(){return this.has()&&(this._savePrevious(),this.trigger("blur",this.get("rowKey"),this.get("columnName")),null!==this.get("rowKey")&&this.set("columnName","")),this},which:function(){return{rowKey:this.get("rowKey"),columnName:this.get("columnName")}},indexOf:function(t){var e=t?this.get("prevRowKey"):this.get("rowKey"),i=t?this.get("prevColumnName"):this.get("columnName");return{row:this.dataModel.indexOfRowKey(e),column:this.columnModel.indexOfColumnName(i,!0)}},has:function(){return this._isValidCell(this.get("rowKey"),this.get("columnName"))},restore:function(){var t=this.get("prevRowKey"),e=this.get("prevColumnName"),i=!1;return this._isValidCell(t,e)&&(this.focus(t,e),i=!0),i},_isValidCell:function(t,e){var i=!o.isBlank(t)&&!!this.dataModel.get(t),n=!o.isBlank(e)&&!!this.columnModel.getColumnModel(e);return i&&n},_findRowKey:function(t){var e,i,n=this.dataModel;return this.has()?(e=Math.max(Math.min(n.indexOfRowKey(this.get("rowKey"))+t,this.dataModel.length-1),0),i=n.at(e),i&&i.get("rowKey")):void 0},_findColumnName:function(t){var e,i=this.columnModel,n=i.getVisibleColumnModelList(),o=i.indexOfColumnName(this.get("columnName"),!0);return this.has()?(e=Math.max(Math.min(o+t,n.length-1),0),n[e]&&n[e].columnName):void 0},_getRowSpanData:function(t,e){return this.dataModel.get(t).getRowSpanData(e)},nextRowIndex:function(t){var e=this.nextRowKey(t);return this.dataModel.indexOfRowKey(e)},prevRowIndex:function(t){var e=this.prevRowKey(t);return this.dataModel.indexOfRowKey(e)},nextColumnIndex:function(){var t=this.nextColumnName();return this.columnModel.indexOfColumnName(t,!0)},prevColumnIndex:function(){var t=this.prevColumnName();return this.columnModel.indexOfColumnName(t,!0)},nextRowKey:function(t){var e,i,n=this.which(),o=n.rowKey;return t="number"==typeof t?t:1,t>1?(o=this._findRowKey(t),i=this._getRowSpanData(o,n.columnName),i.isMainRow||(o=this._findRowKey(i.count+t))):(i=this._getRowSpanData(o,n.columnName),i.isMainRow&&i.count>0?o=this._findRowKey(i.count):i.isMainRow?o=this._findRowKey(1):(e=i.count,i=this._getRowSpanData(i.mainRowKey,n.columnName),o=this._findRowKey(i.count+e))),o},prevRowKey:function(t){var e,i=this.which(),n=i.rowKey;return t="number"==typeof t?t:1,t*=-1,-1>t?(n=this._findRowKey(t),e=this._getRowSpanData(n,i.columnName),e.isMainRow||(n=this._findRowKey(e.count+t))):(e=this._getRowSpanData(n,i.columnName),n=e.isMainRow?this._findRowKey(-1):this._findRowKey(e.count-1)),n},nextColumnName:function(){return this._findColumnName(1)},prevColumnName:function(){return this._findColumnName(-1)},firstRowKey:function(){return this.dataModel.at(0).get("rowKey")},lastRowKey:function(){return this.dataModel.at(this.dataModel.length-1).get("rowKey")},firstColumnName:function(){var t=this.columnModel.getVisibleColumnModelList();return t[0].columnName},lastColumnName:function(){var t=this.columnModel.getVisibleColumnModelList(),e=t.length-1;return t[e].columnName}});e.exports=s},{"../base/model":5,"../common/util":10}],19:[function(t,e,i){"use strict";var n=t("./data/columnModel"),o=t("./data/rowList"),s=t("./toolbar"),a=t("./dimension"),l=t("./focus"),r=t("./renderer"),u=t("./renderer-smart"),d=t("./selection"),c=(t("../common/util"),t("../common/constMap").renderState,{columnFixCount:0,columnModelList:[],keyColumnName:null,selectType:"",autoNumbering:!0,headerHeight:35,rowHeight:27,displayRowCount:10,minimumColumnWidth:50,notUseSmartRendering:!1,columnMerge:[],scrollX:!0,scrollY:!0,useClientSort:!0,singleClickEdit:!1,toolbar:{hasResizeHandler:!0,hasControlPanel:!0,hasPagination:!0}}),h=tui.util.defineClass({init:function(t,e){t=$.extend(!0,{},c,t),this.gridId=t.gridId,this.columnModel=this._createColumnModel(t),this.dataModel=this._createDataModel(t,e),this.toolbarModel=this._createToolbarModel(t),this.dimensionModel=this._createDimensionModel(t,e),this.renderModel=this._createRenderModel(t),this.focusModel=this._createFocusModel(e),this.selectionModel=this._createSelectionModel(),this.dimensionModel.renderModel=this.renderModel},_createColumnModel:function(t){return new n({hasNumberColumn:t.autoNumbering,keyColumnName:t.keyColumnName,columnFixCount:t.columnFixCount,selectType:t.selectType,columnMerge:t.columnMerge,columnModelList:t.columnModelList})},_createDataModel:function(t,e){return new o([],{gridId:this.gridId,domState:e,columnModel:this.columnModel,useClientSort:t.useClientSort})},_createToolbarModel:function(t){return new s(t.toolbar)},_createDimensionModel:function(t,e){var i={headerHeight:t.headerHeight,rowHeight:t.rowHeight,scrollX:!!t.scrollX,scrollY:!!t.scrollY,minimumColumnWidth:t.minimumColumnWidth,displayRowCount:t.displayRowCount};return this.toolbarModel.isVisible()||(i.toolbarHeight=0),new a(i,{columnModel:this.columnModel,dataModel:this.dataModel,domState:e})},_createFocusModel:function(t){return new l(null,{columnModel:this.columnModel,dataModel:this.dataModel,dimensionModel:this.dimensionModel,renderModel:this.renderModel,domState:t})},_createSelectionModel:function(){return new d(null,{columnModel:this.columnModel,dataModel:this.dataModel,dimensionModel:this.dimensionModel,renderModel:this.renderModel,focusModel:this.focusModel})},_createRenderModel:function(t){var e,i,n;return e={emptyMessage:t.emptyMessage},i={columnModel:this.columnModel,dataModel:this.dataModel,dimensionModel:this.dimensionModel},new(n=t.notUseSmartRendering?r:u)(e,i)},destroy:function(){_.each(this,function(t,e){t&&tui.util.isFunction(t._destroy)&&t._destroy(),t&&tui.util.isFunction(t.stopListening)&&t.stopListening(),this[e]=null},this)}});e.exports=h},{"../common/constMap":8,"../common/util":10,"./data/columnModel":13,"./data/rowList":16,"./dimension":17,"./focus":18,"./renderer":21,"./renderer-smart":20,"./selection":24,"./toolbar":25}],20:[function(t,e,i){"use strict";var n=t("./renderer"),o=t("../common/util"),s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.on("change:scrollTop",this._onChange,this),this.listenTo(this.dimensionModel,"change:bodyHeight",this._onChange,this),this.setOwnProperties({hiddenRowCount:10,criticalPoint:3})},_onChange:function(){this._isRenderable(this.get("scrollTop"))&&this.refresh()},_setRenderingRange:function(t){var e,i=this.dimensionModel,n=this.dataModel,s=i.get("rowHeight"),a=i.getDisplayRowCount(),l=Math.max(0,Math.ceil(t/(s+1))-this.hiddenRowCount),r=Math.min(n.length-1,l+a+2*this.hiddenRowCount);n.isRowSpanEnable()&&(l+=this._getStartRowSpanMinCount(l),r+=this._getEndRowSpanMaxCount(r)),e=0===l?0:o.getHeight(l,s)-1,this.set({top:e,startIndex:l,endIndex:r})},_getStartRowSpanMinCount:function(t){var e,i=this.dataModel.at(t),n=0;return i&&(e=_.pluck(i.getRowSpanData(),"count"),e.push(0),n=_.min(e)),n},_getEndRowSpanMaxCount:function(t){var e,i=this.dataModel.at(t),n=0;return i&&(e=_.pluck(i.getRowSpanData(),"count"),e.push(0),n=_.max(e)),n},_isRenderable:function(t){var e=this.dimensionModel,i=this.dataModel,n=e.get("rowHeight"),o=e.get("bodyHeight"),s=i.length,a=Math.max(0,Math.ceil(t/(n+1))),l=Math.min(i.length-1,Math.floor((t+o)/(n+1))),r=this.get("startIndex"),u=this.get("endIndex");return 0!==r&&r+this.criticalPoint>a?!0:u!==s-1&&u-this.criticalPointi;i+=1)n=this.dataModel.at(i),n&&(o=n.get("rowKey"),h={_extraData:n.get("_extraData"),rowKey:o},m={_extraData:n.get("_extraData"),rowKey:o},_.each(r,function(t){"_number"===t?h[t]=p++:h[t]=n.get(t)}),_.each(u,function(t){"_number"===t?m[t]=p++:m[t]=n.get(t)}),d.push(h),c.push(m));for(this.get("lside").clear().reset(d,{parse:!0}),this.get("rside").clear().reset(c,{parse:!0}),e=c.length+g,i=g;e>i;i+=1)this.executeRelation(i);this.isColumnModelChanged?(this.trigger("columnModelChanged"),this.isColumnModelChanged=!1):this.trigger("rowListChanged",t),this._refreshState(),this.trigger("refresh")},_refreshState:function(){this.dataModel.length?this.set("state",s.DONE):this.set("state",s.EMPTY)},_getCollectionByColumnName:function(t){var e,i=this.get("lside");return e=i.at(0)&&i.at(0).get(t)?i:this.get("rside")},getCellData:function(t,e){var i=this._getCollectionByColumnName(e),n=i.get(t);return n?n.get(e):void 0},executeRelation:function(t){var e,i,n=this.dataModel.at(t),o=t-this.get("startIndex");i=n.getRelationResult(),_.each(i,function(t,i){e=this._getCollectionByColumnName(i).at(o),e&&e.setCell(i,t)},this)},_destroy:function(){clearTimeout(this.timeoutIdForRefresh)}});e.exports=a},{"../base/model":5,"../common/constMap":8,"./rowList":23}],22:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=n.extend({initialize:function(t,e){var i,n;i=t&&t.rowKey,n=this.collection.dataModel.get(i),n&&(this.listenTo(n,"change restore",this._onDataModelChange),this.listenTo(n,"extraDataChanged",this._setRowExtraData))},idAttribute:"rowKey",_onDataModelChange:function(t){_.each(t.changed,function(t,e){this.setCell(e,{value:t})},this)},_setRowExtraData:function(){var t,e=this.collection.dataModel,i=e.get(this.get("rowKey")),n=this.collection.columnModel.getVisibleColumnModelList(null,!0),o=i.getRowState();tui.util.isUndefined(this.collection)||_.each(n,function(n){var s,a,l=n.columnName,r=this.get(l),u=this;tui.util.isUndefined(r)||(s=i.isEditable(l),a="_button"===l?o.isDisabledCheck:o.isDisabled,e.isRowSpanEnable()&&!r.isMainRow&&(u=this.collection.get(r.mainRowKey)),u&&(t={isDisabled:a,isEditable:s,className:i.getClassNameList(l).join(" ")},u.setCell(l,t)))},this)},parse:function(t,e){return this._formatData(t,e.collection.dataModel)},_formatData:function(t,e){var i=t.rowKey,n=e.get(i),o=n.getRowState(),s=o.isDisabled;return _.each(t,function(a,l){var r,u=n.isEditable(l);"rowKey"!==l&&"_extraData"!==l&&(r=e.isRowSpanEnable()&&t._extraData&&t._extraData.rowSpanData&&t._extraData.rowSpanData[l]?t._extraData.rowSpanData[l]:{mainRowKey:i,count:0,isMainRow:!0},s="_button"===l?o.isDisabledCheck:s,t[l]={rowKey:i,columnName:l,value:a,rowSpan:r.count,isMainRow:r.isMainRow,mainRowKey:r.mainRowKey,isEditable:u,isDisabled:s,optionList:[],className:n.getClassNameList(l).join(" "),changed:[]})},this),t},setCell:function(t,e){var i,n,s,a=!1,l=[];this.get(t)&&(n=this.get("rowKey"),s=_.clone(this.get(t)),_.each(e,function(t,e){o.isEqual(s[e],t)||(a="value"===e?!0:a,s[e]=t,l.push(e))},this), -l.length&&(s.changed=l,this.set(t,s),a&&(i=this.collection.dataModel.indexOfRowKey(n),this.trigger("valueChange",i))))}});e.exports=s},{"../base/model":5,"../common/util":10}],23:[function(t,e,i){"use strict";var n=t("../base/collection"),o=t("./row"),s=n.extend({model:o,initialize:function(t,e){this.setOwnProperties({dataModel:e.dataModel,columnModel:e.columnModel})}});e.exports=s},{"../base/collection":3,"./row":22}],24:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s={cell:"cell",row:"row",column:"column"},a=n.extend({initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({dataModel:e.dataModel,columnModel:e.columnModel,dimensionModel:e.dimensionModel,focusModel:e.focusModel,renderModel:e.renderModel,inputRange:null,intervalIdForAutoScroll:null,scrollPixelScale:40,_isEnabled:!0,_selectionState:s.cell}),this.listenTo(this.dataModel,"add remove sort reset",this.end),this.listenTo(this.dataModel,"paste",this._onPasteData)},defaults:{range:null},_onPasteData:function(t){this.start(t.startIdx.row,t.startIdx.column),this.update(t.endIdx.row,t.endIdx.column)},setState:function(t){this._selectionState=s[t]||this._selectionState},getState:function(){return this._selectionState},enable:function(){this._isEnabled=!0},disable:function(){this.end(),this._isEnabled=!1},isEnabled:function(){return this._isEnabled},start:function(t,e,i){this._isEnabled&&(this.setState(i),this.inputRange={row:[t,t],column:[e,e]},this._resetRangeAttribute())},startByMousePosition:function(t,e,i){var n=this.dimensionModel.getIndexFromMousePosition(t,e);this.start(n.row,n.column,i)},update:function(t,e,i){var n;!this._isEnabled||0>t||0>e||(this.hasSelection()?this.setState(i):(n=this.focusModel.indexOf(),this.start(n.row,n.column,i)),this._updateInputRange(t,e),this._resetRangeAttribute())},_updateInputRange:function(t,e){var i=this.inputRange;i.row[1]=t,i.column[1]=e},extendColumnSelection:function(t,e,i){var n,s=this._minimumColumnRange,a=this.dimensionModel.getIndexFromMousePosition(e,i),l={row:[0,0],column:[]};t&&t.length||(t=[a.column]),this._setScrolling(e,i),s?n=o.getMinMax(t.concat(s)):(t.push(this.inputRange.column[0]),n=o.getMinMax(t)),l.column.push(n.min,n.max),this._resetRangeAttribute(l)},_setScrolling:function(t,e){var i=this.dimensionModel.getOverflowFromMousePosition(t,e);this.stopAutoScroll(),this._isAutoScrollable(i.x,i.y)&&(this.intervalIdForAutoScroll=setInterval(_.bind(this._adjustScroll,this,i.x,i.y)))},updateByMousePosition:function(t,e,i){var n=this.dimensionModel.getIndexFromMousePosition(t,e);this._setScrolling(t,e),this.update(n.row,n.column,i)},end:function(){this.inputRange=null,this.unset("range"),this.unsetMinimumColumnRange()},stopAutoScroll:function(){_.isNull(this.intervalIdForAutoScroll)||(clearInterval(this.intervalIdForAutoScroll),this.intervalIdForAutoScroll=null)},selectRow:function(t){this._isEnabled&&(this.focusModel.focusAt(t,0),this.start(t,0,s.row),this.update(t,this.columnModel.getVisibleColumnModelList().length-1))},selectColumn:function(t){this._isEnabled&&(this.focusModel.focusAt(0,t),this.start(0,t,s.column),this.update(this.dataModel.length-1,t))},selectAll:function(){this._isEnabled&&(this.start(0,0,s.cell),this.update(this.dataModel.length-1,this.columnModel.getVisibleColumnModelList().length-1))},getStartIndex:function(){var t=this.get("range");return{row:t.row[0],column:t.column[0]}},getEndIndex:function(){var t=this.get("range");return{row:t.row[1],column:t.column[1]}},hasSelection:function(){return!!this.get("range")},getValuesToString:function(){var t,e,i,n,o=this.get("range");return t=this.columnModel.getVisibleColumnModelList().slice(o.column[0],o.column[1]+1),e=this.dataModel.slice(o.row[0],o.row[1]+1),i=_.pluck(t,"columnName"),n=_.map(e,function(t){var e=_.map(i,function(e){return t.getVisibleText(e)});return e.join(" ")}),n.join("\n")},_isAutoScrollable:function(t,e){return!(0===t&&0===e)},_adjustScroll:function(t,e){var i=this.renderModel;t&&this._adjustScrollLeft(t,i.get("scrollLeft"),i.get("maxScrollLeft")),e&&this._adjustScrollTop(e,i.get("scrollTop"),i.get("maxScrollTop"))},_adjustScrollLeft:function(t,e,i){var n=e,o=this.scrollPixelScale;0>t?n=Math.max(0,e-o):t>0&&(n=Math.min(i,e+o)),this.renderModel.set("scrollLeft",n)},_adjustScrollTop:function(t,e,i){var n=e,o=this.scrollPixelScale;0>t?n=Math.max(0,e-o):t>0&&(n=Math.min(i,e+o)),this.renderModel.set("scrollTop",n)},_resetRangeAttribute:function(t){var e,i,n,o=this.dataModel;if(t=t||this.inputRange,!t)return void this.set("range",null);if(i={row:_.sortBy(t.row),column:_.sortBy(t.column)},o.isRowSpanEnable())do n=_.assign([],i.row),i=this._getRowSpannedIndex(i),e=i.row[0]!==n[0]||i.row[1]!==n[1];while(e);switch(this._setRangeMinMax(i.row,i.column),this._selectionState){case s.column:i.row=[0,o.length-1];break;case s.row:i.column=[0,this.columnModel.getVisibleColumnModelList().length-1];break;case s.cell:}this.set("range",i)},setMinimumColumnRange:function(t){this._minimumColumnRange=_.extend(t)},unsetMinimumColumnRange:function(){this._minimumColumnRange=null},_setRangeMinMax:function(t,e){t&&(t[0]=Math.max(0,t[0]),t[1]=Math.min(this.dataModel.length-1,t[1])),e&&(e[0]=Math.max(0,e[0]),e[1]=Math.min(this.columnModel.getVisibleColumnModelList().length-1,e[1]))},_concatRowSpanIndexFromStart:function(t){var e,i=t.startIndex,n=t.endIndex,o=t.columnName,s=t.startRowSpanDataMap&&t.startRowSpanDataMap[o],a=t.startIndexList,l=t.endIndexList;s&&(s.isMainRow?(e=i+s.count-1,e>n&&l.push(e)):(e=i+s.count,a.push(e)))},_concatRowSpanIndexFromEnd:function(t){var e,i,n=t.endIndex,o=t.columnName,s=t.endRowSpanDataMap&&t.endRowSpanDataMap[o],a=t.endIndexList,l=t.dataModel;s&&(s.isMainRow?(e=n+s.count-1,a.push(e)):(e=n+s.count,i=l.at(e).getRowSpanData(o),e+=i.count-1,e>n&&a.push(e)))},_getRowSpannedIndex:function(t){var e,i,n,o,s=this.columnModel.getVisibleColumnModelList().slice(t.column[0],t.column[1]+1),a=this.dataModel,l=[t.row[0]],r=[t.row[1]],u=a.at(t.row[0]),d=a.at(t.row[1]),c=$.extend({},t);return u&&d?(e=a.at(t.row[0]).getRowSpanData(),i=a.at(t.row[1]).getRowSpanData(),_.each(s,function(s){n=s.columnName,o={columnName:n,startIndex:t.row[0],endIndex:t.row[1],endRowSpanDataMap:i,startRowSpanDataMap:e,startIndexList:l,endIndexList:r,dataModel:a},this._concatRowSpanIndexFromStart(o),this._concatRowSpanIndexFromEnd(o)},this),c.row=[Math.min.apply(null,l),Math.max.apply(null,r)],c):c}});e.exports=a},{"../base/model":5,"../common/util":10}],25:[function(t,e,i){"use strict";var n=t("../base/model"),o=(t("../common/util"),n.extend({initialize:function(t){n.prototype.initialize.apply(this,arguments)},defaults:{hasControlPanel:!1,hasPagination:!1,hasResizeHandler:!1,isExcelButtonVisible:!1,isExcelAllButtonVisible:!1,pagination:null},isVisible:function(){return this.get("hasControlPanel")||this.get("hasPagination")||this.get("hasResizeHandler")}}));e.exports=o},{"../base/model":5,"../common/util":10}],26:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").keyName,a=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setOwnProperties({_keyDownSwitch:$.extend({},this._defaultKeyDownSwitch)})},redrawAttributes:["isEditable","optionList","value"],template:_.template(''+t+""},getHtml:function(t){var e,i=o.getAttributesString(this.getAttributes(t));return e=this.template({columnName:t.columnName,rowSpan:t.rowSpan,className:this._getClassNameList(t).join(" "),editType:this.getEditType(),attributeString:i,contentHtml:this._getContentHtml(t)})},redraw:function(t,e){var i={"class":this._getClassNameList(t).join(" ")};t.rowSpan&&(i.rowSpan=t.rowSpan),i["edit-type"]=this.getEditType(),i=$.extend(i,this.getAttributes(t)),e.attr(i),e.html(this._getContentHtml(t))},_getCellData:function(t){var e=this._getCellAddress(t);return this.grid.renderModel.getCellData(e.rowKey,e.columnName)},_getCellAddress:function(t){return{rowKey:this.getRowKey(t),columnName:this.getColumnName(t)}},_getConvertedHtml:function(t,e){var i,n=this.getColumnModel(e),o=n.editOption;return o&&tui.util.isFunction(o.converter)&&(i=o.converter(t,this.grid.dataModel.get(e.rowKey).attributes)),tui.util.isFalsy(i)&&(i=null),i},getColumnName:function(t){return t.closest("td").attr("columnName")},getRowKey:function(t){return t.closest("tr").attr("key")},getColumnModel:function(t){return this.grid.columnModel.getColumnModel(t.columnName)},getAttributes:function(t){var e=this.getColumnModel(t);return{align:e.align||"left"}},focusOut:function(){this.grid.focusModel.focusClipboard()},getEditType:function(){return"normal"},focusIn:function(t){},getContentHtml:function(t){return""},setElementAttribute:function(t,e,i){}});e.exports=a},{"../base/painter":6,"../common/constMap":8,"../common/util":10}],27:[function(t,e,i){"use strict";var n=t("./list"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setKeyDownSwitch({UP_ARROW:function(){},DOWN_ARROW:function(){},PAGE_UP:function(){},PAGE_DOWN:function(){},ENTER:function(t,e){e.$target.trigger("click")},LEFT_ARROW:function(t,e){this._focusPrevInput(e.$target)},RIGHT_ARROW:function(t,e){this._focusNextInput(e.$target)},ESC:function(t,e){this.focusOut(e.$target)},TAB:function(t,e){t.shiftKey?this._focusPrevInput(e.$target)||this.grid.focusModel.focusIn(e.rowKey,e.focusModel.prevColumnName(),!0):this._focusNextInput(e.$target)||this.grid.focusModel.focusIn(e.rowKey,e.focusModel.nextColumnName(),!0)}})},eventHandler:{"change input":"_onChange","keydown input":"_onKeyDown"},getEditType:function(){return"button"},contentTemplate:_.template(' <% if (isDisabled) print("disabled"); %>/>'),labelTemplate:_.template(''),focusIn:function(t){t.find("input").eq(0).prop("disabled")?this.grid.focusModel.focusClipboard():t.find("input").eq(0).focus()},getContentHtml:function(t){var e,i=this.getOptionList(t),n=this.grid.columnModel.getColumnModel(t.columnName),s=t.value,a=(""+s).split(","),l={},r=this._getConvertedHtml(s,t),u=o.getUniqueKey(),d=t.isDisabled,c=n.editOption.type;return _.isNull(r)&&(r="",_.each(a,function(t){l[t]=!0}),_.each(i,function(t){e=u+"_"+t.value,r+=this.contentTemplate({type:c,name:u,id:e,value:t.value,isChecked:!!l[t.value],isDisabled:d}),t.text&&(r+=this.labelTemplate({id:e,labelText:t.text}))},this)),r},setElementAttribute:function(t,e){var i=t.value,n=(""+i).split(",");e.find("input:checked").prop("checked",!1),tui.util.forEachArray(n,function(t){e.find('input[value="'+t+'"]').prop("checked",!0)})},_focusNextInput:function(t){return this._focusTargetInput(t,"next")},_focusPrevInput:function(t){return this._focusTargetInput(t,"prev")},_focusTargetInput:function(t,e){var i,n=t,o=!1;"next"===e?i=function(t){return t.next()}:"prev"===e&&(i=function(t){return t.prev()});do n=i(n);while(n.length&&!n.is("input"));return n.length&&(n.focus(),o=!0),o},_getCheckedValueList:function(t){var e=t.closest("td").find("input:checked"),i=[];return tui.util.forEachArray(e,function(t,n){i.push(e.eq(n).val())}),i},_onChange:function(t){var e=$(t.target),i=this._getCellAddress(e);this.grid.dataModel.setValue(i.rowKey,i.columnName,this._getCheckedValueList(e).join(","))}});e.exports=s},{"../../common/util":10,"./list":28}],28:[function(t,e,i){"use strict";var n=t("../cell"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},redrawAttributes:["isDisabled","isEditable","optionList"],eventHandler:{},getEditType:function(){},focusIn:function(t){},getContentHtml:function(t){throw this.error("Implement getContentHtml(cellData, $target) method. On re-rendering")},setElementAttribute:function(t,e,i){throw this.error("Implement setElementAttribute(cellData, $target) method. ")},getOptionList:function(t){var e=this.grid.columnModel.getColumnModel(t.columnName);return t.optionList&&t.optionList.length?t.optionList:e.editOption.list}});e.exports=o},{"../cell":26}],29:[function(t,e,i){"use strict";var n=t("../cell"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setKeyDownSwitch({UP_ARROW:function(){},DOWN_ARROW:function(){},ENTER:function(t,e){this.focusOut(e.$target)},LEFT_ARROW:function(){},RIGHT_ARROW:function(){},ESC:function(){}})},redrawAttributes:["isDisabled","isEditable","optionList"],eventHandler:{mousedown:"_onMouseDown","change input":"_onChange","keydown input":"_onKeyDown"},contentTemplate:_.template(' <% if (isDisabled) print("disabled") %>/>'),getEditType:function(){return"_button"},getContentHtml:function(t){var e=t.isDisabled;return this.contentTemplate({type:this.grid.columnModel.get("selectType"),name:this.grid.id,isChecked:!!t.value,isDisabled:e})},focusIn:function(){},setElementAttribute:function(t,e){var i=e.find("input"),n=i.prop("checked");n!==!!t.value&&i.prop("checked",t.value)},toggle:function(t){var e=t.find("input");"checkbox"===this.grid.columnModel.get("selectType")&&e.prop("checked",!e.prop("checked"))},getAttributes:function(){return{align:"center"}},_onChange:function(t){var e=$(t.target),i=this.getRowKey(e);this.grid.dataModel.setValue(i,"_button",e.prop("checked"))},_onMouseDown:function(t){var e=$(t.target);e.is("input")||e.find("input").trigger("click")}});e.exports=o},{"../cell":26}],30:[function(t,e,i){"use strict";var n=t("../cell"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},getEditType:function(){return"normal"},getContentHtml:function(t){var e=t.columnName,i=this.grid.columnModel.getColumnModel(e),n=this.grid.dataModel.get(t.rowKey).getHTMLEncodedString(e),o=t.rowKey;return tui.util.isFunction(i.formatter)&&(n=i.formatter(n,this.grid.dataModel.get(o).toJSON(),i)),tui.util.isExisty(n)||(n=""),n},focusIn:function(){this.grid.focusModel.focusClipboard()},setElementAttribute:function(t,e,i){}});e.exports=o},{"../cell":26}],31:[function(t,e,i){"use strict";var n=t("./normal"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},redrawAttributes:[],getEditType:function(){return"_number"},getContentHtml:function(t){return t.value}});e.exports=o},{"./normal":30}],32:[function(t,e,i){"use strict";var n=t("./list"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setKeyDownSwitch({ESC:function(t,e){this.focusOut(e.$target)},ENTER:function(t,e){this.focusOut(e.$target)}})},eventHandler:{"change select":"_onChange","keydown select":"_onKeyDown"},contentTemplate:_.template(''),optionTemplate:_.template(''),getEditType:function(){return"select"},focusIn:function(t){t.find("select").prop("disabled")?this.grid.focusModel.focusClipboard():t.find("select").eq(0).focus()},getContentHtml:function(t){var e=this.getOptionList(t),i=t.isDisabled,n=this._getConvertedHtml(t.value,t),s="";return tui.util.isNull(n)&&(_.each(e,function(e){s+=this.optionTemplate({value:e.value,cellDataValue:t.value,text:e.text})},this),n=this.contentTemplate({name:o.getUniqueKey(),isDisabled:i,options:s})),n},_getContentHtml:function(t){var e,i,n=t.columnName,o=this.grid.columnModel.getColumnModel(n),s=o.editOption||{},a="";return tui.util.isExisty(t.value)||(t.value=o.defaultValue),e=this._getExtraContent(s.beforeContent||s.beforeText,t),i=this._getExtraContent(s.afterContent||s.afterText,t),e&&(a+=this._getSpanWrapContent(e,"before",t)),i&&(a+=this._getSpanWrapContent(i,"after",t)),a+=this._getSpanWrapContent(this.getContentHtml(t),"input")},setElementAttribute:function(t,e,i){var n=e.find("select");i&&n.blur(),n.val(t.value),i&&n.focus()},_onChange:function(t){var e=$(t.target),i=this._getCellAddress(e),n=this.grid;n.dataModel.setValue(i.rowKey,i.columnName,e.val())}});e.exports=s},{"../../common/util":10,"./list":28}],33:[function(t,e,i){"use strict";var n=t("../cell"),o=t("./text"),s=t("../../common/util"),a=t("../../common/formUtil"),l=tui.util.defineClass(o,{init:function(){o.apply(this,arguments),this.setOwnProperties({timeoutIdForClick:0,editingCell:{rowKey:null,columnName:""},clicked:{rowKey:null,columnName:null}})},redrawAttributes:["isDisabled","isEditable","value"],eventHandler:{dblclick:"_onDblClick",mousedown:"_onMouseDown","blur input":"_onBlurConvertible","keydown input":"_onKeyDown","focus input":"_onFocus","selectstart input":"_onSelectStart"},contentTemplate:_.template('/>'),getEditType:function(){return"text-convertible"},focusIn:function(t){this._startEdit(t)},focusOut:function(){this.grid.focusModel.focusClipboard()},getContentHtml:function(t){var e=this.getColumnModel(t),i=this.grid.dataModel.get(t.rowKey).getHTMLEncodedString(t.columnName);return tui.util.isUndefined(i)&&(i=""),this._isEditingCell(t)?this.contentTemplate({type:this._getInputType(),value:i,name:s.getUniqueKey(),isDisabled:t.isDisabled,maxLength:e.editOption.maxLength}):(tui.util.isFunction(e.formatter)&&(i=e.formatter(i,this.grid.dataModel.get(t.rowKey).attributes,e)),i)},_getContentHtml:function(t){var e;return e=this._isEditingCell(t)?o.prototype:n.prototype,e._getContentHtml.call(this,t)},_isEditingCell:function(t){var e=this.editingCell;return!(e.rowKey!==t.rowKey.toString()||e.columnName!==t.columnName.toString())},setElementAttribute:function(t,e,i){},_onBlurConvertible:function(t){var e=$(t.target),i=e.closest("td"),n=this.grid.focusModel;this._onBlur(t),this._endEdit(i),_.defer(function(){n.refreshState()})},_startEdit:function(t){var e,i,n,o;this._blurEditingCell(),i=this.getRowKey(t),n=this.getColumnName(t),o=this.grid.dataModel.get(i).getCellState(n),o.isEditable&&!o.isDisabled&&(this.editingCell={rowKey:i,columnName:n},this.redraw(this._getCellData(t),t),e=t.find("input"),this.originalText=e.val(),a.setCursorToEnd(e.get(0)),e.select())},_endEdit:function(t){var e=this._getCellData(t);this.editingCell={rowKey:null,columnName:null},this.clicked={rowKey:null,columnName:null},e&&this.redraw(e,t)},_blurEditingCell:function(){var t,e=this.editingCell.rowKey,i=this.editingCell.columnName;tui.util.isNull(e)||tui.util.isNull(i)||(t=this.grid.dataModel.getElement(e,i),t.find("input")[0].blur())},_onDblClick:function(t){var e=$(t.target),i=e.closest("td"),n=this._getCellAddress(i);this._isEditingCell(n)||this._startEdit(i)},_onMouseDown:function(t){$(t.target).is("input")&&t.stopPropagation()}});e.exports=l},{"../../common/formUtil":9,"../../common/util":10,"../cell":26,"./text":35}],34:[function(t,e,i){"use strict";var n=t("./text"),o=tui.util.defineClass(n,{init:function(t,e){n.apply(this,arguments)},_getInputType:function(){return"password"},getEditType:function(){return"text-password"}});e.exports=o},{"./text":35}],35:[function(t,e,i){"use strict";var n=t("../cell"),o=t("../../common/util"),s=t("../../common/formUtil"),a=tui.util.defineClass(n,{init:function(t,e){n.apply(this,arguments),this.setOwnProperties({originalText:""}),this.setKeyDownSwitch({UP_ARROW:function(){},DOWN_ARROW:function(){},PAGE_UP:function(){},PAGE_DOWN:function(){},ENTER:function(t,e){this.focusOut(e.$target.closest("td"))},ESC:function(t,e){this._restore(e.$target),this.focusOut(e.$target.closest("td"))}})},redrawAttributes:["isEditable"],eventHandler:{"blur input":"_onBlur","keydown input":"_onKeyDown","focus input":"_onFocus","selectstart input":"_onSelectStart"},contentTemplate:_.template('/>'),_getInputType:function(){return"text"},getEditType:function(){return"text"},focusIn:function(t){var e=t.find("input");e.prop("disabled")?this.grid.focusModel.focusClipboard():(s.setCursorToEnd(e.get(0)),e.select())},focusOut:function(){this.grid.focusModel.focusClipboard()},getContentHtml:function(t){var e,i=this.getColumnModel(t),n=i.editOption,s=this.grid.dataModel.get(t.rowKey).getHTMLEncodedString(t.columnName);return tui.util.isUndefined(s)&&(s=""),e=this._getConvertedHtml(s,t),tui.util.isNull(e)&&(e=this.contentTemplate({type:this._getInputType(),value:s,name:o.getUniqueKey(),isDisabled:t.isDisabled,maxLength:n.maxLength})),e},setElementAttribute:function(t,e){var i=-1!==$.inArray("value",t.changed),n=e.find("input");i&&n.val(t.value),n.prop("disabled",t.isDisabled)},_isEdited:function(t){return t.val()!==this.originalText},_restore:function(t){t.val(this.originalText)},_getContentHtml:function(t){var e,i,n=t.columnName,o=this.grid.columnModel.getColumnModel(n),s=o.editOption||{},a="";return tui.util.isExisty(t.value)||(t.value=o.defaultValue),e=this._getExtraContent(s.beforeContent||s.beforeText,t),i=this._getExtraContent(s.afterContent||s.afterText,t),e&&(a+=this._getSpanWrapContent(e,"before",t)),i&&(a+=this._getSpanWrapContent(i,"after",t)),a+=this._getSpanWrapContent(this.getContentHtml(t),"input")},_onBlur:function(t){var e=$(t.target),i=this.getRowKey(e),n=this.getColumnName(e);this._executeInputEventHandler(t,"blur"),this._isEdited(e)&&this.grid.dataModel.setValue(i,n,e.val()),this.grid.selectionModel.enable()},_onFocus:function(t){var e=$(t.target);this.originalText=e.val(),this._executeInputEventHandler(t,"focus"),this.grid.selectionModel.end()},_onKeyDown:function(t){this._executeInputEventHandler(t,"keydown"),n.prototype._onKeyDown.call(this,t)},_getCellInfoFromInput:function(t){var e=t.closest("td"),i=e.closest("tr");return{rowKey:i.attr("key"),columnName:e.attr("columnname")}},_executeInputEventHandler:function(t,e){var i=$(t.target),n=this._getCellInfoFromInput(i),o=this.grid.columnModel.getColumnModel(n.columnName),s=tui.util.pick(o,"editOption","inputEvents",e);return _.isFunction(s)?s(t,n):null},_onSelectStart:function(t){t.stopPropagation()}});e.exports=a},{"../../common/formUtil":9,"../../common/util":10,"../cell":26}],36:[function(t,e,i){"use strict";var n=t("./cell/mainButton"),o=t("./cell/number"),s=t("./cell/normal"),a=t("./cell/button"),l=t("./cell/select"),r=t("./cell/text"),u=t("./cell/text-convertible"),d=t("./cell/text-password"),c=t("./row"),h=tui.util.defineClass({init:function(t){this.modelManager=t.modelManager,this.cellPainters=this._createCellPainters(),this.rowPainter=this._createRowPainter()},_createCellPainters:function(){var t={},e={grid:this.modelManager},i=[new n(e),new o(e),new s(e),new a(e),new l(e),new r(e),new d(e),new u(e)];return _.each(i,function(e){t[e.getEditType()]=e}),t},_createRowPainter:function(){return new c({grid:this.modelManager,painterManager:this})},getCellPainter:function(t){var e=this.cellPainters[t];return e||(e="radio"===t||"checkbox"===t?this.cellPainters.button:this.cellPainters.normal),e},getCellPainters:function(){return this.cellPainters},getRowPainter:function(){return this.rowPainter}});e.exports=h},{"./cell/button":27,"./cell/mainButton":29,"./cell/normal":30,"./cell/number":31,"./cell/select":32,"./cell/text":35,"./cell/text-convertible":33,"./cell/text-password":34,"./row":37}],37:[function(t,e,i){"use strict";var n=t("../base/painter"),o=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.painterManager=t.painterManager},template:_.template('<%=contents%>'),onModelChange:function(t,e){_.each(t.changed,function(t,i){var n,o;"_extraData"!==i&&(n=this._getEditType(i,t),o=this.painterManager.getCellPainter(n),o.onModelChange(t,e))},this)},_getEditType:function(t,e){var i=this.grid.columnModel.getEditType(t);return e.isEditable||"_number"===t||(i="normal"),i},getHtml:function(t,e){var i="";return tui.util.isUndefined(t.get("rowKey"))?i:(_.each(e,function(e){var n,o,s=e.columnName,a=t.get(s);a&&a.isMainRow&&(n=this._getEditType(s,a),o=this.painterManager.getCellPainter(n),i+=o.getHtml(a))},this),this.template({key:t.get("rowKey"),height:this.grid.dimensionModel.get("rowHeight")+o._extraHeight,contents:i,className:""}))},"static":{_extraHeight:function(){var t=0;return tui.util.browser.msie&&7===tui.util.browser.version&&(t=-2),t}()}});e.exports=o},{"../base/painter":6}],38:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){this.publicObject=t},_listenAndPass:function(t,e){_.each(e,function(e){this.listenTo(t,e,_.bind(this._triggerOnPublic,this,e))},this)},_listenAndRename:function(t,e,i){this.listenTo(t,e,_.bind(this._triggerOnPublic,this,i))},_triggerOnPublic:function(t,e){this.publicObject.trigger(t,e)},listenToNetAddon:function(t){this._listenAndPass(t,["beforeRequest","response","successResponse","failResponse","errorResponse"])},listenToContainerView:function(t){this._listenAndPass(t,["click","dblclick","mousedown","clickCell","dblclickCell","mouseoverCell","mouseoutCell","rendered"])},listenToFocusModel:function(t){this._listenAndRename(t,"select","selectRow")}});_.extend(n.prototype,Backbone.Events),e.exports=n},{}],39:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").keyCode,a=n.extend({initialize:function(t){this.setOwnProperties({focusModel:t.focusModel,selectionModel:t.selectionModel,painterManager:t.painterManager,dimensionModel:t.dimensionModel,dataModel:t.dataModel,columnModel:t.columnModel,renderModel:t.renderModel,timeoutIdForKeyIn:0,isLocked:!1}),this.listenTo(this.focusModel,"focusClipboard",this._onFocus)},tagName:"textarea",className:"clipboard",events:{keydown:"_onKeyDown",blur:"_onBlur"},_onBlur:function(){var t=this.focusModel;_.defer(function(){t.refreshState()})},_onFocus:function(){this.$el.is(":focus")||(this.$el.focus(),this.focusModel.refreshState())},render:function(){return this},_lock:function(){clearTimeout(this.timeoutIdForKeyIn),this.isLocked=!0,this.timeoutIdForKeyIn=setTimeout($.proxy(this._unlock,this),10)},_unlock:function(){this.isLocked=!1},_onKeyDown:function(t){return this.isLocked?(t.preventDefault(),!1):(t.shiftKey&&(t.ctrlKey||t.metaKey)?this._keyInWithShiftAndCtrl(t):t.shiftKey?this._keyInWithShift(t):t.ctrlKey||t.metaKey?this._keyInWithCtrl(t):this._keyIn(t),void this._lock())},_keyIn:function(t){var e=this.focusModel,i=this.selectionModel,n=e.which(),a=n.rowKey,l=n.columnName,r=this.dimensionModel.getDisplayRowCount(),u=!0,d=t.keyCode||t.which;if(!o.isBlank(n.rowKey)){switch(d){case s.UP_ARROW:e.focus(e.prevRowKey(),l,!0);break;case s.DOWN_ARROW:e.focus(e.nextRowKey(),l,!0);break;case s.LEFT_ARROW:e.focus(a,e.prevColumnName(),!0);break;case s.RIGHT_ARROW:e.focus(a,e.nextColumnName(),!0);break;case s.PAGE_UP:e.focus(e.prevRowKey(r-1),l,!0);break;case s.PAGE_DOWN:e.focus(e.nextRowKey(r-1),l,!0);break;case s.HOME:e.focus(a,e.firstColumnName(),!0);break;case s.END:e.focus(a,e.lastColumnName(),!0);break;case s.SPACE:case s.ENTER:this._onEnterSpace(a,l);break;case s.DEL:this._del(a,l);break;case s.TAB:e.focusIn(a,e.nextColumnName(),!0);break;default:u=!1}u&&t.preventDefault(),i.end()}},_onEnterSpace:function(t,e){var i,n=this.columnModel.getEditType(e);"_button"===n?(i=this.cellFactory.getInstance(n),i.toggle(this.dataModel.getElement(t,e))):this.focusModel.focusIn(t,e)},_getIndexBeforeMove:function(){var t,e,i=this.focusModel.indexOf(),n=this.selectionModel.get("range"),o=_.extend({},i);return n&&(t=n.row,e=n.column,o.row=t[0],o.column=e[0],t[1]>i.row&&(o.row=t[1]),e[1]>i.column&&(o.column=e[1])),o},_keyInWithShift:function(t){var e,i,n,o,a=this.focusModel,l=this.dimensionModel,r=this.columnModel.getVisibleColumnModelList(),u=a.which(),d=l.getDisplayRowCount(),c=t.keyCode||t.which,h=this._getIndexBeforeMove(),m=!0,g=!0;switch(c){case s.UP_ARROW:h.row-=1;break;case s.DOWN_ARROW:h.row+=1;break;case s.LEFT_ARROW:h.column-=1;break;case s.RIGHT_ARROW:h.column+=1;break;case s.PAGE_UP:h.row=a.prevRowIndex(d-1);break;case s.PAGE_DOWN:h.row=a.nextRowIndex(d-1);break;case s.HOME:h.column=0;break;case s.END:h.column=r.length-1;break;case s.ENTER:g=!1;break;case s.TAB:g=!1,a.focusIn(u.rowKey,a.prevColumnName(),!0);break;default:g=!1,m=!1}e=r[h.column],n=!(!e||!this.dataModel.getRowData(h.row)),g&&n&&(this._updateSelectionByKeyIn(h.row,h.column),i=l.getScrollPosition(h.row,e.columnName),i&&(o=this.selectionModel.getState(),"column"===o?delete i.scrollTop:"row"===o&&delete i.scrollLeft,this.renderModel.set(i))),m&&t.preventDefault()},_keyInWithCtrl:function(t){var e=this.focusModel,i=t.keyCode||t.which;switch(i){case s.CHAR_A:this.selectionModel.selectAll();break;case s.CHAR_C:this._copyToClipboard();break;case s.HOME:e.focus(e.firstRowKey(),e.firstColumnName(),!0);break;case s.END:e.focus(e.lastRowKey(),e.lastColumnName(),!0);break;case s.CHAR_V:this._paste()}},_paste:function(){this._clearClipBoard(),this.pasting||(this.pasting=!0,this._onKeyupCharV())},_onKeyupCharV:function(){this.$el.on("keyup",$.proxy(this.onKeyupCharV,this))},onKeyupCharV:function(){this._pasteToGrid(),this.pasting=!1},_clearClipBoard:function(){this.$el.val("")},_pasteToGrid:function(){var t,e,i=this.selectionModel,n=this.focusModel,o=this.dataModel;t=i.hasSelection()?i.getStartIndex():n.indexOf(),e=this._getProcessClipBoardData(),this.$el.off("keyup"),o.paste(e,t)},_getProcessClipBoardData:function(){ -for(var t=this.$el.val(),e=t.split("\n"),i=0,n=e.length;n>i;i+=1)e[i]=e[i].split(" ");return e},_keyInWithShiftAndCtrl:function(t){var e=!0,i=this.columnModel.getVisibleColumnModelList(),n=t.keyCode||t.which;switch(n){case s.HOME:this._updateSelectionByKeyIn(0,0);break;case s.END:this._updateSelectionByKeyIn(this.dataModel.length-1,i.length-1);break;default:e=!1}e&&t.preventDefault()},_del:function(){var t,e,i,n=this.selectionModel,o=this.dataModel,s=this.focusModel.which(),a=this.columnModel.getVisibleColumnModelList(),l=s.rowKey,r=s.columnName;if(n.hasSelection()){for(t=n.get("range"),e=t.row[0];e").addClass("left_line"),$("
").addClass("right_line")]);this.$el.addClass("grid_wrapper uio_grid").attr("instanceId",this.gridId).append(t),this._refreshHeight(),this.trigger("rendered")},destroy:function(){this.stopListening(),$(window).off("resize.grid"),this._destroyChildren(),this.$el.replaceWith(this.__$el),this.$el=this.__$el=null}});e.exports=o},{"../base/view":7}],41:[function(t,e,i){"use strict";var n=t("./container"),o=t("./layout/toolbar"),s=t("./layout/toolbar/controlPanel"),a=t("./layout/toolbar/pagination"),l=t("./layout/toolbar/resizeHandler"),r=t("./stateLayer"),u=t("./clipboard"),d=t("./layout/frame-lside"),c=t("./layout/frame-rside"),h=t("./layout/header"),m=t("./layout/resizeHandler"),g=t("./layout/body"),f=t("./layout/bodyTable"),p=t("./rowList"),M=t("./selectionLayer"),_=tui.util.defineClass({init:function(t){this.modelManager=t.modelManager,this.painterManager=t.painterManager},createContainer:function(t){return new n({el:t.el,singleClickEdit:t.singleClickEdit,dataModel:this.modelManager.dataModel,dimensionModel:this.modelManager.dimensionModel,focusModel:this.modelManager.focusModel,gridId:this.modelManager.gridId,viewFactory:this})},createToolbar:function(){return new o({toolbarModel:this.modelManager.toolbarModel,dimensionModel:this.modelManager.dimensionModel,viewFactory:this})},createToolbarControlPanel:function(){return new s({gridId:this.modelManager.gridId,toolbarModel:this.modelManager.toolbarModel})},createToolbarPagination:function(){return new a({toolbarModel:this.modelManager.toolbarModel})},createToolbarResizeHandler:function(){return new l({dimensionModel:this.modelManager.dimensionModel})},createStateLayer:function(){return new r({dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel})},createClipboard:function(){return new u({columnModel:this.modelManager.columnModel,dataModel:this.modelManager.dataModel,dimensionModel:this.modelManager.dimensionModel,selectionModel:this.modelManager.selectionModel,focusModel:this.modelManager.focusModel,renderModel:this.modelManager.renderModel,painterManager:this.modelManager.painterManager})},createFrame:function(t){var e="L"===t?d:c;return new e({dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,viewFactory:this})},createHeader:function(t){return new h({whichSide:t,renderModel:this.modelManager.renderModel,dimensionModel:this.modelManager.dimensionModel,selectionModel:this.modelManager.selectionModel,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,viewFactory:this})},createHeaderResizeHandler:function(t){return new m({whichSide:t,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel})},createBody:function(t){return new g({whichSide:t,renderModel:this.modelManager.renderModel,dimensionModel:this.modelManager.dimensionModel,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,selectionModel:this.modelManager.selectionModel,focusModel:this.modelManager.focusModel,viewFactory:this})},createBodyTable:function(t){return new f({whichSide:t,dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,columnModel:this.modelManager.columnModel,painterManager:this.painterManager,viewFactory:this})},createRowList:function(t){return new p({el:t.el,whichSide:t.whichSide,bodyTableView:t.bodyTableView,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,focusModel:this.modelManager.focusModel,painterManager:this.painterManager})},createSelectionLayer:function(t){return new M({whichSide:t,selectionModel:this.modelManager.selectionModel,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel})}});e.exports=_},{"./clipboard":39,"./container":40,"./layout/body":42,"./layout/bodyTable":43,"./layout/frame-lside":44,"./layout/frame-rside":45,"./layout/header":47,"./layout/resizeHandler":48,"./layout/toolbar":49,"./layout/toolbar/controlPanel":50,"./layout/toolbar/pagination":51,"./layout/toolbar/resizeHandler":52,"./rowList":53,"./selectionLayer":54,"./stateLayer":55}],42:[function(t,e,i){"use strict";var n=t("../../base/view"),o='
',s=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({dimensionModel:t.dimensionModel,dataModel:t.dataModel,columnModel:t.columnModel,renderModel:t.renderModel,selectionModel:t.selectionModel,focusModel:t.focusModel,viewFactory:t.viewFactory,$container:null,whichSide:t&&t.whichSide||"R"}),this.listenTo(this.dimensionModel,"change:bodyHeight",this._onBodyHeightChange).listenTo(this.dataModel,"add remove reset",this._resetContainerHeight).listenTo(this.renderModel,"change:scrollTop",this._onScrollTopChange).listenTo(this.renderModel,"change:scrollLeft",this._onScrollLeftChange)},tagName:"div",className:"data",events:{scroll:"_onScroll","mousedown .body_container":"_onMouseDown","blur input, select":"_onBlurInput"},_onBodyHeightChange:function(t,e){this.$el.css("height",e+"px")},_resetContainerHeight:function(){this.$container.css({height:this.dimensionModel.get("totalRowHeight")})},_onScroll:function(t){var e={scrollTop:t.target.scrollTop};"R"===this.whichSide&&(e.scrollLeft=t.target.scrollLeft),this.renderModel.set(e)},_onScrollLeftChange:function(t,e){"R"===this.whichSide&&(this.el.scrollLeft=e)},_onScrollTopChange:function(t,e){this.el.scrollTop=e},_onMouseDown:function(t){var e,i=this.columnModel,n=$(t.target),o=n.is("input"),s=n.closest("td"),a=n.closest("tr"),l=s.attr("columnName"),r=a.attr("key"),u=this.dataModel.indexOfRowKey(r),d={columnName:l,column:i.indexOfColumnName(l,!0),row:u};!l||0>u?(_.extend(d,this.dimensionModel.getIndexFromMousePosition(t.pageX,t.pageY,!0)),e=i.getVisibleColumnModelList(null,!0),l=e[d.column].columnName,d.columnName=l,d.column=i.indexOfColumnName(l,!0)):"radio"===this.columnModel.get("selectType")&&this.dataModel.check(u),this._controlStartAction(t.pageX,t.pageY,t.shiftKey,d,o)},_onBlurInput:function(t){var e=this.focusModel;_.defer(function(){e.refreshState()})},_controlStartAction:function(t,e,i,n,o){var s=this.columnModel,a=this.selectionModel,l=n.columnName,r=n.column,u=n.row;a.isEnabled()&&(o||this._attachDragEvents(t,e),s.isMetaColumn(l)?"_number"===l?i?a.update(u,0,"row"):a.selectRow(u):this._detachDragEvents():(a.setState("cell"),i&&!o?a.update(u,r):(this.focusModel.focusAt(u,r),a.end())))},_attachDragEvents:function(t,e){this.setOwnProperties({mouseDownX:t,mouseDownY:e}),this.dimensionModel.refreshLayout(),$(document).on("mousemove",$.proxy(this._onMouseMove,this)).on("mouseup",$.proxy(this._detachDragEvents,this)).on("selectstart",$.proxy(this._onSelectStart,this))},_detachDragEvents:function(){this.selectionModel.stopAutoScroll(),$(document).off("mousemove",this._onMouseMove).off("mouseup",this._detachDragEvents).off("selectstart",this._onSelectStart)},_onMouseMove:function(t){var e=this.selectionModel,i=t.pageX,n=t.pageY,o=this._getMouseMoveDistance(i,n)>10;(e.hasSelection()||o)&&e.updateByMousePosition(i,n)},_getMouseMoveDistance:function(t,e){var i=Math.abs(this.mouseDownX-t),n=Math.abs(this.mouseDownY-e);return Math.round(Math.sqrt(Math.pow(i,2)+Math.pow(n,2)))},_onSelectStart:function(t){return t.preventDefault(),!1},render:function(){var t=this.whichSide;return this._destroyChildren(),this.dimensionModel.get("scrollX")||this.$el.css("overflow-x","hidden"),this.dimensionModel.get("scrollY")||"R"!==t||this.$el.css("overflow-y","hidden"),this.$el.css("height",this.dimensionModel.get("bodyHeight")),this.$container=$(o),this.$el.append(this.$container),this._addChildren([this.viewFactory.createBodyTable(t),this.viewFactory.createSelectionLayer(t)]),this.$container.append(this._renderChildren()),this._resetContainerHeight(),this}});e.exports=s},{"../../base/view":7}],43:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({dimensionModel:t.dimensionModel,renderModel:t.renderModel,columnModel:t.columnModel,viewFactory:t.viewFactory,painterManager:t.painterManager,whichSide:t.whichSide||"R"}),this.listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged),this._attachAllTableEventHandlers()},tagName:"div",className:"table_container",template:_.template('<%=colGroup%><%=tbody%>
'),_onColumnWidthChanged:function(){var t=this.dimensionModel.getColumnWidthList(this.whichSide),e=this.$el.find("col");_.each(t,function(t,i){e.eq(i).css("width",t-s.EXTRA_WIDTH)},this)},resetTablePosition:function(){this.$el.css("top",this.renderModel.get("top"))},render:function(){return this._destroyChildren(),this.$el.html(this.template({colGroup:this._getColGroupMarkup(),tbody:""})),this._addChildren(this.viewFactory.createRowList({bodyTableView:this,el:this.$el.find("tbody"),whichSide:this.whichSide})),this._renderChildren(),this},_attachTableEventHandler:function(t,e){_.each(e,function(e,i){this.$el.on(i,t+" "+e.selector,e.handler)},this)},_attachAllTableEventHandlers:function(){var t=this.painterManager.getRowPainter(),e=this.painterManager.getCellPainters();this._attachTableEventHandler("tr",t.getEventHandlerInfo()),_.each(e,function(t,e){var i="td[edit-type="+e+"]",n=t.getEventHandlerInfo();this._attachTableEventHandler(i,n)},this)},redrawTable:function(t){return this.$el[0].innerHTML=this.template({colGroup:this._getColGroupMarkup(),tbody:t}),this.$el.find("tbody")},_getColGroupMarkup:function(){var t=this.whichSide,e=this.dimensionModel.getColumnWidthList(t),i=this.columnModel.getVisibleColumnModelList(t,!0),n="";return _.each(i,function(t,i){var o=t.columnName,a=e[i]-s.EXTRA_WIDTH;n+=''}),n}},{EXTRA_WIDTH:o.isBrowserIE7()?20:0});e.exports=s},{"../../base/view":7,"../../common/util":10}],44:[function(t,e,i){"use strict";var n=t("./frame"),o=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"L"})},className:"lside_area",_onColumnWidthChanged:function(){this.$el.css({width:this.dimensionModel.get("lsideWidth")})},beforeRender:function(){this.$el.css({display:"block",width:this.dimensionModel.get("lsideWidth")})}});e.exports=o},{"./frame":46}],45:[function(t,e,i){"use strict";var n=t("./frame"),o=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"R",$scrollBorder:null}),this.listenTo(this.dimensionModel,"change:bodyHeight change:headerHeight",this._resetScrollBorderHeight)},className:"rside_area",_onColumnWidthChanged:function(){var t=this.dimensionModel;this.$el.css({width:t.get("rsideWidth"),marginLeft:t.get("lsideWidth")})},_resetScrollBorderHeight:function(){var t=this.dimensionModel,e=t.get("bodyHeight")-t.getScrollXHeight();this.$scrollBorder.height(e)},beforeRender:function(){var t=this.dimensionModel;this.$el.css({display:"block",width:t.get("rsideWidth"),marginLeft:t.get("lsideWidth")})},afterRender:function(){var t,e,i,n,o,s=this.dimensionModel;this.dimensionModel.get("scrollY")&&(n=s.get("headerHeight"),o=s.get("bodyHeight"),t=$("
").addClass("header_space"),e=$("
").addClass("scrollbar_border"),i=$("
").addClass("scrollbar_corner"),t.height(n-2),e.css("top",n+"px"),i.css("bottom",s.get("toolbarHeight")),this.$el.append(t,e,i),this.$scrollBorder=e,this._resetScrollBorderHeight())}});e.exports=o},{"./frame":46}],46:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({viewFactory:t.viewFactory,renderModel:t.renderModel,dimensionModel:t.dimensionModel,whichSide:t.whichSide||"R"}),this.listenTo(this.renderModel,"columnModelChanged",this.render,this).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged,this)},tagName:"div",className:"lside_area",render:function(){var t=this.viewFactory;return this._destroyChildren(),this.beforeRender(),this._addChildren([t.createHeader(this.whichSide),t.createBody(this.whichSide)]),this.$el.append(this._renderChildren()),this.afterRender(),this},_onColumnWidthChanged:function(){},beforeRender:function(){},afterRender:function(){}});e.exports=o},{"../../base/view":7}],47:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({renderModel:t.renderModel,dimensionModel:t.dimensionModel,selectionModel:t.selectionModel,columnModel:t.columnModel,dataModel:t.dataModel,viewFactory:t.viewFactory,timeoutForAllChecked:0,whichSide:t.whichSide||"R"}),this.listenTo(this.renderModel,"change:scrollLeft",this._onScrollLeftChange,this).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged,this).listenTo(this.dataModel,"change:_button",this._onCheckCountChange,this).listenTo(this.dataModel,"sortChanged",this._updateBtnSortState,this)},tagName:"div",className:"header",events:{click:"_onClick","mousedown th[columnName]":"_onMouseDown"},template:_.template(' <%=colGroup%><%=tBody%>
'),templateHeader:_.template(' 0) {%>colspan=<%=colspan%> <%}%><%if(rowspan > 0) {%>rowspan=<%=rowspan%> <%}%>><%=title%><%=btnSort%>'),templateCol:_.template(''),markupBtnSort:'',_getColGroupMarkup:function(){var t=this._getColumnData(),e=t.widthList,i=t.modelList,n=[];return _.each(e,function(t,e){n.push(this.templateCol({columnName:i[e].columnName,width:t}))},this),n.join("")},_onMouseDown:function(t){var e,i;this.selectionModel.isEnabled()&&!$(t.target).is("a.btn_sorting")&&(e=$(t.target).closest("th").attr("columnName"),i=this.columnModel.getUnitColumnNamesIfMerged(e),this._hasMetaColumn(i)||this._controlStartAction(i,t.pageX,t.pageY,t.shiftKey))},_controlStartAction:function(t,e,i,n){var o=this.columnModel,s=_.map(t,function(t){return o.indexOfColumnName(t,!0)});n?this._startColumnSelectionWithShiftKey(s,e,i):this._startColumnSelectionWithoutShiftKey(s),this._attachDragEvents()},_startColumnSelectionWithShiftKey:function(t,e,i){var n=this.selectionModel,o=Math.max.apply(null,t);n.update(0,o,"column"),n.extendColumnSelection(t,e,i)},_startColumnSelectionWithoutShiftKey:function(t){var e=this.selectionModel,i=o.getMinMax(t),n=i.min,s=i.max;e.setMinimumColumnRange([n,s]),e.selectColumn(n),e.update(0,s)},_attachDragEvents:function(){$(document).on("mousemove",$.proxy(this._onMouseMove,this)).on("mouseup",$.proxy(this._detachDragEvents,this)).on("selectstart",$.proxy(this._onSelectStart,this))},_detachDragEvents:function(){this.selectionModel.stopAutoScroll(),$(document).off("mousemove",this._onMouseMove).off("mouseup",this._detachDragEvents).off("selectstart",this._onSelectStart)},_onMouseMove:function(t){var e,i,n=this.columnModel,o=!0,s=$(t.target).closest("th").attr("columnName");s?(e=n.getUnitColumnNamesIfMerged(s),i=_.map(e,function(t){return n.indexOfColumnName(t,!0)})):$.contains(this.el,t.target)&&(o=!1),o&&this.selectionModel.extendColumnSelection(i,t.pageX,t.pageY)},_hasMetaColumn:function(t){var e=!1,i=this.columnModel;return tui.util.forEach(t,function(t){return i.isMetaColumn(t)?(e=!0,!1):void 0}),e},_onSelectStart:function(t){return t.preventDefault(),!1},_onCheckCountChange:function(){"checkbox"===this.columnModel.get("selectType")&&(clearTimeout(this.timeoutForAllChecked),this.timeoutForAllChecked=setTimeout($.proxy(this._syncCheckState,this),10))},_getHeaderMainCheckbox:function(){return this.$el.find('th[columnname="_button"] input')},_syncCheckState:function(){var t,e,i;this.columnModel&&"checkbox"===this.columnModel.get("selectType")&&(t=this._getHeaderMainCheckbox(),t.length&&(e=0,i=this.dataModel.getRowList(!0).length,this.dataModel.forEach(function(t){var i=t.getCellState("_button");!i.isDisabled&&i.isEditable&&(e+=1)},this),t.prop("checked",e===i)))},_onColumnWidthChanged:function(){var t=this._getColumnData(),e=t.widthList,i=this.$el.find("col");_.each(e,function(t,e){i.eq(e).css("width",t+"px")})},_onScrollLeftChange:function(t,e){"R"===this.whichSide&&(this.el.scrollLeft=e)},_onClick:function(t){var e=$(t.target),i=e.closest("th").attr("columnname");"_button"===i&&e.is("input")?e.prop("checked")?this.dataModel.checkAll():this.dataModel.uncheckAll():e.is("a.btn_sorting")&&this.dataModel.sortByField(i)},_updateBtnSortState:function(t){this._$currentSortBtn&&this._$currentSortBtn.removeClass("sorting_down sorting_up"),this._$currentSortBtn=this.$el.find("th[columnname="+t.columnName+"] a.btn_sorting"),this._$currentSortBtn.addClass(t.isAscending?"sorting_up":"sorting_down")},render:function(){return this._destroyChildren(),this.dimensionModel.get("scrollX")||this.$el.css("overflow-x","hidden"),this.dimensionModel.get("scrollY")||this.$el.css("overflow-y","hidden"),this.$el.css({height:this.dimensionModel.get("headerHeight")}).html(this.template({colGroup:this._getColGroupMarkup(),tBody:this._getTableBodyMarkup()})),this._addChildren(this.viewFactory.createHeaderResizeHandler(this.whichSide)),this.$el.append(this._renderChildren()),this},_getColumnData:function(){var t=this.columnModel,e=this.dimensionModel,i=e.getColumnWidthList(this.whichSide),n=t.getVisibleColumnModelList(this.whichSide,!0);return{widthList:i,modelList:n}},_getTableBodyMarkup:function(){var t,e,i=this._getColumnHierarchyList(),n=this._getHierarchyMaxRowCount(i),s=this.dimensionModel.get("headerHeight"),a=new Array(n),l=new Array(n),r=[],u=o.getRowHeight(n,s)-1,d=1;return _.each(i,function(e,o){var c=i[o].length,h=0;_.each(e,function(e,i){var o=e.columnName;d=c-1===i&&n-c+1>1?n-c+1:1,t=u*d,i===c-1?t=s-h-2:h+=t+1,l[i]===o?(a[i].pop(),r[i]+=1):r[i]=1,l[i]=o,a[i]=a[i]||[],a[i].push(this.templateHeader({columnName:o,height:t,colspan:r[i],rowspan:d,title:e.title,btnSort:e.isSortable?this.markupBtnSort:""}))},this)},this),e=_.map(a,function(t){return""+t.join("")+""}),e.join("")},_getHierarchyMaxRowCount:function(t){var e=[0];return _.each(t,function(t){e.push(t.length)},this),Math.max.apply(Math,e)},_getColumnHierarchyList:function(){var t,e=this._getColumnData().modelList;return t=_.map(e,function(t){return this._getColumnHierarchy(t).reverse()},this)},_getColumnHierarchy:function(t,e){var i=this.columnModel.get("columnMerge");return e=e||[],t&&(e.push(t),i&&_.each(i,function(i){-1!==$.inArray(t.columnName,i.columnNameList)&&this._getColumnHierarchy(i,e)},this)),e}});e.exports=s},{"../../base/view":7,"../../common/util":10}],48:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){this.setOwnProperties({dimensionModel:t.dimensionModel,columnModel:t.columnModel,whichSide:t.whichSide||"R",isResizing:!1,$target:null,differenceLeft:0,initialWidth:0,initialOffsetLeft:0,initialLeft:0}),this.listenTo(this.dimensionModel,"change:which columnWidthChanged",this._refreshHandlerPosition)},tagName:"div",className:"resize_handle_container",events:{"mousedown .resize_handle":"_onMouseDown","click .resize_handle":"_onClick"},template:_.template('
" style="<%=height%>" title="마우스 드래그를 통해 컬럼의 넓이를 변경할 수 있고,더블클릭을 통해 넓이를 초기화할 수 있습니다.">
'),_getColumnData:function(){var t=this.columnModel,e=this.dimensionModel,i=e.getColumnWidthList(this.whichSide),n=t.getVisibleColumnModelList(this.whichSide,!0);return{widthList:i,modelList:n}},_getResizeHandlerMarkup:function(){var t,e=this._getColumnData(),i=e.modelList,n=this.dimensionModel.get("headerHeight"),o=i.length;return t=_.map(i,function(t,e){return this.template({columnIndex:e,columnName:t.columnName,isLast:e+1===o,height:n})},this),t.join("")},render:function(){var t=this.dimensionModel.get("headerHeight"),e=this._getResizeHandlerMarkup();return this.$el.empty().show().html(e).css({marginTop:-t,height:t}),this._refreshHandlerPosition(),this},_refreshHandlerPosition:function(){var t,e,i,n=this._getColumnData(),o=n.widthList,s=this.$el.find(".resize_handle"),a=this.$el.parent().find("table:first"),l=!1,r=0,u=1;tui.util.forEachArray(s,function(n,d){t=s.eq(d),e=t.attr("columnname"),i=a.find('th[columnname="'+e+'"]').width(),tui.util.isExisty(i)?l=l||i!==o[d]:i=o[d],r+=i+u,t.css("left",r-3+"px")})},_isResizing:function(){return!!this.isResizing},_onMouseDown:function(t){this._startResizing(t)},_onClick:function(t){var e=$(t.target),i=parseInt(e.attr("columnindex"),10),n=e.data("isClicked");n?(this.dimensionModel.restoreColumnWidth(this._getHandlerColumnIndex(i)),this._clearClickedFlag(e),this._refreshHandlerPosition()):this._setClickedFlag(e)},_setClickedFlag:function(t){t.data("isClicked",!0),setTimeout($.proxy(this._clearClickedFlag,this,t),500)},_clearClickedFlag:function(t){t.data("isClicked",!1)},_onMouseUp:function(){this._stopResizing()},_onMouseMove:function(t){var e,i,n;this._isResizing()&&(t.preventDefault(),e=t.pageX-this.initialOffsetLeft,i=this._calculateWidth(t.pageX),n=parseInt(this.$target.attr("columnindex"),10),this.$target.css("left",e+"px"),this.dimensionModel.setColumnWidth(this._getHandlerColumnIndex(n),i),this._refreshHandlerPosition())},_calculateWidth:function(t){var e=t-this.initialOffsetLeft-this.initialLeft;return this.initialWidth+e},_getHandlerColumnIndex:function(t){return"R"===this.whichSide?t+this.columnModel.getVisibleColumnFixCount(!0):t},_startResizing:function(t){var e=this._getColumnData(),i=e.widthList,n=$(t.target);this.isResizing=!0,this.$target=n,this.initialLeft=parseInt(n.css("left").replace("px",""),10),this.initialOffsetLeft=this.$el.offset().left,this.initialWidth=i[n.attr("columnindex")],$("body").css("cursor","col-resize"),$(document).bind("mousemove",$.proxy(this._onMouseMove,this)).bind("mouseup",$.proxy(this._onMouseUp,this)),n[0].setCapture&&n[0].setCapture()},_stopResizing:function(){this.$target&&this.$target[0].releaseCapture&&this.$target[0].releaseCapture(),this.isResizing=!1,this.$target=null,this.initialLeft=0,this.initialOffsetLeft=0,this.initialWidth=0,$("body").css("cursor","default"),$(document).unbind("mousemove",$.proxy(this._onMouseMove,this)).unbind("mouseup",$.proxy(this._onMouseUp,this))},destroy:function(){this.stopListening(),this._stopResizing(),this.remove()}});e.exports=o},{"../../base/view":7}],49:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.toolbarModel=t.toolbarModel,this.dimensionModel=t.dimensionModel,this.viewFactory=t.viewFactory},tagName:"div",className:"toolbar",render:function(){var t=this.toolbarModel;return this._destroyChildren(),t.get("hasControlPanel")&&this._addChildren(this.viewFactory.createToolbarControlPanel()),t.get("hasResizeHandler")&&this._addChildren(this.viewFactory.createToolbarResizeHandler()),t.get("hasPagination")&&this._addChildren(this.viewFactory.createToolbarPagination()),this.$el.empty().append(this._renderChildren()),this._refreshHeight(),this},_refreshHeight:function(){var t=this.dimensionModel.get("toolbarHeight");this.$el.height(t),this.$el.toggle(!!t)}});e.exports=o},{"../../base/view":7}],50:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.setOwnProperties({gridId:t.gridId,toolbarModel:t.toolbarModel,$btnExcel:null,$btnExcelAll:null}),this.listenTo(this.toolbarModel,"change:isExcelButtonVisible change:isExcelAllButtonVisible",this.render)},events:{"click a.excel_download_button":"_onClickExcel"},tagName:"div",className:"btn_setup",templateExcelBtn:_.template('<%=text%>'),_onClickExcel:function(t){var e,i=tui.Grid.getInstanceById(this.gridId),n=i.getAddOn("Net");t.preventDefault(),n&&(e=$(t.target).closest("a"),e.hasClass("excel_page")?n.download("excel"):e.hasClass("excel_all")&&n.download("excelAll"))},render:function(){var t=this.toolbarModel;return this.$el.empty(),t.get("isExcelButtonVisible")&&this.$el.append(this.templateExcelBtn({className:"excel_page",text:"엑셀 다운로드"})),t.get("isExcelAllButtonVisible")&&this.$el.append(this.templateExcelBtn({className:"excel_all",text:"전체 엑셀 다운로드"})),this}});e.exports=o},{"../../../base/view":7}],51:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.toolbarModel=t.toolbarModel},tagName:"div",className:"grid_pagination",template:_.template('FirstPrev LastFirst OffPrev OffNext OffLast Off'),render:function(){return this._destroyChildren(),this.$el.empty().html(this.template()),this._setPaginationInstance(),this},_setPaginationInstance:function(){var t=tui&&tui.component&&tui.component.Pagination,e=this.toolbarModel.get("pagination");!e&&t&&(e=new t({itemCount:1,itemPerPage:1,pagePerPageList:5,isCenterAlign:!0,moveUnit:"page",$preOff:this.$el.find(".pre_off"),$pre_endOff:this.$el.find(".pre_end_off"),$nextOff:this.$el.find(".next_off"),$lastOff:this.$el.find(".next_end_off")},this.$el)),this.toolbarModel.set("pagination",e)}});e.exports=o},{"../../../base/view":7}],52:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.timeoutIdForResize=0},tagName:"div",className:"height_resize_bar",template:_.template(''),events:{mousedown:"_onMouseDown"},_attachMouseEvent:function(){$(document).on("mousemove",$.proxy(this._onMouseMove,this)),$(document).on("mouseup",$.proxy(this._onMouseUp,this)),$(document).on("selectstart",$.proxy(this._onSelectStart,this))},_detachMouseEvent:function(){$(document).off("mousemove",$.proxy(this._onMouseMove,this)),$(document).off("mouseup",$.proxy(this._onMouseUp,this)),$(document).off("selectstart",$.proxy(this._onSelectStart,this))},_onMouseDown:function(t){t.preventDefault(),$(document.body).css("cursor","row-resize"),this.dimensionModel.refreshLayout(),this._attachMouseEvent()},_onMouseMove:function(t){var e=this.dimensionModel,i=e.get("offsetTop"),n=e.get("headerHeight"),o=e.get("rowHeight"),s=e.get("toolbarHeight"),a=t.pageY-i-n-s;clearTimeout(this.timeoutIdForResize),a=Math.max(a,o+e.getScrollXHeight()),this.timeoutIdForResize=setTimeout(function(){e.set({bodyHeight:a})},0)},_onMouseUp:function(){$(document.body).css("cursor","default"),this._detachMouseEvent()},_onSelectStart:function(t){return t.preventDefault(),!1},render:function(){return this._destroyChildren(),this.$el.html(this.template()),this},destroy:function(){this.stopListening(),this._onMouseUp(),this._destroyChildren(),this.remove()}});e.exports=o},{"../../../base/view":7}],53:[function(t,e,i){"use strict";var n=t("../base/view"),o=n.extend({initialize:function(t){var e=t.focusModel,i=t.renderModel,n=t.whichSide||"R";this.setOwnProperties({whichSide:n,bodyTableView:t.bodyTableView,focusModel:e,renderModel:i,dataModel:t.dataModel,columnModel:t.columnModel,collection:i.getCollection(n),painterManager:t.painterManager,sortOptions:null,renderedRowKeys:null}),this._focusClipboardDebounced=_.debounce(this._focusClipboard,10),this.listenTo(this.collection,"change",this._onModelChange).listenTo(e,"select",this._onSelect).listenTo(e,"unselect",this._onUnselect).listenTo(e,"focus",this._onFocus).listenTo(e,"blur",this._onBlur).listenTo(e,"focusIn",this._onFocusIn).listenTo(i,"rowListChanged",this.render); -},_getColumnModelList:function(){return this.columnModel.getVisibleColumnModelList(this.whichSide,!0)},_removeOldRows:function(t){var e=_.indexOf(this.renderedRowKeys,t[0]),i=_.indexOf(this.renderedRowKeys,_.last(t)),n=this.$el.children("tr");n.slice(0,e).remove(),n.slice(i+1).remove()},_appendNewRows:function(t,e){var i=this.collection.slice(0,_.indexOf(t,e[0])),n=this.collection.slice(_.indexOf(t,_.last(e))+1);this.$el.prepend(this._getRowsHtml(i)),this.$el.append(this._getRowsHtml(n))},_resetRows:function(){var t,e=this._getRowsHtml(this.collection.models);if(o.isInnerHtmlOfTbodyReadOnly)t=this.bodyTableView.redrawTable(e),this.setElement(t,!1),tui.util.browser.msie&&tui.util.browser.version<=7&&t.width(t.width());else try{this.$el[0].innerHTML=e}catch(i){o.isInnerHtmlOfTbodyReadOnly=!0,this._resetRows()}},_getRowsHtml:function(t){var e=this.painterManager.getRowPainter(),i=this._getColumnModelList();return _.map(t,function(t){return e.getHtml(t,i)}).join("")},_focusClipboard:function(){try{this.focusModel.focusClipboard()}catch(t){}},_getRowElement:function(t){return this.$el.find('tr[key="'+t+'"]')},_onSelect:function(t){this._setCssSelect(t.rowKey,!0)},_onUnselect:function(t){this._setCssSelect(t,!1)},_setCssSelect:function(t,e){var i,n,o,s,a=this._getColumnModelList(),l={};_.each(a,function(a){i=a.columnName,n=this.dataModel.getMainRowKey(t,i),l[n]=l[n]||this._getRowElement(n),o=l[n],s=o.find('td[columnname="'+i+'"]'),s.length&&s.toggleClass("selected",e)},this)},_onBlur:function(t,e){var i=this.dataModel.getElement(t,e);i.length&&i.removeClass("focused")},_onFocus:function(t,e){var i=this.dataModel.getElement(t,e);i.length&&i.addClass("focused")},_onFocusIn:function(t,e){var i,n,o,s=this.columnModel.isLside(e)?"L":"R";s===this.whichSide&&(i=this.dataModel.getElement(t,e),n=this.columnModel.getEditType(e),o=this.painterManager.getCellPainter(n),o.focusIn(i))},render:function(t){var e,i=this.collection.pluck("rowKey");return this.bodyTableView.resetTablePosition(),t?this._resetRows():(e=_.intersection(i,this.renderedRowKeys),_.isEmpty(i)||_.isEmpty(e)||e.length/i.length<.7?this._resetRows():(this._removeOldRows(e),this._appendNewRows(i,e))),this.renderedRowKeys=i,this._focusClipboardDebounced(),this},_onModelChange:function(t){var e=this._getRowElement(t.get("rowKey"));this.painterManager.getRowPainter().onModelChange(t,e)}},{isInnerHtmlOfTbodyReadOnly:tui.util.browser.msie&&tui.util.browser.version<=9});e.exports=o},{"../base/view":7}],54:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=1,a=n.extend({initialize:function(t){this.setOwnProperties({whichSide:t.whichSide||"R",dimensionModel:t.dimensionModel,columnModel:t.columnModel,selectionModel:t.selectionModel}),this._updateColumnWidthList(),this.listenTo(this.dimensionModel,"columnWidthChanged",this._onChangeColumnWidth),this.listenTo(this.selectionModel,"change:range",this.render)},tagName:"div",className:"selection_layer",_updateColumnWidthList:function(){this.columnWidthList=this.dimensionModel.getColumnWidthList(this.whichSide)},_onChangeColumnWidth:function(){this._updateColumnWidthList(),this.render()},_getOwnSideColumnRange:function(t){var e=this.columnModel.getVisibleColumnFixCount(),i=null;return"L"===this.whichSide?t[0]=e&&(i=[Math.max(t[0],e)-e,t[1]-e]),i},_getVerticalStyles:function(t){var e=this.dimensionModel.get("rowHeight"),i=o.getHeight(t[0],e)-s,n=o.getHeight(t[1]-t[0]+1,e)-2*s;return{top:i+"px",height:n+"px"}},_getHorizontalStyles:function(t){var e=this.columnWidthList,i=this.columnModel.getVisibleMetaColumnCount(),n=t[0],o=t[1],a=0,l=0,r=0;for("L"===this.whichSide&&(n+=i,o+=i),o=Math.min(o,e.length-1);o>=r;r+=1)n>r?a+=e[r]+s:l+=e[r]+s;return l-=s,{left:a+"px",width:l+"px"}},render:function(){var t,e,i=this.selectionModel.get("range");return i&&(e=this._getOwnSideColumnRange(i.column)),e?(t=_.assign({},this._getVerticalStyles(i.row),this._getHorizontalStyles(e)),this.$el.show().css(t)):this.$el.hide(),this}});e.exports=a},{"../base/view":7,"../common/util":10}],55:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").renderState,s=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.renderModel=t.renderModel,this.listenTo(this.dimensionModel,"change",this._refreshLayout),this.listenTo(this.renderModel,"change:state",this.render)},className:"state_layer",template:_.template('
<%= text %> <% if (isLoading) { %>
<% } %>
'),render:function(){var t=this.renderModel.get("state");return t===o.DONE?this.$el.hide():(this.$el.html(this.template({text:this._getMessage(t),isLoading:t===o.LOADING})).show(),this._refreshLayout()),this},_getMessage:function(t){switch(t){case o.LOADING:return"요청을 처리 중입니다.";case o.EMPTY:return this.renderModel.get("emptyMessage")||"데이터가 존재하지 않습니다.";default:return null}},_refreshLayout:function(){var t=this.dimensionModel;this.$el.css({marginTop:t.get("headerHeight"),height:t.get("bodyHeight")+t.get("toolbarHeight")})}});e.exports=s},{"../base/view":7,"../common/constMap":8}]},{},[12]); \ No newline at end of file +!function t(e,i,n){function o(a,l){if(!i[a]){if(!e[a]){var r="function"==typeof require&&require;if(!l&&r)return r(a,!0);if(s)return s(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var d=i[a]={exports:{}};e[a][0].call(d.exports,function(t){var i=e[a][1][t];return o(i?i:t)},d,d.exports,t,e,i,n)}return i[a].exports}for(var s="function"==typeof require&&require,a=0;a0?i=confirm(this._getConfirmMessage(t,e)):alert(this._getConfirmMessage(t,e)),i},_getConfirmMessage:function(t,e){var i,n={createData:"입력",updateData:"수정",deleteData:"삭제",modifyData:"반영"},o=n[t];return i=e>0?e+"건의 데이터를 "+o+"하시겠습니까?":o+"할 데이터가 없습니다."},_ajax:function(t){var e,i=this.createEventData(t.data);this.trigger("beforeRequest",i),i.isStopped()||(t=$.extend({requestType:""},t),e={url:t.url,data:t.data||{},type:t.type||"POST",dataType:t.dataType||"json",complete:$.proxy(this._onComplete,this,t.complete,t),success:$.proxy(this._onSuccess,this,t.success,t),error:$.proxy(this._onError,this,t.error,t)},t.url&&$.ajax(e))},_onComplete:function(t,e,i){this._unlock()},_onSuccess:function(t,e,i,n,o){var s=i&&i.message,a=this.createEventData({httpStatus:n,requestType:e.requestType,requestParameter:e.data,responseData:i});if(this.trigger("response",a),!a.isStopped())if(i&&i.result){if(this.trigger("successResponse",a),a.isStopped())return;_.isFunction(t)&&t(i.data||{},n,o)}else{if(this.trigger("failResponse",a),a.isStopped())return;s&&alert(s)}},_onError:function(t,e,i,n){var o=this.createEventData({httpStatus:n,requestType:e.requestType,requestParameter:e.data,responseData:null});this.renderModel.set("state",l.DONE),this.trigger("response",o),o.isStopped()||(this.trigger("errorResponse",o),o.isStopped()||i.readyState>1&&alert("데이터 요청 중에 에러가 발생하였습니다.\n\n다시 시도하여 주시기 바랍니다."))}});e.exports=r},{"../base/view":7,"../common/constMap":8,"../common/formUtil":9,"../common/util":10,"./net-router":1}],3:[function(t,e,i){"use strict";var n=t("./common"),o=Backbone.Collection.extend({initialize:function(t,e){},clear:function(){return this.each(function(t){t.stopListening(),t=null}),this.reset([],{silent:!0}),this}});_.assign(o.prototype,n),e.exports=o},{"./common":4}],4:[function(t,e,i){"use strict";var n={setOwnProperties:function(t){_.each(t,function(t,e){this[e]=t},this)}};e.exports=n},{}],5:[function(t,e,i){"use strict";var n=t("./common"),o=Backbone.Model.extend({initialize:function(t){}});_.assign(o.prototype,n),e.exports=o},{"./common":4}],6:[function(t,e,i){"use strict";var n=t("./common"),o=tui.util.defineClass({init:function(t){var e=t&&t.grid||this.collection&&this.collection.grid||null;this.setOwnProperties({grid:e}),this.initializeEventHandler()},eventHandler:{},initializeEventHandler:function(){var t={};_.each(this.eventHandler,function(e,i){var n=i.split(" "),o=n[0],s=n[1]||"";t[o]={selector:s,handler:$.proxy(this[e],this)}},this),this.setOwnProperties({_eventHandler:t})},getEventHandlerInfo:function(){return this._eventHandler},getHtml:function(){throw this.error("implement getHtml() method")}});_.assign(o.prototype,n),e.exports=o},{"./common":4}],7:[function(t,e,i){"use strict";var n=t("./common"),o=Backbone.View.extend({initialize:function(t){this._children=[]},error:function(t){var e=function(){this.name="Grid Exception",this.message=t||"error"};return e.prototype=new Error,new e},_addChildren:function(t){_.isArray(t)||(t=[t]),[].push.apply(this._children,t)},_renderChildren:function(){var t=_.map(this._children,function(t){return t.render().el});return t},destroy:function(){this.stopListening(),this._destroyChildren(),this.remove()},createEventData:function(t){var e=$.extend({},t);return e.stop=function(){this._isStopped=!0},e.isStopped=function(){return this._isStopped},e._isStopped=e._isStopped||!1,e},_destroyChildren:function(){if(this._children)for(;this._children.length>0;)this._children.pop().destroy()}});_.assign(o.prototype,n),e.exports=o},{"./common":4}],8:[function(t,e,i){"use strict";var n={TAB:9,ENTER:13,CTRL:17,ESC:27,LEFT_ARROW:37,UP_ARROW:38,RIGHT_ARROW:39,DOWN_ARROW:40,CHAR_A:65,CHAR_C:67,CHAR_F:70,CHAR_R:82,CHAR_V:86,LEFT_WINDOW_KEY:91,F5:116,BACKSPACE:8,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,DEL:46,UNDEFINED:229};e.exports={keyCode:n,keyName:_.invert(n),renderState:{LOADING:"LOADING",DONE:"DONE",EMPTY:"EMPTY"},dimension:{CELL_BORDER_WIDTH:1,TABLE_BORDER_WIDTH:1}}},{}],9:[function(t,e,i){"use strict";var n={setInput:{_changeToStringInArray:function(t){return _.each(t,function(e,i){t[i]=String(e)}),t},radio:function(t,e){t.checked=t.value===e},checkbox:function(t,e){_.isArray(e)?t.checked=-1!==$.inArray(t.value,this._changeToStringInArray(e)):t.checked=t.value===e},"select-one":function(t,e){var i=tui.util.toArray(t.options);tui.util.forEach(i,function(i,n){return i.value===e||i.text===e?(t.selectedIndex=n,!1):void 0})},"select-multiple":function(t,e){var i=tui.util.toArray(t.options);_.isArray(e)?(e=this._changeToStringInArray(e),_.each(i,function(t){t.selected=-1!==$.inArray(t.value,e)||-1!==$.inArray(t.text,e)})):this["select-one"].apply(this,arguments)},defaultAction:function(t,e){t.value=e}},getFormData:function(t){var e={},i=t.serializeArray(),n=tui.util.isExisty;return _.each(i,function(t){var i=t.value||"",o=t.name;n(e[o])?e[o]=[].concat(e[o],i):e[o]=i}),e},getFormElement:function(t,e){var i;return t&&t.length&&(i=e?t.prop("elements")[e+""]:t.prop("elements")),$(i)},setFormData:function(t,e){_.each(e,function(e,i){this.setFormElementValue(t,i,e)},this)},setFormElementValue:function(t,e,i){var n,o=this.getFormElement(t,e);o.length&&(_.isArray(i)||(i=String(i)),o=tui.util.isHTMLTag(o)?[o]:o,o=tui.util.toArray(o),_.each(o,function(t){n=this.setInput[t.type]?t.type:"defaultAction",this.setInput[n](t,i)},this))},setCursorToEnd:function(t){var e,i=t.value.length;if(t.focus(),t.setSelectionRange)try{t.setSelectionRange(i,i)}catch(n){}else if(t.createTextRange){e=t.createTextRange(),e.collapse(!0),e.moveEnd("character",i),e.moveStart("character",i);try{e.select()}catch(n){}}}};e.exports=n},{}],10:[function(t,e,i){"use strict";var n={uniqueId:0,getAttributesString:function(t){var e="";return _.each(t,function(t,i){e+=" "+i+'="'+t+'"'},this),e},sum:function(t){return _.reduce(t,function(t,e){return t+=e},0)},getMinMax:function(t){return{min:Math.min.apply(null,t),max:Math.max.apply(null,t)}},getHeight:function(t,e){return 0===t?t:t*(e+1)+1},getDisplayRowCount:function(t,e){return Math.ceil((t-1)/(e+1))},getRowHeight:function(t,e){return 0===t?0:Math.floor((e-1)/t)-1},isEqual:function(t,e){var i,n=function(t,e){var i=!1;return tui.util.forEach(t,function(t,n){return i=t===e[n]}),i};return typeof t!=typeof e?!1:_.isArray(t)&&t.length!==e.length?!1:_.isObject(t)?(i=!n(t,e)||!n(e,t),!i):t!==e?!1:!0},isBlank:function(t){return _.isString(t)?!t.length:void 0===t||null===t},stripTags:function(t){var e;return t=t.replace(/[\n\r\t]/g,""),tui.util.hasEncodableString(t)&&(/]*\ssrc=[\"']?([^>\"']+)[\"']?[^>]*>/i),t=e?e[1]:""):t=t.replace(//gi,""),t=$.trim(tui.util.decodeHTMLEntity(t.replace(/<\/?(?:h[1-5]|[a-z]+(?:\:[a-z]+)?)[^>]*>/gi,"")))),t},getUniqueKey:function(){return this.uniqueId+=1,this.uniqueId},toQueryString:function(t){var e=[];return _.each(t,function(t,i){_.isString(t)||_.isNumber(t)||(t=$.toJSON(t)),t=encodeURIComponent(t),t&&e.push(i+"="+t)}),e.join("&")},toQueryObject:function(t){var e=t.split("&"),i={};return _.each(e,function(t){var e,n,o=t.split("=");e=o[0],n=decodeURIComponent(o[1]);try{n=$.parseJSON(n)}catch(s){}_.isNull(n)||(i[e]=n)}),i},convertValueType:function(t,e){return"string"===e?t.toString():"number"===e?+t:t},toUpperCaseFirstLetter:function(t){return t.charAt(0).toUpperCase()+t.slice(1)},clamp:function(t,e,i){var n;return e>i&&(n=e,e=i,i=n),Math.max(e,Math.min(t,i))},isBrowserIE7:function(){var t=tui.util.browser;return t.msie&&7===t.version}};e.exports=n},{}],11:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){this.$el=t},getElement:function(t,e){return this.$el.find('tr[key="'+t+'"]').find('td[columnname="'+e+'"]')},getOffset:function(){return this.$el.offset()},getWidth:function(){return this.$el.width()},getParentHeight:function(){return this.$el.parent().height()},hasFocusedElement:function(){return!!this.$el.find(":focus").length}});e.exports=n},{}],12:[function(t,e,i){"use strict";var n=t("./base/view"),o=t("./model/manager"),s=t("./view/factory"),a=t("./domState"),l=t("./publicEventEmitter"),r=t("./painter/manager"),u=t("./addon/net"),d=t("./common/util"),h={};tui=window.tui=tui||{},tui.Grid=n.extend({initialize:function(t){this.id=d.getUniqueKey(),this.modelManager=this._createModelManager(t),this.painterManager=this._createPainterManager(),this.container=this._createContainerView(t),this.publicEventEmitter=this._createPublicEventEmitter(),this.container.render(),this.refreshLayout(),this.addOn={},h[this.id]=this},_createModelManager:function(t){var e=new a(this.$el),i=_.assign({},t,{gridId:this.id});return _.omit(i,"el","singleClickEdit"),new o(i,e)},_createPainterManager:function(){return new r({modelManager:this.modelManager})},_createContainerView:function(t){var e=new s({modelManager:this.modelManager,painterManager:this.painterManager});return e.createContainer({el:this.$el,singleClickEdit:t.singleClickEdit})},_createPublicEventEmitter:function(){var t=new l(this);return t.listenToFocusModel(this.modelManager.focusModel),t.listenToContainerView(this.container),t},disable:function(){this.modelManager.dataModel.setDisabled(!0)},enable:function(){this.modelManager.dataModel.setDisabled(!1)},disableRow:function(t){this.modelManager.dataModel.disableRow(t)},enableRow:function(t){this.modelManager.dataModel.enableRow(t)},getValue:function(t,e,i){return this.modelManager.dataModel.getValue(t,e,i)},getColumnValues:function(t,e){return this.modelManager.dataModel.getColumnValues(t,e)},getRow:function(t,e){return this.modelManager.dataModel.getRowData(t,e)},getRowAt:function(t,e){return this.modelManager.dataModel.getRowDataAt(t,e)},getRowCount:function(){return this.modelManager.dataModel.length},getSelectedRowKey:function(){return this.modelManager.focusModel.which().rowKey},getElement:function(t,e){return this.modelManager.dataModel.getElement(t,e)},setValue:function(t,e,i){this.modelManager.dataModel.setValue(t,e,i)},setColumnValues:function(t,e,i){this.modelManager.dataModel.setColumnValues(t,e,i)},replaceRowList:function(t){this.modelManager.dataModel.replaceRowList(t)},setRowList:function(t,e){this.modelManager.dataModel.setRowList(t,!0,e)},focus:function(t,e,i){this.modelManager.focusModel.focusClipboard(),this.modelManager.focusModel.focus(t,e,i)},focusAt:function(t,e,i){this.modelManager.focusModel.focusAt(t,e,i)},focusIn:function(t,e,i){this.modelManager.focusModel.focusIn(t,e,i)},focusInAt:function(t,e,i){this.modelManager.focusModel.focusInAt(t,e,i)},readyForKeyControl:function(){this.modelManager.focusModel.focusClipboard()},blur:function(){this.modelManager.focusModel.blur()},checkAll:function(){this.modelManager.dataModel.checkAll()},check:function(t){this.modelManager.dataModel.check(t)},uncheckAll:function(){this.modelManager.dataModel.uncheckAll()},uncheck:function(t){this.modelManager.dataModel.uncheck(t)},clear:function(){this.modelManager.dataModel.setRowList([])},removeRow:function(t,e){tui.util.isBoolean(e)&&e&&(e={removeOriginalData:!0}),this.modelManager.dataModel.removeRow(t,e)},removeCheckedRows:function(t){var e=this.getCheckedRowKeyList(),i=e.length+"건의 데이터를 삭제하시겠습니까?";return e.length>0&&(!t||confirm(i))?(_.each(e,function(t){this.modelManager.dataModel.removeRow(t)},this),!0):!1},enableCheck:function(t){this.modelManager.dataModel.enableCheck(t)},disableCheck:function(t){this.modelManager.dataModel.disableCheck(t)},getCheckedRowKeyList:function(t){var e=this.modelManager.dataModel.getRowList(!0),i=_.pluck(e,"rowKey");return t?$.toJSON(i):i},getCheckedRowList:function(t){var e=this.modelManager.dataModel.getRowList(!0);return t?$.toJSON(e):e},getColumnModelList:function(){return this.modelManager.columnModel.get("dataColumnModelList")},getModifiedRowList:function(t){return this.modelManager.dataModel.getModifiedRowList(t)},appendRow:function(t,e){this.modelManager.dataModel.append(t,e)},prependRow:function(t,e){this.modelManager.dataModel.prepend(t,e)},isChanged:function(){return this.modelManager.dataModel.isChanged()},getAddOn:function(t){return t?this.addOn[t]:this.addOn},restore:function(){this.modelManager.dataModel.restore()},select:function(t){this.modelManager.focusModel.select(t)},unselect:function(){this.modelManager.focusModel.unselect(!0)},setColumnFixCount:function(t){this.modelManager.columnModel.set("columnFixCount",t)},setColumnModelList:function(t){this.modelManager.columnModel.set("columnModelList",t)},use:function(t,e){return"Net"===t&&(e=$.extend({toolbarModel:this.modelManager.toolbarModel,renderModel:this.modelManager.renderModel,dataModel:this.modelManager.dataModel},e),this.addOn.Net=new u(e),this.publicEventEmitter.listenToNetAddon(this.addOn.Net)),this},getRowList:function(){return this.modelManager.dataModel.getRowList()},sort:function(t){this.modelManager.dataModel.sortByField(t)},unSort:function(){this.sort("rowKey")},addCellClassName:function(t,e,i){this.modelManager.dataModel.get(t).addCellClassName(e,i)},addRowClassName:function(t,e){this.modelManager.dataModel.get(t).addClassName(e)},removeCellClassName:function(t,e,i){this.modelManager.dataModel.get(t).removeCellClassName(e,i)},removeRowClassName:function(t,e){this.modelManager.dataModel.get(t).removeClassName(e)},getRowSpanData:function(t,e){return this.modelManager.dataModel.getRowSpanData(t,e)},getIndexOfRow:function(t){return this.modelManager.dataModel.indexOfRowKey(t)},setDisplayRowCount:function(t){this.modelManager.dimensionModel.set("displayRowCount",t)},setSize:function(t,e){this.modelManager.dimensionModel.setSize(t,e)},refreshLayout:function(){this.modelManager.dimensionModel.refreshLayout()},showColumn:function(){var t=tui.util.toArray(arguments);this.modelManager.columnModel.setHidden(t,!1)},hideColumn:function(){var t=tui.util.toArray(arguments);this.modelManager.columnModel.setHidden(t,!0)},validate:function(){return this.modelManager.dataModel.validate()},destroy:function(){this.modelManager.destroy(),this.container.destroy(),this.modelManager=this.container=null}}),tui.Grid.getInstanceById=function(t){return h[t]}},{"./addon/net":2,"./base/view":7,"./common/util":10,"./domState":11,"./model/manager":19,"./painter/manager":37,"./publicEventEmitter":39,"./view/factory":42}],13:[function(t,e,i){"use strict";var n=t("../../base/model"),o=["_button","_number"],s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.textType={normal:!0,text:!0,"text-password":!0,"text-convertible":!0},this._setColumnModelList(this.get("columnModelList")),this.on("change",this._onChange,this)},defaults:{keyColumnName:null,columnFixCount:0,metaColumnModelList:[],dataColumnModelList:[],visibleList:[],hasNumberColumn:!0,selectType:"",columnModelMap:{},relationListMap:{},columnMerge:[]},_initializeMetaColumns:function(t){var e=[];return this._initializeButtonColumn(e),this._initializeNumberColumn(e),this._overwriteColumnModelList(e,t),e},_overwriteColumnModelList:function(t,e){_.each(e,function(e){this._extendColumnList(e,t)},this)},_initializeNumberColumn:function(t){var e=this.get("hasNumberColumn"),i={columnName:"_number",align:"center",title:"No.",isFixedWidth:!0,width:60};e||(i.isHidden=!0),this._extendColumnList(i,t)},_initializeButtonColumn:function(t){var e=this.get("selectType"),i={columnName:"_button",isHidden:!1,editOption:{type:e,list:[{value:"selected"}]},isFixedWidth:!0,width:40};"checkbox"===e?i.title='':"radio"===e?i.title="선택":i.isHidden=!0,this._extendColumnList(i,t)},_extendColumnList:function(t,e){var i=t.columnName,n=_.findIndex(e,{columnName:i});-1===n?e.push(t):e[n]=$.extend(e[n],t)},at:function(t,e){var i=e?this.getVisibleColumnModelList():this.get("dataColumnModelList");return i[t]},indexOfColumnName:function(t,e){var i;return i=e?this.getVisibleColumnModelList():this.get("dataColumnModelList"),_.findIndex(i,{columnName:t})},isLside:function(t){var e=this.indexOfColumnName(t,!0);return e>-1&&e=e?!1:void(t.isHidden&&(i-=1))}),t?i+this.getVisibleMetaColumnCount():i},getColumnModel:function(t){return this.get("columnModelMap")[t]},isTextType:function(t){return!!this.textType[this.getEditType(t)]},getEditType:function(t){var e=this.getColumnModel(t),i="normal";return"_button"===t||"_number"===t?i=t:e&&e.editOption&&e.editOption.type&&(i=e.editOption.type),i},_makeVisibleColumnModelList:function(t,e){return t=t||this.get("metaColumnModelList"),e=e||this.get("dataColumnModelList"),_.filter(t.concat(e),function(t){return!t.isHidden})},_getRelationListMap:function(t){var e,i={};return _.each(t,function(t){e=t.columnName,t.relationList&&(i[e]=t.relationList)}),i},getIgnoredColumnNameList:function(){var t=this.get("dataColumnModelList"),e=[];return _.each(t,function(t){t.isIgnore&&e.push(t.columnName)}),e},_setColumnModelList:function(t,e){var i,n,o,s,a;t=$.extend(!0,[],t),tui.util.isUndefined(e)&&(e=this.get("columnFixCount")),i=_.partition(t,function(t){return this.isMetaColumn(t.columnName)},this),s=this._initializeMetaColumns(i[0]),a=i[1],n=this._getRelationListMap(a),o=this._makeVisibleColumnModelList(s,a),this.set({metaColumnModelList:s,dataColumnModelList:a,columnModelMap:_.indexBy(s.concat(a),"columnName"),relationListMap:n,columnFixCount:Math.max(0,e),visibleList:o},{silent:!0}),this.unset("columnModelList",{silent:!0}),this.trigger("columnModelChange")},_onChange:function(t){var e=t.changed,i=e.columnFixCount,n=e.columnModelList;n||(n=this.get("dataColumnModelList")),this._setColumnModelList(n,i)},setHidden:function(t,e){for(var i,n,o,s;t.length;)i=t.shift(),o=this.getColumnModel(i),o?o.isHidden=e:(n=this.getUnitColumnNamesIfMerged(i),t.push.apply(t,n));s=this._makeVisibleColumnModelList(this.get("metaColumnModelList"),this.get("dataColumnModelList")),this.set("visibleList",s,{silent:!0}),this.trigger("columnModelChange")},getUnitColumnNamesIfMerged:function(t){var e,i,n,o=this.get("columnMerge"),s=[],a=[];for(s.push(t);s.length;)e=s.shift(),i=this.getColumnModel(e),i?a.push(e):(n=_.findWhere(o,{columnName:e}),n&&s.push.apply(s,n.columnNameList));return _.uniq(a)},isMetaColumn:function(t){return _.indexOf(o,t)>=0}});e.exports=s},{"../../base/model":5}],14:[function(t,e,i){"use strict";var n=(t("../../base/model"),t("../../common/util"),tui.util.defineClass({init:function(t){this.data=t},getRowSpanData:function(t,e,i){var n=null;return i&&(n=this.data.rowSpanData,t&&n&&(n=n[t])),!n&&t&&(n={count:0,isMainRow:!0,mainRowKey:e}),n},getRowState:function(){var t={isDisabledCheck:!1,isDisabled:!1,isChecked:!1};switch(this.data.rowState){case"DISABLED":t.isDisabled=!0;case"DISABLED_CHECK":t.isDisabledCheck=!0;break;case"CHECKED":t.isChecked=!0}return t},setRowState:function(t){this.data.rowState=t},setRowSpanData:function(t,e){var i=_.assign({},this.data.rowSpanData);t&&(e?i[t]=e:i[t]&&delete i[t],this.data.rowSpanData=i)},addCellClassName:function(t,e){var i,n;i=this.data.className||{},i.column=i.column||{},n=i.column[t]||[],_.contains(n,e)||(n.push(e),i.column[t]=n,this.data.className=i)},addClassName:function(t){var e,i;e=this.data.className||{},i=e.row||[],-1===tui.util.inArray(t,i)&&(i.push(t),e.row=i,this.data.className=e)},getClassNameList:function(t){var e=this.data.className,i=Array.prototype.push,n=[];return e&&(e.row&&i.apply(n,e.row),t&&e.column&&e.column[t]&&i.apply(n,e.column[t])),n},_removeClassNameFromArray:function(t,e){var i=t.join(" ").split(" ");return _.without(i,e)},removeCellClassName:function(t,e){var i=this.data.className;tui.util.pick(i,"column",t)&&(i.column[t]=this._removeClassNameFromArray(i.column[t],e),this.data.className=i)},removeClassName:function(t){var e=this.data.className;e&&e.row&&(e.row=this._removeClassNameFromArray(e.row,t),this.className=e)}}));e.exports=n},{"../../base/model":5,"../../common/util":10}],15:[function(t,e,i){"use strict";var n=t("../../base/model"),o=t("./extraDataManager"),s=t("../../common/util"),a=["_button","_number","_extraData"],l="REQUIRED",r=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.extraDataManager=new o(this.get("_extraData")),this.columnModel=this.collection.columnModel,this.validateMap={},this.on("change",this._onChange,this)},idAttribute:"rowKey",parse:function(t){return t._extraData||(t._extraData={}),t},_triggerExtraDataChangeEvent:function(){this.trigger("extraDataChanged",this.get("_extraData"))},_onChange:function(){var t=_.omit(this.changed,a);this.isDuplicatedPublicChanged(t)||_.each(t,function(t,e){var i=this.columnModel.getColumnModel(e);i&&this._executeChangeBeforeCallback(e)&&(this.collection.syncRowSpannedData(this,e,t),this._executeChangeAfterCallback(e),this.validateCell(e,!0))},this)},_validateCellData:function(t){var e=this.columnModel.getColumnModel(t),i=this.get(t),n="";return e.isRequired&&s.isBlank(i)&&(n=l),n},validateCell:function(t,e){var i;return!e&&t in this.validateMap?this.validateMap[t]:(i=this._validateCellData(t),i?this.addCellClassName(t,"invalid"):this.removeCellClassName(t,"invalid"),this.validateMap[t]=i,i)},_createChangeCallbackEvent:function(t){return{rowKey:this.get("rowKey"),columnName:t,value:this.get(t),instance:tui.Grid.getInstanceById(this.collection.gridId)}},_executeChangeBeforeCallback:function(t){var e,i,n=this.columnModel.getColumnModel(t);return n.editOption&&n.editOption.changeBeforeCallback&&(e=this._createChangeCallbackEvent(t),n.editOption.changeBeforeCallback(e)===!1)?(i={},i[t]=this.previous(t),this.set(i),this.trigger("restore",{changed:i}),!1):!0},_executeChangeAfterCallback:function(t){var e,i=this.columnModel.getColumnModel(t);return i.editOption&&i.editOption.changeAfterCallback?(e=this._createChangeCallbackEvent(t),!!i.editOption.changeAfterCallback(e)):!0},getPrivateProperties:function(){return a},getRowState:function(){return this.extraDataManager.getRowState()},getClassNameList:function(t){var e=this.columnModel.getColumnModel(t),i=this.extraDataManager.getClassNameList(t);return e.className&&i.push(e.className),e.isEllipsis&&i.push("ellipsis"),e.isRequired&&i.push("required"),this._makeUniqueStringArray(i)},_makeUniqueStringArray:function(t){var e=_.uniq(t.join(" ").split(" "));return _.without(e,"")},getCellState:function(t){var e,i,n=["_number","normal"],o=this.columnModel,s=!1,a=!0,l=o.getEditType(t);return i=this.getRelationResult(["isDisabled","isEditable"])[t],e=this.getRowState(),s="_button"===t?e.isDisabledCheck:e.isDisabled,s=s||!(!i||!i.isDisabled),a=-1!==$.inArray(l,n)?!1:!(i&&i.isEditable===!1),{isEditable:a,isDisabled:s}},isEditable:function(t){var e=["_number","normal"],i=this.columnModel.getEditType(t),n=!1;return-1===$.inArray(i,e)&&(n=this.getCellState(t).isEditable),n},isDisabled:function(t){var e;return e=this.getCellState(t),e.isDisabled},getRowSpanData:function(t){var e=this.collection.isRowSpanEnable(),i=this.get("rowKey");return this.extraDataManager.getRowSpanData(t,i,e)},setRowSpanData:function(t,e){this.extraDataManager.setRowSpanData(t,e),this._triggerExtraDataChangeEvent()},setRowState:function(t,e){this.extraDataManager.setRowState(t),e||this._triggerExtraDataChangeEvent()},addCellClassName:function(t,e){this.extraDataManager.addCellClassName(t,e),this._triggerExtraDataChangeEvent()},addClassName:function(t){this.extraDataManager.addClassName(t),this._triggerExtraDataChangeEvent()},removeCellClassName:function(t,e){this.extraDataManager.removeCellClassName(t,e),this._triggerExtraDataChangeEvent()},removeClassName:function(t){this.extraDataManager.removeClassName(t),this._triggerExtraDataChangeEvent()},getHTMLEncodedString:function(t){var e=this.columnModel.getColumnModel(t),i=this.columnModel.isTextType(t),n=this.get(t),o=e.notUseHtmlEntity;return!o&&i&&tui.util.hasEncodableString(n)&&(n=tui.util.encodeHTMLEntity(n)),n},_getListTypeVisibleText:function(t){var e,i,n,o,a=this.get(t),l=this.columnModel.getColumnModel(t);return tui.util.isExisty(tui.util.pick(l,"editOption","list"))?(e=this.getRelationResult(["optionListChange"])[t],i=e&&e.optionList?e.optionList:l.editOption.list,n=typeof i[0].value,o=a.toString().split(","),n!==typeof o[0]&&(o=_.map(o,function(t){return s.convertValueType(t,n)})),_.each(o,function(t,e){var n=_.findWhere(i,{value:t});o[e]=n&&n.text||""},this),o.join(",")):void 0},isDuplicatedPublicChanged:function(t){return this._timeoutIdForChanged&&_.isEqual(this._lastPublicChanged,t)?!0:(clearTimeout(this._timeoutIdForChanged),this._timeoutIdForChanged=setTimeout(_.bind(function(){this._timeoutIdForChanged=null},this),10),this._lastPublicChanged=t,!1)},getVisibleText:function(t){var e,i,n=this.columnModel,o=this.get(t),a={select:!0,radio:!0,checkbox:!0};if(n)if(e=n.getEditType(t),i=n.getColumnModel(t),a[e]){if(!tui.util.isExisty(tui.util.pick(i,"editOption","list",0,"value")))throw this.error('Check "'+t+"\"'s editOption.list property out in your ColumnModel.");o=this._getListTypeVisibleText(t)}else _.isFunction(i.formatter)&&(o=s.stripTags(i.formatter(this.getHTMLEncodedString(t),this.toJSON(),i)));return o=tui.util.isUndefined(o)?o:o.toString()},getRelationResult:function(t){var e,i,n,o,s=this.attributes,a=this.columnModel.get("relationListMap"),l={},r=this.getRowState();return t=t&&t.length?t:["optionListChange","isDisabled","isEditable"],_.each(a,function(a,u){o=s[u],_.each(a,function(a){n=a.columnList,_.each(t,function(t){r.isDisabled&&"isDisabled"===t||(e=a[t],"function"==typeof e&&(i="","optionListChange"===t?i="optionList":"isDisabled"===t?i="isDisabled":"isEditable"===t&&(i="isEditable"),i&&_.each(n,function(t){l[t]=l[t]||{},l[t][i]=e(o,s); +},this)))},this)},this)},this),l}},{privateProperties:a});e.exports=r},{"../../base/model":5,"../../common/util":10,"./extraDataManager":14}],16:[function(t,e,i){"use strict";var n=t("../../base/collection"),o=t("./row"),s=n.extend({initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({columnModel:e.columnModel,domState:e.domState,gridId:e.gridId,lastRowKey:-1,originalRowList:[],originalRowMap:{},startIndex:e.startIndex||1,sortOptions:{columnName:"rowKey",isAscending:!0,useClient:_.isBoolean(e.useClientSort)?e.useClientSort:!0},isDisabled:!1}),this.sortOptions.useClient||(this.comparator=null)},model:o,parse:function(t){return t=t&&t.contents||t,this._formatData(t)},_formatData:function(t){var e=_.filter(t,_.isObject);return _.each(e,function(t,i){e[i]=this._baseFormat(e[i]),this.isRowSpanEnable()&&this._setExtraRowSpanData(e,i)},this),e},_baseFormat:function(t){var e={rowSpan:null,rowSpanData:null,rowState:null},i=this.columnModel.get("keyColumnName"),n=null===i?this._createRowKey():t[i];return t._extraData=$.extend(e,t._extraData),t._button="CHECKED"===t._extraData.rowState,t.rowKey=n,t},_createRowKey:function(){return this.lastRowKey+=1,this.lastRowKey},_setExtraRowSpanData:function(t,e){function i(t,e){var i=t._extraData;return!(!i.rowSpanData||!i.rowSpanData[e])}function n(t,e,i){var n=t._extraData;return n.rowSpanData=n&&n.rowSpanData||{},n.rowSpanData[e]=i,n}var o,s,a,l=t[e],r=l&&l._extraData&&l._extraData.rowSpan,u=l&&l.rowKey;return r&&_.each(r,function(r,d){if(!i(l,d))for(n(l,d,{count:r,isMainRow:!0,mainRowKey:u}),o=-1,a=e+1;e+r>a;a+=1)s=t[a],s[d]=l[d],s._extraData=s._extraData||{},n(s,d,{count:o,isMainRow:!1,mainRowKey:u}),o-=1}),t},setOriginalRowList:function(t){return this.originalRowList=t?this._formatData(t):this.toJSON(),this.originalRowMap=_.indexBy(this.originalRowList,"rowKey"),this.originalRowList},getOriginalRowList:function(t){return t=void 0===t?!0:t,t?_.clone(this.originalRowList):this.originalRowList},getOriginalRow:function(t){return _.clone(this.originalRowMap[t])},getOriginal:function(t,e){return _.clone(this.originalRowMap[t][e])},getMainRowKey:function(t,e){var i,n=this.get(t);return this.isRowSpanEnable()&&(i=n&&n.getRowSpanData(e),t=i?i.mainRowKey:t),t},indexOfRowKey:function(t){return this.indexOf(this.get(t))},isRowSpanEnable:function(){return!this.isSortedByField()},isSortedByField:function(){return"rowKey"!==this.sortOptions.columnName},setSortOptionValues:function(t,e,i){var n=this.sortOptions,o=!1;_.isUndefined(t)&&(t="rowKey"),_.isUndefined(e)&&(e=!0),(n.columnName!==t||n.isAscending!==e)&&(o=!0),n.columnName=t,n.isAscending=e,o&&this.trigger("sortChanged",{columnName:t,isAscending:e,isRequireFetch:i})},sortByField:function(t,e){var i=this.sortOptions;_.isUndefined(e)&&(e=i.columnName===t?!i.isAscending:!0),this.setSortOptionValues(t,e,!i.useClient),i.useClient&&this.sort()},getRowList:function(t,e){var i,n;return t?(n=this.where({_button:!0}),i=[],_.each(n,function(t){i.push(t.attributes)},this)):i=this.toJSON(),e?i:this._removePrivateProp(i)},syncRowSpannedData:function(t,e,i){var n,o,s;if(this.isRowSpanEnable())if(o=t.getRowSpanData(e),o.isMainRow)for(n=this.indexOfRowKey(t.get("rowKey")),s=0;so?a=-1:o>s&&(a=1),n||(a=-a),a},_removePrivateProp:function(t){return _.map(t,function(t){return _.omit(t,o.privateProperties)})},removeRow:function(t,e){var i,n,o,s=this.get(t);s&&(e&&e.keepRowSpanData&&(o=_.clone(s.attributes)),i=_.clone(s.getRowSpanData()),n=this.at(this.indexOf(s)+1),this.remove(s,{silent:!0}),this._syncRowSpanDataForRemove(i,n,o),e&&e.removeOriginalData&&this.setOriginalRowList(),this.trigger("remove"))},_syncRowSpanDataForRemove:function(t,e,i){t&&_.each(t,function(t,n){var o,s,a,l={};if(t.isMainRow){if(1===t.count)return;o=e,a=t.count-1,s=1,a>1&&(l.mainRowKey=o.get("rowKey"),l.isMainRow=!0),o.set(n,i?i[n]:"",{silent:!0})}else o=this.get(t.mainRowKey),a=o.getRowSpanData(n).count-1,s=-t.count;a>1?(l.count=a,o.setRowSpanData(n,l),this._updateSubRowSpanData(o,n,s,a)):o.setRowSpanData(n,null)},this)},_createDummyRow:function(){var t=this.columnModel.get("dataColumnModelList"),e={};return _.each(t,function(t){e[t.columnName]=""},this),e},append:function(t,e){var i,n=this._createModelList(t);return e=_.extend({at:this.length},e),i={at:e.at,add:!0,silent:!0},this.add(n,i),this._syncRowSpanDataForAppend(e.at,n.length,e.extendPrevRowSpan),this.trigger("add",n,e),n},prepend:function(t,e){return e=e||{},e.at=0,this.append(t,e)},getRowData:function(t,e){var i=this.get(t),n=i?i.toJSON():null;return e?$.toJSON(n):n},getRowDataAt:function(t,e){var i=this.at(t),n=i?i.toJSON():null;return e?$.toJSON(i):n},getValue:function(t,e,i){var n,o;return i?n=this.getOriginal(t,e):(o=this.get(t),n=o&&o.get(e)),n},setValue:function(t,e,i,n){var o,s=this.get(t),a={};return i=_.isString(i)?$.trim(i):i,s?(a[e]=i,s.set(a,{silent:n}),o=!0):o=!1,o},getColumnValues:function(t,e){var i=this.pluck(t);return e?$.toJSON(i):i},setColumnValues:function(t,e,i,n){var o={},s={isDisabled:!1,isEditable:!0};o[t]=e,i=void 0===i?!0:i,this.forEach(function(e){i&&(s=e.getCellState(t)),!s.isDisabled&&s.isEditable&&e.set(o,{silent:n})},this)},getRowSpanData:function(t,e){var i=this.get(t);return i?i.getRowSpanData(e):null},isChanged:function(){var t=_.values(this.getModifiedRowList());return _.some(t,function(t){return t.length>0})},setDisabled:function(t){this.isDisabled!==t&&(this.isDisabled=t,this.trigger("disabledChanged"))},enableRow:function(t){this.get(t).setRowState("")},disableRow:function(t){this.get(t).setRowState("DISABLED")},enableCheck:function(t){this.get(t).setRowState("")},disableCheck:function(t){this.get(t).setRowState("DISABLED_CHECK")},check:function(t,e){var i=this.get(t).getRowState().isDisabledCheck,n=this.columnModel.get("selectType");!i&&n&&("radio"===n&&this.uncheckAll(),this.setValue(t,"_button",!0,e))},uncheck:function(t,e){this.setValue(t,"_button",!1,e)},checkAll:function(){this.setColumnValues("_button",!0)},uncheckAll:function(){this.setColumnValues("_button",!1)},_createModelList:function(t){var e,i=[];return t=t||this._createDummyRow(),_.isArray(t)||(t=[t]),e=this._formatData(t),_.each(e,function(t){var e;e=new o(t,{collection:this,parse:!0}),i.push(e)},this),i},_syncRowSpanDataForAppend:function(t,e,i){var n=this.at(t-1);n&&_.each(n.getRowSpanData(),function(t,o){var s,a,l,r;0!==t.count&&(t.isMainRow?(s=n,a=t,l=1):(s=this.get(t.mainRowKey),a=s.getRowSpanData()[o],l=-t.count+1),(a.count>l||i)&&(a.count+=e,r=a.count,this._updateSubRowSpanData(s,o,l,r)))},this)},_updateSubRowSpanData:function(t,e,i,n){var o,s,a=this.indexOf(t),l=t.get("rowKey");for(s=i;n>s;s+=1)o=this.at(a+s),o.set(e,t.get(e),{silent:!0}),o.setRowSpanData(e,{count:-s,mainRowKey:l,isMainRow:!1})},_isModifiedRow:function(t,e,i){var n=_.omit(t,i),o=_.some(n,function(t,i){return"object"==typeof t?$.toJSON(t)!==$.toJSON(e[i]):t!==e[i]},this);return o},getModifiedRowList:function(t){var e=t&&t.isRaw,i=t&&t.isOnlyChecked,n=t&&t.isOnlyRowKeyList,o=e?this.originalRowList:this._removePrivateProp(this.originalRowList),s=e?this.toJSON():this._removePrivateProp(this.toJSON()),a=t&&t.filteringColumnList,l={createList:[],updateList:[],deleteList:[]};return o=_.indexBy(o,"rowKey"),s=_.indexBy(s,"rowKey"),a=_.union(a,this.columnModel.getIgnoredColumnNameList()),_.each(s,function(t,e){var s=o[e],r=n?t.rowKey:t;(!i||i&&this.get(e).get("_button"))&&(s?this._isModifiedRow(t,s,a)&&l.updateList.push(r):l.createList.push(r))},this),_.each(o,function(t,e){var i=n?t.rowKey:t;s[e]||l.deleteList.push(i)},this),l},_resetData:function(t,e,i){this.lastRowKey=-1,this.reset(t,{parse:e}),_.isFunction(i)&&i()},replaceRowList:function(t,e,i){_.isUndefined(e)&&(e=!0),this.trigger("beforeReset"),t&&t.length>500?_.defer(_.bind(this._resetData,this,t,e,i)):this._resetData(t,e,i)},setRowList:function(t,e,i){var n=_.bind(function(){this.setOriginalRowList(),_.isFunction(i)&&i()},this);this.replaceRowList(t,e,n)},restore:function(){var t=this.getOriginalRowList();this.replaceRowList(t,!0)},del:function(t,e,i){var n=this.getMainRowKey(t,e),o=this.get(n).getCellState(e),s=this.columnModel.getEditType(e),a=_.contains(["text","text-convertible","text-password"],s);a&&o.isEditable&&!o.isDisabled&&this.setValue(n,e,"",i)},paste:function(t,e){var i=this._getEndIndexToPaste(t,e);_.each(t,function(t,n){this._setValueForPaste(t,e.row+n,e.column,i.column)},this),this.trigger("paste",{startIdx:e,endIdx:i})},validate:function(){var t=[],e=_.chain(this.columnModel.getVisibleColumnModelList()).filter(function(t){return t.isRequired===!0}).pluck("columnName").value();return this.each(function(i){var n=[];_.each(e,function(t){var e=i.validateCell(t);e&&n.push({columnName:t,errorCode:e})}),n.length&&t.push({rowKey:i.get("rowKey"),errors:n})}),t},_getEndIndexToPaste:function(t,e){var i=this.columnModel.getVisibleColumnModelList(),n=t.length+e.row-1,o=Math.min(t[0].length+e.column,i.length)-1;return{row:n,column:o}},_setValueForPaste:function(t,e,i,n){var o,s,a,l,r=this.at(e),u=this.columnModel,d={};for(r||(r=this.append({})[0]),o=i;n>=o;o+=1)s=u.at(o,!0).columnName,a=r.getCellState(s),l=r.getRowSpanData(s),a.isEditable&&!a.isDisabled&&(!l||l.count>=0)&&(d[s]=t[o-i]);r.set(d)},getElement:function(t,e){var t=this.getMainRowKey(t,e);return this.domState.getElement(t,e)}});e.exports=s},{"../../base/collection":3,"./row":15}],17:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=t("../common/constMap").dimension,a=s.TABLE_BORDER_WIDTH,l=s.CELL_BORDER_WIDTH,r=n.extend({initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this._columnWidthFixedFlags=null,this._minColumnWidthList=null,this.columnModel=e.columnModel,this.dataModel=e.dataModel,this.domState=e.domState,this.listenTo(this.columnModel,"columnModelChange",this._initColumnWidthVariables),this.listenTo(this.dataModel,"add remove reset",this._resetTotalRowHeight),this.on("change:width",this._onWidthChange,this),this.on("change:bodyHeight",this._resetDisplayRowCount,this),this.on("change:displayRowCount",this._resetBodyHeight,this),this._initColumnWidthVariables(),this._resetBodyHeight()},models:null,columnModel:null,defaults:{offsetLeft:0,offsetTop:0,width:0,headerHeight:0,bodyHeight:0,toolbarHeight:65,rowHeight:0,totalRowHeight:0,rsideWidth:0,lsideWidth:0,columnWidthList:[],minimumColumnWidth:0,displayRowCount:1,scrollBarSize:17,scrollX:!0,scrollY:!0,fitToParentHeight:!1},_getAvailableTotalWidth:function(t){var e=this.get("width"),i=e-this.getScrollYWidth()-t-1;return this.columnModel.getVisibleColumnFixCount(!0)>0&&(i-=l),i},_applyMinimumColumnWidth:function(t){var e=this._minColumnWidthList,i=_.clone(t);return _.each(i,function(t,n){var o=e[n];o>t&&(i[n]=o)}),i},_resetTotalRowHeight:function(){var t=this.get("rowHeight"),e=this.dataModel.length,i=e+1;this.set("totalRowHeight",t*e+i)},_resetDisplayRowCount:function(){var t,e;_.has(this.changed,"displayRowCount")||(t=this.get("bodyHeight")-this.getScrollXHeight(),e=o.getDisplayRowCount(t,this.get("rowHeight")),this.set("displayRowCount",e))},_fillEmptyColumnWidth:function(t){var e=this._getAvailableTotalWidth(t.length),i=e-o.sum(t),n=[];return _.each(t,function(t,e){t||n.push(e)}),this._distributeExtraWidthEqually(t,i,n)},_addExtraColumnWidth:function(t,e){var i=this._columnWidthFixedFlags,n=[];return _.each(i,function(t,e){t||n.push(e)}),this._distributeExtraWidthEqually(t,e,n)},_reduceExcessColumnWidth:function(t,e){var i=this._minColumnWidthList,n=this._columnWidthFixedFlags,o=[];return _.each(t,function(t,e){n[e]||o.push({index:e,width:t-i[e]})}),this._reduceExcessColumnWidthSub(_.clone(t),e,o)},_reduceExcessColumnWidthSub:function(t,e,i){var n,o=Math.round(e/i.length),s=[];return _.each(i,function(i){i.widths.length?this._reduceExcessColumnWidthSub(t,e,s):(n=_.pluck(i,"index"),this._distributeExtraWidthEqually(t,e,n))},_distributeExtraWidthEqually:function(t,e,i){var n=i.length,o=Math.round(e/n),s=o*n-e,a=_.clone(t);return _.each(i,function(t){a[t]+=o}),a[_.last(i)]-=s,a},_adjustColumnWidthList:function(t,e){var i,n=t.length,s=this._getAvailableTotalWidth(n),a=s-o.sum(t),l=_.filter(this._columnWidthFixedFlags).length;return a>0?n>l?i=this._addExtraColumnWidth(t,a):(i=_.clone(t),i[n-1]+=a):i=e&&0>a?this._reduceExcessColumnWidth(t,a):t,i},_initColumnWidthVariables:function(){var t,e=this.columnModel.getVisibleColumnModelList(null,!0),i=this.get("minimumColumnWidth"),n=[],o=[],s=[];_.each(e,function(t){var e=t.width>0?t.width:0,a=Math.max(e,i);n.push(e?a:0),s.push(a),o.push(!!t.isFixedWidth)}),this._columnWidthFixedFlags=o,this._minColumnWidthList=s,t=_.compose(this._adjustColumnWidthList,this._applyMinimumColumnWidth,this._fillEmptyColumnWidth),this._setColumnWidthVariables(t.call(this,n),!0)},getFrameWidth:function(t){var e=this.columnModel.getVisibleColumnFixCount(!0),i=this.getColumnWidthList(t),n=this._getFrameWidth(i);return tui.util.isUndefined(t)&&e>0&&(n+=1),n},_getFrameWidth:function(t){var e=0;return t.length&&(e=o.sum(t)+(t.length+1)*l),e},_setColumnWidthVariables:function(t,e){var i,n,o,s,a=this.get("width"),l=this.columnModel.getVisibleColumnFixCount(!0),r=this._getMaxLeftSideWidth();o=t.slice(0,l),s=t.slice(l),n=this._getFrameWidth(o),r&&n>r&&(o=this._adjustLeftSideWidthList(o,r),n=this._getFrameWidth(o),t=o.concat(s)),i=a-n,this.set({columnWidthList:t,rsideWidth:i,lsideWidth:n}),e&&this.set("originalWidthList",_.clone(t)),this.trigger("columnWidthChanged")},_getMinLeftSideWidth:function(){var t,e=this.get("minimumColumnWidth"),i=this.columnModel.getVisibleColumnFixCount(!0),n=0;return i&&(t=(i+1)*l,n=t+e*i),n},_getMaxLeftSideWidth:function(){var t=Math.ceil(.9*this.get("width"));return t&&(t=Math.max(t,this._getMinLeftSideWidth())),t},getCellPosition:function(t,e){var i,n,s,a,r,u,d,h,c=this.dataModel,m=this.columnModel,g=this.get("rowHeight"),f=c.get(t),p=m.getVisibleMetaColumnCount(),_=this.get("columnWidthList").slice(p),M=m.getVisibleColumnFixCount(),w=m.indexOfColumnName(e,!0);if(!f)return{};for(i=c.get(t).getRowSpanData(e),i.isMainRow||(t=i.mainRowKey,i=c.get(t).getRowSpanData(e)),s=i.count||1,n=c.indexOfRowKey(t),a=o.getHeight(n,g),d=a+o.getHeight(s,g)-l,r=h=0,w>=M&&(h=M);w>h;h+=1)r+=_[h]+l;return u=r+_[h]+l,{top:a,left:r,right:u,bottom:d}},getScrollPosition:function(t,e){var i=!this.columnModel.isLside(e),n=this.getCellPosition(t,e),o=this._getBodySize(),s=this._judgeScrollDirection(n,i,o);return this._makeScrollPosition(s,n,o)},_getBodySize:function(){var t=this.get("lsideWidth"),e=this.get("rsideWidth")-this.getScrollYWidth(),i=this.get("bodyHeight")-this.getScrollXHeight();return{height:i,rsideWidth:e,totalWidth:t+e}},_judgeScrollDirection:function(t,e,i){var n,o,s,a,l=this.renderModel,r=l.get("scrollTop"),u=l.get("scrollLeft");return n=t.topr+i.height,e?(s=t.leftu+i.rsideWidth-1):s=a=!1,{isUp:n,isDown:o,isLeft:s,isRight:a}},_makeScrollPosition:function(t,e,i){var n={};return t.isUp?n.scrollTop=e.top:t.isDown&&(n.scrollTop=e.bottom-i.height),t.isLeft?n.scrollLeft=e.left:t.isRight&&(n.scrollLeft=e.right-i.rsideWidth+a),n},getOverflowFromMousePosition:function(t,e){var i=this._rebasePositionToContainer(t,e),n=this._getBodySize();return this._judgeOverflow(i,n)},_judgeOverflow:function(t,e){var i=t.x,n=t.y,o=0,s=0;return 0>n?o=-1:n>e.height&&(o=1),0>i?s=-1:i>e.totalWidth&&(s=1),{x:s,y:o}},getIndexFromMousePosition:function(t,e,i){var n=this._rebasePositionToContainer(t,e);return{row:this._calcRowIndexFromPositionY(n.y),column:this._calcColumnIndexFromPositionX(n.x,i)}},_calcRowIndexFromPositionY:function(t){var e=t+this.renderModel.get("scrollTop"),i=Math.floor(e/(this.get("rowHeight")+l)),n=0,s=Math.max(n,this.dataModel.length-1);return o.clamp(i,n,s)},_calcColumnIndexFromPositionX:function(t,e){var i=this.getColumnWidthList(),n=this.getFrameWidth(),o=t,s=t>=this.get("lsideWidth"),a=e?0:this.columnModel.getVisibleMetaColumnCount(),l=0;return s&&(o+=this.renderModel.get("scrollLeft")),o>=n?l=i.length-1:tui.util.forEachArray(i,function(t,e){return o>t?void(o-=t):(l=e,!1)}),Math.max(0,l-a)},_rebasePositionToContainer:function(t,e){var i=t-this.get("offsetLeft"),n=e-(this.get("offsetTop")+this.get("headerHeight")+2);return{x:i,y:n}},_adjustLeftSideWidthList:function(t,e){var i,n=t.length-1,o=this.get("minimumColumnWidth"),s=this._getFrameWidth(t),a=s-e;if(a>0)for(;n>=0&&a>0;)i=Math.max(o,t[n]-a),a-=t[n]-i,t[n]=i,n-=1;else 0>a&&(t[n]+=Math.abs(a));return t},_resetBodyHeight:function(){var t;_.has(this.changed,"bodyHeight")||(t=o.getHeight(this.get("displayRowCount"),this.get("rowHeight")),this.set("bodyHeight",t+this.getScrollXHeight()))},getScrollXHeight:function(){return this.get("scrollX")?this.get("scrollBarSize"):0},getScrollYWidth:function(){return this.get("scrollY")?this.get("scrollBarSize"):0},_onWidthChange:function(){var t=this._adjustColumnWidthList(this.get("columnWidthList"),!0);this._setColumnWidthVariables(t)},setColumnWidth:function(t,e){var i,n=this.get("columnWidthList"),o=this._columnWidthFixedFlags,s=this._minColumnWidthList[t];!o[t]&&n[t]&&(n[t]=Math.max(e,s),o[t]=!0,i=this._adjustColumnWidthList(n),o[t]=!1,this._setColumnWidthVariables(i))},_calcRealBodyHeight:function(t){return t-this.get("headerHeight")-this.get("toolbarHeight")-a},_getMinBodyHeight:function(){return this.get("rowHeight")+2*l+this.getScrollXHeight()},_setHeight:function(t){this.set("bodyHeight",Math.max(this._calcRealBodyHeight(t),this._getMinBodyHeight()))},setSize:function(t,e){t>0&&this.set("width",t),e>0&&this._setHeight(e),this.trigger("setSize")},getHeight:function(){return this.get("bodyHeight")+this.get("headerHeight")+this.get("toolbarHeight")},refreshLayout:function(){var t=this.domState,e=t.getOffset();this.set({offsetTop:e.top,offsetLeft:e.left,width:t.getWidth()}),this.get("fitToParentHeight")&&this._setHeight(t.getParentHeight())},restoreColumnWidth:function(t){var e=this.get("originalWidthList")[t];this.setColumnWidth(t,e)},getColumnWidthList:function(t){var e=this.columnModel.getVisibleColumnFixCount(!0),i=[];switch(t){case"l":case"L":i=this.get("columnWidthList").slice(0,e);break;case"r":case"R":i=this.get("columnWidthList").slice(e);break;default:i=this.get("columnWidthList")}return i}});e.exports=r},{"../base/model":5,"../common/constMap":8,"../common/util":10}],18:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=n.extend({initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this.dataModel=e.dataModel,this.columnModel=e.columnModel,this.dimensionModel=e.dimensionModel,this.renderModel=e.renderModel,this.cellFactory=e.cellFactory,this.domState=e.domState,this.listenTo(this.dataModel,"add",this._onAddData),this.listenTo(this.dataModel,"reset",this._onResetData)},defaults:{rowKey:null,columnName:"",prevRowKey:null,prevColumnName:""},_onAddData:function(t,e){e.focus&&this.focusAt(e.at,0)},_onResetData:function(){this.unselect(!0)},_savePrevious:function(){return null!==this.get("rowKey")&&this.set("prevRowKey",this.get("rowKey")),this.get("columnName")&&this.set("prevColumnName",this.get("columnName")),this},_clearPrevious:function(){this.set({prevRowKey:null,prevColumnName:""})},_isCurrentRow:function(t){return this.get("rowKey")==t},_isCurrentCell:function(t,e){return this._isCurrentRow(t)&&this.get("columnName")===e},select:function(t){return this._isCurrentRow(t)?this:(this.unselect().set("rowKey",t),"radio"===this.columnModel.get("selectType")&&this.dataModel.check(t),this.trigger("select",{rowKey:t,rowData:this.dataModel.getRowData(t)}),this)},unselect:function(t){return t&&this.blur(),this.trigger("unselect",this.get("rowKey")),this.set({rowKey:null}),this},focus:function(t,e,i){return o.isBlank(t)||o.isBlank(e)||this.columnModel.isMetaColumn(e)||this._isCurrentCell(t,e)?this:(this.blur().select(t).set("columnName",e).trigger("focus",t,e),i&&this.scrollToFocus(),this)},focusAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0);n&&o&&this.focus(n.get("rowKey"),o.columnName,i)},focusIn:function(t,e,i){this.focus(t,e,i),t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t).isEditable(e)?this.trigger("focusIn",t,e):this.focusClipboard()},focusInAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0);n&&o&&this.focusIn(n.get("rowKey"),o.columnName,i)},focusClipboard:function(){this.trigger("focusClipboard")},refreshState:function(){this.domState.hasFocusedElement()?this.has()||this.restore()||this.focusAt(0,0):this.blur()},scrollToFocus:function(){var t=this.get("rowKey"),e=this.get("columnName"),i=this.dimensionModel.getScrollPosition(t,e);tui.util.isEmpty(i)||this.renderModel.set(i)},blur:function(){return this.has()&&(this._savePrevious(),this.trigger("blur",this.get("rowKey"),this.get("columnName")),null!==this.get("rowKey")&&this.set("columnName","")),this},which:function(){return{rowKey:this.get("rowKey"),columnName:this.get("columnName")}},indexOf:function(t){var e=t?this.get("prevRowKey"):this.get("rowKey"),i=t?this.get("prevColumnName"):this.get("columnName");return{row:this.dataModel.indexOfRowKey(e),column:this.columnModel.indexOfColumnName(i,!0)}},has:function(){return this._isValidCell(this.get("rowKey"),this.get("columnName"))},restore:function(){var t=this.get("prevRowKey"),e=this.get("prevColumnName"),i=!1;return this._isValidCell(t,e)&&(this.focus(t,e),i=!0),i},_isValidCell:function(t,e){var i=!o.isBlank(t)&&!!this.dataModel.get(t),n=!o.isBlank(e)&&!!this.columnModel.getColumnModel(e);return i&&n},_findRowKey:function(t){var e,i,n=this.dataModel;return this.has()?(e=Math.max(Math.min(n.indexOfRowKey(this.get("rowKey"))+t,this.dataModel.length-1),0),i=n.at(e),i&&i.get("rowKey")):void 0},_findColumnName:function(t){var e,i=this.columnModel,n=i.getVisibleColumnModelList(),o=i.indexOfColumnName(this.get("columnName"),!0);return this.has()?(e=Math.max(Math.min(o+t,n.length-1),0),n[e]&&n[e].columnName):void 0},_getRowSpanData:function(t,e){return this.dataModel.get(t).getRowSpanData(e)},nextRowIndex:function(t){var e=this.nextRowKey(t);return this.dataModel.indexOfRowKey(e)},prevRowIndex:function(t){var e=this.prevRowKey(t);return this.dataModel.indexOfRowKey(e)},nextColumnIndex:function(){var t=this.nextColumnName();return this.columnModel.indexOfColumnName(t,!0)},prevColumnIndex:function(){var t=this.prevColumnName();return this.columnModel.indexOfColumnName(t,!0)},nextRowKey:function(t){var e,i,n=this.which(),o=n.rowKey;return t="number"==typeof t?t:1,t>1?(o=this._findRowKey(t),i=this._getRowSpanData(o,n.columnName),i.isMainRow||(o=this._findRowKey(i.count+t))):(i=this._getRowSpanData(o,n.columnName),i.isMainRow&&i.count>0?o=this._findRowKey(i.count):i.isMainRow?o=this._findRowKey(1):(e=i.count,i=this._getRowSpanData(i.mainRowKey,n.columnName),o=this._findRowKey(i.count+e))),o},prevRowKey:function(t){var e,i=this.which(),n=i.rowKey;return t="number"==typeof t?t:1,t*=-1,-1>t?(n=this._findRowKey(t),e=this._getRowSpanData(n,i.columnName),e.isMainRow||(n=this._findRowKey(e.count+t))):(e=this._getRowSpanData(n,i.columnName),n=e.isMainRow?this._findRowKey(-1):this._findRowKey(e.count-1)),n},nextColumnName:function(){return this._findColumnName(1)},prevColumnName:function(){return this._findColumnName(-1)},firstRowKey:function(){return this.dataModel.at(0).get("rowKey")},lastRowKey:function(){return this.dataModel.at(this.dataModel.length-1).get("rowKey")},firstColumnName:function(){var t=this.columnModel.getVisibleColumnModelList();return t[0].columnName},lastColumnName:function(){var t=this.columnModel.getVisibleColumnModelList(),e=t.length-1;return t[e].columnName}});e.exports=s},{"../base/model":5,"../common/util":10}],19:[function(t,e,i){"use strict";var n=t("./data/columnModel"),o=t("./data/rowList"),s=t("./toolbar"),a=t("./dimension"),l=t("./focus"),r=t("./renderer"),u=t("./renderer-smart"),d=t("./selection"),h=(t("../common/util"),t("../common/constMap").renderState,{columnFixCount:0,columnModelList:[],keyColumnName:null,selectType:"",autoNumbering:!0,headerHeight:35,rowHeight:27,fitToParentHeight:!1,showDummyRows:!1,displayRowCount:10,minimumColumnWidth:50,notUseSmartRendering:!1,columnMerge:[],scrollX:!0,scrollY:!0,useClientSort:!0,singleClickEdit:!1,toolbar:{hasResizeHandler:!0,hasControlPanel:!0,hasPagination:!0}}),c=tui.util.defineClass({init:function(t,e){t=$.extend(!0,{},h,t),this.gridId=t.gridId,this.columnModel=this._createColumnModel(t),this.dataModel=this._createDataModel(t,e),this.toolbarModel=this._createToolbarModel(t),this.dimensionModel=this._createDimensionModel(t,e),this.renderModel=this._createRenderModel(t),this.focusModel=this._createFocusModel(e),this.selectionModel=this._createSelectionModel(),this.dimensionModel.renderModel=this.renderModel},_createColumnModel:function(t){return new n({hasNumberColumn:t.autoNumbering,keyColumnName:t.keyColumnName,columnFixCount:t.columnFixCount,selectType:t.selectType,columnMerge:t.columnMerge,columnModelList:t.columnModelList})},_createDataModel:function(t,e){return new o([],{gridId:this.gridId,domState:e,columnModel:this.columnModel,useClientSort:t.useClientSort})},_createToolbarModel:function(t){return new s(t.toolbar)},_createDimensionModel:function(t,e){var i={headerHeight:t.headerHeight,rowHeight:t.rowHeight,fitToParentHeight:t.fitToParentHeight,scrollX:!!t.scrollX,scrollY:!!t.scrollY,minimumColumnWidth:t.minimumColumnWidth,displayRowCount:t.displayRowCount};return this.toolbarModel.isVisible()||(i.toolbarHeight=0),new a(i,{columnModel:this.columnModel,dataModel:this.dataModel,domState:e})},_createFocusModel:function(t){return new l(null,{columnModel:this.columnModel,dataModel:this.dataModel,dimensionModel:this.dimensionModel,renderModel:this.renderModel,domState:t})},_createSelectionModel:function(){return new d(null,{columnModel:this.columnModel,dataModel:this.dataModel,dimensionModel:this.dimensionModel,renderModel:this.renderModel,focusModel:this.focusModel})},_createRenderModel:function(t){var e,i,n;return e={emptyMessage:t.emptyMessage,showDummyRows:t.showDummyRows},i={columnModel:this.columnModel,dataModel:this.dataModel,dimensionModel:this.dimensionModel},new(n=t.notUseSmartRendering?r:u)(e,i)},destroy:function(){_.each(this,function(t,e){t&&tui.util.isFunction(t._destroy)&&t._destroy(),t&&tui.util.isFunction(t.stopListening)&&t.stopListening(),this[e]=null},this)}});e.exports=c},{"../common/constMap":8,"../common/util":10,"./data/columnModel":13,"./data/rowList":16,"./dimension":17,"./focus":18,"./renderer":21,"./renderer-smart":20,"./selection":24,"./toolbar":25}],20:[function(t,e,i){"use strict";var n=t("./renderer"),o=t("../common/util"),s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.on("change:scrollTop",this._onChange,this),this.listenTo(this.dimensionModel,"change:bodyHeight",this._onChange,this),this.setOwnProperties({hiddenRowCount:10,criticalPoint:3})},_onChange:function(){this._isRenderable(this.get("scrollTop"))&&this.refresh()},_setRenderingRange:function(t){var e,i=this.dimensionModel,n=this.dataModel,s=i.get("rowHeight"),a=i.get("displayRowCount"),l=Math.max(0,Math.ceil(t/(s+1))-this.hiddenRowCount),r=Math.min(n.length-1,l+a+2*this.hiddenRowCount);n.isRowSpanEnable()&&(l+=this._getStartRowSpanMinCount(l),r+=this._getEndRowSpanMaxCount(r)),e=0===l?0:o.getHeight(l,s)-1,this.set({top:e,startIndex:l,endIndex:r})},_getStartRowSpanMinCount:function(t){var e,i=this.dataModel.at(t),n=0;return i&&(e=_.pluck(i.getRowSpanData(),"count"),e.push(0),n=_.min(e)),n},_getEndRowSpanMaxCount:function(t){var e,i=this.dataModel.at(t),n=0;return i&&(e=_.pluck(i.getRowSpanData(),"count"),e.push(0),n=_.max(e)),n},_isRenderable:function(t){var e=this.dimensionModel,i=this.dataModel,n=e.get("rowHeight"),o=e.get("bodyHeight"),s=i.length,a=Math.max(0,Math.ceil(t/(n+1))),l=Math.min(i.length-1,Math.floor((t+o)/(n+1))),r=this.get("startIndex"),u=this.get("endIndex");return 0!==r&&r+this.criticalPoint>a?!0:u!==s-1&&u-this.criticalPoint=n;n+=1)i=this.dataModel.at(n),a.push(this._createViewDataFromDataModel(i,o.lside,s)),l.push(this._createViewDataFromDataModel(i,o.rside)),s+=1;this._resetViewModelList("lside",a),this._resetViewModelList("rside",l)},_getActualRowCount:function(){return this.get("endIndex")-this.get("startIndex")+1},_clearDummyRows:function(){var t=this.get("endIndex")-this.get("startIndex")+1;_.each(["lside","rside"],function(e){for(var i=this.get(e);i.length>t;)i.pop()},this)},_fillDummyRows:function(){var t=this.dimensionModel.get("displayRowCount"),e=this._getActualRowCount(),i=Math.max(t-e,0);_.times(i,function(){this.get("lside").add({}),this.get("rside").add({})},this),this.set("dummyRowCount",i)},refresh:function(t){var e,i,n;for(this._setRenderingRange(this.get("scrollTop")), +e=this.get("startIndex"),i=this.get("endIndex"),this._resetAllViewModelListWithRange(e,i),this.get("showDummyRows")&&this._fillDummyRows(),n=e;i>=n;n+=1)this._executeRelation(n);this.isColumnModelChanged?(this.trigger("columnModelChanged"),this.isColumnModelChanged=!1):this.trigger("rowListChanged",t),this._refreshState(),this.trigger("refresh")},_refreshState:function(){this.dataModel.length?this.set("state",s.DONE):this.set("state",s.EMPTY)},_getCollectionByColumnName:function(t){var e,i=this.get("lside");return e=i.at(0)&&i.at(0).get(t)?i:this.get("rside")},getCellData:function(t,e){var i=this._getCollectionByColumnName(e),n=i.get(t);return n?n.get(e):void 0},_executeRelation:function(t){var e,i,n=this.dataModel.at(t),o=t-this.get("startIndex");i=n.getRelationResult(),_.each(i,function(t,i){e=this._getCollectionByColumnName(i).at(o),e&&e.setCell(i,t)},this)},_destroy:function(){clearTimeout(this.timeoutIdForRefresh)}}));e.exports=a},{"../base/model":5,"../common/constMap":8,"../common/util":10,"./rowList":23}],22:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=n.extend({initialize:function(t,e){var i=t&&t.rowKey,n=this.collection.dataModel,o=n.get(i);o&&(this.listenTo(o,"change restore",this._onDataModelChange),this.listenTo(o,"extraDataChanged",this._setRowExtraData),this.listenTo(n,"disabledChanged",this._onDataModelDisabledChanged),this.rowData=o)},idAttribute:"rowKey",_onDataModelChange:function(t){_.each(t.changed,function(t,e){this.setCell(e,{value:t})},this)},_getColumnNameList:function(){var t=this.collection.columnModel.getVisibleColumnModelList(null,!0);return _.pluck(t,"columnName")},_isDisabled:function(t,e){var i=this.collection.dataModel.isDisabled;return i||(i="_button"===t?e.isDisabledCheck:e.isDisabled),i},_onDataModelDisabledChanged:function(){var t=this._getColumnNameList(),e=this.rowData.getRowState();_.each(t,function(t){this.setCell(t,{isDisabled:this._isDisabled(t,e)})},this)},_setRowExtraData:function(){var t,e=this.collection.dataModel,i=this._getColumnNameList(),n=this.rowData.getRowState();tui.util.isUndefined(this.collection)||_.each(i,function(i){var o,s,a=this.get(i),l=this;tui.util.isUndefined(a)||(o=this.rowData.isEditable(i),s=this._isDisabled(i,n),e.isRowSpanEnable()&&!a.isMainRow&&(l=this.collection.get(a.mainRowKey)),l&&(t={isDisabled:s,isEditable:o,className:this.rowData.getClassNameList(i).join(" ")},l.setCell(i,t)))},this)},parse:function(t,e){return this._formatData(t,e.collection.dataModel)},_formatData:function(t,e){var i,n,o=t.rowKey;return _.isUndefined(o)?t:(i=e.get(o),n=i.getRowState(),_.each(t,function(s,a){var l;"rowKey"!==a&&"_extraData"!==a&&(l=e.isRowSpanEnable()&&t._extraData&&t._extraData.rowSpanData&&t._extraData.rowSpanData[a]?t._extraData.rowSpanData[a]:{mainRowKey:o,count:0,isMainRow:!0},t[a]={rowKey:o,columnName:a,value:s,rowSpan:l.count,isMainRow:l.isMainRow,mainRowKey:l.mainRowKey,isEditable:i.isEditable(a),isDisabled:this._isDisabled(a,n),className:i.getClassNameList(a).join(" "),optionList:[],changed:[]})},this),t)},setCell:function(t,e){var i,n,s,a=!1,l=[];this.get(t)&&(n=this.get("rowKey"),s=_.clone(this.get(t)),_.each(e,function(t,e){o.isEqual(s[e],t)||(a="value"===e?!0:a,s[e]=t,l.push(e))},this),l.length&&(s.changed=l,this.set(t,s),a&&(i=this.collection.dataModel.indexOfRowKey(n),this.trigger("valueChange",i))))}});e.exports=s},{"../base/model":5,"../common/util":10}],23:[function(t,e,i){"use strict";var n=t("../base/collection"),o=t("./row"),s=n.extend({model:o,initialize:function(t,e){this.setOwnProperties({dataModel:e.dataModel,columnModel:e.columnModel})}});e.exports=s},{"../base/collection":3,"./row":22}],24:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s={cell:"cell",row:"row",column:"column"},a=n.extend({initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({dataModel:e.dataModel,columnModel:e.columnModel,dimensionModel:e.dimensionModel,focusModel:e.focusModel,renderModel:e.renderModel,inputRange:null,intervalIdForAutoScroll:null,scrollPixelScale:40,_isEnabled:!0,_selectionState:s.cell}),this.listenTo(this.dataModel,"add remove sort reset",this.end),this.listenTo(this.dataModel,"paste",this._onPasteData)},defaults:{range:null},_onPasteData:function(t){this.start(t.startIdx.row,t.startIdx.column),this.update(t.endIdx.row,t.endIdx.column)},setState:function(t){this._selectionState=s[t]||this._selectionState},getState:function(){return this._selectionState},enable:function(){this._isEnabled=!0},disable:function(){this.end(),this._isEnabled=!1},isEnabled:function(){return this._isEnabled},start:function(t,e,i){this._isEnabled&&(this.setState(i),this.inputRange={row:[t,t],column:[e,e]},this._resetRangeAttribute())},startByMousePosition:function(t,e,i){var n=this.dimensionModel.getIndexFromMousePosition(t,e);this.start(n.row,n.column,i)},update:function(t,e,i){var n;!this._isEnabled||0>t||0>e||(this.hasSelection()?this.setState(i):(n=this.focusModel.indexOf(),this.start(n.row,n.column,i)),this._updateInputRange(t,e),this._resetRangeAttribute())},_updateInputRange:function(t,e){var i=this.inputRange;i.row[1]=t,i.column[1]=e},extendColumnSelection:function(t,e,i){var n,s=this._minimumColumnRange,a=this.dimensionModel.getIndexFromMousePosition(e,i),l={row:[0,0],column:[]};t&&t.length||(t=[a.column]),this._setScrolling(e,i),s?n=o.getMinMax(t.concat(s)):(t.push(this.inputRange.column[0]),n=o.getMinMax(t)),l.column.push(n.min,n.max),this._resetRangeAttribute(l)},_setScrolling:function(t,e){var i=this.dimensionModel.getOverflowFromMousePosition(t,e);this.stopAutoScroll(),this._isAutoScrollable(i.x,i.y)&&(this.intervalIdForAutoScroll=setInterval(_.bind(this._adjustScroll,this,i.x,i.y)))},updateByMousePosition:function(t,e,i){var n=this.dimensionModel.getIndexFromMousePosition(t,e);this._setScrolling(t,e),this.update(n.row,n.column,i)},end:function(){this.inputRange=null,this.unset("range"),this.unsetMinimumColumnRange()},stopAutoScroll:function(){_.isNull(this.intervalIdForAutoScroll)||(clearInterval(this.intervalIdForAutoScroll),this.intervalIdForAutoScroll=null)},selectRow:function(t){this._isEnabled&&(this.focusModel.focusAt(t,0),this.start(t,0,s.row),this.update(t,this.columnModel.getVisibleColumnModelList().length-1))},selectColumn:function(t){this._isEnabled&&(this.focusModel.focusAt(0,t),this.start(0,t,s.column),this.update(this.dataModel.length-1,t))},selectAll:function(){this._isEnabled&&(this.start(0,0,s.cell),this.update(this.dataModel.length-1,this.columnModel.getVisibleColumnModelList().length-1))},getStartIndex:function(){var t=this.get("range");return{row:t.row[0],column:t.column[0]}},getEndIndex:function(){var t=this.get("range");return{row:t.row[1],column:t.column[1]}},hasSelection:function(){return!!this.get("range")},_isSingleCell:function(t,e){var i=1===t.length,n=1===e.length,o=i&&!n&&e[0].getRowSpanData(t[0]).count===e.length;return i&&n||o},getValuesToString:function(){var t,e,i,n,o=this.get("range");return t=this.columnModel.getVisibleColumnModelList().slice(o.column[0],o.column[1]+1),e=this.dataModel.slice(o.row[0],o.row[1]+1),i=_.pluck(t,"columnName"),n=_.map(e,function(t){var e=_.map(i,function(e){return t.getVisibleText(e)});return e.join(" ")}),this._isSingleCell(i,e)?n[0]:n.join("\n")},_isAutoScrollable:function(t,e){return!(0===t&&0===e)},_adjustScroll:function(t,e){var i=this.renderModel;t&&this._adjustScrollLeft(t,i.get("scrollLeft"),i.get("maxScrollLeft")),e&&this._adjustScrollTop(e,i.get("scrollTop"),i.get("maxScrollTop"))},_adjustScrollLeft:function(t,e,i){var n=e,o=this.scrollPixelScale;0>t?n=Math.max(0,e-o):t>0&&(n=Math.min(i,e+o)),this.renderModel.set("scrollLeft",n)},_adjustScrollTop:function(t,e,i){var n=e,o=this.scrollPixelScale;0>t?n=Math.max(0,e-o):t>0&&(n=Math.min(i,e+o)),this.renderModel.set("scrollTop",n)},_resetRangeAttribute:function(t){var e,i,n,o=this.dataModel;if(t=t||this.inputRange,!t)return void this.set("range",null);if(i={row:_.sortBy(t.row),column:_.sortBy(t.column)},o.isRowSpanEnable())do n=_.assign([],i.row),i=this._getRowSpannedIndex(i),e=i.row[0]!==n[0]||i.row[1]!==n[1];while(e);switch(this._setRangeMinMax(i.row,i.column),this._selectionState){case s.column:i.row=[0,o.length-1];break;case s.row:i.column=[0,this.columnModel.getVisibleColumnModelList().length-1];break;case s.cell:}this.set("range",i)},setMinimumColumnRange:function(t){this._minimumColumnRange=_.extend(t)},unsetMinimumColumnRange:function(){this._minimumColumnRange=null},_setRangeMinMax:function(t,e){t&&(t[0]=Math.max(0,t[0]),t[1]=Math.min(this.dataModel.length-1,t[1])),e&&(e[0]=Math.max(0,e[0]),e[1]=Math.min(this.columnModel.getVisibleColumnModelList().length-1,e[1]))},_concatRowSpanIndexFromStart:function(t){var e,i=t.startIndex,n=t.endIndex,o=t.columnName,s=t.startRowSpanDataMap&&t.startRowSpanDataMap[o],a=t.startIndexList,l=t.endIndexList;s&&(s.isMainRow?(e=i+s.count-1,e>n&&l.push(e)):(e=i+s.count,a.push(e)))},_concatRowSpanIndexFromEnd:function(t){var e,i,n=t.endIndex,o=t.columnName,s=t.endRowSpanDataMap&&t.endRowSpanDataMap[o],a=t.endIndexList,l=t.dataModel;s&&(s.isMainRow?(e=n+s.count-1,a.push(e)):(e=n+s.count,i=l.at(e).getRowSpanData(o),e+=i.count-1,e>n&&a.push(e)))},_getRowSpannedIndex:function(t){var e,i,n,o,s=this.columnModel.getVisibleColumnModelList().slice(t.column[0],t.column[1]+1),a=this.dataModel,l=[t.row[0]],r=[t.row[1]],u=a.at(t.row[0]),d=a.at(t.row[1]),h=$.extend({},t);return u&&d?(e=a.at(t.row[0]).getRowSpanData(),i=a.at(t.row[1]).getRowSpanData(),_.each(s,function(s){n=s.columnName,o={columnName:n,startIndex:t.row[0],endIndex:t.row[1],endRowSpanDataMap:i,startRowSpanDataMap:e,startIndexList:l,endIndexList:r,dataModel:a},this._concatRowSpanIndexFromStart(o),this._concatRowSpanIndexFromEnd(o)},this),h.row=[Math.min.apply(null,l),Math.max.apply(null,r)],h):h}});e.exports=a},{"../base/model":5,"../common/util":10}],25:[function(t,e,i){"use strict";var n=t("../base/model"),o=(t("../common/util"),n.extend({initialize:function(t){n.prototype.initialize.apply(this,arguments)},defaults:{hasControlPanel:!1,hasPagination:!1,hasResizeHandler:!1,isExcelButtonVisible:!1,isExcelAllButtonVisible:!1,pagination:null},isVisible:function(){return this.get("hasControlPanel")||this.get("hasPagination")||this.get("hasResizeHandler")}}));e.exports=o},{"../base/model":5,"../common/util":10}],26:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").keyName,a=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setOwnProperties({_keyDownSwitch:$.extend({},this._defaultKeyDownSwitch)})},redrawAttributes:["isEditable","optionList","value"],template:_.template(''+t+""},getHtml:function(t){var e,i=o.getAttributesString(this.getAttributes(t)),n=this._getContentHtml(t);return e=this.template({columnName:t.columnName,rowSpan:t.rowSpan,className:this._getClassNameList(t).join(" "),editType:this.getEditType(),attributeString:i,contentHtml:n||" "})},redraw:function(t,e){var i={"class":this._getClassNameList(t).join(" ")};t.rowSpan&&(i.rowSpan=t.rowSpan),i["edit-type"]=this.getEditType(),i=$.extend(i,this.getAttributes(t)),e.attr(i),e.html(this._getContentHtml(t))},_getCellData:function(t){var e=this._getCellAddress(t);return this.grid.renderModel.getCellData(e.rowKey,e.columnName)},_getCellAddress:function(t){return{rowKey:this.getRowKey(t),columnName:this.getColumnName(t)}},_validateData:function(t,e){var i=this.grid.dataModel.get(t);i.validateCell(e)},_getConvertedHtml:function(t,e){var i,n=this.getColumnModel(e),o=n.editOption;return o&&tui.util.isFunction(o.converter)&&(i=o.converter(t,this.grid.dataModel.get(e.rowKey).attributes)),tui.util.isFalsy(i)&&(i=null),i},getColumnName:function(t){return t.closest("td").attr("columnName")},getRowKey:function(t){return t.closest("tr").attr("key")},getColumnModel:function(t){return this.grid.columnModel.getColumnModel(t.columnName)},getAttributes:function(t){var e=this.getColumnModel(t);return{align:e.align||"left"}},focusOut:function(){this.grid.focusModel.focusClipboard()},getEditType:function(){return"normal"},focusIn:function(t){},getContentHtml:function(t){return""},setElementAttribute:function(t,e,i){}});e.exports=a},{"../base/painter":6,"../common/constMap":8,"../common/util":10}],27:[function(t,e,i){"use strict";var n=t("./list"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setKeyDownSwitch({UP_ARROW:function(){},DOWN_ARROW:function(){},PAGE_UP:function(){},PAGE_DOWN:function(){},ENTER:function(t,e){e.$target.trigger("click")},LEFT_ARROW:function(t,e){this._focusPrevInput(e.$target)},RIGHT_ARROW:function(t,e){this._focusNextInput(e.$target)},ESC:function(t,e){this.focusOut(e.$target)},TAB:function(t,e){t.shiftKey?this._focusPrevInput(e.$target)||this.grid.focusModel.focusIn(e.rowKey,e.focusModel.prevColumnName(),!0):this._focusNextInput(e.$target)||this.grid.focusModel.focusIn(e.rowKey,e.focusModel.nextColumnName(),!0)}})},eventHandler:{"change input":"_onChange","keydown input":"_onKeyDown","blur input":"_onBlur"},getEditType:function(){return"button"},contentTemplate:_.template(' <% if (isDisabled) print("disabled"); %>/>'),labelTemplate:_.template(''),focusIn:function(t){t.find("input").eq(0).prop("disabled")?this.grid.focusModel.focusClipboard():t.find("input").eq(0).focus()},getContentHtml:function(t){var e,i=this.getOptionList(t),n=this.grid.columnModel.getColumnModel(t.columnName),s=t.value,a=(""+s).split(","),l={},r=this._getConvertedHtml(s,t),u=o.getUniqueKey(),d=t.isDisabled,h=n.editOption.type;return _.isNull(r)&&(r="",_.each(a,function(t){l[t]=!0}),_.each(i,function(t){e=u+"_"+t.value,r+=this.contentTemplate({type:h,name:u,id:e,value:t.value,isChecked:!!l[t.value],isDisabled:d}),t.text&&(r+=this.labelTemplate({id:e,labelText:t.text}))},this)),r},setElementAttribute:function(t,e){var i=t.value,n=(""+i).split(",");e.find("input:checked").prop("checked",!1),tui.util.forEachArray(n,function(t){e.find('input[value="'+t+'"]').prop("checked",!0)})},_focusNextInput:function(t){return this._focusTargetInput(t,"next")},_focusPrevInput:function(t){return this._focusTargetInput(t,"prev")},_focusTargetInput:function(t,e){var i,n=t,o=!1;"next"===e?i=function(t){return t.next()}:"prev"===e&&(i=function(t){return t.prev()});do n=i(n);while(n.length&&!n.is("input"));return n.length&&(n.focus(),o=!0),o},_getCheckedValueList:function(t){var e=t.closest("td").find("input:checked"),i=[];return tui.util.forEachArray(e,function(t,n){i.push(e.eq(n).val())}),i},_onChange:function(t){var e=$(t.target),i=this._getCellAddress(e);this.grid.dataModel.setValue(i.rowKey,i.columnName,this._getCheckedValueList(e).join(","))},_onBlur:function(t){var e=this._getCellAddress($(t.target));this._validateData(e.rowKey,e.columnName)}});e.exports=s},{"../../common/util":10,"./list":28}],28:[function(t,e,i){"use strict";var n=t("../cell"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},redrawAttributes:["isDisabled","isEditable","optionList"],eventHandler:{},getEditType:function(){},focusIn:function(t){},getContentHtml:function(t){throw this.error("Implement getContentHtml(cellData, $target) method. On re-rendering")},setElementAttribute:function(t,e,i){throw this.error("Implement setElementAttribute(cellData, $target) method. ")},getOptionList:function(t){var e=this.grid.columnModel.getColumnModel(t.columnName);return t.optionList&&t.optionList.length?t.optionList:e.editOption.list}});e.exports=o},{"../cell":26}],29:[function(t,e,i){"use strict";var n=t("../cell"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setKeyDownSwitch({UP_ARROW:function(){},DOWN_ARROW:function(){},ENTER:function(t,e){this.focusOut(e.$target)},LEFT_ARROW:function(){},RIGHT_ARROW:function(){},ESC:function(){}})},redrawAttributes:["isDisabled","isEditable","optionList"],eventHandler:{mousedown:"_onMouseDown","change input":"_onChange","keydown input":"_onKeyDown"},contentTemplate:_.template(' <% if (isDisabled) print("disabled") %>/>'),getEditType:function(){return"_button"},getContentHtml:function(t){var e=t.isDisabled;return this.contentTemplate({type:this.grid.columnModel.get("selectType"),name:this.grid.id,isChecked:!!t.value,isDisabled:e})},focusIn:function(){},setElementAttribute:function(t,e){var i=e.find("input"),n=i.prop("checked");n!==!!t.value&&i.prop("checked",t.value)},toggle:function(t){var e=t.find("input");"checkbox"===this.grid.columnModel.get("selectType")&&e.prop("checked",!e.prop("checked"))},getAttributes:function(){return{align:"center"}},_onChange:function(t){var e=$(t.target),i=this.getRowKey(e);this.grid.dataModel.setValue(i,"_button",e.prop("checked"))},_onMouseDown:function(t){var e=$(t.target);e.is("input")||e.find("input").trigger("click")}});e.exports=o},{"../cell":26}],30:[function(t,e,i){"use strict";var n=t("../cell"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},getEditType:function(){return"normal"},getContentHtml:function(t){var e=t.columnName,i=this.grid.columnModel.getColumnModel(e),n=this.grid.dataModel.get(t.rowKey).getHTMLEncodedString(e),o=t.rowKey;return tui.util.isFunction(i.formatter)&&(n=i.formatter(n,this.grid.dataModel.get(o).toJSON(),i)),tui.util.isExisty(n)||(n=""),n},focusIn:function(){this.grid.focusModel.focusClipboard()},setElementAttribute:function(t,e,i){}});e.exports=o},{"../cell":26}],31:[function(t,e,i){"use strict";var n=t("./normal"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},redrawAttributes:[],getEditType:function(){return"_number"},getContentHtml:function(t){return t.value}});e.exports=o},{"./normal":30}],32:[function(t,e,i){"use strict";var n=t("./list"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setKeyDownSwitch({ESC:function(t,e){this.focusOut(e.$target)},ENTER:function(t,e){this.focusOut(e.$target)}})},eventHandler:{"change select":"_onChange","keydown select":"_onKeyDown","blur select":"_onBlurSelect"},contentTemplate:_.template(''),optionTemplate:_.template(''),_onBlurSelect:function(t){var e=this._getCellAddress($(t.target));this._validateData(e.rowKey,e.columnName)},getEditType:function(){return"select"},focusIn:function(t){t.find("select").prop("disabled")?this.grid.focusModel.focusClipboard():t.find("select").eq(0).focus()},getContentHtml:function(t){var e=this.getOptionList(t),i=t.isDisabled,n=this._getConvertedHtml(t.value,t),s="";return tui.util.isNull(n)&&(_.each(e,function(e){s+=this.optionTemplate({value:e.value,cellDataValue:t.value,text:e.text})},this),n=this.contentTemplate({name:o.getUniqueKey(),isDisabled:i,options:s})),n},_getContentHtml:function(t){var e,i,n=t.columnName,o=this.grid.columnModel.getColumnModel(n),s=o.editOption||{},a="";return tui.util.isExisty(t.value)||(t.value=o.defaultValue),e=this._getExtraContent(s.beforeContent||s.beforeText,t),i=this._getExtraContent(s.afterContent||s.afterText,t),e&&(a+=this._getSpanWrapContent(e,"before",t)),i&&(a+=this._getSpanWrapContent(i,"after",t)),a+=this._getSpanWrapContent(this.getContentHtml(t),"input")},setElementAttribute:function(t,e,i){var n=e.find("select");i&&n.blur(),n.val(t.value),i&&n.focus()},_onChange:function(t){var e=$(t.target),i=this._getCellAddress(e),n=this.grid;n.dataModel.setValue(i.rowKey,i.columnName,e.val())}});e.exports=s},{"../../common/util":10,"./list":28}],33:[function(t,e,i){"use strict";var n=t("../cell"),o=t("./text"),s=t("../../common/util"),a=t("../../common/formUtil"),l=tui.util.defineClass(o,{init:function(){o.apply(this,arguments),this.setOwnProperties({timeoutIdForClick:0,editingCell:{rowKey:null,columnName:""},clicked:{rowKey:null,columnName:null}})},redrawAttributes:["isDisabled","isEditable","value"],eventHandler:{dblclick:"_onDblClick",mousedown:"_onMouseDown","blur input":"_onBlurConvertible","keydown input":"_onKeyDown","focus input":"_onFocus","selectstart input":"_onSelectStart"},contentTemplate:_.template('/>'),getEditType:function(){return"text-convertible"},focusIn:function(t){this._startEdit(t)},focusOut:function(){this.grid.focusModel.focusClipboard()},getContentHtml:function(t){var e=this.getColumnModel(t),i=this.grid.dataModel.get(t.rowKey).getHTMLEncodedString(t.columnName);return tui.util.isUndefined(i)&&(i=""),this._isEditingCell(t)?this.contentTemplate({type:this._getInputType(),value:i,name:s.getUniqueKey(),isDisabled:t.isDisabled,maxLength:e.editOption.maxLength}):(tui.util.isFunction(e.formatter)&&(i=e.formatter(i,this.grid.dataModel.get(t.rowKey).attributes,e)),i)},_getContentHtml:function(t){var e;return e=this._isEditingCell(t)?o.prototype:n.prototype,e._getContentHtml.call(this,t)},_isEditingCell:function(t){var e=this.editingCell;return e.rowKey===t.rowKey.toString()&&e.columnName===t.columnName.toString()},setElementAttribute:function(t,e,i){},_onBlurConvertible:function(t){var e=$(t.target),i=e.closest("td"),n=this.grid.focusModel;this._onBlur(t),this._endEdit(i),this._validateData(this.getRowKey(i),this.getColumnName(i)),_.defer(function(){n.refreshState()})},_startEdit:function(t){var e,i,n,o,s=this.grid.dataModel;this._blurEditingCell(),i=this.getRowKey(t),n=this.getColumnName(t),o=s.get(i).getCellState(n),!o.isEditable||s.isDisabled||o.isDisabled||(this.editingCell={rowKey:i,columnName:n},this.redraw(this._getCellData(t),t),e=t.find("input"),this.originalText=e.val(),a.setCursorToEnd(e.get(0)),e.select())},_endEdit:function(t){var e=this._getCellData(t);this.editingCell={rowKey:null,columnName:null},this.clicked={rowKey:null,columnName:null},e&&this.redraw(e,t)},_blurEditingCell:function(){var t,e=this.editingCell.rowKey,i=this.editingCell.columnName;tui.util.isNull(e)||tui.util.isNull(i)||(t=this.grid.dataModel.getElement(e,i),t.find("input")[0].blur())},_onDblClick:function(t){var e=$(t.target),i=e.closest("td"),n=this._getCellAddress(i);this._isEditingCell(n)||this._startEdit(i)},_onMouseDown:function(t){$(t.target).is("input")&&t.stopPropagation()}});e.exports=l},{"../../common/formUtil":9,"../../common/util":10,"../cell":26,"./text":35}],34:[function(t,e,i){"use strict";var n=t("./text"),o=tui.util.defineClass(n,{init:function(t,e){n.apply(this,arguments)},_getInputType:function(){return"password"},getEditType:function(){return"text-password"}});e.exports=o},{"./text":35}],35:[function(t,e,i){"use strict";var n=t("../cell"),o=t("../../common/util"),s=t("../../common/formUtil"),a=tui.util.defineClass(n,{init:function(t,e){n.apply(this,arguments),this.setOwnProperties({originalText:""}),this.setKeyDownSwitch({UP_ARROW:function(){},DOWN_ARROW:function(){},PAGE_UP:function(){},PAGE_DOWN:function(){},ENTER:function(t,e){this.focusOut(e.$target.closest("td"))},ESC:function(t,e){this._restore(e.$target),this.focusOut(e.$target.closest("td"))}})},redrawAttributes:["isEditable"],eventHandler:{"blur input":"_onBlur","keydown input":"_onKeyDown","focus input":"_onFocus","selectstart input":"_onSelectStart"},contentTemplate:_.template('/>'),_getInputType:function(){return"text"},getEditType:function(){return"text"},focusIn:function(t){var e=t.find("input");e.prop("disabled")?this.grid.focusModel.focusClipboard():(s.setCursorToEnd(e.get(0)),e.select())},focusOut:function(){this.grid.focusModel.focusClipboard()},getContentHtml:function(t){var e,i=this.getColumnModel(t),n=i.editOption,s=this.grid.dataModel.get(t.rowKey).getHTMLEncodedString(t.columnName);return tui.util.isUndefined(s)&&(s=""),e=this._getConvertedHtml(s,t),tui.util.isNull(e)&&(e=this.contentTemplate({type:this._getInputType(),value:s,name:o.getUniqueKey(),isDisabled:t.isDisabled,maxLength:n.maxLength})),e},setElementAttribute:function(t,e){var i=-1!==$.inArray("value",t.changed),n=e.find("input");i&&n.val(t.value),n.prop("disabled",t.isDisabled)},_isEdited:function(t){return t.val()!==this.originalText},_restore:function(t){t.val(this.originalText)},_getContentHtml:function(t){var e,i,n=t.columnName,o=this.grid.columnModel.getColumnModel(n),s=o.editOption||{},a="";return tui.util.isExisty(t.value)||(t.value=o.defaultValue),e=this._getExtraContent(s.beforeContent||s.beforeText,t),i=this._getExtraContent(s.afterContent||s.afterText,t),e&&(a+=this._getSpanWrapContent(e,"before",t)),i&&(a+=this._getSpanWrapContent(i,"after",t)),a+=this._getSpanWrapContent(this.getContentHtml(t),"input")},_onBlur:function(t){var e=$(t.target),i=this.getRowKey(e),n=this.getColumnName(e);this._executeInputEventHandler(t,"blur"),this._isEdited(e)&&this.grid.dataModel.setValue(i,n,e.val()),this.grid.selectionModel.enable(),this._validateData(i,n)},_onFocus:function(t){var e=$(t.target);this.originalText=e.val(),this._executeInputEventHandler(t,"focus"),this.grid.selectionModel.end()},_onKeyDown:function(t){this._executeInputEventHandler(t,"keydown"),n.prototype._onKeyDown.call(this,t)},_executeInputEventHandler:function(t,e){var i=$(t.target),n=this._getCellAddress(i),o=this.grid.columnModel.getColumnModel(n.columnName),s=tui.util.pick(o,"editOption","inputEvents",e);return _.isFunction(s)?s(t,n):null},_onSelectStart:function(t){t.stopPropagation()}});e.exports=a},{"../../common/formUtil":9,"../../common/util":10,"../cell":26}],36:[function(t,e,i){"use strict";var n=t("../base/painter"),o=(t("../common/util"),tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},eventHandler:{dblclick:"_onDblClick"},template:_.template(' '),getEditType:function(){return"dummy"},_onDblClick:function(){this.grid.dataModel.append({},{focus:!0})},getHtml:function(t){var e=this.grid.columnModel.isMetaColumn(t);return this.template({columnName:t,className:(e?"meta_column ":"")+"dummy"})}}));e.exports=o},{"../base/painter":6,"../common/util":10}],37:[function(t,e,i){"use strict";var n=t("./cell/mainButton"),o=t("./cell/number"),s=t("./cell/normal"),a=t("./cell/button"),l=t("./cell/select"),r=t("./cell/text"),u=t("./cell/text-convertible"),d=t("./cell/text-password"),h=t("./dummyCell"),c=t("./row"),m=tui.util.defineClass({init:function(t){this.modelManager=t.modelManager,this.cellPainters=this._createCellPainters(),this.rowPainter=this._createRowPainter()},_createCellPainters:function(){var t={},e={grid:this.modelManager},i=[new n(e),new o(e),new s(e),new a(e),new l(e),new r(e),new d(e),new u(e),new h(e)];return _.each(i,function(e){t[e.getEditType()]=e}),t},_createRowPainter:function(){return new c({grid:this.modelManager,painterManager:this})},getCellPainter:function(t){var e=this.cellPainters[t];return e||(e="radio"===t||"checkbox"===t?this.cellPainters.button:this.cellPainters.normal),e},getCellPainters:function(){return this.cellPainters},getRowPainter:function(){return this.rowPainter}});e.exports=m},{"./cell/button":27,"./cell/mainButton":29,"./cell/normal":30,"./cell/number":31,"./cell/select":32,"./cell/text":35,"./cell/text-convertible":33,"./cell/text-password":34,"./dummyCell":36,"./row":38}],38:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.painterManager=t.painterManager},template:_.template('<%=contents%>'),onModelChange:function(t,e){_.each(t.changed,function(t,i){var n,o;"_extraData"!==i&&(n=this._getEditType(i,t),o=this.painterManager.getCellPainter(n),o.onModelChange(t,e))},this)},_getEditType:function(t,e){var i=this.grid.columnModel.getEditType(t);return e.isEditable||"_number"===t||(i="normal"),i},_getHtmlForDummyRow:function(t){var e=this.painterManager.getCellPainter("dummy"),i="";return _.each(t,function(t){i+=e.getHtml(t.columnName)}),i},_getHtmlForActualRow:function(t,e){var i="";return _.each(e,function(e){var n,o,s=e.columnName,a=t.get(s);a&&a.isMainRow&&(n=this._getEditType(s,a),o=this.painterManager.getCellPainter(n),i+=o.getHtml(a))},this),i},getHtml:function(t,e){var i,n=t.get("rowKey");return i=_.isUndefined(n)?this._getHtmlForDummyRow(e):this._getHtmlForActualRow(t,e),this.template({key:n,height:this.grid.dimensionModel.get("rowHeight")+s._extraHeight,contents:i,className:""})},"static":{_extraHeight:function(){var t=0;return o.isBrowserIE7()&&(t=-2),t}()}});e.exports=s},{"../base/painter":6,"../common/util":10}],39:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){this.publicObject=t},_listenForThrough:function(t,e){_.each(e,function(e){this.listenTo(t,e,_.bind(this._triggerOnPublic,this,e))},this)},_listenForRename:function(t,e,i){this.listenTo(t,e,_.bind(this._triggerOnPublic,this,i))},_triggerOnPublic:function(t,e){this.publicObject.trigger(t,e)},listenToNetAddon:function(t){ +this._listenForThrough(t,["beforeRequest","response","successResponse","failResponse","errorResponse"])},listenToContainerView:function(t){this._listenForThrough(t,["click","dblclick","mousedown","clickCell","dblclickCell","mouseoverCell","mouseoutCell","rendered"])},listenToFocusModel:function(t){this._listenForRename(t,"select","selectRow")}});_.extend(n.prototype,Backbone.Events),e.exports=n},{}],40:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").keyCode,a=n.extend({initialize:function(t){this.setOwnProperties({focusModel:t.focusModel,selectionModel:t.selectionModel,painterManager:t.painterManager,dimensionModel:t.dimensionModel,dataModel:t.dataModel,columnModel:t.columnModel,renderModel:t.renderModel,timeoutIdForKeyIn:0,isLocked:!1}),this.listenTo(this.focusModel,"focusClipboard",this._onFocus)},tagName:"textarea",className:"clipboard",events:{keydown:"_onKeyDown",blur:"_onBlur"},_onBlur:function(){var t=this.focusModel;_.defer(function(){t.refreshState()})},_onFocus:function(){try{this.$el.is(":focus")||(this.$el.focus(),this.focusModel.refreshState())}catch(t){}},render:function(){return this},_lock:function(){clearTimeout(this.timeoutIdForKeyIn),this.isLocked=!0,this.timeoutIdForKeyIn=setTimeout($.proxy(this._unlock,this),10)},_unlock:function(){this.isLocked=!1},_onKeyDown:function(t){return this.isLocked?(t.preventDefault(),!1):(t.shiftKey&&(t.ctrlKey||t.metaKey)?this._keyInWithShiftAndCtrl(t):t.shiftKey?this._keyInWithShift(t):t.ctrlKey||t.metaKey?this._keyInWithCtrl(t):this._keyIn(t),void this._lock())},_keyIn:function(t){var e=this.focusModel,i=this.selectionModel,n=e.which(),a=n.rowKey,l=n.columnName,r=this.dimensionModel.get("displayRowCount"),u=!0,d=t.keyCode||t.which;if(!o.isBlank(n.rowKey)){switch(d){case s.UP_ARROW:e.focus(e.prevRowKey(),l,!0);break;case s.DOWN_ARROW:e.focus(e.nextRowKey(),l,!0);break;case s.LEFT_ARROW:e.focus(a,e.prevColumnName(),!0);break;case s.RIGHT_ARROW:e.focus(a,e.nextColumnName(),!0);break;case s.PAGE_UP:e.focus(e.prevRowKey(r-1),l,!0);break;case s.PAGE_DOWN:e.focus(e.nextRowKey(r-1),l,!0);break;case s.HOME:e.focus(a,e.firstColumnName(),!0);break;case s.END:e.focus(a,e.lastColumnName(),!0);break;case s.SPACE:case s.ENTER:this._onEnterSpace(a,l);break;case s.DEL:this._del(a,l);break;case s.TAB:e.focusIn(a,e.nextColumnName(),!0);break;default:u=!1}u&&t.preventDefault(),i.end()}},_onEnterSpace:function(t,e){var i,n=this.columnModel.getEditType(e);"_button"===n?(i=this.cellFactory.getInstance(n),i.toggle(this.dataModel.getElement(t,e))):this.focusModel.focusIn(t,e)},_getIndexBeforeMove:function(){var t,e,i=this.focusModel.indexOf(),n=this.selectionModel.get("range"),o=_.extend({},i);return n&&(t=n.row,e=n.column,o.row=t[0],o.column=e[0],t[1]>i.row&&(o.row=t[1]),e[1]>i.column&&(o.column=e[1])),o},_keyInWithShift:function(t){var e,i,n,o,a=this.focusModel,l=this.dimensionModel,r=this.columnModel.getVisibleColumnModelList(),u=a.which(),d=l.get("displayRowCount"),h=t.keyCode||t.which,c=this._getIndexBeforeMove(),m=!0,g=!0;switch(h){case s.UP_ARROW:c.row-=1;break;case s.DOWN_ARROW:c.row+=1;break;case s.LEFT_ARROW:c.column-=1;break;case s.RIGHT_ARROW:c.column+=1;break;case s.PAGE_UP:c.row=a.prevRowIndex(d-1);break;case s.PAGE_DOWN:c.row=a.nextRowIndex(d-1);break;case s.HOME:c.column=0;break;case s.END:c.column=r.length-1;break;case s.ENTER:g=!1;break;case s.TAB:g=!1,a.focusIn(u.rowKey,a.prevColumnName(),!0);break;default:g=!1,m=!1}e=r[c.column],n=!(!e||!this.dataModel.getRowData(c.row)),g&&n&&(this._updateSelectionByKeyIn(c.row,c.column),i=l.getScrollPosition(c.row,e.columnName),i&&(o=this.selectionModel.getState(),"column"===o?delete i.scrollTop:"row"===o&&delete i.scrollLeft,this.renderModel.set(i))),m&&t.preventDefault()},_keyInWithCtrl:function(t){var e=this.focusModel,i=t.keyCode||t.which;switch(i){case s.CHAR_A:this.selectionModel.selectAll();break;case s.CHAR_C:this._copyToClipboard();break;case s.HOME:e.focus(e.firstRowKey(),e.firstColumnName(),!0);break;case s.END:e.focus(e.lastRowKey(),e.lastColumnName(),!0);break;case s.CHAR_V:this._paste()}},_paste:function(){this._clearClipBoard(),this.pasting||(this.pasting=!0,this._onKeyupCharV())},_onKeyupCharV:function(){this.$el.on("keyup",$.proxy(this.onKeyupCharV,this))},onKeyupCharV:function(){this._pasteToGrid(),this.pasting=!1},_clearClipBoard:function(){this.$el.val("")},_pasteToGrid:function(){var t,e,i=this.selectionModel,n=this.focusModel,o=this.dataModel;t=i.hasSelection()?i.getStartIndex():n.indexOf(),e=this._getProcessClipBoardData(),this.$el.off("keyup"),o.paste(e,t)},_getProcessClipBoardData:function(){for(var t=this.$el.val(),e=t.split("\n"),i=0,n=e.length;n>i;i+=1)e[i]=e[i].split(" ");return e},_keyInWithShiftAndCtrl:function(t){var e=!0,i=this.columnModel.getVisibleColumnModelList(),n=t.keyCode||t.which;switch(n){case s.HOME:this._updateSelectionByKeyIn(0,0);break;case s.END:this._updateSelectionByKeyIn(this.dataModel.length-1,i.length-1);break;default:e=!1}e&&t.preventDefault()},_del:function(){var t,e,i,n=this.selectionModel,o=this.dataModel,s=this.focusModel.which(),a=this.columnModel.getVisibleColumnModelList(),l=s.rowKey,r=s.columnName;if(n.hasSelection()){for(t=n.get("range"),e=t.row[0];e").addClass("left_line"),$("
").addClass("right_line")]);return this.$el.addClass("grid_wrapper uio_grid").attr("data-grid-id",this.gridId).append(t),this._refreshHeight(),this.trigger("rendered"),this},destroy:function(){this.stopListening(),$(window).off("resize.grid"),this._destroyChildren(),this.$el.replaceWith(this.__$el),this.$el=this.__$el=null}});e.exports=o},{"../base/view":7}],42:[function(t,e,i){"use strict";var n=t("./container"),o=t("./layout/toolbar"),s=t("./layout/toolbar/controlPanel"),a=t("./layout/toolbar/pagination"),l=t("./layout/toolbar/resizeHandler"),r=t("./stateLayer"),u=t("./clipboard"),d=t("./layout/frame-lside"),h=t("./layout/frame-rside"),c=t("./layout/header"),m=t("./layout/resizeHandler"),g=t("./layout/body"),f=t("./layout/bodyTable"),p=t("./rowList"),_=t("./selectionLayer"),M=tui.util.defineClass({init:function(t){this.modelManager=t.modelManager,this.painterManager=t.painterManager},createContainer:function(t){return new n({el:t.el,singleClickEdit:t.singleClickEdit,dataModel:this.modelManager.dataModel,dimensionModel:this.modelManager.dimensionModel,focusModel:this.modelManager.focusModel,gridId:this.modelManager.gridId,viewFactory:this})},createToolbar:function(){return new o({toolbarModel:this.modelManager.toolbarModel,dimensionModel:this.modelManager.dimensionModel,viewFactory:this})},createToolbarControlPanel:function(){return new s({gridId:this.modelManager.gridId,toolbarModel:this.modelManager.toolbarModel})},createToolbarPagination:function(){return new a({toolbarModel:this.modelManager.toolbarModel})},createToolbarResizeHandler:function(){return new l({dimensionModel:this.modelManager.dimensionModel})},createStateLayer:function(){return new r({dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel})},createClipboard:function(){return new u({columnModel:this.modelManager.columnModel,dataModel:this.modelManager.dataModel,dimensionModel:this.modelManager.dimensionModel,selectionModel:this.modelManager.selectionModel,focusModel:this.modelManager.focusModel,renderModel:this.modelManager.renderModel,painterManager:this.modelManager.painterManager})},createFrame:function(t){var e="L"===t?d:h;return new e({dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,viewFactory:this})},createHeader:function(t){return new c({whichSide:t,renderModel:this.modelManager.renderModel,dimensionModel:this.modelManager.dimensionModel,selectionModel:this.modelManager.selectionModel,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,viewFactory:this})},createHeaderResizeHandler:function(t){return new m({whichSide:t,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel})},createBody:function(t){return new g({whichSide:t,renderModel:this.modelManager.renderModel,dimensionModel:this.modelManager.dimensionModel,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,selectionModel:this.modelManager.selectionModel,focusModel:this.modelManager.focusModel,viewFactory:this})},createBodyTable:function(t){return new f({whichSide:t,dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,columnModel:this.modelManager.columnModel,painterManager:this.painterManager,viewFactory:this})},createRowList:function(t){return new p({el:t.el,whichSide:t.whichSide,bodyTableView:t.bodyTableView,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,focusModel:this.modelManager.focusModel,painterManager:this.painterManager})},createSelectionLayer:function(t){return new _({whichSide:t,selectionModel:this.modelManager.selectionModel,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel})}});e.exports=M},{"./clipboard":40,"./container":41,"./layout/body":43,"./layout/bodyTable":44,"./layout/frame-lside":45,"./layout/frame-rside":46,"./layout/header":48,"./layout/resizeHandler":49,"./layout/toolbar":50,"./layout/toolbar/controlPanel":51,"./layout/toolbar/pagination":52,"./layout/toolbar/resizeHandler":53,"./rowList":54,"./selectionLayer":55,"./stateLayer":56}],43:[function(t,e,i){"use strict";var n=t("../../base/view"),o='
',s=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({dimensionModel:t.dimensionModel,dataModel:t.dataModel,columnModel:t.columnModel,renderModel:t.renderModel,selectionModel:t.selectionModel,focusModel:t.focusModel,viewFactory:t.viewFactory,$container:null,whichSide:t&&t.whichSide||"R"}),this.listenTo(this.dimensionModel,"change:bodyHeight",this._onBodyHeightChange).listenTo(this.dataModel,"add remove reset",this._resetContainerHeight).listenTo(this.renderModel,"change:scrollTop",this._onScrollTopChange).listenTo(this.renderModel,"change:scrollLeft",this._onScrollLeftChange)},tagName:"div",className:"data",events:{scroll:"_onScroll","mousedown .body_container":"_onMouseDown","blur input, select":"_onBlurInput"},_onBodyHeightChange:function(t,e){this.$el.css("height",e+"px")},_resetContainerHeight:function(){this.$container.css({height:this.dimensionModel.get("totalRowHeight")})},_onScroll:function(t){var e={scrollTop:t.target.scrollTop};"R"===this.whichSide&&(e.scrollLeft=t.target.scrollLeft),this.renderModel.set(e)},_onScrollLeftChange:function(t,e){"R"===this.whichSide&&(this.el.scrollLeft=e)},_onScrollTopChange:function(t,e){this.el.scrollTop=e},_getColumnNameByVisibleIndex:function(t){var e=this.columnModel.getVisibleColumnModelList(null,!1);return e[t].columnName},_onMouseDown:function(t){var e,i=this.columnModel,n=$(t.target),o=n.is("input"),s=n.closest("td"),a=n.closest("tr"),l=s.attr("columnName"),r=a.attr("key"),u=!0;s.length?r&&l?(e={column:i.indexOfColumnName(l,!0),row:this.dataModel.indexOfRowKey(r)},"radio"===this.columnModel.get("selectType")&&this.dataModel.check(e.row)):u=!1:(e=this.dimensionModel.getIndexFromMousePosition(t.pageX,t.pageY),l=this._getColumnNameByVisibleIndex(e.column)),u&&this._controlStartAction(t.pageX,t.pageY,t.shiftKey,e,l,o)},_onBlurInput:function(t){var e=this.focusModel;_.defer(function(){e.refreshState()})},_controlStartAction:function(t,e,i,n,o,s){var a=this.columnModel,l=this.selectionModel,r=n.column,u=n.row;l.isEnabled()&&(s||this._attachDragEvents(t,e),a.isMetaColumn(o)?"_number"===o?i?l.update(u,0,"row"):l.selectRow(u):this._detachDragEvents():(l.setState("cell"),i&&!s?l.update(u,r):(this.focusModel.focusAt(u,r),l.end())))},_attachDragEvents:function(t,e){this.setOwnProperties({mouseDownX:t,mouseDownY:e}),$(document).on("mousemove",$.proxy(this._onMouseMove,this)).on("mouseup",$.proxy(this._detachDragEvents,this)).on("selectstart",$.proxy(this._onSelectStart,this))},_detachDragEvents:function(){this.selectionModel.stopAutoScroll(),$(document).off("mousemove",this._onMouseMove).off("mouseup",this._detachDragEvents).off("selectstart",this._onSelectStart)},_onMouseMove:function(t){var e=this.selectionModel,i=t.pageX,n=t.pageY,o=this._getMouseMoveDistance(i,n)>10;(e.hasSelection()||o)&&e.updateByMousePosition(i,n)},_getMouseMoveDistance:function(t,e){var i=Math.abs(this.mouseDownX-t),n=Math.abs(this.mouseDownY-e);return Math.round(Math.sqrt(Math.pow(i,2)+Math.pow(n,2)))},_onSelectStart:function(t){return t.preventDefault(),!1},render:function(){var t=this.whichSide;return this._destroyChildren(),this.dimensionModel.get("scrollX")||this.$el.css("overflow-x","hidden"),this.dimensionModel.get("scrollY")||"R"!==t||this.$el.css("overflow-y","hidden"),this.$el.css("height",this.dimensionModel.get("bodyHeight")),this.$container=$(o),this.$el.append(this.$container),this._addChildren([this.viewFactory.createBodyTable(t),this.viewFactory.createSelectionLayer(t)]),this.$container.append(this._renderChildren()),this._resetContainerHeight(),this}});e.exports=s},{"../../base/view":7}],44:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap").dimension,a=s.CELL_BORDER_WIDTH,l=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({dimensionModel:t.dimensionModel,renderModel:t.renderModel,columnModel:t.columnModel,viewFactory:t.viewFactory,painterManager:t.painterManager,whichSide:t.whichSide||"R"}),this.listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged),this.listenTo(this.renderModel,"change:dummyRowCount",this._resetOverflow),this.listenTo(this.dimensionModel,"change:bodyHeight",this._resetHeight),this._attachAllTableEventHandlers()},tagName:"div",className:"table_container",template:_.template('<%=colGroup%><%=tbody%>
'),_onColumnWidthChanged:function(){var t=this.dimensionModel.getColumnWidthList(this.whichSide),e=this.$el.find("col"),i=0;_.each(t,function(t,n){e.eq(n).css("width",t-l.EXTRA_WIDTH),i+=t+a},this),o.isBrowserIE7()&&this.$el.width(i+a)},_resetOverflow:function(){var t="visible";this.renderModel.get("dummyRowCount")>0&&(t="hidden"),this.$el.css("overflow",t)},_resetHeight:function(){var t=this.dimensionModel;this.renderModel.get("dummyRowCount")>0?this.$el.height(t.get("bodyHeight")-t.getScrollXHeight()):this.$el.css("height","")},resetTablePosition:function(){this.$el.css("top",this.renderModel.get("top"))},render:function(){return this._destroyChildren(),this.$el.html(this.template({colGroup:this._getColGroupMarkup(),tbody:""})),this._addChildren(this.viewFactory.createRowList({bodyTableView:this,el:this.$el.find("tbody"),whichSide:this.whichSide})),this._renderChildren(),this._resetHeight(),this._resetOverflow(),this},_attachTableEventHandler:function(t,e){_.each(e,function(e,i){this.$el.on(i,t+" "+e.selector,e.handler)},this)},_attachAllTableEventHandlers:function(){var t=this.painterManager.getRowPainter(),e=this.painterManager.getCellPainters();this._attachTableEventHandler("tr",t.getEventHandlerInfo()),_.each(e,function(t,e){var i="td[edit-type="+e+"]",n=t.getEventHandlerInfo();this._attachTableEventHandler(i,n)},this)},redrawTable:function(t){return this.$el[0].innerHTML=this.template({colGroup:this._getColGroupMarkup(),tbody:t}),this.$el.find("tbody")},_getColGroupMarkup:function(){var t=this.whichSide,e=this.dimensionModel.getColumnWidthList(t),i=this.columnModel.getVisibleColumnModelList(t,!0),n="";return _.each(i,function(t,i){var o=t.columnName,s=e[i]-l.EXTRA_WIDTH;n+=''}),n}},{EXTRA_WIDTH:o.isBrowserIE7()?20:0});e.exports=l},{"../../base/view":7,"../../common/constMap":8,"../../common/util":10}],45:[function(t,e,i){"use strict";var n=t("./frame"),o=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"L"})},className:"lside_area",_onColumnWidthChanged:function(){this.$el.css({width:this.dimensionModel.get("lsideWidth")})},beforeRender:function(){this.$el.css({display:"block",width:this.dimensionModel.get("lsideWidth")})}});e.exports=o},{"./frame":47}],46:[function(t,e,i){"use strict";var n=t("./frame"),o=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"R",$scrollBorder:null}),this.listenTo(this.dimensionModel,"change:bodyHeight change:headerHeight",this._resetScrollBorderHeight)},className:"rside_area",_onColumnWidthChanged:function(){var t=this.dimensionModel;this.$el.css({width:t.get("rsideWidth"),marginLeft:t.get("lsideWidth")})},_resetScrollBorderHeight:function(){var t=this.dimensionModel,e=t.get("bodyHeight")-t.getScrollXHeight();this.$scrollBorder.height(e)},beforeRender:function(){var t=this.dimensionModel;this.$el.css({display:"block",width:t.get("rsideWidth"),marginLeft:t.get("lsideWidth")})},afterRender:function(){var t,e,i,n,o,s=this.dimensionModel;this.dimensionModel.get("scrollY")&&(n=s.get("headerHeight"),o=s.get("bodyHeight"),t=$("
").addClass("header_space"),e=$("
").addClass("scrollbar_border"),i=$("
").addClass("scrollbar_corner"),t.height(n-2),e.css("top",n+"px"),i.css("bottom",s.get("toolbarHeight")),this.$el.append(t,e,i),this.$scrollBorder=e,this._resetScrollBorderHeight())}});e.exports=o},{"./frame":47}],47:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({viewFactory:t.viewFactory,renderModel:t.renderModel,dimensionModel:t.dimensionModel,whichSide:t.whichSide||"R"}),this.listenTo(this.renderModel,"columnModelChanged",this.render,this).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged,this)},tagName:"div",className:"lside_area",render:function(){var t=this.viewFactory;return this._destroyChildren(),this.beforeRender(),this._addChildren([t.createHeader(this.whichSide),t.createBody(this.whichSide)]),this.$el.append(this._renderChildren()),this.afterRender(),this},_onColumnWidthChanged:function(){},beforeRender:function(){},afterRender:function(){}});e.exports=o},{"../../base/view":7}],48:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({renderModel:t.renderModel,dimensionModel:t.dimensionModel,selectionModel:t.selectionModel,columnModel:t.columnModel,dataModel:t.dataModel,viewFactory:t.viewFactory,timeoutForAllChecked:0,whichSide:t.whichSide||"R"}),this.listenTo(this.renderModel,"change:scrollLeft",this._onScrollLeftChange,this).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged,this).listenTo(this.dataModel,"change:_button",this._onCheckCountChange,this).listenTo(this.dataModel,"sortChanged",this._updateBtnSortState,this)},tagName:"div",className:"header",events:{click:"_onClick","mousedown th[columnName]":"_onMouseDown"},template:_.template(' <%=colGroup%><%=tBody%>
'),templateHeader:_.template(' 0) {%>colspan=<%=colspan%> <%}%><%if(rowspan > 0) {%>rowspan=<%=rowspan%> <%}%>><%=title%><%=btnSort%>'),templateCol:_.template(''),markupBtnSort:'',_getColGroupMarkup:function(){var t=this._getColumnData(),e=t.widthList,i=t.modelList,n=[];return _.each(e,function(t,e){n.push(this.templateCol({columnName:i[e].columnName,width:t}))},this),n.join("")},_onMouseDown:function(t){var e,i;this.selectionModel.isEnabled()&&!$(t.target).is("a.btn_sorting")&&(e=$(t.target).closest("th").attr("columnName"),i=this.columnModel.getUnitColumnNamesIfMerged(e),this._hasMetaColumn(i)||this._controlStartAction(i,t.pageX,t.pageY,t.shiftKey))},_controlStartAction:function(t,e,i,n){var o=this.columnModel,s=_.map(t,function(t){return o.indexOfColumnName(t,!0)});n?this._startColumnSelectionWithShiftKey(s,e,i):this._startColumnSelectionWithoutShiftKey(s),this._attachDragEvents()},_startColumnSelectionWithShiftKey:function(t,e,i){var n=this.selectionModel,o=Math.max.apply(null,t);n.update(0,o,"column"),n.extendColumnSelection(t,e,i)},_startColumnSelectionWithoutShiftKey:function(t){var e=this.selectionModel,i=o.getMinMax(t),n=i.min,s=i.max;e.setMinimumColumnRange([n,s]),e.selectColumn(n),e.update(0,s)},_attachDragEvents:function(){$(document).on("mousemove",$.proxy(this._onMouseMove,this)).on("mouseup",$.proxy(this._detachDragEvents,this)).on("selectstart",$.proxy(this._onSelectStart,this))},_detachDragEvents:function(){this.selectionModel.stopAutoScroll(),$(document).off("mousemove",this._onMouseMove).off("mouseup",this._detachDragEvents).off("selectstart",this._onSelectStart)},_onMouseMove:function(t){var e,i,n=this.columnModel,o=!0,s=$(t.target).closest("th").attr("columnName");s?(e=n.getUnitColumnNamesIfMerged(s),i=_.map(e,function(t){return n.indexOfColumnName(t,!0)})):$.contains(this.el,t.target)&&(o=!1),o&&this.selectionModel.extendColumnSelection(i,t.pageX,t.pageY)},_hasMetaColumn:function(t){var e=!1,i=this.columnModel;return tui.util.forEach(t,function(t){return i.isMetaColumn(t)?(e=!0,!1):void 0}),e},_onSelectStart:function(t){return t.preventDefault(),!1},_onCheckCountChange:function(){"checkbox"===this.columnModel.get("selectType")&&(clearTimeout(this.timeoutForAllChecked),this.timeoutForAllChecked=setTimeout($.proxy(this._syncCheckState,this),10))},_getHeaderMainCheckbox:function(){return this.$el.find('th[columnname="_button"] input')},_syncCheckState:function(){var t,e,i;this.columnModel&&"checkbox"===this.columnModel.get("selectType")&&(t=this._getHeaderMainCheckbox(),t.length&&(e=0,i=this.dataModel.getRowList(!0).length,this.dataModel.forEach(function(t){var i=t.getCellState("_button");!i.isDisabled&&i.isEditable&&(e+=1)},this),t.prop("checked",e===i)))},_onColumnWidthChanged:function(){var t=this._getColumnData(),e=t.widthList,i=this.$el.find("col");_.each(e,function(t,e){i.eq(e).css("width",t+"px")})},_onScrollLeftChange:function(t,e){"R"===this.whichSide&&(this.el.scrollLeft=e)},_onClick:function(t){var e=$(t.target),i=e.closest("th").attr("columnname");"_button"===i&&e.is("input")?e.prop("checked")?this.dataModel.checkAll():this.dataModel.uncheckAll():e.is("a.btn_sorting")&&this.dataModel.sortByField(i)},_updateBtnSortState:function(t){this._$currentSortBtn&&this._$currentSortBtn.removeClass("sorting_down sorting_up"),this._$currentSortBtn=this.$el.find("th[columnname="+t.columnName+"] a.btn_sorting"),this._$currentSortBtn.addClass(t.isAscending?"sorting_up":"sorting_down")},render:function(){return this._destroyChildren(),this.dimensionModel.get("scrollX")||this.$el.css("overflow-x","hidden"),this.dimensionModel.get("scrollY")||this.$el.css("overflow-y","hidden"),this.$el.css({height:this.dimensionModel.get("headerHeight")}).html(this.template({colGroup:this._getColGroupMarkup(),tBody:this._getTableBodyMarkup()})),this._addChildren(this.viewFactory.createHeaderResizeHandler(this.whichSide)),this.$el.append(this._renderChildren()),this},_getColumnData:function(){var t=this.columnModel,e=this.dimensionModel,i=e.getColumnWidthList(this.whichSide),n=t.getVisibleColumnModelList(this.whichSide,!0);return{widthList:i,modelList:n}},_getTableBodyMarkup:function(){var t,e,i=this._getColumnHierarchyList(),n=this._getHierarchyMaxRowCount(i),s=this.dimensionModel.get("headerHeight"),a=new Array(n),l=new Array(n),r=[],u=o.getRowHeight(n,s)-1,d=1;return _.each(i,function(e,o){var h=i[o].length,c=0;_.each(e,function(e,i){var o=e.columnName;d=h-1===i&&n-h+1>1?n-h+1:1,t=u*d,i===h-1?t=s-c-2:c+=t+1,l[i]===o?(a[i].pop(),r[i]+=1):r[i]=1,l[i]=o,a[i]=a[i]||[],a[i].push(this.templateHeader({columnName:o,height:t,colspan:r[i],rowspan:d,title:e.title,btnSort:e.isSortable?this.markupBtnSort:""}))},this)},this),e=_.map(a,function(t){return""+t.join("")+""}),e.join("")},_getHierarchyMaxRowCount:function(t){var e=[0];return _.each(t,function(t){e.push(t.length)},this),Math.max.apply(Math,e)},_getColumnHierarchyList:function(){var t,e=this._getColumnData().modelList;return t=_.map(e,function(t){return this._getColumnHierarchy(t).reverse()},this)},_getColumnHierarchy:function(t,e){var i=this.columnModel.get("columnMerge");return e=e||[],t&&(e.push(t),i&&_.each(i,function(i){-1!==$.inArray(t.columnName,i.columnNameList)&&this._getColumnHierarchy(i,e)},this)),e}});e.exports=s},{"../../base/view":7,"../../common/util":10}],49:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){this.setOwnProperties({dimensionModel:t.dimensionModel,columnModel:t.columnModel,whichSide:t.whichSide||"R",isResizing:!1,$target:null,differenceLeft:0,initialWidth:0,initialOffsetLeft:0,initialLeft:0}),this.listenTo(this.dimensionModel,"change:which columnWidthChanged",this._refreshHandlerPosition)},tagName:"div",className:"resize_handle_container",events:{"mousedown .resize_handle":"_onMouseDown","click .resize_handle":"_onClick"},template:_.template('
" style="<%=height%>" title="마우스 드래그를 통해 컬럼의 넓이를 변경할 수 있고,더블클릭을 통해 넓이를 초기화할 수 있습니다.">
'),_getColumnData:function(){var t=this.columnModel,e=this.dimensionModel,i=e.getColumnWidthList(this.whichSide),n=t.getVisibleColumnModelList(this.whichSide,!0);return{widthList:i,modelList:n}},_getResizeHandlerMarkup:function(){var t,e=this._getColumnData(),i=e.modelList,n=this.dimensionModel.get("headerHeight"),o=i.length;return t=_.map(i,function(t,e){return this.template({columnIndex:e,columnName:t.columnName,isLast:e+1===o,height:n})},this),t.join("")},render:function(){var t=this.dimensionModel.get("headerHeight"),e=this._getResizeHandlerMarkup();return this.$el.empty().show().html(e).css({marginTop:-t,height:t}),this._refreshHandlerPosition(),this},_refreshHandlerPosition:function(){var t,e,i,n=this._getColumnData(),o=n.widthList,s=this.$el.find(".resize_handle"),a=this.$el.parent().find("table:first"),l=!1,r=0,u=1;tui.util.forEachArray(s,function(n,d){t=s.eq(d),e=t.attr("columnname"),i=a.find('th[columnname="'+e+'"]').width(),tui.util.isExisty(i)?l=l||i!==o[d]:i=o[d],r+=i+u,t.css("left",r-3+"px")})},_isResizing:function(){return!!this.isResizing},_onMouseDown:function(t){this._startResizing(t)},_onClick:function(t){var e=$(t.target),i=parseInt(e.attr("columnindex"),10),n=e.data("isClicked");n?(this.dimensionModel.restoreColumnWidth(this._getHandlerColumnIndex(i)),this._clearClickedFlag(e),this._refreshHandlerPosition()):this._setClickedFlag(e)},_setClickedFlag:function(t){t.data("isClicked",!0),setTimeout($.proxy(this._clearClickedFlag,this,t),500)},_clearClickedFlag:function(t){t.data("isClicked",!1)},_onMouseUp:function(){this._stopResizing()},_onMouseMove:function(t){var e,i,n;this._isResizing()&&(t.preventDefault(),e=t.pageX-this.initialOffsetLeft,i=this._calculateWidth(t.pageX),n=parseInt(this.$target.attr("columnindex"),10),this.$target.css("left",e+"px"),this.dimensionModel.setColumnWidth(this._getHandlerColumnIndex(n),i),this._refreshHandlerPosition())},_calculateWidth:function(t){var e=t-this.initialOffsetLeft-this.initialLeft;return this.initialWidth+e},_getHandlerColumnIndex:function(t){return"R"===this.whichSide?t+this.columnModel.getVisibleColumnFixCount(!0):t},_startResizing:function(t){var e=this._getColumnData(),i=e.widthList,n=$(t.target);this.isResizing=!0,this.$target=n,this.initialLeft=parseInt(n.css("left").replace("px",""),10),this.initialOffsetLeft=this.$el.offset().left,this.initialWidth=i[n.attr("columnindex")],$("body").css("cursor","col-resize"),$(document).bind("mousemove",$.proxy(this._onMouseMove,this)).bind("mouseup",$.proxy(this._onMouseUp,this)),n[0].setCapture&&n[0].setCapture()},_stopResizing:function(){this.$target&&this.$target[0].releaseCapture&&this.$target[0].releaseCapture(),this.isResizing=!1,this.$target=null,this.initialLeft=0,this.initialOffsetLeft=0,this.initialWidth=0,$("body").css("cursor","default"),$(document).unbind("mousemove",$.proxy(this._onMouseMove,this)).unbind("mouseup",$.proxy(this._onMouseUp,this))},destroy:function(){this.stopListening(),this._stopResizing(), +this.remove()}});e.exports=o},{"../../base/view":7}],50:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.toolbarModel=t.toolbarModel,this.dimensionModel=t.dimensionModel,this.viewFactory=t.viewFactory},tagName:"div",className:"toolbar",render:function(){var t=this.toolbarModel;return this._destroyChildren(),t.get("hasControlPanel")&&this._addChildren(this.viewFactory.createToolbarControlPanel()),t.get("hasResizeHandler")&&this._addChildren(this.viewFactory.createToolbarResizeHandler()),t.get("hasPagination")&&this._addChildren(this.viewFactory.createToolbarPagination()),this.$el.empty().append(this._renderChildren()),this._refreshHeight(),this},_refreshHeight:function(){var t=this.dimensionModel.get("toolbarHeight");this.$el.height(t),this.$el.toggle(!!t)}});e.exports=o},{"../../base/view":7}],51:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.setOwnProperties({gridId:t.gridId,toolbarModel:t.toolbarModel,$btnExcel:null,$btnExcelAll:null}),this.listenTo(this.toolbarModel,"change:isExcelButtonVisible change:isExcelAllButtonVisible",this.render)},events:{"click a.excel_download_button":"_onClickExcel"},tagName:"div",className:"btn_setup",templateExcelBtn:_.template('<%=text%>'),_onClickExcel:function(t){var e,i=tui.Grid.getInstanceById(this.gridId),n=i.getAddOn("Net");t.preventDefault(),n&&(e=$(t.target).closest("a"),e.hasClass("excel_page")?n.download("excel"):e.hasClass("excel_all")&&n.download("excelAll"))},render:function(){var t=this.toolbarModel;return this.$el.empty(),t.get("isExcelButtonVisible")&&this.$el.append(this.templateExcelBtn({className:"excel_page",text:"엑셀 다운로드"})),t.get("isExcelAllButtonVisible")&&this.$el.append(this.templateExcelBtn({className:"excel_all",text:"전체 엑셀 다운로드"})),this}});e.exports=o},{"../../../base/view":7}],52:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.toolbarModel=t.toolbarModel},tagName:"div",className:"grid_pagination",template:_.template('FirstPrev LastFirst OffPrev OffNext OffLast Off'),render:function(){return this._destroyChildren(),this.$el.empty().html(this.template()),this._setPaginationInstance(),this},_setPaginationInstance:function(){var t=tui&&tui.component&&tui.component.Pagination,e=this.toolbarModel.get("pagination");!e&&t&&(e=new t({itemCount:1,itemPerPage:1,pagePerPageList:5,isCenterAlign:!0,moveUnit:"page",$preOff:this.$el.find(".pre_off"),$pre_endOff:this.$el.find(".pre_end_off"),$nextOff:this.$el.find(".next_off"),$lastOff:this.$el.find(".next_end_off")},this.$el)),this.toolbarModel.set("pagination",e)}});e.exports=o},{"../../../base/view":7}],53:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.timeoutIdForResize=0},tagName:"div",className:"height_resize_bar",template:_.template(''),events:{mousedown:"_onMouseDown"},_attachMouseEvent:function(){$(document).on("mousemove",$.proxy(this._onMouseMove,this)),$(document).on("mouseup",$.proxy(this._onMouseUp,this)),$(document).on("selectstart",$.proxy(this._onSelectStart,this))},_detachMouseEvent:function(){$(document).off("mousemove",$.proxy(this._onMouseMove,this)),$(document).off("mouseup",$.proxy(this._onMouseUp,this)),$(document).off("selectstart",$.proxy(this._onSelectStart,this))},_onMouseDown:function(t){t.preventDefault(),$(document.body).css("cursor","row-resize"),this._attachMouseEvent()},_onMouseMove:function(t){var e=this.dimensionModel,i=e.get("offsetTop"),n=e.get("headerHeight"),o=e.get("rowHeight"),s=e.get("toolbarHeight"),a=t.pageY-i-n-s;clearTimeout(this.timeoutIdForResize),a=Math.max(a,o+e.getScrollXHeight()),this.timeoutIdForResize=setTimeout(function(){e.set({bodyHeight:a})},0)},_onMouseUp:function(){$(document.body).css("cursor","default"),this._detachMouseEvent()},_onSelectStart:function(t){return t.preventDefault(),!1},render:function(){return this._destroyChildren(),this.$el.html(this.template()),this},destroy:function(){this.stopListening(),this._onMouseUp(),this._destroyChildren(),this.remove()}});e.exports=o},{"../../../base/view":7}],54:[function(t,e,i){"use strict";var n=t("../base/view"),o=n.extend({initialize:function(t){var e=t.focusModel,i=t.renderModel,n=t.whichSide||"R";this.setOwnProperties({whichSide:n,bodyTableView:t.bodyTableView,focusModel:e,renderModel:i,dataModel:t.dataModel,columnModel:t.columnModel,collection:i.getCollection(n),painterManager:t.painterManager,sortOptions:null,renderedRowKeys:null}),this.listenTo(this.collection,"change",this._onModelChange).listenTo(e,"select",this._onSelect).listenTo(e,"unselect",this._onUnselect).listenTo(e,"focus",this._onFocus).listenTo(e,"blur",this._onBlur).listenTo(e,"focusIn",this._onFocusIn).listenTo(i,"rowListChanged",this.render)},_getColumnModelList:function(){return this.columnModel.getVisibleColumnModelList(this.whichSide,!0)},_removeOldRows:function(t){var e=_.indexOf(this.renderedRowKeys,t[0]),i=_.indexOf(this.renderedRowKeys,_.last(t)),n=this.$el.children("tr");n.slice(0,e).remove(),n.slice(i+1).remove()},_appendNewRows:function(t,e){var i=this.collection.slice(0,_.indexOf(t,e[0])),n=this.collection.slice(_.indexOf(t,_.last(e))+1);this.$el.prepend(this._getRowsHtml(i)),this.$el.append(this._getRowsHtml(n))},_resetRows:function(){var t,e=this._getRowsHtml(this.collection.models);if(o.isInnerHtmlOfTbodyReadOnly)t=this.bodyTableView.redrawTable(e),this.setElement(t,!1),tui.util.browser.msie&&tui.util.browser.version<=7&&t.width(t.width());else try{this.$el[0].innerHTML=e}catch(i){o.isInnerHtmlOfTbodyReadOnly=!0,this._resetRows()}},_getRowsHtml:function(t){var e=this.painterManager.getRowPainter(),i=this._getColumnModelList();return _.map(t,function(t){return e.getHtml(t,i)}).join("")},_getRowElement:function(t){return this.$el.find('tr[key="'+t+'"]')},_onSelect:function(t){this._setCssSelect(t.rowKey,!0)},_onUnselect:function(t){this._setCssSelect(t,!1)},_setCssSelect:function(t,e){var i,n,o,s,a=this._getColumnModelList(),l={};_.each(a,function(a){i=a.columnName,n=this.dataModel.getMainRowKey(t,i),l[n]=l[n]||this._getRowElement(n),o=l[n],s=o.find('td[columnname="'+i+'"]'),s.length&&s.toggleClass("selected",e)},this)},_onBlur:function(t,e){var i=this.dataModel.getElement(t,e);i.length&&i.removeClass("focused")},_onFocus:function(t,e){var i=this.dataModel.getElement(t,e);i.length&&i.addClass("focused")},_onFocusIn:function(t,e){var i,n,o,s=this.columnModel.isLside(e)?"L":"R";s===this.whichSide&&(i=this.dataModel.getElement(t,e),n=this.columnModel.getEditType(e),o=this.painterManager.getCellPainter(n),o.focusIn(i))},render:function(t){var e,i=this.collection.pluck("rowKey");return this.bodyTableView.resetTablePosition(),t?this._resetRows():(e=_.intersection(i,this.renderedRowKeys),_.isEmpty(i)||_.isEmpty(e)||e.length/i.length<.7?this._resetRows():(this._removeOldRows(e),this._appendNewRows(i,e))),this.renderedRowKeys=i,this.focusModel.focusClipboard(),this},_onModelChange:function(t){var e=this._getRowElement(t.get("rowKey"));this.painterManager.getRowPainter().onModelChange(t,e)}},{isInnerHtmlOfTbodyReadOnly:tui.util.browser.msie&&tui.util.browser.version<=9});e.exports=o},{"../base/view":7}],55:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=1,a=n.extend({initialize:function(t){this.setOwnProperties({whichSide:t.whichSide||"R",dimensionModel:t.dimensionModel,columnModel:t.columnModel,selectionModel:t.selectionModel}),this._updateColumnWidthList(),this.listenTo(this.dimensionModel,"columnWidthChanged",this._onChangeColumnWidth),this.listenTo(this.selectionModel,"change:range",this.render)},tagName:"div",className:"selection_layer",_updateColumnWidthList:function(){this.columnWidthList=this.dimensionModel.getColumnWidthList(this.whichSide)},_onChangeColumnWidth:function(){this._updateColumnWidthList(),this.render()},_getOwnSideColumnRange:function(t){var e=this.columnModel.getVisibleColumnFixCount(),i=null;return"L"===this.whichSide?t[0]=e&&(i=[Math.max(t[0],e)-e,t[1]-e]),i},_getVerticalStyles:function(t){var e=this.dimensionModel.get("rowHeight"),i=o.getHeight(t[0],e)-s,n=o.getHeight(t[1]-t[0]+1,e)-2*s;return{top:i+"px",height:n+"px"}},_getHorizontalStyles:function(t){var e=this.columnWidthList,i=this.columnModel.getVisibleMetaColumnCount(),n=t[0],o=t[1],a=0,l=0,r=0;for("L"===this.whichSide&&(n+=i,o+=i),o=Math.min(o,e.length-1);o>=r;r+=1)n>r?a+=e[r]+s:l+=e[r]+s;return l-=s,{left:a+"px",width:l+"px"}},render:function(){var t,e,i=this.selectionModel.get("range");return i&&(e=this._getOwnSideColumnRange(i.column)),e?(t=_.assign({},this._getVerticalStyles(i.row),this._getHorizontalStyles(e)),this.$el.show().css(t)):this.$el.hide(),this}});e.exports=a},{"../base/view":7,"../common/util":10}],56:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").renderState,s=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.renderModel=t.renderModel,this.listenTo(this.dimensionModel,"change",this._refreshLayout),this.listenTo(this.renderModel,"change:state",this.render)},className:"state_layer",template:_.template('
<%= text %> <% if (isLoading) { %>
<% } %>
'),render:function(){var t=this.renderModel.get("state");return t===o.DONE?this.$el.hide():(this.$el.html(this.template({text:this._getMessage(t),isLoading:t===o.LOADING})).show(),this._refreshLayout()),this},_getMessage:function(t){switch(t){case o.LOADING:return"요청을 처리 중입니다.";case o.EMPTY:return this.renderModel.get("emptyMessage")||"데이터가 존재하지 않습니다.";default:return null}},_refreshLayout:function(){var t=this.dimensionModel;this.$el.css({marginTop:t.get("headerHeight"),height:t.get("bodyHeight")+t.get("toolbarHeight")})}});e.exports=s},{"../base/view":7,"../common/constMap":8}]},{},[12]); \ No newline at end of file diff --git a/samples/css/grid.css b/samples/css/grid.css index c21d5fc63..a46ee88e0 100644 --- a/samples/css/grid.css +++ b/samples/css/grid.css @@ -1,7 +1,7 @@ /** * @fileoverview tui-grid * @author NHN Ent. FE Development Team - * @version 1.1.1 + * @version 1.1.2 * @license MIT * @link https://github.com/nhnent/tui.grid */ @@ -12,13 +12,13 @@ position: relative; border-bottom: solid 1px #ccc; clear: both; - scrollbar-highlight-color: #f2f2f2; - scrollbar-shadow-color: #f2f2f2; + scrollbar-highlight-color: #f5f5f5; + scrollbar-shadow-color: #f5f5f5; scrollbar-arrow-color: #8a8a8a; scrollbar-face-color: #d9d9d9; - scrollbar-3dlight-color: #f2f2f2; - scrollbar-darkshadow-color: #f2f2f2; - scrollbar-track-color: #f2f2f2; + scrollbar-3dlight-color: #f5f5f5; + scrollbar-darkshadow-color: #f5f5f5; + scrollbar-track-color: #f5f5f5; font-size: 12px; font-family: '돋움', Dotum, Helvetica, 'Apple SD Gothic Neo', Sans-serif; } @@ -26,7 +26,7 @@ -webkit-appearance: none; width: 17px; height: 17px; - background-color: #f2f2f2; + background-color: #f5f5f5; border-top: solid 1px #ccc; } .uio_grid ::-webkit-scrollbar-thumb { @@ -157,20 +157,14 @@ .uio_grid .lside_area .data table { *margin-right: -17px; } -.uio_grid .lside_area .data table .meta_column { - background: #f8f8f8; -} -.uio_grid .lside_area .data table .meta_column.selected { - background: #e0e0e0; -} .uio_grid .lside_area .data .selection_layer { display: none; position: absolute; top: 0; width: 0; height: 0; - border: dotted 1px #f00; - background: #ffa500; + border: solid 1px #004082; + background: #4daaf9; opacity: 0.2; filter: alpha(opacity=10); left: 1px; @@ -205,8 +199,8 @@ top: 0; width: 0; height: 0; - border: dotted 1px #f00; - background: #ffa500; + border: solid 1px #004082; + background: #4daaf9; opacity: 0.2; filter: alpha(opacity=10); left: -1px; @@ -219,7 +213,7 @@ right: 0; width: 16px; border: solid 1px #ccc; - background: #f8f8f8; + background: #eee; } .uio_grid .rside_area .scrollbar_border { display: block; @@ -236,9 +230,6 @@ height: 17px; background-color: #f2f2f2; } -.uio_grid .header th { - background: #f8f8f8; -} .uio_grid .header .resize_handle_container { display: none; position: relative; @@ -268,7 +259,7 @@ .uio_grid table { border: 0; table-layout: fixed; - background-color: #ccc; + background-color: #d8d8d8; border-collapse: separate; border-spacing: 1px; margin: 0; @@ -280,6 +271,11 @@ text-align: center; padding: 0; border: 0; + background: #eee; +} +.uio_grid table th.selected { + background: #b0b0b0; + color: #f8f8f8; } .uio_grid table th .sort a { color: #555; @@ -301,51 +297,48 @@ .uio_grid table th .sorting_up { background-position: -10px -60px; } -.uio_grid table tr.selected { - background-color: #f8f8f8; -} .uio_grid table tr.disabled { color: #b0b0b0; } -.uio_grid table tr.invalidated { - background-color: #ffe1e1; -} -.uio_grid table col { - background: #fff; -} -.uio_grid table col.editable { - background-color: #ffffef; -} .uio_grid table td { overflow: hidden; padding: 0 10px; *padding: 1px 10px; border: 0; white-space: nowrap; + background-color: #fbfbfb; *white-space: pre; } +.uio_grid table td.meta_column { + background: #eee; +} +.uio_grid table td.meta_column.dummy { + background: #eee; +} +.uio_grid table td.meta_column.selected { + background: #b0b0b0; + color: #f8f8f8; +} .uio_grid table td.editable { - background-color: #ffffef; + background-color: #fff; } -.uio_grid table td.selected { - background-color: #f8f8f8; - font-weight: bold; +.uio_grid table td.dummy { + background-color: #fff; +} +.uio_grid table td.required { + background-color: #fffdeb; } .uio_grid table td.disabled { color: #b0b0b0; } -.uio_grid table td.invalidated_row { - background: #ffe1e1; -} -.uio_grid table td.invalidated_column, -.uio_grid table td.invalidated_column input, -.uio_grid table td.invalidated_column select { - color: #ff0202; -} .uio_grid table td.focused { padding: 0 9px; border: dotted 1px #190000; } +.uio_grid table td.invalid { + padding: 0 9px; + border: solid 1px #ff8080; +} .uio_grid table td.ellipsis { -o-text-overflow: ellipsis /*Opera 9*/; -moz-binding: url("ellipsis.xml#ellipsis") /* Firefox */; diff --git a/samples/css/grid.min.css b/samples/css/grid.min.css index 9e62cca75..a40050bb0 100644 --- a/samples/css/grid.min.css +++ b/samples/css/grid.min.css @@ -1,8 +1,8 @@ /** * @fileoverview tui-grid * @author NHN Ent. FE Development Team - * @version 1.1.1 + * @version 1.1.2 * @license MIT * @link https://github.com/nhnent/tui.grid */ -.uio_grid{width:100%;background:#fff;color:#444;position:relative;border-bottom:solid 1px #ccc;clear:both;scrollbar-highlight-color:#f2f2f2;scrollbar-shadow-color:#f2f2f2;scrollbar-arrow-color:#8a8a8a;scrollbar-face-color:#d9d9d9;scrollbar-3dlight-color:#f2f2f2;scrollbar-darkshadow-color:#f2f2f2;scrollbar-track-color:#f2f2f2;font-size:12px;font-family:'돋움',Dotum,Helvetica,'Apple SD Gothic Neo',Sans-serif}.uio_grid ::-webkit-scrollbar{-webkit-appearance:none;width:17px;height:17px;background-color:#f2f2f2;border-top:solid 1px #ccc}.uio_grid ::-webkit-scrollbar-thumb{background-color:#d9d9d9;border:5px solid transparent;border-radius:7px;background-clip:content-box}.uio_grid ::-webkit-scrollbar-thumb:hover{background-color:#c1c1c1}.uio_grid input,.uio_grid p{margin:0;padding:0}.uio_grid input[type=text]{outline:0}.uio_grid li,.uio_grid ul{list-style:none;padding:0;margin:0}.uio_grid em,.uio_grid strong{font-style:normal}.uio_grid .btn_text{display:inline-block;text-decoration:none}.uio_grid .btn_text span{display:inline-block;position:relative;font-size:11px;color:#333;padding-left:17px;letter-spacing:-1px;line-height:23px;white-space:nowrap;cursor:pointer;margin-left:8px;padding-right:7px}.uio_grid .btn_text em{position:absolute;left:0;top:5px;width:17px;height:12px;background:url(../images/icons.gif) no-repeat}.uio_grid .btn_text em.excel,.uio_grid .btn_text em.grid{background-position:-30px -60px}.uio_grid .left_line,.uio_grid .right_line{position:absolute;width:1px;height:100%;background:#ccc;z-index:10;top:0}.uio_grid .left_line{left:0}.uio_grid .right_line{right:0}.uio_grid .clipboard{position:fixed;top:0;left:-9999px;width:100px;height:100px}.uio_grid .state_layer{position:absolute;box-sizing:content-box;top:0;left:0;width:100%;border-bottom:solid 1px #ccc;background:#fff;font-weight:700;text-align:center;z-index:10}.uio_grid .state_layer .layer_content{padding-top:50px}.uio_grid .state_layer .layer_content .loading_img{display:block;margin:10px auto 0;background:url(../images/ani_loading.gif);border:0;width:150px;height:13px}.uio_grid .lside_area{display:none;height:100%;position:absolute;top:0;left:0;overflow:hidden}.uio_grid .lside_area .header{overflow:hidden}.uio_grid .lside_area .data{overflow:scroll;position:relative;margin-right:-17px}.uio_grid .lside_area .data table .meta_column{background:#f8f8f8}.uio_grid .lside_area .data table .meta_column.selected{background:#e0e0e0}.uio_grid .lside_area .data .selection_layer,.uio_grid .rside_area .data .selection_layer{display:none;width:0;border:1px dotted red;background:orange;opacity:.2;filter:alpha(opacity=10);top:0}.uio_grid .lside_area .data .selection_layer{position:absolute;height:0;left:1px}.uio_grid .rside_area{display:none;height:100%;overflow:hidden}.uio_grid .rside_area .header{position:relative;overflow-x:hidden;overflow-y:scroll}.uio_grid .rside_area .data{position:relative;overflow:scroll}.uio_grid .rside_area .data .selection_layer{position:absolute;height:0;left:-1px}.uio_grid .rside_area .header_space{display:block;box-sizing:content-box;position:absolute;top:0;right:0;width:16px;border:1px solid #ccc;background:#f8f8f8}.uio_grid .rside_area .scrollbar_border{display:block;position:absolute;right:17px;width:1px;background:#ccc}.uio_grid .rside_area .scrollbar_corner{position:absolute;bottom:0;right:0;width:17px;height:17px;background-color:#f2f2f2}.uio_grid .header th{background:#f8f8f8}.uio_grid .header .resize_handle_container{display:none;position:relative;width:0}.uio_grid .header .resize_handle_container .resize_handle{float:left;position:absolute;top:-1px;left:-99px;width:7px;height:100%;background:red;opacity:0;filter:alpha(opacity=0);cursor:col-resize}.uio_grid .header .resize_handle_container .resize_handle_last{width:3px}.uio_grid .body_container{position:relative}.uio_grid .body_container .table_container{position:absolute}.uio_grid table{border:0;table-layout:fixed;background-color:#ccc;border-collapse:separate;border-spacing:1px;margin:0}.uio_grid table th{overflow:hidden;white-space:nowrap;text-align:center;padding:0;border:0}.uio_grid table th .sort a{color:#555;text-decoration:none}.uio_grid table td.disabled,.uio_grid table tr.disabled{color:#b0b0b0}.uio_grid table th .btn_sorting{display:inline-block;overflow:hidden;margin-left:6px;height:15px;width:8px;background:url(../images/icons.gif) -20px -60px no-repeat;vertical-align:middle;cursor:pointer}.uio_grid table th .sorting_down{background-position:0 -60px}.uio_grid table th .sorting_up{background-position:-10px -60px}.uio_grid table tr.selected{background-color:#f8f8f8}.uio_grid table tr.invalidated{background-color:#ffe1e1}.uio_grid table col{background:#fff}.uio_grid table col.editable,.uio_grid table td.editable{background-color:#ffffef}.uio_grid table td{overflow:hidden;padding:0 10px;border:0;white-space:nowrap}.uio_grid table td.selected{background-color:#f8f8f8;font-weight:700}.uio_grid table td.invalidated_row{background:#ffe1e1}.uio_grid table td.invalidated_column,.uio_grid table td.invalidated_column input,.uio_grid table td.invalidated_column select{color:#ff0202}.uio_grid table td.focused{padding:0 9px;border:1px dotted #190000}.uio_grid table td.ellipsis{-o-text-overflow:ellipsis;-moz-binding:url(ellipsis.xml#ellipsis);width:100%;text-overflow:ellipsis}.uio_grid table td img{vertical-align:middle}.uio_grid table td span.before{float:left;margin-right:2px;line-height:1.5}.uio_grid table td span.after{float:right;margin-left:2px;line-height:1.5}.uio_grid table td span.input{display:block;overflow:hidden;line-height:1.5}.uio_grid table td span.input input{box-sizing:border-box}.uio_grid table td input[type=password],.uio_grid table td input[type=text]{width:100%;padding:2px 0;border:1px solid #e2e3ea;border-top:solid 1px #abadb3;border-bottom:solid 1px #e3e9ef}.uio_grid table td input.editing{border:1px solid #748eea}.uio_grid table td .search_bx{position:relative}.uio_grid table td .search{display:block;height:20px;padding:0 33px 0 6px;border:1px solid #9c9c9c;line-height:20px}.uio_grid table td .search input{width:100%;background:0 0;padding:4px 0 0;border:0;color:#999;-webkit-appearance:none}.uio_grid table td select{width:100%}.uio_grid table td a{color:#002caf}.uio_grid .toolbar{display:none;width:100%;height:65px;bottom:0;position:absolute;background:#fff;border-top:1px solid #ccc}.uio_grid .toolbar .total_count{position:absolute;top:20px;left:24px;color:#002caf;font-weight:700}.uio_grid .toolbar .btn_setup{position:absolute;right:10px;top:14px}.uio_grid .toolbar .height_resize_bar{overflow:hidden;cursor:row-resize;position:absolute;bottom:0;height:15px;width:100%;border:0;font-size:0;text-align:center}.uio_grid .toolbar .height_resize_bar span{background:url(../images/icons.gif) -70px -60px no-repeat;display:inline-block;width:17px;height:6px;margin-top:5px}.uio_grid .toolbar .height_resize_handle{display:block;margin:0 10px;border-top:1px solid #ccc;cursor:row-resize}.uio_grid .grid_pagination{height:12px;margin-bottom:12px;padding-top:14px;line-height:normal;text-align:center}.uio_grid .grid_pagination a,.uio_grid .grid_pagination span,.uio_grid .grid_pagination strong{display:inline-block;position:relative;padding:4px 8px;min-width:13px;color:#333;font-size:12px;font-weight:700;line-height:normal;text-decoration:none;vertical-align:middle}.uio_grid .grid_pagination strong{padding:4px 6px;color:#ff1313;border:1px solid #d4d4d4;background:#e7e7e7}.uio_grid .grid_pagination .next,.uio_grid .grid_pagination .next_end,.uio_grid .grid_pagination .next_end_off,.uio_grid .grid_pagination .next_off,.uio_grid .grid_pagination .pre,.uio_grid .grid_pagination .pre_end,.uio_grid .grid_pagination .pre_end_off,.uio_grid .grid_pagination .pre_off{width:25px;height:24px;padding:0;border:0;background:url(../images/icons.gif) no-repeat;font-size:0;line-height:999;overflow:hidden;white-space:nowrap}.uio_grid .grid_pagination .next_end,.uio_grid .grid_pagination .next_end_off,.uio_grid .grid_pagination .pre_end,.uio_grid .grid_pagination .pre_end_off{width:24px}.uio_grid .grid_pagination .pre,.uio_grid .grid_pagination .pre_off{margin-right:12px}.uio_grid .grid_pagination .next,.uio_grid .grid_pagination .next_off{margin-left:12px}.uio_grid .grid_pagination .pre_end{background-position:0 0}.uio_grid .grid_pagination .pre_end_off{background-position:0 -30px}.uio_grid .grid_pagination .pre{background-position:-24px 0}.uio_grid .grid_pagination .pre_off{background-position:-24px -30px}.uio_grid .grid_pagination .next{background-position:-50px 0}.uio_grid .grid_pagination .next_off{background-position:-50px -30px}.uio_grid .grid_pagination .next_end{background-position:-75px 0}.uio_grid .grid_pagination .next_end_off{background-position:-75px -30px} \ No newline at end of file +.uio_grid{width:100%;background:#fff;color:#444;position:relative;border-bottom:solid 1px #ccc;clear:both;scrollbar-highlight-color:#f5f5f5;scrollbar-shadow-color:#f5f5f5;scrollbar-arrow-color:#8a8a8a;scrollbar-face-color:#d9d9d9;scrollbar-3dlight-color:#f5f5f5;scrollbar-darkshadow-color:#f5f5f5;scrollbar-track-color:#f5f5f5;font-size:12px;font-family:'돋움',Dotum,Helvetica,'Apple SD Gothic Neo',Sans-serif}.uio_grid ::-webkit-scrollbar{-webkit-appearance:none;width:17px;height:17px;background-color:#f5f5f5;border-top:solid 1px #ccc}.uio_grid ::-webkit-scrollbar-thumb{background-color:#d9d9d9;border:5px solid transparent;border-radius:7px;background-clip:content-box}.uio_grid ::-webkit-scrollbar-thumb:hover{background-color:#c1c1c1}.uio_grid input,.uio_grid p{margin:0;padding:0}.uio_grid input[type=text]{outline:0}.uio_grid li,.uio_grid ul{list-style:none;padding:0;margin:0}.uio_grid em,.uio_grid strong{font-style:normal}.uio_grid .btn_text{display:inline-block;text-decoration:none}.uio_grid .btn_text span{display:inline-block;position:relative;font-size:11px;color:#333;padding-left:17px;letter-spacing:-1px;line-height:23px;white-space:nowrap;cursor:pointer;margin-left:8px;padding-right:7px}.uio_grid .btn_text em{position:absolute;left:0;top:5px;width:17px;height:12px;background:url(../images/icons.gif) no-repeat}.uio_grid .btn_text em.excel,.uio_grid .btn_text em.grid{background-position:-30px -60px}.uio_grid .left_line,.uio_grid .right_line{position:absolute;width:1px;height:100%;background:#ccc;top:0;z-index:10}.uio_grid .left_line{left:0}.uio_grid .right_line{right:0}.uio_grid .clipboard{position:fixed;top:0;left:-9999px;width:100px;height:100px}.uio_grid .state_layer{position:absolute;box-sizing:content-box;top:0;left:0;width:100%;border-bottom:solid 1px #ccc;background:#fff;font-weight:700;text-align:center;z-index:10}.uio_grid .state_layer .layer_content{padding-top:50px}.uio_grid .state_layer .layer_content .loading_img{display:block;margin:10px auto 0;background:url(../images/ani_loading.gif);border:0;width:150px;height:13px}.uio_grid .lside_area .data .selection_layer,.uio_grid .rside_area .data .selection_layer{display:none;width:0;border:1px solid #004082;background:#4daaf9;opacity:.2;filter:alpha(opacity=10);top:0}.uio_grid .lside_area{display:none;height:100%;position:absolute;top:0;left:0;overflow:hidden}.uio_grid .lside_area .header{overflow:hidden}.uio_grid .lside_area .data{overflow:scroll;position:relative;margin-right:-17px}.uio_grid .lside_area .data .selection_layer{position:absolute;height:0;left:1px}.uio_grid .rside_area{display:none;height:100%;overflow:hidden}.uio_grid .rside_area .header{position:relative;overflow-x:hidden;overflow-y:scroll}.uio_grid .rside_area .data{position:relative;overflow:scroll}.uio_grid .rside_area .data .selection_layer{position:absolute;height:0;left:-1px}.uio_grid .rside_area .header_space{display:block;box-sizing:content-box;position:absolute;top:0;right:0;width:16px;border:1px solid #ccc;background:#eee}.uio_grid .rside_area .scrollbar_border{display:block;position:absolute;right:17px;width:1px;background:#ccc}.uio_grid .rside_area .scrollbar_corner{position:absolute;bottom:0;right:0;width:17px;height:17px;background-color:#f2f2f2}.uio_grid .header .resize_handle_container{display:none;position:relative;width:0}.uio_grid .header .resize_handle_container .resize_handle{float:left;position:absolute;top:-1px;left:-99px;width:7px;height:100%;background:red;opacity:0;filter:alpha(opacity=0);cursor:col-resize}.uio_grid .header .resize_handle_container .resize_handle_last{width:3px}.uio_grid .body_container{position:relative}.uio_grid .body_container .table_container{position:absolute}.uio_grid table{border:0;table-layout:fixed;background-color:#d8d8d8;border-collapse:separate;border-spacing:1px;margin:0}.uio_grid table th{overflow:hidden;white-space:nowrap;text-align:center;padding:0;border:0;background:#eee}.uio_grid table th.selected{background:#b0b0b0;color:#f8f8f8}.uio_grid table th .sort a{color:#555;text-decoration:none}.uio_grid table th .btn_sorting{display:inline-block;overflow:hidden;margin-left:6px;height:15px;width:8px;background:url(../images/icons.gif) -20px -60px no-repeat;vertical-align:middle;cursor:pointer}.uio_grid table th .sorting_down{background-position:0 -60px}.uio_grid table th .sorting_up{background-position:-10px -60px}.uio_grid table tr.disabled{color:#b0b0b0}.uio_grid table td{overflow:hidden;padding:0 10px;border:0;white-space:nowrap;background-color:#fbfbfb}.uio_grid table td.meta_column,.uio_grid table td.meta_column.dummy{background:#eee}.uio_grid table td.meta_column.selected{background:#b0b0b0;color:#f8f8f8}.uio_grid table td.dummy,.uio_grid table td.editable{background-color:#fff}.uio_grid table td.required{background-color:#fffdeb}.uio_grid table td.disabled{color:#b0b0b0}.uio_grid table td.focused{padding:0 9px;border:1px dotted #190000}.uio_grid table td.invalid{padding:0 9px;border:1px solid #ff8080}.uio_grid table td.ellipsis{-o-text-overflow:ellipsis;-moz-binding:url(ellipsis.xml#ellipsis);width:100%;text-overflow:ellipsis}.uio_grid table td img{vertical-align:middle}.uio_grid table td span.before{float:left;margin-right:2px;line-height:1.5}.uio_grid table td span.after{float:right;margin-left:2px;line-height:1.5}.uio_grid table td span.input{display:block;overflow:hidden;line-height:1.5}.uio_grid table td span.input input{box-sizing:border-box}.uio_grid table td input[type=password],.uio_grid table td input[type=text]{width:100%;padding:2px 0;border:1px solid #e2e3ea;border-top:solid 1px #abadb3;border-bottom:solid 1px #e3e9ef}.uio_grid table td input.editing{border:1px solid #748eea}.uio_grid table td .search_bx{position:relative}.uio_grid table td .search{display:block;height:20px;padding:0 33px 0 6px;border:1px solid #9c9c9c;line-height:20px}.uio_grid table td .search input{width:100%;background:0 0;padding:4px 0 0;border:0;color:#999;-webkit-appearance:none}.uio_grid table td select{width:100%}.uio_grid table td a{color:#002caf}.uio_grid .toolbar{display:none;width:100%;height:65px;bottom:0;position:absolute;background:#fff;border-top:1px solid #ccc}.uio_grid .toolbar .total_count{position:absolute;top:20px;left:24px;color:#002caf;font-weight:700}.uio_grid .toolbar .btn_setup{position:absolute;right:10px;top:14px}.uio_grid .toolbar .height_resize_bar{overflow:hidden;cursor:row-resize;position:absolute;bottom:0;height:15px;width:100%;border:0;font-size:0;text-align:center}.uio_grid .toolbar .height_resize_bar span{background:url(../images/icons.gif) -70px -60px no-repeat;display:inline-block;width:17px;height:6px;margin-top:5px}.uio_grid .toolbar .height_resize_handle{display:block;margin:0 10px;border-top:1px solid #ccc;cursor:row-resize}.uio_grid .grid_pagination{height:12px;margin-bottom:12px;padding-top:14px;line-height:normal;text-align:center}.uio_grid .grid_pagination a,.uio_grid .grid_pagination span,.uio_grid .grid_pagination strong{display:inline-block;position:relative;padding:4px 8px;min-width:13px;color:#333;font-size:12px;font-weight:700;line-height:normal;text-decoration:none;vertical-align:middle}.uio_grid .grid_pagination strong{padding:4px 6px;color:#ff1313;border:1px solid #d4d4d4;background:#e7e7e7}.uio_grid .grid_pagination .next,.uio_grid .grid_pagination .next_end,.uio_grid .grid_pagination .next_end_off,.uio_grid .grid_pagination .next_off,.uio_grid .grid_pagination .pre,.uio_grid .grid_pagination .pre_end,.uio_grid .grid_pagination .pre_end_off,.uio_grid .grid_pagination .pre_off{width:25px;height:24px;padding:0;border:0;background:url(../images/icons.gif) no-repeat;font-size:0;line-height:999;overflow:hidden;white-space:nowrap}.uio_grid .grid_pagination .next_end,.uio_grid .grid_pagination .next_end_off,.uio_grid .grid_pagination .pre_end,.uio_grid .grid_pagination .pre_end_off{width:24px}.uio_grid .grid_pagination .pre,.uio_grid .grid_pagination .pre_off{margin-right:12px}.uio_grid .grid_pagination .next,.uio_grid .grid_pagination .next_off{margin-left:12px}.uio_grid .grid_pagination .pre_end{background-position:0 0}.uio_grid .grid_pagination .pre_end_off{background-position:0 -30px}.uio_grid .grid_pagination .pre{background-position:-24px 0}.uio_grid .grid_pagination .pre_off{background-position:-24px -30px}.uio_grid .grid_pagination .next{background-position:-50px 0}.uio_grid .grid_pagination .next_off{background-position:-50px -30px}.uio_grid .grid_pagination .next_end{background-position:-75px 0}.uio_grid .grid_pagination .next_end_off{background-position:-75px -30px} \ No newline at end of file diff --git a/samples/js/grid.js b/samples/js/grid.js index 568292725..e740ab8f3 100644 --- a/samples/js/grid.js +++ b/samples/js/grid.js @@ -1,7 +1,7 @@ /** * @fileoverview tui-grid * @author NHN Ent. FE Development Team - * @version 1.1.1 + * @version 1.1.2 * @license MIT * @link https://github.com/nhnent/tui.grid */ @@ -58,15 +58,11 @@ var renderStateMap = require('../common/constMap').renderState; /** * Net Addon * @module addon/net + * @mixes module:base/common */ var Net = View.extend(/**@lends module:addon/net.prototype */{ - tagName: 'form', - events: { - submit: '_onSubmit' - }, /** * @constructs - * @mixes module:base/common * @param {object} options * @param {jquery} options.el form 엘리먼트 * @param {boolean} [options.initialRequest=true] Net 인스턴스 생성과 동시에 readData request 요청을 할 지 여부. @@ -138,6 +134,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * net.request('modifyData'); * */ + initialize: function(options) { var defaultOptions, options, pagination; @@ -193,6 +190,12 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ } }, + tagName: 'form', + + events: { + submit: '_onSubmit' + }, + /** * pagination instance 를 초기화 한다. * @private @@ -340,7 +343,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ /** * form 으로 지정된 엘리먼트의 Data 를 반환한다. - * @return {object} formData 데이터 오브젝트 + * @returns {object} formData 데이터 오브젝트 * @private */ _getFormData: function() { @@ -573,8 +576,8 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * @param {boolean} [options.hasDataParam=true] request 데이터에 rowList 관련 데이터가 포함될 지 여부. * @param {boolean} [options.isOnlyModified=true] rowList 관련 데이터 중 수정된 데이터만 포함할 지 여부 * @param {boolean} [options.isOnlyChecked=true] rowList 관련 데이터 중 checked 된 데이터만 포함할 지 여부 - * @return {{count: number, data: {requestType: string, url: string, data: object, type: string, dataType: string}}} - * 옵션 조건에 해당하는 그리드 데이터 정보 + * @returns {{count: number, data: {requestType: string, url: string, data: object, + * type: string, dataType: string}}} 옵션 조건에 해당하는 그리드 데이터 정보 * @private */ _getDataParam: function(requestType, options) { @@ -631,7 +634,8 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * @param {boolean} [options.hasDataParam=true] request 데이터에 rowList 관련 데이터가 포함될 지 여부. * @param {boolean} [options.isOnlyModified=true] rowList 관련 데이터 중 수정된 데이터만 포함할 지 여부 * @param {boolean} [options.isOnlyChecked=true] rowList 관련 데이터 중 checked 된 데이터만 포함할 지 여부 - * @return {{requestType: string, url: string, data: object, type: string, dataType: string}} ajax 호출시 사용될 option 파라미터 + * @returns {{requestType: string, url: string, data: object, type: string, dataType: string}} + * ajax 호출시 사용될 option 파라미터 * @private */ _getRequestParam: function(requestType, options) { @@ -661,7 +665,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * requestType 에 따른 컨펌 메세지를 노출한다. * @param {String} requestType 요청 타입. 'createData|updateData|deleteData|modifyData' 중 하나를 인자로 넘긴다. * @param {Number} count 전송될 데이터 개수 - * @return {boolean} 계속 진행할지 여부를 반환한다. + * @returns {boolean} 계속 진행할지 여부를 반환한다. * @private */ _isConfirmed: function(requestType, count) { @@ -680,7 +684,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * confirm message 를 반환한다. * @param {String} requestType 요청 타입. 'createData|updateData|deleteData|modifyData' 중 하나를 인자로 넘긴다. * @param {Number} count 전송될 데이터 개수 - * @return {string} 생성된 confirm 메세지 + * @returns {string} 생성된 confirm 메세지 * @private */ _getConfirmMessage: function(requestType, count) { @@ -831,11 +835,13 @@ var common = require('./common'); /** * Base class for Collection * @module base/collection + * @mixes module:base/common */ var Collection = Backbone.Collection.extend(/**@lends module:base/collection.prototype */{ /** - * @mixes module:base/common * @constructs + * @param {Array.} models - Models + * @param {Object} options - Options */ initialize: function(models, options) {}, @@ -895,11 +901,11 @@ var common = require('./common'); /** * Base class for Models * @module base/model + * @mixes module:base/common */ var Model = Backbone.Model.extend(/**@lends module:base/model.prototype*/{ /** * @constructs - * @mixes module:base/common * @param {Object} attributes Attributes */ initialize: function(attributes) {} @@ -928,9 +934,10 @@ var common = require('./common'); var Painter = tui.util.defineClass(/**@lends module:base/painter.prototype */{ /** * @constructs + * @param {Object} attrs - Attributes */ - init: function(attributes) { - var grid = attributes && attributes.grid || this.collection && this.collection.grid || null; + init: function(attrs) { + var grid = attrs && attrs.grid || this.collection && this.collection.grid || null; this.setOwnProperties({ grid: grid }); @@ -989,11 +996,11 @@ var common = require('./common'); /** * Base class for Views * @module base/view + * @mixes module:base/common */ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ /** * @constructs - * @mixes module:base/common * @param {Object} attributes Attributes */ initialize: function(attributes) { @@ -1003,7 +1010,7 @@ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ /** * 에러 객체를 반환한다. * @param {String} message - Error message - * @return {error} 에러객체 + * @returns {error} 에러객체 */ error: function(message) { var GridError = function() { @@ -1015,28 +1022,24 @@ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ }, /** - * destroy 시 함께 삭제할 View 를 내부 변수 _children 에 추가한다. - * @param {instance} instance 인스턴스 객체 - * @return {instance} instance 인자로 전달받은 인스턴스 객체 + * Add children views + * @param {(Object|Array)} views - View instance of Array of view instances + * @private */ _addChildren: function(views) { if (!_.isArray(views)) { views = [views]; } - _.each(views, function(view) { - this._children.push(view); - }, this); + [].push.apply(this._children, views); }, /** * Render children and returns thier elements as array. - * @return {array.} An array of element of children + * @returns {array.} An array of element of children */ _renderChildren: function() { - var elements = []; - - _.each(this._children, function(view) { - elements.push(view.render().el); + var elements = _.map(this._children, function(view) { + return view.render().el; }); return elements; }, @@ -1053,7 +1056,7 @@ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ /** * customEvent 에서 사용할 이벤트 객체를 포멧에 맞게 생성하여 반환한다. * @param {Object} data 이벤트 핸들러에 넘길 데이터 - * @return {{_isStopped: boolean, stop: function, param1: param1, param2: param2}} 생성된 커스텀 이벤트 객체 + * @returns {{_isStopped: boolean, stop: function, param1: param1, param2: param2}} 생성된 커스텀 이벤트 객체 */ createEventData: function(data) { var eventData = $.extend({}, data); @@ -1071,7 +1074,7 @@ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ * 등록되어있는 자식 View 들을 제거한다. */ _destroyChildren: function() { - if (_.isArray(this._children)) { + if (this._children) { while (this._children.length > 0) { this._children.pop().destroy(); } @@ -1123,6 +1126,10 @@ module.exports = { LOADING: 'LOADING', DONE: 'DONE', EMPTY: 'EMPTY' + }, + dimension: { + CELL_BORDER_WIDTH: 1, + TABLE_BORDER_WIDTH: 1 } } @@ -1145,11 +1152,9 @@ var formUtil = { setInput: { /** * 배열의 값들을 전부 String 타입으로 변환한다. - * @memberof module:util - * @private - * @alias form.setInput['_changeToStringInArray'] + * @ignore * @param {Array} arr 변환할 배열 - * @return {Array} 변환된 배열 결과 값 + * @returns {Array} 변환된 배열 결과 값 */ '_changeToStringInArray': function(arr) { _.each(arr, function(value, i) { @@ -1160,8 +1165,7 @@ var formUtil = { /** * radio type 의 input 요소의 값을 설정한다. - * @memberof module:util - * @alias form.setInput['radio'] + * @ignore * @param {HTMLElement} targetElement - Target element * @param {String} formValue - Form value */ @@ -1171,8 +1175,8 @@ var formUtil = { /** * radio type 의 input 요소의 값을 설정한다. + * @ignore * @memberof module:util - * @alias form.setInput.checkbox * @param {HTMLElement} targetElement - Target element * @param {String} formValue - Form value */ @@ -1186,8 +1190,7 @@ var formUtil = { /** * select-one type 의 input 요소의 값을 설정한다. - * @memberof module:util - * @alias form.setInput['select-one'] + * @ignore * @param {HTMLElement} targetElement - Target element * @param {String} formValue - Form value */ @@ -1204,8 +1207,7 @@ var formUtil = { /** * select-multiple type 의 input 요소의 값을 설정한다. - * @memberof module:util - * @alias form.setinput['select-multiple'] + * @ignore * @param {HTMLElement} targetElement - Target element * @param {String} formValue - Form value */ @@ -1226,7 +1228,6 @@ var formUtil = { /** * input 요소의 값을 설정하는 default 로직 * @memberof module:util - * @alias form.setinput['defaultAction'] * @param {HTMLElement} targetElement - Target element * @param {String} formValue - Form value */ @@ -1240,7 +1241,7 @@ var formUtil = { * @memberof module:util * @alias form.getFormData * @param {jQuery} $form jQuery()로 감싼 폼엘리먼트 - * @return {object} form 내의 데이터들을 key:value 형태의 DataObject 로 반환한다. + * @returns {object} form 내의 데이터들을 key:value 형태의 DataObject 로 반환한다. **/ getFormData: function($form) { var result = {}, @@ -1267,7 +1268,7 @@ var formUtil = { * @alias form.getFormElement * @param {jQuery} $form jQuery()로 감싼 폼엘리먼트 * @param {String} [elementName] 특정 이름의 인풋 엘리먼트만 가져오고 싶은 경우 전달하며, 생략할 경우 모든 인풋 엘리먼트를 배열 형태로 리턴한다. - * @return {jQuery} jQuery 로 감싼 엘리먼트를 반환한다. + * @returns {jQuery} jQuery 로 감싼 엘리먼트를 반환한다. */ getFormElement: function($form, elementName) { var formElement; @@ -1355,7 +1356,6 @@ var formUtil = { module.exports = formUtil; - },{}],10:[function(require,module,exports){ /** * @fileoverview 유틸리티 메서드 모음 @@ -1373,7 +1373,7 @@ var util = { * HTML Attribute 설정 시 필요한 문자열을 가공한다. * @memberof module:util * @param {{key:value}} attributes 문자열로 가공할 attribute 데이터 - * @return {string} html 마크업에 포함될 문자열 + * @returns {string} html 마크업에 포함될 문자열 * @example var str = util.getAttributesString({ 'class': 'focused disabled', @@ -1396,7 +1396,7 @@ var util = { * 배열의 합을 반환한다. * @memberof module:util * @param {number[]} list 총 합을 구할 number 타입 배열 - * @return {number} 합산한 결과값 + * @returns {number} 합산한 결과값 */ sum: function(list) { return _.reduce(list, function(memo, value) { @@ -1407,8 +1407,8 @@ var util = { /** * Return min and max value in array - * @param {Array} arr - * @returns {{min: number, max: number}} + * @param {Array} arr - Target array + * @returns {{min: number, max: number}} Min and Max * @see {@link http://jsperf.com/getminmax} */ getMinMax: function(arr) { @@ -1423,7 +1423,7 @@ var util = { * @memberof module:util * @param {number} rowCount 행 개수 * @param {number} rowHeight 한 행당 높이 - * @return {number} 계산된 높이 + * @returns {number} 계산된 높이 */ getHeight: function(rowCount, rowHeight) { return rowCount === 0 ? rowCount : rowCount * (rowHeight + 1) + 1; @@ -1434,7 +1434,7 @@ var util = { * @memberof module:util * @param {number} height 테이블 body 높이 * @param {number} rowHeight 한 행당 높이 - * @return {number} 테이블 body 당 보여지는 행 개수 + * @returns {number} 테이블 body 당 보여지는 행 개수 */ getDisplayRowCount: function(height, rowHeight) { return Math.ceil((height - 1) / (rowHeight + 1)); @@ -1445,7 +1445,7 @@ var util = { * @memberof module:util * @param {number} rowCount 행 개수 * @param {number} height 테이블 body 높이 - * @return {number} 한 행당 높이값 + * @returns {number} 한 행당 높이값 */ getRowHeight: function(rowCount, height) { return rowCount === 0 ? 0 : Math.floor(((height - 1) / rowCount)) - 1; @@ -1457,7 +1457,7 @@ var util = { * @memberof module:util * @param {*} target 동등 비교할 target * @param {*} dist 동등 비교할 dist - * @return {boolean} 동일한지 여부 + * @returns {boolean} 동일한지 여부 */ isEqual: function(target, dist) { var isDiff, @@ -1488,7 +1488,7 @@ var util = { * Returns whether the string blank. * @memberof module:util * @param {*} target - target object - * @return {boolean} True if target is undefined or null or '' + * @returns {boolean} True if target is undefined or null or '' */ isBlank: function(target) { if (_.isString(target)) { @@ -1501,7 +1501,7 @@ var util = { * Grid 에서 필요한 형태로 HTML tag 를 제거한다. * @memberof module:util * @param {string} htmlString html 마크업 문자열 - * @return {String} HTML tag 에 해당하는 부분을 제거한 문자열 + * @returns {String} HTML tag 에 해당하는 부분을 제거한 문자열 */ stripTags: function(htmlString) { var matchResult; @@ -1513,7 +1513,9 @@ var util = { } else { htmlString = htmlString.replace(//gi, ''); } - htmlString = $.trim(tui.util.decodeHTMLEntity(htmlString.replace(/<\/?(?:h[1-5]|[a-z]+(?:\:[a-z]+)?)[^>]*>/ig, ''))); + htmlString = $.trim(tui.util.decodeHTMLEntity( + htmlString.replace(/<\/?(?:h[1-5]|[a-z]+(?:\:[a-z]+)?)[^>]*>/ig, '') + )); } return htmlString; }, @@ -1521,7 +1523,7 @@ var util = { /** * Create unique key * @memberof module:util - * @return {number} unique key 를 반환한다. + * @returns {number} unique key 를 반환한다. */ getUniqueKey: function() { this.uniqueId += 1; @@ -1532,7 +1534,7 @@ var util = { * object 를 query string 으로 변경한다. * @memberof module:util * @param {object} dataObj 쿼리 문자열으로 반환할 객체 - * @return {string} 변환된 쿼리 문자열 + * @returns {string} 변환된 쿼리 문자열 */ toQueryString: function(dataObj) { var queryList = []; @@ -1554,7 +1556,7 @@ var util = { * queryString 을 object 형태로 변형한다. * @memberof module:util * @param {String} queryString 쿼리 문자열 - * @return {Object} 변환한 Object + * @returns {Object} 변환한 Object */ toQueryObject: function(queryString) { var queryList = queryString.split('&'), @@ -1585,7 +1587,7 @@ var util = { * @memberof module:util * @param {*} value 컨버팅할 value * @param {String} type 컨버팅 될 타입 - * @return {*} 타입 컨버팅된 value + * @returns {*} 타입 컨버팅된 value */ convertValueType: function(value, type) { if (type === 'string') { @@ -1599,7 +1601,7 @@ var util = { /** * Capitalize first character of the target string. * @param {string} string Target string - * @return {string} Converted new string + * @returns {string} Converted new string */ toUpperCaseFirstLetter: function(string) { return string.charAt(0).toUpperCase() + string.slice(1); @@ -1627,7 +1629,7 @@ var util = { /** * Returns whether the browser is IE7 - * @return {boolean} True if the browser is IE7 + * @returns {boolean} True if the browser is IE7 */ isBrowserIE7: function() { var browser = tui.util.browser; @@ -1661,7 +1663,7 @@ var DomState = tui.util.defineClass(/**@lends module:domState.prototype */{ * Returns the element of the table-cell identified by rowKey and columnName * @param {(Number|String)} rowKey - Row key * @param {String} columnName - Column name - * @return {jQuery} Cell(TD) element + * @returns {jQuery} Cell(TD) element */ getElement: function(rowKey, columnName) { return this.$el.find('tr[key="' + rowKey + '"]').find('td[columnname="' + columnName + '"]'); @@ -1669,7 +1671,7 @@ var DomState = tui.util.defineClass(/**@lends module:domState.prototype */{ /** * Returns the offset of the container element - * @return {{top: Number, left: Number} Offset object + * @returns {{top: Number, left: Number}} Offset object */ getOffset: function() { return this.$el.offset(); @@ -1683,6 +1685,14 @@ var DomState = tui.util.defineClass(/**@lends module:domState.prototype */{ return this.$el.width(); }, + /** + * Returns the height of the parent of container element. + * @returns {Number} Height of the parent of container element + */ + getParentHeight: function() { + return this.$el.parent().height(); + }, + /** * Returns whether there's child element having focus. * @returns {boolean} True if there's child element having focus @@ -1705,53 +1715,98 @@ module.exports = DomState; * Grid public API * * @param {Object} options - * @param {number} [options.columnFixCount=0] - Column index for fixed column. The columns indexed from 0 to this value will always be shown on the left side. {@link tui.Grid#setColumnFixCount|setColumnFixCount} can be used for setting this value dynamically. - * @param {string} [options.selectType=''] - Type of buttons shown next to the _number(rowKey) column. The string value 'checkbox' or 'radiobox' can be used. If not specified, the button column will not be shown. - * @param {boolean} [options.autoNumbering=true] - Specifies whether to assign a auto increasing number to each rows when rendering time. - * @param {number} [options.headerHeight=35] - The height of header area. When rows in header are multiple (merged column), this value must be the total height of rows. + * @param {number} [options.columnFixCount=0] - Column index for fixed column. The columns indexed from 0 to this + * value will always be shown on the left side. {@link tui.Grid#setColumnFixCount|setColumnFixCount} + * can be used for setting this value dynamically. + * @param {string} [options.selectType=''] - Type of buttons shown next to the _number(rowKey) column. + * The string value 'checkbox' or 'radiobox' can be used. + * If not specified, the button column will not be shown. + * @param {boolean} [options.autoNumbering=true] - Specifies whether to assign a auto increasing number + * to each rows when rendering time. + * @param {number} [options.headerHeight=35] - The height of header area. + * When rows in header are multiple (merged column), this value must be the total height of rows. * @param {number} [options.rowHeight=27] - The height of each rows. - * @param {number} [options.displayRowCount=10] - The number of rows to be shown in the table area. Total height of grid will be set based on this value. + * @param {number} [options.displayRowCount=10] - The number of rows to be shown in the table area. + * Total height of grid will be set based on this value. * @param {number} [options.minimumColumnWidth=50] - Minimum width of each columns. - * @param {boolean} [options.useClientSort=true] - If set to true, sorting will be executed by client itself without server. - * @param {boolean} [options.singleClickEdit=false] - If set to true, text-convertible cell will be changed to edit-mode with a single click. + * @param {boolean} [options.useClientSort=true] - If set to true, sorting will be executed by client itself + * without server. + * @param {boolean} [options.singleClickEdit=false] - If set to true, text-convertible cell will be changed to + * edit-mode with a single click. * @param {boolean} [options.scrollX=true] - Specifies whether to show horizontal scrollbar. * @param {boolean} [options.scrollY=true] - Specifies whether to show vertical scrollbar. - * @param {string} [options.keyColumnName=null] - The name of the column to be used to identify each rows. If not specified, unique value for each rows will be created internally. + * @param {boolean} [options.fitToParentHeight=false] - If set to true, the height of the grid will expand to + * fit the height of parent element. + * @param {boolean} [options.showDummyRows=false] - If set to true, empty area will be filled with dummy rows. + * @param {string} [options.keyColumnName=null] - The name of the column to be used to identify each rows. + * If not specified, unique value for each rows will be created internally. * @param {Object} [options.toolbar] - The object for configuring toolbar UI. * @param {boolean} [options.toolbar.hasResizeHandler=true] - Specifies whether to use the resize hendler. * @param {boolean} [options.toolbar.hasControlPanel=true] - Specifies whether to use the control panel. * @param {boolean} [options.toolbar.hasPagination=true] - Specifies whether to use the pagination. * @param {array} options.columnModelList - The configuration of the grid columns. * @param {string} options.columnModelList.columnName - The name of the column. - * @param {boolean} [options.columnModelList.isEllipsis=false] - If set to true, ellipsis will be used for overflowing content. - * @param {string} [options.columnModelList.align=left] - Horizontal alignment of the column content. Available values are 'left', 'center', 'right'. - * @param {string} [options.columnModelList.className] - The name of the class to be used for all cells of the column. + * @param {boolean} [options.columnModelList.isEllipsis=false] - If set to true, ellipsis will be used + * for overflowing content. + * @param {string} [options.columnModelList.align=left] - Horizontal alignment of the column content. + * Available values are 'left', 'center', 'right'. + * @param {string} [options.columnModelList.className] - The name of the class to be used for all cells of + * the column. * @param {string} [options.columnModelList.title] - The title of the column to be shown on the header. * @param {number} [options.columnModelList.width] - The width of the column. The unit is pixel. * @param {boolean} [options.columnModelList.isHidden] - If set to true, the column will not be shown. - * @param {boolean} [options.columnModelList.isFixedWidth=false] - If set to true, the width of the column will not be changed. - * @param {string} [options.columnModelList.defaultValue] - The default value to be shown when the column doesn't have a value. - * @param {function} [options.columnModelList.formatter] - The function that formats the value of the cell. The retrurn value of the function will be shown as the value of the cell. - * @param {boolean} [options.columnModelList.notUseHtmlEntity=false] - If set to true, the value of the cell will not be encoded as HTML entities. - * @param {boolean} [options.columnModelList.isIgnore=false] - If set to true, the value of the column will be ignored when setting up the list of modified rows. - * @param {boolean} [options.columnModelList.isSortable=false] - If set to true, sort button will be shown on the right side of the column header, which executes the sort action when clicked. + * @param {boolean} [options.columnModelList.isFixedWidth=false] - If set to true, the width of the column + * will not be changed. + * @param {boolean} [options.columnModelList.isRequired=false] - If set to true, the data of the column + * will be checked to be not empty whenever data is changed or calling {@link tui.Grid#validate}. + * @param {string} [options.columnModelList.defaultValue] - The default value to be shown when the column + * doesn't have a value. + * @param {function} [options.columnModelList.formatter] - The function that formats the value of the cell. + * The retrurn value of the function will be shown as the value of the cell. + * @param {boolean} [options.columnModelList.notUseHtmlEntity=false] - If set to true, the value of the cell + * will not be encoded as HTML entities. + * @param {boolean} [options.columnModelList.isIgnore=false] - If set to true, the value of the column will be + * ignored when setting up the list of modified rows. + * @param {boolean} [options.columnModelList.isSortable=false] - If set to true, sort button will be shown on + * the right side of the column header, which executes the sort action when clicked. * @param {Array} [options.columnModelList.editOption] - The object for configuring editing UI. - * @param {string} [options.columnModelList.editOption.type='normal'] - The string value that specifies the type of the editing UI. Available values are 'text', 'text-password', 'text-convertible', 'select', 'radio', 'checkbox'. - * @param {Array} [options.columnModelList.editOption.list] - Specifies the option list for the 'select', 'radio', 'checkbox' type. The item of the array must contain properties named 'text' and 'value'. (e.g. [{text: 'option1', value: 1}, {...}]) - * @param {function} [options.columnModelList.editOption.changeBeforeCallback] - The function that will be called before changing the value of the cell. If returns false, the changing will be canceled. - * @param {function} [options.columnModelList.editOption.changeAfterCallback] - The function that will be called after changing the value of the cell. - * @param {string} [options.columnModelList.editOption.beforeText] Deprecated. (replaced with {@link beforeContent}) - * @param {(string|function)} [options.columnModelList.editOption.beforeContent] - The HTML string to be shown left to the value. If it's a function, the return value will be used. - * @param {string} [options.columnModelList.editOption.afterText] Deprecated. (replaced with {@link afterContent}) - * @param {(string|function)} [options.columnModelList.editOption.afterContent] - The HTML string to be shown right to the value. If it's a function, the return value will be used. - * @param {function} [options.columnModelList.editOption.converter] - The function whose return value (HTML) represents the UI of the cell. If the return value is falsy(null|undefined|false), default UI will be shown. This option is available for the 'text', 'text-password', 'select', 'checkbox', 'radio' type. - * @param {Object} [options.columnModelList.editOption.inputEvents] - The object that has an event name as a key and event handler as a value for events on input element. + * @param {string} [options.columnModelList.editOption.type='normal'] - The string value that specifies + * the type of the editing UI. + * Available values are 'text', 'text-password', 'text-convertible', 'select', 'radio', 'checkbox'. + * @param {Array} [options.columnModelList.editOption.list] - Specifies the option list for the + * 'select', 'radio', 'checkbox' type. The item of the array must contain properties named + * 'text' and 'value'. (e.g. [{text: 'option1', value: 1}, {...}]) + * @param {function} [options.columnModelList.editOption.changeBeforeCallback] - The function that will be + * called before changing the value of the cell. If returns false, the changing will be canceled. + * @param {function} [options.columnModelList.editOption.changeAfterCallback] - The function that will be + * called after changing the value of the cell. + * @param {string} [options.columnModelList.editOption.beforeText] Deprecated. + * (replaced with {@link beforeContent}) + * @param {(string|function)} [options.columnModelList.editOption.beforeContent] - The HTML string to be + * shown left to the value. If it's a function, the return value will be used. + * @param {string} [options.columnModelList.editOption.afterText] Deprecated. + * (replaced with {@link afterContent}) + * @param {(string|function)} [options.columnModelList.editOption.afterContent] - The HTML string to be + * shown right to the value. If it's a function, the return value will be used. + * @param {function} [options.columnModelList.editOption.converter] - The function whose + * return value (HTML) represents the UI of the cell. If the return value is + * falsy(null|undefined|false), default UI will be shown. + * This option is available for the 'text', 'text-password', 'select', 'checkbox', 'radio' type. + * @param {Object} [options.columnModelList.editOption.inputEvents] - The object that has an event name + * as a key and event handler as a value for events on input element. * @param {Array} [options.columnModelList.relationList] - Specifies relation between this and other column. * @param {array} [options.columnModelList.relationList.columnList] - Array of the names of target columns. - * @param {function} [options.columnModelList.relationList.isDisabled] - If returns true, target columns will be disabled. - * @param {function} [options.columnModelList.relationList.isEditable] - If returns true, target columns will be editable. - * @param {function} [options.columnModelList.relationList.optionListChange] - The function whose return value specifies the option list for the 'select', 'radio', 'checkbox' type. The options list of target columns will be replaced with the return value of this function. - * @param {array} options.columnMerge - The array that specifies the merged column. This options does not merge the cells of multiple columns into a single cell. This options only effects to the headers of the multiple columns, creates a new parent header that includes the headers of spcified columns, and sets up the hierarchy. + * @param {function} [options.columnModelList.relationList.isDisabled] - If returns true, target columns + * will be disabled. + * @param {function} [options.columnModelList.relationList.isEditable] - If returns true, target columns + * will be editable. + * @param {function} [options.columnModelList.relationList.optionListChange] - The function whose return + * value specifies the option list for the 'select', 'radio', 'checkbox' type. + * The options list of target columns will be replaced with the return value of this function. + * @param {array} options.columnMerge - The array that specifies the merged column. + * This options does not merge the cells of multiple columns into a single cell. + * This options only effects to the headers of the multiple columns, creates a new parent header + * that includes the headers of spcified columns, and sets up the hierarchy. * @constructor tui.Grid * @example
@@ -1764,6 +1819,8 @@ module.exports = DomState; headerHeight: 100, //(default=35) rowHeight: 27, // (default=27) displayRowCount: 10, //(default=10) + fitToParentHeight: true // (default=false) + showDummyRows: false // (default=false) minimumColumnWidth: 50, //(default=50) scrollX: true, //(default:true) scrollY: true, //(default:true) @@ -1841,6 +1898,7 @@ module.exports = DomState; title: 'password input column', columnName: 'column5', width: 100, + isRequired: true, isFixedWidth: true, editOption: { type: 'text-password', @@ -1988,7 +2046,8 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ /** * Creates core model and returns it. * @param {Object} options - Options set by user - * @return {module:model/manager} - New model manager object + * @returns {module:model/manager} - New model manager object + * @private */ _createModelManager: function(options) { var domState = new DomState(this.$el), @@ -2003,7 +2062,8 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ /** * Creates painter manager and returns it - * @return {module:painter/manager} - New painter manager object + * @returns {module:painter/manager} - New painter manager object + * @private */ _createPainterManager: function() { return new PainterManager({ @@ -2014,7 +2074,8 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ /** * Creates container view and returns it * @param {Object} options - Options set by user - * @return {module:view/container} - New container view object + * @returns {module:view/container} - New container view object + * @private */ _createContainerView: function(options) { var viewFactory = new ViewFactory({ @@ -2030,7 +2091,8 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ /** * Creates public event emitter and returns it. - * @return {module:publicEventEmitter} - New public event emitter + * @returns {module:publicEventEmitter} - New public event emitter + * @private */ _createPublicEventEmitter: function() { var emitter = new PublicEventEmitter(this); @@ -2041,6 +2103,22 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ return emitter; }, + /** + * Disables all rows. + * @api + */ + disable: function() { + this.modelManager.dataModel.setDisabled(true); + }, + + /** + * Enables all rows. + * @api + */ + enable: function() { + this.modelManager.dataModel.setDisabled(false); + }, + /** * Disables the row identified by the rowkey. * @api @@ -2049,6 +2127,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ disableRow: function(rowKey) { this.modelManager.dataModel.disableRow(rowKey); }, + /** * Enables the row identified by the rowKey. * @api @@ -2057,23 +2136,25 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ enableRow: function(rowKey) { this.modelManager.dataModel.enableRow(rowKey); }, + /** * Returns the value of the cell identified by the rowKey and columnName. * @api * @param {(number|string)} rowKey - The unique key of the target row. * @param {string} columnName - The name of the column * @param {boolean} [isOriginal] - It set to true, the original value will be return. - * @return {(number|string)} - The value of the cell + * @returns {(number|string)} - The value of the cell */ getValue: function(rowKey, columnName, isOriginal) { return this.modelManager.dataModel.getValue(rowKey, columnName, isOriginal); }, + /** * Returns a list of all values in the specified column. * @api * @param {string} columnName - The name of the column * @param {boolean} [isJsonString=false] - It set to true, return value will be converted to JSON string. - * @return {(Array|string)} - A List of all values in the specified column. (or JSON string of the list) + * @returns {(Array|string)} - A List of all values in the specified column. (or JSON string of the list) */ getColumnValues: function(columnName, isJsonString) { return this.modelManager.dataModel.getColumnValues(columnName, isJsonString); @@ -2084,7 +2165,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ * @api * @param {(number|string)} rowKey - The unique key of the target row * @param {boolean} [isJsonString=false] - If set to true, return value will be converted to JSON string. - * @return {(Object|string)} - The object that contains all values in the row. (or JSON string of the object) + * @returns {(Object|string)} - The object that contains all values in the row. (or JSON string of the object) */ getRow: function(rowKey, isJsonString) { return this.modelManager.dataModel.getRowData(rowKey, isJsonString); @@ -2095,38 +2176,41 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ * @api * @param {number} index - The index of the row * @param {Boolean} [isJsonString=false] - If set to true, return value will be converted to JSON string. - * @return {Object|string} - The object that contains all values in the row. (or JSON string of the object) + * @returns {Object|string} - The object that contains all values in the row. (or JSON string of the object) */ getRowAt: function(index, isJsonString) { - return this.modelManager.dataModel.getRowData(index, isJsonString); + return this.modelManager.dataModel.getRowDataAt(index, isJsonString); }, /** * Returns the total number of the rows. * @api - * @return {number} - The total number of the rows + * @returns {number} - The total number of the rows */ getRowCount: function() { return this.modelManager.dataModel.length; }, + /** * Returns the rowKey of the currently selected row. * @api - * @return {(number|string)} - The rowKey of the row + * @returns {(number|string)} - The rowKey of the row */ getSelectedRowKey: function() { return this.modelManager.focusModel.which().rowKey; }, + /** * Returns the jquery object of the cell identified by the rowKey and columnName. * @api * @param {(number|string)} rowKey - The unique key of the row * @param {string} columnName - The name of the column - * @return {jQuery} - The jquery object of the cell element + * @returns {jQuery} - The jquery object of the cell element */ getElement: function(rowKey, columnName) { return this.modelManager.dataModel.getElement(rowKey, columnName); }, + /** * Sets the value of the cell identified by the specified rowKey and columnName. * @api @@ -2137,6 +2221,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ setValue: function(rowKey, columnName, columnValue) { this.modelManager.dataModel.setValue(rowKey, columnName, columnValue); }, + /** * Sets the all values in the specified column. * @api @@ -2147,6 +2232,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ setColumnValues: function(columnName, columnValue, isCheckCellState) { this.modelManager.dataModel.setColumnValues(columnName, columnValue, isCheckCellState); }, + /** * Replace all rows with the specified list. This will not change the original data. * @api @@ -2155,6 +2241,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ replaceRowList: function(rowList) { this.modelManager.dataModel.replaceRowList(rowList); }, + /** * Replace all rows with the specified list. This will change the original data. * @api @@ -2164,6 +2251,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ setRowList: function(rowList, callback) { this.modelManager.dataModel.setRowList(rowList, true, callback); }, + /** * Sets focus on the cell identified by the specified rowKey and columnName. * @api @@ -2175,6 +2263,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ this.modelManager.focusModel.focusClipboard(); this.modelManager.focusModel.focus(rowKey, columnName, isScrollable); }, + /** * Sets focus on the cell at the specified index of row and column. * @api @@ -2185,6 +2274,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ focusAt: function(rowIndex, columnIndex, isScrollable) { this.modelManager.focusModel.focusAt(rowIndex, columnIndex, isScrollable); }, + /** * Sets focus on the cell at the specified index of row and column and starts to edit. * @api @@ -2195,6 +2285,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ focusIn: function(rowKey, columnName, isScrollable) { this.modelManager.focusModel.focusIn(rowKey, columnName, isScrollable); }, + /** * Sets focus on the cell at the specified index of row and column and starts to edit. * @api @@ -2204,6 +2295,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ focusInAt: function(rowIndex, columnIndex, isScrollable) { this.modelManager.focusModel.focusInAt(rowIndex, columnIndex, isScrollable); }, + /** * Makes view ready to get keyboard input. * @api @@ -2211,6 +2303,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ readyForKeyControl: function() { this.modelManager.focusModel.focusClipboard(); }, + /** * Removes focus from the focused cell. * @api @@ -2218,6 +2311,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ blur: function() { this.modelManager.focusModel.blur(); }, + /** * Checks all rows. * @api @@ -2225,6 +2319,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ checkAll: function() { this.modelManager.dataModel.checkAll(); }, + /** * Checks the row identified by the specified rowKey. * @api @@ -2233,6 +2328,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ check: function(rowKey) { this.modelManager.dataModel.check(rowKey); }, + /** * Unchecks all rows. * @api @@ -2240,6 +2336,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ uncheckAll: function() { this.modelManager.dataModel.uncheckAll(); }, + /** * Unchecks the row identified by the specified rowKey. * @api @@ -2248,6 +2345,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ uncheck: function(rowKey) { this.modelManager.dataModel.uncheck(rowKey); }, + /** * Removes all rows. * @api @@ -2255,13 +2353,16 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ clear: function() { this.modelManager.dataModel.setRowList([]); }, + /** * Removes the row identified by the specified rowKey. * @api * @param {(number|string)} rowKey - The unique key of the row - * @param {(boolean|object)} [options] - Options. If the type is boolean, this value is equivalent to options.removeOriginalData. + * @param {(boolean|object)} [options] - Options. If the type is boolean, this value is equivalent to + * options.removeOriginalData. * @param {boolean} [options.removeOriginalData] - If set to true, the original data will be removed. - * @param {boolean} [options.keepRowSpanData] - If set to true, the value of the merged cells will not be removed although the target is first cell of them. + * @param {boolean} [options.keepRowSpanData] - If set to true, the value of the merged cells will not be + * removed although the target is first cell of them. */ removeRow: function(rowKey, options) { if (tui.util.isBoolean(options) && options) { @@ -2271,14 +2372,15 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ } this.modelManager.dataModel.removeRow(rowKey, options); }, + /** * Removes all checked rows. * @api * @param {boolean} isConfirm - If set to true, confirm message will be shown before remove. - * @return {boolean} - True if there's at least one row removed. + * @returns {boolean} - True if there's at least one row removed. */ removeCheckedRows: function(isConfirm) { - var rowKeyList = this.modelManager.getCheckedRowKeyList(), + var rowKeyList = this.getCheckedRowKeyList(), message = rowKeyList.length + '건의 데이터를 삭제하시겠습니까?'; if (rowKeyList.length > 0 && (!isConfirm || confirm(message))) { @@ -2289,6 +2391,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ } return false; }, + /** * Enables the row identified by the rowKey to be able to check. * @api @@ -2297,6 +2400,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ enableCheck: function(rowKey) { this.modelManager.dataModel.enableCheck(rowKey); }, + /** * Disables the row identified by the spcified rowKey to not be abled to check. * @api @@ -2305,11 +2409,12 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ disableCheck: function(rowKey) { this.modelManager.dataModel.disableCheck(rowKey); }, + /** * Returns a list of the rowKey of checked rows. * @api * @param {Boolean} [isJsonString=false] - If set to true, return value will be converted to JSON string. - * @return {Array|string} - A list of the rowKey. (or JSON string of the list) + * @returns {Array|string} - A list of the rowKey. (or JSON string of the list) */ getCheckedRowKeyList: function(isJsonString) { var checkedRowList = this.modelManager.dataModel.getRowList(true), @@ -2317,11 +2422,12 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ return isJsonString ? $.toJSON(checkedRowKeyList) : checkedRowKeyList; }, + /** * Returns a list of the checked rows. * @api * @param {Boolean} [isJsonString=false] - If set to true, return value will be converted to JSON string. - * @return {Array|string} - A list of the checked rows. (or JSON string of the list) + * @returns {Array|string} - A list of the checked rows. (or JSON string of the list) */ getCheckedRowList: function(isJsonString) { var checkedRowList = this.modelManager.dataModel.getRowList(true); @@ -2332,61 +2438,73 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ /** * Returns a list of the column model. * @api - * @return {Array} - A list of the column model. + * @returns {Array} - A list of the column model. */ getColumnModelList: function() { return this.modelManager.columnModel.get('dataColumnModelList'); }, + /** * Returns the object that contains the lists of changed data compared to the original data. * The object has properties 'createList', 'updateList', 'deleteList'. * @api * @param {Object} [options] Options * @param {boolean} [options.isOnlyChecked=false] - If set to true, only checked rows will be considered. - * @param {boolean} [options.isRaw=false] - If set to true, the data will contains the row data for internal use. - * @param {boolean} [options.isOnlyRowKeyList=false] - If set to true, only keys of the changed rows will be returned. + * @param {boolean} [options.isRaw=false] - If set to true, the data will contains + * the row data for internal use. + * @param {boolean} [options.isOnlyRowKeyList=false] - If set to true, only keys of the changed + * rows will be returned. * @param {Array} [options.filteringColumnList] - A list of column name to be excluded. - * @return {{createList: Array, updateList: Array, deleteList: Array}} - Object that contains the result list. + * @returns {{createList: Array, updateList: Array, deleteList: Array}} - Object that contains the result list. */ getModifiedRowList: function(options) { return this.modelManager.dataModel.getModifiedRowList(options); }, + /** * Insert the new row with specified data to the end of table. * @api * @param {object} [row] - The data for the new row * @param {object} [options] - Options * @param {number} [options.at] - The index at which new row will be inserted - * @param {boolean} [options.extendPrevRowSpan] - If set to true and the previous row at target index has a rowspan data, the new row will extend the existing rowspan data. + * @param {boolean} [options.extendPrevRowSpan] - If set to true and the previous row at target index + * has a rowspan data, the new row will extend the existing rowspan data. + * @param {boolean} [options.focus] - If set to true, move focus to the new row after appending */ appendRow: function(row, options) { this.modelManager.dataModel.append(row, options); }, + /** * Insert the new row with specified data to the beginning of table. * @api * @param {object} [row] - The data for the new row + * @param {object} [options] - Options + * @param {boolean} [options.focus] - If set to true, move focus to the new row after appending */ - prependRow: function(row) { - this.modelManager.dataModel.prepend(row); + prependRow: function(row, options) { + this.modelManager.dataModel.prepend(row, options); }, + /** * Returns true if there are at least one row changed. * @api - * @return {boolean} - True if there are at least one row changed. + * @returns {boolean} - True if there are at least one row changed. */ isChanged: function() { return this.modelManager.dataModel.isChanged(); }, + /** * Returns the instance of specified AddOn. * @api * @param {string} name - The name of the AddOn - * @return {instance} addOn - The instance of the AddOn + * @returns {instance} addOn - The instance of the AddOn */ getAddOn: function(name) { return name ? this.addOn[name] : this.addOn; }, + /** * Restores the data to the original data. * (Original data is set by {@link tui.Grid#setRowList|setRowList} @@ -2395,6 +2513,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ restore: function() { this.modelManager.dataModel.restore(); }, + /** * Selects the row identified by the rowKey. * @api @@ -2403,6 +2522,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ select: function(rowKey) { this.modelManager.focusModel.select(rowKey); }, + /** * Unselects selected rows. * @api @@ -2410,6 +2530,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ unselect: function() { this.modelManager.focusModel.unselect(true); }, + /** * Sets the count of fixed column. * @api @@ -2418,6 +2539,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ setColumnFixCount: function(count) { this.modelManager.columnModel.set('columnFixCount', count); }, + /** * Sets the list of column model. * @api @@ -2426,12 +2548,13 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ setColumnModelList: function(columnModelList) { this.modelManager.columnModel.set('columnModelList', columnModelList); }, + /** * Create an specified AddOn and use it on this instance. * @api * @param {string} name - The name of the AddOn to use. * @param {object} options - The option objects for configuring the AddON. - * @return {tui.Grid} - This instance. + * @returns {tui.Grid} - This instance. */ use: function(name, options) { if (name === 'Net') { @@ -2445,14 +2568,16 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ } return this; }, + /** * Returns a list of all rows. * @api - * @return {Array} - A list of all rows + * @returns {Array} - A list of all rows */ getRowList: function() { return this.modelManager.dataModel.getRowList(); }, + /** * Sorts all rows by the specified column. * @api @@ -2461,6 +2586,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ sort: function(columnName) { this.modelManager.dataModel.sortByField(columnName); }, + /** * Unsorts all rows. (Sorts by rowKey). * @api @@ -2468,6 +2594,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ unSort: function() { this.sort('rowKey'); }, + /** * Adds the specified css class to cell element identified by the rowKey and className * @api @@ -2478,6 +2605,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ addCellClassName: function(rowKey, columnName, className) { this.modelManager.dataModel.get(rowKey).addCellClassName(columnName, className); }, + /** * Adds the specified css class to all cell elements in the row identified by the rowKey * @api @@ -2487,6 +2615,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ addRowClassName: function(rowKey, className) { this.modelManager.dataModel.get(rowKey).addClassName(className); }, + /** * Removes the specified css class from the cell element indentified by the rowKey and columnName. * @api @@ -2497,6 +2626,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ removeCellClassName: function(rowKey, columnName, className) { this.modelManager.dataModel.get(rowKey).removeCellClassName(columnName, className); }, + /** * Removes the specified css class from all cell elements in the row identified by the rowKey. * @api @@ -2506,24 +2636,28 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ removeRowClassName: function(rowKey, className) { this.modelManager.dataModel.get(rowKey).removeClassName(className); }, + /** * Returns the rowspan data of the cell identified by the rowKey and columnName. * @api * @param {(number|string)} rowKey - The unique key of the row * @param {string} columnName - The name of the column + * @returns {Object} - Row span data */ getRowSpanData: function(rowKey, columnName) { return this.modelManager.dataModel.getRowSpanData(rowKey, columnName); }, + /** * Returns the index of the row indentified by the rowKey. * @api * @param {number|string} rowKey - The unique key of the row - * @return {number} - The index of the row + * @returns {number} - The index of the row */ getIndexOfRow: function(rowKey) { return this.modelManager.dataModel.indexOfRowKey(rowKey); }, + /** * Sets the number of rows to be shown in the table area. * @api @@ -2532,6 +2666,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ setDisplayRowCount: function(count) { this.modelManager.dimensionModel.set('displayRowCount', count); }, + /** * Sets the width and height of the dimension. * @api @@ -2541,6 +2676,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ setSize: function(width, height) { this.modelManager.dimensionModel.setSize(width, height); }, + /** * Refresh the layout view. Use this method when the view was rendered while hidden. * @api @@ -2548,6 +2684,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ refreshLayout: function() { this.modelManager.dimensionModel.refreshLayout(); }, + /** * Show columns * @api @@ -2557,6 +2694,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ var args = tui.util.toArray(arguments); this.modelManager.columnModel.setHidden(args, false); }, + /** * Hide columns * @api @@ -2566,6 +2704,43 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ var args = tui.util.toArray(arguments); this.modelManager.columnModel.setHidden(args, true); }, + + /** + * Validates all data and returns the result. + * Return value is an array which contains only rows which have invalid cell data. + * @returns {Array.} An array of error object + * @api + * @example + // return value example + [ + { + rowKey: 1, + errors: [ + { + columnName: 'c1', + errorCode: 'REQUIRED' + }, + { + columnName: 'c2', + errorCode: 'REQUIRED' + } + ] + }, + { + rowKey: 3, + errors: [ + { + columnName: 'c2', + errorCode: 'REQUIRED' + } + ] + } + ] + */ + validate: function() { + return this.modelManager.dataModel.validate(); + }, + /** * Destroys the instance. * @api @@ -2582,13 +2757,13 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ * @api * @static * @param {number} id - ID of the target grid - * @return {tui.Grid} - Grid instance + * @returns {tui.Grid} - Grid instance */ tui.Grid.getInstanceById = function(id) { return instanceMap[id]; }; -},{"./addon/net":2,"./base/view":7,"./common/util":10,"./domState":11,"./model/manager":19,"./painter/manager":36,"./publicEventEmitter":38,"./view/factory":41}],13:[function(require,module,exports){ +},{"./addon/net":2,"./base/view":7,"./common/util":10,"./domState":11,"./model/manager":19,"./painter/manager":37,"./publicEventEmitter":39,"./view/factory":42}],13:[function(require,module,exports){ /** * @fileoverview 컬럼 모델 * @author NHN Ent. FE Development Team @@ -2609,11 +2784,11 @@ var META_COLUMN_LIST = ['_button', '_number']; /** * 컬럼 모델 데이터를 다루는 객체 * @module model/data/columnModel + * @extends module:base/model */ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype */{ /** * @constructs - * @extends module:base/model */ initialize: function() { Model.prototype.initialize.apply(this, arguments); @@ -2643,7 +2818,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 메타컬럼모델들을 초기화한다. * @param {Array} source - 사용자가 입력한 메타컬럼의 셋팅값 - * @return {Array} dset - 초기화가 완료된 메타컬럼 모델 리스트 + * @returns {Array} dset - 초기화가 완료된 메타컬럼 모델 리스트 * @private */ _initializeMetaColumns: function(source) { @@ -2669,7 +2844,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 인자로 넘어온 metaColumnModelList 에 설정값에 맞게 number column 을 추가한다. - * @param {Array} metaColumnModelList + * @param {Array} metaColumnModelList - Meta column model list * @private */ _initializeNumberColumn: function(metaColumnModelList) { @@ -2690,7 +2865,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 인자로 넘어온 metaColumnModelList 에 설정값에 맞게 button column 을 추가한다. - * @param {Array} metaColumnModelList + * @param {Array} metaColumnModelList - Meta column model listt * @private */ _initializeButtonColumn: function(metaColumnModelList) { @@ -2741,7 +2916,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype * index 에 해당하는 columnModel 을 반환한다. * @param {Number} index 조회할 컬럼모델의 인덱스 값 * @param {Boolean} isVisible [isVisible=false] 화면에 노출되는 컬럼모델 기준으로 찾을것인지 여부. - * @return {object} 조회한 컬럼 모델 + * @returns {object} 조회한 컬럼 모델 */ at: function(index, isVisible) { var columnModelList = isVisible ? this.getVisibleColumnModelList() : this.get('dataColumnModelList'); @@ -2752,7 +2927,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype * columnName 에 해당하는 index를 반환한다. * @param {string} columnName 컬럼명 * @param {Boolean} isVisible [isVisible=false] 화면에 노출되는 컬럼모델 기준으로 반환할 것인지 여부. - * @return {number} index 컬럼명에 해당하는 인덱스 값 + * @returns {number} index 컬럼명에 해당하는 인덱스 값 */ indexOfColumnName: function(columnName, isVisible) { var columnModelList; @@ -2768,7 +2943,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * columnName 이 열고정 영역에 있는 column 인지 반환한다. * @param {String} columnName 컬럼명 - * @return {Boolean} 열고정 영역에 존재하는 컬럼인지 여부 + * @returns {Boolean} 열고정 영역에 존재하는 컬럼인지 여부 */ isLside: function(columnName) { var index = this.indexOfColumnName(columnName, true); @@ -2780,7 +2955,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype * 화면에 노출되는 (!isHidden) 컬럼 모델 리스트를 반환한다. * @param {String} [whichSide] 열고정 영역인지, 열고정이 아닌 영역인지 여부. 지정하지 않았을 경우 전체 visibleList를 반환한다. * @param {boolean} [withMeta=false] 메타컬럼 포함 여부. 지정하지 않으면 데이터컬럼리스트 기준으로 반환한다. - * @return {Array} 조회한 컬럼모델 배열 + * @returns {Array} 조회한 컬럼모델 배열 */ getVisibleColumnModelList: function(whichSide, withMeta) { var startIndex = withMeta ? 0 : this.getVisibleMetaColumnCount(), @@ -2817,7 +2992,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 현재 노출되는 컬럼들 중, 고정된 컬럼들(L-side)의 갯수를 반환한다. * @param {boolean} [withMeta=false] 현재 보여지고 있는 메타컬럼의 count를 합칠지 여부 - * @returns {number} + * @returns {number} Visible columnFix count */ getVisibleColumnFixCount: function(withMeta) { var realColumnFixCount = this.get('columnFixCount'), @@ -2839,7 +3014,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 인자로 받은 columnName 에 해당하는 columnModel 을 반환한다. * @param {String} columnName 컬럼명 - * @return {Object} 컬럼명에 해당하는 컬럼모델 + * @returns {Object} 컬럼명에 해당하는 컬럼모델 */ getColumnModel: function(columnName) { return this.get('columnModelMap')[columnName]; @@ -2849,7 +3024,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype * columnName 에 해당하는 컬럼의 타입이 textType 인지 확인한다. * 랜더링시 html 태그 문자열을 제거할때 사용됨. * @param {String} columnName 컬럼명 - * @return {boolean} text 타입인지 여부 + * @returns {boolean} text 타입인지 여부 */ isTextType: function(columnName) { return !!this.textType[this.getEditType(columnName)]; @@ -2858,7 +3033,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 컬럼 모델로부터 editType 을 반환한다. * @param {string} columnName The name of the target column - * @return {string} 해당하는 columnName 의 editType 을 반환한다. + * @returns {string} 해당하는 columnName 의 editType 을 반환한다. */ getEditType: function(columnName) { var columnModel = this.getColumnModel(columnName), @@ -2873,9 +3048,9 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 인자로 받은 컬럼 모델에서 !isHidden 를 만족하는 리스트를 추려서 반환한다. - * @param {Array} dataColumnModelList 데이터 컬럼 모델 리스트 * @param {Array} metaColumnModelList 메타 컬럼 모델 리스트 - * @return {Array} isHidden 이 설정되지 않은 전체 컬럼 모델 리스트 + * @param {Array} dataColumnModelList 데이터 컬럼 모델 리스트 + * @returns {Array} isHidden 이 설정되지 않은 전체 컬럼 모델 리스트 * @private */ _makeVisibleColumnModelList: function(metaColumnModelList, dataColumnModelList) { @@ -2890,7 +3065,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * 각 columnModel 의 relationList 를 모아 주체가 되는 columnName 기준으로 relationListMap 를 생성하여 반환한다. * @param {Array} columnModelList - Column Model List - * @return {{}|{columnName1: Array, columnName1: Array}} columnName 기준으로 생성된 relationListMap + * @returns {{}|{columnName1: Array, columnName1: Array}} columnName 기준으로 생성된 relationListMap * @private */ _getRelationListMap: function(columnModelList) { @@ -2908,7 +3083,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype /** * isIgnore 가 true 로 설정된 columnName 의 list 를 반환한다. - * @return {Array} isIgnore 가 true 로 설정된 columnName 배열. + * @returns {Array} isIgnore 가 true 로 설정된 columnName 배열. */ getIgnoredColumnNameList: function() { var columnModelLsit = this.get('dataColumnModelList'), @@ -3061,11 +3236,12 @@ var util = require('../../common/util'); /** * Data 중 각 행의 데이터 모델 (DataSource) * @module data/row + * @extends module:base/model */ var ExtraDataManager = tui.util.defineClass(/**@lends module:model/data/extraData.prototype */{ /** * @constructs - * @extends module:base/model + * @param {Object} data - Data object */ init: function(data) { this.data = data; @@ -3076,7 +3252,7 @@ var ExtraDataManager = tui.util.defineClass(/**@lends module:model/data/extraDat * @param {string} columnName - column name * @param {(number|string)} rowKey - rowKey * @param {boolean} isRowSpanEnable - Boolean value whether row span is enable. - * @return {*|{count: number, isMainRow: boolean, mainRowKey: *}} rowSpan data + * @returns {*|{count: number, isMainRow: boolean, mainRowKey: *}} rowSpan data */ getRowSpanData: function(columnName, rowKey, isRowSpanEnable) { var rowSpanData = null; @@ -3100,7 +3276,7 @@ var ExtraDataManager = tui.util.defineClass(/**@lends module:model/data/extraDat /** * Returns the object that contains rowState info. - * @return {{isDisabled: boolean, isDisabledCheck: boolean, isChecked: boolean}} rowState 정보 + * @returns {{isDisabled: boolean, isDisabledCheck: boolean, isChecked: boolean}} rowState 정보 */ getRowState: function() { var result = { @@ -3191,7 +3367,7 @@ var ExtraDataManager = tui.util.defineClass(/**@lends module:model/data/extraDat /** * Returns the list of className. * @param {String} [columnName] - If specified, the result will only conatins class names of cell. - * @return {Array} - The array of class names. + * @returns {Array} - The array of class names. */ getClassNameList: function(columnName) { var classNameData = this.data.className, @@ -3213,7 +3389,7 @@ var ExtraDataManager = tui.util.defineClass(/**@lends module:model/data/extraDat * className 이 담긴 배열로부터 특정 className 을 제거하여 반환한다. * @param {Array} classNameList 디자인 클래스명 리스트 * @param {String} className 제거할 클래스명 - * @return {Array} 제거된 디자인 클래스명 리스트 + * @returns {Array} 제거된 디자인 클래스명 리스트 * @private */ _removeClassNameFromArray: function(classNameList, className) { @@ -3231,14 +3407,14 @@ var ExtraDataManager = tui.util.defineClass(/**@lends module:model/data/extraDat var classNameData = this.data.className; if (tui.util.pick(classNameData, 'column', columnName)) { - classNameData.column[columnName] = this._removeClassNameFromArray(classNameData.column[columnName], className); + classNameData.column[columnName] = + this._removeClassNameFromArray(classNameData.column[columnName], className); this.data.className = classNameData; } }, /** * rowKey 에 해당하는 행 전체에 CSS className 을 제거한다. - * @param {(Number|String)} rowKey 행 데이터의 고유 rowKey * @param {String} className 지정할 디자인 클래스명 */ removeClassName: function(className) { @@ -3271,20 +3447,24 @@ var PRIVATE_PROPERTIES = [ '_extraData' ]; +// Error code for validtaion +var VALID_ERR_REQUIRED = 'REQUIRED'; + /** * Data 중 각 행의 데이터 모델 (DataSource) * @module model/data/row + * @extends module:base/model */ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * @constructs - * @extends module:base/model */ initialize: function() { Model.prototype.initialize.apply(this, arguments); this.extraDataManager = new ExtraDataManager(this.get('_extraData')); this.columnModel = this.collection.columnModel; + this.validateMap = {}; this.on('change', this._onChange, this); }, @@ -3294,7 +3474,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ * Overrides Backbone's parse method for extraData not to be null. * @override * @param {object} data - initial data - * @return {object} - parsed data + * @returns {object} - parsed data */ parse: function(data) { if (!data._extraData) { @@ -3312,9 +3492,8 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ }, /** - * rowData 변경 이벤트 핸들러. - * changeCallback 과 rowSpanData 에 대한 처리를 담당한다. - * @param {object} row 데이터의 키값 + * Event handler for 'change' event. + * Executes callback functions, sync rowspan data, and validate data. * @private */ _onChange: function() { @@ -3333,17 +3512,57 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ } this.collection.syncRowSpannedData(this, columnName, value); this._executeChangeAfterCallback(columnName); - if (!this.getRowState().isDisabledCheck && !columnModel.isIgnore) { - this.set('_button', true); - } + this.validateCell(columnName, true); }, this); }, + /** + * Validate the cell data of given columnName and returns the error code. + * @param {Object} columnName - Column name + * @returns {String} Error code + * @private + */ + _validateCellData: function(columnName) { + var columnModel = this.columnModel.getColumnModel(columnName), + value = this.get(columnName), + errorCode = ''; + + if (columnModel.isRequired && util.isBlank(value)) { + errorCode = VALID_ERR_REQUIRED; + } + return errorCode; + }, + + /** + * Validate a cell of given columnName. + * If the data is invalid, add 'invalid' class name to the cell. + * @param {String} columnName - Target column name + * @param {Boolean} isDataChanged - True if data is changed (called by onChange handler) + * @returns {String} - Error code + */ + validateCell: function(columnName, isDataChanged) { + var errorCode; + + if (!isDataChanged && (columnName in this.validateMap)) { + return this.validateMap[columnName]; + } + + errorCode = this._validateCellData(columnName); + if (errorCode) { + this.addCellClassName(columnName, 'invalid'); + } else { + this.removeCellClassName(columnName, 'invalid'); + } + this.validateMap[columnName] = errorCode; + + return errorCode; + }, + /** * columnModel 에 정의된 changeCallback 을 수행할 때 전달핼 이벤트 객체를 생성한다. - * @param {object} row row 모델 * @param {String} columnName 컬럼명 - * @return {{rowKey: (number|string), columnName: string, columnData: *, instance: {object}}} changeCallback 에 전달될 이벤트 객체 + * @returns {{rowKey: (number|string), columnName: string, columnData: *, instance: {object}}} + * changeCallback 에 전달될 이벤트 객체 * @private */ _createChangeCallbackEvent: function(columnName) { @@ -3358,10 +3577,8 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * columnModel 에 정의된 changeBeforeCallback 을 수행한다. * changeBeforeCallback 의 결과가 false 일 때, 데이터를 복원후 false 를 반환한다. - * - * @param {object} row row 모델 * @param {String} columnName 컬럼명 - * @return {boolean} changeBeforeCallback 수행 결과값 + * @returns {boolean} changeBeforeCallback 수행 결과값 * @private */ _executeChangeBeforeCallback: function(columnName) { @@ -3387,9 +3604,8 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * columnModel 에 정의된 changeAfterCallback 을 수행한다. - * @param {object} row - row 모델 * @param {String} columnName - 컬럼명 - * @return {boolean} changeAfterCallback 수행 결과값 + * @returns {boolean} changeAfterCallback 수행 결과값 * @private */ _executeChangeAfterCallback: function(columnName) { @@ -3405,7 +3621,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * Returns the Array of private property names - * @return {array} An array of private property names + * @returns {array} An array of private property names */ getPrivateProperties: function() { return PRIVATE_PROPERTIES; @@ -3413,16 +3629,16 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * Returns the object that contains rowState info. - * @return {{isDisabled: boolean, isDisabledCheck: boolean, isChecked: boolean}} rowState 정보 + * @returns {{isDisabled: boolean, isDisabledCheck: boolean, isChecked: boolean}} rowState 정보 */ getRowState: function() { return this.extraDataManager.getRowState(); }, /** - * row의 extraData에 설정된 classNameList 를 반환한다. - * @param {String} [columnName] columnName 이 없을 경우 row 에 정의된 className 만 반환한다. - * @return {Array} css 클래스 이름의 배열 + * Returns an array of all className, related with given columnName. + * @param {String} columnName - Column name + * @returns {Array.} - An array of classNames */ getClassNameList: function(columnName) { var columnModel = this.columnModel.getColumnModel(columnName), @@ -3434,13 +3650,16 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ if (columnModel.isEllipsis) { classNameList.push('ellipsis'); } + if (columnModel.isRequired) { + classNameList.push('required'); + } return this._makeUniqueStringArray(classNameList); }, /** * Returns a new array, which splits all comma-separated strings in the targetList and removes duplicated item. * @param {Array} targetArray - Target array - * @return {Array} - New array + * @returns {Array} - New array */ _makeUniqueStringArray: function(targetArray) { var singleStringArray = _.uniq(targetArray.join(' ').split(' ')); @@ -3450,7 +3669,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * columnName 에 해당하는 셀의 편집 가능여부와 disabled 상태 여부를 반환한다. * @param {String} columnName 컬럼명 - * @return {{isEditable: boolean, isDisabled: boolean}} 편집 가능여부와 disabled 상태 정보 + * @returns {{isEditable: boolean, isDisabled: boolean}} 편집 가능여부와 disabled 상태 정보 */ getCellState: function(columnName) { var notEditableTypeList = ['_number', 'normal'], @@ -3486,7 +3705,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * rowKey 와 columnName 에 해당하는 셀이 편집 가능한지 여부를 반환한다. * @param {String} columnName 컬럼명 - * @return {Boolean} 편집 가능한지 여부 + * @returns {Boolean} 편집 가능한지 여부 */ isEditable: function(columnName) { var notEditableTypeList = ['_number', 'normal'], @@ -3502,7 +3721,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * rowKey 와 columnName 에 해당하는 셀이 disable 상태인지 여부를 반환한다. * @param {String} columnName 컬럼명 - * @return {Boolean} disabled 처리를 할지 여부 + * @returns {Boolean} disabled 처리를 할지 여부 */ isDisabled: function(columnName) { var cellState; @@ -3514,7 +3733,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ * getRowSpanData * rowSpan 설정값을 반환한다. * @param {String} [columnName] 인자가 존재하지 않을 경우, 행 전체의 rowSpanData 를 맵 형태로 반환한다. - * @return {*|{count: number, isMainRow: boolean, mainRowKey: *}} rowSpan 설정값 + * @returns {*|{count: number, isMainRow: boolean, mainRowKey: *}} rowSpan 설정값 */ getRowSpanData: function(columnName) { var isRowSpanEnable = this.collection.isRowSpanEnable(), @@ -3557,7 +3776,6 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * rowKey에 해당하는 행 전체에 CSS className 을 설정한다. - * @param {(Number|String)} rowKey 행 데이터의 고유 rowKey * @param {String} className 지정할 디자인 클래스명 */ addClassName: function(className) { @@ -3577,7 +3795,6 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * rowKey 에 해당하는 행 전체에 CSS className 을 제거한다. - * @param {(Number|String)} rowKey 행 데이터의 고유 rowKey * @param {String} className 지정할 디자인 클래스명 */ removeClassName: function(className) { @@ -3590,7 +3807,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ * columnModel 에 notUseHtmlEntity 가 설정된 경우는 동작하지 않는다. * * @param {String} columnName 컬럼명 - * @return {String} 인코딩된 결과값 + * @returns {String} 인코딩된 결과값 */ getHTMLEncodedString: function(columnName) { var columnModel = this.columnModel.getColumnModel(columnName), @@ -3609,7 +3826,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ * text 로 전환해서 반환할 때 처리를 하여 변환한다. * * @param {String} columnName 컬럼명 - * @return {String} text 형태로 가공된 문자열 + * @returns {String} text 형태로 가공된 문자열 * @private */ _getListTypeVisibleText: function(columnName) { @@ -3642,7 +3859,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ * change 이벤트 발생시 동일한 changed 객체의 public 프라퍼티가 동일한 경우 중복 처리를 막기 위해 사용한다. * 10ms 내에 같은 객체로 함수 호출이 일어나면 true를 반환한다. * @param {object} publicChanged 비교할 객체 - * @return {boolean} 중복이면 true, 아니면 false + * @returns {boolean} 중복이면 true, 아니면 false */ isDuplicatedPublicChanged: function(publicChanged) { if (this._timeoutIdForChanged && _.isEqual(this._lastPublicChanged, publicChanged)) { @@ -3660,7 +3877,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * 복사 기능을 사용할 때 화면에 보여지는 데이터를 반환한다. * @param {String} columnName 컬럼명 - * @return {String} 화면에 보여지는 데이터로 가공된 문자열 + * @returns {String} 화면에 보여지는 데이터로 가공된 문자열 */ getVisibleText: function(columnName) { var columnModel = this.columnModel, @@ -3693,9 +3910,9 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ /** * 컬럼모델에 정의된 relation 들을 수행한 결과를 반환한다. (기존 affectOption) - * - * @param {Array} callbackNameList 반환값의 결과를 확인할 대상 callbackList. (default : ['optionListChange', 'isDisabled', 'isEditable']) - * @return {{}|{columnName: {attribute: *}}} row 의 columnName 에 적용될 속성값. + * @param {Array} callbackNameList 반환값의 결과를 확인할 대상 callbackList. + * (default : ['optionListChange', 'isDisabled', 'isEditable']) + * @returns {{}|{columnName: {attribute: *}}} row 의 columnName 에 적용될 속성값. */ getRelationResult: function(callbackNameList) { var rowData = this.attributes, @@ -3763,13 +3980,12 @@ var Row = require('./row'); * Raw 데이터 RowList 콜렉션. (DataSource) * Grid.setRowList 를 사용하여 콜렉션을 설정한다. * @module model/data/rowList + * @extends module:base/collection */ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */{ - model: Row, /** * @param {Array} models 콜랙션에 추가할 model 리스트 * @param {Object} options 생성자의 option 객체 - * @extends module:base/collection * @constructs */ initialize: function(models, options) { @@ -3786,17 +4002,26 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ columnName: 'rowKey', isAscending: true, useClient: (_.isBoolean(options.useClientSort) ? options.useClientSort : true) - } + }, + + /** + * Whether the all rows are disabled. + * This state is not related to individual state of each rows. + * @type {Boolean} + */ + isDisabled: false }); if (!this.sortOptions.useClient) { this.comparator = null; } }, + model: Row, + /** * Backbone 이 collection 생성 시 내부적으로 parse 를 호출하여 데이터를 포멧에 맞게 파싱한다. * @param {Array} data 원본 데이터 - * @return {Array} 파싱하여 가공된 데이터 + * @returns {Array} 파싱하여 가공된 데이터 */ parse: function(data) { data = data && data['contents'] || data; @@ -3807,7 +4032,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * 데이터의 _extraData 를 분석하여, Model 에서 사용할 수 있도록 가공한다. * _extraData 필드에 rowSpanData 를 추가한다. * @param {Array} data 가공할 데이터 - * @return {Array} 가공된 데이터 + * @returns {Array} 가공된 데이터 * @private */ _formatData: function(data) { @@ -3829,7 +4054,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * * @param {object} row 대상 row 데이터 * @param {number} index 해당 row 의 인덱스 정보. rowKey 를 자동 생성할 경우 사용된다. - * @return {object} 가공된 row 데이터 + * @returns {object} 가공된 row 데이터 * @private */ _baseFormat: function(row) { @@ -3849,8 +4074,9 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * 새로운 rowKey를 생성해서 반환한다. - * @return {number} 생성된 rowKey - // */ + * @returns {number} 생성된 rowKey + * @private + */ _createRowKey: function() { this.lastRowKey += 1; return this.lastRowKey; @@ -3860,7 +4086,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * 랜더링시 사용될 extraData 필드에 rowSpanData 값을 세팅한다. * @param {Array} rowList - 전체 rowList 배열. rowSpan 된 경우 자식 row 의 데이터도 가공해야 하기 때문에 전체 list 를 인자로 넘긴다. * @param {number} index - 해당 배열에서 extraData 를 설정할 배열 - * @return {Array} rowList - 가공된 rowList + * @returns {Array} rowList - 가공된 rowList * @private */ _setExtraRowSpanData: function(rowList, index) { @@ -3910,7 +4136,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * originalRowList 와 originalRowMap 을 생성한다. * @param {Array} [rowList] rowList 가 없을 시 현재 collection 데이터를 originalRowList 로 저장한다. - * @return {Array} format 을 거친 데이터 리스트. + * @returns {Array} format 을 거친 데이터 리스트. */ setOriginalRowList: function(rowList) { this.originalRowList = rowList ? this._formatData(rowList) : this.toJSON(); @@ -3921,7 +4147,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * 원본 데이터 리스트를 반환한다. * @param {boolean} [isClone=true] 데이터 복제 여부. - * @return {Array} 원본 데이터 리스트 배열. + * @returns {Array} 원본 데이터 리스트 배열. */ getOriginalRowList: function(isClone) { isClone = isClone === undefined ? true : isClone; @@ -3931,7 +4157,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * 원본 row 데이터를 반환한다. * @param {(Number|String)} rowKey 데이터의 키값 - * @return {Object} 해당 행의 원본 데이터값 + * @returns {Object} 해당 행의 원본 데이터값 */ getOriginalRow: function(rowKey) { return _.clone(this.originalRowMap[rowKey]); @@ -3941,7 +4167,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * rowKey 와 columnName 에 해당하는 원본 데이터를 반환한다. * @param {(Number|String)} rowKey 데이터의 키값 * @param {String} columnName 컬럼명 - * @return {(Number|String)} rowKey 와 컬럼명에 해당하는 셀의 원본 데이터값 + * @returns {(Number|String)} rowKey 와 컬럼명에 해당하는 셀의 원본 데이터값 */ getOriginal: function(rowKey, columnName) { return _.clone(this.originalRowMap[rowKey][columnName]); @@ -3951,7 +4177,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * mainRowKey 를 반환한다. * @param {(Number|String)} rowKey 데이터의 키값 * @param {String} columnName 컬럼명 - * @return {(Number|String)} rowKey 와 컬럼명에 해당하는 셀의 main row 키값 + * @returns {(Number|String)} rowKey 와 컬럼명에 해당하는 셀의 main row 키값 */ getMainRowKey: function(rowKey, columnName) { var row = this.get(rowKey), @@ -3966,7 +4192,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * rowKey 에 해당하는 index를 반환한다. * @param {(Number|String)} rowKey 데이터의 키값 - * @return {Number} 키값에 해당하는 row의 인덱스 + * @returns {Number} 키값에 해당하는 row의 인덱스 */ indexOfRowKey: function(rowKey) { return this.indexOf(this.get(rowKey)); @@ -3976,7 +4202,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * rowSpan 이 적용되어야 하는지 여부를 반환한다. * 랜더링시 사용된다. * - sorted, 혹은 filterd 된 경우 false 를 리턴한다. - * @return {boolean} 랜더링 시 rowSpan 을 해야하는지 여부 + * @returns {boolean} 랜더링 시 rowSpan 을 해야하는지 여부 */ isRowSpanEnable: function() { return !this.isSortedByField(); @@ -3984,7 +4210,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * 현재 RowKey가 아닌 다른 컬럼에 의해 정렬된 상태인지 여부를 반환한다. - * @return {Boolean} 정렬된 상태인지 여부 + * @returns {Boolean} 정렬된 상태인지 여부 */ isSortedByField: function() { return this.sortOptions.columnName !== 'rowKey'; @@ -4092,7 +4318,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * Backbone 에서 sort() 실행시 내부적으로 사용되는 메소드. * @param {Row} a 비교할 앞의 모델 * @param {Row} b 비교할 뒤의 모델 - * @return {number} a가 b보다 작으면 -1, 같으면 0, 크면 1. 내림차순이면 반대. + * @returns {number} a가 b보다 작으면 -1, 같으면 0, 크면 1. 내림차순이면 반대. */ comparator: function(a, b) { var columnName = this.sortOptions.columnName, @@ -4116,7 +4342,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * rowList 에서 내부에서만 사용하는 property 를 제거하고 반환한다. * @param {Array} rowList 내부에 설정된 rowList 배열 - * @return {Array} private 프로퍼티를 제거한 결과값 + * @returns {Array} private 프로퍼티를 제거한 결과값 * @private */ _removePrivateProp: function(rowList) { @@ -4205,7 +4431,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * append, prepend 시 사용할 dummy row를 생성한다. - * @return {Object} 값이 비어있는 더미 row 데이터 + * @returns {Object} 값이 비어있는 더미 row 데이터 * @private */ _createDummyRow: function() { @@ -4220,11 +4446,14 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ }, /** - * 현재 rowList 중 at 에 해당하는 인덱스에 데이터를 append 한다. - * @param {object|array} rowData - 행 추가할 데이터. Array일 경우 여러행를 동시에 추가한다. - * @param {object} [options] - 옵션 객체 - * @param {number} [options.at] - 데이터를 append 할 index - * @param {boolean} [options.extendPrevRowSpan] - 이전 행의 rowSpan 데이터가 있는 경우 합칠지 여부 + * Insert the new row with specified data to the end of table. + * @param {(Array|Object)} [rowData] - The data for the new row + * @param {Object} [options] - Options + * @param {Number} [options.at] - The index at which new row will be inserted + * @param {Boolean} [options.extendPrevRowSpan] - If set to true and the previous row at target index + * has a rowspan data, the new row will extend the existing rowspan data. + * @param {Boolean} [options.focus] - If set to true, move focus to the new row after appending + * @returns {Array.} Row model list */ append: function(rowData, options) { var modelList = this._createModelList(rowData), @@ -4239,25 +4468,30 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ this.add(modelList, addOptions); this._syncRowSpanDataForAppend(options.at, modelList.length, options.extendPrevRowSpan); - this.trigger('add', modelList, addOptions); + this.trigger('add', modelList, options); + return modelList; }, /** * 현재 rowList 에 최상단에 데이터를 append 한다. * @param {Object} rowData prepend 할 행 데이터 + * @param {object} [options] - Options + * @param {boolean} [options.focus] - If set to true, move focus to the new row after appending + * @returns {Array.} Row model list */ - prepend: function(rowData) { - return this.append(rowData, { - at: 0 - }); + prepend: function(rowData, options) { + options = options || {}; + options.at = 0; + + return this.append(rowData, options); }, /** * rowKey에 해당하는 행의 데이터를 리턴한다. isJsonString을 true로 설정하면 결과를 json객체로 변환하여 리턴한다. * @param {(Number|String)} rowKey 행 데이터의 고유 키 * @param {Boolean} [isJsonString=false] true 일 경우 JSON String 으로 반환한다. - * @return {Object} 행 데이터 + * @returns {Object} 행 데이터 */ getRowData: function(rowKey, isJsonString) { var row = this.get(rowKey), @@ -4270,7 +4504,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * 그리드 전체 데이터 중에서 index에 해당하는 순서의 데이터 객체를 리턴한다. * @param {Number} index 행의 인덱스 * @param {Boolean} [isJsonString=false] true 일 경우 JSON String 으로 반환한다. - * @return {Object} 행 데이터 + * @returns {Object} 행 데이터 */ getRowDataAt: function(index, isJsonString) { var row = this.at(index), @@ -4284,7 +4518,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * @param {(Number|String)} rowKey 행 데이터의 고유 키 * @param {String} columnName 컬럼 이름 * @param {boolean} [isOriginal] 원본 데이터 리턴 여부 - * @return {(Number|String|undefined)} 조회한 셀의 값. + * @returns {(Number|String|undefined)} 조회한 셀의 값. */ getValue: function(rowKey, columnName, isOriginal) { var value, row; @@ -4329,7 +4563,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * columnName에 해당하는 column data list를 리턴한다. * @param {String} columnName 컬럼명 * @param {boolean} [isJsonString=false] true 일 경우 JSON String 으로 반환한다. - * @return {Array} 컬럼명에 해당하는 셀들의 데이터 리스트 + * @returns {Array} 컬럼명에 해당하는 셀들의 데이터 리스트 */ getColumnValues: function(columnName, isJsonString) { var valueList = this.pluck(columnName); @@ -4378,7 +4612,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * Returns true if there are at least one row changed. - * @return {boolean} - True if there are at least one row changed. + * @returns {boolean} - True if there are at least one row changed. */ isChanged: function() { var modifiedRowsArr = _.values(this.getModifiedRowList()); @@ -4388,6 +4622,17 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ }); }, + /** + * Enables or Disables all rows. + * @param {Boolean} isDisabled - Whether disabled or not + */ + setDisabled: function(isDisabled) { + if (this.isDisabled !== isDisabled) { + this.isDisabled = isDisabled; + this.trigger('disabledChanged'); + } + }, + /** * rowKey에 해당하는 행을 활성화시킨다. * @param {(Number|String)} rowKey 행 데이터의 고유 키 @@ -4464,7 +4709,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ /** * 주어진 데이터로 모델 목록을 생성하여 반환한다. * @param {object|array} rowData - 모델을 생성할 데이터. Array일 경우 여러개를 동시에 생성한다. - * @return {Row[]} 생성된 모델 목록 + * @returns {Row[]} 생성된 모델 목록 */ _createModelList: function(rowData) { var modelList = [], @@ -4479,7 +4724,6 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ _.each(rowList, function(row) { var rowData; - row._button = true; rowData = new Row(row, { collection: this, parse: true @@ -4560,7 +4804,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * @param {Object} row - row 데이터 * @param {Object} originalRow - 원본 row 데이터 * @param {Array} filteringColumnList - 비교에서 제외할 컬럼명 - * @return {boolean} - 수정여부 + * @returns {boolean} - 수정여부 */ _isModifiedRow: function(row, originalRow, filteringColumnList) { var filtered = _.omit(row, filteringColumnList); @@ -4581,7 +4825,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * @param {boolean} [options.isRaw=false] true 로 설정된 경우 내부 연산용 데이터 제거 필터링을 거치지 않는다. * @param {boolean} [options.isOnlyRowKeyList=false] true 로 설정된 경우 키값만 저장하여 리턴한다. * @param {Array} [options.filteringColumnList] 행 데이터 중에서 데이터 변경으로 간주하지 않을 컬럼 이름을 배열로 설정한다. - * @return {{createList: Array, updateList: Array, deleteList: Array}} options 조건에 해당하는 수정된 rowList 정보 + * @returns {{createList: Array, updateList: Array, deleteList: Array}} options 조건에 해당하는 수정된 rowList 정보 */ getModifiedRowList: function(options) { var isRaw = options && options.isRaw, @@ -4624,6 +4868,13 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ return result; }, + /** + * Resets data. + * @param {Array} rowList - New data + * @param {Boolean} isParse - parse option of Backbone.Collection.reset + * @param {Function} callback - Callback function + * @private + */ _resetData: function(rowList, isParse, callback) { this.lastRowKey = -1; this.reset(rowList, { @@ -4638,6 +4889,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * rowList 를 설정한다. setRowList 와 다르게 setOriginalRowList 를 호출하여 원본데이터를 갱신하지 않는다. * @param {Array} rowList 설정할 데이터 배열 값 * @param {boolean} [isParse=true] backbone 의 parse 로직을 수행할지 여부 + * @param {Function} [callback] callback function */ replaceRowList: function(rowList, isParse, callback) { if (_.isUndefined(isParse)) { @@ -4692,10 +4944,6 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ if (isDeletableType && cellState.isEditable && !cellState.isDisabled) { this.setValue(mainRowKey, columnName, '', silent); - //silent 의 경우 데이터 모델의 change 이벤트가 발생하지 않기 때문에, 강제로 checkbox 를 세팅한다. - if (silent) { - this.check(mainRowKey, silent); - } } }, @@ -4718,11 +4966,71 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ }); }, + /** + * Validates all data and returns the result. + * Return value is an array which contains only rows which have invalid cell data. + * @returns {Array.} An array of error object + * @example + [ + { + rowKey: 1, + errors: [ + { + columnName: 'c1', + errorCode: 'REQUIRED' + }, + { + columnName: 'c2', + errorCode: 'REQUIRED' + } + ] + }, + { + rowKey: 3, + errors: [ + { + columnName: 'c2', + errorCode: 'REQUIRED' + } + ] + } + ] + */ + validate: function() { + var errorRows = [], + requiredColumnNames = _.chain(this.columnModel.getVisibleColumnModelList()) + .filter(function(columnModel) { + return columnModel.isRequired === true; + }) + .pluck('columnName') + .value(); + + this.each(function(row) { + var errorCells = []; + _.each(requiredColumnNames, function(columnName) { + var errorCode = row.validateCell(columnName); + if (errorCode) { + errorCells.push({ + columnName: columnName, + errorCode: errorCode + }); + } + }); + if (errorCells.length) { + errorRows.push({ + rowKey: row.get('rowKey'), + errors: errorCells + }); + } + }); + return errorRows; + }, + /** * 붙여넣기를 실행할 때 끝점이 될 셀의 인덱스를 반환한다. * @param {Array[]} data - 붙여넣기할 데이터 * @param {{row: number, column: number}} startIdx - 시작점이 될 셀의 인덱스 - * @return {{row: number, column: number}} 행과 열의 인덱스 정보를 가진 객체 + * @returns {{row: number, column: number}} 행과 열의 인덱스 정보를 가진 객체 */ _getEndIndexToPaste: function(data, startIdx) { var columnModelList = this.columnModel.getVisibleColumnModelList(), @@ -4769,7 +5077,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ * 내부적으로 자동으로 mainRowKey 를 찾아 반환한다. * @param {(Number|String)} rowKey 행 데이터의 고유 키 * @param {String} columnName 컬럼 이름 - * @return {jQuery} 해당 jQuery Element + * @returns {jQuery} 해당 jQuery Element */ getElement: function(rowKey, columnName) { var rowKey = this.getMainRowKey(rowKey, columnName); @@ -4788,21 +5096,21 @@ module.exports = RowList; var Model = require('../base/model'); var util = require('../common/util'); +var dimensionConstMap = require('../common/constMap').dimension; -// The width of the border of the dimension. -var BORDER_WIDTH = 1; - -// The width of the border of table cell. -var CELL_BORDER_WIDTH = 1; +var TABLE_BORDER_WIDTH = dimensionConstMap.TABLE_BORDER_WIDTH; +var CELL_BORDER_WIDTH = dimensionConstMap.CELL_BORDER_WIDTH; /** * 크기 관련 데이터 저장 * @module model/dimension + * @extends module:base/model */ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** - * @extends module:base/model * @constructs + * @param {Object} attrs - Attributes + * @param {Object} options - Options */ initialize: function(attrs, options) { Model.prototype.initialize.apply(this, arguments); @@ -4829,10 +5137,11 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ this.listenTo(this.dataModel, 'add remove reset', this._resetTotalRowHeight); this.on('change:width', this._onWidthChange, this); - this.on('change:displayRowCount', this._setBodyHeight, this); + this.on('change:bodyHeight', this._resetDisplayRowCount, this); + this.on('change:displayRowCount', this._resetBodyHeight, this); this._initColumnWidthVariables(); - this._setBodyHeight(); + this._resetBodyHeight(); }, models: null, @@ -4860,13 +5169,14 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ displayRowCount: 1, scrollBarSize: 17, scrollX: true, - scrollY: true + scrollY: true, + fitToParentHeight: false }, /** * 전체 넓이에서 스크롤바, border등의 넓이를 제외하고 실제 셀의 넓이에 사용되는 값만 반환한다. * @param {number} columnLength - 컬럼의 개수 - * @return {number} 사용가능한 전체 셀의 넓이 + * @returns {number} 사용가능한 전체 셀의 넓이 * @private */ _getAvailableTotalWidth: function(columnLength) { @@ -4882,7 +5192,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * Makes all width of columns not less than minimumColumnWidth. * @param {number[]} columnWidthList - 컬럼 넓이값 배열 - * @return {number[]} - 수정된 새로운 넓이값 배열 + * @returns {number[]} - 수정된 새로운 넓이값 배열 * @private */ _applyMinimumColumnWidth: function(columnWidthList) { @@ -4899,7 +5209,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ }, /** - * Reset 'totalRowHeight' property. + * Resets the 'totalRowHeight' attribute. + * @private */ _resetTotalRowHeight: function() { var rowHeight = this.get('rowHeight'), @@ -4909,10 +5220,27 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ this.set('totalRowHeight', (rowHeight * rowCount) + totalBorderWidth); }, + /** + * Resets the 'displayRowCount' attribute. + * @private + */ + _resetDisplayRowCount: function() { + var actualBodyHeight, displayRowCount; + + // To prevent recursive call with _resetBodyHeight (called by change:displayRowCount event) + if (_.has(this.changed, 'displayRowCount')) { + return; + } + actualBodyHeight = this.get('bodyHeight') - this.getScrollXHeight(); + displayRowCount = util.getDisplayRowCount(actualBodyHeight, this.get('rowHeight')); + + this.set('displayRowCount', displayRowCount); + }, + /** * Sets the width of columns whose width is not assigned by distributing extra width to them equally. * @param {number[]} columnWidthList - An array of column widths - * @return {number[]} - A new array of column widths + * @returns {number[]} - A new array of column widths * @private */ _fillEmptyColumnWidth: function(columnWidthList) { @@ -4932,7 +5260,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * Adds extra widths of the column equally. * @param {number[]} columnWidthList - An array of column widths * @param {number} totalExtraWidth - Total extra width - * @return {number[]} - A new array of column widths + * @returns {number[]} - A new array of column widths * @private */ _addExtraColumnWidth: function(columnWidthList, totalExtraWidth) { @@ -4951,7 +5279,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * Reduces excess widths of the column equally. * @param {number[]} columnWidthList - An array of column widths * @param {number} totalExcessWidth - Total excess width (negative number) - * @return {number[]} - A new array of column widths + * @returns {number[]} - A new array of column widths * @private */ _reduceExcessColumnWidth: function(columnWidthList, totalExcessWidth) { @@ -4977,7 +5305,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @param {number} totalRemainWidth - Remaining excess width (negative number) * @param {object[]} availableList - An array of infos about available column. * Each item of the array has {index:number, width:number}. - * @return {number[]} - A new array of column widths + * @returns {number[]} - A new array of column widths * @private */ _reduceExcessColumnWidthSub: function(columnWidthList, totalRemainWidth, availableList) { @@ -5007,7 +5335,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @param {number[]} columnWidthList - An array of column width * @param {number} extraWidth - Extra width * @param {number[]} columnIndexes - An array of indexes of target columns - * @return {number[]} - A new array of column widths + * @returns {number[]} - A new array of column widths * @private */ _distributeExtraWidthEqually: function(columnWidthList, extraWidth, columnIndexes) { @@ -5029,7 +5357,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @param {number[]} columnWidthList - An array of column width * @param {boolean} [fitToReducedTotal] - If set to true and the total width is smaller than dimension(width), * the column widths will be reduced. - * @return {number[]} - A new array of column widths + * @returns {number[]} - A new array of column widths * @private */ _adjustColumnWidthList: function(columnWidthList, fitToReducedTotal) { @@ -5093,7 +5421,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * L, R 중 하나를 입력받아 frame 의 너비를 구한다. * @param {String} [whichSide] 지정하지 않을 경우 전체 너비. - * @return {Number} 해당 frame 의 너비 + * @returns {Number} 해당 frame 의 너비 */ getFrameWidth: function(whichSide) { var columnFixCount = this.columnModel.getVisibleColumnFixCount(true), @@ -5109,7 +5437,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * widthList 로부터 보더 값을 포함하여 계산한 frameWidth 를 구한다. * @param {Array} widthList 너비 리스트 배열 - * @return {Number} 계산된 frame 너비값 + * @returns {Number} 계산된 frame 너비값 * @private */ _getFrameWidth: function(widthList) { @@ -5157,7 +5485,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * 열 고정 영역의 minimum width 값을 구한다. - * @return {number} 열고정 영역의 최소 너비값. + * @returns {number} 열고정 영역의 최소 너비값. * @private */ _getMinLeftSideWidth: function() { @@ -5175,7 +5503,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * 열 고정 영역의 maximum width 값을 구한다. - * @return {number} 열고정 영역의 최대 너비값. + * @returns {number} 열고정 영역의 최대 너비값. * @private */ _getMaxLeftSideWidth: function() { @@ -5191,7 +5519,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * 계산한 cell 의 위치를 리턴한다. * @param {Number|String} rowKey - 데이터의 키값 * @param {String} columnName - 칼럼명 - * @return {{top: number, left: number, right: number, bottom: number}} - cell의 위치 + * @returns {{top: number, left: number, right: number, bottom: number}} - cell의 위치 * @todo TC */ getCellPosition: function(rowKey, columnName) { @@ -5246,7 +5574,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * Return scroll position from the received index * @param {Number|String} rowKey - Row-key of target cell * @param {String} columnName - Column name of target cell - * @return {{?scrollLeft: number, ?scrollTop: number}} Position to scroll + * @returns {{scrollLeft: ?Number, scrollTop: ?Number}} Position to scroll */ getScrollPosition: function(rowKey, columnName) { var isRsideColumn = !this.columnModel.isLside(columnName), @@ -5310,7 +5638,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @param {{isUp: boolean, isDown: boolean, isLeft: boolean, isRight: boolean}} scrollDirection - Direction * @param {{top: number, bottom: number, left: number, right: number}} targetPosition - Position of target element * @param {{height: number, rsideWidth: number}} bodySize - Using cached bodySize - * @return {{?scrollLeft: number, ?scrollTop: number}} Position to scroll + * @returns {{scrollLeft: ?Number, scrollTop: ?Number}} Position to scroll * @private */ _makeScrollPosition: function(scrollDirection, targetPosition, bodySize) { @@ -5325,7 +5653,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ if (scrollDirection.isLeft) { pos.scrollLeft = targetPosition.left; } else if (scrollDirection.isRight) { - pos.scrollLeft = targetPosition.right - bodySize.rsideWidth + BORDER_WIDTH; + pos.scrollLeft = targetPosition.right - bodySize.rsideWidth + TABLE_BORDER_WIDTH; } return pos; @@ -5380,7 +5708,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @param {Number} pageX - Mouse X-position based on page * @param {Number} pageY - Mouse Y-position based on page * @param {boolean} [withMeta] - Whether the meta columns go with this calculation - * @return {{row: number, column: number}} Cell index + * @returns {{row: number, column: number}} Cell index */ getIndexFromMousePosition: function(pageX, pageY, withMeta) { var containerPos = this._rebasePositionToContainer(pageX, pageY); @@ -5428,11 +5756,11 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ columnIndex = columnWidthList.length - 1; } else { tui.util.forEachArray(columnWidthList, function(width, index) { - if (cellX <= width) { + if (cellX > width) { + cellX -= width; + } else { columnIndex = index; return false; - } else { - cellX -= width; } }); } @@ -5444,7 +5772,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * 마우스 위치 정보에 해당하는 grid container 기준 pageX 와 pageY 를 반환한다. * @param {Number} pageX 마우스 x 좌표 * @param {Number} pageY 마우스 y 좌표 - * @return {{x: number, y: number}} 그리드 container 기준의 x, y 값 + * @returns {{x: number, y: number}} 그리드 container 기준의 x, y 값 * @private */ _rebasePositionToContainer: function(pageX, pageY) { @@ -5461,7 +5789,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * columnFixCount 가 적용되었을 때, window resize 시 left side 의 너비를 조정한다. * @param {Array} lsideWidthList 열고정 영역의 너비 리스트 배열 * @param {Number} totalWidth grid 전체 너비 - * @return {Array} 열고정 영역의 너비 리스트 + * @returns {Array} 열고정 영역의 너비 리스트 * @private */ _adjustLeftSideWidthList: function(lsideWidthList, totalWidth) { @@ -5484,28 +5812,24 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ }, /** - * 그리드의 body height 를 계산하여 할당한다. + * Resets the 'bodyHeight' attribute. * @private */ - _setBodyHeight: function() { - var height = util.getHeight(this.get('displayRowCount'), this.get('rowHeight')); - - height += this.getScrollXHeight(); - this.set('bodyHeight', height); - }, + _resetBodyHeight: function() { + var rowListHeight; - /** - * 현재 화면에 보이는 row 개수를 반환 - * @return {number} 화면에 보이는 행 개수 - */ - getDisplayRowCount: function() { - return util.getDisplayRowCount(this.get('bodyHeight') - this.getScrollXHeight(), this.get('rowHeight')); + // To prevent recursive call with _resetDisplayRowCount (called by change:bodyHeight event) + if (_.has(this.changed, 'bodyHeight')) { + return; + } + rowListHeight = util.getHeight(this.get('displayRowCount'), this.get('rowHeight')); + this.set('bodyHeight', rowListHeight + this.getScrollXHeight()); }, /** * Return height of X-scrollBar. * If no X-scrollBar, return 0 - * @return {number} Height of X-scrollBar + * @returns {number} Height of X-scrollBar */ getScrollXHeight: function() { return (this.get('scrollX') ? this.get('scrollBarSize') : 0); @@ -5554,16 +5878,16 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * Returns the height of table body. * @param {number} height - The height of the dimension - * @return {number} The height of the table body + * @returns {number} The height of the table body * @private */ _calcRealBodyHeight: function(height) { - return height - this.get('headerHeight') - this.get('toolbarHeight') - BORDER_WIDTH; + return height - this.get('headerHeight') - this.get('toolbarHeight') - TABLE_BORDER_WIDTH; }, /** * Returns the minimum height of table body. - * @return {number} The minimum height of table body + * @returns {number} The minimum height of table body * @private */ _getMinBodyHeight: function() { @@ -5577,7 +5901,6 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ */ _setHeight: function(height) { this.set('bodyHeight', Math.max(this._calcRealBodyHeight(height), this._getMinBodyHeight())); - this.set('displayRowCount', this.getDisplayRowCount(), {silent: true}); }, /** @@ -5597,7 +5920,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * Returns the height of the dimension. - * @return {Number} Height + * @returns {Number} Height */ getHeight: function() { return this.get('bodyHeight') + this.get('headerHeight') + this.get('toolbarHeight'); @@ -5615,6 +5938,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ offsetLeft: offset.left, width: domState.getWidth() }); + + if (this.get('fitToParentHeight')) { + this._setHeight(domState.getParentHeight()); + } }, /** @@ -5629,7 +5956,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ /** * L side 와 R side 에 따른 columnWidthList 를 반환한다. * @param {String} [whichSide] 어느 영역인지 여부. 'L|R' 중 하나를 인자로 넘긴다. 생략시 전체 columnList 반환 - * @return {Array} 조회한 영역의 columnWidthList + * @returns {Array} 조회한 영역의 columnWidthList */ getColumnWidthList: function(whichSide) { var columnFixCount = this.columnModel.getVisibleColumnFixCount(true), @@ -5654,7 +5981,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ module.exports = Dimension; -},{"../base/model":5,"../common/util":10}],18:[function(require,module,exports){ +},{"../base/model":5,"../common/constMap":8,"../common/util":10}],18:[function(require,module,exports){ /** * @fileoverview Focus 관련 데이터 처리름 담당한다. * @author NHN Ent. FE Development Team @@ -5668,11 +5995,13 @@ var Model = require('../base/model'), * Focus model * RowList collection 이 focus class 를 listen 한다. * @module model/focus + * @extends module:base/model */ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** - * @extends module:base/model * @constructs + * @param {Object} attrs - Attributes + * @param {Object} options - Options */ initialize: function(attrs, options) { Model.prototype.initialize.apply(this, arguments); @@ -5683,6 +6012,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ this.renderModel = options.renderModel; this.cellFactory = options.cellFactory; this.domState = options.domState; + + this.listenTo(this.dataModel, 'add', this._onAddData); + this.listenTo(this.dataModel, 'reset', this._onResetData); }, defaults: { @@ -5692,10 +6024,30 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ prevColumnName: '' }, + /** + * Event handler for 'add' event on dataModel. + * @param {Array.} rows - New appended row model + * @param {Object} options - Options. See {@link module:model/data/row#append} + * @private + */ + _onAddData: function(rows, options) { + if (options.focus) { + this.focusAt(options.at, 0); + } + }, + + /** + * Event handler for 'reset' event on dataModel. + * @private + */ + _onResetData: function() { + this.unselect(true); + }, + /** * 이전 focus 정보를 저장한다. * @private - * @return {Model.Focus} This object + * @returns {Model.Focus} This object */ _savePrevious: function() { if (this.get('rowKey') !== null) { @@ -5719,11 +6071,36 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ }, /** - * 행을 select 한다. - * @param {Number|String} rowKey - select 할 행의 키값 - * @returns {Model.Focus} This object + * Returns whether given rowKey is equal to current value + * @param {(Number|String)} rowKey - Row key + * @returns {Boolean} - True if equal + */ + _isCurrentRow: function(rowKey) { + // compare with == operator to avoid strict comparision + // (rowkey can be a number or a string) + return this.get('rowKey') == rowKey; + }, + + /** + * Returns whether given rowKey and columnName is equal to current value + * @param {(Number|String)} rowKey - Row key + * @param {String} columnName - Column name + * @returns {Boolean} - True if equal + */ + _isCurrentCell: function(rowKey, columnName) { + return this._isCurrentRow(rowKey) && this.get('columnName') === columnName; + }, + + /** + * Selects the given row + * @param {Number|String} rowKey - Rowkey of the target row + * @returns {Object} This object */ select: function(rowKey) { + if (this._isCurrentRow(rowKey)) { + return this; + } + this.unselect().set('rowKey', rowKey); if (this.columnModel.get('selectType') === 'radio') { this.dataModel.check(rowKey); @@ -5738,7 +6115,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 행을 unselect 한다. * @param {boolean} blur - The boolean value whether to invoke blur - * @return {Model.Focus} This object + * @returns {Model.Focus} This object */ unselect: function(blur) { if (blur) { @@ -5756,13 +6133,13 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @param {Number|String} rowKey focus 처리할 셀의 rowKey 값 * @param {String} columnName focus 처리할 셀의 컬럼명 * @param {Boolean} isScrollable focus 처리한 영역으로 scroll 위치를 이동할지 여부 - * @return {Model.Focus} This object + * @returns {Model.Focus} This object */ focus: function(rowKey, columnName, isScrollable) { if (util.isBlank(rowKey) || util.isBlank(columnName) || this.columnModel.isMetaColumn(columnName) || - (this.get('rowKey') === rowKey && this.get('columnName') === columnName)) { + this._isCurrentCell(rowKey, columnName)) { return this; } @@ -5857,7 +6234,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 디자인 blur 처리한다. - * @return {Model.Focus} This object + * @returns {Model.Focus} This object */ blur: function() { if (this.has()) { @@ -5872,7 +6249,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 현재 focus 정보를 반환한다. - * @return {{rowKey: (number|string), columnName: string}} 현재 focus 정보에 해당하는 rowKey, columnName + * @returns {{rowKey: (number|string), columnName: string}} 현재 focus 정보에 해당하는 rowKey, columnName */ which: function() { return { @@ -5884,7 +6261,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 현재 focus 정보를 index 기준으로 반환한다. * @param {boolean} isPrevious 이전 focus 정보를 반환할지 여부 - * @return {{row: number, column: number}} The object that contains index info + * @returns {{row: number, column: number}} The object that contains index info */ indexOf: function(isPrevious) { var rowKey = isPrevious ? this.get('prevRowKey') : this.get('rowKey'), @@ -5898,7 +6275,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * Returns whether has focus. - * @return {boolean} True if has focus. + * @returns {boolean} True if has focus. */ has: function() { return this._isValidCell(this.get('rowKey'), this.get('columnName')); @@ -5906,7 +6283,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * Restore previous focus data. - * @return {boolean} True if restored + * @returns {boolean} True if restored */ restore: function() { var prevRowKey = this.get('prevRowKey'), @@ -5922,7 +6299,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * Returns whether the specified cell is exist - * @return {boolean} True if exist + * @param {String|Number} rowKey - Rowkey + * @param {String} columnName - ColumnName + * @returns {boolean} True if exist */ _isValidCell: function(rowKey, columnName) { var isValidRowKey = !util.isBlank(rowKey) && !!this.dataModel.get(rowKey), @@ -5934,14 +6313,19 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 현재 focus 된 row 기준으로 offset 만큼 이동한 rowKey 를 반환한다. * @param {Number} offset 이동할 offset - * @return {Number|String} rowKey offset 만큼 이동한 위치의 rowKey + * @returns {Number|String} rowKey offset 만큼 이동한 위치의 rowKey * @private */ _findRowKey: function(offset) { var index, row, dataModel = this.dataModel; if (this.has()) { - index = Math.max(Math.min(dataModel.indexOfRowKey(this.get('rowKey')) + offset, this.dataModel.length - 1), 0); + index = Math.max( + Math.min( + dataModel.indexOfRowKey(this.get('rowKey')) + offset, + this.dataModel.length - 1 + ), 0 + ); row = dataModel.at(index); return row && row.get('rowKey'); } @@ -5950,7 +6334,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 현재 focus 된 column 기준으로 offset 만큼 이동한 columnName 을 반환한다. * @param {Number} offset 이동할 offset - * @return {String} columnName offset 만큼 이동한 위치의 columnName + * @returns {String} columnName offset 만큼 이동한 위치의 columnName * @private */ _findColumnName: function(offset) { @@ -5969,7 +6353,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * rowSpanData 를 반환한다. * @param {Number|String} rowKey 조회할 데이터의 키값 * @param {String} columnName 컬럼명 - * @return {*|{count: number, isMainRow: boolean, mainRowKey: *}|*} rowSpanData 정보 + * @returns {*|{count: number, isMainRow: boolean, mainRowKey: *}|*} rowSpanData 정보 * @private */ _getRowSpanData: function(rowKey, columnName) { @@ -5979,7 +6363,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * offset 만큼 뒤로 이동한 row 의 index 를 반환한다. * @param {number} offset 이동할 offset - * @return {Number} 이동한 위치의 row index + * @returns {Number} 이동한 위치의 row index */ nextRowIndex: function(offset) { var rowKey = this.nextRowKey(offset); @@ -5989,7 +6373,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * offset 만큼 앞으로 이동한 row의 index를 반환한다. * @param {number} offset 이동할 offset - * @return {Number} 이동한 위치의 row index + * @returns {Number} 이동한 위치의 row index */ prevRowIndex: function(offset) { var rowKey = this.prevRowKey(offset); @@ -5998,7 +6382,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 다음 컬럼의 인덱스를 반환한다. - * @return {Number} 다음 컬럼의 index + * @returns {Number} 다음 컬럼의 index */ nextColumnIndex: function() { var columnName = this.nextColumnName(); @@ -6007,7 +6391,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 이전 컬럼의 인덱스를 반환한다. - * @return {Number} 이전 컬럼의 인덱스 + * @returns {Number} 이전 컬럼의 인덱스 */ prevColumnIndex: function() { var columnName = this.prevColumnName(); @@ -6018,7 +6402,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * keyEvent 발생 시 호출될 메서드로, * rowSpan 정보 까지 계산된 다음 rowKey 를 반환한다. * @param {number} offset 이동할 offset - * @return {Number|String} offset 만큼 이동한 위치의 rowKey + * @returns {Number|String} offset 만큼 이동한 위치의 rowKey */ nextRowKey: function(offset) { var focused = this.which(), @@ -6051,7 +6435,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * keyEvent 발생 시 호출될 메서드로, * rowSpan 정보 까지 계산된 이전 rowKey 를 반환한다. * @param {number} offset 이동할 offset - * @return {Number|String} offset 만큼 이동한 위치의 rowKey + * @returns {Number|String} offset 만큼 이동한 위치의 rowKey */ prevRowKey: function(offset) { var focused = this.which(), @@ -6079,7 +6463,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * keyEvent 발생 시 호출될 메서드로, 다음 columnName 을 반환한다. - * @return {String} 다음 컬럼명 + * @returns {String} 다음 컬럼명 */ nextColumnName: function() { return this._findColumnName(1); @@ -6087,7 +6471,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * keyEvent 발생 시 호출될 메서드로, 이전 columnName 을 반환한다. - * @return {String} 이전 컬럼명 + * @returns {String} 이전 컬럼명 */ prevColumnName: function() { return this._findColumnName(-1); @@ -6095,7 +6479,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 첫번째 row 의 key 를 반환한다. - * @return {(string|number)} 첫번째 row 의 키값 + * @returns {(string|number)} 첫번째 row 의 키값 */ firstRowKey: function() { return this.dataModel.at(0).get('rowKey'); @@ -6103,7 +6487,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 마지막 row의 key 를 반환한다. - * @return {(string|number)} 마지막 row 의 키값 + * @returns {(string|number)} 마지막 row 의 키값 */ lastRowKey: function() { return this.dataModel.at(this.dataModel.length - 1).get('rowKey'); @@ -6111,7 +6495,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 첫번째 columnName 을 반환한다. - * @return {string} 첫번째 컬럼명 + * @returns {string} 첫번째 컬럼명 */ firstColumnName: function() { var columnModelList = this.columnModel.getVisibleColumnModelList(); @@ -6120,7 +6504,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ /** * 마지막 columnName 을 반환한다. - * @return {string} 마지막 컬럼명 + * @returns {string} 마지막 컬럼명 */ lastColumnName: function() { var columnModelList = this.columnModel.getVisibleColumnModelList(), @@ -6158,6 +6542,8 @@ var defaultOptions = { autoNumbering: true, headerHeight: 35, rowHeight: 27, + fitToParentHeight: false, + showDummyRows: false, displayRowCount: 10, minimumColumnWidth: 50, notUseSmartRendering: false, @@ -6203,7 +6589,7 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype /** * Creates an instance of column model and returns it. * @param {Object} options - Options - * @return {module:data/columnModel} A new instance + * @returns {module:data/columnModel} A new instance * @private */ _createColumnModel: function(options) { @@ -6221,7 +6607,7 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype * Creates an instance of data model and returns it. * @param {Object} options - Options * @param {module:domState} domState - domState - * @return {module:data/rowList} - A new instance + * @returns {module:data/rowList} - A new instance * @private */ _createDataModel: function(options, domState) { @@ -6236,7 +6622,7 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype /** * Creates an instance of toolbar model and returns it. * @param {Object} options - Options - * @return {module:model/toolbar} - A new instance + * @returns {module:model/toolbar} - A new instance * @private */ _createToolbarModel: function(options) { @@ -6247,13 +6633,14 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype * Creates an instance of dimension model and returns it. * @param {Object} options - Options * @param {module:domState} domState - domState - * @return {module:model/dimension} - A new instance + * @returns {module:model/dimension} - A new instance * @private */ _createDimensionModel: function(options, domState) { var attrs = { headerHeight: options.headerHeight, rowHeight: options.rowHeight, + fitToParentHeight: options.fitToParentHeight, scrollX: !!options.scrollX, scrollY: !!options.scrollY, minimumColumnWidth: options.minimumColumnWidth, @@ -6273,7 +6660,7 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype /** * Creates an instance of focus model and returns it. * @param {module:domState} domState - DomState instance - * @return {module:model/focus} - A new instance + * @returns {module:model/focus} - A new instance * @private */ _createFocusModel: function(domState) { @@ -6288,7 +6675,7 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype /** * Creates an instance of seleciton model and returns it. - * @return {module:model/selection} - A new instance + * @returns {module:model/selection} - A new instance * @private */ _createSelectionModel: function() { @@ -6304,14 +6691,15 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype /** * Creates an instance of render model and returns it. * @param {Object} options - Options - * @return {module:model/render} - A new instance + * @returns {module:model/render} - A new instance * @private */ _createRenderModel: function(options) { var attrs, renderOptions, Constructor; attrs = { - emptyMessage: options.emptyMessage + emptyMessage: options.emptyMessage, + showDummyRows: options.showDummyRows }; renderOptions = { columnModel: this.columnModel, @@ -6355,10 +6743,10 @@ var util = require('../common/util'); * View 에서 Rendering 시 사용할 객체 * Smart Rendering 을 지원한다. * @module model/renderer-smart + * @extends module:model/renderer */ var SmartRenderer = Renderer.extend(/**@lends module:model/renderer-smart.prototype */{ /** - * @extends module:model/renderer * @constructs */ initialize: function() { @@ -6390,7 +6778,7 @@ var SmartRenderer = Renderer.extend(/**@lends module:model/renderer-smart.protot var dimensionModel = this.dimensionModel, dataModel = this.dataModel, rowHeight = dimensionModel.get('rowHeight'), - displayRowCount = dimensionModel.getDisplayRowCount(), + displayRowCount = dimensionModel.get('displayRowCount'), startIndex = Math.max(0, Math.ceil(scrollTop / (rowHeight + 1)) - this.hiddenRowCount), endIndex = Math.min(dataModel.length - 1, startIndex + displayRowCount + (this.hiddenRowCount * 2)), top; @@ -6411,7 +6799,7 @@ var SmartRenderer = Renderer.extend(/**@lends module:model/renderer-smart.protot /** * 렌더링을 시작하는 행에 rowSpan 정보가 있으면, count 값이 가장 작은 행의 값을 반환한다. * @param {number} startIndex 시작하는 행의 Index - * @return {number} rowSpan의 count 값 (0 이하) + * @returns {number} rowSpan의 count 값 (0 이하) * @private */ _getStartRowSpanMinCount: function(startIndex) { @@ -6430,7 +6818,7 @@ var SmartRenderer = Renderer.extend(/**@lends module:model/renderer-smart.protot /** * 렌더링할 마지막 행에 rowSpan 정보가 있으면, count 값이 가장 큰 행의 값을 반환한다. * @param {number} endIndex 마지막 행의 Index - * @return {number} rowSpan의 count 값 (0 이상) + * @returns {number} rowSpan의 count 값 (0 이상) * @private */ _getEndRowSpanMaxCount: function(endIndex) { @@ -6448,7 +6836,7 @@ var SmartRenderer = Renderer.extend(/**@lends module:model/renderer-smart.protot /** * scrollTop 값 에 따라 rendering 해야하는지 판단한다. * @param {Number} scrollTop 랜더링 범위를 결정하기 위한 현재 scrollTop 위치 값 - * @return {boolean} 랜더링 해야할지 여부 + * @returns {boolean} 랜더링 해야할지 여부 * @private */ _isRenderable: function(scrollTop) { @@ -6490,15 +6878,18 @@ module.exports = SmartRenderer; var Model = require('../base/model'); var RowList = require('./rowList'); var renderStateMap = require('../common/constMap').renderState; +var util = require('../common/util'); /** * View 에서 Rendering 시 사용할 객체 * @module model/renderer + * @extends module:base/model */ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ /** - * @extends module:base/model * @constructs + * @param {Object} attrs - Attributes + * @param {Object} options - Options */ initialize: function(attrs, options) { var lside, rside, rowListOptions; @@ -6525,12 +6916,16 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ this.listenTo(this.columnModel, 'all', this._onColumnModelChange) .listenTo(this.dataModel, 'add remove sort reset', this._onRowListChange) .listenTo(this.dataModel, 'beforeReset', this._onBeforeResetData) - .listenTo(lside, 'valueChange', this._onValueChange) - .listenTo(rside, 'valueChange', this._onValueChange) + .listenTo(lside, 'valueChange', this._executeRelation) + .listenTo(rside, 'valueChange', this._executeRelation) .listenTo(this.dimensionModel, 'change:width', this._updateMaxScrollLeft) .listenTo(this.dimensionModel, 'change:totalRowHeight change:scrollBarSize change:bodyHeight', this._updateMaxScrollTop); + if (this.get('showDummyRows')) { + this.listenTo(this.dimensionModel, 'change:displayRowCount', this._resetDummyRows) + } + this._updateMaxScrollLeft(); }, @@ -6545,6 +6940,8 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ startNumber: 1, lside: null, rside: null, + showDummyRows: false, + dummyRowCount: 0, // text that will be shown if no data to render (custom value set by user) emptyMessage: null, @@ -6553,15 +6950,6 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ state: renderStateMap.EMPTY }, - /** - * lside 와 rside collection 에서 value 값이 변경되었을 시 executeRelation 을 수행하기 위한 이벤트 핸들러 - * @param {number} rowIndex row 의 index 값 - * @private - */ - _onValueChange: function(rowIndex) { - this.executeRelation(rowIndex); - }, - /** * Event handler for 'chage:width' event on Dimension. * @private @@ -6577,26 +6965,28 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ */ _updateMaxScrollTop: function() { var dimension = this.dimensionModel, - maxScrollTop = dimension.get('totalRowHeight') - dimension.get('bodyHeight') + dimension.get('scrollBarSize'); + maxScrollTop = dimension.get('totalRowHeight') - dimension.get('bodyHeight') + + dimension.get('scrollBarSize'); this.set('maxScrollTop', maxScrollTop); }, /** * Event handler for 'beforeReset' event on dataModel + * @private */ _onBeforeResetData: function() { this.set('state', renderStateMap.LOADING); }, /** - * 내부 변수를 초기화 한다. + * Initializes own properties. + * (called by module:addon/net) */ initializeVariables: function() { this.set({ top: 0, scrollTop: 0, - $scrollTarget: null, scrollLeft: 0, startIndex: 0, endIndex: 0, @@ -6607,7 +6997,7 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ /** * 열고정 영역 또는 열고정이 아닌 영역에 대한 Render Collection 을 반환한다. * @param {String} [whichSide='R'] 어느 영역인지 여부. 'L|R' 중에 하나의 값을 넘긴다. - * @return {Object} collection 해당 영역의 랜더 데이터 콜랙션 + * @returns {Object} collection 해당 영역의 랜더 데이터 콜랙션 */ getCollection: function(whichSide) { return this.get(tui.util.isString(whichSide) ? whichSide.toLowerCase() + 'side' : 'rside'); @@ -6638,6 +7028,16 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ this.timeoutIdForRefresh = setTimeout($.proxy(this.refresh, this, true), 0); }, + /** + * Resets dummy rows and trigger 'rowListChanged' event. + * @private + */ + _resetDummyRows: function() { + this._clearDummyRows(); + this._fillDummyRows(); + this.trigger('rowListChanged'); + }, + /** * rendering 할 index 범위를 결정한다. * Smart rendering 을 사용하지 않을 경우 전체 범위로 랜더링한다. @@ -6651,79 +7051,140 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ }, /** - * rendering 할 데이터를 생성한다. - * @param {boolean} isDataModelChanged - The boolean value whether dataModel has changed + * Returns the new data object for rendering based on rowDataModel and specified column names. + * @param {Object} rowDataModel - Instance of module:model/data/row + * @param {Array.} columnNames - Column names + * @param {Number} rowNum - Row number + * @returns {Object} - view data object + * @private */ - refresh: function(isDataModelChanged) { - this._setRenderingRange(this.get('scrollTop')); - - //TODO : rendering 해야할 데이터만 가져온다. - //TODO : eslint 에러 수정 - var columnFixCount = this.columnModel.getVisibleColumnFixCount(true), // eslint-disable-line - columnList = this.columnModel.getVisibleColumnModelList(null, true), - columnNameList = _.pluck(columnList, 'columnName'), - - lsideColumnList = columnNameList.slice(0, columnFixCount), - rsideColumnList = columnNameList.slice(columnFixCount), + _createViewDataFromDataModel: function(rowDataModel, columnNames, rowNum) { + var viewData = { + rowKey: rowDataModel.get('rowKey'), + _extraData: rowDataModel.get('_extraData') + }; - lsideRowList = [], - rsideRowList = [], - lsideRow = [], - rsideRow = [], - startIndex = this.get('startIndex'), - endIndex = this.get('endIndex'), - num = this.get('startNumber') + startIndex, - len, - i, - rowModel, - rowKey; - - for (i = startIndex; i < endIndex + 1; i += 1) { - rowModel = this.dataModel.at(i); - if (rowModel) { - rowKey = rowModel.get('rowKey'); + _.each(columnNames, function(columnName) { + var value = rowDataModel.get(columnName); + if (columnName === '_number') { + value = rowNum; + } + viewData[columnName] = value; + }); - //데이터 초기화 - lsideRow = { - '_extraData': rowModel.get('_extraData'), - 'rowKey': rowKey - }; - rsideRow = { - '_extraData': rowModel.get('_extraData'), - 'rowKey': rowKey - }; + return viewData; + }, - //lside 데이터 먼저 채운다. - _.each(lsideColumnList, function (columnName) { // eslint-disable-line - if (columnName === '_number') { - lsideRow[columnName] = num++; // eslint-disable-line - } else { - lsideRow[columnName] = rowModel.get(columnName); - } - }); + /** + * Returns the object that contains two array of column names splitted by columnFixCount. + * @returns {{lside: Array, rside: Array}} - Column names map + * @private + */ + _getColumnNamesOfEachSide: function() { + var columnFixCount = this.columnModel.getVisibleColumnFixCount(true), + columnModels = this.columnModel.getVisibleColumnModelList(null, true), + columnNames = _.pluck(columnModels, 'columnName'); - _.each(rsideColumnList, function (columnName) { // eslint-disable-line - if (columnName === '_number') { - rsideRow[columnName] = num++; // eslint-disable-line - } else { - rsideRow[columnName] = rowModel.get(columnName); - } - }); - lsideRowList.push(lsideRow); - rsideRowList.push(rsideRow); - } + return { + lside: columnNames.slice(0, columnFixCount), + rside: columnNames.slice(columnFixCount) } + }, - this.get('lside').clear().reset(lsideRowList, { - parse: true - }); - this.get('rside').clear().reset(rsideRowList, { + /** + * Resets specified view model list. + * @param {String} attrName - 'lside' or 'rside' + * @param {Object} viewData - Converted data for rendering view + * @private + */ + _resetViewModelList: function(attrName, viewData) { + this.get(attrName).clear().reset(viewData, { parse: true }); + }, - len = rsideRowList.length + startIndex; - for (i = startIndex; i < len; i += 1) { - this.executeRelation(i); + /** + * Resets both sides(lside, rside) of view model list with given range of data model list. + * @param {Number} startIndex - Start index + * @param {Number} endIndex - End index + * @private + */ + _resetAllViewModelListWithRange: function(startIndex, endIndex) { + var columnNamesMap = this._getColumnNamesOfEachSide(), + rowNum = this.get('startNumber') + startIndex, + lsideData = [], + rsideData = [], + rowDataModel, i, len; + + for (i = startIndex; i <= endIndex; i += 1) { + rowDataModel = this.dataModel.at(i); + lsideData.push(this._createViewDataFromDataModel(rowDataModel, columnNamesMap.lside, rowNum)); + rsideData.push(this._createViewDataFromDataModel(rowDataModel, columnNamesMap.rside)); + rowNum += 1; + } + + this._resetViewModelList('lside', lsideData); + this._resetViewModelList('rside', rsideData); + }, + + /** + * Returns the count of rows (except dummy rows) in view model list + * @returns {Number} Count of rows + * @private + */ + _getActualRowCount: function() { + return this.get('endIndex') - this.get('startIndex') + 1; + }, + + /** + * Removes all dummy rows in the view model list. + * @private + */ + _clearDummyRows: function() { + var dataRowCount = this.get('endIndex') - this.get('startIndex') + 1; + + _.each(['lside', 'rside'], function(attrName) { + var rowList = this.get(attrName); + while (rowList.length > dataRowCount) { + rowList.pop(); + } + }, this); + }, + + /** + * fills the empty area with dummy rows. + * @private + */ + _fillDummyRows: function() { + var displayRowCount = this.dimensionModel.get('displayRowCount'), + actualRowCount = this._getActualRowCount(), + dummyRowCount = Math.max(displayRowCount - actualRowCount, 0); + + _.times(dummyRowCount, function() { + this.get('lside').add({}); + this.get('rside').add({}); + }, this); + this.set('dummyRowCount', dummyRowCount); + }, + + /** + * Refreshes the rendering range and the list of view models, and triggers events. + * @param {Boolean} isDataModelChanged - The boolean value whether dataModel has changed + */ + refresh: function(isDataModelChanged) { + var startIndex, endIndex, i; + + this._setRenderingRange(this.get('scrollTop')); + startIndex = this.get('startIndex'); + endIndex = this.get('endIndex'); + + this._resetAllViewModelListWithRange(startIndex, endIndex); + if (this.get('showDummyRows')) { + this._fillDummyRows(); + } + + for (i = startIndex; i <= endIndex; i += 1) { + this._executeRelation(i); } if (this.isColumnModelChanged) { @@ -6738,6 +7199,7 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ /** * Set state value based on the DataModel.length + * @private */ _refreshState: function() { if (this.dataModel.length) { @@ -6750,7 +7212,7 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ /** * columnName 으로 lside 와 rside rendering collection 중 하나를 반환한다. * @param {String} columnName 컬럼명 - * @return {Collection} 컬럼명에 해당하는 영역의 콜랙션 + * @returns {Collection} 컬럼명에 해당하는 영역의 콜랙션 * @private */ _getCollectionByColumnName: function(columnName) { @@ -6769,7 +7231,7 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * 셀 데이터를 반환한다. * @param {number} rowKey 데이터의 키값 * @param {String} columnName 컬럼명 - * @return {object} cellData 셀 데이터 + * @returns {object} cellData 셀 데이터 * @example => { @@ -6795,13 +7257,15 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ }, /** - * rowIndex 에 해당하는 relation 을 수행한다. - * @param {Number} rowIndex row 의 index 값 + * Executes the relation of the row identified by rowIndex + * @param {Number} rowIndex - Row index + * @private */ - executeRelation: function(rowIndex) { + _executeRelation: function(rowIndex) { var row = this.dataModel.at(rowIndex), renderIdx = rowIndex - this.get('startIndex'), rowModel, relationResult; + relationResult = row.getRelationResult(); _.each(relationResult, function(changes, columnName) { @@ -6823,9 +7287,9 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ module.exports = Renderer; -},{"../base/model":5,"../common/constMap":8,"./rowList":23}],22:[function(require,module,exports){ +},{"../base/model":5,"../common/constMap":8,"../common/util":10,"./rowList":23}],22:[function(require,module,exports){ /** - * @fileoverview RowList 클래스파일 + * @fileoverview Row Model for Rendering (View Model) * @author NHN Ent. FE Development Team */ 'use strict'; @@ -6836,31 +7300,33 @@ var util = require('../common/util'); /** * Row Model * @module model/row + * @extends module:base/model */ var Row = Model.extend(/**@lends module:model/row.prototype */{ /** * @constructs - * @extends module:base/model * @param {object} attributes - Attributes * @param {object} options - Options */ - initialize: function(attributes, options) { // eslint-disable-line no-unused-vars - var rowKey, rowData; - - rowKey = attributes && attributes['rowKey']; - rowData = this.collection.dataModel.get(rowKey); + initialize: function(attributes, options) { + var rowKey = attributes && attributes['rowKey'], + rowListData = this.collection.dataModel, + rowData = rowListData.get(rowKey); if (rowData) { this.listenTo(rowData, 'change restore', this._onDataModelChange); this.listenTo(rowData, 'extraDataChanged', this._setRowExtraData); + this.listenTo(rowListData, 'disabledChanged', this._onDataModelDisabledChanged); + + this.rowData = rowData; } }, idAttribute: 'rowKey', /** - * dataModel 이 변경시 model 데이터를 함께 업데이트 하는 핸들러 - * @param {Object} model 변경이 발생한 row 모델 + * Event handler for 'change restore' event on rowData model + * @param {Object} model - RowData model on which event occurred * @private */ _onDataModelChange: function(model) { @@ -6872,29 +7338,68 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ }, /** - * extra data 를 토대로 rowSpanned 된 render model 의 정보를 업데이트 한다. + * Returns an array of visible column names. + * @returns {Array.} Visible column names + * @private + */ + _getColumnNameList: function() { + var columnModels = this.collection.columnModel.getVisibleColumnModelList(null, true); + + return _.pluck(columnModels, 'columnName'); + }, + + /** + * Returns whether the state of specified column is disabled. + * @param {String} columnName - Column name + * @param {{isDisabledCheck: Boolean, isDisabled: Boolean, isChecked: Boolean}} rowState - Row state + * @returns {Boolean} - True if disabled + * @private + */ + _isDisabled: function(columnName, rowState) { + var isDisabled = this.collection.dataModel.isDisabled; + + if (!isDisabled) { + isDisabled = (columnName === '_button') ? rowState.isDisabledCheck : rowState.isDisabled; + } + return isDisabled; + }, + + /** + * Event handler for 'disabledChanged' event on dataModel + */ + _onDataModelDisabledChanged: function() { + var columnNames = this._getColumnNameList(), + rowState = this.rowData.getRowState(); + + _.each(columnNames, function(columnName) { + this.setCell(columnName, { + isDisabled: this._isDisabled(columnName, rowState) + }); + }, this); + }, + + /** + * Sets the 'isDisabled', 'isEditable', 'className' property of each cell data. * @private */ _setRowExtraData: function() { var dataModel = this.collection.dataModel, - row = dataModel.get(this.get('rowKey')), - columnModelList = this.collection.columnModel.getVisibleColumnModelList(null, true), - rowState = row.getRowState(), + columnNames = this._getColumnNameList(), + rowState = this.rowData.getRowState(), param; if (tui.util.isUndefined(this.collection)) { return; } - _.each(columnModelList, function(columnModel) { - var columnName = columnModel['columnName'], - cellData = this.get(columnName), + _.each(columnNames, function(columnName) { + var cellData = this.get(columnName), rowModel = this, isEditable, isDisabled; if (!tui.util.isUndefined(cellData)) { - isEditable = row.isEditable(columnName); - isDisabled = (columnName === '_button') ? rowState.isDisabledCheck : rowState.isDisabled; + isEditable = this.rowData.isEditable(columnName); + isDisabled = this._isDisabled(columnName, rowState); if (dataModel.isRowSpanEnable() && !cellData['isMainRow']) { rowModel = this.collection.get(cellData['mainRowKey']); } @@ -6902,7 +7407,7 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ param = { isDisabled: isDisabled, isEditable: isEditable, - className: row.getClassNameList(columnName).join(' ') + className: this.rowData.getClassNameList(columnName).join(' ') }; rowModel.setCell(columnName, param); } @@ -6911,29 +7416,36 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ }, /** - * Backbone 이 collection 생성 시 내부적으로 parse 를 호출하여 데이터를 형식에 맞게 가공한다. - * @param {Array} data 원본 데이터 - * @return {Array} 형식에 맞게 가공된 데이터 + * Overrides Backbone.Model.parse + * (this method is called before initialize method) + * @param {Array} data - Original data + * @param {Object} options - Options + * @returns {Array} - Converted data. + * @override */ parse: function(data, options) { return this._formatData(data, options.collection.dataModel); }, /** - * 데이터를 View 에서 사용할 수 있도록 가공한다. - * @param {Array} data 원본 데이터 - * @return {Array} 가공된 데이터 + * Convert the original data to rendering data. + * @param {Array} data - Original data + * @param {module:model/data/rowList} dataModel - Data model + * @returns {Array} - Converted data * @private */ _formatData: function(data, dataModel) { - var rowKey = data['rowKey'], - row = dataModel.get(rowKey), - rowState = row.getRowState(), - isDisabled = rowState.isDisabled; + var rowKey = data.rowKey, + row, rowState; + + if (_.isUndefined(rowKey)) { + return data; + } + row = dataModel.get(rowKey), + rowState = row.getRowState(); _.each(data, function(value, columnName) { - var rowSpanData, - isEditable = row.isEditable(columnName); + var rowSpanData; if (columnName !== 'rowKey' && columnName !== '_extraData') { if (dataModel.isRowSpanEnable() && @@ -6947,23 +7459,18 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ isMainRow: true }; } - isDisabled = (columnName === '_button') ? rowState.isDisabledCheck : isDisabled; - data[columnName] = { rowKey: rowKey, columnName: columnName, value: value, - //Rendering properties rowSpan: rowSpanData.count, isMainRow: rowSpanData.isMainRow, mainRowKey: rowSpanData.mainRowKey, - //Change attribute properties - isEditable: isEditable, - isDisabled: isDisabled, - optionList: [], + isEditable: row.isEditable(columnName), + isDisabled: this._isDisabled(columnName, rowState), className: row.getClassNameList(columnName).join(' '), - - changed: [] //변경된 프로퍼티 목록들 + optionList: [], // for list type column (select, checkbox, radio) + changed: [] //changed property names }; } }, this); @@ -6971,10 +7478,11 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ }, /** - * Cell 의 값을 변경한다. - * - 참조형 데이터 타입이기 때문에 change 이벤트 발생을 위해 이 method 를 사용하여 값 변경을 수행한다. - * @param {String} columnName 컬럼명 - * @param {{key: value}} param key:value 로 이루어진 셀에서 변경할 프로퍼티 목록 + * Sets the cell data. + * (Each cell data is reference type, so do not change the cell data directly and + * use this method to trigger change event) + * @param {String} columnName - Column name + * @param {Object} param - Key-Value pair of the data to change */ setCell: function(columnName, param) { var isValueChanged = false, @@ -7023,17 +7531,19 @@ var Row = require('./row'); /** * View Model rowList collection * @module model/rowList + * @extends module:base/collection */ var RowList = Collection.extend(/**@lends module:model/rowList.prototype */{ model: Row, /** * @constructs - * @extends module:base/collection + * @param {Object} rawData - Raw data + * @param {Object} options - Options */ initialize: function(rawData, options) { this.setOwnProperties({ dataModel: options.dataModel, - columnModel: options.columnModel + columnModel: options.columnModel }); } }); @@ -7055,21 +7565,24 @@ var Model = require('../base/model'), * @const * @type {{cell: string, row: string, column: string}} * @desc - * Selection states + * Selection states */ var SELECTION_STATE = { cell: 'cell', row: 'row', column: 'column' }; + /** - * Selection Model class - * @module model/selection + * Selection Model class + * @module model/selection + * @extends module:base/view */ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * @constructs - * @extends module:base/view + * @param {Object} attr - Attributes + * @param {Object} options - Options */ initialize: function(attr, options) { Model.prototype.initialize.apply(this, arguments); @@ -7143,7 +7656,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * Returns whether the selection is enabled. - * @return {boolean} True if the selection is enabled. + * @returns {boolean} True if the selection is enabled. */ isEnabled: function() { return this._isEnabled; @@ -7296,6 +7809,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * Select all data in a row + * @param {Number} rowIndex - Row idnex */ selectRow: function(rowIndex) { if (this._isEnabled) { @@ -7307,6 +7821,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * Select all data in a column + * @param {Number} columnIdx - Column index */ selectColumn: function(columnIdx) { if (this._isEnabled) { @@ -7328,7 +7843,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * Returns the row and column indexes of the starting position. - * @return {{row: number, column: number}} Objects containing indexes + * @returns {{row: number, column: number}} Objects containing indexes */ getStartIndex: function() { var range = this.get('range'); @@ -7340,7 +7855,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * Returns the row and column indexes of the ending position. - * @return {{row: number, column: number}} Objects containing indexes + * @returns {{row: number, column: number}} Objects containing indexes */ getEndIndex: function() { var range = this.get('range'); @@ -7352,19 +7867,34 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * selection 데이터가 존재하는지 확인한다. - * @return {boolean} selection 데이터 존재여부 + * @returns {boolean} selection 데이터 존재여부 */ hasSelection: function() { return !!this.get('range'); }, + /** + * Returns whether given range is a single cell. (include merged cell) + * @param {Array.} columnNameList - columnNameList + * @param {Array.} rowList - rowList + * @returns {Boolean} + */ + _isSingleCell: function(columnNameList, rowList) { + var isSingleColumn = columnNameList.length === 1, + isSingleRow = rowList.length === 1, + isSingleMergedCell = isSingleColumn && !isSingleRow && + (rowList[0].getRowSpanData(columnNameList[0]).count === rowList.length); + + return (isSingleColumn && isSingleRow) || isSingleMergedCell; + }, + /** * Returns the string value of all cells in the selection range as a single string. - * @return {String} string of values + * @returns {String} string of values */ getValuesToString: function() { var range = this.get('range'), - columnModelList, rowList, columnNameList, rowValues; + columnModelList, rowList, columnNameList, rowValues, result; columnModelList = this.columnModel.getVisibleColumnModelList().slice(range.column[0], range.column[1] + 1); rowList = this.dataModel.slice(range.row[0], range.row[1] + 1); @@ -7377,6 +7907,9 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ return tmpString.join('\t'); }); + if (this._isSingleCell(columnNameList, rowList)) { + return rowValues[0]; + } return rowValues.join('\n'); }, @@ -7384,7 +7917,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * 마우스 드래그로 selection 선택 시 auto scroll 조건에 해당하는지 반환한다. * @param {Number} overflowX 가로축 기준 영역 overflow 값 * @param {Number} overflowY 세로축 기준 영역 overflow 값 - * @return {boolean} overflow 되었는지 여부 + * @returns {boolean} overflow 되었는지 여부 * @private */ _isAutoScrollable: function(overflowX, overflowY) { @@ -7448,7 +7981,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ /** * Expands the 'this.inputRange' if rowspan data exists, and resets the 'range' attributes to the value. - * @param {{column: number[], row: number[]}} [inputRange = this.inputRange] - Input range + * @param {{column: number[], row: number[]}} [inputRange] - Input range. Default is this.inputRange * @private */ _resetRangeAttribute: function(inputRange) { @@ -7647,11 +8180,11 @@ var Model = require('../base/model'), /** * Toolbar Model * @module model/toolbar + * @extends module:base/model */ var Toolbar = Model.extend(/**@lends module:model/toolbar.prototype */{ /** * @constructs - * @extends module:base/model * @param {object} options - Options */ initialize: function(options) { @@ -7674,7 +8207,7 @@ var Toolbar = Model.extend(/**@lends module:model/toolbar.prototype */{ /** * Returns whether the toolbar is visible - * @return {Boolean} True if the toolbar is visible + * @returns {Boolean} True if the toolbar is visible */ isVisible: function() { return this.get('hasControlPanel') || this.get('hasPagination') || this.get('hasResizeHandler'); @@ -7697,11 +8230,11 @@ var keyNameMap = require('../common/constMap').keyName; /** * Cell Painter Base * @module painter/cell + * @extends module:base/painter */ var Cell = tui.util.defineClass(Painter, /**@lends module:painter/cell.prototype */{ /** * @constructs - * @extends module:base/painter */ init: function() { Painter.apply(this, arguments); @@ -7719,7 +8252,7 @@ var Cell = tui.util.defineClass(Painter, /**@lends module:painter/cell.prototype * Markup template * If use '<%=class%>' key word, an error occurs. * So use '<%=className%>' instead of '<%=class%>' - * @return {string} template + * @returns {string} template */ template: _.template( ' 안에 들아갈 html string 을 반환한다. * redrawAttributes 에 해당하는 프로퍼티가 변경되었을 때 수행될 로직을 구현한다. * @param {object} cellData 모델의 셀 데이터 - * @return {string} html 마크업 문자열 + * @returns {string} html 마크업 문자열 * @example * var html = this.getContentHtml(); * @@ -8325,7 +8868,7 @@ var ButtonCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/but /** * 다음 input 에 focus 한다 * @param {jQuery} $currentInput 현재 input jQuery 엘리먼트 - * @return {boolean} 다음 엘리먼트에 focus 되었는지 여부 + * @returns {boolean} 다음 엘리먼트에 focus 되었는지 여부 * @private */ _focusNextInput: function($currentInput) { @@ -8335,7 +8878,7 @@ var ButtonCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/but /** * 이전 input 에 focus 한다. * @param {jQuery} $currentInput 현재 input jQuery 엘리먼트 - * @return {boolean} 다음 엘리먼트에 focus 되었는지 여부 + * @returns {boolean} 다음 엘리먼트에 focus 되었는지 여부 * @private */ _focusPrevInput: function($currentInput) { @@ -8346,7 +8889,7 @@ var ButtonCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/but * 이전 혹은 다음 input 에 focus 한다. * @param {jQuery} $currentInput 현재 input jQuery 엘리먼트 * @param {string} direction 방향 'next|prev' - * @return {boolean} 해당 엘리먼트에 focus 되었는지 여부 + * @returns {boolean} 해당 엘리먼트에 focus 되었는지 여부 * @private */ _focusTargetInput: function($currentInput, direction) { @@ -8378,7 +8921,7 @@ var ButtonCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/but /** * check 된 button 의 값들을 가져온다. onChange 이벤트 핸들러에서 호출한다. * @param {jQuery} $target 이벤트가 발생한 targetElement - * @return {Array} check 된 값들의 결과 배열 + * @returns {Array} check 된 값들의 결과 배열 * @private */ _getCheckedValueList: function($target) { @@ -8400,7 +8943,18 @@ var ButtonCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/but _onChange: function(changeEvent) { var $target = $(changeEvent.target), cellAddress = this._getCellAddress($target); - this.grid.dataModel.setValue(cellAddress.rowKey, cellAddress.columnName, this._getCheckedValueList($target).join(',')); + this.grid.dataModel.setValue(cellAddress.rowKey, cellAddress.columnName, + this._getCheckedValueList($target).join(',')); + }, + + /** + * Event handler for 'blur' event on input element + * @param {Event} ev - Blur event + * @private + */ + _onBlur: function(ev) { + var cellAddr = this._getCellAddress($(ev.target)); + this._validateData(cellAddr.rowKey, cellAddr.columnName); } }); @@ -8418,11 +8972,11 @@ var Cell = require('../cell'); /** * editOption 에 list 를 가지고 있는 형태의 Base 클래스 * @module painter/cell/list + * @extends module:painter/cell */ var ListCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/list.prototype */{ /** * @constructs - * @extends module:painter/cell */ init: function() { Cell.apply(this, arguments); @@ -8435,7 +8989,7 @@ var ListCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/list.prot /* eslint-disable */ /** * 자기 자신의 인스턴스의 editType 을 반환한다. - * @return {String} editType 'normal|button|select|button|text|text-password|text-convertible' + * @returns {String} editType 'normal|button|select|button|text|text-password|text-convertible' */ getEditType: function() {}, @@ -8449,7 +9003,7 @@ var ListCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/list.prot * Cell data 를 인자로 받아 안에 들아갈 html string 을 반환한다. * redrawAttributes 에 해당하는 프로퍼티가 변경되었을 때 수행될 로직을 구현한다. * @param {object} cellData 모델의 셀 데이터 - * @return {string} html 마크업 문자열 + * @returns {string} html 마크업 문자열 * @example * var html = this.getContentHtml(); * @@ -8614,7 +9168,7 @@ var MainButtonCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/mai /** * getHtml 으로 마크업 생성시 td에 포함될 attribute object 를 반환한다. - * @return {Object} td 에 지정할 attribute 데이터 + * @returns {Object} td 에 지정할 attribute 데이터 */ getAttributes: function() { return { @@ -8660,11 +9214,11 @@ var Cell = require('../cell'); /** * editOption 이 적용되지 않은 cell 의 Painter * @module painter/cell/normal + * @extends module:painter/cell */ var NormalCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/normal.prototype */{ /** * @constructs - * @extends module:painter/cell */ init: function() { Cell.apply(this, arguments); @@ -8672,7 +9226,7 @@ var NormalCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/normal. /** * 자기 자신의 인스턴스의 editType 을 반환한다. - * @return {string} editType 'normal|select|button|text|text-convertible' + * @returns {string} editType 'normal|select|button|text|text-convertible' */ getEditType: function() { return 'normal'; @@ -8682,7 +9236,7 @@ var NormalCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/normal. * Cell data 를 인자로 받아 안에 들아갈 html string 을 반환한다. * redrawAttributes 에 해당하는 프로퍼티가 변경되었을 때 수행될 로직을 구현한다. * @param {object} cellData 모델의 셀 데이터 - * @return {string} html 마크업 문자열 + * @returns {string} html 마크업 문자열 * @example * var html = this.getContentHtml(); * @@ -8790,11 +9344,11 @@ var util = require('../../common/util'); /** * Painter class for the select cell * @module painter/cell/select + * @extends module:painter/cell/list */ var SelectCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/select.prototype */{ /** * @constructs - * @extends module:painter/cell/list */ init: function() { ListCell.apply(this, arguments); @@ -8811,12 +9365,13 @@ var SelectCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/sel eventHandler: { 'change select': '_onChange', - 'keydown select': '_onKeyDown' + 'keydown select': '_onKeyDown', + 'blur select': '_onBlurSelect' }, /** * Content markup template - * @return {string} html + * @returns {string} html */ contentTemplate: _.template( '' ), + /** + * Event handler for 'blur' event on select element + * @param {Event} ev - Event object + */ + _onBlurSelect: function(ev) { + var cellAddr = this._getCellAddress($(ev.target)); + this._validateData(cellAddr.rowKey, cellAddr.columnName); + }, + /** * 자기 자신의 인스턴스의 editType 을 반환한다. - * @return {String} editType 'normal|button|select|button|text|text-password|text-convertible' + * @returns {String} editType 'normal|button|select|button|text|text-password|text-convertible' */ getEditType: function() { return 'select'; @@ -8867,7 +9432,7 @@ var SelectCell = tui.util.defineClass(ListCell,/**@lends module:painter/cell/sel * Cell data 를 인자로 받아 안에 들아갈 html string 을 반환한다. * redrawAttributes 에 해당하는 프로퍼티가 변경되었을 때 수행될 로직을 구현한다. * @param {object} cellData 모델의 셀 데이터 - * @return {string} html 마크업 문자열 + * @returns {string} html 마크업 문자열 * @example * var html = this.getContentHtml(); * @@ -9107,7 +9672,7 @@ var ConvertibleCell = tui.util.defineClass(TextCell,/**@lends module:painter/cel * 컬럼모델의 defaultValue, beforeText, afterText 를 적용한 content html 마크업 스트링 을 반환한다. * (상태에 따라 Text나 Base의 함수를 선택해서 사용해야 하기 때문에, 추가로 override 해서 prototype을 이용해 실행) * @param {object} cellData Model의 셀 데이터 - * @return {string} 컬럼모델의 defaultValue, beforeText, afterText 를 적용한 content html 마크업 스트링 + * @returns {string} 컬럼모델의 defaultValue, beforeText, afterText 를 적용한 content html 마크업 스트링 * @private * @override */ @@ -9126,12 +9691,13 @@ var ConvertibleCell = tui.util.defineClass(TextCell,/**@lends module:painter/cel /** * 현재 편집중인 셀인지 여부를 반환한다. * @param {object} cellData Model의 셀 데이터 - * @return {boolean} - 편집중이면 true, 아니면 false + * @returns {boolean} - 편집중이면 true, 아니면 false * @private */ _isEditingCell: function(cellData) { var editingCell = this.editingCell; - return !!(editingCell.rowKey === cellData.rowKey.toString() && editingCell.columnName === cellData.columnName.toString()); + return (editingCell.rowKey === cellData.rowKey.toString() && + editingCell.columnName === cellData.columnName.toString()); }, /** @@ -9155,6 +9721,7 @@ var ConvertibleCell = tui.util.defineClass(TextCell,/**@lends module:painter/cel this._onBlur(blurEvent); this._endEdit($td); + this._validateData(this.getRowKey($td), this.getColumnName($td)); _.defer(function() { focusModel.refreshState(); @@ -9167,15 +9734,16 @@ var ConvertibleCell = tui.util.defineClass(TextCell,/**@lends module:painter/cel * @private */ _startEdit: function($td) { - var $input, rowKey, columnName, cellState; + var dataModel = this.grid.dataModel, + $input, rowKey, columnName, cellState; this._blurEditingCell(); rowKey = this.getRowKey($td); columnName = this.getColumnName($td); - cellState = this.grid.dataModel.get(rowKey).getCellState(columnName); + cellState = dataModel.get(rowKey).getCellState(columnName); - if (cellState.isEditable && !cellState.isDisabled) { + if (cellState.isEditable && !dataModel.isDisabled && !cellState.isDisabled) { this.editingCell = { rowKey: rowKey, columnName: columnName @@ -9267,11 +9835,11 @@ var TextCell = require('./text'); /** * Password 타입의 cell renderer * @module painter/cell/text-password + * @extends module:painter/cell/text */ var PasswordCell = tui.util.defineClass(TextCell,/**@lends module:painter/cell/text-password.prototype */{ /** * @construct - * @extends module:painter/cell/text * @param {object} attributes Attributes * @param {object} options Options */ @@ -9281,7 +9849,7 @@ var PasswordCell = tui.util.defineClass(TextCell,/**@lends module:painter/cell/t /** * input type 을 반환한다. - * @return {string} input 타입 + * @returns {string} input 타입 * @private */ _getInputType: function() { @@ -9290,7 +9858,7 @@ var PasswordCell = tui.util.defineClass(TextCell,/**@lends module:painter/cell/t /** * 자기 자신의 인스턴스의 editType 을 반환한다. - * @return {String} editType 'normal|button|select|button|text|text-password|text-convertible' + * @returns {String} editType 'normal|button|select|button|text|text-password|text-convertible' */ getEditType: function() { return 'text-password'; @@ -9313,11 +9881,11 @@ var formUtil = require('../../common/formUtil'); /** * Painter class for the text cell * @module painter/cell/text + * @extends module:painter/cell */ var TextCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/text.prototype */{ /** * @constructs - * @extends module:painter/cell * @param {object} attributes Attributes * @param {object} options Options */ @@ -9353,7 +9921,7 @@ var TextCell = tui.util.defineClass(Cell,/**@lends module:painter/cell/text.prot /** * Content markup template - * @return {string} html + * @returns {string} html */ contentTemplate: _.template( ' 안에 들아갈 html string 을 반환한다. * redrawAttributes 에 해당하는 프로퍼티가 변경되었을 때 수행될 로직을 구현한다. * @param {object} cellData 모델의 셀 데이터 - * @return {string} html 마크업 문자열 + * @returns {string} html 마크업 문자열 * @example * var html = this.getContentHtml(); * ':"radio"===e?i.title="선택":i.isHidden=!0,this._extendColumnList(i,t)},_extendColumnList:function(t,e){var i=t.columnName,n=_.findIndex(e,{columnName:i});-1===n?e.push(t):e[n]=$.extend(e[n],t)},at:function(t,e){var i=e?this.getVisibleColumnModelList():this.get("dataColumnModelList");return i[t]},indexOfColumnName:function(t,e){var i;return i=e?this.getVisibleColumnModelList():this.get("dataColumnModelList"),_.findIndex(i,{columnName:t})},isLside:function(t){var e=this.indexOfColumnName(t,!0);return e>-1&&e=e?!1:void(t.isHidden&&(i-=1))}),t?i+this.getVisibleMetaColumnCount():i},getColumnModel:function(t){return this.get("columnModelMap")[t]},isTextType:function(t){return!!this.textType[this.getEditType(t)]},getEditType:function(t){var e=this.getColumnModel(t),i="normal";return"_button"===t||"_number"===t?i=t:e&&e.editOption&&e.editOption.type&&(i=e.editOption.type),i},_makeVisibleColumnModelList:function(t,e){return t=t||this.get("metaColumnModelList"),e=e||this.get("dataColumnModelList"),_.filter(t.concat(e),function(t){return!t.isHidden})},_getRelationListMap:function(t){var e,i={};return _.each(t,function(t){e=t.columnName,t.relationList&&(i[e]=t.relationList)}),i},getIgnoredColumnNameList:function(){var t=this.get("dataColumnModelList"),e=[];return _.each(t,function(t){t.isIgnore&&e.push(t.columnName)}),e},_setColumnModelList:function(t,e){var i,n,o,s,a;t=$.extend(!0,[],t),tui.util.isUndefined(e)&&(e=this.get("columnFixCount")),i=_.partition(t,function(t){return this.isMetaColumn(t.columnName)},this),s=this._initializeMetaColumns(i[0]),a=i[1],n=this._getRelationListMap(a),o=this._makeVisibleColumnModelList(s,a),this.set({metaColumnModelList:s,dataColumnModelList:a,columnModelMap:_.indexBy(s.concat(a),"columnName"),relationListMap:n,columnFixCount:Math.max(0,e),visibleList:o},{silent:!0}),this.unset("columnModelList",{silent:!0}),this.trigger("columnModelChange")},_onChange:function(t){var e=t.changed,i=e.columnFixCount,n=e.columnModelList;n||(n=this.get("dataColumnModelList")),this._setColumnModelList(n,i)},setHidden:function(t,e){for(var i,n,o,s;t.length;)i=t.shift(),o=this.getColumnModel(i),o?o.isHidden=e:(n=this.getUnitColumnNamesIfMerged(i),t.push.apply(t,n));s=this._makeVisibleColumnModelList(this.get("metaColumnModelList"),this.get("dataColumnModelList")),this.set("visibleList",s,{silent:!0}),this.trigger("columnModelChange")},getUnitColumnNamesIfMerged:function(t){var e,i,n,o=this.get("columnMerge"),s=[],a=[];for(s.push(t);s.length;)e=s.shift(),i=this.getColumnModel(e),i?a.push(e):(n=_.findWhere(o,{columnName:e}),n&&s.push.apply(s,n.columnNameList));return _.uniq(a)},isMetaColumn:function(t){return _.indexOf(o,t)>=0}});e.exports=s},{"../../base/model":5}],14:[function(t,e,i){"use strict";var n=(t("../../base/model"),t("../../common/util"),tui.util.defineClass({init:function(t){this.data=t},getRowSpanData:function(t,e,i){var n=null;return i&&(n=this.data.rowSpanData,t&&n&&(n=n[t])),!n&&t&&(n={count:0,isMainRow:!0,mainRowKey:e}),n},getRowState:function(){var t={isDisabledCheck:!1,isDisabled:!1,isChecked:!1};switch(this.data.rowState){case"DISABLED":t.isDisabled=!0;case"DISABLED_CHECK":t.isDisabledCheck=!0;break;case"CHECKED":t.isChecked=!0}return t},setRowState:function(t){this.data.rowState=t},setRowSpanData:function(t,e){var i=_.assign({},this.data.rowSpanData);t&&(e?i[t]=e:i[t]&&delete i[t],this.data.rowSpanData=i)},addCellClassName:function(t,e){var i,n;i=this.data.className||{},i.column=i.column||{},n=i.column[t]||[],_.contains(n,e)||(n.push(e),i.column[t]=n,this.data.className=i)},addClassName:function(t){var e,i;e=this.data.className||{},i=e.row||[],-1===tui.util.inArray(t,i)&&(i.push(t),e.row=i,this.data.className=e)},getClassNameList:function(t){var e=this.data.className,i=Array.prototype.push,n=[];return e&&(e.row&&i.apply(n,e.row),t&&e.column&&e.column[t]&&i.apply(n,e.column[t])),n},_removeClassNameFromArray:function(t,e){var i=t.join(" ").split(" ");return _.without(i,e)},removeCellClassName:function(t,e){var i=this.data.className;tui.util.pick(i,"column",t)&&(i.column[t]=this._removeClassNameFromArray(i.column[t],e),this.data.className=i)},removeClassName:function(t){var e=this.data.className;e&&e.row&&(e.row=this._removeClassNameFromArray(e.row,t),this.className=e)}}));e.exports=n},{"../../base/model":5,"../../common/util":10}],15:[function(t,e,i){"use strict";var n=t("../../base/model"),o=t("./extraDataManager"),s=t("../../common/util"),a=["_button","_number","_extraData"],l=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.extraDataManager=new o(this.get("_extraData")),this.columnModel=this.collection.columnModel,this.on("change",this._onChange,this)},idAttribute:"rowKey",parse:function(t){return t._extraData||(t._extraData={}),t},_triggerExtraDataChangeEvent:function(){this.trigger("extraDataChanged",this.get("_extraData"))},_onChange:function(){var t=_.omit(this.changed,a);this.isDuplicatedPublicChanged(t)||_.each(t,function(t,e){var i=this.columnModel.getColumnModel(e);i&&this._executeChangeBeforeCallback(e)&&(this.collection.syncRowSpannedData(this,e,t),this._executeChangeAfterCallback(e),this.getRowState().isDisabledCheck||i.isIgnore||this.set("_button",!0))},this)},_createChangeCallbackEvent:function(t){return{rowKey:this.get("rowKey"),columnName:t,value:this.get(t),instance:tui.Grid.getInstanceById(this.collection.gridId)}},_executeChangeBeforeCallback:function(t){var e,i,n=this.columnModel.getColumnModel(t);return n.editOption&&n.editOption.changeBeforeCallback&&(e=this._createChangeCallbackEvent(t),n.editOption.changeBeforeCallback(e)===!1)?(i={},i[t]=this.previous(t),this.set(i),this.trigger("restore",{changed:i}),!1):!0},_executeChangeAfterCallback:function(t){var e,i=this.columnModel.getColumnModel(t);return i.editOption&&i.editOption.changeAfterCallback?(e=this._createChangeCallbackEvent(t),!!i.editOption.changeAfterCallback(e)):!0},getPrivateProperties:function(){return a},getRowState:function(){return this.extraDataManager.getRowState()},getClassNameList:function(t){var e=this.columnModel.getColumnModel(t),i=this.extraDataManager.getClassNameList(t);return e.className&&i.push(e.className),e.isEllipsis&&i.push("ellipsis"),this._makeUniqueStringArray(i)},_makeUniqueStringArray:function(t){var e=_.uniq(t.join(" ").split(" "));return _.without(e,"")},getCellState:function(t){var e,i,n=["_number","normal"],o=this.columnModel,s=!1,a=!0,l=o.getEditType(t);return i=this.getRelationResult(["isDisabled","isEditable"])[t],e=this.getRowState(),s="_button"===t?e.isDisabledCheck:e.isDisabled,s=s||!(!i||!i.isDisabled),a=-1!==$.inArray(l,n)?!1:!(i&&i.isEditable===!1),{isEditable:a,isDisabled:s}},isEditable:function(t){var e=["_number","normal"],i=this.columnModel.getEditType(t),n=!1;return-1===$.inArray(i,e)&&(n=this.getCellState(t).isEditable),n},isDisabled:function(t){var e;return e=this.getCellState(t),e.isDisabled},getRowSpanData:function(t){var e=this.collection.isRowSpanEnable(),i=this.get("rowKey");return this.extraDataManager.getRowSpanData(t,i,e)},setRowSpanData:function(t,e){this.extraDataManager.setRowSpanData(t,e),this._triggerExtraDataChangeEvent()},setRowState:function(t,e){this.extraDataManager.setRowState(t),e||this._triggerExtraDataChangeEvent()},addCellClassName:function(t,e){this.extraDataManager.addCellClassName(t,e),this._triggerExtraDataChangeEvent()},addClassName:function(t){this.extraDataManager.addClassName(t),this._triggerExtraDataChangeEvent()},removeCellClassName:function(t,e){this.extraDataManager.removeCellClassName(t,e),this._triggerExtraDataChangeEvent()},removeClassName:function(t){this.extraDataManager.removeClassName(t),this._triggerExtraDataChangeEvent()},getHTMLEncodedString:function(t){var e=this.columnModel.getColumnModel(t),i=this.columnModel.isTextType(t),n=this.get(t),o=e.notUseHtmlEntity;return!o&&i&&tui.util.hasEncodableString(n)&&(n=tui.util.encodeHTMLEntity(n)),n},_getListTypeVisibleText:function(t){var e,i,n,o,a=this.get(t),l=this.columnModel.getColumnModel(t);return tui.util.isExisty(tui.util.pick(l,"editOption","list"))?(e=this.getRelationResult(["optionListChange"])[t],i=e&&e.optionList?e.optionList:l.editOption.list,n=typeof i[0].value,o=a.toString().split(","),n!==typeof o[0]&&(o=_.map(o,function(t){return s.convertValueType(t,n)})),_.each(o,function(t,e){var n=_.findWhere(i,{value:t});o[e]=n&&n.text||""},this),o.join(",")):void 0},isDuplicatedPublicChanged:function(t){return this._timeoutIdForChanged&&_.isEqual(this._lastPublicChanged,t)?!0:(clearTimeout(this._timeoutIdForChanged),this._timeoutIdForChanged=setTimeout(_.bind(function(){this._timeoutIdForChanged=null},this),10),this._lastPublicChanged=t,!1)},getVisibleText:function(t){var e,i,n=this.columnModel,o=this.get(t),a={select:!0,radio:!0,checkbox:!0};if(n)if(e=n.getEditType(t),i=n.getColumnModel(t),a[e]){if(!tui.util.isExisty(tui.util.pick(i,"editOption","list",0,"value")))throw this.error('Check "'+t+"\"'s editOption.list property out in your ColumnModel.");o=this._getListTypeVisibleText(t)}else _.isFunction(i.formatter)&&(o=s.stripTags(i.formatter(this.getHTMLEncodedString(t),this.toJSON(),i)));return o=tui.util.isUndefined(o)?o:o.toString()},getRelationResult:function(t){var e,i,n,o,s=this.attributes,a=this.columnModel.get("relationListMap"),l={},r=this.getRowState();return t=t&&t.length?t:["optionListChange","isDisabled","isEditable"],_.each(a,function(a,u){o=s[u],_.each(a,function(a){n=a.columnList,_.each(t,function(t){r.isDisabled&&"isDisabled"===t||(e=a[t],"function"==typeof e&&(i="","optionListChange"===t?i="optionList":"isDisabled"===t?i="isDisabled":"isEditable"===t&&(i="isEditable"),i&&_.each(n,function(t){l[t]=l[t]||{},l[t][i]=e(o,s)},this)))},this)},this)},this),l}},{privateProperties:a});e.exports=l},{"../../base/model":5,"../../common/util":10,"./extraDataManager":14}],16:[function(t,e,i){"use strict";var n=t("../../base/collection"),o=t("./row"),s=n.extend({model:o,initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({columnModel:e.columnModel,domState:e.domState,gridId:e.gridId,lastRowKey:-1,originalRowList:[],originalRowMap:{},startIndex:e.startIndex||1,sortOptions:{columnName:"rowKey",isAscending:!0,useClient:_.isBoolean(e.useClientSort)?e.useClientSort:!0}}),this.sortOptions.useClient||(this.comparator=null); -},parse:function(t){return t=t&&t.contents||t,this._formatData(t)},_formatData:function(t){var e=_.filter(t,_.isObject);return _.each(e,function(t,i){e[i]=this._baseFormat(e[i]),this.isRowSpanEnable()&&this._setExtraRowSpanData(e,i)},this),e},_baseFormat:function(t){var e={rowSpan:null,rowSpanData:null,rowState:null},i=this.columnModel.get("keyColumnName"),n=null===i?this._createRowKey():t[i];return t._extraData=$.extend(e,t._extraData),t._button="CHECKED"===t._extraData.rowState,t.rowKey=n,t},_createRowKey:function(){return this.lastRowKey+=1,this.lastRowKey},_setExtraRowSpanData:function(t,e){function i(t,e){var i=t._extraData;return!(!i.rowSpanData||!i.rowSpanData[e])}function n(t,e,i){var n=t._extraData;return n.rowSpanData=n&&n.rowSpanData||{},n.rowSpanData[e]=i,n}var o,s,a,l=t[e],r=l&&l._extraData&&l._extraData.rowSpan,u=l&&l.rowKey;return r&&_.each(r,function(r,d){if(!i(l,d))for(n(l,d,{count:r,isMainRow:!0,mainRowKey:u}),o=-1,a=e+1;e+r>a;a+=1)s=t[a],s[d]=l[d],s._extraData=s._extraData||{},n(s,d,{count:o,isMainRow:!1,mainRowKey:u}),o-=1}),t},setOriginalRowList:function(t){return this.originalRowList=t?this._formatData(t):this.toJSON(),this.originalRowMap=_.indexBy(this.originalRowList,"rowKey"),this.originalRowList},getOriginalRowList:function(t){return t=void 0===t?!0:t,t?_.clone(this.originalRowList):this.originalRowList},getOriginalRow:function(t){return _.clone(this.originalRowMap[t])},getOriginal:function(t,e){return _.clone(this.originalRowMap[t][e])},getMainRowKey:function(t,e){var i,n=this.get(t);return this.isRowSpanEnable()&&(i=n&&n.getRowSpanData(e),t=i?i.mainRowKey:t),t},indexOfRowKey:function(t){return this.indexOf(this.get(t))},isRowSpanEnable:function(){return!this.isSortedByField()},isSortedByField:function(){return"rowKey"!==this.sortOptions.columnName},setSortOptionValues:function(t,e,i){var n=this.sortOptions,o=!1;_.isUndefined(t)&&(t="rowKey"),_.isUndefined(e)&&(e=!0),(n.columnName!==t||n.isAscending!==e)&&(o=!0),n.columnName=t,n.isAscending=e,o&&this.trigger("sortChanged",{columnName:t,isAscending:e,isRequireFetch:i})},sortByField:function(t,e){var i=this.sortOptions;_.isUndefined(e)&&(e=i.columnName===t?!i.isAscending:!0),this.setSortOptionValues(t,e,!i.useClient),i.useClient&&this.sort()},getRowList:function(t,e){var i,n;return t?(n=this.where({_button:!0}),i=[],_.each(n,function(t){i.push(t.attributes)},this)):i=this.toJSON(),e?i:this._removePrivateProp(i)},syncRowSpannedData:function(t,e,i){var n,o,s;if(this.isRowSpanEnable())if(o=t.getRowSpanData(e),o.isMainRow)for(n=this.indexOfRowKey(t.get("rowKey")),s=0;so?a=-1:o>s&&(a=1),n||(a=-a),a},_removePrivateProp:function(t){return _.map(t,function(t){return _.omit(t,o.privateProperties)})},removeRow:function(t,e){var i,n,o,s=this.get(t);s&&(e&&e.keepRowSpanData&&(o=_.clone(s.attributes)),i=_.clone(s.getRowSpanData()),n=this.at(this.indexOf(s)+1),this.remove(s,{silent:!0}),this._syncRowSpanDataForRemove(i,n,o),e&&e.removeOriginalData&&this.setOriginalRowList(),this.trigger("remove"))},_syncRowSpanDataForRemove:function(t,e,i){t&&_.each(t,function(t,n){var o,s,a,l={};if(t.isMainRow){if(1===t.count)return;o=e,a=t.count-1,s=1,a>1&&(l.mainRowKey=o.get("rowKey"),l.isMainRow=!0),o.set(n,i?i[n]:"",{silent:!0})}else o=this.get(t.mainRowKey),a=o.getRowSpanData(n).count-1,s=-t.count;a>1?(l.count=a,o.setRowSpanData(n,l),this._updateSubRowSpanData(o,n,s,a)):o.setRowSpanData(n,null)},this)},_createDummyRow:function(){var t=this.columnModel.get("dataColumnModelList"),e={};return _.each(t,function(t){e[t.columnName]=""},this),e},append:function(t,e){var i,n=this._createModelList(t);return e=_.extend({at:this.length},e),i={at:e.at,add:!0,silent:!0},this.add(n,i),this._syncRowSpanDataForAppend(e.at,n.length,e.extendPrevRowSpan),this.trigger("add",n,i),n},prepend:function(t){return this.append(t,{at:0})},getRowData:function(t,e){var i=this.get(t),n=i?i.toJSON():null;return e?$.toJSON(n):n},getRowDataAt:function(t,e){var i=this.at(t),n=i?i.toJSON():null;return e?$.toJSON(i):n},getValue:function(t,e,i){var n,o;return i?n=this.getOriginal(t,e):(o=this.get(t),n=o&&o.get(e)),n},setValue:function(t,e,i,n){var o,s=this.get(t),a={};return i=_.isString(i)?$.trim(i):i,s?(a[e]=i,s.set(a,{silent:n}),o=!0):o=!1,o},getColumnValues:function(t,e){var i=this.pluck(t);return e?$.toJSON(i):i},setColumnValues:function(t,e,i,n){var o={},s={isDisabled:!1,isEditable:!0};o[t]=e,i=void 0===i?!0:i,this.forEach(function(e){i&&(s=e.getCellState(t)),!s.isDisabled&&s.isEditable&&e.set(o,{silent:n})},this)},getRowSpanData:function(t,e){var i=this.get(t);return i?i.getRowSpanData(e):null},isChanged:function(){var t=_.values(this.getModifiedRowList());return _.some(t,function(t){return t.length>0})},enableRow:function(t){this.get(t).setRowState("")},disableRow:function(t){this.get(t).setRowState("DISABLED")},enableCheck:function(t){this.get(t).setRowState("")},disableCheck:function(t){this.get(t).setRowState("DISABLED_CHECK")},check:function(t,e){var i=this.get(t).getRowState().isDisabledCheck,n=this.columnModel.get("selectType");!i&&n&&("radio"===n&&this.uncheckAll(),this.setValue(t,"_button",!0,e))},uncheck:function(t,e){this.setValue(t,"_button",!1,e)},checkAll:function(){this.setColumnValues("_button",!0)},uncheckAll:function(){this.setColumnValues("_button",!1)},_createModelList:function(t){var e,i=[];return t=t||this._createDummyRow(),_.isArray(t)||(t=[t]),e=this._formatData(t),_.each(e,function(t){var e;t._button=!0,e=new o(t,{collection:this,parse:!0}),i.push(e)},this),i},_syncRowSpanDataForAppend:function(t,e,i){var n=this.at(t-1);n&&_.each(n.getRowSpanData(),function(t,o){var s,a,l,r;0!==t.count&&(t.isMainRow?(s=n,a=t,l=1):(s=this.get(t.mainRowKey),a=s.getRowSpanData()[o],l=-t.count+1),(a.count>l||i)&&(a.count+=e,r=a.count,this._updateSubRowSpanData(s,o,l,r)))},this)},_updateSubRowSpanData:function(t,e,i,n){var o,s,a=this.indexOf(t),l=t.get("rowKey");for(s=i;n>s;s+=1)o=this.at(a+s),o.set(e,t.get(e),{silent:!0}),o.setRowSpanData(e,{count:-s,mainRowKey:l,isMainRow:!1})},_isModifiedRow:function(t,e,i){var n=_.omit(t,i),o=_.some(n,function(t,i){return"object"==typeof t?$.toJSON(t)!==$.toJSON(e[i]):t!==e[i]},this);return o},getModifiedRowList:function(t){var e=t&&t.isRaw,i=t&&t.isOnlyChecked,n=t&&t.isOnlyRowKeyList,o=e?this.originalRowList:this._removePrivateProp(this.originalRowList),s=e?this.toJSON():this._removePrivateProp(this.toJSON()),a=t&&t.filteringColumnList,l={createList:[],updateList:[],deleteList:[]};return o=_.indexBy(o,"rowKey"),s=_.indexBy(s,"rowKey"),a=_.union(a,this.columnModel.getIgnoredColumnNameList()),_.each(s,function(t,e){var s=o[e],r=n?t.rowKey:t;(!i||i&&this.get(e).get("_button"))&&(s?this._isModifiedRow(t,s,a)&&l.updateList.push(r):l.createList.push(r))},this),_.each(o,function(t,e){var i=n?t.rowKey:t;s[e]||l.deleteList.push(i)},this),l},_resetData:function(t,e,i){this.lastRowKey=-1,this.reset(t,{parse:e}),_.isFunction(i)&&i()},replaceRowList:function(t,e,i){_.isUndefined(e)&&(e=!0),this.trigger("beforeReset"),t&&t.length>500?_.defer(_.bind(this._resetData,this,t,e,i)):this._resetData(t,e,i)},setRowList:function(t,e,i){var n=_.bind(function(){this.setOriginalRowList(),_.isFunction(i)&&i()},this);this.replaceRowList(t,e,n)},restore:function(){var t=this.getOriginalRowList();this.replaceRowList(t,!0)},del:function(t,e,i){var n=this.getMainRowKey(t,e),o=this.get(n).getCellState(e),s=this.columnModel.getEditType(e),a=_.contains(["text","text-convertible","text-password"],s);a&&o.isEditable&&!o.isDisabled&&(this.setValue(n,e,"",i),i&&this.check(n,i))},paste:function(t,e){var i=this._getEndIndexToPaste(t,e);_.each(t,function(t,n){this._setValueForPaste(t,e.row+n,e.column,i.column)},this),this.trigger("paste",{startIdx:e,endIdx:i})},_getEndIndexToPaste:function(t,e){var i=this.columnModel.getVisibleColumnModelList(),n=t.length+e.row-1,o=Math.min(t[0].length+e.column,i.length)-1;return{row:n,column:o}},_setValueForPaste:function(t,e,i,n){var o,s,a,l,r=this.at(e),u=this.columnModel,d={};for(r||(r=this.append({})[0]),o=i;n>=o;o+=1)s=u.at(o,!0).columnName,a=r.getCellState(s),l=r.getRowSpanData(s),a.isEditable&&!a.isDisabled&&(!l||l.count>=0)&&(d[s]=t[o-i]);r.set(d)},getElement:function(t,e){var t=this.getMainRowKey(t,e);return this.domState.getElement(t,e)}});e.exports=s},{"../../base/collection":3,"./row":15}],17:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=1,a=1,l=n.extend({initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this._columnWidthFixedFlags=null,this._minColumnWidthList=null,this.columnModel=e.columnModel,this.dataModel=e.dataModel,this.domState=e.domState,this.listenTo(this.columnModel,"columnModelChange",this._initColumnWidthVariables),this.listenTo(this.dataModel,"add remove reset",this._resetTotalRowHeight),this.on("change:width",this._onWidthChange,this),this.on("change:displayRowCount",this._setBodyHeight,this),this._initColumnWidthVariables(),this._setBodyHeight()},models:null,columnModel:null,defaults:{offsetLeft:0,offsetTop:0,width:0,headerHeight:0,bodyHeight:0,toolbarHeight:65,rowHeight:0,totalRowHeight:0,rsideWidth:0,lsideWidth:0,columnWidthList:[],minimumColumnWidth:0,displayRowCount:1,scrollBarSize:17,scrollX:!0,scrollY:!0},_getAvailableTotalWidth:function(t){var e=this.get("width"),i=e-this.getScrollYWidth()-t-1;return this.columnModel.getVisibleColumnFixCount(!0)>0&&(i-=a),i},_applyMinimumColumnWidth:function(t){var e=this._minColumnWidthList,i=_.clone(t);return _.each(i,function(t,n){var o=e[n];o>t&&(i[n]=o)}),i},_resetTotalRowHeight:function(){var t=this.get("rowHeight"),e=this.dataModel.length,i=e+1;this.set("totalRowHeight",t*e+i)},_fillEmptyColumnWidth:function(t){var e=this._getAvailableTotalWidth(t.length),i=e-o.sum(t),n=[];return _.each(t,function(t,e){t||n.push(e)}),this._distributeExtraWidthEqually(t,i,n)},_addExtraColumnWidth:function(t,e){var i=this._columnWidthFixedFlags,n=[];return _.each(i,function(t,e){t||n.push(e)}),this._distributeExtraWidthEqually(t,e,n)},_reduceExcessColumnWidth:function(t,e){var i=this._minColumnWidthList,n=this._columnWidthFixedFlags,o=[];return _.each(t,function(t,e){n[e]||o.push({index:e,width:t-i[e]})}),this._reduceExcessColumnWidthSub(_.clone(t),e,o)},_reduceExcessColumnWidthSub:function(t,e,i){var n,o=Math.round(e/i.length),s=[];return _.each(i,function(i){i.widths.length?this._reduceExcessColumnWidthSub(t,e,s):(n=_.pluck(i,"index"),this._distributeExtraWidthEqually(t,e,n))},_distributeExtraWidthEqually:function(t,e,i){var n=i.length,o=Math.round(e/n),s=o*n-e,a=_.clone(t);return _.each(i,function(t){a[t]+=o}),a[_.last(i)]-=s,a},_adjustColumnWidthList:function(t,e){var i,n=t.length,s=this._getAvailableTotalWidth(n),a=s-o.sum(t),l=_.filter(this._columnWidthFixedFlags).length;return a>0?n>l?i=this._addExtraColumnWidth(t,a):(i=_.clone(t),i[n-1]+=a):i=e&&0>a?this._reduceExcessColumnWidth(t,a):t,i},_initColumnWidthVariables:function(){var t,e=this.columnModel.getVisibleColumnModelList(null,!0),i=this.get("minimumColumnWidth"),n=[],o=[],s=[];_.each(e,function(t){var e=t.width>0?t.width:0,a=Math.max(e,i);n.push(e?a:0),s.push(a),o.push(!!t.isFixedWidth)}),this._columnWidthFixedFlags=o,this._minColumnWidthList=s,t=_.compose(this._adjustColumnWidthList,this._applyMinimumColumnWidth,this._fillEmptyColumnWidth),this._setColumnWidthVariables(t.call(this,n),!0)},getFrameWidth:function(t){var e=this.columnModel.getVisibleColumnFixCount(!0),i=this.getColumnWidthList(t),n=this._getFrameWidth(i);return tui.util.isUndefined(t)&&e>0&&(n+=1),n},_getFrameWidth:function(t){var e=0;return t.length&&(e=o.sum(t)+(t.length+1)*a),e},_setColumnWidthVariables:function(t,e){var i,n,o,s,a=this.get("width"),l=this.columnModel.getVisibleColumnFixCount(!0),r=this._getMaxLeftSideWidth();o=t.slice(0,l),s=t.slice(l),n=this._getFrameWidth(o),r&&n>r&&(o=this._adjustLeftSideWidthList(o,r),n=this._getFrameWidth(o),t=o.concat(s)),i=a-n,this.set({columnWidthList:t,rsideWidth:i,lsideWidth:n}),e&&this.set("originalWidthList",_.clone(t)),this.trigger("columnWidthChanged")},_getMinLeftSideWidth:function(){var t,e=this.get("minimumColumnWidth"),i=this.columnModel.getVisibleColumnFixCount(!0),n=0;return i&&(t=(i+1)*a,n=t+e*i),n},_getMaxLeftSideWidth:function(){var t=Math.ceil(.9*this.get("width"));return t&&(t=Math.max(t,this._getMinLeftSideWidth())),t},getCellPosition:function(t,e){var i,n,s,l,r,u,d,c,h=this.dataModel,m=this.columnModel,g=this.get("rowHeight"),f=h.get(t),p=m.getVisibleMetaColumnCount(),M=this.get("columnWidthList").slice(p),_=m.getVisibleColumnFixCount(),w=m.indexOfColumnName(e,!0);if(!f)return{};for(i=h.get(t).getRowSpanData(e),i.isMainRow||(t=i.mainRowKey,i=h.get(t).getRowSpanData(e)),s=i.count||1,n=h.indexOfRowKey(t),l=o.getHeight(n,g),d=l+o.getHeight(s,g)-a,r=c=0,w>=_&&(c=_);w>c;c+=1)r+=M[c]+a;return u=r+M[c]+a,{top:l,left:r,right:u,bottom:d}},getScrollPosition:function(t,e){var i=!this.columnModel.isLside(e),n=this.getCellPosition(t,e),o=this._getBodySize(),s=this._judgeScrollDirection(n,i,o);return this._makeScrollPosition(s,n,o)},_getBodySize:function(){var t=this.get("lsideWidth"),e=this.get("rsideWidth")-this.getScrollYWidth(),i=this.get("bodyHeight")-this.getScrollXHeight();return{height:i,rsideWidth:e,totalWidth:t+e}},_judgeScrollDirection:function(t,e,i){var n,o,s,a,l=this.renderModel,r=l.get("scrollTop"),u=l.get("scrollLeft");return n=t.topr+i.height,e?(s=t.leftu+i.rsideWidth-1):s=a=!1,{isUp:n,isDown:o,isLeft:s,isRight:a}},_makeScrollPosition:function(t,e,i){var n={};return t.isUp?n.scrollTop=e.top:t.isDown&&(n.scrollTop=e.bottom-i.height),t.isLeft?n.scrollLeft=e.left:t.isRight&&(n.scrollLeft=e.right-i.rsideWidth+s),n},getOverflowFromMousePosition:function(t,e){var i=this._rebasePositionToContainer(t,e),n=this._getBodySize();return this._judgeOverflow(i,n)},_judgeOverflow:function(t,e){var i=t.x,n=t.y,o=0,s=0;return 0>n?o=-1:n>e.height&&(o=1),0>i?s=-1:i>e.totalWidth&&(s=1),{x:s,y:o}},getIndexFromMousePosition:function(t,e,i){var n=this._rebasePositionToContainer(t,e);return{row:this._calcRowIndexFromPositionY(n.y),column:this._calcColumnIndexFromPositionX(n.x,i)}},_calcRowIndexFromPositionY:function(t){var e=t+this.renderModel.get("scrollTop"),i=Math.floor(e/(this.get("rowHeight")+a)),n=0,s=Math.max(n,this.dataModel.length-1);return o.clamp(i,n,s)},_calcColumnIndexFromPositionX:function(t,e){var i=this.getColumnWidthList(),n=this.getFrameWidth(),o=t,s=t>=this.get("lsideWidth"),a=e?0:this.columnModel.getVisibleMetaColumnCount(),l=0;return s&&(o+=this.renderModel.get("scrollLeft")),o>=n?l=i.length-1:tui.util.forEachArray(i,function(t,e){return t>=o?(l=e,!1):void(o-=t)}),Math.max(0,l-a)},_rebasePositionToContainer:function(t,e){var i=t-this.get("offsetLeft"),n=e-(this.get("offsetTop")+this.get("headerHeight")+2);return{x:i,y:n}},_adjustLeftSideWidthList:function(t,e){var i,n=t.length-1,o=this.get("minimumColumnWidth"),s=this._getFrameWidth(t),a=s-e;if(a>0)for(;n>=0&&a>0;)i=Math.max(o,t[n]-a),a-=t[n]-i,t[n]=i,n-=1;else 0>a&&(t[n]+=Math.abs(a));return t},_setBodyHeight:function(){var t=o.getHeight(this.get("displayRowCount"),this.get("rowHeight"));t+=this.getScrollXHeight(),this.set("bodyHeight",t)},getDisplayRowCount:function(){return o.getDisplayRowCount(this.get("bodyHeight")-this.getScrollXHeight(),this.get("rowHeight"))},getScrollXHeight:function(){return this.get("scrollX")?this.get("scrollBarSize"):0},getScrollYWidth:function(){return this.get("scrollY")?this.get("scrollBarSize"):0},_onWidthChange:function(){var t=this._adjustColumnWidthList(this.get("columnWidthList"),!0);this._setColumnWidthVariables(t)},setColumnWidth:function(t,e){var i,n=this.get("columnWidthList"),o=this._columnWidthFixedFlags,s=this._minColumnWidthList[t];!o[t]&&n[t]&&(n[t]=Math.max(e,s),o[t]=!0,i=this._adjustColumnWidthList(n),o[t]=!1,this._setColumnWidthVariables(i))},_calcRealBodyHeight:function(t){return t-this.get("headerHeight")-this.get("toolbarHeight")-s},_getMinBodyHeight:function(){return this.get("rowHeight")+2*a+this.getScrollXHeight()},_setHeight:function(t){this.set("bodyHeight",Math.max(this._calcRealBodyHeight(t),this._getMinBodyHeight())),this.set("displayRowCount",this.getDisplayRowCount(),{silent:!0})},setSize:function(t,e){t>0&&this.set("width",t),e>0&&this._setHeight(e),this.trigger("setSize")},getHeight:function(){return this.get("bodyHeight")+this.get("headerHeight")+this.get("toolbarHeight")},refreshLayout:function(){var t=this.domState,e=t.getOffset();this.set({offsetTop:e.top,offsetLeft:e.left,width:t.getWidth()})},restoreColumnWidth:function(t){var e=this.get("originalWidthList")[t];this.setColumnWidth(t,e)},getColumnWidthList:function(t){var e=this.columnModel.getVisibleColumnFixCount(!0),i=[];switch(t){case"l":case"L":i=this.get("columnWidthList").slice(0,e);break;case"r":case"R":i=this.get("columnWidthList").slice(e);break;default:i=this.get("columnWidthList")}return i}});e.exports=l},{"../base/model":5,"../common/util":10}],18:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=n.extend({initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this.dataModel=e.dataModel,this.columnModel=e.columnModel,this.dimensionModel=e.dimensionModel,this.renderModel=e.renderModel,this.cellFactory=e.cellFactory,this.domState=e.domState},defaults:{rowKey:null,columnName:"",prevRowKey:null,prevColumnName:""},_savePrevious:function(){return null!==this.get("rowKey")&&this.set("prevRowKey",this.get("rowKey")),this.get("columnName")&&this.set("prevColumnName",this.get("columnName")),this},_clearPrevious:function(){this.set({prevRowKey:null,prevColumnName:""})},select:function(t){return this.unselect().set("rowKey",t),"radio"===this.columnModel.get("selectType")&&this.dataModel.check(t),this.trigger("select",{rowKey:t,rowData:this.dataModel.getRowData(t)}),this},unselect:function(t){return t&&this.blur(),this.trigger("unselect",this.get("rowKey")),this.set({rowKey:null}),this},focus:function(t,e,i){return o.isBlank(t)||o.isBlank(e)||this.columnModel.isMetaColumn(e)||this.get("rowKey")===t&&this.get("columnName")===e?this:(this.blur().select(t).set("columnName",e).trigger("focus",t,e),i&&this.scrollToFocus(),this)},focusAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0);n&&o&&this.focus(n.get("rowKey"),o.columnName,i)},focusIn:function(t,e,i){this.focus(t,e,i),t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t).isEditable(e)?this.trigger("focusIn",t,e):this.focusClipboard()},focusInAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0);n&&o&&this.focusIn(n.get("rowKey"),o.columnName,i)},focusClipboard:function(){this.trigger("focusClipboard")},refreshState:function(){this.domState.hasFocusedElement()?this.has()||this.restore()||this.focusAt(0,0):this.blur()},scrollToFocus:function(){var t=this.get("rowKey"),e=this.get("columnName"),i=this.dimensionModel.getScrollPosition(t,e);tui.util.isEmpty(i)||this.renderModel.set(i)},blur:function(){return this.has()&&(this._savePrevious(),this.trigger("blur",this.get("rowKey"),this.get("columnName")),null!==this.get("rowKey")&&this.set("columnName","")),this},which:function(){return{rowKey:this.get("rowKey"),columnName:this.get("columnName")}},indexOf:function(t){var e=t?this.get("prevRowKey"):this.get("rowKey"),i=t?this.get("prevColumnName"):this.get("columnName");return{row:this.dataModel.indexOfRowKey(e),column:this.columnModel.indexOfColumnName(i,!0)}},has:function(){return this._isValidCell(this.get("rowKey"),this.get("columnName"))},restore:function(){var t=this.get("prevRowKey"),e=this.get("prevColumnName"),i=!1;return this._isValidCell(t,e)&&(this.focus(t,e),i=!0),i},_isValidCell:function(t,e){var i=!o.isBlank(t)&&!!this.dataModel.get(t),n=!o.isBlank(e)&&!!this.columnModel.getColumnModel(e);return i&&n},_findRowKey:function(t){var e,i,n=this.dataModel;return this.has()?(e=Math.max(Math.min(n.indexOfRowKey(this.get("rowKey"))+t,this.dataModel.length-1),0),i=n.at(e),i&&i.get("rowKey")):void 0},_findColumnName:function(t){var e,i=this.columnModel,n=i.getVisibleColumnModelList(),o=i.indexOfColumnName(this.get("columnName"),!0);return this.has()?(e=Math.max(Math.min(o+t,n.length-1),0),n[e]&&n[e].columnName):void 0},_getRowSpanData:function(t,e){return this.dataModel.get(t).getRowSpanData(e)},nextRowIndex:function(t){var e=this.nextRowKey(t);return this.dataModel.indexOfRowKey(e)},prevRowIndex:function(t){var e=this.prevRowKey(t);return this.dataModel.indexOfRowKey(e)},nextColumnIndex:function(){var t=this.nextColumnName();return this.columnModel.indexOfColumnName(t,!0)},prevColumnIndex:function(){var t=this.prevColumnName();return this.columnModel.indexOfColumnName(t,!0)},nextRowKey:function(t){var e,i,n=this.which(),o=n.rowKey;return t="number"==typeof t?t:1,t>1?(o=this._findRowKey(t),i=this._getRowSpanData(o,n.columnName),i.isMainRow||(o=this._findRowKey(i.count+t))):(i=this._getRowSpanData(o,n.columnName),i.isMainRow&&i.count>0?o=this._findRowKey(i.count):i.isMainRow?o=this._findRowKey(1):(e=i.count,i=this._getRowSpanData(i.mainRowKey,n.columnName),o=this._findRowKey(i.count+e))),o},prevRowKey:function(t){var e,i=this.which(),n=i.rowKey;return t="number"==typeof t?t:1,t*=-1,-1>t?(n=this._findRowKey(t),e=this._getRowSpanData(n,i.columnName),e.isMainRow||(n=this._findRowKey(e.count+t))):(e=this._getRowSpanData(n,i.columnName),n=e.isMainRow?this._findRowKey(-1):this._findRowKey(e.count-1)),n},nextColumnName:function(){return this._findColumnName(1)},prevColumnName:function(){return this._findColumnName(-1)},firstRowKey:function(){return this.dataModel.at(0).get("rowKey")},lastRowKey:function(){return this.dataModel.at(this.dataModel.length-1).get("rowKey")},firstColumnName:function(){var t=this.columnModel.getVisibleColumnModelList();return t[0].columnName},lastColumnName:function(){var t=this.columnModel.getVisibleColumnModelList(),e=t.length-1;return t[e].columnName}});e.exports=s},{"../base/model":5,"../common/util":10}],19:[function(t,e,i){"use strict";var n=t("./data/columnModel"),o=t("./data/rowList"),s=t("./toolbar"),a=t("./dimension"),l=t("./focus"),r=t("./renderer"),u=t("./renderer-smart"),d=t("./selection"),c=(t("../common/util"),t("../common/constMap").renderState,{columnFixCount:0,columnModelList:[],keyColumnName:null,selectType:"",autoNumbering:!0,headerHeight:35,rowHeight:27,displayRowCount:10,minimumColumnWidth:50,notUseSmartRendering:!1,columnMerge:[],scrollX:!0,scrollY:!0,useClientSort:!0,singleClickEdit:!1,toolbar:{hasResizeHandler:!0,hasControlPanel:!0,hasPagination:!0}}),h=tui.util.defineClass({init:function(t,e){t=$.extend(!0,{},c,t),this.gridId=t.gridId,this.columnModel=this._createColumnModel(t),this.dataModel=this._createDataModel(t,e),this.toolbarModel=this._createToolbarModel(t),this.dimensionModel=this._createDimensionModel(t,e),this.renderModel=this._createRenderModel(t),this.focusModel=this._createFocusModel(e),this.selectionModel=this._createSelectionModel(),this.dimensionModel.renderModel=this.renderModel},_createColumnModel:function(t){return new n({hasNumberColumn:t.autoNumbering,keyColumnName:t.keyColumnName,columnFixCount:t.columnFixCount,selectType:t.selectType,columnMerge:t.columnMerge,columnModelList:t.columnModelList})},_createDataModel:function(t,e){return new o([],{gridId:this.gridId,domState:e,columnModel:this.columnModel,useClientSort:t.useClientSort})},_createToolbarModel:function(t){return new s(t.toolbar)},_createDimensionModel:function(t,e){var i={headerHeight:t.headerHeight,rowHeight:t.rowHeight,scrollX:!!t.scrollX,scrollY:!!t.scrollY,minimumColumnWidth:t.minimumColumnWidth,displayRowCount:t.displayRowCount};return this.toolbarModel.isVisible()||(i.toolbarHeight=0),new a(i,{columnModel:this.columnModel,dataModel:this.dataModel,domState:e})},_createFocusModel:function(t){return new l(null,{columnModel:this.columnModel,dataModel:this.dataModel,dimensionModel:this.dimensionModel,renderModel:this.renderModel,domState:t})},_createSelectionModel:function(){return new d(null,{columnModel:this.columnModel,dataModel:this.dataModel,dimensionModel:this.dimensionModel,renderModel:this.renderModel,focusModel:this.focusModel})},_createRenderModel:function(t){var e,i,n;return e={emptyMessage:t.emptyMessage},i={columnModel:this.columnModel,dataModel:this.dataModel,dimensionModel:this.dimensionModel},new(n=t.notUseSmartRendering?r:u)(e,i)},destroy:function(){_.each(this,function(t,e){t&&tui.util.isFunction(t._destroy)&&t._destroy(),t&&tui.util.isFunction(t.stopListening)&&t.stopListening(),this[e]=null},this)}});e.exports=h},{"../common/constMap":8,"../common/util":10,"./data/columnModel":13,"./data/rowList":16,"./dimension":17,"./focus":18,"./renderer":21,"./renderer-smart":20,"./selection":24,"./toolbar":25}],20:[function(t,e,i){"use strict";var n=t("./renderer"),o=t("../common/util"),s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.on("change:scrollTop",this._onChange,this),this.listenTo(this.dimensionModel,"change:bodyHeight",this._onChange,this),this.setOwnProperties({hiddenRowCount:10,criticalPoint:3})},_onChange:function(){this._isRenderable(this.get("scrollTop"))&&this.refresh()},_setRenderingRange:function(t){var e,i=this.dimensionModel,n=this.dataModel,s=i.get("rowHeight"),a=i.getDisplayRowCount(),l=Math.max(0,Math.ceil(t/(s+1))-this.hiddenRowCount),r=Math.min(n.length-1,l+a+2*this.hiddenRowCount);n.isRowSpanEnable()&&(l+=this._getStartRowSpanMinCount(l),r+=this._getEndRowSpanMaxCount(r)),e=0===l?0:o.getHeight(l,s)-1,this.set({top:e,startIndex:l,endIndex:r})},_getStartRowSpanMinCount:function(t){var e,i=this.dataModel.at(t),n=0;return i&&(e=_.pluck(i.getRowSpanData(),"count"),e.push(0),n=_.min(e)),n},_getEndRowSpanMaxCount:function(t){var e,i=this.dataModel.at(t),n=0;return i&&(e=_.pluck(i.getRowSpanData(),"count"),e.push(0),n=_.max(e)),n},_isRenderable:function(t){var e=this.dimensionModel,i=this.dataModel,n=e.get("rowHeight"),o=e.get("bodyHeight"),s=i.length,a=Math.max(0,Math.ceil(t/(n+1))),l=Math.min(i.length-1,Math.floor((t+o)/(n+1))),r=this.get("startIndex"),u=this.get("endIndex");return 0!==r&&r+this.criticalPoint>a?!0:u!==s-1&&u-this.criticalPointi;i+=1)n=this.dataModel.at(i),n&&(o=n.get("rowKey"),h={_extraData:n.get("_extraData"),rowKey:o},m={_extraData:n.get("_extraData"),rowKey:o},_.each(r,function(t){"_number"===t?h[t]=p++:h[t]=n.get(t)}),_.each(u,function(t){"_number"===t?m[t]=p++:m[t]=n.get(t)}),d.push(h),c.push(m));for(this.get("lside").clear().reset(d,{parse:!0}),this.get("rside").clear().reset(c,{parse:!0}),e=c.length+g,i=g;e>i;i+=1)this.executeRelation(i);this.isColumnModelChanged?(this.trigger("columnModelChanged"),this.isColumnModelChanged=!1):this.trigger("rowListChanged",t),this._refreshState(),this.trigger("refresh")},_refreshState:function(){this.dataModel.length?this.set("state",s.DONE):this.set("state",s.EMPTY)},_getCollectionByColumnName:function(t){var e,i=this.get("lside");return e=i.at(0)&&i.at(0).get(t)?i:this.get("rside")},getCellData:function(t,e){var i=this._getCollectionByColumnName(e),n=i.get(t);return n?n.get(e):void 0},executeRelation:function(t){var e,i,n=this.dataModel.at(t),o=t-this.get("startIndex");i=n.getRelationResult(),_.each(i,function(t,i){e=this._getCollectionByColumnName(i).at(o),e&&e.setCell(i,t)},this)},_destroy:function(){clearTimeout(this.timeoutIdForRefresh)}});e.exports=a},{"../base/model":5,"../common/constMap":8,"./rowList":23}],22:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=n.extend({initialize:function(t,e){var i,n;i=t&&t.rowKey,n=this.collection.dataModel.get(i),n&&(this.listenTo(n,"change restore",this._onDataModelChange),this.listenTo(n,"extraDataChanged",this._setRowExtraData))},idAttribute:"rowKey",_onDataModelChange:function(t){_.each(t.changed,function(t,e){this.setCell(e,{value:t})},this)},_setRowExtraData:function(){var t,e=this.collection.dataModel,i=e.get(this.get("rowKey")),n=this.collection.columnModel.getVisibleColumnModelList(null,!0),o=i.getRowState();tui.util.isUndefined(this.collection)||_.each(n,function(n){var s,a,l=n.columnName,r=this.get(l),u=this;tui.util.isUndefined(r)||(s=i.isEditable(l),a="_button"===l?o.isDisabledCheck:o.isDisabled,e.isRowSpanEnable()&&!r.isMainRow&&(u=this.collection.get(r.mainRowKey)),u&&(t={isDisabled:a,isEditable:s,className:i.getClassNameList(l).join(" ")},u.setCell(l,t)))},this)},parse:function(t,e){return this._formatData(t,e.collection.dataModel)},_formatData:function(t,e){var i=t.rowKey,n=e.get(i),o=n.getRowState(),s=o.isDisabled;return _.each(t,function(a,l){var r,u=n.isEditable(l);"rowKey"!==l&&"_extraData"!==l&&(r=e.isRowSpanEnable()&&t._extraData&&t._extraData.rowSpanData&&t._extraData.rowSpanData[l]?t._extraData.rowSpanData[l]:{mainRowKey:i,count:0,isMainRow:!0},s="_button"===l?o.isDisabledCheck:s,t[l]={rowKey:i,columnName:l,value:a,rowSpan:r.count,isMainRow:r.isMainRow,mainRowKey:r.mainRowKey,isEditable:u,isDisabled:s,optionList:[],className:n.getClassNameList(l).join(" "),changed:[]})},this),t},setCell:function(t,e){var i,n,s,a=!1,l=[];this.get(t)&&(n=this.get("rowKey"),s=_.clone(this.get(t)),_.each(e,function(t,e){o.isEqual(s[e],t)||(a="value"===e?!0:a,s[e]=t,l.push(e))},this), -l.length&&(s.changed=l,this.set(t,s),a&&(i=this.collection.dataModel.indexOfRowKey(n),this.trigger("valueChange",i))))}});e.exports=s},{"../base/model":5,"../common/util":10}],23:[function(t,e,i){"use strict";var n=t("../base/collection"),o=t("./row"),s=n.extend({model:o,initialize:function(t,e){this.setOwnProperties({dataModel:e.dataModel,columnModel:e.columnModel})}});e.exports=s},{"../base/collection":3,"./row":22}],24:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s={cell:"cell",row:"row",column:"column"},a=n.extend({initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({dataModel:e.dataModel,columnModel:e.columnModel,dimensionModel:e.dimensionModel,focusModel:e.focusModel,renderModel:e.renderModel,inputRange:null,intervalIdForAutoScroll:null,scrollPixelScale:40,_isEnabled:!0,_selectionState:s.cell}),this.listenTo(this.dataModel,"add remove sort reset",this.end),this.listenTo(this.dataModel,"paste",this._onPasteData)},defaults:{range:null},_onPasteData:function(t){this.start(t.startIdx.row,t.startIdx.column),this.update(t.endIdx.row,t.endIdx.column)},setState:function(t){this._selectionState=s[t]||this._selectionState},getState:function(){return this._selectionState},enable:function(){this._isEnabled=!0},disable:function(){this.end(),this._isEnabled=!1},isEnabled:function(){return this._isEnabled},start:function(t,e,i){this._isEnabled&&(this.setState(i),this.inputRange={row:[t,t],column:[e,e]},this._resetRangeAttribute())},startByMousePosition:function(t,e,i){var n=this.dimensionModel.getIndexFromMousePosition(t,e);this.start(n.row,n.column,i)},update:function(t,e,i){var n;!this._isEnabled||0>t||0>e||(this.hasSelection()?this.setState(i):(n=this.focusModel.indexOf(),this.start(n.row,n.column,i)),this._updateInputRange(t,e),this._resetRangeAttribute())},_updateInputRange:function(t,e){var i=this.inputRange;i.row[1]=t,i.column[1]=e},extendColumnSelection:function(t,e,i){var n,s=this._minimumColumnRange,a=this.dimensionModel.getIndexFromMousePosition(e,i),l={row:[0,0],column:[]};t&&t.length||(t=[a.column]),this._setScrolling(e,i),s?n=o.getMinMax(t.concat(s)):(t.push(this.inputRange.column[0]),n=o.getMinMax(t)),l.column.push(n.min,n.max),this._resetRangeAttribute(l)},_setScrolling:function(t,e){var i=this.dimensionModel.getOverflowFromMousePosition(t,e);this.stopAutoScroll(),this._isAutoScrollable(i.x,i.y)&&(this.intervalIdForAutoScroll=setInterval(_.bind(this._adjustScroll,this,i.x,i.y)))},updateByMousePosition:function(t,e,i){var n=this.dimensionModel.getIndexFromMousePosition(t,e);this._setScrolling(t,e),this.update(n.row,n.column,i)},end:function(){this.inputRange=null,this.unset("range"),this.unsetMinimumColumnRange()},stopAutoScroll:function(){_.isNull(this.intervalIdForAutoScroll)||(clearInterval(this.intervalIdForAutoScroll),this.intervalIdForAutoScroll=null)},selectRow:function(t){this._isEnabled&&(this.focusModel.focusAt(t,0),this.start(t,0,s.row),this.update(t,this.columnModel.getVisibleColumnModelList().length-1))},selectColumn:function(t){this._isEnabled&&(this.focusModel.focusAt(0,t),this.start(0,t,s.column),this.update(this.dataModel.length-1,t))},selectAll:function(){this._isEnabled&&(this.start(0,0,s.cell),this.update(this.dataModel.length-1,this.columnModel.getVisibleColumnModelList().length-1))},getStartIndex:function(){var t=this.get("range");return{row:t.row[0],column:t.column[0]}},getEndIndex:function(){var t=this.get("range");return{row:t.row[1],column:t.column[1]}},hasSelection:function(){return!!this.get("range")},getValuesToString:function(){var t,e,i,n,o=this.get("range");return t=this.columnModel.getVisibleColumnModelList().slice(o.column[0],o.column[1]+1),e=this.dataModel.slice(o.row[0],o.row[1]+1),i=_.pluck(t,"columnName"),n=_.map(e,function(t){var e=_.map(i,function(e){return t.getVisibleText(e)});return e.join(" ")}),n.join("\n")},_isAutoScrollable:function(t,e){return!(0===t&&0===e)},_adjustScroll:function(t,e){var i=this.renderModel;t&&this._adjustScrollLeft(t,i.get("scrollLeft"),i.get("maxScrollLeft")),e&&this._adjustScrollTop(e,i.get("scrollTop"),i.get("maxScrollTop"))},_adjustScrollLeft:function(t,e,i){var n=e,o=this.scrollPixelScale;0>t?n=Math.max(0,e-o):t>0&&(n=Math.min(i,e+o)),this.renderModel.set("scrollLeft",n)},_adjustScrollTop:function(t,e,i){var n=e,o=this.scrollPixelScale;0>t?n=Math.max(0,e-o):t>0&&(n=Math.min(i,e+o)),this.renderModel.set("scrollTop",n)},_resetRangeAttribute:function(t){var e,i,n,o=this.dataModel;if(t=t||this.inputRange,!t)return void this.set("range",null);if(i={row:_.sortBy(t.row),column:_.sortBy(t.column)},o.isRowSpanEnable())do n=_.assign([],i.row),i=this._getRowSpannedIndex(i),e=i.row[0]!==n[0]||i.row[1]!==n[1];while(e);switch(this._setRangeMinMax(i.row,i.column),this._selectionState){case s.column:i.row=[0,o.length-1];break;case s.row:i.column=[0,this.columnModel.getVisibleColumnModelList().length-1];break;case s.cell:}this.set("range",i)},setMinimumColumnRange:function(t){this._minimumColumnRange=_.extend(t)},unsetMinimumColumnRange:function(){this._minimumColumnRange=null},_setRangeMinMax:function(t,e){t&&(t[0]=Math.max(0,t[0]),t[1]=Math.min(this.dataModel.length-1,t[1])),e&&(e[0]=Math.max(0,e[0]),e[1]=Math.min(this.columnModel.getVisibleColumnModelList().length-1,e[1]))},_concatRowSpanIndexFromStart:function(t){var e,i=t.startIndex,n=t.endIndex,o=t.columnName,s=t.startRowSpanDataMap&&t.startRowSpanDataMap[o],a=t.startIndexList,l=t.endIndexList;s&&(s.isMainRow?(e=i+s.count-1,e>n&&l.push(e)):(e=i+s.count,a.push(e)))},_concatRowSpanIndexFromEnd:function(t){var e,i,n=t.endIndex,o=t.columnName,s=t.endRowSpanDataMap&&t.endRowSpanDataMap[o],a=t.endIndexList,l=t.dataModel;s&&(s.isMainRow?(e=n+s.count-1,a.push(e)):(e=n+s.count,i=l.at(e).getRowSpanData(o),e+=i.count-1,e>n&&a.push(e)))},_getRowSpannedIndex:function(t){var e,i,n,o,s=this.columnModel.getVisibleColumnModelList().slice(t.column[0],t.column[1]+1),a=this.dataModel,l=[t.row[0]],r=[t.row[1]],u=a.at(t.row[0]),d=a.at(t.row[1]),c=$.extend({},t);return u&&d?(e=a.at(t.row[0]).getRowSpanData(),i=a.at(t.row[1]).getRowSpanData(),_.each(s,function(s){n=s.columnName,o={columnName:n,startIndex:t.row[0],endIndex:t.row[1],endRowSpanDataMap:i,startRowSpanDataMap:e,startIndexList:l,endIndexList:r,dataModel:a},this._concatRowSpanIndexFromStart(o),this._concatRowSpanIndexFromEnd(o)},this),c.row=[Math.min.apply(null,l),Math.max.apply(null,r)],c):c}});e.exports=a},{"../base/model":5,"../common/util":10}],25:[function(t,e,i){"use strict";var n=t("../base/model"),o=(t("../common/util"),n.extend({initialize:function(t){n.prototype.initialize.apply(this,arguments)},defaults:{hasControlPanel:!1,hasPagination:!1,hasResizeHandler:!1,isExcelButtonVisible:!1,isExcelAllButtonVisible:!1,pagination:null},isVisible:function(){return this.get("hasControlPanel")||this.get("hasPagination")||this.get("hasResizeHandler")}}));e.exports=o},{"../base/model":5,"../common/util":10}],26:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").keyName,a=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setOwnProperties({_keyDownSwitch:$.extend({},this._defaultKeyDownSwitch)})},redrawAttributes:["isEditable","optionList","value"],template:_.template(''+t+""},getHtml:function(t){var e,i=o.getAttributesString(this.getAttributes(t));return e=this.template({columnName:t.columnName,rowSpan:t.rowSpan,className:this._getClassNameList(t).join(" "),editType:this.getEditType(),attributeString:i,contentHtml:this._getContentHtml(t)})},redraw:function(t,e){var i={"class":this._getClassNameList(t).join(" ")};t.rowSpan&&(i.rowSpan=t.rowSpan),i["edit-type"]=this.getEditType(),i=$.extend(i,this.getAttributes(t)),e.attr(i),e.html(this._getContentHtml(t))},_getCellData:function(t){var e=this._getCellAddress(t);return this.grid.renderModel.getCellData(e.rowKey,e.columnName)},_getCellAddress:function(t){return{rowKey:this.getRowKey(t),columnName:this.getColumnName(t)}},_getConvertedHtml:function(t,e){var i,n=this.getColumnModel(e),o=n.editOption;return o&&tui.util.isFunction(o.converter)&&(i=o.converter(t,this.grid.dataModel.get(e.rowKey).attributes)),tui.util.isFalsy(i)&&(i=null),i},getColumnName:function(t){return t.closest("td").attr("columnName")},getRowKey:function(t){return t.closest("tr").attr("key")},getColumnModel:function(t){return this.grid.columnModel.getColumnModel(t.columnName)},getAttributes:function(t){var e=this.getColumnModel(t);return{align:e.align||"left"}},focusOut:function(){this.grid.focusModel.focusClipboard()},getEditType:function(){return"normal"},focusIn:function(t){},getContentHtml:function(t){return""},setElementAttribute:function(t,e,i){}});e.exports=a},{"../base/painter":6,"../common/constMap":8,"../common/util":10}],27:[function(t,e,i){"use strict";var n=t("./list"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setKeyDownSwitch({UP_ARROW:function(){},DOWN_ARROW:function(){},PAGE_UP:function(){},PAGE_DOWN:function(){},ENTER:function(t,e){e.$target.trigger("click")},LEFT_ARROW:function(t,e){this._focusPrevInput(e.$target)},RIGHT_ARROW:function(t,e){this._focusNextInput(e.$target)},ESC:function(t,e){this.focusOut(e.$target)},TAB:function(t,e){t.shiftKey?this._focusPrevInput(e.$target)||this.grid.focusModel.focusIn(e.rowKey,e.focusModel.prevColumnName(),!0):this._focusNextInput(e.$target)||this.grid.focusModel.focusIn(e.rowKey,e.focusModel.nextColumnName(),!0)}})},eventHandler:{"change input":"_onChange","keydown input":"_onKeyDown"},getEditType:function(){return"button"},contentTemplate:_.template(' <% if (isDisabled) print("disabled"); %>/>'),labelTemplate:_.template(''),focusIn:function(t){t.find("input").eq(0).prop("disabled")?this.grid.focusModel.focusClipboard():t.find("input").eq(0).focus()},getContentHtml:function(t){var e,i=this.getOptionList(t),n=this.grid.columnModel.getColumnModel(t.columnName),s=t.value,a=(""+s).split(","),l={},r=this._getConvertedHtml(s,t),u=o.getUniqueKey(),d=t.isDisabled,c=n.editOption.type;return _.isNull(r)&&(r="",_.each(a,function(t){l[t]=!0}),_.each(i,function(t){e=u+"_"+t.value,r+=this.contentTemplate({type:c,name:u,id:e,value:t.value,isChecked:!!l[t.value],isDisabled:d}),t.text&&(r+=this.labelTemplate({id:e,labelText:t.text}))},this)),r},setElementAttribute:function(t,e){var i=t.value,n=(""+i).split(",");e.find("input:checked").prop("checked",!1),tui.util.forEachArray(n,function(t){e.find('input[value="'+t+'"]').prop("checked",!0)})},_focusNextInput:function(t){return this._focusTargetInput(t,"next")},_focusPrevInput:function(t){return this._focusTargetInput(t,"prev")},_focusTargetInput:function(t,e){var i,n=t,o=!1;"next"===e?i=function(t){return t.next()}:"prev"===e&&(i=function(t){return t.prev()});do n=i(n);while(n.length&&!n.is("input"));return n.length&&(n.focus(),o=!0),o},_getCheckedValueList:function(t){var e=t.closest("td").find("input:checked"),i=[];return tui.util.forEachArray(e,function(t,n){i.push(e.eq(n).val())}),i},_onChange:function(t){var e=$(t.target),i=this._getCellAddress(e);this.grid.dataModel.setValue(i.rowKey,i.columnName,this._getCheckedValueList(e).join(","))}});e.exports=s},{"../../common/util":10,"./list":28}],28:[function(t,e,i){"use strict";var n=t("../cell"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},redrawAttributes:["isDisabled","isEditable","optionList"],eventHandler:{},getEditType:function(){},focusIn:function(t){},getContentHtml:function(t){throw this.error("Implement getContentHtml(cellData, $target) method. On re-rendering")},setElementAttribute:function(t,e,i){throw this.error("Implement setElementAttribute(cellData, $target) method. ")},getOptionList:function(t){var e=this.grid.columnModel.getColumnModel(t.columnName);return t.optionList&&t.optionList.length?t.optionList:e.editOption.list}});e.exports=o},{"../cell":26}],29:[function(t,e,i){"use strict";var n=t("../cell"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setKeyDownSwitch({UP_ARROW:function(){},DOWN_ARROW:function(){},ENTER:function(t,e){this.focusOut(e.$target)},LEFT_ARROW:function(){},RIGHT_ARROW:function(){},ESC:function(){}})},redrawAttributes:["isDisabled","isEditable","optionList"],eventHandler:{mousedown:"_onMouseDown","change input":"_onChange","keydown input":"_onKeyDown"},contentTemplate:_.template(' <% if (isDisabled) print("disabled") %>/>'),getEditType:function(){return"_button"},getContentHtml:function(t){var e=t.isDisabled;return this.contentTemplate({type:this.grid.columnModel.get("selectType"),name:this.grid.id,isChecked:!!t.value,isDisabled:e})},focusIn:function(){},setElementAttribute:function(t,e){var i=e.find("input"),n=i.prop("checked");n!==!!t.value&&i.prop("checked",t.value)},toggle:function(t){var e=t.find("input");"checkbox"===this.grid.columnModel.get("selectType")&&e.prop("checked",!e.prop("checked"))},getAttributes:function(){return{align:"center"}},_onChange:function(t){var e=$(t.target),i=this.getRowKey(e);this.grid.dataModel.setValue(i,"_button",e.prop("checked"))},_onMouseDown:function(t){var e=$(t.target);e.is("input")||e.find("input").trigger("click")}});e.exports=o},{"../cell":26}],30:[function(t,e,i){"use strict";var n=t("../cell"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},getEditType:function(){return"normal"},getContentHtml:function(t){var e=t.columnName,i=this.grid.columnModel.getColumnModel(e),n=this.grid.dataModel.get(t.rowKey).getHTMLEncodedString(e),o=t.rowKey;return tui.util.isFunction(i.formatter)&&(n=i.formatter(n,this.grid.dataModel.get(o).toJSON(),i)),tui.util.isExisty(n)||(n=""),n},focusIn:function(){this.grid.focusModel.focusClipboard()},setElementAttribute:function(t,e,i){}});e.exports=o},{"../cell":26}],31:[function(t,e,i){"use strict";var n=t("./normal"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},redrawAttributes:[],getEditType:function(){return"_number"},getContentHtml:function(t){return t.value}});e.exports=o},{"./normal":30}],32:[function(t,e,i){"use strict";var n=t("./list"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setKeyDownSwitch({ESC:function(t,e){this.focusOut(e.$target)},ENTER:function(t,e){this.focusOut(e.$target)}})},eventHandler:{"change select":"_onChange","keydown select":"_onKeyDown"},contentTemplate:_.template(''),optionTemplate:_.template(''),getEditType:function(){return"select"},focusIn:function(t){t.find("select").prop("disabled")?this.grid.focusModel.focusClipboard():t.find("select").eq(0).focus()},getContentHtml:function(t){var e=this.getOptionList(t),i=t.isDisabled,n=this._getConvertedHtml(t.value,t),s="";return tui.util.isNull(n)&&(_.each(e,function(e){s+=this.optionTemplate({value:e.value,cellDataValue:t.value,text:e.text})},this),n=this.contentTemplate({name:o.getUniqueKey(),isDisabled:i,options:s})),n},_getContentHtml:function(t){var e,i,n=t.columnName,o=this.grid.columnModel.getColumnModel(n),s=o.editOption||{},a="";return tui.util.isExisty(t.value)||(t.value=o.defaultValue),e=this._getExtraContent(s.beforeContent||s.beforeText,t),i=this._getExtraContent(s.afterContent||s.afterText,t),e&&(a+=this._getSpanWrapContent(e,"before",t)),i&&(a+=this._getSpanWrapContent(i,"after",t)),a+=this._getSpanWrapContent(this.getContentHtml(t),"input")},setElementAttribute:function(t,e,i){var n=e.find("select");i&&n.blur(),n.val(t.value),i&&n.focus()},_onChange:function(t){var e=$(t.target),i=this._getCellAddress(e),n=this.grid;n.dataModel.setValue(i.rowKey,i.columnName,e.val())}});e.exports=s},{"../../common/util":10,"./list":28}],33:[function(t,e,i){"use strict";var n=t("../cell"),o=t("./text"),s=t("../../common/util"),a=t("../../common/formUtil"),l=tui.util.defineClass(o,{init:function(){o.apply(this,arguments),this.setOwnProperties({timeoutIdForClick:0,editingCell:{rowKey:null,columnName:""},clicked:{rowKey:null,columnName:null}})},redrawAttributes:["isDisabled","isEditable","value"],eventHandler:{dblclick:"_onDblClick",mousedown:"_onMouseDown","blur input":"_onBlurConvertible","keydown input":"_onKeyDown","focus input":"_onFocus","selectstart input":"_onSelectStart"},contentTemplate:_.template('/>'),getEditType:function(){return"text-convertible"},focusIn:function(t){this._startEdit(t)},focusOut:function(){this.grid.focusModel.focusClipboard()},getContentHtml:function(t){var e=this.getColumnModel(t),i=this.grid.dataModel.get(t.rowKey).getHTMLEncodedString(t.columnName);return tui.util.isUndefined(i)&&(i=""),this._isEditingCell(t)?this.contentTemplate({type:this._getInputType(),value:i,name:s.getUniqueKey(),isDisabled:t.isDisabled,maxLength:e.editOption.maxLength}):(tui.util.isFunction(e.formatter)&&(i=e.formatter(i,this.grid.dataModel.get(t.rowKey).attributes,e)),i)},_getContentHtml:function(t){var e;return e=this._isEditingCell(t)?o.prototype:n.prototype,e._getContentHtml.call(this,t)},_isEditingCell:function(t){var e=this.editingCell;return!(e.rowKey!==t.rowKey.toString()||e.columnName!==t.columnName.toString())},setElementAttribute:function(t,e,i){},_onBlurConvertible:function(t){var e=$(t.target),i=e.closest("td"),n=this.grid.focusModel;this._onBlur(t),this._endEdit(i),_.defer(function(){n.refreshState()})},_startEdit:function(t){var e,i,n,o;this._blurEditingCell(),i=this.getRowKey(t),n=this.getColumnName(t),o=this.grid.dataModel.get(i).getCellState(n),o.isEditable&&!o.isDisabled&&(this.editingCell={rowKey:i,columnName:n},this.redraw(this._getCellData(t),t),e=t.find("input"),this.originalText=e.val(),a.setCursorToEnd(e.get(0)),e.select())},_endEdit:function(t){var e=this._getCellData(t);this.editingCell={rowKey:null,columnName:null},this.clicked={rowKey:null,columnName:null},e&&this.redraw(e,t)},_blurEditingCell:function(){var t,e=this.editingCell.rowKey,i=this.editingCell.columnName;tui.util.isNull(e)||tui.util.isNull(i)||(t=this.grid.dataModel.getElement(e,i),t.find("input")[0].blur())},_onDblClick:function(t){var e=$(t.target),i=e.closest("td"),n=this._getCellAddress(i);this._isEditingCell(n)||this._startEdit(i)},_onMouseDown:function(t){$(t.target).is("input")&&t.stopPropagation()}});e.exports=l},{"../../common/formUtil":9,"../../common/util":10,"../cell":26,"./text":35}],34:[function(t,e,i){"use strict";var n=t("./text"),o=tui.util.defineClass(n,{init:function(t,e){n.apply(this,arguments)},_getInputType:function(){return"password"},getEditType:function(){return"text-password"}});e.exports=o},{"./text":35}],35:[function(t,e,i){"use strict";var n=t("../cell"),o=t("../../common/util"),s=t("../../common/formUtil"),a=tui.util.defineClass(n,{init:function(t,e){n.apply(this,arguments),this.setOwnProperties({originalText:""}),this.setKeyDownSwitch({UP_ARROW:function(){},DOWN_ARROW:function(){},PAGE_UP:function(){},PAGE_DOWN:function(){},ENTER:function(t,e){this.focusOut(e.$target.closest("td"))},ESC:function(t,e){this._restore(e.$target),this.focusOut(e.$target.closest("td"))}})},redrawAttributes:["isEditable"],eventHandler:{"blur input":"_onBlur","keydown input":"_onKeyDown","focus input":"_onFocus","selectstart input":"_onSelectStart"},contentTemplate:_.template('/>'),_getInputType:function(){return"text"},getEditType:function(){return"text"},focusIn:function(t){var e=t.find("input");e.prop("disabled")?this.grid.focusModel.focusClipboard():(s.setCursorToEnd(e.get(0)),e.select())},focusOut:function(){this.grid.focusModel.focusClipboard()},getContentHtml:function(t){var e,i=this.getColumnModel(t),n=i.editOption,s=this.grid.dataModel.get(t.rowKey).getHTMLEncodedString(t.columnName);return tui.util.isUndefined(s)&&(s=""),e=this._getConvertedHtml(s,t),tui.util.isNull(e)&&(e=this.contentTemplate({type:this._getInputType(),value:s,name:o.getUniqueKey(),isDisabled:t.isDisabled,maxLength:n.maxLength})),e},setElementAttribute:function(t,e){var i=-1!==$.inArray("value",t.changed),n=e.find("input");i&&n.val(t.value),n.prop("disabled",t.isDisabled)},_isEdited:function(t){return t.val()!==this.originalText},_restore:function(t){t.val(this.originalText)},_getContentHtml:function(t){var e,i,n=t.columnName,o=this.grid.columnModel.getColumnModel(n),s=o.editOption||{},a="";return tui.util.isExisty(t.value)||(t.value=o.defaultValue),e=this._getExtraContent(s.beforeContent||s.beforeText,t),i=this._getExtraContent(s.afterContent||s.afterText,t),e&&(a+=this._getSpanWrapContent(e,"before",t)),i&&(a+=this._getSpanWrapContent(i,"after",t)),a+=this._getSpanWrapContent(this.getContentHtml(t),"input")},_onBlur:function(t){var e=$(t.target),i=this.getRowKey(e),n=this.getColumnName(e);this._executeInputEventHandler(t,"blur"),this._isEdited(e)&&this.grid.dataModel.setValue(i,n,e.val()),this.grid.selectionModel.enable()},_onFocus:function(t){var e=$(t.target);this.originalText=e.val(),this._executeInputEventHandler(t,"focus"),this.grid.selectionModel.end()},_onKeyDown:function(t){this._executeInputEventHandler(t,"keydown"),n.prototype._onKeyDown.call(this,t)},_getCellInfoFromInput:function(t){var e=t.closest("td"),i=e.closest("tr");return{rowKey:i.attr("key"),columnName:e.attr("columnname")}},_executeInputEventHandler:function(t,e){var i=$(t.target),n=this._getCellInfoFromInput(i),o=this.grid.columnModel.getColumnModel(n.columnName),s=tui.util.pick(o,"editOption","inputEvents",e);return _.isFunction(s)?s(t,n):null},_onSelectStart:function(t){t.stopPropagation()}});e.exports=a},{"../../common/formUtil":9,"../../common/util":10,"../cell":26}],36:[function(t,e,i){"use strict";var n=t("./cell/mainButton"),o=t("./cell/number"),s=t("./cell/normal"),a=t("./cell/button"),l=t("./cell/select"),r=t("./cell/text"),u=t("./cell/text-convertible"),d=t("./cell/text-password"),c=t("./row"),h=tui.util.defineClass({init:function(t){this.modelManager=t.modelManager,this.cellPainters=this._createCellPainters(),this.rowPainter=this._createRowPainter()},_createCellPainters:function(){var t={},e={grid:this.modelManager},i=[new n(e),new o(e),new s(e),new a(e),new l(e),new r(e),new d(e),new u(e)];return _.each(i,function(e){t[e.getEditType()]=e}),t},_createRowPainter:function(){return new c({grid:this.modelManager,painterManager:this})},getCellPainter:function(t){var e=this.cellPainters[t];return e||(e="radio"===t||"checkbox"===t?this.cellPainters.button:this.cellPainters.normal),e},getCellPainters:function(){return this.cellPainters},getRowPainter:function(){return this.rowPainter}});e.exports=h},{"./cell/button":27,"./cell/mainButton":29,"./cell/normal":30,"./cell/number":31,"./cell/select":32,"./cell/text":35,"./cell/text-convertible":33,"./cell/text-password":34,"./row":37}],37:[function(t,e,i){"use strict";var n=t("../base/painter"),o=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.painterManager=t.painterManager},template:_.template('<%=contents%>'),onModelChange:function(t,e){_.each(t.changed,function(t,i){var n,o;"_extraData"!==i&&(n=this._getEditType(i,t),o=this.painterManager.getCellPainter(n),o.onModelChange(t,e))},this)},_getEditType:function(t,e){var i=this.grid.columnModel.getEditType(t);return e.isEditable||"_number"===t||(i="normal"),i},getHtml:function(t,e){var i="";return tui.util.isUndefined(t.get("rowKey"))?i:(_.each(e,function(e){var n,o,s=e.columnName,a=t.get(s);a&&a.isMainRow&&(n=this._getEditType(s,a),o=this.painterManager.getCellPainter(n),i+=o.getHtml(a))},this),this.template({key:t.get("rowKey"),height:this.grid.dimensionModel.get("rowHeight")+o._extraHeight,contents:i,className:""}))},"static":{_extraHeight:function(){var t=0;return tui.util.browser.msie&&7===tui.util.browser.version&&(t=-2),t}()}});e.exports=o},{"../base/painter":6}],38:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){this.publicObject=t},_listenAndPass:function(t,e){_.each(e,function(e){this.listenTo(t,e,_.bind(this._triggerOnPublic,this,e))},this)},_listenAndRename:function(t,e,i){this.listenTo(t,e,_.bind(this._triggerOnPublic,this,i))},_triggerOnPublic:function(t,e){this.publicObject.trigger(t,e)},listenToNetAddon:function(t){this._listenAndPass(t,["beforeRequest","response","successResponse","failResponse","errorResponse"])},listenToContainerView:function(t){this._listenAndPass(t,["click","dblclick","mousedown","clickCell","dblclickCell","mouseoverCell","mouseoutCell","rendered"])},listenToFocusModel:function(t){this._listenAndRename(t,"select","selectRow")}});_.extend(n.prototype,Backbone.Events),e.exports=n},{}],39:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").keyCode,a=n.extend({initialize:function(t){this.setOwnProperties({focusModel:t.focusModel,selectionModel:t.selectionModel,painterManager:t.painterManager,dimensionModel:t.dimensionModel,dataModel:t.dataModel,columnModel:t.columnModel,renderModel:t.renderModel,timeoutIdForKeyIn:0,isLocked:!1}),this.listenTo(this.focusModel,"focusClipboard",this._onFocus)},tagName:"textarea",className:"clipboard",events:{keydown:"_onKeyDown",blur:"_onBlur"},_onBlur:function(){var t=this.focusModel;_.defer(function(){t.refreshState()})},_onFocus:function(){this.$el.is(":focus")||(this.$el.focus(),this.focusModel.refreshState())},render:function(){return this},_lock:function(){clearTimeout(this.timeoutIdForKeyIn),this.isLocked=!0,this.timeoutIdForKeyIn=setTimeout($.proxy(this._unlock,this),10)},_unlock:function(){this.isLocked=!1},_onKeyDown:function(t){return this.isLocked?(t.preventDefault(),!1):(t.shiftKey&&(t.ctrlKey||t.metaKey)?this._keyInWithShiftAndCtrl(t):t.shiftKey?this._keyInWithShift(t):t.ctrlKey||t.metaKey?this._keyInWithCtrl(t):this._keyIn(t),void this._lock())},_keyIn:function(t){var e=this.focusModel,i=this.selectionModel,n=e.which(),a=n.rowKey,l=n.columnName,r=this.dimensionModel.getDisplayRowCount(),u=!0,d=t.keyCode||t.which;if(!o.isBlank(n.rowKey)){switch(d){case s.UP_ARROW:e.focus(e.prevRowKey(),l,!0);break;case s.DOWN_ARROW:e.focus(e.nextRowKey(),l,!0);break;case s.LEFT_ARROW:e.focus(a,e.prevColumnName(),!0);break;case s.RIGHT_ARROW:e.focus(a,e.nextColumnName(),!0);break;case s.PAGE_UP:e.focus(e.prevRowKey(r-1),l,!0);break;case s.PAGE_DOWN:e.focus(e.nextRowKey(r-1),l,!0);break;case s.HOME:e.focus(a,e.firstColumnName(),!0);break;case s.END:e.focus(a,e.lastColumnName(),!0);break;case s.SPACE:case s.ENTER:this._onEnterSpace(a,l);break;case s.DEL:this._del(a,l);break;case s.TAB:e.focusIn(a,e.nextColumnName(),!0);break;default:u=!1}u&&t.preventDefault(),i.end()}},_onEnterSpace:function(t,e){var i,n=this.columnModel.getEditType(e);"_button"===n?(i=this.cellFactory.getInstance(n),i.toggle(this.dataModel.getElement(t,e))):this.focusModel.focusIn(t,e)},_getIndexBeforeMove:function(){var t,e,i=this.focusModel.indexOf(),n=this.selectionModel.get("range"),o=_.extend({},i);return n&&(t=n.row,e=n.column,o.row=t[0],o.column=e[0],t[1]>i.row&&(o.row=t[1]),e[1]>i.column&&(o.column=e[1])),o},_keyInWithShift:function(t){var e,i,n,o,a=this.focusModel,l=this.dimensionModel,r=this.columnModel.getVisibleColumnModelList(),u=a.which(),d=l.getDisplayRowCount(),c=t.keyCode||t.which,h=this._getIndexBeforeMove(),m=!0,g=!0;switch(c){case s.UP_ARROW:h.row-=1;break;case s.DOWN_ARROW:h.row+=1;break;case s.LEFT_ARROW:h.column-=1;break;case s.RIGHT_ARROW:h.column+=1;break;case s.PAGE_UP:h.row=a.prevRowIndex(d-1);break;case s.PAGE_DOWN:h.row=a.nextRowIndex(d-1);break;case s.HOME:h.column=0;break;case s.END:h.column=r.length-1;break;case s.ENTER:g=!1;break;case s.TAB:g=!1,a.focusIn(u.rowKey,a.prevColumnName(),!0);break;default:g=!1,m=!1}e=r[h.column],n=!(!e||!this.dataModel.getRowData(h.row)),g&&n&&(this._updateSelectionByKeyIn(h.row,h.column),i=l.getScrollPosition(h.row,e.columnName),i&&(o=this.selectionModel.getState(),"column"===o?delete i.scrollTop:"row"===o&&delete i.scrollLeft,this.renderModel.set(i))),m&&t.preventDefault()},_keyInWithCtrl:function(t){var e=this.focusModel,i=t.keyCode||t.which;switch(i){case s.CHAR_A:this.selectionModel.selectAll();break;case s.CHAR_C:this._copyToClipboard();break;case s.HOME:e.focus(e.firstRowKey(),e.firstColumnName(),!0);break;case s.END:e.focus(e.lastRowKey(),e.lastColumnName(),!0);break;case s.CHAR_V:this._paste()}},_paste:function(){this._clearClipBoard(),this.pasting||(this.pasting=!0,this._onKeyupCharV())},_onKeyupCharV:function(){this.$el.on("keyup",$.proxy(this.onKeyupCharV,this))},onKeyupCharV:function(){this._pasteToGrid(),this.pasting=!1},_clearClipBoard:function(){this.$el.val("")},_pasteToGrid:function(){var t,e,i=this.selectionModel,n=this.focusModel,o=this.dataModel;t=i.hasSelection()?i.getStartIndex():n.indexOf(),e=this._getProcessClipBoardData(),this.$el.off("keyup"),o.paste(e,t)},_getProcessClipBoardData:function(){ -for(var t=this.$el.val(),e=t.split("\n"),i=0,n=e.length;n>i;i+=1)e[i]=e[i].split(" ");return e},_keyInWithShiftAndCtrl:function(t){var e=!0,i=this.columnModel.getVisibleColumnModelList(),n=t.keyCode||t.which;switch(n){case s.HOME:this._updateSelectionByKeyIn(0,0);break;case s.END:this._updateSelectionByKeyIn(this.dataModel.length-1,i.length-1);break;default:e=!1}e&&t.preventDefault()},_del:function(){var t,e,i,n=this.selectionModel,o=this.dataModel,s=this.focusModel.which(),a=this.columnModel.getVisibleColumnModelList(),l=s.rowKey,r=s.columnName;if(n.hasSelection()){for(t=n.get("range"),e=t.row[0];e").addClass("left_line"),$("
").addClass("right_line")]);this.$el.addClass("grid_wrapper uio_grid").attr("instanceId",this.gridId).append(t),this._refreshHeight(),this.trigger("rendered")},destroy:function(){this.stopListening(),$(window).off("resize.grid"),this._destroyChildren(),this.$el.replaceWith(this.__$el),this.$el=this.__$el=null}});e.exports=o},{"../base/view":7}],41:[function(t,e,i){"use strict";var n=t("./container"),o=t("./layout/toolbar"),s=t("./layout/toolbar/controlPanel"),a=t("./layout/toolbar/pagination"),l=t("./layout/toolbar/resizeHandler"),r=t("./stateLayer"),u=t("./clipboard"),d=t("./layout/frame-lside"),c=t("./layout/frame-rside"),h=t("./layout/header"),m=t("./layout/resizeHandler"),g=t("./layout/body"),f=t("./layout/bodyTable"),p=t("./rowList"),M=t("./selectionLayer"),_=tui.util.defineClass({init:function(t){this.modelManager=t.modelManager,this.painterManager=t.painterManager},createContainer:function(t){return new n({el:t.el,singleClickEdit:t.singleClickEdit,dataModel:this.modelManager.dataModel,dimensionModel:this.modelManager.dimensionModel,focusModel:this.modelManager.focusModel,gridId:this.modelManager.gridId,viewFactory:this})},createToolbar:function(){return new o({toolbarModel:this.modelManager.toolbarModel,dimensionModel:this.modelManager.dimensionModel,viewFactory:this})},createToolbarControlPanel:function(){return new s({gridId:this.modelManager.gridId,toolbarModel:this.modelManager.toolbarModel})},createToolbarPagination:function(){return new a({toolbarModel:this.modelManager.toolbarModel})},createToolbarResizeHandler:function(){return new l({dimensionModel:this.modelManager.dimensionModel})},createStateLayer:function(){return new r({dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel})},createClipboard:function(){return new u({columnModel:this.modelManager.columnModel,dataModel:this.modelManager.dataModel,dimensionModel:this.modelManager.dimensionModel,selectionModel:this.modelManager.selectionModel,focusModel:this.modelManager.focusModel,renderModel:this.modelManager.renderModel,painterManager:this.modelManager.painterManager})},createFrame:function(t){var e="L"===t?d:c;return new e({dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,viewFactory:this})},createHeader:function(t){return new h({whichSide:t,renderModel:this.modelManager.renderModel,dimensionModel:this.modelManager.dimensionModel,selectionModel:this.modelManager.selectionModel,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,viewFactory:this})},createHeaderResizeHandler:function(t){return new m({whichSide:t,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel})},createBody:function(t){return new g({whichSide:t,renderModel:this.modelManager.renderModel,dimensionModel:this.modelManager.dimensionModel,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,selectionModel:this.modelManager.selectionModel,focusModel:this.modelManager.focusModel,viewFactory:this})},createBodyTable:function(t){return new f({whichSide:t,dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,columnModel:this.modelManager.columnModel,painterManager:this.painterManager,viewFactory:this})},createRowList:function(t){return new p({el:t.el,whichSide:t.whichSide,bodyTableView:t.bodyTableView,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,focusModel:this.modelManager.focusModel,painterManager:this.painterManager})},createSelectionLayer:function(t){return new M({whichSide:t,selectionModel:this.modelManager.selectionModel,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel})}});e.exports=_},{"./clipboard":39,"./container":40,"./layout/body":42,"./layout/bodyTable":43,"./layout/frame-lside":44,"./layout/frame-rside":45,"./layout/header":47,"./layout/resizeHandler":48,"./layout/toolbar":49,"./layout/toolbar/controlPanel":50,"./layout/toolbar/pagination":51,"./layout/toolbar/resizeHandler":52,"./rowList":53,"./selectionLayer":54,"./stateLayer":55}],42:[function(t,e,i){"use strict";var n=t("../../base/view"),o='
',s=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({dimensionModel:t.dimensionModel,dataModel:t.dataModel,columnModel:t.columnModel,renderModel:t.renderModel,selectionModel:t.selectionModel,focusModel:t.focusModel,viewFactory:t.viewFactory,$container:null,whichSide:t&&t.whichSide||"R"}),this.listenTo(this.dimensionModel,"change:bodyHeight",this._onBodyHeightChange).listenTo(this.dataModel,"add remove reset",this._resetContainerHeight).listenTo(this.renderModel,"change:scrollTop",this._onScrollTopChange).listenTo(this.renderModel,"change:scrollLeft",this._onScrollLeftChange)},tagName:"div",className:"data",events:{scroll:"_onScroll","mousedown .body_container":"_onMouseDown","blur input, select":"_onBlurInput"},_onBodyHeightChange:function(t,e){this.$el.css("height",e+"px")},_resetContainerHeight:function(){this.$container.css({height:this.dimensionModel.get("totalRowHeight")})},_onScroll:function(t){var e={scrollTop:t.target.scrollTop};"R"===this.whichSide&&(e.scrollLeft=t.target.scrollLeft),this.renderModel.set(e)},_onScrollLeftChange:function(t,e){"R"===this.whichSide&&(this.el.scrollLeft=e)},_onScrollTopChange:function(t,e){this.el.scrollTop=e},_onMouseDown:function(t){var e,i=this.columnModel,n=$(t.target),o=n.is("input"),s=n.closest("td"),a=n.closest("tr"),l=s.attr("columnName"),r=a.attr("key"),u=this.dataModel.indexOfRowKey(r),d={columnName:l,column:i.indexOfColumnName(l,!0),row:u};!l||0>u?(_.extend(d,this.dimensionModel.getIndexFromMousePosition(t.pageX,t.pageY,!0)),e=i.getVisibleColumnModelList(null,!0),l=e[d.column].columnName,d.columnName=l,d.column=i.indexOfColumnName(l,!0)):"radio"===this.columnModel.get("selectType")&&this.dataModel.check(u),this._controlStartAction(t.pageX,t.pageY,t.shiftKey,d,o)},_onBlurInput:function(t){var e=this.focusModel;_.defer(function(){e.refreshState()})},_controlStartAction:function(t,e,i,n,o){var s=this.columnModel,a=this.selectionModel,l=n.columnName,r=n.column,u=n.row;a.isEnabled()&&(o||this._attachDragEvents(t,e),s.isMetaColumn(l)?"_number"===l?i?a.update(u,0,"row"):a.selectRow(u):this._detachDragEvents():(a.setState("cell"),i&&!o?a.update(u,r):(this.focusModel.focusAt(u,r),a.end())))},_attachDragEvents:function(t,e){this.setOwnProperties({mouseDownX:t,mouseDownY:e}),this.dimensionModel.refreshLayout(),$(document).on("mousemove",$.proxy(this._onMouseMove,this)).on("mouseup",$.proxy(this._detachDragEvents,this)).on("selectstart",$.proxy(this._onSelectStart,this))},_detachDragEvents:function(){this.selectionModel.stopAutoScroll(),$(document).off("mousemove",this._onMouseMove).off("mouseup",this._detachDragEvents).off("selectstart",this._onSelectStart)},_onMouseMove:function(t){var e=this.selectionModel,i=t.pageX,n=t.pageY,o=this._getMouseMoveDistance(i,n)>10;(e.hasSelection()||o)&&e.updateByMousePosition(i,n)},_getMouseMoveDistance:function(t,e){var i=Math.abs(this.mouseDownX-t),n=Math.abs(this.mouseDownY-e);return Math.round(Math.sqrt(Math.pow(i,2)+Math.pow(n,2)))},_onSelectStart:function(t){return t.preventDefault(),!1},render:function(){var t=this.whichSide;return this._destroyChildren(),this.dimensionModel.get("scrollX")||this.$el.css("overflow-x","hidden"),this.dimensionModel.get("scrollY")||"R"!==t||this.$el.css("overflow-y","hidden"),this.$el.css("height",this.dimensionModel.get("bodyHeight")),this.$container=$(o),this.$el.append(this.$container),this._addChildren([this.viewFactory.createBodyTable(t),this.viewFactory.createSelectionLayer(t)]),this.$container.append(this._renderChildren()),this._resetContainerHeight(),this}});e.exports=s},{"../../base/view":7}],43:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({dimensionModel:t.dimensionModel,renderModel:t.renderModel,columnModel:t.columnModel,viewFactory:t.viewFactory,painterManager:t.painterManager,whichSide:t.whichSide||"R"}),this.listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged),this._attachAllTableEventHandlers()},tagName:"div",className:"table_container",template:_.template('<%=colGroup%><%=tbody%>
'),_onColumnWidthChanged:function(){var t=this.dimensionModel.getColumnWidthList(this.whichSide),e=this.$el.find("col");_.each(t,function(t,i){e.eq(i).css("width",t-s.EXTRA_WIDTH)},this)},resetTablePosition:function(){this.$el.css("top",this.renderModel.get("top"))},render:function(){return this._destroyChildren(),this.$el.html(this.template({colGroup:this._getColGroupMarkup(),tbody:""})),this._addChildren(this.viewFactory.createRowList({bodyTableView:this,el:this.$el.find("tbody"),whichSide:this.whichSide})),this._renderChildren(),this},_attachTableEventHandler:function(t,e){_.each(e,function(e,i){this.$el.on(i,t+" "+e.selector,e.handler)},this)},_attachAllTableEventHandlers:function(){var t=this.painterManager.getRowPainter(),e=this.painterManager.getCellPainters();this._attachTableEventHandler("tr",t.getEventHandlerInfo()),_.each(e,function(t,e){var i="td[edit-type="+e+"]",n=t.getEventHandlerInfo();this._attachTableEventHandler(i,n)},this)},redrawTable:function(t){return this.$el[0].innerHTML=this.template({colGroup:this._getColGroupMarkup(),tbody:t}),this.$el.find("tbody")},_getColGroupMarkup:function(){var t=this.whichSide,e=this.dimensionModel.getColumnWidthList(t),i=this.columnModel.getVisibleColumnModelList(t,!0),n="";return _.each(i,function(t,i){var o=t.columnName,a=e[i]-s.EXTRA_WIDTH;n+=''}),n}},{EXTRA_WIDTH:o.isBrowserIE7()?20:0});e.exports=s},{"../../base/view":7,"../../common/util":10}],44:[function(t,e,i){"use strict";var n=t("./frame"),o=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"L"})},className:"lside_area",_onColumnWidthChanged:function(){this.$el.css({width:this.dimensionModel.get("lsideWidth")})},beforeRender:function(){this.$el.css({display:"block",width:this.dimensionModel.get("lsideWidth")})}});e.exports=o},{"./frame":46}],45:[function(t,e,i){"use strict";var n=t("./frame"),o=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"R",$scrollBorder:null}),this.listenTo(this.dimensionModel,"change:bodyHeight change:headerHeight",this._resetScrollBorderHeight)},className:"rside_area",_onColumnWidthChanged:function(){var t=this.dimensionModel;this.$el.css({width:t.get("rsideWidth"),marginLeft:t.get("lsideWidth")})},_resetScrollBorderHeight:function(){var t=this.dimensionModel,e=t.get("bodyHeight")-t.getScrollXHeight();this.$scrollBorder.height(e)},beforeRender:function(){var t=this.dimensionModel;this.$el.css({display:"block",width:t.get("rsideWidth"),marginLeft:t.get("lsideWidth")})},afterRender:function(){var t,e,i,n,o,s=this.dimensionModel;this.dimensionModel.get("scrollY")&&(n=s.get("headerHeight"),o=s.get("bodyHeight"),t=$("
").addClass("header_space"),e=$("
").addClass("scrollbar_border"),i=$("
").addClass("scrollbar_corner"),t.height(n-2),e.css("top",n+"px"),i.css("bottom",s.get("toolbarHeight")),this.$el.append(t,e,i),this.$scrollBorder=e,this._resetScrollBorderHeight())}});e.exports=o},{"./frame":46}],46:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({viewFactory:t.viewFactory,renderModel:t.renderModel,dimensionModel:t.dimensionModel,whichSide:t.whichSide||"R"}),this.listenTo(this.renderModel,"columnModelChanged",this.render,this).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged,this)},tagName:"div",className:"lside_area",render:function(){var t=this.viewFactory;return this._destroyChildren(),this.beforeRender(),this._addChildren([t.createHeader(this.whichSide),t.createBody(this.whichSide)]),this.$el.append(this._renderChildren()),this.afterRender(),this},_onColumnWidthChanged:function(){},beforeRender:function(){},afterRender:function(){}});e.exports=o},{"../../base/view":7}],47:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({renderModel:t.renderModel,dimensionModel:t.dimensionModel,selectionModel:t.selectionModel,columnModel:t.columnModel,dataModel:t.dataModel,viewFactory:t.viewFactory,timeoutForAllChecked:0,whichSide:t.whichSide||"R"}),this.listenTo(this.renderModel,"change:scrollLeft",this._onScrollLeftChange,this).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged,this).listenTo(this.dataModel,"change:_button",this._onCheckCountChange,this).listenTo(this.dataModel,"sortChanged",this._updateBtnSortState,this)},tagName:"div",className:"header",events:{click:"_onClick","mousedown th[columnName]":"_onMouseDown"},template:_.template(' <%=colGroup%><%=tBody%>
'),templateHeader:_.template(' 0) {%>colspan=<%=colspan%> <%}%><%if(rowspan > 0) {%>rowspan=<%=rowspan%> <%}%>><%=title%><%=btnSort%>'),templateCol:_.template(''),markupBtnSort:'',_getColGroupMarkup:function(){var t=this._getColumnData(),e=t.widthList,i=t.modelList,n=[];return _.each(e,function(t,e){n.push(this.templateCol({columnName:i[e].columnName,width:t}))},this),n.join("")},_onMouseDown:function(t){var e,i;this.selectionModel.isEnabled()&&!$(t.target).is("a.btn_sorting")&&(e=$(t.target).closest("th").attr("columnName"),i=this.columnModel.getUnitColumnNamesIfMerged(e),this._hasMetaColumn(i)||this._controlStartAction(i,t.pageX,t.pageY,t.shiftKey))},_controlStartAction:function(t,e,i,n){var o=this.columnModel,s=_.map(t,function(t){return o.indexOfColumnName(t,!0)});n?this._startColumnSelectionWithShiftKey(s,e,i):this._startColumnSelectionWithoutShiftKey(s),this._attachDragEvents()},_startColumnSelectionWithShiftKey:function(t,e,i){var n=this.selectionModel,o=Math.max.apply(null,t);n.update(0,o,"column"),n.extendColumnSelection(t,e,i)},_startColumnSelectionWithoutShiftKey:function(t){var e=this.selectionModel,i=o.getMinMax(t),n=i.min,s=i.max;e.setMinimumColumnRange([n,s]),e.selectColumn(n),e.update(0,s)},_attachDragEvents:function(){$(document).on("mousemove",$.proxy(this._onMouseMove,this)).on("mouseup",$.proxy(this._detachDragEvents,this)).on("selectstart",$.proxy(this._onSelectStart,this))},_detachDragEvents:function(){this.selectionModel.stopAutoScroll(),$(document).off("mousemove",this._onMouseMove).off("mouseup",this._detachDragEvents).off("selectstart",this._onSelectStart)},_onMouseMove:function(t){var e,i,n=this.columnModel,o=!0,s=$(t.target).closest("th").attr("columnName");s?(e=n.getUnitColumnNamesIfMerged(s),i=_.map(e,function(t){return n.indexOfColumnName(t,!0)})):$.contains(this.el,t.target)&&(o=!1),o&&this.selectionModel.extendColumnSelection(i,t.pageX,t.pageY)},_hasMetaColumn:function(t){var e=!1,i=this.columnModel;return tui.util.forEach(t,function(t){return i.isMetaColumn(t)?(e=!0,!1):void 0}),e},_onSelectStart:function(t){return t.preventDefault(),!1},_onCheckCountChange:function(){"checkbox"===this.columnModel.get("selectType")&&(clearTimeout(this.timeoutForAllChecked),this.timeoutForAllChecked=setTimeout($.proxy(this._syncCheckState,this),10))},_getHeaderMainCheckbox:function(){return this.$el.find('th[columnname="_button"] input')},_syncCheckState:function(){var t,e,i;this.columnModel&&"checkbox"===this.columnModel.get("selectType")&&(t=this._getHeaderMainCheckbox(),t.length&&(e=0,i=this.dataModel.getRowList(!0).length,this.dataModel.forEach(function(t){var i=t.getCellState("_button");!i.isDisabled&&i.isEditable&&(e+=1)},this),t.prop("checked",e===i)))},_onColumnWidthChanged:function(){var t=this._getColumnData(),e=t.widthList,i=this.$el.find("col");_.each(e,function(t,e){i.eq(e).css("width",t+"px")})},_onScrollLeftChange:function(t,e){"R"===this.whichSide&&(this.el.scrollLeft=e)},_onClick:function(t){var e=$(t.target),i=e.closest("th").attr("columnname");"_button"===i&&e.is("input")?e.prop("checked")?this.dataModel.checkAll():this.dataModel.uncheckAll():e.is("a.btn_sorting")&&this.dataModel.sortByField(i)},_updateBtnSortState:function(t){this._$currentSortBtn&&this._$currentSortBtn.removeClass("sorting_down sorting_up"),this._$currentSortBtn=this.$el.find("th[columnname="+t.columnName+"] a.btn_sorting"),this._$currentSortBtn.addClass(t.isAscending?"sorting_up":"sorting_down")},render:function(){return this._destroyChildren(),this.dimensionModel.get("scrollX")||this.$el.css("overflow-x","hidden"),this.dimensionModel.get("scrollY")||this.$el.css("overflow-y","hidden"),this.$el.css({height:this.dimensionModel.get("headerHeight")}).html(this.template({colGroup:this._getColGroupMarkup(),tBody:this._getTableBodyMarkup()})),this._addChildren(this.viewFactory.createHeaderResizeHandler(this.whichSide)),this.$el.append(this._renderChildren()),this},_getColumnData:function(){var t=this.columnModel,e=this.dimensionModel,i=e.getColumnWidthList(this.whichSide),n=t.getVisibleColumnModelList(this.whichSide,!0);return{widthList:i,modelList:n}},_getTableBodyMarkup:function(){var t,e,i=this._getColumnHierarchyList(),n=this._getHierarchyMaxRowCount(i),s=this.dimensionModel.get("headerHeight"),a=new Array(n),l=new Array(n),r=[],u=o.getRowHeight(n,s)-1,d=1;return _.each(i,function(e,o){var c=i[o].length,h=0;_.each(e,function(e,i){var o=e.columnName;d=c-1===i&&n-c+1>1?n-c+1:1,t=u*d,i===c-1?t=s-h-2:h+=t+1,l[i]===o?(a[i].pop(),r[i]+=1):r[i]=1,l[i]=o,a[i]=a[i]||[],a[i].push(this.templateHeader({columnName:o,height:t,colspan:r[i],rowspan:d,title:e.title,btnSort:e.isSortable?this.markupBtnSort:""}))},this)},this),e=_.map(a,function(t){return""+t.join("")+""}),e.join("")},_getHierarchyMaxRowCount:function(t){var e=[0];return _.each(t,function(t){e.push(t.length)},this),Math.max.apply(Math,e)},_getColumnHierarchyList:function(){var t,e=this._getColumnData().modelList;return t=_.map(e,function(t){return this._getColumnHierarchy(t).reverse()},this)},_getColumnHierarchy:function(t,e){var i=this.columnModel.get("columnMerge");return e=e||[],t&&(e.push(t),i&&_.each(i,function(i){-1!==$.inArray(t.columnName,i.columnNameList)&&this._getColumnHierarchy(i,e)},this)),e}});e.exports=s},{"../../base/view":7,"../../common/util":10}],48:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){this.setOwnProperties({dimensionModel:t.dimensionModel,columnModel:t.columnModel,whichSide:t.whichSide||"R",isResizing:!1,$target:null,differenceLeft:0,initialWidth:0,initialOffsetLeft:0,initialLeft:0}),this.listenTo(this.dimensionModel,"change:which columnWidthChanged",this._refreshHandlerPosition)},tagName:"div",className:"resize_handle_container",events:{"mousedown .resize_handle":"_onMouseDown","click .resize_handle":"_onClick"},template:_.template('
" style="<%=height%>" title="마우스 드래그를 통해 컬럼의 넓이를 변경할 수 있고,더블클릭을 통해 넓이를 초기화할 수 있습니다.">
'),_getColumnData:function(){var t=this.columnModel,e=this.dimensionModel,i=e.getColumnWidthList(this.whichSide),n=t.getVisibleColumnModelList(this.whichSide,!0);return{widthList:i,modelList:n}},_getResizeHandlerMarkup:function(){var t,e=this._getColumnData(),i=e.modelList,n=this.dimensionModel.get("headerHeight"),o=i.length;return t=_.map(i,function(t,e){return this.template({columnIndex:e,columnName:t.columnName,isLast:e+1===o,height:n})},this),t.join("")},render:function(){var t=this.dimensionModel.get("headerHeight"),e=this._getResizeHandlerMarkup();return this.$el.empty().show().html(e).css({marginTop:-t,height:t}),this._refreshHandlerPosition(),this},_refreshHandlerPosition:function(){var t,e,i,n=this._getColumnData(),o=n.widthList,s=this.$el.find(".resize_handle"),a=this.$el.parent().find("table:first"),l=!1,r=0,u=1;tui.util.forEachArray(s,function(n,d){t=s.eq(d),e=t.attr("columnname"),i=a.find('th[columnname="'+e+'"]').width(),tui.util.isExisty(i)?l=l||i!==o[d]:i=o[d],r+=i+u,t.css("left",r-3+"px")})},_isResizing:function(){return!!this.isResizing},_onMouseDown:function(t){this._startResizing(t)},_onClick:function(t){var e=$(t.target),i=parseInt(e.attr("columnindex"),10),n=e.data("isClicked");n?(this.dimensionModel.restoreColumnWidth(this._getHandlerColumnIndex(i)),this._clearClickedFlag(e),this._refreshHandlerPosition()):this._setClickedFlag(e)},_setClickedFlag:function(t){t.data("isClicked",!0),setTimeout($.proxy(this._clearClickedFlag,this,t),500)},_clearClickedFlag:function(t){t.data("isClicked",!1)},_onMouseUp:function(){this._stopResizing()},_onMouseMove:function(t){var e,i,n;this._isResizing()&&(t.preventDefault(),e=t.pageX-this.initialOffsetLeft,i=this._calculateWidth(t.pageX),n=parseInt(this.$target.attr("columnindex"),10),this.$target.css("left",e+"px"),this.dimensionModel.setColumnWidth(this._getHandlerColumnIndex(n),i),this._refreshHandlerPosition())},_calculateWidth:function(t){var e=t-this.initialOffsetLeft-this.initialLeft;return this.initialWidth+e},_getHandlerColumnIndex:function(t){return"R"===this.whichSide?t+this.columnModel.getVisibleColumnFixCount(!0):t},_startResizing:function(t){var e=this._getColumnData(),i=e.widthList,n=$(t.target);this.isResizing=!0,this.$target=n,this.initialLeft=parseInt(n.css("left").replace("px",""),10),this.initialOffsetLeft=this.$el.offset().left,this.initialWidth=i[n.attr("columnindex")],$("body").css("cursor","col-resize"),$(document).bind("mousemove",$.proxy(this._onMouseMove,this)).bind("mouseup",$.proxy(this._onMouseUp,this)),n[0].setCapture&&n[0].setCapture()},_stopResizing:function(){this.$target&&this.$target[0].releaseCapture&&this.$target[0].releaseCapture(),this.isResizing=!1,this.$target=null,this.initialLeft=0,this.initialOffsetLeft=0,this.initialWidth=0,$("body").css("cursor","default"),$(document).unbind("mousemove",$.proxy(this._onMouseMove,this)).unbind("mouseup",$.proxy(this._onMouseUp,this))},destroy:function(){this.stopListening(),this._stopResizing(),this.remove()}});e.exports=o},{"../../base/view":7}],49:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.toolbarModel=t.toolbarModel,this.dimensionModel=t.dimensionModel,this.viewFactory=t.viewFactory},tagName:"div",className:"toolbar",render:function(){var t=this.toolbarModel;return this._destroyChildren(),t.get("hasControlPanel")&&this._addChildren(this.viewFactory.createToolbarControlPanel()),t.get("hasResizeHandler")&&this._addChildren(this.viewFactory.createToolbarResizeHandler()),t.get("hasPagination")&&this._addChildren(this.viewFactory.createToolbarPagination()),this.$el.empty().append(this._renderChildren()),this._refreshHeight(),this},_refreshHeight:function(){var t=this.dimensionModel.get("toolbarHeight");this.$el.height(t),this.$el.toggle(!!t)}});e.exports=o},{"../../base/view":7}],50:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.setOwnProperties({gridId:t.gridId,toolbarModel:t.toolbarModel,$btnExcel:null,$btnExcelAll:null}),this.listenTo(this.toolbarModel,"change:isExcelButtonVisible change:isExcelAllButtonVisible",this.render)},events:{"click a.excel_download_button":"_onClickExcel"},tagName:"div",className:"btn_setup",templateExcelBtn:_.template('<%=text%>'),_onClickExcel:function(t){var e,i=tui.Grid.getInstanceById(this.gridId),n=i.getAddOn("Net");t.preventDefault(),n&&(e=$(t.target).closest("a"),e.hasClass("excel_page")?n.download("excel"):e.hasClass("excel_all")&&n.download("excelAll"))},render:function(){var t=this.toolbarModel;return this.$el.empty(),t.get("isExcelButtonVisible")&&this.$el.append(this.templateExcelBtn({className:"excel_page",text:"엑셀 다운로드"})),t.get("isExcelAllButtonVisible")&&this.$el.append(this.templateExcelBtn({className:"excel_all",text:"전체 엑셀 다운로드"})),this}});e.exports=o},{"../../../base/view":7}],51:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.toolbarModel=t.toolbarModel},tagName:"div",className:"grid_pagination",template:_.template('FirstPrev LastFirst OffPrev OffNext OffLast Off'),render:function(){return this._destroyChildren(),this.$el.empty().html(this.template()),this._setPaginationInstance(),this},_setPaginationInstance:function(){var t=tui&&tui.component&&tui.component.Pagination,e=this.toolbarModel.get("pagination");!e&&t&&(e=new t({itemCount:1,itemPerPage:1,pagePerPageList:5,isCenterAlign:!0,moveUnit:"page",$preOff:this.$el.find(".pre_off"),$pre_endOff:this.$el.find(".pre_end_off"),$nextOff:this.$el.find(".next_off"),$lastOff:this.$el.find(".next_end_off")},this.$el)),this.toolbarModel.set("pagination",e)}});e.exports=o},{"../../../base/view":7}],52:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.timeoutIdForResize=0},tagName:"div",className:"height_resize_bar",template:_.template(''),events:{mousedown:"_onMouseDown"},_attachMouseEvent:function(){$(document).on("mousemove",$.proxy(this._onMouseMove,this)),$(document).on("mouseup",$.proxy(this._onMouseUp,this)),$(document).on("selectstart",$.proxy(this._onSelectStart,this))},_detachMouseEvent:function(){$(document).off("mousemove",$.proxy(this._onMouseMove,this)),$(document).off("mouseup",$.proxy(this._onMouseUp,this)),$(document).off("selectstart",$.proxy(this._onSelectStart,this))},_onMouseDown:function(t){t.preventDefault(),$(document.body).css("cursor","row-resize"),this.dimensionModel.refreshLayout(),this._attachMouseEvent()},_onMouseMove:function(t){var e=this.dimensionModel,i=e.get("offsetTop"),n=e.get("headerHeight"),o=e.get("rowHeight"),s=e.get("toolbarHeight"),a=t.pageY-i-n-s;clearTimeout(this.timeoutIdForResize),a=Math.max(a,o+e.getScrollXHeight()),this.timeoutIdForResize=setTimeout(function(){e.set({bodyHeight:a})},0)},_onMouseUp:function(){$(document.body).css("cursor","default"),this._detachMouseEvent()},_onSelectStart:function(t){return t.preventDefault(),!1},render:function(){return this._destroyChildren(),this.$el.html(this.template()),this},destroy:function(){this.stopListening(),this._onMouseUp(),this._destroyChildren(),this.remove()}});e.exports=o},{"../../../base/view":7}],53:[function(t,e,i){"use strict";var n=t("../base/view"),o=n.extend({initialize:function(t){var e=t.focusModel,i=t.renderModel,n=t.whichSide||"R";this.setOwnProperties({whichSide:n,bodyTableView:t.bodyTableView,focusModel:e,renderModel:i,dataModel:t.dataModel,columnModel:t.columnModel,collection:i.getCollection(n),painterManager:t.painterManager,sortOptions:null,renderedRowKeys:null}),this._focusClipboardDebounced=_.debounce(this._focusClipboard,10),this.listenTo(this.collection,"change",this._onModelChange).listenTo(e,"select",this._onSelect).listenTo(e,"unselect",this._onUnselect).listenTo(e,"focus",this._onFocus).listenTo(e,"blur",this._onBlur).listenTo(e,"focusIn",this._onFocusIn).listenTo(i,"rowListChanged",this.render); -},_getColumnModelList:function(){return this.columnModel.getVisibleColumnModelList(this.whichSide,!0)},_removeOldRows:function(t){var e=_.indexOf(this.renderedRowKeys,t[0]),i=_.indexOf(this.renderedRowKeys,_.last(t)),n=this.$el.children("tr");n.slice(0,e).remove(),n.slice(i+1).remove()},_appendNewRows:function(t,e){var i=this.collection.slice(0,_.indexOf(t,e[0])),n=this.collection.slice(_.indexOf(t,_.last(e))+1);this.$el.prepend(this._getRowsHtml(i)),this.$el.append(this._getRowsHtml(n))},_resetRows:function(){var t,e=this._getRowsHtml(this.collection.models);if(o.isInnerHtmlOfTbodyReadOnly)t=this.bodyTableView.redrawTable(e),this.setElement(t,!1),tui.util.browser.msie&&tui.util.browser.version<=7&&t.width(t.width());else try{this.$el[0].innerHTML=e}catch(i){o.isInnerHtmlOfTbodyReadOnly=!0,this._resetRows()}},_getRowsHtml:function(t){var e=this.painterManager.getRowPainter(),i=this._getColumnModelList();return _.map(t,function(t){return e.getHtml(t,i)}).join("")},_focusClipboard:function(){try{this.focusModel.focusClipboard()}catch(t){}},_getRowElement:function(t){return this.$el.find('tr[key="'+t+'"]')},_onSelect:function(t){this._setCssSelect(t.rowKey,!0)},_onUnselect:function(t){this._setCssSelect(t,!1)},_setCssSelect:function(t,e){var i,n,o,s,a=this._getColumnModelList(),l={};_.each(a,function(a){i=a.columnName,n=this.dataModel.getMainRowKey(t,i),l[n]=l[n]||this._getRowElement(n),o=l[n],s=o.find('td[columnname="'+i+'"]'),s.length&&s.toggleClass("selected",e)},this)},_onBlur:function(t,e){var i=this.dataModel.getElement(t,e);i.length&&i.removeClass("focused")},_onFocus:function(t,e){var i=this.dataModel.getElement(t,e);i.length&&i.addClass("focused")},_onFocusIn:function(t,e){var i,n,o,s=this.columnModel.isLside(e)?"L":"R";s===this.whichSide&&(i=this.dataModel.getElement(t,e),n=this.columnModel.getEditType(e),o=this.painterManager.getCellPainter(n),o.focusIn(i))},render:function(t){var e,i=this.collection.pluck("rowKey");return this.bodyTableView.resetTablePosition(),t?this._resetRows():(e=_.intersection(i,this.renderedRowKeys),_.isEmpty(i)||_.isEmpty(e)||e.length/i.length<.7?this._resetRows():(this._removeOldRows(e),this._appendNewRows(i,e))),this.renderedRowKeys=i,this._focusClipboardDebounced(),this},_onModelChange:function(t){var e=this._getRowElement(t.get("rowKey"));this.painterManager.getRowPainter().onModelChange(t,e)}},{isInnerHtmlOfTbodyReadOnly:tui.util.browser.msie&&tui.util.browser.version<=9});e.exports=o},{"../base/view":7}],54:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=1,a=n.extend({initialize:function(t){this.setOwnProperties({whichSide:t.whichSide||"R",dimensionModel:t.dimensionModel,columnModel:t.columnModel,selectionModel:t.selectionModel}),this._updateColumnWidthList(),this.listenTo(this.dimensionModel,"columnWidthChanged",this._onChangeColumnWidth),this.listenTo(this.selectionModel,"change:range",this.render)},tagName:"div",className:"selection_layer",_updateColumnWidthList:function(){this.columnWidthList=this.dimensionModel.getColumnWidthList(this.whichSide)},_onChangeColumnWidth:function(){this._updateColumnWidthList(),this.render()},_getOwnSideColumnRange:function(t){var e=this.columnModel.getVisibleColumnFixCount(),i=null;return"L"===this.whichSide?t[0]=e&&(i=[Math.max(t[0],e)-e,t[1]-e]),i},_getVerticalStyles:function(t){var e=this.dimensionModel.get("rowHeight"),i=o.getHeight(t[0],e)-s,n=o.getHeight(t[1]-t[0]+1,e)-2*s;return{top:i+"px",height:n+"px"}},_getHorizontalStyles:function(t){var e=this.columnWidthList,i=this.columnModel.getVisibleMetaColumnCount(),n=t[0],o=t[1],a=0,l=0,r=0;for("L"===this.whichSide&&(n+=i,o+=i),o=Math.min(o,e.length-1);o>=r;r+=1)n>r?a+=e[r]+s:l+=e[r]+s;return l-=s,{left:a+"px",width:l+"px"}},render:function(){var t,e,i=this.selectionModel.get("range");return i&&(e=this._getOwnSideColumnRange(i.column)),e?(t=_.assign({},this._getVerticalStyles(i.row),this._getHorizontalStyles(e)),this.$el.show().css(t)):this.$el.hide(),this}});e.exports=a},{"../base/view":7,"../common/util":10}],55:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").renderState,s=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.renderModel=t.renderModel,this.listenTo(this.dimensionModel,"change",this._refreshLayout),this.listenTo(this.renderModel,"change:state",this.render)},className:"state_layer",template:_.template('
<%= text %> <% if (isLoading) { %>
<% } %>
'),render:function(){var t=this.renderModel.get("state");return t===o.DONE?this.$el.hide():(this.$el.html(this.template({text:this._getMessage(t),isLoading:t===o.LOADING})).show(),this._refreshLayout()),this},_getMessage:function(t){switch(t){case o.LOADING:return"요청을 처리 중입니다.";case o.EMPTY:return this.renderModel.get("emptyMessage")||"데이터가 존재하지 않습니다.";default:return null}},_refreshLayout:function(){var t=this.dimensionModel;this.$el.css({marginTop:t.get("headerHeight"),height:t.get("bodyHeight")+t.get("toolbarHeight")})}});e.exports=s},{"../base/view":7,"../common/constMap":8}]},{},[12]); \ No newline at end of file +!function t(e,i,n){function o(a,l){if(!i[a]){if(!e[a]){var r="function"==typeof require&&require;if(!l&&r)return r(a,!0);if(s)return s(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var d=i[a]={exports:{}};e[a][0].call(d.exports,function(t){var i=e[a][1][t];return o(i?i:t)},d,d.exports,t,e,i,n)}return i[a].exports}for(var s="function"==typeof require&&require,a=0;a0?i=confirm(this._getConfirmMessage(t,e)):alert(this._getConfirmMessage(t,e)),i},_getConfirmMessage:function(t,e){var i,n={createData:"입력",updateData:"수정",deleteData:"삭제",modifyData:"반영"},o=n[t];return i=e>0?e+"건의 데이터를 "+o+"하시겠습니까?":o+"할 데이터가 없습니다."},_ajax:function(t){var e,i=this.createEventData(t.data);this.trigger("beforeRequest",i),i.isStopped()||(t=$.extend({requestType:""},t),e={url:t.url,data:t.data||{},type:t.type||"POST",dataType:t.dataType||"json",complete:$.proxy(this._onComplete,this,t.complete,t),success:$.proxy(this._onSuccess,this,t.success,t),error:$.proxy(this._onError,this,t.error,t)},t.url&&$.ajax(e))},_onComplete:function(t,e,i){this._unlock()},_onSuccess:function(t,e,i,n,o){var s=i&&i.message,a=this.createEventData({httpStatus:n,requestType:e.requestType,requestParameter:e.data,responseData:i});if(this.trigger("response",a),!a.isStopped())if(i&&i.result){if(this.trigger("successResponse",a),a.isStopped())return;_.isFunction(t)&&t(i.data||{},n,o)}else{if(this.trigger("failResponse",a),a.isStopped())return;s&&alert(s)}},_onError:function(t,e,i,n){var o=this.createEventData({httpStatus:n,requestType:e.requestType,requestParameter:e.data,responseData:null});this.renderModel.set("state",l.DONE),this.trigger("response",o),o.isStopped()||(this.trigger("errorResponse",o),o.isStopped()||i.readyState>1&&alert("데이터 요청 중에 에러가 발생하였습니다.\n\n다시 시도하여 주시기 바랍니다."))}});e.exports=r},{"../base/view":7,"../common/constMap":8,"../common/formUtil":9,"../common/util":10,"./net-router":1}],3:[function(t,e,i){"use strict";var n=t("./common"),o=Backbone.Collection.extend({initialize:function(t,e){},clear:function(){return this.each(function(t){t.stopListening(),t=null}),this.reset([],{silent:!0}),this}});_.assign(o.prototype,n),e.exports=o},{"./common":4}],4:[function(t,e,i){"use strict";var n={setOwnProperties:function(t){_.each(t,function(t,e){this[e]=t},this)}};e.exports=n},{}],5:[function(t,e,i){"use strict";var n=t("./common"),o=Backbone.Model.extend({initialize:function(t){}});_.assign(o.prototype,n),e.exports=o},{"./common":4}],6:[function(t,e,i){"use strict";var n=t("./common"),o=tui.util.defineClass({init:function(t){var e=t&&t.grid||this.collection&&this.collection.grid||null;this.setOwnProperties({grid:e}),this.initializeEventHandler()},eventHandler:{},initializeEventHandler:function(){var t={};_.each(this.eventHandler,function(e,i){var n=i.split(" "),o=n[0],s=n[1]||"";t[o]={selector:s,handler:$.proxy(this[e],this)}},this),this.setOwnProperties({_eventHandler:t})},getEventHandlerInfo:function(){return this._eventHandler},getHtml:function(){throw this.error("implement getHtml() method")}});_.assign(o.prototype,n),e.exports=o},{"./common":4}],7:[function(t,e,i){"use strict";var n=t("./common"),o=Backbone.View.extend({initialize:function(t){this._children=[]},error:function(t){var e=function(){this.name="Grid Exception",this.message=t||"error"};return e.prototype=new Error,new e},_addChildren:function(t){_.isArray(t)||(t=[t]),[].push.apply(this._children,t)},_renderChildren:function(){var t=_.map(this._children,function(t){return t.render().el});return t},destroy:function(){this.stopListening(),this._destroyChildren(),this.remove()},createEventData:function(t){var e=$.extend({},t);return e.stop=function(){this._isStopped=!0},e.isStopped=function(){return this._isStopped},e._isStopped=e._isStopped||!1,e},_destroyChildren:function(){if(this._children)for(;this._children.length>0;)this._children.pop().destroy()}});_.assign(o.prototype,n),e.exports=o},{"./common":4}],8:[function(t,e,i){"use strict";var n={TAB:9,ENTER:13,CTRL:17,ESC:27,LEFT_ARROW:37,UP_ARROW:38,RIGHT_ARROW:39,DOWN_ARROW:40,CHAR_A:65,CHAR_C:67,CHAR_F:70,CHAR_R:82,CHAR_V:86,LEFT_WINDOW_KEY:91,F5:116,BACKSPACE:8,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,DEL:46,UNDEFINED:229};e.exports={keyCode:n,keyName:_.invert(n),renderState:{LOADING:"LOADING",DONE:"DONE",EMPTY:"EMPTY"},dimension:{CELL_BORDER_WIDTH:1,TABLE_BORDER_WIDTH:1}}},{}],9:[function(t,e,i){"use strict";var n={setInput:{_changeToStringInArray:function(t){return _.each(t,function(e,i){t[i]=String(e)}),t},radio:function(t,e){t.checked=t.value===e},checkbox:function(t,e){_.isArray(e)?t.checked=-1!==$.inArray(t.value,this._changeToStringInArray(e)):t.checked=t.value===e},"select-one":function(t,e){var i=tui.util.toArray(t.options);tui.util.forEach(i,function(i,n){return i.value===e||i.text===e?(t.selectedIndex=n,!1):void 0})},"select-multiple":function(t,e){var i=tui.util.toArray(t.options);_.isArray(e)?(e=this._changeToStringInArray(e),_.each(i,function(t){t.selected=-1!==$.inArray(t.value,e)||-1!==$.inArray(t.text,e)})):this["select-one"].apply(this,arguments)},defaultAction:function(t,e){t.value=e}},getFormData:function(t){var e={},i=t.serializeArray(),n=tui.util.isExisty;return _.each(i,function(t){var i=t.value||"",o=t.name;n(e[o])?e[o]=[].concat(e[o],i):e[o]=i}),e},getFormElement:function(t,e){var i;return t&&t.length&&(i=e?t.prop("elements")[e+""]:t.prop("elements")),$(i)},setFormData:function(t,e){_.each(e,function(e,i){this.setFormElementValue(t,i,e)},this)},setFormElementValue:function(t,e,i){var n,o=this.getFormElement(t,e);o.length&&(_.isArray(i)||(i=String(i)),o=tui.util.isHTMLTag(o)?[o]:o,o=tui.util.toArray(o),_.each(o,function(t){n=this.setInput[t.type]?t.type:"defaultAction",this.setInput[n](t,i)},this))},setCursorToEnd:function(t){var e,i=t.value.length;if(t.focus(),t.setSelectionRange)try{t.setSelectionRange(i,i)}catch(n){}else if(t.createTextRange){e=t.createTextRange(),e.collapse(!0),e.moveEnd("character",i),e.moveStart("character",i);try{e.select()}catch(n){}}}};e.exports=n},{}],10:[function(t,e,i){"use strict";var n={uniqueId:0,getAttributesString:function(t){var e="";return _.each(t,function(t,i){e+=" "+i+'="'+t+'"'},this),e},sum:function(t){return _.reduce(t,function(t,e){return t+=e},0)},getMinMax:function(t){return{min:Math.min.apply(null,t),max:Math.max.apply(null,t)}},getHeight:function(t,e){return 0===t?t:t*(e+1)+1},getDisplayRowCount:function(t,e){return Math.ceil((t-1)/(e+1))},getRowHeight:function(t,e){return 0===t?0:Math.floor((e-1)/t)-1},isEqual:function(t,e){var i,n=function(t,e){var i=!1;return tui.util.forEach(t,function(t,n){return i=t===e[n]}),i};return typeof t!=typeof e?!1:_.isArray(t)&&t.length!==e.length?!1:_.isObject(t)?(i=!n(t,e)||!n(e,t),!i):t!==e?!1:!0},isBlank:function(t){return _.isString(t)?!t.length:void 0===t||null===t},stripTags:function(t){var e;return t=t.replace(/[\n\r\t]/g,""),tui.util.hasEncodableString(t)&&(/]*\ssrc=[\"']?([^>\"']+)[\"']?[^>]*>/i),t=e?e[1]:""):t=t.replace(//gi,""),t=$.trim(tui.util.decodeHTMLEntity(t.replace(/<\/?(?:h[1-5]|[a-z]+(?:\:[a-z]+)?)[^>]*>/gi,"")))),t},getUniqueKey:function(){return this.uniqueId+=1,this.uniqueId},toQueryString:function(t){var e=[];return _.each(t,function(t,i){_.isString(t)||_.isNumber(t)||(t=$.toJSON(t)),t=encodeURIComponent(t),t&&e.push(i+"="+t)}),e.join("&")},toQueryObject:function(t){var e=t.split("&"),i={};return _.each(e,function(t){var e,n,o=t.split("=");e=o[0],n=decodeURIComponent(o[1]);try{n=$.parseJSON(n)}catch(s){}_.isNull(n)||(i[e]=n)}),i},convertValueType:function(t,e){return"string"===e?t.toString():"number"===e?+t:t},toUpperCaseFirstLetter:function(t){return t.charAt(0).toUpperCase()+t.slice(1)},clamp:function(t,e,i){var n;return e>i&&(n=e,e=i,i=n),Math.max(e,Math.min(t,i))},isBrowserIE7:function(){var t=tui.util.browser;return t.msie&&7===t.version}};e.exports=n},{}],11:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){this.$el=t},getElement:function(t,e){return this.$el.find('tr[key="'+t+'"]').find('td[columnname="'+e+'"]')},getOffset:function(){return this.$el.offset()},getWidth:function(){return this.$el.width()},getParentHeight:function(){return this.$el.parent().height()},hasFocusedElement:function(){return!!this.$el.find(":focus").length}});e.exports=n},{}],12:[function(t,e,i){"use strict";var n=t("./base/view"),o=t("./model/manager"),s=t("./view/factory"),a=t("./domState"),l=t("./publicEventEmitter"),r=t("./painter/manager"),u=t("./addon/net"),d=t("./common/util"),h={};tui=window.tui=tui||{},tui.Grid=n.extend({initialize:function(t){this.id=d.getUniqueKey(),this.modelManager=this._createModelManager(t),this.painterManager=this._createPainterManager(),this.container=this._createContainerView(t),this.publicEventEmitter=this._createPublicEventEmitter(),this.container.render(),this.refreshLayout(),this.addOn={},h[this.id]=this},_createModelManager:function(t){var e=new a(this.$el),i=_.assign({},t,{gridId:this.id});return _.omit(i,"el","singleClickEdit"),new o(i,e)},_createPainterManager:function(){return new r({modelManager:this.modelManager})},_createContainerView:function(t){var e=new s({modelManager:this.modelManager,painterManager:this.painterManager});return e.createContainer({el:this.$el,singleClickEdit:t.singleClickEdit})},_createPublicEventEmitter:function(){var t=new l(this);return t.listenToFocusModel(this.modelManager.focusModel),t.listenToContainerView(this.container),t},disable:function(){this.modelManager.dataModel.setDisabled(!0)},enable:function(){this.modelManager.dataModel.setDisabled(!1)},disableRow:function(t){this.modelManager.dataModel.disableRow(t)},enableRow:function(t){this.modelManager.dataModel.enableRow(t)},getValue:function(t,e,i){return this.modelManager.dataModel.getValue(t,e,i)},getColumnValues:function(t,e){return this.modelManager.dataModel.getColumnValues(t,e)},getRow:function(t,e){return this.modelManager.dataModel.getRowData(t,e)},getRowAt:function(t,e){return this.modelManager.dataModel.getRowDataAt(t,e)},getRowCount:function(){return this.modelManager.dataModel.length},getSelectedRowKey:function(){return this.modelManager.focusModel.which().rowKey},getElement:function(t,e){return this.modelManager.dataModel.getElement(t,e)},setValue:function(t,e,i){this.modelManager.dataModel.setValue(t,e,i)},setColumnValues:function(t,e,i){this.modelManager.dataModel.setColumnValues(t,e,i)},replaceRowList:function(t){this.modelManager.dataModel.replaceRowList(t)},setRowList:function(t,e){this.modelManager.dataModel.setRowList(t,!0,e)},focus:function(t,e,i){this.modelManager.focusModel.focusClipboard(),this.modelManager.focusModel.focus(t,e,i)},focusAt:function(t,e,i){this.modelManager.focusModel.focusAt(t,e,i)},focusIn:function(t,e,i){this.modelManager.focusModel.focusIn(t,e,i)},focusInAt:function(t,e,i){this.modelManager.focusModel.focusInAt(t,e,i)},readyForKeyControl:function(){this.modelManager.focusModel.focusClipboard()},blur:function(){this.modelManager.focusModel.blur()},checkAll:function(){this.modelManager.dataModel.checkAll()},check:function(t){this.modelManager.dataModel.check(t)},uncheckAll:function(){this.modelManager.dataModel.uncheckAll()},uncheck:function(t){this.modelManager.dataModel.uncheck(t)},clear:function(){this.modelManager.dataModel.setRowList([])},removeRow:function(t,e){tui.util.isBoolean(e)&&e&&(e={removeOriginalData:!0}),this.modelManager.dataModel.removeRow(t,e)},removeCheckedRows:function(t){var e=this.getCheckedRowKeyList(),i=e.length+"건의 데이터를 삭제하시겠습니까?";return e.length>0&&(!t||confirm(i))?(_.each(e,function(t){this.modelManager.dataModel.removeRow(t)},this),!0):!1},enableCheck:function(t){this.modelManager.dataModel.enableCheck(t)},disableCheck:function(t){this.modelManager.dataModel.disableCheck(t)},getCheckedRowKeyList:function(t){var e=this.modelManager.dataModel.getRowList(!0),i=_.pluck(e,"rowKey");return t?$.toJSON(i):i},getCheckedRowList:function(t){var e=this.modelManager.dataModel.getRowList(!0);return t?$.toJSON(e):e},getColumnModelList:function(){return this.modelManager.columnModel.get("dataColumnModelList")},getModifiedRowList:function(t){return this.modelManager.dataModel.getModifiedRowList(t)},appendRow:function(t,e){this.modelManager.dataModel.append(t,e)},prependRow:function(t,e){this.modelManager.dataModel.prepend(t,e)},isChanged:function(){return this.modelManager.dataModel.isChanged()},getAddOn:function(t){return t?this.addOn[t]:this.addOn},restore:function(){this.modelManager.dataModel.restore()},select:function(t){this.modelManager.focusModel.select(t)},unselect:function(){this.modelManager.focusModel.unselect(!0)},setColumnFixCount:function(t){this.modelManager.columnModel.set("columnFixCount",t)},setColumnModelList:function(t){this.modelManager.columnModel.set("columnModelList",t)},use:function(t,e){return"Net"===t&&(e=$.extend({toolbarModel:this.modelManager.toolbarModel,renderModel:this.modelManager.renderModel,dataModel:this.modelManager.dataModel},e),this.addOn.Net=new u(e),this.publicEventEmitter.listenToNetAddon(this.addOn.Net)),this},getRowList:function(){return this.modelManager.dataModel.getRowList()},sort:function(t){this.modelManager.dataModel.sortByField(t)},unSort:function(){this.sort("rowKey")},addCellClassName:function(t,e,i){this.modelManager.dataModel.get(t).addCellClassName(e,i)},addRowClassName:function(t,e){this.modelManager.dataModel.get(t).addClassName(e)},removeCellClassName:function(t,e,i){this.modelManager.dataModel.get(t).removeCellClassName(e,i)},removeRowClassName:function(t,e){this.modelManager.dataModel.get(t).removeClassName(e)},getRowSpanData:function(t,e){return this.modelManager.dataModel.getRowSpanData(t,e)},getIndexOfRow:function(t){return this.modelManager.dataModel.indexOfRowKey(t)},setDisplayRowCount:function(t){this.modelManager.dimensionModel.set("displayRowCount",t)},setSize:function(t,e){this.modelManager.dimensionModel.setSize(t,e)},refreshLayout:function(){this.modelManager.dimensionModel.refreshLayout()},showColumn:function(){var t=tui.util.toArray(arguments);this.modelManager.columnModel.setHidden(t,!1)},hideColumn:function(){var t=tui.util.toArray(arguments);this.modelManager.columnModel.setHidden(t,!0)},validate:function(){return this.modelManager.dataModel.validate()},destroy:function(){this.modelManager.destroy(),this.container.destroy(),this.modelManager=this.container=null}}),tui.Grid.getInstanceById=function(t){return h[t]}},{"./addon/net":2,"./base/view":7,"./common/util":10,"./domState":11,"./model/manager":19,"./painter/manager":37,"./publicEventEmitter":39,"./view/factory":42}],13:[function(t,e,i){"use strict";var n=t("../../base/model"),o=["_button","_number"],s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.textType={normal:!0,text:!0,"text-password":!0,"text-convertible":!0},this._setColumnModelList(this.get("columnModelList")),this.on("change",this._onChange,this)},defaults:{keyColumnName:null,columnFixCount:0,metaColumnModelList:[],dataColumnModelList:[],visibleList:[],hasNumberColumn:!0,selectType:"",columnModelMap:{},relationListMap:{},columnMerge:[]},_initializeMetaColumns:function(t){var e=[];return this._initializeButtonColumn(e),this._initializeNumberColumn(e),this._overwriteColumnModelList(e,t),e},_overwriteColumnModelList:function(t,e){_.each(e,function(e){this._extendColumnList(e,t)},this)},_initializeNumberColumn:function(t){var e=this.get("hasNumberColumn"),i={columnName:"_number",align:"center",title:"No.",isFixedWidth:!0,width:60};e||(i.isHidden=!0),this._extendColumnList(i,t)},_initializeButtonColumn:function(t){var e=this.get("selectType"),i={columnName:"_button",isHidden:!1,editOption:{type:e,list:[{value:"selected"}]},isFixedWidth:!0,width:40};"checkbox"===e?i.title='':"radio"===e?i.title="선택":i.isHidden=!0,this._extendColumnList(i,t)},_extendColumnList:function(t,e){var i=t.columnName,n=_.findIndex(e,{columnName:i});-1===n?e.push(t):e[n]=$.extend(e[n],t)},at:function(t,e){var i=e?this.getVisibleColumnModelList():this.get("dataColumnModelList");return i[t]},indexOfColumnName:function(t,e){var i;return i=e?this.getVisibleColumnModelList():this.get("dataColumnModelList"),_.findIndex(i,{columnName:t})},isLside:function(t){var e=this.indexOfColumnName(t,!0);return e>-1&&e=e?!1:void(t.isHidden&&(i-=1))}),t?i+this.getVisibleMetaColumnCount():i},getColumnModel:function(t){return this.get("columnModelMap")[t]},isTextType:function(t){return!!this.textType[this.getEditType(t)]},getEditType:function(t){var e=this.getColumnModel(t),i="normal";return"_button"===t||"_number"===t?i=t:e&&e.editOption&&e.editOption.type&&(i=e.editOption.type),i},_makeVisibleColumnModelList:function(t,e){return t=t||this.get("metaColumnModelList"),e=e||this.get("dataColumnModelList"),_.filter(t.concat(e),function(t){return!t.isHidden})},_getRelationListMap:function(t){var e,i={};return _.each(t,function(t){e=t.columnName,t.relationList&&(i[e]=t.relationList)}),i},getIgnoredColumnNameList:function(){var t=this.get("dataColumnModelList"),e=[];return _.each(t,function(t){t.isIgnore&&e.push(t.columnName)}),e},_setColumnModelList:function(t,e){var i,n,o,s,a;t=$.extend(!0,[],t),tui.util.isUndefined(e)&&(e=this.get("columnFixCount")),i=_.partition(t,function(t){return this.isMetaColumn(t.columnName)},this),s=this._initializeMetaColumns(i[0]),a=i[1],n=this._getRelationListMap(a),o=this._makeVisibleColumnModelList(s,a),this.set({metaColumnModelList:s,dataColumnModelList:a,columnModelMap:_.indexBy(s.concat(a),"columnName"),relationListMap:n,columnFixCount:Math.max(0,e),visibleList:o},{silent:!0}),this.unset("columnModelList",{silent:!0}),this.trigger("columnModelChange")},_onChange:function(t){var e=t.changed,i=e.columnFixCount,n=e.columnModelList;n||(n=this.get("dataColumnModelList")),this._setColumnModelList(n,i)},setHidden:function(t,e){for(var i,n,o,s;t.length;)i=t.shift(),o=this.getColumnModel(i),o?o.isHidden=e:(n=this.getUnitColumnNamesIfMerged(i),t.push.apply(t,n));s=this._makeVisibleColumnModelList(this.get("metaColumnModelList"),this.get("dataColumnModelList")),this.set("visibleList",s,{silent:!0}),this.trigger("columnModelChange")},getUnitColumnNamesIfMerged:function(t){var e,i,n,o=this.get("columnMerge"),s=[],a=[];for(s.push(t);s.length;)e=s.shift(),i=this.getColumnModel(e),i?a.push(e):(n=_.findWhere(o,{columnName:e}),n&&s.push.apply(s,n.columnNameList));return _.uniq(a)},isMetaColumn:function(t){return _.indexOf(o,t)>=0}});e.exports=s},{"../../base/model":5}],14:[function(t,e,i){"use strict";var n=(t("../../base/model"),t("../../common/util"),tui.util.defineClass({init:function(t){this.data=t},getRowSpanData:function(t,e,i){var n=null;return i&&(n=this.data.rowSpanData,t&&n&&(n=n[t])),!n&&t&&(n={count:0,isMainRow:!0,mainRowKey:e}),n},getRowState:function(){var t={isDisabledCheck:!1,isDisabled:!1,isChecked:!1};switch(this.data.rowState){case"DISABLED":t.isDisabled=!0;case"DISABLED_CHECK":t.isDisabledCheck=!0;break;case"CHECKED":t.isChecked=!0}return t},setRowState:function(t){this.data.rowState=t},setRowSpanData:function(t,e){var i=_.assign({},this.data.rowSpanData);t&&(e?i[t]=e:i[t]&&delete i[t],this.data.rowSpanData=i)},addCellClassName:function(t,e){var i,n;i=this.data.className||{},i.column=i.column||{},n=i.column[t]||[],_.contains(n,e)||(n.push(e),i.column[t]=n,this.data.className=i)},addClassName:function(t){var e,i;e=this.data.className||{},i=e.row||[],-1===tui.util.inArray(t,i)&&(i.push(t),e.row=i,this.data.className=e)},getClassNameList:function(t){var e=this.data.className,i=Array.prototype.push,n=[];return e&&(e.row&&i.apply(n,e.row),t&&e.column&&e.column[t]&&i.apply(n,e.column[t])),n},_removeClassNameFromArray:function(t,e){var i=t.join(" ").split(" ");return _.without(i,e)},removeCellClassName:function(t,e){var i=this.data.className;tui.util.pick(i,"column",t)&&(i.column[t]=this._removeClassNameFromArray(i.column[t],e),this.data.className=i)},removeClassName:function(t){var e=this.data.className;e&&e.row&&(e.row=this._removeClassNameFromArray(e.row,t),this.className=e)}}));e.exports=n},{"../../base/model":5,"../../common/util":10}],15:[function(t,e,i){"use strict";var n=t("../../base/model"),o=t("./extraDataManager"),s=t("../../common/util"),a=["_button","_number","_extraData"],l="REQUIRED",r=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.extraDataManager=new o(this.get("_extraData")),this.columnModel=this.collection.columnModel,this.validateMap={},this.on("change",this._onChange,this)},idAttribute:"rowKey",parse:function(t){return t._extraData||(t._extraData={}),t},_triggerExtraDataChangeEvent:function(){this.trigger("extraDataChanged",this.get("_extraData"))},_onChange:function(){var t=_.omit(this.changed,a);this.isDuplicatedPublicChanged(t)||_.each(t,function(t,e){var i=this.columnModel.getColumnModel(e);i&&this._executeChangeBeforeCallback(e)&&(this.collection.syncRowSpannedData(this,e,t),this._executeChangeAfterCallback(e),this.validateCell(e,!0))},this)},_validateCellData:function(t){var e=this.columnModel.getColumnModel(t),i=this.get(t),n="";return e.isRequired&&s.isBlank(i)&&(n=l),n},validateCell:function(t,e){var i;return!e&&t in this.validateMap?this.validateMap[t]:(i=this._validateCellData(t),i?this.addCellClassName(t,"invalid"):this.removeCellClassName(t,"invalid"),this.validateMap[t]=i,i)},_createChangeCallbackEvent:function(t){return{rowKey:this.get("rowKey"),columnName:t,value:this.get(t),instance:tui.Grid.getInstanceById(this.collection.gridId)}},_executeChangeBeforeCallback:function(t){var e,i,n=this.columnModel.getColumnModel(t);return n.editOption&&n.editOption.changeBeforeCallback&&(e=this._createChangeCallbackEvent(t),n.editOption.changeBeforeCallback(e)===!1)?(i={},i[t]=this.previous(t),this.set(i),this.trigger("restore",{changed:i}),!1):!0},_executeChangeAfterCallback:function(t){var e,i=this.columnModel.getColumnModel(t);return i.editOption&&i.editOption.changeAfterCallback?(e=this._createChangeCallbackEvent(t),!!i.editOption.changeAfterCallback(e)):!0},getPrivateProperties:function(){return a},getRowState:function(){return this.extraDataManager.getRowState()},getClassNameList:function(t){var e=this.columnModel.getColumnModel(t),i=this.extraDataManager.getClassNameList(t);return e.className&&i.push(e.className),e.isEllipsis&&i.push("ellipsis"),e.isRequired&&i.push("required"),this._makeUniqueStringArray(i)},_makeUniqueStringArray:function(t){var e=_.uniq(t.join(" ").split(" "));return _.without(e,"")},getCellState:function(t){var e,i,n=["_number","normal"],o=this.columnModel,s=!1,a=!0,l=o.getEditType(t);return i=this.getRelationResult(["isDisabled","isEditable"])[t],e=this.getRowState(),s="_button"===t?e.isDisabledCheck:e.isDisabled,s=s||!(!i||!i.isDisabled),a=-1!==$.inArray(l,n)?!1:!(i&&i.isEditable===!1),{isEditable:a,isDisabled:s}},isEditable:function(t){var e=["_number","normal"],i=this.columnModel.getEditType(t),n=!1;return-1===$.inArray(i,e)&&(n=this.getCellState(t).isEditable),n},isDisabled:function(t){var e;return e=this.getCellState(t),e.isDisabled},getRowSpanData:function(t){var e=this.collection.isRowSpanEnable(),i=this.get("rowKey");return this.extraDataManager.getRowSpanData(t,i,e)},setRowSpanData:function(t,e){this.extraDataManager.setRowSpanData(t,e),this._triggerExtraDataChangeEvent()},setRowState:function(t,e){this.extraDataManager.setRowState(t),e||this._triggerExtraDataChangeEvent()},addCellClassName:function(t,e){this.extraDataManager.addCellClassName(t,e),this._triggerExtraDataChangeEvent()},addClassName:function(t){this.extraDataManager.addClassName(t),this._triggerExtraDataChangeEvent()},removeCellClassName:function(t,e){this.extraDataManager.removeCellClassName(t,e),this._triggerExtraDataChangeEvent()},removeClassName:function(t){this.extraDataManager.removeClassName(t),this._triggerExtraDataChangeEvent()},getHTMLEncodedString:function(t){var e=this.columnModel.getColumnModel(t),i=this.columnModel.isTextType(t),n=this.get(t),o=e.notUseHtmlEntity;return!o&&i&&tui.util.hasEncodableString(n)&&(n=tui.util.encodeHTMLEntity(n)),n},_getListTypeVisibleText:function(t){var e,i,n,o,a=this.get(t),l=this.columnModel.getColumnModel(t);return tui.util.isExisty(tui.util.pick(l,"editOption","list"))?(e=this.getRelationResult(["optionListChange"])[t],i=e&&e.optionList?e.optionList:l.editOption.list,n=typeof i[0].value,o=a.toString().split(","),n!==typeof o[0]&&(o=_.map(o,function(t){return s.convertValueType(t,n)})),_.each(o,function(t,e){var n=_.findWhere(i,{value:t});o[e]=n&&n.text||""},this),o.join(",")):void 0},isDuplicatedPublicChanged:function(t){return this._timeoutIdForChanged&&_.isEqual(this._lastPublicChanged,t)?!0:(clearTimeout(this._timeoutIdForChanged),this._timeoutIdForChanged=setTimeout(_.bind(function(){this._timeoutIdForChanged=null},this),10),this._lastPublicChanged=t,!1)},getVisibleText:function(t){var e,i,n=this.columnModel,o=this.get(t),a={select:!0,radio:!0,checkbox:!0};if(n)if(e=n.getEditType(t),i=n.getColumnModel(t),a[e]){if(!tui.util.isExisty(tui.util.pick(i,"editOption","list",0,"value")))throw this.error('Check "'+t+"\"'s editOption.list property out in your ColumnModel.");o=this._getListTypeVisibleText(t)}else _.isFunction(i.formatter)&&(o=s.stripTags(i.formatter(this.getHTMLEncodedString(t),this.toJSON(),i)));return o=tui.util.isUndefined(o)?o:o.toString()},getRelationResult:function(t){var e,i,n,o,s=this.attributes,a=this.columnModel.get("relationListMap"),l={},r=this.getRowState();return t=t&&t.length?t:["optionListChange","isDisabled","isEditable"],_.each(a,function(a,u){o=s[u],_.each(a,function(a){n=a.columnList,_.each(t,function(t){r.isDisabled&&"isDisabled"===t||(e=a[t],"function"==typeof e&&(i="","optionListChange"===t?i="optionList":"isDisabled"===t?i="isDisabled":"isEditable"===t&&(i="isEditable"),i&&_.each(n,function(t){l[t]=l[t]||{},l[t][i]=e(o,s); +},this)))},this)},this)},this),l}},{privateProperties:a});e.exports=r},{"../../base/model":5,"../../common/util":10,"./extraDataManager":14}],16:[function(t,e,i){"use strict";var n=t("../../base/collection"),o=t("./row"),s=n.extend({initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({columnModel:e.columnModel,domState:e.domState,gridId:e.gridId,lastRowKey:-1,originalRowList:[],originalRowMap:{},startIndex:e.startIndex||1,sortOptions:{columnName:"rowKey",isAscending:!0,useClient:_.isBoolean(e.useClientSort)?e.useClientSort:!0},isDisabled:!1}),this.sortOptions.useClient||(this.comparator=null)},model:o,parse:function(t){return t=t&&t.contents||t,this._formatData(t)},_formatData:function(t){var e=_.filter(t,_.isObject);return _.each(e,function(t,i){e[i]=this._baseFormat(e[i]),this.isRowSpanEnable()&&this._setExtraRowSpanData(e,i)},this),e},_baseFormat:function(t){var e={rowSpan:null,rowSpanData:null,rowState:null},i=this.columnModel.get("keyColumnName"),n=null===i?this._createRowKey():t[i];return t._extraData=$.extend(e,t._extraData),t._button="CHECKED"===t._extraData.rowState,t.rowKey=n,t},_createRowKey:function(){return this.lastRowKey+=1,this.lastRowKey},_setExtraRowSpanData:function(t,e){function i(t,e){var i=t._extraData;return!(!i.rowSpanData||!i.rowSpanData[e])}function n(t,e,i){var n=t._extraData;return n.rowSpanData=n&&n.rowSpanData||{},n.rowSpanData[e]=i,n}var o,s,a,l=t[e],r=l&&l._extraData&&l._extraData.rowSpan,u=l&&l.rowKey;return r&&_.each(r,function(r,d){if(!i(l,d))for(n(l,d,{count:r,isMainRow:!0,mainRowKey:u}),o=-1,a=e+1;e+r>a;a+=1)s=t[a],s[d]=l[d],s._extraData=s._extraData||{},n(s,d,{count:o,isMainRow:!1,mainRowKey:u}),o-=1}),t},setOriginalRowList:function(t){return this.originalRowList=t?this._formatData(t):this.toJSON(),this.originalRowMap=_.indexBy(this.originalRowList,"rowKey"),this.originalRowList},getOriginalRowList:function(t){return t=void 0===t?!0:t,t?_.clone(this.originalRowList):this.originalRowList},getOriginalRow:function(t){return _.clone(this.originalRowMap[t])},getOriginal:function(t,e){return _.clone(this.originalRowMap[t][e])},getMainRowKey:function(t,e){var i,n=this.get(t);return this.isRowSpanEnable()&&(i=n&&n.getRowSpanData(e),t=i?i.mainRowKey:t),t},indexOfRowKey:function(t){return this.indexOf(this.get(t))},isRowSpanEnable:function(){return!this.isSortedByField()},isSortedByField:function(){return"rowKey"!==this.sortOptions.columnName},setSortOptionValues:function(t,e,i){var n=this.sortOptions,o=!1;_.isUndefined(t)&&(t="rowKey"),_.isUndefined(e)&&(e=!0),(n.columnName!==t||n.isAscending!==e)&&(o=!0),n.columnName=t,n.isAscending=e,o&&this.trigger("sortChanged",{columnName:t,isAscending:e,isRequireFetch:i})},sortByField:function(t,e){var i=this.sortOptions;_.isUndefined(e)&&(e=i.columnName===t?!i.isAscending:!0),this.setSortOptionValues(t,e,!i.useClient),i.useClient&&this.sort()},getRowList:function(t,e){var i,n;return t?(n=this.where({_button:!0}),i=[],_.each(n,function(t){i.push(t.attributes)},this)):i=this.toJSON(),e?i:this._removePrivateProp(i)},syncRowSpannedData:function(t,e,i){var n,o,s;if(this.isRowSpanEnable())if(o=t.getRowSpanData(e),o.isMainRow)for(n=this.indexOfRowKey(t.get("rowKey")),s=0;so?a=-1:o>s&&(a=1),n||(a=-a),a},_removePrivateProp:function(t){return _.map(t,function(t){return _.omit(t,o.privateProperties)})},removeRow:function(t,e){var i,n,o,s=this.get(t);s&&(e&&e.keepRowSpanData&&(o=_.clone(s.attributes)),i=_.clone(s.getRowSpanData()),n=this.at(this.indexOf(s)+1),this.remove(s,{silent:!0}),this._syncRowSpanDataForRemove(i,n,o),e&&e.removeOriginalData&&this.setOriginalRowList(),this.trigger("remove"))},_syncRowSpanDataForRemove:function(t,e,i){t&&_.each(t,function(t,n){var o,s,a,l={};if(t.isMainRow){if(1===t.count)return;o=e,a=t.count-1,s=1,a>1&&(l.mainRowKey=o.get("rowKey"),l.isMainRow=!0),o.set(n,i?i[n]:"",{silent:!0})}else o=this.get(t.mainRowKey),a=o.getRowSpanData(n).count-1,s=-t.count;a>1?(l.count=a,o.setRowSpanData(n,l),this._updateSubRowSpanData(o,n,s,a)):o.setRowSpanData(n,null)},this)},_createDummyRow:function(){var t=this.columnModel.get("dataColumnModelList"),e={};return _.each(t,function(t){e[t.columnName]=""},this),e},append:function(t,e){var i,n=this._createModelList(t);return e=_.extend({at:this.length},e),i={at:e.at,add:!0,silent:!0},this.add(n,i),this._syncRowSpanDataForAppend(e.at,n.length,e.extendPrevRowSpan),this.trigger("add",n,e),n},prepend:function(t,e){return e=e||{},e.at=0,this.append(t,e)},getRowData:function(t,e){var i=this.get(t),n=i?i.toJSON():null;return e?$.toJSON(n):n},getRowDataAt:function(t,e){var i=this.at(t),n=i?i.toJSON():null;return e?$.toJSON(i):n},getValue:function(t,e,i){var n,o;return i?n=this.getOriginal(t,e):(o=this.get(t),n=o&&o.get(e)),n},setValue:function(t,e,i,n){var o,s=this.get(t),a={};return i=_.isString(i)?$.trim(i):i,s?(a[e]=i,s.set(a,{silent:n}),o=!0):o=!1,o},getColumnValues:function(t,e){var i=this.pluck(t);return e?$.toJSON(i):i},setColumnValues:function(t,e,i,n){var o={},s={isDisabled:!1,isEditable:!0};o[t]=e,i=void 0===i?!0:i,this.forEach(function(e){i&&(s=e.getCellState(t)),!s.isDisabled&&s.isEditable&&e.set(o,{silent:n})},this)},getRowSpanData:function(t,e){var i=this.get(t);return i?i.getRowSpanData(e):null},isChanged:function(){var t=_.values(this.getModifiedRowList());return _.some(t,function(t){return t.length>0})},setDisabled:function(t){this.isDisabled!==t&&(this.isDisabled=t,this.trigger("disabledChanged"))},enableRow:function(t){this.get(t).setRowState("")},disableRow:function(t){this.get(t).setRowState("DISABLED")},enableCheck:function(t){this.get(t).setRowState("")},disableCheck:function(t){this.get(t).setRowState("DISABLED_CHECK")},check:function(t,e){var i=this.get(t).getRowState().isDisabledCheck,n=this.columnModel.get("selectType");!i&&n&&("radio"===n&&this.uncheckAll(),this.setValue(t,"_button",!0,e))},uncheck:function(t,e){this.setValue(t,"_button",!1,e)},checkAll:function(){this.setColumnValues("_button",!0)},uncheckAll:function(){this.setColumnValues("_button",!1)},_createModelList:function(t){var e,i=[];return t=t||this._createDummyRow(),_.isArray(t)||(t=[t]),e=this._formatData(t),_.each(e,function(t){var e;e=new o(t,{collection:this,parse:!0}),i.push(e)},this),i},_syncRowSpanDataForAppend:function(t,e,i){var n=this.at(t-1);n&&_.each(n.getRowSpanData(),function(t,o){var s,a,l,r;0!==t.count&&(t.isMainRow?(s=n,a=t,l=1):(s=this.get(t.mainRowKey),a=s.getRowSpanData()[o],l=-t.count+1),(a.count>l||i)&&(a.count+=e,r=a.count,this._updateSubRowSpanData(s,o,l,r)))},this)},_updateSubRowSpanData:function(t,e,i,n){var o,s,a=this.indexOf(t),l=t.get("rowKey");for(s=i;n>s;s+=1)o=this.at(a+s),o.set(e,t.get(e),{silent:!0}),o.setRowSpanData(e,{count:-s,mainRowKey:l,isMainRow:!1})},_isModifiedRow:function(t,e,i){var n=_.omit(t,i),o=_.some(n,function(t,i){return"object"==typeof t?$.toJSON(t)!==$.toJSON(e[i]):t!==e[i]},this);return o},getModifiedRowList:function(t){var e=t&&t.isRaw,i=t&&t.isOnlyChecked,n=t&&t.isOnlyRowKeyList,o=e?this.originalRowList:this._removePrivateProp(this.originalRowList),s=e?this.toJSON():this._removePrivateProp(this.toJSON()),a=t&&t.filteringColumnList,l={createList:[],updateList:[],deleteList:[]};return o=_.indexBy(o,"rowKey"),s=_.indexBy(s,"rowKey"),a=_.union(a,this.columnModel.getIgnoredColumnNameList()),_.each(s,function(t,e){var s=o[e],r=n?t.rowKey:t;(!i||i&&this.get(e).get("_button"))&&(s?this._isModifiedRow(t,s,a)&&l.updateList.push(r):l.createList.push(r))},this),_.each(o,function(t,e){var i=n?t.rowKey:t;s[e]||l.deleteList.push(i)},this),l},_resetData:function(t,e,i){this.lastRowKey=-1,this.reset(t,{parse:e}),_.isFunction(i)&&i()},replaceRowList:function(t,e,i){_.isUndefined(e)&&(e=!0),this.trigger("beforeReset"),t&&t.length>500?_.defer(_.bind(this._resetData,this,t,e,i)):this._resetData(t,e,i)},setRowList:function(t,e,i){var n=_.bind(function(){this.setOriginalRowList(),_.isFunction(i)&&i()},this);this.replaceRowList(t,e,n)},restore:function(){var t=this.getOriginalRowList();this.replaceRowList(t,!0)},del:function(t,e,i){var n=this.getMainRowKey(t,e),o=this.get(n).getCellState(e),s=this.columnModel.getEditType(e),a=_.contains(["text","text-convertible","text-password"],s);a&&o.isEditable&&!o.isDisabled&&this.setValue(n,e,"",i)},paste:function(t,e){var i=this._getEndIndexToPaste(t,e);_.each(t,function(t,n){this._setValueForPaste(t,e.row+n,e.column,i.column)},this),this.trigger("paste",{startIdx:e,endIdx:i})},validate:function(){var t=[],e=_.chain(this.columnModel.getVisibleColumnModelList()).filter(function(t){return t.isRequired===!0}).pluck("columnName").value();return this.each(function(i){var n=[];_.each(e,function(t){var e=i.validateCell(t);e&&n.push({columnName:t,errorCode:e})}),n.length&&t.push({rowKey:i.get("rowKey"),errors:n})}),t},_getEndIndexToPaste:function(t,e){var i=this.columnModel.getVisibleColumnModelList(),n=t.length+e.row-1,o=Math.min(t[0].length+e.column,i.length)-1;return{row:n,column:o}},_setValueForPaste:function(t,e,i,n){var o,s,a,l,r=this.at(e),u=this.columnModel,d={};for(r||(r=this.append({})[0]),o=i;n>=o;o+=1)s=u.at(o,!0).columnName,a=r.getCellState(s),l=r.getRowSpanData(s),a.isEditable&&!a.isDisabled&&(!l||l.count>=0)&&(d[s]=t[o-i]);r.set(d)},getElement:function(t,e){var t=this.getMainRowKey(t,e);return this.domState.getElement(t,e)}});e.exports=s},{"../../base/collection":3,"./row":15}],17:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=t("../common/constMap").dimension,a=s.TABLE_BORDER_WIDTH,l=s.CELL_BORDER_WIDTH,r=n.extend({initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this._columnWidthFixedFlags=null,this._minColumnWidthList=null,this.columnModel=e.columnModel,this.dataModel=e.dataModel,this.domState=e.domState,this.listenTo(this.columnModel,"columnModelChange",this._initColumnWidthVariables),this.listenTo(this.dataModel,"add remove reset",this._resetTotalRowHeight),this.on("change:width",this._onWidthChange,this),this.on("change:bodyHeight",this._resetDisplayRowCount,this),this.on("change:displayRowCount",this._resetBodyHeight,this),this._initColumnWidthVariables(),this._resetBodyHeight()},models:null,columnModel:null,defaults:{offsetLeft:0,offsetTop:0,width:0,headerHeight:0,bodyHeight:0,toolbarHeight:65,rowHeight:0,totalRowHeight:0,rsideWidth:0,lsideWidth:0,columnWidthList:[],minimumColumnWidth:0,displayRowCount:1,scrollBarSize:17,scrollX:!0,scrollY:!0,fitToParentHeight:!1},_getAvailableTotalWidth:function(t){var e=this.get("width"),i=e-this.getScrollYWidth()-t-1;return this.columnModel.getVisibleColumnFixCount(!0)>0&&(i-=l),i},_applyMinimumColumnWidth:function(t){var e=this._minColumnWidthList,i=_.clone(t);return _.each(i,function(t,n){var o=e[n];o>t&&(i[n]=o)}),i},_resetTotalRowHeight:function(){var t=this.get("rowHeight"),e=this.dataModel.length,i=e+1;this.set("totalRowHeight",t*e+i)},_resetDisplayRowCount:function(){var t,e;_.has(this.changed,"displayRowCount")||(t=this.get("bodyHeight")-this.getScrollXHeight(),e=o.getDisplayRowCount(t,this.get("rowHeight")),this.set("displayRowCount",e))},_fillEmptyColumnWidth:function(t){var e=this._getAvailableTotalWidth(t.length),i=e-o.sum(t),n=[];return _.each(t,function(t,e){t||n.push(e)}),this._distributeExtraWidthEqually(t,i,n)},_addExtraColumnWidth:function(t,e){var i=this._columnWidthFixedFlags,n=[];return _.each(i,function(t,e){t||n.push(e)}),this._distributeExtraWidthEqually(t,e,n)},_reduceExcessColumnWidth:function(t,e){var i=this._minColumnWidthList,n=this._columnWidthFixedFlags,o=[];return _.each(t,function(t,e){n[e]||o.push({index:e,width:t-i[e]})}),this._reduceExcessColumnWidthSub(_.clone(t),e,o)},_reduceExcessColumnWidthSub:function(t,e,i){var n,o=Math.round(e/i.length),s=[];return _.each(i,function(i){i.widths.length?this._reduceExcessColumnWidthSub(t,e,s):(n=_.pluck(i,"index"),this._distributeExtraWidthEqually(t,e,n))},_distributeExtraWidthEqually:function(t,e,i){var n=i.length,o=Math.round(e/n),s=o*n-e,a=_.clone(t);return _.each(i,function(t){a[t]+=o}),a[_.last(i)]-=s,a},_adjustColumnWidthList:function(t,e){var i,n=t.length,s=this._getAvailableTotalWidth(n),a=s-o.sum(t),l=_.filter(this._columnWidthFixedFlags).length;return a>0?n>l?i=this._addExtraColumnWidth(t,a):(i=_.clone(t),i[n-1]+=a):i=e&&0>a?this._reduceExcessColumnWidth(t,a):t,i},_initColumnWidthVariables:function(){var t,e=this.columnModel.getVisibleColumnModelList(null,!0),i=this.get("minimumColumnWidth"),n=[],o=[],s=[];_.each(e,function(t){var e=t.width>0?t.width:0,a=Math.max(e,i);n.push(e?a:0),s.push(a),o.push(!!t.isFixedWidth)}),this._columnWidthFixedFlags=o,this._minColumnWidthList=s,t=_.compose(this._adjustColumnWidthList,this._applyMinimumColumnWidth,this._fillEmptyColumnWidth),this._setColumnWidthVariables(t.call(this,n),!0)},getFrameWidth:function(t){var e=this.columnModel.getVisibleColumnFixCount(!0),i=this.getColumnWidthList(t),n=this._getFrameWidth(i);return tui.util.isUndefined(t)&&e>0&&(n+=1),n},_getFrameWidth:function(t){var e=0;return t.length&&(e=o.sum(t)+(t.length+1)*l),e},_setColumnWidthVariables:function(t,e){var i,n,o,s,a=this.get("width"),l=this.columnModel.getVisibleColumnFixCount(!0),r=this._getMaxLeftSideWidth();o=t.slice(0,l),s=t.slice(l),n=this._getFrameWidth(o),r&&n>r&&(o=this._adjustLeftSideWidthList(o,r),n=this._getFrameWidth(o),t=o.concat(s)),i=a-n,this.set({columnWidthList:t,rsideWidth:i,lsideWidth:n}),e&&this.set("originalWidthList",_.clone(t)),this.trigger("columnWidthChanged")},_getMinLeftSideWidth:function(){var t,e=this.get("minimumColumnWidth"),i=this.columnModel.getVisibleColumnFixCount(!0),n=0;return i&&(t=(i+1)*l,n=t+e*i),n},_getMaxLeftSideWidth:function(){var t=Math.ceil(.9*this.get("width"));return t&&(t=Math.max(t,this._getMinLeftSideWidth())),t},getCellPosition:function(t,e){var i,n,s,a,r,u,d,h,c=this.dataModel,m=this.columnModel,g=this.get("rowHeight"),f=c.get(t),p=m.getVisibleMetaColumnCount(),_=this.get("columnWidthList").slice(p),M=m.getVisibleColumnFixCount(),w=m.indexOfColumnName(e,!0);if(!f)return{};for(i=c.get(t).getRowSpanData(e),i.isMainRow||(t=i.mainRowKey,i=c.get(t).getRowSpanData(e)),s=i.count||1,n=c.indexOfRowKey(t),a=o.getHeight(n,g),d=a+o.getHeight(s,g)-l,r=h=0,w>=M&&(h=M);w>h;h+=1)r+=_[h]+l;return u=r+_[h]+l,{top:a,left:r,right:u,bottom:d}},getScrollPosition:function(t,e){var i=!this.columnModel.isLside(e),n=this.getCellPosition(t,e),o=this._getBodySize(),s=this._judgeScrollDirection(n,i,o);return this._makeScrollPosition(s,n,o)},_getBodySize:function(){var t=this.get("lsideWidth"),e=this.get("rsideWidth")-this.getScrollYWidth(),i=this.get("bodyHeight")-this.getScrollXHeight();return{height:i,rsideWidth:e,totalWidth:t+e}},_judgeScrollDirection:function(t,e,i){var n,o,s,a,l=this.renderModel,r=l.get("scrollTop"),u=l.get("scrollLeft");return n=t.topr+i.height,e?(s=t.leftu+i.rsideWidth-1):s=a=!1,{isUp:n,isDown:o,isLeft:s,isRight:a}},_makeScrollPosition:function(t,e,i){var n={};return t.isUp?n.scrollTop=e.top:t.isDown&&(n.scrollTop=e.bottom-i.height),t.isLeft?n.scrollLeft=e.left:t.isRight&&(n.scrollLeft=e.right-i.rsideWidth+a),n},getOverflowFromMousePosition:function(t,e){var i=this._rebasePositionToContainer(t,e),n=this._getBodySize();return this._judgeOverflow(i,n)},_judgeOverflow:function(t,e){var i=t.x,n=t.y,o=0,s=0;return 0>n?o=-1:n>e.height&&(o=1),0>i?s=-1:i>e.totalWidth&&(s=1),{x:s,y:o}},getIndexFromMousePosition:function(t,e,i){var n=this._rebasePositionToContainer(t,e);return{row:this._calcRowIndexFromPositionY(n.y),column:this._calcColumnIndexFromPositionX(n.x,i)}},_calcRowIndexFromPositionY:function(t){var e=t+this.renderModel.get("scrollTop"),i=Math.floor(e/(this.get("rowHeight")+l)),n=0,s=Math.max(n,this.dataModel.length-1);return o.clamp(i,n,s)},_calcColumnIndexFromPositionX:function(t,e){var i=this.getColumnWidthList(),n=this.getFrameWidth(),o=t,s=t>=this.get("lsideWidth"),a=e?0:this.columnModel.getVisibleMetaColumnCount(),l=0;return s&&(o+=this.renderModel.get("scrollLeft")),o>=n?l=i.length-1:tui.util.forEachArray(i,function(t,e){return o>t?void(o-=t):(l=e,!1)}),Math.max(0,l-a)},_rebasePositionToContainer:function(t,e){var i=t-this.get("offsetLeft"),n=e-(this.get("offsetTop")+this.get("headerHeight")+2);return{x:i,y:n}},_adjustLeftSideWidthList:function(t,e){var i,n=t.length-1,o=this.get("minimumColumnWidth"),s=this._getFrameWidth(t),a=s-e;if(a>0)for(;n>=0&&a>0;)i=Math.max(o,t[n]-a),a-=t[n]-i,t[n]=i,n-=1;else 0>a&&(t[n]+=Math.abs(a));return t},_resetBodyHeight:function(){var t;_.has(this.changed,"bodyHeight")||(t=o.getHeight(this.get("displayRowCount"),this.get("rowHeight")),this.set("bodyHeight",t+this.getScrollXHeight()))},getScrollXHeight:function(){return this.get("scrollX")?this.get("scrollBarSize"):0},getScrollYWidth:function(){return this.get("scrollY")?this.get("scrollBarSize"):0},_onWidthChange:function(){var t=this._adjustColumnWidthList(this.get("columnWidthList"),!0);this._setColumnWidthVariables(t)},setColumnWidth:function(t,e){var i,n=this.get("columnWidthList"),o=this._columnWidthFixedFlags,s=this._minColumnWidthList[t];!o[t]&&n[t]&&(n[t]=Math.max(e,s),o[t]=!0,i=this._adjustColumnWidthList(n),o[t]=!1,this._setColumnWidthVariables(i))},_calcRealBodyHeight:function(t){return t-this.get("headerHeight")-this.get("toolbarHeight")-a},_getMinBodyHeight:function(){return this.get("rowHeight")+2*l+this.getScrollXHeight()},_setHeight:function(t){this.set("bodyHeight",Math.max(this._calcRealBodyHeight(t),this._getMinBodyHeight()))},setSize:function(t,e){t>0&&this.set("width",t),e>0&&this._setHeight(e),this.trigger("setSize")},getHeight:function(){return this.get("bodyHeight")+this.get("headerHeight")+this.get("toolbarHeight")},refreshLayout:function(){var t=this.domState,e=t.getOffset();this.set({offsetTop:e.top,offsetLeft:e.left,width:t.getWidth()}),this.get("fitToParentHeight")&&this._setHeight(t.getParentHeight())},restoreColumnWidth:function(t){var e=this.get("originalWidthList")[t];this.setColumnWidth(t,e)},getColumnWidthList:function(t){var e=this.columnModel.getVisibleColumnFixCount(!0),i=[];switch(t){case"l":case"L":i=this.get("columnWidthList").slice(0,e);break;case"r":case"R":i=this.get("columnWidthList").slice(e);break;default:i=this.get("columnWidthList")}return i}});e.exports=r},{"../base/model":5,"../common/constMap":8,"../common/util":10}],18:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=n.extend({initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this.dataModel=e.dataModel,this.columnModel=e.columnModel,this.dimensionModel=e.dimensionModel,this.renderModel=e.renderModel,this.cellFactory=e.cellFactory,this.domState=e.domState,this.listenTo(this.dataModel,"add",this._onAddData),this.listenTo(this.dataModel,"reset",this._onResetData)},defaults:{rowKey:null,columnName:"",prevRowKey:null,prevColumnName:""},_onAddData:function(t,e){e.focus&&this.focusAt(e.at,0)},_onResetData:function(){this.unselect(!0)},_savePrevious:function(){return null!==this.get("rowKey")&&this.set("prevRowKey",this.get("rowKey")),this.get("columnName")&&this.set("prevColumnName",this.get("columnName")),this},_clearPrevious:function(){this.set({prevRowKey:null,prevColumnName:""})},_isCurrentRow:function(t){return this.get("rowKey")==t},_isCurrentCell:function(t,e){return this._isCurrentRow(t)&&this.get("columnName")===e},select:function(t){return this._isCurrentRow(t)?this:(this.unselect().set("rowKey",t),"radio"===this.columnModel.get("selectType")&&this.dataModel.check(t),this.trigger("select",{rowKey:t,rowData:this.dataModel.getRowData(t)}),this)},unselect:function(t){return t&&this.blur(),this.trigger("unselect",this.get("rowKey")),this.set({rowKey:null}),this},focus:function(t,e,i){return o.isBlank(t)||o.isBlank(e)||this.columnModel.isMetaColumn(e)||this._isCurrentCell(t,e)?this:(this.blur().select(t).set("columnName",e).trigger("focus",t,e),i&&this.scrollToFocus(),this)},focusAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0);n&&o&&this.focus(n.get("rowKey"),o.columnName,i)},focusIn:function(t,e,i){this.focus(t,e,i),t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t).isEditable(e)?this.trigger("focusIn",t,e):this.focusClipboard()},focusInAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0);n&&o&&this.focusIn(n.get("rowKey"),o.columnName,i)},focusClipboard:function(){this.trigger("focusClipboard")},refreshState:function(){this.domState.hasFocusedElement()?this.has()||this.restore()||this.focusAt(0,0):this.blur()},scrollToFocus:function(){var t=this.get("rowKey"),e=this.get("columnName"),i=this.dimensionModel.getScrollPosition(t,e);tui.util.isEmpty(i)||this.renderModel.set(i)},blur:function(){return this.has()&&(this._savePrevious(),this.trigger("blur",this.get("rowKey"),this.get("columnName")),null!==this.get("rowKey")&&this.set("columnName","")),this},which:function(){return{rowKey:this.get("rowKey"),columnName:this.get("columnName")}},indexOf:function(t){var e=t?this.get("prevRowKey"):this.get("rowKey"),i=t?this.get("prevColumnName"):this.get("columnName");return{row:this.dataModel.indexOfRowKey(e),column:this.columnModel.indexOfColumnName(i,!0)}},has:function(){return this._isValidCell(this.get("rowKey"),this.get("columnName"))},restore:function(){var t=this.get("prevRowKey"),e=this.get("prevColumnName"),i=!1;return this._isValidCell(t,e)&&(this.focus(t,e),i=!0),i},_isValidCell:function(t,e){var i=!o.isBlank(t)&&!!this.dataModel.get(t),n=!o.isBlank(e)&&!!this.columnModel.getColumnModel(e);return i&&n},_findRowKey:function(t){var e,i,n=this.dataModel;return this.has()?(e=Math.max(Math.min(n.indexOfRowKey(this.get("rowKey"))+t,this.dataModel.length-1),0),i=n.at(e),i&&i.get("rowKey")):void 0},_findColumnName:function(t){var e,i=this.columnModel,n=i.getVisibleColumnModelList(),o=i.indexOfColumnName(this.get("columnName"),!0);return this.has()?(e=Math.max(Math.min(o+t,n.length-1),0),n[e]&&n[e].columnName):void 0},_getRowSpanData:function(t,e){return this.dataModel.get(t).getRowSpanData(e)},nextRowIndex:function(t){var e=this.nextRowKey(t);return this.dataModel.indexOfRowKey(e)},prevRowIndex:function(t){var e=this.prevRowKey(t);return this.dataModel.indexOfRowKey(e)},nextColumnIndex:function(){var t=this.nextColumnName();return this.columnModel.indexOfColumnName(t,!0)},prevColumnIndex:function(){var t=this.prevColumnName();return this.columnModel.indexOfColumnName(t,!0)},nextRowKey:function(t){var e,i,n=this.which(),o=n.rowKey;return t="number"==typeof t?t:1,t>1?(o=this._findRowKey(t),i=this._getRowSpanData(o,n.columnName),i.isMainRow||(o=this._findRowKey(i.count+t))):(i=this._getRowSpanData(o,n.columnName),i.isMainRow&&i.count>0?o=this._findRowKey(i.count):i.isMainRow?o=this._findRowKey(1):(e=i.count,i=this._getRowSpanData(i.mainRowKey,n.columnName),o=this._findRowKey(i.count+e))),o},prevRowKey:function(t){var e,i=this.which(),n=i.rowKey;return t="number"==typeof t?t:1,t*=-1,-1>t?(n=this._findRowKey(t),e=this._getRowSpanData(n,i.columnName),e.isMainRow||(n=this._findRowKey(e.count+t))):(e=this._getRowSpanData(n,i.columnName),n=e.isMainRow?this._findRowKey(-1):this._findRowKey(e.count-1)),n},nextColumnName:function(){return this._findColumnName(1)},prevColumnName:function(){return this._findColumnName(-1)},firstRowKey:function(){return this.dataModel.at(0).get("rowKey")},lastRowKey:function(){return this.dataModel.at(this.dataModel.length-1).get("rowKey")},firstColumnName:function(){var t=this.columnModel.getVisibleColumnModelList();return t[0].columnName},lastColumnName:function(){var t=this.columnModel.getVisibleColumnModelList(),e=t.length-1;return t[e].columnName}});e.exports=s},{"../base/model":5,"../common/util":10}],19:[function(t,e,i){"use strict";var n=t("./data/columnModel"),o=t("./data/rowList"),s=t("./toolbar"),a=t("./dimension"),l=t("./focus"),r=t("./renderer"),u=t("./renderer-smart"),d=t("./selection"),h=(t("../common/util"),t("../common/constMap").renderState,{columnFixCount:0,columnModelList:[],keyColumnName:null,selectType:"",autoNumbering:!0,headerHeight:35,rowHeight:27,fitToParentHeight:!1,showDummyRows:!1,displayRowCount:10,minimumColumnWidth:50,notUseSmartRendering:!1,columnMerge:[],scrollX:!0,scrollY:!0,useClientSort:!0,singleClickEdit:!1,toolbar:{hasResizeHandler:!0,hasControlPanel:!0,hasPagination:!0}}),c=tui.util.defineClass({init:function(t,e){t=$.extend(!0,{},h,t),this.gridId=t.gridId,this.columnModel=this._createColumnModel(t),this.dataModel=this._createDataModel(t,e),this.toolbarModel=this._createToolbarModel(t),this.dimensionModel=this._createDimensionModel(t,e),this.renderModel=this._createRenderModel(t),this.focusModel=this._createFocusModel(e),this.selectionModel=this._createSelectionModel(),this.dimensionModel.renderModel=this.renderModel},_createColumnModel:function(t){return new n({hasNumberColumn:t.autoNumbering,keyColumnName:t.keyColumnName,columnFixCount:t.columnFixCount,selectType:t.selectType,columnMerge:t.columnMerge,columnModelList:t.columnModelList})},_createDataModel:function(t,e){return new o([],{gridId:this.gridId,domState:e,columnModel:this.columnModel,useClientSort:t.useClientSort})},_createToolbarModel:function(t){return new s(t.toolbar)},_createDimensionModel:function(t,e){var i={headerHeight:t.headerHeight,rowHeight:t.rowHeight,fitToParentHeight:t.fitToParentHeight,scrollX:!!t.scrollX,scrollY:!!t.scrollY,minimumColumnWidth:t.minimumColumnWidth,displayRowCount:t.displayRowCount};return this.toolbarModel.isVisible()||(i.toolbarHeight=0),new a(i,{columnModel:this.columnModel,dataModel:this.dataModel,domState:e})},_createFocusModel:function(t){return new l(null,{columnModel:this.columnModel,dataModel:this.dataModel,dimensionModel:this.dimensionModel,renderModel:this.renderModel,domState:t})},_createSelectionModel:function(){return new d(null,{columnModel:this.columnModel,dataModel:this.dataModel,dimensionModel:this.dimensionModel,renderModel:this.renderModel,focusModel:this.focusModel})},_createRenderModel:function(t){var e,i,n;return e={emptyMessage:t.emptyMessage,showDummyRows:t.showDummyRows},i={columnModel:this.columnModel,dataModel:this.dataModel,dimensionModel:this.dimensionModel},new(n=t.notUseSmartRendering?r:u)(e,i)},destroy:function(){_.each(this,function(t,e){t&&tui.util.isFunction(t._destroy)&&t._destroy(),t&&tui.util.isFunction(t.stopListening)&&t.stopListening(),this[e]=null},this)}});e.exports=c},{"../common/constMap":8,"../common/util":10,"./data/columnModel":13,"./data/rowList":16,"./dimension":17,"./focus":18,"./renderer":21,"./renderer-smart":20,"./selection":24,"./toolbar":25}],20:[function(t,e,i){"use strict";var n=t("./renderer"),o=t("../common/util"),s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.on("change:scrollTop",this._onChange,this),this.listenTo(this.dimensionModel,"change:bodyHeight",this._onChange,this),this.setOwnProperties({hiddenRowCount:10,criticalPoint:3})},_onChange:function(){this._isRenderable(this.get("scrollTop"))&&this.refresh()},_setRenderingRange:function(t){var e,i=this.dimensionModel,n=this.dataModel,s=i.get("rowHeight"),a=i.get("displayRowCount"),l=Math.max(0,Math.ceil(t/(s+1))-this.hiddenRowCount),r=Math.min(n.length-1,l+a+2*this.hiddenRowCount);n.isRowSpanEnable()&&(l+=this._getStartRowSpanMinCount(l),r+=this._getEndRowSpanMaxCount(r)),e=0===l?0:o.getHeight(l,s)-1,this.set({top:e,startIndex:l,endIndex:r})},_getStartRowSpanMinCount:function(t){var e,i=this.dataModel.at(t),n=0;return i&&(e=_.pluck(i.getRowSpanData(),"count"),e.push(0),n=_.min(e)),n},_getEndRowSpanMaxCount:function(t){var e,i=this.dataModel.at(t),n=0;return i&&(e=_.pluck(i.getRowSpanData(),"count"),e.push(0),n=_.max(e)),n},_isRenderable:function(t){var e=this.dimensionModel,i=this.dataModel,n=e.get("rowHeight"),o=e.get("bodyHeight"),s=i.length,a=Math.max(0,Math.ceil(t/(n+1))),l=Math.min(i.length-1,Math.floor((t+o)/(n+1))),r=this.get("startIndex"),u=this.get("endIndex");return 0!==r&&r+this.criticalPoint>a?!0:u!==s-1&&u-this.criticalPoint=n;n+=1)i=this.dataModel.at(n),a.push(this._createViewDataFromDataModel(i,o.lside,s)),l.push(this._createViewDataFromDataModel(i,o.rside)),s+=1;this._resetViewModelList("lside",a),this._resetViewModelList("rside",l)},_getActualRowCount:function(){return this.get("endIndex")-this.get("startIndex")+1},_clearDummyRows:function(){var t=this.get("endIndex")-this.get("startIndex")+1;_.each(["lside","rside"],function(e){for(var i=this.get(e);i.length>t;)i.pop()},this)},_fillDummyRows:function(){var t=this.dimensionModel.get("displayRowCount"),e=this._getActualRowCount(),i=Math.max(t-e,0);_.times(i,function(){this.get("lside").add({}),this.get("rside").add({})},this),this.set("dummyRowCount",i)},refresh:function(t){var e,i,n;for(this._setRenderingRange(this.get("scrollTop")), +e=this.get("startIndex"),i=this.get("endIndex"),this._resetAllViewModelListWithRange(e,i),this.get("showDummyRows")&&this._fillDummyRows(),n=e;i>=n;n+=1)this._executeRelation(n);this.isColumnModelChanged?(this.trigger("columnModelChanged"),this.isColumnModelChanged=!1):this.trigger("rowListChanged",t),this._refreshState(),this.trigger("refresh")},_refreshState:function(){this.dataModel.length?this.set("state",s.DONE):this.set("state",s.EMPTY)},_getCollectionByColumnName:function(t){var e,i=this.get("lside");return e=i.at(0)&&i.at(0).get(t)?i:this.get("rside")},getCellData:function(t,e){var i=this._getCollectionByColumnName(e),n=i.get(t);return n?n.get(e):void 0},_executeRelation:function(t){var e,i,n=this.dataModel.at(t),o=t-this.get("startIndex");i=n.getRelationResult(),_.each(i,function(t,i){e=this._getCollectionByColumnName(i).at(o),e&&e.setCell(i,t)},this)},_destroy:function(){clearTimeout(this.timeoutIdForRefresh)}}));e.exports=a},{"../base/model":5,"../common/constMap":8,"../common/util":10,"./rowList":23}],22:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=n.extend({initialize:function(t,e){var i=t&&t.rowKey,n=this.collection.dataModel,o=n.get(i);o&&(this.listenTo(o,"change restore",this._onDataModelChange),this.listenTo(o,"extraDataChanged",this._setRowExtraData),this.listenTo(n,"disabledChanged",this._onDataModelDisabledChanged),this.rowData=o)},idAttribute:"rowKey",_onDataModelChange:function(t){_.each(t.changed,function(t,e){this.setCell(e,{value:t})},this)},_getColumnNameList:function(){var t=this.collection.columnModel.getVisibleColumnModelList(null,!0);return _.pluck(t,"columnName")},_isDisabled:function(t,e){var i=this.collection.dataModel.isDisabled;return i||(i="_button"===t?e.isDisabledCheck:e.isDisabled),i},_onDataModelDisabledChanged:function(){var t=this._getColumnNameList(),e=this.rowData.getRowState();_.each(t,function(t){this.setCell(t,{isDisabled:this._isDisabled(t,e)})},this)},_setRowExtraData:function(){var t,e=this.collection.dataModel,i=this._getColumnNameList(),n=this.rowData.getRowState();tui.util.isUndefined(this.collection)||_.each(i,function(i){var o,s,a=this.get(i),l=this;tui.util.isUndefined(a)||(o=this.rowData.isEditable(i),s=this._isDisabled(i,n),e.isRowSpanEnable()&&!a.isMainRow&&(l=this.collection.get(a.mainRowKey)),l&&(t={isDisabled:s,isEditable:o,className:this.rowData.getClassNameList(i).join(" ")},l.setCell(i,t)))},this)},parse:function(t,e){return this._formatData(t,e.collection.dataModel)},_formatData:function(t,e){var i,n,o=t.rowKey;return _.isUndefined(o)?t:(i=e.get(o),n=i.getRowState(),_.each(t,function(s,a){var l;"rowKey"!==a&&"_extraData"!==a&&(l=e.isRowSpanEnable()&&t._extraData&&t._extraData.rowSpanData&&t._extraData.rowSpanData[a]?t._extraData.rowSpanData[a]:{mainRowKey:o,count:0,isMainRow:!0},t[a]={rowKey:o,columnName:a,value:s,rowSpan:l.count,isMainRow:l.isMainRow,mainRowKey:l.mainRowKey,isEditable:i.isEditable(a),isDisabled:this._isDisabled(a,n),className:i.getClassNameList(a).join(" "),optionList:[],changed:[]})},this),t)},setCell:function(t,e){var i,n,s,a=!1,l=[];this.get(t)&&(n=this.get("rowKey"),s=_.clone(this.get(t)),_.each(e,function(t,e){o.isEqual(s[e],t)||(a="value"===e?!0:a,s[e]=t,l.push(e))},this),l.length&&(s.changed=l,this.set(t,s),a&&(i=this.collection.dataModel.indexOfRowKey(n),this.trigger("valueChange",i))))}});e.exports=s},{"../base/model":5,"../common/util":10}],23:[function(t,e,i){"use strict";var n=t("../base/collection"),o=t("./row"),s=n.extend({model:o,initialize:function(t,e){this.setOwnProperties({dataModel:e.dataModel,columnModel:e.columnModel})}});e.exports=s},{"../base/collection":3,"./row":22}],24:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s={cell:"cell",row:"row",column:"column"},a=n.extend({initialize:function(t,e){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({dataModel:e.dataModel,columnModel:e.columnModel,dimensionModel:e.dimensionModel,focusModel:e.focusModel,renderModel:e.renderModel,inputRange:null,intervalIdForAutoScroll:null,scrollPixelScale:40,_isEnabled:!0,_selectionState:s.cell}),this.listenTo(this.dataModel,"add remove sort reset",this.end),this.listenTo(this.dataModel,"paste",this._onPasteData)},defaults:{range:null},_onPasteData:function(t){this.start(t.startIdx.row,t.startIdx.column),this.update(t.endIdx.row,t.endIdx.column)},setState:function(t){this._selectionState=s[t]||this._selectionState},getState:function(){return this._selectionState},enable:function(){this._isEnabled=!0},disable:function(){this.end(),this._isEnabled=!1},isEnabled:function(){return this._isEnabled},start:function(t,e,i){this._isEnabled&&(this.setState(i),this.inputRange={row:[t,t],column:[e,e]},this._resetRangeAttribute())},startByMousePosition:function(t,e,i){var n=this.dimensionModel.getIndexFromMousePosition(t,e);this.start(n.row,n.column,i)},update:function(t,e,i){var n;!this._isEnabled||0>t||0>e||(this.hasSelection()?this.setState(i):(n=this.focusModel.indexOf(),this.start(n.row,n.column,i)),this._updateInputRange(t,e),this._resetRangeAttribute())},_updateInputRange:function(t,e){var i=this.inputRange;i.row[1]=t,i.column[1]=e},extendColumnSelection:function(t,e,i){var n,s=this._minimumColumnRange,a=this.dimensionModel.getIndexFromMousePosition(e,i),l={row:[0,0],column:[]};t&&t.length||(t=[a.column]),this._setScrolling(e,i),s?n=o.getMinMax(t.concat(s)):(t.push(this.inputRange.column[0]),n=o.getMinMax(t)),l.column.push(n.min,n.max),this._resetRangeAttribute(l)},_setScrolling:function(t,e){var i=this.dimensionModel.getOverflowFromMousePosition(t,e);this.stopAutoScroll(),this._isAutoScrollable(i.x,i.y)&&(this.intervalIdForAutoScroll=setInterval(_.bind(this._adjustScroll,this,i.x,i.y)))},updateByMousePosition:function(t,e,i){var n=this.dimensionModel.getIndexFromMousePosition(t,e);this._setScrolling(t,e),this.update(n.row,n.column,i)},end:function(){this.inputRange=null,this.unset("range"),this.unsetMinimumColumnRange()},stopAutoScroll:function(){_.isNull(this.intervalIdForAutoScroll)||(clearInterval(this.intervalIdForAutoScroll),this.intervalIdForAutoScroll=null)},selectRow:function(t){this._isEnabled&&(this.focusModel.focusAt(t,0),this.start(t,0,s.row),this.update(t,this.columnModel.getVisibleColumnModelList().length-1))},selectColumn:function(t){this._isEnabled&&(this.focusModel.focusAt(0,t),this.start(0,t,s.column),this.update(this.dataModel.length-1,t))},selectAll:function(){this._isEnabled&&(this.start(0,0,s.cell),this.update(this.dataModel.length-1,this.columnModel.getVisibleColumnModelList().length-1))},getStartIndex:function(){var t=this.get("range");return{row:t.row[0],column:t.column[0]}},getEndIndex:function(){var t=this.get("range");return{row:t.row[1],column:t.column[1]}},hasSelection:function(){return!!this.get("range")},_isSingleCell:function(t,e){var i=1===t.length,n=1===e.length,o=i&&!n&&e[0].getRowSpanData(t[0]).count===e.length;return i&&n||o},getValuesToString:function(){var t,e,i,n,o=this.get("range");return t=this.columnModel.getVisibleColumnModelList().slice(o.column[0],o.column[1]+1),e=this.dataModel.slice(o.row[0],o.row[1]+1),i=_.pluck(t,"columnName"),n=_.map(e,function(t){var e=_.map(i,function(e){return t.getVisibleText(e)});return e.join(" ")}),this._isSingleCell(i,e)?n[0]:n.join("\n")},_isAutoScrollable:function(t,e){return!(0===t&&0===e)},_adjustScroll:function(t,e){var i=this.renderModel;t&&this._adjustScrollLeft(t,i.get("scrollLeft"),i.get("maxScrollLeft")),e&&this._adjustScrollTop(e,i.get("scrollTop"),i.get("maxScrollTop"))},_adjustScrollLeft:function(t,e,i){var n=e,o=this.scrollPixelScale;0>t?n=Math.max(0,e-o):t>0&&(n=Math.min(i,e+o)),this.renderModel.set("scrollLeft",n)},_adjustScrollTop:function(t,e,i){var n=e,o=this.scrollPixelScale;0>t?n=Math.max(0,e-o):t>0&&(n=Math.min(i,e+o)),this.renderModel.set("scrollTop",n)},_resetRangeAttribute:function(t){var e,i,n,o=this.dataModel;if(t=t||this.inputRange,!t)return void this.set("range",null);if(i={row:_.sortBy(t.row),column:_.sortBy(t.column)},o.isRowSpanEnable())do n=_.assign([],i.row),i=this._getRowSpannedIndex(i),e=i.row[0]!==n[0]||i.row[1]!==n[1];while(e);switch(this._setRangeMinMax(i.row,i.column),this._selectionState){case s.column:i.row=[0,o.length-1];break;case s.row:i.column=[0,this.columnModel.getVisibleColumnModelList().length-1];break;case s.cell:}this.set("range",i)},setMinimumColumnRange:function(t){this._minimumColumnRange=_.extend(t)},unsetMinimumColumnRange:function(){this._minimumColumnRange=null},_setRangeMinMax:function(t,e){t&&(t[0]=Math.max(0,t[0]),t[1]=Math.min(this.dataModel.length-1,t[1])),e&&(e[0]=Math.max(0,e[0]),e[1]=Math.min(this.columnModel.getVisibleColumnModelList().length-1,e[1]))},_concatRowSpanIndexFromStart:function(t){var e,i=t.startIndex,n=t.endIndex,o=t.columnName,s=t.startRowSpanDataMap&&t.startRowSpanDataMap[o],a=t.startIndexList,l=t.endIndexList;s&&(s.isMainRow?(e=i+s.count-1,e>n&&l.push(e)):(e=i+s.count,a.push(e)))},_concatRowSpanIndexFromEnd:function(t){var e,i,n=t.endIndex,o=t.columnName,s=t.endRowSpanDataMap&&t.endRowSpanDataMap[o],a=t.endIndexList,l=t.dataModel;s&&(s.isMainRow?(e=n+s.count-1,a.push(e)):(e=n+s.count,i=l.at(e).getRowSpanData(o),e+=i.count-1,e>n&&a.push(e)))},_getRowSpannedIndex:function(t){var e,i,n,o,s=this.columnModel.getVisibleColumnModelList().slice(t.column[0],t.column[1]+1),a=this.dataModel,l=[t.row[0]],r=[t.row[1]],u=a.at(t.row[0]),d=a.at(t.row[1]),h=$.extend({},t);return u&&d?(e=a.at(t.row[0]).getRowSpanData(),i=a.at(t.row[1]).getRowSpanData(),_.each(s,function(s){n=s.columnName,o={columnName:n,startIndex:t.row[0],endIndex:t.row[1],endRowSpanDataMap:i,startRowSpanDataMap:e,startIndexList:l,endIndexList:r,dataModel:a},this._concatRowSpanIndexFromStart(o),this._concatRowSpanIndexFromEnd(o)},this),h.row=[Math.min.apply(null,l),Math.max.apply(null,r)],h):h}});e.exports=a},{"../base/model":5,"../common/util":10}],25:[function(t,e,i){"use strict";var n=t("../base/model"),o=(t("../common/util"),n.extend({initialize:function(t){n.prototype.initialize.apply(this,arguments)},defaults:{hasControlPanel:!1,hasPagination:!1,hasResizeHandler:!1,isExcelButtonVisible:!1,isExcelAllButtonVisible:!1,pagination:null},isVisible:function(){return this.get("hasControlPanel")||this.get("hasPagination")||this.get("hasResizeHandler")}}));e.exports=o},{"../base/model":5,"../common/util":10}],26:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").keyName,a=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setOwnProperties({_keyDownSwitch:$.extend({},this._defaultKeyDownSwitch)})},redrawAttributes:["isEditable","optionList","value"],template:_.template(''+t+""},getHtml:function(t){var e,i=o.getAttributesString(this.getAttributes(t)),n=this._getContentHtml(t);return e=this.template({columnName:t.columnName,rowSpan:t.rowSpan,className:this._getClassNameList(t).join(" "),editType:this.getEditType(),attributeString:i,contentHtml:n||" "})},redraw:function(t,e){var i={"class":this._getClassNameList(t).join(" ")};t.rowSpan&&(i.rowSpan=t.rowSpan),i["edit-type"]=this.getEditType(),i=$.extend(i,this.getAttributes(t)),e.attr(i),e.html(this._getContentHtml(t))},_getCellData:function(t){var e=this._getCellAddress(t);return this.grid.renderModel.getCellData(e.rowKey,e.columnName)},_getCellAddress:function(t){return{rowKey:this.getRowKey(t),columnName:this.getColumnName(t)}},_validateData:function(t,e){var i=this.grid.dataModel.get(t);i.validateCell(e)},_getConvertedHtml:function(t,e){var i,n=this.getColumnModel(e),o=n.editOption;return o&&tui.util.isFunction(o.converter)&&(i=o.converter(t,this.grid.dataModel.get(e.rowKey).attributes)),tui.util.isFalsy(i)&&(i=null),i},getColumnName:function(t){return t.closest("td").attr("columnName")},getRowKey:function(t){return t.closest("tr").attr("key")},getColumnModel:function(t){return this.grid.columnModel.getColumnModel(t.columnName)},getAttributes:function(t){var e=this.getColumnModel(t);return{align:e.align||"left"}},focusOut:function(){this.grid.focusModel.focusClipboard()},getEditType:function(){return"normal"},focusIn:function(t){},getContentHtml:function(t){return""},setElementAttribute:function(t,e,i){}});e.exports=a},{"../base/painter":6,"../common/constMap":8,"../common/util":10}],27:[function(t,e,i){"use strict";var n=t("./list"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setKeyDownSwitch({UP_ARROW:function(){},DOWN_ARROW:function(){},PAGE_UP:function(){},PAGE_DOWN:function(){},ENTER:function(t,e){e.$target.trigger("click")},LEFT_ARROW:function(t,e){this._focusPrevInput(e.$target)},RIGHT_ARROW:function(t,e){this._focusNextInput(e.$target)},ESC:function(t,e){this.focusOut(e.$target)},TAB:function(t,e){t.shiftKey?this._focusPrevInput(e.$target)||this.grid.focusModel.focusIn(e.rowKey,e.focusModel.prevColumnName(),!0):this._focusNextInput(e.$target)||this.grid.focusModel.focusIn(e.rowKey,e.focusModel.nextColumnName(),!0)}})},eventHandler:{"change input":"_onChange","keydown input":"_onKeyDown","blur input":"_onBlur"},getEditType:function(){return"button"},contentTemplate:_.template(' <% if (isDisabled) print("disabled"); %>/>'),labelTemplate:_.template(''),focusIn:function(t){t.find("input").eq(0).prop("disabled")?this.grid.focusModel.focusClipboard():t.find("input").eq(0).focus()},getContentHtml:function(t){var e,i=this.getOptionList(t),n=this.grid.columnModel.getColumnModel(t.columnName),s=t.value,a=(""+s).split(","),l={},r=this._getConvertedHtml(s,t),u=o.getUniqueKey(),d=t.isDisabled,h=n.editOption.type;return _.isNull(r)&&(r="",_.each(a,function(t){l[t]=!0}),_.each(i,function(t){e=u+"_"+t.value,r+=this.contentTemplate({type:h,name:u,id:e,value:t.value,isChecked:!!l[t.value],isDisabled:d}),t.text&&(r+=this.labelTemplate({id:e,labelText:t.text}))},this)),r},setElementAttribute:function(t,e){var i=t.value,n=(""+i).split(",");e.find("input:checked").prop("checked",!1),tui.util.forEachArray(n,function(t){e.find('input[value="'+t+'"]').prop("checked",!0)})},_focusNextInput:function(t){return this._focusTargetInput(t,"next")},_focusPrevInput:function(t){return this._focusTargetInput(t,"prev")},_focusTargetInput:function(t,e){var i,n=t,o=!1;"next"===e?i=function(t){return t.next()}:"prev"===e&&(i=function(t){return t.prev()});do n=i(n);while(n.length&&!n.is("input"));return n.length&&(n.focus(),o=!0),o},_getCheckedValueList:function(t){var e=t.closest("td").find("input:checked"),i=[];return tui.util.forEachArray(e,function(t,n){i.push(e.eq(n).val())}),i},_onChange:function(t){var e=$(t.target),i=this._getCellAddress(e);this.grid.dataModel.setValue(i.rowKey,i.columnName,this._getCheckedValueList(e).join(","))},_onBlur:function(t){var e=this._getCellAddress($(t.target));this._validateData(e.rowKey,e.columnName)}});e.exports=s},{"../../common/util":10,"./list":28}],28:[function(t,e,i){"use strict";var n=t("../cell"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},redrawAttributes:["isDisabled","isEditable","optionList"],eventHandler:{},getEditType:function(){},focusIn:function(t){},getContentHtml:function(t){throw this.error("Implement getContentHtml(cellData, $target) method. On re-rendering")},setElementAttribute:function(t,e,i){throw this.error("Implement setElementAttribute(cellData, $target) method. ")},getOptionList:function(t){var e=this.grid.columnModel.getColumnModel(t.columnName);return t.optionList&&t.optionList.length?t.optionList:e.editOption.list}});e.exports=o},{"../cell":26}],29:[function(t,e,i){"use strict";var n=t("../cell"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setKeyDownSwitch({UP_ARROW:function(){},DOWN_ARROW:function(){},ENTER:function(t,e){this.focusOut(e.$target)},LEFT_ARROW:function(){},RIGHT_ARROW:function(){},ESC:function(){}})},redrawAttributes:["isDisabled","isEditable","optionList"],eventHandler:{mousedown:"_onMouseDown","change input":"_onChange","keydown input":"_onKeyDown"},contentTemplate:_.template(' <% if (isDisabled) print("disabled") %>/>'),getEditType:function(){return"_button"},getContentHtml:function(t){var e=t.isDisabled;return this.contentTemplate({type:this.grid.columnModel.get("selectType"),name:this.grid.id,isChecked:!!t.value,isDisabled:e})},focusIn:function(){},setElementAttribute:function(t,e){var i=e.find("input"),n=i.prop("checked");n!==!!t.value&&i.prop("checked",t.value)},toggle:function(t){var e=t.find("input");"checkbox"===this.grid.columnModel.get("selectType")&&e.prop("checked",!e.prop("checked"))},getAttributes:function(){return{align:"center"}},_onChange:function(t){var e=$(t.target),i=this.getRowKey(e);this.grid.dataModel.setValue(i,"_button",e.prop("checked"))},_onMouseDown:function(t){var e=$(t.target);e.is("input")||e.find("input").trigger("click")}});e.exports=o},{"../cell":26}],30:[function(t,e,i){"use strict";var n=t("../cell"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},getEditType:function(){return"normal"},getContentHtml:function(t){var e=t.columnName,i=this.grid.columnModel.getColumnModel(e),n=this.grid.dataModel.get(t.rowKey).getHTMLEncodedString(e),o=t.rowKey;return tui.util.isFunction(i.formatter)&&(n=i.formatter(n,this.grid.dataModel.get(o).toJSON(),i)),tui.util.isExisty(n)||(n=""),n},focusIn:function(){this.grid.focusModel.focusClipboard()},setElementAttribute:function(t,e,i){}});e.exports=o},{"../cell":26}],31:[function(t,e,i){"use strict";var n=t("./normal"),o=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},redrawAttributes:[],getEditType:function(){return"_number"},getContentHtml:function(t){return t.value}});e.exports=o},{"./normal":30}],32:[function(t,e,i){"use strict";var n=t("./list"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.setKeyDownSwitch({ESC:function(t,e){this.focusOut(e.$target)},ENTER:function(t,e){this.focusOut(e.$target)}})},eventHandler:{"change select":"_onChange","keydown select":"_onKeyDown","blur select":"_onBlurSelect"},contentTemplate:_.template(''),optionTemplate:_.template(''),_onBlurSelect:function(t){var e=this._getCellAddress($(t.target));this._validateData(e.rowKey,e.columnName)},getEditType:function(){return"select"},focusIn:function(t){t.find("select").prop("disabled")?this.grid.focusModel.focusClipboard():t.find("select").eq(0).focus()},getContentHtml:function(t){var e=this.getOptionList(t),i=t.isDisabled,n=this._getConvertedHtml(t.value,t),s="";return tui.util.isNull(n)&&(_.each(e,function(e){s+=this.optionTemplate({value:e.value,cellDataValue:t.value,text:e.text})},this),n=this.contentTemplate({name:o.getUniqueKey(),isDisabled:i,options:s})),n},_getContentHtml:function(t){var e,i,n=t.columnName,o=this.grid.columnModel.getColumnModel(n),s=o.editOption||{},a="";return tui.util.isExisty(t.value)||(t.value=o.defaultValue),e=this._getExtraContent(s.beforeContent||s.beforeText,t),i=this._getExtraContent(s.afterContent||s.afterText,t),e&&(a+=this._getSpanWrapContent(e,"before",t)),i&&(a+=this._getSpanWrapContent(i,"after",t)),a+=this._getSpanWrapContent(this.getContentHtml(t),"input")},setElementAttribute:function(t,e,i){var n=e.find("select");i&&n.blur(),n.val(t.value),i&&n.focus()},_onChange:function(t){var e=$(t.target),i=this._getCellAddress(e),n=this.grid;n.dataModel.setValue(i.rowKey,i.columnName,e.val())}});e.exports=s},{"../../common/util":10,"./list":28}],33:[function(t,e,i){"use strict";var n=t("../cell"),o=t("./text"),s=t("../../common/util"),a=t("../../common/formUtil"),l=tui.util.defineClass(o,{init:function(){o.apply(this,arguments),this.setOwnProperties({timeoutIdForClick:0,editingCell:{rowKey:null,columnName:""},clicked:{rowKey:null,columnName:null}})},redrawAttributes:["isDisabled","isEditable","value"],eventHandler:{dblclick:"_onDblClick",mousedown:"_onMouseDown","blur input":"_onBlurConvertible","keydown input":"_onKeyDown","focus input":"_onFocus","selectstart input":"_onSelectStart"},contentTemplate:_.template('/>'),getEditType:function(){return"text-convertible"},focusIn:function(t){this._startEdit(t)},focusOut:function(){this.grid.focusModel.focusClipboard()},getContentHtml:function(t){var e=this.getColumnModel(t),i=this.grid.dataModel.get(t.rowKey).getHTMLEncodedString(t.columnName);return tui.util.isUndefined(i)&&(i=""),this._isEditingCell(t)?this.contentTemplate({type:this._getInputType(),value:i,name:s.getUniqueKey(),isDisabled:t.isDisabled,maxLength:e.editOption.maxLength}):(tui.util.isFunction(e.formatter)&&(i=e.formatter(i,this.grid.dataModel.get(t.rowKey).attributes,e)),i)},_getContentHtml:function(t){var e;return e=this._isEditingCell(t)?o.prototype:n.prototype,e._getContentHtml.call(this,t)},_isEditingCell:function(t){var e=this.editingCell;return e.rowKey===t.rowKey.toString()&&e.columnName===t.columnName.toString()},setElementAttribute:function(t,e,i){},_onBlurConvertible:function(t){var e=$(t.target),i=e.closest("td"),n=this.grid.focusModel;this._onBlur(t),this._endEdit(i),this._validateData(this.getRowKey(i),this.getColumnName(i)),_.defer(function(){n.refreshState()})},_startEdit:function(t){var e,i,n,o,s=this.grid.dataModel;this._blurEditingCell(),i=this.getRowKey(t),n=this.getColumnName(t),o=s.get(i).getCellState(n),!o.isEditable||s.isDisabled||o.isDisabled||(this.editingCell={rowKey:i,columnName:n},this.redraw(this._getCellData(t),t),e=t.find("input"),this.originalText=e.val(),a.setCursorToEnd(e.get(0)),e.select())},_endEdit:function(t){var e=this._getCellData(t);this.editingCell={rowKey:null,columnName:null},this.clicked={rowKey:null,columnName:null},e&&this.redraw(e,t)},_blurEditingCell:function(){var t,e=this.editingCell.rowKey,i=this.editingCell.columnName;tui.util.isNull(e)||tui.util.isNull(i)||(t=this.grid.dataModel.getElement(e,i),t.find("input")[0].blur())},_onDblClick:function(t){var e=$(t.target),i=e.closest("td"),n=this._getCellAddress(i);this._isEditingCell(n)||this._startEdit(i)},_onMouseDown:function(t){$(t.target).is("input")&&t.stopPropagation()}});e.exports=l},{"../../common/formUtil":9,"../../common/util":10,"../cell":26,"./text":35}],34:[function(t,e,i){"use strict";var n=t("./text"),o=tui.util.defineClass(n,{init:function(t,e){n.apply(this,arguments)},_getInputType:function(){return"password"},getEditType:function(){return"text-password"}});e.exports=o},{"./text":35}],35:[function(t,e,i){"use strict";var n=t("../cell"),o=t("../../common/util"),s=t("../../common/formUtil"),a=tui.util.defineClass(n,{init:function(t,e){n.apply(this,arguments),this.setOwnProperties({originalText:""}),this.setKeyDownSwitch({UP_ARROW:function(){},DOWN_ARROW:function(){},PAGE_UP:function(){},PAGE_DOWN:function(){},ENTER:function(t,e){this.focusOut(e.$target.closest("td"))},ESC:function(t,e){this._restore(e.$target),this.focusOut(e.$target.closest("td"))}})},redrawAttributes:["isEditable"],eventHandler:{"blur input":"_onBlur","keydown input":"_onKeyDown","focus input":"_onFocus","selectstart input":"_onSelectStart"},contentTemplate:_.template('/>'),_getInputType:function(){return"text"},getEditType:function(){return"text"},focusIn:function(t){var e=t.find("input");e.prop("disabled")?this.grid.focusModel.focusClipboard():(s.setCursorToEnd(e.get(0)),e.select())},focusOut:function(){this.grid.focusModel.focusClipboard()},getContentHtml:function(t){var e,i=this.getColumnModel(t),n=i.editOption,s=this.grid.dataModel.get(t.rowKey).getHTMLEncodedString(t.columnName);return tui.util.isUndefined(s)&&(s=""),e=this._getConvertedHtml(s,t),tui.util.isNull(e)&&(e=this.contentTemplate({type:this._getInputType(),value:s,name:o.getUniqueKey(),isDisabled:t.isDisabled,maxLength:n.maxLength})),e},setElementAttribute:function(t,e){var i=-1!==$.inArray("value",t.changed),n=e.find("input");i&&n.val(t.value),n.prop("disabled",t.isDisabled)},_isEdited:function(t){return t.val()!==this.originalText},_restore:function(t){t.val(this.originalText)},_getContentHtml:function(t){var e,i,n=t.columnName,o=this.grid.columnModel.getColumnModel(n),s=o.editOption||{},a="";return tui.util.isExisty(t.value)||(t.value=o.defaultValue),e=this._getExtraContent(s.beforeContent||s.beforeText,t),i=this._getExtraContent(s.afterContent||s.afterText,t),e&&(a+=this._getSpanWrapContent(e,"before",t)),i&&(a+=this._getSpanWrapContent(i,"after",t)),a+=this._getSpanWrapContent(this.getContentHtml(t),"input")},_onBlur:function(t){var e=$(t.target),i=this.getRowKey(e),n=this.getColumnName(e);this._executeInputEventHandler(t,"blur"),this._isEdited(e)&&this.grid.dataModel.setValue(i,n,e.val()),this.grid.selectionModel.enable(),this._validateData(i,n)},_onFocus:function(t){var e=$(t.target);this.originalText=e.val(),this._executeInputEventHandler(t,"focus"),this.grid.selectionModel.end()},_onKeyDown:function(t){this._executeInputEventHandler(t,"keydown"),n.prototype._onKeyDown.call(this,t)},_executeInputEventHandler:function(t,e){var i=$(t.target),n=this._getCellAddress(i),o=this.grid.columnModel.getColumnModel(n.columnName),s=tui.util.pick(o,"editOption","inputEvents",e);return _.isFunction(s)?s(t,n):null},_onSelectStart:function(t){t.stopPropagation()}});e.exports=a},{"../../common/formUtil":9,"../../common/util":10,"../cell":26}],36:[function(t,e,i){"use strict";var n=t("../base/painter"),o=(t("../common/util"),tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},eventHandler:{dblclick:"_onDblClick"},template:_.template(' '),getEditType:function(){return"dummy"},_onDblClick:function(){this.grid.dataModel.append({},{focus:!0})},getHtml:function(t){var e=this.grid.columnModel.isMetaColumn(t);return this.template({columnName:t,className:(e?"meta_column ":"")+"dummy"})}}));e.exports=o},{"../base/painter":6,"../common/util":10}],37:[function(t,e,i){"use strict";var n=t("./cell/mainButton"),o=t("./cell/number"),s=t("./cell/normal"),a=t("./cell/button"),l=t("./cell/select"),r=t("./cell/text"),u=t("./cell/text-convertible"),d=t("./cell/text-password"),h=t("./dummyCell"),c=t("./row"),m=tui.util.defineClass({init:function(t){this.modelManager=t.modelManager,this.cellPainters=this._createCellPainters(),this.rowPainter=this._createRowPainter()},_createCellPainters:function(){var t={},e={grid:this.modelManager},i=[new n(e),new o(e),new s(e),new a(e),new l(e),new r(e),new d(e),new u(e),new h(e)];return _.each(i,function(e){t[e.getEditType()]=e}),t},_createRowPainter:function(){return new c({grid:this.modelManager,painterManager:this})},getCellPainter:function(t){var e=this.cellPainters[t];return e||(e="radio"===t||"checkbox"===t?this.cellPainters.button:this.cellPainters.normal),e},getCellPainters:function(){return this.cellPainters},getRowPainter:function(){return this.rowPainter}});e.exports=m},{"./cell/button":27,"./cell/mainButton":29,"./cell/normal":30,"./cell/number":31,"./cell/select":32,"./cell/text":35,"./cell/text-convertible":33,"./cell/text-password":34,"./dummyCell":36,"./row":38}],38:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.painterManager=t.painterManager},template:_.template('<%=contents%>'),onModelChange:function(t,e){_.each(t.changed,function(t,i){var n,o;"_extraData"!==i&&(n=this._getEditType(i,t),o=this.painterManager.getCellPainter(n),o.onModelChange(t,e))},this)},_getEditType:function(t,e){var i=this.grid.columnModel.getEditType(t);return e.isEditable||"_number"===t||(i="normal"),i},_getHtmlForDummyRow:function(t){var e=this.painterManager.getCellPainter("dummy"),i="";return _.each(t,function(t){i+=e.getHtml(t.columnName)}),i},_getHtmlForActualRow:function(t,e){var i="";return _.each(e,function(e){var n,o,s=e.columnName,a=t.get(s);a&&a.isMainRow&&(n=this._getEditType(s,a),o=this.painterManager.getCellPainter(n),i+=o.getHtml(a))},this),i},getHtml:function(t,e){var i,n=t.get("rowKey");return i=_.isUndefined(n)?this._getHtmlForDummyRow(e):this._getHtmlForActualRow(t,e),this.template({key:n,height:this.grid.dimensionModel.get("rowHeight")+s._extraHeight,contents:i,className:""})},"static":{_extraHeight:function(){var t=0;return o.isBrowserIE7()&&(t=-2),t}()}});e.exports=s},{"../base/painter":6,"../common/util":10}],39:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){this.publicObject=t},_listenForThrough:function(t,e){_.each(e,function(e){this.listenTo(t,e,_.bind(this._triggerOnPublic,this,e))},this)},_listenForRename:function(t,e,i){this.listenTo(t,e,_.bind(this._triggerOnPublic,this,i))},_triggerOnPublic:function(t,e){this.publicObject.trigger(t,e)},listenToNetAddon:function(t){ +this._listenForThrough(t,["beforeRequest","response","successResponse","failResponse","errorResponse"])},listenToContainerView:function(t){this._listenForThrough(t,["click","dblclick","mousedown","clickCell","dblclickCell","mouseoverCell","mouseoutCell","rendered"])},listenToFocusModel:function(t){this._listenForRename(t,"select","selectRow")}});_.extend(n.prototype,Backbone.Events),e.exports=n},{}],40:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").keyCode,a=n.extend({initialize:function(t){this.setOwnProperties({focusModel:t.focusModel,selectionModel:t.selectionModel,painterManager:t.painterManager,dimensionModel:t.dimensionModel,dataModel:t.dataModel,columnModel:t.columnModel,renderModel:t.renderModel,timeoutIdForKeyIn:0,isLocked:!1}),this.listenTo(this.focusModel,"focusClipboard",this._onFocus)},tagName:"textarea",className:"clipboard",events:{keydown:"_onKeyDown",blur:"_onBlur"},_onBlur:function(){var t=this.focusModel;_.defer(function(){t.refreshState()})},_onFocus:function(){try{this.$el.is(":focus")||(this.$el.focus(),this.focusModel.refreshState())}catch(t){}},render:function(){return this},_lock:function(){clearTimeout(this.timeoutIdForKeyIn),this.isLocked=!0,this.timeoutIdForKeyIn=setTimeout($.proxy(this._unlock,this),10)},_unlock:function(){this.isLocked=!1},_onKeyDown:function(t){return this.isLocked?(t.preventDefault(),!1):(t.shiftKey&&(t.ctrlKey||t.metaKey)?this._keyInWithShiftAndCtrl(t):t.shiftKey?this._keyInWithShift(t):t.ctrlKey||t.metaKey?this._keyInWithCtrl(t):this._keyIn(t),void this._lock())},_keyIn:function(t){var e=this.focusModel,i=this.selectionModel,n=e.which(),a=n.rowKey,l=n.columnName,r=this.dimensionModel.get("displayRowCount"),u=!0,d=t.keyCode||t.which;if(!o.isBlank(n.rowKey)){switch(d){case s.UP_ARROW:e.focus(e.prevRowKey(),l,!0);break;case s.DOWN_ARROW:e.focus(e.nextRowKey(),l,!0);break;case s.LEFT_ARROW:e.focus(a,e.prevColumnName(),!0);break;case s.RIGHT_ARROW:e.focus(a,e.nextColumnName(),!0);break;case s.PAGE_UP:e.focus(e.prevRowKey(r-1),l,!0);break;case s.PAGE_DOWN:e.focus(e.nextRowKey(r-1),l,!0);break;case s.HOME:e.focus(a,e.firstColumnName(),!0);break;case s.END:e.focus(a,e.lastColumnName(),!0);break;case s.SPACE:case s.ENTER:this._onEnterSpace(a,l);break;case s.DEL:this._del(a,l);break;case s.TAB:e.focusIn(a,e.nextColumnName(),!0);break;default:u=!1}u&&t.preventDefault(),i.end()}},_onEnterSpace:function(t,e){var i,n=this.columnModel.getEditType(e);"_button"===n?(i=this.cellFactory.getInstance(n),i.toggle(this.dataModel.getElement(t,e))):this.focusModel.focusIn(t,e)},_getIndexBeforeMove:function(){var t,e,i=this.focusModel.indexOf(),n=this.selectionModel.get("range"),o=_.extend({},i);return n&&(t=n.row,e=n.column,o.row=t[0],o.column=e[0],t[1]>i.row&&(o.row=t[1]),e[1]>i.column&&(o.column=e[1])),o},_keyInWithShift:function(t){var e,i,n,o,a=this.focusModel,l=this.dimensionModel,r=this.columnModel.getVisibleColumnModelList(),u=a.which(),d=l.get("displayRowCount"),h=t.keyCode||t.which,c=this._getIndexBeforeMove(),m=!0,g=!0;switch(h){case s.UP_ARROW:c.row-=1;break;case s.DOWN_ARROW:c.row+=1;break;case s.LEFT_ARROW:c.column-=1;break;case s.RIGHT_ARROW:c.column+=1;break;case s.PAGE_UP:c.row=a.prevRowIndex(d-1);break;case s.PAGE_DOWN:c.row=a.nextRowIndex(d-1);break;case s.HOME:c.column=0;break;case s.END:c.column=r.length-1;break;case s.ENTER:g=!1;break;case s.TAB:g=!1,a.focusIn(u.rowKey,a.prevColumnName(),!0);break;default:g=!1,m=!1}e=r[c.column],n=!(!e||!this.dataModel.getRowData(c.row)),g&&n&&(this._updateSelectionByKeyIn(c.row,c.column),i=l.getScrollPosition(c.row,e.columnName),i&&(o=this.selectionModel.getState(),"column"===o?delete i.scrollTop:"row"===o&&delete i.scrollLeft,this.renderModel.set(i))),m&&t.preventDefault()},_keyInWithCtrl:function(t){var e=this.focusModel,i=t.keyCode||t.which;switch(i){case s.CHAR_A:this.selectionModel.selectAll();break;case s.CHAR_C:this._copyToClipboard();break;case s.HOME:e.focus(e.firstRowKey(),e.firstColumnName(),!0);break;case s.END:e.focus(e.lastRowKey(),e.lastColumnName(),!0);break;case s.CHAR_V:this._paste()}},_paste:function(){this._clearClipBoard(),this.pasting||(this.pasting=!0,this._onKeyupCharV())},_onKeyupCharV:function(){this.$el.on("keyup",$.proxy(this.onKeyupCharV,this))},onKeyupCharV:function(){this._pasteToGrid(),this.pasting=!1},_clearClipBoard:function(){this.$el.val("")},_pasteToGrid:function(){var t,e,i=this.selectionModel,n=this.focusModel,o=this.dataModel;t=i.hasSelection()?i.getStartIndex():n.indexOf(),e=this._getProcessClipBoardData(),this.$el.off("keyup"),o.paste(e,t)},_getProcessClipBoardData:function(){for(var t=this.$el.val(),e=t.split("\n"),i=0,n=e.length;n>i;i+=1)e[i]=e[i].split(" ");return e},_keyInWithShiftAndCtrl:function(t){var e=!0,i=this.columnModel.getVisibleColumnModelList(),n=t.keyCode||t.which;switch(n){case s.HOME:this._updateSelectionByKeyIn(0,0);break;case s.END:this._updateSelectionByKeyIn(this.dataModel.length-1,i.length-1);break;default:e=!1}e&&t.preventDefault()},_del:function(){var t,e,i,n=this.selectionModel,o=this.dataModel,s=this.focusModel.which(),a=this.columnModel.getVisibleColumnModelList(),l=s.rowKey,r=s.columnName;if(n.hasSelection()){for(t=n.get("range"),e=t.row[0];e").addClass("left_line"),$("
").addClass("right_line")]);return this.$el.addClass("grid_wrapper uio_grid").attr("data-grid-id",this.gridId).append(t),this._refreshHeight(),this.trigger("rendered"),this},destroy:function(){this.stopListening(),$(window).off("resize.grid"),this._destroyChildren(),this.$el.replaceWith(this.__$el),this.$el=this.__$el=null}});e.exports=o},{"../base/view":7}],42:[function(t,e,i){"use strict";var n=t("./container"),o=t("./layout/toolbar"),s=t("./layout/toolbar/controlPanel"),a=t("./layout/toolbar/pagination"),l=t("./layout/toolbar/resizeHandler"),r=t("./stateLayer"),u=t("./clipboard"),d=t("./layout/frame-lside"),h=t("./layout/frame-rside"),c=t("./layout/header"),m=t("./layout/resizeHandler"),g=t("./layout/body"),f=t("./layout/bodyTable"),p=t("./rowList"),_=t("./selectionLayer"),M=tui.util.defineClass({init:function(t){this.modelManager=t.modelManager,this.painterManager=t.painterManager},createContainer:function(t){return new n({el:t.el,singleClickEdit:t.singleClickEdit,dataModel:this.modelManager.dataModel,dimensionModel:this.modelManager.dimensionModel,focusModel:this.modelManager.focusModel,gridId:this.modelManager.gridId,viewFactory:this})},createToolbar:function(){return new o({toolbarModel:this.modelManager.toolbarModel,dimensionModel:this.modelManager.dimensionModel,viewFactory:this})},createToolbarControlPanel:function(){return new s({gridId:this.modelManager.gridId,toolbarModel:this.modelManager.toolbarModel})},createToolbarPagination:function(){return new a({toolbarModel:this.modelManager.toolbarModel})},createToolbarResizeHandler:function(){return new l({dimensionModel:this.modelManager.dimensionModel})},createStateLayer:function(){return new r({dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel})},createClipboard:function(){return new u({columnModel:this.modelManager.columnModel,dataModel:this.modelManager.dataModel,dimensionModel:this.modelManager.dimensionModel,selectionModel:this.modelManager.selectionModel,focusModel:this.modelManager.focusModel,renderModel:this.modelManager.renderModel,painterManager:this.modelManager.painterManager})},createFrame:function(t){var e="L"===t?d:h;return new e({dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,viewFactory:this})},createHeader:function(t){return new c({whichSide:t,renderModel:this.modelManager.renderModel,dimensionModel:this.modelManager.dimensionModel,selectionModel:this.modelManager.selectionModel,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,viewFactory:this})},createHeaderResizeHandler:function(t){return new m({whichSide:t,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel})},createBody:function(t){return new g({whichSide:t,renderModel:this.modelManager.renderModel,dimensionModel:this.modelManager.dimensionModel,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,selectionModel:this.modelManager.selectionModel,focusModel:this.modelManager.focusModel,viewFactory:this})},createBodyTable:function(t){return new f({whichSide:t,dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,columnModel:this.modelManager.columnModel,painterManager:this.painterManager,viewFactory:this})},createRowList:function(t){return new p({el:t.el,whichSide:t.whichSide,bodyTableView:t.bodyTableView,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,focusModel:this.modelManager.focusModel,painterManager:this.painterManager})},createSelectionLayer:function(t){return new _({whichSide:t,selectionModel:this.modelManager.selectionModel,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel})}});e.exports=M},{"./clipboard":40,"./container":41,"./layout/body":43,"./layout/bodyTable":44,"./layout/frame-lside":45,"./layout/frame-rside":46,"./layout/header":48,"./layout/resizeHandler":49,"./layout/toolbar":50,"./layout/toolbar/controlPanel":51,"./layout/toolbar/pagination":52,"./layout/toolbar/resizeHandler":53,"./rowList":54,"./selectionLayer":55,"./stateLayer":56}],43:[function(t,e,i){"use strict";var n=t("../../base/view"),o='
',s=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({dimensionModel:t.dimensionModel,dataModel:t.dataModel,columnModel:t.columnModel,renderModel:t.renderModel,selectionModel:t.selectionModel,focusModel:t.focusModel,viewFactory:t.viewFactory,$container:null,whichSide:t&&t.whichSide||"R"}),this.listenTo(this.dimensionModel,"change:bodyHeight",this._onBodyHeightChange).listenTo(this.dataModel,"add remove reset",this._resetContainerHeight).listenTo(this.renderModel,"change:scrollTop",this._onScrollTopChange).listenTo(this.renderModel,"change:scrollLeft",this._onScrollLeftChange)},tagName:"div",className:"data",events:{scroll:"_onScroll","mousedown .body_container":"_onMouseDown","blur input, select":"_onBlurInput"},_onBodyHeightChange:function(t,e){this.$el.css("height",e+"px")},_resetContainerHeight:function(){this.$container.css({height:this.dimensionModel.get("totalRowHeight")})},_onScroll:function(t){var e={scrollTop:t.target.scrollTop};"R"===this.whichSide&&(e.scrollLeft=t.target.scrollLeft),this.renderModel.set(e)},_onScrollLeftChange:function(t,e){"R"===this.whichSide&&(this.el.scrollLeft=e)},_onScrollTopChange:function(t,e){this.el.scrollTop=e},_getColumnNameByVisibleIndex:function(t){var e=this.columnModel.getVisibleColumnModelList(null,!1);return e[t].columnName},_onMouseDown:function(t){var e,i=this.columnModel,n=$(t.target),o=n.is("input"),s=n.closest("td"),a=n.closest("tr"),l=s.attr("columnName"),r=a.attr("key"),u=!0;s.length?r&&l?(e={column:i.indexOfColumnName(l,!0),row:this.dataModel.indexOfRowKey(r)},"radio"===this.columnModel.get("selectType")&&this.dataModel.check(e.row)):u=!1:(e=this.dimensionModel.getIndexFromMousePosition(t.pageX,t.pageY),l=this._getColumnNameByVisibleIndex(e.column)),u&&this._controlStartAction(t.pageX,t.pageY,t.shiftKey,e,l,o)},_onBlurInput:function(t){var e=this.focusModel;_.defer(function(){e.refreshState()})},_controlStartAction:function(t,e,i,n,o,s){var a=this.columnModel,l=this.selectionModel,r=n.column,u=n.row;l.isEnabled()&&(s||this._attachDragEvents(t,e),a.isMetaColumn(o)?"_number"===o?i?l.update(u,0,"row"):l.selectRow(u):this._detachDragEvents():(l.setState("cell"),i&&!s?l.update(u,r):(this.focusModel.focusAt(u,r),l.end())))},_attachDragEvents:function(t,e){this.setOwnProperties({mouseDownX:t,mouseDownY:e}),$(document).on("mousemove",$.proxy(this._onMouseMove,this)).on("mouseup",$.proxy(this._detachDragEvents,this)).on("selectstart",$.proxy(this._onSelectStart,this))},_detachDragEvents:function(){this.selectionModel.stopAutoScroll(),$(document).off("mousemove",this._onMouseMove).off("mouseup",this._detachDragEvents).off("selectstart",this._onSelectStart)},_onMouseMove:function(t){var e=this.selectionModel,i=t.pageX,n=t.pageY,o=this._getMouseMoveDistance(i,n)>10;(e.hasSelection()||o)&&e.updateByMousePosition(i,n)},_getMouseMoveDistance:function(t,e){var i=Math.abs(this.mouseDownX-t),n=Math.abs(this.mouseDownY-e);return Math.round(Math.sqrt(Math.pow(i,2)+Math.pow(n,2)))},_onSelectStart:function(t){return t.preventDefault(),!1},render:function(){var t=this.whichSide;return this._destroyChildren(),this.dimensionModel.get("scrollX")||this.$el.css("overflow-x","hidden"),this.dimensionModel.get("scrollY")||"R"!==t||this.$el.css("overflow-y","hidden"),this.$el.css("height",this.dimensionModel.get("bodyHeight")),this.$container=$(o),this.$el.append(this.$container),this._addChildren([this.viewFactory.createBodyTable(t),this.viewFactory.createSelectionLayer(t)]),this.$container.append(this._renderChildren()),this._resetContainerHeight(),this}});e.exports=s},{"../../base/view":7}],44:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap").dimension,a=s.CELL_BORDER_WIDTH,l=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({dimensionModel:t.dimensionModel,renderModel:t.renderModel,columnModel:t.columnModel,viewFactory:t.viewFactory,painterManager:t.painterManager,whichSide:t.whichSide||"R"}),this.listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged),this.listenTo(this.renderModel,"change:dummyRowCount",this._resetOverflow),this.listenTo(this.dimensionModel,"change:bodyHeight",this._resetHeight),this._attachAllTableEventHandlers()},tagName:"div",className:"table_container",template:_.template('<%=colGroup%><%=tbody%>
'),_onColumnWidthChanged:function(){var t=this.dimensionModel.getColumnWidthList(this.whichSide),e=this.$el.find("col"),i=0;_.each(t,function(t,n){e.eq(n).css("width",t-l.EXTRA_WIDTH),i+=t+a},this),o.isBrowserIE7()&&this.$el.width(i+a)},_resetOverflow:function(){var t="visible";this.renderModel.get("dummyRowCount")>0&&(t="hidden"),this.$el.css("overflow",t)},_resetHeight:function(){var t=this.dimensionModel;this.renderModel.get("dummyRowCount")>0?this.$el.height(t.get("bodyHeight")-t.getScrollXHeight()):this.$el.css("height","")},resetTablePosition:function(){this.$el.css("top",this.renderModel.get("top"))},render:function(){return this._destroyChildren(),this.$el.html(this.template({colGroup:this._getColGroupMarkup(),tbody:""})),this._addChildren(this.viewFactory.createRowList({bodyTableView:this,el:this.$el.find("tbody"),whichSide:this.whichSide})),this._renderChildren(),this._resetHeight(),this._resetOverflow(),this},_attachTableEventHandler:function(t,e){_.each(e,function(e,i){this.$el.on(i,t+" "+e.selector,e.handler)},this)},_attachAllTableEventHandlers:function(){var t=this.painterManager.getRowPainter(),e=this.painterManager.getCellPainters();this._attachTableEventHandler("tr",t.getEventHandlerInfo()),_.each(e,function(t,e){var i="td[edit-type="+e+"]",n=t.getEventHandlerInfo();this._attachTableEventHandler(i,n)},this)},redrawTable:function(t){return this.$el[0].innerHTML=this.template({colGroup:this._getColGroupMarkup(),tbody:t}),this.$el.find("tbody")},_getColGroupMarkup:function(){var t=this.whichSide,e=this.dimensionModel.getColumnWidthList(t),i=this.columnModel.getVisibleColumnModelList(t,!0),n="";return _.each(i,function(t,i){var o=t.columnName,s=e[i]-l.EXTRA_WIDTH;n+=''}),n}},{EXTRA_WIDTH:o.isBrowserIE7()?20:0});e.exports=l},{"../../base/view":7,"../../common/constMap":8,"../../common/util":10}],45:[function(t,e,i){"use strict";var n=t("./frame"),o=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"L"})},className:"lside_area",_onColumnWidthChanged:function(){this.$el.css({width:this.dimensionModel.get("lsideWidth")})},beforeRender:function(){this.$el.css({display:"block",width:this.dimensionModel.get("lsideWidth")})}});e.exports=o},{"./frame":47}],46:[function(t,e,i){"use strict";var n=t("./frame"),o=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"R",$scrollBorder:null}),this.listenTo(this.dimensionModel,"change:bodyHeight change:headerHeight",this._resetScrollBorderHeight)},className:"rside_area",_onColumnWidthChanged:function(){var t=this.dimensionModel;this.$el.css({width:t.get("rsideWidth"),marginLeft:t.get("lsideWidth")})},_resetScrollBorderHeight:function(){var t=this.dimensionModel,e=t.get("bodyHeight")-t.getScrollXHeight();this.$scrollBorder.height(e)},beforeRender:function(){var t=this.dimensionModel;this.$el.css({display:"block",width:t.get("rsideWidth"),marginLeft:t.get("lsideWidth")})},afterRender:function(){var t,e,i,n,o,s=this.dimensionModel;this.dimensionModel.get("scrollY")&&(n=s.get("headerHeight"),o=s.get("bodyHeight"),t=$("
").addClass("header_space"),e=$("
").addClass("scrollbar_border"),i=$("
").addClass("scrollbar_corner"),t.height(n-2),e.css("top",n+"px"),i.css("bottom",s.get("toolbarHeight")),this.$el.append(t,e,i),this.$scrollBorder=e,this._resetScrollBorderHeight())}});e.exports=o},{"./frame":47}],47:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({viewFactory:t.viewFactory,renderModel:t.renderModel,dimensionModel:t.dimensionModel,whichSide:t.whichSide||"R"}),this.listenTo(this.renderModel,"columnModelChanged",this.render,this).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged,this)},tagName:"div",className:"lside_area",render:function(){var t=this.viewFactory;return this._destroyChildren(),this.beforeRender(),this._addChildren([t.createHeader(this.whichSide),t.createBody(this.whichSide)]),this.$el.append(this._renderChildren()),this.afterRender(),this},_onColumnWidthChanged:function(){},beforeRender:function(){},afterRender:function(){}});e.exports=o},{"../../base/view":7}],48:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({renderModel:t.renderModel,dimensionModel:t.dimensionModel,selectionModel:t.selectionModel,columnModel:t.columnModel,dataModel:t.dataModel,viewFactory:t.viewFactory,timeoutForAllChecked:0,whichSide:t.whichSide||"R"}),this.listenTo(this.renderModel,"change:scrollLeft",this._onScrollLeftChange,this).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged,this).listenTo(this.dataModel,"change:_button",this._onCheckCountChange,this).listenTo(this.dataModel,"sortChanged",this._updateBtnSortState,this)},tagName:"div",className:"header",events:{click:"_onClick","mousedown th[columnName]":"_onMouseDown"},template:_.template(' <%=colGroup%><%=tBody%>
'),templateHeader:_.template(' 0) {%>colspan=<%=colspan%> <%}%><%if(rowspan > 0) {%>rowspan=<%=rowspan%> <%}%>><%=title%><%=btnSort%>'),templateCol:_.template(''),markupBtnSort:'',_getColGroupMarkup:function(){var t=this._getColumnData(),e=t.widthList,i=t.modelList,n=[];return _.each(e,function(t,e){n.push(this.templateCol({columnName:i[e].columnName,width:t}))},this),n.join("")},_onMouseDown:function(t){var e,i;this.selectionModel.isEnabled()&&!$(t.target).is("a.btn_sorting")&&(e=$(t.target).closest("th").attr("columnName"),i=this.columnModel.getUnitColumnNamesIfMerged(e),this._hasMetaColumn(i)||this._controlStartAction(i,t.pageX,t.pageY,t.shiftKey))},_controlStartAction:function(t,e,i,n){var o=this.columnModel,s=_.map(t,function(t){return o.indexOfColumnName(t,!0)});n?this._startColumnSelectionWithShiftKey(s,e,i):this._startColumnSelectionWithoutShiftKey(s),this._attachDragEvents()},_startColumnSelectionWithShiftKey:function(t,e,i){var n=this.selectionModel,o=Math.max.apply(null,t);n.update(0,o,"column"),n.extendColumnSelection(t,e,i)},_startColumnSelectionWithoutShiftKey:function(t){var e=this.selectionModel,i=o.getMinMax(t),n=i.min,s=i.max;e.setMinimumColumnRange([n,s]),e.selectColumn(n),e.update(0,s)},_attachDragEvents:function(){$(document).on("mousemove",$.proxy(this._onMouseMove,this)).on("mouseup",$.proxy(this._detachDragEvents,this)).on("selectstart",$.proxy(this._onSelectStart,this))},_detachDragEvents:function(){this.selectionModel.stopAutoScroll(),$(document).off("mousemove",this._onMouseMove).off("mouseup",this._detachDragEvents).off("selectstart",this._onSelectStart)},_onMouseMove:function(t){var e,i,n=this.columnModel,o=!0,s=$(t.target).closest("th").attr("columnName");s?(e=n.getUnitColumnNamesIfMerged(s),i=_.map(e,function(t){return n.indexOfColumnName(t,!0)})):$.contains(this.el,t.target)&&(o=!1),o&&this.selectionModel.extendColumnSelection(i,t.pageX,t.pageY)},_hasMetaColumn:function(t){var e=!1,i=this.columnModel;return tui.util.forEach(t,function(t){return i.isMetaColumn(t)?(e=!0,!1):void 0}),e},_onSelectStart:function(t){return t.preventDefault(),!1},_onCheckCountChange:function(){"checkbox"===this.columnModel.get("selectType")&&(clearTimeout(this.timeoutForAllChecked),this.timeoutForAllChecked=setTimeout($.proxy(this._syncCheckState,this),10))},_getHeaderMainCheckbox:function(){return this.$el.find('th[columnname="_button"] input')},_syncCheckState:function(){var t,e,i;this.columnModel&&"checkbox"===this.columnModel.get("selectType")&&(t=this._getHeaderMainCheckbox(),t.length&&(e=0,i=this.dataModel.getRowList(!0).length,this.dataModel.forEach(function(t){var i=t.getCellState("_button");!i.isDisabled&&i.isEditable&&(e+=1)},this),t.prop("checked",e===i)))},_onColumnWidthChanged:function(){var t=this._getColumnData(),e=t.widthList,i=this.$el.find("col");_.each(e,function(t,e){i.eq(e).css("width",t+"px")})},_onScrollLeftChange:function(t,e){"R"===this.whichSide&&(this.el.scrollLeft=e)},_onClick:function(t){var e=$(t.target),i=e.closest("th").attr("columnname");"_button"===i&&e.is("input")?e.prop("checked")?this.dataModel.checkAll():this.dataModel.uncheckAll():e.is("a.btn_sorting")&&this.dataModel.sortByField(i)},_updateBtnSortState:function(t){this._$currentSortBtn&&this._$currentSortBtn.removeClass("sorting_down sorting_up"),this._$currentSortBtn=this.$el.find("th[columnname="+t.columnName+"] a.btn_sorting"),this._$currentSortBtn.addClass(t.isAscending?"sorting_up":"sorting_down")},render:function(){return this._destroyChildren(),this.dimensionModel.get("scrollX")||this.$el.css("overflow-x","hidden"),this.dimensionModel.get("scrollY")||this.$el.css("overflow-y","hidden"),this.$el.css({height:this.dimensionModel.get("headerHeight")}).html(this.template({colGroup:this._getColGroupMarkup(),tBody:this._getTableBodyMarkup()})),this._addChildren(this.viewFactory.createHeaderResizeHandler(this.whichSide)),this.$el.append(this._renderChildren()),this},_getColumnData:function(){var t=this.columnModel,e=this.dimensionModel,i=e.getColumnWidthList(this.whichSide),n=t.getVisibleColumnModelList(this.whichSide,!0);return{widthList:i,modelList:n}},_getTableBodyMarkup:function(){var t,e,i=this._getColumnHierarchyList(),n=this._getHierarchyMaxRowCount(i),s=this.dimensionModel.get("headerHeight"),a=new Array(n),l=new Array(n),r=[],u=o.getRowHeight(n,s)-1,d=1;return _.each(i,function(e,o){var h=i[o].length,c=0;_.each(e,function(e,i){var o=e.columnName;d=h-1===i&&n-h+1>1?n-h+1:1,t=u*d,i===h-1?t=s-c-2:c+=t+1,l[i]===o?(a[i].pop(),r[i]+=1):r[i]=1,l[i]=o,a[i]=a[i]||[],a[i].push(this.templateHeader({columnName:o,height:t,colspan:r[i],rowspan:d,title:e.title,btnSort:e.isSortable?this.markupBtnSort:""}))},this)},this),e=_.map(a,function(t){return""+t.join("")+""}),e.join("")},_getHierarchyMaxRowCount:function(t){var e=[0];return _.each(t,function(t){e.push(t.length)},this),Math.max.apply(Math,e)},_getColumnHierarchyList:function(){var t,e=this._getColumnData().modelList;return t=_.map(e,function(t){return this._getColumnHierarchy(t).reverse()},this)},_getColumnHierarchy:function(t,e){var i=this.columnModel.get("columnMerge");return e=e||[],t&&(e.push(t),i&&_.each(i,function(i){-1!==$.inArray(t.columnName,i.columnNameList)&&this._getColumnHierarchy(i,e)},this)),e}});e.exports=s},{"../../base/view":7,"../../common/util":10}],49:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){this.setOwnProperties({dimensionModel:t.dimensionModel,columnModel:t.columnModel,whichSide:t.whichSide||"R",isResizing:!1,$target:null,differenceLeft:0,initialWidth:0,initialOffsetLeft:0,initialLeft:0}),this.listenTo(this.dimensionModel,"change:which columnWidthChanged",this._refreshHandlerPosition)},tagName:"div",className:"resize_handle_container",events:{"mousedown .resize_handle":"_onMouseDown","click .resize_handle":"_onClick"},template:_.template('
" style="<%=height%>" title="마우스 드래그를 통해 컬럼의 넓이를 변경할 수 있고,더블클릭을 통해 넓이를 초기화할 수 있습니다.">
'),_getColumnData:function(){var t=this.columnModel,e=this.dimensionModel,i=e.getColumnWidthList(this.whichSide),n=t.getVisibleColumnModelList(this.whichSide,!0);return{widthList:i,modelList:n}},_getResizeHandlerMarkup:function(){var t,e=this._getColumnData(),i=e.modelList,n=this.dimensionModel.get("headerHeight"),o=i.length;return t=_.map(i,function(t,e){return this.template({columnIndex:e,columnName:t.columnName,isLast:e+1===o,height:n})},this),t.join("")},render:function(){var t=this.dimensionModel.get("headerHeight"),e=this._getResizeHandlerMarkup();return this.$el.empty().show().html(e).css({marginTop:-t,height:t}),this._refreshHandlerPosition(),this},_refreshHandlerPosition:function(){var t,e,i,n=this._getColumnData(),o=n.widthList,s=this.$el.find(".resize_handle"),a=this.$el.parent().find("table:first"),l=!1,r=0,u=1;tui.util.forEachArray(s,function(n,d){t=s.eq(d),e=t.attr("columnname"),i=a.find('th[columnname="'+e+'"]').width(),tui.util.isExisty(i)?l=l||i!==o[d]:i=o[d],r+=i+u,t.css("left",r-3+"px")})},_isResizing:function(){return!!this.isResizing},_onMouseDown:function(t){this._startResizing(t)},_onClick:function(t){var e=$(t.target),i=parseInt(e.attr("columnindex"),10),n=e.data("isClicked");n?(this.dimensionModel.restoreColumnWidth(this._getHandlerColumnIndex(i)),this._clearClickedFlag(e),this._refreshHandlerPosition()):this._setClickedFlag(e)},_setClickedFlag:function(t){t.data("isClicked",!0),setTimeout($.proxy(this._clearClickedFlag,this,t),500)},_clearClickedFlag:function(t){t.data("isClicked",!1)},_onMouseUp:function(){this._stopResizing()},_onMouseMove:function(t){var e,i,n;this._isResizing()&&(t.preventDefault(),e=t.pageX-this.initialOffsetLeft,i=this._calculateWidth(t.pageX),n=parseInt(this.$target.attr("columnindex"),10),this.$target.css("left",e+"px"),this.dimensionModel.setColumnWidth(this._getHandlerColumnIndex(n),i),this._refreshHandlerPosition())},_calculateWidth:function(t){var e=t-this.initialOffsetLeft-this.initialLeft;return this.initialWidth+e},_getHandlerColumnIndex:function(t){return"R"===this.whichSide?t+this.columnModel.getVisibleColumnFixCount(!0):t},_startResizing:function(t){var e=this._getColumnData(),i=e.widthList,n=$(t.target);this.isResizing=!0,this.$target=n,this.initialLeft=parseInt(n.css("left").replace("px",""),10),this.initialOffsetLeft=this.$el.offset().left,this.initialWidth=i[n.attr("columnindex")],$("body").css("cursor","col-resize"),$(document).bind("mousemove",$.proxy(this._onMouseMove,this)).bind("mouseup",$.proxy(this._onMouseUp,this)),n[0].setCapture&&n[0].setCapture()},_stopResizing:function(){this.$target&&this.$target[0].releaseCapture&&this.$target[0].releaseCapture(),this.isResizing=!1,this.$target=null,this.initialLeft=0,this.initialOffsetLeft=0,this.initialWidth=0,$("body").css("cursor","default"),$(document).unbind("mousemove",$.proxy(this._onMouseMove,this)).unbind("mouseup",$.proxy(this._onMouseUp,this))},destroy:function(){this.stopListening(),this._stopResizing(), +this.remove()}});e.exports=o},{"../../base/view":7}],50:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.toolbarModel=t.toolbarModel,this.dimensionModel=t.dimensionModel,this.viewFactory=t.viewFactory},tagName:"div",className:"toolbar",render:function(){var t=this.toolbarModel;return this._destroyChildren(),t.get("hasControlPanel")&&this._addChildren(this.viewFactory.createToolbarControlPanel()),t.get("hasResizeHandler")&&this._addChildren(this.viewFactory.createToolbarResizeHandler()),t.get("hasPagination")&&this._addChildren(this.viewFactory.createToolbarPagination()),this.$el.empty().append(this._renderChildren()),this._refreshHeight(),this},_refreshHeight:function(){var t=this.dimensionModel.get("toolbarHeight");this.$el.height(t),this.$el.toggle(!!t)}});e.exports=o},{"../../base/view":7}],51:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.setOwnProperties({gridId:t.gridId,toolbarModel:t.toolbarModel,$btnExcel:null,$btnExcelAll:null}),this.listenTo(this.toolbarModel,"change:isExcelButtonVisible change:isExcelAllButtonVisible",this.render)},events:{"click a.excel_download_button":"_onClickExcel"},tagName:"div",className:"btn_setup",templateExcelBtn:_.template('<%=text%>'),_onClickExcel:function(t){var e,i=tui.Grid.getInstanceById(this.gridId),n=i.getAddOn("Net");t.preventDefault(),n&&(e=$(t.target).closest("a"),e.hasClass("excel_page")?n.download("excel"):e.hasClass("excel_all")&&n.download("excelAll"))},render:function(){var t=this.toolbarModel;return this.$el.empty(),t.get("isExcelButtonVisible")&&this.$el.append(this.templateExcelBtn({className:"excel_page",text:"엑셀 다운로드"})),t.get("isExcelAllButtonVisible")&&this.$el.append(this.templateExcelBtn({className:"excel_all",text:"전체 엑셀 다운로드"})),this}});e.exports=o},{"../../../base/view":7}],52:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.toolbarModel=t.toolbarModel},tagName:"div",className:"grid_pagination",template:_.template('FirstPrev LastFirst OffPrev OffNext OffLast Off'),render:function(){return this._destroyChildren(),this.$el.empty().html(this.template()),this._setPaginationInstance(),this},_setPaginationInstance:function(){var t=tui&&tui.component&&tui.component.Pagination,e=this.toolbarModel.get("pagination");!e&&t&&(e=new t({itemCount:1,itemPerPage:1,pagePerPageList:5,isCenterAlign:!0,moveUnit:"page",$preOff:this.$el.find(".pre_off"),$pre_endOff:this.$el.find(".pre_end_off"),$nextOff:this.$el.find(".next_off"),$lastOff:this.$el.find(".next_end_off")},this.$el)),this.toolbarModel.set("pagination",e)}});e.exports=o},{"../../../base/view":7}],53:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.timeoutIdForResize=0},tagName:"div",className:"height_resize_bar",template:_.template(''),events:{mousedown:"_onMouseDown"},_attachMouseEvent:function(){$(document).on("mousemove",$.proxy(this._onMouseMove,this)),$(document).on("mouseup",$.proxy(this._onMouseUp,this)),$(document).on("selectstart",$.proxy(this._onSelectStart,this))},_detachMouseEvent:function(){$(document).off("mousemove",$.proxy(this._onMouseMove,this)),$(document).off("mouseup",$.proxy(this._onMouseUp,this)),$(document).off("selectstart",$.proxy(this._onSelectStart,this))},_onMouseDown:function(t){t.preventDefault(),$(document.body).css("cursor","row-resize"),this._attachMouseEvent()},_onMouseMove:function(t){var e=this.dimensionModel,i=e.get("offsetTop"),n=e.get("headerHeight"),o=e.get("rowHeight"),s=e.get("toolbarHeight"),a=t.pageY-i-n-s;clearTimeout(this.timeoutIdForResize),a=Math.max(a,o+e.getScrollXHeight()),this.timeoutIdForResize=setTimeout(function(){e.set({bodyHeight:a})},0)},_onMouseUp:function(){$(document.body).css("cursor","default"),this._detachMouseEvent()},_onSelectStart:function(t){return t.preventDefault(),!1},render:function(){return this._destroyChildren(),this.$el.html(this.template()),this},destroy:function(){this.stopListening(),this._onMouseUp(),this._destroyChildren(),this.remove()}});e.exports=o},{"../../../base/view":7}],54:[function(t,e,i){"use strict";var n=t("../base/view"),o=n.extend({initialize:function(t){var e=t.focusModel,i=t.renderModel,n=t.whichSide||"R";this.setOwnProperties({whichSide:n,bodyTableView:t.bodyTableView,focusModel:e,renderModel:i,dataModel:t.dataModel,columnModel:t.columnModel,collection:i.getCollection(n),painterManager:t.painterManager,sortOptions:null,renderedRowKeys:null}),this.listenTo(this.collection,"change",this._onModelChange).listenTo(e,"select",this._onSelect).listenTo(e,"unselect",this._onUnselect).listenTo(e,"focus",this._onFocus).listenTo(e,"blur",this._onBlur).listenTo(e,"focusIn",this._onFocusIn).listenTo(i,"rowListChanged",this.render)},_getColumnModelList:function(){return this.columnModel.getVisibleColumnModelList(this.whichSide,!0)},_removeOldRows:function(t){var e=_.indexOf(this.renderedRowKeys,t[0]),i=_.indexOf(this.renderedRowKeys,_.last(t)),n=this.$el.children("tr");n.slice(0,e).remove(),n.slice(i+1).remove()},_appendNewRows:function(t,e){var i=this.collection.slice(0,_.indexOf(t,e[0])),n=this.collection.slice(_.indexOf(t,_.last(e))+1);this.$el.prepend(this._getRowsHtml(i)),this.$el.append(this._getRowsHtml(n))},_resetRows:function(){var t,e=this._getRowsHtml(this.collection.models);if(o.isInnerHtmlOfTbodyReadOnly)t=this.bodyTableView.redrawTable(e),this.setElement(t,!1),tui.util.browser.msie&&tui.util.browser.version<=7&&t.width(t.width());else try{this.$el[0].innerHTML=e}catch(i){o.isInnerHtmlOfTbodyReadOnly=!0,this._resetRows()}},_getRowsHtml:function(t){var e=this.painterManager.getRowPainter(),i=this._getColumnModelList();return _.map(t,function(t){return e.getHtml(t,i)}).join("")},_getRowElement:function(t){return this.$el.find('tr[key="'+t+'"]')},_onSelect:function(t){this._setCssSelect(t.rowKey,!0)},_onUnselect:function(t){this._setCssSelect(t,!1)},_setCssSelect:function(t,e){var i,n,o,s,a=this._getColumnModelList(),l={};_.each(a,function(a){i=a.columnName,n=this.dataModel.getMainRowKey(t,i),l[n]=l[n]||this._getRowElement(n),o=l[n],s=o.find('td[columnname="'+i+'"]'),s.length&&s.toggleClass("selected",e)},this)},_onBlur:function(t,e){var i=this.dataModel.getElement(t,e);i.length&&i.removeClass("focused")},_onFocus:function(t,e){var i=this.dataModel.getElement(t,e);i.length&&i.addClass("focused")},_onFocusIn:function(t,e){var i,n,o,s=this.columnModel.isLside(e)?"L":"R";s===this.whichSide&&(i=this.dataModel.getElement(t,e),n=this.columnModel.getEditType(e),o=this.painterManager.getCellPainter(n),o.focusIn(i))},render:function(t){var e,i=this.collection.pluck("rowKey");return this.bodyTableView.resetTablePosition(),t?this._resetRows():(e=_.intersection(i,this.renderedRowKeys),_.isEmpty(i)||_.isEmpty(e)||e.length/i.length<.7?this._resetRows():(this._removeOldRows(e),this._appendNewRows(i,e))),this.renderedRowKeys=i,this.focusModel.focusClipboard(),this},_onModelChange:function(t){var e=this._getRowElement(t.get("rowKey"));this.painterManager.getRowPainter().onModelChange(t,e)}},{isInnerHtmlOfTbodyReadOnly:tui.util.browser.msie&&tui.util.browser.version<=9});e.exports=o},{"../base/view":7}],55:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=1,a=n.extend({initialize:function(t){this.setOwnProperties({whichSide:t.whichSide||"R",dimensionModel:t.dimensionModel,columnModel:t.columnModel,selectionModel:t.selectionModel}),this._updateColumnWidthList(),this.listenTo(this.dimensionModel,"columnWidthChanged",this._onChangeColumnWidth),this.listenTo(this.selectionModel,"change:range",this.render)},tagName:"div",className:"selection_layer",_updateColumnWidthList:function(){this.columnWidthList=this.dimensionModel.getColumnWidthList(this.whichSide)},_onChangeColumnWidth:function(){this._updateColumnWidthList(),this.render()},_getOwnSideColumnRange:function(t){var e=this.columnModel.getVisibleColumnFixCount(),i=null;return"L"===this.whichSide?t[0]=e&&(i=[Math.max(t[0],e)-e,t[1]-e]),i},_getVerticalStyles:function(t){var e=this.dimensionModel.get("rowHeight"),i=o.getHeight(t[0],e)-s,n=o.getHeight(t[1]-t[0]+1,e)-2*s;return{top:i+"px",height:n+"px"}},_getHorizontalStyles:function(t){var e=this.columnWidthList,i=this.columnModel.getVisibleMetaColumnCount(),n=t[0],o=t[1],a=0,l=0,r=0;for("L"===this.whichSide&&(n+=i,o+=i),o=Math.min(o,e.length-1);o>=r;r+=1)n>r?a+=e[r]+s:l+=e[r]+s;return l-=s,{left:a+"px",width:l+"px"}},render:function(){var t,e,i=this.selectionModel.get("range");return i&&(e=this._getOwnSideColumnRange(i.column)),e?(t=_.assign({},this._getVerticalStyles(i.row),this._getHorizontalStyles(e)),this.$el.show().css(t)):this.$el.hide(),this}});e.exports=a},{"../base/view":7,"../common/util":10}],56:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").renderState,s=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.renderModel=t.renderModel,this.listenTo(this.dimensionModel,"change",this._refreshLayout),this.listenTo(this.renderModel,"change:state",this.render)},className:"state_layer",template:_.template('
<%= text %> <% if (isLoading) { %>
<% } %>
'),render:function(){var t=this.renderModel.get("state");return t===o.DONE?this.$el.hide():(this.$el.html(this.template({text:this._getMessage(t),isLoading:t===o.LOADING})).show(),this._refreshLayout()),this},_getMessage:function(t){switch(t){case o.LOADING:return"요청을 처리 중입니다.";case o.EMPTY:return this.renderModel.get("emptyMessage")||"데이터가 존재하지 않습니다.";default:return null}},_refreshLayout:function(){var t=this.dimensionModel;this.$el.css({marginTop:t.get("headerHeight"),height:t.get("bodyHeight")+t.get("toolbarHeight")})}});e.exports=s},{"../base/view":7,"../common/constMap":8}]},{},[12]); \ No newline at end of file