Commit c2dd872a authored by bianlongting's avatar bianlongting 💬

merge lqf

parents 10173245 1e272d27
......@@ -91,11 +91,14 @@ export async function importView(file) {
return response;
}
export async function uploadFile(file, compress = false) {
export async function uploadFile(file, compress = false, uuid) {
let params = {file};
if (compress) {
params.compress = true;
}
if (uuid) {
params.uuid = uuid;
}
const response = await fetchApi('/api/uploadFile', {
params,
method: 'post',
......
<template>
<el-form class="props-editor" v-if="data&&meta" v-model="data.props" size="mini" label-width="100px" label-position="left" @submit.native.prevent>
<component v-for="(property, key) in meta.props"
:is="getInput(property)"
:container="data.props"
:value="data.props[key]"
:propertyName="key"
:property="property"
:key="key"
:editable="editable"
:linkable="linkable"
@input="onInput"
/>
</el-form>
</template>
<script>
import {
NumberInput,
StringInput,
EnumInput,
BooleanInput,
ColorInput,
AssetInput,
NodeSelectInput,
MapInput,
DynamicInput,
} from "./inputs";
const inputMapping = {
number: 'NumberInput',
string: 'StringInput',
enum: 'EnumInput',
boolean: 'BooleanInput',
color: 'ColorInput',
asset: 'AssetInput',
node: 'NodeSelectInput',
dynamic: 'DynamicInput',
map: 'MapInput',
};
export default {
name: "PropsEditor",
components: {
DynamicInput, MapInput, NodeSelectInput, AssetInput, ColorInput, BooleanInput, EnumInput, NumberInput, StringInput},
data() {
return {
}
},
props: {
editable: {
type: Boolean,
default: true
},
linkable: {
type: Boolean,
default: false
},
data: {
type: Object,
},
meta: {
type: Object,
},
},
methods: {
getInput(property) {
return inputMapping[property.type];
},
onInput(value, container, propName, oldValue){
if(value === undefined){
this.$delete(container ,propName);
}else{
this.$set(container, propName, value);
}
},
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
<template>
<input-wrapper :editable="editable" :value="value" :container="container" :property="property" :propertyName="propertyName">
<input-wrapper :editable="editable" :linkable="linkable" :value="value" :container="container" :property="property" :propertyName="propertyName">
<el-select :disabled="!editable" :value="editValue" filterable @input="onInput" :placeholder="property.default" class="el-select">
<el-option
v-for="(item, key) in assets"
......@@ -19,7 +19,7 @@
export default {
name: "AssetInput",
components: {InputWrapper,},
props: ['value', 'container', 'property', 'propertyName', 'editable'],
props: ['value', 'container', 'property', 'propertyName', 'editable', 'linkable'],
computed: {
editValue() {
return this.value === undefined ? this.property.default : this.value;
......
<template>
<input-wrapper :editable="editable" :value="value" :container="container" :property="property" :propertyName="propertyName">
<input-wrapper :editable="editable" :linkable="linkable" :value="value" :container="container" :property="property" :propertyName="propertyName">
<el-switch :disabled="!editable" :value="editValue" @input="onInput"
class="picker"></el-switch>
</input-wrapper>
......@@ -11,7 +11,7 @@
export default {
name: "BooleanInput",
components: {InputWrapper},
props: ['value', 'container', 'property', 'propertyName', 'editable'],
props: ['value', 'container', 'property', 'propertyName', 'editable', 'linkable'],
data() {
return {}
},
......
<template>
<input-wrapper :editable="editable" :value="value" :container="container" :property="property" :propertyName="propertyName" class="color-input-container">
<input-wrapper :editable="editable" :linkable="linkable" :value="value" :container="container" :property="property" :propertyName="propertyName" class="color-input-container">
<el-color-picker
:disabled="!editable"
class="picker"
......@@ -17,7 +17,7 @@
export default {
name: "ColorInput",
components: {InputWrapper,},
props: ['value', 'container', 'property', 'propertyName', 'editable'],
props: ['value', 'container', 'property', 'propertyName', 'editable', 'linkable'],
data() {
return {
predefineColors: [
......
<template>
<input-wrapper :editable="editable" :value="value" :container="container" :property="property"
<input-wrapper :editable="editable" :linkable="linkable" :value="value" :container="container" :property="property"
:propertyName="propertyName">
<dynamic-selector style="flex: 1;" :value="value" @input="onChange"
:editable="editable"
......@@ -16,7 +16,7 @@
export default {
name: "DynamicInput",
components: {DynamicSelector, InputWrapper,},
props: ['value', 'container', 'property', 'propertyName', 'editable'],
props: ['value', 'container', 'property', 'propertyName', 'editable', 'linkable'],
methods: {
onChange(v){
this.$emit('input', v, this.container, this.propertyName, this.value);
......
......@@ -16,19 +16,19 @@
:placeholder="defaultValue"/>
</el-popover>
<el-button-group>
<el-button @click="onClickEdit" :disabled="!editable">{{editValue.type[0].toUpperCase()}}</el-button>
<el-button @click="onClickEdit" :disabled="!editable">{{dynamicIconMapping[editValue.type]}}</el-button>
<el-button icon="el-icon-delete" @click="onClickClean" :disabled="!editable"></el-button>
</el-button-group>
</div>
</template>
<script>
import {clonePureObj, getInputDefaultValue} from "../../../../utils";
import {clonePureObj, dynamicIconMapping, getInputDefaultValue} from "../../utils";
export default {
name: "DynamicSelector",
components: {},
props: ['value', 'container', 'property', 'propertyName', 'editable'],
props: ['value', 'container', 'property', 'propertyName', 'editable', 'linkable'],
data() {
let dataTypes = this.$t('dataTypes');
return {
......@@ -36,6 +36,7 @@
popoverEditValue: this.value,
popoverVisible: false,
dataTypes,
dynamicIconMapping,
}
},
computed: {
......
<template>
<input-wrapper :editable="editable" :value="value" :container="container" :property="property" :propertyName="propertyName">
<input-wrapper :editable="editable" :linkable="linkable" :value="value" :container="container" :property="property" :propertyName="propertyName">
<el-select :disabled="!editable" :value="editValue" @input="onInput" :placeholder="property.default" class="el-select">
<el-option
v-for="(item, key) in property.enum"
......@@ -19,7 +19,7 @@
export default {
name: "EnumInput",
components: {InputWrapper,},
props: ['value', 'container', 'property', 'propertyName', 'editable'],
props: ['value', 'container', 'property', 'propertyName', 'editable', 'linkable'],
computed: {
editValue() {
return this.value === undefined ? this.property.default : this.value;
......
......@@ -18,6 +18,7 @@
<slot></slot>
</template>
<el-popover
v-if="linkable"
trigger="click"
:disabled="!editable"
>
......@@ -49,6 +50,7 @@
container: {},
propertyName: String,
editable: Boolean,
linkable: Boolean,
contentWidth: {
type: String,
default: '65%',
......@@ -74,12 +76,12 @@
methods: {
onChange(v) {
if (v) {
this.$set(this.container.data.props, this.propertyName, {
this.$set(this.container, this.propertyName, {
type: 'link',
alias: undefined,
});
} else {
this.$delete(this.container.data.props, this.propertyName);
this.$delete(this.container, this.propertyName);
}
}
}
......
<template>
<input-wrapper :editable="editable" :value="value" :container="container" :property="property"
<input-wrapper :editable="editable" :linkable="linkable" :value="value" :container="container" :property="property"
:propertyName="propertyName">
<div style="display: flex;flex: 1;">
<el-popover
......@@ -38,13 +38,13 @@
<script>
import InputWrapper from "./InputWrapper";
import {getInputDefaultValue} from "../../../../utils";
import {getInputDefaultValue} from "../../utils";
import DynamicSelector from "./DynamicSelector";
export default {
name: "MapInput",
components: {DynamicSelector, InputWrapper,},
props: ['value', 'container', 'property', 'propertyName', 'editable'],
props: ['value', 'container', 'property', 'propertyName', 'editable', 'linkable'],
data() {
let dataTypes = this.$t('dataTypes');
return {
......
<template>
<input-wrapper :editable="editable" :value="value" :container="container" :property="property"
<input-wrapper :editable="editable" :linkable="linkable" :value="value" :container="container" :property="property"
:propertyName="propertyName">
<div style="display: flex;flex: 1;">
<el-popover
......@@ -58,7 +58,7 @@
export default {
name: "NodeSelectInput",
components: {InputWrapper,},
props: ['value', 'container', 'property', 'propertyName', 'editable'],
props: ['value', 'container', 'property', 'propertyName', 'editable', 'linkable'],
data() {
return {
editValueOrigin: this.value,
......
<template>
<input-wrapper :editable="editable" :value="value" :container="container" :property="property" :propertyName="propertyName">
<input-wrapper :editable="editable" :linkable="linkable" :value="value" :container="container" :property="property" :propertyName="propertyName">
<el-input-number :disabled="!editable" :value="editValue" @input="onInput" controls-position="right"
:placeholder="defaultValue"></el-input-number>
</input-wrapper>
......@@ -7,12 +7,12 @@
<script>
import InputWrapper from "./InputWrapper";
import {getInputDefaultValue} from "../../../../utils";
import {getInputDefaultValue} from "../../utils";
export default {
name: "NumberInput",
components: {InputWrapper,},
props: ['value', 'container', 'property', 'propertyName', 'editable'],
props: ['value', 'container', 'property', 'propertyName', 'editable', 'linkable'],
computed: {
editValue() {
return this.value === undefined ? this.property.default : this.value;
......
<template>
<input-wrapper :editable="editable" :value="value" :container="container" :property="property" :propertyName="propertyName">
<input-wrapper :editable="editable" :linkable="linkable" :value="value" :container="container" :property="property" :propertyName="propertyName">
<div style="display: flex;flex: 1;">
<el-popover
placement="top"
......@@ -39,12 +39,12 @@
<script>
import InputWrapper from "./InputWrapper";
import {getInputDefaultValue} from "../../../../utils";
import {getInputDefaultValue} from "../../utils";
export default {
name: "StringInput",
components: {InputWrapper,},
props: ['value', 'container', 'property', 'propertyName', 'editable'],
props: ['value', 'container', 'property', 'propertyName', 'editable', 'linkable'],
data() {
return {
editValueOrigin: this.value,
......
/**
* Created by rockyl on 2020-01-08.
*/
export {default as NumberInput} from './NumberInput';
export {default as StringInput} from './StringInput';
export {default as EnumInput} from './EnumInput';
export {default as BooleanInput} from './BooleanInput';
export {default as ColorInput} from './ColorInput';
export {default as AssetInput} from './AssetInput';
export {default as NodeSelectInput} from './NodeSelectInput';
export {default as MapInput} from './MapInput';
export {default as DynamicInput} from './DynamicInput';
......@@ -9,7 +9,7 @@
"Save And Close": "Save And Close",
"Reset": "Reset",
"Copy": "Copy",
"Assets config": "Assets config",
"Assets": "Assets",
"Paste same level":"Paste(same level)",
"Paste child":"Paste(child)",
"Exit": "Exit",
......@@ -203,6 +203,7 @@
"static": "Static",
"arguments": "Arguments",
"data-center": "DataCenter",
"scope": "Scope",
"env": "Env"
},
"prosTypes": {
......
......@@ -9,7 +9,7 @@
"Save And Close": "保存并关闭",
"Reset": "重置",
"Copy": "复制",
"Assets config": "素材配置",
"Assets": "素材",
"Paste same level":"粘贴(同级)",
"Paste child":"粘贴(子级)",
"Exit": "退出",
......@@ -197,6 +197,7 @@
"textinput": "输入框",
"scrollView": "滚动视图",
"scrollList": "滚动列表",
"htmlView": "HTML视图",
"svga": "SVGA"
},
"panes": {
......@@ -209,6 +210,7 @@
"static": "静态",
"arguments": "入参",
"data-center": "数据中心",
"scope": "当前域",
"env": "自定义"
},
"prosTypes": {
......
......@@ -16,6 +16,7 @@ import {addBehavior, deleteProcessMeta, findProcess} from "./behavior";
import db from "../../utils/db-storage";
import {preprocess} from "../../views/Preview/preview-preprocess";
import {fetchApi} from "../../api/common";
const storeName = 'project';
......@@ -769,10 +770,19 @@ async function uploadFiles(files) {
};
}
async function getSheetUrlByUUID(uuid) {
const response = await fetchApi('/api/uuid2url', {
params: {uuid},
errMessage: 'Failed to get url',
});
return response.url;
}
async function packAssets(assets) {
let failedList = [];
let newAssets = assets.concat();
await packImages(newAssets);
await packImages(newAssets, {getSheetUrlByUUID});
for (let asset of newAssets) {
if (asset.file) {
......@@ -786,7 +796,7 @@ async function packAssets(assets) {
};
let sheetConfigFile = new File([JSON.stringify(sheetConfig)], 'sheet.json', {type: 'plain/text'});
const {url: sheetConfigUrl} = await uploadFile(sheetConfigFile).catch(e => {
const {url: sheetConfigUrl} = await uploadFile(sheetConfigFile, false, asset.sheetUUID).catch(e => {
failedList.push(asset);
});
asset.url = sheetConfigUrl;
......@@ -794,6 +804,7 @@ async function packAssets(assets) {
delete asset.file;
delete asset.frames;
delete asset.sheetUUID;
}
}
......
......@@ -34,7 +34,7 @@ content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, u
<body>
<div id="$CONTAINER_ID$" style="line-height:0;font-size:0"></div>
<script src="${process.env.NODE_ENV === 'development' ? 'http://10.10.92.100:4002/debug/engine.js' : 'http://yun.duiba.com.cn/editor/zeroing/libs/engine.269ce0ee2f951a11e004eee2df2fa1d875fa0b62.js'}"></script>
<script src="${process.env.NODE_ENV === 'development' ? 'http://10.10.92.100:4002/debug/engine.js' : 'http://yun.duiba.com.cn/editor/zeroing/libs/engine.4db1f30a604493bbb87d4966af54cdd10840047a.js'}"></script>
$SCRIPTS$
<script>
engine.launch('//yun.duiba.com.cn/aurora/$VERSION$-data.json');
......
......@@ -280,25 +280,7 @@ $dock-pin-width: 9px;
display: flex;
flex-direction: column;
.linked {
display: block;
height: 26px;
overflow: hidden;
border: 1px solid $--border-color-base;
border-radius: 4px;
background-color: $--background-color-base;
flex: 1;
padding: 0 5px;
color: $--color-text-secondary;
}
.el-input-group__prepend {
padding: 0 5px;
}
.el-select {
width: 100%;
}
.wrapper {
padding: 5px;
......@@ -318,41 +300,6 @@ $dock-pin-width: 9px;
.scrollbar-view {
padding-right: 10px;
.input-wrapper {
.label {
p {
margin: 0;
//text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.alias {
line-height: 16px;
font-size: 14px;
}
.property-name {
line-height: 12px;
font-size: 12px;
color: $--color-text-secondary;
}
}
}
}
.el-form-item__content {
display: flex;
justify-content: flex-end;
.el-input-number--mini {
flex: 1;
}
}
.node-select-container {
flex: 1;
}
}
}
......@@ -460,3 +407,60 @@ $dock-pin-width: 9px;
color: $--color-text-secondary;
}
}
.props-editor{
.linked {
display: block;
height: 26px;
overflow: hidden;
border: 1px solid $--border-color-base;
border-radius: 4px;
background-color: $--background-color-base;
flex: 1;
padding: 0 5px;
color: $--color-text-secondary;
}
.el-input-group__prepend {
padding: 0 5px;
}
.el-select {
width: 100%;
}
.input-wrapper {
.label {
p {
margin: 0;
//text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.alias {
line-height: 16px;
font-size: 14px;
}
.property-name {
line-height: 12px;
font-size: 12px;
color: $--color-text-secondary;
}
}
}
.el-form-item__content {
display: flex;
justify-content: flex-end;
.el-input-number--mini {
flex: 1;
}
}
.node-select-container {
flex: 1;
}
}
......@@ -6,6 +6,14 @@ import {Message, Loading} from "element-ui";
import i18n from '../i18n'
import generateUUID from "uuid/v4";
export const dynamicIconMapping = {
'static': 'S',
'arguments': 'A',
'data-center': 'D',
'scope': 'O',
'env': 'E',
};
export function messageError(e) {
Message({
dangerouslyUseHTMLString: true,
......
......@@ -138,7 +138,10 @@ export default {
htmlText: {
title: 'HTML内容',
type: 'input',
value: ''
value: '',
props: {
clearable: true,
},
},
bold: {
title: '粗体',
......@@ -194,7 +197,7 @@ export default {
{ label: '居中', value: 'middle' },
{ label: '靠下', value: 'down' }
],
value: 'top'
value: 'up'
},
},
bitmapText: {
......@@ -203,12 +206,18 @@ export default {
text: {
title: '文本内容',
type: 'input',
value: ''
value: '',
props: {
clearable: true,
},
},
font: {
title: '字体名',
type: 'input',
value: ''
value: '',
props: {
clearable: true,
},
},
letterSpacing: {
title: '字间距',
......@@ -241,7 +250,10 @@ export default {
pattern: {
title: '输入模式',
type: 'input',
value: ''
value: '',
props: {
clearable: true,
},
},
maxLength: {
title: '最大长度',
......@@ -251,7 +263,10 @@ export default {
placeholder: {
title: '提示文字',
type: 'input',
value: ''
value: '',
props: {
clearable: true,
},
},
placeholderColor: {
title: '提示颜色',
......@@ -414,11 +429,15 @@ export default {
value: true,
},
},
/*htmlView: {
htmlView: {
base: 'node',
groupName: 'HTML视图',
htmlElement: {
title: 'HTML内容',
type: 'input',
props: {
clearable: true,
},
},
}*/
},
}
......@@ -4,6 +4,8 @@
import MaxRectsBinPack from "./MaxRectsBinPack";
import {clonePureObj} from "./index";
import sha256 from "crypto-js/sha256";
import generateUUID from "uuid/v4";
const packExts = ['.png']; //, '.jpg', '.jpeg', '.bmp'
......@@ -14,6 +16,8 @@ export async function packImages(asssts, options = {}) {
const maxSize = options.maxSize || 2048;
const mode = options.mode || 0;
const {getSheetUrlByUUID} = options;
const images = await preProcessing(asssts);
let rects = [], singles = [];
......@@ -70,7 +74,7 @@ export async function packImages(asssts, options = {}) {
});
let frames = {};
let i = 0;
let i = 0, urls = [];
for (let rect of packedRects) {
let sprite = {
x: rect.x + padding,
......@@ -83,17 +87,36 @@ export async function packImages(asssts, options = {}) {
sh: rect.sourceH,
};
urls.push(rect.assets[0].url);
for (let asset of rect.assets) {
frames[asset.uuid] = Object.assign({}, sprite, {name: asset.name});
i++;
}
}
asssts.push({
ext: '.sht',
file: new File([blob], name + '.png'),
frames,
});
const sheetUUID = sha256(urls.sort().join()).toString();
let url;
if (getSheetUrlByUUID) {
url = await getSheetUrlByUUID(sheetUUID);
}
if(url){
asssts.push({
ext: '.sht',
url,
uuid: generateUUID(),
});
}else{
asssts.push({
ext: '.sht',
file: new File([blob], name + '.png'),
frames,
sheetUUID,
});
}
index++;
}
}
......@@ -113,7 +136,7 @@ function loadImage(url, assets) {
})
}
async function preProcessing(assets) {
export async function preProcessing(assets) {
let targetAssets = [];
for (let i = 0, li = assets.length; i < li; i++) {
const asset = assets[i];
......@@ -134,6 +157,7 @@ async function preProcessing(assets) {
}
let ps = [];
for (let url in groups) {
ps.push(loadImage(url, groups[url]))
}
......
......@@ -26,7 +26,7 @@
</template>
<template v-else>
{{objToString(data.props[key].value)}}
<i class="tag">{{data.props[key].type[0].toUpperCase()}}</i>
<i class="tag">{{dynamicIconMapping[data.props[key].type]}}</i>
</template>
</span>
</span>
......@@ -56,6 +56,7 @@
import {mapState} from "vuex";
import DockPin from "./DockPin";
import events from "../../../../global-events";
import {dynamicIconMapping} from "../../../../utils";
export default {
name: "ProcessNode",
......@@ -69,6 +70,7 @@
height: 100,
inputMeta,
active: false,
dynamicIconMapping,
}
},
mounted() {
......
......@@ -132,7 +132,6 @@
</template>
<script>
import ElFormItem from "./inputs/form-item";
import PropsEditorDialog from "./PropsEditorDialog";
import MonacoEditor from "../components/MonacoEditor";
import copy from "copy-to-clipboard";
......@@ -141,7 +140,15 @@ import events from "../../../global-events";
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",
"scope"
];
export default {
name: "MetaEditorDialog",
......@@ -149,8 +156,9 @@ export default {
CodeEditor,
CodeSyncIndicator,
PropsEditorDialog,
ElFormItem,
// ElFormItem,
"monaco-editor": MonacoEditor
//"monaco-editor": MonacoEditor
},
data() {
return {
......@@ -224,7 +232,7 @@ export default {
this.$t("Alert")
).catch(e => {});
} else {
this.meta.script = this.$refs.codeEditor.editor.getValue();
//this.meta.script = this.$refs.codeEditor.editor.getValue();
this.$emit("input", this.meta, isPreview);
this.visible = false;
this.meta = null;
......
<template>
<div class="wrapper" v-if="process">
<el-input :readonly="!editable" class="name-input" v-model="process.data.alias" clearable :placeholder="process.meta.name" size="mini">
<el-input :readonly="!editable" class="name-input" v-model="process.data.alias" clearable
:placeholder="process.meta.name" size="mini">
<template slot="prepend">{{$t('Name')}}</template>
</el-input>
<el-scrollbar class="scrollbar" wrap-class="wrap-x-hidden"
view-class="scrollbar-view">
<el-form v-model="process" size="mini" label-width="100px" label-position="left" @submit.native.prevent>
<component v-for="(property, key) in process.meta.props"
:is="getInput(property)"
v-model="process.data.props[key]"
:propertyName="key"
:property="property"
:container="process"
:key="key"
:editable="editable"
/>
</el-form>
<props-editor ref="propsEditor" :editable="editable" :linkable="true" :data="process.data" :meta="process.meta"/>
</el-scrollbar>
</div>
</template>
<script>
import {mapState} from "vuex";
import NumberInput from "./inputs/NumberInput";
import StringInput from "./inputs/StringInput";
import EnumInput from "./inputs/EnumInput";
import BooleanInput from "./inputs/BooleanInput";
import ColorInput from "./inputs/ColorInput";
import AssetInput from "./inputs/AssetInput";
import NodeSelectInput from "./inputs/NodeSelectInput";
import MapInput from "./inputs/MapInput";
import DynamicInput from "./inputs/DynamicInput";
const inputMapping = {
number: 'NumberInput',
string: 'StringInput',
enum: 'EnumInput',
boolean: 'BooleanInput',
color: 'ColorInput',
asset: 'AssetInput',
node: 'NodeSelectInput',
dynamic: 'DynamicInput',
map: 'MapInput',
};
import PropsEditor from "../../../components/PropsEditor";
export default {
name: "PropertiesInput",
components: {
DynamicInput,
MapInput, NodeSelectInput, AssetInput, ColorInput, BooleanInput, EnumInput, NumberInput, StringInput},
PropsEditor,
},
data() {
return {
process: null,
......
......@@ -28,13 +28,12 @@
<script>
import {mapMutations, mapState} from 'vuex'
import EnabledSetter from "../components/EnabledSetter";
import ElFormItem from "../behavior-editor/inputs/form-item";
import {clonePureObj} from "../../../utils";
import {startCodeSyncServe} from "../../../code-sync-serve";
export default {
name: "CodeSyncServeDialog",
components: {ElFormItem, EnabledSetter,},
components: {EnabledSetter,},
data() {
return {
visible: false,
......
......@@ -19,12 +19,20 @@
</el-table-column>
<el-table-column
prop="assets"
:label="$t('Assets config')"
width="100">
:label="$t('Assets')"
width="60">
<template slot-scope="scope">
<el-button size="mini" icon="el-icon-edit" circle type="primary" plain @click="editAssetMapping(scope.row)"/>
</template>
</el-table-column>
<el-table-column
prop="props"
:label="$t('Props')"
width="60">
<template slot-scope="scope">
<el-button size="mini" icon="el-icon-edit" circle type="primary" plain @click="editProps(scope.row)"/>
</template>
</el-table-column>
<!--<el-table-column
label="Version"
width="100"
......@@ -36,6 +44,7 @@
<el-table-column>
</el-table-column>
<asset-mapping-editor-dialog ref="assetMappingEditorDialog" @save="onSaveAssetMapping"/>
<props-editor-dialog ref="propsEditorDialog"/>
</el-table>
</template>
......@@ -43,10 +52,11 @@
import {mapState, mapMutations} from 'vuex'
import {clonePureObj} from "../../../../utils";
import AssetMappingEditorDialog from "./AssetMappingEditorDialog";
import PropsEditorDialog from "./CustomModuleEditor/PropsEditorDialog";
export default {
name: "CustomModuleEditor",
components: {AssetMappingEditorDialog},
components: {PropsEditorDialog, AssetMappingEditorDialog},
data() {
return {
visible: false,
......@@ -64,12 +74,18 @@
this.editData = clonePureObj(this.customs);
this.customMetas.splice(0);
for (let meta of this.$store.state.env.customs) {
let data = this.editData.find(item => item.id === meta.id);
let editData = this.editData.find(item => item.id === meta.id);
let data = editData ? editData : (editData || {});
if (!data.props) {
data.props = {};
}
this.customMetas.push({
id: meta.id,
name: meta.name,
assetMapping: data && (data.assetMapping || {}),
selected: !!data,
meta,
data,
assetMapping: editData && (editData.assetMapping || {}),
selected: !!editData,
})
}
},
......@@ -81,16 +97,20 @@
editData.push({
id: meta.id,
assetMapping: meta.assetMapping || {},
props: meta.data.props || {},
});
}
}
this.modifyCustoms(editData);
},
editAssetMapping(data) {
this.$refs.assetMappingEditorDialog.show(data);
editAssetMapping(item) {
this.$refs.assetMappingEditorDialog.show(item);
},
editProps(item) {
this.$refs.propsEditorDialog.show(item.data, item.meta);
},
onSaveAssetMapping(mid, assetMapping) {
this.customMetas.find(item=>item.id === mid).assetMapping = assetMapping;
this.customMetas.find(item => item.id === mid).assetMapping = assetMapping;
},
...mapMutations([
'modifyCustoms',
......
<template>
<el-dialog :title="$t('Props Editor')" width="70%" :visible.sync="visible" @opened="onOpen"
:close-on-click-modal="false"
:append-to-body="true"
:show-close="false"
>
<el-scrollbar class="scrollbar" wrap-class="wrap-x-hidden"
view-class="scrollbar-view">
<props-editor v-if="data" ref="propsEditor" :data="data" :meta="meta" :linkable="false"/>
</el-scrollbar>
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="onClose">{{$t('Close')}}</el-button>
<el-button size="mini" @click="onSave" type="primary">{{$t('Save')}}</el-button>
</div>
</el-dialog>
</template>
<script>
import PropsEditor from "../../../../../components/PropsEditor";
export default {
name: "PropsEditorDialog",
components: {PropsEditor},
data() {
return {
visible: false,
data: null,
meta: null,
}
},
methods: {
show(data, meta) {
this.data = data;
this.meta = meta;
this.visible = true;
},
onSave() {
this.visible = false;
},
onClose() {
this.visible = false;
},
onOpen() {
},
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
......@@ -2566,6 +2566,11 @@ crypto-browserify@^3.11.0:
randombytes "^2.0.0"
randomfill "^1.0.3"
crypto-js@^3.1.9-1:
version "3.1.9-1"
resolved "https://registry.npm.taobao.org/crypto-js/download/crypto-js-3.1.9-1.tgz#fda19e761fc077e01ffbfdc6e9fdfc59e8806cd8"
integrity sha1-/aGedh/Ad+Af+/3G6f38WeiAbNg=
css-color-names@0.0.4, css-color-names@^0.0.4:
version "0.0.4"
resolved "https://registry.npm.taobao.org/css-color-names/download/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0"
......@@ -2799,7 +2804,7 @@ debug@4, debug@^4.1.0, debug@^4.1.1, debug@~4.1.0:
dependencies:
ms "^2.1.1"
debug@^3.0.0, debug@^3.1.0, debug@^3.1.1, debug@^3.2.5, debug@^3.2.6:
debug@^3.0.0, debug@^3.1.0, debug@^3.1.1, debug@^3.2.5:
version "3.2.6"
resolved "https://registry.npm.taobao.org/debug/download/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
integrity sha1-6D0X3hbYp++3cX7b5fsQE17uYps=
......@@ -2828,11 +2833,6 @@ deep-equal@^1.0.1:
object-keys "^1.1.1"
regexp.prototype.flags "^1.2.0"
deep-extend@^0.6.0:
version "0.6.0"
resolved "https://registry.npm.taobao.org/deep-extend/download/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
integrity sha1-xPp8lUBKF6nD6Mp+FTcxK3NjMKw=
deep-is@~0.1.3:
version "0.1.3"
resolved "https://registry.npm.taobao.org/deep-is/download/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
......@@ -2956,11 +2956,6 @@ destroy@^1.0.4, destroy@~1.0.4:
resolved "https://registry.npm.taobao.org/destroy/download/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80"
integrity sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=
detect-libc@^1.0.2:
version "1.0.3"
resolved "https://registry.npm.taobao.org/detect-libc/download/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b"
integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=
detect-node@^2.0.4:
version "2.0.4"
resolved "https://registry.npm.taobao.org/detect-node/download/detect-node-2.0.4.tgz#014ee8f8f669c5c58023da64b8179c083a28c46c"
......@@ -3761,13 +3756,6 @@ fs-extra@^7.0.1:
jsonfile "^4.0.0"
universalify "^0.1.0"
fs-minipass@^1.2.5:
version "1.2.7"
resolved "https://registry.npm.taobao.org/fs-minipass/download/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7"
integrity sha1-zP+FcIQef+QmVpPaiJNsVa7X98c=
dependencies:
minipass "^2.6.0"
fs-write-stream-atomic@^1.0.8:
version "1.0.10"
resolved "https://registry.npm.taobao.org/fs-write-stream-atomic/download/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9"
......@@ -4333,7 +4321,7 @@ humanize-ms@^1.2.0, humanize-ms@^1.2.1:
dependencies:
ms "^2.0.0"
iconv-lite@0.4.24, iconv-lite@^0.4.15, iconv-lite@^0.4.4:
iconv-lite@0.4.24, iconv-lite@^0.4.15:
version "0.4.24"
resolved "https://registry.npm.taobao.org/iconv-lite/download/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
integrity sha1-ICK0sl+93CHS9SSXSkdKr+czkIs=
......@@ -4362,13 +4350,6 @@ iferr@^0.1.5:
resolved "https://registry.npm.taobao.org/iferr/download/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501"
integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE=
ignore-walk@^3.0.1:
version "3.0.3"
resolved "https://registry.npm.taobao.org/ignore-walk/download/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37"
integrity sha1-AX4kRxhL/q3nwjjkrv3R6PlbHjc=
dependencies:
minimatch "^3.0.4"
ignore@^3.3.5:
version "3.3.10"
resolved "https://registry.npm.taobao.org/ignore/download/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043"
......@@ -4474,11 +4455,6 @@ inherits@2.0.3:
resolved "https://registry.npm.taobao.org/inherits/download/inherits-2.0.3.tgz?cache=0&sync_timestamp=1560975547815&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Finherits%2Fdownload%2Finherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
ini@~1.3.0:
version "1.3.5"
resolved "https://registry.npm.taobao.org/ini/download/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
integrity sha1-7uJfVtscnsYIXgwid4CD9Zar+Sc=
internal-ip@^4.3.0:
version "4.3.0"
resolved "https://registry.npm.taobao.org/internal-ip/download/internal-ip-4.3.0.tgz#845452baad9d2ca3b69c635a137acb9a0dad0907"
......@@ -5454,21 +5430,6 @@ minimist@~0.0.1:
resolved "https://registry.npm.taobao.org/minimist/download/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"
integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=
minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0:
version "2.9.0"
resolved "https://registry.npm.taobao.org/minipass/download/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6"
integrity sha1-5xN2Ln0+Mv7YAxFc+T4EvKn8yaY=
dependencies:
safe-buffer "^5.1.2"
yallist "^3.0.0"
minizlib@^1.2.1:
version "1.3.3"
resolved "https://registry.npm.taobao.org/minizlib/download/minizlib-1.3.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fminizlib%2Fdownload%2Fminizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d"
integrity sha1-IpDeloGKNMKVUcio0wEha9Zahh0=
dependencies:
minipass "^2.9.0"
mississippi@^2.0.0:
version "2.0.0"
resolved "https://registry.npm.taobao.org/mississippi/download/mississippi-2.0.0.tgz#3442a508fafc28500486feea99409676e4ee5a6f"
......@@ -5615,15 +5576,6 @@ nanomatch@^1.2.9:
snapdragon "^0.8.1"
to-regex "^3.0.1"
needle@^2.2.1:
version "2.4.0"
resolved "https://registry.npm.taobao.org/needle/download/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c"
integrity sha1-aDPnSXXERGQlkOFadQKIxfk5tXw=
dependencies:
debug "^3.2.6"
iconv-lite "^0.4.4"
sax "^1.2.4"
negotiator@0.6.2:
version "0.6.2"
resolved "https://registry.npm.taobao.org/negotiator/download/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb"
......@@ -5712,22 +5664,6 @@ node-libs-browser@^2.2.1:
util "^0.11.0"
vm-browserify "^1.0.1"
node-pre-gyp@*:
version "0.14.0"
resolved "https://registry.npm.taobao.org/node-pre-gyp/download/node-pre-gyp-0.14.0.tgz#9a0596533b877289bcad4e143982ca3d904ddc83"
integrity sha1-mgWWUzuHcom8rU4UOYLKPZBN3IM=
dependencies:
detect-libc "^1.0.2"
mkdirp "^0.5.1"
needle "^2.2.1"
nopt "^4.0.1"
npm-packlist "^1.1.6"
npmlog "^4.0.2"
rc "^1.2.7"
rimraf "^2.6.1"
semver "^5.3.0"
tar "^4.4.2"
node-releases@^1.1.44:
version "1.1.44"
resolved "https://registry.npm.taobao.org/node-releases/download/node-releases-1.1.44.tgz?cache=0&sync_timestamp=1577231700151&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnode-releases%2Fdownload%2Fnode-releases-1.1.44.tgz#cd66438a6eb875e3eb012b6a12e48d9f4326ffd7"
......@@ -5765,14 +5701,6 @@ node-sass@^4.9.2:
dependencies:
abbrev "1"
nopt@^4.0.1:
version "4.0.1"
resolved "https://registry.npm.taobao.org/nopt/download/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d"
integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=
dependencies:
abbrev "1"
osenv "^0.1.4"
normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.5.0:
version "2.5.0"
resolved "https://registry.npm.taobao.org/normalize-package-data/download/normalize-package-data-2.5.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnormalize-package-data%2Fdownload%2Fnormalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8"
......@@ -5820,26 +5748,6 @@ normalize-wheel@^1.0.1:
resolved "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz#aec886affdb045070d856447df62ecf86146ec45"
integrity sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU=
npm-bundled@^1.0.1:
version "1.1.1"
resolved "https://registry.npm.taobao.org/npm-bundled/download/npm-bundled-1.1.1.tgz?cache=0&sync_timestamp=1575936189080&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnpm-bundled%2Fdownload%2Fnpm-bundled-1.1.1.tgz#1edd570865a94cdb1bc8220775e29466c9fb234b"
integrity sha1-Ht1XCGWpTNsbyCIHdeKUZsn7I0s=
dependencies:
npm-normalize-package-bin "^1.0.1"
npm-normalize-package-bin@^1.0.1:
version "1.0.1"
resolved "https://registry.npm.taobao.org/npm-normalize-package-bin/download/npm-normalize-package-bin-1.0.1.tgz?cache=0&sync_timestamp=1575936190670&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnpm-normalize-package-bin%2Fdownload%2Fnpm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2"
integrity sha1-bnmkHyP9I1wGIyGCKNp9nCO49uI=
npm-packlist@^1.1.6:
version "1.4.7"
resolved "https://registry.npm.taobao.org/npm-packlist/download/npm-packlist-1.4.7.tgz#9e954365a06b80b18111ea900945af4f88ed4848"
integrity sha1-npVDZaBrgLGBEeqQCUWvT4jtSEg=
dependencies:
ignore-walk "^3.0.1"
npm-bundled "^1.0.1"
npm-run-path@^2.0.0:
version "2.0.2"
resolved "https://registry.npm.taobao.org/npm-run-path/download/npm-run-path-2.0.2.tgz?cache=0&sync_timestamp=1577053500910&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnpm-run-path%2Fdownload%2Fnpm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
......@@ -5854,7 +5762,7 @@ npm-run-path@^4.0.0:
dependencies:
path-key "^3.0.0"
"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0, npmlog@^4.0.2:
"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0:
version "4.1.2"
resolved "https://registry.npm.taobao.org/npmlog/download/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b"
integrity sha1-CKfyqL9zRgR3mp76StXMcXq7lUs=
......@@ -6097,7 +6005,7 @@ os-tmpdir@^1.0.0:
resolved "https://registry.npm.taobao.org/os-tmpdir/download/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=
osenv@0, osenv@^0.1.4:
osenv@0:
version "0.1.5"
resolved "https://registry.npm.taobao.org/osenv/download/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410"
integrity sha1-hc36+uso6Gd/QW4odZK18/SepBA=
......@@ -7047,16 +6955,6 @@ raw-body@^2.2.0:
iconv-lite "0.4.24"
unpipe "1.0.0"
rc@^1.2.7:
version "1.2.8"
resolved "https://registry.npm.taobao.org/rc/download/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"
integrity sha1-zZJL9SAKB1uDwYjNa54hG3/A0+0=
dependencies:
deep-extend "^0.6.0"
ini "~1.3.0"
minimist "^1.2.0"
strip-json-comments "~2.0.1"
read-pkg-up@^1.0.1:
version "1.0.1"
resolved "https://registry.npm.taobao.org/read-pkg-up/download/read-pkg-up-1.0.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fread-pkg-up%2Fdownload%2Fread-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02"
......@@ -7464,7 +7362,7 @@ sass@^1.22.9:
dependencies:
chokidar ">=2.0.0 <4.0.0"
sax@>=0.6.0, sax@^1.2.4, sax@~1.2.4:
sax@>=0.6.0, sax@~1.2.4:
version "1.2.4"
resolved "https://registry.npm.taobao.org/sax/download/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
integrity sha1-KBYjTiN4vdxOU1T6tcqold9xANk=
......@@ -8152,11 +8050,6 @@ strip-indent@^1.0.1:
dependencies:
get-stdin "^4.0.1"
strip-json-comments@~2.0.1:
version "2.0.1"
resolved "https://registry.npm.taobao.org/strip-json-comments/download/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=
stylehacks@^4.0.0:
version "4.0.3"
resolved "https://registry.npm.taobao.org/stylehacks/download/stylehacks-4.0.3.tgz#6718fcaf4d1e07d8a1318690881e8d96726a71d5"
......@@ -8230,19 +8123,6 @@ tar@^2.0.0:
fstream "^1.0.12"
inherits "2"
tar@^4.4.2:
version "4.4.13"
resolved "https://registry.npm.taobao.org/tar/download/tar-4.4.13.tgz?cache=0&sync_timestamp=1570258601713&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftar%2Fdownload%2Ftar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525"
integrity sha1-Q7NkvFKIjVVSmGN7ENYHkCVKtSU=
dependencies:
chownr "^1.1.1"
fs-minipass "^1.2.5"
minipass "^2.8.6"
minizlib "^1.2.1"
mkdirp "^0.5.0"
safe-buffer "^5.1.2"
yallist "^3.0.3"
terser-webpack-plugin@^1.2.3, terser-webpack-plugin@^1.4.3:
version "1.4.3"
resolved "https://registry.npm.taobao.org/terser-webpack-plugin/download/terser-webpack-plugin-1.4.3.tgz?cache=0&sync_timestamp=1576580745773&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fterser-webpack-plugin%2Fdownload%2Fterser-webpack-plugin-1.4.3.tgz#5ecaf2dbdc5fb99745fd06791f46fc9ddb1c9a7c"
......@@ -9157,7 +9037,7 @@ yallist@^2.1.2:
resolved "https://registry.npm.taobao.org/yallist/download/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=
yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3:
yallist@^3.0.2:
version "3.1.1"
resolved "https://registry.npm.taobao.org/yallist/download/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"
integrity sha1-27fa+b/YusmrRev2ArjLrQ1dCP0=
......
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