carbon-components-svelte 0.87.0 → 0.87.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -170,6 +170,10 @@
|
|
|
170
170
|
const batchSelectedIds = writable(false);
|
|
171
171
|
const tableRows = writable(rows);
|
|
172
172
|
|
|
173
|
+
// Internal ID prefix for radio buttons, checkboxes, etc.
|
|
174
|
+
// since there may be multiple `DataTable` instances that have overlapping row ids.
|
|
175
|
+
const id = "ccs-" + Math.random().toString(36);
|
|
176
|
+
|
|
173
177
|
// Store a copy of the original rows for filter restoration.
|
|
174
178
|
$: originalRows = [...rows];
|
|
175
179
|
|
|
@@ -350,6 +354,10 @@
|
|
|
350
354
|
<button
|
|
351
355
|
type="button"
|
|
352
356
|
class:bx--table-expand__button={true}
|
|
357
|
+
aria-label={expanded ? "Collapse all rows" : "Expand all rows"}
|
|
358
|
+
aria-controls={expandableRowIds
|
|
359
|
+
.map((id) => `expandable-row-${id}`)
|
|
360
|
+
.join(" ")}
|
|
353
361
|
on:click={() => {
|
|
354
362
|
expanded = !expanded;
|
|
355
363
|
expandedRowIds = expanded ? expandableRowIds : [];
|
|
@@ -357,7 +365,10 @@
|
|
|
357
365
|
dispatch("click:header--expand", { expanded });
|
|
358
366
|
}}
|
|
359
367
|
>
|
|
360
|
-
<ChevronRight
|
|
368
|
+
<ChevronRight
|
|
369
|
+
aria-hidden="true"
|
|
370
|
+
class="bx--table-expand__svg"
|
|
371
|
+
/>
|
|
361
372
|
</button>
|
|
362
373
|
{/if}
|
|
363
374
|
</th>
|
|
@@ -370,6 +381,8 @@
|
|
|
370
381
|
<InlineCheckbox
|
|
371
382
|
bind:ref={refSelectAll}
|
|
372
383
|
aria-label="Select all rows"
|
|
384
|
+
name="{id}-select-all"
|
|
385
|
+
value="all"
|
|
373
386
|
checked={selectAll}
|
|
374
387
|
{indeterminate}
|
|
375
388
|
on:change={(e) => {
|
|
@@ -470,6 +483,7 @@
|
|
|
470
483
|
<button
|
|
471
484
|
type="button"
|
|
472
485
|
class:bx--table-expand__button={true}
|
|
486
|
+
aria-controls={`expandable-row-${row.id}`}
|
|
473
487
|
aria-label={expandedRows[row.id]
|
|
474
488
|
? "Collapse current row"
|
|
475
489
|
: "Expand current row"}
|
|
@@ -486,7 +500,10 @@
|
|
|
486
500
|
});
|
|
487
501
|
}}
|
|
488
502
|
>
|
|
489
|
-
<ChevronRight
|
|
503
|
+
<ChevronRight
|
|
504
|
+
aria-hidden="true"
|
|
505
|
+
class="bx--table-expand__svg"
|
|
506
|
+
/>
|
|
490
507
|
</button>
|
|
491
508
|
{/if}
|
|
492
509
|
</TableCell>
|
|
@@ -497,9 +514,12 @@
|
|
|
497
514
|
class:bx--table-column-radio={radio}
|
|
498
515
|
>
|
|
499
516
|
{#if !nonSelectableRowIds.includes(row.id)}
|
|
517
|
+
{@const inputId = `${id}-${row.id}`}
|
|
518
|
+
{@const inputName = `${id}-name`}
|
|
500
519
|
{#if radio}
|
|
501
520
|
<RadioButton
|
|
502
|
-
|
|
521
|
+
id={inputId}
|
|
522
|
+
name={inputName}
|
|
503
523
|
checked={selectedRowIds.includes(row.id)}
|
|
504
524
|
on:change={() => {
|
|
505
525
|
selectedRowIds = [row.id];
|
|
@@ -508,7 +528,8 @@
|
|
|
508
528
|
/>
|
|
509
529
|
{:else}
|
|
510
530
|
<InlineCheckbox
|
|
511
|
-
|
|
531
|
+
id={inputId}
|
|
532
|
+
name={inputName}
|
|
512
533
|
checked={selectedRowIds.includes(row.id)}
|
|
513
534
|
on:change={() => {
|
|
514
535
|
if (selectedRowIds.includes(row.id)) {
|
|
@@ -550,6 +571,7 @@
|
|
|
550
571
|
|
|
551
572
|
{#if expandable}
|
|
552
573
|
<tr
|
|
574
|
+
id={`expandable-row-${row.id}`}
|
|
553
575
|
data-child-row
|
|
554
576
|
class:bx--expandable-row={true}
|
|
555
577
|
on:mouseenter={() => {
|
|
@@ -374,7 +374,6 @@
|
|
|
374
374
|
selectionRef.focus();
|
|
375
375
|
} else {
|
|
376
376
|
open = false;
|
|
377
|
-
fieldRef.blur();
|
|
378
377
|
}
|
|
379
378
|
} else if (key === "ArrowDown") {
|
|
380
379
|
change(1);
|
|
@@ -414,7 +413,6 @@
|
|
|
414
413
|
...item,
|
|
415
414
|
checked: false,
|
|
416
415
|
}));
|
|
417
|
-
if (fieldRef) fieldRef.blur();
|
|
418
416
|
}}
|
|
419
417
|
translateWithId={translateWithIdSelection}
|
|
420
418
|
{disabled}
|
|
@@ -450,7 +448,6 @@
|
|
|
450
448
|
}
|
|
451
449
|
} else if (key === "Tab") {
|
|
452
450
|
open = false;
|
|
453
|
-
inputRef.blur();
|
|
454
451
|
} else if (key === "ArrowDown") {
|
|
455
452
|
change(1);
|
|
456
453
|
} else if (key === "ArrowUp") {
|