@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.
Files changed (114) hide show
  1. package/package.json +1 -3
  2. package/src/configs/components/container.json +2 -1
  3. package/src/configs/components/form/richText.json +2 -1
  4. package/src/configs/components/form/uploader.json +4 -4
  5. package/src/configs/components/image.json +2 -1
  6. package/src/configs/components/link.json +2 -1
  7. package/src/configs/components/richtextview.json +2 -1
  8. package/src/configs/components/scrollVeiw.json +2 -1
  9. package/src/configs/components/swiper.json +2 -1
  10. package/src/configs/components/tabs.json +2 -1
  11. package/src/configs/components/text.json +2 -1
  12. package/src/configs/index.js +3 -5
  13. package/src/mp/components/form/uploader/index.js +15 -8
  14. package/src/mp/components/form/uploader/index.wxml +1 -1
  15. package/src/web/components/form/select/region/{cities.json → cities.js} +2 -2
  16. package/src/web/components/form/select/region/index.js +3 -3
  17. package/src/web/components/form/select/region/{provinces.json → provinces.js} +2 -2
  18. package/src/web/components/form/select/region/{regions.json → regions.js} +2 -2
  19. package/src/web/components/form/switch/index.jsx +1 -0
  20. package/src/web/components/form/uploader/uploader.h5.jsx +42 -16
  21. package/src/web/components/form/uploader/uploader.pc.jsx +1 -1
  22. package/src/web/components/image/image.jsx +0 -1
  23. package/src/web/components/index.js +0 -1
  24. package/src/configs/components/markdown.json +0 -17
  25. package/src/mp/components/markdown/index.js +0 -27
  26. package/src/mp/components/markdown/index.json +0 -6
  27. package/src/mp/components/markdown/index.wxml +0 -1
  28. package/src/mp/components/markdown/towxml/audio-player/Audio.js +0 -99
  29. package/src/mp/components/markdown/towxml/audio-player/audio-player.js +0 -102
  30. package/src/mp/components/markdown/towxml/audio-player/audio-player.json +0 -5
  31. package/src/mp/components/markdown/towxml/audio-player/audio-player.wxml +0 -14
  32. package/src/mp/components/markdown/towxml/audio-player/audio-player.wxss +0 -175
  33. package/src/mp/components/markdown/towxml/audio-player/loading.svg +0 -1
  34. package/src/mp/components/markdown/towxml/config.js +0 -285
  35. package/src/mp/components/markdown/towxml/decode.js +0 -26
  36. package/src/mp/components/markdown/towxml/decode.json +0 -12
  37. package/src/mp/components/markdown/towxml/decode.wxml +0 -1
  38. package/src/mp/components/markdown/towxml/decode.wxss +0 -0
  39. package/src/mp/components/markdown/towxml/img/img.js +0 -98
  40. package/src/mp/components/markdown/towxml/img/img.json +0 -3
  41. package/src/mp/components/markdown/towxml/img/img.wxml +0 -1
  42. package/src/mp/components/markdown/towxml/img/img.wxss +0 -0
  43. package/src/mp/components/markdown/towxml/index.js +0 -19
  44. package/src/mp/components/markdown/towxml/latex/latex.js +0 -53
  45. package/src/mp/components/markdown/towxml/latex/latex.json +0 -5
  46. package/src/mp/components/markdown/towxml/latex/latex.wxml +0 -1
  47. package/src/mp/components/markdown/towxml/latex/latex.wxss +0 -0
  48. package/src/mp/components/markdown/towxml/parse/highlight/highlight.js +0 -729
  49. package/src/mp/components/markdown/towxml/parse/highlight/index.js +0 -7
  50. package/src/mp/components/markdown/towxml/parse/highlight/languages/bash.js +0 -91
  51. package/src/mp/components/markdown/towxml/parse/highlight/languages/c-like.js +0 -244
  52. package/src/mp/components/markdown/towxml/parse/highlight/languages/c.js +0 -20
  53. package/src/mp/components/markdown/towxml/parse/highlight/languages/css.js +0 -138
  54. package/src/mp/components/markdown/towxml/parse/highlight/languages/dart.js +0 -135
  55. package/src/mp/components/markdown/towxml/parse/highlight/languages/go.js +0 -57
  56. package/src/mp/components/markdown/towxml/parse/highlight/languages/htmlbars.js +0 -79
  57. package/src/mp/components/markdown/towxml/parse/highlight/languages/java.js +0 -126
  58. package/src/mp/components/markdown/towxml/parse/highlight/languages/javascript.js +0 -263
  59. package/src/mp/components/markdown/towxml/parse/highlight/languages/json.js +0 -51
  60. package/src/mp/components/markdown/towxml/parse/highlight/languages/less.js +0 -177
  61. package/src/mp/components/markdown/towxml/parse/highlight/languages/nginx.js +0 -103
  62. package/src/mp/components/markdown/towxml/parse/highlight/languages/php.js +0 -152
  63. package/src/mp/components/markdown/towxml/parse/highlight/languages/python-repl.js +0 -27
  64. package/src/mp/components/markdown/towxml/parse/highlight/languages/python.js +0 -146
  65. package/src/mp/components/markdown/towxml/parse/highlight/languages/scss.js +0 -137
  66. package/src/mp/components/markdown/towxml/parse/highlight/languages/shell.js +0 -23
  67. package/src/mp/components/markdown/towxml/parse/highlight/languages/typescript.js +0 -198
  68. package/src/mp/components/markdown/towxml/parse/highlight/languages/xml.js +0 -143
  69. package/src/mp/components/markdown/towxml/parse/highlight/style/github.wxss +0 -99
  70. package/src/mp/components/markdown/towxml/parse/highlight/style/monokai.wxss +0 -70
  71. package/src/mp/components/markdown/towxml/parse/index.js +0 -106
  72. package/src/mp/components/markdown/towxml/parse/markdown/index.js +0 -53
  73. package/src/mp/components/markdown/towxml/parse/markdown/markdown.js +0 -5834
  74. package/src/mp/components/markdown/towxml/parse/markdown/plugins/emoji.js +0 -1773
  75. package/src/mp/components/markdown/towxml/parse/markdown/plugins/ins.js +0 -120
  76. package/src/mp/components/markdown/towxml/parse/markdown/plugins/latex.js +0 -193
  77. package/src/mp/components/markdown/towxml/parse/markdown/plugins/mark.js +0 -120
  78. package/src/mp/components/markdown/towxml/parse/markdown/plugins/sub.js +0 -95
  79. package/src/mp/components/markdown/towxml/parse/markdown/plugins/sup.js +0 -95
  80. package/src/mp/components/markdown/towxml/parse/markdown/plugins/todo.js +0 -220
  81. package/src/mp/components/markdown/towxml/parse/markdown/plugins/yuml.js +0 -18
  82. package/src/mp/components/markdown/towxml/parse/parse2/Parser.js +0 -263
  83. package/src/mp/components/markdown/towxml/parse/parse2/Tokenizer.js +0 -507
  84. package/src/mp/components/markdown/towxml/parse/parse2/domhandler/index.js +0 -104
  85. package/src/mp/components/markdown/towxml/parse/parse2/domhandler/node.js +0 -169
  86. package/src/mp/components/markdown/towxml/parse/parse2/entities/decode.js +0 -54
  87. package/src/mp/components/markdown/towxml/parse/parse2/entities/decode_codepoint.js +0 -19
  88. package/src/mp/components/markdown/towxml/parse/parse2/entities/encode.js +0 -54
  89. package/src/mp/components/markdown/towxml/parse/parse2/entities/index.js +0 -30
  90. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/decode.js +0 -31
  91. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/entities.js +0 -2128
  92. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/legacy.js +0 -109
  93. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/xml.js +0 -2
  94. package/src/mp/components/markdown/towxml/parse/parse2/index.js +0 -8
  95. package/src/mp/components/markdown/towxml/style/main.wxss +0 -378
  96. package/src/mp/components/markdown/towxml/style/theme/dark.wxss +0 -73
  97. package/src/mp/components/markdown/towxml/style/theme/light.wxss +0 -63
  98. package/src/mp/components/markdown/towxml/table/table.js +0 -11
  99. package/src/mp/components/markdown/towxml/table/table.json +0 -6
  100. package/src/mp/components/markdown/towxml/table/table.wxml +0 -24
  101. package/src/mp/components/markdown/towxml/table/table.wxss +0 -0
  102. package/src/mp/components/markdown/towxml/todogroup/todogroup.js +0 -19
  103. package/src/mp/components/markdown/towxml/todogroup/todogroup.json +0 -6
  104. package/src/mp/components/markdown/towxml/todogroup/todogroup.wxml +0 -13
  105. package/src/mp/components/markdown/towxml/todogroup/todogroup.wxss +0 -3
  106. package/src/mp/components/markdown/towxml/towxml.js +0 -17
  107. package/src/mp/components/markdown/towxml/towxml.json +0 -6
  108. package/src/mp/components/markdown/towxml/towxml.wxml +0 -5
  109. package/src/mp/components/markdown/towxml/towxml.wxss +0 -8
  110. package/src/mp/components/markdown/towxml/yuml/yuml.js +0 -51
  111. package/src/mp/components/markdown/towxml/yuml/yuml.json +0 -5
  112. package/src/mp/components/markdown/towxml/yuml/yuml.wxml +0 -5
  113. package/src/mp/components/markdown/towxml/yuml/yuml.wxss +0 -0
  114. 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.7",
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",
@@ -41,6 +41,7 @@
41
41
  "title": "普通容器",
