@anmed/mui-selection 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- package/SelectionField.svelte +10 -1
- package/package.json +1 -1
package/SelectionField.svelte
CHANGED
@@ -45,6 +45,15 @@ const handlerClick = () => {
|
|
45
45
|
dispatcher('action', value);
|
46
46
|
}
|
47
47
|
};
|
48
|
+
const isItemSelect = (item, value) => {
|
49
|
+
if (item != null && value != null) {
|
50
|
+
if (keyCode != null) {
|
51
|
+
return item[keyCode] == value[keyCode];
|
52
|
+
}
|
53
|
+
return item == value;
|
54
|
+
}
|
55
|
+
return false;
|
56
|
+
};
|
48
57
|
</script>
|
49
58
|
|
50
59
|
<div on:click={handlerClick}>
|
@@ -53,7 +62,7 @@ const handlerClick = () => {
|
|
53
62
|
<CommonField {label} {required} bind:focused {above} {error}>
|
54
63
|
<div class="card-select-box">
|
55
64
|
{#each list as item}
|
56
|
-
<span class="{item
|
65
|
+
<span class="{isItemSelect(item,value)? 'card-select-item-selected' :'card-select-item-normal'}"
|
57
66
|
on:click={()=>onCardItemClick(item)}>{getDisplayText(item)}</span>
|
58
67
|
{/each}
|
59
68
|
</div>
|