Commit 39be286 1 parent ee7a12b commit 39be286 Copy full SHA for 39be286
File tree 2 files changed +21
-9
lines changed
2 files changed +21
-9
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @revolist/revogrid-column-numeral" ,
3
- "version" : " 2.0.6 " ,
3
+ "version" : " 2.0.7 " ,
4
4
"description" : " Number column type for RevoGrid system based on numeraljs" ,
5
5
"main" : " ./dist/revo-column-number.umd.cjs" ,
6
6
"module" : " ./dist/revo-column-number.mjs" ,
Original file line number Diff line number Diff line change 1
- import type {
2
- VNode ,
3
- CellProps ,
4
- ColumnDataSchemaModel ,
5
- HyperFunc ,
6
- ColumnProperties ,
7
- ColumnRegular ,
1
+ import {
2
+ type VNode ,
3
+ type CellProps ,
4
+ type ColumnDataSchemaModel ,
5
+ type HyperFunc ,
6
+ type ColumnType ,
7
+ type ColumnRegular ,
8
+ TextEditor ,
8
9
} from '@revolist/revogrid' ;
9
10
import numeral , { Numeral } from 'numeral' ;
10
11
11
12
const defaultFormat = '0,0[.]00' ;
13
+ /**
14
+ * Editor which returns value as number
15
+ */
16
+ class EditCell extends TextEditor {
17
+ getValue ( ) : any {
18
+ const value = this . editInput ?. value ;
19
+ const parsedValue = parseFloat ( value ) ;
20
+ return isNaN ( parsedValue ) ? value : parsedValue ;
21
+ }
22
+ }
12
23
13
- export default class NumberColumnType implements ColumnProperties {
24
+ export default class NumberColumnType implements ColumnType {
14
25
private numberFormat = defaultFormat ;
15
26
constructor (
16
27
format ?: string ,
@@ -20,6 +31,7 @@ export default class NumberColumnType implements ColumnProperties {
20
31
this . numberFormat = format ;
21
32
}
22
33
}
34
+ editor = EditCell ;
23
35
columnProperties = ( ) : CellProps => ( { class : { [ 'align-center' ] : true } } ) ;
24
36
25
37
cellProperties = ( ) : CellProps => ( { class : { [ 'align-right' ] : true } } ) ;
You can’t perform that action at this time.
0 commit comments