var bricks = window.bricks || {}; bricks.PageContent = class extends bricks.Layout { constructor(opts){ super(opts); } } bricks.AccordionItem = class extends bricks.Layout { constructor(opts){ super(opts); this.set_css('accordion-item'); } } bricks.AccordionInfo = class extends bricks.Layout { constructor(opts){ super(opts); this.set_css('accordion-item-info'); } } bricks.DynamicAccordion = class extends bricks.VScrollPanel { /* { "data_url", "data_method", "cache_limit", "page_rows", "record_view" "content_rely_on" "content_rely_value" "editable" "fields": "record_toolbar", "record_toolbar_collapsable" "header" "content_view" } */ constructor(opts){ super(opts); this.element = this.dom_element; this.loader = new bricks.PageDataLoader({ url:this.opts.data_url, params:this.opts.data_params, pagerows:this.opts.page_rows, method:this.opts.data_method, cache_pages:this.opts.cache_limit }); this.old_params = null; this.active_item = null; this.active_content = null; this.loading = false; schedule_once(this.build_all.bind(this), 0.1); } async build_all(){ if (this.title){ this.build_title(); } if (this.description){ this.build_description(); } if (this.toolbar){ await this.build_toolbar(); } if (this.editable && this.fields){ await this.build_new_form(); } if (! this.noheader){ await this.build_header(); } var filler = new bricks.Filler(); this.container = new bricks.VScrollPanel({ }); filler.add_widget(this.container); this.add_widget(filler); this.container.bind('min_threshold', this.load_previous_page.bind(this)); this.container.bind('max_threshold', this.load_next_page.bind(this)); await this.render(); } async build_header(){ await this.build_info(this); } async build_info(item, record){ if (! this.fields && !record){ return; } var w; var tb = null; var info = new bricks.AccordionInfo({}); info.data = record; item.add_widget(info); if (this.editable){ tb = this.build_record_toolbar(info, record); } if (! record){ record = {}; for (var i=0;i