nice-elements 1.15.1 → 1.16.1

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/CLAUDE.md +1 -0
  3. package/README.md +1 -1
  4. package/bower.json +1 -1
  5. package/dist/nice.js +620 -509
  6. package/dist/nice.min.js +1 -1
  7. package/dist/style.css +145 -126
  8. package/dist/style.css.map +1 -1
  9. package/dist/style.min.css +2 -2
  10. package/package.json +5 -6
  11. package/src/components/nice-calendar/nice-calendar.html +3 -4
  12. package/src/components/nice-calendar/nice-calendar.scss +0 -9
  13. package/src/components/nice-date/nice-date-picker.html +60 -0
  14. package/src/components/nice-date/nice-date.html +29 -86
  15. package/src/components/nice-date/nice-date.js +7 -35
  16. package/src/components/nice-date/nice-date.scss +6 -15
  17. package/src/components/nice-datetime-picker/nice-datetime-picker.html +1 -4
  18. package/src/components/nice-datetime-picker/nice-datetime-picker.scss +9 -12
  19. package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.html +1 -3
  20. package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html +32 -30
  21. package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +1 -33
  22. package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.scss +7 -12
  23. package/src/components/nice-dropdown/nice-dropdown.html +42 -40
  24. package/src/components/nice-dropdown/nice-dropdown.js +52 -54
  25. package/src/components/nice-dropdown/nice-dropdown.scss +25 -4
  26. package/src/components/nice-dropdown-old/nice-dropdown-old.html +1 -1
  27. package/src/components/nice-dropdown-old/nice-dropdown-old.scss +8 -2
  28. package/src/components/nice-dtp/nice-dtp.html +7 -7
  29. package/src/components/nice-notification/nice-notification.html +6 -6
  30. package/src/components/nice-notification/nice-notification.scss +7 -6
  31. package/src/components/nice-options/nice-options.scss +4 -0
  32. package/src/components/nice-popup/nice-popup.html +4 -4
  33. package/src/components/nice-popup/nice-popup.js +61 -75
  34. package/src/components/nice-popup/nice-popup.scss +10 -31
  35. package/src/components/nice-search/nice-search.html +21 -26
  36. package/src/components/nice-search/nice-search.js +9 -12
  37. package/src/components/nice-search/nice-search.scss +9 -10
  38. package/src/components/nice-search2/nice-search2.html +22 -18
  39. package/src/components/nice-search2/nice-search2.js +12 -56
  40. package/src/components/nice-search2/nice-search2.scss +3 -2
  41. package/src/components/nice-svgs/nice-svgs.html +8 -0
  42. package/src/components/nice-time-picker/nice-time-picker.html +1 -3
  43. package/src/components/nice-time-picker/nice-time-picker.scss +0 -8
  44. package/src/directives/nice-tooltip/_nice-tooltip.scss +7 -28
  45. package/src/directives/nice-tooltip/nice-tooltip.js +16 -29
  46. package/src/services/nice-service.js +236 -1
  47. package/src/styles/_nice-anchored.scss +75 -0
  48. package/src/styles/_nice.scss +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.15.1",
3
+ "version": "1.16.1",
4
4
  "description": "Nice elements used in olaii angular 1.x webapps.",
5
5
  "main": "dist/nice.js",
6
6
  "license": "MIT",
@@ -21,7 +21,6 @@
21
21
  "angular-truncate": "latest",
22
22
  "bootstrap": "3.3.7",
23
23
  "decimal.js": "10.2.1",
24
- "font-awesome": "4.7.0",
25
24
  "lodash": "3.9.3",
26
25
  "moment": "2.29.4",
27
26
  "ng-dialog": "0.5.6"
@@ -35,11 +34,11 @@
35
34
  "grunt-angular-templates": "1.2.0",
36
35
  "grunt-contrib-clean": "2.0.0",
37
36
  "grunt-contrib-concat": "1.0.1",
38
- "grunt-contrib-cssmin": "4.0.0",
37
+ "grunt-contrib-cssmin": "5.0.0",
39
38
  "grunt-contrib-jshint": "3.0.0",
