refactor(table-row): remove unused prop

This commit is contained in:
Eric Liu 2020-10-24 13:59:30 -07:00
commit d8104d9c48
4 changed files with 135 additions and 158 deletions

View file

@ -1020,6 +1020,8 @@ No forwarded events.
- `on:click` - `on:click`
- `on:click:header` - `on:click:header`
- `on:click:row` - `on:click:row`
- `on:mouseenter:row`
- `on:mouseleave:row`
- `on:click:row--expand` - `on:click:row--expand`
- `on:click:cell` - `on:click:cell`
@ -4594,9 +4596,7 @@ import { TableRow } from "carbon-components-svelte";
### Props ### Props
| Prop name | Type | Default value | Description | No exported props.
| :--------- | :------------------- | :------------ | :------------------------------- |
| isSelected | <code>boolean</code> | `false` | Set to `true` to select the row. |
### Slots ### Slots

View file

@ -2766,14 +2766,14 @@
{ {
"attributes": [ "attributes": [
{ {
"start": 10262, "start": 10544,
"end": 10273, "end": 10555,
"type": "Attribute", "type": "Attribute",
"name": "name", "name": "name",
"value": [ "value": [
{ {
"start": 10268, "start": 10550,
"end": 10272, "end": 10554,
"type": "Text", "type": "Text",
"raw": "cell", "raw": "cell",
"data": "cell" "data": "cell"
@ -2781,26 +2781,26 @@
] ]
}, },
{ {
"start": 10274, "start": 10556,
"end": 10285, "end": 10567,
"type": "Attribute", "type": "Attribute",
"name": "row", "name": "row",
"value": [ "value": [
{ {
"start": 10279, "start": 10561,
"end": 10284, "end": 10566,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 10280, "start": 10562,
"end": 10283, "end": 10565,
"loc": { "loc": {
"start": { "start": {
"line": 337, "line": 344,
"column": 38 "column": 38
}, },
"end": { "end": {
"line": 337, "line": 344,
"column": 41 "column": 41
} }
}, },
@ -2810,26 +2810,26 @@
] ]
}, },
{ {
"start": 10286, "start": 10568,
"end": 10299, "end": 10581,
"type": "Attribute", "type": "Attribute",
"name": "cell", "name": "cell",
"value": [ "value": [
{ {
"start": 10292, "start": 10574,
"end": 10298, "end": 10580,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 10293, "start": 10575,
"end": 10297, "end": 10579,
"loc": { "loc": {
"start": { "start": {
"line": 337, "line": 344,
"column": 51 "column": 51
}, },
"end": { "end": {
"line": 337, "line": 344,
"column": 55 "column": 55
} }
}, },
@ -2841,69 +2841,69 @@
], ],
"children": [ "children": [
{ {
"start": 10300, "start": 10582,
"end": 10317, "end": 10599,
"type": "Text", "type": "Text",
"raw": "\n ", "raw": "\n ",
"data": "\n " "data": "\n "
}, },
{ {
"start": 10317, "start": 10599,
"end": 10383, "end": 10665,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "ConditionalExpression", "type": "ConditionalExpression",
"start": 10318, "start": 10600,
"end": 10382, "end": 10664,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 17 "column": 17
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 81 "column": 81
} }
}, },
"test": { "test": {
"type": "MemberExpression", "type": "MemberExpression",
"start": 10318, "start": 10600,
"end": 10336, "end": 10618,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 17 "column": 17
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 35 "column": 35
} }
}, },
"object": { "object": {
"type": "MemberExpression", "type": "MemberExpression",
"start": 10318, "start": 10600,
"end": 10328, "end": 10610,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 17 "column": 17
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 27 "column": 27
} }
}, },
"object": { "object": {
"type": "Identifier", "type": "Identifier",
"start": 10318, "start": 10600,
"end": 10325, "end": 10607,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 17 "column": 17
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 24 "column": 24
} }
}, },
@ -2911,15 +2911,15 @@
}, },
"property": { "property": {
"type": "Identifier", "type": "Identifier",
"start": 10326, "start": 10608,
"end": 10327, "end": 10609,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 25 "column": 25
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 26 "column": 26
} }
}, },
@ -2930,15 +2930,15 @@
}, },
"property": { "property": {
"type": "Identifier", "type": "Identifier",
"start": 10329, "start": 10611,
"end": 10336, "end": 10618,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 28 "column": 28
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 35 "column": 35
} }
}, },
@ -2949,57 +2949,57 @@
}, },
"consequent": { "consequent": {
"type": "CallExpression", "type": "CallExpression",
"start": 10339, "start": 10621,
"end": 10369, "end": 10651,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 38 "column": 38
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 68 "column": 68
} }
}, },
"callee": { "callee": {
"type": "MemberExpression", "type": "MemberExpression",
"start": 10339, "start": 10621,
"end": 10357, "end": 10639,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 38 "column": 38
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 56 "column": 56
} }
}, },
"object": { "object": {
"type": "MemberExpression", "type": "MemberExpression",
"start": 10339, "start": 10621,
"end": 10349, "end": 10631,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 38 "column": 38
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 48 "column": 48
} }
}, },
"object": { "object": {
"type": "Identifier", "type": "Identifier",
"start": 10339, "start": 10621,
"end": 10346, "end": 10628,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 38 "column": 38
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 45 "column": 45
} }
}, },
@ -3007,15 +3007,15 @@
}, },
"property": { "property": {
"type": "Identifier", "type": "Identifier",
"start": 10347, "start": 10629,
"end": 10348, "end": 10630,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 46 "column": 46
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 47 "column": 47
} }
}, },
@ -3026,15 +3026,15 @@
}, },
"property": { "property": {
"type": "Identifier", "type": "Identifier",
"start": 10350, "start": 10632,
"end": 10357, "end": 10639,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 49 "column": 49
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 56 "column": 56
} }
}, },
@ -3046,29 +3046,29 @@
"arguments": [ "arguments": [
{ {
"type": "MemberExpression", "type": "MemberExpression",
"start": 10358, "start": 10640,
"end": 10368, "end": 10650,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 57 "column": 57
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 67 "column": 67
} }
}, },
"object": { "object": {
"type": "Identifier", "type": "Identifier",
"start": 10358, "start": 10640,
"end": 10362, "end": 10644,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 57 "column": 57
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 61 "column": 61
} }
}, },
@ -3076,15 +3076,15 @@
}, },
"property": { "property": {
"type": "Identifier", "type": "Identifier",
"start": 10363, "start": 10645,
"end": 10368, "end": 10650,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 62 "column": 62
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 67 "column": 67
} }
}, },
@ -3098,29 +3098,29 @@
}, },
"alternate": { "alternate": {
"type": "MemberExpression", "type": "MemberExpression",
"start": 10372, "start": 10654,
"end": 10382, "end": 10664,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 71 "column": 71
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 81 "column": 81
} }
}, },
"object": { "object": {
"type": "Identifier", "type": "Identifier",
"start": 10372, "start": 10654,
"end": 10376, "end": 10658,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 71 "column": 71
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 75 "column": 75
} }
}, },
@ -3128,15 +3128,15 @@
}, },
"property": { "property": {
"type": "Identifier", "type": "Identifier",
"start": 10377, "start": 10659,
"end": 10382, "end": 10664,
"loc": { "loc": {
"start": { "start": {
"line": 338, "line": 345,
"column": 76 "column": 76
}, },
"end": { "end": {
"line": 338, "line": 345,
"column": 81 "column": 81
} }
}, },
@ -3148,8 +3148,8 @@
} }
}, },
{ {
"start": 10383, "start": 10665,
"end": 10398, "end": 10680,
"type": "Text", "type": "Text",
"raw": "\n ", "raw": "\n ",
"data": "\n " "data": "\n "
@ -3164,14 +3164,14 @@
{ {
"attributes": [ "attributes": [
{ {
"start": 10934, "start": 11216,
"end": 10953, "end": 11235,
"type": "Attribute", "type": "Attribute",
"name": "name", "name": "name",
"value": [ "value": [
{ {
"start": 10940, "start": 11222,
"end": 10952, "end": 11234,
"type": "Text", "type": "Text",
"raw": "expanded-row", "raw": "expanded-row",
"data": "expanded-row" "data": "expanded-row"
@ -3179,26 +3179,26 @@
] ]
}, },
{ {
"start": 10954, "start": 11236,
"end": 10965, "end": 11247,
"type": "Attribute", "type": "Attribute",
"name": "row", "name": "row",
"value": [ "value": [
{ {
"start": 10959, "start": 11241,
"end": 10964, "end": 11246,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 10960, "start": 11242,
"end": 10963, "end": 11245,
"loc": { "loc": {
"start": { "start": {
"line": 357, "line": 364,
"column": 48 "column": 48
}, },
"end": { "end": {
"line": 357, "line": 364,
"column": 51 "column": 51
} }
}, },
@ -3240,6 +3240,18 @@
"detail": "row" "detail": "row"
} }
], ],
[
"mouseenter:row",
{
"detail": "row"
}
],
[
"mouseleave:row",
{
"detail": "row"
}
],
[ [
"click:row--expand", "click:row--expand",
{ {
@ -13397,17 +13409,7 @@
}, },
"TableRow": { "TableRow": {
"moduleName": "TableRow", "moduleName": "TableRow",
"props": [ "props": [],
[
"isSelected",
{
"kind": "let",
"value": "false",
"type": "boolean",
"description": "Set to `true` to select the row"
}
]
],
"slots": [ "slots": [
[ [
"default", "default",
@ -13423,8 +13425,8 @@
[ [
"click", "click",
{ {
"start": 257, "start": 25,
"end": 265, "end": 33,
"type": "EventHandler", "type": "EventHandler",
"name": "click", "name": "click",
"modifiers": [], "modifiers": [],
@ -13434,8 +13436,8 @@
[ [
"mouseover", "mouseover",
{ {
"start": 268, "start": 36,
"end": 280, "end": 48,
"type": "EventHandler", "type": "EventHandler",
"name": "mouseover", "name": "mouseover",
"modifiers": [], "modifiers": [],
@ -13445,8 +13447,8 @@
[ [
"mouseenter", "mouseenter",
{ {
"start": 283, "start": 51,
"end": 296, "end": 64,
"type": "EventHandler", "type": "EventHandler",
"name": "mouseenter", "name": "mouseenter",
"modifiers": [], "modifiers": [],
@ -13456,8 +13458,8 @@
[ [
"mouseleave", "mouseleave",
{ {
"start": 299, "start": 67,
"end": 312, "end": 80,
"type": "EventHandler", "type": "EventHandler",
"name": "mouseleave", "name": "mouseleave",
"modifiers": [], "modifiers": [],

View file

@ -1,20 +1,3 @@
<script> <tr {...$$restProps} on:click on:mouseover on:mouseenter on:mouseleave>
/**
* Set to `true` to select the row
* @type {boolean} [isSelected=false]
*/
export let isSelected = false;
// TODO: include ariaLabel, isSelected
</script>
<tr
class:bx--data-table--selected="{isSelected}"
{...$$restProps}
on:click
on:mouseover
on:mouseenter
on:mouseleave
>
<slot /> <slot />
</tr> </tr>

8
types/index.d.ts vendored
View file

@ -4420,14 +4420,6 @@ export class TableHeader extends CarbonSvelteComponent {
} }
export class TableRow extends CarbonSvelteComponent { export class TableRow extends CarbonSvelteComponent {
$$prop_def: {
/**
* Set to `true` to select the row
* @default false
*/
isSelected?: boolean;
};
$$slot_def: { default: {} }; $$slot_def: { default: {} };
} }