Skip to content

Commit

Permalink
Merge pull request #105 from axisj-com/thomas
Browse files Browse the repository at this point in the history
axisj 1.0.1
  • Loading branch information
thomasJang committed May 2, 2014
2 parents 2e5893d + 54d66e5 commit 8834aad
Show file tree
Hide file tree
Showing 62 changed files with 2,342 additions and 2,809 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "axisj",
"version": "1.0.0",
"version": "1.0.1",
"homepage": "https://github.com/axisj-com/axisj",
"authors": [
"tom@axisj.com thomasJ and team axisj"
Expand Down
75 changes: 39 additions & 36 deletions lib/AXGrid.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
/* AXISJ Javascript UI Framework */
/* http://www.axisj.com, license : http://www.axisj.com/license */

/**
/**
* AXGrid
* @class AXGrid
* @extends AXJ
* @version v1.64
* @version v1.65
* @author tom@axisj.com
* @logs
"2012-12-24 오전 11:51:26",
Expand Down Expand Up @@ -63,7 +60,9 @@
"2014-04-20 tom : listLoadingDisplay 실행할 때 가능하면 스크롤바의 위치를 맨위로 이동 시키기",
"2014-04-22 tom : setList 호출시 onError 속성 추가",
"2014-04-25 tom : setData 메소드 추가",
"2014-04-28 tom : mobile 에서 터치무브 버그 픽스"
"2014-04-28 tom : mobile 에서 터치무브 버그 픽스",
"2014-04-28 tom : config.emptyListMSG 에서 설정가능",
"2014-04-29 tom : AXConfig.AXGrid.pageCountMsg 설정기능 추가"
* @description
*
Expand Down Expand Up @@ -94,7 +93,7 @@ AXGrid = Class.create(AXJ, {
this.config.fitToWidthRightMargin = (AXConfig.AXGrid.fitToWidthRightMargin || 10);
this.config.passiveMode = AXConfig.AXGrid.passiveMode;
this.config.passiveRemoveHide = AXConfig.AXGrid.passiveRemoveHide;
this.config.listCountMSG = (AXConfig.AXGrid.listCountMSG || "전체 <b>{listCount}</b>개의 목록이 있습니다.");

this.selectedCells = [];
this.selectedRow = [];

Expand Down Expand Up @@ -953,6 +952,10 @@ AXGrid = Class.create(AXJ, {
return;
}

cfg.emptyListMSG = cfg.emptyListMSG || AXConfig.AXGrid.emptyListMSG;
cfg.listCountMSG = cfg.listCountMSG || AXConfig.AXGrid.listCountMSG || "전체 <b>{listCount}</b>개의 목록이 있습니다.";
cfg.pageCountMSG = cfg.pageCountMSG || AXConfig.AXGrid.pageCountMSG;

/*
cfg.viewMode 결정 구간.
*/
Expand Down Expand Up @@ -2159,7 +2162,7 @@ AXGrid = Class.create(AXJ, {
po.push("<td colspan=\"" + (this.showColLen) + "\">");
po.push("<div class=\"tdRelBlock\">");
po.push("<div class=\"bodyNode bodyTdText\" align=\"center\">");
po.push(AXConfig.AXGrid.emptyListMSG);
po.push(cfg.emptyListMSG);
po.push("</div>");
po.push("</div>");
po.push("</td>");
Expand Down Expand Up @@ -2193,7 +2196,7 @@ AXGrid = Class.create(AXJ, {
}

if (cfg.viewMode == "grid" || cfg.viewMode == "icon") {
po.push("<div id=\"" + cfg.targetID + "_AX_scrollTrackXY\" class=\"gridScrollTrackXY\"></div>");
//po.push("<div id=\"" + cfg.targetID + "_AX_scrollTrackXY\" class=\"gridScrollTrackXY\"></div>");
po.push("<div id=\"" + cfg.targetID + "_AX_scrollTrackY\" class=\"gridScrollTrackY\"><div id=\"" + cfg.targetID + "_AX_scrollYHandle\" class=\"gridScrollHandle\"></div></div>");
po.push("<div id=\"" + cfg.targetID + "_AX_scrollTrackX\" class=\"gridScrollTrackX\"><div id=\"" + cfg.targetID + "_AX_scrollXHandle\" class=\"gridScrollHandle\"></div></div>");
}
Expand All @@ -2202,7 +2205,7 @@ AXGrid = Class.create(AXJ, {
this.scrollContent = axdom("#" + cfg.targetID + "_AX_scrollContent");

this.fixedScrollContent = axdom("#" + cfg.targetID + "_AX_fixedScrollContent");
this.scrollTrackXY = axdom("#" + cfg.targetID + "_AX_scrollTrackXY");
//this.scrollTrackXY = axdom("#" + cfg.targetID + "_AX_scrollTrackXY");
this.scrollTrackY = axdom("#" + cfg.targetID + "_AX_scrollTrackY");
this.scrollYHandle = axdom("#" + cfg.targetID + "_AX_scrollYHandle");
this.scrollTrackX = axdom("#" + cfg.targetID + "_AX_scrollTrackX");
Expand Down Expand Up @@ -2873,13 +2876,12 @@ AXGrid = Class.create(AXJ, {
}
}


if (this.list.length == 0) { /* empty tags */
po.push("<tr class=\"noListTr\">");
po.push("<td colspan=\"" + (this.showColLen) + "\">");
po.push("<div class=\"tdRelBlock\">");
po.push("<div class=\"bodyNode bodyTdText\" align=\"center\">");
po.push(AXConfig.AXGrid.emptyListMSG);
po.push(cfg.emptyListMSG);
po.push("</div>");
po.push("</div>");
po.push("</td>");
Expand Down Expand Up @@ -3069,7 +3071,7 @@ AXGrid = Class.create(AXJ, {

if (this.list.length == 0) { /* empty tags */
po.push("<div class=\"bodyViewMobile\" align=\"center\">");
po.push(AXConfig.AXGrid.emptyListMSG);
po.push(cfg.emptyListMSG);
po.push("</div>");
}

Expand Down Expand Up @@ -3764,14 +3766,15 @@ AXGrid = Class.create(AXJ, {
if (this.contentScrollResize_timer) clearTimeout(this.contentScrollResize_timer);
this.contentScrollResize_timer = setTimeout(function () {
//trace("contentScrollResize_timer");
var bodyHeight = _this.body.height() - _this.scrollTrackXY.outerHeight();
var bodyHeight = _this.body.height();
var scrollHeight = _this.scrollContent.height();

var bodyWidth = _this.body.width();
var scrollWidth = (_this.colWidth > bodyWidth) ? _this.colWidth : bodyWidth;
var _colWidth = (_this.colWidth.number() + cfg.fitToWidthRightMargin);
var scrollWidth = (_colWidth > bodyWidth) ? _colWidth : bodyWidth;

_this.scrollContent.css({ width: scrollWidth + _this.scrollTrackXY.outerWidth() });
_this.colHead.css({ width: scrollWidth + _this.scrollTrackXY.outerWidth() });
_this.scrollContent.css({ width: scrollWidth });
_this.colHead.css({ width: scrollWidth });
/* colHead width 재정의 */

if (_this.hasEditor) _this.editor.css({ width: scrollWidth });
Expand All @@ -3790,45 +3793,45 @@ AXGrid = Class.create(AXJ, {
}

if (bodyHeight < scrollHeight && cfg.height != "auto") {
_this.scrollTrackXY.show();
//_this.scrollTrackXY.show();
_this.scrollTrackY.show();

var scrollTrackYHeight = bodyHeight;
_this.scrollTrackY.css({ height: scrollTrackYHeight });

var scrollYHandleHeight = ((bodyHeight) * scrollTrackYHeight) / scrollHeight;
_this.scrollYHandle.css({ height: scrollYHandleHeight - 2 });
_this.scrollYHandle.css({ height: scrollYHandleHeight });
} else {
_this.scrollTrackXY.hide();
//_this.scrollTrackXY.hide();
_this.scrollTrackY.hide();
}

if (scrollWidth > bodyWidth && cfg.xscroll) {
_this.show_scrollTrackX = true;

_this.scrollTrackXY.show();
//_this.scrollTrackXY.show();
_this.scrollTrackX.show();

var scrollTrackXWidth = bodyWidth - _this.scrollTrackXY.outerWidth();
var scrollTrackXWidth = bodyWidth;
_this.scrollTrackX.css({ width: scrollTrackXWidth });
var scrollXHandleWidth = ((bodyWidth - _this.scrollTrackXY.outerWidth()) * scrollTrackXWidth) / scrollWidth;
var scrollXHandleWidth = ((bodyWidth) * scrollTrackXWidth) / scrollWidth;

_this.scrollXHandle.css({ width: scrollXHandleWidth - 2 });
_this.scrollXHandle.css({ width: scrollXHandleWidth });

/* cfg.height == "auto" 길이 늘이기 */
if (cfg.height == "auto") {
var colHeadHeight = _this.colHead.outerHeight();
var scrollBodyHeight = _this.scrollContent.height();
var scrollTrackXYHeight = _this.scrollTrackXY.outerHeight();
_this.scrollBody.css({ height: (scrollBodyHeight + colHeadHeight + scrollTrackXYHeight) });
//var scrollTrackXYHeight = _this.scrollTrackXY.outerHeight();
_this.scrollBody.css({ height: (scrollBodyHeight + colHeadHeight) });
/*colhead + body height */
_this.body.css({ top: colHeadHeight, height: (scrollBodyHeight + scrollTrackXYHeight) });
_this.body.css({ top: colHeadHeight, height: (scrollBodyHeight) });
/* body Height */
}
} else {
_this.show_scrollTrackX = false;
_this.scrollTrackX.hide();
if (cfg.height == "auto") _this.scrollTrackXY.hide();
//if (cfg.height == "auto") _this.scrollTrackXY.hide();

if (cfg.height == "auto") {
var colHeadHeight = _this.colHead.outerHeight();
Expand Down Expand Up @@ -3865,7 +3868,7 @@ AXGrid = Class.create(AXJ, {
if (cfg.height == "auto") return;
if (!this.contentScrollYAttr) {
this.contentScrollYAttr = {
bodyHeight: this.body.height() - this.scrollTrackXY.outerHeight(),
bodyHeight: this.body.height(),
scrollHeight: this.scrollContent.height(),
scrollTrackYHeight: this.scrollTrackY.height(),
scrollYHandleHeight: this.scrollYHandle.outerHeight()
Expand All @@ -3890,7 +3893,7 @@ AXGrid = Class.create(AXJ, {
if (cfg.height == "auto") return;

this.contentScrollYAttr = {
bodyHeight: this.body.height() - this.scrollTrackXY.outerHeight(),
bodyHeight: this.body.height(),
scrollHeight: this.scrollContent.height(),
scrollTrackYHeight: this.scrollTrackY.height(),
scrollYHandleHeight: this.scrollYHandle.outerHeight()
Expand Down Expand Up @@ -4015,7 +4018,7 @@ AXGrid = Class.create(AXJ, {
var delta = event.detail ? event.detail * (-20) : event.wheelDelta / 2;
/*check for detail first so Opera uses that instead of wheelDelta */

var bodyHeight = this.body.height() - this.scrollTrackXY.outerHeight();
var bodyHeight = this.body.height();
var scrollTop = this.scrollContent.position().top;
var scrollHeight = this.scrollContent.height();

Expand Down Expand Up @@ -4109,7 +4112,7 @@ AXGrid = Class.create(AXJ, {
var pos = this.getTouchPositionToContentScroll(event);
var scrollTouchAttr = this.scrollTouchAttr;

var bodyHeight = this.body.height() - this.scrollTrackXY.outerHeight();
var bodyHeight = this.body.height();
var scrollHeight = this.scrollContent.height();


Expand Down Expand Up @@ -4177,7 +4180,7 @@ AXGrid = Class.create(AXJ, {
var trHeight = this.body.find(".gridBodyTr_" + itemIndex).height();

var scrollHeight = this.scrollContent.height();
var bodyHeight = this.body.height() - this.scrollTrackXY.outerHeight();
var bodyHeight = this.body.height();
var handleHeight = this.scrollYHandle.outerHeight();
var trackHeight = this.scrollTrackY.height();

Expand Down Expand Up @@ -4226,7 +4229,7 @@ AXGrid = Class.create(AXJ, {
var trHeight = this.body.find(".gridBodyTr_" + itemIndex).height();

var scrollHeight = this.scrollContent.height();
var bodyHeight = this.body.height() - this.scrollTrackXY.outerHeight();
var bodyHeight = this.body.height();
var handleHeight = this.scrollYHandle.outerHeight();
var trackHeight = this.scrollTrackY.height();

Expand Down Expand Up @@ -4848,7 +4851,7 @@ AXGrid = Class.create(AXJ, {

}

this.scrollTrackXY.before(this.editor);
this.scrollTrackY.before(this.editor);
this.editor.show();
this.editor.find("input[type=text],textarea").bind("mousedown.AXGrid", function () {
this.focus();
Expand Down Expand Up @@ -5411,7 +5414,7 @@ AXGrid = Class.create(AXJ, {
}
/*alert(axf.getId(cfg.targetID + "_AX_gridPageNo").options[axf.getId(cfg.targetID + "_AX_gridPageNo").options.selectedIndex].value); */
}
axdom("#" + cfg.targetID + "_AX_gridPageCount").html("/ " + pgCount.money() + " Pages");
axdom("#" + cfg.targetID + "_AX_gridPageCount").html("/ " + pgCount.money() + " " + cfg.pageCountMSG);
axdom("#" + cfg.targetID + "_AX_gridStatus").html(cfg.listCountMSG.replace("{listCount}", this.page.listCount.number().money()));


Expand Down
9 changes: 5 additions & 4 deletions lib/AXJ.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ var AXConfig = {
pageHeight: 400,
keyResult: "result",
keyList: "list",
emptyListMSG: "목록이 없습니다.",
listCountMSG: "<b>{listCount}</b> Count"
emptyListMSG: "empty of list",
listCountMSG: "<b>{listCount}</b> count(s)",
pageCountMSG: "page(s)"
},
AXTree: {
fitToWidthRightMargin: 10,
Expand Down Expand Up @@ -494,7 +495,7 @@ Object.extend(String.prototype, (function () {
if(this.length == 14){
try {
var va = this.replace(/\D/g, "");
return new Date(va.substr(0, 4), va.substr(4, 2), va.substr(6, 2), va.substr(8, 2), va.substr(10, 2), va.substr(12, 2));
return new Date(va.substr(0, 4), va.substr(4, 2).number()-1, va.substr(6, 2), va.substr(8, 2), va.substr(10, 2), va.substr(12, 2));
} catch (e) {
return (defaultDate || new Date());
}
Expand All @@ -508,7 +509,7 @@ Object.extend(String.prototype, (function () {
} else if (this.length == 8) {
var separator = (separator || "-");
var va = this.replace(/\D/g, "");
return (va.substr(0, 4) + separator + va.substr(4, 2) + separator + va.substr(6, 2)).date();
return (va.substr(0, 4) + separator + (va.substr(4, 2).number()-1) + separator + va.substr(6, 2)).date();
} else if (this.length < 10) {
return (defaultDate || new Date());
} else if (this.length > 15) {
Expand Down
Loading

0 comments on commit 8834aad

Please sign in to comment.