@mixd-id/web-scaffold 0.1.230406172 → 0.1.230406174
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 +2 -1
- package/src/components/Flex.vue +4 -3
- package/src/components/Grid.vue +1 -0
- package/src/components/Image.vue +0 -1
- package/src/components/ListView.vue +2 -0
- package/src/index.js +6 -0
- package/src/middleware/http/trim-string.js +20 -0
- package/src/utils/helpers.js +9 -0
- package/src/utils/helpers.mjs +9 -0
- package/src/widgets/ComponentSetting.vue +34 -5
- package/src/widgets/WebPageBuilder.vue +19 -12
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.
|
|
4
|
+
"version": "0.1.230406174",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite serve",
|
|
7
7
|
"build": "vite build",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"./components/Textbox.vue": "./src/components/Textbox.vue",
|
|
16
16
|
"./mixin/component": "./src/mixin/component.js",
|
|
17
17
|
"./mixin/edit-mode": "./src/mixin/edit-mode.js",
|
|
18
|
+
"./middleware/http/trim-string": "./src/middleware/http/trim-string.js",
|
|
18
19
|
"./helpers": {
|
|
19
20
|
"require": "./src/utils/helpers.js",
|
|
20
21
|
"import": "./src/utils/helpers.mjs"
|
package/src/components/Flex.vue
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="$style.
|
|
2
|
+
<div :class="$style.Flex">
|
|
3
3
|
|
|
4
4
|
<component v-for="(item, idx) in items"
|
|
5
5
|
:is="item.type"
|
|
6
|
+
:key="item.key"
|
|
6
7
|
:="item" />
|
|
7
8
|
|
|
8
9
|
</div>
|
|
@@ -32,13 +33,13 @@ export default{
|
|
|
32
33
|
|
|
33
34
|
<style module>
|
|
34
35
|
|
|
35
|
-
.
|
|
36
|
+
.Flex{
|
|
36
37
|
@apply flex;
|
|
37
38
|
background-image: v-bind(bgImages[0]);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
@media screen(md){
|
|
41
|
-
.
|
|
42
|
+
.Flex{
|
|
42
43
|
background-image: v-bind(bgImages[1]);
|
|
43
44
|
}
|
|
44
45
|
}
|
package/src/components/Grid.vue
CHANGED
package/src/components/Image.vue
CHANGED
|
@@ -374,6 +374,8 @@ export default{
|
|
|
374
374
|
this.configLoaded = true
|
|
375
375
|
if('reset' in ((this.$route ?? {}).query ?? {}))
|
|
376
376
|
await this.saveConfig()
|
|
377
|
+
|
|
378
|
+
this.$router.replace({ query: { ...this.$route.query, reset: undefined } })
|
|
377
379
|
}
|
|
378
380
|
else{
|
|
379
381
|
switch(this.configStoreObj.type){
|
package/src/index.js
CHANGED
|
@@ -146,6 +146,9 @@ const unregisterResizeEvent = (fn) => {
|
|
|
146
146
|
const consoleInfo = (text) => { console.info(text) }
|
|
147
147
|
const consoleLog = (text) => { console.log(text) }
|
|
148
148
|
const consoleWarn = (text) => { console.warn(text) }
|
|
149
|
+
const consoleTime = (text) => { console.time(text) }
|
|
150
|
+
const consoleTimeLog = (text) => { console.timeLog(text) }
|
|
151
|
+
const consoleTimeEnd = (text) => { console.timeEnd(text) }
|
|
149
152
|
|
|
150
153
|
const util = {
|
|
151
154
|
|
|
@@ -333,6 +336,9 @@ export default{
|
|
|
333
336
|
app.config.globalProperties.log = consoleLog
|
|
334
337
|
app.config.globalProperties.warn = consoleWarn
|
|
335
338
|
app.config.globalProperties.info = consoleInfo
|
|
339
|
+
app.config.globalProperties.time = consoleTime
|
|
340
|
+
app.config.globalProperties.timeLog = consoleTimeLog
|
|
341
|
+
app.config.globalProperties.timeEnd = consoleTimeEnd
|
|
336
342
|
|
|
337
343
|
app.config.globalProperties.$isDev = () => import.meta.env.DEV
|
|
338
344
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function trimStrings(obj) {
|
|
2
|
+
for (const key in obj) {
|
|
3
|
+
if (typeof obj[key] === 'string') {
|
|
4
|
+
obj[key] = obj[key].trim();
|
|
5
|
+
} else if (typeof obj[key] === 'object') {
|
|
6
|
+
trimStrings(obj[key]);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module.exports = async function(req, res, next){
|
|
12
|
+
|
|
13
|
+
if(req.query)
|
|
14
|
+
trimStrings(req.query)
|
|
15
|
+
|
|
16
|
+
if(req.body)
|
|
17
|
+
trimStrings(req.body)
|
|
18
|
+
|
|
19
|
+
next()
|
|
20
|
+
}
|
package/src/utils/helpers.js
CHANGED
|
@@ -384,6 +384,14 @@ const deepObjectContainsObject = (outerObject, innerObject) => {
|
|
|
384
384
|
return true; // All properties and values in innerObject exist in outerObject
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
+
const removeStyleFromTag = (html) => {
|
|
388
|
+
const regex = /<[^>]+style="[^"]*"[^>]*>/g;
|
|
389
|
+
|
|
390
|
+
return html.replace(regex, (match) => {
|
|
391
|
+
return match.replace(/style="[^"]*"/, '');
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
|
|
387
395
|
|
|
388
396
|
module.exports = {
|
|
389
397
|
ceil,
|
|
@@ -408,4 +416,5 @@ module.exports = {
|
|
|
408
416
|
hexToRgb,
|
|
409
417
|
createComponentInstance,
|
|
410
418
|
deepObjectContainsObject,
|
|
419
|
+
removeStyleFromTag,
|
|
411
420
|
}
|
package/src/utils/helpers.mjs
CHANGED
|
@@ -275,6 +275,14 @@ const unPascalCase = function(str){
|
|
|
275
275
|
|
|
276
276
|
const sleep = ms => new Promise(r => setTimeout(r, ms))
|
|
277
277
|
|
|
278
|
+
const removeStyleFromTag = (html) => {
|
|
279
|
+
const regex = /<[^>]+style="[^"]*"[^>]*>/g;
|
|
280
|
+
|
|
281
|
+
return html.replace(regex, (match) => {
|
|
282
|
+
return match.replace(/style="[^"]*"/, '');
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
|
|
278
286
|
export {
|
|
279
287
|
downsizeImage,
|
|
280
288
|
uid,
|
|
@@ -291,6 +299,7 @@ export {
|
|
|
291
299
|
getComponentUids,
|
|
292
300
|
unPascalCase,
|
|
293
301
|
sleep,
|
|
302
|
+
removeStyleFromTag,
|
|
294
303
|
}
|
|
295
304
|
|
|
296
305
|
function observeInit(){
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<label :class="$style.label">Aspect Ratio</label>
|
|
11
11
|
<div v-for="(_, idx) in viewTypes"
|
|
12
12
|
v-show="_.value === viewType">
|
|
13
|
-
<Dropdown v-model="
|
|
13
|
+
<Dropdown v-model="aspectRatio[idx]" @change="apply">
|
|
14
14
|
<option value="">Not Set</option>
|
|
15
15
|
<option :value="`${viewType}aspect-square`">Square</option>
|
|
16
16
|
<option :value="`${viewType}aspect-[2/1]`">2/1</option>
|
|
@@ -562,6 +562,35 @@
|
|
|
562
562
|
</div>
|
|
563
563
|
</div>
|
|
564
564
|
|
|
565
|
+
<div>
|
|
566
|
+
<strong class="text-text-400">Flex Column</strong>
|
|
567
|
+
<div class="h-[1px] bg-text-100 mt-2 mb-4"></div>
|
|
568
|
+
<div class="grid grid-cols-2 gap-4">
|
|
569
|
+
<div>
|
|
570
|
+
<label class="flex-1 text-text-400">Basis</label>
|
|
571
|
+
<Dropdown v-for="(_viewType, index) in viewTypes"
|
|
572
|
+
v-show="_viewType.value === viewType"
|
|
573
|
+
v-model="colSpan[index]"
|
|
574
|
+
@change="apply">
|
|
575
|
+
<option value="">Not Set</option>
|
|
576
|
+
<option :value="`${viewType}basis-1/12`">1/12</option>
|
|
577
|
+
<option :value="`${viewType}basis-2/12`">2/12</option>
|
|
578
|
+
<option :value="`${viewType}basis-3/12`">3/12</option>
|
|
579
|
+
<option :value="`${viewType}basis-4/12`">4/12</option>
|
|
580
|
+
<option :value="`${viewType}basis-5/12`">5/12</option>
|
|
581
|
+
<option :value="`${viewType}basis-6/12`">6/12</option>
|
|
582
|
+
<option :value="`${viewType}basis-7/12`">7/12</option>
|
|
583
|
+
<option :value="`${viewType}basis-8/12`">8/12</option>
|
|
584
|
+
<option :value="`${viewType}basis-9/12`">9/12</option>
|
|
585
|
+
<option :value="`${viewType}basis-10/12`">10/12</option>
|
|
586
|
+
<option :value="`${viewType}basis-11/12`">11/12</option>
|
|
587
|
+
<option :value="`${viewType}basis-full`">Full</option>
|
|
588
|
+
</Dropdown>
|
|
589
|
+
</div>
|
|
590
|
+
|
|
591
|
+
</div>
|
|
592
|
+
</div>
|
|
593
|
+
|
|
565
594
|
<div class="flex flex-col gap-4">
|
|
566
595
|
|
|
567
596
|
<div>
|
|
@@ -1021,10 +1050,10 @@ export default{
|
|
|
1021
1050
|
return this.item.props.height
|
|
1022
1051
|
},
|
|
1023
1052
|
|
|
1024
|
-
|
|
1025
|
-
if(!Array.isArray(this.item.props.
|
|
1026
|
-
this.item.props.
|
|
1027
|
-
return this.item.props.
|
|
1053
|
+
aspectRatio(){
|
|
1054
|
+
if(!Array.isArray(this.item.props.aspectRatio))
|
|
1055
|
+
this.item.props.aspectRatio = []
|
|
1056
|
+
return this.item.props.aspectRatio
|
|
1028
1057
|
},
|
|
1029
1058
|
|
|
1030
1059
|
left(){
|
|
@@ -501,7 +501,7 @@
|
|
|
501
501
|
import throttle from "lodash/throttle";
|
|
502
502
|
import md5 from "md5";
|
|
503
503
|
import groupBy from "lodash/groupBy";
|
|
504
|
-
import {copyToClipboard, getClipboardData} from "../utils/helpers.mjs";
|
|
504
|
+
import {copyToClipboard, getClipboardData, removeStyleFromTag} from "../utils/helpers.mjs";
|
|
505
505
|
|
|
506
506
|
export default{
|
|
507
507
|
|
|
@@ -605,7 +605,12 @@ export default{
|
|
|
605
605
|
|
|
606
606
|
for(let key in component.props){
|
|
607
607
|
if(!this.compClasses.includes(key) && ![ 'enabled' ].includes(key)){
|
|
608
|
-
|
|
608
|
+
|
|
609
|
+
let value = component.props[key]
|
|
610
|
+
if(key === 'htmlText'){
|
|
611
|
+
value = removeStyleFromTag(value)
|
|
612
|
+
}
|
|
613
|
+
instance[key] = value
|
|
609
614
|
}
|
|
610
615
|
}
|
|
611
616
|
|
|
@@ -890,22 +895,24 @@ export default{
|
|
|
890
895
|
|
|
891
896
|
this.socketEmit2('page.save', this.page)
|
|
892
897
|
.then((page) => {
|
|
893
|
-
if(
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
898
|
+
if(reload){
|
|
899
|
+
if(page){
|
|
900
|
+
this.$refs.iframe.contentWindow.postMessage({
|
|
901
|
+
action: 'load',
|
|
902
|
+
page
|
|
903
|
+
}, '*')
|
|
904
|
+
}
|
|
905
|
+
else{
|
|
906
|
+
this.iframeSrc = (this.host ?? import.meta.env.VITE_WEB_HOST) + '/' + (this.page.path ?? '')
|
|
907
|
+
this.reloadIframe()
|
|
908
|
+
}
|
|
902
909
|
}
|
|
903
910
|
})
|
|
904
911
|
.catch((err) => {
|
|
905
912
|
this.toast(err)
|
|
906
913
|
this.load()
|
|
907
914
|
})
|
|
908
|
-
},
|
|
915
|
+
}, 1000),
|
|
909
916
|
|
|
910
917
|
saveLayout: throttle(function(reload = true){
|
|
911
918
|
if(!this.layout.instances || typeof this.layout.instances !== 'object' || Array.isArray(this.layout.instances))
|