Use Math.min to simplify ternary clamping expressions (S7766)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 07:37:46 +08:00
parent 731649ed0a
commit 75adbd9c6b
2 changed files with 7 additions and 19 deletions

View File

@@ -68,7 +68,7 @@
dataKey="id"
breakpoint="0"
:tableClass="tableClass"
@row-select="onRowSelect"
@row-select="onRowSelectionChange"
>
<ColumnGroup type="header">
<Row>
@@ -140,8 +140,8 @@
dataKey="id"
breakpoint="0"
tableClass="w-full !border-separate !border-spacing-x-2 !table-auto text-sm"
@row-select="onRowSelect"
@row-unselect="onRowUnselect"
@row-select="onRowSelectionChange"
@row-unselect="onRowSelectionChange"
@row-select-all="onRowSelectAll($event)"
@row-unselect-all="onRowUnelectAll"
>
@@ -526,21 +526,9 @@ const labelsData = computed(() => {
});
/**
* Selects an option in the categorical table.
* Emits the current attribute selection when a row is selected or deselected.
*/
function onRowSelect() {
const type = selectedAttName.value.type;
const data = {
type: type,
data: selectedAttRange.value,
};
emit("select-attribute", data);
}
/**
* Deselects an option in the categorical table.
*/
function onRowUnselect() {
function onRowSelectionChange() {
const type = selectedAttName.value.type;
const data = {
type: type,
@@ -915,7 +903,7 @@ function sliderValueRange(e, direction) {
(sliderData[sliderData.length - 1] - sliderData[0])) *
sliderData.length;
let result = Math.round(Math.abs(closestIndex));
result = result > selectRange.value ? selectRange.value : result;
result = Math.min(result, selectRange.value);
return result;
});
// Update the slider

View File

@@ -381,7 +381,7 @@ function sliderTimeRange(e, direction) {
(sliderDataVal[sliderDataVal.length - 1] - sliderDataVal[0])) *
sliderDataVal.length;
let result = Math.round(Math.abs(closestIndex));
result = result > selectRange.value ? selectRange.value : result;
result = Math.min(result, selectRange.value);
return result;
});