@cloudbase/weda-ui 0.2.6 → 0.2.10

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 (158) hide show
  1. package/package.json +3 -4
  2. package/src/configs/components/container.json +2 -1
  3. package/src/configs/components/form/input.json +6 -0
  4. package/src/configs/components/form/richText.json +2 -1
  5. package/src/configs/components/form/uploader.json +4 -5
  6. package/src/configs/components/image.json +2 -1
  7. package/src/configs/components/link.json +2 -1
  8. package/src/configs/components/richtextview.json +2 -1
  9. package/src/configs/components/scrollVeiw.json +2 -1
  10. package/src/configs/components/swiper.json +2 -1
  11. package/src/configs/components/tabs.json +31 -86
  12. package/src/configs/components/text.json +2 -1
  13. package/src/configs/index.js +4 -7
  14. package/src/mp/components/form/input/index.js +5 -1
  15. package/src/mp/components/form/input/index.wxml +2 -1
  16. package/src/mp/components/form/select/index.js +2 -2
  17. package/src/mp/components/form/textarea/index.wxml +1 -0
  18. package/src/mp/components/form/uploader/index.js +48 -14
  19. package/src/mp/components/form/uploader/index.wxml +9 -2
  20. package/src/mp/components/image/index.js +57 -8
  21. package/src/mp/components/image/index.json +4 -1
  22. package/src/mp/components/image/index.wxml +4 -2
  23. package/src/mp/components/image/index.wxss +14 -0
  24. package/src/mp/components/richText/index.wxml +1 -1
  25. package/src/mp/components/tabs/index.js +14 -1
  26. package/src/mp/utils/deepEqual.js +42 -0
  27. package/src/web/components/form/enumSelect/MultipleSelect.jsx +94 -0
  28. package/src/web/components/form/enumSelect/NormalSelect.jsx +105 -0
  29. package/src/web/components/form/enumSelect/SelectContainer.jsx +43 -0
  30. package/src/web/components/form/enumSelect/hooks/index.js +49 -0
  31. package/src/web/components/form/enumSelect/index.jsx +9 -0
  32. package/src/web/components/form/enumSelect/props/defaultProps.js +39 -0
  33. package/src/web/components/form/enumSelect/props/propsTypes.js +50 -0
  34. package/src/web/components/form/input/index.jsx +14 -10
  35. package/src/web/components/form/radio/index.jsx +1 -1
  36. package/src/web/components/form/select/h5.jsx +1 -1
  37. package/src/web/components/form/select/region/{cities.json → cities.js} +2 -2
  38. package/src/web/components/form/select/region/index.js +3 -3
  39. package/src/web/components/form/select/region/{provinces.json → provinces.js} +2 -2
  40. package/src/web/components/form/select/region/{regions.json → regions.js} +2 -2
  41. package/src/web/components/form/switch/index.jsx +1 -0
  42. package/src/web/components/form/uploader/index.css +15 -0
  43. package/src/web/components/form/uploader/index.jsx +2 -2
  44. package/src/web/components/form/uploader/uploader.h5.jsx +237 -0
  45. package/src/web/components/form/uploader/{uploaderPc.jsx → uploader.pc.jsx} +69 -59
  46. package/src/web/components/image/image.jsx +79 -5
  47. package/src/web/components/image/index.css +17 -0
  48. package/src/web/components/image/index.jsx +1 -0
  49. package/src/web/components/index.js +1 -1
  50. package/src/web/components/link/test/__snapshots__/storybook.test.js.snap +754 -0
  51. package/src/web/components/modal/index.jsx +3 -2
  52. package/src/web/components/richTextView/index.css +0 -10
  53. package/src/web/components/richTextView/index.jsx +1 -12
  54. package/src/web/components/tabs/index.jsx +3 -3
  55. package/src/web/components/tabs/{tabsH5.jsx → tabs.h5.jsx} +9 -47
  56. package/src/web/components/tabs/{tabsPc.jsx → tabs.pc.jsx} +13 -47
  57. package/src/web/components/uploaderView/index.jsx +1 -1
  58. package/src/web/utils/tcb.js +8 -0
  59. package/CHANGELOG.md +0 -240
  60. package/src/.DS_Store +0 -0
  61. package/src/configs/components/markdown.json +0 -17
  62. package/src/mp/.gitignore +0 -10
  63. package/src/mp/components/markdown/index.js +0 -27
  64. package/src/mp/components/markdown/index.json +0 -6
  65. package/src/mp/components/markdown/index.wxml +0 -1
  66. package/src/mp/components/markdown/towxml/audio-player/Audio.js +0 -99
  67. package/src/mp/components/markdown/towxml/audio-player/audio-player.js +0 -102
  68. package/src/mp/components/markdown/towxml/audio-player/audio-player.json +0 -5
  69. package/src/mp/components/markdown/towxml/audio-player/audio-player.wxml +0 -14
  70. package/src/mp/components/markdown/towxml/audio-player/audio-player.wxss +0 -175
  71. package/src/mp/components/markdown/towxml/audio-player/loading.svg +0 -1
  72. package/src/mp/components/markdown/towxml/config.js +0 -285
  73. package/src/mp/components/markdown/towxml/decode.js +0 -26
  74. package/src/mp/components/markdown/towxml/decode.json +0 -12
  75. package/src/mp/components/markdown/towxml/decode.wxml +0 -1
  76. package/src/mp/components/markdown/towxml/decode.wxss +0 -0
  77. package/src/mp/components/markdown/towxml/img/img.js +0 -98
  78. package/src/mp/components/markdown/towxml/img/img.json +0 -3
  79. package/src/mp/components/markdown/towxml/img/img.wxml +0 -1
  80. package/src/mp/components/markdown/towxml/img/img.wxss +0 -0
  81. package/src/mp/components/markdown/towxml/index.js +0 -19
  82. package/src/mp/components/markdown/towxml/latex/latex.js +0 -53
  83. package/src/mp/components/markdown/towxml/latex/latex.json +0 -5
  84. package/src/mp/components/markdown/towxml/latex/latex.wxml +0 -1
  85. package/src/mp/components/markdown/towxml/latex/latex.wxss +0 -0
  86. package/src/mp/components/markdown/towxml/parse/highlight/highlight.js +0 -729
  87. package/src/mp/components/markdown/towxml/parse/highlight/index.js +0 -7
  88. package/src/mp/components/markdown/towxml/parse/highlight/languages/bash.js +0 -91
  89. package/src/mp/components/markdown/towxml/parse/highlight/languages/c-like.js +0 -244
  90. package/src/mp/components/markdown/towxml/parse/highlight/languages/c.js +0 -20
  91. package/src/mp/components/markdown/towxml/parse/highlight/languages/css.js +0 -138
  92. package/src/mp/components/markdown/towxml/parse/highlight/languages/dart.js +0 -135
  93. package/src/mp/components/markdown/towxml/parse/highlight/languages/go.js +0 -57
  94. package/src/mp/components/markdown/towxml/parse/highlight/languages/htmlbars.js +0 -79
  95. package/src/mp/components/markdown/towxml/parse/highlight/languages/java.js +0 -126
  96. package/src/mp/components/markdown/towxml/parse/highlight/languages/javascript.js +0 -263
  97. package/src/mp/components/markdown/towxml/parse/highlight/languages/json.js +0 -51
  98. package/src/mp/components/markdown/towxml/parse/highlight/languages/less.js +0 -177
  99. package/src/mp/components/markdown/towxml/parse/highlight/languages/nginx.js +0 -103
  100. package/src/mp/components/markdown/towxml/parse/highlight/languages/php.js +0 -152
  101. package/src/mp/components/markdown/towxml/parse/highlight/languages/python-repl.js +0 -27
  102. package/src/mp/components/markdown/towxml/parse/highlight/languages/python.js +0 -146
  103. package/src/mp/components/markdown/towxml/parse/highlight/languages/scss.js +0 -137
  104. package/src/mp/components/markdown/towxml/parse/highlight/languages/shell.js +0 -23
  105. package/src/mp/components/markdown/towxml/parse/highlight/languages/typescript.js +0 -198
  106. package/src/mp/components/markdown/towxml/parse/highlight/languages/xml.js +0 -143
  107. package/src/mp/components/markdown/towxml/parse/highlight/style/github.wxss +0 -99
  108. package/src/mp/components/markdown/towxml/parse/highlight/style/monokai.wxss +0 -70
  109. package/src/mp/components/markdown/towxml/parse/index.js +0 -106
  110. package/src/mp/components/markdown/towxml/parse/markdown/index.js +0 -53
  111. package/src/mp/components/markdown/towxml/parse/markdown/markdown.js +0 -5834
  112. package/src/mp/components/markdown/towxml/parse/markdown/plugins/emoji.js +0 -1773
  113. package/src/mp/components/markdown/towxml/parse/markdown/plugins/ins.js +0 -120
  114. package/src/mp/components/markdown/towxml/parse/markdown/plugins/latex.js +0 -193
  115. package/src/mp/components/markdown/towxml/parse/markdown/plugins/mark.js +0 -120
  116. package/src/mp/components/markdown/towxml/parse/markdown/plugins/sub.js +0 -95
  117. package/src/mp/components/markdown/towxml/parse/markdown/plugins/sup.js +0 -95
  118. package/src/mp/components/markdown/towxml/parse/markdown/plugins/todo.js +0 -220
  119. package/src/mp/components/markdown/towxml/parse/markdown/plugins/yuml.js +0 -18
  120. package/src/mp/components/markdown/towxml/parse/parse2/Parser.js +0 -263
  121. package/src/mp/components/markdown/towxml/parse/parse2/Tokenizer.js +0 -507
  122. package/src/mp/components/markdown/towxml/parse/parse2/domhandler/index.js +0 -104
  123. package/src/mp/components/markdown/towxml/parse/parse2/domhandler/node.js +0 -169
  124. package/src/mp/components/markdown/towxml/parse/parse2/entities/decode.js +0 -54
  125. package/src/mp/components/markdown/towxml/parse/parse2/entities/decode_codepoint.js +0 -19
  126. package/src/mp/components/markdown/towxml/parse/parse2/entities/encode.js +0 -54
  127. package/src/mp/components/markdown/towxml/parse/parse2/entities/index.js +0 -30
  128. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/decode.js +0 -31
  129. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/entities.js +0 -2128
  130. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/legacy.js +0 -109
  131. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/xml.js +0 -2
  132. package/src/mp/components/markdown/towxml/parse/parse2/index.js +0 -8
  133. package/src/mp/components/markdown/towxml/style/main.wxss +0 -378
  134. package/src/mp/components/markdown/towxml/style/theme/dark.wxss +0 -73
  135. package/src/mp/components/markdown/towxml/style/theme/light.wxss +0 -63
  136. package/src/mp/components/markdown/towxml/table/table.js +0 -11
  137. package/src/mp/components/markdown/towxml/table/table.json +0 -6
  138. package/src/mp/components/markdown/towxml/table/table.wxml +0 -24
  139. package/src/mp/components/markdown/towxml/table/table.wxss +0 -0
  140. package/src/mp/components/markdown/towxml/todogroup/todogroup.js +0 -19
  141. package/src/mp/components/markdown/towxml/todogroup/todogroup.json +0 -6
  142. package/src/mp/components/markdown/towxml/todogroup/todogroup.wxml +0 -13
  143. package/src/mp/components/markdown/towxml/todogroup/todogroup.wxss +0 -3
  144. package/src/mp/components/markdown/towxml/towxml.js +0 -17
  145. package/src/mp/components/markdown/towxml/towxml.json +0 -6
  146. package/src/mp/components/markdown/towxml/towxml.wxml +0 -5
  147. package/src/mp/components/markdown/towxml/towxml.wxss +0 -8
  148. package/src/mp/components/markdown/towxml/yuml/yuml.js +0 -51
  149. package/src/mp/components/markdown/towxml/yuml/yuml.json +0 -5
  150. package/src/mp/components/markdown/towxml/yuml/yuml.wxml +0 -5
  151. package/src/mp/components/markdown/towxml/yuml/yuml.wxss +0 -0
  152. package/src/web/.DS_Store +0 -0
  153. package/src/web/components/form/uploader/uploaderH5.jsx +0 -208
  154. package/src/web/components/markdown/index.jsx +0 -40
  155. package/src/web/wedatheme/.git +0 -1
  156. package/src/web/wedatheme/.gitignore +0 -5
  157. package/src/web/wedatheme/.npmrc +0 -1
  158. package/src/web/wedatheme/package-lock.json +0 -14335
