@mpxjs/webpack-plugin 2.10.18-beta.1 → 2.10.19
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/LICENSE +433 -0
- package/lib/index.js +0 -12
- package/lib/runtime/components/react/dist/mpx-camera.d.ts +4 -4
- package/lib/runtime/components/react/dist/mpx-camera.jsx +75 -41
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +92 -15
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +24 -43
- package/lib/runtime/components/react/mpx-camera.tsx +78 -47
- package/lib/runtime/components/react/mpx-scroll-view.tsx +106 -16
- package/lib/runtime/components/react/mpx-swiper.tsx +23 -43
- package/lib/runtime/components/web/mpx-scroll-view.vue +2 -5
- package/lib/template-compiler/compiler.js +3 -7
- package/lib/utils/const.js +0 -29
- package/package.json +4 -3
- package/lib/resolver/ExtendComponentsPlugin.js +0 -60
- package/lib/runtime/components/ali/mpx-section-list.mpx +0 -566
- package/lib/runtime/components/ali/mpx-sticky-header.mpx +0 -212
- package/lib/runtime/components/ali/mpx-sticky-section.mpx +0 -17
- package/lib/runtime/components/react/dist/mpx-section-list.d.ts +0 -48
- package/lib/runtime/components/react/dist/mpx-section-list.jsx +0 -292
- package/lib/runtime/components/react/mpx-section-list.tsx +0 -439
- package/lib/runtime/components/web/mpx-section-list.vue +0 -551
- package/lib/runtime/components/wx/mpx-section-list-default/list-footer.mpx +0 -26
- package/lib/runtime/components/wx/mpx-section-list-default/list-header.mpx +0 -26
- package/lib/runtime/components/wx/mpx-section-list-default/list-item.mpx +0 -26
- package/lib/runtime/components/wx/mpx-section-list-default/section-header.mpx +0 -26
- package/lib/runtime/components/wx/mpx-section-list.mpx +0 -209
- package/lib/runtime/components/wx/mpx-sticky-header.mpx +0 -40
- package/lib/runtime/components/wx/mpx-sticky-section.mpx +0 -31
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<scroll-view wx:ref="recycleViewRef" class="mpx-section-list" scroll-y wx:style="{{ scrollViewStyle }}" type="custom"
|
|
3
|
-
enhanced="{{ enhanced }}" scroll-with-animation="{{ scrollWithAnimation }}" bounces="{{ bounces }}"
|
|
4
|
-
show-scrollbar="{{ showScrollbar }}" refresher-enabled="{{ refresherEnabled }}"
|
|
5
|
-
refresher-triggered="{{ refresherTriggered }}" bindscroll="onScroll" bindrefresherrefresh="onRefresh" scroll-into-view-offset="{{ scrollIntoViewOffset }}"
|
|
6
|
-
scroll-into-view="{{ scrollIntoViewId }}" scroll-into-view-alignment="{{ viewPosition }}">
|
|
7
|
-
<block wx:if="{{ useListHeader }}">
|
|
8
|
-
<list-header listHeaderData="{{ listHeaderData }}"></list-header>
|
|
9
|
-
</block>
|
|
10
|
-
<block wx:for="{{ convertedListData }}" wx:key="index">
|
|
11
|
-
<sticky-section>
|
|
12
|
-
<!-- section header -->
|
|
13
|
-
<block wx:if="{{ item.hasSectionHeader }}">
|
|
14
|
-
<block wx:if="{{ enableSticky }}">
|
|
15
|
-
<sticky-header>
|
|
16
|
-
<section-header itemData="{{ item.headerData }}" id="{{ item._domId }}"></section-header>
|
|
17
|
-
</sticky-header>
|
|
18
|
-
</block>
|
|
19
|
-
<block wx:else>
|
|
20
|
-
<section-header itemData="{{ item.headerData }}" id="{{ item._domId }}"></section-header>
|
|
21
|
-
</block>
|
|
22
|
-
|
|
23
|
-
</block>
|
|
24
|
-
<block wx:for="{{ item.data }}" wx:for-item="subItem" wx:key="subIndex">
|
|
25
|
-
<!-- section items -->
|
|
26
|
-
<recycle-item itemData="{{ subItem.itemData }}" id="{{ subItem._domId }}"></recycle-item>
|
|
27
|
-
</block>
|
|
28
|
-
</sticky-section>
|
|
29
|
-
</block>
|
|
30
|
-
<block wx:if="{{ useListFooter }}">
|
|
31
|
-
<list-footer listFooterData="{{ listFooterData }}"></list-footer>
|
|
32
|
-
</block>
|
|
33
|
-
</scroll-view>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<script>
|
|
37
|
-
import { createComponent } from '@mpxjs/core'
|
|
38
|
-
|
|
39
|
-
createComponent({
|
|
40
|
-
properties: {
|
|
41
|
-
height: {
|
|
42
|
-
type: Number,
|
|
43
|
-
value: null
|
|
44
|
-
},
|
|
45
|
-
width: {
|
|
46
|
-
type: Number,
|
|
47
|
-
value: null
|
|
48
|
-
},
|
|
49
|
-
listData: {
|
|
50
|
-
type: Array,
|
|
51
|
-
value: []
|
|
52
|
-
},
|
|
53
|
-
enableSticky: {
|
|
54
|
-
type: Boolean,
|
|
55
|
-
value: false
|
|
56
|
-
},
|
|
57
|
-
showScrollbar: {
|
|
58
|
-
type: Boolean,
|
|
59
|
-
value: false
|
|
60
|
-
},
|
|
61
|
-
enhanced: {
|
|
62
|
-
type: Boolean,
|
|
63
|
-
value: false
|
|
64
|
-
},
|
|
65
|
-
bounces: {
|
|
66
|
-
type: Boolean,
|
|
67
|
-
value: false
|
|
68
|
-
},
|
|
69
|
-
refresherEnabled: {
|
|
70
|
-
type: Boolean,
|
|
71
|
-
value: false
|
|
72
|
-
},
|
|
73
|
-
refresherTriggered: {
|
|
74
|
-
type: Boolean,
|
|
75
|
-
value: false
|
|
76
|
-
},
|
|
77
|
-
listHeaderData: {
|
|
78
|
-
type: Object,
|
|
79
|
-
value: null
|
|
80
|
-
},
|
|
81
|
-
scrollWithAnimation: {
|
|
82
|
-
type: Boolean,
|
|
83
|
-
value: false
|
|
84
|
-
},
|
|
85
|
-
useListHeader: {
|
|
86
|
-
type: Boolean,
|
|
87
|
-
value: false
|
|
88
|
-
},
|
|
89
|
-
listFooterData: {
|
|
90
|
-
type: Object,
|
|
91
|
-
value: null
|
|
92
|
-
},
|
|
93
|
-
useListFooter: {
|
|
94
|
-
type: Boolean,
|
|
95
|
-
value: false
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
data: {
|
|
99
|
-
convertedListData: [],
|
|
100
|
-
scrollIntoViewId: '',
|
|
101
|
-
scrollIntoViewOffset: 0,
|
|
102
|
-
viewPosition: 'start'
|
|
103
|
-
},
|
|
104
|
-
computed: {
|
|
105
|
-
scrollViewStyle() {
|
|
106
|
-
return `height: ${this.formatDimension(this.height)};width: ${this.formatDimension(this.width)}`
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
watch: {
|
|
110
|
-
listData: {
|
|
111
|
-
handler(newVal) {
|
|
112
|
-
this.convertedListData = this.convertToSectionListData(newVal)
|
|
113
|
-
},
|
|
114
|
-
immediate: true
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
methods: {
|
|
118
|
-
formatDimension(value) {
|
|
119
|
-
return typeof value === 'number' ? `${value}px` : value || '100%'
|
|
120
|
-
},
|
|
121
|
-
onScroll(e) {
|
|
122
|
-
this.triggerEvent('scroll', e)
|
|
123
|
-
},
|
|
124
|
-
onRefresh(e) {
|
|
125
|
-
this.triggerEvent('refresh', e)
|
|
126
|
-
},
|
|
127
|
-
scrollToIndex({ index, viewPosition = 0, viewOffset = 0 }) {
|
|
128
|
-
if (index >= 0) {
|
|
129
|
-
this.scrollIntoViewId = `mpx-recycle-item-${index}`
|
|
130
|
-
switch (viewPosition) {
|
|
131
|
-
case 0:
|
|
132
|
-
this.viewPosition = 'start'
|
|
133
|
-
break
|
|
134
|
-
case 0.5:
|
|
135
|
-
this.viewPosition = 'center'
|
|
136
|
-
break
|
|
137
|
-
case 1:
|
|
138
|
-
this.viewPosition = 'end'
|
|
139
|
-
break
|
|
140
|
-
default:
|
|
141
|
-
this.viewPosition = 'start'
|
|
142
|
-
}
|
|
143
|
-
this.scrollIntoViewOffset = -viewOffset || 0
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
convertToSectionListData(data) {
|
|
147
|
-
const sections = []
|
|
148
|
-
let currentSection = null
|
|
149
|
-
|
|
150
|
-
data && data.forEach((item, index) => {
|
|
151
|
-
if (item.isSectionHeader) {
|
|
152
|
-
// 如果已经存在一个 section,先把它添加到 sections 中
|
|
153
|
-
if (currentSection) {
|
|
154
|
-
sections.push(currentSection)
|
|
155
|
-
}
|
|
156
|
-
// 创建新的 section
|
|
157
|
-
currentSection = {
|
|
158
|
-
headerData: item,
|
|
159
|
-
data: [],
|
|
160
|
-
hasSectionHeader: true,
|
|
161
|
-
_domId: `mpx-recycle-item-${index}`
|
|
162
|
-
}
|
|
163
|
-
} else {
|
|
164
|
-
// 如果没有当前 section,创建一个默认的
|
|
165
|
-
if (!currentSection) {
|
|
166
|
-
// 创建默认section (无header的section)
|
|
167
|
-
currentSection = {
|
|
168
|
-
headerData: null,
|
|
169
|
-
data: [],
|
|
170
|
-
hasSectionHeader: false
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
currentSection.data.push({
|
|
174
|
-
itemData: item,
|
|
175
|
-
_domId: `mpx-recycle-item-${index}`
|
|
176
|
-
})
|
|
177
|
-
}
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
// 添加最后一个 section
|
|
181
|
-
if (currentSection) {
|
|
182
|
-
sections.push(currentSection)
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return sections
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
})
|
|
189
|
-
</script>
|
|
190
|
-
|
|
191
|
-
<script type="application/json">
|
|
192
|
-
{
|
|
193
|
-
"component": true,
|
|
194
|
-
"componentGenerics": {
|
|
195
|
-
"recycle-item": {
|
|
196
|
-
"default": "./mpx-section-list-default/list-item.mpx"
|
|
197
|
-
},
|
|
198
|
-
"section-header": {
|
|
199
|
-
"default": "./mpx-section-list-default/section-header.mpx"
|
|
200
|
-
},
|
|
201
|
-
"list-header": {
|
|
202
|
-
"default": "./mpx-section-list-default/list-header.mpx"
|
|
203
|
-
},
|
|
204
|
-
"list-footer": {
|
|
205
|
-
"default": "./mpx-section-list-default/list-footer.mpx"
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
</script>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<sticky-header offset-top="{{offsetTop}}" padding="{{padding}}" allow-overlapping="{{allowOverlapping}}" bindstickontopchange="handleStickyChange">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</sticky-header>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
import { createComponent } from '@mpxjs/core'
|
|
9
|
-
|
|
10
|
-
createComponent({
|
|
11
|
-
options: {
|
|
12
|
-
virtualHost: true
|
|
13
|
-
},
|
|
14
|
-
properties: {
|
|
15
|
-
offsetTop: {
|
|
16
|
-
type: Number,
|
|
17
|
-
value: 0
|
|
18
|
-
},
|
|
19
|
-
padding: {
|
|
20
|
-
type: Array,
|
|
21
|
-
value: [0, 0, 0, 0]
|
|
22
|
-
},
|
|
23
|
-
allowOverlapping: {
|
|
24
|
-
type: Boolean,
|
|
25
|
-
value: false
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
methods: {
|
|
29
|
-
handleStickyChange(e) {
|
|
30
|
-
this.triggerEvent('stickontopchange', e.detail)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
<script type="application/json">
|
|
37
|
-
{
|
|
38
|
-
"component": true
|
|
39
|
-
}
|
|
40
|
-
</script>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<sticky-section padding="{{ padding }}" push-pinned-header="{{ pushPinnedHeader }}">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</sticky-section>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
import { createComponent } from '@mpxjs/core'
|
|
9
|
-
|
|
10
|
-
createComponent({
|
|
11
|
-
options: {
|
|
12
|
-
virtualHost: true
|
|
13
|
-
},
|
|
14
|
-
properties: {
|
|
15
|
-
padding: {
|
|
16
|
-
type: Array,
|
|
17
|
-
value: [0, 0, 0, 0]
|
|
18
|
-
},
|
|
19
|
-
pushPinnedHeader: {
|
|
20
|
-
type: Boolean,
|
|
21
|
-
value: true
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<script type="application/json">
|
|
28
|
-
{
|
|
29
|
-
"component": true
|
|
30
|
-
}
|
|
31
|
-
</script>
|