@cloudbase/weda-ui 0.2.17 → 2.0.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 (269) hide show
  1. package/README.md +3 -0
  2. package/package.json +10 -5
  3. package/src/configs/components/button.json +0 -2
  4. package/src/configs/components/calendar.json +9 -3
  5. package/src/configs/components/carousel.json +18 -9
  6. package/src/configs/components/chart/bar.json +31 -12
  7. package/src/configs/components/chart/line.json +27 -10
  8. package/src/configs/components/chart/pie.json +22 -8
  9. package/src/configs/components/chart/statisticsCard.json +61 -13
  10. package/src/configs/components/container.json +7 -2
  11. package/src/configs/components/dataView.json +31 -11
  12. package/src/configs/components/form/checkbox.json +97 -5
  13. package/src/configs/components/form/radio.json +123 -4
  14. package/src/configs/components/form/select.json +247 -13
  15. package/src/configs/components/graphicCard.json +90 -75
  16. package/src/configs/components/image.json +19 -8
  17. package/src/configs/components/link.json +25 -6
  18. package/src/configs/components/listView.json +83 -27
  19. package/src/configs/components/lottery.json +153 -0
  20. package/src/configs/components/modal.json +37 -5
  21. package/src/configs/components/navLayout.json +97 -79
  22. package/src/configs/components/navigationBar.json +59 -0
  23. package/src/configs/components/richtextview.json +6 -2
  24. package/src/configs/components/scrollVeiw.json +98 -34
  25. package/src/configs/components/swiper.json +22 -10
  26. package/src/configs/components/tabs.json +54 -9
  27. package/src/configs/components/text.json +43 -30
  28. package/src/configs/components/wxOpenApi/phone.json +141 -0
  29. package/src/configs/components/wxOpenApi/phoneCode.json +121 -0
  30. package/src/configs/components/wxOpenApi/share.json +167 -0
  31. package/src/configs/components/wxOpenApi/userInfo.json +174 -0
  32. package/src/configs/index.js +13 -0
  33. package/src/docs/common/format.tsx +112 -0
  34. package/src/docs/common/tableView.css +164 -0
  35. package/src/docs/common/tableView.tsx +273 -0
  36. package/src/docs/compsdocs/chart/Bar.mdx +159 -0
  37. package/src/docs/compsdocs/chart/Line.mdx +100 -0
  38. package/src/docs/compsdocs/chart/Pie.mdx +83 -0
  39. package/src/docs/compsdocs/chart/_category_.json +1 -0
  40. package/src/docs/compsdocs/chart/statisticsCard.mdx +51 -0
  41. package/src/docs/compsdocs/database/DataView.mdx +33 -0
  42. package/src/docs/compsdocs/database/ListView.mdx +33 -0
  43. package/src/docs/compsdocs/database/_category_.json +1 -0
  44. package/src/docs/compsdocs/form/Form.mdx +35 -0
  45. package/src/docs/compsdocs/form/FormCheckbox.mdx +35 -0
  46. package/src/docs/compsdocs/form/FormDate.mdx +30 -0
  47. package/src/docs/compsdocs/form/FormEmail.mdx +30 -0
  48. package/src/docs/compsdocs/form/FormImageUploader.mdx +31 -0
  49. package/src/docs/compsdocs/form/FormInput.mdx +30 -0
  50. package/src/docs/compsdocs/form/FormLocation.mdx +64 -0
  51. package/src/docs/compsdocs/form/FormPhone.mdx +30 -0
  52. package/src/docs/compsdocs/form/FormRadio.mdx +35 -0
  53. package/src/docs/compsdocs/form/FormRegion.mdx +30 -0
  54. package/src/docs/compsdocs/form/FormSelect.mdx +36 -0
  55. package/src/docs/compsdocs/form/FormSwitch.mdx +30 -0
  56. package/src/docs/compsdocs/form/FormTextarea.mdx +30 -0
  57. package/src/docs/compsdocs/form/FormTime.mdx +30 -0
  58. package/src/docs/compsdocs/form/FormUploadFile.mdx +30 -0
  59. package/src/docs/compsdocs/form/FormUrl.mdx +30 -0
  60. package/src/docs/compsdocs/form/_category_.json +1 -0
  61. package/src/docs/compsdocs/grid/Card.mdx +32 -0
  62. package/src/docs/compsdocs/grid/Container.mdx +42 -0
  63. package/src/docs/compsdocs/grid/Footer.mdx +31 -0
  64. package/src/docs/compsdocs/grid/GridLayout.mdx +32 -0
  65. package/src/docs/compsdocs/grid/Header.mdx +31 -0
  66. package/src/docs/compsdocs/grid/Layout.mdx +25 -0
  67. package/src/docs/compsdocs/grid/List.mdx +31 -0
  68. package/src/docs/compsdocs/grid/ScrollView.mdx +37 -0
  69. package/src/docs/compsdocs/grid/Swiper.mdx +58 -0
  70. package/src/docs/compsdocs/grid/_category_.json +1 -0
  71. package/src/docs/compsdocs/media/Icon.mdx +31 -0
  72. package/src/docs/compsdocs/media/Image.mdx +55 -0
  73. package/src/docs/compsdocs/media/_category_.json +1 -0
  74. package/src/docs/compsdocs/model/ModelCreate.mdx +20 -0
  75. package/src/docs/compsdocs/model/ModelDetail.mdx +20 -0
  76. package/src/docs/compsdocs/model/ModelTable.mdx +24 -0
  77. package/src/docs/compsdocs/model/ModelUpdate.mdx +21 -0
  78. package/src/docs/compsdocs/model/PageLayout.mdx +21 -0
  79. package/src/docs/compsdocs/model/_category_.json +1 -0
  80. package/src/docs/compsdocs/navmenu/Classification.mdx +38 -0
  81. package/src/docs/compsdocs/navmenu/NavBar.mdx +43 -0
  82. package/src/docs/compsdocs/navmenu/NavLayout.mdx +30 -0
  83. package/src/docs/compsdocs/navmenu/TabBar.mdx +43 -0
  84. package/src/docs/compsdocs/navmenu/TabBarItem.mdx +29 -0
  85. package/src/docs/compsdocs/navmenu/_category_.json +1 -0
  86. package/src/docs/compsdocs/senior/Lottery.mdx +48 -0
  87. package/src/docs/compsdocs/senior/Modal.mdx +58 -0
  88. package/src/docs/compsdocs/senior/SlotMachine.mdx +52 -0
  89. package/src/docs/compsdocs/senior/_category_.json +1 -0
  90. package/src/docs/compsdocs/show/Calendar.mdx +29 -0
  91. package/src/docs/compsdocs/show/Divider.mdx +31 -0
  92. package/src/docs/compsdocs/show/GraphicCard.mdx +30 -0
  93. package/src/docs/compsdocs/show/Item.mdx +32 -0
  94. package/src/docs/compsdocs/show/ItemList.mdx +47 -0
  95. package/src/docs/compsdocs/show/Media.mdx +25 -0
  96. package/src/docs/compsdocs/show/StatusTip.mdx +25 -0
  97. package/src/docs/compsdocs/show/Swiper.mdx +33 -0
  98. package/src/docs/compsdocs/show/Tabs.mdx +38 -0
  99. package/src/docs/compsdocs/show/_category_.json +1 -0
  100. package/src/docs/compsdocs/show/button.mdx +25 -0
  101. package/src/docs/compsdocs/text/Link.mdx +43 -0
  102. package/src/docs/compsdocs/text/RichTextView.mdx +36 -0
  103. package/src/docs/compsdocs/text/Text.mdx +31 -0
  104. package/src/docs/compsdocs/text/Title.mdx +32 -0
  105. package/src/docs/compsdocs/text/_category_.json +1 -0
  106. package/src/docs/compsdocs/wxOpen/Phone.mdx +60 -0
  107. package/src/docs/compsdocs/wxOpen/Share.mdx +46 -0
  108. package/src/docs/compsdocs/wxOpen/UserInfo.mdx +60 -0
  109. package/src/docs/compsdocs/wxOpen/_category_.json +4 -0
  110. package/src/index.js +2 -0
  111. package/src/mp/components/button/index.js +18 -2
  112. package/src/mp/components/button/index.wxml +7 -4
  113. package/src/mp/components/chart/bar/index.js +6 -2
  114. package/src/mp/components/chart/common/core/eChartBar.js +9 -8
  115. package/src/mp/components/chart/common/core/eChartBase.js +20 -16
  116. package/src/mp/components/chart/common/core/eChartLine.js +6 -5
  117. package/src/mp/components/chart/line/index.js +10 -6
  118. package/src/mp/components/chart/pie/index.js +6 -2
  119. package/src/mp/components/chart/statisticsCard/index.js +33 -6
  120. package/src/mp/components/dataView/index.json +1 -1
  121. package/src/mp/components/form/checkbox/index.js +41 -2
  122. package/src/mp/components/form/checkbox/index.wxml +1 -1
  123. package/src/mp/components/form/form/index.wxml +1 -2
  124. package/src/mp/components/form/formcell/index.wxml +1 -1
  125. package/src/mp/components/form/formcell/index.wxss +17 -0
  126. package/src/mp/components/form/input/index.js +1 -1
  127. package/src/mp/components/form/input/index.wxss +15 -0
  128. package/src/mp/components/form/location/index.js +43 -2
  129. package/src/mp/components/form/location/index.wxss +4 -6
  130. package/src/mp/components/form/radio/index.js +34 -1
  131. package/src/mp/components/form/select/index.js +351 -41
  132. package/src/mp/components/form/select/index.wxml +17 -2
  133. package/src/mp/components/form/select/index.wxss +4 -0
  134. package/src/mp/components/form/select/region/index.js +101 -0
  135. package/src/mp/components/form/textarea/index.js +1 -1
  136. package/src/mp/components/form/textarea/index.wxss +4 -0
  137. package/src/mp/components/form/uploader/index.js +39 -27
  138. package/src/mp/components/form/uploader/index.json +3 -2
  139. package/src/mp/components/form/uploader/index.wxml +11 -7
  140. package/src/mp/components/form/uploader/index.wxss +20 -2
  141. package/src/mp/components/form/uploader/weui-uploader.js +209 -0
  142. package/src/mp/components/form/uploader/weui-uploader.json +7 -0
  143. package/src/mp/components/form/uploader/weui-uploader.wxml +45 -0
  144. package/src/mp/components/form/uploader/weui-uploader.wxss +1 -0
  145. package/src/mp/components/form/uploaderFile/index.js +10 -6
  146. package/src/mp/components/form/uploaderFile/index.wxss +4 -4
  147. package/src/mp/components/image/index.wxss +3 -2
  148. package/src/mp/components/listView/index.js +38 -43
  149. package/src/mp/components/listView/index.wxml +1 -1
  150. package/src/mp/components/listView/index.wxss +5 -0
  151. package/src/mp/components/lottery/index.js +270 -0
  152. package/src/mp/components/{internals/listView → lottery}/index.json +0 -0
  153. package/src/mp/components/lottery/index.wxml +43 -0
  154. package/src/mp/components/lottery/index.wxss +317 -0
  155. package/src/mp/components/navigationBar/index.js +193 -0
  156. package/src/mp/components/navigationBar/index.json +6 -0
  157. package/src/mp/components/navigationBar/index.wxml +88 -0
  158. package/src/mp/components/navigationBar/index.wxss +1257 -0
  159. package/src/mp/components/tabs/index.js +7 -2
  160. package/src/mp/components/tabs/index.wxml +2 -1
  161. package/src/mp/components/text/index.js +0 -25
  162. package/src/mp/components/text/index.wxml +3 -3
  163. package/src/mp/components/wxOpenApi/phone/index.js +117 -0
  164. package/src/mp/components/wxOpenApi/phone/index.json +4 -0
  165. package/src/mp/components/wxOpenApi/phone/index.wxml +15 -0
  166. package/src/mp/components/wxOpenApi/phone/index.wxss +22 -0
  167. package/src/mp/components/wxOpenApi/phoneCode/index.js +89 -0
  168. package/src/mp/components/wxOpenApi/phoneCode/index.json +4 -0
  169. package/src/mp/components/wxOpenApi/phoneCode/index.wxml +15 -0
  170. package/src/mp/components/wxOpenApi/phoneCode/index.wxss +22 -0
  171. package/src/mp/components/wxOpenApi/share/index.js +117 -0
  172. package/src/mp/components/wxOpenApi/share/index.json +4 -0
  173. package/src/mp/components/wxOpenApi/share/index.wxml +15 -0
  174. package/src/mp/components/wxOpenApi/share/index.wxss +22 -0
  175. package/src/mp/components/wxOpenApi/userInfo/index.js +88 -0
  176. package/src/mp/components/wxOpenApi/userInfo/index.json +4 -0
  177. package/src/mp/components/wxOpenApi/userInfo/index.wxml +14 -0
  178. package/src/mp/components/wxOpenApi/userInfo/index.wxss +22 -0
  179. package/src/mp/index.json +7 -1
  180. package/src/mp/style/weda-ui.wxss +16 -0
  181. package/src/mp/utils/constant.js +15 -0
  182. package/src/mp/utils/destr.js +48 -0
  183. package/src/mp/utils/lodash.js +2 -0
  184. package/src/mp/utils/platform.js +10 -0
  185. package/src/mp/utils/tcb.js +44 -0
  186. package/src/web/components/button/index.css +8 -1
  187. package/src/web/components/button/index.tsx +10 -9
  188. package/src/web/components/calendar/index.jsx +1 -1
  189. package/src/web/components/carousel/index.tsx +8 -8
  190. package/src/web/components/chart/bar/index.tsx +40 -39
  191. package/src/web/components/chart/common/config/line.js +1 -1
  192. package/src/web/components/chart/common/core/eChartBar.js +7 -6
  193. package/src/web/components/chart/common/core/eChartBase.ts +20 -16
  194. package/src/web/components/chart/common/core/eChartLine.js +8 -6
  195. package/src/web/components/chart/line/index.tsx +40 -39
  196. package/src/web/components/chart/statisticsCard/index.tsx +29 -8
  197. package/src/web/components/form/checkbox/index.tsx +61 -23
  198. package/src/web/components/form/form/index.css +5 -1
  199. package/src/web/components/form/form/index.tsx +3 -1
  200. package/src/web/components/form/formcell/index.css +22 -1
  201. package/src/web/components/form/formcell/index.tsx +11 -6
  202. package/src/web/components/form/input/index.css +7 -12
  203. package/src/web/components/form/location/components/LocationH5/index.css +4 -7
  204. package/src/web/components/form/location/components/LocationH5/location.h5.jsx +1 -1
  205. package/src/web/components/form/radio/index.tsx +90 -53
  206. package/src/web/components/form/select/h5.tsx +370 -73
  207. package/src/web/components/form/select/index.css +15 -0
  208. package/src/web/components/form/select/index.tsx +392 -145
  209. package/src/web/components/form/select/region/index.ts +122 -31
  210. package/src/web/components/form/select/time.jsx +89 -0
  211. package/src/web/components/form/select/year.tsx +170 -0
  212. package/src/web/components/form/textarea/index.css +4 -0
  213. package/src/web/components/form/textarea/index.tsx +2 -2
  214. package/src/web/components/form/tips/index.css +4 -0
  215. package/src/web/components/form/tips/index.tsx +4 -3
  216. package/src/web/components/form/uploader/index.css +26 -2
  217. package/src/web/components/form/uploader/uploader.h5.tsx +89 -57
  218. package/src/web/components/form/uploader/uploader.pc.tsx +4 -4
  219. package/src/web/components/form/uploaderFile/index.css +2 -4
  220. package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +13 -7
  221. package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +13 -5
  222. package/src/web/components/image/image.tsx +1 -1
  223. package/src/web/components/image/index.css +3 -3
  224. package/src/web/components/image/index.tsx +6 -7
  225. package/src/web/components/index.js +8 -0
  226. package/src/web/components/link/index.tsx +7 -4
  227. package/src/web/components/listView/index.css +4 -0
  228. package/src/web/components/listView/index.tsx +12 -20
  229. package/src/web/components/lottery/index.css +327 -0
  230. package/src/web/components/lottery/index.tsx +567 -0
  231. package/src/web/components/lottery/lotteryUtil.ts +130 -0
  232. package/src/web/components/modal/index.tsx +3 -1
  233. package/src/web/components/navLayout/index.tsx +2 -2
  234. package/src/web/components/navigationBar/chevron-right--double.svg +3 -0
  235. package/src/web/components/navigationBar/common.tsx +198 -0
  236. package/src/web/components/navigationBar/h5Menu.tsx +179 -0
  237. package/src/web/components/navigationBar/horizontalMenu.tsx +200 -0
  238. package/src/web/components/navigationBar/index.css +762 -0
  239. package/src/web/components/navigationBar/index.tsx +230 -0
  240. package/src/web/components/navigationBar/type.d.ts +111 -0
  241. package/src/web/components/navigationBar/verticalMenu.tsx +81 -0
  242. package/src/web/components/phone/index.css +0 -0
  243. package/src/web/components/phone/index.tsx +22 -0
  244. package/src/web/components/phoneCode/index.css +0 -0
  245. package/src/web/components/phoneCode/index.tsx +22 -0
  246. package/src/web/components/picker/timePicker.tsx +2 -2
  247. package/src/web/components/richTextView/index.tsx +3 -5
  248. package/src/web/components/share/index.css +0 -0
  249. package/src/web/components/share/index.tsx +38 -0
  250. package/src/web/components/slot/index.tsx +1 -1
  251. package/src/web/components/tabs/index.tsx +2 -0
  252. package/src/web/components/tabs/tabs.h5.tsx +43 -33
  253. package/src/web/components/tabs/tabs.pc.tsx +23 -10
  254. package/src/web/components/text/index.tsx +12 -20
  255. package/src/web/components/userInfo/index.css +0 -0
  256. package/src/web/components/userInfo/index.tsx +30 -0
  257. package/src/web/utils/{constant.js → constant.ts} +17 -2
  258. package/src/web/utils/lodash.ts +2 -0
  259. package/src/web/utils/platform.js +9 -0
  260. package/src/web/utils/tcb.js +26 -0
  261. package/src/web/weda-ui.css +7 -1
  262. package/src/mp/components/internals/listView/arrow-right-line.svg +0 -3
  263. package/src/mp/components/internals/listView/index.js +0 -286
  264. package/src/mp/components/internals/listView/index.wxml +0 -40
  265. package/src/mp/components/internals/listView/index.wxss +0 -150
  266. package/src/mp/components/internals/listView/more-line.svg +0 -3
  267. package/src/web/components/form/select/region/cities.ts +0 -2410
  268. package/src/web/components/form/select/region/provinces.ts +0 -240
  269. package/src/web/components/form/select/region/regions.ts +0 -20645
