This commit is contained in:
zyqwst
2020-06-28 00:07:58 +08:00
parent fdb356484a
commit 0ee5a0f388
8 changed files with 296 additions and 301 deletions

View File

@@ -1 +0,0 @@
*{padding:0;margin:0;box-sizing:border-box}.title{text-align:center;font-size:40px;font-weight:700;height:100px;line-height:100px}.container{display:flex;padding:20px;width:80vw;min-width:800px;justify-content:center;height:calc(100vh - 100px);margin:auto}pre{font-family:monospace}.schema,pre{height:100%;overflow-y:auto;border:1px solid rgba(0,0,0,.1);border-radius:8px;padding:12px;width:50%}.schema{margin-left:20px;overflow-x:hidden}.json-schema-editor .row[data-v-1d1f3aa4]{display:flex;margin:12px}.json-schema-editor .row .ant-col-name .ant-col-name-c[data-v-1d1f3aa4],.json-schema-editor .row .ant-col-name[data-v-1d1f3aa4]{display:flex;align-items:center}.json-schema-editor .row .ant-col-name .ant-col-name-required[data-v-1d1f3aa4]{margin-left:6px}.json-schema-editor .row .ant-col-type[data-v-1d1f3aa4]{width:100%}.json-schema-editor .row .ant-col-setting[data-v-1d1f3aa4]{display:inline-block}.json-schema-editor .row .setting-icon[data-v-1d1f3aa4]{color:rgba(0,0,0,.45)}.json-schema-editor .row .plus-icon[data-v-1d1f3aa4]{color:#5b8ff9}.json-schema-editor .row .close-icon[data-v-1d1f3aa4]{color:#e8684a}

1
dist/css/index.f23e0edd.css vendored Normal file
View File

@@ -0,0 +1 @@
*{padding:0;margin:0;box-sizing:border-box}.title{text-align:center;font-size:40px;font-weight:700;height:100px;line-height:100px}.container{display:flex;padding:20px;width:80vw;min-width:800px;justify-content:center;height:calc(100vh - 100px);margin:auto}pre{font-family:monospace}.schema,pre{height:100%;overflow-y:auto;border:1px solid rgba(0,0,0,.1);border-radius:8px;padding:12px;width:50%}.schema{margin-left:20px;overflow-x:hidden}.json-schema-editor .row[data-v-7590959b]{display:flex;margin:12px}.json-schema-editor .row .ant-col-name .ant-col-name-c[data-v-7590959b],.json-schema-editor .row .ant-col-name[data-v-7590959b]{display:flex;align-items:center}.json-schema-editor .row .ant-col-name .ant-col-name-required[data-v-7590959b]{flex:0 0 24px;text-align:center}.json-schema-editor .row .ant-col-type[data-v-7590959b]{width:100%}.json-schema-editor .row .ant-col-setting[data-v-7590959b]{display:inline-block}.json-schema-editor .row .setting-icon[data-v-7590959b]{color:rgba(0,0,0,.45)}.json-schema-editor .row .plus-icon[data-v-7590959b]{color:#5b8ff9}.json-schema-editor .row .close-icon[data-v-7590959b]{color:#e8684a}

2
dist/index.html vendored
View File

@@ -1 +1 @@
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon.ico><title>json-schema-editor-vue</title><link href=css/chunk-vendors.f4ffed8f.css rel=preload as=style><link href=css/index.ca1e8054.css rel=preload as=style><link href=js/chunk-vendors.ccb7282d.js rel=preload as=script><link href=js/index.e12b4015.js rel=preload as=script><link href=css/chunk-vendors.f4ffed8f.css rel=stylesheet><link href=css/index.ca1e8054.css rel=stylesheet></head><body><noscript><strong>We're sorry but json-schema-editor-vue doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.ccb7282d.js></script><script src=js/index.e12b4015.js></script></body></html> <!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon.ico><title>json-schema-editor-vue</title><link href=css/chunk-vendors.f4ffed8f.css rel=preload as=style><link href=css/index.f23e0edd.css rel=preload as=style><link href=js/chunk-vendors.f9af6da6.js rel=preload as=script><link href=js/index.3da5f4f3.js rel=preload as=script><link href=css/chunk-vendors.f4ffed8f.css rel=stylesheet><link href=css/index.f23e0edd.css rel=stylesheet></head><body><noscript><strong>We're sorry but json-schema-editor-vue doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.f9af6da6.js></script><script src=js/index.3da5f4f3.js></script></body></html>

File diff suppressed because one or more lines are too long

290
dist/js/chunk-vendors.f9af6da6.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/js/index.3da5f4f3.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -5,7 +5,7 @@
<div :style="{marginLeft:`${20*deep}px`}" class="ant-col-name-c"> <div :style="{marginLeft:`${20*deep}px`}" class="ant-col-name-c">
<a-button v-if="pickValue.type==='object'" type="link" :icon="hidden?'caret-right':'caret-down'" style="color:rgba(0,0,0,.65)" @click="hidden = !hidden"/> <a-button v-if="pickValue.type==='object'" type="link" :icon="hidden?'caret-right':'caret-down'" style="color:rgba(0,0,0,.65)" @click="hidden = !hidden"/>
<span v-else style="width:32px;display:inline-block"></span> <span v-else style="width:32px;display:inline-block"></span>
<a-input :disabled="disabled || root" :value="pickKey" class="ant-col-name-input" @input="onInputName"/> <a-input :disabled="disabled || root" :value="pickKey" class="ant-col-name-input" @blur="onInputName"/>
</div> </div>
<a-tooltip v-if="root"> <a-tooltip v-if="root">
<span slot="title">全选</span> <span slot="title">全选</span>
@@ -56,7 +56,6 @@
<script> <script>
import TYPE from './type/type' import TYPE from './type/type'
import { Row,Col,Button,Input, Icon,Checkbox,Select,Tooltip } from 'ant-design-vue' import { Row,Col,Button,Input, Icon,Checkbox,Select,Tooltip } from 'ant-design-vue'
// import { clearAttr } from './util'
export default { export default {
name:'JsonSchemaEditor', name:'JsonSchemaEditor',
components: { components: {
@@ -123,9 +122,6 @@ export default {
methods: { methods: {
onInputName(e){ onInputName(e){
const val = e.target.value const val = e.target.value
console.info('input_name',this.pickKey, val,this.parent)
// this.$set(this.parent.properties,val,this.pickValue)
// this.$delete(this.parent.properties,this.pickKey)
const p = {}; const p = {};
for(let key in this.parent.properties){ for(let key in this.parent.properties){
if(key != this.pickKey){ if(key != this.pickKey){
@@ -135,7 +131,6 @@ export default {
delete this.parent.properties[key] delete this.parent.properties[key]
} }
} }
console.info(JSON.stringify(p))
this.$set(this.parent,'properties',p) this.$set(this.parent,'properties',p)
}, },
onChangeType() { onChangeType() {
@@ -157,7 +152,6 @@ export default {
checked ? this.$set(node,'required',Object.keys(node.properties)) : this.$delete(node,'required') checked ? this.$set(node,'required',Object.keys(node.properties)) : this.$delete(node,'required')
Object.keys(node.properties).forEach(key => this._deepCheck(checked,node.properties[key])) Object.keys(node.properties).forEach(key => this._deepCheck(checked,node.properties[key]))
} else if(node.type === 'array' && node.items.type === 'object'){ } else if(node.type === 'array' && node.items.type === 'object'){
console.info("t1",node)
checked ? this.$set(node.items,'required',Object.keys(node.items.properties)) : this.$delete(node.items,'required') checked ? this.$set(node.items,'required',Object.keys(node.items.properties)) : this.$delete(node.items,'required')
Object.keys(node.items.properties).forEach(key => this._deepCheck(checked,node.items.properties[key])) Object.keys(node.items.properties).forEach(key => this._deepCheck(checked,node.items.properties[key]))
} }
@@ -211,7 +205,8 @@ export default {
align-items: center; align-items: center;
} }
.ant-col-name-required{ .ant-col-name-required{
margin-left:6px; flex:0 0 24px;
text-align:center;
} }
} }
.ant-col-type{ .ant-col-type{