@mixd-id/web-scaffold 0.1.230406111 → 0.1.230406112

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.230406111",
4
+ "version": "0.1.230406112",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -0,0 +1,86 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+ <div :class="$style.head">
4
+ <h2 v-if="title">{{ title }}</h2>
5
+ <p v-if="description" v-html="description"></p>
6
+ </div>
7
+ <div :class="$style.container">
8
+ <div v-for="item in items" :class="$style.item">
9
+ <div class="flex flex-col gap-2 flex-1">
10
+ <div class="flex justify-center">
11
+ <svg width="19" height="19" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M464 256h-80v-64c0-35.3 28.7-64 64-64h8c13.3 0 24-10.7 24-24V56c0-13.3-10.7-24-24-24h-8c-88.4 0-160 71.6-160 160v240c0 26.5 21.5 48 48 48h128c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48zm-288 0H96v-64c0-35.3 28.7-64 64-64h8c13.3 0 24-10.7 24-24V56c0-13.3-10.7-24-24-24h-8C71.6 32 0 103.6 0 192v240c0 26.5 21.5 48 48 48h128c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48z"/></svg>
12
+ </div>
13
+ <p>{{ item.text }}</p>
14
+ </div>
15
+ <div class="h-[1px] bg-gray-200"></div>
16
+ <div class="flex flex-row items-center gap-2">
17
+ <Image class="w-[36px] aspect-square"
18
+ :src="imageSrc(item.imageUrl)" />
19
+ <div class="flex-1 flex flex-col leading-tight">
20
+ <div class="text-sm text-ellipsis overflow-hidden whitespace-nowrap">
21
+ {{ item.name }}
22
+ </div>
23
+ <small class="text-gray-500">
24
+ {{ dayjs(item.createdAt).format('D MMM YY') }}
25
+ </small>
26
+ </div>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ </template>
32
+
33
+ <script>
34
+
35
+ import { componentMixin } from '../mixin/component';
36
+ import dayjs from "dayjs";
37
+
38
+ export default{
39
+
40
+ mixins: [ componentMixin ],
41
+
42
+ props: {
43
+
44
+ title: String,
45
+
46
+ description: String,
47
+
48
+ items: Array
49
+
50
+ },
51
+
52
+ methods: {
53
+
54
+ dayjs
55
+
56
+ }
57
+
58
+ }
59
+
60
+ </script>
61
+
62
+ <style module>
63
+
64
+ .comp{
65
+ @apply flex-1 flex flex-col gap-4 bg-gray-100 overflow-hidden;
66
+ }
67
+
68
+ .head{
69
+ @apply text-center md:text-left;
70
+ }
71
+
72
+ .container{
73
+ @apply overflow-x-auto flex flex-row gap-8 md:gap-10 p-1;
74
+ }
75
+ .container::-webkit-scrollbar {
76
+ display: none;
77
+ }
78
+
79
+ .item{
80
+ @apply min-w-[200px] max-w-[200px] bg-white p-6 pb-3 shadow-md flex flex-col gap-2;
81
+ }
82
+ .item p{
83
+ @apply text-lg font-serif max-h-[225px] overflow-hidden;
84
+ }
85
+
86
+ </style>
package/src/index.js CHANGED
@@ -340,6 +340,7 @@ export default{
340
340
  app.component('SplitPane', defineAsyncComponent(() => import("./components/SplitPane.vue")))
341
341
  app.component('Table', defineAsyncComponent(() => import("./components/Table.vue")))
342
342
  app.component('TabView', defineAsyncComponent(() => import("./components/TabView.vue")))
343
+ app.component('Testimonial', defineAsyncComponent(() => import("./components/Testimonial.vue")))
343
344
  app.component('TextBlock', defineAsyncComponent(() => import("./components/TextBlock.vue")))
344
345
  app.component('TextEditor', defineAsyncComponent(() => import("./components/TextEditor.vue")))
345
346
  app.component('PaddingBox', defineAsyncComponent(() => import("./components/PaddingBox.vue")))
@@ -392,6 +393,8 @@ export default{
392
393
  app.component('StyleSetting', defineAsyncComponent(() => import("./widgets/StyleSetting.vue")))
393
394
  app.component('TableItem', defineAsyncComponent(() => import("./widgets/TableItem.vue")))
394
395
  app.component('TableSetting', defineAsyncComponent(() => import("./widgets/TableSetting.vue")))
396
+ app.component('TestimonialItem', defineAsyncComponent(() => import("./widgets/TestimonialItem.vue")))
397
+ app.component('TestimonialSetting', defineAsyncComponent(() => import("./widgets/TestimonialSetting.vue")))
395
398
  app.component('TextBlockItem', defineAsyncComponent(() => import("./widgets/TextBlockItem.vue")))
396
399
  app.component('TextBlockSetting', defineAsyncComponent(() => import("./widgets/TextBlockSetting.vue")))
397
400
  }
@@ -65,5 +65,14 @@ export const componentMixin = {
65
65
  ]
66
66
  }