40
39
  "grunt-contrib-uglify": "5.0.1",
41
- "grunt-sass": "3.1.0",
40
+ "grunt-sass": "4.1.0",
42
41
  "load-grunt-tasks": "5.1.0",
43
- "sass": "1.107.1"
42
+ "sass": "1.108.2"
44
43
  }
45
- }
44
+ }
@@ -43,7 +43,7 @@
43
43
  ng-click="previous()"
44
44
  ng-disabled="isDisabled"
45
45
  >
46
- <i class="fa fa-angle-left"></i>
46
+ <nice-icon icon="icon-chevron-left"></nice-icon>
47
47
  </button>
48
48
 
49
49
  <!-- Today -->
@@ -54,7 +54,7 @@
54
54
  ng-click="today()"
55
55
  ng-disabled="isDisabled"
56
56
  >
57
- <nice-icon icon="icon-circle"></nice-icon>
57
+ <nice-icon icon="icon-dot"></nice-icon>
58
58
  </button>
59
59
 
60
60
  <!-- Next month -->
@@ -65,7 +65,7 @@
65
65
  ng-click="next()"
66
66
  ng-disabled="isDisabled"
67
67
  >
68
- <i class="fa fa-angle-right"></i>
68
+ <nice-icon icon="icon-chevron-right"></nice-icon>
69
69
  </button>
70
70
  </div>
71
71
 
@@ -157,7 +157,6 @@
157
157
  </div>
158
158
 
159
159
  <div class="time-picker-icon">
160
- <!-- <i class="fa fa-clock-o"></i> -->
161
160
  <nice-icon icon="icon-clock"></nice-icon>
162
161
  </div>
163
162
 
@@ -141,15 +141,6 @@
141
141
  flex-shrink: 0;
142
142
  color: white;
143
143
  background: transparent;
144
-
145
- &.fa-angle-left {
146
- text-align: left;
147
- }
148
-
149
- &.fa-angle-right {
150
- text-align: right;
151
- margin-left: $icon-width*-1;
152
- }
153
144
  }
154
145
 
155
146
  .nice-calendar-header-selects {
@@ -0,0 +1,60 @@
1
+ <!------------------------------ Date picker ------------------------------>
2
+ <div class="nice-date-date" ng-if="date" role="grid">
3
+ <div class="nice-date-header">
4
+ <span>
5
+ <select class="year-picker" ng-model="innerDate.year" ng-change="handleDateChange()" ng-options="year for year in years" ng-disabled="isDisabled"></select>
6
+ <span class="nice-date-header-comma">,</span>
7
+ <select class="month-picker" ng-model="innerDate.month" ng-change="handleDateChange()" ng-options="month.value as month.name for month in months" ng-disabled="isDisabled"></select>
8
+ </span>
9
+ <button type="button" class="btn btn-default-naked" ng-disabled="isDisabled" ng-click="previous()" title="{{ 'Previous month' | translate:'Nice' }}">
10
+ <nice-icon icon="icon-chevron-left"></nice-icon>
11
+ </button>
12
+ <button type="button" class="btn btn-default-naked" ng-disabled="isDisabled" ng-click="today()" title="{{ 'Today' | translate:'Nice' }}">
13
+ <nice-icon icon="icon-dot"></nice-icon>
14
+ </button>
15
+ <button type="button" class="btn btn-default-naked" ng-disabled="isDisabled" ng-click="next()" title="{{ 'Next month' | translate:'Nice' }}">
16
+ <nice-icon icon="icon-chevron-right"></nice-icon>
17
+ </button>
18
+ </div>
19
+
20
+ <div class="nice-date-grid nice-date-grid-names">
21
+ <span class="nice-date-day" ng-class="{ 'weekend': $index == 6 || $index == 5 }" ng-repeat="day in weekdays">{{ day }}</span>
22
+ </div>
23
+
24
+ <div class="nice-date-grid">
25
+ <button
26
+ type="button"
27
+ class="nice-date-day"
28
+ role="gridcell"
29
+ title="{{ day.text }}"
30
+ ng-class="{
31
+ 'today': day.isToday,
32
+ 'different-month': !day.isCurrentMonth,
33
+ 'selected': isSameDay(model, day.date),
34
+ 'weekend': day.isWeekday,
35
+ 'disabled': day.isDisabled,
36
+ 'between': isBetween(day.date, model, nextDate)
37
+ }"
38
+ ng-click="select(day)"
39
+ ng-repeat="day in days"
40
+ ng-disabled="isDisabled"
41
+ >
42
+ <span>{{ day.name }}</span>
43
+ </button>
44
+ </div>
45
+ </div>
46
+
47
+ <!------------------------------ Time picker ------------------------------>
48
+ <div class="nice-date-time" ng-if="time">
49
+ <nice-icon icon="icon-clock"></nice-icon>
50
+
51
+ <div class="time-picker time-picker-hour">
52
+ <select ng-disabled="isDisabled" ng-model="innerDate.hour" ng-change="timeChange()" ng-options="hour as hour for hour in hours track by hour" ng-disabled="isDisabled"></select>
53
+ </div>
54
+
55
+ <div class="divider">:</div>
56
+
57
+ <div class="time-picker time-picker-minute">
58
+ <select ng-disabled="isDisabled" ng-model="innerDate.minute" ng-change="timeChange()" ng-options="minute as minute for minute in minutes track by minute" ng-disabled="isDisabled"></select>
59
+ </div>
60
+ </div>
@@ -1,101 +1,44 @@
1
1
  <div class="nice-component nice-date" ng-form="forma" ng-class="{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline }">
