@mixd-id/web-scaffold 0.1.230406198 → 0.1.230406199

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.230406198",
4
+ "version": "0.1.230406199",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -360,21 +360,24 @@ export default{
360
360
  @apply bg-primary-500;
361
361
  }
362
362
 
363
- .htmlNoScroll{
364
- min-height: 100.3%;
365
- overscroll-behavior-y: none;
366
- height: 100%;
367
- overflow: hidden;
368
- }
369
- .bodyNoScroll{
370
- overscroll-behavior: none;
371
- overscroll-behavior-y: none;
372
- overflow: hidden;
373
- position: fixed;
374
- width: 100%;
375
- margin: 0;
376
- max-height: 100%;
377
- -webkit-overflow-scrolling: touch;
363
+ @media screen and (max-width: 768px){
364
+ .htmlNoScroll{
365
+ min-height: 100.3%;
366
+ overscroll-behavior-y: none;
367
+ height: 100%;
368
+ overflow: hidden;
369
+ }
370
+ .bodyNoScroll{
371
+ overscroll-behavior: none;
372
+ overscroll-behavior-y: none;
373
+ overflow: hidden;
374
+ position: fixed;
375
+ width: 100%;
376
+ margin: 0;
377
+ max-height: 100%;
378
+ -webkit-overflow-scrolling: touch;
379
+ }
378
380
  }
379
381
 
382
+
380
383
  </style>
@@ -79,6 +79,8 @@ export default{
79
79
 
80
80
  height: String,
81
81
 
82
+ dock: String,
83
+
82
84
  position: {
83
85
  type: String,
84
86
  default: 'bottom'
@@ -167,7 +169,7 @@ export default{
167
169
  computedClass(){
168
170
  return [
169
171
  this.$style.modal,
170
- this.$style['modal-' + this.position],
172
+ this.$style['modal-' + (this.dock ?? this.position)],
171
173
  this.class,
172
174
  this.mode === 'v-show' ? this.$style['v-show'] : '',
173
175
  this.computedState ? this.$style.open : ''
@@ -188,7 +190,7 @@ export default{
188
190
  return this.transition
189
191
  }
190
192
  else{
191
- switch(this.position){
193
+ switch(this.dock ?? this.position){
192
194
  case 'top':
193
195
  return 'slidedown'
194
196
  case 'bottom':
@@ -25,7 +25,7 @@
25
25
 
26
26
  <Dropdown v-else-if="field.type === 'topic'" v-model="form[field.type]"
27
27
  class="bg-white text-xl md:w-[200px] max-w-full">
28
- <option value="" disabled selected>Pilih Topik Pertanyaan</option>
28
+ <option value="" disabled selected>{{ field.placeholder ? field.placeholder : 'Pilih Topik Pertanyaan' }}</option>
29
29
  <option v-for="item in field.items" :value="item.text">{{ item.text }}</option>
30
30
  </Dropdown>
31
31
 
@@ -205,6 +205,10 @@
205
205
  <template v-slot:head>
206
206
  <div class="relative p-5">
207
207
  <h3>Topic</h3>
208
+
209
+ <button type="button" class="absolute right-0 top-0 p-3" @click="$refs.topicModal.close()">
210
+ <svg width="18" height="18" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z"/></svg>
211
+ </button>
208
212
  </div>
209
213
  </template>
210
214
  <template #foot="{ context }">
@@ -213,32 +217,48 @@
213
217
  </div>
214
218
  </template>
215
219
  <template #default="{ context }">
216
- <div class="flex-1 p-5 flex flex-col gap-6">
217
-
218
- <ListItem :items="context.items"
219
- @reorder="(from, to) => { context.items.splice(to, 0, context.items.splice(from, 1)[0]); }"
220
- body-class="flex flex-col divide-y divide-text-200">
221
- <template v-slot="{ item, index }">
222
- <div class="flex flex-row items-center gap-3">
223
- <div data-reorder>
224
- <svg width="14" height="14" 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>
225
- </div>
226
- <div class="flex-1">
227
- <Textbox v-model="item.text" class="border-none" placeholder="Topic Name" />
228
- </div>
229
- <div>
230
- <button type="button" @click="context.items.splice(index, 1)">
231
- <svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>
232
- </button>
220
+ <div class="flex-1 p-5 flex flex-col gap-4">
221
+
222
+ <div>
223
+ <label class="text-text-400">Label</label>
224
+ <Textbox v-model="context.label" />
225
+ </div>
226
+
227
+ <div>
228
+ <label class="text-text-400">Items</label>
229
+ <ListItem :items="context.items"
230
+ @reorder="(from, to) => { context.items.splice(to, 0, context.items.splice(from, 1)[0]); }"
231
+ body-class="flex flex-col divide-y divide-text-200 border-[1px] border-text-200 mt-1">
232
+ <template v-slot="{ item, index }">
233
+ <div class="flex flex-row items-center gap-3 px-3">
234
+ <div data-reorder>
235
+ <svg width="14" height="14" 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>
236
+ </div>
237
+ <div class="flex-1">
238
+ <Textbox v-model="item.text" class="border-none" placeholder="Topic Name" />
239
+ </div>
240
+ <div>
241
+ <button type="button" @click="context.items.splice(index, 1)">
242
+ <svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>
243
+ </button>
244
+ </div>
233
245
  </div>
234
- </div>
235
- </template>
236
- </ListItem>
246
+ </template>
247
+ </ListItem>
248
+
249
+ <div class="text-center">
250
+ <button type="button" class="text-primary p-3" @click="context.items.push({})">Add Item</button>
251
+ </div>
252
+ </div>
237
253
 
238
- <div class="text-center">
239
- <button type="button" class="text-primary" @click="context.items.push({})">Add Topic</button>
254
+ <div>
255
+ <label class="text-text-400">Placeholder</label>
256
+ <Textbox v-model="context.placeholder" />
240
257
  </div>
241
258
 
259
+ <br />
260
+ <br />
261
+
242
262
  </div>
243
263
  </template>
244
264
  </Modal>
@@ -20,7 +20,7 @@
20
20
  <div class="col-span-2 flex flex-row items-center">
21
21
  <label :class="$style.label" class="flex-1">Position</label>
22
22
  <div class="flex flex-row items-center gap-1">
23
- <Dropdown v-model="position">
23
+ <Dropdown v-model="item.props.dock">
24
24
  <option disabled selected>Choose Position</option>
25
25
  <option value="center">Center</option>
26
26
  <option value="top">Top</option>
@@ -72,13 +72,6 @@ export default{
72
72
 
73
73
  computed: {
74
74
 
75
- position(){
76
- if(!Array.isArray(this.item.props.position))
77
- this.item.props.position = []
78
-
79
- return this.item.props.position
80
- }
81
-
82
75
  }
83
76
 
84
77
  }
@@ -163,7 +163,7 @@
163
163
  </div>
164
164
 
165
165
  <div class="p-6 text-center">
166
- <button type="button" class="text-primary" @click="resetMedia">Reset</button>
166
+ <button type="button" class="text-primary" @click="resetMedia">Reset to Default Style</button>
167
167
  </div>
168
168
 
169
169
  </div>
@@ -19,45 +19,43 @@
19
19
  </template>
20
20
  <div class="flex-1 p-6 flex flex-col gap-4">
21
21
 
22
- <div>
23
- <label class="text-text-400">Name</label>
24
- <Textbox v-model="datasource.name" />
25
- </div>
26
-
27
- <div>
28
- <label class="text-text-400">Key</label>
29
- <Textbox v-model="datasource.key" />
30
- </div>
31
-
32
- <div>
33
- <label class="text-text-400">Model</label>
34
- <Dropdown v-model="datasource.model">
22
+ <div>
23
+ <label class="text-text-400">Model</label>
24
+ <Dropdown v-model="datasource.type" @change="setType">
35
25
  <option disabled selected>Select Model</option>
36
- <option v-for="model in models" :value="model.name">{{ model.name }}</option>
26
+ <option v-for="model in datasources" :value="model.type">{{ model.name }}</option>
37
27
  </Dropdown>
38
- </div>
28
+ </div>
29
+
30
+ <div v-if="datasource.type">
39
31
 
40
- <div>
41
- <label class="text-text-400">Filters</label>
42
32
  <div>
43
- <div v-for="(filter, idx) in datasource.filters" class="flex flex-row gap-2">
44
- <Dropdown v-model="filter.key">
45
- <option disabled selected>Choose Field</option>
46
- <option v-for="column in modelColumns" :value="column.name">{{ column.name }}</option>
47
- </Dropdown>
48
- <Dropdown v-model="filter.operator">
49
- <option disabled selected>Choose Operator</option>
50
- <option value="=">=</option>
51
- </Dropdown>
52
- <Textbox v-model="filter.value" />
53
- <button type="button" @click="datasource.filters.splice(idx, 1)">
54
- <svg width="14" height="14" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z"/></svg>
55
- </button>
56
- </div>
33
+ <label class="text-text-400">Key</label>
34
+ <Textbox v-model="datasource.key" />
57
35
  </div>
58
- <div class="p-3 text-center">
59
- <button type="button" class="text-primary"
60
- @click="datasource.filters.push({})">Add Filter</button>
36
+
37
+ <div v-if="datasource.filters">
38
+ <label class="text-text-400">Filters</label>
39
+ <div>
40
+ <div v-for="(filter, idx) in datasource.filters" class="flex flex-row gap-2">
41
+ <Dropdown v-model="filter.key">
42
+ <option disabled selected>Choose Field</option>
43
+ <option v-for="column in modelColumns" :value="column.name">{{ column.name }}</option>
44
+ </Dropdown>
45
+ <Dropdown v-model="filter.operator">
46
+ <option disabled selected>Choose Operator</option>
47
+ <option value="=">=</option>
48
+ </Dropdown>
49
+ <Textbox v-model="filter.value" />
50
+ <button type="button" @click="datasource.filters.splice(idx, 1)">
51
+ <svg width="14" height="14" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z"/></svg>
52
+ </button>
53
+ </div>
54
+ </div>
55
+ <div class="p-3 text-center">
56
+ <button type="button" class="text-primary"
57
+ @click="datasource.filters.push({})">Add Filter</button>
58
+ </div>
61
59
  </div>
62
60
  </div>
63
61
 
@@ -89,7 +87,7 @@ export default{
89
87
  },
90
88
 
91
89
  create(){
92
- this.datasource = { filters:[] }
90
+ this.datasource = {}
93
91
  this.isOpen = true
94
92
  },
95
93
 
@@ -102,12 +100,17 @@ export default{
102
100
  if(this.useDatasource){
103
101
  this.socketEmit2(this.useDatasource[0], {})
104
102
  .then(res => {
105
- this.models = res.models
103
+ this.datasources = res.datasources
106
104
  })
107
105
  .catch(err => console.error(err))
108
106
  }
109
107
  },
110
108
 
109
+ setType(){
110
+ const datasource = this.datasources.filter(_ => _.type === this.datasource.type).pop()
111
+ Object.assign(this.datasource, datasource)
112
+ }
113
+
111
114
  },
112
115
 
113
116
  mounted() {
@@ -117,13 +120,12 @@ export default{
117
120
  computed: {
118
121
 
119
122
  canApply(){
120
- return this.datasource.name &&
121
- this.datasource.key &&
122
- this.datasource.model
123
+ return this.datasource.type &&
124
+ this.datasource.key
123
125
  },
124
126
 
125
127
  modelColumns(){
126
- return (this.models.filter(_ => _.name === this.datasource.model).pop() ?? {}).columns ?? []
128
+ return (this.datasources.filter(_ => _.name === this.datasource.model).pop() ?? {}).columns ?? []
127
129
  }
128
130
 
129
131
  },
@@ -131,7 +133,7 @@ export default{
131
133
  data(){
132
134
  return {
133
135
  isOpen: false,
134
- models: null,
136
+ datasources: null,
135
137
  datasource: {
136
138
  filters: []
137
139
  },
@@ -540,8 +540,7 @@
540
540
  @postMessageToIframe="onPostMessageToIframe"/>
541
541
  </div>
542
542
 
543
-
544
- <div class="p-5 text-center" v-if="useTemplateCreator">
543
+ <div class="p-5 text-center" v-if="useTemplateCreator && currentItem.type !== 'Style'">
545
544
  <button type="button" class="text-primary"
546
545
  @click="openTemplateCreator">
547
546
  Save as Template
@@ -748,13 +747,11 @@ export default{
748
747
  }
749
748
 
750
749
  for(let key in component.props){
751
- if(!this.compClasses.includes(key) && ![ 'enabled' ].includes(key)){
752
-
753
- let value = component.props[key]
754
- /*if(key === 'htmlText'){
755
- value = removeStyleFromTag(value)
756
- }*/
757
- instance[key] = value
750
+ if(!this.compClasses.includes(key) &&
751
+ !this.containerClasses.includes(key) &&
752
+ !this.itemClasses.includes(key) &&
753
+ ![ 'enabled' ].includes(key)){
754
+ instance[key] = component.props[key]
758
755
  }
759
756
  }
760
757
 
@@ -1635,9 +1632,11 @@ export default{
1635
1632
  'textTransform', 'whitespace', 'textOverflow', 'textDecoration',
1636
1633
  'boxShadow', 'opacity',
1637
1634
  'colSpan', 'rowSpan',
1638
- 'flex', 'flexAlign', 'flexJustify', 'zIndex',
1635
+ 'flex', 'flexAlign', 'flexJustify', 'flexBasis', 'flexColumns',
1636
+ 'zIndex',
1639
1637
 
1640
1638
  'autoFlow', 'alignItems', 'justifyContent',
1639
+ 'letterSpacing',
1641
1640
 
1642
1641
  'animate',
1643
1642
 
@@ -1646,12 +1645,12 @@ export default{
1646
1645
  containerClasses: [
1647
1646
  'containerVariant', 'containerGridColumn', 'containerGap'
1648
1647
  ],
1649
- host: null,
1650
- iframeStyle: {},
1651
- iframeSrc: '',
1652
1648
  itemClasses: [
1653
1649
  'itemMinWidth', 'itemRatio', 'itemVariant'
1654
1650
  ],
1651
+ host: null,
1652
+ iframeStyle: {},
1653
+ iframeSrc: '',
1655
1654
  layouts: [],
1656
1655
  prevData: null,
1657
1656
  previewModes: [