@mixd-id/web-scaffold 0.1.230406199 → 0.1.230406200

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.230406199",
4
+ "version": "0.1.230406200",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+
4
+ <component v-for="(item, idx) in dataItems"
5
+ :is="item.type"
6
+ :key="item.key"
7
+ :="item" />
8
+ </div>
9
+ </template>
10
+
11
+ <script>
12
+
13
+ import {componentMixin} from "../mixin/component";
14
+
15
+ export default{
16
+
17
+ mixins: [ componentMixin ],
18
+
19
+ props: {
20
+
21
+ datasource: Object,
22
+
23
+ items: Array,
24
+
25
+ },
26
+
27
+ computed: {
28
+
29
+ dataItems(){
30
+ if(this.items.length < 1) return []
31
+
32
+ const items = []
33
+
34
+ const dataItems = ((this.pageData ?? {})[(this.datasource ?? {}).key] ?? {}).items ?? []
35
+
36
+ const itemJSON = JSON.stringify(this.items[0])
37
+
38
+ for(let data of dataItems){
39
+ const item = JSON.parse(itemJSON)
40
+ item.data = data
41
+ items.push(item)
42
+ }
43
+
44
+ return items
45
+ }
46
+
47
+ }
48
+
49
+ }
50
+
51
+ </script>
52
+
53
+ <style module>
54
+
55
+ .comp{
56
+
57
+ }
58
+
59
+ </style>
@@ -21,8 +21,15 @@ export default{
21
21
  items: Array,
22
22
  flexColumns: Array,
23
23
  columnType: Array,
24
+ data: Object
24
25
  },
25
26
 
27
+ provide(){
28
+ return {
29
+ parentData: this.data
30
+ }
31
+ }
32
+
26
33
  }
27
34
 
28
35
  </script>
@@ -50,6 +50,7 @@ export default{
50
50
  target: String,
51
51
  text: String,
52
52
  download: Object,
53
+ data: Object,
53
54
  },
54
55
 
55
56
  computed: {
@@ -70,6 +71,12 @@ export default{
70
71
  return obj
71
72
  }
72
73
 
74
+ },
75
+
76
+ provide(){
77
+ return {
78
+ parentData: this.data
79
+ }
73
80
  }
74
81
 
75
82
  }
@@ -1,15 +1,18 @@
1
1
  <template>
2
2
  <component :is="tagName" :class="$style.comp">
3
- {{ text }}
3
+ {{ computedText }}
4
4
  </component>
5
5
  </template>
6
6
 
7
7
  <script>
8
8
 
9
9
  import {componentMixin} from "../mixin/component";
10
+ import {applyDatasourceReplacer} from "../utils/helpers";
10
11
 
11
12
  export default{
12
13
 
14
+ inject: [ 'parentData' ],
15
+
13
16
  mixins: [ componentMixin ],
14
17
 
15
18
  props: {
@@ -21,7 +24,18 @@ export default{
21
24
  default: 'span'
22
25
  }
23
26
 
24
- }
27
+ },
28
+
29
+ computed: {
30
+
31
+ computedText(){
32
+ if(this.parentData){
33
+ return applyDatasourceReplacer(this.text, this.parentData)
34
+ }
35
+ return this.text
36
+ }
37
+
38
+ }
25
39
 
26
40
  }
27
41
 