2
- <div class="nice-date-background" ng-click="toggleOpen()" ng-if="isOpen && !inline"></div>
3
-
4
2
  <div class="row">
5
3
  <!------------------------- Title ------------------------->
6
4
  <nice-title text="title || niceTitle" help="help" required="required" description="description" label-width="labelWidth"></nice-title>
7
5
 
8
6
  <!------------------------- Field ------------------------->
9
- <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
7
+ <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]" click-outside="close()">
10
8
  <div class="disabled-shield" ng-if="isDisabled"></div>
11
9
 
12
- <!------------------------------ Input ------------------------------>
13
- <div class="nice-date-button input-group" ng-class="{ 'open': isOpen }" ng-show="!inline" ng-click="toggleOpen()">
14
- <input
15
- type="text"
16
- class="form-control"
17
- ng-model="innerDate.value"
18
- placeholder="{{ placeholder }}"
19
- ng-required="required"
20
- ng-disabled="isDisabled"
21
- ng-blur="parseTypedDate()"
22
- ng-keydown="typedDateKeydown($event)"
23
- />
24
- <span class="input-group-btn">
25
- <button type="button" class="btn btn-default btn-right" ng-disabled="isDisabled" ng-if="!(model && nullable)">
26
- <nice-icon icon="icon-calendar"></nice-icon>
27
- </button>
28
- <button type="button" class="btn btn-default btn-right" ng-disabled="isDisabled" ng-if="model && nullable" ng-click="clear()">
29
- <nice-icon icon="icon-x"></nice-icon>
30
- </button>
31
- </span>
32
- </div>
33
-
34
- <!-------- Dropdown -------->
35
- <div ng-class="{ 'nice-date-dropdown-wrapper': !inline }">
36
- <div ng-class="{ 'nice-date-dropdown': !inline, 'with-time': time, 'no-date': !date }" ng-if="inline || isOpen">
37
- <!------------------------------ Date picker ------------------------------>
38
- <div class="nice-date-date" ng-if="date" role="grid">
39
- <div class="nice-date-header">
40
- <span>
41
- <select class="year-picker" ng-model="innerDate.year" ng-change="handleDateChange()" ng-options="year for year in years" ng-disabled="isDisabled"></select>
42
- <span class="nice-date-header-comma">,</span>
43
- <select class="month-picker" ng-model="innerDate.month" ng-change="handleDateChange()" ng-options="month.value as month.name for month in months" ng-disabled="isDisabled"></select>
44
- </span>
45
- <button type="button" class="btn btn-default-naked" ng-disabled="isDisabled" ng-click="previous()" title="{{ 'Previous month' | translate:'Nice' }}">
46
- <nice-icon icon="icon-chevron-left"></nice-icon>
47
- </button>
48
- <button type="button" class="btn btn-default-naked" ng-disabled="isDisabled" ng-click="today()" title="{{ 'Today' | translate:'Nice' }}">
49
- <nice-icon icon="icon-circle"></nice-icon>
10
+ <!------------------------------ Input + dropdown ------------------------------>
11
+ <nice-popup ng-show="!inline" trigger="manual" is-open="isOpen" placement="{{ placement }}">
12
+ <nice-popup-target>
13
+ <div class="nice-date-button input-group" ng-class="{ 'open': isOpen }" ng-click="toggleOpen()">
14
+ <input
15
+ type="text"
16
+ class="form-control"
17
+ ng-model="innerDate.value"
18
+ placeholder="{{ placeholder }}"
19
+ ng-required="required"
20
+ ng-disabled="isDisabled"
21
+ ng-blur="parseTypedDate()"
22
+ ng-keydown="typedDateKeydown($event)"
23
+ />
24
+ <span class="input-group-btn">
25
+ <button type="button" class="btn btn-default btn-right" ng-disabled="isDisabled" ng-if="!(model && nullable)">
26
+ <nice-icon icon="icon-calendar"></nice-icon>
50
27
  </button>
