diff --git a/app/renderer/components/Button.scss b/app/renderer/components/Button.scss index e65f942bf5..f97a04bdfc 100644 --- a/app/renderer/components/Button.scss +++ b/app/renderer/components/Button.scss @@ -1,7 +1,7 @@ @import '../styles/variables'; .Button { - --line-height: 34px; + --line-height: 35px; display: inline-block; min-width: 86px; padding: 0 20px; diff --git a/app/renderer/components/Input.js b/app/renderer/components/Input.js index 0b2bc30452..c6955958c0 100644 --- a/app/renderer/components/Input.js +++ b/app/renderer/components/Input.js @@ -52,7 +52,7 @@ const Input = ({ readOnly={readOnly} onChange={event => { if (onChange) { - onChange(event.target.value); + onChange(event.target.value, event); } }} /> diff --git a/app/renderer/styles/index.scss b/app/renderer/styles/index.scss index 1e3681632f..a362245fcb 100644 --- a/app/renderer/styles/index.scss +++ b/app/renderer/styles/index.scss @@ -1,4 +1,5 @@ -@import 'toolkit-inverse'; +@import '~modern-normalize/modern-normalize.css'; +@import './modern-base.css'; @import '~sass-extras/index'; @import './fonts'; @import './variables'; @@ -13,6 +14,7 @@ body { background-color: $background-color; font-family: 'Source Sans Pro', sans-serif; font-weight: normal; + color: #fff; } .dark-mode body { @@ -41,6 +43,8 @@ p { color: #7f8fa4; font-size: 1rem; line-height: 1.5rem; + margin-top: 0; + margin-bottom: 1rem; } p.secondary { @@ -65,6 +69,7 @@ h4, h5, h6 { margin-top: 0; + margin-bottom: 0.5rem; } h1, @@ -89,7 +94,50 @@ button:focus { outline: 0; } +input, +button, +select, +optgroup, +textarea { + margin: 0; + font-family: inherit; + font-size: inherit; + line-height: inherit; +} + /* Bootstrap overrides */ .form-group { margin-bottom: 10px; } + + +// Table +table { + border-spacing: 0; + width: 100%; + border-collapse: collapse; +} + +td, +th { + padding: 1.2rem 1.5rem; + text-align: left; +} + +thead tr { + border-bottom: 0.1rem solid white(30%); +} + +tbody tr { + border-bottom: 0.1rem solid white(10%); +} + +td:first-child, +th:first-child { + padding-left: 0; +} + +td:last-child, +th:last-child { + padding-right: 0; +} diff --git a/app/renderer/styles/modern-base.css b/app/renderer/styles/modern-base.css new file mode 100644 index 0000000000..63998ede06 --- /dev/null +++ b/app/renderer/styles/modern-base.css @@ -0,0 +1,146 @@ + +/*! modern-base | MIT License | https://github.com/sindresorhus/modern-normalize */ + + +/** + * Improve font rendering on HiDPI devices. + */ + +@media + screen and (-webkit-min-device-pixel-ratio: 2), + screen and (min-resolution: 2dppx) { + body { + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + } +} + +/** + * Break up words and URLs so they don't break your layout. + */ + +html { + word-break: break-all; +} + +/** + * Remove default spacing. + */ + +h1, +h2, +h3, +h4, +h5, +h6, +p, +figure, +blockquote, +dd, +dl, +pre { + margin: 0; +} + +/** + * Show link underline only on hover. + */ + +a { + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +/** + * Remove outline on active/hovered focused links. + */ + +a:active, +a:hover { + outline-width: 0; +} + +/** + * Correct the text style of placeholders in Chrome and Safari. + * See discussion: https://github.com/necolas/normalize.css/issues/550 + */ + +::-webkit-input-placeholder { + color: inherit; + opacity: 0.54; +} + +/** + * Remove text shadow from selections. + */ + +::selection { + background: #b3d7fd; + text-shadow: none; +} + +/** + * Remove outline from `:focus` pseudo element. + * Note: Don't forget to apply some styling for the focus state of elements that support it. + */ + +:focus { + outline-width: 0; +} + +/** + * Remove the list style on navigation lists. + */ + +nav ol, +nav ul { + list-style: none; +} + +/** + * Better looking default horizontal rule + */ + +hr { + display: block; + margin: 1em 0; + padding: 0; + border: 0; + border-top: 1px solid #ccc; +} + +/** + * Remove default fieldset styles. + */ + +fieldset { + margin: 0; + padding: 0; + border: 0; +} + +/** + * Allow only vertical resizing of textareas. + */ + +textarea { + resize: vertical; +} + + +/** + * Remove the gap between these elements and the bottom of their containers. + * See: https://github.com/h5bp/html5-boilerplate/issues/440 + */ + +svg, +img, +canvas, +video, +audio, +iframe { + vertical-align: middle; +} diff --git a/app/renderer/views/History.js b/app/renderer/views/History.js index 0d14b5824d..cf2a1e44de 100644 --- a/app/renderer/views/History.js +++ b/app/renderer/views/History.js @@ -19,8 +19,8 @@ const History = () => { return ( -
- +
+
'; - if (this.o.calendarWeeks){ - this.picker.find('.datepicker-days thead tr:first-child .datepicker-switch') - .attr('colspan', function(i, val){ - return parseInt(val) + 1; - }); - var cell = ''; - html += cell; - } - while (dowCnt < this.o.weekStart + 7){ - html += ''; - } - html += ''; - this.picker.find('.datepicker-days thead').append(html); - }, - - fillMonths: function(){ - var html = '', - i = 0; - while (i < 12){ - html += ''+dates[this.o.language].monthsShort[i++]+''; - } - this.picker.find('.datepicker-months td').html(html); - }, - - setRange: function(range){ - if (!range || !range.length) - delete this.range; - else - this.range = $.map(range, function(d){ - return d.valueOf(); - }); - this.fill(); - }, - - getClassNames: function(date){ - var cls = [], - year = this.viewDate.getUTCFullYear(), - month = this.viewDate.getUTCMonth(), - today = new Date(); - if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){ - cls.push('old'); - } - else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){ - cls.push('new'); - } - if (this.focusDate && date.valueOf() === this.focusDate.valueOf()) - cls.push('focused'); - // Compare internal UTC date with local today, not UTC today - if (this.o.todayHighlight && - date.getUTCFullYear() === today.getFullYear() && - date.getUTCMonth() === today.getMonth() && - date.getUTCDate() === today.getDate()){ - cls.push('today'); - } - if (this.dates.contains(date) !== -1) - cls.push('active'); - if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate || - $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){ - cls.push('disabled'); - } - if (this.o.datesDisabled.length > 0 && - $.grep(this.o.datesDisabled, function(d){ - return isUTCEquals(date, d); }).length > 0) { - cls.push('disabled', 'disabled-date'); - } - - if (this.range){ - if (date > this.range[0] && date < this.range[this.range.length-1]){ - cls.push('range'); - } - if ($.inArray(date.valueOf(), this.range) !== -1){ - cls.push('selected'); - } - } - return cls; - }, - - fill: function(){ - var d = new Date(this.viewDate), - year = d.getUTCFullYear(), - month = d.getUTCMonth(), - startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity, - startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity, - endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity, - endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity, - todaytxt = dates[this.o.language].today || dates['en'].today || '', - cleartxt = dates[this.o.language].clear || dates['en'].clear || '', - tooltip; - if (isNaN(year) || isNaN(month)) - return; - this.picker.find('.datepicker-days thead .datepicker-switch') - .text(dates[this.o.language].months[month]+' '+year); - this.picker.find('tfoot .today') - .text(todaytxt) - .toggle(this.o.todayBtn !== false); - this.picker.find('tfoot .clear') - .text(cleartxt) - .toggle(this.o.clearBtn !== false); - this.updateNavArrows(); - this.fillMonths(); - var prevMonth = UTCDate(year, month-1, 28), - day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth()); - prevMonth.setUTCDate(day); - prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7); - var nextMonth = new Date(prevMonth); - nextMonth.setUTCDate(nextMonth.getUTCDate() + 42); - nextMonth = nextMonth.valueOf(); - var html = []; - var clsName; - while (prevMonth.valueOf() < nextMonth){ - if (prevMonth.getUTCDay() === this.o.weekStart){ - html.push(''); - if (this.o.calendarWeeks){ - // ISO 8601: First week contains first thursday. - // ISO also states week starts on Monday, but we can be more abstract here. - var - // Start of current week: based on weekstart/current date - ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5), - // Thursday of this week - th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5), - // First Thursday of year, year from thursday - yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5), - // Calendar week: ms between thursdays, div ms per day, div 7 days - calWeek = (th - yth) / 864e5 / 7 + 1; - html.push(''); - - } - } - clsName = this.getClassNames(prevMonth); - clsName.push('day'); - - if (this.o.beforeShowDay !== $.noop){ - var before = this.o.beforeShowDay(this._utc_to_local(prevMonth)); - if (before === undefined) - before = {}; - else if (typeof(before) === 'boolean') - before = {enabled: before}; - else if (typeof(before) === 'string') - before = {classes: before}; - if (before.enabled === false) - clsName.push('disabled'); - if (before.classes) - clsName = clsName.concat(before.classes.split(/\s+/)); - if (before.tooltip) - tooltip = before.tooltip; - } - - clsName = $.unique(clsName); - html.push(''); - tooltip = null; - if (prevMonth.getUTCDay() === this.o.weekEnd){ - html.push(''); - } - prevMonth.setUTCDate(prevMonth.getUTCDate()+1); - } - this.picker.find('.datepicker-days tbody').empty().append(html.join('')); - - var months = this.picker.find('.datepicker-months') - .find('th:eq(1)') - .text(year) - .end() - .find('span').removeClass('active'); - - $.each(this.dates, function(i, d){ - if (d.getUTCFullYear() === year) - months.eq(d.getUTCMonth()).addClass('active'); - }); - - if (year < startYear || year > endYear){ - months.addClass('disabled'); - } - if (year === startYear){ - months.slice(0, startMonth).addClass('disabled'); - } - if (year === endYear){ - months.slice(endMonth+1).addClass('disabled'); - } - - if (this.o.beforeShowMonth !== $.noop){ - var that = this; - $.each(months, function(i, month){ - if (!$(month).hasClass('disabled')) { - var moDate = new Date(year, i, 1); - var before = that.o.beforeShowMonth(moDate); - if (before === false) - $(month).addClass('disabled'); - } - }); - } - - html = ''; - year = parseInt(year/10, 10) * 10; - var yearCont = this.picker.find('.datepicker-years') - .find('th:eq(1)') - .text(year + '-' + (year + 9)) - .end() - .find('td'); - year -= 1; - var years = $.map(this.dates, function(d){ - return d.getUTCFullYear(); - }), - classes; - for (var i = -1; i < 11; i++){ - classes = ['year']; - if (i === -1) - classes.push('old'); - else if (i === 10) - classes.push('new'); - if ($.inArray(year, years) !== -1) - classes.push('active'); - if (year < startYear || year > endYear) - classes.push('disabled'); - html += '' + year + ''; - year += 1; - } - yearCont.html(html); - }, - - updateNavArrows: function(){ - if (!this._allow_update) - return; - - var d = new Date(this.viewDate), - year = d.getUTCFullYear(), - month = d.getUTCMonth(); - switch (this.viewMode){ - case 0: - if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()){ - this.picker.find('.prev').css({visibility: 'hidden'}); - } - else { - this.picker.find('.prev').css({visibility: 'visible'}); - } - if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()){ - this.picker.find('.next').css({visibility: 'hidden'}); - } - else { - this.picker.find('.next').css({visibility: 'visible'}); - } - break; - case 1: - case 2: - if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()){ - this.picker.find('.prev').css({visibility: 'hidden'}); - } - else { - this.picker.find('.prev').css({visibility: 'visible'}); - } - if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()){ - this.picker.find('.next').css({visibility: 'hidden'}); - } - else { - this.picker.find('.next').css({visibility: 'visible'}); - } - break; - } - }, - - click: function(e){ - e.preventDefault(); - var target = $(e.target).closest('span, td, th'), - year, month, day; - if (target.length === 1){ - switch (target[0].nodeName.toLowerCase()){ - case 'th': - switch (target[0].className){ - case 'datepicker-switch': - this.showMode(1); - break; - case 'prev': - case 'next': - var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1); - switch (this.viewMode){ - case 0: - this.viewDate = this.moveMonth(this.viewDate, dir); - this._trigger('changeMonth', this.viewDate); - break; - case 1: - case 2: - this.viewDate = this.moveYear(this.viewDate, dir); - if (this.viewMode === 1) - this._trigger('changeYear', this.viewDate); - break; - } - this.fill(); - break; - case 'today': - var date = new Date(); - date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); - - this.showMode(-2); - var which = this.o.todayBtn === 'linked' ? null : 'view'; - this._setDate(date, which); - break; - case 'clear': - this.clearDates(); - break; - } - break; - case 'span': - if (!target.hasClass('disabled')){ - this.viewDate.setUTCDate(1); - if (target.hasClass('month')){ - day = 1; - month = target.parent().find('span').index(target); - year = this.viewDate.getUTCFullYear(); - this.viewDate.setUTCMonth(month); - this._trigger('changeMonth', this.viewDate); - if (this.o.minViewMode === 1){ - this._setDate(UTCDate(year, month, day)); - } - } - else { - day = 1; - month = 0; - year = parseInt(target.text(), 10)||0; - this.viewDate.setUTCFullYear(year); - this._trigger('changeYear', this.viewDate); - if (this.o.minViewMode === 2){ - this._setDate(UTCDate(year, month, day)); - } - } - this.showMode(-1); - this.fill(); - } - break; - case 'td': - if (target.hasClass('day') && !target.hasClass('disabled')){ - day = parseInt(target.text(), 10)||1; - year = this.viewDate.getUTCFullYear(); - month = this.viewDate.getUTCMonth(); - if (target.hasClass('old')){ - if (month === 0){ - month = 11; - year -= 1; - } - else { - month -= 1; - } - } - else if (target.hasClass('new')){ - if (month === 11){ - month = 0; - year += 1; - } - else { - month += 1; - } - } - this._setDate(UTCDate(year, month, day)); - } - break; - } - } - if (this.picker.is(':visible') && this._focused_from){ - $(this._focused_from).focus(); - } - delete this._focused_from; - }, - - _toggle_multidate: function(date){ - var ix = this.dates.contains(date); - if (!date){ - this.dates.clear(); - } - - if (ix !== -1){ - if (this.o.multidate === true || this.o.multidate > 1 || this.o.toggleActive){ - this.dates.remove(ix); - } - } else if (this.o.multidate === false) { - this.dates.clear(); - this.dates.push(date); - } - else { - this.dates.push(date); - } - - if (typeof this.o.multidate === 'number') - while (this.dates.length > this.o.multidate) - this.dates.remove(0); - }, - - _setDate: function(date, which){ - if (!which || which === 'date') - this._toggle_multidate(date && new Date(date)); - if (!which || which === 'view') - this.viewDate = date && new Date(date); - - this.fill(); - this.setValue(); - if (!which || which !== 'view') { - this._trigger('changeDate'); - } - var element; - if (this.isInput){ - element = this.element; - } - else if (this.component){ - element = this.element.find('input'); - } - if (element){ - element.change(); - } - if (this.o.autoclose && (!which || which === 'date')){ - this.hide(); - } - }, - - moveMonth: function(date, dir){ - if (!date) - return undefined; - if (!dir) - return date; - var new_date = new Date(date.valueOf()), - day = new_date.getUTCDate(), - month = new_date.getUTCMonth(), - mag = Math.abs(dir), - new_month, test; - dir = dir > 0 ? 1 : -1; - if (mag === 1){ - test = dir === -1 - // If going back one month, make sure month is not current month - // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02) - ? function(){ - return new_date.getUTCMonth() === month; - } - // If going forward one month, make sure month is as expected - // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02) - : function(){ - return new_date.getUTCMonth() !== new_month; - }; - new_month = month + dir; - new_date.setUTCMonth(new_month); - // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11 - if (new_month < 0 || new_month > 11) - new_month = (new_month + 12) % 12; - } - else { - // For magnitudes >1, move one month at a time... - for (var i=0; i < mag; i++) - // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)... - new_date = this.moveMonth(new_date, dir); - // ...then reset the day, keeping it in the new month - new_month = new_date.getUTCMonth(); - new_date.setUTCDate(day); - test = function(){ - return new_month !== new_date.getUTCMonth(); - }; - } - // Common date-resetting loop -- if date is beyond end of month, make it - // end of month - while (test()){ - new_date.setUTCDate(--day); - new_date.setUTCMonth(new_month); - } - return new_date; - }, - - moveYear: function(date, dir){ - return this.moveMonth(date, dir*12); - }, - - dateWithinRange: function(date){ - return date >= this.o.startDate && date <= this.o.endDate; - }, - - keydown: function(e){ - if (!this.picker.is(':visible')){ - if (e.keyCode === 27) // allow escape to hide and re-show picker - this.show(); - return; - } - var dateChanged = false, - dir, newDate, newViewDate, - focusDate = this.focusDate || this.viewDate; - switch (e.keyCode){ - case 27: // escape - if (this.focusDate){ - this.focusDate = null; - this.viewDate = this.dates.get(-1) || this.viewDate; - this.fill(); - } - else - this.hide(); - e.preventDefault(); - break; - case 37: // left - case 39: // right - if (!this.o.keyboardNavigation) - break; - dir = e.keyCode === 37 ? -1 : 1; - if (e.ctrlKey){ - newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir); - newViewDate = this.moveYear(focusDate, dir); - this._trigger('changeYear', this.viewDate); - } - else if (e.shiftKey){ - newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir); - newViewDate = this.moveMonth(focusDate, dir); - this._trigger('changeMonth', this.viewDate); - } - else { - newDate = new Date(this.dates.get(-1) || UTCToday()); - newDate.setUTCDate(newDate.getUTCDate() + dir); - newViewDate = new Date(focusDate); - newViewDate.setUTCDate(focusDate.getUTCDate() + dir); - } - if (this.dateWithinRange(newViewDate)){ - this.focusDate = this.viewDate = newViewDate; - this.setValue(); - this.fill(); - e.preventDefault(); - } - break; - case 38: // up - case 40: // down - if (!this.o.keyboardNavigation) - break; - dir = e.keyCode === 38 ? -1 : 1; - if (e.ctrlKey){ - newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir); - newViewDate = this.moveYear(focusDate, dir); - this._trigger('changeYear', this.viewDate); - } - else if (e.shiftKey){ - newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir); - newViewDate = this.moveMonth(focusDate, dir); - this._trigger('changeMonth', this.viewDate); - } - else { - newDate = new Date(this.dates.get(-1) || UTCToday()); - newDate.setUTCDate(newDate.getUTCDate() + dir * 7); - newViewDate = new Date(focusDate); - newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7); - } - if (this.dateWithinRange(newViewDate)){ - this.focusDate = this.viewDate = newViewDate; - this.setValue(); - this.fill(); - e.preventDefault(); - } - break; - case 32: // spacebar - // Spacebar is used in manually typing dates in some formats. - // As such, its behavior should not be hijacked. - break; - case 13: // enter - focusDate = this.focusDate || this.dates.get(-1) || this.viewDate; - if (this.o.keyboardNavigation) { - this._toggle_multidate(focusDate); - dateChanged = true; - } - this.focusDate = null; - this.viewDate = this.dates.get(-1) || this.viewDate; - this.setValue(); - this.fill(); - if (this.picker.is(':visible')){ - e.preventDefault(); - if (typeof e.stopPropagation === 'function') { - e.stopPropagation(); // All modern browsers, IE9+ - } else { - e.cancelBubble = true; // IE6,7,8 ignore "stopPropagation" - } - if (this.o.autoclose) - this.hide(); - } - break; - case 9: // tab - this.focusDate = null; - this.viewDate = this.dates.get(-1) || this.viewDate; - this.fill(); - this.hide(); - break; - } - if (dateChanged){ - if (this.dates.length) - this._trigger('changeDate'); - else - this._trigger('clearDate'); - var element; - if (this.isInput){ - element = this.element; - } - else if (this.component){ - element = this.element.find('input'); - } - if (element){ - element.change(); - } - } - }, - - showMode: function(dir){ - if (dir){ - this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir)); - } - this.picker - .children('div') - .hide() - .filter('.datepicker-' + DPGlobal.modes[this.viewMode].clsName) - .css('display', 'block'); - this.updateNavArrows(); - } - }; - - var DateRangePicker = function(element, options){ - this.element = $(element); - this.inputs = $.map(options.inputs, function(i){ - return i.jquery ? i[0] : i; - }); - delete options.inputs; - - datepickerPlugin.call($(this.inputs), options) - .bind('changeDate', $.proxy(this.dateUpdated, this)); - - this.pickers = $.map(this.inputs, function(i){ - return $(i).data('datepicker'); - }); - this.updateDates(); - }; - DateRangePicker.prototype = { - updateDates: function(){ - this.dates = $.map(this.pickers, function(i){ - return i.getUTCDate(); - }); - this.updateRanges(); - }, - updateRanges: function(){ - var range = $.map(this.dates, function(d){ - return d.valueOf(); - }); - $.each(this.pickers, function(i, p){ - p.setRange(range); - }); - }, - dateUpdated: function(e){ - // `this.updating` is a workaround for preventing infinite recursion - // between `changeDate` triggering and `setUTCDate` calling. Until - // there is a better mechanism. - if (this.updating) - return; - this.updating = true; - - var dp = $(e.target).data('datepicker'), - new_date = dp.getUTCDate(), - i = $.inArray(e.target, this.inputs), - j = i - 1, - k = i + 1, - l = this.inputs.length; - if (i === -1) - return; - - $.each(this.pickers, function(i, p){ - if (!p.getUTCDate()) - p.setUTCDate(new_date); - }); - - if (new_date < this.dates[j]){ - // Date being moved earlier/left - while (j >= 0 && new_date < this.dates[j]){ - this.pickers[j--].setUTCDate(new_date); - } - } - else if (new_date > this.dates[k]){ - // Date being moved later/right - while (k < l && new_date > this.dates[k]){ - this.pickers[k++].setUTCDate(new_date); - } - } - this.updateDates(); - - delete this.updating; - }, - remove: function(){ - $.map(this.pickers, function(p){ p.remove(); }); - delete this.element.data().datepicker; - } - }; - - function opts_from_el(el, prefix){ - // Derive options from element data-attrs - var data = $(el).data(), - out = {}, inkey, - replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])'); - prefix = new RegExp('^' + prefix.toLowerCase()); - function re_lower(_,a){ - return a.toLowerCase(); - } - for (var key in data) - if (prefix.test(key)){ - inkey = key.replace(replace, re_lower); - out[inkey] = data[key]; - } - return out; - } - - function opts_from_locale(lang){ - // Derive options from locale plugins - var out = {}; - // Check if "de-DE" style date is available, if not language should - // fallback to 2 letter code eg "de" - if (!dates[lang]){ - lang = lang.split('-')[0]; - if (!dates[lang]) - return; - } - var d = dates[lang]; - $.each(locale_opts, function(i,k){ - if (k in d) - out[k] = d[k]; - }); - return out; - } - - var old = $.fn.datepicker; - var datepickerPlugin = function(option){ - var args = Array.apply(null, arguments); - args.shift(); - var internal_return; - this.each(function(){ - var $this = $(this), - data = $this.data('datepicker'), - options = typeof option === 'object' && option; - if (!data){ - var elopts = opts_from_el(this, 'date'), - // Preliminary otions - xopts = $.extend({}, defaults, elopts, options), - locopts = opts_from_locale(xopts.language), - // Options priority: js args, data-attrs, locales, defaults - opts = $.extend({}, defaults, locopts, elopts, options); - if ($this.hasClass('input-daterange') || opts.inputs){ - var ropts = { - inputs: opts.inputs || $this.find('input').toArray() - }; - $this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts)))); - } - else { - $this.data('datepicker', (data = new Datepicker(this, opts))); - } - } - if (typeof option === 'string' && typeof data[option] === 'function'){ - internal_return = data[option].apply(data, args); - if (internal_return !== undefined) - return false; - } - }); - if (internal_return !== undefined) - return internal_return; - else - return this; - }; - $.fn.datepicker = datepickerPlugin; - - var defaults = $.fn.datepicker.defaults = { - autoclose: false, - beforeShowDay: $.noop, - beforeShowMonth: $.noop, - calendarWeeks: false, - clearBtn: false, - toggleActive: false, - daysOfWeekDisabled: [], - datesDisabled: [], - endDate: Infinity, - forceParse: true, - format: 'mm/dd/yyyy', - keyboardNavigation: true, - language: 'en', - minViewMode: 0, - multidate: false, - multidateSeparator: ',', - orientation: "auto", - rtl: false, - startDate: -Infinity, - startView: 0, - todayBtn: false, - todayHighlight: false, - weekStart: 0, - disableTouchKeyboard: false, - container: 'body' - }; - var locale_opts = $.fn.datepicker.locale_opts = [ - 'format', - 'rtl', - 'weekStart' - ]; - $.fn.datepicker.Constructor = Datepicker; - var dates = $.fn.datepicker.dates = { - en: { - days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], - daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], - daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], - months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], - monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], - today: "Today", - clear: "Clear" - } - }; - - var DPGlobal = { - modes: [ - { - clsName: 'days', - navFnc: 'Month', - navStep: 1 - }, - { - clsName: 'months', - navFnc: 'FullYear', - navStep: 1 - }, - { - clsName: 'years', - navFnc: 'FullYear', - navStep: 10 - }], - isLeapYear: function(year){ - return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)); - }, - getDaysInMonth: function(year, month){ - return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; - }, - validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g, - nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g, - parseFormat: function(format){ - // IE treats \0 as a string end in inputs (truncating the value), - // so it's a bad format delimiter, anyway - var separators = format.replace(this.validParts, '\0').split('\0'), - parts = format.match(this.validParts); - if (!separators || !separators.length || !parts || parts.length === 0){ - throw new Error("Invalid date format."); - } - return {separators: separators, parts: parts}; - }, - parseDate: function(date, format, language){ - if (!date) - return undefined; - if (date instanceof Date) - return date; - if (typeof format === 'string') - format = DPGlobal.parseFormat(format); - var part_re = /([\-+]\d+)([dmwy])/, - parts = date.match(/([\-+]\d+)([dmwy])/g), - part, dir, i; - if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){ - date = new Date(); - for (i=0; i < parts.length; i++){ - part = part_re.exec(parts[i]); - dir = parseInt(part[1]); - switch (part[2]){ - case 'd': - date.setUTCDate(date.getUTCDate() + dir); - break; - case 'm': - date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir); - break; - case 'w': - date.setUTCDate(date.getUTCDate() + dir * 7); - break; - case 'y': - date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir); - break; - } - } - return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0); - } - parts = date && date.match(this.nonpunctuation) || []; - date = new Date(); - var parsed = {}, - setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'], - setters_map = { - yyyy: function(d,v){ - return d.setUTCFullYear(v); - }, - yy: function(d,v){ - return d.setUTCFullYear(2000+v); - }, - m: function(d,v){ - if (isNaN(d)) - return d; - v -= 1; - while (v < 0) v += 12; - v %= 12; - d.setUTCMonth(v); - while (d.getUTCMonth() !== v) - d.setUTCDate(d.getUTCDate()-1); - return d; - }, - d: function(d,v){ - return d.setUTCDate(v); - } - }, - val, filtered; - setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m']; - setters_map['dd'] = setters_map['d']; - date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); - var fparts = format.parts.slice(); - // Remove noop parts - if (parts.length !== fparts.length){ - fparts = $(fparts).filter(function(i,p){ - return $.inArray(p, setters_order) !== -1; - }).toArray(); - } - // Process remainder - function match_part(){ - var m = this.slice(0, parts[i].length), - p = parts[i].slice(0, m.length); - return m.toLowerCase() === p.toLowerCase(); - } - if (parts.length === fparts.length){ - var cnt; - for (i=0, cnt = fparts.length; i < cnt; i++){ - val = parseInt(parts[i], 10); - part = fparts[i]; - if (isNaN(val)){ - switch (part){ - case 'MM': - filtered = $(dates[language].months).filter(match_part); - val = $.inArray(filtered[0], dates[language].months) + 1; - break; - case 'M': - filtered = $(dates[language].monthsShort).filter(match_part); - val = $.inArray(filtered[0], dates[language].monthsShort) + 1; - break; - } - } - parsed[part] = val; - } - var _date, s; - for (i=0; i < setters_order.length; i++){ - s = setters_order[i]; - if (s in parsed && !isNaN(parsed[s])){ - _date = new Date(date); - setters_map[s](_date, parsed[s]); - if (!isNaN(_date)) - date = _date; - } - } - } - return date; - }, - formatDate: function(date, format, language){ - if (!date) - return ''; - if (typeof format === 'string') - format = DPGlobal.parseFormat(format); - var val = { - d: date.getUTCDate(), - D: dates[language].daysShort[date.getUTCDay()], - DD: dates[language].days[date.getUTCDay()], - m: date.getUTCMonth() + 1, - M: dates[language].monthsShort[date.getUTCMonth()], - MM: dates[language].months[date.getUTCMonth()], - yy: date.getUTCFullYear().toString().substring(2), - yyyy: date.getUTCFullYear() - }; - val.dd = (val.d < 10 ? '0' : '') + val.d; - val.mm = (val.m < 10 ? '0' : '') + val.m; - date = []; - var seps = $.extend([], format.separators); - for (var i=0, cnt = format.parts.length; i <= cnt; i++){ - if (seps.length) - date.push(seps.shift()); - date.push(val[format.parts[i]]); - } - return date.join(''); - }, - headTemplate: ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - '', - contTemplate: '', - footTemplate: ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - '' - }; - DPGlobal.template = '
'+ - '
'+ - '
diff --git a/app/renderer/views/Preferences.js b/app/renderer/views/Preferences.js index 0cf923ac18..622a3fb74a 100644 --- a/app/renderer/views/Preferences.js +++ b/app/renderer/views/Preferences.js @@ -1,21 +1,22 @@ import electron from 'electron'; import React from 'react'; import _ from 'lodash'; +import Input from '../components/Input'; import TabView from './TabView'; const config = electron.remote.require('./config'); class Form extends React.Component { state = { - marketmakerUrl: config.get('marketmakerUrl'), + marketmakerUrl: config.get('marketmakerUrl') || '', }; persistState = _.debounce((name, value) => { config.set(name, value); }, 500); - handleChange = event => { - const {name, value} = event.target; + handleChange = (value, event) => { + const {name} = event.target; this.setState({[name]: value}); this.persistState(name, value); }; @@ -27,8 +28,7 @@ class Form extends React.Component { - (
-
+

HyperDEX -

+
diff --git a/app/renderer/views/TabView.scss b/app/renderer/views/TabView.scss index 0e1b11d36c..477263d999 100644 --- a/app/renderer/views/TabView.scss +++ b/app/renderer/views/TabView.scss @@ -31,7 +31,7 @@ h6 { .portfolio-name { flex: auto; align-items: start; - font-weight: 500; // TODO: Remove this when bootstrap is gone + font-weight: 500; } .portfolio-dropdown { diff --git a/package.json b/package.json index a1b9a35f43..22f5b3d48e 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,8 @@ "dependencies": { "bip39": "^2.5.0", "crypto-hash": "^0.1.0", - "delay": "^2.0.0", - "jquery": "^3.2.1", "lodash": "^4.17.4", + "modern-normalize": "^0.4.0", "p-queue": "^2.3.1", "randoma": "^1.2.0", "react": "^16.2.0", diff --git a/vendor/bootstrap-dashboard-theme/fonts/toolkit-entypo.eot b/vendor/bootstrap-dashboard-theme/fonts/toolkit-entypo.eot deleted file mode 100644 index 8579ce4ac3..0000000000 Binary files a/vendor/bootstrap-dashboard-theme/fonts/toolkit-entypo.eot and /dev/null differ diff --git a/vendor/bootstrap-dashboard-theme/fonts/toolkit-entypo.ttf b/vendor/bootstrap-dashboard-theme/fonts/toolkit-entypo.ttf deleted file mode 100644 index 1a19f44e2d..0000000000 Binary files a/vendor/bootstrap-dashboard-theme/fonts/toolkit-entypo.ttf and /dev/null differ diff --git a/vendor/bootstrap-dashboard-theme/fonts/toolkit-entypo.woff b/vendor/bootstrap-dashboard-theme/fonts/toolkit-entypo.woff deleted file mode 100644 index b6f49af8c0..0000000000 Binary files a/vendor/bootstrap-dashboard-theme/fonts/toolkit-entypo.woff and /dev/null differ diff --git a/vendor/bootstrap-dashboard-theme/fonts/toolkit-entypo.woff2 b/vendor/bootstrap-dashboard-theme/fonts/toolkit-entypo.woff2 deleted file mode 100644 index 6bf9519498..0000000000 Binary files a/vendor/bootstrap-dashboard-theme/fonts/toolkit-entypo.woff2 and /dev/null differ diff --git a/vendor/bootstrap-dashboard-theme/js/bootstrap/alert.js b/vendor/bootstrap-dashboard-theme/js/bootstrap/alert.js deleted file mode 100644 index b6b9336af7..0000000000 --- a/vendor/bootstrap-dashboard-theme/js/bootstrap/alert.js +++ /dev/null @@ -1,193 +0,0 @@ -import Util from './util' - - -/** - * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-beta): alert.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ - -const Alert = (($) => { - - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - const NAME = 'alert' - const VERSION = '4.0.0-beta' - const DATA_KEY = 'bs.alert' - const EVENT_KEY = `.${DATA_KEY}` - const DATA_API_KEY = '.data-api' - const JQUERY_NO_CONFLICT = $.fn[NAME] - const TRANSITION_DURATION = 150 - - const Selector = { - DISMISS : '[data-dismiss="alert"]' - } - - const Event = { - CLOSE : `close${EVENT_KEY}`, - CLOSED : `closed${EVENT_KEY}`, - CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}` - } - - const ClassName = { - ALERT : 'alert', - FADE : 'fade', - SHOW : 'show' - } - - - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - class Alert { - - constructor(element) { - this._element = element - } - - - // getters - - static get VERSION() { - return VERSION - } - - - // public - - close(element) { - element = element || this._element - - const rootElement = this._getRootElement(element) - const customEvent = this._triggerCloseEvent(rootElement) - - if (customEvent.isDefaultPrevented()) { - return - } - - this._removeElement(rootElement) - } - - dispose() { - $.removeData(this._element, DATA_KEY) - this._element = null - } - - - // private - - _getRootElement(element) { - const selector = Util.getSelectorFromElement(element) - let parent = false - - if (selector) { - parent = $(selector)[0] - } - - if (!parent) { - parent = $(element).closest(`.${ClassName.ALERT}`)[0] - } - - return parent - } - - _triggerCloseEvent(element) { - const closeEvent = $.Event(Event.CLOSE) - - $(element).trigger(closeEvent) - return closeEvent - } - - _removeElement(element) { - $(element).removeClass(ClassName.SHOW) - - if (!Util.supportsTransitionEnd() || - !$(element).hasClass(ClassName.FADE)) { - this._destroyElement(element) - return - } - - $(element) - .one(Util.TRANSITION_END, (event) => this._destroyElement(element, event)) - .emulateTransitionEnd(TRANSITION_DURATION) - } - - _destroyElement(element) { - $(element) - .detach() - .trigger(Event.CLOSED) - .remove() - } - - - // static - - static _jQueryInterface(config) { - return this.each(function () { - const $element = $(this) - let data = $element.data(DATA_KEY) - - if (!data) { - data = new Alert(this) - $element.data(DATA_KEY, data) - } - - if (config === 'close') { - data[config](this) - } - }) - } - - static _handleDismiss(alertInstance) { - return function (event) { - if (event) { - event.preventDefault() - } - - alertInstance.close(this) - } - } - - } - - - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - - $(document).on( - Event.CLICK_DATA_API, - Selector.DISMISS, - Alert._handleDismiss(new Alert()) - ) - - - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME] = Alert._jQueryInterface - $.fn[NAME].Constructor = Alert - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT - return Alert._jQueryInterface - } - - return Alert - -})(jQuery) - -export default Alert diff --git a/vendor/bootstrap-dashboard-theme/js/bootstrap/button.js b/vendor/bootstrap-dashboard-theme/js/bootstrap/button.js deleted file mode 100644 index a8a72ef569..0000000000 --- a/vendor/bootstrap-dashboard-theme/js/bootstrap/button.js +++ /dev/null @@ -1,186 +0,0 @@ -/** - * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-beta): button.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ - -const Button = (($) => { - - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - const NAME = 'button' - const VERSION = '4.0.0-beta' - const DATA_KEY = 'bs.button' - const EVENT_KEY = `.${DATA_KEY}` - const DATA_API_KEY = '.data-api' - const JQUERY_NO_CONFLICT = $.fn[NAME] - - const ClassName = { - ACTIVE : 'active', - BUTTON : 'btn', - FOCUS : 'focus' - } - - const Selector = { - DATA_TOGGLE_CARROT : '[data-toggle^="button"]', - DATA_TOGGLE : '[data-toggle="buttons"]', - INPUT : 'input', - ACTIVE : '.active', - BUTTON : '.btn' - } - - const Event = { - CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`, - FOCUS_BLUR_DATA_API : `focus${EVENT_KEY}${DATA_API_KEY} ` - + `blur${EVENT_KEY}${DATA_API_KEY}` - } - - - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - class Button { - - constructor(element) { - this._element = element - } - - - // getters - - static get VERSION() { - return VERSION - } - - - // public - - toggle() { - let triggerChangeEvent = true - let addAriaPressed = true - const rootElement = $(this._element).closest( - Selector.DATA_TOGGLE - )[0] - - if (rootElement) { - const input = $(this._element).find(Selector.INPUT)[0] - - if (input) { - if (input.type === 'radio') { - if (input.checked && - $(this._element).hasClass(ClassName.ACTIVE)) { - triggerChangeEvent = false - - } else { - const activeElement = $(rootElement).find(Selector.ACTIVE)[0] - - if (activeElement) { - $(activeElement).removeClass(ClassName.ACTIVE) - } - } - } - - if (triggerChangeEvent) { - if (input.hasAttribute('disabled') || - rootElement.hasAttribute('disabled') || - input.classList.contains('disabled') || - rootElement.classList.contains('disabled')) { - return - } - input.checked = !$(this._element).hasClass(ClassName.ACTIVE) - $(input).trigger('change') - } - - input.focus() - addAriaPressed = false - } - - } - - if (addAriaPressed) { - this._element.setAttribute('aria-pressed', - !$(this._element).hasClass(ClassName.ACTIVE)) - } - - if (triggerChangeEvent) { - $(this._element).toggleClass(ClassName.ACTIVE) - } - } - - dispose() { - $.removeData(this._element, DATA_KEY) - this._element = null - } - - - // static - - static _jQueryInterface(config) { - return this.each(function () { - let data = $(this).data(DATA_KEY) - - if (!data) { - data = new Button(this) - $(this).data(DATA_KEY, data) - } - - if (config === 'toggle') { - data[config]() - } - }) - } - - } - - - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - - $(document) - .on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, (event) => { - event.preventDefault() - - let button = event.target - - if (!$(button).hasClass(ClassName.BUTTON)) { - button = $(button).closest(Selector.BUTTON) - } - - Button._jQueryInterface.call($(button), 'toggle') - }) - .on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, (event) => { - const button = $(event.target).closest(Selector.BUTTON)[0] - $(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type)) - }) - - - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME] = Button._jQueryInterface - $.fn[NAME].Constructor = Button - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT - return Button._jQueryInterface - } - - return Button - -})(jQuery) - -export default Button diff --git a/vendor/bootstrap-dashboard-theme/js/bootstrap/carousel.js b/vendor/bootstrap-dashboard-theme/js/bootstrap/carousel.js deleted file mode 100644 index a5d5f143a4..0000000000 --- a/vendor/bootstrap-dashboard-theme/js/bootstrap/carousel.js +++ /dev/null @@ -1,521 +0,0 @@ -import Util from './util' - - -/** - * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-beta): carousel.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ - -const Carousel = (($) => { - - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - const NAME = 'carousel' - const VERSION = '4.0.0-beta' - const DATA_KEY = 'bs.carousel' - const EVENT_KEY = `.${DATA_KEY}` - const DATA_API_KEY = '.data-api' - const JQUERY_NO_CONFLICT = $.fn[NAME] - const TRANSITION_DURATION = 600 - const ARROW_LEFT_KEYCODE = 37 // KeyboardEvent.which value for left arrow key - const ARROW_RIGHT_KEYCODE = 39 // KeyboardEvent.which value for right arrow key - const TOUCHEVENT_COMPAT_WAIT = 500 // Time for mouse compat events to fire after touch - - const Default = { - interval : 5000, - keyboard : true, - slide : false, - pause : 'hover', - wrap : true - } - - const DefaultType = { - interval : '(number|boolean)', - keyboard : 'boolean', - slide : '(boolean|string)', - pause : '(string|boolean)', - wrap : 'boolean' - } - - const Direction = { - NEXT : 'next', - PREV : 'prev', - LEFT : 'left', - RIGHT : 'right' - } - - const Event = { - SLIDE : `slide${EVENT_KEY}`, - SLID : `slid${EVENT_KEY}`, - KEYDOWN : `keydown${EVENT_KEY}`, - MOUSEENTER : `mouseenter${EVENT_KEY}`, - MOUSELEAVE : `mouseleave${EVENT_KEY}`, - TOUCHEND : `touchend${EVENT_KEY}`, - LOAD_DATA_API : `load${EVENT_KEY}${DATA_API_KEY}`, - CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}` - } - - const ClassName = { - CAROUSEL : 'carousel', - ACTIVE : 'active', - SLIDE : 'slide', - RIGHT : 'carousel-item-right', - LEFT : 'carousel-item-left', - NEXT : 'carousel-item-next', - PREV : 'carousel-item-prev', - ITEM : 'carousel-item' - } - - const Selector = { - ACTIVE : '.active', - ACTIVE_ITEM : '.active.carousel-item', - ITEM : '.carousel-item', - NEXT_PREV : '.carousel-item-next, .carousel-item-prev', - INDICATORS : '.carousel-indicators', - DATA_SLIDE : '[data-slide], [data-slide-to]', - DATA_RIDE : '[data-ride="carousel"]' - } - - - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - class Carousel { - - constructor(element, config) { - this._items = null - this._interval = null - this._activeElement = null - - this._isPaused = false - this._isSliding = false - - this.touchTimeout = null - - this._config = this._getConfig(config) - this._element = $(element)[0] - this._indicatorsElement = $(this._element).find(Selector.INDICATORS)[0] - - this._addEventListeners() - } - - - // getters - - static get VERSION() { - return VERSION - } - - static get Default() { - return Default - } - - - // public - - next() { - if (!this._isSliding) { - this._slide(Direction.NEXT) - } - } - - nextWhenVisible() { - // Don't call next when the page isn't visible - if (!document.hidden) { - this.next() - } - } - - prev() { - if (!this._isSliding) { - this._slide(Direction.PREV) - } - } - - pause(event) { - if (!event) { - this._isPaused = true - } - - if ($(this._element).find(Selector.NEXT_PREV)[0] && - Util.supportsTransitionEnd()) { - Util.triggerTransitionEnd(this._element) - this.cycle(true) - } - - clearInterval(this._interval) - this._interval = null - } - - cycle(event) { - if (!event) { - this._isPaused = false - } - - if (this._interval) { - clearInterval(this._interval) - this._interval = null - } - - if (this._config.interval && !this._isPaused) { - this._interval = setInterval( - (document.visibilityState ? this.nextWhenVisible : this.next).bind(this), - this._config.interval - ) - } - } - - to(index) { - this._activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0] - - const activeIndex = this._getItemIndex(this._activeElement) - - if (index > this._items.length - 1 || index < 0) { - return - } - - if (this._isSliding) { - $(this._element).one(Event.SLID, () => this.to(index)) - return - } - - if (activeIndex === index) { - this.pause() - this.cycle() - return - } - - const direction = index > activeIndex ? - Direction.NEXT : - Direction.PREV - - this._slide(direction, this._items[index]) - } - - dispose() { - $(this._element).off(EVENT_KEY) - $.removeData(this._element, DATA_KEY) - - this._items = null - this._config = null - this._element = null - this._interval = null - this._isPaused = null - this._isSliding = null - this._activeElement = null - this._indicatorsElement = null - } - - - // private - - _getConfig(config) { - config = $.extend({}, Default, config) - Util.typeCheckConfig(NAME, config, DefaultType) - return config - } - - _addEventListeners() { - if (this._config.keyboard) { - $(this._element) - .on(Event.KEYDOWN, (event) => this._keydown(event)) - } - - if (this._config.pause === 'hover') { - $(this._element) - .on(Event.MOUSEENTER, (event) => this.pause(event)) - .on(Event.MOUSELEAVE, (event) => this.cycle(event)) - if ('ontouchstart' in document.documentElement) { - // if it's a touch-enabled device, mouseenter/leave are fired as - // part of the mouse compatibility events on first tap - the carousel - // would stop cycling until user tapped out of it; - // here, we listen for touchend, explicitly pause the carousel - // (as if it's the second time we tap on it, mouseenter compat event - // is NOT fired) and after a timeout (to allow for mouse compatibility - // events to fire) we explicitly restart cycling - $(this._element).on(Event.TOUCHEND, () => { - this.pause() - if (this.touchTimeout) { - clearTimeout(this.touchTimeout) - } - this.touchTimeout = setTimeout((event) => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval) - }) - } - } - } - - _keydown(event) { - if (/input|textarea/i.test(event.target.tagName)) { - return - } - - switch (event.which) { - case ARROW_LEFT_KEYCODE: - event.preventDefault() - this.prev() - break - case ARROW_RIGHT_KEYCODE: - event.preventDefault() - this.next() - break - default: - return - } - } - - _getItemIndex(element) { - this._items = $.makeArray($(element).parent().find(Selector.ITEM)) - return this._items.indexOf(element) - } - - _getItemByDirection(direction, activeElement) { - const isNextDirection = direction === Direction.NEXT - const isPrevDirection = direction === Direction.PREV - const activeIndex = this._getItemIndex(activeElement) - const lastItemIndex = this._items.length - 1 - const isGoingToWrap = isPrevDirection && activeIndex === 0 || - isNextDirection && activeIndex === lastItemIndex - - if (isGoingToWrap && !this._config.wrap) { - return activeElement - } - - const delta = direction === Direction.PREV ? -1 : 1 - const itemIndex = (activeIndex + delta) % this._items.length - - return itemIndex === -1 ? - this._items[this._items.length - 1] : this._items[itemIndex] - } - - - _triggerSlideEvent(relatedTarget, eventDirectionName) { - const targetIndex = this._getItemIndex(relatedTarget) - const fromIndex = this._getItemIndex($(this._element).find(Selector.ACTIVE_ITEM)[0]) - const slideEvent = $.Event(Event.SLIDE, { - relatedTarget, - direction: eventDirectionName, - from: fromIndex, - to: targetIndex - }) - - $(this._element).trigger(slideEvent) - - return slideEvent - } - - _setActiveIndicatorElement(element) { - if (this._indicatorsElement) { - $(this._indicatorsElement) - .find(Selector.ACTIVE) - .removeClass(ClassName.ACTIVE) - - const nextIndicator = this._indicatorsElement.children[ - this._getItemIndex(element) - ] - - if (nextIndicator) { - $(nextIndicator).addClass(ClassName.ACTIVE) - } - } - } - - _slide(direction, element) { - const activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0] - const activeElementIndex = this._getItemIndex(activeElement) - const nextElement = element || activeElement && - this._getItemByDirection(direction, activeElement) - const nextElementIndex = this._getItemIndex(nextElement) - const isCycling = Boolean(this._interval) - - let directionalClassName - let orderClassName - let eventDirectionName - - if (direction === Direction.NEXT) { - directionalClassName = ClassName.LEFT - orderClassName = ClassName.NEXT - eventDirectionName = Direction.LEFT - } else { - directionalClassName = ClassName.RIGHT - orderClassName = ClassName.PREV - eventDirectionName = Direction.RIGHT - } - - if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) { - this._isSliding = false - return - } - - const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName) - if (slideEvent.isDefaultPrevented()) { - return - } - - if (!activeElement || !nextElement) { - // some weirdness is happening, so we bail - return - } - - this._isSliding = true - - if (isCycling) { - this.pause() - } - - this._setActiveIndicatorElement(nextElement) - - const slidEvent = $.Event(Event.SLID, { - relatedTarget: nextElement, - direction: eventDirectionName, - from: activeElementIndex, - to: nextElementIndex - }) - - if (Util.supportsTransitionEnd() && - $(this._element).hasClass(ClassName.SLIDE)) { - - $(nextElement).addClass(orderClassName) - - Util.reflow(nextElement) - - $(activeElement).addClass(directionalClassName) - $(nextElement).addClass(directionalClassName) - - $(activeElement) - .one(Util.TRANSITION_END, () => { - $(nextElement) - .removeClass(`${directionalClassName} ${orderClassName}`) - .addClass(ClassName.ACTIVE) - - $(activeElement).removeClass(`${ClassName.ACTIVE} ${orderClassName} ${directionalClassName}`) - - this._isSliding = false - - setTimeout(() => $(this._element).trigger(slidEvent), 0) - - }) - .emulateTransitionEnd(TRANSITION_DURATION) - - } else { - $(activeElement).removeClass(ClassName.ACTIVE) - $(nextElement).addClass(ClassName.ACTIVE) - - this._isSliding = false - $(this._element).trigger(slidEvent) - } - - if (isCycling) { - this.cycle() - } - } - - - // static - - static _jQueryInterface(config) { - return this.each(function () { - let data = $(this).data(DATA_KEY) - const _config = $.extend({}, Default, $(this).data()) - - if (typeof config === 'object') { - $.extend(_config, config) - } - - const action = typeof config === 'string' ? config : _config.slide - - if (!data) { - data = new Carousel(this, _config) - $(this).data(DATA_KEY, data) - } - - if (typeof config === 'number') { - data.to(config) - } else if (typeof action === 'string') { - if (data[action] === undefined) { - throw new Error(`No method named "${action}"`) - } - data[action]() - } else if (_config.interval) { - data.pause() - data.cycle() - } - }) - } - - static _dataApiClickHandler(event) { - const selector = Util.getSelectorFromElement(this) - - if (!selector) { - return - } - - const target = $(selector)[0] - - if (!target || !$(target).hasClass(ClassName.CAROUSEL)) { - return - } - - const config = $.extend({}, $(target).data(), $(this).data()) - const slideIndex = this.getAttribute('data-slide-to') - - if (slideIndex) { - config.interval = false - } - - Carousel._jQueryInterface.call($(target), config) - - if (slideIndex) { - $(target).data(DATA_KEY).to(slideIndex) - } - - event.preventDefault() - } - - } - - - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - - $(document) - .on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler) - - $(window).on(Event.LOAD_DATA_API, () => { - $(Selector.DATA_RIDE).each(function () { - const $carousel = $(this) - Carousel._jQueryInterface.call($carousel, $carousel.data()) - }) - }) - - - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME] = Carousel._jQueryInterface - $.fn[NAME].Constructor = Carousel - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT - return Carousel._jQueryInterface - } - - return Carousel - -})(jQuery) - -export default Carousel diff --git a/vendor/bootstrap-dashboard-theme/js/bootstrap/collapse.js b/vendor/bootstrap-dashboard-theme/js/bootstrap/collapse.js deleted file mode 100644 index 2f00b98cb6..0000000000 --- a/vendor/bootstrap-dashboard-theme/js/bootstrap/collapse.js +++ /dev/null @@ -1,396 +0,0 @@ -import Util from './util' - - -/** - * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-beta): collapse.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ - -const Collapse = (($) => { - - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - const NAME = 'collapse' - const VERSION = '4.0.0-beta' - const DATA_KEY = 'bs.collapse' - const EVENT_KEY = `.${DATA_KEY}` - const DATA_API_KEY = '.data-api' - const JQUERY_NO_CONFLICT = $.fn[NAME] - const TRANSITION_DURATION = 600 - - const Default = { - toggle : true, - parent : '' - } - - const DefaultType = { - toggle : 'boolean', - parent : 'string' - } - - const Event = { - SHOW : `show${EVENT_KEY}`, - SHOWN : `shown${EVENT_KEY}`, - HIDE : `hide${EVENT_KEY}`, - HIDDEN : `hidden${EVENT_KEY}`, - CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}` - } - - const ClassName = { - SHOW : 'show', - COLLAPSE : 'collapse', - COLLAPSING : 'collapsing', - COLLAPSED : 'collapsed' - } - - const Dimension = { - WIDTH : 'width', - HEIGHT : 'height' - } - - const Selector = { - ACTIVES : '.show, .collapsing', - DATA_TOGGLE : '[data-toggle="collapse"]' - } - - - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - class Collapse { - - constructor(element, config) { - this._isTransitioning = false - this._element = element - this._config = this._getConfig(config) - this._triggerArray = $.makeArray($( - `[data-toggle="collapse"][href="#${element.id}"],` + - `[data-toggle="collapse"][data-target="#${element.id}"]` - )) - const tabToggles = $(Selector.DATA_TOGGLE) - for (let i = 0; i < tabToggles.length; i++) { - const elem = tabToggles[i] - const selector = Util.getSelectorFromElement(elem) - if (selector !== null && $(selector).filter(element).length > 0) { - this._triggerArray.push(elem) - } - } - - this._parent = this._config.parent ? this._getParent() : null - - if (!this._config.parent) { - this._addAriaAndCollapsedClass(this._element, this._triggerArray) - } - - if (this._config.toggle) { - this.toggle() - } - } - - - // getters - - static get VERSION() { - return VERSION - } - - static get Default() { - return Default - } - - - // public - - toggle() { - if ($(this._element).hasClass(ClassName.SHOW)) { - this.hide() - } else { - this.show() - } - } - - show() { - if (this._isTransitioning || - $(this._element).hasClass(ClassName.SHOW)) { - return - } - - let actives - let activesData - - if (this._parent) { - actives = $.makeArray($(this._parent).children().children(Selector.ACTIVES)) - if (!actives.length) { - actives = null - } - } - - if (actives) { - activesData = $(actives).data(DATA_KEY) - if (activesData && activesData._isTransitioning) { - return - } - } - - const startEvent = $.Event(Event.SHOW) - $(this._element).trigger(startEvent) - if (startEvent.isDefaultPrevented()) { - return - } - - if (actives) { - Collapse._jQueryInterface.call($(actives), 'hide') - if (!activesData) { - $(actives).data(DATA_KEY, null) - } - } - - const dimension = this._getDimension() - - $(this._element) - .removeClass(ClassName.COLLAPSE) - .addClass(ClassName.COLLAPSING) - - this._element.style[dimension] = 0 - - if (this._triggerArray.length) { - $(this._triggerArray) - .removeClass(ClassName.COLLAPSED) - .attr('aria-expanded', true) - } - - this.setTransitioning(true) - - const complete = () => { - $(this._element) - .removeClass(ClassName.COLLAPSING) - .addClass(ClassName.COLLAPSE) - .addClass(ClassName.SHOW) - - this._element.style[dimension] = '' - - this.setTransitioning(false) - - $(this._element).trigger(Event.SHOWN) - } - - if (!Util.supportsTransitionEnd()) { - complete() - return - } - - const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1) - const scrollSize = `scroll${capitalizedDimension}` - - $(this._element) - .one(Util.TRANSITION_END, complete) - .emulateTransitionEnd(TRANSITION_DURATION) - - this._element.style[dimension] = `${this._element[scrollSize]}px` - } - - hide() { - if (this._isTransitioning || - !$(this._element).hasClass(ClassName.SHOW)) { - return - } - - const startEvent = $.Event(Event.HIDE) - $(this._element).trigger(startEvent) - if (startEvent.isDefaultPrevented()) { - return - } - - const dimension = this._getDimension() - - this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px` - - Util.reflow(this._element) - - $(this._element) - .addClass(ClassName.COLLAPSING) - .removeClass(ClassName.COLLAPSE) - .removeClass(ClassName.SHOW) - - if (this._triggerArray.length) { - for (let i = 0; i < this._triggerArray.length; i++) { - const trigger = this._triggerArray[i] - const selector = Util.getSelectorFromElement(trigger) - if (selector !== null) { - const $elem = $(selector) - if (!$elem.hasClass(ClassName.SHOW)) { - $(trigger).addClass(ClassName.COLLAPSED) - .attr('aria-expanded', false) - } - } - } - } - - this.setTransitioning(true) - - const complete = () => { - this.setTransitioning(false) - $(this._element) - .removeClass(ClassName.COLLAPSING) - .addClass(ClassName.COLLAPSE) - .trigger(Event.HIDDEN) - } - - this._element.style[dimension] = '' - - if (!Util.supportsTransitionEnd()) { - complete() - return - } - - $(this._element) - .one(Util.TRANSITION_END, complete) - .emulateTransitionEnd(TRANSITION_DURATION) - } - - setTransitioning(isTransitioning) { - this._isTransitioning = isTransitioning - } - - dispose() { - $.removeData(this._element, DATA_KEY) - - this._config = null - this._parent = null - this._element = null - this._triggerArray = null - this._isTransitioning = null - } - - - // private - - _getConfig(config) { - config = $.extend({}, Default, config) - config.toggle = Boolean(config.toggle) // coerce string values - Util.typeCheckConfig(NAME, config, DefaultType) - return config - } - - _getDimension() { - const hasWidth = $(this._element).hasClass(Dimension.WIDTH) - return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT - } - - _getParent() { - const parent = $(this._config.parent)[0] - const selector = - `[data-toggle="collapse"][data-parent="${this._config.parent}"]` - - $(parent).find(selector).each((i, element) => { - this._addAriaAndCollapsedClass( - Collapse._getTargetFromElement(element), - [element] - ) - }) - - return parent - } - - _addAriaAndCollapsedClass(element, triggerArray) { - if (element) { - const isOpen = $(element).hasClass(ClassName.SHOW) - - if (triggerArray.length) { - $(triggerArray) - .toggleClass(ClassName.COLLAPSED, !isOpen) - .attr('aria-expanded', isOpen) - } - } - } - - - // static - - static _getTargetFromElement(element) { - const selector = Util.getSelectorFromElement(element) - return selector ? $(selector)[0] : null - } - - static _jQueryInterface(config) { - return this.each(function () { - const $this = $(this) - let data = $this.data(DATA_KEY) - const _config = $.extend( - {}, - Default, - $this.data(), - typeof config === 'object' && config - ) - - if (!data && _config.toggle && /show|hide/.test(config)) { - _config.toggle = false - } - - if (!data) { - data = new Collapse(this, _config) - $this.data(DATA_KEY, data) - } - - if (typeof config === 'string') { - if (data[config] === undefined) { - throw new Error(`No method named "${config}"`) - } - data[config]() - } - }) - } - - } - - - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - - $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { - if (!/input|textarea/i.test(event.target.tagName)) { - event.preventDefault() - } - - const $trigger = $(this) - const selector = Util.getSelectorFromElement(this) - $(selector).each(function () { - const $target = $(this) - const data = $target.data(DATA_KEY) - const config = data ? 'toggle' : $trigger.data() - Collapse._jQueryInterface.call($target, config) - }) - }) - - - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME] = Collapse._jQueryInterface - $.fn[NAME].Constructor = Collapse - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT - return Collapse._jQueryInterface - } - - return Collapse - -})(jQuery) - -export default Collapse diff --git a/vendor/bootstrap-dashboard-theme/js/bootstrap/dropdown.js b/vendor/bootstrap-dashboard-theme/js/bootstrap/dropdown.js deleted file mode 100644 index 5e792a527f..0000000000 --- a/vendor/bootstrap-dashboard-theme/js/bootstrap/dropdown.js +++ /dev/null @@ -1,450 +0,0 @@ -/* global Popper */ - -import Util from './util' - - -/** - * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-beta): dropdown.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ - -const Dropdown = (($) => { - - /** - * Check for Popper dependency - * Popper - https://popper.js.org - */ - if (typeof Popper === 'undefined') { - throw new Error('Bootstrap dropdown require Popper.js (https://popper.js.org)') - } - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - const NAME = 'dropdown' - const VERSION = '4.0.0-beta' - const DATA_KEY = 'bs.dropdown' - const EVENT_KEY = `.${DATA_KEY}` - const DATA_API_KEY = '.data-api' - const JQUERY_NO_CONFLICT = $.fn[NAME] - const ESCAPE_KEYCODE = 27 // KeyboardEvent.which value for Escape (Esc) key - const SPACE_KEYCODE = 32 // KeyboardEvent.which value for space key - const TAB_KEYCODE = 9 // KeyboardEvent.which value for tab key - const ARROW_UP_KEYCODE = 38 // KeyboardEvent.which value for up arrow key - const ARROW_DOWN_KEYCODE = 40 // KeyboardEvent.which value for down arrow key - const RIGHT_MOUSE_BUTTON_WHICH = 3 // MouseEvent.which value for the right button (assuming a right-handed mouse) - const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEYCODE}|${ARROW_DOWN_KEYCODE}|${ESCAPE_KEYCODE}`) - - const Event = { - HIDE : `hide${EVENT_KEY}`, - HIDDEN : `hidden${EVENT_KEY}`, - SHOW : `show${EVENT_KEY}`, - SHOWN : `shown${EVENT_KEY}`, - CLICK : `click${EVENT_KEY}`, - CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`, - KEYDOWN_DATA_API : `keydown${EVENT_KEY}${DATA_API_KEY}`, - KEYUP_DATA_API : `keyup${EVENT_KEY}${DATA_API_KEY}` - } - - const ClassName = { - DISABLED : 'disabled', - SHOW : 'show', - DROPUP : 'dropup', - MENURIGHT : 'dropdown-menu-right', - MENULEFT : 'dropdown-menu-left' - } - - const Selector = { - DATA_TOGGLE : '[data-toggle="dropdown"]', - FORM_CHILD : '.dropdown form', - MENU : '.dropdown-menu', - NAVBAR_NAV : '.navbar-nav', - VISIBLE_ITEMS : '.dropdown-menu .dropdown-item:not(.disabled)' - } - - const AttachmentMap = { - TOP : 'top-start', - TOPEND : 'top-end', - BOTTOM : 'bottom-start', - BOTTOMEND : 'bottom-end' - } - - const Default = { - placement : AttachmentMap.BOTTOM, - offset : 0, - flip : true - } - - const DefaultType = { - placement : 'string', - offset : '(number|string)', - flip : 'boolean' - } - - - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - class Dropdown { - - constructor(element, config) { - this._element = element - this._popper = null - this._config = this._getConfig(config) - this._menu = this._getMenuElement() - this._inNavbar = this._detectNavbar() - - this._addEventListeners() - } - - - // getters - - static get VERSION() { - return VERSION - } - - static get Default() { - return Default - } - - static get DefaultType() { - return DefaultType - } - - // public - - toggle() { - if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED)) { - return - } - - const parent = Dropdown._getParentFromElement(this._element) - const isActive = $(this._menu).hasClass(ClassName.SHOW) - - Dropdown._clearMenus() - - if (isActive) { - return - } - - const relatedTarget = { - relatedTarget : this._element - } - const showEvent = $.Event(Event.SHOW, relatedTarget) - - $(parent).trigger(showEvent) - - if (showEvent.isDefaultPrevented()) { - return - } - - let element = this._element - // for dropup with alignment we use the parent as popper container - if ($(parent).hasClass(ClassName.DROPUP)) { - if ($(this._menu).hasClass(ClassName.MENULEFT) || $(this._menu).hasClass(ClassName.MENURIGHT)) { - element = parent - } - } - this._popper = new Popper(element, this._menu, this._getPopperConfig()) - - // if this is a touch-enabled device we add extra - // empty mouseover listeners to the body's immediate children; - // only needed because of broken event delegation on iOS - // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html - if ('ontouchstart' in document.documentElement && - !$(parent).closest(Selector.NAVBAR_NAV).length) { - $('body').children().on('mouseover', null, $.noop) - } - - this._element.focus() - this._element.setAttribute('aria-expanded', true) - - $(this._menu).toggleClass(ClassName.SHOW) - $(parent) - .toggleClass(ClassName.SHOW) - .trigger($.Event(Event.SHOWN, relatedTarget)) - } - - dispose() { - $.removeData(this._element, DATA_KEY) - $(this._element).off(EVENT_KEY) - this._element = null - this._menu = null - if (this._popper !== null) { - this._popper.destroy() - } - this._popper = null - } - - update() { - this._inNavbar = this._detectNavbar() - if (this._popper !== null) { - this._popper.scheduleUpdate() - } - } - - // private - - _addEventListeners() { - $(this._element).on(Event.CLICK, (event) => { - event.preventDefault() - event.stopPropagation() - this.toggle() - }) - } - - _getConfig(config) { - const elementData = $(this._element).data() - if (elementData.placement !== undefined) { - elementData.placement = AttachmentMap[elementData.placement.toUpperCase()] - } - - config = $.extend( - {}, - this.constructor.Default, - $(this._element).data(), - config - ) - - Util.typeCheckConfig( - NAME, - config, - this.constructor.DefaultType - ) - - return config - } - - _getMenuElement() { - if (!this._menu) { - const parent = Dropdown._getParentFromElement(this._element) - this._menu = $(parent).find(Selector.MENU)[0] - } - return this._menu - } - - _getPlacement() { - const $parentDropdown = $(this._element).parent() - let placement = this._config.placement - - // Handle dropup - if ($parentDropdown.hasClass(ClassName.DROPUP) || this._config.placement === AttachmentMap.TOP) { - placement = AttachmentMap.TOP - if ($(this._menu).hasClass(ClassName.MENURIGHT)) { - placement = AttachmentMap.TOPEND - } - } else if ($(this._menu).hasClass(ClassName.MENURIGHT)) { - placement = AttachmentMap.BOTTOMEND - } - return placement - } - - _detectNavbar() { - return $(this._element).closest('.navbar').length > 0 - } - - _getPopperConfig() { - const popperConfig = { - placement : this._getPlacement(), - modifiers : { - offset : { - offset : this._config.offset - }, - flip : { - enabled : this._config.flip - } - } - } - - // Disable Popper.js for Dropdown in Navbar - if (this._inNavbar) { - popperConfig.modifiers.applyStyle = { - enabled: !this._inNavbar - } - } - return popperConfig - } - - // static - - static _jQueryInterface(config) { - return this.each(function () { - let data = $(this).data(DATA_KEY) - const _config = typeof config === 'object' ? config : null - - if (!data) { - data = new Dropdown(this, _config) - $(this).data(DATA_KEY, data) - } - - if (typeof config === 'string') { - if (data[config] === undefined) { - throw new Error(`No method named "${config}"`) - } - data[config]() - } - }) - } - - static _clearMenus(event) { - if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || - event.type === 'keyup' && event.which !== TAB_KEYCODE)) { - return - } - - const toggles = $.makeArray($(Selector.DATA_TOGGLE)) - for (let i = 0; i < toggles.length; i++) { - const parent = Dropdown._getParentFromElement(toggles[i]) - const context = $(toggles[i]).data(DATA_KEY) - const relatedTarget = { - relatedTarget : toggles[i] - } - - if (!context) { - continue - } - - const dropdownMenu = context._menu - if (!$(parent).hasClass(ClassName.SHOW)) { - continue - } - - if (event && (event.type === 'click' && - /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) - && $.contains(parent, event.target)) { - continue - } - - const hideEvent = $.Event(Event.HIDE, relatedTarget) - $(parent).trigger(hideEvent) - if (hideEvent.isDefaultPrevented()) { - continue - } - - // if this is a touch-enabled device we remove the extra - // empty mouseover listeners we added for iOS support - if ('ontouchstart' in document.documentElement) { - $('body').children().off('mouseover', null, $.noop) - } - - toggles[i].setAttribute('aria-expanded', 'false') - - $(dropdownMenu).removeClass(ClassName.SHOW) - $(parent) - .removeClass(ClassName.SHOW) - .trigger($.Event(Event.HIDDEN, relatedTarget)) - } - } - - static _getParentFromElement(element) { - let parent - const selector = Util.getSelectorFromElement(element) - - if (selector) { - parent = $(selector)[0] - } - - return parent || element.parentNode - } - - static _dataApiKeydownHandler(event) { - if (!REGEXP_KEYDOWN.test(event.which) || /button/i.test(event.target.tagName) && event.which === SPACE_KEYCODE || - /input|textarea/i.test(event.target.tagName)) { - return - } - - event.preventDefault() - event.stopPropagation() - - if (this.disabled || $(this).hasClass(ClassName.DISABLED)) { - return - } - - const parent = Dropdown._getParentFromElement(this) - const isActive = $(parent).hasClass(ClassName.SHOW) - - if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || - isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { - - if (event.which === ESCAPE_KEYCODE) { - const toggle = $(parent).find(Selector.DATA_TOGGLE)[0] - $(toggle).trigger('focus') - } - - $(this).trigger('click') - return - } - - const items = $(parent).find(Selector.VISIBLE_ITEMS).get() - - if (!items.length) { - return - } - - let index = items.indexOf(event.target) - - if (event.which === ARROW_UP_KEYCODE && index > 0) { // up - index-- - } - - if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { // down - index++ - } - - if (index < 0) { - index = 0 - } - - items[index].focus() - } - - } - - - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - - $(document) - .on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler) - .on(Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown._dataApiKeydownHandler) - .on(`${Event.CLICK_DATA_API} ${Event.KEYUP_DATA_API}`, Dropdown._clearMenus) - .on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { - event.preventDefault() - event.stopPropagation() - Dropdown._jQueryInterface.call($(this), 'toggle') - }) - .on(Event.CLICK_DATA_API, Selector.FORM_CHILD, (e) => { - e.stopPropagation() - }) - - - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME] = Dropdown._jQueryInterface - $.fn[NAME].Constructor = Dropdown - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT - return Dropdown._jQueryInterface - } - - return Dropdown - -})(jQuery) - -export default Dropdown diff --git a/vendor/bootstrap-dashboard-theme/js/bootstrap/modal.js b/vendor/bootstrap-dashboard-theme/js/bootstrap/modal.js deleted file mode 100644 index 9f17fafc8f..0000000000 --- a/vendor/bootstrap-dashboard-theme/js/bootstrap/modal.js +++ /dev/null @@ -1,578 +0,0 @@ -import Util from './util' - - -/** - * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-beta): modal.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ - -const Modal = (($) => { - - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - const NAME = 'modal' - const VERSION = '4.0.0-beta' - const DATA_KEY = 'bs.modal' - const EVENT_KEY = `.${DATA_KEY}` - const DATA_API_KEY = '.data-api' - const JQUERY_NO_CONFLICT = $.fn[NAME] - const TRANSITION_DURATION = 300 - const BACKDROP_TRANSITION_DURATION = 150 - const ESCAPE_KEYCODE = 27 // KeyboardEvent.which value for Escape (Esc) key - - const Default = { - backdrop : true, - keyboard : true, - focus : true, - show : true - } - - const DefaultType = { - backdrop : '(boolean|string)', - keyboard : 'boolean', - focus : 'boolean', - show : 'boolean' - } - - const Event = { - HIDE : `hide${EVENT_KEY}`, - HIDDEN : `hidden${EVENT_KEY}`, - SHOW : `show${EVENT_KEY}`, - SHOWN : `shown${EVENT_KEY}`, - FOCUSIN : `focusin${EVENT_KEY}`, - RESIZE : `resize${EVENT_KEY}`, - CLICK_DISMISS : `click.dismiss${EVENT_KEY}`, - KEYDOWN_DISMISS : `keydown.dismiss${EVENT_KEY}`, - MOUSEUP_DISMISS : `mouseup.dismiss${EVENT_KEY}`, - MOUSEDOWN_DISMISS : `mousedown.dismiss${EVENT_KEY}`, - CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}` - } - - const ClassName = { - SCROLLBAR_MEASURER : 'modal-scrollbar-measure', - BACKDROP : 'modal-backdrop', - OPEN : 'modal-open', - FADE : 'fade', - SHOW : 'show' - } - - const Selector = { - DIALOG : '.modal-dialog', - DATA_TOGGLE : '[data-toggle="modal"]', - DATA_DISMISS : '[data-dismiss="modal"]', - FIXED_CONTENT : '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', - NAVBAR_TOGGLER : '.navbar-toggler' - } - - - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - class Modal { - - constructor(element, config) { - this._config = this._getConfig(config) - this._element = element - this._dialog = $(element).find(Selector.DIALOG)[0] - this._backdrop = null - this._isShown = false - this._isBodyOverflowing = false - this._ignoreBackdropClick = false - this._originalBodyPadding = 0 - this._scrollbarWidth = 0 - } - - - // getters - - static get VERSION() { - return VERSION - } - - static get Default() { - return Default - } - - - // public - - toggle(relatedTarget) { - return this._isShown ? this.hide() : this.show(relatedTarget) - } - - show(relatedTarget) { - if (this._isTransitioning) { - return - } - - if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) { - this._isTransitioning = true - } - - const showEvent = $.Event(Event.SHOW, { - relatedTarget - }) - - $(this._element).trigger(showEvent) - - if (this._isShown || showEvent.isDefaultPrevented()) { - return - } - - this._isShown = true - - this._checkScrollbar() - this._setScrollbar() - - $(document.body).addClass(ClassName.OPEN) - - this._setEscapeEvent() - this._setResizeEvent() - - $(this._element).on( - Event.CLICK_DISMISS, - Selector.DATA_DISMISS, - (event) => this.hide(event) - ) - - $(this._dialog).on(Event.MOUSEDOWN_DISMISS, () => { - $(this._element).one(Event.MOUSEUP_DISMISS, (event) => { - if ($(event.target).is(this._element)) { - this._ignoreBackdropClick = true - } - }) - }) - - this._showBackdrop(() => this._showElement(relatedTarget)) - } - - hide(event) { - if (event) { - event.preventDefault() - } - - if (this._isTransitioning || !this._isShown) { - return - } - - const transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE) - - if (transition) { - this._isTransitioning = true - } - - const hideEvent = $.Event(Event.HIDE) - - $(this._element).trigger(hideEvent) - - if (!this._isShown || hideEvent.isDefaultPrevented()) { - return - } - - this._isShown = false - - this._setEscapeEvent() - this._setResizeEvent() - - $(document).off(Event.FOCUSIN) - - $(this._element).removeClass(ClassName.SHOW) - - $(this._element).off(Event.CLICK_DISMISS) - $(this._dialog).off(Event.MOUSEDOWN_DISMISS) - - if (transition) { - - $(this._element) - .one(Util.TRANSITION_END, (event) => this._hideModal(event)) - .emulateTransitionEnd(TRANSITION_DURATION) - } else { - this._hideModal() - } - } - - dispose() { - $.removeData(this._element, DATA_KEY) - - $(window, document, this._element, this._backdrop).off(EVENT_KEY) - - this._config = null - this._element = null - this._dialog = null - this._backdrop = null - this._isShown = null - this._isBodyOverflowing = null - this._ignoreBackdropClick = null - this._scrollbarWidth = null - } - - handleUpdate() { - this._adjustDialog() - } - - // private - - _getConfig(config) { - config = $.extend({}, Default, config) - Util.typeCheckConfig(NAME, config, DefaultType) - return config - } - - _showElement(relatedTarget) { - const transition = Util.supportsTransitionEnd() && - $(this._element).hasClass(ClassName.FADE) - - if (!this._element.parentNode || - this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { - // don't move modals dom position - document.body.appendChild(this._element) - } - - this._element.style.display = 'block' - this._element.removeAttribute('aria-hidden') - this._element.scrollTop = 0 - - if (transition) { - Util.reflow(this._element) - } - - $(this._element).addClass(ClassName.SHOW) - - if (this._config.focus) { - this._enforceFocus() - } - - const shownEvent = $.Event(Event.SHOWN, { - relatedTarget - }) - - const transitionComplete = () => { - if (this._config.focus) { - this._element.focus() - } - this._isTransitioning = false - $(this._element).trigger(shownEvent) - } - - if (transition) { - $(this._dialog) - .one(Util.TRANSITION_END, transitionComplete) - .emulateTransitionEnd(TRANSITION_DURATION) - } else { - transitionComplete() - } - } - - _enforceFocus() { - $(document) - .off(Event.FOCUSIN) // guard against infinite focus loop - .on(Event.FOCUSIN, (event) => { - if (document !== event.target && - this._element !== event.target && - !$(this._element).has(event.target).length) { - this._element.focus() - } - }) - } - - _setEscapeEvent() { - if (this._isShown && this._config.keyboard) { - $(this._element).on(Event.KEYDOWN_DISMISS, (event) => { - if (event.which === ESCAPE_KEYCODE) { - event.preventDefault() - this.hide() - } - }) - - } else if (!this._isShown) { - $(this._element).off(Event.KEYDOWN_DISMISS) - } - } - - _setResizeEvent() { - if (this._isShown) { - $(window).on(Event.RESIZE, (event) => this.handleUpdate(event)) - } else { - $(window).off(Event.RESIZE) - } - } - - _hideModal() { - this._element.style.display = 'none' - this._element.setAttribute('aria-hidden', true) - this._isTransitioning = false - this._showBackdrop(() => { - $(document.body).removeClass(ClassName.OPEN) - this._resetAdjustments() - this._resetScrollbar() - $(this._element).trigger(Event.HIDDEN) - }) - } - - _removeBackdrop() { - if (this._backdrop) { - $(this._backdrop).remove() - this._backdrop = null - } - } - - _showBackdrop(callback) { - const animate = $(this._element).hasClass(ClassName.FADE) ? - ClassName.FADE : '' - - if (this._isShown && this._config.backdrop) { - const doAnimate = Util.supportsTransitionEnd() && animate - - this._backdrop = document.createElement('div') - this._backdrop.className = ClassName.BACKDROP - - if (animate) { - $(this._backdrop).addClass(animate) - } - - $(this._backdrop).appendTo(document.body) - - $(this._element).on(Event.CLICK_DISMISS, (event) => { - if (this._ignoreBackdropClick) { - this._ignoreBackdropClick = false - return - } - if (event.target !== event.currentTarget) { - return - } - if (this._config.backdrop === 'static') { - this._element.focus() - } else { - this.hide() - } - }) - - if (doAnimate) { - Util.reflow(this._backdrop) - } - - $(this._backdrop).addClass(ClassName.SHOW) - - if (!callback) { - return - } - - if (!doAnimate) { - callback() - return - } - - $(this._backdrop) - .one(Util.TRANSITION_END, callback) - .emulateTransitionEnd(BACKDROP_TRANSITION_DURATION) - - } else if (!this._isShown && this._backdrop) { - $(this._backdrop).removeClass(ClassName.SHOW) - - const callbackRemove = () => { - this._removeBackdrop() - if (callback) { - callback() - } - } - - if (Util.supportsTransitionEnd() && - $(this._element).hasClass(ClassName.FADE)) { - $(this._backdrop) - .one(Util.TRANSITION_END, callbackRemove) - .emulateTransitionEnd(BACKDROP_TRANSITION_DURATION) - } else { - callbackRemove() - } - - } else if (callback) { - callback() - } - } - - - // ---------------------------------------------------------------------- - // the following methods are used to handle overflowing modals - // todo (fat): these should probably be refactored out of modal.js - // ---------------------------------------------------------------------- - - _adjustDialog() { - const isModalOverflowing = - this._element.scrollHeight > document.documentElement.clientHeight - - if (!this._isBodyOverflowing && isModalOverflowing) { - this._element.style.paddingLeft = `${this._scrollbarWidth}px` - } - - if (this._isBodyOverflowing && !isModalOverflowing) { - this._element.style.paddingRight = `${this._scrollbarWidth}px` - } - } - - _resetAdjustments() { - this._element.style.paddingLeft = '' - this._element.style.paddingRight = '' - } - - _checkScrollbar() { - this._isBodyOverflowing = document.body.clientWidth < window.innerWidth - this._scrollbarWidth = this._getScrollbarWidth() - } - - _setScrollbar() { - if (this._isBodyOverflowing) { - // Note: DOMNode.style.paddingRight returns the actual value or '' if not set - // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set - - // Adjust fixed content padding - $(Selector.FIXED_CONTENT).each((index, element) => { - const actualPadding = $(element)[0].style.paddingRight - const calculatedPadding = $(element).css('padding-right') - $(element).data('padding-right', actualPadding).css('padding-right', `${parseFloat(calculatedPadding) + this._scrollbarWidth}px`) - }) - - // Adjust navbar-toggler margin - $(Selector.NAVBAR_TOGGLER).each((index, element) => { - const actualMargin = $(element)[0].style.marginRight - const calculatedMargin = $(element).css('margin-right') - $(element).data('margin-right', actualMargin).css('margin-right', `${parseFloat(calculatedMargin) + this._scrollbarWidth}px`) - }) - - // Adjust body padding - const actualPadding = document.body.style.paddingRight - const calculatedPadding = $('body').css('padding-right') - $('body').data('padding-right', actualPadding).css('padding-right', `${parseFloat(calculatedPadding) + this._scrollbarWidth}px`) - } - } - - _resetScrollbar() { - // Restore fixed content padding - $(Selector.FIXED_CONTENT).each((index, element) => { - const padding = $(element).data('padding-right') - if (typeof padding !== 'undefined') { - $(element).css('padding-right', padding).removeData('padding-right') - } - }) - - // Restore navbar-toggler margin - $(Selector.NAVBAR_TOGGLER).each((index, element) => { - const margin = $(element).data('margin-right') - if (typeof margin !== 'undefined') { - $(element).css('margin-right', margin).removeData('margin-right') - } - }) - - // Restore body padding - const padding = $('body').data('padding-right') - if (typeof padding !== 'undefined') { - $('body').css('padding-right', padding).removeData('padding-right') - } - } - - _getScrollbarWidth() { // thx d.walsh - const scrollDiv = document.createElement('div') - scrollDiv.className = ClassName.SCROLLBAR_MEASURER - document.body.appendChild(scrollDiv) - const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth - document.body.removeChild(scrollDiv) - return scrollbarWidth - } - - - // static - - static _jQueryInterface(config, relatedTarget) { - return this.each(function () { - let data = $(this).data(DATA_KEY) - const _config = $.extend( - {}, - Modal.Default, - $(this).data(), - typeof config === 'object' && config - ) - - if (!data) { - data = new Modal(this, _config) - $(this).data(DATA_KEY, data) - } - - if (typeof config === 'string') { - if (data[config] === undefined) { - throw new Error(`No method named "${config}"`) - } - data[config](relatedTarget) - } else if (_config.show) { - data.show(relatedTarget) - } - }) - } - - } - - - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - - $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { - let target - const selector = Util.getSelectorFromElement(this) - - if (selector) { - target = $(selector)[0] - } - - const config = $(target).data(DATA_KEY) ? - 'toggle' : $.extend({}, $(target).data(), $(this).data()) - - if (this.tagName === 'A' || this.tagName === 'AREA') { - event.preventDefault() - } - - const $target = $(target).one(Event.SHOW, (showEvent) => { - if (showEvent.isDefaultPrevented()) { - // only register focus restorer if modal will actually get shown - return - } - - $target.one(Event.HIDDEN, () => { - if ($(this).is(':visible')) { - this.focus() - } - }) - }) - - Modal._jQueryInterface.call($(target), config, this) - }) - - - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME] = Modal._jQueryInterface - $.fn[NAME].Constructor = Modal - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT - return Modal._jQueryInterface - } - - return Modal - -})(jQuery) - -export default Modal diff --git a/vendor/bootstrap-dashboard-theme/js/bootstrap/popover.js b/vendor/bootstrap-dashboard-theme/js/bootstrap/popover.js deleted file mode 100644 index 0e8953f771..0000000000 --- a/vendor/bootstrap-dashboard-theme/js/bootstrap/popover.js +++ /dev/null @@ -1,192 +0,0 @@ -import Tooltip from './tooltip' - - -/** - * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-beta): popover.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ - -const Popover = (($) => { - - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - const NAME = 'popover' - const VERSION = '4.0.0-beta' - const DATA_KEY = 'bs.popover' - const EVENT_KEY = `.${DATA_KEY}` - const JQUERY_NO_CONFLICT = $.fn[NAME] - const CLASS_PREFIX = 'bs-popover' - const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g') - - const Default = $.extend({}, Tooltip.Default, { - placement : 'right', - trigger : 'click', - content : '', - template : '' - }) - - const DefaultType = $.extend({}, Tooltip.DefaultType, { - content : '(string|element|function)' - }) - - const ClassName = { - FADE : 'fade', - SHOW : 'show' - } - - const Selector = { - TITLE : '.popover-header', - CONTENT : '.popover-body' - } - - const Event = { - HIDE : `hide${EVENT_KEY}`, - HIDDEN : `hidden${EVENT_KEY}`, - SHOW : `show${EVENT_KEY}`, - SHOWN : `shown${EVENT_KEY}`, - INSERTED : `inserted${EVENT_KEY}`, - CLICK : `click${EVENT_KEY}`, - FOCUSIN : `focusin${EVENT_KEY}`, - FOCUSOUT : `focusout${EVENT_KEY}`, - MOUSEENTER : `mouseenter${EVENT_KEY}`, - MOUSELEAVE : `mouseleave${EVENT_KEY}` - } - - - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - class Popover extends Tooltip { - - - // getters - - static get VERSION() { - return VERSION - } - - static get Default() { - return Default - } - - static get NAME() { - return NAME - } - - static get DATA_KEY() { - return DATA_KEY - } - - static get Event() { - return Event - } - - static get EVENT_KEY() { - return EVENT_KEY - } - - static get DefaultType() { - return DefaultType - } - - - // overrides - - isWithContent() { - return this.getTitle() || this._getContent() - } - - addAttachmentClass(attachment) { - $(this.getTipElement()).addClass(`${CLASS_PREFIX}-${attachment}`) - } - - getTipElement() { - return this.tip = this.tip || $(this.config.template)[0] - } - - setContent() { - const $tip = $(this.getTipElement()) - - // we use append for html objects to maintain js events - this.setElementContent($tip.find(Selector.TITLE), this.getTitle()) - this.setElementContent($tip.find(Selector.CONTENT), this._getContent()) - - $tip.removeClass(`${ClassName.FADE} ${ClassName.SHOW}`) - } - - // private - - _getContent() { - return this.element.getAttribute('data-content') - || (typeof this.config.content === 'function' ? - this.config.content.call(this.element) : - this.config.content) - } - - _cleanTipClass() { - const $tip = $(this.getTipElement()) - const tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX) - if (tabClass !== null && tabClass.length > 0) { - $tip.removeClass(tabClass.join('')) - } - } - - - // static - - static _jQueryInterface(config) { - return this.each(function () { - let data = $(this).data(DATA_KEY) - const _config = typeof config === 'object' ? config : null - - if (!data && /destroy|hide/.test(config)) { - return - } - - if (!data) { - data = new Popover(this, _config) - $(this).data(DATA_KEY, data) - } - - if (typeof config === 'string') { - if (data[config] === undefined) { - throw new Error(`No method named "${config}"`) - } - data[config]() - } - }) - } - } - - - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME] = Popover._jQueryInterface - $.fn[NAME].Constructor = Popover - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT - return Popover._jQueryInterface - } - - return Popover - -})(jQuery) - -export default Popover diff --git a/vendor/bootstrap-dashboard-theme/js/bootstrap/scrollspy.js b/vendor/bootstrap-dashboard-theme/js/bootstrap/scrollspy.js deleted file mode 100644 index b70b7e477e..0000000000 --- a/vendor/bootstrap-dashboard-theme/js/bootstrap/scrollspy.js +++ /dev/null @@ -1,335 +0,0 @@ -import Util from './util' - - -/** - * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-beta): scrollspy.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ - -const ScrollSpy = (($) => { - - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - const NAME = 'scrollspy' - const VERSION = '4.0.0-beta' - const DATA_KEY = 'bs.scrollspy' - const EVENT_KEY = `.${DATA_KEY}` - const DATA_API_KEY = '.data-api' - const JQUERY_NO_CONFLICT = $.fn[NAME] - - const Default = { - offset : 10, - method : 'auto', - target : '' - } - - const DefaultType = { - offset : 'number', - method : 'string', - target : '(string|element)' - } - - const Event = { - ACTIVATE : `activate${EVENT_KEY}`, - SCROLL : `scroll${EVENT_KEY}`, - LOAD_DATA_API : `load${EVENT_KEY}${DATA_API_KEY}` - } - - const ClassName = { - DROPDOWN_ITEM : 'dropdown-item', - DROPDOWN_MENU : 'dropdown-menu', - ACTIVE : 'active' - } - - const Selector = { - DATA_SPY : '[data-spy="scroll"]', - ACTIVE : '.active', - NAV_LIST_GROUP : '.nav, .list-group', - NAV_LINKS : '.nav-link', - LIST_ITEMS : '.list-group-item', - DROPDOWN : '.dropdown', - DROPDOWN_ITEMS : '.dropdown-item', - DROPDOWN_TOGGLE : '.dropdown-toggle' - } - - const OffsetMethod = { - OFFSET : 'offset', - POSITION : 'position' - } - - - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - class ScrollSpy { - - constructor(element, config) { - this._element = element - this._scrollElement = element.tagName === 'BODY' ? window : element - this._config = this._getConfig(config) - this._selector = `${this._config.target} ${Selector.NAV_LINKS},` - + `${this._config.target} ${Selector.LIST_ITEMS},` - + `${this._config.target} ${Selector.DROPDOWN_ITEMS}` - this._offsets = [] - this._targets = [] - this._activeTarget = null - this._scrollHeight = 0 - - $(this._scrollElement).on(Event.SCROLL, (event) => this._process(event)) - - this.refresh() - this._process() - } - - - // getters - - static get VERSION() { - return VERSION - } - - static get Default() { - return Default - } - - - // public - - refresh() { - const autoMethod = this._scrollElement !== this._scrollElement.window ? - OffsetMethod.POSITION : OffsetMethod.OFFSET - - const offsetMethod = this._config.method === 'auto' ? - autoMethod : this._config.method - - const offsetBase = offsetMethod === OffsetMethod.POSITION ? - this._getScrollTop() : 0 - - this._offsets = [] - this._targets = [] - - this._scrollHeight = this._getScrollHeight() - - const targets = $.makeArray($(this._selector)) - - targets - .map((element) => { - let target - const targetSelector = Util.getSelectorFromElement(element) - - if (targetSelector) { - target = $(targetSelector)[0] - } - - if (target) { - const targetBCR = target.getBoundingClientRect() - if (targetBCR.width || targetBCR.height) { - // todo (fat): remove sketch reliance on jQuery position/offset - return [ - $(target)[offsetMethod]().top + offsetBase, - targetSelector - ] - } - } - return null - }) - .filter((item) => item) - .sort((a, b) => a[0] - b[0]) - .forEach((item) => { - this._offsets.push(item[0]) - this._targets.push(item[1]) - }) - } - - dispose() { - $.removeData(this._element, DATA_KEY) - $(this._scrollElement).off(EVENT_KEY) - - this._element = null - this._scrollElement = null - this._config = null - this._selector = null - this._offsets = null - this._targets = null - this._activeTarget = null - this._scrollHeight = null - } - - - // private - - _getConfig(config) { - config = $.extend({}, Default, config) - - if (typeof config.target !== 'string') { - let id = $(config.target).attr('id') - if (!id) { - id = Util.getUID(NAME) - $(config.target).attr('id', id) - } - config.target = `#${id}` - } - - Util.typeCheckConfig(NAME, config, DefaultType) - - return config - } - - _getScrollTop() { - return this._scrollElement === window ? - this._scrollElement.pageYOffset : this._scrollElement.scrollTop - } - - _getScrollHeight() { - return this._scrollElement.scrollHeight || Math.max( - document.body.scrollHeight, - document.documentElement.scrollHeight - ) - } - - _getOffsetHeight() { - return this._scrollElement === window ? - window.innerHeight : this._scrollElement.getBoundingClientRect().height - } - - _process() { - const scrollTop = this._getScrollTop() + this._config.offset - const scrollHeight = this._getScrollHeight() - const maxScroll = this._config.offset - + scrollHeight - - this._getOffsetHeight() - - if (this._scrollHeight !== scrollHeight) { - this.refresh() - } - - if (scrollTop >= maxScroll) { - const target = this._targets[this._targets.length - 1] - - if (this._activeTarget !== target) { - this._activate(target) - } - return - } - - if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { - this._activeTarget = null - this._clear() - return - } - - for (let i = this._offsets.length; i--;) { - const isActiveTarget = this._activeTarget !== this._targets[i] - && scrollTop >= this._offsets[i] - && (this._offsets[i + 1] === undefined || - scrollTop < this._offsets[i + 1]) - - if (isActiveTarget) { - this._activate(this._targets[i]) - } - } - } - - _activate(target) { - this._activeTarget = target - - this._clear() - - let queries = this._selector.split(',') - queries = queries.map((selector) => { - return `${selector}[data-target="${target}"],` + - `${selector}[href="${target}"]` - }) - - const $link = $(queries.join(',')) - - if ($link.hasClass(ClassName.DROPDOWN_ITEM)) { - $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE) - $link.addClass(ClassName.ACTIVE) - } else { - // Set triggered link as active - $link.addClass(ClassName.ACTIVE) - // Set triggered links parents as active - // With both
    and
 '+dates[this.o.language].daysMin[(dowCnt++)%7]+'
'+ calWeek +''+prevMonth.getUTCDate() + '
«»
'+ - DPGlobal.headTemplate+ - ''+ - DPGlobal.footTemplate+ - '
'+ - '
'+ - '
'+ - ''+ - DPGlobal.headTemplate+ - DPGlobal.contTemplate+ - DPGlobal.footTemplate+ - '
'+ - '
'+ - '
'+ - ''+ - DPGlobal.headTemplate+ - DPGlobal.contTemplate+ - DPGlobal.footTemplate+ - '
'+ - '
'+ - ''; - - $.fn.datepicker.DPGlobal = DPGlobal; - - - /* DATEPICKER NO CONFLICT - * =================== */ - - $.fn.datepicker.noConflict = function(){ - $.fn.datepicker = old; - return this; - }; - - - /* DATEPICKER DATA-API - * ================== */ - - $(document).on( - 'focus.datepicker.data-api click.datepicker.data-api', - '[data-provide="datepicker"]', - function(e){ - var $this = $(this); - if ($this.data('datepicker')) - return; - e.preventDefault(); - // component click requires us to explicitly show it - datepickerPlugin.call($this, 'show'); - } - ); - $(function(){ - datepickerPlugin.call($('[data-provide="datepicker-inline"]')); - }); - -}(window.jQuery)); diff --git a/vendor/bootstrap-dashboard-theme/scss/bootstrap/_alert.scss b/vendor/bootstrap-dashboard-theme/scss/bootstrap/_alert.scss deleted file mode 100644 index 3dfd13f56a..0000000000 --- a/vendor/bootstrap-dashboard-theme/scss/bootstrap/_alert.scss +++ /dev/null @@ -1,48 +0,0 @@ -// -// Base styles -// - -.alert { - padding: $alert-padding-y $alert-padding-x; - margin-bottom: $alert-margin-bottom; - border: $alert-border-width solid transparent; - @include border-radius($alert-border-radius); -} - -// Headings for larger alerts -.alert-heading { - // Specified to prevent conflicts of changing $headings-color - color: inherit; -} - -// Provide class for links that match alerts -.alert-link { - font-weight: $alert-link-font-weight; -} - - -// Dismissible alerts -// -// Expand the right padding and account for the close button's positioning. - -.alert-dismissible { - // Adjust close link position - .close { - position: relative; - top: -$alert-padding-y; - right: -$alert-padding-x; - padding: $alert-padding-y $alert-padding-x; - color: inherit; - } -} - - -// Alternate styles -// -// Generate contextual modifier classes for colorizing the alert. - -@each $color, $value in $theme-colors { - .alert-#{$color} { - @include alert-variant(theme-color-level($color, -10), theme-color-level($color, -9), theme-color-level($color, 6)); - } -} diff --git a/vendor/bootstrap-dashboard-theme/scss/bootstrap/_badge.scss b/vendor/bootstrap-dashboard-theme/scss/bootstrap/_badge.scss deleted file mode 100644 index 8a76263444..0000000000 --- a/vendor/bootstrap-dashboard-theme/scss/bootstrap/_badge.scss +++ /dev/null @@ -1,48 +0,0 @@ -// Base class -// -// Requires one of the contextual, color modifier classes for `color` and -// `background-color`. - -.badge { - display: inline-block; - padding: $badge-padding-y $badge-padding-x; - font-size: $badge-font-size; - font-weight: $badge-font-weight; - line-height: 1; - color: $badge-color; - text-align: center; - white-space: nowrap; - vertical-align: baseline; - @include border-radius(); - - // Empty badges collapse automatically - &:empty { - display: none; - } -} - -// Quick fix for badges in buttons -.btn .badge { - position: relative; - top: -1px; -} - -// Pill badges -// -// Make them extra rounded with a modifier to replace v3's badges. - -.badge-pill { - padding-right: $badge-pill-padding-x; - padding-left: $badge-pill-padding-x; - @include border-radius($badge-pill-border-radius); -} - -// Colors -// -// Contextual variations (linked badges get darker on :hover). - -@each $color, $value in $theme-colors { - .badge-#{$color} { - @include badge-variant($value); - } -} diff --git a/vendor/bootstrap-dashboard-theme/scss/bootstrap/_breadcrumb.scss b/vendor/bootstrap-dashboard-theme/scss/bootstrap/_breadcrumb.scss deleted file mode 100644 index 2bc0e2086e..0000000000 --- a/vendor/bootstrap-dashboard-theme/scss/bootstrap/_breadcrumb.scss +++ /dev/null @@ -1,38 +0,0 @@ -.breadcrumb { - padding: $breadcrumb-padding-y $breadcrumb-padding-x; - margin-bottom: 1rem; - list-style: none; - background-color: $breadcrumb-bg; - @include border-radius($border-radius); - @include clearfix; -} - -.breadcrumb-item { - float: left; - - // The separator between breadcrumbs (by default, a forward-slash: "/") - + .breadcrumb-item::before { - display: inline-block; // Suppress underlining of the separator in modern browsers - padding-right: $breadcrumb-item-padding; - padding-left: $breadcrumb-item-padding; - color: $breadcrumb-divider-color; - content: "#{$breadcrumb-divider}"; - } - - // IE9-11 hack to properly handle hyperlink underlines for breadcrumbs built - // without `