package/src/index.js CHANGED
@@ -422,6 +422,7 @@ export default{
422
422
  app.component('Testimonial', defineAsyncComponent(() => import("./components/Testimonial.vue")))
423
423
  app.component('TextBlock', defineAsyncComponent(() => import("./components/TextBlock.vue")))
424
424
  app.component('TextEditor', defineAsyncComponent(() => import("./components/TextEditor.vue")))
425
+ app.component('DataList', defineAsyncComponent(() => import("./components/DataList.vue")))
425
426
 
426
427
  app.component('AhrefSetting', defineAsyncComponent(() => import("./widgets/AhrefSetting.vue")))
427
428
  app.component('ArticleSetting', defineAsyncComponent(() => import("./widgets/ArticleSetting.vue")))
@@ -470,5 +471,6 @@ export default{
470
471
  app.component('WebLayoutSelector', defineAsyncComponent(() => import("./widgets/WebLayoutSelector.vue")))
471
472
  app.component('WebTemplateCreator', defineAsyncComponent(() => import("./widgets/WebTemplateCreator.vue")))
472
473
  app.component('ModalSetting', defineAsyncComponent(() => import("./widgets/ModalSetting.vue")))
474
+ app.component('DataListSetting', defineAsyncComponent(() => import("./widgets/DataListSetting.vue")))
473
475
  }
474
476
  }
@@ -495,7 +495,117 @@
495
495
  </button>
496
496
  </div>
497
497
  <div class="h-[1px] bg-text-100 mt-2 mb-4"></div>
