@mixd-id/web-scaffold 0.1.240411028 → 0.1.240411030
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 +1 -1
- package/src/components/ContextMenu.vue +12 -1
- package/src/components/List.vue +8 -1
- package/src/components/ListContextMenu.vue +88 -0
- package/src/components/Textbox.vue +1 -1
- package/src/index.js +1 -0
- package/src/utils/importer.js +22 -3
- package/src/utils/wss.js +0 -17
- package/src/utils/wss.mjs +4 -2
- package/src/widgets/WebLayoutSelector.vue +11 -192
- package/src/widgets/WebPageBuilder.vue +2 -0
package/package.json
CHANGED
|
@@ -177,6 +177,17 @@ export default {
|
|
|
177
177
|
left = Math.round(rect.x)
|
|
178
178
|
top = Math.round(rect.y + rect.height)
|
|
179
179
|
transformOrigin = 'top left'
|
|
180
|
+
maxHeight = window.innerHeight - top - 16
|
|
181
|
+
this.transition = 'slidedown'
|
|
182
|
+
|
|
183
|
+
if(top > window.innerHeight * .8){
|
|
184
|
+
top = null
|
|
185
|
+
bottom = window.innerHeight - rect.top + 8
|
|
186
|
+
transformOrigin = 'bottom'
|
|
187
|
+
maxHeight = Math.round(rect.top - 16)
|
|
188
|
+
console.log('maxHeight', maxHeight)
|
|
189
|
+
this.transition = 'slideup'
|
|
190
|
+
}
|
|
180
191
|
break
|
|
181
192
|
}
|
|
182
193
|
|
|
@@ -234,7 +245,7 @@ export default {
|
|
|
234
245
|
|
|
235
246
|
.contextMenu{
|
|
236
247
|
@apply fixed bg-base-300 min-w-[150px] overflow-y-auto rounded-xl z-50;
|
|
237
|
-
@apply whitespace-nowrap shadow-2xl border-[1px] border-text-
|
|
248
|
+
@apply whitespace-nowrap shadow-2xl border-[1px] border-text-200 mt-[1px];
|
|
238
249
|
}
|
|
239
250
|
|
|
240
251
|
@media screen and (min-width: 640px){
|
package/src/components/List.vue
CHANGED
|
@@ -985,8 +985,15 @@ export default{
|
|
|
985
985
|
},
|
|
986
986
|
|
|
987
987
|
preset(){
|
|
988
|
-
|
|
988
|
+
const preset = this.configPresets.find(_ => _.uid === this.configParams.presetIdx) ??
|
|
989
989
|
this.configSharedPresets.find(_ => _.uid === this.configParams.presetIdx)
|
|
990
|
+
|
|
991
|
+
if(preset){
|
|
992
|
+
if(this.$route.query?.search)
|
|
993
|
+
preset.search = this.$route.query.search
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
return preset
|
|
990
997
|
},
|
|
991
998
|
|
|
992
999
|
presetSrc(){
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ContextMenu ref="contextMenu" class="mt-1">
|
|
3
|
+
<div class="flex flex-col min-w-[200px]">
|
|
4
|
+
|
|
5
|
+
<div class="p-1 sticky top-0 bg-base-500" @click.stop>
|
|
6
|
+
<Textbox :clearable="true" @clear="search = ''" placeholder="Search or add..." v-model="search" />
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<button v-if="viewedItems.length > 0" v-for="text in viewedItems" class="w-full p-3 text-left flex flex-row menu-item"
|
|
10
|
+
@click="select(text)">
|
|
11
|
+
{{ text }}
|
|
12
|
+
</button>
|
|
13
|
+
|
|
14
|
+
<button v-else-if="search.length > 0" type="button" class="w-full p-3 text-primary" @click="add(search)">
|
|
15
|
+
Tambah {{ search }}
|
|
16
|
+
</button>
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
</ContextMenu>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import ContextMenu from "./ContextMenu.vue";
|
|
24
|
+
|
|
25
|
+
export default{
|
|
26
|
+
components: {ContextMenu},
|
|
27
|
+
|
|
28
|
+
emits: [ 'select' ],
|
|
29
|
+
|
|
30
|
+
props: {
|
|
31
|
+
items: Array
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
computed: {
|
|
35
|
+
|
|
36
|
+
viewedItems(){
|
|
37
|
+
return (this.items ?? [])
|
|
38
|
+
.filter(text => {
|
|
39
|
+
return text.toLowerCase().includes(this.search.toLowerCase())
|
|
40
|
+
})
|
|
41
|
+
.sort((a, b) => {
|
|
42
|
+
return a.toLowerCase().localeCompare(b.toLowerCase())
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
data(){
|
|
49
|
+
return {
|
|
50
|
+
search: '',
|
|
51
|
+
cb: null
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
methods: {
|
|
56
|
+
|
|
57
|
+
add(text){
|
|
58
|
+
if(`${text}`.length < 1) return
|
|
59
|
+
|
|
60
|
+
this.items.push(text)
|
|
61
|
+
this.select(text)
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
select(text){
|
|
65
|
+
this.$emit('select', text)
|
|
66
|
+
if(typeof this.cb === 'function')
|
|
67
|
+
this.cb(text)
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
open(caller, cb){
|
|
71
|
+
this.search = ''
|
|
72
|
+
this.cb = cb
|
|
73
|
+
this.$refs.contextMenu.open(caller)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<style module>
|
|
83
|
+
|
|
84
|
+
.comp{
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
</style>
|
|
@@ -74,6 +74,7 @@ export default{
|
|
|
74
74
|
this.$style.textbox,
|
|
75
75
|
this.$style['state-' + this.computedState],
|
|
76
76
|
this.readonly ? this.$style.readonly : '',
|
|
77
|
+
this.disabled ? this.$style.disabled : '',
|
|
77
78
|
this.isActive && !this.readonly ? this.$style.active : '',
|
|
78
79
|
this.align ? this.$style['align-' + this.align] : '',
|
|
79
80
|
this.size ? this.$style['size-' + this.size] : ''
|
|
@@ -186,7 +187,6 @@ export default{
|
|
|
186
187
|
}
|
|
187
188
|
|
|
188
189
|
.textbox.readonly{
|
|
189
|
-
@apply bg-text-50;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
.size-sm input{ @apply text-sm; }
|
package/src/index.js
CHANGED
|
@@ -489,6 +489,7 @@ export default{
|
|
|
489
489
|
app.component('MultiDropdown', defineAsyncComponent(() => import("./components/MultiDropdown.vue")))
|
|
490
490
|
app.component('Carousel', defineAsyncComponent(() => import("./components/Carousel.vue")))
|
|
491
491
|
app.component('ContextMenu', defineAsyncComponent(() => import("./components/ContextMenu.vue")))
|
|
492
|
+
app.component('ListContextMenu', defineAsyncComponent(() => import("./components/ListContextMenu.vue")))
|
|
492
493
|
app.component('FAQ', defineAsyncComponent(() => import("./widgets/FAQ.vue")))
|
|
493
494
|
app.component('Flex', defineAsyncComponent(() => import("./components/Flex.vue")))
|
|
494
495
|
app.component('Grid', defineAsyncComponent(() => import("./components/Grid.vue")))
|
package/src/utils/importer.js
CHANGED
|
@@ -5,6 +5,27 @@ const glob = require("glob");
|
|
|
5
5
|
const Exceljs = require("exceljs")
|
|
6
6
|
const { saveBuffer, unflatten } = require('./helpers.js')
|
|
7
7
|
|
|
8
|
+
const getCellText = (cell) => {
|
|
9
|
+
if(!cell) return ''
|
|
10
|
+
|
|
11
|
+
let value = ''
|
|
12
|
+
if(cell.formulaType === 1){
|
|
13
|
+
value = cell.result
|
|
14
|
+
}
|
|
15
|
+
else if(cell.value?.error){
|
|
16
|
+
value = '#ERR'
|
|
17
|
+
}
|
|
18
|
+
else if(cell.value?.hyperlink){
|
|
19
|
+
value = cell.value.hyperlink
|
|
20
|
+
}
|
|
21
|
+
else{
|
|
22
|
+
value = cell.value
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return value
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
8
29
|
const analyseRequest = async(req) => {
|
|
9
30
|
|
|
10
31
|
const file = req.files[0]
|
|
@@ -161,9 +182,7 @@ const importRequest = async(req) => {
|
|
|
161
182
|
const key = keys[idx]
|
|
162
183
|
if(key.value && columnAddress[key.value]){
|
|
163
184
|
const cell = row.getCell(columnAddress[key.value])
|
|
164
|
-
|
|
165
|
-
if(value && value.error) value = ''
|
|
166
|
-
obj[key.key] = value
|
|
185
|
+
obj[key.key] = getCellText(cell)
|
|
167
186
|
}
|
|
168
187
|
}
|
|
169
188
|
|
package/src/utils/wss.js
CHANGED
|
@@ -131,10 +131,6 @@ class WSS extends EventEmitter2{
|
|
|
131
131
|
if(subscriber){
|
|
132
132
|
subscriber.unsubscribe(channel, listener)
|
|
133
133
|
}
|
|
134
|
-
|
|
135
|
-
if(process.verbose){
|
|
136
|
-
process.verbose('wss.leave', channel)
|
|
137
|
-
}
|
|
138
134
|
}
|
|
139
135
|
|
|
140
136
|
socket.join = (channel) => {
|
|
@@ -146,10 +142,6 @@ class WSS extends EventEmitter2{
|
|
|
146
142
|
if(subscriber) {
|
|
147
143
|
subscriber.subscribe(channel, listener)
|
|
148
144
|
}
|
|
149
|
-
|
|
150
|
-
if(process.verbose){
|
|
151
|
-
process.verbose('wss.join', channel)
|
|
152
|
-
}
|
|
153
145
|
}
|
|
154
146
|
|
|
155
147
|
socket.to = (channel) => {
|
|
@@ -297,15 +289,6 @@ class WSS extends EventEmitter2{
|
|
|
297
289
|
|
|
298
290
|
for(let channel of channels){
|
|
299
291
|
await this._client.publish(channel, JSON.stringify({ model, event, items }))
|
|
300
|
-
|
|
301
|
-
if(process.verbose){
|
|
302
|
-
process.verbose('wss.broadcast', {
|
|
303
|
-
channel,
|
|
304
|
-
model,
|
|
305
|
-
event,
|
|
306
|
-
items
|
|
307
|
-
})
|
|
308
|
-
}
|
|
309
292
|
}
|
|
310
293
|
}
|
|
311
294
|
|
package/src/utils/wss.mjs
CHANGED
|
@@ -186,6 +186,8 @@ class WSS extends EventEmitter2{
|
|
|
186
186
|
Object.assign(this._opt, opt)
|
|
187
187
|
|
|
188
188
|
await this.connect(true)
|
|
189
|
+
|
|
190
|
+
console.log('RECONNECTED')
|
|
189
191
|
}
|
|
190
192
|
|
|
191
193
|
sendSync(path, params, cb, err, override){
|
|
@@ -222,12 +224,12 @@ class WSS extends EventEmitter2{
|
|
|
222
224
|
t1: new Date().getTime()
|
|
223
225
|
}
|
|
224
226
|
|
|
225
|
-
const timeout = (override ?? {}).timeout ?? this._opt.timeout
|
|
227
|
+
/*const timeout = (override ?? {}).timeout ?? this._opt.timeout
|
|
226
228
|
setTimeout(() => {
|
|
227
229
|
if(this._callbacks[_requestId] && this._instance.readyState === 1){
|
|
228
230
|
err({ message: 'Timeout' })
|
|
229
231
|
}
|
|
230
|
-
}, timeout)
|
|
232
|
+
}, timeout)*/
|
|
231
233
|
})
|
|
232
234
|
}
|
|
233
235
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Modal ref="modal"
|
|
2
|
+
<Modal ref="modal" width="420" height="480">
|
|
3
3
|
<template v-slot:head>
|
|
4
4
|
<div class="relative p-6">
|
|
5
5
|
<h3>{{ $t('Create Layout') }}</h3>
|
|
@@ -23,13 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
<div>
|
|
25
25
|
<label class="text-text-400">Layouts</label>
|
|
26
|
-
<div class="grid grid-cols-4 gap-2">
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<Image :src="template.imageUrl" class="aspect-[1/2]"/>
|
|
31
|
-
<label>{{ template.layout.name }} </label>
|
|
32
|
-
</div>
|
|
26
|
+
<div class="grid grid-cols-4 gap-2 mt-3">
|
|
27
|
+
<Radio v-for="(template, index) in templates" v-model="instance.templateIndex" :value="index">
|
|
28
|
+
{{ template.layout.name }}
|
|
29
|
+
</Radio>
|
|
33
30
|
</div>
|
|
34
31
|
</div>
|
|
35
32
|
|
|
@@ -37,7 +34,7 @@
|
|
|
37
34
|
</template>
|
|
38
35
|
|
|
39
36
|
<template v-slot:foot>
|
|
40
|
-
<div class="p-5 flex
|
|
37
|
+
<div class="p-5 flex">
|
|
41
38
|
<Button class="w-[100px]"
|
|
42
39
|
ref="applyBtn"
|
|
43
40
|
:state="canApply ? 1 : -1"
|
|
@@ -68,182 +65,6 @@ export default{
|
|
|
68
65
|
footers: []
|
|
69
66
|
}
|
|
70
67
|
},
|
|
71
|
-
{
|
|
72
|
-
imageUrl: '/assets/templates/layout1.png',
|
|
73
|
-
layout: {
|
|
74
|
-
name: 'Nike',
|
|
75
|
-
headers: [
|
|
76
|
-
{
|
|
77
|
-
"type": "Flex",
|
|
78
|
-
"name": "Flex",
|
|
79
|
-
"group": "Layouts",
|
|
80
|
-
"items": [
|
|
81
|
-
{
|
|
82
|
-
"type": "Image",
|
|
83
|
-
"name": "Image",
|
|
84
|
-
"group": "Components",
|
|
85
|
-
"props": {
|
|
86
|
-
"src": [
|
|
87
|
-
"66aafad893b123b69dfcf4ef0f850537.png"
|
|
88
|
-
],
|
|
89
|
-
"enabled": true,
|
|
90
|
-
"aspectRatio": [],
|
|
91
|
-
"display": [],
|
|
92
|
-
"opacity": [],
|
|
93
|
-
"padding": [],
|
|
94
|
-
"margin": [],
|
|
95
|
-
"width": [],
|
|
96
|
-
"minWidth": [],
|
|
97
|
-
"maxWidth": [],
|
|
98
|
-
"height": [
|
|
99
|
-
"h-10vh"
|
|
100
|
-
],
|
|
101
|
-
"minHeight": [],
|
|
102
|
-
"maxHeight": [],
|
|
103
|
-
"overflow": [],
|
|
104
|
-
"colSpan": [],
|
|
105
|
-
"bgColors": [],
|
|
106
|
-
"bgImage": [
|
|
107
|
-
{},
|
|
108
|
-
{}
|
|
109
|
-
],
|
|
110
|
-
"bgSize": [],
|
|
111
|
-
"bgPosition": [],
|
|
112
|
-
"bgRepeat": [],
|
|
113
|
-
"bdSize": [],
|
|
114
|
-
"bdColor": [],
|
|
115
|
-
"bdRadius": [],
|
|
116
|
-
"bdStyle": [],
|
|
117
|
-
"boxShadow": []
|
|
118
|
-
},
|
|
119
|
-
"uid": "e9431764daac79e6d12eaaffb6db048b",
|
|
120
|
-
"instance": {
|
|
121
|
-
"type": "Image",
|
|
122
|
-
"uid": "e9431764daac79e6d12eaaffb6db048b",
|
|
123
|
-
"class": "h-10vh",
|
|
124
|
-
"src": [
|
|
125
|
-
"66aafad893b123b69dfcf4ef0f850537.png"
|
|
126
|
-
],
|
|
127
|
-
"bgImage": [
|
|
128
|
-
{},
|
|
129
|
-
{}
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
],
|
|
134
|
-
"props": {
|
|
135
|
-
"flexColumns": [],
|
|
136
|
-
"direction": [
|
|
137
|
-
"flex-col"
|
|
138
|
-
],
|
|
139
|
-
"gap": [],
|
|
140
|
-
"enabled": true,
|
|
141
|
-
"display": [],
|
|
142
|
-
"opacity": [],
|
|
143
|
-
"padding": [],
|
|
144
|
-
"margin": [],
|
|
145
|
-
"width": [],
|
|
146
|
-
"minWidth": [],
|
|
147
|
-
"maxWidth": [],
|
|
148
|
-
"height": [],
|
|
149
|
-
"minHeight": [],
|
|
150
|
-
"maxHeight": [],
|
|
151
|
-
"overflow": [],
|
|
152
|
-
"colSpan": [],
|
|
153
|
-
"bgColors": [
|
|
154
|
-
"bg-white"
|
|
155
|
-
],
|
|
156
|
-
"bgImage": [
|
|
157
|
-
{},
|
|
158
|
-
{}
|
|
159
|
-
],
|
|
160
|
-
"bgSize": [],
|
|
161
|
-
"bgPosition": [],
|
|
162
|
-
"bgRepeat": [],
|
|
163
|
-
"bdSize": [],
|
|
164
|
-
"bdColor": [],
|
|
165
|
-
"bdRadius": [],
|
|
166
|
-
"bdStyle": [],
|
|
167
|
-
"boxShadow": []
|
|
168
|
-
},
|
|
169
|
-
"uid": "f121447f5dbb20f624b2cc1c45508005",
|
|
170
|
-
"instance": {
|
|
171
|
-
"type": "Flex",
|
|
172
|
-
"uid": "f121447f5dbb20f624b2cc1c45508005",
|
|
173
|
-
"class": "bg-white flex-col",
|
|
174
|
-
"flexColumns": [],
|
|
175
|
-
"bgImage": [
|
|
176
|
-
{},
|
|
177
|
-
{}
|
|
178
|
-
],
|
|
179
|
-
"items": [
|
|
180
|
-
{
|
|
181
|
-
"type": "Image",
|
|
182
|
-
"name": "Image",
|
|
183
|
-
"group": "Components",
|
|
184
|
-
"props": {
|
|
185
|
-
"src": [
|
|
186
|
-
"66aafad893b123b69dfcf4ef0f850537.png"
|
|
187
|
-
],
|
|
188
|
-
"enabled": true,
|
|
189
|
-
"aspectRatio": [],
|
|
190
|
-
"display": [],
|
|
191
|
-
"opacity": [],
|
|
192
|
-
"padding": [],
|
|
193
|
-
"margin": [],
|
|
194
|
-
"width": [],
|
|
195
|
-
"minWidth": [],
|
|
196
|
-
"maxWidth": [],
|
|
197
|
-
"height": [
|
|
198
|
-
"h-10vh"
|
|
199
|
-
],
|
|
200
|
-
"minHeight": [],
|
|
201
|
-
"maxHeight": [],
|
|
202
|
-
"overflow": [],
|
|
203
|
-
"colSpan": [],
|
|
204
|
-
"bgColors": [],
|
|
205
|
-
"bgImage": [
|
|
206
|
-
{},
|
|
207
|
-
{}
|
|
208
|
-
],
|
|
209
|
-
"bgSize": [],
|
|
210
|
-
"bgPosition": [],
|
|
211
|
-
"bgRepeat": [],
|
|
212
|
-
"bdSize": [],
|
|
213
|
-
"bdColor": [],
|
|
214
|
-
"bdRadius": [],
|
|
215
|
-
"bdStyle": [],
|
|
216
|
-
"boxShadow": []
|
|
217
|
-
},
|
|
218
|
-
"uid": "e9431764daac79e6d12eaaffb6db048b",
|
|
219
|
-
"instance": {
|
|
220
|
-
"type": "Image",
|
|
221
|
-
"uid": "e9431764daac79e6d12eaaffb6db048b",
|
|
222
|
-
"class": "h-10vh",
|
|
223
|
-
"src": [
|
|
224
|
-
"66aafad893b123b69dfcf4ef0f850537.png"
|
|
225
|
-
],
|
|
226
|
-
"bgImage": [
|
|
227
|
-
{},
|
|
228
|
-
{}
|
|
229
|
-
]
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
]
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
],
|
|
236
|
-
footers: []
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
imageUrl: '/assets/templates/layout2.png',
|
|
241
|
-
layout: {
|
|
242
|
-
name: 'Apple',
|
|
243
|
-
headers: [],
|
|
244
|
-
footers: []
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
68
|
]
|
|
248
69
|
}
|
|
249
70
|
|
|
@@ -262,17 +83,15 @@ export default{
|
|
|
262
83
|
this.$refs.modal.open()
|
|
263
84
|
},
|
|
264
85
|
|
|
265
|
-
applyTemplate(template){
|
|
266
|
-
Object.assign(this.instance, template.layout)
|
|
267
|
-
},
|
|
268
|
-
|
|
269
86
|
close(){
|
|
270
87
|
this.$refs.modal.close()
|
|
271
88
|
},
|
|
272
89
|
|
|
273
90
|
apply(){
|
|
274
|
-
this.$emit('apply',
|
|
275
|
-
|
|
91
|
+
this.$emit('apply', {
|
|
92
|
+
title: this.instance.title,
|
|
93
|
+
...(this.templates[this.instance.templateIndex].layout)
|
|
94
|
+
})
|
|
276
95
|
}
|
|
277
96
|
|
|
278
97
|
},
|
|
@@ -284,7 +103,7 @@ export default{
|
|
|
284
103
|
},
|
|
285
104
|
|
|
286
105
|
computedWidth(){
|
|
287
|
-
return
|
|
106
|
+
return 520;
|
|
288
107
|
}
|
|
289
108
|
|
|
290
109
|
},
|