@cloudbase/weda-ui 0.2.7 → 0.2.8
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 -3
- package/src/configs/components/container.json +2 -1
- package/src/configs/components/form/richText.json +2 -1
- package/src/configs/components/form/uploader.json +4 -4
- package/src/configs/components/image.json +2 -1
- package/src/configs/components/link.json +2 -1
- package/src/configs/components/richtextview.json +2 -1
- package/src/configs/components/scrollVeiw.json +2 -1
- package/src/configs/components/swiper.json +2 -1
- package/src/configs/components/tabs.json +2 -1
- package/src/configs/components/text.json +2 -1
- package/src/configs/index.js +3 -5
- package/src/mp/components/form/uploader/index.js +15 -8
- package/src/mp/components/form/uploader/index.wxml +1 -1
- package/src/web/components/form/select/region/{cities.json → cities.js} +2 -2
- package/src/web/components/form/select/region/index.js +3 -3
- package/src/web/components/form/select/region/{provinces.json → provinces.js} +2 -2
- package/src/web/components/form/select/region/{regions.json → regions.js} +2 -2
- package/src/web/components/form/switch/index.jsx +1 -0
- package/src/web/components/form/uploader/uploader.h5.jsx +42 -16
- package/src/web/components/form/uploader/uploader.pc.jsx +1 -1
- package/src/web/components/image/image.jsx +0 -1
- package/src/web/components/index.js +0 -1
- package/src/configs/components/markdown.json +0 -17
- package/src/mp/components/markdown/index.js +0 -27
- package/src/mp/components/markdown/index.json +0 -6
- package/src/mp/components/markdown/index.wxml +0 -1
- package/src/mp/components/markdown/towxml/audio-player/Audio.js +0 -99
- package/src/mp/components/markdown/towxml/audio-player/audio-player.js +0 -102
- package/src/mp/components/markdown/towxml/audio-player/audio-player.json +0 -5
- package/src/mp/components/markdown/towxml/audio-player/audio-player.wxml +0 -14
- package/src/mp/components/markdown/towxml/audio-player/audio-player.wxss +0 -175
- package/src/mp/components/markdown/towxml/audio-player/loading.svg +0 -1
- package/src/mp/components/markdown/towxml/config.js +0 -285
- package/src/mp/components/markdown/towxml/decode.js +0 -26
- package/src/mp/components/markdown/towxml/decode.json +0 -12
- package/src/mp/components/markdown/towxml/decode.wxml +0 -1
- package/src/mp/components/markdown/towxml/decode.wxss +0 -0
- package/src/mp/components/markdown/towxml/img/img.js +0 -98
- package/src/mp/components/markdown/towxml/img/img.json +0 -3
- package/src/mp/components/markdown/towxml/img/img.wxml +0 -1
- package/src/mp/components/markdown/towxml/img/img.wxss +0 -0
- package/src/mp/components/markdown/towxml/index.js +0 -19
- package/src/mp/components/markdown/towxml/latex/latex.js +0 -53
- package/src/mp/components/markdown/towxml/latex/latex.json +0 -5
- package/src/mp/components/markdown/towxml/latex/latex.wxml +0 -1
- package/src/mp/components/markdown/towxml/latex/latex.wxss +0 -0
- package/src/mp/components/markdown/towxml/parse/highlight/highlight.js +0 -729
- package/src/mp/components/markdown/towxml/parse/highlight/index.js +0 -7
- package/src/mp/components/markdown/towxml/parse/highlight/languages/bash.js +0 -91
- package/src/mp/components/markdown/towxml/parse/highlight/languages/c-like.js +0 -244
- package/src/mp/components/markdown/towxml/parse/highlight/languages/c.js +0 -20
- package/src/mp/components/markdown/towxml/parse/highlight/languages/css.js +0 -138
- package/src/mp/components/markdown/towxml/parse/highlight/languages/dart.js +0 -135
- package/src/mp/components/markdown/towxml/parse/highlight/languages/go.js +0 -57
- package/src/mp/components/markdown/towxml/parse/highlight/languages/htmlbars.js +0 -79
- package/src/mp/components/markdown/towxml/parse/highlight/languages/java.js +0 -126
- package/src/mp/components/markdown/towxml/parse/highlight/languages/javascript.js +0 -263
- package/src/mp/components/markdown/towxml/parse/highlight/languages/json.js +0 -51
- package/src/mp/components/markdown/towxml/parse/highlight/languages/less.js +0 -177
- package/src/mp/components/markdown/towxml/parse/highlight/languages/nginx.js +0 -103
- package/src/mp/components/markdown/towxml/parse/highlight/languages/php.js +0 -152
- package/src/mp/components/markdown/towxml/parse/highlight/languages/python-repl.js +0 -27
- package/src/mp/components/markdown/towxml/parse/highlight/languages/python.js +0 -146
- package/src/mp/components/markdown/towxml/parse/highlight/languages/scss.js +0 -137
- package/src/mp/components/markdown/towxml/parse/highlight/languages/shell.js +0 -23
- package/src/mp/components/markdown/towxml/parse/highlight/languages/typescript.js +0 -198
- package/src/mp/components/markdown/towxml/parse/highlight/languages/xml.js +0 -143
- package/src/mp/components/markdown/towxml/parse/highlight/style/github.wxss +0 -99
- package/src/mp/components/markdown/towxml/parse/highlight/style/monokai.wxss +0 -70
- package/src/mp/components/markdown/towxml/parse/index.js +0 -106
- package/src/mp/components/markdown/towxml/parse/markdown/index.js +0 -53
- package/src/mp/components/markdown/towxml/parse/markdown/markdown.js +0 -5834
- package/src/mp/components/markdown/towxml/parse/markdown/plugins/emoji.js +0 -1773
- package/src/mp/components/markdown/towxml/parse/markdown/plugins/ins.js +0 -120
- package/src/mp/components/markdown/towxml/parse/markdown/plugins/latex.js +0 -193
- package/src/mp/components/markdown/towxml/parse/markdown/plugins/mark.js +0 -120
- package/src/mp/components/markdown/towxml/parse/markdown/plugins/sub.js +0 -95
- package/src/mp/components/markdown/towxml/parse/markdown/plugins/sup.js +0 -95
- package/src/mp/components/markdown/towxml/parse/markdown/plugins/todo.js +0 -220
- package/src/mp/components/markdown/towxml/parse/markdown/plugins/yuml.js +0 -18
- package/src/mp/components/markdown/towxml/parse/parse2/Parser.js +0 -263
- package/src/mp/components/markdown/towxml/parse/parse2/Tokenizer.js +0 -507
- package/src/mp/components/markdown/towxml/parse/parse2/domhandler/index.js +0 -104
- package/src/mp/components/markdown/towxml/parse/parse2/domhandler/node.js +0 -169
- package/src/mp/components/markdown/towxml/parse/parse2/entities/decode.js +0 -54
- package/src/mp/components/markdown/towxml/parse/parse2/entities/decode_codepoint.js +0 -19
- package/src/mp/components/markdown/towxml/parse/parse2/entities/encode.js +0 -54
- package/src/mp/components/markdown/towxml/parse/parse2/entities/index.js +0 -30
- package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/decode.js +0 -31
- package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/entities.js +0 -2128
- package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/legacy.js +0 -109
- package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/xml.js +0 -2
- package/src/mp/components/markdown/towxml/parse/parse2/index.js +0 -8
- package/src/mp/components/markdown/towxml/style/main.wxss +0 -378
- package/src/mp/components/markdown/towxml/style/theme/dark.wxss +0 -73
- package/src/mp/components/markdown/towxml/style/theme/light.wxss +0 -63
- package/src/mp/components/markdown/towxml/table/table.js +0 -11
- package/src/mp/components/markdown/towxml/table/table.json +0 -6
- package/src/mp/components/markdown/towxml/table/table.wxml +0 -24
- package/src/mp/components/markdown/towxml/table/table.wxss +0 -0
- package/src/mp/components/markdown/towxml/todogroup/todogroup.js +0 -19
- package/src/mp/components/markdown/towxml/todogroup/todogroup.json +0 -6
- package/src/mp/components/markdown/towxml/todogroup/todogroup.wxml +0 -13
- package/src/mp/components/markdown/towxml/todogroup/todogroup.wxss +0 -3
- package/src/mp/components/markdown/towxml/towxml.js +0 -17
- package/src/mp/components/markdown/towxml/towxml.json +0 -6
- package/src/mp/components/markdown/towxml/towxml.wxml +0 -5
- package/src/mp/components/markdown/towxml/towxml.wxss +0 -8
- package/src/mp/components/markdown/towxml/yuml/yuml.js +0 -51
- package/src/mp/components/markdown/towxml/yuml/yuml.json +0 -5
- package/src/mp/components/markdown/towxml/yuml/yuml.wxml +0 -5
- package/src/mp/components/markdown/towxml/yuml/yuml.wxss +0 -0
- package/src/web/components/markdown/index.jsx +0 -40
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/weda-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"module": "./src/index",
|
|
6
6
|
"miniprogram": "mpdist",
|
|
@@ -45,8 +45,6 @@
|
|
|
45
45
|
"object.fromentries": "^2.0.4",
|
|
46
46
|
"prop-types": "^15.7.2",
|
|
47
47
|
"react-easy-swipe": "^0.0.21",
|
|
48
|
-
"react-markdown": "^5.0.3",
|
|
49
|
-
"react-syntax-highlighter": "^15.4.3",
|
|
50
48
|
"react-use": "^15.3.4",
|
|
51
49
|
"tea-component": "^2.6.22",
|
|
52
50
|
"uuid": "8.3.2",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"default": ["image/*"],
|
|
9
9
|
"x-category": "基础属性",
|
|
10
10
|
"x-index": 6,
|
|
11
|
-
"x-platforms": ["
|
|
11
|
+
"x-platforms": ["WEB"],
|
|
12
12
|
"items": {
|
|
13
13
|
"type": "string",
|
|
14
14
|
"enum": [
|
|
@@ -66,8 +66,7 @@
|
|
|
66
66
|
"default": 10,
|
|
67
67
|
"title": "单张大小(M)",
|
|
68
68
|
"x-category": "基础属性",
|
|
69
|
-
"x-index": 5
|
|
70
|
-
"x-platforms": ["PCWEB"]
|
|
69
|
+
"x-index": 5
|
|
71
70
|
},
|
|
72
71
|
"maxUploadCount": {
|
|
73
72
|
"type": "number",
|
|
@@ -136,6 +135,7 @@
|
|
|
136
135
|
"meta": {
|
|
137
136
|
"title": "上传图片",
|
|
138
137
|
"description": "上传图片组件",
|
|
139
|
-
"category": "表单"
|
|
138
|
+
"category": "表单",
|
|
139
|
+
"icon": "//main.qcloudimg.com/raw/f781e6bc48efa1cf926fc768fceeab5e/Uploader.svg"
|
|
140
140
|
}
|
|
141
141
|
}
|
|
@@ -209,7 +209,8 @@
|
|
|
209
209
|
"title": "滚动容器",
|
|
210
210
|
"description": "滚动容器",
|
|
211
211
|
"category": "布局容器",
|
|
212
|
-
"componentOrder": 80
|
|
212
|
+
"componentOrder": 80,
|
|
213
|
+
"icon": "//imgcache.qq.com/qcloud/lowcode/static/ide/left-material-icon/ScrollView.svg"
|
|
213
214
|
},
|
|
214
215
|
"isContainer": true,
|
|
215
216
|
"mpOrigin": "scroll-view"
|
package/src/configs/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import Button from './components/button';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import Container from './components/container';
|
|
1
|
+
import Button from './components/button.json';
|
|
2
|
+
import Text from './components/text.json';
|
|
3
|
+
import Container from './components/container.json';
|
|
5
4
|
import Image from './components/image.json';
|
|
6
5
|
import Link from './components/link.json';
|
|
7
6
|
// import Picker from './components/picker/picker.json';
|
|
@@ -32,7 +31,6 @@ import showModal from './actions/showModal';
|
|
|
32
31
|
|
|
33
32
|
export const components = {
|
|
34
33
|
Button,
|
|
35
|
-
Markdown,
|
|
36
34
|
Text,
|
|
37
35
|
Container,
|
|
38
36
|
Image,
|
|
@@ -37,6 +37,10 @@ Component({
|
|
|
37
37
|
single: {
|
|
38
38
|
type: Boolean,
|
|
39
39
|
value: false
|
|
40
|
+
},
|
|
41
|
+
maxSize: {
|
|
42
|
+
type: Number,
|
|
43
|
+
value: 10
|
|
40
44
|
}
|
|
41
45
|
},
|
|
42
46
|
data: {
|
|
@@ -93,14 +97,17 @@ Component({
|
|
|
93
97
|
}
|
|
94
98
|
},
|
|
95
99
|
observers: {
|
|
96
|
-
'defaultValue': function(value) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
// 'defaultValue': function(value) {
|
|
101
|
+
// if(!deepEqual(value, this.data.urls)) {
|
|
102
|
+
// if(!Array.isArray(value)) {
|
|
103
|
+
// value = [value].filter(v => v.length > 0);
|
|
104
|
+
// }
|
|
105
|
+
// this.setData({
|
|
106
|
+
// files: value.map(f => ({url: f})),
|
|
107
|
+
// urls: value
|
|
108
|
+
// });
|
|
109
|
+
// }
|
|
110
|
+
// },
|
|
104
111
|
'maxUploadCount, single': function(maxUploadCount, single) {
|
|
105
112
|
const maxCount = single ? 1 : maxUploadCount;
|
|
106
113
|
this.setData({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<mp-cells>
|
|
2
2
|
<mp-cell>
|
|
3
|
-
<mp-uploader files="{{files}}" showDelete="{{true}}" ext-class="{{layout}}" bindfail="uploadError" bindsuccess="uploadSuccess" select="{{selectFile}}" upload="{{uploadFile}}" maxCount="{{
|
|
3
|
+
<mp-uploader max-size="{{maxSize * 1024 * 1024}}" files="{{files}}" showDelete="{{true}}" ext-class="{{layout}}" bindfail="uploadError" bindsuccess="uploadSuccess" select="{{selectFile}}" upload="{{uploadFile}}" maxCount="{{maxCount}}" title="{{title}}" tips="{{tips}}" binddelete="onDelete"></mp-uploader>
|
|
4
4
|
</mp-cell>
|
|
5
5
|
</mp-cells>
|
|
6
6
|
<!-- uploader delete 实际代码接受 showDelete
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// 暂时把地区信息打包在本地, 后续移到COS桶内
|
|
2
|
-
import provinces from './provinces.
|
|
3
|
-
import cities from './cities.
|
|
4
|
-
import regions from './regions.
|
|
2
|
+
import {provinces} from './provinces.js';
|
|
3
|
+
import {cities} from './cities.js';
|
|
4
|
+
import {regions} from './regions.js';
|
|
5
5
|
import weui from '../../../../utils/weui';
|
|
6
6
|
|
|
7
7
|
let tree;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[
|
|
1
|
+
export const regions = [
|
|
2
2
|
{
|
|
3
3
|
"level": 3,
|
|
4
4
|
"code": "110101",
|
|
@@ -20642,4 +20642,4 @@
|
|
|
20642
20642
|
"parent_code": "620201",
|
|
20643
20643
|
"en": "Changcheng District"
|
|
20644
20644
|
}
|
|
20645
|
-
]
|
|
20645
|
+
];
|
|
@@ -6,6 +6,7 @@ import { getCloudInstance, getTempFileURL } from '../../../utils/tcb';
|
|
|
6
6
|
import isObjectEqual from '../../../utils/isObjectEqual';
|
|
7
7
|
import { useSyncValue } from '../../../utils/useSyncValue';
|
|
8
8
|
import { isCloudFileID } from '../../../utils/platform';
|
|
9
|
+
import { IMAGE_TYPES } from './uploader.pc';
|
|
9
10
|
|
|
10
11
|
const uploadPath = 'weda-uploader';
|
|
11
12
|
/**
|
|
@@ -14,6 +15,8 @@ const uploadPath = 'weda-uploader';
|
|
|
14
15
|
export function ImageUploaderH5({
|
|
15
16
|
title,
|
|
16
17
|
maxUploadCount,
|
|
18
|
+
maxSize = 10,
|
|
19
|
+
acceptTypes,
|
|
17
20
|
className,
|
|
18
21
|
id,
|
|
19
22
|
events,
|
|
@@ -34,8 +37,17 @@ export function ImageUploaderH5({
|
|
|
34
37
|
const [uploading, setUploading] = React.useState(false);
|
|
35
38
|
//上传进度
|
|
36
39
|
const [progress, setProgress] = React.useState(0);
|
|
37
|
-
const [
|
|
38
|
-
const
|
|
40
|
+
const [inputValue, setInputValue] = useSyncValue(defaultValue, isObjectEqual);
|
|
41
|
+
const fileIdList = React.useMemo(() => {
|
|
42
|
+
if( typeof inputValue === 'string') {
|
|
43
|
+
// single = true 传入的是字符串
|
|
44
|
+
return [inputValue].filter(i => i.length > 0); // 排除空串
|
|
45
|
+
}
|
|
46
|
+
if(Array.isArray(inputValue)) {
|
|
47
|
+
return inputValue;
|
|
48
|
+
}
|
|
49
|
+
return [];
|
|
50
|
+
}, [inputValue]);
|
|
39
51
|
|
|
40
52
|
const finalMaxImgCount = React.useMemo(() => {
|
|
41
53
|
if(single) return 1;
|
|
@@ -43,18 +55,22 @@ export function ImageUploaderH5({
|
|
|
43
55
|
}, [single, maxUploadCount]);
|
|
44
56
|
|
|
45
57
|
const deleteFile = (url) => {
|
|
46
|
-
|
|
58
|
+
if(single) {
|
|
59
|
+
setInputValue('');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
setInputValue((list) => list.filter(f => f !== url));
|
|
47
63
|
};
|
|
48
64
|
React.useEffect(() => {
|
|
49
65
|
if (single) {
|
|
50
|
-
const file =
|
|
66
|
+
const file = fileIdList[0] || '';
|
|
51
67
|
file && onChange && onChange(file);
|
|
52
68
|
events.change && events.change({ value: file });
|
|
53
69
|
} else {
|
|
54
|
-
onChange && onChange(
|
|
55
|
-
events.change && events.change({ value:
|
|
70
|
+
onChange && onChange(fileIdList);
|
|
71
|
+
events.change && events.change({ value: fileIdList });
|
|
56
72
|
}
|
|
57
|
-
}, [
|
|
73
|
+
}, [fileIdList]);
|
|
58
74
|
const onProgress = (progressEvent) => {
|
|
59
75
|
let percentCompleted = 0;
|
|
60
76
|
try {
|
|
@@ -77,7 +93,7 @@ export function ImageUploaderH5({
|
|
|
77
93
|
onUploadProgress: onProgress,
|
|
78
94
|
|
|
79
95
|
});
|
|
80
|
-
fileID &&
|
|
96
|
+
fileID && setInputValue((list) => [...list, fileID]);
|
|
81
97
|
fileID && events.success && events.success({ value: fileID, file });
|
|
82
98
|
} catch (err) {
|
|
83
99
|
events.error && events.error(err);
|
|
@@ -87,6 +103,13 @@ export function ImageUploaderH5({
|
|
|
87
103
|
}
|
|
88
104
|
});
|
|
89
105
|
};
|
|
106
|
+
|
|
107
|
+
const accepts = React.useMemo(() => {
|
|
108
|
+
return acceptTypes.includes('image/*') || acceptTypes.length === 0
|
|
109
|
+
? IMAGE_TYPES
|
|
110
|
+
: Array.from(new Set(acceptTypes));
|
|
111
|
+
}, [acceptTypes]);
|
|
112
|
+
|
|
90
113
|
return (
|
|
91
114
|
<div className={cls} id={id} style={style}>
|
|
92
115
|
<div className="weui-cell">
|
|
@@ -95,13 +118,13 @@ export function ImageUploaderH5({
|
|
|
95
118
|
<div className={classNames("weui-uploader__hd", layout)}>
|
|
96
119
|
<p className="weui-uploader__title">{title}</p>
|
|
97
120
|
<div className="weui-uploader__info">
|
|
98
|
-
<span id="uploadCount">{
|
|
121
|
+
<span id="uploadCount">{fileIdList.length}</span>
|
|
99
122
|
{`/${finalMaxImgCount}`}
|
|
100
123
|
</div>
|
|
101
124
|
</div>
|
|
102
125
|
<div className="weui-uploader__bd">
|
|
103
126
|
<ul className="weui-uploader__files" id="uploaderFiles">
|
|
104
|
-
{(
|
|
127
|
+
{(fileIdList ?? []).map(f => <SingleImage key={f} src={f} deleteBySrc={deleteFile} />)}
|
|
105
128
|
{uploading &&
|
|
106
129
|
<li className="weui-uploader__file weui-uploader__file_status" >
|
|
107
130
|
<div className="weui-uploader__file-content">
|
|
@@ -109,18 +132,18 @@ export function ImageUploaderH5({
|
|
|
109
132
|
</div>
|
|
110
133
|
</li>}
|
|
111
134
|
</ul>
|
|
112
|
-
{(
|
|
113
|
-
(single &&
|
|
135
|
+
{(fileIdList.length < maxUploadCount ||
|
|
136
|
+
(single && fileIdList.length < 1)) && ( // single 模式时,仅当数组为空时显示
|
|
114
137
|
<div className="weui-uploader__input-box">
|
|
115
138
|
<input
|
|
116
139
|
id="uploaderInput"
|
|
117
140
|
className="weui-uploader__input"
|
|
118
141
|
type="file"
|
|
119
|
-
accept=
|
|
142
|
+
accept={accepts.join(',')}
|
|
120
143
|
multiple
|
|
121
144
|
onChange={e => {
|
|
122
145
|
const files = [...e.target.files];
|
|
123
|
-
if (files.some(f => f.size >
|
|
146
|
+
if (files.some(f => f.size > maxSize * 1024 * 1024)) {
|
|
124
147
|
weui.alert('请上传不超过10M的图片');
|
|
125
148
|
return false;
|
|
126
149
|
}
|
|
@@ -130,7 +153,7 @@ export function ImageUploaderH5({
|
|
|
130
153
|
weui.alert(`最多只能上传${finalMaxImgCount}张图片,请重新选择`);
|
|
131
154
|
return false;
|
|
132
155
|
}
|
|
133
|
-
if (
|
|
156
|
+
if (fileIdList.length + files.length > finalMaxImgCount) {
|
|
134
157
|
weui.alert(`最多只能上传${finalMaxImgCount}张图片`);
|
|
135
158
|
return false;
|
|
136
159
|
}
|
|
@@ -195,12 +218,15 @@ function SingleImage({src, deleteBySrc}) {
|
|
|
195
218
|
);
|
|
196
219
|
}
|
|
197
220
|
SingleImage.propTypes = {
|
|
198
|
-
src: PropTypes.string
|
|
221
|
+
src: PropTypes.string,
|
|
222
|
+
deleteBySrc: PropTypes.func
|
|
199
223
|
};
|
|
200
224
|
ImageUploaderH5.propTypes = {
|
|
201
225
|
id: PropTypes.string,
|
|
202
226
|
title: PropTypes.string,
|
|
203
227
|
className: PropTypes.string, // 传入类
|
|
228
|
+
maxSize: PropTypes.number,
|
|
229
|
+
acceptTypes: PropTypes.array,
|
|
204
230
|
maxUploadCount: PropTypes.number, // 【上传图片最大数量】
|
|
205
231
|
events: PropTypes.objectOf(PropTypes.func), // 事件
|
|
206
232
|
style: PropTypes.object,
|
|
@@ -3,7 +3,6 @@ import * as PropTypes from 'prop-types';
|
|
|
3
3
|
import { ConfigProvider, ImagePreview } from 'tea-component';
|
|
4
4
|
import { usePlatform } from '../../utils/platform';
|
|
5
5
|
import { useGesture } from '@use-gesture/react';
|
|
6
|
-
import { off } from 'react-use/lib/util';
|
|
7
6
|
|
|
8
7
|
ImageInner.propTypes = {
|
|
9
8
|
objectFit: PropTypes.string,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import '../wedatheme/style-package/index.css';
|
|
2
2
|
|
|
3
3
|
export { default as Button } from './button';
|
|
4
|
-
export { default as Markdown } from './markdown';
|
|
5
4
|
export { default as Text } from './text';
|
|
6
5
|
export { default as Container } from './container';
|
|
7
6
|
export { default as Image } from './image';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/schema/lcds_component.json",
|
|
3
|
-
"data": {
|
|
4
|
-
"properties": {
|
|
5
|
-
"source": {
|
|
6
|
-
"title": "markdown 内容",
|
|
7
|
-
"type": "textarea",
|
|
8
|
-
"default": "> 这是 `markdown` 文本"
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
"meta": {
|
|
13
|
-
"title": "Markdown",
|
|
14
|
-
"description": "markdown 预览",
|
|
15
|
-
"category": "展示"
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const towxml = require('./towxml/index');
|
|
2
|
-
|
|
3
|
-
Component({
|
|
4
|
-
options: {
|
|
5
|
-
virtualHost: true,
|
|
6
|
-
},
|
|
7
|
-
data: {
|
|
8
|
-
nodes: {},
|
|
9
|
-
},
|
|
10
|
-
properties: {
|
|
11
|
-
source: {
|
|
12
|
-
type: String,
|
|
13
|
-
value: '> 这是 `markdown` 文本',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
methods: {
|
|
17
|
-
updateNodes() {
|
|
18
|
-
const nodes = towxml(this.properties.source, 'markdown', {});
|
|
19
|
-
this.setData({ nodes });
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
observers: {
|
|
23
|
-
source() {
|
|
24
|
-
this.updateNodes();
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<towxml className="weda-ui" nodes="{{nodes}}"></towxml>
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
const fillIn = (val) => `${val < 10 ? '0' : ''}${val}`;
|
|
2
|
-
const formatTime = (_time) => {
|
|
3
|
-
const time = Math.round(_time);
|
|
4
|
-
const second = Math.round(time % 60);
|
|
5
|
-
const minute = Math.floor((time / 60) % 60);
|
|
6
|
-
const hour = Math.floor(time / 60 / 60);
|
|
7
|
-
return `${fillIn(hour)}:${fillIn(minute)}:${fillIn(second)}`;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
class Audio {
|
|
11
|
-
constructor(obj) {
|
|
12
|
-
const _ts = this;
|
|
13
|
-
const option = (_ts.option = obj.attr);
|
|
14
|
-
|
|
15
|
-
(_ts.loop = option.loop === 'true'), (_ts.autoplay = option.autoplay === 'true');
|
|
16
|
-
_ts.create();
|
|
17
|
-
_ts.index = 0;
|
|
18
|
-
}
|
|
19
|
-
create() {
|
|
20
|
-
const _ts = this;
|
|
21
|
-
const { option } = _ts;
|
|
22
|
-
const audio = (_ts.audio = wx.createInnerAudioContext());
|
|
23
|
-
audio.src = option.src;
|
|
24
|
-
|
|
25
|
-
// 说明可以播放了
|
|
26
|
-
audio.onCanplay(() => {
|
|
27
|
-
if (_ts.autoplay && !_ts.index) {
|
|
28
|
-
_ts.play();
|
|
29
|
-
}
|
|
30
|
-
if (!_ts.autoplay && !_ts.index) {
|
|
31
|
-
_ts.eventCanplay();
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// 更新时间
|
|
36
|
-
audio.onTimeUpdate(() => {
|
|
37
|
-
// _ts.status = 'update';
|
|
38
|
-
_ts.duration = audio.duration;
|
|
39
|
-
_ts.currentTime = audio.currentTime;
|
|
40
|
-
|
|
41
|
-
// 定义播放结束
|
|
42
|
-
if (_ts.duration - _ts.currentTime < 0.5) {
|
|
43
|
-
_ts.index++;
|
|
44
|
-
if (_ts.loop) {
|
|
45
|
-
audio.stop();
|
|
46
|
-
} else {
|
|
47
|
-
_ts.stop();
|
|
48
|
-
}
|
|
49
|
-
audio.seek(0);
|
|
50
|
-
}
|
|
51
|
-
_ts.eventTimeUpdate(formatTime(_ts.duration), formatTime(_ts.currentTime));
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
//
|
|
55
|
-
audio.onSeeked(() => {
|
|
56
|
-
if (_ts.loop) {
|
|
57
|
-
_ts.play();
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
// 播放
|
|
62
|
-
play() {
|
|
63
|
-
const _ts = this;
|
|
64
|
-
_ts.status = 'play';
|
|
65
|
-
_ts.audio.play();
|
|
66
|
-
_ts.eventPlay();
|
|
67
|
-
}
|
|
68
|
-
// 暂停
|
|
69
|
-
pause() {
|
|
70
|
-
const _ts = this;
|
|
71
|
-
_ts.status = 'pause';
|
|
72
|
-
_ts.audio.pause();
|
|
73
|
-
_ts.eventPause();
|
|
74
|
-
}
|
|
75
|
-
// 停止
|
|
76
|
-
stop() {
|
|
77
|
-
const _ts = this;
|
|
78
|
-
_ts.status = 'stop';
|
|
79
|
-
_ts.audio.stop();
|
|
80
|
-
_ts.eventStop();
|
|
81
|
-
}
|
|
82
|
-
// 销毁
|
|
83
|
-
destroy() {
|
|
84
|
-
const _ts = this;
|
|
85
|
-
_ts.stop();
|
|
86
|
-
_ts.audio.destroy();
|
|
87
|
-
}
|
|
88
|
-
eventCanplay() {}
|
|
89
|
-
eventTimeUpdate() {}
|
|
90
|
-
eventEnded() {}
|
|
91
|
-
eventError() {}
|
|
92
|
-
eventPause() {}
|
|
93
|
-
eventPlay() {}
|
|
94
|
-
eventSeeked() {}
|
|
95
|
-
eventSeeking() {}
|
|
96
|
-
eventStop() {}
|
|
97
|
-
eventWaiting() {}
|
|
98
|
-
}
|
|
99
|
-
module.exports = Audio;
|