Merge branch '2.0.1'

This commit is contained in:
albert
2022-04-17 13:09:34 +08:00
17 changed files with 127557 additions and 44 deletions

File diff suppressed because one or more lines are too long

1
dist/css/chunk-vendors.4a1219fc.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
*{padding:0;margin:0;box-sizing:border-box}.title{text-align:center;font-size:40px;font-weight:700;height:100px;line-height:100px}.desc{padding:20px;padding:0 3em;font-size:1.2em}.container,.desc{width:80vw;min-width:800px;margin:auto}.container{display:flex;padding:20px;justify-content:center;height:calc(100vh - 150px)}.code-container{max-height:600px;overflow:auto}.schema{margin-left:20px;width:50%;height:100%;overflow-y:auto;overflow-x:hidden;border:1px solid rgba(0,0,0,.1);border-radius:8px;padding:12px}.CodeMirror{height:100%!important}.vue-codemirror{flex:1;margin:0 24px;border:1px solid rgba(0,0,0,.1);min-height:300px;overflow:auto;border-radius:6px}.json-schema-editor .row[data-v-2ccfe969]{display:flex;margin:12px}.json-schema-editor .row .ant-col-name .ant-col-name-c[data-v-2ccfe969],.json-schema-editor .row .ant-col-name[data-v-2ccfe969]{display:flex;align-items:center}.json-schema-editor .row .ant-col-name .ant-col-name-required[data-v-2ccfe969]{flex:0 0 24px;text-align:center}.json-schema-editor .row .ant-col-type[data-v-2ccfe969]{width:100%}.json-schema-editor .row .ant-col-setting[data-v-2ccfe969]{display:inline-block}.json-schema-editor .row .setting-icon[data-v-2ccfe969]{color:rgba(0,0,0,.45);border:none}.json-schema-editor .row .plus-icon[data-v-2ccfe969]{border:none}.json-schema-editor .row .close-icon[data-v-2ccfe969]{color:#888;border:none}.json-schema-editor-advanced-modal{color:rgba(0,0,0,.65);min-width:600px}.json-schema-editor-advanced-modal pre{font-family:monospace;height:100%;overflow-y:auto;border:1px solid rgba(0,0,0,.1);border-radius:4px;padding:12px;width:50%}.json-schema-editor-advanced-modal h3{display:block;border-left:3px solid #1890ff;padding:0 8px}.json-schema-editor-advanced-modal .ant-advanced-search-form .ant-form-item{display:flex}.json-schema-editor-advanced-modal .ant-advanced-search-form .ant-form-item .ant-form-item-control-wrapper{flex:1}
*{padding:0;margin:0;box-sizing:border-box}.title{text-align:center;font-size:40px;font-weight:700;height:100px;line-height:100px}.desc{padding:20px;padding:0 3em;font-size:1.2em}.container,.desc{width:80vw;min-width:800px;margin:auto}.container{display:flex;padding:20px;justify-content:center;height:calc(100vh - 150px)}.code-container{max-height:600px;overflow:auto}.schema{margin-left:20px;width:50%;height:100%;overflow-y:auto;overflow-x:hidden;border:1px solid rgba(0,0,0,.1);border-radius:8px;padding:12px}.CodeMirror{height:100%!important}.vue-codemirror{flex:1;margin:0 24px;border:1px solid rgba(0,0,0,.1);min-height:300px;overflow:auto;border-radius:6px}.json-schema-editor .row[data-v-bc2ddb9c]{display:flex;margin:12px}.json-schema-editor .row .ant-col-name .ant-col-name-c[data-v-bc2ddb9c],.json-schema-editor .row .ant-col-name[data-v-bc2ddb9c]{display:flex;align-items:center}.json-schema-editor .row .ant-col-name .ant-col-name-required[data-v-bc2ddb9c]{flex:0 0 24px;text-align:center}.json-schema-editor .row .ant-col-type[data-v-bc2ddb9c]{width:100%}.json-schema-editor .row .ant-col-setting[data-v-bc2ddb9c]{display:inline-block}.json-schema-editor .row .setting-icon[data-v-bc2ddb9c]{color:rgba(0,0,0,.45);border:none}.json-schema-editor .row .plus-icon[data-v-bc2ddb9c]{border:none}.json-schema-editor .row .close-icon[data-v-bc2ddb9c]{color:#888;border:none}.json-schema-editor-advanced-modal{color:rgba(0,0,0,.65);min-width:600px}.json-schema-editor-advanced-modal pre{font-family:monospace;height:100%;overflow-y:auto;border:1px solid rgba(0,0,0,.1);border-radius:4px;padding:12px;width:50%}.json-schema-editor-advanced-modal h3{display:block;border-left:3px solid #1890ff;padding:0 8px}.json-schema-editor-advanced-modal .ant-advanced-search-form .ant-form-item{display:flex}.json-schema-editor-advanced-modal .ant-advanced-search-form .ant-form-item .ant-form-item-control-wrapper{flex:1}

2
dist/index.html vendored
View File

@@ -105,4 +105,4 @@
-o-transform: rotate(10deg);
transform: rotate(10deg);
}
}</style><link href=css/chunk-vendors.33cca3b1.css rel=preload as=style><link href=css/index.23210cbb.css rel=preload as=style><link href=js/chunk-vendors.e1d2dd21.js rel=preload as=script><link href=js/index.147d6436.js rel=preload as=script><link href=css/chunk-vendors.33cca3b1.css rel=stylesheet><link href=css/index.23210cbb.css rel=stylesheet></head><body><a href=https://github.com/zyqwst/json-schema-editor-vue class=github-corner target=_blank title="Follow me on GitHub" aria-label="Follow me on GitHub"><svg width=80 height=80 viewBox="0 0 250 250" style="fill:#008000; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden=true><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill=currentColor style="transform-origin: 130px 106px;" class=octo-arm></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill=currentColor class=octo-body></path></svg></a><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><footer style=text-align:center;margin-bottom:16px;><a href="" target=_blank style="color: #999">Github</a><a href="" target=_blank style="color: #999;margin-left:16px;">Gitee</a><span style=margin-left:16px>©Zhangyq</span></footer><script src=js/chunk-vendors.e1d2dd21.js></script><script src=js/index.147d6436.js></script></body></html>
}</style><link href=css/chunk-vendors.4a1219fc.css rel=preload as=style><link href=css/index.d6c7999d.css rel=preload as=style><link href=js/chunk-vendors.9fa1e565.js rel=preload as=script><link href=js/index.0f42111c.js rel=preload as=script><link href=css/chunk-vendors.4a1219fc.css rel=stylesheet><link href=css/index.d6c7999d.css rel=stylesheet></head><body><a href=https://github.com/zyqwst/json-schema-editor-vue class=github-corner target=_blank title="Follow me on GitHub" aria-label="Follow me on GitHub"><svg width=80 height=80 viewBox="0 0 250 250" style="fill:#008000; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden=true><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill=currentColor style="transform-origin: 130px 106px;" class=octo-arm></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill=currentColor class=octo-body></path></svg></a><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><footer style=text-align:center;margin-bottom:16px;><a href="" target=_blank style="color: #999">Github</a><a href="" target=_blank style="color: #999;margin-left:16px;">Gitee</a><span style=margin-left:16px>©Zhangyq</span></footer><script src=js/chunk-vendors.9fa1e565.js></script><script src=js/index.0f42111c.js></script></body></html>

