nice-elements 1.6.1 → 1.7.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 +12 -1
- package/README.md +1 -1
- package/bower.json +1 -1
- package/dist/nice.js +318 -161
- package/dist/nice.min.js +1 -1
- package/dist/style.css +262 -114
- package/dist/style.css.map +3 -2
- package/dist/style.min.css +2 -2
- package/package.json +1 -1
- package/src/components/nice-calendar/nice-calendar.html +3 -2
- package/src/components/nice-calendar/nice-calendar.scss +9 -5
- package/src/components/nice-checkbox/nice-checkbox.html +1 -3
- package/src/components/nice-checkbox/nice-checkbox.scss +12 -12
- package/src/components/nice-choice/nice-choice.html +3 -1
- package/src/components/nice-choice/nice-choice.scss +14 -3
- package/src/components/nice-date/nice-date.html +5 -4
- package/src/components/nice-date/nice-date.js +50 -52
- package/src/components/nice-date/nice-date.scss +29 -6
- package/src/components/nice-date-input/nice-date-input.html +41 -0
- package/src/components/nice-date-input/nice-date-input.js +97 -0
- package/src/components/nice-date-input/nice-date-input.scss +49 -0
- package/src/components/nice-date-range/nice-date-range.html +3 -1
- package/src/components/nice-datetime-picker/nice-datetime-picker.html +5 -19
- package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.html +6 -1
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html +5 -3
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +25 -26
- package/src/components/nice-dropdown/nice-dropdown.html +3 -1
- package/src/components/nice-dropdown/nice-dropdown.scss +1 -0
- package/src/components/nice-dtp/nice-dtp.html +12 -12
- package/src/components/nice-help/nice-help.html +2 -1
- package/src/components/nice-help/nice-help.scss +7 -0
- package/src/components/nice-input/nice-input.html +9 -42
- package/src/components/nice-input/nice-input.js +28 -28
- package/src/components/nice-input/nice-input.scss +27 -20
- package/src/components/nice-number/nice-number.html +6 -2
- package/src/components/nice-number/nice-number.scss +15 -3
- package/src/components/nice-quantity/nice-quantity.html +6 -2
- package/src/components/nice-quantity/nice-quantity.scss +11 -0
- package/src/components/nice-search/nice-search.html +9 -20
- package/src/components/nice-search2/nice-search2.html +4 -2
- package/src/components/nice-time-picker/nice-time-picker.html +21 -27
- package/src/components/nice-time-picker/nice-time-picker.scss +11 -32
- package/src/components/nice-upload/nice-upload.html +10 -7
- package/src/components/nice-upload/nice-upload.scss +26 -31
- package/src/components/nice-yesno/nice-yesno.html +2 -2
- package/src/components/nice-yesno/nice-yesno.scss +13 -0
- package/src/styles/_nice-buttons.scss +22 -9
- package/src/styles/_nice-common.scss +57 -13
- package/src/styles/_nice.scss +2 -1
- package/src/styles/_variables.scss +3 -0
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
* # niceDatetimerangePicker2
|
|
8
8
|
*/
|
|
9
9
|
angular.module('niceElements')
|
|
10
|
-
.directive('niceDatetimerangePicker2', function() {
|
|
10
|
+
.directive('niceDatetimerangePicker2', function () {
|
|
11
11
|
return {
|
|
12
12
|
scope: {
|
|
13
13
|
startDate: '=', // binding model
|
|
14
14
|
endDate: '=', // binding model
|
|
15
15
|
formatString: '@', // default: 'D.M.YYYY • H:mm', format for input label string
|
|
16
16
|
modelFormat: '@',
|
|
17
|
-
time: '
|
|
17
|
+
time: '=', // default: false, is time picker enabled?
|
|
18
18
|
minDate: '@', // default: undefined
|
|
19
19
|
maxDate: '@', // default: undefined
|
|
20
20
|
title: '@', // default: ''
|
|
@@ -36,25 +36,24 @@ angular.module('niceElements')
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
// Set defaults
|
|
39
|
-
if(
|
|
40
|
-
else $scope.time = $scope.time == "true";
|
|
39
|
+
if ($scope.time == undefined) $scope.time = false;
|
|
41
40
|
|
|
42
41
|
|
|
43
42
|
// Set format string
|
|
44
|
-
if(!$scope.formatString) {
|
|
45
|
-
if($scope.time) $scope.formatString = 'D.M.YYYY • H:mm';
|
|
43
|
+
if (!$scope.formatString) {
|
|
44
|
+
if ($scope.time) $scope.formatString = 'D.M.YYYY • H:mm';
|
|
46
45
|
else $scope.formatString = 'D.M.YYYY';
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
// Set start date
|
|
50
|
-
if(!$scope.startDate) {
|
|
49
|
+
if (!$scope.startDate) {
|
|
51
50
|
$scope.startDate = moment();
|
|
52
51
|
} else {
|
|
53
52
|
$scope.model.innerStartDate = angular.copy($scope.startDate);
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
// Set end date
|
|
57
|
-
if(!$scope.endDate) {
|
|
56
|
+
if (!$scope.endDate) {
|
|
58
57
|
$scope.endDate = moment();
|
|
59
58
|
} else {
|
|
60
59
|
$scope.model.innerEndDate = angular.copy($scope.endDate);
|
|
@@ -63,7 +62,7 @@ angular.module('niceElements')
|
|
|
63
62
|
|
|
64
63
|
// Setup popper
|
|
65
64
|
// https://popper.js.org/docs/v2/constructors/
|
|
66
|
-
$scope.setupPopper = function() {
|
|
65
|
+
$scope.setupPopper = function () {
|
|
67
66
|
var button = $element[0].getElementsByClassName('nice-daterange-picker-button')[0];
|
|
68
67
|
var tooltip = $element[0].getElementsByClassName('nice-daterange-picker-wrapper')[0];
|
|
69
68
|
$scope.popper = Popper.createPopper(button, tooltip, {
|
|
@@ -79,18 +78,18 @@ angular.module('niceElements')
|
|
|
79
78
|
],
|
|
80
79
|
});
|
|
81
80
|
};
|
|
82
|
-
|
|
81
|
+
|
|
83
82
|
$timeout(function () {
|
|
84
83
|
$scope.setupPopper();
|
|
85
84
|
});
|
|
86
85
|
|
|
87
86
|
|
|
88
|
-
$scope.format = function(){
|
|
87
|
+
$scope.format = function () {
|
|
89
88
|
$scope.modelFormat = $scope.startDate.format($scope.formatString) + " - " + $scope.endDate.format($scope.formatString);
|
|
90
89
|
};
|
|
91
90
|
|
|
92
91
|
|
|
93
|
-
$scope.open = function() {
|
|
92
|
+
$scope.open = function () {
|
|
94
93
|
if (!$scope.isDisabled) {
|
|
95
94
|
$scope.isOpen = true;
|
|
96
95
|
$scope.popper.update();
|
|
@@ -98,14 +97,14 @@ angular.module('niceElements')
|
|
|
98
97
|
};
|
|
99
98
|
|
|
100
99
|
|
|
101
|
-
$scope.close = function() {
|
|
100
|
+
$scope.close = function () {
|
|
102
101
|
$scope.model.innerStartDate = angular.copy($scope.startDate);
|
|
103
102
|
$scope.model.innerEndDate = angular.copy($scope.endDate);
|
|
104
103
|
$scope.isOpen = false;
|
|
105
104
|
};
|
|
106
105
|
|
|
107
106
|
|
|
108
|
-
$scope.confirm = function() {
|
|
107
|
+
$scope.confirm = function () {
|
|
109
108
|
$scope.startDate = angular.copy($scope.model.innerStartDate);
|
|
110
109
|
$scope.endDate = angular.copy($scope.model.innerEndDate);
|
|
111
110
|
if ($scope.onChange) $scope.onChange({ startDate: $scope.startDate, endDate: $scope.endDate });
|
|
@@ -113,58 +112,58 @@ angular.module('niceElements')
|
|
|
113
112
|
};
|
|
114
113
|
|
|
115
114
|
|
|
116
|
-
$scope.selectToday = function(){
|
|
115
|
+
$scope.selectToday = function () {
|
|
117
116
|
$scope.model.innerStartDate = moment().startOf('day');
|
|
118
117
|
$scope.model.innerEndDate = moment().endOf('day');
|
|
119
118
|
};
|
|
120
119
|
|
|
121
120
|
|
|
122
|
-
$scope.selectLastNDays = function(days){
|
|
121
|
+
$scope.selectLastNDays = function (days) {
|
|
123
122
|
$scope.model.innerStartDate = moment().subtract(days, 'days').startOf('day');
|
|
124
123
|
$scope.model.innerEndDate = moment().endOf('day');
|
|
125
124
|
};
|
|
126
125
|
|
|
127
126
|
|
|
128
|
-
$scope.selectLastMonth = function(){
|
|
127
|
+
$scope.selectLastMonth = function () {
|
|
129
128
|
$scope.model.innerStartDate = moment().subtract(1, 'months').startOf('month').startOf('date');
|
|
130
129
|
$scope.model.innerEndDate = moment().subtract(1, 'months').endOf('month').endOf('date');
|
|
131
130
|
};
|
|
132
131
|
|
|
133
132
|
|
|
134
|
-
$scope.selectThisMonth = function(){
|
|
133
|
+
$scope.selectThisMonth = function () {
|
|
135
134
|
$scope.model.innerStartDate = moment().startOf('month').startOf('date');
|
|
136
135
|
$scope.model.innerEndDate = moment().endOf('month').endOf('date');
|
|
137
136
|
};
|
|
138
137
|
|
|
139
138
|
|
|
140
139
|
// ------------------ Remove time from date ------------------
|
|
141
|
-
$scope._removeTime = function(date) {
|
|
140
|
+
$scope._removeTime = function (date) {
|
|
142
141
|
return date.hour(0).minute(0).second(0).millisecond(0);
|
|
143
142
|
};
|
|
144
143
|
|
|
145
144
|
|
|
146
|
-
$scope.dateChanged = function() {
|
|
147
|
-
$timeout(function() {
|
|
145
|
+
$scope.dateChanged = function () {
|
|
146
|
+
$timeout(function () {
|
|
148
147
|
if ($scope.model.innerStartDate && $scope.model.innerEndDate) {
|
|
149
148
|
// Check if start date is after end date
|
|
150
149
|
if ($scope.model.innerStartDate.isAfter($scope.model.innerEndDate)) {
|
|
151
150
|
var temp = angular.copy($scope.model.innerStartDate);
|
|
152
|
-
$scope.model.innerStartDate = angular.copy($scope.model.innerEndDate);
|
|
153
|
-
$scope.model.innerEndDate = temp;
|
|
151
|
+
$scope.model.innerStartDate = angular.copy($scope.model.innerEndDate);
|
|
152
|
+
$scope.model.innerEndDate = temp;
|
|
154
153
|
}
|
|
155
154
|
|
|
156
155
|
// Check if end date is before start date
|
|
157
156
|
if ($scope.model.innerEndDate.isBefore($scope.model.innerStartDate)) {
|
|
158
157
|
var temp = angular.copy($scope.model.innerStartDate);
|
|
159
|
-
$scope.model.innerStartDate = angular.copy($scope.model.innerEndDate);
|
|
160
|
-
$scope.model.innerEndDate = temp;
|
|
158
|
+
$scope.model.innerStartDate = angular.copy($scope.model.innerEndDate);
|
|
159
|
+
$scope.model.innerEndDate = temp;
|
|
161
160
|
}
|
|
162
161
|
}
|
|
163
162
|
});
|
|
164
163
|
}
|
|
165
164
|
|
|
166
165
|
|
|
167
|
-
$scope.$watchGroup(["startDate", "endDate"], function() {
|
|
166
|
+
$scope.$watchGroup(["startDate", "endDate"], function () {
|
|
168
167
|
$scope.model.innerStartDate = angular.copy($scope.startDate);
|
|
169
168
|
$scope.model.innerEndDate = angular.copy($scope.endDate);
|
|
170
169
|
$scope.format();
|
|
@@ -52,7 +52,9 @@
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
<!------------------------- Add button ------------------------->
|
|
55
|
-
<button class="btn btn-primary add-btn" type="button" ng-if="addButtonFunction && !isDisabled" ng-click="addButtonFunction()"
|
|
55
|
+
<button class="btn btn-primary btn-icon add-btn" type="button" ng-if="addButtonFunction && !isDisabled" ng-click="addButtonFunction()">
|
|
56
|
+
<nice-icon icon="icon-plus"></nice-icon>
|
|
57
|
+
</button>
|
|
56
58
|
</div>
|
|
57
59
|
</div>
|
|
58
60
|
</div>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<div class="dtp-actual-num" ng-click="initDate()">{{actualNum}}</div>
|
|
21
21
|
<div>
|
|
22
22
|
<div class="left center p10">
|
|
23
|
-
<a href="javascript:void(0);" class="dtp-select-year-before" ng-click="onYearBeforeClick()" ng-class="{'disabled': !btnYearBeforeEnabled}""><i class="fa fa-chevron-left"></i></a>
|
|
23
|
+
<a href="javascript:void(0);" class="dtp-select-year-before" ng-click="onYearBeforeClick()" ng-class="{'disabled': !btnYearBeforeEnabled}""><i class=" fa fa-chevron-left"></i></a>
|
|
24
24
|
</div>
|
|
25
25
|
<div class="dtp-actual-year p80" ng-click="initDate()">{{actualYear}}</div>
|
|
26
26
|
<div class="right center p10">
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
|
|
49
49
|
<table class="table dtp-picker-days">
|
|
50
50
|
<thead>
|
|
51
|
-
|
|
51
|
+
<th ng-repeat="weekDay in weekDays track by $index">{{weekDay}}</th>
|
|
52
52
|
</thead>
|
|
53
53
|
<tbody>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
<tr ng-repeat="week in weeks">
|
|
55
|
+
<td ng-repeat="day in week">
|
|
56
|
+
<span ng-if="day.disabled" class="dtp-select-day">{{day.label}}</span>
|
|
57
|
+
<a ng-if="!day.disabled" ng-click="onSelectDate(day)" href="javascript:void(0);" class="dtp-select-day" ng-class="{'selected': day.selected}">{{day.label}}</a>
|
|
58
|
+
</td>
|
|
59
|
+
</tr>
|
|
60
60
|
</tbody>
|
|
61
61
|
</table>
|
|
62
62
|
|
|
@@ -83,10 +83,10 @@
|
|
|
83
83
|
</div>
|
|
84
84
|
</div>
|
|
85
85
|
<!--<div class="dtp-buttons" ng-if="enableOkButtons">-->
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
<!--<button class="dtp-btn-cancel btn btn-flat" ng-click="onCancelClick()">{{cancelText}}</button>-->
|
|
87
|
+
<!--<button class="dtp-btn-ok btn btn-flat" ng-click="onOKClick()"> {{okText}} </button>-->
|
|
88
|
+
<!--<div class="clearfix"></div>-->
|
|
89
89
|
<!--</div>-->
|
|
90
90
|
</div>
|
|
91
91
|
</div>
|
|
92
|
-
</div>
|
|
92
|
+
</div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<div class="nice-help" ng-mouseover="onHover()">
|
|
2
|
-
<i class="fa fa-question-circle nice-help-button" aria-label=""></i>
|
|
2
|
+
<!-- <i class="fa fa-question-circle nice-help-button" aria-label=""></i> -->
|
|
3
|
+
<nice-icon icon="icon-help-circle" class="nice-help-button"></nice-icon>
|
|
3
4
|
<div class="nice-help-popup">
|
|
4
5
|
<span ng-bind-html="text">{{ text }}</span>
|
|
5
6
|
<div data-popper-arrow class="nice-help-arrow"></div>
|
|
@@ -8,51 +8,16 @@
|
|
|
8
8
|
|
|
9
9
|
<!------------------------- Field ------------------------->
|
|
10
10
|
<div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
|
|
11
|
-
<div
|
|
12
|
-
class="form-group"
|
|
13
|
-
ng-class="{
|
|
11
|
+
<div class="form-group" ng-class="{
|
|
14
12
|
'has-feedback': showValid && !hideValid,
|
|
15
13
|
'has-warning': !isDisabled && forma.$invalid && forma.$dirty && !hideValid,
|
|
16
14
|
'has-success': !isDisabled && forma.$valid && forma.$dirty && showValid,
|
|
17
15
|
'symbol': symbol,
|
|
18
16
|
'nice-disabled': isDisabled
|
|
19
|
-
}"
|
|
20
|
-
|
|
21
|
-
<textarea
|
|
22
|
-
|
|
23
|
-
class="form-control"
|
|
24
|
-
ng-model="model"
|
|
25
|
-
id="{{ id }}"
|
|
26
|
-
tabindex="{{ tabIndex }}"
|
|
27
|
-
placeholder="{{ placeholder }}"
|
|
28
|
-
rows="{{textAreaLines}}"
|
|
29
|
-
max="{{ max }}"
|
|
30
|
-
min="{{ min }}"
|
|
31
|
-
ng-minlength="minlength"
|
|
32
|
-
ng-maxlength="maxlength"
|
|
33
|
-
ng-required="required"
|
|
34
|
-
ng-pattern="regexexp"
|
|
35
|
-
ng-disabled="isDisabled"
|
|
36
|
-
></textarea>
|
|
37
|
-
|
|
38
|
-
<input
|
|
39
|
-
ng-show="!textArea"
|
|
40
|
-
class="form-control"
|
|
41
|
-
type="{{ internalType }}"
|
|
42
|
-
ng-model="model"
|
|
43
|
-
name="{{ name }}"
|
|
44
|
-
id="{{ id }}"
|
|
45
|
-
tabindex="{{ tabIndex }}"
|
|
46
|
-
placeholder="{{ placeholder }}"
|
|
47
|
-
max="{{ max }}"
|
|
48
|
-
min="{{ min }}"
|
|
49
|
-
ng-minlength="minlength"
|
|
50
|
-
ng-maxlength="maxlength"
|
|
51
|
-
ng-required="required"
|
|
52
|
-
ng-keypress="keypress($event)"
|
|
53
|
-
ng-pattern="regexexp"
|
|
54
|
-
ng-disabled="isDisabled"
|
|
55
|
-
/>
|
|
17
|
+
}">
|
|
18
|
+
|
|
19
|
+
<textarea ng-show="textArea" class="form-control" ng-model="model" id="{{ id }}" tabindex="{{ tabIndex }}" placeholder="{{ placeholder }}" rows="{{textAreaLines}}" max="{{ max }}" min="{{ min }}" ng-minlength="minlength" ng-maxlength="maxlength" ng-required="required" ng-pattern="regexexp" ng-disabled="isDisabled"></textarea>
|
|
20
|
+
<input ng-show="!textArea" class="form-control" type="{{ internalType }}" ng-model="model" name="{{ name }}" id="{{ id }}" tabindex="{{ tabIndex }}" placeholder="{{ placeholder }}" max="{{ max }}" min="{{ min }}" ng-minlength="minlength" ng-maxlength="maxlength" ng-required="required" ng-keypress="keypress($event)" ng-pattern="regexexp" ng-disabled="isDisabled" />
|
|
56
21
|
|
|
57
22
|
<span class="input-group-addon" ng-if="symbol">{{ symbol }}</span>
|
|
58
23
|
<!--<span ng-if="!disabled && showValid && form.$valid && form.$dirty" class="glyphicon glyphicon-ok form-control-feedback feedback-valid" aria-hidden="true"></span>-->
|
|
@@ -62,7 +27,9 @@
|
|
|
62
27
|
<div ng-if="forma.$error && forma.$dirty">
|
|
63
28
|
<div class="error-message" ng-if="forma.$dirty && forma.$error.email" translate translate-context="Nice">Email is not valid.</div>
|
|
64
29
|
<div class="error-message" ng-if="forma.$dirty && forma.$error.pattern" translate translate-context="Nice">This field requires a specific pattern.</div>
|
|
65
|
-
<div class="error-message" ng-if="forma.$error.minlength"
|
|
30
|
+
<div class="error-message" ng-if="forma.$error.minlength">
|
|
31
|
+
<translate translate-context="Nice">Your input is too short. It must contain at least</translate> {{ minlength }} <translate translate-context="Nice">characters</translate>.
|
|
32
|
+
</div>
|
|
66
33
|
<div class="error-message" ng-if="forma.$error.maxlength" translate translate-context="Nice">Your input is too long</div>
|
|
67
34
|
<div class="error-message" ng-if="forma.$error.required" ng-if="forma.$dirty" translate translate-context="Nice">This field is required.</div>
|
|
68
35
|
<div class="error-message" ng-if="forma.$error.unique" translate translate-context="Nice">This field must be unique.</div>
|
|
@@ -71,4 +38,4 @@
|
|
|
71
38
|
<!-- <pre>{{ forma | json }}</pre> -->
|
|
72
39
|
</div>
|
|
73
40
|
</div>
|
|
74
|
-
</ng-form>
|
|
41
|
+
</ng-form>
|
|
@@ -55,7 +55,7 @@ angular.module('niceElements')
|
|
|
55
55
|
attrs.required = attrs.required === 'true';
|
|
56
56
|
//attrs.required = angular.isDefined(attrs.required);
|
|
57
57
|
|
|
58
|
-
if(!scope.textArea) {
|
|
58
|
+
if (!scope.textArea) {
|
|
59
59
|
scope.elementType = "input";
|
|
60
60
|
} else {
|
|
61
61
|
scope.elementType = "textarea";
|
|
@@ -63,9 +63,7 @@ angular.module('niceElements')
|
|
|
63
63
|
|
|
64
64
|
if (scope.isFocused) {
|
|
65
65
|
var input = element[0].getElementsByTagName(scope.elementType)[0];
|
|
66
|
-
if (input)
|
|
67
|
-
input.focus();
|
|
68
|
-
}
|
|
66
|
+
if (input) input.focus();
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
// Set internal type
|
|
@@ -94,8 +92,9 @@ angular.module('niceElements')
|
|
|
94
92
|
|
|
95
93
|
if (angular.isDefined(attrs.minDecimalsCutZeros) && attrs.type == 'number') {
|
|
96
94
|
scope.model = Number(scope.model);
|
|
97
|
-
if (scope.model.toString().split('.').length < 2 || scope.model.toString().split('.')[1].length < parseInt(attrs.minDecimalsCutZeros))
|
|
98
|
-
scope.model = (Number(scope.model)).toFixed(parseInt(attrs.minDecimalsCutZeros));
|
|
95
|
+
if (scope.model.toString().split('.').length < 2 || scope.model.toString().split('.')[1].length < parseInt(attrs.minDecimalsCutZeros)) {
|
|
96
|
+
scope.model = Number((Number(scope.model)).toFixed(parseInt(attrs.minDecimalsCutZeros)));
|
|
97
|
+
}
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
if (angular.isDefined(scope.regex) && scope.regex != '') {
|
|
@@ -114,39 +113,40 @@ angular.module('niceElements')
|
|
|
114
113
|
if (scope.onChange) scope.onChange({ model: scope.model });
|
|
115
114
|
}
|
|
116
115
|
} else {
|
|
116
|
+
scope.model = scope.internalModel;
|
|
117
117
|
if (scope.onChange) scope.onChange({ model: scope.model });
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
|
-
|
|
120
|
+
},
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
controller: function ($scope) {
|
|
123
|
+
$scope.id = Math.random().toString(36).substring(7);
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
event.preventDefault();
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
} else {
|
|
134
|
-
event.preventDefault();
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
} else if (event.charCode == 45) {
|
|
138
|
-
if (String($scope.model).indexOf("-") >= 0) {
|
|
125
|
+
$scope.keypress = function (event) {
|
|
126
|
+
if ($scope.type == "number" || $scope.type == "integer") {
|
|
127
|
+
if (event.charCode == 46 || event.charCode == 44) { // Handle "." and "," key (only one allowed)
|
|
128
|
+
if ($scope.type == "number") {
|
|
129
|
+
if (String($scope.model).indexOf(".") >= 0) {
|
|
139
130
|
event.preventDefault();
|
|
140
131
|
return false;
|
|
141
132
|
}
|
|
142
|
-
} else
|
|
143
|
-
return true;
|
|
144
|
-
} else { // Prevent everything else
|
|
133
|
+
} else {
|
|
145
134
|
event.preventDefault();
|
|
146
135
|
return false;
|
|
147
136
|
}
|
|
137
|
+
} else if (event.charCode == 45) {
|
|
138
|
+
if (String($scope.model).indexOf("-") >= 0) {
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
} else if ((event.charCode >= 48 && event.charCode <= 58) || event.charCode == 0) { // Allow only numbers
|
|
143
|
+
return true;
|
|
144
|
+
} else { // Prevent everything else
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
return false;
|
|
148
147
|
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
151
|
};
|
|
152
152
|
});
|
|
@@ -1,42 +1,49 @@
|
|
|
1
|
-
.nice-input{
|
|
2
|
-
color:
|
|
1
|
+
.nice-input {
|
|
2
|
+
color: var(--nice-font-color);
|
|
3
3
|
display: block;
|
|
4
4
|
|
|
5
|
-
::-webkit-input-placeholder {
|
|
5
|
+
::-webkit-input-placeholder {
|
|
6
|
+
/* WebKit browsers */
|
|
6
7
|
color: $nice-input-placeholder-color;
|
|
7
|
-
// opacity: 0.1;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
:-moz-placeholder {
|
|
10
|
+
:-moz-placeholder {
|
|
11
|
+
/* Mozilla Firefox 4 to 18 */
|
|
11
12
|
color: $nice-input-placeholder-color;
|
|
12
|
-
// opacity: 0.1;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
::-moz-placeholder {
|
|
15
|
+
::-moz-placeholder {
|
|
16
|
+
/* Mozilla Firefox 19+ */
|
|
16
17
|
color: $nice-input-placeholder-color;
|
|
17
|
-
// opacity: 0.1;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
:-ms-input-placeholder {
|
|
20
|
+
:-ms-input-placeholder {
|
|
21
|
+
/* Internet Explorer 10+ */
|
|
21
22
|
color: $nice-input-placeholder-color;
|
|
22
|
-
// opacity: 0.1;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
:disabled::-webkit-input-placeholder {
|
|
25
|
+
:disabled::-webkit-input-placeholder {
|
|
26
|
+
/* WebKit browsers */
|
|
26
27
|
color: $nice-input-disabled-bg;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
:disabled:-moz-placeholder {
|
|
30
|
+
:disabled:-moz-placeholder {
|
|
31
|
+
/* Mozilla Firefox 4 to 18 */
|
|
30
32
|
color: $nice-input-disabled-bg;
|
|
31
|
-
// opacity: 0;
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
|
|
35
|
+
:disabled::-moz-placeholder {
|
|
36
|
+
/* Mozilla Firefox 19+ */
|
|
34
37
|
color: $nice-input-disabled-bg;
|
|
35
|
-
// opacity: 0;
|
|
36
38
|
}
|
|
37
|
-
|
|
39
|
+
|
|
40
|
+
:disabled:-ms-input-placeholder {
|
|
41
|
+
/* Internet Explorer 10+ */
|
|
38
42
|
color: $nice-input-disabled-bg;
|
|
39
|
-
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
textarea {
|
|
46
|
+
border-right: 1px solid var(--nice-border-color) !important;
|
|
40
47
|
}
|
|
41
48
|
|
|
42
49
|
|
|
@@ -44,17 +51,17 @@
|
|
|
44
51
|
margin-bottom: 0px;
|
|
45
52
|
}
|
|
46
53
|
|
|
47
|
-
.symbol{
|
|
54
|
+
.symbol {
|
|
48
55
|
position: relative;
|
|
49
56
|
display: table;
|
|
50
57
|
border-collapse: separate;
|
|
51
|
-
|
|
58
|
+
|
|
52
59
|
.form-control-feedback {
|
|
53
60
|
left: 0;
|
|
54
61
|
right: auto;
|
|
55
62
|
}
|
|
56
63
|
|
|
57
|
-
.form-control{
|
|
64
|
+
.form-control {
|
|
58
65
|
border-top-right-radius: 0;
|
|
59
66
|
border-bottom-right-radius: 0;
|
|
60
67
|
text-align: right;
|
|
@@ -10,13 +10,17 @@
|
|
|
10
10
|
<div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
|
|
11
11
|
<div class="input-group" ng-class="{'has-warning': !disabled && niceNumberForm.$invalid && niceNumberForm.$dirty}">
|
|
12
12
|
<span class="input-group-btn">
|
|
13
|
-
<button class="btn btn-default" type="button" ng-disabled="!canSubstract" ng-click="subtract()" tabindex="-1"
|
|
13
|
+
<button class="btn btn-default btn-left" type="button" ng-disabled="!canSubstract" ng-click="subtract()" tabindex="-1">
|
|
14
|
+
<nice-icon icon="icon-minus"></nice-icon>
|
|
15
|
+
</button>
|
|
14
16
|
</span>
|
|
15
17
|
|
|
16
18
|
<input type="number" step="{{ step }}" ng-change="inputChanged()" class="form-control" max="{{ max }}" min="{{ min }}" ng-model="model" />
|
|
17
19
|
|
|
18
20
|
<span class="input-group-btn">
|
|
19
|
-
<button class="btn btn-default" type="button" ng-disabled="!canAdd" ng-click="add()" tabindex="-1"
|
|
21
|
+
<button class="btn btn-default btn-right" type="button" ng-disabled="!canAdd" ng-click="add()" tabindex="-1">
|
|
22
|
+
<nice-icon icon="icon-plus"></nice-icon>
|
|
23
|
+
</button>
|
|
20
24
|
</span>
|
|
21
25
|
</div>
|
|
22
26
|
|
|
@@ -6,20 +6,32 @@
|
|
|
6
6
|
padding: 0;
|
|
7
7
|
min-width: 30px;
|
|
8
8
|
border-left: 0 none;
|
|
9
|
+
border-right: 0 none;
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
.input-group-btn {
|
|
13
|
-
z-index: 1;
|
|
14
|
-
|
|
15
14
|
.btn {
|
|
16
|
-
background: $nice-
|
|
15
|
+
background: $nice-input-bg;
|
|
17
16
|
height: 34px;
|
|
17
|
+
width: 34px;
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
align-items: center;
|
|
21
|
+
line-height: 0;
|
|
18
22
|
border: 1px solid $nice-border-color;
|
|
19
23
|
|
|
20
24
|
&:focus {
|
|
21
25
|
outline: 0;
|
|
22
26
|
}
|
|
27
|
+
|
|
28
|
+
&.btn-left {
|
|
29
|
+
border-right: 0 none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.btn-right {
|
|
33
|
+
border-left: 0 none;
|
|
34
|
+
}
|
|
23
35
|
}
|
|
24
36
|
}
|
|
25
37
|
|
|
@@ -9,9 +9,13 @@
|
|
|
9
9
|
<!------------------------- Field ------------------------->
|
|
10
10
|
<div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
|
|
11
11
|
<div class="input-group">
|
|
12
|
-
<button class="btn btn-default btn-left" ng-click="sub()" type="button" ng-disabled="isDisabled" tabindex="-1"
|
|
12
|
+
<button class="btn btn-default btn-left" ng-click="sub()" type="button" ng-disabled="isDisabled" tabindex="-1">
|
|
13
|
+
<nice-icon icon="icon-minus"></nice-icon>
|
|
14
|
+
</button>
|
|
13
15
|
<input class="value form-control" ng-model="model" type="number" ng-change="handleChange()" ng-disabled="isDisabled" />
|
|
14
|
-
<button class="btn btn-default btn-right" ng-click="add()" type="button" ng-disabled="isDisabled" tabindex="-1"
|
|
16
|
+
<button class="btn btn-default btn-right" ng-click="add()" type="button" ng-disabled="isDisabled" tabindex="-1">
|
|
17
|
+
<nice-icon icon="icon-plus"></nice-icon>
|
|
18
|
+
</button>
|
|
15
19
|
</div>
|
|
16
20
|
</div>
|
|
17
21
|
</div>
|
|
@@ -6,9 +6,20 @@
|
|
|
6
6
|
display: flex;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
.form-control {
|
|
10
|
+
border-left: 0 none !important;
|
|
11
|
+
border-right: 0 none !important;
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
.btn {
|
|
10
15
|
border: 1px solid $nice-border-color;
|
|
11
16
|
border-radius: 0;
|
|
17
|
+
width: 34px;
|
|
18
|
+
display: flex;
|
|
19
|
+
background: $nice-input-bg;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
align-items: center;
|
|
22
|
+
line-height: 0;
|
|
12
23
|
|
|
13
24
|
&:focus {
|
|
14
25
|
outline: 0 none;
|