42
42
  "category": "布局容器",
43
43
  "description": "通用块状容器",
44
- "componentOrder": 1000
44
+ "componentOrder": 1000,
45
+ "icon": "//imgcache.qq.com/qcloud/lowcode/static/ide/left-material-icon/Container.svg"
45
46
  }
46
47
  }
@@ -113,7 +113,8 @@
113
113
  "meta": {
114
114
  "title": "富文本",
115
115
  "description": "富文本编辑器",
116
- "category": "表单"
116
+ "category": "表单",
117
+ "icon": "//main.qcloudimg.com/raw/adc8cd1b6eb93c0f890ca2322e509a6b/RichText.svg"
117
118
  },
118
119
  "events": [
119
120
  {
@@ -8,7 +8,7 @@
8
8
  "default": ["image/*"],
9
9
  "x-category": "基础属性",
10
10
  "x-index": 6,
11
- "x-platforms": ["PCWEB"],
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
  }
@@ -145,6 +145,7 @@
145
145
  "meta": {
146
146
  "title": "图片",
147
147
  "description": "图片组件",
148
- "category": "多媒体"
148
+ "category": "多媒体",
149
+ "icon": "//imgcache.qq.com/qcloud/lowcode/static/ide/left-material-icon/Image.svg"
149
150
  }
150
151
  }
