@cloudbase/weda-ui-mp 3.15.7 → 3.16.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.
- package/components/form/select/dropdown-select/index.js +8 -0
- package/components/form/select/dropdown-select/index.wxml +1 -1
- package/components/form/selectMultiple/dropdown-select/index.js +15 -17
- package/components/form/selectMultiple/dropdown-select/index.wxml +1 -1
- package/components/form/selectMultiple/index.js +29 -7
- package/components/form/selectMultiple/index.wxml +2 -1
- package/components/form-field-behavior/form-field-behavior.js +22 -79
- package/components/qrcode/index.wxss +1 -1
- package/components/richText/copy/index.wxss +45 -48
- package/components/wd-select/index.js +18 -14
- package/components/wd-select/index.wxml +7 -3
- package/components/wd-select/select/dropdown-select/index.js +192 -0
- package/components/wd-select/select/dropdown-select/index.json +4 -0
- package/components/wd-select/select/dropdown-select/index.wxml +37 -0
- package/components/wd-select/select/dropdown-select/index.wxss +329 -0
- package/components/wd-select/select/formats-util.js +12 -1
- package/components/wd-select/select/index.js +208 -344
- package/components/wd-select/select/index.json +1 -1
- package/components/wd-select/select/index.wxml +16 -16
- package/components/wd-select-multiple/index.js +16 -8
- package/components/wd-select-multiple/index.json +1 -1
- package/components/wd-select-multiple/index.wxml +6 -2
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<view wx:if="{{!focus}}" class="weda-ui-custom-picker__header">
|
|
5
5
|
<button class="weda-ui-custom-picker__header-btn" bindtap="cancelPicker" data-clear="false">取消</button>
|
|
6
6
|
</view>
|
|
7
|
-
<view class="weda-ui-custom-search {{focus?'is-focused':''}}" style="{{focus? 'margin: 34rpx 32rpx 16rpx 32rpx':'margin: 20rpx 32rpx'}}">
|
|
7
|
+
<view wx:if="{{searchable}}" class="weda-ui-custom-search {{focus?'is-focused':''}}" style="{{focus? 'margin: 34rpx 32rpx 16rpx 32rpx':'margin: 20rpx 32rpx'}}">
|
|
8
8
|
<view class="weda-ui-custom-search-box" bindtap="onFocus">
|
|
9
9
|
<input class="weda-ui-input" focus="{{focus}}" bindfocus="onFocus" bindblur="onBlur" bindinput="bindinput" value="{{searchValue}}" hold-keyboard="true" bindconfirm="bindconfirm" />
|
|
10
10
|
<view class="weda-ui-custom-search-box__label">
|
|
@@ -36,14 +36,18 @@ Component({
|
|
|
36
36
|
type: Boolean,
|
|
37
37
|
value: true,
|
|
38
38
|
},
|
|
39
|
-
staticSearchable: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
value: true,
|
|
42
|
-
},
|
|
43
39
|
selectedValue: {
|
|
44
40
|
type: Array,
|
|
45
41
|
value: [],
|
|
46
42
|
},
|
|
43
|
+
searchable: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
value: true,
|
|
46
|
+
},
|
|
47
|
+
filterable: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
value: false,
|
|
50
|
+
},
|
|
47
51
|
},
|
|
48
52
|
data: {
|
|
49
53
|
height: '390px',
|
|
@@ -53,18 +57,12 @@ Component({
|
|
|
53
57
|
status: 0,
|
|
54
58
|
showOption: [],
|
|
55
59
|
searchPageNo: 1,
|
|
56
|
-
timeId: '',
|
|
57
60
|
pageNo: 1,
|
|
58
61
|
selectedCache: [], // 缓存当前选中值
|
|
59
62
|
},
|
|
60
63
|
|
|
61
64
|
lifetimes: {
|
|
62
|
-
detached() {
|
|
63
|
-
const id = this.data.timeId;
|
|
64
|
-
if (id !== '') {
|
|
65
|
-
clearTimeout(id);
|
|
66
|
-
}
|
|
67
|
-
},
|
|
65
|
+
detached() {},
|
|
68
66
|
},
|
|
69
67
|
methods: {
|
|
70
68
|
cancelPicker: function (e) {
|
|
@@ -179,9 +177,13 @@ Component({
|
|
|
179
177
|
},
|
|
180
178
|
},
|
|
181
179
|
observers: {
|
|
182
|
-
'option,searchValue,
|
|
180
|
+
'option,searchValue,filterable': function (option, searchValue, filterable) {
|
|
183
181
|
const { ignoreCase } = this.properties;
|
|
184
|
-
if (
|
|
182
|
+
if (filterable) {
|
|
183
|
+
this.setData({
|
|
184
|
+
showOption: option,
|
|
185
|
+
});
|
|
186
|
+
} else {
|
|
185
187
|
const searchRange = option.filter((item) => {
|
|
186
188
|
if (ignoreCase) {
|
|
187
189
|
return String(item.label).toLowerCase().indexOf(searchValue.toLowerCase()) !== -1;
|
|
@@ -192,10 +194,6 @@ Component({
|
|
|
192
194
|
showOption: searchRange,
|
|
193
195
|
status: searchRange.length > 0 ? 0 : 3,
|
|
194
196
|
});
|
|
195
|
-
} else {
|
|
196
|
-
this.setData({
|
|
197
|
-
showOption: option,
|
|
198
|
-
});
|
|
199
197
|
}
|
|
200
198
|
},
|
|
201
199
|
selectedValue: function (selectedValue) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<button class="weda-ui-custom-picker__header-btn" bindtap="closeModal" data-clear="false">取消</button>
|
|
7
7
|
<button class="weda-ui-custom-picker__header-btn" bindtap="confirmModal">确定</button>
|
|
8
8
|
</view>
|
|
9
|
-
<view class="weda-ui-custom-search {{focus?'is-focused':''}}" style="{{focus? 'margin: 34rpx 32rpx 16rpx 32rpx':'margin: 20rpx 32rpx'}}">
|
|
9
|
+
<view wx:if="{{searchable}}" class="weda-ui-custom-search {{focus?'is-focused':''}}" style="{{focus? 'margin: 34rpx 32rpx 16rpx 32rpx':'margin: 20rpx 32rpx'}}">
|
|
10
10
|
<view class="weda-ui-custom-search-box" bindtap="onFocus">
|
|
11
11
|
<input class="weda-ui-input" focus="{{focus}}" bindfocus="onFocus" bindblur="onBlur" bindinput="bindinput" value="{{searchValue}}" hold-keyboard="true" bindconfirm="bindconfirm" />
|
|
12
12
|
<view class="weda-ui-custom-search-box__label multiple">
|
|
@@ -98,6 +98,26 @@ Component({
|
|
|
98
98
|
type: Array,
|
|
99
99
|
value: [],
|
|
100
100
|
},
|
|
101
|
+
supportManyRelated: {
|
|
102
|
+
type: Boolean,
|
|
103
|
+
value: false,
|
|
104
|
+
},
|
|
105
|
+
queryCondition: {
|
|
106
|
+
type: null,
|
|
107
|
+
value: [],
|
|
108
|
+
},
|
|
109
|
+
sorter: {
|
|
110
|
+
type: Array,
|
|
111
|
+
value: [],
|
|
112
|
+
},
|
|
113
|
+
searchable: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
value: true,
|
|
116
|
+
},
|
|
117
|
+
filterable: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
value: false,
|
|
120
|
+
},
|
|
101
121
|
},
|
|
102
122
|
data: {
|
|
103
123
|
cls: '',
|
|
@@ -112,15 +132,13 @@ Component({
|
|
|
112
132
|
searchOption: [],
|
|
113
133
|
width: '100%',
|
|
114
134
|
isEmpty: true,
|
|
115
|
-
preWhere: [], // 对比 where 监听
|
|
116
|
-
whereEffected: [], // 每次请求都加上
|
|
117
135
|
fetchTimed: null, // 防抖
|
|
118
136
|
queryParam: { select: { $master: true } },
|
|
119
|
-
|
|
137
|
+
_filterable: false,
|
|
120
138
|
},
|
|
121
139
|
lifetimes: {
|
|
122
140
|
attached() {
|
|
123
|
-
const { className, layout, disabled, range } = this.properties;
|
|
141
|
+
const { className, layout, disabled, range, filterable } = this.properties;
|
|
124
142
|
const isFlex = layout !== 'vertical';
|
|
125
143
|
const cls = classNames({
|
|
126
144
|
'weda-ui': true,
|
|
@@ -144,6 +162,7 @@ Component({
|
|
|
144
162
|
cls,
|
|
145
163
|
subCls,
|
|
146
164
|
displayValue,
|
|
165
|
+
_filterable: filterable,
|
|
147
166
|
});
|
|
148
167
|
},
|
|
149
168
|
ready() {
|
|
@@ -172,9 +191,12 @@ Component({
|
|
|
172
191
|
});
|
|
173
192
|
},
|
|
174
193
|
format: function (format) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
194
|
+
if (['many-many', 'one-many'].includes(format)) {
|
|
195
|
+
// 关联关系,自定义查询规则,不走前端过滤
|
|
196
|
+
this.setData({
|
|
197
|
+
_filterable: true,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
178
200
|
},
|
|
179
201
|
'value,range': function () {
|
|
180
202
|
const { range, format } = this.properties;
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
</view>
|
|
14
14
|
<block wx:if="{{allPickerShow}}">
|
|
15
15
|
<dropdownSelect
|
|
16
|
+
searchable="{{searchable}}"
|
|
17
|
+
filterable="{{_filterable}}"
|
|
16
18
|
class="weui-picker__group weui-input"
|
|
17
19
|
bindchange="onChange"
|
|
18
20
|
bind:_childFetchData="_childFetchData"
|
|
@@ -24,7 +26,6 @@
|
|
|
24
26
|
displayLabel="{{displayLabel}}"
|
|
25
27
|
selectedValue="{{value}}"
|
|
26
28
|
ignoreCase="{{ignoreCase}}"
|
|
27
|
-
staticSearchable="{{staticSearchable}}"
|
|
28
29
|
bind:search="onSearch"
|
|
29
30
|
/>
|
|
30
31
|
</block>
|
|
@@ -3,11 +3,7 @@ import equal from '../../utils/deepEqual';
|
|
|
3
3
|
import { errorHandler } from '../../utils/error';
|
|
4
4
|
|
|
5
5
|
import { autorun, untracked } from 'mobx';
|
|
6
|
-
import {
|
|
7
|
-
convertStatus,
|
|
8
|
-
convertRules,
|
|
9
|
-
convertMethodParam,
|
|
10
|
-
} from '../../utils/getFormLegacy';
|
|
6
|
+
import { convertStatus, convertRules, convertMethodParam } from '../../utils/getFormLegacy';
|
|
11
7
|
|
|
12
8
|
export default Behavior({
|
|
13
9
|
behaviors: [],
|
|
@@ -101,14 +97,7 @@ export default Behavior({
|
|
|
101
97
|
},
|
|
102
98
|
async handleValidate(throwError = true) {
|
|
103
99
|
let finalValue = that.data.value;
|
|
104
|
-
const {
|
|
105
|
-
required,
|
|
106
|
-
rules,
|
|
107
|
-
requiredMsg,
|
|
108
|
-
privateRules,
|
|
109
|
-
selfDefineRules,
|
|
110
|
-
label,
|
|
111
|
-
} = that.data;
|
|
100
|
+
const { required, rules, requiredMsg, privateRules, selfDefineRules, label } = that.data;
|
|
112
101
|
const _rules = [].concat(rules, privateRules, selfDefineRules);
|
|
113
102
|
if (!required && !_rules.length) return;
|
|
114
103
|
if (finalValue) {
|
|
@@ -124,9 +113,7 @@ export default Behavior({
|
|
|
124
113
|
const validPromise = [];
|
|
125
114
|
if (required) {
|
|
126
115
|
if (!validType.required(finalValue)) {
|
|
127
|
-
validPromise.push(
|
|
128
|
-
Promise.resolve({ format: 'required', message: requiredMsg })
|
|
129
|
-
);
|
|
116
|
+
validPromise.push(Promise.resolve({ format: 'required', message: requiredMsg }));
|
|
130
117
|
}
|
|
131
118
|
}
|
|
132
119
|
|
|
@@ -153,10 +140,7 @@ export default Behavior({
|
|
|
153
140
|
let reg;
|
|
154
141
|
if (typeof item.pattern === 'string') {
|
|
155
142
|
const m = item.pattern.match(/(\/?)(.+)\1([a-z]*)/i);
|
|
156
|
-
if (
|
|
157
|
-
m[3] &&
|
|
158
|
-
!/^(?!.*?(.).*?\1)[gmixXsuUAJ]+$/.test(m[3])
|
|
159
|
-
) {
|
|
143
|
+
if (m[3] && !/^(?!.*?(.).*?\1)[gmixXsuUAJ]+$/.test(m[3])) {
|
|
160
144
|
reg = RegExp(item.pattern);
|
|
161
145
|
} else {
|
|
162
146
|
reg = new RegExp(m[2], m[3]);
|
|
@@ -225,15 +209,10 @@ export default Behavior({
|
|
|
225
209
|
Promise.resolve().then(() => {
|
|
226
210
|
this._reaction = autorun(() => {
|
|
227
211
|
const form = untracked(() => {
|
|
228
|
-
return this.$widget?.closest(
|
|
229
|
-
(w) => w.getConfig?.()?.componentType === 'form'
|
|
230
|
-
);
|
|
212
|
+
return this.$widget?.closest((w) => w.getConfig?.()?.componentType === 'form');
|
|
231
213
|
});
|
|
232
214
|
|
|
233
|
-
if (
|
|
234
|
-
form &&
|
|
235
|
-
(this.data.layout === 'auto' || this.data.layout === '')
|
|
236
|
-
) {
|
|
215
|
+
if (form && (this.data.layout === 'auto' || this.data.layout === '')) {
|
|
237
216
|
if (form.layout !== this.data.actualLayout) {
|
|
238
217
|
// 在 form 里面
|
|
239
218
|
this.setData({ actualLayout: form.layout });
|
|
@@ -271,9 +250,7 @@ export default Behavior({
|
|
|
271
250
|
// 清空嵌套表单
|
|
272
251
|
this._removeFormObjItem?.();
|
|
273
252
|
if (this.$widget) {
|
|
274
|
-
const form = this.$widget.closest(
|
|
275
|
-
(w) => w.getConfig?.()?.componentType === 'form'
|
|
276
|
-
);
|
|
253
|
+
const form = this.$widget.closest((w) => w.getConfig?.()?.componentType === 'form');
|
|
277
254
|
|
|
278
255
|
form?.updateFormContext(this.data.name, undefined);
|
|
279
256
|
}
|
|
@@ -315,10 +292,7 @@ export default Behavior({
|
|
|
315
292
|
};
|
|
316
293
|
},
|
|
317
294
|
setReadOnly(val) {
|
|
318
|
-
const [originalReadOnly, originalDisabled] = [
|
|
319
|
-
this.data.readOnly,
|
|
320
|
-
this.data.disabled,
|
|
321
|
-
];
|
|
295
|
+
const [originalReadOnly, originalDisabled] = [this.data.readOnly, this.data.disabled];
|
|
322
296
|
const value = convertMethodParam(val);
|
|
323
297
|
if (value !== originalReadOnly) {
|
|
324
298
|
// 先用disabled属性来做
|
|
@@ -345,29 +319,20 @@ export default Behavior({
|
|
|
345
319
|
// this.$instanceRef.current.name = newName;
|
|
346
320
|
this.data._oldName = newName;
|
|
347
321
|
if (typeof this.$widget !== 'object') return;
|
|
348
|
-
const form = this.$widget?.closest?.(
|
|
349
|
-
(w) => w.getConfig?.()?.componentType === 'form'
|
|
350
|
-
);
|
|
322
|
+
const form = this.$widget?.closest?.((w) => w.getConfig?.()?.componentType === 'form');
|
|
351
323
|
|
|
352
|
-
|
|
324
|
+
const formObj = this.$widget?.closest?.((w) => w.getConfig?.()?.componentType === 'formObj');
|
|
325
|
+
|
|
326
|
+
if (formObj) {
|
|
327
|
+
// 添加子组件到嵌套表单里面
|
|
328
|
+
this._removeFormObjItem = formObj.addFormItem(this.data.name, this.$widget);
|
|
329
|
+
} else if (form) {
|
|
353
330
|
// 在 form 里面
|
|
354
331
|
this._removeFormItem = form.addFormItem(this.data.name, this.$widget);
|
|
355
332
|
if (!Object.prototype.hasOwnProperty.call(form?.value, newName)) {
|
|
356
333
|
form?.updateFormContext(this.data.name, this.data.value);
|
|
357
334
|
}
|
|
358
335
|
}
|
|
359
|
-
|
|
360
|
-
const formObj = this.$widget?.closest?.(
|
|
361
|
-
(w) => w.getConfig?.()?.componentType === 'formObj'
|
|
362
|
-
);
|
|
363
|
-
|
|
364
|
-
if (formObj) {
|
|
365
|
-
// 添加子组件到嵌套表单里面
|
|
366
|
-
this._removeFormObjItem = formObj.addFormItem(
|
|
367
|
-
this.data.name,
|
|
368
|
-
this.$widget
|
|
369
|
-
);
|
|
370
|
-
}
|
|
371
336
|
});
|
|
372
337
|
},
|
|
373
338
|
value: function (value) {
|
|
@@ -382,18 +347,12 @@ export default Behavior({
|
|
|
382
347
|
this.$instanceRef.current.value = value;
|
|
383
348
|
|
|
384
349
|
if (this.$widget) {
|
|
385
|
-
const form = this.$widget.closest(
|
|
386
|
-
|
|
387
|
-
);
|
|
388
|
-
const formObj = this.$widget.closest(
|
|
389
|
-
(w) => w.getConfig?.()?.componentType === 'formObj'
|
|
390
|
-
);
|
|
350
|
+
const form = this.$widget.closest((w) => w.getConfig?.()?.componentType === 'form');
|
|
351
|
+
const formObj = this.$widget.closest((w) => w.getConfig?.()?.componentType === 'formObj');
|
|
391
352
|
// 有父级嵌套表单的不更新form值,父级嵌套表单会去更新
|
|
392
353
|
!formObj && form?.updateFormContext(this.data.name, value);
|
|
393
354
|
formObj?.valueChangeFromChild?.({
|
|
394
|
-
name: `${formObj?.formObjName ? `${formObj.formObjName}.` : ''}${
|
|
395
|
-
this.data.name
|
|
396
|
-
}`,
|
|
355
|
+
name: `${formObj?.formObjName ? `${formObj.formObjName}.` : ''}${this.data.name}`,
|
|
397
356
|
value,
|
|
398
357
|
});
|
|
399
358
|
}
|
|
@@ -407,9 +366,7 @@ export default Behavior({
|
|
|
407
366
|
Promise.resolve().then(() => {
|
|
408
367
|
this.data._layout = layout;
|
|
409
368
|
if (!layout || layout === 'auto') {
|
|
410
|
-
const form = this.$widget.closest(
|
|
411
|
-
(w) => w.getConfig?.()?.componentType === 'form'
|
|
412
|
-
);
|
|
369
|
+
const form = this.$widget.closest((w) => w.getConfig?.()?.componentType === 'form');
|
|
413
370
|
|
|
414
371
|
if (form) {
|
|
415
372
|
// 在 form 里面
|
|
@@ -432,9 +389,7 @@ export default Behavior({
|
|
|
432
389
|
this.data._status = status;
|
|
433
390
|
const { disabled: _disabled, readOnly: _readOnly } = this.data;
|
|
434
391
|
const statusParams = convertStatus(status, _disabled, _readOnly);
|
|
435
|
-
const form = this?.$widget?.closest(
|
|
436
|
-
(w) => w.getConfig?.()?.componentType === 'form'
|
|
437
|
-
);
|
|
392
|
+
const form = this?.$widget?.closest((w) => w.getConfig?.()?.componentType === 'form');
|
|
438
393
|
let disabled = statusParams.disabled;
|
|
439
394
|
let readOnly = statusParams.readOnly;
|
|
440
395
|
if (form) {
|
|
@@ -443,13 +398,7 @@ export default Behavior({
|
|
|
443
398
|
}
|
|
444
399
|
this.setData({ disabled, readOnly });
|
|
445
400
|
},
|
|
446
|
-
'required,before,after,requiredMsg,isUnionValue': function (
|
|
447
|
-
required,
|
|
448
|
-
before,
|
|
449
|
-
after,
|
|
450
|
-
requiredMsg,
|
|
451
|
-
isUnionValue
|
|
452
|
-
) {
|
|
401
|
+
'required,before,after,requiredMsg,isUnionValue': function (required, before, after, requiredMsg, isUnionValue) {
|
|
453
402
|
const newPrivateRules = {
|
|
454
403
|
required,
|
|
455
404
|
before,
|
|
@@ -459,13 +408,7 @@ export default Behavior({
|
|
|
459
408
|
};
|
|
460
409
|
if (equal(newPrivateRules, this.data._privateRules)) return;
|
|
461
410
|
this.data._privateRules = newPrivateRules;
|
|
462
|
-
let privateRules = convertRules(
|
|
463
|
-
required,
|
|
464
|
-
before,
|
|
465
|
-
after,
|
|
466
|
-
requiredMsg,
|
|
467
|
-
isUnionValue
|
|
468
|
-
);
|
|
411
|
+
let privateRules = convertRules(required, before, after, requiredMsg, isUnionValue);
|
|
469
412
|
this.setData({ privateRules });
|
|
470
413
|
},
|
|
471
414
|
},
|
|
@@ -1,49 +1,46 @@
|
|
|
1
1
|
@font-face {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
background: #eef1f4;
|
|
48
|
-
}
|
|
49
|
-
|
|
2
|
+
font-family: WdTd;
|
|
3
|
+
src: url('t.eot'), url('t_iefix.eot') format('embedded-opentype'), url('t.woff') format('woff'),
|
|
4
|
+
url('t.ttf') format('truetype'), url('t.svg') format('svg'),
|
|
5
|
+
url('https://comp-public-replace-1303824488-cos.weda.tencent.com/icon/0.0.7/t.eot'),
|
|
6
|
+
url('https://comp-public-replace-1303824488-cos.weda.tencent.com/icon/0.0.7/t_iefix.eot')
|
|
7
|
+
format('embedded-opentype'),
|
|
8
|
+
url('https://comp-public-replace-1303824488-cos.weda.tencent.com/icon/0.0.7/t.woff') format('woff'),
|
|
9
|
+
url('https://comp-public-replace-1303824488-cos.weda.tencent.com/icon/0.0.7/t.ttf') format('truetype'),
|
|
10
|
+
url('https://comp-public-replace-1303824488-cos.weda.tencent.com/icon/0.0.7/t.svg') format('svg');
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
font-style: normal;
|
|
13
|
+
}
|
|
14
|
+
.wd-markdown {
|
|
15
|
+
padding: 1rem;
|
|
16
|
+
}
|
|
17
|
+
.markdown-it-code-wrap {
|
|
18
|
+
position: relative;
|
|
19
|
+
}
|
|
20
|
+
.markdown-it-code-copy {
|
|
21
|
+
font-family: WdTd !important;
|
|
22
|
+
vertical-align: middle;
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
border: none;
|
|
25
|
+
background: transparent;
|
|
26
|
+
position: absolute;
|
|
27
|
+
top: 7.5px;
|
|
28
|
+
right: 6px;
|
|
29
|
+
outline: none;
|
|
30
|
+
}
|
|
31
|
+
i.markdown-it-code-copy {
|
|
32
|
+
font-style: normal;
|
|
33
|
+
}
|
|
34
|
+
.markdown-it-code-copy::before {
|
|
35
|
+
content: '\E1AC';
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 0;
|
|
38
|
+
right: 0;
|
|
39
|
+
width: 20px;
|
|
40
|
+
height: 20px;
|
|
41
|
+
display: inline-block;
|
|
42
|
+
text-align: center;
|
|
43
|
+
}
|
|
44
|
+
.markdown-it-code-copy:hover::before {
|
|
45
|
+
background: #eef1f4;
|
|
46
|
+
}
|
|
@@ -3,10 +3,10 @@ import formFieldBehavior from '../form-field-behavior/form-field-behavior';
|
|
|
3
3
|
import itemBehavior from '../form-field-behavior/item-behavior';
|
|
4
4
|
import { convertFixedIcon, SELECT_ICON_H5 } from '../../utils/getFormLegacy';
|
|
5
5
|
import debounce from '../../utils/debounce';
|
|
6
|
-
import {
|
|
6
|
+
import { arrayToMap, getSelected } from '../../utils/tool';
|
|
7
7
|
|
|
8
8
|
Component({
|
|
9
|
-
options: { virtualHost: true },
|
|
9
|
+
options: { virtualHost: true, styleIsolation: 'shared' },
|
|
10
10
|
behaviors: [itemBehavior, commonCompBehavior, formFieldBehavior],
|
|
11
11
|
properties: {
|
|
12
12
|
classRoot: {
|
|
@@ -25,9 +25,16 @@ Component({
|
|
|
25
25
|
type: Array,
|
|
26
26
|
value: [],
|
|
27
27
|
},
|
|
28
|
+
searchable: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
value: true,
|
|
31
|
+
},
|
|
32
|
+
filterable: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
value: false,
|
|
35
|
+
},
|
|
28
36
|
},
|
|
29
37
|
data: {
|
|
30
|
-
options: [],
|
|
31
38
|
itemMap: {},
|
|
32
39
|
selectedLabel: null,
|
|
33
40
|
selectedItem: null,
|
|
@@ -45,16 +52,18 @@ Component({
|
|
|
45
52
|
});
|
|
46
53
|
this.updateWidgetAPI();
|
|
47
54
|
},
|
|
48
|
-
changeOptions: function (e) {
|
|
49
|
-
const { options } = safeObj(e.detail.value);
|
|
50
|
-
this.setData({ options });
|
|
51
|
-
},
|
|
52
55
|
search: function (e) {
|
|
53
56
|
this.debouncedTriggerSearchEvent(e.detail.value);
|
|
54
57
|
},
|
|
55
58
|
debouncedTriggerSearchEvent: debounce(function (value) {
|
|
56
59
|
this.triggerEvent('search', { value });
|
|
57
60
|
}),
|
|
61
|
+
updateSelect: function (e) {
|
|
62
|
+
const { value, option } = e.detail;
|
|
63
|
+
const itemMap = arrayToMap(option, 'value');
|
|
64
|
+
const { selectedLabel, selectedItem } = getSelected(itemMap, value, false);
|
|
65
|
+
this.setData({ selectedLabel, selectedItem });
|
|
66
|
+
},
|
|
58
67
|
},
|
|
59
68
|
observers: {
|
|
60
69
|
'name, value, label, required, visible, disabled, readOnly, before, after, primaryField, selectedLabel, selectedItem':
|
|
@@ -65,13 +74,8 @@ Component({
|
|
|
65
74
|
const [_suffixType, _suffixIcon] = convertFixedIcon(suffixType, suffixIcon, SELECT_ICON_H5);
|
|
66
75
|
this.setData({ _suffixType, _suffixIcon });
|
|
67
76
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this.setData({ itemMap });
|
|
71
|
-
},
|
|
72
|
-
'itemMap, value': function (itemMap, value) {
|
|
73
|
-
const { selectedLabel, selectedItem } = getSelected(itemMap, value, false);
|
|
74
|
-
this.setData({ selectedLabel, selectedItem });
|
|
77
|
+
range: function (range) {
|
|
78
|
+
this.updateSelect({ detail: { value: this.data.value, option: range } });
|
|
75
79
|
},
|
|
76
80
|
},
|
|
77
81
|
lifetimes: {
|
|
@@ -22,6 +22,9 @@
|
|
|
22
22
|
<wd-input-group before="{{before}}" after="{{after}}" block="{{true}}" size="{{_size}}" classRoot="{{classRoot}}" readOnly="{{readOnly}}">
|
|
23
23
|
<wd-input-wrap block="{{block}}" classRoot="{{classRoot}}" before="{{before}}" after="{{after}}" disabled="{{disabled}}" prefixType="{{prefixType}}" prefixIcon="{{prefixIcon}}" prefixSrc="{{prefixSrc}}" suffixType="{{_suffixType}}" suffixIcon="{{_suffixIcon}}" suffixSrc="{{suffixSrc}}" hasClearIcon="{{hasClearIcon}}" bind:onClear="handleClear" readOnly="{{readOnly}}">
|
|
24
24
|
<old-select
|
|
25
|
+
multiple="{{false}}"
|
|
26
|
+
searchable="{{searchable}}"
|
|
27
|
+
filterable="{{filterable}}"
|
|
25
28
|
supportManyRelated="{{supportManyRelated}}"
|
|
26
29
|
queryCondition="{{queryCondition}}"
|
|
27
30
|
sorter="{{sorter}}"
|
|
@@ -30,7 +33,7 @@
|
|
|
30
33
|
label=""
|
|
31
34
|
defaultValue="{{value}}"
|
|
32
35
|
enumName="{{enumName}}"
|
|
33
|
-
format="{{format
|
|
36
|
+
format="{{format}}"
|
|
34
37
|
placeholder="{{placeholder}}"
|
|
35
38
|
primaryField="{{primaryField}}"
|
|
36
39
|
range="{{range}}"
|
|
@@ -44,10 +47,11 @@
|
|
|
44
47
|
version="wd"
|
|
45
48
|
mode="selector"
|
|
46
49
|
ignoreCase="{{ignoreCase}}"
|
|
47
|
-
staticSearchable="{{staticSearchable}}"
|
|
48
50
|
bind:change="handleChange"
|
|
49
|
-
bind:
|
|
51
|
+
bind:updateSelect="updateSelect"
|
|
50
52
|
bind:search="search"
|
|
53
|
+
bind:focus="handleEvent"
|
|
54
|
+
bind:blur="handleEvent"
|
|
51
55
|
/>
|
|
52
56
|
</wd-input-wrap>
|
|
53
57
|
</wd-input-group>
|