UNPKG

buefy

Version:

Lightweight UI components for Vue.js based on Bulma

1,632 lines (1,440 loc) 91.3 kB
/*! Buefy v0.8.2 | MIT License | github.com/buefy/buefy */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.Datepicker = {})); }(this, function (exports) { 'use strict'; function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var config = { defaultContainerElement: null, defaultIconPack: 'mdi', defaultIconComponent: null, defaultDialogConfirmText: null, defaultDialogCancelText: null, defaultSnackbarDuration: 3500, defaultSnackbarPosition: null, defaultToastDuration: 2000, defaultToastPosition: null, defaultNotificationDuration: 2000, defaultNotificationPosition: null, defaultTooltipType: 'is-primary', defaultTooltipAnimated: false, defaultTooltipDelay: 0, defaultInputAutocomplete: 'on', defaultDateFormatter: null, defaultDateParser: null, defaultDateCreator: null, defaultDayNames: null, defaultMonthNames: null, defaultFirstDayOfWeek: null, defaultUnselectableDaysOfWeek: null, defaultTimeFormatter: null, defaultTimeParser: null, defaultModalCanCancel: ['escape', 'x', 'outside', 'button'], defaultModalScroll: null, defaultDatepickerMobileNative: true, defaultTimepickerMobileNative: true, defaultNoticeQueue: true, defaultInputHasCounter: true, defaultTaginputHasCounter: true, defaultUseHtml5Validation: true, defaultDropdownMobileModal: true, defaultFieldLabelPosition: null, defaultDatepickerYearsRange: [-100, 3], defaultDatepickerNearbyMonthDays: true, defaultDatepickerNearbySelectableMonthDays: false, defaultDatepickerShowWeekNumber: false }; var config$1 = config; var FormElementMixin = { props: { size: String, expanded: Boolean, loading: Boolean, rounded: Boolean, icon: String, iconPack: String, // Native options to use in HTML5 validation autocomplete: String, maxlength: [Number, String], useHtml5Validation: { type: Boolean, default: function _default() { return config$1.defaultUseHtml5Validation; } }, validationMessage: String }, data: function data() { return { isValid: true, isFocused: false, newIconPack: this.iconPack || config$1.defaultIconPack }; }, computed: { /** * Find parent Field, max 3 levels deep. */ parentField: function parentField() { var parent = this.$parent; for (var i = 0; i < 3; i++) { if (parent && !parent.$data._isField) { parent = parent.$parent; } } return parent; }, /** * Get the type prop from parent if it's a Field. */ statusType: function statusType() { if (!this.parentField) return; if (!this.parentField.newType) return; if (typeof this.parentField.newType === 'string') { return this.parentField.newType; } else { for (var key in this.parentField.newType) { if (this.parentField.newType[key]) { return key; } } } }, /** * Get the message prop from parent if it's a Field. */ statusMessage: function statusMessage() { if (!this.parentField) return; return this.parentField.newMessage; }, /** * Fix icon size for inputs, large was too big */ iconSize: function iconSize() { switch (this.size) { case 'is-small': return this.size; case 'is-medium': return; case 'is-large': return this.newIconPack === 'mdi' ? 'is-medium' : ''; } } }, methods: { /** * Focus method that work dynamically depending on the component. */ focus: function focus() { var _this = this; if (this.$data._elementRef === undefined) return; this.$nextTick(function () { var el = _this.$el.querySelector(_this.$data._elementRef); if (el) el.focus(); }); }, onBlur: function onBlur($event) { this.isFocused = false; this.$emit('blur', $event); this.checkHtml5Validity(); }, onFocus: function onFocus($event) { this.isFocused = true; this.$emit('focus', $event); }, /** * Check HTML5 validation, set isValid property. * If validation fail, send 'is-danger' type, * and error message to parent if it's a Field. */ checkHtml5Validity: function checkHtml5Validity() { var _this2 = this; if (!this.useHtml5Validation) return; if (this.$refs[this.$data._elementRef] === undefined) return; var el = this.$el.querySelector(this.$data._elementRef); var type = null; var message = null; var isValid = true; if (!el.checkValidity()) { type = 'is-danger'; message = this.validationMessage || el.validationMessage; isValid = false; } this.isValid = isValid; this.$nextTick(function () { if (_this2.parentField) { // Set type only if not defined if (!_this2.parentField.type) { _this2.parentField.newType = type; } // Set message only if not defined if (!_this2.parentField.message) { _this2.parentField.newMessage = message; } } }); return this.isValid; } } }; /** * Get value of an object property/path even if it's nested */ /** * Mobile detection * https://www.abeautifulsite.net/detecting-mobile-devices-with-javascript */ var isMobile = { Android: function Android() { return typeof window !== 'undefined' && window.navigator.userAgent.match(/Android/i); }, BlackBerry: function BlackBerry() { return typeof window !== 'undefined' && window.navigator.userAgent.match(/BlackBerry/i); }, iOS: function iOS() { return typeof window !== 'undefined' && window.navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function Opera() { return typeof window !== 'undefined' && window.navigator.userAgent.match(/Opera Mini/i); }, Windows: function Windows() { return typeof window !== 'undefined' && window.navigator.userAgent.match(/IEMobile/i); }, any: function any() { return isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows(); } }; // var script = { name: 'BDropdown', props: { value: { type: [String, Number, Boolean, Object, Array, Function], default: null }, disabled: Boolean, hoverable: Boolean, inline: Boolean, position: { type: String, validator: function validator(value) { return ['is-top-right', 'is-top-left', 'is-bottom-left'].indexOf(value) > -1; } }, mobileModal: { type: Boolean, default: function _default() { return config$1.defaultDropdownMobileModal; } }, ariaRole: { type: String, default: '' }, animation: { type: String, default: 'fade' }, multiple: Boolean, closeOnClick: { type: Boolean, default: true } }, data: function data() { return { selected: this.value, isActive: false, isHoverable: this.hoverable, _isDropdown: true // Used internally by DropdownItem }; }, computed: { rootClasses: function rootClasses() { return [this.position, { 'is-disabled': this.disabled, 'is-hoverable': this.hoverable, 'is-inline': this.inline, 'is-active': this.isActive || this.inline, 'is-mobile-modal': this.isMobileModal }]; }, isMobileModal: function isMobileModal() { return this.mobileModal && !this.inline && !this.hoverable; }, ariaRoleMenu: function ariaRoleMenu() { return this.ariaRole === 'menu' || this.ariaRole === 'list' ? this.ariaRole : null; } }, watch: { /** * When v-model is changed set the new selected item. */ value: function value(_value) { this.selected = _value; }, /** * Emit event when isActive value is changed. */ isActive: function isActive(value) { this.$emit('active-change', value); } }, methods: { /** * Click listener from DropdownItem. * 1. Set new selected item. * 2. Emit input event to update the user v-model. * 3. Close the dropdown. */ selectItem: function selectItem(value) { var _this = this; if (this.multiple) { if (this.selected) { var index = this.selected.indexOf(value); if (index === -1) { this.selected.push(value); } else { this.selected.splice(index, 1); } } else { this.selected = [value]; } this.$emit('change', this.selected); } else { if (this.selected !== value) { this.selected = value; this.$emit('change', this.selected); } } this.$emit('input', this.selected); if (!this.multiple) { this.isActive = !this.closeOnClick; if (this.hoverable && this.closeOnClick) { this.isHoverable = false; // Timeout for the animation complete before destroying setTimeout(function () { _this.isHoverable = true; }, 250); } } }, /** * White-listed items to not close when clicked. */ isInWhiteList: function isInWhiteList(el) { if (el === this.$refs.dropdownMenu) return true; if (el === this.$refs.trigger) return true; // All chidren from dropdown if (this.$refs.dropdownMenu !== undefined) { var children = this.$refs.dropdownMenu.querySelectorAll('*'); var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var child = _step.value; if (el === child) { return true; } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return != null) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } // All children from trigger if (this.$refs.trigger !== undefined) { var _children = this.$refs.trigger.querySelectorAll('*'); var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = _children[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var _child = _step2.value; if (el === _child) { return true; } } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return != null) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } } return false; }, /** * Close dropdown if clicked outside. */ clickedOutside: function clickedOutside(event) { if (this.inline) return; if (!this.isInWhiteList(event.target)) this.isActive = false; }, /** * Toggle dropdown if it's not disabled. */ toggle: function toggle() { var _this2 = this; if (this.disabled) return; if (!this.isActive) { // if not active, toggle after clickOutside event // this fixes toggling programmatic this.$nextTick(function () { var value = !_this2.isActive; _this2.isActive = value; // Vue 2.6.x ??? setTimeout(function () { return _this2.isActive = value; }); }); } else { this.isActive = !this.isActive; } } }, created: function created() { if (typeof window !== 'undefined') { document.addEventListener('click', this.clickedOutside); } }, beforeDestroy: function beforeDestroy() { if (typeof window !== 'undefined') { document.removeEventListener('click', this.clickedOutside); } } }; function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */ , shadowMode, createInjector, createInjectorSSR, createInjectorShadow) { if (typeof shadowMode !== 'boolean') { createInjectorSSR = createInjector; createInjector = shadowMode; shadowMode = false; } // Vue.extend constructor export interop. var options = typeof script === 'function' ? script.options : script; // render functions if (template && template.render) { options.render = template.render; options.staticRenderFns = template.staticRenderFns; options._compiled = true; // functional template if (isFunctionalTemplate) { options.functional = true; } } // scopedId if (scopeId) { options._scopeId = scopeId; } var hook; if (moduleIdentifier) { // server build hook = function hook(context) { // 2.3 injection context = context || // cached call this.$vnode && this.$vnode.ssrContext || // stateful this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__; } // inject component styles if (style) { style.call(this, createInjectorSSR(context)); } // register component module identifier for async chunk inference if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier); } }; // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook; } else if (style) { hook = shadowMode ? function () { style.call(this, createInjectorShadow(this.$root.$options.shadowRoot)); } : function (context) { style.call(this, createInjector(context)); }; } if (hook) { if (options.functional) { // register for functional component in vue file var originalRender = options.render; options.render = function renderWithStyleInjection(h, context) { hook.call(context); return originalRender(h, context); }; } else { // inject component registration as beforeCreate hook var existing = options.beforeCreate; options.beforeCreate = existing ? [].concat(existing, hook) : [hook]; } } return script; } var normalizeComponent_1 = normalizeComponent; /* script */ const __vue_script__ = script; /* template */ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"dropdown",class:_vm.rootClasses},[(!_vm.inline)?_c('div',{ref:"trigger",staticClass:"dropdown-trigger",attrs:{"role":"button","aria-haspopup":"true"},on:{"click":_vm.toggle}},[_vm._t("trigger")],2):_vm._e(),_vm._v(" "),_c('transition',{attrs:{"name":_vm.animation}},[(_vm.isMobileModal)?_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.isActive),expression:"isActive"}],staticClass:"background",attrs:{"aria-hidden":!_vm.isActive}}):_vm._e()]),_vm._v(" "),_c('transition',{attrs:{"name":_vm.animation}},[_c('div',{directives:[{name:"show",rawName:"v-show",value:((!_vm.disabled && (_vm.isActive || _vm.isHoverable)) || _vm.inline),expression:"(!disabled && (isActive || isHoverable)) || inline"}],ref:"dropdownMenu",staticClass:"dropdown-menu",attrs:{"aria-hidden":!_vm.isActive}},[_c('div',{staticClass:"dropdown-content",attrs:{"role":_vm.ariaRoleMenu}},[_vm._t("default")],2)])])],1)}; var __vue_staticRenderFns__ = []; /* style */ const __vue_inject_styles__ = undefined; /* scoped */ const __vue_scope_id__ = undefined; /* module identifier */ const __vue_module_identifier__ = undefined; /* functional template */ const __vue_is_functional_template__ = false; /* style inject */ /* style inject SSR */ var Dropdown = normalizeComponent_1( { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, undefined, undefined ); // // // // // // // // // // // // // // // // // // // // // var script$1 = { name: 'BDropdownItem', props: { value: { type: [String, Number, Boolean, Object, Array, Function], default: null }, separator: Boolean, disabled: Boolean, custom: Boolean, focusable: { type: Boolean, default: true }, paddingless: Boolean, hasLink: Boolean, ariaRole: { type: String, default: '' } }, computed: { anchorClasses: function anchorClasses() { return { 'is-disabled': this.$parent.disabled || this.disabled, 'is-paddingless': this.paddingless, 'is-active': this.isActive }; }, itemClasses: function itemClasses() { return { 'dropdown-item': !this.hasLink, 'is-disabled': this.disabled, 'is-paddingless': this.paddingless, 'is-active': this.isActive, 'has-link': this.hasLink }; }, ariaRoleItem: function ariaRoleItem() { return this.ariaRole === 'menuitem' || this.ariaRole === 'listitem' ? this.ariaRole : null; }, /** * Check if item can be clickable. */ isClickable: function isClickable() { return !this.$parent.disabled && !this.separator && !this.disabled && !this.custom; }, isActive: function isActive() { if (this.$parent.selected === null) return false; if (this.$parent.multiple) return this.$parent.selected.indexOf(this.value) >= 0; return this.value === this.$parent.selected; } }, methods: { /** * Click listener, select the item. */ selectItem: function selectItem() { if (!this.isClickable) return; this.$parent.selectItem(this.value); this.$emit('click'); } }, created: function created() { if (!this.$parent.$data._isDropdown) { this.$destroy(); throw new Error('You should wrap bDropdownItem on a bDropdown'); } } }; /* script */ const __vue_script__$1 = script$1; /* template */ var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.separator)?_c('hr',{staticClass:"dropdown-divider"}):(!_vm.custom && !_vm.hasLink)?_c('a',{staticClass:"dropdown-item",class:_vm.anchorClasses,attrs:{"role":_vm.ariaRoleItem,"tabindex":_vm.focusable ? 0 : null},on:{"click":_vm.selectItem}},[_vm._t("default")],2):_c('div',{class:_vm.itemClasses,attrs:{"role":_vm.ariaRoleItem,"tabindex":_vm.focusable ? 0 : null},on:{"click":_vm.selectItem}},[_vm._t("default")],2)}; var __vue_staticRenderFns__$1 = []; /* style */ const __vue_inject_styles__$1 = undefined; /* scoped */ const __vue_scope_id__$1 = undefined; /* module identifier */ const __vue_module_identifier__$1 = undefined; /* functional template */ const __vue_is_functional_template__$1 = false; /* style inject */ /* style inject SSR */ var DropdownItem = normalizeComponent_1( { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, undefined, undefined ); // var script$2 = { name: 'BIcon', props: { type: [String, Object], pack: String, icon: String, size: String, customSize: String, customClass: String, both: Boolean // This is used internally to show both MDI and FA icon }, computed: { /** * Internal icon name based on the pack. * If pack is 'fa', gets the equivalent FA icon name of the MDI, * internal icons are always MDI. */ newIcon: function newIcon() { return this.newPack === 'mdi' ? "".concat(this.newPack, "-").concat(this.icon) : this.addFAPrefix(this.getEquivalentIconOf(this.icon)); }, newPack: function newPack() { return this.pack || config$1.defaultIconPack; }, newType: function newType() { if (!this.type) return; var splitType = []; if (typeof this.type === 'string') { splitType = this.type.split('-'); } else { for (var key in this.type) { if (this.type[key]) { splitType = key.split('-'); break; } } } if (splitType.length <= 1) return; return "has-text-".concat(splitType[1]); }, newCustomSize: function newCustomSize() { return this.customSize || this.customSizeByPack; }, customSizeByPack: function customSizeByPack() { var defaultSize = this.newPack === 'mdi' ? 'mdi-24px' : this.addFAPrefix('lg'); var mediumSize = this.newPack === 'mdi' ? 'mdi-36px' : this.addFAPrefix('2x'); var largeSize = this.newPack === 'mdi' ? 'mdi-48px' : this.addFAPrefix('3x'); switch (this.size) { case 'is-small': return; case 'is-medium': return mediumSize; case 'is-large': return largeSize; default: return defaultSize; } }, useIconComponent: function useIconComponent() { return config$1.defaultIconComponent; } }, methods: { addFAPrefix: function addFAPrefix(value) { if (this.useIconComponent) { return value; } return "fa-".concat(value); }, /** * Equivalent FA icon name of the MDI. */ getEquivalentIconOf: function getEquivalentIconOf(value) { // Only transform the class if the both prop is set to true if (!this.both) { return value; } switch (value) { case 'check': return 'check'; case 'information': return 'info-circle'; case 'check-circle': return 'check-circle'; case 'alert': return 'exclamation-triangle'; case 'alert-circle': return 'exclamation-circle'; case 'arrow-up': return 'arrow-up'; case 'chevron-right': return 'angle-right'; case 'chevron-left': return 'angle-left'; case 'chevron-down': return 'angle-down'; case 'eye': return 'eye'; case 'eye-off': return 'eye-slash'; case 'menu-down': return 'caret-down'; case 'menu-up': return 'caret-up'; default: return value; } } } }; /* script */ const __vue_script__$2 = script$2; /* template */ var __vue_render__$2 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',{staticClass:"icon",class:[_vm.newType, _vm.size]},[(!_vm.useIconComponent)?_c('i',{class:[_vm.newPack, _vm.newIcon, _vm.newCustomSize, _vm.customClass]}):_c(_vm.useIconComponent,{tag:"component",class:[_vm.customClass],attrs:{"icon":[_vm.newPack, _vm.newIcon],"size":_vm.newCustomSize}})],1)}; var __vue_staticRenderFns__$2 = []; /* style */ const __vue_inject_styles__$2 = undefined; /* scoped */ const __vue_scope_id__$2 = undefined; /* module identifier */ const __vue_module_identifier__$2 = undefined; /* functional template */ const __vue_is_functional_template__$2 = false; /* style inject */ /* style inject SSR */ var Icon = normalizeComponent_1( { render: __vue_render__$2, staticRenderFns: __vue_staticRenderFns__$2 }, __vue_inject_styles__$2, __vue_script__$2, __vue_scope_id__$2, __vue_is_functional_template__$2, __vue_module_identifier__$2, undefined, undefined ); var script$3 = { name: 'BInput', components: _defineProperty({}, Icon.name, Icon), mixins: [FormElementMixin], inheritAttrs: false, props: { value: [Number, String], type: { type: String, default: 'text' }, passwordReveal: Boolean, hasCounter: { type: Boolean, default: function _default() { return config$1.defaultInputHasCounter; } }, customClass: { type: String, default: '' } }, data: function data() { return { newValue: this.value, newType: this.type, newAutocomplete: this.autocomplete || config$1.defaultInputAutocomplete, isPasswordVisible: false, _elementRef: this.type === 'textarea' ? 'textarea' : 'input' }; }, computed: { computedValue: { get: function get() { return this.newValue; }, set: function set(value) { this.newValue = value; this.$emit('input', value); !this.isValid && this.checkHtml5Validity(); } }, rootClasses: function rootClasses() { return [this.iconPosition, this.size, { 'is-expanded': this.expanded, 'is-loading': this.loading, 'is-clearfix': !this.hasMessage }]; }, inputClasses: function inputClasses() { return [this.statusType, this.size, { 'is-rounded': this.rounded }]; }, hasIconRight: function hasIconRight() { return this.passwordReveal || this.loading || this.statusTypeIcon; }, /** * Position of the icon or if it's both sides. */ iconPosition: function iconPosition() { if (this.icon && this.hasIconRight) { return 'has-icons-left has-icons-right'; } else if (!this.icon && this.hasIconRight) { return 'has-icons-right'; } else if (this.icon) { return 'has-icons-left'; } }, /** * Icon name (MDI) based on the type. */ statusTypeIcon: function statusTypeIcon() { switch (this.statusType) { case 'is-success': return 'check'; case 'is-danger': return 'alert-circle'; case 'is-info': return 'information'; case 'is-warning': return 'alert'; } }, /** * Check if have any message prop from parent if it's a Field. */ hasMessage: function hasMessage() { return !!this.statusMessage; }, /** * Current password-reveal icon name. */ passwordVisibleIcon: function passwordVisibleIcon() { return !this.isPasswordVisible ? 'eye' : 'eye-off'; }, /** * Get value length */ valueLength: function valueLength() { if (typeof this.computedValue === 'string') { return this.computedValue.length; } else if (typeof this.computedValue === 'number') { return this.computedValue.toString().length; } return 0; } }, watch: { /** * When v-model is changed: * 1. Set internal value. */ value: function value(_value) { this.newValue = _value; } }, methods: { /** * Toggle the visibility of a password-reveal input * by changing the type and focus the input right away. */ togglePasswordVisibility: function togglePasswordVisibility() { var _this = this; this.isPasswordVisible = !this.isPasswordVisible; this.newType = this.isPasswordVisible ? 'text' : 'password'; this.$nextTick(function () { _this.$refs.input.focus(); }); }, /** * Input's 'input' event listener, 'nextTick' is used to prevent event firing * before ui update, helps when using masks (Cleavejs and potentially others). */ onInput: function onInput(event) { var _this2 = this; this.$nextTick(function () { if (event.target) { _this2.computedValue = event.target.value; } }); } } }; /* script */ const __vue_script__$3 = script$3; /* template */ var __vue_render__$3 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"control",class:_vm.rootClasses},[(_vm.type !== 'textarea')?_c('input',_vm._b({ref:"input",staticClass:"input",class:[_vm.inputClasses, _vm.customClass],attrs:{"type":_vm.newType,"autocomplete":_vm.newAutocomplete,"maxlength":_vm.maxlength},domProps:{"value":_vm.computedValue},on:{"input":_vm.onInput,"blur":_vm.onBlur,"focus":_vm.onFocus}},'input',_vm.$attrs,false)):_c('textarea',_vm._b({ref:"textarea",staticClass:"textarea",class:[_vm.inputClasses, _vm.customClass],attrs:{"maxlength":_vm.maxlength},domProps:{"value":_vm.computedValue},on:{"input":_vm.onInput,"blur":_vm.onBlur,"focus":_vm.onFocus}},'textarea',_vm.$attrs,false)),_vm._v(" "),(_vm.icon)?_c('b-icon',{staticClass:"is-left",attrs:{"icon":_vm.icon,"pack":_vm.iconPack,"size":_vm.iconSize}}):_vm._e(),_vm._v(" "),(!_vm.loading && (_vm.passwordReveal || _vm.statusTypeIcon))?_c('b-icon',{staticClass:"is-right",class:{ 'is-clickable': _vm.passwordReveal },attrs:{"icon":_vm.passwordReveal ? _vm.passwordVisibleIcon : _vm.statusTypeIcon,"pack":_vm.iconPack,"size":_vm.iconSize,"type":!_vm.passwordReveal ? _vm.statusType : 'is-primary',"both":""},nativeOn:{"click":function($event){_vm.togglePasswordVisibility($event);}}}):_vm._e(),_vm._v(" "),(_vm.maxlength && _vm.hasCounter && _vm.type !== 'number')?_c('small',{staticClass:"help counter",class:{ 'is-invisible': !_vm.isFocused }},[_vm._v("\n "+_vm._s(_vm.valueLength)+" / "+_vm._s(_vm.maxlength)+"\n ")]):_vm._e()],1)}; var __vue_staticRenderFns__$3 = []; /* style */ const __vue_inject_styles__$3 = undefined; /* scoped */ const __vue_scope_id__$3 = undefined; /* module identifier */ const __vue_module_identifier__$3 = undefined; /* functional template */ const __vue_is_functional_template__$3 = false; /* style inject */ /* style inject SSR */ var Input = normalizeComponent_1( { render: __vue_render__$3, staticRenderFns: __vue_staticRenderFns__$3 }, __vue_inject_styles__$3, __vue_script__$3, __vue_scope_id__$3, __vue_is_functional_template__$3, __vue_module_identifier__$3, undefined, undefined ); var script$4 = { name: 'BFieldBody', props: { message: { type: String }, type: { type: [String, Object] } }, render: function render(createElement) { var _this = this; return createElement('div', { attrs: { 'class': 'field-body' } }, this.$slots.default.map(function (element) { // skip returns and comments if (!element.tag) { return element; } if (_this.message) { return createElement('b-field', { attrs: { message: _this.message, 'type': _this.type } }, [element]); } return createElement('b-field', { attrs: { 'type': _this.type } }, [element]); })); } }; /* script */ const __vue_script__$4 = script$4; /* template */ /* style */ const __vue_inject_styles__$4 = undefined; /* scoped */ const __vue_scope_id__$4 = undefined; /* module identifier */ const __vue_module_identifier__$4 = undefined; /* functional template */ const __vue_is_functional_template__$4 = undefined; /* style inject */ /* style inject SSR */ var FieldBody = normalizeComponent_1( {}, __vue_inject_styles__$4, __vue_script__$4, __vue_scope_id__$4, __vue_is_functional_template__$4, __vue_module_identifier__$4, undefined, undefined ); var script$5 = { name: 'BField', components: _defineProperty({}, FieldBody.name, FieldBody), props: { type: [String, Object], label: String, labelFor: String, message: [String, Array, Object], grouped: Boolean, groupMultiline: Boolean, position: String, expanded: Boolean, horizontal: Boolean, addons: { type: Boolean, default: true }, customClass: String, labelPosition: { type: String, default: function _default() { return config$1.defaultFieldLabelPosition; } } }, data: function data() { return { newType: this.type, newMessage: this.message, fieldLabelSize: null, _isField: true // Used internally by Input and Select }; }, computed: { rootClasses: function rootClasses() { return [this.newPosition, { 'is-expanded': this.expanded, 'is-grouped-multiline': this.groupMultiline, 'is-horizontal': this.horizontal, 'is-floating-in-label': this.hasLabel && !this.horizontal && this.labelPosition === 'inside', 'is-floating-label': this.hasLabel && !this.horizontal && this.labelPosition === 'on-border' }, this.numberInputClasses]; }, /** * Correct Bulma class for the side of the addon or group. * * This is not kept like the others (is-small, etc.), * because since 'has-addons' is set automatically it * doesn't make sense to teach users what addons are exactly. */ newPosition: function newPosition() { if (this.position === undefined) return; var position = this.position.split('-'); if (position.length < 1) return; var prefix = this.grouped ? 'is-grouped-' : 'has-addons-'; if (this.position) return prefix + position[1]; }, /** * Formatted message in case it's an array * (each element is separated by <br> tag) */ formattedMessage: function formattedMessage() { if (typeof this.newMessage === 'string') { return this.newMessage; } else { var messages = []; if (Array.isArray(this.newMessage)) { this.newMessage.forEach(function (message) { if (typeof message === 'string') { messages.push(message); } else { for (var key in message) { if (message[key]) { messages.push(key); } } } }); } else { for (var key in this.newMessage) { if (this.newMessage[key]) { messages.push(key); } } } return messages.filter(function (m) { if (m) return m; }).join(' <br> '); } }, hasLabel: function hasLabel() { return this.label || this.$slots.label; }, numberInputClasses: function numberInputClasses() { if (this.$slots.default) { var numberinput = this.$slots.default.filter(function (node) { return node.tag && node.tag.toLowerCase().indexOf('numberinput') >= 0; })[0]; if (numberinput) { var classes = ['has-numberinput']; var controlsPosition = numberinput.componentOptions.propsData.controlsPosition; var size = numberinput.componentOptions.propsData.size; if (controlsPosition) { classes.push("has-numberinput-".concat(controlsPosition)); } if (size) { classes.push("has-numberinput-".concat(size)); } return classes; } } return null; } }, watch: { /** * Set internal type when prop change. */ type: function type(value) { this.newType = value; }, /** * Set internal message when prop change. */ message: function message(value) { this.newMessage = value; } }, methods: { /** * Field has addons if there are more than one slot * (element / component) in the Field. * Or is grouped when prop is set. * Is a method to be called when component re-render. */ fieldType: function fieldType() { if (this.grouped) return 'is-grouped'; var renderedNode = 0; if (this.$slots.default) { renderedNode = this.$slots.default.reduce(function (i, node) { return node.tag ? i + 1 : i; }, 0); } if (renderedNode > 1 && this.addons && !this.horizontal) { return 'has-addons'; } } }, mounted: function mounted() { if (this.horizontal) { // Bulma docs: .is-normal for any .input or .button var elements = this.$el.querySelectorAll('.input, .select, .button, .textarea, .b-slider'); if (elements.length > 0) { this.fieldLabelSize = 'is-normal'; } } } }; /* script */ const __vue_script__$5 = script$5; /* template */ var __vue_render__$4 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"field",class:[_vm.rootClasses, _vm.fieldType()]},[(_vm.horizontal)?_c('div',{staticClass:"field-label",class:[_vm.customClass, _vm.fieldLabelSize]},[(_vm.hasLabel)?_c('label',{staticClass:"label",class:_vm.customClass,attrs:{"for":_vm.labelFor}},[(_vm.$slots.label)?_vm._t("label"):[_vm._v(_vm._s(_vm.label))]],2):_vm._e()]):[(_vm.hasLabel)?_c('label',{staticClass:"label",class:_vm.customClass,attrs:{"for":_vm.labelFor}},[(_vm.$slots.label)?_vm._t("label"):[_vm._v(_vm._s(_vm.label))]],2):_vm._e()],_vm._v(" "),(_vm.horizontal)?_c('b-field-body',{attrs:{"message":_vm.newMessage ? _vm.formattedMessage : '',"type":_vm.newType}},[_vm._t("default")],2):[_vm._t("default")],_vm._v(" "),(_vm.newMessage && !_vm.horizontal)?_c('p',{staticClass:"help",class:_vm.newType,domProps:{"innerHTML":_vm._s(_vm.formattedMessage)}}):_vm._e()],2)}; var __vue_staticRenderFns__$4 = []; /* style */ const __vue_inject_styles__$5 = undefined; /* scoped */ const __vue_scope_id__$5 = undefined; /* module identifier */ const __vue_module_identifier__$5 = undefined; /* functional template */ const __vue_is_functional_template__$5 = false; /* style inject */ /* style inject SSR */ var Field = normalizeComponent_1( { render: __vue_render__$4, staticRenderFns: __vue_staticRenderFns__$4 }, __vue_inject_styles__$5, __vue_script__$5, __vue_scope_id__$5, __vue_is_functional_template__$5, __vue_module_identifier__$5, undefined, undefined ); var script$6 = { name: 'BSelect', components: _defineProperty({}, Icon.name, Icon), mixins: [FormElementMixin], inheritAttrs: false, props: { value: { type: [String, Number, Boolean, Object, Array, Function], default: null }, placeholder: String, multiple: Boolean, nativeSize: [String, Number] }, data: function data() { return { selected: this.value, _elementRef: 'select' }; }, computed: { computedValue: { get: function get() { return this.selected; }, set: function set(value) { this.selected = value; this.$emit('input', value); !this.isValid && this.checkHtml5Validity(); } }, spanClasses: function spanClasses() { return [this.size, this.statusType, { 'is-fullwidth': this.expanded, 'is-loading': this.loading, 'is-multiple': this.multiple, 'is-rounded': this.rounded, 'is-empty': this.selected === null }]; } }, watch: { /** * When v-model is changed: * 1. Set the selected option. * 2. If it's invalid, validate again. */ value: function value(_value) { this.selected = _value; !this.isValid && this.checkHtml5Validity(); } } }; /* script */ const __vue_script__$6 = script$6; /* template */ var __vue_render__$5 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"control",class:{ 'is-expanded': _vm.expanded, 'has-icons-left': _vm.icon }},[_c('span',{staticClass:"select",class:_vm.spanClasses},[_c('select',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.computedValue),expression:"computedValue"}],ref:"select",attrs:{"multiple":_vm.multiple,"size":_vm.nativeSize},on:{"blur":function($event){_vm.$emit('blur', $event) && _vm.checkHtml5Validity();},"focus":function($event){_vm.$emit('focus', $event);},"change":function($event){var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return val}); _vm.computedValue=$event.target.multiple ? $$selectedVal : $$selectedVal[0];}}},'select',_vm.$attrs,false),[(_vm.placeholder)?[(_vm.computedValue == null)?_c('option',{attrs:{"disabled":"","hidden":""},domProps:{"value":null}},[_vm._v("\n "+_vm._s(_vm.placeholder)+"\n ")]):_vm._e()]:_vm._e(),_vm._v(" "),_vm._t("default")],2)]),_vm._v(" "),(_vm.icon)?_c('b-icon',{staticClass:"is-left",attrs:{"icon":_vm.icon,"pack":_vm.iconPack,"size":_vm.iconSize}}):_vm._e()],1)}; var __vue_staticRenderFns__$5 = []; /* style */ const __vue_inject_styles__$6 = undefined; /* scoped */ const __vue_scope_id__$6 = undefined; /* module identifier */ const __vue_module_identifier__$6 = undefined; /* functional template */ const __vue_is_functional_template__$6 = false; /* style inject */ /* style inject SSR */ var Select = normalizeComponent_1( { render: __vue_render__$5, staticRenderFns: __vue_staticRenderFns__$5 }, __vue_inject_styles__$6, __vue_script__$6, __vue_scope_id__$6, __vue_is_functional_template__$6, __vue_module_identifier__$6, undefined, undefined ); // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // var script$7 = { name: 'BDatepickerTableRow', props: { selectedDate: { type: [Date, Array] }, hoveredDateRange: Array, week: { type: Array, required: true }, month: { type: Number, required: true }, minDate: Date, maxDate: Date, disabled: Boolean, unselectableDates: Array, unselectableDaysOfWeek: Array, selectableDates: Array, events: Array, indicators: String, dateCreator: Function, nearbyMonthDays: Boolean, nearbySelectableMonthDays: Boolean, showWeekNumber: { type: Boolean, default: function _default() { return false; } }, rulesForFirstWeek: { type: Number, default: function _default() { return 4; } }, firstDayOfWeek: Number }, methods: { firstWeekOffset: function firstWeekOffset(year, dow, doy) { // first-week day -- which january is always in the first week (4 for iso, 1 for other) var fwd = 7 + dow - doy; // first-week day local weekday -- which local weekday is fwd var firstJanuary = new Date(year, 0, fwd); var fwdlw = (7 + firstJanuary.getDay() - dow) % 7; return -fwdlw + fwd - 1; }, daysInYear: function daysInYear(year) { return this.isLeapYear(year) ? 366 : 365; }, isLeapYear: function isLeapYear(year) { return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; }, getSetDayOfYear: function getSetDayOfYear(input) { var dayOfYear = Math.round((input - new Date(input.getFullYear(), 0, 1)) / 864e5) + 1; return dayOfYear; }, weeksInYear: function weeksInYear(year, dow, doy) { var weekOffset = this.firstWeekOffset(year, dow, doy); var weekOffsetNext = this.firstWeekOffset(year + 1, dow, doy); return (this.daysInYear(year) - weekOffset + weekOffsetNext) / 7; }, getWeekNumber: function getWeekNumber(mom) { var dow = this.firstDayOfWeek; // first day of week // Rules for the first week : 1 for the 1st January, 4 for the 4th January var doy = this.rulesForFirstWeek; var weekOffset = this.firstWeekOffset(mom.getFullYear(), dow, doy); var week = Math.floor((this.getSetDayOfYear(mom) - weekOffset - 1) / 7) + 1; var resWeek; var resYear; if (week < 1) { resYear = mom.getFullYear() - 1; resWeek = week + this.weeksInYear(resYear, dow, doy); } else if (week > this.weeksInYear(mom.getFullYear(), dow, doy)) { resWeek = week - this.weeksInYear(mom.getFullYear(), dow, doy); resYear = mom.getFullYear() + 1; } else { resYear = mom.getFullYear(); resWeek = week; } return resWeek; }, /* * Check that selected day is within earliest/latest params and * is within this month */ selectableDate: function selectableDate(day) { var validity = []; if (this.minDate) { validity.push(day >= this.minDate); } if (this.maxDate) { validity.push(day <= this.maxDate); } if (this.nearbyMonthDays && !this.nearbySelectableMonthDays) { validity.push(day.getMonth() === this.month); } if (this.selectableDates) { for (var i = 0; i < this.selectableDates.length; i++) { var enabledDate = this.selectableDates[i]; if (day.getDate() === enabledDate.getDate() && day.getFullYear() === enabledDate.getFullYear() && day.getMonth() === enabledDate.getMonth()) { return true; } else { validity.push(false); } } } if (this.unselectableDates) { for (var _i = 0; _i < this.unselectableDates.length; _i++) { var disabledDate = this.unselectableDates[_i]; validity.push(day.getDate() !== disabledDate.getDate() || day.getFullYear() !== disabledDate.getFullYear() || day.getMonth() !== disabledDate.getMonth()); } } if (this.unselectableDaysOfWeek) { for (var _i2 = 0; _i2 < this.unselectableDaysOfWeek.length; _i2++) { var dayOfWeek = this.unselectableDaysOfWeek[_i2]; validity.push(day.getDay() !== dayOfWeek); } } return validity.indexOf(false) < 0; }, /* * Emit select event with chosen date as payload */ emitChosenDate: function emitChosenDate(day) { if (this.disabled) return; if (this.selectableDate(day)) { this.$emit('select', day); } }, eventsDateMatch: function eventsDateMatch(day) { if (!this.events || !this.events.length) return false; var dayEvents = []; for (var i = 0; i < this.events.length; i++) { if (this.events[i].date.getDay() === day.getDay()) { dayEvents.push(this.events[i])