51
- <button type="button" class="btn btn-default-naked" ng-disabled="isDisabled" ng-click="next()" title="{{ 'Next month' | translate:'Nice' }}">
52
- <nice-icon icon="icon-chevron-right"></nice-icon>
28
+ <button type="button" class="btn btn-default btn-right" ng-disabled="isDisabled" ng-if="model && nullable" ng-click="clear()">
29
+ <nice-icon icon="icon-x"></nice-icon>
53
30
  </button>
54
- </div>
55
-
56
- <div class="nice-date-grid nice-date-grid-names">
57
- <span class="nice-date-day" ng-class="{ 'weekend': $index == 6 || $index == 5 }" ng-repeat="day in weekdays">{{ day }}</span>
58
- </div>
59
-
60
- <div class="nice-date-grid">
61
- <button
62
- type="button"
63
- class="nice-date-day"
64
- role="gridcell"
65
- title="{{ day.text }}"
66
- ng-class="{
67
- 'today': day.isToday,
68
- 'different-month': !day.isCurrentMonth,
69
- 'selected': isSameDay(model, day.date),
70
- 'weekend': day.isWeekday,
71
- 'disabled': day.isDisabled,
72
- 'between': isBetween(day.date, model, nextDate)
73
- }"
74
- ng-click="select(day)"
75
- ng-repeat="day in days"
76
- ng-disabled="isDisabled"
77
- >
78
- <span>{{ day.name }}</span>
79
- </button>
80
- </div>
31
+ </span>
81
32
  </div>
33
+ </nice-popup-target>
82
34
 
83
- <!------------------------------ Time picker ------------------------------>
84
- <div class="nice-date-time" ng-if="time">
85
- <nice-icon icon="icon-clock"></nice-icon>
86
-
87
- <div class="time-picker time-picker-hour">
88
- <select ng-disabled="isDisabled" ng-model="innerDate.hour" ng-change="timeChange()" ng-options="hour as hour for hour in hours track by hour" ng-disabled="isDisabled"></select>
89
- </div>
35
+ <nice-popup-content>
36
+ <div class="nice-date-dropdown" ng-class="{ 'with-time': time, 'no-date': !date }" ng-include="'src/components/nice-date/nice-date-picker.html'"></div>
37
+ </nice-popup-content>
38
+ </nice-popup>
90
39
 
