nice-elements 1.8.0 → 1.8.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 +12 -0
- package/LICENSE.md +1 -1
- package/README.md +1 -1
- package/bower.json +1 -1
- package/dist/nice.js +149 -134
- package/dist/nice.min.js +1 -1
- package/dist/style.css +20 -1
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +2 -2
- package/package.json +1 -1
- package/src/components/nice-choice/nice-choice.html +1 -1
- package/src/components/nice-choice/nice-choice.js +6 -0
- package/src/components/nice-dropdown/nice-dropdown.js +1 -1
- package/src/components/nice-dropdown-date/nice-dropdown-date.js +105 -103
- package/src/components/nice-number/nice-number.js +12 -8
- package/src/components/nice-search/nice-search.html +2 -2
- package/src/components/nice-search/nice-search.js +1 -1
- package/src/components/nice-search/nice-search.scss +4 -0
- package/src/components/nice-search2/nice-search2.js +1 -0
- package/src/components/nice-time-picker/nice-time-picker.js +16 -16
- package/src/components/nice-wrapper/_nice-wrapper.scss +20 -1
- package/src/components/nice-wrapper/nice-wrapper.html +2 -2
- package/src/components/nice-wrapper/nice-wrapper.js +3 -1
- package/src/services/nice-service.js +1 -1
|
@@ -8,118 +8,120 @@
|
|
|
8
8
|
*/
|
|
9
9
|
angular.module('niceElements')
|
|
10
10
|
.directive('niceDropdownDate', function (gettextCatalog) {
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
11
|
+
return {
|
|
12
|
+
restrict: 'E',
|
|
13
|
+
replace: true,
|
|
14
|
+
templateUrl: "src/components/nice-dropdown-date/nice-dropdown-date.html",
|
|
15
|
+
scope: {
|
|
16
|
+
model: '=',
|
|
17
|
+
title: '@',
|
|
18
|
+
fieldWidth: '@',
|
|
19
|
+
labelWidth: '@',
|
|
20
|
+
noMargin: '@',
|
|
21
|
+
isDisabled: '=',
|
|
22
|
+
numYears: '@',
|
|
23
|
+
startingYear: '@',
|
|
24
|
+
mature: '@',
|
|
25
|
+
help: '@',
|
|
26
|
+
isInline: '=',
|
|
27
|
+
onChange: '&?'
|
|
28
|
+
},
|
|
29
|
+
link: function ($scope) {
|
|
30
|
+
$scope.days = [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];
|
|
31
|
+
$scope.months = [
|
|
32
|
+
{ value: 0, name: gettextCatalog.getString('Jan', null, 'Nice') },
|
|
33
|
+
{ value: 1, name: gettextCatalog.getString('Feb', null, 'Nice') },
|
|
34
|
+
{ value: 2, name: gettextCatalog.getString('Mar', null, 'Nice') },
|
|
35
|
+
{ value: 3, name: gettextCatalog.getString('Apr', null, 'Nice') },
|
|
36
|
+
{ value: 4, name: gettextCatalog.getString('May', null, 'Nice') },
|
|
37
|
+
{ value: 5, name: gettextCatalog.getString('Jun', null, 'Nice') },
|
|
38
|
+
{ value: 6, name: gettextCatalog.getString('Jul', null, 'Nice') },
|
|
39
|
+
{ value: 7, name: gettextCatalog.getString('Aug', null, 'Nice') },
|
|
40
|
+
{ value: 8, name: gettextCatalog.getString('Sep', null, 'Nice') },
|
|
41
|
+
{ value: 9, name: gettextCatalog.getString('Oct', null, 'Nice') },
|
|
42
|
+
{ value: 10, name: gettextCatalog.getString('Nov', null, 'Nice') },
|
|
43
|
+
{ value: 11, name: gettextCatalog.getString('Dec', null, 'Nice') }
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
// Set the years drop down from attributes or defaults
|
|
48
|
+
var currentYear = parseInt($scope.startingYear, 10) || new Date().getFullYear();
|
|
49
|
+
var numYears = parseInt($scope.numYears, 10) || 100;
|
|
50
|
+
var oldestYear = currentYear - numYears;
|
|
51
|
+
var newestYear = currentYear;
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
// If mature
|
|
55
|
+
if ($scope.mature) newestYear -= 17;
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
// Create years array
|
|
59
|
+
$scope.years = [];
|
|
60
|
+
for (var i = currentYear; i >= oldestYear; i--) {
|
|
61
|
+
if (i <= newestYear) {
|
|
62
|
+
$scope.years.push(i);
|
|
63
|
+
}
|
|
63
64
|
}
|
|
64
|
-
}
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
// Split the current date into sections
|
|
68
|
+
$scope.dateFields = {};
|
|
69
|
+
|
|
69
70
|
|
|
71
|
+
// Watch for model change
|
|
72
|
+
$scope.$watch('model', function (newDate, oldDate) {
|
|
73
|
+
if (newDate && newDate != oldDate) {
|
|
74
|
+
var date = moment(newDate);
|
|
75
|
+
$scope.dateFields.day = date.get('date');
|
|
76
|
+
$scope.dateFields.month = date.get('month');
|
|
77
|
+
$scope.dateFields.year = date.get('year');
|
|
78
|
+
$scope.checkDate();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
// validate that the date selected is accurate
|
|
84
|
+
$scope.checkDate = function () {
|
|
85
|
+
var date = moment($scope.dateFields.day + "." + ($scope.dateFields.month + 1) + "." + $scope.dateFields.year, "D.M.YYYY");
|
|
86
|
+
|
|
87
|
+
if (date.isValid()) {
|
|
88
|
+
// Format
|
|
89
|
+
$scope.model = date.format();
|
|
90
|
+
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
91
|
+
|
|
92
|
+
// Change dates
|
|
93
|
+
$scope.days = [];
|
|
94
|
+
for (i = 1; i <= date.daysInMonth(); i++) {
|
|
95
|
+
$scope.days.push(i);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Valid
|
|
99
|
+
if ($scope.dropdownDateForm) {
|
|
100
|
+
$scope.dropdownDateForm.$setValidity('validDate', true);
|
|
101
|
+
$scope.dropdownDateForm.$setDirty();
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
// Invalid
|
|
105
|
+
if ($scope.dropdownDateForm) $scope.dropdownDateForm.$setValidity('validDate', false);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
70
108
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (
|
|
74
|
-
var date = moment(
|
|
109
|
+
|
|
110
|
+
// Set current date
|
|
111
|
+
if (!$scope.model) {
|
|
112
|
+
var date = moment();
|
|
75
113
|
$scope.dateFields.day = date.get('date');
|
|
76
114
|
$scope.dateFields.month = date.get('month');
|
|
77
115
|
$scope.dateFields.year = date.get('year');
|
|
116
|
+
if ($scope.mature) $scope.dateFields.year -= 18;
|
|
78
117
|
$scope.checkDate();
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
// validate that the date selected is accurate
|
|
84
|
-
$scope.checkDate = function(){
|
|
85
|
-
var date = moment($scope.dateFields.day + "." + ($scope.dateFields.month + 1) + "." + $scope.dateFields.year, "D.M.YYYY");
|
|
86
|
-
|
|
87
|
-
if(date.isValid()){
|
|
88
|
-
// Format
|
|
89
|
-
$scope.model = date.format();
|
|
90
|
-
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
91
|
-
|
|
92
|
-
// Change dates
|
|
93
|
-
$scope.days = [];
|
|
94
|
-
for(i = 1; i <= date.daysInMonth(); i++){
|
|
95
|
-
$scope.days.push(i);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Valid
|
|
99
|
-
$scope.dropdownDateForm.$setValidity('validDate', true);
|
|
100
|
-
$scope.dropdownDateForm.$setDirty();
|
|
101
118
|
} else {
|
|
102
|
-
|
|
103
|
-
$scope.
|
|
119
|
+
var date = moment($scope.model);
|
|
120
|
+
$scope.dateFields.day = date.get('date');
|
|
121
|
+
$scope.dateFields.month = date.get('month');
|
|
122
|
+
$scope.dateFields.year = date.get('year');
|
|
123
|
+
$scope.checkDate();
|
|
104
124
|
}
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
// Set current date
|
|
109
|
-
if(!$scope.model){
|
|
110
|
-
var date = moment();
|
|
111
|
-
$scope.dateFields.day = date.get('date');
|
|
112
|
-
$scope.dateFields.month = date.get('month');
|
|
113
|
-
$scope.dateFields.year = date.get('year');
|
|
114
|
-
if($scope.mature) $scope.dateFields.year -= 18;
|
|
115
|
-
$scope.checkDate();
|
|
116
|
-
} else {
|
|
117
|
-
var date = moment($scope.model);
|
|
118
|
-
$scope.dateFields.day = date.get('date');
|
|
119
|
-
$scope.dateFields.month = date.get('month');
|
|
120
|
-
$scope.dateFields.year = date.get('year');
|
|
121
|
-
$scope.checkDate();
|
|
122
125
|
}
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
});
|
|
126
|
+
};
|
|
127
|
+
});
|
|
@@ -84,10 +84,12 @@ angular.module('niceElements')
|
|
|
84
84
|
|
|
85
85
|
// Check canAdd or canSubtract
|
|
86
86
|
$scope.check = function () {
|
|
87
|
-
if ($scope.
|
|
88
|
-
$scope.
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
if ($scope.niceNumberForm) {
|
|
88
|
+
if ($scope.required && ($scope.model == undefined || $scope.model == null)) {
|
|
89
|
+
$scope.niceNumberForm.$setValidity("no-value", false);
|
|
90
|
+
} else {
|
|
91
|
+
$scope.niceNumberForm.$setValidity("no-value", null);
|
|
92
|
+
}
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
if ($scope.min && parseFloat($scope.model) <= $scope.min) {
|
|
@@ -104,10 +106,12 @@ angular.module('niceElements')
|
|
|
104
106
|
$scope.canAdd = true;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
if ($scope.
|
|
108
|
-
$scope.
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
if ($scope.niceNumberForm) {
|
|
110
|
+
if ($scope.preventZero && parseFloat($scope.model) == 0) {
|
|
111
|
+
$scope.niceNumberForm.$setValidity("zero", false);
|
|
112
|
+
} else {
|
|
113
|
+
$scope.niceNumberForm.$setValidity("zero", null);
|
|
114
|
+
}
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
26
26
|
|
|
27
|
-
<div class="row">
|
|
27
|
+
<div class="row" ng-if="noResults || results.length">
|
|
28
28
|
<div ng-class="labelWidth ? labelWidth : 'col-sm-4'" ng-if="title"></div>
|
|
29
|
-
<div ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
|
|
29
|
+
<div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
|
|
30
30
|
<div class="nice-dropdown-empty" ng-if="noResults">
|
|
31
31
|
<div class="nice-search-row" translate translate-context="Nice">No results found.</div>
|
|
32
32
|
</div>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* # niceTimePicker
|
|
8
8
|
*/
|
|
9
9
|
angular.module('niceElements')
|
|
10
|
-
.directive('niceTimePicker', function() {
|
|
10
|
+
.directive('niceTimePicker', function () {
|
|
11
11
|
return {
|
|
12
12
|
scope: {
|
|
13
13
|
model: '=',
|
|
@@ -22,60 +22,60 @@ angular.module('niceElements')
|
|
|
22
22
|
},
|
|
23
23
|
restrict: 'E',
|
|
24
24
|
templateUrl: 'src/components/nice-time-picker/nice-time-picker.html',
|
|
25
|
-
link: function($scope, $element, $attrs) {
|
|
26
|
-
if(!$scope.model) $scope.model = moment();
|
|
25
|
+
link: function ($scope, $element, $attrs) {
|
|
26
|
+
if (!$scope.model) $scope.model = moment();
|
|
27
27
|
$scope.open = false;
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
$scope.close = function(){
|
|
30
|
+
$scope.close = function () {
|
|
31
31
|
$scope.open = false;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
$scope.validateDate = function(){
|
|
35
|
+
$scope.validateDate = function () {
|
|
36
36
|
$scope.checkDate($scope.modelString);
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
$scope.checkDate = function(date){
|
|
40
|
+
$scope.checkDate = function (date) {
|
|
41
41
|
var parsedDate = moment(date, "HH:mm");
|
|
42
|
-
if(parsedDate.isValid()){
|
|
43
|
-
$scope.forma.$setValidity("valid-time", true);
|
|
42
|
+
if (parsedDate.isValid()) {
|
|
43
|
+
if ($scope.forma) $scope.forma.$setValidity("valid-time", true);
|
|
44
44
|
$scope.model = parsedDate;
|
|
45
45
|
$scope.refreshTime();
|
|
46
46
|
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
47
47
|
} else {
|
|
48
|
-
$scope.forma.$setValidity("valid-time", false);
|
|
48
|
+
if ($scope.forma) $scope.forma.$setValidity("valid-time", false);
|
|
49
49
|
$scope.modelString = "";
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
$scope.refreshTime = function(){
|
|
54
|
+
$scope.refreshTime = function () {
|
|
55
55
|
$scope.hours = $scope.model.format("HH");
|
|
56
56
|
$scope.minutes = $scope.model.format("mm");
|
|
57
57
|
$scope.modelString = $scope.model.format("HH:mm");
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
$scope.changeHour = function(add){
|
|
62
|
-
if(add) $scope.model.add(1, 'hour');
|
|
61
|
+
$scope.changeHour = function (add) {
|
|
62
|
+
if (add) $scope.model.add(1, 'hour');
|
|
63
63
|
else $scope.model.subtract(1, 'hour');
|
|
64
64
|
$scope.refreshTime();
|
|
65
65
|
$scope.forma.$setDirty();
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
$scope.changeMinutes = function(add){
|
|
69
|
-
if(add) $scope.model.add(1, 'minutes');
|
|
68
|
+
$scope.changeMinutes = function (add) {
|
|
69
|
+
if (add) $scope.model.add(1, 'minutes');
|
|
70
70
|
else $scope.model.subtract(1, 'minutes');
|
|
71
71
|
$scope.refreshTime();
|
|
72
72
|
$scope.forma.$setDirty();
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
|
|
76
|
-
$scope.$watch("model", function(value, oldValue){
|
|
76
|
+
$scope.$watch("model", function (value, oldValue) {
|
|
77
77
|
$scope.refreshTime();
|
|
78
|
-
if(!value.isSame(oldValue)){
|
|
78
|
+
if (!value.isSame(oldValue)) {
|
|
79
79
|
$scope.checkDate(value);
|
|
80
80
|
}
|
|
81
81
|
})
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
|
|
32
32
|
.nice-wrapper-title {
|
|
33
33
|
font-size: 1.2em;
|
|
34
|
-
font-weight: bold;
|
|
35
34
|
line-height: 1.2;
|
|
36
35
|
color: var(--nice-primary-color);
|
|
37
36
|
}
|
|
@@ -66,4 +65,24 @@
|
|
|
66
65
|
padding-bottom: 0;
|
|
67
66
|
}
|
|
68
67
|
}
|
|
68
|
+
|
|
69
|
+
&.nice-wrapper-sticky-footer {
|
|
70
|
+
.nice-wrapper-footer {
|
|
71
|
+
position: sticky;
|
|
72
|
+
bottom: calc(-1 * var(--nice-card-padding));
|
|
73
|
+
background: var(--nice-card-bg);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&.nice-wrapper-sticky-header {
|
|
78
|
+
.nice-wrapper-header {
|
|
79
|
+
position: sticky;
|
|
80
|
+
top: calc(-1 * var(--nice-card-padding));
|
|
81
|
+
background: var(--nice-card-bg);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.no-padding {
|
|
86
|
+
padding: 0;
|
|
87
|
+
}
|
|
69
88
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div class="nice-wrapper" ng-class="{ 'collapsable': collapsable, 'has-header': hasHeader, 'has-footer': hasFooter }">
|
|
1
|
+
<div class="nice-wrapper" ng-class="{ 'collapsable': collapsable, 'has-header': hasHeader, 'has-footer': hasFooter, 'nice-wrapper-sticky-footer': stickyFooter, 'nice-wrapper-sticky-header': stickyHeader }">
|
|
2
2
|
<div class="nice-wrapper-header" ng-if="hasHeader" ng-click="toggle()">
|
|
3
3
|
<div class="nice-wrapper-info">
|
|
4
4
|
<div class="nice-wrapper-title" ng-transclude="title">{{ title }}</div>
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
<nice-icon icon="icon-chevron-down"></nice-icon>
|
|
9
9
|
</button>
|
|
10
10
|
</div>
|
|
11
|
-
<div class="nice-wrapper-body" ng-transclude ng-if="isOpen"></div>
|
|
11
|
+
<div class="nice-wrapper-body" ng-class=" {'no-padding': noPadding }" ng-transclude ng-if="isOpen"></div>
|
|
12
12
|
<div class="nice-wrapper-footer" ng-if="isOpen && hasFooter" ng-transclude="footer"></div>
|
|
13
13
|
</div>
|
|
@@ -22,11 +22,13 @@ angular.module('niceElements')
|
|
|
22
22
|
subtitle: '@',
|
|
23
23
|
collapsable: '=',
|
|
24
24
|
collapsed: '@',
|
|
25
|
+
noPadding: '@',
|
|
26
|
+
stickyHeader: '@',
|
|
27
|
+
stickyFooter: '@',
|
|
25
28
|
},
|
|
26
29
|
controller: function ($scope, $transclude) {
|
|
27
30
|
$scope.isOpen = true;
|
|
28
31
|
if ($scope.collapsed) $scope.isOpen = false;
|
|
29
|
-
|
|
30
32
|
$scope.hasTitle = $transclude.isSlotFilled('title');
|
|
31
33
|
$scope.hasSubtitle = $transclude.isSlotFilled('subtitle');
|
|
32
34
|
$scope.hasFooter = $transclude.isSlotFilled('footer');
|