{"version":3,"sources":["tw-city-selector.js","src/handleOptions.js","src/tw-city-selector.js","src/data.js"],"names":["global","factory","exports","module","define","amd","TwCitySelector","this","handleOptions","arguments","getOptionsRequired","getOptionsExtend","optionsCustom","optionsRequired","error","length","hasOwnProperty","optionsDefault","property","elRoleName","el","elCountry","elDistrict","elZipcode","selectedCountry","selectedDistrict","only","showZipcode","bootstrapStyle","countryClassName","countryFiledName","districtClassName","districtFieldName","zipcodeClassName","zipcodeFieldName","options","getElement","init","call","els","document","querySelectorAll","Array","prototype","forEach","self","JSON","parse","stringify","getAttribute","replace","split","setElements","listenCountryChanged","listenDistrictChanged","setSelectedItem","setBootstrapStyle","querySelector","fragment","createDocumentFragment","country","createElement","appendChild","innerHTML","getCountryOptions","setAttribute","name","district","getDistrictOptions","zipcode","type","readOnly","autocomplete","placeholder","style","width","display","i","j","data","countries","isArray","indexOf","index","districts","handler","dataset","value","bind","addEventListener","event","createEvent","initEvent","dispatchEvent","resetSelectors","selectedIndex","fieldClassName","wrapperClassName","wrapper","cloneNode","reset","TwCitySelector$1"],"mappings":"CAAC,SAAUA,EAAQC,GACC,gBAAZC,UAA0C,mBAAXC,QAAyBA,OAAOD,QAAUD,IAC9D,kBAAXG,SAAyBA,OAAOC,IAAMD,OAAOH,GACnDD,EAAOM,eAAiBL,KACxBM,KAAM,WAAe,YCJR,SAASC,KDiEtB,MC/DIC,WAAU,ID2DZC,EC1DmBD,UAAU,GAAIA,UAAU,IAItCE,EAAiBF,UAAU,GAAIA,UAAU,IAGlD,QAASC,GAAmBE,EAAeC,GD2DzC,GC1DIC,GAAQ,GACRC,EAASF,EAAgBE,MD6D7B,KAFAH,EC1DgBA,MAETG,KACEH,EAAcI,eAAeH,EAAgBE,MAClDD,GAASD,EAAgBE,GAAU,ID4DvC,ICzDID,EAAO,KAAM,SAAWA,EAG9B,QAASH,GAAiBC,EAAeK,GD0DvC,ICzDOL,ED0DL,MCzDOK,ED4DT,ICzDIC,ED0DJ,KCzDKA,IAAYN,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AAO,MAAO,MAAO,UAI3B,MAAO,MAAO,MAAO,MAAO,MAAO,QAEnC,MAAO,MAAO,MAAO,MAAO,MAAO,UAInC,MAAO,MAAO,MAAO,MAAO,MAAO,QAEnC,MAAO,MAAO,MAAO,MAAO,MAAO,UAInC,MAAO,OAAQ,MAAO,MAAO,MAAO,MAAO,MAAO,MACnD,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MACjD,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MACjD,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MACjD,QAEC,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MACvE,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MACtE,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,UAIrE,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAClD,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,QAEhD,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MACvE,MAAO,MAAO,MAAO,MAAO,UAI3B,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAClD,MAAO,MAAO,MAAO,MAAO,QAE3B,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MACvE,MAAO,UAIN,MAAO,MAAO,MAAO,QAErB,MAAO,MAAO,MAAO,SH8JlC,OEjQA9E,GAAeqC,UAAUyD,MAAQ,WFmFhC,MElFON,GAAexD,KAAK/B,OFgQrB8F","file":"tw-city-selector.min.js","sourcesContent":["(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.TwCitySelector = factory());\n}(this, (function () { 'use strict';\n\nvar data$1 = {\n // 縣市\n countries: ['臺北市', '基隆市', '新北市', '宜蘭縣', '桃園市', '新竹市', '新竹縣', '苗栗縣', '臺中市', '彰化縣', '南投縣', '嘉義市', '嘉義縣', '雲林縣', '臺南市', '高雄市', '澎湖縣', '金門縣', '屏東縣', '臺東縣', '花蓮縣', '連江縣'],\n\n // 區域\n districts: [\n // 臺北市\n [['中正區', '大同區', '中山區', '松山區', '大安區', '萬華區', '信義區', '士林區', '北投區', '內湖區', '南港區', '文山區'], ['100', '103', '104', '105', '106', '108', '110', '111', '112', '114', '115', '116']],\n // 基隆市\n [['仁愛區', '信義區', '中正區', '中山區', '安樂區', '暖暖區', '七堵區'], ['200', '201', '202', '203', '204', '205', '206']],\n // 新北市\n [['萬里區', '金山區', '板橋區', '汐止區', '深坑區', '石碇區', '瑞芳區', '平溪區', '雙溪區', '貢寮區', '新店區', '坪林區', '烏來區', '永和區', '中和區', '土城區', '三峽區', '樹林區', '鶯歌區', '三重區', '新莊區', '泰山區', '林口區', '蘆洲區', '五股區', '八里區', '淡水區', '三芝區', '石門區'], ['207', '208', '220', '221', '222', '223', '224', '226', '227', '228', '231', '232', '233', '234', '235', '236', '237', '238', '239', '241', '242', '243', '244', '247', '248', '249', '251', '252', '253']],\n // 宜蘭縣\n [['宜蘭市', '頭城鎮', '礁溪鄉', '壯圍鄉', '員山鄉', '羅東鎮', '三星鄉', '大同鄉', '五結鄉', '冬山鄉', '蘇澳鎮', '南澳鄉', '釣魚臺'], ['260', '261', '262', '263', '264', '265', '266', '267', '268', '269', '270', '272', '290']],\n // 桃園市\n [['中壢區', '平鎮區', '龍潭區', '楊梅區', '新屋區', '觀音區', '桃園區', '龜山區', '八德區', '大溪區', '復興區', '大園區', '蘆竹區'], ['320', '324', '325', '326', '327', '328', '330', '333', '334', '335', '336', '337', '338']],\n // 新竹市\n [['東區', '北區', '香山區'], ['300', '300', '300']],\n // 新竹縣\n [['竹北市', '湖口鄉', '新豐鄉', '新埔鎮', '關西鎮', '芎林鄉', '寶山鄉', '竹東鎮', '五峰鄉', '橫山鄉', '尖石鄉', '北埔鄉', '峨眉鄉'], ['302', '303', '304', '305', '306', '307', '308', '310', '311', '312', '313', '314', '315']],\n // 苗栗縣\n [['竹南鎮', '頭份市', '三灣鄉', '南庄鄉', '獅潭鄉', '後龍鎮', '通霄鎮', '苑裡鎮', '苗栗市', '造橋鄉', '頭屋鄉', '公館鄉', '大湖鄉', '泰安鄉', '銅鑼鄉', '三義鄉', '西湖鄉', '卓蘭鎮'], ['350', '351', '352', '353', '354', '356', '357', '358', '360', '361', '362', '363', '364', '365', '366', '367', '368', '369']],\n // 臺中市\n [['中區', '東區', '南區', '西區', '北區', '北屯區', '西屯區', '南屯區', '太平區', '大里區', '霧峰區', '烏日區', '豐原區', '后里區', '石岡區', '東勢區', '和平區', '新社區', '潭子區', '大雅區', '神岡區', '大肚區', '沙鹿區', '龍井區', '梧棲區', '清水區', '大甲區', '外埔區', '大安區'], ['400', '401', '402', '403', '404', '406', '407', '408', '411', '412', '413', '414', '420', '421', '422', '423', '424', '426', '427', '428', '429', '432', '433', '434', '435', '436', '437', '438', '439']],\n // 彰化縣\n [['彰化市', '芬園鄉', '花壇鄉', '秀水鄉', '鹿港鎮', '福興鄉', '線西鄉', '和美鎮', '伸港鄉', '員林市', '社頭鄉', '永靖鄉', '埔心鄉', '溪湖鎮', '大村鄉', '埔鹽鄉', '田中鎮', '北斗鎮', '田尾鄉', '埤頭鄉', '溪州鄉', '竹塘鄉', '二林鎮', '大城鄉', '芳苑鄉', '二水鄉'], ['500', '502', '503', '504', '505', '506', '507', '508', '509', '510', '511', '512', '513', '514', '515', '516', '520', '521', '522', '523', '524', '525', '526', '527', '528', '530']],\n // 南投縣\n [['南投市', '中寮鄉', '草屯鎮', '國姓鄉', '埔里鎮', '仁愛鄉', '名間鄉', '集集鎮', '水里鄉', '魚池鄉', '信義鄉', '竹山鎮', '鹿谷鄉'], ['540', '541', '542', '544', '545', '546', '551', '552', '553', '555', '556', '557', '558']],\n // 嘉義市\n [['東區', '西區'], ['600', '600']],\n // 嘉義縣\n [['番路鄉', '梅山鄉', '竹崎鄉', '阿里山', '中埔鄉', '大埔鄉', '水上鄉', '鹿草鄉', '太保市', '朴子市', '東石鄉', '六腳鄉', '新港鄉', '民雄鄉', '大林鎮', '溪口鄉', '義竹鄉', '布袋鎮'], ['602', '603', '604', '605', '606', '607', '608', '611', '612', '613', '614', '615', '616', '621', '622', '623', '624', '625']],\n // 雲林縣\n [['斗南鎮', '大埤鄉', '虎尾鎮', '土庫鎮', '褒忠鄉', '東勢鄉', '臺西鄉', '崙背鄉', '麥寮鄉', '斗六市', '林內鄉', '古坑鄉', '莿桐鄉', '西螺鎮', '二崙鄉', '北港鎮', '水林鄉', '口湖鄉', '四湖鄉', '元長鄉'], ['630', '631', '632', '633', '634', '635', '636', '637', '638', '640', '643', '646', '647', '648', '649', '651', '652', '653', '654', '655']],\n // 臺南市\n [['中西區', '東區', '南區', '北區', '安平區', '安南區', '永康區', '歸仁區', '新化區', '左鎮區', '玉井區', '楠西區', '南化區', '仁德區', '關廟區', '龍崎區', '官田區', '麻豆區', '佳里區', '西港區', '七股區', '將軍區', '學甲區', '北門區', '新營區', '後壁區', '白河區', '東山區', '六甲區', '下營區', '柳營區', '鹽水區', '善化區', '大內區', '山上區', '新市區', '安定區'], ['700', '701', '702', '704', '708', '709', '710', '711', '712', '713', '714', '715', '716', '717', '718', '719', '720', '721', '722', '723', '724', '725', '726', '727', '730', '731', '732', '733', '734', '735', '736', '737', '741', '742', '743', '744', '745']],\n // 高雄市\n [['新興區', '前金區', '苓雅區', '鹽埕區', '鼓山區', '旗津區', '前鎮區', '三民區', '楠梓區', '小港區', '左營區', '仁武區', '大社區', '東沙群島', '南沙群島', '岡山區', '路竹區', '阿蓮區', '田寮區', '燕巢區', '橋頭區', '梓官區', '彌陀區', '永安區', '湖內區', '鳳山市', '大寮區', '林園區', '鳥松區', '大樹區', '旗山區', '美濃區', '六龜區', '內門區', '杉林區', '甲仙區', '桃源區', '那瑪夏區', '茂林區', '茄萣區'], ['800', '801', '802', '803', '804', '805', '806', '807', '811', '812', '813', '814', '815', '817', '819', '820', '821', '822', '823', '824', '825', '826', '827', '828', '829', '830', '831', '832', '833', '840', '842', '843', '844', '845', '846', '847', '848', '849', '851', '852']],\n // 澎湖縣\n [['馬公市', '西嶼鄉', '望安鄉', '七美鄉', '白沙鄉', '湖西鄉'], ['880', '881', '882', '883', '884', '885']],\n // 金門縣\n [['金沙鎮', '金湖鎮', '金寧鄉', '金城鎮', '烈嶼鄉', '烏坵鄉'], ['890', '891', '892', '893', '894', '896']],\n // 屏東縣\n [['屏東市', '三地門鄉', '霧臺鄉', '瑪家鄉', '九如鄉', '里港鄉', '高樹鄉', '鹽埔鄉', '長治鄉', '麟洛鄉', '竹田鄉', '內埔鄉', '萬丹鄉', '潮州鎮', '泰武鄉', '來義鄉', '萬巒鄉', '崁頂鄉', '新埤鄉', '南州鄉', '林邊鄉', '東港鎮', '琉球鄉', '佳冬鄉', '新園鄉', '枋寮鄉', '枋山鄉', '春日鄉', '獅子鄉', '車城鄉', '牡丹鄉', '恆春鎮', '滿州鄉'], ['900', '901', '902', '903', '904', '905', '906', '907', '908', '909', '911', '912', '913', '920', '921', '922', '923', '924', '925', '926', '927', '928', '929', '931', '932', '940', '941', '942', '943', '944', '945', '946', '947']],\n // 臺東縣\n [['臺東市', '綠島鄉', '蘭嶼鄉', '延平鄉', '卑南鄉', '鹿野鄉', '關山鎮', '海端鄉', '池上鄉', '東河鄉', '成功鎮', '長濱鄉', '太麻里', '金峰鄉', '大武鄉', '達仁鄉'], ['950', '951', '952', '953', '954', '955', '956', '957', '958', '959', '961', '962', '963', '964', '965', '966']],\n // 花蓮縣\n [['花蓮市', '新城鄉', '秀林鄉', '吉安鄉', '壽豐鄉', '鳳林鎮', '光復鄉', '豐濱鄉', '瑞穗鄉', '萬榮鄉', '玉里鎮', '卓溪鄉', '富里鄉'], ['970', '971', '972', '973', '974', '975', '976', '977', '978', '979', '981', '982', '983']],\n // 連江縣\n [['南竿鄉', '北竿鄉', '莒光鄉', '東引鄉'], ['209', '210', '211', '212']]]\n};\n\nfunction handleOptions() {\n // Check options required\n if (arguments[1]) {\n getOptionsRequired(arguments[0], arguments[1]);\n }\n\n // Extend options\n return getOptionsExtend(arguments[0], arguments[2]);\n}\n\nfunction getOptionsRequired(optionsCustom, optionsRequired) {\n var error = '';\n var length = optionsRequired.length;\n optionsCustom = optionsCustom || {};\n\n while (length--) {\n if (!optionsCustom.hasOwnProperty(optionsRequired[length])) error += optionsRequired[length] + ',';\n }\n\n if (error) throw '缺少參數: ' + error;\n}\n\nfunction getOptionsExtend(optionsCustom, optionsDefault) {\n if (!optionsCustom) {\n return optionsDefault;\n }\n\n var property;\n for (property in optionsCustom) {\n optionsDefault[property] = optionsCustom[property];\n }\n\n return optionsDefault;\n}\n\n// --------------------\n// Module import\n// --------------------\n\n// module.exports = TwCitySelector; /* use browserify to build */\n\n\n// --------------------\n// Constructor\n// --------------------\nfunction TwCitySelector$1() {\n\n\tvar elRoleName = 'tw-city-selector';\n\n\t// --- Setting options ---\n\tvar optionsCustom = arguments[0];\n\tvar optionsRequired = arguments.length ? ['el'] : null; // 設置必要參數,若無帶入任何參數則設不設置\n\tvar optionsDefault = {\n\t\tel: null,\n\t\telCountry: null,\n\t\telDistrict: null,\n\t\telZipcode: null,\n\t\tselectedCountry: null, // {boolean} 預設選擇的縣市\n\t\tselectedDistrict: null, //{boolean} 預設選擇的區域\n\t\tonly: null, // {array} 限制顯示哪些縣市\n\t\tshowZipcode: false, // {boolean} 是否顯示郵遞區號欄位\n\t\tbootstrapStyle: false,\n\t\tcountryClassName: 'country',\n\t\tcountryFiledName: 'country',\n\t\tdistrictClassName: 'district',\n\t\tdistrictFieldName: 'district',\n\t\tzipcodeClassName: 'zipcode',\n\t\tzipcodeFieldName: 'zipcode'\n\t};\n\n\tthis.options = handleOptions(optionsCustom, optionsRequired, optionsDefault);\n\n\t// 有指定 element 的初始化\n\tif (this.options.el) {\n\t\tthis.el = getElement(this.options.el);\n\t\tthis.elCountry = getElement(this.options.elCountry);\n\t\tthis.elDistrict = getElement(this.options.elDistrict);\n\t\tthis.elZipcode = getElement(this.options.elZipcode);\n\n\t\tinit.call(this);\n\n\t\treturn this;\n\t}\n\n\t// 無指定 element 的初始化,使用 role-attribute element 作為預設 elements\n\tvar els = document.querySelectorAll('[role=' + elRoleName + ']');\n\tArray.prototype.forEach.call(els, function (el) {\n\t\tvar self = JSON.parse(JSON.stringify(this)); // clone object,因 object 為參考\n\n\t\t// 重置設定\n\t\tself.el = el;\n\t\tself.elCountry = null;\n\t\tself.elDistrict = null;\n\t\tself.elZipcode = null;\n\n\t\t// 限制顯示哪些縣市\n\t\tself.options.only = el.getAttribute('data-only') ? el.getAttribute('data-only').replace(/\\s/g, '').split(',') // 去除空白字元,轉陣列\n\t\t: null;\n\n\t\t// 預設選擇的縣市\n\t\tself.options.selectedCountry = el.getAttribute('data-selected-country');\n\n\t\t// 預設選擇的區域\n\t\tself.options.selectedDistrict = el.getAttribute('data-selected-district');\n\n\t\t// 是否使用 bootstrap 樣式\n\t\tself.options.bootstrapStyle = el.getAttribute('data-bootstrap-style') != null;\n\n\t\t// 是否顯示郵遞區號\n\t\tself.options.showZipcode = el.getAttribute('data-show-zipcode') != null;\n\n\t\tinit.call(self);\n\t}, this);\n\n\t// return this;\n}\n\n// --------------------\n// Public Methods\n// --------------------\n// TwCitySelector.prototype.init = function() {\n// \treturn init.call(this);\n// };\n\nTwCitySelector$1.prototype.reset = function () {\n\treturn resetSelectors.call(this);\n};\n\n// --------------------\n// Private Methods\n// --------------------\nfunction init() {\n\tsetElements.call(this);\n\tlistenCountryChanged.call(this);\n\tlistenDistrictChanged.call(this);\n\n\t// 有設定預設選定的縣市\n\tif (this.options.selectedCountry) {\n\t\tsetSelectedItem.call(this);\n\t}\n\n\t// bootstrap 樣式套入\n\tif (this.options.bootstrapStyle) {\n\t\tsetBootstrapStyle.call(this);\n\t}\n\n\treturn this;\n}\n\nfunction getElement(el) {\n\treturn el ? document.querySelector(el) : null;\n}\n\nfunction setElements() {\n\tvar fragment = document.createDocumentFragment();\n\n\t// 縣市選單\n\tif (!this.elCountry) {\n\t\tvar country = document.createElement('select');\n\t\tthis.elCountry = country;\n\t\tfragment.appendChild(country);\n\t}\n\n\t// 縣市選單屬性\n\tthis.elCountry.innerHTML = getCountryOptions(this.options.only);\n\tthis.elCountry.setAttribute('class', this.options.countryClassName);\n\tthis.elCountry.name = this.options.countryFiledName;\n\n\t// 區域選單\n\tif (!this.elDistrict) {\n\t\tvar district = document.createElement('select');\n\t\tthis.elDistrict = district;\n\t\tfragment.appendChild(district);\n\t}\n\n\t// 區域選單屬性\n\tthis.elDistrict.innerHTML = getDistrictOptions();\n\tthis.elDistrict.setAttribute('class', this.options.districtClassName);\n\tthis.elDistrict.name = this.options.districtFieldName;\n\n\t// 郵遞區號\n\tif (!this.elZipcode) {\n\t\tvar zipcode = document.createElement('input');\n\t\tthis.elZipcode = zipcode;\n\t\tfragment.appendChild(zipcode);\n\t}\n\n\t// 郵遞區號屬性設定\n\tthis.elZipcode.setAttribute('class', this.options.zipcodeClassName);\n\tthis.elZipcode.name = this.options.zipcodeFieldName;\n\tthis.elZipcode.type = 'text';\n\tthis.elZipcode.readOnly = true;\n\tthis.elZipcode.autocomplete = 'off';\n\tthis.elZipcode.placeholder = '郵遞區號';\n\tthis.elZipcode.style.width = '6em';\n\tthis.elZipcode.style.display = this.options.showZipcode || 'none';\n\n\t// element 片段塞入 el\n\tthis.el.appendChild(fragment);\n}\n\nfunction getCountryOptions(only) {\n\tvar options = '';\n\n\tfor (var i = 0, j = data$1.countries.length; i < j; i++) {\n\t\t// 若有設定限制顯示的縣市,且該項目不在自訂縣市中\n\t\tif (only && Array.isArray(only) && only.indexOf(data$1.countries[i]) === -1) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// format: \n\t\toptions += '';\n\t}\n\n\treturn options;\n}\n\nfunction getDistrictOptions(index) {\n\tif (!index) {\n\t\treturn '';\n\t}\n\n\tvar options = '';\n\n\tfor (var i = 0, j = data$1.districts[index][0].length - 1; i <= j; i++) {\n\t\t// format: \n\t\toptions += '';\n\t}\n\n\treturn options;\n}\n\nfunction listenCountryChanged() {\n\tvar handler = function () {\n\t\tvar index = this.elCountry.querySelector('option:checked').dataset.index;\n\t\tthis.elDistrict.innerHTML = getDistrictOptions(index);\n\t\tthis.elZipcode.value = '';\n\t}.bind(this);\n\n\tthis.elCountry.addEventListener('change', handler);\n}\n\nfunction listenDistrictChanged() {\n\tvar handler = function () {\n\t\tvar zipcode = this.elDistrict.querySelector('option:checked').dataset.zipcode;\n\t\tthis.elZipcode.value = zipcode;\n\t}.bind(this);\n\n\tthis.elDistrict.addEventListener('change', handler);\n}\n\nfunction setSelectedItem() {\n\tvar event = document.createEvent('Event');\n\tevent.initEvent('change', true, true);\n\n\tthis.elCountry.value = this.options.selectedCountry;\n\tthis.elCountry.dispatchEvent(event);\n\n\tif (this.options.selectedDistrict) {\n\t\tthis.elDistrict.value = this.options.selectedDistrict;\n\t\tthis.elDistrict.dispatchEvent(event);\n\t}\n}\n\nfunction resetSelectors() {\n\tthis.elCountry.selectedIndex = 0;\n\tthis.elDistrict.innerHTML = getDistrictOptions();\n\tthis.elZipcode.value = '';\n\n\treturn this;\n}\n\nfunction setBootstrapStyle() {\n\tvar fieldClassName = 'form-control';\n\tvar wrapperClassName = 'form-group';\n\tvar fragment = document.createDocumentFragment();\n\n\tthis.elCountry.setAttribute('class', fieldClassName);\n\tthis.elDistrict.setAttribute('class', fieldClassName);\n\tthis.elZipcode.setAttribute('class', fieldClassName);\n\n\tvar wrapper = document.createElement('div');\n\twrapper.setAttribute('class', wrapperClassName);\n\n\tvar elCountry = wrapper.cloneNode();\n\telCountry.appendChild(this.elCountry);\n\tfragment.appendChild(elCountry);\n\n\tvar elDistrict = wrapper.cloneNode();\n\telDistrict.appendChild(this.elDistrict);\n\tfragment.appendChild(elDistrict);\n\n\tvar elZipcode = wrapper.cloneNode();\n\telZipcode.appendChild(this.elZipcode);\n\tfragment.appendChild(elZipcode);\n\n\tthis.el.appendChild(fragment);\n}\n\nreturn TwCitySelector$1;\n\n})));\n","export default function handleOptions() {\n // Check options required\n if (arguments[1]) {\n getOptionsRequired(arguments[0], arguments[1]);\n }\n \n // Extend options\n return getOptionsExtend(arguments[0], arguments[2]);\n}\n\nfunction getOptionsRequired(optionsCustom, optionsRequired) {\n var error = '';\n var length = optionsRequired.length;\n optionsCustom = optionsCustom || {};\n\n while (length--) {\n if ( ! optionsCustom.hasOwnProperty(optionsRequired[length])) \n error += optionsRequired[length] + ',';\n }\n \n if (error) throw '缺少參數: ' + error;\n}\n\nfunction getOptionsExtend(optionsCustom, optionsDefault) {\n if ( ! optionsCustom) {\n return optionsDefault;\n }\n \n var property;\n for (property in optionsCustom) {\n optionsDefault[property] = optionsCustom[property];\n }\n \n return optionsDefault;\n}","'use strict';\n\n// --------------------\n// Module import\n// --------------------\nimport data from './data';\nimport handleOptions from './handleOptions';\n\n\n// --------------------\n// Module export\n// --------------------\nexport default TwCitySelector; /* use rollup to build */\n// module.exports = TwCitySelector; /* use browserify to build */\n\n\n// --------------------\n// Constructor\n// --------------------\nfunction TwCitySelector() {\n\n\tvar elRoleName = 'tw-city-selector';\n\n\t// --- Setting options ---\n\tvar optionsCustom = arguments[0];\n\tvar optionsRequired = arguments.length ? ['el'] : null; // 設置必要參數,若無帶入任何參數則設不設置\n\tvar optionsDefault = {\n\t\tel: null,\n\t\telCountry: null,\n\t\telDistrict: null,\n\t\telZipcode: null,\n\t\tselectedCountry: null, // {boolean} 預設選擇的縣市\n\t\tselectedDistrict: null, //{boolean} 預設選擇的區域\n\t\tonly: null, // {array} 限制顯示哪些縣市\n\t\tshowZipcode: false, // {boolean} 是否顯示郵遞區號欄位\n\t\tbootstrapStyle: false,\n\t\tcountryClassName: 'country',\n\t\tcountryFiledName: 'country',\n\t\tdistrictClassName: 'district',\n\t\tdistrictFieldName: 'district',\n\t\tzipcodeClassName: 'zipcode',\n\t\tzipcodeFieldName: 'zipcode'\n\t};\n\n\tthis.options = handleOptions(optionsCustom, optionsRequired, optionsDefault);\n\n\t// 有指定 element 的初始化\n\tif (this.options.el) {\n\t\tthis.el = getElement(this.options.el);\n\t\tthis.elCountry = getElement(this.options.elCountry);\n\t\tthis.elDistrict = getElement(this.options.elDistrict);\n\t\tthis.elZipcode = getElement(this.options.elZipcode);\n\n\t\tinit.call(this);\n\n\t\treturn this;\n\t}\n\n\t// 無指定 element 的初始化,使用 role-attribute element 作為預設 elements\n\tvar els = document.querySelectorAll('[role='+ elRoleName +']');\n\tArray.prototype.forEach.call(els, function(el) {\n\t\tvar self = JSON.parse(JSON.stringify(this)); // clone object,因 object 為參考\n\n\t\t// 重置設定\n\t\tself.el = el;\n\t\tself.elCountry = null;\n\t\tself.elDistrict = null;\n\t\tself.elZipcode = null;\n\n\t\t// 限制顯示哪些縣市\n\t\tself.options.only = el.getAttribute('data-only')\n\t\t\t? el.getAttribute('data-only').replace(/\\s/g, '').split(',') // 去除空白字元,轉陣列\n\t\t\t: null;\n\n\t\t// 預設選擇的縣市\n\t\tself.options.selectedCountry = el.getAttribute('data-selected-country');\n\n\t\t// 預設選擇的區域\n\t\tself.options.selectedDistrict = el.getAttribute('data-selected-district');\n\n\t\t// 是否使用 bootstrap 樣式\n\t\tself.options.bootstrapStyle = (el.getAttribute('data-bootstrap-style') != null);\n\n\t\t// 是否顯示郵遞區號\n\t\tself.options.showZipcode = (el.getAttribute('data-show-zipcode') != null);\n\n\t\tinit.call(self);\n\t}, this);\n\n\t// return this;\n};\n\n\n// --------------------\n// Public Methods\n// --------------------\n// TwCitySelector.prototype.init = function() {\n// \treturn init.call(this);\n// };\n\nTwCitySelector.prototype.reset = function() {\n\treturn resetSelectors.call(this);\n};\n\n\n// --------------------\n// Private Methods\n// --------------------\nfunction init() {\n\tsetElements.call(this);\n\tlistenCountryChanged.call(this);\n\tlistenDistrictChanged.call(this);\n\n\t// 有設定預設選定的縣市\n\tif (this.options.selectedCountry) {\n\t\tsetSelectedItem.call(this);\n\t}\n\n\t// bootstrap 樣式套入\n\tif (this.options.bootstrapStyle) {\n\t\tsetBootstrapStyle.call(this);\n\t}\n\n\treturn this;\n}\n\nfunction getElement(el) {\n\treturn el ? document.querySelector(el) : null;\n}\n\nfunction setElements() {\n\tvar fragment = document.createDocumentFragment();\n\n\t// 縣市選單\n\tif ( ! this.elCountry) {\n\t\tvar country = document.createElement('select');\n\t\tthis.elCountry = country;\n\t\tfragment.appendChild(country);\n\t}\n\n\t// 縣市選單屬性\n\tthis.elCountry.innerHTML = getCountryOptions(this.options.only);\n\tthis.elCountry.setAttribute('class', this.options.countryClassName);\n\tthis.elCountry.name = this.options.countryFiledName;\n\n\t// 區域選單\n\tif ( ! this.elDistrict) {\n\t\tvar district = document.createElement('select');\n\t\tthis.elDistrict = district;\n\t\tfragment.appendChild(district);\n\t}\n\n\t// 區域選單屬性\n\tthis.elDistrict.innerHTML = getDistrictOptions();\n\tthis.elDistrict.setAttribute('class', this.options.districtClassName);\n\tthis.elDistrict.name = this.options.districtFieldName;\n\n\t// 郵遞區號\n\tif ( ! this.elZipcode) {\n\t\tvar zipcode = document.createElement('input');\n\t\tthis.elZipcode = zipcode;\n\t\tfragment.appendChild(zipcode);\n\t}\n\n\t// 郵遞區號屬性設定\n\tthis.elZipcode.setAttribute('class', this.options.zipcodeClassName);\n\tthis.elZipcode.name = this.options.zipcodeFieldName;\n\tthis.elZipcode.type = 'text';\n\tthis.elZipcode.readOnly = true;\n\tthis.elZipcode.autocomplete = 'off';\n\tthis.elZipcode.placeholder = '郵遞區號';\n\tthis.elZipcode.style.width = '6em';\n\tthis.elZipcode.style.display = this.options.showZipcode || 'none';\n\n\t// element 片段塞入 el\n\tthis.el.appendChild(fragment);\n}\n\nfunction getCountryOptions(only) {\n\tvar options = '';\n\n\tfor (var i = 0, j = data.countries.length; i < j; i++) {\n\t\t// 若有設定限制顯示的縣市,且該項目不在自訂縣市中\n\t\tif (only && Array.isArray(only) && only.indexOf(data.countries[i]) === -1) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// format: \n\t\toptions += ``;\n\t}\n\n\treturn options;\n}\n\nfunction getDistrictOptions(index) {\n\tif ( ! index) {\n\t\treturn '';\n\t}\n\n\tvar options = '';\n\n\tfor(var i = 0, j = data.districts[index][0].length - 1; i <= j; i++) {\n\t\t// format: \n\t\toptions += ``;\n\t}\n\n\treturn options;\n}\n\nfunction listenCountryChanged() {\n\tvar handler = function() {\n\t\tvar index = this.elCountry.querySelector('option:checked').dataset.index;\n\t\tthis.elDistrict.innerHTML = getDistrictOptions(index);\n\t\tthis.elZipcode.value = '';\n\t}.bind(this);\n\n\tthis.elCountry.addEventListener('change', handler);\n}\n\nfunction listenDistrictChanged() {\n\tvar handler = function() {\n\t\tvar zipcode = this.elDistrict.querySelector('option:checked').dataset.zipcode;\n\t\tthis.elZipcode.value = zipcode;\n\t}.bind(this);\n\n\tthis.elDistrict.addEventListener('change', handler);\n}\n\nfunction setSelectedItem() {\n\tvar event = document.createEvent('Event');\n\tevent.initEvent('change', true, true);\n\n\tthis.elCountry.value = this.options.selectedCountry;\n\tthis.elCountry.dispatchEvent(event);\n\n\tif (this.options.selectedDistrict) {\n\t\tthis.elDistrict.value = this.options.selectedDistrict;\n\t\tthis.elDistrict.dispatchEvent(event);\n\t}\n}\n\nfunction resetSelectors() {\n\tthis.elCountry.selectedIndex = 0;\n\tthis.elDistrict.innerHTML = getDistrictOptions();\n\tthis.elZipcode.value = '';\n\n\treturn this;\n}\n\nfunction setBootstrapStyle() {\n\tvar fieldClassName = 'form-control';\n var wrapperClassName = 'form-group';\n\tvar fragment = document.createDocumentFragment();\n\n\tthis.elCountry.setAttribute('class', fieldClassName);\n\tthis.elDistrict.setAttribute('class', fieldClassName);\n\tthis.elZipcode.setAttribute('class', fieldClassName);\n\n var wrapper = document.createElement('div');\n wrapper.setAttribute('class', wrapperClassName);\n\n\tvar elCountry = wrapper.cloneNode();\n\telCountry.appendChild(this.elCountry);\n\tfragment.appendChild(elCountry);\n\n\tvar elDistrict = wrapper.cloneNode();\n\telDistrict.appendChild(this.elDistrict);\n\tfragment.appendChild(elDistrict);\n\n\tvar elZipcode = wrapper.cloneNode();\n\telZipcode.appendChild(this.elZipcode);\n\tfragment.appendChild(elZipcode);\n\n\tthis.el.appendChild(fragment);\n}\n","export default data;\n\nvar data = {\n // 縣市\n countries: [\n '臺北市', '基隆市', '新北市', '宜蘭縣', '桃園市', '新竹市', '新竹縣', '苗栗縣',\n '臺中市', '彰化縣', '南投縣', '嘉義市', '嘉義縣', '雲林縣', '臺南市', '高雄市',\n '澎湖縣', '金門縣', '屏東縣', '臺東縣', '花蓮縣', '連江縣'\n ],\n\n // 區域\n districts: [\n // 臺北市\n [\n ['中正區', '大同區', '中山區', '松山區', '大安區', '萬華區', '信義區',\n '士林區', '北投區', '內湖區', '南港區', '文山區'],\n\n ['100', '103', '104', '105', '106', '108', '110', '111', '112', '114', '115', '116']\n ],\n // 基隆市\n [\n ['仁愛區', '信義區', '中正區', '中山區', '安樂區', '暖暖區', '七堵區'],\n\n ['200', '201', '202', '203', '204', '205', '206']\n ],\n // 新北市\n [\n ['萬里區', '金山區', '板橋區', '汐止區', '深坑區', '石碇區', '瑞芳區', '平溪區',\n '雙溪區', '貢寮區', '新店區', '坪林區', '烏來區', '永和區', '中和區', '土城區',\n '三峽區', '樹林區', '鶯歌區', '三重區', '新莊區', '泰山區', '林口區', '蘆洲區',\n '五股區', '八里區', '淡水區', '三芝區', '石門區'],\n\n ['207', '208', '220', '221', '222', '223', '224', '226', '227', '228',\n '231', '232', '233', '234', '235', '236', '237', '238', '239', '241',\n '242', '243', '244', '247', '248', '249', '251', '252', '253']\n ],\n // 宜蘭縣\n [\n ['宜蘭市', '頭城鎮', '礁溪鄉', '壯圍鄉', '員山鄉', '羅東鎮', '三星鄉', '大同鄉',\n '五結鄉', '冬山鄉', '蘇澳鎮', '南澳鄉', '釣魚臺'],\n\n ['260', '261', '262', '263', '264', '265', '266', '267', '268', '269',\n '270', '272', '290']\n ],\n // 桃園市\n \t[\n \t\t['中壢區', '平鎮區', '龍潭區', '楊梅區', '新屋區', '觀音區', '桃園區', '龜山區',\n \t\t'八德區', '大溪區', '復興區', '大園區', '蘆竹區'],\n\n \t\t['320', '324', '325', '326', '327', '328', '330', '333', '334', '335',\n \t\t'336', '337', '338']\n ],\n // 新竹市\n [\n ['東區', '北區', '香山區'],\n\n ['300', '300', '300']\n ],\n // 新竹縣\n [\n ['竹北市', '湖口鄉', '新豐鄉', '新埔鎮', '關西鎮', '芎林鄉', '寶山鄉',\n '竹東鎮', '五峰鄉', '橫山鄉', '尖石鄉', '北埔鄉', '峨眉鄉'],\n\n ['302', '303', '304', '305', '306', '307', '308', '310', '311',\n '312', '313', '314', '315']\n ],\n // 苗栗縣\n [\n ['竹南鎮', '頭份市', '三灣鄉', '南庄鄉', '獅潭鄉', '後龍鎮', '通霄鎮', '苑裡鎮',\n '苗栗市', '造橋鄉', '頭屋鄉', '公館鄉', '大湖鄉', '泰安鄉',\n '銅鑼鄉', '三義鄉', '西湖鄉', '卓蘭鎮'],\n\n ['350', '351', '352', '353', '354', '356', '357', '358', '360', '361',\n '362', '363', '364', '365', '366', '367', '368', '369']\n ],\n // 臺中市\n [\n ['中區', '東區', '南區', '西區', '北區', '北屯區', '西屯區', '南屯區', '太平區',\n '大里區', '霧峰區', '烏日區', '豐原區', '后里區', '石岡區', '東勢區', '和平區',\n '新社區', '潭子區', '大雅區', '神岡區', '大肚區', '沙鹿區', '龍井區', '梧棲區',\n '清水區', '大甲區', '外埔區', '大安區'],\n\n ['400', '401', '402', '403', '404', '406', '407', '408', '411', '412',\n '413', '414', '420', '421', '422', '423', '424', '426', '427', '428',\n '429', '432', '433', '434', '435', '436', '437', '438', '439']\n ],\n // 彰化縣\n [\n ['彰化市', '芬園鄉', '花壇鄉', '秀水鄉', '鹿港鎮', '福興鄉', '線西鄉', '和美鎮',\n '伸港鄉', '員林市', '社頭鄉', '永靖鄉', '埔心鄉', '溪湖鎮', '大村鄉', '埔鹽鄉',\n '田中鎮', '北斗鎮', '田尾鄉', '埤頭鄉', '溪州鄉', '竹塘鄉', '二林鎮', '大城鄉',\n '芳苑鄉', '二水鄉'],\n\n ['500', '502', '503', '504', '505', '506', '507', '508', '509', '510',\n '511', '512', '513', '514', '515', '516', '520', '521', '522', '523',\n '524', '525', '526', '527', '528', '530']\n ],\n // 南投縣\n [\n ['南投市', '中寮鄉', '草屯鎮', '國姓鄉', '埔里鎮', '仁愛鄉', '名間鄉', '集集鎮',\n '水里鄉', '魚池鄉', '信義鄉', '竹山鎮', '鹿谷鄉'],\n\n ['540', '541', '542', '544', '545', '546', '551', '552', '553', '555',\n '556', '557', '558']\n ],\n // 嘉義市\n [\n ['東區', '西區'],\n\n ['600', '600']\n ],\n // 嘉義縣\n [\n ['番路鄉', '梅山鄉', '竹崎鄉', '阿里山', '中埔鄉', '大埔鄉', '水上鄉',\n '鹿草鄉', '太保市', '朴子市', '東石鄉', '六腳鄉', '新港鄉', '民雄鄉', '大林鎮',\n '溪口鄉', '義竹鄉', '布袋鎮'],\n\n ['602', '603', '604', '605', '606', '607', '608', '611', '612',\n '613', '614', '615', '616', '621', '622', '623', '624', '625']\n ],\n // 雲林縣\n [\n ['斗南鎮', '大埤鄉', '虎尾鎮', '土庫鎮', '褒忠鄉', '東勢鄉', '臺西鄉', '崙背鄉',\n '麥寮鄉', '斗六市', '林內鄉', '古坑鄉', '莿桐鄉', '西螺鎮', '二崙鄉', '北港鎮',\n '水林鄉', '口湖鄉', '四湖鄉', '元長鄉'],\n\n ['630', '631', '632', '633', '634', '635', '636', '637', '638', '640', '643',\n '646', '647', '648', '649', '651', '652', '653', '654', '655']\n ],\n // 臺南市\n [\n ['中西區', '東區', '南區', '北區', '安平區', '安南區', '永康區', '歸仁區', '新化區',\n '左鎮區', '玉井區', '楠西區', '南化區', '仁德區', '關廟區', '龍崎區', '官田區',\n '麻豆區', '佳里區', '西港區', '七股區', '將軍區', '學甲區', '北門區', '新營區',\n '後壁區', '白河區', '東山區', '六甲區', '下營區', '柳營區', '鹽水區', '善化區',\n '大內區', '山上區', '新市區', '安定區'],\n\n ['700', '701', '702', '704', '708', '709', '710', '711', '712', '713', '714',\n '715', '716', '717', '718', '719', '720', '721', '722', '723', '724', '725',\n '726', '727', '730', '731', '732', '733', '734', '735', '736', '737', '741',\n '742', '743', '744', '745']\n ],\n // 高雄市\n [\n ['新興區', '前金區', '苓雅區', '鹽埕區', '鼓山區', '旗津區', '前鎮區', '三民區',\n '楠梓區', '小港區', '左營區', '仁武區', '大社區', '東沙群島', '南沙群島', '岡山區',\n '路竹區', '阿蓮區', '田寮區', '燕巢區', '橋頭區', '梓官區', '彌陀區', '永安區',\n '湖內區', '鳳山市', '大寮區', '林園區', '鳥松區', '大樹區', '旗山區', '美濃區',\n '六龜區', '內門區', '杉林區', '甲仙區', '桃源區', '那瑪夏區', '茂林區', '茄萣區'],\n\n ['800', '801', '802', '803', '804', '805', '806', '807', '811', '812', '813',\n '814', '815', '817', '819', '820', '821', '822', '823', '824', '825', '826', '827', '828',\n '829', '830', '831', '832', '833', '840', '842', '843', '844', '845', '846',\n '847', '848', '849', '851', '852']\n ],\n // 澎湖縣\n [\n ['馬公市', '西嶼鄉', '望安鄉', '七美鄉', '白沙鄉', '湖西鄉'],\n\n ['880', '881', '882', '883', '884', '885']\n ],\n // 金門縣\n [\n ['金沙鎮', '金湖鎮', '金寧鄉', '金城鎮', '烈嶼鄉', '烏坵鄉'],\n\n ['890', '891', '892', '893', '894', '896']\n ],\n // 屏東縣\n [\n ['屏東市', '三地門鄉', '霧臺鄉', '瑪家鄉', '九如鄉', '里港鄉', '高樹鄉', '鹽埔鄉',\n '長治鄉', '麟洛鄉', '竹田鄉', '內埔鄉', '萬丹鄉', '潮州鎮', '泰武鄉', '來義鄉',\n '萬巒鄉', '崁頂鄉', '新埤鄉', '南州鄉', '林邊鄉', '東港鎮', '琉球鄉', '佳冬鄉',\n '新園鄉', '枋寮鄉', '枋山鄉', '春日鄉', '獅子鄉', '車城鄉', '牡丹鄉', '恆春鎮',\n '滿州鄉'],\n\n ['900', '901', '902', '903', '904', '905', '906', '907', '908', '909', '911',\n '912', '913', '920', '921', '922', '923', '924', '925', '926', '927', '928',\n '929', '931', '932', '940', '941', '942', '943', '944', '945', '946', '947']\n ],\n // 臺東縣\n [\n ['臺東市', '綠島鄉', '蘭嶼鄉', '延平鄉', '卑南鄉', '鹿野鄉', '關山鎮', '海端鄉',\n '池上鄉', '東河鄉', '成功鎮', '長濱鄉', '太麻里', '金峰鄉', '大武鄉', '達仁鄉'],\n\n ['950', '951', '952', '953', '954', '955', '956', '957', '958', '959', '961',\n '962', '963', '964', '965', '966']\n ],\n // 花蓮縣\n [\n ['花蓮市', '新城鄉', '秀林鄉', '吉安鄉', '壽豐鄉', '鳳林鎮', '光復鄉', '豐濱鄉',\n '瑞穗鄉', '萬榮鄉', '玉里鎮', '卓溪鄉', '富里鄉'],\n\n ['970', '971', '972', '973', '974', '975', '976', '977', '978', '979', '981',\n '982', '983']\n ],\n // 連江縣\n [\n ['南竿鄉', '北竿鄉', '莒光鄉', '東引鄉'],\n\n ['209', '210', '211', '212']\n ]\n ]\n};\n"]}