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.
- package/.vscode/settings.json +1 -1
- package/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/bower.json +1 -1
- package/dist/nice.js +69 -53
- package/dist/nice.min.js +1 -1
- package/package.json +1 -1
- package/src/components/nice-date/nice-date.js +3 -3
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html +2 -3
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +45 -36
- package/src/components/nice-dropdown/nice-dropdown.js +13 -7
- package/src/components/nice-search2/nice-search2.js +6 -5
package/package.json
CHANGED
|
@@ -65,7 +65,7 @@ angular.module('niceElements')
|
|
|
65
65
|
$scope.years.push(year + i);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
$scope.months =
|
|
68
|
+
$scope.months = [
|
|
69
69
|
{ value: 0, name: gettextCatalog.getString("January", null, "Nice") },
|
|
70
70
|
{ value: 1, name: gettextCatalog.getString("February", null, "Nice") },
|
|
71
71
|
{ value: 2, name: gettextCatalog.getString("March", null, "Nice") },
|
|
@@ -110,7 +110,7 @@ angular.module('niceElements')
|
|
|
110
110
|
});
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
$timeout(function() {
|
|
113
|
+
$timeout(function () {
|
|
114
114
|
if (!$scope.inline) $scope.setupPopper();
|
|
115
115
|
});
|
|
116
116
|
|
|
@@ -301,7 +301,7 @@ angular.module('niceElements')
|
|
|
301
301
|
|
|
302
302
|
|
|
303
303
|
// ------------------ Bootstrap ------------------
|
|
304
|
-
$scope.boostrap = function(){
|
|
304
|
+
$scope.boostrap = function() {
|
|
305
305
|
$scope.setInnerDate(moment($scope.model));
|
|
306
306
|
$scope.getTime();
|
|
307
307
|
|
|
@@ -32,13 +32,12 @@
|
|
|
32
32
|
</div>
|
|
33
33
|
</div>
|
|
34
34
|
|
|
35
|
-
|
|
36
35
|
<div class="dtp-left">
|
|
37
|
-
<nice-date model="innerStartDate" next-date="innerEndDate"
|
|
36
|
+
<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>
|
|
38
37
|
</div>
|
|
39
38
|
|
|
40
39
|
<div class="dtp-right">
|
|
41
|
-
<nice-date model="innerEndDate" next-date="innerStartDate"
|
|
40
|
+
<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>
|
|
42
41
|
</div>
|
|
43
42
|
</div>
|
|
44
43
|
</div>
|
|
@@ -27,8 +27,12 @@ angular.module('niceElements')
|
|
|
27
27
|
onChange: '&?'
|
|
28
28
|
},
|
|
29
29
|
templateUrl: 'src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html',
|
|
30
|
-
controller: function ($element, $scope) {
|
|
30
|
+
controller: function ($element, $timeout, $scope) {
|
|
31
31
|
$scope.isOpen = false;
|
|
32
|
+
$scope.model = {
|
|
33
|
+
innerStartDate: null,
|
|
34
|
+
innerEndDate: null,
|
|
35
|
+
}
|
|
32
36
|
|
|
33
37
|
|
|
34
38
|
// Set defaults
|
|
@@ -46,14 +50,14 @@ angular.module('niceElements')
|
|
|
46
50
|
if(!$scope.startDate) {
|
|
47
51
|
$scope.startDate = moment();
|
|
48
52
|
} else {
|
|
49
|
-
$scope.innerStartDate = angular.copy($scope.startDate);
|
|
53
|
+
$scope.model.innerStartDate = angular.copy($scope.startDate);
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
// Set end date
|
|
53
57
|
if(!$scope.endDate) {
|
|
54
58
|
$scope.endDate = moment();
|
|
55
59
|
} else {
|
|
56
|
-
$scope.innerEndDate = angular.copy($scope.endDate);
|
|
60
|
+
$scope.model.innerEndDate = angular.copy($scope.endDate);
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
|
|
@@ -75,7 +79,10 @@ angular.module('niceElements')
|
|
|
75
79
|
],
|
|
76
80
|
});
|
|
77
81
|
};
|
|
78
|
-
|
|
82
|
+
|
|
83
|
+
$timeout(function () {
|
|
84
|
+
$scope.setupPopper();
|
|
85
|
+
});
|
|
79
86
|
|
|
80
87
|
|
|
81
88
|
$scope.format = function(){
|
|
@@ -92,41 +99,41 @@ angular.module('niceElements')
|
|
|
92
99
|
|
|
93
100
|
|
|
94
101
|
$scope.close = function() {
|
|
95
|
-
$scope.innerStartDate = angular.copy($scope.startDate);
|
|
96
|
-
$scope.innerEndDate = angular.copy($scope.endDate);
|
|
102
|
+
$scope.model.innerStartDate = angular.copy($scope.startDate);
|
|
103
|
+
$scope.model.innerEndDate = angular.copy($scope.endDate);
|
|
97
104
|
$scope.isOpen = false;
|
|
98
105
|
};
|
|
99
106
|
|
|
100
107
|
|
|
101
108
|
$scope.confirm = function() {
|
|
102
|
-
$scope.startDate = angular.copy($scope.innerStartDate);
|
|
103
|
-
$scope.endDate = angular.copy($scope.innerEndDate);
|
|
104
|
-
if ($scope.onChange) $scope.onChange({
|
|
105
|
-
$scope.
|
|
109
|
+
$scope.startDate = angular.copy($scope.model.innerStartDate);
|
|
110
|
+
$scope.endDate = angular.copy($scope.model.innerEndDate);
|
|
111
|
+
if ($scope.onChange) $scope.onChange({ startDate: $scope.startDate, endDate: $scope.endDate });
|
|
112
|
+
$scope.isOpen = false;
|
|
106
113
|
};
|
|
107
114
|
|
|
108
115
|
|
|
109
116
|
$scope.selectToday = function(){
|
|
110
|
-
$scope.innerStartDate = moment().startOf('day');
|
|
111
|
-
$scope.innerEndDate = moment().endOf('day');
|
|
117
|
+
$scope.model.innerStartDate = moment().startOf('day');
|
|
118
|
+
$scope.model.innerEndDate = moment().endOf('day');
|
|
112
119
|
};
|
|
113
120
|
|
|
114
121
|
|
|
115
122
|
$scope.selectLastNDays = function(days){
|
|
116
|
-
$scope.innerStartDate = moment().subtract(days, 'days').startOf('day');
|
|
117
|
-
$scope.innerEndDate = moment().endOf('day');
|
|
123
|
+
$scope.model.innerStartDate = moment().subtract(days, 'days').startOf('day');
|
|
124
|
+
$scope.model.innerEndDate = moment().endOf('day');
|
|
118
125
|
};
|
|
119
126
|
|
|
120
127
|
|
|
121
128
|
$scope.selectLastMonth = function(){
|
|
122
|
-
$scope.innerStartDate = moment().subtract(1, 'months').startOf('month').startOf('date');
|
|
123
|
-
$scope.innerEndDate = moment().subtract(1, 'months').endOf('month').endOf('date');
|
|
129
|
+
$scope.model.innerStartDate = moment().subtract(1, 'months').startOf('month').startOf('date');
|
|
130
|
+
$scope.model.innerEndDate = moment().subtract(1, 'months').endOf('month').endOf('date');
|
|
124
131
|
};
|
|
125
132
|
|
|
126
133
|
|
|
127
134
|
$scope.selectThisMonth = function(){
|
|
128
|
-
$scope.innerStartDate = moment().startOf('month').startOf('date');
|
|
129
|
-
$scope.innerEndDate = moment().endOf('month').endOf('date');
|
|
135
|
+
$scope.model.innerStartDate = moment().startOf('month').startOf('date');
|
|
136
|
+
$scope.model.innerEndDate = moment().endOf('month').endOf('date');
|
|
130
137
|
};
|
|
131
138
|
|
|
132
139
|
|
|
@@ -136,28 +143,30 @@ angular.module('niceElements')
|
|
|
136
143
|
};
|
|
137
144
|
|
|
138
145
|
|
|
139
|
-
$scope
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
$scope.dateChanged = function() {
|
|
147
|
+
$timeout(function() {
|
|
148
|
+
if ($scope.model.innerStartDate && $scope.model.innerEndDate) {
|
|
149
|
+
// Check if start date is after end date
|
|
150
|
+
if ($scope.model.innerStartDate.isAfter($scope.model.innerEndDate)) {
|
|
151
|
+
var temp = angular.copy($scope.model.innerStartDate);
|
|
152
|
+
$scope.model.innerStartDate = angular.copy($scope.model.innerEndDate);
|
|
153
|
+
$scope.model.innerEndDate = temp;
|
|
154
|
+
}
|
|
147
155
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
156
|
+
// Check if end date is before start date
|
|
157
|
+
if ($scope.model.innerEndDate.isBefore($scope.model.innerStartDate)) {
|
|
158
|
+
var temp = angular.copy($scope.model.innerStartDate);
|
|
159
|
+
$scope.model.innerStartDate = angular.copy($scope.model.innerEndDate);
|
|
160
|
+
$scope.model.innerEndDate = temp;
|
|
161
|
+
}
|
|
153
162
|
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
156
165
|
|
|
157
166
|
|
|
158
|
-
$scope.$watchGroup(["startDate", "endDate"], function(){
|
|
159
|
-
$scope.innerStartDate = angular.copy($scope.startDate);
|
|
160
|
-
$scope.innerEndDate = angular.copy($scope.endDate);
|
|
167
|
+
$scope.$watchGroup(["startDate", "endDate"], function() {
|
|
168
|
+
$scope.model.innerStartDate = angular.copy($scope.startDate);
|
|
169
|
+
$scope.model.innerEndDate = angular.copy($scope.endDate);
|
|
161
170
|
$scope.format();
|
|
162
171
|
});
|
|
163
172
|
}
|
|
@@ -91,19 +91,20 @@ angular.module('niceElements')
|
|
|
91
91
|
requires: ["computeStyles"],
|
|
92
92
|
fn: function(e) {
|
|
93
93
|
var state = e.state;
|
|
94
|
-
state.styles.popper.width =
|
|
94
|
+
state.styles.popper.width = state.rects.reference.width + "px";
|
|
95
95
|
},
|
|
96
96
|
effect: function(e) {
|
|
97
97
|
var state = e.state;
|
|
98
|
-
state.elements.popper.style.width =
|
|
99
|
-
state.elements.reference.offsetWidth
|
|
100
|
-
}px`;
|
|
98
|
+
state.elements.popper.style.width = state.elements.reference.offsetWidth + "px";
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
],
|
|
104
102
|
});
|
|
105
103
|
};
|
|
106
|
-
|
|
104
|
+
|
|
105
|
+
$timeout(function () {
|
|
106
|
+
$scope.setupPopper();
|
|
107
|
+
});
|
|
107
108
|
|
|
108
109
|
// -----------------------------------Open -----------------------------------
|
|
109
110
|
$scope.toggle = function () {
|
|
@@ -119,9 +120,14 @@ angular.module('niceElements')
|
|
|
119
120
|
};
|
|
120
121
|
|
|
121
122
|
$scope.open = function () {
|
|
122
|
-
$scope.
|
|
123
|
+
$scope.popper.update();
|
|
124
|
+
$timeout(function () {
|
|
125
|
+
$scope.isOpen = true;
|
|
126
|
+
$timeout(function () {
|
|
127
|
+
$scope.popper.update();
|
|
128
|
+
});
|
|
129
|
+
});
|
|
123
130
|
$timeout(function () {
|
|
124
|
-
$scope.popper.update();
|
|
125
131
|
$scope.focusInput();
|
|
126
132
|
$scope.scrollToHover(true);
|
|
127
133
|
}, 100);
|
|
@@ -64,19 +64,20 @@ angular.module('niceElements')
|
|
|
64
64
|
requires: ["computeStyles"],
|
|
65
65
|
fn: function(e) {
|
|
66
66
|
var state = e.state;
|
|
67
|
-
state.styles.popper.width =
|
|
67
|
+
state.styles.popper.width = state.rects.reference.width + "px";
|
|
68
68
|
},
|
|
69
69
|
effect: function(e) {
|
|
70
70
|
var state = e.state;
|
|
71
|
-
state.elements.popper.style.width =
|
|
72
|
-
state.elements.reference.offsetWidth
|
|
73
|
-
}px`;
|
|
71
|
+
state.elements.popper.style.width = state.elements.reference.offsetWidth + "px";
|
|
74
72
|
}
|
|
75
73
|
}
|
|
76
74
|
],
|
|
77
75
|
});
|
|
78
76
|
};
|
|
79
|
-
|
|
77
|
+
|
|
78
|
+
$timeout(function () {
|
|
79
|
+
$scope.setupPopper();
|
|
80
|
+
})
|
|
80
81
|
|
|
81
82
|
// ------------------- On focus -------------------
|
|
82
83
|
$scope.onFocus = function() {
|