diff --git a/bower.json b/bower.json index 06c572f5d..9484a5607 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "tui-grid", - "version": "1.2.0-c", + "version": "1.2.1", "authors": [ "NHN Ent. FE Development Team" ], diff --git a/dist/grid.css b/dist/grid.css index 08881c6bb..2648513ca 100644 --- a/dist/grid.css +++ b/dist/grid.css @@ -1,76 +1,75 @@ /** * @fileoverview tui-grid * @author NHN Ent. FE Development Team - * @version 1.2.0-c + * @version 1.2.1 * @license MIT * @link https://github.com/nhnent/tui.grid */ -.uio_grid { +.tui-grid-container { width: 100%; - background: #fff; - color: #444; position: relative; - border-bottom: solid 1px #ccc; + border-style: solid; + border-width: 0 0 1px; clear: both; - scrollbar-highlight-color: #f5f5f5; - scrollbar-shadow-color: #f5f5f5; - scrollbar-arrow-color: #8a8a8a; - scrollbar-face-color: #d9d9d9; - scrollbar-3dlight-color: #f5f5f5; - scrollbar-darkshadow-color: #f5f5f5; - scrollbar-track-color: #f5f5f5; font-size: 12px; font-family: '돋움', Dotum, Helvetica, 'Apple SD Gothic Neo', Sans-serif; } -.uio_grid ::-webkit-scrollbar { +.tui-grid-container.tui-grid-no-scroll-x { + border-bottom-width: 0; +} +.tui-grid-container ::-webkit-scrollbar { -webkit-appearance: none; width: 17px; height: 17px; - background-color: #f5f5f5; } -.uio_grid ::-webkit-scrollbar-thumb { - background-color: #d9d9d9; +.tui-grid-container ::-webkit-scrollbar-thumb { border: 5px solid transparent; border-radius: 7px; background-clip: content-box; } -.uio_grid ::-webkit-scrollbar-thumb:hover { - background-color: #c1c1c1; -} -.uio_grid * { +.tui-grid-container * { box-sizing: content-box; } -.uio_grid p, -.uio_grid input { +.tui-grid-container p, +.tui-grid-container input { margin: 0; padding: 0; } -.uio_grid fieldset { +.tui-grid-container fieldset { margin: 0; padding: 0; border: 0; display: inline; white-space: nowrap; } -.uio_grid input[type=text] { +.tui-grid-container input[type=text], +.tui-grid-container input[type=password] { outline: none; + box-sizing: border-box; line-height: normal; } -.uio_grid ul, -.uio_grid li { +.tui-grid-container ul, +.tui-grid-container li { list-style: none; padding: 0; margin: 0; } -.uio_grid strong, -.uio_grid em { +.tui-grid-container strong, +.tui-grid-container em { font-style: normal; } -.uio_grid .btn_text { +.tui-grid-clipboard { + position: fixed; + top: 0px; + left: -9999px; + width: 100px; + height: 100px; +} +.tui-grid-btn-text { display: inline-block; text-decoration: none; } -.uio_grid .btn_text span { +.tui-grid-btn-text span { display: inline-block; position: relative; font-size: 11px; @@ -83,7 +82,7 @@ margin-left: 8px; padding-right: 7px; } -.uio_grid .btn_text em { +.tui-grid-btn-text em { position: absolute; left: 0; top: 5px; @@ -91,40 +90,26 @@ height: 12px; background: url("../images/icons.gif") no-repeat; } -.uio_grid .btn_text em.excel { - background-position: -30px -60px; -} -.uio_grid .btn_text em.grid { +.tui-grid-btn-text em.tui-grid-btn-excel-icon { background-position: -30px -60px; } -.uio_grid .clipboard { - position: fixed; - top: 0px; - left: -9999px; - width: 100px; - height: 100px; -} -.uio_grid .cell_content input[type=text], -.uio_grid .cell_content input[type=password] { - width: 100%; - padding: 2px 0; - border: solid 1px #e2e3ea; - border-top: solid 1px #abadb3; - border-bottom: solid 1px #e3e9ef; -} -.uio_grid .cell_content input.editing { - border: solid 1px #748eea; -} -.uio_grid .cell_content label + input { - margin-left: 10px; +.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; + vertical-align: middle; + cursor: pointer; } -.uio_grid .cell_content select { - width: 100%; +.tui-grid-btn-sorting-down { + background-position: 0 -60px; } -.uio_grid .cell_content a { - color: #002caf; +.tui-grid-btn-sorting-up { + background-position: -10px -60px; } -.uio_grid .state_layer { +.tui-grid-layer-state { position: absolute; top: 0; left: 0; @@ -135,10 +120,10 @@ text-align: center; z-index: 12; } -.uio_grid .state_layer .layer_content { +.tui-grid-layer-state-content { padding-top: 50px; } -.uio_grid .state_layer .layer_content .loading_img { +.tui-grid-layer-state-loading { display: block; margin: 10px auto 0; background: url("../images/ani_loading.gif"); @@ -146,43 +131,149 @@ width: 150px; height: 13px; } -.uio_grid .editing_layer { +.tui-grid-layer-editing { position: absolute; display: none; background: #fff; z-index: 15; padding: 0 10px; - border: dotted 1px #190000; + border-style: solid; + border-width: 1px; + 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; + border-style: solid; + border-width: 1px; + opacity: 0.2; + filter: alpha(opacity=10); +} +.tui-grid-table { + width: 100%; + border-width: 1px; + box-sizing: border-box; + border-style: solid; + table-layout: fixed; + border-collapse: collapse; + margin: 0; +} +.tui-grid-cell { + overflow: hidden; white-space: nowrap; + *white-space: pre; + border-width: 1px; + border-style: solid; + padding: 0 10px; +} +.tui-grid-cell img { + vertical-align: middle; +} +.tui-grid-cell-head { + padding: 0; + 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 { + 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; + *margin-left: -2px; + *padding-left: 2px; +} +.tui-grid-cell-content input[type=text], +.tui-grid-cell-content input[type=password] { + width: 100%; + padding: 2px 0; + border: solid 1px #e2e3ea; + border-top: solid 1px #abadb3; + border-bottom: solid 1px #e3e9ef; +} +.tui-grid-cell-content label + input { + margin-left: 10px; +} +.tui-grid-cell-content select { + box-sizing: border-box; + width: 100%; } -.uio_grid .left_line { +.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; - background: #ccc; 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; } -.uio_grid .right_line { - position: absolute; - background: #ccc; - z-index: 13; +.tui-grid-border-line-right { top: 0; bottom: 0; right: 0; width: 1px; } -.uio_grid .data_bottom_line { - position: absolute; - background: #ccc; - z-index: 13; +.tui-grid-border-line-bottom { bottom: 0; left: 0; right: 17px; height: 1px; } -.uio_grid .lside_area { +.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; @@ -191,243 +282,86 @@ overflow: hidden; z-index: 10; } -.uio_grid .lside_area .header { +.tui-grid-lside-area .tui-grid-head-area { overflow: hidden; } -.uio_grid .lside_area .data { - overflow: scroll; +.tui-grid-lside-area .tui-grid-body-area { position: relative; + overflow: scroll; margin-right: -17px; } -.uio_grid .lside_area .data .selection_layer { - display: none; - position: absolute; - top: 0; - width: 0; - height: 0; - border: solid 1px #004082; - background: #4daaf9; - opacity: 0.2; - filter: alpha(opacity=10); +.tui-grid-lside-area .tui-grid-body-area .tui-grid-selection-layer { left: 1px; } -.uio_grid .lside_area .scrollbar_overlay { - position: absolute; - bottom: 0; - left: 0; - right: 0; - height: 17px; - background-color: #f5f5f5; -} -.uio_grid .rside_area { +.tui-grid-rside-area { display: none; height: 100%; overflow: hidden; } -.uio_grid .rside_area .header { +.tui-grid-rside-area .tui-grid-head-area { position: relative; margin-right: 17px; overflow: hidden; } -.uio_grid .rside_area .header.no_scroll { +.tui-grid-rside-area .tui-grid-head-area.tui-grid-no-scroll-y { margin-right: 0; } -.uio_grid .rside_area .data { +.tui-grid-rside-area .tui-grid-body-area { position: relative; overflow: scroll; } -.uio_grid .rside_area .data .selection_layer { - display: none; +.tui-grid-body-container { + position: relative; + margin-top: -1px; +} +.tui-grid-table-container { position: absolute; - top: 0; - width: 0; - height: 0; - border: solid 1px #004082; - background: #4daaf9; - opacity: 0.2; - filter: alpha(opacity=10); } -.uio_grid .rside_area .header_space { +.tui-grid-scrollbar-head { display: block; position: absolute; top: 0; right: 0; width: 16px; - border: solid 1px #ccc; - background: #eee; + border-style: solid; + border-width: 1px; } -.uio_grid .rside_area .scrollbar_border { - display: block; +.tui-grid-scrollbar-left-bottom { position: absolute; - right: 17px; - width: 1px; - background: #ccc; + bottom: 0; + left: 0; + right: 0; + height: 17px; } -.uio_grid .rside_area .scrollbar_corner { +.tui-grid-scrollbar-right-bottom { position: absolute; bottom: 0; right: 0; width: 17px; height: 17px; - background-color: #f5f5f5; } -.uio_grid .header .resize_handle_container { - display: none; - position: relative; - width: 0; -} -.uio_grid .header .resize_handle_container .resize_handle { - float: left; - position: absolute; - top: -1px; - left: -99px; - width: 7px; - height: 100%; - background: #f00; - opacity: 0; - filter: alpha(opacity=0); - cursor: col-resize; -} -.uio_grid .header .resize_handle_container .resize_handle_last { - width: 3px; -} -.uio_grid .body_container { - position: relative; - margin-top: -1px; -} -.uio_grid .body_container .table_container { - position: absolute; -} -.uio_grid table { - border: 0; - table-layout: fixed; - background-color: #d8d8d8; - border-collapse: separate; - border-spacing: 1px; - margin: 0; -} -.uio_grid table th { - overflow: hidden; - white-space: nowrap; - *white-space: pre; - text-align: center; - padding: 0; - border: 0; - background: #eee; -} -.uio_grid table th.selected { - background: #cdcdcd; -} -.uio_grid table th .sort a { - color: #555; - text-decoration: none; -} -.uio_grid table th .btn_sorting { - display: inline-block; - overflow: hidden; - margin-left: 6px; - height: 15px; - width: 8px; - background: url("../images/icons.gif") -20px -60px no-repeat; - vertical-align: middle; - cursor: pointer; -} -.uio_grid table th .sorting_down { - background-position: 0 -60px; -} -.uio_grid table th .sorting_up { - background-position: -10px -60px; -} -.uio_grid table tr.disabled { - color: #b0b0b0; -} -.uio_grid table td { - overflow: hidden; - padding: 0 10px; - *padding: 1px 10px; - border: 0; - white-space: nowrap; - background-color: #fbfbfb; - *white-space: pre; -} -.uio_grid table td.meta_column { - background: #eee; -} -.uio_grid table td.meta_column.dummy { - background: #eee; -} -.uio_grid table td.meta_column.selected { - background: #cdcdcd; -} -.uio_grid table td.editable { - background-color: #fff; -} -.uio_grid table td.dummy { - background-color: #fff; -} -.uio_grid table td.required { - background-color: #fffdeb; -} -.uio_grid table td.disabled { - color: #b0b0b0; -} -.uio_grid table td.focused { - padding: 0 9px; - border: dotted 1px #190000; -} -.uio_grid table td.invalid { - padding: 0 9px; - border: solid 1px #ff8080; -} -.uio_grid table td.ellipsis { - -o-text-overflow: ellipsis /*Opera 9*/; - -moz-binding: url("ellipsis.xml#ellipsis") /* Firefox */; - width: 100% /* for IE6 */; - text-overflow: ellipsis; -} -.uio_grid table td img { - vertical-align: middle; -} -.uio_grid table td span.before { - float: left; - margin-right: 2px; - line-height: 1.5; -} -.uio_grid table td span.after { - float: right; - margin-left: 2px; - line-height: 1.5; -} -.uio_grid table td span.input { +.tui-grid-scrollbar-border { display: block; - overflow: hidden; - line-height: 1.5; - *margin-left: -2px; - *padding-left: 2px; + position: absolute; + right: 17px; + width: 1px; } -.uio_grid .toolbar { +.tui-grid-toolbar { display: none; width: 100%; height: 65px; bottom: 0px; position: absolute; - background: #fff; - border-top: 1px solid #ccc; + border-style: solid; + border-width: 1px 0 0; z-index: 11; } -.uio_grid .toolbar .total_count { - position: absolute; - top: 20px; - left: 24px; - color: #002caf; - font-weight: bold; -} -.uio_grid .toolbar .btn_setup { +.tui-grid-toolbar-btn-holder { position: absolute; right: 10px; top: 14px; } -.uio_grid .toolbar .height_resize_bar { +.tui-grid-height-resize-bar { overflow: hidden; cursor: row-resize; position: absolute; @@ -438,29 +372,30 @@ font-size: 0; text-align: center; } -.uio_grid .toolbar .height_resize_bar span { +.tui-grid-height-resize-bar span { background: url("../images/icons.gif") no-repeat -70px -60px; display: inline-block; width: 17px; height: 6px; margin-top: 5px; } -.uio_grid .toolbar .height_resize_handle { +.tui-grid-height-resize-handle { display: block; margin: 0 10px; - border-top: 1px solid #ccc; + border-style: solid; + border-width: 1px 0 0; cursor: row-resize; } -.uio_grid .grid_pagination { +.tui-grid-pagination { height: 12px; margin-bottom: 12px; padding-top: 14px; line-height: normal; text-align: center; } -.uio_grid .grid_pagination a, -.uio_grid .grid_pagination strong, -.uio_grid .grid_pagination span { +.tui-grid-pagination a, +.tui-grid-pagination strong, +.tui-grid-pagination span { display: inline-block; position: relative; padding: 4px 8px 4px; @@ -472,20 +407,20 @@ text-decoration: none; vertical-align: middle; } -.uio_grid .grid_pagination strong { +.tui-grid-pagination strong { padding: 4px 6px 4px; color: #ff1313; border: 1px solid #d4d4d4; background: #e7e7e7; } -.uio_grid .grid_pagination .pre_end, -.uio_grid .grid_pagination .pre_end_off, -.uio_grid .grid_pagination .pre, -.uio_grid .grid_pagination .pre_off, -.uio_grid .grid_pagination .next, -.uio_grid .grid_pagination .next_off, -.uio_grid .grid_pagination .next_end, -.uio_grid .grid_pagination .next_end_off { +.tui-grid-pagination .tui-grid-pre-end, +.tui-grid-pagination .tui-grid-pre-end-off, +.tui-grid-pagination .tui-grid-pre, +.tui-grid-pagination .tui-grid-pre-off, +.tui-grid-pagination .tui-grid-next, +.tui-grid-pagination .tui-grid-next-off, +.tui-grid-pagination .tui-grid-next-end, +.tui-grid-pagination .tui-grid-next-end-off { overflow: hidden; width: 25px; height: 24px; @@ -497,41 +432,41 @@ overflow: hidden; white-space: nowrap; } -.uio_grid .grid_pagination .pre_end, -.uio_grid .grid_pagination .pre_end_off, -.uio_grid .grid_pagination .next_end, -.uio_grid .grid_pagination .next_end_off { +.tui-grid-pagination .tui-grid-pre-end, +.tui-grid-pagination .tui-grid-pre-end-off, +.tui-grid-pagination .tui-grid-next-end, +.tui-grid-pagination .tui-grid-next-end-off { width: 24px; } -.uio_grid .grid_pagination .pre, -.uio_grid .grid_pagination .pre_off { +.tui-grid-pagination .tui-grid-pre, +.tui-grid-pagination .tui-grid-pre-off { margin-right: 12px; } -.uio_grid .grid_pagination .next, -.uio_grid .grid_pagination .next_off { +.tui-grid-pagination .tui-grid-next, +.tui-grid-pagination .tui-grid-next-off { margin-left: 12px; } -.uio_grid .grid_pagination .pre_end { +.tui-grid-pagination .tui-grid-pre-end { background-position: 0 0; } -.uio_grid .grid_pagination .pre_end_off { +.tui-grid-pagination .tui-grid-pre-end-off { background-position: 0 -30px; } -.uio_grid .grid_pagination .pre { +.tui-grid-pagination .tui-grid-pre { background-position: -24px 0; } -.uio_grid .grid_pagination .pre_off { +.tui-grid-pagination .tui-grid-pre-off { background-position: -24px -30px; } -.uio_grid .grid_pagination .next { +.tui-grid-pagination .tui-grid-next { background-position: -50px 0; } -.uio_grid .grid_pagination .next_off { +.tui-grid-pagination .tui-grid-next-off { background-position: -50px -30px; } -.uio_grid .grid_pagination .next_end { +.tui-grid-pagination .tui-grid-next-end { background-position: -75px 0; } -.uio_grid .grid_pagination .next_end_off { +.tui-grid-pagination .tui-grid-next-end-off { background-position: -75px -30px; } diff --git a/dist/grid.js b/dist/grid.js index caf98e176..4403e2a85 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.0-c + * @version 1.2.1 * @license MIT * @link https://github.com/nhnent/tui.grid */ @@ -826,7 +826,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ module.exports = Net; -},{"../base/view":7,"../common/constMap":8,"../common/formUtil":9,"../common/gridEvent":10,"../common/util":11,"./net-router":1}],3:[function(require,module,exports){ +},{"../base/view":7,"../common/constMap":9,"../common/formUtil":10,"../common/gridEvent":11,"../common/util":12,"./net-router":1}],3:[function(require,module,exports){ /** * @fileoverview Base class for Collections * @author NHN Ent. FE Development Team @@ -912,7 +912,7 @@ module.exports = Model; */ 'use strict'; -var attrNameMap = require('../common/constMap').attrName; +var attrNameConst = require('../common/constMap').attrName; /** * Base class for Painters @@ -949,11 +949,11 @@ var Painter = tui.util.defineClass(/**@lends module:base/painter.prototype */{ * @private */ _getCellAddress: function($target) { - var $addressHolder = $target.closest('[' + attrNameMap.ROW_KEY + ']'); + var $addressHolder = $target.closest('[' + attrNameConst.ROW_KEY + ']'); return { - rowKey: $addressHolder.attr(attrNameMap.ROW_KEY), - columnName: $addressHolder.attr(attrNameMap.COLUMN_NAME) + rowKey: $addressHolder.attr(attrNameConst.ROW_KEY), + columnName: $addressHolder.attr(attrNameConst.COLUMN_NAME) }; }, @@ -982,7 +982,7 @@ var Painter = tui.util.defineClass(/**@lends module:base/painter.prototype */{ module.exports = Painter; -},{"../common/constMap":8}],7:[function(require,module,exports){ +},{"../common/constMap":9}],7:[function(require,module,exports){ /** * @fileoverview Base class for Views * @author NHN Ent. FE Development Team @@ -1068,6 +1068,119 @@ module.exports = View; },{"./common":4}],8:[function(require,module,exports){ /** +* @fileoverview class name constants. +* @author NHN Ent. FE Development Team +*/ +'use strict'; + +var PREFIX = 'tui-grid-'; + +var classNames = { + CONTAINER: 'container', + CLIPBOARD: 'clipboard', + + // common + NO_SCROLL_X: 'no-scroll-x', + NO_SCROLL_Y: 'no-scroll-y', + + // layer + 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-line', + BORDER_TOP: 'border-line-top', + BORDER_LEFT: 'border-line-left', + BORDER_RIGHT: 'border-line-right', + BORDER_BOTTOM: 'border-line-bottom', + + // layout (area) + LSIDE_AREA: 'lside-area', + RSIDE_AREA: 'rside-area', + HEAD_AREA: 'head-area', + BODY_AREA: 'body-area', + + // header + COLUMN_RESIZE_CONTAINER: 'column-resize-container', + COLUMN_RESIZE_HANDLE: 'column-resize-handle', + COLUMN_RESIZE_HANDLE_LAST: 'column-resize-handle-last', + + // body + BODY_CONTAINER: 'body-container', + BODY_TABLE_CONTAINER: 'table-container', + + // scrollbar + SCROLLBAR_HEAD: 'scrollbar-head', + SCROLLBAR_BORDER: 'scrollbar-border', + SCROLLBAR_RIGHT_BOTTOM: 'scrollbar-right-bottom', + SCROLLBAR_LEFT_BOTTOM: 'scrollbar-left-bottom', + + // pagination + 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: 'table', + + // cell style + 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', + CELL_CONTENT_BEFORE: 'content-before', + CELL_CONTENT_AFTER: 'content-after', + CELL_CONTENT_INPUT: 'content-input', + + // buttons + 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', + TOOLBAR_BTN_HOLDER: 'toolbar-btn-holder', + HEIGHT_RESIZE_BAR: 'height-resize-bar', + HEIGHT_RESIZE_HANDLE: 'height-resize-handle' +}; + +var exports = _.mapObject(classNames, function(className) { + return PREFIX + className; +}); +exports.PREFIX = PREFIX; + +module.exports = exports; + +},{}],9:[function(require,module,exports){ +/** * @fileoverview Object that conatins constant values * @author NHN Ent. FE Development Team */ @@ -1114,11 +1227,18 @@ module.exports = { attrName: { ROW_KEY: 'data-row-key', COLUMN_NAME: 'data-column-name', - EDIT_TYPE: 'data-edit-type' + COLUMN_INDEX: 'data-column-index', + EDIT_TYPE: 'data-edit-type', + GRID_ID: 'data-grid-id' + }, + themeName: { + DEFAULT: 'default', + STRIPED: 'striped', + CLEAN: 'clean' } }; -},{}],9:[function(require,module,exports){ +},{}],10:[function(require,module,exports){ /** * @fileoverview Utilities for form data, form element * @author NHN Ent. Fe Development Team @@ -1338,7 +1458,7 @@ var formUtil = { module.exports = formUtil; -},{}],10:[function(require,module,exports){ +},{}],11:[function(require,module,exports){ /** * @fileoverview Event class for public event of Grid * @author NHN Ent. FE Development Team @@ -1386,7 +1506,7 @@ var GridEvent = tui.util.defineClass(/**@lends module:common/gridEvent.prototype module.exports = GridEvent; -},{}],11:[function(require,module,exports){ +},{}],12:[function(require,module,exports){ /** * @fileoverview 유틸리티 메서드 모음 * @author NHN Ent. FE Development Team @@ -1690,19 +1810,39 @@ var util = { isBrowserIE7: function() { var browser = tui.util.browser; return browser.msie && browser.version === 7; // eslint-disable-line no-magic-numbers + }, + + /** + * create style element and append it into the head element. + * @param {String} id - element id + * @param {String} cssString - css string + */ + appendStyleElement: function(id, cssString) { + var style = document.createElement('style'); + + style.type = 'text/css'; + style.id = id; + + if (style.styleSheet) { + style.styleSheet.cssText = cssString; + } else { + style.appendChild(document.createTextNode(cssString)); + } + + document.getElementsByTagName('head')[0].appendChild(style); } }; module.exports = util; -},{"./constMap":8}],12:[function(require,module,exports){ +},{"./constMap":9}],13:[function(require,module,exports){ /** * @fileoverview This class offers methods that can be used to get the current state of DOM element. * @author NHN Ent. FE Development Team */ 'use strict'; -var attrNameMap = require('./common/constMap').attrName; +var attrNameConst = require('./common/constMap').attrName; /** * Class for offering methods that can be used to get the current state of DOM element. @@ -1724,8 +1864,8 @@ var DomState = tui.util.defineClass(/**@lends module:domState.prototype */{ * @returns {jQuery} Cell(TD) element */ getElement: function(rowKey, columnName) { - return this.$el.find('tr[' + attrNameMap.ROW_KEY + '=' + rowKey + ']') - .find('td[' + attrNameMap.COLUMN_NAME + '=' + columnName + ']'); + return this.$el.find('tr[' + attrNameConst.ROW_KEY + '=' + rowKey + ']') + .find('td[' + attrNameConst.COLUMN_NAME + '=' + columnName + ']'); }, /** @@ -1763,7 +1903,7 @@ var DomState = tui.util.defineClass(/**@lends module:domState.prototype */{ module.exports = DomState; -},{"./common/constMap":8}],13:[function(require,module,exports){ +},{"./common/constMap":9}],14:[function(require,module,exports){ /** * @fileoverview The tui.Grid class for the external API. * @author NHN Ent. FE Development Team @@ -2075,6 +2215,8 @@ var PainterManager = require('./painter/manager'); var PainterController = require('./painter/controller'); var NetAddOn = require('./addon/net'); var util = require('./common/util'); +var themeManager = require('./theme/manager'); +var themeNameConst = require('./common/constMap').themeName; var instanceMap = {}; @@ -2101,6 +2243,10 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ this.container.render(); this.refreshLayout(); + if (!themeManager.isApplied()) { + themeManager.apply(themeNameConst.DEFAULT); + } + this.addOn = {}; instanceMap[this.id] = this; }, @@ -2108,6 +2254,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ /** * Creates core model and returns it. * @param {Object} options - Options set by user + * @param {module:domState} domState - domState * @returns {module:model/manager} - New model manager object * @private */ @@ -2143,7 +2290,8 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ /** * Creates container view and returns it - * @param {Object} options - Options set by user + * @param {Object} options - Options set by user + * @param {module:domState} domState - domState * @returns {module:view/container} - New container view object * @private */ @@ -2838,15 +2986,96 @@ tui.Grid.getInstanceById = function(id) { return instanceMap[id]; }; -},{"./addon/net":2,"./base/view":7,"./common/util":11,"./domState":12,"./model/manager":20,"./painter/controller":28,"./painter/manager":35,"./publicEventEmitter":37,"./view/factory":41}],14:[function(require,module,exports){ +/** + * Apply theme to all grid instances with the preset options of a given name. + * @api + * @static + * @param {String} presetName - preset theme name. Available values are 'default', 'striped' and 'clean'. + * @param {Object} [extOptions] - if exist, extend preset options with this object. + * @param {Object} [extOptions.grid] - Styles for the grid (container) + * @param {String} [extOptions.grid.background] - Background color of the grid. + * @param {number} [extOptions.grid.border] - Border color of the grid + * @param {number} [extOptions.grid.text] - Text color of the grid. + * @param {Object} [extOptions.selection] - Styles for a selection layer. + * @param {String} [extOptions.selection.background] - Background color of a selection layer. + * @param {String} [extOptions.selection.border] - Border color of a selection layer. + * @param {Object} [extOptions.toolbar] - Styles for a toolbar area. + * @param {String} [extOptions.toolbar.background] - Background color of a toolbar area. + * @param {String} [extOptions.toolbar.border] - Border color of a toolbar area. + * @param {Object} [extOptions.scrollbar] - Styles for scrollbars. + * @param {String} [extOptions.scrollbar.background] - Background color of scrollbars. + * @param {String} [extOptions.scrollbar.thumb] - Color of thumbs in scrollbars. + * @param {String} [extOptions.scrollbar.active] - Color of arrows(for IE) or + * thumb:hover(for other browsers) in scrollbars. + * @param {Object} [extOptions.cell] - Styles for the table cells. + * @param {Object} [extOptions.cell.normal] - Styles for normal cells. + * @param {String} [extOptions.cell.normal.background] - Background color of normal cells. + * @param {String} [extOptions.cell.normal.border] - Border color of normal cells. + * @param {String} [extOptions.cell.normal.text] - Text color of normal cells. + * @param {Boolean} [extOptions.cell.normal.showVerticalBorder] - Whether vertical borders of + * normal cells are visible. + * @param {Boolean} [extOptions.cell.normal.showHorizontalBorder] - Whether horizontal borders of + * normal cells are visible. + * @param {Object} [extOptions.cell.head] - Styles for the head cells. + * @param {String} [extOptions.cell.head.background] - Background color of head cells. + * @param {String} [extOptions.cell.head.border] - border color of head cells. + * @param {String} [extOptions.cell.head.text] - text color of head cells. + * @param {Boolean} [extOptions.cell.head.showVerticalBorder] - Whether vertical borders of + * head cells are visible. + * @param {Boolean} [extOptions.cell.head.showHorizontalBorder] - Whether horizontal borders of + * head cells are visible. + * @param {Object} [extOptions.cell.selectedHead] - Styles for selected head cells. + * @param {String} [extOptions.cell.selectedHead.background] - background color of selected haed cells. + * @param {String} [extOptions.cell.selectedHead.text] - text color of selected head cells. + * @param {Object} [extOptions.cell.focused] - Styles for a focused cell. + * @param {String} [extOptions.cell.focused.background] - background color of a focused cell. + * @param {String} [extOptions.cell.focused.border] - border color of a focused cell. + * @param {Object} [extOptions.cell.required] - Styles for required cells. + * @param {String} [extOptions.cell.required.background] - background color of required cells. + * @param {String} [extOptions.cell.required.text] - text color of required cells. + * @param {Object} [extOptions.cell.editable] - Styles for editable cells. + * @param {String} [extOptions.cell.editable.background] - background color of the editable cells. + * @param {String} [extOptions.cell.editable.text] - text color of the selected editable cells. + * @param {Object} [extOptions.cell.disabled] - Styles for disabled cells. + * @param {String} [extOptions.cell.disabled.background] - background color of disabled cells. + * @param {String} [extOptions.cell.disabled.text] - text color of disabled cells. + * @param {Object} [extOptions.cell.invalid] - Styles for invalid cells. + * @param {String} [extOptions.cell.invalid.background] - background color of invalid cells. + * @param {String} [extOptions.cell.invalid.text] - text color of invalid cells. + * @param {Object} [extOptions.cell.currentRow] - Styles for cells in a current row. + * @param {String} [extOptions.cell.currentRow.background] - background color of cells in a current row. + * @param {String} [extOptions.cell.currentRow.text] - text color of cells in a current row. + * @param {Object} [extOptions.cell.evenRow] - Styles for cells in even rows. + * @param {String} [extOptions.cell.evenRow.background] - background color of cells in even rows. + * @param {String} [extOptions.cell.evenRow.text] - text color of cells in even rows. + * @param {Object} [extOptions.cell.dummy] - Styles for dummy cells. + * @param {String} [extOptions.cell.dummy.background] - background color of dummy cells. + * @example +tui.Grid.applyTheme('striped', { + grid: { + border: '#aaa', + text: '#333' + }, + cell: { + disabled: { + text: '#999' + } + } +}); + */ +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){ /** * @fileoverview 컬럼 모델 * @author NHN Ent. FE Development Team */ 'use strict'; -var Model = require('../../base/model'), - util = require('../../common/util'); +var Model = require('../../base/model'); +var util = require('../../common/util'); /** * 컬럼 모델 데이터를 다루는 객체 @@ -3277,7 +3506,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype module.exports = ColumnModel; -},{"../../base/model":5,"../../common/util":11}],15:[function(require,module,exports){ +},{"../../base/model":5,"../../common/util":12}],16:[function(require,module,exports){ /** * @fileoverview Grid 의 Data Source 에 해당하는 Model 정의 * @author NHN Ent. FE Development Team @@ -3480,7 +3709,7 @@ var ExtraDataManager = tui.util.defineClass(/**@lends module:model/data/extraDat module.exports = ExtraDataManager; -},{}],16:[function(require,module,exports){ +},{}],17:[function(require,module,exports){ /** * @fileoverview Grid 의 Data Source 에 해당하는 Model 정의 * @author NHN Ent. FE Development Team @@ -3490,6 +3719,7 @@ module.exports = ExtraDataManager; var Model = require('../../base/model'); var ExtraDataManager = require('./extraDataManager'); var util = require('../../common/util'); +var classNameConst = require('../../common/classNameConst'); // Propertie names that indicate meta data var PRIVATE_PROPERTIES = [ @@ -3601,9 +3831,9 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ errorCode = this._validateCellData(columnName); if (errorCode) { - this.addCellClassName(columnName, 'invalid'); + this.addCellClassName(columnName, classNameConst.CELL_INVALID); } else { - this.removeCellClassName(columnName, 'invalid'); + this.removeCellClassName(columnName, classNameConst.CELL_INVALID); } this.validateMap[columnName] = errorCode; @@ -3699,18 +3929,18 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ classNameList.push(columnModel.className); } if (columnModel.isEllipsis) { - classNameList.push('ellipsis'); + classNameList.push(classNameConst.CELL_ELLIPSIS); } if (columnModel.isRequired) { - classNameList.push('required'); + classNameList.push(classNameConst.CELL_REQUIRED); } if (isMetaColumn) { - classNameList.push('meta_column'); + classNameList.push(classNameConst.CELL_HEAD); } else if (cellState.isEditable) { - classNameList.push('editable'); + classNameList.push(classNameConst.CELL_EDITABLE); } if (cellState.isDisabled) { - classNameList.push('disabled'); + classNameList.push(classNameConst.CELL_DISABLED); } return this._makeUniqueStringArray(classNameList); @@ -4031,7 +4261,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ module.exports = Row; -},{"../../base/model":5,"../../common/util":11,"./extraDataManager":15}],17:[function(require,module,exports){ +},{"../../base/model":5,"../../common/classNameConst":8,"../../common/util":12,"./extraDataManager":16}],18:[function(require,module,exports){ /** * @fileoverview Grid 의 Data Source 에 해당하는 Collection 정의 * @author NHN Ent. FE Development Team @@ -5139,7 +5369,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ module.exports = RowList; -},{"../../base/collection":3,"./row":16}],18:[function(require,module,exports){ +},{"../../base/collection":3,"./row":17}],19:[function(require,module,exports){ /** * @fileoverview 크기에 관련된 데이터를 다루는 모델 * @author NHN Ent. FE Development Team @@ -5344,6 +5574,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ }); } }); + return this._reduceExcessColumnWidthSub(_.clone(columnWidthList), totalExcessWidth, availableList); }, @@ -5376,6 +5607,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ return this._reduceExcessColumnWidthSub(columnWidthList, totalRemainWidth, newAvailableList); } columnIndexes = _.pluck(availableList, 'index'); + return this._distributeExtraWidthEqually(columnWidthList, totalRemainWidth, columnIndexes); }, @@ -5396,7 +5628,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ _.each(columnIndexes, function(columnIndex) { resultList[columnIndex] += avgValue; }); - resultList[_.last(columnIndexes)] -= errorValue; + + if (columnIndexes.length) { + resultList[_.last(columnIndexes)] -= errorValue; + } return resultList; }, @@ -5588,57 +5823,92 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ }, /** - * 계산한 cell 의 위치를 리턴한다. - * @param {Number|String} rowKey - 데이터의 키값 - * @param {String} columnName - 칼럼명 - * @returns {{top: number, left: number, right: number, bottom: number}} - cell의 위치 - * @todo TC + * Returns the horizontal position of the given column + * @param {String} columnName - column name + * @returns {{left: Number, right: Number}} + * @private */ - getCellPosition: function(rowKey, columnName) { - var dataModel = this.dataModel, - columnModel = this.columnModel, - rowHeight = this.get('rowHeight'), - row = dataModel.get(rowKey), - metaColumnCount = columnModel.getVisibleMetaColumnCount(), - columnWidthList = this.get('columnWidthList').slice(metaColumnCount), - columnFixCount = columnModel.getVisibleColumnFixCount(), - columnIdx = columnModel.indexOfColumnName(columnName, true), - rowSpanData, - rowIdx, spanCount, - top, left, right, bottom, i; + _getCellHorizontalPosition: function(columnName) { + var columnModel = this.columnModel; + var metaColumnCount = columnModel.getVisibleMetaColumnCount(); + var columnWidthList = this.get('columnWidthList'); + var leftColumnCount = columnModel.getVisibleColumnFixCount() + metaColumnCount; + var targetIdx = columnModel.indexOfColumnName(columnName, true) + metaColumnCount; + var idx = leftColumnCount > targetIdx ? 0 : leftColumnCount; + var left = 0; - if (!row) { - return {}; + for (; idx < targetIdx; idx += 1) { + left += columnWidthList[idx] + CELL_BORDER_WIDTH; } - rowSpanData = dataModel.get(rowKey).getRowSpanData(columnName); + return { + left: left, + right: left + columnWidthList[targetIdx] + CELL_BORDER_WIDTH + }; + }, + + /** + * Returns the vertical position of the given row + * @param {Number} rowKey - row key + * @param {Number} rowSpanCount - the count of rowspan + * @returns {{top: Number, bottom: Number}} + */ + _getCellVerticalPosition: function(rowKey, rowSpanCount) { + var dataModel = this.dataModel; + var rowHeight = this.get('rowHeight'); + var rowIdx = dataModel.indexOfRowKey(rowKey); + var top = util.getHeight(rowIdx, rowHeight); + var height = util.getHeight(rowSpanCount, rowHeight); + + return { + top: top, + bottom: top + height + }; + }, + + /** + * Returns the count of rowspan of given cell + * @param {Number} rowKey - row key + * @param {String} columnName - column name + * @returns {Number} + * @private + */ + _getRowSpanCount: function(rowKey, columnName) { + var rowSpanData = this.dataModel.get(rowKey).getRowSpanData(columnName); if (!rowSpanData.isMainRow) { rowKey = rowSpanData.mainRowKey; - rowSpanData = dataModel.get(rowKey).getRowSpanData(columnName); + rowSpanData = this.dataModel.get(rowKey).getRowSpanData(columnName); } - spanCount = rowSpanData.count || 1; + return rowSpanData.count || 1; + }, - rowIdx = dataModel.indexOfRowKey(rowKey); + /** + * 계산한 cell 의 위치를 리턴한다. + * @param {Number|String} rowKey - 데이터의 키값 + * @param {String} columnName - 칼럼명 + * @returns {{top: number, left: number, right: number, bottom: number}} - cell의 위치 + * @todo TC + */ + getCellPosition: function(rowKey, columnName) { + var rowSpanCount, vPos, hPos; - top = util.getHeight(rowIdx, rowHeight); - bottom = top + util.getHeight(spanCount, rowHeight) - CELL_BORDER_WIDTH; + rowKey = this.dataModel.getMainRowKey(rowKey, columnName); - left = i = 0; - if (columnFixCount <= columnIdx) { - i = columnFixCount; - } - for (; i < columnIdx; i += 1) { - left += columnWidthList[i] + CELL_BORDER_WIDTH; + if (!this.dataModel.get(rowKey)) { + return {}; } - right = left + columnWidthList[i] + CELL_BORDER_WIDTH; + + rowSpanCount = this._getRowSpanCount(rowKey, columnName); + vPos = this._getCellVerticalPosition(rowKey, rowSpanCount); + hPos = this._getCellHorizontalPosition(columnName); return { - top: top, - left: left, - right: right, - bottom: bottom + top: vPos.top, + bottom: vPos.bottom, + left: hPos.left, + right: hPos.right }; }, @@ -5649,10 +5919,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @returns {{scrollLeft: ?Number, scrollTop: ?Number}} Position to scroll */ getScrollPosition: function(rowKey, columnName) { - var isRsideColumn = !this.columnModel.isLside(columnName), - targetPosition = this.getCellPosition(rowKey, columnName), - bodySize = this._getBodySize(), - scrollDirection = this._judgeScrollDirection(targetPosition, isRsideColumn, bodySize); + var isRsideColumn = !this.columnModel.isLside(columnName); + var targetPosition = this.getCellPosition(rowKey, columnName); + var bodySize = this._getBodySize(); + var scrollDirection = this._judgeScrollDirection(targetPosition, isRsideColumn, bodySize); return this._makeScrollPosition(scrollDirection, targetPosition, bodySize); }, @@ -6057,16 +6327,16 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ module.exports = Dimension; -},{"../base/model":5,"../common/constMap":8,"../common/util":11}],19:[function(require,module,exports){ +},{"../base/model":5,"../common/constMap":9,"../common/util":12}],20:[function(require,module,exports){ /** * @fileoverview Focus 관련 데이터 처리름 담당한다. * @author NHN Ent. FE Development Team */ 'use strict'; -var Model = require('../base/model'), - util = require('../common/util'), - GridEvent = require('../common/gridEvent'); +var Model = require('../base/model'); +var util = require('../common/util'); +var GridEvent = require('../common/gridEvent'); /** * Focus model @@ -6344,9 +6614,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * Scroll to focus */ scrollToFocus: function() { - var rowKey = this.get('rowKey'), - columnName = this.get('columnName'), - scrollPosition = this.dimensionModel.getScrollPosition(rowKey, columnName); + var rowKey = this.get('rowKey'); + var columnName = this.get('columnName'); + var scrollPosition = this.dimensionModel.getScrollPosition(rowKey, columnName); if (!tui.util.isEmpty(scrollPosition)) { this.renderModel.set(scrollPosition); @@ -6454,12 +6724,21 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {Boolean} true if succeeded, false otherwise. */ startEditing: function(rowKey, columnName) { - if (this.get('editingAddress') || - !this.isCurrentCell(rowKey, columnName, true) || - !this.dataModel.get(rowKey).isEditable(columnName)) { + if (this.get('editingAddress')) { + return false; + } + + if (_.isUndefined(rowKey) && _.isUndefined(columnName)) { + rowKey = this.get('rowKey'); + columnName = this.get('columnName'); + } else if (!this.isCurrentCell(rowKey, columnName, true)) { return false; } + rowKey = this.dataModel.getMainRowKey(rowKey, columnName); + if (!this.dataModel.get(rowKey).isEditable(columnName)) { + return false; + } this.set('editingAddress', { rowKey: rowKey, columnName: columnName @@ -6708,7 +6987,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ module.exports = Focus; -},{"../base/model":5,"../common/gridEvent":10,"../common/util":11}],20:[function(require,module,exports){ +},{"../base/model":5,"../common/gridEvent":11,"../common/util":12}],21:[function(require,module,exports){ /** * @fileoverview Model Manager * @author NHN Ent. FE Development Team @@ -6921,7 +7200,7 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype module.exports = ModelManager; -},{"./data/columnModel":14,"./data/rowList":17,"./dimension":18,"./focus":19,"./renderer":22,"./renderer-smart":21,"./selection":25,"./toolbar":26}],21:[function(require,module,exports){ +},{"./data/columnModel":15,"./data/rowList":18,"./dimension":19,"./focus":20,"./renderer":23,"./renderer-smart":22,"./selection":26,"./toolbar":27}],22:[function(require,module,exports){ /** * @fileoverview 스마트 랜더링을 지원하는 Renderer 모ㄷ델 * @author NHN Ent. FE Development Team @@ -7060,7 +7339,7 @@ var SmartRenderer = Renderer.extend(/**@lends module:model/renderer-smart.protot module.exports = SmartRenderer; -},{"../common/util":11,"./renderer":22}],22:[function(require,module,exports){ +},{"../common/util":12,"./renderer":23}],23:[function(require,module,exports){ /** * @fileoverview Rendering 모델 * @author NHN Ent. FE Development Team @@ -7114,7 +7393,6 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ .listenTo(lside, 'valueChange', this._executeRelation) .listenTo(rside, 'valueChange', this._executeRelation) .listenTo(this.focusModel, 'change:editingAddress', this._onEditingAddressChange) - .listenTo(this.focusModel, 'focus blur', this._onFocusOrBlur) .listenTo(this.dimensionModel, 'change:width', this._updateMaxScrollLeft) .listenTo(this.dimensionModel, 'change:totalRowHeight change:scrollBarSize change:bodyHeight', this._updateMaxScrollTop); @@ -7195,21 +7473,6 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ } }, - /** - * Event handler for 'focus' and 'blur' events on focusModel - * @param {Number|String} rowKey - row key - * @param {String} columnName - column name - * @private - */ - _onFocusOrBlur: function(rowKey, columnName) { - var mainRowKey = this.dataModel.getMainRowKey(rowKey, columnName); - var rowModel = this._getRowModel(mainRowKey, columnName); - - if (rowModel) { - rowModel.updateClassName(columnName); - } - }, - /** * Event handler for 'change:editingAddress' event on focusModel * @param {module:model/focus} focusModel - focus model @@ -7381,6 +7644,7 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ _createViewDataFromDataModel: function(rowDataModel, columnNames, height, rowNum) { var viewData = { height: height, + rowNum: rowNum, rowKey: rowDataModel.get('rowKey'), _extraData: rowDataModel.get('_extraData') }; @@ -7442,7 +7706,7 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ for (i = startIndex; i <= endIndex; i += 1) { rowDataModel = this.dataModel.at(i); lsideData.push(this._createViewDataFromDataModel(rowDataModel, columnNamesMap.lside, height, rowNum)); - rsideData.push(this._createViewDataFromDataModel(rowDataModel, columnNamesMap.rside, height)); + rsideData.push(this._createViewDataFromDataModel(rowDataModel, columnNamesMap.rside, height, rowNum)); rowNum += 1; } @@ -7479,17 +7743,20 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _fillDummyRows: function() { - var displayRowCount = this.dimensionModel.get('displayRowCount'), - actualRowCount = this._getActualRowCount(), - dummyRowCount = Math.max(displayRowCount - actualRowCount, 0), - rowHeight = this.dimensionModel.get('rowHeight'); + var displayRowCount = this.dimensionModel.get('displayRowCount'); + var actualRowCount = this._getActualRowCount(); + var dummyRowCount = Math.max(displayRowCount - actualRowCount, 0); + var rowHeight = this.dimensionModel.get('rowHeight'); + var rowNum = this.get('endIndex') + 2; _.times(dummyRowCount, function() { _.each(['lside', 'rside'], function(listName) { this.get(listName).add({ - height: rowHeight + height: rowHeight, + rowNum: rowNum }); }, this); + rowNum += 1; }, this); this.set('dummyRowCount', dummyRowCount); @@ -7621,7 +7888,7 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ module.exports = Renderer; -},{"../base/model":5,"../common/constMap":8,"./rowList":24}],23:[function(require,module,exports){ +},{"../base/model":5,"../common/constMap":9,"./rowList":25}],24:[function(require,module,exports){ /** * @fileoverview Row Model for Rendering (View Model) * @author NHN Ent. FE Development Team @@ -7778,15 +8045,16 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ * @private */ _formatData: function(data, dataModel, columnModel, focusModel) { - var rowKey = data.rowKey, - columnData, row; + var rowKey = data.rowKey; + var rowNum = data.rowNum; + var columnData, row; if (_.isUndefined(rowKey)) { return data; } row = dataModel.get(rowKey); - columnData = _.omit(data, 'rowKey', '_extraData', 'height'); + columnData = _.omit(data, 'rowKey', '_extraData', 'height', 'rowNum'); _.each(columnData, function(value, columnName) { var rowSpanData = this._getRowSpanData(columnName, data, dataModel.isRowSpanEnable()), @@ -7796,6 +8064,7 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ data[columnName] = { rowKey: rowKey, + rowNum: rowNum, columnName: columnName, rowSpan: rowSpanData.count, isMainRow: rowSpanData.isMainRow, @@ -7803,7 +8072,6 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ isEditable: cellState.isEditable, isDisabled: cellState.isDisabled, isEditing: focusModel.isEditingCell(rowKey, columnName), - isFocused: focusModel.isCurrentCell(rowKey, columnName), optionList: tui.util.pick(column, 'editOption', 'list'), className: this._getClassNameString(columnName, row, focusModel), columnModel: column, @@ -7836,10 +8104,6 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ } classNames = row.getClassNameList(columnName); - if (focusModel.isCurrentCell(row.get('rowKey'), columnName, true)) { - classNames.push('focused'); - } - return classNames.join(' '); }, @@ -8037,7 +8301,7 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ module.exports = Row; -},{"../base/model":5,"../common/util":11}],24:[function(require,module,exports){ +},{"../base/model":5,"../common/util":12}],25:[function(require,module,exports){ /** * @fileoverview RowList 클래스파일 * @author NHN Ent. FE Development Team @@ -8071,7 +8335,7 @@ var RowList = Collection.extend(/**@lends module:model/rowList.prototype */{ module.exports = RowList; -},{"../base/collection":3,"./row":23}],25:[function(require,module,exports){ +},{"../base/collection":3,"./row":24}],26:[function(require,module,exports){ /** * @fileoverview Selection Model class * @author NHN Ent. FE Development Team @@ -8688,7 +8952,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ module.exports = Selection; -},{"../base/model":5,"../common/util":11}],26:[function(require,module,exports){ +},{"../base/model":5,"../common/util":12}],27:[function(require,module,exports){ /** * @fileoverview Toolbar model class * @author NHN Ent. FE Development Team @@ -8729,7 +8993,7 @@ var Toolbar = Model.extend(/**@lends module:model/toolbar.prototype */{ module.exports = Toolbar; -},{"../base/model":5}],27:[function(require,module,exports){ +},{"../base/model":5}],28:[function(require,module,exports){ /** * @fileoverview Painter class for cell(TD) views * @author NHN Ent. FE Development Team @@ -8738,7 +9002,8 @@ module.exports = Toolbar; var Painter = require('../base/painter'); var util = require('../common/util'); -var attrNameMap = require('../common/constMap').attrName; +var attrNameConst = require('../common/constMap').attrName; +var classNameConst = require('../common/classNameConst'); /** * Painter class for cell(TD) views @@ -8755,7 +9020,7 @@ var Cell = tui.util.defineClass(Painter, /**@lends module:painter/cell.prototype this.editType = options.editType; this.inputPainter = options.inputPainter; - this.selector = 'td[' + attrNameMap.EDIT_TYPE + '=' + this.editType + ']'; + this.selector = 'td[' + attrNameConst.EDIT_TYPE + '=' + this.editType + ']'; }, /** @@ -8810,9 +9075,9 @@ var Cell = tui.util.defineClass(Painter, /**@lends module:painter/cell.prototype content = this.inputPainter.generateHtml(cellData); if (this._shouldContentBeWrapped() && !this._isUsingViewMode(cellData)) { - beforeContent = this._getSpanWrapContent(beforeContent, 'before'); - afterContent = this._getSpanWrapContent(afterContent, 'after'); - content = this._getSpanWrapContent(content, 'input'); + beforeContent = this._getSpanWrapContent(beforeContent, classNameConst.CELL_CONTENT_BEFORE); + afterContent = this._getSpanWrapContent(afterContent, classNameConst.CELL_CONTENT_AFTER); + content = this._getSpanWrapContent(content, classNameConst.CELL_CONTENT_INPUT); return beforeContent + afterContent + content; } @@ -8862,14 +9127,20 @@ var Cell = tui.util.defineClass(Painter, /**@lends module:painter/cell.prototype * @private */ _getAttributes: function(cellData) { + var classNames = [ + cellData.className, + classNameConst.CELL, + classNameConst.CELL_CONTENT, + (cellData.rowNum % 2) ? classNameConst.CELL_ROW_ODD : classNameConst.CELL_ROW_EVEN + ]; var attrs = { - 'class': cellData.className + ' cell_content', 'align': cellData.columnModel.align || 'left' }; + attrs['class'] = classNames.join(' '); - attrs[attrNameMap.EDIT_TYPE] = this.editType; - attrs[attrNameMap.ROW_KEY] = cellData.rowKey; - attrs[attrNameMap.COLUMN_NAME] = cellData.columnName; + attrs[attrNameConst.EDIT_TYPE] = this.editType; + attrs[attrNameConst.ROW_KEY] = cellData.rowKey; + attrs[attrNameConst.COLUMN_NAME] = cellData.columnName; if (cellData.rowSpan) { attrs.rowspan = cellData.rowSpan; } @@ -8932,7 +9203,7 @@ var Cell = tui.util.defineClass(Painter, /**@lends module:painter/cell.prototype module.exports = Cell; -},{"../base/painter":6,"../common/constMap":8,"../common/util":11}],28:[function(require,module,exports){ +},{"../base/painter":6,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],29:[function(require,module,exports){ /** * @fileoverview Controller class to handle actions from the painters * @author NHN Ent. FE Development Team @@ -9069,7 +9340,7 @@ var PainterController = tui.util.defineClass(/**@lends module:painter/controller module.exports = PainterController; -},{}],29:[function(require,module,exports){ +},{}],30:[function(require,module,exports){ /** * @fileoverview Dummy cell painter * @author NHN Ent. FE Development Team @@ -9078,7 +9349,8 @@ module.exports = PainterController; var Painter = require('../base/painter'); var util = require('../common/util'); -var attrNameMap = require('../common/constMap').attrName; +var attrNameConst = require('../common/constMap').attrName; +var classNameConst = require('../common/classNameConst'); /** * Dummy Cell Painter @@ -9105,16 +9377,17 @@ var DummyCell = tui.util.defineClass(Painter, /**@lends module:painter/dummyCell * css selector to find its own element(s) from a parent element. * @type {String} */ - selector: 'td[' + attrNameMap.EDIT_TYPE + '=dummy]', + selector: 'td[' + attrNameConst.EDIT_TYPE + '=dummy]', /** * Template function * @returns {String} HTML string */ template: _.template( - '="<%=columnName%>" ' + - 'class="<%=className%>" ' + - '<%=attrEditType%>="dummy">' + + '' + '​' + // 'for height issue with empty cell in IE7 '' ), @@ -9129,25 +9402,32 @@ var DummyCell = tui.util.defineClass(Painter, /**@lends module:painter/dummyCell /** * Generates a HTML string from given data, and returns it. + * @param {Number} rowNum - row number * @param {String} columnName - column name * @returns {string} HTML string * @implements {module:base/painter} */ - generateHtml: function(columnName) { - var isMeta = util.isMetaColumn(columnName); + generateHtml: function(rowNum, columnName) { + var classNames = [ + classNameConst.CELL, + classNameConst.CELL_DUMMY, + (rowNum % 2) ? classNameConst.CELL_ROW_ODD : classNameConst.CELL_ROW_EVEN + ]; + + if (util.isMetaColumn(columnName)) { + classNames.push(classNameConst.CELL_HEAD); + } return this.template({ - attrColumnName: attrNameMap.COLUMN_NAME, - attrEditType: attrNameMap.EDIT_TYPE, columnName: columnName, - className: (isMeta ? 'meta_column ' : '') + 'dummy' + className: classNames.join(' ') }); } }); module.exports = DummyCell; -},{"../base/painter":6,"../common/constMap":8,"../common/util":11}],30:[function(require,module,exports){ +},{"../base/painter":6,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],31:[function(require,module,exports){ /** * @fileoverview Base class for the Input Painter * @author NHN Ent. FE Development Team @@ -9228,7 +9508,7 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ }, /** - * Event handler for the 'focus' event. + * Event handler for the 'focusin' event. * @param {Event} event - DOM event object * @private */ @@ -9240,7 +9520,7 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ }, /** - * Event handler for the 'blur' event. + * Event handler for the 'focusout' event. * @param {Event} event - DOM event object * @private */ @@ -9340,7 +9620,7 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ module.exports = InputPainter; -},{"../../base/painter":6,"../../common/constMap":8}],31:[function(require,module,exports){ +},{"../../base/painter":6,"../../common/constMap":9}],32:[function(require,module,exports){ /** * @fileoverview Painter class for 'checkbox' and 'radio button'. * @author NHN Ent. FE Development Team @@ -9596,7 +9876,7 @@ var ButtonPainter = tui.util.defineClass(InputPainter, /**@lends module:painter/ module.exports = ButtonPainter; -},{"../../common/util":11,"./base":30}],32:[function(require,module,exports){ +},{"../../common/util":12,"./base":31}],33:[function(require,module,exports){ /** * @fileoverview Main Button Painter * @author NHN Ent. FE Development Team @@ -9604,6 +9884,7 @@ module.exports = ButtonPainter; 'use strict'; var Painter = require('../../base/painter'); +var classNameConst = require('../../common/classNameConst'); /** * Main Button Painter @@ -9619,7 +9900,7 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ init: function(options) { Painter.apply(this, arguments); - this.selector = 'input.main_button'; + this.selector = 'input.' + classNameConst.CELL_MAIN_BUTTON; this.inputType = options.inputType; this.gridId = options.gridId; }, @@ -9637,7 +9918,8 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ * @returns {String} */ template: _.template( - ' />' + ' />' ), /** @@ -9669,7 +9951,7 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ module.exports = InputPainter; -},{"../../base/painter":6}],33:[function(require,module,exports){ +},{"../../base/painter":6,"../../common/classNameConst":8}],34:[function(require,module,exports){ /** * @fileoverview Painter class for 'select' input. * @author NHN Ent. FE Development Team @@ -9755,7 +10037,7 @@ var SelectPainter = tui.util.defineClass(InputPainter, /**@lends module:painter/ module.exports = SelectPainter; -},{"../../common/util":11,"./base":30}],34:[function(require,module,exports){ +},{"../../common/util":12,"./base":31}],35:[function(require,module,exports){ /** * @fileoverview Painter class for the 'input[type=text]' and 'input[type=password]'. * @author NHN Ent. FE Development Team @@ -9878,7 +10160,7 @@ var TextPainter = tui.util.defineClass(InputPainter, /**@lends module:painter/in module.exports = TextPainter; -},{"../../common/util":11,"./base":30}],35:[function(require,module,exports){ +},{"../../common/util":12,"./base":31}],36:[function(require,module,exports){ /** * @fileoverview Painter Manager * @author NHN Ent. FE Development Team @@ -10029,7 +10311,7 @@ var PainterManager = tui.util.defineClass(/**@lends module:painter/manager.proto module.exports = PainterManager; -},{"./cell":27,"./dummyCell":29,"./input/button":31,"./input/mainButton":32,"./input/select":33,"./input/text":34,"./row":36}],36:[function(require,module,exports){ +},{"./cell":28,"./dummyCell":30,"./input/button":32,"./input/mainButton":33,"./input/select":34,"./input/text":35,"./row":37}],37:[function(require,module,exports){ /** * @fileoverview Painter class for the row(TR) views * @author NHN Ent. FE Development Team @@ -10038,7 +10320,9 @@ module.exports = PainterManager; var Painter = require('../base/painter'); var util = require('../common/util'); -var attrNameMap = require('../common/constMap').attrName; +var constMap = require('../common/constMap'); +var attrNameConst = constMap.attrName; +var CELL_BORDER_WIDTH = constMap.dimension.CELL_BORDER_WIDTH; /** * Painter class for the row(TR) views @@ -10090,16 +10374,17 @@ var RowPainter = tui.util.defineClass(Painter, /**@lends module:painter/row.prot /** * Returns the HTML string of all cells in Dummy row. - * @param {Array.} columnNames - An array of column names + * @param {Number} rowNum - row number + * @param {Array.} columnNames - An array of column names * @returns {String} HTLM string * @private */ - _generateHtmlForDummyRow: function(columnNames) { + _generateHtmlForDummyRow: function(rowNum, columnNames) { var cellPainter = this.painterManager.getCellPainter('dummy'), html = ''; _.each(columnNames, function(columnName) { - html += cellPainter.generateHtml(columnName); + html += cellPainter.generateHtml(rowNum, columnName); }); return html; @@ -10136,21 +10421,23 @@ var RowPainter = tui.util.defineClass(Painter, /**@lends module:painter/row.prot * @returns {String} HTLM string */ generateHtml: function(model, columnNames) { - var rowKey = model.get('rowKey'), - html; + var rowKey = model.get('rowKey'); + var rowNum = model.get('rowNum'); + var className = ''; + var html; if (_.isUndefined(rowKey)) { - html = this._generateHtmlForDummyRow(columnNames); + html = this._generateHtmlForDummyRow(rowNum, columnNames); } else { html = this._generateHtmlForActualRow(model, columnNames); } return this.template({ - rowKeyAttrName: attrNameMap.ROW_KEY, + rowKeyAttrName: attrNameConst.ROW_KEY, rowKey: rowKey, - height: model.get('height') + RowPainter._extraHeight, + height: model.get('height') + RowPainter._extraHeight + CELL_BORDER_WIDTH, contents: html, - className: '' + className: className }); }, @@ -10164,7 +10451,7 @@ var RowPainter = tui.util.defineClass(Painter, /**@lends module:painter/row.prot var editType, cellPainter, $td; if (columnName !== '_extraData') { - $td = $tr.find('td[' + attrNameMap.COLUMN_NAME + '=' + columnName + ']'); + $td = $tr.find('td[' + attrNameConst.COLUMN_NAME + '=' + columnName + ']'); editType = this._getEditType(columnName, cellData); cellPainter = this.painterManager.getCellPainter(editType); cellPainter.refresh(cellData, $td); @@ -10191,7 +10478,7 @@ var RowPainter = tui.util.defineClass(Painter, /**@lends module:painter/row.prot module.exports = RowPainter; -},{"../base/painter":6,"../common/constMap":8,"../common/util":11}],37:[function(require,module,exports){ +},{"../base/painter":6,"../common/constMap":9,"../common/util":12}],38:[function(require,module,exports){ /** * @fileoverview Public Event Emitter * @author NHN Ent. FE Development Team @@ -10290,146 +10577,765 @@ _.extend(PublicEventEmitter.prototype, Backbone.Events); module.exports = PublicEventEmitter; -},{}],38:[function(require,module,exports){ +},{}],39:[function(require,module,exports){ /** - * @fileoverview 키 이벤트 핸들링 담당하는 Clipboard 정의 - * @author NHN Ent. FE Development Team - */ +* @fileoverview CSS Rule string builder +* @author NHN Ent. FE Development Team +*/ 'use strict'; -var View = require('../base/view'); -var util = require('../common/util'); -var keyCodeMap = require('../common/constMap').keyCode; - /** - * Clipboard view class - * @module view/clipboard - * @extends module:base/view + * create css rule string and returns it + * @param {String} selector - css selector + * @param {String} property - css property + * @param {String} value - css value */ -var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ +var CSSRuleBuilder = tui.util.defineClass({ + init: function(selector) { + if (!_.isString(selector) || !selector) { + throw new Error('The Selector must be a string and not be empty.'); + } + this._selector = selector; + this._propValues = []; + }, + /** - * @constructs - * @param {Object} options - Options + * Add a set of css property and value. + * @param {String} property - css property + * @param {String} value - css value + * @returns {CSSRuleBuilder} */ - initialize: function(options) { - this.setOwnProperties({ - focusModel: options.focusModel, - selectionModel: options.selectionModel, - painterManager: options.painterManager, - dimensionModel: options.dimensionModel, - dataModel: options.dataModel, - columnModel: options.columnModel, - renderModel: options.renderModel, - timeoutIdForKeyIn: 0, - isLocked: false - }); - this.listenTo(this.focusModel, 'focusClipboard', this._onFocus); + add: function(property, value) { + if (value) { + this._propValues.push(property + ':' + value); + } + return this; }, - tagName: 'textarea', + /** + * Shortcut for add('border-color', value) + * @param {String} value - css value + * @returns {CSSRuleBuilder} + */ + border: function(value) { + return this.add('border-color', value); + }, - className: 'clipboard', + /** + * Add a border-width style to the rule. + * @param {Object} options - visible options + * @param {Boolean} [options.showVerticalBorder] - whether the vertical border is visible + * @param {Boolean} [options.showHorizontalBorder] - whether the horizontal border is visible + * @returns {CSSRuleBuilder} + */ + borderWidth: function(options) { + var vertical = options.showVerticalBorder; + var horizontal = options.showHorizontalBorder; + var value; - events: { - 'keydown': '_onKeyDown', - 'blur': '_onBlur' + if (_.isBoolean(vertical)) { + value = vertical ? '1px' : '0'; + this.add('border-left-width', value) + .add('border-right-width', value); + } + if (_.isBoolean(horizontal)) { + value = horizontal ? '1px' : '0'; + this.add('border-top-width', value) + .add('border-bottom-width', value); + } + return this; }, /** - * Event handler for blur event. - * @private + * Shortcut for add('background-color', value) + * @param {String} value - css value + * @returns {CSSRuleBuilder} */ - _onBlur: function() { - var focusModel = this.focusModel; - setTimeout(function() { - focusModel.refreshState(); - }, 0); + bg: function(value) { + return this.add('background-color', value); }, /** - * Event handler for 'focusClipboard' event on focusModel - * @private + * Shortcut for add('color', value) + * @param {String} value - css value + * @returns {CSSRuleBuilder} */ - _onFocus: function() { - try { - if (!this.$el.is(':focus')) { - this.$el.focus(); - this.focusModel.refreshState(); - } - } catch (e) { - // Do nothing. - // This try/catch block is just for preventing 'Unspecified error' - // in IE9(and under) when running test using karma. - } + text: function(value) { + return this.add('color', value); }, /** - * 랜더링 한다. - * @returns {View.Clipboard} this object + * Create a CSS rule string with a selector and prop-values. + * @returns {String} */ - render: function() { - return this; - }, + build: function() { + var result = ''; + + if (this._propValues.length) { + result = this._selector + '{' + this._propValues.join(';') + '}'; + } + + return result; + } +}); +module.exports = { /** - * keyEvent 의 중복 호출을 방지하는 lock 을 설정한다. - * @private + * Creates new Builder instance. + * @param {String} selector - selector + * @returns {CSSRuleBuilder} */ - _lock: function() { - clearTimeout(this.timeoutIdForKeyIn); - this.isLocked = true; - this.timeoutIdForKeyIn = setTimeout($.proxy(this._unlock, this), 10); // eslint-disable-line no-magic-numbers + create: function(selector) { + return new CSSRuleBuilder(selector); }, /** - * keyEvent 의 중복 호출을 방지하는 lock 을 해제한다. - * @private + * Creates a new Builder instance with a class name selector. + * @param {String} className - class name + * @returns {Builder} */ - _unlock: function() { - this.isLocked = false; + createClassRule: function(className) { + return this.create('.' + className); }, /** - * keyDown 이벤트 핸들러 - * @param {Event} keyDownEvent 이벤트 객체 - * @private + * Creates an array of new Builder instances for the -webkit-scrollbar styles. + * @param {String} selector - selector + * @param {Object} options - options + * @returns {Array.} */ - _onKeyDown: function(keyDownEvent) { - if (this.isLocked) { - keyDownEvent.preventDefault(); - return; - } + createWebkitScrollbarRules: function(selector, options) { + return [ + this.create(selector + ' ::-webkit-scrollbar').bg(options.background), + this.create(selector + ' ::-webkit-scrollbar-thumb').bg(options.thumb), + this.create(selector + ' ::-webkit-scrollbar-thumb:hover').bg(options.active) + ]; + }, - if (keyDownEvent.shiftKey && (keyDownEvent.ctrlKey || keyDownEvent.metaKey)) { - this._keyInWithShiftAndCtrl(keyDownEvent); - } else if (keyDownEvent.shiftKey) { - this._keyInWithShift(keyDownEvent); - } else if (keyDownEvent.ctrlKey || keyDownEvent.metaKey) { - this._keyInWithCtrl(keyDownEvent); - } else { - this._keyIn(keyDownEvent); - } - this._lock(); + /** + * Creates a builder instance for the IE scrollbar styles. + * @param {String} selector - selector + * @param {Object} options - options + * @returns {Array.} + */ + createIEScrollbarRule: function(selector, options) { + var bgProps = [ + 'scrollbar-3dlight-color', + 'scrollbar-darkshadow-color', + 'scrollbar-track-color', + 'scrollbar-shadow-color' + ]; + var thumbProps = [ + 'scrollbar-face-color', + 'scrollbar-highlight-color' + ]; + var ieScrollbarRule = this.create(selector); + + _.each(bgProps, function(prop) { + ieScrollbarRule.add(prop, options.background); + }); + _.each(thumbProps, function(prop) { + ieScrollbarRule.add(prop, options.thumb); + }); + ieScrollbarRule.add('scrollbar-arrow-color', options.active); + + return ieScrollbarRule; }, /** - * ctrl, shift 둘다 눌리지 않은 상태에서의 key down 이벤트 핸들러 - * @param {Event} keyDownEvent 이벤트 객체 - * @private + * Build all rules and returns the concatenated string. + * @param {Array.} rules - rule builders + * @returns {String} */ - _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; - - if (util.isBlank(focused.rowKey)) { - return; - } + buildAll: function(rules) { + return _.map(rules, function(rule) { + return rule.build(); + }).join(''); + } +}; + +},{}],40:[function(require,module,exports){ +/** +* @fileoverview theme manager +* @author NHN Ent. FE Development Team +*/ +'use strict'; + +var util = require('../common/util'); +var styleGen = require('./styleGenerator'); +var themeNameConst = require('../common/constMap').themeName; + +var STYLE_ELEMENT_ID = 'tui-grid-theme-style'; + +var presetOptions = {}; +presetOptions[themeNameConst.DEFAULT] = require('./preset/default'); +presetOptions[themeNameConst.STRIPED] = require('./preset/striped'); +presetOptions[themeNameConst.CLEAN] = require('./preset/clean'); + +/** + * build css string with given options. + * @param {Object} options - options + * @returns {String} + */ +function buildCssString(options) { + var styles = [ + styleGen.grid(options.grid), + styleGen.scrollbar(options.scrollbar), + styleGen.toolbar(options.toolbar), + styleGen.selection(options.selection) + ]; + var cell = options.cell; + + if (cell) { + styles = styles.concat([ + styleGen.cell(cell.normal), + styleGen.cellDummy(cell.dummy), + styleGen.cellEditable(cell.editable), + styleGen.cellEvenRow(cell.evenRow), + styleGen.cellHead(cell.head), + styleGen.cellRequired(cell.required), + styleGen.cellDisabled(cell.disabled), + styleGen.cellInvalid(cell.invalid), + styleGen.cellCurrentRow(cell.currentRow), + styleGen.cellSelectedHead(cell.selectedHead), + styleGen.cellFocused(cell.focused) + ]); + } + + return styles.join(''); +} + +/** + * Set document style with given options. + * @param {Object} options - options + */ +function setDocumentStyle(options) { + var cssString = buildCssString(options); + + $('#' + STYLE_ELEMENT_ID).remove(); + util.appendStyleElement(STYLE_ELEMENT_ID, cssString); +} + +module.exports = { + /** + * Creates a style element using theme options identified by given name, + * and appends it to the document. + * @param {String} themeName - preset theme name + * @param {Object} extOptions - if exist, extend preset theme options with it. + */ + apply: function(themeName, extOptions) { + var options = presetOptions[themeName]; + + if (!options) { + options = presetOptions[themeNameConst.DEFAULT]; + } + options = $.extend(true, {}, options, extOptions); + setDocumentStyle(options); + }, + + /** + * Returns whether the style of a theme is applied. + * @returns {Boolean} + */ + isApplied: function() { + return $('#' + STYLE_ELEMENT_ID).length === 1; + } +}; + +},{"../common/constMap":9,"../common/util":12,"./preset/clean":41,"./preset/default":42,"./preset/striped":43,"./styleGenerator":44}],41:[function(require,module,exports){ +/** +* @fileoverview default theme preset +* @author NHN Ent. FE Development Team +*/ +'use strict'; + +var presetDefault = require('./default'); + +module.exports = $.extend(true, {}, presetDefault, { + grid: { + border: '#c0c0c0' + }, + toolbar: { + border: '#e0e0e0' + }, + cell: { + normal: { + background: '#fff', + border: '#e0e0e0', + showVerticalBorder: false, + showHorizontalBorder: true + }, + head: { + background: '#fff', + border: '#e0e0e0', + showVerticalBorder: false, + showHorizontalBorder: true + }, + selectedHead: { + background: '#e0e0e0' + } + } +}); + +},{"./default":42}],42:[function(require,module,exports){ +/** +* @fileoverview default theme preset +* @author NHN Ent. FE Development Team +*/ +'use strict'; + +module.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: true, + showHorizontalBorder: true + }, + head: { + background: '#eee', + border: '#ccc', + showVerticalBorder: true, + showHorizontalBorder: true + }, + 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(require,module,exports){ +/** +* @fileoverview default theme preset +* @author NHN Ent. FE Development Team +*/ +'use strict'; + +var presetDefault = require('./default'); + +module.exports = $.extend(true, {}, presetDefault, { + cell: { + normal: { + background: '#fff', + border: '#e8e8e8', + showVerticalBorder: false, + showHorizontalBorder: false + }, + evenRow: { + background: '#f3f3f3' + }, + head: { + showVerticalBorder: true, + showHorizontalBorder: true + } + } +}); + +},{"./default":42}],44:[function(require,module,exports){ +/** +* @fileoverview css style generator +* @author NHN Ent. FE Development Team +*/ +'use strict'; + +var builder = require('./cssRuleBuilder'); +var classNameConst = require('../common/classNameConst'); + +/** + * Shortcut for the builder.createClassRule() method. + */ +var classRule = _.bind(builder.createClassRule, builder); + +/** + * Creates a rule string for background and text colors. + * @param {String} className - class name + * @param {Objecr} options - options + * @returns {String} + */ +function bgTextRuleString(className, options) { + return classRule(className) + .bg(options.background) + .text(options.text) + .build(); +} + +module.exports = { + /** + * Generates a css string for the grid. + * @param {Object} options - options + * @returns {String} + */ + grid: function(options) { + var containerRule = classRule(classNameConst.CONTAINER) + .bg(options.background) + .border(options.border) + .text(options.text); + 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); + var scrollHeadRule = classRule(classNameConst.SCROLLBAR_HEAD).border(options.border); + var scrollBorderRule = classRule(classNameConst.SCROLLBAR_BORDER).bg(options.border); + + return builder.buildAll([ + containerRule, + tableRule, + headRule, + borderLineRule, + scrollHeadRule, + scrollBorderRule + ]); + }, + + /** + * Generates a css string for scrollbars. + * @param {Object} options - options + * @returns {String} + */ + scrollbar: function(options) { + var webkitScrollbarRules = builder.createWebkitScrollbarRules('.' + classNameConst.CONTAINER, options); + var ieScrollbarRule = builder.createIEScrollbarRule('.' + classNameConst.CONTAINER, options); + var rightBottomRule = classRule(classNameConst.SCROLLBAR_RIGHT_BOTTOM).bg(options.background); + var leftBottomRule = classRule(classNameConst.SCROLLBAR_LEFT_BOTTOM).bg(options.background); + var scrollHeadRule = classRule(classNameConst.SCROLLBAR_HEAD).bg(options.background); + + return builder.buildAll(webkitScrollbarRules.concat([ + ieScrollbarRule, + rightBottomRule, + leftBottomRule, + scrollHeadRule + ])); + }, + + /** + * Generates a css string for a toolbar. + * @param {Object} options - options + * @returns {String} + */ + toolbar: function(options) { + var toolbarRule = classRule(classNameConst.TOOLBAR) + .bg(options.background) + .border(options.border); + + var resizeHandleRule = classRule(classNameConst.HEIGHT_RESIZE_HANDLE) + .border(options.border); + + return builder.buildAll([ + toolbarRule, + resizeHandleRule + ]); + }, + + /** + * Generates a css string for selection layers. + * @param {Object} options - options + * @returns {String} + */ + selection: function(options) { + return classRule(classNameConst.LAYER_SELECTION) + .bg(options.background) + .border(options.border) + .build(); + }, + + /** + * Generates a css string for table cells. + * @param {Object} options - options + * @returns {String} + */ + cell: function(options) { + var cellRule = classRule(classNameConst.CELL) + .bg(options.background) + .border(options.border) + .borderWidth(options) + .text(options.text); + + return cellRule.build(); + }, + + /* + * Generates a css string for head cells. + * @param {Object} options - options + * @returns {String} + */ + cellHead: function(options) { + var headRule = classRule(classNameConst.CELL_HEAD) + .bg(options.background) + .border(options.border) + .borderWidth(options) + .text(options.text); + + return headRule.build(); + }, + + /** + * Generates a css string for the cells in even rows. + * @param {Object} options - options + * @returns {String} + */ + cellEvenRow: function(options) { + return classRule(classNameConst.CELL_ROW_EVEN) + .bg(options.background) + .build(); + }, + + /** + * Generates a css string for selected head cells. + * @param {Object} options - options + * @returns {String} + */ + cellSelectedHead: function(options) { + return builder.create('.' + classNameConst.CELL_HEAD + '.' + classNameConst.CELL_SELECTED) + .bg(options.background) + .text(options.text) + .build(); + }, + + /** + * Generates a css string for focused cells. + * @param {Object} options - options + * @returns {String} + */ + cellFocused: function(options) { + var focusLayerRule = classRule(classNameConst.LAYER_FOCUS_BORDER).bg(options.border); + var editingLayerRule = classRule(classNameConst.LAYER_EDITING).border(options.border); + + return builder.buildAll([focusLayerRule, editingLayerRule]); + }, + + /** + * Generates a css string for editable cells. + * @param {Object} options - options + * @returns {String} + */ + cellEditable: function(options) { + return bgTextRuleString(classNameConst.CELL_EDITABLE, options); + }, + + /** + * Generates a css string for required cells. + * @param {Object} options - options + * @returns {String} + */ + cellRequired: function(options) { + return bgTextRuleString(classNameConst.CELL_REQUIRED, options); + }, + + /** + * Generates a css string for disabled cells. + * @param {Object} options - options + * @returns {String} + */ + cellDisabled: function(options) { + return bgTextRuleString(classNameConst.CELL_DISABLED, options); + }, + + /** + * Generates a css string for dummy cells. + * @param {Object} options - options + * @returns {String} + */ + cellDummy: function(options) { + return bgTextRuleString(classNameConst.CELL_DUMMY, options); + }, + + /** + * Generates a css string for invalid cells. + * @param {Object} options - options + * @returns {String} + */ + cellInvalid: function(options) { + return bgTextRuleString(classNameConst.CELL_INVALID, options); + }, + + /** + * Generates a css string for cells in a current row. + * @param {Object} options - options + * @returns {String} + */ + cellCurrentRow: function(options) { + return bgTextRuleString(classNameConst.CELL_CURRENT_ROW, options); + } +}; + +},{"../common/classNameConst":8,"./cssRuleBuilder":39}],45:[function(require,module,exports){ +/** + * @fileoverview 키 이벤트 핸들링 담당하는 Clipboard 정의 + * @author NHN Ent. FE Development Team + */ +'use strict'; + +var View = require('../base/view'); +var util = require('../common/util'); +var keyCodeMap = require('../common/constMap').keyCode; +var classNameConst = require('../common/classNameConst'); + +/** + * Clipboard view class + * @module view/clipboard + * @extends module:base/view + */ +var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ + /** + * @constructs + * @param {Object} options - Options + */ + initialize: function(options) { + this.setOwnProperties({ + focusModel: options.focusModel, + selectionModel: options.selectionModel, + painterManager: options.painterManager, + dimensionModel: options.dimensionModel, + dataModel: options.dataModel, + columnModel: options.columnModel, + renderModel: options.renderModel, + timeoutIdForKeyIn: 0, + isLocked: false + }); + this.listenTo(this.focusModel, 'focusClipboard', this._onFocus); + }, + + tagName: 'textarea', + + className: classNameConst.CLIPBOARD, + + events: { + 'keydown': '_onKeyDown', + 'blur': '_onBlur' + }, + + /** + * Event handler for blur event. + * @private + */ + _onBlur: function() { + var focusModel = this.focusModel; + setTimeout(function() { + focusModel.refreshState(); + }, 0); + }, + + /** + * Event handler for 'focusClipboard' event on focusModel + * @private + */ + _onFocus: function() { + try { + if (!this.$el.is(':focus')) { + this.$el.focus(); + this.focusModel.refreshState(); + } + } catch (e) { + // Do nothing. + // This try/catch block is just for preventing 'Unspecified error' + // in IE9(and under) when running test using karma. + } + }, + + /** + * 랜더링 한다. + * @returns {View.Clipboard} this object + */ + render: function() { + return this; + }, + + /** + * keyEvent 의 중복 호출을 방지하는 lock 을 설정한다. + * @private + */ + _lock: function() { + clearTimeout(this.timeoutIdForKeyIn); + this.isLocked = true; + this.timeoutIdForKeyIn = setTimeout($.proxy(this._unlock, this), 10); // eslint-disable-line no-magic-numbers + }, + + /** + * keyEvent 의 중복 호출을 방지하는 lock 을 해제한다. + * @private + */ + _unlock: function() { + this.isLocked = false; + }, + + /** + * keyDown 이벤트 핸들러 + * @param {Event} keyDownEvent 이벤트 객체 + * @private + */ + _onKeyDown: function(keyDownEvent) { + if (this.isLocked) { + keyDownEvent.preventDefault(); + return; + } + + if (keyDownEvent.shiftKey && (keyDownEvent.ctrlKey || keyDownEvent.metaKey)) { + this._keyInWithShiftAndCtrl(keyDownEvent); + } else if (keyDownEvent.shiftKey) { + this._keyInWithShift(keyDownEvent); + } else if (keyDownEvent.ctrlKey || keyDownEvent.metaKey) { + this._keyInWithCtrl(keyDownEvent); + } else { + this._keyIn(keyDownEvent); + } + this._lock(); + }, + + /** + * ctrl, shift 둘다 눌리지 않은 상태에서의 key down 이벤트 핸들러 + * @param {Event} keyDownEvent 이벤트 객체 + * @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; + + if (util.isBlank(focused.rowKey)) { + return; + } switch (keyCode) { case keyCodeMap.UP_ARROW: @@ -10800,7 +11706,7 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ module.exports = Clipboard; -},{"../base/view":7,"../common/constMap":8,"../common/util":11}],39:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],46:[function(require,module,exports){ /** * @fileoverview View class that conaints a top element of the DOM structure of the grid. * @author NHN Ent. FE Development Team @@ -10809,7 +11715,8 @@ module.exports = Clipboard; var View = require('../base/view'); var GridEvent = require('../common/gridEvent'); -var attrNameMap = require('../common/constMap').attrName; +var attrNameConst = require('../common/constMap').attrName; +var classNameConst = require('../common/classNameConst'); /** * Container View @@ -10991,7 +11898,10 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ _isCellElement: function($target, isIncludeChild) { var $cell = isIncludeChild ? $target.closest('td') : $target; - return !!($cell.is('td') && $cell.attr(attrNameMap.COLUMN_NAME) && $cell.parent().attr(attrNameMap.ROW_KEY)); + return !!($cell.is('td') && + $cell.attr(attrNameConst.COLUMN_NAME) && + $cell.parent().attr(attrNameConst.ROW_KEY) + ); }, /** @@ -11001,8 +11911,8 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ * @returns {{rowKey: string, rowData: Data.Row, columnName: string}} 셀 관련 정보를 담은 객체 */ _getCellInfoFromElement: function($cell) { - var rowKey = Number($cell.attr(attrNameMap.ROW_KEY)); - var columnName = $cell.attr(attrNameMap.COLUMN_NAME); + var rowKey = Number($cell.attr(attrNameConst.ROW_KEY)); + var columnName = $cell.attr(attrNameConst.COLUMN_NAME); return { rowKey: rowKey, @@ -11045,13 +11955,19 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ */ render: function() { var childElements = this._renderChildren().concat([ - $('
').addClass('left_line'), - $('
').addClass('right_line') + $('
').addClass(classNameConst.BORDER_LINE + ' ' + classNameConst.BORDER_TOP), + $('
').addClass(classNameConst.BORDER_LINE + ' ' + classNameConst.BORDER_LEFT), + $('
').addClass(classNameConst.BORDER_LINE + ' ' + classNameConst.BORDER_RIGHT) ]); - this.$el.addClass('grid_wrapper uio_grid') - .attr('data-grid-id', this.gridId) + + 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'); @@ -11064,9 +11980,15 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ */ _appendBottomLine: function() { var bottomPos = this.dimensionModel.get('toolbarHeight') + this.dimensionModel.getScrollXHeight(); - if (bottomPos) { - this.$el.append($('
').addClass('data_bottom_line').css('bottom', bottomPos)); + 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); }, /** @@ -11084,7 +12006,7 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ module.exports = Container; -},{"../base/view":7,"../common/constMap":8,"../common/gridEvent":10}],40:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/gridEvent":11}],47:[function(require,module,exports){ /** * @fileoverview Layer class that represents the state of rendering phase * @author NHN Ent. FE Development Team @@ -11093,7 +12015,8 @@ module.exports = Container; var View = require('../base/view'); var CELL_BORDER_WIDTH = require('../common/constMap').dimension.CELL_BORDER_WIDTH; -var attrNameMap = require('../common/constMap').attrName; +var attrNameConst = require('../common/constMap').attrName; +var classNameConst = require('../common/classNameConst'); /** * Layer class that represents the state of rendering phase. @@ -11113,7 +12036,7 @@ var EditingLayer = View.extend(/**@lends module:view/editingLayer.prototype */{ this.listenTo(this.renderModel, 'editingStateChanged', this._onEditingStateChanged); }, - className: 'editing_layer cell_content', + className: classNameConst.LAYER_EDITING + ' ' + classNameConst.CELL_CONTENT, /** * Starts editing the given cell. @@ -11128,8 +12051,8 @@ var EditingLayer = View.extend(/**@lends module:view/editingLayer.prototype */{ var painter = this.inputPainters[editType]; this.$el.html(painter.generateHtml(cellData)) - .attr(attrNameMap.ROW_KEY, rowKey) - .attr(attrNameMap.COLUMN_NAME, columnName) + .attr(attrNameConst.ROW_KEY, rowKey) + .attr(attrNameConst.COLUMN_NAME, columnName) .css(styleMap).show(); this._adjustLeftPosition(); @@ -11151,8 +12074,8 @@ var EditingLayer = View.extend(/**@lends module:view/editingLayer.prototype */{ * @private */ _finishEditing: function() { - this.$el.removeAttr(attrNameMap.ROW_KEY); - this.$el.removeAttr(attrNameMap.COLUMN_NAME); + this.$el.removeAttr(attrNameConst.ROW_KEY); + this.$el.removeAttr(attrNameConst.COLUMN_NAME); this.$el.empty().hide(); }, @@ -11170,6 +12093,27 @@ var EditingLayer = View.extend(/**@lends module:view/editingLayer.prototype */{ } }, + /** + * Adjust offset value of TD, because it varies from browsers to browsers when borders are callapsed. + * @param {Number} offsetValue - offset value (offset.top or offset.left) + * @returns {Number} + * @private + */ + _adjustCellOffsetValue: function(offsetValue) { + var browser = tui.util.browser; + var result = offsetValue; + + if (browser.msie) { + if (browser.version === 9) { + result = offsetValue - 1; + } else if (browser.version > 9) { + result = Math.floor(offsetValue); + } + } + + return result; + }, + /** * Calculates the position and the dimension of the layer and returns the object that contains css properties. * @param {Stirng} rowKey - row key @@ -11179,15 +12123,15 @@ var EditingLayer = View.extend(/**@lends module:view/editingLayer.prototype */{ * @private */ _calculateLayoutStyle: function(rowKey, columnName, expandable) { - var wrapperOffset = this.domState.getOffset(), - $cell = this.domState.getElement(rowKey, columnName), - cellOffset = $cell.offset(), - cellHeight = $cell.height(), - cellWidth = $cell.width() - (CELL_BORDER_WIDTH * 2); + var wrapperOffset = this.domState.getOffset(); + var $cell = this.domState.getElement(rowKey, columnName); + var cellOffset = $cell.offset(); + var cellHeight = $cell.height() + CELL_BORDER_WIDTH; + var cellWidth = $cell.width() + CELL_BORDER_WIDTH; return { - top: cellOffset.top - wrapperOffset.top, - left: cellOffset.left - wrapperOffset.left, + top: this._adjustCellOffsetValue(cellOffset.top) - wrapperOffset.top, + left: this._adjustCellOffsetValue(cellOffset.left) - wrapperOffset.left, height: cellHeight, minWidth: expandable ? cellWidth : '', width: expandable ? '' : cellWidth, @@ -11221,9 +12165,10 @@ var EditingLayer = View.extend(/**@lends module:view/editingLayer.prototype */{ } }); + module.exports = EditingLayer; -},{"../base/view":7,"../common/constMap":8}],41:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],48:[function(require,module,exports){ /** * @fileoverview View factory * @author NHN Ent. FE Development Team @@ -11246,6 +12191,7 @@ var BodyTableView = require('./layout/bodyTable'); var RowListView = require('./rowList'); var SelectionLayerView = require('./selectionLayer'); var EditingLayerView = require('./editingLayer'); +var FocusLayerView = require('./focusLayer'); /** * View Factory @@ -11472,12 +12418,171 @@ var ViewFactory = tui.util.defineClass({ inputPainters: this.painterManager.getInputPainters(true), domState: this.domState }); + }, + + /** + * Creates focus layer view and returns it. + * @param {String} whichSide - 'L'(left) or 'R'(right) + * @returns {module:view/focusLayer} New focus layer view instance + */ + createFocusLayer: function(whichSide) { + return new FocusLayerView({ + whichSide: whichSide, + dimensionModel: this.modelManager.dimensionModel, + columnModel: this.modelManager.columnModel, + focusModel: this.modelManager.focusModel + }); } }); module.exports = ViewFactory; -},{"./clipboard":38,"./container":39,"./editingLayer":40,"./layout/body":42,"./layout/bodyTable":43,"./layout/frame-lside":44,"./layout/frame-rside":45,"./layout/header":47,"./layout/resizeHandler":48,"./layout/toolbar":49,"./layout/toolbar/controlPanel":50,"./layout/toolbar/pagination":51,"./layout/toolbar/resizeHandler":52,"./rowList":53,"./selectionLayer":54,"./stateLayer":55}],42:[function(require,module,exports){ +},{"./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){ +/** + * @fileoverview Class for the layer view that represents the currently focused cell + * @author NHN Ent. FE Development Team + */ +'use strict'; + +var View = require('../base/view'); +var CELL_BORDER_WIDTH = require('../common/constMap').dimension.CELL_BORDER_WIDTH; +var classNameConst = require('../common/classNameConst'); + +var HTML_BORDER_DIV = '
'; + +/** + * Class for the layer view that represents the currently focused cell + * @module view/focusLayer + * @extends module:base/view + */ +var FocusLayer = View.extend(/**@lends module:view/focusLayer.prototype */{ + /** + * @constructs + * @param {Object} options - Options + */ + initialize: function(options) { + this.focusModel = options.focusModel; + this.columnModel = options.columnModel; + this.dimensionModel = options.dimensionModel; + this.whichSide = options.whichSide; + + this.borderEl = { + $top: $(HTML_BORDER_DIV), + $left: $(HTML_BORDER_DIV), + $right: $(HTML_BORDER_DIV), + $bottom: $(HTML_BORDER_DIV) + }; + + this.listenTo(this.dimensionModel, 'columnWidthChanged', this._onColumnWidthChanged); + this.listenTo(this.focusModel, 'blur', this._onBlur); + this.listenTo(this.focusModel, 'focus', this._onFocus); + // this.listenTo(this.focusModel, 'change:editingAddress', this._onChangeEditingAddress); + }, + + className: classNameConst.LAYER_FOCUS, + + /** + * Event handler for 'columnWidthChanged' event on the module:model/dimension + * @private + */ + _onColumnWidthChanged: function() { + var focusModel = this.focusModel; + + if (this.$el.is(':visible')) { + this._refreshBorderLayout(focusModel.get('rowKey'), focusModel.get('columnName')); + } + }, + + /** + * Event handler for 'blur' event on the module:model/focus + * @private + */ + _onBlur: function() { + this.$el.hide(); + }, + + /** + * Event handler for 'focus' event on module:model/focus + * @param {Number} rowKey - target row key + * @param {String} columnName - target column name + * @private + */ + _onFocus: function(rowKey, columnName) { + var targetSide = this.columnModel.isLside(columnName) ? 'L' : 'R'; + + if (targetSide === this.whichSide) { + this._refreshBorderLayout(rowKey, columnName); + this.$el.show(); + } + }, + + _onChangeEditingAddress: function(focusModel, address) { + if (address) { + this.$el.hide(); + } else { + this.$el.show(); + } + }, + + /** + * Resets the position and the dimension of the layer. + * @param {Number} rowKey - row key + * @param {String} columnName - column name + * @private + */ + _refreshBorderLayout: function(rowKey, columnName) { + var pos = this.dimensionModel.getCellPosition(rowKey, columnName); + var width = pos.right - pos.left; + var height = pos.bottom - pos.top; + + this.borderEl.$left.css({ + top: pos.top, + left: pos.left, + width: CELL_BORDER_WIDTH, + height: height + CELL_BORDER_WIDTH + }); + + this.borderEl.$top.css({ + top: pos.top === 0 ? CELL_BORDER_WIDTH : pos.top, + left: pos.left, + width: width + CELL_BORDER_WIDTH, + height: CELL_BORDER_WIDTH + }); + + this.borderEl.$right.css({ + top: pos.top, + left: pos.left + width, + width: CELL_BORDER_WIDTH, + height: height + CELL_BORDER_WIDTH + }); + + this.borderEl.$bottom.css({ + top: pos.top + height, + left: pos.left, + width: width + CELL_BORDER_WIDTH, + height: CELL_BORDER_WIDTH + }); + }, + + /** + * Render + * @returns {Object} this instance + */ + render: function() { + var $el = this.$el; + + _.each(this.borderEl, function($border) { + $el.append($border); + }); + $el.hide(); + + return this; + } +}); + +module.exports = FocusLayer; + +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],50:[function(require,module,exports){ /** * @fileoverview Class for the body layout * @author NHN Ent. FE Development Team @@ -11486,16 +12591,14 @@ module.exports = ViewFactory; var View = require('../../base/view'); var util = require('../../common/util'); -var attrNameMap = require('../../common/constMap').attrName; +var attrNameConst = require('../../common/constMap').attrName; +var classNameConst = require('../../common/classNameConst'); +// Minimum time (ms) to detect if an alert or confirm dialog has been displayed. +var MIN_INTERVAL_FOR_PAUSED = 200; -var HTML_CONTAINER = '
', - - // Minimum time (ms) to detect if an alert or confirm dialog has been displayed. - MIN_INTERVAL_FOR_PAUSED = 200, - - // Minimum distance (pixel) to detect if user wants to drag when moving mouse with button pressed. - MIN_DISATNCE_FOR_DRAG = 10; +// Minimum distance (pixel) to detect if user wants to drag when moving mouse with button pressed. +var MIN_DISATNCE_FOR_DRAG = 10; /** * Class for the body layout @@ -11531,13 +12634,14 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ .listenTo(this.renderModel, 'change:scrollLeft', this._onScrollLeftChange); }, - tagName: 'div', + className: classNameConst.BODY_AREA, - className: 'data', + events: function() { + var hash = {}; + hash.scroll = '_onScroll'; + hash['mousedown .' + classNameConst.BODY_CONTAINER] = '_onMouseDown'; - events: { - 'scroll': '_onScroll', - 'mousedown .body_container': '_onMouseDown' + return hash; }, /** @@ -11615,17 +12719,17 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ * @private */ _onMouseDown: function(event) { - var columnModel = this.columnModel, - $target = $(event.target), - $td = $target.closest('td'), - $tr = $target.closest('tr'), - columnName = $td.attr(attrNameMap.COLUMN_NAME), - rowKey = $tr.attr(attrNameMap.ROW_KEY), - startAction = true, - inputData = _.pick(event, 'pageX', 'pageY', 'shiftKey'), - indexData; - - if (!$td.length) { // selection layer + var columnModel = this.columnModel; + var $target = $(event.target); + var $td = $target.closest('td'); + var $tr = $target.closest('tr'); + var columnName = $td.attr(attrNameConst.COLUMN_NAME); + var rowKey = $tr.attr(attrNameConst.ROW_KEY); + var startAction = true; + var inputData = _.pick(event, 'pageX', 'pageY', 'shiftKey'); + var indexData; + + if (!$td.length) { // selection layer, focus layer indexData = this.dimensionModel.getIndexFromMousePosition(event.pageX, event.pageY); columnName = this._getColumnNameByVisibleIndex(indexData.column); } else if (rowKey && columnName) { // valid cell @@ -11754,13 +12858,10 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ * @private */ _onMouseMove: function(event) { - var selectionModel = this.selectionModel, - pageX = event.pageX, - pageY = event.pageY, - dragged = this._getMouseMoveDistance(pageX, pageY) > MIN_DISATNCE_FOR_DRAG; + var dragged = this._getMouseMoveDistance(event.pageX, event.pageY) > MIN_DISATNCE_FOR_DRAG; - if (selectionModel.hasSelection() || dragged) { - selectionModel.updateByMousePosition(pageX, pageY); + if (this.selectionModel.hasSelection() || dragged) { + this.selectionModel.updateByMousePosition(event.pageX, event.pageY); } }, @@ -11772,8 +12873,8 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ * @private */ _getMouseMoveDistance: function(pageX, pageY) { - var dx = Math.abs(this.mouseDownX - pageX), - dy = Math.abs(this.mouseDownY - pageY); + var dx = Math.abs(this.mouseDownX - pageX); + var dy = Math.abs(this.mouseDownY - pageY); return Math.round(Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2))); }, @@ -11806,12 +12907,13 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ } this.$el.css('height', this.dimensionModel.get('bodyHeight')); - this.$container = $(HTML_CONTAINER); + this.$container = $('
').addClass(classNameConst.BODY_CONTAINER); this.$el.append(this.$container); this._addChildren([ this.viewFactory.createBodyTable(whichSide), - this.viewFactory.createSelectionLayer(whichSide) + this.viewFactory.createSelectionLayer(whichSide), + this.viewFactory.createFocusLayer(whichSide) ]); this.$container.append(this._renderChildren()); this._resetContainerHeight(); @@ -11821,7 +12923,7 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ module.exports = Body; -},{"../../base/view":7,"../../common/constMap":8,"../../common/util":11}],43:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],51:[function(require,module,exports){ /** * @fileoverview Class for the table layout in the body(data) area * @author NHN Ent. FE Development Team @@ -11831,6 +12933,7 @@ module.exports = Body; var View = require('../../base/view'); var util = require('../../common/util'); var constMap = require('../../common/constMap'); +var classNameConst = require('../../common/classNameConst'); var CELL_BORDER_WIDTH = constMap.dimension.CELL_BORDER_WIDTH; var ATTR_COLUMN_NAME = constMap.attrName.COLUMN_NAME; @@ -11867,12 +12970,10 @@ var BodyTable = View.extend(/**@lends module:view/layout/bodyTable.prototype */{ this._attachAllTableEventHandlers(); }, - tagName: 'div', - - className: 'table_container', + className: classNameConst.BODY_TABLE_CONTAINER, template: _.template( - '' + + '
' + ' <%=colGroup%>' + ' <%=tbody%>' + '
'), @@ -11891,7 +12992,7 @@ var BodyTable = View.extend(/**@lends module:view/layout/bodyTable.prototype */{ totalWidth = 0; _.each(columnWidthList, function(width, index) { - $colList.eq(index).css('width', width - BodyTable.EXTRA_WIDTH); + $colList.eq(index).css('width', width - BodyTable.EXTRA_WIDTH + CELL_BORDER_WIDTH); totalWidth += width + CELL_BORDER_WIDTH; }, this); @@ -12004,7 +13105,7 @@ var BodyTable = View.extend(/**@lends module:view/layout/bodyTable.prototype */{ html += this.templateCol({ attrColumnName: ATTR_COLUMN_NAME, columnName: columnModel.columnName, - width: columnWidthList[index] - BodyTable.EXTRA_WIDTH + width: columnWidthList[index] - BodyTable.EXTRA_WIDTH + CELL_BORDER_WIDTH }); }, this); @@ -12017,7 +13118,7 @@ var BodyTable = View.extend(/**@lends module:view/layout/bodyTable.prototype */{ module.exports = BodyTable; -},{"../../base/view":7,"../../common/constMap":8,"../../common/util":11}],44:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],52:[function(require,module,exports){ /** * @fileoverview Left Side Frame * @author NHN Ent. FE Development Team @@ -12025,6 +13126,7 @@ module.exports = BodyTable; 'use strict'; var Frame = require('./frame'); +var classNameConst = require('../../common/classNameConst'); /** * Left Side Frame @@ -12042,7 +13144,7 @@ var LsideFrame = Frame.extend(/**@lends module:view/layout/frame-lside.prototype }); }, - className: 'lside_area', + className: classNameConst.LSIDE_AREA, /** * Event handler for 'changeColumnWidth' event on module:model/dimension @@ -12079,7 +13181,7 @@ var LsideFrame = Frame.extend(/**@lends module:view/layout/frame-lside.prototype } $scrollOverlay = $('
') - .addClass('scrollbar_overlay') + .addClass(classNameConst.SCROLLBAR_LEFT_BOTTOM) .css('bottom', dimensionModel.get('toolbarHeight')); this.$el.append($scrollOverlay); } @@ -12087,7 +13189,7 @@ var LsideFrame = Frame.extend(/**@lends module:view/layout/frame-lside.prototype module.exports = LsideFrame; -},{"./frame":46}],45:[function(require,module,exports){ +},{"../../common/classNameConst":8,"./frame":54}],53:[function(require,module,exports){ /** * @fileoverview Right Side Frame * @author NHN Ent. FE Development Team @@ -12095,8 +13197,10 @@ module.exports = LsideFrame; 'use strict'; var Frame = require('./frame'); +var classNameConst = require('../../common/classNameConst'); var CELL_BORDER_WIDTH = require('../../common/constMap').dimension.CELL_BORDER_WIDTH; + /** * right side frame class * @module view/layout/frame-rside @@ -12116,7 +13220,7 @@ var RsideFrame = Frame.extend(/**@lends module:view/layout/frame-rside.prototype this._resetScrollBorderHeight); }, - className: 'rside_area', + className: classNameConst.RSIDE_AREA, /** * Event handler for 'columnWidthChanged' event on dimensionModel @@ -12187,10 +13291,10 @@ var RsideFrame = Frame.extend(/**@lends module:view/layout/frame-rside.prototype headerHeight = dimensionModel.get('headerHeight'); // Empty DIV for hiding scrollbar in the header area - $space = $('
').addClass('header_space'); + $space = $('
').addClass(classNameConst.SCROLLBAR_HEAD); // Empty DIV for showing a left-border of vertical scrollbar in the body area - $scrollBorder = $('
').addClass('scrollbar_border'); + $scrollBorder = $('
').addClass(classNameConst.SCROLLBAR_BORDER); $space.height(headerHeight - 2); // subtract 2px for border-width (top and bottom) @@ -12203,7 +13307,7 @@ var RsideFrame = Frame.extend(/**@lends module:view/layout/frame-rside.prototype // casues to be stuck in the same position in Chrome) if (dimensionModel.get('scrollX')) { $scrollCorner = $('
') - .addClass('scrollbar_corner') + .addClass(classNameConst.SCROLLBAR_RIGHT_BOTTOM) .css('bottom', dimensionModel.get('toolbarHeight')); this.$el.append($scrollCorner); } @@ -12215,7 +13319,7 @@ var RsideFrame = Frame.extend(/**@lends module:view/layout/frame-rside.prototype module.exports = RsideFrame; -},{"../../common/constMap":8,"./frame":46}],46:[function(require,module,exports){ +},{"../../common/classNameConst":8,"../../common/constMap":9,"./frame":54}],54:[function(require,module,exports){ /** * @fileoverview Frame Base * @author NHN Ent. FE Development Team @@ -12245,14 +13349,10 @@ var Frame = View.extend(/**@lends module:view/layout/frame.prototype */{ whichSide: options.whichSide || 'R' }); - this.listenTo(this.renderModel, 'columnModelChanged', this.render, this) - .listenTo(this.dimensionModel, 'columnWidthChanged', this._onColumnWidthChanged, this); + this.listenTo(this.renderModel, 'columnModelChanged', this.render) + .listenTo(this.dimensionModel, 'columnWidthChanged', this._onColumnWidthChanged); }, - tagName: 'div', - - className: 'lside_area', - /** * Render * @returns {module:view/layout/frame} This object @@ -12296,7 +13396,7 @@ var Frame = View.extend(/**@lends module:view/layout/frame.prototype */{ module.exports = Frame; -},{"../../base/view":7}],47:[function(require,module,exports){ +},{"../../base/view":7}],55:[function(require,module,exports){ /** * @fileoverview Header 관련 * @author NHN Ent. FE Development Team @@ -12305,10 +13405,13 @@ module.exports = Frame; var View = require('../../base/view'); var util = require('../../common/util'); +var constMap = require('../../common/constMap'); +var classNameConst = require('../../common/classNameConst'); -var CLASSNAME_SELECTED = 'selected'; var DELAY_SYNC_CHECK = 10; -var ATTR_COLUMN_NAME = require('../../common/constMap').attrName.COLUMN_NAME; +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; /** * Header 레이아웃 View @@ -12344,9 +13447,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ .listenTo(this.dataModel, 'sortChanged', this._updateBtnSortState); }, - tagName: 'div', - - className: 'header', + className: classNameConst.HEAD_AREA, events: { 'click': '_onClick', @@ -12357,7 +13458,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ * 전체 template */ template: _.template( - '' + + '
' + '<%=colGroup%>' + '<%=tBody%>' + '
' @@ -12393,7 +13494,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ /** * 정렬 버튼을 위한 HTML 마크업 */ - markupBtnSort: '', + markupBtnSort: '', /** * col group 마크업을 생성한다. @@ -12410,7 +13511,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ htmlList.push(this.templateCol({ attrColumnName: ATTR_COLUMN_NAME, columnName: columnModelList[index].columnName, - width: width + width: width + CELL_BORDER_WIDTH })); }, this); return htmlList.join(''); @@ -12461,11 +13562,11 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ columnNames = [this.focusModel.get('columnName')]; } - $ths.removeClass(CLASSNAME_SELECTED); + $ths.removeClass(classNameConst.CELL_SELECTED); if (columnNames) { mergedColumnNames = this._getContainingMergedColumnNames(columnNames); _.each(columnNames.concat(mergedColumnNames), function(columnName) { - $ths.filter('[' + ATTR_COLUMN_NAME + '=' + columnName + ']').addClass(CLASSNAME_SELECTED); + $ths.filter('[' + ATTR_COLUMN_NAME + '=' + columnName + ']').addClass(classNameConst.CELL_SELECTED); }); } }, @@ -12478,7 +13579,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ _onMouseDown: function(event) { var columnName, columnNames; - if (!this.selectionModel.isEnabled() || $(event.target).is('a.btn_sorting')) { + if (!this.selectionModel.isEnabled() || $(event.target).is('a.' + classNameConst.BTN_SORT)) { return; } @@ -12675,7 +13776,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ $colList = this.$el.find('col'); _.each(columnWidthList, function(columnWidth, index) { - $colList.eq(index).css('width', columnWidth + 'px'); + $colList.eq(index).css('width', columnWidth + CELL_BORDER_WIDTH); }); }, @@ -12701,14 +13802,13 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ var $target = $(clickEvent.target), columnName = $target.closest('th').attr(ATTR_COLUMN_NAME); - /* istanbul ignore else */ if (columnName === '_button' && $target.is('input')) { if ($target.prop('checked')) { this.dataModel.checkAll(); } else { this.dataModel.uncheckAll(); } - } else if ($target.is('a.btn_sorting')) { + } else if ($target.is('a.' + classNameConst.BTN_SORT)) { this.dataModel.sortByField(columnName); } }, @@ -12722,12 +13822,14 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ */ _updateBtnSortState: function(sortOptions) { if (this._$currentSortBtn) { - this._$currentSortBtn.removeClass('sorting_down sorting_up'); + this._$currentSortBtn.removeClass(classNameConst.BTN_SORT_DOWN + ' ' + classNameConst.BTN_SORT_UP); } this._$currentSortBtn = this.$el.find( - 'th[' + ATTR_COLUMN_NAME + '=' + sortOptions.columnName + '] a.btn_sorting' + 'th[' + ATTR_COLUMN_NAME + '=' + sortOptions.columnName + '] a.' + classNameConst.BTN_SORT + ); + this._$currentSortBtn.addClass(sortOptions.isAscending ? + classNameConst.BTN_SORT_UP : classNameConst.BTN_SORT_DOWN ); - this._$currentSortBtn.addClass(sortOptions.isAscending ? 'sorting_up' : 'sorting_down'); }, /** @@ -12738,11 +13840,11 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ this._destroyChildren(); if (this.whichSide === 'R' && !this.dimensionModel.get('scrollY')) { - this.$el.addClass('no_scroll'); + this.$el.addClass(classNameConst.NO_SCROLL_Y); } this.$el.css({ - height: this.dimensionModel.get('headerHeight') + height: this.dimensionModel.get('headerHeight') - TABLE_BORDER_WIDTH }).html(this.template({ colGroup: this._getColGroupMarkup(), tBody: this._getTableBodyMarkup() @@ -12793,6 +13895,14 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ curHeight = 0; _.each(hierarchy, function(columnModel, j) { var columnName = columnModel.columnName; + var classNames = [ + classNameConst.CELL, + classNameConst.CELL_HEAD + ]; + + if (columnModel.isRequired) { + classNames.push(classNameConst.CELL_REQRUIRED); + } rowSpan = (length - 1 === j && (maxRowCount - length + 1) > 1) ? (maxRowCount - length + 1) : 1; height = rowHeight * rowSpan; @@ -12813,7 +13923,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ rowMarkupList[j].push(this.templateHeader({ attrColumnName: ATTR_COLUMN_NAME, columnName: columnName, - className: columnModel.isRequired ? 'required' : '', + className: classNames.join(' '), height: height, colspan: colSpanList[j], rowspan: rowSpan, @@ -12888,7 +13998,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ module.exports = Header; -},{"../../base/view":7,"../../common/constMap":8,"../../common/util":11}],48:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],56:[function(require,module,exports){ /** * @fileoverview ResizeHandler for the Header * @author NHN Ent. FE Development Team @@ -12896,7 +14006,9 @@ module.exports = Header; 'use strict'; var View = require('../../base/view'); -var ATTR_COLUMN_NAME = require('../../common/constMap').attrName.COLUMN_NAME; +var attrNameConst = require('../../common/constMap').attrName; +var classNameConst = require('../../common/classNameConst'); +var CELL_BORDER_WIDTH = require('../../common/constMap').dimension.CELL_BORDER_WIDTH; /** * Reside Handler class @@ -12921,28 +14033,30 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto initialOffsetLeft: 0, initialLeft: 0 }); + this.listenTo(this.dimensionModel, 'change:which columnWidthChanged', this._refreshHandlerPosition); }, - tagName: 'div', + className: classNameConst.COLUMN_RESIZE_CONTAINER, - className: 'resize_handle_container', + events: function() { + var eventHash = {}; - events: { - 'mousedown .resize_handle': '_onMouseDown', - 'dblclick .resize_handle': '_onDblClick' + eventHash['mousedown .' + classNameConst.COLUMN_RESIZE_HANDLE] = '_onMouseDown'; + eventHash['dblclick .' + classNameConst.COLUMN_RESIZE_HANDLE] = '_onDblClick'; + + return eventHash; }, template: _.template( - '
="<%=columnName%>" ' + - 'class="resize_handle' + - '<% if(isLast === true) ' + - ' print(" resize_handle_last");%>' + - '" ' + + '
' + - '
'), + '
' + ), /** * Return an object that contains an array of column width and an array of column model. @@ -12950,10 +14064,10 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto * @private */ _getColumnData: function() { - var columnModel = this.columnModel, - dimensionModel = this.dimensionModel, - columnWidthList = dimensionModel.getColumnWidthList(this.whichSide), - columnModelList = columnModel.getVisibleColumnModelList(this.whichSide, true); + var columnModel = this.columnModel; + var dimensionModel = this.dimensionModel; + var columnWidthList = dimensionModel.getColumnWidthList(this.whichSide); + var columnModelList = columnModel.getVisibleColumnModelList(this.whichSide, true); return { widthList: columnWidthList, @@ -12967,21 +14081,19 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto * @private */ _getResizeHandlerMarkup: function() { - var columnData = this._getColumnData(), - columnModelList = columnData.modelList, - headerHeight = this.dimensionModel.get('headerHeight'), - length = columnModelList.length, - resizeHandleMarkupList; - - resizeHandleMarkupList = _.map(columnModelList, function(columnModel, index) { + var columnData = this._getColumnData(); + var columnModelList = columnData.modelList; + var headerHeight = this.dimensionModel.get('headerHeight'); + var length = columnModelList.length; + var resizeHandleMarkupList = _.map(columnModelList, function(columnModel, index) { return this.template({ - attrColumnName: ATTR_COLUMN_NAME, + lastClass: (index + 1 === length) ? classNameConst.COLUMN_RESIZE_HANDLE_LAST : '', columnIndex: index, columnName: columnModel.columnName, - isLast: index + 1 === length, height: headerHeight }); }, this); + return resizeHandleMarkupList.join(''); }, @@ -13007,29 +14119,17 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto * @private */ _refreshHandlerPosition: function() { - var columnData = this._getColumnData(), - columnWidthList = columnData.widthList, - $resizeHandleList = this.$el.find('.resize_handle'), - $table = this.$el.parent().find('table:first'), - isChanged = false, - $handler, - columnName, - curPos = 0, - BORDER_WIDTH = 1, - HANDLER_WIDTH_HALF = 3, - width; + var columnData = this._getColumnData(); + var columnWidthList = columnData.widthList; + var $resizeHandleList = this.$el.find('.' + classNameConst.COLUMN_RESIZE_HANDLE); + var curPos = 0; tui.util.forEachArray($resizeHandleList, function(item, index) { - $handler = $resizeHandleList.eq(index); - columnName = $handler.attr(ATTR_COLUMN_NAME); - width = $table.find('th[' + ATTR_COLUMN_NAME + '=' + columnName + ']').width(); - if (tui.util.isExisty(width)) { - isChanged = isChanged || (width !== columnWidthList[index]); - } else { - width = columnWidthList[index]; - } - curPos += width + BORDER_WIDTH; - $handler.css('left', curPos - HANDLER_WIDTH_HALF); + var $handler = $resizeHandleList.eq(index); + var handlerWidthHalf = Math.ceil($handler.width() / 2); + + curPos += columnWidthList[index] + CELL_BORDER_WIDTH; + $handler.css('left', curPos - handlerWidthHalf); }); }, @@ -13048,7 +14148,7 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto * @private */ _onMouseDown: function(mouseEvent) { - this._startResizing(mouseEvent); + this._startResizing($(mouseEvent.target)); }, /** @@ -13057,8 +14157,8 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto * @private */ _onDblClick: function(mouseEvent) { - var $target = $(mouseEvent.target), - index = parseInt($target.attr('columnindex'), 10); + var $target = $(mouseEvent.target); + var index = parseInt($target.attr(attrNameConst.COLUMN_INDEX), 10); this.dimensionModel.restoreColumnWidth(this._getHandlerColumnIndex(index)); this._refreshHandlerPosition(); @@ -13080,15 +14180,14 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto _onMouseMove: function(mouseEvent) { var left, width, index; - /* istanbul ignore else */ if (this._isResizing()) { mouseEvent.preventDefault(); left = mouseEvent.pageX - this.initialOffsetLeft; width = this._calculateWidth(mouseEvent.pageX); - index = parseInt(this.$target.attr('columnindex'), 10); + index = parseInt(this.$target.attr(attrNameConst.COLUMN_INDEX), 10); - this.$target.css('left', left + 'px'); + this.$target.css('left', left); this.dimensionModel.setColumnWidth(this._getHandlerColumnIndex(index), width); this._refreshHandlerPosition(); } @@ -13117,19 +14216,18 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto /** * Start resizing - * @param {event} mouseDownEvent - mouse event + * @param {jQuery} $target - target element * @private */ - _startResizing: function(mouseDownEvent) { - var columnData = this._getColumnData(), - columnWidthList = columnData.widthList, - $target = $(mouseDownEvent.target); + _startResizing: function($target) { + var columnData = this._getColumnData(); + var columnWidthList = columnData.widthList; this.isResizing = true; this.$target = $target; this.initialLeft = parseInt($target.css('left').replace('px', ''), 10); this.initialOffsetLeft = this.$el.offset().left; - this.initialWidth = columnWidthList[$target.attr('columnindex')]; + this.initialWidth = columnWidthList[$target.attr(attrNameConst.COLUMN_INDEX)]; $('body').css('cursor', 'col-resize'); $(document) .bind('mousemove', $.proxy(this._onMouseMove, this)) @@ -13175,7 +14273,7 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto module.exports = ResizeHandler; -},{"../../base/view":7,"../../common/constMap":8}],49:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9}],57:[function(require,module,exports){ /** * @fileoverview 툴바영역 클래스 * @author NHN Ent. FE Development Team @@ -13183,6 +14281,7 @@ module.exports = ResizeHandler; 'use strict'; var View = require('../../base/view'); +var classNameConst = require('../../common/classNameConst'); /** * 툴바 영역 @@ -13202,9 +14301,7 @@ var Toolbar = View.extend(/**@lends module:view/layout/toolbar.prototype */{ this.viewFactory = options.viewFactory; }, - tagName: 'div', - - className: 'toolbar', + className: classNameConst.TOOLBAR, /** * 랜더링한다. @@ -13247,7 +14344,7 @@ var Toolbar = View.extend(/**@lends module:view/layout/toolbar.prototype */{ module.exports = Toolbar; -},{"../../base/view":7}],50:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8}],58:[function(require,module,exports){ /** * @fileoverview Class for the control panel in the toolbar * @author NHN Ent. FE Development Team @@ -13255,6 +14352,7 @@ module.exports = Toolbar; 'use strict'; var View = require('../../../base/view'); +var classNameConst = require('../../../common/classNameConst'); /** * Class for the control panel in the toolbar @@ -13278,17 +14376,17 @@ var ControlPanel = View.extend(/**@lends module:view/layout/toolbar/controlPanel 'change:isExcelButtonVisible change:isExcelAllButtonVisible', this.render); }, - events: { - 'click a.excel_download_button': '_onClickExcel' + events: function() { + var hash = {}; + hash['click .' + classNameConst.BTN_EXCEL] = '_onClickExcel'; + return hash; }, - tagName: 'div', - - className: 'btn_setup', + className: classNameConst.TOOLBAR_BTN_HOLDER, templateExcelBtn: _.template( - '' + - '<%=text%>' + + '' + + '<%=text%>' + '' ), @@ -13298,18 +14396,18 @@ var ControlPanel = View.extend(/**@lends module:view/layout/toolbar/controlPanel * @private */ _onClickExcel: function(mouseEvent) { - var grid = tui.Grid.getInstanceById(this.gridId), - net = grid.getAddOn('Net'), - $target; + var grid = tui.Grid.getInstanceById(this.gridId); + var net = grid.getAddOn('Net'); + var $target; mouseEvent.preventDefault(); if (net) { $target = $(mouseEvent.target).closest('a'); - if ($target.hasClass('excel_page')) { + if ($target.hasClass(classNameConst.BTN_EXCEL_PAGE)) { net.download('excel'); - } else if ($target.hasClass('excel_all')) { + } else if ($target.hasClass(classNameConst.BTN_EXCEL_ALL)) { net.download('excelAll'); } } @@ -13326,13 +14424,13 @@ var ControlPanel = View.extend(/**@lends module:view/layout/toolbar/controlPanel if (toolbarModel.get('isExcelButtonVisible')) { this.$el.append(this.templateExcelBtn({ - className: 'excel_page', + className: classNameConst.BTN_EXCEL_PAGE, text: '엑셀 다운로드' })); } if (toolbarModel.get('isExcelAllButtonVisible')) { this.$el.append(this.templateExcelBtn({ - className: 'excel_all', + className: classNameConst.BTN_EXCEL_ALL, text: '전체 엑셀 다운로드' })); } @@ -13342,7 +14440,7 @@ var ControlPanel = View.extend(/**@lends module:view/layout/toolbar/controlPanel module.exports = ControlPanel; -},{"../../../base/view":7}],51:[function(require,module,exports){ +},{"../../../base/view":7,"../../../common/classNameConst":8}],59:[function(require,module,exports){ /** * @fileoverview Class for the pagination in the toolbar * @author NHN Ent. FE Development Team @@ -13350,6 +14448,7 @@ module.exports = ControlPanel; 'use strict'; var View = require('../../../base/view'); +var classNameConst = require('../../../common/classNameConst'); /** * Class for the pagination in the toolbar @@ -13365,19 +14464,17 @@ var Pagination = View.extend(/**@lends module:view/layout/toolbar/pagination.pro this.toolbarModel = options.toolbarModel; }, - tagName: 'div', - - className: 'grid_pagination', + className: classNameConst.PAGINATION, - template: _.template( - 'First' + - 'Prev ' + - '' + - 'Last' + - 'First Off' + - 'Prev Off' + - 'Next Off' + - 'Last Off' + htmlString: ( + 'First' + + 'Prev ' + + 'Next' + + 'Last' + + 'First Off' + + 'Prev Off' + + 'Next Off' + + 'Last Off' ), /** @@ -13386,8 +14483,9 @@ var Pagination = View.extend(/**@lends module:view/layout/toolbar/pagination.pro */ render: function() { this._destroyChildren(); - this.$el.empty().html(this.template()); + this.$el.empty().html(this.htmlString); this._setPaginationInstance(); + return this; }, @@ -13401,15 +14499,16 @@ var Pagination = View.extend(/**@lends module:view/layout/toolbar/pagination.pro if (!pagination && PaginationClass) { pagination = new PaginationClass({ + classPrefix: classNameConst.PREFIX, itemCount: 1, itemPerPage: 1, pagePerPageList: 5, isCenterAlign: true, moveUnit: 'page', - $preOff: this.$el.find('.pre_off'), - $pre_endOff: this.$el.find('.pre_end_off'), // eslint-disable-line camelcase - $nextOff: this.$el.find('.next_off'), - $lastOff: this.$el.find('.next_end_off') + $preOff: this.$el.find('.' + classNameConst.PAGINATION_PRE_OFF), + $pre_endOff: this.$el.find('.' + classNameConst.PAGINATION_PRE_END_OFF), // eslint-disable-line + $nextOff: this.$el.find('.' + classNameConst.PAGINATION_NEXT_OFF), + $lastOff: this.$el.find('.' + classNameConst.PAGINATION_NEXT_END_OFF) }, this.$el); } this.toolbarModel.set('pagination', pagination); @@ -13418,7 +14517,7 @@ var Pagination = View.extend(/**@lends module:view/layout/toolbar/pagination.pro module.exports = Pagination; -},{"../../../base/view":7}],52:[function(require,module,exports){ +},{"../../../base/view":7,"../../../common/classNameConst":8}],60:[function(require,module,exports){ /** * @fileoverview Class for the resize handler of the toolbar * @author NHN Ent. FE Development Team @@ -13426,6 +14525,7 @@ module.exports = Pagination; 'use strict'; var View = require('../../../base/view'); +var classNameConst = require('../../../common/classNameConst'); /** * Class for the resize handler of the toolbar @@ -13442,11 +14542,9 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/toolbar/resizeHandl this.timeoutIdForResize = 0; }, - tagName: 'div', + className: classNameConst.HEIGHT_RESIZE_BAR, - className: 'height_resize_bar', - - template: _.template(''), + htmlString: '', events: { 'mousedown': '_onMouseDown' @@ -13534,7 +14632,8 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/toolbar/resizeHandl */ render: function() { this._destroyChildren(); - this.$el.html(this.template()); + this.$el.html(this.htmlString); + return this; }, @@ -13551,7 +14650,7 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/toolbar/resizeHandl module.exports = ResizeHandler; -},{"../../../base/view":7}],53:[function(require,module,exports){ +},{"../../../base/view":7,"../../../common/classNameConst":8}],61:[function(require,module,exports){ /** * @fileoverview RowList View * @author NHN Ent. FE Development Team @@ -13560,11 +14659,8 @@ module.exports = ResizeHandler; var View = require('../base/view'); var util = require('../common/util'); -var attrNameMap = require('../common/constMap').attrName; - -var CLASSNAME_SELECTED = 'selected'; -var CLASSNAME_FOCUSED_ROW = 'focused_row'; -var SELECTOR_META_CELL = 'td.meta_column'; +var attrNameConst = require('../common/constMap').attrName; +var classNameConst = require('../common/classNameConst'); /** * RowList View @@ -13692,7 +14788,7 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ * @private */ _getRowElement: function(rowKey) { - return this.$el.find('tr[' + attrNameMap.ROW_KEY + '=' + rowKey + ']'); + return this.$el.find('tr[' + attrNameConst.ROW_KEY + '=' + rowKey + ']'); }, /** @@ -13700,8 +14796,9 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ * @private */ _refreshSelectedMetaColumns: function() { - var $rows = this.$el.find('tr'), - $filteredRows; + var $rows = this.$el.find('tr'); + var metaSelector = '.' + classNameConst.CELL_HEAD; + var $filteredRows; if (this.selectionModel.hasSelection()) { $filteredRows = this._filterRowsByIndexRange($rows, this.selectionModel.get('range').row); @@ -13709,8 +14806,8 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ $filteredRows = this._filterRowByKey($rows, this.focusModel.get('rowKey')); } - $rows.find(SELECTOR_META_CELL).removeClass(CLASSNAME_SELECTED); - $filteredRows.find(SELECTOR_META_CELL).addClass(CLASSNAME_SELECTED); + $rows.find(metaSelector).removeClass(classNameConst.CELL_SELECTED); + $filteredRows.find(metaSelector).addClass(classNameConst.CELL_SELECTED); }, /** @@ -13752,20 +14849,20 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ }, /** - * Removes the CLASSNAME_FOCUSED_ROW class from the cells in the previously focused row and + * Removes the CURRENT_ROW class from the cells in the previously focused row and * adds it to the cells in the currently focused row. * @private */ _refreshFocusedRow: function() { - var rowKey = this.focusModel.get('rowKey'), - prevRowKey = this.focusModel.get('prevRowKey'); + var rowKey = this.focusModel.get('rowKey'); + var prevRowKey = this.focusModel.get('prevRowKey'); this._setFocusedRowClass(prevRowKey, false); this._setFocusedRowClass(rowKey, true); }, /** - * Finds all cells in the row indentified by given rowKey and toggles the CLASSNAME_FOCUSED_ROW on them. + * Finds all cells in the row indentified by given rowKey and toggles the CURRENT_ROW on them. * @param {Number|String} rowKey - rowKey * @param {Boolean} focused - if set to true, the class will be added, otherwise be removed. * @private @@ -13781,8 +14878,8 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ if (!trMap[mainRowKey]) { trMap[mainRowKey] = this._getRowElement(mainRowKey); } - $td = trMap[mainRowKey].find('td[' + attrNameMap.COLUMN_NAME + '=' + columnName + ']'); - $td.toggleClass(CLASSNAME_FOCUSED_ROW, focused); + $td = trMap[mainRowKey].find('td[' + attrNameConst.COLUMN_NAME + '=' + columnName + ']'); + $td.toggleClass(classNameConst.CELL_CURRENT_ROW, focused); }, this); }, @@ -13849,7 +14946,7 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ module.exports = RowList; -},{"../base/view":7,"../common/constMap":8,"../common/util":11}],54:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],62:[function(require,module,exports){ /** * @fileoverview Class for the selection layer * @author NHN Ent. FE Development Team @@ -13858,6 +14955,7 @@ module.exports = RowList; var View = require('../base/view'); var util = require('../common/util'); +var classNameConst = require('../common/classNameConst'); var CELL_BORDER_WIDTH = require('../common/constMap').dimension.CELL_BORDER_WIDTH; /** @@ -13884,9 +14982,7 @@ var SelectionLayer = View.extend(/**@lends module:view/selectionLayer.prototype this.listenTo(this.selectionModel, 'change:range', this.render); }, - tagName: 'div', - - className: 'selection_layer', + className: classNameConst.LAYER_SELECTION, /** * Updates this.columnWidthList @@ -14012,7 +15108,7 @@ var SelectionLayer = View.extend(/**@lends module:view/selectionLayer.prototype module.exports = SelectionLayer; -},{"../base/view":7,"../common/constMap":8,"../common/util":11}],55:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],63:[function(require,module,exports){ /** * @fileoverview Layer class that represents the state of rendering phase * @author NHN Ent. FE Development Team @@ -14020,7 +15116,8 @@ module.exports = SelectionLayer; 'use strict'; var View = require('../base/view'); -var renderStateMap = require('../common/constMap').renderState; +var stateConst = require('../common/constMap').renderState; +var classNameConst = require('../common/classNameConst'); /** * Layer class that represents the state of rendering phase. @@ -14041,13 +15138,13 @@ var StateLayer = View.extend(/**@lends module:view/stateLayer.prototype */{ this.listenTo(this.renderModel, 'change:state', this.render); }, - className: 'state_layer', + className: classNameConst.LAYER_STATE, template: _.template( - '
' + + '
' + ' <%= text %>' + ' <% if (isLoading) { %>' + - '
' + + '
' + ' <% } %>' + '
' ), @@ -14059,7 +15156,7 @@ var StateLayer = View.extend(/**@lends module:view/stateLayer.prototype */{ render: function() { var renderState = this.renderModel.get('state'); - if (renderState === renderStateMap.DONE) { + if (renderState === stateConst.DONE) { this.$el.hide(); } else { this._showLayer(renderState); @@ -14076,7 +15173,7 @@ var StateLayer = View.extend(/**@lends module:view/stateLayer.prototype */{ _showLayer: function(renderState) { var layerHtml = this.template({ text: this._getMessage(renderState), - isLoading: (renderState === renderStateMap.LOADING) + isLoading: (renderState === stateConst.LOADING) }); this.$el.html(layerHtml).show(); @@ -14090,9 +15187,9 @@ var StateLayer = View.extend(/**@lends module:view/stateLayer.prototype */{ */ _getMessage: function(renderState) { switch (renderState) { - case renderStateMap.LOADING: + case stateConst.LOADING: return '요청을 처리 중입니다.'; - case renderStateMap.EMPTY: + case stateConst.EMPTY: return (this.renderModel.get('emptyMessage') || '데이터가 존재하지 않습니다.'); default: return null; @@ -14115,4 +15212,4 @@ var StateLayer = View.extend(/**@lends module:view/stateLayer.prototype */{ module.exports = StateLayer; -},{"../base/view":7,"../common/constMap":8}]},{},[13]); +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}]},{},[14]); diff --git a/dist/grid.min.css b/dist/grid.min.css index 3b3f3a6ad..c4b6fa238 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.0-c + * @version 1.2.1 * @license MIT * @link https://github.com/nhnent/tui.grid */ -.uio_grid fieldset,.uio_grid input,.uio_grid p{padding:0;margin:0}.uio_grid{width:100%;background:#fff;color:#444;position:relative;border-bottom:solid 1px #ccc;clear:both;scrollbar-highlight-color:#f5f5f5;scrollbar-shadow-color:#f5f5f5;scrollbar-arrow-color:#8a8a8a;scrollbar-face-color:#d9d9d9;scrollbar-3dlight-color:#f5f5f5;scrollbar-darkshadow-color:#f5f5f5;scrollbar-track-color:#f5f5f5;font-size:12px;font-family:'돋움',Dotum,Helvetica,'Apple SD Gothic Neo',Sans-serif}.uio_grid ::-webkit-scrollbar{-webkit-appearance:none;width:17px;height:17px;background-color:#f5f5f5}.uio_grid ::-webkit-scrollbar-thumb{background-color:#d9d9d9;border:5px solid transparent;border-radius:7px;background-clip:content-box}.uio_grid ::-webkit-scrollbar-thumb:hover{background-color:#c1c1c1}.uio_grid *{box-sizing:content-box}.uio_grid fieldset{border:0;display:inline;white-space:nowrap}.uio_grid input[type=text]{outline:0;line-height:normal}.uio_grid li,.uio_grid ul{list-style:none;padding:0;margin:0}.uio_grid em,.uio_grid strong{font-style:normal}.uio_grid .btn_text{display:inline-block;text-decoration:none}.uio_grid .btn_text span{display:inline-block;position:relative;font-size:11px;color:#333;padding-left:17px;letter-spacing:-1px;line-height:23px;white-space:nowrap;cursor:pointer;margin-left:8px;padding-right:7px}.uio_grid .btn_text em{position:absolute;left:0;top:5px;width:17px;height:12px;background:url(../images/icons.gif) no-repeat}.uio_grid .btn_text em.excel,.uio_grid .btn_text em.grid{background-position:-30px -60px}.uio_grid .clipboard{position:fixed;top:0;left:-9999px;width:100px;height:100px}.uio_grid .cell_content input[type=password],.uio_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}.uio_grid .cell_content input.editing{border:1px solid #748eea}.uio_grid .cell_content label+input{margin-left:10px}.uio_grid .cell_content select{width:100%}.uio_grid .cell_content a{color:#002caf}.uio_grid .state_layer{position:absolute;top:0;left:0;width:100%;border-bottom:solid 1px #ccc;background:#fff;font-weight:700;text-align:center;z-index:12}.uio_grid .state_layer .layer_content{padding-top:50px}.uio_grid .state_layer .layer_content .loading_img{display:block;margin:10px auto 0;background:url(../images/ani_loading.gif);border:0;width:150px;height:13px}.uio_grid .editing_layer{position:absolute;display:none;background:#fff;z-index:15;padding:0 10px;border:1px dotted #190000;white-space:nowrap}.uio_grid .data_bottom_line,.uio_grid .left_line,.uio_grid .right_line{background:#ccc;z-index:13;position:absolute;bottom:0}.uio_grid .left_line{top:0;left:0;width:1px}.uio_grid .right_line{top:0;right:0;width:1px}.uio_grid .data_bottom_line{left:0;right:17px;height:1px}.uio_grid .lside_area{display:none;height:100%;position:absolute;top:0;left:0;overflow:hidden;z-index:10}.uio_grid .lside_area .header{overflow:hidden}.uio_grid .lside_area .data{overflow:scroll;position:relative;margin-right:-17px}.uio_grid .lside_area .data .selection_layer{display:none;position:absolute;top:0;width:0;height:0;border:1px solid #004082;background:#4daaf9;opacity:.2;filter:alpha(opacity=10);left:1px}.uio_grid .lside_area .scrollbar_overlay{position:absolute;bottom:0;left:0;right:0;height:17px;background-color:#f5f5f5}.uio_grid .rside_area{display:none;height:100%;overflow:hidden}.uio_grid .rside_area .header{position:relative;margin-right:17px;overflow:hidden}.uio_grid .rside_area .header.no_scroll{margin-right:0}.uio_grid .rside_area .data{position:relative;overflow:scroll}.uio_grid .rside_area .data .selection_layer{display:none;position:absolute;top:0;width:0;height:0;border:1px solid #004082;background:#4daaf9;opacity:.2;filter:alpha(opacity=10)}.uio_grid .rside_area .header_space{display:block;position:absolute;top:0;right:0;width:16px;border:1px solid #ccc;background:#eee}.uio_grid .rside_area .scrollbar_border{display:block;position:absolute;right:17px;width:1px;background:#ccc}.uio_grid .rside_area .scrollbar_corner{position:absolute;bottom:0;right:0;width:17px;height:17px;background-color:#f5f5f5}.uio_grid .header .resize_handle_container{display:none;position:relative;width:0}.uio_grid .header .resize_handle_container .resize_handle{float:left;position:absolute;top:-1px;left:-99px;width:7px;height:100%;background:red;opacity:0;filter:alpha(opacity=0);cursor:col-resize}.uio_grid .header .resize_handle_container .resize_handle_last{width:3px}.uio_grid .body_container{position:relative;margin-top:-1px}.uio_grid .body_container .table_container{position:absolute}.uio_grid table{border:0;table-layout:fixed;background-color:#d8d8d8;border-collapse:separate;border-spacing:1px;margin:0}.uio_grid table th{overflow:hidden;white-space:nowrap;text-align:center;padding:0;border:0;background:#eee}.uio_grid table th.selected{background:#cdcdcd}.uio_grid table th .sort a{color:#555;text-decoration:none}.uio_grid table td.disabled,.uio_grid table tr.disabled{color:#b0b0b0}.uio_grid table th .btn_sorting{display:inline-block;overflow:hidden;margin-left:6px;height:15px;width:8px;background:url(../images/icons.gif) -20px -60px no-repeat;vertical-align:middle;cursor:pointer}.uio_grid table th .sorting_down{background-position:0 -60px}.uio_grid table th .sorting_up{background-position:-10px -60px}.uio_grid table td{overflow:hidden;padding:0 10px;border:0;white-space:nowrap;background-color:#fbfbfb}.uio_grid table td.meta_column,.uio_grid table td.meta_column.dummy{background:#eee}.uio_grid table td.meta_column.selected{background:#cdcdcd}.uio_grid table td.dummy,.uio_grid table td.editable{background-color:#fff}.uio_grid table td.required{background-color:#fffdeb}.uio_grid table td.focused{padding:0 9px;border:1px dotted #190000}.uio_grid table td.invalid{padding:0 9px;border:1px solid #ff8080}.uio_grid table td.ellipsis{-o-text-overflow:ellipsis;-moz-binding:url(ellipsis.xml#ellipsis);width:100%;text-overflow:ellipsis}.uio_grid table td img{vertical-align:middle}.uio_grid table td span.before{float:left;margin-right:2px;line-height:1.5}.uio_grid table td span.after{float:right;margin-left:2px;line-height:1.5}.uio_grid table td span.input{display:block;overflow:hidden;line-height:1.5}.uio_grid .toolbar{display:none;width:100%;height:65px;bottom:0;position:absolute;background:#fff;border-top:1px solid #ccc;z-index:11}.uio_grid .toolbar .total_count{position:absolute;top:20px;left:24px;color:#002caf;font-weight:700}.uio_grid .toolbar .btn_setup{position:absolute;right:10px;top:14px}.uio_grid .toolbar .height_resize_bar{overflow:hidden;cursor:row-resize;position:absolute;bottom:0;height:15px;width:100%;border:0;font-size:0;text-align:center}.uio_grid .toolbar .height_resize_bar span{background:url(../images/icons.gif) -70px -60px no-repeat;display:inline-block;width:17px;height:6px;margin-top:5px}.uio_grid .toolbar .height_resize_handle{display:block;margin:0 10px;border-top:1px solid #ccc;cursor:row-resize}.uio_grid .grid_pagination{height:12px;margin-bottom:12px;padding-top:14px;line-height:normal;text-align:center}.uio_grid .grid_pagination a,.uio_grid .grid_pagination span,.uio_grid .grid_pagination strong{display:inline-block;position:relative;padding:4px 8px;min-width:13px;color:#333;font-size:12px;font-weight:700;line-height:normal;text-decoration:none;vertical-align:middle}.uio_grid .grid_pagination strong{padding:4px 6px;color:#ff1313;border:1px solid #d4d4d4;background:#e7e7e7}.uio_grid .grid_pagination .next,.uio_grid .grid_pagination .next_end,.uio_grid .grid_pagination .next_end_off,.uio_grid .grid_pagination .next_off,.uio_grid .grid_pagination .pre,.uio_grid .grid_pagination .pre_end,.uio_grid .grid_pagination .pre_end_off,.uio_grid .grid_pagination .pre_off{width:25px;height:24px;padding:0;border:0;background:url(../images/icons.gif) no-repeat;font-size:0;line-height:999;overflow:hidden;white-space:nowrap}.uio_grid .grid_pagination .next_end,.uio_grid .grid_pagination .next_end_off,.uio_grid .grid_pagination .pre_end,.uio_grid .grid_pagination .pre_end_off{width:24px}.uio_grid .grid_pagination .pre,.uio_grid .grid_pagination .pre_off{margin-right:12px}.uio_grid .grid_pagination .next,.uio_grid .grid_pagination .next_off{margin-left:12px}.uio_grid .grid_pagination .pre_end{background-position:0 0}.uio_grid .grid_pagination .pre_end_off{background-position:0 -30px}.uio_grid .grid_pagination .pre{background-position:-24px 0}.uio_grid .grid_pagination .pre_off{background-position:-24px -30px}.uio_grid .grid_pagination .next{background-position:-50px 0}.uio_grid .grid_pagination .next_off{background-position:-50px -30px}.uio_grid .grid_pagination .next_end{background-position:-75px 0}.uio_grid .grid_pagination .next_end_off{background-position:-75px -30px} \ No newline at end of file +.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 diff --git a/dist/grid.min.js b/dist/grid.min.js index 5b1ae45b2..e6af61c85 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.0-c + * @version 1.2.1 * @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":8,"../common/formUtil":9,"../common/gridEvent":10,"../common/util":11,"./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":8}],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={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",EDIT_TYPE:"data-edit-type"}}},{}],9:[function(t,e,i){"use strict";var n={setInput:{_changeToStringInArray:function(t){return _.each(t,function(e,i){t[i]=String(e)}),t},radio:function(t,e){t.checked=t.value===e},checkbox:function(t,e){_.isArray(e)?t.checked=-1!==$.inArray(t.value,this._changeToStringInArray(e)):t.checked=t.value===e},"select-one":function(t,e){var i=tui.util.toArray(t.options);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},{}],10:[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},{}],11:[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}};e.exports=o},{"./constMap":8}],12:[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":8}],13:[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"),h=t("./common/util"),c={};tui=window.tui=tui||{},tui.Grid=n.extend({initialize:function(t){var e=new a(this.$el);this.id=h.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(),this.addOn={},c[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 c[t]}},{"./addon/net":2,"./base/view":7,"./common/util":11,"./domState":12,"./model/manager":20,"./painter/controller":28,"./painter/manager":35,"./publicEventEmitter":37,"./view/factory":41}],14:[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":16}],18:[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}),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},getCellPosition:function(t,e){var i,n,s,a,r,u,d,h,c=this.dataModel,m=this.columnModel,g=this.get("rowHeight"),f=c.get(t),p=m.getVisibleMetaColumnCount(),_=this.get("columnWidthList").slice(p),M=m.getVisibleColumnFixCount(),w=m.indexOfColumnName(e,!0);if(!f)return{};for(i=c.get(t).getRowSpanData(e),i.isMainRow||(t=i.mainRowKey,i=c.get(t).getRowSpanData(e)),s=i.count||1,n=c.indexOfRowKey(t),a=o.getHeight(n,g),d=a+o.getHeight(s,g)-l,r=h=0,w>=M&&(h=M);w>h;h+=1)r+=_[h]+l;return u=r+_[h]+l,{top:a,left:r,right:u,bottom:d}},getScrollPosition:function(t,e){var i=!this.columnModel.isLside(e),n=this.getCellPosition(t,e),o=this._getBodySize(),s=this._judgeScrollDirection(n,i,o);return this._makeScrollPosition(s,n,o)},_getBodySize:function(){var t=this.get("lsideWidth"),e=this.get("rsideWidth")-this.getScrollYWidth(),i=this.get("bodyHeight")-this.getScrollXHeight();return{height:i,rsideWidth:e,totalWidth:t+e}},_judgeScrollDirection:function(t,e,i){var n,o,s,a,l=this.renderModel,r=l.get("scrollTop"),u=l.get("scrollLeft");return n=t.topr+i.height,e?(s=t.leftu+i.rsideWidth-1):s=a=!1,{isUp:n,isDown:o,isLeft:s,isRight:a}},_makeScrollPosition:function(t,e,i){var n={};return t.isUp?n.scrollTop=e.top:t.isDown&&(n.scrollTop=e.bottom-i.height),t.isLeft?n.scrollLeft=e.left:t.isRight&&(n.scrollLeft=e.right-i.rsideWidth+a),n},getOverflowFromMousePosition:function(t,e){var i=this._rebasePositionToContainer(t,e),n=this._getBodySize();return this._judgeOverflow(i,n)},_judgeOverflow:function(t,e){var i=t.x,n=t.y,o=0,s=0;return 0>n?o=-1:n>e.height&&(o=1),0>i?s=-1:i>e.totalWidth&&(s=1),{x:s,y:o}},getIndexFromMousePosition:function(t,e,i){var n=this._rebasePositionToContainer(t,e);return{row:this._calcRowIndexFromPositionY(n.y),column:this._calcColumnIndexFromPositionX(n.x,i)}},_calcRowIndexFromPositionY:function(t){var e=t+this.renderModel.get("scrollTop"),i=Math.floor(e/(this.get("rowHeight")+l)),n=0,s=Math.max(n,this.dataModel.length-1);return o.clamp(i,n,s)},_calcColumnIndexFromPositionX:function(t,e){var i=this.getColumnWidthList(),n=this.getFrameWidth(),o=t,s=t>=this.get("lsideWidth"),a=e?0:this.columnModel.getVisibleMetaColumnCount(),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":8,"../common/util":11}],19:[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){return!this.get("editingAddress")&&this.isCurrentCell(t,e,!0)&&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":10,"../common/util":11}],20:[function(t,e,i){"use strict";var n=t("./data/columnModel"),o=t("./data/rowList"),s=t("./toolbar"),a=t("./dimension"),l=t("./focus"),r=t("./renderer"),u=t("./renderer-smart"),d=t("./selection"),h={columnFixCount:0,columnModelList:[],keyColumnName:null,selectType:"",autoNumbering:!0,headerHeight:35,rowHeight:27,fitToParentHeight:!1,showDummyRows:!1,displayRowCount:10,minimumColumnWidth:50,notUseSmartRendering:!1,columnMerge:[],scrollX:!0,scrollY:!0,useClientSort:!0,singleClickEdit:!1,toolbar:{hasResizeHandler:!0,hasControlPanel:!0,hasPagination:!0}},c=tui.util.defineClass({init:function(t,e){t=$.extend(!0,{},h,t),this.gridId=t.gridId,this.columnModel=this._createColumnModel(t),this.dataModel=this._createDataModel(t,e),this.toolbarModel=this._createToolbarModel(t),this.dimensionModel=this._createDimensionModel(t,e),this.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=c},{"./data/columnModel":14,"./data/rowList":17,"./dimension":18,"./focus":19,"./renderer":22,"./renderer-smart":21,"./selection":25,"./toolbar":26}],21:[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)},_onFocusOrBlur:function(t,e){var i=this.dataModel.getMainRowKey(t,e),n=this._getRowModel(i,e);n&&n.updateClassName(e)},_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,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+=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");_.times(i,function(){_.each(["lside","rside"],function(t){this.get(t).add({height:n})},this)},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":8,"./rowList":24}],23:[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;return _.isUndefined(a)?t:(s=e.get(a),o=_.omit(t,"rowKey","_extraData","height"),_.each(o,function(o,l){var r=this._getRowSpanData(l,t,e.isRowSpanEnable()),u=s.getCellState(l),d=i.isTextType(l),h=i.getColumnModel(l);t[l]={rowKey:a,columnName:l,rowSpan:r.count,isMainRow:r.isMainRow,mainRowKey:r.mainRowKey,isEditable:u.isEditable,isDisabled:u.isDisabled,isEditing:n.isEditingCell(a,l),isFocused:n.isCurrentCell(a,l),optionList:tui.util.pick(h,"editOption","list"),className:this._getClassNameString(l,s,n),columnModel:h,changed:[]},_.assign(t[l],this._getValueAttrs(o,s,h,d))},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),i.isCurrentCell(e.get("rowKey"),t,!0)&&n.push("focused"),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":11}],24:[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":23}],25:[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]),h=$.extend({},t);return u&&d?(e=a.at(t.row[0]).getRowSpanData(),i=a.at(t.row[1]).getRowSpanData(),_.each(s,function(s){n=s.columnName,o={columnName:n,startIndex:t.row[0],endIndex:t.row[1],endRowSpanDataMap:i,startRowSpanDataMap:e,startIndexList:l,endIndexList:r,dataModel:a},this._concatRowSpanIndexFromStart(o),this._concatRowSpanIndexFromEnd(o)},this),h.row=[Math.min.apply(null,l),Math.max.apply(null,r)],h):h}});e.exports=a},{"../base/model":5,"../common/util":11}],26:[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}],27:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").attrName,a=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,"before"),n=this._getSpanWrapContent(n,"after"),e=this._getSpanWrapContent(e,"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={"class":t.className+" cell_content",align:t.columnModel.align||"left"};return e[s.EDIT_TYPE]=this.editType,e[s.ROW_KEY]=t.rowKey,e[s.COLUMN_NAME]=t.columnName,t.rowSpan&&(e.rowspan=t.rowSpan),e},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=a},{"../base/painter":6,"../common/constMap":8,"../common/util":11}],28:[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},{}],29:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").attrName,a=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},events:{dblclick:"_onDblClick"},selector:"td["+s.EDIT_TYPE+"=dummy]",template:_.template('="<%=columnName%>" class="<%=className%>" <%=attrEditType%>="dummy">​'),_onDblClick:function(){this.controller.appendEmptyRowAndFocus(!0)},generateHtml:function(t){var e=o.isMetaColumn(t);return this.template({attrColumnName:s.COLUMN_NAME,attrEditType:s.EDIT_TYPE,columnName:t,className:(e?"meta_column ":"")+"dummy"})}});e.exports=a},{"../base/painter":6,"../common/constMap":8,"../common/util":11}],30:[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":8}],31:[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":11,"./base":30}],32:[function(t,e,i){"use strict";var n=t("../../base/painter"),o=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.selector="input.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=o},{"../../base/painter":6}],33:[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":11,"./base":30}],34:[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":11,"./base":30}],35:[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":27,"./dummyCell":29,"./input/button":31,"./input/mainButton":32,"./input/select":33,"./input/text":34,"./row":36}],36:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").attrName,a=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){var e=this.painterManager.getCellPainter("dummy"),i="";return _.each(t,function(t){i+=e.generateHtml(t)}),i},_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");return i=_.isUndefined(n)?this._generateHtmlForDummyRow(e):this._generateHtmlForActualRow(t,e),this.template({rowKeyAttrName:s.ROW_KEY,rowKey:n,height:t.get("height")+a._extraHeight,contents:i,className:""})},refresh:function(t,e){_.each(t,function(t,i){var n,o,a;"_extraData"!==i&&(a=e.find("td["+s.COLUMN_NAME+"="+i+"]"),n=this._getEditType(i,t),o=this.painterManager.getCellPainter(n),o.refresh(t,a))},this)},"static":{_extraHeight:function(){var t=0;return o.isBrowserIE7()&&(t=-2),t}()}});e.exports=a},{"../base/painter":6,"../common/constMap":8,"../common/util":11}],37:[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},{}],38:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").keyCode,a=n.extend({initialize:function(t){this.setOwnProperties({focusModel:t.focusModel,selectionModel:t.selectionModel,painterManager:t.painterManager,dimensionModel:t.dimensionModel,dataModel:t.dataModel,columnModel:t.columnModel,renderModel:t.renderModel,timeoutIdForKeyIn:0,isLocked:!1}),this.listenTo(this.focusModel,"focusClipboard",this._onFocus)},tagName:"textarea",className:"clipboard",events:{keydown:"_onKeyDown",blur:"_onBlur"},_onBlur:function(){var t=this.focusModel;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"),h=t.keyCode||t.which,c=this._getIndexBeforeMove(),m=!0,g=!0;switch(h){case s.UP_ARROW:c.row-=1;break;case s.DOWN_ARROW:c.row+=1;break;case s.LEFT_ARROW:c.column-=1;break;case s.RIGHT_ARROW:c.column+=1;break;case s.PAGE_UP:c.row=a.prevRowIndex(d-1);break;case s.PAGE_DOWN:c.row=a.nextRowIndex(d-1);break;case s.HOME:c.column=0;break;case s.END:c.column=r.length-1;break;case s.ENTER:g=!1;break;case s.TAB:g=!1,a.focusIn(u.rowKey,a.prevColumnName(),!0);break;default:g=!1,m=!1}e=r[c.column],n=!(!e||!this.dataModel.getRowData(c.row)),g&&n&&(this._updateSelectionByKeyIn(c.row,c.column),i=l.getScrollPosition(c.row,e.columnName),i&&(o=this.selectionModel.getState(),"column"===o?delete i.scrollTop:"row"===o&&delete i.scrollLeft,this.renderModel.set(i))),m&&t.preventDefault()},_keyInWithCtrl:function(t){var e=this.focusModel,i=t.keyCode||t.which;switch(i){case s.CHAR_A:this.selectionModel.selectAll();break;case s.CHAR_C:this._copyToClipboard();break;case s.HOME:e.focus(e.firstRowKey(),e.firstColumnName(),!0);break;case s.END:e.focus(e.lastRowKey(),e.lastColumnName(),!0);break;case s.CHAR_V:this._paste()}},_paste:function(){this._clearClipBoard(),this.pasting||(this.pasting=!0,this._onKeyupCharV())},_onKeyupCharV:function(){this.$el.on("keyup",$.proxy(this.onKeyupCharV,this))},onKeyupCharV:function(){this._pasteToGrid(),this.pasting=!1},_clearClipBoard:function(){this.$el.val("")},_pasteToGrid:function(){var t,e,i=this.selectionModel,n=this.focusModel,o=this.dataModel;t=i.hasSelection()?i.getStartIndex():n.indexOf(),e=this._getProcessClipBoardData(),this.$el.off("keyup"),o.paste(e,t)},_getProcessClipBoardData:function(){for(var t=this.$el.val(),e=t.split("\n"),i=0,n=e.length;n>i;i+=1)e[i]=e[i].split(" ");return e},_keyInWithShiftAndCtrl:function(t){var e=!0,i=this.columnModel.getVisibleColumnModelList(),n=t.keyCode||t.which;switch(n){case s.HOME:this._updateSelectionByKeyIn(0,0);break;case s.END:this._updateSelectionByKeyIn(this.dataModel.length-1,i.length-1);break;default:e=!1}e&&t.preventDefault()},_del:function(){var t,e,i,n=this.selectionModel,o=this.dataModel,s=this.focusModel.which(),a=this.columnModel.getVisibleColumnModelList(),l=s.rowKey,r=s.columnName;if(n.hasSelection()){for(t=n.get("range"),e=t.row[0];e").addClass("left_line"),$("
").addClass("right_line")]);return this.$el.addClass("grid_wrapper uio_grid").attr("data-grid-id",this.gridId).append(t),this._appendBottomLine(),this._refreshHeight(),this.trigger("rendered"),this},_appendBottomLine:function(){var t=this.dimensionModel.get("toolbarHeight")+this.dimensionModel.getScrollXHeight();t&&this.$el.append($("
").addClass("data_bottom_line").css("bottom",t))},destroy:function(){this.stopListening(),$(window).off("resize.grid"),this._destroyChildren(),this.$el.replaceWith(this.__$el),this.$el=this.__$el=null}});e.exports=a},{"../base/view":7,"../common/constMap":8,"../common/gridEvent":10}],40:[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=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:"editing_layer 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)},_calculateLayoutStyle:function(t,e,i){var n=this.domState.getOffset(),s=this.domState.getElement(t,e),a=s.offset(),l=s.height(),r=s.width()-2*o;return{top:a.top-n.top,left: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=a},{"../base/view":7,"../common/constMap":8}],41:[function(t,e,i){"use strict";var n=t("./container"),o=t("./layout/toolbar"),s=t("./layout/toolbar/controlPanel"),a=t("./layout/toolbar/pagination"),l=t("./layout/toolbar/resizeHandler"),r=t("./stateLayer"),u=t("./clipboard"),d=t("./layout/frame-lside"),h=t("./layout/frame-rside"),c=t("./layout/header"),m=t("./layout/resizeHandler"),g=t("./layout/body"),f=t("./layout/bodyTable"),p=t("./rowList"),_=t("./selectionLayer"),M=t("./editingLayer"),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:h;return new e({dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,viewFactory:this})},createHeader:function(t){return new c({whichSide:t,renderModel:this.modelManager.renderModel,dimensionModel:this.modelManager.dimensionModel,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 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 _({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})}});e.exports=w},{"./clipboard":38,"./container":39,"./editingLayer":40,"./layout/body":42,"./layout/bodyTable":43,"./layout/frame-lside":44,"./layout/frame-rside":45,"./layout/header":47,"./layout/resizeHandler":48,"./layout/toolbar":49,"./layout/toolbar/controlPanel":50,"./layout/toolbar/pagination":51,"./layout/toolbar/resizeHandler":52,"./rowList":53,"./selectionLayer":54,"./stateLayer":55}],42:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap").attrName,a='
',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)},tagName:"div",className:"data",events:{scroll:"_onScroll","mousedown .body_container":"_onMouseDown"},_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.selectionModel,i=t.pageX,n=t.pageY,o=this._getMouseMoveDistance(i,n)>r;(e.hasSelection()||o)&&e.updateByMousePosition(i,n)},_getMouseMoveDistance:function(t,e){var i=Math.abs(this.mouseDownX-t),n=Math.abs(this.mouseDownY-e);return Math.round(Math.sqrt(Math.pow(i,2)+Math.pow(n,2)))},_onSelectStart:function(t){return t.preventDefault(),!1},render:function(){var t=this.whichSide;return this._destroyChildren(),this.dimensionModel.get("scrollX")||this.$el.css("overflow-x","hidden"),this.dimensionModel.get("scrollY")||"R"!==t||this.$el.css("overflow-y","hidden"),this.$el.css("height",this.dimensionModel.get("bodyHeight")),this.$container=$(a),this.$el.append(this.$container),this._addChildren([this.viewFactory.createBodyTable(t),this.viewFactory.createSelectionLayer(t)]),this.$container.append(this._renderChildren()),this._resetContainerHeight(),this}});e.exports=u},{"../../base/view":7,"../../common/constMap":8,"../../common/util":11}],43:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap"),a=s.dimension.CELL_BORDER_WIDTH,l=s.attrName.COLUMN_NAME,r=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({dimensionModel:t.dimensionModel,renderModel:t.renderModel,columnModel:t.columnModel,viewFactory:t.viewFactory,painterManager:t.painterManager,whichSide:t.whichSide||"R"}),this.listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged),this.listenTo(this.renderModel,"change:dummyRowCount",this._resetOverflow),this.listenTo(this.dimensionModel,"change:bodyHeight",this._resetHeight),this._attachAllTableEventHandlers()},tagName:"div",className:"table_container",template:_.template('<%=colGroup%><%=tbody%>
'),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-r.EXTRA_WIDTH),i+=t+a},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:l,columnName:t.columnName,width:e[i]-r.EXTRA_WIDTH})},this),n}},{EXTRA_WIDTH:o.isBrowserIE7()?20:0});e.exports=r},{"../../base/view":7,"../../common/constMap":8,"../../common/util":11}],44:[function(t,e,i){"use strict";var n=t("./frame"),o=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"L"})},className:"lside_area",_onColumnWidthChanged:function(){this.$el.css({width:this.dimensionModel.get("lsideWidth")})},beforeRender:function(){this.$el.css({display:"block",width:this.dimensionModel.get("lsideWidth")})},afterRender:function(){var t,e=this.dimensionModel;e.get("scrollX")&&(t=$("
").addClass("scrollbar_overlay").css("bottom",e.get("toolbarHeight")),this.$el.append(t))}});e.exports=o},{"./frame":46}],45:[function(t,e,i){"use strict";var n=t("./frame"),o=t("../../common/constMap").dimension.CELL_BORDER_WIDTH,s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"R",$scrollBorder:null}),this.listenTo(this.dimensionModel,"change:bodyHeight change:headerHeight",this._resetScrollBorderHeight)},className:"rside_area",_onColumnWidthChanged:function(){this._refreshLayout()},_refreshLayout:function(){var t=this.dimensionModel,e=t.get("rsideWidth"),i=t.get("lsideWidth");i>0&&!t.isDivisionBorderDoubled()&&(e+=o,i-=o),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,o=this.dimensionModel;o.get("scrollY")&&(n=o.get("headerHeight"),t=$("
").addClass("header_space"),e=$("
").addClass("scrollbar_border"),t.height(n-2),e.css("top",n+"px"),this.$el.append(t,e),o.get("scrollX")&&(i=$("
").addClass("scrollbar_corner").css("bottom",o.get("toolbarHeight")),this.$el.append(i)),this.$scrollBorder=e,this._resetScrollBorderHeight())}});e.exports=s},{"../../common/constMap":8,"./frame":46}],46:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({viewFactory:t.viewFactory,renderModel:t.renderModel,dimensionModel:t.dimensionModel,whichSide:t.whichSide||"R"}),this.listenTo(this.renderModel,"columnModelChanged",this.render,this).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged,this)},tagName:"div",className:"lside_area",render:function(){var t=this.viewFactory;return this.$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}],47:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s="selected",a=10,l=t("../../common/constMap").attrName.COLUMN_NAME,r=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)},tagName:"div",className:"header",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:l,columnName:i[e].columnName,width:t}))},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(s),t&&(e=this._getContainingMergedColumnNames(t),_.each(t.concat(e),function(t){i.filter("["+l+"="+t+"]").addClass(s)}))},_onMouseDown:function(t){var e,i;this.selectionModel.isEnabled()&&!$(t.target).is("a.btn_sorting")&&(e=$(t.target).closest("th").attr(l),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(l);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),a))},_getHeaderMainCheckbox:function(){return this.$el.find("th["+l+"=_button] input")},_syncCheckState:function(){var t,e,i;this.columnModel&&"checkbox"===this.columnModel.get("selectType")&&(t=this._getHeaderMainCheckbox(),t.length&&(e=0,i=this.dataModel.getRowList(!0).length,this.dataModel.forEach(function(t){var i=t.getCellState("_button");!i.isDisabled&&i.isEditable&&(e+=1)},this),t.prop("checked",e===i)))},_onColumnWidthChanged:function(){var t=this._getColumnData(),e=t.widthList,i=this.$el.find("col");_.each(e,function(t,e){i.eq(e).css("width",t+"px")})},_onScrollLeftChange:function(t,e){"R"===this.whichSide&&(this.el.scrollLeft=e)},_onClick:function(t){var e=$(t.target),i=e.closest("th").attr(l);"_button"===i&&e.is("input")?e.prop("checked")?this.dataModel.checkAll():this.dataModel.uncheckAll():e.is("a.btn_sorting")&&this.dataModel.sortByField(i)},_updateBtnSortState:function(t){this._$currentSortBtn&&this._$currentSortBtn.removeClass("sorting_down sorting_up"),this._$currentSortBtn=this.$el.find("th["+l+"="+t.columnName+"] a.btn_sorting"),this._$currentSortBtn.addClass(t.isAscending?"sorting_up":"sorting_down")},render:function(){return this._destroyChildren(),"R"!==this.whichSide||this.dimensionModel.get("scrollY")||this.$el.addClass("no_scroll"),this.$el.css({height:this.dimensionModel.get("headerHeight")}).html(this.template({colGroup:this._getColGroupMarkup(),tBody:this._getTableBodyMarkup()})),this._addChildren(this.viewFactory.createHeaderResizeHandler(this.whichSide)),this.$el.append(this._renderChildren()),this},_getColumnData:function(){var t=this.columnModel,e=this.dimensionModel,i=e.getColumnWidthList(this.whichSide),n=t.getVisibleColumnModelList(this.whichSide,!0);return{widthList:i,modelList:n}},_getTableBodyMarkup:function(){var t,e,i=this._getColumnHierarchyList(),n=this._getHierarchyMaxRowCount(i),s=this.dimensionModel.get("headerHeight"),a=new Array(n),r=new Array(n),u=[],d=o.getRowHeight(n,s)-1,h=1;return _.each(i,function(e,o){var c=i[o].length,m=0;_.each(e,function(e,i){var o=e.columnName;h=c-1===i&&n-c+1>1?n-c+1:1,t=d*h,i===c-1?t=s-m-2:m+=t+1,r[i]===o?(a[i].pop(),u[i]+=1):u[i]=1,r[i]=o,a[i]=a[i]||[],a[i].push(this.templateHeader({attrColumnName:l,columnName:o,className:e.isRequired?"required":"",height:t,colspan:u[i],rowspan:h,title:e.title,btnSort:e.isSortable?this.markupBtnSort:""}))},this)},this),e=_.map(a,function(t){return""+t.join("")+""}),e.join("")},_getHierarchyMaxRowCount:function(t){var e=[0];return _.each(t,function(t){e.push(t.length)},this),Math.max.apply(Math,e)},_getColumnHierarchyList:function(){var t,e=this._getColumnData().modelList;return t=_.map(e,function(t){return this._getColumnHierarchy(t).reverse()},this)},_getColumnHierarchy:function(t,e){var i=this.columnModel.get("columnMerge");return e=e||[],t&&(e.push(t),i&&_.each(i,function(i){-1!==$.inArray(t.columnName,i.columnNameList)&&this._getColumnHierarchy(i,e)},this)),e}});e.exports=r},{"../../base/view":7,"../../common/constMap":8,"../../common/util":11}],48:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/constMap").attrName.COLUMN_NAME,s=n.extend({initialize:function(t){this.setOwnProperties({dimensionModel:t.dimensionModel,columnModel:t.columnModel,whichSide:t.whichSide||"R",isResizing:!1,$target:null,differenceLeft:0,initialWidth:0,initialOffsetLeft:0,initialLeft:0}),this.listenTo(this.dimensionModel,"change:which columnWidthChanged",this._refreshHandlerPosition)},tagName:"div",className:"resize_handle_container",events:{"mousedown .resize_handle":"_onMouseDown","dblclick .resize_handle":"_onDblClick"},template:_.template('
="<%=columnName%>" class="resize_handle<% if(isLast === true) print(" resize_handle_last");%>" style="<%=height%>" title="마우스 드래그를 통해 컬럼의 넓이를 변경할 수 있고,더블클릭을 통해 넓이를 초기화할 수 있습니다.">
'),_getColumnData:function(){var t=this.columnModel,e=this.dimensionModel,i=e.getColumnWidthList(this.whichSide),n=t.getVisibleColumnModelList(this.whichSide,!0);return{widthList:i,modelList:n}},_getResizeHandlerMarkup:function(){var t,e=this._getColumnData(),i=e.modelList,n=this.dimensionModel.get("headerHeight"),s=i.length;return t=_.map(i,function(t,e){return this.template({attrColumnName:o,columnIndex:e,columnName:t.columnName,isLast:e+1===s,height:n})},this),t.join("")},render:function(){var t=this.dimensionModel.get("headerHeight"),e=this._getResizeHandlerMarkup();return this.$el.empty().show().html(e).css({marginTop:-t,height:t}),this._refreshHandlerPosition(),this},_refreshHandlerPosition:function(){var t,e,i,n=this._getColumnData(),s=n.widthList,a=this.$el.find(".resize_handle"),l=this.$el.parent().find("table:first"),r=!1,u=0,d=1,h=3;tui.util.forEachArray(a,function(n,c){t=a.eq(c),e=t.attr(o),i=l.find("th["+o+"="+e+"]").width(),tui.util.isExisty(i)?r=r||i!==s[c]:i=s[c],u+=i+d,t.css("left",u-h)})},_isResizing:function(){return!!this.isResizing},_onMouseDown:function(t){this._startResizing(t)},_onDblClick:function(t){var e=$(t.target),i=parseInt(e.attr("columnindex"),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("columnindex"),10),this.$target.css("left",e+"px"),this.dimensionModel.setColumnWidth(this._getHandlerColumnIndex(n),i),this._refreshHandlerPosition())},_calculateWidth:function(t){var e=t-this.initialOffsetLeft-this.initialLeft;return this.initialWidth+e},_getHandlerColumnIndex:function(t){return"R"===this.whichSide?t+this.columnModel.getVisibleColumnFixCount(!0):t},_startResizing:function(t){var e=this._getColumnData(),i=e.widthList,n=$(t.target);this.isResizing=!0,this.$target=n,this.initialLeft=parseInt(n.css("left").replace("px",""),10),this.initialOffsetLeft=this.$el.offset().left,this.initialWidth=i[n.attr("columnindex")],$("body").css("cursor","col-resize"),$(document).bind("mousemove",$.proxy(this._onMouseMove,this)).bind("mouseup",$.proxy(this._onMouseUp,this)), -n[0].setCapture&&n[0].setCapture()},_stopResizing:function(){this.$target&&this.$target[0].releaseCapture&&this.$target[0].releaseCapture(),this.isResizing=!1,this.$target=null,this.initialLeft=0,this.initialOffsetLeft=0,this.initialWidth=0,$("body").css("cursor","default"),$(document).unbind("mousemove",$.proxy(this._onMouseMove,this)).unbind("mouseup",$.proxy(this._onMouseUp,this))},destroy:function(){this.stopListening(),this._stopResizing(),this.remove()}});e.exports=s},{"../../base/view":7,"../../common/constMap":8}],49:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.toolbarModel=t.toolbarModel,this.dimensionModel=t.dimensionModel,this.viewFactory=t.viewFactory},tagName:"div",className:"toolbar",render:function(){var t=this.toolbarModel;return this._destroyChildren(),t.get("hasControlPanel")&&this._addChildren(this.viewFactory.createToolbarControlPanel()),t.get("hasResizeHandler")&&this._addChildren(this.viewFactory.createToolbarResizeHandler()),t.get("hasPagination")&&this._addChildren(this.viewFactory.createToolbarPagination()),this.$el.empty().append(this._renderChildren()),this._refreshHeight(),this},_refreshHeight:function(){var t=this.dimensionModel.get("toolbarHeight");this.$el.height(t),this.$el.toggle(!!t)}});e.exports=o},{"../../base/view":7}],50:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.setOwnProperties({gridId:t.gridId,toolbarModel:t.toolbarModel,$btnExcel:null,$btnExcelAll:null}),this.listenTo(this.toolbarModel,"change:isExcelButtonVisible change:isExcelAllButtonVisible",this.render)},events:{"click a.excel_download_button":"_onClickExcel"},tagName:"div",className:"btn_setup",templateExcelBtn:_.template('<%=text%>'),_onClickExcel:function(t){var e,i=tui.Grid.getInstanceById(this.gridId),n=i.getAddOn("Net");t.preventDefault(),n&&(e=$(t.target).closest("a"),e.hasClass("excel_page")?n.download("excel"):e.hasClass("excel_all")&&n.download("excelAll"))},render:function(){var t=this.toolbarModel;return this.$el.empty(),t.get("isExcelButtonVisible")&&this.$el.append(this.templateExcelBtn({className:"excel_page",text:"엑셀 다운로드"})),t.get("isExcelAllButtonVisible")&&this.$el.append(this.templateExcelBtn({className:"excel_all",text:"전체 엑셀 다운로드"})),this}});e.exports=o},{"../../../base/view":7}],51:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.toolbarModel=t.toolbarModel},tagName:"div",className:"grid_pagination",template:_.template('FirstPrev LastFirst OffPrev OffNext OffLast Off'),render:function(){return this._destroyChildren(),this.$el.empty().html(this.template()),this._setPaginationInstance(),this},_setPaginationInstance:function(){var t=tui&&tui.component&&tui.component.Pagination,e=this.toolbarModel.get("pagination");!e&&t&&(e=new t({itemCount:1,itemPerPage:1,pagePerPageList:5,isCenterAlign:!0,moveUnit:"page",$preOff:this.$el.find(".pre_off"),$pre_endOff:this.$el.find(".pre_end_off"),$nextOff:this.$el.find(".next_off"),$lastOff:this.$el.find(".next_end_off")},this.$el)),this.toolbarModel.set("pagination",e)}});e.exports=o},{"../../../base/view":7}],52:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.timeoutIdForResize=0},tagName:"div",className:"height_resize_bar",template:_.template(''),events:{mousedown:"_onMouseDown"},_attachMouseEvent:function(){$(document).on("mousemove",$.proxy(this._onMouseMove,this)),$(document).on("mouseup",$.proxy(this._onMouseUp,this)),$(document).on("selectstart",$.proxy(this._onSelectStart,this))},_detachMouseEvent:function(){$(document).off("mousemove",$.proxy(this._onMouseMove,this)),$(document).off("mouseup",$.proxy(this._onMouseUp,this)),$(document).off("selectstart",$.proxy(this._onSelectStart,this))},_onMouseDown:function(t){t.preventDefault(),$(document.body).css("cursor","row-resize"),this._attachMouseEvent()},_onMouseMove:function(t){var e=this.dimensionModel,i=e.get("offsetTop"),n=e.get("headerHeight"),o=e.get("rowHeight"),s=e.get("toolbarHeight"),a=t.pageY-i-n-s;clearTimeout(this.timeoutIdForResize),a=Math.max(a,o+e.getScrollXHeight()),this.timeoutIdForResize=setTimeout(function(){e.set({bodyHeight:a})},0)},_onMouseUp:function(){$(document.body).css("cursor","default"),this._detachMouseEvent()},_onSelectStart:function(t){return t.preventDefault(),!1},render:function(){return this._destroyChildren(),this.$el.html(this.template()),this},destroy:function(){this.stopListening(),this._onMouseUp(),this._destroyChildren(),this.remove()}});e.exports=o},{"../../../base/view":7}],53:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").attrName,a="selected",l="focused_row",r="td.meta_column",u=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(u.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){u.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");t=this.selectionModel.hasSelection()?this._filterRowsByIndexRange(e,this.selectionModel.get("range").row):this._filterRowByKey(e,this.focusModel.get("rowKey")),e.find(r).removeClass(a),t.find(r).addClass(a)},_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,a=this.dataModel.getMainRowKey(t,i);n[a]||(n[a]=this._getRowElement(a)),o=n[a].find("td["+s.COLUMN_NAME+"="+i+"]"),o.toggleClass(l,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=u},{"../base/view":7,"../common/constMap":8,"../common/util":11}],54:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").dimension.CELL_BORDER_WIDTH,a=n.extend({initialize:function(t){this.setOwnProperties({whichSide:t.whichSide||"R",dimensionModel:t.dimensionModel,columnModel:t.columnModel,selectionModel:t.selectionModel}),this._updateColumnWidthList(),this.listenTo(this.dimensionModel,"columnWidthChanged",this._onChangeColumnWidth),this.listenTo(this.selectionModel,"change:range",this.render)},tagName:"div",className:"selection_layer",_updateColumnWidthList:function(){this.columnWidthList=this.dimensionModel.getColumnWidthList(this.whichSide)},_onChangeColumnWidth:function(){this._updateColumnWidthList(),this.render()},_getOwnSideColumnRange:function(t){var e=this.columnModel.getVisibleColumnFixCount(),i=null;return"L"===this.whichSide?t[0]=e&&(i=[Math.max(t[0],e)-e,t[1]-e]),i},_getVerticalStyles:function(t){var e=this.dimensionModel.get("rowHeight"),i=o.getHeight(t[0],e),n=o.getHeight(t[1]-t[0]+1,e)-s;return{top:i+"px",height:n+"px"}},_getHorizontalStyles:function(t){var e=this.columnWidthList,i=this.columnModel.getVisibleMetaColumnCount(),n=t[0],o=t[1],a=0,l=0,r=0;for("L"===this.whichSide&&(n+=i,o+=i),o=Math.min(o,e.length-1);o>=r;r+=1)n>r?a+=e[r]+s:l+=e[r]+s;return l-=s,{left:a+"px",width:l+"px"}},render:function(){var t,e,i=this.selectionModel.get("range");return i&&(e=this._getOwnSideColumnRange(i.column)),e?(t=_.assign({},this._getVerticalStyles(i.row),this._getHorizontalStyles(e)),this.$el.show().css(t)):this.$el.hide(),this}});e.exports=a},{"../base/view":7,"../common/constMap":8,"../common/util":11}],55:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").renderState,s=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.renderModel=t.renderModel,this.timeoutIdForDelay=null,this.listenTo(this.dimensionModel,"change",this._refreshLayout),this.listenTo(this.renderModel,"change:state",this.render)},className:"state_layer",template:_.template('
<%= text %> <% if (isLoading) { %>
<% } %>
'),render:function(){var t=this.renderModel.get("state");return t===o.DONE?this.$el.hide():this._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=s},{"../base/view":7,"../common/constMap":8}]},{},[13]); \ No newline at end of file +!function t(e,i,n){function o(a,l){if(!i[a]){if(!e[a]){var r="function"==typeof require&&require;if(!l&&r)return r(a,!0);if(s)return s(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var d=i[a]={exports:{}};e[a][0].call(d.exports,function(t){var i=e[a][1][t];return o(i?i:t)},d,d.exports,t,e,i,n)}return i[a].exports}for(var s="function"==typeof require&&require,a=0;a0?i=confirm(this._getConfirmMessage(t,e)):alert(this._getConfirmMessage(t,e)),i},_getConfirmMessage:function(t,e){var i,n={createData:"입력",updateData:"수정",deleteData:"삭제",modifyData:"반영"},o=n[t];return i=e>0?e+"건의 데이터를 "+o+"하시겠습니까?":o+"할 데이터가 없습니다."},_ajax:function(t){var e,i=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 diff --git a/package.json b/package.json index 5d631d1ef..e6c638a63 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tui-grid", - "version": "1.2.0-c", + "version": "1.2.1", "description": "grid", "main": "gulpfiles.js", "directories": { diff --git a/samples/css/grid.css b/samples/css/grid.css index 08881c6bb..2648513ca 100644 --- a/samples/css/grid.css +++ b/samples/css/grid.css @@ -1,76 +1,75 @@ /** * @fileoverview tui-grid * @author NHN Ent. FE Development Team - * @version 1.2.0-c + * @version 1.2.1 * @license MIT * @link https://github.com/nhnent/tui.grid */ -.uio_grid { +.tui-grid-container { width: 100%; - background: #fff; - color: #444; position: relative; - border-bottom: solid 1px #ccc; + border-style: solid; + border-width: 0 0 1px; clear: both; - scrollbar-highlight-color: #f5f5f5; - scrollbar-shadow-color: #f5f5f5; - scrollbar-arrow-color: #8a8a8a; - scrollbar-face-color: #d9d9d9; - scrollbar-3dlight-color: #f5f5f5; - scrollbar-darkshadow-color: #f5f5f5; - scrollbar-track-color: #f5f5f5; font-size: 12px; font-family: '돋움', Dotum, Helvetica, 'Apple SD Gothic Neo', Sans-serif; } -.uio_grid ::-webkit-scrollbar { +.tui-grid-container.tui-grid-no-scroll-x { + border-bottom-width: 0; +} +.tui-grid-container ::-webkit-scrollbar { -webkit-appearance: none; width: 17px; height: 17px; - background-color: #f5f5f5; } -.uio_grid ::-webkit-scrollbar-thumb { - background-color: #d9d9d9; +.tui-grid-container ::-webkit-scrollbar-thumb { border: 5px solid transparent; border-radius: 7px; background-clip: content-box; } -.uio_grid ::-webkit-scrollbar-thumb:hover { - background-color: #c1c1c1; -} -.uio_grid * { +.tui-grid-container * { box-sizing: content-box; } -.uio_grid p, -.uio_grid input { +.tui-grid-container p, +.tui-grid-container input { margin: 0; padding: 0; } -.uio_grid fieldset { +.tui-grid-container fieldset { margin: 0; padding: 0; border: 0; display: inline; white-space: nowrap; } -.uio_grid input[type=text] { +.tui-grid-container input[type=text], +.tui-grid-container input[type=password] { outline: none; + box-sizing: border-box; line-height: normal; } -.uio_grid ul, -.uio_grid li { +.tui-grid-container ul, +.tui-grid-container li { list-style: none; padding: 0; margin: 0; } -.uio_grid strong, -.uio_grid em { +.tui-grid-container strong, +.tui-grid-container em { font-style: normal; } -.uio_grid .btn_text { +.tui-grid-clipboard { + position: fixed; + top: 0px; + left: -9999px; + width: 100px; + height: 100px; +} +.tui-grid-btn-text { display: inline-block; text-decoration: none; } -.uio_grid .btn_text span { +.tui-grid-btn-text span { display: inline-block; position: relative; font-size: 11px; @@ -83,7 +82,7 @@ margin-left: 8px; padding-right: 7px; } -.uio_grid .btn_text em { +.tui-grid-btn-text em { position: absolute; left: 0; top: 5px; @@ -91,40 +90,26 @@ height: 12px; background: url("../images/icons.gif") no-repeat; } -.uio_grid .btn_text em.excel { - background-position: -30px -60px; -} -.uio_grid .btn_text em.grid { +.tui-grid-btn-text em.tui-grid-btn-excel-icon { background-position: -30px -60px; } -.uio_grid .clipboard { - position: fixed; - top: 0px; - left: -9999px; - width: 100px; - height: 100px; -} -.uio_grid .cell_content input[type=text], -.uio_grid .cell_content input[type=password] { - width: 100%; - padding: 2px 0; - border: solid 1px #e2e3ea; - border-top: solid 1px #abadb3; - border-bottom: solid 1px #e3e9ef; -} -.uio_grid .cell_content input.editing { - border: solid 1px #748eea; -} -.uio_grid .cell_content label + input { - margin-left: 10px; +.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; + vertical-align: middle; + cursor: pointer; } -.uio_grid .cell_content select { - width: 100%; +.tui-grid-btn-sorting-down { + background-position: 0 -60px; } -.uio_grid .cell_content a { - color: #002caf; +.tui-grid-btn-sorting-up { + background-position: -10px -60px; } -.uio_grid .state_layer { +.tui-grid-layer-state { position: absolute; top: 0; left: 0; @@ -135,10 +120,10 @@ text-align: center; z-index: 12; } -.uio_grid .state_layer .layer_content { +.tui-grid-layer-state-content { padding-top: 50px; } -.uio_grid .state_layer .layer_content .loading_img { +.tui-grid-layer-state-loading { display: block; margin: 10px auto 0; background: url("../images/ani_loading.gif"); @@ -146,43 +131,149 @@ width: 150px; height: 13px; } -.uio_grid .editing_layer { +.tui-grid-layer-editing { position: absolute; display: none; background: #fff; z-index: 15; padding: 0 10px; - border: dotted 1px #190000; + border-style: solid; + border-width: 1px; + 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; + border-style: solid; + border-width: 1px; + opacity: 0.2; + filter: alpha(opacity=10); +} +.tui-grid-table { + width: 100%; + border-width: 1px; + box-sizing: border-box; + border-style: solid; + table-layout: fixed; + border-collapse: collapse; + margin: 0; +} +.tui-grid-cell { + overflow: hidden; white-space: nowrap; + *white-space: pre; + border-width: 1px; + border-style: solid; + padding: 0 10px; +} +.tui-grid-cell img { + vertical-align: middle; +} +.tui-grid-cell-head { + padding: 0; + 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 { + 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; + *margin-left: -2px; + *padding-left: 2px; +} +.tui-grid-cell-content input[type=text], +.tui-grid-cell-content input[type=password] { + width: 100%; + padding: 2px 0; + border: solid 1px #e2e3ea; + border-top: solid 1px #abadb3; + border-bottom: solid 1px #e3e9ef; +} +.tui-grid-cell-content label + input { + margin-left: 10px; +} +.tui-grid-cell-content select { + box-sizing: border-box; + width: 100%; } -.uio_grid .left_line { +.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; - background: #ccc; 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; } -.uio_grid .right_line { - position: absolute; - background: #ccc; - z-index: 13; +.tui-grid-border-line-right { top: 0; bottom: 0; right: 0; width: 1px; } -.uio_grid .data_bottom_line { - position: absolute; - background: #ccc; - z-index: 13; +.tui-grid-border-line-bottom { bottom: 0; left: 0; right: 17px; height: 1px; } -.uio_grid .lside_area { +.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; @@ -191,243 +282,86 @@ overflow: hidden; z-index: 10; } -.uio_grid .lside_area .header { +.tui-grid-lside-area .tui-grid-head-area { overflow: hidden; } -.uio_grid .lside_area .data { - overflow: scroll; +.tui-grid-lside-area .tui-grid-body-area { position: relative; + overflow: scroll; margin-right: -17px; } -.uio_grid .lside_area .data .selection_layer { - display: none; - position: absolute; - top: 0; - width: 0; - height: 0; - border: solid 1px #004082; - background: #4daaf9; - opacity: 0.2; - filter: alpha(opacity=10); +.tui-grid-lside-area .tui-grid-body-area .tui-grid-selection-layer { left: 1px; } -.uio_grid .lside_area .scrollbar_overlay { - position: absolute; - bottom: 0; - left: 0; - right: 0; - height: 17px; - background-color: #f5f5f5; -} -.uio_grid .rside_area { +.tui-grid-rside-area { display: none; height: 100%; overflow: hidden; } -.uio_grid .rside_area .header { +.tui-grid-rside-area .tui-grid-head-area { position: relative; margin-right: 17px; overflow: hidden; } -.uio_grid .rside_area .header.no_scroll { +.tui-grid-rside-area .tui-grid-head-area.tui-grid-no-scroll-y { margin-right: 0; } -.uio_grid .rside_area .data { +.tui-grid-rside-area .tui-grid-body-area { position: relative; overflow: scroll; } -.uio_grid .rside_area .data .selection_layer { - display: none; +.tui-grid-body-container { + position: relative; + margin-top: -1px; +} +.tui-grid-table-container { position: absolute; - top: 0; - width: 0; - height: 0; - border: solid 1px #004082; - background: #4daaf9; - opacity: 0.2; - filter: alpha(opacity=10); } -.uio_grid .rside_area .header_space { +.tui-grid-scrollbar-head { display: block; position: absolute; top: 0; right: 0; width: 16px; - border: solid 1px #ccc; - background: #eee; + border-style: solid; + border-width: 1px; } -.uio_grid .rside_area .scrollbar_border { - display: block; +.tui-grid-scrollbar-left-bottom { position: absolute; - right: 17px; - width: 1px; - background: #ccc; + bottom: 0; + left: 0; + right: 0; + height: 17px; } -.uio_grid .rside_area .scrollbar_corner { +.tui-grid-scrollbar-right-bottom { position: absolute; bottom: 0; right: 0; width: 17px; height: 17px; - background-color: #f5f5f5; } -.uio_grid .header .resize_handle_container { - display: none; - position: relative; - width: 0; -} -.uio_grid .header .resize_handle_container .resize_handle { - float: left; - position: absolute; - top: -1px; - left: -99px; - width: 7px; - height: 100%; - background: #f00; - opacity: 0; - filter: alpha(opacity=0); - cursor: col-resize; -} -.uio_grid .header .resize_handle_container .resize_handle_last { - width: 3px; -} -.uio_grid .body_container { - position: relative; - margin-top: -1px; -} -.uio_grid .body_container .table_container { - position: absolute; -} -.uio_grid table { - border: 0; - table-layout: fixed; - background-color: #d8d8d8; - border-collapse: separate; - border-spacing: 1px; - margin: 0; -} -.uio_grid table th { - overflow: hidden; - white-space: nowrap; - *white-space: pre; - text-align: center; - padding: 0; - border: 0; - background: #eee; -} -.uio_grid table th.selected { - background: #cdcdcd; -} -.uio_grid table th .sort a { - color: #555; - text-decoration: none; -} -.uio_grid table th .btn_sorting { - display: inline-block; - overflow: hidden; - margin-left: 6px; - height: 15px; - width: 8px; - background: url("../images/icons.gif") -20px -60px no-repeat; - vertical-align: middle; - cursor: pointer; -} -.uio_grid table th .sorting_down { - background-position: 0 -60px; -} -.uio_grid table th .sorting_up { - background-position: -10px -60px; -} -.uio_grid table tr.disabled { - color: #b0b0b0; -} -.uio_grid table td { - overflow: hidden; - padding: 0 10px; - *padding: 1px 10px; - border: 0; - white-space: nowrap; - background-color: #fbfbfb; - *white-space: pre; -} -.uio_grid table td.meta_column { - background: #eee; -} -.uio_grid table td.meta_column.dummy { - background: #eee; -} -.uio_grid table td.meta_column.selected { - background: #cdcdcd; -} -.uio_grid table td.editable { - background-color: #fff; -} -.uio_grid table td.dummy { - background-color: #fff; -} -.uio_grid table td.required { - background-color: #fffdeb; -} -.uio_grid table td.disabled { - color: #b0b0b0; -} -.uio_grid table td.focused { - padding: 0 9px; - border: dotted 1px #190000; -} -.uio_grid table td.invalid { - padding: 0 9px; - border: solid 1px #ff8080; -} -.uio_grid table td.ellipsis { - -o-text-overflow: ellipsis /*Opera 9*/; - -moz-binding: url("ellipsis.xml#ellipsis") /* Firefox */; - width: 100% /* for IE6 */; - text-overflow: ellipsis; -} -.uio_grid table td img { - vertical-align: middle; -} -.uio_grid table td span.before { - float: left; - margin-right: 2px; - line-height: 1.5; -} -.uio_grid table td span.after { - float: right; - margin-left: 2px; - line-height: 1.5; -} -.uio_grid table td span.input { +.tui-grid-scrollbar-border { display: block; - overflow: hidden; - line-height: 1.5; - *margin-left: -2px; - *padding-left: 2px; + position: absolute; + right: 17px; + width: 1px; } -.uio_grid .toolbar { +.tui-grid-toolbar { display: none; width: 100%; height: 65px; bottom: 0px; position: absolute; - background: #fff; - border-top: 1px solid #ccc; + border-style: solid; + border-width: 1px 0 0; z-index: 11; } -.uio_grid .toolbar .total_count { - position: absolute; - top: 20px; - left: 24px; - color: #002caf; - font-weight: bold; -} -.uio_grid .toolbar .btn_setup { +.tui-grid-toolbar-btn-holder { position: absolute; right: 10px; top: 14px; } -.uio_grid .toolbar .height_resize_bar { +.tui-grid-height-resize-bar { overflow: hidden; cursor: row-resize; position: absolute; @@ -438,29 +372,30 @@ font-size: 0; text-align: center; } -.uio_grid .toolbar .height_resize_bar span { +.tui-grid-height-resize-bar span { background: url("../images/icons.gif") no-repeat -70px -60px; display: inline-block; width: 17px; height: 6px; margin-top: 5px; } -.uio_grid .toolbar .height_resize_handle { +.tui-grid-height-resize-handle { display: block; margin: 0 10px; - border-top: 1px solid #ccc; + border-style: solid; + border-width: 1px 0 0; cursor: row-resize; } -.uio_grid .grid_pagination { +.tui-grid-pagination { height: 12px; margin-bottom: 12px; padding-top: 14px; line-height: normal; text-align: center; } -.uio_grid .grid_pagination a, -.uio_grid .grid_pagination strong, -.uio_grid .grid_pagination span { +.tui-grid-pagination a, +.tui-grid-pagination strong, +.tui-grid-pagination span { display: inline-block; position: relative; padding: 4px 8px 4px; @@ -472,20 +407,20 @@ text-decoration: none; vertical-align: middle; } -.uio_grid .grid_pagination strong { +.tui-grid-pagination strong { padding: 4px 6px 4px; color: #ff1313; border: 1px solid #d4d4d4; background: #e7e7e7; } -.uio_grid .grid_pagination .pre_end, -.uio_grid .grid_pagination .pre_end_off, -.uio_grid .grid_pagination .pre, -.uio_grid .grid_pagination .pre_off, -.uio_grid .grid_pagination .next, -.uio_grid .grid_pagination .next_off, -.uio_grid .grid_pagination .next_end, -.uio_grid .grid_pagination .next_end_off { +.tui-grid-pagination .tui-grid-pre-end, +.tui-grid-pagination .tui-grid-pre-end-off, +.tui-grid-pagination .tui-grid-pre, +.tui-grid-pagination .tui-grid-pre-off, +.tui-grid-pagination .tui-grid-next, +.tui-grid-pagination .tui-grid-next-off, +.tui-grid-pagination .tui-grid-next-end, +.tui-grid-pagination .tui-grid-next-end-off { overflow: hidden; width: 25px; height: 24px; @@ -497,41 +432,41 @@ overflow: hidden; white-space: nowrap; } -.uio_grid .grid_pagination .pre_end, -.uio_grid .grid_pagination .pre_end_off, -.uio_grid .grid_pagination .next_end, -.uio_grid .grid_pagination .next_end_off { +.tui-grid-pagination .tui-grid-pre-end, +.tui-grid-pagination .tui-grid-pre-end-off, +.tui-grid-pagination .tui-grid-next-end, +.tui-grid-pagination .tui-grid-next-end-off { width: 24px; } -.uio_grid .grid_pagination .pre, -.uio_grid .grid_pagination .pre_off { +.tui-grid-pagination .tui-grid-pre, +.tui-grid-pagination .tui-grid-pre-off { margin-right: 12px; } -.uio_grid .grid_pagination .next, -.uio_grid .grid_pagination .next_off { +.tui-grid-pagination .tui-grid-next, +.tui-grid-pagination .tui-grid-next-off { margin-left: 12px; } -.uio_grid .grid_pagination .pre_end { +.tui-grid-pagination .tui-grid-pre-end { background-position: 0 0; } -.uio_grid .grid_pagination .pre_end_off { +.tui-grid-pagination .tui-grid-pre-end-off { background-position: 0 -30px; } -.uio_grid .grid_pagination .pre { +.tui-grid-pagination .tui-grid-pre { background-position: -24px 0; } -.uio_grid .grid_pagination .pre_off { +.tui-grid-pagination .tui-grid-pre-off { background-position: -24px -30px; } -.uio_grid .grid_pagination .next { +.tui-grid-pagination .tui-grid-next { background-position: -50px 0; } -.uio_grid .grid_pagination .next_off { +.tui-grid-pagination .tui-grid-next-off { background-position: -50px -30px; } -.uio_grid .grid_pagination .next_end { +.tui-grid-pagination .tui-grid-next-end { background-position: -75px 0; } -.uio_grid .grid_pagination .next_end_off { +.tui-grid-pagination .tui-grid-next-end-off { background-position: -75px -30px; } diff --git a/samples/css/grid.min.css b/samples/css/grid.min.css index 3b3f3a6ad..c4b6fa238 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.0-c + * @version 1.2.1 * @license MIT * @link https://github.com/nhnent/tui.grid */ -.uio_grid fieldset,.uio_grid input,.uio_grid p{padding:0;margin:0}.uio_grid{width:100%;background:#fff;color:#444;position:relative;border-bottom:solid 1px #ccc;clear:both;scrollbar-highlight-color:#f5f5f5;scrollbar-shadow-color:#f5f5f5;scrollbar-arrow-color:#8a8a8a;scrollbar-face-color:#d9d9d9;scrollbar-3dlight-color:#f5f5f5;scrollbar-darkshadow-color:#f5f5f5;scrollbar-track-color:#f5f5f5;font-size:12px;font-family:'돋움',Dotum,Helvetica,'Apple SD Gothic Neo',Sans-serif}.uio_grid ::-webkit-scrollbar{-webkit-appearance:none;width:17px;height:17px;background-color:#f5f5f5}.uio_grid ::-webkit-scrollbar-thumb{background-color:#d9d9d9;border:5px solid transparent;border-radius:7px;background-clip:content-box}.uio_grid ::-webkit-scrollbar-thumb:hover{background-color:#c1c1c1}.uio_grid *{box-sizing:content-box}.uio_grid fieldset{border:0;display:inline;white-space:nowrap}.uio_grid input[type=text]{outline:0;line-height:normal}.uio_grid li,.uio_grid ul{list-style:none;padding:0;margin:0}.uio_grid em,.uio_grid strong{font-style:normal}.uio_grid .btn_text{display:inline-block;text-decoration:none}.uio_grid .btn_text span{display:inline-block;position:relative;font-size:11px;color:#333;padding-left:17px;letter-spacing:-1px;line-height:23px;white-space:nowrap;cursor:pointer;margin-left:8px;padding-right:7px}.uio_grid .btn_text em{position:absolute;left:0;top:5px;width:17px;height:12px;background:url(../images/icons.gif) no-repeat}.uio_grid .btn_text em.excel,.uio_grid .btn_text em.grid{background-position:-30px -60px}.uio_grid .clipboard{position:fixed;top:0;left:-9999px;width:100px;height:100px}.uio_grid .cell_content input[type=password],.uio_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}.uio_grid .cell_content input.editing{border:1px solid #748eea}.uio_grid .cell_content label+input{margin-left:10px}.uio_grid .cell_content select{width:100%}.uio_grid .cell_content a{color:#002caf}.uio_grid .state_layer{position:absolute;top:0;left:0;width:100%;border-bottom:solid 1px #ccc;background:#fff;font-weight:700;text-align:center;z-index:12}.uio_grid .state_layer .layer_content{padding-top:50px}.uio_grid .state_layer .layer_content .loading_img{display:block;margin:10px auto 0;background:url(../images/ani_loading.gif);border:0;width:150px;height:13px}.uio_grid .editing_layer{position:absolute;display:none;background:#fff;z-index:15;padding:0 10px;border:1px dotted #190000;white-space:nowrap}.uio_grid .data_bottom_line,.uio_grid .left_line,.uio_grid .right_line{background:#ccc;z-index:13;position:absolute;bottom:0}.uio_grid .left_line{top:0;left:0;width:1px}.uio_grid .right_line{top:0;right:0;width:1px}.uio_grid .data_bottom_line{left:0;right:17px;height:1px}.uio_grid .lside_area{display:none;height:100%;position:absolute;top:0;left:0;overflow:hidden;z-index:10}.uio_grid .lside_area .header{overflow:hidden}.uio_grid .lside_area .data{overflow:scroll;position:relative;margin-right:-17px}.uio_grid .lside_area .data .selection_layer{display:none;position:absolute;top:0;width:0;height:0;border:1px solid #004082;background:#4daaf9;opacity:.2;filter:alpha(opacity=10);left:1px}.uio_grid .lside_area .scrollbar_overlay{position:absolute;bottom:0;left:0;right:0;height:17px;background-color:#f5f5f5}.uio_grid .rside_area{display:none;height:100%;overflow:hidden}.uio_grid .rside_area .header{position:relative;margin-right:17px;overflow:hidden}.uio_grid .rside_area .header.no_scroll{margin-right:0}.uio_grid .rside_area .data{position:relative;overflow:scroll}.uio_grid .rside_area .data .selection_layer{display:none;position:absolute;top:0;width:0;height:0;border:1px solid #004082;background:#4daaf9;opacity:.2;filter:alpha(opacity=10)}.uio_grid .rside_area .header_space{display:block;position:absolute;top:0;right:0;width:16px;border:1px solid #ccc;background:#eee}.uio_grid .rside_area .scrollbar_border{display:block;position:absolute;right:17px;width:1px;background:#ccc}.uio_grid .rside_area .scrollbar_corner{position:absolute;bottom:0;right:0;width:17px;height:17px;background-color:#f5f5f5}.uio_grid .header .resize_handle_container{display:none;position:relative;width:0}.uio_grid .header .resize_handle_container .resize_handle{float:left;position:absolute;top:-1px;left:-99px;width:7px;height:100%;background:red;opacity:0;filter:alpha(opacity=0);cursor:col-resize}.uio_grid .header .resize_handle_container .resize_handle_last{width:3px}.uio_grid .body_container{position:relative;margin-top:-1px}.uio_grid .body_container .table_container{position:absolute}.uio_grid table{border:0;table-layout:fixed;background-color:#d8d8d8;border-collapse:separate;border-spacing:1px;margin:0}.uio_grid table th{overflow:hidden;white-space:nowrap;text-align:center;padding:0;border:0;background:#eee}.uio_grid table th.selected{background:#cdcdcd}.uio_grid table th .sort a{color:#555;text-decoration:none}.uio_grid table td.disabled,.uio_grid table tr.disabled{color:#b0b0b0}.uio_grid table th .btn_sorting{display:inline-block;overflow:hidden;margin-left:6px;height:15px;width:8px;background:url(../images/icons.gif) -20px -60px no-repeat;vertical-align:middle;cursor:pointer}.uio_grid table th .sorting_down{background-position:0 -60px}.uio_grid table th .sorting_up{background-position:-10px -60px}.uio_grid table td{overflow:hidden;padding:0 10px;border:0;white-space:nowrap;background-color:#fbfbfb}.uio_grid table td.meta_column,.uio_grid table td.meta_column.dummy{background:#eee}.uio_grid table td.meta_column.selected{background:#cdcdcd}.uio_grid table td.dummy,.uio_grid table td.editable{background-color:#fff}.uio_grid table td.required{background-color:#fffdeb}.uio_grid table td.focused{padding:0 9px;border:1px dotted #190000}.uio_grid table td.invalid{padding:0 9px;border:1px solid #ff8080}.uio_grid table td.ellipsis{-o-text-overflow:ellipsis;-moz-binding:url(ellipsis.xml#ellipsis);width:100%;text-overflow:ellipsis}.uio_grid table td img{vertical-align:middle}.uio_grid table td span.before{float:left;margin-right:2px;line-height:1.5}.uio_grid table td span.after{float:right;margin-left:2px;line-height:1.5}.uio_grid table td span.input{display:block;overflow:hidden;line-height:1.5}.uio_grid .toolbar{display:none;width:100%;height:65px;bottom:0;position:absolute;background:#fff;border-top:1px solid #ccc;z-index:11}.uio_grid .toolbar .total_count{position:absolute;top:20px;left:24px;color:#002caf;font-weight:700}.uio_grid .toolbar .btn_setup{position:absolute;right:10px;top:14px}.uio_grid .toolbar .height_resize_bar{overflow:hidden;cursor:row-resize;position:absolute;bottom:0;height:15px;width:100%;border:0;font-size:0;text-align:center}.uio_grid .toolbar .height_resize_bar span{background:url(../images/icons.gif) -70px -60px no-repeat;display:inline-block;width:17px;height:6px;margin-top:5px}.uio_grid .toolbar .height_resize_handle{display:block;margin:0 10px;border-top:1px solid #ccc;cursor:row-resize}.uio_grid .grid_pagination{height:12px;margin-bottom:12px;padding-top:14px;line-height:normal;text-align:center}.uio_grid .grid_pagination a,.uio_grid .grid_pagination span,.uio_grid .grid_pagination strong{display:inline-block;position:relative;padding:4px 8px;min-width:13px;color:#333;font-size:12px;font-weight:700;line-height:normal;text-decoration:none;vertical-align:middle}.uio_grid .grid_pagination strong{padding:4px 6px;color:#ff1313;border:1px solid #d4d4d4;background:#e7e7e7}.uio_grid .grid_pagination .next,.uio_grid .grid_pagination .next_end,.uio_grid .grid_pagination .next_end_off,.uio_grid .grid_pagination .next_off,.uio_grid .grid_pagination .pre,.uio_grid .grid_pagination .pre_end,.uio_grid .grid_pagination .pre_end_off,.uio_grid .grid_pagination .pre_off{width:25px;height:24px;padding:0;border:0;background:url(../images/icons.gif) no-repeat;font-size:0;line-height:999;overflow:hidden;white-space:nowrap}.uio_grid .grid_pagination .next_end,.uio_grid .grid_pagination .next_end_off,.uio_grid .grid_pagination .pre_end,.uio_grid .grid_pagination .pre_end_off{width:24px}.uio_grid .grid_pagination .pre,.uio_grid .grid_pagination .pre_off{margin-right:12px}.uio_grid .grid_pagination .next,.uio_grid .grid_pagination .next_off{margin-left:12px}.uio_grid .grid_pagination .pre_end{background-position:0 0}.uio_grid .grid_pagination .pre_end_off{background-position:0 -30px}.uio_grid .grid_pagination .pre{background-position:-24px 0}.uio_grid .grid_pagination .pre_off{background-position:-24px -30px}.uio_grid .grid_pagination .next{background-position:-50px 0}.uio_grid .grid_pagination .next_off{background-position:-50px -30px}.uio_grid .grid_pagination .next_end{background-position:-75px 0}.uio_grid .grid_pagination .next_end_off{background-position:-75px -30px} \ No newline at end of file +.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 diff --git a/samples/js/grid.js b/samples/js/grid.js index caf98e176..4403e2a85 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.0-c + * @version 1.2.1 * @license MIT * @link https://github.com/nhnent/tui.grid */ @@ -826,7 +826,7 @@ var Net = View.extend(/**@lends module:addon/net.prototype */{ module.exports = Net; -},{"../base/view":7,"../common/constMap":8,"../common/formUtil":9,"../common/gridEvent":10,"../common/util":11,"./net-router":1}],3:[function(require,module,exports){ +},{"../base/view":7,"../common/constMap":9,"../common/formUtil":10,"../common/gridEvent":11,"../common/util":12,"./net-router":1}],3:[function(require,module,exports){ /** * @fileoverview Base class for Collections * @author NHN Ent. FE Development Team @@ -912,7 +912,7 @@ module.exports = Model; */ 'use strict'; -var attrNameMap = require('../common/constMap').attrName; +var attrNameConst = require('../common/constMap').attrName; /** * Base class for Painters @@ -949,11 +949,11 @@ var Painter = tui.util.defineClass(/**@lends module:base/painter.prototype */{ * @private */ _getCellAddress: function($target) { - var $addressHolder = $target.closest('[' + attrNameMap.ROW_KEY + ']'); + var $addressHolder = $target.closest('[' + attrNameConst.ROW_KEY + ']'); return { - rowKey: $addressHolder.attr(attrNameMap.ROW_KEY), - columnName: $addressHolder.attr(attrNameMap.COLUMN_NAME) + rowKey: $addressHolder.attr(attrNameConst.ROW_KEY), + columnName: $addressHolder.attr(attrNameConst.COLUMN_NAME) }; }, @@ -982,7 +982,7 @@ var Painter = tui.util.defineClass(/**@lends module:base/painter.prototype */{ module.exports = Painter; -},{"../common/constMap":8}],7:[function(require,module,exports){ +},{"../common/constMap":9}],7:[function(require,module,exports){ /** * @fileoverview Base class for Views * @author NHN Ent. FE Development Team @@ -1068,6 +1068,119 @@ module.exports = View; },{"./common":4}],8:[function(require,module,exports){ /** +* @fileoverview class name constants. +* @author NHN Ent. FE Development Team +*/ +'use strict'; + +var PREFIX = 'tui-grid-'; + +var classNames = { + CONTAINER: 'container', + CLIPBOARD: 'clipboard', + + // common + NO_SCROLL_X: 'no-scroll-x', + NO_SCROLL_Y: 'no-scroll-y', + + // layer + 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-line', + BORDER_TOP: 'border-line-top', + BORDER_LEFT: 'border-line-left', + BORDER_RIGHT: 'border-line-right', + BORDER_BOTTOM: 'border-line-bottom', + + // layout (area) + LSIDE_AREA: 'lside-area', + RSIDE_AREA: 'rside-area', + HEAD_AREA: 'head-area', + BODY_AREA: 'body-area', + + // header + COLUMN_RESIZE_CONTAINER: 'column-resize-container', + COLUMN_RESIZE_HANDLE: 'column-resize-handle', + COLUMN_RESIZE_HANDLE_LAST: 'column-resize-handle-last', + + // body + BODY_CONTAINER: 'body-container', + BODY_TABLE_CONTAINER: 'table-container', + + // scrollbar + SCROLLBAR_HEAD: 'scrollbar-head', + SCROLLBAR_BORDER: 'scrollbar-border', + SCROLLBAR_RIGHT_BOTTOM: 'scrollbar-right-bottom', + SCROLLBAR_LEFT_BOTTOM: 'scrollbar-left-bottom', + + // pagination + 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: 'table', + + // cell style + 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', + CELL_CONTENT_BEFORE: 'content-before', + CELL_CONTENT_AFTER: 'content-after', + CELL_CONTENT_INPUT: 'content-input', + + // buttons + 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', + TOOLBAR_BTN_HOLDER: 'toolbar-btn-holder', + HEIGHT_RESIZE_BAR: 'height-resize-bar', + HEIGHT_RESIZE_HANDLE: 'height-resize-handle' +}; + +var exports = _.mapObject(classNames, function(className) { + return PREFIX + className; +}); +exports.PREFIX = PREFIX; + +module.exports = exports; + +},{}],9:[function(require,module,exports){ +/** * @fileoverview Object that conatins constant values * @author NHN Ent. FE Development Team */ @@ -1114,11 +1227,18 @@ module.exports = { attrName: { ROW_KEY: 'data-row-key', COLUMN_NAME: 'data-column-name', - EDIT_TYPE: 'data-edit-type' + COLUMN_INDEX: 'data-column-index', + EDIT_TYPE: 'data-edit-type', + GRID_ID: 'data-grid-id' + }, + themeName: { + DEFAULT: 'default', + STRIPED: 'striped', + CLEAN: 'clean' } }; -},{}],9:[function(require,module,exports){ +},{}],10:[function(require,module,exports){ /** * @fileoverview Utilities for form data, form element * @author NHN Ent. Fe Development Team @@ -1338,7 +1458,7 @@ var formUtil = { module.exports = formUtil; -},{}],10:[function(require,module,exports){ +},{}],11:[function(require,module,exports){ /** * @fileoverview Event class for public event of Grid * @author NHN Ent. FE Development Team @@ -1386,7 +1506,7 @@ var GridEvent = tui.util.defineClass(/**@lends module:common/gridEvent.prototype module.exports = GridEvent; -},{}],11:[function(require,module,exports){ +},{}],12:[function(require,module,exports){ /** * @fileoverview 유틸리티 메서드 모음 * @author NHN Ent. FE Development Team @@ -1690,19 +1810,39 @@ var util = { isBrowserIE7: function() { var browser = tui.util.browser; return browser.msie && browser.version === 7; // eslint-disable-line no-magic-numbers + }, + + /** + * create style element and append it into the head element. + * @param {String} id - element id + * @param {String} cssString - css string + */ + appendStyleElement: function(id, cssString) { + var style = document.createElement('style'); + + style.type = 'text/css'; + style.id = id; + + if (style.styleSheet) { + style.styleSheet.cssText = cssString; + } else { + style.appendChild(document.createTextNode(cssString)); + } + + document.getElementsByTagName('head')[0].appendChild(style); } }; module.exports = util; -},{"./constMap":8}],12:[function(require,module,exports){ +},{"./constMap":9}],13:[function(require,module,exports){ /** * @fileoverview This class offers methods that can be used to get the current state of DOM element. * @author NHN Ent. FE Development Team */ 'use strict'; -var attrNameMap = require('./common/constMap').attrName; +var attrNameConst = require('./common/constMap').attrName; /** * Class for offering methods that can be used to get the current state of DOM element. @@ -1724,8 +1864,8 @@ var DomState = tui.util.defineClass(/**@lends module:domState.prototype */{ * @returns {jQuery} Cell(TD) element */ getElement: function(rowKey, columnName) { - return this.$el.find('tr[' + attrNameMap.ROW_KEY + '=' + rowKey + ']') - .find('td[' + attrNameMap.COLUMN_NAME + '=' + columnName + ']'); + return this.$el.find('tr[' + attrNameConst.ROW_KEY + '=' + rowKey + ']') + .find('td[' + attrNameConst.COLUMN_NAME + '=' + columnName + ']'); }, /** @@ -1763,7 +1903,7 @@ var DomState = tui.util.defineClass(/**@lends module:domState.prototype */{ module.exports = DomState; -},{"./common/constMap":8}],13:[function(require,module,exports){ +},{"./common/constMap":9}],14:[function(require,module,exports){ /** * @fileoverview The tui.Grid class for the external API. * @author NHN Ent. FE Development Team @@ -2075,6 +2215,8 @@ var PainterManager = require('./painter/manager'); var PainterController = require('./painter/controller'); var NetAddOn = require('./addon/net'); var util = require('./common/util'); +var themeManager = require('./theme/manager'); +var themeNameConst = require('./common/constMap').themeName; var instanceMap = {}; @@ -2101,6 +2243,10 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ this.container.render(); this.refreshLayout(); + if (!themeManager.isApplied()) { + themeManager.apply(themeNameConst.DEFAULT); + } + this.addOn = {}; instanceMap[this.id] = this; }, @@ -2108,6 +2254,7 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ /** * Creates core model and returns it. * @param {Object} options - Options set by user + * @param {module:domState} domState - domState * @returns {module:model/manager} - New model manager object * @private */ @@ -2143,7 +2290,8 @@ tui.Grid = View.extend(/**@lends tui.Grid.prototype */{ /** * Creates container view and returns it - * @param {Object} options - Options set by user + * @param {Object} options - Options set by user + * @param {module:domState} domState - domState * @returns {module:view/container} - New container view object * @private */ @@ -2838,15 +2986,96 @@ tui.Grid.getInstanceById = function(id) { return instanceMap[id]; }; -},{"./addon/net":2,"./base/view":7,"./common/util":11,"./domState":12,"./model/manager":20,"./painter/controller":28,"./painter/manager":35,"./publicEventEmitter":37,"./view/factory":41}],14:[function(require,module,exports){ +/** + * Apply theme to all grid instances with the preset options of a given name. + * @api + * @static + * @param {String} presetName - preset theme name. Available values are 'default', 'striped' and 'clean'. + * @param {Object} [extOptions] - if exist, extend preset options with this object. + * @param {Object} [extOptions.grid] - Styles for the grid (container) + * @param {String} [extOptions.grid.background] - Background color of the grid. + * @param {number} [extOptions.grid.border] - Border color of the grid + * @param {number} [extOptions.grid.text] - Text color of the grid. + * @param {Object} [extOptions.selection] - Styles for a selection layer. + * @param {String} [extOptions.selection.background] - Background color of a selection layer. + * @param {String} [extOptions.selection.border] - Border color of a selection layer. + * @param {Object} [extOptions.toolbar] - Styles for a toolbar area. + * @param {String} [extOptions.toolbar.background] - Background color of a toolbar area. + * @param {String} [extOptions.toolbar.border] - Border color of a toolbar area. + * @param {Object} [extOptions.scrollbar] - Styles for scrollbars. + * @param {String} [extOptions.scrollbar.background] - Background color of scrollbars. + * @param {String} [extOptions.scrollbar.thumb] - Color of thumbs in scrollbars. + * @param {String} [extOptions.scrollbar.active] - Color of arrows(for IE) or + * thumb:hover(for other browsers) in scrollbars. + * @param {Object} [extOptions.cell] - Styles for the table cells. + * @param {Object} [extOptions.cell.normal] - Styles for normal cells. + * @param {String} [extOptions.cell.normal.background] - Background color of normal cells. + * @param {String} [extOptions.cell.normal.border] - Border color of normal cells. + * @param {String} [extOptions.cell.normal.text] - Text color of normal cells. + * @param {Boolean} [extOptions.cell.normal.showVerticalBorder] - Whether vertical borders of + * normal cells are visible. + * @param {Boolean} [extOptions.cell.normal.showHorizontalBorder] - Whether horizontal borders of + * normal cells are visible. + * @param {Object} [extOptions.cell.head] - Styles for the head cells. + * @param {String} [extOptions.cell.head.background] - Background color of head cells. + * @param {String} [extOptions.cell.head.border] - border color of head cells. + * @param {String} [extOptions.cell.head.text] - text color of head cells. + * @param {Boolean} [extOptions.cell.head.showVerticalBorder] - Whether vertical borders of + * head cells are visible. + * @param {Boolean} [extOptions.cell.head.showHorizontalBorder] - Whether horizontal borders of + * head cells are visible. + * @param {Object} [extOptions.cell.selectedHead] - Styles for selected head cells. + * @param {String} [extOptions.cell.selectedHead.background] - background color of selected haed cells. + * @param {String} [extOptions.cell.selectedHead.text] - text color of selected head cells. + * @param {Object} [extOptions.cell.focused] - Styles for a focused cell. + * @param {String} [extOptions.cell.focused.background] - background color of a focused cell. + * @param {String} [extOptions.cell.focused.border] - border color of a focused cell. + * @param {Object} [extOptions.cell.required] - Styles for required cells. + * @param {String} [extOptions.cell.required.background] - background color of required cells. + * @param {String} [extOptions.cell.required.text] - text color of required cells. + * @param {Object} [extOptions.cell.editable] - Styles for editable cells. + * @param {String} [extOptions.cell.editable.background] - background color of the editable cells. + * @param {String} [extOptions.cell.editable.text] - text color of the selected editable cells. + * @param {Object} [extOptions.cell.disabled] - Styles for disabled cells. + * @param {String} [extOptions.cell.disabled.background] - background color of disabled cells. + * @param {String} [extOptions.cell.disabled.text] - text color of disabled cells. + * @param {Object} [extOptions.cell.invalid] - Styles for invalid cells. + * @param {String} [extOptions.cell.invalid.background] - background color of invalid cells. + * @param {String} [extOptions.cell.invalid.text] - text color of invalid cells. + * @param {Object} [extOptions.cell.currentRow] - Styles for cells in a current row. + * @param {String} [extOptions.cell.currentRow.background] - background color of cells in a current row. + * @param {String} [extOptions.cell.currentRow.text] - text color of cells in a current row. + * @param {Object} [extOptions.cell.evenRow] - Styles for cells in even rows. + * @param {String} [extOptions.cell.evenRow.background] - background color of cells in even rows. + * @param {String} [extOptions.cell.evenRow.text] - text color of cells in even rows. + * @param {Object} [extOptions.cell.dummy] - Styles for dummy cells. + * @param {String} [extOptions.cell.dummy.background] - background color of dummy cells. + * @example +tui.Grid.applyTheme('striped', { + grid: { + border: '#aaa', + text: '#333' + }, + cell: { + disabled: { + text: '#999' + } + } +}); + */ +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){ /** * @fileoverview 컬럼 모델 * @author NHN Ent. FE Development Team */ 'use strict'; -var Model = require('../../base/model'), - util = require('../../common/util'); +var Model = require('../../base/model'); +var util = require('../../common/util'); /** * 컬럼 모델 데이터를 다루는 객체 @@ -3277,7 +3506,7 @@ var ColumnModel = Model.extend(/**@lends module:model/data/columnModel.prototype module.exports = ColumnModel; -},{"../../base/model":5,"../../common/util":11}],15:[function(require,module,exports){ +},{"../../base/model":5,"../../common/util":12}],16:[function(require,module,exports){ /** * @fileoverview Grid 의 Data Source 에 해당하는 Model 정의 * @author NHN Ent. FE Development Team @@ -3480,7 +3709,7 @@ var ExtraDataManager = tui.util.defineClass(/**@lends module:model/data/extraDat module.exports = ExtraDataManager; -},{}],16:[function(require,module,exports){ +},{}],17:[function(require,module,exports){ /** * @fileoverview Grid 의 Data Source 에 해당하는 Model 정의 * @author NHN Ent. FE Development Team @@ -3490,6 +3719,7 @@ module.exports = ExtraDataManager; var Model = require('../../base/model'); var ExtraDataManager = require('./extraDataManager'); var util = require('../../common/util'); +var classNameConst = require('../../common/classNameConst'); // Propertie names that indicate meta data var PRIVATE_PROPERTIES = [ @@ -3601,9 +3831,9 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ errorCode = this._validateCellData(columnName); if (errorCode) { - this.addCellClassName(columnName, 'invalid'); + this.addCellClassName(columnName, classNameConst.CELL_INVALID); } else { - this.removeCellClassName(columnName, 'invalid'); + this.removeCellClassName(columnName, classNameConst.CELL_INVALID); } this.validateMap[columnName] = errorCode; @@ -3699,18 +3929,18 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ classNameList.push(columnModel.className); } if (columnModel.isEllipsis) { - classNameList.push('ellipsis'); + classNameList.push(classNameConst.CELL_ELLIPSIS); } if (columnModel.isRequired) { - classNameList.push('required'); + classNameList.push(classNameConst.CELL_REQUIRED); } if (isMetaColumn) { - classNameList.push('meta_column'); + classNameList.push(classNameConst.CELL_HEAD); } else if (cellState.isEditable) { - classNameList.push('editable'); + classNameList.push(classNameConst.CELL_EDITABLE); } if (cellState.isDisabled) { - classNameList.push('disabled'); + classNameList.push(classNameConst.CELL_DISABLED); } return this._makeUniqueStringArray(classNameList); @@ -4031,7 +4261,7 @@ var Row = Model.extend(/**@lends module:model/data/row.prototype */{ module.exports = Row; -},{"../../base/model":5,"../../common/util":11,"./extraDataManager":15}],17:[function(require,module,exports){ +},{"../../base/model":5,"../../common/classNameConst":8,"../../common/util":12,"./extraDataManager":16}],18:[function(require,module,exports){ /** * @fileoverview Grid 의 Data Source 에 해당하는 Collection 정의 * @author NHN Ent. FE Development Team @@ -5139,7 +5369,7 @@ var RowList = Collection.extend(/**@lends module:model/data/rowList.prototype */ module.exports = RowList; -},{"../../base/collection":3,"./row":16}],18:[function(require,module,exports){ +},{"../../base/collection":3,"./row":17}],19:[function(require,module,exports){ /** * @fileoverview 크기에 관련된 데이터를 다루는 모델 * @author NHN Ent. FE Development Team @@ -5344,6 +5574,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ }); } }); + return this._reduceExcessColumnWidthSub(_.clone(columnWidthList), totalExcessWidth, availableList); }, @@ -5376,6 +5607,7 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ return this._reduceExcessColumnWidthSub(columnWidthList, totalRemainWidth, newAvailableList); } columnIndexes = _.pluck(availableList, 'index'); + return this._distributeExtraWidthEqually(columnWidthList, totalRemainWidth, columnIndexes); }, @@ -5396,7 +5628,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ _.each(columnIndexes, function(columnIndex) { resultList[columnIndex] += avgValue; }); - resultList[_.last(columnIndexes)] -= errorValue; + + if (columnIndexes.length) { + resultList[_.last(columnIndexes)] -= errorValue; + } return resultList; }, @@ -5588,57 +5823,92 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ }, /** - * 계산한 cell 의 위치를 리턴한다. - * @param {Number|String} rowKey - 데이터의 키값 - * @param {String} columnName - 칼럼명 - * @returns {{top: number, left: number, right: number, bottom: number}} - cell의 위치 - * @todo TC + * Returns the horizontal position of the given column + * @param {String} columnName - column name + * @returns {{left: Number, right: Number}} + * @private */ - getCellPosition: function(rowKey, columnName) { - var dataModel = this.dataModel, - columnModel = this.columnModel, - rowHeight = this.get('rowHeight'), - row = dataModel.get(rowKey), - metaColumnCount = columnModel.getVisibleMetaColumnCount(), - columnWidthList = this.get('columnWidthList').slice(metaColumnCount), - columnFixCount = columnModel.getVisibleColumnFixCount(), - columnIdx = columnModel.indexOfColumnName(columnName, true), - rowSpanData, - rowIdx, spanCount, - top, left, right, bottom, i; + _getCellHorizontalPosition: function(columnName) { + var columnModel = this.columnModel; + var metaColumnCount = columnModel.getVisibleMetaColumnCount(); + var columnWidthList = this.get('columnWidthList'); + var leftColumnCount = columnModel.getVisibleColumnFixCount() + metaColumnCount; + var targetIdx = columnModel.indexOfColumnName(columnName, true) + metaColumnCount; + var idx = leftColumnCount > targetIdx ? 0 : leftColumnCount; + var left = 0; - if (!row) { - return {}; + for (; idx < targetIdx; idx += 1) { + left += columnWidthList[idx] + CELL_BORDER_WIDTH; } - rowSpanData = dataModel.get(rowKey).getRowSpanData(columnName); + return { + left: left, + right: left + columnWidthList[targetIdx] + CELL_BORDER_WIDTH + }; + }, + + /** + * Returns the vertical position of the given row + * @param {Number} rowKey - row key + * @param {Number} rowSpanCount - the count of rowspan + * @returns {{top: Number, bottom: Number}} + */ + _getCellVerticalPosition: function(rowKey, rowSpanCount) { + var dataModel = this.dataModel; + var rowHeight = this.get('rowHeight'); + var rowIdx = dataModel.indexOfRowKey(rowKey); + var top = util.getHeight(rowIdx, rowHeight); + var height = util.getHeight(rowSpanCount, rowHeight); + + return { + top: top, + bottom: top + height + }; + }, + + /** + * Returns the count of rowspan of given cell + * @param {Number} rowKey - row key + * @param {String} columnName - column name + * @returns {Number} + * @private + */ + _getRowSpanCount: function(rowKey, columnName) { + var rowSpanData = this.dataModel.get(rowKey).getRowSpanData(columnName); if (!rowSpanData.isMainRow) { rowKey = rowSpanData.mainRowKey; - rowSpanData = dataModel.get(rowKey).getRowSpanData(columnName); + rowSpanData = this.dataModel.get(rowKey).getRowSpanData(columnName); } - spanCount = rowSpanData.count || 1; + return rowSpanData.count || 1; + }, - rowIdx = dataModel.indexOfRowKey(rowKey); + /** + * 계산한 cell 의 위치를 리턴한다. + * @param {Number|String} rowKey - 데이터의 키값 + * @param {String} columnName - 칼럼명 + * @returns {{top: number, left: number, right: number, bottom: number}} - cell의 위치 + * @todo TC + */ + getCellPosition: function(rowKey, columnName) { + var rowSpanCount, vPos, hPos; - top = util.getHeight(rowIdx, rowHeight); - bottom = top + util.getHeight(spanCount, rowHeight) - CELL_BORDER_WIDTH; + rowKey = this.dataModel.getMainRowKey(rowKey, columnName); - left = i = 0; - if (columnFixCount <= columnIdx) { - i = columnFixCount; - } - for (; i < columnIdx; i += 1) { - left += columnWidthList[i] + CELL_BORDER_WIDTH; + if (!this.dataModel.get(rowKey)) { + return {}; } - right = left + columnWidthList[i] + CELL_BORDER_WIDTH; + + rowSpanCount = this._getRowSpanCount(rowKey, columnName); + vPos = this._getCellVerticalPosition(rowKey, rowSpanCount); + hPos = this._getCellHorizontalPosition(columnName); return { - top: top, - left: left, - right: right, - bottom: bottom + top: vPos.top, + bottom: vPos.bottom, + left: hPos.left, + right: hPos.right }; }, @@ -5649,10 +5919,10 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ * @returns {{scrollLeft: ?Number, scrollTop: ?Number}} Position to scroll */ getScrollPosition: function(rowKey, columnName) { - var isRsideColumn = !this.columnModel.isLside(columnName), - targetPosition = this.getCellPosition(rowKey, columnName), - bodySize = this._getBodySize(), - scrollDirection = this._judgeScrollDirection(targetPosition, isRsideColumn, bodySize); + var isRsideColumn = !this.columnModel.isLside(columnName); + var targetPosition = this.getCellPosition(rowKey, columnName); + var bodySize = this._getBodySize(); + var scrollDirection = this._judgeScrollDirection(targetPosition, isRsideColumn, bodySize); return this._makeScrollPosition(scrollDirection, targetPosition, bodySize); }, @@ -6057,16 +6327,16 @@ var Dimension = Model.extend(/**@lends module:model/dimension.prototype */{ module.exports = Dimension; -},{"../base/model":5,"../common/constMap":8,"../common/util":11}],19:[function(require,module,exports){ +},{"../base/model":5,"../common/constMap":9,"../common/util":12}],20:[function(require,module,exports){ /** * @fileoverview Focus 관련 데이터 처리름 담당한다. * @author NHN Ent. FE Development Team */ 'use strict'; -var Model = require('../base/model'), - util = require('../common/util'), - GridEvent = require('../common/gridEvent'); +var Model = require('../base/model'); +var util = require('../common/util'); +var GridEvent = require('../common/gridEvent'); /** * Focus model @@ -6344,9 +6614,9 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * Scroll to focus */ scrollToFocus: function() { - var rowKey = this.get('rowKey'), - columnName = this.get('columnName'), - scrollPosition = this.dimensionModel.getScrollPosition(rowKey, columnName); + var rowKey = this.get('rowKey'); + var columnName = this.get('columnName'); + var scrollPosition = this.dimensionModel.getScrollPosition(rowKey, columnName); if (!tui.util.isEmpty(scrollPosition)) { this.renderModel.set(scrollPosition); @@ -6454,12 +6724,21 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ * @returns {Boolean} true if succeeded, false otherwise. */ startEditing: function(rowKey, columnName) { - if (this.get('editingAddress') || - !this.isCurrentCell(rowKey, columnName, true) || - !this.dataModel.get(rowKey).isEditable(columnName)) { + if (this.get('editingAddress')) { + return false; + } + + if (_.isUndefined(rowKey) && _.isUndefined(columnName)) { + rowKey = this.get('rowKey'); + columnName = this.get('columnName'); + } else if (!this.isCurrentCell(rowKey, columnName, true)) { return false; } + rowKey = this.dataModel.getMainRowKey(rowKey, columnName); + if (!this.dataModel.get(rowKey).isEditable(columnName)) { + return false; + } this.set('editingAddress', { rowKey: rowKey, columnName: columnName @@ -6708,7 +6987,7 @@ var Focus = Model.extend(/**@lends module:model/focus.prototype */{ module.exports = Focus; -},{"../base/model":5,"../common/gridEvent":10,"../common/util":11}],20:[function(require,module,exports){ +},{"../base/model":5,"../common/gridEvent":11,"../common/util":12}],21:[function(require,module,exports){ /** * @fileoverview Model Manager * @author NHN Ent. FE Development Team @@ -6921,7 +7200,7 @@ var ModelManager = tui.util.defineClass(/**@lends module:modelManager.prototype module.exports = ModelManager; -},{"./data/columnModel":14,"./data/rowList":17,"./dimension":18,"./focus":19,"./renderer":22,"./renderer-smart":21,"./selection":25,"./toolbar":26}],21:[function(require,module,exports){ +},{"./data/columnModel":15,"./data/rowList":18,"./dimension":19,"./focus":20,"./renderer":23,"./renderer-smart":22,"./selection":26,"./toolbar":27}],22:[function(require,module,exports){ /** * @fileoverview 스마트 랜더링을 지원하는 Renderer 모ㄷ델 * @author NHN Ent. FE Development Team @@ -7060,7 +7339,7 @@ var SmartRenderer = Renderer.extend(/**@lends module:model/renderer-smart.protot module.exports = SmartRenderer; -},{"../common/util":11,"./renderer":22}],22:[function(require,module,exports){ +},{"../common/util":12,"./renderer":23}],23:[function(require,module,exports){ /** * @fileoverview Rendering 모델 * @author NHN Ent. FE Development Team @@ -7114,7 +7393,6 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ .listenTo(lside, 'valueChange', this._executeRelation) .listenTo(rside, 'valueChange', this._executeRelation) .listenTo(this.focusModel, 'change:editingAddress', this._onEditingAddressChange) - .listenTo(this.focusModel, 'focus blur', this._onFocusOrBlur) .listenTo(this.dimensionModel, 'change:width', this._updateMaxScrollLeft) .listenTo(this.dimensionModel, 'change:totalRowHeight change:scrollBarSize change:bodyHeight', this._updateMaxScrollTop); @@ -7195,21 +7473,6 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ } }, - /** - * Event handler for 'focus' and 'blur' events on focusModel - * @param {Number|String} rowKey - row key - * @param {String} columnName - column name - * @private - */ - _onFocusOrBlur: function(rowKey, columnName) { - var mainRowKey = this.dataModel.getMainRowKey(rowKey, columnName); - var rowModel = this._getRowModel(mainRowKey, columnName); - - if (rowModel) { - rowModel.updateClassName(columnName); - } - }, - /** * Event handler for 'change:editingAddress' event on focusModel * @param {module:model/focus} focusModel - focus model @@ -7381,6 +7644,7 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ _createViewDataFromDataModel: function(rowDataModel, columnNames, height, rowNum) { var viewData = { height: height, + rowNum: rowNum, rowKey: rowDataModel.get('rowKey'), _extraData: rowDataModel.get('_extraData') }; @@ -7442,7 +7706,7 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ for (i = startIndex; i <= endIndex; i += 1) { rowDataModel = this.dataModel.at(i); lsideData.push(this._createViewDataFromDataModel(rowDataModel, columnNamesMap.lside, height, rowNum)); - rsideData.push(this._createViewDataFromDataModel(rowDataModel, columnNamesMap.rside, height)); + rsideData.push(this._createViewDataFromDataModel(rowDataModel, columnNamesMap.rside, height, rowNum)); rowNum += 1; } @@ -7479,17 +7743,20 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ * @private */ _fillDummyRows: function() { - var displayRowCount = this.dimensionModel.get('displayRowCount'), - actualRowCount = this._getActualRowCount(), - dummyRowCount = Math.max(displayRowCount - actualRowCount, 0), - rowHeight = this.dimensionModel.get('rowHeight'); + var displayRowCount = this.dimensionModel.get('displayRowCount'); + var actualRowCount = this._getActualRowCount(); + var dummyRowCount = Math.max(displayRowCount - actualRowCount, 0); + var rowHeight = this.dimensionModel.get('rowHeight'); + var rowNum = this.get('endIndex') + 2; _.times(dummyRowCount, function() { _.each(['lside', 'rside'], function(listName) { this.get(listName).add({ - height: rowHeight + height: rowHeight, + rowNum: rowNum }); }, this); + rowNum += 1; }, this); this.set('dummyRowCount', dummyRowCount); @@ -7621,7 +7888,7 @@ var Renderer = Model.extend(/**@lends module:model/renderer.prototype */{ module.exports = Renderer; -},{"../base/model":5,"../common/constMap":8,"./rowList":24}],23:[function(require,module,exports){ +},{"../base/model":5,"../common/constMap":9,"./rowList":25}],24:[function(require,module,exports){ /** * @fileoverview Row Model for Rendering (View Model) * @author NHN Ent. FE Development Team @@ -7778,15 +8045,16 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ * @private */ _formatData: function(data, dataModel, columnModel, focusModel) { - var rowKey = data.rowKey, - columnData, row; + var rowKey = data.rowKey; + var rowNum = data.rowNum; + var columnData, row; if (_.isUndefined(rowKey)) { return data; } row = dataModel.get(rowKey); - columnData = _.omit(data, 'rowKey', '_extraData', 'height'); + columnData = _.omit(data, 'rowKey', '_extraData', 'height', 'rowNum'); _.each(columnData, function(value, columnName) { var rowSpanData = this._getRowSpanData(columnName, data, dataModel.isRowSpanEnable()), @@ -7796,6 +8064,7 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ data[columnName] = { rowKey: rowKey, + rowNum: rowNum, columnName: columnName, rowSpan: rowSpanData.count, isMainRow: rowSpanData.isMainRow, @@ -7803,7 +8072,6 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ isEditable: cellState.isEditable, isDisabled: cellState.isDisabled, isEditing: focusModel.isEditingCell(rowKey, columnName), - isFocused: focusModel.isCurrentCell(rowKey, columnName), optionList: tui.util.pick(column, 'editOption', 'list'), className: this._getClassNameString(columnName, row, focusModel), columnModel: column, @@ -7836,10 +8104,6 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ } classNames = row.getClassNameList(columnName); - if (focusModel.isCurrentCell(row.get('rowKey'), columnName, true)) { - classNames.push('focused'); - } - return classNames.join(' '); }, @@ -8037,7 +8301,7 @@ var Row = Model.extend(/**@lends module:model/row.prototype */{ module.exports = Row; -},{"../base/model":5,"../common/util":11}],24:[function(require,module,exports){ +},{"../base/model":5,"../common/util":12}],25:[function(require,module,exports){ /** * @fileoverview RowList 클래스파일 * @author NHN Ent. FE Development Team @@ -8071,7 +8335,7 @@ var RowList = Collection.extend(/**@lends module:model/rowList.prototype */{ module.exports = RowList; -},{"../base/collection":3,"./row":23}],25:[function(require,module,exports){ +},{"../base/collection":3,"./row":24}],26:[function(require,module,exports){ /** * @fileoverview Selection Model class * @author NHN Ent. FE Development Team @@ -8688,7 +8952,7 @@ var Selection = Model.extend(/**@lends module:model/selection.prototype */{ module.exports = Selection; -},{"../base/model":5,"../common/util":11}],26:[function(require,module,exports){ +},{"../base/model":5,"../common/util":12}],27:[function(require,module,exports){ /** * @fileoverview Toolbar model class * @author NHN Ent. FE Development Team @@ -8729,7 +8993,7 @@ var Toolbar = Model.extend(/**@lends module:model/toolbar.prototype */{ module.exports = Toolbar; -},{"../base/model":5}],27:[function(require,module,exports){ +},{"../base/model":5}],28:[function(require,module,exports){ /** * @fileoverview Painter class for cell(TD) views * @author NHN Ent. FE Development Team @@ -8738,7 +9002,8 @@ module.exports = Toolbar; var Painter = require('../base/painter'); var util = require('../common/util'); -var attrNameMap = require('../common/constMap').attrName; +var attrNameConst = require('../common/constMap').attrName; +var classNameConst = require('../common/classNameConst'); /** * Painter class for cell(TD) views @@ -8755,7 +9020,7 @@ var Cell = tui.util.defineClass(Painter, /**@lends module:painter/cell.prototype this.editType = options.editType; this.inputPainter = options.inputPainter; - this.selector = 'td[' + attrNameMap.EDIT_TYPE + '=' + this.editType + ']'; + this.selector = 'td[' + attrNameConst.EDIT_TYPE + '=' + this.editType + ']'; }, /** @@ -8810,9 +9075,9 @@ var Cell = tui.util.defineClass(Painter, /**@lends module:painter/cell.prototype content = this.inputPainter.generateHtml(cellData); if (this._shouldContentBeWrapped() && !this._isUsingViewMode(cellData)) { - beforeContent = this._getSpanWrapContent(beforeContent, 'before'); - afterContent = this._getSpanWrapContent(afterContent, 'after'); - content = this._getSpanWrapContent(content, 'input'); + beforeContent = this._getSpanWrapContent(beforeContent, classNameConst.CELL_CONTENT_BEFORE); + afterContent = this._getSpanWrapContent(afterContent, classNameConst.CELL_CONTENT_AFTER); + content = this._getSpanWrapContent(content, classNameConst.CELL_CONTENT_INPUT); return beforeContent + afterContent + content; } @@ -8862,14 +9127,20 @@ var Cell = tui.util.defineClass(Painter, /**@lends module:painter/cell.prototype * @private */ _getAttributes: function(cellData) { + var classNames = [ + cellData.className, + classNameConst.CELL, + classNameConst.CELL_CONTENT, + (cellData.rowNum % 2) ? classNameConst.CELL_ROW_ODD : classNameConst.CELL_ROW_EVEN + ]; var attrs = { - 'class': cellData.className + ' cell_content', 'align': cellData.columnModel.align || 'left' }; + attrs['class'] = classNames.join(' '); - attrs[attrNameMap.EDIT_TYPE] = this.editType; - attrs[attrNameMap.ROW_KEY] = cellData.rowKey; - attrs[attrNameMap.COLUMN_NAME] = cellData.columnName; + attrs[attrNameConst.EDIT_TYPE] = this.editType; + attrs[attrNameConst.ROW_KEY] = cellData.rowKey; + attrs[attrNameConst.COLUMN_NAME] = cellData.columnName; if (cellData.rowSpan) { attrs.rowspan = cellData.rowSpan; } @@ -8932,7 +9203,7 @@ var Cell = tui.util.defineClass(Painter, /**@lends module:painter/cell.prototype module.exports = Cell; -},{"../base/painter":6,"../common/constMap":8,"../common/util":11}],28:[function(require,module,exports){ +},{"../base/painter":6,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],29:[function(require,module,exports){ /** * @fileoverview Controller class to handle actions from the painters * @author NHN Ent. FE Development Team @@ -9069,7 +9340,7 @@ var PainterController = tui.util.defineClass(/**@lends module:painter/controller module.exports = PainterController; -},{}],29:[function(require,module,exports){ +},{}],30:[function(require,module,exports){ /** * @fileoverview Dummy cell painter * @author NHN Ent. FE Development Team @@ -9078,7 +9349,8 @@ module.exports = PainterController; var Painter = require('../base/painter'); var util = require('../common/util'); -var attrNameMap = require('../common/constMap').attrName; +var attrNameConst = require('../common/constMap').attrName; +var classNameConst = require('../common/classNameConst'); /** * Dummy Cell Painter @@ -9105,16 +9377,17 @@ var DummyCell = tui.util.defineClass(Painter, /**@lends module:painter/dummyCell * css selector to find its own element(s) from a parent element. * @type {String} */ - selector: 'td[' + attrNameMap.EDIT_TYPE + '=dummy]', + selector: 'td[' + attrNameConst.EDIT_TYPE + '=dummy]', /** * Template function * @returns {String} HTML string */ template: _.template( - '="<%=columnName%>" ' + - 'class="<%=className%>" ' + - '<%=attrEditType%>="dummy">' + + '' + '​' + // 'for height issue with empty cell in IE7 '' ), @@ -9129,25 +9402,32 @@ var DummyCell = tui.util.defineClass(Painter, /**@lends module:painter/dummyCell /** * Generates a HTML string from given data, and returns it. + * @param {Number} rowNum - row number * @param {String} columnName - column name * @returns {string} HTML string * @implements {module:base/painter} */ - generateHtml: function(columnName) { - var isMeta = util.isMetaColumn(columnName); + generateHtml: function(rowNum, columnName) { + var classNames = [ + classNameConst.CELL, + classNameConst.CELL_DUMMY, + (rowNum % 2) ? classNameConst.CELL_ROW_ODD : classNameConst.CELL_ROW_EVEN + ]; + + if (util.isMetaColumn(columnName)) { + classNames.push(classNameConst.CELL_HEAD); + } return this.template({ - attrColumnName: attrNameMap.COLUMN_NAME, - attrEditType: attrNameMap.EDIT_TYPE, columnName: columnName, - className: (isMeta ? 'meta_column ' : '') + 'dummy' + className: classNames.join(' ') }); } }); module.exports = DummyCell; -},{"../base/painter":6,"../common/constMap":8,"../common/util":11}],30:[function(require,module,exports){ +},{"../base/painter":6,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],31:[function(require,module,exports){ /** * @fileoverview Base class for the Input Painter * @author NHN Ent. FE Development Team @@ -9228,7 +9508,7 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ }, /** - * Event handler for the 'focus' event. + * Event handler for the 'focusin' event. * @param {Event} event - DOM event object * @private */ @@ -9240,7 +9520,7 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ }, /** - * Event handler for the 'blur' event. + * Event handler for the 'focusout' event. * @param {Event} event - DOM event object * @private */ @@ -9340,7 +9620,7 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ module.exports = InputPainter; -},{"../../base/painter":6,"../../common/constMap":8}],31:[function(require,module,exports){ +},{"../../base/painter":6,"../../common/constMap":9}],32:[function(require,module,exports){ /** * @fileoverview Painter class for 'checkbox' and 'radio button'. * @author NHN Ent. FE Development Team @@ -9596,7 +9876,7 @@ var ButtonPainter = tui.util.defineClass(InputPainter, /**@lends module:painter/ module.exports = ButtonPainter; -},{"../../common/util":11,"./base":30}],32:[function(require,module,exports){ +},{"../../common/util":12,"./base":31}],33:[function(require,module,exports){ /** * @fileoverview Main Button Painter * @author NHN Ent. FE Development Team @@ -9604,6 +9884,7 @@ module.exports = ButtonPainter; 'use strict'; var Painter = require('../../base/painter'); +var classNameConst = require('../../common/classNameConst'); /** * Main Button Painter @@ -9619,7 +9900,7 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ init: function(options) { Painter.apply(this, arguments); - this.selector = 'input.main_button'; + this.selector = 'input.' + classNameConst.CELL_MAIN_BUTTON; this.inputType = options.inputType; this.gridId = options.gridId; }, @@ -9637,7 +9918,8 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ * @returns {String} */ template: _.template( - ' />' + ' />' ), /** @@ -9669,7 +9951,7 @@ var InputPainter = tui.util.defineClass(Painter, /**@lends module:painter/input/ module.exports = InputPainter; -},{"../../base/painter":6}],33:[function(require,module,exports){ +},{"../../base/painter":6,"../../common/classNameConst":8}],34:[function(require,module,exports){ /** * @fileoverview Painter class for 'select' input. * @author NHN Ent. FE Development Team @@ -9755,7 +10037,7 @@ var SelectPainter = tui.util.defineClass(InputPainter, /**@lends module:painter/ module.exports = SelectPainter; -},{"../../common/util":11,"./base":30}],34:[function(require,module,exports){ +},{"../../common/util":12,"./base":31}],35:[function(require,module,exports){ /** * @fileoverview Painter class for the 'input[type=text]' and 'input[type=password]'. * @author NHN Ent. FE Development Team @@ -9878,7 +10160,7 @@ var TextPainter = tui.util.defineClass(InputPainter, /**@lends module:painter/in module.exports = TextPainter; -},{"../../common/util":11,"./base":30}],35:[function(require,module,exports){ +},{"../../common/util":12,"./base":31}],36:[function(require,module,exports){ /** * @fileoverview Painter Manager * @author NHN Ent. FE Development Team @@ -10029,7 +10311,7 @@ var PainterManager = tui.util.defineClass(/**@lends module:painter/manager.proto module.exports = PainterManager; -},{"./cell":27,"./dummyCell":29,"./input/button":31,"./input/mainButton":32,"./input/select":33,"./input/text":34,"./row":36}],36:[function(require,module,exports){ +},{"./cell":28,"./dummyCell":30,"./input/button":32,"./input/mainButton":33,"./input/select":34,"./input/text":35,"./row":37}],37:[function(require,module,exports){ /** * @fileoverview Painter class for the row(TR) views * @author NHN Ent. FE Development Team @@ -10038,7 +10320,9 @@ module.exports = PainterManager; var Painter = require('../base/painter'); var util = require('../common/util'); -var attrNameMap = require('../common/constMap').attrName; +var constMap = require('../common/constMap'); +var attrNameConst = constMap.attrName; +var CELL_BORDER_WIDTH = constMap.dimension.CELL_BORDER_WIDTH; /** * Painter class for the row(TR) views @@ -10090,16 +10374,17 @@ var RowPainter = tui.util.defineClass(Painter, /**@lends module:painter/row.prot /** * Returns the HTML string of all cells in Dummy row. - * @param {Array.} columnNames - An array of column names + * @param {Number} rowNum - row number + * @param {Array.} columnNames - An array of column names * @returns {String} HTLM string * @private */ - _generateHtmlForDummyRow: function(columnNames) { + _generateHtmlForDummyRow: function(rowNum, columnNames) { var cellPainter = this.painterManager.getCellPainter('dummy'), html = ''; _.each(columnNames, function(columnName) { - html += cellPainter.generateHtml(columnName); + html += cellPainter.generateHtml(rowNum, columnName); }); return html; @@ -10136,21 +10421,23 @@ var RowPainter = tui.util.defineClass(Painter, /**@lends module:painter/row.prot * @returns {String} HTLM string */ generateHtml: function(model, columnNames) { - var rowKey = model.get('rowKey'), - html; + var rowKey = model.get('rowKey'); + var rowNum = model.get('rowNum'); + var className = ''; + var html; if (_.isUndefined(rowKey)) { - html = this._generateHtmlForDummyRow(columnNames); + html = this._generateHtmlForDummyRow(rowNum, columnNames); } else { html = this._generateHtmlForActualRow(model, columnNames); } return this.template({ - rowKeyAttrName: attrNameMap.ROW_KEY, + rowKeyAttrName: attrNameConst.ROW_KEY, rowKey: rowKey, - height: model.get('height') + RowPainter._extraHeight, + height: model.get('height') + RowPainter._extraHeight + CELL_BORDER_WIDTH, contents: html, - className: '' + className: className }); }, @@ -10164,7 +10451,7 @@ var RowPainter = tui.util.defineClass(Painter, /**@lends module:painter/row.prot var editType, cellPainter, $td; if (columnName !== '_extraData') { - $td = $tr.find('td[' + attrNameMap.COLUMN_NAME + '=' + columnName + ']'); + $td = $tr.find('td[' + attrNameConst.COLUMN_NAME + '=' + columnName + ']'); editType = this._getEditType(columnName, cellData); cellPainter = this.painterManager.getCellPainter(editType); cellPainter.refresh(cellData, $td); @@ -10191,7 +10478,7 @@ var RowPainter = tui.util.defineClass(Painter, /**@lends module:painter/row.prot module.exports = RowPainter; -},{"../base/painter":6,"../common/constMap":8,"../common/util":11}],37:[function(require,module,exports){ +},{"../base/painter":6,"../common/constMap":9,"../common/util":12}],38:[function(require,module,exports){ /** * @fileoverview Public Event Emitter * @author NHN Ent. FE Development Team @@ -10290,146 +10577,765 @@ _.extend(PublicEventEmitter.prototype, Backbone.Events); module.exports = PublicEventEmitter; -},{}],38:[function(require,module,exports){ +},{}],39:[function(require,module,exports){ /** - * @fileoverview 키 이벤트 핸들링 담당하는 Clipboard 정의 - * @author NHN Ent. FE Development Team - */ +* @fileoverview CSS Rule string builder +* @author NHN Ent. FE Development Team +*/ 'use strict'; -var View = require('../base/view'); -var util = require('../common/util'); -var keyCodeMap = require('../common/constMap').keyCode; - /** - * Clipboard view class - * @module view/clipboard - * @extends module:base/view + * create css rule string and returns it + * @param {String} selector - css selector + * @param {String} property - css property + * @param {String} value - css value */ -var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ +var CSSRuleBuilder = tui.util.defineClass({ + init: function(selector) { + if (!_.isString(selector) || !selector) { + throw new Error('The Selector must be a string and not be empty.'); + } + this._selector = selector; + this._propValues = []; + }, + /** - * @constructs - * @param {Object} options - Options + * Add a set of css property and value. + * @param {String} property - css property + * @param {String} value - css value + * @returns {CSSRuleBuilder} */ - initialize: function(options) { - this.setOwnProperties({ - focusModel: options.focusModel, - selectionModel: options.selectionModel, - painterManager: options.painterManager, - dimensionModel: options.dimensionModel, - dataModel: options.dataModel, - columnModel: options.columnModel, - renderModel: options.renderModel, - timeoutIdForKeyIn: 0, - isLocked: false - }); - this.listenTo(this.focusModel, 'focusClipboard', this._onFocus); + add: function(property, value) { + if (value) { + this._propValues.push(property + ':' + value); + } + return this; }, - tagName: 'textarea', + /** + * Shortcut for add('border-color', value) + * @param {String} value - css value + * @returns {CSSRuleBuilder} + */ + border: function(value) { + return this.add('border-color', value); + }, - className: 'clipboard', + /** + * Add a border-width style to the rule. + * @param {Object} options - visible options + * @param {Boolean} [options.showVerticalBorder] - whether the vertical border is visible + * @param {Boolean} [options.showHorizontalBorder] - whether the horizontal border is visible + * @returns {CSSRuleBuilder} + */ + borderWidth: function(options) { + var vertical = options.showVerticalBorder; + var horizontal = options.showHorizontalBorder; + var value; - events: { - 'keydown': '_onKeyDown', - 'blur': '_onBlur' + if (_.isBoolean(vertical)) { + value = vertical ? '1px' : '0'; + this.add('border-left-width', value) + .add('border-right-width', value); + } + if (_.isBoolean(horizontal)) { + value = horizontal ? '1px' : '0'; + this.add('border-top-width', value) + .add('border-bottom-width', value); + } + return this; }, /** - * Event handler for blur event. - * @private + * Shortcut for add('background-color', value) + * @param {String} value - css value + * @returns {CSSRuleBuilder} */ - _onBlur: function() { - var focusModel = this.focusModel; - setTimeout(function() { - focusModel.refreshState(); - }, 0); + bg: function(value) { + return this.add('background-color', value); }, /** - * Event handler for 'focusClipboard' event on focusModel - * @private + * Shortcut for add('color', value) + * @param {String} value - css value + * @returns {CSSRuleBuilder} */ - _onFocus: function() { - try { - if (!this.$el.is(':focus')) { - this.$el.focus(); - this.focusModel.refreshState(); - } - } catch (e) { - // Do nothing. - // This try/catch block is just for preventing 'Unspecified error' - // in IE9(and under) when running test using karma. - } + text: function(value) { + return this.add('color', value); }, /** - * 랜더링 한다. - * @returns {View.Clipboard} this object + * Create a CSS rule string with a selector and prop-values. + * @returns {String} */ - render: function() { - return this; - }, + build: function() { + var result = ''; + + if (this._propValues.length) { + result = this._selector + '{' + this._propValues.join(';') + '}'; + } + + return result; + } +}); +module.exports = { /** - * keyEvent 의 중복 호출을 방지하는 lock 을 설정한다. - * @private + * Creates new Builder instance. + * @param {String} selector - selector + * @returns {CSSRuleBuilder} */ - _lock: function() { - clearTimeout(this.timeoutIdForKeyIn); - this.isLocked = true; - this.timeoutIdForKeyIn = setTimeout($.proxy(this._unlock, this), 10); // eslint-disable-line no-magic-numbers + create: function(selector) { + return new CSSRuleBuilder(selector); }, /** - * keyEvent 의 중복 호출을 방지하는 lock 을 해제한다. - * @private + * Creates a new Builder instance with a class name selector. + * @param {String} className - class name + * @returns {Builder} */ - _unlock: function() { - this.isLocked = false; + createClassRule: function(className) { + return this.create('.' + className); }, /** - * keyDown 이벤트 핸들러 - * @param {Event} keyDownEvent 이벤트 객체 - * @private + * Creates an array of new Builder instances for the -webkit-scrollbar styles. + * @param {String} selector - selector + * @param {Object} options - options + * @returns {Array.} */ - _onKeyDown: function(keyDownEvent) { - if (this.isLocked) { - keyDownEvent.preventDefault(); - return; - } + createWebkitScrollbarRules: function(selector, options) { + return [ + this.create(selector + ' ::-webkit-scrollbar').bg(options.background), + this.create(selector + ' ::-webkit-scrollbar-thumb').bg(options.thumb), + this.create(selector + ' ::-webkit-scrollbar-thumb:hover').bg(options.active) + ]; + }, - if (keyDownEvent.shiftKey && (keyDownEvent.ctrlKey || keyDownEvent.metaKey)) { - this._keyInWithShiftAndCtrl(keyDownEvent); - } else if (keyDownEvent.shiftKey) { - this._keyInWithShift(keyDownEvent); - } else if (keyDownEvent.ctrlKey || keyDownEvent.metaKey) { - this._keyInWithCtrl(keyDownEvent); - } else { - this._keyIn(keyDownEvent); - } - this._lock(); + /** + * Creates a builder instance for the IE scrollbar styles. + * @param {String} selector - selector + * @param {Object} options - options + * @returns {Array.} + */ + createIEScrollbarRule: function(selector, options) { + var bgProps = [ + 'scrollbar-3dlight-color', + 'scrollbar-darkshadow-color', + 'scrollbar-track-color', + 'scrollbar-shadow-color' + ]; + var thumbProps = [ + 'scrollbar-face-color', + 'scrollbar-highlight-color' + ]; + var ieScrollbarRule = this.create(selector); + + _.each(bgProps, function(prop) { + ieScrollbarRule.add(prop, options.background); + }); + _.each(thumbProps, function(prop) { + ieScrollbarRule.add(prop, options.thumb); + }); + ieScrollbarRule.add('scrollbar-arrow-color', options.active); + + return ieScrollbarRule; }, /** - * ctrl, shift 둘다 눌리지 않은 상태에서의 key down 이벤트 핸들러 - * @param {Event} keyDownEvent 이벤트 객체 - * @private + * Build all rules and returns the concatenated string. + * @param {Array.} rules - rule builders + * @returns {String} */ - _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; - - if (util.isBlank(focused.rowKey)) { - return; - } + buildAll: function(rules) { + return _.map(rules, function(rule) { + return rule.build(); + }).join(''); + } +}; + +},{}],40:[function(require,module,exports){ +/** +* @fileoverview theme manager +* @author NHN Ent. FE Development Team +*/ +'use strict'; + +var util = require('../common/util'); +var styleGen = require('./styleGenerator'); +var themeNameConst = require('../common/constMap').themeName; + +var STYLE_ELEMENT_ID = 'tui-grid-theme-style'; + +var presetOptions = {}; +presetOptions[themeNameConst.DEFAULT] = require('./preset/default'); +presetOptions[themeNameConst.STRIPED] = require('./preset/striped'); +presetOptions[themeNameConst.CLEAN] = require('./preset/clean'); + +/** + * build css string with given options. + * @param {Object} options - options + * @returns {String} + */ +function buildCssString(options) { + var styles = [ + styleGen.grid(options.grid), + styleGen.scrollbar(options.scrollbar), + styleGen.toolbar(options.toolbar), + styleGen.selection(options.selection) + ]; + var cell = options.cell; + + if (cell) { + styles = styles.concat([ + styleGen.cell(cell.normal), + styleGen.cellDummy(cell.dummy), + styleGen.cellEditable(cell.editable), + styleGen.cellEvenRow(cell.evenRow), + styleGen.cellHead(cell.head), + styleGen.cellRequired(cell.required), + styleGen.cellDisabled(cell.disabled), + styleGen.cellInvalid(cell.invalid), + styleGen.cellCurrentRow(cell.currentRow), + styleGen.cellSelectedHead(cell.selectedHead), + styleGen.cellFocused(cell.focused) + ]); + } + + return styles.join(''); +} + +/** + * Set document style with given options. + * @param {Object} options - options + */ +function setDocumentStyle(options) { + var cssString = buildCssString(options); + + $('#' + STYLE_ELEMENT_ID).remove(); + util.appendStyleElement(STYLE_ELEMENT_ID, cssString); +} + +module.exports = { + /** + * Creates a style element using theme options identified by given name, + * and appends it to the document. + * @param {String} themeName - preset theme name + * @param {Object} extOptions - if exist, extend preset theme options with it. + */ + apply: function(themeName, extOptions) { + var options = presetOptions[themeName]; + + if (!options) { + options = presetOptions[themeNameConst.DEFAULT]; + } + options = $.extend(true, {}, options, extOptions); + setDocumentStyle(options); + }, + + /** + * Returns whether the style of a theme is applied. + * @returns {Boolean} + */ + isApplied: function() { + return $('#' + STYLE_ELEMENT_ID).length === 1; + } +}; + +},{"../common/constMap":9,"../common/util":12,"./preset/clean":41,"./preset/default":42,"./preset/striped":43,"./styleGenerator":44}],41:[function(require,module,exports){ +/** +* @fileoverview default theme preset +* @author NHN Ent. FE Development Team +*/ +'use strict'; + +var presetDefault = require('./default'); + +module.exports = $.extend(true, {}, presetDefault, { + grid: { + border: '#c0c0c0' + }, + toolbar: { + border: '#e0e0e0' + }, + cell: { + normal: { + background: '#fff', + border: '#e0e0e0', + showVerticalBorder: false, + showHorizontalBorder: true + }, + head: { + background: '#fff', + border: '#e0e0e0', + showVerticalBorder: false, + showHorizontalBorder: true + }, + selectedHead: { + background: '#e0e0e0' + } + } +}); + +},{"./default":42}],42:[function(require,module,exports){ +/** +* @fileoverview default theme preset +* @author NHN Ent. FE Development Team +*/ +'use strict'; + +module.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: true, + showHorizontalBorder: true + }, + head: { + background: '#eee', + border: '#ccc', + showVerticalBorder: true, + showHorizontalBorder: true + }, + 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(require,module,exports){ +/** +* @fileoverview default theme preset +* @author NHN Ent. FE Development Team +*/ +'use strict'; + +var presetDefault = require('./default'); + +module.exports = $.extend(true, {}, presetDefault, { + cell: { + normal: { + background: '#fff', + border: '#e8e8e8', + showVerticalBorder: false, + showHorizontalBorder: false + }, + evenRow: { + background: '#f3f3f3' + }, + head: { + showVerticalBorder: true, + showHorizontalBorder: true + } + } +}); + +},{"./default":42}],44:[function(require,module,exports){ +/** +* @fileoverview css style generator +* @author NHN Ent. FE Development Team +*/ +'use strict'; + +var builder = require('./cssRuleBuilder'); +var classNameConst = require('../common/classNameConst'); + +/** + * Shortcut for the builder.createClassRule() method. + */ +var classRule = _.bind(builder.createClassRule, builder); + +/** + * Creates a rule string for background and text colors. + * @param {String} className - class name + * @param {Objecr} options - options + * @returns {String} + */ +function bgTextRuleString(className, options) { + return classRule(className) + .bg(options.background) + .text(options.text) + .build(); +} + +module.exports = { + /** + * Generates a css string for the grid. + * @param {Object} options - options + * @returns {String} + */ + grid: function(options) { + var containerRule = classRule(classNameConst.CONTAINER) + .bg(options.background) + .border(options.border) + .text(options.text); + 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); + var scrollHeadRule = classRule(classNameConst.SCROLLBAR_HEAD).border(options.border); + var scrollBorderRule = classRule(classNameConst.SCROLLBAR_BORDER).bg(options.border); + + return builder.buildAll([ + containerRule, + tableRule, + headRule, + borderLineRule, + scrollHeadRule, + scrollBorderRule + ]); + }, + + /** + * Generates a css string for scrollbars. + * @param {Object} options - options + * @returns {String} + */ + scrollbar: function(options) { + var webkitScrollbarRules = builder.createWebkitScrollbarRules('.' + classNameConst.CONTAINER, options); + var ieScrollbarRule = builder.createIEScrollbarRule('.' + classNameConst.CONTAINER, options); + var rightBottomRule = classRule(classNameConst.SCROLLBAR_RIGHT_BOTTOM).bg(options.background); + var leftBottomRule = classRule(classNameConst.SCROLLBAR_LEFT_BOTTOM).bg(options.background); + var scrollHeadRule = classRule(classNameConst.SCROLLBAR_HEAD).bg(options.background); + + return builder.buildAll(webkitScrollbarRules.concat([ + ieScrollbarRule, + rightBottomRule, + leftBottomRule, + scrollHeadRule + ])); + }, + + /** + * Generates a css string for a toolbar. + * @param {Object} options - options + * @returns {String} + */ + toolbar: function(options) { + var toolbarRule = classRule(classNameConst.TOOLBAR) + .bg(options.background) + .border(options.border); + + var resizeHandleRule = classRule(classNameConst.HEIGHT_RESIZE_HANDLE) + .border(options.border); + + return builder.buildAll([ + toolbarRule, + resizeHandleRule + ]); + }, + + /** + * Generates a css string for selection layers. + * @param {Object} options - options + * @returns {String} + */ + selection: function(options) { + return classRule(classNameConst.LAYER_SELECTION) + .bg(options.background) + .border(options.border) + .build(); + }, + + /** + * Generates a css string for table cells. + * @param {Object} options - options + * @returns {String} + */ + cell: function(options) { + var cellRule = classRule(classNameConst.CELL) + .bg(options.background) + .border(options.border) + .borderWidth(options) + .text(options.text); + + return cellRule.build(); + }, + + /* + * Generates a css string for head cells. + * @param {Object} options - options + * @returns {String} + */ + cellHead: function(options) { + var headRule = classRule(classNameConst.CELL_HEAD) + .bg(options.background) + .border(options.border) + .borderWidth(options) + .text(options.text); + + return headRule.build(); + }, + + /** + * Generates a css string for the cells in even rows. + * @param {Object} options - options + * @returns {String} + */ + cellEvenRow: function(options) { + return classRule(classNameConst.CELL_ROW_EVEN) + .bg(options.background) + .build(); + }, + + /** + * Generates a css string for selected head cells. + * @param {Object} options - options + * @returns {String} + */ + cellSelectedHead: function(options) { + return builder.create('.' + classNameConst.CELL_HEAD + '.' + classNameConst.CELL_SELECTED) + .bg(options.background) + .text(options.text) + .build(); + }, + + /** + * Generates a css string for focused cells. + * @param {Object} options - options + * @returns {String} + */ + cellFocused: function(options) { + var focusLayerRule = classRule(classNameConst.LAYER_FOCUS_BORDER).bg(options.border); + var editingLayerRule = classRule(classNameConst.LAYER_EDITING).border(options.border); + + return builder.buildAll([focusLayerRule, editingLayerRule]); + }, + + /** + * Generates a css string for editable cells. + * @param {Object} options - options + * @returns {String} + */ + cellEditable: function(options) { + return bgTextRuleString(classNameConst.CELL_EDITABLE, options); + }, + + /** + * Generates a css string for required cells. + * @param {Object} options - options + * @returns {String} + */ + cellRequired: function(options) { + return bgTextRuleString(classNameConst.CELL_REQUIRED, options); + }, + + /** + * Generates a css string for disabled cells. + * @param {Object} options - options + * @returns {String} + */ + cellDisabled: function(options) { + return bgTextRuleString(classNameConst.CELL_DISABLED, options); + }, + + /** + * Generates a css string for dummy cells. + * @param {Object} options - options + * @returns {String} + */ + cellDummy: function(options) { + return bgTextRuleString(classNameConst.CELL_DUMMY, options); + }, + + /** + * Generates a css string for invalid cells. + * @param {Object} options - options + * @returns {String} + */ + cellInvalid: function(options) { + return bgTextRuleString(classNameConst.CELL_INVALID, options); + }, + + /** + * Generates a css string for cells in a current row. + * @param {Object} options - options + * @returns {String} + */ + cellCurrentRow: function(options) { + return bgTextRuleString(classNameConst.CELL_CURRENT_ROW, options); + } +}; + +},{"../common/classNameConst":8,"./cssRuleBuilder":39}],45:[function(require,module,exports){ +/** + * @fileoverview 키 이벤트 핸들링 담당하는 Clipboard 정의 + * @author NHN Ent. FE Development Team + */ +'use strict'; + +var View = require('../base/view'); +var util = require('../common/util'); +var keyCodeMap = require('../common/constMap').keyCode; +var classNameConst = require('../common/classNameConst'); + +/** + * Clipboard view class + * @module view/clipboard + * @extends module:base/view + */ +var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ + /** + * @constructs + * @param {Object} options - Options + */ + initialize: function(options) { + this.setOwnProperties({ + focusModel: options.focusModel, + selectionModel: options.selectionModel, + painterManager: options.painterManager, + dimensionModel: options.dimensionModel, + dataModel: options.dataModel, + columnModel: options.columnModel, + renderModel: options.renderModel, + timeoutIdForKeyIn: 0, + isLocked: false + }); + this.listenTo(this.focusModel, 'focusClipboard', this._onFocus); + }, + + tagName: 'textarea', + + className: classNameConst.CLIPBOARD, + + events: { + 'keydown': '_onKeyDown', + 'blur': '_onBlur' + }, + + /** + * Event handler for blur event. + * @private + */ + _onBlur: function() { + var focusModel = this.focusModel; + setTimeout(function() { + focusModel.refreshState(); + }, 0); + }, + + /** + * Event handler for 'focusClipboard' event on focusModel + * @private + */ + _onFocus: function() { + try { + if (!this.$el.is(':focus')) { + this.$el.focus(); + this.focusModel.refreshState(); + } + } catch (e) { + // Do nothing. + // This try/catch block is just for preventing 'Unspecified error' + // in IE9(and under) when running test using karma. + } + }, + + /** + * 랜더링 한다. + * @returns {View.Clipboard} this object + */ + render: function() { + return this; + }, + + /** + * keyEvent 의 중복 호출을 방지하는 lock 을 설정한다. + * @private + */ + _lock: function() { + clearTimeout(this.timeoutIdForKeyIn); + this.isLocked = true; + this.timeoutIdForKeyIn = setTimeout($.proxy(this._unlock, this), 10); // eslint-disable-line no-magic-numbers + }, + + /** + * keyEvent 의 중복 호출을 방지하는 lock 을 해제한다. + * @private + */ + _unlock: function() { + this.isLocked = false; + }, + + /** + * keyDown 이벤트 핸들러 + * @param {Event} keyDownEvent 이벤트 객체 + * @private + */ + _onKeyDown: function(keyDownEvent) { + if (this.isLocked) { + keyDownEvent.preventDefault(); + return; + } + + if (keyDownEvent.shiftKey && (keyDownEvent.ctrlKey || keyDownEvent.metaKey)) { + this._keyInWithShiftAndCtrl(keyDownEvent); + } else if (keyDownEvent.shiftKey) { + this._keyInWithShift(keyDownEvent); + } else if (keyDownEvent.ctrlKey || keyDownEvent.metaKey) { + this._keyInWithCtrl(keyDownEvent); + } else { + this._keyIn(keyDownEvent); + } + this._lock(); + }, + + /** + * ctrl, shift 둘다 눌리지 않은 상태에서의 key down 이벤트 핸들러 + * @param {Event} keyDownEvent 이벤트 객체 + * @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; + + if (util.isBlank(focused.rowKey)) { + return; + } switch (keyCode) { case keyCodeMap.UP_ARROW: @@ -10800,7 +11706,7 @@ var Clipboard = View.extend(/**@lends module:view/clipboard.prototype */{ module.exports = Clipboard; -},{"../base/view":7,"../common/constMap":8,"../common/util":11}],39:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],46:[function(require,module,exports){ /** * @fileoverview View class that conaints a top element of the DOM structure of the grid. * @author NHN Ent. FE Development Team @@ -10809,7 +11715,8 @@ module.exports = Clipboard; var View = require('../base/view'); var GridEvent = require('../common/gridEvent'); -var attrNameMap = require('../common/constMap').attrName; +var attrNameConst = require('../common/constMap').attrName; +var classNameConst = require('../common/classNameConst'); /** * Container View @@ -10991,7 +11898,10 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ _isCellElement: function($target, isIncludeChild) { var $cell = isIncludeChild ? $target.closest('td') : $target; - return !!($cell.is('td') && $cell.attr(attrNameMap.COLUMN_NAME) && $cell.parent().attr(attrNameMap.ROW_KEY)); + return !!($cell.is('td') && + $cell.attr(attrNameConst.COLUMN_NAME) && + $cell.parent().attr(attrNameConst.ROW_KEY) + ); }, /** @@ -11001,8 +11911,8 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ * @returns {{rowKey: string, rowData: Data.Row, columnName: string}} 셀 관련 정보를 담은 객체 */ _getCellInfoFromElement: function($cell) { - var rowKey = Number($cell.attr(attrNameMap.ROW_KEY)); - var columnName = $cell.attr(attrNameMap.COLUMN_NAME); + var rowKey = Number($cell.attr(attrNameConst.ROW_KEY)); + var columnName = $cell.attr(attrNameConst.COLUMN_NAME); return { rowKey: rowKey, @@ -11045,13 +11955,19 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ */ render: function() { var childElements = this._renderChildren().concat([ - $('
').addClass('left_line'), - $('
').addClass('right_line') + $('
').addClass(classNameConst.BORDER_LINE + ' ' + classNameConst.BORDER_TOP), + $('
').addClass(classNameConst.BORDER_LINE + ' ' + classNameConst.BORDER_LEFT), + $('
').addClass(classNameConst.BORDER_LINE + ' ' + classNameConst.BORDER_RIGHT) ]); - this.$el.addClass('grid_wrapper uio_grid') - .attr('data-grid-id', this.gridId) + + 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'); @@ -11064,9 +11980,15 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ */ _appendBottomLine: function() { var bottomPos = this.dimensionModel.get('toolbarHeight') + this.dimensionModel.getScrollXHeight(); - if (bottomPos) { - this.$el.append($('
').addClass('data_bottom_line').css('bottom', bottomPos)); + 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); }, /** @@ -11084,7 +12006,7 @@ var Container = View.extend(/**@lends module:view/container.prototype */{ module.exports = Container; -},{"../base/view":7,"../common/constMap":8,"../common/gridEvent":10}],40:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/gridEvent":11}],47:[function(require,module,exports){ /** * @fileoverview Layer class that represents the state of rendering phase * @author NHN Ent. FE Development Team @@ -11093,7 +12015,8 @@ module.exports = Container; var View = require('../base/view'); var CELL_BORDER_WIDTH = require('../common/constMap').dimension.CELL_BORDER_WIDTH; -var attrNameMap = require('../common/constMap').attrName; +var attrNameConst = require('../common/constMap').attrName; +var classNameConst = require('../common/classNameConst'); /** * Layer class that represents the state of rendering phase. @@ -11113,7 +12036,7 @@ var EditingLayer = View.extend(/**@lends module:view/editingLayer.prototype */{ this.listenTo(this.renderModel, 'editingStateChanged', this._onEditingStateChanged); }, - className: 'editing_layer cell_content', + className: classNameConst.LAYER_EDITING + ' ' + classNameConst.CELL_CONTENT, /** * Starts editing the given cell. @@ -11128,8 +12051,8 @@ var EditingLayer = View.extend(/**@lends module:view/editingLayer.prototype */{ var painter = this.inputPainters[editType]; this.$el.html(painter.generateHtml(cellData)) - .attr(attrNameMap.ROW_KEY, rowKey) - .attr(attrNameMap.COLUMN_NAME, columnName) + .attr(attrNameConst.ROW_KEY, rowKey) + .attr(attrNameConst.COLUMN_NAME, columnName) .css(styleMap).show(); this._adjustLeftPosition(); @@ -11151,8 +12074,8 @@ var EditingLayer = View.extend(/**@lends module:view/editingLayer.prototype */{ * @private */ _finishEditing: function() { - this.$el.removeAttr(attrNameMap.ROW_KEY); - this.$el.removeAttr(attrNameMap.COLUMN_NAME); + this.$el.removeAttr(attrNameConst.ROW_KEY); + this.$el.removeAttr(attrNameConst.COLUMN_NAME); this.$el.empty().hide(); }, @@ -11170,6 +12093,27 @@ var EditingLayer = View.extend(/**@lends module:view/editingLayer.prototype */{ } }, + /** + * Adjust offset value of TD, because it varies from browsers to browsers when borders are callapsed. + * @param {Number} offsetValue - offset value (offset.top or offset.left) + * @returns {Number} + * @private + */ + _adjustCellOffsetValue: function(offsetValue) { + var browser = tui.util.browser; + var result = offsetValue; + + if (browser.msie) { + if (browser.version === 9) { + result = offsetValue - 1; + } else if (browser.version > 9) { + result = Math.floor(offsetValue); + } + } + + return result; + }, + /** * Calculates the position and the dimension of the layer and returns the object that contains css properties. * @param {Stirng} rowKey - row key @@ -11179,15 +12123,15 @@ var EditingLayer = View.extend(/**@lends module:view/editingLayer.prototype */{ * @private */ _calculateLayoutStyle: function(rowKey, columnName, expandable) { - var wrapperOffset = this.domState.getOffset(), - $cell = this.domState.getElement(rowKey, columnName), - cellOffset = $cell.offset(), - cellHeight = $cell.height(), - cellWidth = $cell.width() - (CELL_BORDER_WIDTH * 2); + var wrapperOffset = this.domState.getOffset(); + var $cell = this.domState.getElement(rowKey, columnName); + var cellOffset = $cell.offset(); + var cellHeight = $cell.height() + CELL_BORDER_WIDTH; + var cellWidth = $cell.width() + CELL_BORDER_WIDTH; return { - top: cellOffset.top - wrapperOffset.top, - left: cellOffset.left - wrapperOffset.left, + top: this._adjustCellOffsetValue(cellOffset.top) - wrapperOffset.top, + left: this._adjustCellOffsetValue(cellOffset.left) - wrapperOffset.left, height: cellHeight, minWidth: expandable ? cellWidth : '', width: expandable ? '' : cellWidth, @@ -11221,9 +12165,10 @@ var EditingLayer = View.extend(/**@lends module:view/editingLayer.prototype */{ } }); + module.exports = EditingLayer; -},{"../base/view":7,"../common/constMap":8}],41:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],48:[function(require,module,exports){ /** * @fileoverview View factory * @author NHN Ent. FE Development Team @@ -11246,6 +12191,7 @@ var BodyTableView = require('./layout/bodyTable'); var RowListView = require('./rowList'); var SelectionLayerView = require('./selectionLayer'); var EditingLayerView = require('./editingLayer'); +var FocusLayerView = require('./focusLayer'); /** * View Factory @@ -11472,12 +12418,171 @@ var ViewFactory = tui.util.defineClass({ inputPainters: this.painterManager.getInputPainters(true), domState: this.domState }); + }, + + /** + * Creates focus layer view and returns it. + * @param {String} whichSide - 'L'(left) or 'R'(right) + * @returns {module:view/focusLayer} New focus layer view instance + */ + createFocusLayer: function(whichSide) { + return new FocusLayerView({ + whichSide: whichSide, + dimensionModel: this.modelManager.dimensionModel, + columnModel: this.modelManager.columnModel, + focusModel: this.modelManager.focusModel + }); } }); module.exports = ViewFactory; -},{"./clipboard":38,"./container":39,"./editingLayer":40,"./layout/body":42,"./layout/bodyTable":43,"./layout/frame-lside":44,"./layout/frame-rside":45,"./layout/header":47,"./layout/resizeHandler":48,"./layout/toolbar":49,"./layout/toolbar/controlPanel":50,"./layout/toolbar/pagination":51,"./layout/toolbar/resizeHandler":52,"./rowList":53,"./selectionLayer":54,"./stateLayer":55}],42:[function(require,module,exports){ +},{"./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){ +/** + * @fileoverview Class for the layer view that represents the currently focused cell + * @author NHN Ent. FE Development Team + */ +'use strict'; + +var View = require('../base/view'); +var CELL_BORDER_WIDTH = require('../common/constMap').dimension.CELL_BORDER_WIDTH; +var classNameConst = require('../common/classNameConst'); + +var HTML_BORDER_DIV = '
'; + +/** + * Class for the layer view that represents the currently focused cell + * @module view/focusLayer + * @extends module:base/view + */ +var FocusLayer = View.extend(/**@lends module:view/focusLayer.prototype */{ + /** + * @constructs + * @param {Object} options - Options + */ + initialize: function(options) { + this.focusModel = options.focusModel; + this.columnModel = options.columnModel; + this.dimensionModel = options.dimensionModel; + this.whichSide = options.whichSide; + + this.borderEl = { + $top: $(HTML_BORDER_DIV), + $left: $(HTML_BORDER_DIV), + $right: $(HTML_BORDER_DIV), + $bottom: $(HTML_BORDER_DIV) + }; + + this.listenTo(this.dimensionModel, 'columnWidthChanged', this._onColumnWidthChanged); + this.listenTo(this.focusModel, 'blur', this._onBlur); + this.listenTo(this.focusModel, 'focus', this._onFocus); + // this.listenTo(this.focusModel, 'change:editingAddress', this._onChangeEditingAddress); + }, + + className: classNameConst.LAYER_FOCUS, + + /** + * Event handler for 'columnWidthChanged' event on the module:model/dimension + * @private + */ + _onColumnWidthChanged: function() { + var focusModel = this.focusModel; + + if (this.$el.is(':visible')) { + this._refreshBorderLayout(focusModel.get('rowKey'), focusModel.get('columnName')); + } + }, + + /** + * Event handler for 'blur' event on the module:model/focus + * @private + */ + _onBlur: function() { + this.$el.hide(); + }, + + /** + * Event handler for 'focus' event on module:model/focus + * @param {Number} rowKey - target row key + * @param {String} columnName - target column name + * @private + */ + _onFocus: function(rowKey, columnName) { + var targetSide = this.columnModel.isLside(columnName) ? 'L' : 'R'; + + if (targetSide === this.whichSide) { + this._refreshBorderLayout(rowKey, columnName); + this.$el.show(); + } + }, + + _onChangeEditingAddress: function(focusModel, address) { + if (address) { + this.$el.hide(); + } else { + this.$el.show(); + } + }, + + /** + * Resets the position and the dimension of the layer. + * @param {Number} rowKey - row key + * @param {String} columnName - column name + * @private + */ + _refreshBorderLayout: function(rowKey, columnName) { + var pos = this.dimensionModel.getCellPosition(rowKey, columnName); + var width = pos.right - pos.left; + var height = pos.bottom - pos.top; + + this.borderEl.$left.css({ + top: pos.top, + left: pos.left, + width: CELL_BORDER_WIDTH, + height: height + CELL_BORDER_WIDTH + }); + + this.borderEl.$top.css({ + top: pos.top === 0 ? CELL_BORDER_WIDTH : pos.top, + left: pos.left, + width: width + CELL_BORDER_WIDTH, + height: CELL_BORDER_WIDTH + }); + + this.borderEl.$right.css({ + top: pos.top, + left: pos.left + width, + width: CELL_BORDER_WIDTH, + height: height + CELL_BORDER_WIDTH + }); + + this.borderEl.$bottom.css({ + top: pos.top + height, + left: pos.left, + width: width + CELL_BORDER_WIDTH, + height: CELL_BORDER_WIDTH + }); + }, + + /** + * Render + * @returns {Object} this instance + */ + render: function() { + var $el = this.$el; + + _.each(this.borderEl, function($border) { + $el.append($border); + }); + $el.hide(); + + return this; + } +}); + +module.exports = FocusLayer; + +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}],50:[function(require,module,exports){ /** * @fileoverview Class for the body layout * @author NHN Ent. FE Development Team @@ -11486,16 +12591,14 @@ module.exports = ViewFactory; var View = require('../../base/view'); var util = require('../../common/util'); -var attrNameMap = require('../../common/constMap').attrName; +var attrNameConst = require('../../common/constMap').attrName; +var classNameConst = require('../../common/classNameConst'); +// Minimum time (ms) to detect if an alert or confirm dialog has been displayed. +var MIN_INTERVAL_FOR_PAUSED = 200; -var HTML_CONTAINER = '
', - - // Minimum time (ms) to detect if an alert or confirm dialog has been displayed. - MIN_INTERVAL_FOR_PAUSED = 200, - - // Minimum distance (pixel) to detect if user wants to drag when moving mouse with button pressed. - MIN_DISATNCE_FOR_DRAG = 10; +// Minimum distance (pixel) to detect if user wants to drag when moving mouse with button pressed. +var MIN_DISATNCE_FOR_DRAG = 10; /** * Class for the body layout @@ -11531,13 +12634,14 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ .listenTo(this.renderModel, 'change:scrollLeft', this._onScrollLeftChange); }, - tagName: 'div', + className: classNameConst.BODY_AREA, - className: 'data', + events: function() { + var hash = {}; + hash.scroll = '_onScroll'; + hash['mousedown .' + classNameConst.BODY_CONTAINER] = '_onMouseDown'; - events: { - 'scroll': '_onScroll', - 'mousedown .body_container': '_onMouseDown' + return hash; }, /** @@ -11615,17 +12719,17 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ * @private */ _onMouseDown: function(event) { - var columnModel = this.columnModel, - $target = $(event.target), - $td = $target.closest('td'), - $tr = $target.closest('tr'), - columnName = $td.attr(attrNameMap.COLUMN_NAME), - rowKey = $tr.attr(attrNameMap.ROW_KEY), - startAction = true, - inputData = _.pick(event, 'pageX', 'pageY', 'shiftKey'), - indexData; - - if (!$td.length) { // selection layer + var columnModel = this.columnModel; + var $target = $(event.target); + var $td = $target.closest('td'); + var $tr = $target.closest('tr'); + var columnName = $td.attr(attrNameConst.COLUMN_NAME); + var rowKey = $tr.attr(attrNameConst.ROW_KEY); + var startAction = true; + var inputData = _.pick(event, 'pageX', 'pageY', 'shiftKey'); + var indexData; + + if (!$td.length) { // selection layer, focus layer indexData = this.dimensionModel.getIndexFromMousePosition(event.pageX, event.pageY); columnName = this._getColumnNameByVisibleIndex(indexData.column); } else if (rowKey && columnName) { // valid cell @@ -11754,13 +12858,10 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ * @private */ _onMouseMove: function(event) { - var selectionModel = this.selectionModel, - pageX = event.pageX, - pageY = event.pageY, - dragged = this._getMouseMoveDistance(pageX, pageY) > MIN_DISATNCE_FOR_DRAG; + var dragged = this._getMouseMoveDistance(event.pageX, event.pageY) > MIN_DISATNCE_FOR_DRAG; - if (selectionModel.hasSelection() || dragged) { - selectionModel.updateByMousePosition(pageX, pageY); + if (this.selectionModel.hasSelection() || dragged) { + this.selectionModel.updateByMousePosition(event.pageX, event.pageY); } }, @@ -11772,8 +12873,8 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ * @private */ _getMouseMoveDistance: function(pageX, pageY) { - var dx = Math.abs(this.mouseDownX - pageX), - dy = Math.abs(this.mouseDownY - pageY); + var dx = Math.abs(this.mouseDownX - pageX); + var dy = Math.abs(this.mouseDownY - pageY); return Math.round(Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2))); }, @@ -11806,12 +12907,13 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ } this.$el.css('height', this.dimensionModel.get('bodyHeight')); - this.$container = $(HTML_CONTAINER); + this.$container = $('
').addClass(classNameConst.BODY_CONTAINER); this.$el.append(this.$container); this._addChildren([ this.viewFactory.createBodyTable(whichSide), - this.viewFactory.createSelectionLayer(whichSide) + this.viewFactory.createSelectionLayer(whichSide), + this.viewFactory.createFocusLayer(whichSide) ]); this.$container.append(this._renderChildren()); this._resetContainerHeight(); @@ -11821,7 +12923,7 @@ var Body = View.extend(/**@lends module:view/layout/body.prototype */{ module.exports = Body; -},{"../../base/view":7,"../../common/constMap":8,"../../common/util":11}],43:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],51:[function(require,module,exports){ /** * @fileoverview Class for the table layout in the body(data) area * @author NHN Ent. FE Development Team @@ -11831,6 +12933,7 @@ module.exports = Body; var View = require('../../base/view'); var util = require('../../common/util'); var constMap = require('../../common/constMap'); +var classNameConst = require('../../common/classNameConst'); var CELL_BORDER_WIDTH = constMap.dimension.CELL_BORDER_WIDTH; var ATTR_COLUMN_NAME = constMap.attrName.COLUMN_NAME; @@ -11867,12 +12970,10 @@ var BodyTable = View.extend(/**@lends module:view/layout/bodyTable.prototype */{ this._attachAllTableEventHandlers(); }, - tagName: 'div', - - className: 'table_container', + className: classNameConst.BODY_TABLE_CONTAINER, template: _.template( - '' + + '
' + ' <%=colGroup%>' + ' <%=tbody%>' + '
'), @@ -11891,7 +12992,7 @@ var BodyTable = View.extend(/**@lends module:view/layout/bodyTable.prototype */{ totalWidth = 0; _.each(columnWidthList, function(width, index) { - $colList.eq(index).css('width', width - BodyTable.EXTRA_WIDTH); + $colList.eq(index).css('width', width - BodyTable.EXTRA_WIDTH + CELL_BORDER_WIDTH); totalWidth += width + CELL_BORDER_WIDTH; }, this); @@ -12004,7 +13105,7 @@ var BodyTable = View.extend(/**@lends module:view/layout/bodyTable.prototype */{ html += this.templateCol({ attrColumnName: ATTR_COLUMN_NAME, columnName: columnModel.columnName, - width: columnWidthList[index] - BodyTable.EXTRA_WIDTH + width: columnWidthList[index] - BodyTable.EXTRA_WIDTH + CELL_BORDER_WIDTH }); }, this); @@ -12017,7 +13118,7 @@ var BodyTable = View.extend(/**@lends module:view/layout/bodyTable.prototype */{ module.exports = BodyTable; -},{"../../base/view":7,"../../common/constMap":8,"../../common/util":11}],44:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],52:[function(require,module,exports){ /** * @fileoverview Left Side Frame * @author NHN Ent. FE Development Team @@ -12025,6 +13126,7 @@ module.exports = BodyTable; 'use strict'; var Frame = require('./frame'); +var classNameConst = require('../../common/classNameConst'); /** * Left Side Frame @@ -12042,7 +13144,7 @@ var LsideFrame = Frame.extend(/**@lends module:view/layout/frame-lside.prototype }); }, - className: 'lside_area', + className: classNameConst.LSIDE_AREA, /** * Event handler for 'changeColumnWidth' event on module:model/dimension @@ -12079,7 +13181,7 @@ var LsideFrame = Frame.extend(/**@lends module:view/layout/frame-lside.prototype } $scrollOverlay = $('
') - .addClass('scrollbar_overlay') + .addClass(classNameConst.SCROLLBAR_LEFT_BOTTOM) .css('bottom', dimensionModel.get('toolbarHeight')); this.$el.append($scrollOverlay); } @@ -12087,7 +13189,7 @@ var LsideFrame = Frame.extend(/**@lends module:view/layout/frame-lside.prototype module.exports = LsideFrame; -},{"./frame":46}],45:[function(require,module,exports){ +},{"../../common/classNameConst":8,"./frame":54}],53:[function(require,module,exports){ /** * @fileoverview Right Side Frame * @author NHN Ent. FE Development Team @@ -12095,8 +13197,10 @@ module.exports = LsideFrame; 'use strict'; var Frame = require('./frame'); +var classNameConst = require('../../common/classNameConst'); var CELL_BORDER_WIDTH = require('../../common/constMap').dimension.CELL_BORDER_WIDTH; + /** * right side frame class * @module view/layout/frame-rside @@ -12116,7 +13220,7 @@ var RsideFrame = Frame.extend(/**@lends module:view/layout/frame-rside.prototype this._resetScrollBorderHeight); }, - className: 'rside_area', + className: classNameConst.RSIDE_AREA, /** * Event handler for 'columnWidthChanged' event on dimensionModel @@ -12187,10 +13291,10 @@ var RsideFrame = Frame.extend(/**@lends module:view/layout/frame-rside.prototype headerHeight = dimensionModel.get('headerHeight'); // Empty DIV for hiding scrollbar in the header area - $space = $('
').addClass('header_space'); + $space = $('
').addClass(classNameConst.SCROLLBAR_HEAD); // Empty DIV for showing a left-border of vertical scrollbar in the body area - $scrollBorder = $('
').addClass('scrollbar_border'); + $scrollBorder = $('
').addClass(classNameConst.SCROLLBAR_BORDER); $space.height(headerHeight - 2); // subtract 2px for border-width (top and bottom) @@ -12203,7 +13307,7 @@ var RsideFrame = Frame.extend(/**@lends module:view/layout/frame-rside.prototype // casues to be stuck in the same position in Chrome) if (dimensionModel.get('scrollX')) { $scrollCorner = $('
') - .addClass('scrollbar_corner') + .addClass(classNameConst.SCROLLBAR_RIGHT_BOTTOM) .css('bottom', dimensionModel.get('toolbarHeight')); this.$el.append($scrollCorner); } @@ -12215,7 +13319,7 @@ var RsideFrame = Frame.extend(/**@lends module:view/layout/frame-rside.prototype module.exports = RsideFrame; -},{"../../common/constMap":8,"./frame":46}],46:[function(require,module,exports){ +},{"../../common/classNameConst":8,"../../common/constMap":9,"./frame":54}],54:[function(require,module,exports){ /** * @fileoverview Frame Base * @author NHN Ent. FE Development Team @@ -12245,14 +13349,10 @@ var Frame = View.extend(/**@lends module:view/layout/frame.prototype */{ whichSide: options.whichSide || 'R' }); - this.listenTo(this.renderModel, 'columnModelChanged', this.render, this) - .listenTo(this.dimensionModel, 'columnWidthChanged', this._onColumnWidthChanged, this); + this.listenTo(this.renderModel, 'columnModelChanged', this.render) + .listenTo(this.dimensionModel, 'columnWidthChanged', this._onColumnWidthChanged); }, - tagName: 'div', - - className: 'lside_area', - /** * Render * @returns {module:view/layout/frame} This object @@ -12296,7 +13396,7 @@ var Frame = View.extend(/**@lends module:view/layout/frame.prototype */{ module.exports = Frame; -},{"../../base/view":7}],47:[function(require,module,exports){ +},{"../../base/view":7}],55:[function(require,module,exports){ /** * @fileoverview Header 관련 * @author NHN Ent. FE Development Team @@ -12305,10 +13405,13 @@ module.exports = Frame; var View = require('../../base/view'); var util = require('../../common/util'); +var constMap = require('../../common/constMap'); +var classNameConst = require('../../common/classNameConst'); -var CLASSNAME_SELECTED = 'selected'; var DELAY_SYNC_CHECK = 10; -var ATTR_COLUMN_NAME = require('../../common/constMap').attrName.COLUMN_NAME; +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; /** * Header 레이아웃 View @@ -12344,9 +13447,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ .listenTo(this.dataModel, 'sortChanged', this._updateBtnSortState); }, - tagName: 'div', - - className: 'header', + className: classNameConst.HEAD_AREA, events: { 'click': '_onClick', @@ -12357,7 +13458,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ * 전체 template */ template: _.template( - '' + + '
' + '<%=colGroup%>' + '<%=tBody%>' + '
' @@ -12393,7 +13494,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ /** * 정렬 버튼을 위한 HTML 마크업 */ - markupBtnSort: '', + markupBtnSort: '', /** * col group 마크업을 생성한다. @@ -12410,7 +13511,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ htmlList.push(this.templateCol({ attrColumnName: ATTR_COLUMN_NAME, columnName: columnModelList[index].columnName, - width: width + width: width + CELL_BORDER_WIDTH })); }, this); return htmlList.join(''); @@ -12461,11 +13562,11 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ columnNames = [this.focusModel.get('columnName')]; } - $ths.removeClass(CLASSNAME_SELECTED); + $ths.removeClass(classNameConst.CELL_SELECTED); if (columnNames) { mergedColumnNames = this._getContainingMergedColumnNames(columnNames); _.each(columnNames.concat(mergedColumnNames), function(columnName) { - $ths.filter('[' + ATTR_COLUMN_NAME + '=' + columnName + ']').addClass(CLASSNAME_SELECTED); + $ths.filter('[' + ATTR_COLUMN_NAME + '=' + columnName + ']').addClass(classNameConst.CELL_SELECTED); }); } }, @@ -12478,7 +13579,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ _onMouseDown: function(event) { var columnName, columnNames; - if (!this.selectionModel.isEnabled() || $(event.target).is('a.btn_sorting')) { + if (!this.selectionModel.isEnabled() || $(event.target).is('a.' + classNameConst.BTN_SORT)) { return; } @@ -12675,7 +13776,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ $colList = this.$el.find('col'); _.each(columnWidthList, function(columnWidth, index) { - $colList.eq(index).css('width', columnWidth + 'px'); + $colList.eq(index).css('width', columnWidth + CELL_BORDER_WIDTH); }); }, @@ -12701,14 +13802,13 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ var $target = $(clickEvent.target), columnName = $target.closest('th').attr(ATTR_COLUMN_NAME); - /* istanbul ignore else */ if (columnName === '_button' && $target.is('input')) { if ($target.prop('checked')) { this.dataModel.checkAll(); } else { this.dataModel.uncheckAll(); } - } else if ($target.is('a.btn_sorting')) { + } else if ($target.is('a.' + classNameConst.BTN_SORT)) { this.dataModel.sortByField(columnName); } }, @@ -12722,12 +13822,14 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ */ _updateBtnSortState: function(sortOptions) { if (this._$currentSortBtn) { - this._$currentSortBtn.removeClass('sorting_down sorting_up'); + this._$currentSortBtn.removeClass(classNameConst.BTN_SORT_DOWN + ' ' + classNameConst.BTN_SORT_UP); } this._$currentSortBtn = this.$el.find( - 'th[' + ATTR_COLUMN_NAME + '=' + sortOptions.columnName + '] a.btn_sorting' + 'th[' + ATTR_COLUMN_NAME + '=' + sortOptions.columnName + '] a.' + classNameConst.BTN_SORT + ); + this._$currentSortBtn.addClass(sortOptions.isAscending ? + classNameConst.BTN_SORT_UP : classNameConst.BTN_SORT_DOWN ); - this._$currentSortBtn.addClass(sortOptions.isAscending ? 'sorting_up' : 'sorting_down'); }, /** @@ -12738,11 +13840,11 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ this._destroyChildren(); if (this.whichSide === 'R' && !this.dimensionModel.get('scrollY')) { - this.$el.addClass('no_scroll'); + this.$el.addClass(classNameConst.NO_SCROLL_Y); } this.$el.css({ - height: this.dimensionModel.get('headerHeight') + height: this.dimensionModel.get('headerHeight') - TABLE_BORDER_WIDTH }).html(this.template({ colGroup: this._getColGroupMarkup(), tBody: this._getTableBodyMarkup() @@ -12793,6 +13895,14 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ curHeight = 0; _.each(hierarchy, function(columnModel, j) { var columnName = columnModel.columnName; + var classNames = [ + classNameConst.CELL, + classNameConst.CELL_HEAD + ]; + + if (columnModel.isRequired) { + classNames.push(classNameConst.CELL_REQRUIRED); + } rowSpan = (length - 1 === j && (maxRowCount - length + 1) > 1) ? (maxRowCount - length + 1) : 1; height = rowHeight * rowSpan; @@ -12813,7 +13923,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ rowMarkupList[j].push(this.templateHeader({ attrColumnName: ATTR_COLUMN_NAME, columnName: columnName, - className: columnModel.isRequired ? 'required' : '', + className: classNames.join(' '), height: height, colspan: colSpanList[j], rowspan: rowSpan, @@ -12888,7 +13998,7 @@ var Header = View.extend(/**@lends module:view/layout/header.prototype */{ module.exports = Header; -},{"../../base/view":7,"../../common/constMap":8,"../../common/util":11}],48:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9,"../../common/util":12}],56:[function(require,module,exports){ /** * @fileoverview ResizeHandler for the Header * @author NHN Ent. FE Development Team @@ -12896,7 +14006,9 @@ module.exports = Header; 'use strict'; var View = require('../../base/view'); -var ATTR_COLUMN_NAME = require('../../common/constMap').attrName.COLUMN_NAME; +var attrNameConst = require('../../common/constMap').attrName; +var classNameConst = require('../../common/classNameConst'); +var CELL_BORDER_WIDTH = require('../../common/constMap').dimension.CELL_BORDER_WIDTH; /** * Reside Handler class @@ -12921,28 +14033,30 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto initialOffsetLeft: 0, initialLeft: 0 }); + this.listenTo(this.dimensionModel, 'change:which columnWidthChanged', this._refreshHandlerPosition); }, - tagName: 'div', + className: classNameConst.COLUMN_RESIZE_CONTAINER, - className: 'resize_handle_container', + events: function() { + var eventHash = {}; - events: { - 'mousedown .resize_handle': '_onMouseDown', - 'dblclick .resize_handle': '_onDblClick' + eventHash['mousedown .' + classNameConst.COLUMN_RESIZE_HANDLE] = '_onMouseDown'; + eventHash['dblclick .' + classNameConst.COLUMN_RESIZE_HANDLE] = '_onDblClick'; + + return eventHash; }, template: _.template( - '
="<%=columnName%>" ' + - 'class="resize_handle' + - '<% if(isLast === true) ' + - ' print(" resize_handle_last");%>' + - '" ' + + '
' + - '
'), + '
' + ), /** * Return an object that contains an array of column width and an array of column model. @@ -12950,10 +14064,10 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto * @private */ _getColumnData: function() { - var columnModel = this.columnModel, - dimensionModel = this.dimensionModel, - columnWidthList = dimensionModel.getColumnWidthList(this.whichSide), - columnModelList = columnModel.getVisibleColumnModelList(this.whichSide, true); + var columnModel = this.columnModel; + var dimensionModel = this.dimensionModel; + var columnWidthList = dimensionModel.getColumnWidthList(this.whichSide); + var columnModelList = columnModel.getVisibleColumnModelList(this.whichSide, true); return { widthList: columnWidthList, @@ -12967,21 +14081,19 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto * @private */ _getResizeHandlerMarkup: function() { - var columnData = this._getColumnData(), - columnModelList = columnData.modelList, - headerHeight = this.dimensionModel.get('headerHeight'), - length = columnModelList.length, - resizeHandleMarkupList; - - resizeHandleMarkupList = _.map(columnModelList, function(columnModel, index) { + var columnData = this._getColumnData(); + var columnModelList = columnData.modelList; + var headerHeight = this.dimensionModel.get('headerHeight'); + var length = columnModelList.length; + var resizeHandleMarkupList = _.map(columnModelList, function(columnModel, index) { return this.template({ - attrColumnName: ATTR_COLUMN_NAME, + lastClass: (index + 1 === length) ? classNameConst.COLUMN_RESIZE_HANDLE_LAST : '', columnIndex: index, columnName: columnModel.columnName, - isLast: index + 1 === length, height: headerHeight }); }, this); + return resizeHandleMarkupList.join(''); }, @@ -13007,29 +14119,17 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto * @private */ _refreshHandlerPosition: function() { - var columnData = this._getColumnData(), - columnWidthList = columnData.widthList, - $resizeHandleList = this.$el.find('.resize_handle'), - $table = this.$el.parent().find('table:first'), - isChanged = false, - $handler, - columnName, - curPos = 0, - BORDER_WIDTH = 1, - HANDLER_WIDTH_HALF = 3, - width; + var columnData = this._getColumnData(); + var columnWidthList = columnData.widthList; + var $resizeHandleList = this.$el.find('.' + classNameConst.COLUMN_RESIZE_HANDLE); + var curPos = 0; tui.util.forEachArray($resizeHandleList, function(item, index) { - $handler = $resizeHandleList.eq(index); - columnName = $handler.attr(ATTR_COLUMN_NAME); - width = $table.find('th[' + ATTR_COLUMN_NAME + '=' + columnName + ']').width(); - if (tui.util.isExisty(width)) { - isChanged = isChanged || (width !== columnWidthList[index]); - } else { - width = columnWidthList[index]; - } - curPos += width + BORDER_WIDTH; - $handler.css('left', curPos - HANDLER_WIDTH_HALF); + var $handler = $resizeHandleList.eq(index); + var handlerWidthHalf = Math.ceil($handler.width() / 2); + + curPos += columnWidthList[index] + CELL_BORDER_WIDTH; + $handler.css('left', curPos - handlerWidthHalf); }); }, @@ -13048,7 +14148,7 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto * @private */ _onMouseDown: function(mouseEvent) { - this._startResizing(mouseEvent); + this._startResizing($(mouseEvent.target)); }, /** @@ -13057,8 +14157,8 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto * @private */ _onDblClick: function(mouseEvent) { - var $target = $(mouseEvent.target), - index = parseInt($target.attr('columnindex'), 10); + var $target = $(mouseEvent.target); + var index = parseInt($target.attr(attrNameConst.COLUMN_INDEX), 10); this.dimensionModel.restoreColumnWidth(this._getHandlerColumnIndex(index)); this._refreshHandlerPosition(); @@ -13080,15 +14180,14 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto _onMouseMove: function(mouseEvent) { var left, width, index; - /* istanbul ignore else */ if (this._isResizing()) { mouseEvent.preventDefault(); left = mouseEvent.pageX - this.initialOffsetLeft; width = this._calculateWidth(mouseEvent.pageX); - index = parseInt(this.$target.attr('columnindex'), 10); + index = parseInt(this.$target.attr(attrNameConst.COLUMN_INDEX), 10); - this.$target.css('left', left + 'px'); + this.$target.css('left', left); this.dimensionModel.setColumnWidth(this._getHandlerColumnIndex(index), width); this._refreshHandlerPosition(); } @@ -13117,19 +14216,18 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto /** * Start resizing - * @param {event} mouseDownEvent - mouse event + * @param {jQuery} $target - target element * @private */ - _startResizing: function(mouseDownEvent) { - var columnData = this._getColumnData(), - columnWidthList = columnData.widthList, - $target = $(mouseDownEvent.target); + _startResizing: function($target) { + var columnData = this._getColumnData(); + var columnWidthList = columnData.widthList; this.isResizing = true; this.$target = $target; this.initialLeft = parseInt($target.css('left').replace('px', ''), 10); this.initialOffsetLeft = this.$el.offset().left; - this.initialWidth = columnWidthList[$target.attr('columnindex')]; + this.initialWidth = columnWidthList[$target.attr(attrNameConst.COLUMN_INDEX)]; $('body').css('cursor', 'col-resize'); $(document) .bind('mousemove', $.proxy(this._onMouseMove, this)) @@ -13175,7 +14273,7 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/resizeHandler.proto module.exports = ResizeHandler; -},{"../../base/view":7,"../../common/constMap":8}],49:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8,"../../common/constMap":9}],57:[function(require,module,exports){ /** * @fileoverview 툴바영역 클래스 * @author NHN Ent. FE Development Team @@ -13183,6 +14281,7 @@ module.exports = ResizeHandler; 'use strict'; var View = require('../../base/view'); +var classNameConst = require('../../common/classNameConst'); /** * 툴바 영역 @@ -13202,9 +14301,7 @@ var Toolbar = View.extend(/**@lends module:view/layout/toolbar.prototype */{ this.viewFactory = options.viewFactory; }, - tagName: 'div', - - className: 'toolbar', + className: classNameConst.TOOLBAR, /** * 랜더링한다. @@ -13247,7 +14344,7 @@ var Toolbar = View.extend(/**@lends module:view/layout/toolbar.prototype */{ module.exports = Toolbar; -},{"../../base/view":7}],50:[function(require,module,exports){ +},{"../../base/view":7,"../../common/classNameConst":8}],58:[function(require,module,exports){ /** * @fileoverview Class for the control panel in the toolbar * @author NHN Ent. FE Development Team @@ -13255,6 +14352,7 @@ module.exports = Toolbar; 'use strict'; var View = require('../../../base/view'); +var classNameConst = require('../../../common/classNameConst'); /** * Class for the control panel in the toolbar @@ -13278,17 +14376,17 @@ var ControlPanel = View.extend(/**@lends module:view/layout/toolbar/controlPanel 'change:isExcelButtonVisible change:isExcelAllButtonVisible', this.render); }, - events: { - 'click a.excel_download_button': '_onClickExcel' + events: function() { + var hash = {}; + hash['click .' + classNameConst.BTN_EXCEL] = '_onClickExcel'; + return hash; }, - tagName: 'div', - - className: 'btn_setup', + className: classNameConst.TOOLBAR_BTN_HOLDER, templateExcelBtn: _.template( - '' + - '<%=text%>' + + '' + + '<%=text%>' + '' ), @@ -13298,18 +14396,18 @@ var ControlPanel = View.extend(/**@lends module:view/layout/toolbar/controlPanel * @private */ _onClickExcel: function(mouseEvent) { - var grid = tui.Grid.getInstanceById(this.gridId), - net = grid.getAddOn('Net'), - $target; + var grid = tui.Grid.getInstanceById(this.gridId); + var net = grid.getAddOn('Net'); + var $target; mouseEvent.preventDefault(); if (net) { $target = $(mouseEvent.target).closest('a'); - if ($target.hasClass('excel_page')) { + if ($target.hasClass(classNameConst.BTN_EXCEL_PAGE)) { net.download('excel'); - } else if ($target.hasClass('excel_all')) { + } else if ($target.hasClass(classNameConst.BTN_EXCEL_ALL)) { net.download('excelAll'); } } @@ -13326,13 +14424,13 @@ var ControlPanel = View.extend(/**@lends module:view/layout/toolbar/controlPanel if (toolbarModel.get('isExcelButtonVisible')) { this.$el.append(this.templateExcelBtn({ - className: 'excel_page', + className: classNameConst.BTN_EXCEL_PAGE, text: '엑셀 다운로드' })); } if (toolbarModel.get('isExcelAllButtonVisible')) { this.$el.append(this.templateExcelBtn({ - className: 'excel_all', + className: classNameConst.BTN_EXCEL_ALL, text: '전체 엑셀 다운로드' })); } @@ -13342,7 +14440,7 @@ var ControlPanel = View.extend(/**@lends module:view/layout/toolbar/controlPanel module.exports = ControlPanel; -},{"../../../base/view":7}],51:[function(require,module,exports){ +},{"../../../base/view":7,"../../../common/classNameConst":8}],59:[function(require,module,exports){ /** * @fileoverview Class for the pagination in the toolbar * @author NHN Ent. FE Development Team @@ -13350,6 +14448,7 @@ module.exports = ControlPanel; 'use strict'; var View = require('../../../base/view'); +var classNameConst = require('../../../common/classNameConst'); /** * Class for the pagination in the toolbar @@ -13365,19 +14464,17 @@ var Pagination = View.extend(/**@lends module:view/layout/toolbar/pagination.pro this.toolbarModel = options.toolbarModel; }, - tagName: 'div', - - className: 'grid_pagination', + className: classNameConst.PAGINATION, - template: _.template( - 'First' + - 'Prev ' + - '' + - 'Last' + - 'First Off' + - 'Prev Off' + - 'Next Off' + - 'Last Off' + htmlString: ( + 'First' + + 'Prev ' + + 'Next' + + 'Last' + + 'First Off' + + 'Prev Off' + + 'Next Off' + + 'Last Off' ), /** @@ -13386,8 +14483,9 @@ var Pagination = View.extend(/**@lends module:view/layout/toolbar/pagination.pro */ render: function() { this._destroyChildren(); - this.$el.empty().html(this.template()); + this.$el.empty().html(this.htmlString); this._setPaginationInstance(); + return this; }, @@ -13401,15 +14499,16 @@ var Pagination = View.extend(/**@lends module:view/layout/toolbar/pagination.pro if (!pagination && PaginationClass) { pagination = new PaginationClass({ + classPrefix: classNameConst.PREFIX, itemCount: 1, itemPerPage: 1, pagePerPageList: 5, isCenterAlign: true, moveUnit: 'page', - $preOff: this.$el.find('.pre_off'), - $pre_endOff: this.$el.find('.pre_end_off'), // eslint-disable-line camelcase - $nextOff: this.$el.find('.next_off'), - $lastOff: this.$el.find('.next_end_off') + $preOff: this.$el.find('.' + classNameConst.PAGINATION_PRE_OFF), + $pre_endOff: this.$el.find('.' + classNameConst.PAGINATION_PRE_END_OFF), // eslint-disable-line + $nextOff: this.$el.find('.' + classNameConst.PAGINATION_NEXT_OFF), + $lastOff: this.$el.find('.' + classNameConst.PAGINATION_NEXT_END_OFF) }, this.$el); } this.toolbarModel.set('pagination', pagination); @@ -13418,7 +14517,7 @@ var Pagination = View.extend(/**@lends module:view/layout/toolbar/pagination.pro module.exports = Pagination; -},{"../../../base/view":7}],52:[function(require,module,exports){ +},{"../../../base/view":7,"../../../common/classNameConst":8}],60:[function(require,module,exports){ /** * @fileoverview Class for the resize handler of the toolbar * @author NHN Ent. FE Development Team @@ -13426,6 +14525,7 @@ module.exports = Pagination; 'use strict'; var View = require('../../../base/view'); +var classNameConst = require('../../../common/classNameConst'); /** * Class for the resize handler of the toolbar @@ -13442,11 +14542,9 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/toolbar/resizeHandl this.timeoutIdForResize = 0; }, - tagName: 'div', + className: classNameConst.HEIGHT_RESIZE_BAR, - className: 'height_resize_bar', - - template: _.template(''), + htmlString: '', events: { 'mousedown': '_onMouseDown' @@ -13534,7 +14632,8 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/toolbar/resizeHandl */ render: function() { this._destroyChildren(); - this.$el.html(this.template()); + this.$el.html(this.htmlString); + return this; }, @@ -13551,7 +14650,7 @@ var ResizeHandler = View.extend(/**@lends module:view/layout/toolbar/resizeHandl module.exports = ResizeHandler; -},{"../../../base/view":7}],53:[function(require,module,exports){ +},{"../../../base/view":7,"../../../common/classNameConst":8}],61:[function(require,module,exports){ /** * @fileoverview RowList View * @author NHN Ent. FE Development Team @@ -13560,11 +14659,8 @@ module.exports = ResizeHandler; var View = require('../base/view'); var util = require('../common/util'); -var attrNameMap = require('../common/constMap').attrName; - -var CLASSNAME_SELECTED = 'selected'; -var CLASSNAME_FOCUSED_ROW = 'focused_row'; -var SELECTOR_META_CELL = 'td.meta_column'; +var attrNameConst = require('../common/constMap').attrName; +var classNameConst = require('../common/classNameConst'); /** * RowList View @@ -13692,7 +14788,7 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ * @private */ _getRowElement: function(rowKey) { - return this.$el.find('tr[' + attrNameMap.ROW_KEY + '=' + rowKey + ']'); + return this.$el.find('tr[' + attrNameConst.ROW_KEY + '=' + rowKey + ']'); }, /** @@ -13700,8 +14796,9 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ * @private */ _refreshSelectedMetaColumns: function() { - var $rows = this.$el.find('tr'), - $filteredRows; + var $rows = this.$el.find('tr'); + var metaSelector = '.' + classNameConst.CELL_HEAD; + var $filteredRows; if (this.selectionModel.hasSelection()) { $filteredRows = this._filterRowsByIndexRange($rows, this.selectionModel.get('range').row); @@ -13709,8 +14806,8 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ $filteredRows = this._filterRowByKey($rows, this.focusModel.get('rowKey')); } - $rows.find(SELECTOR_META_CELL).removeClass(CLASSNAME_SELECTED); - $filteredRows.find(SELECTOR_META_CELL).addClass(CLASSNAME_SELECTED); + $rows.find(metaSelector).removeClass(classNameConst.CELL_SELECTED); + $filteredRows.find(metaSelector).addClass(classNameConst.CELL_SELECTED); }, /** @@ -13752,20 +14849,20 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ }, /** - * Removes the CLASSNAME_FOCUSED_ROW class from the cells in the previously focused row and + * Removes the CURRENT_ROW class from the cells in the previously focused row and * adds it to the cells in the currently focused row. * @private */ _refreshFocusedRow: function() { - var rowKey = this.focusModel.get('rowKey'), - prevRowKey = this.focusModel.get('prevRowKey'); + var rowKey = this.focusModel.get('rowKey'); + var prevRowKey = this.focusModel.get('prevRowKey'); this._setFocusedRowClass(prevRowKey, false); this._setFocusedRowClass(rowKey, true); }, /** - * Finds all cells in the row indentified by given rowKey and toggles the CLASSNAME_FOCUSED_ROW on them. + * Finds all cells in the row indentified by given rowKey and toggles the CURRENT_ROW on them. * @param {Number|String} rowKey - rowKey * @param {Boolean} focused - if set to true, the class will be added, otherwise be removed. * @private @@ -13781,8 +14878,8 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ if (!trMap[mainRowKey]) { trMap[mainRowKey] = this._getRowElement(mainRowKey); } - $td = trMap[mainRowKey].find('td[' + attrNameMap.COLUMN_NAME + '=' + columnName + ']'); - $td.toggleClass(CLASSNAME_FOCUSED_ROW, focused); + $td = trMap[mainRowKey].find('td[' + attrNameConst.COLUMN_NAME + '=' + columnName + ']'); + $td.toggleClass(classNameConst.CELL_CURRENT_ROW, focused); }, this); }, @@ -13849,7 +14946,7 @@ var RowList = View.extend(/**@lends module:view/rowList.prototype */{ module.exports = RowList; -},{"../base/view":7,"../common/constMap":8,"../common/util":11}],54:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],62:[function(require,module,exports){ /** * @fileoverview Class for the selection layer * @author NHN Ent. FE Development Team @@ -13858,6 +14955,7 @@ module.exports = RowList; var View = require('../base/view'); var util = require('../common/util'); +var classNameConst = require('../common/classNameConst'); var CELL_BORDER_WIDTH = require('../common/constMap').dimension.CELL_BORDER_WIDTH; /** @@ -13884,9 +14982,7 @@ var SelectionLayer = View.extend(/**@lends module:view/selectionLayer.prototype this.listenTo(this.selectionModel, 'change:range', this.render); }, - tagName: 'div', - - className: 'selection_layer', + className: classNameConst.LAYER_SELECTION, /** * Updates this.columnWidthList @@ -14012,7 +15108,7 @@ var SelectionLayer = View.extend(/**@lends module:view/selectionLayer.prototype module.exports = SelectionLayer; -},{"../base/view":7,"../common/constMap":8,"../common/util":11}],55:[function(require,module,exports){ +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9,"../common/util":12}],63:[function(require,module,exports){ /** * @fileoverview Layer class that represents the state of rendering phase * @author NHN Ent. FE Development Team @@ -14020,7 +15116,8 @@ module.exports = SelectionLayer; 'use strict'; var View = require('../base/view'); -var renderStateMap = require('../common/constMap').renderState; +var stateConst = require('../common/constMap').renderState; +var classNameConst = require('../common/classNameConst'); /** * Layer class that represents the state of rendering phase. @@ -14041,13 +15138,13 @@ var StateLayer = View.extend(/**@lends module:view/stateLayer.prototype */{ this.listenTo(this.renderModel, 'change:state', this.render); }, - className: 'state_layer', + className: classNameConst.LAYER_STATE, template: _.template( - '
' + + '
' + ' <%= text %>' + ' <% if (isLoading) { %>' + - '
' + + '
' + ' <% } %>' + '
' ), @@ -14059,7 +15156,7 @@ var StateLayer = View.extend(/**@lends module:view/stateLayer.prototype */{ render: function() { var renderState = this.renderModel.get('state'); - if (renderState === renderStateMap.DONE) { + if (renderState === stateConst.DONE) { this.$el.hide(); } else { this._showLayer(renderState); @@ -14076,7 +15173,7 @@ var StateLayer = View.extend(/**@lends module:view/stateLayer.prototype */{ _showLayer: function(renderState) { var layerHtml = this.template({ text: this._getMessage(renderState), - isLoading: (renderState === renderStateMap.LOADING) + isLoading: (renderState === stateConst.LOADING) }); this.$el.html(layerHtml).show(); @@ -14090,9 +15187,9 @@ var StateLayer = View.extend(/**@lends module:view/stateLayer.prototype */{ */ _getMessage: function(renderState) { switch (renderState) { - case renderStateMap.LOADING: + case stateConst.LOADING: return '요청을 처리 중입니다.'; - case renderStateMap.EMPTY: + case stateConst.EMPTY: return (this.renderModel.get('emptyMessage') || '데이터가 존재하지 않습니다.'); default: return null; @@ -14115,4 +15212,4 @@ var StateLayer = View.extend(/**@lends module:view/stateLayer.prototype */{ module.exports = StateLayer; -},{"../base/view":7,"../common/constMap":8}]},{},[13]); +},{"../base/view":7,"../common/classNameConst":8,"../common/constMap":9}]},{},[14]); diff --git a/samples/js/grid.min.js b/samples/js/grid.min.js index 5b1ae45b2..e6af61c85 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.0-c + * @version 1.2.1 * @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":8,"../common/formUtil":9,"../common/gridEvent":10,"../common/util":11,"./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":8}],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={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",EDIT_TYPE:"data-edit-type"}}},{}],9:[function(t,e,i){"use strict";var n={setInput:{_changeToStringInArray:function(t){return _.each(t,function(e,i){t[i]=String(e)}),t},radio:function(t,e){t.checked=t.value===e},checkbox:function(t,e){_.isArray(e)?t.checked=-1!==$.inArray(t.value,this._changeToStringInArray(e)):t.checked=t.value===e},"select-one":function(t,e){var i=tui.util.toArray(t.options);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},{}],10:[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},{}],11:[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}};e.exports=o},{"./constMap":8}],12:[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":8}],13:[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"),h=t("./common/util"),c={};tui=window.tui=tui||{},tui.Grid=n.extend({initialize:function(t){var e=new a(this.$el);this.id=h.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(),this.addOn={},c[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 c[t]}},{"./addon/net":2,"./base/view":7,"./common/util":11,"./domState":12,"./model/manager":20,"./painter/controller":28,"./painter/manager":35,"./publicEventEmitter":37,"./view/factory":41}],14:[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":16}],18:[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}),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},getCellPosition:function(t,e){var i,n,s,a,r,u,d,h,c=this.dataModel,m=this.columnModel,g=this.get("rowHeight"),f=c.get(t),p=m.getVisibleMetaColumnCount(),_=this.get("columnWidthList").slice(p),M=m.getVisibleColumnFixCount(),w=m.indexOfColumnName(e,!0);if(!f)return{};for(i=c.get(t).getRowSpanData(e),i.isMainRow||(t=i.mainRowKey,i=c.get(t).getRowSpanData(e)),s=i.count||1,n=c.indexOfRowKey(t),a=o.getHeight(n,g),d=a+o.getHeight(s,g)-l,r=h=0,w>=M&&(h=M);w>h;h+=1)r+=_[h]+l;return u=r+_[h]+l,{top:a,left:r,right:u,bottom:d}},getScrollPosition:function(t,e){var i=!this.columnModel.isLside(e),n=this.getCellPosition(t,e),o=this._getBodySize(),s=this._judgeScrollDirection(n,i,o);return this._makeScrollPosition(s,n,o)},_getBodySize:function(){var t=this.get("lsideWidth"),e=this.get("rsideWidth")-this.getScrollYWidth(),i=this.get("bodyHeight")-this.getScrollXHeight();return{height:i,rsideWidth:e,totalWidth:t+e}},_judgeScrollDirection:function(t,e,i){var n,o,s,a,l=this.renderModel,r=l.get("scrollTop"),u=l.get("scrollLeft");return n=t.topr+i.height,e?(s=t.leftu+i.rsideWidth-1):s=a=!1,{isUp:n,isDown:o,isLeft:s,isRight:a}},_makeScrollPosition:function(t,e,i){var n={};return t.isUp?n.scrollTop=e.top:t.isDown&&(n.scrollTop=e.bottom-i.height),t.isLeft?n.scrollLeft=e.left:t.isRight&&(n.scrollLeft=e.right-i.rsideWidth+a),n},getOverflowFromMousePosition:function(t,e){var i=this._rebasePositionToContainer(t,e),n=this._getBodySize();return this._judgeOverflow(i,n)},_judgeOverflow:function(t,e){var i=t.x,n=t.y,o=0,s=0;return 0>n?o=-1:n>e.height&&(o=1),0>i?s=-1:i>e.totalWidth&&(s=1),{x:s,y:o}},getIndexFromMousePosition:function(t,e,i){var n=this._rebasePositionToContainer(t,e);return{row:this._calcRowIndexFromPositionY(n.y),column:this._calcColumnIndexFromPositionX(n.x,i)}},_calcRowIndexFromPositionY:function(t){var e=t+this.renderModel.get("scrollTop"),i=Math.floor(e/(this.get("rowHeight")+l)),n=0,s=Math.max(n,this.dataModel.length-1);return o.clamp(i,n,s)},_calcColumnIndexFromPositionX:function(t,e){var i=this.getColumnWidthList(),n=this.getFrameWidth(),o=t,s=t>=this.get("lsideWidth"),a=e?0:this.columnModel.getVisibleMetaColumnCount(),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":8,"../common/util":11}],19:[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){return!this.get("editingAddress")&&this.isCurrentCell(t,e,!0)&&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":10,"../common/util":11}],20:[function(t,e,i){"use strict";var n=t("./data/columnModel"),o=t("./data/rowList"),s=t("./toolbar"),a=t("./dimension"),l=t("./focus"),r=t("./renderer"),u=t("./renderer-smart"),d=t("./selection"),h={columnFixCount:0,columnModelList:[],keyColumnName:null,selectType:"",autoNumbering:!0,headerHeight:35,rowHeight:27,fitToParentHeight:!1,showDummyRows:!1,displayRowCount:10,minimumColumnWidth:50,notUseSmartRendering:!1,columnMerge:[],scrollX:!0,scrollY:!0,useClientSort:!0,singleClickEdit:!1,toolbar:{hasResizeHandler:!0,hasControlPanel:!0,hasPagination:!0}},c=tui.util.defineClass({init:function(t,e){t=$.extend(!0,{},h,t),this.gridId=t.gridId,this.columnModel=this._createColumnModel(t),this.dataModel=this._createDataModel(t,e),this.toolbarModel=this._createToolbarModel(t),this.dimensionModel=this._createDimensionModel(t,e),this.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=c},{"./data/columnModel":14,"./data/rowList":17,"./dimension":18,"./focus":19,"./renderer":22,"./renderer-smart":21,"./selection":25,"./toolbar":26}],21:[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)},_onFocusOrBlur:function(t,e){var i=this.dataModel.getMainRowKey(t,e),n=this._getRowModel(i,e);n&&n.updateClassName(e)},_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,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+=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");_.times(i,function(){_.each(["lside","rside"],function(t){this.get(t).add({height:n})},this)},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":8,"./rowList":24}],23:[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;return _.isUndefined(a)?t:(s=e.get(a),o=_.omit(t,"rowKey","_extraData","height"),_.each(o,function(o,l){var r=this._getRowSpanData(l,t,e.isRowSpanEnable()),u=s.getCellState(l),d=i.isTextType(l),h=i.getColumnModel(l);t[l]={rowKey:a,columnName:l,rowSpan:r.count,isMainRow:r.isMainRow,mainRowKey:r.mainRowKey,isEditable:u.isEditable,isDisabled:u.isDisabled,isEditing:n.isEditingCell(a,l),isFocused:n.isCurrentCell(a,l),optionList:tui.util.pick(h,"editOption","list"),className:this._getClassNameString(l,s,n),columnModel:h,changed:[]},_.assign(t[l],this._getValueAttrs(o,s,h,d))},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),i.isCurrentCell(e.get("rowKey"),t,!0)&&n.push("focused"),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":11}],24:[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":23}],25:[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]),h=$.extend({},t);return u&&d?(e=a.at(t.row[0]).getRowSpanData(),i=a.at(t.row[1]).getRowSpanData(),_.each(s,function(s){n=s.columnName,o={columnName:n,startIndex:t.row[0],endIndex:t.row[1],endRowSpanDataMap:i,startRowSpanDataMap:e,startIndexList:l,endIndexList:r,dataModel:a},this._concatRowSpanIndexFromStart(o),this._concatRowSpanIndexFromEnd(o)},this),h.row=[Math.min.apply(null,l),Math.max.apply(null,r)],h):h}});e.exports=a},{"../base/model":5,"../common/util":11}],26:[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}],27:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").attrName,a=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,"before"),n=this._getSpanWrapContent(n,"after"),e=this._getSpanWrapContent(e,"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={"class":t.className+" cell_content",align:t.columnModel.align||"left"};return e[s.EDIT_TYPE]=this.editType,e[s.ROW_KEY]=t.rowKey,e[s.COLUMN_NAME]=t.columnName,t.rowSpan&&(e.rowspan=t.rowSpan),e},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=a},{"../base/painter":6,"../common/constMap":8,"../common/util":11}],28:[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},{}],29:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").attrName,a=tui.util.defineClass(n,{init:function(){n.apply(this,arguments)},events:{dblclick:"_onDblClick"},selector:"td["+s.EDIT_TYPE+"=dummy]",template:_.template('="<%=columnName%>" class="<%=className%>" <%=attrEditType%>="dummy">​'),_onDblClick:function(){this.controller.appendEmptyRowAndFocus(!0)},generateHtml:function(t){var e=o.isMetaColumn(t);return this.template({attrColumnName:s.COLUMN_NAME,attrEditType:s.EDIT_TYPE,columnName:t,className:(e?"meta_column ":"")+"dummy"})}});e.exports=a},{"../base/painter":6,"../common/constMap":8,"../common/util":11}],30:[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":8}],31:[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":11,"./base":30}],32:[function(t,e,i){"use strict";var n=t("../../base/painter"),o=tui.util.defineClass(n,{init:function(t){n.apply(this,arguments),this.selector="input.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=o},{"../../base/painter":6}],33:[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":11,"./base":30}],34:[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":11,"./base":30}],35:[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":27,"./dummyCell":29,"./input/button":31,"./input/mainButton":32,"./input/select":33,"./input/text":34,"./row":36}],36:[function(t,e,i){"use strict";var n=t("../base/painter"),o=t("../common/util"),s=t("../common/constMap").attrName,a=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){var e=this.painterManager.getCellPainter("dummy"),i="";return _.each(t,function(t){i+=e.generateHtml(t)}),i},_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");return i=_.isUndefined(n)?this._generateHtmlForDummyRow(e):this._generateHtmlForActualRow(t,e),this.template({rowKeyAttrName:s.ROW_KEY,rowKey:n,height:t.get("height")+a._extraHeight,contents:i,className:""})},refresh:function(t,e){_.each(t,function(t,i){var n,o,a;"_extraData"!==i&&(a=e.find("td["+s.COLUMN_NAME+"="+i+"]"),n=this._getEditType(i,t),o=this.painterManager.getCellPainter(n),o.refresh(t,a))},this)},"static":{_extraHeight:function(){var t=0;return o.isBrowserIE7()&&(t=-2),t}()}});e.exports=a},{"../base/painter":6,"../common/constMap":8,"../common/util":11}],37:[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},{}],38:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").keyCode,a=n.extend({initialize:function(t){this.setOwnProperties({focusModel:t.focusModel,selectionModel:t.selectionModel,painterManager:t.painterManager,dimensionModel:t.dimensionModel,dataModel:t.dataModel,columnModel:t.columnModel,renderModel:t.renderModel,timeoutIdForKeyIn:0,isLocked:!1}),this.listenTo(this.focusModel,"focusClipboard",this._onFocus)},tagName:"textarea",className:"clipboard",events:{keydown:"_onKeyDown",blur:"_onBlur"},_onBlur:function(){var t=this.focusModel;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"),h=t.keyCode||t.which,c=this._getIndexBeforeMove(),m=!0,g=!0;switch(h){case s.UP_ARROW:c.row-=1;break;case s.DOWN_ARROW:c.row+=1;break;case s.LEFT_ARROW:c.column-=1;break;case s.RIGHT_ARROW:c.column+=1;break;case s.PAGE_UP:c.row=a.prevRowIndex(d-1);break;case s.PAGE_DOWN:c.row=a.nextRowIndex(d-1);break;case s.HOME:c.column=0;break;case s.END:c.column=r.length-1;break;case s.ENTER:g=!1;break;case s.TAB:g=!1,a.focusIn(u.rowKey,a.prevColumnName(),!0);break;default:g=!1,m=!1}e=r[c.column],n=!(!e||!this.dataModel.getRowData(c.row)),g&&n&&(this._updateSelectionByKeyIn(c.row,c.column),i=l.getScrollPosition(c.row,e.columnName),i&&(o=this.selectionModel.getState(),"column"===o?delete i.scrollTop:"row"===o&&delete i.scrollLeft,this.renderModel.set(i))),m&&t.preventDefault()},_keyInWithCtrl:function(t){var e=this.focusModel,i=t.keyCode||t.which;switch(i){case s.CHAR_A:this.selectionModel.selectAll();break;case s.CHAR_C:this._copyToClipboard();break;case s.HOME:e.focus(e.firstRowKey(),e.firstColumnName(),!0);break;case s.END:e.focus(e.lastRowKey(),e.lastColumnName(),!0);break;case s.CHAR_V:this._paste()}},_paste:function(){this._clearClipBoard(),this.pasting||(this.pasting=!0,this._onKeyupCharV())},_onKeyupCharV:function(){this.$el.on("keyup",$.proxy(this.onKeyupCharV,this))},onKeyupCharV:function(){this._pasteToGrid(),this.pasting=!1},_clearClipBoard:function(){this.$el.val("")},_pasteToGrid:function(){var t,e,i=this.selectionModel,n=this.focusModel,o=this.dataModel;t=i.hasSelection()?i.getStartIndex():n.indexOf(),e=this._getProcessClipBoardData(),this.$el.off("keyup"),o.paste(e,t)},_getProcessClipBoardData:function(){for(var t=this.$el.val(),e=t.split("\n"),i=0,n=e.length;n>i;i+=1)e[i]=e[i].split(" ");return e},_keyInWithShiftAndCtrl:function(t){var e=!0,i=this.columnModel.getVisibleColumnModelList(),n=t.keyCode||t.which;switch(n){case s.HOME:this._updateSelectionByKeyIn(0,0);break;case s.END:this._updateSelectionByKeyIn(this.dataModel.length-1,i.length-1);break;default:e=!1}e&&t.preventDefault()},_del:function(){var t,e,i,n=this.selectionModel,o=this.dataModel,s=this.focusModel.which(),a=this.columnModel.getVisibleColumnModelList(),l=s.rowKey,r=s.columnName;if(n.hasSelection()){for(t=n.get("range"),e=t.row[0];e").addClass("left_line"),$("
").addClass("right_line")]);return this.$el.addClass("grid_wrapper uio_grid").attr("data-grid-id",this.gridId).append(t),this._appendBottomLine(),this._refreshHeight(),this.trigger("rendered"),this},_appendBottomLine:function(){var t=this.dimensionModel.get("toolbarHeight")+this.dimensionModel.getScrollXHeight();t&&this.$el.append($("
").addClass("data_bottom_line").css("bottom",t))},destroy:function(){this.stopListening(),$(window).off("resize.grid"),this._destroyChildren(),this.$el.replaceWith(this.__$el),this.$el=this.__$el=null}});e.exports=a},{"../base/view":7,"../common/constMap":8,"../common/gridEvent":10}],40:[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=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:"editing_layer 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)},_calculateLayoutStyle:function(t,e,i){var n=this.domState.getOffset(),s=this.domState.getElement(t,e),a=s.offset(),l=s.height(),r=s.width()-2*o;return{top:a.top-n.top,left: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=a},{"../base/view":7,"../common/constMap":8}],41:[function(t,e,i){"use strict";var n=t("./container"),o=t("./layout/toolbar"),s=t("./layout/toolbar/controlPanel"),a=t("./layout/toolbar/pagination"),l=t("./layout/toolbar/resizeHandler"),r=t("./stateLayer"),u=t("./clipboard"),d=t("./layout/frame-lside"),h=t("./layout/frame-rside"),c=t("./layout/header"),m=t("./layout/resizeHandler"),g=t("./layout/body"),f=t("./layout/bodyTable"),p=t("./rowList"),_=t("./selectionLayer"),M=t("./editingLayer"),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:h;return new e({dimensionModel:this.modelManager.dimensionModel,renderModel:this.modelManager.renderModel,viewFactory:this})},createHeader:function(t){return new c({whichSide:t,renderModel:this.modelManager.renderModel,dimensionModel:this.modelManager.dimensionModel,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 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 _({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})}});e.exports=w},{"./clipboard":38,"./container":39,"./editingLayer":40,"./layout/body":42,"./layout/bodyTable":43,"./layout/frame-lside":44,"./layout/frame-rside":45,"./layout/header":47,"./layout/resizeHandler":48,"./layout/toolbar":49,"./layout/toolbar/controlPanel":50,"./layout/toolbar/pagination":51,"./layout/toolbar/resizeHandler":52,"./rowList":53,"./selectionLayer":54,"./stateLayer":55}],42:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap").attrName,a='
',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)},tagName:"div",className:"data",events:{scroll:"_onScroll","mousedown .body_container":"_onMouseDown"},_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.selectionModel,i=t.pageX,n=t.pageY,o=this._getMouseMoveDistance(i,n)>r;(e.hasSelection()||o)&&e.updateByMousePosition(i,n)},_getMouseMoveDistance:function(t,e){var i=Math.abs(this.mouseDownX-t),n=Math.abs(this.mouseDownY-e);return Math.round(Math.sqrt(Math.pow(i,2)+Math.pow(n,2)))},_onSelectStart:function(t){return t.preventDefault(),!1},render:function(){var t=this.whichSide;return this._destroyChildren(),this.dimensionModel.get("scrollX")||this.$el.css("overflow-x","hidden"),this.dimensionModel.get("scrollY")||"R"!==t||this.$el.css("overflow-y","hidden"),this.$el.css("height",this.dimensionModel.get("bodyHeight")),this.$container=$(a),this.$el.append(this.$container),this._addChildren([this.viewFactory.createBodyTable(t),this.viewFactory.createSelectionLayer(t)]),this.$container.append(this._renderChildren()),this._resetContainerHeight(),this}});e.exports=u},{"../../base/view":7,"../../common/constMap":8,"../../common/util":11}],43:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s=t("../../common/constMap"),a=s.dimension.CELL_BORDER_WIDTH,l=s.attrName.COLUMN_NAME,r=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({dimensionModel:t.dimensionModel,renderModel:t.renderModel,columnModel:t.columnModel,viewFactory:t.viewFactory,painterManager:t.painterManager,whichSide:t.whichSide||"R"}),this.listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged),this.listenTo(this.renderModel,"change:dummyRowCount",this._resetOverflow),this.listenTo(this.dimensionModel,"change:bodyHeight",this._resetHeight),this._attachAllTableEventHandlers()},tagName:"div",className:"table_container",template:_.template('<%=colGroup%><%=tbody%>
'),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-r.EXTRA_WIDTH),i+=t+a},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:l,columnName:t.columnName,width:e[i]-r.EXTRA_WIDTH})},this),n}},{EXTRA_WIDTH:o.isBrowserIE7()?20:0});e.exports=r},{"../../base/view":7,"../../common/constMap":8,"../../common/util":11}],44:[function(t,e,i){"use strict";var n=t("./frame"),o=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"L"})},className:"lside_area",_onColumnWidthChanged:function(){this.$el.css({width:this.dimensionModel.get("lsideWidth")})},beforeRender:function(){this.$el.css({display:"block",width:this.dimensionModel.get("lsideWidth")})},afterRender:function(){var t,e=this.dimensionModel;e.get("scrollX")&&(t=$("
").addClass("scrollbar_overlay").css("bottom",e.get("toolbarHeight")),this.$el.append(t))}});e.exports=o},{"./frame":46}],45:[function(t,e,i){"use strict";var n=t("./frame"),o=t("../../common/constMap").dimension.CELL_BORDER_WIDTH,s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.setOwnProperties({whichSide:"R",$scrollBorder:null}),this.listenTo(this.dimensionModel,"change:bodyHeight change:headerHeight",this._resetScrollBorderHeight)},className:"rside_area",_onColumnWidthChanged:function(){this._refreshLayout()},_refreshLayout:function(){var t=this.dimensionModel,e=t.get("rsideWidth"),i=t.get("lsideWidth");i>0&&!t.isDivisionBorderDoubled()&&(e+=o,i-=o),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,o=this.dimensionModel;o.get("scrollY")&&(n=o.get("headerHeight"),t=$("
").addClass("header_space"),e=$("
").addClass("scrollbar_border"),t.height(n-2),e.css("top",n+"px"),this.$el.append(t,e),o.get("scrollX")&&(i=$("
").addClass("scrollbar_corner").css("bottom",o.get("toolbarHeight")),this.$el.append(i)),this.$scrollBorder=e,this._resetScrollBorderHeight())}});e.exports=s},{"../../common/constMap":8,"./frame":46}],46:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.setOwnProperties({viewFactory:t.viewFactory,renderModel:t.renderModel,dimensionModel:t.dimensionModel,whichSide:t.whichSide||"R"}),this.listenTo(this.renderModel,"columnModelChanged",this.render,this).listenTo(this.dimensionModel,"columnWidthChanged",this._onColumnWidthChanged,this)},tagName:"div",className:"lside_area",render:function(){var t=this.viewFactory;return this.$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}],47:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/util"),s="selected",a=10,l=t("../../common/constMap").attrName.COLUMN_NAME,r=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)},tagName:"div",className:"header",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:l,columnName:i[e].columnName,width:t}))},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(s),t&&(e=this._getContainingMergedColumnNames(t),_.each(t.concat(e),function(t){i.filter("["+l+"="+t+"]").addClass(s)}))},_onMouseDown:function(t){var e,i;this.selectionModel.isEnabled()&&!$(t.target).is("a.btn_sorting")&&(e=$(t.target).closest("th").attr(l),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(l);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),a))},_getHeaderMainCheckbox:function(){return this.$el.find("th["+l+"=_button] input")},_syncCheckState:function(){var t,e,i;this.columnModel&&"checkbox"===this.columnModel.get("selectType")&&(t=this._getHeaderMainCheckbox(),t.length&&(e=0,i=this.dataModel.getRowList(!0).length,this.dataModel.forEach(function(t){var i=t.getCellState("_button");!i.isDisabled&&i.isEditable&&(e+=1)},this),t.prop("checked",e===i)))},_onColumnWidthChanged:function(){var t=this._getColumnData(),e=t.widthList,i=this.$el.find("col");_.each(e,function(t,e){i.eq(e).css("width",t+"px")})},_onScrollLeftChange:function(t,e){"R"===this.whichSide&&(this.el.scrollLeft=e)},_onClick:function(t){var e=$(t.target),i=e.closest("th").attr(l);"_button"===i&&e.is("input")?e.prop("checked")?this.dataModel.checkAll():this.dataModel.uncheckAll():e.is("a.btn_sorting")&&this.dataModel.sortByField(i)},_updateBtnSortState:function(t){this._$currentSortBtn&&this._$currentSortBtn.removeClass("sorting_down sorting_up"),this._$currentSortBtn=this.$el.find("th["+l+"="+t.columnName+"] a.btn_sorting"),this._$currentSortBtn.addClass(t.isAscending?"sorting_up":"sorting_down")},render:function(){return this._destroyChildren(),"R"!==this.whichSide||this.dimensionModel.get("scrollY")||this.$el.addClass("no_scroll"),this.$el.css({height:this.dimensionModel.get("headerHeight")}).html(this.template({colGroup:this._getColGroupMarkup(),tBody:this._getTableBodyMarkup()})),this._addChildren(this.viewFactory.createHeaderResizeHandler(this.whichSide)),this.$el.append(this._renderChildren()),this},_getColumnData:function(){var t=this.columnModel,e=this.dimensionModel,i=e.getColumnWidthList(this.whichSide),n=t.getVisibleColumnModelList(this.whichSide,!0);return{widthList:i,modelList:n}},_getTableBodyMarkup:function(){var t,e,i=this._getColumnHierarchyList(),n=this._getHierarchyMaxRowCount(i),s=this.dimensionModel.get("headerHeight"),a=new Array(n),r=new Array(n),u=[],d=o.getRowHeight(n,s)-1,h=1;return _.each(i,function(e,o){var c=i[o].length,m=0;_.each(e,function(e,i){var o=e.columnName;h=c-1===i&&n-c+1>1?n-c+1:1,t=d*h,i===c-1?t=s-m-2:m+=t+1,r[i]===o?(a[i].pop(),u[i]+=1):u[i]=1,r[i]=o,a[i]=a[i]||[],a[i].push(this.templateHeader({attrColumnName:l,columnName:o,className:e.isRequired?"required":"",height:t,colspan:u[i],rowspan:h,title:e.title,btnSort:e.isSortable?this.markupBtnSort:""}))},this)},this),e=_.map(a,function(t){return""+t.join("")+""}),e.join("")},_getHierarchyMaxRowCount:function(t){var e=[0];return _.each(t,function(t){e.push(t.length)},this),Math.max.apply(Math,e)},_getColumnHierarchyList:function(){var t,e=this._getColumnData().modelList;return t=_.map(e,function(t){return this._getColumnHierarchy(t).reverse()},this)},_getColumnHierarchy:function(t,e){var i=this.columnModel.get("columnMerge");return e=e||[],t&&(e.push(t),i&&_.each(i,function(i){-1!==$.inArray(t.columnName,i.columnNameList)&&this._getColumnHierarchy(i,e)},this)),e}});e.exports=r},{"../../base/view":7,"../../common/constMap":8,"../../common/util":11}],48:[function(t,e,i){"use strict";var n=t("../../base/view"),o=t("../../common/constMap").attrName.COLUMN_NAME,s=n.extend({initialize:function(t){this.setOwnProperties({dimensionModel:t.dimensionModel,columnModel:t.columnModel,whichSide:t.whichSide||"R",isResizing:!1,$target:null,differenceLeft:0,initialWidth:0,initialOffsetLeft:0,initialLeft:0}),this.listenTo(this.dimensionModel,"change:which columnWidthChanged",this._refreshHandlerPosition)},tagName:"div",className:"resize_handle_container",events:{"mousedown .resize_handle":"_onMouseDown","dblclick .resize_handle":"_onDblClick"},template:_.template('
="<%=columnName%>" class="resize_handle<% if(isLast === true) print(" resize_handle_last");%>" style="<%=height%>" title="마우스 드래그를 통해 컬럼의 넓이를 변경할 수 있고,더블클릭을 통해 넓이를 초기화할 수 있습니다.">
'),_getColumnData:function(){var t=this.columnModel,e=this.dimensionModel,i=e.getColumnWidthList(this.whichSide),n=t.getVisibleColumnModelList(this.whichSide,!0);return{widthList:i,modelList:n}},_getResizeHandlerMarkup:function(){var t,e=this._getColumnData(),i=e.modelList,n=this.dimensionModel.get("headerHeight"),s=i.length;return t=_.map(i,function(t,e){return this.template({attrColumnName:o,columnIndex:e,columnName:t.columnName,isLast:e+1===s,height:n})},this),t.join("")},render:function(){var t=this.dimensionModel.get("headerHeight"),e=this._getResizeHandlerMarkup();return this.$el.empty().show().html(e).css({marginTop:-t,height:t}),this._refreshHandlerPosition(),this},_refreshHandlerPosition:function(){var t,e,i,n=this._getColumnData(),s=n.widthList,a=this.$el.find(".resize_handle"),l=this.$el.parent().find("table:first"),r=!1,u=0,d=1,h=3;tui.util.forEachArray(a,function(n,c){t=a.eq(c),e=t.attr(o),i=l.find("th["+o+"="+e+"]").width(),tui.util.isExisty(i)?r=r||i!==s[c]:i=s[c],u+=i+d,t.css("left",u-h)})},_isResizing:function(){return!!this.isResizing},_onMouseDown:function(t){this._startResizing(t)},_onDblClick:function(t){var e=$(t.target),i=parseInt(e.attr("columnindex"),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("columnindex"),10),this.$target.css("left",e+"px"),this.dimensionModel.setColumnWidth(this._getHandlerColumnIndex(n),i),this._refreshHandlerPosition())},_calculateWidth:function(t){var e=t-this.initialOffsetLeft-this.initialLeft;return this.initialWidth+e},_getHandlerColumnIndex:function(t){return"R"===this.whichSide?t+this.columnModel.getVisibleColumnFixCount(!0):t},_startResizing:function(t){var e=this._getColumnData(),i=e.widthList,n=$(t.target);this.isResizing=!0,this.$target=n,this.initialLeft=parseInt(n.css("left").replace("px",""),10),this.initialOffsetLeft=this.$el.offset().left,this.initialWidth=i[n.attr("columnindex")],$("body").css("cursor","col-resize"),$(document).bind("mousemove",$.proxy(this._onMouseMove,this)).bind("mouseup",$.proxy(this._onMouseUp,this)), -n[0].setCapture&&n[0].setCapture()},_stopResizing:function(){this.$target&&this.$target[0].releaseCapture&&this.$target[0].releaseCapture(),this.isResizing=!1,this.$target=null,this.initialLeft=0,this.initialOffsetLeft=0,this.initialWidth=0,$("body").css("cursor","default"),$(document).unbind("mousemove",$.proxy(this._onMouseMove,this)).unbind("mouseup",$.proxy(this._onMouseUp,this))},destroy:function(){this.stopListening(),this._stopResizing(),this.remove()}});e.exports=s},{"../../base/view":7,"../../common/constMap":8}],49:[function(t,e,i){"use strict";var n=t("../../base/view"),o=n.extend({initialize:function(t){n.prototype.initialize.call(this),this.toolbarModel=t.toolbarModel,this.dimensionModel=t.dimensionModel,this.viewFactory=t.viewFactory},tagName:"div",className:"toolbar",render:function(){var t=this.toolbarModel;return this._destroyChildren(),t.get("hasControlPanel")&&this._addChildren(this.viewFactory.createToolbarControlPanel()),t.get("hasResizeHandler")&&this._addChildren(this.viewFactory.createToolbarResizeHandler()),t.get("hasPagination")&&this._addChildren(this.viewFactory.createToolbarPagination()),this.$el.empty().append(this._renderChildren()),this._refreshHeight(),this},_refreshHeight:function(){var t=this.dimensionModel.get("toolbarHeight");this.$el.height(t),this.$el.toggle(!!t)}});e.exports=o},{"../../base/view":7}],50:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.setOwnProperties({gridId:t.gridId,toolbarModel:t.toolbarModel,$btnExcel:null,$btnExcelAll:null}),this.listenTo(this.toolbarModel,"change:isExcelButtonVisible change:isExcelAllButtonVisible",this.render)},events:{"click a.excel_download_button":"_onClickExcel"},tagName:"div",className:"btn_setup",templateExcelBtn:_.template('<%=text%>'),_onClickExcel:function(t){var e,i=tui.Grid.getInstanceById(this.gridId),n=i.getAddOn("Net");t.preventDefault(),n&&(e=$(t.target).closest("a"),e.hasClass("excel_page")?n.download("excel"):e.hasClass("excel_all")&&n.download("excelAll"))},render:function(){var t=this.toolbarModel;return this.$el.empty(),t.get("isExcelButtonVisible")&&this.$el.append(this.templateExcelBtn({className:"excel_page",text:"엑셀 다운로드"})),t.get("isExcelAllButtonVisible")&&this.$el.append(this.templateExcelBtn({className:"excel_all",text:"전체 엑셀 다운로드"})),this}});e.exports=o},{"../../../base/view":7}],51:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.toolbarModel=t.toolbarModel},tagName:"div",className:"grid_pagination",template:_.template('FirstPrev LastFirst OffPrev OffNext OffLast Off'),render:function(){return this._destroyChildren(),this.$el.empty().html(this.template()),this._setPaginationInstance(),this},_setPaginationInstance:function(){var t=tui&&tui.component&&tui.component.Pagination,e=this.toolbarModel.get("pagination");!e&&t&&(e=new t({itemCount:1,itemPerPage:1,pagePerPageList:5,isCenterAlign:!0,moveUnit:"page",$preOff:this.$el.find(".pre_off"),$pre_endOff:this.$el.find(".pre_end_off"),$nextOff:this.$el.find(".next_off"),$lastOff:this.$el.find(".next_end_off")},this.$el)),this.toolbarModel.set("pagination",e)}});e.exports=o},{"../../../base/view":7}],52:[function(t,e,i){"use strict";var n=t("../../../base/view"),o=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.timeoutIdForResize=0},tagName:"div",className:"height_resize_bar",template:_.template(''),events:{mousedown:"_onMouseDown"},_attachMouseEvent:function(){$(document).on("mousemove",$.proxy(this._onMouseMove,this)),$(document).on("mouseup",$.proxy(this._onMouseUp,this)),$(document).on("selectstart",$.proxy(this._onSelectStart,this))},_detachMouseEvent:function(){$(document).off("mousemove",$.proxy(this._onMouseMove,this)),$(document).off("mouseup",$.proxy(this._onMouseUp,this)),$(document).off("selectstart",$.proxy(this._onSelectStart,this))},_onMouseDown:function(t){t.preventDefault(),$(document.body).css("cursor","row-resize"),this._attachMouseEvent()},_onMouseMove:function(t){var e=this.dimensionModel,i=e.get("offsetTop"),n=e.get("headerHeight"),o=e.get("rowHeight"),s=e.get("toolbarHeight"),a=t.pageY-i-n-s;clearTimeout(this.timeoutIdForResize),a=Math.max(a,o+e.getScrollXHeight()),this.timeoutIdForResize=setTimeout(function(){e.set({bodyHeight:a})},0)},_onMouseUp:function(){$(document.body).css("cursor","default"),this._detachMouseEvent()},_onSelectStart:function(t){return t.preventDefault(),!1},render:function(){return this._destroyChildren(),this.$el.html(this.template()),this},destroy:function(){this.stopListening(),this._onMouseUp(),this._destroyChildren(),this.remove()}});e.exports=o},{"../../../base/view":7}],53:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").attrName,a="selected",l="focused_row",r="td.meta_column",u=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(u.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){u.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");t=this.selectionModel.hasSelection()?this._filterRowsByIndexRange(e,this.selectionModel.get("range").row):this._filterRowByKey(e,this.focusModel.get("rowKey")),e.find(r).removeClass(a),t.find(r).addClass(a)},_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,a=this.dataModel.getMainRowKey(t,i);n[a]||(n[a]=this._getRowElement(a)),o=n[a].find("td["+s.COLUMN_NAME+"="+i+"]"),o.toggleClass(l,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=u},{"../base/view":7,"../common/constMap":8,"../common/util":11}],54:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/util"),s=t("../common/constMap").dimension.CELL_BORDER_WIDTH,a=n.extend({initialize:function(t){this.setOwnProperties({whichSide:t.whichSide||"R",dimensionModel:t.dimensionModel,columnModel:t.columnModel,selectionModel:t.selectionModel}),this._updateColumnWidthList(),this.listenTo(this.dimensionModel,"columnWidthChanged",this._onChangeColumnWidth),this.listenTo(this.selectionModel,"change:range",this.render)},tagName:"div",className:"selection_layer",_updateColumnWidthList:function(){this.columnWidthList=this.dimensionModel.getColumnWidthList(this.whichSide)},_onChangeColumnWidth:function(){this._updateColumnWidthList(),this.render()},_getOwnSideColumnRange:function(t){var e=this.columnModel.getVisibleColumnFixCount(),i=null;return"L"===this.whichSide?t[0]=e&&(i=[Math.max(t[0],e)-e,t[1]-e]),i},_getVerticalStyles:function(t){var e=this.dimensionModel.get("rowHeight"),i=o.getHeight(t[0],e),n=o.getHeight(t[1]-t[0]+1,e)-s;return{top:i+"px",height:n+"px"}},_getHorizontalStyles:function(t){var e=this.columnWidthList,i=this.columnModel.getVisibleMetaColumnCount(),n=t[0],o=t[1],a=0,l=0,r=0;for("L"===this.whichSide&&(n+=i,o+=i),o=Math.min(o,e.length-1);o>=r;r+=1)n>r?a+=e[r]+s:l+=e[r]+s;return l-=s,{left:a+"px",width:l+"px"}},render:function(){var t,e,i=this.selectionModel.get("range");return i&&(e=this._getOwnSideColumnRange(i.column)),e?(t=_.assign({},this._getVerticalStyles(i.row),this._getHorizontalStyles(e)),this.$el.show().css(t)):this.$el.hide(),this}});e.exports=a},{"../base/view":7,"../common/constMap":8,"../common/util":11}],55:[function(t,e,i){"use strict";var n=t("../base/view"),o=t("../common/constMap").renderState,s=n.extend({initialize:function(t){this.dimensionModel=t.dimensionModel,this.renderModel=t.renderModel,this.timeoutIdForDelay=null,this.listenTo(this.dimensionModel,"change",this._refreshLayout),this.listenTo(this.renderModel,"change:state",this.render)},className:"state_layer",template:_.template('
<%= text %> <% if (isLoading) { %>
<% } %>
'),render:function(){var t=this.renderModel.get("state");return t===o.DONE?this.$el.hide():this._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=s},{"../base/view":7,"../common/constMap":8}]},{},[13]); \ No newline at end of file +!function t(e,i,n){function o(a,l){if(!i[a]){if(!e[a]){var r="function"==typeof require&&require;if(!l&&r)return r(a,!0);if(s)return s(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var d=i[a]={exports:{}};e[a][0].call(d.exports,function(t){var i=e[a][1][t];return o(i?i:t)},d,d.exports,t,e,i,n)}return i[a].exports}for(var s="function"==typeof require&&require,a=0;a0?i=confirm(this._getConfirmMessage(t,e)):alert(this._getConfirmMessage(t,e)),i},_getConfirmMessage:function(t,e){var i,n={createData:"입력",updateData:"수정",deleteData:"삭제",modifyData:"반영"},o=n[t];return i=e>0?e+"건의 데이터를 "+o+"하시겠습니까?":o+"할 데이터가 없습니다."},_ajax:function(t){var e,i=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