@mixd-id/web-scaffold 0.1.230406300 → 0.1.230406301

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.
Files changed (38) hide show
  1. package/docs/components/Header2.md +16 -0
  2. package/docs/components/TreeView.md +0 -0
  3. package/package.json +1 -1
  4. package/src/components/Checkbox.vue +1 -0
  5. package/src/components/TreeView.vue +29 -19
  6. package/src/components/TreeViewItem.vue +91 -81
  7. package/src/index.js +61 -2
  8. package/src/stores/components.js +36 -0
  9. package/src/widgets/ArticleSetting.vue +15 -31
  10. package/src/widgets/BackgroundSetting.vue +132 -0
  11. package/src/widgets/BorderSetting.vue +201 -0
  12. package/src/widgets/ButtonSetting.vue +21 -92
  13. package/src/widgets/CarouselSetting.vue +53 -141
  14. package/src/widgets/ComponentPropertyLabel.vue +35 -0
  15. package/src/widgets/ComponentPropertySelector.vue +115 -0
  16. package/src/widgets/ComponentSetting2.vue +1 -3
  17. package/src/widgets/ComponentSetting3.vue +231 -0
  18. package/src/widgets/EffectSetting.vue +94 -0
  19. package/src/widgets/FiltersSetting.vue +88 -0
  20. package/src/widgets/FlexSetting.vue +182 -168
  21. package/src/widgets/GridSetting.vue +97 -260
  22. package/src/widgets/Header2.vue +40 -25
  23. package/src/widgets/Header2Setting.vue +103 -209
  24. package/src/widgets/IconSelector.vue +179 -0
  25. package/src/widgets/ImageSetting.vue +42 -110
  26. package/src/widgets/LayoutSetting.vue +251 -0
  27. package/src/widgets/MarginPaddingSetting.vue +58 -0
  28. package/src/widgets/MarginSetting.vue +57 -35
  29. package/src/widgets/MenuEditor.vue +159 -0
  30. package/src/widgets/PaddingSetting.vue +53 -31
  31. package/src/widgets/ParagraphSetting.vue +7 -32
  32. package/src/widgets/SizingSetting.vue +306 -0
  33. package/src/widgets/SpacingSetting.vue +77 -0
  34. package/src/widgets/SvgSetting.vue +82 -106
  35. package/src/widgets/TransitionSetting.vue +64 -0
  36. package/src/widgets/TypographySetting.vue +334 -0
  37. package/src/widgets/WebComponentSelector.vue +24 -8
  38. package/src/widgets/WebPageBuilder2.vue +508 -155
@@ -0,0 +1,16 @@
1
+ # Header 2
2
+
3
+ ### Properties
4
+ | Name | Type | Default | Description |
5
+ |--------------------------|--------|---------|----------------------------|
6
+ | `logo` | Array | [] | Responsive Array of Object |
7
+ | `logo[].url` | String | | Logo url |
8
+ | `icons` | Array | {} | Responsive Array of Object |
9
+ | `icons[].items` | Array | {} | Array of Object |
10
+ | `icons[].items[].icon` | String | | (required) icon value |
11
+ | `icons[].items[].target` | String | | (required) target value |
12
+ | `icons[].items[].text` | String | route | route, search |
13
+ | `menu[].items[].icon` | String | | svg, image |
14
+ | `menu[].items[].text` | String | | |
15
+ | `menu[].items[].target` | String | | |
16
+ | `menu[].items[].items` | Array | | |
File without changes
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.230406300",
4
+ "version": "0.1.230406301",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -61,6 +61,7 @@ export default {
61
61
  return this.modelValue.includes(this.value)
62
62
  }
63
63
  else if(this.modelValue){
64
+ console.log(2, this.value, this.modelValue)
64
65
  return this.value === this.modelValue
65
66
  }
