@cloudbase/weda-ui 0.2.5 → 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 +4 -4
- package/src/.DS_Store +0 -0
- package/src/configs/components/container.json +2 -1
- package/src/configs/components/form/input.json +6 -0
- package/src/configs/components/form/richText.json +2 -1
- package/src/configs/components/form/uploader.json +10 -5
- 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 +31 -86
- package/src/configs/components/text.json +2 -1
- package/src/configs/index.js +3 -5
- package/src/index.js +2 -3
- package/src/mp/components/form/input/index.js +5 -1
- package/src/mp/components/form/input/index.wxml +2 -1
- package/src/mp/components/form/select/index.js +2 -2
- package/src/mp/components/form/textarea/index.wxml +1 -0
- package/src/mp/components/form/uploader/index.js +50 -13
- package/src/mp/components/form/uploader/index.wxml +11 -1
- package/src/mp/components/image/index.js +57 -8
- package/src/mp/components/image/index.json +4 -1
- package/src/mp/components/image/index.wxml +4 -2
- package/src/mp/components/image/index.wxss +15 -0
- package/src/mp/components/richText/index.wxml +3 -1
- package/src/mp/components/tabs/index.js +22 -6
- package/src/mp/utils/deepEqual.js +42 -0
- package/src/web/actions/index.js +2 -4
- package/src/web/components/form/checkbox/index.jsx +8 -10
- package/src/web/components/form/formcell/index.jsx +1 -1
- package/src/web/components/form/input/index.jsx +16 -18
- package/src/web/components/form/radio/index.jsx +7 -7
- package/src/web/components/form/select/h5.jsx +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 +4 -9
- package/src/web/components/form/textarea/index.jsx +4 -12
- package/src/web/components/form/uploader/index.css +15 -0
- package/src/web/components/form/uploader/index.jsx +2 -2
- package/src/web/components/form/uploader/uploader.h5.jsx +237 -0
- package/src/web/components/form/uploader/{uploaderPc.jsx → uploader.pc.jsx} +76 -58
- package/src/web/components/image/image.jsx +79 -5
- package/src/web/components/image/index.css +18 -0
- package/src/web/components/image/index.jsx +1 -0
- package/src/web/components/index.js +26 -58
- package/src/web/components/richTextView/index.css +0 -10
- package/src/web/components/richTextView/index.jsx +1 -12
- package/src/web/components/tabs/{index.js → index.jsx} +3 -3
- package/src/web/components/tabs/{tabsH5.js → tabs.h5.jsx} +9 -47
- package/src/web/components/tabs/{tabsPc.js → tabs.pc.jsx} +13 -47
- package/src/web/components/uploaderView/index.jsx +1 -1
- package/src/web/index.js +2 -3
- package/src/web/utils/isObjectEqual.js +10 -1
- package/src/web/utils/useSyncValue.js +14 -0
- package/src/web/weda-ui.css +8 -0
- 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/form/uploader/uploaderH5.jsx +0 -192
- package/src/web/components/markdown/index.jsx +0 -40
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
left: 0;
|
|
10
10
|
right: 0;
|
|
11
11
|
background-color: black;
|
|
12
|
+
z-index: 99;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
.weda-img-preview {
|
|
@@ -29,3 +30,17 @@
|
|
|
29
30
|
display: inline-block;
|
|
30
31
|
z-index: 99;
|
|
31
32
|
}
|
|
33
|
+
|
|
34
|
+
.weda-image-error {
|
|
35
|
+
position: relative;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.weda-image-error::before {
|
|
39
|
+
content: '';
|
|
40
|
+
background: #f5f5f5 url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIiBmaWxsPSJub25lIj4KICA8cGF0aCBkPSJNMjUuMzIgMTYuMzU5N0MyNi4wNzY0IDE2LjM1OTcgMjYuODI1NCAxNi41MDg3IDI3LjUyNDMgMTYuNzk4MUMyOC4yMjMxIDE3LjA4NzYgMjguODU4MSAxNy41MTE5IDI5LjM5MjkgMTguMDQ2OEMyOS45Mjc4IDE4LjU4MTYgMzAuMzUyMSAxOS4yMTY2IDMwLjY0MTYgMTkuOTE1NEMzMC45MzEgMjAuNjE0MyAzMS4wOCAyMS4zNjMzIDMxLjA4IDIyLjExOTdDMzEuMDggMjIuODc2MSAzMC45MzEgMjMuNjI1MSAzMC42NDE2IDI0LjMyMzlDMzAuMzUyMSAyNS4wMjI4IDI5LjkyNzggMjUuNjU3OCAyOS4zOTI5IDI2LjE5MjZDMjguODU4MSAyNi43Mjc1IDI4LjIyMzEgMjcuMTUxOCAyNy41MjQzIDI3LjQ0MTJDMjYuODI1NCAyNy43MzA3IDI2LjA3NjQgMjcuODc5NyAyNS4zMiAyNy44Nzk3QzIzLjc5MjQgMjcuODc5NyAyMi4zMjczIDI3LjI3MjggMjEuMjQ3MSAyNi4xOTI2QzIwLjE2NjkgMjUuMTEyNCAxOS41NiAyMy42NDczIDE5LjU2IDIyLjExOTdDMTkuNTYgMjAuNTkyIDIwLjE2NjkgMTkuMTI3IDIxLjI0NzEgMTguMDQ2OEMyMi4zMjczIDE2Ljk2NjUgMjMuNzkyNCAxNi4zNTk3IDI1LjMyIDE2LjM1OTdaTTI4IDMuNTU5NjlWMTQuODc2OEMyNy4xNzc3IDE0LjU4NjYgMjYuMTkyIDE0LjQzODggMjUuMzIgMTQuNDM5N0MyNC4wMzEgMTQuNDM5NyAyMi44MTU3IDE0Ljc1NzEgMjEuNzQ4OCAxNS4zMTg0TDIwLjc5NTIgMTMuMTU5N0wxNi4wMjU5IDIwLjAyNzVMOC40NDU3NiAxNi40NDFMMy41NiAyMy4zOTk3SDE3Ljc0NjJDMTcuOTg2NyAyNC44MjkgMTguNjI4MiAyNi4xNjA2IDE5LjU5NTggMjcuMjM5N0gxVjMuNTU5NjlIMjhaTTI1Ljk2IDI0LjAzOTdIMjQuNjhWMjUuMzE5N0gyNS45NlYyNC4wMzk3Wk0yNS45NiAxOC45MTk3SDI0LjY4VjIzLjM5OTdIMjUuOTZWMTguOTE5N1pNNi4xMiAxMC41OTk3QzYuMTIgMTEuOTk4MSA3LjE5OTA0IDEzLjEwODUgOC42MDc2OCAxMy4xNTg0QzEwLjAyMDggMTMuMjA3NyAxMS4yNCAxMi4wNDggMTEuMjQgMTAuNTk5N0MxMS4yNCA5LjI0NjA5IDEwLjA2NDMgOC4wODU3NyA4Ljc1MjMyIDguMDQwOTdDNy4yOTU2OCA3Ljk5MTY5IDYuMTIgOS4xNTEzNyA2LjEyIDEwLjU5OTdaIiBmaWxsPSIjQkNDNEQwIj48L3BhdGg+Cjwvc3ZnPgo=') no-repeat center / 50% 50%;
|
|
41
|
+
position: absolute;
|
|
42
|
+
left: 0;
|
|
43
|
+
top: 0;
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 100%;
|
|
46
|
+
}
|
|
@@ -7,13 +7,20 @@ Component({
|
|
|
7
7
|
},
|
|
8
8
|
|
|
9
9
|
properties: {
|
|
10
|
-
tabs: Array,
|
|
11
|
-
scrollCellId:
|
|
10
|
+
tabs: { type: Array, value: [] },
|
|
11
|
+
scrollCellId: {
|
|
12
|
+
type: String,
|
|
13
|
+
value: '',
|
|
14
|
+
},
|
|
15
|
+
selectedIndex: {
|
|
16
|
+
type: Number,
|
|
17
|
+
value: 0
|
|
18
|
+
}
|
|
12
19
|
},
|
|
13
20
|
|
|
14
21
|
data: {
|
|
15
22
|
currentIndex: 0,
|
|
16
|
-
stickyStyle: null
|
|
23
|
+
stickyStyle: null,
|
|
17
24
|
},
|
|
18
25
|
|
|
19
26
|
methods: {
|
|
@@ -21,14 +28,23 @@ Component({
|
|
|
21
28
|
const { tabs } = this.data;
|
|
22
29
|
const { index } = e.target.dataset;
|
|
23
30
|
this.setData({
|
|
24
|
-
currentIndex: index
|
|
31
|
+
currentIndex: index,
|
|
25
32
|
});
|
|
26
|
-
|
|
33
|
+
this.triggerEvent('change', {id: index, label: tabs[index].title});
|
|
27
34
|
if (tabs.length > 5) {
|
|
28
35
|
this.setData({
|
|
29
|
-
scrollCellId: `cell-${
|
|
36
|
+
scrollCellId: `cell-${Math.max(index - 2, 0)}`,
|
|
30
37
|
});
|
|
31
38
|
}
|
|
32
39
|
},
|
|
40
|
+
},
|
|
41
|
+
observers: {
|
|
42
|
+
'selectedIndex': function(selectedIndex) {
|
|
43
|
+
if(selectedIndex !== this.data.currentIndex) {
|
|
44
|
+
this.setData({
|
|
45
|
+
currentIndex: selectedIndex
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
33
49
|
}
|
|
34
50
|
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
function equal(a, b) {
|
|
2
|
+
if (a === b) return true;
|
|
3
|
+
|
|
4
|
+
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
5
|
+
if (a.constructor !== b.constructor) return false;
|
|
6
|
+
|
|
7
|
+
var length, i, keys;
|
|
8
|
+
if (Array.isArray(a)) {
|
|
9
|
+
length = a.length;
|
|
10
|
+
if (length != b.length) return false;
|
|
11
|
+
for (i = length; i-- !== 0;)
|
|
12
|
+
if (!equal(a[i], b[i])) return false;
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
19
|
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
20
|
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
21
|
+
|
|
22
|
+
keys = Object.keys(a);
|
|
23
|
+
length = keys.length;
|
|
24
|
+
if (length !== Object.keys(b).length) return false;
|
|
25
|
+
|
|
26
|
+
for (i = length; i-- !== 0;)
|
|
27
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
28
|
+
|
|
29
|
+
for (i = length; i-- !== 0;) {
|
|
30
|
+
var key = keys[i];
|
|
31
|
+
|
|
32
|
+
if (!equal(a[key], b[key])) return false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// true if both NaN, false otherwise
|
|
39
|
+
return a!==a && b!==b;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default equal;
|
package/src/web/actions/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import { Checkbox as TeaCheckbox, ConfigProvider } from 'tea-component';
|
|
|
5
5
|
import classNames from '../../../utils/classnames';
|
|
6
6
|
import getLocalCounter from '../../../utils/getLocalCounter';
|
|
7
7
|
import isObjectEqual from '../../../utils/isObjectEqual';
|
|
8
|
-
import FormCell from '../formcell';
|
|
9
8
|
import fromEntries from 'object.fromentries';
|
|
10
9
|
import { usePlatform } from '../../../utils/platform';
|
|
11
10
|
import { renderDecorator } from '../renderDecorator';
|
|
@@ -62,6 +61,7 @@ export default function Checkbox({
|
|
|
62
61
|
*/
|
|
63
62
|
const getChangeHandler = function (value) {
|
|
64
63
|
const onChange = function (e) {
|
|
64
|
+
e.stopPropagation();
|
|
65
65
|
const checked = !checkedItems[value];
|
|
66
66
|
const newMap = Object.assign({}, checkedItems, { [value]: checked });
|
|
67
67
|
setCheckedItems(newMap);
|
|
@@ -78,36 +78,34 @@ export default function Checkbox({
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
// 现在低码组件往源码组件传入的id不唯一, 暂时使用hashcode替代
|
|
81
|
-
const hashcode = getLocalCounter();
|
|
81
|
+
const hashcode = React.useMemo(() => getLocalCounter(), []);
|
|
82
82
|
let checkboxElement;
|
|
83
83
|
if(platform === 'h5') {
|
|
84
84
|
checkboxElement = range.map(({ label, value }, index) => {
|
|
85
85
|
const _id = `checkbox-${hashcode}-${index}`;
|
|
86
86
|
const _name = `checkbox-${hashcode}-${name}`;
|
|
87
87
|
return (
|
|
88
|
-
<
|
|
89
|
-
className={subCls}
|
|
90
|
-
htmlFor={_id}
|
|
88
|
+
<div
|
|
91
89
|
key={_id}
|
|
92
|
-
|
|
90
|
+
onClickCapture={getChangeHandler(value)}
|
|
91
|
+
className={subCls}
|
|
93
92
|
>
|
|
94
93
|
<div className="weui-cell__hd">
|
|
95
94
|
<input
|
|
96
95
|
type="checkbox"
|
|
97
96
|
className="weui-check"
|
|
98
97
|
value={value}
|
|
99
|
-
name={_name}
|
|
100
98
|
id={_id}
|
|
101
|
-
|
|
99
|
+
name={_name}
|
|
100
|
+
checked={checkedItems[value]}
|
|
102
101
|
disabled={disabled}
|
|
103
|
-
onClick={(e) => e.stopPropagation()}
|
|
104
102
|
/>
|
|
105
103
|
<i className="weui-icon-checked"></i>
|
|
106
104
|
</div>
|
|
107
105
|
<div className="weui-cell__bd">
|
|
108
106
|
<p>{label}</p>
|
|
109
107
|
</div>
|
|
110
|
-
</
|
|
108
|
+
</div>
|
|
111
109
|
);
|
|
112
110
|
});
|
|
113
111
|
} else {
|
|
@@ -2,10 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
import * as PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
4
|
import classNames from '../../../utils/classnames';
|
|
5
|
-
import FormCell from '../formcell';
|
|
6
5
|
import { usePlatform } from '../../../utils/platform';
|
|
7
6
|
import { Input as TeaInput } from 'tea-component';
|
|
8
7
|
import { renderDecorator } from '../renderDecorator';
|
|
8
|
+
import { useSyncValue } from '../../../utils/useSyncValue';
|
|
9
9
|
export default function Input({
|
|
10
10
|
// 系统属性
|
|
11
11
|
id,
|
|
@@ -26,7 +26,8 @@ export default function Input({
|
|
|
26
26
|
layout,
|
|
27
27
|
requiredFlag,
|
|
28
28
|
size,
|
|
29
|
-
decorator
|
|
29
|
+
decorator,
|
|
30
|
+
clearable
|
|
30
31
|
}) {
|
|
31
32
|
const platform = usePlatform();
|
|
32
33
|
const cls = classNames({
|
|
@@ -42,15 +43,8 @@ export default function Input({
|
|
|
42
43
|
});
|
|
43
44
|
const inputType = getInputType(type, password);
|
|
44
45
|
|
|
45
|
-
const [value, setValue] = React.useState(defaultValue);
|
|
46
46
|
// 两次默认值不同时, 需要刷新value
|
|
47
|
-
const
|
|
48
|
-
React.useEffect(() => {
|
|
49
|
-
if (prevDefaultValueRef.current !== defaultValue) {
|
|
50
|
-
prevDefaultValueRef.current = defaultValue;
|
|
51
|
-
setValue(defaultValue);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
47
|
+
const [value, setValue] = useSyncValue(defaultValue);
|
|
54
48
|
|
|
55
49
|
const onChange = function (e) {
|
|
56
50
|
const text = typeof e === 'string' ? e : e.target.value;
|
|
@@ -102,12 +96,14 @@ const fieldEl = platform === 'h5' ? <div className={subCls}>
|
|
|
102
96
|
onBlur={onBlur}
|
|
103
97
|
onKeyDown={onKeyDown}
|
|
104
98
|
/>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
99
|
+
{clearable &&
|
|
100
|
+
<button
|
|
101
|
+
className="weui-btn_reset weui-btn_icon weui-btn_input-clear"
|
|
102
|
+
onMouseDown={onClear}
|
|
103
|
+
>
|
|
104
|
+
<i className="weui-icon-clear"></i>
|
|
105
|
+
</button>
|
|
106
|
+
}
|
|
111
107
|
</div>
|
|
112
108
|
</div> : <TeaInput
|
|
113
109
|
size={size}
|
|
@@ -156,7 +152,8 @@ Input.propTypes = {
|
|
|
156
152
|
layout: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
157
153
|
requiredFlag: PropTypes.bool,
|
|
158
154
|
size: PropTypes.oneOf(['s', 'm', 'l', 'full']),
|
|
159
|
-
decorator: PropTypes.oneOfType([PropTypes.array, PropTypes.node])
|
|
155
|
+
decorator: PropTypes.oneOfType([PropTypes.array, PropTypes.node]),
|
|
156
|
+
clearable: PropTypes.bool
|
|
160
157
|
};
|
|
161
158
|
|
|
162
159
|
Input.defaultProps = {
|
|
@@ -175,7 +172,8 @@ Input.defaultProps = {
|
|
|
175
172
|
focus: false,
|
|
176
173
|
layout: 'horizontal',
|
|
177
174
|
requiredFlag: false,
|
|
178
|
-
size: 'l'
|
|
175
|
+
size: 'l',
|
|
176
|
+
clearable: true
|
|
179
177
|
};
|
|
180
178
|
|
|
181
179
|
function getInputType(type, password) {
|
|
@@ -58,6 +58,7 @@ export default function Radio({
|
|
|
58
58
|
*/
|
|
59
59
|
const getChangeHandler = function (value) {
|
|
60
60
|
const onChange = function (e) {
|
|
61
|
+
e.stopPropagation();
|
|
61
62
|
setCheckedItemValue(value);
|
|
62
63
|
events.change({ value }, { originEvent: e });
|
|
63
64
|
};
|
|
@@ -65,7 +66,7 @@ export default function Radio({
|
|
|
65
66
|
};
|
|
66
67
|
|
|
67
68
|
// 现在低码组件往源码组件传入的id不唯一, 暂时使用hashcode替代
|
|
68
|
-
const hashcode = getLocalCounter();
|
|
69
|
+
const hashcode = React.useMemo(() => getLocalCounter(), []);
|
|
69
70
|
let radioElement;
|
|
70
71
|
if(isH5) {
|
|
71
72
|
|
|
@@ -73,12 +74,11 @@ export default function Radio({
|
|
|
73
74
|
const _id = `radio-${hashcode}-${index}`;
|
|
74
75
|
const _name = `radio-${hashcode}-${name}`;
|
|
75
76
|
return (
|
|
76
|
-
|
|
77
|
+
<div
|
|
77
78
|
className={subCls}
|
|
78
|
-
htmlFor={_id}
|
|
79
79
|
key={_id}
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
onClickCapture={getChangeHandler(value)}
|
|
81
|
+
>
|
|
82
82
|
<div className="weui-cell__hd">
|
|
83
83
|
<input
|
|
84
84
|
type="radio"
|
|
@@ -95,7 +95,7 @@ export default function Radio({
|
|
|
95
95
|
<div className="weui-cell__bd">
|
|
96
96
|
<p>{label}</p>
|
|
97
97
|
</div>
|
|
98
|
-
</
|
|
98
|
+
</div>
|
|
99
99
|
);
|
|
100
100
|
});
|
|
101
101
|
} else {
|
|
@@ -104,7 +104,7 @@ export default function Radio({
|
|
|
104
104
|
<TeaRadio.Group
|
|
105
105
|
disabled={disabled}
|
|
106
106
|
value={checkedItemValue}
|
|
107
|
-
onChange={value => getChangeHandler(value)()}
|
|
107
|
+
onChange={(value, {event}) => getChangeHandler(value)(event)}
|
|
108
108
|
>
|
|
109
109
|
{range.map(({value, label}, index) => {
|
|
110
110
|
const _id = `radio-${hashcode}-${index}`;
|
|
@@ -262,7 +262,7 @@ export function decodeIsoDatetime(isoStringOrTimesnap, type) {
|
|
|
262
262
|
|
|
263
263
|
if (
|
|
264
264
|
typeof isoStringOrTimesnap === 'string' &&
|
|
265
|
-
|
|
265
|
+
/^-?[0-9]*$/.test(isoStringOrTimesnap)
|
|
266
266
|
) {
|
|
267
267
|
const timeSnap = Number(isoStringOrTimesnap);
|
|
268
268
|
if (!isNaN(timeSnap)) {
|
|
@@ -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 getLocalCounter from '../../../utils/getLocalCounter';
|
|
|
6
6
|
import {usePlatform} from '../../../utils/platform';
|
|
7
7
|
import {Switch as TeaSwitch} from 'tea-component';
|
|
8
8
|
import { renderDecorator } from '../renderDecorator';
|
|
9
|
+
import { useSyncValue } from '../../../utils/useSyncValue';
|
|
9
10
|
export default function Switch({
|
|
10
11
|
// 系统属性
|
|
11
12
|
id,
|
|
@@ -36,16 +37,9 @@ export default function Switch({
|
|
|
36
37
|
});
|
|
37
38
|
|
|
38
39
|
const platform = usePlatform();
|
|
39
|
-
const [checked, setChecked] = React.useState(defaultChecked);
|
|
40
40
|
// 两次默认值不同时, 需要刷新
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
if (prevDefaultCheckedRef.current !== defaultChecked) {
|
|
44
|
-
prevDefaultCheckedRef.current = defaultChecked;
|
|
45
|
-
setChecked(defaultChecked);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
41
|
+
const [checked, setChecked] = useSyncValue(defaultChecked);
|
|
42
|
+
|
|
49
43
|
const onChange = function (e) {
|
|
50
44
|
setChecked(e.target.checked);
|
|
51
45
|
events.change({ value: e.target.checked }, { originEvent: e });
|
|
@@ -76,6 +70,7 @@ export default function Switch({
|
|
|
76
70
|
(
|
|
77
71
|
<TeaSwitch
|
|
78
72
|
id={_id}
|
|
73
|
+
value={checked}
|
|
79
74
|
disabled={disabled}
|
|
80
75
|
onChange={onChange}
|
|
81
76
|
/>
|
|
@@ -7,6 +7,7 @@ import './index.css';
|
|
|
7
7
|
import { ConfigProvider, Input } from 'tea-component';
|
|
8
8
|
import { usePlatform } from '../../../utils/platform';
|
|
9
9
|
import { renderDecorator } from '../renderDecorator';
|
|
10
|
+
import { useSyncValue } from '../../../utils/useSyncValue';
|
|
10
11
|
|
|
11
12
|
export default function Textarea({
|
|
12
13
|
// 系统属性
|
|
@@ -42,22 +43,13 @@ export default function Textarea({
|
|
|
42
43
|
'weui-cell_disabled': disabled,
|
|
43
44
|
});
|
|
44
45
|
|
|
45
|
-
const [value, setValue] = React.useState(defaultValue);
|
|
46
|
-
const [counter, setCounter] = React.useState(defaultValue?.length || 0);
|
|
47
46
|
// 两次默认值不同时, 需要刷新value
|
|
48
|
-
const
|
|
49
|
-
React.
|
|
50
|
-
|
|
51
|
-
prevDefaultValueRef.current = defaultValue;
|
|
52
|
-
setValue(defaultValue);
|
|
53
|
-
setCounter(defaultValue?.length || 0);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
47
|
+
const [value, setValue] = useSyncValue(defaultValue);
|
|
48
|
+
const counter = React.useMemo(() => (value?.length || 0), [value]);
|
|
49
|
+
|
|
57
50
|
const onChange = function (e) {
|
|
58
51
|
const text = typeof e === 'string' ? e : e.target.value;
|
|
59
52
|
setValue(text);
|
|
60
|
-
setCounter(text.length || 0);
|
|
61
53
|
events.change({ value: text });
|
|
62
54
|
};
|
|
63
55
|
|
|
@@ -67,3 +67,18 @@
|
|
|
67
67
|
align-items: center;
|
|
68
68
|
background-color: rgba(0, 0, 0, 0.6);
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
.weui-uploader.horizontal {
|
|
72
|
+
display: flex;
|
|
73
|
+
}
|
|
74
|
+
.weui-uploader.horizontal .weui-uploader__hd {
|
|
75
|
+
display: inline-block;
|
|
76
|
+
align-self: center;
|
|
77
|
+
}
|
|
78
|
+
.weda-uploader-pc.horizontal {
|
|
79
|
+
display: flex;
|
|
80
|
+
justify-content: space-between;
|
|
81
|
+
}
|
|
82
|
+
.weui-uploader.horizontal .weui-uploader__bd {
|
|
83
|
+
padding-left: 2.28571rem;
|
|
84
|
+
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import * as PropTypes from 'prop-types';
|
|
4
4
|
import { usePlatform } from '../../../utils/platform';
|
|
5
|
-
import { UploaderH5 } from './
|
|
5
|
+
import { ImageUploaderH5 as UploaderH5 } from './uploader.h5';
|
|
6
6
|
import classNames from '../../../utils/classnames';
|
|
7
|
-
import { UploaderPCInner, CLASS_PREFIX } from './
|
|
7
|
+
import { UploaderPCInner, CLASS_PREFIX } from './uploader.pc';
|
|
8
8
|
|
|
9
9
|
import './index.css';
|
|
10
10
|
import { renderDecorator } from '../renderDecorator';
|