2019-08-07 10:03:49 +02:00
|
|
|
<script>
|
|
|
|
|
|
|
|
import ComponentSearch from "./ComponentSearch.svelte";
|
|
|
|
import { store } from "../builderStore";
|
|
|
|
import PropsView from "./PropsView.svelte";
|
|
|
|
import Textbox from "../common/Textbox.svelte";
|
2019-08-14 23:11:59 +02:00
|
|
|
import Button from "../common/Button.svelte";
|
|
|
|
import ButtonGroup from "../common/ButtonGroup.svelte";
|
|
|
|
import { pipe } from "../common/core";
|
|
|
|
import UIkit from "uikit";
|
|
|
|
import {
|
|
|
|
getNewComponentInfo
|
|
|
|
} from "./pagesParsing/createProps";
|
|
|
|
import { isRootComponent } from "./pagesParsing/searchComponents";
|
2019-08-07 10:03:49 +02:00
|
|
|
|
2019-08-14 23:11:59 +02:00
|
|
|
import {
|
|
|
|
cloneDeep,
|
|
|
|
join,
|
|
|
|
split,
|
|
|
|
map,
|
|
|
|
keys,
|
|
|
|
isUndefined
|
|
|
|
} from "lodash/fp";
|
|
|
|
import { assign } from "lodash";
|
2019-08-07 10:03:49 +02:00
|
|
|
|
2019-08-14 23:11:59 +02:00
|
|
|
|
|
|
|
|
2019-08-16 16:48:45 +02:00
|
|
|
let modalElement;
|
|
|
|
let allComponents;
|
2019-08-14 23:11:59 +02:00
|
|
|
|
2019-08-16 16:48:45 +02:00
|
|
|
store.subscribe(s => {
|
|
|
|
allComponents = s.allComponents;
|
|
|
|
})
|
2019-08-14 23:11:59 +02:00
|
|
|
|
2019-08-16 16:48:45 +02:00
|
|
|
export const close = () => {
|
2019-08-14 23:11:59 +02:00
|
|
|
UIkit.modal(modalElement).hide();
|
|
|
|
}
|
|
|
|
|
2019-08-16 16:48:45 +02:00
|
|
|
export const show = () => {
|
|
|
|
UIkit.modal(modalElement).show();
|
2019-08-14 23:11:59 +02:00
|
|
|
}
|
|
|
|
|
2019-08-16 16:48:45 +02:00
|
|
|
const onComponentChosen = (c) => {
|
|
|
|
store.createDerivedComponent(c.name);
|
|
|
|
close();
|
2019-08-07 10:03:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
2019-08-14 23:11:59 +02:00
|
|
|
<div bind:this={modalElement} id="new-component-modal" uk-modal>
|
|
|
|
<div class="uk-modal-dialog">
|
|
|
|
|
|
|
|
<div class="uk-modal-header">
|
|
|
|
<h1>New Component</h1>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="uk-modal-body">
|
2019-08-16 16:48:45 +02:00
|
|
|
<ComponentSearch onComponentChosen={onComponentChosen} />
|
2019-08-14 23:11:59 +02:00
|
|
|
</div>
|
2019-08-07 10:03:49 +02:00
|
|
|
</div>
|
2019-08-14 23:11:59 +02:00
|
|
|
</div>
|
2019-08-07 10:03:49 +02:00
|
|
|
|
|
|
|
<style>
|
2019-08-14 23:11:59 +02:00
|
|
|
h1 {
|
|
|
|
font-size:1.2em;
|
|
|
|
}
|
|
|
|
|
2019-08-07 10:03:49 +02:00
|
|
|
</style>
|