diff --git a/build/js/ExpandableTable.js b/build/js/ExpandableTable.js index 9c2842dbd..1094f9e35 100644 --- a/build/js/ExpandableTable.js +++ b/build/js/ExpandableTable.js @@ -29,8 +29,8 @@ const SELECTOR_ARIA_ATTR = 'aria-expanded' * ==================================================== */ class ExpandableTable { - constructor(element, config) { - this._config = config + constructor(element, options) { + this._options = options this._element = element } @@ -72,16 +72,17 @@ class ExpandableTable { // Static - static _jQueryInterface(config) { + static _jQueryInterface(operation) { return this.each(function () { let data = $(this).data(DATA_KEY) + if (!data) { data = new ExpandableTable($(this)) $(this).data(DATA_KEY, data) } - if (config === 'init' || config === 'toggleRow') { - data[config]() + if (typeof operation === 'string' && operation.match(/init|toggleRow/)) { + data[operation]() } }) } diff --git a/build/scss/_table.scss b/build/scss/_table.scss index 7eb7e3742..389e9d5b2 100644 --- a/build/scss/_table.scss +++ b/build/scss/_table.scss @@ -79,11 +79,27 @@ [data-widget="expandable-table"] { cursor: pointer; + + i { + transition: transform $transition-speed linear; + } + &[aria-expanded="true"] { + td > i { + // stylelint-disable selector-max-attribute + &[class*="right"] { + transform: rotate(90deg); + } + &[class*="left"] { + transform: rotate(-90deg); + } + // stylelint-enable selector-max-attribute + } + } } .expandable-body { - td { - padding: 0; + > td { + padding: 0 !important; width: 100%; > div, @@ -91,4 +107,16 @@ padding: $table-cell-padding; } } + + .table { + width: calc(100% - #{$table-cell-padding}); + margin: 0 0 0 $table-cell-padding; + + tr:first-child { + td, + th { + border-top: none; + } + } + } } diff --git a/pages/tables/simple.html b/pages/tables/simple.html index 393913841..273a890f1 100644 --- a/pages/tables/simple.html +++ b/pages/tables/simple.html @@ -1313,7 +1313,94 @@ - + +
183 | +|||||||
+ + 219 + | +|||||||
+
+
+
|
+ |||||||
657 | +|||||||
175 | +|||||||
134 | +|||||||
494 | +|||||||
832 | +|||||||
982 | +