@cloudbase/weda-ui-mp 3.20.1 → 3.20.2

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.
@@ -47,7 +47,7 @@ Component({
47
47
  type: Boolean,
48
48
  value: true,
49
49
  },
50
- defauleShowLocation: {
50
+ defaultShowLocation: {
51
51
  type: Boolean,
52
52
  value: true,
53
53
  },
@@ -107,9 +107,7 @@ Component({
107
107
  const { locationType, dataSource } = this.properties;
108
108
  const getReverseGeocoder = async (location) => {
109
109
  const { isApikeyStatus } = this.data;
110
- let key = isApikeyStatus.apiKey
111
- ? isApikeyStatus.apiKey
112
- : await this.getApikey(dataSource.name, 'get');
110
+ let key = isApikeyStatus.apiKey ? isApikeyStatus.apiKey : await this.getApikey(dataSource.name, 'get');
113
111
  if (key) {
114
112
  qqmapsdk = new QQMapWX({
115
113
  key: key,
@@ -123,9 +121,7 @@ Component({
123
121
  poiname: result?.formatted_addresses?.recommend,
124
122
  detailedAddress: result?.address,
125
123
  };
126
- let isCustomLocation = this.checkCustomLocation(
127
- this.properties.value
128
- );
124
+ let isCustomLocation = this.checkCustomLocation(this.properties.value);
129
125
  if (isCustomLocation) {
130
126
  this.setData({
131
127
  currentLocations: detailLocation,
@@ -156,16 +152,10 @@ Component({
156
152
  detailedAddress: '',
157
153
  };
158
154
  // 表单为新增时回传点位信息
159
- let isCustomLocation = this.checkCustomLocation(
160
- this.properties.value
161
- );
155
+ let isCustomLocation = this.checkCustomLocation(this.properties.value);
162
156
  let customLocation = {
163
- latitude: isCustomLocation
164
- ? this.properties.value?.geopoint?.coordinates[1]
165
- : '',
166
- longitude: isCustomLocation
167
- ? this.properties.value?.geopoint?.coordinates[0]
168
- : '',
157
+ latitude: isCustomLocation ? this.properties.value?.geopoint?.coordinates[1] : '',
158
+ longitude: isCustomLocation ? this.properties.value?.geopoint?.coordinates[0] : '',
169
159
  poiname: this.properties.value?.address,
170
160
  detailedAddress: this.properties.value?.detailedAddress,
171
161
  };
@@ -176,10 +166,7 @@ Component({
176
166
  message: '',
177
167
  },
178
168
  });
179
- this.setLocation(
180
- isCustomLocation ? customLocation : location,
181
- isCustomLocation
182
- );
169
+ this.setLocation(isCustomLocation ? customLocation : location, isCustomLocation);
183
170
  if (!isCustomLocation) {
184
171
  locationType !== 1 && this.setData({ isAddrShow: true });
185
172
  } else {
@@ -199,10 +186,7 @@ Component({
199
186
  };
200
187
  const getCustomInfoLocation = () => {
201
188
  let customInfoLocation = customInfo.getCurrentLocation();
202
- if (
203
- !!customInfoLocation &&
204
- typeof customInfoLocation.then === 'function'
205
- ) {
189
+ if (!!customInfoLocation && typeof customInfoLocation.then === 'function') {
206
190
  customInfoLocation
207
191
  .then((res) => {
208
192
  drowMapMarks(res);
@@ -410,10 +394,7 @@ Component({
410
394
  this.changeValueFormat(location);
411
395
  },
412
396
  checkCustomLocation(params) {
413
- if (
414
- !params?.address ||
415
- (params?.geopoint?.type && params?.geopoint?.type != 'Point')
416
- ) {
397
+ if (!params?.address || (params?.geopoint?.type && params?.geopoint?.type != 'Point')) {
417
398
  return false;
418
399
  }
419
400
  return true;
@@ -465,11 +446,7 @@ Component({
465
446
  value: function (value) {
466
447
  const currentLocations = this.data.currentLocations;
467
448
  if (value || !currentLocations.latitude) {
468
- const {
469
- geopoint: { coordinates } = {},
470
- address: poiname,
471
- detailedAddress,
472
- } = value || {};
449
+ const { geopoint: { coordinates } = {}, address: poiname, detailedAddress } = value || {};
473
450
 
474
451
  if (!coordinates?.[0]) return;
475
452
 
@@ -512,7 +489,7 @@ Component({
512
489
  {
513
490
  'weui-flex': isFlex,
514
491
  [className]: className,
515
- }
492
+ },
516
493
  );
517
494
  this.setData({ cls });
518
495
  },
@@ -272,7 +272,7 @@ export default Behavior({
272
272
  type: Boolean,
273
273
  value: false,
274
274
  },
275
- defauleShowLocation: {
275
+ defaultShowLocation: {
276
276
  type: Boolean,
277
277
  value: true,
278
278
  },
@@ -31,7 +31,7 @@ Component({
31
31
  type: Boolean,
32
32
  value: true,
33
33
  },
34
- defauleShowLocation: {
34
+ defaultShowLocation: {
35
35
  type: Boolean,
36
36
  value: true,
37
37
  },
@@ -14,7 +14,7 @@
14
14
  customLocation="{{customLocation}}"
15
15
  customRange="{{customRange}}"
16
16
  dataSource="{{dataSource}}"
17
- defauleShowLocation="{{defauleShowLocation}}"
17
+ defaultShowLocation="{{defaultShowLocation}}"
18
18
  drag="{{drag}}"
19
19
  locationType="{{locationType}}"
20
20
  locationRange="{{locationRange}}"
@@ -1,11 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-magic-numbers */
2
2
  import { commonCompBehavior } from '../../utils/common-behavior';
3
- import {
4
- getStartMoment,
5
- convertValueToDateItem,
6
- getYMD,
7
- convertMethodParam,
8
- } from '../../utils/getFormLegacy';
3
+ import { getStartMoment, convertValueToDateItem, getYMD, convertMethodParam } from '../../utils/getFormLegacy';
9
4
  import { WEEKS, getConfigDataObj, convertWeeks } from './weeks';
10
5
 
11
6
  Component({
@@ -41,6 +36,12 @@ Component({
41
36
  type: Array,
42
37
  value: [],
43
38
  },
39
+ start: {
40
+ type: null,
41
+ },
42
+ end: {
43
+ type: null,
44
+ },
44
45
  },
45
46
  data: {
46
47
  currentValue: null, // 时间戳
@@ -114,10 +115,7 @@ Component({
114
115
  const { _oldCurrentValue, _oldCurrentMonthValue } = this.data;
115
116
  const currentValue = getStartMoment('day', value, false)?.valueOf();
116
117
  const currentMonthValue = getStartMoment('month', initMonth)?.valueOf();
117
- if (
118
- currentValue !== _oldCurrentValue ||
119
- currentMonthValue !== _oldCurrentMonthValue
120
- ) {
118
+ if (currentValue !== _oldCurrentValue || currentMonthValue !== _oldCurrentMonthValue) {
121
119
  this.setData({
122
120
  currentValue,
123
121
  currentMonthValue,
@@ -136,12 +134,14 @@ Component({
136
134
  const checkedDay = getYMD(dateItem);
137
135
  this.setData({ checkedDay });
138
136
  },
139
- 'currentMonthValue,configDataObj': function (
140
- currentMonthValue,
141
- configDataObj
142
- ) {
143
- const { year, month } = convertValueToDateItem(currentMonthValue);
144
- const weeks = convertWeeks(year, month, configDataObj);
137
+ 'currentMonthValue,configDataObj,start,end': function (currentMonthValue, configDataObj, start, end) {
138
+ const dateItem = convertValueToDateItem(currentMonthValue);
139
+ if (!dateItem) {
140
+ console.error('Invalid date item returned from convertValueToDateItem');
141
+ return;
142
+ }
143
+ const { year, month } = dateItem;
144
+ const weeks = convertWeeks(year, month, configDataObj, [start, end]);
145
145
  const yearMonthDisplay = `${year}年${month + 1}月`;
146
146
  this.setData({ weeks, yearMonthDisplay });
147
147
  },
@@ -1,9 +1,4 @@
1
- import {
2
- getStartMoment,
3
- convertValueToDateItem,
4
- getYMD,
5
- convertYearMonthToWeeks,
6
- } from '../../utils/getFormLegacy';
1
+ import { getStartMoment, convertValueToDateItem, getYMD, convertYearMonthToWeeks } from '../../utils/getFormLegacy';
7
2
 
8
3
  export const WEEKS = ['日', '一', '二', '三', '四', '五', '六'];
9
4
  export const BLOCK_NAME = 'weda-calendar';
@@ -25,8 +20,8 @@ export const getConfigDataObj = (configData) => {
25
20
  };
26
21
 
27
22
  // 带上外部配置,转星期
28
- export const convertWeeks = (year, month, configDataObj) => {
29
- const weeks = convertYearMonthToWeeks(year, month, null, {
23
+ export const convertWeeks = (year, month, configDataObj, range) => {
24
+ const weeks = convertYearMonthToWeeks(year, month, range, {
30
25
  isPreNext: true,
31
26
  isDynamic: true,
32
27
  });
@@ -14,6 +14,7 @@
14
14
 
15
15
  .wd-image {
16
16
  max-width: 100%;
17
+ vertical-align: middle;
17
18
  }
18
19
 
19
20
  @media screen and (max-width: 768px) {
@@ -31,7 +31,7 @@
31
31
  customLocation="{{customLocation}}"
32
32
  customRange="{{customRange}}"
33
33
  dataSource="{{dataSource}}"
34
- defauleShowLocation="{{defauleShowLocation}}"
34
+ defaultShowLocation="{{defaultShowLocation}}"
35
35
  drag="{{drag}}"
36
36
  locationType="{{locationType}}"
37
37
  locationRange="{{locationRange}}"
@@ -147,7 +147,7 @@ Component({
147
147
  _option = range;
148
148
  }
149
149
  const label = this.getLabels(value, _option);
150
- const checkRange = this.getChecks(value, _option, this.data.displayValue);
150
+ const checkRange = this.getChecks(value, _option);
151
151
  // 默认
152
152
  this.setData({
153
153
  option: checkRange,
@@ -284,13 +284,13 @@ Component({
284
284
  this._fetchData({ pageNo, searchValue });
285
285
  }
286
286
  },
287
- getLabels: function (values, options, _preLabel) {
287
+ getLabels: function (values, options) {
288
288
  let labels = values;
289
289
  if (Array.isArray(values) && Array.isArray(options)) {
290
290
  const rm = arrayToMap(options, 'value');
291
291
  labels = values.map((d) => {
292
292
  const obj = rm[d];
293
- let item = lodashGet(obj, 'text') ?? lodashGet(obj, 'label') ?? _preLabel ?? d;
293
+ let item = lodashGet(obj, 'text') ?? lodashGet(obj, 'label') ?? d;
294
294
  return textToString(item);
295
295
  });
296
296
  }
@@ -2,7 +2,7 @@
2
2
  <view class="{{classPrefix + '-tabs__header'}}">
3
3
  <view class="{{classPrefix + '-tabs__header-item-wrap' }}">
4
4
  <view class="{{classPrefix + '-tabs__header-item-content'}}">
5
- <scroll-view scroll-x="true" scroll-into-view="{{scrollId}}" class="{{classPrefix + '-tabs__scroll'}}" enable-flex="true" wx:if="{{direction!=='vertical'}}">
5
+ <scroll-view scroll-x="true" scroll-into-view="{{scrollId}}" class="{{classPrefix + '-tabs__scroll'}}" enable-flex="true" enhanced="{{true}}" show-scrollbar="{{false}}" wx:if="{{direction!=='vertical'}}" >
6
6
  <view wx:for="{{list}}" class="{{classPrefix + '-tabs__item'}} {{item.selected?'is-selected':''}} {{item.isDisabled?'is-disabled':''}}" wx:for-index="index" wx:for-item="item" wx:key="index" id="{{'cell-'+index}}" bindtap="onItemClick" data-value="{{index}}" data-item="{{item}}">
7
7
  <view wx-if="{{item.iconType !== 'none' && item.iconPosition === 'prefix'}}" class="{{classPrefix + '-tabs__item-icon'}}">
8
8
  <wd-icon type="{{item.iconType}}" name="{{ item.iconType === 'inner' ? item.innerIcon : item.outerImage}}" src="{{item.iconType === 'custom' ? item.outerImage : ''}}" size="xs" />
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "miniprogram": "./",
4
4
  "packageManager": "yarn@3.0.2",
5
5
  "dependencies": {},
6
- "version": "3.20.1",
6
+ "version": "3.20.2",
7
7
  "main": "./",
8
8
  "publishConfig": {
9
9
  "access": "public"
package/utils/enum.js CHANGED
@@ -1051,6 +1051,7 @@ export const PROPS_WHERE_REL_MEMBER = [].concat(PROPS_WHERE_REL, [
1051
1051
  export const WD_LOCATION_TYPE = [
1052
1052
  { label: '无', value: 1 },
1053
1053
  { label: '用户当前位置', value: 2 },
1054
+ { label: '自定义位置', value: 3 },
1054
1055
  ];
1055
1056
 
1056
1057
  export const WD_LOCATION_RANGE = [