From e9367f45d6e2d864ee32a4a09e8b6ec09915eaa9 Mon Sep 17 00:00:00 2001 From: bzp2010 Date: Mon, 6 Apr 2020 11:41:03 +0800 Subject: [PATCH 1/3] feat: add array property editor --- src/components/PluginDialog/index.vue | 74 ++++++++++++++++++++++++++- src/lang/en.ts | 3 ++ src/lang/zh.ts | 3 ++ 3 files changed, 79 insertions(+), 1 deletion(-) diff --git a/src/components/PluginDialog/index.vue b/src/components/PluginDialog/index.vue index a1a5f4be03..bc9b990134 100644 --- a/src/components/PluginDialog/index.vue +++ b/src/components/PluginDialog/index.vue @@ -132,6 +132,26 @@ active-color="#13ce66" inactive-color="#ff4949" /> + + +
+ + + + + {{ $t('button.addValue') }} + +
Date: Mon, 6 Apr 2020 19:04:12 +0800 Subject: [PATCH 2/3] fix some problem --- src/components/PluginDialog/index.vue | 29 ++++++++++++++++++--------- src/lang/en.ts | 4 +++- src/lang/zh.ts | 4 +++- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/components/PluginDialog/index.vue b/src/components/PluginDialog/index.vue index bc9b990134..40a2b1ffea 100644 --- a/src/components/PluginDialog/index.vue +++ b/src/components/PluginDialog/index.vue @@ -95,6 +95,7 @@ :prop="key" > + + + + -
- +
{{ $t('button.addValue') }} @@ -161,14 +165,14 @@ - Cancel + {{ $t('button.cancel') }} - Confirm + {{ $t('button.confirm') }} @@ -334,7 +338,7 @@ export default class extends Vue { if (valid) { this.data = this.processOneOfProp(this.data) this.$emit('save', this.name, this.data) - this.$message.warning('Your data will be saved after you click the Save button') + this.$message.warning(`${this.$t('message.clickSaveButton')}`) } else { return false } @@ -350,7 +354,7 @@ export default class extends Vue { this.arrayPropertiesLength[key].push(this.arrayPropertiesLength[key].length) this.$forceUpdate() } else { - this.$message.warning(`${this.$t('message.cannotAddMore')}`) + this.$message.warning(`${this.$t('message.cannotAddMoreItems')}`) } } @@ -413,5 +417,10 @@ export default class extends Vue { margin-left: 10px; } } + + .array-input-container > * { + display: flex; + margin-top: 5px; + } } diff --git a/src/lang/en.ts b/src/lang/en.ts index 59401336e6..58623f7438 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -64,6 +64,7 @@ export default { }, button: { save: 'Save', + confirm: 'Confirm', cancel: 'Cancel', add_plugin: 'Add Plugin', add_node: 'Add Node', @@ -87,6 +88,7 @@ export default { hashOnTip: 'Select a hash on.' }, message: { - cannotAddMore: 'You cannot add more item!' + cannotAddMoreItems: 'You cannot add more item!', + clickSaveButton: 'Your data will be saved after you click the Save button!' } } diff --git a/src/lang/zh.ts b/src/lang/zh.ts index 33dccc91b8..5eb56c4db9 100644 --- a/src/lang/zh.ts +++ b/src/lang/zh.ts @@ -72,6 +72,7 @@ export default { }, button: { save: '保存', + confirm: '确认', cancel: '取消', add_plugin: '添加 Plugin', add_node: '添加 Node', @@ -95,6 +96,7 @@ export default { hashOnTip: '选择 chash 参数来源。' }, message: { - cannotAddMore: '不能添加更多项了!' + cannotAddMoreItems: '不能添加更多项了!', + clickSaveButton: '你的数据将在点击保存按钮后被保存!' } } From 17813de87c24e7f906790e009db076cea7a4a532 Mon Sep 17 00:00:00 2001 From: bzp2010 Date: Mon, 6 Apr 2020 21:25:16 +0800 Subject: [PATCH 3/3] clean useless codes --- src/components/PluginDialog/index.vue | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/PluginDialog/index.vue b/src/components/PluginDialog/index.vue index 40a2b1ffea..045626605b 100644 --- a/src/components/PluginDialog/index.vue +++ b/src/components/PluginDialog/index.vue @@ -280,15 +280,12 @@ export default class extends Vue { schemaKeys[key] = [] this.arrayPropertiesLength[key] = [...new Array(this.pluginData[key] ? this.pluginData[key].length : schema.properties[key].minItems).keys()] break - case 'object': schemaKeys[key] = {} break - case 'boolean': schemaKeys[key] = false break - default: schemaKeys[key] = '' }