301
dist/js/chunk-vendors.9fa1e565.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

1
dist/js/index.0f42111c.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

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "json-schema-editor-vue",
"version": "2.0.0",
"version": "2.0.1",
"author": "zhangyq",
"description": "A json-schema editor of high efficient and easy-to-use, base on Vue",
"keywords": [

View File

@@ -62,11 +62,11 @@
<a-col :span="8" v-for="(item,key) in advancedValue" :key="key">
<a-form-item>
<span>{{ local[key] }}</span>
<a-input-number v-model="advancedValue[key]" v-if="advancedAttr[key].type === 'integer'" style="width:100%" :placeholder="key"/>
<a-input-number v-model="advancedValue[key]" v-else-if="advancedAttr[key].type === 'number'" style="width:100%" :placeholder="key"/>
<a-input-number v-model="advancedValue[key]" v-if="advancedAttr[key].type === 'integer' || advancedAttr[key].type === 'number'" style="width:100%" :placeholder="key"/>
<span v-else-if="advancedAttr[key].type === 'boolean'" style="display:inline-block;width:100%">
<a-switch v-model="advancedValue[key]"/>
</span>
<a-textarea @blur="changeEnumValue" :value="advancedValue['enum'] && advancedValue['enum'].length && advancedValue['enum'].join('\n')" :rows="2" v-else-if="key === 'enum'" ></a-textarea>
<a-select v-else-if="advancedAttr[key].type === 'array'" v-model="advancedValue[key]" style="width:100%" :getPopupContainer="
triggerNode => {
return triggerNode.parentNode || document.body;
@@ -78,7 +78,6 @@
{{t}}
</a-select-option>
</a-select>
<a-input v-model="advancedValue[key]" v-else style="width:100%" :placeholder="key"/>
</a-form-item>
</a-col>
@@ -128,7 +127,7 @@ export default {
AButton: Button,
// eslint-disable-next-line vue/no-unused-components
AIcon: Icon,
AInput: Input,AInputNumber:InputNumber,
AInput: Input,AInputNumber:InputNumber,ATextarea: Input.TextArea,
ACheckbox: Checkbox,
ASelect: Select,
ASelectOption:Select.Option,
@@ -254,10 +253,19 @@ export default {
}
},
onChangeType() {
this.parseCustomProps()
// 删除自定义属性
this.customProps.forEach(item => {
this.$delete(this.pickValue, item.key)
});
this.customProps = [];
this.$delete(this.pickValue,'properties')
this.$delete(this.pickValue,'items')
this.$delete(this.pickValue,'required')
this.$delete(this.pickValue,'format')
this.$delete(this.pickValue,'enum')
if(this.isArray){
this.$set(this.pickValue,'items',{type:'string'})
}
@@ -268,6 +276,16 @@ export default {
onRootCheck(e){
this._deepCheck( e.target.checked,this.pickValue)
},
changeEnumValue (e) {
const pickType = this.pickValue.type
const value = e.target.value
var arr = value.split('\n')
if (arr.length === 0 || (arr.length == 1 && !arr[0])) {
this.$delete(this.advancedValue, 'enum')
} else {
this.advancedValue.enum = arr.map(item => pickType === 'string' ? item : +item)
}
},
_deepCheck(checked,node){
if(node.type === 'object' && node.properties){
checked ? this.$set(node,'required',Object.keys(node.properties)) : this.$delete(node,'required')
@@ -323,7 +341,7 @@ export default {
},
onSetting(){
this.modalVisible = true
this.advancedValue = this.advanced.value
this.advancedValue = { ...this.advanced.value }
for(const k in this.advancedValue) {
if(this.pickValue[k]) this.advancedValue[k] = this.pickValue[k]
}

View File

@@ -3,7 +3,8 @@ const value = {
maximum: null,
minimum: null,
exclusiveMaximum:null,
exclusiveMinimum:null
exclusiveMinimum:null,
enum:[]
}
const attr = {
description: {
@@ -25,6 +26,10 @@ const attr = {
exclusiveMinimum:{
name:'不包含最小值',
type:'boolean'
},
enum:{
name:'枚举',
type:'array'
}
}
const wrapper = {value, attr}

View File

@@ -3,7 +3,8 @@ const value = {
maximum: null,
minimum: null,
exclusiveMaximum:null,
exclusiveMinimum:null
exclusiveMinimum:null,
enum:[]
}
const attr = {
description: {
@@ -25,6 +26,10 @@ const attr = {
exclusiveMinimum:{
name:'不包含最小值',
type:'boolean'
},
enum:{
name:'枚举',
type:'array'
}
}
const wrapper = {value, attr}

View File

@@ -3,7 +3,8 @@ const value = {
maxLength: null,
minLength: null,
pattern: null,
format:null
format:undefined,
enum:[]
}
const attr = {
description: {
@@ -26,6 +27,10 @@ const attr = {
name:'格式',
type:'array',
enums:['date','date-time','email','hostname','ipv4','ipv6','uri']
},
enum:{
name:'枚举',
type:'array'
}
}
const wrapper = {value, attr}