Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"pascalCasedName": "JsonEditorVue",
"version": "0.10.2",
"private": false,
"packageManager": "pnpm@latest",
"packageManager": "pnpm@7.18.1",
"description": "JSON editor & viewer for Vue 2.6 / 2.7 / 3 & Nuxt 2 / 3.",
"author": "cloydlau",
"license": "MIT",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions src/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { globalAttrs, globalProps } from './install'

export type Mode = 'tree' | 'text' | 'table'

const modelValueProp = isVue3 ? 'modelValue' : 'value'
const updateModelValue = isVue3 ? 'update:modelValue' : 'input'
const modelValueProp: any = isVue3 ? 'modelValue' : 'value'
const updateModelValue: any = isVue3 ? 'update:modelValue' : 'input'
const boolAttrs = [
'mainMenuBar',
'navigationBar',
Expand All @@ -28,19 +28,20 @@ const boolAttrs = [
'escapeControlCharacters',
'escapeUnicodeCharacters',
'flattenColumns',
]
] as const

export default defineComponent({
name,
inheritAttrs: true,
props: {
[modelValueProp]: {},
mode: {
type: String as PropType<Mode>,
},
...Object.fromEntries(Array.from(boolAttrs, boolAttr => [boolAttr, {
type: Boolean,
...(Object.fromEntries(boolAttrs.map(boolAttr => [boolAttr, {
type: Boolean as PropType<boolean>,
default: undefined,
}])),
}])) as { [key in typeof boolAttrs[number]]: { type: PropType<boolean>; default: undefined } }),
},
emits: [updateModelValue, 'update:mode'],
setup(props, { attrs, emit, expose }) {
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"resolveJsonModule": true,
"esModuleInterop": true,
"removeComments": false,
"skipLibCheck": true,
"jsx": "preserve",
"lib": ["esnext", "dom"],
"types": ["node"],
Expand Down