Commit 53645390 authored by rockyl's avatar rockyl

提交

parent 1e347450
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* Created by rockyl on 2019-11-25. * Created by rockyl on 2019-11-25.
*/ */
var mergeFlagReg = /__m$/; var mergeFlagReg = /__m/;
var excludeFlagReg = /__e$/; var excludeFlagReg = /__e/;
var extName = '.psd'; var extName = '.psd';
var oldDocument = app.activeDocument; var oldDocument = app.activeDocument;
...@@ -15,7 +15,12 @@ var document = oldDocument.duplicate(oldDocument.name.replace(extName, '') + '- ...@@ -15,7 +15,12 @@ var document = oldDocument.duplicate(oldDocument.name.replace(extName, '') + '-
function traverse(layer, callback) { function traverse(layer, callback) {
if (layer.layers) { if (layer.layers) {
for (var i = 0, li = layer.layers.length; i < li; i++) { for (var i = 0, li = layer.layers.length; i < li; i++) {
var childLayer = layer.layers[i]; var childLayer;
try {
childLayer = layer.layers[i];
}catch (e) {
alert('图层[' + layer.name + ']的第' + i + '个子图层存在问题,请先处理掉');
}
var action = callback(childLayer); var action = callback(childLayer);
switch (action) { switch (action) {
case 0: case 0:
......
...@@ -80,7 +80,8 @@ ...@@ -80,7 +80,8 @@
"Saving": "保存中…", "Saving": "保存中…",
"Divider": "分流节点", "Divider": "分流节点",
"Custom": "自定义节点", "Custom": "自定义节点",
"Custom event": "自定义事件", "Custom global event": "自定义全局事件",
"Custom private event": "自定义私有事件",
"Entry": "入口", "Entry": "入口",
"Packing": "打包", "Packing": "打包",
"Type": "类型", "Type": "类型",
...@@ -108,6 +109,8 @@ ...@@ -108,6 +109,8 @@
"Trigger once": "触发一次", "Trigger once": "触发一次",
"Meta Editor": "过程元配置", "Meta Editor": "过程元配置",
"Env editor": "环境编辑器", "Env editor": "环境编辑器",
"Inline": "内联",
"Common": "通用",
"As inline": "作为内联", "As inline": "作为内联",
"Project": "项目", "Project": "项目",
"Check template code": "查看模板代码", "Check template code": "查看模板代码",
...@@ -157,6 +160,7 @@ ...@@ -157,6 +160,7 @@
"Confirm to exit the editor": "确定退出编辑器吗?", "Confirm to exit the editor": "确定退出编辑器吗?",
"Confirm to publish": "确定发布吗?", "Confirm to publish": "确定发布吗?",
"Are you sure to delete this behavior?": "确定删除这个的行为吗", "Are you sure to delete this behavior?": "确定删除这个的行为吗",
"Are you sure to delete this process?": "确定删除这个的过程吗",
"Are you sure to delete it's process?": "确定删除行为对应的过程吗", "Are you sure to delete it's process?": "确定删除行为对应的过程吗",
"Are you sure to delete this asset?": "确定删除这个素材吗", "Are you sure to delete this asset?": "确定删除这个素材吗",
"Are you sure to combine those assets?": "确定合并这些素材吗", "Are you sure to combine those assets?": "确定合并这些素材吗",
...@@ -205,7 +209,7 @@ ...@@ -205,7 +209,7 @@
"Index page exists": "已存在首页", "Index page exists": "已存在首页",
"Please config projectID": "请先配置{env}环境下的projectId", "Please config projectID": "请先配置{env}环境下的projectId",
"Online ticket is invalid": "线上tickct失效,请联系管理员修改", "Online ticket is invalid": "线上tickct失效,请联系管理员修改",
"Are you sure to translate to normal process?": "你确定将此转化为通用过程吗?", "Are you sure to transform process?": "你确定将此转化为{inlineType}过程吗?",
"Input custom process name": "请输入自定义过程名称", "Input custom process name": "请输入自定义过程名称",
"Invalid name": "无效名称", "Invalid name": "无效名称",
"eventGroup": { "eventGroup": {
......
...@@ -92,14 +92,44 @@ export const behaviorStore = { ...@@ -92,14 +92,44 @@ export const behaviorStore = {
} }
state.drawState.boardScale = Math.max(Math.min(4, scale), 0.1); state.drawState.boardScale = Math.max(Math.min(4, scale), 0.1);
}, },
translateToNormal(state, {meta, parentMeta}) { switchProcessInlineType(state, {process, parentMeta}) {
meta.isInline = false; let newMeta = process.meta;
let index = parentMeta.metas.indexOf(meta);
const {isInline} = newMeta;
let oldUUID = newMeta.id;
let newUUID = generateUUID();
if (isInline) {
newMeta.id = newUUID;
newMeta.isInline = false;
let index = parentMeta.metas.indexOf(newMeta);
parentMeta.metas.splice(index, 1); parentMeta.metas.splice(index, 1);
state.processes.push(meta); state.processes.push(newMeta);
for (let key in parentMeta.sub) {
let subProcess = parentMeta.sub[key];
if (subProcess.meta === oldUUID) {
subProcess.meta = newUUID;
}
}
} else {
newMeta = clonePureObj(newMeta);
newMeta.id = newUUID;
newMeta.isInline = true;
Vue.set(parentMeta, 'metas', []);
parentMeta.metas.push(newMeta);
process.metaID = newUUID;
}
for (let key in parentMeta.sub) {
let subProcess = parentMeta.sub[key];
console.log(subProcess.meta);
}
this.commit('makeBehaviorDirty'); this.commit('makeBehaviorDirty');
}, },
}, },
getters: { getters: {
customProcessMap: state => { customProcessMap: state => {
......
...@@ -578,6 +578,9 @@ export const projectStore = { ...@@ -578,6 +578,9 @@ export const projectStore = {
let index = entries.indexOf(behavior.meta); let index = entries.indexOf(behavior.meta);
if (index >= 0) { if (index >= 0) {
let path = paths.splice(index, 1, null)[0]; let path = paths.splice(index, 1, null)[0];
if(!path){
continue;
}
path[0] = { path[0] = {
process: behavior, process: behavior,
metaName: path[0].name, metaName: path[0].name,
......
.zero-playground-body-center{ .zero-playground-body-center{
position: relative; position: relative;
width: 750px; width: 750px;
height: 1206px;
margin: 10px auto; margin: 10px auto;
height: 1200px;
// max-height: 1200px; // max-height: 1200px;
background-color: transparent; background-color: transparent;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.4); box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
......
...@@ -277,6 +277,10 @@ export const styles = { ...@@ -277,6 +277,10 @@ export const styles = {
// 如果是label类型,把fillColor转换为color // 如果是label类型,把fillColor转换为color
cmpSelfProps.color = cmpSelfProps.fillColor; cmpSelfProps.color = cmpSelfProps.fillColor;
delete cmpSelfProps.fillColor; delete cmpSelfProps.fillColor;
if (cmpSelfProps.italic) { //斜体
delete cmpSelfProps.italic;
cmpSelfProps.fontStyle = 'italic';
}
if (!onlyOpera) { if (!onlyOpera) {
if (cmpSelfProps.lineType === 'single') { if (cmpSelfProps.lineType === 'single') {
// word-break: keep-all;white-space: nowrap; // word-break: keep-all;white-space: nowrap;
......
...@@ -156,6 +156,14 @@ export default { ...@@ -156,6 +156,14 @@ export default {
}, },
value: false, value: false,
}, },
italic: {
title: '斜体',
type: 'switch',
props: {
width: 40
},
value: false,
},
fillColor: { fillColor: {
title: '颜色', title: '颜色',
type: 'colorPicker', type: 'colorPicker',
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
}, },
onClickItem(asset, event) { onClickItem(asset, event) {
this.$emit('click-item', asset); this.$emit('click-item', asset);
if (event.metaKey) { if (event.altKey) {
if (this.isSelected(asset)) { if (this.isSelected(asset)) {
this.unselectItem(asset); this.unselectItem(asset);
} else { } else {
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
<el-dropdown-item :disabled="!!activeComponent.events[key]" v-for="(item, key) in builtinEvents" :command="key" <el-dropdown-item :disabled="!!activeComponent.events[key]" v-for="(item, key) in builtinEvents" :command="key"
:key="key">{{item}} :key="key">{{item}}
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item divided command="custom">{{$t('Custom event')}}</el-dropdown-item> <el-dropdown-item divided command="custom-global">{{$t('Custom global event')}}</el-dropdown-item>
<el-dropdown-item command="custom-private">{{$t('Custom private event')}}</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<el-scrollbar class="scrollbar" wrap-class="wrap-x-hidden" view-class="trigger-list"> <el-scrollbar class="scrollbar" wrap-class="wrap-x-hidden" view-class="trigger-list">
...@@ -14,6 +15,7 @@ ...@@ -14,6 +15,7 @@
<div class="top-bar"> <div class="top-bar">
<span class="el-icon-caret-right el-tree-node__expand-icon expanded-arrow" <span class="el-icon-caret-right el-tree-node__expand-icon expanded-arrow"
:class="{expanded: !trigger.collapse}"></span> :class="{expanded: !trigger.collapse}"></span>
<el-icon v-if="trigger.custom" :name="trigger.private ? 's-opportunity' : 's-home'"></el-icon>
<span class="name" @click="toggleCollapse(trigger)"> <span class="name" @click="toggleCollapse(trigger)">
{{$t('events')[name] || name}}({{trigger.behaviors.length}}) {{$t('events')[name] || name}}({{trigger.behaviors.length}})
</span> </span>
...@@ -34,9 +36,11 @@ ...@@ -34,9 +36,11 @@
<div v-for="(behavior, index) in trigger.behaviors" class="behavior-item"> <div v-for="(behavior, index) in trigger.behaviors" class="behavior-item">
<enabled-setter :target="behavior"/> <enabled-setter :target="behavior"/>
<span v-if="!getBehavior(behavior)" class="name-field missing-behavior">{{$t('Missing behavior')}}</span> <span v-if="!getBehavior(behavior)" class="name-field missing-behavior">{{$t('Missing behavior')}}</span>
<input v-else class="name-field name-input" type="text" v-model="getBehavior(behavior).name" @change="onBehaviorNameChange"></input> <input v-else class="name-field name-input" type="text" v-model="getBehavior(behavior).name"
@change="onBehaviorNameChange"></input>
<el-popconfirm class="delete-button" @onConfirm="deleteBehavior(index, trigger.behaviors)" :title="$t('Are you sure to delete this behavior?')"> <el-popconfirm class="delete-button" @onConfirm="deleteBehavior(index, trigger.behaviors)"
:title="$t('Are you sure to delete this behavior?')">
<el-button slot="reference" icon="el-icon-minus" type="danger" plain circle size="mini"/> <el-button slot="reference" icon="el-icon-minus" type="danger" plain circle size="mini"/>
</el-popconfirm> </el-popconfirm>
<el-button icon="el-icon-edit" class="edit-button" type="primary" plain circle size="mini" <el-button icon="el-icon-edit" class="edit-button" type="primary" plain circle size="mini"
...@@ -86,9 +90,17 @@ ...@@ -86,9 +90,17 @@
}, },
addTrigger(command) { addTrigger(command) {
let trigger = {behaviors: []}; let trigger = {behaviors: []};
if (command === 'custom') { switch (command) {
case 'custom-global':
case 'custom-private':
trigger.custom = true; trigger.custom = true;
break;
} }
if (command === 'custom-private') {
trigger.private = true;
}
this.addBehavior(command, trigger.behaviors); this.addBehavior(command, trigger.behaviors);
this.$set(this.activeComponent.events, command, trigger); this.$set(this.activeComponent.events, command, trigger);
}, },
...@@ -151,7 +163,7 @@ ...@@ -151,7 +163,7 @@
editBehavior(behavior, behaviors) { editBehavior(behavior, behaviors) {
events.$emit('edit-behavior', [{process: behavior}]); events.$emit('edit-behavior', [{process: behavior}]);
}, },
onBehaviorNameChange(){ onBehaviorNameChange() {
this.makeProjectDirty(); this.makeProjectDirty();
}, },
async deleteBehavior(index, behaviors) { async deleteBehavior(index, behaviors) {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<board ref="board" <board ref="board"
@select-process-node="onSelectProcessNode" @select-process-node="onSelectProcessNode"
@edit-process="editProcess" @edit-process="editProcess"
@translate-to-normal="onTranslateToNormal" @transform="onClickTransform"
@edit-meta="onEditMeta"/> @edit-meta="onEditMeta"/>
</div> </div>
<div class="properties background full-size" splitpanes-min="20" :splitpanes-size="20"> <div class="properties background full-size" splitpanes-min="20" :splitpanes-size="20">
...@@ -153,10 +153,12 @@ ...@@ -153,10 +153,12 @@
} }
this.$refs.board.updateProcessNode(meta.id); this.$refs.board.updateProcessNode(meta.id);
}, },
onTranslateToNormal(meta, parentMeta) { onClickTransform(process, parentMeta) {
this.$confirm(this.$t('Are you sure to translate to normal process?'), this.$t('Alert')) const {isInline} = process.meta;
const inlineType = this.$t(isInline ? 'Common' : 'Inline');
this.$confirm(this.$t('Are you sure to transform process?', {inlineType}), this.$t('Alert'))
.then(() => { .then(() => {
this.translateToNormal({meta, parentMeta}); this.switchProcessInlineType({process, parentMeta});
}).catch(e => { }).catch(e => {
}) })
}, },
...@@ -169,7 +171,7 @@ ...@@ -169,7 +171,7 @@
'pushProcessStack', 'pushProcessStack',
'popProcessStack', 'popProcessStack',
'setScale', 'setScale',
'translateToNormal', 'switchProcessInlineType',
]), ]),
...mapGetters([ ...mapGetters([
'metaInUse', 'metaInUse',
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
@edit-meta="onEditMeta" @edit-meta="onEditMeta"
@dblclick="editSubProcess(process)" @dblclick="editSubProcess(process)"
@meta-modified="onProcessMetaModified" @meta-modified="onProcessMetaModified"
@translate-to-normal="onTranslateToNormal" @transform="onClickTransform"
/> />
</g> </g>
</g> </g>
...@@ -399,8 +399,8 @@ ...@@ -399,8 +399,8 @@
onEditMeta(meta, parentMeta) { onEditMeta(meta, parentMeta) {
this.$emit('edit-meta', meta, parentMeta); this.$emit('edit-meta', meta, parentMeta);
}, },
onTranslateToNormal(meta) { onClickTransform(process) {
this.$emit('translate-to-normal', meta, this.process.meta); this.$emit('transform', process, this.process.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)) {
......
...@@ -7,7 +7,11 @@ export default class Process { ...@@ -7,7 +7,11 @@ export default class Process {
this._resolveProcess = resolveProcess; this._resolveProcess = resolveProcess;
this._parent = parent; this._parent = parent;
this._data = data; this._data = data;
this.meta = typeof data.meta === 'string' ? this.resolveMeta(data.meta) : data.meta; if (typeof data.meta === 'string') {
this.metaID = data.meta;
} else {
this.meta = data.meta;
}
} }
get data() { get data() {
...@@ -22,6 +26,11 @@ export default class Process { ...@@ -22,6 +26,11 @@ export default class Process {
return this._data.uuid; return this._data.uuid;
} }
set metaID(id) {
this._data.meta = id;
this.meta = this.resolveMeta(id);
}
resolveMeta(id) { resolveMeta(id) {
let meta = this.meta && this.meta.metas ? this.meta.metas.find(meta => meta.id === id) : null; let meta = this.meta && this.meta.metas ? this.meta.metas.find(meta => meta.id === id) : null;
if (!meta && this._parent) { if (!meta && this._parent) {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
@mouseenter="onMouseEnter" @mouseenter="onMouseEnter"
@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-magic-stick" :underline="false" v-if="meta.isInline" @mousedown.stop.prevent @click.stop="onClickTranslate"/> <el-link icon="el-icon-magic-stick" :underline="false" v-if="meta.type !== 'builtin'" @mousedown.stop.prevent @click.stop="onClickTransform"/>
<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' && !meta.isDivider" <el-link icon="el-icon-edit" :underline="false" v-if="meta.type !== 'builtin' && !meta.isDivider"
@mousedown.stop.prevent @click.stop="onClickEdit"/> @mousedown.stop.prevent @click.stop="onClickEdit"/>
...@@ -249,8 +249,8 @@ ...@@ -249,8 +249,8 @@
this.$emit('down-pin', e, this.data, pin); this.$emit('down-pin', e, this.data, pin);
} }
}, },
onClickTranslate() { onClickTransform() {
this.$emit('translate-to-normal', this.meta); this.$emit('transform', this.process);
}, },
onClickDelete() { onClickDelete() {
this.$confirm(this.$t('Are you sure to delete this process?')) this.$confirm(this.$t('Are you sure to delete this process?'))
......
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