91
- <div class="divider">:</div>
92
-
93
- <div class="time-picker time-picker-minute">
94
- <select ng-disabled="isDisabled" ng-model="innerDate.minute" ng-change="timeChange()" ng-options="minute as minute for minute in minutes track by minute" ng-disabled="isDisabled"></select>
95
- </div>
96
- </div>
97
- </div>
98
- </div>
40
+ <!------------------------------ Inline ------------------------------>
41
+ <div ng-if="inline" ng-class="{ 'with-time': time, 'no-date': !date }" ng-include="'src/components/nice-date/nice-date-picker.html'"></div>
99
42
  </div>
100
43
  </div>
101
- </div>
44
+ </div>
@@ -34,7 +34,7 @@ angular.module('niceElements')
34
34
  required: '=',
35
35
  nullable: '=',
36
36
  placeholder: '@',
37
- placement: '@', // Describes the preferred placement of the popper
37
+ placement: '@', // Preferred placement of the dropdown (nice-popup)
38
38
  },
39
39
  controller: function ($scope, $attrs, $element, $timeout, gettextCatalog, NiceService) {
40
40
  NiceService.bindFlag($scope, $attrs, 'inline');
@@ -97,37 +97,6 @@ angular.module('niceElements')
97
97
  if ($scope.minDate) $scope.minDate = moment($scope.minDate);
98
98
 
99
99
 
100
- // Setup popper
101
- // https://popper.js.org/docs/v2/constructors/
102
- $scope.setupPopper = function () {
103
- const button = $element[0].getElementsByClassName('nice-date-button')[0];
104
- const tooltip = $element[0].getElementsByClassName('nice-date-dropdown-wrapper')[0];
105
- $scope.popper = Popper.createPopper(button, tooltip, {
106
- strategy: 'fixed',
107
- placement: $scope.placement,
108
- modifiers: [
109
- {
110
- name: 'offset',
111
- options: {
112
- offset: [0, 5],
113
- },
114
- }
115
- ],
116
- });
117
- };
118
-
119
- const setupTimer = $timeout(function () {
120
- if (!$scope.inline) $scope.setupPopper();
121
- }, 100);
122
-
123
- // Popper adds scroll/resize listeners to window; remove them with the component
124
- $scope.$on('$destroy', function () {
125
- $timeout.cancel(setupTimer);
126
- if ($scope.popper) $scope.popper.destroy();
127
- $scope.popper = null;
128
- });
129
-
130
-
131
100
  // ------------------ Time changes ------------------
132
101
  $scope.timeChange = function () {
133
102
  let selectedDate = angular.copy($scope.model);
@@ -426,13 +395,16 @@ angular.module('niceElements')
426
395
  $scope.bootstrap();
427
396
 
428
397
 
398
+ // ------------------ Close (click outside) ------------------
399
+ $scope.close = function () {
400
+ $scope.isOpen = false;
401
+ };
402
+
403
+
429
404
  // ------------------ Toggle open ------------------
430
405
  $scope.toggleOpen = function () {
431
406
  if (!$scope.isDisabled) {
432
407
  $scope.isOpen = !$scope.isOpen;
433
- $timeout(function () {
434
- if ($scope.popper) $scope.popper.update();
435
- });
436
408
  }
437
409
  };
438
410
  }
@@ -2,8 +2,12 @@
2
2
  $spacing: 10px;
3
3
  $icon-width: 40px;
4
4
 
5
- .nice-date-dropdown-wrapper {
6
- z-index: 1000;
5
+ // Dropdown is a nice-popup
6
+ .nice-popup-target {
7
+ display: block;
8
+ }
9
+
10
+ .nice-popup-content {
7
11
  width: 300px;
8
12
  }
9
13
 
@@ -12,15 +16,6 @@
12
16
  line-height: normal;
13
17
  }
14
18
 
15
- .nice-date-background {
16
- position: fixed;
17
- top: 0;
18
- left: 0;
19
- width: 100%;
20
- z-index: 999;
21
- height: 100%;
22
- }
23
-
24
19
  .input-group {
25
20
  cursor: pointer;
26
21
  width: 100%;
@@ -86,10 +81,6 @@
86
81
  background: var(--nice-primary-color-lighter);
87
82
  color: white;
88
83
  }
89
-
90
- .fa-circle {
91
- font-size: 8px;
92
- }
93
84
  }
94
85
 
95
86
  .nice-date-header-comma {
@@ -1,12 +1,10 @@
1
1
  <div class="nice-component nice-datetime-picker" name="form" ng-class="{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline }">
2
- <div class="nice-dtp-background" ng-click="closeDtp(true)" ng-if="isOpen"></div>
3
-
4
2
  <div class="row">
5
3
  <!------------------------- Title ------------------------->
6
4
  <nice-title text="title || niceTitle" help="help" required="required" description="description" label-width="labelWidth"></nice-title>
7
5
 
8
6
  <!------------------------- Field ------------------------->
9
- <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
7
+ <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]" click-outside="closeDtp(true)" is-open="{{ isOpen }}">
10
8
  <!--Needed for intercepting form changes ($dirty)!-->
11
9
  <div ng-form="formDatetimePicker"></div>
12
10
 
@@ -14,7 +12,6 @@
14
12
  <input type="text" class="form-control" value="{{ value }}" ng-click="openDtp()" ng-disabled="isDisabled">
15
13
  <span class="input-group-btn">
16
14
  <button type="button" class="btn btn-default" ng-click="openDtp()">
17
- <!-- <i class="fa" ng-class="date == 'true' ? 'fa-calendar' : 'fa-clock-o'"></i> -->
18
15
  <nice-icon ng-if="isTrue(date)" icon="icon-calendar"></nice-icon>
19
16
  <nice-icon ng-if="!isTrue(date)" icon="icon-clock"></nice-icon>
20
17
  </button>
@@ -179,10 +179,16 @@ $color_gallery_approx: #eee;
179
179
 
180
180
  >a {
181
181
  color: $white;
182
+ }
183
+ }
182
184
 
183
- >i {
184
- font-size: 1em;
185
- }
185
+ .dtp-close,
186
+ .p10 {
187
+ .nice-icon {
188
+ display: inline-flex;
189
+ vertical-align: middle;
190
+ width: 16px;
191
+ height: 16px;
186
192
  }
187
193
  }
188
194
 
@@ -418,12 +424,3 @@ $color_gallery_approx: #eee;
418
424
  user-select: none;
419
425
  }
420
426
  }
421
-
422
- .nice-dtp-background {
423
- position: fixed;
424
- top: 0;
425
- left: 0;
426
- width: 100%;
427
- z-index: 199;
428
- height: 100%;
429
- }
@@ -1,12 +1,10 @@
1
1
  <div class="nice-component nice-datetime-picker nice-datetimerange-picker" name="form" ng-class="{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline }">
2
- <div class="nice-dtp-background" ng-click="cancelClick()" ng-if="showDtpRange"></div>
3
-
4
2
  <div class="row">
5
3
  <!------------------------- Title ------------------------->
6
4
  <nice-title text="title || niceTitle" help="help" required="required" description="description" label-width="labelWidth"></nice-title>
7
5
 
8
6
  <!------------------------- Field ------------------------->
9
- <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
7
+ <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]" click-outside="cancelClick()" is-open="{{ showDtpRange }}">
10
8
  <!--Needed for intercepting form changes ($dirty)!-->
11
9
  <div ng-form="formDatetimeRangePicker"></div>
12
10
 
@@ -1,45 +1,47 @@
1
1
  <div class="nice-component nice-datetimerange-picker-2" ng-form="formDateRangePicker" ng-class="{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline }">
2
- <div class="nice-dtp-background" ng-click="close()" ng-if="isOpen"></div>
3
-
4
2
  <div class="row">
5
3
  <!------------------------- Title ------------------------->
6
4
  <nice-title text="title || niceTitle" help="help" required="required" description="description" label-width="labelWidth"></nice-title>
