File tree Expand file tree Collapse file tree 7 files changed +27
-25
lines changed Expand file tree Collapse file tree 7 files changed +27
-25
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " cheetah-grid" ,
3
- "version" : " 0.22.6 " ,
3
+ "version" : " 0.22.7 " ,
4
4
"description" : " Cheetah Grid is a high performance grid engine that works on canvas" ,
5
5
"keywords" : [
6
6
" spreadsheet" ,
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import type {
6
6
EditorOption ,
7
7
InlineInputEditorOption ,
8
8
InlineMenuEditorOption ,
9
+ RecordBoolean ,
9
10
SmallDialogInputEditorOption ,
10
11
} from "../ts-types" ;
11
12
import { Action } from "./action/Action" ;
@@ -20,28 +21,28 @@ import { SmallDialogInputEditor } from "./action/SmallDialogInputEditor";
20
21
21
22
// eslint-disable-next-line @typescript-eslint/no-explicit-any
22
23
class ImmutableCheckEditor extends CheckEditor < any > {
23
- get disabled ( ) : boolean {
24
+ get disabled ( ) : RecordBoolean {
24
25
return this . _disabled ;
25
26
}
26
- get readOnly ( ) : boolean {
27
+ get readOnly ( ) : RecordBoolean {
27
28
return this . _readOnly ;
28
29
}
29
30
}
30
31
// eslint-disable-next-line @typescript-eslint/no-explicit-any
31
32
class ImmutableRadioEditor extends RadioEditor < any > {
32
- get disabled ( ) : boolean {
33
+ get disabled ( ) : RecordBoolean {
33
34
return this . _disabled ;
34
35
}
35
- get readOnly ( ) : boolean {
36
+ get readOnly ( ) : RecordBoolean {
36
37
return this . _readOnly ;
37
38
}
38
39
}
39
40
// eslint-disable-next-line @typescript-eslint/no-explicit-any
40
41
class ImmutableInputEditor extends SmallDialogInputEditor < any > {
41
- get disabled ( ) : boolean {
42
+ get disabled ( ) : RecordBoolean {
42
43
return this . _disabled ;
43
44
}
44
- get readOnly ( ) : boolean {
45
+ get readOnly ( ) : RecordBoolean {
45
46
return this . _readOnly ;
46
47
}
47
48
}
Original file line number Diff line number Diff line change @@ -4,18 +4,19 @@ import type {
4
4
EventListenerId ,
5
5
LayoutObjectId ,
6
6
ListGridAPI ,
7
+ RecordBoolean ,
7
8
} from "../../ts-types" ;
8
9
9
10
export abstract class BaseAction < T > {
10
- protected _disabled : boolean ;
11
+ protected _disabled : RecordBoolean ;
11
12
constructor ( option : BaseActionOption = { } ) {
12
13
this . _disabled = option . disabled || false ;
13
14
}
14
15
abstract get editable ( ) : boolean ;
15
- get disabled ( ) : boolean {
16
+ get disabled ( ) : RecordBoolean {
16
17
return this . _disabled ;
17
18
}
18
- set disabled ( disabled : boolean ) {
19
+ set disabled ( disabled : RecordBoolean ) {
19
20
this . _disabled = disabled ;
20
21
this . onChangeDisabledInternal ( ) ;
21
22
}
Original file line number Diff line number Diff line change
1
+ import type { EditorOption , RecordBoolean } from "../../ts-types" ;
1
2
import { BaseAction } from "./BaseAction" ;
2
- import type { EditorOption } from "../../ts-types" ;
3
3
export abstract class Editor < T > extends BaseAction < T > {
4
- protected _readOnly : boolean ;
4
+ protected _readOnly : RecordBoolean ;
5
5
constructor ( option : EditorOption = { } ) {
6
6
super ( option ) ;
7
7
this . _readOnly = option . readOnly || false ;
8
8
}
9
9
get editable ( ) : boolean {
10
10
return true ;
11
11
}
12
- get readOnly ( ) : boolean {
12
+ get readOnly ( ) : RecordBoolean {
13
13
return this . _readOnly ;
14
14
}
15
- set readOnly ( readOnly : boolean ) {
16
- this . _readOnly = ! ! readOnly ;
15
+ set readOnly ( readOnly : RecordBoolean ) {
16
+ this . _readOnly = readOnly ;
17
17
this . onChangeReadOnlyInternal ( ) ;
18
18
}
19
19
onChangeReadOnlyInternal ( ) : void {
Original file line number Diff line number Diff line change 1
- import type { ListGridAPI } from "../../ts-types" ;
1
+ import type { ListGridAPI , RecordBoolean } from "../../ts-types" ;
2
2
import { isPromise } from "../../internal/utils" ;
3
3
4
4
export function isDisabledRecord < T > (
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
- option : boolean | ( ( record : any ) => boolean ) ,
5
+ option : RecordBoolean ,
7
6
grid : ListGridAPI < T > ,
8
7
row : number
9
8
) : boolean {
@@ -13,8 +12,7 @@ export function isDisabledRecord<T>(
13
12
return getBooleanOptionOfRecord ( option , grid , row ) ;
14
13
}
15
14
export function isReadOnlyRecord < T > (
16
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
- option : boolean | ( ( record : any ) => boolean ) ,
15
+ option : RecordBoolean ,
18
16
grid : ListGridAPI < T > ,
19
17
row : number
20
18
) : boolean {
@@ -55,8 +53,7 @@ export function toggleValue(
55
53
}
56
54
57
55
function getBooleanOptionOfRecord < T > (
58
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
- option : boolean | ( ( record : any ) => boolean ) ,
56
+ option : RecordBoolean ,
60
57
grid : ListGridAPI < T > ,
61
58
row : number
62
59
) : boolean {
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import type {
8
8
export class BaseAction < T > {
9
9
protected _disabled : boolean ;
10
10
constructor ( option : BaseActionOption = { } ) {
11
- this . _disabled = option . disabled || false ;
11
+ this . _disabled = ! ! option . disabled || false ;
12
12
}
13
13
get disabled ( ) : boolean {
14
14
return this . _disabled ;
Original file line number Diff line number Diff line change @@ -3,8 +3,11 @@ import type { ColumnMenuItemOptions } from "../define";
3
3
import type { ListGridAPI } from "../grid-engine" ;
4
4
import type { MaybePromise } from "../base" ;
5
5
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
+ export type RecordBoolean < T = any > = boolean | ( ( record : T ) => boolean ) ;
8
+
6
9
export interface BaseActionOption {
7
- disabled ?: boolean ;
10
+ disabled ?: RecordBoolean ;
8
11
}
9
12
10
13
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -13,7 +16,7 @@ export interface ActionOption extends BaseActionOption {
13
16
action ?: ActionListener ;
14
17
}
15
18
export interface EditorOption extends BaseActionOption {
16
- readOnly ?: boolean ;
19
+ readOnly ?: RecordBoolean ;
17
20
}
18
21
export type ButtonActionOption = ActionOption ;
19
22
You can’t perform that action at this time.
0 commit comments