498
- <div class="grid grid-cols-2 gap-4" v-if="expanded['gridColumn']">
498
+ <div v-if="expanded['gridColumn']"
499
+ v-for="(_, idx) in viewTypes"
500
+ v-show="viewType === _.value"
501
+ class="grid grid-cols-2 gap-4">
502
+
503
+ <div>
504
+ <label class="text-text-400">Columns</label>
505
+ <Dropdown v-model="columns[idx]" class="mt-1">
506
+ <option value="">Not Set</option>
507
+ <option :value="`${viewType}grid-cols-1`">1</option>
508
+ <option :value="`${viewType}grid-cols-2`">2</option>
509
+ <option :value="`${viewType}grid-cols-3`">3</option>
510
+ <option :value="`${viewType}grid-cols-4`">4</option>
511
+ <option :value="`${viewType}grid-cols-5`">5</option>
512
+ <option :value="`${viewType}grid-cols-6`">6</option>
513
+ <option :value="`${viewType}grid-cols-7`">7</option>
514
+ <option :value="`${viewType}grid-cols-8`">8</option>
515
+ <option :value="`${viewType}grid-cols-9`">9</option>
516
+ <option :value="`${viewType}grid-cols-10`">10</option>
517
+ <option :value="`${viewType}grid-cols-11`">11</option>
518
+ <option :value="`${viewType}grid-cols-12`">12</option>
519
+ <option :value="`${viewType}grid-cols-none`">None</option>
520
+ </Dropdown>
521
+ </div>
522
+
523
+ <div>
524
+ <label class="text-text-400">Rows</label>
525
+ <Dropdown v-model="rows[idx]"
526
+ class="mt-1">
527
+ <option value="">Not Set</option>
528
+ <option :value="`${viewType}grid-rows-1`">1</option>
529
+ <option :value="`${viewType}grid-rows-2`">2</option>
530
+ <option :value="`${viewType}grid-rows-3`">3</option>
531
+ <option :value="`${viewType}grid-rows-4`">4</option>
532
+ <option :value="`${viewType}grid-rows-5`">5</option>
533
+ <option :value="`${viewType}grid-rows-6`">6</option>
534
+ <option :value="`${viewType}grid-rows-7`">7</option>
535
+ <option :value="`${viewType}grid-rows-8`">8</option>
536
+ <option :value="`${viewType}grid-rows-9`">9</option>
537
+ <option :value="`${viewType}grid-rows-10`">10</option>
538
+ <option :value="`${viewType}grid-rows-11`">11</option>
539
+ <option :value="`${viewType}grid-rows-12`">12</option>
540
+ <option :value="`${viewType}grid-rows-none`">None</option>
541
+ </Dropdown>
542
+ </div>
543
+
544
+ <div>
545
+ <label class="text-text-400">Gap</label>
546
+ <Dropdown v-model="gap[idx]" class="mt-1">
547
+ <option value="">Not Set</option>
548
+ <option :value="`${viewType}gap-0`">0</option>
549
+ <option :value="`${viewType}gap-1`">1</option>
550
+ <option :value="`${viewType}gap-2`">2</option>
551
+ <option :value="`${viewType}gap-3`">3</option>
552
+ <option :value="`${viewType}gap-4`">4</option>
553
+ <option :value="`${viewType}gap-5`">5</option>
554
+ <option :value="`${viewType}gap-6`">6</option>
555
+ <option :value="`${viewType}gap-7`">7</option>
556
+ <option :value="`${viewType}gap-8`">8</option>
557
+ <option :value="`${viewType}gap-9`">9</option>
558
+ <option :value="`${viewType}gap-10`">10</option>
559
+ <option :value="`${viewType}gap-11`">11</option>
560
+ <option :value="`${viewType}gap-12`">12</option>
561
+ </Dropdown>
562
+ </div>
563
+
564
+ <div>
565
+ <label class="text-text-400">Auto Flow</label>
566
+ <Dropdown v-model="autoFlow[idx]" class="mt-1">
567
+ <option value="">Not Set</option>
568
+ <option :value="`${viewType}grid-flow-row`">Row</option>
569
+ <option :value="`${viewType}grid-flow-col`">Col</option>
570
+ <option :value="`${viewType}grid-flow-dense`">Dense</option>
571
+ <option :value="`${viewType}grid-flow-row-dense`">Row Dense</option>
572
+ <option :value="`${viewType}grid-flow-col-dense`">Col Dense</option>
573
+ </Dropdown>
574
+ </div>
575
+
576
+ <div>
577
+ <label class="text-text-400">Align Items</label>
578
+ <Dropdown v-for="(_, idx) in viewTypes"
579
+ v-show="viewType === _.value"
580
+ v-model="alignItems[idx]"
581
+ class="w-full">
582
+ <option value="">Not Set</option>
583
+ <option :value="`${viewType}items-start`">Start</option>
584
+ <option :value="`${viewType}items-end`">End</option>
585
+ <option :value="`${viewType}items-center`">Center</option>
586
+ <option :value="`${viewType}items-baseline`">Baseline</option>
587
+ <option :value="`${viewType}items-stretch`">Stretch</option>
588
+ </Dropdown>
589
+ </div>
590
+
591
+ <div>
592
+ <label class="text-text-400">Justify Content</label>
593
+ <Dropdown v-for="(_, idx) in viewTypes"
594
+ v-show="viewType === _.value"
595
+ v-model="justifyContent[idx]"
596
+ class="w-full">
597
+ <option value="">Not Set</option>
598
+ <option :value="`${viewType}justify-normal`">Normal</option>
599
+ <option :value="`${viewType}justify-start`">Start</option>
600
+ <option :value="`${viewType}justify-end`">End</option>
601
+ <option :value="`${viewType}justify-center`">Center</option>
602
+ <option :value="`${viewType}justify-between`">Between</option>
603
+ <option :value="`${viewType}justify-around`">Around</option>
604
+ <option :value="`${viewType}justify-evenly`">Evenly</option>
605
+ <option :value="`${viewType}justify-stretch`">Stretch</option>
606
+ </Dropdown>
607
+ </div>
608
+
499
609
  <div>
500
610
  <label class="flex-1 text-text-400">Column Span</label>
501
611
  <div v-for="(_, index) in viewTypes"
