{"version":3,"file":"table.module.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":["api","window","TableEmission","SCROLLABLE","internals","ns","emission","CHANGE","CAPTION_HEIGHT","Table","core","Instance","instanceClassName","init","this","addAscent","setCaptionHeight","bind","value","setProperty","TableSelector","TABLE","selector","SHADOW","SHADOW_LEFT","SHADOW_RIGHT","ELEMENT","CAPTION","TableElement","listen","scroll","content","querySelector","isResizing","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":";AAAA,MCCMA,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,kBCArD,MAAMG,UAAcT,EAAIU,KAAKC,SAChBC,+BACT,MAAO,QAGTC,OACEC,KAAKC,UAAUb,EAAcM,eAAgBM,KAAKE,iBAAiBC,KAAKH,OAG1EE,iBAAkBE,GAChBJ,KAAKK,YAAY,iBAAkB,QAAQD,gBCbxC,MAAME,EAAgB,CAC3BC,MAAOrB,EAAII,UAAUC,GAAGiB,SAAS,SACjCC,OAAQvB,EAAII,UAAUC,GAAGiB,SAAS,iBAClCE,YAAaxB,EAAII,UAAUC,GAAGiB,SAAS,uBACvCG,aAAczB,EAAII,UAAUC,GAAGiB,SAAS,wBACxCI,QAAS,GAAG1B,EAAII,UAAUC,GAAGiB,SAAS,gBAAgBtB,EAAII,UAAUC,GAAGiB,SAAS,6BAChFK,QAAS,GAAG3B,EAAII,UAAUC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