99 unref ,
1010 watch ,
1111} from 'vue-demi'
12- import type { HTMLAttributes , PropType } from 'vue-demi'
12+ import type { PropType } from 'vue-demi'
1313import { JSONEditor } from 'vanilla-jsoneditor'
1414import { conclude } from 'vue-global-config'
1515import { debounce } from 'lodash-es'
@@ -18,10 +18,10 @@ import { globalAttrs, globalProps } from './install'
1818
1919export type Mode = 'tree' | 'text' | 'table'
2020
21- type ModalValue = typeof isVue3 extends true ? 'modelValue' : 'value'
21+ type ModalValueProp = typeof isVue3 extends true ? 'modelValue' : 'value'
2222type UpdateModalValue = typeof isVue3 extends true ? 'update:modelValue' : 'input'
2323
24- const modelValueProp : ModalValue = ( isVue3 ? 'modelValue' : 'value' ) as any
24+ const modelValueProp : ModalValueProp = ( isVue3 ? 'modelValue' : 'value' ) as any
2525const updateModelValue : UpdateModalValue = ( isVue3 ? 'update:modelValue' : 'input' ) as any
2626
2727const boolAttributes = [
@@ -34,23 +34,19 @@ const boolAttributes = [
3434 'flattenColumns' ,
3535] as const
3636
37- type Attributes = ModalValue | UpdateModalValue
38- type BoolAttributes = {
39- [ K in typeof boolAttributes [ number ] ] : boolean
40- }
41-
42- export default defineComponent < HTMLAttributes & { mode : PropType < Mode > } & { [ K in Attributes ] : any } & BoolAttributes , { } , { } , { } , { } , { } , { } , { 'update:mode' : ( mode : Mode ) => void ; 'update:modalValue' : ( value : unknown ) => void ; 'input' : ( value : unknown ) => void } > ( {
37+ export default defineComponent ( {
4338 name,
39+ inheritAttrs : true ,
4440 props : {
4541 [ modelValueProp ] : { } ,
4642 mode : {
4743 type : String as PropType < Mode > ,
4844 } ,
49- ...Object . fromEntries ( Array . from ( boolAttributes , boolAttr => [ boolAttr , {
45+ ...( Object . fromEntries ( Array . from ( boolAttributes , boolAttr => [ boolAttr , {
5046 type : Boolean ,
5147 default : undefined ,
52- } ] ) ) ,
53- } as any ,
48+ } ] ) ) as { [ key in typeof boolAttributes [ number ] ] : { type : BooleanConstructor ; default : undefined } } ) ,
49+ } ,
5450 emits : [ updateModelValue , 'update:mode' ] ,
5551 setup ( props , { attrs, emit, expose } ) {
5652 const currentInstance = getCurrentInstance ( ) ?. proxy
0 commit comments