@@ -1083,6 +1193,36 @@ export default{
1083
1193
 
1084
1194
  computed: {
1085
1195
 
1196
+ autoFlow(){
1197
+ if(!Array.isArray(this.item.props.autoFlow))
1198
+ this.item.props.autoFlow = []
1199
+ return this.item.props.autoFlow
1200
+ },
1201
+
1202
+ columns(){
1203
+ if(!Array.isArray(this.item.props.columns))
1204
+ this.item.props.columns = []
1205
+ return this.item.props.columns
1206
+ },
1207
+
1208
+ rows(){
1209
+ if(!Array.isArray(this.item.props.rows))
1210
+ this.item.props.rows = []
1211
+ return this.item.props.rows
1212
+ },
1213
+
1214
+ alignItems(){
1215
+ if(!Array.isArray(this.item.props.alignItems))
1216
+ this.item.props.alignItems = []
1217
+ return this.item.props.alignItems
1218
+ },
1219
+
1220
+ justifyContent(){
1221
+ if(!Array.isArray(this.item.props.justifyContent))
1222
+ this.item.props.justifyContent = []
1223
+ return this.item.props.justifyContent
1224
+ },
1225
+
1086
1226
  animate(){
1087
1227
  if(!Array.isArray(this.item.props.animate))
1088
1228
  this.item.props.animate = []
@@ -1582,6 +1722,8 @@ export default{
1582
1722
  [ 'Inline Flex', 'inline-flex' ],
1583
1723
  [ 'Table', 'table' ],
1584
1724
  [ 'Inline Table', 'inline-table' ],
1725
+ [ 'Grid', 'grid' ],
1726
+ [ 'Inline Grid', 'inline-grid' ],
1585
1727
  ],
1586
1728
  divideStyle: [
1587
1729
  [ 'Solid', 'divide-solid' ],
@@ -91,6 +91,18 @@ export default{
91
91
  return
92
92
  }
93
93
 
94
+ const utm = this.utm && Object.values(this.utm).join('').length > 0 ? this.utm :
95
+ ('utm_source' in this.$route.query || 'utm_medium' in this.$route.query ||
96
+ 'utm_campaign' in this.$route.query || 'utm_id' in this.$route.query ||
97
+ 'utm_term' in this.$route.query || 'utm_content' in this.$route.query ? {
98
+ source: this.$route.query.utm_source,
99
+ medium: this.$route.query.utm_medium,
100
+ campaign: this.$route.query.utm_campaign,
101
+ id: this.$route.query.utm_id,
102
+ term: this.$route.query.utm_term,
103
+ content: this.$route.query.utm_content,
104
+ } : null)
105
+
94
106
  this.$refs.submitBtn.setState(2)
95
107
  this.axios({
96
108
  method: this.submitMethod ?? 'post',
@@ -101,7 +113,7 @@ export default{
101
113
  componentUid: this.uid,
102
114
  ...this.form,
103
115
  type: 1,
104
- utm: this.utm,
116
+ utm,
105
117
  },
106
118
  params: this.form
107
119
  })
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+
4
+ <div>
5
+ <div class="flex flex-row gap-4 items-center cursor-pointer"
6
+ @click="expanded['datalist'] = !expanded['datalist']">
7
+ <strong class="flex-1 text-text-400">Data List</strong>
8
+ <label class="text-primary">
9
+ {{ expanded['datalist'] ? 'Hide': 'Show' }}
10
+ </label>
11
+ </div>
12
+ <div class="h-[1px] bg-text-100 mt-2 mb-4"></div>
13
+ <div v-if="expanded['datalist']">
14
+
15
+ <div>
16
+ <label class="flex-1 text-text-400">Data key</label>
17
+ <Textbox v-model="datasource.key" @keyup.enter="apply"/>
18
+ </div>
19
+
20
+ </div>
21
+ </div>
22
+
23
+ <ComponentSetting :item="item"
24
+ :view-type="viewType"
25
+ :view-types="viewTypes"
26
+ defaultDisplay="flex"
27
+ @change="apply" />
28
+
29
+ </div>
30
+ </template>
31
+
32
+ <script>
33
+
34
+ export default{
35
+
36
+ emits: [ 'change' ],
37
+
38
+ inject: [ 'confirm', 'imageSrc', 'uploadImage', 'store' ],
39
+
40
+ props: {
41
+
42
+ item: {
43
+ type: Object,
44
+ required: true
45
+ },
46
+
47
+ viewType: String,
48
+
49
+ viewTypes: Array,
50
+
51
+ },
52
+
53
+ methods: {
54
+
55
+ apply(){
56
+ this.$emit('change')
57
+ }
58
+
59
+ },
60
+
61
+ computed: {
62
+
63
+ componentStore(){
64
+ if(this.store && this.store.components){
65
+ if(!this.store.components.compsetting)
66
+ this.store.components.compsetting = {}
67
+
68
+ return this.store.components.compsetting
69
+ }
70
+ return {}
71
+ },
72
+
73
+ expanded(){
74
+ if(!this.componentStore['expanded'])
75
+ this.componentStore['expanded'] = {}
76
+ return this.componentStore['expanded']
77
+ },
78
+
79
+ datasource(){
80
+ if(!this.item.props.datasource)
81
+ this.item.props.datasource = {}
82
+ return this.item.props.datasource
83
+ }
84
+
85
+ },
86
+
87
+ data(){
88
+ return {
89
+ }
90
+ },
91
+
92
+ }
93
+
94
+ </script>
95
+
96
+ <style module>
97
+
98
+ .comp{
99
+ @apply flex flex-col gap-6;
100
+ }
101
+
102
+ </style>
@@ -33,9 +33,7 @@
33
33
 
34
34
  <div>
35
35
  <label class="text-text-400">Rows</label>
36
- <Dropdown v-for="(_, index) in viewTypes"
37
- v-show="_.value === viewType"
38
- v-model="rows[index]"
36
+ <Dropdown v-model="rows[idx]"
39
37
  class="mt-1"
40
38
  @change="$emit('change')">
41
39
  <option value="">Not Set</option>
@@ -10,7 +10,7 @@
10
10
  </label>
11
11
  </div>
12
12
  <div class="h-[1px] bg-text-100 mt-2 mb-4"></div>
13
- <div v-if="expanded['image']">
13
+ <div v-if="expanded['image']" class="flex flex-col gap-4">
14
14
 
15
15
  <div v-for="(_viewType, index) in viewTypes"
16
16
  v-show="_viewType.value === viewType">
@@ -1540,6 +1540,8 @@ export default{
1540
1540
  icons:[], columns:[ 'grid-cols-4' ],
1541
1541
  }},
1542
1542
 
1543
+ { type:'DataList', name:'Data List', group:'Widgets', props:{}, items:[] },
1544
+
1543
1545
  { type:'FAQ', name:'FAQ', group:'Widgets', thumbnailUrl:"/images/templates/faq.gif", props:{ items:[] }},
1544
1546
 
1545
1547
  { type:'FeatureList', name:'Feature List', group:'Widgets', props:{ items:[], columns:[], variant:['variant1'] }},
@@ -35,6 +35,7 @@ module.exports = {
35
35
  'aspect-[1/2]', 'aspect-[2/3]', 'aspect-[3/4]', 'aspect-[8/9]',
36
36
 
37
37
  'hidden', 'block', 'inline-block', 'inline', 'flex', 'inline-flex', 'table', 'inline-table',
38
+ 'grid', 'inline-grid',
38
39
 
39
40
  'static', 'fixed', 'absolute', 'relative', 'sticky',
40
41
 
@@ -252,6 +253,7 @@ module.exports = {
252
253
  'md:aspect-[1/2]', 'md:aspect-[2/3]', 'md:aspect-[3/4]', 'md:aspect-[8/9]',
253
254
 
254
255
  'md:hidden', 'md:block', 'md:inline-block', 'md:inline', 'md:flex', 'md:inline-flex', 'md:table', 'md:inline-table',
256
+ 'md:grid', 'md:inline-grid',
255
257
 
256
258
  'md:static', 'md:fixed', 'md:absolute', 'md:relative', 'md:sticky',
257
259