@cloudbase/weda-ui 3.13.7 → 3.14.1

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.
@@ -5,7 +5,7 @@ import * as React from 'react';
5
5
  import classNames from '../../../../utils/classnames';
6
6
  import debounce from '../../../../utils/debounce';
7
7
  import { tmapApiUrl } from '../constants';
8
- import { getTMap, calculateDistance, base64LocationIcon, } from '../../../../utils/tmap';
8
+ import { getTMap, calculateDistance, base64LocationIcon } from '../../../../utils/tmap';
9
9
  import { errorHandler } from '../../../../utils/error';
10
10
  import { Icon } from 'tea-component';
11
11
  import { inH5IsMobile } from '../../../../utils/platform';
@@ -54,7 +54,7 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
54
54
  function loadScript() {
55
55
  const script = document.createElement('script');
56
56
  script.type = 'text/javascript';
57
- script.src = `${tmapApiUrl}?v=2.exp&key=${APIKEY}&callback=init&libraries=service`;
57
+ script.src = `${tmapApiUrl}?v=2.exp&key=${APIKEY}&libraries=service`;
58
58
  script.onload = () => {
59
59
  initMap();
60
60
  };
@@ -69,7 +69,6 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
69
69
  else {
70
70
  loadScript();
71
71
  }
72
- exploreNear('updateCenter');
73
72
  return () => {
74
73
  mapRef.current && mapRef.current.destroy();
75
74
  };
@@ -80,16 +79,26 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
80
79
  const initMap = () => {
81
80
  if (!getTMap())
82
81
  return;
83
- const TMap = getTMap();
84
- //定义地图中心点坐标
85
- const center = new TMap.LatLng(lat, lng);
86
- //定义map变量,调用 TMap.Map() 构造函数创建地图
87
- mapRef.current = new TMap.Map(document.getElementById(`form-map-choose-${mapDomName.current}`), {
88
- center,
89
- zoom: 16, //设置地图缩放级别
90
- });
91
- initMarker(TMap, mapRef.current);
92
- getRadius() && initCircle(TMap, mapRef.current);
82
+ try {
83
+ const TMap = getTMap();
84
+ //定义地图中心点坐标
85
+ const center = new TMap.LatLng(lat, lng);
86
+ //定义map变量,调用 TMap.Map() 构造函数创建地图
87
+ mapRef.current = new TMap.Map(document.getElementById(`form-map-choose-${mapDomName.current}`), {
88
+ center,
89
+ zoom: 16, //设置地图缩放级别
90
+ });
91
+ initMarker(TMap, mapRef.current);
92
+ getRadius() && initCircle(TMap, mapRef.current);
93
+ exploreNear('updateCenter');
94
+ }
95
+ catch (error) {
96
+ errorHandler({
97
+ code: 'WdLocation.initMap',
98
+ error,
99
+ message: `初始化地图失败,请检查APIKEY【${APIKEY}】是否正确,或者检查是否有配额`,
100
+ });
101
+ }
93
102
  };
94
103
  const initMarker = (TMap, map) => {
95
104
  const canLoad = lat && lng && TMap && map;
@@ -234,11 +243,15 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
234
243
  }
235
244
  })
236
245
  .catch((error) => {
246
+ var _a;
237
247
  setSearchLoadingStatus(false);
238
248
  setRealLocation({ lat, lng }, []);
239
249
  errorHandler({
240
250
  code: 'WdLocation.exploreNear',
241
251
  error,
252
+ message: ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('调用量已达到上限'))
253
+ ? `附近搜索失败,请检查APIKEY【${APIKEY}】是否正确,调整/ws/place/v1/explore配额`
254
+ : '',
242
255
  });
243
256
  });
244
257
  }, 500);
@@ -270,9 +283,13 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
270
283
  }
271
284
  })
272
285
  .catch((error) => {
286
+ var _a;
273
287
  errorHandler({
274
288
  code: 'WdLocation.getAddress',
275
289
  error,
290
+ message: ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('调用量已达到上限'))
291
+ ? `地址解析失败,请检查APIKEY【${APIKEY}】是否正确,调整/ws/geocoder/v1/?address=*配额`
292
+ : '',
276
293
  });
277
294
  let item = {
278
295
  id: 'current-location',
@@ -323,9 +340,13 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
323
340
  }
324
341
  })
325
342
  .catch((error) => {
343
+ var _a;
326
344
  errorHandler({
327
345
  code: 'WdLocation.getSuggestion',
328
346
  error,
347
+ message: ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('调用量已达到上限'))
348
+ ? `关键词输入提示失败,请检查APIKEY【${APIKEY}】是否正确,调整/ws/place/v1/suggestion配额`
349
+ : '',
329
350
  });
330
351
  });
331
352
  }
@@ -415,14 +436,14 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
415
436
  e.stopPropagation();
416
437
  }, ref: searchListRef, onScroll: searchListOnScroll, children: (isSearch ? searchList : exploreList).map((item, index) => (_jsx("div", { className: "weda-ui_mapChoose_search_list_li", onClick: () => {
417
438
  chooseLoction(item);
418
- }, children: _jsxs("div", { className: "weda-ui_mapChoose_search_list_li_wrap", children: [_jsx("div", { className: "weda-ui_mapChoose_search_list_li_title", children: item.title }), _jsx("div", { className: "weda-ui_mapChoose_search_list_li_con", children: item.address }), item.id === chooseLoc.id && (_jsx("span", { className: "weda-ui_mapChoose_search_list_li_con_choosed" }))] }) }, index))) })] }));
439
+ }, children: _jsxs("div", { className: "weda-ui_mapChoose_search_list_li_wrap", children: [_jsx("div", { className: "weda-ui_mapChoose_search_list_li_title", children: item.title }), _jsx("div", { className: "weda-ui_mapChoose_search_list_li_con", children: item.address }), item.id === chooseLoc.id && _jsx("span", { className: "weda-ui_mapChoose_search_list_li_con_choosed" })] }) }, index))) })] }));
419
440
  };
420
441
  const renderOutTip = () => {
421
442
  return (_jsxs("div", { className: classNames({
422
443
  'weda-ui_mapChoose_outTip': true,
423
444
  'weda-ui_mapChoose_outTip_block': isOutofrange,
424
445
  'weda-ui_mapChoose_outTip_pc': isPC,
425
- }), children: [isOutofrange && (_jsx(Icon, { type: "warning", size: "default", color: "#ED7B2F", style: { marginRight: '9px' } })), isOutofrange && _jsx("span", { children: "\u5B9A\u4F4D\u8D85\u51FA\u5141\u8BB8\u8303\u56F4,\u8BF7\u8C03\u6574" })] }));
446
+ }), children: [isOutofrange && _jsx(Icon, { type: "warning", size: "default", color: "#ED7B2F", style: { marginRight: '9px' } }), isOutofrange && _jsx("span", { children: "\u5B9A\u4F4D\u8D85\u51FA\u5141\u8BB8\u8303\u56F4,\u8BF7\u8C03\u6574" })] }));
426
447
  };
427
448
  const getRadius = () => {
428
449
  let radius = 0;
@@ -437,6 +458,7 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
437
458
  // 获取设备最新位置
438
459
  const getLatestLc = function () {
439
460
  return new Promise((resolve) => {
461
+ var _a;
440
462
  try {
441
463
  if (userLocation) {
442
464
  resolve(userLocation);
@@ -470,6 +492,9 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
470
492
  errorHandler({
471
493
  code: 'WdLocation.getLatestLocation',
472
494
  error: e,
495
+ message: ((_a = e === null || e === void 0 ? void 0 : e.message) === null || _a === void 0 ? void 0 : _a.includes('调用量已达到上限'))
496
+ ? `坐标转换失败,请检查APIKEY【${APIKEY}】是否正确,调整/ws/geocoder/v1/?location=*配额`
497
+ : '',
473
498
  });
474
499
  resolve(null);
475
500
  }
@@ -57,6 +57,7 @@
57
57
  .wd-status-content .wd-status-content__content.table {
58
58
  background-color: unset;
59
59
  height: 160px;
60
+ display: flex;
60
61
  }
61
62
  .wd-status-content .wd-status-content__content.listview {
62
63
  background-color: unset;
@@ -24,13 +24,13 @@ export const ImagePreview = (props) => {
24
24
  const previewStyle = platform === 'h5'
25
25
  ? {
26
26
  touchAction: 'none',
27
- backgroundImage: `url('${realSrc || src}')`,
27
+ // backgroundImage: `url('${realSrc || src}')`,
28
28
  transform: `translate(${translateX}px, ${translateY}px) scale(${previewScale})`,
29
29
  ...style,
30
30
  }
31
31
  : {
32
32
  touchAction: 'none',
33
- backgroundImage: `url('${realSrc || src}')`,
33
+ // backgroundImage: `url('${realSrc || src}')`,
34
34
  transform: `rotate(${rotate}deg)`,
35
35
  ...style,
36
36
  };
@@ -100,7 +100,7 @@ export const ImagePreview = (props) => {
100
100
  e.stopPropagation();
101
101
  }
102
102
  setVisible(false);
103
- }, className: `${classPrefix}-image-mask__close-btn`, children: _jsx("i", { className: `${classPrefix}-image-mask__icon-close` }) }), _jsx("div", { ...bind(), className: `${classPrefix}-image-preview`, style: previewStyle }), platform === 'pc' && (_jsxs("div", { className: `${classPrefix}-image-preview-toolbar`, children: [(previewImageList === null || previewImageList === void 0 ? void 0 : previewImageList.length) > 1 && (_jsxs(_Fragment, { children: [_jsx("span", { className: "wd-icon-wrap wd-event-tap", children: _jsx(WdIcon, { name: 'td:chevron-left', size: "sm", events: {
103
+ }, className: `${classPrefix}-image-mask__close-btn`, children: _jsx("i", { className: `${classPrefix}-image-mask__icon-close` }) }), _jsx("div", { ...bind(), className: `${classPrefix}-image-preview ${classPrefix}-${platform}-image-preview`, style: previewStyle, children: _jsx("img", { style: { backgroundImage: `url('${realSrc || src}')` }, className: `${classPrefix}-image-preview-img`, src: realSrc || src }) }), platform === 'pc' && (_jsxs("div", { className: `${classPrefix}-image-preview-toolbar`, children: [(previewImageList === null || previewImageList === void 0 ? void 0 : previewImageList.length) > 1 && (_jsxs(_Fragment, { children: [_jsx("span", { className: "wd-icon-wrap wd-event-tap", children: _jsx(WdIcon, { name: 'td:chevron-left', size: "sm", events: {
104
104
  tap: (arg, { originEvent: e }) => {
105
105
  e === null || e === void 0 ? void 0 : e.stopPropagation();
106
106
  const index = previewImageList.findIndex((i) => i === currentImg);
@@ -25,8 +25,10 @@
25
25
  border-radius: 100%;
26
26
  margin-right: 15px;
27
27
  }
28
- .wd-store-home__footer {
28
+ .wd-store-home__wrap .wd-store-home__footer {
29
29
  border-top: 1px solid #f2f2f2;
30
+ }
31
+ .wd-store-home__footer {
30
32
  font-size: 12px;
31
33
  padding: 5px 0;
32
34
  display: flex;
@@ -2,7 +2,7 @@
2
2
  import type { CommonPropsType } from '../../types';
3
3
  import type { DataType } from '../../../configs/components/wd-store-product';
4
4
  import './style';
5
- export default function WdStoreProduct({ className, id }: WdStoreProductProps): JSX.Element;
5
+ export default function WdStoreProduct(props: WdStoreProductProps): JSX.Element;
6
6
  interface WdStoreProductProps extends CommonPropsType, DataType {
7
7
  }
8
8
  export { type WdStoreProductProps };
@@ -4,10 +4,11 @@ import './style';
4
4
  import WdButton from '../wd-button';
5
5
  import { useCanPreview } from '../../utils/hooks/useCanPreview';
6
6
  import { useConfig } from '../../utils/config-context';
7
- export default function WdStoreProduct({ className, id }) {
7
+ export default function WdStoreProduct(props) {
8
+ const { className, id, customContent, children } = props;
8
9
  const { classPrefix } = useConfig();
9
10
  const canPreview = useCanPreview();
10
11
  if (!canPreview)
11
12
  return null;
12
- return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(Bubble, { placement: "auto", openDelay: 300, content: _jsxs(_Fragment, { children: ["\u8BE5\u7EC4\u4EF6\u5FC5\u987B\u5728\u5C0F\u7A0B\u5E8F\u771F\u5B9E\u73AF\u5883\u4F7F\u7528\u624D\u80FD\u591F\u770B\u5230\u5B9E\u9645\u6548\u679C\u3002", _jsx("br", {}), _jsx("a", { href: "https://developers.weixin.qq.com/miniprogram/dev/component/store-product.html", target: "_blank", rel: "noreferrer", children: "\u67E5\u770B\u8BF4\u660E" })] }), children: _jsxs("div", { className: `${className} ${classPrefix}-store-product__wrap`, id: id, children: [_jsxs("div", { className: `${classPrefix}-store-home__content`, children: [_jsx("img", { className: `${classPrefix}-store-product__img`, src: "https://qcloudimg.tencent-cloud.cn/raw/4a29d51b504f12b4933ce4490110b4dc.svg", alt: "" }), _jsxs("div", { className: `${classPrefix}-store-product__text`, children: [_jsxs("div", { children: [_jsx("p", { className: `${classPrefix}-store-home__title`, children: "\u5546\u54C1\u540D\u79F0" }), _jsx("span", { className: `${classPrefix}-store-home__label`, children: "\u5546\u54C1\u6807\u7B7E" })] }), _jsxs("div", { className: `${classPrefix}-store-product__text__footer`, children: [_jsx("p", { className: "price", children: "\u00A5\u4EF7\u683C \u8D77" }), " ", _jsx(WdButton, { text: "\u8D2D\u4E70" })] })] })] }), _jsxs("div", { className: `${classPrefix}-store-home__footer`, children: [_jsx("i", { className: `${classPrefix}-store-home__icon` }), "\u5C0F\u5E97\u540D\u79F0"] })] }) }) }));
13
+ return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(Bubble, { placement: "auto", openDelay: 300, content: _jsxs(_Fragment, { children: ["\u8BE5\u7EC4\u4EF6\u5FC5\u987B\u5728\u5C0F\u7A0B\u5E8F\u771F\u5B9E\u73AF\u5883\u4F7F\u7528\u624D\u80FD\u591F\u770B\u5230\u5B9E\u9645\u6548\u679C\u3002", _jsx("br", {}), _jsx("a", { href: "https://developers.weixin.qq.com/miniprogram/dev/component/store-product.html", target: "_blank", rel: "noreferrer", children: "\u67E5\u770B\u8BF4\u660E" })] }), children: _jsxs("div", { className: `${className} ${customContent ? '' : classPrefix + '-store-product__wrap'}`, id: id, children: [customContent ? (children) : (_jsx("div", { className: `${classPrefix}-store-home__content`, children: _jsxs(_Fragment, { children: [_jsx("img", { className: `${classPrefix}-store-product__img`, src: "https://qcloudimg.tencent-cloud.cn/raw/4a29d51b504f12b4933ce4490110b4dc.svg", alt: "" }), _jsxs("div", { className: `${classPrefix}-store-product__text`, children: [_jsxs("div", { children: [_jsx("p", { className: `${classPrefix}-store-home__title`, children: "\u5546\u54C1\u540D\u79F0" }), _jsx("span", { className: `${classPrefix}-store-home__label`, children: "\u5546\u54C1\u6807\u7B7E" })] }), _jsxs("div", { className: `${classPrefix}-store-product__text__footer`, children: [_jsx("p", { className: "price", children: "\u00A5\u4EF7\u683C \u8D77" }), " ", _jsx(WdButton, { text: "\u8D2D\u4E70" })] })] })] }) })), _jsxs("div", { className: `${classPrefix}-store-home__footer`, children: [_jsx("i", { className: `${classPrefix}-store-home__icon` }), "\u5C0F\u5E97\u540D\u79F0"] })] }) }) }));
13
14
  }
@@ -9,7 +9,7 @@ import { filterFieldsGenerate } from './filterFieldsGenerate';
9
9
  import { WdButton } from '../../../wd-button';
10
10
  import { usePlatform } from '../../../../utils/platform';
11
11
  import { useSetWidgetApi } from '../../../../utils/widget-api/use-set-widget-api';
12
- const getFilterConfig = (data) => data.map(({ name, label, value, fieldCalculationOption = [], fieldCalculation, }) => ({
12
+ const getFilterConfig = (data) => data.map(({ name, label, value, fieldCalculationOption = [], fieldCalculation }) => ({
13
13
  name,
14
14
  label,
15
15
  value,
@@ -18,7 +18,7 @@ const getFilterConfig = (data) => data.map(({ name, label, value, fieldCalculati
18
18
  }));
19
19
  // 筛选表单
20
20
  export const FilterFieldsPanel = forwardRef(function Comp(props, ref) {
21
- const { filterFields, fetchData, openMobileFilter, setOpenMobileFilter, setFilterConfig, } = props;
21
+ const { filterFields, fetchData, openMobileFilter, setOpenMobileFilter, setFilterConfig } = props;
22
22
  const num = 2;
23
23
  const maxlength = 3;
24
24
  const { classPrefix } = useConfig();
@@ -27,7 +27,7 @@ export const FilterFieldsPanel = forwardRef(function Comp(props, ref) {
27
27
  const [initFilterData, setInitFilterData] = useState([]);
28
28
  const [filterData, setFilterData] = useState([]);
29
29
  const updateFilterData = (filterFieldItemConfig) => {
30
- const newData = filterData.map((i) => i.id === filterFieldItemConfig.id ? filterFieldItemConfig : i);
30
+ const newData = filterData.map((i) => (i.id === filterFieldItemConfig.id ? filterFieldItemConfig : i));
31
31
  setFilterData(newData);
32
32
  setFilterConfig(getFilterConfig(newData));
33
33
  };
@@ -54,9 +54,7 @@ export const FilterFieldsPanel = forwardRef(function Comp(props, ref) {
54
54
  const searchHandle = (searchData = filterData) => {
55
55
  let searchValues = [];
56
56
  const filterValues = searchData.filter((i) => {
57
- if (Array.isArray(i.value) &&
58
- i.filterType === 'number' &&
59
- i.fieldCalculation.value === 'scope') {
57
+ if (Array.isArray(i.value) && i.filterType === 'number' && i.fieldCalculation.value === 'scope') {
60
58
  // 若筛选字段为number类型,且为范围选择时,只要有一个值则返回
61
59
  return i.value[0] || i.value[1];
62
60
  }
@@ -72,10 +70,7 @@ export const FilterFieldsPanel = forwardRef(function Comp(props, ref) {
72
70
  var _a;
73
71
  if (n.$and) {
74
72
  return {
75
- $and: [
76
- ...n.$and,
77
- { [i.name]: { [(_a = i === null || i === void 0 ? void 0 : i.fieldCalculation) === null || _a === void 0 ? void 0 : _a.value]: '1' } },
78
- ],
73
+ $and: [...n.$and, { [i.name]: { [(_a = i === null || i === void 0 ? void 0 : i.fieldCalculation) === null || _a === void 0 ? void 0 : _a.value]: '1' } }],
79
74
  };
80
75
  }
81
76
  return n;
@@ -90,6 +85,7 @@ export const FilterFieldsPanel = forwardRef(function Comp(props, ref) {
90
85
  });
91
86
  // 值筛选条件
92
87
  filterValues.forEach((i) => {
88
+ var _a, _b, _c;
93
89
  switch (i.fieldCalculation.value) {
94
90
  case 'scope':
95
91
  if (i.filterType === 'number') {
@@ -126,17 +122,17 @@ export const FilterFieldsPanel = forwardRef(function Comp(props, ref) {
126
122
  case 'exclude':
127
123
  searchValues.push({
128
124
  key: i.name,
129
- val: `^((?!${i.value}).)*$`,
125
+ val: `^((?!${(_a = i.value) === null || _a === void 0 ? void 0 : _a.trim()}).)*$`,
130
126
  rel: 'regex',
131
127
  });
132
128
  break;
133
129
  case 'startWith':
134
- searchValues.push({ key: i.name, val: `^${i.value}`, rel: 'regex' });
130
+ searchValues.push({ key: i.name, val: `^${(_b = i.value) === null || _b === void 0 ? void 0 : _b.trim()}`, rel: 'regex' });
135
131
  break;
136
132
  default: {
137
133
  const searchItem = {
138
134
  key: i.name,
139
- val: i.value,
135
+ val: (_c = i.value) === null || _c === void 0 ? void 0 : _c.trim(),
140
136
  rel: i.fieldCalculation.value,
141
137
  };
142
138
  if (i.filterType === 'number') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/weda-ui",
3
- "version": "3.13.7",
3
+ "version": "3.14.1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index",
6
6
  "miniprogram": "mpdist",
@@ -43,7 +43,7 @@
43
43
  "prestart:e2e-server": "node ./tools/e2e-prepare.mjs",
44
44
  "start:e2e-server": "node ./lowcode-comps/e2e-server.js",
45
45
  "test:e2e-component": "npm run build-mp && npx cypress run --component",
46
- "test:e2e-cals": "start-server-and-test start:e2e-server 2333 'npx cypress run -b chrome --headless'",
46
+ "test:e2e-cals": "WAIT_ON_TIMEOUT=900000 start-server-and-test start:e2e-server 2333 'npx cypress run -b chrome --headless'",
47
47
  "test:manual-e2e-cals": "start-server-and-test start:e2e-server 2333 'npx cypress open -b chrome'",
48
48
  "test:e2e": "npm run test:e2e-component && npm run test:e2e-cals",
49
49
  "posttest:e2e-cals": "npm run e2e:report",
@@ -85,7 +85,7 @@
85
85
  "description": "腾讯云微搭低代码组件库模板",
86
86
  "dependencies": {
87
87
  "@antv/g6": "^4.8.5",
88
- "@cloudbase/weda-client": "^1.1.17",
88
+ "@cloudbase/weda-client": "^1.1.21",
89
89
  "@codemirror/autocomplete": "^6.16.0",
90
90
  "@codemirror/lang-javascript": "^6.2.2",
91
91
  "@codemirror/lang-json": "^6.0.1",