group form nodes based on groups
This commit is contained in:
parent
a8b145382c
commit
692f7249a6
1 changed files with 86 additions and 73 deletions
|
@ -9,10 +9,21 @@
|
||||||
isUiNodeImageAttributes,
|
isUiNodeImageAttributes,
|
||||||
isUiNodeInputAttributes,
|
isUiNodeInputAttributes,
|
||||||
isUiNodeScriptAttributes,
|
isUiNodeScriptAttributes,
|
||||||
isUiNodeTextAttributes
|
isUiNodeTextAttributes,
|
||||||
|
filterNodesByGroups
|
||||||
} from '@ory/integrations/ui';
|
} from '@ory/integrations/ui';
|
||||||
|
|
||||||
export let ui: UiContainer;
|
export let ui: UiContainer;
|
||||||
|
|
||||||
|
let groups = [
|
||||||
|
...new Set(ui.nodes.map((node) => node.group).filter((group) => group != 'default'))
|
||||||
|
];
|
||||||
|
export let grouped_nodes = groups.map((group) =>
|
||||||
|
filterNodesByGroups({
|
||||||
|
nodes: ui.nodes,
|
||||||
|
groups: group
|
||||||
|
})
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if ui.messages}
|
{#if ui.messages}
|
||||||
|
@ -48,8 +59,9 @@
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<form action={ui.action} method={ui.method} class="space-y-3">
|
{#each grouped_nodes as node_group}
|
||||||
{#each ui.nodes as node}
|
<form action={ui.action} method={ui.method} class="space-y-3">
|
||||||
|
{#each node_group as node}
|
||||||
{#if isUiNodeTextAttributes(node.attributes)}
|
{#if isUiNodeTextAttributes(node.attributes)}
|
||||||
{node.attributes.text.text}
|
{node.attributes.text.text}
|
||||||
{:else if isUiNodeInputAttributes(node.attributes)}
|
{:else if isUiNodeInputAttributes(node.attributes)}
|
||||||
|
@ -130,4 +142,5 @@
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</form>
|
</form>
|
||||||
|
{/each}
|
||||||
|
|
Loading…
Reference in a new issue