@finqu/cool 1.1.9 → 1.2.0

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.
Files changed (68) hide show
  1. package/dist/css/cool-grid.css +1 -1
  2. package/dist/css/cool-grid.css.map +1 -1
  3. package/dist/css/cool-grid.min.css.map +1 -1
  4. package/dist/css/cool-reboot.css +5 -1
  5. package/dist/css/cool-reboot.css.map +6 -4
  6. package/dist/css/cool-reboot.min.css +1 -1
  7. package/dist/css/cool-reboot.min.css.map +1 -1
  8. package/dist/css/cool.css +190 -55
  9. package/dist/css/cool.css.map +23 -19
  10. package/dist/css/cool.min.css +1 -1
  11. package/dist/css/cool.min.css.map +1 -1
  12. package/dist/js/cool.bundle.js +565 -178
  13. package/dist/js/cool.bundle.js.map +1 -1
  14. package/dist/js/cool.bundle.min.js +2 -2
  15. package/dist/js/cool.bundle.min.js.map +1 -1
  16. package/dist/js/cool.esm.js +565 -178
  17. package/dist/js/cool.esm.js.map +1 -1
  18. package/dist/js/cool.esm.min.js +2 -2
  19. package/dist/js/cool.esm.min.js.map +1 -1
  20. package/dist/js/cool.js +565 -178
  21. package/dist/js/cool.js.map +1 -1
  22. package/dist/js/cool.min.js +2 -2
  23. package/dist/js/cool.min.js.map +1 -1
  24. package/html/index.html +846 -4
  25. package/js/dist/collapse.js +1043 -629
  26. package/js/dist/collapse.js.map +1 -1
  27. package/js/dist/common.js +520 -282
  28. package/js/dist/common.js.map +1 -1
  29. package/js/dist/dropdown.js +273 -58
  30. package/js/dist/dropdown.js.map +1 -1
  31. package/js/dist/popover.js +273 -58
  32. package/js/dist/popover.js.map +1 -1
  33. package/js/dist/sectiontabs.js +273 -58
  34. package/js/dist/sectiontabs.js.map +1 -1
  35. package/js/dist/select.js +9904 -3726
  36. package/js/dist/select.js.map +1 -1
  37. package/js/dist/tooltip.js +1703 -1434
  38. package/js/dist/tooltip.js.map +1 -1
  39. package/js/src/abstract-ui-component.js +16 -5
  40. package/js/src/collapse.js +24 -10
  41. package/js/src/common.js +18 -0
  42. package/js/src/dialog.js +6 -17
  43. package/js/src/dropdown.js +2 -2
  44. package/js/src/popover.js +2 -2
  45. package/js/src/section-tabs.js +2 -2
  46. package/js/src/select.js +578 -177
  47. package/js/src/toast.js +2 -2
  48. package/js/src/tooltip.js +7 -2
  49. package/js/src/util/index.js +10 -0
  50. package/package.json +1 -1
  51. package/scss/_button-group.scss +4 -0
  52. package/scss/_buttons.scss +3 -3
  53. package/scss/_custom-forms.scss +14 -12
  54. package/scss/_dialog.scss +16 -5
  55. package/scss/_frame.scss +1 -0
  56. package/scss/_images.scss +45 -1
  57. package/scss/_input-group.scss +12 -6
  58. package/scss/_mixins.scss +1 -0
  59. package/scss/_notification.scss +13 -0
  60. package/scss/_reboot.scss +4 -0
  61. package/scss/_section.scss +14 -2
  62. package/scss/_select.scss +10 -1
  63. package/scss/_tables.scss +2 -1
  64. package/scss/_variables.scss +2 -2
  65. package/scss/cool.scss +2 -1
  66. package/scss/mixins/_notification-variant.scss +7 -0
  67. package/scss/utilities/_collapse.scss +2 -2
  68. package/scss/utilities/_cursor.scss +12 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Cool UI v1.1.8 (https://finqu.fi)
2
+ * Cool UI v1.1.9 (https://finqu.fi)
3
3
  * Copyright 2011-2019 Finqu Oy
4
4
  * Licensed under the ISC license - (http://opensource.org/licenses/ISC)
5
5
  */
@@ -1373,6 +1373,21 @@ function () {
1373
1373
  } else {
1374
1374
  return;
1375
1375
  }
1376
+ }); // button toggle
1377
+
1378
+ $(document).on('click', '.btn-group-toggle .btn > input', function (e) {
1379
+ e.stopPropagation();
1380
+ });
1381
+ $(document).on('click', '.btn-group-toggle .btn', function () {
1382
+ $(this).find('input').trigger('click');
1383
+ $(this).parent().find('input').trigger('change');
1384
+ });
1385
+ $(document).on('change', '.btn-group-toggle .btn > input', function () {
1386
+ if ($(this).is(':checked')) {
1387
+ $(this).parent().addClass('active');
1388
+ } else {
1389
+ $(this).parent().removeClass('active');
1390
+ }
1376
1391
  }); // Force select element unfocus after change
1377
1392
 
1378
1393
  $('select').on('change', function () {
@@ -1509,6 +1524,14 @@ var touchEvents = function touchEvents() {
1509
1524
  return result;
1510
1525
  };
1511
1526
 
1527
+ $.event.special.destroyed = {
1528
+ remove: function remove(obj) {
1529
+ if (obj.handler) {
1530
+ obj.handler();
1531
+ }
1532
+ }
1533
+ };
1534
+
1512
1535
  var AbstractUIComponent =
1513
1536
  /*#__PURE__*/
1514
1537
  function () {
@@ -1521,7 +1544,7 @@ function () {
1521
1544
  var onInit = this.opts.onInit;
1522
1545
 
1523
1546
  if (typeof onInit === 'function') {
1524
- onInit.call(this.el);
1547
+ onInit.call(this);
1525
1548
  }
1526
1549
  } // Update callback
1527
1550
  ;
@@ -1530,7 +1553,7 @@ function () {
1530
1553
  var onUpdate = this.opts.onUpdate;
1531
1554
 
1532
1555
  if (typeof onUpdate === 'function') {
1533
- onUpdate.call(this.el);
1556
+ onUpdate.call(this);
1534
1557
  }
1535
1558
  } // Destroy callback
1536
1559
  ;
@@ -1539,7 +1562,7 @@ function () {
1539
1562
  var onDestroy = this.opts.onDestroy;
1540
1563
 
1541
1564
  if (typeof onDestroy === 'function') {
1542
- onDestroy.call(this.el);
1565
+ onDestroy.call(this);
1543
1566
  }
1544
1567
  } // Show callback
1545
1568
  ;
@@ -1548,7 +1571,7 @@ function () {
1548
1571
  var onShow = this.opts.onShow;
1549
1572
 
1550
1573
  if (typeof onShow === 'function') {
1551
- onShow.call(this.el);
1574
+ onShow.call(this);
1552
1575
  }
1553
1576
  } // Close callback
1554
1577
  ;
@@ -1557,7 +1580,16 @@ function () {
1557
1580
  var onClose = this.opts.onClose;
1558
1581
 
1559
1582
  if (typeof onClose === 'function') {
1560
- onClose.call(this.el);
1583
+ onClose.call(this);
1584
+ }
1585
+ } // Reset callback
1586
+ ;
1587
+
1588
+ _proto.onReset = function onReset() {
1589
+ var onReset = this.opts.onReset;
1590
+
1591
+ if (typeof onReset === 'function') {
1592
+ onReset.call(this);
1561
1593
  }
1562
1594
  } // Debug log
1563
1595
  ;
@@ -2116,7 +2148,7 @@ function (_AbstractUIComponent) {
2116
2148
  _proto.init = function init() {
2117
2149
  var _this2 = this;
2118
2150
 
2119
- $.when(this.buildCache()).then(function () {
2151
+ this.buildCache().then(function () {
2120
2152
  _this2.buildScroll();
2121
2153
 
2122
2154
  _this2.bindEvents();
@@ -2141,112 +2173,165 @@ function (_AbstractUIComponent) {
2141
2173
  this.buildCache();
2142
2174
  this.bindEvents();
2143
2175
  this.onUpdate();
2144
- } // Cache DOM nodes for performance
2176
+ } // Reset plugin data
2145
2177
  ;
2146
2178
 
2147
- _proto.buildCache = function buildCache() {
2148
- var _this3 = this;
2149
-
2150
- this.$el = $(this.el);
2151
- this.$selectHeader = this.$el.find('.select-header');
2152
- this.$selectIconContainer = this.$selectHeader.find('.select-icon');
2153
- this.name = this.$el.data('name') ? this.$el.data('name') : this.opts.name;
2154
- this.scrollContentHeight = this.$el.data('scrollContentHeight') ? this.$el.data('scrollContentHeight') : this.opts.scrollContentHeight;
2155
- this.items = this.$el.data('items') ? this.$el.data('items') : this.opts.items;
2179
+ _proto.reset = function reset() {
2156
2180
  this.data = {};
2157
2181
  this.data[this.name] = [];
2158
- this.searchData = [];
2159
- this.searchApi = this.$el.data('searchApi') ? this.$el.data('searchApi') : this.opts.searchApi;
2160
- this.type = this.$el.data('type') ? this.$el.data('type') : this.opts.type;
2161
- this.contentOpen = false;
2182
+ this.items = [];
2183
+ this.$select.find('.select-item').remove();
2184
+ this.$selectItems = [];
2185
+ this.$selectIconContainer.html(this.selectIconDefault);
2162
2186
 
2163
- if (this.$el.data('setData') && this.$el.data('setData') != '') {
2164
- this.data = this.$el.data('setData');
2187
+ if (this.data[this.name].length == 0 && this.dynamicTitle && this.dynamicTitleDefault && this.dynamicTitleDefault !== 0 && this.$selectTitle.text().trim() == 0 && (this.$selectItems.length > 0 || this.searchApi)) {
2188
+ this.$selectTitle.html(this.dynamicTitleDefault);
2165
2189
  }
2166
2190
 
2167
- if (this.$el.find('.select-search')) {
2168
- this.showSearch = true;
2169
- } else {
2170
- this.showSearch = this.$el.data('showSearch') ? this.$el.data('showSearch') : this.opts.showSearch;
2191
+ if (this.$selectItems.length == 0 && !this.searchApi && this.dynamicTitle && this.dynamicTitleEmptyDefault && this.dynamicTitleEmptyDefault !== 0) {
2192
+ this.$selectHeader.css('cursor', 'default');
2193
+ this.$selectIconContainer.addClass('d-none');
2194
+ this.$selectTitle.html(this.dynamicTitleEmptyDefault);
2171
2195
  }
2172
2196
 
2173
- if (this.$el.find('.select-footer')) {
2174
- this.showFooter = true;
2175
- } else {
2176
- this.showFooter = this.$el.data('showFooter') ? this.$el.data('showFooter') : this.opts.showFooter;
2197
+ if (this.showSearch) {
2198
+ this.searchData = [];
2199
+ this.$searchInput.val('');
2200
+ this.searchString = '';
2201
+ this.search.call(this);
2177
2202
  }
2203
+ } // Cache DOM nodes for performance
2204
+ ;
2178
2205
 
2179
- if (this.items.length) {
2180
- var items = this._renderItemList(this.items);
2181
-
2182
- this.$select = $("\n <div class=\"select-content\">\n\n " + this._renderSearch() + "\n\n <div class=\"select-scrollable-content\">" + items + "</div>\n\n " + this._renderFooter() + "\n\n </div>\n ");
2183
- this.$el.append(this.$select);
2184
- this.$scrollableContent = this.$select.find('.select-scrollable-content') ? this.$select.find('.select-scrollable-content') : false;
2185
- this.$selectItems = this.$select.find('.select-item');
2186
- this.$selectLabels = this.$select.find('[data-label]');
2206
+ _proto.buildCache = function buildCache() {
2207
+ var _this3 = this;
2187
2208
 
2188
- if (this.showSearch) {
2189
- this.$searchContainer = this.$select.find('.select-search');
2190
- this.$searchInput = this.$select.find('[name="select-search"]');
2191
- this.$searchIconContainer = this.$select.find('.select-search-icon');
2192
- this.$clearSearchButton = this.$select.find('[data-clear-search]');
2209
+ return new Promise(function (primaryResolve, primaryReject) {
2210
+ var self = _this3;
2211
+ _this3.$el = $(_this3.el);
2212
+ _this3.$container = _this3.$el.parent();
2213
+ _this3.$selectHeader = _this3.$el.find('.select-header');
2214
+ _this3.$selectTitle = _this3.$el.find('.select-title');
2215
+ _this3.$selectIconContainer = _this3.$selectHeader.find('.select-icon');
2216
+ _this3.selectIconDefault = _this3.$selectHeader.find('.select-icon') ? _this3.$selectHeader.find('.select-icon').html() : '<i class="' + (_this3.opts.faPro ? 'fal' : 'fas') + 'fa-angle-down icon"></i>';
2217
+ _this3.name = _this3.$el.data('name') ? _this3.$el.data('name') : _this3.opts.name;
2218
+ _this3.scrollContentHeight = _this3.$el.data('scrollContentHeight') ? _this3.$el.data('scrollContentHeight') : _this3.opts.scrollContentHeight;
2219
+ _this3.items = _this3.$el.data('items') ? _this3.$el.data('items') : _this3.opts.items;
2220
+ _this3.data = {};
2221
+ _this3.data[_this3.name] = [];
2222
+ _this3.searchData = [];
2223
+ _this3.searchApi = _this3.$el.data('searchApi') ? _this3.$el.data('searchApi') : _this3.opts.searchApi;
2224
+ _this3.type = _this3.$el.data('type') ? _this3.$el.data('type') : _this3.opts.type;
2225
+ _this3.contentOpen = false;
2226
+ _this3.searchPlaceholder = _this3.$el.data('search-placeholder') ? _this3.$el.data('search-placeholder') : _this3.opts.searchPlaceholder;
2227
+ _this3.btnCloseText = _this3.$el.data('btn-close-text') ? _this3.$el.data('btn-close-text') : _this3.opts.btnCloseText;
2228
+ _this3.labelTemplate = _this3.opts.labelTemplate;
2229
+ _this3.confirmCheck = _this3.opts.confirmCheck;
2230
+ _this3.confirmUncheck = _this3.opts.confirmUncheck;
2231
+ _this3.preventUncheck = _this3.opts.preventUncheck;
2232
+ _this3.dynamicTitle = _this3.$el.data('dynamicTitle') ? _this3.$el.data('dynamicTitle') : _this3.opts.dynamicTitle;
2233
+ _this3.dynamicTitleDefault = _this3.$el.data('dynamicTitleDefault') ? _this3.$el.data('dynamicTitleDefault') : _this3.opts.dynamicTitleDefault;
2234
+ _this3.dynamicTitleEmptyDefault = _this3.$el.data('dynamicTitleEmptyDefault') ? _this3.$el.data('dynamicTitleEmptyDefault') : _this3.opts.dynamicTitleEmptyDefault;
2235
+ _this3.allowNoneOnRadioSelect = _this3.$el.data('allowNoneOnRadioSelect') ? _this3.$el.data('allowNoneOnRadioSelect') : _this3.opts.allowNoneOnRadioSelect;
2236
+ _this3.showValidStateIcon = _this3.$el.data('showValidStateIcon') ? _this3.$el.data('showValidStateIcon') : _this3.opts.showValidStateIcon;
2237
+ _this3.itemsToExclude = _this3.$el.data('itemsToExclude') ? _this3.$el.data('itemsToExclude').replace(/\s/g, '').split(',') : _this3.opts.itemsToExclude;
2238
+ _this3.preventClose = false;
2239
+
2240
+ if (_this3.opts.setData) {
2241
+ _this3.data = _this3.opts.setData;
2193
2242
  }
2194
2243
 
2195
- if (this.showFooter) {
2196
- this.$footerContainer = this.$select.find('.select-footer');
2197
- this.$closeButton = this.$select.find('[data-select-close]');
2244
+ if (_this3.$el.data('setData') && _this3.$el.data('setData') != '') {
2245
+ _this3.data = _this3.$el.data('setData');
2198
2246
  }
2199
2247
 
2200
- $.each(this.$selectLabels, function (i, el) {
2201
- this.searchData.push({
2202
- id: i,
2203
- val: $(el).text().trim()
2204
- });
2248
+ _this3.data[_this3.name] = _this3.data[_this3.name].filter(function (item) {
2249
+ return self.itemsToExclude.indexOf(parseInt(item.id, 10)) === -1;
2250
+ });
2251
+ _this3.items = _this3.items.filter(function (item) {
2252
+ return self.itemsToExclude.indexOf(parseInt(item.id, 10)) === -1;
2205
2253
  });
2206
- this.log(this.$el);
2207
- this.log(this.$select);
2208
- this.log(this.$scrollableContent);
2209
- this.log('Name: ' + this.name);
2210
- this.log('Show search: ' + this.showSearch);
2211
- this.log('Show footer: ' + this.showFooter);
2212
- this.log('Scroll content height: ' + this.scrollContentHeight + 'px');
2213
- this.log(this.items);
2214
- this.log(this.searchData);
2215
- } else {
2216
- this.$select = this.$el.find('.select-content');
2217
- this.$scrollableContent = this.$select.find('.select-scrollable-content');
2218
- this.$selectItems = this.$select.find('.select-item');
2219
- this.$selectLabels = this.$select.find('[data-label]');
2220
2254
 
2221
- if (this.showSearch) {
2222
- this.$searchContainer = this.$select.find('.select-search');
2223
- this.$searchInput = this.$select.find('[name="select-search"]');
2224
- this.$searchIconContainer = this.$select.find('.select-search-icon');
2225
- this.$clearSearchButton = this.$select.find('[data-clear-search]');
2255
+ if (_this3.$el.find('.select-search').length) {
2256
+ _this3.showSearch = true;
2257
+ } else {
2258
+ _this3.showSearch = _this3.$el.data('showSearch') ? _this3.$el.data('showSearch') : _this3.opts.showSearch;
2226
2259
  }
2227
2260
 
2228
- if (this.showFooter) {
2229
- this.$footerContainer = this.$select.find('.select-footer');
2230
- this.$closeButton = this.$select.find('[data-select-close]');
2261
+ if (_this3.$el.find('.select-footer').length) {
2262
+ _this3.showFooter = true;
2263
+ } else {
2264
+ _this3.showFooter = _this3.$el.data('showFooter') ? _this3.$el.data('showFooter') : _this3.opts.showFooter;
2231
2265
  }
2232
2266
 
2233
- $.each(this.$selectLabels, function (i, el) {
2234
- _this3.searchData.push({
2235
- id: i,
2236
- val: $(el).text().trim()
2237
- });
2267
+ _this3.$select = _this3.$el.find('.select-content');
2268
+ new Promise(function (secondaryResolve, secondaryReject) {
2269
+ if (!_this3.$select.length) {
2270
+ var items = _this3._renderItemList(_this3.items);
2271
+
2272
+ _this3.$select = $("\n <div class=\"select-content\">\n\n " + _this3._renderSearch() + "\n\n <div class=\"select-scrollable-content\">" + items + "</div>\n\n " + _this3._renderFooter() + "\n\n </div>\n ");
2273
+
2274
+ _this3.$el.append(_this3.$select);
2275
+
2276
+ secondaryResolve();
2277
+ } else {
2278
+ secondaryResolve();
2279
+ }
2280
+ }).then(function () {
2281
+ _this3.$scrollableContent = _this3.$select.find('.select-scrollable-content') ? _this3.$select.find('.select-scrollable-content') : false;
2282
+ _this3.$selectItems = _this3.$select.find('.select-item');
2283
+
2284
+ if (_this3.data[_this3.name].length == 0 && _this3.dynamicTitle && _this3.dynamicTitleDefault && _this3.dynamicTitleDefault !== 0 && _this3.$selectTitle.text().trim() == 0 && (_this3.$selectItems.length > 0 || _this3.searchApi)) {
2285
+ _this3.$selectTitle.html(_this3.dynamicTitleDefault);
2286
+ }
2287
+
2288
+ if (_this3.$selectItems.length == 0 && !_this3.searchApi && _this3.dynamicTitle && _this3.dynamicTitleEmptyDefault && _this3.dynamicTitleEmptyDefault !== 0) {
2289
+ _this3.$selectHeader.css('cursor', 'default');
2290
+
2291
+ _this3.$selectIconContainer.addClass('d-none');
2292
+
2293
+ _this3.$selectTitle.html(_this3.dynamicTitleEmptyDefault);
2294
+ }
2295
+
2296
+ if (_this3.showSearch) {
2297
+ _this3.$searchContainer = _this3.$select.find('.select-search');
2298
+ _this3.$searchInput = _this3.$select.find('[name="select-search"]');
2299
+ _this3.$searchIconContainer = _this3.$select.find('.select-search-icon');
2300
+ _this3.$clearSearchButton = _this3.$select.find('[data-clear-search]'); // Prevent tabfocus from breaking select functionality
2301
+
2302
+ _this3.$searchInput[0].tabIndex = -1;
2303
+ }
2304
+
2305
+ if (_this3.showFooter) {
2306
+ _this3.$footerContainer = _this3.$select.find('.select-footer');
2307
+ _this3.$closeButton = _this3.$select.find('[data-select-close]'); // Prevent tabfocus from breaking select functionality
2308
+
2309
+ _this3.$closeButton[0].tabIndex = -1;
2310
+ }
2311
+
2312
+ _this3.buildSearchData();
2313
+
2314
+ _this3.log(_this3.$el);
2315
+
2316
+ _this3.log(_this3.$select);
2317
+
2318
+ _this3.log(_this3.$scrollableContent);
2319
+
2320
+ _this3.log('Name: ' + _this3.name);
2321
+
2322
+ _this3.log('Show search: ' + _this3.showSearch);
2323
+
2324
+ _this3.log('Show footer: ' + _this3.showFooter);
2325
+
2326
+ _this3.log('Scroll content height: ' + _this3.scrollContentHeight + 'px');
2327
+
2328
+ _this3.log(_this3.items);
2329
+
2330
+ _this3.log(_this3.searchData);
2331
+
2332
+ primaryResolve();
2238
2333
  });
2239
- this.log(this.$el);
2240
- this.log(this.$select);
2241
- this.log(this.$scrollableContent);
2242
- this.log('Name: ' + this.name);
2243
- this.log('Show search: ' + this.showSearch);
2244
- this.log('Show footer: ' + this.showFooter);
2245
- this.log('Scroll content height: ' + this.scrollContentHeight + 'px');
2246
- this.log(this.items);
2247
- this.log(this.searchData);
2248
- return true;
2249
- }
2334
+ });
2250
2335
  } // Build scroll
2251
2336
  ;
2252
2337
 
@@ -2279,7 +2364,9 @@ function (_AbstractUIComponent) {
2279
2364
  scrollYMarginOffset: -1,
2280
2365
  suppressScrollY: true,
2281
2366
  suppressScrollX: true
2282
- });
2367
+ }); // Prevent tabfocus from breaking select functionality
2368
+
2369
+ this.$scrollableContent.find('[tabindex="0"]').attr('tabindex', -1);
2283
2370
 
2284
2371
  if (this.$scrollableContent[0].offsetHeight < this.$scrollableContent[0].scrollHeight) {
2285
2372
  this.$scrollableContent.addClass('ps-show-rail-y');
@@ -2287,32 +2374,94 @@ function (_AbstractUIComponent) {
2287
2374
  }
2288
2375
  }
2289
2376
  }
2377
+ } // Build search data
2378
+ ;
2379
+
2380
+ _proto.buildSearchData = function buildSearchData() {
2381
+ var _this4 = this;
2382
+
2383
+ return new Promise(function (resolve, reject) {
2384
+ _this4.searchData = [];
2385
+
2386
+ var selectLabels = _this4.$select.find('[data-label]');
2387
+
2388
+ $.each(selectLabels, function (i, el) {
2389
+ _this4.searchData.push({
2390
+ id: i,
2391
+ val: $(el).text().trim()
2392
+ });
2393
+ });
2394
+ resolve();
2395
+ });
2290
2396
  } // Bind events that trigger methods
2291
2397
  ;
2292
2398
 
2293
2399
  _proto.bindEvents = function bindEvents() {
2294
- var _this4 = this;
2400
+ var _this5 = this;
2295
2401
 
2296
2402
  var self = this;
2297
2403
  this.$selectHeader.on('click' + '.' + NAME$1, function () {
2298
- if (_this4.contentOpen) {
2299
- _this4.close();
2300
- } else {
2301
- _this4.show();
2404
+ if (_this5.contentOpen) {
2405
+ _this5.close();
2406
+ } else if (_this5.$selectItems.length > 0 || _this5.searchApi) {
2407
+ _this5.show();
2302
2408
  }
2303
2409
  });
2304
2410
  this.$el.on('change' + '.' + NAME$1, 'input[type="checkbox"]', function () {
2411
+ var el = this;
2305
2412
  var val = $(this).val();
2306
-
2307
- if (this.checked) {
2413
+ self.preventClose = true;
2414
+
2415
+ if (typeof self.confirmCheck === 'function' && el.checked) {
2416
+ el.checked = false;
2417
+ self.confirmCheck(function (cb) {
2418
+ if (cb == 'confirmed') {
2419
+ self.data[self.name].indexOf(val) === -1 ? self.data[self.name].push(val) : false;
2420
+ el.checked = true;
2421
+ self.onSelect(el);
2422
+ self.preventClose = false;
2423
+ } else {
2424
+ setTimeout(function () {
2425
+ self.preventClose = false;
2426
+ }, 800);
2427
+ }
2428
+ }, el);
2429
+ } else if (el.checked) {
2308
2430
  self.data[self.name].indexOf(val) === -1 ? self.data[self.name].push(val) : false;
2309
- } else {
2431
+ self.onSelect(el);
2432
+ setTimeout(function () {
2433
+ self.preventClose = false;
2434
+ }, 800);
2435
+ } else if (typeof self.confirmUncheck === 'function' && !el.checked) {
2436
+ el.checked = true;
2437
+ self.confirmUncheck(function (cb) {
2438
+ if (cb == 'confirmed') {
2439
+ self.data[self.name] = self.data[self.name].filter(function (n) {
2440
+ return n != val;
2441
+ });
2442
+ el.checked = false;
2443
+ self.onSelect(el);
2444
+ self.preventClose = false;
2445
+ } else {
2446
+ setTimeout(function () {
2447
+ self.preventClose = false;
2448
+ }, 800);
2449
+ }
2450
+ }, el);
2451
+ } else if (!el.checked && !self.preventUncheck) {
2310
2452
  self.data[self.name] = self.data[self.name].filter(function (n) {
2311
2453
  return n != val;
2312
2454
  });
2455
+ self.onSelect(el);
2456
+ setTimeout(function () {
2457
+ self.preventClose = false;
2458
+ }, 800);
2459
+ } else if (!el.checked && self.preventUncheck) {
2460
+ el.checked = true;
2461
+ setTimeout(function () {
2462
+ self.preventClose = false;
2463
+ }, 800);
2313
2464
  }
2314
-
2315
- self.onSelect(this);
2316
2465
  });
2317
2466
  this.$el.on('change' + '.' + NAME$1, 'input[type="radio"]', function () {
2318
2467
  var val = $(this).val();
@@ -2326,12 +2475,20 @@ function (_AbstractUIComponent) {
2326
2475
  }
2327
2476
  });
2328
2477
  this.$el.on('click' + '.' + NAME$1, 'input[type="radio"]', function () {
2329
- if ($(this).hasClass('checked')) {
2330
- self.data[plugin.name] = [];
2478
+ if ($(this).hasClass('checked') && self.allowNoneOnRadioSelect) {
2479
+ self.data[self.name] = [];
2331
2480
  $(this).prop('checked', false);
2332
2481
  $(this).removeClass('checked');
2482
+
2483
+ if (self.dynamicTitle) {
2484
+ self.$selectTitle.html(self.dynamicTitleDefault);
2485
+ }
2333
2486
  } else {
2334
2487
  $(this).addClass('checked');
2488
+
2489
+ if (self.dynamicTitle) {
2490
+ self.$selectTitle.html($(this).parent().find('[data-label]').text());
2491
+ }
2335
2492
  }
2336
2493
 
2337
2494
  self.onSelect(this);
@@ -2359,7 +2516,7 @@ function (_AbstractUIComponent) {
2359
2516
  this.$searchInput.on('focusout' + '.' + NAME$1, function () {
2360
2517
  self.$searchContainer.removeClass('focused');
2361
2518
  });
2362
- this.$clearSearchButton.on('click' + '.' + NAME$1, function () {
2519
+ this.$searchContainer.on('click' + '.' + NAME$1, '[data-clear-search]', function () {
2363
2520
  if (self.searchString.length) {
2364
2521
  self.$searchInput.val('');
2365
2522
  self.searchString = '';
@@ -2372,12 +2529,12 @@ function (_AbstractUIComponent) {
2372
2529
 
2373
2530
  if (this.showFooter) {
2374
2531
  this.$closeButton.on('click' + '.' + NAME$1, function () {
2375
- _this4.close();
2532
+ _this5.close();
2376
2533
  });
2377
2534
  }
2378
2535
 
2379
2536
  $(document).on('touchstart click', function (e) {
2380
- if (!self.$el.is(e.target) && self.$el.has(e.target).length === 0 && self.contentOpen) {
2537
+ if (!self.$el.is(e.target) && !self.$el.has(e.target).length && self.contentOpen && !self.preventClose) {
2381
2538
  self.close.call(self);
2382
2539
  }
2383
2540
  });
@@ -2400,9 +2557,13 @@ function (_AbstractUIComponent) {
2400
2557
 
2401
2558
  _proto.setData = function setData() {
2402
2559
  var self = this;
2403
- var type = null;
2404
2560
  var faNameSpace = this.opts.faPro ? 'fal' : 'fas';
2405
- this.$selectIconContainer.html("<i class=\"" + faNameSpace + " fa-check text-green icon\"></i>");
2561
+
2562
+ if (this.showValidStateIcon) {
2563
+ this.$selectIconContainer.html("<i class=\"" + faNameSpace + " fa-check text-green icon\"></i>");
2564
+ } else {
2565
+ this.$selectIconContainer.html(this.selectIconDefault);
2566
+ }
2406
2567
 
2407
2568
  if (this.searchApi.length) {
2408
2569
  var searchUrl = this.searchApi;
@@ -2421,23 +2582,11 @@ function (_AbstractUIComponent) {
2421
2582
  url: searchUrl
2422
2583
  }).done(function (data) {
2423
2584
  var items = data.map(function (item) {
2424
- var label = '';
2425
-
2426
- if (item.name) {
2427
- label = item.name;
2428
- } else if (item.label) {
2429
- label = item.label;
2430
- } else if (item.value) {
2431
- label = item.value;
2432
- }
2433
-
2434
- return {
2435
- id: item.id.toString(),
2436
- label: label
2437
- };
2585
+ item.id = item.id.toString();
2586
+ return item;
2438
2587
  });
2439
2588
  items = items.filter(function (item) {
2440
- return self.data[self.name].indexOf(item.id) > -1;
2589
+ return !(self.data[self.name].indexOf(item.id) > -1) && self.itemsToExclude.indexOf(parseInt(item.id, 10)) === -1;
2441
2590
  });
2442
2591
  var result = $(self._renderItemList(items));
2443
2592
  $.when(self.$scrollableContent.append(result)).then(function () {
@@ -2452,12 +2601,12 @@ function (_AbstractUIComponent) {
2452
2601
  }
2453
2602
 
2454
2603
  if (self.$select.find(':input[type="checkbox"]').length) {
2455
- type = 'checkbox';
2604
+ self.type = 'checkbox';
2456
2605
  } else if (self.$select.find(':input[type="radio"]').length) {
2457
- type = 'radio';
2606
+ self.type = 'radio';
2458
2607
  }
2459
2608
 
2460
- if (type == 'checkbox') {
2609
+ if (self.type == 'checkbox') {
2461
2610
  self.data[self.name].forEach(function (value) {
2462
2611
  var $input = self.$select.find(':input').filter(function () {
2463
2612
  return this.value == value;
@@ -2465,24 +2614,29 @@ function (_AbstractUIComponent) {
2465
2614
  $input.prop('checked', true);
2466
2615
  self.onSelect($input[0]);
2467
2616
  });
2468
- } else if (type == 'radio') {
2617
+ } else if (self.type == 'radio') {
2469
2618
  var $input = self.$select.find(':input').filter(function () {
2470
2619
  return this.value == self.data[self.name];
2471
2620
  });
2472
2621
  $input.prop('checked', true);
2473
2622
  $input.addClass('checked');
2623
+
2624
+ if (self.dynamicTitle) {
2625
+ self.$selectTitle.html($input.parent().find('[data-label]').text());
2626
+ }
2627
+
2474
2628
  self.onSelect($input[0]);
2475
2629
  }
2476
2630
  });
2477
2631
  });
2478
2632
  } else {
2479
2633
  if (this.$select.find(':input[type="checkbox"]').length) {
2480
- type = 'checkbox';
2634
+ this.type = 'checkbox';
2481
2635
  } else if (this.$select.find(':input[type="radio"]').length) {
2482
- type = 'radio';
2636
+ this.type = 'radio';
2483
2637
  }
2484
2638
 
2485
- if (type == 'checkbox') {
2639
+ if (this.type == 'checkbox') {
2486
2640
  this.data[this.name].forEach(function (value) {
2487
2641
  var $input = self.$select.find(':input').filter(function () {
2488
2642
  return this.value == value;
@@ -2490,12 +2644,17 @@ function (_AbstractUIComponent) {
2490
2644
  $input.prop('checked', true);
2491
2645
  self.onSelect($input[0]);
2492
2646
  });
2493
- } else if (type == 'radio') {
2647
+ } else if (this.type == 'radio') {
2494
2648
  var $input = this.$select.find(':input').filter(function () {
2495
2649
  return this.value == self.data[self.name];
2496
2650
  });
2497
2651
  $input.prop('checked', true);
2498
2652
  $input.addClass('checked');
2653
+
2654
+ if (this.dynamicTitle) {
2655
+ this.$selectTitle.html($input.parent().find('[data-label]').text());
2656
+ }
2657
+
2499
2658
  this.onSelect($input[0]);
2500
2659
  }
2501
2660
  }
@@ -2514,13 +2673,11 @@ function (_AbstractUIComponent) {
2514
2673
  url: this.searchApi + this.searchString
2515
2674
  }).done(function (data) {
2516
2675
  var items = data.map(function (item) {
2517
- return {
2518
- id: item.id.toString(),
2519
- label: item.name || item.label || item.value || null
2520
- };
2676
+ item.id = item.id.toString();
2677
+ return item;
2521
2678
  });
2522
2679
  items = items.filter(function (item) {
2523
- return !(self.data[self.name].indexOf(item.id) > -1);
2680
+ return !(self.data[self.name].indexOf(item.id) > -1) && self.itemsToExclude.indexOf(parseInt(item.id, 10)) === -1;
2524
2681
  }); // Remove id with value 0 from results
2525
2682
 
2526
2683
  items = items.filter(function (item) {
@@ -2578,6 +2735,8 @@ function (_AbstractUIComponent) {
2578
2735
  ;
2579
2736
 
2580
2737
  _proto.show = function show() {
2738
+ var _this6 = this;
2739
+
2581
2740
  if (this.$el.hasClass('show')) {
2582
2741
  return;
2583
2742
  }
@@ -2611,29 +2770,39 @@ function (_AbstractUIComponent) {
2611
2770
  }
2612
2771
 
2613
2772
  this.$selectIconContainer.html("<i class=\"" + faNameSpace + " fa-angle-up icon\"></i>");
2773
+ setTimeout(function () {
2774
+ _this6.$el[0].scrollIntoView({
2775
+ behavior: 'smooth',
2776
+ block: 'nearest',
2777
+ inline: 'nearest'
2778
+ });
2779
+ }, 300);
2614
2780
  this.contentOpen = true;
2615
2781
  this.onShow();
2616
2782
  } // Close
2617
2783
  ;
2618
2784
 
2619
2785
  _proto.close = function close() {
2620
- var self = this;
2621
- var faNameSpace = this.opts.faPro ? 'fal' : 'fas';
2622
- this.$el.css('max-height', '');
2623
- this.$el.removeClass('show');
2624
- setTimeout(function () {
2625
- self.$el.removeAttr('style');
2626
- }, 300);
2786
+ if (!this.preventClose) {
2787
+ var self = this;
2788
+ var faNameSpace = this.opts.faPro ? 'fal' : 'fas';
2789
+ this.$el.css('max-height', '');
2790
+ this.$el.removeClass('show');
2791
+ setTimeout(function () {
2792
+ self.$el.removeAttr('style');
2793
+ }, 300);
2627
2794
 
2628
- if (this.data[this.name].length > 0) {
2629
- this.$selectIconContainer.html("<i class=\"" + faNameSpace + " fa-check text-green icon\"></i>");
2630
- } else {
2631
- this.$selectIconContainer.html("<i class=\"" + faNameSpace + " fa-angle-down icon\"></i>");
2632
- }
2795
+ if (this.data[this.name].length > 0 && this.showValidStateIcon) {
2796
+ this.$selectIconContainer.html("<i class=\"" + faNameSpace + " fa-check text-green icon\"></i>");
2797
+ } else {
2798
+ this.$selectIconContainer.html(this.selectIconDefault);
2799
+ }
2633
2800
 
2634
- this.contentOpen = false;
2635
- this.onClose();
2636
- };
2801
+ this.contentOpen = false;
2802
+ this.onClose();
2803
+ }
2804
+ } // On select
2805
+ ;
2637
2806
 
2638
2807
  _proto.onSelect = function onSelect(el) {
2639
2808
  var onSelect = this.opts.onSelect;
@@ -2641,13 +2810,210 @@ function (_AbstractUIComponent) {
2641
2810
  if (typeof onSelect === 'function') {
2642
2811
  onSelect.call(el);
2643
2812
  }
2813
+ } // Add more items after plugin is already initialized
2814
+ ;
2815
+
2816
+ _proto.appendItems = function appendItems(items, selectItems) {
2817
+ var _this7 = this;
2818
+
2819
+ return new Promise(function (resolve, reject) {
2820
+ var self = _this7;
2821
+
2822
+ if (!$.isArray(items)) {
2823
+ var itemsArr = [];
2824
+ itemsArr.push(items);
2825
+ items = itemsArr;
2826
+ }
2827
+
2828
+ items = items.filter(function (item) {
2829
+ return self.itemsToExclude.indexOf(parseInt(item.id, 10)) === -1;
2830
+ });
2831
+ items.forEach(function (item) {
2832
+ _this7.items.push(item);
2833
+ });
2834
+
2835
+ var domItems = _this7._renderItemList(items);
2836
+
2837
+ _this7.$scrollableContent.prepend(domItems);
2838
+
2839
+ _this7.$selectItems = _this7.$select.find('.select-item');
2840
+
2841
+ _this7.buildSearchData().then(function () {
2842
+ if (_this7.$selectItems.length > 0) {
2843
+ if (_this7.$select.find(':input[type="checkbox"]').length) {
2844
+ _this7.type = 'checkbox';
2845
+ } else if (_this7.$select.find(':input[type="radio"]').length) {
2846
+ _this7.type = 'radio';
2847
+ }
2848
+
2849
+ if (_this7.type == 'checkbox') {
2850
+ items.forEach(function (item) {
2851
+ var $input = _this7.$select.find(':input').filter(function () {
2852
+ return this.value == item.id;
2853
+ });
2854
+
2855
+ var val = parseInt($input.val(), 10);
2856
+ $input.prop('checked', true);
2857
+ _this7.data[_this7.name].indexOf(val) === -1 ? _this7.data[_this7.name].push(val) : false;
2858
+
2859
+ _this7.onSelect($input[0]);
2860
+ });
2861
+ } else if (_this7.type == 'radio') {
2862
+ var item = items[0];
2863
+
2864
+ var $input = _this7.$select.find(':input').filter(function () {
2865
+ return this.value == item.id;
2866
+ });
2867
+
2868
+ var val = parseInt($input.val(), 10);
2869
+ $input.prop('checked', true);
2870
+ $input.addClass('checked');
2871
+ _this7.data[_this7.name].indexOf(val) === -1 ? _this7.data[_this7.name].push(val) : false;
2872
+
2873
+ if (_this7.dynamicTitle) {
2874
+ _this7.$selectTitle.html($input.parent().find('[data-label]').text());
2875
+ }
2876
+
2877
+ _this7.$select.find('input[type="radio"]').not($input).prop('checked', false);
2878
+
2879
+ _this7.$select.find('input[type="radio"]').not($input).removeClass('checked');
2880
+
2881
+ _this7.onSelect($input[0]);
2882
+ }
2883
+ }
2884
+
2885
+ if (_this7.data[_this7.name].length == 0 && _this7.dynamicTitle && _this7.dynamicTitleDefault && _this7.dynamicTitleDefault !== 0 && _this7.$selectTitle.text().trim() == 0 && (_this7.$selectItems.length > 0 || _this7.searchApi)) {
2886
+ _this7.$selectTitle.html(_this7.dynamicTitleDefault);
2887
+ }
2888
+
2889
+ if (_this7.$selectHeader.attr('style')) {
2890
+ _this7.$selectHeader.removeAttr('style');
2891
+ }
2892
+
2893
+ if (_this7.$selectIconContainer.hasClass('d-none')) {
2894
+ _this7.$selectIconContainer.removeClass('d-none');
2895
+ }
2896
+
2897
+ resolve();
2898
+ });
2899
+ });
2900
+ } // Deselect items
2901
+ ;
2902
+
2903
+ _proto.deselectItems = function deselectItems(array) {
2904
+ var _this8 = this;
2905
+
2906
+ return new Promise(function (resolve, reject) {
2907
+ array.forEach(function (id) {
2908
+ var $input = _this8.$select.find(':input').filter(function () {
2909
+ return this.value == id;
2910
+ });
2911
+
2912
+ if ($input[0].checked) {
2913
+ $input.trigger('click');
2914
+ }
2915
+ });
2916
+
2917
+ if (_this8.data[_this8.name].length == 0) {
2918
+ _this8.$selectIconContainer.html(_this8.selectIconDefault);
2919
+ }
2920
+ });
2921
+ } // Get item
2922
+ ;
2923
+
2924
+ _proto.getItem = function getItem(key, val) {
2925
+ var result = $.grep(this.items, function (item) {
2926
+ return item[key] == val;
2927
+ })[0];
2928
+ return result ? result : null;
2929
+ } // Get selected items
2930
+ ;
2931
+
2932
+ _proto.getSelectedItems = function getSelectedItems(segment) {
2933
+ var ids = [];
2934
+ var result = [];
2935
+ var data = this.data[this.name];
2936
+
2937
+ if (!$.isArray(data)) {
2938
+ ids.push(data);
2939
+ } else {
2940
+ ids = data;
2941
+ }
2942
+
2943
+ ids = ids.map(Number);
2944
+
2945
+ if (this.items.length > 0) {
2946
+ result = $.grep(this.items, function (item) {
2947
+ return ids.indexOf(parseInt(item.id, 10)) > -1;
2948
+ });
2949
+
2950
+ if (segment) {
2951
+ result = result.map(function (obj) {
2952
+ return obj[segment];
2953
+ }).filter(function (obj) {
2954
+ return obj != null;
2955
+ });
2956
+ }
2957
+ } else {
2958
+ result = ids;
2959
+ }
2960
+
2961
+ return result;
2962
+ } // Get selected item
2963
+ ;
2964
+
2965
+ _proto.getSelectedItem = function getSelectedItem(segment) {
2966
+ var ids = [];
2967
+ var result = [];
2968
+ var data = this.data[this.name];
2969
+
2970
+ if (!$.isArray(data)) {
2971
+ ids.push(data);
2972
+ } else {
2973
+ ids = data;
2974
+ }
2975
+
2976
+ ids = ids.map(Number);
2977
+
2978
+ if (this.items.length > 0) {
2979
+ result = $.grep(this.items, function (item) {
2980
+ return ids.indexOf(parseInt(item.id, 10)) > -1;
2981
+ });
2982
+
2983
+ if (segment) {
2984
+ result = result.map(function (obj) {
2985
+ return obj[segment];
2986
+ }).filter(function (obj) {
2987
+ return obj != null;
2988
+ });
2989
+ }
2990
+ } else {
2991
+ result = ids;
2992
+ }
2993
+
2994
+ return result[0] == null ? null : result[0];
2644
2995
  };
2645
2996
 
2646
2997
  _proto._renderItemList = function _renderItemList(items) {
2647
2998
  var result = '';
2648
2999
 
2649
3000
  for (var i = 0; i < items.length; ++i) {
2650
- result += "\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 + "\">\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\" data-label>\n " + items[i].label + "\n </span>\n\n </label>\n\n </div>\n\n </div>\n\n </div>\n\n ";
3001
+ var item = items[i];
3002
+ var label = '';
3003
+
3004
+ if (typeof this.labelTemplate === 'function') {
3005
+ label = this.labelTemplate(item);
3006
+ } else {
3007
+ if (item.name) {
3008
+ label = item.name;
3009
+ } else if (item.label) {
3010
+ label = item.label;
3011
+ } else if (item.value) {
3012
+ label = item.value;
3013
+ }
3014
+ }
3015
+
3016
+ result += "\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 ";
2651
3017
  }
2652
3018
 
2653
3019
  return result;
@@ -2656,18 +3022,18 @@ function (_AbstractUIComponent) {
2656
3022
  _proto._renderSearch = function _renderSearch() {
2657
3023
  if (!this.showSearch) {
2658
3024
  return '';
3025
+ } else {
3026
+ var faNameSpace = this.opts.faPro ? 'fal' : 'fas';
3027
+ return "\n\n <div class=\"select-search\">\n\n <div class=\"select-search-input\">\n\n <input type=\"text\" name=\"select-search\" value=\"\" placeholder=\"" + this.searchPlaceholder + "\" tabindex=\"-1\">\n\n </div>\n\n <div class=\"select-search-icon\">\n\n <i class=\"" + faNameSpace + " fa-search icon\"></i>\n\n </div>\n\n </div>\n\n ";
2659
3028
  }
2660
-
2661
- var faNameSpace = this.opts.faPro ? 'fal' : 'fas';
2662
- return "\n\n <div class=\"select-search\">\n\n <div class=\"select-search-input\">\n\n <input type=\"text\" name=\"select-search\" value=\"\" placeholder=\"" + this.opts.searchPlaceholder + "\">\n\n </div>\n\n <div class=\"select-search-icon\">\n\n <i class=\"" + faNameSpace + " fa-search icon\"></i>\n\n </div>\n\n </div>\n\n ";
2663
3029
  };
2664
3030
 
2665
3031
  _proto._renderFooter = function _renderFooter() {
2666
3032
  if (!this.showFooter) {
2667
3033
  return '';
3034
+ } else {
3035
+ return "\n\n <div class=\"select-footer\">\n\n <button class=\"btn btn-block btn-secondary\" type=\"button\" tabindex=\"-1\" data-select-close >\n " + this.btnCloseText + "\n </button>\n\n </div>\n\n ";
2668
3036
  }
2669
-
2670
- return "\n\n <div class=\"select-footer\">\n\n <button class=\"btn btn-primary\" type=\"button\" data-select-close>\n " + this.opts.btnCloseText + "\n </button>\n\n </div>\n\n ";
2671
3037
  };
2672
3038
 
2673
3039
  Select._jQueryInterface = function _jQueryInterface(config) {
@@ -2708,6 +3074,10 @@ if (typeof $ !== 'undefined') {
2708
3074
  $.fn[NAME$1].defaults = {
2709
3075
  name: '',
2710
3076
  type: 'checkbox',
3077
+ labelTemplate: null,
3078
+ confirmCheck: null,
3079
+ confirmUncheck: null,
3080
+ setData: null,
2711
3081
  scrollContentHeight: 100,
2712
3082
  faPro: false,
2713
3083
  items: [],
@@ -2719,12 +3089,20 @@ if (typeof $ !== 'undefined') {
2719
3089
  onDestroy: null,
2720
3090
  onShow: null,
2721
3091
  onClose: null,
3092
+ onReset: null,
2722
3093
  onSearch: null,
2723
3094
  onSelect: null,
2724
3095
  buildScroll: null,
2725
3096
  searchPlaceholder: null,
2726
3097
  btnCloseText: null,
2727
- debug: false
3098
+ debug: false,
3099
+ dynamicTitle: false,
3100
+ dynamicTitleDefault: '',
3101
+ dynamicTitleEmptyDefault: '',
3102
+ allowNoneOnRadioSelect: true,
3103
+ preventUncheck: false,
3104
+ showValidStateIcon: true,
3105
+ itemsToExclude: []
2728
3106
  };
2729
3107
  }
2730
3108
 
@@ -3212,6 +3590,9 @@ function (_AbstractUIComponent) {
3212
3590
  this.$el.on('mouseleave' + '.' + NAME$3, function () {
3213
3591
  _this2.close();
3214
3592
  });
3593
+ this.$el.on('destroyed' + '.' + NAME$3, function () {
3594
+ _this2.close();
3595
+ });
3215
3596
  $(window).on('resize', debounce(function () {
3216
3597
  if (_this2.$tooltip) {
3217
3598
  _this2.setPosition();
@@ -3857,6 +4238,10 @@ function (_AbstractUIComponent) {
3857
4238
  this.$indicator = $(this.$el).parent().find('[data-collapse-indicator]');
3858
4239
  }
3859
4240
 
4241
+ if (this.expanded) {
4242
+ this.$target.css('height', 'auto');
4243
+ }
4244
+
3860
4245
  this.log(this.$el);
3861
4246
  this.log(this.$target);
3862
4247
  this.log(this.$container);
@@ -3913,7 +4298,12 @@ function (_AbstractUIComponent) {
3913
4298
  _proto.show = function show() {
3914
4299
  var _this3 = this;
3915
4300
 
3916
- this.$target.removeClass('collapse visible');
4301
+ // Update target height if something is added to dom which causes height to change
4302
+ if (this.targetHeight !== this.$target.height()) {
4303
+ this.targetHeight = this.$target.height();
4304
+ }
4305
+
4306
+ this.$target.removeClass('collapse show');
3917
4307
  this.$target.addClass('collapsing');
3918
4308
 
3919
4309
  if (this.$el.is('button')) {
@@ -3921,14 +4311,14 @@ function (_AbstractUIComponent) {
3921
4311
  }
3922
4312
 
3923
4313
  if (this.$container.length) {
3924
- this.$container.addClass('visible');
4314
+ this.$container.addClass('show');
3925
4315
  }
3926
4316
 
3927
4317
  this.$target.css('height');
3928
4318
  this.$target.css('height', this.targetHeight);
3929
4319
 
3930
4320
  if (this.$indicator.length) {
3931
- this.$indicator.addClass('visible');
4321
+ this.$indicator.addClass('show');
3932
4322
  }
3933
4323
 
3934
4324
  this.$target.one(this.whichTransitionEvent(), function () {
@@ -3940,7 +4330,7 @@ function (_AbstractUIComponent) {
3940
4330
 
3941
4331
  _this3.$target.removeAttr('style');
3942
4332
 
3943
- _this3.$target.addClass('collapse visible');
4333
+ _this3.$target.addClass('collapse show');
3944
4334
 
3945
4335
  _this3.$el.attr('aria-expanded', true);
3946
4336
 
@@ -3955,7 +4345,7 @@ function (_AbstractUIComponent) {
3955
4345
  _proto.close = function close() {
3956
4346
  var _this4 = this;
3957
4347
 
3958
- this.$target.removeClass('collapse visible');
4348
+ this.$target.removeClass('collapse show');
3959
4349
  this.$target.addClass('collapsing');
3960
4350
 
3961
4351
  if (this.$el.is('button')) {
@@ -3963,7 +4353,7 @@ function (_AbstractUIComponent) {
3963
4353
  }
3964
4354
 
3965
4355
  if (this.$container.length) {
3966
- this.$container.removeClass('visible');
4356
+ this.$container.removeClass('show');
3967
4357
  }
3968
4358
 
3969
4359
  this.$target.css('height', this.$target.height());
@@ -3971,8 +4361,8 @@ function (_AbstractUIComponent) {
3971
4361
  _this4.$target.css('height', 0);
3972
4362
  }, 10);
3973
4363
 
3974
- if (this.$indicator.length && this.$indicator.hasClass('visible')) {
3975
- this.$indicator.removeClass('visible');
4364
+ if (this.$indicator.length && this.$indicator.hasClass('show')) {
4365
+ this.$indicator.removeClass('show');
3976
4366
  }
3977
4367
 
3978
4368
  this.$target.one(this.whichTransitionEvent(), function () {
@@ -3988,7 +4378,11 @@ function (_AbstractUIComponent) {
3988
4378
 
3989
4379
  _this4.$el.attr('aria-expanded', false);
3990
4380
 
3991
- _this4.expanded = false;
4381
+ _this4.expanded = false; // Update target height if something is added to dom which causes height to change
4382
+
4383
+ if (_this4.targetHeight !== _this4.$target.height()) {
4384
+ _this4.targetHeight = _this4.$target.height();
4385
+ }
3992
4386
  });
3993
4387
  this.onClose();
3994
4388
  };
@@ -4571,6 +4965,7 @@ function () {
4571
4965
  animationSpeed: settings.animationSpeed,
4572
4966
  callbacks: settings.callbacks,
4573
4967
  maxBodyHeight: settings.maxBodyHeight,
4968
+ overflowVisible: settings.overflowVisible,
4574
4969
  actions: settings.actions,
4575
4970
  onInit: settings.onInit,
4576
4971
  onShow: settings.onShow,
@@ -4676,16 +5071,6 @@ function () {
4676
5071
 
4677
5072
  this.$container.append(dialog.$el);
4678
5073
 
4679
- if (dialog.template === '' && touchEvents() == false) {
4680
- dialog.$el.find('.dialog-body').addClass('ps-dark');
4681
- new PerfectScrollbar(dialog.$el.find('.dialog-body')[0], {
4682
- wheelSpeed: 1,
4683
- wheelPropagation: false,
4684
- minScrollbarLength: 20
4685
- });
4686
- dialog.$el.find('.dialog-body').addClass('ps-show-rail-y');
4687
- }
4688
-
4689
5074
  if (dialog.animation) {
4690
5075
  dialog.$el.find('.dialog-content').addClass(dialog.animationSpeed).animateCss(dialog.animationIn);
4691
5076
  }
@@ -4859,6 +5244,7 @@ function () {
4859
5244
  var classes = dialog.classes ? ' ' + dialog.classes : '';
4860
5245
  var centered = dialog.centered ? ' dialog-centered' : '';
4861
5246
  var size = dialog.size ? ' dialog-' + dialog.size : '';
5247
+ var overFlowVisible = dialog.overflowVisible ? ' dialog-overflow-visible' : '';
4862
5248
  var uuid = ' data-dialog-uuid="' + dialog.uuid + '"';
4863
5249
  var backdrop = dialog.backdrop ? ' data-dialog-backdrop="true"' : ' data-dialog-backdrop="false"';
4864
5250
  var title = dialog.title;
@@ -4874,7 +5260,7 @@ function () {
4874
5260
  body = dialog.body;
4875
5261
  }
4876
5262
 
4877
- return "\n <div class=\"dialog" + classes + centered + size + "\"" + uuid + backdrop + ">\n\n <div class=\"dialog-container\">\n\n <div class=\"dialog-content\">\n\n <div class=\"dialog-header\">\n\n <span class=\"dialog-title\">\n " + title + "\n </span>\n\n " + closeBtn + "\n\n </div>\n\n <div class=\"dialog-body\"" + maxBodyHeight + ">\n\n " + body + "\n\n </div>\n\n " + footer + "\n\n </div>\n\n </div>\n\n </div>\n ";
5263
+ return "\n <div class=\"dialog" + classes + centered + size + overFlowVisible + "\"" + uuid + backdrop + ">\n\n <div class=\"dialog-container\">\n\n <div class=\"dialog-content\">\n\n <div class=\"dialog-header\">\n\n <span class=\"dialog-title\">\n " + title + "\n </span>\n\n " + closeBtn + "\n\n </div>\n\n <div class=\"dialog-body\"" + maxBodyHeight + ">\n\n " + body + "\n\n </div>\n\n " + footer + "\n\n </div>\n\n </div>\n\n </div>\n ";
4878
5264
  };
4879
5265
 
4880
5266
  Dialog._jQueryInterface = function _jQueryInterface(config) {
@@ -4930,6 +5316,7 @@ if (typeof $ !== 'undefined') {
4930
5316
  animationSpeed: 'fastest',
4931
5317
  callbacks: {},
4932
5318
  maxBodyHeight: window.innerHeight - 200,
5319
+ overflowVisible: false,
4933
5320
  faPro: false,
4934
5321
  debug: true,
4935
5322
  onInitialize: null,