{"version":3,"file":"table.module.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":[],"mappings":";;AAAA,MAAM,MAAM,GAAG;AACf,EAAE,MAAM,EAAE,IAAI;AACd,EAAE,SAAS,EAAE,MAAM;AACnB,EAAE,YAAY,EAAE,SAAS;AACzB,EAAE,OAAO,EAAE,QAAQ;AACnB,CAAC;;ACJD,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;;ACC7B,MAAM,aAAa,GAAG;AAC7B,EAAE,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;AAC9D,EAAE,MAAM,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;AACtD,EAAE,cAAc,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;AACrE,CAAC;;ACHD,MAAM,OAAO,GAAG,MAAM,CAAC;AACvB;AACA,MAAM,KAAK,SAAS,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;AACtC,EAAE,WAAW,iBAAiB,CAAC,GAAG;AAClC,IAAI,OAAO,OAAO,CAAC;AACnB,GAAG;AACH;AACA,EAAE,IAAI,CAAC,GAAG;AACV,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACnF,GAAG;AACH;AACA,EAAE,gBAAgB,CAAC,CAAC,KAAK,EAAE;AAC3B,IAAI,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,KAAK,EAAE,KAAK,C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