nice-elements 1.4.11 → 1.6.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/.vscode/settings.json +3 -0
- package/CHANGELOG.md +28 -0
- package/README.md +48 -1
- package/bower.json +1 -1
- package/dist/nice.js +1262 -106
- package/dist/nice.min.js +1 -1
- package/dist/style.css +989 -66
- package/dist/style.css.map +7 -2
- package/dist/style.min.css +2 -2
- package/package.json +1 -1
- package/src/components/nice-calendar/nice-calendar.html +10 -37
- package/src/components/nice-calendar/nice-calendar.scss +25 -24
- package/src/components/nice-checkbox/nice-checkbox.html +2 -2
- package/src/components/nice-checkbox/nice-checkbox.scss +5 -4
- package/src/components/nice-choice/nice-choice.html +1 -1
- package/src/components/nice-choice/nice-choice.scss +22 -22
- package/src/components/nice-date/nice-date.html +14 -34
- package/src/components/nice-date/nice-date.scss +41 -17
- package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.html +4 -34
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.scss +18 -14
- package/src/components/nice-dropdown/nice-dropdown.js +5 -0
- package/src/components/nice-dropdown/nice-dropdown.scss +5 -4
- package/src/components/nice-dropdown-old/nice-dropdown-old.scss +27 -26
- package/src/components/nice-icon/nice-icon.html +3 -0
- package/src/components/nice-icon/nice-icon.js +18 -0
- package/src/components/nice-icon/nice-icon.scss +6 -0
- package/src/components/nice-number/nice-number.html +2 -2
- package/src/components/nice-number/nice-number.scss +9 -0
- package/src/components/nice-popup/nice-popup.html +7 -0
- package/src/components/nice-popup/nice-popup.js +123 -0
- package/src/components/nice-popup/nice-popup.scss +44 -0
- package/src/components/nice-quantity/nice-quantity.html +3 -10
- package/src/components/nice-quantity/nice-quantity.scss +17 -10
- package/src/components/nice-search2/nice-search2.html +2 -12
- package/src/components/nice-search2/nice-search2.js +34 -27
- package/src/components/nice-svgs/nice-svgs.html +1153 -0
- package/src/components/nice-svgs/nice-svgs.js +16 -0
- package/src/components/nice-toast/nice-toast.html +3 -0
- package/src/components/nice-toast/nice-toast.js +57 -0
- package/src/components/nice-toast/nice-toast.scss +75 -0
- package/src/components/nice-tooltip/nice-tooltip.js +9 -6
- package/src/components/nice-upload/nice-upload.html +4 -5
- package/src/components/nice-upload/nice-upload.js +73 -41
- package/src/components/nice-upload/nice-upload.scss +32 -13
- package/src/components/nice-yesno/nice-yesno.html +1 -1
- package/src/components/nice-yesno/nice-yesno.scss +23 -15
- package/src/styles/_nice-buttons.scss +335 -0
- package/src/styles/_nice-common.scss +84 -47
- package/src/styles/_nice-spacing.scss +58 -0
- package/src/styles/_nice.scss +6 -1
- package/src/styles/_variables.scss +81 -3
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
.nice-dropdown-old{
|
|
2
|
-
.disabled{
|
|
1
|
+
.nice-dropdown-old {
|
|
2
|
+
.disabled {
|
|
3
3
|
cursor: not-allowed !important;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.open{
|
|
7
|
-
.btn-dropdown{
|
|
6
|
+
.open {
|
|
7
|
+
.btn-dropdown {
|
|
8
8
|
background: $nice-focus-bg !important;
|
|
9
|
-
border-color: $nice-focus-border !important;
|
|
10
9
|
color: $nice-focus-color !important;
|
|
11
10
|
}
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
.btn-group{
|
|
13
|
+
.btn-group {
|
|
15
14
|
width: 100%;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
.input-group-btn{
|
|
17
|
+
.input-group-btn {
|
|
19
18
|
padding-left: 10px;
|
|
20
|
-
|
|
19
|
+
|
|
20
|
+
.btn {
|
|
21
21
|
border-bottom-left-radius: $nice-border-radius;
|
|
22
22
|
border-top-left-radius: $nice-border-radius;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.dropdown-menu{
|
|
26
|
+
.dropdown-menu {
|
|
27
27
|
min-width: 200px;
|
|
28
28
|
width: 100%;
|
|
29
29
|
padding: 0;
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
-webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.175);
|
|
34
34
|
box-shadow: 0 0 1px rgba(0, 0, 0, 0.175);
|
|
35
35
|
|
|
36
|
-
li{
|
|
37
|
-
.choice-checkbox{
|
|
36
|
+
li {
|
|
37
|
+
.choice-checkbox {
|
|
38
38
|
-webkit-transition: all 0.2s;
|
|
39
39
|
-moz-transition: all 0.2s;
|
|
40
40
|
-ms-transition: all 0.2s;
|
|
@@ -51,24 +51,24 @@
|
|
|
51
51
|
border-radius: 2px;
|
|
52
52
|
text-align: center;
|
|
53
53
|
|
|
54
|
-
&.selected{
|
|
54
|
+
&.selected {
|
|
55
55
|
border-color: $nice-choice-selected-bg;
|
|
56
56
|
background: $nice-choice-selected-bg;
|
|
57
57
|
color: $nice-choice-selected-color;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
.multiple-item{
|
|
61
|
+
.multiple-item {
|
|
62
62
|
margin-left: 35px;
|
|
63
63
|
line-height: 26px;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
a{
|
|
67
|
-
padding:10px;
|
|
66
|
+
a {
|
|
67
|
+
padding: 10px;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
&:hover{
|
|
71
|
-
a{
|
|
70
|
+
&:hover {
|
|
71
|
+
a {
|
|
72
72
|
background: $nice-hover-color;
|
|
73
73
|
//color: white;
|
|
74
74
|
}
|
|
@@ -77,13 +77,14 @@
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
.btn-dropdown{
|
|
80
|
+
.btn-dropdown {
|
|
81
81
|
@extend .btn-primary;
|
|
82
82
|
background: $nice-dropdown-bg;
|
|
83
83
|
border-color: $nice-dropdown-border;
|
|
84
84
|
color: $nice-dropdown-color;
|
|
85
85
|
font-weight: $nice-font-weight;
|
|
86
86
|
min-height: 34px;
|
|
87
|
+
justify-content: flex-start;
|
|
87
88
|
|
|
88
89
|
white-space: nowrap;
|
|
89
90
|
text-overflow: ellipsis;
|
|
@@ -92,38 +93,38 @@
|
|
|
92
93
|
text-align: left;
|
|
93
94
|
padding-right: 25px;
|
|
94
95
|
|
|
95
|
-
.caret{
|
|
96
|
+
.caret {
|
|
96
97
|
position: absolute;
|
|
97
98
|
top: 15px;
|
|
98
99
|
right: 10px;
|
|
99
100
|
color: $nice-border-color;
|
|
100
101
|
}
|
|
101
102
|
|
|
102
|
-
&:disabled{
|
|
103
|
+
&:disabled {
|
|
103
104
|
cursor: not-allowed;
|
|
104
105
|
background: $nice-dropdown-disabled-bg !important;
|
|
105
106
|
border-color: $nice-dropdown-disabled-border !important;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
&:hover{
|
|
109
|
+
&:hover {
|
|
109
110
|
background: $nice-dropdown-hover-bg;
|
|
110
111
|
border-color: $nice-dropdown-hover-border;
|
|
111
112
|
color: $nice-dropdown-hover-color;
|
|
112
113
|
}
|
|
113
114
|
|
|
114
|
-
&:active,
|
|
115
|
+
&:active,
|
|
116
|
+
&:focus {
|
|
115
117
|
background: $nice-focus-bg !important;
|
|
116
|
-
border-color: $nice-focus-border !important;
|
|
117
118
|
color: $nice-focus-color !important;
|
|
119
|
+
@extend .nice-focus;
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
122
|
|
|
121
|
-
.dropdown-color{
|
|
123
|
+
.dropdown-color {
|
|
122
124
|
width: 12px;
|
|
123
125
|
height: 12px;
|
|
124
126
|
margin-right: 7px;
|
|
125
127
|
border-radius: 3px;
|
|
126
128
|
display: inline-block;
|
|
127
129
|
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @ngdoc directive
|
|
5
|
+
* @name niceElements.directive:niceIcon
|
|
6
|
+
* @description
|
|
7
|
+
* # niceIcon
|
|
8
|
+
*/
|
|
9
|
+
angular.module('niceElements')
|
|
10
|
+
.directive('niceIcon', function () {
|
|
11
|
+
return {
|
|
12
|
+
templateUrl: 'src/components/nice-icon/nice-icon.html',
|
|
13
|
+
restrict: 'E',
|
|
14
|
+
scope: {
|
|
15
|
+
icon: '@'
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
});
|
|
@@ -10,13 +10,13 @@
|
|
|
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()">-</button>
|
|
13
|
+
<button class="btn btn-default" type="button" ng-disabled="!canSubstract" ng-click="subtract()" tabindex="-1">-</button>
|
|
14
14
|
</span>
|
|
15
15
|
|
|
16
16
|
<input type="number" step="{{ step }}" ng-change="inputChanged()" class="form-control" max="{{ max }}" min="{{ min }}" ng-model="model" />
|
|
17
17
|
|
|
18
18
|
<span class="input-group-btn">
|
|
19
|
-
<button class="btn btn-default" type="button" ng-disabled="!canAdd" ng-click="add()">+</button>
|
|
19
|
+
<button class="btn btn-default" type="button" ng-disabled="!canAdd" ng-click="add()" tabindex="-1">+</button>
|
|
20
20
|
</span>
|
|
21
21
|
</div>
|
|
22
22
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
.nice-number {
|
|
2
2
|
.input-group {
|
|
3
3
|
.form-control {
|
|
4
|
+
z-index: 0;
|
|
4
5
|
text-align: center;
|
|
5
6
|
padding: 0;
|
|
6
7
|
min-width: 30px;
|
|
@@ -9,8 +10,16 @@
|
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
.input-group-btn {
|
|
13
|
+
z-index: 1;
|
|
14
|
+
|
|
12
15
|
.btn {
|
|
13
16
|
background: $nice-addon-bg;
|
|
17
|
+
height: 34px;
|
|
18
|
+
border: 1px solid $nice-border-color;
|
|
19
|
+
|
|
20
|
+
&:focus {
|
|
21
|
+
outline: 0;
|
|
22
|
+
}
|
|
14
23
|
}
|
|
15
24
|
}
|
|
16
25
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<div class="nice-popup" click-outside="close()">
|
|
2
|
+
<div class="nice-popup-target" ng-transclude="target" ng-click="toggle()"></div>
|
|
3
|
+
<div class="nice-popup-content">
|
|
4
|
+
<div class="nice-popup-arrow" data-popper-arrow ng-show="isOpen && showArrow"></div>
|
|
5
|
+
<div ng-transclude="content" ng-if="isOpen"></div>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @ngdoc directive
|
|
5
|
+
* @name niceElements.directive:nicePopup
|
|
6
|
+
* @description
|
|
7
|
+
* # nicePopup
|
|
8
|
+
*/
|
|
9
|
+
angular.module('niceElements')
|
|
10
|
+
.directive('nicePopup', function () {
|
|
11
|
+
return {
|
|
12
|
+
templateUrl: 'src/components/nice-popup/nice-popup.html',
|
|
13
|
+
restrict: 'E',
|
|
14
|
+
transclude: {
|
|
15
|
+
'target': '?nicePopupTarget',
|
|
16
|
+
'content': '?nicePopupContent'
|
|
17
|
+
},
|
|
18
|
+
scope: {
|
|
19
|
+
offsetDistance: '@', // distance, displaces the popper away from, or toward, the reference element in the direction of its placement
|
|
20
|
+
offsetSkidding: '@', // skidding, displaces the popper along the reference element.
|
|
21
|
+
placement: '@', // Describes the preferred placement of the popper
|
|
22
|
+
strategy: '@',
|
|
23
|
+
showArrow: '@',
|
|
24
|
+
onChange: '&?',
|
|
25
|
+
},
|
|
26
|
+
controller: function ($scope, $element, $timeout) {
|
|
27
|
+
$scope.isOpen = false;
|
|
28
|
+
if (!$scope.showArrow) { $scope.showArrow = false; }
|
|
29
|
+
if (!$scope.offsetDistance && $scope.showArrow) { $scope.offsetDistance = 8; }
|
|
30
|
+
if (!$scope.offsetDistance) { $scope.offsetDistance = 5; }
|
|
31
|
+
if (!$scope.offsetSkidding) { $scope.offsetSkidding = 0; }
|
|
32
|
+
if (!$scope.placement) { $scope.placement = "auto"; }
|
|
33
|
+
if (!$scope.strategy) { $scope.strategy = "fixed"; }
|
|
34
|
+
|
|
35
|
+
// Placements
|
|
36
|
+
// [
|
|
37
|
+
// 'auto',
|
|
38
|
+
// 'auto-start',
|
|
39
|
+
// 'auto-end',
|
|
40
|
+
// 'top',
|
|
41
|
+
// 'top-start',
|
|
42
|
+
// 'top-end',
|
|
43
|
+
// 'bottom',
|
|
44
|
+
// 'bottom-start',
|
|
45
|
+
// 'bottom-end',
|
|
46
|
+
// 'right',
|
|
47
|
+
// 'right-start',
|
|
48
|
+
// 'right-end',
|
|
49
|
+
// 'left',
|
|
50
|
+
// 'left-start',
|
|
51
|
+
// 'left-end'
|
|
52
|
+
// ]
|
|
53
|
+
|
|
54
|
+
// Setup popper
|
|
55
|
+
// https://popper.js.org/docs/v2/constructors/
|
|
56
|
+
$scope.setupPopper = function () {
|
|
57
|
+
var target = $element[0].getElementsByClassName('nice-popup-target')[0];
|
|
58
|
+
var content = $element[0].getElementsByClassName('nice-popup-content')[0];
|
|
59
|
+
$scope.popper = Popper.createPopper(target, content, {
|
|
60
|
+
placement: $scope.placement,
|
|
61
|
+
strategy: $scope.strategy,
|
|
62
|
+
scroll: true,
|
|
63
|
+
resize: true,
|
|
64
|
+
modifiers: [
|
|
65
|
+
{
|
|
66
|
+
name: 'offset',
|
|
67
|
+
options: {
|
|
68
|
+
offset: [$scope.offsetSkidding, $scope.offsetDistance],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'arrow',
|
|
73
|
+
options: {
|
|
74
|
+
padding: 5, // 5px from the edges of the popper
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
// {
|
|
78
|
+
// name: "sameWidth",
|
|
79
|
+
// enabled: true,
|
|
80
|
+
// phase: "beforeWrite",
|
|
81
|
+
// requires: ["computeStyles"],
|
|
82
|
+
// fn: function (e) {
|
|
83
|
+
// var state = e.state;
|
|
84
|
+
// state.styles.popper.width = state.rects.reference.width + "px";
|
|
85
|
+
// },
|
|
86
|
+
// effect: function (e) {
|
|
87
|
+
// var state = e.state;
|
|
88
|
+
// state.elements.popper.style.width = state.elements.reference.offsetWidth + "px";
|
|
89
|
+
// }
|
|
90
|
+
// }
|
|
91
|
+
],
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
$timeout(function () {
|
|
96
|
+
$scope.setupPopper();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// -----------------------------------Open -----------------------------------
|
|
100
|
+
$scope.toggle = function () {
|
|
101
|
+
if ($scope.isOpen) {
|
|
102
|
+
$scope.close();
|
|
103
|
+
} else {
|
|
104
|
+
$scope.open();
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
$scope.close = function () {
|
|
109
|
+
$scope.isOpen = false;
|
|
110
|
+
if ($scope.onChange) $scope.onChange($scope.isOpen);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
$scope.open = function () {
|
|
114
|
+
$scope.popper.update();
|
|
115
|
+
$scope.isOpen = true;
|
|
116
|
+
if ($scope.onChange) $scope.onChange($scope.isOpen);
|
|
117
|
+
$timeout(function () {
|
|
118
|
+
$scope.popper.update();
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.nice-popup {
|
|
2
|
+
.nice-popup-target {
|
|
3
|
+
display: inline-block;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.nice-popup-arrow[data-hide] {
|
|
7
|
+
visibility: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.nice-popup-arrow,
|
|
11
|
+
.nice-popup-arrow::before {
|
|
12
|
+
position: absolute;
|
|
13
|
+
width: 8px;
|
|
14
|
+
height: 8px;
|
|
15
|
+
z-index: -1;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.nice-popup-arrow::before {
|
|
19
|
+
content: '';
|
|
20
|
+
transform: rotate(45deg);
|
|
21
|
+
background: #ffffff;
|
|
22
|
+
border: 1px solid $nice-border-color;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.nice-popup-content {
|
|
26
|
+
z-index: 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.nice-popup-content[data-popper-placement^='top']>.nice-popup-arrow {
|
|
30
|
+
bottom: -4px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.nice-popup-content[data-popper-placement^='bottom']>.nice-popup-arrow {
|
|
34
|
+
top: -4px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.nice-popup-content[data-popper-placement^='left']>.nice-popup-arrow {
|
|
38
|
+
right: -4px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.nice-popup-content[data-popper-placement^='right']>.nice-popup-arrow {
|
|
42
|
+
left: -4px;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -9,17 +9,10 @@
|
|
|
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
|
-
<
|
|
13
|
-
<button class="btn btn-primary btn-left" ng-click="sub()" type="button" ng-disabled="isDisabled">-</button>
|
|
14
|
-
</span>
|
|
15
|
-
|
|
12
|
+
<button class="btn btn-default btn-left" ng-click="sub()" type="button" ng-disabled="isDisabled" tabindex="-1">-</button>
|
|
16
13
|
<input class="value form-control" ng-model="model" type="number" ng-change="handleChange()" ng-disabled="isDisabled" />
|
|
17
|
-
|
|
18
|
-
<span class="input-group-btn">
|
|
19
|
-
<button class="btn btn-primary btn-right" ng-click="add()" type="button" ng-disabled="isDisabled">+</button>
|
|
20
|
-
</span>
|
|
14
|
+
<button class="btn btn-default btn-right" ng-click="add()" type="button" ng-disabled="isDisabled" tabindex="-1">+</button>
|
|
21
15
|
</div>
|
|
22
16
|
</div>
|
|
23
17
|
</div>
|
|
24
|
-
</div>
|
|
25
|
-
|
|
18
|
+
</div>
|
|
@@ -1,35 +1,42 @@
|
|
|
1
|
-
.nice-quantity{
|
|
1
|
+
.nice-quantity {
|
|
2
2
|
$nice-quantity-height: 35px;
|
|
3
3
|
width: 100%;
|
|
4
4
|
|
|
5
|
+
.input-group {
|
|
6
|
+
display: flex;
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
.btn {
|
|
6
|
-
height: $nice-quantity-height;
|
|
7
|
-
width: $nice-quantity-height;
|
|
8
|
-
line-height: $nice-quantity-height - 2;
|
|
9
|
-
padding: 0;
|
|
10
10
|
border: 1px solid $nice-border-color;
|
|
11
|
+
border-radius: 0;
|
|
12
|
+
|
|
13
|
+
&:focus {
|
|
14
|
+
outline: 0 none;
|
|
15
|
+
}
|
|
11
16
|
}
|
|
12
17
|
|
|
13
|
-
.btn-left{
|
|
18
|
+
.btn-left {
|
|
14
19
|
border-bottom-left-radius: $nice-border-radius;
|
|
15
20
|
border-top-left-radius: $nice-border-radius;
|
|
16
|
-
|
|
21
|
+
border-right: 0 none;
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
.btn-right{
|
|
24
|
+
.btn-right {
|
|
20
25
|
border-bottom-right-radius: $nice-border-radius;
|
|
21
26
|
border-top-right-radius: $nice-border-radius;
|
|
22
|
-
|
|
27
|
+
border-left: 0 none;
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
input {
|
|
26
31
|
text-align: center;
|
|
32
|
+
flex-grow: 1;
|
|
33
|
+
|
|
27
34
|
&:focus {
|
|
28
35
|
outline: 0 none;
|
|
29
36
|
}
|
|
30
37
|
}
|
|
31
38
|
|
|
32
|
-
.value{
|
|
39
|
+
.value {
|
|
33
40
|
line-height: $nice-quantity-height - 2;
|
|
34
41
|
padding: 0px 10px;
|
|
35
42
|
text-align: center;
|
|
@@ -9,17 +9,7 @@
|
|
|
9
9
|
<!------------------------- Field ------------------------->
|
|
10
10
|
<div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]" click-outside="close()">
|
|
11
11
|
<div class="nice-search-button input-group" ng-class="{ 'disabled': isDisabled, 'has-warning': !isDisabled && form.$invalid && form.$dirty, 'has-success': !isDisabled && form.$valid && form.$dirty}">
|
|
12
|
-
<input
|
|
13
|
-
class="form-control"
|
|
14
|
-
type="text"
|
|
15
|
-
id="{{ id }}"
|
|
16
|
-
ng-model="model"
|
|
17
|
-
placeholder="{{ placeholder }}"
|
|
18
|
-
ng-disabled="isDisabled"
|
|
19
|
-
ng-change="updateSearch()"
|
|
20
|
-
ng-focus="onFocus()"
|
|
21
|
-
tabindex="{{ tabIndex }}"
|
|
22
|
-
>
|
|
12
|
+
<input class="form-control" type="text" id="{{ id }}" ng-model="model" placeholder="{{ placeholder }}" ng-disabled="isDisabled" ng-change="updateSearch()" ng-focus="onFocus()" ng-blur="onBlur()" tabindex="{{ tabIndex }}">
|
|
23
13
|
|
|
24
14
|
<span class="input-group-addon clickable" ng-click="onFocus()">
|
|
25
15
|
<i ng-show="!loading" class="fa fa-search"></i>
|
|
@@ -41,5 +31,5 @@
|
|
|
41
31
|
</div>
|
|
42
32
|
</div>
|
|
43
33
|
</div>
|
|
44
|
-
|
|
34
|
+
</div>
|
|
45
35
|
</ng-form>
|
|
@@ -30,7 +30,7 @@ angular.module('niceElements')
|
|
|
30
30
|
isInline: '=',
|
|
31
31
|
help: '@'
|
|
32
32
|
},
|
|
33
|
-
controller: function($scope, $timeout, $element) {
|
|
33
|
+
controller: function ($scope, $timeout, $element) {
|
|
34
34
|
$scope.loading = false;
|
|
35
35
|
$scope.isOpen = false;
|
|
36
36
|
$scope.debounce = null;
|
|
@@ -44,7 +44,7 @@ angular.module('niceElements')
|
|
|
44
44
|
|
|
45
45
|
// Setup popper
|
|
46
46
|
// https://popper.js.org/docs/v2/constructors/
|
|
47
|
-
$scope.setupPopper = function() {
|
|
47
|
+
$scope.setupPopper = function () {
|
|
48
48
|
var button = $element[0].getElementsByClassName('nice-search-button')[0];
|
|
49
49
|
var tooltip = $element[0].getElementsByClassName('nice-search-dropdown-wrapper')[0];
|
|
50
50
|
$scope.popper = Popper.createPopper(button, tooltip, {
|
|
@@ -62,13 +62,13 @@ angular.module('niceElements')
|
|
|
62
62
|
enabled: true,
|
|
63
63
|
phase: "beforeWrite",
|
|
64
64
|
requires: ["computeStyles"],
|
|
65
|
-
fn: function(e) {
|
|
65
|
+
fn: function (e) {
|
|
66
66
|
var state = e.state;
|
|
67
67
|
state.styles.popper.width = state.rects.reference.width + "px";
|
|
68
68
|
},
|
|
69
|
-
effect: function(e) {
|
|
69
|
+
effect: function (e) {
|
|
70
70
|
var state = e.state;
|
|
71
|
-
state.elements.popper.style.width = state.elements.reference.offsetWidth
|
|
71
|
+
state.elements.popper.style.width = state.elements.reference.offsetWidth + "px";
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
],
|
|
@@ -77,10 +77,11 @@ angular.module('niceElements')
|
|
|
77
77
|
|
|
78
78
|
$timeout(function () {
|
|
79
79
|
$scope.setupPopper();
|
|
80
|
-
})
|
|
81
|
-
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
|
|
82
83
|
// ------------------- On focus -------------------
|
|
83
|
-
$scope.onFocus = function() {
|
|
84
|
+
$scope.onFocus = function () {
|
|
84
85
|
if ($scope.showDropdown && $scope.results.length == 0) {
|
|
85
86
|
$scope.getData($scope.model);
|
|
86
87
|
}
|
|
@@ -92,23 +93,29 @@ angular.module('niceElements')
|
|
|
92
93
|
};
|
|
93
94
|
|
|
94
95
|
|
|
96
|
+
// ------------------- On blur -------------------
|
|
97
|
+
$scope.onBlur = function () {
|
|
98
|
+
$scope.close();
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
|
|
95
102
|
// ------------------- On focus -------------------
|
|
96
|
-
$scope.open = function() {
|
|
103
|
+
$scope.open = function () {
|
|
97
104
|
$scope.isOpen = true;
|
|
98
|
-
$timeout(function() {
|
|
105
|
+
$timeout(function () {
|
|
99
106
|
if ($scope.popper) $scope.popper.update();
|
|
100
107
|
});
|
|
101
108
|
};
|
|
102
109
|
|
|
103
110
|
|
|
104
111
|
// ------------------- On blur -------------------
|
|
105
|
-
$scope.close = function() {
|
|
112
|
+
$scope.close = function () {
|
|
106
113
|
$scope.isOpen = false;
|
|
107
114
|
|
|
108
115
|
var input = $element[0].getElementsByTagName('input')[0];
|
|
109
116
|
if (input) input.blur();
|
|
110
117
|
|
|
111
|
-
$timeout(function() {
|
|
118
|
+
$timeout(function () {
|
|
112
119
|
$scope.popper.update();
|
|
113
120
|
})
|
|
114
121
|
};
|
|
@@ -120,7 +127,7 @@ angular.module('niceElements')
|
|
|
120
127
|
$timeout.cancel($scope.debounce);
|
|
121
128
|
}
|
|
122
129
|
|
|
123
|
-
$scope.debounce = $timeout(function() {
|
|
130
|
+
$scope.debounce = $timeout(function () {
|
|
124
131
|
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
125
132
|
$scope.getData($scope.model);
|
|
126
133
|
}, $scope.debounceTime);
|
|
@@ -128,14 +135,14 @@ angular.module('niceElements')
|
|
|
128
135
|
|
|
129
136
|
|
|
130
137
|
// ------------------- Get data -------------------
|
|
131
|
-
$scope.getData = function(keywords) {
|
|
138
|
+
$scope.getData = function (keywords) {
|
|
132
139
|
if ($scope.refreshFunction != null) {
|
|
133
140
|
$scope.loading = true;
|
|
134
141
|
$scope.requestNumber += 1;
|
|
135
142
|
var requestNumber = angular.copy($scope.requestNumber);
|
|
136
|
-
$scope.refreshFunction(keywords).then(function(results) {
|
|
137
|
-
if ($scope.requestNumber == requestNumber) {
|
|
138
|
-
$timeout(function() {
|
|
143
|
+
$scope.refreshFunction(keywords).then(function (results) {
|
|
144
|
+
if ($scope.requestNumber == requestNumber) {
|
|
145
|
+
$timeout(function () {
|
|
139
146
|
$scope.open();
|
|
140
147
|
$scope.loading = false;
|
|
141
148
|
|
|
@@ -147,7 +154,7 @@ angular.module('niceElements')
|
|
|
147
154
|
}
|
|
148
155
|
});
|
|
149
156
|
}
|
|
150
|
-
}, function(error) {
|
|
157
|
+
}, function (error) {
|
|
151
158
|
$scope.loading = false;
|
|
152
159
|
$scope.close();
|
|
153
160
|
});
|
|
@@ -159,7 +166,7 @@ angular.module('niceElements')
|
|
|
159
166
|
|
|
160
167
|
|
|
161
168
|
// ------------------------ If search button is clicked set focus or make request ------------------------
|
|
162
|
-
$scope.search = function() {
|
|
169
|
+
$scope.search = function () {
|
|
163
170
|
if (!$scope.isDisabled) {
|
|
164
171
|
if ($scope.showDropdown) {
|
|
165
172
|
$scope.updateSearch();
|
|
@@ -186,7 +193,7 @@ angular.module('niceElements')
|
|
|
186
193
|
|
|
187
194
|
|
|
188
195
|
// ----------------------------------- Scroll to hover -----------------------------------
|
|
189
|
-
$scope.scrollToHover = function(notSmooth) {
|
|
196
|
+
$scope.scrollToHover = function (notSmooth) {
|
|
190
197
|
var dropdownMenu = $element[0].getElementsByClassName("nice-dropdown")[0];
|
|
191
198
|
var hoverItem = dropdownMenu.getElementsByClassName("active")[0];
|
|
192
199
|
if (hoverItem) {
|
|
@@ -205,10 +212,10 @@ angular.module('niceElements')
|
|
|
205
212
|
// Arrow Up
|
|
206
213
|
if (event.keyCode == 38) {
|
|
207
214
|
event.preventDefault();
|
|
208
|
-
$timeout(function() {
|
|
209
|
-
if (
|
|
215
|
+
$timeout(function () {
|
|
216
|
+
if ($scope.selectedIndex > 0) {
|
|
210
217
|
$scope.selectedIndex -= 1;
|
|
211
|
-
$timeout(function() {
|
|
218
|
+
$timeout(function () {
|
|
212
219
|
$scope.scrollToHover();
|
|
213
220
|
});
|
|
214
221
|
}
|
|
@@ -218,10 +225,10 @@ angular.module('niceElements')
|
|
|
218
225
|
// Arrow Down
|
|
219
226
|
if (event.keyCode == 40) {
|
|
220
227
|
event.preventDefault();
|
|
221
|
-
$timeout(function() {
|
|
228
|
+
$timeout(function () {
|
|
222
229
|
if ($scope.results && $scope.selectedIndex < $scope.results.length - 1) {
|
|
223
230
|
$scope.selectedIndex += 1;
|
|
224
|
-
$timeout(function() {
|
|
231
|
+
$timeout(function () {
|
|
225
232
|
$scope.scrollToHover();
|
|
226
233
|
});
|
|
227
234
|
}
|
|
@@ -231,14 +238,14 @@ angular.module('niceElements')
|
|
|
231
238
|
// Enter
|
|
232
239
|
if (event.keyCode == 13) {
|
|
233
240
|
event.preventDefault();
|
|
234
|
-
$timeout(function() {
|
|
241
|
+
$timeout(function () {
|
|
235
242
|
$scope.selectItem($scope.results[$scope.selectedIndex], $scope.selectedIndex);
|
|
236
243
|
});
|
|
237
244
|
}
|
|
238
245
|
|
|
239
246
|
// Escape
|
|
240
247
|
if (event.keyCode == 27) {
|
|
241
|
-
$timeout(function() {
|
|
248
|
+
$timeout(function () {
|
|
242
249
|
$scope.close();
|
|
243
250
|
});
|
|
244
251
|
}
|