@finqu/cool 1.2.6 → 1.2.7
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/js/cool.bundle.js +68 -18
- package/dist/js/cool.bundle.js.map +1 -1
- package/dist/js/cool.esm.js +68 -18
- package/dist/js/cool.esm.js.map +1 -1
- package/dist/js/cool.js +68 -18
- package/dist/js/cool.js.map +1 -1
- package/html/index.html +37 -0
- package/js/dist/collapse.js +2 -2
- package/js/dist/common.js +2 -2
- package/js/dist/dropdown.js +2 -2
- package/js/dist/popover.js +1840 -1727
- package/js/dist/popover.js.map +1 -1
- package/js/dist/sectiontabs.js +2 -2
- package/js/dist/select.js +4129 -3443
- package/js/dist/select.js.map +1 -1
- package/js/dist/tooltip.js +2 -2
- package/js/src/popover.js +6 -0
- package/js/src/select.js +66 -18
- package/package.json +1 -1
- package/scss/LISENCE +1 -1
- package/scss/cool-grid.scss +2 -2
- package/scss/cool-reboot.scss +2 -2
- package/scss/cool.scss +2 -2
package/dist/js/cool.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Cool UI v1.2.
|
|
3
|
-
* Copyright 2011-
|
|
2
|
+
* Cool UI v1.2.6 (https://finqu.fi)
|
|
3
|
+
* Copyright 2011-2020 Finqu Oy
|
|
4
4
|
* Licensed under the ISC license - (http://opensource.org/licenses/ISC)
|
|
5
5
|
*/
|
|
6
6
|
import 'jquery';
|
|
@@ -1671,6 +1671,7 @@ function (_AbstractUIComponent) {
|
|
|
1671
1671
|
_proto.buildCache = function buildCache() {
|
|
1672
1672
|
this.$el = $(this.el);
|
|
1673
1673
|
this.$container = this.$el.data('container') ? $(this.$el.data('container')) : $(this.opts.container);
|
|
1674
|
+
this.containerAutoDetect = this.$el.data('containerAutoDetect') ? this.$el.data('containerAutoDetect') : this.opts.containerAutoDetect;
|
|
1674
1675
|
this.id = 'popover-' + this.generateUUID();
|
|
1675
1676
|
this.animation = this.$el.data('animation') ? this.$el.data('animation') : this.opts.animation;
|
|
1676
1677
|
this.animationIn = this.$el.data('animationIn') ? this.$el.data('animationIn') : this.opts.animationIn;
|
|
@@ -1681,6 +1682,10 @@ function (_AbstractUIComponent) {
|
|
|
1681
1682
|
this.placementChanged = false;
|
|
1682
1683
|
this.title = this.$el.data('title') ? this.$el.data('title') : this.opts.title;
|
|
1683
1684
|
this.content = this.$el.data('content') ? this.$el.data('content') : this.opts.content;
|
|
1685
|
+
|
|
1686
|
+
if (this.containerAutoDetect) {
|
|
1687
|
+
this.$container = this.$el.offsetParent();
|
|
1688
|
+
}
|
|
1684
1689
|
} // Bind events that trigger methods
|
|
1685
1690
|
;
|
|
1686
1691
|
|
|
@@ -2105,6 +2110,7 @@ if (typeof $ !== 'undefined') {
|
|
|
2105
2110
|
|
|
2106
2111
|
$.fn[NAME].defaults = {
|
|
2107
2112
|
container: '.content-inner',
|
|
2113
|
+
containerAutoDetect: false,
|
|
2108
2114
|
trigger: 'focus',
|
|
2109
2115
|
placement: 'bottom',
|
|
2110
2116
|
animation: true,
|
|
@@ -2258,13 +2264,13 @@ function (_AbstractUIComponent) {
|
|
|
2258
2264
|
_this3.data = _this3.$el.data('setData');
|
|
2259
2265
|
}
|
|
2260
2266
|
|
|
2261
|
-
if (
|
|
2267
|
+
if (_this3.data[_this3.name] !== 'undefined' && _this3.data[_this3.name].length > 0 && self.itemsToExclude) {
|
|
2262
2268
|
_this3.data[_this3.name] = _this3.data[_this3.name].filter(function (item) {
|
|
2263
2269
|
return self.itemsToExclude.indexOf(parseInt(item.id, 10)) === -1;
|
|
2264
2270
|
});
|
|
2265
2271
|
}
|
|
2266
2272
|
|
|
2267
|
-
if (
|
|
2273
|
+
if (_this3.items !== 'undefined' && _this3.items.lengths > 0 && self.itemsToExclude) {
|
|
2268
2274
|
_this3.items = _this3.items.filter(function (item) {
|
|
2269
2275
|
return self.itemsToExclude.indexOf(parseInt(item.id, 10)) === -1;
|
|
2270
2276
|
});
|
|
@@ -2287,10 +2293,12 @@ function (_AbstractUIComponent) {
|
|
|
2287
2293
|
if (!_this3.$select.length) {
|
|
2288
2294
|
var items = _this3._renderItemList(_this3.items);
|
|
2289
2295
|
|
|
2290
|
-
_this3.$select = $("\n <div class=\"select-content\">\n\n " + _this3._renderSearch() + "\n\n <div class=\"select-scrollable-content\"
|
|
2296
|
+
_this3.$select = $("\n <div class=\"select-content\">\n\n " + _this3._renderSearch() + "\n\n <div class=\"select-scrollable-content\"></div>\n\n " + _this3._renderFooter() + "\n\n </div>\n ");
|
|
2291
2297
|
|
|
2292
2298
|
_this3.$el.append(_this3.$select);
|
|
2293
2299
|
|
|
2300
|
+
_this3.$select.find('.select-scrollable-content').append(items);
|
|
2301
|
+
|
|
2294
2302
|
secondaryResolve();
|
|
2295
2303
|
} else {
|
|
2296
2304
|
secondaryResolve();
|
|
@@ -2603,11 +2611,27 @@ function (_AbstractUIComponent) {
|
|
|
2603
2611
|
item.id = item[self.primaryKeyword].toString();
|
|
2604
2612
|
return item;
|
|
2605
2613
|
});
|
|
2614
|
+
var itemIds = items.map(function (item) {
|
|
2615
|
+
return parseInt(item.id, 10);
|
|
2616
|
+
}); // Remove value from data if it doesn't exist anymore
|
|
2617
|
+
|
|
2618
|
+
self.data[self.name] = self.data[self.name].filter(function (value) {
|
|
2619
|
+
return itemIds.indexOf(parseInt(value, 10)) > -1;
|
|
2620
|
+
});
|
|
2621
|
+
|
|
2622
|
+
if (self.data[self.name].length == 0) {
|
|
2623
|
+
self.$selectIconContainer.html(self.selectIconDefault);
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2606
2626
|
items = items.filter(function (item) {
|
|
2607
2627
|
return self.data[self.name].indexOf(item.id) > -1 && self.itemsToExclude.indexOf(parseInt(item.id, 10)) === -1 && parseInt(item.id, 10) > 0;
|
|
2608
2628
|
});
|
|
2609
|
-
|
|
2629
|
+
|
|
2630
|
+
var result = self._renderItemList(items);
|
|
2631
|
+
|
|
2610
2632
|
$.when(self.$scrollableContent.append(result)).then(function () {
|
|
2633
|
+
var $inputs = self.$scrollableContent.find(':input');
|
|
2634
|
+
|
|
2611
2635
|
if (self.$scrollableContent[0].offsetHeight < self.$scrollableContent[0].scrollHeight) {
|
|
2612
2636
|
self.scroll.update();
|
|
2613
2637
|
self.scroll.settings.suppressScrollY = false;
|
|
@@ -2618,22 +2642,22 @@ function (_AbstractUIComponent) {
|
|
|
2618
2642
|
self.$scrollableContent.removeClass('ps-show-rail-y');
|
|
2619
2643
|
}
|
|
2620
2644
|
|
|
2621
|
-
if (self.$
|
|
2645
|
+
if (self.$scrollableContent.find(':input[type="checkbox"]').length) {
|
|
2622
2646
|
self.type = 'checkbox';
|
|
2623
|
-
} else if (self.$
|
|
2647
|
+
} else if (self.$scrollableContent.find(':input[type="radio"]').length) {
|
|
2624
2648
|
self.type = 'radio';
|
|
2625
2649
|
}
|
|
2626
2650
|
|
|
2627
2651
|
if (self.type == 'checkbox') {
|
|
2628
2652
|
self.data[self.name].forEach(function (value) {
|
|
2629
|
-
var $input =
|
|
2653
|
+
var $input = $inputs.filter(function () {
|
|
2630
2654
|
return this.value == value;
|
|
2631
2655
|
});
|
|
2632
2656
|
$input.prop('checked', true);
|
|
2633
2657
|
self.onSelect($input[0]);
|
|
2634
2658
|
});
|
|
2635
2659
|
} else if (self.type == 'radio') {
|
|
2636
|
-
var $input =
|
|
2660
|
+
var $input = $inputs.filter(function () {
|
|
2637
2661
|
return this.value == self.data[self.name];
|
|
2638
2662
|
});
|
|
2639
2663
|
$input.prop('checked', true);
|
|
@@ -2648,22 +2672,35 @@ function (_AbstractUIComponent) {
|
|
|
2648
2672
|
});
|
|
2649
2673
|
});
|
|
2650
2674
|
} else {
|
|
2651
|
-
if
|
|
2675
|
+
// Remove value from data if it doesn't exist anymore
|
|
2676
|
+
var $inputs = this.$scrollableContent.find(':input');
|
|
2677
|
+
var inputValues = $inputs.length > 0 ? $inputs.map(function () {
|
|
2678
|
+
return parseInt(this.value, 10);
|
|
2679
|
+
}).get() : [];
|
|
2680
|
+
this.data[this.name] = this.data[this.name].filter(function (value) {
|
|
2681
|
+
return inputValues.indexOf(parseInt(value, 10)) > -1;
|
|
2682
|
+
});
|
|
2683
|
+
|
|
2684
|
+
if (this.data[this.name].length == 0) {
|
|
2685
|
+
this.$selectIconContainer.html(this.selectIconDefault);
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
if (this.$scrollableContent.find(':input[type="checkbox"]').length) {
|
|
2652
2689
|
this.type = 'checkbox';
|
|
2653
|
-
} else if (this.$
|
|
2690
|
+
} else if (this.$scrollableContent.find(':input[type="radio"]').length) {
|
|
2654
2691
|
this.type = 'radio';
|
|
2655
2692
|
}
|
|
2656
2693
|
|
|
2657
2694
|
if (this.type == 'checkbox') {
|
|
2658
2695
|
this.data[this.name].forEach(function (value) {
|
|
2659
|
-
var $input =
|
|
2696
|
+
var $input = $inputs.filter(function () {
|
|
2660
2697
|
return this.value == value;
|
|
2661
2698
|
});
|
|
2662
2699
|
$input.prop('checked', true);
|
|
2663
2700
|
self.onSelect($input[0]);
|
|
2664
2701
|
});
|
|
2665
2702
|
} else if (this.type == 'radio') {
|
|
2666
|
-
var $input =
|
|
2703
|
+
var $input = $inputs.filter(function () {
|
|
2667
2704
|
return this.value == self.data[self.name];
|
|
2668
2705
|
});
|
|
2669
2706
|
$input.prop('checked', true);
|
|
@@ -2697,7 +2734,9 @@ function (_AbstractUIComponent) {
|
|
|
2697
2734
|
items = items.filter(function (item) {
|
|
2698
2735
|
return self.data[self.name].indexOf(item.id) === -1 && self.itemsToExclude.indexOf(parseInt(item.id, 10)) === -1 && parseInt(item.id, 10) > 0;
|
|
2699
2736
|
});
|
|
2700
|
-
|
|
2737
|
+
|
|
2738
|
+
var result = self._renderItemList(items);
|
|
2739
|
+
|
|
2701
2740
|
$.when(self.$scrollableContent.append(result)).then(function () {
|
|
2702
2741
|
var faNameSpace = self.opts.faPro ? 'fal' : 'fas';
|
|
2703
2742
|
self.$searchIconContainer.html("<i class=\"" + faNameSpace + " fa-times icon\"></i>");
|
|
@@ -2819,10 +2858,21 @@ function (_AbstractUIComponent) {
|
|
|
2819
2858
|
;
|
|
2820
2859
|
|
|
2821
2860
|
_proto.onSelect = function onSelect(el) {
|
|
2861
|
+
var self = this;
|
|
2822
2862
|
var onSelect = this.opts.onSelect;
|
|
2863
|
+
var data = $(el).parents('.select-item').data();
|
|
2864
|
+
|
|
2865
|
+
if (this.searchApi.length && !$.isEmptyObject(data)) {
|
|
2866
|
+
if ($(el).length && el.checked) {
|
|
2867
|
+
this.items.push(data);
|
|
2868
|
+
} else {
|
|
2869
|
+
this.items = $.grep(this.items, function (item) {
|
|
2870
|
+
return item[self.primaryKeyword] != data.id;
|
|
2871
|
+
});
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2823
2874
|
|
|
2824
2875
|
if (typeof onSelect === 'function') {
|
|
2825
|
-
var data = this.getItem('id', el.value);
|
|
2826
2876
|
onSelect.call(el, data, this);
|
|
2827
2877
|
}
|
|
2828
2878
|
} // Add more items after plugin is already initialized
|
|
@@ -3010,7 +3060,7 @@ function (_AbstractUIComponent) {
|
|
|
3010
3060
|
};
|
|
3011
3061
|
|
|
3012
3062
|
_proto._renderItemList = function _renderItemList(items) {
|
|
3013
|
-
var result =
|
|
3063
|
+
var result = [];
|
|
3014
3064
|
|
|
3015
3065
|
for (var i = 0; i < items.length; ++i) {
|
|
3016
3066
|
var item = items[i];
|
|
@@ -3028,7 +3078,7 @@ function (_AbstractUIComponent) {
|
|
|
3028
3078
|
}
|
|
3029
3079
|
}
|
|
3030
3080
|
|
|
3031
|
-
result
|
|
3081
|
+
result.push($("\n\n <div class=\"select-item\">\n\n <div class=\"select-item-" + this.type + "\">\n\n <div class=\"styled-" + this.type + "\">\n\n <input type=\"" + this.type + "\" id=\"select-" + this.name + "-" + items[i].id + "\" value=\"" + items[i].id + "\" tabindex=\"-1\">\n\n <label for=\"select-" + this.name + "-" + items[i].id + "\">\n\n <span class=\"radio-inner\">\n <svg viewBox=\"0 0 18 18\">\n <polyline points=\"1.5 6 4.5 9 10.5 1\"></polyline>\n </svg>\n </span>\n\n <span class=\"" + this.type + "-label\"" + (typeof this.labelTemplate !== 'function' ? ' data-label' : '') + ">\n " + label + "\n </span>\n\n </label>\n\n </div>\n\n </div>\n\n </div>\n\n ").data(item));
|
|
3032
3082
|
}
|
|
3033
3083
|
|
|
3034
3084
|
return result;
|