@mixd-id/web-scaffold 0.1.230406082 → 0.1.230406083

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.230406082",
4
+ "version": "0.1.230406083",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -22,7 +22,6 @@ export default{
22
22
 
23
23
  beautify(){
24
24
  const html = JSON.parse(JSON.stringify(this.modelValue, null, 2))
25
- console.log(html)
26
25
  this.$emit('update:modelValue', html)
27
26
  },
28
27
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :class="computedClass" :style="computedStyle">
2
+ <div :class="compClass" :style="computedStyle">
3
3
 
4
4
  <component v-for="(item, idx) in computedItems"
5
5
  :is="item.type"
@@ -10,7 +10,6 @@
10
10
  :class="itemClass(idx)" />
11
11
 
12
12
  </div>
13
-
14
13
  </template>
15
14
 
16
15
  <script>
@@ -27,29 +26,27 @@ export default{
27
26
  columnType: Array,
28
27
  },
29
28
 
29
+ methods: {
30
+
31
+ itemClass(idx){
32
+ return ((this.flexColumns ?? [])[idx] ?? []).join(' ')
33
+ },
34
+ },
35
+
30
36
  computed: {
31
37
 
32
38
  computedItems(){
33
39
  return this.items.filter((_) => _.props.enabled)
34
40
  },
35
41
 
36
- computedClass(){
37
-
38
- const classNames = [
42
+ compClass(){
43
+ return [
39
44
  this.$style.comp,
40
45
  this.extClass
41
46
  ]
42
-
43
- return classNames.join(' ')
47
+ .join(' ')
44
48
  }
45
49
 
46
- },
47
-
48
- methods: {
49
-
50
- itemClass(idx){
51
- return (this.flexColumns[idx] ?? []).join(' ')
52
- },
53
50
  }
54
51
 
55
52
  }
@@ -121,7 +121,7 @@ export default{
121
121
  watch: {
122
122
 
123
123
  src(to){
124
- console.log('src', to)
124
+
125
125
  }
126
126
 
127
127
 
@@ -137,4 +137,4 @@ export default{
137
137
  @apply relative;
138
138
  }
139
139
 
140
- </style>
140
+ </style>
@@ -344,7 +344,6 @@ export default{
344
344
  preset: this.preset
345
345
  })
346
346
  .then((res) => {
347
- console.log('res', res)
348
347
  /*const data = res && res.data ? res.data : res
349
348
  this.summary = data*/
350
349
  })
@@ -52,7 +52,6 @@ export default{
52
52
  },
53
53
 
54
54
  mounted(){
55
- console.log(this.$slots)
56
55
  },
57
56
 
58
57
  data(){
@@ -109,7 +109,7 @@ export default{
109
109
 
110
110
  column:{
111
111
  handler(to){
112
- console.log('column changed')
112
+
113
113
  },
114
114
  deep: true
115
115
  }
@@ -156,4 +156,4 @@ export default{
156
156
  @apply w-full
157
157
  }
158
158
 
159
- </style>
159
+ </style>
@@ -26,7 +26,7 @@ export default{
26
26
  this.extClass
27
27
  ]
28
28
  .filter(_=>_)
29
- .join()
29
+ .join(' ')
30
30
  }
31
31
 
32
32
  }
package/src/index.js CHANGED
@@ -318,7 +318,8 @@ export default{
318
318
  app.component('BoxItem', defineAsyncComponent(() => import("./widgets/BoxItem.vue")))
319
319
  app.component('BoxSetting', defineAsyncComponent(() => import("./widgets/BoxSetting.vue")))
320
320
  app.component('ButtonItem', defineAsyncComponent(() => import("./widgets/ButtonItem.vue")))
321
- app.component('ButtonSetting', defineAsyncComponent(() => import("./widgets/ButtonSetting.vue")))
321
+ app.component('ButtonSetting', defineAsyncComponent(() => import("./wid" +
322
+ "gets/ButtonSetting.vue")))
322
323
  app.component('CarouselItem', defineAsyncComponent(() => import("./widgets/CarouselItem.vue")))
323
324
  app.component('CarouselSetting', defineAsyncComponent(() => import("./widgets/CarouselSetting.vue")))
324
325
  app.component('ContactForm', defineAsyncComponent(() => import("./widgets/ContactForm.vue")))
@@ -32,7 +32,8 @@ export const componentMixin = {
32
32
  direction: Array,
33
33
  gap: Array,
34
34
  display: Array,
35
- type: Array,
35
+
36
+ flexColumns: Array,
36
37
 
37
38
  fontFamily: Array,
38
39
  fontSize: Array,
@@ -64,7 +65,7 @@ export const componentMixin = {
64
65
 
65
66
  computedStyle(){
66
67
  return {
67
- 'background-image': this.$screenPrefix === 'md' ? (this.bgImages[1] ?? this.bgImages[0]) : this.bgImages[0]
68
+ 'background-image': 'xmd' === 'md' ? (this.bgImages[1] ?? this.bgImages[0]) : this.bgImages[0]
68
69
  }
69
70
  }
70
71
  }
@@ -10,16 +10,16 @@
10
10
  <div class="flex flex-col gap-4">
11
11
  <div v-for="field in fields">
12
12
  <label class="text-gray-700">{{ field.label ?? field.type }}</label>
13
- <Textbox v-if="field.type === 'name'" v-model="form[field.type]" class="bg-white text-xl" :readonly="succeed" />
14
- <Textbox v-if="field.type === 'email'" v-model="form[field.type]" class="bg-white text-xl w-[300px] max-w-full" :readonly="succeed" />
15
- <Textbox v-else-if="field.type === 'mobileNumber'" v-model="form[field.type]" class="bg-white text-xl" type="tel" :readonly="succeed" />
16
- <Textbox v-else-if="field.type === 'referralCode'" v-model="form[field.type]" class="bg-white text-xl w-[200px] max-w-full" :readonly="succeed" />
17
- <Textarea v-else-if="field.type === 'remark'" v-model="form[field.type]" rows="2" :readonly="succeed"></Textarea>
13
+ <Textbox v-if="field.type === 'name'" v-model="form[field.type]" class="bg-white text-xl" :readonly="completed" />
14
+ <Textbox v-if="field.type === 'email'" v-model="form[field.type]" class="bg-white text-xl md:w-[300px] max-w-full" :readonly="completed" />
15
+ <Textbox v-else-if="field.type === 'mobileNumber'" v-model="form[field.type]" class="bg-white text-xl" type="tel" :readonly="completed" />
16
+ <Textbox v-else-if="field.type === 'referralCode'" v-model="form[field.type]" class="bg-white text-xl md:w-[200px] max-w-full" :readonly="completed" />
17
+ <Textarea v-else-if="field.type === 'remark'" v-model="form[field.type]" rows="2" :readonly="completed"></Textarea>
18
18
  </div>
19
19
  </div>
20
20
 
21
21
  <Button ref="submitBtn" class="w-full" @click="submitForm" :state="!canSubmit ? -1 : 1">
22
- <h5>{{ succeed ? 'Form berhasil dikirim' : 'Kirim' }}</h5>
22
+ <h5>{{ completed ? 'Form berhasil dikirim' : 'Kirim' }}</h5>
23
23
  </Button>
24
24
 
25
25
  </div>
@@ -29,6 +29,7 @@
29
29
  <script>
30
30
 
31
31
  import {componentMixin} from "../mixin/component";
32
+ import axios from "axios";
32
33
 
33
34
  export default{
34
35
 
@@ -53,6 +54,8 @@ export default{
53
54
  description: String,
54
55
  fields: Array,
55
56
  onSubmit: Array,
57
+ submitUrl: String,
58
+ submitMethod: String
56
59
 
57
60
  },
58
61
 
@@ -60,10 +63,18 @@ export default{
60
63
 
61
64
  submitForm(){
62
65
  if('edit-mode' in this.$route.query) return
66
+ if(!this.submitUrl) return
63
67
 
64
68
  this.$refs.submitBtn.setState(2)
65
-
66
- // TODO
69
+ axios({
70
+ method: this.submitMethod ?? 'post',
71
+ url: this.submitUrl,
72
+ data: this.form,
73
+ params: this.form
74
+ })
75
+ .then(_ => this.completed = true)
76
+ .catch(err => this.alert(err))
77
+ .finally(_ => this.$refs.submitBtn.resetState(2))
67
78
  }
68
79
 
69
80
  },
@@ -72,7 +83,7 @@ export default{
72
83
 
73
84
  canSubmit(){
74
85
  return this.fields.every(field => [ 'referralCode', 'email', 'remark' ].includes(field.type) || this.form[field.type]) &&
75
- !this.succeed
86
+ !this.completed
76
87
  },
77
88
 
78
89
  compClass(){
@@ -92,7 +103,7 @@ export default{
92
103
  data(){
93
104
  return {
94
105
  form: {},
95
- succeed: false
106
+ completed: false
96
107
  }
97
108
  },
98
109
 
@@ -85,6 +85,21 @@
85
85
  </ListItem>
86
86
  </div>
87
87
 
88
+ <div>
89
+ <label class="text-text-400">Submit URL</label>
90
+ <div class="flex flex-row gap-2 mt-1">
91
+ <Dropdown v-model="item.props.submitMethod"
92
+ class="w-[100px]"
93
+ @change="$emit('change')">
94
+ <option value="get">GET</option>
95
+ <option value="post">POST</option>
96
+ </Dropdown>
97
+ <Textbox v-model="item.props.submitUrl"
98
+ class="flex-1"
99
+ @keyup.enter="$emit('change')"/>
100
+ </div>
101
+ </div>
102
+
88
103
  <ComponentSetting :item="item"
89
104
  :view-type="viewType"
90
105
  :view-types="viewTypes"
@@ -8,7 +8,7 @@
8
8
  <label class="text-text-400">Direction</label>
9
9
  <Dropdown v-for="(_, idx) in viewTypes"
10
10
  v-show="viewType === _.value"
11
- v-model="item.props.direction[idx]"
11
+ v-model="direction[idx]"
12
12
  @change="$emit('change')">
13
13
  <option value="">Default</option>
14
14
  <option :value="`${viewType}flex-row`">Row</option>
@@ -22,7 +22,7 @@
22
22
  <label class="text-text-400">Gap</label>
23
23
  <Dropdown v-for="(_, idx) in viewTypes"
24
24
  v-show="viewType === _.value"
25
- v-model="item.props.gap[idx]"
25
+ v-model="gap[idx]"
26
26
  class="w-[120px]"
27
27
  @change="$emit('change')">
28
28
  <option value="">Not Set</option>
@@ -67,7 +67,6 @@
67
67
  </div>
68
68
  </template>
69
69
  </ListItem>
70
-
71
70
  <div class="text-center">
72
71
  <button type="button" class="p-3 text-primary" @click="item.props.flexColumns.push([ '', '' ])">Add Column</button>
73
72
  </div>
@@ -103,6 +102,24 @@ export default{
103
102
 
104
103
  viewTypes: Array,
105
104
 
105
+ },
106
+
107
+ computed: {
108
+
109
+ direction(){
110
+ if(!Array.isArray(this.item.props.direction))
111
+ this.item.props.direction = [ 'flex-column' ]
112
+
113
+ return this.item.props.direction
114
+ },
115
+
116
+ gap(){
117
+ if(!Array.isArray(this.item.props.gap))
118
+ this.item.props.gap = [ 'gap-2' ]
119
+
120
+ return this.item.props.gap
121
+ }
122
+
106
123
  }
107
124
 
108
125
  }
@@ -78,7 +78,7 @@ export default{
78
78
  <style module>
79
79
 
80
80
  .comp{
81
- @apply p-2 px-4 bg-gray-100 rounded-lg flex flex-row md:flex-col gap-2 items-center md:items-start;
81
+ @apply flex flex-row md:flex-col gap-2 items-center md:items-start;
82
82
  background-image: v-bind(bgImages[0]);
83
83
  }
84
84
 
@@ -126,7 +126,7 @@ export default{
126
126
  methods: {
127
127
 
128
128
  addStyle(compName, styleKey, variant){
129
- console.log('addStyle', compName, styleKey, variant)
129
+
130
130
  if(!this.item.props[compName])
131
131
  this.item.props[compName] = {}
132
132
 
@@ -664,7 +664,7 @@ export default{
664
664
  listen(){
665
665
  this.socketEmit2('page.subscribe', { name:'page' })
666
666
  .then(() => {
667
- console.log('Subscribed to page hooks')
667
+
668
668
  })
669
669
  .catch((err) => this.toast(err))
670
670
  },
@@ -672,7 +672,7 @@ export default{
672
672
  stopListen(){
673
673
  this.socketEmit2('page.unsubscribe', { name:'page' })
674
674
  .then(() => {
675
- console.log('Unsubscribed to page hooks')
675
+
676
676
  })
677
677
  .catch((err) => this.toast(err))
678
678
  },
@@ -855,7 +855,7 @@ export default{
855
855
  }},
856
856
 
857
857
  { type:'Flex', name:'Flex', group:'Layouts', items:[], props:{
858
- flexColumns: [], direction: [], gap: [],
858
+ flexColumns: [], direction: [ 'flex-col' ], gap: [],
859
859
  }},
860
860
 
861
861
  { type:'Grid', name:'Grid', group:'Layouts', items:[], gap:[], props:{