carbon-components
Advanced tools
Comparing version 7.3.2 to 7.3.3
@@ -44,6 +44,8 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var feedback = this.element.querySelector(this.options.feedbackTooltip); | ||
feedback.classList.add(this.options.classShowFeedback); | ||
setTimeout(function () { | ||
feedback.classList.remove(_this2.options.classShowFeedback); | ||
}, this.options.timeoutValue); | ||
if (feedback) { | ||
feedback.classList.add(this.options.classShowFeedback); | ||
setTimeout(function () { | ||
feedback.classList.remove(_this2.options.classShowFeedback); | ||
}, this.options.timeoutValue); | ||
} | ||
} | ||
@@ -50,0 +52,0 @@ |
@@ -48,2 +48,6 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
if (!_this.tableBody) { | ||
throw new Error('Cannot find the table body.'); | ||
} | ||
_this._zebraStripe(); | ||
@@ -50,0 +54,0 @@ _this._initExpandableRows(); |
@@ -42,5 +42,13 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
_this.input = _this.element.querySelector(_this.options.selectorInput); | ||
_this.inputId = _this.input.getAttribute('id'); | ||
_this.container = _this.element.querySelector(_this.options.selectorContainer); | ||
if (!_this.input) { | ||
throw new Error('Cannot find the file input box.'); | ||
} | ||
if (!_this.container) { | ||
throw new Error('Cannot find the file names container.'); | ||
} | ||
_this.inputId = _this.input.getAttribute('id'); | ||
_this.input.addEventListener('change', function () { | ||
@@ -47,0 +55,0 @@ return _this._displayFilenames(); |
@@ -36,8 +36,10 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
_this.button = element.querySelector(_this.options.selectorButton) || false; | ||
_this.button.addEventListener('click', function (evt) { | ||
if (evt.currentTarget === _this.button) { | ||
_this.remove(); | ||
} | ||
}); | ||
_this.button = element.querySelector(_this.options.selectorButton); | ||
if (_this.button) { | ||
_this.button.addEventListener('click', function (evt) { | ||
if (evt.currentTarget === _this.button) { | ||
_this.remove(); | ||
} | ||
}); | ||
} | ||
return _this; | ||
@@ -44,0 +46,0 @@ } |
@@ -45,2 +45,5 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var input = _this.element.querySelector(_this.options.selectorSearchInput); | ||
if (!input) { | ||
throw new Error('Cannot find the search input.'); | ||
} | ||
@@ -47,0 +50,0 @@ if (closeIcon) { |
@@ -148,3 +148,6 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
value: function _updateMenuState() { | ||
this.element.querySelector(this.options.selectorMenu).classList.toggle(this.options.classHidden); | ||
var menu = this.element.querySelector(this.options.selectorMenu); | ||
if (menu) { | ||
menu.classList.toggle(this.options.classHidden); | ||
} | ||
} | ||
@@ -160,3 +163,6 @@ | ||
value: function _updateTriggerText(target) { | ||
this.element.querySelector(this.options.selectorTriggerText).textContent = target.textContent; | ||
var triggerText = this.element.querySelector(this.options.selectorTriggerText); | ||
if (triggerText) { | ||
triggerText.textContent = target.textContent; | ||
} | ||
} | ||
@@ -163,0 +169,0 @@ |
@@ -38,9 +38,10 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var rowHeightBtns = _this.element.querySelector(_this.options.selectorRowHeight); | ||
rowHeightBtns.addEventListener('click', function (event) { | ||
_this._handleRowHeightChange(event, boundTable); | ||
}); | ||
// [...this.element.querySelectorAll(this.options.selectorRowHeight)].forEach((item) => { | ||
// item.addEventListener('click', (event) => { this._handleRowHeightChange(event, boundTable); }); | ||
// }); | ||
if (rowHeightBtns) { | ||
rowHeightBtns.addEventListener('click', function (event) { | ||
_this._handleRowHeightChange(event, boundTable); | ||
}); | ||
// [...this.element.querySelectorAll(this.options.selectorRowHeight)].forEach((item) => { | ||
// item.addEventListener('click', (event) => { this._handleRowHeightChange(event, boundTable); }); | ||
// }); | ||
} | ||
} | ||
@@ -70,15 +71,18 @@ | ||
var searchInput = eventMatches(event, this.options.selectorSearch); | ||
var isOfSelf = this.element.querySelector(this.options.selectorSearch).contains(event.target); | ||
var isOfToolbar = this.element.contains(event.target); | ||
var shouldBeOpen = isOfSelf && !this.element.classList.contains(this.options.classSearchActive); | ||
var isOfSelfSearchInput = searchInput && this.element.contains(searchInput); | ||
if (searchInput && shouldBeOpen) { | ||
searchInput.classList.add(this.options.classSearchActive); | ||
searchInput.querySelector('input').focus(); | ||
if (isOfSelfSearchInput) { | ||
var shouldBeOpen = isOfSelfSearchInput && !this.element.classList.contains(this.options.classSearchActive); | ||
searchInput.classList.toggle(this.options.classSearchActive, shouldBeOpen); | ||
if (shouldBeOpen) { | ||
searchInput.querySelector('input').focus(); | ||
} | ||
} | ||
if (!searchInput && !isOfToolbar) { | ||
[].concat(_toConsumableArray(this.element.ownerDocument.querySelectorAll(this.options.selectorSearch))).forEach(function (item) { | ||
var targetComponentElement = eventMatches(event, this.options.selectorInit); | ||
[].concat(_toConsumableArray(this.element.ownerDocument.querySelectorAll(this.options.selectorSearch))).forEach(function (item) { | ||
if (!targetComponentElement || !targetComponentElement.contains(item)) { | ||
item.classList.remove(_this2.options.classSearchActive); | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
@@ -85,0 +89,0 @@ |
@@ -14,2 +14,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
import initComponentBySearch from '../../globals/js/mixins/init-component-by-search'; | ||
import eventMatches from '../../globals/js/misc/event-matches'; | ||
import on from '../../globals/js/misc/on'; | ||
@@ -51,27 +52,26 @@ | ||
if (event.target.querySelector(_this.options.selectorAccountDropdown) !== null) { | ||
if (event.detail.item.querySelector(_this.options.classLinkedIcon) !== null) { | ||
_this.element.linkedAccount = event.detail.item.querySelector(_this.options.selectorAccountSlLinked).cloneNode(true); | ||
_this.element.isLinked = true; | ||
_this.element.linkedIcon = event.detail.item.querySelector(_this.options.classLinkedIcon).cloneNode(true); | ||
} else { | ||
_this.element.linkedAccount = ''; | ||
_this.element.isLinked = false; | ||
_this.element.linkedIcon = ''; | ||
} | ||
var linkedIconNode = event.detail.item.querySelector(_this.options.classLinkedIcon); | ||
_this.element.isLinked = !!linkedIconNode; | ||
_this.element.linkedIcon = linkedIconNode && linkedIconNode.cloneNode(true); | ||
var linkedAccountNode = event.detail.item.querySelector(_this.options.selectorAccountSlLinked); | ||
_this.element.linkedAccount = linkedAccountNode && linkedAccountNode.cloneNode(true); | ||
} | ||
}); | ||
_this.element.querySelector(_this.options.selectorToggle).addEventListener('keydown', function (event) { | ||
_this.toggle(event); | ||
}); | ||
var toggleNode = _this.element.querySelector(_this.options.selectorToggle); | ||
if (toggleNode) { | ||
toggleNode.addEventListener('keydown', function (event) { | ||
_this.toggle(event); | ||
}); | ||
_this.element.querySelector(_this.options.selectorToggle).addEventListener('mouseenter', function (event) { | ||
_this.getLinkedData(event); | ||
_this.determineSwitcherValues(true); | ||
}); | ||
toggleNode.addEventListener('mouseenter', function (event) { | ||
_this.getLinkedData(event); | ||
_this.determineSwitcherValues(true); | ||
}); | ||
_this.element.querySelector(_this.options.selectorToggle).addEventListener('mouseleave', function (event) { | ||
_this.getLinkedData(event); | ||
_this.determineSwitcherValues(false); | ||
}); | ||
toggleNode.addEventListener('mouseleave', function (event) { | ||
_this.getLinkedData(event); | ||
_this.determineSwitcherValues(false); | ||
}); | ||
} | ||
@@ -133,3 +133,3 @@ _this.element.ownerDocument.addEventListener('keyup', function () { | ||
var isOfSelf = this.element.contains(clickTarget); | ||
var isToggle = this.element.ownerDocument.querySelector(this.options.selectorToggle).contains(clickTarget); | ||
var isToggle = eventMatches(evt, this.options.selectorToggle); | ||
var isOpen = this.element.classList.contains(this.options.classSwitcherOpen); | ||
@@ -215,31 +215,52 @@ | ||
if (isHovered && !isOpen) { | ||
nameElement.textContent = nameDropdownValue; | ||
orgElement.textContent = orgDropdownValue; | ||
spaceElement.textContent = spaceDropdownValue; | ||
regionElement.textContent = regionDropdownValue; | ||
menuElement.style.width = this.element.getBoundingClientRect().width + 'px'; | ||
} else { | ||
if (nameDropdownValue.length > 25) { | ||
nameShort = nameDropdownValue.substr(0, 25) + '...'; | ||
nameElement.textContent = nameShort; | ||
} else { | ||
if (nameElement) { | ||
nameElement.textContent = nameDropdownValue; | ||
} | ||
if (orgDropdownValue.length > 25) { | ||
orgShort = orgDropdownValue.slice(0, 12) + '...' + orgDropdownValue.slice(-13); | ||
orgElement.textContent = orgShort; | ||
} else { | ||
if (orgElement) { | ||
orgElement.textContent = orgDropdownValue; | ||
} | ||
if (spaceDropdownValue.length > 25) { | ||
spaceShort = spaceDropdownValue.substr(0, 25) + '...'; | ||
spaceElement.textContent = spaceShort; | ||
} else { | ||
if (spaceElement) { | ||
spaceElement.textContent = spaceDropdownValue; | ||
} | ||
if (regionElement) { | ||
regionElement.textContent = regionDropdownValue; | ||
} | ||
if (menuElement) { | ||
menuElement.style.width = this.element.getBoundingClientRect().width + 'px'; | ||
} | ||
} else { | ||
if (nameElement) { | ||
if (nameDropdownValue.length > 25) { | ||
nameShort = nameDropdownValue.substr(0, 25) + '...'; | ||
nameElement.textContent = nameShort; | ||
} else { | ||
nameElement.textContent = nameDropdownValue; | ||
} | ||
} | ||
regionElement.textContent = regionDropdownValue; | ||
menuElement.style.width = this.element.getBoundingClientRect().width + 'px'; | ||
if (orgElement) { | ||
if (orgDropdownValue.length > 25) { | ||
orgShort = orgDropdownValue.slice(0, 12) + '...' + orgDropdownValue.slice(-13); | ||
orgElement.textContent = orgShort; | ||
} else { | ||
orgElement.textContent = orgDropdownValue; | ||
} | ||
} | ||
if (spaceElement) { | ||
if (spaceDropdownValue.length > 25) { | ||
spaceShort = spaceDropdownValue.substr(0, 25) + '...'; | ||
spaceElement.textContent = spaceShort; | ||
} else { | ||
spaceElement.textContent = spaceDropdownValue; | ||
} | ||
} | ||
if (regionElement) { | ||
regionElement.textContent = regionDropdownValue; | ||
} | ||
if (menuElement) { | ||
menuElement.style.width = this.element.getBoundingClientRect().width + 'px'; | ||
} | ||
} | ||
@@ -246,0 +267,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"homepage": "http://carbondesignsystem.com/", | ||
"version": "7.3.2", | ||
"version": "7.3.3", | ||
"module": "es/index.js", | ||
@@ -8,0 +8,0 @@ "main": "umd/index.js", |
@@ -22,6 +22,8 @@ import mixin from '../../globals/js/misc/mixin'; | ||
const feedback = this.element.querySelector(this.options.feedbackTooltip); | ||
feedback.classList.add(this.options.classShowFeedback); | ||
setTimeout(() => { | ||
feedback.classList.remove(this.options.classShowFeedback); | ||
}, this.options.timeoutValue); | ||
if (feedback) { | ||
feedback.classList.add(this.options.classShowFeedback); | ||
setTimeout(() => { | ||
feedback.classList.remove(this.options.classShowFeedback); | ||
}, this.options.timeoutValue); | ||
} | ||
} | ||
@@ -28,0 +30,0 @@ |
@@ -32,2 +32,6 @@ import mixin from '../../globals/js/misc/mixin'; | ||
if (!this.tableBody) { | ||
throw new Error('Cannot find the table body.'); | ||
} | ||
this._zebraStripe(); | ||
@@ -34,0 +38,0 @@ this._initExpandableRows(); |
@@ -18,5 +18,13 @@ import mixin from '../../globals/js/misc/mixin'; | ||
this.input = this.element.querySelector(this.options.selectorInput); | ||
this.inputId = this.input.getAttribute('id'); | ||
this.container = this.element.querySelector(this.options.selectorContainer); | ||
if (!this.input) { | ||
throw new Error('Cannot find the file input box.'); | ||
} | ||
if (!this.container) { | ||
throw new Error('Cannot find the file names container.'); | ||
} | ||
this.inputId = this.input.getAttribute('id'); | ||
this.input.addEventListener('change', () => this._displayFilenames()); | ||
@@ -23,0 +31,0 @@ } |
@@ -15,8 +15,10 @@ import mixin from '../../globals/js/misc/mixin'; | ||
super(element, options); | ||
this.button = element.querySelector(this.options.selectorButton) || false; | ||
this.button.addEventListener('click', (evt) => { | ||
if (evt.currentTarget === this.button) { | ||
this.remove(); | ||
} | ||
}); | ||
this.button = element.querySelector(this.options.selectorButton); | ||
if (this.button) { | ||
this.button.addEventListener('click', (evt) => { | ||
if (evt.currentTarget === this.button) { | ||
this.remove(); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -23,0 +25,0 @@ |
@@ -30,2 +30,5 @@ import mixin from '../../globals/js/misc/mixin'; | ||
const input = this.element.querySelector(this.options.selectorSearchInput); | ||
if (!input) { | ||
throw new Error('Cannot find the search input.'); | ||
} | ||
@@ -32,0 +35,0 @@ if (closeIcon) { |
@@ -109,3 +109,6 @@ import eventMatches from '../../globals/js/misc/event-matches'; | ||
_updateMenuState() { | ||
this.element.querySelector(this.options.selectorMenu).classList.toggle(this.options.classHidden); | ||
const menu = this.element.querySelector(this.options.selectorMenu); | ||
if (menu) { | ||
menu.classList.toggle(this.options.classHidden); | ||
} | ||
} | ||
@@ -118,3 +121,6 @@ | ||
_updateTriggerText(target) { | ||
this.element.querySelector(this.options.selectorTriggerText).textContent = target.textContent; | ||
const triggerText = this.element.querySelector(this.options.selectorTriggerText); | ||
if (triggerText) { | ||
triggerText.textContent = target.textContent; | ||
} | ||
} | ||
@@ -121,0 +127,0 @@ |
@@ -22,7 +22,8 @@ import mixin from '../../globals/js/misc/mixin'; | ||
const rowHeightBtns = this.element.querySelector(this.options.selectorRowHeight); | ||
rowHeightBtns.addEventListener('click', (event) => { this._handleRowHeightChange(event, boundTable); }); | ||
// [...this.element.querySelectorAll(this.options.selectorRowHeight)].forEach((item) => { | ||
// item.addEventListener('click', (event) => { this._handleRowHeightChange(event, boundTable); }); | ||
// }); | ||
if (rowHeightBtns) { | ||
rowHeightBtns.addEventListener('click', (event) => { this._handleRowHeightChange(event, boundTable); }); | ||
// [...this.element.querySelectorAll(this.options.selectorRowHeight)].forEach((item) => { | ||
// item.addEventListener('click', (event) => { this._handleRowHeightChange(event, boundTable); }); | ||
// }); | ||
} | ||
} | ||
@@ -41,15 +42,18 @@ | ||
const searchInput = eventMatches(event, this.options.selectorSearch); | ||
const isOfSelf = this.element.querySelector(this.options.selectorSearch).contains(event.target); | ||
const isOfToolbar = this.element.contains(event.target); | ||
const shouldBeOpen = isOfSelf && !this.element.classList.contains(this.options.classSearchActive); | ||
const isOfSelfSearchInput = searchInput && this.element.contains(searchInput); | ||
if (searchInput && shouldBeOpen) { | ||
searchInput.classList.add(this.options.classSearchActive); | ||
searchInput.querySelector('input').focus(); | ||
if (isOfSelfSearchInput) { | ||
const shouldBeOpen = isOfSelfSearchInput && !this.element.classList.contains(this.options.classSearchActive); | ||
searchInput.classList.toggle(this.options.classSearchActive, shouldBeOpen); | ||
if (shouldBeOpen) { | ||
searchInput.querySelector('input').focus(); | ||
} | ||
} | ||
if (!searchInput && !isOfToolbar) { | ||
[...this.element.ownerDocument.querySelectorAll(this.options.selectorSearch)].forEach((item) => { | ||
const targetComponentElement = eventMatches(event, this.options.selectorInit); | ||
[...this.element.ownerDocument.querySelectorAll(this.options.selectorSearch)].forEach((item) => { | ||
if (!targetComponentElement || !targetComponentElement.contains(item)) { | ||
item.classList.remove(this.options.classSearchActive); | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
@@ -56,0 +60,0 @@ |
import mixin from '../../globals/js/misc/mixin'; | ||
import createComponent from '../../globals/js/mixins/create-component'; | ||
import initComponentBySearch from '../../globals/js/mixins/init-component-by-search'; | ||
import eventMatches from '../../globals/js/misc/event-matches'; | ||
import on from '../../globals/js/misc/on'; | ||
@@ -34,25 +35,24 @@ | ||
if (event.target.querySelector(this.options.selectorAccountDropdown) !== null) { | ||
if (event.detail.item.querySelector(this.options.classLinkedIcon) !== null) { | ||
this.element.linkedAccount = event.detail.item.querySelector(this.options.selectorAccountSlLinked).cloneNode(true); | ||
this.element.isLinked = true; | ||
this.element.linkedIcon = event.detail.item.querySelector(this.options.classLinkedIcon).cloneNode(true); | ||
} else { | ||
this.element.linkedAccount = ''; | ||
this.element.isLinked = false; | ||
this.element.linkedIcon = ''; | ||
} | ||
const linkedIconNode = event.detail.item.querySelector(this.options.classLinkedIcon); | ||
this.element.isLinked = !!linkedIconNode; | ||
this.element.linkedIcon = linkedIconNode && linkedIconNode.cloneNode(true); | ||
const linkedAccountNode = event.detail.item.querySelector(this.options.selectorAccountSlLinked); | ||
this.element.linkedAccount = linkedAccountNode && linkedAccountNode.cloneNode(true); | ||
} | ||
}); | ||
this.element.querySelector(this.options.selectorToggle).addEventListener('keydown', (event) => { this.toggle(event); }); | ||
const toggleNode = this.element.querySelector(this.options.selectorToggle); | ||
if (toggleNode) { | ||
toggleNode.addEventListener('keydown', (event) => { this.toggle(event); }); | ||
this.element.querySelector(this.options.selectorToggle).addEventListener('mouseenter', (event) => { | ||
this.getLinkedData(event); | ||
this.determineSwitcherValues(true); | ||
}); | ||
toggleNode.addEventListener('mouseenter', (event) => { | ||
this.getLinkedData(event); | ||
this.determineSwitcherValues(true); | ||
}); | ||
this.element.querySelector(this.options.selectorToggle).addEventListener('mouseleave', (event) => { | ||
this.getLinkedData(event); | ||
this.determineSwitcherValues(false); | ||
}); | ||
toggleNode.addEventListener('mouseleave', (event) => { | ||
this.getLinkedData(event); | ||
this.determineSwitcherValues(false); | ||
}); | ||
} | ||
@@ -102,3 +102,3 @@ this.element.ownerDocument.addEventListener('keyup', () => this.handleBlur()); | ||
const isOfSelf = this.element.contains(clickTarget); | ||
const isToggle = this.element.ownerDocument.querySelector(this.options.selectorToggle).contains(clickTarget); | ||
const isToggle = eventMatches(evt, this.options.selectorToggle); | ||
const isOpen = this.element.classList.contains(this.options.classSwitcherOpen); | ||
@@ -183,31 +183,52 @@ | ||
if (isHovered && !isOpen) { | ||
nameElement.textContent = nameDropdownValue; | ||
orgElement.textContent = orgDropdownValue; | ||
spaceElement.textContent = spaceDropdownValue; | ||
regionElement.textContent = regionDropdownValue; | ||
menuElement.style.width = `${this.element.getBoundingClientRect().width}px`; | ||
} else { | ||
if (nameDropdownValue.length > 25) { | ||
nameShort = `${nameDropdownValue.substr(0, 25)}...`; | ||
nameElement.textContent = nameShort; | ||
} else { | ||
if (nameElement) { | ||
nameElement.textContent = nameDropdownValue; | ||
} | ||
if (orgDropdownValue.length > 25) { | ||
orgShort = `${orgDropdownValue.slice(0, 12)}...${orgDropdownValue.slice(-13)}`; | ||
orgElement.textContent = orgShort; | ||
} else { | ||
if (orgElement) { | ||
orgElement.textContent = orgDropdownValue; | ||
} | ||
if (spaceDropdownValue.length > 25) { | ||
spaceShort = `${spaceDropdownValue.substr(0, 25)}...`; | ||
spaceElement.textContent = spaceShort; | ||
} else { | ||
if (spaceElement) { | ||
spaceElement.textContent = spaceDropdownValue; | ||
} | ||
if (regionElement) { | ||
regionElement.textContent = regionDropdownValue; | ||
} | ||
if (menuElement) { | ||
menuElement.style.width = `${this.element.getBoundingClientRect().width}px`; | ||
} | ||
} else { | ||
if (nameElement) { | ||
if (nameDropdownValue.length > 25) { | ||
nameShort = `${nameDropdownValue.substr(0, 25)}...`; | ||
nameElement.textContent = nameShort; | ||
} else { | ||
nameElement.textContent = nameDropdownValue; | ||
} | ||
} | ||
regionElement.textContent = regionDropdownValue; | ||
menuElement.style.width = `${this.element.getBoundingClientRect().width}px`; | ||
if (orgElement) { | ||
if (orgDropdownValue.length > 25) { | ||
orgShort = `${orgDropdownValue.slice(0, 12)}...${orgDropdownValue.slice(-13)}`; | ||
orgElement.textContent = orgShort; | ||
} else { | ||
orgElement.textContent = orgDropdownValue; | ||
} | ||
} | ||
if (spaceElement) { | ||
if (spaceDropdownValue.length > 25) { | ||
spaceShort = `${spaceDropdownValue.substr(0, 25)}...`; | ||
spaceElement.textContent = spaceShort; | ||
} else { | ||
spaceElement.textContent = spaceDropdownValue; | ||
} | ||
} | ||
if (regionElement) { | ||
regionElement.textContent = regionDropdownValue; | ||
} | ||
if (menuElement) { | ||
menuElement.style.width = `${this.element.getBoundingClientRect().width}px`; | ||
} | ||
} | ||
@@ -214,0 +235,0 @@ } |
@@ -111,6 +111,8 @@ (function (global, factory) { | ||
var feedback = this.element.querySelector(this.options.feedbackTooltip); | ||
feedback.classList.add(this.options.classShowFeedback); | ||
setTimeout(function () { | ||
feedback.classList.remove(_this2.options.classShowFeedback); | ||
}, this.options.timeoutValue); | ||
if (feedback) { | ||
feedback.classList.add(this.options.classShowFeedback); | ||
setTimeout(function () { | ||
feedback.classList.remove(_this2.options.classShowFeedback); | ||
}, this.options.timeoutValue); | ||
} | ||
} | ||
@@ -117,0 +119,0 @@ }]); |
@@ -127,2 +127,6 @@ (function (global, factory) { | ||
if (!_this.tableBody) { | ||
throw new Error('Cannot find the table body.'); | ||
} | ||
_this._zebraStripe(); | ||
@@ -129,0 +133,0 @@ _this._initExpandableRows(); |
@@ -120,5 +120,13 @@ (function (global, factory) { | ||
_this.input = _this.element.querySelector(_this.options.selectorInput); | ||
_this.inputId = _this.input.getAttribute('id'); | ||
_this.container = _this.element.querySelector(_this.options.selectorContainer); | ||
if (!_this.input) { | ||
throw new Error('Cannot find the file input box.'); | ||
} | ||
if (!_this.container) { | ||
throw new Error('Cannot find the file names container.'); | ||
} | ||
_this.inputId = _this.input.getAttribute('id'); | ||
_this.input.addEventListener('change', function () { | ||
@@ -125,0 +133,0 @@ return _this._displayFilenames(); |
@@ -104,8 +104,10 @@ (function (global, factory) { | ||
_this.button = element.querySelector(_this.options.selectorButton) || false; | ||
_this.button.addEventListener('click', function (evt) { | ||
if (evt.currentTarget === _this.button) { | ||
_this.remove(); | ||
} | ||
}); | ||
_this.button = element.querySelector(_this.options.selectorButton); | ||
if (_this.button) { | ||
_this.button.addEventListener('click', function (evt) { | ||
if (evt.currentTarget === _this.button) { | ||
_this.remove(); | ||
} | ||
}); | ||
} | ||
return _this; | ||
@@ -112,0 +114,0 @@ } |
@@ -124,2 +124,5 @@ (function (global, factory) { | ||
var input = _this.element.querySelector(_this.options.selectorSearchInput); | ||
if (!input) { | ||
throw new Error('Cannot find the search input.'); | ||
} | ||
@@ -126,0 +129,0 @@ if (closeIcon) { |
@@ -226,3 +226,6 @@ (function (global, factory) { | ||
value: function _updateMenuState() { | ||
this.element.querySelector(this.options.selectorMenu).classList.toggle(this.options.classHidden); | ||
var menu = this.element.querySelector(this.options.selectorMenu); | ||
if (menu) { | ||
menu.classList.toggle(this.options.classHidden); | ||
} | ||
} | ||
@@ -232,3 +235,6 @@ }, { | ||
value: function _updateTriggerText(target) { | ||
this.element.querySelector(this.options.selectorTriggerText).textContent = target.textContent; | ||
var triggerText = this.element.querySelector(this.options.selectorTriggerText); | ||
if (triggerText) { | ||
triggerText.textContent = target.textContent; | ||
} | ||
} | ||
@@ -235,0 +241,0 @@ }]); |
@@ -140,9 +140,10 @@ (function (global, factory) { | ||
var rowHeightBtns = _this.element.querySelector(_this.options.selectorRowHeight); | ||
rowHeightBtns.addEventListener('click', function (event) { | ||
_this._handleRowHeightChange(event, boundTable); | ||
}); | ||
// [...this.element.querySelectorAll(this.options.selectorRowHeight)].forEach((item) => { | ||
// item.addEventListener('click', (event) => { this._handleRowHeightChange(event, boundTable); }); | ||
// }); | ||
if (rowHeightBtns) { | ||
rowHeightBtns.addEventListener('click', function (event) { | ||
_this._handleRowHeightChange(event, boundTable); | ||
}); | ||
// [...this.element.querySelectorAll(this.options.selectorRowHeight)].forEach((item) => { | ||
// item.addEventListener('click', (event) => { this._handleRowHeightChange(event, boundTable); }); | ||
// }); | ||
} | ||
} | ||
@@ -172,15 +173,18 @@ | ||
var searchInput = (0, _eventMatches2.default)(event, this.options.selectorSearch); | ||
var isOfSelf = this.element.querySelector(this.options.selectorSearch).contains(event.target); | ||
var isOfToolbar = this.element.contains(event.target); | ||
var shouldBeOpen = isOfSelf && !this.element.classList.contains(this.options.classSearchActive); | ||
var isOfSelfSearchInput = searchInput && this.element.contains(searchInput); | ||
if (searchInput && shouldBeOpen) { | ||
searchInput.classList.add(this.options.classSearchActive); | ||
searchInput.querySelector('input').focus(); | ||
if (isOfSelfSearchInput) { | ||
var shouldBeOpen = isOfSelfSearchInput && !this.element.classList.contains(this.options.classSearchActive); | ||
searchInput.classList.toggle(this.options.classSearchActive, shouldBeOpen); | ||
if (shouldBeOpen) { | ||
searchInput.querySelector('input').focus(); | ||
} | ||
} | ||
if (!searchInput && !isOfToolbar) { | ||
[].concat(_toConsumableArray(this.element.ownerDocument.querySelectorAll(this.options.selectorSearch))).forEach(function (item) { | ||
var targetComponentElement = (0, _eventMatches2.default)(event, this.options.selectorInit); | ||
[].concat(_toConsumableArray(this.element.ownerDocument.querySelectorAll(this.options.selectorSearch))).forEach(function (item) { | ||
if (!targetComponentElement || !targetComponentElement.contains(item)) { | ||
item.classList.remove(_this2.options.classSearchActive); | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
@@ -187,0 +191,0 @@ }, { |
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['exports', '../../globals/js/misc/mixin', '../../globals/js/mixins/create-component', '../../globals/js/mixins/init-component-by-search', '../../globals/js/misc/on'], factory); | ||
define(['exports', '../../globals/js/misc/mixin', '../../globals/js/mixins/create-component', '../../globals/js/mixins/init-component-by-search', '../../globals/js/misc/event-matches', '../../globals/js/misc/on'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports, require('../../globals/js/misc/mixin'), require('../../globals/js/mixins/create-component'), require('../../globals/js/mixins/init-component-by-search'), require('../../globals/js/misc/on')); | ||
factory(exports, require('../../globals/js/misc/mixin'), require('../../globals/js/mixins/create-component'), require('../../globals/js/mixins/init-component-by-search'), require('../../globals/js/misc/event-matches'), require('../../globals/js/misc/on')); | ||
} else { | ||
@@ -10,6 +10,6 @@ var mod = { | ||
}; | ||
factory(mod.exports, global.mixin, global.createComponent, global.initComponentBySearch, global.on); | ||
factory(mod.exports, global.mixin, global.createComponent, global.initComponentBySearch, global.eventMatches, global.on); | ||
global.profileSwitcher = mod.exports; | ||
} | ||
})(this, function (exports, _mixin2, _createComponent, _initComponentBySearch, _on) { | ||
})(this, function (exports, _mixin2, _createComponent, _initComponentBySearch, _eventMatches, _on) { | ||
'use strict'; | ||
@@ -27,2 +27,4 @@ | ||
var _eventMatches2 = _interopRequireDefault(_eventMatches); | ||
var _on2 = _interopRequireDefault(_on); | ||
@@ -143,27 +145,26 @@ | ||
if (event.target.querySelector(_this.options.selectorAccountDropdown) !== null) { | ||
if (event.detail.item.querySelector(_this.options.classLinkedIcon) !== null) { | ||
_this.element.linkedAccount = event.detail.item.querySelector(_this.options.selectorAccountSlLinked).cloneNode(true); | ||
_this.element.isLinked = true; | ||
_this.element.linkedIcon = event.detail.item.querySelector(_this.options.classLinkedIcon).cloneNode(true); | ||
} else { | ||
_this.element.linkedAccount = ''; | ||
_this.element.isLinked = false; | ||
_this.element.linkedIcon = ''; | ||
} | ||
var linkedIconNode = event.detail.item.querySelector(_this.options.classLinkedIcon); | ||
_this.element.isLinked = !!linkedIconNode; | ||
_this.element.linkedIcon = linkedIconNode && linkedIconNode.cloneNode(true); | ||
var linkedAccountNode = event.detail.item.querySelector(_this.options.selectorAccountSlLinked); | ||
_this.element.linkedAccount = linkedAccountNode && linkedAccountNode.cloneNode(true); | ||
} | ||
}); | ||
_this.element.querySelector(_this.options.selectorToggle).addEventListener('keydown', function (event) { | ||
_this.toggle(event); | ||
}); | ||
var toggleNode = _this.element.querySelector(_this.options.selectorToggle); | ||
if (toggleNode) { | ||
toggleNode.addEventListener('keydown', function (event) { | ||
_this.toggle(event); | ||
}); | ||
_this.element.querySelector(_this.options.selectorToggle).addEventListener('mouseenter', function (event) { | ||
_this.getLinkedData(event); | ||
_this.determineSwitcherValues(true); | ||
}); | ||
toggleNode.addEventListener('mouseenter', function (event) { | ||
_this.getLinkedData(event); | ||
_this.determineSwitcherValues(true); | ||
}); | ||
_this.element.querySelector(_this.options.selectorToggle).addEventListener('mouseleave', function (event) { | ||
_this.getLinkedData(event); | ||
_this.determineSwitcherValues(false); | ||
}); | ||
toggleNode.addEventListener('mouseleave', function (event) { | ||
_this.getLinkedData(event); | ||
_this.determineSwitcherValues(false); | ||
}); | ||
} | ||
@@ -217,3 +218,3 @@ _this.element.ownerDocument.addEventListener('keyup', function () { | ||
var isOfSelf = this.element.contains(clickTarget); | ||
var isToggle = this.element.ownerDocument.querySelector(this.options.selectorToggle).contains(clickTarget); | ||
var isToggle = (0, _eventMatches2.default)(evt, this.options.selectorToggle); | ||
var isOpen = this.element.classList.contains(this.options.classSwitcherOpen); | ||
@@ -290,31 +291,52 @@ | ||
if (isHovered && !isOpen) { | ||
nameElement.textContent = nameDropdownValue; | ||
orgElement.textContent = orgDropdownValue; | ||
spaceElement.textContent = spaceDropdownValue; | ||
regionElement.textContent = regionDropdownValue; | ||
menuElement.style.width = this.element.getBoundingClientRect().width + 'px'; | ||
} else { | ||
if (nameDropdownValue.length > 25) { | ||
nameShort = nameDropdownValue.substr(0, 25) + '...'; | ||
nameElement.textContent = nameShort; | ||
} else { | ||
if (nameElement) { | ||
nameElement.textContent = nameDropdownValue; | ||
} | ||
if (orgDropdownValue.length > 25) { | ||
orgShort = orgDropdownValue.slice(0, 12) + '...' + orgDropdownValue.slice(-13); | ||
orgElement.textContent = orgShort; | ||
} else { | ||
if (orgElement) { | ||
orgElement.textContent = orgDropdownValue; | ||
} | ||
if (spaceDropdownValue.length > 25) { | ||
spaceShort = spaceDropdownValue.substr(0, 25) + '...'; | ||
spaceElement.textContent = spaceShort; | ||
} else { | ||
if (spaceElement) { | ||
spaceElement.textContent = spaceDropdownValue; | ||
} | ||
if (regionElement) { | ||
regionElement.textContent = regionDropdownValue; | ||
} | ||
if (menuElement) { | ||
menuElement.style.width = this.element.getBoundingClientRect().width + 'px'; | ||
} | ||
} else { | ||
if (nameElement) { | ||
if (nameDropdownValue.length > 25) { | ||
nameShort = nameDropdownValue.substr(0, 25) + '...'; | ||
nameElement.textContent = nameShort; | ||
} else { | ||
nameElement.textContent = nameDropdownValue; | ||
} | ||
} | ||
regionElement.textContent = regionDropdownValue; | ||
menuElement.style.width = this.element.getBoundingClientRect().width + 'px'; | ||
if (orgElement) { | ||
if (orgDropdownValue.length > 25) { | ||
orgShort = orgDropdownValue.slice(0, 12) + '...' + orgDropdownValue.slice(-13); | ||
orgElement.textContent = orgShort; | ||
} else { | ||
orgElement.textContent = orgDropdownValue; | ||
} | ||
} | ||
if (spaceElement) { | ||
if (spaceDropdownValue.length > 25) { | ||
spaceShort = spaceDropdownValue.substr(0, 25) + '...'; | ||
spaceElement.textContent = spaceShort; | ||
} else { | ||
spaceElement.textContent = spaceDropdownValue; | ||
} | ||
} | ||
if (regionElement) { | ||
regionElement.textContent = regionDropdownValue; | ||
} | ||
if (menuElement) { | ||
menuElement.style.width = this.element.getBoundingClientRect().width + 'px'; | ||
} | ||
} | ||
@@ -321,0 +343,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
2965104
27050