nice-elements 1.12.11 → 1.13.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.13.0 (20.1.2026)
4
+
5
+ - created nice options component
6
+
7
+ ## v1.12.12 (6.1.2026)
8
+
9
+ - added addButtonDisabled prop to nice dropdown
10
+
3
11
  ## v1.12.11 (19.12.2025)
4
12
 
5
13
  - added nice checkbox indeterminate prop,
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ![Nice elements](https://github.com/Klemen1337/angularjs-nice-elements/raw/master/demo/assets/logo.png)
2
2
 
3
- # Nice elements v1.12.11
3
+ # Nice elements v1.13.0
4
4
 
5
5
  Nice elements is an AngularJS v1.5.8 module that contains nice form elements like inputs, choice fields, search, toggle, dropdown, etc.
6
6
 
@@ -50,6 +50,7 @@ Nice elements is an AngularJS v1.5.8 module that contains nice form elements lik
50
50
  - nice-view
51
51
  - nice-virtual-scroll
52
52
  - nice-on-scroll
53
+ - nice-options
53
54
  - ~~nice-datetime-picker~~ (DEPREACATED)
54
55
  - ~~nice-datetimerange-picker~~ (DEPREACATED)
55
56
  - ~~nice-dtp~~ (DEPREACATED)
package/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.12.11",
3
+ "version": "1.13.0",
4
4
  "authors": [
5
5
  "Klemen Kastelic <klemen@olaii.com>"
6
6
  ],
package/dist/nice.js CHANGED
@@ -2474,6 +2474,7 @@ angular.module('niceElements')
2474
2474
  labelWidth: '@',
2475
2475
  loading: '=?',
2476
2476
  addButtonFunction: '=?',
2477
+ addButtonDisabled: '=?',
2477
2478
  objValue: '@', // Optional - default is 'value'
2478
2479
  objKey: '@?', // Optional - default is 'id'. Used only when returnOnlyKey=true.
2479
2480
  selectedIsKey: '@?',
@@ -4536,6 +4537,75 @@ angular.module('niceElements').directive('niceOnScroll', function() {
4536
4537
  });
4537
4538
  'use strict';
4538
4539
 
4540
+ /**
4541
+ * @ngdoc directive
4542
+ * @name niceElements.directive:niceOptions
4543
+ * @description
4544
+ * # niceOptions
4545
+ */
4546
+ angular.module('niceElements')
4547
+ .directive('niceOptions', function () {
4548
+ return {
4549
+ templateUrl: 'src/components/nice-options/nice-options.html',
4550
+ restrict: 'E',
4551
+ transclude: true,
4552
+ scope: {
4553
+ model: '=',
4554
+ niceTitle: '@',
4555
+ isDisabled: '=',
4556
+ fieldWidth: '@',
4557
+ labelWidth: '@',
4558
+ noMargin: '@',
4559
+ onChange: '&?',
4560
+ isInline: '=',
4561
+ help: '@',
4562
+ required: '=',
4563
+ options: '=',
4564
+ selectedIsKey: '=',
4565
+ valueKey: "@"
4566
+ },
4567
+ controller: function ($scope, $timeout) {
4568
+ if (!$scope.fieldWidth) $scope.fieldWidth = 'col-sm-8';
4569
+ if (!$scope.labelWidth) $scope.labelWidth = 'col-sm-4';
4570
+ if (!$scope.valueKey) $scope.valueKey = 'id';
4571
+ $scope.noMargin = angular.isDefined($scope.noMargin);
4572
+
4573
+ // Check if selected
4574
+ $scope.isSelected = function(option) {
4575
+ if (!$scope.model) return false;
4576
+ if ($scope.selectedIsKey) {
4577
+ return $scope.model == option[$scope.valueKey];
4578
+ } else {
4579
+ return $scope.model[$scope.valueKey] == option[$scope.valueKey];
4580
+ }
4581
+ };
4582
+
4583
+ // Select option
4584
+ $scope.selectOption = function(option) {
4585
+ if ($scope.isSelected(option) && !$scope.required) {
4586
+ $scope.model = null;
4587
+ } else if ($scope.selectedIsKey) {
4588
+ $scope.model = option[$scope.valueKey];
4589
+ } else {
4590
+ $scope.model = option;
4591
+ }
4592
+
4593
+ $timeout(function () {
4594
+ if ($scope.onChange) $scope.onChange({ model: $scope.model });
4595
+ $scope.formNiceOptions.$setDirty();
4596
+ });
4597
+ };
4598
+
4599
+ // Select default
4600
+ if (!$scope.model && $scope.options && $scope.required) {
4601
+ $scope.selectOption($scope.options[0]);
4602
+ }
4603
+ }
4604
+ };
4605
+ });
4606
+
4607
+ 'use strict';
4608
+
4539
4609
  /**
4540
4610
  * @ngdoc directive
4541
4611
  * @name niceElements.directive:nicePercent
@@ -6325,11 +6395,16 @@ angular.module('niceElements')
6325
6395
  return (el.scrollTop + el.clientHeight) >= (el.scrollHeight - tolerance);
6326
6396
  };
6327
6397
 
6328
- // Scroll Event Listener
6329
- element[0].addEventListener('scroll', () => {
6398
+ function onScroll() {
6330
6399
  if (isScrolledToBottom(element[0]) && !scope.$eval(attrs.niceInfiniteLoaderDisabled)) {
6331
6400
  scope.$eval(attrs.niceInfiniteLoader);
6332
6401
  }
6402
+ }
6403
+
6404
+ // Scroll Event Listener
6405
+ element.on('scroll', onScroll);
6406
+ scope.$on('$destroy', () => {
6407
+ element.off('scroll', onScroll);
6333
6408
  });
6334
6409
  }
6335
6410
  };
@@ -6431,7 +6506,7 @@ angular.module('niceElements')
6431
6506
  .service('NiceService', function ($rootScope) {
6432
6507
  const service = {
6433
6508
  name: "Nice elements",
6434
- version: "1.12.11",
6509
+ version: "1.13.0",
6435
6510
  getHeader: function () {
6436
6511
  return {};
6437
6512
  },
@@ -7155,7 +7230,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
7155
7230
  "\n" +
7156
7231
  "\n" +
7157
7232
  " \n" +
7158
- " <button type=\"button\" class=\"btn btn-primary btn-icon add-btn\" ng-if=\"addButtonFunction && !isDisabled\" ng-click=\"handleAddButton($event)\" ng-disabled=\"isDisabled\">\n" +
7233
+ " <button type=\"button\" class=\"btn btn-primary btn-icon add-btn\" ng-if=\"addButtonFunction\" ng-click=\"handleAddButton($event)\" ng-disabled=\"addButtonDisabled || isDisabled\">\n" +
7159
7234
  " <nice-icon icon=\"icon-plus\"></nice-icon>\n" +
7160
7235
  " </button>\n" +
7161
7236
  " </div>\n" +
@@ -7420,6 +7495,27 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
7420
7495
  );
7421
7496
 
7422
7497
 
7498
+ $templateCache.put('src/components/nice-options/nice-options.html',
7499
+ "<div class=\"nice-component nice-options\" ng-class=\"{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline, 'nice-disabled': isDisabled }\" ng-form=\"formNiceOptions\">\n" +
7500
+ " <div class=\"row\">\n" +
7501
+ " \n" +
7502
+ " <nice-title text=\"title || niceTitle\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
7503
+ "\n" +
7504
+ " \n" +
7505
+ " <div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8']\">\n" +
7506
+ " <div class=\"nice-options-wrapper\">\n" +
7507
+ " <button ng-repeat=\"option in options\" type=\"button\" class=\"btn\" ng-click=\"selectOption(option)\" ng-disabled=\"isDisabled\" ng-class=\"{ 'btn-primary': isSelected(option), 'btn-default': !isSelected(option) }\" ng-transclude>\n" +
7508
+ " <nice-icon class=\"nice-options-wrapper-icon\" ng-if=\"option.icon\" icon=\"{{ option.icon }}\"></nice-icon>\n" +
7509
+ " <div class=\"nice-options-wrapper-title\">{{ option.title }}</div>\n" +
7510
+ " <div class=\"nice-options-wrapper-description\" ng-if=\"option.description\">{{ option.description }}</div>\n" +
7511
+ " </button>\n" +
7512
+ " </div>\n" +
7513
+ " </div>\n" +
7514
+ " </div>\n" +
7515
+ "</div>"
7516
+ );
7517
+
7518
+
7423
7519
  $templateCache.put('src/components/nice-percent/nice-percent.html',
7424
7520
  "<ng-form class=\"nice-component nice-input\" ng-class=\"{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }\" name=\"form\">\n" +
7425
7521
  " <div class=\"row\">\n" +
@@ -8824,6 +8920,13 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
8824
8920
  " <path d=\"M14.3267 10.9481C14.1175 10.5991 14.2308 10.1469 14.5797 9.93748C14.9287 9.72809 15.3811 9.84093 15.5906 10.1898L14.3267 10.9481ZM20.0134 10.9483L17.8019 14.634C17.6687 14.8557 17.4289 14.9912 17.1703 14.9913C16.9114 14.9913 16.6714 14.8555 16.5382 14.6335L14.3267 10.9481L15.5906 10.1898L17.1706 12.8216L18.7487 10.1901L18.7911 10.1276C19.0146 9.82829 19.4329 9.74063 19.7601 9.93682C20.0874 10.1332 20.2077 10.5439 20.0489 10.882L20.0134 10.9483Z\"/>\n" +
8825
8921
  " </symbol>\n" +
8826
8922
  "\n" +
8923
+ " <symbol id=\"icon-options\" viewBox=\"0 0 24 24\">\n" +
8924
+ " <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M21 5H3C2.44772 5 2 5.44772 2 6V18C2 18.5523 2.44772 19 3 19H21C21.5523 19 22 18.5523 22 18V6C22 5.44772 21.5523 5 21 5ZM3 3C1.34315 3 0 4.34315 0 6V18C0 19.6569 1.34315 21 3 21H21C22.6569 21 24 19.6569 24 18V6C24 4.34315 22.6569 3 21 3H3Z\"/>\n" +
8925
+ " <path d=\"M4.5 8.5C4.5 7.67157 5.17157 7 6 7V7C6.82843 7 7.5 7.67157 7.5 8.5V15.5C7.5 16.3284 6.82843 17 6 17V17C5.17157 17 4.5 16.3284 4.5 15.5V8.5Z\"/>\n" +
8926
+ " <path d=\"M10.5 8.5C10.5 7.67157 11.1716 7 12 7V7C12.8284 7 13.5 7.67157 13.5 8.5V15.5C13.5 16.3284 12.8284 17 12 17V17C11.1716 17 10.5 16.3284 10.5 15.5V8.5Z\"/>\n" +
8927
+ " <path d=\"M16.5 8.5C16.5 7.67157 17.1716 7 18 7V7C18.8284 7 19.5 7.67157 19.5 8.5V15.5C19.5 16.3284 18.8284 17 18 17V17C17.1716 17 16.5 16.3284 16.5 15.5V8.5Z\"/>\n" +
8928
+ " </symbol>\n" +
8929
+ "\n" +
8827
8930
  " <symbol id=\"icon-seat\" viewBox=\"0 0 370 370\">\n" +
8828
8931
  " <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M31 261H339V300C339 329.823 314.823 354 285 354H85C55.1766 354 31 329.823 31 300V261ZM73.372 321C65.9937 316.906 61 309.036 61 300V291H309V300C309 309.036 304.006 316.906 296.628 321C293.183 322.911 289.219 324 285 324H85C80.7813 324 76.8167 322.911 73.372 321Z\"></path>\n" +
8829
8932
  " <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M339 291H249V227C249 202.147 269.147 182 294 182C318.853 182 339 202.147 339 227V291ZM309 227C309 218.716 302.284 212 294 212C285.716 212 279 218.716 279 227V261H309V227Z\"></path>\n" +