Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
seonim-ryu committed Oct 26, 2017
2 parents 033efc9 + 5505522 commit ab4d18c
Show file tree
Hide file tree
Showing 31 changed files with 376 additions and 277 deletions.
6 changes: 3 additions & 3 deletions examples/example.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"example08-using-datepicker": {
"title": "8. Using DatePicker component"
},
"example09-footer-summary": {
"title": "9. Footer and Summary"
"example09-using-summary": {
"title": "9. Using Summary"
},
"example10-using-net": {
"title": "10. Binding to remote data using net"
Expand All @@ -33,6 +33,6 @@
"title": "11. Customizing Row headers"
},
"example12-using-whitespace": {
"title": "11. Using whiteSpace"
"title": "12. Using whiteSpace"
}
}
23 changes: 14 additions & 9 deletions examples/example03-complex-columns.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,33 @@
scrollX: false,
scrollY: false,
header: {
height: 100,
height: 120,
complexColumns: [
{
title: 'Detail',
title: 'Basic',
name: 'mergeColumn1',
childNames: ['type', 'release', 'genre']
childNames: ['name', 'artist']
},
{
title: 'Album Info',
title: 'Extra',
name: 'mergeColumn2',
childNames: ['name', 'artist', 'mergeColumn1']
childNames: ['type', 'release', 'genre']
},
{
title: 'Total Count',
title: 'Detail',
name: 'mergeColumn3',
childNames: ['downloadCount', 'listenCount']
childNames: ['mergeColumn1', 'mergeColumn2']
},
{
title: 'Sales Info',
title: 'Count',
name: 'mergeColumn4',
childNames: ['price', 'mergeColumn3']
childNames: ['downloadCount', 'listenCount']
},
{
title: 'Album Info',
name: 'mergeColumn5',
childNames: ['price', 'mergeColumn3', 'mergeColumn4']
}
]
},
columns: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
<html lang="ko">
<head>
<meta charset="utf-8">
<title>9. Footer and Summary</title>
<title>9. Using Summary</title>
<link rel="stylesheet" type="text/css" href="./css/explain.css" />
<link rel="stylesheet" type="text/css" href="../dist/tui-grid.css" />
</head>
<body>
<div class="explain">
You can see the tutorial <a href="https://github.com/nhnent/tui.grid/wiki/Footer-and-Summary" target="_blank">here</a>.
You can see the tutorial <a href="https://github.com/nhnent/tui.grid/wiki/Using-Summary" target="_blank">here</a>.
The "footer" option to use summary feature is deprecated since 2.5.0 version and
this option is replaced by the "summary" option.
</div>
<div class="code-html">
<div id="grid"></div>
Expand Down Expand Up @@ -54,8 +56,9 @@
}
}
],
footer: {
summary: {
height: 50,
position: 'bottom', // or 'top'
columnContent: {
c2: {
template: function(valueMap) {
Expand Down
1 change: 1 addition & 0 deletions examples/example11-customizing-rowheaders.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
el: $('#grid'),
data: gridData,
scrollX: false,
scrollY: false,
rowHeight: 40,
header: {
height: 40
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tui-grid",
"version": "2.4.1",
"version": "2.5.0",
"description": "TOAST UI Grid : Powerful data grid control supported by TOAST UI",
"main": "dist/tui-grid.js",
"scripts": {
Expand Down
89 changes: 0 additions & 89 deletions src/css/calendar.styl

This file was deleted.

1 change: 0 additions & 1 deletion src/css/index.styl
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,3 @@ opacity(n)
@import 'table.styl'
@import 'layout.styl'
@import 'pagination.styl'
@import 'calendar.styl'
25 changes: 17 additions & 8 deletions src/css/layout.styl
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,19 @@
position relative
overflow scroll

.foot-area
.summary-area
position relative
border-width 1px 0 0
border-style solid
margin-top -18px
overflow-y hidden
overflow-x scroll

.summary-area-top
border-width 0

.summary-area-bottom
border-width 1px 0 0

.lside-area
display none
position absolute
Expand All @@ -78,27 +83,31 @@
display none
overflow hidden

.head-area, .foot-area
.head-area, .summary-area
margin-right 17px

.no-scroll-y
.rside-area
.head-area, .foot-area
.head-area, .summary-area
margin-right 0

.no-scroll-x
.foot-area
.summary-area
margin-top 0
overflow-x hidden
.foot-area-right
.summary-area-right
bottom 0

.foot-area-right
.summary-area-right
position absolute
right 0
bottom 17px
width 17px
border-style solid

.summary-area-right-top
border-width 0 0 1px 1px

.summary-area-right-bottom
border-width 1px 0 1px 1px

.body-container
Expand Down
5 changes: 2 additions & 3 deletions src/css/table.styl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
width 100%
border-right-width 0

.foot-area
.summary-area
.table
border-width 0 0 1px
.cell
Expand Down Expand Up @@ -83,10 +83,9 @@
.column-resize-handle
float left
position absolute
top -1px
bottom 1px
left -99px
width 7px
height 100%
background #000
opacity 0
cursor col-resize
Expand Down
8 changes: 6 additions & 2 deletions src/js/common/classNameConst.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ var classNames = {
RSIDE_AREA: 'rside-area',
HEAD_AREA: 'head-area',
BODY_AREA: 'body-area',
FOOT_AREA: 'foot-area',
FOOT_AREA_RIGHT: 'foot-area-right',
SUMMARY_AREA: 'summary-area',
SUMMARY_AREA_TOP: 'summary-area-top',
SUMMARY_AREA_BOTTOM: 'summary-area-bottom',
SUMMARY_AREA_RIGHT: 'summary-area-right',
SUMMARY_AREA_RIGHT_TOP: 'summary-area-right-top',
SUMMARY_AREA_RIGHT_BOTTOM: 'summary-area-right-bottom',

// header
COLUMN_RESIZE_CONTAINER: 'column-resize-container',
Expand Down
4 changes: 4 additions & 0 deletions src/js/common/constMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,9 @@ module.exports = {
CNT: 'cnt',
MAX: 'max',
MIN: 'min'
},
summaryPosition: {
TOP: 'top',
BOTTOM: 'bottom'
}
};
46 changes: 36 additions & 10 deletions src/js/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,36 @@ var instanceMap = {};
* for this column
* @param {Object} [options.columns.component.options] - The options object to be used for
* creating the component
* @param {Object} [options.footer] - The object for configuring footer area.
* @param {number} [options.footer.height] - The height of the footer area.
* @param {Object.<string, Object>} [options.footer.columnContent]
* The object for configuring each column in the footer.
* @param {Object} [options.summary] - The object for configuring summary area.
* @param {number} [options.summary.height] - The height of the summary area.
* @param {Object.<string, Object>} [options.summary.columnContent]
* The object for configuring each column in the summary.
* Sub options below are keyed by each column name.
* @param {boolean} [options.footer.columnContent.useAutoSummary=true]
* @param {boolean} [options.summary.columnContent.useAutoSummary=true]
* If set to true, the summary value of each column is served as a paramater to the template
* function whenever data is changed.
* @param {function} [options.footer.columnContent.template] - Template function which returns the
* content(HTML) of the column of the footer. This function takes an K-V object as a parameter
* @param {function} [options.summary.columnContent.template] - Template function which returns the
* content(HTML) of the column of the summary. This function takes an K-V object as a parameter
* which contains a summary values keyed by 'sum', 'avg', 'min', 'max' and 'cnt'.
* @param {Object} [options.footer] - Deprecated: The object for configuring summary area. This option is replaced by "summary" option.
* @param {number} [options.footer.height] - Deprecated: The height of the summary area.
* @param {Object.<string, Object>} [options.footer.columnContent]
* Deprecated: The object for configuring each column in the summary.
* Sub options below are keyed by each column name.
* @param {boolean} [options.footer.columnContent.useAutoSummary=true]
* Deprecated: If set to true, the summary value of each column is served as a paramater to the template
* function whenever data is changed.
* @param {function} [options.footer.columnContent.template] - Deprecated: Template function which returns the
* content(HTML) of the column of the summary. This function takes an K-V object as a parameter
* which contains a summary values keyed by 'sum', 'avg', 'min', 'max' and 'cnt'.
*/
var Grid = View.extend(/** @lends Grid.prototype */{
initialize: function(options) {
if (options.footer) {
util.warning('The "footer" option is deprecated since 2.5.0 and replaced by "summary" option.');
options.summary = options.footer;
}

this.id = util.getUniqueKey();
this.domState = new DomState(this.$el);
this.domEventBus = DomEventBus.create();
Expand Down Expand Up @@ -250,7 +266,7 @@ var Grid = View.extend(/** @lends Grid.prototype */{
*/
_createViewFactory: function(options) {
var viewOptions = _.pick(options, [
'heightResizable', 'footer'
'heightResizable', 'summary'
]);
var dependencies = {
modelManager: this.modelManager,
Expand Down Expand Up @@ -880,12 +896,22 @@ var Grid = View.extend(/** @lends Grid.prototype */{
},

/**
* Sets the HTML string of given column footer.
* Sets the HTML string of given column summary.
* @param {string} columnName - column name
* @param {string} contents - HTML string
*/
setSummaryColumnContent: function(columnName, contents) {
this.modelManager.columnModel.setSummaryContent(columnName, contents);
},

/**
* Sets the HTML string of given column summary.
* @deprecated since version 2.5.0 and is replaced by "setSummaryColumnContent" API
* @param {string} columnName - column name
* @param {string} contents - HTML string
*/
setFooterColumnContent: function(columnName, contents) {
this.modelManager.columnModel.setFooterContent(columnName, contents);
this.modelManager.columnModel.setSummaryContent(columnName, contents);
},

/**
Expand Down
Loading

0 comments on commit ab4d18c

Please sign in to comment.