@dreamworld/dw-chip-select 1.1.3 → 1.1.4
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/dw-chip-select.js +13 -0
- package/package.json +1 -1
package/dw-chip-select.js
CHANGED
|
@@ -35,6 +35,11 @@ export class DwChipSelect extends LitElement {
|
|
|
35
35
|
margin-right: 8px;
|
|
36
36
|
margin-top: 8px;
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
dw-chip[disabled] {
|
|
40
|
+
opacity: 0.5;
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
}
|
|
38
43
|
`;
|
|
39
44
|
}
|
|
40
45
|
|
|
@@ -64,6 +69,11 @@ export class DwChipSelect extends LitElement {
|
|
|
64
69
|
*/
|
|
65
70
|
valueTextProvider: { type: Function },
|
|
66
71
|
|
|
72
|
+
/**
|
|
73
|
+
* specific chip should be disabled or not
|
|
74
|
+
*/
|
|
75
|
+
chipDisabledProvider: { type: Function },
|
|
76
|
+
|
|
67
77
|
/**
|
|
68
78
|
* This function provides the value.
|
|
69
79
|
*/
|
|
@@ -147,11 +157,14 @@ export class DwChipSelect extends LitElement {
|
|
|
147
157
|
${repeat(this.items, (item, index) => {
|
|
148
158
|
const selected = this.#_isSelected(item);
|
|
149
159
|
const activated = this.#_isActivated(index);
|
|
160
|
+
const isDisabled = this.chipDisabledProvider ? this.chipDisabledProvider(item) : false;
|
|
161
|
+
|
|
150
162
|
return html`<dw-chip
|
|
151
163
|
.value=${this.valueTextProvider(item)}
|
|
152
164
|
?selected=${selected}
|
|
153
165
|
?activated=${activated}
|
|
154
166
|
.type=${this.type}
|
|
167
|
+
?disabled=${isDisabled}
|
|
155
168
|
@click=${() => this._onChipToggle(item, selected, index)}
|
|
156
169
|
></dw-chip>`;
|
|
157
170
|
})}
|