nice-elements 1.6.1 → 1.6.2

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,8 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.6.2 (7.12.2022)
4
+
5
+ - fixed nice upload - OLA-199
6
+
3
7
  ## v1.6.1 (3.12.2022)
4
8
 
5
- - fixed nice search 2 item select
9
+ - fixed nice search 2 item select,
6
10
  - added negative spacings,
7
11
  - worked on button icons spacing
8
12
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ![Nice elements](/demo/assets/logo.png)
2
2
 
3
- # Nice elements v1.6.1
3
+ # Nice elements v1.6.2
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
 
package/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "authors": [
5
5
  "Klemen Kastelic <klemen@olaii.com>"
6
6
  ],
package/dist/nice.js CHANGED
@@ -814,6 +814,103 @@ angular.module('niceElements')
814
814
 
815
815
  'use strict';
816
816
 
817
+ /**
818
+ * @ngdoc directive
819
+ * @name niceElements.directive:niceDatetimePicker
820
+ * @description
821
+ * # niceDatetimePicker
822
+ */
823
+ angular.module('niceElements')
824
+ .directive('niceDateInput', function () {
825
+ return {
826
+ restrict: 'E',
827
+ transclude: false,
828
+ templateUrl: 'src/components/nice-date-input/nice-date-input.html',
829
+ scope: {
830
+ model: '=', // binding model
831
+ date: '=?', // default: true, is date picker enabled?
832
+ time: '=?', // default: false, is time picker enabled?
833
+ minDate: '@', // default: undefined
834
+ maxDate: '@', // default: undefined
835
+ title: '@', // default: ''
836
+ noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
837
+ fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
838
+ labelWidth: '@', // default: 'col-sm-4', bootstrap classes that defines width of label
839
+ isDisabled: '=',
840
+ help: '@',
841
+ isInline: '=',
842
+ onChange: '&?'
843
+ },
844
+ controller: function ($scope) {
845
+ $scope.formatDate = "DD.MM.YYYY";
846
+ $scope.formatTime = "HH:mm";
847
+ $scope.hours = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23];
848
+ $scope.minutes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59];
849
+ $scope.model = moment($scope.model) || moment().set({ 'second': 0, 'millisecond': 0 });
850
+
851
+ $scope.dateChanged = function (date) {
852
+ $scope.modelDate = date.format($scope.formatDate);
853
+ $scope.handleChange();
854
+ }
855
+
856
+ $scope.timeChanged = function (date) {
857
+ $scope.modelTime = date.format($scope.formatTime);
858
+ $scope.handleChange();
859
+ }
860
+
861
+ // -------------------- On date change --------------------
862
+ $scope.handleChange = function () {
863
+ var newModel = moment($scope.modelDate + " " + $scope.modelTime, $scope.formatDate + " " + $scope.formatTime).seconds(0).milliseconds(0);
864
+ if (newModel.isValid()) {
865
+ $scope.model = newModel;
866
+ if ($scope.onChange) $scope.onChange({ model: $scope.model });
867
+ $scope.niceDateInputForm.$setValidity('validDate', true);
868
+ } else {
869
+ $scope.model = null;
870
+ if ($scope.onChange) $scope.onChange({ model: $scope.model });
871
+ $scope.niceDateInputForm.$setValidity('validDate', false);
872
+ }
873
+ }
874
+
875
+ // -------------------- Format model --------------------
876
+ $scope.formatModel = function () {
877
+ $scope.modelDate = $scope.model.format($scope.formatDate);
878
+ $scope.modelTime = $scope.model.format($scope.formatTime);
879
+ }
880
+ $scope.formatModel();
881
+
882
+ // -------------------- Date --------------------
883
+ $scope.dateBlur = function () {
884
+ var newDate = moment($scope.modelDate, $scope.formatDate);
885
+ if (newDate.isValid()) {
886
+ $scope.niceDateInputForm.$setValidity('validDate', true);
887
+ $scope.handleChange();
888
+ } else {
889
+ $scope.niceDateInputForm.$setValidity('validDate', false);
890
+ }
891
+ };
892
+
893
+ // -------------------- Time --------------------
894
+ $scope.timeBlur = function () {
895
+ var newTime = moment($scope.modelTime, $scope.formatTime);
896
+ if (newTime.isValid()) {
897
+ $scope.niceDateInputForm.$setValidity('validDate', true);
898
+ $scope.handleChange();
899
+ } else {
900
+ $scope.niceDateInputForm.$setValidity('validDate', false);
901
+ }
902
+ };
903
+
904
+ // -------------------- Watch model --------------------
905
+ $scope.$watch('model', function () {
906
+ $scope.formatModel();
907
+ });
908
+ }
909
+ }
910
+ }
911
+ );
912
+ 'use strict';
913
+
817
914
  /**
818
915
  * @ngdoc directive
819
916
  * @name niceElements.directive:niceDateRange
@@ -5463,6 +5560,48 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
5463
5560
  );
5464
5561
 
5465
5562
 
5563
+ $templateCache.put('src/components/nice-date-input/nice-date-input.html',
5564
+ "<div class=\"nice-component nice-date-input\" ng-form=\"niceDateInputForm\" ng-class=\"{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline, 'error': niceDateInputForm.$invalid }\">\n" +
5565
+ "<div class=\"row\">\n" +
5566
+ "<div class=\"nice-title col-xs-12\" ng-class=\"labelWidth ? labelWidth : 'col-sm-4'\" ng-if=\"title\">\n" +
5567
+ "<div class=\"nice-title-text\">{{ title }}<span ng-if=\"required\">*</span></div>\n" +
5568
+ "<nice-help class=\"nice-title-help\" ng-if=\"help\" text=\"{{ help }}\"></nice-help>\n" +
5569
+ "</div>\n" +
5570
+ "<div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\">\n" +
5571
+ "<div class=\"input-group nice-date-input\" ng-class=\"{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }\">\n" +
5572
+ "<input type=\"text\" class=\"form-control\" ng-model=\"modelDate\" ng-blur=\"dateBlur()\" ng-disabled=\"isDisabled\">\n" +
5573
+ "<nice-popup placement=\"bottom\">\n" +
5574
+ "<nice-popup-target>\n" +
5575
+ "<button class=\"input-group-addon btn btn-default\" tabindex=\"-1\">\n" +
5576
+ "<nice-icon icon=\"icon-calendar\"></nice-icon>\n" +
5577
+ "</button>\n" +
5578
+ "</nice-popup-target>\n" +
5579
+ "<nice-popup-content>\n" +
5580
+ "<nice-date is-inline=\"true\" inline=\"true\" model=\"model\" on-change=\"dateChanged(model)\" no-margin=\"true\"></nice-date>\n" +
5581
+ "</nice-popup-content>\n" +
5582
+ "</nice-popup>\n" +
5583
+ "</div>\n" +
5584
+ "<div class=\"input-group nice-time-input\" ng-class=\"{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }\">\n" +
5585
+ "<input type=\"text\" class=\"form-control\" ng-model=\"modelTime\" ng-blur=\"timeBlur()\" ng-disabled=\"isDisabled\">\n" +
5586
+ "<nice-popup placement=\"bottom\">\n" +
5587
+ "<nice-popup-target>\n" +
5588
+ "<button class=\"input-group-addon btn btn-default\" tabindex=\"-1\">\n" +
5589
+ "<nice-icon icon=\"icon-clock\"></nice-icon>\n" +
5590
+ "</button>\n" +
5591
+ "</nice-popup-target>\n" +
5592
+ "<nice-popup-content>\n" +
5593
+ "<div class=\"dates\">\n" +
5594
+ "<div class=\"date\"></div>\n" +
5595
+ "</div>\n" +
5596
+ "</nice-popup-content>\n" +
5597
+ "</nice-popup>\n" +
5598
+ "</div>\n" +
5599
+ "</div>\n" +
5600
+ "</div>\n" +
5601
+ "</div>"
5602
+ );
5603
+
5604
+
5466
5605
  $templateCache.put('src/components/nice-date-range/nice-date-range.html',
5467
5606
  "<ng-form class=\"nice-component nice-date-range\" ng-class=\"{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }\" name=\"form\">\n" +
5468
5607
  "<div class=\"row\">\n" +
@@ -7087,14 +7226,17 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
7087
7226
  "<nice-help class=\"nice-title-help\" ng-if=\"help\" text=\"{{ help }}\"></nice-help>\n" +
7088
7227
  "</div>\n" +
7089
7228
  "<div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\">\n" +
7090
- "<input class=\"input-file\" type=\"file\" accept=\"{{ accept }}\" ng-model=\"file\" ng-disabled=\"isDisabled\">\n" +
7229
+ "<div class=\"nice-upload-area\">\n" +
7091
7230
  "<div class=\"input-area\" ng-class=\"{ 'dragging': dragging || draggingGlobal }\">\n" +
7092
7231
  "<div class=\"middle-text\" ng-if=\"!imageSource && !loading\">\n" +
7232
+ "<nice-icon icon=\"icon-upload\"></nice-icon>\n" +
7093
7233
  "<div class=\"text text-placeholder\" ng-if=\"!dragging\">{{ text }}</div>\n" +
7094
7234
  "<div class=\"text text-placeholder\" ng-if=\"dragging\" translate translate-group=\"Nice\">Drop file here</div>\n" +
7095
7235
  "<div class=\"error\" ng-if=\"error\">{{ error }}</div>\n" +
7096
7236
  "</div>\n" +
7097
7237
  "<img ng-if=\"imageSource\" data-ng-src=\"{{ imageSource }}\">\n" +
7238
+ "</div>\n" +
7239
+ "<input class=\"input-file\" type=\"file\" accept=\"{{ accept }}\" ng-model=\"file\" ng-disabled=\"isDisabled || loading\">\n" +
7098
7240
  "<nice-loader fulldiv=\"true\" ng-if=\"loading\"></nice-loader>\n" +
7099
7241
  "</div>\n" +
7100
7242
  "</div>\n" +