Commit ef0c2537 authored by rockyl's avatar rockyl

Merge branch 'dev' into dep-lock

parents d6843bc5 2803508e
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</noscript> </noscript>
<script> <script>
window.__data = { window.__data = {
token : "<%= process.env.NODE_ENV === 'development' ? 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MjA4NSwibmFtZSI6IuWKs-eQquWzsCIsImFjY291bnQiOiJsYW9xaWZlbmciLCJlbWFpbCI6Imxhb3FpZmVuZ0BkdWliYS5jb20uY24iLCJtb2JpbGUiOiIxMzQ1Njc3NDE1MyIsImRpbmdVc2VySWQiOiI1MDY5MDYyOTIxMjkxMDAxIiwibW9kZWxBdXRob3JpemUiOmZhbHNlLCJsb2dpblRpbWVvdXQiOjE0ODA5LCJnbXRDcmVhdGUiOjE1MzQ0MTIwMTUwMDAsImdtdE1vZGlmaWVkIjoxNTczODgyMDk2MDAwLCJzeXN0ZW1JZFNldCI6WzAsMSwzNCwyMjcsMzYsMzcsMjMxLDIwMywxOSwyMSwyNDYsMjMsMjUsMjQ5LDI3LDMwXSwiaWF0IjoxNTc1MzQwMzg2fQ.2JEYMRx6wbJsMIMh3quyM14OsoMz_iJRq4Az_xz-WTc' : '$TOKEN$' %>", token : "<%= process.env.NODE_ENV === 'development' ? 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MjA4NSwibmFtZSI6IuWKs-eQquWzsCIsImFjY291bnQiOiJsYW9xaWZlbmciLCJlbWFpbCI6Imxhb3FpZmVuZ0BkdWliYS5jb20uY24iLCJtb2JpbGUiOiIxMzQ1Njc3NDE1MyIsImRpbmdVc2VySWQiOiI1MDY5MDYyOTIxMjkxMDAxIiwibW9kZWxBdXRob3JpemUiOmZhbHNlLCJsb2dpblRpbWVvdXQiOjgzMzUzLCJnbXRDcmVhdGUiOjE1MzQ0MTIwMTUwMDAsImdtdE1vZGlmaWVkIjoxNTczODgyMDk2MDAwLCJzeXN0ZW1JZFNldCI6WzAsMSwzNCwyMjcsMzYsMzcsMjMxLDIwMyw0NCwxOSwyMSwyNDYsMjMsMjQ5LDI1LDI3LDMwXSwiaWF0IjoxNTc4Mjc3OTg5fQ.mm6T34NuMBwTKaLBbVOI5AqGQNC9rwfiAdIv8c4C4_I' : '$TOKEN$' %>",
apiHost : "<%= process.env.NODE_ENV === 'development' ? 'http://beacon.duibadev.com.cn' : '$API_HOST$' %>" apiHost : "<%= process.env.NODE_ENV === 'development' ? 'http://beacon.duibadev.com.cn' : '$API_HOST$' %>"
} }
</script> </script>
......
...@@ -88,12 +88,15 @@ ...@@ -88,12 +88,15 @@
}); });
await playWaiting(this.prepare(), this.$t('Preparing')).catch(e => { await playWaiting(this.prepare(), this.$t('Preparing')).catch(e => {
console.log(e);
}); });
setTimeout(() => { setTimeout(() => {
startCodeSyncServe(this.codeSyncServeConfig); //startCodeSyncServe(this.codeSyncServeConfig);
}, 100); }, 100);
this.loadProject(); this.loadProject().catch(e => {
console.log(e);
});
}, },
destroyed() { destroyed() {
document.removeEventListener('keydown', this.onKeyPress) document.removeEventListener('keydown', this.onKeyPress)
......
<template> <template>
<el-dialog :title="$t('Meta Editor')" width="80%" :visible.sync="visible" <el-dialog
:close-on-click-modal="false" :title="$t('Meta Editor')"
:close-on-press-escape="false" width="80%"
:show-close="false" :visible.sync="visible"
fullscreen :close-on-click-modal="false"
:append-to-body="true" :close-on-press-escape="false"
custom-class="flex-dialog behavior-editor-dialog" :show-close="false"
> fullscreen
<div class="meta-editor-wrapper"> :append-to-body="true"
<el-form ref="form" v-if="meta" :model="meta" :rules="rules" :show-message="false" class="info-editor" size="mini" custom-class="flex-dialog behavior-editor-dialog"
label-position="right" label-width="70px" @submit.native.prevent> >
<template> <div class="meta-editor-wrapper">
<el-form-item prop="id" :label="$t('ID')"> <el-form
<el-input v-model="meta.id" :placeholder="$t('ID')" :readonly="!editable"/> ref="form"
</el-form-item> v-if="meta"
<el-form-item prop="name" :label="$t('Name')"> :model="meta"
<el-input v-model="meta.name" :placeholder="$t('Name')" :readonly="!editable"/> :rules="rules"
</el-form-item> :show-message="false"
<el-form-item prop="desc" :label="$t('Desc')"> class="info-editor"
<el-input v-model="meta.desc" :placeholder="$t('Description')" :readonly="!editable"/> size="mini"
</el-form-item> label-position="right"
<!--<el-form-item prop="type" label="Type"> label-width="70px"
@submit.native.prevent
>
<template>
<el-form-item prop="id" :label="$t('ID')">
<el-input
v-model="meta.id"
:placeholder="$t('ID')"
:readonly="!editable"
/>
</el-form-item>
<el-form-item prop="name" :label="$t('Name')">
<el-input
v-model="meta.name"
:placeholder="$t('Name')"
:readonly="!editable"
/>
</el-form-item>
<el-form-item prop="desc" :label="$t('Desc')">
<el-input
v-model="meta.desc"
:placeholder="$t('Description')"
:readonly="!editable"
/>
</el-form-item>
<!--<el-form-item prop="type" label="Type">
<el-input v-model="meta.type" :placeholder="$t('Type')" :readonly="!editable"/> <el-input v-model="meta.type" :placeholder="$t('Type')" :readonly="!editable"/>
</el-form-item> </el-form-item>
<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="$t('Props')"> <el-form-item :label="$t('Props')">
<el-link :underline="false" @click="onClickEditProps" :disabled="!editable"> <el-link
<template v-if="Object.keys(meta.props).length"> :underline="false"
<el-tag type="success" size="mini" v-for="(option, key) in meta.props" :key="key">{{key}}</el-tag> @click="onClickEditProps"
</template> :disabled="!editable"
<template v-else>{{$t('Empty')}}</template> >
</el-link> <template v-if="Object.keys(meta.props).length">
</el-form-item> <el-tag
<el-form-item :label="$t('Output')"> type="success"
<div style="display: flex;flex: 1;"> size="mini"
<el-select style="flex: 1;" v-model="meta.output" :disabled="!editable" allow-create filterable multiple v-for="(option, key) in meta.props"
:placeholder="$t('Output')"/> :key="key"
</div> >{{ key }}</el-tag
</el-form-item> >
</template> </template>
</el-form> <template v-else>{{ $t("Empty") }}</template>
<div style="margin-top: 5px;"> </el-link>
<code-sync-indicator/> </el-form-item>
<el-tag v-for="(item, key) in exposeVariables" :key="key" size="mini">{{item}}</el-tag> <el-form-item :label="$t('Output')">
</div> <div style="display: flex;flex: 1;">
<!--<el-input v-if="meta" class="script-editor" :readonly=" !editable" type="textarea" :placeholder="$t('Code')" <el-select
v-model="meta.script"></el-input>--> style="flex: 1;"
<code-editor v-if="meta" v-model="meta.script"/> v-model="meta.output"
</div> :disabled="!editable"
<div slot="footer" class="dialog-footer"> allow-create
<div class="button-bar"> filterable
<el-button-group style="margin-right: 20px;"> multiple
<el-button size="mini" plain @click="copyMeta">CopyMeta</el-button> :placeholder="$t('Output')"
<el-popover> />
<div ref="pasteBoard" @paste="onPaste">Click and Ctrl+V</div> </div>
<el-button size="mini" slot="reference" plain @click="pasteMeta">PasteMeta</el-button> </el-form-item>
</el-popover> </template>
</el-button-group> </el-form>
<el-button size="mini" plain @click="cancel">{{$t('Cancel')}}</el-button> <div style="margin-top: 5px;">
<!--<el-button size="mini" plain @click="save(true)">{{$t('Save And Preview')}}</el-button>--> <code-sync-indicator />
<el-button size="mini" type="primary" plain @click="save(false)">{{$t('Save')}}</el-button> <el-tag v-for="(item, key) in exposeVariables" :key="key" size="mini">{{
</div> item
</div> }}</el-tag>
<props-editor-dialog ref="propsEditorDialog"/> </div>
</el-dialog> <!--<el-input v-if="meta" class="script-editor" :readonly=" !editable" type="textarea" :placeholder="$t('Code')"
v-model="meta.script"></el-input>-->
<!-- <codemirror
ref="codeEditor"
v-if="meta"
v-model="meta.script"
:options="cmOptions"
@cursorActivity="onCodeChange"
/>-->
<!--<monaco-editor
ref="codeEditor"
v-if="meta"
:code="meta.script"
:options="monacoConfig"
/>-->
<code-editor v-if="meta" v-model="meta.script"/>
</div>
<div slot="footer" class="dialog-footer">
<div class="button-bar">
<el-button-group style="margin-right: 20px;">
<el-button size="mini" plain @click="copyMeta">CopyMeta</el-button>
<el-popover>
<div ref="pasteBoard" @paste="onPaste">Click and Ctrl+V</div>
<el-button size="mini" slot="reference" plain @click="pasteMeta"
>PasteMeta</el-button
>
</el-popover>
</el-button-group>
<el-button size="mini" plain @click="cancel">{{
$t("Cancel")
}}</el-button>
<!--<el-button size="mini" plain @click="save(true)">{{$t('Save And Preview')}}</el-button>-->
<el-button size="mini" type="primary" plain @click="save(false)">{{
$t("Save")
}}</el-button>
</div>
</div>
<props-editor-dialog ref="propsEditorDialog" />
</el-dialog>
</template> </template>
<script> <script>
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 MonacoEditor from "../components/MonacoEditor";
import {clonePureObj} from "../../../utils"; import copy from "copy-to-clipboard";
import events from '../../../global-events'; import { clonePureObj } from "../../../utils";
import CodeSyncIndicator from "../BottomBar/CodeSyncIndicator"; import events from "../../../global-events";
import CodeEditor from "./CodeEditor"; import CodeSyncIndicator from "../BottomBar/CodeSyncIndicator";
import CodeEditor from "./CodeEditor";
const exposeVariables = ['args', 'props', 'target', 'global', 'vm', 'engine']; const exposeVariables = ["args", "props", "target", "global", "vm", "engine"];
export default { export default {
name: "MetaEditorDialog", name: "MetaEditorDialog",
components: {CodeEditor, CodeSyncIndicator, PropsEditorDialog, ElFormItem}, components: {
data() { CodeEditor,
return { CodeSyncIndicator,
visible: false, PropsEditorDialog,
meta: null, ElFormItem,
propsEditorVisible: false, //"monaco-editor": MonacoEditor
exposeVariables, },
data() {
return {
visible: false,
meta: null,
propsEditorVisible: false,
exposeVariables,
rules: { rules: {
id: [ id: [{ required: true, trigger: "blur" }],
{required: true, trigger: 'blur'}, name: [{ required: true, trigger: "blur" }]
], },
name: [ cmOptions: {
{required: true, trigger: 'blur'} tabSize: 2,
], styleActiveLine: true,
}, theme: "default",
} line: true,
}, matchBrackets: true,
mounted() { autoCloseBrackets: true,
events.$on('edit-save', this.onEditSave); extraKeys: {
}, "Alt-Space": "autocomplete"
destroyed(){ },
events.$off('edit-save', this.onEditSave);
},
computed: {
editable() {
return this.meta;// && this.meta.type !== 'builtin';
},
props() {
return Object.keys(this.meta.props).join(',')
},
},
methods: {
edit(meta) {
this.visible = true;
this.meta = clonePureObj(meta);
this.oldMetaID = this.meta.id;
events.$emit('edit-open', this.meta); lineNumbers: true,
}, mode: { name: "javascript", globalVars: true },
onEditSave(code){ gutters: ["CodeMirror-lint-markers"],
this.$set(this.meta, 'script', code); lint: true
}, },
onClickEditProps() { monacoConfig: {
this.$refs.propsEditorDialog.edit(this.meta.props); language: "javascript"
}, }
save(isPreview) { };
this.$refs.form.validate((valid) => { },
if (valid) { mounted() {
if (this.oldMetaID !== this.meta.id && this.$store.getters.metaIDExists(this.meta.id)) { events.$on("edit-save", this.onEditSave);
this.$alert(this.$t('This Meta ID is in use, can not save'), this.$t('Alert')) },
.catch((e) => { destroyed() {
}); events.$off("edit-save", this.onEditSave);
} else { },
this.$emit('input', this.meta, isPreview); computed: {
this.visible = false; editable() {
} return this.meta; // && this.meta.type !== 'builtin';
} else { },
return false; props() {
} return Object.keys(this.meta.props).join(",");
}); }
}, },
cancel() { methods: {
this.visible = false; edit(meta) {
}, this.visible = true;
copyMeta() { this.meta = clonePureObj(meta);
copy(JSON.stringify(this.meta)); this.oldMetaID = this.meta.id;
},
pasteMeta() {
//setTimeout(this.focusPasteBoard, 1000, this);
},
onPaste(e) {
let metaStr = e.clipboardData.getData("Text");
if (metaStr) {
try {
let meta = JSON.parse(metaStr);
this.meta = meta;
} catch (e) {
} events.$emit("edit-open", this.meta.script);
} },
}, onEditSave(code) {
focusPasteBoard() { this.$set(this.meta, "script", code);
this.$refs.pasteBoard.focus(); },
}, onClickEditProps() {
} this.$refs.propsEditorDialog.edit(this.meta.props);
} },
save(isPreview) {
this.$refs.form.validate(valid => {
if (valid) {
if (
this.oldMetaID !== this.meta.id &&
this.$store.getters.metaIDExists(this.meta.id)
) {
this.$alert(
this.$t("This Meta ID is in use, can not save"),
this.$t("Alert")
).catch(e => {});
} else {
this.meta.script = this.$refs.codeEditor.editor.getValue();
this.$emit("input", this.meta, isPreview);
this.visible = false;
}
} else {
return false;
}
});
},
cancel() {
this.visible = false;
},
copyMeta() {
copy(JSON.stringify(this.meta));
},
pasteMeta() {
//setTimeout(this.focusPasteBoard, 1000, this);
},
onPaste(e) {
let metaStr = e.clipboardData.getData("Text");
if (metaStr) {
try {
let meta = JSON.parse(metaStr);
this.meta = meta;
} catch (e) {}
}
},
focusPasteBoard() {
this.$refs.pasteBoard.focus();
},
onCodeChange(codemirror) {
//codemirror.showHint();
//console.log(code);
}
}
};
</script> </script>
<style scoped> <style scoped></style>
</style>
\ No newline at end of file
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<div> <div>
<el-scrollbar class="tree-scrollbar" wrap-class="wrap-x-hidden"> <el-scrollbar class="tree-scrollbar" wrap-class="wrap-x-hidden">
<el-tree <el-tree
v-if="popoverVisible"
:data="behavior_views" :data="behavior_views"
:props="defaultProps" :props="defaultProps"
:expand-on-click-node="false" :expand-on-click-node="false"
......
<template>
<div id="container"></div>
</template>
<script>
import * as monaco from "monaco-editor";
export default {
name: "MonacoEditor",
props: {
options: Object,
code: String
},
async mounted() {
const { options, code } = this;
const res = await fetch(
"http://yun.duiba.com.cn/editor/zeroing/types/types.d.ts"
);
const types = await res.text();
const defaultConfig = {
language: "javascript",
value: "",
minimap: {
enabled: false
}
};
// compiler options
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
target: monaco.languages.typescript.ScriptTarget.ES6,
allowNonTsExtensions: true,
allowJs: true
});
// extra libraries
monaco.languages.typescript.javascriptDefaults.addExtraLib(
[types].join("\n")
);
const config = Object.assign({}, defaultConfig, options, { value: code });
this.editor = monaco.editor.create(
document.getElementById("container"),
config
);
}
};
</script>
<style lang="scss" scoped>
#container {
width: 100%;
height: 100%;
}
</style>
const serverHost = 'http://10.10.95.74:7777'; const serverHost = 'http://10.10.95.74:7777'
//const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')
module.exports = { module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '//yun.duiba.com.cn/editor/zeroing/v1/' : '', publicPath: process.env.NODE_ENV === 'production' ? '//yun.duiba.com.cn/editor/zeroing/v1/' : '',
...@@ -26,9 +26,10 @@ module.exports = { ...@@ -26,9 +26,10 @@ module.exports = {
},*/ },*/
configureWebpack: { configureWebpack: {
plugins: [ plugins: [
/*new MonacoWebpackPlugin({ new MonacoWebpackPlugin({
languages: ['html', 'javascript', 'json'] languages: ['javascript', 'typescript', 'json'],
})*/ publicPath: process.env.NODE_ENV === 'production' ? "/monaco" : "",
})
] ]
} }
}; }
This source diff could not be displayed because it is too large. You can view the blob instead.
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