7
5
 
8
6
  <!------------------------- Field ------------------------->
9
- <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
10
- <div class="nice-daterange-picker-button input-group" ng-class="{ 'open': isOpen }" ng-click="open()">
11
- <input type="text" class="form-control" value="{{ modelFormat }}" readonly="readonly" ng-disabled="isDisabled" />
12
- <!-- <div class="form-control" title="{{ modelFormat }}">{{ modelFormat }}</div> -->
13
- <button type="button" class="btn input-group-addon" ng-disabled="isDisabled">
14
- <nice-icon icon="icon-calendar"></nice-icon>
15
- </button>
16
- </div>
7
+ <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]" click-outside="isOpen && close()">
8
+ <nice-popup trigger="manual" is-open="isOpen" placement="{{ placement }}" on-change="isOpen || close()">
9
+ <nice-popup-target>
10
+ <div class="nice-daterange-picker-button input-group" ng-class="{ 'open': isOpen }" ng-click="open()">
11
+ <input type="text" class="form-control" value="{{ modelFormat }}" readonly="readonly" ng-disabled="isDisabled" />
12
+ <!-- <div class="form-control" title="{{ modelFormat }}">{{ modelFormat }}</div> -->
13
+ <button type="button" class="btn input-group-addon" ng-disabled="isDisabled">
14
+ <nice-icon icon="icon-calendar"></nice-icon>
15
+ </button>
16
+ </div>
17
+ </nice-popup-target>
17
18
 
18
- <div class="nice-daterange-picker-wrapper">
19
- <div class="dtp-wrapper" ng-if="isOpen">
20
- <div class="dtp-buttons-left">
21
- <div class="dtp-buttons-top">
22
- <a class="btn btn-primary btn-block" ng-click="selectToday()" translate translate-context="Nice">Last 24 hours</a>
23
- <a class="btn btn-primary btn-block" ng-click="selectLastNDays(7)" translate translate-context="Nice">Last 7 days</a>
24
- <a class="btn btn-primary btn-block" ng-click="selectLastMonth()" translate translate-context="Nice">Last month</a>
25
- <a class="btn btn-primary btn-block" ng-click="selectThisMonth()" translate translate-context="Nice">This month</a>
26
- </div>
19
+ <nice-popup-content>
20
+ <div class="dtp-wrapper">
21
+ <div class="dtp-buttons-left">
22
+ <div class="dtp-buttons-top">
23
+ <a class="btn btn-primary btn-block" ng-click="selectToday()" translate translate-context="Nice">Last 24 hours</a>
24
+ <a class="btn btn-primary btn-block" ng-click="selectLastNDays(7)" translate translate-context="Nice">Last 7 days</a>
25
+ <a class="btn btn-primary btn-block" ng-click="selectLastMonth()" translate translate-context="Nice">Last month</a>
26
+ <a class="btn btn-primary btn-block" ng-click="selectThisMonth()" translate translate-context="Nice">This month</a>
27
+ </div>
27
28
 
28
- <div class="dtp-buttons-bottom">
29
- <a class="btn btn-danger btn-block" ng-click="close()" translate translate-context="Nice">Cancel</a>
30
- <a class="btn btn-success btn-block" ng-click="confirm()" translate translate-context="Nice">OK</a>
29
+ <div class="dtp-buttons-bottom">
30
+ <a class="btn btn-danger btn-block" ng-click="close()" translate translate-context="Nice">Cancel</a>
31
+ <a class="btn btn-success btn-block" ng-click="confirm()" translate translate-context="Nice">OK</a>
32
+ </div>
31
33
  </div>
32
- </div>
33
34
 
34
- <div class="dtp-left">
35
- <nice-date model="model.innerStartDate" next-date="model.innerEndDate" is-inline="true" no-margin="true" inline="true" time="time" min-date="minDate" max-date="maxDate" on-change="dateChanged(model)"></nice-date>
36
- </div>
35
+ <div class="dtp-left">
36
+ <nice-date model="model.innerStartDate" next-date="model.innerEndDate" is-inline="true" no-margin="true" inline="true" time="time" min-date="minDate" max-date="maxDate" on-change="dateChanged(model)"></nice-date>
37
+ </div>
37
38
 
