From 76ced318b0f27ab0a72cadd486ecadc4a15d28f2 Mon Sep 17 00:00:00 2001 From: Lena Daxenbichler Date: Thu, 22 Aug 2024 10:46:19 +0200 Subject: [PATCH] remove ':has' css rules, as they are not supported in FF. --- js/src/bundle.js | 3 + js/src/header.js | 22 ++ js/src/logo.js | 26 +++ scss/form.scss | 2 +- scss/header.scss | 195 +++++++++--------- scss/styles.scss | 3 + src/cone/app/browser/static/cone/cone.app.css | 120 ++++++----- src/cone/app/browser/static/cone/cone.app.js | 42 +++- .../app/browser/static/cone/cone.app.min.css | 2 +- .../app/browser/static/cone/cone.app.min.js | 2 +- 10 files changed, 265 insertions(+), 152 deletions(-) create mode 100644 js/src/logo.js diff --git a/js/src/bundle.js b/js/src/bundle.js index fcd14c06..39c41ce0 100644 --- a/js/src/bundle.js +++ b/js/src/bundle.js @@ -22,6 +22,7 @@ import {Translation} from './translation.js'; import {MainMenu} from './mainmenu.js'; import {Header} from './header.js'; import {MainArea} from './layout.js'; +import {Logo} from './logo.js'; export * from './batcheditems.js'; export * from './colormode.js'; @@ -40,6 +41,7 @@ export * from './utils.js'; export * from './mainmenu.js'; export * from './header.js'; export * from './layout.js'; +export * from './logo.js'; $(function() { new KeyBinder(); @@ -57,6 +59,7 @@ $(function() { ts.ajax.register(Scrollbar.initialize, true); ts.ajax.register(LiveSearch.initialize, true); ts.ajax.register(MainMenu.initialize, true); + ts.ajax.register(Logo.initialize, true); ts.ajax.register(Header.initialize, true); ts.ajax.register(MainArea.initialize, true); ts.ajax.register(Sidebar.initialize, true); diff --git a/js/src/header.js b/js/src/header.js index 7a599983..b1511564 100644 --- a/js/src/header.js +++ b/js/src/header.js @@ -20,6 +20,7 @@ export class Header extends LayoutAware { this.header_content = ts.query_elem('#header-content', elem); this.navbar_content_wrapper = ts.query_elem('#navbar-content-wrapper', elem); this.navbar_content = ts.query_elem('#navbar-content', elem); + this.navbar_toggler = ts.query_elem('#navbar-toggler', this.elem); this.personal_tools = ts.query_elem('#personaltools', elem); this.mainmenu = ts.query_elem('#mainmenu', elem); this.mainmenu_elems = $('.nav-link.dropdown-toggle', this.mainmenu); @@ -30,6 +31,10 @@ export class Header extends LayoutAware { $(el).on('hidden.bs.dropdown', this.render_mobile_scrollbar.bind(this)); }); + this.set_mobile_menu_open = this.set_mobile_menu_open.bind(this); + this.set_mobile_menu_closed = this.set_mobile_menu_closed.bind(this); + this.bind(); + ts.ajax.attach(this, elem); this.render_mobile_scrollbar = this.render_mobile_scrollbar.bind(this); @@ -41,6 +46,9 @@ export class Header extends LayoutAware { $(el).off('shown.bs.dropdown', this.render_mobile_scrollbar.bind(this)); $(el).off('hidden.bs.dropdown', this.render_mobile_scrollbar.bind(this)); }); + const wrapper = this.navbar_content_wrapper; + wrapper.off('show.bs.collapse shown.bs.collapse', this.set_mobile_menu_open); + wrapper.off('hide.bs.collapse hidden.bs.collapse', this.set_mobile_menu_closed); } render_mobile_scrollbar() { @@ -49,6 +57,20 @@ export class Header extends LayoutAware { } } + bind() { + const wrapper = this.navbar_content_wrapper; + wrapper.on('show.bs.collapse shown.bs.collapse', this.set_mobile_menu_open); + wrapper.on('hidden.bs.collapse', this.set_mobile_menu_closed); + } + + set_mobile_menu_open() { + this.elem.addClass('mobile-menu-open'); + } + + set_mobile_menu_closed() { + this.elem.removeClass('mobile-menu-open'); + } + on_is_compact(val) { if (val) { this.elem.removeClass('full').removeClass('navbar-expand'); diff --git a/js/src/logo.js b/js/src/logo.js new file mode 100644 index 00000000..d8e58eda --- /dev/null +++ b/js/src/logo.js @@ -0,0 +1,26 @@ +import ts from 'treibstoff'; +import {LayoutAware} from './layout.js'; + +export class Logo extends LayoutAware { + + static initialize(context) { + const elem = ts.query_elem('#header-logo', context); + if (!elem) { + return; + } + new Logo(elem); + } + + constructor(elem) { + super(elem); + } + + on_sidebar_resize(inst, sidebar) { + console.log(sidebar.collapsed) + if (sidebar.collapsed) { + this.elem.removeClass('text-white'); + } else { + this.elem.addClass('text-white'); + } + } +} diff --git a/scss/form.scss b/scss/form.scss index 0ec1787d..d6bfe063 100644 --- a/scss/form.scss +++ b/scss/form.scss @@ -1,4 +1,4 @@ // contentform -#input-contentform-save:has(+ input.btn) { +#input-contentform-save { margin-right: 1rem; } diff --git a/scss/header.scss b/scss/header.scss index 00833df0..204a9062 100644 --- a/scss/header.scss +++ b/scss/header.scss @@ -11,91 +11,64 @@ #header-logo-placeholder { visibility: hidden; } -#header-main { - height: var(--navbar-height); - &.navbar-expand { - #header-content { - flex-direction: row-reverse; - } - #navbar-content-wrapper { - box-shadow: none!important; - background: none; - } - } - &:not(.navbar-expand) { - #header-content { - flex-direction: row; - } +#main-area { + // display: flex; + // flex-direction: column; - #navbar-content { - flex-direction: column; - } - #livesearch { - order: 0; - width: 100%; - padding-left: 55px !important; - padding-right: 15px !important; - } - #mainmenu { - order: 1; - margin-left: 10px!important; - margin-top: 20px; - margin-bottom: 20px; + &.compact { + #header-main.mobile-menu-open { - ul > li { - // XXX - display: block!important; + #header-logo-placeholder { + display: none; } - } - } - &.compact:has(.show) { - // XXX: has is not supported in Firefox!!!! - height: 100%; - } - &.compact:has(.show), &.compact:has(.collapsing) { - #header-logo-placeholder { - display: none; - } + #navbar-content-wrapper { + max-height: calc(100vh - 50px); + position: relative; + overflow: hidden; + padding: 0 !important; + z-index: 3; - #navbar-content-wrapper { - position: relative; - overflow: hidden; - height: 100%; - padding: 0 !important; - - @media screen and (max-width: 768px) { - z-index: 1200; + @media screen and (max-width: 768px) { + z-index: 1200; + } } - } - #header-content { - align-items: flex-start; - } - .navbar-toggler { - height: 50px!important; // XXX variable - } - - #mainmenu { - .scrollable-content { - right: 0!important; + #header-content { + align-items: flex-start; + } + .navbar-toggler { + height: 50px!important; // XXX variable } - .dropdown-menu { - border: none; + #mainmenu { + align-items: baseline; - > li { - .dropdown-item { - padding: 8px 20px; - } - &:first-child { + .scrollbar { + display: none!important; + } + .scrollable-content { + right: 0!important; + } + + .dropdown-menu { + border: none; + + > li { .dropdown-item { - padding-top: 0; + padding: 8px 20px; + } + &:first-child { + .dropdown-item { + padding-top: 0; + } } } } } } + } + &.super-compact { #personaltools { height: 50px; justify-content: space-between; @@ -106,7 +79,6 @@ } } } - &.full { #mainmenu { .dropdown-menu { @@ -117,36 +89,75 @@ height: 100%; } } + #header-main { + height: var(--navbar-height); - #navbar-content-wrapper { - min-width: 0; - z-index: 1; + &.navbar-expand { + #header-content { + flex-direction: row-reverse; + } + #navbar-content-wrapper { + box-shadow: none!important; + background: none; + } + } + &:not(.navbar-expand) { + #header-content { + flex-direction: row; + } - #navbar-content { - min-width: 0; + #navbar-content { + flex-direction: column; + } + #livesearch { + order: 0; + width: 100%; + padding-left: 55px !important; + padding-right: 15px !important; + } + #mainmenu { + order: 1; + margin-left: 10px!important; + margin-top: 20px; + margin-bottom: 20px; + + ul > li { + // XXX + display: block!important; + } + } } - } - #mainmenu { - > ul { - padding-left: 8px; - white-space: nowrap; + + #navbar-content-wrapper { + min-width: 0; + z-index: 1; + + #navbar-content { + min-width: 0; + } } - .nav-item.active .nav-link { - color: $primary; + #mainmenu { + > ul { + padding-left: 8px; + white-space: nowrap; + } + .nav-item.active .nav-link { + color: $primary; + } } - } - #personaltools { - #language-dropdown > div.dropdown-toggle > a { - height: 20px; + #personaltools { + #language-dropdown > div.dropdown-toggle > a { + height: 20px; - img { - vertical-align: baseline; + img { + vertical-align: baseline; + } + } + #colortoggler #colortoggle-switch { + width: 2rem; + height: 1rem; } - } - #colortoggler #colortoggle-switch { - width: 2rem; - height: 1rem; } } } diff --git a/scss/styles.scss b/scss/styles.scss index b8be80a3..9714f8fe 100644 --- a/scss/styles.scss +++ b/scss/styles.scss @@ -12,6 +12,9 @@ html { body { height: 100%; } +#footer { + z-index: 1; +} @import 'content.scss'; @import 'form.scss'; diff --git a/src/cone/app/browser/static/cone/cone.app.css b/src/cone/app/browser/static/cone/cone.app.css index 8af65358..8afed0b3 100644 --- a/src/cone/app/browser/static/cone/cone.app.css +++ b/src/cone/app/browser/static/cone/cone.app.css @@ -68,6 +68,10 @@ body { height: 100%; } +#footer { + z-index: 1; +} + /* content */ #content { height: calc(100% - 40px); @@ -85,7 +89,7 @@ tr.selectable td { -ms-user-select: none; } -#input-contentform-save:has(+ input.btn) { +#input-contentform-save { margin-right: 1rem; } @@ -102,107 +106,111 @@ tr.selectable td { visibility: hidden; } -#header-main { - height: var(--navbar-height); -} -#header-main.navbar-expand #header-content { - flex-direction: row-reverse; -} -#header-main.navbar-expand #navbar-content-wrapper { - box-shadow: none !important; - background: none; -} -#header-main:not(.navbar-expand) #header-content { - flex-direction: row; -} -#header-main:not(.navbar-expand) #navbar-content { - flex-direction: column; -} -#header-main:not(.navbar-expand) #livesearch { - order: 0; - width: 100%; - padding-left: 55px !important; - padding-right: 15px !important; -} -#header-main:not(.navbar-expand) #mainmenu { - order: 1; - margin-left: 10px !important; - margin-top: 20px; - margin-bottom: 20px; -} -#header-main:not(.navbar-expand) #mainmenu ul > li { - display: block !important; -} -#header-main.compact:has(.show) { - height: 100%; -} -#header-main.compact:has(.show) #header-logo-placeholder, #header-main.compact:has(.collapsing) #header-logo-placeholder { +#main-area.compact #header-main.mobile-menu-open #header-logo-placeholder { display: none; } -#header-main.compact:has(.show) #navbar-content-wrapper, #header-main.compact:has(.collapsing) #navbar-content-wrapper { +#main-area.compact #header-main.mobile-menu-open #navbar-content-wrapper { + max-height: calc(100vh - 50px); position: relative; overflow: hidden; - height: 100%; padding: 0 !important; + z-index: 3; } @media screen and (max-width: 768px) { - #header-main.compact:has(.show) #navbar-content-wrapper, #header-main.compact:has(.collapsing) #navbar-content-wrapper { + #main-area.compact #header-main.mobile-menu-open #navbar-content-wrapper { z-index: 1200; } } -#header-main.compact:has(.show) #header-content, #header-main.compact:has(.collapsing) #header-content { +#main-area.compact #header-main.mobile-menu-open #header-content { align-items: flex-start; } -#header-main.compact:has(.show) .navbar-toggler, #header-main.compact:has(.collapsing) .navbar-toggler { +#main-area.compact #header-main.mobile-menu-open .navbar-toggler { height: 50px !important; } -#header-main.compact:has(.show) #mainmenu .scrollable-content, #header-main.compact:has(.collapsing) #mainmenu .scrollable-content { +#main-area.compact #header-main.mobile-menu-open #mainmenu { + align-items: baseline; +} +#main-area.compact #header-main.mobile-menu-open #mainmenu .scrollbar { + display: none !important; +} +#main-area.compact #header-main.mobile-menu-open #mainmenu .scrollable-content { right: 0 !important; } -#header-main.compact:has(.show) #mainmenu .dropdown-menu, #header-main.compact:has(.collapsing) #mainmenu .dropdown-menu { +#main-area.compact #header-main.mobile-menu-open #mainmenu .dropdown-menu { border: none; } -#header-main.compact:has(.show) #mainmenu .dropdown-menu > li .dropdown-item, #header-main.compact:has(.collapsing) #mainmenu .dropdown-menu > li .dropdown-item { +#main-area.compact #header-main.mobile-menu-open #mainmenu .dropdown-menu > li .dropdown-item { padding: 8px 20px; } -#header-main.compact:has(.show) #mainmenu .dropdown-menu > li:first-child .dropdown-item, #header-main.compact:has(.collapsing) #mainmenu .dropdown-menu > li:first-child .dropdown-item { +#main-area.compact #header-main.mobile-menu-open #mainmenu .dropdown-menu > li:first-child .dropdown-item { padding-top: 0; } -#header-main.compact:has(.show) #personaltools, #header-main.compact:has(.collapsing) #personaltools { +#main-area.super-compact #personaltools { height: 50px; justify-content: space-between; margin: auto 20px; } -#header-main.compact:has(.show) #personaltools #colortoggler, #header-main.compact:has(.collapsing) #personaltools #colortoggler { +#main-area.super-compact #personaltools #colortoggler { padding-left: 0; } -#header-main.full #mainmenu .dropdown-menu { +#main-area.full #mainmenu .dropdown-menu { position: fixed; } -#header-main.full #personaltools { +#main-area.full #personaltools { height: 100%; } -#header-main #navbar-content-wrapper { +#main-area #header-main { + height: var(--navbar-height); +} +#main-area #header-main.navbar-expand #header-content { + flex-direction: row-reverse; +} +#main-area #header-main.navbar-expand #navbar-content-wrapper { + box-shadow: none !important; + background: none; +} +#main-area #header-main:not(.navbar-expand) #header-content { + flex-direction: row; +} +#main-area #header-main:not(.navbar-expand) #navbar-content { + flex-direction: column; +} +#main-area #header-main:not(.navbar-expand) #livesearch { + order: 0; + width: 100%; + padding-left: 55px !important; + padding-right: 15px !important; +} +#main-area #header-main:not(.navbar-expand) #mainmenu { + order: 1; + margin-left: 10px !important; + margin-top: 20px; + margin-bottom: 20px; +} +#main-area #header-main:not(.navbar-expand) #mainmenu ul > li { + display: block !important; +} +#main-area #header-main #navbar-content-wrapper { min-width: 0; z-index: 1; } -#header-main #navbar-content-wrapper #navbar-content { +#main-area #header-main #navbar-content-wrapper #navbar-content { min-width: 0; } -#header-main #mainmenu > ul { +#main-area #header-main #mainmenu > ul { padding-left: 8px; white-space: nowrap; } -#header-main #mainmenu .nav-item.active .nav-link { +#main-area #header-main #mainmenu .nav-item.active .nav-link { color: #4e7bba; } -#header-main #personaltools #language-dropdown > div.dropdown-toggle > a { +#main-area #header-main #personaltools #language-dropdown > div.dropdown-toggle > a { height: 20px; } -#header-main #personaltools #language-dropdown > div.dropdown-toggle > a img { +#main-area #header-main #personaltools #language-dropdown > div.dropdown-toggle > a img { vertical-align: baseline; } -#header-main #personaltools #colortoggler #colortoggle-switch { +#main-area #header-main #personaltools #colortoggler #colortoggle-switch { width: 2rem; height: 1rem; } diff --git a/src/cone/app/browser/static/cone/cone.app.js b/src/cone/app/browser/static/cone/cone.app.js index 2fd83a2d..62d3b3e5 100644 --- a/src/cone/app/browser/static/cone/cone.app.js +++ b/src/cone/app/browser/static/cone/cone.app.js @@ -1215,6 +1215,7 @@ var cone = (function (exports, $, ts) { this.header_content = ts.query_elem('#header-content', elem); this.navbar_content_wrapper = ts.query_elem('#navbar-content-wrapper', elem); this.navbar_content = ts.query_elem('#navbar-content', elem); + this.navbar_toggler = ts.query_elem('#navbar-toggler', this.elem); this.personal_tools = ts.query_elem('#personaltools', elem); this.mainmenu = ts.query_elem('#mainmenu', elem); this.mainmenu_elems = $('.nav-link.dropdown-toggle', this.mainmenu); @@ -1222,6 +1223,9 @@ var cone = (function (exports, $, ts) { $(el).on('shown.bs.dropdown', this.render_mobile_scrollbar.bind(this)); $(el).on('hidden.bs.dropdown', this.render_mobile_scrollbar.bind(this)); }); + this.set_mobile_menu_open = this.set_mobile_menu_open.bind(this); + this.set_mobile_menu_closed = this.set_mobile_menu_closed.bind(this); + this.bind(); ts.ajax.attach(this, elem); this.render_mobile_scrollbar = this.render_mobile_scrollbar.bind(this); } @@ -1231,12 +1235,26 @@ var cone = (function (exports, $, ts) { $(el).off('shown.bs.dropdown', this.render_mobile_scrollbar.bind(this)); $(el).off('hidden.bs.dropdown', this.render_mobile_scrollbar.bind(this)); }); + const wrapper = this.navbar_content_wrapper; + wrapper.off('show.bs.collapse shown.bs.collapse', this.set_mobile_menu_open); + wrapper.off('hide.bs.collapse hidden.bs.collapse', this.set_mobile_menu_closed); } render_mobile_scrollbar() { if (this.is_compact && this.mobile_scrollbar) { this.mobile_scrollbar.render(); } } + bind() { + const wrapper = this.navbar_content_wrapper; + wrapper.on('show.bs.collapse shown.bs.collapse', this.set_mobile_menu_open); + wrapper.on('hidden.bs.collapse', this.set_mobile_menu_closed); + } + set_mobile_menu_open() { + this.elem.addClass('mobile-menu-open'); + } + set_mobile_menu_closed() { + this.elem.removeClass('mobile-menu-open'); + } on_is_compact(val) { if (val) { this.elem.removeClass('full').removeClass('navbar-expand'); @@ -1278,7 +1296,6 @@ var cone = (function (exports, $, ts) { } } on_is_sidebar_collapsed(val) { - console.log('sidebar collapsed ' + val); if (val) { this.logo_placeholder.show(); } else { @@ -1287,6 +1304,27 @@ var cone = (function (exports, $, ts) { } } + class Logo extends LayoutAware { + static initialize(context) { + const elem = ts.query_elem('#header-logo', context); + if (!elem) { + return; + } + new Logo(elem); + } + constructor(elem) { + super(elem); + } + on_sidebar_resize(inst, sidebar) { + console.log(sidebar.collapsed); + if (sidebar.collapsed) { + this.elem.removeClass('text-white'); + } else { + this.elem.addClass('text-white'); + } + } + } + class Selectable { constructor(options) { this.options = options; @@ -1433,6 +1471,7 @@ var cone = (function (exports, $, ts) { ts.ajax.register(Scrollbar.initialize, true); ts.ajax.register(LiveSearch.initialize, true); ts.ajax.register(MainMenu.initialize, true); + ts.ajax.register(Logo.initialize, true); ts.ajax.register(Header.initialize, true); ts.ajax.register(MainArea.initialize, true); ts.ajax.register(Sidebar.initialize, true); @@ -1450,6 +1489,7 @@ var cone = (function (exports, $, ts) { exports.KeyBinder = KeyBinder; exports.LayoutAware = LayoutAware; exports.LiveSearch = LiveSearch; + exports.Logo = Logo; exports.MainArea = MainArea; exports.MainMenu = MainMenu; exports.ReferenceBrowserLoader = ReferenceBrowserLoader; diff --git a/src/cone/app/browser/static/cone/cone.app.min.css b/src/cone/app/browser/static/cone/cone.app.min.css index e1ed581d..dfd51e40 100644 --- a/src/cone/app/browser/static/cone/cone.app.min.css +++ b/src/cone/app/browser/static/cone/cone.app.min.css @@ -1 +1 @@ -[data-bs-theme=dark] #content{color:#f8f9fa;background-color:#212529}[data-bs-theme=dark] #navbar-content-wrapper{color:#f8f9fa;background-color:#212529}[data-bs-theme=dark] #sidebar_left{background-color:#343b45}[data-bs-theme=dark] #footer{color:#f8f9fa;background-color:#000}[data-bs-theme=dark] #contextmenu{color:#f8f9fa;background-color:#343a40}[data-bs-theme=dark] tr.selectable.selected td{background-color:#344555}[data-bs-theme=dark] .table-striped>tbody>tr.selectable.selected:nth-child(2n+1)>td{background-color:#485f76}[data-bs-theme=light] #content{color:#212529;background-color:#f8f9fa}[data-bs-theme=light] #navbar-content-wrapper{color:#212529;background-color:#fff}[data-bs-theme=light] #sidebar_left{background-color:#414c5b}[data-bs-theme=light] #footer{color:#212529;background-color:#f8f9fa}[data-bs-theme=light] #contextmenu{color:#212529;background-color:#fff}[data-bs-theme=light] tr.selectable.selected td{background-color:#dfeefb}[data-bs-theme=light] .table-striped>tbody>tr.selectable.selected:nth-child(2n+1)>td{background-color:#cfdce7}:root{--sidebar-width: 300px;--navbar-height: 50px}html{height:100%;width:100%}body{height:100%}#content{height:calc(100% - 40px)}#main-area{width:0 !important}tr.selectable td{user-select:none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}#input-contentform-save:has(+input.btn){margin-right:1rem}#header-logo{z-index:4}#header-logo>span,#header-logo-placeholder>span{font-size:1.5rem !important}#header-logo-placeholder{visibility:hidden}#header-main{height:var(--navbar-height)}#header-main.navbar-expand #header-content{flex-direction:row-reverse}#header-main.navbar-expand #navbar-content-wrapper{box-shadow:none !important;background:none}#header-main:not(.navbar-expand) #header-content{flex-direction:row}#header-main:not(.navbar-expand) #navbar-content{flex-direction:column}#header-main:not(.navbar-expand) #livesearch{order:0;width:100%;padding-left:55px !important;padding-right:15px !important}#header-main:not(.navbar-expand) #mainmenu{order:1;margin-left:10px !important;margin-top:20px;margin-bottom:20px}#header-main:not(.navbar-expand) #mainmenu ul>li{display:block !important}#header-main.compact:has(.show){height:100%}#header-main.compact:has(.show) #header-logo-placeholder,#header-main.compact:has(.collapsing) #header-logo-placeholder{display:none}#header-main.compact:has(.show) #navbar-content-wrapper,#header-main.compact:has(.collapsing) #navbar-content-wrapper{position:relative;overflow:hidden;height:100%;padding:0 !important}@media screen and (max-width: 768px){#header-main.compact:has(.show) #navbar-content-wrapper,#header-main.compact:has(.collapsing) #navbar-content-wrapper{z-index:1200}}#header-main.compact:has(.show) #header-content,#header-main.compact:has(.collapsing) #header-content{align-items:flex-start}#header-main.compact:has(.show) .navbar-toggler,#header-main.compact:has(.collapsing) .navbar-toggler{height:50px !important}#header-main.compact:has(.show) #mainmenu .scrollable-content,#header-main.compact:has(.collapsing) #mainmenu .scrollable-content{right:0 !important}#header-main.compact:has(.show) #mainmenu .dropdown-menu,#header-main.compact:has(.collapsing) #mainmenu .dropdown-menu{border:none}#header-main.compact:has(.show) #mainmenu .dropdown-menu>li .dropdown-item,#header-main.compact:has(.collapsing) #mainmenu .dropdown-menu>li .dropdown-item{padding:8px 20px}#header-main.compact:has(.show) #mainmenu .dropdown-menu>li:first-child .dropdown-item,#header-main.compact:has(.collapsing) #mainmenu .dropdown-menu>li:first-child .dropdown-item{padding-top:0}#header-main.compact:has(.show) #personaltools,#header-main.compact:has(.collapsing) #personaltools{height:50px;justify-content:space-between;margin:auto 20px}#header-main.compact:has(.show) #personaltools #colortoggler,#header-main.compact:has(.collapsing) #personaltools #colortoggler{padding-left:0}#header-main.full #mainmenu .dropdown-menu{position:fixed}#header-main.full #personaltools{height:100%}#header-main #navbar-content-wrapper{min-width:0;z-index:1}#header-main #navbar-content-wrapper #navbar-content{min-width:0}#header-main #mainmenu>ul{padding-left:8px;white-space:nowrap}#header-main #mainmenu .nav-item.active .nav-link{color:#4e7bba}#header-main #personaltools #language-dropdown>div.dropdown-toggle>a{height:20px}#header-main #personaltools #language-dropdown>div.dropdown-toggle>a img{vertical-align:baseline}#header-main #personaltools #colortoggler #colortoggle-switch{width:2rem;height:1rem}#personaltools-dropdown .dropdown-item a{text-decoration:none;color:var(--bs-secondary-color)}#form-loginform{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%}#form-loginform #field-loginform-user,#form-loginform #field-loginform-password{display:grid;grid-template-columns:1fr 2fr;margin-bottom:.5rem}#form-loginform #input-loginform-login{margin-top:1.5rem;width:200px}#layout:has(#sidebar_left.expanded) #header-logo,#layout:has(#sidebar_left.responsive-expanded:not(.collapsed)) #header-logo{color:#fff}.scrollable-x,.scrollable-y{position:relative;overflow:hidden}.scrollable-content{position:relative}.scrollbar{display:none;position:absolute;background:#dee2e6;border-radius:3px;z-index:1000}.scrollbar .scroll-handle{position:relative;border-radius:3px;background:#4e7bba}.scrollbar-top .scrollbar{top:0}.scrollbar-bottom .scrollbar{bottom:0}.scrollbar-left .scrollbar{left:0}.scrollbar-right .scrollbar{right:0}[data-bs-theme=dark] #content{color:#f8f9fa;background-color:#212529}[data-bs-theme=dark] #navbar-content-wrapper{color:#f8f9fa;background-color:#212529}[data-bs-theme=dark] #sidebar_left{background-color:#343b45}[data-bs-theme=dark] #footer{color:#f8f9fa;background-color:#000}[data-bs-theme=dark] #contextmenu{color:#f8f9fa;background-color:#343a40}[data-bs-theme=dark] tr.selectable.selected td{background-color:#344555}[data-bs-theme=dark] .table-striped>tbody>tr.selectable.selected:nth-child(2n+1)>td{background-color:#485f76}[data-bs-theme=light] #content{color:#212529;background-color:#f8f9fa}[data-bs-theme=light] #navbar-content-wrapper{color:#212529;background-color:#fff}[data-bs-theme=light] #sidebar_left{background-color:#414c5b}[data-bs-theme=light] #footer{color:#212529;background-color:#f8f9fa}[data-bs-theme=light] #contextmenu{color:#212529;background-color:#fff}[data-bs-theme=light] tr.selectable.selected td{background-color:#dfeefb}[data-bs-theme=light] .table-striped>tbody>tr.selectable.selected:nth-child(2n+1)>td{background-color:#cfdce7}#sidebar_left{height:100%;max-height:100%;user-select:none}#sidebar_left>.scrollable-y{margin-top:34px}#sidebar_left ul.list-group,#sidebar_left ul.list-group li{background-color:inherit}#sidebar_left #navtree{max-width:100%}#sidebar_left #navtree .nav-link{z-index:2000;white-space:nowrap}#sidebar_left #navtree .nav-link.active{background-color:rgba(0,0,0,0);font-weight:bold}#sidebar_left #navtree .nav-link i.bi-chevron-right{vertical-align:text-bottom}#sidebar_left #navtree .nav-link span{display:inline-block;width:calc(100% - 40px);text-overflow:ellipsis;overflow-x:hidden;vertical-align:text-bottom}#sidebar_left #sidebar_resize{position:relative;left:100%;width:0;height:0}#sidebar_left #sidebar_resize #sidebar_resizer{position:absolute;z-index:3;height:100vh;width:20px;transform:translateX(-50%);cursor:col-resize}#sidebar_left #sidebar_collapse{position:relative;left:100%;top:100%;width:0;height:0}#sidebar_left #sidebar_collapse .collapse_btn{position:absolute;bottom:0px;border-radius:100%;z-index:20001}#sidebar_left.collapsed{width:0px !important;min-width:0 !important}#sidebar_left.collapsed #sidebar_resize{display:none}#sidebar_left.collapsed #sidebar_collapse .collapse_btn .bi-chevron-left{display:none}#sidebar_left.expanded #sidebar_collapse .collapse_btn .bi-chevron-right{display:none}@media(min-width: 1400px){#sidebar_left:not(.collapsed) #sidebar_collapse .collapse_btn{transform:translateX(-20px)}#sidebar_left:not(.collapsed) #sidebar_collapse .collapse_btn .bi-chevron-right{display:none}}@media(max-width: 1399.98px){#sidebar_left:not(.expanded){width:0 !important;min-width:0 !important}#sidebar_left:not(.expanded) #sidebar_resize{display:none}#sidebar_left:not(.expanded) #sidebar_collapse .collapse_btn .bi-chevron-left{display:none}}@media(min-width: 768px)and (max-width: 1399.98px){#sidebar_left.expanded #sidebar_collapse .collapse_btn{transform:translateX(-20px)}}@media(max-width: 767.98px){#sidebar_left #sidebar_resize{display:none}#sidebar_left.expanded{width:100% !important;z-index:3}#sidebar_left.expanded #sidebar_collapse{left:calc(100% - 50px)}}.table_length,.table_filter{width:unset}#contents>div.card-body div.row>div{flex:1 0 auto;flex-wrap:nowrap}.table-footer{gap:1rem 0}.table-footer .table_info{white-space:nowrap}#main-area.full .table_length{max-width:max-content}#main-area.full .table_filter{max-width:300px} +[data-bs-theme=dark] #content{color:#f8f9fa;background-color:#212529}[data-bs-theme=dark] #navbar-content-wrapper{color:#f8f9fa;background-color:#212529}[data-bs-theme=dark] #sidebar_left{background-color:#343b45}[data-bs-theme=dark] #footer{color:#f8f9fa;background-color:#000}[data-bs-theme=dark] #contextmenu{color:#f8f9fa;background-color:#343a40}[data-bs-theme=dark] tr.selectable.selected td{background-color:#344555}[data-bs-theme=dark] .table-striped>tbody>tr.selectable.selected:nth-child(2n+1)>td{background-color:#485f76}[data-bs-theme=light] #content{color:#212529;background-color:#f8f9fa}[data-bs-theme=light] #navbar-content-wrapper{color:#212529;background-color:#fff}[data-bs-theme=light] #sidebar_left{background-color:#414c5b}[data-bs-theme=light] #footer{color:#212529;background-color:#f8f9fa}[data-bs-theme=light] #contextmenu{color:#212529;background-color:#fff}[data-bs-theme=light] tr.selectable.selected td{background-color:#dfeefb}[data-bs-theme=light] .table-striped>tbody>tr.selectable.selected:nth-child(2n+1)>td{background-color:#cfdce7}:root{--sidebar-width: 300px;--navbar-height: 50px}html{height:100%;width:100%}body{height:100%}#footer{z-index:1}#content{height:calc(100% - 40px)}#main-area{width:0 !important}tr.selectable td{user-select:none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}#input-contentform-save{margin-right:1rem}#header-logo{z-index:4}#header-logo>span,#header-logo-placeholder>span{font-size:1.5rem !important}#header-logo-placeholder{visibility:hidden}#main-area.compact #header-main.mobile-menu-open #header-logo-placeholder{display:none}#main-area.compact #header-main.mobile-menu-open #navbar-content-wrapper{max-height:calc(100vh - 50px);position:relative;overflow:hidden;padding:0 !important;z-index:3}@media screen and (max-width: 768px){#main-area.compact #header-main.mobile-menu-open #navbar-content-wrapper{z-index:1200}}#main-area.compact #header-main.mobile-menu-open #header-content{align-items:flex-start}#main-area.compact #header-main.mobile-menu-open .navbar-toggler{height:50px !important}#main-area.compact #header-main.mobile-menu-open #mainmenu{align-items:baseline}#main-area.compact #header-main.mobile-menu-open #mainmenu .scrollbar{display:none !important}#main-area.compact #header-main.mobile-menu-open #mainmenu .scrollable-content{right:0 !important}#main-area.compact #header-main.mobile-menu-open #mainmenu .dropdown-menu{border:none}#main-area.compact #header-main.mobile-menu-open #mainmenu .dropdown-menu>li .dropdown-item{padding:8px 20px}#main-area.compact #header-main.mobile-menu-open #mainmenu .dropdown-menu>li:first-child .dropdown-item{padding-top:0}#main-area.super-compact #personaltools{height:50px;justify-content:space-between;margin:auto 20px}#main-area.super-compact #personaltools #colortoggler{padding-left:0}#main-area.full #mainmenu .dropdown-menu{position:fixed}#main-area.full #personaltools{height:100%}#main-area #header-main{height:var(--navbar-height)}#main-area #header-main.navbar-expand #header-content{flex-direction:row-reverse}#main-area #header-main.navbar-expand #navbar-content-wrapper{box-shadow:none !important;background:none}#main-area #header-main:not(.navbar-expand) #header-content{flex-direction:row}#main-area #header-main:not(.navbar-expand) #navbar-content{flex-direction:column}#main-area #header-main:not(.navbar-expand) #livesearch{order:0;width:100%;padding-left:55px !important;padding-right:15px !important}#main-area #header-main:not(.navbar-expand) #mainmenu{order:1;margin-left:10px !important;margin-top:20px;margin-bottom:20px}#main-area #header-main:not(.navbar-expand) #mainmenu ul>li{display:block !important}#main-area #header-main #navbar-content-wrapper{min-width:0;z-index:1}#main-area #header-main #navbar-content-wrapper #navbar-content{min-width:0}#main-area #header-main #mainmenu>ul{padding-left:8px;white-space:nowrap}#main-area #header-main #mainmenu .nav-item.active .nav-link{color:#4e7bba}#main-area #header-main #personaltools #language-dropdown>div.dropdown-toggle>a{height:20px}#main-area #header-main #personaltools #language-dropdown>div.dropdown-toggle>a img{vertical-align:baseline}#main-area #header-main #personaltools #colortoggler #colortoggle-switch{width:2rem;height:1rem}#personaltools-dropdown .dropdown-item a{text-decoration:none;color:var(--bs-secondary-color)}#form-loginform{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%}#form-loginform #field-loginform-user,#form-loginform #field-loginform-password{display:grid;grid-template-columns:1fr 2fr;margin-bottom:.5rem}#form-loginform #input-loginform-login{margin-top:1.5rem;width:200px}#layout:has(#sidebar_left.expanded) #header-logo,#layout:has(#sidebar_left.responsive-expanded:not(.collapsed)) #header-logo{color:#fff}.scrollable-x,.scrollable-y{position:relative;overflow:hidden}.scrollable-content{position:relative}.scrollbar{display:none;position:absolute;background:#dee2e6;border-radius:3px;z-index:1000}.scrollbar .scroll-handle{position:relative;border-radius:3px;background:#4e7bba}.scrollbar-top .scrollbar{top:0}.scrollbar-bottom .scrollbar{bottom:0}.scrollbar-left .scrollbar{left:0}.scrollbar-right .scrollbar{right:0}[data-bs-theme=dark] #content{color:#f8f9fa;background-color:#212529}[data-bs-theme=dark] #navbar-content-wrapper{color:#f8f9fa;background-color:#212529}[data-bs-theme=dark] #sidebar_left{background-color:#343b45}[data-bs-theme=dark] #footer{color:#f8f9fa;background-color:#000}[data-bs-theme=dark] #contextmenu{color:#f8f9fa;background-color:#343a40}[data-bs-theme=dark] tr.selectable.selected td{background-color:#344555}[data-bs-theme=dark] .table-striped>tbody>tr.selectable.selected:nth-child(2n+1)>td{background-color:#485f76}[data-bs-theme=light] #content{color:#212529;background-color:#f8f9fa}[data-bs-theme=light] #navbar-content-wrapper{color:#212529;background-color:#fff}[data-bs-theme=light] #sidebar_left{background-color:#414c5b}[data-bs-theme=light] #footer{color:#212529;background-color:#f8f9fa}[data-bs-theme=light] #contextmenu{color:#212529;background-color:#fff}[data-bs-theme=light] tr.selectable.selected td{background-color:#dfeefb}[data-bs-theme=light] .table-striped>tbody>tr.selectable.selected:nth-child(2n+1)>td{background-color:#cfdce7}#sidebar_left{height:100%;max-height:100%;user-select:none}#sidebar_left>.scrollable-y{margin-top:34px}#sidebar_left ul.list-group,#sidebar_left ul.list-group li{background-color:inherit}#sidebar_left #navtree{max-width:100%}#sidebar_left #navtree .nav-link{z-index:2000;white-space:nowrap}#sidebar_left #navtree .nav-link.active{background-color:rgba(0,0,0,0);font-weight:bold}#sidebar_left #navtree .nav-link i.bi-chevron-right{vertical-align:text-bottom}#sidebar_left #navtree .nav-link span{display:inline-block;width:calc(100% - 40px);text-overflow:ellipsis;overflow-x:hidden;vertical-align:text-bottom}#sidebar_left #sidebar_resize{position:relative;left:100%;width:0;height:0}#sidebar_left #sidebar_resize #sidebar_resizer{position:absolute;z-index:3;height:100vh;width:20px;transform:translateX(-50%);cursor:col-resize}#sidebar_left #sidebar_collapse{position:relative;left:100%;top:100%;width:0;height:0}#sidebar_left #sidebar_collapse .collapse_btn{position:absolute;bottom:0px;border-radius:100%;z-index:20001}#sidebar_left.collapsed{width:0px !important;min-width:0 !important}#sidebar_left.collapsed #sidebar_resize{display:none}#sidebar_left.collapsed #sidebar_collapse .collapse_btn .bi-chevron-left{display:none}#sidebar_left.expanded #sidebar_collapse .collapse_btn .bi-chevron-right{display:none}@media(min-width: 1400px){#sidebar_left:not(.collapsed) #sidebar_collapse .collapse_btn{transform:translateX(-20px)}#sidebar_left:not(.collapsed) #sidebar_collapse .collapse_btn .bi-chevron-right{display:none}}@media(max-width: 1399.98px){#sidebar_left:not(.expanded){width:0 !important;min-width:0 !important}#sidebar_left:not(.expanded) #sidebar_resize{display:none}#sidebar_left:not(.expanded) #sidebar_collapse .collapse_btn .bi-chevron-left{display:none}}@media(min-width: 768px)and (max-width: 1399.98px){#sidebar_left.expanded #sidebar_collapse .collapse_btn{transform:translateX(-20px)}}@media(max-width: 767.98px){#sidebar_left #sidebar_resize{display:none}#sidebar_left.expanded{width:100% !important;z-index:3}#sidebar_left.expanded #sidebar_collapse{left:calc(100% - 50px)}}.table_length,.table_filter{width:unset}#contents>div.card-body div.row>div{flex:1 0 auto;flex-wrap:nowrap}.table-footer{gap:1rem 0}.table-footer .table_info{white-space:nowrap}#main-area.full .table_length{max-width:max-content}#main-area.full .table_filter{max-width:300px} diff --git a/src/cone/app/browser/static/cone/cone.app.min.js b/src/cone/app/browser/static/cone/cone.app.min.js index fa3668eb..6c1399ab 100644 --- a/src/cone/app/browser/static/cone/cone.app.min.js +++ b/src/cone/app/browser/static/cone/cone.app.min.js @@ -1 +1 @@ -var cone=function(e,t,s){"use strict";class i{constructor(e,t){this.elem=e,this.name=t}set_filter(e){let t=this.elem,i=s.ajax.parse_target(t.attr("ajax:target")),o=t.attr("ajax:event");if(i.params[this.name]=e,t.attr("ajax:path")){let r=t.attr("ajax:path-event");r||(r=o),s.ajax.path({path:i.path+i.query+"&"+this.name+"="+e,event:r,target:i})}let r=o.split(":");s.ajax.trigger({name:r[0],selector:r[1],target:i})}}class o extends i{static initialize(e,s=".batched_items_slice_size select"){t(s,e).each((function(){new o(t(this))}))}constructor(e){super(e,"size"),e.off("change").on("change",this.change_handle.bind(this))}change_handle(e){let s=t("option:selected",this.elem).first();this.set_filter(s.val())}}class r extends i{static initialize(e,s=".batched_items_filter input",i="term"){t(s,e).each((function(){new r(t(this),i)}))}constructor(e,t){super(e,t),e.off("focus").on("focus",this.focus_handle.bind(this)),e.off("keypress").on("keypress",this.keypress_handle.bind(this)),e.off("keyup").on("keyup",this.keyup_handle.bind(this)),e.off("change").on("change",this.change_handle.bind(this))}focus_handle(e){let t=this.elem;t.hasClass("empty_filter")&&(t.val(""),t.removeClass("empty_filter"))}keypress_handle(e){13==e.keyCode&&e.preventDefault()}keyup_handle(e){13==e.keyCode&&(e.preventDefault(),this.set_filter(this.elem.val()))}change_handle(e){e.preventDefault(),this.set_filter(this.elem.val())}}class a{static get media_query(){return window.matchMedia("(prefers-color-scheme: dark)")}static get stored_theme(){return localStorage.getItem("cone-app-color-theme")}static set stored_theme(e){localStorage.setItem("cone-app-color-theme",e)}static get preferred_theme(){return this.stored_theme?this.stored_theme:this.media_query.matches?"dark":"light"}static watch(e){this.media_query.addEventListener("change",e)}static set_theme(e){const t=document.documentElement;"auto"===e&&this.media_query.matches?t.setAttribute("data-bs-theme","dark"):t.setAttribute("data-bs-theme",e)}constructor(){this.bind(),a.set_theme(a.preferred_theme)}bind(){a.watch((()=>{const e=this.stored_theme;"light"===e&&"dark"===e||a.set_theme(a.preferred_theme)}))}}class n extends s.ChangeListener{static initialize(e){const t=s.query_elem("#colortoggle-switch",e);t&&new n(t)}constructor(e){super({elem:e}),this.update(),a.watch((()=>{this.update()}))}update(){const e=a.preferred_theme,t=this.elem,s=t.is(":checked");"dark"!==e||s?"light"===e&&s&&t.prop("checked",!1):t.prop("checked",!0)}on_change(){const e=this.elem.is(":checked")?"dark":"light";a.set_theme(e),a.stored_theme=e}}class l{static initialize(e){new l(e)}constructor(e){this.cut_cookie="cone.app.copysupport.cut",this.copy_cookie="cone.app.copysupport.copy",this.context=e,this.paste_action=t("a#toolbaraction-paste",e),this.paste_action.off("click").on("click",this.handle_paste.bind(this)),this.copyable=t("table tr.selectable.copysupportitem",e),this.copyable.length&&(this.cut_action=t("a#toolbaraction-cut",e),this.cut_action.off("click").on("click",this.handle_cut.bind(this)),this.copy_action=t("a#toolbaraction-copy",e),this.copy_action.off("click").on("click",this.handle_copy.bind(this)),this.selectable=this.copyable.selectable({on_firstclick:this.on_firstclick.bind(this),on_select:this.on_select.bind(this)}).data("selectable"),this.read_selected_from_cookie(this.cut_cookie,"copysupport_cut"),this.read_selected_from_cookie(this.copy_cookie,""))}on_firstclick(e,t){}on_select(e){}write_selected_to_cookie(e){let i=t(this.selectable.selected),o=new Array;i.each((function(){o.push(t(this).attr("ajax:target"))}));let r=o.join("::");s.create_cookie(e,r),r.length?t(this.paste_action).removeClass("disabled"):t(this.paste_action).addClass("disabled")}read_selected_from_cookie(e,i){let o=s.read_cookie(e);if(!o)return;let r,a,n=o.split("::"),l=this;t("table tr.selectable",this.context).each((function(){r=t(this),a=r.attr("ajax:target");for(let e in n)if(n[e]==a){r.addClass("selected"),i&&r.addClass(i),l.selectable.add(r.get(0));break}}))}handle_cut(e){e.preventDefault(),s.create_cookie(this.copy_cookie,"",0),this.write_selected_to_cookie(this.cut_cookie),this.copyable.removeClass("copysupport_cut"),t(this.selectable.selected).addClass("copysupport_cut")}handle_copy(e){e.preventDefault(),s.create_cookie(this.cut_cookie,"",0),this.write_selected_to_cookie(this.copy_cookie),this.copyable.removeClass("copysupport_cut")}handle_paste(e){e.preventDefault();let i=t(e.currentTarget);if(i.hasClass("disabled"))return;let o=s.ajax.parse_target(i.attr("ajax:target"));s.ajax.action({name:"paste",mode:"NONE",selector:"NONE",url:o.url,params:o.params})}}let h={shift_down:!1,ctrl_down:!1};class c{constructor(){t(window).on("keydown",this.key_down.bind(this)),t(window).on("keyup",this.key_up.bind(this))}key_down(e){switch(e.keyCode||e.which){case 16:h.shift_down=!0;break;case 17:h.ctrl_down=!0}}key_up(e){switch(e.keyCode||e.which){case 16:h.shift_down=!1;break;case 17:h.ctrl_down=!1}}}class d{static initialize(e,t=null){const i=s.query_elem("input#search-text",e);i&&(null===t&&(t=cone.LiveSearch),new t(i))}constructor(e){this.elem=e,this.target=`${e.data("search-target")}/livesearch`,this.content=t("#content"),this.result=null,this._term="",this._minlen=3,this._delay=250,this._timeout_event=null,this._in_progress=!1,this.on_keydown=this.on_keydown.bind(this),this.on_change=this.on_change.bind(this),this.on_result=this.on_result.bind(this),e.on("keydown",this.on_keydown),e.on("change",this.on_change)}search(){this._in_progress=!0,s.http_request({url:this.target,params:{term:this._term},type:"json",success:this.on_result}),this._in_progress=!1}render_no_results(){s.compile_template(this,'\n
No search results
\n ',this.result)}render_suggestion(e){s.compile_template(this,`\n
\n
\n \n \n ${e.value}\n \n
\n

\n ${void 0===e.description?"":e.description}\n

\n
\n `,this.result)}on_result(e,t,i){if(this.content.empty(),s.compile_template(this,`\n
\n
\n

Search results for "${this._term}"

\n
\n
\n `,this.content),e.length){s.compile_template(this,`\n

\n ${e.length} Results\n

\n `,this.result);for(const t of e)this.render_suggestion(t)}else this.render_no_results();this.result.tsajax()}on_keydown(e){13!==e.keyCode&&s.clock.schedule_frame((()=>{this._term!==this.elem.val()&&this.elem.trigger("change")}))}on_change(e){if(this._in_progress)return;const t=this.elem.val();this._term!==t&&(this._term=t,this._term.length{this._timeout_event=null,this.search()}),this._delay)))}}class _{static initialize(e){if(!e)return;let s=e.parents("div.modal");if(!s.length)return;let i=s.data("overlay"),o=i.ref_target;t("a.addreference",e).each((function(){new p(t(this),o,i)})),t("a.removereference",e).each((function(){new m(t(this),o,i)}))}constructor(e,t,s){this.elem=e,this.target=t,this.target_tag=t.get(0).tagName,this.overlay=s}single_value(){return"INPUT"==this.target_tag}multi_value(){return"SELECT"==this.target_tag}toggle_enabled(e){t("a",e.parent()).toggleClass("disabled")}reset_selected(e){let s=new Array;this.single_value()&&s.push(e.attr("value")),this.multi_value()&&t("[selected=selected]",e).each((function(){s.push(t(this).attr("value"))})),this.set_selected_on_ajax_target(e.parent(),s);let i=this.overlay,o=this;t("div.referencebrowser a",i.elem).each((function(){let e=t(this);e.attr("ajax:target")&&o.set_selected_on_ajax_target(e,s)}))}set_selected_on_ajax_target(e,t){let i=s.ajax.parse_target(e.attr("ajax:target"));i.params.selected=t.join(",");let o=new Array;for(let e in i.params)o.push(e+"="+i.params[e]);e.attr("ajax:target",i.url+"?"+o.join("&"))}}class p extends _{constructor(e,t,s){super(e,t,s),e.off("click").on("click",this.add_reference.bind(this))}add_reference(e){e.preventDefault();let s=this.elem,i=this.target,o=s.attr("id");o=o.substring(4,o.length);let r=t(".reftitle",s.parent()).html();if(this.single_value()){i.attr("value",r);let e='[name="'+i.attr("name")+'.uid"]';return t(e).attr("value",o),this.set_selected_on_ajax_target(i.parent(),[o]),void this.overlay.close()}if(this.multi_value()){if(t('[value="'+o+'"]',i.parent()).length)return;let e=t("");e.val(o).html(r).attr("selected","selected"),i.append(e),i.trigger("change")}this.reset_selected(i),this.toggle_enabled(s)}}class m extends _{constructor(e,t,s){super(e,t,s),e.off("click").on("click",this.remove_reference.bind(this))}remove_reference(e){e.preventDefault();let s=this.elem,i=this.target,o=s.attr("id");if(o=o.substring(4,o.length),this.single_value()){i.attr("value","");let e='[name="'+i.attr("name")+'.uid"]';t(e).attr("value","")}if(this.multi_value()){let e='[value="'+o+'"]';if(!t(e,i.parent()).length)return;t(e,i).remove(),i.trigger("change")}this.reset_selected(i),this.toggle_enabled(s)}}class u{static initialize(e){t(".referencebrowser_trigger",e).each((function(){new u(t(this))}))}constructor(e){this.wrapper=e.parent();let s=`[name="${e.data("reference-name")}"]`;this.target=t(s,this.wrapper),e.off("click").on("click",this.load_ref_browser.bind(this))}load_ref_browser(e){e.preventDefault(),s.ajax.overlay({action:"referencebrowser",target:this.wrapper.attr("ajax:target"),on_complete:this.on_complete.bind(this)}).ref_target=this.target}on_complete(e){let s=this.target;t("a.addreference",e.elem).each((function(){new p(t(this),s,e)})),t("a.removereference",e.elem).each((function(){new m(t(this),s,e)}))}}function b(e,t){u.initialize(t)}function f(e,s,i){t(".referencebrowser_trigger",s).each((function(){let s=t(this),o=s.data("reference-name"),r=e.base_id.replace(/\-/g,".");s.data("reference-name",e.set_value_index(o,r,i,"."))}))}t((function(){void 0!==window.yafowil_array&&(yafowil_array.on_array_event("on_add",b),yafowil_array.on_array_event("on_index",f))}));class g extends s.Motion{static initialize(e){t(".scrollable-x",e).each((function(){new v(t(this))})),t(".scrollable-y",e).each((function(){new w(t(this))}))}constructor(e){if(super(),this.elem=e,this.elem.data("scrollbar"))return void console.warn("cone.app: Only one Scrollbar can be bound to each element.");this.elem.data("scrollbar",this),this.content=s.query_elem("> .scrollable-content",e),this.on_scroll=this.on_scroll.bind(this),this.on_click=this.on_click.bind(this),this.on_hover=this.on_hover.bind(this),this.on_resize=this.on_resize.bind(this),this.compile(),this.position=0,this.scroll_step=50,new s.Property(this,"disabled",!1),s.ajax.attach(this,this.elem),s.clock.schedule_frame((()=>this.render()));const i=t(window).width()<=768;new s.Property(this,"is_mobile",i)}get position(){return this._position||0}set position(e){this._position=this.safe_position(e),this.update(),this.trigger("on_position",this._position)}get pointer_events(){return"all"===this.elem.css("pointer-events")}set pointer_events(e){this.elem.css("pointer-events",e?"all":"none")}fade_timer(){this.scrollbar.is(":visible")||this.scrollbar.fadeIn("fast"),this.fade_out_timeout&&clearTimeout(this.fade_out_timeout),this.fade_out_timeout=setTimeout((()=>{this.scrollbar.fadeOut("slow")}),700)}on_is_mobile(e){e&&this.contentsize>this.scrollsize?(this.scrollbar.stop(!0,!0).show(),this.elem.off("mouseenter mouseleave",this.on_hover)):(this.scrollbar.stop(!0,!0).hide(),this.elem.on("mouseenter mouseleave",this.on_hover))}bind(){this.pointer_events=!0,this.elem.on("mousewheel wheel",this.on_scroll),this.scrollbar.on("click",this.on_click),this.set_scope(this.thumb,t(document),this.elem),t(window).on("resize",this.on_resize)}unbind(){this.elem.off("mousewheel wheel",this.on_scroll),this.elem.off("mouseenter mouseleave",this.on_hover),this.scrollbar.off("click",this.on_click),t(this.thumb).off("mousedown",this._down_handle),t(window).off("resize",this.on_resize)}destroy(){this.unbind(),this.scrollbar.remove(),this.elem.data("scrollbar",null)}compile(){s.compile_template(this,'\n
\n
\n
\n
\n ',this.elem)}render(e){this.scrollbar.css(e,this.scrollsize),this.contentsize<=this.scrollsize?this.thumbsize=this.scrollsize:this.thumbsize=Math.pow(this.scrollsize,2)/this.contentsize,this.thumb.css(e,this.thumbsize),this.update(),this.position=this.safe_position(this.position)}safe_position(e){if("number"!=typeof e)throw`Scrollbar position must be a Number, position is: "${e}".`;if(this.contentsize<=this.scrollsize)return 0;const t=this.contentsize-this.scrollsize;return e>=t?e=t:e<=0&&(e=0),e}on_disabled(e){e?this.unbind():this.bind()}on_resize(){this.is_mobile=t(window).width()<=768,this.position=this.safe_position(this.position),this.render()}on_hover(e){e.preventDefault(),e.stopPropagation();const t=this.elem;(t.has(e.target).length>0||t.is(e.target))&&this.contentsize>this.scrollsize&&("mouseenter"===e.type?this.scrollbar.stop(!0,!0).fadeIn():"mouseleave"===e.type&&e.relatedTarget!==t.get(0)&&this.scrollbar.stop(!0,!0).fadeOut())}on_scroll(e){if(this.contentsize<=this.scrollsize)return;let t=e.originalEvent;"number"==typeof t.deltaY&&(t.deltaY>0?this.position+=this.scroll_step:t.deltaY<0&&(this.position-=this.scroll_step))}on_click(e){e.preventDefault(),this.thumb.addClass("active");let t=this.pos_from_evt(e)-this.offset-this.thumbsize/2;this.position=this.contentsize*t/this.scrollsize,this.thumb.removeClass("active")}touchstart(e){const t=e.originalEvent.touches[0];this._touch_pos=this.pos_from_evt(t),this._start_position=this.position}touchmove(e){if(this.contentsize<=this.scrollsize)return;const t=e.originalEvent.touches[0],s=this.pos_from_evt(t)-this._touch_pos;this.position=this._start_position-s,this.fade_timer()}touchend(e){delete this._touch_pos,delete this._start_position}down(e){this._mouse_pos=this.pos_from_evt(e)-this.offset,this._thumb_pos=this.position/(this.contentsize/this.scrollsize),this.elem.off("mouseenter mouseleave",this.on_hover),this.thumb.addClass("active")}move(e){let t=this.pos_from_evt(e)-this.offset,s=this._thumb_pos+t-this._mouse_pos;this.position=this.contentsize*s/this.scrollsize}up(e){delete this._mouse_pos,delete this._thumb_pos,this.elem.on("mouseenter mouseleave",this.on_hover),this.thumb.removeClass("active")}}class v extends g{get offset(){return this.elem.offset().left}get contentsize(){return this.content.outerWidth()}get scrollsize(){const e=parseFloat(this.elem.css("padding-right")),t=parseFloat(this.elem.css("padding-left"));return this.elem.outerWidth()-t-e}compile(){super.compile(),this.thumb.css("height","6px"),this.scrollbar.css("height","6px").css("width",this.scrollsize),this.thumbsize=this.scrollsize/(this.contentsize/this.scrollsize),this.thumb.css("width",this.thumbsize)}render(){super.render("width")}update(){let e=this.position/(this.contentsize/this.scrollsize);this.content.css("right",this.position+"px"),this.thumb.css("left",e+"px")}pos_from_evt(e){return e.pageX}}class w extends g{get offset(){return this.elem.offset().top}get contentsize(){return this.content.outerHeight()}get scrollsize(){const e=parseFloat(this.elem.css("padding-top")),t=parseFloat(this.elem.css("padding-bottom"));return this.elem.outerHeight()-e-t}compile(){super.compile(),this.thumb.css("width","6px"),this.scrollbar.css("width","6px").css("top","0px").css("height",this.scrollsize),this.thumbsize=this.scrollsize/(this.contentsize/this.scrollsize),this.thumb.css("height",this.thumbsize)}render(){super.render("height")}update(){let e=this.position/(this.contentsize/this.scrollsize);this.content.css("bottom",this.position+"px"),this.thumb.css("top",e+"px")}pos_from_evt(e){return e.pageY}}class y{static initialize(e){new y(e)}constructor(e){t("input.add_remove_role_for_principal",e).off("change").on("change",this.set_principal_role)}set_principal_role(e){e.preventDefault();let i,o=t(this);i=this.checked?"add_principal_role":"remove_principal_role";let r=o.parent().attr("ajax:target"),a={id:o.attr("name"),role:o.attr("value")};s.ajax.action({name:i,mode:"NONE",selector:"NONE",url:r,params:a})}}class k extends s.Events{on_sidebar_resize(e){}on_main_area_mode(e){}}const z=new k;class x extends s.Motion{static initialize(e){const t=s.query_elem("#sidebar_left",e);t&&new x(t)}constructor(e){super(),this.elem=e,e.css("width",this.sidebar_width+"px"),this.scrollbar=s.query_elem(".scrollable-y",e).data("scrollbar");const i=s.query_elem(".scrollable-content",e),o=i.css("padding-left"),r=i.css("padding-right"),a=t("#header-logo").outerWidth(!0);e.css("min-width",`calc(${a}px + ${o} + ${r})`),this.on_click=this.on_click.bind(this);s.query_elem("#sidebar_collapse",e).on("click",this.on_click);const n=s.query_elem("#sidebar_resizer",e);this.set_scope(n,t(document)),this.responsive_toggle=this.responsive_toggle.bind(this),t(window).on("resize",this.responsive_toggle),this.responsive_toggle(),t("html, body").css("overscroll-behavior","auto")}get sidebar_width(){return localStorage.getItem("cone-app-sidebar-width")||300}set sidebar_width(e){localStorage.setItem("cone-app-sidebar-width",e)}get collapsed(){return this.elem.outerWidth()<=0}responsive_toggle(){this.collapsed?(this.elem.removeClass("responsive-expanded"),this.elem.addClass("responsive-collapsed")):(this.elem.addClass("responsive-expanded"),this.elem.removeClass("responsive-collapsed")),this.collapsed!==this.responsive_collapsed&&(this.responsive_collapsed=this.collapsed,z.trigger("on_sidebar_resize",this))}collapse(){t("html, body").css("overscroll-behavior","auto"),this.elem.removeClass("expanded").addClass("collapsed"),z.trigger("on_sidebar_resize",this)}expand(){t("html, body").css("overscroll-behavior","none"),this.elem.removeClass("collapsed").addClass("expanded"),z.trigger("on_sidebar_resize",this)}on_click(e){this.collapsed?this.expand():this.collapse()}move(e){this.scrollbar.pointer_events=!1,e.pageX<=115&&(e.pageX=115),this.sidebar_width=parseInt(e.pageX),this.elem.css("width",this.sidebar_width),z.trigger("on_sidebar_resize",this)}up(){this.scrollbar.pointer_events=!0,z.trigger("on_sidebar_resize",this)}}class C{static initialize(e){o.initialize(e,".table_length select"),r.initialize(e,".table_filter input")}}class j{static initialize(e){t(".translation-nav",e).each((function(){new j(t(this))}))}constructor(e){t("div.invalid-feedback",e.parent()).show(),this.nav_elem=e,this.fields_elem=e.next(),this.show_lang_handle=this.show_lang_handle.bind(this),t("li > a",e).on("click",this.show_lang_handle),t("li.error",e).length?t("li.error:first > a",e).trigger("click"):t("li > a.active",e).trigger("click"),this.fields_elem.show()}show_lang_handle(e){e.preventDefault(),t("li > a",this.nav_elem).removeClass("active"),this.fields_elem.children().hide();let s=t(e.currentTarget);s.addClass("active"),t(s.attr("href"),this.fields_elem).show()}}class q extends s.Events{static initialize(e){const t=s.query_elem("#main-area",e);t&&new q(t)}constructor(e){super(),this.elem=e,new s.Property(this,"is_compact",null),new s.Property(this,"is_super_compact",null),this.set_mode=this.set_mode.bind(this),z.on("on_sidebar_resize",this.set_mode),t(window).on("resize",this.set_mode),this.set_mode(),s.ajax.attach(this,e)}destroy(){t(window).off("resize",this.set_mode),z.off("on_sidebar_resize",this.set_mode)}set_mode(){this.is_compact=this.elem.outerWidth()<992,this.is_super_compact=this.elem.outerWidth()<576}on_is_compact(e){e?(this.elem.removeClass("full"),this.elem.addClass("compact")):(this.elem.removeClass("compact"),this.elem.addClass("full")),z.trigger("on_main_area_mode",this)}on_is_super_compact(e){e?this.elem.addClass("super-compact"):this.elem.removeClass("super-compact"),z.trigger("on_main_area_mode",this)}}class S extends s.Events{constructor(e){super(),this.elem=e,new s.Property(this,"is_compact",null),new s.Property(this,"is_super_compact",null),new s.Property(this,"is_sidebar_collapsed",null),this.set_mode=this.set_mode.bind(this),z.on("on_main_area_mode",this.set_mode),this.on_sidebar_resize=this.on_sidebar_resize.bind(this),z.on("on_sidebar_resize",this.on_sidebar_resize),s.ajax.attach(this,e)}destroy(){z.off("on_main_area_mode",this.set_mode),z.off("on_sidebar_resize",this.on_sidebar_resize)}set_mode(e,t){this.is_compact=t.is_compact,this.is_super_compact=t.is_super_compact}on_is_compact(e){e?(this.elem.removeClass("full"),this.elem.addClass("compact")):(this.elem.removeClass("compact"),this.elem.addClass("full"))}on_is_super_compact(e){e?this.elem.addClass("super-compact"):this.elem.removeClass("super-compact")}on_sidebar_resize(e,t){this.is_sidebar_collapsed=t.collapsed}on_is_sidebar_collapsed(e){}}class E extends S{static initialize(e){const t=s.query_elem("#mainmenu",e);t&&new E(t)}constructor(e){super(e),this.elem=e,this.height=this.elem.outerHeight(),this.scrollbar=e.data("scrollbar"),this.elems=t(".nav-link.dropdown-toggle",e),this.open_dropdown=null,this.on_show_dropdown_desktop=this.on_show_dropdown_desktop.bind(this),this.on_hide_dropdown_desktop=this.on_hide_dropdown_desktop.bind(this),this.hide_dropdowns=this.hide_dropdowns.bind(this),this.scrollbar.on("on_position",this.hide_dropdowns)}on_sidebar_resize(e,t){super.on_sidebar_resize(e,t),requestAnimationFrame((()=>{this.scrollbar.render()}))}on_is_compact(e){this.hide_dropdowns(),e?(this.scrollbar.off("on_position",this.hide_dropdowns),this.bind_dropdowns_mobile()):(this.bind_dropdowns_desktop(),this.scrollbar.on("on_position",this.hide_dropdowns))}on_show_dropdown_desktop(e){const s=e.target;this.open_dropdown=s,this.elem.css("height","200vh");t(s).siblings("ul.dropdown-menu").css({top:`${this.height}px`,left:`${t(s).offset().left}px`})}on_hide_dropdown_desktop(e){const t=e.target;this.open_dropdown===t&&(this.elem.css("height","100%"),this.open_dropdown=null)}bind_dropdowns_desktop(){this.elems.each(((e,s)=>{t(s).on("shown.bs.dropdown",this.on_show_dropdown_desktop),t(s).on("hidden.bs.dropdown",this.on_hide_dropdown_desktop)}))}bind_dropdowns_mobile(){this.elems.each(((e,s)=>{t(s).off("shown.bs.dropdown",this.on_show_dropdown_desktop),t(s).off("hidden.bs.dropdown",this.on_hide_dropdown_desktop)}))}hide_dropdowns(){this.elems.each(((e,s)=>{t(s).dropdown("hide")}))}}class $ extends S{static initialize(e){const t=s.query_elem("#header-main",e);t&&new $(t)}constructor(e){super(e),this.elem=e,this.logo_placeholder=s.query_elem("#header-logo-placeholder",e),this.header_content=s.query_elem("#header-content",e),this.navbar_content_wrapper=s.query_elem("#navbar-content-wrapper",e),this.navbar_content=s.query_elem("#navbar-content",e),this.personal_tools=s.query_elem("#personaltools",e),this.mainmenu=s.query_elem("#mainmenu",e),this.mainmenu_elems=t(".nav-link.dropdown-toggle",this.mainmenu),this.mainmenu_elems.each(((e,s)=>{t(s).on("shown.bs.dropdown",this.render_mobile_scrollbar.bind(this)),t(s).on("hidden.bs.dropdown",this.render_mobile_scrollbar.bind(this))})),s.ajax.attach(this,e),this.render_mobile_scrollbar=this.render_mobile_scrollbar.bind(this)}destroy(){super.destroy(),this.mainmenu_elems.each(((e,s)=>{t(s).off("shown.bs.dropdown",this.render_mobile_scrollbar.bind(this)),t(s).off("hidden.bs.dropdown",this.render_mobile_scrollbar.bind(this))}))}render_mobile_scrollbar(){this.is_compact&&this.mobile_scrollbar&&this.mobile_scrollbar.render()}on_is_compact(e){e?(this.elem.removeClass("full").removeClass("navbar-expand"),this.elem.addClass("compact"),this.navbar_content.addClass("scrollable-content"),this.mobile_scrollbar=new w(this.navbar_content_wrapper),this.navbar_content_wrapper.on("shown.bs.collapse",(()=>{t("html, body").css("overscroll-behavior","none"),this.mobile_scrollbar.render()})),this.navbar_content_wrapper.on("hide.bs.collapse",(()=>{t("html, body").css("overscroll-behavior","auto"),this.mobile_scrollbar.scrollbar.hide()}))):(this.elem.removeClass("compact"),this.elem.addClass("full").addClass("navbar-expand"),this.navbar_content.removeClass("scrollable-content"),this.mobile_scrollbar&&(this.mobile_scrollbar.destroy(),this.mobile_scrollbar=null))}on_is_super_compact(e){const i=null!==s.query_elem("#personaltools",this.navbar_content);e?i||this.personal_tools.detach().appendTo(this.navbar_content):(i&&this.personal_tools.detach().prependTo(this.header_content),t(".dropdown-menu.show").removeClass("show"))}on_is_sidebar_collapsed(e){console.log("sidebar collapsed "+e),e?this.logo_placeholder.show():this.logo_placeholder.hide()}}class D{constructor(e){this.options=e,this.selected=[],this.select_direction=0,this.firstclick=!0}reset(){this.selected=[]}add(e){this.remove(e),this.selected.push(e)}remove(e){let s=t.grep(this.selected,(function(t,s){return t!==e}));this.selected=s}select_no_key(e,t){e.children().removeClass("selected"),t.addClass("selected"),this.reset(),this.add(t.get(0))}select_ctrl_down(e){e.toggleClass("selected"),e.hasClass("selected")?this.add(e.get(0)):this.remove(e.get(0))}get_nearest(e,s){let i,o,r=e.children(".selected"),a=-1;return t(r).each((function(){o=t(this),i=o.index(),-1==a?a=i:s>i?this.select_direction>0?ia&&(a=i):s{const e=this.stored_theme;"light"===e&&"dark"===e||n.set_theme(n.preferred_theme)}))}}class a extends s.ChangeListener{static initialize(e){const t=s.query_elem("#colortoggle-switch",e);t&&new a(t)}constructor(e){super({elem:e}),this.update(),n.watch((()=>{this.update()}))}update(){const e=n.preferred_theme,t=this.elem,s=t.is(":checked");"dark"!==e||s?"light"===e&&s&&t.prop("checked",!1):t.prop("checked",!0)}on_change(){const e=this.elem.is(":checked")?"dark":"light";n.set_theme(e),n.stored_theme=e}}class l{static initialize(e){new l(e)}constructor(e){this.cut_cookie="cone.app.copysupport.cut",this.copy_cookie="cone.app.copysupport.copy",this.context=e,this.paste_action=t("a#toolbaraction-paste",e),this.paste_action.off("click").on("click",this.handle_paste.bind(this)),this.copyable=t("table tr.selectable.copysupportitem",e),this.copyable.length&&(this.cut_action=t("a#toolbaraction-cut",e),this.cut_action.off("click").on("click",this.handle_cut.bind(this)),this.copy_action=t("a#toolbaraction-copy",e),this.copy_action.off("click").on("click",this.handle_copy.bind(this)),this.selectable=this.copyable.selectable({on_firstclick:this.on_firstclick.bind(this),on_select:this.on_select.bind(this)}).data("selectable"),this.read_selected_from_cookie(this.cut_cookie,"copysupport_cut"),this.read_selected_from_cookie(this.copy_cookie,""))}on_firstclick(e,t){}on_select(e){}write_selected_to_cookie(e){let i=t(this.selectable.selected),o=new Array;i.each((function(){o.push(t(this).attr("ajax:target"))}));let r=o.join("::");s.create_cookie(e,r),r.length?t(this.paste_action).removeClass("disabled"):t(this.paste_action).addClass("disabled")}read_selected_from_cookie(e,i){let o=s.read_cookie(e);if(!o)return;let r,n,a=o.split("::"),l=this;t("table tr.selectable",this.context).each((function(){r=t(this),n=r.attr("ajax:target");for(let e in a)if(a[e]==n){r.addClass("selected"),i&&r.addClass(i),l.selectable.add(r.get(0));break}}))}handle_cut(e){e.preventDefault(),s.create_cookie(this.copy_cookie,"",0),this.write_selected_to_cookie(this.cut_cookie),this.copyable.removeClass("copysupport_cut"),t(this.selectable.selected).addClass("copysupport_cut")}handle_copy(e){e.preventDefault(),s.create_cookie(this.cut_cookie,"",0),this.write_selected_to_cookie(this.copy_cookie),this.copyable.removeClass("copysupport_cut")}handle_paste(e){e.preventDefault();let i=t(e.currentTarget);if(i.hasClass("disabled"))return;let o=s.ajax.parse_target(i.attr("ajax:target"));s.ajax.action({name:"paste",mode:"NONE",selector:"NONE",url:o.url,params:o.params})}}let h={shift_down:!1,ctrl_down:!1};class c{constructor(){t(window).on("keydown",this.key_down.bind(this)),t(window).on("keyup",this.key_up.bind(this))}key_down(e){switch(e.keyCode||e.which){case 16:h.shift_down=!0;break;case 17:h.ctrl_down=!0}}key_up(e){switch(e.keyCode||e.which){case 16:h.shift_down=!1;break;case 17:h.ctrl_down=!1}}}class d{static initialize(e,t=null){const i=s.query_elem("input#search-text",e);i&&(null===t&&(t=cone.LiveSearch),new t(i))}constructor(e){this.elem=e,this.target=`${e.data("search-target")}/livesearch`,this.content=t("#content"),this.result=null,this._term="",this._minlen=3,this._delay=250,this._timeout_event=null,this._in_progress=!1,this.on_keydown=this.on_keydown.bind(this),this.on_change=this.on_change.bind(this),this.on_result=this.on_result.bind(this),e.on("keydown",this.on_keydown),e.on("change",this.on_change)}search(){this._in_progress=!0,s.http_request({url:this.target,params:{term:this._term},type:"json",success:this.on_result}),this._in_progress=!1}render_no_results(){s.compile_template(this,'\n
No search results
\n ',this.result)}render_suggestion(e){s.compile_template(this,`\n
\n
\n \n \n ${e.value}\n \n
\n

\n ${void 0===e.description?"":e.description}\n

\n
\n `,this.result)}on_result(e,t,i){if(this.content.empty(),s.compile_template(this,`\n
\n
\n

Search results for "${this._term}"

\n
\n
\n `,this.content),e.length){s.compile_template(this,`\n

\n ${e.length} Results\n

\n `,this.result);for(const t of e)this.render_suggestion(t)}else this.render_no_results();this.result.tsajax()}on_keydown(e){13!==e.keyCode&&s.clock.schedule_frame((()=>{this._term!==this.elem.val()&&this.elem.trigger("change")}))}on_change(e){if(this._in_progress)return;const t=this.elem.val();this._term!==t&&(this._term=t,this._term.length{this._timeout_event=null,this.search()}),this._delay)))}}class _{static initialize(e){if(!e)return;let s=e.parents("div.modal");if(!s.length)return;let i=s.data("overlay"),o=i.ref_target;t("a.addreference",e).each((function(){new p(t(this),o,i)})),t("a.removereference",e).each((function(){new m(t(this),o,i)}))}constructor(e,t,s){this.elem=e,this.target=t,this.target_tag=t.get(0).tagName,this.overlay=s}single_value(){return"INPUT"==this.target_tag}multi_value(){return"SELECT"==this.target_tag}toggle_enabled(e){t("a",e.parent()).toggleClass("disabled")}reset_selected(e){let s=new Array;this.single_value()&&s.push(e.attr("value")),this.multi_value()&&t("[selected=selected]",e).each((function(){s.push(t(this).attr("value"))})),this.set_selected_on_ajax_target(e.parent(),s);let i=this.overlay,o=this;t("div.referencebrowser a",i.elem).each((function(){let e=t(this);e.attr("ajax:target")&&o.set_selected_on_ajax_target(e,s)}))}set_selected_on_ajax_target(e,t){let i=s.ajax.parse_target(e.attr("ajax:target"));i.params.selected=t.join(",");let o=new Array;for(let e in i.params)o.push(e+"="+i.params[e]);e.attr("ajax:target",i.url+"?"+o.join("&"))}}class p extends _{constructor(e,t,s){super(e,t,s),e.off("click").on("click",this.add_reference.bind(this))}add_reference(e){e.preventDefault();let s=this.elem,i=this.target,o=s.attr("id");o=o.substring(4,o.length);let r=t(".reftitle",s.parent()).html();if(this.single_value()){i.attr("value",r);let e='[name="'+i.attr("name")+'.uid"]';return t(e).attr("value",o),this.set_selected_on_ajax_target(i.parent(),[o]),void this.overlay.close()}if(this.multi_value()){if(t('[value="'+o+'"]',i.parent()).length)return;let e=t("");e.val(o).html(r).attr("selected","selected"),i.append(e),i.trigger("change")}this.reset_selected(i),this.toggle_enabled(s)}}class m extends _{constructor(e,t,s){super(e,t,s),e.off("click").on("click",this.remove_reference.bind(this))}remove_reference(e){e.preventDefault();let s=this.elem,i=this.target,o=s.attr("id");if(o=o.substring(4,o.length),this.single_value()){i.attr("value","");let e='[name="'+i.attr("name")+'.uid"]';t(e).attr("value","")}if(this.multi_value()){let e='[value="'+o+'"]';if(!t(e,i.parent()).length)return;t(e,i).remove(),i.trigger("change")}this.reset_selected(i),this.toggle_enabled(s)}}class u{static initialize(e){t(".referencebrowser_trigger",e).each((function(){new u(t(this))}))}constructor(e){this.wrapper=e.parent();let s=`[name="${e.data("reference-name")}"]`;this.target=t(s,this.wrapper),e.off("click").on("click",this.load_ref_browser.bind(this))}load_ref_browser(e){e.preventDefault(),s.ajax.overlay({action:"referencebrowser",target:this.wrapper.attr("ajax:target"),on_complete:this.on_complete.bind(this)}).ref_target=this.target}on_complete(e){let s=this.target;t("a.addreference",e.elem).each((function(){new p(t(this),s,e)})),t("a.removereference",e.elem).each((function(){new m(t(this),s,e)}))}}function b(e,t){u.initialize(t)}function f(e,s,i){t(".referencebrowser_trigger",s).each((function(){let s=t(this),o=s.data("reference-name"),r=e.base_id.replace(/\-/g,".");s.data("reference-name",e.set_value_index(o,r,i,"."))}))}t((function(){void 0!==window.yafowil_array&&(yafowil_array.on_array_event("on_add",b),yafowil_array.on_array_event("on_index",f))}));class g extends s.Motion{static initialize(e){t(".scrollable-x",e).each((function(){new v(t(this))})),t(".scrollable-y",e).each((function(){new w(t(this))}))}constructor(e){if(super(),this.elem=e,this.elem.data("scrollbar"))return void console.warn("cone.app: Only one Scrollbar can be bound to each element.");this.elem.data("scrollbar",this),this.content=s.query_elem("> .scrollable-content",e),this.on_scroll=this.on_scroll.bind(this),this.on_click=this.on_click.bind(this),this.on_hover=this.on_hover.bind(this),this.on_resize=this.on_resize.bind(this),this.compile(),this.position=0,this.scroll_step=50,new s.Property(this,"disabled",!1),s.ajax.attach(this,this.elem),s.clock.schedule_frame((()=>this.render()));const i=t(window).width()<=768;new s.Property(this,"is_mobile",i)}get position(){return this._position||0}set position(e){this._position=this.safe_position(e),this.update(),this.trigger("on_position",this._position)}get pointer_events(){return"all"===this.elem.css("pointer-events")}set pointer_events(e){this.elem.css("pointer-events",e?"all":"none")}fade_timer(){this.scrollbar.is(":visible")||this.scrollbar.fadeIn("fast"),this.fade_out_timeout&&clearTimeout(this.fade_out_timeout),this.fade_out_timeout=setTimeout((()=>{this.scrollbar.fadeOut("slow")}),700)}on_is_mobile(e){e&&this.contentsize>this.scrollsize?(this.scrollbar.stop(!0,!0).show(),this.elem.off("mouseenter mouseleave",this.on_hover)):(this.scrollbar.stop(!0,!0).hide(),this.elem.on("mouseenter mouseleave",this.on_hover))}bind(){this.pointer_events=!0,this.elem.on("mousewheel wheel",this.on_scroll),this.scrollbar.on("click",this.on_click),this.set_scope(this.thumb,t(document),this.elem),t(window).on("resize",this.on_resize)}unbind(){this.elem.off("mousewheel wheel",this.on_scroll),this.elem.off("mouseenter mouseleave",this.on_hover),this.scrollbar.off("click",this.on_click),t(this.thumb).off("mousedown",this._down_handle),t(window).off("resize",this.on_resize)}destroy(){this.unbind(),this.scrollbar.remove(),this.elem.data("scrollbar",null)}compile(){s.compile_template(this,'\n
\n
\n
\n
\n ',this.elem)}render(e){this.scrollbar.css(e,this.scrollsize),this.contentsize<=this.scrollsize?this.thumbsize=this.scrollsize:this.thumbsize=Math.pow(this.scrollsize,2)/this.contentsize,this.thumb.css(e,this.thumbsize),this.update(),this.position=this.safe_position(this.position)}safe_position(e){if("number"!=typeof e)throw`Scrollbar position must be a Number, position is: "${e}".`;if(this.contentsize<=this.scrollsize)return 0;const t=this.contentsize-this.scrollsize;return e>=t?e=t:e<=0&&(e=0),e}on_disabled(e){e?this.unbind():this.bind()}on_resize(){this.is_mobile=t(window).width()<=768,this.position=this.safe_position(this.position),this.render()}on_hover(e){e.preventDefault(),e.stopPropagation();const t=this.elem;(t.has(e.target).length>0||t.is(e.target))&&this.contentsize>this.scrollsize&&("mouseenter"===e.type?this.scrollbar.stop(!0,!0).fadeIn():"mouseleave"===e.type&&e.relatedTarget!==t.get(0)&&this.scrollbar.stop(!0,!0).fadeOut())}on_scroll(e){if(this.contentsize<=this.scrollsize)return;let t=e.originalEvent;"number"==typeof t.deltaY&&(t.deltaY>0?this.position+=this.scroll_step:t.deltaY<0&&(this.position-=this.scroll_step))}on_click(e){e.preventDefault(),this.thumb.addClass("active");let t=this.pos_from_evt(e)-this.offset-this.thumbsize/2;this.position=this.contentsize*t/this.scrollsize,this.thumb.removeClass("active")}touchstart(e){const t=e.originalEvent.touches[0];this._touch_pos=this.pos_from_evt(t),this._start_position=this.position}touchmove(e){if(this.contentsize<=this.scrollsize)return;const t=e.originalEvent.touches[0],s=this.pos_from_evt(t)-this._touch_pos;this.position=this._start_position-s,this.fade_timer()}touchend(e){delete this._touch_pos,delete this._start_position}down(e){this._mouse_pos=this.pos_from_evt(e)-this.offset,this._thumb_pos=this.position/(this.contentsize/this.scrollsize),this.elem.off("mouseenter mouseleave",this.on_hover),this.thumb.addClass("active")}move(e){let t=this.pos_from_evt(e)-this.offset,s=this._thumb_pos+t-this._mouse_pos;this.position=this.contentsize*s/this.scrollsize}up(e){delete this._mouse_pos,delete this._thumb_pos,this.elem.on("mouseenter mouseleave",this.on_hover),this.thumb.removeClass("active")}}class v extends g{get offset(){return this.elem.offset().left}get contentsize(){return this.content.outerWidth()}get scrollsize(){const e=parseFloat(this.elem.css("padding-right")),t=parseFloat(this.elem.css("padding-left"));return this.elem.outerWidth()-t-e}compile(){super.compile(),this.thumb.css("height","6px"),this.scrollbar.css("height","6px").css("width",this.scrollsize),this.thumbsize=this.scrollsize/(this.contentsize/this.scrollsize),this.thumb.css("width",this.thumbsize)}render(){super.render("width")}update(){let e=this.position/(this.contentsize/this.scrollsize);this.content.css("right",this.position+"px"),this.thumb.css("left",e+"px")}pos_from_evt(e){return e.pageX}}class w extends g{get offset(){return this.elem.offset().top}get contentsize(){return this.content.outerHeight()}get scrollsize(){const e=parseFloat(this.elem.css("padding-top")),t=parseFloat(this.elem.css("padding-bottom"));return this.elem.outerHeight()-e-t}compile(){super.compile(),this.thumb.css("width","6px"),this.scrollbar.css("width","6px").css("top","0px").css("height",this.scrollsize),this.thumbsize=this.scrollsize/(this.contentsize/this.scrollsize),this.thumb.css("height",this.thumbsize)}render(){super.render("height")}update(){let e=this.position/(this.contentsize/this.scrollsize);this.content.css("bottom",this.position+"px"),this.thumb.css("top",e+"px")}pos_from_evt(e){return e.pageY}}class y{static initialize(e){new y(e)}constructor(e){t("input.add_remove_role_for_principal",e).off("change").on("change",this.set_principal_role)}set_principal_role(e){e.preventDefault();let i,o=t(this);i=this.checked?"add_principal_role":"remove_principal_role";let r=o.parent().attr("ajax:target"),n={id:o.attr("name"),role:o.attr("value")};s.ajax.action({name:i,mode:"NONE",selector:"NONE",url:r,params:n})}}class k extends s.Events{on_sidebar_resize(e){}on_main_area_mode(e){}}const z=new k;class x extends s.Motion{static initialize(e){const t=s.query_elem("#sidebar_left",e);t&&new x(t)}constructor(e){super(),this.elem=e,e.css("width",this.sidebar_width+"px"),this.scrollbar=s.query_elem(".scrollable-y",e).data("scrollbar");const i=s.query_elem(".scrollable-content",e),o=i.css("padding-left"),r=i.css("padding-right"),n=t("#header-logo").outerWidth(!0);e.css("min-width",`calc(${n}px + ${o} + ${r})`),this.on_click=this.on_click.bind(this);s.query_elem("#sidebar_collapse",e).on("click",this.on_click);const a=s.query_elem("#sidebar_resizer",e);this.set_scope(a,t(document)),this.responsive_toggle=this.responsive_toggle.bind(this),t(window).on("resize",this.responsive_toggle),this.responsive_toggle(),t("html, body").css("overscroll-behavior","auto")}get sidebar_width(){return localStorage.getItem("cone-app-sidebar-width")||300}set sidebar_width(e){localStorage.setItem("cone-app-sidebar-width",e)}get collapsed(){return this.elem.outerWidth()<=0}responsive_toggle(){this.collapsed?(this.elem.removeClass("responsive-expanded"),this.elem.addClass("responsive-collapsed")):(this.elem.addClass("responsive-expanded"),this.elem.removeClass("responsive-collapsed")),this.collapsed!==this.responsive_collapsed&&(this.responsive_collapsed=this.collapsed,z.trigger("on_sidebar_resize",this))}collapse(){t("html, body").css("overscroll-behavior","auto"),this.elem.removeClass("expanded").addClass("collapsed"),z.trigger("on_sidebar_resize",this)}expand(){t("html, body").css("overscroll-behavior","none"),this.elem.removeClass("collapsed").addClass("expanded"),z.trigger("on_sidebar_resize",this)}on_click(e){this.collapsed?this.expand():this.collapse()}move(e){this.scrollbar.pointer_events=!1,e.pageX<=115&&(e.pageX=115),this.sidebar_width=parseInt(e.pageX),this.elem.css("width",this.sidebar_width),z.trigger("on_sidebar_resize",this)}up(){this.scrollbar.pointer_events=!0,z.trigger("on_sidebar_resize",this)}}class C{static initialize(e){o.initialize(e,".table_length select"),r.initialize(e,".table_filter input")}}class j{static initialize(e){t(".translation-nav",e).each((function(){new j(t(this))}))}constructor(e){t("div.invalid-feedback",e.parent()).show(),this.nav_elem=e,this.fields_elem=e.next(),this.show_lang_handle=this.show_lang_handle.bind(this),t("li > a",e).on("click",this.show_lang_handle),t("li.error",e).length?t("li.error:first > a",e).trigger("click"):t("li > a.active",e).trigger("click"),this.fields_elem.show()}show_lang_handle(e){e.preventDefault(),t("li > a",this.nav_elem).removeClass("active"),this.fields_elem.children().hide();let s=t(e.currentTarget);s.addClass("active"),t(s.attr("href"),this.fields_elem).show()}}class q extends s.Events{static initialize(e){const t=s.query_elem("#main-area",e);t&&new q(t)}constructor(e){super(),this.elem=e,new s.Property(this,"is_compact",null),new s.Property(this,"is_super_compact",null),this.set_mode=this.set_mode.bind(this),z.on("on_sidebar_resize",this.set_mode),t(window).on("resize",this.set_mode),this.set_mode(),s.ajax.attach(this,e)}destroy(){t(window).off("resize",this.set_mode),z.off("on_sidebar_resize",this.set_mode)}set_mode(){this.is_compact=this.elem.outerWidth()<992,this.is_super_compact=this.elem.outerWidth()<576}on_is_compact(e){e?(this.elem.removeClass("full"),this.elem.addClass("compact")):(this.elem.removeClass("compact"),this.elem.addClass("full")),z.trigger("on_main_area_mode",this)}on_is_super_compact(e){e?this.elem.addClass("super-compact"):this.elem.removeClass("super-compact"),z.trigger("on_main_area_mode",this)}}class S extends s.Events{constructor(e){super(),this.elem=e,new s.Property(this,"is_compact",null),new s.Property(this,"is_super_compact",null),new s.Property(this,"is_sidebar_collapsed",null),this.set_mode=this.set_mode.bind(this),z.on("on_main_area_mode",this.set_mode),this.on_sidebar_resize=this.on_sidebar_resize.bind(this),z.on("on_sidebar_resize",this.on_sidebar_resize),s.ajax.attach(this,e)}destroy(){z.off("on_main_area_mode",this.set_mode),z.off("on_sidebar_resize",this.on_sidebar_resize)}set_mode(e,t){this.is_compact=t.is_compact,this.is_super_compact=t.is_super_compact}on_is_compact(e){e?(this.elem.removeClass("full"),this.elem.addClass("compact")):(this.elem.removeClass("compact"),this.elem.addClass("full"))}on_is_super_compact(e){e?this.elem.addClass("super-compact"):this.elem.removeClass("super-compact")}on_sidebar_resize(e,t){this.is_sidebar_collapsed=t.collapsed}on_is_sidebar_collapsed(e){}}class E extends S{static initialize(e){const t=s.query_elem("#mainmenu",e);t&&new E(t)}constructor(e){super(e),this.elem=e,this.height=this.elem.outerHeight(),this.scrollbar=e.data("scrollbar"),this.elems=t(".nav-link.dropdown-toggle",e),this.open_dropdown=null,this.on_show_dropdown_desktop=this.on_show_dropdown_desktop.bind(this),this.on_hide_dropdown_desktop=this.on_hide_dropdown_desktop.bind(this),this.hide_dropdowns=this.hide_dropdowns.bind(this),this.scrollbar.on("on_position",this.hide_dropdowns)}on_sidebar_resize(e,t){super.on_sidebar_resize(e,t),requestAnimationFrame((()=>{this.scrollbar.render()}))}on_is_compact(e){this.hide_dropdowns(),e?(this.scrollbar.off("on_position",this.hide_dropdowns),this.bind_dropdowns_mobile()):(this.bind_dropdowns_desktop(),this.scrollbar.on("on_position",this.hide_dropdowns))}on_show_dropdown_desktop(e){const s=e.target;this.open_dropdown=s,this.elem.css("height","200vh");t(s).siblings("ul.dropdown-menu").css({top:`${this.height}px`,left:`${t(s).offset().left}px`})}on_hide_dropdown_desktop(e){const t=e.target;this.open_dropdown===t&&(this.elem.css("height","100%"),this.open_dropdown=null)}bind_dropdowns_desktop(){this.elems.each(((e,s)=>{t(s).on("shown.bs.dropdown",this.on_show_dropdown_desktop),t(s).on("hidden.bs.dropdown",this.on_hide_dropdown_desktop)}))}bind_dropdowns_mobile(){this.elems.each(((e,s)=>{t(s).off("shown.bs.dropdown",this.on_show_dropdown_desktop),t(s).off("hidden.bs.dropdown",this.on_hide_dropdown_desktop)}))}hide_dropdowns(){this.elems.each(((e,s)=>{t(s).dropdown("hide")}))}}class $ extends S{static initialize(e){const t=s.query_elem("#header-main",e);t&&new $(t)}constructor(e){super(e),this.elem=e,this.logo_placeholder=s.query_elem("#header-logo-placeholder",e),this.header_content=s.query_elem("#header-content",e),this.navbar_content_wrapper=s.query_elem("#navbar-content-wrapper",e),this.navbar_content=s.query_elem("#navbar-content",e),this.navbar_toggler=s.query_elem("#navbar-toggler",this.elem),this.personal_tools=s.query_elem("#personaltools",e),this.mainmenu=s.query_elem("#mainmenu",e),this.mainmenu_elems=t(".nav-link.dropdown-toggle",this.mainmenu),this.mainmenu_elems.each(((e,s)=>{t(s).on("shown.bs.dropdown",this.render_mobile_scrollbar.bind(this)),t(s).on("hidden.bs.dropdown",this.render_mobile_scrollbar.bind(this))})),this.set_mobile_menu_open=this.set_mobile_menu_open.bind(this),this.set_mobile_menu_closed=this.set_mobile_menu_closed.bind(this),this.bind(),s.ajax.attach(this,e),this.render_mobile_scrollbar=this.render_mobile_scrollbar.bind(this)}destroy(){super.destroy(),this.mainmenu_elems.each(((e,s)=>{t(s).off("shown.bs.dropdown",this.render_mobile_scrollbar.bind(this)),t(s).off("hidden.bs.dropdown",this.render_mobile_scrollbar.bind(this))}));const e=this.navbar_content_wrapper;e.off("show.bs.collapse shown.bs.collapse",this.set_mobile_menu_open),e.off("hide.bs.collapse hidden.bs.collapse",this.set_mobile_menu_closed)}render_mobile_scrollbar(){this.is_compact&&this.mobile_scrollbar&&this.mobile_scrollbar.render()}bind(){const e=this.navbar_content_wrapper;e.on("show.bs.collapse shown.bs.collapse",this.set_mobile_menu_open),e.on("hidden.bs.collapse",this.set_mobile_menu_closed)}set_mobile_menu_open(){this.elem.addClass("mobile-menu-open")}set_mobile_menu_closed(){this.elem.removeClass("mobile-menu-open")}on_is_compact(e){e?(this.elem.removeClass("full").removeClass("navbar-expand"),this.elem.addClass("compact"),this.navbar_content.addClass("scrollable-content"),this.mobile_scrollbar=new w(this.navbar_content_wrapper),this.navbar_content_wrapper.on("shown.bs.collapse",(()=>{t("html, body").css("overscroll-behavior","none"),this.mobile_scrollbar.render()})),this.navbar_content_wrapper.on("hide.bs.collapse",(()=>{t("html, body").css("overscroll-behavior","auto"),this.mobile_scrollbar.scrollbar.hide()}))):(this.elem.removeClass("compact"),this.elem.addClass("full").addClass("navbar-expand"),this.navbar_content.removeClass("scrollable-content"),this.mobile_scrollbar&&(this.mobile_scrollbar.destroy(),this.mobile_scrollbar=null))}on_is_super_compact(e){const i=null!==s.query_elem("#personaltools",this.navbar_content);e?i||this.personal_tools.detach().appendTo(this.navbar_content):(i&&this.personal_tools.detach().prependTo(this.header_content),t(".dropdown-menu.show").removeClass("show"))}on_is_sidebar_collapsed(e){e?this.logo_placeholder.show():this.logo_placeholder.hide()}}class D extends S{static initialize(e){const t=s.query_elem("#header-logo",e);t&&new D(t)}constructor(e){super(e)}on_sidebar_resize(e,t){console.log(t.collapsed),t.collapsed?this.elem.removeClass("text-white"):this.elem.addClass("text-white")}}class I{constructor(e){this.options=e,this.selected=[],this.select_direction=0,this.firstclick=!0}reset(){this.selected=[]}add(e){this.remove(e),this.selected.push(e)}remove(e){let s=t.grep(this.selected,(function(t,s){return t!==e}));this.selected=s}select_no_key(e,t){e.children().removeClass("selected"),t.addClass("selected"),this.reset(),this.add(t.get(0))}select_ctrl_down(e){e.toggleClass("selected"),e.hasClass("selected")?this.add(e.get(0)):this.remove(e.get(0))}get_nearest(e,s){let i,o,r=e.children(".selected"),n=-1;return t(r).each((function(){o=t(this),i=o.index(),-1==n?n=i:s>i?this.select_direction>0?in&&(n=i):s