Skip to content

Commit

Permalink
ax5calendar 0.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasJang committed Feb 13, 2016
1 parent f4c4ec3 commit b4644cc
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 32 deletions.
61 changes: 46 additions & 15 deletions dist/ax5calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@
this.move(e || window.event);
}).bind(this));
}


// collect selectableMap
if (cfg.selection) {
this.setSelection(cfg.selection, false);
}
// collect selectableMap
if (cfg.selectable) {
this.setSelectable(cfg.selectable, false);
Expand Down Expand Up @@ -759,24 +763,43 @@
*
* ```
*/
this.setSelection = function (selection) {
if (!U.isArray(selection)) return this;
this.setSelection = (function () {
self.selectionMap = {};
var processor = {
'arr': function(v, map, count){
map = {};
if (!U.isArray(v)) return map;
self.selection = v = v.splice(0, count);
v.forEach(function (n) {
if (U.isDate(n))
n = U.date(n, {'return': cfg.dateFormat});
map[n] = true;
});
return map;
}
};

selectableCount = (cfg.multipleSelect) ? (U.isNumber(cfg.multipleSelect)) ? cfg.multipleSelect : 2 : 1;
this.selection = selection.splice(0, selectableCount);
return function (selection, isPrint) {
var
result = {}
;
selectableCount = (cfg.multipleSelect) ? (U.isNumber(cfg.multipleSelect)) ? cfg.multipleSelect : 2 : 1;

this.selection.forEach(function (d) {
self.selectionMap[U.date(d, {"return": cfg.dateFormat})] = true;
});
if (cfg.selection = selection) {
if (U.isArray(selection)) {
result = processor.arr(selection, {}, selectableCount);
}else{
return this;
}
}

setTimeout((function () {
this.selection.forEach(function (d) {
self.$["body"].find('[data-calendar-item-date="' + U.date(d, {"return": cfg.dateFormat}) + '"]').addClass("selected-day");
});
}).bind(this));
this.selectionMap = result;
// 변경내용 적용하여 출력

return this;
};
if (isPrint !== false) this.applySelectionMap();

};
})();

/**
* @method ax5.ui.calendar.getSelection
Expand Down Expand Up @@ -930,6 +953,14 @@
}).bind(this));
};

this.applySelectionMap = function(){
setTimeout((function () {
for (var k in this.selectionMap) {
this.$["body"].find('[data-calendar-item-date="' + k + '"]').addClass("selected-day");
}
}).bind(this));
};

// 클래스 생성자
this.main = (function () {
if (arguments && U.isObject(arguments[0])) {
Expand Down
Loading

0 comments on commit b4644cc

Please sign in to comment.