@@ -6,10 +6,8 @@ import type { App, PropType } from 'vue-demi'
6
6
import { conclude , resolveConfig } from 'vue-global-config'
7
7
import { PascalCasedName as name } from '../package.json'
8
8
9
- export type EditorMode = `${Mode } `
10
-
11
- const propsGlobal : Record < string , any > = { }
12
- const attrsGlobal : Record < string , any > = { }
9
+ const propsGlobal : Record < string | number | symbol , any > = { }
10
+ const attrsGlobal : Record < string | number | symbol , any > = { }
13
11
const modeDefault = 'tree'
14
12
const modelValueProp = isVue3 ? 'modelValue' : 'value'
15
13
const updateModelValue = isVue3 ? 'update:modelValue' : 'input'
@@ -35,7 +33,7 @@ export default defineComponent({
35
33
props : {
36
34
[ modelValueProp ] : Object ,
37
35
mode : {
38
- type : String as PropType < EditorMode > ,
36
+ type : String as PropType < Mode > ,
39
37
} ,
40
38
debounce : {
41
39
type : Number ,
@@ -56,32 +54,21 @@ export default defineComponent({
56
54
type : Boolean ,
57
55
default : undefined ,
58
56
} ,
59
- askToFormat : {
60
- type : Boolean ,
61
- default : undefined ,
62
- } ,
63
- readOnly : {
64
- type : Boolean ,
65
- default : undefined ,
66
- } ,
67
- escapeControlCharacters : {
68
- type : Boolean ,
69
- default : undefined ,
70
- } ,
71
- escapeUnicodeCharacters : {
72
- type : Boolean ,
73
- default : undefined ,
74
- } ,
75
- flattenColumns : {
76
- type : Boolean ,
77
- default : undefined ,
78
- } ,
57
+ ...Object . fromEntries (
58
+ boolAttrs . map ( boolAttr => [
59
+ boolAttr ,
60
+ {
61
+ type : Boolean as PropType < boolean > ,
62
+ default : undefined ,
63
+ } ,
64
+ ] ) ,
65
+ ) ,
79
66
} ,
80
67
emits : {
81
68
[ updateModelValue ] ( _payload : any ) {
82
69
return true
83
70
} ,
84
- 'update:mode' : function ( _payload : EditorMode ) {
71
+ 'update:mode' : function ( _payload : Mode ) {
85
72
return true
86
73
} ,
87
74
} ,
@@ -93,13 +80,13 @@ export default defineComponent({
93
80
const modeComputed = ref ( )
94
81
watchEffect ( ( ) => {
95
82
modeComputed . value = conclude ( [ props . mode , propsGlobal . mode ] , {
96
- type : String as PropType < EditorMode > ,
83
+ type : String as PropType < Mode > ,
97
84
} )
98
85
jsonEditor . value ?. updateProps ( {
99
86
mode : modeComputed . value || modeDefault ,
100
87
} )
101
88
} )
102
- const onChangeMode = ( mode : EditorMode ) => {
89
+ const onChangeMode = ( mode : Mode ) => {
103
90
emit ( 'update:mode' , mode )
104
91
}
105
92
// Synchronize the local `mode` with the global one
0 commit comments