@finqu/cool 1.2.0 → 1.2.3
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/css/cool-grid.css +2 -2
- package/dist/css/cool-grid.css.map +3 -3
- package/dist/css/cool-grid.min.css +1 -1
- package/dist/css/cool-grid.min.css.map +1 -1
- package/dist/css/cool-reboot.css +2 -2
- package/dist/css/cool-reboot.css.map +6 -6
- package/dist/css/cool-reboot.min.css +1 -1
- package/dist/css/cool-reboot.min.css.map +1 -1
- package/dist/css/cool.css +2668 -726
- package/dist/css/cool.css.map +18 -18
- package/dist/css/cool.min.css +2 -2
- package/dist/css/cool.min.css.map +1 -1
- package/dist/js/cool.bundle.js +119 -32
- package/dist/js/cool.bundle.js.map +1 -1
- package/dist/js/cool.bundle.min.js +2 -2
- package/dist/js/cool.bundle.min.js.map +1 -1
- package/dist/js/cool.esm.js +119 -32
- package/dist/js/cool.esm.js.map +1 -1
- package/dist/js/cool.esm.min.js +2 -2
- package/dist/js/cool.esm.min.js.map +1 -1
- package/dist/js/cool.js +119 -32
- package/dist/js/cool.js.map +1 -1
- package/dist/js/cool.min.js +2 -2
- package/dist/js/cool.min.js.map +1 -1
- package/html/dropdown-test.html +200 -0
- package/html/index.html +480 -5
- package/js/dist/collapse.js +1 -1
- package/js/dist/common.js +677 -545
- package/js/dist/common.js.map +1 -1
- package/js/dist/dropdown.js +3188 -1819
- package/js/dist/dropdown.js.map +1 -1
- package/js/dist/popover.js +1 -1
- package/js/dist/sectiontabs.js +1 -1
- package/js/dist/select.js +2842 -2649
- package/js/dist/select.js.map +1 -1
- package/js/dist/tooltip.js +1 -1
- package/js/src/common.js +8 -0
- package/js/src/dialog.js +6 -1
- package/js/src/dropdown.js +77 -5
- package/js/src/select.js +31 -31
- package/package.json +21 -21
- package/scss/_alert.scss +79 -82
- package/scss/_badge.scss +16 -22
- package/scss/_dialog.scss +1 -0
- package/scss/_dropdown.scss +1 -4
- package/scss/_frame.scss +23 -3
- package/scss/_functions.scss +10 -0
- package/scss/_images.scss +7 -1
- package/scss/_navbar.scss +40 -0
- package/scss/_section.scss +14 -0
- package/scss/_type.scss +37 -6
- package/scss/_variables.scss +4 -3
- package/scss/cool-grid.scss +1 -1
- package/scss/cool-reboot.scss +1 -1
- package/scss/cool.scss +1 -1
- package/scss/mixins/_alert-variant.scss +13 -28
- package/scss/mixins/_badge-variant.scss +27 -5
- package/scss/mixins/_text-truncate.scss +77 -4
- package/scss/utilities/_cursor.scss +2 -2
- package/scss/utilities/_text.scss +4 -2
package/dist/js/cool.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Cool UI v1.
|
|
2
|
+
* Cool UI v1.2.2 (https://finqu.fi)
|
|
3
3
|
* Copyright 2011-2019 Finqu Oy
|
|
4
4
|
* Licensed under the ISC license - (http://opensource.org/licenses/ISC)
|
|
5
5
|
*/
|
|
@@ -1332,6 +1332,10 @@ function () {
|
|
|
1332
1332
|
linkDisabled = true;
|
|
1333
1333
|
}
|
|
1334
1334
|
|
|
1335
|
+
if (target.hasClass('table-link-exclude')) {
|
|
1336
|
+
linkDisabled = true;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1335
1339
|
if (target.is('td, .td, img') && !linkDisabled) {
|
|
1336
1340
|
if (e.ctrlKey || e.metaKey) {
|
|
1337
1341
|
window.open(href, '_blank');
|
|
@@ -1368,6 +1372,10 @@ function () {
|
|
|
1368
1372
|
btnDisabled = true;
|
|
1369
1373
|
}
|
|
1370
1374
|
|
|
1375
|
+
if (target.hasClass('table-btn-exclude')) {
|
|
1376
|
+
btnDisabled = true;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1371
1379
|
if (target.is('td, .td, img') && !btnDisabled) {
|
|
1372
1380
|
$(btn).click();
|
|
1373
1381
|
} else {
|
|
@@ -2237,6 +2245,10 @@ function (_AbstractUIComponent) {
|
|
|
2237
2245
|
_this3.itemsToExclude = _this3.$el.data('itemsToExclude') ? _this3.$el.data('itemsToExclude').replace(/\s/g, '').split(',') : _this3.opts.itemsToExclude;
|
|
2238
2246
|
_this3.preventClose = false;
|
|
2239
2247
|
|
|
2248
|
+
if (_this3.itemsToExclude.length > 0) {
|
|
2249
|
+
_this3.itemsToExclude = _this3.itemsToExclude.map(Number);
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2240
2252
|
if (_this3.opts.setData) {
|
|
2241
2253
|
_this3.data = _this3.opts.setData;
|
|
2242
2254
|
}
|
|
@@ -2245,12 +2257,17 @@ function (_AbstractUIComponent) {
|
|
|
2245
2257
|
_this3.data = _this3.$el.data('setData');
|
|
2246
2258
|
}
|
|
2247
2259
|
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2260
|
+
if (typeof _this3.data[_this3.name].filter !== 'undefined' && self.itemsToExclude) {
|
|
2261
|
+
_this3.data[_this3.name] = _this3.data[_this3.name].filter(function (item) {
|
|
2262
|
+
return self.itemsToExclude.indexOf(parseInt(item.id, 10)) === -1;
|
|
2263
|
+
});
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
if (typeof _this3.items.filter !== 'undefined' && self.itemsToExclude) {
|
|
2267
|
+
_this3.items = _this3.items.filter(function (item) {
|
|
2268
|
+
return self.itemsToExclude.indexOf(parseInt(item.id, 10)) === -1;
|
|
2269
|
+
});
|
|
2270
|
+
}
|
|
2254
2271
|
|
|
2255
2272
|
if (_this3.$el.find('.select-search').length) {
|
|
2256
2273
|
_this3.showSearch = true;
|
|
@@ -2410,6 +2427,8 @@ function (_AbstractUIComponent) {
|
|
|
2410
2427
|
this.$el.on('change' + '.' + NAME$1, 'input[type="checkbox"]', function () {
|
|
2411
2428
|
var el = this;
|
|
2412
2429
|
var val = $(this).val();
|
|
2430
|
+
var closeTimeout = 600; // ms
|
|
2431
|
+
|
|
2413
2432
|
self.preventClose = true;
|
|
2414
2433
|
|
|
2415
2434
|
if (typeof self.confirmCheck === 'function' && el.checked) {
|
|
@@ -2419,19 +2438,18 @@ function (_AbstractUIComponent) {
|
|
|
2419
2438
|
self.data[self.name].indexOf(val) === -1 ? self.data[self.name].push(val) : false;
|
|
2420
2439
|
el.checked = true;
|
|
2421
2440
|
self.onSelect(el);
|
|
2422
|
-
self.preventClose = false;
|
|
2423
|
-
} else {
|
|
2424
|
-
setTimeout(function () {
|
|
2425
|
-
self.preventClose = false;
|
|
2426
|
-
}, 800);
|
|
2427
2441
|
}
|
|
2442
|
+
|
|
2443
|
+
setTimeout(function () {
|
|
2444
|
+
self.preventClose = false;
|
|
2445
|
+
}, closeTimeout);
|
|
2428
2446
|
}, el);
|
|
2429
2447
|
} else if (el.checked) {
|
|
2430
2448
|
self.data[self.name].indexOf(val) === -1 ? self.data[self.name].push(val) : false;
|
|
2431
2449
|
self.onSelect(el);
|
|
2432
2450
|
setTimeout(function () {
|
|
2433
2451
|
self.preventClose = false;
|
|
2434
|
-
},
|
|
2452
|
+
}, closeTimeout);
|
|
2435
2453
|
} else if (typeof self.confirmUncheck === 'function' && !el.checked) {
|
|
2436
2454
|
el.checked = true;
|
|
2437
2455
|
self.confirmUncheck(function (cb) {
|
|
@@ -2441,12 +2459,11 @@ function (_AbstractUIComponent) {
|
|
|
2441
2459
|
});
|
|
2442
2460
|
el.checked = false;
|
|
2443
2461
|
self.onSelect(el);
|
|
2444
|
-
self.preventClose = false;
|
|
2445
|
-
} else {
|
|
2446
|
-
setTimeout(function () {
|
|
2447
|
-
self.preventClose = false;
|
|
2448
|
-
}, 800);
|
|
2449
2462
|
}
|
|
2463
|
+
|
|
2464
|
+
setTimeout(function () {
|
|
2465
|
+
self.preventClose = false;
|
|
2466
|
+
}, closeTimeout);
|
|
2450
2467
|
}, el);
|
|
2451
2468
|
} else if (!el.checked && !self.preventUncheck) {
|
|
2452
2469
|
self.data[self.name] = self.data[self.name].filter(function (n) {
|
|
@@ -2455,12 +2472,12 @@ function (_AbstractUIComponent) {
|
|
|
2455
2472
|
self.onSelect(el);
|
|
2456
2473
|
setTimeout(function () {
|
|
2457
2474
|
self.preventClose = false;
|
|
2458
|
-
},
|
|
2475
|
+
}, closeTimeout);
|
|
2459
2476
|
} else if (!el.checked && self.preventUncheck) {
|
|
2460
2477
|
el.checked = true;
|
|
2461
2478
|
setTimeout(function () {
|
|
2462
2479
|
self.preventClose = false;
|
|
2463
|
-
},
|
|
2480
|
+
}, closeTimeout);
|
|
2464
2481
|
}
|
|
2465
2482
|
});
|
|
2466
2483
|
this.$el.on('change' + '.' + NAME$1, 'input[type="radio"]', function () {
|
|
@@ -2586,7 +2603,7 @@ function (_AbstractUIComponent) {
|
|
|
2586
2603
|
return item;
|
|
2587
2604
|
});
|
|
2588
2605
|
items = items.filter(function (item) {
|
|
2589
|
-
return
|
|
2606
|
+
return self.data[self.name].indexOf(item.id) > -1 && self.itemsToExclude.indexOf(parseInt(item.id, 10)) === -1 && parseInt(item.id, 10) > 0;
|
|
2590
2607
|
});
|
|
2591
2608
|
var result = $(self._renderItemList(items));
|
|
2592
2609
|
$.when(self.$scrollableContent.append(result)).then(function () {
|
|
@@ -2677,11 +2694,7 @@ function (_AbstractUIComponent) {
|
|
|
2677
2694
|
return item;
|
|
2678
2695
|
});
|
|
2679
2696
|
items = items.filter(function (item) {
|
|
2680
|
-
return
|
|
2681
|
-
}); // Remove id with value 0 from results
|
|
2682
|
-
|
|
2683
|
-
items = items.filter(function (item) {
|
|
2684
|
-
return item.id > 0;
|
|
2697
|
+
return self.data[self.name].indexOf(item.id) === -1 && self.itemsToExclude.indexOf(parseInt(item.id, 10)) === -1 && parseInt(item.id, 10) > 0;
|
|
2685
2698
|
});
|
|
2686
2699
|
var result = $(self._renderItemList(items));
|
|
2687
2700
|
$.when(self.$scrollableContent.append(result)).then(function () {
|
|
@@ -2868,7 +2881,7 @@ function (_AbstractUIComponent) {
|
|
|
2868
2881
|
var val = parseInt($input.val(), 10);
|
|
2869
2882
|
$input.prop('checked', true);
|
|
2870
2883
|
$input.addClass('checked');
|
|
2871
|
-
_this7.data[_this7.name].indexOf(val) === -1 ? _this7.data[_this7.name]
|
|
2884
|
+
_this7.data[_this7.name].indexOf(val) === -1 ? _this7.data[_this7.name] = [val] : false;
|
|
2872
2885
|
|
|
2873
2886
|
if (_this7.dynamicTitle) {
|
|
2874
2887
|
_this7.$selectTitle.html($input.parent().find('[data-label]').text());
|
|
@@ -3178,6 +3191,7 @@ function (_AbstractUIComponent) {
|
|
|
3178
3191
|
this.minWidth = this.$el.data('minWidth') ? this.$el.data('minWidth') : this.opts.minWidth;
|
|
3179
3192
|
this.scroll = this.$el.data('scroll') ? this.$el.data('scroll') : this.opts.scroll;
|
|
3180
3193
|
this.scrollContentHeight = this.$el.data('scrollContentHeight') ? this.$el.data('scrollContentHeight') : this.opts.scrollContentHeight;
|
|
3194
|
+
this.positionObserver = this.$el.attr('data-position-observer') ? JSON.parse(this.$el.attr('data-position-observer')) : this.opts.positionObserver;
|
|
3181
3195
|
this.closeOnItemClick = this.$el.data('closeOnItemClick') ? this.$el.data('closeOnItemClick') : this.opts.closeOnItemClick;
|
|
3182
3196
|
this.content = this.$el.data('content') ? this.$el.data('content') : this.opts.content;
|
|
3183
3197
|
this.contentOpen = false;
|
|
@@ -3344,8 +3358,10 @@ function (_AbstractUIComponent) {
|
|
|
3344
3358
|
var dropdownTriggerHeight = this.$el.outerHeight(true);
|
|
3345
3359
|
var dropdownTriggerPosX = this.$el.position().left;
|
|
3346
3360
|
var dropdownTriggerPosY = this.$el.position().top;
|
|
3347
|
-
var dropdownPosX;
|
|
3348
|
-
var dropdownPosY;
|
|
3361
|
+
var dropdownPosX = 0;
|
|
3362
|
+
var dropdownPosY = 0;
|
|
3363
|
+
var offsetX = 0;
|
|
3364
|
+
var offsetY = 0;
|
|
3349
3365
|
|
|
3350
3366
|
if (placement === 'top') {
|
|
3351
3367
|
if (this.align === 'end') {
|
|
@@ -3373,12 +3389,78 @@ function (_AbstractUIComponent) {
|
|
|
3373
3389
|
|
|
3374
3390
|
if (this.offset) {
|
|
3375
3391
|
var offsets = this.offset.split(',');
|
|
3376
|
-
|
|
3377
|
-
|
|
3392
|
+
offsetX = offsets[0];
|
|
3393
|
+
offsetY = offsets[1];
|
|
3378
3394
|
dropdownPosX += parseInt(offsetX, 10);
|
|
3379
3395
|
dropdownPosY += parseInt(offsetY, 10);
|
|
3380
3396
|
}
|
|
3381
3397
|
|
|
3398
|
+
if (this.positionObserver) {
|
|
3399
|
+
// this is not set during init so we have to fetch it
|
|
3400
|
+
// and let's assume that this containing parent fits and is inside
|
|
3401
|
+
// viewport
|
|
3402
|
+
var $containingParent = null;
|
|
3403
|
+
|
|
3404
|
+
do {
|
|
3405
|
+
$containingParent = $containingParent ? $containingParent.parent() : this.$container.parent();
|
|
3406
|
+
|
|
3407
|
+
if (!$containingParent) {
|
|
3408
|
+
$containingParent = $('body');
|
|
3409
|
+
break;
|
|
3410
|
+
}
|
|
3411
|
+
} while ($containingParent.css('overflow-x') !== 'hidden' && $containingParent.css('overflow') !== 'hidden' && ($containingParent.prop('tagName') ? $containingParent.prop('tagName').toLowerCase() !== 'body' : false));
|
|
3412
|
+
|
|
3413
|
+
var containingBoundingRect = $containingParent.get(0).getBoundingClientRect();
|
|
3414
|
+
var containerBoundingRect = this.$container.get(0).getBoundingClientRect();
|
|
3415
|
+
|
|
3416
|
+
if (containingBoundingRect.width < dropdownWidth) {
|
|
3417
|
+
this.$dropdown.css('max-width', containingBoundingRect.width);
|
|
3418
|
+
dropdownWidth = containingBoundingRect.width;
|
|
3419
|
+
} else {
|
|
3420
|
+
this.$dropdown.css('max-width', '');
|
|
3421
|
+
}
|
|
3422
|
+
|
|
3423
|
+
if (containingBoundingRect.height < dropdownHeight) {
|
|
3424
|
+
this.$dropdown.css('max-height', containingBoundingRect.height);
|
|
3425
|
+
dropdownHeight = containingBoundingRect.height;
|
|
3426
|
+
} else {
|
|
3427
|
+
this.$dropdown.css('max-height', '');
|
|
3428
|
+
}
|
|
3429
|
+
|
|
3430
|
+
var maxTop = Math.max(Math.abs(containingBoundingRect.y - containerBoundingRect.y), 0);
|
|
3431
|
+
var maxLeft = Math.max(Math.abs(containingBoundingRect.x - containerBoundingRect.x), 0);
|
|
3432
|
+
var maxRight = $containingParent.get(0).scrollWidth - (containerBoundingRect.x + containerBoundingRect.width);
|
|
3433
|
+
var maxBottom = $containingParent.get(0).scrollHeight - (containerBoundingRect.y + (placement === 'dropbottom' ? containerBoundingRect.height : 0));
|
|
3434
|
+
|
|
3435
|
+
if (maxLeft < dropdownWidth && dropdownPosX < dropdownTriggerPosX) {
|
|
3436
|
+
dropdownPosX = dropdownTriggerPosX; // would be on top of the trigger
|
|
3437
|
+
|
|
3438
|
+
if (dropdownTriggerPosY + dropdownTriggerHeight > dropdownPosY) {
|
|
3439
|
+
dropdownPosY = dropdownTriggerPosY + dropdownTriggerHeight + (offsetY > 0 ? offsetY : 0);
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
|
|
3443
|
+
if (maxRight < dropdownWidth && dropdownPosX + dropdownWidth > dropdownTriggerPosX + dropdownTriggerWidth) {
|
|
3444
|
+
dropdownPosX = dropdownTriggerPosX + dropdownTriggerWidth - dropdownWidth;
|
|
3445
|
+
|
|
3446
|
+
if (dropdownTriggerPosY + dropdownTriggerHeight > dropdownPosY) {
|
|
3447
|
+
dropdownPosY = dropdownTriggerPosY + dropdownTriggerHeight + (offsetY > 0 ? offsetY : 0);
|
|
3448
|
+
}
|
|
3449
|
+
}
|
|
3450
|
+
|
|
3451
|
+
if (dropdownPosY < dropdownTriggerPosY && maxTop < dropdownHeight) {
|
|
3452
|
+
dropdownPosY = dropdownTriggerPosY + dropdownTriggerHeight + offsetY;
|
|
3453
|
+
}
|
|
3454
|
+
|
|
3455
|
+
if (dropdownPosY >= dropdownTriggerPosY && maxBottom < dropdownHeight) {
|
|
3456
|
+
if (dropdownPosX >= dropdownTriggerPosX + dropdownTriggerWidth || dropdownTriggerPosX >= dropdownPosX + dropdownWidth) {
|
|
3457
|
+
dropdownPosY = dropdownTriggerPosY - (dropdownHeight - maxBottom);
|
|
3458
|
+
} else {
|
|
3459
|
+
dropdownPosY = dropdownTriggerPosY - dropdownHeight - offsetY;
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
|
|
3382
3464
|
this.$dropdown.css({
|
|
3383
3465
|
position: 'absolute',
|
|
3384
3466
|
top: '0px',
|
|
@@ -3503,6 +3585,7 @@ if (typeof $ !== 'undefined') {
|
|
|
3503
3585
|
minWidth: null,
|
|
3504
3586
|
align: 'start',
|
|
3505
3587
|
closeOnItemClick: true,
|
|
3588
|
+
positionObserver: true,
|
|
3506
3589
|
content: false,
|
|
3507
3590
|
scroll: true,
|
|
3508
3591
|
scrollContentHeight: 100,
|
|
@@ -4972,6 +5055,10 @@ function () {
|
|
|
4972
5055
|
onClose: settings.onClose
|
|
4973
5056
|
};
|
|
4974
5057
|
|
|
5058
|
+
if (dialog.maxBodyHeight == null) {
|
|
5059
|
+
dialog.maxBodyHeight = window.innerHeight - 200;
|
|
5060
|
+
}
|
|
5061
|
+
|
|
4975
5062
|
if (typeof dialog.template === 'function') {
|
|
4976
5063
|
dialog.$el = $(dialog.template());
|
|
4977
5064
|
} else {
|
|
@@ -5315,7 +5402,7 @@ if (typeof $ !== 'undefined') {
|
|
|
5315
5402
|
animationOut: 'fadeOut',
|
|
5316
5403
|
animationSpeed: 'fastest',
|
|
5317
5404
|
callbacks: {},
|
|
5318
|
-
maxBodyHeight:
|
|
5405
|
+
maxBodyHeight: null,
|
|
5319
5406
|
overflowVisible: false,
|
|
5320
5407
|
faPro: false,
|
|
5321
5408
|
debug: true,
|