@cloudbase/weda-ui-mp 3.6.5 → 3.6.7

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.
@@ -659,9 +659,20 @@ Component({
659
659
  searchRecords.findIndex((r) => r._id === item._id) < 0
660
660
  ) || []
661
661
  ),
662
+ records: records.concat(
663
+ (results ?? []).filter(
664
+ (item) => records.findIndex((r) => r._id === item._id) < 0
665
+ ) || []
666
+ ),
662
667
  searchStatus: status,
663
668
  }
664
669
  : {
670
+ searchRecords: searchRecords.concat(
671
+ (results ?? []).filter(
672
+ (item) =>
673
+ searchRecords.findIndex((r) => r._id === item._id) < 0
674
+ ) || []
675
+ ),
665
676
  records: records.concat(
666
677
  (results ?? []).filter(
667
678
  (item) => records.findIndex((r) => r._id === item._id) < 0
@@ -227,14 +227,14 @@ Component({
227
227
  urls: newUrls,
228
228
  });
229
229
  }
230
- this.handleChange(newUrls);
230
+ this.handleChange(newUrls, true);
231
231
  },
232
- handleChange: function (values) {
232
+ handleChange: function (values, isDelete = false) {
233
233
  let value = values;
234
234
  if (this.properties.single) {
235
235
  value = values[0] ?? '';
236
236
  }
237
- this.triggerEvent('change', { value });
237
+ this.triggerEvent('change', { value, isDelete });
238
238
  },
239
239
  },
240
240
  observers: {
@@ -40,7 +40,7 @@
40
40
  <view wx:if="{{currentFiles.length < maxCount && !readOnly}}" class="weui-uploader__input-box {{shapeClass}}" hover-class="weui-active">
41
41
  <view wx:if="{{!disabled&&!isChooseAvatar}}" class="weui-uploader__input" bindtap="chooseImage"></view>
42
42
 
43
- <button class="weui-uploader__input" wx:if="{{!disabled&&isChooseAvatar}}" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar"></button>
43
+ <button class="weui-uploader__input weui-uploader__input-button" wx:if="{{!disabled&&isChooseAvatar}}" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar"></button>
44
44
 
45
45
  <view wx:if="{{disabled}}" class="weui-uploader__uploader_disabled"></view>
46
46
  </view>
@@ -17,3 +17,7 @@
17
17
  .weui-uploader__files .img-shape-rounded-tectangle::before {
18
18
  border-radius: 6px;
19
19
  }
20
+
21
+ .weui-uploader__files .weui-uploader__input-box .weui-uploader__input-button {
22
+ width: 100%;
23
+ }
@@ -391,7 +391,7 @@ export default Behavior({
391
391
  this.data._status = status;
392
392
  const { disabled: _disabled, readOnly: _readOnly } = this.data;
393
393
  const statusParams = convertStatus(status, _disabled, _readOnly);
394
- const form = this.$widget.closest(
394
+ const form = this?.$widget?.closest(
395
395
  (w) => w.getConfig?.()?.componentType === 'form'
396
396
  );
397
397
  let disabled = statusParams.disabled;
@@ -506,4 +506,8 @@ button::after {
506
506
  button:not([size=mini]) {
507
507
  margin: 0;
508
508
  width: auto;
509
+ }
510
+
511
+ button:not([size=mini]).wd-btn--block {
512
+ width: 100%;
509
513
  }
@@ -112,6 +112,18 @@ Component({
112
112
  });
113
113
  });
114
114
  },
115
+ setReadOnly() {
116
+ Object.keys(this.data._formItemMap).forEach((name) => {
117
+ const items = this.data._formItemMap[name];
118
+ items.forEach((item) => {
119
+ if (!item.setReadOnly) {
120
+ console.error('表单组件缺少setReadOnly方法:', item);
121
+ return;
122
+ }
123
+ item.setReadOnly(true);
124
+ });
125
+ });
126
+ },
115
127
  async validate() {
116
128
  const validatePromise = [];
117
129
  const validateKey = [];
@@ -617,14 +629,25 @@ Component({
617
629
  paramGetItem,
618
630
  value
619
631
  ) {
632
+ if (formType === 'read') {
633
+ this.setReadOnly();
634
+ }
635
+ const isDataModel = ![
636
+ 'connector',
637
+ 'custom-connector',
638
+ 'expression',
639
+ ].includes(datasourceType);
640
+ if (
641
+ isDataModel &&
642
+ formTypeWithInitValue &&
643
+ _id &&
644
+ !equal(_id, this.data._preDataId)
645
+ ) {
646
+ this.setData({ isLoadingData: true });
647
+ }
620
648
  clearTimeout(this.data._delayRef.current.initTimer);
621
649
  // eslint-disable-next-line rulesdir/no-timer
622
650
  this.data._delayRef.current.initTimer = setTimeout(() => {
623
- const isDataModel = ![
624
- 'connector',
625
- 'custom-connector',
626
- 'expression',
627
- ].includes(datasourceType);
628
651
  if (!dataSourceName) {
629
652
  this.setData({ loadingStatus: 'done' });
630
653
  if (datasourceType !== 'expression') {
@@ -1,13 +1,15 @@
1
- <block wx:if="{{loadingStatus === 'hidden'}}"></block>
2
- <block wx:elif="{{loadingStatus === 'loading'}}">
3
- <view class="wedatea2td-action-state">
4
- <view class="wedatea2td-mr-2n wedatea2td-icon wedatea2td-icon-loading" role="img" aria-label="loading"></view>
5
- <view class="wedatea2td-action-state__text" title="数据加载中...">数据加载中...</view>
6
- </view>
7
- </block>
8
- <block wx:else>
9
- <view class="weui-form weda-ui wd-form wd-mp-form {{className}}" id="{{id}}" style="{{style}}">
10
- <block wx:if="{{errorObj.message}}"><status-content errorObj="{{errorObj}}"></status-content></block>
11
- <block wx:if="{{!errorObj.message}}"><slot name="contentSlot" /></block>
12
- </view>
13
- </block>
1
+ <view class="weui-form weda-ui wd-form wd-mp-form {{className}}" id="{{id}}" style="{{style}}">
2
+ <block wx:if="{{loadingStatus === 'loading'}}">
3
+ <view class="wedatea2td-action-state">
4
+ <view class="wedatea2td-mr-2n wedatea2td-icon wedatea2td-icon-loading" role="img" aria-label="loading"></view>
5
+ <view class="wedatea2td-action-state__text" title="数据加载中...">数据加载中...</view>
6
+ </view>
7
+ </block>
8
+
9
+ <block wx:if="{{errorObj.message}}">
10
+ <status-content errorObj="{{errorObj}}"></status-content>
11
+ </block>
12
+ <block wx:if="{{!errorObj.message}}">
13
+ <slot name="contentSlot" />
14
+ </block>
15
+ </view>
@@ -18,6 +18,21 @@
18
18
  padding-bottom: 8px;
19
19
  }
20
20
 
21
+ .wd-mp-form {
22
+ position: relative;
23
+ }
24
+ .wd-mp-form .wedatea2td-action-state {
25
+ position: absolute;
26
+ top: 0;
27
+ height: 100%;
28
+ width: 100%;
29
+ margin: 0 auto;
30
+ text-align: center;
31
+ align-items: center;
32
+ justify-content: center;
33
+ z-index: 9999;
34
+ background: #fff;
35
+ }
21
36
  /*
22
37
  表单模版内置样式 END }}}
23
38
  */
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "miniprogram": "./",
4
4
  "packageManager": "yarn@3.0.2",
5
5
  "dependencies": {},
6
- "version": "3.6.5",
6
+ "version": "3.6.7",
7
7
  "main": "./",
8
8
  "publishConfig": {
9
9
  "access": "public"