fomantic-ui 2.9.4-beta.30 → 2.9.4-beta.32
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.
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +1 -1
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +1 -1
- package/dist/components/api.min.js +1 -1
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/calendar.min.css +1 -1
- package/dist/components/calendar.min.js +1 -1
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +1 -1
- package/dist/components/comment.css +1 -1
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +1 -1
- package/dist/components/container.min.css +1 -1
- package/dist/components/dimmer.css +1 -1
- package/dist/components/dimmer.js +1 -1
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +1 -1
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +1 -1
- package/dist/components/dropdown.js +42 -11
- package/dist/components/dropdown.min.css +1 -1
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +1 -1
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +1 -1
- package/dist/components/emoji.css +1 -1
- package/dist/components/emoji.min.css +1 -1
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +1 -1
- package/dist/components/flyout.js +1 -1
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +1 -1
- package/dist/components/form.css +1 -1
- package/dist/components/form.js +1 -1
- package/dist/components/form.min.css +1 -1
- package/dist/components/form.min.js +1 -1
- package/dist/components/grid.css +1 -1
- package/dist/components/grid.min.css +1 -1
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +1 -1
- package/dist/components/icon.min.css +1 -1
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +1 -1
- package/dist/components/input.min.css +1 -1
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/menu.css +1 -1
- package/dist/components/menu.min.css +1 -1
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +1 -1
- package/dist/components/modal.js +1 -1
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +1 -1
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +1 -1
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +1 -1
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -1
- package/dist/components/popup.js +1 -1
- package/dist/components/popup.min.css +1 -1
- package/dist/components/popup.min.js +1 -1
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +1 -1
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +1 -1
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +1 -1
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +1 -1
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +1 -1
- package/dist/components/search.js +58 -10
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +1 -1
- package/dist/components/segment.min.css +1 -1
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +1 -1
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +1 -1
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +1 -1
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +1 -1
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +1 -1
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +1 -1
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +1 -1
- package/dist/components/state.js +1 -1
- package/dist/components/state.min.js +1 -1
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +1 -1
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +1 -1
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +1 -1
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +1 -1
- package/dist/components/table.css +7 -7
- package/dist/components/table.min.css +2 -2
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +1 -1
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +1 -1
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +1 -1
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +1 -1
- package/dist/components/visibility.js +1 -1
- package/dist/components/visibility.min.js +1 -1
- package/dist/semantic.css +59 -59
- package/dist/semantic.js +124 -45
- package/dist/semantic.min.css +2 -2
- package/dist/semantic.min.js +2 -2
- package/package.json +1 -1
- package/src/definitions/collections/table.less +6 -6
- package/src/definitions/modules/dropdown.js +41 -10
- package/src/definitions/modules/dropdown.less +7 -0
- package/src/definitions/modules/search.js +57 -9
- package/src/definitions/modules/search.less +9 -2
- package/src/themes/default/globals/site.variables +3 -0
- package/src/themes/default/globals/variation.variables +2 -0
- package/src/themes/default/modules/dropdown.variables +3 -0
- package/src/themes/default/modules/search.variables +3 -0
package/package.json
CHANGED
@@ -117,16 +117,16 @@
|
|
117
117
|
.ui.table > tfoot > tr > td:first-child {
|
118
118
|
border-left: none;
|
119
119
|
}
|
120
|
-
.ui.table > tfoot > tr:
|
121
|
-
.ui.table > tfoot > tr:
|
120
|
+
.ui.table > tfoot > tr:last-child > th:first-child,
|
121
|
+
.ui.table > tfoot > tr:last-child > td:first-child {
|
122
122
|
border-radius: 0 0 0 @borderRadius;
|
123
123
|
}
|
124
|
-
.ui.table > tfoot > tr:
|
125
|
-
.ui.table > tfoot > tr:
|
124
|
+
.ui.table > tfoot > tr:last-child > th:last-child,
|
125
|
+
.ui.table > tfoot > tr:last-child > td:last-child {
|
126
126
|
border-radius: 0 0 @borderRadius 0;
|
127
127
|
}
|
128
|
-
.ui.table > tfoot > tr:
|
129
|
-
.ui.table > tfoot > tr:
|
128
|
+
.ui.table > tfoot > tr:last-child > th:only-child,
|
129
|
+
.ui.table > tfoot > tr:last-child > td:only-child {
|
130
130
|
border-radius: 0 0 @borderRadius @borderRadius;
|
131
131
|
}
|
132
132
|
|
@@ -890,11 +890,13 @@
|
|
890
890
|
? query
|
891
891
|
: module.get.query()
|
892
892
|
),
|
893
|
-
results
|
894
|
-
escapedTerm
|
895
|
-
|
893
|
+
results = null,
|
894
|
+
escapedTerm = module.escape.string(searchTerm),
|
895
|
+
regExpIgnore = settings.ignoreSearchCase ? 'i' : '',
|
896
|
+
regExpFlags = regExpIgnore + 'gm',
|
896
897
|
beginsWithRegExp = new RegExp('^' + escapedTerm, regExpFlags)
|
897
898
|
;
|
899
|
+
module.remove.filteredItem();
|
898
900
|
// avoid loop if we're matching nothing
|
899
901
|
if (module.has.query()) {
|
900
902
|
results = [];
|
@@ -938,12 +940,34 @@
|
|
938
940
|
;
|
939
941
|
}
|
940
942
|
module.debug('Showing only matched items', searchTerm);
|
941
|
-
module.remove.filteredItem();
|
942
943
|
if (results) {
|
943
944
|
$item
|
944
945
|
.not(results)
|
945
946
|
.addClass(className.filtered)
|
946
947
|
;
|
948
|
+
if (settings.highlightMatches && (settings.match === 'both' || settings.match === 'text')) {
|
949
|
+
var querySplit = query.split(''),
|
950
|
+
diacriticReg = settings.ignoreDiacritics ? '[\u0300-\u036F]?' : '',
|
951
|
+
htmlReg = '(?![^<]*>)',
|
952
|
+
markedRegExp = new RegExp(htmlReg + '(' + querySplit.join(diacriticReg + ')(.*?)' + htmlReg + '(') + diacriticReg + ')', regExpIgnore),
|
953
|
+
markedReplacer = function () {
|
954
|
+
var args = [].slice.call(arguments, 1, querySplit.length * 2).map(function (x, i) {
|
955
|
+
return i & 1 ? x : '<mark>' + x + '</mark>'; // eslint-disable-line no-bitwise
|
956
|
+
});
|
957
|
+
|
958
|
+
return args.join('');
|
959
|
+
}
|
960
|
+
;
|
961
|
+
$.each(results, function (index, result) {
|
962
|
+
var $result = $(result),
|
963
|
+
markedHTML = module.get.choiceText($result, true)
|
964
|
+
;
|
965
|
+
if (settings.ignoreDiacritics) {
|
966
|
+
markedHTML = markedHTML.normalize('NFD');
|
967
|
+
}
|
968
|
+
$result.html(markedHTML.replace(markedRegExp, markedReplacer));
|
969
|
+
});
|
970
|
+
}
|
947
971
|
}
|
948
972
|
|
949
973
|
if (!module.has.query()) {
|
@@ -979,8 +1003,10 @@
|
|
979
1003
|
termLength = term.length,
|
980
1004
|
queryLength = query.length
|
981
1005
|
;
|
982
|
-
|
983
|
-
|
1006
|
+
if (settings.ignoreSearchCase) {
|
1007
|
+
query = query.toLowerCase();
|
1008
|
+
term = term.toLowerCase();
|
1009
|
+
}
|
984
1010
|
if (queryLength > termLength) {
|
985
1011
|
return false;
|
986
1012
|
}
|
@@ -3084,6 +3110,12 @@
|
|
3084
3110
|
$item.removeClass(className.active);
|
3085
3111
|
},
|
3086
3112
|
filteredItem: function () {
|
3113
|
+
if (settings.highlightMatches) {
|
3114
|
+
$.each($item, function (index, item) {
|
3115
|
+
var $markItem = $(item);
|
3116
|
+
$markItem.html($markItem.html().replace(/<\/?mark>/g, ''));
|
3117
|
+
});
|
3118
|
+
}
|
3087
3119
|
if (settings.useLabels && module.has.maxSelections()) {
|
3088
3120
|
return;
|
3089
3121
|
}
|
@@ -3809,8 +3841,7 @@
|
|
3809
3841
|
;
|
3810
3842
|
if (shouldEscape.test(string)) {
|
3811
3843
|
string = string.replace(forceAmpersand ? /&/g : /&(?![\d#a-z]{1,12};)/gi, '&');
|
3812
|
-
|
3813
|
-
return string.replace(badChars, escapedChar);
|
3844
|
+
string = string.replace(badChars, escapedChar);
|
3814
3845
|
}
|
3815
3846
|
|
3816
3847
|
return string;
|
@@ -4015,6 +4046,7 @@
|
|
4015
4046
|
|
4016
4047
|
match: 'both', // what to match against with search selection (both, text, or label)
|
4017
4048
|
fullTextSearch: 'exact', // search anywhere in value (set to 'exact' to require exact matches)
|
4049
|
+
highlightMatches: false, // Whether search result should highlight matching strings
|
4018
4050
|
ignoreDiacritics: false, // match results also if they contain diacritics of the same base character (for example searching for "a" will also match "á" or "â" or "à", etc...)
|
4019
4051
|
hideDividers: false, // Whether to hide any divider elements (specified in selector.divider) that are sibling to any items when searched (set to true will hide all dividers, set to 'empty' will hide them when they are not followed by a visible item)
|
4020
4052
|
|
@@ -4239,8 +4271,7 @@
|
|
4239
4271
|
;
|
4240
4272
|
if (shouldEscape.test(string)) {
|
4241
4273
|
string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&');
|
4242
|
-
|
4243
|
-
return string.replace(badChars, escapedChar);
|
4274
|
+
string = string.replace(badChars, escapedChar);
|
4244
4275
|
}
|
4245
4276
|
|
4246
4277
|
return string;
|
@@ -1860,6 +1860,13 @@ select.ui.dropdown {
|
|
1860
1860
|
});
|
1861
1861
|
}
|
1862
1862
|
|
1863
|
+
& when (@variationDropdownHighlightMatches) {
|
1864
|
+
.ui.dropdown .menu > .item mark {
|
1865
|
+
background: @highlightMatchesBackground;
|
1866
|
+
color: @highlightMatchesColor;
|
1867
|
+
}
|
1868
|
+
}
|
1869
|
+
|
1863
1870
|
& when (@variationDropdownInverted) {
|
1864
1871
|
/* --------------
|
1865
1872
|
Inverted
|
@@ -135,7 +135,10 @@
|
|
135
135
|
// this makes sure $.extend does not add specified search fields to default fields
|
136
136
|
// this is the only setting which should not extend defaults
|
137
137
|
if (parameters && parameters.searchFields !== undefined) {
|
138
|
-
settings.searchFields = parameters.searchFields
|
138
|
+
settings.searchFields = Array.isArray(parameters.searchFields)
|
139
|
+
? parameters.searchFields
|
140
|
+
: [parameters.searchFields]
|
141
|
+
;
|
139
142
|
}
|
140
143
|
},
|
141
144
|
},
|
@@ -631,7 +634,7 @@
|
|
631
634
|
exactResults = [],
|
632
635
|
fuzzyResults = [],
|
633
636
|
searchExp = searchTerm.replace(regExp.escape, '\\$&'),
|
634
|
-
matchRegExp
|
637
|
+
matchRegExp = new RegExp(regExp.beginsWith + searchExp, settings.ignoreSearchCase ? 'i' : ''),
|
635
638
|
|
636
639
|
// avoid duplicates when pushing results
|
637
640
|
addResult = function (array, result) {
|
@@ -667,13 +670,14 @@
|
|
667
670
|
var concatenatedContent = [];
|
668
671
|
$.each(searchFields, function (index, field) {
|
669
672
|
var
|
670
|
-
fieldExists =
|
673
|
+
fieldExists = typeof content[field] === 'string' || typeof content[field] === 'number'
|
671
674
|
;
|
672
675
|
if (fieldExists) {
|
673
676
|
var text;
|
674
677
|
text = typeof content[field] === 'string'
|
675
678
|
? module.remove.diacritics(content[field])
|
676
679
|
: content[field].toString();
|
680
|
+
text = $('<div/>', { html: text }).text().trim();
|
677
681
|
if (settings.fullTextSearch === 'all') {
|
678
682
|
concatenatedContent.push(text);
|
679
683
|
if (index < lastSearchFieldIndex) {
|
@@ -704,8 +708,10 @@
|
|
704
708
|
},
|
705
709
|
},
|
706
710
|
exactSearch: function (query, term) {
|
707
|
-
|
708
|
-
|
711
|
+
if (settings.ignoreSearchCase) {
|
712
|
+
query = query.toLowerCase();
|
713
|
+
term = term.toLowerCase();
|
714
|
+
}
|
709
715
|
|
710
716
|
return term.indexOf(query) > -1;
|
711
717
|
},
|
@@ -732,8 +738,10 @@
|
|
732
738
|
if (typeof query !== 'string') {
|
733
739
|
return false;
|
734
740
|
}
|
735
|
-
|
736
|
-
|
741
|
+
if (settings.ignoreSearchCase) {
|
742
|
+
query = query.toLowerCase();
|
743
|
+
term = term.toLowerCase();
|
744
|
+
}
|
737
745
|
if (queryLength > termLength) {
|
738
746
|
return false;
|
739
747
|
}
|
@@ -1088,6 +1096,39 @@
|
|
1088
1096
|
response[fields.results] = response[fields.results].slice(0, settings.maxResults);
|
1089
1097
|
}
|
1090
1098
|
}
|
1099
|
+
if (settings.highlightMatches) {
|
1100
|
+
var results = response[fields.results],
|
1101
|
+
regExpIgnore = settings.ignoreSearchCase ? 'i' : '',
|
1102
|
+
querySplit = module.get.value().split(''),
|
1103
|
+
diacriticReg = settings.ignoreDiacritics ? '[\u0300-\u036F]?' : '',
|
1104
|
+
htmlReg = '(?![^<]*>)',
|
1105
|
+
markedRegExp = new RegExp(htmlReg + '(' + querySplit.join(diacriticReg + ')(.*?)' + htmlReg + '(') + diacriticReg + ')', regExpIgnore),
|
1106
|
+
markedReplacer = function () {
|
1107
|
+
var args = [].slice.call(arguments, 1, querySplit.length * 2).map(function (x, i) {
|
1108
|
+
return i & 1 ? x : '<mark>' + x + '</mark>'; // eslint-disable-line no-bitwise
|
1109
|
+
});
|
1110
|
+
|
1111
|
+
return args.join('');
|
1112
|
+
}
|
1113
|
+
;
|
1114
|
+
$.each(results, function (label, content) {
|
1115
|
+
$.each(settings.searchFields, function (index, field) {
|
1116
|
+
var
|
1117
|
+
fieldExists = typeof content[field] === 'string' || typeof content[field] === 'number'
|
1118
|
+
;
|
1119
|
+
if (fieldExists) {
|
1120
|
+
var markedHTML = typeof content[field] === 'string'
|
1121
|
+
? content[field]
|
1122
|
+
: content[field].toString();
|
1123
|
+
if (settings.ignoreDiacritics) {
|
1124
|
+
markedHTML = markedHTML.normalize('NFD');
|
1125
|
+
}
|
1126
|
+
markedHTML = markedHTML.replace(/<\/?mark>/g, '');
|
1127
|
+
response[fields.results][label][field] = markedHTML.replace(markedRegExp, markedReplacer);
|
1128
|
+
}
|
1129
|
+
});
|
1130
|
+
});
|
1131
|
+
}
|
1091
1132
|
if (isFunction(template)) {
|
1092
1133
|
html = template(response, fields, settings.preserveHTML);
|
1093
1134
|
} else {
|
@@ -1316,9 +1357,15 @@
|
|
1316
1357
|
// search anywhere in value (set to 'exact' to require exact matches
|
1317
1358
|
fullTextSearch: 'exact',
|
1318
1359
|
|
1360
|
+
// Whether search result should highlight matching strings
|
1361
|
+
highlightMatches: false,
|
1362
|
+
|
1319
1363
|
// match results also if they contain diacritics of the same base character (for example searching for "a" will also match "á" or "â" or "à", etc...)
|
1320
1364
|
ignoreDiacritics: false,
|
1321
1365
|
|
1366
|
+
// whether to consider case sensitivity on local searching
|
1367
|
+
ignoreSearchCase: true,
|
1368
|
+
|
1322
1369
|
// whether to add events to prompt automatically
|
1323
1370
|
automatic: true,
|
1324
1371
|
|
@@ -1436,8 +1483,9 @@
|
|
1436
1483
|
};
|
1437
1484
|
if (shouldEscape.test(string)) {
|
1438
1485
|
string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&');
|
1439
|
-
|
1440
|
-
|
1486
|
+
string = string.replace(badChars, escapedChar);
|
1487
|
+
// FUI controlled HTML is still allowed
|
1488
|
+
string = string.replace(/<(\/)*mark>/g, '<$1mark>');
|
1441
1489
|
}
|
1442
1490
|
|
1443
1491
|
return string;
|
@@ -565,8 +565,8 @@
|
|
565
565
|
.ui.search {
|
566
566
|
font-size: @relativeMedium;
|
567
567
|
}
|
568
|
-
& when not (@
|
569
|
-
each(@
|
568
|
+
& when not (@variationSearchSizes = false) {
|
569
|
+
each(@variationSearchSizes, {
|
570
570
|
@s: @{value}SearchSize;
|
571
571
|
.ui.@{value}.search {
|
572
572
|
font-size: @@s;
|
@@ -574,6 +574,13 @@
|
|
574
574
|
});
|
575
575
|
}
|
576
576
|
|
577
|
+
& when (@variationSearchHighlightMatches) {
|
578
|
+
.ui.search > .results mark {
|
579
|
+
background: @highlightMatchesBackground;
|
580
|
+
color: @highlightMatchesColor;
|
581
|
+
}
|
582
|
+
}
|
583
|
+
|
577
584
|
/* --------------
|
578
585
|
Mobile
|
579
586
|
--------------- */
|
@@ -1538,3 +1538,6 @@
|
|
1538
1538
|
|
1539
1539
|
@inputWarningPlaceholderColor: if(iscolor(@formWarningColor), lighten(@formWarningColor, 40), @formWarningColor);
|
1540
1540
|
@inputWarningPlaceholderFocusColor: if(iscolor(@formWarningColor), lighten(@formWarningColor, 30), @formWarningColor);
|
1541
|
+
|
1542
|
+
@defaultHighlightMatchesBackground: revert;
|
1543
|
+
@defaultHighlightMatchesColor: revert;
|
@@ -573,6 +573,7 @@
|
|
573
573
|
@variationDropdownPointing: true;
|
574
574
|
@variationDropdownColumnar: true;
|
575
575
|
@variationDropdownScrollhint: true;
|
576
|
+
@variationDropdownHighlightMatches: false;
|
576
577
|
@variationDropdownSizes: @variationAllSizes;
|
577
578
|
|
578
579
|
/* Embed */
|
@@ -678,6 +679,7 @@
|
|
678
679
|
@variationSearchVeryLong: true;
|
679
680
|
@variationSearchResizable: true;
|
680
681
|
@variationSearchScrolling: true;
|
682
|
+
@variationSearchHighlightMatches: false;
|
681
683
|
@variationSearchSizes: @variationAllSizes;
|
682
684
|
|
683
685
|
/* Shape */
|