nice-elements 1.4.7 → 1.4.9

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,5 @@
1
1
  {
2
- "editor.formatOnSave": false,
2
+ "editor.formatOnSave": true,
3
3
  "html.format.wrapLineLength": 0,
4
4
  "prettier.printWidth": 0
5
5
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.4.9 (23.9.2022)
4
+
5
+ - fixed nice-datetimerange-picker-2 model change
6
+
7
+ ## v1.4.8 (29.8.2022)
8
+
9
+ - fixes
10
+
3
11
  ## v1.4.7 (29.8.2022)
4
12
 
5
13
  - fixes
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Nice elements v1.4.7
1
+ # Nice elements v1.4.9
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.9",
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") },
@@ -1001,7 +1001,7 @@ angular.module('niceElements')
1001
1001
  });
1002
1002
  };
1003
1003
 
1004
- $timeout(function() {
1004
+ $timeout(function () {
1005
1005
  if (!$scope.inline) $scope.setupPopper();
1006
1006
  });
1007
1007
 
@@ -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
 
@@ -1336,8 +1336,12 @@ angular.module('niceElements')
1336
1336
  onChange: '&?'
1337
1337
  },
1338
1338
  templateUrl: 'src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html',
1339
- controller: function ($element, $scope) {
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
 
@@ -1384,7 +1388,10 @@ angular.module('niceElements')
1384
1388
  ],
1385
1389
  });
1386
1390
  };
1387
- $scope.setupPopper();
1391
+
1392
+ $timeout(function () {
1393
+ $scope.setupPopper();
1394
+ });
1388
1395
 
1389
1396
 
1390
1397
  $scope.format = function(){
@@ -1401,41 +1408,41 @@ angular.module('niceElements')
1401
1408
 
1402
1409
 
1403
1410
  $scope.close = function() {
1404
- $scope.innerStartDate = angular.copy($scope.startDate);
1405
- $scope.innerEndDate = angular.copy($scope.endDate);
1411
+ $scope.model.innerStartDate = angular.copy($scope.startDate);
1412
+ $scope.model.innerEndDate = angular.copy($scope.endDate);
1406
1413
  $scope.isOpen = false;
1407
1414
  };
1408
1415
 
1409
1416
 
1410
1417
  $scope.confirm = function() {
1411
- $scope.startDate = angular.copy($scope.innerStartDate);
1412
- $scope.endDate = angular.copy($scope.innerEndDate);
1413
- if ($scope.onChange) $scope.onChange({ model: $scope.model });
1414
- $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;
1415
1422
  };
1416
1423
 
1417
1424
 
1418
1425
  $scope.selectToday = function(){
1419
- $scope.innerStartDate = moment().startOf('day');
1420
- $scope.innerEndDate = moment().endOf('day');
1426
+ $scope.model.innerStartDate = moment().startOf('day');
1427
+ $scope.model.innerEndDate = moment().endOf('day');
1421
1428
  };
1422
1429
 
1423
1430
 
1424
1431
  $scope.selectLastNDays = function(days){
1425
- $scope.innerStartDate = moment().subtract(days, 'days').startOf('day');
1426
- $scope.innerEndDate = moment().endOf('day');
1432
+ $scope.model.innerStartDate = moment().subtract(days, 'days').startOf('day');
1433
+ $scope.model.innerEndDate = moment().endOf('day');
1427
1434
  };
1428
1435
 
1429
1436
 
1430
1437
  $scope.selectLastMonth = function(){
1431
- $scope.innerStartDate = moment().subtract(1, 'months').startOf('month').startOf('date');
1432
- $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');
1433
1440
  };
1434
1441
 
1435
1442
 
1436
1443
  $scope.selectThisMonth = function(){
1437
- $scope.innerStartDate = moment().startOf('month').startOf('date');
1438
- $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');
1439
1446
  };
1440
1447
 
1441
1448
 
@@ -1445,28 +1452,30 @@ angular.module('niceElements')
1445
1452
  };
1446
1453
 
1447
1454
 
