Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/ILIAS/UI/resources/js/Table/dist/table.min.js

Large diffs are not rendered by default.

31 changes: 25 additions & 6 deletions components/ILIAS/UI/resources/js/Table/src/datatable.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,25 @@ export default class DataTable {
const col = cols[i];
col.addEventListener('change', () => this.selectionChange());
}

this.#checkForStateChanges();
}

#checkForStateChanges()
{
const checkboxes = Array.from(this.#component.querySelectorAll('input.c-table-data__row-selector'));
const updateState = () => {
const allSame = Array.from(new Set(checkboxes.map(n => n.checked)));
if (allSame.length === 1) {
this.selectAll(allSame[0]);
} else {
const d = document.querySelector('.c-table-data__header__rowselection.state');
d.classList.remove('all');
d.classList.remove('none');
d.classList.add('some');
}
};
checkboxes.forEach(n => n.addEventListener('input', updateState));
}

/**
Expand Down Expand Up @@ -178,8 +197,7 @@ export default class DataTable {
*/
selectAll(state) {
const cols = this.#table.getElementsByClassName('c-table-data__row-selector');
const selectorAll = this.#table.getElementsByClassName('c-table-data__selection_all').item(0);
const selectorNone = this.#table.getElementsByClassName('c-table-data__selection_none').item(0);
const header = this.#table.querySelector('.c-table-data__header__rowselection.state');

for (let i = 0; i < cols.length; i += 1) {
const col = cols[i];
Expand All @@ -191,13 +209,14 @@ export default class DataTable {
}
}

header.classList.remove('some');
if (state) {
selectorAll.style.display = 'none';
selectorNone.style.display = 'block';
header.classList.add('none');
header.classList.remove('all');
} else {
this.#disableRowSelection(false);
selectorAll.style.display = 'block';
selectorNone.style.display = 'none';
header.classList.add('all');
header.classList.remove('none');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,18 @@ protected function renderActionsHeader(
$sig_all = clone $signal;
$sig_all->addOption('select', true);
$select_all = $f->button()->shy('', '')
->withSymbol($glyph_factory->add())
->withOnClick($sig_all);
->withSymbol($glyph_factory->unselect())
->withOnClick($sig_all);
$clear = $f->button()->shy('', '')
->withSymbol($glyph_factory->clear())
->withOnClick($sig_all);
$signal->addOption('select', false);
$select_none = $f->button()->shy('', '')
->withSymbol($glyph_factory->close())
->withOnClick($signal);
->withSymbol($glyph_factory->select())
->withOnClick($signal);
$tpl->setVariable('SELECTION_CONTROL_SELECT', $default_renderer->render($select_all));
$tpl->setVariable('SELECTION_CONTROL_DESELECT', $default_renderer->render($select_none));
$tpl->setVariable('SELECTION_CONTROL_CLEAR', $default_renderer->render($clear));
}

if ($component instanceof Component\Table\Ordering) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ <h2 class="ilHeader" id="{ID}_label">{TITLE}</h2>
<tr class="c-table-data__header c-table-data__row">

<!-- BEGIN header_rowselection_cell -->
<th class="c-table-data__header c-table-data__cell c-table-data__header__rowselection" tabindex="-1" aria-colindex="1">
<th class="c-table-data__header c-table-data__cell c-table-data__header__rowselection state all" tabindex="-1" aria-colindex="1">
<div class="c-table-data__selection_all">{SELECTION_CONTROL_SELECT}</div>
<div class="c-table-data__selection_none">{SELECTION_CONTROL_DESELECT}</div>
<div class="c-table-data__selection_some">{SELECTION_CONTROL_CLEAR}</div>
</th>
<!-- END header_rowselection_cell -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ <h2 class="ilHeader" id="{ID}_label">{TITLE}</h2>
<tr class="c-table-data__header c-table-data__row">

<!-- BEGIN header_rowselection_cell -->
<th class="c-table-data__header c-table-data__cell c-table-data__header__rowselection" tabindex="-1" aria-colindex="1">
<th class="c-table-data__header c-table-data__cell c-table-data__header__rowselection state all" tabindex="-1" aria-colindex="1">
{DRAG_HINT}
<!-- BEGIN has_selectall -->
<div class="c-table-data__selection_all">{SELECTION_CONTROL_SELECT}</div>
<div class="c-table-data__selection_none">{SELECTION_CONTROL_DESELECT}</div>
<div class="c-table-data__selection_some">{SELECTION_CONTROL_CLEAR}</div>
<!-- END has_selectall -->
</th>
<!-- END header_rowselection_cell -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,24 @@ th.c-table-data__cell {
}
}

th.c-table-data__cell.c-table-data__header__rowselection{
&.state.all {
.c-table-data__selection_all { display: block; }
.c-table-data__selection_none { display: none; }
.c-table-data__selection_some { display : none; }
}
&.state.some {
.c-table-data__selection_all { display: none; }
.c-table-data__selection_none { display: none; }
.c-table-data__selection_some { display : block; }
}
&.state.none {
.c-table-data__selection_all { display: none; }
.c-table-data__selection_none { display: block; }
.c-table-data__selection_some { display : none; }
}
}

// stick under breadcrumbs when they are present

.breadcrumbs + #mainspacekeeper th.c-table-data__cell {
Expand Down
28 changes: 28 additions & 0 deletions templates/default/delos.css
Original file line number Diff line number Diff line change
Expand Up @@ -11977,6 +11977,34 @@ th.c-table-data__cell {
}
}

th.c-table-data__cell.c-table-data__header__rowselection.state.all .c-table-data__selection_all {
display: block;
}
th.c-table-data__cell.c-table-data__header__rowselection.state.all .c-table-data__selection_none {
display: none;
}
th.c-table-data__cell.c-table-data__header__rowselection.state.all .c-table-data__selection_some {
display: none;
}
th.c-table-data__cell.c-table-data__header__rowselection.state.some .c-table-data__selection_all {
display: none;
}
th.c-table-data__cell.c-table-data__header__rowselection.state.some .c-table-data__selection_none {
display: none;
}
th.c-table-data__cell.c-table-data__header__rowselection.state.some .c-table-data__selection_some {
display: block;
}
th.c-table-data__cell.c-table-data__header__rowselection.state.none .c-table-data__selection_all {
display: none;
}
th.c-table-data__cell.c-table-data__header__rowselection.state.none .c-table-data__selection_none {
display: block;
}
th.c-table-data__cell.c-table-data__header__rowselection.state.none .c-table-data__selection_some {
display: none;
}

@media screen and (min-width: 993px) {
.breadcrumbs + #mainspacekeeper th.c-table-data__cell {
top: 32px;
Expand Down
Loading