nice-elements 1.4.8 → 1.4.10

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.
@@ -1,5 +1,8 @@
1
1
  {
2
- "editor.formatOnSave": false,
2
+ "editor.formatOnSave": true,
3
3
  "html.format.wrapLineLength": 0,
4
- "prettier.printWidth": 0
4
+ "prettier.printWidth": 0,
5
+ "[scss]": {
6
+ "editor.defaultFormatter": "vscode.css-language-features"
7
+ }
5
8
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.4.10 (13.10.2022)
4
+
5
+ - used popper for nice help
6
+
7
+ ## v1.4.9 (23.9.2022)
8
+
9
+ - fixed nice-datetimerange-picker-2 model change
10
+
3
11
  ## v1.4.8 (29.8.2022)
4
12
 
5
13
  - fixes
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Nice elements v1.4.8
1
+ # Nice elements v1.4.10
2
2
 
3
3
  Nice elements is an AngularJS v1.5.8 module that contains nice form elements like inputs, choice fields, search, toggle, dropdown, etc.
4
4
 
package/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.4.5",
3
+ "version": "1.4.10",
4
4
  "authors": [
5
5
  "Klemen Kastelic <klemen@olaii.com>"
6
6
  ],
package/dist/nice.js CHANGED
@@ -956,7 +956,7 @@ angular.module('niceElements')
956
956
  $scope.years.push(year + i);
957
957
  }
958
958
 
