@mixd-id/web-scaffold 0.1.230406153 → 0.1.230406155

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406153",
4
+ "version": "0.1.230406155",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -126,7 +126,15 @@ export default{
126
126
 
127
127
  computedState(to, from){
128
128
  this.setState(to)
129
- }
129
+ },
130
+
131
+ $route(to, from){
132
+ if(from.path !== to.path && !to.hash){
133
+ let overlay = document.querySelector('.bW9k')
134
+ if(overlay && overlay.classList.contains('bW9l'))
135
+ overlay.classList.remove('bW9l')
136
+ }
137
+ },
130
138
 
131
139
  },
132
140
 
@@ -15,7 +15,7 @@ import {parseBoolean} from "../utils/helpers.mjs";
15
15
 
16
16
  export default{
17
17
 
18
- emits: [ 'change' ],
18
+ emits: [ 'change', 'update:modelValue' ],
19
19
 
20
20
  props:{
21
21
  name: String,
@@ -41,8 +41,6 @@
41
41
 
42
42
  <script>
43
43
 
44
- import {copyToClipboard} from "../utils/helpers.mjs";
45
-
46
44
  let dragged = null
47
45
  let guide1 = null
48
46
 
@@ -145,14 +143,6 @@ export default{
145
143
  }
146
144
  }
147
145
 
148
- /*console.log('#1', {
149
- startIdx,
150
- targetIdx,
151
- destIdx,
152
- moveDirection,
153
- dragArea: dragged.dragArea
154
- })*/
155
-
156
146
  dragged.targetParent.splice(destIdx, 0, dragged.parent.splice(startIdx, 1)[0])
157
147
 
158
148
  this.$emit('change')
@@ -181,7 +171,6 @@ export default{
181
171
  if(dragged.target !== this.item){
182
172
  const rect = this.$refs.item.getBoundingClientRect()
183
173
  dragged.centerY = rect.y + (rect.height / 2)
184
- //console.log('#BS', dragged.centerY, this.item.name)
185
174
  }
186
175
  dragged.target = this.item
187
176
  dragged.targetParent = this.parent
@@ -194,8 +183,6 @@ export default{
194
183
  this.$el.insertBefore(guide1, null)
195
184
  dragged.dragArea = 1
196
185
  }
197
-
198
- //console.log('centerY', dragged.dragArea, e.clientY, dragged.centerY)
199
186
  },
200
187
 
201
188
  hoverMouseOut(e){
@@ -215,10 +202,14 @@ export default{
215
202
 
216
203
  computed: {
217
204
 
205
+ isSelected(){
206
+ return this.selectedItem === this.item
207
+ },
208
+
218
209
  itemClass(){
219
210
  return [
220
211
  this.$style.item,
221
- this.selectedItem === this.item ? this.$style.active : '',
212
+ this.isSelected ? this.$style.active : '',
222
213
  this.state === 3 ? this.$style.active : '',
223
214
  ]
224
215
  .filter(_=>_)
@@ -232,7 +223,26 @@ export default{
232
223
  childCollapsed: false,
233
224
  hvm: null
234
225
  }
235
- }
226
+ },
227
+
228
+ watch: {
229
+
230
+ item: {
231
+ handler(){
232
+ this.childCollapsed = false
233
+ },
234
+ deep: true
235
+ },
236
+
237
+ isSelected(to){
238
+ if(to){
239
+ this.$el.scrollIntoView({
240
+ behavior: 'smooth',
241
+ })
242
+ }
243
+ }
244
+
245
+ },
236
246
 
237
247
  }
238
248
 
@@ -154,7 +154,7 @@
154
154
  <div class="flex flex-row gap-2">
155
155
  <label class="flex-1 text-text-400">{{ $t('Header')}}</label>
156
156
  <button type="button" class="text-primary"
157
- @click="$refs.webPageComponentSelector.open({ items:layout.headers })">
157
+ @click="$refs.webPageComponentSelector.open({ items:layout.headers, isLayout:true })">
158
158
  Add Header
159
159
  </button>
160
160
  </div>
@@ -174,7 +174,7 @@
174
174
  <div class="flex flex-row gap-2">
175
175
  <label class="flex-1 text-text-400">{{ $t('Footer')}}</label>
176
176
  <button type="button" class="text-primary"
177
- @click="$refs.webPageComponentSelector.open({ items:layout.footers })">
177
+ @click="$refs.webPageComponentSelector.open({ items:layout.footers, isLayout:true })">
178
178
  Add Footer
179
179
  </button>
180
180
  </div>
@@ -513,7 +513,7 @@ export default{
513
513
 
514
514
  methods: {
515
515
 
516
- addComponent({ type, items }){
516
+ addComponent({ type, items, isLayout }){
517
517
 
518
518
  let obj = this.availableComponents.find((_) => _.type === type)
519
519
  obj = JSON.parse(JSON.stringify(obj))
@@ -529,6 +529,8 @@ export default{
529
529
  this.store.selectedComponent = [ obj.uid ]
530
530
 
531
531
  this.$refs.webPageComponentSelector.close()
532
+
533
+ isLayout ? this.saveLayout() : this.save()
532
534
  },
533
535
 
534
536
  addDatasource(datasource){