1 line
7.6 KiB
Text
1 line
7.6 KiB
Text
|
{"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 instan
|