67
67
 
68
+ },
69
+
70
+ methods: {
71
+
72
+ imageSrc(src){
73
+ return typeof src === 'string' ?
74
+ import.meta.env.VITE_IMAGE_HOST + '/' + src : src
75
+ }
76
+
68
77
  }
69
78
  };
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <div class="flex-1 flex flex-row items-center gap-2">
3
+ {{ item.props.name ?? item.type }}
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+
9
+ export default{
10
+
11
+ props: {
12
+ item: Object
13
+ }
14
+
15
+ }
16
+
17
+ </script>
18
+
19
+ <style module>
20
+
21
+ .comp{
22
+
23
+ }
24
+
25
+ </style>
@@ -0,0 +1,152 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+ <div>
4
+ <label class="text-text-400">Title</label>
5
+ <Textbox v-model="item.props.title" class="mt-1" />
6
+ </div>
7
+
8
+ <div>
9
+ <label class="text-text-400">Description</label>
10
+ <Textarea v-model="item.props.description" rows="3" class="mt-1" />
11
+ </div>
12
+
13
+ <div>
14
+ <div class="flex flex-row items-center">
15
+ <label class="text-text-400 flex-1">Testimonials</label>
16
+ <button type="button" class="text-primary" @click="$refs.modal.open({ createdAt:'2023-01-01' })">Add</button>
17
+ </div>
18
+ <ListItem :items="items"
19
+ @reorder="(from, to) => { items.splice(to, 0, items.splice(from, 1)[0]); $emit('change') }">
20
+ <template v-slot="{ item, index }">
21
+ <div class="flex flex-row items-center gap-3 cursor-pointer">
22
+ <div data-reorder>
23
+ <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>
24
+ </div>
25
+ <div class="flex-1 p-2" @click="$refs.modal.open(item)">
26
+ <p class="line-clamp-2">
27
+ {{ item.text }}
28
+ </p>
29
+ </div>
30
+ <div>
31
+ <button type="button" @click="confirm($t('Remove this item?'), '', () => { items.splice(index, 1); $emit('change') })">
32
+ <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>
33
+ </button>
34
+ </div>
35
+ </div>
36
+ </template>
37
+ </ListItem>
38
+ </div>
39
+
40
+ <Modal ref="modal" width="360" height="420">
41
+ <template v-slot:head>
42
+ <div class="relative p-5">
43
+ <h3>Add Testimonial</h3>
44
+ <div class="absolute top-0 right-0 p-2">
45
+ <button type="button" class="p-2" @click="$refs.modal.close()">
46
+ <svg width="24" height="24" viewBox="0 0 24 24" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg">
47
+ <path d="M6.53034 5.46965C6.23745 5.17676 5.76257 5.17676 5.46968 5.46965C5.17679 5.76255 5.17679 6.23742 5.46968 6.53031L10.9393 12L5.46967 17.4697C5.17678 17.7626 5.17678 18.2374 5.46967 18.5303C5.76256 18.8232 6.23744 18.8232 6.53033 18.5303L12 13.0606L17.4697 18.5303C17.7626 18.8232 18.2375 18.8232 18.5303 18.5303C18.8232 18.2374 18.8232 17.7626 18.5303 17.4697L13.0607 12L18.5303 6.53032C18.8232 6.23743 18.8232 5.76256 18.5303 5.46966C18.2374 5.17677 17.7626 5.17677 17.4697 5.46966L12 10.9393L6.53034 5.46965Z"/>
48
+ </svg>
49
+ </button>
50
+ </div>
51
+ </div>
52
+ </template>
53
+ <template v-slot:foot="{ context }">
54
+ <div class="p-6">
55
+ <Button @click="apply(context)"
56
+ :state="!context.text || !context.name || !context.createdAt ? -1 : 1"
57
+ class="w-full">Add Testimonial</Button>
58
+ </div>
59
+ </template>
60
+ <template #default="{ context }">
61
+ <div class="flex-1 p-6 flex flex-col gap-6">
62
+ <Textarea v-model="context.text" rows="5" placeholder="Text"></Textarea>
63
+ <div class="flex flex-row gap-4 items-center">
64
+ <Image ref="image" class="w-[64px] aspect-square rounded-full bg-text-50"
65
+ :src="imageSrc(context.imageUrl)"
66
+ :editable="true"
67
+ @click="$refs.image.edit()"
68
+ @change="(base64, file) => context.imageUrl = file"/>
69
+ <div class="flex-1 flex flex-col gap-1">
70
+ <Textbox v-model="context.name" placeholder="Name" />
71
+ <Datepicker v-model="context.createdAt" placeholder="Time" mode="popup" />
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </template>
76
+ </Modal>
77
+
78
+
79
+ <ComponentSetting :item="item"
80
+ :view-type="viewType"
81
+ :view-types="viewTypes"
82
+ default-display="block"
83
+ @change="$emit('change')" />
84
+ </div>
85
+ </template>
86
+
87
+ <script>
88
+
89
+ export default{
90
+
91
+ emits: [ 'change' ],
92
+
93
+ inject: [ 'confirm', 'imageSrc', 'socketEmit2' ],
94
+
95
+ methods: {
96
+
97
+ apply(item){
98
+
99
+ const index = this.item.props.items.indexOf(item)
100
+ if(index === -1){
101
+ this.item.props.items.push(item)
102
+ }
103
+ else{
104
+ Object.assign(this.item.props.items[index], item)
105
+ }
106
+
107
+ this.$refs.modal.close()
108
+ this.$emit('change')
109
+ },
110
+
111
+ save(){
112
+ this.$emit('save')
113
+ this.close()
114
+ }
115
+
116
+ },
117
+
118
+ props: {
119
+
120
+ item: {
121
+ type: Object,
122
+ required: true
123
+ },
124
+
125
+ viewType: String,
126
+
127
+ viewTypes: Array,
128
+
129
+ },
130
+
131
+ computed: {
132
+
133
+ items(){
134
+ if(!Array.isArray(this.item.props.items)){
135
+ this.item.props.items = []
136
+ }
137
+ return this.item.props.items
138
+ }
139
+
140
+ }
141
+
142
+ }
143
+
144
+ </script>
145
+
146
+ <style module>
147
+
148
+ .comp{
149
+ @apply flex flex-col gap-4;
150
+ }
151
+
152
+ </style>
@@ -993,6 +993,9 @@ export default{
993
993
  channels:[],
994
994
  }},
995
995
 
996
+ { type:'Testimonial', name:'Testimonial', group:'Widgets', props:{
997
+ }},
998
+
996
999
  { type:'Header', name:'Header', group:'Headers', props:{
997
1000
  htmlText:'', images:{},
998
1001
  }},