@@ -1,3 +1,3 @@
1
- <view class="weda-ui {{className}}" style="{{style ? style : 'width:100%; height:100%'}}">
1
+ <view class="weda-ui {{className}}" style="{{style}}">
2
2
  <rich-text nodes="{{__html}}"></rich-text>
3
3
  </view>
@@ -12,6 +12,10 @@ Component({
12
12
  type: String,
13
13
  value: '',
14
14
  },
15
+ selectedIndex: {
16
+ type: Number,
17
+ value: 0
18
+ }
15
19
  },
16
20
 
17
21
  data: {
@@ -26,7 +30,7 @@ Component({
26
30
  this.setData({
27
31
  currentIndex: index,
28
32
  });
29
-
33
+ this.triggerEvent('change', {id: index, label: tabs[index].title});
30
34
  if (tabs.length > 5) {
31
35
  this.setData({
32
36
  scrollCellId: `cell-${Math.max(index - 2, 0)}`,
@@ -34,4 +38,13 @@ Component({
34
38
  }
35
39
  },
36
40
  },
41
+ observers: {
42
+ 'selectedIndex': function(selectedIndex) {
43
+ if(selectedIndex !== this.data.currentIndex) {
44
+ this.setData({
45
+ currentIndex: selectedIndex
46
+ });
47
+ }
48
+ }
49
+ }
37
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;
@@ -0,0 +1,94 @@
1
+ import * as React from 'react';
2
+ import { SelectMultiple } from 'tea-component';
3
+
4
+ import SelectContainer from './SelectContainer';
5
+
6
+ import { normalProps } from './props/defaultProps';
7
+ import { propTypes } from './props/propsTypes';
8
+ import useOptions from './hooks';
9
+
10
+ const MultipleSelect = ({
11
+ // 系统属性
12
+ id,
13
+ style,
14
+ className,
15
+ events,
16
+ // weda 组件属性
17
+ label,
18
+ labelVisible,
19
+ layout,
20
+ requiredFlag,
21
+ decorator,
22
+ // tea组件属性
23
+ value,
24
+ placeholder,
25
+ disabled,
26
+ onChange,
27
+ clearable,
28
+ appearance,
29
+ allOption,
30
+ matchButtonWidth,
31
+ virtual,
32
+ searchable,
33
+ size,
34
+ // 业务属性
35
+ enumType,
36
+ customEnum,
37
+ optionId,
38
+ isModelApp,
39
+ }) => {
40
+ const options = useOptions({ enumType, optionId, customEnum });
41
+
42
+ const onSelectChange = (values) => {
43
+ // @ts-ignore
44
+ events.change && events.change({ value: values });
45
+ if (onChange) {
46
+ onChange(values);
47
+ }
48
+ };
49
+
50
+ const multipleSelectProps = {
51
+ placeholder,
52
+ disabled,
53
+ clearable,
54
+ appearance,
55
+ key: id,
56
+ options,
57
+ onChange: onSelectChange,
58
+ matchButtonWidth,
59
+ searchable,
60
+ size,
61
+ defaultValue: value || [],
62
+ allOption,
63
+ staging: false,
64
+ virtual,
65
+ };
66
+
67
+ if (isModelApp) {
68
+ return <SelectMultiple {...multipleSelectProps} />;
69
+ }
70
+ return (
71
+ <SelectContainer
72
+ style={style}
73
+ className={className}
74
+ label={label}
75
+ labelVisible={labelVisible}
76
+ layout={layout}
77
+ // @ts-ignore
78
+ multiCell={false}
79
+ requiredFlag={requiredFlag}
80
+ decorator={decorator}
81
+ id={id}
82
+ >
83
+ <SelectMultiple {...multipleSelectProps} />
84
+ </SelectContainer>
85
+ );
86
+ };
87
+ MultipleSelect.propTypes = {
88
+ ...propTypes,
89
+ };
90
+ MultipleSelect.defaultProps = {
91
+ ...normalProps,
92
+ };
93
+
94
+ export default MultipleSelect;
@@ -0,0 +1,105 @@
1
+ import * as React from 'react';
2
+ import { Select } from 'tea-component';
3
+
4
+ import SelectContainer from './SelectContainer';
5
+
6
+ import { multipleProps } from './props/defaultProps';
7
+ import { propTypes } from './props/propsTypes';
8
+ import useOptions from './hooks';
9
+
10
+ const { useState, useEffect } = React;
11
+
12
+ const useValue = (value) => {
13
+ const [selectedValue, setSelectedValue] = useState('');
14
+
15
+ useEffect(() => {
16
+ setSelectedValue(value);
17
+ }, [value]);
18
+
19
+ return [selectedValue, setSelectedValue];
20
+ };
21
+
22
+ const NormalSelect = ({
23
+ // 系统属性
24
+ id,
25
+ style,
26
+ className,
27
+ events,
28
+ // weda 组件属性
29
+ label,
30
+ labelVisible,
31
+ layout,
32
+ requiredFlag,
33
+ decorator,
34
+ // tea组件属性
35
+ value,
36
+ placeholder,
37
+ disabled,
38
+ onChange,
39
+ clearable,
40
+ appearance,
41
+ matchButtonWidth,
42
+ virtual,
43
+ searchable,
44
+ size,
45
+ // 业务属性
46
+ enumType,
47
+ customEnum,
48
+ optionId,
49
+ isModelApp,
50
+ }) => {
51
+ const options = useOptions({ enumType, optionId, customEnum });
52
+ const [selectedValue, setSelectedValue] = useValue(value);
53
+
54
+ const onSelectChange = (value) => {
55
+ // @ts-ignore
56
+ setSelectedValue(value);
57
+ events.change && events.change({ value });
58
+ if (onChange) {
59
+ onChange(value || '');
60
+ }
61
+ };
62
+
63
+ const singleSelectProps = {
64
+ placeholder,
65
+ disabled,
66
+ clearable,
67
+ appearance,
68
+ key: id,
69
+ options,
70
+ onChange: onSelectChange,
71
+ value: selectedValue,
72
+ matchButtonWidth,
73
+ virtual,
74
+ searchable,
75
+ size,
76
+ };
77
+
78
+ if (isModelApp) {
79
+ return <Select {...singleSelectProps} />;
80
+ }
81
+ return (
82
+ <SelectContainer
83
+ style={style}
84
+ className={className}
85
+ label={label}
86
+ labelVisible={labelVisible}
87
+ layout={layout}
88
+ // @ts-ignore
89
+ multiCell={false}
90
+ requiredFlag={requiredFlag}
91
+ decorator={decorator}
92
+ id={id}
93
+ >
94
+ <Select {...singleSelectProps} />
95
+ </SelectContainer>
96
+ );
97
+ };
98
+ NormalSelect.propTypes = {
99
+ ...propTypes,
100
+ };
101
+ NormalSelect.defaultProps = {
102
+ ...multipleProps,
103
+ };
104
+
105
+ export default NormalSelect;
@@ -0,0 +1,43 @@
1
+ import * as React from 'react';
2
+ import classNames from '../../../utils/classnames';
3
+ import { selectContainerPropsTypes } from './props/propsTypes';
4
+ import { renderDecorator } from '../renderDecorator';
5
+
6
+ const SelectContainer = ({
7
+ style,
8
+ className,
9
+ // weda 组件属性
10
+ id,
11
+ label,
12
+ labelVisible,
13
+ layout,
14
+ requiredFlag,
15
+ decorator,
16
+ children,
17
+ }) => {
18
+ const cls = classNames({
19
+ 'weda-ui': true,
20
+ [className]: className,
21
+ });
22
+ const subCls = classNames({
23
+ 'weui-cell': true,
24
+ 'weui-cell_active': true,
25
+ 'weui-cell_form': true,
26
+ 'weui-cell_disabled': true,
27
+ });
28
+ const SelectComponent = <div className={subCls}>{children}</div>;
29
+ return renderDecorator(
30
+ SelectComponent,
31
+ decorator
32
+ )({
33
+ id,
34
+ className: cls,
35
+ style,
36
+ label: labelVisible ? label : null,
37
+ layout,
38
+ multiCell: false,
39
+ requiredFlag,
40
+ });
41
+ };
42
+ SelectContainer.propTypes = selectContainerPropsTypes;
43
+ export default SelectContainer;
@@ -0,0 +1,49 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { getDescribeGeneralOptionsDetailList } from '../../../../utils/tcb';
3
+
4
+ const GENERAL_OPTION = 'general-option';
5
+ const CUSTOM = 'custom';
6
+
7
+ const handleOptionsDetailList = (response) => {
8
+ const config = response?.Data?.Config ?? '[]';
9
+ return JSON.parse(config)?.map((item) => ({
10
+ value: item?.key,
11
+ text: item?.value,
12
+ }));
13
+ };
14
+
15
+ export default function useOptions({ enumType, optionId, customEnum }) {
16
+ const [options, setOptions] = useState([]);
17
+ const isCustom = enumType === CUSTOM;
18
+ const isGeneralOption = enumType === GENERAL_OPTION;
19
+
20
+ const getOptionsDetailList = async (optionId) => {
21
+ try {
22
+ const response = await getDescribeGeneralOptionsDetailList({
23
+ methodName: 'callDesignApi',
24
+ params: {
25
+ action: 'DescribeGeneralOptionsDetail',
26
+ data: {
27
+ Id: optionId,
28
+ },
29
+ },
30
+ });
31
+ const options = handleOptionsDetailList(response);
32
+ setOptions(options);
33
+ } catch (error) {
34
+ setOptions([]);
35
+ }
36
+ };
37
+
38
+ useEffect(() => {
39
+ if (optionId && isGeneralOption) {
40
+ getOptionsDetailList(optionId);
41
+ }
42
+ }, [optionId, isGeneralOption]);
43
+
44
+ useEffect(() => {
45
+ setOptions(customEnum);
46
+ }, [isCustom]);
47
+
48
+ return options;
49
+ }
@@ -0,0 +1,9 @@
1
+ import MultipleSelect from './MultipleSelect';
2
+ import NormalSelect from './NormalSelect';
3
+
4
+ const EnumSelect = NormalSelect;
5
+
6
+ // @ts-ignore
7
+ EnumSelect.MultipleSelect = MultipleSelect;
8
+
9
+ export default EnumSelect;
@@ -0,0 +1,39 @@
1
+ const commonProps = {
2
+ // 系统属性
3
+ events: {},
4
+ // weda 组件属性
5
+ label: '标题',
6
+ labelVisible: true,
7
+ layout: 'horizontal',
8
+ requiredFlag: false,
9
+ // tea组件属性
10
+ name: 'enumSelect',
11
+ placeholder: '请选择',
12
+ disabled: false,
13
+ onChange: () => {},
14
+ options: [],
15
+ clearable: true,
16
+ appearance: 'button',
17
+ matchButtonWidth: true,
18
+ virtual: true,
19
+ searchable: true,
20
+ size: 'm',
21
+ // 业务属性
22
+ enumType: '',
23
+ customEnum: [],
24
+ optionId: null,
25
+ isModelApp: false,
26
+ };
27
+ export const normalProps = {
28
+ ...commonProps,
29
+ value: '',
30
+ };
31
+ export const multipleProps = {
32
+ ...commonProps,
33
+ value: [],
34
+ allOption: {
35
+ value: 'all',
36
+ text: '全选',
37
+ tooltip: '全选',
38
+ },
39
+ };
@@ -0,0 +1,50 @@
1
+ import * as PropTypes from 'prop-types';
2
+
3
+ const commonPropsTypes = {
4
+ // 系统属性
5
+ id: PropTypes.string,
6
+ style: PropTypes.string,
7
+ className: PropTypes.string,
8
+ // weda 组件属性
9
+ label: PropTypes.string,
10
+ labelVisible: PropTypes.bool,
11
+ layout: PropTypes.string,
12
+ requiredFlag: PropTypes.bool,
13
+ };
14
+ export const propTypes = {
15
+ ...commonPropsTypes,
16
+ // 系统属性
17
+ events: PropTypes.object,
18
+ // tea组件属性
19
+ defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
20
+ name: PropTypes.string,
21
+ placeholder: PropTypes.string,
22
+ disabled: PropTypes.bool,
23
+ onChange: PropTypes.func,
24
+ options: PropTypes.array,
25
+ clearable: PropTypes.bool,
26
+ appearance: PropTypes.string,
27
+ allOption: PropTypes.object,
28
+ matchButtonWidth: PropTypes.bool,
29
+ virtual: PropTypes.bool,
30
+ searchable: PropTypes.bool,
31
+ size: PropTypes.string,
32
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
33
+ // 业务属性
34
+ enumType: PropTypes.string,
35
+ customEnum: PropTypes.array,
36
+ optionId: PropTypes.string,
37
+ isModelApp: PropTypes.bool,
38
+ };
39
+
40
+ export const formContainerPropsTypes = {
41
+ ...commonPropsTypes,
42
+ children: PropTypes.element,
43
+ decorator: PropTypes.element,
44
+ };
45
+
46
+ export const selectContainerPropsTypes = {
47
+ ...commonPropsTypes,
48
+ children: PropTypes.element,
49
+ decorator: PropTypes.element,
50
+ };
@@ -2,7 +2,6 @@ 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';
@@ -27,7 +26,8 @@ export default function Input({
27
26
  layout,
28
27
  requiredFlag,
29
28
  size,
30
- decorator
29
+ decorator,
30
+ clearable
31
31
  }) {
32
32
  const platform = usePlatform();
33
33
  const cls = classNames({
@@ -96,12 +96,14 @@ const fieldEl = platform === 'h5' ? <div className={subCls}>
96
96
  onBlur={onBlur}
97
97
  onKeyDown={onKeyDown}
98
98
  />
99
- <button
100
- className="weui-btn_reset weui-btn_icon weui-btn_input-clear"
101
- onMouseDown={onClear}
102
- >
103
- <i className="weui-icon-clear"></i>
104
- </button>
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
+ }
105
107
  </div>
106
108
  </div> : <TeaInput
107
109
  size={size}
@@ -150,7 +152,8 @@ Input.propTypes = {
150
152
  layout: PropTypes.oneOf(['horizontal', 'vertical']),
151
153
  requiredFlag: PropTypes.bool,
152
154
  size: PropTypes.oneOf(['s', 'm', 'l', 'full']),
153
- decorator: PropTypes.oneOfType([PropTypes.array, PropTypes.node])
155
+ decorator: PropTypes.oneOfType([PropTypes.array, PropTypes.node]),
156
+ clearable: PropTypes.bool
154
157
  };
155
158
 
156
159
  Input.defaultProps = {
@@ -169,7 +172,8 @@ Input.defaultProps = {
169
172
  focus: false,
170
173
  layout: 'horizontal',
171
174
  requiredFlag: false,
172
- size: 'l'
175
+ size: 'l',
176
+ clearable: true
173
177
  };
174
178
 
175
179
  function getInputType(type, password) {
@@ -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
- /^[0-9]*$/.test(isoStringOrTimesnap)
265
+ /^-?[0-9]*$/.test(isoStringOrTimesnap)
266
266
  ) {
267
267
  const timeSnap = Number(isoStringOrTimesnap);
268
268
  if (!isNaN(timeSnap)) {
@@ -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
  />
@@ -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 './uploaderH5';
5
+ import { ImageUploaderH5 as UploaderH5 } from './uploader.h5';
6
6
  import classNames from '../../../utils/classnames';
7
- import { UploaderPCInner, CLASS_PREFIX } from './uploaderPc';
7
+ import { UploaderPCInner, CLASS_PREFIX } from './uploader.pc';
8
8
 
9
9
  import './index.css';
10
10
  import { renderDecorator } from '../renderDecorator';