nice-elements 1.15.0 → 1.16.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/.claude/launch.json +11 -0
- package/CHANGELOG.md +24 -0
- package/CLAUDE.md +1 -0
- package/README.md +1 -1
- package/bower.json +1 -1
- package/dist/nice.js +688 -495
- package/dist/nice.min.js +1 -1
- package/dist/style.css +140 -114
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +2 -2
- package/package.json +5 -6
- package/src/components/nice-calendar/nice-calendar.html +7 -4
- package/src/components/nice-calendar/nice-calendar.scss +0 -9
- package/src/components/nice-checkbox/nice-checkbox.html +10 -4
- package/src/components/nice-checkbox/nice-checkbox.js +1 -0
- package/src/components/nice-checkbox/nice-checkbox.scss +7 -0
- package/src/components/nice-choice/nice-choice.js +11 -0
- package/src/components/nice-date/nice-date-picker.html +60 -0
- package/src/components/nice-date/nice-date.html +29 -77
- package/src/components/nice-date/nice-date.js +54 -35
- package/src/components/nice-date/nice-date.scss +7 -15
- package/src/components/nice-date-input/nice-date-input.js +1 -1
- package/src/components/nice-date-range/nice-date-range.html +1 -1
- package/src/components/nice-datetime-picker/nice-datetime-picker.html +4 -4
- package/src/components/nice-datetime-picker/nice-datetime-picker.scss +9 -12
- package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.html +1 -3
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html +32 -30
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +1 -33
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.scss +7 -12
- package/src/components/nice-dropdown/nice-dropdown.html +42 -40
- package/src/components/nice-dropdown/nice-dropdown.js +64 -57
- package/src/components/nice-dropdown/nice-dropdown.scss +25 -15
- package/src/components/nice-dropdown-old/nice-dropdown-old.html +1 -1
- package/src/components/nice-dropdown-old/nice-dropdown-old.scss +8 -2
- package/src/components/nice-dtp/nice-dtp.html +7 -7
- package/src/components/nice-options/nice-options.scss +4 -0
- package/src/components/nice-percent/nice-percent.js +10 -3
- package/src/components/nice-popup/nice-popup.html +4 -4
- package/src/components/nice-popup/nice-popup.js +61 -75
- package/src/components/nice-popup/nice-popup.scss +10 -31
- package/src/components/nice-search/nice-search.html +0 -3
- package/src/components/nice-search/nice-search.js +8 -14
- package/src/components/nice-search2/nice-search2.html +22 -18
- package/src/components/nice-search2/nice-search2.js +2 -56
- package/src/components/nice-search2/nice-search2.scss +3 -2
- package/src/components/nice-svgs/nice-svgs.html +8 -0
- package/src/components/nice-time-picker/nice-time-picker.html +1 -3
- package/src/components/nice-time-picker/nice-time-picker.scss +0 -8
- package/src/components/nice-toggle/nice-toggle.html +3 -0
- package/src/components/nice-upload/nice-upload.html +1 -1
- package/src/components/nice-yesno/nice-yesno.html +3 -0
- package/src/directives/nice-tooltip/_nice-tooltip.scss +7 -28
- package/src/directives/nice-tooltip/nice-tooltip.js +16 -29
- package/src/services/nice-service.js +236 -1
- package/src/styles/_nice-anchored.scss +75 -0
- package/src/styles/_nice-common.scss +17 -0
- 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.
|
|
3
|
+
"version": "1.16.0",
|
|
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": "
|
|
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": "
|
|
40
|
+
"grunt-sass": "4.1.0",
|
|
42
41
|
"load-grunt-tasks": "5.1.0",
|
|
43
|
-
"sass": "1.
|
|
42
|
+
"sass": "1.108.2"
|
|
44
43
|
}
|
|
45
|
-
}
|
|
44
|
+
}
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
<div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
|
|
8
8
|
<div class="disabled-shield" ng-if="isDisabled"></div>
|
|
9
9
|
|
|
10
|
+
<!-- Only for form validation (start and end date have to be set when required) -->
|
|
11
|
+
<input class="hidden-input" ng-model="startDate" ng-required="required" tabindex="-1" />
|
|
12
|
+
<input class="hidden-input" ng-model="endDate" ng-required="required" tabindex="-1" />
|
|
13
|
+
|
|
10
14
|
<div class="nice-calendar-wrapper">
|
|
11
15
|
<div class="nice-calendar-weeks">
|
|
12
16
|
<div class="nice-calendar-header">
|
|
@@ -39,7 +43,7 @@
|
|
|
39
43
|
ng-click="previous()"
|
|
40
44
|
ng-disabled="isDisabled"
|
|
41
45
|
>
|
|
42
|
-
<
|
|
46
|
+
<nice-icon icon="icon-chevron-left"></nice-icon>
|
|
43
47
|
</button>
|
|
44
48
|
|
|
45
49
|
<!-- Today -->
|
|
@@ -50,7 +54,7 @@
|
|
|
50
54
|
ng-click="today()"
|
|
51
55
|
ng-disabled="isDisabled"
|
|
52
56
|
>
|
|
53
|
-
<nice-icon icon="icon-
|
|
57
|
+
<nice-icon icon="icon-dot"></nice-icon>
|
|
54
58
|
</button>
|
|
55
59
|
|
|
56
60
|
<!-- Next month -->
|
|
@@ -61,7 +65,7 @@
|
|
|
61
65
|
ng-click="next()"
|
|
62
66
|
ng-disabled="isDisabled"
|
|
63
67
|
>
|
|
64
|
-
<
|
|
68
|
+
<nice-icon icon="icon-chevron-right"></nice-icon>
|
|
65
69
|
</button>
|
|
66
70
|
</div>
|
|
67
71
|
|
|
@@ -153,7 +157,6 @@
|
|
|
153
157
|
</div>
|
|
154
158
|
|
|
155
159
|
<div class="time-picker-icon">
|
|
156
|
-
<!-- <i class="fa fa-clock-o"></i> -->
|
|
157
160
|
<nice-icon icon="icon-clock"></nice-icon>
|
|
158
161
|
</div>
|
|
159
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 {
|
|
@@ -9,10 +9,16 @@
|
|
|
9
9
|
}"
|
|
10
10
|
ng-click="toggle()"
|
|
11
11
|
>
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
<span class="nice-checkbox-box">
|
|
13
|
+
<button type="button" class="btn nice-checkbox-checkbox" ng-disabled="isDisabled">
|
|
14
|
+
<nice-icon ng-if="model" class="nice-checkbox-check" icon="icon-check"></nice-icon>
|
|
15
|
+
<nice-icon ng-if="!model && indeterminate" class="nice-checkbox-check" icon="icon-minus"></nice-icon>
|
|
16
|
+
</button>
|
|
17
|
+
|
|
18
|
+
<!-- Only for form validation (checkbox must be checked when required).
|
|
19
|
+
Placed next to the box so the browser "required" bubble points at it. -->
|
|
20
|
+
<input type="checkbox" class="hidden-input" ng-model="model" ng-required="required" tabindex="-1" />
|
|
21
|
+
</span>
|
|
16
22
|
<div class="nice-checkbox-info" ng-transclude>
|
|
17
23
|
<nice-title text="title || niceTitle" help="help" required="required" description="niceDescription" label-width="col-xs-12"></nice-title>
|
|
18
24
|
<!-- <div ng-if="title || niceTitle" class="nice-checkbox-message" ng-class="{ 'nice-disabled': isDisabled }">{{ title || niceTitle }}</div> -->
|
|
@@ -29,6 +29,7 @@ angular.module('niceElements')
|
|
|
29
29
|
multiple: '=?',
|
|
30
30
|
help: '@',
|
|
31
31
|
isInline: '=?',
|
|
32
|
+
required: '=?',
|
|
32
33
|
onChange: '&?'
|
|
33
34
|
},
|
|
34
35
|
controller: function ($attrs, $scope) {
|
|
@@ -208,6 +209,16 @@ angular.module('niceElements')
|
|
|
208
209
|
}
|
|
209
210
|
});
|
|
210
211
|
|
|
212
|
+
// Required: something has to be selected (at least one item when multiple)
|
|
213
|
+
const checkRequired = function () {
|
|
214
|
+
if (!$scope.formChoice) return;
|
|
215
|
+
let hasValue = $scope.model !== null && angular.isDefined($scope.model);
|
|
216
|
+
if ($scope.multiple) hasValue = !!($scope.model && $scope.model.length);
|
|
217
|
+
$scope.formChoice.$setValidity('required', !$scope.required || hasValue);
|
|
218
|
+
};
|
|
219
|
+
$scope.$watchCollection('model', checkRequired);
|
|
220
|
+
$scope.$watch('required', checkRequired);
|
|
221
|
+
|
|
211
222
|
}
|
|
212
223
|
};
|
|
213
224
|
});
|
|
@@ -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,92 +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
|
-
<
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<div class="nice-date-date" ng-if="date" role="grid">
|
|
30
|
-
<div class="nice-date-header">
|
|
31
|
-
<span>
|
|
32
|
-
<select class="year-picker" ng-model="innerDate.year" ng-change="handleDateChange()" ng-options="year for year in years" ng-disabled="isDisabled"></select>
|
|
33
|
-
<span class="nice-date-header-comma">,</span>
|
|
34
|
-
<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>
|
|
35
|
-
</span>
|
|
36
|
-
<button type="button" class="btn btn-default-naked" ng-disabled="isDisabled" ng-click="previous()" title="{{ 'Previous month' | translate:'Nice' }}">
|
|
37
|
-
<nice-icon icon="icon-chevron-left"></nice-icon>
|
|
38
|
-
</button>
|
|
39
|
-
<button type="button" class="btn btn-default-naked" ng-disabled="isDisabled" ng-click="today()" title="{{ 'Today' | translate:'Nice' }}">
|
|
40
|
-
<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>
|
|
41
27
|
</button>
|
|
42
|
-
<button type="button" class="btn btn-default-
|
|
43
|
-
<nice-icon icon="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>
|
|
44
30
|
</button>
|
|
45
|
-
</
|
|
46
|
-
|
|
47
|
-
<div class="nice-date-grid nice-date-grid-names">
|
|
48
|
-
<span class="nice-date-day" ng-class="{ 'weekend': $index == 6 || $index == 5 }" ng-repeat="day in weekdays">{{ day }}</span>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<div class="nice-date-grid">
|
|
52
|
-
<button
|
|
53
|
-
type="button"
|
|
54
|
-
class="nice-date-day"
|
|
55
|
-
role="gridcell"
|
|
56
|
-
title="{{ day.text }}"
|
|
57
|
-
ng-class="{
|
|
58
|
-
'today': day.isToday,
|
|
59
|
-
'different-month': !day.isCurrentMonth,
|
|
60
|
-
'selected': isSameDay(model, day.date),
|
|
61
|
-
'weekend': day.isWeekday,
|
|
62
|
-
'disabled': day.isDisabled,
|
|
63
|
-
'between': isBetween(day.date, model, nextDate)
|
|
64
|
-
}"
|
|
65
|
-
ng-click="select(day)"
|
|
66
|
-
ng-repeat="day in days"
|
|
67
|
-
ng-disabled="isDisabled"
|
|
68
|
-
>
|
|
69
|
-
<span>{{ day.name }}</span>
|
|
70
|
-
</button>
|
|
71
|
-
</div>
|
|
31
|
+
</span>
|
|
72
32
|
</div>
|
|
33
|
+
</nice-popup-target>
|
|
73
34
|
|
|
74
|
-
|
|
75
|
-
<div class="nice-date-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<div class="time-picker time-picker-hour">
|
|
79
|
-
<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>
|
|
80
|
-
</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>
|
|
81
39
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
<div class="time-picker time-picker-minute">
|
|
85
|
-
<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>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
</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>
|
|
90
42
|
</div>
|
|
91
43
|
</div>
|
|
92
|
-
</div>
|
|
44
|
+
</div>
|
|
@@ -34,7 +34,7 @@ angular.module('niceElements')
|
|
|
34
34
|
required: '=',
|
|
35
35
|
nullable: '=',
|
|
36
36
|
placeholder: '@',
|
|
37
|
-
placement: '@', //
|
|
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);
|
|
@@ -160,6 +129,53 @@ angular.module('niceElements')
|
|
|
160
129
|
};
|
|
161
130
|
|
|
162
131
|
|
|
132
|
+
// ------------------ Typed date ------------------
|
|
133
|
+
// Formats accepted when the date is typed in (strict parsing)
|
|
134
|
+
const TYPED_DATE_FORMATS = ['D.M.YYYY', 'D.M.YY', 'D.M.', 'D.M'];
|
|
135
|
+
const TYPED_TIME_FORMATS = ['D.M.YYYY H:mm', 'D.M.YY H:mm', 'D.M. H:mm', 'D.M H:mm'];
|
|
136
|
+
|
|
137
|
+
// Parse typed text on blur (or Enter). Invalid or out of range text reverts to the current model.
|
|
138
|
+
$scope.parseTypedDate = function () {
|
|
139
|
+
const text = ($scope.innerDate.value || "").replace("•", " ").replace(/\s+/g, " ").trim();
|
|
140
|
+
|
|
141
|
+
// Nothing changed
|
|
142
|
+
if (text == $scope.formatDate($scope.model).replace("•", " ").replace(/\s+/g, " ")) return;
|
|
143
|
+
|
|
144
|
+
// Empty text clears the model, unless the field can't be empty
|
|
145
|
+
if (!text) {
|
|
146
|
+
if ($scope.nullable || $scope.required) $scope.setTypedDate(null);
|
|
147
|
+
else $scope.innerDate.value = $scope.formatDate($scope.model);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const formats = $scope.time ? TYPED_TIME_FORMATS.concat(TYPED_DATE_FORMATS) : TYPED_DATE_FORMATS;
|
|
152
|
+
const date = moment(text, formats, true);
|
|
153
|
+
if (!date.isValid() || _isDisabledDate(date)) {
|
|
154
|
+
$scope.innerDate.value = $scope.formatDate($scope.model);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (!$scope.time) $scope._removeTime(date);
|
|
159
|
+
$scope.setTypedDate(date);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
$scope.setTypedDate = function (date) {
|
|
163
|
+
$scope.model = date;
|
|
164
|
+
$scope.innerDate.value = $scope.formatDate($scope.model);
|
|
165
|
+
$timeout(function () {
|
|
166
|
+
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
167
|
+
$scope.forma.$setDirty();
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// Enter parses the text first, so the form is submitted with the typed date.
|
|
172
|
+
// Enter and Tab also close the picker (it isn't closed on blur, because clicking a day blurs the input).
|
|
173
|
+
$scope.typedDateKeydown = function (event) {
|
|
174
|
+
if (event.keyCode == 13) $scope.parseTypedDate();
|
|
175
|
+
if (event.keyCode == 13 || event.keyCode == 9) $scope.isOpen = false;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
|
|
163
179
|
// ------------------ Clear ------------------
|
|
164
180
|
$scope.clear = function () {
|
|
165
181
|
$scope.isOpen = false;
|
|
@@ -379,13 +395,16 @@ angular.module('niceElements')
|
|
|
379
395
|
$scope.bootstrap();
|
|
380
396
|
|
|
381
397
|
|
|
398
|
+
// ------------------ Close (click outside) ------------------
|
|
399
|
+
$scope.close = function () {
|
|
400
|
+
$scope.isOpen = false;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
|
|
382
404
|
// ------------------ Toggle open ------------------
|
|
383
405
|
$scope.toggleOpen = function () {
|
|
384
406
|
if (!$scope.isDisabled) {
|
|
385
407
|
$scope.isOpen = !$scope.isOpen;
|
|
386
|
-
$timeout(function () {
|
|
387
|
-
if ($scope.popper) $scope.popper.update();
|
|
388
|
-
});
|
|
389
408
|
}
|
|
390
409
|
};
|
|
391
410
|
}
|
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
$spacing: 10px;
|
|
3
3
|
$icon-width: 40px;
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
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,21 +16,13 @@
|
|
|
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%;
|
|
27
22
|
|
|
28
23
|
.form-control {
|
|
29
24
|
text-overflow: ellipsis;
|
|
25
|
+
cursor: text;
|
|
30
26
|
}
|
|
31
27
|
}
|
|
32
28
|
|
|
@@ -85,10 +81,6 @@
|
|
|
85
81
|
background: var(--nice-primary-color-lighter);
|
|
86
82
|
color: white;
|
|
87
83
|
}
|
|
88
|
-
|
|
89
|
-
.fa-circle {
|
|
90
|
-
font-size: 8px;
|
|
91
|
-
}
|
|
92
84
|
}
|
|
93
85
|
|
|
94
86
|
.nice-date-header-comma {
|
|
@@ -41,7 +41,7 @@ angular.module('niceElements')
|
|
|
41
41
|
if ($scope.time === undefined) $scope.time = true;
|
|
42
42
|
if (!$scope.placeholderDate) { $scope.placeholderDate = gettextCatalog.getString("••.••.••••", null, "Nice"); }
|
|
43
43
|
if (!$scope.placeholderTime) { $scope.placeholderTime = gettextCatalog.getString("••:••", null, "Nice"); }
|
|
44
|
-
if (!$scope.model && !$scope.nullable) $scope.model = moment(
|
|
44
|
+
if (!$scope.model && !$scope.nullable) $scope.model = moment().set({ 'second': 0, 'millisecond': 0 });
|
|
45
45
|
$scope.inner = {
|
|
46
46
|
timeModel: angular.copy($scope.model || moment()),
|
|
47
47
|
dateModel: angular.copy($scope.model || moment()),
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<!------------------------- Field ------------------------->
|
|
7
7
|
<div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
|
|
8
8
|
<div class="input-group">
|
|
9
|
-
<input date-range-picker class="form-control date-picker" type="text" options="opts" ng-model="model" />
|
|
9
|
+
<input date-range-picker class="form-control date-picker" type="text" options="opts" ng-model="model" ng-required="required" />
|
|
10
10
|
<span date-range-picker options="opts" ng-model="model" class="input-group-addon">
|
|
11
11
|
<nice-icon icon="icon-calendar"></nice-icon>
|
|
12
12
|
</span>
|
|
@@ -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,13 +12,15 @@
|
|
|
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>
|
|
21
18
|
</span>
|
|
22
19
|
</div>
|
|
23
20
|
|
|
21
|
+
<!-- Only for form validation (date has to be set when required) -->
|
|
22
|
+
<input class="hidden-input" ng-model="model" ng-required="required" tabindex="-1" />
|
|
23
|
+
|
|
24
24
|
<!-- inject nice-dtp here -->
|
|
25
25
|
<div ng-show="isOpen">
|
|
26
26
|
<nice-dtp model="internalDate" format="{{ format }}" model-format="{{ modelFormat }}" date="{{ isTrue(date) }}" time="{{ isTrue(time) }}" width="{{ width }}" enable-ok-buttons="{{ enableOkButtons }}" lang="{{ lang }}" min-date="{{ minDate }}" max-date="{{ maxDate }}" week-start="{{ weekStart }}" ok-text="{{ okText }}" cancel-text="{{ cancelText }}" closed="closeDtp"></nice-dtp>
|
|
@@ -179,10 +179,16 @@ $color_gallery_approx: #eee;
|
|
|
179
179
|
|
|
180
180
|
>a {
|
|
181
181
|
color: $white;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
182
184
|
|
|
183
|
-
|
|
184
|
-
|
|
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
|
|