@materializecss/materialize 2.2.1 → 2.2.2
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/README.md +8 -11
- package/dist/css/materialize.css +2790 -2140
- package/dist/css/materialize.min.css +3 -5
- package/dist/css/materialize.min.css.map +1 -1
- package/dist/js/materialize.cjs.js +528 -215
- package/dist/js/materialize.d.ts +115 -13
- package/dist/js/materialize.js +528 -215
- package/dist/js/materialize.min.js +3 -3
- package/dist/js/materialize.mjs +528 -215
- package/package.json +5 -3
- package/sass/components/_badges.scss +1 -1
- package/sass/components/_breadcrumb.scss +27 -0
- package/sass/components/_buttons.scss +60 -167
- package/sass/components/_cards.scss +36 -17
- package/sass/components/_carousel.scss +16 -18
- package/sass/components/_chips.scss +6 -14
- package/sass/components/_collapsible.scss +8 -5
- package/sass/components/_collection.scss +2 -3
- package/sass/components/_color-variables.scss +35 -3
- package/sass/components/_datepicker.scss +95 -48
- package/sass/components/_dropdown.scss +11 -7
- package/sass/components/_global.scss +22 -111
- package/sass/components/_grid.scss +3 -1
- package/sass/components/_materialbox.scss +5 -6
- package/sass/components/_modal.scss +11 -4
- package/sass/components/_navbar.scss +17 -16
- package/sass/components/_pagination.scss +47 -0
- package/sass/components/_preloader.scss +3 -1
- package/sass/components/_pulse.scss +3 -3
- package/sass/components/_sidenav.scss +15 -17
- package/sass/components/_slider.scss +2 -4
- package/sass/components/_tabs.scss +45 -33
- package/sass/components/_tapTarget.scss +10 -11
- package/sass/components/_timepicker.scss +62 -47
- package/sass/components/_toast.scss +3 -0
- package/sass/components/_tooltip.scss +0 -8
- package/sass/components/_transitions.scss +2 -3
- package/sass/components/_typography.scss +5 -5
- package/sass/components/_variables.scss +3 -2
- package/sass/components/forms/_checkboxes.scss +1 -2
- package/sass/components/forms/_file-input.scss +7 -9
- package/sass/components/forms/_forms.scss +8 -14
- package/sass/components/forms/_input-fields.scss +17 -11
- package/sass/components/forms/_range.scss +6 -1
- package/sass/components/forms/_select.scss +11 -103
- package/sass/components/forms/_switches.scss +2 -0
- package/sass/components/mixins.module.scss +159 -0
- package/sass/materialize.scss +39 -43
- package/sass/components/_color-classes.scss +0 -32
package/dist/js/materialize.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Materialize v2.2.
|
|
3
|
-
* Copyright 2014-
|
|
2
|
+
* Materialize v2.2.2 (https://materializeweb.com)
|
|
3
|
+
* Copyright 2014-2025 Materialize
|
|
4
4
|
* MIT License (https://raw.githubusercontent.com/materializecss/materialize/master/LICENSE)
|
|
5
5
|
*/
|
|
6
6
|
var M = (function (exports) {
|
|
@@ -219,13 +219,11 @@ var M = (function (exports) {
|
|
|
219
219
|
if (!previous && options.leading === false)
|
|
220
220
|
previous = now;
|
|
221
221
|
const remaining = wait - (now - previous);
|
|
222
|
-
context = this;
|
|
223
222
|
if (remaining <= 0) {
|
|
224
223
|
clearTimeout(timeout);
|
|
225
224
|
timeout = null;
|
|
226
225
|
previous = now;
|
|
227
|
-
result = func.apply(
|
|
228
|
-
context = args = null;
|
|
226
|
+
result = func.apply(this, args);
|
|
229
227
|
}
|
|
230
228
|
else if (!timeout && options.trailing !== false) {
|
|
231
229
|
timeout = setTimeout(later, remaining);
|
|
@@ -233,6 +231,105 @@ var M = (function (exports) {
|
|
|
233
231
|
return result;
|
|
234
232
|
};
|
|
235
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Renders confirm/close buttons with callback function
|
|
236
|
+
*/
|
|
237
|
+
static createConfirmationContainer(container, confirmText, cancelText, onConfirm, onCancel) {
|
|
238
|
+
const confirmationButtonsContainer = document.createElement('div');
|
|
239
|
+
confirmationButtonsContainer.classList.add('confirmation-btns');
|
|
240
|
+
container.append(confirmationButtonsContainer);
|
|
241
|
+
this.createButton(confirmationButtonsContainer, cancelText, ['btn-cancel'], true, onCancel);
|
|
242
|
+
this.createButton(confirmationButtonsContainer, confirmText, ['btn-confirm'], true, onConfirm);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Renders a button with optional callback function
|
|
246
|
+
*/
|
|
247
|
+
static createButton(container, text, className = [], visibility = true, callback = null) {
|
|
248
|
+
className = className.concat(['btn', 'waves-effect', 'text']);
|
|
249
|
+
const button = document.createElement('button');
|
|
250
|
+
button.className = className.join(' ');
|
|
251
|
+
button.style.visibility = visibility ? 'visible' : 'hidden';
|
|
252
|
+
button.type = 'button';
|
|
253
|
+
button.tabIndex = !!visibility ? 0 : -1;
|
|
254
|
+
button.innerText = text;
|
|
255
|
+
button.addEventListener('click', callback);
|
|
256
|
+
button.addEventListener('keypress', (e) => {
|
|
257
|
+
if (Utils.keys.ENTER.includes(e.key))
|
|
258
|
+
callback(e);
|
|
259
|
+
});
|
|
260
|
+
container.append(button);
|
|
261
|
+
}
|
|
262
|
+
static _setAbsolutePosition(origin, container, position, margin, transitionMovement, align = 'center') {
|
|
263
|
+
const originHeight = origin.offsetHeight, originWidth = origin.offsetWidth, containerHeight = container.offsetHeight, containerWidth = container.offsetWidth;
|
|
264
|
+
let xMovement = 0, yMovement = 0, targetTop = origin.getBoundingClientRect().top + Utils.getDocumentScrollTop(), targetLeft = origin.getBoundingClientRect().left + Utils.getDocumentScrollLeft();
|
|
265
|
+
if (position === 'top') {
|
|
266
|
+
targetTop += -containerHeight - margin;
|
|
267
|
+
if (align === 'center') {
|
|
268
|
+
targetLeft += originWidth / 2 - containerWidth / 2; // This is center align
|
|
269
|
+
}
|
|
270
|
+
yMovement = -transitionMovement;
|
|
271
|
+
}
|
|
272
|
+
else if (position === 'right') {
|
|
273
|
+
targetTop += originHeight / 2 - containerHeight / 2;
|
|
274
|
+
targetLeft = originWidth + margin;
|
|
275
|
+
xMovement = transitionMovement;
|
|
276
|
+
}
|
|
277
|
+
else if (position === 'left') {
|
|
278
|
+
targetTop += originHeight / 2 - containerHeight / 2;
|
|
279
|
+
targetLeft = -containerWidth - margin;
|
|
280
|
+
xMovement = -transitionMovement;
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
targetTop += originHeight + margin;
|
|
284
|
+
if (align === 'center') {
|
|
285
|
+
targetLeft += originWidth / 2 - containerWidth / 2; // This is center align
|
|
286
|
+
}
|
|
287
|
+
yMovement = transitionMovement;
|
|
288
|
+
}
|
|
289
|
+
if (align === 'right') {
|
|
290
|
+
targetLeft += originWidth - containerWidth - margin;
|
|
291
|
+
}
|
|
292
|
+
const newCoordinates = Utils._repositionWithinScreen(targetLeft, targetTop, containerWidth, containerHeight, margin, transitionMovement, align);
|
|
293
|
+
container.style.top = newCoordinates.y + 'px';
|
|
294
|
+
container.style.left = newCoordinates.x + 'px';
|
|
295
|
+
return { x: xMovement, y: yMovement };
|
|
296
|
+
}
|
|
297
|
+
static _repositionWithinScreen(x, y, width, height, margin, transitionMovement, align) {
|
|
298
|
+
const scrollLeft = Utils.getDocumentScrollLeft();
|
|
299
|
+
const scrollTop = Utils.getDocumentScrollTop();
|
|
300
|
+
let newX = x - scrollLeft;
|
|
301
|
+
let newY = y - scrollTop;
|
|
302
|
+
const bounding = {
|
|
303
|
+
left: newX,
|
|
304
|
+
top: newY,
|
|
305
|
+
width: width,
|
|
306
|
+
height: height
|
|
307
|
+
};
|
|
308
|
+
let offset;
|
|
309
|
+
if (align === 'left' || align == 'center') {
|
|
310
|
+
offset = margin + transitionMovement;
|
|
311
|
+
}
|
|
312
|
+
else if (align === 'right') {
|
|
313
|
+
offset = margin - transitionMovement;
|
|
314
|
+
}
|
|
315
|
+
const edges = Utils.checkWithinContainer(document.body, bounding, offset);
|
|
316
|
+
if (edges.left) {
|
|
317
|
+
newX = offset;
|
|
318
|
+
}
|
|
319
|
+
else if (edges.right) {
|
|
320
|
+
newX -= newX + width - window.innerWidth;
|
|
321
|
+
}
|
|
322
|
+
if (edges.top) {
|
|
323
|
+
newY = offset;
|
|
324
|
+
}
|
|
325
|
+
else if (edges.bottom) {
|
|
326
|
+
newY -= newY + height - window.innerHeight;
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
x: newX + scrollLeft,
|
|
330
|
+
y: newY + scrollTop
|
|
331
|
+
};
|
|
332
|
+
}
|
|
236
333
|
}
|
|
237
334
|
|
|
238
335
|
/**
|
|
@@ -303,7 +400,7 @@ var M = (function (exports) {
|
|
|
303
400
|
}
|
|
304
401
|
}
|
|
305
402
|
|
|
306
|
-
const _defaults$
|
|
403
|
+
const _defaults$n = {
|
|
307
404
|
alignment: 'left',
|
|
308
405
|
autoFocus: true,
|
|
309
406
|
constrainWidth: true,
|
|
@@ -351,12 +448,12 @@ var M = (function (exports) {
|
|
|
351
448
|
this.filterQuery = [];
|
|
352
449
|
this.el.ariaExpanded = 'false';
|
|
353
450
|
// Move dropdown-content after dropdown-trigger
|
|
354
|
-
this.
|
|
451
|
+
this._moveDropdownToElement();
|
|
355
452
|
this._makeDropdownFocusable();
|
|
356
453
|
this._setupEventHandlers();
|
|
357
454
|
}
|
|
358
455
|
static get defaults() {
|
|
359
|
-
return _defaults$
|
|
456
|
+
return _defaults$n;
|
|
360
457
|
}
|
|
361
458
|
/**
|
|
362
459
|
* Initializes instances of Dropdown.
|
|
@@ -417,7 +514,7 @@ var M = (function (exports) {
|
|
|
417
514
|
}
|
|
418
515
|
_handleClick = (e) => {
|
|
419
516
|
e.preventDefault();
|
|
420
|
-
this._moveDropdown(e.target.closest('li'));
|
|
517
|
+
//this._moveDropdown((<HTMLElement>e.target).closest('li'));
|
|
421
518
|
if (this.isOpen) {
|
|
422
519
|
this.close();
|
|
423
520
|
}
|
|
@@ -425,8 +522,8 @@ var M = (function (exports) {
|
|
|
425
522
|
this.open();
|
|
426
523
|
}
|
|
427
524
|
};
|
|
428
|
-
_handleMouseEnter = (
|
|
429
|
-
this._moveDropdown(e.target.closest('li'));
|
|
525
|
+
_handleMouseEnter = () => {
|
|
526
|
+
//this._moveDropdown((<HTMLElement>e.target).closest('li'));
|
|
430
527
|
this.open();
|
|
431
528
|
};
|
|
432
529
|
_handleMouseLeave = (e) => {
|
|
@@ -512,7 +609,7 @@ var M = (function (exports) {
|
|
|
512
609
|
else if (Utils.keys.ENTER.includes(e.key) && this.isOpen) {
|
|
513
610
|
// Search for <a> and <button>
|
|
514
611
|
const focusedElement = this.dropdownEl.children[this.focusedIndex];
|
|
515
|
-
const activatableElement = focusedElement
|
|
612
|
+
const activatableElement = focusedElement?.querySelector('a, button');
|
|
516
613
|
// Click a or button tag if exists, otherwise click li tag
|
|
517
614
|
if (!!activatableElement) {
|
|
518
615
|
activatableElement.click();
|
|
@@ -572,19 +669,17 @@ var M = (function (exports) {
|
|
|
572
669
|
this.dropdownEl.style.top = '';
|
|
573
670
|
this.dropdownEl.style.transformOrigin = '';
|
|
574
671
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
if (!!this.options.container) {
|
|
672
|
+
_moveDropdownToElement(containerEl = null) {
|
|
673
|
+
if (this.options.container) {
|
|
578
674
|
this.options.container.append(this.dropdownEl);
|
|
675
|
+
return;
|
|
579
676
|
}
|
|
580
|
-
|
|
581
|
-
if (!containerEl.contains(this.dropdownEl))
|
|
677
|
+
if (containerEl) {
|
|
678
|
+
if (!containerEl.contains(this.dropdownEl))
|
|
582
679
|
containerEl.append(this.dropdownEl);
|
|
583
|
-
|
|
584
|
-
}
|
|
585
|
-
else {
|
|
586
|
-
this.el.after(this.dropdownEl);
|
|
680
|
+
return;
|
|
587
681
|
}
|
|
682
|
+
this.el.after(this.dropdownEl);
|
|
588
683
|
}
|
|
589
684
|
_makeDropdownFocusable() {
|
|
590
685
|
if (!this.dropdownEl)
|
|
@@ -745,7 +840,7 @@ var M = (function (exports) {
|
|
|
745
840
|
}
|
|
746
841
|
if (getComputedStyle(closestOverflowParent).position === 'static')
|
|
747
842
|
closestOverflowParent.style.position = 'relative';
|
|
748
|
-
this._moveDropdown(closestOverflowParent);
|
|
843
|
+
//this._moveDropdown(closestOverflowParent);
|
|
749
844
|
// Set width before calculating positionInfo
|
|
750
845
|
const idealWidth = this.options.constrainWidth
|
|
751
846
|
? this.el.getBoundingClientRect().width
|
|
@@ -809,7 +904,7 @@ var M = (function (exports) {
|
|
|
809
904
|
};
|
|
810
905
|
}
|
|
811
906
|
|
|
812
|
-
const _defaults$
|
|
907
|
+
const _defaults$m = {
|
|
813
908
|
data: [], // Autocomplete data set
|
|
814
909
|
onAutocomplete: null, // Callback for when autocompleted
|
|
815
910
|
dropdownOptions: {
|
|
@@ -822,11 +917,12 @@ var M = (function (exports) {
|
|
|
822
917
|
isMultiSelect: false,
|
|
823
918
|
onSearch: (text, autocomplete) => {
|
|
824
919
|
const normSearch = text.toLocaleLowerCase();
|
|
825
|
-
autocomplete.setMenuItems(autocomplete.options.data.filter((option) => option.id.toString().toLocaleLowerCase().includes(normSearch)
|
|
826
|
-
option.text?.toLocaleLowerCase().includes(normSearch)));
|
|
920
|
+
autocomplete.setMenuItems(autocomplete.options.data.filter((option) => option.id.toString().toLocaleLowerCase().includes(normSearch)
|
|
921
|
+
|| option.text?.toLocaleLowerCase().includes(normSearch)));
|
|
827
922
|
},
|
|
828
923
|
maxDropDownHeight: '300px',
|
|
829
|
-
allowUnsafeHTML: false
|
|
924
|
+
allowUnsafeHTML: false,
|
|
925
|
+
selected: []
|
|
830
926
|
};
|
|
831
927
|
class Autocomplete extends Component {
|
|
832
928
|
/** If the autocomplete is open. */
|
|
@@ -855,7 +951,7 @@ var M = (function (exports) {
|
|
|
855
951
|
this.count = 0;
|
|
856
952
|
this.activeIndex = -1;
|
|
857
953
|
this.oldVal = '';
|
|
858
|
-
this.selectedValues = [];
|
|
954
|
+
this.selectedValues = this.selectedValues || this.options.selected.map((value) => ({ id: value })) || [];
|
|
859
955
|
this.menuItems = this.options.data || [];
|
|
860
956
|
this.$active = null;
|
|
861
957
|
this._mousedown = false;
|
|
@@ -863,7 +959,7 @@ var M = (function (exports) {
|
|
|
863
959
|
this._setupEventHandlers();
|
|
864
960
|
}
|
|
865
961
|
static get defaults() {
|
|
866
|
-
return _defaults$
|
|
962
|
+
return _defaults$m;
|
|
867
963
|
}
|
|
868
964
|
/**
|
|
869
965
|
* Initializes instances of Autocomplete.
|
|
@@ -912,6 +1008,7 @@ var M = (function (exports) {
|
|
|
912
1008
|
this.container.style.maxHeight = this.options.maxDropDownHeight;
|
|
913
1009
|
this.container.id = `autocomplete-options-${Utils.guid()}`;
|
|
914
1010
|
this.container.classList.add('autocomplete-content', 'dropdown-content');
|
|
1011
|
+
this.container.ariaExpanded = 'true';
|
|
915
1012
|
this.el.setAttribute('data-target', this.container.id);
|
|
916
1013
|
this.menuItems.forEach((menuItem) => {
|
|
917
1014
|
const itemElement = this._createDropdownItem(menuItem);
|
|
@@ -944,6 +1041,10 @@ var M = (function (exports) {
|
|
|
944
1041
|
this.el.after(label);
|
|
945
1042
|
// Sketchy removal of dropdown click handler
|
|
946
1043
|
this.el.removeEventListener('click', this.dropdown._handleClick);
|
|
1044
|
+
if (!this.options.isMultiSelect && !(this.options.selected.length === 0)) {
|
|
1045
|
+
const selectedValue = this.menuItems.filter((value) => value.id === this.selectedValues[0].id);
|
|
1046
|
+
this.el.value = selectedValue[0].text;
|
|
1047
|
+
}
|
|
947
1048
|
// Set Value if already set in HTML
|
|
948
1049
|
if (this.el.value)
|
|
949
1050
|
this.selectOption(this.el.value);
|
|
@@ -955,6 +1056,7 @@ var M = (function (exports) {
|
|
|
955
1056
|
this._updateSelectedInfo();
|
|
956
1057
|
}
|
|
957
1058
|
_removeDropdown() {
|
|
1059
|
+
this.container.ariaExpanded = 'false';
|
|
958
1060
|
this.container.parentNode.removeChild(this.container);
|
|
959
1061
|
}
|
|
960
1062
|
_handleInputBlur = () => {
|
|
@@ -1064,6 +1166,7 @@ var M = (function (exports) {
|
|
|
1064
1166
|
const item = document.createElement('li');
|
|
1065
1167
|
item.setAttribute('data-id', entry.id);
|
|
1066
1168
|
item.setAttribute('style', 'display:grid; grid-auto-flow: column; user-select: none; align-items: center;');
|
|
1169
|
+
item.tabIndex = 0;
|
|
1067
1170
|
// Checkbox
|
|
1068
1171
|
if (this.options.isMultiSelect) {
|
|
1069
1172
|
item.innerHTML = `
|
|
@@ -1191,14 +1294,29 @@ var M = (function (exports) {
|
|
|
1191
1294
|
/**
|
|
1192
1295
|
* Updates the visible or selectable items shown in the menu.
|
|
1193
1296
|
* @param menuItems Items to be available.
|
|
1297
|
+
* @param selected Selected item ids
|
|
1298
|
+
* @param open Option to conditionally open dropdown
|
|
1194
1299
|
*/
|
|
1195
|
-
setMenuItems(menuItems) {
|
|
1300
|
+
setMenuItems(menuItems, selected = null, open = true) {
|
|
1196
1301
|
this.menuItems = menuItems;
|
|
1197
|
-
this.
|
|
1302
|
+
this.options.data = menuItems;
|
|
1303
|
+
if (selected) {
|
|
1304
|
+
this.selectedValues = this.menuItems.filter((item) => !(selected.indexOf(item.id) === -1));
|
|
1305
|
+
}
|
|
1306
|
+
if (this.options.isMultiSelect) {
|
|
1307
|
+
this._renderDropdown();
|
|
1308
|
+
}
|
|
1309
|
+
else {
|
|
1310
|
+
this._refreshInputText();
|
|
1311
|
+
}
|
|
1312
|
+
if (open)
|
|
1313
|
+
this.open();
|
|
1198
1314
|
this._updateSelectedInfo();
|
|
1315
|
+
this._triggerChanged();
|
|
1199
1316
|
}
|
|
1200
1317
|
/**
|
|
1201
1318
|
* Sets selected values.
|
|
1319
|
+
* @deprecated @see https://github.com/materializecss/materialize/issues/552
|
|
1202
1320
|
* @param entries
|
|
1203
1321
|
*/
|
|
1204
1322
|
setValues(entries) {
|
|
@@ -1218,16 +1336,16 @@ var M = (function (exports) {
|
|
|
1218
1336
|
if (!entry)
|
|
1219
1337
|
return;
|
|
1220
1338
|
// Toggle Checkbox
|
|
1221
|
-
const li = this.container.querySelector('li[data-id="' + id + '"]');
|
|
1222
|
-
if (!li)
|
|
1223
|
-
return;
|
|
1339
|
+
/* const li = this.container.querySelector('li[data-id="' + id + '"]');
|
|
1340
|
+
if (!li) return;*/
|
|
1224
1341
|
if (this.options.isMultiSelect) {
|
|
1225
|
-
const checkbox = li.querySelector('input[type="checkbox"]');
|
|
1226
|
-
checkbox.checked = !checkbox.checked
|
|
1227
|
-
if (
|
|
1342
|
+
/* const checkbox = <HTMLInputElement | null>li.querySelector('input[type="checkbox"]');
|
|
1343
|
+
checkbox.checked = !checkbox.checked;*/
|
|
1344
|
+
if (!(this.selectedValues.filter((selectedEntry) => selectedEntry.id === entry.id).length >= 1))
|
|
1228
1345
|
this.selectedValues.push(entry);
|
|
1229
1346
|
else
|
|
1230
1347
|
this.selectedValues = this.selectedValues.filter((selectedEntry) => selectedEntry.id !== entry.id);
|
|
1348
|
+
this._renderDropdown();
|
|
1231
1349
|
this.el.focus();
|
|
1232
1350
|
}
|
|
1233
1351
|
else {
|
|
@@ -1240,9 +1358,16 @@ var M = (function (exports) {
|
|
|
1240
1358
|
this._updateSelectedInfo();
|
|
1241
1359
|
this._triggerChanged();
|
|
1242
1360
|
}
|
|
1361
|
+
selectOptions(ids) {
|
|
1362
|
+
const entries = this.menuItems.filter((item) => !(ids.indexOf(item.id) === -1));
|
|
1363
|
+
if (!entries)
|
|
1364
|
+
return;
|
|
1365
|
+
this.selectedValues = entries;
|
|
1366
|
+
this._renderDropdown();
|
|
1367
|
+
}
|
|
1243
1368
|
}
|
|
1244
1369
|
|
|
1245
|
-
const _defaults$
|
|
1370
|
+
const _defaults$l = {
|
|
1246
1371
|
direction: 'top',
|
|
1247
1372
|
hoverEnabled: true,
|
|
1248
1373
|
toolbarEnabled: false
|
|
@@ -1276,6 +1401,8 @@ var M = (function (exports) {
|
|
|
1276
1401
|
this.offsetY = 0;
|
|
1277
1402
|
this.offsetX = 0;
|
|
1278
1403
|
this.el.classList.add(`direction-${this.options.direction}`);
|
|
1404
|
+
this._anchor.tabIndex = 0;
|
|
1405
|
+
this._menu.ariaExpanded = 'false';
|
|
1279
1406
|
if (this.options.direction === 'top')
|
|
1280
1407
|
this.offsetY = 40;
|
|
1281
1408
|
else if (this.options.direction === 'right')
|
|
@@ -1287,7 +1414,7 @@ var M = (function (exports) {
|
|
|
1287
1414
|
this._setupEventHandlers();
|
|
1288
1415
|
}
|
|
1289
1416
|
static get defaults() {
|
|
1290
|
-
return _defaults$
|
|
1417
|
+
return _defaults$l;
|
|
1291
1418
|
}
|
|
1292
1419
|
/**
|
|
1293
1420
|
* Initializes instances of FloatingActionButton.
|
|
@@ -1312,6 +1439,7 @@ var M = (function (exports) {
|
|
|
1312
1439
|
else {
|
|
1313
1440
|
this.el.addEventListener('click', this._handleFABClick);
|
|
1314
1441
|
}
|
|
1442
|
+
this.el.addEventListener('keypress', this._handleFABKeyPress);
|
|
1315
1443
|
}
|
|
1316
1444
|
_removeEventHandlers() {
|
|
1317
1445
|
if (this.options.hoverEnabled && !this.options.toolbarEnabled) {
|
|
@@ -1321,8 +1449,17 @@ var M = (function (exports) {
|
|
|
1321
1449
|
else {
|
|
1322
1450
|
this.el.removeEventListener('click', this._handleFABClick);
|
|
1323
1451
|
}
|
|
1452
|
+
this.el.removeEventListener('keypress', this._handleFABKeyPress);
|
|
1324
1453
|
}
|
|
1325
1454
|
_handleFABClick = () => {
|
|
1455
|
+
this._handleFABToggle();
|
|
1456
|
+
};
|
|
1457
|
+
_handleFABKeyPress = (e) => {
|
|
1458
|
+
if (Utils.keys.ENTER.includes(e.key)) {
|
|
1459
|
+
this._handleFABToggle();
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1462
|
+
_handleFABToggle = () => {
|
|
1326
1463
|
if (this.isOpen) {
|
|
1327
1464
|
this.close();
|
|
1328
1465
|
}
|
|
@@ -1364,6 +1501,7 @@ var M = (function (exports) {
|
|
|
1364
1501
|
};
|
|
1365
1502
|
_animateInFAB() {
|
|
1366
1503
|
this.el.classList.add('active');
|
|
1504
|
+
this._menu.ariaExpanded = 'true';
|
|
1367
1505
|
const delayIncrement = 40;
|
|
1368
1506
|
const duration = 275;
|
|
1369
1507
|
this._floatingBtnsReverse.forEach((el, index) => {
|
|
@@ -1380,18 +1518,23 @@ var M = (function (exports) {
|
|
|
1380
1518
|
el.style.transition = `opacity ${duration}ms ease, transform ${duration}ms ease`;
|
|
1381
1519
|
el.style.opacity = '1';
|
|
1382
1520
|
el.style.transform = 'translate(0, 0) scale(1)';
|
|
1521
|
+
el.tabIndex = 0;
|
|
1383
1522
|
}, 1);
|
|
1384
1523
|
}, delay);
|
|
1385
1524
|
});
|
|
1386
1525
|
}
|
|
1387
1526
|
_animateOutFAB() {
|
|
1388
1527
|
const duration = 175;
|
|
1389
|
-
setTimeout(() =>
|
|
1528
|
+
setTimeout(() => {
|
|
1529
|
+
this.el.classList.remove('active');
|
|
1530
|
+
this._menu.ariaExpanded = 'false';
|
|
1531
|
+
}, duration);
|
|
1390
1532
|
this._floatingBtnsReverse.forEach((el) => {
|
|
1391
1533
|
el.style.transition = `opacity ${duration}ms ease, transform ${duration}ms ease`;
|
|
1392
1534
|
// to
|
|
1393
1535
|
el.style.opacity = '0';
|
|
1394
1536
|
el.style.transform = `translate(${this.offsetX}px, ${this.offsetY}px) scale(0.4)`;
|
|
1537
|
+
el.tabIndex = -1;
|
|
1395
1538
|
});
|
|
1396
1539
|
}
|
|
1397
1540
|
_animateInToolbar() {
|
|
@@ -1415,6 +1558,7 @@ var M = (function (exports) {
|
|
|
1415
1558
|
this.el.style.left = '0';
|
|
1416
1559
|
this.el.style.transform = 'translateX(' + this.offsetX + 'px)';
|
|
1417
1560
|
this.el.style.transition = 'none';
|
|
1561
|
+
this._menu.ariaExpanded = 'true';
|
|
1418
1562
|
this._anchor.style.transform = `translateY(${this.offsetY}px`;
|
|
1419
1563
|
this._anchor.style.transition = 'none';
|
|
1420
1564
|
setTimeout(() => {
|
|
@@ -1429,9 +1573,10 @@ var M = (function (exports) {
|
|
|
1429
1573
|
this.el.style.backgroundColor = fabColor;
|
|
1430
1574
|
backdrop.style.transform = 'scale(' + scaleFactor + ')';
|
|
1431
1575
|
backdrop.style.transition = 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)';
|
|
1432
|
-
this._menu
|
|
1433
|
-
.
|
|
1434
|
-
|
|
1576
|
+
this._menu.querySelectorAll('li > a').forEach((a) => {
|
|
1577
|
+
a.style.opacity = '1';
|
|
1578
|
+
a.tabIndex = 0;
|
|
1579
|
+
});
|
|
1435
1580
|
// Scroll to close.
|
|
1436
1581
|
window.addEventListener('scroll', this.close, true);
|
|
1437
1582
|
document.body.addEventListener('click', this._handleDocumentClick, true);
|
|
@@ -1440,7 +1585,7 @@ var M = (function (exports) {
|
|
|
1440
1585
|
}
|
|
1441
1586
|
}
|
|
1442
1587
|
|
|
1443
|
-
const _defaults$
|
|
1588
|
+
const _defaults$k = {
|
|
1444
1589
|
onOpen: null,
|
|
1445
1590
|
onClose: null,
|
|
1446
1591
|
inDuration: 225,
|
|
@@ -1459,6 +1604,7 @@ var M = (function (exports) {
|
|
|
1459
1604
|
...Cards.defaults,
|
|
1460
1605
|
...options
|
|
1461
1606
|
};
|
|
1607
|
+
this._activators = [];
|
|
1462
1608
|
this.cardReveal = this.el.querySelector('.card-reveal');
|
|
1463
1609
|
if (this.cardReveal) {
|
|
1464
1610
|
this.initialOverflow = getComputedStyle(this.el).overflow;
|
|
@@ -1475,7 +1621,7 @@ var M = (function (exports) {
|
|
|
1475
1621
|
}
|
|
1476
1622
|
}
|
|
1477
1623
|
static get defaults() {
|
|
1478
|
-
return _defaults$
|
|
1624
|
+
return _defaults$k;
|
|
1479
1625
|
}
|
|
1480
1626
|
/**
|
|
1481
1627
|
* Initializes instances of Cards.
|
|
@@ -1574,9 +1720,20 @@ var M = (function (exports) {
|
|
|
1574
1720
|
}
|
|
1575
1721
|
this._removeRevealCloseEventHandlers();
|
|
1576
1722
|
};
|
|
1723
|
+
static Init() {
|
|
1724
|
+
if (typeof document !== 'undefined')
|
|
1725
|
+
// Handle initialization of static cards.
|
|
1726
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
1727
|
+
const cards = document.querySelectorAll('.card');
|
|
1728
|
+
cards.forEach((el) => {
|
|
1729
|
+
if (el && (el['M_Card'] == undefined))
|
|
1730
|
+
this.init(el);
|
|
1731
|
+
});
|
|
1732
|
+
});
|
|
1733
|
+
}
|
|
1577
1734
|
}
|
|
1578
1735
|
|
|
1579
|
-
const _defaults$
|
|
1736
|
+
const _defaults$j = {
|
|
1580
1737
|
duration: 200, // ms
|
|
1581
1738
|
dist: -100, // zoom scale TODO: make this more intuitive as an option
|
|
1582
1739
|
shift: 0, // spacing for center image
|
|
@@ -1678,7 +1835,7 @@ var M = (function (exports) {
|
|
|
1678
1835
|
this._scroll(this.offset);
|
|
1679
1836
|
}
|
|
1680
1837
|
static get defaults() {
|
|
1681
|
-
return _defaults$
|
|
1838
|
+
return _defaults$j;
|
|
1682
1839
|
}
|
|
1683
1840
|
/**
|
|
1684
1841
|
* Initializes instances of Carousel.
|
|
@@ -1733,9 +1890,7 @@ var M = (function (exports) {
|
|
|
1733
1890
|
}
|
|
1734
1891
|
window.removeEventListener('resize', this._handleThrottledResize);
|
|
1735
1892
|
}
|
|
1736
|
-
_handleThrottledResize = Utils.throttle(
|
|
1737
|
-
this._handleResize();
|
|
1738
|
-
}, 200, null).bind(this);
|
|
1893
|
+
_handleThrottledResize = () => Utils.throttle(this._handleResize, 200, null).bind(this);
|
|
1739
1894
|
_handleCarouselTap = (e) => {
|
|
1740
1895
|
// Fixes firefox draggable image bug
|
|
1741
1896
|
if (e.type === 'mousedown' && e.target.tagName === 'IMG') {
|
|
@@ -2150,7 +2305,7 @@ var M = (function (exports) {
|
|
|
2150
2305
|
}
|
|
2151
2306
|
}
|
|
2152
2307
|
|
|
2153
|
-
const _defaults$
|
|
2308
|
+
const _defaults$i = {
|
|
2154
2309
|
data: [],
|
|
2155
2310
|
placeholder: '',
|
|
2156
2311
|
secondaryPlaceholder: '',
|
|
@@ -2204,7 +2359,7 @@ var M = (function (exports) {
|
|
|
2204
2359
|
}
|
|
2205
2360
|
}
|
|
2206
2361
|
static get defaults() {
|
|
2207
|
-
return _defaults$
|
|
2362
|
+
return _defaults$i;
|
|
2208
2363
|
}
|
|
2209
2364
|
/**
|
|
2210
2365
|
* Initializes instances of Chips.
|
|
@@ -2488,7 +2643,7 @@ var M = (function (exports) {
|
|
|
2488
2643
|
}
|
|
2489
2644
|
}
|
|
2490
2645
|
|
|
2491
|
-
const _defaults$
|
|
2646
|
+
const _defaults$h = {
|
|
2492
2647
|
accordion: true,
|
|
2493
2648
|
onOpenStart: null,
|
|
2494
2649
|
onOpenEnd: null,
|
|
@@ -2524,7 +2679,7 @@ var M = (function (exports) {
|
|
|
2524
2679
|
}
|
|
2525
2680
|
}
|
|
2526
2681
|
static get defaults() {
|
|
2527
|
-
return _defaults$
|
|
2682
|
+
return _defaults$h;
|
|
2528
2683
|
}
|
|
2529
2684
|
/**
|
|
2530
2685
|
* Initializes instances of Collapsible.
|
|
@@ -2643,7 +2798,7 @@ var M = (function (exports) {
|
|
|
2643
2798
|
};
|
|
2644
2799
|
}
|
|
2645
2800
|
|
|
2646
|
-
const _defaults$
|
|
2801
|
+
const _defaults$g = {
|
|
2647
2802
|
classes: '',
|
|
2648
2803
|
dropdownOptions: {}
|
|
2649
2804
|
};
|
|
@@ -2665,6 +2820,7 @@ var M = (function (exports) {
|
|
|
2665
2820
|
wrapper;
|
|
2666
2821
|
selectOptions;
|
|
2667
2822
|
_values;
|
|
2823
|
+
nativeTabIndex;
|
|
2668
2824
|
constructor(el, options) {
|
|
2669
2825
|
super(el, options, FormSelect);
|
|
2670
2826
|
if (this.el.classList.contains('browser-default'))
|
|
@@ -2675,13 +2831,14 @@ var M = (function (exports) {
|
|
|
2675
2831
|
...options
|
|
2676
2832
|
};
|
|
2677
2833
|
this.isMultiple = this.el.multiple;
|
|
2834
|
+
this.nativeTabIndex = this.el.tabIndex ?? -1;
|
|
2678
2835
|
this.el.tabIndex = -1;
|
|
2679
2836
|
this._values = [];
|
|
2680
2837
|
this._setupDropdown();
|
|
2681
2838
|
this._setupEventHandlers();
|
|
2682
2839
|
}
|
|
2683
2840
|
static get defaults() {
|
|
2684
|
-
return _defaults$
|
|
2841
|
+
return _defaults$g;
|
|
2685
2842
|
}
|
|
2686
2843
|
/**
|
|
2687
2844
|
* Initializes instances of FormSelect.
|
|
@@ -2771,8 +2928,6 @@ var M = (function (exports) {
|
|
|
2771
2928
|
};
|
|
2772
2929
|
_setupDropdown() {
|
|
2773
2930
|
this.labelEl = document.querySelector('[for="' + this.el.id + '"]');
|
|
2774
|
-
if (this.labelEl)
|
|
2775
|
-
this.labelEl.style.display = 'none';
|
|
2776
2931
|
this.wrapper = document.createElement('div');
|
|
2777
2932
|
this.wrapper.classList.add('select-wrapper', 'input-field');
|
|
2778
2933
|
if (this.options.classes.length > 0) {
|
|
@@ -2790,6 +2945,7 @@ var M = (function (exports) {
|
|
|
2790
2945
|
// Create dropdown
|
|
2791
2946
|
this.dropdownOptions = document.createElement('ul');
|
|
2792
2947
|
this.dropdownOptions.id = `select-options-${Utils.guid()}`;
|
|
2948
|
+
this.dropdownOptions.setAttribute('popover', 'auto');
|
|
2793
2949
|
this.dropdownOptions.classList.add('dropdown-content', 'select-dropdown');
|
|
2794
2950
|
this.dropdownOptions.setAttribute('role', 'listbox');
|
|
2795
2951
|
this.dropdownOptions.ariaMultiSelectable = this.isMultiple.toString();
|
|
@@ -2838,6 +2994,7 @@ var M = (function (exports) {
|
|
|
2838
2994
|
this.input.ariaRequired = this.el.hasAttribute('required').toString(); //setAttribute("aria-required", this.el.hasAttribute("required"));
|
|
2839
2995
|
if (this.el.disabled)
|
|
2840
2996
|
this.input.disabled = true; // 'true');
|
|
2997
|
+
this.input.setAttribute('tabindex', this.nativeTabIndex.toString());
|
|
2841
2998
|
const attrs = this.el.attributes;
|
|
2842
2999
|
for (let i = 0; i < attrs.length; ++i) {
|
|
2843
3000
|
const attr = attrs[i];
|
|
@@ -2863,7 +3020,7 @@ var M = (function (exports) {
|
|
|
2863
3020
|
this.wrapper.prepend(dropdownIcon);
|
|
2864
3021
|
// Initialize dropdown
|
|
2865
3022
|
if (!this.el.disabled) {
|
|
2866
|
-
const dropdownOptions = { ...this.options.dropdownOptions };
|
|
3023
|
+
const dropdownOptions = { ...this.options.dropdownOptions };
|
|
2867
3024
|
dropdownOptions.coverTrigger = false;
|
|
2868
3025
|
const userOnOpenEnd = dropdownOptions.onOpenEnd;
|
|
2869
3026
|
const userOnCloseEnd = dropdownOptions.onCloseEnd;
|
|
@@ -2902,13 +3059,9 @@ var M = (function (exports) {
|
|
|
2902
3059
|
}
|
|
2903
3060
|
// Add initial selections
|
|
2904
3061
|
this._setSelectedStates();
|
|
2905
|
-
//
|
|
2906
|
-
if (this.labelEl)
|
|
2907
|
-
|
|
2908
|
-
label.htmlFor = this.input.id;
|
|
2909
|
-
label.innerText = this.labelEl.innerText;
|
|
2910
|
-
this.input.after(label);
|
|
2911
|
-
}
|
|
3062
|
+
// move label
|
|
3063
|
+
if (this.labelEl)
|
|
3064
|
+
this.input.after(this.labelEl);
|
|
2912
3065
|
}
|
|
2913
3066
|
_addOptionToValues(realOption, virtualOption) {
|
|
2914
3067
|
this._values.push({ el: realOption, optionEl: virtualOption });
|
|
@@ -3028,6 +3181,74 @@ var M = (function (exports) {
|
|
|
3028
3181
|
}
|
|
3029
3182
|
}
|
|
3030
3183
|
|
|
3184
|
+
const _defaults$f = {
|
|
3185
|
+
margin: 5,
|
|
3186
|
+
transition: 10,
|
|
3187
|
+
duration: 250,
|
|
3188
|
+
align: 'left'
|
|
3189
|
+
};
|
|
3190
|
+
class DockedDisplayPlugin {
|
|
3191
|
+
el;
|
|
3192
|
+
container;
|
|
3193
|
+
options;
|
|
3194
|
+
visible;
|
|
3195
|
+
constructor(el, container, options) {
|
|
3196
|
+
this.el = el;
|
|
3197
|
+
this.options = {
|
|
3198
|
+
..._defaults$f,
|
|
3199
|
+
...options
|
|
3200
|
+
};
|
|
3201
|
+
this.container = document.createElement('div');
|
|
3202
|
+
this.container.classList.add('display-docked');
|
|
3203
|
+
this.container.append(container);
|
|
3204
|
+
el.parentElement.append(this.container);
|
|
3205
|
+
document.addEventListener('click', (e) => {
|
|
3206
|
+
if (this.visible && !(this.el === e.target) && !(e.target.closest('.display-docked'))) {
|
|
3207
|
+
this.hide();
|
|
3208
|
+
}
|
|
3209
|
+
});
|
|
3210
|
+
}
|
|
3211
|
+
/**
|
|
3212
|
+
* Initializes instance of DockedDisplayPlugin
|
|
3213
|
+
* @param el HTMLElement to position to
|
|
3214
|
+
* @param container HTMLElement to be positioned
|
|
3215
|
+
* @param options Plugin options
|
|
3216
|
+
*/
|
|
3217
|
+
static init(el, container, options) {
|
|
3218
|
+
return new DockedDisplayPlugin(el, container, options);
|
|
3219
|
+
}
|
|
3220
|
+
show = () => {
|
|
3221
|
+
if (this.visible)
|
|
3222
|
+
return;
|
|
3223
|
+
this.visible = true;
|
|
3224
|
+
const coordinates = Utils._setAbsolutePosition(this.el, this.container, 'bottom', this.options.margin, this.options.transition, this.options.align);
|
|
3225
|
+
// @todo move to Util? -> duplicate code fragment with tooltip
|
|
3226
|
+
// easeOutCubic
|
|
3227
|
+
this.container.style.visibility = 'visible';
|
|
3228
|
+
this.container.style.transition = `
|
|
3229
|
+
transform ${this.options.duration}ms ease-out,
|
|
3230
|
+
opacity ${this.options.duration}ms ease-out`;
|
|
3231
|
+
setTimeout(() => {
|
|
3232
|
+
this.container.style.transform = `translateX(${coordinates.x}px) translateY(${coordinates.y}px)`;
|
|
3233
|
+
this.container.style.opacity = (1).toString();
|
|
3234
|
+
}, 1);
|
|
3235
|
+
};
|
|
3236
|
+
hide = () => {
|
|
3237
|
+
if (!this.visible)
|
|
3238
|
+
return;
|
|
3239
|
+
this.visible = false;
|
|
3240
|
+
// @todo move to Util? -> duplicate code fragment with tooltip
|
|
3241
|
+
this.container.removeAttribute('style');
|
|
3242
|
+
this.container.style.transition = `
|
|
3243
|
+
transform ${this.options.duration}ms ease-out,
|
|
3244
|
+
opacity ${this.options.duration}ms ease-out`;
|
|
3245
|
+
setTimeout(() => {
|
|
3246
|
+
this.container.style.transform = `translateX(0px) translateY(0px)`;
|
|
3247
|
+
this.container.style.opacity = '0';
|
|
3248
|
+
}, 1);
|
|
3249
|
+
};
|
|
3250
|
+
}
|
|
3251
|
+
|
|
3031
3252
|
const _defaults$e = {
|
|
3032
3253
|
// the default output format for the input field value
|
|
3033
3254
|
format: 'mmm dd, yyyy',
|
|
@@ -3035,6 +3256,8 @@ var M = (function (exports) {
|
|
|
3035
3256
|
parse: null,
|
|
3036
3257
|
// The initial condition if the datepicker is based on date range
|
|
3037
3258
|
isDateRange: false,
|
|
3259
|
+
// The selector of the user specified date range end element
|
|
3260
|
+
dateRangeEndEl: null,
|
|
3038
3261
|
// The initial condition if the datepicker is based on multiple date selection
|
|
3039
3262
|
isMultipleSelection: false,
|
|
3040
3263
|
// The initial date to view when first opened
|
|
@@ -3068,10 +3291,14 @@ var M = (function (exports) {
|
|
|
3068
3291
|
showMonthAfterYear: false,
|
|
3069
3292
|
// Render days of the calendar grid that fall in the next or previous month
|
|
3070
3293
|
showDaysInNextAndPreviousMonths: false,
|
|
3294
|
+
// Specify if docked picker is in open state by default
|
|
3295
|
+
openByDefault: false,
|
|
3071
3296
|
// Specify a DOM element to render the calendar in
|
|
3072
3297
|
container: null,
|
|
3073
3298
|
// Show clear button
|
|
3074
3299
|
showClearBtn: false,
|
|
3300
|
+
// Autosubmit
|
|
3301
|
+
autoSubmit: true,
|
|
3075
3302
|
// internationalization
|
|
3076
3303
|
i18n: {
|
|
3077
3304
|
cancel: 'Cancel',
|
|
@@ -3115,18 +3342,23 @@ var M = (function (exports) {
|
|
|
3115
3342
|
events: [],
|
|
3116
3343
|
// callback function
|
|
3117
3344
|
onSelect: null,
|
|
3118
|
-
onDraw: null
|
|
3345
|
+
onDraw: null,
|
|
3346
|
+
onInputInteraction: null,
|
|
3347
|
+
displayPlugin: null,
|
|
3348
|
+
displayPluginOptions: null,
|
|
3349
|
+
onConfirm: null,
|
|
3350
|
+
onCancel: null,
|
|
3119
3351
|
};
|
|
3120
3352
|
class Datepicker extends Component {
|
|
3121
3353
|
id;
|
|
3122
3354
|
multiple = false;
|
|
3123
3355
|
calendarEl;
|
|
3124
3356
|
/** CLEAR button instance. */
|
|
3125
|
-
clearBtn;
|
|
3357
|
+
// clearBtn: HTMLElement;
|
|
3126
3358
|
/** DONE button instance */
|
|
3127
|
-
doneBtn;
|
|
3128
|
-
cancelBtn
|
|
3129
|
-
|
|
3359
|
+
/*doneBtn: HTMLElement;
|
|
3360
|
+
cancelBtn: HTMLElement;*/
|
|
3361
|
+
containerEl;
|
|
3130
3362
|
yearTextEl;
|
|
3131
3363
|
dateTextEl;
|
|
3132
3364
|
endDateEl;
|
|
@@ -3139,6 +3371,8 @@ var M = (function (exports) {
|
|
|
3139
3371
|
calendars;
|
|
3140
3372
|
_y;
|
|
3141
3373
|
_m;
|
|
3374
|
+
displayPlugin;
|
|
3375
|
+
footer;
|
|
3142
3376
|
static _template;
|
|
3143
3377
|
constructor(el, options) {
|
|
3144
3378
|
super(el, options, Datepicker);
|
|
@@ -3192,6 +3426,10 @@ var M = (function (exports) {
|
|
|
3192
3426
|
this.dateEls = [];
|
|
3193
3427
|
this.dateEls.push(el);
|
|
3194
3428
|
}
|
|
3429
|
+
if (this.options.displayPlugin) {
|
|
3430
|
+
if (this.options.displayPlugin === 'docked')
|
|
3431
|
+
this.displayPlugin = DockedDisplayPlugin.init(this.el, this.containerEl, this.options.displayPluginOptions);
|
|
3432
|
+
}
|
|
3195
3433
|
}
|
|
3196
3434
|
static get defaults() {
|
|
3197
3435
|
return _defaults$e;
|
|
@@ -3240,7 +3478,7 @@ var M = (function (exports) {
|
|
|
3240
3478
|
}
|
|
3241
3479
|
destroy() {
|
|
3242
3480
|
this._removeEventHandlers();
|
|
3243
|
-
this.
|
|
3481
|
+
this.containerEl.remove();
|
|
3244
3482
|
this.destroySelects();
|
|
3245
3483
|
this.el['M_Datepicker'] = undefined;
|
|
3246
3484
|
}
|
|
@@ -3259,27 +3497,55 @@ var M = (function (exports) {
|
|
|
3259
3497
|
if (this.el.type == 'date') {
|
|
3260
3498
|
this.el.classList.add('datepicker-date-input');
|
|
3261
3499
|
}
|
|
3500
|
+
if (!this.el.parentElement.querySelector('.datepicker-format') === null) {
|
|
3501
|
+
this._renderDateInputFormat(this.el);
|
|
3502
|
+
}
|
|
3262
3503
|
if (this.options.isDateRange) {
|
|
3263
|
-
this.
|
|
3264
|
-
this.
|
|
3504
|
+
this.containerEl.classList.add('daterange');
|
|
3505
|
+
if (!this.options.dateRangeEndEl) {
|
|
3506
|
+
this.endDateEl = this.createDateInput();
|
|
3507
|
+
this.endDateEl.classList.add('datepicker-end-date');
|
|
3508
|
+
}
|
|
3509
|
+
else if (document.querySelector(this.options.dateRangeEndEl) === undefined) {
|
|
3510
|
+
console.warn('Specified date range end input element in dateRangeEndEl not found');
|
|
3511
|
+
}
|
|
3512
|
+
else {
|
|
3513
|
+
this.endDateEl = document.querySelector(this.options.dateRangeEndEl);
|
|
3514
|
+
if (!this.endDateEl.parentElement.querySelector('.datepicker-format') === null) {
|
|
3515
|
+
this._renderDateInputFormat(this.endDateEl);
|
|
3516
|
+
}
|
|
3517
|
+
}
|
|
3265
3518
|
}
|
|
3266
|
-
if (this.options.showClearBtn) {
|
|
3267
|
-
|
|
3268
|
-
|
|
3519
|
+
/*if (this.options.showClearBtn) {
|
|
3520
|
+
this.clearBtn.style.visibility = '';
|
|
3521
|
+
this.clearBtn.innerText = this.options.i18n.clear;
|
|
3269
3522
|
}
|
|
3270
3523
|
this.doneBtn.innerText = this.options.i18n.done;
|
|
3271
|
-
this.cancelBtn.innerText = this.options.i18n.cancel
|
|
3524
|
+
this.cancelBtn.innerText = this.options.i18n.cancel;*/
|
|
3525
|
+
Utils.createButton(this.footer, this.options.i18n.clear, ['datepicker-clear'], this.options.showClearBtn, this._handleClearClick);
|
|
3526
|
+
if (!this.options.autoSubmit) {
|
|
3527
|
+
Utils.createConfirmationContainer(this.footer, this.options.i18n.done, this.options.i18n.cancel, this._confirm, this._cancel);
|
|
3528
|
+
}
|
|
3272
3529
|
if (this.options.container) {
|
|
3273
3530
|
const optEl = this.options.container;
|
|
3274
3531
|
this.options.container =
|
|
3275
3532
|
optEl instanceof HTMLElement ? optEl : document.querySelector(optEl);
|
|
3276
|
-
this.options.container.append(this.
|
|
3533
|
+
this.options.container.append(this.containerEl);
|
|
3277
3534
|
}
|
|
3278
3535
|
else {
|
|
3279
|
-
//this.
|
|
3280
|
-
this.el
|
|
3536
|
+
//this.containerEl.before(this.el);
|
|
3537
|
+
const appendTo = !this.endDateEl ? this.el : this.endDateEl;
|
|
3538
|
+
if (!this.options.openByDefault)
|
|
3539
|
+
this.containerEl.setAttribute('style', 'display: none; visibility: hidden;');
|
|
3540
|
+
appendTo.parentElement.after(this.containerEl);
|
|
3281
3541
|
}
|
|
3282
3542
|
}
|
|
3543
|
+
/**
|
|
3544
|
+
* Renders the date input format
|
|
3545
|
+
*/
|
|
3546
|
+
_renderDateInputFormat(el) {
|
|
3547
|
+
el.parentElement.querySelector('.datepicker-format').innerHTML = this.options.format.toString();
|
|
3548
|
+
}
|
|
3283
3549
|
/**
|
|
3284
3550
|
* Gets a string representation of the given date.
|
|
3285
3551
|
*/
|
|
@@ -3420,7 +3686,6 @@ var M = (function (exports) {
|
|
|
3420
3686
|
* Sets given date as the input value on the given element.
|
|
3421
3687
|
*/
|
|
3422
3688
|
setInputValue(el, date) {
|
|
3423
|
-
console.log('setinputvalue');
|
|
3424
3689
|
if (el.type == 'date') {
|
|
3425
3690
|
this.setDataDate(el, date);
|
|
3426
3691
|
el.value = this.formatDate(date, 'yyyy-mm-dd');
|
|
@@ -3524,7 +3789,7 @@ var M = (function (exports) {
|
|
|
3524
3789
|
day < this.options.endRange, isDisabled = (this.options.minDate && day < this.options.minDate) ||
|
|
3525
3790
|
(this.options.maxDate && day > this.options.maxDate) ||
|
|
3526
3791
|
(this.options.disableWeekends && Datepicker._isWeekend(day)) ||
|
|
3527
|
-
(this.options.disableDayFn && this.options.disableDayFn(day)), isDateRange = this.options.isDateRange &&
|
|
3792
|
+
(this.options.disableDayFn && this.options.disableDayFn(day)), isDateRangeStart = this.options.isDateRange && this.date && this.endDate && Datepicker._compareDates(this.date, day), isDateRangeEnd = this.options.isDateRange && this.endDate && Datepicker._compareDates(this.endDate, day), isDateRange = this.options.isDateRange &&
|
|
3528
3793
|
Datepicker._isDate(this.endDate) &&
|
|
3529
3794
|
Datepicker._compareWithinRange(day, this.date, this.endDate);
|
|
3530
3795
|
let dayNumber = 1 + (i - before), monthNumber = month, yearNumber = year;
|
|
@@ -3564,6 +3829,8 @@ var M = (function (exports) {
|
|
|
3564
3829
|
isEndRange: isEndRange,
|
|
3565
3830
|
isInRange: isInRange,
|
|
3566
3831
|
showDaysInNextAndPreviousMonths: this.options.showDaysInNextAndPreviousMonths,
|
|
3832
|
+
isDateRangeStart: isDateRangeStart,
|
|
3833
|
+
isDateRangeEnd: isDateRangeEnd,
|
|
3567
3834
|
isDateRange: isDateRange
|
|
3568
3835
|
};
|
|
3569
3836
|
row.push(this.renderDay(dayConfig));
|
|
@@ -3577,8 +3844,18 @@ var M = (function (exports) {
|
|
|
3577
3844
|
return this.renderTable(this.options, data, randId);
|
|
3578
3845
|
}
|
|
3579
3846
|
renderDay(opts) {
|
|
3580
|
-
const
|
|
3581
|
-
|
|
3847
|
+
const classMap = {
|
|
3848
|
+
isDisabled: 'is-disabled',
|
|
3849
|
+
isToday: 'is-today',
|
|
3850
|
+
isSelected: 'is-selected',
|
|
3851
|
+
hasEvent: 'has-event',
|
|
3852
|
+
isInRange: 'is-inrange',
|
|
3853
|
+
isStartRange: 'is-startrange',
|
|
3854
|
+
isEndRange: 'is-endrange',
|
|
3855
|
+
isDateRangeStart: 'is-daterange-start',
|
|
3856
|
+
isDateRangeEnd: 'is-daterange-end',
|
|
3857
|
+
isDateRange: 'is-daterange'
|
|
3858
|
+
}, ariaSelected = !(['isSelected', 'isDateRange'].filter((prop) => !!(opts.hasOwnProperty(prop) && opts[prop] === true)).length === 0), arr = ['datepicker-day'];
|
|
3582
3859
|
if (opts.isEmpty) {
|
|
3583
3860
|
if (opts.showDaysInNextAndPreviousMonths) {
|
|
3584
3861
|
arr.push('is-outside-current-month');
|
|
@@ -3588,36 +3865,10 @@ var M = (function (exports) {
|
|
|
3588
3865
|
return '<td class="is-empty"></td>';
|
|
3589
3866
|
}
|
|
3590
3867
|
}
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
if (opts.isToday) {
|
|
3596
|
-
arr.push('is-today');
|
|
3597
|
-
}
|
|
3598
|
-
if (opts.isSelected) {
|
|
3599
|
-
arr.push('is-selected');
|
|
3600
|
-
ariaSelected = 'true';
|
|
3601
|
-
}
|
|
3602
|
-
// @todo should we create this additional css class?
|
|
3603
|
-
if (opts.hasEvent) {
|
|
3604
|
-
arr.push('has-event');
|
|
3605
|
-
}
|
|
3606
|
-
// @todo should we create this additional css class?
|
|
3607
|
-
if (opts.isInRange) {
|
|
3608
|
-
arr.push('is-inrange');
|
|
3609
|
-
}
|
|
3610
|
-
// @todo should we create this additional css class?
|
|
3611
|
-
if (opts.isStartRange) {
|
|
3612
|
-
arr.push('is-startrange');
|
|
3613
|
-
}
|
|
3614
|
-
// @todo should we create this additional css class?
|
|
3615
|
-
if (opts.isEndRange) {
|
|
3616
|
-
arr.push('is-endrange');
|
|
3617
|
-
}
|
|
3618
|
-
// @todo create additional css class
|
|
3619
|
-
if (opts.isDateRange) {
|
|
3620
|
-
arr.push('is-daterange');
|
|
3868
|
+
for (const [property, className] of Object.entries(classMap)) {
|
|
3869
|
+
if (opts.hasOwnProperty(property) && opts[property]) {
|
|
3870
|
+
arr.push(className);
|
|
3871
|
+
}
|
|
3621
3872
|
}
|
|
3622
3873
|
return (`<td data-day="${opts.day}" class="${arr.join(' ')}" aria-selected="${ariaSelected}">` +
|
|
3623
3874
|
`<button class="datepicker-day-button" type="button" data-year="${opts.year}" data-month="${opts.month}" data-day="${opts.day}">${opts.day}</button>` +
|
|
@@ -3686,7 +3937,9 @@ var M = (function (exports) {
|
|
|
3686
3937
|
arr.reverse();
|
|
3687
3938
|
const yearHtml = `<select class="datepicker-select orig-select-year" tabindex="-1">${arr.join('')}</select>`;
|
|
3688
3939
|
const leftArrow = '<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"/><path d="M0-.5h24v24H0z" fill="none"/></svg>';
|
|
3689
|
-
html += `<button class="month-prev${prev ? '' : ' is-disabled'
|
|
3940
|
+
html += `<button class="month-prev${prev ? '' : ' is-disabled'
|
|
3941
|
+
// @todo remove button class and add scss mixin, current implementation temporary for focus states, @see https://github.com/materializecss/materialize/issues/566
|
|
3942
|
+
} btn" type="button">${leftArrow}</button>`;
|
|
3690
3943
|
html += '<div class="selects-container">';
|
|
3691
3944
|
if (opts.showMonthAfterYear) {
|
|
3692
3945
|
html += yearHtml + monthHtml;
|
|
@@ -3702,7 +3955,9 @@ var M = (function (exports) {
|
|
|
3702
3955
|
next = false;
|
|
3703
3956
|
}
|
|
3704
3957
|
const rightArrow = '<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"/><path d="M0-.25h24v24H0z" fill="none"/></svg>';
|
|
3705
|
-
html += `<button class="month-next${next ? '' : ' is-disabled'
|
|
3958
|
+
html += `<button class="month-next${next ? '' : ' is-disabled'
|
|
3959
|
+
// @todo remove button class and add scss mixin, current implementation temporary for focus states, @see https://github.com/materializecss/materialize/issues/566
|
|
3960
|
+
} btn" type="button">${rightArrow}</button>`;
|
|
3706
3961
|
return (html += '</div>');
|
|
3707
3962
|
}
|
|
3708
3963
|
// refresh HTML
|
|
@@ -3741,6 +3996,7 @@ var M = (function (exports) {
|
|
|
3741
3996
|
// Init Materialize Select
|
|
3742
3997
|
const yearSelect = this.calendarEl.querySelector('.orig-select-year');
|
|
3743
3998
|
const monthSelect = this.calendarEl.querySelector('.orig-select-month');
|
|
3999
|
+
// @todo fix accessibility @see https://github.com/materializecss/materialize/issues/522
|
|
3744
4000
|
FormSelect.init(yearSelect, {
|
|
3745
4001
|
classes: 'select-year',
|
|
3746
4002
|
dropdownOptions: { container: document.body, constrainWidth: false }
|
|
@@ -3761,25 +4017,26 @@ var M = (function (exports) {
|
|
|
3761
4017
|
this.el.addEventListener('keydown', this._handleInputKeydown);
|
|
3762
4018
|
this.el.addEventListener('change', this._handleInputChange);
|
|
3763
4019
|
this.calendarEl.addEventListener('click', this._handleCalendarClick);
|
|
3764
|
-
this.doneBtn.addEventListener('click',
|
|
3765
|
-
this.cancelBtn.addEventListener('click', this.
|
|
4020
|
+
/* this.doneBtn.addEventListener('click', this._confirm);
|
|
4021
|
+
this.cancelBtn.addEventListener('click', this._cancel);
|
|
4022
|
+
|
|
3766
4023
|
if (this.options.showClearBtn) {
|
|
3767
|
-
|
|
3768
|
-
}
|
|
4024
|
+
this.clearBtn.addEventListener('click', this._handleClearClick);
|
|
4025
|
+
}*/
|
|
3769
4026
|
}
|
|
3770
4027
|
_setupVariables() {
|
|
3771
4028
|
const template = document.createElement('template');
|
|
3772
4029
|
template.innerHTML = Datepicker._template.trim();
|
|
3773
|
-
this.
|
|
3774
|
-
this.calendarEl = this.
|
|
3775
|
-
this.yearTextEl = this.
|
|
3776
|
-
this.dateTextEl = this.
|
|
3777
|
-
if (this.options.showClearBtn) {
|
|
3778
|
-
|
|
3779
|
-
}
|
|
3780
|
-
|
|
3781
|
-
this.
|
|
3782
|
-
this.
|
|
4030
|
+
this.containerEl = template.content.firstChild;
|
|
4031
|
+
this.calendarEl = this.containerEl.querySelector('.datepicker-calendar');
|
|
4032
|
+
this.yearTextEl = this.containerEl.querySelector('.year-text');
|
|
4033
|
+
this.dateTextEl = this.containerEl.querySelector('.date-text');
|
|
4034
|
+
/* if (this.options.showClearBtn) {
|
|
4035
|
+
this.clearBtn = this.containerEl.querySelector('.datepicker-clear');
|
|
4036
|
+
}
|
|
4037
|
+
this.doneBtn = this.containerEl.querySelector('.datepicker-done');
|
|
4038
|
+
this.cancelBtn = this.containerEl.querySelector('.datepicker-cancel');*/
|
|
4039
|
+
this.footer = this.containerEl.querySelector('.datepicker-footer');
|
|
3783
4040
|
this.formats = {
|
|
3784
4041
|
d: (date) => {
|
|
3785
4042
|
return date.getDate();
|
|
@@ -3834,12 +4091,20 @@ var M = (function (exports) {
|
|
|
3834
4091
|
this.setDateFromInput(e.target);
|
|
3835
4092
|
this.draw();
|
|
3836
4093
|
this.gotoDate(e.target === this.el ? this.date : this.endDate);
|
|
4094
|
+
if (this.displayPlugin)
|
|
4095
|
+
this.displayPlugin.show();
|
|
4096
|
+
if (this.options.onInputInteraction)
|
|
4097
|
+
this.options.onInputInteraction.call(this);
|
|
3837
4098
|
};
|
|
3838
4099
|
_handleInputKeydown = (e) => {
|
|
3839
4100
|
if (Utils.keys.ENTER.includes(e.key)) {
|
|
3840
4101
|
e.preventDefault();
|
|
3841
4102
|
this.setDateFromInput(e.target);
|
|
3842
4103
|
this.draw();
|
|
4104
|
+
if (this.displayPlugin)
|
|
4105
|
+
this.displayPlugin.show();
|
|
4106
|
+
if (this.options.onInputInteraction)
|
|
4107
|
+
this.options.onInputInteraction.call(this);
|
|
3843
4108
|
}
|
|
3844
4109
|
};
|
|
3845
4110
|
_handleCalendarClick = (e) => {
|
|
@@ -3855,7 +4120,8 @@ var M = (function (exports) {
|
|
|
3855
4120
|
if (this.options.isDateRange) {
|
|
3856
4121
|
this._handleDateRangeCalendarClick(selectedDate);
|
|
3857
4122
|
}
|
|
3858
|
-
this.
|
|
4123
|
+
if (this.options.autoSubmit)
|
|
4124
|
+
this._finishSelection();
|
|
3859
4125
|
}
|
|
3860
4126
|
else if (target.closest('.month-prev')) {
|
|
3861
4127
|
this.prevMonth();
|
|
@@ -3883,6 +4149,7 @@ var M = (function (exports) {
|
|
|
3883
4149
|
_clearDates = () => {
|
|
3884
4150
|
this.date = null;
|
|
3885
4151
|
this.endDate = null;
|
|
4152
|
+
this.draw();
|
|
3886
4153
|
};
|
|
3887
4154
|
_handleMonthChange = (e) => {
|
|
3888
4155
|
this.gotoMonth(e.target.value);
|
|
@@ -3947,7 +4214,17 @@ var M = (function (exports) {
|
|
|
3947
4214
|
// Set input value to the selected date and close Datepicker
|
|
3948
4215
|
_finishSelection = () => {
|
|
3949
4216
|
this.setInputValues();
|
|
3950
|
-
|
|
4217
|
+
// Commented out because of function deprecations
|
|
4218
|
+
// this.close();
|
|
4219
|
+
};
|
|
4220
|
+
_confirm = () => {
|
|
4221
|
+
this._finishSelection();
|
|
4222
|
+
if (typeof this.options.onConfirm === 'function')
|
|
4223
|
+
this.options.onConfirm.call(this);
|
|
4224
|
+
};
|
|
4225
|
+
_cancel = () => {
|
|
4226
|
+
if (typeof this.options.onCancel === 'function')
|
|
4227
|
+
this.options.onCancel.call(this);
|
|
3951
4228
|
};
|
|
3952
4229
|
// deprecated
|
|
3953
4230
|
open() {
|
|
@@ -3960,8 +4237,7 @@ var M = (function (exports) {
|
|
|
3960
4237
|
}
|
|
3961
4238
|
static {
|
|
3962
4239
|
Datepicker._template = `
|
|
3963
|
-
|
|
3964
|
-
<div class="modal-content datepicker-container">
|
|
4240
|
+
<div class="datepicker-container">
|
|
3965
4241
|
<div class="datepicker-date-display">
|
|
3966
4242
|
<span class="year-text"></span>
|
|
3967
4243
|
<span class="date-text"></span>
|
|
@@ -3969,15 +4245,14 @@ var M = (function (exports) {
|
|
|
3969
4245
|
<div class="datepicker-calendar-container">
|
|
3970
4246
|
<div class="datepicker-calendar"></div>
|
|
3971
4247
|
<div class="datepicker-footer">
|
|
3972
|
-
|
|
4248
|
+
<!--<button class="btn-flat datepicker-clear waves-effect" style="visibility: hidden;" type="button"></button>
|
|
3973
4249
|
<div class="confirmation-btns">
|
|
3974
4250
|
<button class="btn-flat datepicker-cancel waves-effect" type="button"></button>
|
|
3975
4251
|
<button class="btn-flat datepicker-done waves-effect" type="button"></button>
|
|
3976
|
-
</div
|
|
4252
|
+
</div>-->
|
|
3977
4253
|
</div>
|
|
3978
4254
|
</div>
|
|
3979
|
-
</div
|
|
3980
|
-
</div>`;
|
|
4255
|
+
</div>`;
|
|
3981
4256
|
}
|
|
3982
4257
|
}
|
|
3983
4258
|
|
|
@@ -4086,7 +4361,7 @@ var M = (function (exports) {
|
|
|
4086
4361
|
// So we set the height to the original one
|
|
4087
4362
|
textarea.style.height = originalHeight + 'px';
|
|
4088
4363
|
}
|
|
4089
|
-
textarea.setAttribute('previous-length', textarea.value.length.toString());
|
|
4364
|
+
textarea.setAttribute('previous-length', (textarea.value || '').length.toString());
|
|
4090
4365
|
}
|
|
4091
4366
|
static Init() {
|
|
4092
4367
|
if (typeof document !== 'undefined')
|
|
@@ -4133,7 +4408,7 @@ var M = (function (exports) {
|
|
|
4133
4408
|
static InitTextarea(textarea) {
|
|
4134
4409
|
// Save Data in Element
|
|
4135
4410
|
textarea.setAttribute('original-height', textarea.getBoundingClientRect().height.toString());
|
|
4136
|
-
textarea.setAttribute('previous-length', textarea.value.length.toString());
|
|
4411
|
+
textarea.setAttribute('previous-length', (textarea.value || '').length.toString());
|
|
4137
4412
|
Forms.textareaAutoResize(textarea);
|
|
4138
4413
|
textarea.addEventListener('keyup', (e) => Forms.textareaAutoResize(e.target));
|
|
4139
4414
|
textarea.addEventListener('keydown', (e) => Forms.textareaAutoResize(e.target));
|
|
@@ -4882,9 +5157,7 @@ var M = (function (exports) {
|
|
|
4882
5157
|
document.body.removeEventListener('click', this._handleTriggerClick);
|
|
4883
5158
|
}
|
|
4884
5159
|
}
|
|
4885
|
-
_handleThrottledResize = Utils.throttle(
|
|
4886
|
-
this._handleWindowScroll();
|
|
4887
|
-
}, 200).bind(this);
|
|
5160
|
+
_handleThrottledResize = () => Utils.throttle(this._handleWindowScroll, 200).bind(this);
|
|
4888
5161
|
_handleTriggerClick = (e) => {
|
|
4889
5162
|
const trigger = e.target;
|
|
4890
5163
|
for (let i = ScrollSpy._elements.length - 1; i >= 0; i--) {
|
|
@@ -5854,9 +6127,7 @@ var M = (function (exports) {
|
|
|
5854
6127
|
// this.originEl.removeEventListener('click', this._handleOriginClick);
|
|
5855
6128
|
window.removeEventListener('resize', this._handleThrottledResize);
|
|
5856
6129
|
}
|
|
5857
|
-
_handleThrottledResize = Utils.throttle(
|
|
5858
|
-
this._handleResize();
|
|
5859
|
-
}, 200).bind(this);
|
|
6130
|
+
_handleThrottledResize = () => Utils.throttle(this._handleResize, 200).bind(this);
|
|
5860
6131
|
_handleKeyboardInteraction = (e) => {
|
|
5861
6132
|
if (Utils.keys.ENTER.includes(e.key)) {
|
|
5862
6133
|
this._handleTargetToggle();
|
|
@@ -6055,6 +6326,7 @@ var M = (function (exports) {
|
|
|
6055
6326
|
defaultTime: 'now', // default time, 'now' or '13:14' e.g.
|
|
6056
6327
|
fromNow: 0, // Millisecond offset from the defaultTime
|
|
6057
6328
|
showClearBtn: false,
|
|
6329
|
+
autoSubmit: true,
|
|
6058
6330
|
// internationalization
|
|
6059
6331
|
i18n: {
|
|
6060
6332
|
cancel: 'Cancel',
|
|
@@ -6064,11 +6336,16 @@ var M = (function (exports) {
|
|
|
6064
6336
|
twelveHour: true, // change to 12 hour AM/PM clock from 24 hour
|
|
6065
6337
|
vibrate: true, // vibrate the device when dragging clock hand
|
|
6066
6338
|
// Callbacks
|
|
6067
|
-
onSelect: null
|
|
6339
|
+
onSelect: null,
|
|
6340
|
+
onInputInteraction: null,
|
|
6341
|
+
onDone: null,
|
|
6342
|
+
onCancel: null,
|
|
6343
|
+
displayPlugin: null,
|
|
6344
|
+
displayPluginOptions: null,
|
|
6068
6345
|
};
|
|
6069
6346
|
class Timepicker extends Component {
|
|
6070
6347
|
id;
|
|
6071
|
-
|
|
6348
|
+
containerEl;
|
|
6072
6349
|
plate;
|
|
6073
6350
|
digitalClock;
|
|
6074
6351
|
inputHours;
|
|
@@ -6108,6 +6385,7 @@ var M = (function (exports) {
|
|
|
6108
6385
|
g;
|
|
6109
6386
|
toggleViewTimer;
|
|
6110
6387
|
vibrateTimer;
|
|
6388
|
+
displayPlugin;
|
|
6111
6389
|
constructor(el, options) {
|
|
6112
6390
|
super(el, options, Timepicker);
|
|
6113
6391
|
this.el['M_Timepicker'] = this;
|
|
@@ -6121,6 +6399,10 @@ var M = (function (exports) {
|
|
|
6121
6399
|
this._setupEventHandlers();
|
|
6122
6400
|
this._clockSetup();
|
|
6123
6401
|
this._pickerSetup();
|
|
6402
|
+
if (this.options.displayPlugin) {
|
|
6403
|
+
if (this.options.displayPlugin === 'docked')
|
|
6404
|
+
this.displayPlugin = DockedDisplayPlugin.init(this.el, this.containerEl, this.options.displayPluginOptions);
|
|
6405
|
+
}
|
|
6124
6406
|
}
|
|
6125
6407
|
static get defaults() {
|
|
6126
6408
|
return _defaults$5;
|
|
@@ -6155,7 +6437,7 @@ var M = (function (exports) {
|
|
|
6155
6437
|
}
|
|
6156
6438
|
destroy() {
|
|
6157
6439
|
this._removeEventHandlers();
|
|
6158
|
-
this.
|
|
6440
|
+
this.containerEl.remove();
|
|
6159
6441
|
this.el['M_Timepicker'] = undefined;
|
|
6160
6442
|
}
|
|
6161
6443
|
_setupEventHandlers() {
|
|
@@ -6174,12 +6456,20 @@ var M = (function (exports) {
|
|
|
6174
6456
|
this.el.removeEventListener('keydown', this._handleInputKeydown);
|
|
6175
6457
|
}
|
|
6176
6458
|
_handleInputClick = () => {
|
|
6177
|
-
this.
|
|
6459
|
+
this.inputHours.focus();
|
|
6460
|
+
if (typeof this.options.onInputInteraction === 'function')
|
|
6461
|
+
this.options.onInputInteraction.call(this);
|
|
6462
|
+
if (this.displayPlugin)
|
|
6463
|
+
this.displayPlugin.show();
|
|
6178
6464
|
};
|
|
6179
6465
|
_handleInputKeydown = (e) => {
|
|
6180
6466
|
if (Utils.keys.ENTER.includes(e.key)) {
|
|
6181
6467
|
e.preventDefault();
|
|
6182
|
-
this.
|
|
6468
|
+
this.inputHours.focus();
|
|
6469
|
+
if (typeof this.options.onInputInteraction === 'function')
|
|
6470
|
+
this.options.onInputInteraction.call(this);
|
|
6471
|
+
if (this.displayPlugin)
|
|
6472
|
+
this.displayPlugin.show();
|
|
6183
6473
|
}
|
|
6184
6474
|
};
|
|
6185
6475
|
_handleTimeInputEnterKey = (e) => {
|
|
@@ -6226,12 +6516,14 @@ var M = (function (exports) {
|
|
|
6226
6516
|
this.setHand(x, y);
|
|
6227
6517
|
}
|
|
6228
6518
|
if (this.currentView === 'hours') {
|
|
6519
|
+
this.inputMinutes.focus();
|
|
6229
6520
|
this.showView('minutes', this.options.duration / 2);
|
|
6230
6521
|
}
|
|
6231
6522
|
else {
|
|
6232
|
-
this.minutesView.classList.add('timepicker-dial-out');
|
|
6523
|
+
// this.minutesView.classList.add('timepicker-dial-out');
|
|
6233
6524
|
setTimeout(() => {
|
|
6234
|
-
this.
|
|
6525
|
+
if (this.options.autoSubmit)
|
|
6526
|
+
this.done();
|
|
6235
6527
|
}, this.options.duration / 2);
|
|
6236
6528
|
}
|
|
6237
6529
|
if (typeof this.options.onSelect === 'function') {
|
|
@@ -6244,16 +6536,16 @@ var M = (function (exports) {
|
|
|
6244
6536
|
_insertHTMLIntoDOM() {
|
|
6245
6537
|
const template = document.createElement('template');
|
|
6246
6538
|
template.innerHTML = Timepicker._template.trim();
|
|
6247
|
-
this.
|
|
6248
|
-
this.
|
|
6539
|
+
this.containerEl = template.content.firstChild;
|
|
6540
|
+
this.containerEl.id = 'container-' + this.id;
|
|
6249
6541
|
// Append popover to input by default
|
|
6250
6542
|
const optEl = this.options.container;
|
|
6251
6543
|
const containerEl = optEl instanceof HTMLElement ? optEl : document.querySelector(optEl);
|
|
6252
6544
|
if (this.options.container && !!containerEl) {
|
|
6253
|
-
containerEl.append(this.
|
|
6545
|
+
containerEl.append(this.containerEl);
|
|
6254
6546
|
}
|
|
6255
6547
|
else {
|
|
6256
|
-
this.el.parentElement.appendChild(this.
|
|
6548
|
+
this.el.parentElement.appendChild(this.containerEl);
|
|
6257
6549
|
}
|
|
6258
6550
|
}
|
|
6259
6551
|
_setupVariables() {
|
|
@@ -6263,42 +6555,49 @@ var M = (function (exports) {
|
|
|
6263
6555
|
: navigator['webkitVibrate']
|
|
6264
6556
|
? 'webkitVibrate'
|
|
6265
6557
|
: null;
|
|
6266
|
-
this._canvas = this.
|
|
6267
|
-
this.plate = this.
|
|
6268
|
-
this.digitalClock = this.
|
|
6269
|
-
this.hoursView = this.
|
|
6270
|
-
this.minutesView = this.
|
|
6271
|
-
this.inputHours = this.
|
|
6272
|
-
this.inputMinutes = this.
|
|
6273
|
-
this.spanAmPm = this.
|
|
6274
|
-
this.footer = this.
|
|
6558
|
+
this._canvas = this.containerEl.querySelector('.timepicker-canvas');
|
|
6559
|
+
this.plate = this.containerEl.querySelector('.timepicker-plate');
|
|
6560
|
+
this.digitalClock = this.containerEl.querySelector('.timepicker-display-column');
|
|
6561
|
+
this.hoursView = this.containerEl.querySelector('.timepicker-hours');
|
|
6562
|
+
this.minutesView = this.containerEl.querySelector('.timepicker-minutes');
|
|
6563
|
+
this.inputHours = this.containerEl.querySelector('.timepicker-input-hours');
|
|
6564
|
+
this.inputMinutes = this.containerEl.querySelector('.timepicker-input-minutes');
|
|
6565
|
+
this.spanAmPm = this.containerEl.querySelector('.timepicker-span-am-pm');
|
|
6566
|
+
this.footer = this.containerEl.querySelector('.timepicker-footer');
|
|
6275
6567
|
this.amOrPm = 'PM';
|
|
6276
6568
|
}
|
|
6277
|
-
_createButton(text, visibility) {
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
}
|
|
6569
|
+
/*private _createButton(text: string, visibility: string): HTMLButtonElement {
|
|
6570
|
+
const button = document.createElement('button');
|
|
6571
|
+
button.classList.add('btn', 'waves-effect', 'text');
|
|
6572
|
+
button.style.visibility = visibility;
|
|
6573
|
+
button.type = 'button';
|
|
6574
|
+
button.tabIndex = -1;
|
|
6575
|
+
button.innerText = text;
|
|
6576
|
+
return button;
|
|
6577
|
+
}*/
|
|
6286
6578
|
_pickerSetup() {
|
|
6287
|
-
|
|
6288
|
-
clearButton.
|
|
6289
|
-
|
|
6290
|
-
this.footer.
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6579
|
+
// clearButton.classList.add('timepicker-clear');
|
|
6580
|
+
// clearButton.addEventListener('click', this.clear);
|
|
6581
|
+
// this.footer.appendChild(clearButton);
|
|
6582
|
+
Utils.createButton(this.footer, this.options.i18n.clear, ['timepicker-clear'], this.options.showClearBtn, this.clear);
|
|
6583
|
+
if (!this.options.autoSubmit) {
|
|
6584
|
+
/*const confirmationBtnsContainer = document.createElement('div');
|
|
6585
|
+
confirmationBtnsContainer.classList.add('confirmation-btns');
|
|
6586
|
+
this.footer.append(confirmationBtnsContainer);
|
|
6587
|
+
|
|
6588
|
+
const cancelButton = this._createButton(this.options.i18n.cancel, '');
|
|
6589
|
+
cancelButton.classList.add('timepicker-close');
|
|
6590
|
+
cancelButton.addEventListener('click', this.close);
|
|
6591
|
+
confirmationBtnsContainer.appendChild(cancelButton);
|
|
6592
|
+
|
|
6593
|
+
const doneButton = this._createButton(this.options.i18n.done, '');
|
|
6594
|
+
doneButton.classList.add('timepicker-close');
|
|
6595
|
+
//doneButton.addEventListener('click', this._finishSelection);
|
|
6596
|
+
confirmationBtnsContainer.appendChild(doneButton);*/
|
|
6597
|
+
Utils.createConfirmationContainer(this.footer, this.options.i18n.done, this.options.i18n.cancel, this.confirm, this.cancel);
|
|
6598
|
+
}
|
|
6599
|
+
this._updateTimeFromInput();
|
|
6600
|
+
this.showView('hours');
|
|
6302
6601
|
}
|
|
6303
6602
|
_clockSetup() {
|
|
6304
6603
|
if (this.options.twelveHour) {
|
|
@@ -6306,13 +6605,17 @@ var M = (function (exports) {
|
|
|
6306
6605
|
this._amBtn = document.createElement('div');
|
|
6307
6606
|
this._amBtn.classList.add('am-btn', 'btn');
|
|
6308
6607
|
this._amBtn.innerText = 'AM';
|
|
6608
|
+
this._amBtn.tabIndex = 0;
|
|
6309
6609
|
this._amBtn.addEventListener('click', this._handleAmPmClick);
|
|
6610
|
+
this._amBtn.addEventListener('keypress', this._handleAmPmKeypress);
|
|
6310
6611
|
this.spanAmPm.appendChild(this._amBtn);
|
|
6311
6612
|
// PM Button
|
|
6312
6613
|
this._pmBtn = document.createElement('div');
|
|
6313
6614
|
this._pmBtn.classList.add('pm-btn', 'btn');
|
|
6314
6615
|
this._pmBtn.innerText = 'PM';
|
|
6616
|
+
this._pmBtn.tabIndex = 0;
|
|
6315
6617
|
this._pmBtn.addEventListener('click', this._handleAmPmClick);
|
|
6618
|
+
this._pmBtn.addEventListener('keypress', this._handleAmPmKeypress);
|
|
6316
6619
|
this.spanAmPm.appendChild(this._pmBtn);
|
|
6317
6620
|
}
|
|
6318
6621
|
this._buildHoursView();
|
|
@@ -6405,8 +6708,15 @@ var M = (function (exports) {
|
|
|
6405
6708
|
}
|
|
6406
6709
|
}
|
|
6407
6710
|
_handleAmPmClick = (e) => {
|
|
6408
|
-
|
|
6409
|
-
|
|
6711
|
+
this._handleAmPmInteraction(e.target);
|
|
6712
|
+
};
|
|
6713
|
+
_handleAmPmKeypress = (e) => {
|
|
6714
|
+
if (Utils.keys.ENTER.includes(e.key)) {
|
|
6715
|
+
this._handleAmPmInteraction(e.target);
|
|
6716
|
+
}
|
|
6717
|
+
};
|
|
6718
|
+
_handleAmPmInteraction = (e) => {
|
|
6719
|
+
this.amOrPm = e.classList.contains('am-btn') ? 'AM' : 'PM';
|
|
6410
6720
|
this._updateAmPmView();
|
|
6411
6721
|
};
|
|
6412
6722
|
_updateAmPmView() {
|
|
@@ -6455,14 +6765,13 @@ var M = (function (exports) {
|
|
|
6455
6765
|
if (view === 'minutes' && getComputedStyle(this.hoursView).visibility === 'visible') ;
|
|
6456
6766
|
const isHours = view === 'hours', nextView = isHours ? this.hoursView : this.minutesView, hideView = isHours ? this.minutesView : this.hoursView;
|
|
6457
6767
|
this.currentView = view;
|
|
6458
|
-
if (isHours) {
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
}
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
}
|
|
6768
|
+
/*if (isHours) {
|
|
6769
|
+
this.inputHours.classList.add('text-primary');
|
|
6770
|
+
this.inputMinutes.classList.remove('text-primary');
|
|
6771
|
+
} else {
|
|
6772
|
+
this.inputHours.classList.remove('text-primary');
|
|
6773
|
+
this.inputMinutes.classList.add('text-primary');
|
|
6774
|
+
}*/
|
|
6466
6775
|
// Transition view
|
|
6467
6776
|
hideView.classList.add('timepicker-dial-out');
|
|
6468
6777
|
nextView.style.visibility = 'visible';
|
|
@@ -6611,8 +6920,7 @@ var M = (function (exports) {
|
|
|
6611
6920
|
this.hours = new Date().getHours();
|
|
6612
6921
|
this.inputHours.value = (this.hours % (this.options.twelveHour ? 12 : 24)).toString();
|
|
6613
6922
|
}
|
|
6614
|
-
|
|
6615
|
-
done = (e = null, clearValue = null) => {
|
|
6923
|
+
done = (clearValue = null) => {
|
|
6616
6924
|
// Set input value
|
|
6617
6925
|
const last = this.el.value;
|
|
6618
6926
|
let value = clearValue
|
|
@@ -6627,16 +6935,23 @@ var M = (function (exports) {
|
|
|
6627
6935
|
if (value !== last) {
|
|
6628
6936
|
this.el.dispatchEvent(new Event('change', { bubbles: true, cancelable: true, composed: true }));
|
|
6629
6937
|
}
|
|
6630
|
-
|
|
6631
|
-
|
|
6938
|
+
};
|
|
6939
|
+
confirm = () => {
|
|
6940
|
+
this.done();
|
|
6941
|
+
if (typeof this.options.onDone === 'function')
|
|
6942
|
+
this.options.onDone.call(this);
|
|
6943
|
+
};
|
|
6944
|
+
cancel = () => {
|
|
6945
|
+
// not logical clearing the input field on cancel, since the end user might want to make use of the previously submitted value
|
|
6946
|
+
// this.clear();
|
|
6947
|
+
if (typeof this.options.onCancel === 'function')
|
|
6948
|
+
this.options.onCancel.call(this);
|
|
6632
6949
|
};
|
|
6633
6950
|
clear = () => {
|
|
6634
|
-
this.done(
|
|
6951
|
+
this.done(true);
|
|
6635
6952
|
};
|
|
6636
6953
|
// deprecated
|
|
6637
6954
|
open() {
|
|
6638
|
-
// this._updateTimeFromInput();
|
|
6639
|
-
// this.showView('hours');
|
|
6640
6955
|
console.warn('Timepicker.close() is deprecated. Remove this method and wrap in modal yourself.');
|
|
6641
6956
|
return this;
|
|
6642
6957
|
}
|
|
@@ -6645,14 +6960,12 @@ var M = (function (exports) {
|
|
|
6645
6960
|
return this;
|
|
6646
6961
|
}
|
|
6647
6962
|
static {
|
|
6648
|
-
Timepicker._template =
|
|
6649
|
-
<div class="modal timepicker-modal">
|
|
6650
|
-
<div class="modal-content timepicker-container">
|
|
6963
|
+
Timepicker._template = `<div class="timepicker-container">
|
|
6651
6964
|
<div class="timepicker-digital-display">
|
|
6652
6965
|
<div class="timepicker-text-container">
|
|
6653
|
-
<div class="timepicker-display-column">
|
|
6966
|
+
<div class="timepicker-display-column timepicker-display-digital-clock">
|
|
6654
6967
|
<div class="timepicker-input-hours-wrapper">
|
|
6655
|
-
<input type="text" maxlength="2"
|
|
6968
|
+
<input type="text" maxlength="2" class="timepicker-input-hours text-primary" />
|
|
6656
6969
|
</div>
|
|
6657
6970
|
<div class="timepicker-input-divider-wrapper">
|
|
6658
6971
|
<span class="timepicker-input-divider">:</span>
|
|
@@ -6674,8 +6987,7 @@ var M = (function (exports) {
|
|
|
6674
6987
|
</div>
|
|
6675
6988
|
<div class="timepicker-footer"></div>
|
|
6676
6989
|
</div>
|
|
6677
|
-
</div
|
|
6678
|
-
</div>`;
|
|
6990
|
+
</div>`;
|
|
6679
6991
|
}
|
|
6680
6992
|
}
|
|
6681
6993
|
|
|
@@ -7838,7 +8150,7 @@ var M = (function (exports) {
|
|
|
7838
8150
|
}
|
|
7839
8151
|
|
|
7840
8152
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7841
|
-
const version = '2.2.
|
|
8153
|
+
const version = '2.2.2';
|
|
7842
8154
|
/**
|
|
7843
8155
|
* Automatically initialize components.
|
|
7844
8156
|
* @param context Root element to initialize. Defaults to `document.body`.
|
|
@@ -7897,6 +8209,7 @@ var M = (function (exports) {
|
|
|
7897
8209
|
Chips.Init();
|
|
7898
8210
|
Waves.Init();
|
|
7899
8211
|
Range.Init();
|
|
8212
|
+
Cards.Init();
|
|
7900
8213
|
|
|
7901
8214
|
exports.AutoInit = AutoInit;
|
|
7902
8215
|
exports.Autocomplete = Autocomplete;
|