{"version":3,"file":"table.nomodule.min.js","sources":["../../../.config/config.js","../../../src/core/api.js","../../../src/component/table/script/table/table-emission.js","../../../src/component/table/script/table/table.js","../../../src/component/table/script/table/table-selector.js","../../../src/component/table/script/table/table-element.js","../../../src/component/table/script/table/table-caption.js","../../../src/component/table/index.js","../../../src/component/table/main.js"],"sourcesContent":["const config = {\r\n prefix: 'fr',\r\n namespace: 'dsfr',\r\n organisation: '@gouvfr',\r\n version: '1.11.2'\r\n};\r\n\r\nexport default config;\r\n","import config from './config.js';\nconst api = window[config.namespace];\nexport default api;\n","import api from '../../api.js';\n\nexport const TableEmission = {\n SCROLLABLE: api.internals.ns.emission('table', 'scrollable'),\n CHANGE: api.internals.ns.emission('table', 'change'),\n CAPTION_HEIGHT: api.internals.ns.emission('table', 'captionheight')\n};\n","import api from '../../api.js';\nimport { TableEmission } from './table-emission.js';\n\nconst PADDING = '1rem'; // padding de 4v sur le caption\n\nclass Table extends api.core.Instance {\n static get instanceClassName () {\n return 'Table';\n }\n\n init () {\n this.addAscent(TableEmission.CAPTION_HEIGHT, this.setCaptionHeight.bind(this));\n }\n\n setCaptionHeight (value) {\n this.setProperty('--table-offset', `calc(${value}px + ${PADDING})`);\n }\n}\n\nexport { Table };\n","import api from '../../api.js';\n\nexport const TableSelector = {\n TABLE: api.internals.ns.selector('table'),\n SHADOW: api.internals.ns.selector('table__shadow'),\n SHADOW_LEFT: api.internals.ns.selector('table__shadow--left'),\n SHADOW_RIGHT: api.internals.ns.selector('table__shadow--right'),\n ELEMENT: `${api.internals.ns.selector('table')}:not(${api.internals.ns.selector('table--no-scroll')}) table`,\n CAPTION: `${api.internals.ns.selector('table')} table caption`\n};\n","import api from '../../api.js';\nimport { TableSelector } from './table-selector.js';\n\nconst SCROLL_OFFSET = 8; // valeur en px du scroll avant laquelle le shadow s'active ou se desactive\n\nclass TableElement extends api.core.Instance {\n static get instanceClassName () {\n return 'TableElement';\n }\n\n init () {\n this.listen('scroll', this.scroll.bind(this));\n this.content = this.querySelector('tbody');\n this.isResizing = true;\n }\n\n get isScrolling () {\n return this._isScrolling;\n }\n\n set isScrolling (value) {\n if (this._isScrolling === value) return;\n this._isScrolling = value;\n\n if (value) {\n this.addClass(TableSelector.SHADOW);\n this.scroll();\n } else {\n this.removeClass(TableSelector.SHADOW);\n this.removeClass(TableSelector.SHADOW_LEFT);\n this.removeClass(TableSelector.SHADOW_RIGHT);\n }\n }\n\n /* ajoute la classe fr-table__shadow-left ou fr-table__shadow-right sur fr-table en fonction d'une valeur de scroll et du sens (right, left) */\n scroll () {\n const isMin = this.node.scrollLeft <= SCROLL_OFFSET;\n const max = this.content.offsetWidth - this.node.offsetWidth - SCROLL_OFFSET;\n const isMax = Math.abs(this.node.scrollLeft) >= max;\n const isRtl = document.documentElement.getAttribute('dir') === 'rtl';\n const minSelector = isRtl ? TableSelector.SHADOW_RIGHT : TableSelector.SHADOW_LEFT;\n const maxSelector = isRtl ? TableSelector.SHADOW_LEFT : TableSelector.SHADOW_RIGHT;\n\n if (isMin) {\n this.removeClass(minSelector);\n } else {\n this.addClass(minSelector);\n }\n\n if (isMax) {\n this.removeClass(maxSelector);\n } else {\n this.addClass(maxSelector);\n }\n }\n\n resize () {\n this.isScrolling = this.content.offsetWidth > this.node.offsetWidth;\n }\n\n dispose () {\n this.isScrolling = false;\n }\n}\n\nexport { TableElement };\n","import api from '../../api.js';\nimport { TableEmission } from './table-emission.js';\n\nclass TableCaption extends api.core.Instance {\n static get instanceClassName () {\n return 'TableCaption';\n }\n\n init () {\n this.height = 0;\n this.isResizing = true;\n }\n\n resize () {\n const height = this.getRect().height;\n if (this.height === height) return;\n this.height = height;\n this.ascend(TableEmission.CAPTION_HEIGHT, height);\n }\n}\n\nexport { TableCaption };\n","import api from './api.js';\nimport { Table } from './script/table/table.js';\nimport { TableElement } from './script/table/table-element.js';\nimport { TableSelector } from './script/table/table-selector.js';\nimport { TableCaption } from './script/table/table-caption.js';\n\napi.table = {\n Table: Table,\n TableElement: TableElement,\n TableCaption: TableCaption,\n TableSelector: TableSelector\n};\n\nexport default api;\n","import api from './index.js';\n\napi.internals.register(api.table.TableSelector.TABLE, api.table.Table);\napi.internals.register(api.table.TableSelector.ELEMENT, api.table.TableElement);\napi.internals.register(api.table.TableSelector.CAPTION, api.table.TableCaption);\n\nexport default api;\n"],"names":["const","api","window","TableEmission","SCROLLABLE","internals","ns","emission","CHANGE","CAPTION_HEIGHT","Table","staticAccessors","instanceClassName","init","this","addAscent","setCaptionHeight","bind","value","setProperty","core","Instance","TableSelector","TABLE","selector","SHADOW","SHADOW_LEFT","SHADOW_RIGHT","ELEMENT","CAPTION","TableElement","listen","scroll","content","querySelector","isResizing","prototypeAccessors","isScrolling","_isScrolling","addClass","removeClass","isMin","node","scrollLeft","max","offsetWidth","isMax","Math","abs","isRtl","document","documentElement","getAttribute","minSelector","maxSelector","resize","dispose","TableCaption","height","getRect","ascend","table","register"],"mappings":";yBAAAA,ICCMC,EAAMC,OAAuB,KCCtBC,EAAgB,CAC3BC,WAAYH,EAAII,UAAUC,GAAGC,SAAS,QAAS,cAC/CC,OAAQP,EAAII,UAAUC,GAAGC,SAAS,QAAS,UAC3CE,eAAgBR,EAAII,UAAUC,GAAGC,SAAS,QAAS,kBCA/CG,6LACJC,EAAWC,iCACT,MAAO,qBAGTC,gBACEC,KAAKC,UAAUZ,EAAcM,eAAgBK,KAAKE,iBAAiBC,KAAKH,oBAG1EE,0BAAkBE,GAChBJ,KAAKK,YAAY,yBAA0BD,iDAV3BjB,EAAImB,KAAKC,UCHhBC,EAAgB,CAC3BC,MAAOtB,EAAII,UAAUC,GAAGkB,SAAS,SACjCC,OAAQxB,EAAII,UAAUC,GAAGkB,SAAS,iBAClCE,YAAazB,EAAII,UAAUC,GAAGkB,SAAS,uBACvCG,aAAc1B,EAAII,UAAUC,GAAGkB,SAAS,wBACxCI,QAAY3B,EAAII,UAAUC,GAAGkB,SAAS,iBAAgBvB,EAAII,UAAUC,GAAGkB,SAAS,8BAChFK,QAAY5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