38
- <div class="dtp-right">
39
- <nice-date model="model.innerEndDate" next-date="model.innerStartDate" is-inline="true" no-margin="true" inline="true" time="time" min-date="minDate" max-date="maxDate" on-change="dateChanged(model)"></nice-date>
39
+ <div class="dtp-right">
40
+ <nice-date model="model.innerEndDate" next-date="model.innerStartDate" is-inline="true" no-margin="true" inline="true" time="time" min-date="minDate" max-date="maxDate" on-change="dateChanged(model)"></nice-date>
41
+ </div>
40
42
  </div>
41
- </div>
42
- </div>
43
+ </nice-popup-content>
44
+ </nice-popup>
43
45
  </div>
44
46
  </div>
45
47
  </div>
@@ -28,7 +28,7 @@ angular.module('niceElements')
28
28
  isInline: '=',
29
29
  onChange: '&?',
30
30
  required: '=',
31
- placement: '@', // Describes the preferred placement of the popper
31
+ placement: '@', // Preferred placement of the dropdown (nice-popup)
32
32
  },
33
33
  templateUrl: 'src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html',
34
34
  controller: function ($element, $timeout, $scope) {
@@ -64,37 +64,6 @@ angular.module('niceElements')
64
64
  }
65
65
 
66
66
 
67
- // Setup popper
68
- // https://popper.js.org/docs/v2/constructors/
69
- $scope.setupPopper = function () {
70
- const button = $element[0].getElementsByClassName('nice-daterange-picker-button')[0];
71
- const tooltip = $element[0].getElementsByClassName('nice-daterange-picker-wrapper')[0];
72
- $scope.popper = Popper.createPopper(button, tooltip, {
73
- strategy: 'fixed',
74
- placement: $scope.placement,
75
- modifiers: [
76
- {
77
- name: 'offset',
78
- options: {
79
- offset: [0, 5],
80
- },
81
- }
82
- ],
83
- });
84
- };
85
-
86
- const setupTimer = $timeout(function () {
87
- $scope.setupPopper();
88
- });
89
-
90
- // Popper adds scroll/resize listeners to window; remove them with the component
91
- $scope.$on('$destroy', function () {
92
- $timeout.cancel(setupTimer);
93
- if ($scope.popper) $scope.popper.destroy();
94
- $scope.popper = null;
95
- });
96
-
97
-
98
67
  $scope.format = function () {
99
68
  $scope.modelFormat = $scope.startDate.format($scope.formatString) + " - " + $scope.endDate.format($scope.formatString);
100
69
  };
@@ -103,7 +72,6 @@ angular.module('niceElements')
103
72
  $scope.open = function () {
104
73
  if (!$scope.isDisabled) {
105
74
  $scope.isOpen = true;
106
- if ($scope.popper) $scope.popper.update();
107
75
  }
108
76
  };
109
77
 
@@ -10,10 +10,14 @@
10
10
  &.open {}
11
11
  }
12
12
 
13
- .nice-daterange-picker-wrapper {
14
- z-index: 900;
13
+ // Dropdown is a nice-popup
14
+ .nice-popup-target {
15
+ display: block;
16
+ }
17
+
18
+ .nice-popup-content {
15
19
  width: 700px;
16
- max-width: 80%;
20
+ max-width: 80vw;
17
21
  }
18
22
 
19
23
  .dtp-wrapper {
@@ -73,15 +77,6 @@
73
77
  }
74
78
 
75
79
 
76
- .nice-dtp-background {
77
- position: fixed;
78
- top: 0;
79
- left: 0;
80
- width: 100%;
81
- z-index: 800;
82
- height: 100%;
83
- }
84
-
85
80
  .btn {
86
81
  border-radius: $nice-border-radius;
87
82
  }