/** * 공통 컴포넌트 js 파일 * 스타일은 im_component.css에 작성 */ /** * 화면 아래에서 올라오는 시트 다이얼로그 * @type {{isOpen: imSheet.isOpen, close: imSheet.close, open: imSheet.open}} */ var imSheet = function(){ var default_option = { html: '' }; var $im_sheet_content; var $im_sheet; var open = function(o, callback) { var option = o; if(typeof option.id === 'undefined') option.id = makeUniq('im_sheet_'); option = $.extend({}, default_option, option); if(isOpen(option.id)) close(option.id); $im_sheet_content = $('
').append(o.html); $im_sheet = $('').append($im_sheet_content); $('body').append($im_sheet).addClass('modal-open'); setTimeout(function(){ $im_sheet_content.css({ 'top': 'calc(100% - ' + $im_sheet_content.height() + 'px)' }).focus(); setTimeout(function(){ if(typeof callback == 'function') callback($im_sheet); }, 200); }, 10); $im_sheet.on('click', function(e){ if($(e.target).parents('.im-sheet-content').length === 0){ close(option.id); } }); }; var close = function(id, callback) { if(typeof id === 'undefined') return false; $im_sheet = $("#" + id); $im_sheet_content = $im_sheet.find('.im-sheet-content'); $im_sheet_content.css({ 'top' : '100%' }); setTimeout(function(){ $im_sheet.remove(); $('body').removeClass('modal-open'); if(typeof callback == 'function') callback($im_sheet); }, 200); }; var isOpen = function(id) { if(typeof id === 'undefined') return false; var $im_sheet = $("#" + id); return $im_sheet.css('display')==='block'; }; return { 'open': function(o, callback){ open(o, callback); }, 'close': function(id, callback){ close(id, callback); }, isOpen: function(id){ isOpen(id); } } }(); /** * imSheet 디자인의 셀렉트 다이얼로그 * @type {{close: imSheetSelect.close, open: imSheetSelect.open}} */ var imSheetSelect = function(){ var default_option = { }; var open = function(list, selected, select_event, o){ var option = o; if(typeof option.id === 'undefined') option.id = makeUniq('im_sheet_'); option = $.extend({}, default_option, option); var $ul = $('