@mixd-id/web-scaffold 0.1.240411029 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.240411029",
4
+ "version": "0.1.240411030",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -985,8 +985,15 @@ export default{
985
985
  },
986
986
 
987
987
  preset(){
988
- return this.configPresets.find(_ => _.uid === this.configParams.presetIdx) ??
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(){
@@ -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
- let value = cell.formulaType === 1 ? cell.result : cell.value
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" :width="computedWidth" height="600">
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
- <div v-for="template in templates"
28
- :class="$style.templateItem + (instance === template ? ' ' + $style.active : '')"
29
- @click="applyTemplate(template)">
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 justify-end">
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', this.instance)
275
- this.close()
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 800;
106
+ return 520;
288
107
  }
289
108
 
290
109
  },
@@ -740,7 +740,9 @@ export default{
740
740
  .then(layout => {
741
741
  this.loadLayouts()
742
742
  this.page.layoutId = layout.id
743
+ this.$refs.webLayoutSelector.close()
743
744
  })
745
+ .catch(err => this.alert(err))
744
746
  },
745
747
 
746
748
  createStyleSheet(styles){