nice-elements 1.13.3 → 1.13.5
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 +286 -134
- package/dist/nice.min.js +1 -1
- package/dist/style.css +108 -74
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +2 -2
- package/package.json +1 -1
- package/src/components/nice-alert/nice-alert.js +3 -2
- package/src/components/nice-calendar/nice-calendar.html +105 -12
- package/src/components/nice-calendar/nice-calendar.js +118 -47
- package/src/components/nice-calendar/nice-calendar.scss +137 -95
- package/src/components/nice-checkbox/nice-checkbox.html +1 -1
- package/src/components/nice-choice/nice-choice.html +1 -1
- package/src/components/nice-choice/nice-choice.js +1 -0
- package/src/components/nice-comment/nice-comment.html +1 -1
- package/src/components/nice-comment/nice-comment.js +1 -0
- package/src/components/nice-date/nice-date.html +18 -9
- package/src/components/nice-date/nice-date.js +67 -36
- package/src/components/nice-date/nice-date.scss +21 -27
- package/src/components/nice-date-input/nice-date-input.html +1 -1
- package/src/components/nice-date-input/nice-date-input.js +1 -0
- package/src/components/nice-date-range/nice-date-range.html +1 -1
- package/src/components/nice-date-range/nice-date-range.js +1 -0
- package/src/components/nice-datetime-picker/nice-datetime-picker.html +1 -1
- package/src/components/nice-datetime-picker/nice-datetime-picker.js +1 -0
- package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.html +1 -1
- package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.js +1 -0
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html +1 -1
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +1 -0
- package/src/components/nice-dropdown/nice-dropdown.html +1 -1
- package/src/components/nice-dropdown/nice-dropdown.js +1 -0
- package/src/components/nice-dropdown-date/nice-dropdown-date.html +1 -1
- package/src/components/nice-dropdown-date/nice-dropdown-date.js +1 -0
- package/src/components/nice-dropdown-old/nice-dropdown-old.html +1 -1
- package/src/components/nice-dropdown-old/nice-dropdown-old.js +1 -0
- package/src/components/nice-dtp/nice-dtp.js +1 -0
- package/src/components/nice-input/nice-input.html +44 -4
- package/src/components/nice-input/nice-input.js +6 -2
- package/src/components/nice-label/nice-label.html +1 -1
- package/src/components/nice-label/nice-label.js +1 -0
- package/src/components/nice-number/nice-number.html +1 -1
- package/src/components/nice-number/nice-number.js +1 -0
- package/src/components/nice-options/nice-options.html +1 -1
- package/src/components/nice-options/nice-options.js +1 -0
- package/src/components/nice-percent/nice-percent.html +1 -1
- package/src/components/nice-percent/nice-percent.js +1 -0
- package/src/components/nice-progress-bar/nice-progress-bar.html +1 -1
- package/src/components/nice-progress-bar/nice-progress-bar.js +1 -0
- package/src/components/nice-quantity/nice-quantity.html +1 -1
- package/src/components/nice-quantity/nice-quantity.js +1 -0
- package/src/components/nice-search/nice-search.html +1 -1
- package/src/components/nice-search/nice-search.js +1 -0
- package/src/components/nice-search2/nice-search2.html +1 -1
- package/src/components/nice-search2/nice-search2.js +1 -0
- package/src/components/nice-slot/nice-slot.html +1 -1
- package/src/components/nice-slot/nice-slot.js +1 -0
- package/src/components/nice-time-picker/nice-time-picker.html +1 -1
- package/src/components/nice-time-picker/nice-time-picker.js +1 -0
- package/src/components/nice-toggle/nice-toggle.html +1 -1
- package/src/components/nice-upload/nice-upload.html +1 -1
- package/src/components/nice-upload/nice-upload.js +1 -0
- package/src/components/nice-wrapper/nice-wrapper.js +1 -0
- package/src/components/nice-yesno/nice-yesno.html +1 -1
- package/src/components/nice-yesno/nice-yesno.js +1 -0
- package/src/services/nice-service.js +1 -1
- package/src/styles/_nice-common.scss +11 -1
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
.nice-calendar {
|
|
2
2
|
display: block;
|
|
3
3
|
|
|
4
|
+
.nice-calendar-days {
|
|
5
|
+
display: grid;
|
|
6
|
+
grid-template-columns: repeat(7, 1fr);
|
|
7
|
+
height: 180px;
|
|
8
|
+
gap: 1px;
|
|
9
|
+
background: var(--nice-border-color);
|
|
10
|
+
|
|
11
|
+
&.nice-calendar-days-header {
|
|
12
|
+
color: darken($nice-base-color, 10%);
|
|
13
|
+
line-height: 20px;
|
|
14
|
+
height: auto;
|
|
15
|
+
cursor: default;
|
|
16
|
+
border-bottom: 1px solid var(--nice-border-color);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
4
20
|
.nice-selected-dates {
|
|
5
21
|
padding: 0 10px 5px 10px;
|
|
6
22
|
display: flex;
|
|
@@ -106,14 +122,14 @@
|
|
|
106
122
|
$icon-width: 40px;
|
|
107
123
|
$header-height: 40px;
|
|
108
124
|
|
|
109
|
-
.header {
|
|
110
|
-
float: left;
|
|
125
|
+
.nice-calendar-header {
|
|
111
126
|
width: 100%;
|
|
112
127
|
background: $nice-base-color;
|
|
113
128
|
height: $header-height;
|
|
114
129
|
line-height: $header-height;
|
|
115
130
|
color: white;
|
|
116
131
|
display: flex;
|
|
132
|
+
flex-direction: row;
|
|
117
133
|
|
|
118
134
|
button {
|
|
119
135
|
width: $icon-width;
|
|
@@ -136,129 +152,155 @@
|
|
|
136
152
|
}
|
|
137
153
|
}
|
|
138
154
|
|
|
139
|
-
|
|
155
|
+
.nice-calendar-header-selects {
|
|
156
|
+
margin-left: 10px;
|
|
140
157
|
flex-grow: 1;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
158
|
+
display: flex;
|
|
159
|
+
align-items: center;
|
|
160
|
+
// justify-content: center;
|
|
161
|
+
// gap: 3px;
|
|
162
|
+
|
|
163
|
+
// .month-select {
|
|
164
|
+
// text-align: right;
|
|
165
|
+
// }
|
|
166
|
+
|
|
167
|
+
span {
|
|
168
|
+
margin-right: 3px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.month-select,
|
|
172
|
+
.year-select {
|
|
173
|
+
background: transparent;
|
|
174
|
+
border: 0 none;
|
|
175
|
+
color: white;
|
|
176
|
+
padding: 0;
|
|
177
|
+
margin: 0;
|
|
178
|
+
-webkit-appearance: none;
|
|
179
|
+
-moz-appearance: none;
|
|
180
|
+
appearance: none;
|
|
181
|
+
border-radius: 0;
|
|
182
|
+
cursor: pointer;
|
|
183
|
+
}
|
|
144
184
|
}
|
|
145
185
|
}
|
|
146
186
|
|
|
147
|
-
.
|
|
148
|
-
|
|
187
|
+
.day {
|
|
188
|
+
position: relative;
|
|
149
189
|
width: 100%;
|
|
150
|
-
|
|
190
|
+
height: 100%;
|
|
191
|
+
box-shadow: 0 0 0;
|
|
192
|
+
border: 0 none;
|
|
193
|
+
font-size: 12px;
|
|
194
|
+
text-align: center;
|
|
195
|
+
background: white;
|
|
196
|
+
color: $nice-font-color;
|
|
197
|
+
|
|
198
|
+
&.today:before {
|
|
199
|
+
content: " ";
|
|
200
|
+
position: absolute;
|
|
201
|
+
top: 0;
|
|
202
|
+
right: 0;
|
|
203
|
+
height: 10px;
|
|
204
|
+
width: 10px;
|
|
205
|
+
border-style: solid;
|
|
206
|
+
border-width: 0 10px 10px 0;
|
|
207
|
+
border-color: transparent $nice-base-color transparent transparent;
|
|
208
|
+
}
|
|
151
209
|
|
|
152
|
-
|
|
153
|
-
|
|
210
|
+
&.different-month {
|
|
211
|
+
color: #C0C0C0;
|
|
154
212
|
}
|
|
155
213
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
height: $day-height;
|
|
160
|
-
line-height: $day-height;
|
|
161
|
-
box-shadow: 0 0 0;
|
|
162
|
-
border: 0 none;
|
|
163
|
-
border-left: solid 1px $nice-border-color;
|
|
164
|
-
font-size: 12px;
|
|
165
|
-
text-align: center;
|
|
166
|
-
background: white;
|
|
167
|
-
color: $nice-font-color;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
&:first-child {
|
|
171
|
-
border-left: none;
|
|
172
|
-
}
|
|
214
|
+
&.weekend {
|
|
215
|
+
background: #fafafa;
|
|
216
|
+
}
|
|
173
217
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
height: 10px;
|
|
180
|
-
width: 10px;
|
|
181
|
-
border-style: solid;
|
|
182
|
-
border-width: 0 10px 10px 0;
|
|
183
|
-
border-color: transparent $nice-base-color transparent transparent;
|
|
184
|
-
}
|
|
218
|
+
&.disabled {
|
|
219
|
+
// opacity: 0.3;
|
|
220
|
+
color: $nice-danger-color;
|
|
221
|
+
background: #fff7f7;
|
|
222
|
+
cursor: not-allowed;
|
|
185
223
|
|
|
186
|
-
|
|
187
|
-
|
|
224
|
+
&:hover {
|
|
225
|
+
background: var(--nice-danger-color-plain) !important;
|
|
226
|
+
border-radius: 0 !important;
|
|
227
|
+
color: var(--nice-danger-color) !important;
|
|
188
228
|
}
|
|
229
|
+
}
|
|
189
230
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
231
|
+
&.selected {
|
|
232
|
+
background: lighten($nice-base-color, 30%);
|
|
233
|
+
}
|
|
193
234
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
235
|
+
&.start-selected {
|
|
236
|
+
background: $nice-base-color;
|
|
237
|
+
color: white;
|
|
238
|
+
border-bottom-left-radius: 10px;
|
|
239
|
+
border-top-left-radius: 10px;
|
|
240
|
+
}
|
|
199
241
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
242
|
+
&.end-selected {
|
|
243
|
+
background: $nice-base-color;
|
|
244
|
+
color: white;
|
|
245
|
+
border-bottom-right-radius: 10px;
|
|
246
|
+
border-top-right-radius: 10px;
|
|
247
|
+
}
|
|
203
248
|
|
|
204
|
-
|
|
205
|
-
|
|
249
|
+
&.selecting-start {
|
|
250
|
+
&:hover {
|
|
251
|
+
background: lighten($nice-base-color, 3%);
|
|
206
252
|
color: white;
|
|
207
253
|
border-bottom-left-radius: 10px;
|
|
208
254
|
border-top-left-radius: 10px;
|
|
209
255
|
}
|
|
256
|
+
}
|
|
210
257
|
|
|
211
|
-
|
|
212
|
-
|
|
258
|
+
&.selecting-end {
|
|
259
|
+
&:hover {
|
|
260
|
+
background: darken($nice-base-color, 10%);
|
|
213
261
|
color: white;
|
|
214
262
|
border-bottom-right-radius: 10px;
|
|
215
263
|
border-top-right-radius: 10px;
|
|
216
264
|
}
|
|
265
|
+
}
|
|
217
266
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
267
|
+
.popup {
|
|
268
|
+
position: absolute;
|
|
269
|
+
bottom: 20px;
|
|
270
|
+
left: 50%;
|
|
271
|
+
background: var(--nice-border-color);
|
|
272
|
+
color: var(--nice-font-color);
|
|
273
|
+
z-index: 1000;
|
|
274
|
+
line-height: 12px;
|
|
275
|
+
font-size: 10px;
|
|
276
|
+
text-align: left;
|
|
277
|
+
padding: 2px 8px;
|
|
278
|
+
display: none;
|
|
279
|
+
white-space: nowrap;
|
|
280
|
+
width: fit-content;
|
|
281
|
+
margin: 0;
|
|
282
|
+
transform: translate(-50%, -100%);
|
|
283
|
+
border-radius: 10px;
|
|
284
|
+
}
|
|
235
285
|
|
|
286
|
+
&:hover {
|
|
236
287
|
.popup {
|
|
237
|
-
|
|
238
|
-
bottom: 130%;
|
|
239
|
-
left: 50%;
|
|
240
|
-
background: var(--nice-border-color);
|
|
241
|
-
color: var(--nice-font-color);
|
|
242
|
-
z-index: 1000;
|
|
243
|
-
line-height: 12px;
|
|
244
|
-
font-size: 10px;
|
|
245
|
-
text-align: left;
|
|
246
|
-
padding: 2px 8px;
|
|
247
|
-
display: none;
|
|
248
|
-
white-space: nowrap;
|
|
249
|
-
width: fit-content;
|
|
250
|
-
margin: 0;
|
|
251
|
-
transform: translate(-50%, -100%);
|
|
252
|
-
border-radius: 10px;
|
|
288
|
+
display: block;
|
|
253
289
|
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
254
292
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
293
|
+
.week {
|
|
294
|
+
display: flex;
|
|
295
|
+
width: 100%;
|
|
296
|
+
border-top: solid 1px $nice-border-color;
|
|
297
|
+
|
|
298
|
+
&:first-child {
|
|
299
|
+
border-top: none;
|
|
260
300
|
}
|
|
261
301
|
|
|
302
|
+
|
|
303
|
+
|
|
262
304
|
&.names>span {
|
|
263
305
|
color: darken($nice-base-color, 10%);
|
|
264
306
|
line-height: 20px;
|
|
@@ -282,7 +324,7 @@
|
|
|
282
324
|
}
|
|
283
325
|
|
|
284
326
|
.disabled {
|
|
285
|
-
opacity: 0.5;
|
|
327
|
+
// opacity: 0.5;
|
|
286
328
|
cursor: not-allowed;
|
|
287
329
|
user-select: none;
|
|
288
330
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<nice-icon ng-if="!model && indeterminate" class="nice-checkbox-check" icon="icon-minus"></nice-icon>
|
|
15
15
|
</button>
|
|
16
16
|
<div class="nice-checkbox-info" ng-transclude>
|
|
17
|
-
<nice-title text="title || niceTitle" help="help" required="required" description="niceDescription" label-width="col-xs-12"></nice-title>
|
|
17
|
+
<nice-title text="title || niceTitle" help="help" required="required" description="description" description="niceDescription" label-width="col-xs-12"></nice-title>
|
|
18
18
|
<!-- <div ng-if="title || niceTitle" class="nice-checkbox-message" ng-class="{ 'nice-disabled': isDisabled }">{{ title || niceTitle }}</div> -->
|
|
19
19
|
<!-- <div ng-if="niceDescription" class="nice-checkbox-description" ng-class="{ 'nice-disabled': isDisabled }">{{ niceDescription }}</div> -->
|
|
20
20
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div class="nice-component nice-choice" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }" ng-form="formChoice">
|
|
2
2
|
<div class="row">
|
|
3
3
|
<!------------------------- Title ------------------------->
|
|
4
|
-
<nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
4
|
+
<nice-title text="title || niceTitle" help="help" required="required" description="description" label-width="labelWidth"></nice-title>
|
|
5
5
|
|
|
6
6
|
<!------------------------- Field ------------------------->
|
|
7
7
|
<div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div class="nice-component nice-comment" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }">
|
|
2
2
|
<div class="row">
|
|
3
3
|
<!------------------------- Title ------------------------->
|
|
4
|
-
<nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
4
|
+
<nice-title text="title || niceTitle" help="help" required="required" description="description" label-width="labelWidth"></nice-title>
|
|
5
5
|
|
|
6
6
|
<!------------------------- Field ------------------------->
|
|
7
7
|
<div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]" ng-click="edit()">
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
<div class="row">
|
|
5
5
|
<!------------------------- Title ------------------------->
|
|
6
|
-
<nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
6
|
+
<nice-title text="title || niceTitle" help="help" required="required" description="description" label-width="labelWidth"></nice-title>
|
|
7
7
|
|
|
8
8
|
<!------------------------- Field ------------------------->
|
|
9
9
|
<div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
|
|
@@ -33,31 +33,40 @@
|
|
|
33
33
|
<span class="nice-date-header-comma">,</span>
|
|
34
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
35
|
</span>
|
|
36
|
-
<button type="button" class="btn btn-default-naked" ng-disabled="isDisabled" ng-click="previous()">
|
|
36
|
+
<button type="button" class="btn btn-default-naked" ng-disabled="isDisabled" ng-click="previous()" title="{{ 'Previous month' | translate:'Nice' }}">
|
|
37
37
|
<nice-icon icon="icon-chevron-left"></nice-icon>
|
|
38
38
|
</button>
|
|
39
|
-
<button type="button" class="btn btn-default-naked" ng-disabled="isDisabled" ng-click="today()">
|
|
39
|
+
<button type="button" class="btn btn-default-naked" ng-disabled="isDisabled" ng-click="today()" title="{{ 'Today' | translate:'Nice' }}">
|
|
40
40
|
<nice-icon icon="icon-circle"></nice-icon>
|
|
41
41
|
</button>
|
|
42
|
-
<button type="button" class="btn btn-default-naked" ng-disabled="isDisabled" ng-click="next()">
|
|
42
|
+
<button type="button" class="btn btn-default-naked" ng-disabled="isDisabled" ng-click="next()" title="{{ 'Next month' | translate:'Nice' }}">
|
|
43
43
|
<nice-icon icon="icon-chevron-right"></nice-icon>
|
|
44
44
|
</button>
|
|
45
45
|
</div>
|
|
46
46
|
|
|
47
|
-
<div class="nice-date-
|
|
47
|
+
<div class="nice-date-grid nice-date-grid-names">
|
|
48
48
|
<span class="nice-date-day" ng-class="{ 'weekend': $index == 6 || $index == 5 }" ng-repeat="day in weekdays">{{ day }}</span>
|
|
49
49
|
</div>
|
|
50
50
|
|
|
51
|
-
<div class="nice-date-
|
|
52
|
-
<button
|
|
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="{
|
|
53
58
|
'today': day.isToday,
|
|
54
59
|
'different-month': !day.isCurrentMonth,
|
|
55
60
|
'selected': isSameDay(model, day.date),
|
|
56
61
|
'weekend': day.isWeekday,
|
|
57
62
|
'disabled': day.isDisabled,
|
|
58
63
|
'between': isBetween(day.date, model, nextDate)
|
|
59
|
-
}"
|
|
60
|
-
|
|
64
|
+
}"
|
|
65
|
+
ng-click="select(day)"
|
|
66
|
+
ng-repeat="day in days"
|
|
67
|
+
ng-disabled="isDisabled"
|
|
68
|
+
>
|
|
69
|
+
<span>{{ day.name }}</span>
|
|
61
70
|
</button>
|
|
62
71
|
</div>
|
|
63
72
|
</div>
|
|
@@ -15,6 +15,7 @@ angular.module('niceElements')
|
|
|
15
15
|
templateUrl: 'src/components/nice-date/nice-date.html',
|
|
16
16
|
scope: {
|
|
17
17
|
niceTitle: '@',
|
|
18
|
+
description: '@?',
|
|
18
19
|
title: '@', // default: ''
|
|
19
20
|
noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
|
|
20
21
|
fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
|
|
@@ -257,47 +258,77 @@ angular.module('niceElements')
|
|
|
257
258
|
|
|
258
259
|
|
|
259
260
|
// ------------------ Build month ------------------
|
|
260
|
-
$scope._buildMonth = function
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
261
|
+
$scope._buildMonth = function() {
|
|
262
|
+
$scope.days = [];
|
|
263
|
+
|
|
264
|
+
// 1. Get the first day of the currently viewed month
|
|
265
|
+
const firstDayOfMonth = new Date(
|
|
266
|
+
$scope.innerDate.year,
|
|
267
|
+
$scope.innerDate.month,
|
|
268
|
+
1
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
// 2. Calculate the offset (0 = Sunday, 1 = Monday, etc.)
|
|
272
|
+
// If your calendar starts on Monday, we adjust the JS Sunday (0) to 7
|
|
273
|
+
let startOffset = firstDayOfMonth.getDay();
|
|
274
|
+
if (startOffset === 0) startOffset = 7; // Treat Sunday as 7
|
|
275
|
+
startOffset -= 1; // Adjust so Monday = 0
|
|
276
|
+
|
|
277
|
+
// 3. We always want to show a standard 6-week grid (42 days)
|
|
278
|
+
// We start the loop from 1 minus the offset
|
|
279
|
+
for (let d = 1 - startOffset; d <= 42 - startOffset; d++) {
|
|
280
|
+
$scope.days.push(
|
|
281
|
+
_buildDay(
|
|
282
|
+
$scope.innerDate.year,
|
|
283
|
+
$scope.innerDate.month,
|
|
284
|
+
d
|
|
285
|
+
)
|
|
286
|
+
);
|
|
272
287
|
}
|
|
273
288
|
};
|
|
274
289
|
|
|
290
|
+
// ------------------ Build day ------------------
|
|
291
|
+
function _buildDay(year, month, day) {
|
|
292
|
+
const today = moment();
|
|
293
|
+
const date = moment().year(year).month(month).date(day);
|
|
294
|
+
return {
|
|
295
|
+
id: date.toString(),
|
|
296
|
+
date: date,
|
|
297
|
+
year: date.year(),
|
|
298
|
+
month: date.month(),
|
|
299
|
+
day: date.date(),
|
|
300
|
+
dayInWeek: date.day(),
|
|
301
|
+
isCurrentMonth: date.month() == $scope.innerDate.month,
|
|
302
|
+
isWeekday: date.day() == 0 || date.day() == 6,
|
|
303
|
+
isToday: _isSameDay(moment(), date),
|
|
304
|
+
selected: _isSameDay($scope.innerDate.date, date),
|
|
305
|
+
today: _isSameDay(today, date),
|
|
306
|
+
highlighted: _isHighlighted(date),
|
|
307
|
+
isDisabled: _isDisabledDate(date),
|
|
308
|
+
text: date.format('dddd, D.M.YYYY'),
|
|
309
|
+
name: date.format('D'),
|
|
310
|
+
};
|
|
311
|
+
}
|
|
275
312
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
number: date.date(),
|
|
283
|
-
isCurrentMonth: $scope.isSameMonth(date, $scope.innerDate.date),
|
|
284
|
-
isToday: date.isSame(new Date(), "day"),
|
|
285
|
-
isWeekday: date.weekday() == 6 || date.weekday() == 0,
|
|
286
|
-
value: date.format('D.M.YYYY'),
|
|
287
|
-
date: date
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
if ($scope.minDate) day.isDisabled = date.isBefore($scope.minDate);
|
|
291
|
-
if ($scope.maxDate) day.isDisabled = date.isAfter($scope.maxDate);
|
|
292
|
-
if ($scope.minDate && $scope.maxDate) day.isDisabled = !date.isBetween($scope.minDate, $scope.maxDate);
|
|
293
|
-
|
|
294
|
-
days.push(day);
|
|
295
|
-
date = date.clone();
|
|
296
|
-
date.add(1, "d");
|
|
297
|
-
}
|
|
313
|
+
function _isDisabledDate(date) {
|
|
314
|
+
// console.log(date.format('D.M.YYYY'), $scope.minDate.format('D.M.YYYY'), $scope.maxDate.format('D.M.YYYY'));
|
|
315
|
+
if ($scope.minDate && date.isBefore($scope.minDate)) return true;
|
|
316
|
+
if ($scope.maxDate && date.isAfter($scope.maxDate)) return true;
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
298
319
|
|
|
299
|
-
|
|
300
|
-
|
|
320
|
+
function _isHighlighted(date) {
|
|
321
|
+
// if (props.highlightTo && isWithinInterval(date, { end: props.highlightTo, start: selected.value })) return true;
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function _isSameDay(date1, date2) {
|
|
326
|
+
return (
|
|
327
|
+
date1.date() == date2.date() &&
|
|
328
|
+
date1.month() == date2.month() &&
|
|
329
|
+
date1.year() == date2.year()
|
|
330
|
+
);
|
|
331
|
+
}
|
|
301
332
|
|
|
302
333
|
|
|
303
334
|
// ------------------ Watch for model change ------------------
|
|
@@ -124,25 +124,21 @@
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
.nice-date-
|
|
127
|
+
.nice-date-grid {
|
|
128
128
|
width: 100%;
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
display: grid;
|
|
130
|
+
grid-template-columns: repeat(7, 1fr);
|
|
131
131
|
flex-grow: 1;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
border-top: none;
|
|
135
|
-
}
|
|
132
|
+
gap: 1px;
|
|
133
|
+
background: var(--nice-border-color);
|
|
136
134
|
|
|
137
135
|
.nice-date-day {
|
|
136
|
+
width: 100%;
|
|
138
137
|
box-shadow: 0 0 0;
|
|
139
138
|
user-select: none;
|
|
140
139
|
position: relative;
|
|
141
|
-
min-height: 20px;
|
|
142
|
-
width: 14.2857%;
|
|
143
140
|
border-radius: var(--nice-border-radius);
|
|
144
141
|
border: 0 none;
|
|
145
|
-
border-left: solid 1px var(--nice-border-color);
|
|
146
142
|
font-size: 12px;
|
|
147
143
|
text-align: center;
|
|
148
144
|
background: var(--nice-card-bg);
|
|
@@ -150,14 +146,12 @@
|
|
|
150
146
|
color: var(--nice-font-color);
|
|
151
147
|
padding: 0;
|
|
152
148
|
margin: 0;
|
|
149
|
+
border-radius: 0;
|
|
153
150
|
|
|
154
151
|
display: flex;
|
|
155
152
|
justify-content: center;
|
|
156
153
|
align-items: center;
|
|
157
154
|
|
|
158
|
-
&:first-child {
|
|
159
|
-
border-left: none;
|
|
160
|
-
}
|
|
161
155
|
|
|
162
156
|
&.today:before {
|
|
163
157
|
content: " ";
|
|
@@ -180,14 +174,22 @@
|
|
|
180
174
|
}
|
|
181
175
|
|
|
182
176
|
&.disabled {
|
|
183
|
-
opacity: 0.3;
|
|
177
|
+
// opacity: 0.3;
|
|
184
178
|
color: var(--nice-danger-color);
|
|
179
|
+
background: #fff7f7;
|
|
185
180
|
cursor: not-allowed;
|
|
181
|
+
|
|
182
|
+
&:hover {
|
|
183
|
+
background: var(--nice-danger-color-plain) !important;
|
|
184
|
+
border-radius: 0 !important;
|
|
185
|
+
color: var(--nice-danger-color) !important;
|
|
186
|
+
}
|
|
186
187
|
}
|
|
187
188
|
|
|
188
189
|
&.selected {
|
|
189
190
|
background: var(--nice-primary-color) !important;
|
|
190
191
|
color: var(--nice-card-bg);
|
|
192
|
+
border-radius: var(--nice-border-radius);
|
|
191
193
|
}
|
|
192
194
|
|
|
193
195
|
&.between {
|
|
@@ -204,21 +206,13 @@
|
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
208
|
|
|
207
|
-
&.names {
|
|
209
|
+
&.nice-date-grid-names {
|
|
210
|
+
height: 20px;
|
|
208
211
|
flex-grow: 0;
|
|
209
|
-
height: 21px;
|
|
210
212
|
flex-shrink: 0;
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
min-height: 20px;
|
|
215
|
-
cursor: default;
|
|
216
|
-
|
|
217
|
-
&:hover {
|
|
218
|
-
background: var(--nice-card-bg);
|
|
219
|
-
color: var(--nice-primary-color-darker);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
213
|
+
color: var(--nice-primary-color-darker);
|
|
214
|
+
border-bottom: 1px solid var(--nice-border-color);
|
|
215
|
+
cursor: default;
|
|
222
216
|
}
|
|
223
217
|
}
|
|
224
218
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<ng-form class="nice-component nice-date-input" name="niceDateInputForm" ng-class="{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline, 'error': niceDateInputForm.$invalid, 'nice-date-input-no-date': !date }">
|
|
2
2
|
<div class="row">
|
|
3
3
|
<!------------------------- Title ------------------------->
|
|
4
|
-
<nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
4
|
+
<nice-title text="title || niceTitle" help="help" required="required" description="description" label-width="labelWidth"></nice-title>
|
|
5
5
|
|
|
6
6
|
<!------------------------- Field ------------------------->
|
|
7
7
|
<div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
|
|
@@ -20,6 +20,7 @@ angular.module('niceElements')
|
|
|
20
20
|
maxDate: '=', // default: undefined
|
|
21
21
|
niceTitle: '@',
|
|
22
22
|
title: '@', // default: ''
|
|
23
|
+
description: '@?',
|
|
23
24
|
noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
|
|
24
25
|
fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
|
|
25
26
|
labelWidth: '@', // default: 'col-sm-4', bootstrap classes that defines width of label
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<ng-form class="nice-component nice-date-range" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }" name="form">
|
|
2
2
|
<div class="row">
|
|
3
3
|
<!------------------------- Title ------------------------->
|
|
4
|
-
<nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
4
|
+
<nice-title text="title || niceTitle" help="help" required="required" description="description" label-width="labelWidth"></nice-title>
|
|
5
5
|
|
|
6
6
|
<!------------------------- Field ------------------------->
|
|
7
7
|
<div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
|