diff --git a/__html__/action-button.html b/__html__/action-button.html index e36d3d12e..30bbcd659 100644 --- a/__html__/action-button.html +++ b/__html__/action-button.html @@ -18,7 +18,7 @@
-
\r\n `)\r\n },\r\n\r\n _createEvents: function () {\r\n const that = this, element = this.element, o = this.options;\r\n element.on(\"click\", \".pm-command button\", function () {\r\n const command = $(this).parent().find(\"code\").text();\r\n Metro.utils.copy2clipboard(command);\r\n });\r\n },\r\n\r\n changeAttribute: function (attr, newValue) {\r\n },\r\n\r\n destroy: function () {\r\n this.element.remove();\r\n }\r\n });\r\n}(Metro, Dom));", "/** @format */\n\n(function (Metro, $) {\n \"use strict\";\n\n let PageControlDefaultConfig = {\n appendButton: true,\n tabsPosition: \"left\",\n customButtons: null,\n activateNewTab: true,\n defaultNewTabTitle: \"New File\",\n defaultNewCanClose: true,\n defaultNewTabIcon: \"\",\n defaultNewTabImage: \"\",\n defaultNewTabPosition: \"before\", // before, after\n appendActions: null,\n tabsActions: null,\n tabActions: null,\n refControl: false,\n onAppendButtonClick: Metro.noop,\n onTabCreate: Metro.noop_arg,\n onTabActivate: Metro.noop,\n onTabDeactivate: Metro.noop,\n onTabBeforeClose: Metro.noop_true,\n onTabClose: Metro.noop,\n onTabRename: Metro.noop,\n onTabPropChange: Metro.noop,\n onTabOrganized: Metro.noop,\n };\n\n Metro.pageControlSetup = function (options) {\n PageControlDefaultConfig = $.extend({}, PageControlDefaultConfig, options);\n };\n\n if (typeof globalThis[\"metroPageControlSetup\"] !== undefined) {\n Metro.pageControlSetup(globalThis[\"metroPageControlSetup\"]);\n }\n\n Metro.Component(\"page-control\", {\n init: function (options, elem) {\n this._super(elem, options, PageControlDefaultConfig, {\n // define instance vars here\n newFileIndex: 1,\n invisibleTabsHolderToggle: null,\n invisibleTabsHolder: null,\n });\n return this;\n },\n\n _create: function () {\n this._createStructure();\n this._createEvents();\n\n this._fireEvent(\"page-control-create\");\n },\n\n _createStructure: function () {\n const that = this,\n element = this.element,\n o = this.options;\n\n this.component = $(\"
\").addClass(\"page-control\").insertBefore(element);\n\n element.addClass(\"page-control__tabs\").appendTo(this.component);\n element.addClass(`tabs-position-${o.tabsPosition}`);\n\n const items = element.children(\"li:not(.page-control__tab-custom)\");\n\n let activeTabExists = false;\n\n items.each(function (index, el) {\n const $el = $(el),\n html = $el.html(),\n active = $el.hasClass(\"active\");\n const tab = that.createTab({\n caption: html,\n icon: $el.attr(\"data-icon\"),\n image: $el.attr(\"data-image\"),\n canClose: $el.attr(\"data-close\") !== \"false\",\n data: $el.attr(\"data-data\"),\n ref: $el.attr(\"data-ref\"),\n });\n if (active && !activeTabExists) {\n activeTabExists = true;\n tab.addClass(\"active\");\n that._fireEvent(\"tab-activate\", { tab: tab[0] });\n }\n element.append(tab);\n $el.remove();\n });\n\n if (!activeTabExists) {\n const tab = this.element.children(\".page-control__tab\").first();\n tab.addClass(\"active\");\n this._fireEvent(\"tab-activate\", { tab: tab[0] });\n }\n\n if (o.refControl) {\n this._updateRefs();\n }\n\n if (o.appendButton) {\n const appendButton = $(\"
  • \").addClass(\"page-control__tab__append\").html(`+`);\n\n if (o.appendActions) {\n const appendItems = Metro.utils.exec(o.appendActions, null, this);\n if (!Array.isArray(appendItems)) {\n throw \"PageControl Error! Prop appendActions must be a function that returns an array.\";\n }\n const appendMenu = $(\"
      \");\n appendItems.map((el) => appendMenu.append(that._renderMenuItem(el)));\n appendButton.append(appendMenu);\n }\n\n element.append(appendButton);\n }\n\n const services = $(\"
    • \").addClass(\"page-control__tab__service\").addClass(\"invisible-tabs\").appendTo(element);\n services.append(\n $(\"
      \").addClass(\"page-control__service-button\").html(`\n \u21A7\n
        \n `),\n );\n\n this.invisibleTabsHolderToggle = services.find(\".page-control__tab__service.invisible-tabs > .page-control__service-button\");\n this.invisibleTabsHolder = Metro.makePlugin(services.find(\".page-control__invisible_tabs_holder\"), \"dropdown\", {\n onClick: (e) => {\n const parent = $(e.target.parentNode);\n if (parent.hasClass(\"page-control__tab__closer\")) {\n this.closeButtonClick(e);\n } else {\n this.activateTab(parent[0]);\n }\n e.preventDefault();\n e.stopPropagation();\n },\n });\n this.invisibleTabsHolderToggle.hide();\n this.organizeTabs();\n\n const tabsServices = $(\"
      • \").addClass(\"page-control__tab__service\").addClass(\"tabs-menu\").appendTo(element);\n tabsServices.append(\n $(\"
        \").addClass(\"page-control__service-button\").html(`\n \uFE19\n
          \n `),\n );\n if (!o.tabsActions) {\n tabsServices.hide();\n } else {\n const tabsMenu = tabsServices.find(\"ul\");\n const tabsMenuItems = Metro.utils.exec(o.tabsActions, null, this);\n tabsMenuItems.map((el) => tabsMenu.append(that._renderMenuItem(el)));\n }\n },\n\n _updateRefs: function () {\n const tabs = this.element.find(\".page-control__tab\");\n const activeTab = this.element.find(\".page-control__tab.active\");\n tabs.each((_, el) => $($(el).data(\"ref\")).hide());\n $(activeTab.data(\"ref\")).show();\n },\n\n _createEvents: function () {\n const that = this,\n element = this.element,\n o = this.options;\n\n element.on(\"click\", \".page-control__tab__closer\", this.closeButtonClick.bind(this));\n\n element.on(\"click\", \".page-control__tab__menu > li > a\", function (e) {\n const action = $(this).attr(\"data-action\");\n const menu = Metro.getPlugin($(this).closest(\"ul\"), \"dropdown\");\n const tab = $(this).closest(\".page-control__tab\")[0];\n\n menu.close();\n\n switch (action) {\n case \"close\": {\n that.closeTab(tab);\n break;\n }\n case \"close-all\": {\n that.closeAll();\n break;\n }\n case \"close-other\": {\n that.closeOtherTabs(tab);\n break;\n }\n case \"close-inactive\": {\n that.closeInactiveTabs();\n break;\n }\n case \"close-left\": {\n that.closeTabsOnTheLeft(tab);\n break;\n }\n case \"close-right\": {\n that.closeTabsOnTheRight(tab);\n break;\n }\n case \"rename\": {\n that.renameTab(tab);\n break;\n }\n }\n\n e.preventDefault();\n e.stopPropagation();\n });\n\n element.on(\"click\", \".page-control__tab\", function () {\n const tab = $(this);\n if (tab.hasClass(\"active\")) {\n return;\n }\n that.activateTab(this);\n });\n\n element.on(\"click\", \".page-control__tab__append > span\", (e) => {\n e.preventDefault();\n e.stopPropagation();\n\n const tab = that.createTab({\n caption: `${o.defaultNewTabTitle} ${that.newFileIndex++}`,\n canClose: o.defaultNewCanClose,\n icon: o.defaultNewTabIcon,\n image: o.defaultNewTabImage,\n data: null,\n });\n\n that._fireEvent(\"tab-append\", { tab });\n\n that.activateTab(tab);\n that.organizeTabs();\n\n that._fireEvent(\"append-button-click\", { tab });\n });\n\n $(globalThis).on(\"resize\", () => {\n this.organizeTabs();\n });\n },\n\n _renderMenuItem: function (el) {\n const li = $(\"
        • \");\n const an = $(\"\");\n\n if (el.icon || el.image) {\n an.append(el.icon ? $(\"\").addClass(el.icon) : $(\"\").attr(\"src\", el.image).attr(\"alt\", \"\"));\n }\n\n if (el.title) {\n an.append($(\"\").addClass(\"caption\").text(el.title));\n }\n\n an.data(\"data\", el.data);\n if (el.onclick) an.on(\"click\", (e) => el.onclick(e));\n li.append(an);\n\n return li;\n },\n\n createTab: function ({ caption, icon, image, canClose = true, hasMenu = true, data, ref }) {\n const that = this,\n element = this.element,\n o = this.options;\n\n const tab = $(\"
        • \").addClass(\"page-control__tab\").appendTo(element);\n\n if (hasMenu) {\n tab.append(\n $(\"
          \").addClass(\"page-control__tab__menu__holder\").html(`\n \uFE19\n \n `),\n );\n if (o.tabActions) {\n const tabMenu = tab.find(\"ul\");\n const tabMenuItems = Metro.utils.exec(o.tabActions);\n if (!Array.isArray(tabMenuItems)) {\n throw \"PageControl Error! Prop tabActions must be a function that returns an array.\";\n }\n tabMenu.append($(\"
        • \"));\n tabMenuItems.map((el) => tabMenu.append(that._renderMenuItem(el)));\n }\n }\n\n if (icon || image) {\n tab.append(\n $(\"\")\n .addClass(\"page-control__tab__icon\")\n .html(icon ? `` : `\"\"/`),\n );\n }\n\n tab.append($(\"\").addClass(\"page-control__tab__caption\").html(caption));\n\n if (canClose) {\n tab.append($(\"\").addClass(\"page-control__tab__closer\").html(`\u2715`));\n }\n\n tab.data(\"data\", data);\n tab.data(\"ref\", ref);\n\n this._fireEvent(\"tab-create\", { tab: tab[0] });\n\n element[o.defaultNewTabPosition === \"before\" ? \"prepend\" : \"append\"](tab);\n\n return tab[0];\n },\n\n closeButtonClick: function (e) {\n const that = this,\n o = this.options;\n\n const tab = $(e.target).closest(\".page-control__tab\");\n const parent = tab.closest(\"ul\");\n\n if (!o.onTabBeforeClose(tab[0])) {\n return;\n }\n\n that.closeTab(tab[0]);\n\n if (parent.hasClass(\"page-control__invisible_tabs_holder\") && parent.children(\".page-control__tab\").length === 0) {\n Metro.getPlugin(this.invisibleTabsHolder, \"dropdown\").close();\n this.invisibleTabsHolderToggle.hide();\n }\n\n e.preventDefault();\n e.stopPropagation();\n },\n\n closeTab: function (tab, reorg = true) {\n const $tab = $(tab);\n if ($tab.hasClass(\"active\")) {\n const prev = $tab.prev(\".page-control__tab\"),\n next = $tab.next(\".page-control__tab\");\n if (prev.length) {\n this.activateTab(prev[0]);\n } else if (next.length) {\n this.activateTab(next[0]);\n } else if ($tab.parent().hasClass(\"page-control__invisible_tabs_holder\") && parent.children(\".page-control__tab\").length === 1) {\n if (element.children(\".page-control__tab\").length) {\n this.activateTab(element.children(\".page-control__tab\").last()[0]);\n }\n }\n }\n this._fireEvent(\"tab-close\", { tab });\n if (this.options.refControl) {\n $($tab.data(\"ref\")).remove();\n }\n $tab.remove();\n if (reorg) this.organizeTabs();\n return this;\n },\n\n activateTab: function (tab) {\n const element = this.element, o = this.options;\n\n element.find(\".page-control__tab\").each((index, el) => {\n const t = $(el);\n if (t.hasClass(\"active\")) {\n this._fireEvent(\"tab-deactivate\", { tab: el });\n t.removeClass(\"active\");\n }\n });\n\n $(tab).addClass(\"active\");\n\n if (o.refControl) {\n this._updateRefs();\n }\n\n this._fireEvent(\"tab-activate\", { tab });\n\n if ($(tab).parent().hasClass(\"page-control__invisible_tabs_holder\")) {\n element.prepend(tab);\n this.organizeTabs();\n }\n\n return this;\n },\n\n organizeTabs: function () {\n const element = this.element;\n const tabsWidth = this.elem.getBoundingClientRect().width;\n const holder = this.invisibleTabsHolder;\n const addTabButton = element.find(\".page-control__tab__append\");\n\n holder.children(\".page-control__tab\").each((index, el) => {\n const tab = $(el);\n\n if (addTabButton.length) {\n tab.insertBefore(addTabButton);\n } else {\n tab.appendTo(element);\n }\n });\n\n const tabs = element.children(\".page-control__tab\");\n let w = 0;\n for (let tab of tabs) {\n const tabRect = tab.getBoundingClientRect();\n if (w + tabRect.width + 50 > tabsWidth) {\n $(tab).nextAll(\".page-control__tab\").appendTo(holder);\n $(tab).appendTo(holder);\n break;\n }\n w += tabRect.width;\n }\n\n if (holder.children().length) {\n this.invisibleTabsHolderToggle.show(function () {\n $(this).css({\n display: \"flex\",\n });\n });\n } else {\n this.invisibleTabsHolderToggle.hide();\n }\n\n this._fireEvent(\"tab-organized\", null);\n },\n\n addTab: function ({ caption, icon, image, canClose = true, hasMenu = true, data, ref }, insert = \"before\") {\n const o = this.options;\n\n const newTab = this.createTab({caption, icon, image, canClose, hasMenu, data, ref});\n\n if (o.activateNewTab) {\n this.activateTab(newTab);\n }\n\n this.element[insert === \"before\" ? \"prepend\" : \"append\"](newTab);\n this.organizeTabs();\n return newTab;\n },\n\n getActiveTab: function () {\n return this.component.find(\".page-control__tab.active\")[0];\n },\n\n getActiveTabIndex: function () {\n return this.component.find(\".page-control__tab\").index(\".active\", false);\n },\n\n getTabByIndex: function (index) {\n return this.component.find(\".page-control__tab\").get(index);\n },\n\n getTabByTitle: function (caption) {\n if (!caption) {\n return undefined;\n }\n const tabs = this.component.find(\".page-control__tab\");\n for (const tab of tabs) {\n if ($(tab).find(\".caption\").text() === caption) {\n return tab;\n }\n }\n return undefined;\n },\n\n closeAll: function () {\n this.component.find(\".page-control__tab\").each((index, tab) => {\n this.closeTab(tab, false);\n });\n this.organizeTabs();\n return this;\n },\n\n closeInactiveTabs: function () {\n this.component.find(\".page-control__tab\").each((index, tab) => {\n if (!$(tab).hasClass(\"active\")) this.closeTab(tab, false);\n });\n this.organizeTabs();\n return this;\n },\n\n closeOtherTabs: function (tab) {\n let _tab = typeof tab === \"number\" ? this.getTabByIndex(tab) : $(tab);\n this.component.find(\".page-control__tab\").each((index, tab) => {\n if (_tab[0] !== tab) this.closeTab(tab, false);\n });\n this.activateTab(tab);\n this.organizeTabs();\n return this;\n },\n\n closeTabsOnTheLeft: function (tab) {\n const tabs = this.component.find(\".page-control__tab\");\n const tabIndex = tabs.indexOf($(tab));\n this.component.find(\".page-control__tab\").each((index, _tab) => {\n if (index < tabIndex) this.closeTab(_tab, false);\n });\n this.organizeTabs();\n return this;\n },\n\n closeTabsOnTheRight: function (tab) {\n const tabs = this.component.find(\".page-control__tab\");\n const tabIndex = tabs.indexOf($(tab));\n this.component.find(\".page-control__tab\").each((index, _tab) => {\n if (index > tabIndex) this.closeTab(_tab, false);\n });\n this.organizeTabs();\n return this;\n },\n\n setupTab: function (tab, prop, val) {\n const $tab = $(tab);\n switch (prop) {\n case \"caption\": {\n $tab.find(\".page-control__tab__caption\").text(val);\n break;\n }\n case \"icon\": {\n $tab.find(\".page-control__tab__icon\")[0].className = val;\n break;\n }\n case \"image\": {\n $tab.find(\".page-control__tab__image\").attr(\"src\", val);\n break;\n }\n case \"data\": {\n $tab.data(\"data\", val);\n break;\n }\n case \"ref\": {\n $tab.data(\"ref\", val);\n break;\n }\n }\n this._fireEvent(\"tab-prop-change\", { tab });\n this.organizeTabs();\n },\n\n renameTab: function (tab) {\n const that = this;\n const caption = $(tab).find(\".page-control__tab__caption\");\n\n Metro.dialog.create({\n title: that.strings.label_rename_tab,\n content: `\n
          \n \n
          \n `,\n defaultActions: false,\n customButtons: [\n {\n text: that.strings.label_ok,\n cls: \"js-dialog-close info\",\n onclick: function (dlg) {\n that.setupTab(tab, \"caption\", dlg.find(\"input\").val());\n },\n },\n {\n text: that.strings.label_cancel,\n cls: \"js-dialog-close\",\n },\n ],\n });\n },\n\n changeAttribute: function (attr, newValue) {},\n\n destroy: function () {\n this.component.remove();\n },\n });\n})(Metro, Dom);\n", " /* global Metro */\n(function(Metro, $) {\n 'use strict';\n Metro.pagination = function(c){\n var defConf = {\n length: 0, //total rows\n rows: 0, // page size\n current: 0,\n target: \"body\",\n clsPagination: \"\",\n prevTitle: \"\",\n nextTitle: \"\",\n distance: 5,\n islandSize: 3,\n shortTrack: 10,\n }, conf;\n\n var strings = Metro.locales[$(\"html\").attr(\"lang\") || \"en\"];\n \n var i, prev, next;\n\n conf = $.extend( {}, defConf, c);\n\n var distance = parseInt(conf.distance);\n var shortTrack = parseInt(conf.shortTrack);\n var islandSize = parseInt(conf.islandSize)\n var totalRows = parseInt(conf.length)\n var pageSize = parseInt(conf.rows)\n var totalPages = Math.ceil(totalRows/pageSize)\n var current = parseInt(conf.current)\n var pagination_wrapper = $(conf.target); pagination_wrapper.html(\"\");\n var pagination = $(\"
            \").addClass(\"pagination\").addClass(conf.clsPagination).appendTo(pagination_wrapper);\n\n if (totalRows === 0) {\n return ;\n }\n\n if (pageSize === -1) {\n return ;\n }\n\n var add_item = function(item_title, item_type, data){\n var li, a;\n\n li = $(\"
          • \").addClass(\"page-item\").addClass(item_type);\n a = $(\"\").addClass(\"page-link\").html(item_title);\n a.data(\"page\", data);\n a.appendTo(li);\n\n return li;\n };\n\n prev = add_item(conf.prevTitle || strings.label_prev, \"service prev-page\", \"prev\");\n pagination.append(prev);\n\n pagination.append(add_item(1, current === 1 ? \"active\" : \"\", 1));\n\n if (distance === 0 || totalPages <= shortTrack) {\n for (i = 2; i < totalPages; i++) {\n pagination.append(add_item(i, i === current ? \"active\" : \"\", i));\n }\n } else {\n if (current < distance) {\n for (i = 2; i <= distance; i++) {\n pagination.append(add_item(i, i === current ? \"active\" : \"\", i));\n }\n\n if (totalPages > distance) {\n pagination.append(add_item(\"...\", \"no-link\", null));\n }\n } else if (current <= totalPages && current > totalPages - distance + 1) {\n if (totalPages > distance) {\n pagination.append(add_item(\"...\", \"no-link\", null));\n }\n\n for (i = totalPages - distance + 1; i < totalPages; i++) {\n pagination.append(add_item(i, i === current ? \"active\" : \"\", i));\n }\n } else {\n pagination.append(add_item(\"...\", \"no-link\", null));\n\n for(let i = islandSize; i > 0; i--) {\n pagination.append(add_item(current - i, \"\", current - i))\n }\n\n pagination.append(add_item(current, \"active\", current));\n\n for(let i = 1; i <= islandSize; i++) {\n pagination.append(add_item(current + i, \"\", current + i))\n }\n\n pagination.append(add_item(\"...\", \"no-link\", null));\n }\n }\n\n if (totalPages > 1 || current < totalPages) pagination.append(add_item(totalPages, current === totalPages ? \"active\" : \"\", totalPages));\n\n next = add_item(conf.nextTitle || strings.label_next, \"service next-page\", \"next\");\n pagination.append(next);\n\n if (current === 1) {\n prev.addClass(\"disabled\");\n }\n\n if (current === totalPages) {\n next.addClass(\"disabled\");\n }\n\n if (totalRows === 0) {\n pagination.addClass(\"disabled\");\n pagination.children().addClass(\"disabled\");\n }\n\n return pagination;\n };\n}(Metro, Dom));", "(function (Metro, $) {\n \"use strict\";\n\n const toggleImage = ``\n\n var PanelDefaultConfig = {\n panelDeferred: 0,\n id: null,\n titleCaption: \"\",\n titleIcon: \"\",\n collapsible: false,\n collapsed: false,\n collapseDuration: 100,\n width: \"auto\",\n height: \"auto\",\n draggable: false,\n\n customButtons: null,\n clsCustomButton: \"\",\n\n clsPanel: \"\",\n clsTitle: \"\",\n clsTitleCaption: \"\",\n clsTitleIcon: \"\",\n clsContent: \"\",\n clsCollapseToggle: \"\",\n\n onCollapse: Metro.noop,\n onExpand: Metro.noop,\n onDragStart: Metro.noop,\n onDragStop: Metro.noop,\n onDragMove: Metro.noop,\n onPanelCreate: Metro.noop,\n };\n\n Metro.panelSetup = function (options) {\n PanelDefaultConfig = $.extend({}, PanelDefaultConfig, options);\n };\n\n if (typeof globalThis[\"metroPanelSetup\"] !== undefined) {\n Metro.panelSetup(globalThis[\"metroPanelSetup\"]);\n }\n\n Metro.Component(\"panel\", {\n init: function (options, elem) {\n this._super(elem, options, PanelDefaultConfig);\n\n return this;\n },\n\n _addCustomButtons: function (buttons) {\n var element = this.element,\n o = this.options;\n var title = element.closest(\".panel\").find(\".panel-title\");\n var buttonsContainer,\n customButtons = [];\n\n customButtons = Metro.utils.isObject(buttons);\n if (!customButtons) {\n console.warn(\"Unknown format for custom buttons\", buttons);\n return;\n }\n\n if (title.length === 0) {\n console.warn(\"No place for custom buttons\");\n return;\n }\n\n buttonsContainer = title.find(\".custom-buttons\");\n\n if (buttonsContainer.length === 0) {\n buttonsContainer = $(\"
            \")\n .addClass(\"custom-buttons\")\n .appendTo(title);\n } else {\n buttonsContainer.find(\".btn-custom\").off(Metro.events.click);\n buttonsContainer.html(\"\");\n }\n\n $.each(customButtons, function () {\n var item = this;\n var customButton = $(\"\");\n\n customButton\n .addClass(\"button btn-custom\")\n .addClass(o.clsCustomButton)\n .addClass(item.cls)\n .attr(\"tabindex\", -1)\n .html(item.html);\n\n if (item.attr && typeof item.attr === \"object\") {\n $.each(item.attr, function (k, v) {\n customButton.attr(Str.dashedName(k), v);\n });\n }\n\n customButton.data(\"action\", item.onclick);\n\n buttonsContainer.prepend(customButton);\n });\n\n title.on(Metro.events.click, \".btn-custom\", function (e) {\n if (Metro.utils.isRightMouse(e)) return;\n var button = $(this);\n var action = button.data(\"action\");\n Metro.utils.exec(action, [button], this);\n });\n\n return this;\n },\n\n _create: function () {\n var element = this.element,\n o = this.options;\n var panel = $(\"
            \").addClass(\"panel\").addClass(o.clsPanel);\n var id = o.id ? o.id : Metro.utils.elementId(\"panel\");\n var original_classes = element[0].className;\n var title;\n\n panel.attr(\"id\", id).addClass(original_classes);\n panel.insertBefore(element);\n element.appendTo(panel);\n\n element[0].className = \"\";\n element\n .addClass(\"panel-content\")\n .addClass(o.clsContent)\n .appendTo(panel);\n\n if (\n o.titleCaption !== \"\" ||\n o.titleIcon !== \"\" ||\n o.collapsible === true\n ) {\n title = $(\"
            \").addClass(\"panel-title\").addClass(o.clsTitle);\n\n if (o.titleCaption !== \"\") {\n $(\"\")\n .addClass(\"caption\")\n .addClass(o.clsTitleCaption)\n .html(o.titleCaption)\n .appendTo(title);\n }\n\n if (o.titleIcon !== \"\") {\n $(o.titleIcon)\n .addClass(\"icon\")\n .addClass(o.clsTitleIcon)\n .appendTo(title);\n }\n\n if (o.collapsible === true) {\n var collapseToggle = $(\"\")\n .addClass(\"dropdown-toggle marker-center active-toggle\")\n .addClass(o.clsCollapseToggle)\n .appendTo(title);\n \n collapseToggle.append(toggleImage);\n \n Metro.makePlugin(element, \"collapse\", {\n toggleElement: collapseToggle,\n duration: o.collapseDuration,\n onCollapse: o.onCollapse,\n onExpand: o.onExpand,\n });\n\n if (o.collapsed === true) {\n this.collapse();\n }\n }\n\n title.appendTo(panel);\n }\n\n if (title && Metro.utils.isValue(o.customButtons)) {\n this._addCustomButtons(o.customButtons);\n }\n\n if (o.draggable === true) {\n var dragElement;\n\n if (title) {\n dragElement = title.find(\".caption, .icon\");\n } else {\n dragElement = panel;\n }\n\n Metro.makePlugin(panel, \"draggable\", {\n dragContext: panel[0],\n dragElement: dragElement,\n onDragStart: o.onDragStart,\n onDragStop: o.onDragStop,\n onDragMove: o.onDragMove,\n });\n }\n\n if (o.width !== \"auto\" && parseInt(o.width) >= 0) {\n panel.outerWidth(parseInt(o.width));\n }\n\n if (o.height !== \"auto\" && parseInt(o.height) >= 0) {\n panel.outerHeight(parseInt(o.height));\n element.css({ overflow: \"auto\" });\n }\n\n this.panel = panel;\n\n this._fireEvent(\"panel-create\", {\n element: element,\n panel: panel,\n });\n },\n\n customButtons: function (buttons) {\n return this._addCustomButtons(buttons);\n },\n\n collapse: function () {\n var element = this.element;\n if (Metro.utils.isMetroObject(element, \"collapse\") === false) {\n return;\n }\n Metro.getPlugin(element, \"collapse\").collapse();\n },\n\n open: function () {\n this.expand();\n },\n\n close: function () {\n this.collapse();\n },\n\n expand: function () {\n var element = this.element;\n if (Metro.utils.isMetroObject(element, \"collapse\") === false) {\n return;\n }\n Metro.getPlugin(element, \"collapse\").expand();\n },\n\n /* eslint-disable-next-line */\n changeAttribute: function (attributeName) {},\n\n destroy: function () {\n var element = this.element,\n o = this.options;\n\n if (o.collapsible === true) {\n Metro.getPlugin(element, \"collapse\").destroy();\n }\n\n if (o.draggable === true) {\n Metro.getPlugin(element, \"draggable\").destroy();\n }\n\n return element;\n },\n });\n})(Metro, Dom);\n", "/* global Metro */\n(function(Metro, $) {\n 'use strict';\n var Utils = Metro.utils;\n var PopoverDefaultConfig = {\n popoverDeferred: 0,\n popoverText: \"\",\n popoverHide: 3000,\n popoverTimeout: 10,\n popoverOffset: 10,\n popoverTrigger: Metro.popoverEvents.HOVER,\n popoverPosition: Metro.position.TOP,\n hideOnLeave: false,\n closeButton: true,\n clsPopover: \"\",\n clsPopoverContent: \"\",\n onPopoverShow: Metro.noop,\n onPopoverHide: Metro.noop,\n onPopoverCreate: Metro.noop\n };\n\n Metro.popoverSetup = function (options) {\n PopoverDefaultConfig = $.extend({}, PopoverDefaultConfig, options);\n };\n\n if (typeof globalThis[\"metroPopoverSetup\"] !== undefined) {\n Metro.popoverSetup(globalThis[\"metroPopoverSetup\"]);\n }\n\n Metro.Component('popover', {\n init: function( options, elem ) {\n this._super(elem, options, PopoverDefaultConfig, {\n popover: null,\n popovered: false,\n size: {\n width: 0,\n height: 0\n },\n id: Utils.elementId(\"popover\")\n });\n\n return this;\n },\n\n _create: function(){\n this._createEvents();\n this._fireEvent(\"popover-create\", {\n element: this.element\n })\n },\n\n _createEvents: function(){\n var that = this, element = this.element, o = this.options;\n var event;\n\n switch (o.popoverTrigger) {\n case Metro.popoverEvents.CLICK: event = Metro.events.click; break;\n case Metro.popoverEvents.FOCUS: event = Metro.events.focus; break;\n default: event = Metro.events.enter;\n }\n\n element.on(event, function(){\n if (that.popover !== null || that.popovered === true) {\n return ;\n }\n setTimeout(function(){\n that.createPopover();\n\n that._fireEvent(\"popover-show\", {\n popover: that.popover\n });\n\n if (o.popoverHide > 0) {\n setTimeout(function(){\n that.removePopover();\n }, o.popoverHide);\n }\n }, o.popoverTimeout);\n });\n\n if (o.hideOnLeave === true) {\n element.on(Metro.events.leave, function(){\n that.removePopover();\n });\n }\n\n $(globalThis).on(Metro.events.scroll, function(){\n if (that.popover !== null) that.setPosition();\n }, {ns: this.id});\n },\n\n setPosition: function(){\n var popover = this.popover, size = this.size, o = this.options, element = this.element;\n\n if (o.popoverPosition === Metro.position.BOTTOM) {\n popover.addClass('bottom');\n popover.css({\n top: element.offset().top - $(globalThis).scrollTop() + element.outerHeight() + o.popoverOffset,\n left: element.offset().left + element.outerWidth()/2 - size.width/2 - $(globalThis).scrollLeft()\n });\n } else if (o.popoverPosition === Metro.position.RIGHT) {\n popover.addClass('right');\n popover.css({\n top: element.offset().top + element.outerHeight()/2 - size.height/2 - $(globalThis).scrollTop(),\n left: element.offset().left + element.outerWidth() - $(globalThis).scrollLeft() + o.popoverOffset\n });\n } else if (o.popoverPosition === Metro.position.LEFT) {\n popover.addClass('left');\n popover.css({\n top: element.offset().top + element.outerHeight()/2 - size.height/2 - $(globalThis).scrollTop(),\n left: element.offset().left - size.width - $(globalThis).scrollLeft() - o.popoverOffset\n });\n } else {\n popover.addClass('top');\n popover.css({\n top: element.offset().top - $(globalThis).scrollTop() - size.height - o.popoverOffset,\n left: element.offset().left + element.outerWidth()/2 - size.width/2 - $(globalThis).scrollLeft()\n });\n }\n },\n\n createPopover: function(){\n var that = this, elem = this.elem, element = this.element, o = this.options;\n var popover;\n var neb_pos;\n var id = Utils.elementId(\"popover\");\n var closeButton;\n\n if (this.popovered) {\n return ;\n }\n\n popover = $(\"
            \").addClass(\"popover neb\").addClass(o.clsPopover);\n popover.attr(\"id\", id);\n\n $(\"
            \").addClass(\"popover-content\").addClass(o.clsPopoverContent).html(o.popoverText).appendTo(popover);\n\n if (o.popoverHide === 0 && o.closeButton === true) {\n closeButton = $(\"\n `).appendTo(element)\n \n element.append(\n this.pagination = $(\"
            \").addClass(\"dataset-pagination\")\n )\n },\n\n _createEvents: function(){\n const that = this, element = this.element, o = this.options;\n\n element.on(\"click\", \".page-link\", function(){\n const parent = $(this).parent()\n if (parent.hasClass(\"service\")) {\n if (parent.hasClass(\"prev-page\")) {\n that.offset -= that.limit;\n if (that.offset < 0) {\n that.offset = 0;\n }\n } else {\n that.offset += that.limit;\n }\n that._loadData().then(() => {})\n return\n }\n that.offset = $(this).data(\"page\") * that.limit - that.limit;\n that._loadData().then(() => {})\n })\n\n const searchFn = Hooks.useDebounce(() => {\n const val = element.find(\"input[name=search]\").val().trim()\n if (val === \"\") {\n this.search = \"\"\n this.url = o.url\n this._loadData().then(() => {})\n return\n }\n if (val.length < 3) {\n return\n }\n this.search = val\n this.url = o.searchUrl\n this._loadData().then(() => {})\n }, 300)\n\n element.on(Metro.events.inputchange, \"input[name=search]\", searchFn)\n\n element.on(\"change\", \"select[name=rows-count]\", function(){\n that.limit = +$(this).val()\n that.offset = 0\n that._loadData().then(() => {})\n })\n \n element.on(\"change\", \"select[name=sort-order]\", function(){\n const [field, order] = $(this).val().split(\":\")\n that.url = o.url\n that.sortField = field\n that.sortOrder = order\n that.offset = 0\n that._loadData().then(() => {})\n })\n \n element.on(\"click\", \".load-more-button\", function(){\n that.offset += that.limit\n that._loadData(true).then(() => {})\n })\n },\n\n _createEntries: function (append = false){\n var that = this, element = this.element, o = this.options;\n\n if (!this.data) {\n return ;\n }\n\n const usePagination = Metro.utils.isValue(this.data[o.totalKey])\n\n this.entries = this.data[o.dataKey];\n this.total = this.data[o.totalKey];\n\n if (append === false) this.body.clear()\n \n this.entries.forEach((entry, index) => {\n const item = $(\"
            \").addClass(\"dataset-item\").addClass(o.clsItem).addClass(index % 2 === 0 ? \"even\" : \"odd\")\n const html = Metro.utils.exec(o.template, [entry], entry)\n item.html(html).appendTo(that.body)\n });\n\n if (usePagination && !o.shortPagination) {\n Metro.pagination({\n length: this.total,\n rows: this.limit,\n current: this.offset === 0 ? 1 : Math.round(this.offset / this.limit) + 1,\n target: this.pagination,\n clsPagination: o.clsPagination\n })\n } else {\n this.pagination.html(`\n \n `)\n }\n },\n\n /*\n * options = {\n * caption: \"\",\n * url: \"\",\n * searchUrl: \"\",\n * method: \"GET\",\n * limit: 10,\n * offset: 0,\n * sort: \"\",\n * sortOrder: \"asc\",\n * limitKey: \"limit\",\n * }\n * */\n setup: function (options){\n \n },\n \n changeAttribute: function(attr, newValue){\n },\n\n destroy: function(){\n this.element.remove();\n }\n });\n}(Metro, Dom));", "(function(Metro, $) {\n 'use strict';\n \n let RemoteTableDefaultConfig = {\n caption: \"\",\n url: \"\",\n searchUrl: \"\",\n method: \"GET\",\n limit: 10,\n offset: 0,\n fields: \"\",\n sortableFields: \"\",\n colSize: \"\",\n sort: \"\",\n sortOrder: \"asc\",\n captions: null,\n limitKey: \"limit\",\n offsetKey: \"offset\",\n searchKey: \"query\",\n totalKey: \"total\",\n dataKey: \"data\",\n sortKey: \"sortBy\",\n orderKey: \"order\",\n shortPagination: false,\n rows: 10,\n rowsSteps: \"10,25,50,100\",\n \n clsTable: \"\",\n clsPagination: \"\",\n \n onLoad: f => f,\n onDrawRow: Metro.noop,\n onDrawCell: Metro.noop,\n onDrawHeadCell: Metro.noop,\n onTableCreate: Metro.noop\n };\n\n Metro.remoteTableSetup = function (options) {\n RemoteTableDefaultConfig = $.extend({}, RemoteTableDefaultConfig, options);\n };\n\n if (typeof window[\"metroRemoteTableSetup\"] !== undefined) {\n Metro.remoteTableSetup(window[\"metroRemoteTableSetup\"]);\n }\n\n Metro.Component('remote-table', {\n init: function( options, elem ) {\n this._super(elem, options, RemoteTableDefaultConfig, {\n // define instance vars here\n data: null,\n total: 0,\n });\n return this;\n },\n\n _create: function(){\n const o = this.options;\n\n this.offset = o.offset\n this.fields = o.fields.toArray(\",\")\n this.captions = o.captions ? o.captions.toArray(\",\") : null\n this.rowSteps = o.rowsSteps.toArray(\",\")\n this.colSize = o.colSize.toArray(\",\")\n this.limit = +o.rows\n this.url = o.url\n this.search = \"\"\n this.sortField = o.sort\n this.sortOrder = o.sortOrder\n \n this._createStructure();\n this._createEvents();\n \n this._loadData().then(() => {});\n\n this._fireEvent('table-create');\n },\n\n _loadData: async function (){\n const o = this.options\n if (!this.url) { return }\n let url = this.url + \"?\" + o.limitKey + \"=\" + this.limit + \"&\" + o.offsetKey + \"=\" + this.offset\n if (this.sortField) { url += \"&\" + o.sortKey + \"=\" + this.sortField + \"&\" + o.orderKey + \"=\" + this.sortOrder; }\n if (this.search) { url += \"&\" + o.searchKey + \"=\" + this.search; }\n const response = await fetch(url, { method: o.method })\n if (response.ok === false) { return ; }\n this.data = Metro.utils.exec(o.onLoad, [await response.json()], this);\n this._createEntries()\n },\n \n _createStructure: function(){\n const element = this.element, o = this.options;\n let entries\n \n element.addClass(\"table-component remote-table\")\n element.append(entries = $(\"
            \").addClass(\"table-entry\"))\n \n entries.html(`\n
            \n
            \n \n
            \n
            \n \n
            \n
            \n \n \n \n \n
            ${o.caption}
            \n `)\n this.header = entries.find(\"thead\")\n this.body = entries.find(\"tbody\")\n \n element.append(\n this.pagination = $(\"
            \").addClass(\"table-pagination\")\n )\n },\n\n _createEvents: function(){\n const that = this, element = this.element, o = this.options;\n \n element.on(\"click\", \".page-link\", function(){\n const parent = $(this).parent()\n if (parent.hasClass(\"service\")) {\n if (parent.hasClass(\"prev-page\")) {\n that.offset -= that.limit;\n if (that.offset < 0) {\n that.offset = 0;\n } \n } else {\n that.offset += that.limit;\n }\n that._loadData().then(() => {})\n return\n }\n that.offset = $(this).data(\"page\") * that.limit - that.limit;\n that._loadData().then(() => {})\n })\n \n const searchFn = Hooks.useDebounce(() => {\n const val = element.find(\"input[name=search]\").val().trim()\n if (val === \"\") {\n this.search = \"\"\n this.url = o.url\n this._loadData().then(() => {})\n return\n }\n if (val.length < 3) {\n return\n }\n this.search = val\n this.url = o.searchUrl\n this._loadData().then(() => {})\n }, 300)\n \n element.on(Metro.events.inputchange, \"input[name=search]\", searchFn)\n \n element.on(\"change\", \"select[name=rows-count]\", function(){\n that.limit = +$(this).val()\n that.offset = 0\n that._loadData().then(() => {})\n })\n \n element.on(\"click\", \".sortable-column\", function(){\n const field = $(this).attr(\"data-field\")\n if (that.sortField === field) {\n that.sortOrder = that.sortOrder === \"asc\" ? \"desc\" : \"asc\"\n } else {\n that.sortField = field\n that.sortOrder = \"asc\"\n }\n that._loadData().then(() => {})\n })\n },\n\n _createEntries: function (){\n const o = this.options;\n \n if (!this.data) {\n return ;\n }\n\n const usePagination = Metro.utils.isValue(this.data[o.totalKey])\n \n this.entries = this.data[o.dataKey];\n this.total = this.data[o.totalKey];\n\n this.header.clear()\n this.body.clear()\n \n const headerRow = $(\"\").addClass(\"table-header\").appendTo(this.header);\n let hIndex = 0;\n for (let key of Object.keys(this.entries[0])) {\n if (this.fields.length && !this.fields.includes(key)) {\n continue;\n }\n const cellData = this.captions ? this.captions[hIndex] : key\n const cell = $(\"\").html(cellData).attr(\"data-field\", key);\n if (o.sortableFields && o.sortableFields.includes(key)) {\n cell.addClass(\"sortable-column\")\n if (this.sortField === key) {\n cell.addClass(`sort-${this.sortOrder}`)\n }\n }\n cell.appendTo(headerRow).addClass(`head-cell-${key}`);\n if (this.colSize[hIndex]) {\n cell.css(\"width\", this.colSize[hIndex])\n }\n Metro.utils.exec(o.onDrawHeadCell, [cell[0], cellData, key, hIndex, o.sortableFields.includes(key), this.sortField === key, this.sortOrder], this);\n hIndex++\n }\n \n this.entries.forEach((entry, index) => {\n const row = $(\"\").addClass(\"table-row\");\n this.body.append(row);\n Metro.utils.exec(o.onDrawRow, [row, entry, index], this);\n let hIndex = 0;\n for (let key in entry) {\n if (this.fields.length && !this.fields.includes(key)) {\n continue;\n }\n const cell = $(\"\").attr(\"data-label\", this.captions ? this.captions[hIndex] : key)\n .addClass(`data-cell-${key}`)\n .html(entry[key]);\n \n row.append(cell);\n Metro.utils.exec(o.onDrawCell, [cell[0], entry[key], key, entry, index], this);\n hIndex++\n }\n });\n \n if (usePagination && !o.shortPagination) {\n Metro.pagination({\n length: this.total,\n rows: this.limit,\n current: this.offset === 0 ? 1 : Math.round(this.offset / this.limit) + 1,\n target: this.pagination,\n clsPagination: o.clsPagination,\n })\n } else {\n this.pagination.html(`\n \n `)\n }\n \n },\n \n changeAttribute: function(attr, newValue){\n },\n\n destroy: function(){\n this.element.remove();\n }\n });\n}(Metro, Dom));", "/* global Metro */\n(function(Metro, $) {\n 'use strict';\n var Utils = Metro.utils;\n var ResizableDefaultConfig = {\n resizableDeferred: 0,\n canResize: true,\n resizeElement: \".resize-element\",\n minWidth: 0,\n minHeight: 0,\n maxWidth: 0,\n maxHeight: 0,\n preserveRatio: false,\n onResizeStart: Metro.noop,\n onResizeStop: Metro.noop,\n onResize: Metro.noop,\n onResizableCreate: Metro.noop\n };\n\n Metro.resizableSetup = function (options) {\n ResizableDefaultConfig = $.extend({}, ResizableDefaultConfig, options);\n };\n\n if (typeof globalThis[\"metroResizableSetup\"] !== undefined) {\n Metro.resizableSetup(globalThis[\"metroResizableSetup\"]);\n }\n\n Metro.Component('resizable', {\n init: function( options, elem ) {\n this._super(elem, options, ResizableDefaultConfig, {\n resizer: null,\n id: Utils.elementId(\"resizable\")\n });\n\n return this;\n },\n\n _create: function(){\n this._createStructure();\n this._createEvents();\n\n this._fireEvent(\"resizable-create\");\n },\n\n _createStructure: function(){\n var element = this.element, o = this.options;\n\n element.data(\"canResize\", true);\n element.addClass(\"resizable-element\");\n\n if (Utils.isValue(o.resizeElement) && element.find(o.resizeElement).length > 0) {\n this.resizer = element.find(o.resizeElement);\n } else {\n this.resizer = $(\"\").addClass(\"resize-element\").appendTo(element);\n }\n\n element.data(\"canResize\", o.canResize);\n },\n\n _createEvents: function(){\n var that = this, element = this.element, o = this.options;\n\n this.resizer.on(Metro.events.start, function(e){\n\n if (element.data('canResize') === false) {\n return ;\n }\n\n var startXY = Utils.pageXY(e);\n var startWidth = parseInt(element.outerWidth());\n var startHeight = parseInt(element.outerHeight());\n var size = {width: startWidth, height: startHeight};\n\n element.addClass(\"stop-pointer\");\n\n that._fireEvent(\"resize-start\", {\n size: size\n });\n\n $(document).on(Metro.events.move, function(e){\n var moveXY = Utils.pageXY(e);\n var size = {\n width: startWidth + moveXY.x - startXY.x,\n height: startHeight + moveXY.y - startXY.y\n };\n\n if (o.maxWidth > 0 && size.width > o.maxWidth) {return true;}\n if (o.minWidth > 0 && size.width < o.minWidth) {return true;}\n\n if (o.maxHeight > 0 && size.height > o.maxHeight) {return true;}\n if (o.minHeight > 0 && size.height < o.minHeight) {return true;}\n\n element.css(size);\n\n that._fireEvent(\"resize\", {\n size: size\n })\n\n }, {ns: that.id});\n\n $(document).on(Metro.events.stop, function(){\n element.removeClass(\"stop-pointer\");\n\n $(document).off(Metro.events.move, {ns: that.id});\n $(document).off(Metro.events.stop, {ns: that.id});\n\n var size = {\n width: parseInt(element.outerWidth()),\n height: parseInt(element.outerHeight())\n };\n\n that._fireEvent(\"resize-stop\", {\n size: size\n });\n\n }, {ns: that.id});\n\n e.preventDefault();\n e.stopPropagation();\n });\n\n },\n\n off: function(){\n this.element.data(\"canResize\", false);\n },\n\n on: function(){\n this.element.data(\"canResize\", true);\n },\n\n changeAttribute: function(attributeName){\n var element = this.element, o = this.options;\n\n var canResize = function(){\n o.canResize = JSON.parse(element.attr('data-can-resize')) === true;\n };\n\n switch (attributeName) {\n case \"data-can-resize\": canResize(); break;\n }\n },\n\n destroy: function(){\n this.resizer.off(Metro.events.start);\n return this.element;\n }\n });\n}(Metro, Dom));", "/* global Metro */\n(function(Metro, $) {\n 'use strict';\n var Utils = Metro.utils;\n var ResizerDefaultConfig = {\n resizerDeferred: 0,\n onMediaPoint: Metro.noop,\n onMediaPointEnter: Metro.noop,\n onMediaPointLeave: Metro.noop,\n onWindowResize: Metro.noop,\n onElementResize: Metro.noop,\n onResizerCreate: Metro.noop\n };\n\n Metro.resizerSetup = function (options) {\n ResizerDefaultConfig = $.extend({}, ResizerDefaultConfig, options);\n };\n\n if (typeof globalThis[\"metroResizerSetup\"] !== undefined) {\n Metro.resizerSetup(globalThis[\"metroResizerSetup\"]);\n }\n\n Metro.Component('resizer', {\n init: function( options, elem ) {\n this._super(elem, options, ResizerDefaultConfig, {\n size: {width: 0, height: 0},\n media: globalThis.METRO_MEDIA,\n id: Utils.elementId(\"resizer\")\n });\n\n return this;\n },\n\n _create: function(){\n var element = this.element;\n\n this.size = {\n width: element.width(),\n height: element.height()\n };\n\n this._createStructure();\n this._createEvents();\n\n this._fireEvent(\"resizer-create\", {\n element: element\n });\n },\n\n _createStructure: function(){\n },\n\n _createEvents: function(){\n var that = this, element = this.element;\n var win = $.window();\n\n win.on(\"resize\", function(){\n var windowWidth = win.width(), windowHeight = win.height();\n var elementWidth = element.width(), elementHeight = element.height();\n var oldSize = that.size;\n var point;\n\n that._fireEvent(\"window-resize\", {\n width: windowWidth,\n height: windowHeight,\n media: globalThis.METRO_MEDIA\n });\n\n if (that.size.width !== elementWidth || that.size.height !== elementHeight) {\n that.size = {\n width: elementWidth,\n height: elementHeight\n };\n\n that._fireEvent(\"element-resize\", {\n width: elementWidth,\n height: elementHeight,\n oldSize: oldSize,\n media: globalThis.METRO_MEDIA\n });\n\n }\n\n if (that.media.length !== globalThis.METRO_MEDIA.length) {\n if (that.media.length > globalThis.METRO_MEDIA.length) {\n point = that.media.filter(function(x){\n return !globalThis.METRO_MEDIA.includes(x);\n });\n\n that._fireEvent(\"media-point-leave\", {\n point: point,\n media: globalThis.METRO_MEDIA\n });\n\n } else {\n point = globalThis.METRO_MEDIA.filter(function(x){\n return !that.media.includes(x);\n });\n\n that._fireEvent(\"media-point-enter\", {\n point: point,\n media: globalThis.METRO_MEDIA\n });\n }\n\n that.media = globalThis.METRO_MEDIA;\n\n that._fireEvent(\"media-point\", {\n point: point,\n media: globalThis.METRO_MEDIA\n });\n }\n }, {ns: this.id});\n },\n\n changeAttribute: function(){\n },\n\n destroy: function(){\n $(globalThis).off(\"resize\", {ns: this.id});\n }\n });\n}(Metro, Dom));", "/* global Metro */\n(function(Metro, $) {\n 'use strict';\n var Utils = Metro.utils;\n var RibbonMenuDefaultConfig = {\n ribbonmenuDeferred: 0,\n onStatic: Metro.noop,\n onBeforeTab: Metro.noop_true,\n onTab: Metro.noop,\n onRibbonMenuCreate: Metro.noop\n };\n\n Metro.ribbonMenuSetup = function (options) {\n RibbonMenuDefaultConfig = $.extend({}, RibbonMenuDefaultConfig, options);\n };\n\n if (typeof globalThis[\"metroRibbonMenuSetup\"] !== undefined) {\n Metro.ribbonMenuSetup(globalThis[\"metroRibbonMenuSetup\"]);\n }\n\n Metro.Component('ribbon-menu', {\n init: function( options, elem ) {\n this._super(elem, options, RibbonMenuDefaultConfig);\n\n return this;\n },\n\n _create: function(){\n var element = this.element;\n\n this._createStructure();\n this._createEvents();\n\n this._fireEvent(\"ribbon-menu-create\", {\n element: element\n });\n },\n\n _createStructure: function(){\n var element = this.element;\n\n element.addClass(\"ribbon-menu\");\n\n\n var fluentGroups = element.find(\".ribbon-toggle-group\");\n\n $.each(fluentGroups, function(){\n var g = $(this);\n g.buttongroup({\n clsActive: \"active\"\n });\n var gw = 0;\n var btns = g.find(\".ribbon-icon-button\");\n $.each(btns, function(){\n var b = $(this);\n var w = b.outerWidth(true);\n if (w > gw) gw = w;\n });\n g.css(\"width\", gw * Math.ceil(btns.length / 3) + 4);\n });\n\n element.find(\".section\").addClass(\"non-active\")\n\n var tabs = element.find(\".tabs-holder li:not(.static)\");\n var active_tab = element.find(\".tabs-holder li.active\");\n\n if (active_tab.length > 0) {\n this.open($(active_tab[0]));\n } else {\n if (tabs.length > 0) {\n this.open($(tabs[0]));\n }\n }\n },\n\n _createEvents: function(){\n var that = this, element = this.element, o = this.options;\n\n element.on(Metro.events.click, \".tabs-holder li a\", function(e){\n var link = $(this);\n var tab = $(this).parent(\"li\");\n\n if (tab.hasClass(\"static\")) {\n if (o.onStatic === Metro.noop && link.attr(\"href\") !== undefined) {\n document.location.href = link.attr(\"href\");\n } else {\n that._fireEvent(\"static\", {\n tab: tab[0]\n });\n }\n } else {\n if (Utils.exec(o.onBeforeTab, [tab[0]], element[0]) === true) {\n that.open(tab[0]);\n }\n }\n e.preventDefault();\n })\n },\n\n open: function(tab){\n var element = this.element;\n var $tab = $(tab);\n var tabs = element.find(\".tabs-holder li\");\n var sections = element.find(\".content-holder .section\");\n var target = $tab.children(\"a\").attr(\"href\");\n var target_section = target !== \"#\" ? element.find(target) : null;\n\n sections.addClass(\"non-active\")\n tabs.removeClass(\"active\");\n $tab.addClass(\"active\");\n\n sections.removeClass(\"active\");\n\n if (target_section) {\n target_section.addClass(\"active\").removeClass(\"non-active\");\n }\n\n this._fireEvent(\"tab\", {\n tab: $tab[0]\n });\n },\n\n changeAttribute: function(){\n },\n\n destroy: function(){\n var element = this.element;\n element.off(Metro.events.click, \".tabs-holder li a\");\n return element;\n }\n });\n}(Metro, Dom));", "/* global Metro */\n(function(Metro, $) {\n 'use strict';\n var Utils = Metro.utils;\n var RippleDefaultConfig = {\n rippleDeferred: 0,\n rippleColor: \"#fff\",\n rippleAlpha: .4,\n rippleTarget: \"default\",\n onRippleCreate: Metro.noop\n };\n\n Metro.rippleSetup = function (options) {\n RippleDefaultConfig = $.extend({}, RippleDefaultConfig, options);\n };\n\n if (typeof globalThis[\"metroRippleSetup\"] !== undefined) {\n Metro.rippleSetup(globalThis[\"metroRippleSetup\"]);\n }\n\n var getRipple = function(target, color, alpha, event){\n var el = $(target);\n var rect = Utils.rect(el[0]);\n var x, y;\n\n if (el.length === 0) {\n return ;\n }\n\n if (!Utils.isValue(color)) {\n color = \"#fff\";\n }\n\n if (!Utils.isValue(alpha)) {\n alpha = .4;\n }\n\n if (el.css('position') === 'static') {\n el.css('position', 'relative');\n }\n\n el.css({\n overflow: 'hidden'\n });\n\n $(\".ripple\").remove();\n\n var size = Math.max(el.outerWidth(), el.outerHeight());\n\n // Add the element\n var ripple = $(\"\").css({\n width: size,\n height: size\n });\n\n el.prepend(ripple);\n\n if (event) {\n // Get touch point x, y\n x = event.pageX - el.offset().left - ripple.width()/2;\n y = event.pageY - el.offset().top - ripple.height()/2;\n } else {\n // Get the center of the element\n x = rect.width / 2 - ripple.width()/2;\n y = rect.height / 2 - ripple.height()/2;\n }\n\n ripple.css({\n background: Farbe.Routines.toRGBA(Farbe.Routines.parse(color), alpha),\n width: size,\n height: size,\n top: y + 'px',\n left: x + 'px'\n }).addClass(\"rippleEffect\");\n\n setTimeout(function(){\n ripple.remove();\n }, 400);\n };\n\n Metro.Component('ripple', {\n init: function( options, elem ) {\n this._super(elem, options, RippleDefaultConfig);\n return this;\n },\n\n _create: function(){\n var element = this.element, o = this.options;\n var target = o.rippleTarget === 'default' ? null : o.rippleTarget;\n\n element.on(Metro.events.click, target, function(e){\n getRipple(this, o.rippleColor, o.rippleAlpha, e);\n });\n\n this._fireEvent(\"riopple-create\", {\n element: element\n });\n },\n\n changeAttribute: function(attributeName){\n var element = this.element, o = this.options;\n\n function changeColor(){\n var color = element.attr(\"data-ripple-color\");\n if (!Farbe.Routines.isColor(color)) {\n return;\n }\n o.rippleColor = color;\n }\n\n function changeAlpha(){\n var alpha = +element.attr(\"data-ripple-alpha\");\n if (isNaN(alpha)) {\n return;\n }\n o.rippleColor = alpha;\n }\n\n switch (attributeName) {\n case \"data-ripple-color\": changeColor(); break;\n case \"data-ripple-alpha\": changeAlpha(); break;\n }\n },\n\n destroy: function(){\n var element = this.element, o = this.options;\n var target = o.rippleTarget === 'default' ? null : o.rippleTarget;\n element.off(Metro.events.click, target);\n }\n });\n\n Metro.ripple = getRipple;\n}(Metro, Dom));", "/* global Metro */\n/* eslint-disable */\n(function(Metro, $) {\n 'use strict';\n\n var SearcherDefaultConfig = {\n onSearcherCreate: Metro.noop\n };\n\n Metro.searcherSetup = function (options) {\n SearcherDefaultConfig = $.extend({}, SearcherDefaultConfig, options);\n };\n\n if (typeof globalThis[\"metroSearcherSetup\"] !== undefined) {\n Metro.searcherSetup(globalThis[\"metroSearcherSetup\"]);\n }\n\n Metro.Component('searcher', {\n init: function( options, elem ) {\n this._super(elem, options, SearcherDefaultConfig, {\n // define instance vars here\n });\n return this;\n },\n\n _create: function(){\n var that = this, element = this.element, o = this.options;\n\n this._createStructure();\n this._createEvents();\n\n this._fireEvent('searcher-create');\n },\n\n _createStructure: function(){\n var that = this, element = this.element, o = this.options;\n\n },\n\n _createEvents: function(){\n var that = this, element = this.element, o = this.options;\n\n },\n\n changeAttribute: function(attr, newValue){\n },\n\n destroy: function(){\n this.element.remove();\n }\n });\n}(Metro, Dom));\n/* eslint-enable */", "/* global Metro, METRO_ANIMATION_DURATION */\n(function(Metro, $) {\n 'use strict';\n let SidebarDefaultConfig = {\n menuScrollbar: false,\n sidebarDeferred: 0,\n position: \"left\",\n shift: null,\n staticShift: null,\n toggle: null,\n duration: METRO_ANIMATION_DURATION,\n static: null,\n closeOutside: true,\n onOpen: Metro.noop,\n onClose: Metro.noop,\n onToggle: Metro.noop,\n onStaticSet: Metro.noop,\n onStaticLoss: Metro.noop,\n onSidebarCreate: Metro.noop\n };\n\n Metro.sidebarSetup = function (options) {\n SidebarDefaultConfig = $.extend({}, SidebarDefaultConfig, options);\n };\n\n if (typeof globalThis[\"metroSidebarSetup\"] !== undefined) {\n Metro.sidebarSetup(globalThis[\"metroSidebarSetup\"]);\n }\n\n Metro.Component('sidebar', {\n init: function( options, elem ) {\n this._super(elem, options, SidebarDefaultConfig, {\n toggle_element: null,\n id: Metro.utils.elementId('sidebar')\n });\n\n return this;\n },\n\n _create: function(){\n const element = this.element;\n\n this._createStructure();\n this._createEvents();\n $(globalThis).resize();\n this._checkStatic();\n\n this._fireEvent(\"sidebar-create\", {\n element: element\n });\n },\n\n _createStructure: function(){\n const element = this.element, o = this.options;\n const header = element.find(\".sidebar-header\");\n const sheet = Metro.sheet;\n const menu = element.find(\".sidebar-menu\");\n const size = element.outerWidth();\n\n element.addClass(\"sidebar\").addClass(\"on-\"+o.position);\n\n if (o.menuScrollbar === false) {\n menu.addClass(\"hide-scroll\");\n }\n\n if (o.toggle !== null && $(o.toggle).length > 0) {\n this.toggle_element = $(o.toggle);\n }\n\n if (header.length > 0) {\n if (header.data(\"image\") !== undefined) {\n header.css({\n backgroundImage: \"url(\"+header.data(\"image\")+\")\"\n });\n }\n }\n\n if (o.static !== null) {\n if (o.staticShift !== null) {\n if (o.position === 'left') {\n Metro.utils.addCssRule(sheet, \"@media screen and \" + Metro.media_queries[o.static.toUpperCase()], o.staticShift + \"{margin-left: \" + size + \"px; width: calc(100% - \" + size + \"px);}\");\n } else {\n Metro.utils.addCssRule(sheet, \"@media screen and \" + Metro.media_queries[o.static.toUpperCase()], o.staticShift + \"{margin-right: \" + size + \"px; width: calc(100% - \" + size + \"px);}\");\n }\n }\n }\n },\n\n _createEvents: function(){\n const that = this, element = this.element, o = this.options;\n const toggle = this.toggle_element;\n\n if (toggle !== null) {\n toggle.on(Metro.events.click, function(e){\n that.toggle();\n e.stopPropagation();\n });\n } else if (o.toggle) {\n $.document().on(\"click\", o.toggle, function (e) {\n that.toggle();\n e.stopPropagation();\n })\n }\n\n if (o.static !== null && Metro.media_modes.includes(o.static)) {\n $(globalThis).on(Metro.events.resize,function(){\n that._checkStatic();\n }, {ns: this.id});\n }\n\n element.on(Metro.events.click, \".sidebar-menu .js-sidebar-close\", function(e){\n that.close();\n e.stopPropagation();\n });\n\n element.on(Metro.events.click, function(e){\n e.stopPropagation();\n });\n\n $(document).on(Metro.events.click, function(){\n if (o.closeOutside === true) {\n if (that.isOpen()) that.close()\n }\n })\n },\n\n _checkStatic: function(){\n const element = this.element, o = this.options;\n if (Metro.utils.mediaExist(o.static) && !element.hasClass(\"static\")) {\n element.addClass(\"static\");\n element.data(\"opened\", false).removeClass('open');\n if (o.shift !== null) {\n $.each(o.shift.split(\",\"), function(){\n $(this)\n .animate({\n draw: {\n left: 0\n },\n dur: o.duration\n })\n });\n }\n\n this._fireEvent(\"static-set\");\n }\n if (!Metro.utils.mediaExist(o.static)) {\n element.removeClass(\"static\");\n this._fireEvent(\"static-loss\");\n }\n },\n\n isOpen: function(){\n return this.element.data(\"opened\") === true;\n },\n\n open: function(){\n const element = this.element, o = this.options;\n\n if (element.hasClass(\"static\")) {\n return ;\n }\n\n element.data(\"opened\", true).addClass('open');\n\n if (o.shift !== null) {\n $(o.shift)\n .animate({\n draw: {\n left: element.outerWidth()\n },\n dur: o.duration\n });\n }\n\n this._fireEvent(\"open\");\n },\n\n close: function(){\n const element = this.element, o = this.options;\n\n if (element.hasClass(\"static\")) {\n return ;\n }\n\n element.data(\"opened\", false).removeClass('open');\n\n if (o.shift !== null) {\n $(o.shift)\n .animate({\n draw: {\n left: 0\n },\n dur: o.duration\n });\n }\n\n this._fireEvent(\"close\");\n },\n\n toggle: function(){\n if (this.isOpen()) {\n this.close();\n } else {\n this.open();\n }\n\n this._fireEvent(\"toggle\");\n },\n\n changeAttribute: function(){\n },\n\n destroy: function(){\n const element = this.element, o = this.options;\n const toggle = this.toggle_element;\n\n if (toggle !== null) {\n toggle.off(Metro.events.click);\n }\n\n if (o.static !== null && Metro.media_modes.includes(o.static)) {\n $(globalThis).off(Metro.events.resize, {ns: this.id});\n }\n\n element.off(Metro.events.click, \".js-sidebar-close\");\n\n return element;\n }\n });\n\n Metro['sidebar'] = {\n isSidebar: function(el){\n return Metro.utils.isMetroObject(el, \"sidebar\");\n },\n\n open: function(el){\n if (!this.isSidebar(el)) {\n return ;\n }\n Metro.getPlugin(el, \"sidebar\").open();\n },\n\n close: function(el){\n if (!this.isSidebar(el)) {\n return ;\n }\n Metro.getPlugin(el, \"sidebar\").close();\n },\n\n toggle: function(el){\n if (!this.isSidebar(el)) {\n return ;\n }\n Metro.getPlugin(el, \"sidebar\").toggle();\n },\n\n isOpen: function(el){\n if (!this.isSidebar(el)) {\n return ;\n }\n return Metro.getPlugin(el, \"sidebar\").isOpen();\n }\n };\n}(Metro, Dom));", "/* global Metro */\n(function(Metro, $) {\n 'use strict';\n\n var SidenavCounterDefaultConfig = {\n compacted: false,\n toggle: null,\n expandPoint: \"fs\",\n onMenuItemClick: Metro.noop,\n onCollapse: Metro.noop,\n onExpand: Metro.noop,\n onSidenavCreate: Metro.noop\n };\n\n Metro.sidenavCounterSetup = function (options) {\n SidenavCounterDefaultConfig = $.extend({}, SidenavCounterDefaultConfig, options);\n };\n\n if (typeof window[\"metroSidenavCounterSetup\"] !== undefined) {\n Metro.sidenavCounterSetup(window[\"metroSidenavCounterSetup\"]);\n }\n\n Metro.Component('sidenav-counter', {\n init: function( options, elem ) {\n this._super(elem, options, SidenavCounterDefaultConfig, {\n // define instance vars here\n });\n return this;\n },\n\n _create: function(){\n var that = this, element = this.element, o = this.options;\n\n this._createStructure();\n this._createEvents();\n\n this._fireEvent('sidenav-create');\n },\n\n _createStructure: function(){\n var that = this, element = this.element, o = this.options;\n\n element.addClass(\"sidenav-counter\")\n if (Metro.utils.mediaExist(o.expandPoint)) {\n element.addClass(\"expanded\");\n }\n const state = Metro.storage.getItem(\"sidenav-counter:compacted\");\n if (state === true) {\n element.removeClass(\"expanded\");\n element.addClass(\"handmade\");\n }\n },\n\n _createEvents: function(){\n var that = this, element = this.element, o = this.options;\n\n if (o.toggle) {\n $(o.toggle).on(\"click\", function() {\n element.toggleClass(\"expanded\");\n element.toggleClass(\"handmade\");\n Metro.storage.setItem(\"sidenav-counter:compacted\", !element.hasClass(\"expanded\"));\n })\n }\n\n $(globalThis).on(Metro.events.resize, () => {\n if (element.hasClass(\"handmade\")) {\n return\n }\n if (Metro.utils.mediaExist(o.expandPoint)) {\n element.addClass(\"expanded\");\n } else {\n element.removeClass(\"expanded\");\n }\n }, {ns: this.id})\n },\n\n changeAttribute: function(attr, newValue){\n },\n\n destroy: function(){\n this.element.remove();\n }\n });\n}(Metro, Dom));", "/* global Metro */\n(function(Metro, $) {\n 'use strict';\n var Utils = Metro.utils;\n var SorterDefaultConfig = {\n sorterDeferred: 0,\n thousandSeparator: \",\",\n decimalSeparator: \",\",\n sortTarget: null,\n sortSource: null,\n sortDir: \"asc\",\n sortStart: true,\n saveInitial: true,\n onSortStart: Metro.noop,\n onSortStop: Metro.noop,\n onSortItemSwitch: Metro.noop,\n onSorterCreate: Metro.noop\n };\n\n Metro.sorterSetup = function (options) {\n SorterDefaultConfig = $.extend({}, SorterDefaultConfig, options);\n };\n\n if (typeof globalThis[\"metroSorterSetup\"] !== undefined) {\n Metro.sorterSetup(globalThis[\"metroSorterSetup\"]);\n }\n\n Metro.Component('sorter', {\n init: function( options, elem ) {\n this._super(elem, options, SorterDefaultConfig, {\n initial: []\n });\n\n return this;\n },\n\n _create: function(){\n var element = this.element;\n\n this._createStructure();\n\n this._fireEvent(\"sorter-create\", {\n element: element\n });\n },\n\n _createStructure: function(){\n var element = this.element, o = this.options;\n\n if (o.sortTarget === null) {\n o.sortTarget = element.children()[0].tagName;\n }\n\n this.initial = element.find(o.sortTarget).get();\n\n if (o.sortStart === true) {\n this.sort(o.sortDir);\n }\n },\n\n _getItemContent: function(item){\n var o = this.options;\n var data, inset, i, format;\n\n if (Utils.isValue(o.sortSource)) {\n data = \"\";\n inset = item.getElementsByClassName(o.sortSource);\n\n if (inset.length > 0) for (i = 0; i < inset.length; i++) {\n data += inset[i].textContent;\n }\n format = inset[0].dataset.format;\n } else {\n data = item.textContent;\n format = item.dataset.format;\n }\n\n data = (\"\"+data).toLowerCase().replace(/[\\n\\r]+|[\\s]{2,}/g, ' ').trim();\n\n if (Utils.isValue(format)) {\n\n if (['number', 'int', 'float', 'money'].indexOf(format) !== -1 && (o.thousandSeparator !== \",\" || o.decimalSeparator !== \".\" )) {\n data = Utils.parseNumber(data, o.thousandSeparator, o.decimalSeparator);\n }\n\n switch (format) {\n case \"date\": data = Utils.isDate(data) ? new Date(data) : \"\"; break;\n case \"number\": data = Number(data); break;\n case \"int\": data = parseInt(data); break;\n case \"float\": data = parseFloat(data); break;\n case \"money\": data = Utils.parseMoney(data); break;\n case \"card\": data = Utils.parseCard(data); break;\n case \"phone\": data = Utils.parsePhone(data); break;\n }\n }\n\n return data;\n },\n\n sort: function(dir){\n var that = this, element = this.element, o = this.options;\n var items;\n var id = Utils.elementId(\"temp\");\n var prev;\n\n if (dir !== undefined) {\n o.sortDir = dir;\n }\n\n items = element.find(o.sortTarget).get();\n\n if (items.length === 0) {\n return ;\n }\n\n prev = $(\"
            \").attr(\"id\", id).insertBefore($(element.find(o.sortTarget)[0]));\n\n this._fireEvent(\"sort-start\", {\n items: items\n });\n\n items.sort(function(a, b){\n var c1 = that._getItemContent(a);\n var c2 = that._getItemContent(b);\n var result = 0;\n\n if (c1 < c2 ) {\n result = -1;\n }\n\n if (c1 > c2 ) {\n result = 1;\n }\n\n if (result !== 0) {\n that._fireEvent(\"sort-item-switch\", {\n a: a,\n b: b,\n result: result\n });\n }\n\n return result;\n });\n\n if (o.sortDir === \"desc\") {\n items.reverse();\n }\n\n element.find(o.sortTarget).remove();\n\n $.each(items, function(){\n var $this = $(this);\n $this.insertAfter(prev);\n prev = $this;\n });\n\n $(\"#\"+id).remove();\n\n this._fireEvent(\"sort-stop\", {\n items: items\n });\n },\n\n reset: function(){\n var element = this.element, o = this.options;\n var items;\n var id = Utils.elementId('sorter');\n var prev;\n\n items = this.initial;\n\n if (items.length === 0) {\n return ;\n }\n\n prev = $(\"
            \").attr(\"id\", id).insertBefore($(element.find(o.sortTarget)[0]));\n\n element.find(o.sortTarget).remove();\n\n $.each(items, function(){\n var $this = $(this);\n $this.insertAfter(prev);\n prev = $this;\n });\n\n $(\"#\"+id).remove();\n },\n\n changeAttribute: function(attributeName){\n var that = this, element = this.element, o = this.options;\n\n var changeSortDir = function() {\n var dir = element.attr(\"data-sort-dir\").trim();\n if (dir === \"\") return;\n o.sortDir = dir;\n that.sort();\n };\n\n var changeSortContent = function(){\n var content = element.attr(\"data-sort-content\").trim();\n if (content === \"\") return ;\n o.sortContent = content;\n that.sort();\n };\n\n switch (attributeName) {\n case \"data-sort-dir\": changeSortDir(); break;\n case \"data-sort-content\": changeSortContent(); break;\n }\n },\n\n destroy: function(){\n return this.element;\n }\n });\n\n Metro['sorter'] = {\n create: function(el, op){\n return Utils.$()(el).sorter(op);\n },\n\n isSorter: function(el){\n return Utils.isMetroObject(el, \"sorter\");\n },\n\n sort: function(el, dir){\n if (!this.isSorter(el)) {\n return false;\n }\n if (dir === undefined) {\n dir = \"asc\";\n }\n Metro.getPlugin(el, \"sorter\").sort(dir);\n },\n\n reset: function(el){\n if (!this.isSorter(el)) {\n return false;\n }\n Metro.getPlugin(el, \"sorter\").reset();\n }\n };\n}(Metro, Dom));", "/* global Metro */\n(function(Metro, $) {\n 'use strict';\n\n const SPLIT_MODE = {\n VERTICAL: \"vertical\",\n HORIZONTAL: \"horizontal\",\n }\n\n\n const Storage = Metro.storage;\n let SplitterDefaultConfig = {\n splitterDeferred: 0,\n split: SPLIT_MODE.VERTICAL, // horizontal or vertical\n splitSizes: null,\n gutterSize: 5,\n gutterStyle: \"default\", // ribbed, dashed, dotted, default\n minSizes: null,\n children: \"*\",\n gutterClick: \"expand\", // TODO expand or collapse\n saveState: false,\n noResize: false,\n onResizeStart: Metro.noop,\n onResizeStop: Metro.noop,\n onResizeSplit: Metro.noop,\n onResizeWindow: Metro.noop,\n onSplitterCreate: Metro.noop\n };\n\n Metro.splitterSetup = function (options) {\n SplitterDefaultConfig = $.extend({}, SplitterDefaultConfig, options);\n };\n\n if (typeof globalThis[\"metroSplitterSetup\"] !== \"undefined\") {\n Metro.splitterSetup(globalThis[\"metroSplitterSetup\"]);\n }\n\n Metro.Component('splitter', {\n init: function( options, elem ) {\n this._super(elem, options, SplitterDefaultConfig, {\n storage: Metro.utils.isValue(Storage) ? Storage : null,\n storageKey: \"SPLITTER:\",\n id: Metro.utils.elementId(\"splitter\")\n });\n\n return this;\n },\n\n _create: function(){\n const element = this.element;\n\n this._createStructure();\n this._createEvents();\n\n this._fireEvent(\"splitter-create\", {\n element: element\n });\n },\n\n _createStructure: function(){\n const element = this.element, o = this.options;\n const children = element.children(o.children).addClass(\"split-block\");\n let i, children_sizes = [];\n const resizeProp = o.split === SPLIT_MODE.HORIZONTAL ? \"height\" : \"width\";\n\n element.addClass(\"splitter\");\n element.addClass((o.split.toLowerCase() === SPLIT_MODE.VERTICAL) ? \"vertical\" : \"horizontal\");\n\n if (o.gutterStyle !== \"default\") {\n element.addClass(`gutter-style-${o.gutterStyle}`);\n }\n \n if (o.noResize === true) {\n element.addClass(\"static-size\")\n }\n\n for (i = 0; i < children.length - 1; i++) {\n $(\"
            \").addClass(\"gutter\").css(resizeProp, o.gutterSize).insertAfter($(children[i]));\n }\n\n this._setSize();\n\n if (Metro.utils.isValue(o.minSizes)) {\n if ((\"\"+o.minSizes).includes(\",\")) {\n children_sizes = o.minSizes.toArray();\n for (i = 0; i < children_sizes.length; i++) {\n $(children[i]).data(\"min-size\", children_sizes[i]);\n children[i].style.setProperty('min-'+resizeProp, (\"\"+children_sizes[i]).includes(\"%\") ? children_sizes[i] : (\"\"+children_sizes[i]).replace(\"px\", \"\")+\"px\", 'important');\n }\n } else {\n $.each(children, function(){\n this.style.setProperty('min-'+resizeProp, (\"\"+o.minSizes).includes(\"%\") ? o.minSizes : (\"\"+o.minSizes).replace(\"px\", \"\")+\"px\", 'important');\n });\n }\n }\n\n if (o.saveState && this.storage !== null) {\n this._getSize();\n }\n },\n\n _setSize: function(){\n const element = this.element, o = this.options;\n let gutters, children_sizes;\n const children = element.children(\".split-block\");\n const w = element.width();\n\n gutters = element.children(\".gutter\");\n\n if (!Metro.utils.isValue(o.splitSizes)) {\n children.css({\n flexBasis: `calc(${100/children.length}% - ${gutters.length * o.gutterSize}px)`\n })\n } else {\n children_sizes = (\"\"+o.splitSizes).toArray();\n let remnant = 100\n let i = 0\n for(; i < children_sizes.length; i++) {\n let s = children_sizes[i];\n if (!s.includes(\"%\")) {\n s = +s * 100 / w\n } else {\n s = parseInt(s);\n }\n remnant -= s;\n $(children[i]).css({\n flexBasis: `calc(${s}% - ${gutters.length * o.gutterSize}px)`\n });\n }\n for (; i < children.length; i++) {\n $(children[i]).css({\n flexBasis: `calc(${remnant/(children.length - i)}% - ${gutters.length * o.gutterSize}px)`\n });\n }\n }\n },\n\n _createEvents: function(){\n const that = this, element = this.element, o = this.options;\n const gutters = element.children(\".gutter\");\n\n gutters.on(Metro.events.startAll, function(e){\n if (o.noResize === true) {\n return false\n }\n\n const w = o.split === SPLIT_MODE.VERTICAL ? element.width() : element.height();\n const gutter = $(this);\n const prev_block = gutter.prev(\".split-block\");\n const next_block = gutter.next(\".split-block\");\n const prev_block_size = 100 * (o.split === SPLIT_MODE.VERTICAL ? prev_block.outerWidth(true) : prev_block.outerHeight(true)) / w;\n const next_block_size = 100 * (o.split === SPLIT_MODE.VERTICAL ? next_block.outerWidth(true) : next_block.outerHeight(true)) / w;\n const start_pos = Metro.utils.getCursorPosition(element[0], e);\n\n gutter.addClass(\"active\");\n\n prev_block.addClass(\"stop-pointer\");\n next_block.addClass(\"stop-pointer\");\n\n that._fireEvent(\"resize-start\", {\n pos: start_pos,\n gutter: gutter[0],\n prevBlock: prev_block[0],\n nextBlock: next_block[0]\n });\n\n $(globalThis).on(Metro.events.moveAll, function(e){\n const pos = Metro.utils.getCursorPosition(element[0], e);\n let new_pos;\n\n if (o.split === SPLIT_MODE.VERTICAL) {\n new_pos = (pos.x * 100 / w) - (start_pos.x * 100 / w);\n\n } else {\n new_pos = (pos.y * 100 / w) - (start_pos.y * 100 / w);\n }\n\n prev_block.css(\"flex-basis\", \"calc(\" + (prev_block_size + new_pos) + \"% - \"+(gutters.length * o.gutterSize)+\"px)\");\n next_block.css(\"flex-basis\", \"calc(\" + (next_block_size - new_pos) + \"% - \"+(gutters.length * o.gutterSize)+\"px)\");\n\n that._fireEvent(\"resize-split\", {\n pos: pos,\n gutter: gutter[0],\n prevBlock: prev_block[0],\n nextBlock: next_block[0]\n });\n\n }, {ns: that.id});\n\n $(globalThis).on(Metro.events.stopAll, function(e){\n let cur_pos;\n\n prev_block.removeClass(\"stop-pointer\");\n next_block.removeClass(\"stop-pointer\");\n\n that._saveSize();\n\n gutter.removeClass(\"active\");\n\n $(globalThis).off(Metro.events.moveAll,{ns: that.id});\n $(globalThis).off(Metro.events.stopAll,{ns: that.id});\n\n cur_pos = Metro.utils.getCursorPosition(element[0], e);\n\n that._fireEvent(\"resize-stop\", {\n pos: cur_pos,\n gutter: gutter[0],\n prevBlock: prev_block[0],\n nextBlock: next_block[0]\n });\n\n }, {ns: that.id})\n }, {passive: true});\n\n $(globalThis).on(Metro.events.resize, function(){\n const gutter = element.children(\".gutter\");\n const prev_block = gutter.prev(\".split-block\");\n const next_block = gutter.next(\".split-block\");\n\n that._fireEvent(\"resize-window\", {\n prevBlock: prev_block[0],\n nextBlock: next_block[0]\n });\n\n }, {ns: that.id});\n },\n\n _saveSize: function(){\n const element = this.element, o = this.options;\n const storage = this.storage, itemsSize = [];\n const id = element.attr(\"id\") || this.id;\n\n if (o.saveState === true && storage !== null) {\n\n $.each(element.children(\".split-block\"), function(){\n const item = $(this);\n itemsSize.push(item.css(\"flex-basis\"));\n });\n\n if (storage)\n storage.setItem(this.storageKey + id, itemsSize);\n }\n },\n\n _getSize: function(){\n const element = this.element, o = this.options;\n let storage = this.storage, itemsSize = [];\n const id = element.attr(\"id\") || this.id;\n\n if (o.saveState === true && storage !== null) {\n\n itemsSize = storage.getItem(this.storageKey + id);\n\n $.each(element.children(\".split-block\"), function(i, v){\n const item = $(v);\n if (Metro.utils.isValue(itemsSize) && Metro.utils.isValue(itemsSize[i])) item.css(\"flex-basis\", itemsSize[i]);\n });\n }\n },\n\n size: function(size){\n const that = this, o = this.options;\n if (Metro.utils.isValue(size)) {\n o.splitSizes = size;\n that._setSize();\n }\n return this;\n },\n\n changeAttribute: function(attributeName){\n const that = this, element = this.element;\n\n function changeSize(){\n const size = element.attr(\"data-split-sizes\");\n that.size(size);\n }\n\n if (attributeName === 'data-split-sizes') {\n changeSize();\n }\n },\n\n destroy: function(){\n const element = this.element;\n const gutters = element.children(\".gutter\");\n gutters.off(Metro.events.start);\n return element.remove();\n }\n });\n}(Metro, Dom));", "/* global Metro */\n(function(Metro, $) {\n 'use strict';\n var StepperDefaultConfig = {\n stepperDeferred: 0,\n view: Metro.stepperView.SQUARE, // square, cycle, diamond\n steps: 3,\n step: 1,\n stepClick: false,\n clsStepper: \"\",\n clsStep: \"\",\n clsComplete: \"\",\n clsCurrent: \"\",\n onStep: Metro.noop,\n onStepClick: Metro.noop,\n onStepperCreate: Metro.noop\n };\n\n Metro.stepperSetup = function (options) {\n StepperDefaultConfig = $.extend({}, StepperDefaultConfig, options);\n };\n\n if (typeof globalThis[\"metroStepperSetup\"] !== undefined) {\n Metro.stepperSetup(globalThis[\"metroStepperSetup\"]);\n }\n\n Metro.Component('stepper', {\n init: function( options, elem ) {\n this._super(elem, options, StepperDefaultConfig, {\n current: 0\n });\n\n return this;\n },\n\n _create: function(){\n var element = this.element, o = this.options;\n\n if (o.step <= 0) {\n o.step = 1;\n }\n\n this._createStepper();\n this._createEvents();\n\n this._fireEvent(\"stepper-create\", {\n element: element\n });\n },\n\n _createStepper: function(){\n var element = this.element, o = this.options;\n var i;\n\n element.addClass(\"stepper\").addClass(o.view).addClass(o.clsStepper);\n\n for(i = 1; i <= o.steps; i++) {\n $(\"\").addClass(\"step\").addClass(o.clsStep).data(\"step\", i).html(\"\"+i+\"\").appendTo(element);\n }\n\n this.current = 1;\n this.toStep(o.step);\n },\n\n _createEvents: function(){\n var that = this, element = this.element, o = this.options;\n\n element.on(Metro.events.click, \".step\", function(){\n var step = $(this).data(\"step\");\n if (o.stepClick === true) {\n that.toStep(step);\n\n that._fireEvent(\"step-click\", {\n step: step\n });\n }\n });\n },\n\n next: function(){\n var element = this.element;\n var steps = element.find(\".step\");\n\n if (this.current + 1 > steps.length) {\n return ;\n }\n\n this.current++;\n\n this.toStep(this.current);\n },\n\n prev: function(){\n if (this.current - 1 === 0) {\n return ;\n }\n\n this.current--;\n\n this.toStep(this.current);\n },\n\n last: function(){\n var element = this.element;\n\n this.toStep(element.find(\".step\").length);\n },\n\n first: function(){\n this.toStep(1);\n },\n\n toStep: function(step){\n var element = this.element, o = this.options;\n var target = $(element.find(\".step\").get(step - 1));\n var prevStep = this.current;\n\n if (target.length === 0) {\n return ;\n }\n\n this.current = step;\n\n element.find(\".step\")\n .removeClass(\"complete current\")\n .removeClass(o.clsCurrent)\n .removeClass(o.clsComplete);\n\n target.addClass(\"current\").addClass(o.clsCurrent);\n target.prevAll().addClass(\"complete\").addClass(o.clsComplete);\n\n this._fireEvent(\"step\", {\n step: this.current,\n prev: prevStep\n });\n\n },\n\n changeAttribute: function(){\n },\n\n destroy: function(){\n var element = this.element;\n element.off(Metro.events.click, \".step\");\n return element;\n }\n });\n}(Metro, Dom));", "/* global Metro */\n(function(Metro) {\n 'use strict';\n\n const MetroStorage = function (type) {\n return new MetroStorage.init(type);\n };\n\n MetroStorage.prototype = {\n setKey: function(key){\n this.key = key\n },\n\n getKey: function(){\n return this.key;\n },\n\n setItem: function(key, value){\n this.storage.setItem(this.key + \":\" + key, JSON.stringify(value));\n },\n\n getItem: function(key, default_value, reviver){\n let result, value;\n\n value = this.storage.getItem(this.key + \":\" + key);\n\n try {\n result = JSON.parse(value, reviver);\n } catch (e) {\n result = null;\n }\n return Metro.utils.nvl(result, default_value);\n },\n\n getItemPart: function(key, sub_key, default_value, reviver){\n let i;\n let val = this.getItem(key, default_value, reviver);\n\n sub_key = sub_key.split(\"->\");\n for(i = 0; i < sub_key.length; i++) {\n val = val[sub_key[i]];\n }\n return val;\n },\n\n delItem: function(key){\n this.storage.removeItem(this.key + \":\" + key)\n },\n\n size: function(unit){\n let divider;\n switch (unit) {\n case 'm':\n case 'M': {\n divider = 1024 * 1024;\n break;\n }\n case 'k':\n case 'K': {\n divider = 1024;\n break;\n }\n default: divider = 1;\n }\n return JSON.stringify(this.storage).length / divider;\n }\n };\n\n MetroStorage.init = function(type){\n\n this.key = \"\";\n this.storage = type ? type : globalThis.localStorage;\n\n return this;\n };\n\n MetroStorage.init.prototype = MetroStorage.prototype;\n\n Metro.storage = MetroStorage(globalThis.localStorage);\n Metro.session = MetroStorage(globalThis.sessionStorage);\n}(Metro));", "/* global Metro, METRO_ANIMATION_DURATION, Cake */\n(function(Metro, $) {\n 'use strict';\n var Utils = Metro.utils;\n var StreamerDefaultConfig = {\n streamerDeferred: 0,\n wheel: true,\n wheelStep: 20,\n duration: METRO_ANIMATION_DURATION,\n defaultClosedIcon: \"\",\n defaultOpenIcon: \"\",\n changeUri: true,\n encodeLink: true,\n closed: false,\n chromeNotice: false,\n startFrom: null,\n slideToStart: true,\n startSlideSleep: 1000,\n source: null,\n data: null,\n eventClick: \"select\",\n selectGlobal: true,\n streamSelect: false,\n excludeSelectElement: null,\n excludeClickElement: null,\n excludeElement: null,\n excludeSelectClass: \"\",\n excludeClickClass: \"\",\n excludeClass: \"\",\n\n onDataLoad: Metro.noop,\n onDataLoaded: Metro.noop,\n onDataLoadError: Metro.noop,\n\n onDrawEvent: Metro.noop,\n onDrawGlobalEvent: Metro.noop,\n onDrawStream: Metro.noop,\n\n onStreamClick: Metro.noop,\n onStreamSelect: Metro.noop,\n onEventClick: Metro.noop,\n onEventSelect: Metro.noop,\n onEventsScroll: Metro.noop,\n onStreamerCreate: Metro.noop\n };\n\n Metro.streamerSetup = function (options) {\n StreamerDefaultConfig = $.extend({}, StreamerDefaultConfig, options);\n };\n\n if (typeof globalThis[\"metroStreamerSetup\"] !== undefined) {\n Metro.streamerSetup(globalThis[\"metroStreamerSetup\"]);\n }\n\n Metro.Component('streamer', {\n init: function( options, elem ) {\n this._super(elem, options, StreamerDefaultConfig, {\n data: null,\n scroll: 0,\n scrollDir: \"left\",\n events: null\n });\n\n return this;\n },\n\n _create: function(){\n var element = this.element, o = this.options;\n\n element.addClass(\"streamer\");\n\n if (element.attr(\"id\") === undefined) {\n element.attr(\"id\", Utils.elementId(\"streamer\"));\n }\n\n if (o.source === null && o.data === null) {\n return false;\n }\n\n $(\"
            \").addClass(\"streams\").appendTo(element);\n $(\"
            \").addClass(\"events-area\").appendTo(element);\n\n if (o.source !== null) {\n\n this._fireEvent(\"data-load\", {\n source: o.source\n });\n\n this._loadSource();\n } else {\n this.data = o.data;\n this.build();\n }\n\n // TODO Fix mouse scroll\n // if (o.chromeNotice === true && Utils.detectChrome() === true && $.touchable === false) {\n // $(\"

            \").addClass(\"text-small text-muted\").html(\"*) In Chrome browser please press and hold Shift and turn the mouse wheel.\").insertAfter(element);\n // }\n },\n\n _loadSource: function(){\n var that = this, o = this.options;\n\n fetch(o.source)\n .then(Metro.fetch.status)\n .then(Metro.fetch.json)\n .then(function(data){\n that._fireEvent(\"data-loaded\", {\n source: o.source,\n data: data\n });\n\n that.data = data;\n that.build();\n })\n .catch(function (error) {\n that._fireEvent(\"data-load-error\", {\n source: o.source,\n error: error\n });\n });\n },\n\n build: function(){\n var that = this, element = this.element, o = this.options, data = this.data;\n var streams = element.find(\".streams\").html(\"\");\n var events_area = element.find(\".events-area\").html(\"\");\n var fake_timeline;\n var timeline = $(\"

              \").addClass(\"streamer-timeline\").html(\"\").appendTo(events_area);\n var streamer_events = $(\"
              \").addClass(\"streamer-events\").appendTo(events_area);\n var event_group_main = $(\"
              \").addClass(\"event-group\").appendTo(streamer_events);\n var StreamerIDS = Utils.getURIParameter(null, \"StreamerIDS\");\n\n if (StreamerIDS !== null && o.encodeLink === true) {\n StreamerIDS = atob(StreamerIDS);\n }\n\n var StreamerIDS_i = StreamerIDS ? StreamerIDS.split(\"|\")[0] : null;\n var StreamerIDS_a = StreamerIDS ? StreamerIDS.split(\"|\")[1].split(\",\") : [];\n\n if (data.actions !== undefined) {\n var actions = $(\"
              \").addClass(\"streamer-actions\").appendTo(streams);\n $.each(data.actions, function(){\n var item = this;\n var button = $(\"\" +\n \"\" +\n \"\",\n )\n .appendTo(row);\n tds[that.view[i][\"index-view\"]] = row;\n });\n\n //\n for (j = 0; j < cells.length; j++) {\n tds[j].appendTo(table);\n }\n },\n\n _createInspector: function () {\n var o = this.options,\n strings = this.strings;\n var inspector, table_wrap, table, tbody, actions;\n\n inspector = $(\"
              \").addClass(\"table-inspector\");\n inspector.attr(\"for\", this.element.attr(\"id\"));\n\n $(\"
              \" + (o.inspectorTitle || strings.label_inspector) + \"
              \").appendTo(inspector);\n\n table_wrap = $(\"
              \").addClass(\"table-wrap\").appendTo(inspector);\n\n table = $(\"\").addClass(\"table subcompact\");\n tbody = $(\"\").appendTo(table);\n\n table.appendTo(table_wrap);\n\n this._createInspectorItems(tbody);\n\n actions = $(\"
              \").appendTo(inspector);\n $(\"
              \");\n element.prepend(head);\n }\n\n head.clear().addClass(o.clsHead);\n\n if (o.caption) {\n $(\"\").addClass(o.clsHeadRow).appendTo(head);\n\n $.each(this.service, function () {\n var item = this,\n classes = [];\n var th = $(\"\").addClass(this.options.clsBody);\n if (head.length !== 0) {\n body.insertAfter(head);\n } else {\n element.append(body);\n }\n }\n\n body.clear();\n },\n\n _createTableFooter: function () {\n var element = this.element,\n o = this.options;\n var foot = element.find(\"tfoot\");\n var tr, th;\n\n if (foot.length === 0) {\n foot = $(\"\").appendTo(element);\n }\n\n foot.clear().addClass(o.clsFooter);\n\n if (this.foots.length === 0) {\n return;\n }\n\n tr = $(\"\").addClass(o.clsHeadRow).appendTo(foot);\n $.each(this.foots, function () {\n var item = this;\n th = $(\"\").addClass(o.clsBodyRow);\n tr.data(\"original\", cells);\n\n // Rownum\n\n is_even_row = i % 2 === 0;\n\n td = $(\"\").addClass(o.clsBodyRow).appendTo(body);\n td = $(\"\").appendTo(table);\n var body = $(\"\").appendTo(table);\n var i,\n j,\n cells,\n tds = [],\n items,\n tr,\n td;\n var start, stop;\n\n if (typeof Export.tableToCSV !== \"function\") {\n return;\n }\n\n mode = Utils.isValue(mode) ? mode.toLowerCase() : \"all-filtered\";\n filename = Utils.isValue(filename) ? filename : Utils.elementId(\"table\") + \"-export.csv\";\n\n // Create table header\n tr = $(\"\");\n cells = this.heads;\n\n for (j = 0; j < cells.length; j++) {\n tds[j] = null;\n }\n\n $.each(cells, function (cell_index) {\n var item = this;\n if (Utils.bool(that.view[cell_index][\"show\"]) === false) {\n return;\n }\n td = $(\"\");\n\n cells = items[i];\n\n for (j = 0; j < cells.length; j++) {\n tds[j] = null;\n }\n\n $.each(cells, function (cell_index) {\n if (Utils.bool(that.view[cell_index].show) === false) {\n return;\n }\n td = $(\"
              \").html(o.caption).insertBefore(head);\n }\n \n if (this.heads.length === 0) {\n return head;\n }\n\n tr = $(\"
              \");\n if (Utils.isValue(item.title)) {\n th.html(item.title);\n }\n if (Utils.isValue(item.size)) {\n th.css({ width: item.size });\n }\n if (Utils.isValue(item.cls)) {\n classes.push(item.cls);\n }\n classes.push(o.clsHeadCell);\n th.addClass(classes.join(\" \"));\n tr.append(th);\n });\n\n cells = this.heads;\n\n for (j = 0; j < cells.length; j++) {\n tds[j] = null;\n }\n\n $.each(cells, function (cell_index) {\n var item = this;\n var classes = [];\n\n var th = $(\"\");\n th.data(\"index\", cell_index);\n\n if (Utils.isValue(item.title)) {\n th.html(item.title);\n }\n if (Utils.isValue(item.format)) {\n th.attr(\"data-format\", item.format);\n }\n if (Utils.isValue(item.formatMask)) {\n th.attr(\"data-format-mask\", item.formatMask);\n }\n if (Utils.isValue(item.name)) {\n th.attr(\"data-name\", item.name);\n }\n if (Utils.isValue(item.colspan)) {\n th.attr(\"colspan\", item.colspan);\n }\n if (Utils.isValue(item.size)) {\n th.attr(\"data-size\", item.size);\n }\n if (Utils.isValue(item.sortable)) {\n th.attr(\"data-sortable\", item.sortable);\n }\n if (Utils.isValue(item.sortDir)) {\n th.attr(\"data-sort-dir\", item.sortDir);\n }\n if (Utils.isValue(item.clsColumn)) {\n th.attr(\"data-cls-column\", item.clsColumn);\n }\n if (Utils.isValue(item.cls)) {\n th.attr(\"data-cls\", item.cls);\n }\n if (Utils.isValue(item.show)) {\n th.attr(\"data-show\", item.show);\n }\n if (Utils.isValue(item.required)) {\n th.attr(\"data-required\", item.required);\n }\n if (Utils.isValue(item.field)) {\n th.attr(\"data-field\", item.field);\n }\n if (Utils.isValue(item.fieldType)) {\n th.attr(\"data-field-type\", item.fieldType);\n }\n if (Utils.isValue(item.validator)) {\n th.attr(\"data-validator\", item.validator);\n }\n if (Utils.isValue(item.template)) {\n th.attr(\"data-template\", item.template);\n }\n if (Utils.isValue(view[cell_index][\"size\"])) {\n th.css({ width: view[cell_index][\"size\"] });\n }\n if (item.sortable === true) {\n classes.push(\"sortable-column\");\n\n if (Utils.isValue(item.sortDir)) {\n classes.push(\"sort-\" + item.sortDir);\n }\n }\n if (Utils.isValue(item.cls)) {\n $.each(item.cls.toArray(), function () {\n classes.push(this);\n });\n }\n if (Utils.bool(view[cell_index][\"show\"]) === false) {\n if (classes.indexOf(\"hidden\") === -1) classes.push(\"hidden\");\n }\n\n classes.push(o.clsHeadCell);\n\n if (Utils.bool(view[cell_index][\"show\"])) {\n Utils.arrayDelete(classes, \"hidden\");\n }\n\n th.addClass(classes.join(\" \"));\n\n tds[view[cell_index][\"index-view\"]] = th;\n });\n\n for (j = 0; j < cells.length; j++) {\n tds[j].appendTo(tr);\n }\n },\n\n _createTableBody: function () {\n var body,\n head,\n element = this.element;\n\n head = element.find(\"thead\");\n body = element.find(\"tbody\");\n\n if (body.length === 0) {\n body = $(\"
              \").appendTo(tr);\n\n if (item.title !== undefined) {\n th.html(item.title);\n }\n\n if (item.name !== undefined) {\n th.addClass(\"foot-column-name-\" + item.name);\n }\n\n if (item.cls !== undefined) {\n th.addClass(item.cls);\n }\n\n if (Utils.isValue(item.colspan)) {\n th.attr(\"colspan\", item.colspan);\n }\n\n th.appendTo(tr);\n });\n },\n\n _createTopBlock: function () {\n var that = this,\n element = this.element,\n o = this.options,\n strings = this.strings;\n var top_block = $(\"
              \").addClass(\"table-top\").addClass(o.clsTableTop).insertBefore(element.parent());\n var search_block, search_input, rows_block, rows_select;\n\n search_block = Utils.isValue(this.wrapperSearch)\n ? this.wrapperSearch\n : $(\"
              \").addClass(\"table-search-block\").addClass(o.clsSearch).appendTo(top_block);\n search_block.addClass(o.clsSearch);\n\n search_input = $(\"\").attr(\"type\", \"text\").attr(\"placeholder\", o.tableSearchPlaceholder).appendTo(search_block);\n Metro.makePlugin(search_input, \"input\", {\n prepend: o.tableSearchTitle || strings.label_search,\n });\n\n if (o.showSearch !== true) {\n search_block.hide();\n }\n\n rows_block = Utils.isValue(this.wrapperRows) ? this.wrapperRows : $(\"
              \").addClass(\"table-rows-block\").appendTo(top_block);\n rows_block.addClass(o.clsRowsCount);\n\n rows_select = $(\"`).addClass(\"table-skip-input\").addClass(o.clsTableSkipInput).appendTo(skip);\n $(\"
              \")\n .attr(\"data-label\", \"#\")\n .attr(\"aria-label\", \"#\")\n .html(i + 1);\n if (that.service[0].clsColumn !== undefined) {\n td.addClass(that.service[0].clsColumn);\n }\n td.appendTo(tr);\n\n // Checkbox\n td = $(\"\")\n .attr(\"data-label\", \"CHK\")\n .attr(\"aria-label\", \"CHK\")\n \n if (o.checkType === \"checkbox\") {\n check = $(\n \"\",\n );\n } else {\n check = $(\n \"\",\n );\n }\n\n if (Utils.isValue(stored_keys) && Array.isArray(stored_keys) && stored_keys.indexOf(\"\" + items[i][o.checkColIndex]) > -1) {\n check.prop(\"checked\", true);\n checkedItems.push(cells);\n }\n\n check.addClass(\"table-service-check\");\n\n this._fireEvent(\"check-draw\", {\n check: check,\n });\n\n check.appendTo(td);\n if (that.service[1].clsColumn !== undefined) {\n td.addClass(that.service[1].clsColumn);\n }\n td.appendTo(tr);\n // End of check\n\n for (j = 0; j < cells.length; j++) {\n tds[j] = null;\n }\n\n $.each(cells, function (cell_index) {\n var val = this;\n var td = $(\"\")\n .attr(\"data-label\", that.heads[cell_index].title)\n .attr(\"aria-label\", that.heads[cell_index].title);\n\n if (Utils.isValue(that.heads[cell_index].template)) {\n val = that.heads[cell_index].template.replace(/%VAL%/g, val);\n }\n\n td.html(val);\n\n td.addClass(o.clsBodyCell);\n if (Utils.isValue(that.heads[cell_index].clsColumn)) {\n td.addClass(that.heads[cell_index].clsColumn);\n }\n\n if (Utils.bool(view[cell_index].show) === false) {\n td.addClass(\"hidden\");\n }\n\n if (Utils.bool(view[cell_index].show)) {\n td.removeClass(\"hidden\");\n }\n\n td.data(\"original\", this);\n\n tds[view[cell_index][\"index-view\"]] = td;\n\n that._fireEvent(\"draw-cell\", {\n td: td,\n val: val,\n cellIndex: cell_index,\n head: that.heads[cell_index],\n items: cells,\n });\n\n if (o.cellWrapper === true) {\n val = $(\"
              \").addClass(\"data-wrapper\").addClass(o.clsCellWrapper).html(td.html());\n td.html(\"\").append(val);\n }\n });\n\n for (j = 0; j < cells.length; j++) {\n tds[j].appendTo(tr);\n\n that._fireEvent(\"append-cell\", {\n td: tds[j],\n tr: tr,\n index: j,\n });\n }\n\n that._fireEvent(\"draw-row\", {\n tr: tr,\n view: that.view,\n heads: that.heads,\n items: cells,\n });\n\n tr.addClass(o.clsRow)\n .addClass(is_even_row ? o.clsEvenRow : o.clsOddRow)\n .appendTo(body);\n\n that._fireEvent(\"append-row\", {\n tr: tr,\n });\n }\n\n $(this.component).find(\".table-service-check-all input\").prop(\"checked\", checkedItems.length);\n } else {\n j = 0;\n $.each(view, function () {\n if (this.show) j++;\n });\n if (o.check === true) {\n j++;\n }\n if (o.rownum === true) {\n j++;\n }\n tr = $(\"
              \")\n .attr(\"colspan\", j)\n .addClass(\"text-center\")\n .html(\n $(\"\")\n .addClass(o.clsEmptyTableTitle)\n .html(o.emptyTableTitle || strings.label_empty),\n );\n td.appendTo(tr);\n }\n\n this._info(start + 1, stop + 1, items.length);\n this._paging(items.length);\n\n if (this.activity) this.activity.hide();\n\n this._fireEvent(\"draw\");\n\n if (cb !== undefined) {\n Utils.exec(cb, null, element[0]);\n }\n },\n\n _getItemContent: function (row) {\n var o = this.options,\n locale = this.locale;\n var result,\n col = row[this.sort.colIndex];\n var format = this.heads[this.sort.colIndex].format;\n var formatMask =\n !Utils.isNull(this.heads) && !Utils.isNull(this.heads[this.sort.colIndex]) && Utils.isValue(this.heads[this.sort.colIndex][\"formatMask\"])\n ? this.heads[this.sort.colIndex][\"formatMask\"]\n : \"%Y-%m-%d\";\n var thousandSeparator =\n this.heads && this.heads[this.sort.colIndex] && this.heads[this.sort.colIndex][\"thousandSeparator\"]\n ? this.heads[this.sort.colIndex][\"thousandSeparator\"]\n : o.thousandSeparator;\n var decimalSeparator =\n this.heads && this.heads[this.sort.colIndex] && this.heads[this.sort.colIndex][\"decimalSeparator\"]\n ? this.heads[this.sort.colIndex][\"decimalSeparator\"]\n : o.decimalSeparator;\n\n result = (\"\" + col)\n .toLowerCase()\n .replace(/[\\n\\r]+|[\\s]{2,}/g, \" \")\n .trim();\n\n if (Utils.isValue(result) && Utils.isValue(format)) {\n if ([\"number\", \"int\", \"float\", \"money\"].indexOf(format) !== -1) {\n result = Utils.parseNumber(result, thousandSeparator, decimalSeparator);\n }\n\n switch (format) {\n case \"date\":\n result = formatMask ? Datetime.from(result, formatMask, locale) : datetime(result);\n break;\n case \"number\":\n result = +result;\n break;\n case \"int\":\n result = parseInt(result);\n break;\n case \"float\":\n result = parseFloat(result);\n break;\n case \"money\":\n result = Utils.parseMoney(result);\n break;\n case \"card\":\n result = Utils.parseCard(result);\n break;\n case \"phone\":\n result = Utils.parsePhone(result);\n break;\n }\n }\n\n return result;\n },\n\n addItem: function (item, redraw) {\n if (!Array.isArray(item)) {\n console.warn(\"Item is not an array and can't be added\");\n return this;\n }\n this.items.push(item);\n if (redraw !== false) this.draw();\n },\n\n addItems: function (items, redraw) {\n if (!Array.isArray(items)) {\n console.warn(\"Items is not an array and can't be added\");\n return this;\n }\n items.forEach(function (item) {\n if (Array.isArray(item)) this.items.push(item, false);\n });\n this.draw();\n if (redraw !== false) this.draw();\n },\n\n updateItem: function (key, field, value) {\n var item = this.items[this.index[key]];\n var fieldIndex = null;\n if (Utils.isNull(item)) {\n console.warn(\"Item is undefined for update\");\n return this;\n }\n if (isNaN(field)) {\n this.heads.forEach(function (v, i) {\n if (v[\"name\"] === field) {\n fieldIndex = i;\n }\n });\n }\n if (Utils.isNull(fieldIndex)) {\n console.warn(\"Item is undefined for update. Field \" + field + \" not found in data structure\");\n return this;\n }\n\n item[fieldIndex] = value;\n this.items[this.index[key]] = item;\n return this;\n },\n\n getItem: function (key) {\n return this.items[this.index[key]];\n },\n\n deleteItem: function (fieldIndex, value) {\n var i,\n deleteIndexes = [];\n var is_func = Utils.isFunc(value);\n for (i = 0; i < this.items.length; i++) {\n if (is_func) {\n if (Utils.exec(value, [this.items[i][fieldIndex]])) {\n deleteIndexes.push(i);\n }\n } else {\n if (this.items[i][fieldIndex] === value) {\n deleteIndexes.push(i);\n }\n }\n }\n\n this.items = Utils.arrayDeleteByMultipleKeys(this.items, deleteIndexes);\n\n return this;\n },\n\n deleteItemByName: function (fieldName, value) {\n var i,\n fieldIndex,\n deleteIndexes = [];\n var is_func = Utils.isFunc(value);\n\n for (i = 0; i < this.heads.length; i++) {\n if (this.heads[i][\"name\"] === fieldName) {\n fieldIndex = i;\n break;\n }\n }\n\n for (i = 0; i < this.items.length; i++) {\n if (is_func) {\n if (Utils.exec(value, [this.items[i][fieldIndex]])) {\n deleteIndexes.push(i);\n }\n } else {\n if (this.items[i][fieldIndex] === value) {\n deleteIndexes.push(i);\n }\n }\n }\n\n this.items = Utils.arrayDeleteByMultipleKeys(this.items, deleteIndexes);\n\n return this;\n },\n\n draw: function () {\n this._draw();\n return this;\n },\n\n sorting: function (dir) {\n var that = this;\n\n if (Utils.isValue(dir)) {\n this.sort.dir = dir;\n }\n\n this._fireEvent(\"sort-start\", {\n items: this.items,\n });\n\n this.items.sort(function (a, b) {\n var c1 = that._getItemContent(a);\n var c2 = that._getItemContent(b);\n var result = 0;\n\n if (c1 < c2) {\n result = that.sort.dir === \"asc\" ? -1 : 1;\n }\n if (c1 > c2) {\n result = that.sort.dir === \"asc\" ? 1 : -1;\n }\n\n if (result !== 0) {\n that._fireEvent(\"sort-item-switch\", {\n a: a,\n b: b,\n result: result,\n });\n }\n\n return result;\n });\n\n this._fireEvent(\"sort-stop\", {\n items: this.items,\n });\n\n return this;\n },\n\n search: function (val) {\n this.searchString = val.trim().toLowerCase();\n this.currentPage = 1;\n this._draw();\n return this;\n },\n\n _rebuild: function (review) {\n var that = this,\n element = this.element;\n var need_sort = false,\n sortable_columns;\n\n this._createIndex();\n\n if (review === true) {\n this.view = this._createView();\n }\n\n this._createTableHeader();\n this._createTableBody();\n this._createTableFooter();\n\n if (this.heads.length > 0)\n $.each(this.heads, function (i) {\n var item = this;\n if (!need_sort && [\"asc\", \"desc\"].indexOf(item.sortDir) > -1) {\n need_sort = true;\n that.sort.colIndex = i;\n that.sort.dir = item.sortDir;\n }\n });\n\n if (need_sort) {\n sortable_columns = element.find(\".sortable-column\");\n this._resetSortClass(sortable_columns);\n $(sortable_columns.get(that.sort.colIndex)).addClass(\"sort-\" + that.sort.dir);\n this.sorting();\n }\n\n that.currentPage = 1;\n\n that._draw();\n },\n\n setHeads: function (data) {\n this.heads = data;\n return this;\n },\n\n setHeadItem: function (name, data) {\n var i, index;\n for (i = 0; i < this.heads.length; i++) {\n if (this.heads[i].name === name) {\n index = i;\n break;\n }\n }\n this.heads[index] = data;\n return this;\n },\n\n setItems: function (data) {\n this.items = data;\n return this;\n },\n\n setData: function (/*obj*/ data) {\n var that = this,\n o = this.options;\n\n this.activity.show(function () {\n that.items = [];\n that.heads = [];\n that.foots = [];\n\n if (Array.isArray(o.head)) {\n that.heads = o.head;\n }\n\n if (Array.isArray(o.body)) {\n that.items = o.body;\n }\n\n that._createItemsFromJSON(data);\n\n that._rebuild(true);\n\n that.activity.hide();\n });\n\n return this;\n },\n\n loadData: function (source, review) {\n var that = this,\n element = this.element,\n o = this.options;\n\n if (!Utils.isValue(review)) {\n review = true;\n }\n\n element.html(\"\");\n\n if (!Utils.isValue(source)) {\n this._rebuild(review);\n } else {\n o.source = source;\n\n this._fireEvent(\"data-load\", {\n source: o.source,\n });\n\n that.activity.show(function () {\n fetch(o.source)\n .then(Metro.fetch.status)\n .then(Metro.fetch.json)\n .then(function (data) {\n that.activity.hide();\n that.items = [];\n that.heads = [];\n that.foots = [];\n\n that._fireEvent(\"data-loaded\", {\n source: o.source,\n data: data,\n });\n\n if (Array.isArray(o.head)) {\n that.heads = o.head;\n }\n\n if (Array.isArray(o.body)) {\n that.items = o.body;\n }\n\n that._createItemsFromJSON(data);\n that._rebuild(review);\n that._resetInspector();\n\n that._fireEvent(\"data-load-end\", {\n source: o.source,\n data: data,\n });\n })\n .catch(function (error) {\n that.activity.hide();\n that._fireEvent(\"data-load-error\", {\n source: o.source,\n error: error,\n });\n });\n });\n }\n },\n\n reload: function (review) {\n this.loadData(this.options.source, review);\n },\n\n clear: function () {\n this.items = [];\n return this.draw();\n },\n\n next: function () {\n if (this.items.length === 0) return;\n this.currentPage++;\n if (this.currentPage > this.pagesCount) {\n this.currentPage = this.pagesCount;\n return;\n }\n this._draw();\n return this;\n },\n\n prev: function () {\n if (this.items.length === 0) return;\n this.currentPage--;\n if (this.currentPage === 0) {\n this.currentPage = 1;\n return;\n }\n this._draw();\n return this;\n },\n\n first: function () {\n if (this.items.length === 0) return;\n this.currentPage = 1;\n this._draw();\n return this;\n },\n\n last: function () {\n if (this.items.length === 0) return;\n this.currentPage = this.pagesCount;\n this._draw();\n return this;\n },\n\n page: function (num) {\n if (num <= 0) {\n num = 1;\n }\n\n if (num > this.pagesCount) {\n num = this.pagesCount;\n }\n\n this.currentPage = num;\n this._draw();\n return this;\n },\n\n addFilter: function (f, redraw) {\n var filterIndex = null,\n i,\n func = Utils.isFunc(f);\n if (func === false) {\n return;\n }\n\n for (i = 0; i < this.filters.length; i++) {\n if (Utils.isNull(this.filters[i])) {\n filterIndex = i;\n this.filters[i] = func;\n break;\n }\n }\n\n if (Utils.isNull(filterIndex)) {\n this.filters.push(func);\n filterIndex = this.filters.length - 1;\n }\n\n if (redraw === true) {\n this.currentPage = 1;\n this.draw();\n }\n\n return filterIndex;\n },\n\n removeFilter: function (key, redraw) {\n this.filters[key] = null;\n if (redraw === true) {\n this.currentPage = 1;\n this.draw();\n }\n return this;\n },\n\n removeFilters: function (redraw) {\n this.filters = [];\n if (redraw === true) {\n this.currentPage = 1;\n this.draw();\n }\n return this;\n },\n\n getItems: function () {\n return this.items;\n },\n\n getHeads: function () {\n return this.heads;\n },\n\n getView: function () {\n return this.view;\n },\n\n getFilteredItems: function () {\n return this.filteredItems.length > 0 ? this.filteredItems : this.items;\n },\n\n getSelectedItems: function () {\n var element = this.element,\n o = this.options;\n var stored_keys = Metro.storage.getItem(o.checkStoreKey.replace(\"$1\", element.attr(\"id\")));\n var selected = [];\n\n if (!Utils.isValue(stored_keys)) {\n return [];\n }\n\n $.each(this.items, function () {\n if (stored_keys.indexOf(\"\" + this[o.checkColIndex]) !== -1) {\n selected.push(this);\n }\n });\n return selected;\n },\n\n getStoredKeys: function () {\n var element = this.element,\n o = this.options;\n return Metro.storage.getItem(o.checkStoreKey.replace(\"$1\", element.attr(\"id\")), []);\n },\n\n clearSelected: function (redraw) {\n var element = this.element,\n o = this.options;\n Metro.storage.setItem(o.checkStoreKey.replace(\"$1\", element.attr(\"id\")), []);\n element.find(\"table-service-check-all input\").prop(\"checked\", false);\n if (redraw === true) this._draw();\n },\n\n getFilters: function () {\n return this.filters;\n },\n\n getFiltersIndexes: function () {\n return this.filtersIndexes;\n },\n\n openInspector: function (mode) {\n var ins = this.inspector;\n if (mode) {\n ins.show(0, function () {\n ins.css({\n top: ($(globalThis).height() - ins.outerHeight(true)) / 2 + pageYOffset,\n left: ($(globalThis).width() - ins.outerWidth(true)) / 2 + pageXOffset,\n }).data(\"open\", true);\n });\n } else {\n ins.hide().data(\"open\", false);\n }\n },\n\n closeInspector: function () {\n this.openInspector(false);\n },\n\n toggleInspector: function () {\n this.openInspector(!this.inspector.data(\"open\"));\n },\n\n resetView: function () {\n this.view = this._createView();\n\n this._createTableHeader();\n this._createTableFooter();\n this._draw();\n\n this._resetInspector();\n this._saveTableView();\n },\n\n rebuildIndex: function () {\n this._createIndex();\n },\n\n getIndex: function () {\n return this.index;\n },\n\n export: function (to, mode, filename, options) {\n var Export = Metro.export;\n var that = this,\n o = this.options;\n var table = document.createElement(\"table\");\n var head = $(\"
              \");\n if (Utils.isValue(item.title)) {\n td.html(item.title);\n }\n tds[that.view[cell_index][\"index-view\"]] = td;\n });\n\n for (j = 0; j < cells.length; j++) {\n if (Utils.isValue(tds[j])) tds[j].appendTo(tr);\n }\n tr.appendTo(head);\n\n // Create table data\n if (mode === \"checked\") {\n items = this.getSelectedItems();\n start = 0;\n stop = items.length - 1;\n } else if (mode === \"view\") {\n items = this._filter();\n start = parseInt(o.rows) === -1 ? 0 : o.rows * (this.currentPage - 1);\n stop = parseInt(o.rows) === -1 ? items.length - 1 : start + o.rows - 1;\n } else if (mode === \"all\") {\n items = this.items;\n start = 0;\n stop = items.length - 1;\n } else {\n items = this._filter();\n start = 0;\n stop = items.length - 1;\n }\n\n for (i = start; i <= stop; i++) {\n if (Utils.isValue(items[i])) {\n tr = $(\"
              \").html(this);\n tds[that.view[cell_index][\"index-view\"]] = td;\n });\n\n for (j = 0; j < cells.length; j++) {\n if (Utils.isValue(tds[j])) tds[j].appendTo(tr);\n }\n\n tr.appendTo(body);\n }\n }\n\n // switch (to) {\n // default: Export.tableToCSV(table, filename, options);\n // }\n Export.tableToCSV(table, filename, options);\n table.remove();\n },\n\n changeAttribute: function (attributeName) {\n var that = this,\n element = this.element,\n o = this.options;\n\n function dataCheck() {\n o.check = Utils.bool(element.attr(\"data-check\"));\n that._service();\n that._createTableHeader();\n that._draw();\n }\n\n function dataRownum() {\n o.rownum = Utils.bool(element.attr(\"data-rownum\"));\n that._service();\n that._createTableHeader();\n that._draw();\n }\n\n switch (attributeName) {\n case \"data-check\":\n dataCheck();\n break;\n case \"data-rownum\":\n dataRownum();\n break;\n }\n },\n\n destroy: function () {\n var element = this.element;\n var component = element.closest(\".table-component\");\n var search_input = component.find(\"input\");\n var rows_select = component.find(\"select\");\n\n search_input.data(\"input\").destroy();\n rows_select.data(\"select\").destroy();\n\n $(globalThis).off(Metro.events.resize, { ns: this.id });\n\n element.off(Metro.events.click, \".sortable-column\");\n\n element.off(Metro.events.click, \".table-service-check input\");\n\n element.off(Metro.events.click, \".table-service-check-all input\");\n\n search_input.off(Metro.events.inputchange);\n\n if (Utils.isValue(this.wrapperSearch)) {\n var customSearch = this.wrapperSearch.find(\"input\");\n if (customSearch.length > 0) {\n customSearch.off(Metro.events.inputchange);\n }\n }\n\n component.off(Metro.events.click, \".pagination .page-link\");\n if (Utils.isValue(this.wrapperPagination)) {\n this.wrapperPagination.off(Metro.events.click, \".pagination .page-link\");\n }\n element.off(Metro.events.click, \".js-table-crud-button\");\n\n this._removeInspectorEvents();\n\n return element;\n },\n });\n})(Metro, Dom);\n", "/* global Metro */\n(function(Metro, $) {\n 'use strict';\n var Utils = Metro.utils;\n var MaterialTabsDefaultConfig = {\n wheelStep: 20,\n materialtabsDeferred: 0,\n deep: false,\n fixedTabs: false,\n duration: 300,\n appBar: false,\n\n clsComponent: \"\",\n clsTabs: \"\",\n clsTab: \"\",\n clsTabActive: \"\",\n clsMarker: \"\",\n\n onBeforeTabOpen: Metro.noop_true,\n onTabOpen: Metro.noop,\n onTabsScroll: Metro.noop,\n onTabsCreate: Metro.noop\n };\n\n Metro.materialTabsSetup = function (options) {\n MaterialTabsDefaultConfig = $.extend({}, MaterialTabsDefaultConfig, options);\n };\n\n if (typeof globalThis[\"metroMaterialTabsSetup\"] !== undefined) {\n Metro.materialTabsSetup(globalThis[\"metroMaterialTabsSetup\"]);\n }\n\n Metro.Component('material-tabs', {\n init: function( options, elem ) {\n this._super(elem, options, MaterialTabsDefaultConfig, {\n marker: null,\n scroll: 0,\n scrollDir: \"left\"\n });\n\n return this;\n },\n\n _create: function(){\n var element = this.element;\n\n this._createStructure();\n this._createEvents();\n\n this._fireEvent(\"tabs-create\", {\n element: element\n });\n },\n\n _createStructure: function(){\n var element = this.element, o = this.options;\n var tabs = element.find(\"li\"), active_tab = element.find(\"li.active\");\n var wrapper = $(\"
              \").addClass(\"tabs-material-wrapper\").addClass(o.clsComponent).insertBefore(element);\n\n if (o.appBar === true) {\n wrapper.addClass(\"app-bar-present\");\n }\n if (o.appBar === \"more\") {\n wrapper.addClass(\"app-bar-present-more\");\n }\n\n element.appendTo(wrapper);\n element.addClass(\"tabs-material\").addClass(o.clsTabs);\n tabs.addClass(o.clsTab);\n\n if (o.deep === true) {\n element.addClass(\"deep\");\n }\n\n if (o.fixedTabs === true) {\n element.addClass(\"fixed-tabs\");\n }\n\n this.marker = element.find(\".tab-marker\");\n\n if (this.marker.length === 0) {\n this.marker = $(\"\").addClass(\"tab-marker\").addClass(o.clsMarker).appendTo(element);\n }\n\n this.openTab(active_tab.length === 0 ? tabs[0] : active_tab[0]);\n },\n\n _createEvents: function(){\n var that = this, element = this.element, o = this.options;\n\n element.on(Metro.events.click, \"li\", function(e){\n var tab = $(this);\n var active_tab = element.find(\"li.active\");\n var tab_next = tab.index() > active_tab.index();\n var target = tab.children(\"a\").attr(\"href\");\n\n e.preventDefault();\n\n if (Utils.isValue(target) && target[0] === \"#\") {\n if (tab.hasClass(\"active\")) return;\n if (tab.hasClass(\"disabled\")) return;\n if (Utils.exec(o.onBeforeTabOpen, [tab, target, tab_next], this) === false) return;\n that.openTab(tab, tab_next);\n }\n });\n\n element.on(Metro.events.scroll, function(){\n var oldScroll = that.scroll;\n\n that.scrollDir = that.scroll < element[0].scrollLeft ? \"left\" : \"right\";\n that.scroll = element[0].scrollLeft;\n\n that._fireEvent(\"tabs-scroll\", {\n scrollLeft: element[0].scrollLeft,\n oldScroll: oldScroll,\n scrollDir: that.scrollDir\n });\n\n });\n\n element.on(Metro.events.mousewheel, function(e){\n if (e.deltaY === undefined) {\n return ;\n }\n\n var scroll, scrollable = $(this);\n var dir = e.deltaY > 0 ? -1 : 1;\n var step = o.wheelStep;\n\n\n scroll = scrollable.scrollLeft() - ( dir * step);\n scrollable.scrollLeft(scroll);\n }, {\n passive: true\n })\n },\n\n openTab: function(tab, tab_next){\n var element = this.element, o = this.options;\n var tabs = element.find(\"li\");\n var magic = 52, shift, width, tab_width, target, tab_left, scroll, scrollLeft;\n\n tab = $(tab);\n\n $.each(tabs, function(){\n var target = $(this).find(\"a\").attr(\"href\");\n if (!Utils.isValue(target)) return;\n if (target[0] === \"#\" && target.length > 1) {\n $(target).hide();\n }\n });\n\n width = element.width();\n scroll = element.scrollLeft();\n tab_left = tab.position().left;\n tab_width = tab.width();\n shift = tab_left + tab_width;\n\n tabs.removeClass(\"active\").removeClass(o.clsTabActive);\n tab.addClass(\"active\").addClass(o.clsTabActive);\n\n if (shift + magic > width + scroll) {\n scrollLeft = scroll + (magic * 2);\n } else if (tab_left < scroll) {\n scrollLeft = tab_left - magic * 2;\n } else {\n scrollLeft = scroll;\n }\n\n element.animate({\n draw: {\n scrollLeft: scrollLeft\n },\n dur: o.duration\n });\n\n this.marker.animate({\n draw: {\n left: tab_left,\n width: tab_width\n },\n dur: o.duration\n });\n\n target = tab.find(\"a\").attr(\"href\");\n if (Utils.isValue(target)) {\n if (target[0] === \"#\" && target.length > 1) {\n $(target).show();\n }\n }\n\n this._fireEvent(\"tab-open\", {\n tab: tab[0],\n target: target,\n tab_next: tab_next\n });\n },\n\n open: function(tab_num){\n var element = this.element;\n var tabs = element.find(\"li\");\n var active_tab = element.find(\"li.active\");\n var tab = tabs.eq(tab_num - 1);\n var tab_next = tabs.index(tab) > tabs.index(active_tab);\n this.openTab(tab, tab_next);\n },\n\n changeAttribute: function(){\n },\n\n destroy: function(){\n var element = this.element;\n\n element.off(Metro.events.click, \"li\");\n element.off(Metro.events.scroll);\n\n return element;\n }\n });\n}(Metro, Dom));", "/**\n * @format\n */\n\n(function (Metro, $) {\n \"use strict\";\n\n let TagInputDefaultConfig = {\n autocomplete: null,\n autocompleteUnique: true,\n autocompleteUrl: null,\n autocompleteUrlMethod: \"GET\",\n autocompleteUrlKey: null,\n autocompleteDivider: \",\",\n autocompleteListHeight: 200,\n\n label: \"\",\n size: \"normal\",\n taginputDeferred: 0,\n static: false,\n clearButton: true,\n clearButtonIcon: \"\u274C\",\n\n randomColor: false,\n maxTags: 0,\n tagSeparator: \",\",\n tagTrigger: \"Enter, Space, Comma\",\n backspace: true,\n\n clsComponent: \"\",\n clsInput: \"\",\n clsClearButton: \"\",\n clsTag: \"\",\n clsTagTitle: \"\",\n clsTagAction: \"\",\n clsLabel: \"\",\n\n onBeforeTagAdd: Metro.noop_true,\n onTagAdd: Metro.noop,\n onBeforeTagRemove: Metro.noop_true,\n onTagRemove: Metro.noop,\n onTag: Metro.noop,\n onClear: Metro.noop,\n onTagTrigger: Metro.noop,\n onTagInputCreate: Metro.noop,\n };\n\n Metro.tagInputSetup = function (options) {\n TagInputDefaultConfig = $.extend({}, TagInputDefaultConfig, options);\n };\n\n if (typeof globalThis[\"metroTagInputSetup\"] !== undefined) {\n Metro.tagInputSetup(globalThis[\"metroTagInputSetup\"]);\n }\n\n Metro.Component(\"tag-input\", {\n init: function (options, elem) {\n this._super(elem, options, TagInputDefaultConfig, {\n values: [],\n triggers: [],\n autocomplete: [],\n });\n\n return this;\n },\n\n _create: function () {\n this.triggers = (\"\" + this.options.tagTrigger).toArray(\",\");\n\n if (\n this.triggers.includes(\"Space\") ||\n this.triggers.includes(\"Spacebar\")\n ) {\n this.triggers.push(\" \");\n this.triggers.push(\"Spacebar\");\n }\n\n if (this.triggers.includes(\"Comma\")) {\n this.triggers.push(\",\");\n }\n\n this._createStructure();\n this._createEvents();\n\n this._fireEvent(\"tag-input-create\", {\n element: this.element,\n });\n },\n\n _createStructure: function () {\n const that = this,\n element = this.element,\n o = this.options;\n let container, input, clearButton;\n const values = element.val().trim();\n\n container = element.wrap(\"
              \")\n .addClass(\"tag-input \" + element[0].className)\n .addClass(o.clsComponent)\n\n container.addClass(\"input-\" + o.size);\n\n element[0].className = \"\";\n\n element.addClass(\"original-input\");\n input = $(\"\")\n .addClass(\"input-wrapper\")\n .addClass(o.clsInput)\n .attr(\"size\", 1);\n input.appendTo(container);\n\n if (o.clearButton !== false && !element[0].readOnly) {\n container.addClass(\"padding-for-clear\");\n clearButton = $(\"