fomantic-ui-sass 2.8.3 → 2.8.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -0
- data/README.md +6 -0
- data/app/assets/fonts/semantic-ui/brand-icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.svg +95 -56
- data/app/assets/fonts/semantic-ui/brand-icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/icons.svg +121 -88
- data/app/assets/fonts/semantic-ui/icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.svg +10 -10
- data/app/assets/fonts/semantic-ui/outline-icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff2 +0 -0
- data/app/assets/javascripts/semantic-ui/calendar.js +249 -60
- data/app/assets/javascripts/semantic-ui/checkbox.js +1 -1
- data/app/assets/javascripts/semantic-ui/dimmer.js +3 -3
- data/app/assets/javascripts/semantic-ui/dropdown.js +62 -23
- data/app/assets/javascripts/semantic-ui/form.js +78 -26
- data/app/assets/javascripts/semantic-ui/modal.js +9 -1
- data/app/assets/javascripts/semantic-ui/popup.js +6 -5
- data/app/assets/javascripts/semantic-ui/progress.js +20 -24
- data/app/assets/javascripts/semantic-ui/search.js +28 -0
- data/app/assets/javascripts/semantic-ui/slider.js +2 -2
- data/app/assets/javascripts/semantic-ui/tab.js +3 -2
- data/app/assets/javascripts/semantic-ui/toast.js +9 -7
- data/app/assets/javascripts/semantic-ui/visibility.js +1 -1
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +79 -117
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +8 -6
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +36 -35
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +4 -4
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +23 -17
- data/app/assets/stylesheets/semantic-ui/elements/_all.scss +1 -0
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +9 -3
- data/app/assets/stylesheets/semantic-ui/elements/_emoji.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +8 -8
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +124 -15
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +33 -4
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +48 -48
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +38 -2
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +12 -12
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +7 -1
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +16 -9
- data/app/assets/stylesheets/semantic-ui/elements/_text.scss +15 -0
- data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +16 -9
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +1 -0
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +17 -14
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +122 -32
- data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +6 -6
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +10 -6
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +2 -0
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +32 -3
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +90 -0
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +1 -0
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +2 -1
- data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +9 -0
- data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +7 -7
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +34 -34
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +5 -5
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +4 -4
- data/lib/fomantic/ui/sass/version.rb +2 -2
- metadata +6 -6
@@ -556,10 +556,10 @@ $.fn.checkbox = function(parameters) {
|
|
556
556
|
trigger: {
|
557
557
|
change: function() {
|
558
558
|
var
|
559
|
-
events = document.createEvent('HTMLEvents'),
|
560
559
|
inputElement = $input[0]
|
561
560
|
;
|
562
561
|
if(inputElement) {
|
562
|
+
var events = document.createEvent('HTMLEvents');
|
563
563
|
module.verbose('Triggering native change event');
|
564
564
|
events.initEvent('change', true, false);
|
565
565
|
inputElement.dispatchEvent(events);
|
@@ -408,11 +408,11 @@ $.fn.dimmer = function(parameters) {
|
|
408
408
|
var
|
409
409
|
color = $dimmer.css('background-color'),
|
410
410
|
colorArray = color.split(','),
|
411
|
-
isRGB = (colorArray && colorArray.length
|
412
|
-
isRGBA = (colorArray && colorArray.length == 4)
|
411
|
+
isRGB = (colorArray && colorArray.length >= 3)
|
413
412
|
;
|
414
413
|
opacity = settings.opacity === 0 ? 0 : settings.opacity || opacity;
|
415
|
-
if(isRGB
|
414
|
+
if(isRGB) {
|
415
|
+
colorArray[2] = colorArray[2].replace(')','');
|
416
416
|
colorArray[3] = opacity + ')';
|
417
417
|
color = colorArray.join(',');
|
418
418
|
}
|
@@ -97,6 +97,7 @@ $.fn.dropdown = function(parameters) {
|
|
97
97
|
id,
|
98
98
|
selectObserver,
|
99
99
|
menuObserver,
|
100
|
+
classObserver,
|
100
101
|
module
|
101
102
|
;
|
102
103
|
|
@@ -117,7 +118,9 @@ $.fn.dropdown = function(parameters) {
|
|
117
118
|
module.setup.layout();
|
118
119
|
|
119
120
|
if(settings.values) {
|
121
|
+
module.set.initialLoad();
|
120
122
|
module.change.values(settings.values);
|
123
|
+
module.remove.initialLoad();
|
121
124
|
}
|
122
125
|
|
123
126
|
module.refreshData();
|
@@ -160,15 +163,18 @@ $.fn.dropdown = function(parameters) {
|
|
160
163
|
;
|
161
164
|
module.disconnect.menuObserver();
|
162
165
|
module.disconnect.selectObserver();
|
166
|
+
module.disconnect.classObserver();
|
163
167
|
},
|
164
168
|
|
165
169
|
observeChanges: function() {
|
166
170
|
if('MutationObserver' in window) {
|
167
171
|
selectObserver = new MutationObserver(module.event.select.mutation);
|
168
172
|
menuObserver = new MutationObserver(module.event.menu.mutation);
|
169
|
-
module.
|
173
|
+
classObserver = new MutationObserver(module.event.class.mutation);
|
174
|
+
module.debug('Setting up mutation observer', selectObserver, menuObserver, classObserver);
|
170
175
|
module.observe.select();
|
171
176
|
module.observe.menu();
|
177
|
+
module.observe.class();
|
172
178
|
}
|
173
179
|
},
|
174
180
|
|
@@ -182,6 +188,11 @@ $.fn.dropdown = function(parameters) {
|
|
182
188
|
if(selectObserver) {
|
183
189
|
selectObserver.disconnect();
|
184
190
|
}
|
191
|
+
},
|
192
|
+
classObserver: function() {
|
193
|
+
if(classObserver) {
|
194
|
+
classObserver.disconnect();
|
195
|
+
}
|
185
196
|
}
|
186
197
|
},
|
187
198
|
observe: {
|
@@ -200,6 +211,13 @@ $.fn.dropdown = function(parameters) {
|
|
200
211
|
subtree : true
|
201
212
|
});
|
202
213
|
}
|
214
|
+
},
|
215
|
+
class: function() {
|
216
|
+
if(module.has.search() && classObserver) {
|
217
|
+
classObserver.observe($module[0], {
|
218
|
+
attributes : true
|
219
|
+
});
|
220
|
+
}
|
203
221
|
}
|
204
222
|
},
|
205
223
|
|
@@ -541,6 +559,7 @@ $.fn.dropdown = function(parameters) {
|
|
541
559
|
} else if( module.can.click() ) {
|
542
560
|
module.unbind.intent();
|
543
561
|
}
|
562
|
+
iconClicked = false;
|
544
563
|
},
|
545
564
|
|
546
565
|
hideOthers: function() {
|
@@ -791,9 +810,9 @@ $.fn.dropdown = function(parameters) {
|
|
791
810
|
values = [];
|
792
811
|
}
|
793
812
|
module.remove.message();
|
794
|
-
|
795
|
-
|
796
|
-
|
813
|
+
var menuConfig = {};
|
814
|
+
menuConfig[fields.values] = values;
|
815
|
+
module.setup.menu(menuConfig);
|
797
816
|
|
798
817
|
if(values.length===0 && !settings.allowAdditions) {
|
799
818
|
module.add.message(message.noResults);
|
@@ -989,7 +1008,9 @@ $.fn.dropdown = function(parameters) {
|
|
989
1008
|
module.clear();
|
990
1009
|
}
|
991
1010
|
module.debug('Creating dropdown with specified values', values);
|
992
|
-
|
1011
|
+
var menuConfig = {};
|
1012
|
+
menuConfig[fields.values] = values;
|
1013
|
+
module.setup.menu(menuConfig);
|
993
1014
|
$.each(values, function(index, item) {
|
994
1015
|
if(item.selected == true) {
|
995
1016
|
module.debug('Setting initial selection to', item[fields.value]);
|
@@ -1213,6 +1234,15 @@ $.fn.dropdown = function(parameters) {
|
|
1213
1234
|
}
|
1214
1235
|
}
|
1215
1236
|
},
|
1237
|
+
class: {
|
1238
|
+
mutation: function(mutations) {
|
1239
|
+
mutations.forEach(function(mutation) {
|
1240
|
+
if(mutation.attributeName === "class") {
|
1241
|
+
module.check.disabled();
|
1242
|
+
}
|
1243
|
+
});
|
1244
|
+
}
|
1245
|
+
},
|
1216
1246
|
select: {
|
1217
1247
|
mutation: function(mutations) {
|
1218
1248
|
module.debug('<select> modified, recreating menu');
|
@@ -1634,10 +1664,10 @@ $.fn.dropdown = function(parameters) {
|
|
1634
1664
|
trigger: {
|
1635
1665
|
change: function() {
|
1636
1666
|
var
|
1637
|
-
events = document.createEvent('HTMLEvents'),
|
1638
1667
|
inputElement = $input[0]
|
1639
1668
|
;
|
1640
1669
|
if(inputElement) {
|
1670
|
+
var events = document.createEvent('HTMLEvents');
|
1641
1671
|
module.verbose('Triggering native change event');
|
1642
1672
|
events.initEvent('change', true, false);
|
1643
1673
|
inputElement.dispatchEvent(events);
|
@@ -1769,10 +1799,10 @@ $.fn.dropdown = function(parameters) {
|
|
1769
1799
|
return $module.data(metadata.placeholderText) || '';
|
1770
1800
|
},
|
1771
1801
|
text: function() {
|
1772
|
-
return $text.text();
|
1802
|
+
return settings.preserveHTML ? $text.html() : $text.text();
|
1773
1803
|
},
|
1774
1804
|
query: function() {
|
1775
|
-
return
|
1805
|
+
return String($search.val()).trim();
|
1776
1806
|
},
|
1777
1807
|
searchWidth: function(value) {
|
1778
1808
|
value = (value !== undefined)
|
@@ -1915,8 +1945,8 @@ $.fn.dropdown = function(parameters) {
|
|
1915
1945
|
return ($choice.data(metadata.text) !== undefined)
|
1916
1946
|
? $choice.data(metadata.text)
|
1917
1947
|
: (preserveHTML)
|
1918
|
-
?
|
1919
|
-
:
|
1948
|
+
? $choice.html().trim()
|
1949
|
+
: $choice.text().trim()
|
1920
1950
|
;
|
1921
1951
|
}
|
1922
1952
|
},
|
@@ -1928,11 +1958,11 @@ $.fn.dropdown = function(parameters) {
|
|
1928
1958
|
return ($choice.data(metadata.value) !== undefined)
|
1929
1959
|
? String( $choice.data(metadata.value) )
|
1930
1960
|
: (typeof choiceText === 'string')
|
1931
|
-
?
|
1961
|
+
? String(
|
1932
1962
|
settings.ignoreSearchCase
|
1933
1963
|
? choiceText.toLowerCase()
|
1934
1964
|
: choiceText
|
1935
|
-
)
|
1965
|
+
).trim()
|
1936
1966
|
: String(choiceText)
|
1937
1967
|
;
|
1938
1968
|
},
|
@@ -1953,9 +1983,9 @@ $.fn.dropdown = function(parameters) {
|
|
1953
1983
|
selectValues: function() {
|
1954
1984
|
var
|
1955
1985
|
select = {},
|
1956
|
-
oldGroup = []
|
1986
|
+
oldGroup = [],
|
1987
|
+
values = []
|
1957
1988
|
;
|
1958
|
-
select.values = [];
|
1959
1989
|
$module
|
1960
1990
|
.find('option')
|
1961
1991
|
.each(function() {
|
@@ -1976,14 +2006,14 @@ $.fn.dropdown = function(parameters) {
|
|
1976
2006
|
}
|
1977
2007
|
else {
|
1978
2008
|
if(group.length !== oldGroup.length || group[0] !== oldGroup[0]) {
|
1979
|
-
|
2009
|
+
values.push({
|
1980
2010
|
type: 'header',
|
1981
2011
|
divider: settings.headerDivider,
|
1982
2012
|
name: group.attr('label') || ''
|
1983
2013
|
});
|
1984
2014
|
oldGroup = group;
|
1985
2015
|
}
|
1986
|
-
|
2016
|
+
values.push({
|
1987
2017
|
name : name,
|
1988
2018
|
value : value,
|
1989
2019
|
text : text,
|
@@ -1998,19 +2028,21 @@ $.fn.dropdown = function(parameters) {
|
|
1998
2028
|
}
|
1999
2029
|
if(settings.sortSelect) {
|
2000
2030
|
if(settings.sortSelect === true) {
|
2001
|
-
|
2031
|
+
values.sort(function(a, b) {
|
2002
2032
|
return a.name.localeCompare(b.name);
|
2003
2033
|
});
|
2004
2034
|
} else if(settings.sortSelect === 'natural') {
|
2005
|
-
|
2035
|
+
values.sort(function(a, b) {
|
2006
2036
|
return (a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
|
2007
2037
|
});
|
2008
2038
|
} else if($.isFunction(settings.sortSelect)) {
|
2009
|
-
|
2039
|
+
values.sort(settings.sortSelect);
|
2010
2040
|
}
|
2041
|
+
select[fields.values] = values;
|
2011
2042
|
module.debug('Retrieved and sorted values from select', select);
|
2012
2043
|
}
|
2013
2044
|
else {
|
2045
|
+
select[fields.values] = values;
|
2014
2046
|
module.debug('Retrieved values from select', select);
|
2015
2047
|
}
|
2016
2048
|
return select;
|
@@ -2075,7 +2107,7 @@ $.fn.dropdown = function(parameters) {
|
|
2075
2107
|
return;
|
2076
2108
|
}
|
2077
2109
|
if(isMultiple) {
|
2078
|
-
if($.inArray(module.escape.htmlEntities(String(optionValue)), value) !== -1) {
|
2110
|
+
if($.inArray(module.escape.htmlEntities(String(optionValue)), value.map(function(v){return String(v);})) !== -1) {
|
2079
2111
|
$selectedItem = ($selectedItem)
|
2080
2112
|
? $selectedItem.add($choice)
|
2081
2113
|
: $choice
|
@@ -2133,6 +2165,9 @@ $.fn.dropdown = function(parameters) {
|
|
2133
2165
|
}
|
2134
2166
|
}
|
2135
2167
|
return true;
|
2168
|
+
},
|
2169
|
+
disabled: function(){
|
2170
|
+
$search.attr('tabindex',module.is.disabled() ? -1 : 0);
|
2136
2171
|
}
|
2137
2172
|
},
|
2138
2173
|
|
@@ -2398,8 +2433,8 @@ $.fn.dropdown = function(parameters) {
|
|
2398
2433
|
module.debug('Added tabindex to searchable dropdown');
|
2399
2434
|
$search
|
2400
2435
|
.val('')
|
2401
|
-
.attr('tabindex', 0)
|
2402
2436
|
;
|
2437
|
+
module.check.disabled();
|
2403
2438
|
$menu
|
2404
2439
|
.attr('tabindex', -1)
|
2405
2440
|
;
|
@@ -3530,9 +3565,12 @@ $.fn.dropdown = function(parameters) {
|
|
3530
3565
|
module.set.scrollPosition(module.get.selectedItem(), true);
|
3531
3566
|
}
|
3532
3567
|
if( module.is.hidden($currentMenu) || module.is.animating($currentMenu) ) {
|
3568
|
+
var displayType = $module.hasClass('column') ? 'flex' : false;
|
3533
3569
|
if(transition == 'none') {
|
3534
3570
|
start();
|
3535
|
-
$currentMenu.transition(
|
3571
|
+
$currentMenu.transition({
|
3572
|
+
displayType: displayType
|
3573
|
+
}).transition('show');
|
3536
3574
|
callback.call(element);
|
3537
3575
|
}
|
3538
3576
|
else if($.fn.transition !== undefined && $module.transition('is supported')) {
|
@@ -3544,6 +3582,7 @@ $.fn.dropdown = function(parameters) {
|
|
3544
3582
|
duration : settings.duration,
|
3545
3583
|
queue : true,
|
3546
3584
|
onStart : start,
|
3585
|
+
displayType: displayType,
|
3547
3586
|
onComplete : function() {
|
3548
3587
|
callback.call(element);
|
3549
3588
|
}
|
@@ -4032,7 +4071,7 @@ $.fn.dropdown.settings = {
|
|
4032
4071
|
message : '.message',
|
4033
4072
|
menuIcon : '.dropdown.icon',
|
4034
4073
|
search : 'input.search, .menu > .search > input, .menu input.search',
|
4035
|
-
sizer : '>
|
4074
|
+
sizer : '> span.sizer',
|
4036
4075
|
text : '> .text:not(.icon)',
|
4037
4076
|
unselectable : '.disabled, .filtered',
|
4038
4077
|
clearIcon : '> .remove.icon'
|
@@ -95,6 +95,9 @@ $.fn.form = function(parameters) {
|
|
95
95
|
module.verbose('Initializing form validation', $module, settings);
|
96
96
|
module.bindEvents();
|
97
97
|
module.set.defaults();
|
98
|
+
if (settings.autoCheckRequired) {
|
99
|
+
module.set.autoCheck();
|
100
|
+
}
|
98
101
|
module.instantiate();
|
99
102
|
}
|
100
103
|
},
|
@@ -216,6 +219,7 @@ $.fn.form = function(parameters) {
|
|
216
219
|
$field.val('');
|
217
220
|
}
|
218
221
|
});
|
222
|
+
module.remove.states();
|
219
223
|
},
|
220
224
|
|
221
225
|
reset: function() {
|
@@ -256,8 +260,7 @@ $.fn.form = function(parameters) {
|
|
256
260
|
$field.val(defaultValue);
|
257
261
|
}
|
258
262
|
});
|
259
|
-
|
260
|
-
module.determine.isDirty();
|
263
|
+
module.remove.states();
|
261
264
|
},
|
262
265
|
|
263
266
|
determine: {
|
@@ -333,20 +336,20 @@ $.fn.form = function(parameters) {
|
|
333
336
|
}
|
334
337
|
},
|
335
338
|
blank: function($field) {
|
336
|
-
return
|
339
|
+
return String($field.val()).trim() === '';
|
337
340
|
},
|
338
|
-
valid: function(field) {
|
341
|
+
valid: function(field, showErrors) {
|
339
342
|
var
|
340
343
|
allValid = true
|
341
344
|
;
|
342
345
|
if(field) {
|
343
346
|
module.verbose('Checking if field is valid', field);
|
344
|
-
return module.validate.field(validation[field], field,
|
347
|
+
return module.validate.field(validation[field], field, !!showErrors);
|
345
348
|
}
|
346
349
|
else {
|
347
350
|
module.verbose('Checking if form is valid');
|
348
351
|
$.each(validation, function(fieldName, field) {
|
349
|
-
if( !module.is.valid(fieldName) ) {
|
352
|
+
if( !module.is.valid(fieldName, showErrors) ) {
|
350
353
|
allValid = false;
|
351
354
|
}
|
352
355
|
});
|
@@ -363,9 +366,15 @@ $.fn.form = function(parameters) {
|
|
363
366
|
var initialValue = $el.data(metadata.defaultValue);
|
364
367
|
// Explicitly check for null/undefined here as value may be `false`, so ($el.data(dataInitialValue) || '') would not work
|
365
368
|
if (initialValue == null) { initialValue = ''; }
|
369
|
+
else if(Array.isArray(initialValue)) {
|
370
|
+
initialValue = initialValue.toString();
|
371
|
+
}
|
366
372
|
var currentValue = $el.val();
|
367
373
|
if (currentValue == null) { currentValue = ''; }
|
368
|
-
|
374
|
+
// multiple select values are returned as arrays which are never equal, so do string conversion first
|
375
|
+
else if(Array.isArray(currentValue)) {
|
376
|
+
currentValue = currentValue.toString();
|
377
|
+
}
|
369
378
|
// Boolean values can be encoded as "true/false" or "True/False" depending on underlying frameworks so we need a case insensitive comparison
|
370
379
|
var boolRegex = /^(true|false)$/i;
|
371
380
|
var isBoolValue = boolRegex.test(initialValue) && boolRegex.test(currentValue);
|
@@ -458,6 +467,9 @@ $.fn.form = function(parameters) {
|
|
458
467
|
module.timer = setTimeout(function() {
|
459
468
|
module.debug('Revalidating field', $field, module.get.validation($field));
|
460
469
|
module.validate.field( validationRules );
|
470
|
+
if(!settings.inline) {
|
471
|
+
module.validate.form(false,true);
|
472
|
+
}
|
461
473
|
}, settings.delay);
|
462
474
|
}
|
463
475
|
}
|
@@ -542,7 +554,7 @@ $.fn.form = function(parameters) {
|
|
542
554
|
name
|
543
555
|
;
|
544
556
|
if(requiresValue) {
|
545
|
-
prompt = prompt.replace(
|
557
|
+
prompt = prompt.replace(/\{value\}/g, $field.val());
|
546
558
|
}
|
547
559
|
if(requiresName) {
|
548
560
|
$label = $field.closest(selector.group).find('label').eq(0);
|
@@ -550,10 +562,10 @@ $.fn.form = function(parameters) {
|
|
550
562
|
? $label.text()
|
551
563
|
: $field.prop('placeholder') || settings.text.unspecifiedField
|
552
564
|
;
|
553
|
-
prompt = prompt.replace(
|
565
|
+
prompt = prompt.replace(/\{name\}/g, name);
|
554
566
|
}
|
555
|
-
prompt = prompt.replace(
|
556
|
-
prompt = prompt.replace(
|
567
|
+
prompt = prompt.replace(/\{identifier\}/g, field.identifier);
|
568
|
+
prompt = prompt.replace(/\{ruleValue\}/g, ancillary);
|
557
569
|
if(!rule.prompt) {
|
558
570
|
module.verbose('Using default validation prompt for type', prompt, ruleName);
|
559
571
|
}
|
@@ -703,7 +715,7 @@ $.fn.form = function(parameters) {
|
|
703
715
|
}
|
704
716
|
else {
|
705
717
|
if(isRadio) {
|
706
|
-
if(values[name] === undefined || values[name]
|
718
|
+
if(values[name] === undefined || values[name] === false) {
|
707
719
|
values[name] = (isChecked)
|
708
720
|
? value || true
|
709
721
|
: false
|
@@ -915,6 +927,17 @@ $.fn.form = function(parameters) {
|
|
915
927
|
},
|
916
928
|
|
917
929
|
remove: {
|
930
|
+
errors: function() {
|
931
|
+
module.debug('Removing form error messages');
|
932
|
+
$message.empty();
|
933
|
+
},
|
934
|
+
states: function() {
|
935
|
+
$module.removeClass(className.error).removeClass(className.success);
|
936
|
+
if(!settings.inline) {
|
937
|
+
module.remove.errors();
|
938
|
+
}
|
939
|
+
module.determine.isDirty();
|
940
|
+
},
|
918
941
|
rule: function(field, rule) {
|
919
942
|
var
|
920
943
|
rules = Array.isArray(rule)
|
@@ -1116,6 +1139,32 @@ $.fn.form = function(parameters) {
|
|
1116
1139
|
asDirty: function() {
|
1117
1140
|
module.set.defaults();
|
1118
1141
|
module.set.dirty();
|
1142
|
+
},
|
1143
|
+
autoCheck: function() {
|
1144
|
+
module.debug('Enabling auto check on required fields');
|
1145
|
+
$field.each(function (_index, el) {
|
1146
|
+
var
|
1147
|
+
$el = $(el),
|
1148
|
+
$elGroup = $(el).closest($group),
|
1149
|
+
isCheckbox = ($el.filter(selector.checkbox).length > 0),
|
1150
|
+
isRequired = $el.prop('required') || $elGroup.hasClass(className.required) || $elGroup.parent().hasClass(className.required),
|
1151
|
+
isDisabled = $el.is(':disabled') || $elGroup.hasClass(className.disabled) || $elGroup.parent().hasClass(className.disabled),
|
1152
|
+
validation = module.get.validation($el),
|
1153
|
+
hasEmptyRule = validation
|
1154
|
+
? $.grep(validation.rules, function(rule) { return rule.type == "empty" }) !== 0
|
1155
|
+
: false,
|
1156
|
+
identifier = validation.identifier || $el.attr('id') || $el.attr('name') || $el.data(metadata.validate)
|
1157
|
+
;
|
1158
|
+
if (isRequired && !isDisabled && !hasEmptyRule && identifier !== undefined) {
|
1159
|
+
if (isCheckbox) {
|
1160
|
+
module.verbose("Adding 'checked' rule on field", identifier);
|
1161
|
+
module.add.rule(identifier, "checked");
|
1162
|
+
} else {
|
1163
|
+
module.verbose("Adding 'empty' rule on field", identifier);
|
1164
|
+
module.add.rule(identifier, "empty");
|
1165
|
+
}
|
1166
|
+
}
|
1167
|
+
});
|
1119
1168
|
}
|
1120
1169
|
},
|
1121
1170
|
|
@@ -1134,12 +1183,16 @@ $.fn.form = function(parameters) {
|
|
1134
1183
|
if( module.determine.isValid() ) {
|
1135
1184
|
module.debug('Form has no validation errors, submitting');
|
1136
1185
|
module.set.success();
|
1186
|
+
if(!settings.inline) {
|
1187
|
+
module.remove.errors();
|
1188
|
+
}
|
1137
1189
|
if(ignoreCallbacks !== true) {
|
1138
1190
|
return settings.onSuccess.call(element, event, values);
|
1139
1191
|
}
|
1140
1192
|
}
|
1141
1193
|
else {
|
1142
1194
|
module.debug('Form has errors');
|
1195
|
+
submitting = false;
|
1143
1196
|
module.set.error();
|
1144
1197
|
if(!settings.inline) {
|
1145
1198
|
module.add.errors(formErrors);
|
@@ -1178,13 +1231,7 @@ $.fn.form = function(parameters) {
|
|
1178
1231
|
module.debug('Using field name as identifier', identifier);
|
1179
1232
|
field.identifier = identifier;
|
1180
1233
|
}
|
1181
|
-
var isDisabled =
|
1182
|
-
$.each($field, function(){
|
1183
|
-
if(!$(this).prop('disabled')) {
|
1184
|
-
isDisabled = false;
|
1185
|
-
return false;
|
1186
|
-
}
|
1187
|
-
});
|
1234
|
+
var isDisabled = !$field.filter(':not(:disabled)').length;
|
1188
1235
|
if(isDisabled) {
|
1189
1236
|
module.debug('Field is disabled. Skipping', identifier);
|
1190
1237
|
}
|
@@ -1195,7 +1242,9 @@ $.fn.form = function(parameters) {
|
|
1195
1242
|
module.debug('Field depends on another value that is not present or empty. Skipping', $dependsField);
|
1196
1243
|
}
|
1197
1244
|
else if(field.rules !== undefined) {
|
1198
|
-
|
1245
|
+
if(showErrors) {
|
1246
|
+
$field.closest($group).removeClass(className.error);
|
1247
|
+
}
|
1199
1248
|
$.each(field.rules, function(index, rule) {
|
1200
1249
|
if( module.has.field(identifier)) {
|
1201
1250
|
var invalidFields = module.validate.rule(field, rule,true) || [];
|
@@ -1241,7 +1290,7 @@ $.fn.form = function(parameters) {
|
|
1241
1290
|
// cast to string avoiding encoding special values
|
1242
1291
|
value = (value === undefined || value === '' || value === null)
|
1243
1292
|
? ''
|
1244
|
-
: (settings.shouldTrim) ?
|
1293
|
+
: (settings.shouldTrim) ? String(value + '').trim() : String(value + '')
|
1245
1294
|
;
|
1246
1295
|
return ruleFunction.call(field, value, ancillary, $module);
|
1247
1296
|
}
|
@@ -1455,6 +1504,7 @@ $.fn.form.settings = {
|
|
1455
1504
|
transition : 'scale',
|
1456
1505
|
duration : 200,
|
1457
1506
|
|
1507
|
+
autoCheckRequired : false,
|
1458
1508
|
preventLeaving : false,
|
1459
1509
|
dateHandling : 'date', // 'date', 'input', 'formatter'
|
1460
1510
|
|
@@ -1521,7 +1571,7 @@ $.fn.form.settings = {
|
|
1521
1571
|
selector : {
|
1522
1572
|
checkbox : 'input[type="checkbox"], input[type="radio"]',
|
1523
1573
|
clear : '.clear',
|
1524
|
-
field : 'input, textarea, select',
|
1574
|
+
field : 'input:not(.search), textarea, select',
|
1525
1575
|
group : '.field',
|
1526
1576
|
input : 'input',
|
1527
1577
|
message : '.error.message',
|
@@ -1535,10 +1585,12 @@ $.fn.form.settings = {
|
|
1535
1585
|
},
|
1536
1586
|
|
1537
1587
|
className : {
|
1538
|
-
error
|
1539
|
-
label
|
1540
|
-
pressed
|
1541
|
-
success
|
1588
|
+
error : 'error',
|
1589
|
+
label : 'ui basic red pointing prompt label',
|
1590
|
+
pressed : 'down',
|
1591
|
+
success : 'success',
|
1592
|
+
required : 'required',
|
1593
|
+
disabled : 'disabled'
|
1542
1594
|
},
|
1543
1595
|
|
1544
1596
|
error: {
|