UNPKG

primevue

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primevue.svg)](https://badge.fury.io/js/primevue) [![Discord Chat](https://img.shields.io/discord/55794023

1,399 lines (1,130 loc) 572 kB
this.primevue = this.primevue || {}; this.primevue.utils = (function (exports) { 'use strict'; var DomHandler = { innerWidth(el) { if (el) { let width = el.offsetWidth; let style = getComputedStyle(el); width += parseFloat(style.paddingLeft) + parseFloat(style.paddingRight); return width; } return 0; }, width(el) { if (el) { let width = el.offsetWidth; let style = getComputedStyle(el); width -= parseFloat(style.paddingLeft) + parseFloat(style.paddingRight); return width; } return 0; }, getWindowScrollTop() { let doc = document.documentElement; return (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); }, getWindowScrollLeft() { let doc = document.documentElement; return (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0); }, getOuterWidth(el, margin) { if (el) { let width = el.offsetWidth; if (margin) { let style = getComputedStyle(el); width += parseFloat(style.marginLeft) + parseFloat(style.marginRight); } return width; } return 0; }, getOuterHeight(el, margin) { if (el) { let height = el.offsetHeight; if (margin) { let style = getComputedStyle(el); height += parseFloat(style.marginTop) + parseFloat(style.marginBottom); } return height; } return 0; }, getClientHeight(el, margin) { if (el) { let height = el.clientHeight; if (margin) { let style = getComputedStyle(el); height += parseFloat(style.marginTop) + parseFloat(style.marginBottom); } return height; } return 0; }, getViewport() { let win = window, d = document, e = d.documentElement, g = d.getElementsByTagName('body')[0], w = win.innerWidth || e.clientWidth || g.clientWidth, h = win.innerHeight || e.clientHeight || g.clientHeight; return { width: w, height: h }; }, getOffset(el) { if (el) { let rect = el.getBoundingClientRect(); return { top: rect.top + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0), left: rect.left + (window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0) }; } return { top: 'auto', left: 'auto' }; }, index(element) { if (element) { let children = element.parentNode.childNodes; let num = 0; for (let i = 0; i < children.length; i++) { if (children[i] === element) return num; if (children[i].nodeType === 1) num++; } } return -1; }, addMultipleClasses(element, className) { if (element && className) { if (element.classList) { let styles = className.split(' '); for (let i = 0; i < styles.length; i++) { element.classList.add(styles[i]); } } else { let styles = className.split(' '); for (let i = 0; i < styles.length; i++) { element.className += ' ' + styles[i]; } } } }, addClass(element, className) { if (element && className) { if (element.classList) element.classList.add(className); else element.className += ' ' + className; } }, removeClass(element, className) { if (element && className) { if (element.classList) element.classList.remove(className); else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' '); } }, hasClass(element, className) { if (element) { if (element.classList) return element.classList.contains(className); else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className); } return false; }, find(element, selector) { return this.isElement(element) ? element.querySelectorAll(selector) : []; }, findSingle(element, selector) { return this.isElement(element) ? element.querySelector(selector) : null; }, getHeight(el) { if (el) { let height = el.offsetHeight; let style = getComputedStyle(el); height -= parseFloat(style.paddingTop) + parseFloat(style.paddingBottom) + parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); return height; } return 0; }, getWidth(el) { if (el) { let width = el.offsetWidth; let style = getComputedStyle(el); width -= parseFloat(style.paddingLeft) + parseFloat(style.paddingRight) + parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth); return width; } return 0; }, absolutePosition(element, target) { if (element) { let elementDimensions = element.offsetParent ? { width: element.offsetWidth, height: element.offsetHeight } : this.getHiddenElementDimensions(element); let elementOuterHeight = elementDimensions.height; let elementOuterWidth = elementDimensions.width; let targetOuterHeight = target.offsetHeight; let targetOuterWidth = target.offsetWidth; let targetOffset = target.getBoundingClientRect(); let windowScrollTop = this.getWindowScrollTop(); let windowScrollLeft = this.getWindowScrollLeft(); let viewport = this.getViewport(); let top, left; if (targetOffset.top + targetOuterHeight + elementOuterHeight > viewport.height) { top = targetOffset.top + windowScrollTop - elementOuterHeight; element.style.transformOrigin = 'bottom'; if (top < 0) { top = windowScrollTop; } } else { top = targetOuterHeight + targetOffset.top + windowScrollTop; element.style.transformOrigin = 'top'; } if (targetOffset.left + elementOuterWidth > viewport.width) left = Math.max(0, targetOffset.left + windowScrollLeft + targetOuterWidth - elementOuterWidth); else left = targetOffset.left + windowScrollLeft; element.style.top = top + 'px'; element.style.left = left + 'px'; } }, relativePosition(element, target) { if (element) { let elementDimensions = element.offsetParent ? { width: element.offsetWidth, height: element.offsetHeight } : this.getHiddenElementDimensions(element); const targetHeight = target.offsetHeight; const targetOffset = target.getBoundingClientRect(); const viewport = this.getViewport(); let top, left; if (targetOffset.top + targetHeight + elementDimensions.height > viewport.height) { top = -1 * elementDimensions.height; element.style.transformOrigin = 'bottom'; if (targetOffset.top + top < 0) { top = -1 * targetOffset.top; } } else { top = targetHeight; element.style.transformOrigin = 'top'; } if (elementDimensions.width > viewport.width) { // element wider then viewport and cannot fit on screen (align at left side of viewport) left = targetOffset.left * -1; } else if (targetOffset.left + elementDimensions.width > viewport.width) { // element wider then viewport but can be fit on screen (align at right side of viewport) left = (targetOffset.left + elementDimensions.width - viewport.width) * -1; } else { // element fits on screen (align with target) left = 0; } element.style.top = top + 'px'; element.style.left = left + 'px'; } }, getParents(element, parents = []) { return element['parentNode'] === null ? parents : this.getParents(element.parentNode, parents.concat([element.parentNode])); }, getScrollableParents(element) { let scrollableParents = []; if (element) { let parents = this.getParents(element); const overflowRegex = /(auto|scroll)/; const overflowCheck = (node) => { let styleDeclaration = window['getComputedStyle'](node, null); return overflowRegex.test(styleDeclaration.getPropertyValue('overflow')) || overflowRegex.test(styleDeclaration.getPropertyValue('overflowX')) || overflowRegex.test(styleDeclaration.getPropertyValue('overflowY')); }; for (let parent of parents) { let scrollSelectors = parent.nodeType === 1 && parent.dataset['scrollselectors']; if (scrollSelectors) { let selectors = scrollSelectors.split(','); for (let selector of selectors) { let el = this.findSingle(parent, selector); if (el && overflowCheck(el)) { scrollableParents.push(el); } } } if (parent.nodeType !== 9 && overflowCheck(parent)) { scrollableParents.push(parent); } } } return scrollableParents; }, getHiddenElementOuterHeight(element) { if (element) { element.style.visibility = 'hidden'; element.style.display = 'block'; let elementHeight = element.offsetHeight; element.style.display = 'none'; element.style.visibility = 'visible'; return elementHeight; } return 0; }, getHiddenElementOuterWidth(element) { if (element) { element.style.visibility = 'hidden'; element.style.display = 'block'; let elementWidth = element.offsetWidth; element.style.display = 'none'; element.style.visibility = 'visible'; return elementWidth; } return 0; }, getHiddenElementDimensions(element) { if (element) { let dimensions = {}; element.style.visibility = 'hidden'; element.style.display = 'block'; dimensions.width = element.offsetWidth; dimensions.height = element.offsetHeight; element.style.display = 'none'; element.style.visibility = 'visible'; return dimensions; } return 0; }, fadeIn(element, duration) { if (element) { element.style.opacity = 0; let last = +new Date(); let opacity = 0; let tick = function () { opacity = +element.style.opacity + (new Date().getTime() - last) / duration; element.style.opacity = opacity; last = +new Date(); if (+opacity < 1) { (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16); } }; tick(); } }, fadeOut(element, ms) { if (element) { let opacity = 1, interval = 50, duration = ms, gap = interval / duration; let fading = setInterval(() => { opacity -= gap; if (opacity <= 0) { opacity = 0; clearInterval(fading); } element.style.opacity = opacity; }, interval); } }, getUserAgent() { return navigator.userAgent; }, appendChild(element, target) { if (this.isElement(target)) target.appendChild(element); else if (target.el && target.elElement) target.elElement.appendChild(element); else throw new Error('Cannot append ' + target + ' to ' + element); }, isElement(obj) { return typeof HTMLElement === 'object' ? obj instanceof HTMLElement : obj && typeof obj === 'object' && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === 'string'; }, scrollInView(container, item) { let borderTopValue = getComputedStyle(container).getPropertyValue('borderTopWidth'); let borderTop = borderTopValue ? parseFloat(borderTopValue) : 0; let paddingTopValue = getComputedStyle(container).getPropertyValue('paddingTop'); let paddingTop = paddingTopValue ? parseFloat(paddingTopValue) : 0; let containerRect = container.getBoundingClientRect(); let itemRect = item.getBoundingClientRect(); let offset = itemRect.top + document.body.scrollTop - (containerRect.top + document.body.scrollTop) - borderTop - paddingTop; let scroll = container.scrollTop; let elementHeight = container.clientHeight; let itemHeight = this.getOuterHeight(item); if (offset < 0) { container.scrollTop = scroll + offset; } else if (offset + itemHeight > elementHeight) { container.scrollTop = scroll + offset - elementHeight + itemHeight; } }, clearSelection() { if (window.getSelection) { if (window.getSelection().empty) { window.getSelection().empty(); } else if (window.getSelection().removeAllRanges && window.getSelection().rangeCount > 0 && window.getSelection().getRangeAt(0).getClientRects().length > 0) { window.getSelection().removeAllRanges(); } } else if (document['selection'] && document['selection'].empty) { try { document['selection'].empty(); } catch (error) { //ignore IE bug } } }, getSelection() { if (window.getSelection) return window.getSelection().toString(); else if (document.getSelection) return document.getSelection().toString(); else if (document['selection']) return document['selection'].createRange().text; return null; }, calculateScrollbarWidth() { if (this.calculatedScrollbarWidth != null) return this.calculatedScrollbarWidth; let scrollDiv = document.createElement('div'); scrollDiv.className = 'p-scrollbar-measure'; document.body.appendChild(scrollDiv); let scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; document.body.removeChild(scrollDiv); this.calculatedScrollbarWidth = scrollbarWidth; return scrollbarWidth; }, getBrowser() { if (!this.browser) { let matched = this.resolveUserAgent(); this.browser = {}; if (matched.browser) { this.browser[matched.browser] = true; this.browser['version'] = matched.version; } if (this.browser['chrome']) { this.browser['webkit'] = true; } else if (this.browser['webkit']) { this.browser['safari'] = true; } } return this.browser; }, resolveUserAgent() { let ua = navigator.userAgent.toLowerCase(); let match = /(chrome)[ ]([\w.]+)/.exec(ua) || /(webkit)[ ]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ ]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || (ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)) || []; return { browser: match[1] || '', version: match[2] || '0' }; }, isVisible(element) { return element && element.offsetParent != null; }, invokeElementMethod(element, methodName, args) { element[methodName].apply(element, args); }, isExist(element) { return !!(element !== null && typeof element !== 'undefined' && element.nodeName && element.parentNode); }, isClient() { return !!(typeof window !== 'undefined' && window.document && window.document.createElement); }, focus(el, options) { el && document.activeElement !== el && el.focus(options); }, isFocusableElement(element, selector = '') { return this.isElement(element) ? element.matches(`button:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}, [href][clientHeight][clientWidth]:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}, input:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}, select:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}, textarea:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}, [tabIndex]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}, [contenteditable]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}`) : false; }, getFocusableElements(element, selector = '') { let focusableElements = this.find( element, `button:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}, [href][clientHeight][clientWidth]:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}, input:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}, select:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}, textarea:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}, [tabIndex]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}, [contenteditable]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}` ); let visibleFocusableElements = []; for (let focusableElement of focusableElements) { if (getComputedStyle(focusableElement).display != 'none' && getComputedStyle(focusableElement).visibility != 'hidden') visibleFocusableElements.push(focusableElement); } return visibleFocusableElements; }, getFirstFocusableElement(element, selector) { const focusableElements = this.getFocusableElements(element, selector); return focusableElements.length > 0 ? focusableElements[0] : null; }, getLastFocusableElement(element, selector) { const focusableElements = this.getFocusableElements(element, selector); return focusableElements.length > 0 ? focusableElements[focusableElements.length - 1] : null; }, getNextFocusableElement(container, element, selector) { const focusableElements = this.getFocusableElements(container, selector); const index = focusableElements.length > 0 ? focusableElements.findIndex((el) => el === element) : -1; const nextIndex = index > -1 && focusableElements.length >= index + 1 ? index + 1 : -1; return nextIndex > -1 ? focusableElements[nextIndex] : null; }, isClickable(element) { if (element) { const targetNode = element.nodeName; const parentNode = element.parentElement && element.parentElement.nodeName; return ( targetNode === 'INPUT' || targetNode === 'TEXTAREA' || targetNode === 'BUTTON' || targetNode === 'A' || parentNode === 'INPUT' || parentNode === 'TEXTAREA' || parentNode === 'BUTTON' || parentNode === 'A' || !!element.closest('.p-button, .p-checkbox, .p-radiobutton') ); } return false; }, applyStyle(element, style) { if (typeof style === 'string') { element.style.cssText = style; } else { for (let prop in style) { element.style[prop] = style[prop]; } } }, isIOS() { return /iPad|iPhone|iPod/.test(navigator.userAgent) && !window['MSStream']; }, isAndroid() { return /(android)/i.test(navigator.userAgent); }, isTouchDevice() { return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0; }, exportCSV(csv, filename) { let blob = new Blob([csv], { type: 'application/csv;charset=utf-8;' }); if (window.navigator.msSaveOrOpenBlob) { navigator.msSaveOrOpenBlob(blob, filename + '.csv'); } else { let link = document.createElement('a'); if (link.download !== undefined) { link.setAttribute('href', URL.createObjectURL(blob)); link.setAttribute('download', filename + '.csv'); link.style.display = 'none'; document.body.appendChild(link); link.click(); document.body.removeChild(link); } else { csv = 'data:text/csv;charset=utf-8,' + csv; window.open(encodeURI(csv)); } } } }; class ConnectedOverlayScrollHandler { constructor(element, listener = () => {}) { this.element = element; this.listener = listener; } bindScrollListener() { this.scrollableParents = DomHandler.getScrollableParents(this.element); for (let i = 0; i < this.scrollableParents.length; i++) { this.scrollableParents[i].addEventListener('scroll', this.listener); } } unbindScrollListener() { if (this.scrollableParents) { for (let i = 0; i < this.scrollableParents.length; i++) { this.scrollableParents[i].removeEventListener('scroll', this.listener); } } } destroy() { this.unbindScrollListener(); this.element = null; this.listener = null; this.scrollableParents = null; } } function primebus() { const allHandlers = new Map(); return { on(type, handler) { let handlers = allHandlers.get(type); if (!handlers) handlers = [handler]; else handlers.push(handler); allHandlers.set(type, handlers); }, off(type, handler) { let handlers = allHandlers.get(type); if (handlers) { handlers.splice(handlers.indexOf(handler) >>> 0, 1); } }, emit(type, evt) { let handlers = allHandlers.get(type); if (handlers) { handlers.slice().map((handler) => { handler(evt); }); } } }; } var ObjectUtils = { equals(obj1, obj2, field) { if (field) return this.resolveFieldData(obj1, field) === this.resolveFieldData(obj2, field); else return this.deepEquals(obj1, obj2); }, deepEquals(a, b) { if (a === b) return true; if (a && b && typeof a == 'object' && typeof b == 'object') { var arrA = Array.isArray(a), arrB = Array.isArray(b), i, length, key; if (arrA && arrB) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0; ) if (!this.deepEquals(a[i], b[i])) return false; return true; } if (arrA != arrB) return false; var dateA = a instanceof Date, dateB = b instanceof Date; if (dateA != dateB) return false; if (dateA && dateB) return a.getTime() == b.getTime(); var regexpA = a instanceof RegExp, regexpB = b instanceof RegExp; if (regexpA != regexpB) return false; if (regexpA && regexpB) return a.toString() == b.toString(); var keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; for (i = length; i-- !== 0; ) { key = keys[i]; if (!this.deepEquals(a[key], b[key])) return false; } return true; } return a !== a && b !== b; }, resolveFieldData(data, field) { if (data && Object.keys(data).length && field) { if (this.isFunction(field)) { return field(data); } else if (field.indexOf('.') === -1) { return data[field]; } else { let fields = field.split('.'); let value = data; for (var i = 0, len = fields.length; i < len; ++i) { if (value == null) { return null; } value = value[fields[i]]; } return value; } } else { return null; } }, isFunction(obj) { return !!(obj && obj.constructor && obj.call && obj.apply); }, getItemValue(obj, ...params) { return this.isFunction(obj) ? obj(...params) : obj; }, filter(value, fields, filterValue) { var filteredItems = []; if (value) { for (let item of value) { for (let field of fields) { if (String(this.resolveFieldData(item, field)).toLowerCase().indexOf(filterValue.toLowerCase()) > -1) { filteredItems.push(item); break; } } } } return filteredItems; }, reorderArray(value, from, to) { if (value && from !== to) { if (to >= value.length) { to %= value.length; from %= value.length; } value.splice(to, 0, value.splice(from, 1)[0]); } }, findIndexInList(value, list) { let index = -1; if (list) { for (let i = 0; i < list.length; i++) { if (list[i] === value) { index = i; break; } } } return index; }, contains(value, list) { if (value != null && list && list.length) { for (let val of list) { if (this.equals(value, val)) return true; } } return false; }, insertIntoOrderedArray(item, index, arr, sourceArr) { if (arr.length > 0) { let injected = false; for (let i = 0; i < arr.length; i++) { let currentItemIndex = this.findIndexInList(arr[i], sourceArr); if (currentItemIndex > index) { arr.splice(i, 0, item); injected = true; break; } } if (!injected) { arr.push(item); } } else { arr.push(item); } }, removeAccents(str) { if (str && str.search(/[\xC0-\xFF]/g) > -1) { str = str .replace(/[\xC0-\xC5]/g, 'A') .replace(/[\xC6]/g, 'AE') .replace(/[\xC7]/g, 'C') .replace(/[\xC8-\xCB]/g, 'E') .replace(/[\xCC-\xCF]/g, 'I') .replace(/[\xD0]/g, 'D') .replace(/[\xD1]/g, 'N') .replace(/[\xD2-\xD6\xD8]/g, 'O') .replace(/[\xD9-\xDC]/g, 'U') .replace(/[\xDD]/g, 'Y') .replace(/[\xDE]/g, 'P') .replace(/[\xE0-\xE5]/g, 'a') .replace(/[\xE6]/g, 'ae') .replace(/[\xE7]/g, 'c') .replace(/[\xE8-\xEB]/g, 'e') .replace(/[\xEC-\xEF]/g, 'i') .replace(/[\xF1]/g, 'n') .replace(/[\xF2-\xF6\xF8]/g, 'o') .replace(/[\xF9-\xFC]/g, 'u') .replace(/[\xFE]/g, 'p') .replace(/[\xFD\xFF]/g, 'y'); } return str; }, getVNodeProp(vnode, prop) { let props = vnode.props; if (props) { let kebapProp = prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); let propName = Object.prototype.hasOwnProperty.call(props, kebapProp) ? kebapProp : prop; return vnode.type.props[prop].type === Boolean && props[propName] === '' ? true : props[propName]; } return null; }, convertToFlatCase(str) { // convert snake, kebab, camel and pascal cases to flat case return this.isNotEmpty(str) ? str.replace(/(-|_)/g, '').toLowerCase() : str; }, isEmpty(value) { return value === null || value === undefined || value === '' || (Array.isArray(value) && value.length === 0) || (!(value instanceof Date) && typeof value === 'object' && Object.keys(value).length === 0); }, isNotEmpty(value) { return !this.isEmpty(value); }, isPrintableCharacter(char = '') { return this.isNotEmpty(char) && char.length === 1 && char.match(/\S| /); }, /** * Firefox-v103 does not currently support the "findLast" method. It is stated that this method will be supported with Firefox-v104. * https://caniuse.com/mdn-javascript_builtins_array_findlast */ findLast(arr, callback) { let item; if (this.isNotEmpty(arr)) { try { item = arr.findLast(callback); } catch { item = [...arr].reverse().find(callback); } } return item; }, /** * Firefox-v103 does not currently support the "findLastIndex" method. It is stated that this method will be supported with Firefox-v104. * https://caniuse.com/mdn-javascript_builtins_array_findlastindex */ findLastIndex(arr, callback) { let index = -1; if (this.isNotEmpty(arr)) { try { index = arr.findLastIndex(callback); } catch { index = arr.lastIndexOf([...arr].reverse().find(callback)); } } return index; } }; var lastId = 0; function UniqueComponentId (prefix = 'pv_id_') { lastId++; return `${prefix}${lastId}`; } function handler() { let zIndexes = []; const generateZIndex = (key, autoZIndex, baseZIndex = 999) => { const lastZIndex = getLastZIndex(key, autoZIndex, baseZIndex); const newZIndex = lastZIndex.value + (lastZIndex.key === key ? 0 : baseZIndex) + 1; zIndexes.push({ key, value: newZIndex }); return newZIndex; }; const revertZIndex = (zIndex) => { zIndexes = zIndexes.filter((obj) => obj.value !== zIndex); }; const getCurrentZIndex = (key, autoZIndex) => { return getLastZIndex(key, autoZIndex).value; }; const getLastZIndex = (key, autoZIndex, baseZIndex = 0) => { return [...zIndexes].reverse().find((obj) => (autoZIndex ? true : obj.key === key)) || { key, value: baseZIndex }; }; const getZIndex = (el) => { return el ? parseInt(el.style.zIndex, 10) || 0 : 0; }; return { get: getZIndex, set: (key, el, baseZIndex) => { if (el) { el.style.zIndex = String(generateZIndex(key, true, baseZIndex)); } }, clear: (el) => { if (el) { revertZIndex(getZIndex(el)); el.style.zIndex = ''; } }, getCurrent: (key) => getCurrentZIndex(key, true) }; } var ZIndexUtils = handler(); exports.ConnectedOverlayScrollHandler = ConnectedOverlayScrollHandler; exports.DomHandler = DomHandler; exports.EventBus = primebus; exports.ObjectUtils = ObjectUtils; exports.UniqueComponentId = UniqueComponentId; exports.ZIndexUtils = ZIndexUtils; Object.defineProperty(exports, '__esModule', { value: true }); return exports; })({}); this.primevue = this.primevue || {}; this.primevue.api = (function (exports, utils) { 'use strict'; const FilterMatchMode = { STARTS_WITH: 'startsWith', CONTAINS: 'contains', NOT_CONTAINS: 'notContains', ENDS_WITH: 'endsWith', EQUALS: 'equals', NOT_EQUALS: 'notEquals', IN: 'in', LESS_THAN: 'lt', LESS_THAN_OR_EQUAL_TO: 'lte', GREATER_THAN: 'gt', GREATER_THAN_OR_EQUAL_TO: 'gte', BETWEEN: 'between', DATE_IS: 'dateIs', DATE_IS_NOT: 'dateIsNot', DATE_BEFORE: 'dateBefore', DATE_AFTER: 'dateAfter' }; const FilterOperator = { AND: 'and', OR: 'or' }; const FilterService = { filter(value, fields, filterValue, filterMatchMode, filterLocale) { let filteredItems = []; if (value) { for (let item of value) { for (let field of fields) { let fieldValue = utils.ObjectUtils.resolveFieldData(item, field); if (this.filters[filterMatchMode](fieldValue, filterValue, filterLocale)) { filteredItems.push(item); break; } } } } return filteredItems; }, filters: { startsWith(value, filter, filterLocale) { if (filter === undefined || filter === null || filter.trim() === '') { return true; } if (value === undefined || value === null) { return false; } let filterValue = utils.ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale); let stringValue = utils.ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale); return stringValue.slice(0, filterValue.length) === filterValue; }, contains(value, filter, filterLocale) { if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) { return true; } if (value === undefined || value === null) { return false; } let filterValue = utils.ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale); let stringValue = utils.ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale); return stringValue.indexOf(filterValue) !== -1; }, notContains(value, filter, filterLocale) { if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) { return true; } if (value === undefined || value === null) { return false; } let filterValue = utils.ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale); let stringValue = utils.ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale); return stringValue.indexOf(filterValue) === -1; }, endsWith(value, filter, filterLocale) { if (filter === undefined || filter === null || filter.trim() === '') { return true; } if (value === undefined || value === null) { return false; } let filterValue = utils.ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale); let stringValue = utils.ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale); return stringValue.indexOf(filterValue, stringValue.length - filterValue.length) !== -1; }, equals(value, filter, filterLocale) { if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) { return true; } if (value === undefined || value === null) { return false; } if (value.getTime && filter.getTime) return value.getTime() === filter.getTime(); else return utils.ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale) == utils.ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale); }, notEquals(value, filter, filterLocale) { if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) { return false; } if (value === undefined || value === null) { return true; } if (value.getTime && filter.getTime) return value.getTime() !== filter.getTime(); else return utils.ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale) != utils.ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale); }, in(value, filter) { if (filter === undefined || filter === null || filter.length === 0) { return true; } for (let i = 0; i < filter.length; i++) { if (utils.ObjectUtils.equals(value, filter[i])) { return true; } } return false; }, between(value, filter) { if (filter == null || filter[0] == null || filter[1] == null) { return true; } if (value === undefined || value === null) { return false; } if (value.getTime) return filter[0].getTime() <= value.getTime() && value.getTime() <= filter[1].getTime(); else return filter[0] <= value && value <= filter[1]; }, lt(value, filter) { if (filter === undefined || filter === null) { return true; } if (value === undefined || value === null) { return false; } if (value.getTime && filter.getTime) return value.getTime() < filter.getTime(); else return value < filter; }, lte(value, filter) { if (filter === undefined || filter === null) { return true; } if (value === undefined || value === null) { return false; } if (value.getTime && filter.getTime) return value.getTime() <= filter.getTime(); else return value <= filter; }, gt(value, filter) { if (filter === undefined || filter === null) { return true; } if (value === undefined || value === null) { return false; } if (value.getTime && filter.getTime) return value.getTime() > filter.getTime(); else return value > filter; }, gte(value, filter) { if (filter === undefined || filter === null) { return true; } if (value === undefined || value === null) { return false; } if (value.getTime && filter.getTime) return value.getTime() >= filter.getTime(); else return value >= filter; }, dateIs(value, filter) { if (filter === undefined || filter === null) { return true; } if (value === undefined || value === null) { return false; } return value.toDateString() === filter.toDateString(); }, dateIsNot(value, filter) { if (filter === undefined || filter === null) { return true; } if (value === undefined || value === null) { return false; } return value.toDateString() !== filter.toDateString(); }, dateBefore(value, filter) { if (filter === undefined || filter === null) { return true; } if (value === undefined || value === null) { return false; } return value.getTime() < filter.getTime(); }, dateAfter(value, filter) { if (filter === undefined || filter === null) { return true; } if (value === undefined || value === null) { return false; } return value.getTime() > filter.getTime(); } }, register(rule, fn) { this.filters[rule] = fn; } }; const PrimeIcons = { ALIGN_CENTER: 'pi pi-align-center', ALIGN_JUSTIFY: 'pi pi-align-justify', ALIGN_LEFT: 'pi pi-align-left', ALIGN_RIGHT: 'pi pi-align-right', AMAZON: 'pi pi-amazon', ANDROID: 'pi pi-android', ANGLE_DOUBLE_DOWN: 'pi pi-angle-double-down', ANGLE_DOUBLE_LEFT: 'pi pi-angle-double-left', ANGLE_DOUBLE_RIGHT: 'pi pi-angle-double-right', ANGLE_DOUBLE_UP: 'pi pi-angle-double-up', ANGLE_DOWN: 'pi pi-angle-down', ANGLE_LEFT: 'pi pi-angle-left', ANGLE_RIGHT: 'pi pi-angle-right', ANGLE_UP: 'pi pi-angle-up', APPLE: 'pi pi-apple', ARROW_CIRCLE_DOWN: 'pi pi-arrow-circle-down', ARROW_CIRCLE_LEFT: 'pi pi-arrow-circle-left', ARROW_CIRCLE_RIGHT: 'pi pi-arrow-circle-right', ARROW_CIRCLE_UP: 'pi pi-arrow-circle-up', ARROW_DOWN: 'pi pi-arrow-down', ARROW_DOWN_LEFT: 'pi pi-arrow-down-left', ARROW_DOWN_RIGHT: 'pi pi-arrow-down-right', ARROW_LEFT: 'pi pi-arrow-left', ARROW_RIGHT: 'pi pi-arrow-right', ARROW_RIGHT_ARROW_LEFT: 'pi pi-arrow-right-arrow-left', ARROW_UP: 'pi pi-arrow-up', ARROW_UP_LEFT: 'pi pi-arrow-up-left', ARROW_UP_RIGHT: 'pi pi-arrow-up-right', ARROW_H: 'pi pi-arrows-h', ARROW_V: 'pi pi-arrows-v', ARROW_A: 'pi pi-arrows-alt', AT: 'pi pi-at', BACKWARD: 'pi pi-backward', BAN: 'pi pi-ban', BARS: 'pi pi-bars', BELL: 'pi pi-bell', BITCOIN: 'pi pi-bitcoin', BOLT: 'pi pi-bolt', BOOK: 'pi pi-book', BOOKMARK: 'pi pi-bookmark', BOOKMARK_FILL: 'pi pi-bookmark-fill', BOX: 'pi pi-box', BRIEFCASE: 'pi pi-briefcase', BUILDING: 'pi pi-building', CALENDAR: 'pi pi-calendar', CALENDAR_MINUS: 'pi pi-calendar-minus', CALENDAR_PLUS: 'pi pi-calendar-plus', CALENDAR_TIMES: 'pi pi-calendar-times', CALCULATOR: 'pi pi-calculator', CAMERA: 'pi pi-camera', CAR: 'pi pi-car', CARET_DOWN: 'pi pi-caret-down', CARET_LEFT: 'pi pi-caret-left', CARET_RIGHT: 'pi pi-caret-right', CARET_UP: 'pi pi-caret-up', CART_PLUS: 'pi pi-cart-plus', CHART_BAR: 'pi pi-chart-bar', CHART_LINE: 'pi pi-chart-line', CHART_PIE: 'pi pi-chart-pie', CHECK: 'pi pi-check', CHECK_CIRCLE: 'pi pi-check-circle', CHECK_SQUARE: 'pi pi-check-square', CHEVRON_CIRCLE_DOWN: 'pi pi-chevron-circle-down', CHEVRON_CIRCLE_LEFT: 'pi pi-chevron-circle-left', CHEVRON_CIRCLE_RIGHT: 'pi pi-chevron-circle-right', CHEVRON_CIRCLE_UP: 'pi pi-chevron-circle-up', CHEVRON_DOWN: 'pi pi-chevron-down', CHEVRON_LEFT: 'pi pi-chevron-left', CHEVRON_RIGHT: 'pi pi-chevron-right', CHEVRON_UP: 'pi pi-chevron-up', CIRCLE: 'pi pi-circle', CIRCLE_FILL: 'pi pi-circle-fill', CLOCK: 'pi pi-clock', CLONE: 'pi pi-clone', CLOUD: 'pi pi-cloud', CLOUD_DOWNLOAD: 'pi pi-cloud-download', CLOUD_UPLOAD: 'pi pi-cloud-upload', CODE: 'pi pi-code', COG: 'pi pi-cog', COMMENT: 'pi pi-comment', COMMENTS: 'pi pi-comments', COMPASS: 'pi pi-compass', COPY: 'pi pi-copy', CREDIT_CARD: 'pi pi-credit-card', DATABASE: 'pi pi-database', DELETELEFT: 'pi pi-delete-left', DESKTOP: 'pi pi-desktop', DIRECTIONS: 'pi pi-directions', DIRECTIONS_ALT: 'pi pi-directions-alt', DISCORD: 'pi pi-discord', DOLLAR: 'pi pi-dollar', DOWNLOAD: 'pi pi-download', EJECT: 'pi pi-eject', ELLIPSIS_H: 'pi pi-ellipsis-h', ELLIPSIS_V: 'pi pi-ellipsis-v', ENVELOPE: 'pi pi-envelope', ERASER: 'pi pi-eraser', EURO: 'pi pi-euro', EXCLAMATION_CIRCLE: 'pi pi-exclamation-circle', EXCLAMATION_TRIANGLE: 'pi pi-exclamation-triangle', EXTERNAL_LINK: 'pi pi-external-link', EYE: 'pi pi-eye', EYE_SLASH: 'pi pi-eye-slash', FACEBOOK: 'pi pi-facebook',