959
- $scope.months = [
959
+ $scope.months = [
960
960
  { value: 0, name: gettextCatalog.getString("January", null, "Nice") },
961
961
  { value: 1, name: gettextCatalog.getString("February", null, "Nice") },
962
962
  { value: 2, name: gettextCatalog.getString("March", null, "Nice") },
@@ -1192,7 +1192,7 @@ angular.module('niceElements')
1192
1192
 
1193
1193
 
1194
1194
  // ------------------ Bootstrap ------------------
1195
- $scope.boostrap = function(){
1195
+ $scope.boostrap = function() {
1196
1196
  $scope.setInnerDate(moment($scope.model));
1197
1197
  $scope.getTime();
1198
1198
 
@@ -1338,6 +1338,10 @@ angular.module('niceElements')
1338
1338
  templateUrl: 'src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html',
1339
1339
  controller: function ($element, $timeout, $scope) {
1340
1340
  $scope.isOpen = false;
1341
+ $scope.model = {
1342
+ innerStartDate: null,
1343
+ innerEndDate: null,
1344
+ }
1341
1345
 
1342
1346
 
1343
1347
  // Set defaults
@@ -1355,14 +1359,14 @@ angular.module('niceElements')
1355
1359
  if(!$scope.startDate) {
1356
1360
  $scope.startDate = moment();
1357
1361
  } else {
1358
- $scope.innerStartDate = angular.copy($scope.startDate);
1362
+ $scope.model.innerStartDate = angular.copy($scope.startDate);
1359
1363
  }
1360
1364
 
1361
1365
  // Set end date
1362
1366
  if(!$scope.endDate) {
1363
1367
  $scope.endDate = moment();
1364
1368
  } else {
1365
- $scope.innerEndDate = angular.copy($scope.endDate);
1369
+ $scope.model.innerEndDate = angular.copy($scope.endDate);
1366
1370
  }
1367
1371
 
1368
1372
 
@@ -1404,41 +1408,41 @@ angular.module('niceElements')
1404
1408
 
1405
1409
 
1406
1410
  $scope.close = function() {
1407
- $scope.innerStartDate = angular.copy($scope.startDate);
1408
- $scope.innerEndDate = angular.copy($scope.endDate);
1411
+ $scope.model.innerStartDate = angular.copy($scope.startDate);
1412
+ $scope.model.innerEndDate = angular.copy($scope.endDate);
1409
1413
  $scope.isOpen = false;
1410
1414
  };
1411
1415
 
1412
1416
 
1413
1417
  $scope.confirm = function() {
1414
- $scope.startDate = angular.copy($scope.innerStartDate);
1415
- $scope.endDate = angular.copy($scope.innerEndDate);
1416
- if ($scope.onChange) $scope.onChange({ model: $scope.model });
1417
- $scope.close();
1418
+ $scope.startDate = angular.copy($scope.model.innerStartDate);
1419
+ $scope.endDate = angular.copy($scope.model.innerEndDate);
1420
+ if ($scope.onChange) $scope.onChange({ startDate: $scope.startDate, endDate: $scope.endDate });
1421
+ $scope.isOpen = false;
1418
1422
  };
1419
1423
 
1420
1424
 
1421
1425
  $scope.selectToday = function(){
1422
- $scope.innerStartDate = moment().startOf('day');
1423
- $scope.innerEndDate = moment().endOf('day');
1426
+ $scope.model.innerStartDate = moment().startOf('day');
1427
+ $scope.model.innerEndDate = moment().endOf('day');
1424
1428
  };
1425
1429
 
1426
1430
 
1427
1431
  $scope.selectLastNDays = function(days){
1428
- $scope.innerStartDate = moment().subtract(days, 'days').startOf('day');
1429
- $scope.innerEndDate = moment().endOf('day');
1432
+ $scope.model.innerStartDate = moment().subtract(days, 'days').startOf('day');
1433
+ $scope.model.innerEndDate = moment().endOf('day');
1430
1434
  };
1431
1435
 
1432
1436
 
1433
1437
  $scope.selectLastMonth = function(){
1434
- $scope.innerStartDate = moment().subtract(1, 'months').startOf('month').startOf('date');
1435
- $scope.innerEndDate = moment().subtract(1, 'months').endOf('month').endOf('date');
1438
+ $scope.model.innerStartDate = moment().subtract(1, 'months').startOf('month').startOf('date');
1439
+ $scope.model.innerEndDate = moment().subtract(1, 'months').endOf('month').endOf('date');
1436
1440
  };
1437
1441
 
1438
1442
 
1439
1443
  $scope.selectThisMonth = function(){
1440
- $scope.innerStartDate = moment().startOf('month').startOf('date');
1441
- $scope.innerEndDate = moment().endOf('month').endOf('date');
1444
+ $scope.model.innerStartDate = moment().startOf('month').startOf('date');
1445
+ $scope.model.innerEndDate = moment().endOf('month').endOf('date');
1442
1446
  };
1443
1447
 
1444
1448
 
@@ -1448,28 +1452,30 @@ angular.module('niceElements')
1448
1452
  };
1449
1453
 
1450
1454
 
1451
- $scope.$watchGroup(["innerStartDate", "innerEndDate"], function(newValues){
1452
- if (newValues[0] && newValues[1]) {
1453
- // Check if start date is after end date
1454
- if ($scope.innerStartDate.isAfter($scope.innerEndDate)) {
1455
- var temp = angular.copy($scope.innerStartDate);
1456
- $scope.innerStartDate = angular.copy($scope.innerEndDate);
1457
- $scope.innerEndDate = temp;
1458
- }
1455
+ $scope.dateChanged = function() {
1456
+ $timeout(function() {
1457
+ if ($scope.model.innerStartDate && $scope.model.innerEndDate) {
1458
+ // Check if start date is after end date
1459
+ if ($scope.model.innerStartDate.isAfter($scope.model.innerEndDate)) {
1460
+ var temp = angular.copy($scope.model.innerStartDate);
1461
+ $scope.model.innerStartDate = angular.copy($scope.model.innerEndDate);
1462
+ $scope.model.innerEndDate = temp;
1463
+ }
1459
1464
 
1460
- // Check if end date is before start date
1461
- if ($scope.innerEndDate.isBefore($scope.innerStartDate)) {
1462
- var temp = angular.copy($scope.innerStartDate);
1463
- $scope.innerStartDate = angular.copy($scope.innerEndDate);
1464
- $scope.innerEndDate = temp;
1465
+ // Check if end date is before start date
1466
+ if ($scope.model.innerEndDate.isBefore($scope.model.innerStartDate)) {
1467
+ var temp = angular.copy($scope.model.innerStartDate);
1468
+ $scope.model.innerStartDate = angular.copy($scope.model.innerEndDate);
1469
+ $scope.model.innerEndDate = temp;
1470
+ }
1465
1471
  }
1466
- }
1467
- });
1472
+ });
1473
+ }
1468
1474
 
1469
1475
 
1470
- $scope.$watchGroup(["startDate", "endDate"], function(){
1471
- $scope.innerStartDate = angular.copy($scope.startDate);
1472
- $scope.innerEndDate = angular.copy($scope.endDate);
1476
+ $scope.$watchGroup(["startDate", "endDate"], function() {
1477
+ $scope.model.innerStartDate = angular.copy($scope.startDate);
1478
+ $scope.model.innerEndDate = angular.copy($scope.endDate);
1473
1479
  $scope.format();
1474
1480
  });
1475
1481
  }
@@ -3403,6 +3409,42 @@ angular.module('niceElements')
3403
3409
  restrict: 'E',
3404
3410
  scope: {
3405
3411
  text: '@'
3412
+ },
3413
+ controller: function ($scope, $element, $timeout) {
3414
+ // Setup popper
3415
+ // https://popper.js.org/docs/v2/constructors/
3416
+ $scope.setupPopper = function () {
3417
+ var button = $element[0].getElementsByClassName('nice-help-button')[0];
3418
+ var tooltip = $element[0].getElementsByClassName('nice-help-popup')[0];
3419
+ $scope.popper = Popper.createPopper(button, tooltip, {
3420
+ strategy: 'fixed',
3421
+ placement: 'top',
3422
+ scroll: true,
3423
+ resize: true,
3424
+ modifiers: [
3425
+ {
3426
+ name: 'offset',
3427
+ options: {
3428
+ offset: [0, 5],
3429
+ },
3430
+ },
3431
+ {
3432
+ name: 'arrow',
3433
+ options: {
3434
+ padding: 2,
3435
+ },
3436
+ }
3437
+ ],
3438
+ });
3439
+ };
3440
+
3441
+ // $timeout(function () {
3442
+ // $scope.setupPopper();
3443
+ // });
3444
+
3445
+ $scope.onHover = function () {
3446
+ $scope.setupPopper();
3447
+ }
3406
3448
  }
3407
3449
  };
3408
3450
  });
@@ -5292,10 +5334,10 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
5292
5334
  "</div>\n" +
5293
5335
  "</div>\n" +
5294
5336
  "<div class=\"dtp-left\">\n" +
5295
- "<nice-date model=\"innerStartDate\" next-date=\"innerEndDate\" field-width=\"col-xs-12\" no-margin=\"true\" inline=\"true\" time=\"time\"></nice-date>\n" +
5337
+ "<nice-date model=\"model.innerStartDate\" next-date=\"model.innerEndDate\" is-inline=\"true\" no-margin=\"true\" inline=\"true\" time=\"{{ time }}\" on-change=\"dateChanged(model)\"></nice-date>\n" +
5296
5338
  "</div>\n" +
5297
5339
  "<div class=\"dtp-right\">\n" +
5298
- "<nice-date model=\"innerEndDate\" next-date=\"innerStartDate\" field-width=\"col-xs-12\" no-margin=\"true\" inline=\"true\" time=\"time\"></nice-date>\n" +
5340
+ "<nice-date model=\"model.innerEndDate\" next-date=\"model.innerStartDate\" is-inline=\"true\" no-margin=\"true\" inline=\"true\" time=\"{{ time }}\" on-change=\"dateChanged(model)\"></nice-date>\n" +
5299
5341
  "</div>\n" +
5300
5342
  "</div>\n" +
5301
5343
  "</div>\n" +
@@ -5562,10 +5604,13 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
5562
5604
 
5563
5605
 
5564
5606
  $templateCache.put('src/components/nice-help/nice-help.html',
5565
- "<div class=\"nice-help\">\n" +
5566
- "<i class=\"fa fa-question-circle\"></i>\n" +
5567
- "<div class=\"help-window\" ng-bind-html=\"text\">{{ text }}</div>\n" +
5568
- "</div>\n"
5607
+ "<div class=\"nice-help\" ng-mouseover=\"onHover()\">\n" +
5608
+ "<i class=\"fa fa-question-circle nice-help-button\" aria-label=\"\"></i>\n" +
5609
+ "<div class=\"nice-help-popup\">\n" +
5610
+ "<span ng-bind-html=\"text\">{{ text }}</span>\n" +
5611
+ "<div data-popper-arrow class=\"nice-help-arrow\"></div>\n" +
5612
+ "</div>\n" +
5613
+ "</div>"
5569
5614
  );
5570
5615
 
5571
5616