@@ -53,7 +53,8 @@
53
53
  "title": "链接",
54
54
  "description": "",
55
55
  "category": "文本",
56
- "componentOrder": 10
56
+ "componentOrder": 10,
57
+ "icon": "//main.qcloudimg.com/raw/eb8a45dc259eb4925d89ac88be1ecdd9/Link.svg"
57
58
  },
58
59
  "events": [
59
60
  {
@@ -16,6 +16,7 @@
16
16
  "title": "富文本展示",
17
17
  "description": "富文本展示",
18
18
  "category": "文本",
19
- "componentOrder": 0
19
+ "componentOrder": 0,
20
+ "icon": "//main.qcloudimg.com/raw/9c42d779f51105715a032d139344c508/RichTextView.svg"
20
21
  }
21
22
  }
@@ -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"
@@ -70,7 +70,8 @@
70
70
  "title": "轮播",
71
71
  "description": "轮播图组件",
72
72
  "category": "展示",
73
- "componentOrder": 80
73
+ "componentOrder": 80,
74
+ "icon": "//imgcache.qq.com/qcloud/lowcode/static/ide/left-material-icon/Swiper.svg"
74
75
  },
75
76
  "isContainer": true,
76
77
  "mpOrigin": "swiper"
@@ -70,6 +70,7 @@
70
70
  "name": "Tabs",
