nice-elements 1.4.3 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +1 -1
- package/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/bower.json +1 -1
- package/dist/nice.js +202 -88
- package/dist/nice.min.js +1 -1
- package/dist/style.css +46 -50
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +2 -2
- package/package.json +2 -1
- package/src/components/nice-calendar/nice-calendar.js +11 -5
- package/src/components/nice-date/nice-date.html +63 -61
- package/src/components/nice-date/nice-date.js +28 -1
- package/src/components/nice-date/nice-date.scss +5 -5
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html +20 -18
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +23 -1
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.scss +6 -6
- package/src/components/nice-dropdown/nice-dropdown.html +18 -16
- package/src/components/nice-dropdown/nice-dropdown.js +72 -62
- package/src/components/nice-dropdown/nice-dropdown.scss +10 -12
- package/src/components/nice-search2/nice-search2.html +4 -2
- package/src/components/nice-search2/nice-search2.js +41 -0
- package/src/components/nice-search2/nice-search2.scss +4 -8
package/.vscode/settings.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v1.4.6 (26.8.2022)
|
|
4
|
+
|
|
5
|
+
- fixed popper in nice-date, nice-search,
|
|
6
|
+
- fixed with in nice-daterange-picker-2
|
|
7
|
+
|
|
8
|
+
## v1.4.5 (26.8.2022)
|
|
9
|
+
|
|
10
|
+
- added @popperjs/core v2.11.6,
|
|
11
|
+
- changed dropdown to popper in nice-dropdown, nice-date, nice-search2 and nice-daterange-picker-2
|
|
12
|
+
|
|
13
|
+
## v1.4.4 (1.8.2022)
|
|
14
|
+
|
|
15
|
+
- fixed nice-calendar update on time select
|
|
16
|
+
|
|
3
17
|
## v1.4.3 (28.4.2022)
|
|
4
18
|
|
|
5
19
|
- worked on nice calendar time prop,
|
package/README.md
CHANGED
package/bower.json
CHANGED
package/dist/nice.js
CHANGED
|
@@ -137,7 +137,7 @@ angular.module('niceElements')
|
|
|
137
137
|
function bootstrap() {
|
|
138
138
|
// scope.startDate = moment(scope.startDate.second(0).millisecond(0));
|
|
139
139
|
// scope.endDate = moment(scope.endDate.second(0).millisecond(0));
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
if (!scope.time) {
|
|
142
142
|
scope.startDateHour = 0;
|
|
143
143
|
scope.startDateMinute = 0;
|
|
@@ -155,7 +155,7 @@ angular.module('niceElements')
|
|
|
155
155
|
scope.startDateHour = moment(scope.startDate).hours();
|
|
156
156
|
scope.startDateMinute = moment(scope.startDate).minutes();
|
|
157
157
|
scope.endDateHour = moment(scope.endDate).hours();
|
|
158
|
-
scope.endDateMinute = moment(scope.endDate).minutes();
|
|
158
|
+
scope.endDateMinute = moment(scope.endDate).minutes();
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
scope.month = angular.copy(moment(scope.startDate));
|
|
@@ -195,8 +195,6 @@ angular.module('niceElements')
|
|
|
195
195
|
scope.endDate = angular.copy(scope.startDate);
|
|
196
196
|
}
|
|
197
197
|
} else {
|
|
198
|
-
|
|
199
|
-
|
|
200
198
|
if (!scope.time) {
|
|
201
199
|
selectedDate.hours(23);
|
|
202
200
|
selectedDate.minutes(59);
|
|
@@ -207,7 +205,6 @@ angular.module('niceElements')
|
|
|
207
205
|
selectedDate.minutes(scope.endDateMinute);
|
|
208
206
|
}
|
|
209
207
|
|
|
210
|
-
|
|
211
208
|
// Set end date
|
|
212
209
|
scope.endDate = selectedDate;
|
|
213
210
|
scope.selectStart = true;
|
|
@@ -248,6 +245,7 @@ angular.module('niceElements')
|
|
|
248
245
|
scope.startDate = moment(scope.startDate).hours(scope.startDateHour);
|
|
249
246
|
scope.formCalendar.$setDirty();
|
|
250
247
|
scope.displayStartChange();
|
|
248
|
+
scope.handleUpdate();
|
|
251
249
|
};
|
|
252
250
|
|
|
253
251
|
|
|
@@ -256,6 +254,7 @@ angular.module('niceElements')
|
|
|
256
254
|
scope.startDate = moment(scope.startDate).minutes(scope.startDateMinute);
|
|
257
255
|
scope.formCalendar.$setDirty();
|
|
258
256
|
scope.displayStartChange();
|
|
257
|
+
scope.handleUpdate();
|
|
259
258
|
};
|
|
260
259
|
|
|
261
260
|
|
|
@@ -264,6 +263,7 @@ angular.module('niceElements')
|
|
|
264
263
|
scope.endDate = moment(scope.endDate).hours(scope.endDateHour);
|
|
265
264
|
scope.formCalendar.$setDirty();
|
|
266
265
|
scope.displayEndChange();
|
|
266
|
+
scope.handleUpdate();
|
|
267
267
|
};
|
|
268
268
|
|
|
269
269
|
|
|
@@ -272,6 +272,12 @@ angular.module('niceElements')
|
|
|
272
272
|
scope.endDate = moment(scope.endDate).minutes(scope.endDateMinute);
|
|
273
273
|
scope.formCalendar.$setDirty();
|
|
274
274
|
scope.displayEndChange();
|
|
275
|
+
scope.handleUpdate();
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
scope.handleUpdate = function () {
|
|
280
|
+
if (scope.onChange) scope.onChange({ model: { startDate: scope.startDate, endDate: scope.endDate }, element: element });
|
|
275
281
|
};
|
|
276
282
|
|
|
277
283
|
|
|
@@ -915,7 +921,7 @@ angular.module('niceElements')
|
|
|
915
921
|
isInline: '=',
|
|
916
922
|
onChange: '&?'
|
|
917
923
|
},
|
|
918
|
-
controller: function($scope, gettextCatalog) {
|
|
924
|
+
controller: function($scope, $element, $timeout, gettextCatalog) {
|
|
919
925
|
$scope.isOpen = false;
|
|
920
926
|
$scope.hours = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23];
|
|
921
927
|
$scope.minutes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59];
|
|
@@ -975,6 +981,30 @@ angular.module('niceElements')
|
|
|
975
981
|
if ($scope.maxDate) $scope.maxDate = moment($scope.maxDate);
|
|
976
982
|
if ($scope.minDate) $scope.minDate = moment($scope.minDate);
|
|
977
983
|
|
|
984
|
+
|
|
985
|
+
// Setup popper
|
|
986
|
+
// https://popper.js.org/docs/v2/constructors/
|
|
987
|
+
$scope.setupPopper = function() {
|
|
988
|
+
var button = $element[0].getElementsByClassName('nice-date-button')[0];
|
|
989
|
+
var tooltip = $element[0].getElementsByClassName('nice-date-dropdown-wrapper')[0];
|
|
990
|
+
$scope.popper = Popper.createPopper(button, tooltip, {
|
|
991
|
+
strategy: 'fixed',
|
|
992
|
+
placement: 'bottom-start',
|
|
993
|
+
modifiers: [
|
|
994
|
+
{
|
|
995
|
+
name: 'offset',
|
|
996
|
+
options: {
|
|
997
|
+
offset: [0, 5],
|
|
998
|
+
},
|
|
999
|
+
}
|
|
1000
|
+
],
|
|
1001
|
+
});
|
|
1002
|
+
};
|
|
1003
|
+
|
|
1004
|
+
$timeout(function() {
|
|
1005
|
+
if (!$scope.isInline) $scope.setupPopper();
|
|
1006
|
+
})
|
|
1007
|
+
|
|
978
1008
|
|
|
979
1009
|
// ------------------ Time changes ------------------
|
|
980
1010
|
$scope.timeChange = function() {
|
|
@@ -1181,6 +1211,9 @@ angular.module('niceElements')
|
|
|
1181
1211
|
$scope.toggleOpen = function() {
|
|
1182
1212
|
if (!$scope.isDisabled) {
|
|
1183
1213
|
$scope.isOpen = !$scope.isOpen;
|
|
1214
|
+
$timeout(function() {
|
|
1215
|
+
if ($scope.popper) $scope.popper.update();
|
|
1216
|
+
})
|
|
1184
1217
|
}
|
|
1185
1218
|
};
|
|
1186
1219
|
}
|
|
@@ -1303,7 +1336,7 @@ angular.module('niceElements')
|
|
|
1303
1336
|
onChange: '&?'
|
|
1304
1337
|
},
|
|
1305
1338
|
templateUrl: 'src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html',
|
|
1306
|
-
controller: function ($
|
|
1339
|
+
controller: function ($element, $scope) {
|
|
1307
1340
|
$scope.isOpen = false;
|
|
1308
1341
|
|
|
1309
1342
|
|
|
@@ -1333,6 +1366,27 @@ angular.module('niceElements')
|
|
|
1333
1366
|
}
|
|
1334
1367
|
|
|
1335
1368
|
|
|
1369
|
+
// Setup popper
|
|
1370
|
+
// https://popper.js.org/docs/v2/constructors/
|
|
1371
|
+
$scope.setupPopper = function() {
|
|
1372
|
+
var button = $element[0].getElementsByClassName('nice-daterange-picker-button')[0];
|
|
1373
|
+
var tooltip = $element[0].getElementsByClassName('nice-daterange-picker-wrapper')[0];
|
|
1374
|
+
$scope.popper = Popper.createPopper(button, tooltip, {
|
|
1375
|
+
strategy: 'fixed',
|
|
1376
|
+
placement: 'bottom-start',
|
|
1377
|
+
modifiers: [
|
|
1378
|
+
{
|
|
1379
|
+
name: 'offset',
|
|
1380
|
+
options: {
|
|
1381
|
+
offset: [0, 5],
|
|
1382
|
+
},
|
|
1383
|
+
}
|
|
1384
|
+
],
|
|
1385
|
+
});
|
|
1386
|
+
};
|
|
1387
|
+
$scope.setupPopper();
|
|
1388
|
+
|
|
1389
|
+
|
|
1336
1390
|
$scope.format = function(){
|
|
1337
1391
|
$scope.modelFormat = $scope.startDate.format($scope.formatString) + " - " + $scope.endDate.format($scope.formatString);
|
|
1338
1392
|
};
|
|
@@ -1341,6 +1395,7 @@ angular.module('niceElements')
|
|
|
1341
1395
|
$scope.open = function() {
|
|
1342
1396
|
if (!$scope.isDisabled) {
|
|
1343
1397
|
$scope.isOpen = true;
|
|
1398
|
+
$scope.popper.update();
|
|
1344
1399
|
}
|
|
1345
1400
|
};
|
|
1346
1401
|
|
|
@@ -2160,8 +2215,7 @@ angular.module('niceElements')
|
|
|
2160
2215
|
selectedText: '@',
|
|
2161
2216
|
searchFunction: '=?',
|
|
2162
2217
|
isInline: '=',
|
|
2163
|
-
clearOnSelect: '@'
|
|
2164
|
-
positionFixed: '=' // Dropdown menu will be fixed to page
|
|
2218
|
+
clearOnSelect: '@'
|
|
2165
2219
|
},
|
|
2166
2220
|
controller: function ($scope, $element, $timeout, gettextCatalog) {
|
|
2167
2221
|
if (!$scope.objValue) { $scope.objValue = 'value'; }
|
|
@@ -2182,11 +2236,47 @@ angular.module('niceElements')
|
|
|
2182
2236
|
$scope.isOpen = false;
|
|
2183
2237
|
$scope.selected = null;
|
|
2184
2238
|
$scope.selectedIndex = 0;
|
|
2239
|
+
$scope.popper = null;
|
|
2185
2240
|
|
|
2186
2241
|
$scope.internal = {
|
|
2187
2242
|
search: ""
|
|
2188
2243
|
};
|
|
2189
2244
|
|
|
2245
|
+
// Setup popper
|
|
2246
|
+
// https://popper.js.org/docs/v2/constructors/
|
|
2247
|
+
$scope.setupPopper = function() {
|
|
2248
|
+
var button = $element[0].getElementsByClassName('btn-dropdown')[0];
|
|
2249
|
+
var tooltip = $element[0].getElementsByClassName('nice-dropdown-menu-wrapper')[0];
|
|
2250
|
+
$scope.popper = Popper.createPopper(button, tooltip, {
|
|
2251
|
+
strategy: 'fixed',
|
|
2252
|
+
scroll: true,
|
|
2253
|
+
resize: true,
|
|
2254
|
+
modifiers: [
|
|
2255
|
+
{
|
|
2256
|
+
name: 'offset',
|
|
2257
|
+
options: {
|
|
2258
|
+
offset: [0, 5],
|
|
2259
|
+
},
|
|
2260
|
+
},
|
|
2261
|
+
{
|
|
2262
|
+
name: "sameWidth",
|
|
2263
|
+
enabled: true,
|
|
2264
|
+
phase: "beforeWrite",
|
|
2265
|
+
requires: ["computeStyles"],
|
|
2266
|
+
fn: ({ state }) => {
|
|
2267
|
+
state.styles.popper.width = `${state.rects.reference.width}px`;
|
|
2268
|
+
},
|
|
2269
|
+
effect: ({ state }) => {
|
|
2270
|
+
state.elements.popper.style.width = `${
|
|
2271
|
+
state.elements.reference.offsetWidth
|
|
2272
|
+
}px`;
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
],
|
|
2276
|
+
});
|
|
2277
|
+
};
|
|
2278
|
+
$scope.setupPopper();
|
|
2279
|
+
|
|
2190
2280
|
// -----------------------------------Open -----------------------------------
|
|
2191
2281
|
$scope.toggle = function () {
|
|
2192
2282
|
if ($scope.isOpen) {
|
|
@@ -2201,10 +2291,10 @@ angular.module('niceElements')
|
|
|
2201
2291
|
};
|
|
2202
2292
|
|
|
2203
2293
|
$scope.open = function () {
|
|
2204
|
-
$scope.focusInput();
|
|
2205
2294
|
$scope.isOpen = true;
|
|
2206
|
-
|
|
2207
|
-
|
|
2295
|
+
$timeout(function () {
|
|
2296
|
+
$scope.popper.update();
|
|
2297
|
+
$scope.focusInput();
|
|
2208
2298
|
$scope.scrollToHover(true);
|
|
2209
2299
|
}, 100);
|
|
2210
2300
|
};
|
|
@@ -2222,18 +2312,18 @@ angular.module('niceElements')
|
|
|
2222
2312
|
|
|
2223
2313
|
|
|
2224
2314
|
// ----------------------------------- Scroll to hover -----------------------------------
|
|
2225
|
-
$scope.scrollToHover = function(notSmooth) {
|
|
2226
|
-
var dropdownMenu = $element[0].getElementsByClassName("dropdown-menu")[0];
|
|
2227
|
-
|
|
2315
|
+
$scope.scrollToHover = function (notSmooth) {
|
|
2316
|
+
var dropdownMenu = $element[0].getElementsByClassName("nice-dropdown-menu")[0];
|
|
2317
|
+
if (!dropdownMenu) return;
|
|
2318
|
+
var dorpdownList = dropdownMenu.getElementsByClassName("nice-dropdown-items")[0];
|
|
2228
2319
|
var hoverItem = dorpdownList.getElementsByClassName("hover")[0];
|
|
2229
|
-
if (hoverItem)
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
}
|
|
2320
|
+
if (!hoverItem) return
|
|
2321
|
+
var topPos = hoverItem.offsetTop;
|
|
2322
|
+
dorpdownList.scroll({
|
|
2323
|
+
top: topPos - 120,
|
|
2324
|
+
left: 0,
|
|
2325
|
+
behavior: notSmooth ? 'auto' : 'smooth'
|
|
2326
|
+
});
|
|
2237
2327
|
};
|
|
2238
2328
|
|
|
2239
2329
|
|
|
@@ -2268,11 +2358,11 @@ angular.module('niceElements')
|
|
|
2268
2358
|
|
|
2269
2359
|
|
|
2270
2360
|
// ----------------------------------- Handle multiple select -----------------------------------
|
|
2271
|
-
$scope.handleMultipleSelect = function(item, index) {
|
|
2361
|
+
$scope.handleMultipleSelect = function (item, index) {
|
|
2272
2362
|
if (!$scope.selected) $scope.selected = [];
|
|
2273
2363
|
|
|
2274
|
-
if(item._selected) {
|
|
2275
|
-
$scope.selected = $scope.selected.filter(function(s) {
|
|
2364
|
+
if (item._selected) {
|
|
2365
|
+
$scope.selected = $scope.selected.filter(function (s) {
|
|
2276
2366
|
return s[$scope.objKey] != item[$scope.objKey];
|
|
2277
2367
|
});
|
|
2278
2368
|
} else {
|
|
@@ -2284,7 +2374,7 @@ angular.module('niceElements')
|
|
|
2284
2374
|
|
|
2285
2375
|
|
|
2286
2376
|
// ----------------------------------- Handle single slect -----------------------------------
|
|
2287
|
-
$scope.handleSingleSelect = function(item, index) {
|
|
2377
|
+
$scope.handleSingleSelect = function (item, index) {
|
|
2288
2378
|
$scope.selected = item;
|
|
2289
2379
|
$scope.close();
|
|
2290
2380
|
$scope.handleSetModel();
|
|
@@ -2292,13 +2382,13 @@ angular.module('niceElements')
|
|
|
2292
2382
|
|
|
2293
2383
|
|
|
2294
2384
|
// ----------------------------------- Handle set model -----------------------------------
|
|
2295
|
-
$scope.handleSetModel = function() {
|
|
2385
|
+
$scope.handleSetModel = function () {
|
|
2296
2386
|
var obj = angular.copy($scope.selected);
|
|
2297
2387
|
|
|
2298
2388
|
if ($scope.selected != null) {
|
|
2299
2389
|
// Remove selected flag
|
|
2300
2390
|
if ($scope.multiple) {
|
|
2301
|
-
angular.forEach(obj, function(o) {
|
|
2391
|
+
angular.forEach(obj, function (o) {
|
|
2302
2392
|
o._selected = undefined;
|
|
2303
2393
|
});
|
|
2304
2394
|
} else {
|
|
@@ -2308,7 +2398,7 @@ angular.module('niceElements')
|
|
|
2308
2398
|
// Selected is object
|
|
2309
2399
|
if ($scope.selectedIsKey) {
|
|
2310
2400
|
if ($scope.multiple) {
|
|
2311
|
-
angular.forEach(obj, function(o) {
|
|
2401
|
+
angular.forEach(obj, function (o) {
|
|
2312
2402
|
o = o[$scope.objKey];
|
|
2313
2403
|
});
|
|
2314
2404
|
} else {
|
|
@@ -2316,7 +2406,7 @@ angular.module('niceElements')
|
|
|
2316
2406
|
}
|
|
2317
2407
|
}
|
|
2318
2408
|
}
|
|
2319
|
-
|
|
2409
|
+
|
|
2320
2410
|
if ($scope.clearOnSelect) {
|
|
2321
2411
|
// Clear on select
|
|
2322
2412
|
$scope.model = null;
|
|
@@ -2333,7 +2423,7 @@ angular.module('niceElements')
|
|
|
2333
2423
|
|
|
2334
2424
|
|
|
2335
2425
|
// ----------------------------------- Handle default -----------------------------------
|
|
2336
|
-
$scope.handleDefault = function() {
|
|
2426
|
+
$scope.handleDefault = function () {
|
|
2337
2427
|
if ($scope.model) $scope.handleModelChange();
|
|
2338
2428
|
if (!$scope.nullable && !$scope.model && !$scope.clearOnSelect && $scope.internalList && $scope.internalList.length > 0) {
|
|
2339
2429
|
$scope.handleSelected($scope.internalList[0], 0);
|
|
@@ -2352,16 +2442,16 @@ angular.module('niceElements')
|
|
|
2352
2442
|
$scope.handleModelChange();
|
|
2353
2443
|
});
|
|
2354
2444
|
|
|
2355
|
-
$scope.handleModelChange = function() {
|
|
2445
|
+
$scope.handleModelChange = function () {
|
|
2356
2446
|
$scope.selected = angular.copy($scope.model);
|
|
2357
|
-
angular.forEach($scope.internalList, function(i, index) {
|
|
2447
|
+
angular.forEach($scope.internalList, function (i, index) {
|
|
2358
2448
|
i._selected = false;
|
|
2359
2449
|
|
|
2360
2450
|
if ($scope.selectedIsKey) {
|
|
2361
2451
|
// Not object
|
|
2362
2452
|
if ($scope.multiple) {
|
|
2363
2453
|
// Multiple
|
|
2364
|
-
angular.forEach($scope.selected, function(s) {
|
|
2454
|
+
angular.forEach($scope.selected, function (s) {
|
|
2365
2455
|
if (i[$scope.objKey] == s) {
|
|
2366
2456
|
i._selected = true;
|
|
2367
2457
|
// $scope.selected.push(i);
|
|
@@ -2376,12 +2466,12 @@ angular.module('niceElements')
|
|
|
2376
2466
|
$scope.selectedIndex = index;
|
|
2377
2467
|
$scope.scrollToHover();
|
|
2378
2468
|
}
|
|
2379
|
-
}
|
|
2469
|
+
}
|
|
2380
2470
|
} else {
|
|
2381
2471
|
// Is object
|
|
2382
2472
|
if ($scope.multiple) {
|
|
2383
2473
|
// Multiple
|
|
2384
|
-
angular.forEach($scope.selected, function(s) {
|
|
2474
|
+
angular.forEach($scope.selected, function (s) {
|
|
2385
2475
|
if (i[$scope.objKey] == s[$scope.objKey]) {
|
|
2386
2476
|
i._selected = true;
|
|
2387
2477
|
// $scope.selected.push(i);
|
|
@@ -2400,41 +2490,16 @@ angular.module('niceElements')
|
|
|
2400
2490
|
}
|
|
2401
2491
|
});
|
|
2402
2492
|
}
|
|
2403
|
-
|
|
2404
|
-
// ----------------------------------- Handle fixed position -----------------------------------
|
|
2405
|
-
if ($scope.positionFixed) {
|
|
2406
|
-
$scope.dropdownButton = $element[0].getElementsByClassName('btn-dropdown')[0]
|
|
2407
|
-
$scope.dropdownMenu = $element[0].getElementsByClassName('dropdown-menu')[0]
|
|
2408
|
-
$scope.updateStyle = function () {
|
|
2409
|
-
if (this.isOpen) {
|
|
2410
|
-
var buttonPos = $scope.dropdownButton.getBoundingClientRect();
|
|
2411
|
-
$scope.dropdownMenu.style.top = (buttonPos.top + buttonPos.height) + "px";
|
|
2412
|
-
$scope.dropdownMenu.style.left = buttonPos.left + "px";
|
|
2413
|
-
$scope.dropdownMenu.style.width = buttonPos.width + "px";
|
|
2414
|
-
}
|
|
2415
|
-
}
|
|
2416
|
-
|
|
2417
|
-
$scope.updateStyle();
|
|
2418
|
-
|
|
2419
|
-
angular.element($window).on("resize", function () {
|
|
2420
|
-
$scope.updateStyle();
|
|
2421
|
-
})
|
|
2422
|
-
|
|
2423
|
-
angular.element($window).on("scroll", function () {
|
|
2424
|
-
$scope.updateStyle();
|
|
2425
|
-
})
|
|
2426
|
-
}
|
|
2427
|
-
|
|
2428
2493
|
|
|
2429
2494
|
// ----------------------------------- Watch for keydown and keypress -----------------------------------
|
|
2430
2495
|
$element.bind("keydown keypress", function (event) {
|
|
2431
2496
|
// Arrow Up
|
|
2432
2497
|
if (event.keyCode == 38) {
|
|
2433
2498
|
event.preventDefault();
|
|
2434
|
-
$timeout(function() {
|
|
2435
|
-
if (
|
|
2499
|
+
$timeout(function () {
|
|
2500
|
+
if ($scope.selectedIndex > 0) {
|
|
2436
2501
|
$scope.selectedIndex -= 1;
|
|
2437
|
-
$timeout(function() {
|
|
2502
|
+
$timeout(function () {
|
|
2438
2503
|
$scope.scrollToHover();
|
|
2439
2504
|
});
|
|
2440
2505
|
}
|
|
@@ -2444,10 +2509,10 @@ angular.module('niceElements')
|
|
|
2444
2509
|
// Arrow Down
|
|
2445
2510
|
if (event.keyCode == 40) {
|
|
2446
2511
|
event.preventDefault();
|
|
2447
|
-
$timeout(function() {
|
|
2512
|
+
$timeout(function () {
|
|
2448
2513
|
if ($scope.internalList && $scope.selectedIndex < $scope.internalList.length - 1) {
|
|
2449
2514
|
$scope.selectedIndex += 1;
|
|
2450
|
-
$timeout(function() {
|
|
2515
|
+
$timeout(function () {
|
|
2451
2516
|
$scope.scrollToHover();
|
|
2452
2517
|
});
|
|
2453
2518
|
}
|
|
@@ -2457,14 +2522,14 @@ angular.module('niceElements')
|
|
|
2457
2522
|
// Enter
|
|
2458
2523
|
if (event.keyCode == 13) {
|
|
2459
2524
|
event.preventDefault();
|
|
2460
|
-
$timeout(function() {
|
|
2525
|
+
$timeout(function () {
|
|
2461
2526
|
$scope.handleSelected($scope.internalList[$scope.selectedIndex], $scope.selectedIndex);
|
|
2462
2527
|
});
|
|
2463
2528
|
}
|
|
2464
2529
|
|
|
2465
2530
|
// Escape
|
|
2466
2531
|
if (event.keyCode == 27) {
|
|
2467
|
-
$timeout(function() {
|
|
2532
|
+
$timeout(function () {
|
|
2468
2533
|
$scope.close();
|
|
2469
2534
|
});
|
|
2470
2535
|
}
|
|
@@ -4317,6 +4382,40 @@ angular.module('niceElements')
|
|
|
4317
4382
|
|
|
4318
4383
|
if (!$scope.debounceTime) $scope.debounceTime = 500;
|
|
4319
4384
|
if (!$scope.model) $scope.model = "";
|
|
4385
|
+
|
|
4386
|
+
// Setup popper
|
|
4387
|
+
// https://popper.js.org/docs/v2/constructors/
|
|
4388
|
+
$scope.setupPopper = function() {
|
|
4389
|
+
var button = $element[0].getElementsByClassName('nice-search-button')[0];
|
|
4390
|
+
var tooltip = $element[0].getElementsByClassName('nice-search-dropdown-wrapper')[0];
|
|
4391
|
+
$scope.popper = Popper.createPopper(button, tooltip, {
|
|
4392
|
+
strategy: 'fixed',
|
|
4393
|
+
placement: 'bottom-start',
|
|
4394
|
+
modifiers: [
|
|
4395
|
+
{
|
|
4396
|
+
name: 'offset',
|
|
4397
|
+
options: {
|
|
4398
|
+
offset: [0, 5],
|
|
4399
|
+
},
|
|
4400
|
+
},
|
|
4401
|
+
{
|
|
4402
|
+
name: "sameWidth",
|
|
4403
|
+
enabled: true,
|
|
4404
|
+
phase: "beforeWrite",
|
|
4405
|
+
requires: ["computeStyles"],
|
|
4406
|
+
fn: ({ state }) => {
|
|
4407
|
+
state.styles.popper.width = `${state.rects.reference.width}px`;
|
|
4408
|
+
},
|
|
4409
|
+
effect: ({ state }) => {
|
|
4410
|
+
state.elements.popper.style.width = `${
|
|
4411
|
+
state.elements.reference.offsetWidth
|
|
4412
|
+
}px`;
|
|
4413
|
+
}
|
|
4414
|
+
}
|
|
4415
|
+
],
|
|
4416
|
+
});
|
|
4417
|
+
};
|
|
4418
|
+
$scope.setupPopper();
|
|
4320
4419
|
|
|
4321
4420
|
// ------------------- On focus -------------------
|
|
4322
4421
|
$scope.onFocus = function() {
|
|
@@ -4334,6 +4433,9 @@ angular.module('niceElements')
|
|
|
4334
4433
|
// ------------------- On focus -------------------
|
|
4335
4434
|
$scope.open = function() {
|
|
4336
4435
|
$scope.isOpen = true;
|
|
4436
|
+
$timeout(function() {
|
|
4437
|
+
if ($scope.popper) $scope.popper.update();
|
|
4438
|
+
});
|
|
4337
4439
|
};
|
|
4338
4440
|
|
|
4339
4441
|
|
|
@@ -4343,6 +4445,10 @@ angular.module('niceElements')
|
|
|
4343
4445
|
|
|
4344
4446
|
var input = $element[0].getElementsByTagName('input')[0];
|
|
4345
4447
|
if (input) input.blur();
|
|
4448
|
+
|
|
4449
|
+
$timeout(function() {
|
|
4450
|
+
$scope.popper.update();
|
|
4451
|
+
})
|
|
4346
4452
|
};
|
|
4347
4453
|
|
|
4348
4454
|
|
|
@@ -5065,12 +5171,13 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
5065
5171
|
"</div>\n" +
|
|
5066
5172
|
"<div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\">\n" +
|
|
5067
5173
|
"<div class=\"disabled-shield\" ng-if=\"isDisabled\"></div>\n" +
|
|
5068
|
-
"<div class=\"input-group\" ng-class=\"{ 'open': isOpen }\" ng-
|
|
5174
|
+
"<div class=\"nice-date-button input-group\" ng-class=\"{ 'open': isOpen }\" ng-show=\"!inline\" ng-click=\"toggleOpen()\">\n" +
|
|
5069
5175
|
"<input type=\"text\" class=\"form-control\" value=\"{{ model | niceDate:time }}\" readonly=\"readonly\">\n" +
|
|
5070
5176
|
"<span class=\"input-group-addon clickable\">\n" +
|
|
5071
5177
|
"<i class=\"fa fa-calendar\"></i>\n" +
|
|
5072
5178
|
"</span>\n" +
|
|
5073
5179
|
"</div>\n" +
|
|
5180
|
+
"<div ng-class=\"{ 'nice-date-dropdown-wrapper': !inline }\">\n" +
|
|
5074
5181
|
"<div ng-class=\"{ 'nice-date-dropdown': !inline }\" ng-if=\"inline || isOpen\">\n" +
|
|
5075
5182
|
"<div class=\"nice-date-date\" ng-class=\"{ 'with-time': time }\">\n" +
|
|
5076
5183
|
"<div class=\"nice-date-header\">\n" +
|
|
@@ -5089,13 +5196,13 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
5089
5196
|
"</div>\n" +
|
|
5090
5197
|
"<div class=\"nice-date-week\" ng-repeat=\"week in weeks\">\n" +
|
|
5091
5198
|
"<span class=\"nice-date-day\" title=\"{{ day.value }}\" ng-class=\"{\n" +
|
|
5092
|
-
"
|
|
5093
|
-
"
|
|
5094
|
-
"
|
|
5095
|
-
"
|
|
5096
|
-
"
|
|
5097
|
-
"
|
|
5098
|
-
"
|
|
5199
|
+
" 'today': day.isToday,\n" +
|
|
5200
|
+
" 'different-month': !day.isCurrentMonth,\n" +
|
|
5201
|
+
" 'selected': isSameDay(model, day.date),\n" +
|
|
5202
|
+
" 'weekend': day.isWeekday,\n" +
|
|
5203
|
+
" 'disabled': day.isDisabled,\n" +
|
|
5204
|
+
" 'between': isBetween(day.date, model, nextDate)\n" +
|
|
5205
|
+
" }\" ng-click=\"select(day)\" ng-repeat=\"day in week.days\">{{ day.number }}</span>\n" +
|
|
5099
5206
|
"</div>\n" +
|
|
5100
5207
|
"</div>\n" +
|
|
5101
5208
|
"<div class=\"nice-date-time\" ng-if=\"time\">\n" +
|
|
@@ -5113,6 +5220,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
5113
5220
|
"</div>\n" +
|
|
5114
5221
|
"</div>\n" +
|
|
5115
5222
|
"</div>\n" +
|
|
5223
|
+
"</div>\n" +
|
|
5116
5224
|
"</div>"
|
|
5117
5225
|
);
|
|
5118
5226
|
|
|
@@ -5151,11 +5259,12 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
5151
5259
|
"<nice-help class=\"nice-title-help\" ng-if=\"help\" text=\"{{ help }}\"></nice-help>\n" +
|
|
5152
5260
|
"</div>\n" +
|
|
5153
5261
|
"<div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\">\n" +
|
|
5154
|
-
"<div class=\"input-group\" ng-class=\"{ 'open': isOpen }\" ng-click=\"open()\">\n" +
|
|
5262
|
+
"<div class=\"nice-daterange-picker-button input-group\" ng-class=\"{ 'open': isOpen }\" ng-click=\"open()\">\n" +
|
|
5155
5263
|
"<input type=\"text\" class=\"form-control\" value=\"{{ modelFormat }}\" readonly=\"readonly\">\n" +
|
|
5156
5264
|
"<span class=\"input-group-addon clickable\"><i class=\"fa fa-calendar\"></i></span>\n" +
|
|
5157
5265
|
"</div>\n" +
|
|
5158
|
-
"<div class=\"
|
|
5266
|
+
"<div class=\"nice-daterange-picker-wrapper\">\n" +
|
|
5267
|
+
"<div class=\"dtp-wrapper\" ng-if=\"isOpen\">\n" +
|
|
5159
5268
|
"<div class=\"dtp-buttons-left\">\n" +
|
|
5160
5269
|
"<div class=\"dtp-buttons-top\">\n" +
|
|
5161
5270
|
"<a class=\"btn btn-primary btn-block\" ng-click=\"selectToday()\" translate translate-context=\"Nice\">Last 24 hours</a>\n" +
|
|
@@ -5177,6 +5286,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
5177
5286
|
"</div>\n" +
|
|
5178
5287
|
"</div>\n" +
|
|
5179
5288
|
"</div>\n" +
|
|
5289
|
+
"</div>\n" +
|
|
5180
5290
|
"</div>"
|
|
5181
5291
|
);
|
|
5182
5292
|
|
|
@@ -5319,23 +5429,25 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
5319
5429
|
"<span class=\"caret\" ng-show=\"!loading\"></span>\n" +
|
|
5320
5430
|
"<nice-loader visible-when=\"!loading\"></nice-loader>\n" +
|
|
5321
5431
|
"</button>\n" +
|
|
5322
|
-
"<div class=\"
|
|
5432
|
+
"<div class=\"nice-dropdown-menu-wrapper\">\n" +
|
|
5433
|
+
"<div class=\"nice-dropdown-menu\" ng-if=\"isOpen\">\n" +
|
|
5323
5434
|
"<div class=\"search-bar\" ng-if=\"searchFunction\">\n" +
|
|
5324
5435
|
"<input ng-model=\"internal.search\" ng-model-options=\"{ debounce: 500 }\" ng-change=\"handleSearch()\" placeholder=\"{{ searchText }}\">\n" +
|
|
5325
5436
|
"<span class=\"icon\"><i class=\"fa fa-search\"></i></span>\n" +
|
|
5326
5437
|
"</div>\n" +
|
|
5438
|
+
"<div class=\"nice-dropdown-items\">\n" +
|
|
5327
5439
|
"<div class=\"nice-no-data\" ng-if=\"internalList && internalList.length == 0\">{{ noDataText }}</div>\n" +
|
|
5328
|
-
"<
|
|
5329
|
-
"<li class=\"null-item\" ng-if=\"nullable && internalList.length != 0\" ng-click=\"handleSelected(null, -1)\">\n" +
|
|
5440
|
+
"<div class=\"nice-dropdown-item null-item\" ng-if=\"nullable && internalList.length != 0\" ng-click=\"handleSelected(null, -1)\">\n" +
|
|
5330
5441
|
"{{ nullableText }}\n" +
|
|
5331
|
-
"</
|
|
5332
|
-
"<
|
|
5442
|
+
"</div>\n" +
|
|
5443
|
+
"<div class=\"nice-dropdown-item\" ng-repeat=\"item in internalList\" ng-click=\"handleSelected(item, $index)\" ng-class=\"{ 'selected': item._selected, 'hover': $index == selectedIndex }\">\n" +
|
|
5333
5444
|
"<span class=\"choice-checkbox\" ng-if=\"multiple\"><i class=\"fa fa-check\"></i></span>\n" +
|
|
5334
5445
|
"<span ng-transclude=\"option\">\n" +
|
|
5335
5446
|
"<span ng-class=\"{ 'multiple-item': multiple }\">{{ item[objValue] }}</span>\n" +
|
|
5336
5447
|
"</span>\n" +
|
|
5337
|
-
"</
|
|
5338
|
-
"</
|
|
5448
|
+
"</div>\n" +
|
|
5449
|
+
"</div>\n" +
|
|
5450
|
+
"</div>\n" +
|
|
5339
5451
|
"</div>\n" +
|
|
5340
5452
|
"<button class=\"btn btn-primary add-btn\" type=\"button\" ng-if=\"addButtonFunction && !isDisabled\" ng-click=\"addButtonFunction()\">+</button>\n" +
|
|
5341
5453
|
"</div>\n" +
|
|
@@ -5666,13 +5778,15 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
5666
5778
|
"<nice-help class=\"nice-title-help\" ng-if=\"help\" text=\"{{ help }}\"></nice-help>\n" +
|
|
5667
5779
|
"</div>\n" +
|
|
5668
5780
|
"<div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\" click-outside=\"close()\">\n" +
|
|
5669
|
-
"<div class=\"input-group\" ng-class=\"{ 'disabled': isDisabled, 'has-warning': !isDisabled && form.$invalid && form.$dirty, 'has-success': !isDisabled && form.$valid && form.$dirty}\">\n" +
|
|
5781
|
+
"<div class=\"nice-search-button input-group\" ng-class=\"{ 'disabled': isDisabled, 'has-warning': !isDisabled && form.$invalid && form.$dirty, 'has-success': !isDisabled && form.$valid && form.$dirty}\">\n" +
|
|
5670
5782
|
"<input class=\"form-control\" type=\"text\" id=\"{{ id }}\" ng-model=\"model\" placeholder=\"{{ placeholder }}\" ng-disabled=\"isDisabled\" ng-change=\"updateSearch()\" ng-focus=\"onFocus()\" tabindex=\"{{ tabIndex }}\">\n" +
|
|
5671
5783
|
"<span class=\"input-group-addon clickable\" ng-click=\"onFocus()\">\n" +
|
|
5672
5784
|
"<i ng-show=\"!loading\" class=\"fa fa-search\"></i>\n" +
|
|
5673
5785
|
"<i ng-show=\"loading\" class=\"fa fa-refresh fa-spin\"></i>\n" +
|
|
5674
5786
|
"</span>\n" +
|
|
5675
|
-
"
|
|
5787
|
+
"</div>\n" +
|
|
5788
|
+
"<div class=\"nice-search-dropdown-wrapper\">\n" +
|
|
5789
|
+
"<div class=\"nice-search-dropdown\" ng-if=\"showDropdown && isOpen\">\n" +
|
|
5676
5790
|
"<div class=\"nice-search-row nice-search-row-loading\" ng-if=\"loading && results.length == 0\">\n" +
|
|
5677
5791
|
"<nice-loader visible-when=\"!loading\"></nice-loader>\n" +
|
|
5678
5792
|
"</div>\n" +
|