@cloudbase/weda-ui 0.2.15 → 0.2.16

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 (112) hide show
  1. package/package.json +10 -7
  2. package/src/configs/components/calendar.json +75 -0
  3. package/src/configs/components/carousel.json +273 -0
  4. package/src/configs/components/chart/statisticsCard.json +331 -0
  5. package/src/configs/components/dataView.json +139 -0
  6. package/src/configs/components/form/location.json +152 -0
  7. package/src/configs/components/form/uploaderFile.json +2 -1
  8. package/src/configs/components/graphicCard.json +399 -0
  9. package/src/configs/components/link.json +2 -2
  10. package/src/configs/components/listView.json +230 -0
  11. package/src/configs/components/navLayout.json +350 -0
  12. package/src/configs/components/swiper.json +3 -3
  13. package/src/configs/index.js +16 -0
  14. package/src/mp/components/button/index.js +12 -13
  15. package/src/mp/components/button/index.wxml +1 -1
  16. package/src/mp/components/calendar/arrowright--line.svg +11 -0
  17. package/src/mp/components/calendar/index.js +238 -0
  18. package/src/mp/components/calendar/index.json +4 -0
  19. package/src/mp/components/calendar/index.wxml +37 -0
  20. package/src/mp/components/calendar/index.wxss +178 -0
  21. package/src/mp/components/carousel/index.js +88 -0
  22. package/src/mp/components/carousel/index.json +7 -0
  23. package/src/mp/components/carousel/index.wxml +6 -0
  24. package/src/mp/components/chart/statisticsCard/index.js +226 -0
  25. package/src/mp/components/chart/statisticsCard/index.json +4 -0
  26. package/src/mp/components/chart/statisticsCard/index.wxml +9 -0
  27. package/src/mp/components/chart/statisticsCard/index.wxss +45 -0
  28. package/src/mp/components/dataView/index.js +34 -0
  29. package/src/mp/components/dataView/index.json +7 -0
  30. package/src/mp/components/dataView/index.wxml +15 -0
  31. package/src/mp/components/dataView/index.wxss +0 -0
  32. package/src/mp/components/form/location/components/mapChoose/index.js +201 -0
  33. package/src/mp/components/form/location/components/mapChoose/index.json +4 -0
  34. package/src/mp/components/form/location/components/mapChoose/index.wxml +42 -0
  35. package/src/mp/components/form/location/components/mapChoose/index.wxss +188 -0
  36. package/src/mp/components/form/location/index.js +341 -0
  37. package/src/mp/components/form/location/index.json +6 -0
  38. package/src/mp/components/form/location/index.wxml +25 -0
  39. package/src/mp/components/form/location/index.wxss +91 -0
  40. package/src/mp/components/form/uploader/index.js +39 -35
  41. package/src/mp/components/form/uploaderFile/index.js +61 -14
  42. package/src/mp/components/graphicCard/chevron-right.svg +3 -0
  43. package/src/mp/components/graphicCard/index.js +205 -0
  44. package/src/mp/components/graphicCard/index.json +4 -0
  45. package/src/mp/components/graphicCard/index.wxml +29 -0
  46. package/src/mp/components/graphicCard/index.wxss +157 -0
  47. package/src/mp/components/image/index.js +0 -1
  48. package/src/mp/components/listView/arrow-right-line.svg +3 -0
  49. package/src/mp/components/listView/index.js +286 -0
  50. package/src/mp/components/listView/index.json +4 -0
  51. package/src/mp/components/listView/index.wxml +40 -0
  52. package/src/mp/components/listView/index.wxss +150 -0
  53. package/src/mp/components/listView/more-line.svg +3 -0
  54. package/src/mp/components/navLayout/index.js +123 -0
  55. package/src/mp/components/navLayout/index.json +7 -0
  56. package/src/mp/components/navLayout/index.wxml +25 -0
  57. package/src/mp/components/navLayout/index.wxss +1193 -0
  58. package/src/mp/components/swiper/index.wxml +2 -0
  59. package/src/mp/index.json +9 -1
  60. package/src/mp/utils/debounce.js +133 -0
  61. package/src/mp/utils/dr_square_point.js +25 -0
  62. package/src/mp/utils/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js +1336 -0
  63. package/src/mp/utils/spark-md5.js +776 -0
  64. package/src/mp/utils/tcb.js +18 -0
  65. package/src/web/components/calendar/index.css +382 -0
  66. package/src/web/components/calendar/index.jsx +312 -0
  67. package/src/web/components/calendar/util.js +90 -0
  68. package/src/web/components/carousel/index.css +119 -0
  69. package/src/web/components/carousel/index.tsx +417 -0
  70. package/src/web/components/chart/statisticsCard/index.css +62 -0
  71. package/src/web/components/chart/statisticsCard/index.tsx +286 -0
  72. package/src/web/components/chart/statisticsCard/interface.ts +14 -0
  73. package/src/web/components/dataView/index.tsx +20 -0
  74. package/src/web/components/dataView/interface.ts +6 -0
  75. package/src/web/components/form/location/common/mapChoose.css +178 -0
  76. package/src/web/components/form/location/common/mapChoose.jsx +343 -0
  77. package/src/web/components/form/location/common/mapView.jsx +190 -0
  78. package/src/web/components/form/location/common/propsConfig.js +54 -0
  79. package/src/web/components/form/location/common/selectModal.css +44 -0
  80. package/src/web/components/form/location/common/selectModal.jsx +82 -0
  81. package/src/web/components/form/location/common/useLocationInfo.js +100 -0
  82. package/src/web/components/form/location/components/LocationH5/index.css +243 -0
  83. package/src/web/components/form/location/components/LocationH5/location.h5.jsx +403 -0
  84. package/src/web/components/form/location/components/LocationPC/Header.jsx +109 -0
  85. package/src/web/components/form/location/components/LocationPC/index.css +44 -0
  86. package/src/web/components/form/location/components/LocationPC/location.PC.jsx +323 -0
  87. package/src/web/components/form/location/constants.js +4 -0
  88. package/src/web/components/form/location/index.css +0 -0
  89. package/src/web/components/form/location/index.jsx +25 -0
  90. package/src/web/components/form/uploader/uploader.h5.tsx +16 -10
  91. package/src/web/components/form/uploader/uploader.pc.tsx +15 -11
  92. package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +122 -107
  93. package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +22 -19
  94. package/src/web/components/graphicCard/index.css +163 -0
  95. package/src/web/components/graphicCard/index.tsx +309 -0
  96. package/src/web/components/image/image.tsx +0 -1
  97. package/src/web/components/index.js +12 -0
  98. package/src/web/components/listView/arrow-right-line.svg +3 -0
  99. package/src/web/components/listView/index.css +139 -0
  100. package/src/web/components/listView/index.tsx +354 -0
  101. package/src/web/components/listView/interface.ts +98 -0
  102. package/src/web/components/navLayout/index.css +332 -0
  103. package/src/web/components/navLayout/index.tsx +247 -0
  104. package/src/web/components/tabs/index.tsx +2 -2
  105. package/src/web/components/tabs/tabs.h5.tsx +7 -4
  106. package/src/web/components/uploaderFileView/index.css +9 -9
  107. package/src/web/components/uploaderFileView/index.jsx +32 -23
  108. package/src/web/types.d.ts +15 -14
  109. package/src/web/utils/debounce.js +98 -0
  110. package/src/web/utils/platform.js +31 -0
  111. package/src/web/utils/tcb.js +35 -0
  112. package/src/web/utils/tmap.js +4 -0