66
67
  else{
@@ -1,17 +1,17 @@
1
1
  <template>
2
2
  <div :class="$style.comp">
3
3
 
4
- <TreeViewItem v-for="(item, index) in modelValue"
4
+ <TreeViewItem v-for="(item, index) in items"
5
5
  :item="item"
6
- :parent="modelValue"
7
- :selected-item="selectedItem"
6
+ :index="index"
7
+ :parent="parent"
8
+ :depth="0"
9
+ :model-value="modelValue"
8
10
  @moveup="moveUp(item)"
9
11
  @movedown="moveDown(item)"
10
- @change="$emit('change')"
11
- @remove="confirm({ title:$t('Remove this item?'), onConfirm: () => { modelValue.splice(index, 1);$emit('change') }})"
12
- @add="(items) => $emit('add', items)">
13
- <template #default="{ item, parent }">
14
- <slot :item="item" :parent="parent"></slot>
12
+ @change="$emit('change')">
13
+ <template #default="{ item, parent, index, depth }">
14
+ <slot :item="item" :parent="parent" :index="index" :depth="depth"></slot>
15
15
  </template>
16
16
  </TreeViewItem>
17
17
 
@@ -27,23 +27,23 @@ export default{
27
27
 
28
28
  components: {TreeViewItem},
29
29
 
30
- emits: [ 'add', 'change', 'paste' ],
30
+ emits: [ 'change', 'paste' ],
31
31
 
32
32
  inject: [ 'confirm', 'toast' ],
33
33
 
34
34
  props: {
35
35
 
36
- modelValue: Array,
36
+ items: Array,
37
37
 
38
- selectedItem: Object
38
+ modelValue: Object
39
39
 
40
40
  },
41
41
 
42
42
  methods: {
43
43
 
44
44
  copy(){
45
- if(this.selectedItem){
46
- copyToClipboard(JSON.stringify(this.selectedItem))
45
+ if(this.modelValue){
46
+ copyToClipboard(JSON.stringify(this.modelValue))
47
47
  .then(() => this.toast('Copied to clipboard'))
48
48
  }
49
49
  },
@@ -59,23 +59,23 @@ export default{
59
59
  },
60
60
 
61
61
  moveDown(item){
62
- const idx = this.modelValue.indexOf(item)
63
- if(idx < this.modelValue.length - 1){
64
- this.modelValue.splice(idx + 1, 0, this.modelValue.splice(idx, 1)[0])
62
+ const idx = this.items.indexOf(item)
63
+ if(idx < this.items.length - 1){
64
+ this.items.splice(idx + 1, 0, this.items.splice(idx, 1)[0])
65
65
  this.$emit('change')
66
66
  }
67
67
  },
68
68
 
69
69
  moveUp(item){
70
- const idx = this.modelValue.indexOf(item)
70
+ const idx = this.items.indexOf(item)
71
71
  if(idx - 1 >= 0){
72
- this.modelValue.splice(idx - 1, 0, this.modelValue.splice(idx, 1)[0])
72
+ this.items.splice(idx - 1, 0, this.items.splice(idx, 1)[0])
73
73
  this.$emit('change')
74
74
  }
75
75
  },
76
76
 
77
77
  add(){
78
- this.$emit('add', this.modelValue)
78
+ this.$emit('add', this.items)
79
79
  },
80
80
 
81
81
  },
@@ -84,6 +84,16 @@ export default{
84
84
  window.addEventListener('keydown', this.onKeyUp)
85
85
  },
86
86
 
87
+ computed: {
88
+
89
+ parent(){
90
+ return {
91
+ items: this.items
92
+ }
93
+ }
94
+
95
+ },
96
+
87
97
  watch: {
88
98
 
89
99
 
@@ -1,22 +1,26 @@
1
1
  <template>
2
- <div @mousemove="hoverMouseOver"
3
- @mouseout="hoverMouseOut">
2
+ <div>
4
3
  <div ref="item"
5
4
  :class="itemClass"
6
- @mousedown="mouseDown">
7
-
8
- <button type="button" class="p-1 w-[18px]"
9
- v-if="Array.isArray((item ?? {}).items) && item.items.length > 0"
10
- @click="childCollapsed = !childCollapsed">
11
- <svg v-if="!childCollapsed" width="14" height="14" class="fill-text-300 pointer-events-none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"/></svg>
12
- <svg v-else width="14" height="14" class="fill-text-300 pointer-events-none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 512"><path d="M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"/></svg>
13
- </button>
5
+ @mousemove="hoverMouseOver"
6
+ @mouseout="hoverMouseOut">
7
+
8
+ <div class="flex-1 flex flex-row items-center px-2">
9
+ <div @mousedown="mouseDown" class="pr-3">
10
+ <svg width="11" height="11" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496 288H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-128H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16z"/></svg>
11
+ </div>
12
+
13
+ <button type="button" class="pr-2"
14
+ v-if="Array.isArray((item ?? {}).items) && item.items.length > 0"
15
+ @click="childCollapsed = !childCollapsed">
16
+ <svg v-if="!childCollapsed" width="14" height="14" class="fill-text-300 pointer-events-none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"/></svg>
17
+ <svg v-else width="14" height="14" class="fill-text-300 pointer-events-none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 512"><path d="M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"/></svg>
18
+ </button>
14
19
 
15
- <div class="flex-1 flex px-3">
16
- <slot :item="item" :parent="parent"></slot>
20
+ <slot :item="item" :parent="parent" :index="index" :depth="depth"></slot>
17
21
  </div>
18
22
 
19
- <div class="flex flex-row items-center">
23
+ <div class="hidden flex flex-row items-center">
20
24
  <button v-if="item && Array.isArray(item.items)"
21
25
  type="button"
22
26
  class="p-1"
@@ -33,20 +37,18 @@
33
37
 
34
38
  </div>
35
39
  <div ref="container"
36
- v-show="item && Array.isArray(item.items) && !childCollapsed" class="ml-6"
37
- @mousemove.stop=""
38
- @mouseout.stop="">
40
+ v-show="item && Array.isArray(item.items) && !childCollapsed" class="ml-6">
39
41
  <TreeViewItem v-for="(subItem, index) in item.items"
40
42
  :item="subItem"
41
- :parent="item.items"
42
- :selected-item="selectedItem"
43
+ :parent="item"
44
+ :index="index"
45
+ :depth="depth + 1"
46
+ :model-value="modelValue"
43
47
  @moveup="moveUp(subItem)"
44
48
  @movedown="moveDown(subItem)"
45
- @remove="confirm({ title:$t('Remove this item?'), onConfirm: () => { item.items.splice(index, 1);$emit('change') }})"
46
- @add="(items) => $emit('add', items)"
47
49
  @change="$emit('change')">
48
- <template #default="{ item }">
49
- <slot :item="item"></slot>
50
+ <template #default="{ item, parent, index, depth }">
51
+ <slot :item="item" :parent="parent" :index="index" :depth="depth"></slot>
50
52
  </template>
51
53
  </TreeViewItem>
52
54
  </div>
@@ -62,17 +64,17 @@ export default{
62
64
 
63
65
  name: 'TreeViewItem',
64
66
 
65
- emits: [ 'add', 'change', 'moveup', 'movedown', 'remove' ],
67
+ emits: [ 'change', 'moveup', 'movedown' ],
66
68
 
67
- inject: [ 'confirm', 'toast', 'store', 'getConfig' ],
69
+ inject: [ 'confirm', 'toast' ],
68
70
 
69
71
  props: {
72
+ config: Object,
70
73
  item: Object,
71
-
72
- parent: Array,
73
-
74
- selectedItem: Object,
75
-
74
+ parent: Object,
75
+ index: Number,
76
+ depth: Number,
77
+ modelValue: Object,
76
78
  state: {
77
79
  type: [ Number, String ],
78
80
  default: 1
@@ -119,9 +121,8 @@ export default{
119
121
 
120
122
  const mouseMove = (e) => {
121
123
  const distanceX = e.clientX - startX
122
- const distanceY = e.clientY - startY
123
124
 
124
- if(!dragged.cloned && Math.abs(distanceY) > 10){
125
+ if(!dragged.cloned){
125
126
  const cloned = this.$el.cloneNode(true)
126
127
  cloned.style.position = 'absolute'
127
128
  cloned.style.left = rect.x + "px"
@@ -150,56 +151,62 @@ export default{
150
151
  window.removeEventListener('mousemove', mouseMove)
151
152
  window.removeEventListener('mouseup', mouseUp)
152
153
 
153
- if(dragged && dragged.parent && dragged.targetParent){
154
-
155
- const targetIdx = dragged.targetParent.indexOf(dragged.target)
156
- const moveDirection = e.clientY < dragged.startY ? -1 : 1
157
- const sameParent = dragged.parent === dragged.targetParent
154
+ if(dragged){
158
155
 
159
- let destIdx = undefined
156
+ if(dragged.parent && dragged.targetParent){
160
157
 
161
- if(dragged.dragArea === 1){
162
- if(sameParent){
163
- if(moveDirection === -1){
164
- destIdx = targetIdx
165
- }
166
- else{
167
- destIdx = targetIdx - 1
168
- }
158
+ if(dragged.dragArea === 3){
159
+ dragged.target.items.push(dragged.parent.items.splice(dragged.parent.items.indexOf(dragged.item), 1)[0])
160
+ this.$emit('change')
169
161
  }
170
162
  else{
171
- destIdx = targetIdx
172
- }
173
- }
174
- else if(dragged.dragArea === 2){
175
- if(sameParent){
176
- if(moveDirection === -1){
177
- destIdx = targetIdx + 1
163
+ const targetIdx = dragged.targetParent.items.indexOf(dragged.target)
164
+ const moveDirection = e.clientY < dragged.startY ? -1 : 1
165
+ const sameParent = dragged.parent === dragged.targetParent
166
+
167
+ let destIdx = undefined
168
+
169
+ if(dragged.dragArea === 1){
170
+ if(sameParent){
171
+ if(moveDirection === -1){
172
+ destIdx = targetIdx
173
+ }
174
+ else{
175
+ destIdx = targetIdx - 1
176
+ }
177
+ }
178
+ else{
179
+ destIdx = targetIdx
180
+ }
178
181
  }
179
- else{
180
- destIdx = targetIdx
182
+ else if(dragged.dragArea === 2){
183
+ if(sameParent){
184
+ if(moveDirection === -1){
185
+ destIdx = targetIdx + 1
186
+ }
187
+ else{
188
+ destIdx = targetIdx
189
+ }
190
+ }
191
+ else{
192
+ if(moveDirection === -1){
193
+ destIdx = targetIdx + 1
194
+ }
195
+ else{
196
+ destIdx = targetIdx + 1
197
+ }
198
+ }
181
199
  }
182
- }
183
- else{
184
- if(moveDirection === -1){
185
- destIdx = targetIdx + 1
186
- }
187
- else{
188
- destIdx = targetIdx + 1
200
+
201
+ if(destIdx !== undefined){
202
+ dragged.targetParent.items.splice(destIdx, 0,
203
+ dragged.parent.items.splice(dragged.parent.items.indexOf(dragged.item), 1)[0])
204
+ this.$emit('change')
189
205
  }
190
206
  }
191
- }
192
207
 
193
- if(destIdx !== undefined){
194
- dragged.targetParent.splice(destIdx, 0,
195
- dragged.parent.splice(dragged.parent.indexOf(dragged.item), 1)[0])
196
- this.$emit('change')
197
- }
198
- else if(dragged.dragArea === 3){
199
- dragged.targetParent.push(dragged.parent.splice(dragged.parent.indexOf(dragged.item), 1)[0])
200
- this.$emit('change')
201
208
  }
202
- }
209
+ }
203
210
 
204
211
  if(guide1 && guide1.parentNode){
205
212
  guide1.parentNode.removeChild(guide1)
@@ -299,16 +306,19 @@ export default{
299
306
  computed: {
300
307
 
301
308
  componentStore(){
302
- if(this.store && this.store.components){
303
- if(!this.store.components.treeviewitem)
304
- this.store.components.treeviewitem = {}
309
+ if(this.cConfig){
310
+ if(!this.cConfig.components)
311
+ this.cConfig.components = {}
312
+
313
+ if(!this.cConfig.components.treeviewitem)
314
+ this.cConfig.components.treeviewitem = {}
305
315
 
306
- return this.store.components.treeviewitem
316
+ return this.cConfig.components.treeviewitem
307
317
  }
308
318
  },
309
319
 
310
320
  isSelected(){
311
- return this.selectedItem === this.item
321
+ return this.modelValue === this.item
312
322
  },
313
323
 
314
324
  itemClass(){
@@ -326,14 +336,13 @@ export default{
326
336
  data(){
327
337
  return {
328
338
  childCollapsed: true,
329
- hvm: null
339
+ hvm: null,
340
+ cConfig: {}
330
341
  }
331
342
  },
332
343
 
333
344
  mounted() {
334
- if(this.componentStore){
335
- this.childCollapsed = this.componentStore[this.item.uid] ?? this.childCollapsed
336
- }
345
+ this.childCollapsed = this.componentStore ? this.componentStore[this.item.uid] : this.childCollapsed
337
346
  },
338
347
 
339
348
  watch: {
@@ -348,6 +357,7 @@ export default{
348
357
  },
349
358
 
350
359
  childCollapsed(to){
360
+
351
361
  if(this.item.uid && this.componentStore){
352
362
  this.componentStore[this.item.uid] = to
353
363
  }
@@ -414,7 +424,7 @@ export default{
414
424
  }
415
425
 
416
426
  .guide{
417
- @apply h-[1px] bg-primary rounded-lg;
427
+ @apply h-[2px] bg-primary rounded-lg;
418
428
  }
419
429
 
420
430
  .item.dragInto{
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import {defineAsyncComponent, reactive, ref} from "vue"
1
+ import {defineAsyncComponent, reactive} from "vue"
2
2
  import {observeInit} from './utils/helpers.mjs'
3
3
  import throttle from "lodash/throttle"
4
4
  import dayjs from "dayjs";
@@ -162,6 +162,26 @@ const formatDate = (date, format = 'YYYY-MM-DD HH:mm:ss') => {
162
162
 
163
163
  const util = {
164
164
 
165
+ addHTMLAttribute: (html, attr) => {
166
+
167
+ const splits = (html ?? '').split(' ')
168
+
169
+ if(splits.length > 0 && splits[0]){
170
+ const htmlAttr = []
171
+ for(let key in attr){
172
+ htmlAttr.push(`${key}="${attr[key]}"`)
173
+ }
174
+
175
+ html = [
176
+ splits[0],
177
+ ...htmlAttr,
178
+ ...splits.slice(1)
179
+ ].join(' ')
180
+ }
181
+
182
+ return html
183
+ },
184
+
165
185
  dragResize: (e, callback) => {
166
186
 
167
187
  e.preventDefault()
@@ -362,7 +382,31 @@ export default{
362
382
  app.config.globalProperties.time = consoleTime
363
383
  app.config.globalProperties.timeLog = consoleTimeLog
364
384
  app.config.globalProperties.timeEnd = consoleTimeEnd
365
- app.config.globalProperties.$device = reactive({})
385
+ app.config.globalProperties.$device = reactive({
386
+
387
+ getValue: (arr) => {
388
+ if(Array.isArray(arr)){
389
+ let index = 0
390
+ switch(app.config.globalProperties.$device){
391
+ case 'md':
392
+ index = 1
393
+ break
394
+ case 'lg':
395
+ index = 2
396
+ break
397
+ }
398
+
399
+ for(let i = index ; i >= 0 ; i--){
400
+ if(arr && arr[i])
401
+ return arr[i]
402
+ }
403
+ }
404
+ },
405
+
406
+ type: 'mobile',
407
+ media: '',
408
+
409
+ })
366
410
  app.config.globalProperties.$isDebugMode = () => {
367
411
  if(!('isDebugMode' in privateVars)){
368
412
  privateVars.isDebugMode = location.search.indexOf('debug-mode') >= 0 ||
@@ -520,6 +564,7 @@ export default{
520
564
  app.component('CountdownSetting', defineAsyncComponent(() => import("./widgets/CountdownSetting.vue")))
521
565
  app.component('ComponentSetting', defineAsyncComponent(() => import("./widgets/ComponentSetting.vue")))
522
566
  app.component('ComponentSetting2', defineAsyncComponent(() => import("./widgets/ComponentSetting2.vue")))
567
+ app.component('ComponentSetting3', defineAsyncComponent(() => import("./widgets/ComponentSetting3.vue")))
523
568
  app.component('ContactForm', defineAsyncComponent(() => import("./widgets/ContactForm.vue")))
524
569
  app.component('ContactFormSetting', defineAsyncComponent(() => import("./widgets/ContactFormSetting.vue")))
525
570
  app.component('EmbeddedVideo', defineAsyncComponent(() => import("./widgets/EmbeddedVideo.vue")))
@@ -540,6 +585,7 @@ export default{
540
585
  app.component('LinkSetting', defineAsyncComponent(() => import("./widgets/LinkSetting.vue")))
541
586
  app.component('ImageSetting', defineAsyncComponent(() => import("./widgets/ImageSetting.vue")))
542
587
  app.component('MarginSetting', defineAsyncComponent(() => import("./widgets/MarginSetting.vue")))
588
+ app.component('MarginPaddingSetting', defineAsyncComponent(() => import("./widgets/MarginPaddingSetting.vue")))
543
589
  app.component('MultiValueSetting', defineAsyncComponent(() => import("./widgets/MultiValueSetting.vue")))
544
590
  app.component('MultiValueSetting2', defineAsyncComponent(() => import("./widgets/MultiValueSetting2.vue")))
545
591
  app.component('PaddingSetting', defineAsyncComponent(() => import("./widgets/PaddingSetting.vue")))
@@ -569,6 +615,19 @@ export default{
569
615
  app.component('PresetBarPivotColumnEdit', defineAsyncComponent(() => import("./widgets/PresetBarPivotColumnEdit.vue")))
570
616
  app.component('LogViewer', defineAsyncComponent(() => import("./widgets/LogViewer.vue")))
571
617
  app.component('ColumnSelector', defineAsyncComponent(() => import("./widgets/ColumnSelector.vue")))
618
+ app.component('ComponentPropertySelector', defineAsyncComponent(() => import("./widgets/ComponentPropertySelector.vue")))
619
+ app.component('ComponentPropertyLabel', defineAsyncComponent(() => import("./widgets/ComponentPropertyLabel.vue")))
620
+ app.component('LayoutSetting', defineAsyncComponent(() => import("./widgets/LayoutSetting.vue")))
621
+ app.component('BackgroundSetting', defineAsyncComponent(() => import("./widgets/BackgroundSetting.vue")))
622
+ app.component('BorderSetting', defineAsyncComponent(() => import("./widgets/BorderSetting.vue")))
623
+ app.component('TransitionSetting', defineAsyncComponent(() => import("./widgets/TransitionSetting.vue")))
624
+ app.component('EffectSetting', defineAsyncComponent(() => import("./widgets/EffectSetting.vue")))
625
+ app.component('SpacingSetting', defineAsyncComponent(() => import("./widgets/SpacingSetting.vue")))
626
+ app.component('SizingSetting', defineAsyncComponent(() => import("./widgets/SizingSetting.vue")))
627
+ app.component('TypographySetting', defineAsyncComponent(() => import("./widgets/TypographySetting.vue")))
628
+ app.component('FiltersSetting', defineAsyncComponent(() => import("./widgets/FiltersSetting.vue")))
629
+ app.component('IconSelector', defineAsyncComponent(() => import("./widgets/IconSelector.vue")))
630
+ app.component('MenuEditor', defineAsyncComponent(() => import("./widgets/MenuEditor.vue")))
572
631
  },
573
632
 
574
633
  }
@@ -0,0 +1,36 @@
1
+ import { defineStore } from 'pinia'
2
+
3
+ export const useComponentState = defineStore('componentState', {
4
+
5
+ state: () => ({
6
+ version: 1,
7
+ isInit: false,
8
+ }),
9
+
10
+ actions: {
11
+
12
+ init(){
13
+ if(this.isInit) return
14
+ this.isInit = true
15
+
16
+ if(typeof localStorage !== 'undefined' && localStorage.getItem('componentState')){
17
+ try{
18
+ const store = JSON.parse(atob(localStorage.getItem('componentState')))
19
+ this.$patch(Object.assign(store, {}))
20
+ }
21
+ catch(e){
22
+
23
+ }
24
+ }
25
+
26
+ this.$subscribe(() => {
27
+ console.log('save')
28
+ localStorage.setItem('componentState', btoa(JSON.stringify(this.$state)))
29
+ })
30
+
31
+ console.log('componentState init completed')
32
+ },
33
+
34
+ }
35
+
36
+ })
@@ -1,11 +1,7 @@
1
1
  <template>
2
- <div :class="$style.comp">
2
+ <div>
3
3
 
4
4
  <div class="flex flex-col gap-4" v-if="viewType === ''">
5
- <div>
6
- <strong class="flex-1 text-text-400">Article</strong>
7
- <div class="h-[1px] bg-text-100 mt-2"></div>
8
- </div>
9
5
 
10
6
  <div class="overflow-x-auto">
11
7
  <label class="text-text-400">Action</label>
@@ -240,12 +236,6 @@
240
236
 
241
237
  </div>
242
238
 
243
- <ComponentSetting2 :item="item"
244
- :view-type="viewType"
245
- :view-types="viewTypes"
246
- defaultDisplay="block"
247
- @change="$emit('change')" />
248
-
249
239
  </div>
250
240
  </template>
251
241
 
@@ -257,9 +247,9 @@ import axios from "axios";
257
247
 
258
248
  export default{
259
249
 
260
- emits: [ 'change', 'postMessageToIframe' ],
250
+ emits: [ 'change' ],
261
251
 
262
- inject: [ 'alert', 'postIframe' ],
252
+ inject: [ 'alert', 'viewTypes', 'postIframe', 'onPostMessageToIframe' ],
263
253
 
264
254
  props: {
265
255
 
@@ -268,9 +258,7 @@ export default{
268
258
  required: true
269
259
  },
270
260
 
271
- viewType: String,
272
-
273
- viewTypes: Array,
261
+ config: Object,
274
262
 
275
263
  },
276
264
 
@@ -341,7 +329,7 @@ export default{
341
329
  case 'bold':
342
330
  case 'italic':
343
331
  default:
344
- this.$emit('postMessageToIframe', this.item.uid, { action:'format', type, value })
332
+ this.onPostMessageToIframe(this.item.uid, { action:'format', type, value })
345
333
  break
346
334
 
347
335
  }
@@ -382,27 +370,27 @@ export default{
382
370
  },
383
371
 
384
372
  insertTable(){
385
- this.$emit('postMessageToIframe', this.item.uid, { action:'insertTable' })
373
+ this.onPostMessageToIframe(this.item.uid, { action:'insertTable' })
386
374
  },
387
375
 
388
376
  removeFormat(){
389
- this.$emit('postMessageToIframe', this.item.uid, { action:'removeFormat' })
377
+ this.onPostMessageToIframe(this.item.uid, { action:'removeFormat' })
390
378
  },
391
379
 
392
380
  addTableColumn(){
393
- this.$emit('postMessageToIframe', this.item.uid, { action:'addTableColumn' })
381
+ this.onPostMessageToIframe(this.item.uid, { action:'addTableColumn' })
394
382
  },
395
383
 
396
384
  addTableRow(){
397
- this.$emit('postMessageToIframe', this.item.uid, { action:'addTableRow' })
385
+ this.onPostMessageToIframe(this.item.uid, { action:'addTableRow' })
398
386
  },
399
387
 
400
388
  removeTableColumn(){
401
- this.$emit('postMessageToIframe', this.item.uid, { action:'removeTableColumn' })
389
+ this.onPostMessageToIframe(this.item.uid, { action:'removeTableColumn' })
402
390
  },
403
391
 
404
392
  removeTableRow(){
405
- this.$emit('postMessageToIframe', this.item.uid, { action:'removeTableRow' })
393
+ this.onPostMessageToIframe(this.item.uid, { action:'removeTableRow' })
406
394
  },
407
395
 
408
396
  setSubAction(subAction){
@@ -448,6 +436,10 @@ export default{
448
436
  return this.item.props.textColor
449
437
  },
450
438
 
439
+ viewType(){
440
+ return this.config.viewType
441
+ },
442
+
451
443
  },
452
444
 
453
445
  data(){
@@ -459,11 +451,3 @@ export default{
459
451
  }
460
452
 
461
453
  </script>
462
-
463
- <style module>
464
-
465
- .comp{
466
- @apply flex flex-col gap-6;
467
- }
468
-
469
- </style>