@cloudbase/weda-ui-mp 3.19.0 → 3.20.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.
@@ -72,9 +72,9 @@ Component({
72
72
  * 用于同步子组件的默认值
73
73
  * @param params
74
74
  */
75
- __setValueImmediate__(params) {
76
- that.changeByChildFormObj(params);
77
- },
75
+ // __setValueImmediate__(params) {
76
+ // that.changeByChildFormObj(params);
77
+ // },
78
78
  /**
79
79
  * 嵌套表单内部子组件值改变时,触发嵌套表单组件的值更新
80
80
  * @param params.name 子组件名称
@@ -269,16 +269,16 @@ Component({
269
269
  parentForm?.updateFormContext();
270
270
  }
271
271
 
272
- if (params.name) {
273
- // 触发父级嵌套表单值更新
274
- parentFormObj?.__setValueImmediate__?.({
275
- name: params.name,
276
- value: params.value,
277
- });
278
- } else if (parentFormObj?.formObjName) {
279
- // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
280
- parentFormObj?.__setValueImmediate__?.({ name, value });
281
- }
272
+ // if (params.name) {
273
+ // // 触发父级嵌套表单值更新
274
+ // parentFormObj?.__setValueImmediate__?.({
275
+ // name: params.name,
276
+ // value: params.value,
277
+ // });
278
+ // } else if (parentFormObj?.formObjName) {
279
+ // // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
280
+ // parentFormObj?.__setValueImmediate__?.({ name, value });
281
+ // }
282
282
  },
283
283
  /**
284
284
  * 子组件默认值变更,触发嵌套表单值更新
@@ -286,41 +286,36 @@ Component({
286
286
  * @param params.value
287
287
  */
288
288
  changeByChildFormObj(params) {
289
- const { objValue, name } = this.data;
290
- const value = deepClone(objValue);
291
- lodashSet(value, getValueName(params.name, name), params.value);
292
-
293
- const tempValue = this.getTempValue(value);
294
-
295
- const tempObjValue = this.getTempValue(objValue);
296
- if (equal(tempValue, tempObjValue)) {
297
- return;
298
- }
299
- this.setData({ objValue: value || [] });
300
-
301
- const parentFormObj = this.getParentFormObj();
302
- const parentForm = this.getParentForm();
303
-
304
- if (params.name) {
305
- // 判断是否将当前的name前缀加上,以便父级嵌套表单更新值
306
- const nameTemp = `${!params.name.startsWith(name) && name ? `${name}.` : ''}${params.name}`;
307
- // 将值同步给父级嵌套表单
308
- parentFormObj?.__setValueImmediate__?.({
309
- name: nameTemp,
310
- value: params.value,
311
- });
312
- } else if (parentFormObj?.formObjName) {
313
- // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
314
- parentFormObj?.__setValueImmediate__?.({ name, value });
315
- }
316
-
317
- if (!parentFormObj && parentForm) {
318
- // 触发父级普通表单值更新
319
- // 子组件向上同步值,不调用setValue
320
- // parentForm?.setValue?.({ [name]: value }, false, true);
321
- // 刷新父级普通表单的formData
322
- parentForm?.updateFormContext();
323
- }
289
+ // const { objValue, name } = this.data;
290
+ // const value = deepClone(objValue);
291
+ // lodashSet(value, getValueName(params.name, name), params.value);
292
+ // const tempValue = this.getTempValue(value);
293
+ // const tempObjValue = this.getTempValue(objValue);
294
+ // if (equal(tempValue, tempObjValue)) {
295
+ // return;
296
+ // }
297
+ // this.setData({ objValue: value || [] });
298
+ // const parentFormObj = this.getParentFormObj();
299
+ // const parentForm = this.getParentForm();
300
+ // if (params.name) {
301
+ // // 判断是否将当前的name前缀加上,以便父级嵌套表单更新值
302
+ // const nameTemp = `${!params.name.startsWith(name) && name ? `${name}.` : ''}${params.name}`;
303
+ // // 将值同步给父级嵌套表单
304
+ // parentFormObj?.__setValueImmediate__?.({
305
+ // name: nameTemp,
306
+ // value: params.value,
307
+ // });
308
+ // } else if (parentFormObj?.formObjName) {
309
+ // // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
310
+ // parentFormObj?.__setValueImmediate__?.({ name, value });
311
+ // }
312
+ // if (!parentFormObj && parentForm) {
313
+ // // 触发父级普通表单值更新
314
+ // // 子组件向上同步值,不调用setValue
315
+ // // parentForm?.setValue?.({ [name]: value }, false, true);
316
+ // // 刷新父级普通表单的formData
317
+ // parentForm?.updateFormContext();
318
+ // }
324
319
  },
325
320
  },
326
321
  observers: {
@@ -61,9 +61,9 @@ Component({
61
61
  * 用于同步子组件的默认值
62
62
  * @param params
63
63
  */
64
- __setValueImmediate__(params) {
65
- that.changeByChildFormObj(params);
66
- },
64
+ // __setValueImmediate__(params) {
65
+ // that.changeByChildFormObj(params);
66
+ // },
67
67
  /**
68
68
  * 嵌套表单内部子组件值改变时,触发嵌套表单组件的值更新
69
69
  * @param params.name 子组件名称
@@ -213,16 +213,16 @@ Component({
213
213
  parentForm?.updateFormContext();
214
214
  }
215
215
 
216
- if (params.name) {
217
- // 触发父级嵌套表单值更新
218
- parentFormObj?.__setValueImmediate__?.({
219
- name: params.name,
220
- value: params.value,
221
- });
222
- } else if (parentFormObj?.formObjName) {
223
- // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
224
- parentFormObj?.__setValueImmediate__?.({ name, value });
225
- }
216
+ // if (params.name) {
217
+ // // 触发父级嵌套表单值更新
218
+ // parentFormObj?.__setValueImmediate__?.({
219
+ // name: params.name,
220
+ // value: params.value,
221
+ // });
222
+ // } else if (parentFormObj?.formObjName) {
223
+ // // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
224
+ // parentFormObj?.__setValueImmediate__?.({ name, value });
225
+ // }
226
226
 
227
227
  this.triggerOnDataChange(value);
228
228
  },
@@ -231,42 +231,42 @@ Component({
231
231
  * @param params.name
232
232
  * @param params.value
233
233
  */
234
- changeByChildFormObj(params) {
235
- const { objValue, name } = this.data;
236
- const value = deepClone(objValue);
237
- lodashSet(value, getValueName(params.name, name), params.value);
234
+ // changeByChildFormObj(params) {
235
+ // const { objValue, name } = this.data;
236
+ // const value = deepClone(objValue);
237
+ // lodashSet(value, getValueName(params.name, name), params.value);
238
238
 
239
- if (equal(value, objValue)) {
240
- return;
241
- }
239
+ // if (equal(value, objValue)) {
240
+ // return;
241
+ // }
242
242
 
243
- const parentFormObj = this.getParentFormObj();
244
- const parentForm = this.getParentForm();
243
+ // const parentFormObj = this.getParentFormObj();
244
+ // const parentForm = this.getParentForm();
245
245
 
246
- if (params.name) {
247
- // 判断是否将当前的name前缀加上,以便父级嵌套表单更新值
248
- const nameTemp = `${!params.name.startsWith(name) && name ? `${name}.` : ''}${params.name}`;
249
- // 将值同步给父级嵌套表单
250
- parentFormObj?.__setValueImmediate__?.({
251
- name: nameTemp,
252
- value: params.value,
253
- });
254
- } else if (parentFormObj?.formObjName) {
255
- // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
256
- parentFormObj?.__setValueImmediate__?.({ name, value });
257
- }
246
+ // if (params.name) {
247
+ // // 判断是否将当前的name前缀加上,以便父级嵌套表单更新值
248
+ // const nameTemp = `${!params.name.startsWith(name) && name ? `${name}.` : ''}${params.name}`;
249
+ // // 将值同步给父级嵌套表单
250
+ // parentFormObj?.__setValueImmediate__?.({
251
+ // name: nameTemp,
252
+ // value: params.value,
253
+ // });
254
+ // } else if (parentFormObj?.formObjName) {
255
+ // // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
256
+ // parentFormObj?.__setValueImmediate__?.({ name, value });
257
+ // }
258
258
 
259
- if (!parentFormObj && parentForm) {
260
- // 触发父级普通表单值更新
261
- // 子组件向上同步值,不调用setValue
262
- // parentForm?.setValue?.({ [name]: value }, false, true);
263
- // 刷新父级普通表单的formData
264
- parentForm?.updateFormContext();
265
- }
259
+ // if (!parentFormObj && parentForm) {
260
+ // // 触发父级普通表单值更新
261
+ // // 子组件向上同步值,不调用setValue
262
+ // // parentForm?.setValue?.({ [name]: value }, false, true);
263
+ // // 刷新父级普通表单的formData
264
+ // parentForm?.updateFormContext();
265
+ // }
266
266
 
267
- this.setData({ objValue: value || {} });
268
- this.updateWidgetAPI();
269
- },
267
+ // this.setData({ objValue: value || {} });
268
+ // this.updateWidgetAPI();
269
+ // },
270
270
  },
271
271
  observers: {
272
272
  'disabled, readOnly': function (disabled, readOnly) {
@@ -35,7 +35,7 @@ Component({
35
35
  placeholderCls: `${WD_PREFIX}-form-input-wrap__placeholder weui-input__placeholder`,
36
36
  cls: '',
37
37
  currentInputValue: '',
38
- _hasClearIcon: false,
38
+ hasClearIcon: false,
39
39
  isFocus: false,
40
40
  counter: 0,
41
41
 
@@ -102,9 +102,9 @@ Component({
102
102
  },
103
103
  observers: {
104
104
  'disabled,clearable,isFocus,currentInputValue': function (disabled, clearable, isFocus, currentInputValue) {
105
- const _hasClearIcon = clearable && isFocus && !disabled && currentInputValue?.length > 0;
105
+ const hasClearIcon = clearable && isFocus && !disabled && currentInputValue?.length > 0;
106
106
  const counter = typeof currentInputValue === 'string' ? currentInputValue.length : 0;
107
- this.setData({ _hasClearIcon, counter });
107
+ this.setData({ hasClearIcon, counter });
108
108
  },
109
109
  'disabled,size,classRoot,wrapClassName,before,after': function (
110
110
  disabled,
@@ -56,14 +56,14 @@
56
56
  </view>
57
57
 
58
58
  <!-- 清除按钮 -->
59
- <block wx:if="{{_hasClearIcon}}">
60
- <view class="{{inputWrap}}__after" >
59
+ <block wx:if="{{hasClearIcon}}">
60
+ <view class="{{inputWrap}}__after">
61
61
  <wd-icon className="{{classPrefix}}-icon__trigger" name="td:close-circle-filled" size="{{iconSize}}" bind:touchstart="handleClear"></wd-icon>
62
62
  </view>
63
63
  </block>
64
64
 
65
65
  <!-- 后缀图标 -->
66
- <block wx:if="{{!_hasClearIcon && suffixType}}">
66
+ <block wx:if="{{!hasClearIcon && suffixType}}">
67
67
  <view class="{{inputWrap}}__after" data-type="suffix" bind:tap="inputAdornmentClick">
68
68
  <wd-icon name="{{suffixIcon}}" type="{{suffixType}}" src="{{suffixSrc}}" size="{{iconSize}}" className="{{root}}__icon-after"></wd-icon>
69
69
  </view>
@@ -76,7 +76,7 @@ Component({
76
76
  * 控制弹窗打开/关闭
77
77
  * @param {Boolean} isOpen
78
78
  */
79
- dealShow(isOpen, params, isTrigger = true) {
79
+ dealShow(isOpen, params) {
80
80
  let setImmediately = {
81
81
  maskPreToShow: true,
82
82
  isMaskShow: !isOpen,
@@ -92,9 +92,8 @@ Component({
92
92
  }
93
93
 
94
94
  this.setData(setImmediately);
95
- if (isTrigger) {
96
- this.triggerEvent(isOpen ? 'open' : 'close', params);
97
- }
95
+
96
+ this.triggerEvent(isOpen ? 'open' : 'close', params);
98
97
  },
99
98
  /**
100
99
  * 关闭弹窗
@@ -163,9 +162,6 @@ Component({
163
162
  modalBdClasses,
164
163
  });
165
164
  },
166
- defaultShow: function (defaultShow) {
167
- this.dealShow(defaultShow, {}, false);
168
- },
169
165
  'isBdShow,openInfo,closeInfo': function () {
170
166
  this.updateWidgetAPI();
171
167
  },
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "miniprogram": "./",
4
4
  "packageManager": "yarn@3.0.2",
5
5
  "dependencies": {},
6
- "version": "3.19.0",
6
+ "version": "3.20.0",
7
7
  "main": "./",
8
8
  "publishConfig": {
9
9
  "access": "public"