From 0819e7ec55c6b4fd0f10042b0e137a1cc9f99495 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Tue, 18 Sep 2018 11:42:22 +0200 Subject: [PATCH] chore(release): 1.2.0 --- CHANGELOG.md | 16 +++++++ dist/bs-custom-file-input.js | 64 +++++++++++++++++++--------- dist/bs-custom-file-input.js.map | 2 +- dist/bs-custom-file-input.min.js | 4 +- dist/bs-custom-file-input.min.js.map | 2 +- package-lock.json | 2 +- package.json | 2 +- 7 files changed, 67 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8b74db..2064165 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,22 @@ All notable changes to this project will be documented in this file. See [standard-version](/~https://github.com/conventional-changelog/standard-version) for commit guidelines. + +# [1.2.0](/~https://github.com/Johann-S/bs-custom-file-input/compare/v1.1.1...v1.2.0) (2018-09-18) + + +### Bug Fixes + +* **core:** remove unused events and better destroy method ([2845f4e](/~https://github.com/Johann-S/bs-custom-file-input/commit/2845f4e)) + + +### Features + +* **core:** allow to use children in label elements ([e92a581](/~https://github.com/Johann-S/bs-custom-file-input/commit/e92a581)) +* **demo:** add a demo ([22f925b](/~https://github.com/Johann-S/bs-custom-file-input/commit/22f925b)) + + + ## [1.1.1](/~https://github.com/Johann-S/bs-custom-file-input/compare/v1.1.0...v1.1.1) (2018-09-05) diff --git a/dist/bs-custom-file-input.js b/dist/bs-custom-file-input.js index 6441215..c60b687 100644 --- a/dist/bs-custom-file-input.js +++ b/dist/bs-custom-file-input.js @@ -1,5 +1,5 @@ /*! - * bsCustomFileInput v1.1.1 (/~https://github.com/Johann-S/bs-custom-file-input) + * bsCustomFileInput v1.2.0 (/~https://github.com/Johann-S/bs-custom-file-input) * Copyright 2018 Johann-S * Licensed under MIT (/~https://github.com/Johann-S/bs-custom-file-input/blob/master/LICENSE) */ @@ -12,9 +12,12 @@ var Selector = { CUSTOMFILE: '.custom-file input[type="file"]', CUSTOMFILELABEL: '.custom-file-label', - FORM: 'form' + FORM: 'form', + INPUT: 'input' }; + var textNodeType = 3; + var getDefaultText = function getDefaultText(input) { var defaultText = ''; var label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL); @@ -26,12 +29,29 @@ return defaultText; }; + var findFirstChildNode = function findFirstChildNode(element) { + if (element.childNodes.length > 0) { + var childNodes = [].slice.call(element.childNodes); + + for (var i = 0; i < childNodes.length; i++) { + var node = childNodes[i]; + + if (node.nodeType !== textNodeType) { + return node; + } + } + } + + return element; + }; + var restoreDefaultText = function restoreDefaultText(input) { var defaultText = input.bsCustomFileInput.defaultText; var label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL); if (label) { - label.innerHTML = defaultText; + var element = findFirstChildNode(label); + element.innerHTML = defaultText; } }; @@ -43,36 +63,35 @@ return file.name; }); return files.join(', '); - } else { - return input.value; } + + return input.value; }; function handleInputChange() { var label = this.parentNode.querySelector(Selector.CUSTOMFILELABEL); if (label) { - label.innerHTML = getSelectedFiles(this); + var element = findFirstChildNode(label); + element.innerHTML = getSelectedFiles(this); } } function handleFormReset() { - var customFileList = [].slice.call(this.querySelectorAll(Selector.CUSTOMFILE)); + var customFileList = [].slice.call(this.querySelectorAll(Selector.INPUT)).filter(function (input) { + return !!input.bsCustomFileInput; + }); for (var i = 0, len = customFileList.length; i < len; i++) { restoreDefaultText(customFileList[i]); } } + var customProperty = 'bsCustomFileInput'; var Event = { FORMRESET: 'reset', - INPUTCHANGE: 'change', - INPUTFOCUSIN: 'focusin', - INPUTFOCUSOUT: 'focusout' + INPUTCHANGE: 'change' }; - var customProperty = 'bsCustomFileInput'; - var customFormSelector = null; - var customInputSelector = null; var bsCustomFileInput = { init: function init(inputSelector, formSelector) { if (inputSelector === void 0) { @@ -83,10 +102,8 @@ formSelector = Selector.FORM; } - customInputSelector = inputSelector; - customFormSelector = formSelector; - var customFileInputList = [].slice.call(document.querySelectorAll(customInputSelector)); - var formList = [].slice.call(document.querySelectorAll(customFormSelector)); + var customFileInputList = [].slice.call(document.querySelectorAll(inputSelector)); + var formList = [].slice.call(document.querySelectorAll(formSelector)); for (var i = 0, len = customFileInputList.length; i < len; i++) { var input = customFileInputList[i]; @@ -101,11 +118,18 @@ for (var _i = 0, _len = formList.length; _i < _len; _i++) { formList[_i].addEventListener(Event.FORMRESET, handleFormReset); + + Object.defineProperty(formList[_i], customProperty, { + value: true, + writable: true + }); } }, destroy: function destroy() { - var formList = [].slice.call(document.querySelectorAll(customFormSelector)); - var customFileInputList = [].slice.call(document.querySelectorAll(customInputSelector)).filter(function (input) { + var formList = [].slice.call(document.querySelectorAll(Selector.FORM)).filter(function (form) { + return !!form.bsCustomFileInput; + }); + var customFileInputList = [].slice.call(document.querySelectorAll(Selector.INPUT)).filter(function (input) { return !!input.bsCustomFileInput; }); @@ -118,6 +142,8 @@ for (var _i2 = 0, _len2 = formList.length; _i2 < _len2; _i2++) { formList[_i2].removeEventListener(Event.FORMRESET, handleFormReset); + + formList[_i2][customProperty] = undefined; } } }; diff --git a/dist/bs-custom-file-input.js.map b/dist/bs-custom-file-input.js.map index 0da0e5c..9906c98 100644 --- a/dist/bs-custom-file-input.js.map +++ b/dist/bs-custom-file-input.js.map @@ -1 +1 @@ -{"version":3,"file":"bs-custom-file-input.js","sources":["../src/selector.js","../src/util.js","../src/eventHandlers.js","../src/index.js"],"sourcesContent":["const Selector = {\n CUSTOMFILE: '.custom-file input[type=\"file\"]',\n CUSTOMFILELABEL: '.custom-file-label',\n FORM: 'form',\n}\n\nexport default Selector\n","import Selector from './selector'\n\nconst getDefaultText = (input) => {\n let defaultText = ''\n\n const label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n defaultText = label.innerHTML\n }\n\n return defaultText\n}\n\nconst restoreDefaultText = (input) => {\n const defaultText = input.bsCustomFileInput.defaultText\n const label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n label.innerHTML = defaultText\n }\n}\n\nexport {\n getDefaultText,\n restoreDefaultText,\n}\n","import Selector from './selector'\nimport { restoreDefaultText } from './util'\n\nconst fileApi = !!window.File\n\nconst getSelectedFiles = (input) => {\n if (input.hasAttribute('multiple') && fileApi) {\n const files = [].slice.call(input.files)\n .map((file) => file.name)\n\n return files.join(', ')\n } else {\n return input.value\n }\n}\n\nfunction handleInputChange() {\n const label = this.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n label.innerHTML = getSelectedFiles(this)\n }\n}\n\nfunction handleFormReset() {\n const customFileList = [].slice.call(this.querySelectorAll(Selector.CUSTOMFILE))\n\n for (let i = 0, len = customFileList.length; i < len; i++) {\n restoreDefaultText(customFileList[i])\n }\n}\n\nexport {\n handleInputChange,\n handleFormReset,\n}\n","import { getDefaultText, restoreDefaultText } from './util'\nimport {\n handleFormReset,\n handleInputChange,\n} from './eventHandlers'\nimport Selector from './selector'\n\nconst Event = {\n FORMRESET : 'reset',\n INPUTCHANGE : 'change',\n INPUTFOCUSIN : 'focusin',\n INPUTFOCUSOUT : 'focusout',\n}\n\nconst customProperty = 'bsCustomFileInput'\n\nlet customFormSelector = null\nlet customInputSelector = null\n\nconst bsCustomFileInput = {\n init(inputSelector = Selector.CUSTOMFILE, formSelector = Selector.FORM) {\n customInputSelector = inputSelector\n customFormSelector = formSelector\n\n const customFileInputList = [].slice.call(document.querySelectorAll(customInputSelector))\n const formList = [].slice.call(document.querySelectorAll(customFormSelector))\n\n for (let i = 0, len = customFileInputList.length; i < len; i++) {\n const input = customFileInputList[i]\n\n Object.defineProperty(input, customProperty, {\n value: {\n defaultText: getDefaultText(input),\n },\n writable: true,\n })\n\n input.addEventListener(Event.INPUTCHANGE, handleInputChange)\n }\n\n for (let i = 0, len = formList.length; i < len; i++) {\n formList[i].addEventListener(Event.FORMRESET, handleFormReset)\n }\n },\n\n destroy() {\n const formList = [].slice.call(document.querySelectorAll(customFormSelector))\n const customFileInputList = [].slice.call(document.querySelectorAll(customInputSelector))\n .filter((input) => !!input.bsCustomFileInput)\n\n for (let i = 0, len = customFileInputList.length; i < len; i++) {\n const input = customFileInputList[i]\n\n restoreDefaultText(input)\n input[customProperty] = undefined\n\n input.removeEventListener(Event.INPUTCHANGE, handleInputChange)\n }\n\n for (let i = 0, len = formList.length; i < len; i++) {\n formList[i].removeEventListener(Event.FORMRESET, handleFormReset)\n }\n },\n}\n\nexport default bsCustomFileInput\n"],"names":["Selector","CUSTOMFILE","CUSTOMFILELABEL","FORM","getDefaultText","input","defaultText","label","parentNode","querySelector","innerHTML","restoreDefaultText","bsCustomFileInput","fileApi","window","File","getSelectedFiles","hasAttribute","files","slice","call","map","file","name","join","value","handleInputChange","handleFormReset","customFileList","querySelectorAll","i","len","length","Event","FORMRESET","INPUTCHANGE","INPUTFOCUSIN","INPUTFOCUSOUT","customProperty","customFormSelector","customInputSelector","init","inputSelector","formSelector","customFileInputList","document","formList","Object","defineProperty","writable","addEventListener","destroy","filter","undefined","removeEventListener"],"mappings":";;;;;;;;;;;EAAA,IAAMA,QAAQ,GAAG;EACfC,EAAAA,UAAU,EAAE,iCADG;EAEfC,EAAAA,eAAe,EAAE,oBAFF;EAGfC,EAAAA,IAAI,EAAE;EAHS,CAAjB;;ECEA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,KAAD,EAAW;EAChC,MAAIC,WAAW,GAAG,EAAlB;EAEA,MAAMC,KAAK,GAAGF,KAAK,CAACG,UAAN,CAAiBC,aAAjB,CAA+BT,QAAQ,CAACE,eAAxC,CAAd;;EAEA,MAAIK,KAAJ,EAAW;EACTD,IAAAA,WAAW,GAAGC,KAAK,CAACG,SAApB;EACD;;EAED,SAAOJ,WAAP;EACD,CAVD;;EAYA,IAAMK,kBAAkB,GAAG,SAArBA,kBAAqB,CAACN,KAAD,EAAW;EACpC,MAAMC,WAAW,GAAGD,KAAK,CAACO,iBAAN,CAAwBN,WAA5C;EACA,MAAMC,KAAK,GAAGF,KAAK,CAACG,UAAN,CAAiBC,aAAjB,CAA+BT,QAAQ,CAACE,eAAxC,CA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at end of file +{"version":3,"file":"bs-custom-file-input.js","sources":["../src/selector.js","../src/util.js","../src/eventHandlers.js","../src/index.js"],"sourcesContent":["const Selector = {\n CUSTOMFILE: '.custom-file input[type=\"file\"]',\n CUSTOMFILELABEL: '.custom-file-label',\n FORM: 'form',\n INPUT: 'input',\n}\n\nexport default Selector\n","import Selector from './selector'\n\nconst textNodeType = 3\nconst getDefaultText = (input) => {\n let defaultText = ''\n\n const label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n defaultText = label.innerHTML\n }\n\n return defaultText\n}\n\nconst findFirstChildNode = (element) => {\n if (element.childNodes.length > 0) {\n const childNodes = [].slice.call(element.childNodes)\n\n for (let i = 0; i < childNodes.length; i++) {\n const node = childNodes[i]\n if (node.nodeType !== textNodeType) {\n return node\n }\n }\n }\n\n return element\n}\n\nconst restoreDefaultText = (input) => {\n const defaultText = input.bsCustomFileInput.defaultText\n const label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n const element = findFirstChildNode(label)\n element.innerHTML = defaultText\n }\n}\n\nexport {\n getDefaultText,\n findFirstChildNode,\n restoreDefaultText,\n}\n","import { findFirstChildNode, restoreDefaultText } from './util'\nimport Selector from './selector'\n\nconst fileApi = !!window.File\n\nconst getSelectedFiles = (input) => {\n if (input.hasAttribute('multiple') && fileApi) {\n const files = [].slice.call(input.files)\n .map((file) => file.name)\n\n return files.join(', ')\n }\n\n return input.value\n}\n\nfunction handleInputChange() {\n const label = this.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n const element = findFirstChildNode(label)\n element.innerHTML = getSelectedFiles(this)\n }\n}\n\nfunction handleFormReset() {\n const customFileList = [].slice.call(this.querySelectorAll(Selector.INPUT))\n .filter((input) => !!input.bsCustomFileInput)\n\n for (let i = 0, len = customFileList.length; i < len; i++) {\n restoreDefaultText(customFileList[i])\n }\n}\n\nexport {\n handleInputChange,\n handleFormReset,\n}\n","import { getDefaultText, restoreDefaultText } from './util'\nimport { handleFormReset, handleInputChange } from './eventHandlers'\nimport Selector from './selector'\n\nconst customProperty = 'bsCustomFileInput'\nconst Event = {\n FORMRESET : 'reset',\n INPUTCHANGE : 'change',\n}\n\nconst bsCustomFileInput = {\n init(inputSelector = Selector.CUSTOMFILE, formSelector = Selector.FORM) {\n const customFileInputList = [].slice.call(document.querySelectorAll(inputSelector))\n const formList = [].slice.call(document.querySelectorAll(formSelector))\n\n for (let i = 0, len = customFileInputList.length; i < len; i++) {\n const input = customFileInputList[i]\n\n Object.defineProperty(input, customProperty, {\n value: {\n defaultText: getDefaultText(input),\n },\n writable: true,\n })\n\n input.addEventListener(Event.INPUTCHANGE, handleInputChange)\n }\n\n for (let i = 0, len = formList.length; i < len; i++) {\n formList[i].addEventListener(Event.FORMRESET, handleFormReset)\n Object.defineProperty(formList[i], customProperty, {\n value: true,\n writable: true,\n })\n }\n },\n\n destroy() {\n const formList = [].slice.call(document.querySelectorAll(Selector.FORM))\n .filter((form) => !!form.bsCustomFileInput)\n const customFileInputList = [].slice.call(document.querySelectorAll(Selector.INPUT))\n .filter((input) => !!input.bsCustomFileInput)\n\n for (let i = 0, len = customFileInputList.length; i < len; i++) {\n const input = customFileInputList[i]\n\n restoreDefaultText(input)\n input[customProperty] = undefined\n\n input.removeEventListener(Event.INPUTCHANGE, handleInputChange)\n }\n\n for (let i = 0, len = formList.length; i < len; i++) {\n formList[i].removeEventListener(Event.FORMRESET, handleFormReset)\n formList[i][customProperty] = undefined\n }\n },\n}\n\nexport default bsCustomFileInput\n"],"names":["Selector","CUSTOMFILE","CUSTOMFILELABEL","FORM","INPUT","textNodeType","getDefaultText","input","defaultText","label","parentNode","querySelector","innerHTML","findFirstChildNode","element","childNodes","length","slice","call","i","node","nodeType","restoreDefaultText","bsCustomFileInput","fileApi","window","File","getSelectedFiles","hasAttribute","files","map","file","name","join","value","handleInputChange","handleFormReset","customFileList","querySelectorAll","filter","len","customProperty","Event","FORMRESET","INPUTCHANGE","init","inputSelector","formSelector","customFileInputList","document","formList","Object","defineProperty","writable","addEventListener","destroy","form","undefined","removeEventListener"],"mappings":";;;;;;;;;;;EAAA,IAAMA,QAAQ,GAAG;EACfC,EAAAA,UAAU,EAAE,iCADG;EAEfC,EAAAA,eAAe,EAAE,oBAFF;EAGfC,EAAAA,IAAI,EAAE,MAHS;EAIfC,EAAAA,KAAK,EAAE;EAJQ,CAAjB;;ECEA,IAAMC,YAAY,GAAG,CAArB;;EACA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,KAAD,EAAW;EAChC,MAAIC,WAAW,GAAG,EAAlB;EAEA,MAAMC,KAAK,GAAGF,KAAK,CAACG,UAAN,CAAiBC,aAAjB,CAA+BX,QAAQ,CAACE,eAAxC,CAAd;;EAEA,MAAIO,KAAJ,EAAW;EACTD,IAAAA,WAAW,GAAGC,KAAK,CAACG,SAApB;EACD;;EAED,SAAOJ,WAAP;EACD,CAVD;;EAYA,IAAMK,kBAAkB,GAAG,SAArBA,kBAAqB,CAACC,OAAD,EAAa;EACtC,MAAIA,OAAO,CAACC,UAAR,CAAmBC,MAAnB,GAA4B,CAAhC,EAAmC;EACjC,QAAMD,UAAU,GAAG,GAAGE,KAAH,CAASC,IAAT,CAAcJ,OAAO,CAACC,UAAtB,CAAnB;;EAEA,SAAK,IAAII,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGJ,UAAU,CAACC,MAA/B,EAAuCG,CAAC,EAAxC,EAA4C;EAC1C,UAAMC,IAAI,GAAGL,UAAU,CAACI,CAAD,CAAvB;;EACA,UAAIC,IAAI,CAACC,QAAL,KAAkBhB,YAAtB,EAAoC;EAClC,eAAOe,IAAP;EACD;EACF;EACF;;EAED,SAAON,OAAP;EACD,CAbD;;EAeA,IAAMQ,kBAAkB,GAAG,SAArBA,kBAAqB,CAACf,KAAD,EAAW;EACpC,MAAMC,WAAW,GAAGD,KAAK,CAACgB,iBAAN,CAAwBf,WAA5C;EACA,MAAMC,KAAK,GAAGF,KAAK,CAAC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ACmD,mBAAN,CAA0BhB,KAAK,CAACE,WAAhC,EAA6CT,iBAA7C;EACD;;EAED,SAAK,IAAIhB,GAAC,GAAG,CAAR,EAAWqB,KAAG,GAAGU,QAAQ,CAAClC,MAA/B,EAAuCG,GAAC,GAAGqB,KAA3C,EAAgDrB,GAAC,EAAjD,EAAqD;EACnD+B,MAAAA,QAAQ,CAAC/B,GAAD,CAAR,CAAYuC,mBAAZ,CAAgChB,KAAK,CAACC,SAAtC,EAAiDP,eAAjD;;EACAc,MAAAA,QAAQ,CAAC/B,GAAD,CAAR,CAAYsB,cAAZ,IAA8BgB,SAA9B;EACD;EACF;EA9CuB,CAA1B;;;;;;;;"} \ No newline at end of file diff --git a/dist/bs-custom-file-input.min.js b/dist/bs-custom-file-input.min.js index e74c2f3..e7c99e2 100644 --- a/dist/bs-custom-file-input.min.js +++ b/dist/bs-custom-file-input.min.js @@ -1,7 +1,7 @@ /*! - * bsCustomFileInput v1.1.1 (/~https://github.com/Johann-S/bs-custom-file-input) + * bsCustomFileInput v1.2.0 (/~https://github.com/Johann-S/bs-custom-file-input) * Copyright 2018 Johann-S * Licensed under MIT (/~https://github.com/Johann-S/bs-custom-file-input/blob/master/LICENSE) */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.bsCustomFileInput=t()}(this,function(){"use strict";var d={CUSTOMFILE:'.custom-file input[type="file"]',CUSTOMFILELABEL:".custom-file-label",FORM:"form"},u=function(e){var t=e.bsCustomFileInput.defaultText,n=e.parentNode.querySelector(d.CUSTOMFILELABEL);n&&(n.innerHTML=t)},t=!!window.File,n=function(e){return e.hasAttribute("multiple")&&t?[].slice.call(e.files).map(function(e){return e.name}).join(", "):e.value};function v(){var e=this.parentNode.querySelector(d.CUSTOMFILELABEL);e&&(e.innerHTML=n(this))}function L(){for(var e=[].slice.call(this.querySelectorAll(d.CUSTOMFILE)),t=0,n=e.length;t {\n let defaultText = ''\n\n const label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n defaultText = label.innerHTML\n }\n\n return defaultText\n}\n\nconst restoreDefaultText = (input) => {\n const defaultText = input.bsCustomFileInput.defaultText\n const label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n label.innerHTML = defaultText\n }\n}\n\nexport {\n getDefaultText,\n restoreDefaultText,\n}\n","import Selector from './selector'\nimport { restoreDefaultText } from './util'\n\nconst fileApi = !!window.File\n\nconst getSelectedFiles = (input) => {\n if (input.hasAttribute('multiple') && fileApi) {\n const files = [].slice.call(input.files)\n .map((file) => file.name)\n\n return files.join(', ')\n } else {\n return input.value\n }\n}\n\nfunction handleInputChange() {\n const label = this.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n label.innerHTML = getSelectedFiles(this)\n }\n}\n\nfunction handleFormReset() {\n const customFileList = [].slice.call(this.querySelectorAll(Selector.CUSTOMFILE))\n\n for (let i = 0, len = customFileList.length; i < len; i++) {\n restoreDefaultText(customFileList[i])\n }\n}\n\nexport {\n handleInputChange,\n handleFormReset,\n}\n","import { getDefaultText, restoreDefaultText } from './util'\nimport {\n handleFormReset,\n handleInputChange,\n} from './eventHandlers'\nimport Selector from './selector'\n\nconst Event = {\n FORMRESET : 'reset',\n INPUTCHANGE : 'change',\n INPUTFOCUSIN : 'focusin',\n INPUTFOCUSOUT : 'focusout',\n}\n\nconst customProperty = 'bsCustomFileInput'\n\nlet customFormSelector = null\nlet customInputSelector = null\n\nconst bsCustomFileInput = {\n init(inputSelector = Selector.CUSTOMFILE, formSelector = Selector.FORM) {\n customInputSelector = inputSelector\n customFormSelector = formSelector\n\n const customFileInputList = [].slice.call(document.querySelectorAll(customInputSelector))\n const formList = [].slice.call(document.querySelectorAll(customFormSelector))\n\n for (let i = 0, len = customFileInputList.length; i < len; i++) {\n const input = customFileInputList[i]\n\n Object.defineProperty(input, customProperty, {\n value: {\n defaultText: getDefaultText(input),\n },\n writable: true,\n })\n\n input.addEventListener(Event.INPUTCHANGE, handleInputChange)\n }\n\n for (let i = 0, len = formList.length; i < len; i++) {\n formList[i].addEventListener(Event.FORMRESET, handleFormReset)\n }\n },\n\n destroy() {\n const formList = [].slice.call(document.querySelectorAll(customFormSelector))\n const customFileInputList = [].slice.call(document.querySelectorAll(customInputSelector))\n .filter((input) => !!input.bsCustomFileInput)\n\n for (let i = 0, len = customFileInputList.length; i < len; i++) {\n const input = customFileInputList[i]\n\n restoreDefaultText(input)\n input[customProperty] = undefined\n\n input.removeEventListener(Event.INPUTCHANGE, handleInputChange)\n }\n\n for (let i = 0, len = formList.length; i < len; i++) {\n formList[i].removeEventListener(Event.FORMRESET, handleFormReset)\n }\n },\n}\n\nexport default bsCustomFileInput\n"],"names":["Selector","CUSTOMFILE","CUSTOMFILELABEL","FORM","restoreDefaultText","input","defaultText","bsCustomFileInput","label","parentNode","querySelector","innerHTML","fileApi","window","File","getSelectedFiles","hasAttribute","slice","call","files","map","file","name","join","value","handleInputChange","this","handleFormReset","customFileList","querySelectorAll","i","len","length","Event","customProperty","customFormSelector","customInputSelector","init","inputSelector","formSelector","customFileInputList","document","formList","Object","defineProperty","writable","addEventListener","destroy","filter","undefined","removeEventListener"],"mappings":";;;;;6LAAA,IAAMA,EAAW,CACfC,WAAY,kCACZC,gBAAiB,qBACjBC,KAAM,QCWFC,EAAqB,SAACC,OACpBC,EAAcD,EAAME,kBAAkBD,YACtCE,EAAQH,EAAMI,WAAWC,cAAcV,EAASE,iBAElDM,IACFA,EAAMG,UAAYL,IChBhBM,IAAYC,OAAOC,KAEnBC,EAAmB,SAACV,UACpBA,EAAMW,aAAa,aAAeJ,EACtB,GAAGK,MAAMC,KAAKb,EAAMc,OAC/BC,IAAI,SAACC,UAASA,EAAKC,OAETC,KAAK,MAEXlB,EAAMmB,OAIjB,SAASC,QACDjB,EAAQkB,KAAKjB,WAAWC,cAAcV,EAASE,iBAEjDM,IACFA,EAAMG,UAAYI,EAAiBW,OAIvC,SAASC,YACDC,EAA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OAG1C,IAAIK,EAAI,EAAGC,EAAMW,EAASV,OAAQF,EAAIC,EAAKD,IAC9CY,EAASZ,GAAGoB,oBAAoBjB,EAAiBN"} \ No newline at end of file +{"version":3,"file":"bs-custom-file-input.min.js","sources":["../src/selector.js","../src/util.js","../src/eventHandlers.js","../src/index.js"],"sourcesContent":["const Selector = {\n CUSTOMFILE: '.custom-file input[type=\"file\"]',\n CUSTOMFILELABEL: '.custom-file-label',\n FORM: 'form',\n INPUT: 'input',\n}\n\nexport default Selector\n","import Selector from './selector'\n\nconst textNodeType = 3\nconst getDefaultText = (input) => {\n let defaultText = ''\n\n const label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n defaultText = label.innerHTML\n }\n\n return defaultText\n}\n\nconst findFirstChildNode = (element) => {\n if (element.childNodes.length > 0) {\n const childNodes = [].slice.call(element.childNodes)\n\n for (let i = 0; i < childNodes.length; i++) {\n const node = childNodes[i]\n if (node.nodeType !== textNodeType) {\n return node\n }\n }\n }\n\n return element\n}\n\nconst restoreDefaultText = (input) => {\n const defaultText = input.bsCustomFileInput.defaultText\n const label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n const element = findFirstChildNode(label)\n element.innerHTML = defaultText\n }\n}\n\nexport {\n getDefaultText,\n findFirstChildNode,\n restoreDefaultText,\n}\n","import { findFirstChildNode, restoreDefaultText } from './util'\nimport Selector from './selector'\n\nconst fileApi = !!window.File\n\nconst getSelectedFiles = (input) => {\n if (input.hasAttribute('multiple') && fileApi) {\n const files = [].slice.call(input.files)\n .map((file) => file.name)\n\n return files.join(', ')\n }\n\n return input.value\n}\n\nfunction handleInputChange() {\n const label = this.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n const element = findFirstChildNode(label)\n element.innerHTML = getSelectedFiles(this)\n }\n}\n\nfunction handleFormReset() {\n const customFileList = [].slice.call(this.querySelectorAll(Selector.INPUT))\n .filter((input) => !!input.bsCustomFileInput)\n\n for (let i = 0, len = customFileList.length; i < len; i++) {\n restoreDefaultText(customFileList[i])\n }\n}\n\nexport {\n handleInputChange,\n handleFormReset,\n}\n","import { getDefaultText, restoreDefaultText } from './util'\nimport { handleFormReset, handleInputChange } from './eventHandlers'\nimport Selector from './selector'\n\nconst customProperty = 'bsCustomFileInput'\nconst Event = {\n FORMRESET : 'reset',\n INPUTCHANGE : 'change',\n}\n\nconst bsCustomFileInput = {\n init(inputSelector = Selector.CUSTOMFILE, formSelector = Selector.FORM) {\n const customFileInputList = [].slice.call(document.querySelectorAll(inputSelector))\n const formList = [].slice.call(document.querySelectorAll(formSelector))\n\n for (let i = 0, len = customFileInputList.length; i < len; i++) {\n const input = customFileInputList[i]\n\n Object.defineProperty(input, customProperty, {\n value: {\n defaultText: getDefaultText(input),\n },\n writable: true,\n })\n\n input.addEventListener(Event.INPUTCHANGE, handleInputChange)\n }\n\n for (let i = 0, len = formList.length; i < len; i++) {\n formList[i].addEventListener(Event.FORMRESET, handleFormReset)\n Object.defineProperty(formList[i], customProperty, {\n value: true,\n writable: true,\n })\n }\n },\n\n destroy() {\n const formList = [].slice.call(document.querySelectorAll(Selector.FORM))\n .filter((form) => !!form.bsCustomFileInput)\n const customFileInputList = [].slice.call(document.querySelectorAll(Selector.INPUT))\n .filter((input) => !!input.bsCustomFileInput)\n\n for (let i = 0, len = customFileInputList.length; i < len; i++) {\n const input = customFileInputList[i]\n\n restoreDefaultText(input)\n input[customProperty] = undefined\n\n input.removeEventListener(Event.INPUTCHANGE, handleInputChange)\n }\n\n for (let i = 0, len = formList.length; i < len; i++) {\n formList[i].removeEventListener(Event.FORMRESET, handleFormReset)\n formList[i][customProperty] = undefined\n }\n },\n}\n\nexport default bsCustomFileInput\n"],"names":["Selector","CUSTOMFILE","CUSTOMFILELABEL","FORM","INPUT","findFirstChildNode","element","childNodes","length","slice","call","i","node","nodeType","restoreDefaultText","input","defaultText","bsCustomFileInput","label","parentNode","querySelector","innerHTML","fileApi","window","File","getSelectedFiles","hasAttribute","files","map","file","name","join","value","handleInputChange","this","handleFormReset","customFileList","querySelectorAll","filter","len","customProperty","Event","init","inputSelector","formSelector","customFileInputList","document","formList","Object","defineProperty","writable","addEventListener","destroy","form","undefined","removeEventListener"],"mappings":";;;;;6LAAA,IAAMA,EAAW,CACfC,WAAY,kCACZC,gBAAiB,qBACjBC,KAAM,OACNC,MAAO,SCWHC,EAAqB,SAACC,MACM,EAA5BA,EAAQC,WAAWC,eACfD,EAAa,GAAGE,MAAMC,KAAKJ,EAAQC,YAEhCI,EAAI,EAAGA,EAAIJ,EAAWC,OAAQG,IAAK,KACpCC,EAAOL,EAAWI,MAlBT,IAmBXC,EAAKC,gBACAD,SAKNN,GAGHQ,EAAqB,SAACC,OACpBC,EAAcD,EAAME,kBAAkBD,YACtCE,EAAQH,EAAMI,WAAWC,cAAcpB,EAASE,iBAElDgB,IACcb,EAAmBa,GAC3BG,UAAYL,ICjClBM,IAAYC,OAAOC,KAEnBC,EAAmB,SAACV,UACpBA,EAAMW,aAAa,aAAeJ,EACtB,GAAGb,MAAMC,KAAKK,EAAMY,OAC/BC,IAAI,SAACC,UAASA,EAAKC,OAETC,KAAK,MAGbhB,EAAMiB,OAGf,SAASC,QACDf,EAAQgB,KAAKf,WAAWC,cAAcpB,EAASE,iBAEjDgB,IACcb,EAAmBa,GAC3BG,UAAYI,EAAiBS,OAIzC,SAASC,YACDC,EAAiB,GAAG3B,MAAMC,KAAKwB,KAAKG,iBAAiBrC,EAASI,QACjEkC,OAAO,SAACvB,WAAYA,EAAME,oBAEpBN,EAAI,EAAG4B,EAAMH,EAAe5B,OAAQG,EAAI4B,EAAK5B,IACpDG,EAAmBsB,EAAezB,IC1BtC,IAAM6B,EAAiB,oBACjBC,EACU,QADVA,EAEU,eAGU,CACxBC,cAAKC,EAAqCC,YAArCD,IAAAA,EAAgB3C,EAASC,qBAAY2C,IAAAA,EAAe5C,EAASG,cFR5CY,EAClBC,EAEEE,EEME2B,EAAsB,GAAGpC,MAAMC,KAAKoC,SAAST,iBAAiBM,IAC9DI,EAAW,GAAGtC,MAAMC,KAAKoC,SAAST,iBAAiBO,IAEhDjC,EAAI,EAAG4B,EAAMM,EAAoBrC,OAAQG,EAAI4B,EAAK5B,IAAK,KACxDI,EAAQ8B,EAAoBlC,GAElCqC,OAAOC,eAAelC,EAAOyB,EAAgB,CAC3CR,MAAO,CACLhB,aFjBcD,EEiBcA,EFhBhCC,OAAAA,OAEEE,EAFFF,EAAc,GAEZE,EAAQH,EAAMI,WAAWC,cAAcpB,EAASE,iBAElDgB,IACFF,EAAcE,EAAMG,WAGfL,IEUDkC,UAAU,IAGZnC,EAAMoC,iBAAiBV,EAAmBR,OAGvC,IAAItB,EAAI,EAAG4B,EAAMQ,EAASvC,OAAQG,EAAI4B,EAAK5B,IAC9CoC,EAASpC,GAAGwC,iBAAiBV,EAAiBN,GAC9Ca,OAAOC,eAAeF,EAASpC,GAAI6B,EAAgB,CACjDR,OAAO,EACPkB,UAAU,KAKhBE,2BACQL,EAAW,GAAGtC,MAAMC,KAAKoC,SAAST,iBAAiBrC,EAASG,OAC/DmC,OAAO,SAACe,WAAWA,EAAKpC,oBACrB4B,EAAsB,GAAGpC,MAAMC,KAAKoC,SAAST,iBAAiBrC,EAASI,QAC1EkC,OAAO,SAACvB,WAAYA,EAAME,oBAEpBN,EAAI,EAAG4B,EAAMM,EAAoBrC,OAAQG,EAAI4B,EAAK5B,IAAK,KACxDI,EAAQ8B,EAAoBlC,GAElCG,EAAmBC,GACnBA,EAAMyB,QAAkBc,EAExBvC,EAAMwC,oBAAoBd,EAAmBR,OAG1C,IAAItB,EAAI,EAAG4B,EAAMQ,EAASvC,OAAQG,EAAI4B,EAAK5B,IAC9CoC,EAASpC,GAAG4C,oBAAoBd,EAAiBN,GACjDY,EAASpC,GAAG6B,QAAkBc"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index fcb2cd8..716521f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "bs-custom-file-input", - "version": "1.1.1", + "version": "1.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 50af90e..ea9e2b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bs-custom-file-input", - "version": "1.1.1", + "version": "1.2.0", "description": "A little plugin for Bootstrap 4 custom file input", "author": "Johann-S ", "contributors": [