Skip to content

Commit 26c40a1

Browse files
committed
ChmodCheckbox is completed
1 parent fc5118b commit 26c40a1

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

src/components.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export namespace Components {
2525
* The middle name
2626
*/
2727
'middle': string;
28-
'permissionValue': number;
28+
'permission': number;
2929
}
3030
}
3131

@@ -59,7 +59,7 @@ declare namespace LocalJSX {
5959
* The middle name
6060
*/
6161
'middle'?: string;
62-
'permissionValue'?: number;
62+
'permission'?: number;
6363
}
6464

6565
interface IntrinsicElements {

src/components/chmod-checkbox/chmod-checkbox.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ export class CHModCheckbox {
1010
/**
1111
* The first name
1212
*/
13-
@Prop({ mutable: true }) first: string = "READ";
13+
@Prop() first: string = "READ";
1414

1515
/**
1616
* The middle name
1717
*/
18-
@Prop({ mutable: true }) middle: string = "WRITE";
18+
@Prop() middle: string = "WRITE";
1919

2020
/**
2121
* The last name
2222
*/
23-
@Prop({ mutable: true }) last: string = "EXECUTE";
23+
@Prop() last: string = "EXECUTE";
2424

25-
@Prop() permissionValue: number = 0;
25+
@Prop({ mutable: true, reflect: true }) permission: number = 0;
2626
@Prop() isReadChecked: boolean = false;
2727
@Prop() isWriteChecked: boolean = false;
2828
@Prop() isExecuteChecked: boolean = false;
@@ -37,13 +37,12 @@ export class CHModCheckbox {
3737
id="read"
3838
name="check"
3939
type="checkbox"
40-
checked={this.isReadChecked}
4140
onChange={() => {
4241
this.isReadChecked = !this.isReadChecked;
43-
this.permissionValue = calculatePermission(
42+
this.permission = calculatePermission(
4443
"read",
4544
this.isReadChecked,
46-
this.permissionValue
45+
this.permission
4746
);
4847
}}
4948
/>
@@ -61,13 +60,12 @@ export class CHModCheckbox {
6160
id="write"
6261
name="check"
6362
type="checkbox"
64-
checked={this.isWriteChecked}
6563
onChange={() => {
6664
this.isWriteChecked = !this.isWriteChecked;
67-
this.permissionValue = calculatePermission(
65+
this.permission = calculatePermission(
6866
"write",
6967
this.isWriteChecked,
70-
this.permissionValue
68+
this.permission
7169
);
7270
}}
7371
/>
@@ -85,13 +83,12 @@ export class CHModCheckbox {
8583
id="execute"
8684
name="check"
8785
type="checkbox"
88-
checked={this.isExecuteChecked}
8986
onChange={() => {
9087
this.isExecuteChecked = !this.isExecuteChecked;
91-
this.permissionValue = calculatePermission(
88+
this.permission = calculatePermission(
9289
"execute",
9390
this.isExecuteChecked,
94-
this.permissionValue
91+
this.permission
9592
);
9693
}}
9794
/>

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
<script nomodule src="/build/chmod-checkbox.js"></script>
1212
</head>
1313
<body>
14-
<chmod-checkbox />
14+
<chmod-checkbox permission="0"/>
1515
</body>
1616
</html>

0 commit comments

Comments
 (0)