From 694f6b9a4babdfcfe969cd59f8d33e036b7e6310 Mon Sep 17 00:00:00 2001 From: mathieustan Date: Mon, 16 Nov 2020 09:45:15 +0100 Subject: [PATCH] :sparkles:(VDPickerCustomInput): Allows to use an icon slot --- dist/vue-datepicker.esm.js | 2 +- dist/vue-datepicker.min.css | 2 +- dist/vue-datepicker.min.js | 2 +- dist/vue-datepicker.umd.js | 2 +- doc-src/public/index.html | 2 ++ doc-src/src/App.vue | 5 +++ doc-src/src/examples/slot-input-icon.vue | 15 +++++++++ .../VDPickerCustomInput.js | 31 +++++++++++++------ .../VDPickerCustomInput.scss | 2 +- .../VDPicker/VDPickerCustomInput.spec.js | 28 ++++++++++++++++- 10 files changed, 76 insertions(+), 15 deletions(-) create mode 100644 doc-src/src/examples/slot-input-icon.vue diff --git a/dist/vue-datepicker.esm.js b/dist/vue-datepicker.esm.js index 7ca06f2..d3f714c 100644 --- a/dist/vue-datepicker.esm.js +++ b/dist/vue-datepicker.esm.js @@ -2,4 +2,4 @@ * Vue-datepicker v0.2.10 * (c) 2019-2020 Mathieu Stanowski */ -import{clearAllBodyScrollLocks as t,disableBodyScroll as e,enableBodyScroll as n}from"body-scroll-lock";import r from"vue";import i from"dayjs";var a=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},o={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekStart:0,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"[".concat(t).concat(e[(n-20)%10]||e[n]||e[0],"]")},buttonValidate:"Ok",buttonCancel:"Cancel",rangeHeaderText:"From %d To %d"},s={name:"fr",weekdays:"Dimanche_Lundi_Mardi_Mercredi_Jeudi_Vendredi_Samedi".split("_"),months:"Janvier_Février_Mars_Avril_Mai_Juin_Juillet_Août_Septembre_Octobre_Novembre_Décembre".split("_"),weekStart:1,weekdaysShort:"Dim_Lun_Mar_Mer_Jeu_Ven_Sam".split("_"),monthsShort:"Janv_Févr_Mars_Avr_Mai_Juin_Juil_Août_Sept_Oct_Nov_Déc".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),ordinal:function(t){return t},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},buttonValidate:"Ok",buttonCancel:"Annuler",rangeHeaderText:"Du %d Au %d"},c={name:"es",monthsShort:"ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),months:"Enero_Febrero_Marzo_Abril_Mayo_Junio_Julio_Agosto_Septiembre_Octubre_Noviembre_Diciembre".split("_"),weekStart:1,formats:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},ordinal:function(t){return"".concat(t,"º")},buttonValidate:"Ok",buttonCancel:"Anular",rangeHeaderText:"Del %d Al %d"},l={name:"de",weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),ordinal:function(t){return"".concat(t,".")},weekStart:1,formats:{LTS:"HH:mm:ss",LT:"HH:mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},buttonValidate:"Ok",buttonCancel:"Abbrechen",rangeHeaderText:"Vom %d Bis %d"},u={name:"he",weekdays:"ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת".split("_"),weekdaysShort:"א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳".split("_"),weekdaysMin:"א׳_ב׳_ג׳_ד׳_ה׳_ו_ש׳".split("_"),months:"ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר".split("_"),monthsShort:"ינו_פבר_מרץ_אפר_מאי_יונ_יול_אוג_ספט_אוק_נוב_דצמ".split("_"),ordinal:function(t){return t},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [ב]MMMM YYYY",LLL:"D [ב]MMMM YYYY HH:mm",LLLL:"dddd, D [ב]MMMM YYYY HH:mm",l:"D/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},buttonValidate:"אישור",buttonCancel:"ביטול",rangeHeaderText:"מתאריך %d עד תאריך %d"},d={name:"ru",weekdays:"Воскресенье_Понедельник_Вторник_Среда_Четверг_Пятница_Суббота".split("_"),weekdaysShort:"Вс_Пн_Вт_Ср_Чт_Пт_Сб".split("_"),weekdaysMin:"Вс_Пн_Вт_Ср_Чт_Пт_Сб".split("_"),months:"Январь_Февраль_Март_Апрель_Май_Июнь_Июль_Август_Сентябрь_Октябрь_Ноябрь_Декабрь".split("_"),monthsShort:"Янв_Фев_Мар_Апр_Май_Июн_Июл_Авг_Сен_Окт_Ноя_Дек".split("_"),weekStart:1,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},ordinal:function(t){return t},buttonValidate:"Ок",buttonCancel:"Отмена",rangeHeaderText:"От %d До %d"},h={name:"sv",weekdays:"Söndag_Måndag_Tisdag_Onsdag_Torsdag_Fredag_Lördag".split("_"),weekdaysShort:"Sön_Mån_Tis_Ons_Tor_Fre_Lör".split("_"),weekdaysMin:"Sö_Må_Ti_On_To_Fr_Lö".split("_"),months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekStart:0,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"[".concat(t).concat(e[(n-20)%10]||e[n]||e[0],"]")},buttonValidate:"Ok",buttonCancel:"Avbryt",rangeHeaderText:"Från %d till %d"},p=Object.freeze({__proto__:null,fr:s,en:o,es:c,de:l,he:u,ru:d,sv:h}),f=["name","weekdays","weekdaysShort","weekdaysMin","weekStart","months","monthsShort","ordinal","formats","buttonCancel","buttonValidate","rangeHeaderText"],m={date:"DD MMMM YYYY",month:"MMMM YYYY",quarter:"YYYY-[Q]Q",year:"YYYY",range:"DD MMMM YYYY"},v={date:"YYYY-MM-DD",month:"YYYY-MM",quarter:"YYYY-Q",year:"YYYY",range:"YYYY-MM-DD"},y={date:"dddd DD MMMM",month:"MMMM",quarter:"[Q]Q",year:"YYYY",range:"DD MMMM YYYY"},g=1900,b=3e3,D="date",_="month",k="quarter",O="year",M=/(%d)+/,w=Object.freeze({enter:13,tab:9,delete:46,esc:27,space:32,up:38,down:40,left:37,right:39,end:35,home:36,del:46,backspace:8,insert:45,pageup:33,pagedown:34});function Y(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function S(t){for(var e=arguments,n=1;n0&&void 0!==arguments[0]?arguments[0]:{},e=Object.keys(t);return e.length>0&&e.every((function(t){return f.includes(t)}))},getLocale:function(t){return this.isValidLocale(t)?t:p[t]||this.getLocale(this.getDefaultLang())}}}),C=r.extend({name:"Mobile",props:{mobileBreakpoint:{type:[Number,String],default:576,validator:function(t){return!isNaN(Number(t))}}},data:function(){return{width:0,mobile:!1,resizeTimeout:void 0}},computed:{isMobile:function(){return this.mobile}},created:function(){var t=this;window&&(window.addEventListener("resize",this.onResize,{passive:!0}),this.$on("hook:destroyed",(function(){window.removeEventListener("resize",t.onResize,{passive:!0})})),this.update())},methods:{onResize:function(){clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(this.update,200)},update:function(){var t=this.getClientWidth();this.width=t,this.mobile=t3&&void 0!==arguments[3]&&arguments[3],i=function i(a){n(a),t.removeEventListener(e,i,r)};t.addEventListener(e,i,r)}function B(t){var e=L(t);return"boolean"===e||"string"===e||t.nodeType===Node.ELEMENT_NODE}function F(t){if(null!=t&&""!==t)return isNaN(+t)?String(t):"".concat(Number(t),"px")}function I(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return t.$scopedSlots[e]?t.$scopedSlots[e]&&t.$scopedSlots[e](n):!t.$slots[e]||n&&!r?void 0:t.$slots[e]}function V(t){if(!t||t.nodeType!==Node.ELEMENT_NODE)return 0;var e=+window.getComputedStyle(t).getPropertyValue("z-index");return e||V(t.parentNode)}var z={mixins:[H],props:{activator:{default:void 0,validator:function(t){return["string","object"].includes(L(t))}},disabled:{type:Boolean,default:!1}},data:function(){return{activatorElement:void 0,activatorNode:[]}},watch:{activator:"resetActivator"},mounted:function(){var t,e,n,r=(e="activator",n=!0,(t=this).$slots[e]&&t.$scopedSlots[e]&&t.$scopedSlots[e].name?n?"v-slot":"scoped":t.$slots[e]?"normal":t.$scopedSlots[e]?"scoped":void 0);r&&["v-slot","normal"].includes(r)&&console.error('The activator slot must be bound, try \'