diff --git a/definitions/behaviors/form.js b/definitions/behaviors/form.js index d76ab96..b71df56 100644 --- a/definitions/behaviors/form.js +++ b/definitions/behaviors/form.js @@ -818,26 +818,36 @@ $.fn.form = function(parameters) { module.add.field(name, rules); }, field: function(name, rules) { + // Validation should have at least a standard format + if(validation[name] === undefined || validation[name].rules === undefined) { + validation[name] = { + rules: [] + }; + } var - newValidation = {} + newValidation = { + rules: [] + } ; if(module.is.shorthandRules(rules)) { rules = Array.isArray(rules) ? rules : [rules] ; - newValidation[name] = { - rules: [] - }; - $.each(rules, function(index, rule) { - newValidation[name].rules.push({ type: rule }); + $.each(rules, function(_index, rule) { + newValidation.rules.push({ type: rule }); }); } else { - newValidation[name] = rules; + newValidation.rules = rules.rules; } - validation = $.extend({}, validation, newValidation); - module.debug('Adding rules', newValidation, validation); + // For each new rule, check if there's not already one with the same type + $.each(newValidation.rules, function (_index, rule) { + if ($.grep(validation[name].rules, function(item){ return item.type == rule.type; }).length == 0) { + validation[name].rules.push(rule); + } + }); + module.debug('Adding rules', newValidation.rules, validation); }, fields: function(fields) { var diff --git a/definitions/collections/form.less b/definitions/collections/form.less index 5ed8214..db162f4 100644 --- a/definitions/collections/form.less +++ b/definitions/collections/form.less @@ -47,6 +47,7 @@ margin: @fieldMargin; } +.ui.form .fields .fields, .ui.form .field:last-child, .ui.form .fields:last-child .field { margin-bottom: 0; @@ -412,6 +413,39 @@ background: @inputFocusBackground; box-shadow: @inputFocusBoxShadow; } +& when (@variationInputAction) { + .ui.form .ui.action.input:not(.left) input:not([type]):focus, + .ui.form .ui.action.input:not(.left) input[type="date"]:focus, + .ui.form .ui.action.input:not(.left) input[type="datetime-local"]:focus, + .ui.form .ui.action.input:not(.left) input[type="email"]:focus, + .ui.form .ui.action.input:not(.left) input[type="number"]:focus, + .ui.form .ui.action.input:not(.left) input[type="password"]:focus, + .ui.form .ui.action.input:not(.left) input[type="search"]:focus, + .ui.form .ui.action.input:not(.left) input[type="tel"]:focus, + .ui.form .ui.action.input:not(.left) input[type="time"]:focus, + .ui.form .ui.action.input:not(.left) input[type="text"]:focus, + .ui.form .ui.action.input:not(.left) input[type="file"]:focus, + .ui.form .ui.action.input:not(.left) input[type="url"]:focus { + border-top-right-radius: 0; + border-bottom-right-radius: 0; + } + + .ui.form .ui.action.input.left input:not([type]), + .ui.form .ui.action.input.left input[type="date"], + .ui.form .ui.action.input.left input[type="datetime-local"], + .ui.form .ui.action.input.left input[type="email"], + .ui.form .ui.action.input.left input[type="number"], + .ui.form .ui.action.input.left input[type="password"], + .ui.form .ui.action.input.left input[type="search"], + .ui.form .ui.action.input.left input[type="tel"], + .ui.form .ui.action.input.left input[type="time"], + .ui.form .ui.action.input.left input[type="text"], + .ui.form .ui.action.input.left input[type="file"], + .ui.form .ui.action.input.left input[type="url"] { + border-bottom-left-radius: 0; + border-top-left-radius: 0; + } +} .ui.form textarea:focus { color: @textAreaFocusColor; border-color: @textAreaFocusBorderColor; diff --git a/definitions/collections/table.less b/definitions/collections/table.less index b54df23..40cd2d3 100644 --- a/definitions/collections/table.less +++ b/definitions/collections/table.less @@ -1016,35 +1016,45 @@ each(@colors, { color: @sortableDisabledColor; } .ui.sortable.table > thead > tr > th:hover { - background: @sortableHoverBackground; color: @sortableHoverColor; } + .ui.sortable.table:not(.basic) > thead > tr > th:hover { + background: @sortableHoverBackground; + } /* Sorted */ .ui.sortable.table thead th.sorted { - background: @sortableActiveBackground; color: @sortableActiveColor; } + .ui.sortable.table:not(.basic) thead th.sorted { + background: @sortableActiveBackground; + } .ui.sortable.table thead th.sorted:after { display: inline-block; } /* Sorted Hover */ .ui.sortable.table thead th.sorted:hover { - background: @sortableActiveHoverBackground; color: @sortableActiveHoverColor; } + .ui.sortable.table:not(.basic) thead th.sorted:hover { + background: @sortableActiveHoverBackground; + } & when (@variationTableInverted) { /* Inverted */ .ui.inverted.sortable.table thead th.sorted { - background: @sortableInvertedActiveBackground; color: @sortableInvertedActiveColor; } + .ui.inverted.sortable.table:not(.basic) thead th.sorted { + background: @sortableInvertedActiveBackground; + } .ui.inverted.sortable.table > thead > tr > th:hover { - background: @sortableInvertedHoverBackground; color: @sortableInvertedHoverColor; } - .ui.inverted.sortable.table > thead > tr > th { + .ui.inverted.sortable.table:not(.basic) > thead > tr > th:hover { + background: @sortableInvertedHoverBackground; + } + .ui.inverted.sortable.table:not(.basic) > thead > tr > th { border-left-color: @sortableInvertedBorderColor; border-right-color: @sortableInvertedBorderColor; } diff --git a/definitions/elements/input.less b/definitions/elements/input.less index 436bdce..3eb8736 100644 --- a/definitions/elements/input.less +++ b/definitions/elements/input.less @@ -435,7 +435,7 @@ /* Labeled and action input states */ each(@formStates, { @state: replace(@key, '@', ''); - @borderColor: @formStates[@@state][color]; + @borderColor: @formStates[@@state][borderColor]; .ui.form > .field.@{state} > .ui.action.input > .ui.button, .ui.form > .field.@{state} > .ui.labeled.input:not([class*="corner labeled"]) > .ui.label, diff --git a/definitions/modules/checkbox.js b/definitions/modules/checkbox.js index 7160380..9222bfb 100644 --- a/definitions/modules/checkbox.js +++ b/definitions/modules/checkbox.js @@ -175,7 +175,7 @@ $.fn.checkbox = function(parameters) { }, preventDefaultOnInputTarget: function() { - if(typeof event !== 'undefined' && $(event.target).is(selector.input)) { + if(typeof event !== 'undefined' && event !== null && $(event.target).is(selector.input)) { module.verbose('Preventing default check action after manual check action'); event.preventDefault(); } diff --git a/definitions/modules/dimmer.less b/definitions/modules/dimmer.less index 5f7a468..6f4a907 100644 --- a/definitions/modules/dimmer.less +++ b/definitions/modules/dimmer.less @@ -64,7 +64,7 @@ /* Loose Coupling */ .ui.segment > .ui.dimmer:not(.page) { - border-radius: inherit !important; + border-radius: inherit; } /* Scrollbars */ @@ -295,16 +295,16 @@ body.dimmable > .dimmer { -webkit-transform: translateY(calc(-50% - .5px)); } - .ui.segment > .ui[class*="top dimmer"] { - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; + .ui.segment > .ui.ui[class*="top dimmer"] { + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; } - .ui.segment > .ui[class*="center dimmer"] { - border-radius: 0 !important; + .ui.segment > .ui.ui[class*="center dimmer"] { + border-radius: 0; } - .ui.segment > .ui[class*="bottom dimmer"] { - border-top-left-radius: 0 !important; - border-top-right-radius: 0 !important; + .ui.segment > .ui.ui[class*="bottom dimmer"] { + border-top-left-radius: 0; + border-top-right-radius: 0; } .ui[class*="center dimmer"].transition[class*="fade up"].in { diff --git a/definitions/modules/dropdown.js b/definitions/modules/dropdown.js index 07057d2..19251eb 100644 --- a/definitions/modules/dropdown.js +++ b/definitions/modules/dropdown.js @@ -31,6 +31,10 @@ $.fn.dropdown = function(parameters) { moduleSelector = $allModules.selector || '', hasTouch = ('ontouchstart' in document.documentElement), + clickEvent = hasTouch + ? 'touchstart' + : 'click', + time = new Date().getTime(), performance = [], @@ -565,27 +569,10 @@ $.fn.dropdown = function(parameters) { bind: { events: function() { - if(hasTouch) { - module.bind.touchEvents(); - } module.bind.keyboardEvents(); module.bind.inputEvents(); module.bind.mouseEvents(); }, - touchEvents: function() { - module.debug('Touch device detected binding additional touch events'); - if( module.is.searchSelection() ) { - // do nothing special yet - } - else if( module.is.single() ) { - $module - .on('touchstart' + eventNamespace, module.event.test.toggle) - ; - } - $menu - .on('touchstart' + eventNamespace, selector.item, module.event.item.mouseenter) - ; - }, keyboardEvents: function() { module.verbose('Binding keyboard events'); $module @@ -612,8 +599,8 @@ $.fn.dropdown = function(parameters) { module.verbose('Binding mouse events'); if(module.is.multiple()) { $module - .on('click' + eventNamespace, selector.label, module.event.label.click) - .on('click' + eventNamespace, selector.remove, module.event.remove.click) + .on(clickEvent + eventNamespace, selector.label, module.event.label.click) + .on(clickEvent + eventNamespace, selector.remove, module.event.remove.click) ; } if( module.is.searchSelection() ) { @@ -622,24 +609,24 @@ $.fn.dropdown = function(parameters) { .on('mouseup' + eventNamespace, module.event.mouseup) .on('mousedown' + eventNamespace, selector.menu, module.event.menu.mousedown) .on('mouseup' + eventNamespace, selector.menu, module.event.menu.mouseup) - .on('click' + eventNamespace, selector.icon, module.event.icon.click) - .on('click' + eventNamespace, selector.clearIcon, module.event.clearIcon.click) + .on(clickEvent + eventNamespace, selector.icon, module.event.icon.click) + .on(clickEvent + eventNamespace, selector.clearIcon, module.event.clearIcon.click) .on('focus' + eventNamespace, selector.search, module.event.search.focus) - .on('click' + eventNamespace, selector.search, module.event.search.focus) + .on(clickEvent + eventNamespace, selector.search, module.event.search.focus) .on('blur' + eventNamespace, selector.search, module.event.search.blur) - .on('click' + eventNamespace, selector.text, module.event.text.focus) + .on(clickEvent + eventNamespace, selector.text, module.event.text.focus) ; if(module.is.multiple()) { $module - .on('click' + eventNamespace, module.event.click) + .on(clickEvent + eventNamespace, module.event.click) ; } } else { if(settings.on == 'click') { $module - .on('click' + eventNamespace, selector.icon, module.event.icon.click) - .on('click' + eventNamespace, module.event.test.toggle) + .on(clickEvent + eventNamespace, selector.icon, module.event.icon.click) + .on(clickEvent + eventNamespace, module.event.test.toggle) ; } else if(settings.on == 'hover') { @@ -657,7 +644,7 @@ $.fn.dropdown = function(parameters) { .on('mousedown' + eventNamespace, module.event.mousedown) .on('mouseup' + eventNamespace, module.event.mouseup) .on('focus' + eventNamespace, module.event.focus) - .on('click' + eventNamespace, selector.clearIcon, module.event.clearIcon.click) + .on(clickEvent + eventNamespace, selector.clearIcon, module.event.clearIcon.click) ; if(module.has.menuSearch() ) { $module @@ -671,7 +658,7 @@ $.fn.dropdown = function(parameters) { } } $menu - .on('mouseenter' + eventNamespace, selector.item, module.event.item.mouseenter) + .on((hasTouch ? 'touchstart' : 'mouseenter') + eventNamespace, selector.item, module.event.item.mouseenter) .on('mouseleave' + eventNamespace, selector.item, module.event.item.mouseleave) .on('click' + eventNamespace, selector.item, module.event.item.click) ; @@ -685,7 +672,7 @@ $.fn.dropdown = function(parameters) { ; } $document - .on('click' + elementNamespace, module.event.test.hide) + .on(clickEvent + elementNamespace, module.event.test.hide) ; } }, @@ -700,7 +687,7 @@ $.fn.dropdown = function(parameters) { ; } $document - .off('click' + elementNamespace) + .off(clickEvent + elementNamespace) ; } }, @@ -848,6 +835,10 @@ $.fn.dropdown = function(parameters) { text, value ; + if($choice.hasClass(className.unfilterable)) { + results.push(this); + return true; + } if(settings.match === 'both' || settings.match === 'text') { text = module.remove.diacritics(String(module.get.choiceText($choice, false))); if(text.search(beginsWithRegExp) !== -1) { @@ -1017,7 +1008,7 @@ $.fn.dropdown = function(parameters) { var value = settings.templates.deQuote(item[fields.value]), name = settings.templates.escape( - item[fields.name] || item[fields.value], + item[fields.name] || '', settings.preserveHTML ) ; @@ -1975,6 +1966,9 @@ $.fn.dropdown = function(parameters) { value = ( $option.attr('value') !== undefined ) ? $option.attr('value') : name, + text = ( $option.data(metadata.text) !== undefined ) + ? $option.data(metadata.text) + : name, group = $option.parent('optgroup') ; if(settings.placeholder === 'auto' && value === '') { @@ -1992,6 +1986,7 @@ $.fn.dropdown = function(parameters) { select.values.push({ name : name, value : value, + text : text, disabled : disabled }); } @@ -2080,7 +2075,7 @@ $.fn.dropdown = function(parameters) { return; } if(isMultiple) { - if($.inArray( String(optionValue), value) !== -1) { + if($.inArray(module.escape.htmlEntities(String(optionValue)), value) !== -1) { $selectedItem = ($selectedItem) ? $selectedItem.add($choice) : $choice @@ -2099,7 +2094,7 @@ $.fn.dropdown = function(parameters) { optionValue = optionValue.toLowerCase(); value = value.toLowerCase(); } - if( String(optionValue) == String(value)) { + if(module.escape.htmlEntities(String(optionValue)) === module.escape.htmlEntities(String(value))) { module.verbose('Found select item by value', optionValue, value); $selectedItem = $choice; return true; @@ -3072,6 +3067,7 @@ $.fn.dropdown = function(parameters) { values = module.get.values(), newValue ; + removedValue = module.escape.htmlEntities(removedValue); if( module.has.selectInput() ) { module.verbose('Input is