diff --git a/libs/blocks/table/table.css b/libs/blocks/table/table.css index 04fbd77a37..1cb0ae4d1f 100644 --- a/libs/blocks/table/table.css +++ b/libs/blocks/table/table.css @@ -466,7 +466,6 @@ .table.has-addon .row-heading .col.col-heading:not(.col-1) .buttons-wrapper { align-items: flex-end; - height: 100%; } .table.has-addon p.body { @@ -485,7 +484,6 @@ text-align: start; font-style: normal; font-weight: 400; - gap: var(--spacing-xxs); color: black; padding: 5px 10px; box-sizing: border-box; @@ -495,7 +493,7 @@ background-color: var(--color-gray-300); } -.table.has-addon .addon-label :first-child { +.table.has-addon .addon-label .icon { display: flex; align-self: center; } diff --git a/libs/blocks/table/table.js b/libs/blocks/table/table.js index 5346d6d99e..ab0d1ce3da 100644 --- a/libs/blocks/table/table.js +++ b/libs/blocks/table/table.js @@ -129,14 +129,19 @@ function handleAddOnContent(table) { const [position, order, style] = addOn.innerText.split('-') .filter((key) => key.toUpperCase() !== addOnKey).map((key) => key.toLowerCase()); if (!position || !order) return; - const indexAttr = 'data-col-index'; + const dataIndex = 'data-col-index'; [...table.querySelector('.row-heading').children].forEach((headCol) => { headCol.querySelector('.heading-content')?.classList.add('content'); - const colIndex = headCol.getAttribute(indexAttr); + const colIndex = headCol.getAttribute(dataIndex); if (colIndex <= 1) return; // skip the key column const tagName = `${position}-${order}`; - const content = [...addOnRow.children] - .find((col) => col.getAttribute(indexAttr) === colIndex).childNodes; + const column = [...addOnRow.children].find((el) => el.getAttribute(dataIndex) === colIndex); + let content = column.childNodes; + const icon = column.querySelector('.icon'); + if (style === 'label' && icon) { + const text = [...content].filter((node) => !node.classList?.contains('icon')); + content = [createTag('span', null, text), icon]; + } const tag = createTag('div', { class: tagName }, [...content].map((node) => node)); if (style) tag.classList.add(`addon-${style}`); const el = headCol.querySelector(`.${position}`); diff --git a/test/blocks/table/mocks/body.html b/test/blocks/table/mocks/body.html index 3ff68f3860..6fb93feb80 100644 --- a/test/blocks/table/mocks/body.html +++ b/test/blocks/table/mocks/body.html @@ -460,6 +460,13 @@
test
test
+
+
ADDON-CONTENT-AFTER-LABEL
+
test | test
+
test | test
+
test | test
+
test | test
+