Skip to content

Commit 30556a7

Browse files
bug fixed
2 parents bd1e740 + b541aae commit 30556a7

File tree

12 files changed

+137
-141
lines changed

12 files changed

+137
-141
lines changed

package-lock.json

Lines changed: 1 addition & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Canvas.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
>
4141

4242
<div class="component-title">
43-
<p>{{ componentData.componentName }}</p>
43+
<p>{{ componentData.componentName }}<span v-if="isElementPlus(componentData.htmlList)"> (Element+)</span></p>
4444
</div>
4545
<q-icon v-if="componentData.componentName === this.activeComponent"
4646
size="25px"
@@ -536,6 +536,10 @@ export default {
536536
// this.initialPosition.x = this.activeComponentData.x;
537537
// this.initialPosition.y = this.activeComponentData.y;
538538
// },
539+
isElementPlus(htmlList) {
540+
console.log(htmlList);
541+
return htmlList.find(({ text }) => text[0] === 'e');
542+
},
539543
//color change function
540544
updateColors(data) {
541545
let payload = {
@@ -643,6 +647,7 @@ export default {
643647
644648
// renders modal with Update Children and Layer in it
645649
handleAddNotes() {
650+
console.log(this.activeComponentData);
646651
if (this.wasDragged === false && this.activeComponent !== '') {
647652
this.openNoteModal();
648653
}
@@ -914,7 +919,7 @@ behavior: url(/pie/PIE.htc);
914919
position: absolute;
915920
font-size: 3em;
916921
margin-top: -4%;
917-
margin-left: 23%;
922+
margin-left: 29%;
918923
color: black;
919924
}
920925

src/components/composables/useCreateComponent.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import * as ElementPlus from '../../../node_modules/element-plus/es/components' // importing all components from Element Plus with install wrappers
1+
// import * as ElementPlus from '../../../node_modules/element-plus/es/components' // importing all components from Element Plus with install wrappers
22

33
export function useCreateComponent(importObj) {
4-
54
const createComponent = (importObj) => {
65
let imported = false; //alter this logic once ready to import components
76
if (importObj.hasOwnProperty('componentName')) {
@@ -29,10 +28,12 @@ export function useCreateComponent(importObj) {
2928
return false;
3029
}
3130
// boilerplate properties for each component upon creation
31+
console.log(importObj.parent);
32+
console.log({ y: importObj?.parent?.y })
3233
const component = {
33-
x: 0,
34-
y: 0,
35-
z: 0,
34+
x: importObj?.parent?.x ?? 0,
35+
y: importObj?.parent?.y ?? 0,
36+
z: importObj?.parent?.z ?? 0,
3637
htmlList: this.selectedElementList,
3738
noteList: [],
3839
children: [],
@@ -68,7 +69,7 @@ export function useCreateComponent(importObj) {
6869
createComponent(importObj)
6970

7071
// console logging all components from Element Plus to determine shape of data and investigate structure of components
71-
console.log(ElementPlus)
72+
// console.log(ElementPlus)
7273
// components all within giant object
7374
}
7475

src/components/composables/useExportComponent.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ export function useExportComponent() {
99
*
1010
*/
1111

12-
const showExportComponentDialog = () => {
13-
ipcRenderer
14-
.invoke("exportComponent", {
12+
const exportComponent = () => {
13+
ipcRenderer.invoke("exportComponent", {
1514
title: "Choose location to save folder in",
1615
message: "Choose location to save folder in",
1716
nameFieldLabel: "Component Name",
@@ -356,5 +355,5 @@ z-index: ${html.z};
356355
this.componentMap[this.activeComponent].children
357356
);
358357
}
359-
showExportComponentDialog();
358+
exportComponent();
360359
}

src/components/left-sidebar/ComponentTab/CreateMenu.vue

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,36 @@ Description:
88
<template>
99
<div class="create-component-div drawer-menu">
1010

11-
<q-expansion-item group="accordion" label="Create Component" >
12-
<ImportLibraryButton></ImportLibraryButton>
11+
<form class="create-component-form" v-on:submit.prevent="createComponent">
12+
<!-- will render if creating new component -->
13+
<q-input
14+
v-if="activeComponent === ''"
15+
v-on:keyup.delete.stop
16+
v-model="componentNameInputValue"
17+
label="Set component name *"
18+
color="white"
19+
dark
20+
dense
21+
outlined
22+
item-aligned
23+
padding="5px"
24+
class="input-add"
25+
no-error-icon
26+
reactive-rules
27+
:rules="[ val => val.length != 0 || 'Please set a component name', val => !Object.keys(this.componentMap).includes(val) || 'A component/route with this name already exists' ]"
28+
></q-input>
29+
</form>
30+
31+
<ParentMultiselect
32+
@addparent="parent = $event"
33+
v-if="activeComponent === ''"></ParentMultiselect>
34+
35+
<!-- <q-expansion-item group="accordion" label="Create Component" > -->
1336
<LibComponents></LibComponents>
1437
<div class="searchinput">
15-
<q-input v-if ="this.$store.state.displaylibComponent" outlined v-model="input" placeholder="Please input" label="Search Component"
1638

39+
<q-input outlined v-model="input" placeholder="Please input" label="Search Element+ Components"
40+
id="searchbox"
1741
color="white"
1842
dark
1943
dense
@@ -22,6 +46,7 @@ Description:
2246
class="input-add"
2347
no-error-icon
2448
/>
49+
2550
</div>
2651

2752

@@ -35,33 +60,8 @@ Description:
3560

3661
</q-tooltip>
3762
</q-item>
38-
39-
40-
4163
</q-list>
4264

43-
<form class="create-component-form" v-on:submit.prevent="createComponent">
44-
<!-- will render if creating new component -->
45-
<q-input
46-
v-if="activeComponent === ''"
47-
v-on:keyup.delete.stop
48-
v-model="componentNameInputValue"
49-
label="Set component name *"
50-
color="white"
51-
dark
52-
dense
53-
outlined
54-
item-aligned
55-
padding="5px"
56-
class="input-add"
57-
no-error-icon
58-
reactive-rules
59-
:rules="[ val => val.length != 0 || 'Please set a component name', val => !Object.keys(this.componentMap).includes(val) || 'A component/route with this name already exists' ]"
60-
></q-input>
61-
</form>
62-
63-
<ParentMultiselect v-if="activeComponent === ''"></ParentMultiselect>
64-
6565
<div class="subsection">Elements/Components</div>
6666
<div class="icon-container">
6767
<Icons
@@ -89,7 +89,7 @@ Description:
8989
:disabled="!componentNameInputValue.trim() || Object.keys(this.componentMap).includes(componentNameInputValue.trim())"
9090
/>
9191

92-
</q-expansion-item>
92+
<!-- </q-expansion-item> -->
9393
</div>
9494
</template>
9595

@@ -108,6 +108,7 @@ export default {
108108
data(){
109109
return {
110110
input:'',
111+
parent: '',
111112
libArray:[
112113
{
113114
name:'alert',
@@ -200,7 +201,7 @@ export default {
200201
"userActions",
201202
"userState",
202203
"userProps",
203-
204+
"routes",
204205
]),
205206
componentNameInputValue: {
206207
get() {
@@ -245,11 +246,13 @@ pickComponent(componentName){
245246
this.addLibComponents(payload);
246247
247248
}
248-
249249
,
250-
251250
createComponent() {
252-
useCreateComponent.bind(this)({}) //invokes composable
251+
// need to find a dynamic solution to pull current route, here set to HomeView
252+
// Parses array of components off routes, then finds parent element name (id), then passes parent into useCreateComponent, where x, y and z are pulled off the parent object
253+
const parent = JSON.parse(
254+
JSON.stringify(this.routes.HomeView)).find((ele) => ele.componentName === this.parent);
255+
useCreateComponent.bind(this)({ parent }) //invokes composable
253256
},
254257
},
255258
watch: {
@@ -275,7 +278,6 @@ pickComponent(componentName){
275278
justify-content: flex-start;
276279
align-items: stretch;
277280
padding: -20px;
278-
margin-right: 10px;
279281
}
280282
.subsection {
281283
border-top: 1px solid rgba(245, 245, 245, 0.3);
@@ -308,8 +310,11 @@ pickComponent(componentName){
308310
max-width: 600px;
309311
}
310312
.searchinput{
311-
margin-right: 10px;
313+
314+
width: 260px;
315+
312316
}
313317
314318
319+
315320
</style>

src/components/left-sidebar/ComponentTab/LibComponents.vue

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
<template>
22

3-
<div class=""
4-
5-
v-if = "this.$store.state.displaylibComponent">
6-
7-
8-
9-
<q-btn-dropdown class="selectLib" color="pink" label="Select Library Component" dropdown-icon="change_history">
3+
<div class="">
4+
<q-btn-dropdown class="selectLib" color="pink" label="Select Element+ Component" dropdown-icon="change_history">
105
<q-list class="dropButton">
116

127
<q-item clickable v-close-popup @click="pickComponent('e-alert')">

src/components/left-sidebar/ComponentTab/ParentMultiselect.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export default {
4444
// 'routes'
4545
]),
4646
options() {
47+
console.log(this.routes);
4748
return this.routes[this.activeRoute].map(
4849
(component) => component.componentName
4950
);
@@ -53,6 +54,7 @@ export default {
5354
...mapActions(["parentSelected", "setActiveComponent"]),
5455
selectParent(value) {
5556
this.parentSelected(value);
57+
this.$emit("addparent", value);
5658
},
5759
// when multiselect is opened activeComponent is deselected to allow for parentSelected action
5860
resetActiveComponent() {

src/components/left-sidebar/ComponentTab/UpdateMenu.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ Description:
110110
</q-expansion-item>
111111

112112
</q-list>
113+
<q-btn
114+
id="create-component-btn"
115+
class="sidebar-btn"
116+
color="secondary"
117+
label="Done"
118+
@click="resetActiveComponent"
119+
/>
113120
<q-btn
114121
id="exportButton"
115122
class="sidebar-btn"
@@ -175,6 +182,7 @@ export default {
175182
"componentMap",
176183
"exportAsTypescript",
177184
'attributeModalOpen',
185+
178186
]),
179187
180188
activeRouteDisplay() {
@@ -418,7 +426,7 @@ p {
418426
margin-bottom: 30px;
419427
}
420428
421-
#exportButton {
429+
#exportButton, #create-component-btn {
422430
background-color: $secondary;
423431
color: $menutext;
424432
width: 100%;

0 commit comments

Comments
 (0)