diff --git a/dist/grid.css b/dist/grid.css index 2648513ca..689831f54 100644 --- a/dist/grid.css +++ b/dist/grid.css @@ -1,22 +1,18 @@ /** * @fileoverview tui-grid * @author NHN Ent. FE Development Team - * @version 1.2.1 + * @version 1.3.0 * @license MIT * @link https://github.com/nhnent/tui.grid */ .tui-grid-container { width: 100%; position: relative; - border-style: solid; - border-width: 0 0 1px; + border-width: 0; clear: both; font-size: 12px; font-family: '돋움', Dotum, Helvetica, 'Apple SD Gothic Neo', Sans-serif; } -.tui-grid-container.tui-grid-no-scroll-x { - border-bottom-width: 0; -} .tui-grid-container ::-webkit-scrollbar { -webkit-appearance: none; width: 17px; @@ -109,6 +105,24 @@ .tui-grid-btn-sorting-up { background-position: -10px -60px; } +.tui-grid-icon-arrow { + display: inline-block; + width: 0; + height: 0; + border-style: solid; + border-width: 4px; + border-color: #a0a0a0; +} +.tui-grid-icon-arrow-left { + border-top-color: transparent; + border-bottom-color: transparent; + border-left-width: 0; +} +.tui-grid-icon-arrow-right { + border-top-color: transparent; + border-bottom-color: transparent; + border-right-width: 0; +} .tui-grid-layer-state { position: absolute; top: 0; @@ -155,7 +169,10 @@ border-style: solid; border-width: 1px; opacity: 0.2; - filter: alpha(opacity=10); + filter: alpha(opacity=20); +} +.tui-grid-layer-datepicker { + position: absolute; } .tui-grid-table { width: 100%; @@ -166,6 +183,9 @@ border-collapse: collapse; margin: 0; } +.tui-grid-lside-area .tui-grid-table { + border-right-width: 0; +} .tui-grid-cell { overflow: hidden; white-space: nowrap; @@ -182,8 +202,6 @@ text-align: center; } .tui-grid-cell-ellipsis { - -o-text-overflow: ellipsis /*Opera 9*/; - -moz-binding: url("ellipsis.xml#ellipsis") /* Firefox */; text-overflow: ellipsis; } .tui-grid-cell-content .tui-grid-content-before { @@ -266,16 +284,28 @@ right: 17px; height: 1px; } -.tui-grid-border-line-bottom.tui-grid-no-scroll-y { +.tui-grid-no-scroll-x .tui-grid-border-line-bottom, +.tui-grid-no-scroll-y .tui-grid-border-line-bottom { right: 0; } +.tui-grid-content-area { + position: relative; + border-style: solid; + border-width: 0 0 1px; +} +.tui-grid-content-area.tui-grid-no-scroll-x { + border-bottom-width: 0; +} .tui-grid-head-area { border-style: solid; border-width: 0 0 1px; } +.tui-grid-head-area .tui-grid-cell-head { + border-top-width: 1px; + border-bottom-width: 1px; +} .tui-grid-lside-area { display: none; - height: 100%; position: absolute; top: 0; left: 0; @@ -295,16 +325,15 @@ } .tui-grid-rside-area { display: none; - height: 100%; overflow: hidden; } .tui-grid-rside-area .tui-grid-head-area { position: relative; - margin-right: 17px; + padding-right: 17px; overflow: hidden; } .tui-grid-rside-area .tui-grid-head-area.tui-grid-no-scroll-y { - margin-right: 0; + padding-right: 0; } .tui-grid-rside-area .tui-grid-body-area { position: relative; @@ -348,12 +377,13 @@ } .tui-grid-toolbar { display: none; - width: 100%; + left: 0; + right: 0; height: 65px; bottom: 0px; position: absolute; border-style: solid; - border-width: 1px 0 0; + border-width: 0 1px 1px; z-index: 11; } .tui-grid-toolbar-btn-holder { @@ -470,3 +500,100 @@ .tui-grid-pagination .tui-grid-next-end-off { background-position: -75px -30px; } +.tui-grid-calendar-btn-prev-year, +.tui-grid-calendar-btn-prev-month, +.tui-grid-calendar-btn-next-month, +.tui-grid-calendar-btn-next-year { + position: absolute; + top: 4px; + padding: 3px 6px 2px; + border: 1px solid transparent; +} +.tui-grid-calendar-btn-prev-year:hover, +.tui-grid-calendar-btn-prev-month:hover, +.tui-grid-calendar-btn-next-month:hover, +.tui-grid-calendar-btn-next-year:hover { + border-color: #ccc; +} +.tui-grid-calendar { + position: absolute; + width: 190px; + background: #fff; + border: 1px solid #ccc; + font-size: 11px; + color: #444; + font-family: arial; +} +.tui-grid-calendar table { + margin: 0 auto; + table-layout: fixed; + text-align: center; +} +.tui-grid-calendar table tr { + height: 20px; +} +.tui-grid-calendar table th { + width: 20px; +} +.tui-grid-calendar table th.tui-grid-calendar-sat { + color: #00f; +} +.tui-grid-calendar table th.tui-grid-calendar-sun { + color: #e82828; +} +.tui-grid-calendar table td { + background: #eee; + color: #ccc; +} +.tui-grid-calendar table td.tui-grid-calendar-selectable { + cursor: pointer; + background: #fff; + color: #444; +} +.tui-grid-calendar table td.tui-grid-calendar-selectable.tui-grid-calendar-selected { + background: #c3ebff; + font-weight: bold; +} +.tui-grid-calendar table td.tui-grid-calendar-selectable.tui-grid-calendar-sat { + color: #00f; +} +.tui-grid-calendar table td.tui-grid-calendar-selectable.tui-grid-calendar-sun { + color: #e82828; +} +.tui-grid-calendar table td.tui-grid-calendar-selectable:hover { + background: #c3ebff; +} +.tui-grid-calendar-header { + padding: 6px 0 5px; + text-align: center; + border-bottom: 1px solid #ddd; +} +.tui-grid-calendar-title { + font-size: 14px; +} +.tui-grid-calendar-body { + padding: 5px 7px; +} +.tui-grid-calendar-btn-prev-year { + left: 18px; +} +.tui-grid-calendar-btn-prev-month { + left: 42px; +} +.tui-grid-calendar-btn-next-month { + right: 42px; +} +.tui-grid-calendar-btn-next-year { + right: 20px; +} +.tui-grid-calendar-today { + text-decoration: underline; +} +.tui-grid-calendar-prev-month, +.tui-grid-calendar-next-month { + opacity: 0.4; + filter: alpha(opacity=40); +} +.tui-grid-calendar-footer { + display: none; +} diff --git a/dist/grid.js b/dist/grid.js index 4403e2a85..c7f57f0dd 100644 --- a/dist/grid.js +++ b/dist/grid.js @@ -1,7 +1,7 @@ /** * @fileoverview tui-grid * @author NHN Ent. FE Development Team - * @version 1.2.1 + * @version 1.3.0 * @license MIT * @link https://github.com/nhnent/tui.grid */ @@ -196,6 +196,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ */ _initializePagination: function() { var pagination = this.pagination; + if (pagination) { pagination.setOption('itemPerPage', this.perPage); pagination.setOption('itemCount', 1); @@ -288,6 +289,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ */ _setFormData: function(data) { var formData = _.clone(data); + _.each(this.lastRequestedReadData, function(value, key) { if ((_.isUndefined(formData[key]) || _.isNull(formData[key])) && value) { formData[key] = ''; @@ -351,7 +353,6 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * @private */ _getFormData: function() { - /* istanbul ignore next*/ return formUtil.getFormData(this.$el); }, @@ -362,8 +363,8 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * @private */ _onReadSuccess: function(dataModel, responseData) { - var pagination = this.pagination, - page, totalCount; + var pagination = this.pagination; + var page, totalCount; dataModel.setOriginalRowList(); @@ -612,7 +613,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ _.each(dataMap, function(list, name) { if (_.contains(checkList, name) && list.length) { count += list.length; - data[name] = $.toJSON(list); + data[name] = JSON.stringify(list); } }, this); } else { @@ -644,15 +645,15 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ */ _getRequestParam: function(requestType, options) { var defaultOptions = { - url: this.api[requestType], - type: null, - hasDataParam: true, - isOnlyModified: true, - isOnlyChecked: true - }, - newOptions = $.extend(defaultOptions, options), - dataParam = this._getDataParam(requestType, newOptions), - param = null; + url: this.api[requestType], + type: null, + hasDataParam: true, + isOnlyModified: true, + isOnlyChecked: true + }; + var newOptions = $.extend(defaultOptions, options); + var dataParam = this._getDataParam(requestType, newOptions); + var param = null; if (newOptions.isSkipConfirm || this._isConfirmed(requestType, dataParam.count)) { param = { @@ -662,6 +663,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ type: newOptions.type }; } + return param; }, @@ -675,12 +677,12 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ _isConfirmed: function(requestType, count) { var result = false; - /* istanbul ignore next: confirm 을 확인할 수 없읔 */ if (count > 0) { result = confirm(this._getConfirmMessage(requestType, count)); } else { alert(this._getConfirmMessage(requestType, count)); } + return result; }, @@ -693,19 +695,20 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ */ _getConfirmMessage: function(requestType, count) { var textMap = { - 'createData': '입력', - 'updateData': '수정', - 'deleteData': '삭제', - 'modifyData': '반영' - }, - actionName = textMap[requestType], - message; + createData: '입력', + updateData: '수정', + deleteData: '삭제', + modifyData: '반영' + }; + var actionName = textMap[requestType]; + var message; if (count > 0) { message = count + '건의 데이터를 ' + actionName + '하시겠습니까?'; } else { message = actionName + '할 데이터가 없습니다.'; } + return message; }, @@ -715,8 +718,8 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * @private */ _ajax: function(options) { - var eventData = new GridEvent(options.data), - params; + var eventData = new GridEvent(options.data); + var params; this.trigger('beforeRequest', eventData); if (eventData.isStopped()) { @@ -759,13 +762,13 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * @private */ _onSuccess: function(callback, options, responseData, status, jqXHR) { - var message = responseData && responseData.message, - eventData = new GridEvent({ - httpStatus: status, - requestType: options.requestType, - requestParameter: options.data, - responseData: responseData - }); + var message = responseData && responseData.message; + var eventData = new GridEvent({ + httpStatus: status, + requestType: options.requestType, + requestParameter: options.data, + responseData: responseData + }); this.trigger('response', eventData); if (eventData.isStopped()) { @@ -1015,6 +1018,7 @@ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ this.message = message || 'error'; }; GridError.prototype = new Error(); + return new GridError(); }, @@ -1027,7 +1031,7 @@ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ if (!_.isArray(views)) { views = [views]; } - [].push.apply(this._children, views); + [].push.apply(this._children, _.compact(views)); }, /** @@ -1038,6 +1042,7 @@ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ var elements = _.map(this._children, function(view) { return view.render().el; }); + return elements; }, @@ -1083,6 +1088,11 @@ var classNames = { NO_SCROLL_X: 'no-scroll-x', NO_SCROLL_Y: 'no-scroll-y', + // icon + ICO_ARROW: 'icon-arrow', + ICO_ARROW_LEFT: 'icon-arrow-left', + ICO_ARROW_RIGHT: 'icon-arrow-right', + // layer LAYER_STATE: 'layer-state', LAYER_STATE_CONTENT: 'layer-state-content', @@ -1091,6 +1101,7 @@ var classNames = { LAYER_FOCUS: 'layer-focus', LAYER_FOCUS_BORDER: 'layer-focus-border', LAYER_SELECTION: 'layer-selection', + LAYER_DATE_PICKER: 'layer-datepicker', // border line BORDER_LINE: 'border-line', @@ -1100,6 +1111,7 @@ var classNames = { BORDER_BOTTOM: 'border-line-bottom', // layout (area) + CONTENT_AREA: 'content-area', LSIDE_AREA: 'lside-area', RSIDE_AREA: 'rside-area', HEAD_AREA: 'head-area', @@ -1169,7 +1181,16 @@ var classNames = { TOOLBAR: 'toolbar', TOOLBAR_BTN_HOLDER: 'toolbar-btn-holder', HEIGHT_RESIZE_BAR: 'height-resize-bar', - HEIGHT_RESIZE_HANDLE: 'height-resize-handle' + HEIGHT_RESIZE_HANDLE: 'height-resize-handle', + + // etc + CALENDAR: 'calendar', + CALENDAR_BTN_PREV_YEAR: 'calendar-btn-prev-year', + CALENDAR_BTN_NEXT_YEAR: 'calendar-btn-next-year', + CALENDAR_BTN_PREV_MONTH: 'calendar-btn-prev-month', + CALENDAR_BTN_NEXT_MONTH: 'calendar-btn-next-month', + CALENDAR_SELECTABLE: 'calendar-selectable', + CALENDAR_SELECTED: 'calendar-selected' }; var exports = _.mapObject(classNames, function(className) { @@ -1235,6 +1256,11 @@ module.exports = { DEFAULT: 'default', STRIPED: 'striped', CLEAN: 'clean' + }, + selectionType: { + CELL: 'CELL', + ROW: 'ROW', + COLUMN: 'COLUMN' } }; @@ -1265,6 +1291,7 @@ var formUtil = { _.each(arr, function(value, i) { arr[i] = String(value); }); + return arr; }, @@ -1381,6 +1408,7 @@ var formUtil = { formElement = $form.prop('elements'); } } + return $(formElement); }, @@ -1541,6 +1569,7 @@ var util = { _.each(attributes, function(value, key) { str += ' ' + key + '="' + value + '"'; }, this); + return str; }, @@ -1553,6 +1582,7 @@ var util = { sum: function(list) { return _.reduce(list, function(memo, value) { memo += value; + return memo; }, 0); }, @@ -1669,13 +1699,13 @@ var util = { htmlString = htmlString.replace(/[\n\r\t]/g, ''); if (tui.util.hasEncodableString(htmlString)) { if (/]*\ssrc=[\"']?([^>\"']+)[\"']?[^>]*>/i); + matchResult = htmlString.match(/]*\ssrc=["']?([^>"']+)["']?[^>]*>/i); htmlString = matchResult ? matchResult[1] : ''; } else { htmlString = htmlString.replace(//gi, ''); } htmlString = $.trim(tui.util.decodeHTMLEntity( - htmlString.replace(/<\/?(?:h[1-5]|[a-z]+(?:\:[a-z]+)?)[^>]*>/ig, '') + htmlString.replace(/<\/?(?:h[1-5]|[a-z]+(?::[a-z]+)?)[^>]*>/ig, '') )); } return htmlString; @@ -1715,7 +1745,7 @@ var util = { _.each(dataObj, function(value, name) { if (!_.isString(value) && !_.isNumber(value)) { - value = $.toJSON(value); + value = JSON.stringify(value); } value = encodeURIComponent(value); if (value) { @@ -1743,7 +1773,7 @@ var util = { key = tmp[0]; value = decodeURIComponent(tmp[1]); try { - value = $.parseJSON(value); + value = JSON.parse(value); } catch(e) {} // eslint-disable-line if (!_.isNull(value)) { @@ -2001,6 +2031,11 @@ module.exports = DomState; * @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 {Object} [options.columnModelList.component] - Option for using tui-component + * @param {string} [options.columnModelList.component.name] - The name of the compnent to use + for this column + * @param {Object} [options.columnModelList.component.option] - The option object to be used for + creating the component * @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 @@ -2636,10 +2671,10 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ * @returns {Array|string} - A list of the rowKey. (or JSON string of the list) */ getCheckedRowKeyList: function(isJsonString) { - var checkedRowList = this.modelManager.dataModel.getRowList(true), - checkedRowKeyList = _.pluck(checkedRowList, 'rowKey'); + var checkedRowList = this.modelManager.dataModel.getRowList(true); + var checkedRowKeyList = _.pluck(checkedRowList, 'rowKey'); - return isJsonString ? $.toJSON(checkedRowKeyList) : checkedRowKeyList; + return isJsonString ? JSON.stringify(checkedRowKeyList) : checkedRowKeyList; }, /** @@ -2651,7 +2686,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ getCheckedRowList: function(isJsonString) { var checkedRowList = this.modelManager.dataModel.getRowList(true); - return isJsonString ? $.toJSON(checkedRowList) : checkedRowList; + return isJsonString ? JSON.stringify(checkedRowList) : checkedRowList; }, /** @@ -3067,7 +3102,7 @@ tui.Grid.applyTheme = function(presetName, extOptions) { themeManager.apply(presetName, extOptions); }; -},{"./addon/net":2,"./base/view":7,"./common/constMap":9,"./common/util":12,"./domState":13,"./model/manager":21,"./painter/controller":29,"./painter/manager":36,"./publicEventEmitter":38,"./theme/manager":40,"./view/factory":48}],15:[function(require,module,exports){ +},{"./addon/net":2,"./base/view":7,"./common/constMap":9,"./common/util":12,"./domState":13,"./model/manager":21,"./painter/controller":29,"./painter/manager":36,"./publicEventEmitter":38,"./theme/manager":40,"./view/factory":49}],15:[function(require,module,exports){ /** * @fileoverview 컬럼 모델 * @author NHN Ent. FE Development Team @@ -4792,7 +4827,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ var row = this.get(rowKey), rowData = row ? row.toJSON() : null; - return isJsonString ? $.toJSON(rowData) : rowData; + return isJsonString ? JSON.stringify(rowData) : rowData; }, /** @@ -4805,7 +4840,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ var row = this.at(index), rowData = row ? row.toJSON() : null; - return isJsonString ? $.toJSON(row) : rowData; + return isJsonString ? JSON.stringify(row) : rowData; }, /** @@ -4862,7 +4897,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ */ getColumnValues: function(columnName, isJsonString) { var valueList = this.pluck(columnName); - return isJsonString ? $.toJSON(valueList) : valueList; + return isJsonString ? JSON.stringify(valueList) : valueList; }, /** @@ -5103,7 +5138,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ var filtered = _.omit(row, filteringColumnList); var result = _.some(filtered, function(value, columnName) { if (typeof value === 'object') { - return ($.toJSON(value) !== $.toJSON(originalRow[columnName])); + return (JSON.stringify(value) !== JSON.stringify(originalRow[columnName])); } return value !== originalRow[columnName]; }, this); @@ -5461,10 +5496,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _getAvailableTotalWidth: function(columnLength) { - var totalWidth = this.get('width'), - borderCount = columnLength + 1 + (this.isDivisionBorderDoubled() ? 1 : 0), - totalBorderWidth = borderCount * CELL_BORDER_WIDTH, - availableTotalWidth = totalWidth - this.getScrollYWidth() - totalBorderWidth; + var totalWidth = this.get('width'); + var borderCount = columnLength + 1 + (this.isDivisionBorderDoubled() ? 1 : 0); + var totalBorderWidth = borderCount * CELL_BORDER_WIDTH; + var availableTotalWidth = totalWidth - this.getScrollYWidth() - totalBorderWidth; return availableTotalWidth; }, @@ -5476,8 +5511,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _applyMinimumColumnWidth: function(columnWidthList) { - var minWidthList = this._minColumnWidthList, - appliedList = _.clone(columnWidthList); + var minWidthList = this._minColumnWidthList; + var appliedList = _.clone(columnWidthList); _.each(appliedList, function(width, index) { var minWidth = minWidthList[index]; @@ -5485,6 +5520,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ appliedList[index] = minWidth; } }); + return appliedList; }, @@ -5493,8 +5529,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _resetTotalRowHeight: function() { - var rowHeight = this.get('rowHeight'), - rowCount = this.dataModel.length; + var rowHeight = this.get('rowHeight'); + var rowCount = this.dataModel.length; this.set('totalRowHeight', util.getHeight(rowCount, rowHeight)); }, @@ -5523,15 +5559,16 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _fillEmptyColumnWidth: function(columnWidthList) { - var totalWidth = this._getAvailableTotalWidth(columnWidthList.length), - remainTotalWidth = totalWidth - util.sum(columnWidthList), - emptyIndexes = []; + var totalWidth = this._getAvailableTotalWidth(columnWidthList.length); + var remainTotalWidth = totalWidth - util.sum(columnWidthList); + var emptyIndexes = []; _.each(columnWidthList, function(width, index) { if (!width) { emptyIndexes.push(index); } }); + return this._distributeExtraWidthEqually(columnWidthList, remainTotalWidth, emptyIndexes); }, @@ -5543,8 +5580,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _addExtraColumnWidth: function(columnWidthList, totalExtraWidth) { - var fixedFlags = this._columnWidthFixedFlags, - columnIndexes = []; + var fixedFlags = this._columnWidthFixedFlags; + var columnIndexes = []; _.each(fixedFlags, function(flag, index) { if (!flag) { @@ -5562,9 +5599,9 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _reduceExcessColumnWidth: function(columnWidthList, totalExcessWidth) { - var minWidthList = this._minColumnWidthList, - fixedFlags = this._columnWidthFixedFlags, - availableList = []; + var minWidthList = this._minColumnWidthList; + var fixedFlags = this._columnWidthFixedFlags; + var availableList = []; _.each(columnWidthList, function(width, index) { if (!fixedFlags[index]) { @@ -5589,9 +5626,9 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _reduceExcessColumnWidthSub: function(columnWidthList, totalRemainWidth, availableList) { - var avgValue = Math.round(totalRemainWidth / availableList.length), - newAvailableList = [], - columnIndexes; + var avgValue = Math.round(totalRemainWidth / availableList.length); + var newAvailableList = []; + var columnIndexes; _.each(availableList, function(available) { // note that totalRemainWidth and avgValue are negative number. @@ -5620,10 +5657,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _distributeExtraWidthEqually: function(columnWidthList, extraWidth, columnIndexes) { - var length = columnIndexes.length, - avgValue = Math.round(extraWidth / length), - errorValue = (avgValue * length) - extraWidth, // to correct total width - resultList = _.clone(columnWidthList); + var length = columnIndexes.length; + var avgValue = Math.round(extraWidth / length); + var errorValue = (avgValue * length) - extraWidth; // to correct total width + var resultList = _.clone(columnWidthList); _.each(columnIndexes, function(columnIndex) { resultList[columnIndex] += avgValue; @@ -5645,11 +5682,11 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _adjustColumnWidthList: function(columnWidthList, fitToReducedTotal) { - var columnLength = columnWidthList.length, - availableWidth = this._getAvailableTotalWidth(columnLength), - totalExtraWidth = availableWidth - util.sum(columnWidthList), - fixedCount = _.filter(this._columnWidthFixedFlags).length, - adjustedList; + var columnLength = columnWidthList.length; + var availableWidth = this._getAvailableTotalWidth(columnLength); + var totalExtraWidth = availableWidth - util.sum(columnWidthList); + var fixedCount = _.filter(this._columnWidthFixedFlags).length; + var adjustedList; if (totalExtraWidth > 0) { if (columnLength > fixedCount) { @@ -5664,6 +5701,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ } else { adjustedList = columnWidthList; } + return adjustedList; }, @@ -5672,15 +5710,15 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _initColumnWidthVariables: function() { - var columnModelList = this.columnModel.getVisibleColumnModelList(null, true), - commonMinWidth = this.get('minimumColumnWidth'), - widthList = [], - fixedFlags = [], - minWidthList = []; + var columnModelList = this.columnModel.getVisibleColumnModelList(null, true); + var commonMinWidth = this.get('minimumColumnWidth'); + var widthList = []; + var fixedFlags = []; + var minWidthList = []; _.each(columnModelList, function(columnModel) { - var width = columnModel.width > 0 ? columnModel.width : 0, - minWidth = Math.max(width, commonMinWidth); + var width = columnModel.width > 0 ? columnModel.width : 0; + var minWidth = Math.max(width, commonMinWidth); // Meta columns are not affected by common 'minimumColumnWidth' value if (util.isMetaColumn(columnModel.columnName)) { @@ -5731,13 +5769,14 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @returns {Number} 해당 frame 의 너비 */ getFrameWidth: function(whichSide) { - var columnFixCount = this.columnModel.getVisibleColumnFixCount(true), - columnWidthList = this.getColumnWidthList(whichSide), - frameWidth = this._getFrameWidth(columnWidthList); + var columnFixCount = this.columnModel.getVisibleColumnFixCount(true); + var columnWidthList = this.getColumnWidthList(whichSide); + var frameWidth = this._getFrameWidth(columnWidthList); if (_.isUndefined(whichSide) && columnFixCount > 0) { frameWidth += CELL_BORDER_WIDTH; } + return frameWidth; }, @@ -5749,9 +5788,11 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ */ _getFrameWidth: function(widthList) { var frameWidth = 0; + if (widthList.length) { frameWidth = util.sum(widthList) + ((widthList.length + 1) * CELL_BORDER_WIDTH); } + return frameWidth; }, @@ -5762,10 +5803,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _setColumnWidthVariables: function(columnWidthList, isSaveWidthList) { - var totalWidth = this.get('width'), - columnFixCount = this.columnModel.getVisibleColumnFixCount(true), - maxLeftSideWidth = this._getMaxLeftSideWidth(), - rsideWidth, lsideWidth, lsideWidthList, rsideWidthList; + var totalWidth = this.get('width'); + var columnFixCount = this.columnModel.getVisibleColumnFixCount(true); + var maxLeftSideWidth = this._getMaxLeftSideWidth(); + var rsideWidth, lsideWidth, lsideWidthList, rsideWidthList; lsideWidthList = columnWidthList.slice(0, columnFixCount); rsideWidthList = columnWidthList.slice(columnFixCount); @@ -5796,15 +5837,16 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _getMinLeftSideWidth: function() { - var minimumColumnWidth = this.get('minimumColumnWidth'), - columnFixCount = this.columnModel.getVisibleColumnFixCount(true), - minWidth = 0, - borderWidth; + var minimumColumnWidth = this.get('minimumColumnWidth'); + var columnFixCount = this.columnModel.getVisibleColumnFixCount(true); + var minWidth = 0; + var borderWidth; if (columnFixCount) { borderWidth = (columnFixCount + 1) * CELL_BORDER_WIDTH; minWidth = borderWidth + (minimumColumnWidth * columnFixCount); } + return minWidth; }, @@ -5819,6 +5861,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ if (maxWidth) { maxWidth = Math.max(maxWidth, this._getMinLeftSideWidth()); } + return maxWidth; }, @@ -5953,10 +5996,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _judgeScrollDirection: function(targetPosition, isRsideColumn, bodySize) { - var renderModel = this.renderModel, - currentTop = renderModel.get('scrollTop'), - currentLeft = renderModel.get('scrollLeft'), - isUp, isDown, isLeft, isRight; + var renderModel = this.renderModel; + var currentTop = renderModel.get('scrollTop'); + var currentLeft = renderModel.get('scrollLeft'); + var isUp, isDown, isLeft, isRight; isUp = targetPosition.top < currentTop; isDown = !isUp && (targetPosition.bottom > (currentTop + bodySize.height)); @@ -6008,8 +6051,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @returns {{x: number, y: number}} Mouse-overflow */ getOverflowFromMousePosition: function(pageX, pageY) { - var containerPos = this._rebasePositionToContainer(pageX, pageY), - bodySize = this._getBodySize(); + var containerPos = this._rebasePositionToContainer(pageX, pageY); + var bodySize = this._getBodySize(); return this._judgeOverflow(containerPos, bodySize); }, @@ -6022,10 +6065,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _judgeOverflow: function(containerPosition, bodySize) { - var containerX = containerPosition.x, - containerY = containerPosition.y, - overflowY = 0, - overflowX = 0; + var containerX = containerPosition.x; + var containerY = containerPosition.y; + var overflowY = 0; + var overflowX = 0; if (containerY < 0) { overflowY = -1; @@ -6068,10 +6111,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _calcRowIndexFromPositionY: function(containerY) { - var cellY = containerY + this.renderModel.get('scrollTop'), - tempIndex = Math.floor(cellY / (this.get('rowHeight') + CELL_BORDER_WIDTH)), - min = 0, - max = Math.max(min, this.dataModel.length - 1); + var cellY = containerY + this.renderModel.get('scrollTop'); + var tempIndex = Math.floor(cellY / (this.get('rowHeight') + CELL_BORDER_WIDTH)); + var min = 0; + var max = Math.max(min, this.dataModel.length - 1); return util.clamp(tempIndex, min, max); }, @@ -6084,12 +6127,12 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _calcColumnIndexFromPositionX: function(containerX, withMeta) { - var columnWidthList = this.getColumnWidthList(), - totalColumnWidth = this.getFrameWidth(), - cellX = containerX, - isRsidePosition = containerX >= this.get('lsideWidth'), - adjustableIndex = (withMeta) ? 0 : this.columnModel.getVisibleMetaColumnCount(), - columnIndex = 0; + var columnWidthList = this.getColumnWidthList(); + var totalColumnWidth = this.getFrameWidth(); + var cellX = containerX; + var isRsidePosition = containerX >= this.get('lsideWidth'); + var adjustableIndex = (withMeta) ? 0 : this.columnModel.getVisibleMetaColumnCount(); + var columnIndex = 0; if (isRsidePosition) { cellX += this.renderModel.get('scrollLeft'); @@ -6121,8 +6164,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _rebasePositionToContainer: function(pageX, pageY) { - var containerPosX = pageX - this.get('offsetLeft'), - containerPosY = pageY - (this.get('offsetTop') + this.get('headerHeight') + 2); + var containerPosX = pageX - this.get('offsetLeft'); + var containerPosY = pageY - (this.get('offsetTop') + this.get('headerHeight') + 2); return { x: containerPosX, @@ -6138,11 +6181,12 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _adjustLeftSideWidthList: function(lsideWidthList, totalWidth) { - var i = lsideWidthList.length - 1, - minimumColumnWidth = this.get('minimumColumnWidth'), - currentWidth = this._getFrameWidth(lsideWidthList), - diff = currentWidth - totalWidth, - changedWidth; + var i = lsideWidthList.length - 1; + var minimumColumnWidth = this.get('minimumColumnWidth'); + var currentWidth = this._getFrameWidth(lsideWidthList); + var diff = currentWidth - totalWidth; + var changedWidth; + if (diff > 0) { while (i >= 0 && diff > 0) { changedWidth = Math.max(minimumColumnWidth, lsideWidthList[i] - diff); @@ -6153,6 +6197,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ } else if (diff < 0) { lsideWidthList[i] += Math.abs(diff); } + return lsideWidthList; }, @@ -6195,6 +6240,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ */ _onWidthChange: function() { var widthList = this._adjustColumnWidthList(this.get('columnWidthList'), true); + this._setColumnWidthVariables(widthList); }, @@ -6204,10 +6250,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @param {Number} width 변경할 너비 pixel값 */ setColumnWidth: function(index, width) { - var columnWidthList = this.get('columnWidthList'), - fixedFlags = this._columnWidthFixedFlags, - minWidth = this._minColumnWidthList[index], - adjustedList; + var columnWidthList = this.get('columnWidthList'); + var fixedFlags = this._columnWidthFixedFlags; + var minWidth = this._minColumnWidthList[index]; + var adjustedList; if (!fixedFlags[index] && columnWidthList[index]) { columnWidthList[index] = Math.max(width, minWidth); @@ -6276,8 +6322,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * layout 에 필요한 크기 및 위치 데이터를 갱신한다. */ refreshLayout: function() { - var domState = this.domState, - offset = domState.getOffset(); + var domState = this.domState; + var offset = domState.getOffset(); this.set({ offsetTop: offset.top, @@ -6296,6 +6342,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ */ restoreColumnWidth: function(index) { var orgWidth = this.get('originalWidthList')[index]; + this.setColumnWidth(index, orgWidth); }, @@ -6305,8 +6352,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @returns {Array} 조회한 영역의 columnWidthList */ getColumnWidthList: function(whichSide) { - var columnFixCount = this.columnModel.getVisibleColumnFixCount(true), - columnWidthList = []; + var columnFixCount = this.columnModel.getVisibleColumnFixCount(true); + var columnWidthList = []; switch (whichSide) { case 'l': @@ -6321,6 +6368,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ columnWidthList = this.get('columnWidthList'); break; } + return columnWidthList; } }); @@ -6449,8 +6497,8 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {Boolean} True is success */ select: function(rowKey) { - var eventData = new GridEvent(), - currentRowKey = this.get('rowKey'); + var eventData = new GridEvent(); + var currentRowKey = this.get('rowKey'); if (String(currentRowKey) === String(rowKey)) { return true; @@ -6480,6 +6528,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ */ _cancelSelect: function() { var prevColumnName = this.get('prevColumnName'); + this.set('columnName', prevColumnName); this.trigger('focus', this.get('rowKey'), prevColumnName); }, @@ -6533,9 +6582,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {Boolean} true if success */ focusAt: function(rowIndex, columnIndex, isScrollable) { - var row = this.dataModel.at(rowIndex), - column = this.columnModel.at(columnIndex, true), - result = false; + var row = this.dataModel.at(rowIndex); + var column = this.columnModel.at(columnIndex, true); + var result = false; if (row && column) { result = this.focus(row.get('rowKey'), column.columnName, isScrollable); @@ -6576,9 +6625,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {Boolean} true if success */ focusInAt: function(rowIndex, columnIndex, isScrollable) { - var row = this.dataModel.at(rowIndex), - column = this.columnModel.at(columnIndex, true), - result = false; + var row = this.dataModel.at(rowIndex); + var column = this.columnModel.at(columnIndex, true); + var result = false; if (row && column) { result = this.focusIn(row.get('rowKey'), column.columnName, isScrollable); @@ -6663,8 +6712,8 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {{row: number, column: number}} The object that contains index info */ indexOf: function(isPrevious) { - var rowKey = isPrevious ? this.get('prevRowKey') : this.get('rowKey'), - columnName = isPrevious ? this.get('prevColumnName') : this.get('columnName'); + var rowKey = isPrevious ? this.get('prevRowKey') : this.get('rowKey'); + var columnName = isPrevious ? this.get('prevColumnName') : this.get('columnName'); return { row: this.dataModel.indexOfRowKey(rowKey), @@ -6678,8 +6727,8 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {boolean} True if has focus. */ has: function(checkValid) { - var rowKey = this.get('rowKey'), - columnName = this.get('columnName'); + var rowKey = this.get('rowKey'); + var columnName = this.get('columnName'); if (checkValid) { return this._isValidCell(rowKey, columnName); @@ -6692,9 +6741,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {boolean} True if restored */ restore: function() { - var prevRowKey = this.get('prevRowKey'), - prevColumnName = this.get('prevColumnName'), - restored = false; + var prevRowKey = this.get('prevRowKey'); + var prevColumnName = this.get('prevColumnName'); + var restored = false; if (this._isValidCell(prevRowKey, prevColumnName)) { this.focus(prevRowKey, prevColumnName); @@ -6769,8 +6818,8 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @private */ _isValidCell: function(rowKey, columnName) { - var isValidRowKey = !util.isBlank(rowKey) && !!this.dataModel.get(rowKey), - isValidColumnName = !util.isBlank(columnName) && !!this.columnModel.getColumnModel(columnName); + var isValidRowKey = !util.isBlank(rowKey) && !!this.dataModel.get(rowKey); + var isValidColumnName = !util.isBlank(columnName) && !!this.columnModel.getColumnModel(columnName); return isValidRowKey && isValidColumnName; }, @@ -6782,9 +6831,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @private */ _findRowKey: function(offset) { - var index, row, - dataModel = this.dataModel, - rowKey = null; + var dataModel = this.dataModel; + var rowKey = null; + var index, row; if (this.has(true)) { index = Math.max( @@ -6808,11 +6857,11 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @private */ _findColumnName: function(offset) { - var index, - columnModel = this.columnModel, - columnModelList = columnModel.getVisibleColumnModelList(), - columnIndex = columnModel.indexOfColumnName(this.get('columnName'), true), - columnName = null; + var columnModel = this.columnModel; + var columnModelList = columnModel.getVisibleColumnModelList(); + var columnIndex = columnModel.indexOfColumnName(this.get('columnName'), true); + var columnName = null; + var index; if (this.has(true)) { index = Math.max(Math.min(columnIndex + offset, columnModelList.length - 1), 0); @@ -6839,6 +6888,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ */ nextRowIndex: function(offset) { var rowKey = this.nextRowKey(offset); + return this.dataModel.indexOfRowKey(rowKey); }, @@ -6849,6 +6899,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ */ prevRowIndex: function(offset) { var rowKey = this.prevRowKey(offset); + return this.dataModel.indexOfRowKey(rowKey); }, @@ -6858,6 +6909,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ */ nextColumnIndex: function() { var columnName = this.nextColumnName(); + return this.columnModel.indexOfColumnName(columnName, true); }, @@ -6867,6 +6919,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ */ prevColumnIndex: function() { var columnName = this.prevColumnName(); + return this.columnModel.indexOfColumnName(columnName, true); }, @@ -6877,9 +6930,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {Number|String} offset 만큼 이동한 위치의 rowKey */ nextRowKey: function(offset) { - var focused = this.which(), - rowKey = focused.rowKey, - count, rowSpanData; + var focused = this.which(); + var rowKey = focused.rowKey; + var count, rowSpanData; offset = (typeof offset === 'number') ? offset : 1; if (offset > 1) { @@ -6900,6 +6953,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ rowKey = this._findRowKey(1); } } + return rowKey; }, @@ -6910,9 +6964,10 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {Number|String} offset 만큼 이동한 위치의 rowKey */ prevRowKey: function(offset) { - var focused = this.which(), - rowKey = focused.rowKey, - rowSpanData; + var focused = this.which(); + var rowKey = focused.rowKey; + var rowSpanData; + offset = typeof offset === 'number' ? offset : 1; offset *= -1; @@ -6930,6 +6985,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ rowKey = this._findRowKey(-1); } } + return rowKey; }, @@ -6971,6 +7027,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ */ firstColumnName: function() { var columnModelList = this.columnModel.getVisibleColumnModelList(); + return columnModelList[0].columnName; }, @@ -6979,8 +7036,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {string} 마지막 컬럼명 */ lastColumnName: function() { - var columnModelList = this.columnModel.getVisibleColumnModelList(), - lastIndex = columnModelList.length - 1; + var columnModelList = this.columnModel.getVisibleColumnModelList(); + var lastIndex = columnModelList.length - 1; + return columnModelList[lastIndex].columnName; } }); @@ -7443,8 +7501,8 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _updateMaxScrollLeft: function() { - var dimension = this.dimensionModel, - maxScrollLeft = dimension.getFrameWidth('R') - dimension.get('rsideWidth') + + var dimension = this.dimensionModel; + var maxScrollLeft = dimension.getFrameWidth('R') - dimension.get('rsideWidth') + dimension.getScrollYWidth(); this.set('maxScrollLeft', maxScrollLeft); @@ -7455,9 +7513,9 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _updateMaxScrollTop: function() { - var dimension = this.dimensionModel, - maxScrollTop = dimension.get('totalRowHeight') - dimension.get('bodyHeight') + - dimension.get('scrollBarSize'); + var dimension = this.dimensionModel; + var maxScrollTop = dimension.get('totalRowHeight') - dimension.get('bodyHeight') + + dimension.get('scrollBarSize'); this.set('maxScrollTop', maxScrollTop); }, @@ -7585,7 +7643,9 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ startIndex: 0, endIndex: 0 }); - this.refresh(true); + this.refresh({ + columnModelChanged: true + }); }, /** @@ -7593,7 +7653,9 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _onDataModelChange: function() { - this.refresh(false, true); + this.refresh({ + dataModelChanged: true + }); }, /** @@ -7603,7 +7665,9 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _onAddDataModel: function(dataModel, options) { - this.refresh(false, true); + this.refresh({ + dataModelChanged: true + }); if (options.focus) { this.focusModel.focusAt(options.at, 0); @@ -7611,13 +7675,13 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ }, /** - * Resets dummy rows and trigger 'rowListChanged' event. + * Resets dummy rows and trigger 'dataModelChanged' event. * @private */ _resetDummyRows: function() { this._clearDummyRows(); this._fillDummyRows(); - this.trigger('rowListChanged'); + this.trigger('dataModelChanged'); }, /** @@ -7667,9 +7731,9 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _getColumnNamesOfEachSide: function() { - var columnFixCount = this.columnModel.getVisibleColumnFixCount(true), - columnModels = this.columnModel.getVisibleColumnModelList(null, true), - columnNames = _.pluck(columnModels, 'columnName'); + var columnFixCount = this.columnModel.getVisibleColumnFixCount(true); + var columnModels = this.columnModel.getVisibleColumnModelList(null, true); + var columnNames = _.pluck(columnModels, 'columnName'); return { lside: columnNames.slice(0, columnFixCount), @@ -7696,12 +7760,12 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _resetAllViewModelListWithRange: function(startIndex, endIndex) { - var columnNamesMap = this._getColumnNamesOfEachSide(), - rowNum = this.get('startNumber') + startIndex, - height = this.dimensionModel.get('rowHeight'), - lsideData = [], - rsideData = [], - rowDataModel, i; + var columnNamesMap = this._getColumnNamesOfEachSide(); + var rowNum = this.get('startNumber') + startIndex; + var height = this.dimensionModel.get('rowHeight'); + var lsideData = []; + var rsideData = []; + var rowDataModel, i; for (i = startIndex; i <= endIndex; i += 1) { rowDataModel = this.dataModel.at(i); @@ -7764,10 +7828,13 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ /** * Refreshes the rendering range and the list of view models, and triggers events. - * @param {Boolean} columnModelChanged - The boolean value whether columnModel has changed - * @param {Boolean} dataModelChanged - The boolean value whether dataModel has changed + * @param {Object} options - options + * @param {Boolean} [options.columnModelChanged] - The boolean value whether columnModel has changed + * @param {Boolean} [options.dataModelChanged] - The boolean value whether dataModel has changed */ - refresh: function(columnModelChanged, dataModelChanged) { + refresh: function(options) { + var columnModelChanged = !!options && options.columnModelChanged; + var dataModelChanged = !!options && options.dataModelChanged; var startIndex, endIndex, i; this._setRenderingRange(this.get('scrollTop')); @@ -7810,8 +7877,8 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _getCollectionByColumnName: function(columnName) { - var lside = this.get('lside'), - collection; + var lside = this.get('lside'); + var collection; if (lside.at(0) && lside.at(0).get(columnName)) { collection = lside; @@ -7856,12 +7923,13 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ } */ getCellData: function(rowKey, columnName) { - var row = this._getRowModel(rowKey, columnName), - cellData = null; + var row = this._getRowModel(rowKey, columnName); + var cellData = null; if (row) { cellData = row.get(columnName); } + return cellData; }, @@ -7871,9 +7939,9 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _executeRelation: function(rowIndex) { - var row = this.dataModel.at(rowIndex), - renderIdx = rowIndex - this.get('startIndex'), - rowModel, relationResult; + var row = this.dataModel.at(rowIndex); + var renderIdx = rowIndex - this.get('startIndex'); + var rowModel, relationResult; relationResult = row.executeRelationCallbacksAll(); @@ -7910,9 +7978,9 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ * @param {object} options - Options */ initialize: function(attributes) { - var rowKey = attributes && attributes.rowKey, - dataModel = this.collection.dataModel, - rowData = dataModel.get(rowKey); + var rowKey = attributes && attributes.rowKey; + var dataModel = this.collection.dataModel; + var rowData = dataModel.get(rowKey); this.dataModel = dataModel; this.columnModel = this.collection.columnModel; @@ -7990,32 +8058,22 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ * @private */ _setRowExtraData: function() { - var dataModel = this.collection.dataModel, - columnNames = this._getColumnNameList(), - param; - if (tui.util.isUndefined(this.collection)) { return; } - _.each(columnNames, function(columnName) { - var cellData = this.get(columnName), - rowModel = this, // eslint-disable-line consistent-this - cellState; + _.each(this._getColumnNameList(), function(columnName) { + var cellData = this.get(columnName); + var cellState; - if (!tui.util.isUndefined(cellData)) { + if (!tui.util.isUndefined(cellData) && cellData.isMainRow) { cellState = this.rowData.getCellState(columnName); - if (dataModel.isRowSpanEnable() && !cellData.isMainRow) { - rowModel = this.collection.get(cellData.mainRowKey); - } - if (rowModel) { - param = { - isDisabled: cellState.isDisabled, - isEditable: cellState.isEditable, - className: this._getClassNameString(columnName) - }; - rowModel.setCell(columnName, param); - } + + this.setCell(columnName, { + isDisabled: cellState.isDisabled, + isEditable: cellState.isEditable, + className: this._getClassNameString(columnName) + }); } }, this); }, @@ -8057,10 +8115,10 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ columnData = _.omit(data, 'rowKey', '_extraData', 'height', 'rowNum'); _.each(columnData, function(value, columnName) { - var rowSpanData = this._getRowSpanData(columnName, data, dataModel.isRowSpanEnable()), - cellState = row.getCellState(columnName), - isTextType = columnModel.isTextType(columnName), - column = columnModel.getColumnModel(columnName); + var rowSpanData = this._getRowSpanData(columnName, data, dataModel.isRowSpanEnable()); + var cellState = row.getCellState(columnName); + var isTextType = columnModel.isTextType(columnName); + var column = columnModel.getColumnModel(columnName); data[columnName] = { rowKey: rowKey, @@ -8117,10 +8175,10 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ * @private */ _getValueAttrs: function(value, row, column, isTextType) { - var beforeContent = tui.util.pick(column, 'editOption', 'beforeContent'), - afterContent = tui.util.pick(column, 'editOption', 'afterContent'), - converter = tui.util.pick(column, 'editOption', 'converter'), - rowAttrs = row.toJSON(); + var beforeContent = tui.util.pick(column, 'editOption', 'beforeContent'); + var afterContent = tui.util.pick(column, 'editOption', 'afterContent'); + var converter = tui.util.pick(column, 'editOption', 'converter'); + var rowAttrs = row.toJSON(); return { value: this._getValueToDisplay(value, column, isTextType), @@ -8198,9 +8256,9 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ * @private */ _getValueToDisplay: function(value, column, isTextType) { - var isExisty = tui.util.isExisty, - notUseHtmlEntity = column.notUseHtmlEntity, - defaultValue = column.defaultValue; + var isExisty = tui.util.isExisty; + var notUseHtmlEntity = column.notUseHtmlEntity; + var defaultValue = column.defaultValue; if (!isExisty(value)) { value = isExisty(defaultValue) ? defaultValue : ''; @@ -8252,9 +8310,9 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ * @param {Object} param - Key-Value pair of the data to change */ setCell: function(columnName, param) { - var isValueChanged = false, - changed = [], - rowIndex, rowKey, data; + var isValueChanged = false; + var changed = []; + var rowIndex, rowKey, data; if (!this.has(columnName)) { return; @@ -8276,7 +8334,7 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ this.set(columnName, data, { silent: this._shouldSetSilently(data, isValueChanged) }); - if (isValueChanged && !data.isEditing) { + if (isValueChanged) { rowIndex = this.collection.dataModel.indexOfRowKey(rowKey); this.trigger('valueChange', rowIndex); } @@ -8293,9 +8351,15 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ _shouldSetSilently: function(cellData, valueChanged) { var valueChangedOnEditing = cellData.isEditing && valueChanged; var useViewMode = tui.util.pick(cellData, 'columnModel', 'editOption', 'useViewMode') !== false; - var editingStarted = _.contains(cellData.changed, 'isEditing') && cellData.isEditing; - - return valueChangedOnEditing || (useViewMode && editingStarted); + var editingChangedToTrue = _.contains(cellData.changed, 'isEditing') && cellData.isEditing; + + // Silent Cases + // 1: If values have been changed while the isEditing is true, + // prevent the related cell-view from changing its value-state until editing is finished. + // 2: If useViewMode is true and isEditing is changing to true, + // prevent the related cell-view from changing its state to enable editing, + // as the editing-layer will be used for editing instead. + return valueChangedOnEditing || (useViewMode && editingChangedToTrue); } }); @@ -8342,21 +8406,9 @@ module.exports = RowList; */ 'use strict'; -var Model = require('../base/model'), - util = require('../common/util'); - -/** - * @ignore - * @const - * @type {{cell: string, row: string, column: string}} - * @desc - * Selection states - */ -var SELECTION_STATE = { - cell: 'cell', - row: 'row', - column: 'column' -}; +var Model = require('../base/model'); +var util = require('../common/util'); +var typeConstMap = require('../common/constMap').selectionType; /** * Selection Model class @@ -8382,8 +8434,8 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ inputRange: null, intervalIdForAutoScroll: null, scrollPixelScale: 40, - _isEnabled: true, - _selectionState: SELECTION_STATE.cell + enabled: true, + selectionType: typeConstMap.CELL }); this.listenTo(this.dataModel, 'add remove sort reset', this.end); @@ -8409,26 +8461,26 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ }, /** - * Set selection state - * @param {string} state - Selection state (cell, row, column) + * Set selection type + * @param {string} type - Selection type (CELL, ROW, COLUMN) */ - setState: function(state) { - this._selectionState = SELECTION_STATE[state] || this._selectionState; + setType: function(type) { + this.selectionType = typeConstMap[type] || this.selectionType; }, /** - * Return the selection state - * @returns {string} state - Selection state (cell, row, column) + * Return the selection type + * @returns {string} type - Selection type (CELL, ROW, COLUMN) */ - getState: function() { - return this._selectionState; + getType: function() { + return this.selectionType; }, /** * Enables the selection. */ enable: function() { - this._isEnabled = true; + this.enabled = true; }, /** @@ -8436,7 +8488,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ */ disable: function() { this.end(); - this._isEnabled = false; + this.enabled = false; }, /** @@ -8444,20 +8496,21 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @returns {boolean} True if the selection is enabled. */ isEnabled: function() { - return this._isEnabled; + return this.enabled; }, /** * Starts the selection. * @param {Number} rowIndex - Row index * @param {Number} columnIndex - Column index - * @param {string} state - Selection state강지 + * @param {string} type - Selection type */ - start: function(rowIndex, columnIndex, state) { - if (!this._isEnabled) { + start: function(rowIndex, columnIndex, type) { + if (!this.isEnabled()) { return; } - this.setState(state); + + this.setType(type); this.inputRange = { row: [rowIndex, rowIndex], column: [columnIndex, columnIndex] @@ -8469,31 +8522,31 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * Starts the selection by mouse position. * @param {number} pageX - X position relative to the document * @param {number} pageY - Y position relative to the document - * @param {string} state - Selection state + * @param {string} type - Selection type */ - startByMousePosition: function(pageX, pageY, state) { + startByMousePosition: function(pageX, pageY, type) { var index = this.dimensionModel.getIndexFromMousePosition(pageX, pageY); - this.start(index.row, index.column, state); + this.start(index.row, index.column, type); }, /** * Updates the selection range. * @param {number} rowIndex - Row index * @param {number} columnIndex - Column index - * @param {string} [state] - Selection state + * @param {string} [type] - Selection type */ - update: function(rowIndex, columnIndex, state) { + update: function(rowIndex, columnIndex, type) { var focusedIndex; - if (!this._isEnabled || rowIndex < 0 || columnIndex < 0) { + if (!this.enabled || rowIndex < 0 || columnIndex < 0) { return; } if (!this.hasSelection()) { focusedIndex = this.focusModel.indexOf(); - this.start(focusedIndex.row, focusedIndex.column, state); + this.start(focusedIndex.row, focusedIndex.column, type); } else { - this.setState(state); + this.setType(type); } this._updateInputRange(rowIndex, columnIndex); @@ -8509,6 +8562,12 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ _updateInputRange: function(rowIndex, columnIndex) { var inputRange = this.inputRange; + if (this.selectionType === typeConstMap.ROW) { + columnIndex = this.columnModel.getVisibleColumnModelList().length - 1; + } else if (this.selectionType === typeConstMap.COLUMN) { + rowIndex = this.dataModel.length - 1; + } + inputRange.row[1] = rowIndex; inputRange.column[1] = columnIndex; }, @@ -8520,13 +8579,13 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @param {number} pageY - Mouse positino Y */ extendColumnSelection: function(columnIndexes, pageX, pageY) { - var minimumColumnRange = this._minimumColumnRange, - index = this.dimensionModel.getIndexFromMousePosition(pageX, pageY), - range = { - row: [0, 0], - column: [] - }, - minMax; + var minimumColumnRange = this._minimumColumnRange; + var index = this.dimensionModel.getIndexFromMousePosition(pageX, pageY); + var range = { + row: [0, this.dataModel.length - 1], + column: [] + }; + var minMax; if (!columnIndexes || !columnIndexes.length) { columnIndexes = [index.column]; @@ -8564,13 +8623,13 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * Updates the selection range by mouse position. * @param {number} pageX - X position relative to the document * @param {number} pageY - Y position relative to the document - * @param {string} [state] - Selection state + * @param {string} [type] - Selection type */ - updateByMousePosition: function(pageX, pageY, state) { + updateByMousePosition: function(pageX, pageY, type) { var index = this.dimensionModel.getIndexFromMousePosition(pageX, pageY); this._setScrolling(pageX, pageY); - this.update(index.row, index.column, state); + this.update(index.row, index.column, type); }, /** @@ -8597,9 +8656,9 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @param {Number} rowIndex - Row idnex */ selectRow: function(rowIndex) { - if (this._isEnabled) { + if (this.isEnabled()) { this.focusModel.focusAt(rowIndex, 0); - this.start(rowIndex, 0, SELECTION_STATE.row); + this.start(rowIndex, 0, typeConstMap.ROW); this.update(rowIndex, this.columnModel.getVisibleColumnModelList().length - 1); } }, @@ -8609,9 +8668,9 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @param {Number} columnIdx - Column index */ selectColumn: function(columnIdx) { - if (this._isEnabled) { + if (this.isEnabled()) { this.focusModel.focusAt(0, columnIdx); - this.start(0, columnIdx, SELECTION_STATE.column); + this.start(0, columnIdx, typeConstMap.COLUMN); this.update(this.dataModel.length - 1, columnIdx); } }, @@ -8620,8 +8679,8 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * Selects all data range. */ selectAll: function() { - if (this._isEnabled) { - this.start(0, 0, SELECTION_STATE.cell); + if (this.isEnabled()) { + this.start(0, 0, typeConstMap.CELL); this.update(this.dataModel.length - 1, this.columnModel.getVisibleColumnModelList().length - 1); } }, @@ -8632,6 +8691,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ */ getStartIndex: function() { var range = this.get('range'); + return { row: range.row[0], column: range.column[0] @@ -8644,6 +8704,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ */ getEndIndex: function() { var range = this.get('range'); + return { row: range.row[1], column: range.column[1] @@ -8665,10 +8726,10 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @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); + var isSingleColumn = columnNameList.length === 1; + var isSingleRow = rowList.length === 1; + var isSingleMergedCell = isSingleColumn && !isSingleRow && + (rowList[0].getRowSpanData(columnNameList[0]).count === rowList.length); return (isSingleColumn && isSingleRow) || isSingleMergedCell; }, @@ -8678,8 +8739,8 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @returns {String} string of values */ getValuesToString: function() { - var range = this.get('range'), - columnModelList, rowList, columnNameList, rowValues; + var range = this.get('range'); + var columnModelList, rowList, columnNameList, rowValues; columnModelList = this.columnModel.getVisibleColumnModelList().slice(range.column[0], range.column[1] + 1); rowList = this.dataModel.slice(range.row[0], range.row[1] + 1); @@ -8734,8 +8795,8 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @private */ _adjustScrollLeft: function(overflowX, scrollLeft, maxScrollLeft) { - var adjusted = scrollLeft, - pixelScale = this.scrollPixelScale; + var adjusted = scrollLeft; + var pixelScale = this.scrollPixelScale; if (overflowX < 0) { adjusted = Math.max(0, scrollLeft - pixelScale); @@ -8753,8 +8814,8 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @private */ _adjustScrollTop: function(overflowY, scrollTop, maxScrollTop) { - var adjusted = scrollTop, - pixelScale = this.scrollPixelScale; + var adjusted = scrollTop; + var pixelScale = this.scrollPixelScale; if (overflowY < 0) { adjusted = Math.max(0, scrollTop - pixelScale); @@ -8770,8 +8831,8 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @private */ _resetRangeAttribute: function(inputRange) { - var dataModel = this.dataModel, - hasSpannedRange, spannedRange, tmpRowRange; + var dataModel = this.dataModel; + var hasSpannedRange, spannedRange, tmpRowRange; inputRange = inputRange || this.inputRange; if (!inputRange) { @@ -8784,7 +8845,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ column: _.sortBy(inputRange.column) }; - if (dataModel.isRowSpanEnable()) { + if (dataModel.isRowSpanEnable() && this.selectionType === typeConstMap.CELL) { do { tmpRowRange = _.assign([], spannedRange.row); spannedRange = this._getRowSpannedIndex(spannedRange); @@ -8794,19 +8855,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ spannedRange.row[1] !== tmpRowRange[1] ); } while (hasSpannedRange); - } - - this._setRangeMinMax(spannedRange.row, spannedRange.column); - switch (this._selectionState) { - case SELECTION_STATE.column: - spannedRange.row = [0, dataModel.length - 1]; - break; - case SELECTION_STATE.row: - spannedRange.column = [0, this.columnModel.getVisibleColumnModelList().length - 1]; - break; - case SELECTION_STATE.cell: - default: - break; + this._setRangeMinMax(spannedRange.row, spannedRange.column); } this.set('range', spannedRange); @@ -8851,13 +8900,13 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @private */ _concatRowSpanIndexFromStart: function(param) { - var startIndex = param.startIndex, - endIndex = param.endIndex, - columnName = param.columnName, - rowSpanData = param.startRowSpanDataMap && param.startRowSpanDataMap[columnName], - startIndexList = param.startIndexList, - endIndexList = param.endIndexList, - spannedIndex; + var startIndex = param.startIndex; + var endIndex = param.endIndex; + var columnName = param.columnName; + var rowSpanData = param.startRowSpanDataMap && param.startRowSpanDataMap[columnName]; + var startIndexList = param.startIndexList; + var endIndexList = param.endIndexList; + var spannedIndex; if (!rowSpanData) { return; @@ -8880,12 +8929,12 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @private */ _concatRowSpanIndexFromEnd: function(param) { - var endIndex = param.endIndex, - columnName = param.columnName, - rowSpanData = param.endRowSpanDataMap && param.endRowSpanDataMap[columnName], - endIndexList = param.endIndexList, - dataModel = param.dataModel, - spannedIndex, tmpRowSpanData; + var endIndex = param.endIndex; + var columnName = param.columnName; + var rowSpanData = param.endRowSpanDataMap && param.endRowSpanDataMap[columnName]; + var endIndexList = param.endIndexList; + var dataModel = param.dataModel; + var spannedIndex, tmpRowSpanData; if (!rowSpanData) { return; @@ -8912,14 +8961,14 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ */ _getRowSpannedIndex: function(spannedRange) { var columnModelList = this.columnModel.getVisibleColumnModelList() - .slice(spannedRange.column[0], spannedRange.column[1] + 1), - dataModel = this.dataModel, - startIndexList = [spannedRange.row[0]], - endIndexList = [spannedRange.row[1]], - startRow = dataModel.at(spannedRange.row[0]), - endRow = dataModel.at(spannedRange.row[1]), - newSpannedRange = $.extend({}, spannedRange), - startRowSpanDataMap, endRowSpanDataMap, columnName, param; + .slice(spannedRange.column[0], spannedRange.column[1] + 1); + var dataModel = this.dataModel; + var startIndexList = [spannedRange.row[0]]; + var endIndexList = [spannedRange.row[1]]; + var startRow = dataModel.at(spannedRange.row[0]); + var endRow = dataModel.at(spannedRange.row[1]); + var newSpannedRange = $.extend({}, spannedRange); + var startRowSpanDataMap, endRowSpanDataMap, columnName, param; if (!startRow || !endRow) { return newSpannedRange; @@ -8952,7 +9001,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ module.exports = Selection; -},{"../base/model":5,"../common/util":12}],27:[function(require,module,exports){ +},{"../base/model":5,"../common/constMap":9,"../common/util":12}],27:[function(require,module,exports){ /** * @fileoverview Toolbar model class * @author NHN Ent. FE Development Team @@ -9184,15 +9233,15 @@ var Cell = tui.util.defineClass(Painter, /**@lends module:painter/cell.prototype * @param {jQuery} $td - cell element */ refresh: function(cellData, $td) { - var contentProps = ['value', 'isEditing', 'isDisabled']; - var isEditingChanged = _.contains(cellData.changed, 'isEditing'); + var contentProps = ['value', 'isEditing', 'isDisabled', 'optionList']; + var editingChangedToTrue = _.contains(cellData.changed, 'isEditing') && cellData.isEditing; var shouldUpdateContent = _.intersection(contentProps, cellData.changed).length > 0; var attrs = this._getAttributes(cellData); delete attrs.rowspan; // prevent error in IE7 (cannot update rowspan attribute) $td.attr(attrs); - if (isEditingChanged && cellData.isEditing && !this._isUsingViewMode(cellData)) { + if (editingChangedToTrue && !this._isUsingViewMode(cellData)) { this.inputPainter.focus($td); } else if (shouldUpdateContent) { $td.html(this._getContentHtml(cellData)); @@ -9286,10 +9335,10 @@ var PainterController = tui.util.defineClass(/**@lends module:painter/controller * @param {Boolean} reverse - if set to true, find the previous cell instead of next cell */ focusInToNextCell: function(reverse) { - var focusModel = this.focusModel, - rowKey = focusModel.get('rowKey'), - columnName = focusModel.get('columnName'), - nextColumnName = reverse ? focusModel.prevColumnName() : focusModel.nextColumnName(); + var focusModel = this.focusModel; + var rowKey = focusModel.get('rowKey'); + var columnName = focusModel.get('columnName'); + var nextColumnName = reverse ? focusModel.prevColumnName() : focusModel.nextColumnName(); if (columnName !== nextColumnName) { focusModel.focusIn(rowKey, nextColumnName, true); @@ -9302,9 +9351,9 @@ var PainterController = tui.util.defineClass(/**@lends module:painter/controller * @param {{rowKey:String, columnName:String}} address - cell address */ executeCustomInputEventHandler: function(event, address) { - var columnModel = this.columnModel.getColumnModel(address.columnName), - eventType = event.type, - eventHandler; + var columnModel = this.columnModel.getColumnModel(address.columnName); + var eventType = event.type; + var eventHandler; if (eventType === 'focusin') { eventType = 'focus'; @@ -9501,8 +9550,8 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ * @private */ _executeCustomEventHandler: function(event) { - var $input = $(event.target), - address = this._getCellAddress($input); + var $input = $(event.target); + var address = this._getCellAddress($input); this.controller.executeCustomInputEventHandler(event, address); }, @@ -9513,9 +9562,11 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ * @private */ _onFocusIn: function(event) { - var address = this._getCellAddress($(event.target)); + var $target = $(event.target); + var address = this._getCellAddress($target); this._executeCustomEventHandler(event); + this.trigger('focusIn', $target, address); this.controller.startEditing(address); }, @@ -9525,10 +9576,11 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ * @private */ _onFocusOut: function(event) { - var $target = $(event.target), - address = this._getCellAddress($target); + var $target = $(event.target); + var address = this._getCellAddress($target); this._executeCustomEventHandler(event); + this.trigger('focusOut', $target, address); this.controller.finishEditing(address, false, $target.val()); }, @@ -9618,6 +9670,8 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ } }); +_.assign(InputPainter.prototype, Backbone.Events); + module.exports = InputPainter; },{"../../base/painter":6,"../../common/constMap":9}],32:[function(require,module,exports){ @@ -10791,8 +10845,9 @@ function buildCssString(options) { styleGen.cell(cell.normal), styleGen.cellDummy(cell.dummy), styleGen.cellEditable(cell.editable), - styleGen.cellEvenRow(cell.evenRow), styleGen.cellHead(cell.head), + styleGen.cellOddRow(cell.oddRow), + styleGen.cellEvenRow(cell.evenRow), styleGen.cellRequired(cell.required), styleGen.cellDisabled(cell.disabled), styleGen.cellInvalid(cell.invalid), @@ -10938,6 +10993,7 @@ module.exports = { background: '#ff8080' }, evenRow: {}, + oddRow: {}, currentRow: {} } }; @@ -10959,12 +11015,16 @@ module.exports = $.extend(true, {}, presetDefault, { showVerticalBorder: false, showHorizontalBorder: false }, - evenRow: { + oddRow: { background: '#f3f3f3' }, + evenRow: { + background: '#fff' + }, head: { - showVerticalBorder: true, - showHorizontalBorder: true + background: '#fff', + showVerticalBorder: false, + showHorizontalBorder: false } } }); @@ -11006,8 +11066,8 @@ module.exports = { grid: function(options) { var containerRule = classRule(classNameConst.CONTAINER) .bg(options.background) - .border(options.border) .text(options.text); + var contentAreaRule = classRule(classNameConst.CONTENT_AREA).border(options.border); var tableRule = classRule(classNameConst.TABLE).border(options.border); var headRule = classRule(classNameConst.HEAD_AREA).border(options.border); var borderLineRule = classRule(classNameConst.BORDER_LINE).bg(options.border); @@ -11016,6 +11076,7 @@ module.exports = { return builder.buildAll([ containerRule, + contentAreaRule, tableRule, headRule, borderLineRule, @@ -11116,6 +11177,17 @@ module.exports = { .build(); }, + /** + * Generates a css string for the cells in odd rows. + * @param {Object} options - options + * @returns {String} + */ + cellOddRow: function(options) { + return classRule(classNameConst.CELL_ROW_ODD) + .bg(options.background) + .build(); + }, + /** * Generates a css string for selected head cells. * @param {Object} options - options @@ -11204,8 +11276,10 @@ module.exports = { var View = require('../base/view'); var util = require('../common/util'); -var keyCodeMap = require('../common/constMap').keyCode; var classNameConst = require('../common/classNameConst'); +var constMap = require('../common/constMap'); +var keyCodeMap = constMap.keyCode; +var selTypeConst = constMap.selectionType; /** * Clipboard view class @@ -11247,6 +11321,7 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ */ _onBlur: function() { var focusModel = this.focusModel; + setTimeout(function() { focusModel.refreshState(); }, 0); @@ -11300,7 +11375,7 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @param {Event} keyDownEvent 이벤트 객체 * @private */ - _onKeyDown: function(keyDownEvent) { + _onKeyDown: function(keyDownEvent) { // eslint-disable-line complexity if (this.isLocked) { keyDownEvent.preventDefault(); return; @@ -11324,14 +11399,14 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @private */ _keyIn: function(keyDownEvent) { // eslint-disable-line complexity - var focusModel = this.focusModel, - selectionModel = this.selectionModel, - focused = focusModel.which(), - rowKey = focused.rowKey, - columnName = focused.columnName, - displayRowCount = this.dimensionModel.get('displayRowCount'), - isKeyIdentified = true, - keyCode = keyDownEvent.keyCode || keyDownEvent.which; + var focusModel = this.focusModel; + var selectionModel = this.selectionModel; + var focused = focusModel.which(); + var rowKey = focused.rowKey; + var columnName = focused.columnName; + var displayRowCount = this.dimensionModel.get('displayRowCount'); + var isKeyIdentified = true; + var keyCode = keyDownEvent.keyCode || keyDownEvent.which; if (util.isBlank(focused.rowKey)) { return; @@ -11399,10 +11474,10 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @private */ _getIndexBeforeMove: function() { - var focusedIndex = this.focusModel.indexOf(), - selectionRange = this.selectionModel.get('range'), - index = _.extend({}, focusedIndex), - selectionRowRange, selectionColumnRange; + var focusedIndex = this.focusModel.indexOf(); + var selectionRange = this.selectionModel.get('range'); + var index = _.extend({}, focusedIndex); + var selectionRowRange, selectionColumnRange; if (selectionRange) { selectionRowRange = selectionRange.row; @@ -11427,16 +11502,16 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @private */ _keyInWithShift: function(keyDownEvent) { // eslint-disable-line complexity - var focusModel = this.focusModel, - dimensionModel = this.dimensionModel, - columnModelList = this.columnModel.getVisibleColumnModelList(), - focused = focusModel.which(), - displayRowCount = dimensionModel.get('displayRowCount'), - keyCode = keyDownEvent.keyCode || keyDownEvent.which, - index = this._getIndexBeforeMove(), - isKeyIdentified = true, - isSelection = true, - columnModel, scrollPosition, isValid, selectionState; + var focusModel = this.focusModel; + var dimensionModel = this.dimensionModel; + var columnModelList = this.columnModel.getVisibleColumnModelList(); + var focused = focusModel.which(); + var displayRowCount = dimensionModel.get('displayRowCount'); + var keyCode = keyDownEvent.keyCode || keyDownEvent.which; + var index = this._getIndexBeforeMove(); + var isKeyIdentified = true; + var isSelection = true; + var columnModel, scrollPosition, isValid, selectionType; switch (keyCode) { case keyCodeMap.UP_ARROW: @@ -11483,10 +11558,10 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ this._updateSelectionByKeyIn(index.row, index.column); scrollPosition = dimensionModel.getScrollPosition(index.row, columnModel.columnName); if (scrollPosition) { - selectionState = this.selectionModel.getState(); - if (selectionState === 'column') { + selectionType = this.selectionModel.getType(); + if (selectionType === selTypeConst.COLUMN) { delete scrollPosition.scrollTop; - } else if (selectionState === 'row') { + } else if (selectionType === selTypeConst.ROW) { delete scrollPosition.scrollLeft; } this.renderModel.set(scrollPosition); @@ -11503,9 +11578,9 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @param {Event} keyDownEvent 이벤트 객체 * @private */ - _keyInWithCtrl: function(keyDownEvent) { - var focusModel = this.focusModel, - keyCode = keyDownEvent.keyCode || keyDownEvent.which; + _keyInWithCtrl: function(keyDownEvent) { // eslint-disable-line complexity + var focusModel = this.focusModel; + var keyCode = keyDownEvent.keyCode || keyDownEvent.which; switch (keyCode) { case keyCodeMap.CHAR_A: @@ -11521,7 +11596,7 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ focusModel.focus(focusModel.lastRowKey(), focusModel.lastColumnName(), true); break; case keyCodeMap.CHAR_V: - this._paste(); + this._pasteWhenKeyupCharV(); break; default: break; @@ -11532,7 +11607,9 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * paste date * @private */ - _paste: function() { + _pasteWhenKeyupCharV: function() { + var self = this; + // pressing v long time, clear clipboard to keep final paste date this._clearClipBoard(); if (this.pasting) { @@ -11540,20 +11617,10 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ } this.pasting = true; - this._onKeyupCharV(); - }, - - /** - * keyup event attach - * @private - */ - _onKeyupCharV: function() { - this.$el.on('keyup', $.proxy(this.onKeyupCharV, this)); - }, - - onKeyupCharV: function() { - this._pasteToGrid(); - this.pasting = false; + this.$el.on('keyup', function() { + self._pasteToGrid(); + self.pasting = false; + }); }, /** @@ -11569,10 +11636,10 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @private */ _pasteToGrid: function() { - var selectionModel = this.selectionModel, - focusModel = this.focusModel, - dataModel = this.dataModel, - startIdx, data; + var selectionModel = this.selectionModel; + var focusModel = this.focusModel; + var dataModel = this.dataModel; + var startIdx, data; if (selectionModel.hasSelection()) { startIdx = selectionModel.getStartIndex(); @@ -11591,14 +11658,15 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @returns {Array.>} result */ _getProcessClipBoardData: function() { - var text = this.$el.val(), - result = text.split('\n'), - i = 0, - len = result.length; + var text = this.$el.val(); + var result = text.split('\n'); + var i = 0; + var len = result.length; for (; i < len; i += 1) { result[i] = result[i].split('\t'); } + return result; }, @@ -11608,9 +11676,9 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @private */ _keyInWithShiftAndCtrl: function(keyDownEvent) { - var isKeyIdentified = true, - columnModelList = this.columnModel.getVisibleColumnModelList(), - keyCode = keyDownEvent.keyCode || keyDownEvent.which; + var isKeyIdentified = true; + var columnModelList = this.columnModel.getVisibleColumnModelList(); + var keyCode = keyDownEvent.keyCode || keyDownEvent.which; switch (keyCode) { case keyCodeMap.HOME: @@ -11635,13 +11703,13 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @private */ _del: function() { - var selectionModel = this.selectionModel, - dataModel = this.dataModel, - focused = this.focusModel.which(), - columnModelList = this.columnModel.getVisibleColumnModelList(), - rowKey = focused.rowKey, - columnName = focused.columnName, - range, i, j; + var selectionModel = this.selectionModel; + var dataModel = this.dataModel; + var focused = this.focusModel.which(); + var columnModelList = this.columnModel.getVisibleColumnModelList(); + var rowKey = focused.rowKey; + var columnName = focused.columnName; + var range, i, j; if (selectionModel.hasSelection()) { //다수의 cell 을 제거 할 때에는 silent 로 데이터를 변환한 후 한번에 랜더링을 refresh 한다. @@ -11654,7 +11722,9 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ dataModel.get(rowKey).validateCell(columnName); } } - this.renderModel.refresh(true); + this.renderModel.refresh({ + dataModelChanged: true + }); } else { dataModel.del(rowKey, columnName); } @@ -11678,14 +11748,16 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @private */ _getClipboardString: function() { - var text, - selectionModel = this.selectionModel, - focused = this.focusModel.which(); + var selectionModel = this.selectionModel; + var focused = this.focusModel.which(); + var text; + if (selectionModel.hasSelection()) { text = this.selectionModel.getValuesToString(); } else { text = this.dataModel.get(focused.rowKey).getValueString(focused.columnName); } + return text; }, @@ -11693,9 +11765,9 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * 현재 그리드의 data 를 clipboard 에 copy 한다. * @private */ - /* istanbul ignore next */ _copyToClipboard: function() { var text = this._getClipboardString(); + if (window.clipboardData) { window.clipboardData.setData('Text', text); } else { @@ -11767,11 +11839,11 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ var factory = this.viewFactory; this._addChildren([ - factory.createFrame('L'), - factory.createFrame('R'), + factory.createContentArea(), factory.createToolbar(), factory.createStateLayer(), factory.createEditingLayer(), + factory.createDatePickerLayer(), factory.createClipboard() ]); }, @@ -11807,9 +11879,9 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ * @private */ _onClick: function(mouseEvent) { - var eventData = new GridEvent(mouseEvent), - $target = $(mouseEvent.target), - cellInfo; + var eventData = new GridEvent(mouseEvent); + var $target = $(mouseEvent.target); + var cellInfo; this.trigger('click', eventData); if (eventData.isStopped()) { @@ -11830,8 +11902,8 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ * @private */ _onDblClick: function(mouseEvent) { - var eventData = new GridEvent(mouseEvent), - $target = $(mouseEvent.target); + var eventData = new GridEvent(mouseEvent); + var $target = $(mouseEvent.target); this.trigger('dblclick', eventData); if (eventData.isStopped()) { @@ -11863,8 +11935,8 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ * @param {MouseEvent} mouseEvent 마우스 이벤트 객체 */ _onMouseOut: function(mouseEvent) { - var $target = $(mouseEvent.target), - eventData; + var $target = $(mouseEvent.target); + var eventData; if (this._isCellElement($target)) { eventData = new GridEvent(mouseEvent); @@ -11881,6 +11953,7 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ */ _triggerCellMouseEvent: function(eventName, eventData, cell) { var cellInfo = cell; + if (cell instanceof $) { cellInfo = this._getCellInfoFromElement(cell); } @@ -11927,8 +12000,8 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ * @private */ _onMouseDown: function(mouseEvent) { - var $target = $(mouseEvent.target), - eventData = new GridEvent(mouseEvent); + var $target = $(mouseEvent.target); + var eventData = new GridEvent(mouseEvent); this.trigger('mousedown', eventData); if (eventData.isStopped()) { @@ -11954,43 +12027,17 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ * @returns {module:view/container} this object */ render: function() { - var childElements = this._renderChildren().concat([ - $('
').addClass(classNameConst.BORDER_LINE + ' ' + classNameConst.BORDER_TOP), - $('
').addClass(classNameConst.BORDER_LINE + ' ' + classNameConst.BORDER_LEFT), - $('
').addClass(classNameConst.BORDER_LINE + ' ' + classNameConst.BORDER_RIGHT) - ]); + var childElements = this._renderChildren(); this.$el.addClass(classNameConst.CONTAINER) .attr(attrNameConst.GRID_ID, this.gridId) .append(childElements); - if (!this.dimensionModel.get('scrollX')) { - this.$el.addClass(classNameConst.NO_SCROLL_X); - } - - this._appendBottomLine(); this._refreshHeight(); this.trigger('rendered'); return this; }, - /** - * Appends botton line of data - * @private - */ - _appendBottomLine: function() { - var bottomPos = this.dimensionModel.get('toolbarHeight') + this.dimensionModel.getScrollXHeight(); - var $line = $('
') - .addClass(classNameConst.BORDER_BOTTOM) - .addClass(classNameConst.BORDER_LINE) - .css('bottom', bottomPos); - - if (!this.dimensionModel.get('scrollY')) { - $line.addClass(classNameConst.NO_SCROLL_Y); - } - this.$el.append($line); - }, - /** * 소멸자 */ @@ -12007,6 +12054,201 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ module.exports = Container; },{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/gridEvent":11}],47:[function(require,module,exports){ +/** + * @fileoverview Layer View class which contains the 'tui-component-date-picker' + * @author NHN Ent. FE Development Team + */ +'use strict'; + +var View = require('../base/view'); +var classNameConst = require('../common/classNameConst'); +var DEFAULT_DATE_FORMAT = 'yyyy-mm-dd'; +var DatePickerLayer; + +/** + * Returns a HTML string of a span element to represent an arrow-icon + * @param {String} dirClassName - className to indicate direction of the arrow + * @returns {String} + */ +function arrowHTML(dirClassName) { + var classNameStr = classNameConst.ICO_ARROW + ' ' + dirClassName; + + return ''; +} + +/** + * Layer View class which contains the 'tui-component-date-picker' + * @module view/datePickerLayer + * @extends module:base/view + */ +DatePickerLayer = View.extend(/**@lends module:view/datePickerLayer.prototype */{ + /** + * @constructs + * @param {Object} options - Options + */ + initialize: function(options) { + this.textPainter = options.textPainter; + this.columnModel = options.columnModel; + this.domState = options.domState; + this.calendar = this._createCalendar(); + this.datePicker = this._createDatePicker(); + + this._customizeCalendarBtns(); + + this.listenTo(this.textPainter, 'focusIn', this._onFocusInTextInput); + this.listenTo(this.textPainter, 'focusOut', this._onFocusOutTextInput); + }, + + className: classNameConst.LAYER_DATE_PICKER, + + /** + * Creates an instance of 'tui-component-calendar' + * @returns {tui.component.Calendar} + * @private + */ + _createCalendar: function() { + var $calendarEl = $('
').addClass(classNameConst.CALENDAR); + + // prevent blur event from occuring in the input element + $calendarEl.mousedown(function(ev) { + ev.preventDefault(); + ev.target.unselectable = true; // trick for IE8 + return false; + }); + + return new tui.component.Calendar({ + element: $calendarEl, + classPrefix: classNameConst.CALENDAR + '-' + }); + }, + + /** + * Customize the buttons of the calendar. + * @private + */ + _customizeCalendarBtns: function() { + var $header = this.calendar.$header; + var leftArrowHTML = arrowHTML(classNameConst.ICO_ARROW_LEFT); + var rightArrowHTML = arrowHTML(classNameConst.ICO_ARROW_RIGHT); + + $header.find('.' + classNameConst.CALENDAR_BTN_PREV_YEAR).html(leftArrowHTML + leftArrowHTML); + $header.find('.' + classNameConst.CALENDAR_BTN_NEXT_YEAR).html(rightArrowHTML + rightArrowHTML); + $header.find('.' + classNameConst.CALENDAR_BTN_PREV_MONTH).html(leftArrowHTML); + $header.find('.' + classNameConst.CALENDAR_BTN_NEXT_MONTH).html(rightArrowHTML); + }, + + /** + * Creates an instance of 'tui-component-date-picker' + * @returns {tui.component.DatePicker} + * @private + */ + _createDatePicker: function() { + var datePicker = new tui.component.DatePicker({ + parentElement: this.$el, + enableSetDateByEnterKey: false, + selectableClassName: classNameConst.CALENDAR_SELECTABLE, + selectedClassName: classNameConst.CALENDAR_SELECTED, + pos: { + top: 0, + left: 0 + } + }, this.calendar); + + datePicker.on('update', function() { + datePicker.close(); + }); + + return datePicker; + }, + + /** + * Creates date object for now + * @returns {{year: Number, month: Number, date: Number}} + * @private + */ + _createDateForNow: function() { + var now = new Date(); + + return { + year: now.getFullYear(), + month: now.getMonth() + 1, + date: now.getDate() + }; + }, + + /** + * Resets date picker options + * @param {Object} options - datePicker options + * @param {jQuery} $input - target input element + * @private + */ + _resetDatePicker: function(options, $input) { + var datePicker = this.datePicker; + var date = options.date || this._createDateForNow(); + + datePicker.setDateForm(options.dateForm || DEFAULT_DATE_FORMAT); + datePicker.setRanges(options.selectableRanges || []); + datePicker.setDate(date.year, date.month, date.date); + datePicker.setElement($input); + }, + + /** + * Calculates the position of the layer and returns the object that contains css properties. + * @param {jQuery} $input - input element + * @returns {Object} + * @private + */ + _calculatePosition: function($input) { + var inputOffset = $input.offset(); + var inputHeight = $input.outerHeight(); + var wrapperOffset = this.domState.getOffset(); + + return { + top: inputOffset.top - wrapperOffset.top + inputHeight, + left: inputOffset.left - wrapperOffset.left + }; + }, + + /** + * Event handler for 'focusIn' event of module:painter/input/text + * @param {jQuery} $input - target input element + * @param {{rowKey: String, columnName: String}} address - target cell address + * @private + */ + _onFocusInTextInput: function($input, address) { + var columnName = address.columnName; + var component = this.columnModel.getColumnModel(columnName).component; + var editType = this.columnModel.getEditType(columnName); + + if (editType === 'text' && component && component.name === 'datePicker') { + this.$el.css(this._calculatePosition($input)).show(); + this._resetDatePicker(component.option || {}, $input); + this.datePicker.open(); + } + }, + + /** + * Event handler for 'focusOut' event of module:painter/input/text + * @private + */ + _onFocusOutTextInput: function() { + this.datePicker.close(); + this.$el.hide(); + }, + + /** + * Render + * @returns {Object} this object + */ + render: function() { + this.$el.hide(); + return this; + } +}); + +module.exports = DatePickerLayer; + +},{"../base/view":7,"../common/classNameConst":8}],48:[function(require,module,exports){ /** * @fileoverview Layer class that represents the state of rendering phase * @author NHN Ent. FE Development Team @@ -12168,7 +12410,7 @@ var EditingLayer = View.extend(/**@lends module:view/editingLayer.prototype */{ module.exports = EditingLayer; -},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],48:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],49:[function(require,module,exports){ /** * @fileoverview View factory * @author NHN Ent. FE Development Team @@ -12176,6 +12418,7 @@ module.exports = EditingLayer; 'use strict'; var ContainerView = require('./container'); +var ContentAreaView = require('./layout/content-area'); var ToolbarView = require('./layout/toolbar'); var ToolbarControlPanelView = require('./layout/toolbar/controlPanel'); var ToolbarPaginationView = require('./layout/toolbar/pagination'); @@ -12191,6 +12434,7 @@ var BodyTableView = require('./layout/bodyTable'); var RowListView = require('./rowList'); var SelectionLayerView = require('./selectionLayer'); var EditingLayerView = require('./editingLayer'); +var DatePickeLayerView = require('./datePickerLayer'); var FocusLayerView = require('./focusLayer'); /** @@ -12207,7 +12451,7 @@ var ViewFactory = tui.util.defineClass({ /** * Creates container view and returns it. * @param {Object} options - Options set by user - * @returns {module:view/container} - New container view instance + * @returns {module:view/container} */ createContainer: function(options) { return new ContainerView({ @@ -12221,6 +12465,17 @@ var ViewFactory = tui.util.defineClass({ }); }, + /** + * Creates a view instance for the contents area. + * @returns {module:view/layout/content-area} + */ + createContentArea: function() { + return new ContentAreaView({ + dimensionModel: this.modelManager.dimensionModel, + viewFactory: this + }); + }, + /** * Creates toolbar view and returns it. * @returns {module:view/toolbar} - New toolbar view instance @@ -12420,6 +12675,24 @@ var ViewFactory = tui.util.defineClass({ }); }, + /** + * Creates an instance of date-picker layer view. + * @returns {module:view/datePickerLayer} + */ + createDatePickerLayer: function() { + if (!tui.component || + !tui.component.DatePicker || + !tui.component.Calendar) { + return null; + } + + return new DatePickeLayerView({ + columnModel: this.modelManager.columnModel, + textPainter: this.painterManager.getInputPainters().text, + domState: this.domState + }); + }, + /** * Creates focus layer view and returns it. * @param {String} whichSide - 'L'(left) or 'R'(right) @@ -12437,7 +12710,7 @@ var ViewFactory = tui.util.defineClass({ module.exports = ViewFactory; -},{"./clipboard":45,"./container":46,"./editingLayer":47,"./focusLayer":49,"./layout/body":50,"./layout/bodyTable":51,"./layout/frame-lside":52,"./layout/frame-rside":53,"./layout/header":55,"./layout/resizeHandler":56,"./layout/toolbar":57,"./layout/toolbar/controlPanel":58,"./layout/toolbar/pagination":59,"./layout/toolbar/resizeHandler":60,"./rowList":61,"./selectionLayer":62,"./stateLayer":63}],49:[function(require,module,exports){ +},{"./clipboard":45,"./container":46,"./datePickerLayer":47,"./editingLayer":48,"./focusLayer":50,"./layout/body":51,"./layout/bodyTable":52,"./layout/content-area":53,"./layout/frame-lside":54,"./layout/frame-rside":55,"./layout/header":57,"./layout/resizeHandler":58,"./layout/toolbar":59,"./layout/toolbar/controlPanel":60,"./layout/toolbar/pagination":61,"./layout/toolbar/resizeHandler":62,"./rowList":63,"./selectionLayer":64,"./stateLayer":65}],50:[function(require,module,exports){ /** * @fileoverview Class for the layer view that represents the currently focused cell * @author NHN Ent. FE Development Team @@ -12582,7 +12855,7 @@ var FocusLayer = View.extend(/**@lends module:view/focusLayer.prototype */{ module.exports = FocusLayer; -},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],50:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],51:[function(require,module,exports){ /** * @fileoverview Class for the body layout * @author NHN Ent. FE Development Team @@ -12591,8 +12864,10 @@ module.exports = FocusLayer; var View = require('../../base/view'); var util = require('../../common/util'); -var attrNameConst = require('../../common/constMap').attrName; +var constMap = require('../../common/constMap'); var classNameConst = require('../../common/classNameConst'); +var attrNameConst = constMap.attrName; +var selTypeMap = constMap.selectionType; // Minimum time (ms) to detect if an alert or confirm dialog has been displayed. var MIN_INTERVAL_FOR_PAUSED = 200; @@ -12771,7 +13046,7 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ } if (!util.isMetaColumn(columnName)) { - selectionModel.setState('cell'); + selectionModel.setType(selTypeMap.CELL); if (inputData.shiftKey && !isInput) { selectionModel.update(rowIndex, columnIndex); } else { @@ -12798,7 +13073,7 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ */ _updateSelectionByRow: function(rowIndex, shiftKey) { if (shiftKey) { - this.selectionModel.update(rowIndex, 0, 'row'); + this.selectionModel.update(rowIndex, 0, selTypeMap.ROW); } else { this.selectionModel.selectRow(rowIndex); } @@ -12923,7 +13198,7 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ module.exports = Body; -},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],51:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],52:[function(require,module,exports){ /** * @fileoverview Class for the table layout in the body(data) area * @author NHN Ent. FE Development Team @@ -13118,7 +13393,91 @@ var BodyTable = View.extend(/**@lends module:view/layout/bodyTable.prototype */{ module.exports = BodyTable; -},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],52:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],53:[function(require,module,exports){ +/** + * @fileoverview Class for the content area + * @author NHN Ent. FE Development Team + */ +'use strict'; + +var View = require('../../base/view'); +var classNameConst = require('../../common/classNameConst'); +var ContentArea; + +/** + * Create DIV element to draw border + * @param {String} className - border class name + * @returns {jQuery} + */ +function borderDIV(className) { + return $('
') + .addClass(classNameConst.BORDER_LINE) + .addClass(className); +} + +/** + * Content area + * @module view/layout/content-area + * @extends module:base/view + */ +ContentArea = View.extend(/**@lends module:view/layout/content-area.prototype */{ + /** + * @constructs + * @param {Object} options - Options + */ + initialize: function(options) { + View.prototype.initialize.call(this); + + this.viewFactory = options.viewFactory; + this.dimensionModel = options.dimensionModel; + this._addFrameViews(); + }, + + className: classNameConst.CONTENT_AREA, + + /** + * Creates Frame views and add them as children. + * @private + */ + _addFrameViews: function() { + var factory = this.viewFactory; + + this._addChildren([ + factory.createFrame('L'), + factory.createFrame('R') + ]); + }, + + /** + * Renders + * @returns {Object} this object + */ + render: function() { + var dimensionModel = this.dimensionModel; + var scrollXHeight = dimensionModel.getScrollXHeight(); + var childElements = this._renderChildren().concat([ + borderDIV(classNameConst.BORDER_TOP), + borderDIV(classNameConst.BORDER_LEFT), + borderDIV(classNameConst.BORDER_RIGHT), + borderDIV(classNameConst.BORDER_BOTTOM).css('bottom', scrollXHeight) + ]); + + if (!dimensionModel.get('scrollX')) { + this.$el.addClass(classNameConst.NO_SCROLL_X); + } + if (!dimensionModel.get('scrollY')) { + this.$el.addClass(classNameConst.NO_SCROLL_Y); + } + + this.$el.append(childElements); + + return this; + } +}); + +module.exports = ContentArea; + +},{"../../base/view":7,"../../common/classNameConst":8}],54:[function(require,module,exports){ /** * @fileoverview Left Side Frame * @author NHN Ent. FE Development Team @@ -13173,23 +13532,17 @@ var LsideFrame = Frame.extend(/**@lends module:view/layout/frame-lside.prototype * @override */ afterRender: function() { - var dimensionModel = this.dimensionModel, - $scrollOverlay; // overlay DIV to hide scrollbar UI - - if (!dimensionModel.get('scrollX')) { + if (!this.dimensionModel.get('scrollX')) { return; } - $scrollOverlay = $('
') - .addClass(classNameConst.SCROLLBAR_LEFT_BOTTOM) - .css('bottom', dimensionModel.get('toolbarHeight')); - this.$el.append($scrollOverlay); + this.$el.append($('
').addClass(classNameConst.SCROLLBAR_LEFT_BOTTOM)); } }); module.exports = LsideFrame; -},{"../../common/classNameConst":8,"./frame":54}],53:[function(require,module,exports){ +},{"../../common/classNameConst":8,"./frame":56}],55:[function(require,module,exports){ /** * @fileoverview Right Side Frame * @author NHN Ent. FE Development Team @@ -13306,9 +13659,7 @@ var RsideFrame = Frame.extend(/**@lends module:view/layout/frame-rside.prototype // (For resolving the issue that styling scrollbar-corner with '-webkit-scrollbar-corner' // casues to be stuck in the same position in Chrome) if (dimensionModel.get('scrollX')) { - $scrollCorner = $('
') - .addClass(classNameConst.SCROLLBAR_RIGHT_BOTTOM) - .css('bottom', dimensionModel.get('toolbarHeight')); + $scrollCorner = $('
').addClass(classNameConst.SCROLLBAR_RIGHT_BOTTOM); this.$el.append($scrollCorner); } @@ -13319,7 +13670,7 @@ var RsideFrame = Frame.extend(/**@lends module:view/layout/frame-rside.prototype module.exports = RsideFrame; -},{"../../common/classNameConst":8,"../../common/constMap":9,"./frame":54}],54:[function(require,module,exports){ +},{"../../common/classNameConst":8,"../../common/constMap":9,"./frame":56}],56:[function(require,module,exports){ /** * @fileoverview Frame Base * @author NHN Ent. FE Development Team @@ -13396,7 +13747,7 @@ var Frame = View.extend(/**@lends module:view/layout/frame.prototype */{ module.exports = Frame; -},{"../../base/view":7}],55:[function(require,module,exports){ +},{"../../base/view":7}],57:[function(require,module,exports){ /** * @fileoverview Header 관련 * @author NHN Ent. FE Development Team @@ -13409,6 +13760,7 @@ var constMap = require('../../common/constMap'); var classNameConst = require('../../common/classNameConst'); var DELAY_SYNC_CHECK = 10; +var SEL_TYPE_COLUMN = constMap.selectionType.COLUMN; var ATTR_COLUMN_NAME = constMap.attrName.COLUMN_NAME; var CELL_BORDER_WIDTH = constMap.dimension.CELL_BORDER_WIDTH; var TABLE_BORDER_WIDTH = constMap.dimension.TABLE_BORDER_WIDTH; @@ -13625,10 +13977,10 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ * @private */ _startColumnSelectionWithShiftKey: function(columnIndexes, pageX, pageY) { - var selectionModel = this.selectionModel, - max = Math.max.apply(null, columnIndexes); + var selectionModel = this.selectionModel; + var max = Math.max.apply(null, columnIndexes); - selectionModel.update(0, max, 'column'); + selectionModel.update(0, max, SEL_TYPE_COLUMN); selectionModel.extendColumnSelection(columnIndexes, pageX, pageY); }, @@ -13998,7 +14350,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ module.exports = Header; -},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],56:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],58:[function(require,module,exports){ /** * @fileoverview ResizeHandler for the Header * @author NHN Ent. FE Development Team @@ -14273,7 +14625,7 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto module.exports = ResizeHandler; -},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9}],57:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9}],59:[function(require,module,exports){ /** * @fileoverview 툴바영역 클래스 * @author NHN Ent. FE Development Team @@ -14344,7 +14696,7 @@ var Toolbar = View.extend(/**@lends module:view/layout/toolbar.prototype */{ module.exports = Toolbar; -},{"../../base/view":7,"../../common/classNameConst":8}],58:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8}],60:[function(require,module,exports){ /** * @fileoverview Class for the control panel in the toolbar * @author NHN Ent. FE Development Team @@ -14440,7 +14792,7 @@ var ControlPanel = View.extend(/**@lends module:view/layout/toolbar/controlPanel module.exports = ControlPanel; -},{"../../../base/view":7,"../../../common/classNameConst":8}],59:[function(require,module,exports){ +},{"../../../base/view":7,"../../../common/classNameConst":8}],61:[function(require,module,exports){ /** * @fileoverview Class for the pagination in the toolbar * @author NHN Ent. FE Development Team @@ -14517,7 +14869,7 @@ var Pagination = View.extend(/**@lends module:view/layout/toolbar/pagination.pro module.exports = Pagination; -},{"../../../base/view":7,"../../../common/classNameConst":8}],60:[function(require,module,exports){ +},{"../../../base/view":7,"../../../common/classNameConst":8}],62:[function(require,module,exports){ /** * @fileoverview Class for the resize handler of the toolbar * @author NHN Ent. FE Development Team @@ -14650,7 +15002,7 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/toolbar/resizeHandl module.exports = ResizeHandler; -},{"../../../base/view":7,"../../../common/classNameConst":8}],61:[function(require,module,exports){ +},{"../../../base/view":7,"../../../common/classNameConst":8}],63:[function(require,module,exports){ /** * @fileoverview RowList View * @author NHN Ent. FE Development Team @@ -14885,16 +15237,16 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ /** * Renders. - * @param {boolean} isModelChanged - 모델이 변경된 경우(add, remove..) true, 아니면(스크롤 변경 등) false + * @param {boolean} dataModelChanged - 모델이 변경된 경우(add, remove..) true, 아니면(스크롤 변경 등) false * @returns {View.RowList} this 객체 */ - render: function(isModelChanged) { + render: function(dataModelChanged) { var rowKeys = this.collection.pluck('rowKey'), dupRowKeys; this.bodyTableView.resetTablePosition(); - if (isModelChanged) { + if (dataModelChanged) { this._resetRows(); } else { dupRowKeys = _.intersection(rowKeys, this.renderedRowKeys); @@ -14946,7 +15298,7 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ module.exports = RowList; -},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],62:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],64:[function(require,module,exports){ /** * @fileoverview Class for the selection layer * @author NHN Ent. FE Development Team @@ -15108,7 +15460,7 @@ var SelectionLayer = View.extend(/**@lends module:view/selectionLayer.prototype module.exports = SelectionLayer; -},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],63:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],65:[function(require,module,exports){ /** * @fileoverview Layer class that represents the state of rendering phase * @author NHN Ent. FE Development Team diff --git a/dist/grid.min.css b/dist/grid.min.css index c4b6fa238..50ba5f5eb 100644 --- a/dist/grid.min.css +++ b/dist/grid.min.css @@ -1,8 +1,8 @@ /** * @fileoverview tui-grid * @author NHN Ent. FE Development Team - * @version 1.2.1 + * @version 1.3.0 * @license MIT * @link https://github.com/nhnent/tui.grid */ -.tui-grid-btn-sorting,.tui-grid-cell img{vertical-align:middle}.tui-grid-container{width:100%;position:relative;border-style:solid;border-width:0 0 1px;clear:both;font-size:12px;font-family:'돋움',Dotum,Helvetica,'Apple SD Gothic Neo',Sans-serif}.tui-grid-container.tui-grid-no-scroll-x{border-bottom-width:0}.tui-grid-container ::-webkit-scrollbar{-webkit-appearance:none;width:17px;height:17px}.tui-grid-container ::-webkit-scrollbar-thumb{border:5px solid transparent;border-radius:7px;background-clip:content-box}.tui-grid-container *{box-sizing:content-box}.tui-grid-cell-content select,.tui-grid-table{box-sizing:border-box;width:100%}.tui-grid-container input,.tui-grid-container p{margin:0;padding:0}.tui-grid-container fieldset{margin:0;padding:0;border:0;display:inline;white-space:nowrap}.tui-grid-container input[type=password],.tui-grid-container input[type=text]{outline:0;box-sizing:border-box;line-height:normal}.tui-grid-container li,.tui-grid-container ul{list-style:none;padding:0;margin:0}.tui-grid-container em,.tui-grid-container strong{font-style:normal}.tui-grid-clipboard{position:fixed;top:0;left:-9999px;width:100px;height:100px}.tui-grid-btn-text{display:inline-block;text-decoration:none}.tui-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}.tui-grid-btn-text em{position:absolute;left:0;top:5px;width:17px;height:12px;background:url(../images/icons.gif) no-repeat}.tui-grid-btn-text em.tui-grid-btn-excel-icon{background-position:-30px -60px}.tui-grid-btn-sorting{display:inline-block;overflow:hidden;margin-left:6px;height:15px;width:8px;background:url(../images/icons.gif) -20px -60px no-repeat;cursor:pointer}.tui-grid-btn-sorting-down{background-position:0 -60px}.tui-grid-btn-sorting-up{background-position:-10px -60px}.tui-grid-layer-state{position:absolute;top:0;left:0;width:100%;border-bottom:solid 1px #ccc;background:#fff;font-weight:700;text-align:center;z-index:12}.tui-grid-layer-state-content{padding-top:50px}.tui-grid-layer-state-loading{display:block;margin:10px auto 0;background:url(../images/ani_loading.gif);border:0;width:150px;height:13px}.tui-grid-cell,.tui-grid-layer-editing,.tui-grid-layer-selection,.tui-grid-table{border-width:1px;border-style:solid}.tui-grid-layer-editing{position:absolute;display:none;background:#fff;z-index:15;padding:0 10px;white-space:nowrap}.tui-grid-layer-focus-border{position:absolute;overflow:hidden;z-index:14}.tui-grid-layer-selection{position:absolute;display:none;top:0;width:0;height:0;opacity:.2;filter:alpha(opacity=10)}.tui-grid-table{table-layout:fixed;border-collapse:collapse;margin:0}.tui-grid-cell{overflow:hidden;white-space:nowrap;padding:0 10px}.tui-grid-cell-head{padding:0;text-align:center}.tui-grid-cell-ellipsis{-o-text-overflow:ellipsis;-moz-binding:url(ellipsis.xml#ellipsis);text-overflow:ellipsis}.tui-grid-cell-content .tui-grid-content-before{float:left;margin-right:2px;line-height:1.5}.tui-grid-cell-content .tui-grid-content-after{float:right;margin-left:2px;line-height:1.5}.tui-grid-cell-content .tui-grid-content-input{display:block;overflow:hidden;line-height:1.5}.tui-grid-cell-content input[type=password],.tui-grid-cell-content input[type=text]{width:100%;padding:2px 0;border:1px solid #e2e3ea;border-top:solid 1px #abadb3;border-bottom:solid 1px #e3e9ef}.tui-grid-cell-content label+input{margin-left:10px}.tui-grid-column-resize-container{display:none;position:relative;width:0}.tui-grid-column-resize-handle{float:left;position:absolute;top:-1px;left:-99px;width:7px;height:100%;background:#000;opacity:0;filter:alpha(opacity=0);cursor:col-resize}.tui-grid-column-resize-handle-last{width:3px}.tui-grid-border-line{position:absolute;z-index:13}.tui-grid-border-line-top{top:0;left:0;right:0;height:1px}.tui-grid-border-line-left{top:0;bottom:0;left:0;width:1px}.tui-grid-border-line-right{top:0;bottom:0;right:0;width:1px}.tui-grid-border-line-bottom{bottom:0;left:0;right:17px;height:1px}.tui-grid-border-line-bottom.tui-grid-no-scroll-y{right:0}.tui-grid-head-area{border-style:solid;border-width:0 0 1px}.tui-grid-lside-area{display:none;height:100%;position:absolute;top:0;left:0;overflow:hidden;z-index:10}.tui-grid-lside-area .tui-grid-head-area{overflow:hidden}.tui-grid-lside-area .tui-grid-body-area{position:relative;overflow:scroll;margin-right:-17px}.tui-grid-lside-area .tui-grid-body-area .tui-grid-selection-layer{left:1px}.tui-grid-rside-area{display:none;height:100%;overflow:hidden}.tui-grid-rside-area .tui-grid-head-area{position:relative;margin-right:17px;overflow:hidden}.tui-grid-rside-area .tui-grid-head-area.tui-grid-no-scroll-y{margin-right:0}.tui-grid-rside-area .tui-grid-body-area{position:relative;overflow:scroll}.tui-grid-body-container{position:relative;margin-top:-1px}.tui-grid-table-container{position:absolute}.tui-grid-scrollbar-head{display:block;position:absolute;top:0;right:0;width:16px;border-style:solid;border-width:1px}.tui-grid-scrollbar-left-bottom{position:absolute;bottom:0;left:0;right:0;height:17px}.tui-grid-scrollbar-right-bottom{position:absolute;bottom:0;right:0;width:17px;height:17px}.tui-grid-scrollbar-border{display:block;position:absolute;right:17px;width:1px}.tui-grid-toolbar{display:none;width:100%;height:65px;bottom:0;position:absolute;border-style:solid;border-width:1px 0 0;z-index:11}.tui-grid-toolbar-btn-holder{position:absolute;right:10px;top:14px}.tui-grid-height-resize-bar{overflow:hidden;cursor:row-resize;position:absolute;bottom:0;height:15px;width:100%;border:0;font-size:0;text-align:center}.tui-grid-height-resize-bar span{background:url(../images/icons.gif) -70px -60px no-repeat;display:inline-block;width:17px;height:6px;margin-top:5px}.tui-grid-height-resize-handle{display:block;margin:0 10px;border-style:solid;border-width:1px 0 0;cursor:row-resize}.tui-grid-pagination{height:12px;margin-bottom:12px;padding-top:14px;line-height:normal;text-align:center}.tui-grid-pagination a,.tui-grid-pagination span,.tui-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}.tui-grid-pagination strong{padding:4px 6px;color:#ff1313;border:1px solid #d4d4d4;background:#e7e7e7}.tui-grid-pagination .tui-grid-next,.tui-grid-pagination .tui-grid-next-end,.tui-grid-pagination .tui-grid-next-end-off,.tui-grid-pagination .tui-grid-next-off,.tui-grid-pagination .tui-grid-pre,.tui-grid-pagination .tui-grid-pre-end,.tui-grid-pagination .tui-grid-pre-end-off,.tui-grid-pagination .tui-grid-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}.tui-grid-pagination .tui-grid-next-end,.tui-grid-pagination .tui-grid-next-end-off,.tui-grid-pagination .tui-grid-pre-end,.tui-grid-pagination .tui-grid-pre-end-off{width:24px}.tui-grid-pagination .tui-grid-pre,.tui-grid-pagination .tui-grid-pre-off{margin-right:12px}.tui-grid-pagination .tui-grid-next,.tui-grid-pagination .tui-grid-next-off{margin-left:12px}.tui-grid-pagination .tui-grid-pre-end{background-position:0 0}.tui-grid-pagination .tui-grid-pre-end-off{background-position:0 -30px}.tui-grid-pagination .tui-grid-pre{background-position:-24px 0}.tui-grid-pagination .tui-grid-pre-off{background-position:-24px -30px}.tui-grid-pagination .tui-grid-next{background-position:-50px 0}.tui-grid-pagination .tui-grid-next-off{background-position:-50px -30px}.tui-grid-pagination .tui-grid-next-end{background-position:-75px 0}.tui-grid-pagination .tui-grid-next-end-off{background-position:-75px -30px} \ No newline at end of file +.tui-grid-btn-sorting,.tui-grid-cell img{vertical-align:middle}.tui-grid-container{width:100%;position:relative;border-width:0;clear:both;font-size:12px;font-family:'돋움',Dotum,Helvetica,'Apple SD Gothic Neo',Sans-serif}.tui-grid-container ::-webkit-scrollbar{-webkit-appearance:none;width:17px;height:17px}.tui-grid-container ::-webkit-scrollbar-thumb{border:5px solid transparent;border-radius:7px;background-clip:content-box}.tui-grid-container *{box-sizing:content-box}.tui-grid-cell-content select,.tui-grid-table{box-sizing:border-box;width:100%}.tui-grid-container input,.tui-grid-container p{margin:0;padding:0}.tui-grid-container fieldset{margin:0;padding:0;border:0;display:inline;white-space:nowrap}.tui-grid-icon-arrow-left,.tui-grid-icon-arrow-right{border-top-color:transparent;border-bottom-color:transparent}.tui-grid-container input[type=password],.tui-grid-container input[type=text]{outline:0;box-sizing:border-box;line-height:normal}.tui-grid-container li,.tui-grid-container ul{list-style:none;padding:0;margin:0}.tui-grid-container em,.tui-grid-container strong{font-style:normal}.tui-grid-clipboard{position:fixed;top:0;left:-9999px;width:100px;height:100px}.tui-grid-btn-text{display:inline-block;text-decoration:none}.tui-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}.tui-grid-btn-text em{position:absolute;left:0;top:5px;width:17px;height:12px;background:url(../images/icons.gif) no-repeat}.tui-grid-btn-text em.tui-grid-btn-excel-icon{background-position:-30px -60px}.tui-grid-btn-sorting{display:inline-block;overflow:hidden;margin-left:6px;height:15px;width:8px;background:url(../images/icons.gif) -20px -60px no-repeat;cursor:pointer}.tui-grid-btn-sorting-down{background-position:0 -60px}.tui-grid-btn-sorting-up{background-position:-10px -60px}.tui-grid-icon-arrow{display:inline-block;width:0;height:0;border-style:solid;border-width:4px;border-color:#a0a0a0}.tui-grid-icon-arrow-left{border-left-width:0}.tui-grid-icon-arrow-right{border-right-width:0}.tui-grid-layer-state{position:absolute;top:0;left:0;width:100%;border-bottom:solid 1px #ccc;background:#fff;font-weight:700;text-align:center;z-index:12}.tui-grid-layer-state-content{padding-top:50px}.tui-grid-layer-state-loading{display:block;margin:10px auto 0;background:url(../images/ani_loading.gif);border:0;width:150px;height:13px}.tui-grid-cell,.tui-grid-layer-editing,.tui-grid-layer-selection,.tui-grid-table{border-width:1px;border-style:solid}.tui-grid-layer-editing{position:absolute;display:none;background:#fff;z-index:15;padding:0 10px;white-space:nowrap}.tui-grid-layer-focus-border{position:absolute;overflow:hidden;z-index:14}.tui-grid-layer-selection{position:absolute;display:none;top:0;width:0;height:0;opacity:.2;filter:alpha(opacity=20)}.tui-grid-layer-datepicker{position:absolute}.tui-grid-table{table-layout:fixed;border-collapse:collapse;margin:0}.tui-grid-lside-area .tui-grid-table{border-right-width:0}.tui-grid-cell{overflow:hidden;white-space:nowrap;padding:0 10px}.tui-grid-cell-head{padding:0;text-align:center}.tui-grid-cell-ellipsis{text-overflow:ellipsis}.tui-grid-cell-content .tui-grid-content-before{float:left;margin-right:2px;line-height:1.5}.tui-grid-cell-content .tui-grid-content-after{float:right;margin-left:2px;line-height:1.5}.tui-grid-cell-content .tui-grid-content-input{display:block;overflow:hidden;line-height:1.5}.tui-grid-cell-content input[type=password],.tui-grid-cell-content input[type=text]{width:100%;padding:2px 0;border:1px solid #e2e3ea;border-top:solid 1px #abadb3;border-bottom:solid 1px #e3e9ef}.tui-grid-cell-content label+input{margin-left:10px}.tui-grid-column-resize-container{display:none;position:relative;width:0}.tui-grid-column-resize-handle{float:left;position:absolute;top:-1px;left:-99px;width:7px;height:100%;background:#000;opacity:0;filter:alpha(opacity=0);cursor:col-resize}.tui-grid-column-resize-handle-last{width:3px}.tui-grid-border-line{position:absolute;z-index:13}.tui-grid-border-line-top{top:0;left:0;right:0;height:1px}.tui-grid-border-line-left{top:0;bottom:0;left:0;width:1px}.tui-grid-border-line-right{top:0;bottom:0;right:0;width:1px}.tui-grid-border-line-bottom{bottom:0;left:0;right:17px;height:1px}.tui-grid-no-scroll-x .tui-grid-border-line-bottom,.tui-grid-no-scroll-y .tui-grid-border-line-bottom{right:0}.tui-grid-content-area{position:relative;border-style:solid;border-width:0 0 1px}.tui-grid-content-area.tui-grid-no-scroll-x{border-bottom-width:0}.tui-grid-head-area{border-style:solid;border-width:0 0 1px}.tui-grid-head-area .tui-grid-cell-head{border-top-width:1px;border-bottom-width:1px}.tui-grid-lside-area{display:none;position:absolute;top:0;left:0;overflow:hidden;z-index:10}.tui-grid-lside-area .tui-grid-head-area{overflow:hidden}.tui-grid-lside-area .tui-grid-body-area{position:relative;overflow:scroll;margin-right:-17px}.tui-grid-lside-area .tui-grid-body-area .tui-grid-selection-layer{left:1px}.tui-grid-rside-area{display:none;overflow:hidden}.tui-grid-rside-area .tui-grid-head-area{position:relative;padding-right:17px;overflow:hidden}.tui-grid-rside-area .tui-grid-head-area.tui-grid-no-scroll-y{padding-right:0}.tui-grid-rside-area .tui-grid-body-area{position:relative;overflow:scroll}.tui-grid-body-container{position:relative;margin-top:-1px}.tui-grid-table-container{position:absolute}.tui-grid-scrollbar-head{display:block;position:absolute;top:0;right:0;width:16px;border-style:solid;border-width:1px}.tui-grid-scrollbar-left-bottom{position:absolute;bottom:0;left:0;right:0;height:17px}.tui-grid-scrollbar-right-bottom{position:absolute;bottom:0;right:0;width:17px;height:17px}.tui-grid-scrollbar-border{display:block;position:absolute;right:17px;width:1px}.tui-grid-toolbar{display:none;left:0;right:0;height:65px;bottom:0;position:absolute;border-style:solid;border-width:0 1px 1px;z-index:11}.tui-grid-toolbar-btn-holder{position:absolute;right:10px;top:14px}.tui-grid-height-resize-bar{overflow:hidden;cursor:row-resize;position:absolute;bottom:0;height:15px;width:100%;border:0;font-size:0;text-align:center}.tui-grid-height-resize-bar span{background:url(../images/icons.gif) -70px -60px no-repeat;display:inline-block;width:17px;height:6px;margin-top:5px}.tui-grid-height-resize-handle{display:block;margin:0 10px;border-style:solid;border-width:1px 0 0;cursor:row-resize}.tui-grid-pagination{height:12px;margin-bottom:12px;padding-top:14px;line-height:normal;text-align:center}.tui-grid-pagination a,.tui-grid-pagination span,.tui-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}.tui-grid-pagination strong{padding:4px 6px;color:#ff1313;border:1px solid #d4d4d4;background:#e7e7e7}.tui-grid-pagination .tui-grid-next,.tui-grid-pagination .tui-grid-next-end,.tui-grid-pagination .tui-grid-next-end-off,.tui-grid-pagination .tui-grid-next-off,.tui-grid-pagination .tui-grid-pre,.tui-grid-pagination .tui-grid-pre-end,.tui-grid-pagination .tui-grid-pre-end-off,.tui-grid-pagination .tui-grid-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}.tui-grid-pagination .tui-grid-next-end,.tui-grid-pagination .tui-grid-next-end-off,.tui-grid-pagination .tui-grid-pre-end,.tui-grid-pagination .tui-grid-pre-end-off{width:24px}.tui-grid-pagination .tui-grid-pre,.tui-grid-pagination .tui-grid-pre-off{margin-right:12px}.tui-grid-pagination .tui-grid-next,.tui-grid-pagination .tui-grid-next-off{margin-left:12px}.tui-grid-pagination .tui-grid-pre-end{background-position:0 0}.tui-grid-pagination .tui-grid-pre-end-off{background-position:0 -30px}.tui-grid-pagination .tui-grid-pre{background-position:-24px 0}.tui-grid-pagination .tui-grid-pre-off{background-position:-24px -30px}.tui-grid-pagination .tui-grid-next{background-position:-50px 0}.tui-grid-pagination .tui-grid-next-off{background-position:-50px -30px}.tui-grid-pagination .tui-grid-next-end{background-position:-75px 0}.tui-grid-pagination .tui-grid-next-end-off{background-position:-75px -30px}.tui-grid-calendar-btn-next-month,.tui-grid-calendar-btn-next-year,.tui-grid-calendar-btn-prev-month,.tui-grid-calendar-btn-prev-year{position:absolute;top:4px;padding:3px 6px 2px;border:1px solid transparent}.tui-grid-calendar-btn-next-month:hover,.tui-grid-calendar-btn-next-year:hover,.tui-grid-calendar-btn-prev-month:hover,.tui-grid-calendar-btn-prev-year:hover{border-color:#ccc}.tui-grid-calendar{position:absolute;width:190px;background:#fff;border:1px solid #ccc;font-size:11px;color:#444;font-family:arial}.tui-grid-calendar table{margin:0 auto;table-layout:fixed;text-align:center}.tui-grid-calendar table tr{height:20px}.tui-grid-calendar table th{width:20px}.tui-grid-calendar table th.tui-grid-calendar-sat{color:#00f}.tui-grid-calendar table th.tui-grid-calendar-sun{color:#e82828}.tui-grid-calendar table td{background:#eee;color:#ccc}.tui-grid-calendar table td.tui-grid-calendar-selectable{cursor:pointer;background:#fff;color:#444}.tui-grid-calendar table td.tui-grid-calendar-selectable.tui-grid-calendar-selected{background:#c3ebff;font-weight:700}.tui-grid-calendar table td.tui-grid-calendar-selectable.tui-grid-calendar-sat{color:#00f}.tui-grid-calendar table td.tui-grid-calendar-selectable.tui-grid-calendar-sun{color:#e82828}.tui-grid-calendar table td.tui-grid-calendar-selectable:hover{background:#c3ebff}.tui-grid-calendar-header{padding:6px 0 5px;text-align:center;border-bottom:1px solid #ddd}.tui-grid-calendar-title{font-size:14px}.tui-grid-calendar-body{padding:5px 7px}.tui-grid-calendar-btn-prev-year{left:18px}.tui-grid-calendar-btn-prev-month{left:42px}.tui-grid-calendar-btn-next-month{right:42px}.tui-grid-calendar-btn-next-year{right:20px}.tui-grid-calendar-today{text-decoration:underline}.tui-grid-calendar-next-month,.tui-grid-calendar-prev-month{opacity:.4;filter:alpha(opacity=40)}.tui-grid-calendar-footer{display:none} \ No newline at end of file diff --git a/dist/grid.min.js b/dist/grid.min.js index e6af61c85..ae7d8f502 100644 --- a/dist/grid.min.js +++ b/dist/grid.min.js @@ -1,12 +1,12 @@ /** * @fileoverview tui-grid * @author NHN Ent. FE Development Team - * @version 1.2.1 + * @version 1.3.0 * @license MIT * @link https://github.com/nhnent/tui.grid */ -!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=new l(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=new l({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=new l({httpStatus:n,requestType:e.requestType,requestParameter:e.data,responseData:null});this.renderModel.set("state",r.DONE),this.trigger("response",o),o.isStopped()||(this.trigger("errorResponse",o),o.isStopped()||i.readyState>1&&alert("데이터 요청 중에 에러가 발생하였습니다.\n\n다시 시도하여 주시기 바랍니다."))}});e.exports=d},{"../base/view":7,"../common/constMap":9,"../common/formUtil":10,"../common/gridEvent":11,"../common/util":12,"./net-router":1}],3:[function(t,e,i){"use strict";var n=t("./common"),o=Backbone.Collection.extend({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({});_.assign(o.prototype,n),e.exports=o},{"./common":4}],6:[function(t,e,i){"use strict";var n=t("../common/constMap").attrName,o=tui.util.defineClass({init:function(t){this.controller=t.controller},events:{},selector:"",_getCellAddress:function(t){var e=t.closest("["+n.ROW_KEY+"]");return{rowKey:e.attr(n.ROW_KEY),columnName:e.attr(n.COLUMN_NAME)}},attachEventHandlers:function(t,e){_.each(this.events,function(i,n){var o=_.bind(this[i],this),s=e+" "+this.selector;t.on(n,s,o)},this)},generateHtml:function(){throw new Error("implement generateHtml() method")}});e.exports=o},{"../common/constMap":9}],7:[function(t,e,i){"use strict";var n=t("./common"),o=Backbone.View.extend({initialize:function(){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()},_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="tui-grid-",o={CONTAINER:"container",CLIPBOARD:"clipboard",NO_SCROLL_X:"no-scroll-x",NO_SCROLL_Y:"no-scroll-y",LAYER_STATE:"layer-state",LAYER_STATE_CONTENT:"layer-state-content",LAYER_STATE_LOADING:"layer-state-loading",LAYER_EDITING:"layer-editing",LAYER_FOCUS:"layer-focus",LAYER_FOCUS_BORDER:"layer-focus-border",LAYER_SELECTION:"layer-selection",BORDER_LINE:"border-line",BORDER_TOP:"border-line-top",BORDER_LEFT:"border-line-left",BORDER_RIGHT:"border-line-right",BORDER_BOTTOM:"border-line-bottom",LSIDE_AREA:"lside-area",RSIDE_AREA:"rside-area",HEAD_AREA:"head-area",BODY_AREA:"body-area",COLUMN_RESIZE_CONTAINER:"column-resize-container",COLUMN_RESIZE_HANDLE:"column-resize-handle",COLUMN_RESIZE_HANDLE_LAST:"column-resize-handle-last",BODY_CONTAINER:"body-container",BODY_TABLE_CONTAINER:"table-container",SCROLLBAR_HEAD:"scrollbar-head",SCROLLBAR_BORDER:"scrollbar-border",SCROLLBAR_RIGHT_BOTTOM:"scrollbar-right-bottom",SCROLLBAR_LEFT_BOTTOM:"scrollbar-left-bottom",PAGINATION:"pagination",PAGINATION_PRE:"pre",PAGINATION_PRE_OFF:"pre-off",PAGINATION_PRE_END:"pre-end",PAGINATION_PRE_END_OFF:"pre-end-off",PAGINATION_NEXT:"next",PAGINATION_NEXT_OFF:"next-off",PAGINATION_NEXT_END:"next-end",PAGINATION_NEXT_END_OFF:"next-end-off",TABLE:"table",CELL:"cell",CELL_HEAD:"cell-head",CELL_ROW_ODD:"cell-row-odd",CELL_ROW_EVEN:"cell-row-even",CELL_EDITABLE:"cell-editable",CELL_DUMMY:"cell-dummy",CELL_REQUIRED:"cell-required",CELL_DISABLED:"cell-disabled",CELL_SELECTED:"cell-selected",CELL_INVALID:"cell-invalid",CELL_ELLIPSIS:"cell-ellipsis",CELL_CURRENT_ROW:"cell-current-row",CELL_MAIN_BUTTON:"cell-main-button",CELL_CONTENT:"cell-content",CELL_CONTENT_BEFORE:"content-before",CELL_CONTENT_AFTER:"content-after",CELL_CONTENT_INPUT:"content-input",BTN_TEXT:"btn-text",BTN_SORT:"btn-sorting",BTN_SORT_UP:"btn-sorting-up",BTN_SORT_DOWN:"btn-sorting-down",BTN_EXCEL:"btn-excel-download",BTN_EXCEL_ICON:"btn-excel-icon",BTN_EXCEL_PAGE:"btn-excel-page",BTN_EXCEL_ALL:"btn-excel-all",TOOLBAR:"toolbar",TOOLBAR_BTN_HOLDER:"toolbar-btn-holder",HEIGHT_RESIZE_BAR:"height-resize-bar",HEIGHT_RESIZE_HANDLE:"height-resize-handle"},i=_.mapObject(o,function(t){return n+t});i.PREFIX=n,e.exports=i},{}],9:[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},attrName:{ROW_KEY:"data-row-key",COLUMN_NAME:"data-column-name",COLUMN_INDEX:"data-column-index",EDIT_TYPE:"data-edit-type",GRID_ID:"data-grid-id"},themeName:{DEFAULT:"default",STRIPED:"striped",CLEAN:"clean"}}},{}],10:[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);t.selectedIndex=_.findIndex(i,function(t){return t.value===e||t.text===e})},"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")[String(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},{}],11:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){this._stopped=!1,this.setData(t)},setData:function(t){_.extend(this,t)},stop:function(){this._stopped=!0},isStopped:function(){return this._stopped}});e.exports=n},{}],12:[function(t,e,i){"use strict";var n=t("./constMap").dimension.CELL_BORDER_WIDTH,o={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+n)},getDisplayRowCount:function(t,e){return Math.ceil(t/(e+n))},getRowHeight:function(t,e){return 0===t?0:Math.floor((e-n)/t)},isMetaColumn:function(t){return _.contains(["_button","_number"],t)},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},isBlank:function(t){return _.isString(t)?!t.length:_.isUndefined(t)||_.isNull(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},toString:function(t){return _.isUndefined(t)||_.isNull(t)?"":String(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?String(t):"number"===e?Number(t):"boolean"===e?Boolean(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},appendStyleElement:function(t,e){var i=document.createElement("style");i.type="text/css",i.id=t,i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e)),document.getElementsByTagName("head")[0].appendChild(i)}};e.exports=o},{"./constMap":9}],13:[function(t,e,i){"use strict";var n=t("./common/constMap").attrName,o=tui.util.defineClass({init:function(t){this.$el=t},getElement:function(t,e){return this.$el.find("tr["+n.ROW_KEY+"="+t+"]").find("td["+n.COLUMN_NAME+"="+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=o},{"./common/constMap":9}],14:[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("./painter/controller"),d=t("./addon/net"),c=t("./common/util"),h=t("./theme/manager"),m=t("./common/constMap").themeName,g={};tui=window.tui=tui||{},tui.Grid=n.extend({initialize:function(t){var e=new a(this.$el);this.id=c.getUniqueKey(),this.modelManager=this._createModelManager(t,e),this.painterManager=this._createPainterManager(),this.container=this._createContainerView(t,e),this.publicEventEmitter=this._createPublicEventEmitter(),this.container.render(),this.refreshLayout(),h.isApplied()||h.apply(m.DEFAULT),this.addOn={},g[this.id]=this},_createModelManager:function(t,e){var i=_.assign({},t,{gridId:this.id});return _.omit(i,"el","singleClickEdit"),new o(i,e)},_createPainterManager:function(){var t=new u({focusModel:this.modelManager.focusModel,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,selectionModel:this.modelManager.selectionModel});return new r({gridId:this.id,selectType:this.modelManager.columnModel.get("selectType"),controller:t})},_createContainerView:function(t,e){var i=new s({modelManager:this.modelManager,painterManager:this.painterManager,domState:e});return i.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){var e=this.modelManager.columnModel.at(0,!0);this.modelManager.focusModel.focus(t,e.columnName)},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 d(e),this.publicEventEmitter.listenToNetAddon(this.addOn.Net)),this},getRowList:function(){return this.modelManager.dataModel.getRowList()},sort:function(t,e){this.modelManager.dataModel.sortByField(t,e)},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 g[t]},tui.Grid.applyTheme=function(t,e){h.apply(t,e)}},{"./addon/net":2,"./base/view":7,"./common/constMap":9,"./common/util":12,"./domState":13,"./model/manager":21,"./painter/controller":29,"./painter/manager":36,"./publicEventEmitter":38,"./theme/manager":40,"./view/factory":48}],15:[function(t,e,i){"use strict";var n=t("../../base/model"),o=t("../../common/util"),s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.textType={normal:!0,text:!0,password:!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,align:"center",editOption:{type:"mainButton"},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&&ea;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=_.isUndefined(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=_.isUndefined(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=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},replaceRowList:function(t,e,i){t||(t=[]),_.isUndefined(e)&&(e=!0),this.trigger("beforeReset",t.length),this.lastRowKey=-1,this.reset(t,{parse:e}),_.isFunction(i)&&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","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 i=this.getMainRowKey(t,e);return this.domState.getElement(i,e)}});e.exports=s},{"../../base/collection":3,"./row":17}],19:[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=t+1+(this.isDivisionBorderDoubled()?1:0),n=i*l,o=e-this.getScrollYWidth()-n;return o},_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;this.set("totalRowHeight",o.getHeight(e,t))},_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}),i.length&&(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=this.columnModel.getVisibleColumnModelList(null,!0),e=this.get("minimumColumnWidth"),i=[],n=[],s=[];_.each(t,function(t){var a=t.width>0?t.width:0,l=Math.max(a,e);o.isMetaColumn(t.columnName)&&(l=a),i.push(a?l:0),s.push(l),n.push(!!t.isFixedWidth)},this),this._columnWidthFixedFlags=n,this._minColumnWidthList=s,this._setColumnWidthVariables(this._calculateColumnWidth(i),!0)},_calculateColumnWidth:function(t){return t=this._fillEmptyColumnWidth(t),t=this._applyMinimumColumnWidth(t),t=this._adjustColumnWidthList(t)},isDivisionBorderDoubled:function(){return this.columnModel.getVisibleColumnFixCount()>0},getFrameWidth:function(t){var e=this.columnModel.getVisibleColumnFixCount(!0),i=this.getColumnWidthList(t),n=this._getFrameWidth(i);return _.isUndefined(t)&&e>0&&(n+=l),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},_getCellHorizontalPosition:function(t){for(var e=this.columnModel,i=e.getVisibleMetaColumnCount(),n=this.get("columnWidthList"),o=e.getVisibleColumnFixCount()+i,s=e.indexOfColumnName(t,!0)+i,a=o>s?0:o,r=0;s>a;a+=1)r+=n[a]+l;return{left:r,right:r+n[s]+l}},_getCellVerticalPosition:function(t,e){var i=this.dataModel,n=this.get("rowHeight"),s=i.indexOfRowKey(t),a=o.getHeight(s,n),l=o.getHeight(e,n);return{top:a,bottom:a+l}},_getRowSpanCount:function(t,e){var i=this.dataModel.get(t).getRowSpanData(e);return i.isMainRow||(t=i.mainRowKey,i=this.dataModel.get(t).getRowSpanData(e)),i.count||1},getCellPosition:function(t,e){var i,n,o;return t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t)?(i=this._getRowSpanCount(t,e),n=this._getCellVerticalPosition(t,i),o=this._getCellHorizontalPosition(e),{top:n.top,bottom:n.bottom,left:o.left,right:o.right}):{}},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(),r=0;return s&&(o+=this.renderModel.get("scrollLeft")),o>=n?r=i.length-1:tui.util.forEachArray(i,function(t,e){return t+=l,r=e,o>t?void(o-=t):!1}),Math.max(0,r-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":9,"../common/util":12}],20:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=t("../common/gridEvent"),a=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.domState=e.domState,this.listenTo(this.dataModel,"reset",this._onResetData)},defaults:{rowKey:null,columnName:"",prevRowKey:null,prevColumnName:"",editingAddress:null},_onResetData:function(){this.unselect(!0)},_savePrevious:function(){null!==this.get("rowKey")&&this.set("prevRowKey",this.get("rowKey")),this.get("columnName")&&this.set("prevColumnName",this.get("columnName"))},_clearPrevious:function(){this.set({prevRowKey:null,prevColumnName:""})},isCurrentCell:function(t,e,i){var n=this.get("columnName"),o=this.get("rowKey");return i&&(o=this.dataModel.getMainRowKey(o,n)),String(o)===String(t)&&n===e},select:function(t){var e=new s,i=this.get("rowKey");return String(i)===String(t)?!0:(e.setData({rowKey:t,prevRowKey:i,rowData:this.dataModel.getRowData(t)}),this.trigger("select",e),e.isStopped()?(this._cancelSelect(),!1):(this.set("rowKey",t),"radio"===this.columnModel.get("selectType")&&this.dataModel.check(t),!0))},_cancelSelect:function(){var t=this.get("prevColumnName");this.set("columnName",t),this.trigger("focus",this.get("rowKey"),t)},unselect:function(t){t&&this.blur(),this.set({rowKey:null})},focus:function(t,e,i){return!this._isValidCell(t,e)||o.isMetaColumn(e)||this.isCurrentCell(t,e)?!0:(this.blur(),this.select(t)?(this.set("columnName",e),this.trigger("focus",t,e),i&&this.scrollToFocus(),!0):!1)},focusAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0),s=!1;return n&&o&&(s=this.focus(n.get("rowKey"),o.columnName,i)),s},focusIn:function(t,e,i){var n=this.focus(t,e,i);return n&&(t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t).isEditable(e)?(this.finishEditing(),this.startEditing(t,e)):this.focusClipboard()),n},focusInAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0),s=!1;return n&&o&&(s=this.focusIn(n.get("rowKey"),o.columnName,i)),s},focusClipboard:function(){this.trigger("focusClipboard")},refreshState:function(){var t;this.domState.hasFocusedElement()?this.has()||(t=this.restore(),t||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(){var t=this.get("columnName");return this.has()?(this.has(!0)&&this._savePrevious(),null!==this.get("rowKey")&&this.set("columnName",""),this.trigger("blur",this.get("rowKey"),t),this):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(t){var e=this.get("rowKey"),i=this.get("columnName");return t?this._isValidCell(e,i):!o.isBlank(e)&&!o.isBlank(i)},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},isEditingCell:function(t,e){var i=this.get("editingAddress");return i&&String(i.rowKey)===String(t)&&i.columnName===e},startEditing:function(t,e){if(this.get("editingAddress"))return!1;if(_.isUndefined(t)&&_.isUndefined(e))t=this.get("rowKey"),e=this.get("columnName");else if(!this.isCurrentCell(t,e,!0))return!1;return t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t).isEditable(e)?(this.set("editingAddress",{rowKey:t,columnName:e}),!0):!1},finishEditing:function(){return this.get("editingAddress")?(this.set("editingAddress",null),!0):!1},_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,o=null;return this.has(!0)&&(e=Math.max(Math.min(n.indexOfRowKey(this.get("rowKey"))+t,this.dataModel.length-1),0),i=n.at(e),i&&(o=i.get("rowKey"))),o},_findColumnName:function(t){var e,i=this.columnModel,n=i.getVisibleColumnModelList(),o=i.indexOfColumnName(this.get("columnName"),!0),s=null;return this.has(!0)&&(e=Math.max(Math.min(o+t,n.length-1),0),s=n[e]&&n[e].columnName),s},_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=a},{"../base/model":5,"../common/gridEvent":11,"../common/util":12}],21:[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={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}},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.focusModel=this._createFocusModel(e),this.renderModel=this._createRenderModel(t),this.selectionModel=this._createSelectionModel(),this.focusModel.renderModel=this.renderModel,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,focusModel:this.focusModel},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},{"./data/columnModel":15,"./data/rowList":18,"./dimension":19,"./focus":20,"./renderer":23,"./renderer-smart":22,"./selection":26,"./toolbar":27}],22:[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),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.criticalPointa&&this.set("state",s.LOADING)},_onEditingAddressChange:function(t,e){var i=e,n=!0,o=this;e||(i=t.previous("editingAddress"),n=!1),this._updateCellData(i.rowKey,i.columnName,{isEditing:n}),this._triggerEditingStateChanged(i.rowKey,i.columnName),_.defer(function(){o._toggleChangeLayoutEventHandlers(n)})},_toggleChangeLayoutEventHandlers:function(t){var e="change:scrollTop change:scrollLeft",i="columnWidthChanged";t?(this.listenToOnce(this.dimensionModel,i,this._onChangeLayoutBound),this.once(e,this._onChangeLayoutBound)):(this.stopListening(this.dimensionModel,i,this._onChangeLayoutBound),this.off(e,this._onChangeLayoutBound))},_triggerEditingStateChanged:function(t,e){var i=this.getCellData(t,e);tui.util.pick(i,"columnModel","editOption","useViewMode")!==!1&&this.trigger("editingStateChanged",i)},_updateCellData:function(t,e,i){var n=this._getRowModel(t,e);n&&n.setCell(e,i)},initializeVariables:function(){this.set({top:0,scrollTop:0,scrollLeft:0,startIndex:0,endIndex:0,startNumber:1})},getCollection:function(t){return this.get(tui.util.isString(t)?t.toLowerCase()+"side":"rside")},_onColumnModelChange:function(){this.set({scrollTop:0,top:0,startIndex:0,endIndex:0}),this.refresh(!0)},_onDataModelChange:function(){this.refresh(!1,!0)},_onAddDataModel:function(t,e){this.refresh(!1,!0),e.focus&&this.focusModel.focusAt(e.at,0)},_resetDummyRows:function(){this._clearDummyRows(),this._fillDummyRows(),this.trigger("rowListChanged")},_setRenderingRange:function(){this.set({startIndex:0,endIndex:this.dataModel.length-1})},_createViewDataFromDataModel:function(t,e,i,n){var o={height:i,rowNum:n,rowKey:t.get("rowKey"),_extraData:t.get("_extraData")};return _.each(e,function(e){var i=t.get(e);"_number"===e&&(i=n),o[e]=i}),o},_getColumnNamesOfEachSide:function(){var t=this.columnModel.getVisibleColumnFixCount(!0),e=this.columnModel.getVisibleColumnModelList(null,!0),i=_.pluck(e,"columnName");return{lside:i.slice(0,t),rside:i.slice(t)}},_resetViewModelList:function(t,e){this.get(t).clear().reset(e,{parse:!0})},_resetAllViewModelListWithRange:function(t,e){var i,n,o=this._getColumnNamesOfEachSide(),s=this.get("startNumber")+t,a=this.dimensionModel.get("rowHeight"),l=[],r=[];for(n=t;e>=n;n+=1)i=this.dataModel.at(n),l.push(this._createViewDataFromDataModel(i,o.lside,a,s)),r.push(this._createViewDataFromDataModel(i,o.rside,a,s)),s+=1;this._resetViewModelList("lside",l),this._resetViewModelList("rside",r)},_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),n=this.dimensionModel.get("rowHeight"),o=this.get("endIndex")+2;_.times(i,function(){_.each(["lside","rside"],function(t){this.get(t).add({height:n,rowNum:o})},this),o+=1},this),this.set("dummyRowCount",i)},refresh:function(t,e){var i,n,o;for(this._setRenderingRange(this.get("scrollTop")),i=this.get("startIndex"),n=this.get("endIndex"),this._resetAllViewModelListWithRange(i,n),this.get("showDummyRows")&&this._fillDummyRows(),o=i;n>=o;o+=1)this._executeRelation(o);t?this.trigger("columnModelChanged"):this.trigger("rowListChanged",e),this._refreshState()},_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")},_getRowModel:function(t,e){var i=this._getCollectionByColumnName(e);return i.get(t)},getCellData:function(t,e){var i=this._getRowModel(t,e),n=null;return i&&(n=i.get(e)),n},_executeRelation:function(t){var e,i,n=this.dataModel.at(t),o=t-this.get("startIndex");i=n.executeRelationCallbacksAll(),_.each(i,function(t,i){e=this._getCollectionByColumnName(i).at(o),e&&e.setCell(i,t)},this)}});e.exports=l},{"../base/model":5,"../common/constMap":9,"./rowList":25}],24:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=n.extend({initialize:function(t){var e=t&&t.rowKey,i=this.collection.dataModel,n=i.get(e);this.dataModel=i,this.columnModel=this.collection.columnModel,this.focusModel=this.collection.focusModel,n&&(this.listenTo(n,"change",this._onDataModelChange),this.listenTo(n,"restore",this._onDataModelRestore),this.listenTo(n,"extraDataChanged",this._setRowExtraData),this.listenTo(i,"disabledChanged",this._onDataModelDisabledChanged),this.rowData=n)},idAttribute:"rowKey",_onDataModelChange:function(t){_.each(t.changed,function(e,i){var n,o;this.has(i)&&(n=this.columnModel.getColumnModel(i),o=this.columnModel.isTextType(i),this.setCell(i,this._getValueAttrs(e,t,n,o)))},this)},_onDataModelRestore:function(t){var e=this.get(t);e&&this.trigger("restore",e)},_getColumnNameList:function(){var t=this.collection.columnModel.getVisibleColumnModelList(null,!0);return _.pluck(t,"columnName")},_onDataModelDisabledChanged:function(){var t=this._getColumnNameList();_.each(t,function(t){this.setCell(t,{isDisabled:this.rowData.isDisabled(t),className:this._getClassNameString(t)})},this)},_setRowExtraData:function(){var t,e=this.collection.dataModel,i=this._getColumnNameList();tui.util.isUndefined(this.collection)||_.each(i,function(i){var n,o=this.get(i),s=this;tui.util.isUndefined(o)||(n=this.rowData.getCellState(i),e.isRowSpanEnable()&&!o.isMainRow&&(s=this.collection.get(o.mainRowKey)),s&&(t={isDisabled:n.isDisabled,isEditable:n.isEditable,className:this._getClassNameString(i)},s.setCell(i,t)))},this)},parse:function(t,e){var i=e.collection;return this._formatData(t,i.dataModel,i.columnModel,i.focusModel)},_formatData:function(t,e,i,n){var o,s,a=t.rowKey,l=t.rowNum;return _.isUndefined(a)?t:(s=e.get(a),o=_.omit(t,"rowKey","_extraData","height","rowNum"),_.each(o,function(o,r){var u=this._getRowSpanData(r,t,e.isRowSpanEnable()),d=s.getCellState(r),c=i.isTextType(r),h=i.getColumnModel(r);t[r]={rowKey:a,rowNum:l,columnName:r,rowSpan:u.count,isMainRow:u.isMainRow,mainRowKey:u.mainRowKey,isEditable:d.isEditable,isDisabled:d.isDisabled,isEditing:n.isEditingCell(a,r),optionList:tui.util.pick(h,"editOption","list"),className:this._getClassNameString(r,s,n),columnModel:h,changed:[]},_.assign(t[r],this._getValueAttrs(o,s,h,c))},this),t)},_getClassNameString:function(t,e,i){var n;return e||(e=this.dataModel.get(this.get("rowKey")))?(i||(i=this.focusModel),n=e.getClassNameList(t),n.join(" ")):""},_getValueAttrs:function(t,e,i,n){var o=tui.util.pick(i,"editOption","beforeContent"),s=tui.util.pick(i,"editOption","afterContent"),a=tui.util.pick(i,"editOption","converter"),l=e.toJSON();return{value:this._getValueToDisplay(t,i,n),formattedValue:this._getFormattedValue(t,l,i),beforeContent:this._getExtraContent(o,t,l),afterContent:this._getExtraContent(s,t,l),convertedHTML:this._getConvertedHTML(a,t,l)}},_getFormattedValue:function(t,e,i){var n=t||"";return _.isFunction(i.formatter)&&(n=i.formatter(n,e,i)),n},_getExtraContent:function(t,e,i){var n="";return _.isFunction(t)?n=t(e,i):tui.util.isExisty(t)&&(n=t),n},_getConvertedHTML:function(t,e,i){var n=null;return _.isFunction(t)&&(n=t(e,i)),n===!1&&(n=null),n},_getValueToDisplay:function(t,e,i){var n=tui.util.isExisty,o=e.notUseHtmlEntity,s=e.defaultValue;return n(t)||(t=n(s)?s:""),i&&!o&&tui.util.hasEncodableString(t)&&(t=tui.util.encodeHTMLEntity(t)),t},_getRowSpanData:function(t,e,i){var n=tui.util.pick(e,"_extraData","rowSpanData",t);return i&&n||(n={mainRowKey:e.rowKey,count:0,isMainRow:!0}),n},updateClassName:function(t){this.setCell(t,{className:this._getClassNameString(t)})},setCell:function(t,e){var i,n,s,a=!1,l=[];this.has(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,{silent:this._shouldSetSilently(s,a)}),a&&!s.isEditing&&(i=this.collection.dataModel.indexOfRowKey(n),this.trigger("valueChange",i))))},_shouldSetSilently:function(t,e){var i=t.isEditing&&e,n=tui.util.pick(t,"columnModel","editOption","useViewMode")!==!1,o=_.contains(t.changed,"isEditing")&&t.isEditing;return i||n&&o}});e.exports=s},{"../base/model":5,"../common/util":12}],25:[function(t,e,i){"use strict";var n=t("../base/collection"),o=t("./row"),s=n.extend({initialize:function(t,e){this.setOwnProperties({dataModel:e.dataModel,columnModel:e.columnModel,focusModel:e.focusModel})},model:o});e.exports=s},{"../base/collection":3,"./row":24}],26:[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.getValueString(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]),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":12}],27:[function(t,e,i){"use strict";var n=t("../base/model"),o=n.extend({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}],28:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.editType=t.editType,this.inputPainter=t.inputPainter,this.selector="td["+s.EDIT_TYPE+"="+this.editType+"]"},events:{dblclick:"_onDblClick"},template:_.template("><%=contentHtml%>"),_onDblClick:function(t){var e;this._isEditableType()&&(e=this._getCellAddress($(t.target)),this.controller.startEditing(e,!0))},_isEditableType:function(){return!_.contains(["normal","mainButton"],this.editType)},_getContentHtml:function(t){var e=t.formattedValue,i=t.beforeContent,n=t.afterContent;return this.inputPainter&&(e=this.inputPainter.generateHtml(t),this._shouldContentBeWrapped()&&!this._isUsingViewMode(t))?(i=this._getSpanWrapContent(i,a.CELL_CONTENT_BEFORE),n=this._getSpanWrapContent(n,a.CELL_CONTENT_AFTER),e=this._getSpanWrapContent(e,a.CELL_CONTENT_INPUT),i+n+e):i+e+n},_isUsingViewMode:function(t){return tui.util.pick(t,"columnModel","editOption","useViewMode")!==!1},_shouldContentBeWrapped:function(){return _.contains(["text","password","select"],this.editType)},_getSpanWrapContent:function(t,e){return tui.util.isFalsy(t)&&(t=""),''+t+""},_getAttributes:function(t){var e=[t.className,a.CELL,a.CELL_CONTENT,t.rowNum%2?a.CELL_ROW_ODD:a.CELL_ROW_EVEN],i={align:t.columnModel.align||"left"};return i["class"]=e.join(" "),i[s.EDIT_TYPE]=this.editType,i[s.ROW_KEY]=t.rowKey,i[s.COLUMN_NAME]=t.columnName,t.rowSpan&&(i.rowspan=t.rowSpan),i},attachEventHandlers:function(t,e){n.prototype.attachEventHandlers.call(this,t,e),this.inputPainter&&this.inputPainter.attachEventHandlers(t,e+" "+this.selector)},generateHtml:function(t){var e=o.getAttributesString(this._getAttributes(t)),i=this._getContentHtml(t);return this.template({attributeString:e,contentHtml:i||"​"})},refresh:function(t,e){var i=["value","isEditing","isDisabled"],n=_.contains(t.changed,"isEditing"),o=_.intersection(i,t.changed).length>0,s=this._getAttributes(t);delete s.rowspan,e.attr(s),n&&t.isEditing&&!this._isUsingViewMode(t)?this.inputPainter.focus(e):o&&(e.html(this._getContentHtml(t)),e.scrollLeft(0))}});e.exports=l},{"../base/painter":6,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],29:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){this.focusModel=t.focusModel,this.dataModel=t.dataModel,this.columnModel=t.columnModel,this.selectionModel=t.selectionModel},startEditing:function(t,e){var i;return e&&this.focusModel.finishEditing(),i=this.focusModel.startEditing(t.rowKey,t.columnName),i&&this.selectionModel.end(),i},finishEditing:function(t,e,i){var n=this.focusModel;return n.isEditingCell(t.rowKey,t.columnName)?(this.selectionModel.enable(),_.isUndefined(i)||(this.setValue(t,i),this.dataModel.get(t.rowKey).validateCell(t.columnName)),n.finishEditing(),e?n.focusClipboard():_.defer(function(){n.refreshState()}),!0):!1},focusInToNextCell:function(t){var e=this.focusModel,i=e.get("rowKey"),n=e.get("columnName"),o=t?e.prevColumnName():e.nextColumnName();n!==o&&e.focusIn(i,o,!0)},executeCustomInputEventHandler:function(t,e){var i,n=this.columnModel.getColumnModel(e.columnName),o=t.type;"focusin"===o?o="focus":"focusout"===o&&(o="blur"),i=tui.util.pick(n,"editOption","inputEvents",o),_.isFunction(i)&&i.call(t.target,t,e)},appendEmptyRowAndFocus:function(){this.dataModel.append({},{focus:!0})},setValue:function(t,e){this.dataModel.setValue(t.rowKey,t.columnName,e)}});e.exports=n},{}],30:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},events:{dblclick:"_onDblClick"},selector:"td["+s.EDIT_TYPE+"=dummy]",template:_.template("​'),_onDblClick:function(){this.controller.appendEmptyRowAndFocus(!0)},generateHtml:function(t,e){var i=[a.CELL,a.CELL_DUMMY,t%2?a.CELL_ROW_ODD:a.CELL_ROW_EVEN];return o.isMetaColumn(e)&&i.push(a.CELL_HEAD),this.template({columnName:e,className:i.join(" ")})}});e.exports=l},{"../base/painter":6,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],31:[function(t,e,i){"use strict";var n=t("../../base/painter"),o=t("../../common/constMap").keyName,s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},events:{keydown:"_onKeyDown",focusin:"_onFocusIn",focusout:"_onFocusOut"},keyDownActions:{ESC:function(t){this.controller.finishEditing(t.address,!0)},ENTER:function(t){this.controller.finishEditing(t.address,!0,t.value)},TAB:function(t){this.controller.finishEditing(t.address,!0,t.value),this.controller.focusInToNextCell(t.shiftKey)}},_extendKeydownActions:function(t){this.keyDownActions=_.assign({},this.keyDownActions,t)},_extendEvents:function(t){this.events=_.assign({},this.events,t)},_executeCustomEventHandler:function(t){var e=$(t.target),i=this._getCellAddress(e);this.controller.executeCustomInputEventHandler(t,i)},_onFocusIn:function(t){var e=this._getCellAddress($(t.target));this._executeCustomEventHandler(t),this.controller.startEditing(e)},_onFocusOut:function(t){var e=$(t.target),i=this._getCellAddress(e);this._executeCustomEventHandler(t),this.controller.finishEditing(i,!1,e.val())},_onKeyDown:function(t){var e=t.keyCode||t.which,i=o[e],n=this.keyDownActions[i],s=$(t.target),a={$target:s,address:this._getCellAddress(s),shiftKey:t.shiftKey,value:s.val()};this._executeCustomEventHandler(t),n&&(n.call(this,a),t.preventDefault())},_getDisplayValue:function(){throw new Error("implement _getDisplayValue() method")},_generateInputHtml:function(){throw new Error("implement _generateInputHtml() method")},_isUsingViewMode:function(t){return tui.util.pick(t,"columnModel","editOption","useViewMode")!==!1},generateHtml:function(t){var e;return e=_.isNull(t.convertedHTML)?!this._isUsingViewMode(t)||t.isEditing?this._generateInputHtml(t):this._getDisplayValue(t):t.convertedHTML},focus:function(t){var e=t.find(this.selector);e.is(":focus")||e.eq(0).focus()}});e.exports=s},{"../../base/painter":6,"../../common/constMap":9}],32:[function(t,e,i){"use strict";var n=t("./base"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.inputType=t.inputType,this.selector="fieldset[data-type="+this.inputType+"]",this._extendEvents({mousedown:"_onMouseDown"}),this._extendKeydownActions({TAB:function(t){var e;this._focusNextInput(t.$target,t.shiftKey)||(e=this._getCheckedValueString(t.$target),this.controller.finishEditing(t.address,!0,e),this.controller.focusInToNextCell(t.shiftKey))},ENTER:function(t){var e=this._getCheckedValueString(t.$target);this.controller.finishEditing(t.address,!0,e)},LEFT_ARROW:function(t){this._focusNextInput(t.$target,!0)},RIGHT_ARROW:function(t){this._focusNextInput(t.$target)},UP_ARROW:function(){},DOWN_ARROW:function(){}})},template:_.template('
<%=content%>
'),inputTemplate:_.template(' <%=disabled%> />'),labelTemplate:_.template(''),_onFocusOut:function(t){var e=$(t.target),i=this;_.defer(function(){var t,n;e.siblings("input:focus").length||(t=i._getCellAddress(e),n=i._getCheckedValueString(e),i.controller.finishEditing(t,!1,n))})},_onMouseDown:function(t){var e=$(t.target),i=e.closest("fieldset").find("input:focus").length>0;!e.is("input")&&i&&(t.stopPropagation(),t.preventDefault())},_focusNextInput:function(t,e){var i=e?"prevAll":"nextAll",n=t[i]("input");return n.length?(n.first().focus(),!0):!1},_getCheckedValueString:function(t){var e,i=t.parent().find("input:checked"),n=[];return i.each(function(){var t=$(this),e=t.attr("data-value-type"),i=o.convertValueType(t.val(),e);n.push(i)}),e=1===n.length?n[0]:n.join(",")},_getCheckedValueSet:function(t){var e={};return _.each(String(t).split(","),function(t){e[t]=!0}),e},_getDisplayValue:function(t){var e=this._getCheckedValueSet(t.value),i=[];return _.each(t.optionList,function(t){e[t.value]&&i.push(t.text)}),i.join(",")},_generateInputHtml:function(t){var e=this._getCheckedValueSet(t.value),i=o.getUniqueKey(),n="";return _.each(t.optionList,function(o){var s=i+"_"+o.value;n+=this.inputTemplate({type:this.inputType,id:s,name:i,value:o.value,valueType:typeof o.value,checked:e[o.value]?"checked":"",disabled:t.isDisabled?"disabled":""}),o.text&&(n+=this.labelTemplate({id:s,labelText:o.text}))},this),this.template({type:this.inputType,content:n})},focus:function(t){var e=t.find("input");e.is(":focus")||e.eq(0).focus()}});e.exports=s},{"../../common/util":12,"./base":31}],33:[function(t,e,i){"use strict";var n=t("../../base/painter"),o=t("../../common/classNameConst"),s=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.selector="input."+o.CELL_MAIN_BUTTON,this.inputType=t.inputType,this.gridId=t.gridId},events:{change:"_onChange"},template:_.template(' />'),_onChange:function(t){var e=$(t.target),i=this._getCellAddress(e);this.controller.setValue(i,e.is(":checked"))},generateHtml:function(t){return this.template({type:this.inputType,name:this.gridId,checked:t.value?"checked":""})}});e.exports=s},{"../../base/painter":6,"../../common/classNameConst":8}],34:[function(t,e,i){"use strict";var n=t("./base"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.selector="select"},template:_.template(''),optionTemplate:_.template(''),_getDisplayValue:function(t){var e=_.find(t.optionList,function(e){return String(e.value)===String(t.value)});return e?e.text:""},_generateInputHtml:function(t){var e=_.reduce(t.optionList,function(e,i){return e+this.optionTemplate({value:i.value,text:i.text,selected:String(t.value)===String(i.value)?"selected":""})},"",this);return this.template({name:o.getUniqueKey(),disabled:t.isDisabled?"disabled":"",options:e})}});e.exports=s},{"../../common/util":12,"./base":31}],35:[function(t,e,i){"use strict";var n=t("./base"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.inputType=t.inputType,this.selector="input[type="+this.inputType+"]",this._extendEvents({selectstart:"_onSelectStart"})},template:_.template('/>'),_onSelectStart:function(t){t.stopPropagation()},_convertStringToAsterisks:function(t){return Array(t.length+1).join("*")},_getDisplayValue:function(t){var e=t.formattedValue;return"password"===this.inputType&&(e=this._convertStringToAsterisks(t.value)),e},_generateInputHtml:function(t){var e=tui.util.pick(t,"columnModel","editOption","maxLength");return this.template({type:this.inputType,value:t.value,name:o.getUniqueKey(),disabled:t.isDisabled?"disabled":"",maxLength:e})},focus:function(t){var e=t.find(this.selector);1!==e.length||e.is(":focus")||e.select()}});e.exports=s},{"../../common/util":12,"./base":31}],36:[function(t,e,i){"use strict";var n=t("./row"),o=t("./cell"),s=t("./dummyCell"),a=t("./input/text"),l=t("./input/select"),r=t("./input/button"),u=t("./input/mainButton"),d=tui.util.defineClass({init:function(t){this.gridId=t.gridId,this.selectType=t.selectType,this.inputPainters=this._createInputPainters(t.controller),this.cellPainters=this._createCellPainters(t.controller),this.rowPainter=this._createRowPainter()},_createInputPainters:function(t){return{text:new a({controller:t,inputType:"text"}),password:new a({controller:t,inputType:"password"}),checkbox:new r({controller:t,inputType:"checkbox"}),radio:new r({controller:t,inputType:"radio"}),select:new l({controller:t}),mainButton:new u({controller:t,inputType:this.selectType,gridId:this.gridId})}},_createCellPainters:function(t){var e={dummy:new s({controller:t}),normal:new o({controller:t,editType:"normal"})};return _.each(this.inputPainters,function(i,n){e[n]=new o({editType:n,controller:t,inputPainter:i})},this),e},_createRowPainter:function(){return new n({painterManager:this})},getCellPainter:function(t){return this.cellPainters[t]},getCellPainters:function(){return this.cellPainters},getInputPainters:function(t){var e=this.inputPainters;return t&&(e=_.omit(e,"mainButton")),e},getRowPainter:function(){return this.rowPainter}});e.exports=d},{"./cell":28,"./dummyCell":30,"./input/button":32,"./input/mainButton":33,"./input/select":34,"./input/text":35,"./row":37}],37:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap"),a=s.attrName,l=s.dimension.CELL_BORDER_WIDTH,r=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.painterManager=t.painterManager},selector:"tr",template:_.template('="<%=rowKey%>" class="<%=className%>" style="height: <%=height%>px;"><%=contents%>'),_getEditType:function(t,e){var i=tui.util.pick(e.columnModel,"editOption","type");return i||"normal"},_generateHtmlForDummyRow:function(t,e){var i=this.painterManager.getCellPainter("dummy"),n="";return _.each(e,function(e){n+=i.generateHtml(t,e)}),n},_generateHtmlForActualRow:function(t,e){var i="";return _.each(e,function(e){var n,o,s=t.get(e);s&&s.isMainRow&&(n=this._getEditType(e,s),o=this.painterManager.getCellPainter(n),i+=o.generateHtml(s))},this),i},generateHtml:function(t,e){var i,n=t.get("rowKey"),o=t.get("rowNum"),s="";return i=_.isUndefined(n)?this._generateHtmlForDummyRow(o,e):this._generateHtmlForActualRow(t,e),this.template({rowKeyAttrName:a.ROW_KEY,rowKey:n,height:t.get("height")+r._extraHeight+l,contents:i,className:s})},refresh:function(t,e){_.each(t,function(t,i){ -var n,o,s;"_extraData"!==i&&(s=e.find("td["+a.COLUMN_NAME+"="+i+"]"),n=this._getEditType(i,t),o=this.painterManager.getCellPainter(n),o.refresh(t,s))},this)},"static":{_extraHeight:function(){var t=0;return o.isBrowserIE7()&&(t=-2),t}()}});e.exports=r},{"../base/painter":6,"../common/constMap":9,"../common/util":12}],38:[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},{}],39:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){if(!_.isString(t)||!t)throw new Error("The Selector must be a string and not be empty.");this._selector=t,this._propValues=[]},add:function(t,e){return e&&this._propValues.push(t+":"+e),this},border:function(t){return this.add("border-color",t)},borderWidth:function(t){var e,i=t.showVerticalBorder,n=t.showHorizontalBorder;return _.isBoolean(i)&&(e=i?"1px":"0",this.add("border-left-width",e).add("border-right-width",e)),_.isBoolean(n)&&(e=n?"1px":"0",this.add("border-top-width",e).add("border-bottom-width",e)),this},bg:function(t){return this.add("background-color",t)},text:function(t){return this.add("color",t)},build:function(){var t="";return this._propValues.length&&(t=this._selector+"{"+this._propValues.join(";")+"}"),t}});e.exports={create:function(t){return new n(t)},createClassRule:function(t){return this.create("."+t)},createWebkitScrollbarRules:function(t,e){return[this.create(t+" ::-webkit-scrollbar").bg(e.background),this.create(t+" ::-webkit-scrollbar-thumb").bg(e.thumb),this.create(t+" ::-webkit-scrollbar-thumb:hover").bg(e.active)]},createIEScrollbarRule:function(t,e){var i=["scrollbar-3dlight-color","scrollbar-darkshadow-color","scrollbar-track-color","scrollbar-shadow-color"],n=["scrollbar-face-color","scrollbar-highlight-color"],o=this.create(t);return _.each(i,function(t){o.add(t,e.background)}),_.each(n,function(t){o.add(t,e.thumb)}),o.add("scrollbar-arrow-color",e.active),o},buildAll:function(t){return _.map(t,function(t){return t.build()}).join("")}}},{}],40:[function(t,e,i){"use strict";function n(t){var e=[a.grid(t.grid),a.scrollbar(t.scrollbar),a.toolbar(t.toolbar),a.selection(t.selection)],i=t.cell;return i&&(e=e.concat([a.cell(i.normal),a.cellDummy(i.dummy),a.cellEditable(i.editable),a.cellEvenRow(i.evenRow),a.cellHead(i.head),a.cellRequired(i.required),a.cellDisabled(i.disabled),a.cellInvalid(i.invalid),a.cellCurrentRow(i.currentRow),a.cellSelectedHead(i.selectedHead),a.cellFocused(i.focused)])),e.join("")}function o(t){var e=n(t);$("#"+r).remove(),s.appendStyleElement(r,e)}var s=t("../common/util"),a=t("./styleGenerator"),l=t("../common/constMap").themeName,r="tui-grid-theme-style",u={};u[l.DEFAULT]=t("./preset/default"),u[l.STRIPED]=t("./preset/striped"),u[l.CLEAN]=t("./preset/clean"),e.exports={apply:function(t,e){var i=u[t];i||(i=u[l.DEFAULT]),i=$.extend(!0,{},i,e),o(i)},isApplied:function(){return 1===$("#"+r).length}}},{"../common/constMap":9,"../common/util":12,"./preset/clean":41,"./preset/default":42,"./preset/striped":43,"./styleGenerator":44}],41:[function(t,e,i){"use strict";var n=t("./default");e.exports=$.extend(!0,{},n,{grid:{border:"#c0c0c0"},toolbar:{border:"#e0e0e0"},cell:{normal:{background:"#fff",border:"#e0e0e0",showVerticalBorder:!1,showHorizontalBorder:!0},head:{background:"#fff",border:"#e0e0e0",showVerticalBorder:!1,showHorizontalBorder:!0},selectedHead:{background:"#e0e0e0"}}})},{"./default":42}],42:[function(t,e,i){"use strict";e.exports={grid:{background:"#fff",border:"#ccc",text:"#444"},selection:{background:"#4daaf9",border:"#004082"},toolbar:{border:"#ccc",background:"transparent"},scrollbar:{background:"#f5f5f5",thumb:"#d9d9d9",active:"#c1c1c1"},cell:{normal:{background:"#fbfbfb",border:"#e0e0e0",showVerticalBorder:!0,showHorizontalBorder:!0},head:{background:"#eee",border:"#ccc",showVerticalBorder:!0,showHorizontalBorder:!0},selectedHead:{background:"#d8d8d8"},focused:{border:"#418ed4"},required:{background:"#fffdeb"},editable:{background:"#fff"},disabled:{text:"#b0b0b0"},dummy:{background:"#fff"},invalid:{background:"#ff8080"},evenRow:{},currentRow:{}}}},{}],43:[function(t,e,i){"use strict";var n=t("./default");e.exports=$.extend(!0,{},n,{cell:{normal:{background:"#fff",border:"#e8e8e8",showVerticalBorder:!1,showHorizontalBorder:!1},evenRow:{background:"#f3f3f3"},head:{showVerticalBorder:!0,showHorizontalBorder:!0}}})},{"./default":42}],44:[function(t,e,i){"use strict";function n(t,e){return a(t).bg(e.background).text(e.text).build()}var o=t("./cssRuleBuilder"),s=t("../common/classNameConst"),a=_.bind(o.createClassRule,o);e.exports={grid:function(t){var e=a(s.CONTAINER).bg(t.background).border(t.border).text(t.text),i=a(s.TABLE).border(t.border),n=a(s.HEAD_AREA).border(t.border),l=a(s.BORDER_LINE).bg(t.border),r=a(s.SCROLLBAR_HEAD).border(t.border),u=a(s.SCROLLBAR_BORDER).bg(t.border);return o.buildAll([e,i,n,l,r,u])},scrollbar:function(t){var e=o.createWebkitScrollbarRules("."+s.CONTAINER,t),i=o.createIEScrollbarRule("."+s.CONTAINER,t),n=a(s.SCROLLBAR_RIGHT_BOTTOM).bg(t.background),l=a(s.SCROLLBAR_LEFT_BOTTOM).bg(t.background),r=a(s.SCROLLBAR_HEAD).bg(t.background);return o.buildAll(e.concat([i,n,l,r]))},toolbar:function(t){var e=a(s.TOOLBAR).bg(t.background).border(t.border),i=a(s.HEIGHT_RESIZE_HANDLE).border(t.border);return o.buildAll([e,i])},selection:function(t){return a(s.LAYER_SELECTION).bg(t.background).border(t.border).build()},cell:function(t){var e=a(s.CELL).bg(t.background).border(t.border).borderWidth(t).text(t.text);return e.build()},cellHead:function(t){var e=a(s.CELL_HEAD).bg(t.background).border(t.border).borderWidth(t).text(t.text);return e.build()},cellEvenRow:function(t){return a(s.CELL_ROW_EVEN).bg(t.background).build()},cellSelectedHead:function(t){return o.create("."+s.CELL_HEAD+"."+s.CELL_SELECTED).bg(t.background).text(t.text).build()},cellFocused:function(t){var e=a(s.LAYER_FOCUS_BORDER).bg(t.border),i=a(s.LAYER_EDITING).border(t.border);return o.buildAll([e,i])},cellEditable:function(t){return n(s.CELL_EDITABLE,t)},cellRequired:function(t){return n(s.CELL_REQUIRED,t)},cellDisabled:function(t){return n(s.CELL_DISABLED,t)},cellDummy:function(t){return n(s.CELL_DUMMY,t)},cellInvalid:function(t){return n(s.CELL_INVALID,t)},cellCurrentRow:function(t){return n(s.CELL_CURRENT_ROW,t)}}},{"../common/classNameConst":8,"./cssRuleBuilder":39}],45:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").keyCode,a=t("../common/classNameConst"),l=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:a.CLIPBOARD,events:{keydown:"_onKeyDown",blur:"_onBlur"},_onBlur:function(){var t=this.focusModel;setTimeout(function(){t.refreshState()},0)},_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?void t.preventDefault():(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){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"),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(a.BORDER_LINE+" "+a.BORDER_TOP),$("
").addClass(a.BORDER_LINE+" "+a.BORDER_LEFT),$("
").addClass(a.BORDER_LINE+" "+a.BORDER_RIGHT)]);return this.$el.addClass(a.CONTAINER).attr(s.GRID_ID,this.gridId).append(t),this.dimensionModel.get("scrollX")||this.$el.addClass(a.NO_SCROLL_X),this._appendBottomLine(),this._refreshHeight(),this.trigger("rendered"),this},_appendBottomLine:function(){var t=this.dimensionModel.get("toolbarHeight")+this.dimensionModel.getScrollXHeight(),e=$("
").addClass(a.BORDER_BOTTOM).addClass(a.BORDER_LINE).css("bottom",t);this.dimensionModel.get("scrollY")||e.addClass(a.NO_SCROLL_Y),this.$el.append(e)},destroy:function(){this.stopListening(),$(window).off("resize.grid"),this._destroyChildren(),this.$el.replaceWith(this.__$el),this.$el=this.__$el=null}});e.exports=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/gridEvent":11}],47:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").dimension.CELL_BORDER_WIDTH,s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=n.extend({initialize:function(t){this.renderModel=t.renderModel,this.domState=t.domState,this.inputPainters=t.inputPainters,this.listenTo(this.renderModel,"editingStateChanged",this._onEditingStateChanged)},className:a.LAYER_EDITING+" "+a.CELL_CONTENT,_startEditing:function(t){var e=t.rowKey,i=t.columnName,n=tui.util.pick(t,"columnModel","editOption","type"),o=this._calculateLayoutStyle(e,i,this._isWidthExpandable(n)),a=this.inputPainters[n];this.$el.html(a.generateHtml(t)).attr(s.ROW_KEY,e).attr(s.COLUMN_NAME,i).css(o).show(),this._adjustLeftPosition(),a.focus(this.$el)},_isWidthExpandable:function(t){return _.contains(["checkbox","radio"],t)},_finishEditing:function(){this.$el.removeAttr(s.ROW_KEY),this.$el.removeAttr(s.COLUMN_NAME),this.$el.empty().hide()},_adjustLeftPosition:function(){var t=this.domState.getWidth(),e=this.$el.outerWidth(),i=this.$el.position().left;i+e>t&&this.$el.css("left",t-e)},_adjustCellOffsetValue:function(t){var e=tui.util.browser,i=t;return e.msie&&(9===e.version?i=t-1:e.version>9&&(i=Math.floor(t))),i},_calculateLayoutStyle:function(t,e,i){var n=this.domState.getOffset(),s=this.domState.getElement(t,e),a=s.offset(),l=s.height()+o,r=s.width()+o;return{top:this._adjustCellOffsetValue(a.top)-n.top,left:this._adjustCellOffsetValue(a.left)-n.left,height:l,minWidth:i?r:"",width:i?"":r,lineHeight:l+"px"}},_onEditingStateChanged:function(t){t.isEditing?this._startEditing(t):this._finishEditing()},render:function(){return _.each(this.inputPainters,function(t){t.attachEventHandlers(this.$el,"")},this),this}});e.exports=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],48:[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"),_=t("./rowList"),p=t("./selectionLayer"),M=t("./editingLayer"),C=t("./focusLayer"),w=tui.util.defineClass({init:function(t){this.domState=t.domState,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,focusModel:this.modelManager.focusModel,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 _({el:t.el,whichSide:t.whichSide,bodyTableView:t.bodyTableView,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,dimensionModel:this.modelManager.dimensionModel,selectionModel:this.modelManager.selectionModel,renderModel:this.modelManager.renderModel,focusModel:this.modelManager.focusModel,painterManager:this.painterManager})},createSelectionLayer:function(t){return new p({whichSide:t,selectionModel:this.modelManager.selectionModel,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel})},createEditingLayer:function(){return new M({renderModel:this.modelManager.renderModel,inputPainters:this.painterManager.getInputPainters(!0),domState:this.domState})},createFocusLayer:function(t){return new C({whichSide:t,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel,focusModel:this.modelManager.focusModel})}});e.exports=w},{"./clipboard":45,"./container":46,"./editingLayer":47,"./focusLayer":49,"./layout/body":50,"./layout/bodyTable":51,"./layout/frame-lside":52,"./layout/frame-rside":53,"./layout/header":55,"./layout/resizeHandler":56,"./layout/toolbar":57,"./layout/toolbar/controlPanel":58,"./layout/toolbar/pagination":59,"./layout/toolbar/resizeHandler":60,"./rowList":61,"./selectionLayer":62,"./stateLayer":63}],49:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").dimension.CELL_BORDER_WIDTH,s=t("../common/classNameConst"),a='
',l=n.extend({initialize:function(t){this.focusModel=t.focusModel,this.columnModel=t.columnModel,this.dimensionModel=t.dimensionModel,this.whichSide=t.whichSide,this.borderEl={$top:$(a),$left:$(a),$right:$(a),$bottom:$(a)},this.listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged),this.listenTo(this.focusModel,"blur",this._onBlur),this.listenTo(this.focusModel,"focus",this._onFocus)},className:s.LAYER_FOCUS,_onColumnWidthChanged:function(){var t=this.focusModel;this.$el.is(":visible")&&this._refreshBorderLayout(t.get("rowKey"),t.get("columnName"))},_onBlur:function(){this.$el.hide()},_onFocus:function(t,e){var i=this.columnModel.isLside(e)?"L":"R";i===this.whichSide&&(this._refreshBorderLayout(t,e),this.$el.show())},_onChangeEditingAddress:function(t,e){e?this.$el.hide():this.$el.show()},_refreshBorderLayout:function(t,e){var i=this.dimensionModel.getCellPosition(t,e),n=i.right-i.left,s=i.bottom-i.top;this.borderEl.$left.css({top:i.top,left:i.left,width:o,height:s+o}),this.borderEl.$top.css({top:0===i.top?o:i.top,left:i.left,width:n+o,height:o}),this.borderEl.$right.css({top:i.top,left:i.left+n,width:o,height:s+o}),this.borderEl.$bottom.css({top:i.top+s,left:i.left,width:n+o,height:o})},render:function(){var t=this.$el;return _.each(this.borderEl,function(e){t.append(e)}),t.hide(),this}});e.exports=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],50:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap").attrName,a=t("../../common/classNameConst"),l=200,r=10,u=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)},className:a.BODY_AREA,events:function(){var t={};return t.scroll="_onScroll",t["mousedown ."+a.BODY_CONTAINER]="_onMouseDown",t},_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.closest("td"),a=n.closest("tr"),l=o.attr(s.COLUMN_NAME),r=a.attr(s.ROW_KEY),u=!0,d=_.pick(t,"pageX","pageY","shiftKey");o.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(d,e,l,n.is("input"))},_controlStartAction:function(t,e,i,n){var s=this.selectionModel,a=e.column,l=e.row,r=!0;s.isEnabled()&&(o.isMetaColumn(i)?"_number"===i?this._updateSelectionByRow(l,t.shiftKey):r=!1:(s.setState("cell"),t.shiftKey&&!n?s.update(l,a):(r=this._doFocusAtAndCheckDraggable(l,a),s.end())),!n&&r&&(this.dimensionModel.refreshLayout(),this._attachDragEvents(t.pageX,t.pageY)))},_updateSelectionByRow:function(t,e){e?this.selectionModel.update(t,0,"row"):this.selectionModel.selectRow(t)},_doFocusAtAndCheckDraggable:function(t,e){var i=(new Date).getTime(),n=this.focusModel.focusAt(t,e),o=(new Date).getTime(),s=o-i>l;return n&&!s},_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._getMouseMoveDistance(t.pageX,t.pageY)>r;(this.selectionModel.hasSelection()||e)&&this.selectionModel.updateByMousePosition(t.pageX,t.pageY)},_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=$("
").addClass(a.BODY_CONTAINER),this.$el.append(this.$container),this._addChildren([this.viewFactory.createBodyTable(t),this.viewFactory.createSelectionLayer(t),this.viewFactory.createFocusLayer(t)]),this.$container.append(this._renderChildren()),this._resetContainerHeight(),this}});e.exports=u},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],51:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap"),a=t("../../common/classNameConst"),l=s.dimension.CELL_BORDER_WIDTH,r=s.attrName.COLUMN_NAME,u=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()},className:a.BODY_TABLE_CONTAINER,template:_.template('<%=colGroup%><%=tbody%>
'),templateCol:_.template('="<%=columnName%>" style="width:<%=width%>px">'),_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-u.EXTRA_WIDTH+l),i+=t+l},this),o.isBrowserIE7()&&this.$el.width(i)},_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},_attachAllTableEventHandlers:function(){var t=this.painterManager.getCellPainters();_.each(t,function(t){t.attachEventHandlers(this.$el,"")},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){n+=this.templateCol({attrColumnName:r,columnName:t.columnName,width:e[i]-u.EXTRA_WIDTH+l})},this),n}},{EXTRA_WIDTH:o.isBrowserIE7()?20:0});e.exports=u},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],52:[function(t,e,i){"use strict";var n=t("./frame"),o=t("../../common/classNameConst"),s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"L"})},className:o.LSIDE_AREA,_onColumnWidthChanged:function(){this.$el.css({width:this.dimensionModel.get("lsideWidth")})},beforeRender:function(){this.$el.css({display:"block",width:this.dimensionModel.get("lsideWidth")})},afterRender:function(){var t,e=this.dimensionModel;e.get("scrollX")&&(t=$("
").addClass(o.SCROLLBAR_LEFT_BOTTOM).css("bottom",e.get("toolbarHeight")),this.$el.append(t))}});e.exports=s},{"../../common/classNameConst":8,"./frame":54}],53:[function(t,e,i){"use strict";var n=t("./frame"),o=t("../../common/classNameConst"),s=t("../../common/constMap").dimension.CELL_BORDER_WIDTH,a=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:o.RSIDE_AREA,_onColumnWidthChanged:function(){this._refreshLayout()},_refreshLayout:function(){var t=this.dimensionModel,e=t.get("rsideWidth"),i=t.get("lsideWidth");i>0&&!t.isDivisionBorderDoubled()&&(e+=s, -i-=s),this.$el.css({width:e,marginLeft:i})},_resetScrollBorderHeight:function(){var t,e;this.$scrollBorder&&(t=this.dimensionModel,e=t.get("bodyHeight")-t.getScrollXHeight(),this.$scrollBorder.height(e))},beforeRender:function(){this.$el.css("display","block"),this._refreshLayout()},afterRender:function(){var t,e,i,n,s=this.dimensionModel;s.get("scrollY")&&(n=s.get("headerHeight"),t=$("
").addClass(o.SCROLLBAR_HEAD),e=$("
").addClass(o.SCROLLBAR_BORDER),t.height(n-2),e.css("top",n+"px"),this.$el.append(t,e),s.get("scrollX")&&(i=$("
").addClass(o.SCROLLBAR_RIGHT_BOTTOM).css("bottom",s.get("toolbarHeight")),this.$el.append(i)),this.$scrollBorder=e,this._resetScrollBorderHeight())}});e.exports=a},{"../../common/classNameConst":8,"../../common/constMap":9,"./frame":54}],54:[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).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged)},render:function(){var t=this.viewFactory;return this.$el.empty(),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}],55:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap"),a=t("../../common/classNameConst"),l=10,r=s.attrName.COLUMN_NAME,u=s.dimension.CELL_BORDER_WIDTH,d=s.dimension.TABLE_BORDER_WIDTH,c=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({renderModel:t.renderModel,dimensionModel:t.dimensionModel,selectionModel:t.selectionModel,focusModel:t.focusModel,columnModel:t.columnModel,dataModel:t.dataModel,viewFactory:t.viewFactory,timeoutForAllChecked:0,whichSide:t.whichSide||"R"}),this.listenTo(this.renderModel,"change:scrollLeft",this._onScrollLeftChange).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged).listenTo(this.selectionModel,"change:range",this._refreshSelectedHeaders).listenTo(this.focusModel,"change:columnName",this._refreshSelectedHeaders).listenTo(this.dataModel,"change:_button",this._onCheckCountChange).listenTo(this.dataModel,"sortChanged",this._updateBtnSortState)},className:a.HEAD_AREA,events:{click:"_onClick","mousedown th":"_onMouseDown"},template:_.template('<%=colGroup%><%=tBody%>
'),templateHeader:_.template('="<%=columnName%>" class="<%=className%>" height="<%=height%>" <%if(colspan > 0) {%>colspan=<%=colspan%> <%}%><%if(rowspan > 0) {%>rowspan=<%=rowspan%> <%}%>><%=title%><%=btnSort%>'),templateCol:_.template('="<%=columnName%>" style="width:<%=width%>px">'),markupBtnSort:'',_getColGroupMarkup:function(){var t=this._getColumnData(),e=t.widthList,i=t.modelList,n=[];return _.each(e,function(t,e){n.push(this.templateCol({attrColumnName:r,columnName:i[e].columnName,width:t+u}))},this),n.join("")},_getSelectedColumnNames:function(){var t=this.selectionModel.get("range").column,e=this.columnModel.getVisibleColumnModelList(),i=e.slice(t[0],t[1]+1);return _.pluck(i,"columnName")},_getContainingMergedColumnNames:function(t){var e=this.columnModel,i=_.pluck(e.get("columnMerge"),"columnName");return _.filter(i,function(i){var n=e.getUnitColumnNamesIfMerged(i);return _.every(n,function(e){return _.contains(t,e)})})},_refreshSelectedHeaders:function(){var t,e,i=this.$el.find("th");this.selectionModel.hasSelection()?t=this._getSelectedColumnNames():this.focusModel.has(!0)&&(t=[this.focusModel.get("columnName")]),i.removeClass(a.CELL_SELECTED),t&&(e=this._getContainingMergedColumnNames(t),_.each(t.concat(e),function(t){i.filter("["+r+"="+t+"]").addClass(a.CELL_SELECTED)}))},_onMouseDown:function(t){var e,i;this.selectionModel.isEnabled()&&!$(t.target).is("a."+a.BTN_SORT)&&(e=$(t.target).closest("th").attr(r),e&&(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(r);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){return _.some(t,function(t){return o.isMetaColumn(t)})},_onSelectStart:function(t){return t.preventDefault(),!1},_onCheckCountChange:function(){"checkbox"===this.columnModel.get("selectType")&&(clearTimeout(this.timeoutForAllChecked),this.timeoutForAllChecked=setTimeout($.proxy(this._syncCheckState,this),l))},_getHeaderMainCheckbox:function(){return this.$el.find("th["+r+"=_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+u)})},_onScrollLeftChange:function(t,e){"R"===this.whichSide&&(this.el.scrollLeft=e)},_onClick:function(t){var e=$(t.target),i=e.closest("th").attr(r);"_button"===i&&e.is("input")?e.prop("checked")?this.dataModel.checkAll():this.dataModel.uncheckAll():e.is("a."+a.BTN_SORT)&&this.dataModel.sortByField(i)},_updateBtnSortState:function(t){this._$currentSortBtn&&this._$currentSortBtn.removeClass(a.BTN_SORT_DOWN+" "+a.BTN_SORT_UP),this._$currentSortBtn=this.$el.find("th["+r+"="+t.columnName+"] a."+a.BTN_SORT),this._$currentSortBtn.addClass(t.isAscending?a.BTN_SORT_UP:a.BTN_SORT_DOWN)},render:function(){return this._destroyChildren(),"R"!==this.whichSide||this.dimensionModel.get("scrollY")||this.$el.addClass(a.NO_SCROLL_Y),this.$el.css({height:this.dimensionModel.get("headerHeight")-d}).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"),l=new Array(n),u=new Array(n),d=[],c=o.getRowHeight(n,s)-1,h=1;return _.each(i,function(e,o){var m=i[o].length,g=0;_.each(e,function(e,i){var o=e.columnName,f=[a.CELL,a.CELL_HEAD];e.isRequired&&f.push(a.CELL_REQRUIRED),h=m-1===i&&n-m+1>1?n-m+1:1,t=c*h,i===m-1?t=s-g-2:g+=t+1,u[i]===o?(l[i].pop(),d[i]+=1):d[i]=1,u[i]=o,l[i]=l[i]||[],l[i].push(this.templateHeader({attrColumnName:r,columnName:o,className:f.join(" "),height:t,colspan:d[i],rowspan:h,title:e.title,btnSort:e.isSortable?this.markupBtnSort:""}))},this)},this),e=_.map(l,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=c},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],56:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/constMap").attrName,s=t("../../common/classNameConst"),a=t("../../common/constMap").dimension.CELL_BORDER_WIDTH,l=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)},className:s.COLUMN_RESIZE_CONTAINER,events:function(){var t={};return t["mousedown ."+s.COLUMN_RESIZE_HANDLE]="_onMouseDown",t["dblclick ."+s.COLUMN_RESIZE_HANDLE]="_onDblClick",t},template:_.template("
'),_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=this._getColumnData(),e=t.modelList,i=this.dimensionModel.get("headerHeight"),n=e.length,o=_.map(e,function(t,e){return this.template({lastClass:e+1===n?s.COLUMN_RESIZE_HANDLE_LAST:"",columnIndex:e,columnName:t.columnName,height:i})},this);return o.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=this._getColumnData(),e=t.widthList,i=this.$el.find("."+s.COLUMN_RESIZE_HANDLE),n=0;tui.util.forEachArray(i,function(t,o){var s=i.eq(o),l=Math.ceil(s.width()/2);n+=e[o]+a,s.css("left",n-l)})},_isResizing:function(){return!!this.isResizing},_onMouseDown:function(t){this._startResizing($(t.target))},_onDblClick:function(t){var e=$(t.target),i=parseInt(e.attr(o.COLUMN_INDEX),10);this.dimensionModel.restoreColumnWidth(this._getHandlerColumnIndex(i)),this._refreshHandlerPosition()},_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(o.COLUMN_INDEX),10),this.$target.css("left",e),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;this.isResizing=!0,this.$target=t,this.initialLeft=parseInt(t.css("left").replace("px",""),10),this.initialOffsetLeft=this.$el.offset().left,this.initialWidth=i[t.attr(o.COLUMN_INDEX)],$("body").css("cursor","col-resize"),$(document).bind("mousemove",$.proxy(this._onMouseMove,this)).bind("mouseup",$.proxy(this._onMouseUp,this)),t[0].setCapture&&t[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=l},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9}],57:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/classNameConst"),s=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.toolbarModel=t.toolbarModel,this.dimensionModel=t.dimensionModel,this.viewFactory=t.viewFactory},className:o.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=s},{"../../base/view":7,"../../common/classNameConst":8}],58:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=t("../../../common/classNameConst"),s=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:function(){var t={};return t["click ."+o.BTN_EXCEL]="_onClickExcel",t},className:o.TOOLBAR_BTN_HOLDER,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(o.BTN_EXCEL_PAGE)?n.download("excel"):e.hasClass(o.BTN_EXCEL_ALL)&&n.download("excelAll"))},render:function(){var t=this.toolbarModel;return this.$el.empty(),t.get("isExcelButtonVisible")&&this.$el.append(this.templateExcelBtn({className:o.BTN_EXCEL_PAGE,text:"엑셀 다운로드"})),t.get("isExcelAllButtonVisible")&&this.$el.append(this.templateExcelBtn({className:o.BTN_EXCEL_ALL,text:"전체 엑셀 다운로드"})),this}});e.exports=s},{"../../../base/view":7,"../../../common/classNameConst":8}],59:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=t("../../../common/classNameConst"),s=n.extend({initialize:function(t){this.toolbarModel=t.toolbarModel},className:o.PAGINATION,htmlString:'FirstPrev NextLastFirst OffPrev OffNext OffLast Off',render:function(){return this._destroyChildren(),this.$el.empty().html(this.htmlString),this._setPaginationInstance(),this},_setPaginationInstance:function(){var t=tui&&tui.component&&tui.component.Pagination,e=this.toolbarModel.get("pagination");!e&&t&&(e=new t({classPrefix:o.PREFIX,itemCount:1,itemPerPage:1,pagePerPageList:5,isCenterAlign:!0,moveUnit:"page",$preOff:this.$el.find("."+o.PAGINATION_PRE_OFF),$pre_endOff:this.$el.find("."+o.PAGINATION_PRE_END_OFF),$nextOff:this.$el.find("."+o.PAGINATION_NEXT_OFF),$lastOff:this.$el.find("."+o.PAGINATION_NEXT_END_OFF)},this.$el)),this.toolbarModel.set("pagination",e)}});e.exports=s},{"../../../base/view":7,"../../../common/classNameConst":8}],60:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=t("../../../common/classNameConst"),s=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.timeoutIdForResize=0},className:o.HEIGHT_RESIZE_BAR,htmlString:'',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.htmlString),this},destroy:function(){this.stopListening(),this._onMouseUp(),this._destroyChildren(),this.remove()}});e.exports=s},{"../../../base/view":7,"../../../common/classNameConst":8}],61:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=n.extend({initialize:function(t){var e=t.focusModel,i=t.renderModel,n=t.selectionModel,o=t.whichSide||"R";this.setOwnProperties({whichSide:o,bodyTableView:t.bodyTableView,focusModel:e,renderModel:i,selectionModel:n,dataModel:t.dataModel,columnModel:t.columnModel,collection:i.getCollection(o),painterManager:t.painterManager,sortOptions:null,renderedRowKeys:null}),this.listenTo(this.collection,"change",this._onModelChange).listenTo(this.collection,"restore",this._onModelRestore).listenTo(e,"change:rowKey",this._refreshFocusedRow).listenTo(i,"rowListChanged",this.render),"L"===this.whichSide&&this.listenTo(e,"change:rowKey",this._refreshSelectedMetaColumns).listenTo(n,"change:range",this._refreshSelectedMetaColumns).listenTo(i,"rowListChanged",this._refreshSelectedMetaColumns)},_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(l.isInnerHtmlOfTbodyReadOnly)t=this.bodyTableView.redrawTable(e),this.setElement(t,!1),o.isBrowserIE7()&&t.width(t.width());else try{this.$el[0].innerHTML=e}catch(i){l.isInnerHtmlOfTbodyReadOnly=!0,this._resetRows()}},_getRowsHtml:function(t){var e=this.painterManager.getRowPainter(),i=_.pluck(this._getColumnModelList(),"columnName");return _.map(t,function(t){return e.generateHtml(t,i)}).join("")},_getRowElement:function(t){return this.$el.find("tr["+s.ROW_KEY+"="+t+"]")},_refreshSelectedMetaColumns:function(){var t,e=this.$el.find("tr"),i="."+a.CELL_HEAD;t=this.selectionModel.hasSelection()?this._filterRowsByIndexRange(e,this.selectionModel.get("range").row):this._filterRowByKey(e,this.focusModel.get("rowKey")),e.find(i).removeClass(a.CELL_SELECTED),t.find(i).addClass(a.CELL_SELECTED)},_filterRowsByIndexRange:function(t,e){var i,n,o=this.renderModel,s=o.get("startIndex");return i=Math.max(e[0]-s,0),n=Math.max(e[1]-s+1,0),i||n?t.slice(i,n):$()},_filterRowByKey:function(t,e){var i=this.dataModel.indexOfRowKey(e),n=this.renderModel.get("startIndex");return n>i?$():t.eq(i-n)},_refreshFocusedRow:function(){var t=this.focusModel.get("rowKey"),e=this.focusModel.get("prevRowKey");this._setFocusedRowClass(e,!1),this._setFocusedRowClass(t,!0)},_setFocusedRowClass:function(t,e){var i=_.pluck(this._getColumnModelList(),"columnName"),n={};_.each(i,function(i){var o,l=this.dataModel.getMainRowKey(t,i);n[l]||(n[l]=this._getRowElement(l)),o=n[l].find("td["+s.COLUMN_NAME+"="+i+"]"),o.toggleClass(a.CELL_CURRENT_ROW,e)},this)},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},_onModelChange:function(t){var e=this._getRowElement(t.get("rowKey"));this.painterManager.getRowPainter().refresh(t.changed,e)},_onModelRestore:function(t){var e=this.dataModel.getElement(t.rowKey,t.columnName),i=this.columnModel.getEditType(t.columnName);this.painterManager.getCellPainter(i).refresh(t,e)}},{isInnerHtmlOfTbodyReadOnly:tui.util.browser.msie&&tui.util.browser.version<=9});e.exports=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],62:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/classNameConst"),a=t("../common/constMap").dimension.CELL_BORDER_WIDTH,l=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)},className:s.LAYER_SELECTION,_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),n=o.getHeight(t[1]-t[0]+1,e)-a;return{top:i+"px",height:n+"px"}},_getHorizontalStyles:function(t){var e=this.columnWidthList,i=this.columnModel.getVisibleMetaColumnCount(),n=t[0],o=t[1],s=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?s+=e[r]+a:l+=e[r]+a;return l-=a,{left:s+"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=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],63:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").renderState,s=t("../common/classNameConst"),a=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.renderModel=t.renderModel,this.timeoutIdForDelay=null,this.listenTo(this.dimensionModel,"change",this._refreshLayout),this.listenTo(this.renderModel,"change:state",this.render)},className:s.LAYER_STATE,template:_.template('
<%= text %> <% if (isLoading) { %>
<% } %>
'),render:function(){var t=this.renderModel.get("state");return t===o.DONE?this.$el.hide():this._showLayer(t),this},_showLayer:function(t){var e=this.template({text:this._getMessage(t),isLoading:t===o.LOADING});this.$el.html(e).show(),this._refreshLayout()},_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=a},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}]},{},[14]); \ 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 d=new Error("Cannot find module '"+a+"'");throw d.code="MODULE_NOT_FOUND",d}var u=i[a]={exports:{}};e[a][0].call(u.exports,function(t){var i=e[a][1][t];return o(i?i:t)},u,u.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=new l(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=new l({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=new l({httpStatus:n,requestType:e.requestType,requestParameter:e.data,responseData:null});this.renderModel.set("state",r.DONE),this.trigger("response",o),o.isStopped()||(this.trigger("errorResponse",o),o.isStopped()||i.readyState>1&&alert("데이터 요청 중에 에러가 발생하였습니다.\n\n다시 시도하여 주시기 바랍니다."))}});e.exports=u},{"../base/view":7,"../common/constMap":9,"../common/formUtil":10,"../common/gridEvent":11,"../common/util":12,"./net-router":1}],3:[function(t,e,i){"use strict";var n=t("./common"),o=Backbone.Collection.extend({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({});_.assign(o.prototype,n),e.exports=o},{"./common":4}],6:[function(t,e,i){"use strict";var n=t("../common/constMap").attrName,o=tui.util.defineClass({init:function(t){this.controller=t.controller},events:{},selector:"",_getCellAddress:function(t){var e=t.closest("["+n.ROW_KEY+"]");return{rowKey:e.attr(n.ROW_KEY),columnName:e.attr(n.COLUMN_NAME)}},attachEventHandlers:function(t,e){_.each(this.events,function(i,n){var o=_.bind(this[i],this),s=e+" "+this.selector;t.on(n,s,o)},this)},generateHtml:function(){throw new Error("implement generateHtml() method")}});e.exports=o},{"../common/constMap":9}],7:[function(t,e,i){"use strict";var n=t("./common"),o=Backbone.View.extend({initialize:function(){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,_.compact(t))},_renderChildren:function(){var t=_.map(this._children,function(t){return t.render().el});return t},destroy:function(){this.stopListening(),this._destroyChildren(),this.remove()},_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="tui-grid-",o={CONTAINER:"container",CLIPBOARD:"clipboard",NO_SCROLL_X:"no-scroll-x",NO_SCROLL_Y:"no-scroll-y",ICO_ARROW:"icon-arrow",ICO_ARROW_LEFT:"icon-arrow-left",ICO_ARROW_RIGHT:"icon-arrow-right",LAYER_STATE:"layer-state",LAYER_STATE_CONTENT:"layer-state-content",LAYER_STATE_LOADING:"layer-state-loading",LAYER_EDITING:"layer-editing",LAYER_FOCUS:"layer-focus",LAYER_FOCUS_BORDER:"layer-focus-border",LAYER_SELECTION:"layer-selection",LAYER_DATE_PICKER:"layer-datepicker",BORDER_LINE:"border-line",BORDER_TOP:"border-line-top",BORDER_LEFT:"border-line-left",BORDER_RIGHT:"border-line-right",BORDER_BOTTOM:"border-line-bottom",CONTENT_AREA:"content-area",LSIDE_AREA:"lside-area",RSIDE_AREA:"rside-area",HEAD_AREA:"head-area",BODY_AREA:"body-area",COLUMN_RESIZE_CONTAINER:"column-resize-container",COLUMN_RESIZE_HANDLE:"column-resize-handle",COLUMN_RESIZE_HANDLE_LAST:"column-resize-handle-last",BODY_CONTAINER:"body-container",BODY_TABLE_CONTAINER:"table-container",SCROLLBAR_HEAD:"scrollbar-head",SCROLLBAR_BORDER:"scrollbar-border",SCROLLBAR_RIGHT_BOTTOM:"scrollbar-right-bottom",SCROLLBAR_LEFT_BOTTOM:"scrollbar-left-bottom",PAGINATION:"pagination",PAGINATION_PRE:"pre",PAGINATION_PRE_OFF:"pre-off",PAGINATION_PRE_END:"pre-end",PAGINATION_PRE_END_OFF:"pre-end-off",PAGINATION_NEXT:"next",PAGINATION_NEXT_OFF:"next-off",PAGINATION_NEXT_END:"next-end",PAGINATION_NEXT_END_OFF:"next-end-off",TABLE:"table",CELL:"cell",CELL_HEAD:"cell-head",CELL_ROW_ODD:"cell-row-odd",CELL_ROW_EVEN:"cell-row-even",CELL_EDITABLE:"cell-editable",CELL_DUMMY:"cell-dummy",CELL_REQUIRED:"cell-required",CELL_DISABLED:"cell-disabled",CELL_SELECTED:"cell-selected",CELL_INVALID:"cell-invalid",CELL_ELLIPSIS:"cell-ellipsis",CELL_CURRENT_ROW:"cell-current-row",CELL_MAIN_BUTTON:"cell-main-button",CELL_CONTENT:"cell-content",CELL_CONTENT_BEFORE:"content-before",CELL_CONTENT_AFTER:"content-after",CELL_CONTENT_INPUT:"content-input",BTN_TEXT:"btn-text",BTN_SORT:"btn-sorting",BTN_SORT_UP:"btn-sorting-up",BTN_SORT_DOWN:"btn-sorting-down",BTN_EXCEL:"btn-excel-download",BTN_EXCEL_ICON:"btn-excel-icon",BTN_EXCEL_PAGE:"btn-excel-page",BTN_EXCEL_ALL:"btn-excel-all",TOOLBAR:"toolbar",TOOLBAR_BTN_HOLDER:"toolbar-btn-holder",HEIGHT_RESIZE_BAR:"height-resize-bar",HEIGHT_RESIZE_HANDLE:"height-resize-handle",CALENDAR:"calendar",CALENDAR_BTN_PREV_YEAR:"calendar-btn-prev-year",CALENDAR_BTN_NEXT_YEAR:"calendar-btn-next-year",CALENDAR_BTN_PREV_MONTH:"calendar-btn-prev-month",CALENDAR_BTN_NEXT_MONTH:"calendar-btn-next-month",CALENDAR_SELECTABLE:"calendar-selectable",CALENDAR_SELECTED:"calendar-selected"},i=_.mapObject(o,function(t){return n+t});i.PREFIX=n,e.exports=i},{}],9:[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},attrName:{ROW_KEY:"data-row-key",COLUMN_NAME:"data-column-name",COLUMN_INDEX:"data-column-index",EDIT_TYPE:"data-edit-type",GRID_ID:"data-grid-id"},themeName:{DEFAULT:"default",STRIPED:"striped",CLEAN:"clean"},selectionType:{CELL:"CELL",ROW:"ROW",COLUMN:"COLUMN"}}},{}],10:[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);t.selectedIndex=_.findIndex(i,function(t){return t.value===e||t.text===e})},"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")[String(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},{}],11:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){this._stopped=!1,this.setData(t)},setData:function(t){_.extend(this,t)},stop:function(){this._stopped=!0},isStopped:function(){return this._stopped}});e.exports=n},{}],12:[function(t,e,i){"use strict";var n=t("./constMap").dimension.CELL_BORDER_WIDTH,o={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+n)},getDisplayRowCount:function(t,e){return Math.ceil(t/(e+n))},getRowHeight:function(t,e){return 0===t?0:Math.floor((e-n)/t)},isMetaColumn:function(t){return _.contains(["_button","_number"],t)},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},isBlank:function(t){return _.isString(t)?!t.length:_.isUndefined(t)||_.isNull(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},toString:function(t){return _.isUndefined(t)||_.isNull(t)?"":String(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=JSON.stringify(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=JSON.parse(n)}catch(s){}_.isNull(n)||(i[e]=n)}),i},convertValueType:function(t,e){return"string"===e?String(t):"number"===e?Number(t):"boolean"===e?Boolean(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},appendStyleElement:function(t,e){var i=document.createElement("style");i.type="text/css",i.id=t,i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e)),document.getElementsByTagName("head")[0].appendChild(i)}};e.exports=o},{"./constMap":9}],13:[function(t,e,i){"use strict";var n=t("./common/constMap").attrName,o=tui.util.defineClass({init:function(t){this.$el=t},getElement:function(t,e){return this.$el.find("tr["+n.ROW_KEY+"="+t+"]").find("td["+n.COLUMN_NAME+"="+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=o},{"./common/constMap":9}],14:[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"),d=t("./painter/controller"),u=t("./addon/net"),c=t("./common/util"),h=t("./theme/manager"),m=t("./common/constMap").themeName,g={};tui=window.tui=tui||{},tui.Grid=n.extend({initialize:function(t){var e=new a(this.$el);this.id=c.getUniqueKey(),this.modelManager=this._createModelManager(t,e),this.painterManager=this._createPainterManager(),this.container=this._createContainerView(t,e),this.publicEventEmitter=this._createPublicEventEmitter(),this.container.render(),this.refreshLayout(),h.isApplied()||h.apply(m.DEFAULT),this.addOn={},g[this.id]=this},_createModelManager:function(t,e){var i=_.assign({},t,{gridId:this.id});return _.omit(i,"el","singleClickEdit"),new o(i,e)},_createPainterManager:function(){var t=new d({focusModel:this.modelManager.focusModel,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,selectionModel:this.modelManager.selectionModel});return new r({gridId:this.id,selectType:this.modelManager.columnModel.get("selectType"),controller:t})},_createContainerView:function(t,e){var i=new s({modelManager:this.modelManager,painterManager:this.painterManager,domState:e});return i.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?JSON.stringify(i):i},getCheckedRowList:function(t){var e=this.modelManager.dataModel.getRowList(!0);return t?JSON.stringify(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){var e=this.modelManager.columnModel.at(0,!0);this.modelManager.focusModel.focus(t,e.columnName)},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,e){this.modelManager.dataModel.sortByField(t,e)},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 g[t]},tui.Grid.applyTheme=function(t,e){h.apply(t,e)}},{"./addon/net":2,"./base/view":7,"./common/constMap":9,"./common/util":12,"./domState":13,"./model/manager":21,"./painter/controller":29,"./painter/manager":36,"./publicEventEmitter":38,"./theme/manager":40,"./view/factory":49}],15:[function(t,e,i){"use strict";var n=t("../../base/model"),o=t("../../common/util"),s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.textType={normal:!0,text:!0,password:!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,align:"center",editOption:{type:"mainButton"},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&&ea;a+=1)s=t[a],s[u]=l[u],s._extraData=s._extraData||{},n(s,u,{count:o,isMainRow:!1,mainRowKey:d}),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=_.isUndefined(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?JSON.stringify(n):n},getRowDataAt:function(t,e){var i=this.at(t),n=i?i.toJSON():null;return e?JSON.stringify(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?JSON.stringify(i):i},setColumnValues:function(t,e,i,n){var o={},s={isDisabled:!1,isEditable:!0};o[t]=e,i=_.isUndefined(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=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?JSON.stringify(t)!==JSON.stringify(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},replaceRowList:function(t,e,i){t||(t=[]),_.isUndefined(e)&&(e=!0),this.trigger("beforeReset",t.length),this.lastRowKey=-1,this.reset(t,{parse:e}),_.isFunction(i)&&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","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),d=this.columnModel,u={};for(r||(r=this.append({})[0]),o=i;n>=o;o+=1)s=d.at(o,!0).columnName,a=r.getCellState(s),l=r.getRowSpanData(s),a.isEditable&&!a.isDisabled&&(!l||l.count>=0)&&(u[s]=t[o-i]);r.set(u)},getElement:function(t,e){var i=this.getMainRowKey(t,e);return this.domState.getElement(i,e)}});e.exports=s},{"../../base/collection":3,"./row":17}],19:[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=t+1+(this.isDivisionBorderDoubled()?1:0),n=i*l,o=e-this.getScrollYWidth()-n;return o},_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;this.set("totalRowHeight",o.getHeight(e,t))},_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}),i.length&&(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=this.columnModel.getVisibleColumnModelList(null,!0),e=this.get("minimumColumnWidth"),i=[],n=[],s=[];_.each(t,function(t){var a=t.width>0?t.width:0,l=Math.max(a,e);o.isMetaColumn(t.columnName)&&(l=a),i.push(a?l:0),s.push(l),n.push(!!t.isFixedWidth)},this),this._columnWidthFixedFlags=n,this._minColumnWidthList=s,this._setColumnWidthVariables(this._calculateColumnWidth(i),!0)},_calculateColumnWidth:function(t){return t=this._fillEmptyColumnWidth(t),t=this._applyMinimumColumnWidth(t),t=this._adjustColumnWidthList(t)},isDivisionBorderDoubled:function(){return this.columnModel.getVisibleColumnFixCount()>0},getFrameWidth:function(t){var e=this.columnModel.getVisibleColumnFixCount(!0),i=this.getColumnWidthList(t),n=this._getFrameWidth(i);return _.isUndefined(t)&&e>0&&(n+=l),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},_getCellHorizontalPosition:function(t){for(var e=this.columnModel,i=e.getVisibleMetaColumnCount(),n=this.get("columnWidthList"),o=e.getVisibleColumnFixCount()+i,s=e.indexOfColumnName(t,!0)+i,a=o>s?0:o,r=0;s>a;a+=1)r+=n[a]+l;return{left:r,right:r+n[s]+l}},_getCellVerticalPosition:function(t,e){var i=this.dataModel,n=this.get("rowHeight"),s=i.indexOfRowKey(t),a=o.getHeight(s,n),l=o.getHeight(e,n);return{top:a,bottom:a+l}},_getRowSpanCount:function(t,e){var i=this.dataModel.get(t).getRowSpanData(e);return i.isMainRow||(t=i.mainRowKey,i=this.dataModel.get(t).getRowSpanData(e)),i.count||1},getCellPosition:function(t,e){var i,n,o;return t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t)?(i=this._getRowSpanCount(t,e),n=this._getCellVerticalPosition(t,i),o=this._getCellHorizontalPosition(e),{top:n.top,bottom:n.bottom,left:o.left,right:o.right}):{}},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"),d=l.get("scrollLeft");return n=t.topr+i.height,e?(s=t.leftd+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(),r=0;return s&&(o+=this.renderModel.get("scrollLeft")),o>=n?r=i.length-1:tui.util.forEachArray(i,function(t,e){return t+=l,r=e,o>t?void(o-=t):!1}),Math.max(0,r-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":9,"../common/util":12}],20:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=t("../common/gridEvent"),a=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.domState=e.domState,this.listenTo(this.dataModel,"reset",this._onResetData)},defaults:{rowKey:null,columnName:"",prevRowKey:null,prevColumnName:"",editingAddress:null},_onResetData:function(){this.unselect(!0)},_savePrevious:function(){null!==this.get("rowKey")&&this.set("prevRowKey",this.get("rowKey")),this.get("columnName")&&this.set("prevColumnName",this.get("columnName"))},_clearPrevious:function(){this.set({prevRowKey:null,prevColumnName:""})},isCurrentCell:function(t,e,i){var n=this.get("columnName"),o=this.get("rowKey");return i&&(o=this.dataModel.getMainRowKey(o,n)),String(o)===String(t)&&n===e},select:function(t){var e=new s,i=this.get("rowKey");return String(i)===String(t)?!0:(e.setData({rowKey:t,prevRowKey:i,rowData:this.dataModel.getRowData(t)}),this.trigger("select",e),e.isStopped()?(this._cancelSelect(),!1):(this.set("rowKey",t),"radio"===this.columnModel.get("selectType")&&this.dataModel.check(t),!0))},_cancelSelect:function(){var t=this.get("prevColumnName");this.set("columnName",t),this.trigger("focus",this.get("rowKey"),t)},unselect:function(t){t&&this.blur(),this.set({rowKey:null})},focus:function(t,e,i){return!this._isValidCell(t,e)||o.isMetaColumn(e)||this.isCurrentCell(t,e)?!0:(this.blur(),this.select(t)?(this.set("columnName",e),this.trigger("focus",t,e),i&&this.scrollToFocus(),!0):!1)},focusAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0),s=!1;return n&&o&&(s=this.focus(n.get("rowKey"),o.columnName,i)),s},focusIn:function(t,e,i){var n=this.focus(t,e,i);return n&&(t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t).isEditable(e)?(this.finishEditing(),this.startEditing(t,e)):this.focusClipboard()),n},focusInAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0),s=!1;return n&&o&&(s=this.focusIn(n.get("rowKey"),o.columnName,i)),s},focusClipboard:function(){this.trigger("focusClipboard")},refreshState:function(){var t;this.domState.hasFocusedElement()?this.has()||(t=this.restore(),t||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(){var t=this.get("columnName");return this.has()?(this.has(!0)&&this._savePrevious(),null!==this.get("rowKey")&&this.set("columnName",""),this.trigger("blur",this.get("rowKey"),t),this):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(t){var e=this.get("rowKey"),i=this.get("columnName");return t?this._isValidCell(e,i):!o.isBlank(e)&&!o.isBlank(i)},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},isEditingCell:function(t,e){var i=this.get("editingAddress");return i&&String(i.rowKey)===String(t)&&i.columnName===e},startEditing:function(t,e){if(this.get("editingAddress"))return!1;if(_.isUndefined(t)&&_.isUndefined(e))t=this.get("rowKey"),e=this.get("columnName");else if(!this.isCurrentCell(t,e,!0))return!1;return t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t).isEditable(e)?(this.set("editingAddress",{rowKey:t,columnName:e}),!0):!1},finishEditing:function(){return this.get("editingAddress")?(this.set("editingAddress",null),!0):!1},_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,o=null;return this.has(!0)&&(e=Math.max(Math.min(n.indexOfRowKey(this.get("rowKey"))+t,this.dataModel.length-1),0),i=n.at(e),i&&(o=i.get("rowKey"))),o},_findColumnName:function(t){var e,i=this.columnModel,n=i.getVisibleColumnModelList(),o=i.indexOfColumnName(this.get("columnName"),!0),s=null;return this.has(!0)&&(e=Math.max(Math.min(o+t,n.length-1),0),s=n[e]&&n[e].columnName),s},_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=a},{"../base/model":5,"../common/gridEvent":11,"../common/util":12}],21:[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"),d=t("./renderer-smart"),u=t("./selection"),c={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}},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.focusModel=this._createFocusModel(e),this.renderModel=this._createRenderModel(t),this.selectionModel=this._createSelectionModel(),this.focusModel.renderModel=this.renderModel,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 u(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,focusModel:this.focusModel},new(n=t.notUseSmartRendering?r:d)(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},{"./data/columnModel":15,"./data/rowList":18,"./dimension":19,"./focus":20,"./renderer":23, +"./renderer-smart":22,"./selection":26,"./toolbar":27}],22:[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),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"),d=this.get("endIndex");return 0!==r&&r+this.criticalPoint>a?!0:d!==s-1&&d-this.criticalPointa&&this.set("state",s.LOADING)},_onEditingAddressChange:function(t,e){var i=e,n=!0,o=this;e||(i=t.previous("editingAddress"),n=!1),this._updateCellData(i.rowKey,i.columnName,{isEditing:n}),this._triggerEditingStateChanged(i.rowKey,i.columnName),_.defer(function(){o._toggleChangeLayoutEventHandlers(n)})},_toggleChangeLayoutEventHandlers:function(t){var e="change:scrollTop change:scrollLeft",i="columnWidthChanged";t?(this.listenToOnce(this.dimensionModel,i,this._onChangeLayoutBound),this.once(e,this._onChangeLayoutBound)):(this.stopListening(this.dimensionModel,i,this._onChangeLayoutBound),this.off(e,this._onChangeLayoutBound))},_triggerEditingStateChanged:function(t,e){var i=this.getCellData(t,e);tui.util.pick(i,"columnModel","editOption","useViewMode")!==!1&&this.trigger("editingStateChanged",i)},_updateCellData:function(t,e,i){var n=this._getRowModel(t,e);n&&n.setCell(e,i)},initializeVariables:function(){this.set({top:0,scrollTop:0,scrollLeft:0,startIndex:0,endIndex:0,startNumber:1})},getCollection:function(t){return this.get(tui.util.isString(t)?t.toLowerCase()+"side":"rside")},_onColumnModelChange:function(){this.set({scrollTop:0,top:0,startIndex:0,endIndex:0}),this.refresh({columnModelChanged:!0})},_onDataModelChange:function(){this.refresh({dataModelChanged:!0})},_onAddDataModel:function(t,e){this.refresh({dataModelChanged:!0}),e.focus&&this.focusModel.focusAt(e.at,0)},_resetDummyRows:function(){this._clearDummyRows(),this._fillDummyRows(),this.trigger("dataModelChanged")},_setRenderingRange:function(){this.set({startIndex:0,endIndex:this.dataModel.length-1})},_createViewDataFromDataModel:function(t,e,i,n){var o={height:i,rowNum:n,rowKey:t.get("rowKey"),_extraData:t.get("_extraData")};return _.each(e,function(e){var i=t.get(e);"_number"===e&&(i=n),o[e]=i}),o},_getColumnNamesOfEachSide:function(){var t=this.columnModel.getVisibleColumnFixCount(!0),e=this.columnModel.getVisibleColumnModelList(null,!0),i=_.pluck(e,"columnName");return{lside:i.slice(0,t),rside:i.slice(t)}},_resetViewModelList:function(t,e){this.get(t).clear().reset(e,{parse:!0})},_resetAllViewModelListWithRange:function(t,e){var i,n,o=this._getColumnNamesOfEachSide(),s=this.get("startNumber")+t,a=this.dimensionModel.get("rowHeight"),l=[],r=[];for(n=t;e>=n;n+=1)i=this.dataModel.at(n),l.push(this._createViewDataFromDataModel(i,o.lside,a,s)),r.push(this._createViewDataFromDataModel(i,o.rside,a,s)),s+=1;this._resetViewModelList("lside",l),this._resetViewModelList("rside",r)},_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),n=this.dimensionModel.get("rowHeight"),o=this.get("endIndex")+2;_.times(i,function(){_.each(["lside","rside"],function(t){this.get(t).add({height:n,rowNum:o})},this),o+=1},this),this.set("dummyRowCount",i)},refresh:function(t){var e,i,n,o=!!t&&t.columnModelChanged,s=!!t&&t.dataModelChanged;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);o?this.trigger("columnModelChanged"):this.trigger("rowListChanged",s),this._refreshState()},_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")},_getRowModel:function(t,e){var i=this._getCollectionByColumnName(e);return i.get(t)},getCellData:function(t,e){var i=this._getRowModel(t,e),n=null;return i&&(n=i.get(e)),n},_executeRelation:function(t){var e,i,n=this.dataModel.at(t),o=t-this.get("startIndex");i=n.executeRelationCallbacksAll(),_.each(i,function(t,i){e=this._getCollectionByColumnName(i).at(o),e&&e.setCell(i,t)},this)}});e.exports=l},{"../base/model":5,"../common/constMap":9,"./rowList":25}],24:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=n.extend({initialize:function(t){var e=t&&t.rowKey,i=this.collection.dataModel,n=i.get(e);this.dataModel=i,this.columnModel=this.collection.columnModel,this.focusModel=this.collection.focusModel,n&&(this.listenTo(n,"change",this._onDataModelChange),this.listenTo(n,"restore",this._onDataModelRestore),this.listenTo(n,"extraDataChanged",this._setRowExtraData),this.listenTo(i,"disabledChanged",this._onDataModelDisabledChanged),this.rowData=n)},idAttribute:"rowKey",_onDataModelChange:function(t){_.each(t.changed,function(e,i){var n,o;this.has(i)&&(n=this.columnModel.getColumnModel(i),o=this.columnModel.isTextType(i),this.setCell(i,this._getValueAttrs(e,t,n,o)))},this)},_onDataModelRestore:function(t){var e=this.get(t);e&&this.trigger("restore",e)},_getColumnNameList:function(){var t=this.collection.columnModel.getVisibleColumnModelList(null,!0);return _.pluck(t,"columnName")},_onDataModelDisabledChanged:function(){var t=this._getColumnNameList();_.each(t,function(t){this.setCell(t,{isDisabled:this.rowData.isDisabled(t),className:this._getClassNameString(t)})},this)},_setRowExtraData:function(){tui.util.isUndefined(this.collection)||_.each(this._getColumnNameList(),function(t){var e,i=this.get(t);!tui.util.isUndefined(i)&&i.isMainRow&&(e=this.rowData.getCellState(t),this.setCell(t,{isDisabled:e.isDisabled,isEditable:e.isEditable,className:this._getClassNameString(t)}))},this)},parse:function(t,e){var i=e.collection;return this._formatData(t,i.dataModel,i.columnModel,i.focusModel)},_formatData:function(t,e,i,n){var o,s,a=t.rowKey,l=t.rowNum;return _.isUndefined(a)?t:(s=e.get(a),o=_.omit(t,"rowKey","_extraData","height","rowNum"),_.each(o,function(o,r){var d=this._getRowSpanData(r,t,e.isRowSpanEnable()),u=s.getCellState(r),c=i.isTextType(r),h=i.getColumnModel(r);t[r]={rowKey:a,rowNum:l,columnName:r,rowSpan:d.count,isMainRow:d.isMainRow,mainRowKey:d.mainRowKey,isEditable:u.isEditable,isDisabled:u.isDisabled,isEditing:n.isEditingCell(a,r),optionList:tui.util.pick(h,"editOption","list"),className:this._getClassNameString(r,s,n),columnModel:h,changed:[]},_.assign(t[r],this._getValueAttrs(o,s,h,c))},this),t)},_getClassNameString:function(t,e,i){var n;return e||(e=this.dataModel.get(this.get("rowKey")))?(i||(i=this.focusModel),n=e.getClassNameList(t),n.join(" ")):""},_getValueAttrs:function(t,e,i,n){var o=tui.util.pick(i,"editOption","beforeContent"),s=tui.util.pick(i,"editOption","afterContent"),a=tui.util.pick(i,"editOption","converter"),l=e.toJSON();return{value:this._getValueToDisplay(t,i,n),formattedValue:this._getFormattedValue(t,l,i),beforeContent:this._getExtraContent(o,t,l),afterContent:this._getExtraContent(s,t,l),convertedHTML:this._getConvertedHTML(a,t,l)}},_getFormattedValue:function(t,e,i){var n=t||"";return _.isFunction(i.formatter)&&(n=i.formatter(n,e,i)),n},_getExtraContent:function(t,e,i){var n="";return _.isFunction(t)?n=t(e,i):tui.util.isExisty(t)&&(n=t),n},_getConvertedHTML:function(t,e,i){var n=null;return _.isFunction(t)&&(n=t(e,i)),n===!1&&(n=null),n},_getValueToDisplay:function(t,e,i){var n=tui.util.isExisty,o=e.notUseHtmlEntity,s=e.defaultValue;return n(t)||(t=n(s)?s:""),i&&!o&&tui.util.hasEncodableString(t)&&(t=tui.util.encodeHTMLEntity(t)),t},_getRowSpanData:function(t,e,i){var n=tui.util.pick(e,"_extraData","rowSpanData",t);return i&&n||(n={mainRowKey:e.rowKey,count:0,isMainRow:!0}),n},updateClassName:function(t){this.setCell(t,{className:this._getClassNameString(t)})},setCell:function(t,e){var i,n,s,a=!1,l=[];this.has(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,{silent:this._shouldSetSilently(s,a)}),a&&(i=this.collection.dataModel.indexOfRowKey(n),this.trigger("valueChange",i))))},_shouldSetSilently:function(t,e){var i=t.isEditing&&e,n=tui.util.pick(t,"columnModel","editOption","useViewMode")!==!1,o=_.contains(t.changed,"isEditing")&&t.isEditing;return i||n&&o}});e.exports=s},{"../base/model":5,"../common/util":12}],25:[function(t,e,i){"use strict";var n=t("../base/collection"),o=t("./row"),s=n.extend({initialize:function(t,e){this.setOwnProperties({dataModel:e.dataModel,columnModel:e.columnModel,focusModel:e.focusModel})},model:o});e.exports=s},{"../base/collection":3,"./row":24}],26:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=t("../common/constMap").selectionType,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,enabled:!0,selectionType: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)},setType:function(t){this.selectionType=s[t]||this.selectionType},getType:function(){return this.selectionType},enable:function(){this.enabled=!0},disable:function(){this.end(),this.enabled=!1},isEnabled:function(){return this.enabled},start:function(t,e,i){this.isEnabled()&&(this.setType(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.enabled||0>t||0>e||(this.hasSelection()?this.setType(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;this.selectionType===s.ROW?e=this.columnModel.getVisibleColumnModelList().length-1:this.selectionType===s.COLUMN&&(t=this.dataModel.length-1),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,this.dataModel.length-1],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.getValueString(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()&&this.selectionType===s.CELL){do n=_.assign([],i.row),i=this._getRowSpannedIndex(i),e=i.row[0]!==n[0]||i.row[1]!==n[1];while(e);this._setRangeMinMax(i.row,i.column)}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]],d=a.at(t.row[0]),u=a.at(t.row[1]),c=$.extend({},t);return d&&u?(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/constMap":9,"../common/util":12}],27:[function(t,e,i){"use strict";var n=t("../base/model"),o=n.extend({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}],28:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.editType=t.editType,this.inputPainter=t.inputPainter,this.selector="td["+s.EDIT_TYPE+"="+this.editType+"]"},events:{dblclick:"_onDblClick"},template:_.template("><%=contentHtml%>"),_onDblClick:function(t){var e;this._isEditableType()&&(e=this._getCellAddress($(t.target)),this.controller.startEditing(e,!0))},_isEditableType:function(){return!_.contains(["normal","mainButton"],this.editType)},_getContentHtml:function(t){var e=t.formattedValue,i=t.beforeContent,n=t.afterContent;return this.inputPainter&&(e=this.inputPainter.generateHtml(t),this._shouldContentBeWrapped()&&!this._isUsingViewMode(t))?(i=this._getSpanWrapContent(i,a.CELL_CONTENT_BEFORE),n=this._getSpanWrapContent(n,a.CELL_CONTENT_AFTER),e=this._getSpanWrapContent(e,a.CELL_CONTENT_INPUT),i+n+e):i+e+n},_isUsingViewMode:function(t){return tui.util.pick(t,"columnModel","editOption","useViewMode")!==!1},_shouldContentBeWrapped:function(){return _.contains(["text","password","select"],this.editType)},_getSpanWrapContent:function(t,e){return tui.util.isFalsy(t)&&(t=""),''+t+""},_getAttributes:function(t){var e=[t.className,a.CELL,a.CELL_CONTENT,t.rowNum%2?a.CELL_ROW_ODD:a.CELL_ROW_EVEN],i={align:t.columnModel.align||"left"};return i["class"]=e.join(" "),i[s.EDIT_TYPE]=this.editType,i[s.ROW_KEY]=t.rowKey,i[s.COLUMN_NAME]=t.columnName,t.rowSpan&&(i.rowspan=t.rowSpan),i},attachEventHandlers:function(t,e){n.prototype.attachEventHandlers.call(this,t,e),this.inputPainter&&this.inputPainter.attachEventHandlers(t,e+" "+this.selector)},generateHtml:function(t){var e=o.getAttributesString(this._getAttributes(t)),i=this._getContentHtml(t);return this.template({attributeString:e,contentHtml:i||"​"})},refresh:function(t,e){var i=["value","isEditing","isDisabled","optionList"],n=_.contains(t.changed,"isEditing")&&t.isEditing,o=_.intersection(i,t.changed).length>0,s=this._getAttributes(t);delete s.rowspan,e.attr(s),n&&!this._isUsingViewMode(t)?this.inputPainter.focus(e):o&&(e.html(this._getContentHtml(t)),e.scrollLeft(0))}});e.exports=l},{"../base/painter":6,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],29:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){this.focusModel=t.focusModel,this.dataModel=t.dataModel,this.columnModel=t.columnModel,this.selectionModel=t.selectionModel},startEditing:function(t,e){var i;return e&&this.focusModel.finishEditing(),i=this.focusModel.startEditing(t.rowKey,t.columnName),i&&this.selectionModel.end(),i},finishEditing:function(t,e,i){var n=this.focusModel;return n.isEditingCell(t.rowKey,t.columnName)?(this.selectionModel.enable(),_.isUndefined(i)||(this.setValue(t,i),this.dataModel.get(t.rowKey).validateCell(t.columnName)),n.finishEditing(),e?n.focusClipboard():_.defer(function(){n.refreshState()}),!0):!1},focusInToNextCell:function(t){var e=this.focusModel,i=e.get("rowKey"),n=e.get("columnName"),o=t?e.prevColumnName():e.nextColumnName();n!==o&&e.focusIn(i,o,!0)},executeCustomInputEventHandler:function(t,e){var i,n=this.columnModel.getColumnModel(e.columnName),o=t.type;"focusin"===o?o="focus":"focusout"===o&&(o="blur"),i=tui.util.pick(n,"editOption","inputEvents",o),_.isFunction(i)&&i.call(t.target,t,e)},appendEmptyRowAndFocus:function(){this.dataModel.append({},{focus:!0})},setValue:function(t,e){this.dataModel.setValue(t.rowKey,t.columnName,e)}});e.exports=n},{}],30:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},events:{dblclick:"_onDblClick"},selector:"td["+s.EDIT_TYPE+"=dummy]",template:_.template("​'),_onDblClick:function(){this.controller.appendEmptyRowAndFocus(!0)},generateHtml:function(t,e){var i=[a.CELL,a.CELL_DUMMY,t%2?a.CELL_ROW_ODD:a.CELL_ROW_EVEN];return o.isMetaColumn(e)&&i.push(a.CELL_HEAD),this.template({columnName:e,className:i.join(" ")})}});e.exports=l},{"../base/painter":6,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],31:[function(t,e,i){"use strict";var n=t("../../base/painter"),o=t("../../common/constMap").keyName,s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},events:{keydown:"_onKeyDown",focusin:"_onFocusIn",focusout:"_onFocusOut"},keyDownActions:{ESC:function(t){this.controller.finishEditing(t.address,!0)},ENTER:function(t){this.controller.finishEditing(t.address,!0,t.value)},TAB:function(t){this.controller.finishEditing(t.address,!0,t.value),this.controller.focusInToNextCell(t.shiftKey)}},_extendKeydownActions:function(t){this.keyDownActions=_.assign({},this.keyDownActions,t)},_extendEvents:function(t){this.events=_.assign({},this.events,t)},_executeCustomEventHandler:function(t){var e=$(t.target),i=this._getCellAddress(e);this.controller.executeCustomInputEventHandler(t,i)},_onFocusIn:function(t){var e=$(t.target),i=this._getCellAddress(e);this._executeCustomEventHandler(t),this.trigger("focusIn",e,i),this.controller.startEditing(i)},_onFocusOut:function(t){var e=$(t.target),i=this._getCellAddress(e);this._executeCustomEventHandler(t),this.trigger("focusOut",e,i),this.controller.finishEditing(i,!1,e.val())},_onKeyDown:function(t){var e=t.keyCode||t.which,i=o[e],n=this.keyDownActions[i],s=$(t.target),a={$target:s,address:this._getCellAddress(s),shiftKey:t.shiftKey,value:s.val()};this._executeCustomEventHandler(t),n&&(n.call(this,a),t.preventDefault())},_getDisplayValue:function(){throw new Error("implement _getDisplayValue() method")},_generateInputHtml:function(){throw new Error("implement _generateInputHtml() method")},_isUsingViewMode:function(t){return tui.util.pick(t,"columnModel","editOption","useViewMode")!==!1},generateHtml:function(t){var e;return e=_.isNull(t.convertedHTML)?!this._isUsingViewMode(t)||t.isEditing?this._generateInputHtml(t):this._getDisplayValue(t):t.convertedHTML},focus:function(t){var e=t.find(this.selector);e.is(":focus")||e.eq(0).focus()}});_.assign(s.prototype,Backbone.Events),e.exports=s},{"../../base/painter":6,"../../common/constMap":9}],32:[function(t,e,i){"use strict";var n=t("./base"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.inputType=t.inputType,this.selector="fieldset[data-type="+this.inputType+"]",this._extendEvents({mousedown:"_onMouseDown"}),this._extendKeydownActions({TAB:function(t){var e;this._focusNextInput(t.$target,t.shiftKey)||(e=this._getCheckedValueString(t.$target),this.controller.finishEditing(t.address,!0,e),this.controller.focusInToNextCell(t.shiftKey))},ENTER:function(t){var e=this._getCheckedValueString(t.$target);this.controller.finishEditing(t.address,!0,e)},LEFT_ARROW:function(t){this._focusNextInput(t.$target,!0)},RIGHT_ARROW:function(t){this._focusNextInput(t.$target)},UP_ARROW:function(){},DOWN_ARROW:function(){}})},template:_.template('
<%=content%>
'),inputTemplate:_.template(' <%=disabled%> />'),labelTemplate:_.template(''),_onFocusOut:function(t){var e=$(t.target),i=this;_.defer(function(){var t,n;e.siblings("input:focus").length||(t=i._getCellAddress(e),n=i._getCheckedValueString(e),i.controller.finishEditing(t,!1,n))})},_onMouseDown:function(t){var e=$(t.target),i=e.closest("fieldset").find("input:focus").length>0;!e.is("input")&&i&&(t.stopPropagation(),t.preventDefault())},_focusNextInput:function(t,e){var i=e?"prevAll":"nextAll",n=t[i]("input");return n.length?(n.first().focus(),!0):!1},_getCheckedValueString:function(t){var e,i=t.parent().find("input:checked"),n=[];return i.each(function(){var t=$(this),e=t.attr("data-value-type"),i=o.convertValueType(t.val(),e);n.push(i)}),e=1===n.length?n[0]:n.join(",")},_getCheckedValueSet:function(t){var e={};return _.each(String(t).split(","),function(t){e[t]=!0}),e},_getDisplayValue:function(t){var e=this._getCheckedValueSet(t.value),i=[];return _.each(t.optionList,function(t){e[t.value]&&i.push(t.text)}),i.join(",")},_generateInputHtml:function(t){var e=this._getCheckedValueSet(t.value),i=o.getUniqueKey(),n="";return _.each(t.optionList,function(o){var s=i+"_"+o.value;n+=this.inputTemplate({type:this.inputType,id:s,name:i,value:o.value,valueType:typeof o.value,checked:e[o.value]?"checked":"",disabled:t.isDisabled?"disabled":""}),o.text&&(n+=this.labelTemplate({id:s,labelText:o.text}))},this),this.template({type:this.inputType,content:n})},focus:function(t){var e=t.find("input");e.is(":focus")||e.eq(0).focus()}});e.exports=s},{"../../common/util":12,"./base":31}],33:[function(t,e,i){"use strict";var n=t("../../base/painter"),o=t("../../common/classNameConst"),s=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.selector="input."+o.CELL_MAIN_BUTTON,this.inputType=t.inputType,this.gridId=t.gridId},events:{change:"_onChange"},template:_.template(' />'),_onChange:function(t){var e=$(t.target),i=this._getCellAddress(e);this.controller.setValue(i,e.is(":checked"))},generateHtml:function(t){return this.template({type:this.inputType,name:this.gridId,checked:t.value?"checked":""})}});e.exports=s},{"../../base/painter":6,"../../common/classNameConst":8}],34:[function(t,e,i){"use strict";var n=t("./base"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.selector="select"},template:_.template(''),optionTemplate:_.template(''),_getDisplayValue:function(t){var e=_.find(t.optionList,function(e){return String(e.value)===String(t.value)});return e?e.text:""},_generateInputHtml:function(t){var e=_.reduce(t.optionList,function(e,i){return e+this.optionTemplate({value:i.value,text:i.text,selected:String(t.value)===String(i.value)?"selected":""})},"",this);return this.template({name:o.getUniqueKey(),disabled:t.isDisabled?"disabled":"",options:e})}});e.exports=s},{"../../common/util":12,"./base":31}],35:[function(t,e,i){"use strict";var n=t("./base"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.inputType=t.inputType,this.selector="input[type="+this.inputType+"]",this._extendEvents({selectstart:"_onSelectStart"})},template:_.template('/>'),_onSelectStart:function(t){t.stopPropagation()},_convertStringToAsterisks:function(t){return Array(t.length+1).join("*")},_getDisplayValue:function(t){var e=t.formattedValue;return"password"===this.inputType&&(e=this._convertStringToAsterisks(t.value)),e},_generateInputHtml:function(t){var e=tui.util.pick(t,"columnModel","editOption","maxLength");return this.template({type:this.inputType,value:t.value,name:o.getUniqueKey(),disabled:t.isDisabled?"disabled":"",maxLength:e})},focus:function(t){var e=t.find(this.selector);1!==e.length||e.is(":focus")||e.select()}});e.exports=s},{"../../common/util":12,"./base":31}],36:[function(t,e,i){"use strict";var n=t("./row"),o=t("./cell"),s=t("./dummyCell"),a=t("./input/text"),l=t("./input/select"),r=t("./input/button"),d=t("./input/mainButton"),u=tui.util.defineClass({init:function(t){this.gridId=t.gridId,this.selectType=t.selectType,this.inputPainters=this._createInputPainters(t.controller),this.cellPainters=this._createCellPainters(t.controller),this.rowPainter=this._createRowPainter()},_createInputPainters:function(t){return{text:new a({controller:t,inputType:"text"}),password:new a({controller:t,inputType:"password"}),checkbox:new r({controller:t,inputType:"checkbox"}),radio:new r({controller:t,inputType:"radio"}),select:new l({controller:t}),mainButton:new d({controller:t,inputType:this.selectType,gridId:this.gridId})}},_createCellPainters:function(t){var e={dummy:new s({controller:t}),normal:new o({controller:t,editType:"normal"})};return _.each(this.inputPainters,function(i,n){e[n]=new o({editType:n,controller:t,inputPainter:i})},this),e},_createRowPainter:function(){return new n({painterManager:this})},getCellPainter:function(t){return this.cellPainters[t]},getCellPainters:function(){return this.cellPainters},getInputPainters:function(t){var e=this.inputPainters;return t&&(e=_.omit(e,"mainButton")),e},getRowPainter:function(){return this.rowPainter}});e.exports=u},{"./cell":28,"./dummyCell":30,"./input/button":32,"./input/mainButton":33,"./input/select":34,"./input/text":35,"./row":37}],37:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap"),a=s.attrName,l=s.dimension.CELL_BORDER_WIDTH,r=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.painterManager=t.painterManager},selector:"tr",template:_.template('="<%=rowKey%>" class="<%=className%>" style="height: <%=height%>px;"><%=contents%>'), +_getEditType:function(t,e){var i=tui.util.pick(e.columnModel,"editOption","type");return i||"normal"},_generateHtmlForDummyRow:function(t,e){var i=this.painterManager.getCellPainter("dummy"),n="";return _.each(e,function(e){n+=i.generateHtml(t,e)}),n},_generateHtmlForActualRow:function(t,e){var i="";return _.each(e,function(e){var n,o,s=t.get(e);s&&s.isMainRow&&(n=this._getEditType(e,s),o=this.painterManager.getCellPainter(n),i+=o.generateHtml(s))},this),i},generateHtml:function(t,e){var i,n=t.get("rowKey"),o=t.get("rowNum"),s="";return i=_.isUndefined(n)?this._generateHtmlForDummyRow(o,e):this._generateHtmlForActualRow(t,e),this.template({rowKeyAttrName:a.ROW_KEY,rowKey:n,height:t.get("height")+r._extraHeight+l,contents:i,className:s})},refresh:function(t,e){_.each(t,function(t,i){var n,o,s;"_extraData"!==i&&(s=e.find("td["+a.COLUMN_NAME+"="+i+"]"),n=this._getEditType(i,t),o=this.painterManager.getCellPainter(n),o.refresh(t,s))},this)},"static":{_extraHeight:function(){var t=0;return o.isBrowserIE7()&&(t=-2),t}()}});e.exports=r},{"../base/painter":6,"../common/constMap":9,"../common/util":12}],38:[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},{}],39:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){if(!_.isString(t)||!t)throw new Error("The Selector must be a string and not be empty.");this._selector=t,this._propValues=[]},add:function(t,e){return e&&this._propValues.push(t+":"+e),this},border:function(t){return this.add("border-color",t)},borderWidth:function(t){var e,i=t.showVerticalBorder,n=t.showHorizontalBorder;return _.isBoolean(i)&&(e=i?"1px":"0",this.add("border-left-width",e).add("border-right-width",e)),_.isBoolean(n)&&(e=n?"1px":"0",this.add("border-top-width",e).add("border-bottom-width",e)),this},bg:function(t){return this.add("background-color",t)},text:function(t){return this.add("color",t)},build:function(){var t="";return this._propValues.length&&(t=this._selector+"{"+this._propValues.join(";")+"}"),t}});e.exports={create:function(t){return new n(t)},createClassRule:function(t){return this.create("."+t)},createWebkitScrollbarRules:function(t,e){return[this.create(t+" ::-webkit-scrollbar").bg(e.background),this.create(t+" ::-webkit-scrollbar-thumb").bg(e.thumb),this.create(t+" ::-webkit-scrollbar-thumb:hover").bg(e.active)]},createIEScrollbarRule:function(t,e){var i=["scrollbar-3dlight-color","scrollbar-darkshadow-color","scrollbar-track-color","scrollbar-shadow-color"],n=["scrollbar-face-color","scrollbar-highlight-color"],o=this.create(t);return _.each(i,function(t){o.add(t,e.background)}),_.each(n,function(t){o.add(t,e.thumb)}),o.add("scrollbar-arrow-color",e.active),o},buildAll:function(t){return _.map(t,function(t){return t.build()}).join("")}}},{}],40:[function(t,e,i){"use strict";function n(t){var e=[a.grid(t.grid),a.scrollbar(t.scrollbar),a.toolbar(t.toolbar),a.selection(t.selection)],i=t.cell;return i&&(e=e.concat([a.cell(i.normal),a.cellDummy(i.dummy),a.cellEditable(i.editable),a.cellHead(i.head),a.cellOddRow(i.oddRow),a.cellEvenRow(i.evenRow),a.cellRequired(i.required),a.cellDisabled(i.disabled),a.cellInvalid(i.invalid),a.cellCurrentRow(i.currentRow),a.cellSelectedHead(i.selectedHead),a.cellFocused(i.focused)])),e.join("")}function o(t){var e=n(t);$("#"+r).remove(),s.appendStyleElement(r,e)}var s=t("../common/util"),a=t("./styleGenerator"),l=t("../common/constMap").themeName,r="tui-grid-theme-style",d={};d[l.DEFAULT]=t("./preset/default"),d[l.STRIPED]=t("./preset/striped"),d[l.CLEAN]=t("./preset/clean"),e.exports={apply:function(t,e){var i=d[t];i||(i=d[l.DEFAULT]),i=$.extend(!0,{},i,e),o(i)},isApplied:function(){return 1===$("#"+r).length}}},{"../common/constMap":9,"../common/util":12,"./preset/clean":41,"./preset/default":42,"./preset/striped":43,"./styleGenerator":44}],41:[function(t,e,i){"use strict";var n=t("./default");e.exports=$.extend(!0,{},n,{grid:{border:"#c0c0c0"},toolbar:{border:"#e0e0e0"},cell:{normal:{background:"#fff",border:"#e0e0e0",showVerticalBorder:!1,showHorizontalBorder:!0},head:{background:"#fff",border:"#e0e0e0",showVerticalBorder:!1,showHorizontalBorder:!0},selectedHead:{background:"#e0e0e0"}}})},{"./default":42}],42:[function(t,e,i){"use strict";e.exports={grid:{background:"#fff",border:"#ccc",text:"#444"},selection:{background:"#4daaf9",border:"#004082"},toolbar:{border:"#ccc",background:"transparent"},scrollbar:{background:"#f5f5f5",thumb:"#d9d9d9",active:"#c1c1c1"},cell:{normal:{background:"#fbfbfb",border:"#e0e0e0",showVerticalBorder:!0,showHorizontalBorder:!0},head:{background:"#eee",border:"#ccc",showVerticalBorder:!0,showHorizontalBorder:!0},selectedHead:{background:"#d8d8d8"},focused:{border:"#418ed4"},required:{background:"#fffdeb"},editable:{background:"#fff"},disabled:{text:"#b0b0b0"},dummy:{background:"#fff"},invalid:{background:"#ff8080"},evenRow:{},oddRow:{},currentRow:{}}}},{}],43:[function(t,e,i){"use strict";var n=t("./default");e.exports=$.extend(!0,{},n,{cell:{normal:{background:"#fff",border:"#e8e8e8",showVerticalBorder:!1,showHorizontalBorder:!1},oddRow:{background:"#f3f3f3"},evenRow:{background:"#fff"},head:{background:"#fff",showVerticalBorder:!1,showHorizontalBorder:!1}}})},{"./default":42}],44:[function(t,e,i){"use strict";function n(t,e){return a(t).bg(e.background).text(e.text).build()}var o=t("./cssRuleBuilder"),s=t("../common/classNameConst"),a=_.bind(o.createClassRule,o);e.exports={grid:function(t){var e=a(s.CONTAINER).bg(t.background).text(t.text),i=a(s.CONTENT_AREA).border(t.border),n=a(s.TABLE).border(t.border),l=a(s.HEAD_AREA).border(t.border),r=a(s.BORDER_LINE).bg(t.border),d=a(s.SCROLLBAR_HEAD).border(t.border),u=a(s.SCROLLBAR_BORDER).bg(t.border);return o.buildAll([e,i,n,l,r,d,u])},scrollbar:function(t){var e=o.createWebkitScrollbarRules("."+s.CONTAINER,t),i=o.createIEScrollbarRule("."+s.CONTAINER,t),n=a(s.SCROLLBAR_RIGHT_BOTTOM).bg(t.background),l=a(s.SCROLLBAR_LEFT_BOTTOM).bg(t.background),r=a(s.SCROLLBAR_HEAD).bg(t.background);return o.buildAll(e.concat([i,n,l,r]))},toolbar:function(t){var e=a(s.TOOLBAR).bg(t.background).border(t.border),i=a(s.HEIGHT_RESIZE_HANDLE).border(t.border);return o.buildAll([e,i])},selection:function(t){return a(s.LAYER_SELECTION).bg(t.background).border(t.border).build()},cell:function(t){var e=a(s.CELL).bg(t.background).border(t.border).borderWidth(t).text(t.text);return e.build()},cellHead:function(t){var e=a(s.CELL_HEAD).bg(t.background).border(t.border).borderWidth(t).text(t.text);return e.build()},cellEvenRow:function(t){return a(s.CELL_ROW_EVEN).bg(t.background).build()},cellOddRow:function(t){return a(s.CELL_ROW_ODD).bg(t.background).build()},cellSelectedHead:function(t){return o.create("."+s.CELL_HEAD+"."+s.CELL_SELECTED).bg(t.background).text(t.text).build()},cellFocused:function(t){var e=a(s.LAYER_FOCUS_BORDER).bg(t.border),i=a(s.LAYER_EDITING).border(t.border);return o.buildAll([e,i])},cellEditable:function(t){return n(s.CELL_EDITABLE,t)},cellRequired:function(t){return n(s.CELL_REQUIRED,t)},cellDisabled:function(t){return n(s.CELL_DISABLED,t)},cellDummy:function(t){return n(s.CELL_DUMMY,t)},cellInvalid:function(t){return n(s.CELL_INVALID,t)},cellCurrentRow:function(t){return n(s.CELL_CURRENT_ROW,t)}}},{"../common/classNameConst":8,"./cssRuleBuilder":39}],45:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/classNameConst"),a=t("../common/constMap"),l=a.keyCode,r=a.selectionType,d=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:s.CLIPBOARD,events:{keydown:"_onKeyDown",blur:"_onBlur"},_onBlur:function(){var t=this.focusModel;setTimeout(function(){t.refreshState()},0)},_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?void t.preventDefault():(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(),s=n.rowKey,a=n.columnName,r=this.dimensionModel.get("displayRowCount"),d=!0,u=t.keyCode||t.which;if(!o.isBlank(n.rowKey)){switch(u){case l.UP_ARROW:e.focus(e.prevRowKey(),a,!0);break;case l.DOWN_ARROW:e.focus(e.nextRowKey(),a,!0);break;case l.LEFT_ARROW:e.focus(s,e.prevColumnName(),!0);break;case l.RIGHT_ARROW:e.focus(s,e.nextColumnName(),!0);break;case l.PAGE_UP:e.focus(e.prevRowKey(r-1),a,!0);break;case l.PAGE_DOWN:e.focus(e.nextRowKey(r-1),a,!0);break;case l.HOME:e.focus(s,e.firstColumnName(),!0);break;case l.END:e.focus(s,e.lastColumnName(),!0);break;case l.SPACE:case l.ENTER:this._onEnterSpace(s,a);break;case l.DEL:this._del(s,a);break;case l.TAB:e.focusIn(s,e.nextColumnName(),!0);break;default:d=!1}d&&t.preventDefault(),i.end()}},_onEnterSpace:function(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,s=this.focusModel,a=this.dimensionModel,d=this.columnModel.getVisibleColumnModelList(),u=s.which(),c=a.get("displayRowCount"),h=t.keyCode||t.which,m=this._getIndexBeforeMove(),g=!0,f=!0;switch(h){case l.UP_ARROW:m.row-=1;break;case l.DOWN_ARROW:m.row+=1;break;case l.LEFT_ARROW:m.column-=1;break;case l.RIGHT_ARROW:m.column+=1;break;case l.PAGE_UP:m.row=s.prevRowIndex(c-1);break;case l.PAGE_DOWN:m.row=s.nextRowIndex(c-1);break;case l.HOME:m.column=0;break;case l.END:m.column=d.length-1;break;case l.ENTER:f=!1;break;case l.TAB:f=!1,s.focusIn(u.rowKey,s.prevColumnName(),!0);break;default:f=!1,g=!1}e=d[m.column],n=!(!e||!this.dataModel.getRowData(m.row)),f&&n&&(this._updateSelectionByKeyIn(m.row,m.column),i=a.getScrollPosition(m.row,e.columnName),i&&(o=this.selectionModel.getType(),o===r.COLUMN?delete i.scrollTop:o===r.ROW&&delete i.scrollLeft,this.renderModel.set(i))),g&&t.preventDefault()},_keyInWithCtrl:function(t){var e=this.focusModel,i=t.keyCode||t.which;switch(i){case l.CHAR_A:this.selectionModel.selectAll();break;case l.CHAR_C:this._copyToClipboard();break;case l.HOME:e.focus(e.firstRowKey(),e.firstColumnName(),!0);break;case l.END:e.focus(e.lastRowKey(),e.lastColumnName(),!0);break;case l.CHAR_V:this._pasteWhenKeyupCharV()}},_pasteWhenKeyupCharV:function(){var t=this;this._clearClipBoard(),this.pasting||(this.pasting=!0,this.$el.on("keyup",function(){t._pasteToGrid(),t.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 l.HOME:this._updateSelectionByKeyIn(0,0);break;case l.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'}var o,s=t("../base/view"),a=t("../common/classNameConst"),l="yyyy-mm-dd";o=s.extend({initialize:function(t){this.textPainter=t.textPainter,this.columnModel=t.columnModel,this.domState=t.domState,this.calendar=this._createCalendar(),this.datePicker=this._createDatePicker(),this._customizeCalendarBtns(),this.listenTo(this.textPainter,"focusIn",this._onFocusInTextInput),this.listenTo(this.textPainter,"focusOut",this._onFocusOutTextInput)},className:a.LAYER_DATE_PICKER,_createCalendar:function(){var t=$("
").addClass(a.CALENDAR);return t.mousedown(function(t){return t.preventDefault(),t.target.unselectable=!0,!1}),new tui.component.Calendar({element:t,classPrefix:a.CALENDAR+"-"})},_customizeCalendarBtns:function(){var t=this.calendar.$header,e=n(a.ICO_ARROW_LEFT),i=n(a.ICO_ARROW_RIGHT);t.find("."+a.CALENDAR_BTN_PREV_YEAR).html(e+e),t.find("."+a.CALENDAR_BTN_NEXT_YEAR).html(i+i),t.find("."+a.CALENDAR_BTN_PREV_MONTH).html(e),t.find("."+a.CALENDAR_BTN_NEXT_MONTH).html(i)},_createDatePicker:function(){var t=new tui.component.DatePicker({parentElement:this.$el,enableSetDateByEnterKey:!1,selectableClassName:a.CALENDAR_SELECTABLE,selectedClassName:a.CALENDAR_SELECTED,pos:{top:0,left:0}},this.calendar);return t.on("update",function(){t.close()}),t},_createDateForNow:function(){var t=new Date;return{year:t.getFullYear(),month:t.getMonth()+1,date:t.getDate()}},_resetDatePicker:function(t,e){var i=this.datePicker,n=t.date||this._createDateForNow();i.setDateForm(t.dateForm||l),i.setRanges(t.selectableRanges||[]),i.setDate(n.year,n.month,n.date),i.setElement(e)},_calculatePosition:function(t){var e=t.offset(),i=t.outerHeight(),n=this.domState.getOffset();return{top:e.top-n.top+i,left:e.left-n.left}},_onFocusInTextInput:function(t,e){var i=e.columnName,n=this.columnModel.getColumnModel(i).component,o=this.columnModel.getEditType(i);"text"===o&&n&&"datePicker"===n.name&&(this.$el.css(this._calculatePosition(t)).show(),this._resetDatePicker(n.option||{},t),this.datePicker.open())},_onFocusOutTextInput:function(){this.datePicker.close(),this.$el.hide()},render:function(){return this.$el.hide(),this}}),e.exports=o},{"../base/view":7,"../common/classNameConst":8}],48:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").dimension.CELL_BORDER_WIDTH,s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=n.extend({initialize:function(t){this.renderModel=t.renderModel,this.domState=t.domState,this.inputPainters=t.inputPainters,this.listenTo(this.renderModel,"editingStateChanged",this._onEditingStateChanged)},className:a.LAYER_EDITING+" "+a.CELL_CONTENT,_startEditing:function(t){var e=t.rowKey,i=t.columnName,n=tui.util.pick(t,"columnModel","editOption","type"),o=this._calculateLayoutStyle(e,i,this._isWidthExpandable(n)),a=this.inputPainters[n];this.$el.html(a.generateHtml(t)).attr(s.ROW_KEY,e).attr(s.COLUMN_NAME,i).css(o).show(),this._adjustLeftPosition(),a.focus(this.$el)},_isWidthExpandable:function(t){return _.contains(["checkbox","radio"],t)},_finishEditing:function(){this.$el.removeAttr(s.ROW_KEY),this.$el.removeAttr(s.COLUMN_NAME),this.$el.empty().hide()},_adjustLeftPosition:function(){var t=this.domState.getWidth(),e=this.$el.outerWidth(),i=this.$el.position().left;i+e>t&&this.$el.css("left",t-e)},_adjustCellOffsetValue:function(t){var e=tui.util.browser,i=t;return e.msie&&(9===e.version?i=t-1:e.version>9&&(i=Math.floor(t))),i},_calculateLayoutStyle:function(t,e,i){var n=this.domState.getOffset(),s=this.domState.getElement(t,e),a=s.offset(),l=s.height()+o,r=s.width()+o;return{top:this._adjustCellOffsetValue(a.top)-n.top,left:this._adjustCellOffsetValue(a.left)-n.left,height:l,minWidth:i?r:"",width:i?"":r,lineHeight:l+"px"}},_onEditingStateChanged:function(t){t.isEditing?this._startEditing(t):this._finishEditing()},render:function(){return _.each(this.inputPainters,function(t){t.attachEventHandlers(this.$el,"")},this),this}});e.exports=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],49:[function(t,e,i){"use strict";var n=t("./container"),o=t("./layout/content-area"),s=t("./layout/toolbar"),a=t("./layout/toolbar/controlPanel"),l=t("./layout/toolbar/pagination"),r=t("./layout/toolbar/resizeHandler"),d=t("./stateLayer"),u=t("./clipboard"),c=t("./layout/frame-lside"),h=t("./layout/frame-rside"),m=t("./layout/header"),g=t("./layout/resizeHandler"),f=t("./layout/body"),_=t("./layout/bodyTable"),p=t("./rowList"),M=t("./selectionLayer"),C=t("./editingLayer"),w=t("./datePickerLayer"),v=t("./focusLayer"),y=tui.util.defineClass({init:function(t){this.domState=t.domState,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})},createContentArea:function(){return new o({dimensionModel:this.modelManager.dimensionModel,viewFactory:this})},createToolbar:function(){return new s({toolbarModel:this.modelManager.toolbarModel,dimensionModel:this.modelManager.dimensionModel,viewFactory:this})},createToolbarControlPanel:function(){return new a({gridId:this.modelManager.gridId,toolbarModel:this.modelManager.toolbarModel})},createToolbarPagination:function(){return new l({toolbarModel:this.modelManager.toolbarModel})},createToolbarResizeHandler:function(){return new r({dimensionModel:this.modelManager.dimensionModel})},createStateLayer:function(){return new d({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?c:h;return new e({dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,viewFactory:this})},createHeader:function(t){return new m({whichSide:t,renderModel:this.modelManager.renderModel,dimensionModel:this.modelManager.dimensionModel,focusModel:this.modelManager.focusModel,selectionModel:this.modelManager.selectionModel,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,viewFactory:this})},createHeaderResizeHandler:function(t){return new g({whichSide:t,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel})},createBody:function(t){return new f({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 _({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,selectionModel:this.modelManager.selectionModel,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})},createEditingLayer:function(){return new C({renderModel:this.modelManager.renderModel,inputPainters:this.painterManager.getInputPainters(!0),domState:this.domState})},createDatePickerLayer:function(){return tui.component&&tui.component.DatePicker&&tui.component.Calendar?new w({columnModel:this.modelManager.columnModel,textPainter:this.painterManager.getInputPainters().text,domState:this.domState}):null},createFocusLayer:function(t){return new v({whichSide:t,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel,focusModel:this.modelManager.focusModel})}});e.exports=y},{"./clipboard":45,"./container":46,"./datePickerLayer":47,"./editingLayer":48,"./focusLayer":50,"./layout/body":51,"./layout/bodyTable":52,"./layout/content-area":53,"./layout/frame-lside":54,"./layout/frame-rside":55,"./layout/header":57,"./layout/resizeHandler":58,"./layout/toolbar":59,"./layout/toolbar/controlPanel":60,"./layout/toolbar/pagination":61,"./layout/toolbar/resizeHandler":62,"./rowList":63,"./selectionLayer":64,"./stateLayer":65}],50:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").dimension.CELL_BORDER_WIDTH,s=t("../common/classNameConst"),a='
',l=n.extend({initialize:function(t){this.focusModel=t.focusModel,this.columnModel=t.columnModel,this.dimensionModel=t.dimensionModel,this.whichSide=t.whichSide,this.borderEl={$top:$(a),$left:$(a),$right:$(a),$bottom:$(a)},this.listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged),this.listenTo(this.focusModel,"blur",this._onBlur),this.listenTo(this.focusModel,"focus",this._onFocus)},className:s.LAYER_FOCUS,_onColumnWidthChanged:function(){var t=this.focusModel;this.$el.is(":visible")&&this._refreshBorderLayout(t.get("rowKey"),t.get("columnName"))},_onBlur:function(){this.$el.hide()},_onFocus:function(t,e){var i=this.columnModel.isLside(e)?"L":"R";i===this.whichSide&&(this._refreshBorderLayout(t,e),this.$el.show())},_onChangeEditingAddress:function(t,e){e?this.$el.hide():this.$el.show()},_refreshBorderLayout:function(t,e){var i=this.dimensionModel.getCellPosition(t,e),n=i.right-i.left,s=i.bottom-i.top;this.borderEl.$left.css({top:i.top,left:i.left,width:o,height:s+o}),this.borderEl.$top.css({top:0===i.top?o:i.top,left:i.left,width:n+o,height:o}),this.borderEl.$right.css({top:i.top,left:i.left+n,width:o,height:s+o}),this.borderEl.$bottom.css({top:i.top+s,left:i.left,width:n+o,height:o})},render:function(){var t=this.$el;return _.each(this.borderEl,function(e){t.append(e)}),t.hide(),this}});e.exports=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],51:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap"),a=t("../../common/classNameConst"),l=s.attrName,r=s.selectionType,d=200,u=10,c=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)},className:a.BODY_AREA,events:function(){var t={};return t.scroll="_onScroll",t["mousedown ."+a.BODY_CONTAINER]="_onMouseDown",t},_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.closest("td"),s=n.closest("tr"),a=o.attr(l.COLUMN_NAME),r=s.attr(l.ROW_KEY),d=!0,u=_.pick(t,"pageX","pageY","shiftKey");o.length?r&&a?(e={column:i.indexOfColumnName(a,!0),row:this.dataModel.indexOfRowKey(r)},"radio"===this.columnModel.get("selectType")&&this.dataModel.check(e.row)):d=!1:(e=this.dimensionModel.getIndexFromMousePosition(t.pageX,t.pageY),a=this._getColumnNameByVisibleIndex(e.column)),d&&this._controlStartAction(u,e,a,n.is("input"))},_controlStartAction:function(t,e,i,n){var s=this.selectionModel,a=e.column,l=e.row,d=!0;s.isEnabled()&&(o.isMetaColumn(i)?"_number"===i?this._updateSelectionByRow(l,t.shiftKey):d=!1:(s.setType(r.CELL),t.shiftKey&&!n?s.update(l,a):(d=this._doFocusAtAndCheckDraggable(l,a),s.end())),!n&&d&&(this.dimensionModel.refreshLayout(),this._attachDragEvents(t.pageX,t.pageY)))},_updateSelectionByRow:function(t,e){e?this.selectionModel.update(t,0,r.ROW):this.selectionModel.selectRow(t)},_doFocusAtAndCheckDraggable:function(t,e){var i=(new Date).getTime(),n=this.focusModel.focusAt(t,e),o=(new Date).getTime(),s=o-i>d;return n&&!s},_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._getMouseMoveDistance(t.pageX,t.pageY)>u;(this.selectionModel.hasSelection()||e)&&this.selectionModel.updateByMousePosition(t.pageX,t.pageY)},_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=$("
").addClass(a.BODY_CONTAINER),this.$el.append(this.$container),this._addChildren([this.viewFactory.createBodyTable(t),this.viewFactory.createSelectionLayer(t),this.viewFactory.createFocusLayer(t)]),this.$container.append(this._renderChildren()),this._resetContainerHeight(),this}});e.exports=c},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],52:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap"),a=t("../../common/classNameConst"),l=s.dimension.CELL_BORDER_WIDTH,r=s.attrName.COLUMN_NAME,d=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()},className:a.BODY_TABLE_CONTAINER,template:_.template('<%=colGroup%><%=tbody%>
'),templateCol:_.template('="<%=columnName%>" style="width:<%=width%>px">'),_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-d.EXTRA_WIDTH+l),i+=t+l},this),o.isBrowserIE7()&&this.$el.width(i)},_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},_attachAllTableEventHandlers:function(){var t=this.painterManager.getCellPainters();_.each(t,function(t){t.attachEventHandlers(this.$el,"")},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){n+=this.templateCol({attrColumnName:r,columnName:t.columnName,width:e[i]-d.EXTRA_WIDTH+l})},this),n}},{EXTRA_WIDTH:o.isBrowserIE7()?20:0});e.exports=d},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],53:[function(t,e,i){"use strict";function n(t){return $("
").addClass(a.BORDER_LINE).addClass(t)}var o,s=t("../../base/view"),a=t("../../common/classNameConst");o=s.extend({initialize:function(t){s.prototype.initialize.call(this),this.viewFactory=t.viewFactory,this.dimensionModel=t.dimensionModel,this._addFrameViews()},className:a.CONTENT_AREA,_addFrameViews:function(){var t=this.viewFactory;this._addChildren([t.createFrame("L"),t.createFrame("R")])},render:function(){var t=this.dimensionModel,e=t.getScrollXHeight(),i=this._renderChildren().concat([n(a.BORDER_TOP),n(a.BORDER_LEFT),n(a.BORDER_RIGHT),n(a.BORDER_BOTTOM).css("bottom",e)]);return t.get("scrollX")||this.$el.addClass(a.NO_SCROLL_X),t.get("scrollY")||this.$el.addClass(a.NO_SCROLL_Y),this.$el.append(i),this}}),e.exports=o},{"../../base/view":7,"../../common/classNameConst":8}],54:[function(t,e,i){"use strict";var n=t("./frame"),o=t("../../common/classNameConst"),s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"L"})},className:o.LSIDE_AREA,_onColumnWidthChanged:function(){this.$el.css({width:this.dimensionModel.get("lsideWidth")})},beforeRender:function(){this.$el.css({display:"block",width:this.dimensionModel.get("lsideWidth")})},afterRender:function(){this.dimensionModel.get("scrollX")&&this.$el.append($("
").addClass(o.SCROLLBAR_LEFT_BOTTOM))}});e.exports=s},{"../../common/classNameConst":8,"./frame":56}],55:[function(t,e,i){"use strict";var n=t("./frame"),o=t("../../common/classNameConst"),s=t("../../common/constMap").dimension.CELL_BORDER_WIDTH,a=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:o.RSIDE_AREA,_onColumnWidthChanged:function(){this._refreshLayout()},_refreshLayout:function(){var t=this.dimensionModel,e=t.get("rsideWidth"),i=t.get("lsideWidth");i>0&&!t.isDivisionBorderDoubled()&&(e+=s,i-=s),this.$el.css({width:e,marginLeft:i})},_resetScrollBorderHeight:function(){var t,e;this.$scrollBorder&&(t=this.dimensionModel,e=t.get("bodyHeight")-t.getScrollXHeight(),this.$scrollBorder.height(e))},beforeRender:function(){this.$el.css("display","block"),this._refreshLayout()},afterRender:function(){var t,e,i,n,s=this.dimensionModel;s.get("scrollY")&&(n=s.get("headerHeight"),t=$("
").addClass(o.SCROLLBAR_HEAD),e=$("
").addClass(o.SCROLLBAR_BORDER),t.height(n-2),e.css("top",n+"px"),this.$el.append(t,e),s.get("scrollX")&&(i=$("
").addClass(o.SCROLLBAR_RIGHT_BOTTOM),this.$el.append(i)),this.$scrollBorder=e,this._resetScrollBorderHeight())}});e.exports=a},{"../../common/classNameConst":8,"../../common/constMap":9,"./frame":56}],56:[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).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged)},render:function(){var t=this.viewFactory;return this.$el.empty(),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}],57:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap"),a=t("../../common/classNameConst"),l=10,r=s.selectionType.COLUMN,d=s.attrName.COLUMN_NAME,u=s.dimension.CELL_BORDER_WIDTH,c=s.dimension.TABLE_BORDER_WIDTH,h=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({renderModel:t.renderModel,dimensionModel:t.dimensionModel,selectionModel:t.selectionModel,focusModel:t.focusModel,columnModel:t.columnModel,dataModel:t.dataModel,viewFactory:t.viewFactory,timeoutForAllChecked:0,whichSide:t.whichSide||"R"}),this.listenTo(this.renderModel,"change:scrollLeft",this._onScrollLeftChange).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged).listenTo(this.selectionModel,"change:range",this._refreshSelectedHeaders).listenTo(this.focusModel,"change:columnName",this._refreshSelectedHeaders).listenTo(this.dataModel,"change:_button",this._onCheckCountChange).listenTo(this.dataModel,"sortChanged",this._updateBtnSortState)},className:a.HEAD_AREA,events:{click:"_onClick","mousedown th":"_onMouseDown"},template:_.template('<%=colGroup%><%=tBody%>
'),templateHeader:_.template('="<%=columnName%>" class="<%=className%>" height="<%=height%>" <%if(colspan > 0) {%>colspan=<%=colspan%> <%}%><%if(rowspan > 0) {%>rowspan=<%=rowspan%> <%}%>><%=title%><%=btnSort%>'),templateCol:_.template('="<%=columnName%>" style="width:<%=width%>px">'),markupBtnSort:'',_getColGroupMarkup:function(){var t=this._getColumnData(),e=t.widthList,i=t.modelList,n=[];return _.each(e,function(t,e){n.push(this.templateCol({attrColumnName:d,columnName:i[e].columnName,width:t+u}))},this),n.join("")},_getSelectedColumnNames:function(){var t=this.selectionModel.get("range").column,e=this.columnModel.getVisibleColumnModelList(),i=e.slice(t[0],t[1]+1);return _.pluck(i,"columnName")},_getContainingMergedColumnNames:function(t){var e=this.columnModel,i=_.pluck(e.get("columnMerge"),"columnName");return _.filter(i,function(i){var n=e.getUnitColumnNamesIfMerged(i);return _.every(n,function(e){return _.contains(t,e)})})},_refreshSelectedHeaders:function(){var t,e,i=this.$el.find("th");this.selectionModel.hasSelection()?t=this._getSelectedColumnNames():this.focusModel.has(!0)&&(t=[this.focusModel.get("columnName")]),i.removeClass(a.CELL_SELECTED),t&&(e=this._getContainingMergedColumnNames(t),_.each(t.concat(e),function(t){i.filter("["+d+"="+t+"]").addClass(a.CELL_SELECTED)}))},_onMouseDown:function(t){var e,i;this.selectionModel.isEnabled()&&!$(t.target).is("a."+a.BTN_SORT)&&(e=$(t.target).closest("th").attr(d),e&&(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,r),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(d);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){return _.some(t,function(t){return o.isMetaColumn(t)})},_onSelectStart:function(t){return t.preventDefault(),!1},_onCheckCountChange:function(){"checkbox"===this.columnModel.get("selectType")&&(clearTimeout(this.timeoutForAllChecked),this.timeoutForAllChecked=setTimeout($.proxy(this._syncCheckState,this),l))},_getHeaderMainCheckbox:function(){return this.$el.find("th["+d+"=_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+u)})},_onScrollLeftChange:function(t,e){"R"===this.whichSide&&(this.el.scrollLeft=e)},_onClick:function(t){var e=$(t.target),i=e.closest("th").attr(d);"_button"===i&&e.is("input")?e.prop("checked")?this.dataModel.checkAll():this.dataModel.uncheckAll():e.is("a."+a.BTN_SORT)&&this.dataModel.sortByField(i)},_updateBtnSortState:function(t){this._$currentSortBtn&&this._$currentSortBtn.removeClass(a.BTN_SORT_DOWN+" "+a.BTN_SORT_UP),this._$currentSortBtn=this.$el.find("th["+d+"="+t.columnName+"] a."+a.BTN_SORT),this._$currentSortBtn.addClass(t.isAscending?a.BTN_SORT_UP:a.BTN_SORT_DOWN)},render:function(){return this._destroyChildren(),"R"!==this.whichSide||this.dimensionModel.get("scrollY")||this.$el.addClass(a.NO_SCROLL_Y),this.$el.css({height:this.dimensionModel.get("headerHeight")-c}).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"),l=new Array(n),r=new Array(n),u=[],c=o.getRowHeight(n,s)-1,h=1;return _.each(i,function(e,o){var m=i[o].length,g=0;_.each(e,function(e,i){var o=e.columnName,f=[a.CELL,a.CELL_HEAD];e.isRequired&&f.push(a.CELL_REQRUIRED),h=m-1===i&&n-m+1>1?n-m+1:1,t=c*h,i===m-1?t=s-g-2:g+=t+1,r[i]===o?(l[i].pop(),u[i]+=1):u[i]=1,r[i]=o,l[i]=l[i]||[],l[i].push(this.templateHeader({attrColumnName:d,columnName:o,className:f.join(" "),height:t,colspan:u[i],rowspan:h,title:e.title,btnSort:e.isSortable?this.markupBtnSort:""}))},this)},this),e=_.map(l,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=h},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],58:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/constMap").attrName,s=t("../../common/classNameConst"),a=t("../../common/constMap").dimension.CELL_BORDER_WIDTH,l=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)},className:s.COLUMN_RESIZE_CONTAINER,events:function(){var t={};return t["mousedown ."+s.COLUMN_RESIZE_HANDLE]="_onMouseDown",t["dblclick ."+s.COLUMN_RESIZE_HANDLE]="_onDblClick",t},template:_.template("
'),_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=this._getColumnData(),e=t.modelList,i=this.dimensionModel.get("headerHeight"),n=e.length,o=_.map(e,function(t,e){return this.template({lastClass:e+1===n?s.COLUMN_RESIZE_HANDLE_LAST:"",columnIndex:e,columnName:t.columnName,height:i})},this);return o.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=this._getColumnData(),e=t.widthList,i=this.$el.find("."+s.COLUMN_RESIZE_HANDLE),n=0;tui.util.forEachArray(i,function(t,o){var s=i.eq(o),l=Math.ceil(s.width()/2);n+=e[o]+a,s.css("left",n-l)})},_isResizing:function(){return!!this.isResizing},_onMouseDown:function(t){this._startResizing($(t.target))},_onDblClick:function(t){var e=$(t.target),i=parseInt(e.attr(o.COLUMN_INDEX),10);this.dimensionModel.restoreColumnWidth(this._getHandlerColumnIndex(i)),this._refreshHandlerPosition()},_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(o.COLUMN_INDEX),10),this.$target.css("left",e),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;this.isResizing=!0,this.$target=t,this.initialLeft=parseInt(t.css("left").replace("px",""),10),this.initialOffsetLeft=this.$el.offset().left,this.initialWidth=i[t.attr(o.COLUMN_INDEX)],$("body").css("cursor","col-resize"),$(document).bind("mousemove",$.proxy(this._onMouseMove,this)).bind("mouseup",$.proxy(this._onMouseUp,this)),t[0].setCapture&&t[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=l},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9}],59:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/classNameConst"),s=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.toolbarModel=t.toolbarModel,this.dimensionModel=t.dimensionModel,this.viewFactory=t.viewFactory},className:o.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=s},{"../../base/view":7,"../../common/classNameConst":8}],60:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=t("../../../common/classNameConst"),s=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:function(){var t={};return t["click ."+o.BTN_EXCEL]="_onClickExcel",t},className:o.TOOLBAR_BTN_HOLDER,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(o.BTN_EXCEL_PAGE)?n.download("excel"):e.hasClass(o.BTN_EXCEL_ALL)&&n.download("excelAll"))},render:function(){var t=this.toolbarModel;return this.$el.empty(),t.get("isExcelButtonVisible")&&this.$el.append(this.templateExcelBtn({className:o.BTN_EXCEL_PAGE,text:"엑셀 다운로드"})),t.get("isExcelAllButtonVisible")&&this.$el.append(this.templateExcelBtn({className:o.BTN_EXCEL_ALL,text:"전체 엑셀 다운로드"})),this}});e.exports=s},{"../../../base/view":7,"../../../common/classNameConst":8}],61:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=t("../../../common/classNameConst"),s=n.extend({initialize:function(t){this.toolbarModel=t.toolbarModel},className:o.PAGINATION,htmlString:'FirstPrev NextLastFirst OffPrev OffNext OffLast Off',render:function(){return this._destroyChildren(),this.$el.empty().html(this.htmlString),this._setPaginationInstance(),this},_setPaginationInstance:function(){var t=tui&&tui.component&&tui.component.Pagination,e=this.toolbarModel.get("pagination");!e&&t&&(e=new t({classPrefix:o.PREFIX,itemCount:1,itemPerPage:1,pagePerPageList:5,isCenterAlign:!0,moveUnit:"page",$preOff:this.$el.find("."+o.PAGINATION_PRE_OFF),$pre_endOff:this.$el.find("."+o.PAGINATION_PRE_END_OFF),$nextOff:this.$el.find("."+o.PAGINATION_NEXT_OFF),$lastOff:this.$el.find("."+o.PAGINATION_NEXT_END_OFF)},this.$el)),this.toolbarModel.set("pagination",e)}});e.exports=s},{"../../../base/view":7,"../../../common/classNameConst":8}],62:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=t("../../../common/classNameConst"),s=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.timeoutIdForResize=0},className:o.HEIGHT_RESIZE_BAR,htmlString:'',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.htmlString),this},destroy:function(){this.stopListening(),this._onMouseUp(),this._destroyChildren(),this.remove()}});e.exports=s},{"../../../base/view":7,"../../../common/classNameConst":8}],63:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=n.extend({initialize:function(t){var e=t.focusModel,i=t.renderModel,n=t.selectionModel,o=t.whichSide||"R";this.setOwnProperties({whichSide:o,bodyTableView:t.bodyTableView,focusModel:e,renderModel:i,selectionModel:n,dataModel:t.dataModel,columnModel:t.columnModel,collection:i.getCollection(o),painterManager:t.painterManager,sortOptions:null,renderedRowKeys:null}),this.listenTo(this.collection,"change",this._onModelChange).listenTo(this.collection,"restore",this._onModelRestore).listenTo(e,"change:rowKey",this._refreshFocusedRow).listenTo(i,"rowListChanged",this.render),"L"===this.whichSide&&this.listenTo(e,"change:rowKey",this._refreshSelectedMetaColumns).listenTo(n,"change:range",this._refreshSelectedMetaColumns).listenTo(i,"rowListChanged",this._refreshSelectedMetaColumns)},_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(l.isInnerHtmlOfTbodyReadOnly)t=this.bodyTableView.redrawTable(e),this.setElement(t,!1),o.isBrowserIE7()&&t.width(t.width());else try{this.$el[0].innerHTML=e}catch(i){l.isInnerHtmlOfTbodyReadOnly=!0,this._resetRows()}},_getRowsHtml:function(t){var e=this.painterManager.getRowPainter(),i=_.pluck(this._getColumnModelList(),"columnName");return _.map(t,function(t){return e.generateHtml(t,i)}).join("")},_getRowElement:function(t){return this.$el.find("tr["+s.ROW_KEY+"="+t+"]")},_refreshSelectedMetaColumns:function(){var t,e=this.$el.find("tr"),i="."+a.CELL_HEAD;t=this.selectionModel.hasSelection()?this._filterRowsByIndexRange(e,this.selectionModel.get("range").row):this._filterRowByKey(e,this.focusModel.get("rowKey")),e.find(i).removeClass(a.CELL_SELECTED),t.find(i).addClass(a.CELL_SELECTED)},_filterRowsByIndexRange:function(t,e){var i,n,o=this.renderModel,s=o.get("startIndex");return i=Math.max(e[0]-s,0),n=Math.max(e[1]-s+1,0),i||n?t.slice(i,n):$()},_filterRowByKey:function(t,e){var i=this.dataModel.indexOfRowKey(e),n=this.renderModel.get("startIndex");return n>i?$():t.eq(i-n)},_refreshFocusedRow:function(){var t=this.focusModel.get("rowKey"),e=this.focusModel.get("prevRowKey");this._setFocusedRowClass(e,!1),this._setFocusedRowClass(t,!0)},_setFocusedRowClass:function(t,e){var i=_.pluck(this._getColumnModelList(),"columnName"),n={};_.each(i,function(i){var o,l=this.dataModel.getMainRowKey(t,i);n[l]||(n[l]=this._getRowElement(l)),o=n[l].find("td["+s.COLUMN_NAME+"="+i+"]"),o.toggleClass(a.CELL_CURRENT_ROW,e)},this)},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},_onModelChange:function(t){var e=this._getRowElement(t.get("rowKey"));this.painterManager.getRowPainter().refresh(t.changed,e)},_onModelRestore:function(t){var e=this.dataModel.getElement(t.rowKey,t.columnName),i=this.columnModel.getEditType(t.columnName);this.painterManager.getCellPainter(i).refresh(t,e)}},{isInnerHtmlOfTbodyReadOnly:tui.util.browser.msie&&tui.util.browser.version<=9});e.exports=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],64:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/classNameConst"),a=t("../common/constMap").dimension.CELL_BORDER_WIDTH,l=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)},className:s.LAYER_SELECTION,_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),n=o.getHeight(t[1]-t[0]+1,e)-a;return{top:i+"px",height:n+"px"}},_getHorizontalStyles:function(t){var e=this.columnWidthList,i=this.columnModel.getVisibleMetaColumnCount(),n=t[0],o=t[1],s=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?s+=e[r]+a:l+=e[r]+a;return l-=a,{left:s+"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=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],65:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").renderState,s=t("../common/classNameConst"),a=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.renderModel=t.renderModel,this.timeoutIdForDelay=null,this.listenTo(this.dimensionModel,"change",this._refreshLayout),this.listenTo(this.renderModel,"change:state",this.render)},className:s.LAYER_STATE,template:_.template('
<%= text %> <% if (isLoading) { %>
<% } %>
'),render:function(){var t=this.renderModel.get("state");return t===o.DONE?this.$el.hide():this._showLayer(t),this},_showLayer:function(t){var e=this.template({text:this._getMessage(t),isLoading:t===o.LOADING});this.$el.html(e).show(),this._refreshLayout()},_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=a},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}]},{},[14]); \ No newline at end of file diff --git a/samples/css/grid.css b/samples/css/grid.css index 2648513ca..689831f54 100644 --- a/samples/css/grid.css +++ b/samples/css/grid.css @@ -1,22 +1,18 @@ /** * @fileoverview tui-grid * @author NHN Ent. FE Development Team - * @version 1.2.1 + * @version 1.3.0 * @license MIT * @link https://github.com/nhnent/tui.grid */ .tui-grid-container { width: 100%; position: relative; - border-style: solid; - border-width: 0 0 1px; + border-width: 0; clear: both; font-size: 12px; font-family: '돋움', Dotum, Helvetica, 'Apple SD Gothic Neo', Sans-serif; } -.tui-grid-container.tui-grid-no-scroll-x { - border-bottom-width: 0; -} .tui-grid-container ::-webkit-scrollbar { -webkit-appearance: none; width: 17px; @@ -109,6 +105,24 @@ .tui-grid-btn-sorting-up { background-position: -10px -60px; } +.tui-grid-icon-arrow { + display: inline-block; + width: 0; + height: 0; + border-style: solid; + border-width: 4px; + border-color: #a0a0a0; +} +.tui-grid-icon-arrow-left { + border-top-color: transparent; + border-bottom-color: transparent; + border-left-width: 0; +} +.tui-grid-icon-arrow-right { + border-top-color: transparent; + border-bottom-color: transparent; + border-right-width: 0; +} .tui-grid-layer-state { position: absolute; top: 0; @@ -155,7 +169,10 @@ border-style: solid; border-width: 1px; opacity: 0.2; - filter: alpha(opacity=10); + filter: alpha(opacity=20); +} +.tui-grid-layer-datepicker { + position: absolute; } .tui-grid-table { width: 100%; @@ -166,6 +183,9 @@ border-collapse: collapse; margin: 0; } +.tui-grid-lside-area .tui-grid-table { + border-right-width: 0; +} .tui-grid-cell { overflow: hidden; white-space: nowrap; @@ -182,8 +202,6 @@ text-align: center; } .tui-grid-cell-ellipsis { - -o-text-overflow: ellipsis /*Opera 9*/; - -moz-binding: url("ellipsis.xml#ellipsis") /* Firefox */; text-overflow: ellipsis; } .tui-grid-cell-content .tui-grid-content-before { @@ -266,16 +284,28 @@ right: 17px; height: 1px; } -.tui-grid-border-line-bottom.tui-grid-no-scroll-y { +.tui-grid-no-scroll-x .tui-grid-border-line-bottom, +.tui-grid-no-scroll-y .tui-grid-border-line-bottom { right: 0; } +.tui-grid-content-area { + position: relative; + border-style: solid; + border-width: 0 0 1px; +} +.tui-grid-content-area.tui-grid-no-scroll-x { + border-bottom-width: 0; +} .tui-grid-head-area { border-style: solid; border-width: 0 0 1px; } +.tui-grid-head-area .tui-grid-cell-head { + border-top-width: 1px; + border-bottom-width: 1px; +} .tui-grid-lside-area { display: none; - height: 100%; position: absolute; top: 0; left: 0; @@ -295,16 +325,15 @@ } .tui-grid-rside-area { display: none; - height: 100%; overflow: hidden; } .tui-grid-rside-area .tui-grid-head-area { position: relative; - margin-right: 17px; + padding-right: 17px; overflow: hidden; } .tui-grid-rside-area .tui-grid-head-area.tui-grid-no-scroll-y { - margin-right: 0; + padding-right: 0; } .tui-grid-rside-area .tui-grid-body-area { position: relative; @@ -348,12 +377,13 @@ } .tui-grid-toolbar { display: none; - width: 100%; + left: 0; + right: 0; height: 65px; bottom: 0px; position: absolute; border-style: solid; - border-width: 1px 0 0; + border-width: 0 1px 1px; z-index: 11; } .tui-grid-toolbar-btn-holder { @@ -470,3 +500,100 @@ .tui-grid-pagination .tui-grid-next-end-off { background-position: -75px -30px; } +.tui-grid-calendar-btn-prev-year, +.tui-grid-calendar-btn-prev-month, +.tui-grid-calendar-btn-next-month, +.tui-grid-calendar-btn-next-year { + position: absolute; + top: 4px; + padding: 3px 6px 2px; + border: 1px solid transparent; +} +.tui-grid-calendar-btn-prev-year:hover, +.tui-grid-calendar-btn-prev-month:hover, +.tui-grid-calendar-btn-next-month:hover, +.tui-grid-calendar-btn-next-year:hover { + border-color: #ccc; +} +.tui-grid-calendar { + position: absolute; + width: 190px; + background: #fff; + border: 1px solid #ccc; + font-size: 11px; + color: #444; + font-family: arial; +} +.tui-grid-calendar table { + margin: 0 auto; + table-layout: fixed; + text-align: center; +} +.tui-grid-calendar table tr { + height: 20px; +} +.tui-grid-calendar table th { + width: 20px; +} +.tui-grid-calendar table th.tui-grid-calendar-sat { + color: #00f; +} +.tui-grid-calendar table th.tui-grid-calendar-sun { + color: #e82828; +} +.tui-grid-calendar table td { + background: #eee; + color: #ccc; +} +.tui-grid-calendar table td.tui-grid-calendar-selectable { + cursor: pointer; + background: #fff; + color: #444; +} +.tui-grid-calendar table td.tui-grid-calendar-selectable.tui-grid-calendar-selected { + background: #c3ebff; + font-weight: bold; +} +.tui-grid-calendar table td.tui-grid-calendar-selectable.tui-grid-calendar-sat { + color: #00f; +} +.tui-grid-calendar table td.tui-grid-calendar-selectable.tui-grid-calendar-sun { + color: #e82828; +} +.tui-grid-calendar table td.tui-grid-calendar-selectable:hover { + background: #c3ebff; +} +.tui-grid-calendar-header { + padding: 6px 0 5px; + text-align: center; + border-bottom: 1px solid #ddd; +} +.tui-grid-calendar-title { + font-size: 14px; +} +.tui-grid-calendar-body { + padding: 5px 7px; +} +.tui-grid-calendar-btn-prev-year { + left: 18px; +} +.tui-grid-calendar-btn-prev-month { + left: 42px; +} +.tui-grid-calendar-btn-next-month { + right: 42px; +} +.tui-grid-calendar-btn-next-year { + right: 20px; +} +.tui-grid-calendar-today { + text-decoration: underline; +} +.tui-grid-calendar-prev-month, +.tui-grid-calendar-next-month { + opacity: 0.4; + filter: alpha(opacity=40); +} +.tui-grid-calendar-footer { + display: none; +} diff --git a/samples/css/grid.min.css b/samples/css/grid.min.css index c4b6fa238..50ba5f5eb 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.2.1 + * @version 1.3.0 * @license MIT * @link https://github.com/nhnent/tui.grid */ -.tui-grid-btn-sorting,.tui-grid-cell img{vertical-align:middle}.tui-grid-container{width:100%;position:relative;border-style:solid;border-width:0 0 1px;clear:both;font-size:12px;font-family:'돋움',Dotum,Helvetica,'Apple SD Gothic Neo',Sans-serif}.tui-grid-container.tui-grid-no-scroll-x{border-bottom-width:0}.tui-grid-container ::-webkit-scrollbar{-webkit-appearance:none;width:17px;height:17px}.tui-grid-container ::-webkit-scrollbar-thumb{border:5px solid transparent;border-radius:7px;background-clip:content-box}.tui-grid-container *{box-sizing:content-box}.tui-grid-cell-content select,.tui-grid-table{box-sizing:border-box;width:100%}.tui-grid-container input,.tui-grid-container p{margin:0;padding:0}.tui-grid-container fieldset{margin:0;padding:0;border:0;display:inline;white-space:nowrap}.tui-grid-container input[type=password],.tui-grid-container input[type=text]{outline:0;box-sizing:border-box;line-height:normal}.tui-grid-container li,.tui-grid-container ul{list-style:none;padding:0;margin:0}.tui-grid-container em,.tui-grid-container strong{font-style:normal}.tui-grid-clipboard{position:fixed;top:0;left:-9999px;width:100px;height:100px}.tui-grid-btn-text{display:inline-block;text-decoration:none}.tui-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}.tui-grid-btn-text em{position:absolute;left:0;top:5px;width:17px;height:12px;background:url(../images/icons.gif) no-repeat}.tui-grid-btn-text em.tui-grid-btn-excel-icon{background-position:-30px -60px}.tui-grid-btn-sorting{display:inline-block;overflow:hidden;margin-left:6px;height:15px;width:8px;background:url(../images/icons.gif) -20px -60px no-repeat;cursor:pointer}.tui-grid-btn-sorting-down{background-position:0 -60px}.tui-grid-btn-sorting-up{background-position:-10px -60px}.tui-grid-layer-state{position:absolute;top:0;left:0;width:100%;border-bottom:solid 1px #ccc;background:#fff;font-weight:700;text-align:center;z-index:12}.tui-grid-layer-state-content{padding-top:50px}.tui-grid-layer-state-loading{display:block;margin:10px auto 0;background:url(../images/ani_loading.gif);border:0;width:150px;height:13px}.tui-grid-cell,.tui-grid-layer-editing,.tui-grid-layer-selection,.tui-grid-table{border-width:1px;border-style:solid}.tui-grid-layer-editing{position:absolute;display:none;background:#fff;z-index:15;padding:0 10px;white-space:nowrap}.tui-grid-layer-focus-border{position:absolute;overflow:hidden;z-index:14}.tui-grid-layer-selection{position:absolute;display:none;top:0;width:0;height:0;opacity:.2;filter:alpha(opacity=10)}.tui-grid-table{table-layout:fixed;border-collapse:collapse;margin:0}.tui-grid-cell{overflow:hidden;white-space:nowrap;padding:0 10px}.tui-grid-cell-head{padding:0;text-align:center}.tui-grid-cell-ellipsis{-o-text-overflow:ellipsis;-moz-binding:url(ellipsis.xml#ellipsis);text-overflow:ellipsis}.tui-grid-cell-content .tui-grid-content-before{float:left;margin-right:2px;line-height:1.5}.tui-grid-cell-content .tui-grid-content-after{float:right;margin-left:2px;line-height:1.5}.tui-grid-cell-content .tui-grid-content-input{display:block;overflow:hidden;line-height:1.5}.tui-grid-cell-content input[type=password],.tui-grid-cell-content input[type=text]{width:100%;padding:2px 0;border:1px solid #e2e3ea;border-top:solid 1px #abadb3;border-bottom:solid 1px #e3e9ef}.tui-grid-cell-content label+input{margin-left:10px}.tui-grid-column-resize-container{display:none;position:relative;width:0}.tui-grid-column-resize-handle{float:left;position:absolute;top:-1px;left:-99px;width:7px;height:100%;background:#000;opacity:0;filter:alpha(opacity=0);cursor:col-resize}.tui-grid-column-resize-handle-last{width:3px}.tui-grid-border-line{position:absolute;z-index:13}.tui-grid-border-line-top{top:0;left:0;right:0;height:1px}.tui-grid-border-line-left{top:0;bottom:0;left:0;width:1px}.tui-grid-border-line-right{top:0;bottom:0;right:0;width:1px}.tui-grid-border-line-bottom{bottom:0;left:0;right:17px;height:1px}.tui-grid-border-line-bottom.tui-grid-no-scroll-y{right:0}.tui-grid-head-area{border-style:solid;border-width:0 0 1px}.tui-grid-lside-area{display:none;height:100%;position:absolute;top:0;left:0;overflow:hidden;z-index:10}.tui-grid-lside-area .tui-grid-head-area{overflow:hidden}.tui-grid-lside-area .tui-grid-body-area{position:relative;overflow:scroll;margin-right:-17px}.tui-grid-lside-area .tui-grid-body-area .tui-grid-selection-layer{left:1px}.tui-grid-rside-area{display:none;height:100%;overflow:hidden}.tui-grid-rside-area .tui-grid-head-area{position:relative;margin-right:17px;overflow:hidden}.tui-grid-rside-area .tui-grid-head-area.tui-grid-no-scroll-y{margin-right:0}.tui-grid-rside-area .tui-grid-body-area{position:relative;overflow:scroll}.tui-grid-body-container{position:relative;margin-top:-1px}.tui-grid-table-container{position:absolute}.tui-grid-scrollbar-head{display:block;position:absolute;top:0;right:0;width:16px;border-style:solid;border-width:1px}.tui-grid-scrollbar-left-bottom{position:absolute;bottom:0;left:0;right:0;height:17px}.tui-grid-scrollbar-right-bottom{position:absolute;bottom:0;right:0;width:17px;height:17px}.tui-grid-scrollbar-border{display:block;position:absolute;right:17px;width:1px}.tui-grid-toolbar{display:none;width:100%;height:65px;bottom:0;position:absolute;border-style:solid;border-width:1px 0 0;z-index:11}.tui-grid-toolbar-btn-holder{position:absolute;right:10px;top:14px}.tui-grid-height-resize-bar{overflow:hidden;cursor:row-resize;position:absolute;bottom:0;height:15px;width:100%;border:0;font-size:0;text-align:center}.tui-grid-height-resize-bar span{background:url(../images/icons.gif) -70px -60px no-repeat;display:inline-block;width:17px;height:6px;margin-top:5px}.tui-grid-height-resize-handle{display:block;margin:0 10px;border-style:solid;border-width:1px 0 0;cursor:row-resize}.tui-grid-pagination{height:12px;margin-bottom:12px;padding-top:14px;line-height:normal;text-align:center}.tui-grid-pagination a,.tui-grid-pagination span,.tui-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}.tui-grid-pagination strong{padding:4px 6px;color:#ff1313;border:1px solid #d4d4d4;background:#e7e7e7}.tui-grid-pagination .tui-grid-next,.tui-grid-pagination .tui-grid-next-end,.tui-grid-pagination .tui-grid-next-end-off,.tui-grid-pagination .tui-grid-next-off,.tui-grid-pagination .tui-grid-pre,.tui-grid-pagination .tui-grid-pre-end,.tui-grid-pagination .tui-grid-pre-end-off,.tui-grid-pagination .tui-grid-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}.tui-grid-pagination .tui-grid-next-end,.tui-grid-pagination .tui-grid-next-end-off,.tui-grid-pagination .tui-grid-pre-end,.tui-grid-pagination .tui-grid-pre-end-off{width:24px}.tui-grid-pagination .tui-grid-pre,.tui-grid-pagination .tui-grid-pre-off{margin-right:12px}.tui-grid-pagination .tui-grid-next,.tui-grid-pagination .tui-grid-next-off{margin-left:12px}.tui-grid-pagination .tui-grid-pre-end{background-position:0 0}.tui-grid-pagination .tui-grid-pre-end-off{background-position:0 -30px}.tui-grid-pagination .tui-grid-pre{background-position:-24px 0}.tui-grid-pagination .tui-grid-pre-off{background-position:-24px -30px}.tui-grid-pagination .tui-grid-next{background-position:-50px 0}.tui-grid-pagination .tui-grid-next-off{background-position:-50px -30px}.tui-grid-pagination .tui-grid-next-end{background-position:-75px 0}.tui-grid-pagination .tui-grid-next-end-off{background-position:-75px -30px} \ No newline at end of file +.tui-grid-btn-sorting,.tui-grid-cell img{vertical-align:middle}.tui-grid-container{width:100%;position:relative;border-width:0;clear:both;font-size:12px;font-family:'돋움',Dotum,Helvetica,'Apple SD Gothic Neo',Sans-serif}.tui-grid-container ::-webkit-scrollbar{-webkit-appearance:none;width:17px;height:17px}.tui-grid-container ::-webkit-scrollbar-thumb{border:5px solid transparent;border-radius:7px;background-clip:content-box}.tui-grid-container *{box-sizing:content-box}.tui-grid-cell-content select,.tui-grid-table{box-sizing:border-box;width:100%}.tui-grid-container input,.tui-grid-container p{margin:0;padding:0}.tui-grid-container fieldset{margin:0;padding:0;border:0;display:inline;white-space:nowrap}.tui-grid-icon-arrow-left,.tui-grid-icon-arrow-right{border-top-color:transparent;border-bottom-color:transparent}.tui-grid-container input[type=password],.tui-grid-container input[type=text]{outline:0;box-sizing:border-box;line-height:normal}.tui-grid-container li,.tui-grid-container ul{list-style:none;padding:0;margin:0}.tui-grid-container em,.tui-grid-container strong{font-style:normal}.tui-grid-clipboard{position:fixed;top:0;left:-9999px;width:100px;height:100px}.tui-grid-btn-text{display:inline-block;text-decoration:none}.tui-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}.tui-grid-btn-text em{position:absolute;left:0;top:5px;width:17px;height:12px;background:url(../images/icons.gif) no-repeat}.tui-grid-btn-text em.tui-grid-btn-excel-icon{background-position:-30px -60px}.tui-grid-btn-sorting{display:inline-block;overflow:hidden;margin-left:6px;height:15px;width:8px;background:url(../images/icons.gif) -20px -60px no-repeat;cursor:pointer}.tui-grid-btn-sorting-down{background-position:0 -60px}.tui-grid-btn-sorting-up{background-position:-10px -60px}.tui-grid-icon-arrow{display:inline-block;width:0;height:0;border-style:solid;border-width:4px;border-color:#a0a0a0}.tui-grid-icon-arrow-left{border-left-width:0}.tui-grid-icon-arrow-right{border-right-width:0}.tui-grid-layer-state{position:absolute;top:0;left:0;width:100%;border-bottom:solid 1px #ccc;background:#fff;font-weight:700;text-align:center;z-index:12}.tui-grid-layer-state-content{padding-top:50px}.tui-grid-layer-state-loading{display:block;margin:10px auto 0;background:url(../images/ani_loading.gif);border:0;width:150px;height:13px}.tui-grid-cell,.tui-grid-layer-editing,.tui-grid-layer-selection,.tui-grid-table{border-width:1px;border-style:solid}.tui-grid-layer-editing{position:absolute;display:none;background:#fff;z-index:15;padding:0 10px;white-space:nowrap}.tui-grid-layer-focus-border{position:absolute;overflow:hidden;z-index:14}.tui-grid-layer-selection{position:absolute;display:none;top:0;width:0;height:0;opacity:.2;filter:alpha(opacity=20)}.tui-grid-layer-datepicker{position:absolute}.tui-grid-table{table-layout:fixed;border-collapse:collapse;margin:0}.tui-grid-lside-area .tui-grid-table{border-right-width:0}.tui-grid-cell{overflow:hidden;white-space:nowrap;padding:0 10px}.tui-grid-cell-head{padding:0;text-align:center}.tui-grid-cell-ellipsis{text-overflow:ellipsis}.tui-grid-cell-content .tui-grid-content-before{float:left;margin-right:2px;line-height:1.5}.tui-grid-cell-content .tui-grid-content-after{float:right;margin-left:2px;line-height:1.5}.tui-grid-cell-content .tui-grid-content-input{display:block;overflow:hidden;line-height:1.5}.tui-grid-cell-content input[type=password],.tui-grid-cell-content input[type=text]{width:100%;padding:2px 0;border:1px solid #e2e3ea;border-top:solid 1px #abadb3;border-bottom:solid 1px #e3e9ef}.tui-grid-cell-content label+input{margin-left:10px}.tui-grid-column-resize-container{display:none;position:relative;width:0}.tui-grid-column-resize-handle{float:left;position:absolute;top:-1px;left:-99px;width:7px;height:100%;background:#000;opacity:0;filter:alpha(opacity=0);cursor:col-resize}.tui-grid-column-resize-handle-last{width:3px}.tui-grid-border-line{position:absolute;z-index:13}.tui-grid-border-line-top{top:0;left:0;right:0;height:1px}.tui-grid-border-line-left{top:0;bottom:0;left:0;width:1px}.tui-grid-border-line-right{top:0;bottom:0;right:0;width:1px}.tui-grid-border-line-bottom{bottom:0;left:0;right:17px;height:1px}.tui-grid-no-scroll-x .tui-grid-border-line-bottom,.tui-grid-no-scroll-y .tui-grid-border-line-bottom{right:0}.tui-grid-content-area{position:relative;border-style:solid;border-width:0 0 1px}.tui-grid-content-area.tui-grid-no-scroll-x{border-bottom-width:0}.tui-grid-head-area{border-style:solid;border-width:0 0 1px}.tui-grid-head-area .tui-grid-cell-head{border-top-width:1px;border-bottom-width:1px}.tui-grid-lside-area{display:none;position:absolute;top:0;left:0;overflow:hidden;z-index:10}.tui-grid-lside-area .tui-grid-head-area{overflow:hidden}.tui-grid-lside-area .tui-grid-body-area{position:relative;overflow:scroll;margin-right:-17px}.tui-grid-lside-area .tui-grid-body-area .tui-grid-selection-layer{left:1px}.tui-grid-rside-area{display:none;overflow:hidden}.tui-grid-rside-area .tui-grid-head-area{position:relative;padding-right:17px;overflow:hidden}.tui-grid-rside-area .tui-grid-head-area.tui-grid-no-scroll-y{padding-right:0}.tui-grid-rside-area .tui-grid-body-area{position:relative;overflow:scroll}.tui-grid-body-container{position:relative;margin-top:-1px}.tui-grid-table-container{position:absolute}.tui-grid-scrollbar-head{display:block;position:absolute;top:0;right:0;width:16px;border-style:solid;border-width:1px}.tui-grid-scrollbar-left-bottom{position:absolute;bottom:0;left:0;right:0;height:17px}.tui-grid-scrollbar-right-bottom{position:absolute;bottom:0;right:0;width:17px;height:17px}.tui-grid-scrollbar-border{display:block;position:absolute;right:17px;width:1px}.tui-grid-toolbar{display:none;left:0;right:0;height:65px;bottom:0;position:absolute;border-style:solid;border-width:0 1px 1px;z-index:11}.tui-grid-toolbar-btn-holder{position:absolute;right:10px;top:14px}.tui-grid-height-resize-bar{overflow:hidden;cursor:row-resize;position:absolute;bottom:0;height:15px;width:100%;border:0;font-size:0;text-align:center}.tui-grid-height-resize-bar span{background:url(../images/icons.gif) -70px -60px no-repeat;display:inline-block;width:17px;height:6px;margin-top:5px}.tui-grid-height-resize-handle{display:block;margin:0 10px;border-style:solid;border-width:1px 0 0;cursor:row-resize}.tui-grid-pagination{height:12px;margin-bottom:12px;padding-top:14px;line-height:normal;text-align:center}.tui-grid-pagination a,.tui-grid-pagination span,.tui-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}.tui-grid-pagination strong{padding:4px 6px;color:#ff1313;border:1px solid #d4d4d4;background:#e7e7e7}.tui-grid-pagination .tui-grid-next,.tui-grid-pagination .tui-grid-next-end,.tui-grid-pagination .tui-grid-next-end-off,.tui-grid-pagination .tui-grid-next-off,.tui-grid-pagination .tui-grid-pre,.tui-grid-pagination .tui-grid-pre-end,.tui-grid-pagination .tui-grid-pre-end-off,.tui-grid-pagination .tui-grid-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}.tui-grid-pagination .tui-grid-next-end,.tui-grid-pagination .tui-grid-next-end-off,.tui-grid-pagination .tui-grid-pre-end,.tui-grid-pagination .tui-grid-pre-end-off{width:24px}.tui-grid-pagination .tui-grid-pre,.tui-grid-pagination .tui-grid-pre-off{margin-right:12px}.tui-grid-pagination .tui-grid-next,.tui-grid-pagination .tui-grid-next-off{margin-left:12px}.tui-grid-pagination .tui-grid-pre-end{background-position:0 0}.tui-grid-pagination .tui-grid-pre-end-off{background-position:0 -30px}.tui-grid-pagination .tui-grid-pre{background-position:-24px 0}.tui-grid-pagination .tui-grid-pre-off{background-position:-24px -30px}.tui-grid-pagination .tui-grid-next{background-position:-50px 0}.tui-grid-pagination .tui-grid-next-off{background-position:-50px -30px}.tui-grid-pagination .tui-grid-next-end{background-position:-75px 0}.tui-grid-pagination .tui-grid-next-end-off{background-position:-75px -30px}.tui-grid-calendar-btn-next-month,.tui-grid-calendar-btn-next-year,.tui-grid-calendar-btn-prev-month,.tui-grid-calendar-btn-prev-year{position:absolute;top:4px;padding:3px 6px 2px;border:1px solid transparent}.tui-grid-calendar-btn-next-month:hover,.tui-grid-calendar-btn-next-year:hover,.tui-grid-calendar-btn-prev-month:hover,.tui-grid-calendar-btn-prev-year:hover{border-color:#ccc}.tui-grid-calendar{position:absolute;width:190px;background:#fff;border:1px solid #ccc;font-size:11px;color:#444;font-family:arial}.tui-grid-calendar table{margin:0 auto;table-layout:fixed;text-align:center}.tui-grid-calendar table tr{height:20px}.tui-grid-calendar table th{width:20px}.tui-grid-calendar table th.tui-grid-calendar-sat{color:#00f}.tui-grid-calendar table th.tui-grid-calendar-sun{color:#e82828}.tui-grid-calendar table td{background:#eee;color:#ccc}.tui-grid-calendar table td.tui-grid-calendar-selectable{cursor:pointer;background:#fff;color:#444}.tui-grid-calendar table td.tui-grid-calendar-selectable.tui-grid-calendar-selected{background:#c3ebff;font-weight:700}.tui-grid-calendar table td.tui-grid-calendar-selectable.tui-grid-calendar-sat{color:#00f}.tui-grid-calendar table td.tui-grid-calendar-selectable.tui-grid-calendar-sun{color:#e82828}.tui-grid-calendar table td.tui-grid-calendar-selectable:hover{background:#c3ebff}.tui-grid-calendar-header{padding:6px 0 5px;text-align:center;border-bottom:1px solid #ddd}.tui-grid-calendar-title{font-size:14px}.tui-grid-calendar-body{padding:5px 7px}.tui-grid-calendar-btn-prev-year{left:18px}.tui-grid-calendar-btn-prev-month{left:42px}.tui-grid-calendar-btn-next-month{right:42px}.tui-grid-calendar-btn-next-year{right:20px}.tui-grid-calendar-today{text-decoration:underline}.tui-grid-calendar-next-month,.tui-grid-calendar-prev-month{opacity:.4;filter:alpha(opacity=40)}.tui-grid-calendar-footer{display:none} \ No newline at end of file diff --git a/samples/js/grid.js b/samples/js/grid.js index 4403e2a85..c7f57f0dd 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.2.1 + * @version 1.3.0 * @license MIT * @link https://github.com/nhnent/tui.grid */ @@ -196,6 +196,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ */ _initializePagination: function() { var pagination = this.pagination; + if (pagination) { pagination.setOption('itemPerPage', this.perPage); pagination.setOption('itemCount', 1); @@ -288,6 +289,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ */ _setFormData: function(data) { var formData = _.clone(data); + _.each(this.lastRequestedReadData, function(value, key) { if ((_.isUndefined(formData[key]) || _.isNull(formData[key])) && value) { formData[key] = ''; @@ -351,7 +353,6 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * @private */ _getFormData: function() { - /* istanbul ignore next*/ return formUtil.getFormData(this.$el); }, @@ -362,8 +363,8 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * @private */ _onReadSuccess: function(dataModel, responseData) { - var pagination = this.pagination, - page, totalCount; + var pagination = this.pagination; + var page, totalCount; dataModel.setOriginalRowList(); @@ -612,7 +613,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ _.each(dataMap, function(list, name) { if (_.contains(checkList, name) && list.length) { count += list.length; - data[name] = $.toJSON(list); + data[name] = JSON.stringify(list); } }, this); } else { @@ -644,15 +645,15 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ */ _getRequestParam: function(requestType, options) { var defaultOptions = { - url: this.api[requestType], - type: null, - hasDataParam: true, - isOnlyModified: true, - isOnlyChecked: true - }, - newOptions = $.extend(defaultOptions, options), - dataParam = this._getDataParam(requestType, newOptions), - param = null; + url: this.api[requestType], + type: null, + hasDataParam: true, + isOnlyModified: true, + isOnlyChecked: true + }; + var newOptions = $.extend(defaultOptions, options); + var dataParam = this._getDataParam(requestType, newOptions); + var param = null; if (newOptions.isSkipConfirm || this._isConfirmed(requestType, dataParam.count)) { param = { @@ -662,6 +663,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ type: newOptions.type }; } + return param; }, @@ -675,12 +677,12 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ _isConfirmed: function(requestType, count) { var result = false; - /* istanbul ignore next: confirm 을 확인할 수 없읔 */ if (count > 0) { result = confirm(this._getConfirmMessage(requestType, count)); } else { alert(this._getConfirmMessage(requestType, count)); } + return result; }, @@ -693,19 +695,20 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ */ _getConfirmMessage: function(requestType, count) { var textMap = { - 'createData': '입력', - 'updateData': '수정', - 'deleteData': '삭제', - 'modifyData': '반영' - }, - actionName = textMap[requestType], - message; + createData: '입력', + updateData: '수정', + deleteData: '삭제', + modifyData: '반영' + }; + var actionName = textMap[requestType]; + var message; if (count > 0) { message = count + '건의 데이터를 ' + actionName + '하시겠습니까?'; } else { message = actionName + '할 데이터가 없습니다.'; } + return message; }, @@ -715,8 +718,8 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * @private */ _ajax: function(options) { - var eventData = new GridEvent(options.data), - params; + var eventData = new GridEvent(options.data); + var params; this.trigger('beforeRequest', eventData); if (eventData.isStopped()) { @@ -759,13 +762,13 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ * @private */ _onSuccess: function(callback, options, responseData, status, jqXHR) { - var message = responseData && responseData.message, - eventData = new GridEvent({ - httpStatus: status, - requestType: options.requestType, - requestParameter: options.data, - responseData: responseData - }); + var message = responseData && responseData.message; + var eventData = new GridEvent({ + httpStatus: status, + requestType: options.requestType, + requestParameter: options.data, + responseData: responseData + }); this.trigger('response', eventData); if (eventData.isStopped()) { @@ -1015,6 +1018,7 @@ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ this.message = message || 'error'; }; GridError.prototype = new Error(); + return new GridError(); }, @@ -1027,7 +1031,7 @@ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ if (!_.isArray(views)) { views = [views]; } - [].push.apply(this._children, views); + [].push.apply(this._children, _.compact(views)); }, /** @@ -1038,6 +1042,7 @@ var View = Backbone.View.extend(/**@lends module:base/view.prototype */{ var elements = _.map(this._children, function(view) { return view.render().el; }); + return elements; }, @@ -1083,6 +1088,11 @@ var classNames = { NO_SCROLL_X: 'no-scroll-x', NO_SCROLL_Y: 'no-scroll-y', + // icon + ICO_ARROW: 'icon-arrow', + ICO_ARROW_LEFT: 'icon-arrow-left', + ICO_ARROW_RIGHT: 'icon-arrow-right', + // layer LAYER_STATE: 'layer-state', LAYER_STATE_CONTENT: 'layer-state-content', @@ -1091,6 +1101,7 @@ var classNames = { LAYER_FOCUS: 'layer-focus', LAYER_FOCUS_BORDER: 'layer-focus-border', LAYER_SELECTION: 'layer-selection', + LAYER_DATE_PICKER: 'layer-datepicker', // border line BORDER_LINE: 'border-line', @@ -1100,6 +1111,7 @@ var classNames = { BORDER_BOTTOM: 'border-line-bottom', // layout (area) + CONTENT_AREA: 'content-area', LSIDE_AREA: 'lside-area', RSIDE_AREA: 'rside-area', HEAD_AREA: 'head-area', @@ -1169,7 +1181,16 @@ var classNames = { TOOLBAR: 'toolbar', TOOLBAR_BTN_HOLDER: 'toolbar-btn-holder', HEIGHT_RESIZE_BAR: 'height-resize-bar', - HEIGHT_RESIZE_HANDLE: 'height-resize-handle' + HEIGHT_RESIZE_HANDLE: 'height-resize-handle', + + // etc + CALENDAR: 'calendar', + CALENDAR_BTN_PREV_YEAR: 'calendar-btn-prev-year', + CALENDAR_BTN_NEXT_YEAR: 'calendar-btn-next-year', + CALENDAR_BTN_PREV_MONTH: 'calendar-btn-prev-month', + CALENDAR_BTN_NEXT_MONTH: 'calendar-btn-next-month', + CALENDAR_SELECTABLE: 'calendar-selectable', + CALENDAR_SELECTED: 'calendar-selected' }; var exports = _.mapObject(classNames, function(className) { @@ -1235,6 +1256,11 @@ module.exports = { DEFAULT: 'default', STRIPED: 'striped', CLEAN: 'clean' + }, + selectionType: { + CELL: 'CELL', + ROW: 'ROW', + COLUMN: 'COLUMN' } }; @@ -1265,6 +1291,7 @@ var formUtil = { _.each(arr, function(value, i) { arr[i] = String(value); }); + return arr; }, @@ -1381,6 +1408,7 @@ var formUtil = { formElement = $form.prop('elements'); } } + return $(formElement); }, @@ -1541,6 +1569,7 @@ var util = { _.each(attributes, function(value, key) { str += ' ' + key + '="' + value + '"'; }, this); + return str; }, @@ -1553,6 +1582,7 @@ var util = { sum: function(list) { return _.reduce(list, function(memo, value) { memo += value; + return memo; }, 0); }, @@ -1669,13 +1699,13 @@ var util = { htmlString = htmlString.replace(/[\n\r\t]/g, ''); if (tui.util.hasEncodableString(htmlString)) { if (/]*\ssrc=[\"']?([^>\"']+)[\"']?[^>]*>/i); + matchResult = htmlString.match(/]*\ssrc=["']?([^>"']+)["']?[^>]*>/i); htmlString = matchResult ? matchResult[1] : ''; } else { htmlString = htmlString.replace(//gi, ''); } htmlString = $.trim(tui.util.decodeHTMLEntity( - htmlString.replace(/<\/?(?:h[1-5]|[a-z]+(?:\:[a-z]+)?)[^>]*>/ig, '') + htmlString.replace(/<\/?(?:h[1-5]|[a-z]+(?::[a-z]+)?)[^>]*>/ig, '') )); } return htmlString; @@ -1715,7 +1745,7 @@ var util = { _.each(dataObj, function(value, name) { if (!_.isString(value) && !_.isNumber(value)) { - value = $.toJSON(value); + value = JSON.stringify(value); } value = encodeURIComponent(value); if (value) { @@ -1743,7 +1773,7 @@ var util = { key = tmp[0]; value = decodeURIComponent(tmp[1]); try { - value = $.parseJSON(value); + value = JSON.parse(value); } catch(e) {} // eslint-disable-line if (!_.isNull(value)) { @@ -2001,6 +2031,11 @@ module.exports = DomState; * @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 {Object} [options.columnModelList.component] - Option for using tui-component + * @param {string} [options.columnModelList.component.name] - The name of the compnent to use + for this column + * @param {Object} [options.columnModelList.component.option] - The option object to be used for + creating the component * @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 @@ -2636,10 +2671,10 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ * @returns {Array|string} - A list of the rowKey. (or JSON string of the list) */ getCheckedRowKeyList: function(isJsonString) { - var checkedRowList = this.modelManager.dataModel.getRowList(true), - checkedRowKeyList = _.pluck(checkedRowList, 'rowKey'); + var checkedRowList = this.modelManager.dataModel.getRowList(true); + var checkedRowKeyList = _.pluck(checkedRowList, 'rowKey'); - return isJsonString ? $.toJSON(checkedRowKeyList) : checkedRowKeyList; + return isJsonString ? JSON.stringify(checkedRowKeyList) : checkedRowKeyList; }, /** @@ -2651,7 +2686,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ getCheckedRowList: function(isJsonString) { var checkedRowList = this.modelManager.dataModel.getRowList(true); - return isJsonString ? $.toJSON(checkedRowList) : checkedRowList; + return isJsonString ? JSON.stringify(checkedRowList) : checkedRowList; }, /** @@ -3067,7 +3102,7 @@ tui.Grid.applyTheme = function(presetName, extOptions) { themeManager.apply(presetName, extOptions); }; -},{"./addon/net":2,"./base/view":7,"./common/constMap":9,"./common/util":12,"./domState":13,"./model/manager":21,"./painter/controller":29,"./painter/manager":36,"./publicEventEmitter":38,"./theme/manager":40,"./view/factory":48}],15:[function(require,module,exports){ +},{"./addon/net":2,"./base/view":7,"./common/constMap":9,"./common/util":12,"./domState":13,"./model/manager":21,"./painter/controller":29,"./painter/manager":36,"./publicEventEmitter":38,"./theme/manager":40,"./view/factory":49}],15:[function(require,module,exports){ /** * @fileoverview 컬럼 모델 * @author NHN Ent. FE Development Team @@ -4792,7 +4827,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ var row = this.get(rowKey), rowData = row ? row.toJSON() : null; - return isJsonString ? $.toJSON(rowData) : rowData; + return isJsonString ? JSON.stringify(rowData) : rowData; }, /** @@ -4805,7 +4840,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ var row = this.at(index), rowData = row ? row.toJSON() : null; - return isJsonString ? $.toJSON(row) : rowData; + return isJsonString ? JSON.stringify(row) : rowData; }, /** @@ -4862,7 +4897,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ */ getColumnValues: function(columnName, isJsonString) { var valueList = this.pluck(columnName); - return isJsonString ? $.toJSON(valueList) : valueList; + return isJsonString ? JSON.stringify(valueList) : valueList; }, /** @@ -5103,7 +5138,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ var filtered = _.omit(row, filteringColumnList); var result = _.some(filtered, function(value, columnName) { if (typeof value === 'object') { - return ($.toJSON(value) !== $.toJSON(originalRow[columnName])); + return (JSON.stringify(value) !== JSON.stringify(originalRow[columnName])); } return value !== originalRow[columnName]; }, this); @@ -5461,10 +5496,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _getAvailableTotalWidth: function(columnLength) { - var totalWidth = this.get('width'), - borderCount = columnLength + 1 + (this.isDivisionBorderDoubled() ? 1 : 0), - totalBorderWidth = borderCount * CELL_BORDER_WIDTH, - availableTotalWidth = totalWidth - this.getScrollYWidth() - totalBorderWidth; + var totalWidth = this.get('width'); + var borderCount = columnLength + 1 + (this.isDivisionBorderDoubled() ? 1 : 0); + var totalBorderWidth = borderCount * CELL_BORDER_WIDTH; + var availableTotalWidth = totalWidth - this.getScrollYWidth() - totalBorderWidth; return availableTotalWidth; }, @@ -5476,8 +5511,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _applyMinimumColumnWidth: function(columnWidthList) { - var minWidthList = this._minColumnWidthList, - appliedList = _.clone(columnWidthList); + var minWidthList = this._minColumnWidthList; + var appliedList = _.clone(columnWidthList); _.each(appliedList, function(width, index) { var minWidth = minWidthList[index]; @@ -5485,6 +5520,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ appliedList[index] = minWidth; } }); + return appliedList; }, @@ -5493,8 +5529,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _resetTotalRowHeight: function() { - var rowHeight = this.get('rowHeight'), - rowCount = this.dataModel.length; + var rowHeight = this.get('rowHeight'); + var rowCount = this.dataModel.length; this.set('totalRowHeight', util.getHeight(rowCount, rowHeight)); }, @@ -5523,15 +5559,16 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _fillEmptyColumnWidth: function(columnWidthList) { - var totalWidth = this._getAvailableTotalWidth(columnWidthList.length), - remainTotalWidth = totalWidth - util.sum(columnWidthList), - emptyIndexes = []; + var totalWidth = this._getAvailableTotalWidth(columnWidthList.length); + var remainTotalWidth = totalWidth - util.sum(columnWidthList); + var emptyIndexes = []; _.each(columnWidthList, function(width, index) { if (!width) { emptyIndexes.push(index); } }); + return this._distributeExtraWidthEqually(columnWidthList, remainTotalWidth, emptyIndexes); }, @@ -5543,8 +5580,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _addExtraColumnWidth: function(columnWidthList, totalExtraWidth) { - var fixedFlags = this._columnWidthFixedFlags, - columnIndexes = []; + var fixedFlags = this._columnWidthFixedFlags; + var columnIndexes = []; _.each(fixedFlags, function(flag, index) { if (!flag) { @@ -5562,9 +5599,9 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _reduceExcessColumnWidth: function(columnWidthList, totalExcessWidth) { - var minWidthList = this._minColumnWidthList, - fixedFlags = this._columnWidthFixedFlags, - availableList = []; + var minWidthList = this._minColumnWidthList; + var fixedFlags = this._columnWidthFixedFlags; + var availableList = []; _.each(columnWidthList, function(width, index) { if (!fixedFlags[index]) { @@ -5589,9 +5626,9 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _reduceExcessColumnWidthSub: function(columnWidthList, totalRemainWidth, availableList) { - var avgValue = Math.round(totalRemainWidth / availableList.length), - newAvailableList = [], - columnIndexes; + var avgValue = Math.round(totalRemainWidth / availableList.length); + var newAvailableList = []; + var columnIndexes; _.each(availableList, function(available) { // note that totalRemainWidth and avgValue are negative number. @@ -5620,10 +5657,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _distributeExtraWidthEqually: function(columnWidthList, extraWidth, columnIndexes) { - var length = columnIndexes.length, - avgValue = Math.round(extraWidth / length), - errorValue = (avgValue * length) - extraWidth, // to correct total width - resultList = _.clone(columnWidthList); + var length = columnIndexes.length; + var avgValue = Math.round(extraWidth / length); + var errorValue = (avgValue * length) - extraWidth; // to correct total width + var resultList = _.clone(columnWidthList); _.each(columnIndexes, function(columnIndex) { resultList[columnIndex] += avgValue; @@ -5645,11 +5682,11 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _adjustColumnWidthList: function(columnWidthList, fitToReducedTotal) { - var columnLength = columnWidthList.length, - availableWidth = this._getAvailableTotalWidth(columnLength), - totalExtraWidth = availableWidth - util.sum(columnWidthList), - fixedCount = _.filter(this._columnWidthFixedFlags).length, - adjustedList; + var columnLength = columnWidthList.length; + var availableWidth = this._getAvailableTotalWidth(columnLength); + var totalExtraWidth = availableWidth - util.sum(columnWidthList); + var fixedCount = _.filter(this._columnWidthFixedFlags).length; + var adjustedList; if (totalExtraWidth > 0) { if (columnLength > fixedCount) { @@ -5664,6 +5701,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ } else { adjustedList = columnWidthList; } + return adjustedList; }, @@ -5672,15 +5710,15 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _initColumnWidthVariables: function() { - var columnModelList = this.columnModel.getVisibleColumnModelList(null, true), - commonMinWidth = this.get('minimumColumnWidth'), - widthList = [], - fixedFlags = [], - minWidthList = []; + var columnModelList = this.columnModel.getVisibleColumnModelList(null, true); + var commonMinWidth = this.get('minimumColumnWidth'); + var widthList = []; + var fixedFlags = []; + var minWidthList = []; _.each(columnModelList, function(columnModel) { - var width = columnModel.width > 0 ? columnModel.width : 0, - minWidth = Math.max(width, commonMinWidth); + var width = columnModel.width > 0 ? columnModel.width : 0; + var minWidth = Math.max(width, commonMinWidth); // Meta columns are not affected by common 'minimumColumnWidth' value if (util.isMetaColumn(columnModel.columnName)) { @@ -5731,13 +5769,14 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @returns {Number} 해당 frame 의 너비 */ getFrameWidth: function(whichSide) { - var columnFixCount = this.columnModel.getVisibleColumnFixCount(true), - columnWidthList = this.getColumnWidthList(whichSide), - frameWidth = this._getFrameWidth(columnWidthList); + var columnFixCount = this.columnModel.getVisibleColumnFixCount(true); + var columnWidthList = this.getColumnWidthList(whichSide); + var frameWidth = this._getFrameWidth(columnWidthList); if (_.isUndefined(whichSide) && columnFixCount > 0) { frameWidth += CELL_BORDER_WIDTH; } + return frameWidth; }, @@ -5749,9 +5788,11 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ */ _getFrameWidth: function(widthList) { var frameWidth = 0; + if (widthList.length) { frameWidth = util.sum(widthList) + ((widthList.length + 1) * CELL_BORDER_WIDTH); } + return frameWidth; }, @@ -5762,10 +5803,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _setColumnWidthVariables: function(columnWidthList, isSaveWidthList) { - var totalWidth = this.get('width'), - columnFixCount = this.columnModel.getVisibleColumnFixCount(true), - maxLeftSideWidth = this._getMaxLeftSideWidth(), - rsideWidth, lsideWidth, lsideWidthList, rsideWidthList; + var totalWidth = this.get('width'); + var columnFixCount = this.columnModel.getVisibleColumnFixCount(true); + var maxLeftSideWidth = this._getMaxLeftSideWidth(); + var rsideWidth, lsideWidth, lsideWidthList, rsideWidthList; lsideWidthList = columnWidthList.slice(0, columnFixCount); rsideWidthList = columnWidthList.slice(columnFixCount); @@ -5796,15 +5837,16 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _getMinLeftSideWidth: function() { - var minimumColumnWidth = this.get('minimumColumnWidth'), - columnFixCount = this.columnModel.getVisibleColumnFixCount(true), - minWidth = 0, - borderWidth; + var minimumColumnWidth = this.get('minimumColumnWidth'); + var columnFixCount = this.columnModel.getVisibleColumnFixCount(true); + var minWidth = 0; + var borderWidth; if (columnFixCount) { borderWidth = (columnFixCount + 1) * CELL_BORDER_WIDTH; minWidth = borderWidth + (minimumColumnWidth * columnFixCount); } + return minWidth; }, @@ -5819,6 +5861,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ if (maxWidth) { maxWidth = Math.max(maxWidth, this._getMinLeftSideWidth()); } + return maxWidth; }, @@ -5953,10 +5996,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _judgeScrollDirection: function(targetPosition, isRsideColumn, bodySize) { - var renderModel = this.renderModel, - currentTop = renderModel.get('scrollTop'), - currentLeft = renderModel.get('scrollLeft'), - isUp, isDown, isLeft, isRight; + var renderModel = this.renderModel; + var currentTop = renderModel.get('scrollTop'); + var currentLeft = renderModel.get('scrollLeft'); + var isUp, isDown, isLeft, isRight; isUp = targetPosition.top < currentTop; isDown = !isUp && (targetPosition.bottom > (currentTop + bodySize.height)); @@ -6008,8 +6051,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @returns {{x: number, y: number}} Mouse-overflow */ getOverflowFromMousePosition: function(pageX, pageY) { - var containerPos = this._rebasePositionToContainer(pageX, pageY), - bodySize = this._getBodySize(); + var containerPos = this._rebasePositionToContainer(pageX, pageY); + var bodySize = this._getBodySize(); return this._judgeOverflow(containerPos, bodySize); }, @@ -6022,10 +6065,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _judgeOverflow: function(containerPosition, bodySize) { - var containerX = containerPosition.x, - containerY = containerPosition.y, - overflowY = 0, - overflowX = 0; + var containerX = containerPosition.x; + var containerY = containerPosition.y; + var overflowY = 0; + var overflowX = 0; if (containerY < 0) { overflowY = -1; @@ -6068,10 +6111,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _calcRowIndexFromPositionY: function(containerY) { - var cellY = containerY + this.renderModel.get('scrollTop'), - tempIndex = Math.floor(cellY / (this.get('rowHeight') + CELL_BORDER_WIDTH)), - min = 0, - max = Math.max(min, this.dataModel.length - 1); + var cellY = containerY + this.renderModel.get('scrollTop'); + var tempIndex = Math.floor(cellY / (this.get('rowHeight') + CELL_BORDER_WIDTH)); + var min = 0; + var max = Math.max(min, this.dataModel.length - 1); return util.clamp(tempIndex, min, max); }, @@ -6084,12 +6127,12 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _calcColumnIndexFromPositionX: function(containerX, withMeta) { - var columnWidthList = this.getColumnWidthList(), - totalColumnWidth = this.getFrameWidth(), - cellX = containerX, - isRsidePosition = containerX >= this.get('lsideWidth'), - adjustableIndex = (withMeta) ? 0 : this.columnModel.getVisibleMetaColumnCount(), - columnIndex = 0; + var columnWidthList = this.getColumnWidthList(); + var totalColumnWidth = this.getFrameWidth(); + var cellX = containerX; + var isRsidePosition = containerX >= this.get('lsideWidth'); + var adjustableIndex = (withMeta) ? 0 : this.columnModel.getVisibleMetaColumnCount(); + var columnIndex = 0; if (isRsidePosition) { cellX += this.renderModel.get('scrollLeft'); @@ -6121,8 +6164,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _rebasePositionToContainer: function(pageX, pageY) { - var containerPosX = pageX - this.get('offsetLeft'), - containerPosY = pageY - (this.get('offsetTop') + this.get('headerHeight') + 2); + var containerPosX = pageX - this.get('offsetLeft'); + var containerPosY = pageY - (this.get('offsetTop') + this.get('headerHeight') + 2); return { x: containerPosX, @@ -6138,11 +6181,12 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @private */ _adjustLeftSideWidthList: function(lsideWidthList, totalWidth) { - var i = lsideWidthList.length - 1, - minimumColumnWidth = this.get('minimumColumnWidth'), - currentWidth = this._getFrameWidth(lsideWidthList), - diff = currentWidth - totalWidth, - changedWidth; + var i = lsideWidthList.length - 1; + var minimumColumnWidth = this.get('minimumColumnWidth'); + var currentWidth = this._getFrameWidth(lsideWidthList); + var diff = currentWidth - totalWidth; + var changedWidth; + if (diff > 0) { while (i >= 0 && diff > 0) { changedWidth = Math.max(minimumColumnWidth, lsideWidthList[i] - diff); @@ -6153,6 +6197,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ } else if (diff < 0) { lsideWidthList[i] += Math.abs(diff); } + return lsideWidthList; }, @@ -6195,6 +6240,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ */ _onWidthChange: function() { var widthList = this._adjustColumnWidthList(this.get('columnWidthList'), true); + this._setColumnWidthVariables(widthList); }, @@ -6204,10 +6250,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @param {Number} width 변경할 너비 pixel값 */ setColumnWidth: function(index, width) { - var columnWidthList = this.get('columnWidthList'), - fixedFlags = this._columnWidthFixedFlags, - minWidth = this._minColumnWidthList[index], - adjustedList; + var columnWidthList = this.get('columnWidthList'); + var fixedFlags = this._columnWidthFixedFlags; + var minWidth = this._minColumnWidthList[index]; + var adjustedList; if (!fixedFlags[index] && columnWidthList[index]) { columnWidthList[index] = Math.max(width, minWidth); @@ -6276,8 +6322,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * layout 에 필요한 크기 및 위치 데이터를 갱신한다. */ refreshLayout: function() { - var domState = this.domState, - offset = domState.getOffset(); + var domState = this.domState; + var offset = domState.getOffset(); this.set({ offsetTop: offset.top, @@ -6296,6 +6342,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ */ restoreColumnWidth: function(index) { var orgWidth = this.get('originalWidthList')[index]; + this.setColumnWidth(index, orgWidth); }, @@ -6305,8 +6352,8 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @returns {Array} 조회한 영역의 columnWidthList */ getColumnWidthList: function(whichSide) { - var columnFixCount = this.columnModel.getVisibleColumnFixCount(true), - columnWidthList = []; + var columnFixCount = this.columnModel.getVisibleColumnFixCount(true); + var columnWidthList = []; switch (whichSide) { case 'l': @@ -6321,6 +6368,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ columnWidthList = this.get('columnWidthList'); break; } + return columnWidthList; } }); @@ -6449,8 +6497,8 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {Boolean} True is success */ select: function(rowKey) { - var eventData = new GridEvent(), - currentRowKey = this.get('rowKey'); + var eventData = new GridEvent(); + var currentRowKey = this.get('rowKey'); if (String(currentRowKey) === String(rowKey)) { return true; @@ -6480,6 +6528,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ */ _cancelSelect: function() { var prevColumnName = this.get('prevColumnName'); + this.set('columnName', prevColumnName); this.trigger('focus', this.get('rowKey'), prevColumnName); }, @@ -6533,9 +6582,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {Boolean} true if success */ focusAt: function(rowIndex, columnIndex, isScrollable) { - var row = this.dataModel.at(rowIndex), - column = this.columnModel.at(columnIndex, true), - result = false; + var row = this.dataModel.at(rowIndex); + var column = this.columnModel.at(columnIndex, true); + var result = false; if (row && column) { result = this.focus(row.get('rowKey'), column.columnName, isScrollable); @@ -6576,9 +6625,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {Boolean} true if success */ focusInAt: function(rowIndex, columnIndex, isScrollable) { - var row = this.dataModel.at(rowIndex), - column = this.columnModel.at(columnIndex, true), - result = false; + var row = this.dataModel.at(rowIndex); + var column = this.columnModel.at(columnIndex, true); + var result = false; if (row && column) { result = this.focusIn(row.get('rowKey'), column.columnName, isScrollable); @@ -6663,8 +6712,8 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {{row: number, column: number}} The object that contains index info */ indexOf: function(isPrevious) { - var rowKey = isPrevious ? this.get('prevRowKey') : this.get('rowKey'), - columnName = isPrevious ? this.get('prevColumnName') : this.get('columnName'); + var rowKey = isPrevious ? this.get('prevRowKey') : this.get('rowKey'); + var columnName = isPrevious ? this.get('prevColumnName') : this.get('columnName'); return { row: this.dataModel.indexOfRowKey(rowKey), @@ -6678,8 +6727,8 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {boolean} True if has focus. */ has: function(checkValid) { - var rowKey = this.get('rowKey'), - columnName = this.get('columnName'); + var rowKey = this.get('rowKey'); + var columnName = this.get('columnName'); if (checkValid) { return this._isValidCell(rowKey, columnName); @@ -6692,9 +6741,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {boolean} True if restored */ restore: function() { - var prevRowKey = this.get('prevRowKey'), - prevColumnName = this.get('prevColumnName'), - restored = false; + var prevRowKey = this.get('prevRowKey'); + var prevColumnName = this.get('prevColumnName'); + var restored = false; if (this._isValidCell(prevRowKey, prevColumnName)) { this.focus(prevRowKey, prevColumnName); @@ -6769,8 +6818,8 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @private */ _isValidCell: function(rowKey, columnName) { - var isValidRowKey = !util.isBlank(rowKey) && !!this.dataModel.get(rowKey), - isValidColumnName = !util.isBlank(columnName) && !!this.columnModel.getColumnModel(columnName); + var isValidRowKey = !util.isBlank(rowKey) && !!this.dataModel.get(rowKey); + var isValidColumnName = !util.isBlank(columnName) && !!this.columnModel.getColumnModel(columnName); return isValidRowKey && isValidColumnName; }, @@ -6782,9 +6831,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @private */ _findRowKey: function(offset) { - var index, row, - dataModel = this.dataModel, - rowKey = null; + var dataModel = this.dataModel; + var rowKey = null; + var index, row; if (this.has(true)) { index = Math.max( @@ -6808,11 +6857,11 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @private */ _findColumnName: function(offset) { - var index, - columnModel = this.columnModel, - columnModelList = columnModel.getVisibleColumnModelList(), - columnIndex = columnModel.indexOfColumnName(this.get('columnName'), true), - columnName = null; + var columnModel = this.columnModel; + var columnModelList = columnModel.getVisibleColumnModelList(); + var columnIndex = columnModel.indexOfColumnName(this.get('columnName'), true); + var columnName = null; + var index; if (this.has(true)) { index = Math.max(Math.min(columnIndex + offset, columnModelList.length - 1), 0); @@ -6839,6 +6888,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ */ nextRowIndex: function(offset) { var rowKey = this.nextRowKey(offset); + return this.dataModel.indexOfRowKey(rowKey); }, @@ -6849,6 +6899,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ */ prevRowIndex: function(offset) { var rowKey = this.prevRowKey(offset); + return this.dataModel.indexOfRowKey(rowKey); }, @@ -6858,6 +6909,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ */ nextColumnIndex: function() { var columnName = this.nextColumnName(); + return this.columnModel.indexOfColumnName(columnName, true); }, @@ -6867,6 +6919,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ */ prevColumnIndex: function() { var columnName = this.prevColumnName(); + return this.columnModel.indexOfColumnName(columnName, true); }, @@ -6877,9 +6930,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {Number|String} offset 만큼 이동한 위치의 rowKey */ nextRowKey: function(offset) { - var focused = this.which(), - rowKey = focused.rowKey, - count, rowSpanData; + var focused = this.which(); + var rowKey = focused.rowKey; + var count, rowSpanData; offset = (typeof offset === 'number') ? offset : 1; if (offset > 1) { @@ -6900,6 +6953,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ rowKey = this._findRowKey(1); } } + return rowKey; }, @@ -6910,9 +6964,10 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {Number|String} offset 만큼 이동한 위치의 rowKey */ prevRowKey: function(offset) { - var focused = this.which(), - rowKey = focused.rowKey, - rowSpanData; + var focused = this.which(); + var rowKey = focused.rowKey; + var rowSpanData; + offset = typeof offset === 'number' ? offset : 1; offset *= -1; @@ -6930,6 +6985,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ rowKey = this._findRowKey(-1); } } + return rowKey; }, @@ -6971,6 +7027,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ */ firstColumnName: function() { var columnModelList = this.columnModel.getVisibleColumnModelList(); + return columnModelList[0].columnName; }, @@ -6979,8 +7036,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {string} 마지막 컬럼명 */ lastColumnName: function() { - var columnModelList = this.columnModel.getVisibleColumnModelList(), - lastIndex = columnModelList.length - 1; + var columnModelList = this.columnModel.getVisibleColumnModelList(); + var lastIndex = columnModelList.length - 1; + return columnModelList[lastIndex].columnName; } }); @@ -7443,8 +7501,8 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _updateMaxScrollLeft: function() { - var dimension = this.dimensionModel, - maxScrollLeft = dimension.getFrameWidth('R') - dimension.get('rsideWidth') + + var dimension = this.dimensionModel; + var maxScrollLeft = dimension.getFrameWidth('R') - dimension.get('rsideWidth') + dimension.getScrollYWidth(); this.set('maxScrollLeft', maxScrollLeft); @@ -7455,9 +7513,9 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _updateMaxScrollTop: function() { - var dimension = this.dimensionModel, - maxScrollTop = dimension.get('totalRowHeight') - dimension.get('bodyHeight') + - dimension.get('scrollBarSize'); + var dimension = this.dimensionModel; + var maxScrollTop = dimension.get('totalRowHeight') - dimension.get('bodyHeight') + + dimension.get('scrollBarSize'); this.set('maxScrollTop', maxScrollTop); }, @@ -7585,7 +7643,9 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ startIndex: 0, endIndex: 0 }); - this.refresh(true); + this.refresh({ + columnModelChanged: true + }); }, /** @@ -7593,7 +7653,9 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _onDataModelChange: function() { - this.refresh(false, true); + this.refresh({ + dataModelChanged: true + }); }, /** @@ -7603,7 +7665,9 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _onAddDataModel: function(dataModel, options) { - this.refresh(false, true); + this.refresh({ + dataModelChanged: true + }); if (options.focus) { this.focusModel.focusAt(options.at, 0); @@ -7611,13 +7675,13 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ }, /** - * Resets dummy rows and trigger 'rowListChanged' event. + * Resets dummy rows and trigger 'dataModelChanged' event. * @private */ _resetDummyRows: function() { this._clearDummyRows(); this._fillDummyRows(); - this.trigger('rowListChanged'); + this.trigger('dataModelChanged'); }, /** @@ -7667,9 +7731,9 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _getColumnNamesOfEachSide: function() { - var columnFixCount = this.columnModel.getVisibleColumnFixCount(true), - columnModels = this.columnModel.getVisibleColumnModelList(null, true), - columnNames = _.pluck(columnModels, 'columnName'); + var columnFixCount = this.columnModel.getVisibleColumnFixCount(true); + var columnModels = this.columnModel.getVisibleColumnModelList(null, true); + var columnNames = _.pluck(columnModels, 'columnName'); return { lside: columnNames.slice(0, columnFixCount), @@ -7696,12 +7760,12 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _resetAllViewModelListWithRange: function(startIndex, endIndex) { - var columnNamesMap = this._getColumnNamesOfEachSide(), - rowNum = this.get('startNumber') + startIndex, - height = this.dimensionModel.get('rowHeight'), - lsideData = [], - rsideData = [], - rowDataModel, i; + var columnNamesMap = this._getColumnNamesOfEachSide(); + var rowNum = this.get('startNumber') + startIndex; + var height = this.dimensionModel.get('rowHeight'); + var lsideData = []; + var rsideData = []; + var rowDataModel, i; for (i = startIndex; i <= endIndex; i += 1) { rowDataModel = this.dataModel.at(i); @@ -7764,10 +7828,13 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ /** * Refreshes the rendering range and the list of view models, and triggers events. - * @param {Boolean} columnModelChanged - The boolean value whether columnModel has changed - * @param {Boolean} dataModelChanged - The boolean value whether dataModel has changed + * @param {Object} options - options + * @param {Boolean} [options.columnModelChanged] - The boolean value whether columnModel has changed + * @param {Boolean} [options.dataModelChanged] - The boolean value whether dataModel has changed */ - refresh: function(columnModelChanged, dataModelChanged) { + refresh: function(options) { + var columnModelChanged = !!options && options.columnModelChanged; + var dataModelChanged = !!options && options.dataModelChanged; var startIndex, endIndex, i; this._setRenderingRange(this.get('scrollTop')); @@ -7810,8 +7877,8 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _getCollectionByColumnName: function(columnName) { - var lside = this.get('lside'), - collection; + var lside = this.get('lside'); + var collection; if (lside.at(0) && lside.at(0).get(columnName)) { collection = lside; @@ -7856,12 +7923,13 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ } */ getCellData: function(rowKey, columnName) { - var row = this._getRowModel(rowKey, columnName), - cellData = null; + var row = this._getRowModel(rowKey, columnName); + var cellData = null; if (row) { cellData = row.get(columnName); } + return cellData; }, @@ -7871,9 +7939,9 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _executeRelation: function(rowIndex) { - var row = this.dataModel.at(rowIndex), - renderIdx = rowIndex - this.get('startIndex'), - rowModel, relationResult; + var row = this.dataModel.at(rowIndex); + var renderIdx = rowIndex - this.get('startIndex'); + var rowModel, relationResult; relationResult = row.executeRelationCallbacksAll(); @@ -7910,9 +7978,9 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ * @param {object} options - Options */ initialize: function(attributes) { - var rowKey = attributes && attributes.rowKey, - dataModel = this.collection.dataModel, - rowData = dataModel.get(rowKey); + var rowKey = attributes && attributes.rowKey; + var dataModel = this.collection.dataModel; + var rowData = dataModel.get(rowKey); this.dataModel = dataModel; this.columnModel = this.collection.columnModel; @@ -7990,32 +8058,22 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ * @private */ _setRowExtraData: function() { - var dataModel = this.collection.dataModel, - columnNames = this._getColumnNameList(), - param; - if (tui.util.isUndefined(this.collection)) { return; } - _.each(columnNames, function(columnName) { - var cellData = this.get(columnName), - rowModel = this, // eslint-disable-line consistent-this - cellState; + _.each(this._getColumnNameList(), function(columnName) { + var cellData = this.get(columnName); + var cellState; - if (!tui.util.isUndefined(cellData)) { + if (!tui.util.isUndefined(cellData) && cellData.isMainRow) { cellState = this.rowData.getCellState(columnName); - if (dataModel.isRowSpanEnable() && !cellData.isMainRow) { - rowModel = this.collection.get(cellData.mainRowKey); - } - if (rowModel) { - param = { - isDisabled: cellState.isDisabled, - isEditable: cellState.isEditable, - className: this._getClassNameString(columnName) - }; - rowModel.setCell(columnName, param); - } + + this.setCell(columnName, { + isDisabled: cellState.isDisabled, + isEditable: cellState.isEditable, + className: this._getClassNameString(columnName) + }); } }, this); }, @@ -8057,10 +8115,10 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ columnData = _.omit(data, 'rowKey', '_extraData', 'height', 'rowNum'); _.each(columnData, function(value, columnName) { - var rowSpanData = this._getRowSpanData(columnName, data, dataModel.isRowSpanEnable()), - cellState = row.getCellState(columnName), - isTextType = columnModel.isTextType(columnName), - column = columnModel.getColumnModel(columnName); + var rowSpanData = this._getRowSpanData(columnName, data, dataModel.isRowSpanEnable()); + var cellState = row.getCellState(columnName); + var isTextType = columnModel.isTextType(columnName); + var column = columnModel.getColumnModel(columnName); data[columnName] = { rowKey: rowKey, @@ -8117,10 +8175,10 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ * @private */ _getValueAttrs: function(value, row, column, isTextType) { - var beforeContent = tui.util.pick(column, 'editOption', 'beforeContent'), - afterContent = tui.util.pick(column, 'editOption', 'afterContent'), - converter = tui.util.pick(column, 'editOption', 'converter'), - rowAttrs = row.toJSON(); + var beforeContent = tui.util.pick(column, 'editOption', 'beforeContent'); + var afterContent = tui.util.pick(column, 'editOption', 'afterContent'); + var converter = tui.util.pick(column, 'editOption', 'converter'); + var rowAttrs = row.toJSON(); return { value: this._getValueToDisplay(value, column, isTextType), @@ -8198,9 +8256,9 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ * @private */ _getValueToDisplay: function(value, column, isTextType) { - var isExisty = tui.util.isExisty, - notUseHtmlEntity = column.notUseHtmlEntity, - defaultValue = column.defaultValue; + var isExisty = tui.util.isExisty; + var notUseHtmlEntity = column.notUseHtmlEntity; + var defaultValue = column.defaultValue; if (!isExisty(value)) { value = isExisty(defaultValue) ? defaultValue : ''; @@ -8252,9 +8310,9 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ * @param {Object} param - Key-Value pair of the data to change */ setCell: function(columnName, param) { - var isValueChanged = false, - changed = [], - rowIndex, rowKey, data; + var isValueChanged = false; + var changed = []; + var rowIndex, rowKey, data; if (!this.has(columnName)) { return; @@ -8276,7 +8334,7 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ this.set(columnName, data, { silent: this._shouldSetSilently(data, isValueChanged) }); - if (isValueChanged && !data.isEditing) { + if (isValueChanged) { rowIndex = this.collection.dataModel.indexOfRowKey(rowKey); this.trigger('valueChange', rowIndex); } @@ -8293,9 +8351,15 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ _shouldSetSilently: function(cellData, valueChanged) { var valueChangedOnEditing = cellData.isEditing && valueChanged; var useViewMode = tui.util.pick(cellData, 'columnModel', 'editOption', 'useViewMode') !== false; - var editingStarted = _.contains(cellData.changed, 'isEditing') && cellData.isEditing; - - return valueChangedOnEditing || (useViewMode && editingStarted); + var editingChangedToTrue = _.contains(cellData.changed, 'isEditing') && cellData.isEditing; + + // Silent Cases + // 1: If values have been changed while the isEditing is true, + // prevent the related cell-view from changing its value-state until editing is finished. + // 2: If useViewMode is true and isEditing is changing to true, + // prevent the related cell-view from changing its state to enable editing, + // as the editing-layer will be used for editing instead. + return valueChangedOnEditing || (useViewMode && editingChangedToTrue); } }); @@ -8342,21 +8406,9 @@ module.exports = RowList; */ 'use strict'; -var Model = require('../base/model'), - util = require('../common/util'); - -/** - * @ignore - * @const - * @type {{cell: string, row: string, column: string}} - * @desc - * Selection states - */ -var SELECTION_STATE = { - cell: 'cell', - row: 'row', - column: 'column' -}; +var Model = require('../base/model'); +var util = require('../common/util'); +var typeConstMap = require('../common/constMap').selectionType; /** * Selection Model class @@ -8382,8 +8434,8 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ inputRange: null, intervalIdForAutoScroll: null, scrollPixelScale: 40, - _isEnabled: true, - _selectionState: SELECTION_STATE.cell + enabled: true, + selectionType: typeConstMap.CELL }); this.listenTo(this.dataModel, 'add remove sort reset', this.end); @@ -8409,26 +8461,26 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ }, /** - * Set selection state - * @param {string} state - Selection state (cell, row, column) + * Set selection type + * @param {string} type - Selection type (CELL, ROW, COLUMN) */ - setState: function(state) { - this._selectionState = SELECTION_STATE[state] || this._selectionState; + setType: function(type) { + this.selectionType = typeConstMap[type] || this.selectionType; }, /** - * Return the selection state - * @returns {string} state - Selection state (cell, row, column) + * Return the selection type + * @returns {string} type - Selection type (CELL, ROW, COLUMN) */ - getState: function() { - return this._selectionState; + getType: function() { + return this.selectionType; }, /** * Enables the selection. */ enable: function() { - this._isEnabled = true; + this.enabled = true; }, /** @@ -8436,7 +8488,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ */ disable: function() { this.end(); - this._isEnabled = false; + this.enabled = false; }, /** @@ -8444,20 +8496,21 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @returns {boolean} True if the selection is enabled. */ isEnabled: function() { - return this._isEnabled; + return this.enabled; }, /** * Starts the selection. * @param {Number} rowIndex - Row index * @param {Number} columnIndex - Column index - * @param {string} state - Selection state강지 + * @param {string} type - Selection type */ - start: function(rowIndex, columnIndex, state) { - if (!this._isEnabled) { + start: function(rowIndex, columnIndex, type) { + if (!this.isEnabled()) { return; } - this.setState(state); + + this.setType(type); this.inputRange = { row: [rowIndex, rowIndex], column: [columnIndex, columnIndex] @@ -8469,31 +8522,31 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * Starts the selection by mouse position. * @param {number} pageX - X position relative to the document * @param {number} pageY - Y position relative to the document - * @param {string} state - Selection state + * @param {string} type - Selection type */ - startByMousePosition: function(pageX, pageY, state) { + startByMousePosition: function(pageX, pageY, type) { var index = this.dimensionModel.getIndexFromMousePosition(pageX, pageY); - this.start(index.row, index.column, state); + this.start(index.row, index.column, type); }, /** * Updates the selection range. * @param {number} rowIndex - Row index * @param {number} columnIndex - Column index - * @param {string} [state] - Selection state + * @param {string} [type] - Selection type */ - update: function(rowIndex, columnIndex, state) { + update: function(rowIndex, columnIndex, type) { var focusedIndex; - if (!this._isEnabled || rowIndex < 0 || columnIndex < 0) { + if (!this.enabled || rowIndex < 0 || columnIndex < 0) { return; } if (!this.hasSelection()) { focusedIndex = this.focusModel.indexOf(); - this.start(focusedIndex.row, focusedIndex.column, state); + this.start(focusedIndex.row, focusedIndex.column, type); } else { - this.setState(state); + this.setType(type); } this._updateInputRange(rowIndex, columnIndex); @@ -8509,6 +8562,12 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ _updateInputRange: function(rowIndex, columnIndex) { var inputRange = this.inputRange; + if (this.selectionType === typeConstMap.ROW) { + columnIndex = this.columnModel.getVisibleColumnModelList().length - 1; + } else if (this.selectionType === typeConstMap.COLUMN) { + rowIndex = this.dataModel.length - 1; + } + inputRange.row[1] = rowIndex; inputRange.column[1] = columnIndex; }, @@ -8520,13 +8579,13 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @param {number} pageY - Mouse positino Y */ extendColumnSelection: function(columnIndexes, pageX, pageY) { - var minimumColumnRange = this._minimumColumnRange, - index = this.dimensionModel.getIndexFromMousePosition(pageX, pageY), - range = { - row: [0, 0], - column: [] - }, - minMax; + var minimumColumnRange = this._minimumColumnRange; + var index = this.dimensionModel.getIndexFromMousePosition(pageX, pageY); + var range = { + row: [0, this.dataModel.length - 1], + column: [] + }; + var minMax; if (!columnIndexes || !columnIndexes.length) { columnIndexes = [index.column]; @@ -8564,13 +8623,13 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * Updates the selection range by mouse position. * @param {number} pageX - X position relative to the document * @param {number} pageY - Y position relative to the document - * @param {string} [state] - Selection state + * @param {string} [type] - Selection type */ - updateByMousePosition: function(pageX, pageY, state) { + updateByMousePosition: function(pageX, pageY, type) { var index = this.dimensionModel.getIndexFromMousePosition(pageX, pageY); this._setScrolling(pageX, pageY); - this.update(index.row, index.column, state); + this.update(index.row, index.column, type); }, /** @@ -8597,9 +8656,9 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @param {Number} rowIndex - Row idnex */ selectRow: function(rowIndex) { - if (this._isEnabled) { + if (this.isEnabled()) { this.focusModel.focusAt(rowIndex, 0); - this.start(rowIndex, 0, SELECTION_STATE.row); + this.start(rowIndex, 0, typeConstMap.ROW); this.update(rowIndex, this.columnModel.getVisibleColumnModelList().length - 1); } }, @@ -8609,9 +8668,9 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @param {Number} columnIdx - Column index */ selectColumn: function(columnIdx) { - if (this._isEnabled) { + if (this.isEnabled()) { this.focusModel.focusAt(0, columnIdx); - this.start(0, columnIdx, SELECTION_STATE.column); + this.start(0, columnIdx, typeConstMap.COLUMN); this.update(this.dataModel.length - 1, columnIdx); } }, @@ -8620,8 +8679,8 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * Selects all data range. */ selectAll: function() { - if (this._isEnabled) { - this.start(0, 0, SELECTION_STATE.cell); + if (this.isEnabled()) { + this.start(0, 0, typeConstMap.CELL); this.update(this.dataModel.length - 1, this.columnModel.getVisibleColumnModelList().length - 1); } }, @@ -8632,6 +8691,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ */ getStartIndex: function() { var range = this.get('range'); + return { row: range.row[0], column: range.column[0] @@ -8644,6 +8704,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ */ getEndIndex: function() { var range = this.get('range'); + return { row: range.row[1], column: range.column[1] @@ -8665,10 +8726,10 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @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); + var isSingleColumn = columnNameList.length === 1; + var isSingleRow = rowList.length === 1; + var isSingleMergedCell = isSingleColumn && !isSingleRow && + (rowList[0].getRowSpanData(columnNameList[0]).count === rowList.length); return (isSingleColumn && isSingleRow) || isSingleMergedCell; }, @@ -8678,8 +8739,8 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @returns {String} string of values */ getValuesToString: function() { - var range = this.get('range'), - columnModelList, rowList, columnNameList, rowValues; + var range = this.get('range'); + var columnModelList, rowList, columnNameList, rowValues; columnModelList = this.columnModel.getVisibleColumnModelList().slice(range.column[0], range.column[1] + 1); rowList = this.dataModel.slice(range.row[0], range.row[1] + 1); @@ -8734,8 +8795,8 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @private */ _adjustScrollLeft: function(overflowX, scrollLeft, maxScrollLeft) { - var adjusted = scrollLeft, - pixelScale = this.scrollPixelScale; + var adjusted = scrollLeft; + var pixelScale = this.scrollPixelScale; if (overflowX < 0) { adjusted = Math.max(0, scrollLeft - pixelScale); @@ -8753,8 +8814,8 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @private */ _adjustScrollTop: function(overflowY, scrollTop, maxScrollTop) { - var adjusted = scrollTop, - pixelScale = this.scrollPixelScale; + var adjusted = scrollTop; + var pixelScale = this.scrollPixelScale; if (overflowY < 0) { adjusted = Math.max(0, scrollTop - pixelScale); @@ -8770,8 +8831,8 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @private */ _resetRangeAttribute: function(inputRange) { - var dataModel = this.dataModel, - hasSpannedRange, spannedRange, tmpRowRange; + var dataModel = this.dataModel; + var hasSpannedRange, spannedRange, tmpRowRange; inputRange = inputRange || this.inputRange; if (!inputRange) { @@ -8784,7 +8845,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ column: _.sortBy(inputRange.column) }; - if (dataModel.isRowSpanEnable()) { + if (dataModel.isRowSpanEnable() && this.selectionType === typeConstMap.CELL) { do { tmpRowRange = _.assign([], spannedRange.row); spannedRange = this._getRowSpannedIndex(spannedRange); @@ -8794,19 +8855,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ spannedRange.row[1] !== tmpRowRange[1] ); } while (hasSpannedRange); - } - - this._setRangeMinMax(spannedRange.row, spannedRange.column); - switch (this._selectionState) { - case SELECTION_STATE.column: - spannedRange.row = [0, dataModel.length - 1]; - break; - case SELECTION_STATE.row: - spannedRange.column = [0, this.columnModel.getVisibleColumnModelList().length - 1]; - break; - case SELECTION_STATE.cell: - default: - break; + this._setRangeMinMax(spannedRange.row, spannedRange.column); } this.set('range', spannedRange); @@ -8851,13 +8900,13 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @private */ _concatRowSpanIndexFromStart: function(param) { - var startIndex = param.startIndex, - endIndex = param.endIndex, - columnName = param.columnName, - rowSpanData = param.startRowSpanDataMap && param.startRowSpanDataMap[columnName], - startIndexList = param.startIndexList, - endIndexList = param.endIndexList, - spannedIndex; + var startIndex = param.startIndex; + var endIndex = param.endIndex; + var columnName = param.columnName; + var rowSpanData = param.startRowSpanDataMap && param.startRowSpanDataMap[columnName]; + var startIndexList = param.startIndexList; + var endIndexList = param.endIndexList; + var spannedIndex; if (!rowSpanData) { return; @@ -8880,12 +8929,12 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ * @private */ _concatRowSpanIndexFromEnd: function(param) { - var endIndex = param.endIndex, - columnName = param.columnName, - rowSpanData = param.endRowSpanDataMap && param.endRowSpanDataMap[columnName], - endIndexList = param.endIndexList, - dataModel = param.dataModel, - spannedIndex, tmpRowSpanData; + var endIndex = param.endIndex; + var columnName = param.columnName; + var rowSpanData = param.endRowSpanDataMap && param.endRowSpanDataMap[columnName]; + var endIndexList = param.endIndexList; + var dataModel = param.dataModel; + var spannedIndex, tmpRowSpanData; if (!rowSpanData) { return; @@ -8912,14 +8961,14 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ */ _getRowSpannedIndex: function(spannedRange) { var columnModelList = this.columnModel.getVisibleColumnModelList() - .slice(spannedRange.column[0], spannedRange.column[1] + 1), - dataModel = this.dataModel, - startIndexList = [spannedRange.row[0]], - endIndexList = [spannedRange.row[1]], - startRow = dataModel.at(spannedRange.row[0]), - endRow = dataModel.at(spannedRange.row[1]), - newSpannedRange = $.extend({}, spannedRange), - startRowSpanDataMap, endRowSpanDataMap, columnName, param; + .slice(spannedRange.column[0], spannedRange.column[1] + 1); + var dataModel = this.dataModel; + var startIndexList = [spannedRange.row[0]]; + var endIndexList = [spannedRange.row[1]]; + var startRow = dataModel.at(spannedRange.row[0]); + var endRow = dataModel.at(spannedRange.row[1]); + var newSpannedRange = $.extend({}, spannedRange); + var startRowSpanDataMap, endRowSpanDataMap, columnName, param; if (!startRow || !endRow) { return newSpannedRange; @@ -8952,7 +9001,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ module.exports = Selection; -},{"../base/model":5,"../common/util":12}],27:[function(require,module,exports){ +},{"../base/model":5,"../common/constMap":9,"../common/util":12}],27:[function(require,module,exports){ /** * @fileoverview Toolbar model class * @author NHN Ent. FE Development Team @@ -9184,15 +9233,15 @@ var Cell = tui.util.defineClass(Painter, /**@lends module:painter/cell.prototype * @param {jQuery} $td - cell element */ refresh: function(cellData, $td) { - var contentProps = ['value', 'isEditing', 'isDisabled']; - var isEditingChanged = _.contains(cellData.changed, 'isEditing'); + var contentProps = ['value', 'isEditing', 'isDisabled', 'optionList']; + var editingChangedToTrue = _.contains(cellData.changed, 'isEditing') && cellData.isEditing; var shouldUpdateContent = _.intersection(contentProps, cellData.changed).length > 0; var attrs = this._getAttributes(cellData); delete attrs.rowspan; // prevent error in IE7 (cannot update rowspan attribute) $td.attr(attrs); - if (isEditingChanged && cellData.isEditing && !this._isUsingViewMode(cellData)) { + if (editingChangedToTrue && !this._isUsingViewMode(cellData)) { this.inputPainter.focus($td); } else if (shouldUpdateContent) { $td.html(this._getContentHtml(cellData)); @@ -9286,10 +9335,10 @@ var PainterController = tui.util.defineClass(/**@lends module:painter/controller * @param {Boolean} reverse - if set to true, find the previous cell instead of next cell */ focusInToNextCell: function(reverse) { - var focusModel = this.focusModel, - rowKey = focusModel.get('rowKey'), - columnName = focusModel.get('columnName'), - nextColumnName = reverse ? focusModel.prevColumnName() : focusModel.nextColumnName(); + var focusModel = this.focusModel; + var rowKey = focusModel.get('rowKey'); + var columnName = focusModel.get('columnName'); + var nextColumnName = reverse ? focusModel.prevColumnName() : focusModel.nextColumnName(); if (columnName !== nextColumnName) { focusModel.focusIn(rowKey, nextColumnName, true); @@ -9302,9 +9351,9 @@ var PainterController = tui.util.defineClass(/**@lends module:painter/controller * @param {{rowKey:String, columnName:String}} address - cell address */ executeCustomInputEventHandler: function(event, address) { - var columnModel = this.columnModel.getColumnModel(address.columnName), - eventType = event.type, - eventHandler; + var columnModel = this.columnModel.getColumnModel(address.columnName); + var eventType = event.type; + var eventHandler; if (eventType === 'focusin') { eventType = 'focus'; @@ -9501,8 +9550,8 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ * @private */ _executeCustomEventHandler: function(event) { - var $input = $(event.target), - address = this._getCellAddress($input); + var $input = $(event.target); + var address = this._getCellAddress($input); this.controller.executeCustomInputEventHandler(event, address); }, @@ -9513,9 +9562,11 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ * @private */ _onFocusIn: function(event) { - var address = this._getCellAddress($(event.target)); + var $target = $(event.target); + var address = this._getCellAddress($target); this._executeCustomEventHandler(event); + this.trigger('focusIn', $target, address); this.controller.startEditing(address); }, @@ -9525,10 +9576,11 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ * @private */ _onFocusOut: function(event) { - var $target = $(event.target), - address = this._getCellAddress($target); + var $target = $(event.target); + var address = this._getCellAddress($target); this._executeCustomEventHandler(event); + this.trigger('focusOut', $target, address); this.controller.finishEditing(address, false, $target.val()); }, @@ -9618,6 +9670,8 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ } }); +_.assign(InputPainter.prototype, Backbone.Events); + module.exports = InputPainter; },{"../../base/painter":6,"../../common/constMap":9}],32:[function(require,module,exports){ @@ -10791,8 +10845,9 @@ function buildCssString(options) { styleGen.cell(cell.normal), styleGen.cellDummy(cell.dummy), styleGen.cellEditable(cell.editable), - styleGen.cellEvenRow(cell.evenRow), styleGen.cellHead(cell.head), + styleGen.cellOddRow(cell.oddRow), + styleGen.cellEvenRow(cell.evenRow), styleGen.cellRequired(cell.required), styleGen.cellDisabled(cell.disabled), styleGen.cellInvalid(cell.invalid), @@ -10938,6 +10993,7 @@ module.exports = { background: '#ff8080' }, evenRow: {}, + oddRow: {}, currentRow: {} } }; @@ -10959,12 +11015,16 @@ module.exports = $.extend(true, {}, presetDefault, { showVerticalBorder: false, showHorizontalBorder: false }, - evenRow: { + oddRow: { background: '#f3f3f3' }, + evenRow: { + background: '#fff' + }, head: { - showVerticalBorder: true, - showHorizontalBorder: true + background: '#fff', + showVerticalBorder: false, + showHorizontalBorder: false } } }); @@ -11006,8 +11066,8 @@ module.exports = { grid: function(options) { var containerRule = classRule(classNameConst.CONTAINER) .bg(options.background) - .border(options.border) .text(options.text); + var contentAreaRule = classRule(classNameConst.CONTENT_AREA).border(options.border); var tableRule = classRule(classNameConst.TABLE).border(options.border); var headRule = classRule(classNameConst.HEAD_AREA).border(options.border); var borderLineRule = classRule(classNameConst.BORDER_LINE).bg(options.border); @@ -11016,6 +11076,7 @@ module.exports = { return builder.buildAll([ containerRule, + contentAreaRule, tableRule, headRule, borderLineRule, @@ -11116,6 +11177,17 @@ module.exports = { .build(); }, + /** + * Generates a css string for the cells in odd rows. + * @param {Object} options - options + * @returns {String} + */ + cellOddRow: function(options) { + return classRule(classNameConst.CELL_ROW_ODD) + .bg(options.background) + .build(); + }, + /** * Generates a css string for selected head cells. * @param {Object} options - options @@ -11204,8 +11276,10 @@ module.exports = { var View = require('../base/view'); var util = require('../common/util'); -var keyCodeMap = require('../common/constMap').keyCode; var classNameConst = require('../common/classNameConst'); +var constMap = require('../common/constMap'); +var keyCodeMap = constMap.keyCode; +var selTypeConst = constMap.selectionType; /** * Clipboard view class @@ -11247,6 +11321,7 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ */ _onBlur: function() { var focusModel = this.focusModel; + setTimeout(function() { focusModel.refreshState(); }, 0); @@ -11300,7 +11375,7 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @param {Event} keyDownEvent 이벤트 객체 * @private */ - _onKeyDown: function(keyDownEvent) { + _onKeyDown: function(keyDownEvent) { // eslint-disable-line complexity if (this.isLocked) { keyDownEvent.preventDefault(); return; @@ -11324,14 +11399,14 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @private */ _keyIn: function(keyDownEvent) { // eslint-disable-line complexity - var focusModel = this.focusModel, - selectionModel = this.selectionModel, - focused = focusModel.which(), - rowKey = focused.rowKey, - columnName = focused.columnName, - displayRowCount = this.dimensionModel.get('displayRowCount'), - isKeyIdentified = true, - keyCode = keyDownEvent.keyCode || keyDownEvent.which; + var focusModel = this.focusModel; + var selectionModel = this.selectionModel; + var focused = focusModel.which(); + var rowKey = focused.rowKey; + var columnName = focused.columnName; + var displayRowCount = this.dimensionModel.get('displayRowCount'); + var isKeyIdentified = true; + var keyCode = keyDownEvent.keyCode || keyDownEvent.which; if (util.isBlank(focused.rowKey)) { return; @@ -11399,10 +11474,10 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @private */ _getIndexBeforeMove: function() { - var focusedIndex = this.focusModel.indexOf(), - selectionRange = this.selectionModel.get('range'), - index = _.extend({}, focusedIndex), - selectionRowRange, selectionColumnRange; + var focusedIndex = this.focusModel.indexOf(); + var selectionRange = this.selectionModel.get('range'); + var index = _.extend({}, focusedIndex); + var selectionRowRange, selectionColumnRange; if (selectionRange) { selectionRowRange = selectionRange.row; @@ -11427,16 +11502,16 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @private */ _keyInWithShift: function(keyDownEvent) { // eslint-disable-line complexity - var focusModel = this.focusModel, - dimensionModel = this.dimensionModel, - columnModelList = this.columnModel.getVisibleColumnModelList(), - focused = focusModel.which(), - displayRowCount = dimensionModel.get('displayRowCount'), - keyCode = keyDownEvent.keyCode || keyDownEvent.which, - index = this._getIndexBeforeMove(), - isKeyIdentified = true, - isSelection = true, - columnModel, scrollPosition, isValid, selectionState; + var focusModel = this.focusModel; + var dimensionModel = this.dimensionModel; + var columnModelList = this.columnModel.getVisibleColumnModelList(); + var focused = focusModel.which(); + var displayRowCount = dimensionModel.get('displayRowCount'); + var keyCode = keyDownEvent.keyCode || keyDownEvent.which; + var index = this._getIndexBeforeMove(); + var isKeyIdentified = true; + var isSelection = true; + var columnModel, scrollPosition, isValid, selectionType; switch (keyCode) { case keyCodeMap.UP_ARROW: @@ -11483,10 +11558,10 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ this._updateSelectionByKeyIn(index.row, index.column); scrollPosition = dimensionModel.getScrollPosition(index.row, columnModel.columnName); if (scrollPosition) { - selectionState = this.selectionModel.getState(); - if (selectionState === 'column') { + selectionType = this.selectionModel.getType(); + if (selectionType === selTypeConst.COLUMN) { delete scrollPosition.scrollTop; - } else if (selectionState === 'row') { + } else if (selectionType === selTypeConst.ROW) { delete scrollPosition.scrollLeft; } this.renderModel.set(scrollPosition); @@ -11503,9 +11578,9 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @param {Event} keyDownEvent 이벤트 객체 * @private */ - _keyInWithCtrl: function(keyDownEvent) { - var focusModel = this.focusModel, - keyCode = keyDownEvent.keyCode || keyDownEvent.which; + _keyInWithCtrl: function(keyDownEvent) { // eslint-disable-line complexity + var focusModel = this.focusModel; + var keyCode = keyDownEvent.keyCode || keyDownEvent.which; switch (keyCode) { case keyCodeMap.CHAR_A: @@ -11521,7 +11596,7 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ focusModel.focus(focusModel.lastRowKey(), focusModel.lastColumnName(), true); break; case keyCodeMap.CHAR_V: - this._paste(); + this._pasteWhenKeyupCharV(); break; default: break; @@ -11532,7 +11607,9 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * paste date * @private */ - _paste: function() { + _pasteWhenKeyupCharV: function() { + var self = this; + // pressing v long time, clear clipboard to keep final paste date this._clearClipBoard(); if (this.pasting) { @@ -11540,20 +11617,10 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ } this.pasting = true; - this._onKeyupCharV(); - }, - - /** - * keyup event attach - * @private - */ - _onKeyupCharV: function() { - this.$el.on('keyup', $.proxy(this.onKeyupCharV, this)); - }, - - onKeyupCharV: function() { - this._pasteToGrid(); - this.pasting = false; + this.$el.on('keyup', function() { + self._pasteToGrid(); + self.pasting = false; + }); }, /** @@ -11569,10 +11636,10 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @private */ _pasteToGrid: function() { - var selectionModel = this.selectionModel, - focusModel = this.focusModel, - dataModel = this.dataModel, - startIdx, data; + var selectionModel = this.selectionModel; + var focusModel = this.focusModel; + var dataModel = this.dataModel; + var startIdx, data; if (selectionModel.hasSelection()) { startIdx = selectionModel.getStartIndex(); @@ -11591,14 +11658,15 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @returns {Array.>} result */ _getProcessClipBoardData: function() { - var text = this.$el.val(), - result = text.split('\n'), - i = 0, - len = result.length; + var text = this.$el.val(); + var result = text.split('\n'); + var i = 0; + var len = result.length; for (; i < len; i += 1) { result[i] = result[i].split('\t'); } + return result; }, @@ -11608,9 +11676,9 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @private */ _keyInWithShiftAndCtrl: function(keyDownEvent) { - var isKeyIdentified = true, - columnModelList = this.columnModel.getVisibleColumnModelList(), - keyCode = keyDownEvent.keyCode || keyDownEvent.which; + var isKeyIdentified = true; + var columnModelList = this.columnModel.getVisibleColumnModelList(); + var keyCode = keyDownEvent.keyCode || keyDownEvent.which; switch (keyCode) { case keyCodeMap.HOME: @@ -11635,13 +11703,13 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @private */ _del: function() { - var selectionModel = this.selectionModel, - dataModel = this.dataModel, - focused = this.focusModel.which(), - columnModelList = this.columnModel.getVisibleColumnModelList(), - rowKey = focused.rowKey, - columnName = focused.columnName, - range, i, j; + var selectionModel = this.selectionModel; + var dataModel = this.dataModel; + var focused = this.focusModel.which(); + var columnModelList = this.columnModel.getVisibleColumnModelList(); + var rowKey = focused.rowKey; + var columnName = focused.columnName; + var range, i, j; if (selectionModel.hasSelection()) { //다수의 cell 을 제거 할 때에는 silent 로 데이터를 변환한 후 한번에 랜더링을 refresh 한다. @@ -11654,7 +11722,9 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ dataModel.get(rowKey).validateCell(columnName); } } - this.renderModel.refresh(true); + this.renderModel.refresh({ + dataModelChanged: true + }); } else { dataModel.del(rowKey, columnName); } @@ -11678,14 +11748,16 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * @private */ _getClipboardString: function() { - var text, - selectionModel = this.selectionModel, - focused = this.focusModel.which(); + var selectionModel = this.selectionModel; + var focused = this.focusModel.which(); + var text; + if (selectionModel.hasSelection()) { text = this.selectionModel.getValuesToString(); } else { text = this.dataModel.get(focused.rowKey).getValueString(focused.columnName); } + return text; }, @@ -11693,9 +11765,9 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ * 현재 그리드의 data 를 clipboard 에 copy 한다. * @private */ - /* istanbul ignore next */ _copyToClipboard: function() { var text = this._getClipboardString(); + if (window.clipboardData) { window.clipboardData.setData('Text', text); } else { @@ -11767,11 +11839,11 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ var factory = this.viewFactory; this._addChildren([ - factory.createFrame('L'), - factory.createFrame('R'), + factory.createContentArea(), factory.createToolbar(), factory.createStateLayer(), factory.createEditingLayer(), + factory.createDatePickerLayer(), factory.createClipboard() ]); }, @@ -11807,9 +11879,9 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ * @private */ _onClick: function(mouseEvent) { - var eventData = new GridEvent(mouseEvent), - $target = $(mouseEvent.target), - cellInfo; + var eventData = new GridEvent(mouseEvent); + var $target = $(mouseEvent.target); + var cellInfo; this.trigger('click', eventData); if (eventData.isStopped()) { @@ -11830,8 +11902,8 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ * @private */ _onDblClick: function(mouseEvent) { - var eventData = new GridEvent(mouseEvent), - $target = $(mouseEvent.target); + var eventData = new GridEvent(mouseEvent); + var $target = $(mouseEvent.target); this.trigger('dblclick', eventData); if (eventData.isStopped()) { @@ -11863,8 +11935,8 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ * @param {MouseEvent} mouseEvent 마우스 이벤트 객체 */ _onMouseOut: function(mouseEvent) { - var $target = $(mouseEvent.target), - eventData; + var $target = $(mouseEvent.target); + var eventData; if (this._isCellElement($target)) { eventData = new GridEvent(mouseEvent); @@ -11881,6 +11953,7 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ */ _triggerCellMouseEvent: function(eventName, eventData, cell) { var cellInfo = cell; + if (cell instanceof $) { cellInfo = this._getCellInfoFromElement(cell); } @@ -11927,8 +12000,8 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ * @private */ _onMouseDown: function(mouseEvent) { - var $target = $(mouseEvent.target), - eventData = new GridEvent(mouseEvent); + var $target = $(mouseEvent.target); + var eventData = new GridEvent(mouseEvent); this.trigger('mousedown', eventData); if (eventData.isStopped()) { @@ -11954,43 +12027,17 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ * @returns {module:view/container} this object */ render: function() { - var childElements = this._renderChildren().concat([ - $('
').addClass(classNameConst.BORDER_LINE + ' ' + classNameConst.BORDER_TOP), - $('
').addClass(classNameConst.BORDER_LINE + ' ' + classNameConst.BORDER_LEFT), - $('
').addClass(classNameConst.BORDER_LINE + ' ' + classNameConst.BORDER_RIGHT) - ]); + var childElements = this._renderChildren(); this.$el.addClass(classNameConst.CONTAINER) .attr(attrNameConst.GRID_ID, this.gridId) .append(childElements); - if (!this.dimensionModel.get('scrollX')) { - this.$el.addClass(classNameConst.NO_SCROLL_X); - } - - this._appendBottomLine(); this._refreshHeight(); this.trigger('rendered'); return this; }, - /** - * Appends botton line of data - * @private - */ - _appendBottomLine: function() { - var bottomPos = this.dimensionModel.get('toolbarHeight') + this.dimensionModel.getScrollXHeight(); - var $line = $('
') - .addClass(classNameConst.BORDER_BOTTOM) - .addClass(classNameConst.BORDER_LINE) - .css('bottom', bottomPos); - - if (!this.dimensionModel.get('scrollY')) { - $line.addClass(classNameConst.NO_SCROLL_Y); - } - this.$el.append($line); - }, - /** * 소멸자 */ @@ -12007,6 +12054,201 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ module.exports = Container; },{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/gridEvent":11}],47:[function(require,module,exports){ +/** + * @fileoverview Layer View class which contains the 'tui-component-date-picker' + * @author NHN Ent. FE Development Team + */ +'use strict'; + +var View = require('../base/view'); +var classNameConst = require('../common/classNameConst'); +var DEFAULT_DATE_FORMAT = 'yyyy-mm-dd'; +var DatePickerLayer; + +/** + * Returns a HTML string of a span element to represent an arrow-icon + * @param {String} dirClassName - className to indicate direction of the arrow + * @returns {String} + */ +function arrowHTML(dirClassName) { + var classNameStr = classNameConst.ICO_ARROW + ' ' + dirClassName; + + return ''; +} + +/** + * Layer View class which contains the 'tui-component-date-picker' + * @module view/datePickerLayer + * @extends module:base/view + */ +DatePickerLayer = View.extend(/**@lends module:view/datePickerLayer.prototype */{ + /** + * @constructs + * @param {Object} options - Options + */ + initialize: function(options) { + this.textPainter = options.textPainter; + this.columnModel = options.columnModel; + this.domState = options.domState; + this.calendar = this._createCalendar(); + this.datePicker = this._createDatePicker(); + + this._customizeCalendarBtns(); + + this.listenTo(this.textPainter, 'focusIn', this._onFocusInTextInput); + this.listenTo(this.textPainter, 'focusOut', this._onFocusOutTextInput); + }, + + className: classNameConst.LAYER_DATE_PICKER, + + /** + * Creates an instance of 'tui-component-calendar' + * @returns {tui.component.Calendar} + * @private + */ + _createCalendar: function() { + var $calendarEl = $('
').addClass(classNameConst.CALENDAR); + + // prevent blur event from occuring in the input element + $calendarEl.mousedown(function(ev) { + ev.preventDefault(); + ev.target.unselectable = true; // trick for IE8 + return false; + }); + + return new tui.component.Calendar({ + element: $calendarEl, + classPrefix: classNameConst.CALENDAR + '-' + }); + }, + + /** + * Customize the buttons of the calendar. + * @private + */ + _customizeCalendarBtns: function() { + var $header = this.calendar.$header; + var leftArrowHTML = arrowHTML(classNameConst.ICO_ARROW_LEFT); + var rightArrowHTML = arrowHTML(classNameConst.ICO_ARROW_RIGHT); + + $header.find('.' + classNameConst.CALENDAR_BTN_PREV_YEAR).html(leftArrowHTML + leftArrowHTML); + $header.find('.' + classNameConst.CALENDAR_BTN_NEXT_YEAR).html(rightArrowHTML + rightArrowHTML); + $header.find('.' + classNameConst.CALENDAR_BTN_PREV_MONTH).html(leftArrowHTML); + $header.find('.' + classNameConst.CALENDAR_BTN_NEXT_MONTH).html(rightArrowHTML); + }, + + /** + * Creates an instance of 'tui-component-date-picker' + * @returns {tui.component.DatePicker} + * @private + */ + _createDatePicker: function() { + var datePicker = new tui.component.DatePicker({ + parentElement: this.$el, + enableSetDateByEnterKey: false, + selectableClassName: classNameConst.CALENDAR_SELECTABLE, + selectedClassName: classNameConst.CALENDAR_SELECTED, + pos: { + top: 0, + left: 0 + } + }, this.calendar); + + datePicker.on('update', function() { + datePicker.close(); + }); + + return datePicker; + }, + + /** + * Creates date object for now + * @returns {{year: Number, month: Number, date: Number}} + * @private + */ + _createDateForNow: function() { + var now = new Date(); + + return { + year: now.getFullYear(), + month: now.getMonth() + 1, + date: now.getDate() + }; + }, + + /** + * Resets date picker options + * @param {Object} options - datePicker options + * @param {jQuery} $input - target input element + * @private + */ + _resetDatePicker: function(options, $input) { + var datePicker = this.datePicker; + var date = options.date || this._createDateForNow(); + + datePicker.setDateForm(options.dateForm || DEFAULT_DATE_FORMAT); + datePicker.setRanges(options.selectableRanges || []); + datePicker.setDate(date.year, date.month, date.date); + datePicker.setElement($input); + }, + + /** + * Calculates the position of the layer and returns the object that contains css properties. + * @param {jQuery} $input - input element + * @returns {Object} + * @private + */ + _calculatePosition: function($input) { + var inputOffset = $input.offset(); + var inputHeight = $input.outerHeight(); + var wrapperOffset = this.domState.getOffset(); + + return { + top: inputOffset.top - wrapperOffset.top + inputHeight, + left: inputOffset.left - wrapperOffset.left + }; + }, + + /** + * Event handler for 'focusIn' event of module:painter/input/text + * @param {jQuery} $input - target input element + * @param {{rowKey: String, columnName: String}} address - target cell address + * @private + */ + _onFocusInTextInput: function($input, address) { + var columnName = address.columnName; + var component = this.columnModel.getColumnModel(columnName).component; + var editType = this.columnModel.getEditType(columnName); + + if (editType === 'text' && component && component.name === 'datePicker') { + this.$el.css(this._calculatePosition($input)).show(); + this._resetDatePicker(component.option || {}, $input); + this.datePicker.open(); + } + }, + + /** + * Event handler for 'focusOut' event of module:painter/input/text + * @private + */ + _onFocusOutTextInput: function() { + this.datePicker.close(); + this.$el.hide(); + }, + + /** + * Render + * @returns {Object} this object + */ + render: function() { + this.$el.hide(); + return this; + } +}); + +module.exports = DatePickerLayer; + +},{"../base/view":7,"../common/classNameConst":8}],48:[function(require,module,exports){ /** * @fileoverview Layer class that represents the state of rendering phase * @author NHN Ent. FE Development Team @@ -12168,7 +12410,7 @@ var EditingLayer = View.extend(/**@lends module:view/editingLayer.prototype */{ module.exports = EditingLayer; -},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],48:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],49:[function(require,module,exports){ /** * @fileoverview View factory * @author NHN Ent. FE Development Team @@ -12176,6 +12418,7 @@ module.exports = EditingLayer; 'use strict'; var ContainerView = require('./container'); +var ContentAreaView = require('./layout/content-area'); var ToolbarView = require('./layout/toolbar'); var ToolbarControlPanelView = require('./layout/toolbar/controlPanel'); var ToolbarPaginationView = require('./layout/toolbar/pagination'); @@ -12191,6 +12434,7 @@ var BodyTableView = require('./layout/bodyTable'); var RowListView = require('./rowList'); var SelectionLayerView = require('./selectionLayer'); var EditingLayerView = require('./editingLayer'); +var DatePickeLayerView = require('./datePickerLayer'); var FocusLayerView = require('./focusLayer'); /** @@ -12207,7 +12451,7 @@ var ViewFactory = tui.util.defineClass({ /** * Creates container view and returns it. * @param {Object} options - Options set by user - * @returns {module:view/container} - New container view instance + * @returns {module:view/container} */ createContainer: function(options) { return new ContainerView({ @@ -12221,6 +12465,17 @@ var ViewFactory = tui.util.defineClass({ }); }, + /** + * Creates a view instance for the contents area. + * @returns {module:view/layout/content-area} + */ + createContentArea: function() { + return new ContentAreaView({ + dimensionModel: this.modelManager.dimensionModel, + viewFactory: this + }); + }, + /** * Creates toolbar view and returns it. * @returns {module:view/toolbar} - New toolbar view instance @@ -12420,6 +12675,24 @@ var ViewFactory = tui.util.defineClass({ }); }, + /** + * Creates an instance of date-picker layer view. + * @returns {module:view/datePickerLayer} + */ + createDatePickerLayer: function() { + if (!tui.component || + !tui.component.DatePicker || + !tui.component.Calendar) { + return null; + } + + return new DatePickeLayerView({ + columnModel: this.modelManager.columnModel, + textPainter: this.painterManager.getInputPainters().text, + domState: this.domState + }); + }, + /** * Creates focus layer view and returns it. * @param {String} whichSide - 'L'(left) or 'R'(right) @@ -12437,7 +12710,7 @@ var ViewFactory = tui.util.defineClass({ module.exports = ViewFactory; -},{"./clipboard":45,"./container":46,"./editingLayer":47,"./focusLayer":49,"./layout/body":50,"./layout/bodyTable":51,"./layout/frame-lside":52,"./layout/frame-rside":53,"./layout/header":55,"./layout/resizeHandler":56,"./layout/toolbar":57,"./layout/toolbar/controlPanel":58,"./layout/toolbar/pagination":59,"./layout/toolbar/resizeHandler":60,"./rowList":61,"./selectionLayer":62,"./stateLayer":63}],49:[function(require,module,exports){ +},{"./clipboard":45,"./container":46,"./datePickerLayer":47,"./editingLayer":48,"./focusLayer":50,"./layout/body":51,"./layout/bodyTable":52,"./layout/content-area":53,"./layout/frame-lside":54,"./layout/frame-rside":55,"./layout/header":57,"./layout/resizeHandler":58,"./layout/toolbar":59,"./layout/toolbar/controlPanel":60,"./layout/toolbar/pagination":61,"./layout/toolbar/resizeHandler":62,"./rowList":63,"./selectionLayer":64,"./stateLayer":65}],50:[function(require,module,exports){ /** * @fileoverview Class for the layer view that represents the currently focused cell * @author NHN Ent. FE Development Team @@ -12582,7 +12855,7 @@ var FocusLayer = View.extend(/**@lends module:view/focusLayer.prototype */{ module.exports = FocusLayer; -},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],50:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],51:[function(require,module,exports){ /** * @fileoverview Class for the body layout * @author NHN Ent. FE Development Team @@ -12591,8 +12864,10 @@ module.exports = FocusLayer; var View = require('../../base/view'); var util = require('../../common/util'); -var attrNameConst = require('../../common/constMap').attrName; +var constMap = require('../../common/constMap'); var classNameConst = require('../../common/classNameConst'); +var attrNameConst = constMap.attrName; +var selTypeMap = constMap.selectionType; // Minimum time (ms) to detect if an alert or confirm dialog has been displayed. var MIN_INTERVAL_FOR_PAUSED = 200; @@ -12771,7 +13046,7 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ } if (!util.isMetaColumn(columnName)) { - selectionModel.setState('cell'); + selectionModel.setType(selTypeMap.CELL); if (inputData.shiftKey && !isInput) { selectionModel.update(rowIndex, columnIndex); } else { @@ -12798,7 +13073,7 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ */ _updateSelectionByRow: function(rowIndex, shiftKey) { if (shiftKey) { - this.selectionModel.update(rowIndex, 0, 'row'); + this.selectionModel.update(rowIndex, 0, selTypeMap.ROW); } else { this.selectionModel.selectRow(rowIndex); } @@ -12923,7 +13198,7 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ module.exports = Body; -},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],51:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],52:[function(require,module,exports){ /** * @fileoverview Class for the table layout in the body(data) area * @author NHN Ent. FE Development Team @@ -13118,7 +13393,91 @@ var BodyTable = View.extend(/**@lends module:view/layout/bodyTable.prototype */{ module.exports = BodyTable; -},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],52:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],53:[function(require,module,exports){ +/** + * @fileoverview Class for the content area + * @author NHN Ent. FE Development Team + */ +'use strict'; + +var View = require('../../base/view'); +var classNameConst = require('../../common/classNameConst'); +var ContentArea; + +/** + * Create DIV element to draw border + * @param {String} className - border class name + * @returns {jQuery} + */ +function borderDIV(className) { + return $('
') + .addClass(classNameConst.BORDER_LINE) + .addClass(className); +} + +/** + * Content area + * @module view/layout/content-area + * @extends module:base/view + */ +ContentArea = View.extend(/**@lends module:view/layout/content-area.prototype */{ + /** + * @constructs + * @param {Object} options - Options + */ + initialize: function(options) { + View.prototype.initialize.call(this); + + this.viewFactory = options.viewFactory; + this.dimensionModel = options.dimensionModel; + this._addFrameViews(); + }, + + className: classNameConst.CONTENT_AREA, + + /** + * Creates Frame views and add them as children. + * @private + */ + _addFrameViews: function() { + var factory = this.viewFactory; + + this._addChildren([ + factory.createFrame('L'), + factory.createFrame('R') + ]); + }, + + /** + * Renders + * @returns {Object} this object + */ + render: function() { + var dimensionModel = this.dimensionModel; + var scrollXHeight = dimensionModel.getScrollXHeight(); + var childElements = this._renderChildren().concat([ + borderDIV(classNameConst.BORDER_TOP), + borderDIV(classNameConst.BORDER_LEFT), + borderDIV(classNameConst.BORDER_RIGHT), + borderDIV(classNameConst.BORDER_BOTTOM).css('bottom', scrollXHeight) + ]); + + if (!dimensionModel.get('scrollX')) { + this.$el.addClass(classNameConst.NO_SCROLL_X); + } + if (!dimensionModel.get('scrollY')) { + this.$el.addClass(classNameConst.NO_SCROLL_Y); + } + + this.$el.append(childElements); + + return this; + } +}); + +module.exports = ContentArea; + +},{"../../base/view":7,"../../common/classNameConst":8}],54:[function(require,module,exports){ /** * @fileoverview Left Side Frame * @author NHN Ent. FE Development Team @@ -13173,23 +13532,17 @@ var LsideFrame = Frame.extend(/**@lends module:view/layout/frame-lside.prototype * @override */ afterRender: function() { - var dimensionModel = this.dimensionModel, - $scrollOverlay; // overlay DIV to hide scrollbar UI - - if (!dimensionModel.get('scrollX')) { + if (!this.dimensionModel.get('scrollX')) { return; } - $scrollOverlay = $('
') - .addClass(classNameConst.SCROLLBAR_LEFT_BOTTOM) - .css('bottom', dimensionModel.get('toolbarHeight')); - this.$el.append($scrollOverlay); + this.$el.append($('
').addClass(classNameConst.SCROLLBAR_LEFT_BOTTOM)); } }); module.exports = LsideFrame; -},{"../../common/classNameConst":8,"./frame":54}],53:[function(require,module,exports){ +},{"../../common/classNameConst":8,"./frame":56}],55:[function(require,module,exports){ /** * @fileoverview Right Side Frame * @author NHN Ent. FE Development Team @@ -13306,9 +13659,7 @@ var RsideFrame = Frame.extend(/**@lends module:view/layout/frame-rside.prototype // (For resolving the issue that styling scrollbar-corner with '-webkit-scrollbar-corner' // casues to be stuck in the same position in Chrome) if (dimensionModel.get('scrollX')) { - $scrollCorner = $('
') - .addClass(classNameConst.SCROLLBAR_RIGHT_BOTTOM) - .css('bottom', dimensionModel.get('toolbarHeight')); + $scrollCorner = $('
').addClass(classNameConst.SCROLLBAR_RIGHT_BOTTOM); this.$el.append($scrollCorner); } @@ -13319,7 +13670,7 @@ var RsideFrame = Frame.extend(/**@lends module:view/layout/frame-rside.prototype module.exports = RsideFrame; -},{"../../common/classNameConst":8,"../../common/constMap":9,"./frame":54}],54:[function(require,module,exports){ +},{"../../common/classNameConst":8,"../../common/constMap":9,"./frame":56}],56:[function(require,module,exports){ /** * @fileoverview Frame Base * @author NHN Ent. FE Development Team @@ -13396,7 +13747,7 @@ var Frame = View.extend(/**@lends module:view/layout/frame.prototype */{ module.exports = Frame; -},{"../../base/view":7}],55:[function(require,module,exports){ +},{"../../base/view":7}],57:[function(require,module,exports){ /** * @fileoverview Header 관련 * @author NHN Ent. FE Development Team @@ -13409,6 +13760,7 @@ var constMap = require('../../common/constMap'); var classNameConst = require('../../common/classNameConst'); var DELAY_SYNC_CHECK = 10; +var SEL_TYPE_COLUMN = constMap.selectionType.COLUMN; var ATTR_COLUMN_NAME = constMap.attrName.COLUMN_NAME; var CELL_BORDER_WIDTH = constMap.dimension.CELL_BORDER_WIDTH; var TABLE_BORDER_WIDTH = constMap.dimension.TABLE_BORDER_WIDTH; @@ -13625,10 +13977,10 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ * @private */ _startColumnSelectionWithShiftKey: function(columnIndexes, pageX, pageY) { - var selectionModel = this.selectionModel, - max = Math.max.apply(null, columnIndexes); + var selectionModel = this.selectionModel; + var max = Math.max.apply(null, columnIndexes); - selectionModel.update(0, max, 'column'); + selectionModel.update(0, max, SEL_TYPE_COLUMN); selectionModel.extendColumnSelection(columnIndexes, pageX, pageY); }, @@ -13998,7 +14350,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ module.exports = Header; -},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],56:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],58:[function(require,module,exports){ /** * @fileoverview ResizeHandler for the Header * @author NHN Ent. FE Development Team @@ -14273,7 +14625,7 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto module.exports = ResizeHandler; -},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9}],57:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9}],59:[function(require,module,exports){ /** * @fileoverview 툴바영역 클래스 * @author NHN Ent. FE Development Team @@ -14344,7 +14696,7 @@ var Toolbar = View.extend(/**@lends module:view/layout/toolbar.prototype */{ module.exports = Toolbar; -},{"../../base/view":7,"../../common/classNameConst":8}],58:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8}],60:[function(require,module,exports){ /** * @fileoverview Class for the control panel in the toolbar * @author NHN Ent. FE Development Team @@ -14440,7 +14792,7 @@ var ControlPanel = View.extend(/**@lends module:view/layout/toolbar/controlPanel module.exports = ControlPanel; -},{"../../../base/view":7,"../../../common/classNameConst":8}],59:[function(require,module,exports){ +},{"../../../base/view":7,"../../../common/classNameConst":8}],61:[function(require,module,exports){ /** * @fileoverview Class for the pagination in the toolbar * @author NHN Ent. FE Development Team @@ -14517,7 +14869,7 @@ var Pagination = View.extend(/**@lends module:view/layout/toolbar/pagination.pro module.exports = Pagination; -},{"../../../base/view":7,"../../../common/classNameConst":8}],60:[function(require,module,exports){ +},{"../../../base/view":7,"../../../common/classNameConst":8}],62:[function(require,module,exports){ /** * @fileoverview Class for the resize handler of the toolbar * @author NHN Ent. FE Development Team @@ -14650,7 +15002,7 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/toolbar/resizeHandl module.exports = ResizeHandler; -},{"../../../base/view":7,"../../../common/classNameConst":8}],61:[function(require,module,exports){ +},{"../../../base/view":7,"../../../common/classNameConst":8}],63:[function(require,module,exports){ /** * @fileoverview RowList View * @author NHN Ent. FE Development Team @@ -14885,16 +15237,16 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ /** * Renders. - * @param {boolean} isModelChanged - 모델이 변경된 경우(add, remove..) true, 아니면(스크롤 변경 등) false + * @param {boolean} dataModelChanged - 모델이 변경된 경우(add, remove..) true, 아니면(스크롤 변경 등) false * @returns {View.RowList} this 객체 */ - render: function(isModelChanged) { + render: function(dataModelChanged) { var rowKeys = this.collection.pluck('rowKey'), dupRowKeys; this.bodyTableView.resetTablePosition(); - if (isModelChanged) { + if (dataModelChanged) { this._resetRows(); } else { dupRowKeys = _.intersection(rowKeys, this.renderedRowKeys); @@ -14946,7 +15298,7 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ module.exports = RowList; -},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],62:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],64:[function(require,module,exports){ /** * @fileoverview Class for the selection layer * @author NHN Ent. FE Development Team @@ -15108,7 +15460,7 @@ var SelectionLayer = View.extend(/**@lends module:view/selectionLayer.prototype module.exports = SelectionLayer; -},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],63:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],65:[function(require,module,exports){ /** * @fileoverview Layer class that represents the state of rendering phase * @author NHN Ent. FE Development Team diff --git a/samples/js/grid.min.js b/samples/js/grid.min.js index e6af61c85..ae7d8f502 100644 --- a/samples/js/grid.min.js +++ b/samples/js/grid.min.js @@ -1,12 +1,12 @@ /** * @fileoverview tui-grid * @author NHN Ent. FE Development Team - * @version 1.2.1 + * @version 1.3.0 * @license MIT * @link https://github.com/nhnent/tui.grid */ -!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=new l(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=new l({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=new l({httpStatus:n,requestType:e.requestType,requestParameter:e.data,responseData:null});this.renderModel.set("state",r.DONE),this.trigger("response",o),o.isStopped()||(this.trigger("errorResponse",o),o.isStopped()||i.readyState>1&&alert("데이터 요청 중에 에러가 발생하였습니다.\n\n다시 시도하여 주시기 바랍니다."))}});e.exports=d},{"../base/view":7,"../common/constMap":9,"../common/formUtil":10,"../common/gridEvent":11,"../common/util":12,"./net-router":1}],3:[function(t,e,i){"use strict";var n=t("./common"),o=Backbone.Collection.extend({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({});_.assign(o.prototype,n),e.exports=o},{"./common":4}],6:[function(t,e,i){"use strict";var n=t("../common/constMap").attrName,o=tui.util.defineClass({init:function(t){this.controller=t.controller},events:{},selector:"",_getCellAddress:function(t){var e=t.closest("["+n.ROW_KEY+"]");return{rowKey:e.attr(n.ROW_KEY),columnName:e.attr(n.COLUMN_NAME)}},attachEventHandlers:function(t,e){_.each(this.events,function(i,n){var o=_.bind(this[i],this),s=e+" "+this.selector;t.on(n,s,o)},this)},generateHtml:function(){throw new Error("implement generateHtml() method")}});e.exports=o},{"../common/constMap":9}],7:[function(t,e,i){"use strict";var n=t("./common"),o=Backbone.View.extend({initialize:function(){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()},_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="tui-grid-",o={CONTAINER:"container",CLIPBOARD:"clipboard",NO_SCROLL_X:"no-scroll-x",NO_SCROLL_Y:"no-scroll-y",LAYER_STATE:"layer-state",LAYER_STATE_CONTENT:"layer-state-content",LAYER_STATE_LOADING:"layer-state-loading",LAYER_EDITING:"layer-editing",LAYER_FOCUS:"layer-focus",LAYER_FOCUS_BORDER:"layer-focus-border",LAYER_SELECTION:"layer-selection",BORDER_LINE:"border-line",BORDER_TOP:"border-line-top",BORDER_LEFT:"border-line-left",BORDER_RIGHT:"border-line-right",BORDER_BOTTOM:"border-line-bottom",LSIDE_AREA:"lside-area",RSIDE_AREA:"rside-area",HEAD_AREA:"head-area",BODY_AREA:"body-area",COLUMN_RESIZE_CONTAINER:"column-resize-container",COLUMN_RESIZE_HANDLE:"column-resize-handle",COLUMN_RESIZE_HANDLE_LAST:"column-resize-handle-last",BODY_CONTAINER:"body-container",BODY_TABLE_CONTAINER:"table-container",SCROLLBAR_HEAD:"scrollbar-head",SCROLLBAR_BORDER:"scrollbar-border",SCROLLBAR_RIGHT_BOTTOM:"scrollbar-right-bottom",SCROLLBAR_LEFT_BOTTOM:"scrollbar-left-bottom",PAGINATION:"pagination",PAGINATION_PRE:"pre",PAGINATION_PRE_OFF:"pre-off",PAGINATION_PRE_END:"pre-end",PAGINATION_PRE_END_OFF:"pre-end-off",PAGINATION_NEXT:"next",PAGINATION_NEXT_OFF:"next-off",PAGINATION_NEXT_END:"next-end",PAGINATION_NEXT_END_OFF:"next-end-off",TABLE:"table",CELL:"cell",CELL_HEAD:"cell-head",CELL_ROW_ODD:"cell-row-odd",CELL_ROW_EVEN:"cell-row-even",CELL_EDITABLE:"cell-editable",CELL_DUMMY:"cell-dummy",CELL_REQUIRED:"cell-required",CELL_DISABLED:"cell-disabled",CELL_SELECTED:"cell-selected",CELL_INVALID:"cell-invalid",CELL_ELLIPSIS:"cell-ellipsis",CELL_CURRENT_ROW:"cell-current-row",CELL_MAIN_BUTTON:"cell-main-button",CELL_CONTENT:"cell-content",CELL_CONTENT_BEFORE:"content-before",CELL_CONTENT_AFTER:"content-after",CELL_CONTENT_INPUT:"content-input",BTN_TEXT:"btn-text",BTN_SORT:"btn-sorting",BTN_SORT_UP:"btn-sorting-up",BTN_SORT_DOWN:"btn-sorting-down",BTN_EXCEL:"btn-excel-download",BTN_EXCEL_ICON:"btn-excel-icon",BTN_EXCEL_PAGE:"btn-excel-page",BTN_EXCEL_ALL:"btn-excel-all",TOOLBAR:"toolbar",TOOLBAR_BTN_HOLDER:"toolbar-btn-holder",HEIGHT_RESIZE_BAR:"height-resize-bar",HEIGHT_RESIZE_HANDLE:"height-resize-handle"},i=_.mapObject(o,function(t){return n+t});i.PREFIX=n,e.exports=i},{}],9:[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},attrName:{ROW_KEY:"data-row-key",COLUMN_NAME:"data-column-name",COLUMN_INDEX:"data-column-index",EDIT_TYPE:"data-edit-type",GRID_ID:"data-grid-id"},themeName:{DEFAULT:"default",STRIPED:"striped",CLEAN:"clean"}}},{}],10:[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);t.selectedIndex=_.findIndex(i,function(t){return t.value===e||t.text===e})},"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")[String(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},{}],11:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){this._stopped=!1,this.setData(t)},setData:function(t){_.extend(this,t)},stop:function(){this._stopped=!0},isStopped:function(){return this._stopped}});e.exports=n},{}],12:[function(t,e,i){"use strict";var n=t("./constMap").dimension.CELL_BORDER_WIDTH,o={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+n)},getDisplayRowCount:function(t,e){return Math.ceil(t/(e+n))},getRowHeight:function(t,e){return 0===t?0:Math.floor((e-n)/t)},isMetaColumn:function(t){return _.contains(["_button","_number"],t)},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},isBlank:function(t){return _.isString(t)?!t.length:_.isUndefined(t)||_.isNull(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},toString:function(t){return _.isUndefined(t)||_.isNull(t)?"":String(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?String(t):"number"===e?Number(t):"boolean"===e?Boolean(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},appendStyleElement:function(t,e){var i=document.createElement("style");i.type="text/css",i.id=t,i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e)),document.getElementsByTagName("head")[0].appendChild(i)}};e.exports=o},{"./constMap":9}],13:[function(t,e,i){"use strict";var n=t("./common/constMap").attrName,o=tui.util.defineClass({init:function(t){this.$el=t},getElement:function(t,e){return this.$el.find("tr["+n.ROW_KEY+"="+t+"]").find("td["+n.COLUMN_NAME+"="+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=o},{"./common/constMap":9}],14:[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("./painter/controller"),d=t("./addon/net"),c=t("./common/util"),h=t("./theme/manager"),m=t("./common/constMap").themeName,g={};tui=window.tui=tui||{},tui.Grid=n.extend({initialize:function(t){var e=new a(this.$el);this.id=c.getUniqueKey(),this.modelManager=this._createModelManager(t,e),this.painterManager=this._createPainterManager(),this.container=this._createContainerView(t,e),this.publicEventEmitter=this._createPublicEventEmitter(),this.container.render(),this.refreshLayout(),h.isApplied()||h.apply(m.DEFAULT),this.addOn={},g[this.id]=this},_createModelManager:function(t,e){var i=_.assign({},t,{gridId:this.id});return _.omit(i,"el","singleClickEdit"),new o(i,e)},_createPainterManager:function(){var t=new u({focusModel:this.modelManager.focusModel,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,selectionModel:this.modelManager.selectionModel});return new r({gridId:this.id,selectType:this.modelManager.columnModel.get("selectType"),controller:t})},_createContainerView:function(t,e){var i=new s({modelManager:this.modelManager,painterManager:this.painterManager,domState:e});return i.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){var e=this.modelManager.columnModel.at(0,!0);this.modelManager.focusModel.focus(t,e.columnName)},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 d(e),this.publicEventEmitter.listenToNetAddon(this.addOn.Net)),this},getRowList:function(){return this.modelManager.dataModel.getRowList()},sort:function(t,e){this.modelManager.dataModel.sortByField(t,e)},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 g[t]},tui.Grid.applyTheme=function(t,e){h.apply(t,e)}},{"./addon/net":2,"./base/view":7,"./common/constMap":9,"./common/util":12,"./domState":13,"./model/manager":21,"./painter/controller":29,"./painter/manager":36,"./publicEventEmitter":38,"./theme/manager":40,"./view/factory":48}],15:[function(t,e,i){"use strict";var n=t("../../base/model"),o=t("../../common/util"),s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.textType={normal:!0,text:!0,password:!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,align:"center",editOption:{type:"mainButton"},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&&ea;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=_.isUndefined(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=_.isUndefined(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=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},replaceRowList:function(t,e,i){t||(t=[]),_.isUndefined(e)&&(e=!0),this.trigger("beforeReset",t.length),this.lastRowKey=-1,this.reset(t,{parse:e}),_.isFunction(i)&&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","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 i=this.getMainRowKey(t,e);return this.domState.getElement(i,e)}});e.exports=s},{"../../base/collection":3,"./row":17}],19:[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=t+1+(this.isDivisionBorderDoubled()?1:0),n=i*l,o=e-this.getScrollYWidth()-n;return o},_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;this.set("totalRowHeight",o.getHeight(e,t))},_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}),i.length&&(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=this.columnModel.getVisibleColumnModelList(null,!0),e=this.get("minimumColumnWidth"),i=[],n=[],s=[];_.each(t,function(t){var a=t.width>0?t.width:0,l=Math.max(a,e);o.isMetaColumn(t.columnName)&&(l=a),i.push(a?l:0),s.push(l),n.push(!!t.isFixedWidth)},this),this._columnWidthFixedFlags=n,this._minColumnWidthList=s,this._setColumnWidthVariables(this._calculateColumnWidth(i),!0)},_calculateColumnWidth:function(t){return t=this._fillEmptyColumnWidth(t),t=this._applyMinimumColumnWidth(t),t=this._adjustColumnWidthList(t)},isDivisionBorderDoubled:function(){return this.columnModel.getVisibleColumnFixCount()>0},getFrameWidth:function(t){var e=this.columnModel.getVisibleColumnFixCount(!0),i=this.getColumnWidthList(t),n=this._getFrameWidth(i);return _.isUndefined(t)&&e>0&&(n+=l),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},_getCellHorizontalPosition:function(t){for(var e=this.columnModel,i=e.getVisibleMetaColumnCount(),n=this.get("columnWidthList"),o=e.getVisibleColumnFixCount()+i,s=e.indexOfColumnName(t,!0)+i,a=o>s?0:o,r=0;s>a;a+=1)r+=n[a]+l;return{left:r,right:r+n[s]+l}},_getCellVerticalPosition:function(t,e){var i=this.dataModel,n=this.get("rowHeight"),s=i.indexOfRowKey(t),a=o.getHeight(s,n),l=o.getHeight(e,n);return{top:a,bottom:a+l}},_getRowSpanCount:function(t,e){var i=this.dataModel.get(t).getRowSpanData(e);return i.isMainRow||(t=i.mainRowKey,i=this.dataModel.get(t).getRowSpanData(e)),i.count||1},getCellPosition:function(t,e){var i,n,o;return t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t)?(i=this._getRowSpanCount(t,e),n=this._getCellVerticalPosition(t,i),o=this._getCellHorizontalPosition(e),{top:n.top,bottom:n.bottom,left:o.left,right:o.right}):{}},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(),r=0;return s&&(o+=this.renderModel.get("scrollLeft")),o>=n?r=i.length-1:tui.util.forEachArray(i,function(t,e){return t+=l,r=e,o>t?void(o-=t):!1}),Math.max(0,r-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":9,"../common/util":12}],20:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=t("../common/gridEvent"),a=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.domState=e.domState,this.listenTo(this.dataModel,"reset",this._onResetData)},defaults:{rowKey:null,columnName:"",prevRowKey:null,prevColumnName:"",editingAddress:null},_onResetData:function(){this.unselect(!0)},_savePrevious:function(){null!==this.get("rowKey")&&this.set("prevRowKey",this.get("rowKey")),this.get("columnName")&&this.set("prevColumnName",this.get("columnName"))},_clearPrevious:function(){this.set({prevRowKey:null,prevColumnName:""})},isCurrentCell:function(t,e,i){var n=this.get("columnName"),o=this.get("rowKey");return i&&(o=this.dataModel.getMainRowKey(o,n)),String(o)===String(t)&&n===e},select:function(t){var e=new s,i=this.get("rowKey");return String(i)===String(t)?!0:(e.setData({rowKey:t,prevRowKey:i,rowData:this.dataModel.getRowData(t)}),this.trigger("select",e),e.isStopped()?(this._cancelSelect(),!1):(this.set("rowKey",t),"radio"===this.columnModel.get("selectType")&&this.dataModel.check(t),!0))},_cancelSelect:function(){var t=this.get("prevColumnName");this.set("columnName",t),this.trigger("focus",this.get("rowKey"),t)},unselect:function(t){t&&this.blur(),this.set({rowKey:null})},focus:function(t,e,i){return!this._isValidCell(t,e)||o.isMetaColumn(e)||this.isCurrentCell(t,e)?!0:(this.blur(),this.select(t)?(this.set("columnName",e),this.trigger("focus",t,e),i&&this.scrollToFocus(),!0):!1)},focusAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0),s=!1;return n&&o&&(s=this.focus(n.get("rowKey"),o.columnName,i)),s},focusIn:function(t,e,i){var n=this.focus(t,e,i);return n&&(t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t).isEditable(e)?(this.finishEditing(),this.startEditing(t,e)):this.focusClipboard()),n},focusInAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0),s=!1;return n&&o&&(s=this.focusIn(n.get("rowKey"),o.columnName,i)),s},focusClipboard:function(){this.trigger("focusClipboard")},refreshState:function(){var t;this.domState.hasFocusedElement()?this.has()||(t=this.restore(),t||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(){var t=this.get("columnName");return this.has()?(this.has(!0)&&this._savePrevious(),null!==this.get("rowKey")&&this.set("columnName",""),this.trigger("blur",this.get("rowKey"),t),this):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(t){var e=this.get("rowKey"),i=this.get("columnName");return t?this._isValidCell(e,i):!o.isBlank(e)&&!o.isBlank(i)},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},isEditingCell:function(t,e){var i=this.get("editingAddress");return i&&String(i.rowKey)===String(t)&&i.columnName===e},startEditing:function(t,e){if(this.get("editingAddress"))return!1;if(_.isUndefined(t)&&_.isUndefined(e))t=this.get("rowKey"),e=this.get("columnName");else if(!this.isCurrentCell(t,e,!0))return!1;return t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t).isEditable(e)?(this.set("editingAddress",{rowKey:t,columnName:e}),!0):!1},finishEditing:function(){return this.get("editingAddress")?(this.set("editingAddress",null),!0):!1},_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,o=null;return this.has(!0)&&(e=Math.max(Math.min(n.indexOfRowKey(this.get("rowKey"))+t,this.dataModel.length-1),0),i=n.at(e),i&&(o=i.get("rowKey"))),o},_findColumnName:function(t){var e,i=this.columnModel,n=i.getVisibleColumnModelList(),o=i.indexOfColumnName(this.get("columnName"),!0),s=null;return this.has(!0)&&(e=Math.max(Math.min(o+t,n.length-1),0),s=n[e]&&n[e].columnName),s},_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=a},{"../base/model":5,"../common/gridEvent":11,"../common/util":12}],21:[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={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}},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.focusModel=this._createFocusModel(e),this.renderModel=this._createRenderModel(t),this.selectionModel=this._createSelectionModel(),this.focusModel.renderModel=this.renderModel,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,focusModel:this.focusModel},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},{"./data/columnModel":15,"./data/rowList":18,"./dimension":19,"./focus":20,"./renderer":23,"./renderer-smart":22,"./selection":26,"./toolbar":27}],22:[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),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.criticalPointa&&this.set("state",s.LOADING)},_onEditingAddressChange:function(t,e){var i=e,n=!0,o=this;e||(i=t.previous("editingAddress"),n=!1),this._updateCellData(i.rowKey,i.columnName,{isEditing:n}),this._triggerEditingStateChanged(i.rowKey,i.columnName),_.defer(function(){o._toggleChangeLayoutEventHandlers(n)})},_toggleChangeLayoutEventHandlers:function(t){var e="change:scrollTop change:scrollLeft",i="columnWidthChanged";t?(this.listenToOnce(this.dimensionModel,i,this._onChangeLayoutBound),this.once(e,this._onChangeLayoutBound)):(this.stopListening(this.dimensionModel,i,this._onChangeLayoutBound),this.off(e,this._onChangeLayoutBound))},_triggerEditingStateChanged:function(t,e){var i=this.getCellData(t,e);tui.util.pick(i,"columnModel","editOption","useViewMode")!==!1&&this.trigger("editingStateChanged",i)},_updateCellData:function(t,e,i){var n=this._getRowModel(t,e);n&&n.setCell(e,i)},initializeVariables:function(){this.set({top:0,scrollTop:0,scrollLeft:0,startIndex:0,endIndex:0,startNumber:1})},getCollection:function(t){return this.get(tui.util.isString(t)?t.toLowerCase()+"side":"rside")},_onColumnModelChange:function(){this.set({scrollTop:0,top:0,startIndex:0,endIndex:0}),this.refresh(!0)},_onDataModelChange:function(){this.refresh(!1,!0)},_onAddDataModel:function(t,e){this.refresh(!1,!0),e.focus&&this.focusModel.focusAt(e.at,0)},_resetDummyRows:function(){this._clearDummyRows(),this._fillDummyRows(),this.trigger("rowListChanged")},_setRenderingRange:function(){this.set({startIndex:0,endIndex:this.dataModel.length-1})},_createViewDataFromDataModel:function(t,e,i,n){var o={height:i,rowNum:n,rowKey:t.get("rowKey"),_extraData:t.get("_extraData")};return _.each(e,function(e){var i=t.get(e);"_number"===e&&(i=n),o[e]=i}),o},_getColumnNamesOfEachSide:function(){var t=this.columnModel.getVisibleColumnFixCount(!0),e=this.columnModel.getVisibleColumnModelList(null,!0),i=_.pluck(e,"columnName");return{lside:i.slice(0,t),rside:i.slice(t)}},_resetViewModelList:function(t,e){this.get(t).clear().reset(e,{parse:!0})},_resetAllViewModelListWithRange:function(t,e){var i,n,o=this._getColumnNamesOfEachSide(),s=this.get("startNumber")+t,a=this.dimensionModel.get("rowHeight"),l=[],r=[];for(n=t;e>=n;n+=1)i=this.dataModel.at(n),l.push(this._createViewDataFromDataModel(i,o.lside,a,s)),r.push(this._createViewDataFromDataModel(i,o.rside,a,s)),s+=1;this._resetViewModelList("lside",l),this._resetViewModelList("rside",r)},_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),n=this.dimensionModel.get("rowHeight"),o=this.get("endIndex")+2;_.times(i,function(){_.each(["lside","rside"],function(t){this.get(t).add({height:n,rowNum:o})},this),o+=1},this),this.set("dummyRowCount",i)},refresh:function(t,e){var i,n,o;for(this._setRenderingRange(this.get("scrollTop")),i=this.get("startIndex"),n=this.get("endIndex"),this._resetAllViewModelListWithRange(i,n),this.get("showDummyRows")&&this._fillDummyRows(),o=i;n>=o;o+=1)this._executeRelation(o);t?this.trigger("columnModelChanged"):this.trigger("rowListChanged",e),this._refreshState()},_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")},_getRowModel:function(t,e){var i=this._getCollectionByColumnName(e);return i.get(t)},getCellData:function(t,e){var i=this._getRowModel(t,e),n=null;return i&&(n=i.get(e)),n},_executeRelation:function(t){var e,i,n=this.dataModel.at(t),o=t-this.get("startIndex");i=n.executeRelationCallbacksAll(),_.each(i,function(t,i){e=this._getCollectionByColumnName(i).at(o),e&&e.setCell(i,t)},this)}});e.exports=l},{"../base/model":5,"../common/constMap":9,"./rowList":25}],24:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=n.extend({initialize:function(t){var e=t&&t.rowKey,i=this.collection.dataModel,n=i.get(e);this.dataModel=i,this.columnModel=this.collection.columnModel,this.focusModel=this.collection.focusModel,n&&(this.listenTo(n,"change",this._onDataModelChange),this.listenTo(n,"restore",this._onDataModelRestore),this.listenTo(n,"extraDataChanged",this._setRowExtraData),this.listenTo(i,"disabledChanged",this._onDataModelDisabledChanged),this.rowData=n)},idAttribute:"rowKey",_onDataModelChange:function(t){_.each(t.changed,function(e,i){var n,o;this.has(i)&&(n=this.columnModel.getColumnModel(i),o=this.columnModel.isTextType(i),this.setCell(i,this._getValueAttrs(e,t,n,o)))},this)},_onDataModelRestore:function(t){var e=this.get(t);e&&this.trigger("restore",e)},_getColumnNameList:function(){var t=this.collection.columnModel.getVisibleColumnModelList(null,!0);return _.pluck(t,"columnName")},_onDataModelDisabledChanged:function(){var t=this._getColumnNameList();_.each(t,function(t){this.setCell(t,{isDisabled:this.rowData.isDisabled(t),className:this._getClassNameString(t)})},this)},_setRowExtraData:function(){var t,e=this.collection.dataModel,i=this._getColumnNameList();tui.util.isUndefined(this.collection)||_.each(i,function(i){var n,o=this.get(i),s=this;tui.util.isUndefined(o)||(n=this.rowData.getCellState(i),e.isRowSpanEnable()&&!o.isMainRow&&(s=this.collection.get(o.mainRowKey)),s&&(t={isDisabled:n.isDisabled,isEditable:n.isEditable,className:this._getClassNameString(i)},s.setCell(i,t)))},this)},parse:function(t,e){var i=e.collection;return this._formatData(t,i.dataModel,i.columnModel,i.focusModel)},_formatData:function(t,e,i,n){var o,s,a=t.rowKey,l=t.rowNum;return _.isUndefined(a)?t:(s=e.get(a),o=_.omit(t,"rowKey","_extraData","height","rowNum"),_.each(o,function(o,r){var u=this._getRowSpanData(r,t,e.isRowSpanEnable()),d=s.getCellState(r),c=i.isTextType(r),h=i.getColumnModel(r);t[r]={rowKey:a,rowNum:l,columnName:r,rowSpan:u.count,isMainRow:u.isMainRow,mainRowKey:u.mainRowKey,isEditable:d.isEditable,isDisabled:d.isDisabled,isEditing:n.isEditingCell(a,r),optionList:tui.util.pick(h,"editOption","list"),className:this._getClassNameString(r,s,n),columnModel:h,changed:[]},_.assign(t[r],this._getValueAttrs(o,s,h,c))},this),t)},_getClassNameString:function(t,e,i){var n;return e||(e=this.dataModel.get(this.get("rowKey")))?(i||(i=this.focusModel),n=e.getClassNameList(t),n.join(" ")):""},_getValueAttrs:function(t,e,i,n){var o=tui.util.pick(i,"editOption","beforeContent"),s=tui.util.pick(i,"editOption","afterContent"),a=tui.util.pick(i,"editOption","converter"),l=e.toJSON();return{value:this._getValueToDisplay(t,i,n),formattedValue:this._getFormattedValue(t,l,i),beforeContent:this._getExtraContent(o,t,l),afterContent:this._getExtraContent(s,t,l),convertedHTML:this._getConvertedHTML(a,t,l)}},_getFormattedValue:function(t,e,i){var n=t||"";return _.isFunction(i.formatter)&&(n=i.formatter(n,e,i)),n},_getExtraContent:function(t,e,i){var n="";return _.isFunction(t)?n=t(e,i):tui.util.isExisty(t)&&(n=t),n},_getConvertedHTML:function(t,e,i){var n=null;return _.isFunction(t)&&(n=t(e,i)),n===!1&&(n=null),n},_getValueToDisplay:function(t,e,i){var n=tui.util.isExisty,o=e.notUseHtmlEntity,s=e.defaultValue;return n(t)||(t=n(s)?s:""),i&&!o&&tui.util.hasEncodableString(t)&&(t=tui.util.encodeHTMLEntity(t)),t},_getRowSpanData:function(t,e,i){var n=tui.util.pick(e,"_extraData","rowSpanData",t);return i&&n||(n={mainRowKey:e.rowKey,count:0,isMainRow:!0}),n},updateClassName:function(t){this.setCell(t,{className:this._getClassNameString(t)})},setCell:function(t,e){var i,n,s,a=!1,l=[];this.has(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,{silent:this._shouldSetSilently(s,a)}),a&&!s.isEditing&&(i=this.collection.dataModel.indexOfRowKey(n),this.trigger("valueChange",i))))},_shouldSetSilently:function(t,e){var i=t.isEditing&&e,n=tui.util.pick(t,"columnModel","editOption","useViewMode")!==!1,o=_.contains(t.changed,"isEditing")&&t.isEditing;return i||n&&o}});e.exports=s},{"../base/model":5,"../common/util":12}],25:[function(t,e,i){"use strict";var n=t("../base/collection"),o=t("./row"),s=n.extend({initialize:function(t,e){this.setOwnProperties({dataModel:e.dataModel,columnModel:e.columnModel,focusModel:e.focusModel})},model:o});e.exports=s},{"../base/collection":3,"./row":24}],26:[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.getValueString(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]),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":12}],27:[function(t,e,i){"use strict";var n=t("../base/model"),o=n.extend({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}],28:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.editType=t.editType,this.inputPainter=t.inputPainter,this.selector="td["+s.EDIT_TYPE+"="+this.editType+"]"},events:{dblclick:"_onDblClick"},template:_.template("><%=contentHtml%>"),_onDblClick:function(t){var e;this._isEditableType()&&(e=this._getCellAddress($(t.target)),this.controller.startEditing(e,!0))},_isEditableType:function(){return!_.contains(["normal","mainButton"],this.editType)},_getContentHtml:function(t){var e=t.formattedValue,i=t.beforeContent,n=t.afterContent;return this.inputPainter&&(e=this.inputPainter.generateHtml(t),this._shouldContentBeWrapped()&&!this._isUsingViewMode(t))?(i=this._getSpanWrapContent(i,a.CELL_CONTENT_BEFORE),n=this._getSpanWrapContent(n,a.CELL_CONTENT_AFTER),e=this._getSpanWrapContent(e,a.CELL_CONTENT_INPUT),i+n+e):i+e+n},_isUsingViewMode:function(t){return tui.util.pick(t,"columnModel","editOption","useViewMode")!==!1},_shouldContentBeWrapped:function(){return _.contains(["text","password","select"],this.editType)},_getSpanWrapContent:function(t,e){return tui.util.isFalsy(t)&&(t=""),''+t+""},_getAttributes:function(t){var e=[t.className,a.CELL,a.CELL_CONTENT,t.rowNum%2?a.CELL_ROW_ODD:a.CELL_ROW_EVEN],i={align:t.columnModel.align||"left"};return i["class"]=e.join(" "),i[s.EDIT_TYPE]=this.editType,i[s.ROW_KEY]=t.rowKey,i[s.COLUMN_NAME]=t.columnName,t.rowSpan&&(i.rowspan=t.rowSpan),i},attachEventHandlers:function(t,e){n.prototype.attachEventHandlers.call(this,t,e),this.inputPainter&&this.inputPainter.attachEventHandlers(t,e+" "+this.selector)},generateHtml:function(t){var e=o.getAttributesString(this._getAttributes(t)),i=this._getContentHtml(t);return this.template({attributeString:e,contentHtml:i||"​"})},refresh:function(t,e){var i=["value","isEditing","isDisabled"],n=_.contains(t.changed,"isEditing"),o=_.intersection(i,t.changed).length>0,s=this._getAttributes(t);delete s.rowspan,e.attr(s),n&&t.isEditing&&!this._isUsingViewMode(t)?this.inputPainter.focus(e):o&&(e.html(this._getContentHtml(t)),e.scrollLeft(0))}});e.exports=l},{"../base/painter":6,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],29:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){this.focusModel=t.focusModel,this.dataModel=t.dataModel,this.columnModel=t.columnModel,this.selectionModel=t.selectionModel},startEditing:function(t,e){var i;return e&&this.focusModel.finishEditing(),i=this.focusModel.startEditing(t.rowKey,t.columnName),i&&this.selectionModel.end(),i},finishEditing:function(t,e,i){var n=this.focusModel;return n.isEditingCell(t.rowKey,t.columnName)?(this.selectionModel.enable(),_.isUndefined(i)||(this.setValue(t,i),this.dataModel.get(t.rowKey).validateCell(t.columnName)),n.finishEditing(),e?n.focusClipboard():_.defer(function(){n.refreshState()}),!0):!1},focusInToNextCell:function(t){var e=this.focusModel,i=e.get("rowKey"),n=e.get("columnName"),o=t?e.prevColumnName():e.nextColumnName();n!==o&&e.focusIn(i,o,!0)},executeCustomInputEventHandler:function(t,e){var i,n=this.columnModel.getColumnModel(e.columnName),o=t.type;"focusin"===o?o="focus":"focusout"===o&&(o="blur"),i=tui.util.pick(n,"editOption","inputEvents",o),_.isFunction(i)&&i.call(t.target,t,e)},appendEmptyRowAndFocus:function(){this.dataModel.append({},{focus:!0})},setValue:function(t,e){this.dataModel.setValue(t.rowKey,t.columnName,e)}});e.exports=n},{}],30:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},events:{dblclick:"_onDblClick"},selector:"td["+s.EDIT_TYPE+"=dummy]",template:_.template("​'),_onDblClick:function(){this.controller.appendEmptyRowAndFocus(!0)},generateHtml:function(t,e){var i=[a.CELL,a.CELL_DUMMY,t%2?a.CELL_ROW_ODD:a.CELL_ROW_EVEN];return o.isMetaColumn(e)&&i.push(a.CELL_HEAD),this.template({columnName:e,className:i.join(" ")})}});e.exports=l},{"../base/painter":6,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],31:[function(t,e,i){"use strict";var n=t("../../base/painter"),o=t("../../common/constMap").keyName,s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},events:{keydown:"_onKeyDown",focusin:"_onFocusIn",focusout:"_onFocusOut"},keyDownActions:{ESC:function(t){this.controller.finishEditing(t.address,!0)},ENTER:function(t){this.controller.finishEditing(t.address,!0,t.value)},TAB:function(t){this.controller.finishEditing(t.address,!0,t.value),this.controller.focusInToNextCell(t.shiftKey)}},_extendKeydownActions:function(t){this.keyDownActions=_.assign({},this.keyDownActions,t)},_extendEvents:function(t){this.events=_.assign({},this.events,t)},_executeCustomEventHandler:function(t){var e=$(t.target),i=this._getCellAddress(e);this.controller.executeCustomInputEventHandler(t,i)},_onFocusIn:function(t){var e=this._getCellAddress($(t.target));this._executeCustomEventHandler(t),this.controller.startEditing(e)},_onFocusOut:function(t){var e=$(t.target),i=this._getCellAddress(e);this._executeCustomEventHandler(t),this.controller.finishEditing(i,!1,e.val())},_onKeyDown:function(t){var e=t.keyCode||t.which,i=o[e],n=this.keyDownActions[i],s=$(t.target),a={$target:s,address:this._getCellAddress(s),shiftKey:t.shiftKey,value:s.val()};this._executeCustomEventHandler(t),n&&(n.call(this,a),t.preventDefault())},_getDisplayValue:function(){throw new Error("implement _getDisplayValue() method")},_generateInputHtml:function(){throw new Error("implement _generateInputHtml() method")},_isUsingViewMode:function(t){return tui.util.pick(t,"columnModel","editOption","useViewMode")!==!1},generateHtml:function(t){var e;return e=_.isNull(t.convertedHTML)?!this._isUsingViewMode(t)||t.isEditing?this._generateInputHtml(t):this._getDisplayValue(t):t.convertedHTML},focus:function(t){var e=t.find(this.selector);e.is(":focus")||e.eq(0).focus()}});e.exports=s},{"../../base/painter":6,"../../common/constMap":9}],32:[function(t,e,i){"use strict";var n=t("./base"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.inputType=t.inputType,this.selector="fieldset[data-type="+this.inputType+"]",this._extendEvents({mousedown:"_onMouseDown"}),this._extendKeydownActions({TAB:function(t){var e;this._focusNextInput(t.$target,t.shiftKey)||(e=this._getCheckedValueString(t.$target),this.controller.finishEditing(t.address,!0,e),this.controller.focusInToNextCell(t.shiftKey))},ENTER:function(t){var e=this._getCheckedValueString(t.$target);this.controller.finishEditing(t.address,!0,e)},LEFT_ARROW:function(t){this._focusNextInput(t.$target,!0)},RIGHT_ARROW:function(t){this._focusNextInput(t.$target)},UP_ARROW:function(){},DOWN_ARROW:function(){}})},template:_.template('
<%=content%>
'),inputTemplate:_.template(' <%=disabled%> />'),labelTemplate:_.template(''),_onFocusOut:function(t){var e=$(t.target),i=this;_.defer(function(){var t,n;e.siblings("input:focus").length||(t=i._getCellAddress(e),n=i._getCheckedValueString(e),i.controller.finishEditing(t,!1,n))})},_onMouseDown:function(t){var e=$(t.target),i=e.closest("fieldset").find("input:focus").length>0;!e.is("input")&&i&&(t.stopPropagation(),t.preventDefault())},_focusNextInput:function(t,e){var i=e?"prevAll":"nextAll",n=t[i]("input");return n.length?(n.first().focus(),!0):!1},_getCheckedValueString:function(t){var e,i=t.parent().find("input:checked"),n=[];return i.each(function(){var t=$(this),e=t.attr("data-value-type"),i=o.convertValueType(t.val(),e);n.push(i)}),e=1===n.length?n[0]:n.join(",")},_getCheckedValueSet:function(t){var e={};return _.each(String(t).split(","),function(t){e[t]=!0}),e},_getDisplayValue:function(t){var e=this._getCheckedValueSet(t.value),i=[];return _.each(t.optionList,function(t){e[t.value]&&i.push(t.text)}),i.join(",")},_generateInputHtml:function(t){var e=this._getCheckedValueSet(t.value),i=o.getUniqueKey(),n="";return _.each(t.optionList,function(o){var s=i+"_"+o.value;n+=this.inputTemplate({type:this.inputType,id:s,name:i,value:o.value,valueType:typeof o.value,checked:e[o.value]?"checked":"",disabled:t.isDisabled?"disabled":""}),o.text&&(n+=this.labelTemplate({id:s,labelText:o.text}))},this),this.template({type:this.inputType,content:n})},focus:function(t){var e=t.find("input");e.is(":focus")||e.eq(0).focus()}});e.exports=s},{"../../common/util":12,"./base":31}],33:[function(t,e,i){"use strict";var n=t("../../base/painter"),o=t("../../common/classNameConst"),s=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.selector="input."+o.CELL_MAIN_BUTTON,this.inputType=t.inputType,this.gridId=t.gridId},events:{change:"_onChange"},template:_.template(' />'),_onChange:function(t){var e=$(t.target),i=this._getCellAddress(e);this.controller.setValue(i,e.is(":checked"))},generateHtml:function(t){return this.template({type:this.inputType,name:this.gridId,checked:t.value?"checked":""})}});e.exports=s},{"../../base/painter":6,"../../common/classNameConst":8}],34:[function(t,e,i){"use strict";var n=t("./base"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.selector="select"},template:_.template(''),optionTemplate:_.template(''),_getDisplayValue:function(t){var e=_.find(t.optionList,function(e){return String(e.value)===String(t.value)});return e?e.text:""},_generateInputHtml:function(t){var e=_.reduce(t.optionList,function(e,i){return e+this.optionTemplate({value:i.value,text:i.text,selected:String(t.value)===String(i.value)?"selected":""})},"",this);return this.template({name:o.getUniqueKey(),disabled:t.isDisabled?"disabled":"",options:e})}});e.exports=s},{"../../common/util":12,"./base":31}],35:[function(t,e,i){"use strict";var n=t("./base"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.inputType=t.inputType,this.selector="input[type="+this.inputType+"]",this._extendEvents({selectstart:"_onSelectStart"})},template:_.template('/>'),_onSelectStart:function(t){t.stopPropagation()},_convertStringToAsterisks:function(t){return Array(t.length+1).join("*")},_getDisplayValue:function(t){var e=t.formattedValue;return"password"===this.inputType&&(e=this._convertStringToAsterisks(t.value)),e},_generateInputHtml:function(t){var e=tui.util.pick(t,"columnModel","editOption","maxLength");return this.template({type:this.inputType,value:t.value,name:o.getUniqueKey(),disabled:t.isDisabled?"disabled":"",maxLength:e})},focus:function(t){var e=t.find(this.selector);1!==e.length||e.is(":focus")||e.select()}});e.exports=s},{"../../common/util":12,"./base":31}],36:[function(t,e,i){"use strict";var n=t("./row"),o=t("./cell"),s=t("./dummyCell"),a=t("./input/text"),l=t("./input/select"),r=t("./input/button"),u=t("./input/mainButton"),d=tui.util.defineClass({init:function(t){this.gridId=t.gridId,this.selectType=t.selectType,this.inputPainters=this._createInputPainters(t.controller),this.cellPainters=this._createCellPainters(t.controller),this.rowPainter=this._createRowPainter()},_createInputPainters:function(t){return{text:new a({controller:t,inputType:"text"}),password:new a({controller:t,inputType:"password"}),checkbox:new r({controller:t,inputType:"checkbox"}),radio:new r({controller:t,inputType:"radio"}),select:new l({controller:t}),mainButton:new u({controller:t,inputType:this.selectType,gridId:this.gridId})}},_createCellPainters:function(t){var e={dummy:new s({controller:t}),normal:new o({controller:t,editType:"normal"})};return _.each(this.inputPainters,function(i,n){e[n]=new o({editType:n,controller:t,inputPainter:i})},this),e},_createRowPainter:function(){return new n({painterManager:this})},getCellPainter:function(t){return this.cellPainters[t]},getCellPainters:function(){return this.cellPainters},getInputPainters:function(t){var e=this.inputPainters;return t&&(e=_.omit(e,"mainButton")),e},getRowPainter:function(){return this.rowPainter}});e.exports=d},{"./cell":28,"./dummyCell":30,"./input/button":32,"./input/mainButton":33,"./input/select":34,"./input/text":35,"./row":37}],37:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap"),a=s.attrName,l=s.dimension.CELL_BORDER_WIDTH,r=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.painterManager=t.painterManager},selector:"tr",template:_.template('="<%=rowKey%>" class="<%=className%>" style="height: <%=height%>px;"><%=contents%>'),_getEditType:function(t,e){var i=tui.util.pick(e.columnModel,"editOption","type");return i||"normal"},_generateHtmlForDummyRow:function(t,e){var i=this.painterManager.getCellPainter("dummy"),n="";return _.each(e,function(e){n+=i.generateHtml(t,e)}),n},_generateHtmlForActualRow:function(t,e){var i="";return _.each(e,function(e){var n,o,s=t.get(e);s&&s.isMainRow&&(n=this._getEditType(e,s),o=this.painterManager.getCellPainter(n),i+=o.generateHtml(s))},this),i},generateHtml:function(t,e){var i,n=t.get("rowKey"),o=t.get("rowNum"),s="";return i=_.isUndefined(n)?this._generateHtmlForDummyRow(o,e):this._generateHtmlForActualRow(t,e),this.template({rowKeyAttrName:a.ROW_KEY,rowKey:n,height:t.get("height")+r._extraHeight+l,contents:i,className:s})},refresh:function(t,e){_.each(t,function(t,i){ -var n,o,s;"_extraData"!==i&&(s=e.find("td["+a.COLUMN_NAME+"="+i+"]"),n=this._getEditType(i,t),o=this.painterManager.getCellPainter(n),o.refresh(t,s))},this)},"static":{_extraHeight:function(){var t=0;return o.isBrowserIE7()&&(t=-2),t}()}});e.exports=r},{"../base/painter":6,"../common/constMap":9,"../common/util":12}],38:[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},{}],39:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){if(!_.isString(t)||!t)throw new Error("The Selector must be a string and not be empty.");this._selector=t,this._propValues=[]},add:function(t,e){return e&&this._propValues.push(t+":"+e),this},border:function(t){return this.add("border-color",t)},borderWidth:function(t){var e,i=t.showVerticalBorder,n=t.showHorizontalBorder;return _.isBoolean(i)&&(e=i?"1px":"0",this.add("border-left-width",e).add("border-right-width",e)),_.isBoolean(n)&&(e=n?"1px":"0",this.add("border-top-width",e).add("border-bottom-width",e)),this},bg:function(t){return this.add("background-color",t)},text:function(t){return this.add("color",t)},build:function(){var t="";return this._propValues.length&&(t=this._selector+"{"+this._propValues.join(";")+"}"),t}});e.exports={create:function(t){return new n(t)},createClassRule:function(t){return this.create("."+t)},createWebkitScrollbarRules:function(t,e){return[this.create(t+" ::-webkit-scrollbar").bg(e.background),this.create(t+" ::-webkit-scrollbar-thumb").bg(e.thumb),this.create(t+" ::-webkit-scrollbar-thumb:hover").bg(e.active)]},createIEScrollbarRule:function(t,e){var i=["scrollbar-3dlight-color","scrollbar-darkshadow-color","scrollbar-track-color","scrollbar-shadow-color"],n=["scrollbar-face-color","scrollbar-highlight-color"],o=this.create(t);return _.each(i,function(t){o.add(t,e.background)}),_.each(n,function(t){o.add(t,e.thumb)}),o.add("scrollbar-arrow-color",e.active),o},buildAll:function(t){return _.map(t,function(t){return t.build()}).join("")}}},{}],40:[function(t,e,i){"use strict";function n(t){var e=[a.grid(t.grid),a.scrollbar(t.scrollbar),a.toolbar(t.toolbar),a.selection(t.selection)],i=t.cell;return i&&(e=e.concat([a.cell(i.normal),a.cellDummy(i.dummy),a.cellEditable(i.editable),a.cellEvenRow(i.evenRow),a.cellHead(i.head),a.cellRequired(i.required),a.cellDisabled(i.disabled),a.cellInvalid(i.invalid),a.cellCurrentRow(i.currentRow),a.cellSelectedHead(i.selectedHead),a.cellFocused(i.focused)])),e.join("")}function o(t){var e=n(t);$("#"+r).remove(),s.appendStyleElement(r,e)}var s=t("../common/util"),a=t("./styleGenerator"),l=t("../common/constMap").themeName,r="tui-grid-theme-style",u={};u[l.DEFAULT]=t("./preset/default"),u[l.STRIPED]=t("./preset/striped"),u[l.CLEAN]=t("./preset/clean"),e.exports={apply:function(t,e){var i=u[t];i||(i=u[l.DEFAULT]),i=$.extend(!0,{},i,e),o(i)},isApplied:function(){return 1===$("#"+r).length}}},{"../common/constMap":9,"../common/util":12,"./preset/clean":41,"./preset/default":42,"./preset/striped":43,"./styleGenerator":44}],41:[function(t,e,i){"use strict";var n=t("./default");e.exports=$.extend(!0,{},n,{grid:{border:"#c0c0c0"},toolbar:{border:"#e0e0e0"},cell:{normal:{background:"#fff",border:"#e0e0e0",showVerticalBorder:!1,showHorizontalBorder:!0},head:{background:"#fff",border:"#e0e0e0",showVerticalBorder:!1,showHorizontalBorder:!0},selectedHead:{background:"#e0e0e0"}}})},{"./default":42}],42:[function(t,e,i){"use strict";e.exports={grid:{background:"#fff",border:"#ccc",text:"#444"},selection:{background:"#4daaf9",border:"#004082"},toolbar:{border:"#ccc",background:"transparent"},scrollbar:{background:"#f5f5f5",thumb:"#d9d9d9",active:"#c1c1c1"},cell:{normal:{background:"#fbfbfb",border:"#e0e0e0",showVerticalBorder:!0,showHorizontalBorder:!0},head:{background:"#eee",border:"#ccc",showVerticalBorder:!0,showHorizontalBorder:!0},selectedHead:{background:"#d8d8d8"},focused:{border:"#418ed4"},required:{background:"#fffdeb"},editable:{background:"#fff"},disabled:{text:"#b0b0b0"},dummy:{background:"#fff"},invalid:{background:"#ff8080"},evenRow:{},currentRow:{}}}},{}],43:[function(t,e,i){"use strict";var n=t("./default");e.exports=$.extend(!0,{},n,{cell:{normal:{background:"#fff",border:"#e8e8e8",showVerticalBorder:!1,showHorizontalBorder:!1},evenRow:{background:"#f3f3f3"},head:{showVerticalBorder:!0,showHorizontalBorder:!0}}})},{"./default":42}],44:[function(t,e,i){"use strict";function n(t,e){return a(t).bg(e.background).text(e.text).build()}var o=t("./cssRuleBuilder"),s=t("../common/classNameConst"),a=_.bind(o.createClassRule,o);e.exports={grid:function(t){var e=a(s.CONTAINER).bg(t.background).border(t.border).text(t.text),i=a(s.TABLE).border(t.border),n=a(s.HEAD_AREA).border(t.border),l=a(s.BORDER_LINE).bg(t.border),r=a(s.SCROLLBAR_HEAD).border(t.border),u=a(s.SCROLLBAR_BORDER).bg(t.border);return o.buildAll([e,i,n,l,r,u])},scrollbar:function(t){var e=o.createWebkitScrollbarRules("."+s.CONTAINER,t),i=o.createIEScrollbarRule("."+s.CONTAINER,t),n=a(s.SCROLLBAR_RIGHT_BOTTOM).bg(t.background),l=a(s.SCROLLBAR_LEFT_BOTTOM).bg(t.background),r=a(s.SCROLLBAR_HEAD).bg(t.background);return o.buildAll(e.concat([i,n,l,r]))},toolbar:function(t){var e=a(s.TOOLBAR).bg(t.background).border(t.border),i=a(s.HEIGHT_RESIZE_HANDLE).border(t.border);return o.buildAll([e,i])},selection:function(t){return a(s.LAYER_SELECTION).bg(t.background).border(t.border).build()},cell:function(t){var e=a(s.CELL).bg(t.background).border(t.border).borderWidth(t).text(t.text);return e.build()},cellHead:function(t){var e=a(s.CELL_HEAD).bg(t.background).border(t.border).borderWidth(t).text(t.text);return e.build()},cellEvenRow:function(t){return a(s.CELL_ROW_EVEN).bg(t.background).build()},cellSelectedHead:function(t){return o.create("."+s.CELL_HEAD+"."+s.CELL_SELECTED).bg(t.background).text(t.text).build()},cellFocused:function(t){var e=a(s.LAYER_FOCUS_BORDER).bg(t.border),i=a(s.LAYER_EDITING).border(t.border);return o.buildAll([e,i])},cellEditable:function(t){return n(s.CELL_EDITABLE,t)},cellRequired:function(t){return n(s.CELL_REQUIRED,t)},cellDisabled:function(t){return n(s.CELL_DISABLED,t)},cellDummy:function(t){return n(s.CELL_DUMMY,t)},cellInvalid:function(t){return n(s.CELL_INVALID,t)},cellCurrentRow:function(t){return n(s.CELL_CURRENT_ROW,t)}}},{"../common/classNameConst":8,"./cssRuleBuilder":39}],45:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").keyCode,a=t("../common/classNameConst"),l=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:a.CLIPBOARD,events:{keydown:"_onKeyDown",blur:"_onBlur"},_onBlur:function(){var t=this.focusModel;setTimeout(function(){t.refreshState()},0)},_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?void t.preventDefault():(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){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"),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(a.BORDER_LINE+" "+a.BORDER_TOP),$("
").addClass(a.BORDER_LINE+" "+a.BORDER_LEFT),$("
").addClass(a.BORDER_LINE+" "+a.BORDER_RIGHT)]);return this.$el.addClass(a.CONTAINER).attr(s.GRID_ID,this.gridId).append(t),this.dimensionModel.get("scrollX")||this.$el.addClass(a.NO_SCROLL_X),this._appendBottomLine(),this._refreshHeight(),this.trigger("rendered"),this},_appendBottomLine:function(){var t=this.dimensionModel.get("toolbarHeight")+this.dimensionModel.getScrollXHeight(),e=$("
").addClass(a.BORDER_BOTTOM).addClass(a.BORDER_LINE).css("bottom",t);this.dimensionModel.get("scrollY")||e.addClass(a.NO_SCROLL_Y),this.$el.append(e)},destroy:function(){this.stopListening(),$(window).off("resize.grid"),this._destroyChildren(),this.$el.replaceWith(this.__$el),this.$el=this.__$el=null}});e.exports=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/gridEvent":11}],47:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").dimension.CELL_BORDER_WIDTH,s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=n.extend({initialize:function(t){this.renderModel=t.renderModel,this.domState=t.domState,this.inputPainters=t.inputPainters,this.listenTo(this.renderModel,"editingStateChanged",this._onEditingStateChanged)},className:a.LAYER_EDITING+" "+a.CELL_CONTENT,_startEditing:function(t){var e=t.rowKey,i=t.columnName,n=tui.util.pick(t,"columnModel","editOption","type"),o=this._calculateLayoutStyle(e,i,this._isWidthExpandable(n)),a=this.inputPainters[n];this.$el.html(a.generateHtml(t)).attr(s.ROW_KEY,e).attr(s.COLUMN_NAME,i).css(o).show(),this._adjustLeftPosition(),a.focus(this.$el)},_isWidthExpandable:function(t){return _.contains(["checkbox","radio"],t)},_finishEditing:function(){this.$el.removeAttr(s.ROW_KEY),this.$el.removeAttr(s.COLUMN_NAME),this.$el.empty().hide()},_adjustLeftPosition:function(){var t=this.domState.getWidth(),e=this.$el.outerWidth(),i=this.$el.position().left;i+e>t&&this.$el.css("left",t-e)},_adjustCellOffsetValue:function(t){var e=tui.util.browser,i=t;return e.msie&&(9===e.version?i=t-1:e.version>9&&(i=Math.floor(t))),i},_calculateLayoutStyle:function(t,e,i){var n=this.domState.getOffset(),s=this.domState.getElement(t,e),a=s.offset(),l=s.height()+o,r=s.width()+o;return{top:this._adjustCellOffsetValue(a.top)-n.top,left:this._adjustCellOffsetValue(a.left)-n.left,height:l,minWidth:i?r:"",width:i?"":r,lineHeight:l+"px"}},_onEditingStateChanged:function(t){t.isEditing?this._startEditing(t):this._finishEditing()},render:function(){return _.each(this.inputPainters,function(t){t.attachEventHandlers(this.$el,"")},this),this}});e.exports=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],48:[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"),_=t("./rowList"),p=t("./selectionLayer"),M=t("./editingLayer"),C=t("./focusLayer"),w=tui.util.defineClass({init:function(t){this.domState=t.domState,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,focusModel:this.modelManager.focusModel,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 _({el:t.el,whichSide:t.whichSide,bodyTableView:t.bodyTableView,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,dimensionModel:this.modelManager.dimensionModel,selectionModel:this.modelManager.selectionModel,renderModel:this.modelManager.renderModel,focusModel:this.modelManager.focusModel,painterManager:this.painterManager})},createSelectionLayer:function(t){return new p({whichSide:t,selectionModel:this.modelManager.selectionModel,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel})},createEditingLayer:function(){return new M({renderModel:this.modelManager.renderModel,inputPainters:this.painterManager.getInputPainters(!0),domState:this.domState})},createFocusLayer:function(t){return new C({whichSide:t,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel,focusModel:this.modelManager.focusModel})}});e.exports=w},{"./clipboard":45,"./container":46,"./editingLayer":47,"./focusLayer":49,"./layout/body":50,"./layout/bodyTable":51,"./layout/frame-lside":52,"./layout/frame-rside":53,"./layout/header":55,"./layout/resizeHandler":56,"./layout/toolbar":57,"./layout/toolbar/controlPanel":58,"./layout/toolbar/pagination":59,"./layout/toolbar/resizeHandler":60,"./rowList":61,"./selectionLayer":62,"./stateLayer":63}],49:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").dimension.CELL_BORDER_WIDTH,s=t("../common/classNameConst"),a='
',l=n.extend({initialize:function(t){this.focusModel=t.focusModel,this.columnModel=t.columnModel,this.dimensionModel=t.dimensionModel,this.whichSide=t.whichSide,this.borderEl={$top:$(a),$left:$(a),$right:$(a),$bottom:$(a)},this.listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged),this.listenTo(this.focusModel,"blur",this._onBlur),this.listenTo(this.focusModel,"focus",this._onFocus)},className:s.LAYER_FOCUS,_onColumnWidthChanged:function(){var t=this.focusModel;this.$el.is(":visible")&&this._refreshBorderLayout(t.get("rowKey"),t.get("columnName"))},_onBlur:function(){this.$el.hide()},_onFocus:function(t,e){var i=this.columnModel.isLside(e)?"L":"R";i===this.whichSide&&(this._refreshBorderLayout(t,e),this.$el.show())},_onChangeEditingAddress:function(t,e){e?this.$el.hide():this.$el.show()},_refreshBorderLayout:function(t,e){var i=this.dimensionModel.getCellPosition(t,e),n=i.right-i.left,s=i.bottom-i.top;this.borderEl.$left.css({top:i.top,left:i.left,width:o,height:s+o}),this.borderEl.$top.css({top:0===i.top?o:i.top,left:i.left,width:n+o,height:o}),this.borderEl.$right.css({top:i.top,left:i.left+n,width:o,height:s+o}),this.borderEl.$bottom.css({top:i.top+s,left:i.left,width:n+o,height:o})},render:function(){var t=this.$el;return _.each(this.borderEl,function(e){t.append(e)}),t.hide(),this}});e.exports=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],50:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap").attrName,a=t("../../common/classNameConst"),l=200,r=10,u=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)},className:a.BODY_AREA,events:function(){var t={};return t.scroll="_onScroll",t["mousedown ."+a.BODY_CONTAINER]="_onMouseDown",t},_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.closest("td"),a=n.closest("tr"),l=o.attr(s.COLUMN_NAME),r=a.attr(s.ROW_KEY),u=!0,d=_.pick(t,"pageX","pageY","shiftKey");o.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(d,e,l,n.is("input"))},_controlStartAction:function(t,e,i,n){var s=this.selectionModel,a=e.column,l=e.row,r=!0;s.isEnabled()&&(o.isMetaColumn(i)?"_number"===i?this._updateSelectionByRow(l,t.shiftKey):r=!1:(s.setState("cell"),t.shiftKey&&!n?s.update(l,a):(r=this._doFocusAtAndCheckDraggable(l,a),s.end())),!n&&r&&(this.dimensionModel.refreshLayout(),this._attachDragEvents(t.pageX,t.pageY)))},_updateSelectionByRow:function(t,e){e?this.selectionModel.update(t,0,"row"):this.selectionModel.selectRow(t)},_doFocusAtAndCheckDraggable:function(t,e){var i=(new Date).getTime(),n=this.focusModel.focusAt(t,e),o=(new Date).getTime(),s=o-i>l;return n&&!s},_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._getMouseMoveDistance(t.pageX,t.pageY)>r;(this.selectionModel.hasSelection()||e)&&this.selectionModel.updateByMousePosition(t.pageX,t.pageY)},_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=$("
").addClass(a.BODY_CONTAINER),this.$el.append(this.$container),this._addChildren([this.viewFactory.createBodyTable(t),this.viewFactory.createSelectionLayer(t),this.viewFactory.createFocusLayer(t)]),this.$container.append(this._renderChildren()),this._resetContainerHeight(),this}});e.exports=u},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],51:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap"),a=t("../../common/classNameConst"),l=s.dimension.CELL_BORDER_WIDTH,r=s.attrName.COLUMN_NAME,u=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()},className:a.BODY_TABLE_CONTAINER,template:_.template('<%=colGroup%><%=tbody%>
'),templateCol:_.template('="<%=columnName%>" style="width:<%=width%>px">'),_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-u.EXTRA_WIDTH+l),i+=t+l},this),o.isBrowserIE7()&&this.$el.width(i)},_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},_attachAllTableEventHandlers:function(){var t=this.painterManager.getCellPainters();_.each(t,function(t){t.attachEventHandlers(this.$el,"")},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){n+=this.templateCol({attrColumnName:r,columnName:t.columnName,width:e[i]-u.EXTRA_WIDTH+l})},this),n}},{EXTRA_WIDTH:o.isBrowserIE7()?20:0});e.exports=u},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],52:[function(t,e,i){"use strict";var n=t("./frame"),o=t("../../common/classNameConst"),s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"L"})},className:o.LSIDE_AREA,_onColumnWidthChanged:function(){this.$el.css({width:this.dimensionModel.get("lsideWidth")})},beforeRender:function(){this.$el.css({display:"block",width:this.dimensionModel.get("lsideWidth")})},afterRender:function(){var t,e=this.dimensionModel;e.get("scrollX")&&(t=$("
").addClass(o.SCROLLBAR_LEFT_BOTTOM).css("bottom",e.get("toolbarHeight")),this.$el.append(t))}});e.exports=s},{"../../common/classNameConst":8,"./frame":54}],53:[function(t,e,i){"use strict";var n=t("./frame"),o=t("../../common/classNameConst"),s=t("../../common/constMap").dimension.CELL_BORDER_WIDTH,a=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:o.RSIDE_AREA,_onColumnWidthChanged:function(){this._refreshLayout()},_refreshLayout:function(){var t=this.dimensionModel,e=t.get("rsideWidth"),i=t.get("lsideWidth");i>0&&!t.isDivisionBorderDoubled()&&(e+=s, -i-=s),this.$el.css({width:e,marginLeft:i})},_resetScrollBorderHeight:function(){var t,e;this.$scrollBorder&&(t=this.dimensionModel,e=t.get("bodyHeight")-t.getScrollXHeight(),this.$scrollBorder.height(e))},beforeRender:function(){this.$el.css("display","block"),this._refreshLayout()},afterRender:function(){var t,e,i,n,s=this.dimensionModel;s.get("scrollY")&&(n=s.get("headerHeight"),t=$("
").addClass(o.SCROLLBAR_HEAD),e=$("
").addClass(o.SCROLLBAR_BORDER),t.height(n-2),e.css("top",n+"px"),this.$el.append(t,e),s.get("scrollX")&&(i=$("
").addClass(o.SCROLLBAR_RIGHT_BOTTOM).css("bottom",s.get("toolbarHeight")),this.$el.append(i)),this.$scrollBorder=e,this._resetScrollBorderHeight())}});e.exports=a},{"../../common/classNameConst":8,"../../common/constMap":9,"./frame":54}],54:[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).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged)},render:function(){var t=this.viewFactory;return this.$el.empty(),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}],55:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap"),a=t("../../common/classNameConst"),l=10,r=s.attrName.COLUMN_NAME,u=s.dimension.CELL_BORDER_WIDTH,d=s.dimension.TABLE_BORDER_WIDTH,c=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({renderModel:t.renderModel,dimensionModel:t.dimensionModel,selectionModel:t.selectionModel,focusModel:t.focusModel,columnModel:t.columnModel,dataModel:t.dataModel,viewFactory:t.viewFactory,timeoutForAllChecked:0,whichSide:t.whichSide||"R"}),this.listenTo(this.renderModel,"change:scrollLeft",this._onScrollLeftChange).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged).listenTo(this.selectionModel,"change:range",this._refreshSelectedHeaders).listenTo(this.focusModel,"change:columnName",this._refreshSelectedHeaders).listenTo(this.dataModel,"change:_button",this._onCheckCountChange).listenTo(this.dataModel,"sortChanged",this._updateBtnSortState)},className:a.HEAD_AREA,events:{click:"_onClick","mousedown th":"_onMouseDown"},template:_.template('<%=colGroup%><%=tBody%>
'),templateHeader:_.template('="<%=columnName%>" class="<%=className%>" height="<%=height%>" <%if(colspan > 0) {%>colspan=<%=colspan%> <%}%><%if(rowspan > 0) {%>rowspan=<%=rowspan%> <%}%>><%=title%><%=btnSort%>'),templateCol:_.template('="<%=columnName%>" style="width:<%=width%>px">'),markupBtnSort:'',_getColGroupMarkup:function(){var t=this._getColumnData(),e=t.widthList,i=t.modelList,n=[];return _.each(e,function(t,e){n.push(this.templateCol({attrColumnName:r,columnName:i[e].columnName,width:t+u}))},this),n.join("")},_getSelectedColumnNames:function(){var t=this.selectionModel.get("range").column,e=this.columnModel.getVisibleColumnModelList(),i=e.slice(t[0],t[1]+1);return _.pluck(i,"columnName")},_getContainingMergedColumnNames:function(t){var e=this.columnModel,i=_.pluck(e.get("columnMerge"),"columnName");return _.filter(i,function(i){var n=e.getUnitColumnNamesIfMerged(i);return _.every(n,function(e){return _.contains(t,e)})})},_refreshSelectedHeaders:function(){var t,e,i=this.$el.find("th");this.selectionModel.hasSelection()?t=this._getSelectedColumnNames():this.focusModel.has(!0)&&(t=[this.focusModel.get("columnName")]),i.removeClass(a.CELL_SELECTED),t&&(e=this._getContainingMergedColumnNames(t),_.each(t.concat(e),function(t){i.filter("["+r+"="+t+"]").addClass(a.CELL_SELECTED)}))},_onMouseDown:function(t){var e,i;this.selectionModel.isEnabled()&&!$(t.target).is("a."+a.BTN_SORT)&&(e=$(t.target).closest("th").attr(r),e&&(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(r);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){return _.some(t,function(t){return o.isMetaColumn(t)})},_onSelectStart:function(t){return t.preventDefault(),!1},_onCheckCountChange:function(){"checkbox"===this.columnModel.get("selectType")&&(clearTimeout(this.timeoutForAllChecked),this.timeoutForAllChecked=setTimeout($.proxy(this._syncCheckState,this),l))},_getHeaderMainCheckbox:function(){return this.$el.find("th["+r+"=_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+u)})},_onScrollLeftChange:function(t,e){"R"===this.whichSide&&(this.el.scrollLeft=e)},_onClick:function(t){var e=$(t.target),i=e.closest("th").attr(r);"_button"===i&&e.is("input")?e.prop("checked")?this.dataModel.checkAll():this.dataModel.uncheckAll():e.is("a."+a.BTN_SORT)&&this.dataModel.sortByField(i)},_updateBtnSortState:function(t){this._$currentSortBtn&&this._$currentSortBtn.removeClass(a.BTN_SORT_DOWN+" "+a.BTN_SORT_UP),this._$currentSortBtn=this.$el.find("th["+r+"="+t.columnName+"] a."+a.BTN_SORT),this._$currentSortBtn.addClass(t.isAscending?a.BTN_SORT_UP:a.BTN_SORT_DOWN)},render:function(){return this._destroyChildren(),"R"!==this.whichSide||this.dimensionModel.get("scrollY")||this.$el.addClass(a.NO_SCROLL_Y),this.$el.css({height:this.dimensionModel.get("headerHeight")-d}).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"),l=new Array(n),u=new Array(n),d=[],c=o.getRowHeight(n,s)-1,h=1;return _.each(i,function(e,o){var m=i[o].length,g=0;_.each(e,function(e,i){var o=e.columnName,f=[a.CELL,a.CELL_HEAD];e.isRequired&&f.push(a.CELL_REQRUIRED),h=m-1===i&&n-m+1>1?n-m+1:1,t=c*h,i===m-1?t=s-g-2:g+=t+1,u[i]===o?(l[i].pop(),d[i]+=1):d[i]=1,u[i]=o,l[i]=l[i]||[],l[i].push(this.templateHeader({attrColumnName:r,columnName:o,className:f.join(" "),height:t,colspan:d[i],rowspan:h,title:e.title,btnSort:e.isSortable?this.markupBtnSort:""}))},this)},this),e=_.map(l,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=c},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],56:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/constMap").attrName,s=t("../../common/classNameConst"),a=t("../../common/constMap").dimension.CELL_BORDER_WIDTH,l=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)},className:s.COLUMN_RESIZE_CONTAINER,events:function(){var t={};return t["mousedown ."+s.COLUMN_RESIZE_HANDLE]="_onMouseDown",t["dblclick ."+s.COLUMN_RESIZE_HANDLE]="_onDblClick",t},template:_.template("
'),_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=this._getColumnData(),e=t.modelList,i=this.dimensionModel.get("headerHeight"),n=e.length,o=_.map(e,function(t,e){return this.template({lastClass:e+1===n?s.COLUMN_RESIZE_HANDLE_LAST:"",columnIndex:e,columnName:t.columnName,height:i})},this);return o.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=this._getColumnData(),e=t.widthList,i=this.$el.find("."+s.COLUMN_RESIZE_HANDLE),n=0;tui.util.forEachArray(i,function(t,o){var s=i.eq(o),l=Math.ceil(s.width()/2);n+=e[o]+a,s.css("left",n-l)})},_isResizing:function(){return!!this.isResizing},_onMouseDown:function(t){this._startResizing($(t.target))},_onDblClick:function(t){var e=$(t.target),i=parseInt(e.attr(o.COLUMN_INDEX),10);this.dimensionModel.restoreColumnWidth(this._getHandlerColumnIndex(i)),this._refreshHandlerPosition()},_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(o.COLUMN_INDEX),10),this.$target.css("left",e),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;this.isResizing=!0,this.$target=t,this.initialLeft=parseInt(t.css("left").replace("px",""),10),this.initialOffsetLeft=this.$el.offset().left,this.initialWidth=i[t.attr(o.COLUMN_INDEX)],$("body").css("cursor","col-resize"),$(document).bind("mousemove",$.proxy(this._onMouseMove,this)).bind("mouseup",$.proxy(this._onMouseUp,this)),t[0].setCapture&&t[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=l},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9}],57:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/classNameConst"),s=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.toolbarModel=t.toolbarModel,this.dimensionModel=t.dimensionModel,this.viewFactory=t.viewFactory},className:o.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=s},{"../../base/view":7,"../../common/classNameConst":8}],58:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=t("../../../common/classNameConst"),s=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:function(){var t={};return t["click ."+o.BTN_EXCEL]="_onClickExcel",t},className:o.TOOLBAR_BTN_HOLDER,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(o.BTN_EXCEL_PAGE)?n.download("excel"):e.hasClass(o.BTN_EXCEL_ALL)&&n.download("excelAll"))},render:function(){var t=this.toolbarModel;return this.$el.empty(),t.get("isExcelButtonVisible")&&this.$el.append(this.templateExcelBtn({className:o.BTN_EXCEL_PAGE,text:"엑셀 다운로드"})),t.get("isExcelAllButtonVisible")&&this.$el.append(this.templateExcelBtn({className:o.BTN_EXCEL_ALL,text:"전체 엑셀 다운로드"})),this}});e.exports=s},{"../../../base/view":7,"../../../common/classNameConst":8}],59:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=t("../../../common/classNameConst"),s=n.extend({initialize:function(t){this.toolbarModel=t.toolbarModel},className:o.PAGINATION,htmlString:'FirstPrev NextLastFirst OffPrev OffNext OffLast Off',render:function(){return this._destroyChildren(),this.$el.empty().html(this.htmlString),this._setPaginationInstance(),this},_setPaginationInstance:function(){var t=tui&&tui.component&&tui.component.Pagination,e=this.toolbarModel.get("pagination");!e&&t&&(e=new t({classPrefix:o.PREFIX,itemCount:1,itemPerPage:1,pagePerPageList:5,isCenterAlign:!0,moveUnit:"page",$preOff:this.$el.find("."+o.PAGINATION_PRE_OFF),$pre_endOff:this.$el.find("."+o.PAGINATION_PRE_END_OFF),$nextOff:this.$el.find("."+o.PAGINATION_NEXT_OFF),$lastOff:this.$el.find("."+o.PAGINATION_NEXT_END_OFF)},this.$el)),this.toolbarModel.set("pagination",e)}});e.exports=s},{"../../../base/view":7,"../../../common/classNameConst":8}],60:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=t("../../../common/classNameConst"),s=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.timeoutIdForResize=0},className:o.HEIGHT_RESIZE_BAR,htmlString:'',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.htmlString),this},destroy:function(){this.stopListening(),this._onMouseUp(),this._destroyChildren(),this.remove()}});e.exports=s},{"../../../base/view":7,"../../../common/classNameConst":8}],61:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=n.extend({initialize:function(t){var e=t.focusModel,i=t.renderModel,n=t.selectionModel,o=t.whichSide||"R";this.setOwnProperties({whichSide:o,bodyTableView:t.bodyTableView,focusModel:e,renderModel:i,selectionModel:n,dataModel:t.dataModel,columnModel:t.columnModel,collection:i.getCollection(o),painterManager:t.painterManager,sortOptions:null,renderedRowKeys:null}),this.listenTo(this.collection,"change",this._onModelChange).listenTo(this.collection,"restore",this._onModelRestore).listenTo(e,"change:rowKey",this._refreshFocusedRow).listenTo(i,"rowListChanged",this.render),"L"===this.whichSide&&this.listenTo(e,"change:rowKey",this._refreshSelectedMetaColumns).listenTo(n,"change:range",this._refreshSelectedMetaColumns).listenTo(i,"rowListChanged",this._refreshSelectedMetaColumns)},_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(l.isInnerHtmlOfTbodyReadOnly)t=this.bodyTableView.redrawTable(e),this.setElement(t,!1),o.isBrowserIE7()&&t.width(t.width());else try{this.$el[0].innerHTML=e}catch(i){l.isInnerHtmlOfTbodyReadOnly=!0,this._resetRows()}},_getRowsHtml:function(t){var e=this.painterManager.getRowPainter(),i=_.pluck(this._getColumnModelList(),"columnName");return _.map(t,function(t){return e.generateHtml(t,i)}).join("")},_getRowElement:function(t){return this.$el.find("tr["+s.ROW_KEY+"="+t+"]")},_refreshSelectedMetaColumns:function(){var t,e=this.$el.find("tr"),i="."+a.CELL_HEAD;t=this.selectionModel.hasSelection()?this._filterRowsByIndexRange(e,this.selectionModel.get("range").row):this._filterRowByKey(e,this.focusModel.get("rowKey")),e.find(i).removeClass(a.CELL_SELECTED),t.find(i).addClass(a.CELL_SELECTED)},_filterRowsByIndexRange:function(t,e){var i,n,o=this.renderModel,s=o.get("startIndex");return i=Math.max(e[0]-s,0),n=Math.max(e[1]-s+1,0),i||n?t.slice(i,n):$()},_filterRowByKey:function(t,e){var i=this.dataModel.indexOfRowKey(e),n=this.renderModel.get("startIndex");return n>i?$():t.eq(i-n)},_refreshFocusedRow:function(){var t=this.focusModel.get("rowKey"),e=this.focusModel.get("prevRowKey");this._setFocusedRowClass(e,!1),this._setFocusedRowClass(t,!0)},_setFocusedRowClass:function(t,e){var i=_.pluck(this._getColumnModelList(),"columnName"),n={};_.each(i,function(i){var o,l=this.dataModel.getMainRowKey(t,i);n[l]||(n[l]=this._getRowElement(l)),o=n[l].find("td["+s.COLUMN_NAME+"="+i+"]"),o.toggleClass(a.CELL_CURRENT_ROW,e)},this)},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},_onModelChange:function(t){var e=this._getRowElement(t.get("rowKey"));this.painterManager.getRowPainter().refresh(t.changed,e)},_onModelRestore:function(t){var e=this.dataModel.getElement(t.rowKey,t.columnName),i=this.columnModel.getEditType(t.columnName);this.painterManager.getCellPainter(i).refresh(t,e)}},{isInnerHtmlOfTbodyReadOnly:tui.util.browser.msie&&tui.util.browser.version<=9});e.exports=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],62:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/classNameConst"),a=t("../common/constMap").dimension.CELL_BORDER_WIDTH,l=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)},className:s.LAYER_SELECTION,_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),n=o.getHeight(t[1]-t[0]+1,e)-a;return{top:i+"px",height:n+"px"}},_getHorizontalStyles:function(t){var e=this.columnWidthList,i=this.columnModel.getVisibleMetaColumnCount(),n=t[0],o=t[1],s=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?s+=e[r]+a:l+=e[r]+a;return l-=a,{left:s+"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=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],63:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").renderState,s=t("../common/classNameConst"),a=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.renderModel=t.renderModel,this.timeoutIdForDelay=null,this.listenTo(this.dimensionModel,"change",this._refreshLayout),this.listenTo(this.renderModel,"change:state",this.render)},className:s.LAYER_STATE,template:_.template('
<%= text %> <% if (isLoading) { %>
<% } %>
'),render:function(){var t=this.renderModel.get("state");return t===o.DONE?this.$el.hide():this._showLayer(t),this},_showLayer:function(t){var e=this.template({text:this._getMessage(t),isLoading:t===o.LOADING});this.$el.html(e).show(),this._refreshLayout()},_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=a},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}]},{},[14]); \ 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 d=new Error("Cannot find module '"+a+"'");throw d.code="MODULE_NOT_FOUND",d}var u=i[a]={exports:{}};e[a][0].call(u.exports,function(t){var i=e[a][1][t];return o(i?i:t)},u,u.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=new l(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=new l({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=new l({httpStatus:n,requestType:e.requestType,requestParameter:e.data,responseData:null});this.renderModel.set("state",r.DONE),this.trigger("response",o),o.isStopped()||(this.trigger("errorResponse",o),o.isStopped()||i.readyState>1&&alert("데이터 요청 중에 에러가 발생하였습니다.\n\n다시 시도하여 주시기 바랍니다."))}});e.exports=u},{"../base/view":7,"../common/constMap":9,"../common/formUtil":10,"../common/gridEvent":11,"../common/util":12,"./net-router":1}],3:[function(t,e,i){"use strict";var n=t("./common"),o=Backbone.Collection.extend({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({});_.assign(o.prototype,n),e.exports=o},{"./common":4}],6:[function(t,e,i){"use strict";var n=t("../common/constMap").attrName,o=tui.util.defineClass({init:function(t){this.controller=t.controller},events:{},selector:"",_getCellAddress:function(t){var e=t.closest("["+n.ROW_KEY+"]");return{rowKey:e.attr(n.ROW_KEY),columnName:e.attr(n.COLUMN_NAME)}},attachEventHandlers:function(t,e){_.each(this.events,function(i,n){var o=_.bind(this[i],this),s=e+" "+this.selector;t.on(n,s,o)},this)},generateHtml:function(){throw new Error("implement generateHtml() method")}});e.exports=o},{"../common/constMap":9}],7:[function(t,e,i){"use strict";var n=t("./common"),o=Backbone.View.extend({initialize:function(){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,_.compact(t))},_renderChildren:function(){var t=_.map(this._children,function(t){return t.render().el});return t},destroy:function(){this.stopListening(),this._destroyChildren(),this.remove()},_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="tui-grid-",o={CONTAINER:"container",CLIPBOARD:"clipboard",NO_SCROLL_X:"no-scroll-x",NO_SCROLL_Y:"no-scroll-y",ICO_ARROW:"icon-arrow",ICO_ARROW_LEFT:"icon-arrow-left",ICO_ARROW_RIGHT:"icon-arrow-right",LAYER_STATE:"layer-state",LAYER_STATE_CONTENT:"layer-state-content",LAYER_STATE_LOADING:"layer-state-loading",LAYER_EDITING:"layer-editing",LAYER_FOCUS:"layer-focus",LAYER_FOCUS_BORDER:"layer-focus-border",LAYER_SELECTION:"layer-selection",LAYER_DATE_PICKER:"layer-datepicker",BORDER_LINE:"border-line",BORDER_TOP:"border-line-top",BORDER_LEFT:"border-line-left",BORDER_RIGHT:"border-line-right",BORDER_BOTTOM:"border-line-bottom",CONTENT_AREA:"content-area",LSIDE_AREA:"lside-area",RSIDE_AREA:"rside-area",HEAD_AREA:"head-area",BODY_AREA:"body-area",COLUMN_RESIZE_CONTAINER:"column-resize-container",COLUMN_RESIZE_HANDLE:"column-resize-handle",COLUMN_RESIZE_HANDLE_LAST:"column-resize-handle-last",BODY_CONTAINER:"body-container",BODY_TABLE_CONTAINER:"table-container",SCROLLBAR_HEAD:"scrollbar-head",SCROLLBAR_BORDER:"scrollbar-border",SCROLLBAR_RIGHT_BOTTOM:"scrollbar-right-bottom",SCROLLBAR_LEFT_BOTTOM:"scrollbar-left-bottom",PAGINATION:"pagination",PAGINATION_PRE:"pre",PAGINATION_PRE_OFF:"pre-off",PAGINATION_PRE_END:"pre-end",PAGINATION_PRE_END_OFF:"pre-end-off",PAGINATION_NEXT:"next",PAGINATION_NEXT_OFF:"next-off",PAGINATION_NEXT_END:"next-end",PAGINATION_NEXT_END_OFF:"next-end-off",TABLE:"table",CELL:"cell",CELL_HEAD:"cell-head",CELL_ROW_ODD:"cell-row-odd",CELL_ROW_EVEN:"cell-row-even",CELL_EDITABLE:"cell-editable",CELL_DUMMY:"cell-dummy",CELL_REQUIRED:"cell-required",CELL_DISABLED:"cell-disabled",CELL_SELECTED:"cell-selected",CELL_INVALID:"cell-invalid",CELL_ELLIPSIS:"cell-ellipsis",CELL_CURRENT_ROW:"cell-current-row",CELL_MAIN_BUTTON:"cell-main-button",CELL_CONTENT:"cell-content",CELL_CONTENT_BEFORE:"content-before",CELL_CONTENT_AFTER:"content-after",CELL_CONTENT_INPUT:"content-input",BTN_TEXT:"btn-text",BTN_SORT:"btn-sorting",BTN_SORT_UP:"btn-sorting-up",BTN_SORT_DOWN:"btn-sorting-down",BTN_EXCEL:"btn-excel-download",BTN_EXCEL_ICON:"btn-excel-icon",BTN_EXCEL_PAGE:"btn-excel-page",BTN_EXCEL_ALL:"btn-excel-all",TOOLBAR:"toolbar",TOOLBAR_BTN_HOLDER:"toolbar-btn-holder",HEIGHT_RESIZE_BAR:"height-resize-bar",HEIGHT_RESIZE_HANDLE:"height-resize-handle",CALENDAR:"calendar",CALENDAR_BTN_PREV_YEAR:"calendar-btn-prev-year",CALENDAR_BTN_NEXT_YEAR:"calendar-btn-next-year",CALENDAR_BTN_PREV_MONTH:"calendar-btn-prev-month",CALENDAR_BTN_NEXT_MONTH:"calendar-btn-next-month",CALENDAR_SELECTABLE:"calendar-selectable",CALENDAR_SELECTED:"calendar-selected"},i=_.mapObject(o,function(t){return n+t});i.PREFIX=n,e.exports=i},{}],9:[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},attrName:{ROW_KEY:"data-row-key",COLUMN_NAME:"data-column-name",COLUMN_INDEX:"data-column-index",EDIT_TYPE:"data-edit-type",GRID_ID:"data-grid-id"},themeName:{DEFAULT:"default",STRIPED:"striped",CLEAN:"clean"},selectionType:{CELL:"CELL",ROW:"ROW",COLUMN:"COLUMN"}}},{}],10:[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);t.selectedIndex=_.findIndex(i,function(t){return t.value===e||t.text===e})},"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")[String(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},{}],11:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){this._stopped=!1,this.setData(t)},setData:function(t){_.extend(this,t)},stop:function(){this._stopped=!0},isStopped:function(){return this._stopped}});e.exports=n},{}],12:[function(t,e,i){"use strict";var n=t("./constMap").dimension.CELL_BORDER_WIDTH,o={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+n)},getDisplayRowCount:function(t,e){return Math.ceil(t/(e+n))},getRowHeight:function(t,e){return 0===t?0:Math.floor((e-n)/t)},isMetaColumn:function(t){return _.contains(["_button","_number"],t)},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},isBlank:function(t){return _.isString(t)?!t.length:_.isUndefined(t)||_.isNull(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},toString:function(t){return _.isUndefined(t)||_.isNull(t)?"":String(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=JSON.stringify(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=JSON.parse(n)}catch(s){}_.isNull(n)||(i[e]=n)}),i},convertValueType:function(t,e){return"string"===e?String(t):"number"===e?Number(t):"boolean"===e?Boolean(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},appendStyleElement:function(t,e){var i=document.createElement("style");i.type="text/css",i.id=t,i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e)),document.getElementsByTagName("head")[0].appendChild(i)}};e.exports=o},{"./constMap":9}],13:[function(t,e,i){"use strict";var n=t("./common/constMap").attrName,o=tui.util.defineClass({init:function(t){this.$el=t},getElement:function(t,e){return this.$el.find("tr["+n.ROW_KEY+"="+t+"]").find("td["+n.COLUMN_NAME+"="+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=o},{"./common/constMap":9}],14:[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"),d=t("./painter/controller"),u=t("./addon/net"),c=t("./common/util"),h=t("./theme/manager"),m=t("./common/constMap").themeName,g={};tui=window.tui=tui||{},tui.Grid=n.extend({initialize:function(t){var e=new a(this.$el);this.id=c.getUniqueKey(),this.modelManager=this._createModelManager(t,e),this.painterManager=this._createPainterManager(),this.container=this._createContainerView(t,e),this.publicEventEmitter=this._createPublicEventEmitter(),this.container.render(),this.refreshLayout(),h.isApplied()||h.apply(m.DEFAULT),this.addOn={},g[this.id]=this},_createModelManager:function(t,e){var i=_.assign({},t,{gridId:this.id});return _.omit(i,"el","singleClickEdit"),new o(i,e)},_createPainterManager:function(){var t=new d({focusModel:this.modelManager.focusModel,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,selectionModel:this.modelManager.selectionModel});return new r({gridId:this.id,selectType:this.modelManager.columnModel.get("selectType"),controller:t})},_createContainerView:function(t,e){var i=new s({modelManager:this.modelManager,painterManager:this.painterManager,domState:e});return i.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?JSON.stringify(i):i},getCheckedRowList:function(t){var e=this.modelManager.dataModel.getRowList(!0);return t?JSON.stringify(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){var e=this.modelManager.columnModel.at(0,!0);this.modelManager.focusModel.focus(t,e.columnName)},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,e){this.modelManager.dataModel.sortByField(t,e)},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 g[t]},tui.Grid.applyTheme=function(t,e){h.apply(t,e)}},{"./addon/net":2,"./base/view":7,"./common/constMap":9,"./common/util":12,"./domState":13,"./model/manager":21,"./painter/controller":29,"./painter/manager":36,"./publicEventEmitter":38,"./theme/manager":40,"./view/factory":49}],15:[function(t,e,i){"use strict";var n=t("../../base/model"),o=t("../../common/util"),s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.textType={normal:!0,text:!0,password:!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,align:"center",editOption:{type:"mainButton"},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&&ea;a+=1)s=t[a],s[u]=l[u],s._extraData=s._extraData||{},n(s,u,{count:o,isMainRow:!1,mainRowKey:d}),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=_.isUndefined(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?JSON.stringify(n):n},getRowDataAt:function(t,e){var i=this.at(t),n=i?i.toJSON():null;return e?JSON.stringify(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?JSON.stringify(i):i},setColumnValues:function(t,e,i,n){var o={},s={isDisabled:!1,isEditable:!0};o[t]=e,i=_.isUndefined(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=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?JSON.stringify(t)!==JSON.stringify(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},replaceRowList:function(t,e,i){t||(t=[]),_.isUndefined(e)&&(e=!0),this.trigger("beforeReset",t.length),this.lastRowKey=-1,this.reset(t,{parse:e}),_.isFunction(i)&&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","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),d=this.columnModel,u={};for(r||(r=this.append({})[0]),o=i;n>=o;o+=1)s=d.at(o,!0).columnName,a=r.getCellState(s),l=r.getRowSpanData(s),a.isEditable&&!a.isDisabled&&(!l||l.count>=0)&&(u[s]=t[o-i]);r.set(u)},getElement:function(t,e){var i=this.getMainRowKey(t,e);return this.domState.getElement(i,e)}});e.exports=s},{"../../base/collection":3,"./row":17}],19:[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=t+1+(this.isDivisionBorderDoubled()?1:0),n=i*l,o=e-this.getScrollYWidth()-n;return o},_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;this.set("totalRowHeight",o.getHeight(e,t))},_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}),i.length&&(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=this.columnModel.getVisibleColumnModelList(null,!0),e=this.get("minimumColumnWidth"),i=[],n=[],s=[];_.each(t,function(t){var a=t.width>0?t.width:0,l=Math.max(a,e);o.isMetaColumn(t.columnName)&&(l=a),i.push(a?l:0),s.push(l),n.push(!!t.isFixedWidth)},this),this._columnWidthFixedFlags=n,this._minColumnWidthList=s,this._setColumnWidthVariables(this._calculateColumnWidth(i),!0)},_calculateColumnWidth:function(t){return t=this._fillEmptyColumnWidth(t),t=this._applyMinimumColumnWidth(t),t=this._adjustColumnWidthList(t)},isDivisionBorderDoubled:function(){return this.columnModel.getVisibleColumnFixCount()>0},getFrameWidth:function(t){var e=this.columnModel.getVisibleColumnFixCount(!0),i=this.getColumnWidthList(t),n=this._getFrameWidth(i);return _.isUndefined(t)&&e>0&&(n+=l),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},_getCellHorizontalPosition:function(t){for(var e=this.columnModel,i=e.getVisibleMetaColumnCount(),n=this.get("columnWidthList"),o=e.getVisibleColumnFixCount()+i,s=e.indexOfColumnName(t,!0)+i,a=o>s?0:o,r=0;s>a;a+=1)r+=n[a]+l;return{left:r,right:r+n[s]+l}},_getCellVerticalPosition:function(t,e){var i=this.dataModel,n=this.get("rowHeight"),s=i.indexOfRowKey(t),a=o.getHeight(s,n),l=o.getHeight(e,n);return{top:a,bottom:a+l}},_getRowSpanCount:function(t,e){var i=this.dataModel.get(t).getRowSpanData(e);return i.isMainRow||(t=i.mainRowKey,i=this.dataModel.get(t).getRowSpanData(e)),i.count||1},getCellPosition:function(t,e){var i,n,o;return t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t)?(i=this._getRowSpanCount(t,e),n=this._getCellVerticalPosition(t,i),o=this._getCellHorizontalPosition(e),{top:n.top,bottom:n.bottom,left:o.left,right:o.right}):{}},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"),d=l.get("scrollLeft");return n=t.topr+i.height,e?(s=t.leftd+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(),r=0;return s&&(o+=this.renderModel.get("scrollLeft")),o>=n?r=i.length-1:tui.util.forEachArray(i,function(t,e){return t+=l,r=e,o>t?void(o-=t):!1}),Math.max(0,r-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":9,"../common/util":12}],20:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=t("../common/gridEvent"),a=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.domState=e.domState,this.listenTo(this.dataModel,"reset",this._onResetData)},defaults:{rowKey:null,columnName:"",prevRowKey:null,prevColumnName:"",editingAddress:null},_onResetData:function(){this.unselect(!0)},_savePrevious:function(){null!==this.get("rowKey")&&this.set("prevRowKey",this.get("rowKey")),this.get("columnName")&&this.set("prevColumnName",this.get("columnName"))},_clearPrevious:function(){this.set({prevRowKey:null,prevColumnName:""})},isCurrentCell:function(t,e,i){var n=this.get("columnName"),o=this.get("rowKey");return i&&(o=this.dataModel.getMainRowKey(o,n)),String(o)===String(t)&&n===e},select:function(t){var e=new s,i=this.get("rowKey");return String(i)===String(t)?!0:(e.setData({rowKey:t,prevRowKey:i,rowData:this.dataModel.getRowData(t)}),this.trigger("select",e),e.isStopped()?(this._cancelSelect(),!1):(this.set("rowKey",t),"radio"===this.columnModel.get("selectType")&&this.dataModel.check(t),!0))},_cancelSelect:function(){var t=this.get("prevColumnName");this.set("columnName",t),this.trigger("focus",this.get("rowKey"),t)},unselect:function(t){t&&this.blur(),this.set({rowKey:null})},focus:function(t,e,i){return!this._isValidCell(t,e)||o.isMetaColumn(e)||this.isCurrentCell(t,e)?!0:(this.blur(),this.select(t)?(this.set("columnName",e),this.trigger("focus",t,e),i&&this.scrollToFocus(),!0):!1)},focusAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0),s=!1;return n&&o&&(s=this.focus(n.get("rowKey"),o.columnName,i)),s},focusIn:function(t,e,i){var n=this.focus(t,e,i);return n&&(t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t).isEditable(e)?(this.finishEditing(),this.startEditing(t,e)):this.focusClipboard()),n},focusInAt:function(t,e,i){var n=this.dataModel.at(t),o=this.columnModel.at(e,!0),s=!1;return n&&o&&(s=this.focusIn(n.get("rowKey"),o.columnName,i)),s},focusClipboard:function(){this.trigger("focusClipboard")},refreshState:function(){var t;this.domState.hasFocusedElement()?this.has()||(t=this.restore(),t||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(){var t=this.get("columnName");return this.has()?(this.has(!0)&&this._savePrevious(),null!==this.get("rowKey")&&this.set("columnName",""),this.trigger("blur",this.get("rowKey"),t),this):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(t){var e=this.get("rowKey"),i=this.get("columnName");return t?this._isValidCell(e,i):!o.isBlank(e)&&!o.isBlank(i)},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},isEditingCell:function(t,e){var i=this.get("editingAddress");return i&&String(i.rowKey)===String(t)&&i.columnName===e},startEditing:function(t,e){if(this.get("editingAddress"))return!1;if(_.isUndefined(t)&&_.isUndefined(e))t=this.get("rowKey"),e=this.get("columnName");else if(!this.isCurrentCell(t,e,!0))return!1;return t=this.dataModel.getMainRowKey(t,e),this.dataModel.get(t).isEditable(e)?(this.set("editingAddress",{rowKey:t,columnName:e}),!0):!1},finishEditing:function(){return this.get("editingAddress")?(this.set("editingAddress",null),!0):!1},_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,o=null;return this.has(!0)&&(e=Math.max(Math.min(n.indexOfRowKey(this.get("rowKey"))+t,this.dataModel.length-1),0),i=n.at(e),i&&(o=i.get("rowKey"))),o},_findColumnName:function(t){var e,i=this.columnModel,n=i.getVisibleColumnModelList(),o=i.indexOfColumnName(this.get("columnName"),!0),s=null;return this.has(!0)&&(e=Math.max(Math.min(o+t,n.length-1),0),s=n[e]&&n[e].columnName),s},_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=a},{"../base/model":5,"../common/gridEvent":11,"../common/util":12}],21:[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"),d=t("./renderer-smart"),u=t("./selection"),c={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}},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.focusModel=this._createFocusModel(e),this.renderModel=this._createRenderModel(t),this.selectionModel=this._createSelectionModel(),this.focusModel.renderModel=this.renderModel,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 u(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,focusModel:this.focusModel},new(n=t.notUseSmartRendering?r:d)(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},{"./data/columnModel":15,"./data/rowList":18,"./dimension":19,"./focus":20,"./renderer":23, +"./renderer-smart":22,"./selection":26,"./toolbar":27}],22:[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),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"),d=this.get("endIndex");return 0!==r&&r+this.criticalPoint>a?!0:d!==s-1&&d-this.criticalPointa&&this.set("state",s.LOADING)},_onEditingAddressChange:function(t,e){var i=e,n=!0,o=this;e||(i=t.previous("editingAddress"),n=!1),this._updateCellData(i.rowKey,i.columnName,{isEditing:n}),this._triggerEditingStateChanged(i.rowKey,i.columnName),_.defer(function(){o._toggleChangeLayoutEventHandlers(n)})},_toggleChangeLayoutEventHandlers:function(t){var e="change:scrollTop change:scrollLeft",i="columnWidthChanged";t?(this.listenToOnce(this.dimensionModel,i,this._onChangeLayoutBound),this.once(e,this._onChangeLayoutBound)):(this.stopListening(this.dimensionModel,i,this._onChangeLayoutBound),this.off(e,this._onChangeLayoutBound))},_triggerEditingStateChanged:function(t,e){var i=this.getCellData(t,e);tui.util.pick(i,"columnModel","editOption","useViewMode")!==!1&&this.trigger("editingStateChanged",i)},_updateCellData:function(t,e,i){var n=this._getRowModel(t,e);n&&n.setCell(e,i)},initializeVariables:function(){this.set({top:0,scrollTop:0,scrollLeft:0,startIndex:0,endIndex:0,startNumber:1})},getCollection:function(t){return this.get(tui.util.isString(t)?t.toLowerCase()+"side":"rside")},_onColumnModelChange:function(){this.set({scrollTop:0,top:0,startIndex:0,endIndex:0}),this.refresh({columnModelChanged:!0})},_onDataModelChange:function(){this.refresh({dataModelChanged:!0})},_onAddDataModel:function(t,e){this.refresh({dataModelChanged:!0}),e.focus&&this.focusModel.focusAt(e.at,0)},_resetDummyRows:function(){this._clearDummyRows(),this._fillDummyRows(),this.trigger("dataModelChanged")},_setRenderingRange:function(){this.set({startIndex:0,endIndex:this.dataModel.length-1})},_createViewDataFromDataModel:function(t,e,i,n){var o={height:i,rowNum:n,rowKey:t.get("rowKey"),_extraData:t.get("_extraData")};return _.each(e,function(e){var i=t.get(e);"_number"===e&&(i=n),o[e]=i}),o},_getColumnNamesOfEachSide:function(){var t=this.columnModel.getVisibleColumnFixCount(!0),e=this.columnModel.getVisibleColumnModelList(null,!0),i=_.pluck(e,"columnName");return{lside:i.slice(0,t),rside:i.slice(t)}},_resetViewModelList:function(t,e){this.get(t).clear().reset(e,{parse:!0})},_resetAllViewModelListWithRange:function(t,e){var i,n,o=this._getColumnNamesOfEachSide(),s=this.get("startNumber")+t,a=this.dimensionModel.get("rowHeight"),l=[],r=[];for(n=t;e>=n;n+=1)i=this.dataModel.at(n),l.push(this._createViewDataFromDataModel(i,o.lside,a,s)),r.push(this._createViewDataFromDataModel(i,o.rside,a,s)),s+=1;this._resetViewModelList("lside",l),this._resetViewModelList("rside",r)},_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),n=this.dimensionModel.get("rowHeight"),o=this.get("endIndex")+2;_.times(i,function(){_.each(["lside","rside"],function(t){this.get(t).add({height:n,rowNum:o})},this),o+=1},this),this.set("dummyRowCount",i)},refresh:function(t){var e,i,n,o=!!t&&t.columnModelChanged,s=!!t&&t.dataModelChanged;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);o?this.trigger("columnModelChanged"):this.trigger("rowListChanged",s),this._refreshState()},_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")},_getRowModel:function(t,e){var i=this._getCollectionByColumnName(e);return i.get(t)},getCellData:function(t,e){var i=this._getRowModel(t,e),n=null;return i&&(n=i.get(e)),n},_executeRelation:function(t){var e,i,n=this.dataModel.at(t),o=t-this.get("startIndex");i=n.executeRelationCallbacksAll(),_.each(i,function(t,i){e=this._getCollectionByColumnName(i).at(o),e&&e.setCell(i,t)},this)}});e.exports=l},{"../base/model":5,"../common/constMap":9,"./rowList":25}],24:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=n.extend({initialize:function(t){var e=t&&t.rowKey,i=this.collection.dataModel,n=i.get(e);this.dataModel=i,this.columnModel=this.collection.columnModel,this.focusModel=this.collection.focusModel,n&&(this.listenTo(n,"change",this._onDataModelChange),this.listenTo(n,"restore",this._onDataModelRestore),this.listenTo(n,"extraDataChanged",this._setRowExtraData),this.listenTo(i,"disabledChanged",this._onDataModelDisabledChanged),this.rowData=n)},idAttribute:"rowKey",_onDataModelChange:function(t){_.each(t.changed,function(e,i){var n,o;this.has(i)&&(n=this.columnModel.getColumnModel(i),o=this.columnModel.isTextType(i),this.setCell(i,this._getValueAttrs(e,t,n,o)))},this)},_onDataModelRestore:function(t){var e=this.get(t);e&&this.trigger("restore",e)},_getColumnNameList:function(){var t=this.collection.columnModel.getVisibleColumnModelList(null,!0);return _.pluck(t,"columnName")},_onDataModelDisabledChanged:function(){var t=this._getColumnNameList();_.each(t,function(t){this.setCell(t,{isDisabled:this.rowData.isDisabled(t),className:this._getClassNameString(t)})},this)},_setRowExtraData:function(){tui.util.isUndefined(this.collection)||_.each(this._getColumnNameList(),function(t){var e,i=this.get(t);!tui.util.isUndefined(i)&&i.isMainRow&&(e=this.rowData.getCellState(t),this.setCell(t,{isDisabled:e.isDisabled,isEditable:e.isEditable,className:this._getClassNameString(t)}))},this)},parse:function(t,e){var i=e.collection;return this._formatData(t,i.dataModel,i.columnModel,i.focusModel)},_formatData:function(t,e,i,n){var o,s,a=t.rowKey,l=t.rowNum;return _.isUndefined(a)?t:(s=e.get(a),o=_.omit(t,"rowKey","_extraData","height","rowNum"),_.each(o,function(o,r){var d=this._getRowSpanData(r,t,e.isRowSpanEnable()),u=s.getCellState(r),c=i.isTextType(r),h=i.getColumnModel(r);t[r]={rowKey:a,rowNum:l,columnName:r,rowSpan:d.count,isMainRow:d.isMainRow,mainRowKey:d.mainRowKey,isEditable:u.isEditable,isDisabled:u.isDisabled,isEditing:n.isEditingCell(a,r),optionList:tui.util.pick(h,"editOption","list"),className:this._getClassNameString(r,s,n),columnModel:h,changed:[]},_.assign(t[r],this._getValueAttrs(o,s,h,c))},this),t)},_getClassNameString:function(t,e,i){var n;return e||(e=this.dataModel.get(this.get("rowKey")))?(i||(i=this.focusModel),n=e.getClassNameList(t),n.join(" ")):""},_getValueAttrs:function(t,e,i,n){var o=tui.util.pick(i,"editOption","beforeContent"),s=tui.util.pick(i,"editOption","afterContent"),a=tui.util.pick(i,"editOption","converter"),l=e.toJSON();return{value:this._getValueToDisplay(t,i,n),formattedValue:this._getFormattedValue(t,l,i),beforeContent:this._getExtraContent(o,t,l),afterContent:this._getExtraContent(s,t,l),convertedHTML:this._getConvertedHTML(a,t,l)}},_getFormattedValue:function(t,e,i){var n=t||"";return _.isFunction(i.formatter)&&(n=i.formatter(n,e,i)),n},_getExtraContent:function(t,e,i){var n="";return _.isFunction(t)?n=t(e,i):tui.util.isExisty(t)&&(n=t),n},_getConvertedHTML:function(t,e,i){var n=null;return _.isFunction(t)&&(n=t(e,i)),n===!1&&(n=null),n},_getValueToDisplay:function(t,e,i){var n=tui.util.isExisty,o=e.notUseHtmlEntity,s=e.defaultValue;return n(t)||(t=n(s)?s:""),i&&!o&&tui.util.hasEncodableString(t)&&(t=tui.util.encodeHTMLEntity(t)),t},_getRowSpanData:function(t,e,i){var n=tui.util.pick(e,"_extraData","rowSpanData",t);return i&&n||(n={mainRowKey:e.rowKey,count:0,isMainRow:!0}),n},updateClassName:function(t){this.setCell(t,{className:this._getClassNameString(t)})},setCell:function(t,e){var i,n,s,a=!1,l=[];this.has(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,{silent:this._shouldSetSilently(s,a)}),a&&(i=this.collection.dataModel.indexOfRowKey(n),this.trigger("valueChange",i))))},_shouldSetSilently:function(t,e){var i=t.isEditing&&e,n=tui.util.pick(t,"columnModel","editOption","useViewMode")!==!1,o=_.contains(t.changed,"isEditing")&&t.isEditing;return i||n&&o}});e.exports=s},{"../base/model":5,"../common/util":12}],25:[function(t,e,i){"use strict";var n=t("../base/collection"),o=t("./row"),s=n.extend({initialize:function(t,e){this.setOwnProperties({dataModel:e.dataModel,columnModel:e.columnModel,focusModel:e.focusModel})},model:o});e.exports=s},{"../base/collection":3,"./row":24}],26:[function(t,e,i){"use strict";var n=t("../base/model"),o=t("../common/util"),s=t("../common/constMap").selectionType,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,enabled:!0,selectionType: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)},setType:function(t){this.selectionType=s[t]||this.selectionType},getType:function(){return this.selectionType},enable:function(){this.enabled=!0},disable:function(){this.end(),this.enabled=!1},isEnabled:function(){return this.enabled},start:function(t,e,i){this.isEnabled()&&(this.setType(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.enabled||0>t||0>e||(this.hasSelection()?this.setType(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;this.selectionType===s.ROW?e=this.columnModel.getVisibleColumnModelList().length-1:this.selectionType===s.COLUMN&&(t=this.dataModel.length-1),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,this.dataModel.length-1],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.getValueString(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()&&this.selectionType===s.CELL){do n=_.assign([],i.row),i=this._getRowSpannedIndex(i),e=i.row[0]!==n[0]||i.row[1]!==n[1];while(e);this._setRangeMinMax(i.row,i.column)}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]],d=a.at(t.row[0]),u=a.at(t.row[1]),c=$.extend({},t);return d&&u?(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/constMap":9,"../common/util":12}],27:[function(t,e,i){"use strict";var n=t("../base/model"),o=n.extend({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}],28:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.editType=t.editType,this.inputPainter=t.inputPainter,this.selector="td["+s.EDIT_TYPE+"="+this.editType+"]"},events:{dblclick:"_onDblClick"},template:_.template("><%=contentHtml%>"),_onDblClick:function(t){var e;this._isEditableType()&&(e=this._getCellAddress($(t.target)),this.controller.startEditing(e,!0))},_isEditableType:function(){return!_.contains(["normal","mainButton"],this.editType)},_getContentHtml:function(t){var e=t.formattedValue,i=t.beforeContent,n=t.afterContent;return this.inputPainter&&(e=this.inputPainter.generateHtml(t),this._shouldContentBeWrapped()&&!this._isUsingViewMode(t))?(i=this._getSpanWrapContent(i,a.CELL_CONTENT_BEFORE),n=this._getSpanWrapContent(n,a.CELL_CONTENT_AFTER),e=this._getSpanWrapContent(e,a.CELL_CONTENT_INPUT),i+n+e):i+e+n},_isUsingViewMode:function(t){return tui.util.pick(t,"columnModel","editOption","useViewMode")!==!1},_shouldContentBeWrapped:function(){return _.contains(["text","password","select"],this.editType)},_getSpanWrapContent:function(t,e){return tui.util.isFalsy(t)&&(t=""),''+t+""},_getAttributes:function(t){var e=[t.className,a.CELL,a.CELL_CONTENT,t.rowNum%2?a.CELL_ROW_ODD:a.CELL_ROW_EVEN],i={align:t.columnModel.align||"left"};return i["class"]=e.join(" "),i[s.EDIT_TYPE]=this.editType,i[s.ROW_KEY]=t.rowKey,i[s.COLUMN_NAME]=t.columnName,t.rowSpan&&(i.rowspan=t.rowSpan),i},attachEventHandlers:function(t,e){n.prototype.attachEventHandlers.call(this,t,e),this.inputPainter&&this.inputPainter.attachEventHandlers(t,e+" "+this.selector)},generateHtml:function(t){var e=o.getAttributesString(this._getAttributes(t)),i=this._getContentHtml(t);return this.template({attributeString:e,contentHtml:i||"​"})},refresh:function(t,e){var i=["value","isEditing","isDisabled","optionList"],n=_.contains(t.changed,"isEditing")&&t.isEditing,o=_.intersection(i,t.changed).length>0,s=this._getAttributes(t);delete s.rowspan,e.attr(s),n&&!this._isUsingViewMode(t)?this.inputPainter.focus(e):o&&(e.html(this._getContentHtml(t)),e.scrollLeft(0))}});e.exports=l},{"../base/painter":6,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],29:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){this.focusModel=t.focusModel,this.dataModel=t.dataModel,this.columnModel=t.columnModel,this.selectionModel=t.selectionModel},startEditing:function(t,e){var i;return e&&this.focusModel.finishEditing(),i=this.focusModel.startEditing(t.rowKey,t.columnName),i&&this.selectionModel.end(),i},finishEditing:function(t,e,i){var n=this.focusModel;return n.isEditingCell(t.rowKey,t.columnName)?(this.selectionModel.enable(),_.isUndefined(i)||(this.setValue(t,i),this.dataModel.get(t.rowKey).validateCell(t.columnName)),n.finishEditing(),e?n.focusClipboard():_.defer(function(){n.refreshState()}),!0):!1},focusInToNextCell:function(t){var e=this.focusModel,i=e.get("rowKey"),n=e.get("columnName"),o=t?e.prevColumnName():e.nextColumnName();n!==o&&e.focusIn(i,o,!0)},executeCustomInputEventHandler:function(t,e){var i,n=this.columnModel.getColumnModel(e.columnName),o=t.type;"focusin"===o?o="focus":"focusout"===o&&(o="blur"),i=tui.util.pick(n,"editOption","inputEvents",o),_.isFunction(i)&&i.call(t.target,t,e)},appendEmptyRowAndFocus:function(){this.dataModel.append({},{focus:!0})},setValue:function(t,e){this.dataModel.setValue(t.rowKey,t.columnName,e)}});e.exports=n},{}],30:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},events:{dblclick:"_onDblClick"},selector:"td["+s.EDIT_TYPE+"=dummy]",template:_.template("​'),_onDblClick:function(){this.controller.appendEmptyRowAndFocus(!0)},generateHtml:function(t,e){var i=[a.CELL,a.CELL_DUMMY,t%2?a.CELL_ROW_ODD:a.CELL_ROW_EVEN];return o.isMetaColumn(e)&&i.push(a.CELL_HEAD),this.template({columnName:e,className:i.join(" ")})}});e.exports=l},{"../base/painter":6,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],31:[function(t,e,i){"use strict";var n=t("../../base/painter"),o=t("../../common/constMap").keyName,s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},events:{keydown:"_onKeyDown",focusin:"_onFocusIn",focusout:"_onFocusOut"},keyDownActions:{ESC:function(t){this.controller.finishEditing(t.address,!0)},ENTER:function(t){this.controller.finishEditing(t.address,!0,t.value)},TAB:function(t){this.controller.finishEditing(t.address,!0,t.value),this.controller.focusInToNextCell(t.shiftKey)}},_extendKeydownActions:function(t){this.keyDownActions=_.assign({},this.keyDownActions,t)},_extendEvents:function(t){this.events=_.assign({},this.events,t)},_executeCustomEventHandler:function(t){var e=$(t.target),i=this._getCellAddress(e);this.controller.executeCustomInputEventHandler(t,i)},_onFocusIn:function(t){var e=$(t.target),i=this._getCellAddress(e);this._executeCustomEventHandler(t),this.trigger("focusIn",e,i),this.controller.startEditing(i)},_onFocusOut:function(t){var e=$(t.target),i=this._getCellAddress(e);this._executeCustomEventHandler(t),this.trigger("focusOut",e,i),this.controller.finishEditing(i,!1,e.val())},_onKeyDown:function(t){var e=t.keyCode||t.which,i=o[e],n=this.keyDownActions[i],s=$(t.target),a={$target:s,address:this._getCellAddress(s),shiftKey:t.shiftKey,value:s.val()};this._executeCustomEventHandler(t),n&&(n.call(this,a),t.preventDefault())},_getDisplayValue:function(){throw new Error("implement _getDisplayValue() method")},_generateInputHtml:function(){throw new Error("implement _generateInputHtml() method")},_isUsingViewMode:function(t){return tui.util.pick(t,"columnModel","editOption","useViewMode")!==!1},generateHtml:function(t){var e;return e=_.isNull(t.convertedHTML)?!this._isUsingViewMode(t)||t.isEditing?this._generateInputHtml(t):this._getDisplayValue(t):t.convertedHTML},focus:function(t){var e=t.find(this.selector);e.is(":focus")||e.eq(0).focus()}});_.assign(s.prototype,Backbone.Events),e.exports=s},{"../../base/painter":6,"../../common/constMap":9}],32:[function(t,e,i){"use strict";var n=t("./base"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.inputType=t.inputType,this.selector="fieldset[data-type="+this.inputType+"]",this._extendEvents({mousedown:"_onMouseDown"}),this._extendKeydownActions({TAB:function(t){var e;this._focusNextInput(t.$target,t.shiftKey)||(e=this._getCheckedValueString(t.$target),this.controller.finishEditing(t.address,!0,e),this.controller.focusInToNextCell(t.shiftKey))},ENTER:function(t){var e=this._getCheckedValueString(t.$target);this.controller.finishEditing(t.address,!0,e)},LEFT_ARROW:function(t){this._focusNextInput(t.$target,!0)},RIGHT_ARROW:function(t){this._focusNextInput(t.$target)},UP_ARROW:function(){},DOWN_ARROW:function(){}})},template:_.template('
<%=content%>
'),inputTemplate:_.template(' <%=disabled%> />'),labelTemplate:_.template(''),_onFocusOut:function(t){var e=$(t.target),i=this;_.defer(function(){var t,n;e.siblings("input:focus").length||(t=i._getCellAddress(e),n=i._getCheckedValueString(e),i.controller.finishEditing(t,!1,n))})},_onMouseDown:function(t){var e=$(t.target),i=e.closest("fieldset").find("input:focus").length>0;!e.is("input")&&i&&(t.stopPropagation(),t.preventDefault())},_focusNextInput:function(t,e){var i=e?"prevAll":"nextAll",n=t[i]("input");return n.length?(n.first().focus(),!0):!1},_getCheckedValueString:function(t){var e,i=t.parent().find("input:checked"),n=[];return i.each(function(){var t=$(this),e=t.attr("data-value-type"),i=o.convertValueType(t.val(),e);n.push(i)}),e=1===n.length?n[0]:n.join(",")},_getCheckedValueSet:function(t){var e={};return _.each(String(t).split(","),function(t){e[t]=!0}),e},_getDisplayValue:function(t){var e=this._getCheckedValueSet(t.value),i=[];return _.each(t.optionList,function(t){e[t.value]&&i.push(t.text)}),i.join(",")},_generateInputHtml:function(t){var e=this._getCheckedValueSet(t.value),i=o.getUniqueKey(),n="";return _.each(t.optionList,function(o){var s=i+"_"+o.value;n+=this.inputTemplate({type:this.inputType,id:s,name:i,value:o.value,valueType:typeof o.value,checked:e[o.value]?"checked":"",disabled:t.isDisabled?"disabled":""}),o.text&&(n+=this.labelTemplate({id:s,labelText:o.text}))},this),this.template({type:this.inputType,content:n})},focus:function(t){var e=t.find("input");e.is(":focus")||e.eq(0).focus()}});e.exports=s},{"../../common/util":12,"./base":31}],33:[function(t,e,i){"use strict";var n=t("../../base/painter"),o=t("../../common/classNameConst"),s=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.selector="input."+o.CELL_MAIN_BUTTON,this.inputType=t.inputType,this.gridId=t.gridId},events:{change:"_onChange"},template:_.template(' />'),_onChange:function(t){var e=$(t.target),i=this._getCellAddress(e);this.controller.setValue(i,e.is(":checked"))},generateHtml:function(t){return this.template({type:this.inputType,name:this.gridId,checked:t.value?"checked":""})}});e.exports=s},{"../../base/painter":6,"../../common/classNameConst":8}],34:[function(t,e,i){"use strict";var n=t("./base"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(){n.apply(this,arguments),this.selector="select"},template:_.template(''),optionTemplate:_.template(''),_getDisplayValue:function(t){var e=_.find(t.optionList,function(e){return String(e.value)===String(t.value)});return e?e.text:""},_generateInputHtml:function(t){var e=_.reduce(t.optionList,function(e,i){return e+this.optionTemplate({value:i.value,text:i.text,selected:String(t.value)===String(i.value)?"selected":""})},"",this);return this.template({name:o.getUniqueKey(),disabled:t.isDisabled?"disabled":"",options:e})}});e.exports=s},{"../../common/util":12,"./base":31}],35:[function(t,e,i){"use strict";var n=t("./base"),o=t("../../common/util"),s=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.inputType=t.inputType,this.selector="input[type="+this.inputType+"]",this._extendEvents({selectstart:"_onSelectStart"})},template:_.template('/>'),_onSelectStart:function(t){t.stopPropagation()},_convertStringToAsterisks:function(t){return Array(t.length+1).join("*")},_getDisplayValue:function(t){var e=t.formattedValue;return"password"===this.inputType&&(e=this._convertStringToAsterisks(t.value)),e},_generateInputHtml:function(t){var e=tui.util.pick(t,"columnModel","editOption","maxLength");return this.template({type:this.inputType,value:t.value,name:o.getUniqueKey(),disabled:t.isDisabled?"disabled":"",maxLength:e})},focus:function(t){var e=t.find(this.selector);1!==e.length||e.is(":focus")||e.select()}});e.exports=s},{"../../common/util":12,"./base":31}],36:[function(t,e,i){"use strict";var n=t("./row"),o=t("./cell"),s=t("./dummyCell"),a=t("./input/text"),l=t("./input/select"),r=t("./input/button"),d=t("./input/mainButton"),u=tui.util.defineClass({init:function(t){this.gridId=t.gridId,this.selectType=t.selectType,this.inputPainters=this._createInputPainters(t.controller),this.cellPainters=this._createCellPainters(t.controller),this.rowPainter=this._createRowPainter()},_createInputPainters:function(t){return{text:new a({controller:t,inputType:"text"}),password:new a({controller:t,inputType:"password"}),checkbox:new r({controller:t,inputType:"checkbox"}),radio:new r({controller:t,inputType:"radio"}),select:new l({controller:t}),mainButton:new d({controller:t,inputType:this.selectType,gridId:this.gridId})}},_createCellPainters:function(t){var e={dummy:new s({controller:t}),normal:new o({controller:t,editType:"normal"})};return _.each(this.inputPainters,function(i,n){e[n]=new o({editType:n,controller:t,inputPainter:i})},this),e},_createRowPainter:function(){return new n({painterManager:this})},getCellPainter:function(t){return this.cellPainters[t]},getCellPainters:function(){return this.cellPainters},getInputPainters:function(t){var e=this.inputPainters;return t&&(e=_.omit(e,"mainButton")),e},getRowPainter:function(){return this.rowPainter}});e.exports=u},{"./cell":28,"./dummyCell":30,"./input/button":32,"./input/mainButton":33,"./input/select":34,"./input/text":35,"./row":37}],37:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap"),a=s.attrName,l=s.dimension.CELL_BORDER_WIDTH,r=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.painterManager=t.painterManager},selector:"tr",template:_.template('="<%=rowKey%>" class="<%=className%>" style="height: <%=height%>px;"><%=contents%>'), +_getEditType:function(t,e){var i=tui.util.pick(e.columnModel,"editOption","type");return i||"normal"},_generateHtmlForDummyRow:function(t,e){var i=this.painterManager.getCellPainter("dummy"),n="";return _.each(e,function(e){n+=i.generateHtml(t,e)}),n},_generateHtmlForActualRow:function(t,e){var i="";return _.each(e,function(e){var n,o,s=t.get(e);s&&s.isMainRow&&(n=this._getEditType(e,s),o=this.painterManager.getCellPainter(n),i+=o.generateHtml(s))},this),i},generateHtml:function(t,e){var i,n=t.get("rowKey"),o=t.get("rowNum"),s="";return i=_.isUndefined(n)?this._generateHtmlForDummyRow(o,e):this._generateHtmlForActualRow(t,e),this.template({rowKeyAttrName:a.ROW_KEY,rowKey:n,height:t.get("height")+r._extraHeight+l,contents:i,className:s})},refresh:function(t,e){_.each(t,function(t,i){var n,o,s;"_extraData"!==i&&(s=e.find("td["+a.COLUMN_NAME+"="+i+"]"),n=this._getEditType(i,t),o=this.painterManager.getCellPainter(n),o.refresh(t,s))},this)},"static":{_extraHeight:function(){var t=0;return o.isBrowserIE7()&&(t=-2),t}()}});e.exports=r},{"../base/painter":6,"../common/constMap":9,"../common/util":12}],38:[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},{}],39:[function(t,e,i){"use strict";var n=tui.util.defineClass({init:function(t){if(!_.isString(t)||!t)throw new Error("The Selector must be a string and not be empty.");this._selector=t,this._propValues=[]},add:function(t,e){return e&&this._propValues.push(t+":"+e),this},border:function(t){return this.add("border-color",t)},borderWidth:function(t){var e,i=t.showVerticalBorder,n=t.showHorizontalBorder;return _.isBoolean(i)&&(e=i?"1px":"0",this.add("border-left-width",e).add("border-right-width",e)),_.isBoolean(n)&&(e=n?"1px":"0",this.add("border-top-width",e).add("border-bottom-width",e)),this},bg:function(t){return this.add("background-color",t)},text:function(t){return this.add("color",t)},build:function(){var t="";return this._propValues.length&&(t=this._selector+"{"+this._propValues.join(";")+"}"),t}});e.exports={create:function(t){return new n(t)},createClassRule:function(t){return this.create("."+t)},createWebkitScrollbarRules:function(t,e){return[this.create(t+" ::-webkit-scrollbar").bg(e.background),this.create(t+" ::-webkit-scrollbar-thumb").bg(e.thumb),this.create(t+" ::-webkit-scrollbar-thumb:hover").bg(e.active)]},createIEScrollbarRule:function(t,e){var i=["scrollbar-3dlight-color","scrollbar-darkshadow-color","scrollbar-track-color","scrollbar-shadow-color"],n=["scrollbar-face-color","scrollbar-highlight-color"],o=this.create(t);return _.each(i,function(t){o.add(t,e.background)}),_.each(n,function(t){o.add(t,e.thumb)}),o.add("scrollbar-arrow-color",e.active),o},buildAll:function(t){return _.map(t,function(t){return t.build()}).join("")}}},{}],40:[function(t,e,i){"use strict";function n(t){var e=[a.grid(t.grid),a.scrollbar(t.scrollbar),a.toolbar(t.toolbar),a.selection(t.selection)],i=t.cell;return i&&(e=e.concat([a.cell(i.normal),a.cellDummy(i.dummy),a.cellEditable(i.editable),a.cellHead(i.head),a.cellOddRow(i.oddRow),a.cellEvenRow(i.evenRow),a.cellRequired(i.required),a.cellDisabled(i.disabled),a.cellInvalid(i.invalid),a.cellCurrentRow(i.currentRow),a.cellSelectedHead(i.selectedHead),a.cellFocused(i.focused)])),e.join("")}function o(t){var e=n(t);$("#"+r).remove(),s.appendStyleElement(r,e)}var s=t("../common/util"),a=t("./styleGenerator"),l=t("../common/constMap").themeName,r="tui-grid-theme-style",d={};d[l.DEFAULT]=t("./preset/default"),d[l.STRIPED]=t("./preset/striped"),d[l.CLEAN]=t("./preset/clean"),e.exports={apply:function(t,e){var i=d[t];i||(i=d[l.DEFAULT]),i=$.extend(!0,{},i,e),o(i)},isApplied:function(){return 1===$("#"+r).length}}},{"../common/constMap":9,"../common/util":12,"./preset/clean":41,"./preset/default":42,"./preset/striped":43,"./styleGenerator":44}],41:[function(t,e,i){"use strict";var n=t("./default");e.exports=$.extend(!0,{},n,{grid:{border:"#c0c0c0"},toolbar:{border:"#e0e0e0"},cell:{normal:{background:"#fff",border:"#e0e0e0",showVerticalBorder:!1,showHorizontalBorder:!0},head:{background:"#fff",border:"#e0e0e0",showVerticalBorder:!1,showHorizontalBorder:!0},selectedHead:{background:"#e0e0e0"}}})},{"./default":42}],42:[function(t,e,i){"use strict";e.exports={grid:{background:"#fff",border:"#ccc",text:"#444"},selection:{background:"#4daaf9",border:"#004082"},toolbar:{border:"#ccc",background:"transparent"},scrollbar:{background:"#f5f5f5",thumb:"#d9d9d9",active:"#c1c1c1"},cell:{normal:{background:"#fbfbfb",border:"#e0e0e0",showVerticalBorder:!0,showHorizontalBorder:!0},head:{background:"#eee",border:"#ccc",showVerticalBorder:!0,showHorizontalBorder:!0},selectedHead:{background:"#d8d8d8"},focused:{border:"#418ed4"},required:{background:"#fffdeb"},editable:{background:"#fff"},disabled:{text:"#b0b0b0"},dummy:{background:"#fff"},invalid:{background:"#ff8080"},evenRow:{},oddRow:{},currentRow:{}}}},{}],43:[function(t,e,i){"use strict";var n=t("./default");e.exports=$.extend(!0,{},n,{cell:{normal:{background:"#fff",border:"#e8e8e8",showVerticalBorder:!1,showHorizontalBorder:!1},oddRow:{background:"#f3f3f3"},evenRow:{background:"#fff"},head:{background:"#fff",showVerticalBorder:!1,showHorizontalBorder:!1}}})},{"./default":42}],44:[function(t,e,i){"use strict";function n(t,e){return a(t).bg(e.background).text(e.text).build()}var o=t("./cssRuleBuilder"),s=t("../common/classNameConst"),a=_.bind(o.createClassRule,o);e.exports={grid:function(t){var e=a(s.CONTAINER).bg(t.background).text(t.text),i=a(s.CONTENT_AREA).border(t.border),n=a(s.TABLE).border(t.border),l=a(s.HEAD_AREA).border(t.border),r=a(s.BORDER_LINE).bg(t.border),d=a(s.SCROLLBAR_HEAD).border(t.border),u=a(s.SCROLLBAR_BORDER).bg(t.border);return o.buildAll([e,i,n,l,r,d,u])},scrollbar:function(t){var e=o.createWebkitScrollbarRules("."+s.CONTAINER,t),i=o.createIEScrollbarRule("."+s.CONTAINER,t),n=a(s.SCROLLBAR_RIGHT_BOTTOM).bg(t.background),l=a(s.SCROLLBAR_LEFT_BOTTOM).bg(t.background),r=a(s.SCROLLBAR_HEAD).bg(t.background);return o.buildAll(e.concat([i,n,l,r]))},toolbar:function(t){var e=a(s.TOOLBAR).bg(t.background).border(t.border),i=a(s.HEIGHT_RESIZE_HANDLE).border(t.border);return o.buildAll([e,i])},selection:function(t){return a(s.LAYER_SELECTION).bg(t.background).border(t.border).build()},cell:function(t){var e=a(s.CELL).bg(t.background).border(t.border).borderWidth(t).text(t.text);return e.build()},cellHead:function(t){var e=a(s.CELL_HEAD).bg(t.background).border(t.border).borderWidth(t).text(t.text);return e.build()},cellEvenRow:function(t){return a(s.CELL_ROW_EVEN).bg(t.background).build()},cellOddRow:function(t){return a(s.CELL_ROW_ODD).bg(t.background).build()},cellSelectedHead:function(t){return o.create("."+s.CELL_HEAD+"."+s.CELL_SELECTED).bg(t.background).text(t.text).build()},cellFocused:function(t){var e=a(s.LAYER_FOCUS_BORDER).bg(t.border),i=a(s.LAYER_EDITING).border(t.border);return o.buildAll([e,i])},cellEditable:function(t){return n(s.CELL_EDITABLE,t)},cellRequired:function(t){return n(s.CELL_REQUIRED,t)},cellDisabled:function(t){return n(s.CELL_DISABLED,t)},cellDummy:function(t){return n(s.CELL_DUMMY,t)},cellInvalid:function(t){return n(s.CELL_INVALID,t)},cellCurrentRow:function(t){return n(s.CELL_CURRENT_ROW,t)}}},{"../common/classNameConst":8,"./cssRuleBuilder":39}],45:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/classNameConst"),a=t("../common/constMap"),l=a.keyCode,r=a.selectionType,d=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:s.CLIPBOARD,events:{keydown:"_onKeyDown",blur:"_onBlur"},_onBlur:function(){var t=this.focusModel;setTimeout(function(){t.refreshState()},0)},_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?void t.preventDefault():(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(),s=n.rowKey,a=n.columnName,r=this.dimensionModel.get("displayRowCount"),d=!0,u=t.keyCode||t.which;if(!o.isBlank(n.rowKey)){switch(u){case l.UP_ARROW:e.focus(e.prevRowKey(),a,!0);break;case l.DOWN_ARROW:e.focus(e.nextRowKey(),a,!0);break;case l.LEFT_ARROW:e.focus(s,e.prevColumnName(),!0);break;case l.RIGHT_ARROW:e.focus(s,e.nextColumnName(),!0);break;case l.PAGE_UP:e.focus(e.prevRowKey(r-1),a,!0);break;case l.PAGE_DOWN:e.focus(e.nextRowKey(r-1),a,!0);break;case l.HOME:e.focus(s,e.firstColumnName(),!0);break;case l.END:e.focus(s,e.lastColumnName(),!0);break;case l.SPACE:case l.ENTER:this._onEnterSpace(s,a);break;case l.DEL:this._del(s,a);break;case l.TAB:e.focusIn(s,e.nextColumnName(),!0);break;default:d=!1}d&&t.preventDefault(),i.end()}},_onEnterSpace:function(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,s=this.focusModel,a=this.dimensionModel,d=this.columnModel.getVisibleColumnModelList(),u=s.which(),c=a.get("displayRowCount"),h=t.keyCode||t.which,m=this._getIndexBeforeMove(),g=!0,f=!0;switch(h){case l.UP_ARROW:m.row-=1;break;case l.DOWN_ARROW:m.row+=1;break;case l.LEFT_ARROW:m.column-=1;break;case l.RIGHT_ARROW:m.column+=1;break;case l.PAGE_UP:m.row=s.prevRowIndex(c-1);break;case l.PAGE_DOWN:m.row=s.nextRowIndex(c-1);break;case l.HOME:m.column=0;break;case l.END:m.column=d.length-1;break;case l.ENTER:f=!1;break;case l.TAB:f=!1,s.focusIn(u.rowKey,s.prevColumnName(),!0);break;default:f=!1,g=!1}e=d[m.column],n=!(!e||!this.dataModel.getRowData(m.row)),f&&n&&(this._updateSelectionByKeyIn(m.row,m.column),i=a.getScrollPosition(m.row,e.columnName),i&&(o=this.selectionModel.getType(),o===r.COLUMN?delete i.scrollTop:o===r.ROW&&delete i.scrollLeft,this.renderModel.set(i))),g&&t.preventDefault()},_keyInWithCtrl:function(t){var e=this.focusModel,i=t.keyCode||t.which;switch(i){case l.CHAR_A:this.selectionModel.selectAll();break;case l.CHAR_C:this._copyToClipboard();break;case l.HOME:e.focus(e.firstRowKey(),e.firstColumnName(),!0);break;case l.END:e.focus(e.lastRowKey(),e.lastColumnName(),!0);break;case l.CHAR_V:this._pasteWhenKeyupCharV()}},_pasteWhenKeyupCharV:function(){var t=this;this._clearClipBoard(),this.pasting||(this.pasting=!0,this.$el.on("keyup",function(){t._pasteToGrid(),t.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 l.HOME:this._updateSelectionByKeyIn(0,0);break;case l.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'}var o,s=t("../base/view"),a=t("../common/classNameConst"),l="yyyy-mm-dd";o=s.extend({initialize:function(t){this.textPainter=t.textPainter,this.columnModel=t.columnModel,this.domState=t.domState,this.calendar=this._createCalendar(),this.datePicker=this._createDatePicker(),this._customizeCalendarBtns(),this.listenTo(this.textPainter,"focusIn",this._onFocusInTextInput),this.listenTo(this.textPainter,"focusOut",this._onFocusOutTextInput)},className:a.LAYER_DATE_PICKER,_createCalendar:function(){var t=$("
").addClass(a.CALENDAR);return t.mousedown(function(t){return t.preventDefault(),t.target.unselectable=!0,!1}),new tui.component.Calendar({element:t,classPrefix:a.CALENDAR+"-"})},_customizeCalendarBtns:function(){var t=this.calendar.$header,e=n(a.ICO_ARROW_LEFT),i=n(a.ICO_ARROW_RIGHT);t.find("."+a.CALENDAR_BTN_PREV_YEAR).html(e+e),t.find("."+a.CALENDAR_BTN_NEXT_YEAR).html(i+i),t.find("."+a.CALENDAR_BTN_PREV_MONTH).html(e),t.find("."+a.CALENDAR_BTN_NEXT_MONTH).html(i)},_createDatePicker:function(){var t=new tui.component.DatePicker({parentElement:this.$el,enableSetDateByEnterKey:!1,selectableClassName:a.CALENDAR_SELECTABLE,selectedClassName:a.CALENDAR_SELECTED,pos:{top:0,left:0}},this.calendar);return t.on("update",function(){t.close()}),t},_createDateForNow:function(){var t=new Date;return{year:t.getFullYear(),month:t.getMonth()+1,date:t.getDate()}},_resetDatePicker:function(t,e){var i=this.datePicker,n=t.date||this._createDateForNow();i.setDateForm(t.dateForm||l),i.setRanges(t.selectableRanges||[]),i.setDate(n.year,n.month,n.date),i.setElement(e)},_calculatePosition:function(t){var e=t.offset(),i=t.outerHeight(),n=this.domState.getOffset();return{top:e.top-n.top+i,left:e.left-n.left}},_onFocusInTextInput:function(t,e){var i=e.columnName,n=this.columnModel.getColumnModel(i).component,o=this.columnModel.getEditType(i);"text"===o&&n&&"datePicker"===n.name&&(this.$el.css(this._calculatePosition(t)).show(),this._resetDatePicker(n.option||{},t),this.datePicker.open())},_onFocusOutTextInput:function(){this.datePicker.close(),this.$el.hide()},render:function(){return this.$el.hide(),this}}),e.exports=o},{"../base/view":7,"../common/classNameConst":8}],48:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").dimension.CELL_BORDER_WIDTH,s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=n.extend({initialize:function(t){this.renderModel=t.renderModel,this.domState=t.domState,this.inputPainters=t.inputPainters,this.listenTo(this.renderModel,"editingStateChanged",this._onEditingStateChanged)},className:a.LAYER_EDITING+" "+a.CELL_CONTENT,_startEditing:function(t){var e=t.rowKey,i=t.columnName,n=tui.util.pick(t,"columnModel","editOption","type"),o=this._calculateLayoutStyle(e,i,this._isWidthExpandable(n)),a=this.inputPainters[n];this.$el.html(a.generateHtml(t)).attr(s.ROW_KEY,e).attr(s.COLUMN_NAME,i).css(o).show(),this._adjustLeftPosition(),a.focus(this.$el)},_isWidthExpandable:function(t){return _.contains(["checkbox","radio"],t)},_finishEditing:function(){this.$el.removeAttr(s.ROW_KEY),this.$el.removeAttr(s.COLUMN_NAME),this.$el.empty().hide()},_adjustLeftPosition:function(){var t=this.domState.getWidth(),e=this.$el.outerWidth(),i=this.$el.position().left;i+e>t&&this.$el.css("left",t-e)},_adjustCellOffsetValue:function(t){var e=tui.util.browser,i=t;return e.msie&&(9===e.version?i=t-1:e.version>9&&(i=Math.floor(t))),i},_calculateLayoutStyle:function(t,e,i){var n=this.domState.getOffset(),s=this.domState.getElement(t,e),a=s.offset(),l=s.height()+o,r=s.width()+o;return{top:this._adjustCellOffsetValue(a.top)-n.top,left:this._adjustCellOffsetValue(a.left)-n.left,height:l,minWidth:i?r:"",width:i?"":r,lineHeight:l+"px"}},_onEditingStateChanged:function(t){t.isEditing?this._startEditing(t):this._finishEditing()},render:function(){return _.each(this.inputPainters,function(t){t.attachEventHandlers(this.$el,"")},this),this}});e.exports=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],49:[function(t,e,i){"use strict";var n=t("./container"),o=t("./layout/content-area"),s=t("./layout/toolbar"),a=t("./layout/toolbar/controlPanel"),l=t("./layout/toolbar/pagination"),r=t("./layout/toolbar/resizeHandler"),d=t("./stateLayer"),u=t("./clipboard"),c=t("./layout/frame-lside"),h=t("./layout/frame-rside"),m=t("./layout/header"),g=t("./layout/resizeHandler"),f=t("./layout/body"),_=t("./layout/bodyTable"),p=t("./rowList"),M=t("./selectionLayer"),C=t("./editingLayer"),w=t("./datePickerLayer"),v=t("./focusLayer"),y=tui.util.defineClass({init:function(t){this.domState=t.domState,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})},createContentArea:function(){return new o({dimensionModel:this.modelManager.dimensionModel,viewFactory:this})},createToolbar:function(){return new s({toolbarModel:this.modelManager.toolbarModel,dimensionModel:this.modelManager.dimensionModel,viewFactory:this})},createToolbarControlPanel:function(){return new a({gridId:this.modelManager.gridId,toolbarModel:this.modelManager.toolbarModel})},createToolbarPagination:function(){return new l({toolbarModel:this.modelManager.toolbarModel})},createToolbarResizeHandler:function(){return new r({dimensionModel:this.modelManager.dimensionModel})},createStateLayer:function(){return new d({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?c:h;return new e({dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,viewFactory:this})},createHeader:function(t){return new m({whichSide:t,renderModel:this.modelManager.renderModel,dimensionModel:this.modelManager.dimensionModel,focusModel:this.modelManager.focusModel,selectionModel:this.modelManager.selectionModel,dataModel:this.modelManager.dataModel,columnModel:this.modelManager.columnModel,viewFactory:this})},createHeaderResizeHandler:function(t){return new g({whichSide:t,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel})},createBody:function(t){return new f({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 _({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,selectionModel:this.modelManager.selectionModel,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})},createEditingLayer:function(){return new C({renderModel:this.modelManager.renderModel,inputPainters:this.painterManager.getInputPainters(!0),domState:this.domState})},createDatePickerLayer:function(){return tui.component&&tui.component.DatePicker&&tui.component.Calendar?new w({columnModel:this.modelManager.columnModel,textPainter:this.painterManager.getInputPainters().text,domState:this.domState}):null},createFocusLayer:function(t){return new v({whichSide:t,dimensionModel:this.modelManager.dimensionModel,columnModel:this.modelManager.columnModel,focusModel:this.modelManager.focusModel})}});e.exports=y},{"./clipboard":45,"./container":46,"./datePickerLayer":47,"./editingLayer":48,"./focusLayer":50,"./layout/body":51,"./layout/bodyTable":52,"./layout/content-area":53,"./layout/frame-lside":54,"./layout/frame-rside":55,"./layout/header":57,"./layout/resizeHandler":58,"./layout/toolbar":59,"./layout/toolbar/controlPanel":60,"./layout/toolbar/pagination":61,"./layout/toolbar/resizeHandler":62,"./rowList":63,"./selectionLayer":64,"./stateLayer":65}],50:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").dimension.CELL_BORDER_WIDTH,s=t("../common/classNameConst"),a='
',l=n.extend({initialize:function(t){this.focusModel=t.focusModel,this.columnModel=t.columnModel,this.dimensionModel=t.dimensionModel,this.whichSide=t.whichSide,this.borderEl={$top:$(a),$left:$(a),$right:$(a),$bottom:$(a)},this.listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged),this.listenTo(this.focusModel,"blur",this._onBlur),this.listenTo(this.focusModel,"focus",this._onFocus)},className:s.LAYER_FOCUS,_onColumnWidthChanged:function(){var t=this.focusModel;this.$el.is(":visible")&&this._refreshBorderLayout(t.get("rowKey"),t.get("columnName"))},_onBlur:function(){this.$el.hide()},_onFocus:function(t,e){var i=this.columnModel.isLside(e)?"L":"R";i===this.whichSide&&(this._refreshBorderLayout(t,e),this.$el.show())},_onChangeEditingAddress:function(t,e){e?this.$el.hide():this.$el.show()},_refreshBorderLayout:function(t,e){var i=this.dimensionModel.getCellPosition(t,e),n=i.right-i.left,s=i.bottom-i.top;this.borderEl.$left.css({top:i.top,left:i.left,width:o,height:s+o}),this.borderEl.$top.css({top:0===i.top?o:i.top,left:i.left,width:n+o,height:o}),this.borderEl.$right.css({top:i.top,left:i.left+n,width:o,height:s+o}),this.borderEl.$bottom.css({top:i.top+s,left:i.left,width:n+o,height:o})},render:function(){var t=this.$el;return _.each(this.borderEl,function(e){t.append(e)}),t.hide(),this}});e.exports=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],51:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap"),a=t("../../common/classNameConst"),l=s.attrName,r=s.selectionType,d=200,u=10,c=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)},className:a.BODY_AREA,events:function(){var t={};return t.scroll="_onScroll",t["mousedown ."+a.BODY_CONTAINER]="_onMouseDown",t},_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.closest("td"),s=n.closest("tr"),a=o.attr(l.COLUMN_NAME),r=s.attr(l.ROW_KEY),d=!0,u=_.pick(t,"pageX","pageY","shiftKey");o.length?r&&a?(e={column:i.indexOfColumnName(a,!0),row:this.dataModel.indexOfRowKey(r)},"radio"===this.columnModel.get("selectType")&&this.dataModel.check(e.row)):d=!1:(e=this.dimensionModel.getIndexFromMousePosition(t.pageX,t.pageY),a=this._getColumnNameByVisibleIndex(e.column)),d&&this._controlStartAction(u,e,a,n.is("input"))},_controlStartAction:function(t,e,i,n){var s=this.selectionModel,a=e.column,l=e.row,d=!0;s.isEnabled()&&(o.isMetaColumn(i)?"_number"===i?this._updateSelectionByRow(l,t.shiftKey):d=!1:(s.setType(r.CELL),t.shiftKey&&!n?s.update(l,a):(d=this._doFocusAtAndCheckDraggable(l,a),s.end())),!n&&d&&(this.dimensionModel.refreshLayout(),this._attachDragEvents(t.pageX,t.pageY)))},_updateSelectionByRow:function(t,e){e?this.selectionModel.update(t,0,r.ROW):this.selectionModel.selectRow(t)},_doFocusAtAndCheckDraggable:function(t,e){var i=(new Date).getTime(),n=this.focusModel.focusAt(t,e),o=(new Date).getTime(),s=o-i>d;return n&&!s},_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._getMouseMoveDistance(t.pageX,t.pageY)>u;(this.selectionModel.hasSelection()||e)&&this.selectionModel.updateByMousePosition(t.pageX,t.pageY)},_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=$("
").addClass(a.BODY_CONTAINER),this.$el.append(this.$container),this._addChildren([this.viewFactory.createBodyTable(t),this.viewFactory.createSelectionLayer(t),this.viewFactory.createFocusLayer(t)]),this.$container.append(this._renderChildren()),this._resetContainerHeight(),this}});e.exports=c},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],52:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap"),a=t("../../common/classNameConst"),l=s.dimension.CELL_BORDER_WIDTH,r=s.attrName.COLUMN_NAME,d=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()},className:a.BODY_TABLE_CONTAINER,template:_.template('<%=colGroup%><%=tbody%>
'),templateCol:_.template('="<%=columnName%>" style="width:<%=width%>px">'),_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-d.EXTRA_WIDTH+l),i+=t+l},this),o.isBrowserIE7()&&this.$el.width(i)},_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},_attachAllTableEventHandlers:function(){var t=this.painterManager.getCellPainters();_.each(t,function(t){t.attachEventHandlers(this.$el,"")},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){n+=this.templateCol({attrColumnName:r,columnName:t.columnName,width:e[i]-d.EXTRA_WIDTH+l})},this),n}},{EXTRA_WIDTH:o.isBrowserIE7()?20:0});e.exports=d},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],53:[function(t,e,i){"use strict";function n(t){return $("
").addClass(a.BORDER_LINE).addClass(t)}var o,s=t("../../base/view"),a=t("../../common/classNameConst");o=s.extend({initialize:function(t){s.prototype.initialize.call(this),this.viewFactory=t.viewFactory,this.dimensionModel=t.dimensionModel,this._addFrameViews()},className:a.CONTENT_AREA,_addFrameViews:function(){var t=this.viewFactory;this._addChildren([t.createFrame("L"),t.createFrame("R")])},render:function(){var t=this.dimensionModel,e=t.getScrollXHeight(),i=this._renderChildren().concat([n(a.BORDER_TOP),n(a.BORDER_LEFT),n(a.BORDER_RIGHT),n(a.BORDER_BOTTOM).css("bottom",e)]);return t.get("scrollX")||this.$el.addClass(a.NO_SCROLL_X),t.get("scrollY")||this.$el.addClass(a.NO_SCROLL_Y),this.$el.append(i),this}}),e.exports=o},{"../../base/view":7,"../../common/classNameConst":8}],54:[function(t,e,i){"use strict";var n=t("./frame"),o=t("../../common/classNameConst"),s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"L"})},className:o.LSIDE_AREA,_onColumnWidthChanged:function(){this.$el.css({width:this.dimensionModel.get("lsideWidth")})},beforeRender:function(){this.$el.css({display:"block",width:this.dimensionModel.get("lsideWidth")})},afterRender:function(){this.dimensionModel.get("scrollX")&&this.$el.append($("
").addClass(o.SCROLLBAR_LEFT_BOTTOM))}});e.exports=s},{"../../common/classNameConst":8,"./frame":56}],55:[function(t,e,i){"use strict";var n=t("./frame"),o=t("../../common/classNameConst"),s=t("../../common/constMap").dimension.CELL_BORDER_WIDTH,a=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:o.RSIDE_AREA,_onColumnWidthChanged:function(){this._refreshLayout()},_refreshLayout:function(){var t=this.dimensionModel,e=t.get("rsideWidth"),i=t.get("lsideWidth");i>0&&!t.isDivisionBorderDoubled()&&(e+=s,i-=s),this.$el.css({width:e,marginLeft:i})},_resetScrollBorderHeight:function(){var t,e;this.$scrollBorder&&(t=this.dimensionModel,e=t.get("bodyHeight")-t.getScrollXHeight(),this.$scrollBorder.height(e))},beforeRender:function(){this.$el.css("display","block"),this._refreshLayout()},afterRender:function(){var t,e,i,n,s=this.dimensionModel;s.get("scrollY")&&(n=s.get("headerHeight"),t=$("
").addClass(o.SCROLLBAR_HEAD),e=$("
").addClass(o.SCROLLBAR_BORDER),t.height(n-2),e.css("top",n+"px"),this.$el.append(t,e),s.get("scrollX")&&(i=$("
").addClass(o.SCROLLBAR_RIGHT_BOTTOM),this.$el.append(i)),this.$scrollBorder=e,this._resetScrollBorderHeight())}});e.exports=a},{"../../common/classNameConst":8,"../../common/constMap":9,"./frame":56}],56:[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).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged)},render:function(){var t=this.viewFactory;return this.$el.empty(),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}],57:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap"),a=t("../../common/classNameConst"),l=10,r=s.selectionType.COLUMN,d=s.attrName.COLUMN_NAME,u=s.dimension.CELL_BORDER_WIDTH,c=s.dimension.TABLE_BORDER_WIDTH,h=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({renderModel:t.renderModel,dimensionModel:t.dimensionModel,selectionModel:t.selectionModel,focusModel:t.focusModel,columnModel:t.columnModel,dataModel:t.dataModel,viewFactory:t.viewFactory,timeoutForAllChecked:0,whichSide:t.whichSide||"R"}),this.listenTo(this.renderModel,"change:scrollLeft",this._onScrollLeftChange).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged).listenTo(this.selectionModel,"change:range",this._refreshSelectedHeaders).listenTo(this.focusModel,"change:columnName",this._refreshSelectedHeaders).listenTo(this.dataModel,"change:_button",this._onCheckCountChange).listenTo(this.dataModel,"sortChanged",this._updateBtnSortState)},className:a.HEAD_AREA,events:{click:"_onClick","mousedown th":"_onMouseDown"},template:_.template('<%=colGroup%><%=tBody%>
'),templateHeader:_.template('="<%=columnName%>" class="<%=className%>" height="<%=height%>" <%if(colspan > 0) {%>colspan=<%=colspan%> <%}%><%if(rowspan > 0) {%>rowspan=<%=rowspan%> <%}%>><%=title%><%=btnSort%>'),templateCol:_.template('="<%=columnName%>" style="width:<%=width%>px">'),markupBtnSort:'',_getColGroupMarkup:function(){var t=this._getColumnData(),e=t.widthList,i=t.modelList,n=[];return _.each(e,function(t,e){n.push(this.templateCol({attrColumnName:d,columnName:i[e].columnName,width:t+u}))},this),n.join("")},_getSelectedColumnNames:function(){var t=this.selectionModel.get("range").column,e=this.columnModel.getVisibleColumnModelList(),i=e.slice(t[0],t[1]+1);return _.pluck(i,"columnName")},_getContainingMergedColumnNames:function(t){var e=this.columnModel,i=_.pluck(e.get("columnMerge"),"columnName");return _.filter(i,function(i){var n=e.getUnitColumnNamesIfMerged(i);return _.every(n,function(e){return _.contains(t,e)})})},_refreshSelectedHeaders:function(){var t,e,i=this.$el.find("th");this.selectionModel.hasSelection()?t=this._getSelectedColumnNames():this.focusModel.has(!0)&&(t=[this.focusModel.get("columnName")]),i.removeClass(a.CELL_SELECTED),t&&(e=this._getContainingMergedColumnNames(t),_.each(t.concat(e),function(t){i.filter("["+d+"="+t+"]").addClass(a.CELL_SELECTED)}))},_onMouseDown:function(t){var e,i;this.selectionModel.isEnabled()&&!$(t.target).is("a."+a.BTN_SORT)&&(e=$(t.target).closest("th").attr(d),e&&(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,r),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(d);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){return _.some(t,function(t){return o.isMetaColumn(t)})},_onSelectStart:function(t){return t.preventDefault(),!1},_onCheckCountChange:function(){"checkbox"===this.columnModel.get("selectType")&&(clearTimeout(this.timeoutForAllChecked),this.timeoutForAllChecked=setTimeout($.proxy(this._syncCheckState,this),l))},_getHeaderMainCheckbox:function(){return this.$el.find("th["+d+"=_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+u)})},_onScrollLeftChange:function(t,e){"R"===this.whichSide&&(this.el.scrollLeft=e)},_onClick:function(t){var e=$(t.target),i=e.closest("th").attr(d);"_button"===i&&e.is("input")?e.prop("checked")?this.dataModel.checkAll():this.dataModel.uncheckAll():e.is("a."+a.BTN_SORT)&&this.dataModel.sortByField(i)},_updateBtnSortState:function(t){this._$currentSortBtn&&this._$currentSortBtn.removeClass(a.BTN_SORT_DOWN+" "+a.BTN_SORT_UP),this._$currentSortBtn=this.$el.find("th["+d+"="+t.columnName+"] a."+a.BTN_SORT),this._$currentSortBtn.addClass(t.isAscending?a.BTN_SORT_UP:a.BTN_SORT_DOWN)},render:function(){return this._destroyChildren(),"R"!==this.whichSide||this.dimensionModel.get("scrollY")||this.$el.addClass(a.NO_SCROLL_Y),this.$el.css({height:this.dimensionModel.get("headerHeight")-c}).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"),l=new Array(n),r=new Array(n),u=[],c=o.getRowHeight(n,s)-1,h=1;return _.each(i,function(e,o){var m=i[o].length,g=0;_.each(e,function(e,i){var o=e.columnName,f=[a.CELL,a.CELL_HEAD];e.isRequired&&f.push(a.CELL_REQRUIRED),h=m-1===i&&n-m+1>1?n-m+1:1,t=c*h,i===m-1?t=s-g-2:g+=t+1,r[i]===o?(l[i].pop(),u[i]+=1):u[i]=1,r[i]=o,l[i]=l[i]||[],l[i].push(this.templateHeader({attrColumnName:d,columnName:o,className:f.join(" "),height:t,colspan:u[i],rowspan:h,title:e.title,btnSort:e.isSortable?this.markupBtnSort:""}))},this)},this),e=_.map(l,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=h},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],58:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/constMap").attrName,s=t("../../common/classNameConst"),a=t("../../common/constMap").dimension.CELL_BORDER_WIDTH,l=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)},className:s.COLUMN_RESIZE_CONTAINER,events:function(){var t={};return t["mousedown ."+s.COLUMN_RESIZE_HANDLE]="_onMouseDown",t["dblclick ."+s.COLUMN_RESIZE_HANDLE]="_onDblClick",t},template:_.template("
'),_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=this._getColumnData(),e=t.modelList,i=this.dimensionModel.get("headerHeight"),n=e.length,o=_.map(e,function(t,e){return this.template({lastClass:e+1===n?s.COLUMN_RESIZE_HANDLE_LAST:"",columnIndex:e,columnName:t.columnName,height:i})},this);return o.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=this._getColumnData(),e=t.widthList,i=this.$el.find("."+s.COLUMN_RESIZE_HANDLE),n=0;tui.util.forEachArray(i,function(t,o){var s=i.eq(o),l=Math.ceil(s.width()/2);n+=e[o]+a,s.css("left",n-l)})},_isResizing:function(){return!!this.isResizing},_onMouseDown:function(t){this._startResizing($(t.target))},_onDblClick:function(t){var e=$(t.target),i=parseInt(e.attr(o.COLUMN_INDEX),10);this.dimensionModel.restoreColumnWidth(this._getHandlerColumnIndex(i)),this._refreshHandlerPosition()},_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(o.COLUMN_INDEX),10),this.$target.css("left",e),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;this.isResizing=!0,this.$target=t,this.initialLeft=parseInt(t.css("left").replace("px",""),10),this.initialOffsetLeft=this.$el.offset().left,this.initialWidth=i[t.attr(o.COLUMN_INDEX)],$("body").css("cursor","col-resize"),$(document).bind("mousemove",$.proxy(this._onMouseMove,this)).bind("mouseup",$.proxy(this._onMouseUp,this)),t[0].setCapture&&t[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=l},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9}],59:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/classNameConst"),s=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.toolbarModel=t.toolbarModel,this.dimensionModel=t.dimensionModel,this.viewFactory=t.viewFactory},className:o.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=s},{"../../base/view":7,"../../common/classNameConst":8}],60:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=t("../../../common/classNameConst"),s=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:function(){var t={};return t["click ."+o.BTN_EXCEL]="_onClickExcel",t},className:o.TOOLBAR_BTN_HOLDER,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(o.BTN_EXCEL_PAGE)?n.download("excel"):e.hasClass(o.BTN_EXCEL_ALL)&&n.download("excelAll"))},render:function(){var t=this.toolbarModel;return this.$el.empty(),t.get("isExcelButtonVisible")&&this.$el.append(this.templateExcelBtn({className:o.BTN_EXCEL_PAGE,text:"엑셀 다운로드"})),t.get("isExcelAllButtonVisible")&&this.$el.append(this.templateExcelBtn({className:o.BTN_EXCEL_ALL,text:"전체 엑셀 다운로드"})),this}});e.exports=s},{"../../../base/view":7,"../../../common/classNameConst":8}],61:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=t("../../../common/classNameConst"),s=n.extend({initialize:function(t){this.toolbarModel=t.toolbarModel},className:o.PAGINATION,htmlString:'FirstPrev NextLastFirst OffPrev OffNext OffLast Off',render:function(){return this._destroyChildren(),this.$el.empty().html(this.htmlString),this._setPaginationInstance(),this},_setPaginationInstance:function(){var t=tui&&tui.component&&tui.component.Pagination,e=this.toolbarModel.get("pagination");!e&&t&&(e=new t({classPrefix:o.PREFIX,itemCount:1,itemPerPage:1,pagePerPageList:5,isCenterAlign:!0,moveUnit:"page",$preOff:this.$el.find("."+o.PAGINATION_PRE_OFF),$pre_endOff:this.$el.find("."+o.PAGINATION_PRE_END_OFF),$nextOff:this.$el.find("."+o.PAGINATION_NEXT_OFF),$lastOff:this.$el.find("."+o.PAGINATION_NEXT_END_OFF)},this.$el)),this.toolbarModel.set("pagination",e)}});e.exports=s},{"../../../base/view":7,"../../../common/classNameConst":8}],62:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=t("../../../common/classNameConst"),s=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.timeoutIdForResize=0},className:o.HEIGHT_RESIZE_BAR,htmlString:'',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.htmlString),this},destroy:function(){this.stopListening(),this._onMouseUp(),this._destroyChildren(),this.remove()}});e.exports=s},{"../../../base/view":7,"../../../common/classNameConst":8}],63:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").attrName,a=t("../common/classNameConst"),l=n.extend({initialize:function(t){var e=t.focusModel,i=t.renderModel,n=t.selectionModel,o=t.whichSide||"R";this.setOwnProperties({whichSide:o,bodyTableView:t.bodyTableView,focusModel:e,renderModel:i,selectionModel:n,dataModel:t.dataModel,columnModel:t.columnModel,collection:i.getCollection(o),painterManager:t.painterManager,sortOptions:null,renderedRowKeys:null}),this.listenTo(this.collection,"change",this._onModelChange).listenTo(this.collection,"restore",this._onModelRestore).listenTo(e,"change:rowKey",this._refreshFocusedRow).listenTo(i,"rowListChanged",this.render),"L"===this.whichSide&&this.listenTo(e,"change:rowKey",this._refreshSelectedMetaColumns).listenTo(n,"change:range",this._refreshSelectedMetaColumns).listenTo(i,"rowListChanged",this._refreshSelectedMetaColumns)},_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(l.isInnerHtmlOfTbodyReadOnly)t=this.bodyTableView.redrawTable(e),this.setElement(t,!1),o.isBrowserIE7()&&t.width(t.width());else try{this.$el[0].innerHTML=e}catch(i){l.isInnerHtmlOfTbodyReadOnly=!0,this._resetRows()}},_getRowsHtml:function(t){var e=this.painterManager.getRowPainter(),i=_.pluck(this._getColumnModelList(),"columnName");return _.map(t,function(t){return e.generateHtml(t,i)}).join("")},_getRowElement:function(t){return this.$el.find("tr["+s.ROW_KEY+"="+t+"]")},_refreshSelectedMetaColumns:function(){var t,e=this.$el.find("tr"),i="."+a.CELL_HEAD;t=this.selectionModel.hasSelection()?this._filterRowsByIndexRange(e,this.selectionModel.get("range").row):this._filterRowByKey(e,this.focusModel.get("rowKey")),e.find(i).removeClass(a.CELL_SELECTED),t.find(i).addClass(a.CELL_SELECTED)},_filterRowsByIndexRange:function(t,e){var i,n,o=this.renderModel,s=o.get("startIndex");return i=Math.max(e[0]-s,0),n=Math.max(e[1]-s+1,0),i||n?t.slice(i,n):$()},_filterRowByKey:function(t,e){var i=this.dataModel.indexOfRowKey(e),n=this.renderModel.get("startIndex");return n>i?$():t.eq(i-n)},_refreshFocusedRow:function(){var t=this.focusModel.get("rowKey"),e=this.focusModel.get("prevRowKey");this._setFocusedRowClass(e,!1),this._setFocusedRowClass(t,!0)},_setFocusedRowClass:function(t,e){var i=_.pluck(this._getColumnModelList(),"columnName"),n={};_.each(i,function(i){var o,l=this.dataModel.getMainRowKey(t,i);n[l]||(n[l]=this._getRowElement(l)),o=n[l].find("td["+s.COLUMN_NAME+"="+i+"]"),o.toggleClass(a.CELL_CURRENT_ROW,e)},this)},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},_onModelChange:function(t){var e=this._getRowElement(t.get("rowKey"));this.painterManager.getRowPainter().refresh(t.changed,e)},_onModelRestore:function(t){var e=this.dataModel.getElement(t.rowKey,t.columnName),i=this.columnModel.getEditType(t.columnName);this.painterManager.getCellPainter(i).refresh(t,e)}},{isInnerHtmlOfTbodyReadOnly:tui.util.browser.msie&&tui.util.browser.version<=9});e.exports=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],64:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/classNameConst"),a=t("../common/constMap").dimension.CELL_BORDER_WIDTH,l=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)},className:s.LAYER_SELECTION,_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),n=o.getHeight(t[1]-t[0]+1,e)-a;return{top:i+"px",height:n+"px"}},_getHorizontalStyles:function(t){var e=this.columnWidthList,i=this.columnModel.getVisibleMetaColumnCount(),n=t[0],o=t[1],s=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?s+=e[r]+a:l+=e[r]+a;return l-=a,{left:s+"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=l},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],65:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").renderState,s=t("../common/classNameConst"),a=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.renderModel=t.renderModel,this.timeoutIdForDelay=null,this.listenTo(this.dimensionModel,"change",this._refreshLayout),this.listenTo(this.renderModel,"change:state",this.render)},className:s.LAYER_STATE,template:_.template('
<%= text %> <% if (isLoading) { %>
<% } %>
'),render:function(){var t=this.renderModel.get("state");return t===o.DONE?this.$el.hide():this._showLayer(t),this},_showLayer:function(t){var e=this.template({text:this._getMessage(t),isLoading:t===o.LOADING});this.$el.html(e).show(),this._refreshLayout()},_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=a},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}]},{},[14]); \ No newline at end of file