@@ -7,3 +7,5 @@
7
7
  indicator-active-color="{{indicatorActiveColor}}">
8
8
  <slot></slot>
9
9
  </swiper>
10
+
11
+
package/src/mp/index.json CHANGED
@@ -9,6 +9,7 @@
9
9
  "Checkbox": "components/form/checkbox/index",
10
10
  "Switch": "components/form/switch/index",
11
11
  "Input": "components/form/input/index",
12
+ "Location": "components/form/location/index",
12
13
  "Textarea": "components/form/textarea/index",
13
14
  "Select": "components/form/select/index",
14
15
  "Uploader": "components/form/uploader/index",
@@ -22,10 +23,17 @@
22
23
  "type": "native",
23
24
  "path": "swiper"
24
25
  },
26
+ "Carousel": "components/carousel/index",
25
27
  "ScrollView": "components/scrollView/index",
26
28
  "Tips": "components/form/tips/index",
27
29
  "RichTextView": "components/richText/index",
28
- "Tabs": "components/tabs/index"
30
+ "Tabs": "components/tabs/index",
31
+ "ListView": "components/listView/index",
32
+ "DataView": "components/dataView/index",
33
+ "Calendar": "components/calendar/index",
34
+ "NavLayout": "components/navLayout/index",
35
+ "StatisticsCard": "components/chart/statisticsCard/index",
36
+ "GraphicCard": "components/graphicCard/index"
29
37
  },