@@ -1,30 +1,43 @@
1
+ import { useCustomCompareEffect, useMountEffect, useSyncedRef } from '@react-hookz/web';
1
2
  import * as React from 'react';
2
3
  import { Tabs as TeaTabs, TabPanel, ConfigProvider } from 'tea-component';
3
4
  import classNames from '../../utils/classnames';
5
+ import isObjectEqual from '../../utils/isObjectEqual';
4
6
  import { useSyncValue } from '../../utils/useSyncValue';
5
7
  import { PropsType } from './index';
6
8
 
7
9
 
8
10
  export default function TabsPc({
9
- tabs,
11
+ tabs = [],
10
12
  selectedIndex,
11
13
  events,
12
14
  className,
13
15
  style,
16
+ isMultipleSlot = true,
14
17
  ...restProps
15
18
  }: PropsType) {
16
19
 
17
20
  const [activeIndex, setActiveIndex] = useSyncValue(selectedIndex);
18
- const _tabs = Array.isArray(tabs) && tabs.length && tabs.map((item, index) => {
19
- return {
20
- id: index.toString(),
21
- label: item.title
22
- };
23
- });
21
+ const _tabs = React.useMemo(() => {
22
+ return Array.isArray(tabs) && tabs.length && tabs.map((item, index) => {
23
+ return {
24
+ id: index.toString(),
25
+ label: item.title,
26
+ value: item.value
27
+ };
28
+ });
29
+ }, [tabs]);
24
30
 
31
+ const eventsRef = useSyncedRef(events);
32
+ useCustomCompareEffect(() => {
33
+ eventsRef.current && eventsRef.current.change({
34
+ id: _tabs[activeIndex]?.id,
35
+ label: _tabs[activeIndex]?.label,
36
+ value: _tabs[activeIndex]?.value,
37
+ });
38
+ }, [activeIndex, _tabs], isObjectEqual);
25
39
  const onActive = (e) => {
26
40
  setActiveIndex(e.id);
27
- events && events.change(e);
28
41
  };
29
42
  return (
30
43
  <ConfigProvider classPrefix="wedatea2td">
@@ -40,11 +53,11 @@ export default function TabsPc({
40
53
  key={item.id}
41
54
  id={item.id}
42
55
  >
43
- {restProps[`panel${index + 1}`]}
56
+ {isMultipleSlot ? restProps[`panel${index + 1}`] : restProps['panel1']}
44
57
  </TabPanel>
45
58
  )
46
59
  )}
47
60
  </TeaTabs>
48
61
  </ConfigProvider>
49
62
  );
