@cloudbase/weda-ui 3.13.7 → 3.14.0

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';
@@ -234,11 +234,13 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
234
234
  }
235
235
  })
236
236
  .catch((error) => {
237
+ var _a;
237
238
  setSearchLoadingStatus(false);
238
239
  setRealLocation({ lat, lng }, []);
239
240
  errorHandler({
240
241
  code: 'WdLocation.exploreNear',
241
242
  error,
243
+ message: ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('调用量已达到上限')) ? '附近搜索失败,请调整/ws/place/v1/explore配额' : '',
242
244
  });
243
245
  });
244
246
  }, 500);
@@ -270,9 +272,13 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
270
272
  }
271
273
  })
272
274
  .catch((error) => {
275
+ var _a;
273
276
  errorHandler({
274
277
  code: 'WdLocation.getAddress',
275
278
  error,
279
+ message: ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('调用量已达到上限'))
280
+ ? '地址解析失败,请调整/ws/geocoder/v1/?address=*配额'
281
+ : '',
276
282
  });
277
283
  let item = {
278
284
  id: 'current-location',
@@ -323,9 +329,13 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
323
329
  }
324
330
  })
325
331
  .catch((error) => {
332
+ var _a;
326
333
  errorHandler({
327
334
  code: 'WdLocation.getSuggestion',
328
335
  error,
336
+ message: ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('调用量已达到上限'))
337
+ ? '关键词输入提示失败,请调整/ws/place/v1/suggestion配额'
338
+ : '',
329
339
  });
330
340
  });
331
341
  }
@@ -415,14 +425,14 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
415
425
  e.stopPropagation();
416
426
  }, ref: searchListRef, onScroll: searchListOnScroll, children: (isSearch ? searchList : exploreList).map((item, index) => (_jsx("div", { className: "weda-ui_mapChoose_search_list_li", onClick: () => {
417
427
  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))) })] }));
428
+ }, 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
429
  };
420
430
  const renderOutTip = () => {
421
431
  return (_jsxs("div", { className: classNames({
422
432
  'weda-ui_mapChoose_outTip': true,
423
433
  'weda-ui_mapChoose_outTip_block': isOutofrange,
424
434
  '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" })] }));
435
+ }), 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
436
  };
427
437
  const getRadius = () => {
428
438
  let radius = 0;
@@ -437,6 +447,7 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
437
447
  // 获取设备最新位置
438
448
  const getLatestLc = function () {
439
449
  return new Promise((resolve) => {
450
+ var _a;
440
451
  try {
441
452
  if (userLocation) {
442
453
  resolve(userLocation);
@@ -470,6 +481,9 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
470
481
  errorHandler({
471
482
  code: 'WdLocation.getLatestLocation',
472
483
  error: e,
484
+ message: ((_a = e === null || e === void 0 ? void 0 : e.message) === null || _a === void 0 ? void 0 : _a.includes('调用量已达到上限'))
485
+ ? '坐标转换失败,请调整/ws/geocoder/v1/?location=*配额'
486
+ : '',
473
487
  });
474
488
  resolve(null);
475
489
  }
@@ -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);
@@ -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.0",
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",