30
38
  "actions": {
31
39
  "showToast": "actions/showToast/index",
@@ -0,0 +1,133 @@
1
+ function isObject(value) {
2
+ const type = typeof value;
3
+ return value != null && (type === 'object' || type === 'function');
4
+ }
5
+
6
+ function debounce(func, wait, options) {
7
+ let lastArgs, lastThis, maxWait, result, timerId, lastCallTime;
8
+
9
+ let lastInvokeTime = 0;
10
+ let leading = false;
11
+ let maxing = false;
12
+ let trailing = true;
13
+
14
+ // 初始化
15
+ if (typeof func !== 'function') {
16
+ throw new TypeError('Expected a function');
17
+ }
18
+ wait = +wait || 0;
19
+ if (isObject(options)) {
20
+ leading = !!options.leading;
21
+ maxing = 'maxWait' in options;
22
+ maxWait = maxing ? Math.max(+options.maxWait || 0, wait) : maxWait;
23
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
24
+ }
25
+
26
+ // 调用func
27
+ function invokeFunc(time) {
28
+ const args = lastArgs;
29
+ const thisArg = lastThis;
30
+
31
+ lastArgs = lastThis = undefined;
32
+ lastInvokeTime = time;
33
+ result = func.apply(thisArg, args);
34
+ return result;
35
+ }
36
+
37
+ // 启动延时
38
+ function startTimer(pendingFunc, wait) {
39
+ return setTimeout(pendingFunc, wait);
40
+ }
41
+
42
+ // 延时开始前
43
+ function leadingEdge(time) {
44
+ lastInvokeTime = time;
45
+ // 启动延时
46
+ timerId = startTimer(timerExpired, wait);
47
+ // 如果是leading模式,延时前调用func
48
+ return leading ? invokeFunc(time) : result;
49
+ }
50
+
51
+ //计算剩余的延时时间:
52
+ //1. 不存在maxWait:(上一次debouncedFunc调用后)延时不能超过wait
53
+ //2. 存在maxWait:func调用不能被延时超过maxWait
54
+ //根据这两种情况计算出最短时间
55
+ function remainingWait(time) {
56
+ const timeSinceLastCall = time - lastCallTime;
57
+ const timeSinceLastInvoke = time - lastInvokeTime;
58
+ const timeWaiting = wait - timeSinceLastCall;
59
+
60
+ return maxing
61
+ ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke)
62
+ : timeWaiting;
63
+ }
64
+
65
+ //判断当前时间是否能调用func:
66
+ //1.首次调用debouncedFunc
67
+ //2.距离上一次debouncedFunc调用后已延迟wait毫秒
68
+ //3.func调用总延迟达到maxWait毫秒
69
+ //4.系统时间倒退
70
+ function shouldInvoke(time) {
71
+ const timeSinceLastCall = time - lastCallTime;
72
+ const timeSinceLastInvoke = time - lastInvokeTime;
73
+ return (
74
+ lastCallTime === undefined ||
75
+ timeSinceLastCall >= wait ||
76
+ timeSinceLastCall < 0 ||
77
+ (maxing && timeSinceLastInvoke >= maxWait)
78
+ );
79
+ }
80
+
81
+ // 延时器回调
82
+ function timerExpired() {
83
+ const time = Date.now();
84
+ // 如果满足时间条件,结束延时
85
+ if (shouldInvoke(time)) {
86
+ return trailingEdge(time);
87
+ }
88
+ // 没满足时间条件,计算剩余等待时间,继续延时
89
+ timerId = startTimer(timerExpired, remainingWait(time));
90
+ }
91
+
92
+ //延时结束后
93
+ function trailingEdge(time) {
94
+ timerId = undefined;
95
+ //如果是trailing模式,调用func
96
+ if (trailing && lastArgs) {
97
+ return invokeFunc(time);
98
+ }
99
+ lastArgs = lastThis = undefined;
100
+ return result;
101
+ }
102
+
103
+ //debouncedFunc
104
+ function debounced(...args) {
105
+ const time = Date.now();
106
+ const isInvoking = shouldInvoke(time);
107
+
108
+ lastArgs = args;
109
+ lastThis = this;
110
+ lastCallTime = time;
111
+
112
+ if (isInvoking) {
113
+ //timerId不存在有两种原因:
114
+ //1. 首次调用
115
+ //2. 上次延时调用结束
116
+ if (timerId === undefined) {
117
+ return leadingEdge(lastCallTime);
118
+ }
119
+ // 存在func调用最长延时限制时,执行func并启动下一次延时,可实现throttle
120
+ if (maxing) {
121
+ timerId = startTimer(timerExpired, wait);
122
+ return invokeFunc(lastCallTime);
123
+ }
124
+ }
125
+ if (timerId === undefined) {
126
+ timerId = startTimer(timerExpired, wait);
127
+ }
128
+ return result;
129
+ }
130
+ return debounced;
131
+ }
132
+
133
+ export default debounce;
@@ -0,0 +1,25 @@
1
+ /**
2
+ *计算某个经纬度的周围某段距离的正方形的四个点
3
+ *
4
+ *@param lng float 经度
5
+ *@param lat float 纬度
6
+ *@param distance float 该点所在圆的半径,该圆与此正方形内切,默认值为0.5千米
7
+ *@return array 正方形的四个点的经纬度坐标
8
+ */
9
+
10
+ function dr_square_point($lng, $lat, $distance = 0.5) {
11
+ $distance = $distance ? $distance : 1;
12
+ let $r = 6371; //地球半径,平均半径为6371km
13
+ let $dlng = 2 * Math.asin(Math.sin($distance / (2 * $r)) / Math.cos($lat * (Math.PI / 180)));
14
+ $dlng = $dlng * (180 / Math.PI);
15
+ let $dlat = $distance / $r;
16
+ $dlat = $dlat * (180 / Math.PI);
17
+ return {
18
+ 'leftTop': [$lat + $dlat, $lng - $dlng],
19
+ 'leftBottom': [$lat - $dlat, $lng - $dlng],
20
+ 'rightBottom': [$lat - $dlat, $lng + $dlng],
21
+ 'rightTop': [$lat + $dlat, $lng + $dlng],
22
+ };
23
+ }
24
+
25
+ export default dr_square_point;