@mixd-id/web-scaffold 0.1.230406200 → 0.1.230406201
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/DataList.vue +39 -6
- package/src/components/Link.vue +5 -2
- package/src/components/Modal.vue +41 -43
- package/src/components/TextBlock.vue +2 -2
- package/src/mixin/component.js +0 -1
- package/src/widgets/ComponentSetting.vue +31 -0
- package/src/widgets/WebPageBuilder.vue +1 -1
- package/tailwind.config.js +6 -0
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="$style.comp">
|
|
3
3
|
|
|
4
|
-
<component v-for="(item, idx) in
|
|
4
|
+
<component v-for="(item, idx) in computedItems"
|
|
5
5
|
:is="item.type"
|
|
6
6
|
:key="item.key"
|
|
7
7
|
:="item" />
|
|
8
|
+
|
|
9
|
+
<div v-show="hasNext">
|
|
10
|
+
<button type="button" @click="loadNext" class="p-3 w-full text-primary">Load More</button>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
8
13
|
</div>
|
|
9
14
|
</template>
|
|
10
15
|
|
|
@@ -14,36 +19,64 @@ import {componentMixin} from "../mixin/component";
|
|
|
14
19
|
|
|
15
20
|
export default{
|
|
16
21
|
|
|
22
|
+
inject: [ 'pageLoad' ],
|
|
23
|
+
|
|
17
24
|
mixins: [ componentMixin ],
|
|
18
25
|
|
|
19
26
|
props: {
|
|
20
27
|
|
|
28
|
+
data: Object,
|
|
21
29
|
datasource: Object,
|
|
22
30
|
|
|
23
31
|
items: Array,
|
|
24
|
-
|
|
25
32
|
},
|
|
26
33
|
|
|
27
34
|
computed: {
|
|
28
35
|
|
|
36
|
+
computedData(){
|
|
37
|
+
return (this.pageData ?? {})[(this.datasource ?? {}).key] ?? {}
|
|
38
|
+
},
|
|
39
|
+
|
|
29
40
|
dataItems(){
|
|
41
|
+
const dataItems = this.computedData.items ?? []
|
|
42
|
+
if(this.editMode === 1 && this.dataItems.length < 1) dataItems.push({})
|
|
43
|
+
return dataItems
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
computedItems(){
|
|
30
47
|
if(this.items.length < 1) return []
|
|
31
48
|
|
|
32
49
|
const items = []
|
|
33
|
-
|
|
34
|
-
const dataItems = ((this.pageData ?? {})[(this.datasource ?? {}).key] ?? {}).items ?? []
|
|
35
|
-
|
|
36
50
|
const itemJSON = JSON.stringify(this.items[0])
|
|
37
51
|
|
|
38
|
-
for(let data of dataItems){
|
|
52
|
+
for(let data of this.dataItems){
|
|
39
53
|
const item = JSON.parse(itemJSON)
|
|
40
54
|
item.data = data
|
|
41
55
|
items.push(item)
|
|
56
|
+
|
|
57
|
+
if(this.editMode === 1) break
|
|
42
58
|
}
|
|
43
59
|
|
|
44
60
|
return items
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
hasNext(){
|
|
64
|
+
return true
|
|
45
65
|
}
|
|
46
66
|
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
methods: {
|
|
70
|
+
|
|
71
|
+
loadNext(){
|
|
72
|
+
if(!this.pageLoad) return
|
|
73
|
+
|
|
74
|
+
this.pageLoad({
|
|
75
|
+
...this.datasource,
|
|
76
|
+
page: (this.computedData.page ?? 0) + 1
|
|
77
|
+
})
|
|
78
|
+
},
|
|
79
|
+
|
|
47
80
|
}
|
|
48
81
|
|
|
49
82
|
}
|
package/src/components/Link.vue
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
<script>
|
|
32
32
|
|
|
33
33
|
import { componentMixin } from "../mixin/component";
|
|
34
|
+
import { applyDatasourceReplacer } from "../utils/helpers";
|
|
34
35
|
|
|
35
36
|
export default{
|
|
36
37
|
|
|
@@ -63,10 +64,12 @@ export default{
|
|
|
63
64
|
const obj = {}
|
|
64
65
|
|
|
65
66
|
if(this.route.hash)
|
|
66
|
-
obj.hash = '#' + this.route.hash
|
|
67
|
+
obj.hash = '#' + (this.editMode === 1 ? this.route.hash :
|
|
68
|
+
applyDatasourceReplacer(this.route.hash, this.data))
|
|
67
69
|
|
|
68
70
|
if(this.route.path)
|
|
69
|
-
obj.path = this.route.path
|
|
71
|
+
obj.path = this.editMode === 1 ? this.route.path :
|
|
72
|
+
applyDatasourceReplacer(this.route.path, this.data)
|
|
70
73
|
|
|
71
74
|
return obj
|
|
72
75
|
}
|
package/src/components/Modal.vue
CHANGED
|
@@ -1,48 +1,46 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<div v-if="isDisabled" :class="$style.overlay"></div>
|
|
41
|
-
</div>
|
|
2
|
+
<Teleport to=".bW9k">
|
|
3
|
+
<Transition :name="computedTransition"
|
|
4
|
+
appear
|
|
5
|
+
@after-leave="onAfterLeave(); $emit('hide')"
|
|
6
|
+
@after-enter="$emit('show')">
|
|
7
|
+
<div v-if="currentState"
|
|
8
|
+
ref="modal"
|
|
9
|
+
:class="computedClass"
|
|
10
|
+
:style="computedStyle"
|
|
11
|
+
:data-state="computedState ? 1 : 0">
|
|
12
|
+
<component v-if="Array.isArray(items) && items.length > 0"
|
|
13
|
+
v-for="(item, idx) in items"
|
|
14
|
+
:is="item.type"
|
|
15
|
+
:key="item.key"
|
|
16
|
+
:="item" />
|
|
17
|
+
<form v-else-if="useForm" @submit.prevent="$emit('submit')">
|
|
18
|
+
<div class="modal-head">
|
|
19
|
+
<slot name="head" :context="context"></slot>
|
|
20
|
+
</div>
|
|
21
|
+
<div :class="$style.modalBody">
|
|
22
|
+
<slot :context="context"></slot>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="modal-foot">
|
|
25
|
+
<slot name="foot" :context="context"></slot>
|
|
26
|
+
</div>
|
|
27
|
+
<div v-if="isDisabled" :class="$style.overlay"></div>
|
|
28
|
+
</form>
|
|
29
|
+
<div v-else class="flex-1 min-h-0 flex flex-col relative">
|
|
30
|
+
<div class="modal-head">
|
|
31
|
+
<slot name="head" :context="context"></slot>
|
|
32
|
+
</div>
|
|
33
|
+
<div :class="$style.modalBody">
|
|
34
|
+
<slot :context="context"></slot>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="modal-foot">
|
|
37
|
+
<slot name="foot" :context="context"></slot>
|
|
38
|
+
</div>
|
|
39
|
+
<div v-if="isDisabled" :class="$style.overlay"></div>
|
|
42
40
|
</div>
|
|
43
|
-
</
|
|
44
|
-
</
|
|
45
|
-
</
|
|
41
|
+
</div>
|
|
42
|
+
</Transition>
|
|
43
|
+
</Teleport>
|
|
46
44
|
</template>
|
|
47
45
|
|
|
48
46
|
<script>
|
|
@@ -21,7 +21,7 @@ export default{
|
|
|
21
21
|
|
|
22
22
|
tagName: {
|
|
23
23
|
type: String,
|
|
24
|
-
default: '
|
|
24
|
+
default: 'div'
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
},
|
|
@@ -29,7 +29,7 @@ export default{
|
|
|
29
29
|
computed: {
|
|
30
30
|
|
|
31
31
|
computedText(){
|
|
32
|
-
if(this.parentData){
|
|
32
|
+
if(this.parentData && this.editMode !== 1){
|
|
33
33
|
return applyDatasourceReplacer(this.text, this.parentData)
|
|
34
34
|
}
|
|
35
35
|
return this.text
|
package/src/mixin/component.js
CHANGED
|
@@ -371,6 +371,22 @@
|
|
|
371
371
|
</div>
|
|
372
372
|
</div>
|
|
373
373
|
|
|
374
|
+
<div>
|
|
375
|
+
<label class="text-text-400">Line Clamp</label>
|
|
376
|
+
<div v-for="(_, index) in viewTypes"
|
|
377
|
+
v-show="_.value === viewType">
|
|
378
|
+
<Dropdown v-model="lineClamp[index]">
|
|
379
|
+
<option value="">
|
|
380
|
+
{{ emptyComponentText('lineClamp', index) }}
|
|
381
|
+
</option>
|
|
382
|
+
<option v-for="opt in components.lineClamp"
|
|
383
|
+
:value="`${viewType}${opt[1]}`">
|
|
384
|
+
{{ opt[0] }}
|
|
385
|
+
</option>
|
|
386
|
+
</Dropdown>
|
|
387
|
+
</div>
|
|
388
|
+
</div>
|
|
389
|
+
|
|
374
390
|
<div>
|
|
375
391
|
<label class="text-text-400">Letter Spacing</label>
|
|
376
392
|
<div v-for="(_, index) in viewTypes"
|
|
@@ -1428,6 +1444,12 @@ export default{
|
|
|
1428
1444
|
|
|
1429
1445
|
return this.item.props.letterSpacing
|
|
1430
1446
|
},
|
|
1447
|
+
lineClamp(){
|
|
1448
|
+
if(!Array.isArray(this.item.props.lineClamp))
|
|
1449
|
+
this.item.props.lineClamp = []
|
|
1450
|
+
|
|
1451
|
+
return this.item.props.lineClamp
|
|
1452
|
+
},
|
|
1431
1453
|
lineHeight(){
|
|
1432
1454
|
if(!Array.isArray(this.item.props.lineHeight))
|
|
1433
1455
|
this.item.props.lineHeight = []
|
|
@@ -1872,6 +1894,15 @@ export default{
|
|
|
1872
1894
|
[ 'Wider', 'tracking-wider' ],
|
|
1873
1895
|
[ 'Widest', 'tracking-widest' ],
|
|
1874
1896
|
],
|
|
1897
|
+
lineClamp: [
|
|
1898
|
+
[ '1', 'line-clamp-1' ],
|
|
1899
|
+
[ '2', 'line-clamp-2' ],
|
|
1900
|
+
[ '3', 'line-clamp-3' ],
|
|
1901
|
+
[ '4', 'line-clamp-4' ],
|
|
1902
|
+
[ '5', 'line-clamp-5' ],
|
|
1903
|
+
[ '6', 'line-clamp-6' ],
|
|
1904
|
+
[ 'None', 'line-clamp-none' ],
|
|
1905
|
+
],
|
|
1875
1906
|
lineHeight: [
|
|
1876
1907
|
[ 'None', 'leading-none' ],
|
|
1877
1908
|
[ 'Tight', 'leading-tight' ],
|
package/tailwind.config.js
CHANGED
|
@@ -229,6 +229,9 @@ module.exports = {
|
|
|
229
229
|
'underline', 'overline', 'line-through', 'no-underline',
|
|
230
230
|
'truncate', 'text-ellipsis', 'text-clip',
|
|
231
231
|
|
|
232
|
+
'line-clamp-1', 'line-clamp-2', 'line-clamp-3', 'line-clamp-4', 'line-clamp-5',
|
|
233
|
+
'line-clamp-6', 'line-clamp-none',
|
|
234
|
+
|
|
232
235
|
// // //
|
|
233
236
|
|
|
234
237
|
'md:flex-wrap', 'md:flex-wrap-reverse', 'md:flex-nowrap',
|
|
@@ -447,6 +450,9 @@ module.exports = {
|
|
|
447
450
|
'md:underline', 'md:overline', 'md:line-through', 'md:no-underline',
|
|
448
451
|
'md:truncate', 'md:text-ellipsis', 'md:text-clip',
|
|
449
452
|
|
|
453
|
+
'md:line-clamp-1', 'md:line-clamp-2', 'md:line-clamp-3', 'md:line-clamp-4', 'md:line-clamp-5',
|
|
454
|
+
'md:line-clamp-6', 'md:line-clamp-none',
|
|
455
|
+
|
|
450
456
|
],
|
|
451
457
|
theme: {
|
|
452
458
|
extend: {
|