fomantic-ui 2.10.0-beta.13 → 2.10.0-beta.14
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 +56 -66
- 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 +3 -4
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- 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 +3 -4
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- 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 +3 -4
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +2 -2
- 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 +3 -4
- package/dist/components/popup.min.css +1 -1
- package/dist/components/popup.min.js +2 -2
- 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 +3 -4
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- 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 +3 -4
- 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 +1 -1
- package/dist/components/table.min.css +1 -1
- 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 +3 -4
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +2 -2
- 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 +53 -53
- package/dist/semantic.js +95 -112
- package/dist/semantic.min.css +1 -1
- package/dist/semantic.min.js +2 -2
- package/package.json +1 -1
- package/src/definitions/modules/dropdown.js +55 -65
- package/src/definitions/modules/embed.js +2 -3
- package/src/definitions/modules/flyout.js +2 -3
- package/src/definitions/modules/modal.js +2 -3
- package/src/definitions/modules/popup.js +2 -3
- package/src/definitions/modules/rating.js +2 -3
- package/src/definitions/modules/search.js +2 -3
- package/src/definitions/modules/toast.js +2 -3
package/dist/components/ad.css
CHANGED
package/dist/components/api.js
CHANGED
package/dist/components/card.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
2
|
+
* # Fomantic-UI 2.10.0-beta.14+ea33639 - Dropdown
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -232,7 +232,7 @@
|
|
232
232
|
: [values];
|
233
233
|
$.each(values, function (index, value) {
|
234
234
|
if (module.get.item(value) === false) {
|
235
|
-
html = settings.templates.addition(module.add.variables(message.addResult, value));
|
235
|
+
html = settings.templates.addition(module.add.variables(message.addResult, settings.templates.escape(value, settings)));
|
236
236
|
$userChoice = $('<div />')
|
237
237
|
.html(html)
|
238
238
|
.attr('data-' + metadata.value, value)
|
@@ -710,7 +710,9 @@
|
|
710
710
|
module.remove.message();
|
711
711
|
}
|
712
712
|
if (settings.allowAdditions) {
|
713
|
-
module.add.userSuggestion(
|
713
|
+
module.add.userSuggestion(settings.preserveHTML
|
714
|
+
? module.escape.htmlEntities(query)
|
715
|
+
: query);
|
714
716
|
}
|
715
717
|
if (module.is.searchSelection() && module.can.show() && module.is.focusedOnSearch() && !module.is.empty()) {
|
716
718
|
module.show();
|
@@ -793,7 +795,7 @@
|
|
793
795
|
if (values.length === 0 && !settings.allowAdditions) {
|
794
796
|
module.add.message(message.noResults);
|
795
797
|
} else {
|
796
|
-
let value = module.is.multiple() ? module.get.values() : module.get.value();
|
798
|
+
let value = module.is.multiple() ? module.get.values(true) : module.get.value();
|
797
799
|
if (value !== '') {
|
798
800
|
module.verbose('Value(s) present after click icon, select value(s) in items');
|
799
801
|
module.set.selected(value, null, true, true);
|
@@ -1040,8 +1042,11 @@
|
|
1040
1042
|
let tokens = pasteValue.split(settings.delimiter);
|
1041
1043
|
let notFoundTokens = [];
|
1042
1044
|
tokens.forEach(function (value) {
|
1043
|
-
|
1044
|
-
|
1045
|
+
const valueTrimmed = settings.preserveHTML
|
1046
|
+
? module.escape.htmlEntities(value.trim())
|
1047
|
+
: value.trim();
|
1048
|
+
if (module.set.selected(valueTrimmed, null, false, true) === false) {
|
1049
|
+
notFoundTokens.push(valueTrimmed);
|
1045
1050
|
}
|
1046
1051
|
});
|
1047
1052
|
event.preventDefault();
|
@@ -1779,7 +1784,9 @@
|
|
1779
1784
|
return $module.data(metadata.placeholderText) || '';
|
1780
1785
|
},
|
1781
1786
|
text: function () {
|
1782
|
-
return settings.preserveHTML
|
1787
|
+
return settings.preserveHTML
|
1788
|
+
? $text.html()
|
1789
|
+
: $text.text();
|
1783
1790
|
},
|
1784
1791
|
query: function () {
|
1785
1792
|
return String($search.val()).trim();
|
@@ -1948,7 +1955,7 @@
|
|
1948
1955
|
.find('option')
|
1949
1956
|
.each(function () {
|
1950
1957
|
let $option = $(this);
|
1951
|
-
let name = $option.html();
|
1958
|
+
let name = module.escape.assumeUnescapedAmpLtGt($option.html());
|
1952
1959
|
let disabled = $option.attr('disabled');
|
1953
1960
|
let value = $option.attr('value') !== undefined
|
1954
1961
|
? $option.attr('value')
|
@@ -1971,7 +1978,7 @@
|
|
1971
1978
|
values.push({
|
1972
1979
|
name: name,
|
1973
1980
|
value: value,
|
1974
|
-
text:
|
1981
|
+
text: text,
|
1975
1982
|
disabled: disabled,
|
1976
1983
|
});
|
1977
1984
|
}
|
@@ -2050,7 +2057,7 @@
|
|
2050
2057
|
return;
|
2051
2058
|
}
|
2052
2059
|
if (isMultiple) {
|
2053
|
-
if ($.inArray(module.escape.htmlEntities(String(optionValue)), value.map(String)
|
2060
|
+
if ($.inArray(module.escape.htmlEntities(String(optionValue)), value.map(String)) !== -1) {
|
2054
2061
|
$selectedItem = $selectedItem
|
2055
2062
|
? $selectedItem.add($choice)
|
2056
2063
|
: $choice;
|
@@ -2532,7 +2539,6 @@
|
|
2532
2539
|
} else {
|
2533
2540
|
$input.addClass(className.noselection);
|
2534
2541
|
}
|
2535
|
-
let escapedValue = module.escape.value(value);
|
2536
2542
|
let hasInput = $input.length > 0;
|
2537
2543
|
let currentValue = module.get.values();
|
2538
2544
|
let stringValue = value !== undefined
|
@@ -2550,10 +2556,10 @@
|
|
2550
2556
|
module.debug('Adding user option', value);
|
2551
2557
|
module.add.optionValue(value);
|
2552
2558
|
}
|
2553
|
-
module.debug('Updating input value',
|
2559
|
+
module.debug('Updating input value', value, currentValue);
|
2554
2560
|
internalChange = true;
|
2555
2561
|
$input
|
2556
|
-
.val(
|
2562
|
+
.val(value);
|
2557
2563
|
if (settings.fireOnInit === false && module.is.initialLoad()) {
|
2558
2564
|
module.debug('Input native change event ignored on initial load');
|
2559
2565
|
} else if (preventChangeTrigger !== true) {
|
@@ -2561,8 +2567,8 @@
|
|
2561
2567
|
}
|
2562
2568
|
internalChange = false;
|
2563
2569
|
} else {
|
2564
|
-
module.verbose('Storing value in metadata',
|
2565
|
-
if (
|
2570
|
+
module.verbose('Storing value in metadata', value, $input);
|
2571
|
+
if (value !== currentValue) {
|
2566
2572
|
$module.data(metadata.value, stringValue);
|
2567
2573
|
}
|
2568
2574
|
}
|
@@ -2687,19 +2693,18 @@
|
|
2687
2693
|
let $next = module.is.searchSelection()
|
2688
2694
|
? $search
|
2689
2695
|
: $text;
|
2690
|
-
let escapedValue = module.escape.value(value);
|
2691
2696
|
let $label;
|
2692
2697
|
if (settings.ignoreCase) {
|
2693
|
-
|
2698
|
+
value = value.toLowerCase();
|
2694
2699
|
}
|
2695
2700
|
$label = $('<a />')
|
2696
2701
|
.addClass(className.label)
|
2697
|
-
.attr('data-' + metadata.value,
|
2698
|
-
.html(templates.label(
|
2699
|
-
$label = settings.onLabelCreate.call($label,
|
2702
|
+
.attr('data-' + metadata.value, value)
|
2703
|
+
.html(templates.label(value, text, settings));
|
2704
|
+
$label = settings.onLabelCreate.call($label, value, text);
|
2700
2705
|
|
2701
2706
|
if (module.has.label(value)) {
|
2702
|
-
module.debug('User selection already exists, skipping',
|
2707
|
+
module.debug('User selection already exists, skipping', value);
|
2703
2708
|
|
2704
2709
|
return;
|
2705
2710
|
}
|
@@ -2738,8 +2743,7 @@
|
|
2738
2743
|
}
|
2739
2744
|
},
|
2740
2745
|
optionValue: function (value) {
|
2741
|
-
let
|
2742
|
-
let $option = $input.find('option[value="' + CSS.escape(escapedValue) + '"]');
|
2746
|
+
let $option = $input.find('option[value="' + CSS.escape(value) + '"]');
|
2743
2747
|
let hasOption = $option.length > 0;
|
2744
2748
|
if (hasOption) {
|
2745
2749
|
return;
|
@@ -2751,7 +2755,7 @@
|
|
2751
2755
|
$input.find('option.' + className.addition).remove();
|
2752
2756
|
}
|
2753
2757
|
$('<option/>')
|
2754
|
-
.prop('value',
|
2758
|
+
.prop('value', value)
|
2755
2759
|
.addClass(className.addition)
|
2756
2760
|
.text(value)
|
2757
2761
|
.appendTo($input);
|
@@ -2780,7 +2784,7 @@
|
|
2780
2784
|
.attr('data-' + metadata.text, value)
|
2781
2785
|
.removeClass(className.filtered);
|
2782
2786
|
if (!settings.hideAdditions) {
|
2783
|
-
html = settings.templates.addition(module.add.variables(message.addResult, value));
|
2787
|
+
html = settings.templates.addition(module.add.variables(message.addResult, settings.templates.escape(value, settings)));
|
2784
2788
|
$addition
|
2785
2789
|
.html(html);
|
2786
2790
|
}
|
@@ -2915,8 +2919,7 @@
|
|
2915
2919
|
module.remove.empty();
|
2916
2920
|
},
|
2917
2921
|
optionValue: function (value) {
|
2918
|
-
let
|
2919
|
-
let $option = $input.find('option[value="' + CSS.escape(escapedValue) + '"]');
|
2922
|
+
let $option = $input.find('option[value="' + CSS.escape(value) + '"]');
|
2920
2923
|
let hasOption = $option.length > 0;
|
2921
2924
|
if (!hasOption || !$option.hasClass(className.addition)) {
|
2922
2925
|
return;
|
@@ -2924,7 +2927,7 @@
|
|
2924
2927
|
// temporarily disconnect observer
|
2925
2928
|
module.disconnect.selectObserver();
|
2926
2929
|
$option.remove();
|
2927
|
-
module.verbose('Removing user addition as an <option>',
|
2930
|
+
module.verbose('Removing user addition as an <option>', value);
|
2928
2931
|
module.observe.select();
|
2929
2932
|
},
|
2930
2933
|
message: function () {
|
@@ -3013,9 +3016,8 @@
|
|
3013
3016
|
return values;
|
3014
3017
|
},
|
3015
3018
|
label: function (value, shouldAnimate) {
|
3016
|
-
let escapedValue = module.escape.value(value);
|
3017
3019
|
let $labels = $module.find(selector.label);
|
3018
|
-
let $removedLabel = $labels.filter('[data-' + metadata.value + '="' + CSS.escape(settings.ignoreCase ?
|
3020
|
+
let $removedLabel = $labels.filter('[data-' + metadata.value + '="' + CSS.escape(settings.ignoreCase ? value.toLowerCase() : value) + '"]');
|
3019
3021
|
module.verbose('Removing label', $removedLabel);
|
3020
3022
|
$removedLabel.remove();
|
3021
3023
|
},
|
@@ -3126,13 +3128,12 @@
|
|
3126
3128
|
return $menu.children(selector.message).length > 0;
|
3127
3129
|
},
|
3128
3130
|
label: function (value) {
|
3129
|
-
let escapedValue = module.escape.value(value);
|
3130
3131
|
let $labels = $module.find(selector.label);
|
3131
3132
|
if (settings.ignoreCase) {
|
3132
|
-
|
3133
|
+
value = value.toLowerCase();
|
3133
3134
|
}
|
3134
3135
|
|
3135
|
-
return $labels.filter('[data-' + metadata.value + '="' + CSS.escape(
|
3136
|
+
return $labels.filter('[data-' + metadata.value + '="' + CSS.escape(value) + '"]').length > 0;
|
3136
3137
|
},
|
3137
3138
|
maxSelections: function () {
|
3138
3139
|
return settings.maxSelections && module.get.selectionCount() >= settings.maxSelections;
|
@@ -3537,38 +3538,13 @@
|
|
3537
3538
|
},
|
3538
3539
|
|
3539
3540
|
escape: {
|
3540
|
-
value: function (value) {
|
3541
|
-
let multipleValues = Array.isArray(value);
|
3542
|
-
let stringValue = typeof value === 'string';
|
3543
|
-
let isUnparsable = !stringValue && !multipleValues;
|
3544
|
-
let hasQuotes = stringValue && value.search(regExp.quote) !== -1;
|
3545
|
-
let values = [];
|
3546
|
-
if (isUnparsable || !hasQuotes) {
|
3547
|
-
return value;
|
3548
|
-
}
|
3549
|
-
module.debug('Encoding quote values for use in select', value);
|
3550
|
-
if (multipleValues) {
|
3551
|
-
$.each(value, function (index, value) {
|
3552
|
-
values.push(value.replace(regExp.quote, '"'));
|
3553
|
-
});
|
3554
|
-
|
3555
|
-
return values;
|
3556
|
-
}
|
3557
|
-
|
3558
|
-
return value.replace(regExp.quote, '"');
|
3559
|
-
},
|
3560
3541
|
string: function (text) {
|
3561
3542
|
text = String(text);
|
3562
3543
|
|
3563
3544
|
return text.replace(regExp.escape, '\\$&');
|
3564
3545
|
},
|
3565
|
-
htmlEntities: function (string
|
3566
|
-
|
3567
|
-
|
3568
|
-
const badChars = forceAmpersand
|
3569
|
-
? /["&'<>]/g
|
3570
|
-
: /["'<>]|&(?![\d#A-Za-z]{1,12};)/g;
|
3571
|
-
const escape = {
|
3546
|
+
htmlEntities: function (string) {
|
3547
|
+
const escapeMap = {
|
3572
3548
|
'"': '"',
|
3573
3549
|
'&': '&',
|
3574
3550
|
"'": ''',
|
@@ -3576,7 +3552,23 @@
|
|
3576
3552
|
'>': '>',
|
3577
3553
|
};
|
3578
3554
|
|
3579
|
-
return String(string).replace(
|
3555
|
+
return String(string).replace(/["&'<>]/g, (chr) => escapeMap[chr]);
|
3556
|
+
},
|
3557
|
+
|
3558
|
+
// https://github.com/fomantic/Fomantic-UI/issues/2782
|
3559
|
+
// https://jsfiddle.net/3efL7jnt/
|
3560
|
+
assumeUnescapedAmpLtGt: function (string) {
|
3561
|
+
if (settings.preserveHTML) {
|
3562
|
+
return string;
|
3563
|
+
}
|
3564
|
+
|
3565
|
+
const unescapeMap = {
|
3566
|
+
'&': '&',
|
3567
|
+
'<': '<',
|
3568
|
+
'>': '>',
|
3569
|
+
};
|
3570
|
+
|
3571
|
+
return string.replace(/&(?:amp|lt|gt);/g, (v) => unescapeMap[v]);
|
3580
3572
|
},
|
3581
3573
|
},
|
3582
3574
|
|
@@ -3789,7 +3781,7 @@
|
|
3789
3781
|
|
3790
3782
|
maxSelections: false, // When set to a number, limits the number of selections to this count
|
3791
3783
|
useLabels: true, // whether multiple select should filter currently active selections from choices
|
3792
|
-
delimiter: ',', // when multiselect uses normal <input
|
3784
|
+
delimiter: ',', // when multiselect uses normal <input>, the values will be delimited with this character
|
3793
3785
|
|
3794
3786
|
showOnFocus: false, // show the menu on focus
|
3795
3787
|
allowReselection: false, // whether current value should trigger callbacks when reselected
|
@@ -3866,7 +3858,6 @@
|
|
3866
3858
|
|
3867
3859
|
regExp: {
|
3868
3860
|
escape: /[\s#$()*+,.:=?@[\\\]^{|}-]/g,
|
3869
|
-
quote: /"/g,
|
3870
3861
|
},
|
3871
3862
|
|
3872
3863
|
metadata: {
|
@@ -3980,8 +3971,7 @@
|
|
3980
3971
|
return string;
|
3981
3972
|
}
|
3982
3973
|
|
3983
|
-
const
|
3984
|
-
const escape = {
|
3974
|
+
const escapeMap = {
|
3985
3975
|
'"': '"',
|
3986
3976
|
'&': '&',
|
3987
3977
|
"'": ''',
|
@@ -3989,7 +3979,7 @@
|
|
3989
3979
|
'>': '>',
|
3990
3980
|
};
|
3991
3981
|
|
3992
|
-
return String(string).replace(
|
3982
|
+
return String(string).replace(/["&'<>]/g, (chr) => escapeMap[chr]);
|
3993
3983
|
},
|
3994
3984
|
// generates dropdown from select values
|
3995
3985
|
dropdown: function (select, settings) {
|