1448
- $scope.$watchGroup(["innerStartDate", "innerEndDate"], function(newValues){
1449
- if (newValues[0] && newValues[1]) {
1450
- // Check if start date is after end date
1451
- if ($scope.innerStartDate.isAfter($scope.innerEndDate)) {
1452
- var temp = angular.copy($scope.innerStartDate);
1453
- $scope.innerStartDate = angular.copy($scope.innerEndDate);
1454
- $scope.innerEndDate = temp;
1455
- }
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
+ }
1456
1464
 
1457
- // Check if end date is before start date
1458
- if ($scope.innerEndDate.isBefore($scope.innerStartDate)) {
1459
- var temp = angular.copy($scope.innerStartDate);
1460
- $scope.innerStartDate = angular.copy($scope.innerEndDate);
1461
- $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
+ }
1462
1471
  }
1463
- }
1464
- });
1472
+ });
1473
+ }
1465
1474
 
1466
1475
 
1467
- $scope.$watchGroup(["startDate", "endDate"], function(){
1468
- $scope.innerStartDate = angular.copy($scope.startDate);
1469
- $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);
1470
1479
  $scope.format();
1471
1480
  });
1472
1481
  }
@@ -2265,19 +2274,20 @@ angular.module('niceElements')
2265
2274
  requires: ["computeStyles"],
2266
2275
  fn: function(e) {
2267
2276
  var state = e.state;
2268
- state.styles.popper.width = `${state.rects.reference.width}px`;
2277
+ state.styles.popper.width = state.rects.reference.width + "px";
2269
2278
  },
2270
2279
  effect: function(e) {
2271
2280
  var state = e.state;
2272
- state.elements.popper.style.width = `${
2273
- state.elements.reference.offsetWidth
2274
- }px`;
2281
+ state.elements.popper.style.width = state.elements.reference.offsetWidth + "px";
2275
2282
  }
2276
2283
  }
2277
2284
  ],
2278
2285
  });
2279
2286
  };
2280
- $scope.setupPopper();
2287
+
2288
+ $timeout(function () {
2289
+ $scope.setupPopper();
2290
+ });
2281
2291
 
2282
2292
  // -----------------------------------Open -----------------------------------
2283
2293
  $scope.toggle = function () {
@@ -2293,9 +2303,14 @@ angular.module('niceElements')
2293
2303
  };
2294
2304
 
2295
2305
  $scope.open = function () {
2296
- $scope.isOpen = true;
2306
+ $scope.popper.update();
2307
+ $timeout(function () {
2308
+ $scope.isOpen = true;
2309
+ $timeout(function () {
2310
+ $scope.popper.update();
2311
+ });
2312
+ });
2297
2313
  $timeout(function () {
2298
- $scope.popper.update();
2299
2314
  $scope.focusInput();
2300
2315
  $scope.scrollToHover(true);
2301
2316
  }, 100);
@@ -4407,19 +4422,20 @@ angular.module('niceElements')
4407
4422
  requires: ["computeStyles"],
4408
4423
  fn: function(e) {
4409
4424
  var state = e.state;
4410
- state.styles.popper.width = `${state.rects.reference.width}px`;
4425
+ state.styles.popper.width = state.rects.reference.width + "px";
4411
4426
  },
4412
4427
  effect: function(e) {
4413
4428
  var state = e.state;
4414
- state.elements.popper.style.width = `${
4415
- state.elements.reference.offsetWidth
4416
- }px`;
4429
+ state.elements.popper.style.width = state.elements.reference.offsetWidth + "px";
4417
4430
  }
4418
4431
  }
4419
4432
  ],
4420
4433
  });
4421
4434
  };
4422
- $scope.setupPopper();
4435
+
4436
+ $timeout(function () {
4437
+ $scope.setupPopper();
4438
+ })
4423
4439
 
4424
4440
  // ------------------- On focus -------------------
4425
4441
  $scope.onFocus = function() {
@@ -5282,10 +5298,10 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
5282
5298
  "</div>\n" +
5283
5299
  "</div>\n" +
5284
5300
  "<div class=\"dtp-left\">\n" +
5285
- "<nice-date model=\"innerStartDate\" next-date=\"innerEndDate\" field-width=\"col-xs-12\" no-margin=\"true\" inline=\"true\" time=\"time\"></nice-date>\n" +
5301
+ "<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" +
5286
5302
  "</div>\n" +
5287
5303
  "<div class=\"dtp-right\">\n" +
5288
- "<nice-date model=\"innerEndDate\" next-date=\"innerStartDate\" field-width=\"col-xs-12\" no-margin=\"true\" inline=\"true\" time=\"time\"></nice-date>\n" +
5304
+ "<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" +
5289
5305
  "</div>\n" +
5290
5306
  "</div>\n" +
5291
5307
  "</div>\n" +