50
- }
63
+ }
@@ -17,17 +17,15 @@ export interface PropsType extends CommonPropsType {
17
17
 
18
18
  }
19
19
  export default function Text({
20
- text = '文本内容',
21
- maxLines = 2,
22
- space = false,
23
- userSelect = true,
24
- textAlign = '',
25
- textColor = '',
20
+ text,
21
+ maxLines,
22
+ space,
23
+ userSelect,
26
24
  style = {},
27
25
  className,
28
26
  events,
29
27
  id,
30
- level = '0',
28
+ level,
31
29
  contenteditable,
32
30
  onInput,
33
31
  onBlur
@@ -40,25 +38,19 @@ export default function Text({
40
38
  if (!userSelect) {
41
39
  textStyle.userSelect = 'none';
42
40
  }
43
- const levelName = level === '0' ? '' : `level_${level}`;
41
+ const levelName = (level === '0' || !level) ? '' : `level_${level}`;
44
42
 
45
- // 添加文本颜色属性
46
- let style2 = {};
47
- if (textColor !== "") {
48
- style2 = {color: textColor};
49
- }
50
-
51
- // 添加对齐属性
52
- if (textAlign !== "") {
53
- style2 = {...style2, textAlign};
54
- }
43
+ const inlineStyle = React.useMemo(
44
+ () => ({ ...textStyle, ...style }),
45
+ [textStyle, style]
46
+ );
55
47
  return (
56
48
  <p
57
49
  //@ts-expect-error contentEditable type def sucks
58
50
  contentEditable={contenteditable}
59
51
  onInput={onInput}
60
52
  onBlur={onBlur}
61
- style={{ ...style, ...textStyle, ...style2 }}
53
+ style={inlineStyle}
62
54
  className={classNames('weda-text', 'weda-ui', className, levelName)}
63
55
  id={id}
64
56
  onClick={(e) => events.tap({}, { originEvent: e })}
@@ -66,4 +58,4 @@ export default function Text({
66
58
  {text}
67
59
  </p>
68
60
  );
69
- }
61
+ }
File without changes
@@ -0,0 +1,30 @@
1
+ import * as React from 'react';
2
+ import Button from '../../components/button';
3
+ import { CommonPropsType } from '../../types';
4
+
5
+ const UserInfo = (props: PropsType) => <Button {...props} />;
6
+
7
+ export interface PropsType extends CommonPropsType {
8
+ /**
9
+ * 按钮标题
10
+ */
11
+ text?: string;
12
+ /**
13
+ * 按钮风格
14
+ */
15
+ type?: 'primary' | 'warn' | 'wechat' | 'default';
16
+ /**
17
+ * 按钮大小
18
+ */
19
+ size?: 'default' | 'mini' | 'large';
20
+ /**
21
+ * 信息用途
22
+ */
23
+ usage?: string;
24
+ /**
25
+ * 语言
26
+ */
27
+ language?: string;
28
+ }
29
+
30
+ export default UserInfo;
@@ -2,6 +2,21 @@ export const TitleType = {
2
2
  LEFT: 'left',
3
3
  TOP: 'top',
4
4
  NONE: 'none',
5
- };
5
+ } as const;
6
6
 
7
- export const LOAD_ERR_IMG_BASE64 = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIg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jA2NDMgOC4wODU3NyA4Ljc1MjMyIDguMDQwOTdDNy4yOTU2OCA3Ljk5MTY5IDYuMTIgOS4xNTEzNyA2LjEyIDEwLjU5OTdaIiBmaWxsPSIjQkNDNEQwIj48L3BhdGg+Cjwvc3ZnPgo=' as const;
8
+
9
+ export const REL_DICT = {
10
+ equal: 'eq', // 等于
11
+ unequal: 'neq', // 不等于
12
+ include: 'search', // 包含
13
+ exclude: '_exclude', // 不包含
14
+ begin_with: '_begin_with', // 开头是
15
+ greater: 'gt', // 大于
16
+ greater_or_equal: 'gte', // 大于等于
17
+ bigger_or_equal: 'gte', //大于等于
18
+ less: 'lt', // 小于
19
+ less_or_equal: 'lte', // 小于等于
20
+ in: 'in', // 多选值
21
+ not_in: 'nin', // 不在多选值
22
+ } as const;
@@ -0,0 +1,2 @@
1
+ // https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11973
2
+ export const isNil = (val: any): val is (null | undefined) => val == null;
@@ -132,3 +132,12 @@ export const transFileCloudidToName = (fileID) => {
132
132
  const title = name.replace(uuidReg, '');
133
133
  return title;
134
134
  };
135
+
136
+ /**
137
+ * 判断是否是url
138
+ */
139
+ const reg =
140
+ // eslint-disable-next-line no-useless-escape
141
+ /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
142
+
143
+ export const isUrl = (path) => reg.test(path);
@@ -1,3 +1,4 @@
1
+ import { isInIde } from './platform';
1
2
  /**
2
3
  * 云存储/云函数相关
3
4
  */
@@ -54,6 +55,31 @@ export async function callDataSource(param) {
54
55
  }
55
56
  }
56
57
 
58
+ /**
59
+ * 云API:获取用户自定义导航内容
60
+ * param
61
+ * WeAppId: string,
62
+ * EnvId: string,
63
+ * PublishType?: string,
64
+ */
65
+ export async function getAppCustomNav() {
66
+ try {
67
+ const PublishType = isInIde() ? 'preview' : '';
68
+ const WeAppId = window?.app?.id;
69
+ const res = await callWedaApi({
70
+ action: 'DescribeAppCustomNav',
71
+ serviceType: 'lowcode',
72
+ data: {
73
+ WeAppId,
74
+ PublishType,
75
+ },
76
+ });
77
+ return res;
78
+ } catch (error) {
79
+ console.error('错误', error);
80
+ return {};
81
+ }
82
+ }
57
83
 
58
84
  export function callWedaApi(...args) {
59
85
  return window.app.cloud.callWedaApi(...args);
@@ -6,6 +6,8 @@ body .weda-ui {
6
6
  --weui-BRAND: #006eff;
7
7
  --weui-TAG-TEXT-BLUE: #0067eb;
8
8
  --weui-BTN-DEFAULT-COLOR: #576b95;
9
+ --weui-WECHAT: #07c160;
10
+ --weui-TAG-TEXT-GREEN: #06ae56;
9
11
  --weui-BG-2: rgba(255, 255, 255, 0);
10
12
  }
11
13
 
@@ -62,4 +64,8 @@ body .weda-ui {
62
64
  left: -9999px;
63
65
  width: 0;
64
66
  height: 0;
65
- }
67
+ }
68
+
69
+ .weda-ui .weui-cell {
70
+ font-size: 16px; /* 修改默认weui的17为16 */
71
+ }
@@ -1,3 +0,0 @@
1
- <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M13.1719 12.0002L8.22192 7.05023L9.63592 5.63623L15.9999 12.0002L9.63592 18.3642L8.22192 16.9502L13.1719 12.0002Z" fill="#09121F"/>
3
- </svg>
@@ -1,286 +0,0 @@
1
- const isNull = (val) => [undefined, null].includes(val);
2
- const REL_DICT = {
3
- equal: 'eq', // 等于
4
- unequal: 'neq', // 不等于
5
- include: 'search', // 包含
6
- exclude: '_exclude', // 不包含
7
- begin_with: '_begin_with', // 开头是
8
- greater: 'gt', // 大于
9
- greater_or_equal: 'gte', // 大于等于
10
- less: 'lt', // 小于
11
- less_or_equal: 'lte', // 小于等于
12
- in: 'in', // 多选值
13
- not_in: 'nin', // 不在多选值
14
- };
15
- const ORDERTYPE = ['asc', 'desc'];
16
- const getWhereList = (where) => {
17
- let result = [];
18
- Array.isArray(where) &&
19
- where.forEach((item1) => {
20
- if (item1?.groupLogic !== 'or' && Array.isArray(item1?.logicData)) {
21
- item1?.logicData.forEach((item2) => {
22
- let [rel, val] = [REL_DICT[item2?.rel], item2?.value];
23
- if ('_begin_with' === rel) {
24
- rel = 'regex';
25
- val = `^${val}`;
26
- }
27
- if ('_exclude' === rel) {
28
- rel = 'regex';
29
- val = `^((?!${val}).)*$`;
30
- }
31
- if (item2?.logic !== 'or' && item2?.key && rel && !isNull(val)) {
32
- result.push({ key: item2.key, rel, val });
33
- }
34
- });
35
- }
36
- });
37
- return result;
38
- };
39
- const DEFAULT_DATA = {
40
- pageNo: 1,
41
- loading: false,
42
- total: 0,
43
- records: [],
44
- pageStr: '0/0',
45
- isVisiableSign: false,
46
- isFirstScreen: true,
47
- };
48
-
49
- Component({
50
- options: {
51
- virtualHost: true,
52
- },
53
- properties: {
54
- className: {
55
- type: String,
56
- value: '',
57
- },
58
- style: {
59
- type: String,
60
- value: '',
61
- },
62
- datasource: {
63
- type: Object,
64
- value: {},
65
- },
66
- orderBy: {
67
- type: String,
68
- },
69
- orderType: {
70
- type: String,
71
- },
72
- where: {
73
- type: Array,
74
- value: [],
75
- },
76
- pageSize: {
77
- type: Number,
78
- value: 5,
79
- },
80
- template: {
81
- type: String,
82
- value: 'simpleList',
83
- },
84
- pagination: {
85
- type: String,
86
- value: 'loadMoreButton',
87
- },
88
- beforeDataChange: {
89
- type: Function,
90
- value: (v) => v,
91
- },
92
- },
93
- data: { ...DEFAULT_DATA },
94
- methods: {
95
- /**
96
- * 列表容器拉取数据,放在 setData 的回调函数中执行
97
- */
98
- _fetchData: async function () {
99
- const { app } = getApp();
100
- const callDataSource = app?.cloud?.callDataSource;
101
- const { pageNo, loading } = this.data;
102
- const { datasource, orderBy, orderType, where, pageSize } =
103
- this.properties;
104
- if (loading) return;
105
- if (!callDataSource) {
106
- console.warn(`当前环境缺少方法 app.cloud.callDataSource`);
107
- return;
108
- }
109
- this.setData({ loading: true });
110
- const { name: dataSourceName, extra } = datasource || {};
111
- const methodName =
112
- typeof extra?.methodName === 'string'
113
- ? extra?.methodName
114
- : 'wedaGetRecords';
115
- const tcbParams = {};
116
-
117
- // tcb分页参数
118
- if (!isNull(pageNo) && !isNull(pageSize)) {
119
- tcbParams['pageNo'] = pageNo;
120
- tcbParams['pageSize'] = pageSize;
121
- }
122
- // tcb排序参数
123
- if (orderBy && ORDERTYPE.includes(orderType)) {
124
- tcbParams['orderBy'] = orderBy;
125
- tcbParams['orderType'] = orderType;
126
- }
127
- // tcb过滤参数
128
- const whereEffected = [].concat(getWhereList(where));
129
- whereEffected.length > 0 && (tcbParams['where'] = whereEffected);
130
- // tcb结果和事件
131
- const data = await callDataSource({
132
- dataSourceName,
133
- methodName,
134
- params: tcbParams,
135
- });
136
- let records = data?.records || [];
137
- let total = data?.total || 0;
138
- if (
139
- ['loadMoreButton', 'bottomLoad'].includes(this.properties.pagination)
140
- ) {
141
- records = [...this.data.records, ...records]; // TODO 可能存在单次 setData 数据量过大引起小程序性能问题
142
- }
143
- this.setData(
144
- {
145
- total,
146
- records,
147
- loading: false,
148
- pageStr: `${total > 0 ? pageNo : 0}/${
149
- Math.ceil(total / pageSize) || 0
150
- }`,
151
- },
152
- () => {
153
- this._handleEvents(data);
154
- setTimeout(() => this._firstScreenLoadMore(), 150);
155
- }
156
- );
157
- },
158
- /**
159
- * 下一页
160
- */
161
- handleNext: function () {
162
- if (
163
- this.data.loading ||
164
- !(this.properties.pageSize * this.data.pageNo < this.data.total)
165
- ) {
166
- return;
167
- }
168
- this.setData({ pageNo: this.data.pageNo + 1 }, () => this._fetchData());
169
- },
170
- /**
171
- * 上一页
172
- */
173
- handlePre: function () {
174
- if (this.data.loading || !(this.properties.pageNo > 1)) {
175
- return;
176
- }
177
- this.setData({ pageNo: this.data.pageNo - 1 }, () => this._fetchData());
178
- },
179
- /**
180
- * 向外部传递事件
181
- */
182
- _handleEvents: function (data) {
183
- const records = this.data.records || [];
184
- const total = this.data.total || records?.length || 0;
185
- const beforeDataChange = this.properties.beforeDataChange || ((v) => v);
186
- this.triggerEvent('onDataChange', {
187
- data: beforeDataChange(records),
188
- });
189
- if (JSON.stringify(data) === '{}') {
190
- this.triggerEvent('queryFail', {
191
- datasource: this.properties.datasource,
192
- data: null,
193
- });
194
- } else {
195
- if (total === 0) {
196
- this.triggerEvent('queryEmpty', {
197
- datasource: this.properties.datasource,
198
- data: beforeDataChange([]),
199
- });
200
- }
201
- this.triggerEvent('querySuccess', {
202
- datasource: this.properties.datasource,
203
- data: beforeDataChange(records),
204
- });
205
- }
206
- },
207
- /**
208
- * 首屏持续触底加载特殊处理
209
- */
210
- _firstScreenLoadMore: function () {
211
- if (this.properties.pagination === 'bottomLoad') {
212
- if (this.data.isFirstScreen) {
213
- this.setData({ isFirstScreen: false });
214
- this.contentObserver?.disconnect();
215
- this._observerContent();
216
- }
217
- }
218
- },
219
- /**
220
- * 开始监听slot
221
- */
222
- _observerContent: function () {
223
- this.contentObserver = this.createIntersectionObserver();
224
- this.contentObserver
225
- .relativeToViewport()
226
- .observe('#weda-list-view_content', (res) => {
227
- this.setData({
228
- isFirstScreen:
229
- res?.boundingClientRect?.bottom <= res?.relativeRect?.bottom,
230
- });
231
- });
232
- },
233
- /**
234
- * 开始监听sign
235
- */
236
- _observerSign: function () {
237
- this.signObserver = this.createIntersectionObserver();
238
- this.signObserver
239
- .relativeTo('.weda-list-view__containor', { bottom: 10 })
240
- .observe('#weda-list-view_sign', (res) => {
241
- this.setData({ isVisiableSign: res?.intersectionRatio > 0 });
242
- });
243
- },
244
- },
245
- observers: {
246
- 'datasource,orderBy,orderType,where,pageSize,pagination': function (
247
- dDatasource,
248
- dOrderBy,
249
- dOrderType,
250
- dWhere,
251
- dPageSize,
252
- dPagination
253
- ) {
254
- if (
255
- dDatasource !== this.properties.datasource ||
256
- dOrderBy !== this.properties.orderBy ||
257
- dOrderType !== this.properties.orderType ||
258
- dWhere !== this.properties.where ||
259
- dPageSize !== this.properties.pageSize ||
260
- dPagination !== this.properties.pagination
261
- ) {
262
- this.setData({ ...DEFAULT_DATA }, () => this._fetchData());
263
- }
264
- },
265
- isVisiableSign: function (dIsVisiableSign) {
266
- if (dIsVisiableSign && this.properties.pagination === 'bottomLoad') {
267
- this.handleNext();
268
- }
269
- },
270
- isFirstScreen: function (dIsFirstScreen) {
271
- if (dIsFirstScreen && this.properties.pagination === 'bottomLoad') {
272
- this.handleNext();
273
- }
274
- },
275
- },
276
- lifetimes: {
277
- attached: function () {
278
- this._fetchData();
279
- this._observerSign();
280
- },
281
- detached: function () {
282
- this.contentObserver?.disconnect();
283
- this.signObserver?.disconnect();
284
- },
285
- },
286
- });
@@ -1,40 +0,0 @@
1
- <scroll-view scroll-y scroll-with-animation lower-threshold="5" style="height:97vh;{{style}}"
2
- class="weda-list-view__containor weda-ui {{className}}">
3
- <!-- 列表插槽 -->
4
- <view class="{{template === 'cardList' ? 'weda-list-view-card' : ''}}" id="weda-list-view_content">
5
- <slot></slot>
6
- </view>
7
-
8
- <view class="weda-list-view__more">
9
- <!-- 加载更多 -->
10
- <block wx:if="{{pagination==='loadMoreButton' && pageSize * pageNo < total}}">
11
- <view class="weda-list-view__more-text" bindtap="handleNext">加载更多</view>
12
- </block>
13
- <!-- 触底刷新 -->
14
- <block wx:elif="{{pagination==='bottomLoad'}}">
15
- <view class="weda-list-view__bottom-load" id="weda-list-view_sign">
16
- <view class="weda-list-view__more-symbol" wx:if="{{loading}}">
17
- <view class="weda-list-view__symbol-item"></view>
18
- <view class="weda-list-view__symbol-item"></view>
19
- <view class="weda-list-view__symbol-item"></view>
20
- </view>
21
- </view>
22
- </block>
23
- <!-- 分页器 -->
24
- <block wx:elif="{{pagination==='pagination'}}">
25
- <view class="weda-list-view__more-pagination">
26
- <view class="weda-list-view__pagination-pre {{pageNo > 1 ? 'active': ''}}" bindtap="handlePre">
27
- <image class="weda-list-view__pagination-icon" src='arrow-right-line.svg' />
28
- 上一页
29
- </view>
30
- <view class="weda-list-view__pagination-text">{{pageStr}}</view>
31
- <view class="weda-list-view__pagination-next {{pageSize * pageNo < total ? 'active' : ''}}"
32
- bindtap="handleNext">
33
- <image class="weda-list-view__pagination-icon" src='arrow-right-line.svg' />
34
- 下一页
35
- </view>
36
- </view>
37
- </block>
38
- <block wx:else></block>
39
- </view>
40
- </scroll-view>