File tree Expand file tree Collapse file tree 2 files changed +70
-0
lines changed Expand file tree Collapse file tree 2 files changed +70
-0
lines changed Original file line number Diff line number Diff line change 1+ import { HXElement } from './HXElement' ;
2+ import { STATE } from './HXFormControlElement' ;
3+
4+ /**
5+ * Defines behavior for the `<hx-checkbox-set>` element.
6+ *
7+ * @extends HXElement
8+ * @hideconstructor
9+ * @since 0.18.0
10+ */
11+ export class HXCheckboxSetElement extends HXElement {
12+ static get is ( ) {
13+ return 'hx-checkbox-set' ;
14+ }
15+
16+ $onConnect ( ) {
17+ this . addEventListener ( 'hxchange' , this . _onHxchange ) ;
18+ this . addEventListener ( 'hxdirty' , this . _onHxdirty ) ;
19+ this . addEventListener ( 'hxtouch' , this . _onHxtouch ) ;
20+ }
21+
22+ $onDisconnect ( ) {
23+ this . removeEventListener ( 'hxchange' , this . _onHxchange ) ;
24+ this . removeEventListener ( 'hxdirty' , this . _onHxdirty ) ;
25+ this . removeEventListener ( 'hxtouch' , this . _onHxtouch ) ;
26+ }
27+
28+ /**
29+ * @readonly
30+ * @type {Boolean } [false]
31+ */
32+ get isDirty ( ) {
33+ return this . hasAttribute ( STATE . dirty ) ;
34+ }
35+
36+ /**
37+ * @readonly
38+ * @type {Boolean } [false]
39+ */
40+ get wasChanged ( ) {
41+ return this . hasAttribute ( STATE . changed ) ;
42+ }
43+
44+ /**
45+ * @readonly
46+ * @type {Boolean } [false]
47+ */
48+ get wasTouched ( ) {
49+ return this . hasAttribute ( STATE . touched ) ;
50+ }
51+
52+ /** @private */
53+ _onHxchange ( evt ) {
54+ evt . stopPropagation ( ) ;
55+ this . $defaultAttribute ( STATE . changed , '' ) ;
56+ }
57+
58+ /** @private */
59+ _onHxdirty ( evt ) {
60+ evt . stopPropagation ( ) ;
61+ this . $defaultAttribute ( STATE . dirty , '' ) ;
62+ }
63+
64+ /** @private */
65+ _onHxtouch ( evt ) {
66+ evt . stopPropagation ( ) ;
67+ this . $defaultAttribute ( STATE . touched , '' ) ;
68+ }
69+ }
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ export { HXAlertElement } from './HXAlertElement';
44export { HXBusyElement } from './HXBusyElement' ;
55export { HXCheckboxControlElement } from './HXCheckboxControlElement' ;
66export { HXCheckboxElement } from './HXCheckboxElement' ;
7+ export { HXCheckboxSetElement } from './HXCheckboxSetElement' ;
78export { HXDisclosureElement } from './HXDisclosureElement' ;
89export { HXDivElement } from './HXDivElement' ;
910export { HXDrawerElement } from './HXDrawerElement' ;
You can’t perform that action at this time.
0 commit comments