{"version":3,"sources":["AX6UIDialog.js"],"names":["_jqmin","require","_AX6UICore2","_AX6Util","_AX6Info","_AX6Mustache","dialogTmpl","columnKeys","onStateChanged","opts","that","getContent","call","dialogId","title","config","btns","additionalContent","data","this","msg","replace","input","_crlf","open","isFunction","$activeDialog","document","append","pos","box","callback","dialogConfig","height","id","css","width","_jqmin2","default","body","position","top","window","on","clickEventName","left","onKeyup","zIndex","self","e","state","event","find","dialogType","trigger","_this","_AX6Util2","throttle","align","autoCloseTime","autoCloseTimer","setTimeout","close","btnOnClick","innerHeight","innerWidth","srcElement","target","getAttribute","k","key","value","btnTarget","findParentNode","doNotCallback","emptyKey","oi","val","onClick","keyCode","get","focus","_AX6Info2","eventKeys","ESC","RETURN","required","AX6UIDialog","_classCallCheck","_this2","_possibleConstructorReturn","__proto__","Object","getPrototypeOf","instanceId","theme","queue","lang","ok","cancel","animateTime","init","initOnce","initialized","tryCount","isString","extend","label","push","_option","clearTimeout","addClass","off","length","shift","bind"],"mappings":"2/BAAAA,OAAAC,QAAA,gDACAC,YAAAD,QAAA,kEACAE,SAAAF,QAAA,2DACAG,SAAAH,QAAA,2DACAI,aAAAJ,QAAA,uEAJAK,WAAA,SAAAC,GASE,MAAA,m9CAmDAC,eAAA,SAAAC,EAAAC,GAUI,OApBND,GAAAA,EAAAD,eAYMG,EAAAA,eAAaC,KAAbD,EAAAA,GAEFE,KAAUA,gBACVC,KAAAA,eAAQF,KAAcF,EAAKK,GAG3BC,EAAAA,KACAN,EAAA,MACE,GAEFO,WAAAA,SAAoBJ,EAAUI,GAC5B,IAAAC,GACEL,SAAAA,EACDC,MAFDL,EAGKK,OAAAK,KAAAJ,OAAAD,OAAA,GACHM,KAAAX,EAAOQ,KAAAA,KAAAA,OAAPG,KAAA,IAAAC,QAAA,MAAA,SACDC,MAAAb,EAAAa,MACFN,KAAEP,EAAKQ,KAhBVM,MAAA,WAOI,OAAOJ,KAAKE,QAAQ,MAAO,UARjCJ,kBAAA,SAAAA,GAsBMO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AAA,UAIb9E,KAAAO,cAGCP,KAAK6E,MAAMY,KAAKnG,GAAhBe,KAAAZ,KAAKoF,KAAMY,EAAX7E,GAGDZ,mCAiBG0F,GACJ,IAAIpG,OAAAA,EAAMC,OAAAA,EA2CNA,OAzCAS,KAAKO,gBACHP,KAAKyC,gBAAgBkD,aAAa3F,KAAKyC,gBAH7CnD,EAAIA,KAAAA,aAOFU,KAAKO,cAAcqF,SAAS,YAL9B,EAAA1E,QAAAC,SAAII,QACFsE,IAAI,qBAODA,IAAI,oBAEPnD,WAAY,WALZ1C,KAAKO,gBACLP,KAAAO,cAAOgB,SAOHvB,KAAKO,cAAgB,MADrBhB,GACAsC,KAAA7B,KACD+B,MAAA,QAKCrC,SAAUJ,EAAKyB,IADfgB,GAAOM,UAAAlB,QAAAb,WAFFoF,EAAA9E,UAGLlB,EAAAA,SAAeqB,KAAAA,EAAAA,IAHjBzB,EAAAsB,UAAA8E,GAAAA,EAAAnC,eASEjE,EAAKsB,SAASnB,KAAKF,EAAMA,GAH3BD,GAEOA,EAAIA,eACTA,EAAAA,eAAAG,KAAAF,EAAAA,GAMOS,KAAKX,gBAHdW,KAAIV,eAAaD,KAAAA,EAAjBE,GAKCS,KAAA6E,OAAA7E,KAAA6E,MAAAiB,QAICzF,KAAKZ,KAAKO,KAAMA,KAAK6E,MAAMkB,SAA3B1F,EAAAA,KACDd,EAAA,MAIAyG,KAAKhG,MAAOA,KAAKJ,OAAOqF,cADzB1F,8BAIL6E","file":"AX6UIDialog.js","sourcesContent":["import jQuery from \"jqmin\";\nimport AX6UICore from \"./AX6UICore.js\";\nimport U from \"./AX6Util.js\";\nimport info from \"./AX6Info.js\";\nimport mustache from \"./AX6Mustache.js\";\n\n/* ~~~~~~~~~~~~~~~~~~ end of import  ~~~~~~~~~~~~~~~~~~~~ */\n\nconst dialogTmpl = function (columnKeys) {\n  return ` \n<div id=\"{{dialogId}}\" data-dialog-els=\"root\" data-ax6ui-dialog=\"\" class=\"{{theme}}\">\n    <div class=\"ax-dialog-header\" data-dialog-els=\"header\">\n        {{{title}}}\n    </div>\n    <div class=\"ax-dialog-body\" data-dialog-els=\"body\">\n        <div class=\"ax-dialog-msg\">{{{msg}}}</div>\n        \n        {{#input}}\n        <div class=\"ax-dialog-prompt\">\n            {{#@each}}\n            <div class=\"form-group\">\n            {{#@value.label}}\n            <label>{{#_crlf}}{{{.}}}{{/_crlf}}</label>\n            {{/@value.label}}\n            <input type=\"{{@value.type}}\" placeholder=\"{{@value.placeholder}}\" class=\"form-control {{@value.theme}}\" data-dialog-prompt=\"{{@key}}\" style=\"width:100%;\" value=\"{{@value.value}}\" />\n            {{#@value.help}}\n            <p class=\"help-block\">{{#_crlf}}{{.}}{{/_crlf}}</p>\n            {{/@value.help}}\n            </div>\n            {{/@each}}\n        </div>\n        {{/input}}\n        \n        <div class=\"ax-dialog-buttons\" data-dialog-els=\"buttons\">\n            <div class=\"ax-button-wrap\">\n            {{#btns}}\n                {{#@each}}\n                <button type=\"button\" data-dialog-btn=\"{{@key}}\" class=\"btn btn-{{@value.theme}}\">{{@value.label}}</button>\n                {{/@each}}\n            {{/btns}}\n            </div>\n        </div>\n        \n        {{#additionalContent}}\n        <div data-dialog-els=\"additional-content\">{{{.}}}</div>\n        {{/additionalContent}}\n    </div>\n</div>  \n`;\n};\nconst onStateChanged = function (opts, that) {\n  if (opts && opts.onStateChanged) {\n    opts.onStateChanged.call(that, that);\n  }\n  else if (this.onStateChanged) {\n    this.onStateChanged.call(that, that);\n  }\n\n  opts = null;\n  that = null;\n  return true;\n};\nconst getContent = function (dialogId, opts) {\n  let data = {\n    dialogId: dialogId,\n    title: (opts.title || this.config.title || \"\"),\n    msg: (opts.msg || this.config.msg || \"\").replace(/\\n/g, \"<br/>\"),\n    input: opts.input,\n    btns: opts.btns,\n    '_crlf': function () {\n      return this.replace(/\\n/g, \"<br/>\");\n    },\n    additionalContent: (function (additionalContent) {\n      if (U.isFunction(additionalContent)) {\n        return additionalContent.call(opts);\n      }\n      else {\n        return additionalContent;\n      }\n    })(opts.additionalContent)\n  };\n\n  return mustache.render(dialogTmpl.call(this), data);\n};\nconst open = function (opts, callback) {\n  let pos = {},\n      box = {\n        width: opts.width\n      };\n\n  this.dialogConfig = opts;\n  this.$activeDialog = jQuery(getContent.call(this, opts.id, opts));\n  this.$activeDialog.css({width: box.width});\n  jQuery(document.body).append(this.$activeDialog);\n\n  if (typeof callback === \"undefined\") {\n    callback = opts.callback;\n  }\n\n  // dialog 높이 구하기 - 너비가 정해지면 높이가 변경 될 것.\n  opts.height = box.height = this.$activeDialog.height();\n\n  //- position 정렬\n  if (typeof opts.position === \"undefined\" || opts.position === \"center\") {\n    pos.top = jQuery(window).height() / 2 - box.height / 2;\n    pos.left = jQuery(window).width() / 2 - box.width / 2;\n  }\n  else {\n    pos.left = opts.position.left || 0;\n    pos.top = opts.position.top || 0;\n  }\n  if (this.config.zIndex) {\n    pos[\"z-index\"] = this.config.zIndex;\n  }\n\n  this.$activeDialog\n    .css(pos)\n    .on(opts.clickEventName, \"[data-dialog-btn]\", (e) => {\n      btnOnClick.call(this, e || window.event, opts, callback);\n    })\n    .find(opts.dialogType === \"prompt\" ? \"[data-dialog-prompt]\" : \"[data-dialog-btn]\").trigger(\"focus\");\n\n\n  // bind key event\n  jQuery(window)\n    .on(\"keydown.ax6dialog\", (e) => {\n      onKeyup.call(this, e || window.event, opts, callback);\n    })\n    .on(\"resize.ax6dialog\", U.throttle(function (e) {\n      align.call(this, e || window.event);\n    }, 30).bind(this));\n\n  onStateChanged.call(this, opts, {\n    self: this,\n    state: \"open\"\n  });\n\n  if (opts.autoCloseTime) {\n    this.autoCloseTimer = setTimeout(() => {\n      this.close();\n    }, opts.autoCloseTime);\n  }\n\n  pos = null;\n  box = null;\n};\nconst align = function (e) {\n  if (!this.$activeDialog) return this;\n  let opts = this.dialogConfig,\n      box  = {\n        width: opts.width,\n        height: opts.height\n      };\n\n  //- position 정렬\n  if (typeof opts.position === \"undefined\" || opts.position === \"center\") {\n    box.top = window.innerHeight / 2 - box.height / 2;\n    box.left = window.innerWidth / 2 - box.width / 2;\n  }\n  else {\n    box.left = opts.position.left || 0;\n    box.top = opts.position.top || 0;\n  }\n  if (box.left < 0) box.left = 0;\n  if (box.top < 0) box.top = 0;\n\n  this.$activeDialog.css(box);\n\n  opts = null;\n  box = null;\n\n  return this;\n};\nconst btnOnClick = function (e, opts, callback, target, k) {\n  let that,\n      emptyKey = null;\n\n  if (e.srcElement) e.target = e.srcElement;\n\n  target = U.findParentNode(e.target, function (target) {\n    if (target.getAttribute(\"data-dialog-btn\")) {\n      return true;\n    }\n  });\n\n  if (target) {\n    k = target.getAttribute(\"data-dialog-btn\");\n\n    that = {\n      self: this,\n      key: k, value: opts.btns[k],\n      dialogId: opts.id,\n      btnTarget: target\n    };\n    if (opts.dialogType === \"prompt\") {\n      that.input = {};\n      for (let oi in opts.input) {\n        that.input[oi] = this.$activeDialog.find('[data-dialog-prompt=' + oi + ']').val();\n        if (opts.input[oi].required && (that.input[oi] == \"\" || that.input[oi] == null)) {\n          emptyKey = oi;\n          break;\n        }\n      }\n    }\n    if (opts.btns[k].onClick) {\n      opts.btns[k].onClick.call(that, that);\n    }\n    else if (opts.dialogType === \"alert\") {\n      if (callback) callback.call(that, that);\n      this.close({doNotCallback: true});\n    }\n    else if (opts.dialogType === \"confirm\") {\n      if (callback) callback.call(that, that);\n      this.close({doNotCallback: true});\n    }\n    else if (opts.dialogType === \"prompt\") {\n      if (k === 'ok') {\n        if (emptyKey) {\n          this.$activeDialog.find('[data-dialog-prompt=\"' + emptyKey + '\"]').get(0).focus();\n          return false;\n        }\n      }\n      if (callback) callback.call(that, that);\n      this.close({doNotCallback: true});\n    }\n  }\n\n  that = null;\n  opts = null;\n  callback = null;\n  target = null;\n  k = null;\n};\nconst onKeyup = function (e, opts, callback, target, k) {\n  let that,\n      emptyKey = null;\n\n  if (e.keyCode == info.eventKeys.ESC) {\n    this.close();\n  }\n  if (opts.dialogType === \"prompt\") {\n    if (e.keyCode == info.eventKeys.RETURN) {\n      that = {\n        self: this,\n        key: k, value: opts.btns[k],\n        dialogId: opts.id,\n        btnTarget: target\n      };\n      that.input = {};\n\n      for (let oi in opts.input) {\n        that.input[oi] = this.$activeDialog.find('[data-dialog-prompt=' + oi + ']').val();\n        if (opts.input[oi].required && (that.input[oi] == \"\" || that.input[oi] == null)) {\n          emptyKey = oi;\n          break;\n        }\n      }\n      if (emptyKey) {\n        that = null;\n        emptyKey = null;\n        return false;\n      }\n      if (callback) callback.call(that, that);\n      this.close({doNotCallback: true});\n    }\n  }\n\n  that = null;\n  emptyKey = null;\n  opts = null;\n  callback = null;\n  target = null;\n  k = null;\n};\n\n/* ~~~~~~~~~~~~~~~~~~ end of private  ~~~~~~~~~~~~~~~~~~~~ */\n\n/**\n * @class\n */\nclass AX6UIDialog extends AX6UICore {\n  /**\n   * @constructor\n   * @param config\n   */\n  constructor(config) {\n    super();\n\n    /**\n     * @member {JSON}\n     * @param config\n     * @param [config.theme='default']\n     * @param [config.width=300]\n     * @param [config.title='']\n     * @param [config.msg='']\n     * @param [config.lang]\n     * @param [config.lang.ok='ok']\n     * @param [config.lang.cancel='cancel']\n     * @param [config.animateTime=150]\n     * @param [config.autoCloseTime=0]\n     * @param [config.onStateChanged]\n     *\n     */\n    this.config = {\n      id: 'ax6-dialog-' + this.instanceId,\n      clickEventName: \"click\",\n      theme: 'default',\n      width: 300,\n      title: 'AX6UIDialog',\n      msg: '',\n      lang: {\n        \"ok\": \"ok\", \"cancel\": \"cancel\"\n      },\n      animateTime: 150,\n      autoCloseTime: 0\n    };\n    jQuery.extend(true, this.config, config);\n\n    // 멤버 변수 초기화\n    /**\n     * dialog가 열려있는 상태에서 다시 open이 되면 queue에 보관 하였다가 close후 open\n     * @member {Array}\n     */\n    this.queue = [];\n    /**\n     * @member {jQueryElement}\n     */\n    this.$activeDialog = null;\n    /**\n     * @member {Object}\n     */\n    this.autoCloseTimer = null;\n\n    this.init();\n  }\n\n  /**\n   * @method\n   * @param config\n   */\n  init() {\n    this.onStateChanged = this.config.onStateChanged;\n    delete this.config.onStateChanged;\n\n    // init 호출 여부\n    this.initOnce();\n  }\n\n  /**\n   * @method\n   */\n  initOnce() {\n    if (this.initialized) return this;\n    this.initialized = true;\n  }\n\n  /**\n   * @method\n   * @param opts\n   * @param callback\n   * @param tryCount\n   * @return {AX6UIDialog}\n   * @example\n   * ```js\n   * import {Dialog} from \"ax6ui\"\n   *\n   * const dialog = new Dialog();\n   * dialog.alert(\"Alert Message\");\n   * dialog.alert({\n     *     title: \"Title\",\n     *     msg: \"Alert Message\"\n     * });\n   * ```\n   */\n  alert(opts, callback, tryCount) {\n    if (typeof opts === \"undefined\") {\n      opts = {\n        title: this.config.title,\n        msg: \"\"\n      }\n    } else if (U.isString(opts)) {\n      opts = {\n        title: this.config.title,\n        msg: opts\n      }\n    }\n\n    opts = jQuery.extend(true, {}, this.config, opts, {\n      dialogType: \"alert\",\n      callback: callback\n    });\n\n    if (typeof opts.btns === \"undefined\") {\n      opts.btns = {\n        ok: {label: opts.lang[\"ok\"], theme: opts.theme}\n      };\n    }\n\n    if (this.$activeDialog) {\n      this.queue.push(opts);\n    } else {\n      open.call(this, opts, callback);\n    }\n  }\n\n  /**\n   * @method\n   * @param opts\n   * @param callback\n   * @param tryCount\n   * @return {AX6UIDialog}\n   * @example\n   * ```js\n   * import {Dialog} from \"ax6ui\"\n   *\n   * const dialog = new Dialog();\n   * dialog.confirm({\n     *     title: \"확인\",\n     *     msg: \"확인 또는 취소를 누르세요\"\n     * }, function (res) {\n     *     //console.log(this, a, b);\n     *     if(res.key == \"ok\"){\n     *         console.log(\"OK\");\n     *     }\n     *     else if(res.key == \"cancel\"){\n     *         console.log(\"CANCEL\");\n     *     }\n     * });\n   *\n   * // btns custom\n   * dialog.config({\n     *  title: \"예/아니오\",\n     *  msg: \"당신은 개발자 입니까?\",\n     *  btns: {\n     *      Y: {label: \"예\"},\n     *      N: {label: \"아니오\"}\n     *  }\n     * }, function (res) {\n     *      console.log(res);\n     * });\n   * ```\n   */\n  confirm(opts, callback, tryCount) {\n    if (typeof opts === \"undefined\") {\n      opts = {\n        title: this.config.title,\n        msg: \"\"\n      }\n    } else if (U.isString(opts)) {\n      opts = {\n        title: this.config.title,\n        msg: opts\n      }\n    }\n\n    opts = jQuery.extend(true, {}, this.config, opts, {\n      dialogType: \"confirm\",\n      callback: callback\n    });\n\n    if (typeof opts.btns === \"undefined\") {\n      opts.btns = {\n        ok: {label: opts.lang[\"ok\"], theme: opts.theme},\n        cancel: {label: opts.lang[\"cancel\"]}\n      };\n    }\n\n    if (this.$activeDialog) {\n      this.queue.push(opts);\n    } else {\n      open.call(this, opts, callback);\n    }\n\n    return this;\n  }\n\n  /**\n   * @method\n   * @param opts\n   * @param callback\n   * @param tryCount\n   * @return {AX6UIDialog}\n   * @example\n   * ```js\n   * import {Dialog} from \"ax6ui\"\n   *\n   * const dialog = new Dialog();\n   *\n   * dialog.prompt({\n     *  title: \"prompt\",\n     *  msg: '다음의 값을 입력하세요.',\n     *  input: {\n     *      data1: {label: \"data1의 라벨\", type: \"password\"},\n     *      data2: {label: \"data2의 라벨\"}\n     *  }\n     * }, function(res){\n     *      console.log(res);\n     * });\n   * ```\n   */\n  prompt(opts, callback, tryCount) {\n    if (typeof opts === \"undefined\") {\n      opts = {\n        title: this.config.title,\n        msg: \"\"\n      }\n    } else if (U.isString(opts)) {\n      opts = {\n        title: this.config.title,\n        msg: opts\n      }\n    }\n\n    opts = jQuery.extend(true, {}, this.config, opts, {\n      dialogType: \"prompt\",\n      callback: callback\n    });\n\n    if (typeof opts.input === \"undefined\") {\n      opts.input = {\n        value: {label: \"\"}\n      };\n    }\n    if (typeof opts.btns === \"undefined\") {\n      opts.btns = {\n        ok: {label: opts.lang[\"ok\"], theme: opts.theme},\n        cancel: {label: opts.lang[\"cancel\"]}\n      };\n    }\n\n    if (this.$activeDialog) {\n      this.queue.push(opts);\n    } else {\n      open.call(this, opts, callback);\n    }\n\n    return this;\n  }\n\n  /**\n   * @method\n   * @param _option\n   * @return {AX6UIDialog}\n   * @example\n   * ```js\n   * dialog.close();\n   * dialog.close({callback: function(){\n     *\n     * });\n     * ```\n     */\n  close(_option) {\n    let opts, that;\n\n    if (this.$activeDialog) {\n      if (this.autoCloseTimer) clearTimeout(this.autoCloseTimer);\n\n      opts = this.dialogConfig;\n\n      this.$activeDialog.addClass(\"destroy\");\n      jQuery(window)\n        .off(\"keydown.ax6dialog\")\n        .off(\"resize.ax6dialog\");\n\n      setTimeout((function () {\n        if (this.$activeDialog) {\n          this.$activeDialog.remove();\n          this.$activeDialog = null;\n        }\n\n        that = {\n          self: this,\n          state: \"close\",\n          dialogId: opts.id\n        };\n\n        if (_option && U.isFunction(_option.callback)) {\n          _option.callback.call(that, that);\n        } else if (opts.callback && (!_option || !_option.doNotCallback)) {\n          opts.callback.call(that, that);\n        }\n\n        if (opts && opts.onStateChanged) {\n          opts.onStateChanged.call(that, that);\n        }\n        else if (this.onStateChanged) {\n          this.onStateChanged.call(that, that);\n        }\n\n        // 열려야 할 큐가 남아 있다면 큐아이템으로 다시 open\n        if (this.queue && this.queue.length) {\n          open.call(this, this.queue.shift());\n        }\n\n        opts = null;\n        that = null;\n      }).bind(this), this.config.animateTime);\n    }\n    return this;\n  }\n}\n\nexport default AX6UIDialog;"]}