Skip to content

Commit

Permalink
chore(release): update dist
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Hamilton committed Sep 6, 2020
1 parent c463868 commit ea8e914
Show file tree
Hide file tree
Showing 70 changed files with 1,276 additions and 659 deletions.
2 changes: 1 addition & 1 deletion components/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@
---------------*/

.ui.icon.buttons .button,
.ui.icon.button:not(.animated) {
.ui.icon.button:not(.animated):not(.compact) {
padding: 0.78571429em 0.78571429em 0.78571429em;
}
.ui.animated.icon.button > .content > .icon,
Expand Down
2 changes: 1 addition & 1 deletion components/button.min.css

Large diffs are not rendered by default.

25 changes: 16 additions & 9 deletions components/calendar.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
.ui.calendar .ui.table tr th {
border-left: none;
}
.ui.calendar .ui.table tr th .icon {
.ui.calendar .ui.table tr th i.icon {
margin: 0;
}
.ui.calendar .ui.table tr:first-child th {
Expand Down Expand Up @@ -104,7 +104,7 @@
position: absolute;
right: 0;
}
.ui.calendar .ui.table tr .disabled {
.ui.ui.calendar .ui.table tr .disabled {
pointer-events: auto;
cursor: default;
color: rgba(40, 40, 40, 0.3);
Expand All @@ -127,21 +127,28 @@
-webkit-box-shadow: none;
box-shadow: none;
}
.ui.calendar .ui.table.inverted tr td.range {
.ui.calendar:not(.disabled) .calendar:focus .ui.table tbody tr td.focus,
.ui.calendar:not(.disabled) .calendar.active .ui.table tbody tr td.focus {
-webkit-box-shadow: inset 0 0 0 1px #85B7D9;
box-shadow: inset 0 0 0 1px #85B7D9;
}
.ui.inverted.calendar .ui.table.inverted tr td.range {
background: rgba(255, 255, 255, 0.08);
color: #ffffff;
-webkit-box-shadow: none;
box-shadow: none;
}
.ui.calendar:not(.disabled) .calendar:focus .ui.table tbody tr td.focus,
.ui.calendar:not(.disabled) .calendar.active .ui.table tbody tr td.focus {
.ui.inverted.calendar:not(.disabled) .calendar:focus .ui.table.inverted tbody tr td.focus,
.ui.inverted.calendar:not(.disabled) .calendar.active .ui.table.inverted tbody tr td.focus {
-webkit-box-shadow: inset 0 0 0 1px #85B7D9;
box-shadow: inset 0 0 0 1px #85B7D9;
}
.ui.calendar:not(.disabled) .calendar:focus .ui.table.inverted tbody tr td.focus,
.ui.calendar:not(.disabled) .calendar.active .ui.table.inverted tbody tr td.focus {
-webkit-box-shadow: inset 0 0 0 1px #85B7D9;
box-shadow: inset 0 0 0 1px #85B7D9;
.ui.inverted.calendar .ui.inverted.table tr .disabled {
color: rgba(225, 225, 225, 0.3);
}
.ui.inverted.calendar .ui.inverted.table tr .adjacent:not(.disabled) {
color: rgba(255, 255, 255, 0.8);
background: rgba(255, 255, 255, 0.02);
}


Expand Down
162 changes: 144 additions & 18 deletions components/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ $.fn.calendar = function(parameters) {
'15': {'row': 2, 'column': 2 },
'20': {'row': 3, 'column': 1 },
'30': {'row': 2, 'column': 1 }
}
},
numberText = ['','one','two','three','four','five','six','seven','eight']
;

$allModules
Expand Down Expand Up @@ -74,7 +75,10 @@ $.fn.calendar = function(parameters) {

isTouch,
isTouchDown = false,
isInverted = $module.hasClass(className.inverted),
focusDateUsedForRange = false,
selectionComplete = false,
classObserver,
module
;

Expand All @@ -92,6 +96,7 @@ $.fn.calendar = function(parameters) {
module.create.calendar();

module.bind.events();
module.observeChanges();
module.instantiate();
},

Expand All @@ -105,6 +110,7 @@ $.fn.calendar = function(parameters) {
module.verbose('Destroying previous calendar for', element);
$module.removeData(moduleNamespace);
module.unbind.events();
module.disconnect.classObserver();
},

setup: {
Expand Down Expand Up @@ -140,12 +146,19 @@ $.fn.calendar = function(parameters) {
$container = $('<div/>').addClass(className.popup)[domPositionFunction]($activatorParent);
}
$container.addClass(className.calendar);
var onVisible = settings.onVisible;
if(isInverted){
$container.addClass(className.inverted);
}
var onVisible = function () {
module.refreshTooltips();
return settings.onVisible.apply($container, arguments);
};
var onHidden = settings.onHidden;
if (!$input.length) {
//no input, $container has to handle focus/blur
$container.attr('tabindex', '0');
onVisible = function () {
module.refreshTooltips();
module.focus();
return settings.onVisible.apply($container, arguments);
};
Expand All @@ -157,7 +170,7 @@ $.fn.calendar = function(parameters) {
var onShow = function () {
//reset the focus date onShow
module.set.focusDate(module.get.date());
module.set.mode(settings.startMode);
module.set.mode(module.get.validatedMode(settings.startMode));
return settings.onShow.apply($container, arguments);
};
var on = module.setting('on');
Expand All @@ -177,6 +190,7 @@ $.fn.calendar = function(parameters) {
if ($activator.length && !settings.inline) {
return;
}
settings.inline = true;
$container = $('<div/>').addClass(className.calendar).appendTo($module);
if (!$input.length) {
$container.attr('tabindex', '0');
Expand All @@ -186,6 +200,7 @@ $.fn.calendar = function(parameters) {
if (settings.touchReadonly && $input.length && isTouch) {
$input.prop('readonly', true);
}
module.check.disabled();
},
date: function () {
var date;
Expand All @@ -197,6 +212,21 @@ $.fn.calendar = function(parameters) {
date = parser.date($input.val(), settings);
}
module.set.date(date, settings.formatInput, false);
module.set.mode(module.get.mode(), false);
}
},

trigger: {
change: function() {
var
inputElement = $input[0]
;
if(inputElement) {
var events = document.createEvent('HTMLEvents');
module.verbose('Triggering native change event');
events.initEvent('change', true, false);
inputElement.dispatchEvent(events);
}
}
},

Expand Down Expand Up @@ -278,7 +308,10 @@ $.fn.calendar = function(parameters) {
if (isDay && settings.showWeekNumbers){
tempMode += ' andweek';
}
var table = $('<table/>').addClass(className.table).addClass(tempMode).appendTo(container);
var table = $('<table/>').addClass(className.table).addClass(tempMode).addClass(numberText[columns] + ' column').appendTo(container);
if(isInverted){
table.addClass(className.inverted);
}
var textColumns = columns;
//no header for time-only mode
if (!isTimeOnly) {
Expand Down Expand Up @@ -348,15 +381,27 @@ $.fn.calendar = function(parameters) {
var disabledDate = module.helper.findDayAsObject(cellDate, mode, settings.disabledDates);
if (disabledDate !== null && disabledDate[metadata.message]) {
cell.attr("data-tooltip", disabledDate[metadata.message]);
cell.attr("data-position", tooltipPosition);
cell.attr("data-position", disabledDate[metadata.position] || tooltipPosition);
if(disabledDate[metadata.inverted] || (isInverted && disabledDate[metadata.inverted] === undefined)) {
cell.attr("data-inverted", '');
}
if(disabledDate[metadata.variation]) {
cell.attr("data-variation", disabledDate[metadata.variation]);
}
}
} else {
var eventDate = module.helper.findDayAsObject(cellDate, mode, settings.eventDates);
if (eventDate !== null) {
cell.addClass(eventDate[metadata.class] || settings.eventClass);
if (eventDate[metadata.message]) {
cell.attr("data-tooltip", eventDate[metadata.message]);
cell.attr("data-position", tooltipPosition);
cell.attr("data-position", eventDate[metadata.position] || tooltipPosition);
if(eventDate[metadata.inverted] || (isInverted && eventDate[metadata.inverted] === undefined)) {
cell.attr("data-inverted", '');
}
if(eventDate[metadata.variation]) {
cell.attr("data-variation", eventDate[metadata.variation]);
}
}
}
}
Expand Down Expand Up @@ -395,6 +440,10 @@ $.fn.calendar = function(parameters) {
}

module.update.focus(false, table);

if(settings.inline){
module.refreshTooltips();
}
}
}
},
Expand Down Expand Up @@ -436,6 +485,20 @@ $.fn.calendar = function(parameters) {
module.create.calendar();
},

refreshTooltips: function() {
var winWidth = $(window).width();
$container.find('td[data-position]').each(function () {
var cell = $(this);
var tooltipWidth = window.getComputedStyle(cell[0], ':after').width.replace(/[^0-9\.]/g,'');
var tooltipPosition = cell.attr('data-position');
// use a fallback width of 250 (calendar width) for IE/Edge (which return "auto")
var calcPosition = (winWidth - cell.width() - (parseInt(tooltipWidth,10) || 250)) > cell.offset().left ? 'right' : 'left';
if(tooltipPosition.indexOf(calcPosition) === -1) {
cell.attr('data-position',tooltipPosition.replace(/(left|right)/,calcPosition));
}
});
},

bind: {
events: function () {
module.debug('Binding events');
Expand Down Expand Up @@ -576,6 +639,57 @@ $.fn.calendar = function(parameters) {
var text = formatter.datetime(date, settings);
$input.val(text);
}
if(selectionComplete){
module.trigger.change();
selectionComplete = false;
}
},
class: {
mutation: function(mutations) {
mutations.forEach(function(mutation) {
if(mutation.attributeName === "class") {
module.check.disabled();
}
});
}
}
},

observeChanges: function() {
if('MutationObserver' in window) {
classObserver = new MutationObserver(module.event.class.mutation);
module.debug('Setting up mutation observer', classObserver);
module.observe.class();
}
},

disconnect: {
classObserver: function() {
if($input.length && classObserver) {
classObserver.disconnect();
}
}
},

observe: {
class: function() {
if($input.length && classObserver) {
classObserver.observe($module[0], {
attributes : true
});
}
}
},

is: {
disabled: function() {
return $module.hasClass(className.disabled);
}
},

check: {
disabled: function(){
$input.attr('tabindex',module.is.disabled() ? -1 : 0);
}
},

Expand Down Expand Up @@ -622,6 +736,9 @@ $.fn.calendar = function(parameters) {
mode: function () {
//only returns valid modes for the current settings
var mode = $module.data(metadata.mode) || settings.startMode;
return module.get.validatedMode(mode);
},
validatedMode: function(mode){
var validModes = module.get.validModes();
if ($.inArray(mode, validModes) >= 0) {
return mode;
Expand Down Expand Up @@ -739,7 +856,7 @@ $.fn.calendar = function(parameters) {
module.set.monthOffset(monthOffset, false);
}
}
var changed = module.set.dataKeyValue(metadata.focusDate, date, refreshCalendar);
var changed = module.set.dataKeyValue(metadata.focusDate, date, !!date && refreshCalendar);
updateFocus = (updateFocus !== false && changed && refreshCalendar === false) || focusDateUsedForRange != updateRange;
focusDateUsedForRange = updateRange;
if (updateFocus) {
Expand Down Expand Up @@ -798,15 +915,18 @@ $.fn.calendar = function(parameters) {
(settings.type === 'year' && mode === 'year');
if (complete) {
var canceled = module.set.date(date) === false;
if (!canceled && settings.closable) {
module.popup('hide');
//if this is a range calendar, focus the container or input. This will open the popup from its event listeners.
var endModule = module.get.calendarModule(settings.endCalendar);
if (endModule) {
if (endModule.setting('on') !== 'focus') {
endModule.popup('show');
if (!canceled) {
selectionComplete = true;
if(settings.closable) {
module.popup('hide');
//if this is a range calendar, focus the container or input. This will open the popup from its event listeners.
var endModule = module.get.calendarModule(settings.endCalendar);
if (endModule) {
if (endModule.setting('on') !== 'focus') {
endModule.popup('show');
}
endModule.focus();
}
endModule.focus();
}
}
} else {
Expand Down Expand Up @@ -1348,12 +1468,13 @@ $.fn.calendar.settings = {
return null;
}
if(text.match(/^[0-9]{4}[\/\-\.][0-9]{2}[\/\-\.][0-9]{2}$/)){
text += ' 00:00:00';
text = text.replace(/[\/\-\.]/g,'/') + ' 00:00:00';
}
// Reverse date and month in some cases
text = settings.monthFirst || !text.match(/^[0-9]{2}[\/\-\.]/) ? text : text.replace(/[\/\-\.]/g,'/').replace(/([0-9]+)\/([0-9]+)/,'$2/$1');
var textDate = new Date(text);
if(!isNaN(textDate.getDate())) {
var numberOnly = text.match(/^[0-9]+$/) !== null;
if(!numberOnly && !isNaN(textDate.getDate())) {
return textDate;
}
text = text.toLowerCase();
Expand Down Expand Up @@ -1610,6 +1731,7 @@ $.fn.calendar.settings = {
grid: 'ui equal width grid',
column: 'column',
table: 'ui celled center aligned unstackable table',
inverted: 'inverted',
prev: 'prev link',
next: 'next link',
prevIcon: 'chevron left icon',
Expand All @@ -1623,7 +1745,8 @@ $.fn.calendar.settings = {
rangeCell: 'range',
focusCell: 'focus',
todayCell: 'today',
today: 'today link'
today: 'today link',
disabled: 'disabled'
},

metadata: {
Expand All @@ -1638,6 +1761,9 @@ $.fn.calendar.settings = {
monthOffset: 'monthOffset',
message: 'message',
class: 'class',
inverted: 'inverted',
variation: 'variation',
position: 'position',
month: 'month',
year: 'year'
},
Expand Down
2 changes: 1 addition & 1 deletion components/calendar.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ea8e914

Please sign in to comment.