Commit 81f17997 authored by rockyl's avatar rockyl

翻译中文

实现预设
parent 8f8ad27b
VUE_APP_I18N_LOCALE=en VUE_APP_I18N_LOCALE=zh-CN
VUE_APP_I18N_FALLBACK_LOCALE=en VUE_APP_I18N_FALLBACK_LOCALE=en
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
</noscript> </noscript>
<script> <script>
window.__data = { window.__data = {
token : "<%= process.env.NODE_ENV === 'development' ? 'eyJhbGciOiJIUzI1NiJ9.5Yqz55Cq5bOw.wixVqBeqGS2FBY_VWF1cC_Vg5Zr0vYgRTfuncjGthYY' : '$TOKEN$' %>" token : "<%= process.env.NODE_ENV === 'development' ? 'eyJhbGciOiJIUzI1NiJ9.5Yqz55Cq5bOw.wixVqBeqGS2FBY_VWF1cC_Vg5Zr0vYgRTfuncjGthYY' : '$TOKEN$' %>",
apiHost : "<%= process.env.NODE_ENV === 'development' ? 'http://beacon.duibadev.com.cn' : '$API_HOST$' %>"
} }
</script> </script>
<div id="app"></div> <div id="app"></div>
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
*/ */
export let API_HOST; export let API_HOST;
if(process.env.NODE_ENV === 'development'){ if (process.env.NODE_ENV === 'development') {
//API_HOST = 'http://10.10.95.74:7777'; //API_HOST = 'http://10.10.95.74:7777';
//API_HOST = 'http://localhost:3002'; //API_HOST = 'http://localhost:3002';
API_HOST = 'http://beacon.duibadev.com.cn' API_HOST = window.__data.apiHost;
}else{ } else {
API_HOST = 'http://beacon.duibadev.com.cn' API_HOST = window.__data.apiHost;
} }
export const UPLOAD_FILE_URL = API_HOST + '/api/uploadFile'; export const UPLOAD_FILE_URL = API_HOST + '/api/uploadFile';
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
"Save": "Save", "Save": "Save",
"Copy": "Copy", "Copy": "Copy",
"Exit": "Exit", "Exit": "Exit",
"Props": "Props",
"Behavior": "Behavior",
"Add": "Add", "Add": "Add",
"Delete": "Delete", "Delete": "Delete",
"Import": "Import", "Import": "Import",
...@@ -20,6 +22,8 @@ ...@@ -20,6 +22,8 @@
"Code": "Code", "Code": "Code",
"Desc": "Desc", "Desc": "Desc",
"Empty": "Empty", "Empty": "Empty",
"Key": "Key",
"Default": "Default",
"Event": "Event", "Event": "Event",
"No desc": "No desc", "No desc": "No desc",
"Description": "Description", "Description": "Description",
...@@ -61,7 +65,6 @@ ...@@ -61,7 +65,6 @@
"Scale Mode": "Scale Mode", "Scale Mode": "Scale Mode",
"Renderer Type": "Renderer Type", "Renderer Type": "Renderer Type",
"Props Editor": "Props Editor", "Props Editor": "Props Editor",
"Edit Behavior": "Edit Behavior",
"Trigger once": "Trigger once", "Trigger once": "Trigger once",
"Meta Editor": "Meta Editor", "Meta Editor": "Meta Editor",
"As inline": "As inline", "As inline": "As inline",
...@@ -131,5 +134,25 @@ ...@@ -131,5 +134,25 @@
"static": "Static", "static": "Static",
"arguments": "Arguments", "arguments": "Arguments",
"data-center": "DataCenter" "data-center": "DataCenter"
},
"prosTypes": {
"boolean": "Boolean",
"string": "String",
"number": "Number",
"enum": "Enum",
"color": "Color",
"asset": "Asset",
"node": "Node",
"data": "Data"
},
"events": {
"init": "Init",
"awake": "Awake",
"sleep": "Sleep",
"data-center": "DataCenter",
"click": "Click",
"touchstart": "Touchstart",
"touchend": "Touchend",
"touchmove": "Touchmove"
} }
} }
\ No newline at end of file
{ {
"Alert": "提示", "Alert": "提示",
"Confirm": "确定", "Confirm": "确认",
"Cancel": "取消", "Cancel": "取消",
"In processing": "处理中…", "Close": "关闭",
"Projects": "项目列表", "Still Close": "仍然关闭",
"copy": "副本", "Save": "保存",
"No projects": "没有项目", "Copy": "复制",
"Exit": "退出",
"Props": "属性",
"Behavior": "行为",
"Add": "添加",
"Delete": "删除",
"Import": "导入",
"Export": "导出",
"Upload": "上传",
"Edit": "编辑",
"ID": "ID",
"Name": "名字",
"Alias": "别名",
"Output": "输出",
"Code": "代码",
"Desc": "描述",
"Empty": "空",
"Key": "属性名",
"Default": "默认值",
"Event": "事件",
"No desc": "无描述",
"Description": "描述",
"Failed to fetch": "网络错误!",
"In processing": "处理中……",
"Projects": "项目",
"copy": "复制",
"No projects": "无项目",
"Create": "创建", "Create": "创建",
"Project name": "项目名称", "Project details": "项目详情",
"Project does not exist": "项目不存在",
"Project name": "项目名",
"Data mapping": "数据映射",
"Behavior Editor": "行为编辑器",
"Template": "模板", "Template": "模板",
"Preparing": "准备中…", "Preparing": "准备中…",
"Deleting": "删除中…",
"Saving": "保存中…",
"Divider": "分流节点",
"Custom": "自定义节点",
"Entry": "入口",
"Packing": "打包",
"Type": "类型",
"Group": "分组",
"Access denied": "无权限",
"Invalid router": "无效的页面",
"Jump after": "{cd}秒后跳转",
"Open in new tab": "新标签打开",
"Pack project successfully": "项目打包成功",
"Pack project failed": "项目打包失败",
"Create project": "创建项目", "Create project": "创建项目",
"Rename project": "重命名项目",
"Entry scene view": "入口场景视图",
"Page title": "页面标题",
"Container ID": "容器ID",
"Design width": "设计宽度",
"Design height": "设计高度",
"Frame Rate": "帧率",
"Scale Mode": "缩放模式",
"Renderer Type": "渲染模式",
"Props Editor": "属性编辑器",
"Trigger once": "触发一次",
"Meta Editor": "过程元配置",
"As inline": "作为内联",
"Link to parent": "连接到父节点",
"Input project name": "输入项目名",
"Invalid project name": "无效的项目名",
"Creating project": "项目创建中…", "Creating project": "项目创建中…",
"Create project success": "创建项目成功", "Create project success": "项目创建成功",
"Duplicate project": "复制项目", "Duplicate project": "复制项目",
"Duplicating project": "项目复制中…", "Duplicating project": "项目复制中…",
"Duplicate project success": "复制项目成功", "Duplicate project success": "项目复制成功",
"Project name cannot be empty": "项目名不能为空", "Project name cannot be empty": "项目名不能为空",
"This action will permanently delete project": "即将永久删除项目[{projectName}], 是否继续?", "This action will permanently delete project": "您将删除项目[{projectName}], 是否继续?",
"Failed to fetch env": "环境获取失败", "Fetching projects": "获取项目列表…",
"Failed to fetch projects": "项目列表获取失败", "Failed to fetch env": "获取环境失败",
"Failed to fetch projects": "获取项目列表失败",
"Failed to fetch project": "获取项目失败",
"Failed to create project": "创建项目失败", "Failed to create project": "创建项目失败",
"Failed to duplicate project": "复制项目失败", "Failed to duplicate project": "复制项目失败",
"Failed to delete project": "删除项目失败", "Failed to delete project": "删除项目失败",
"Failed to get project": "获取项目失败", "Failed to get project": "获取项目失败",
"Failed to save project": "保存项目失败", "Failed to save project": "保存项目失败",
"Save project successfully": "保存项目成功",
"Input view name": "输入视图名",
"Invalid view name": "无效的视图名",
"Unsaved version found locally": "本地发现了未保存保本,请选择版本打开",
"Local Version": "本地版本",
"Remote Version": "远程版本",
"Confirm to exit the editor": "确定退出编辑器吗?",
"Confirm to publish": "确定发布吗?",
"Are you sure to delete this asset": "确定删除素材吗",
"Are you sure to delete this link": "确定删除映射吗",
"Rename asset": "重命名素材",
"Input asset name": "输入素材名",
"Invalid asset name": "无效的素材名",
"Copied field to clipboard": "已复制 {field} 到剪切板",
"Unsaved Alert": "项目还未保存,是否保存?",
"Meta is in use, can not delete": "过程元正在使用中,不能删除!",
"Are you sure to delete this meta": "确定删除这个过程元吗?",
"This Meta ID is in use, can not save": "这个ID正在被使用,不能保存!",
"Custom node desc": "自定义节点",
"Divider node desc": "分流节点,出口会按顺序一次执行",
"Save this behavior before": "是否先保存这个行为?",
"menu": { "menu": {
"save": "保存", "save": "保存",
"details": "详情", "details": "详情",
"preview": "预览", "preview": "预览",
"publish": "发布", "pack": "发布",
"data-mapping": "数据映射", "data-mapping": "数据映射",
"exit": "退出" "exit": "退出",
"undo": "撤销",
"redo": "重做"
},
"view_node_menu": {
"node": "节点",
"image": "图片",
"label": "标签",
"rect": "矩形"
}, },
"panes": { "panes": {
"Assets": "素材", "Assets": "素材",
"Inspector": "属性", "Inspector": "属性",
"Playground": "编辑", "Playground": "画布",
"Views": "视图" "Views": "视图"
},
"dataTypes": {
"static": "静态",
"arguments": "入参",
"data-center": "数据中心"
},
"prosTypes": {
"boolean": "布尔",
"string": "字符串",
"number": "数字",
"enum": "枚举",
"color": "颜色",
"asset": "素材",
"node": "节点",
"data": "数据"
},
"events": {
"init": "初始化",
"awake": "激活",
"sleep": "入眠",
"data-center": "数据中心",
"click": "触摸点击",
"touchstart": "触摸按下",
"touchend": "触摸弹起",
"touchmove": "触摸移动"
} }
} }
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import Vue from "vue"; import Vue from "vue";
import i18n from "../../i18n"; import i18n from "../../i18n";
import generateUUID from "uuid/v4"; import generateUUID from "uuid/v4";
import {metaInUse, updateProcesses} from "../../utils"; import {clonePureObj, metaInUse, updateProcesses} from "../../utils";
export const behaviorStore = { export const behaviorStore = {
state: { state: {
...@@ -32,8 +32,8 @@ export const behaviorStore = { ...@@ -32,8 +32,8 @@ export const behaviorStore = {
behavior_startEdit(state, {originData, behaviors, event}) { behavior_startEdit(state, {originData, behaviors, event}) {
state.originData = originData; state.originData = originData;
state.originBehaviors = behaviors; state.originBehaviors = behaviors;
state.behaviors = JSON.parse(JSON.stringify(behaviors)); state.behaviors = clonePureObj(behaviors);
state.data = JSON.parse(JSON.stringify(originData)); state.data = clonePureObj(originData);
if (state.behaviors.length > 0) { if (state.behaviors.length > 0) {
state.currentBehavior = state.behaviors[0]; state.currentBehavior = state.behaviors[0];
...@@ -153,7 +153,7 @@ export const behaviorStore = { ...@@ -153,7 +153,7 @@ export const behaviorStore = {
} }
}, },
actions: { actions: {
addCustomProcessMeta({commit, state}, {process, isInline, processId}) { addCustomProcessMeta({commit, state}, {masterProcess, isInline, processId}) {
let meta = { let meta = {
id: generateUUID(), id: generateUUID(),
script: '', script: '',
...@@ -171,19 +171,33 @@ export const behaviorStore = { ...@@ -171,19 +171,33 @@ export const behaviorStore = {
meta.isDivider = true; meta.isDivider = true;
break; break;
} }
if (isInline) {
if (!process.meta.metas) { addProcessMeta(commit, isInline, masterProcess, meta);
Vue.set(process.meta, 'metas', []);
}
process.meta.metas.push(meta);
} else {
commit('addProcessMeta', meta);
}
return meta; return meta;
}, },
addProcessFromPrefab({commit, state}, {masterProcess, isInline, meta: pMeta}){
let meta = clonePureObj(pMeta);
meta.id = generateUUID();
meta.isInline = isInline;
delete meta.type;
addProcessMeta(commit, isInline, masterProcess, meta);
return meta;
}
} }
}; };
function updatePropsEditable(state) { function updatePropsEditable(state) {
state.editable = state.processStack.filter(item => item.meta.type === 'builtin') <= 0; state.editable = state.processStack.filter(item => item.meta.type === 'builtin') <= 0;
} }
function addProcessMeta(commit, isInline, masterProcess, meta){
if (isInline) {
if (!masterProcess.meta.metas) {
Vue.set(masterProcess.meta, 'metas', []);
}
masterProcess.meta.metas.push(meta);
} else {
commit('addProcessMeta', meta);
}
}
...@@ -7,7 +7,7 @@ import { projectApi } from "../../api"; ...@@ -7,7 +7,7 @@ import { projectApi } from "../../api";
import path from "path"; import path from "path";
import generateUUID from "uuid/v4"; import generateUUID from "uuid/v4";
import { getCmpProps, flattenViews, getCmpByUUID } from '../../utils/common'; import { getCmpProps, flattenViews, getCmpByUUID } from '../../utils/common';
import { saveAs } from "../../utils"; import {clonePureObj, saveAs} from "../../utils";
import { template } from "../../template"; import { template } from "../../template";
const defaultOptions = { const defaultOptions = {
...@@ -25,7 +25,7 @@ const defaultOptions = { ...@@ -25,7 +25,7 @@ const defaultOptions = {
const OPERATE_MAX_LENGTH = 200; // 撤销重做栈最大值 const OPERATE_MAX_LENGTH = 200; // 撤销重做栈最大值
function getDefaultOptions() { function getDefaultOptions() {
return JSON.parse(JSON.stringify(defaultOptions)); return clonePureObj(defaultOptions);
} }
export const projectStore = { export const projectStore = {
......
...@@ -47,3 +47,12 @@ ...@@ -47,3 +47,12 @@
padding: 5px 0 5px 5px; padding: 5px 0 5px 5px;
} }
.el-input-number.is-controls-right .el-input__inner {
padding-left: 5px;
padding-right: 40px;
}
.el-input-number--mini .el-input-number__increase, .el-input-number--mini .el-input-number__decrease {
width: 16px;
}
export default ['init', 'awake', 'sleep', 'datacenter', 'click', 'touchstart', 'touchend', 'touchmove']
\ No newline at end of file
...@@ -103,3 +103,7 @@ export function metaInUse(process, targetMetaID) { ...@@ -103,3 +103,7 @@ export function metaInUse(process, targetMetaID) {
} }
return result; return result;
} }
export function clonePureObj(obj){
return JSON.parse(JSON.stringify(obj));
}
...@@ -170,15 +170,15 @@ ...@@ -170,15 +170,15 @@
duration: 1000, duration: 1000,
}); });
this.$confirm(this.$t('Pack project successfully'), this.$t('Alert'), { this.$confirm(this.$t('Pack project successfully'), this.$t('Alert'), {
confirmButtonText: this.$t('Close'), confirmButtonText: this.$t('Open in new tab'),
cancelButtonText: this.$t('Open in new tab'), cancelButtonText: this.$t('Close'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
}).catch(() => {
setTimeout(()=>{ setTimeout(()=>{
window.open(tplUrl, 'blank'); window.open(tplUrl, 'blank');
}, 500); }, 500);
}).catch(() => {
}); });
}catch (e) { }catch (e) {
this.$message({ this.$message({
......
<template> <template>
<pane icon="el-icon-s-operation" :title="$t('panes.Inspector')"> <pane icon="el-icon-s-operation" :title="$t('panes.Inspector')">
<el-tabs v-model="tab" type="border-card" class="inspector-tabs"> <el-tabs v-model="tab" type="border-card" class="inspector-tabs">
<el-tab-pane label="Props" name="properties"> <el-tab-pane :label="$t('Props')" name="properties">
<props-tab/> <props-tab/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="Behavior" name="behavior"> <el-tab-pane :label="$t('Behavior')" name="behavior">
<behavior-tab/> <behavior-tab/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
......
...@@ -4,13 +4,12 @@ ...@@ -4,13 +4,12 @@
<el-form ref="form" size="mini" label-width="60px"> <el-form ref="form" size="mini" label-width="60px">
<div v-for="(evn, key) in eventsObj" :key="key"> <div v-for="(evn, key) in eventsObj" :key="key">
<el-form-item :label="$t('Event') + ':'"> <el-form-item :label="$t('Event') + ':'">
<div>{{key}}</div> <div>{{events[key]}}</div>
<div > <div >
<el-tooltip :content="$t('Trigger once')" placement="top"> <!--<el-tooltip :content="$t('Trigger once')" placement="top">
<el-switch v-model="evn.once" @change="v => handleOnceChange(key, v)"></el-switch> <el-switch v-model="evn.once" @change="v => handleOnceChange(key, v)"></el-switch>
</el-tooltip> </el-tooltip>-->
<el-button size="mini" @click="showBehaviorEditor(evn, key)" style="margin-left: 20px;"> <el-button size="mini" @click="showBehaviorEditor(evn, key)" style="margin-left: 20px;" icon="el-icon-edit">
{{$t('Edit Behavior')}}
<i v-if="evn.behaviors && evn.behaviors.length" class="el-icon-check el-icon--right"></i> <i v-if="evn.behaviors && evn.behaviors.length" class="el-icon-check el-icon--right"></i>
</el-button> </el-button>
<el-button icon="el-icon-delete" size="mini" v-if="evn.behaviors && evn.behaviors.length" @click="deleteBehavior(key)"> <el-button icon="el-icon-delete" size="mini" v-if="evn.behaviors && evn.behaviors.length" @click="deleteBehavior(key)">
...@@ -27,20 +26,21 @@ ...@@ -27,20 +26,21 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import _ from 'lodash'; import _ from 'lodash';
import events from '../../../utils/events';
import BehaviorEditorDialog from '../dialogs/BehaviorEditorDialog'; import BehaviorEditorDialog from '../dialogs/BehaviorEditorDialog';
export default { export default {
name: 'BehaviorTab', name: 'BehaviorTab',
data() { data() {
let eventsObj = {}; let eventsObj = {};
events.forEach(event => { const events = this.$t('events');
Object.keys(events).forEach(event => {
eventsObj[event] = { eventsObj[event] = {
once: false, once: false,
behaviors: [] behaviors: []
}; };
}); });
return { return {
events,
eventsObj, eventsObj,
behaviors: [], behaviors: [],
currentEvent: '' currentEvent: ''
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
<div class="center full-size background" splitpanes-min="20" :splitpanes-size="70"> <div class="center full-size background" splitpanes-min="20" :splitpanes-size="70">
<edit-path :processStack="processStack" @pop="onPop"/> <edit-path :processStack="processStack" @pop="onPop"/>
<div class="operate-bar"> <div class="operate-bar">
<el-button-group> <!--<el-button-group>
<el-button size="mini" icon="el-icon-zoom-out" @click="setScale(-0.1)"/> <el-button size="mini" icon="el-icon-zoom-out" @click="setScale(-0.1)"/>
<el-button size="mini" @click="setScale(0)">1:1</el-button> <el-button size="mini" @click="setScale(0)">1:1</el-button>
<el-button size="mini" icon="el-icon-zoom-in" @click="setScale(0.1)"/> <el-button size="mini" icon="el-icon-zoom-in" @click="setScale(0.1)"/>
</el-button-group> </el-button-group>-->
</div> </div>
<board ref="board" @select-process-node="onSelectProcessNode" @edit-process="editProcess" @edit-meta="onEditMeta"/> <board ref="board" @select-process-node="onSelectProcessNode" @edit-process="editProcess" @edit-meta="onEditMeta"/>
</div> </div>
......
...@@ -82,14 +82,16 @@ ...@@ -82,14 +82,16 @@
methods: { methods: {
...mapActions([ ...mapActions([
'addCustomProcessMeta', 'addCustomProcessMeta',
'addDividerProcessMeta', 'addProcessFromPrefab',
]), ]),
...mapMutations([ ...mapMutations([
'deleteProcessMeta', 'deleteProcessMeta',
'setScale',
]), ]),
async edit(process, resolveProcess) { async edit(process, resolveProcess) {
this.boardOffset.x = 0; this.boardOffset.x = 0;
this.boardOffset.y = 0; this.boardOffset.y = 0;
this.setScale(0);
this.selectedProcessNode = null; this.selectedProcessNode = null;
this.process = process; this.process = process;
this.resolveProcess = resolveProcess; this.resolveProcess = resolveProcess;
...@@ -114,7 +116,7 @@ ...@@ -114,7 +116,7 @@
this.$set(this.subProcessMap, uuid, process); this.$set(this.subProcessMap, uuid, process);
}, },
async addSubProcessData(processId, pos) { async addSubProcessData(processId, pos) {
let process, processMeta, isInline; let meta, isInline;
if (customs.includes(processId)) { if (customs.includes(processId)) {
try { try {
...@@ -124,15 +126,24 @@ ...@@ -124,15 +126,24 @@
return; return;
} }
processMeta = await this.addCustomProcessMeta({process: this.process, isInline, processId}); meta = await this.addCustomProcessMeta({masterProcess: this.process, isInline, processId});
processId = processMeta.id; }else{
meta = this.process.resolveMeta(processId);
} }
process = this.process.resolveMeta(processId); if(meta.isPrefab){
try {
const result = await this.$refs.inlineChooseDialog.show();
isInline = result.isInline;
} catch (e) {
return;
}
meta = await this.addProcessFromPrefab({masterProcess: this.process, isInline, meta})
}
let data = { let data = {
uuid: generateUUID(), uuid: generateUUID(),
meta: process.id, meta: meta.id,
design: { design: {
x: pos.x, x: pos.x,
y: pos.y, y: pos.y,
...@@ -232,8 +243,8 @@ ...@@ -232,8 +243,8 @@
}, },
onMouseMove(e) { onMouseMove(e) {
const scale = this.scale; const scale = this.scale;
let x = e.x - this.drawState.boardOffset.x; let x = e.x - this.drawState.boardOffset.x - this.boardOffset.x;
let y = e.y - this.drawState.boardOffset.y; let y = e.y - this.drawState.boardOffset.y - this.boardOffset.y;
this.lineDrawing.path = this.drawingLineStart + `${x / scale},${y / scale} ${x / scale},${y / scale}`; this.lineDrawing.path = this.drawingLineStart + `${x / scale},${y / scale} ${x / scale},${y / scale}`;
}, },
onMouseUp(e) { onMouseUp(e) {
...@@ -279,7 +290,7 @@ ...@@ -279,7 +290,7 @@
this.$emit('edit-meta', meta); this.$emit('edit-meta', meta);
}, },
editSubProcess(process) { editSubProcess(process) {
if (!process.meta.isDivider && (this.editable || process.meta.type !== 'builtin' || process.meta.sub && Object.keys(process.meta.sub).length > 0)) { if (!process.meta.isDivider && this.editable && (process.meta.type !== 'builtin' || process.meta.sub && Object.keys(process.meta.sub).length > 0)) {
this.$emit('edit-process', process); this.$emit('edit-process', process);
} }
}, },
...@@ -363,6 +374,8 @@ ...@@ -363,6 +374,8 @@
return; return;
} }
this.onResize();
this.boardDragDownPos = null; this.boardDragDownPos = null;
}, },
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
@mouseleave="onMouseLeave" @click="onClick" @dblclick="onDblclick"> @mouseleave="onMouseLeave" @click="onClick" @dblclick="onDblclick">
<div class="top-bar" v-if="meta.id !== 'entry' && editable"> <div class="top-bar" v-if="meta.id !== 'entry' && editable">
<el-link icon="el-icon-delete" :underline="false" @mousedown.stop.prevent @click.stop="onClickDelete"/> <el-link icon="el-icon-delete" :underline="false" @mousedown.stop.prevent @click.stop="onClickDelete"/>
<el-link icon="el-icon-edit" :underline="false" v-if="meta.type !== 'builtin'" @mousedown.stop.prevent @click.stop="onClickEdit"/> <el-link icon="el-icon-edit" :underline="false" v-if="meta.type !== 'builtin' && !meta.isDivider" @mousedown.stop.prevent @click.stop="onClickEdit"/>
</div> </div>
<div class="header"> <div class="header">
<i v-if="meta.isInline">i</i> <i v-if="meta.isInline">i</i>
......
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
<div class="meta-editor-wrapper"> <div class="meta-editor-wrapper">
<el-form ref="form" v-if="meta" :model="meta" :rules="rules" :show-message="false" class="info-editor" size="mini" label-position="right" label-width="70px" @submit.native.prevent> <el-form ref="form" v-if="meta" :model="meta" :rules="rules" :show-message="false" class="info-editor" size="mini" label-position="right" label-width="70px" @submit.native.prevent>
<template> <template>
<el-form-item prop="id" label="ID"> <el-form-item prop="id" :label="$t('ID')">
<el-input v-model="meta.id" :placeholder="$t('ID')" :readonly="!editable"/> <el-input v-model="meta.id" :placeholder="$t('ID')" :readonly="!editable"/>
</el-form-item> </el-form-item>
<el-form-item prop="name" label="Name"> <el-form-item prop="name" :label="$t('Name')">
<el-input v-model="meta.name" :placeholder="$t('Name')" :readonly="!editable"/> <el-input v-model="meta.name" :placeholder="$t('Name')" :readonly="!editable"/>
</el-form-item> </el-form-item>
<el-form-item prop="desc" label="Desc"> <el-form-item prop="desc" :label="$t('Desc')">
<el-input v-model="meta.desc" :placeholder="$t('Description')" :readonly="!editable"/> <el-input v-model="meta.desc" :placeholder="$t('Description')" :readonly="!editable"/>
</el-form-item> </el-form-item>
<!--<el-form-item prop="type" label="Type"> <!--<el-form-item prop="type" label="Type">
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<el-form-item prop="group" label="Group"> <el-form-item prop="group" label="Group">
<el-input v-model="meta.group" :placeholder="$t('Group')" :readonly="!editable"/> <el-input v-model="meta.group" :placeholder="$t('Group')" :readonly="!editable"/>
</el-form-item>--> </el-form-item>-->
<el-form-item label="Props"> <el-form-item :label="$t('Props')">
<el-link :underline="false" @click="onClickEditProps" :disabled="!editable"> <el-link :underline="false" @click="onClickEditProps" :disabled="!editable">
<template v-if="Object.keys(meta.props).length"> <template v-if="Object.keys(meta.props).length">
<el-tag type="success" size="mini" v-for="(option, key) in meta.props" :key="key">{{key}}</el-tag> <el-tag type="success" size="mini" v-for="(option, key) in meta.props" :key="key">{{key}}</el-tag>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<template v-else>{{$t('Empty')}}</template> <template v-else>{{$t('Empty')}}</template>
</el-link> </el-link>
</el-form-item> </el-form-item>
<el-form-item label="Output"> <el-form-item :label="$t('Output')">
<div style="display: flex;flex: 1;"> <div style="display: flex;flex: 1;">
<el-select style="flex: 1;" v-model="meta.output" :disabled="!editable" allow-create filterable multiple <el-select style="flex: 1;" v-model="meta.output" :disabled="!editable" allow-create filterable multiple
:placeholder="$t('Output')"/> :placeholder="$t('Output')"/>
...@@ -48,8 +48,8 @@ ...@@ -48,8 +48,8 @@
<el-button size="mini" slot="reference" plain @click="pasteMeta">PasteMeta</el-button> <el-button size="mini" slot="reference" plain @click="pasteMeta">PasteMeta</el-button>
</el-popover> </el-popover>
</el-button-group> </el-button-group>
<el-button size="mini" plain @click="cancel">Cancel</el-button> <el-button size="mini" plain @click="cancel">{{$t('Cancel')}}</el-button>
<el-button size="mini" plain @click="save">Save</el-button> <el-button size="mini" plain @click="save">{{$t('Save')}}</el-button>
</div> </div>
</div> </div>
<props-editor-dialog ref="propsEditorDialog"/> <props-editor-dialog ref="propsEditorDialog"/>
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
import ElFormItem from "./inputs/form-item"; import ElFormItem from "./inputs/form-item";
import PropsEditorDialog from "./PropsEditorDialog"; import PropsEditorDialog from "./PropsEditorDialog";
import copy from 'copy-to-clipboard' import copy from 'copy-to-clipboard'
import {clonePureObj} from "../../../utils";
export default { export default {
name: "MetaEditorDialog", name: "MetaEditorDialog",
...@@ -91,7 +92,7 @@ ...@@ -91,7 +92,7 @@
methods: { methods: {
edit(meta) { edit(meta) {
this.visible = true; this.visible = true;
this.meta = JSON.parse(JSON.stringify(meta)); this.meta = clonePureObj(meta);
this.oldMetaID = this.meta.id; this.oldMetaID = this.meta.id;
}, },
onClickEditProps() { onClickEditProps() {
......
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
:data="props" :data="props"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
label="Type" :label="$t('Type')"
width="100"> width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.option.type" size="mini"> <el-select v-model="scope.row.option.type" size="mini">
<el-option v-for="type in types" <el-option v-for="(str, type) in types"
:key="type" :key="type"
:label="type" :label="str"
:value="type" :value="type"
> >
</el-option> </el-option>
...@@ -25,21 +25,21 @@ ...@@ -25,21 +25,21 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="Key" :label="$t('Key')"
width="120"> width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.key" size="mini"/> <el-input v-model="scope.row.key" size="mini"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="Alias" :label="$t('Alias')"
width="100"> width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.option.alias" size="mini"/> <el-input v-model="scope.row.option.alias" size="mini"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="Default"> :label="$t('Default')">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-if="scope.row.option.type === 'string' || scope.row.option.type === 'enum'" class="default-value" v-model="scope.row.option.default" size="mini" placeholder="Default"/> <el-input v-if="scope.row.option.type === 'string' || scope.row.option.type === 'enum'" class="default-value" v-model="scope.row.option.default" size="mini" placeholder="Default"/>
<el-input-number v-if="scope.row.option.type === 'number'" controls-position="right" class="default-value" v-model="scope.row.option.default" size="mini" placeholder="Default"/> <el-input-number v-if="scope.row.option.type === 'number'" controls-position="right" class="default-value" v-model="scope.row.option.default" size="mini" placeholder="Default"/>
...@@ -72,14 +72,16 @@ ...@@ -72,14 +72,16 @@
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<div class="button-bar"> <div class="button-bar">
<el-button size="mini" plain @click="cancel">Cancel</el-button> <el-button size="mini" plain @click="cancel">{{$t('Cancel')}}</el-button>
<el-button size="mini" plain @click="save">Save</el-button> <el-button size="mini" plain @click="save">{{$t('Save')}}</el-button>
</div> </div>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import {clonePureObj} from "../../../utils";
export default { export default {
name: "PropsEditorDialog", name: "PropsEditorDialog",
data() { data() {
...@@ -88,23 +90,14 @@ ...@@ -88,23 +90,14 @@
originProps: null, originProps: null,
copiedProps: null, copiedProps: null,
props: [], props: [],
types: [ types: this.$t('prosTypes'),
'boolean',
'string',
'number',
'enum',
'color',
'asset',
'node',
'data',
],
} }
}, },
methods: { methods: {
edit(props) { edit(props) {
this.visible = true; this.visible = true;
this.originProps = props; this.originProps = props;
this.copiedProps = JSON.parse(JSON.stringify(props)); this.copiedProps = clonePureObj(props);
this.props.splice(0); this.props.splice(0);
for (let key in this.copiedProps) { for (let key in this.copiedProps) {
let option = this.copiedProps[key]; let option = this.copiedProps[key];
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
:disabled="!editable" :disabled="!editable"
> >
<el-radio-group v-model="editValue.type" size="mini" @change="onChange" :disabled="!editable"> <el-radio-group v-model="editValue.type" size="mini" @change="onChange" :disabled="!editable">
<el-radio-button v-for="(item, key) in dataTypes" :label="key">{{item}}</el-radio-button> <el-radio-button v-for="(item, key) in dataTypes" :label="key" :key="key">{{item}}</el-radio-button>
</el-radio-group> </el-radio-group>
<el-input clearable slot="reference" :value="editValue.value" @input="onInput" @change="onChange" <el-input clearable slot="reference" :value="editValue.value" @input="onInput" @change="onChange"
:readonly="!editable" :readonly="!editable"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment