nice-elements 1.4.10 → 1.5.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 -0
- package/README.md +1 -1
- package/bower.json +1 -1
- package/dist/nice.js +1125 -11
- package/dist/nice.min.js +1 -1
- package/dist/style.css +119 -0
- package/dist/style.css.map +5 -2
- package/dist/style.min.css +1 -1
- package/package.json +1 -1
- package/src/components/nice-dropdown/nice-dropdown.js +7 -5
- 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-popup/nice-popup.html +7 -0
- package/src/components/nice-popup/nice-popup.js +120 -0
- package/src/components/nice-popup/nice-popup.scss +40 -0
- 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/styles/_nice.scss +4 -1
- package/src/styles/_variables.scss +35 -33
|
@@ -39,11 +39,13 @@ angular.module('niceElements')
|
|
|
39
39
|
searchText: '@',
|
|
40
40
|
nullableText: '@',
|
|
41
41
|
selectedText: '@',
|
|
42
|
+
dropdownDistance: '@',
|
|
42
43
|
searchFunction: '=?',
|
|
43
44
|
isInline: '=',
|
|
44
45
|
clearOnSelect: '@'
|
|
45
46
|
},
|
|
46
47
|
controller: function ($scope, $element, $timeout, gettextCatalog) {
|
|
48
|
+
if (!$scope.dropdownDistance) { $scope.dropdownDistance = 5; }
|
|
47
49
|
if (!$scope.objValue) { $scope.objValue = 'value'; }
|
|
48
50
|
if (!$scope.objKey) { $scope.objKey = 'id'; }
|
|
49
51
|
if (!$scope.noOptionsText) { $scope.noOptionsText = gettextCatalog.getString("No options", null, "Nice"); }
|
|
@@ -70,7 +72,7 @@ angular.module('niceElements')
|
|
|
70
72
|
|
|
71
73
|
// Setup popper
|
|
72
74
|
// https://popper.js.org/docs/v2/constructors/
|
|
73
|
-
$scope.setupPopper = function() {
|
|
75
|
+
$scope.setupPopper = function () {
|
|
74
76
|
var button = $element[0].getElementsByClassName('btn-dropdown')[0];
|
|
75
77
|
var tooltip = $element[0].getElementsByClassName('nice-dropdown-menu-wrapper')[0];
|
|
76
78
|
$scope.popper = Popper.createPopper(button, tooltip, {
|
|
@@ -81,7 +83,7 @@ angular.module('niceElements')
|
|
|
81
83
|
{
|
|
82
84
|
name: 'offset',
|
|
83
85
|
options: {
|
|
84
|
-
offset: [0,
|
|
86
|
+
offset: [0, $scope.dropdownDistance],
|
|
85
87
|
},
|
|
86
88
|
},
|
|
87
89
|
{
|
|
@@ -89,13 +91,13 @@ angular.module('niceElements')
|
|
|
89
91
|
enabled: true,
|
|
90
92
|
phase: "beforeWrite",
|
|
91
93
|
requires: ["computeStyles"],
|
|
92
|
-
fn: function(e) {
|
|
94
|
+
fn: function (e) {
|
|
93
95
|
var state = e.state;
|
|
94
96
|
state.styles.popper.width = state.rects.reference.width + "px";
|
|
95
97
|
},
|
|
96
|
-
effect: function(e) {
|
|
98
|
+
effect: function (e) {
|
|
97
99
|
var state = e.state;
|
|
98
|
-
state.elements.popper.style.width = state.elements.reference.offsetWidth
|
|
100
|
+
state.elements.popper.style.width = state.elements.reference.offsetWidth + "px";
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
],
|
|
@@ -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
|
+
});
|
|
@@ -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,120 @@
|
|
|
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
|
+
},
|
|
25
|
+
controller: function ($scope, $element, $timeout) {
|
|
26
|
+
$scope.isOpen = false;
|
|
27
|
+
if (!$scope.showArrow) { $scope.showArrow = false; }
|
|
28
|
+
if (!$scope.offsetDistance && $scope.showArrow) { $scope.offsetDistance = 8; }
|
|
29
|
+
if (!$scope.offsetDistance) { $scope.offsetDistance = 5; }
|
|
30
|
+
if (!$scope.offsetSkidding) { $scope.offsetSkidding = 0; }
|
|
31
|
+
if (!$scope.placement) { $scope.placement = "auto"; }
|
|
32
|
+
if (!$scope.strategy) { $scope.strategy = "fixed"; }
|
|
33
|
+
|
|
34
|
+
// Placements
|
|
35
|
+
// [
|
|
36
|
+
// 'auto',
|
|
37
|
+
// 'auto-start',
|
|
38
|
+
// 'auto-end',
|
|
39
|
+
// 'top',
|
|
40
|
+
// 'top-start',
|
|
41
|
+
// 'top-end',
|
|
42
|
+
// 'bottom',
|
|
43
|
+
// 'bottom-start',
|
|
44
|
+
// 'bottom-end',
|
|
45
|
+
// 'right',
|
|
46
|
+
// 'right-start',
|
|
47
|
+
// 'right-end',
|
|
48
|
+
// 'left',
|
|
49
|
+
// 'left-start',
|
|
50
|
+
// 'left-end'
|
|
51
|
+
// ]
|
|
52
|
+
|
|
53
|
+
// Setup popper
|
|
54
|
+
// https://popper.js.org/docs/v2/constructors/
|
|
55
|
+
$scope.setupPopper = function () {
|
|
56
|
+
var target = $element[0].getElementsByClassName('nice-popup-target')[0];
|
|
57
|
+
var content = $element[0].getElementsByClassName('nice-popup-content')[0];
|
|
58
|
+
$scope.popper = Popper.createPopper(target, content, {
|
|
59
|
+
placement: $scope.placement,
|
|
60
|
+
strategy: $scope.strategy,
|
|
61
|
+
scroll: true,
|
|
62
|
+
resize: true,
|
|
63
|
+
modifiers: [
|
|
64
|
+
{
|
|
65
|
+
name: 'offset',
|
|
66
|
+
options: {
|
|
67
|
+
offset: [$scope.offsetSkidding, $scope.offsetDistance],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'arrow',
|
|
72
|
+
options: {
|
|
73
|
+
padding: 5, // 5px from the edges of the popper
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
// {
|
|
77
|
+
// name: "sameWidth",
|
|
78
|
+
// enabled: true,
|
|
79
|
+
// phase: "beforeWrite",
|
|
80
|
+
// requires: ["computeStyles"],
|
|
81
|
+
// fn: function (e) {
|
|
82
|
+
// var state = e.state;
|
|
83
|
+
// state.styles.popper.width = state.rects.reference.width + "px";
|
|
84
|
+
// },
|
|
85
|
+
// effect: function (e) {
|
|
86
|
+
// var state = e.state;
|
|
87
|
+
// state.elements.popper.style.width = state.elements.reference.offsetWidth + "px";
|
|
88
|
+
// }
|
|
89
|
+
// }
|
|
90
|
+
],
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
$timeout(function () {
|
|
95
|
+
$scope.setupPopper();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// -----------------------------------Open -----------------------------------
|
|
99
|
+
$scope.toggle = function () {
|
|
100
|
+
if ($scope.isOpen) {
|
|
101
|
+
$scope.close();
|
|
102
|
+
} else {
|
|
103
|
+
$scope.open();
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
$scope.close = function () {
|
|
108
|
+
$scope.isOpen = false;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
$scope.open = function () {
|
|
112
|
+
$scope.popper.update();
|
|
113
|
+
$scope.isOpen = true;
|
|
114
|
+
$timeout(function () {
|
|
115
|
+
$scope.popper.update();
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
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[data-popper-placement^='top']>.nice-popup-arrow {
|
|
26
|
+
bottom: -4px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.nice-popup-content[data-popper-placement^='bottom']>.nice-popup-arrow {
|
|
30
|
+
top: -4px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.nice-popup-content[data-popper-placement^='left']>.nice-popup-arrow {
|
|
34
|
+
right: -4px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.nice-popup-content[data-popper-placement^='right']>.nice-popup-arrow {
|
|
38
|
+
left: -4px;
|
|
39
|
+
}
|
|
40
|
+
}
|