71
71
  "title": "选项卡",
72
72
  "description": "选项卡组件",
73
- "category": "展示"
73
+ "category": "展示",
74
+ "icon": "//qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_files/static/comp/icons/Tabs.svg"
74
75
  }
75
76
  }
@@ -41,6 +41,7 @@
41
41
  "title": "文本",
42
42
  "description": "文本内容",
43
43
  "category": "文本",
44
- "componentOrder": 100
44
+ "componentOrder": 100,
45
+ "icon": "//imgcache.qq.com/qcloud/lowcode/static/ide/left-material-icon/Text.svg"
45
46
  }
46
47
  }
@@ -1,7 +1,6 @@
1
- import Button from './components/button';
2
- import Markdown from './components/markdown';
3
- import Text from './components/text';
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
- if(!deepEqual(value, this.data.urls)) {
98
- this.setData({
99
- files: value.map(f => ({url: f})),
100
- urls: value
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="{{maxUploadCount}}" title="{{title}}" tips="{{tips}}" binddelete="onDelete"></mp-uploader>
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,4 +1,4 @@
1
- [
1
+ export const cities = [
2
2
  {
3
3
  "level": 2,
4
4
  "code": "1101",
@@ -2407,4 +2407,4 @@
2407
2407
  "parent_code": "65",
2408
2408
  "en": "County-level administrative divisions directly under the Central Government"
2409
2409
  }
2410
- ]
2410
+ ];
@@ -1,7 +1,7 @@
1
1
  // 暂时把地区信息打包在本地, 后续移到COS桶内
2
- import provinces from './provinces.json';
3
- import cities from './cities.json';
4
- import regions from './regions.json';
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 provinces = [
2
2
  {
3
3
  "level": 1,
4
4
  "code": "11",
@@ -237,4 +237,4 @@
237
237
  "parent_code": "",
238
238
  "en": "Taiwan"
239
239
  }
240
- ]
240
+ ];
@@ -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
+ ];
@@ -70,6 +70,7 @@ export default function Switch({
70
70
  (
71
71
  <TeaSwitch
72
72
  id={_id}
73
+ value={checked}
73
74
  disabled={disabled}
74
75
  onChange={onChange}
75
76
  />
@@ -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 [fileIDList, setfileIDList] = useSyncValue(defaultValue, isObjectEqual);
38
- const uploadCount = (fileIDList ?? []).length;
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
- setfileIDList((list) => list.filter(f => f !== url));
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 = fileIDList[0] || '';
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(fileIDList);
55
- events.change && events.change({ value: fileIDList });
70
+ onChange && onChange(fileIdList);
71
+ events.change && events.change({ value: fileIdList });
56
72
  }
57
- }, [fileIDList]);
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 && setfileIDList((list) => [...list, 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">{uploadCount}</span>
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
- {(fileIDList ?? []).map(f => <SingleImage key={f} src={f} deleteBySrc={deleteFile} />)}
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
- {(fileIDList.length < maxUploadCount ||
113
- (single && fileIDList.length < 1)) && ( // 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="image/*"
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 > 10 * 1024 * 1024)) {
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 (uploadCount + files.length > finalMaxImgCount) {
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,
@@ -18,7 +18,7 @@ import * as PropTypes from 'prop-types';
18
18
  // 默认组件类前缀
19
19
  export const CLASS_PREFIX = 'weda-uploader-pc';
20
20
  // 默认图片类型
21
- const IMAGE_TYPES = [
21
+ export const IMAGE_TYPES = [
22
22
  'image/jpg',
23
23
  'image/png',
24
24
  'image/tif',
@@ -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,6 +0,0 @@
1
- {
2
- "component": true,
3
- "usingComponents": {
4
- "towxml": "./towxml/towxml"
5
- }
6
- }
@@ -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;