-
Notifications
You must be signed in to change notification settings - Fork 239
Expand file tree
/
Copy pathProjectProperty.vue
More file actions
263 lines (244 loc) · 7.86 KB
/
ProjectProperty.vue
File metadata and controls
263 lines (244 loc) · 7.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<template>
<p>
<span>Project:</span>
<!-- class="objectPropertyAttribute" -->
<input
id="projname"
type="text"
autocomplete="off"
name="setProjectName"
v-model="projectStore.project.name"
:oninput="projectStore.setProjectNameDefined"
/>
</p>
<p>
<span>Circuit:</span>
<input
:ref="circnameInput"
id="circname"
:key="SimulatorState.activeCircuit?.id"
class="objectPropertyAttribute"
type="text"
autocomplete="off"
name="changeCircuitName"
:value="SimulatorState.activeCircuit?.name"
/>
</p>
<InputGroups
property-name="Clock Time (ms):"
:property-value="(simulationArea as any).timePeriod"
property-value-type="number"
value-min="50"
step-size="10"
property-input-name="changeClockTime"
property-input-id="clockTime"
/>
<p>
<span>Clock Enabled:</span>
<label class="switch">
<input
type="checkbox"
class="objectPropertyAttributeChecked"
name="changeClockEnable"
checked
/>
<span class="slider"></span
></label>
</p>
<p>
<span>Lite Mode:</span>
<label class="switch">
<input
type="checkbox"
class="objectPropertyAttributeChecked"
name="changeLightMode"
/>
<span class="slider"></span>
</label>
</p>
<p>
<button
type="button"
class="panelButton btn btn-xs custom-btn--primary"
@click="() => {
toggleLayoutMode()
simulatorMobileStore.showPropertiesPanel = false
simulatorMobileStore.showCircuits = 'layout-elements'
}"
>
Edit Layout
</button>
<button
type="button"
class="panelButton btn btn-xs custom-btn--tertiary"
@click.stop="closeCircuit(SimulatorState.activeCircuit)"
>
Delete Circuit
</button>
</p>
<!-- <MessageBox
v-model="SimulatorState.dialogBox.delete_circuit"
:circuit-item="circuitToDelete"
:button-list="buttonArray"
:is-persistent="ifPersistentShow"
:message-text="messageValue"
@button-click="
(selectedOption, circuitItem) =>
dialogBoxConformation(selectedOption, circuitItem)
"
/> -->
<!-- <DeleteCircuit /> -->
</template>
<script lang="ts" setup>
import { toggleLayoutMode } from '#/simulator/src/layoutMode'
// import {
// deleteCurrentCircuit,
// getDependenciesList,
// scopeList,
// } from '#/simulator/src/circuit'
// import { showMessage } from '#/simulator/src/utils'
import { simulationArea } from '#/simulator/src/simulationArea'
import InputGroups from '#/components/Panels/Shared/InputGroups.vue'
// import MessageBox from '#/components/MessageBox/messageBox.vue'
// import { ref, Ref, onMounted, watch } from 'vue'
import { useState } from '#/store/SimulatorStore/state'
import { useProjectStore } from '#/store/projectStore'
// import DeleteCircuit from '#/components/helpers/deleteCircuit/DeleteCircuit.vue'
import { closeCircuit } from '#/components/helpers/deleteCircuit/DeleteCircuit.vue'
import { useSimulatorMobileStore } from '#/store/simulatorMobileStore'
import { watch } from 'vue'
import { ref } from 'vue'
const projectStore = useProjectStore()
const SimulatorState = <SimulatorStateType>useState()
const circnameInput = ref<HTMLInputElement | null>(null)
const simulatorMobileStore = useSimulatorMobileStore()
watch(() => SimulatorState.circuit_name_clickable, () => {
setTimeout(() => {
if (circnameInput.value && SimulatorState.circuit_name_clickable) {
circnameInput.value.select()
}
}, 100)
})
// const circuitId: Ref<string | number> = ref(0)
// const circuitName: Ref<string> = ref('Untitled-Cirucit')
// const ifPersistentShow: Ref<boolean> = ref(false)
// const messageValue: Ref<string> = ref('')
// const buttonArray: Ref<Array<buttonArrType>> = ref([
// { text: '', emitOption: '' },
// ])
// const circuitToDelete: Ref<Object> = ref({})
type SimulatorStateType = {
activeCircuit: {
id: string | number
name: string
}
circuit_list: Array<Object>
dialogBox: {
delete_circuit: boolean
}
circuit_name_clickable: boolean
}
// type CircuitItem = {
// id: string | number
// name: string
// }
// type buttonArrType = {
// text: string
// emitOption: string
// }
// onMounted(() => {
// // checking if circuit or tab is switched
// // setInterval(() => {
// // if (circuitId.value != globalScope.id) {
// // circuitName.value = globalScope.name
// // circuitId.value = globalScope.id
// // }
// // }, 250)
// watch(
// () => SimulatorState.activeCircuit,
// () => {
// circuitName.value = SimulatorState.activeCircuit.name
// circuitId.value = SimulatorState.activeCircuit.id
// },
// { deep: true }
// )
// })
// function clearMessageBoxFields(): void {
// SimulatorState.dialogBox.delete_circuit = false
// ifPersistentShow.value = false
// messageValue.value = ''
// buttonArray.value = []
// }
// function closeCircuit(circuitItem: CircuitItem): void {
// clearMessageBoxFields()
// // check circuit count
// if (SimulatorState.circuit_list.length <= 1) {
// SimulatorState.dialogBox.delete_circuit = true
// ifPersistentShow.value = false
// messageValue.value =
// 'At least 2 circuits need to be there in order to delete a circuit.'
// buttonArray.value = [
// {
// text: 'Close',
// emitOption: 'dispMessage',
// },
// ]
// return
// }
// clearMessageBoxFields()
// let dependencies = getDependenciesList(circuitItem.id)
// if (dependencies) {
// dependencies = `\nThe following circuits are depending on '${
// scopeList[circuitItem.id].name
// }': [ ${dependencies} ].\n Delete subcircuits of ${
// scopeList[circuitItem.id].name
// } before trying to delete ${scopeList[circuitItem.id].name}`
// SimulatorState.dialogBox.delete_circuit = true
// ifPersistentShow.value = true
// messageValue.value = dependencies
// buttonArray.value = [
// {
// text: 'OK',
// emitOption: 'dispMessage',
// },
// ]
// return
// }
// clearMessageBoxFields()
// SimulatorState.dialogBox.delete_circuit = true
// ifPersistentShow.value = true
// buttonArray.value = [
// {
// text: 'Continue',
// emitOption: 'confirmDeletion',
// },
// {
// text: 'Cancel',
// emitOption: 'cancelDeletion',
// },
// ]
// circuitToDelete.value = circuitItem
// messageValue.value = `Are you sure want to close: ${
// scopeList[circuitItem.id].name
// }\nThis cannot be undone.`
// }
// function dialogBoxConformation(
// selectedOption: string,
// circuitItem: CircuitItem
// ): void {
// SimulatorState.dialogBox.delete_circuit = false
// if (selectedOption == 'confirmDeletion') {
// deleteCurrentCircuit(circuitItem.id)
// } else if (selectedOption == 'cancelDeletion') {
// showMessage('Circuit was not closed')
// }
// }
</script>
<style scoped>
.panelButton {
width: 100%;
margin-bottom: 5px;
}
</style>
<!-- TODO: add type to scopeList -->
<!-- Note: Clock timer and clock enable crash issue fixed with debouncing in ux.js -->