mirror of
https://github.com/fluxscape/fluxscape.git
synced 2026-01-10 14:22:53 +01:00
chore(runtime): Clean up "Push Component To Stack" (#30)
This commit is contained in:
@@ -72,8 +72,10 @@ const Navigate = {
|
||||
backCallback: (action, results) => {
|
||||
this._internal.backResults = results;
|
||||
|
||||
for (var key in results) {
|
||||
if (this.hasOutput('backResult-' + key)) this.flagOutputDirty('backResult-' + key);
|
||||
for (const key in results) {
|
||||
if (this.hasOutput('backResult-' + key)) {
|
||||
this.flagOutputDirty('backResult-' + key);
|
||||
}
|
||||
}
|
||||
|
||||
if (action !== undefined) this.sendSignalOnOutput(action);
|
||||
@@ -114,22 +116,23 @@ const Navigate = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (name === 'target')
|
||||
if (name === 'target') {
|
||||
return this.registerInput(name, {
|
||||
set: this.setTargetPageId.bind(this)
|
||||
});
|
||||
else if (name === 'transition')
|
||||
} else if (name === 'transition') {
|
||||
return this.registerInput(name, {
|
||||
set: this.setTransition.bind(this)
|
||||
});
|
||||
else if (name.startsWith('tr-'))
|
||||
} else if (name.startsWith('tr-')) {
|
||||
return this.registerInput(name, {
|
||||
set: this.setTransitionParam.bind(this, name.substring('tr-'.length))
|
||||
});
|
||||
else if (name.startsWith('pm-'))
|
||||
} else if (name.startsWith('pm-')) {
|
||||
return this.registerInput(name, {
|
||||
set: this.setPageParam.bind(this, name.substring('pm-'.length))
|
||||
});
|
||||
}
|
||||
},
|
||||
registerOutputIfNeeded: function (name) {
|
||||
if (this.hasOutput(name)) {
|
||||
@@ -174,18 +177,24 @@ function setup(context, graphModel) {
|
||||
if (Transitions[transition]) ports = ports.concat(Transitions[transition].ports(node.parameters));
|
||||
}
|
||||
|
||||
// if(node.parameters['stack'] !== undefined) {
|
||||
var pageStacks = graphModel.getNodesWithType('Page Stack');
|
||||
var pageStack = pageStacks.find(
|
||||
const pageStacks = graphModel.getNodesWithType('Page Stack');
|
||||
const pageStack = pageStacks.find(
|
||||
(ps) => (ps.parameters['name'] || 'Main') === (node.parameters['stack'] || 'Main')
|
||||
);
|
||||
|
||||
if (pageStack !== undefined) {
|
||||
var pages = pageStack.parameters['pages'];
|
||||
const pages = pageStack.parameters['pages'];
|
||||
if (pages !== undefined && pages.length > 0) {
|
||||
ports.push({
|
||||
plug: 'input',
|
||||
type: { name: 'enum', enums: pages.map((p) => ({ label: p.label, value: p.id })), allowEditOnly: true },
|
||||
type: {
|
||||
name: 'enum',
|
||||
enums: pages.map((p) => ({
|
||||
label: p.label,
|
||||
value: p.id
|
||||
})),
|
||||
allowEditOnly: true
|
||||
},
|
||||
group: 'General',
|
||||
displayName: 'Target Page',
|
||||
name: 'target',
|
||||
@@ -193,14 +202,14 @@ function setup(context, graphModel) {
|
||||
});
|
||||
|
||||
// See if there is a target page with component
|
||||
var targetPageId = node.parameters['target'] || pages[0].id;
|
||||
var targetComponentName = pageStack.parameters['pageComp-' + targetPageId];
|
||||
const targetPageId = node.parameters['target'] || pages[0].id;
|
||||
const targetComponentName = pageStack.parameters['pageComp-' + targetPageId];
|
||||
if (targetComponentName !== undefined) {
|
||||
const component = graphModel.components[targetComponentName];
|
||||
|
||||
if (component !== undefined) {
|
||||
// Make all inputs of the component to inputs of this navigation node
|
||||
for (var inputName in component.inputPorts) {
|
||||
for (const inputName in component.inputPorts) {
|
||||
ports.push({
|
||||
name: 'pm-' + inputName,
|
||||
displayName: inputName,
|
||||
@@ -245,7 +254,6 @@ function setup(context, graphModel) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
context.editorConnection.sendDynamicPorts(node.id, ports);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user