TP_JO2024/home/dist/component/table/table.module.min.js

4 lines
2.3 KiB
JavaScript
Raw Permalink Normal View History

2024-03-27 17:19:37 +01:00
/*! DSFR v1.11.2 | SPDX-License-Identifier: MIT | License-Filename: LICENSE.md | restricted use (see terms and conditions) */
const e=window.dsfr,t={SCROLLABLE:e.internals.ns.emission("table","scrollable"),CHANGE:e.internals.ns.emission("table","change"),CAPTION_HEIGHT:e.internals.ns.emission("table","captionheight")};class s extends e.core.Instance{static get instanceClassName(){return"Table"}init(){this.addAscent(t.CAPTION_HEIGHT,this.setCaptionHeight.bind(this))}setCaptionHeight(e){this.setProperty("--table-offset",`calc(${e}px + 1rem)`)}}const i={TABLE:e.internals.ns.selector("table"),SHADOW:e.internals.ns.selector("table__shadow"),SHADOW_LEFT:e.internals.ns.selector("table__shadow--left"),SHADOW_RIGHT:e.internals.ns.selector("table__shadow--right"),ELEMENT:`${e.internals.ns.selector("table")}:not(${e.internals.ns.selector("table--no-scroll")}) table`,CAPTION:`${e.internals.ns.selector("table")} table caption`};class l extends e.core.Instance{static get instanceClassName(){return"TableElement"}init(){this.listen("scroll",this.scroll.bind(this)),this.content=this.querySelector("tbody"),this.isResizing=!0}get isScrolling(){return this._isScrolling}set isScrolling(e){this._isScrolling!==e&&(this._isScrolling=e,e?(this.addClass(i.SHADOW),this.scroll()):(this.removeClass(i.SHADOW),this.removeClass(i.SHADOW_LEFT),this.removeClass(i.SHADOW_RIGHT)))}scroll(){const e=this.node.scrollLeft<=8,t=this.content.offsetWidth-this.node.offsetWidth-8,s=Math.abs(this.node.scrollLeft)>=t,l="rtl"===document.documentElement.getAttribute("dir"),n=l?i.SHADOW_RIGHT:i.SHADOW_LEFT,a=l?i.SHADOW_LEFT:i.SHADOW_RIGHT;e?this.removeClass(n):this.addClass(n),s?this.removeClass(a):this.addClass(a)}resize(){this.isScrolling=this.content.offsetWidth>this.node.offsetWidth}dispose(){this.isScrolling=!1}}class n extends e.core.Instance{static get instanceClassName(){return"TableCaption"}init(){this.height=0,this.isResizing=!0}resize(){const e=this.getRect().height;this.height!==e&&(this.height=e,this.ascend(t.CAPTION_HEIGHT,e))}}e.table={Table:s,TableElement:l,TableCaption:n,TableSelector:i},e.internals.register(e.table.TableSelector.TABLE,e.table.Table),e.internals.register(e.table.TableSelector.ELEMENT,e.table.TableElement),e.internals.register(e.table.TableSelector.CAPTION,e.table.TableCaption);
//# sourceMappingURL=table.module.min.js.map