@cloudbase/weda-ui-mp 3.15.3 → 3.15.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.
- package/components/richText/copy/index.js +26 -0
- package/components/richText/copy/index.json +6 -0
- package/components/richText/copy/index.wxml +1 -0
- package/components/richText/copy/index.wxss +49 -0
- package/components/richText/index.js +3 -6
- package/components/richText/mp-html/node/node.json +2 -1
- package/components/richText/mp-html/node/node.wxml +8 -0
- package/components/richText/mp-html/node/node.wxss +3 -1
- package/components/tooltip/index.wxss +3 -6
- package/components/wd-form/index.js +2 -2
- package/components/wd-form-arr/index.js +17 -8
- package/components/wd-form-arr/index.wxml +1 -1
- package/components/wd-form-item-obj/index.js +13 -29
- package/components/wd-form-item-obj/index.wxss +5 -0
- package/components/wd-form-obj/index.js +13 -30
- package/components/wd-form-obj/index.wxml +1 -1
- package/components/wd-markdown/index.js +4 -0
- package/components/wd-markdown/index.wxml +1 -1
- package/components/wd-markdown/index.wxss +1109 -3
- package/components/wd-markdown/utils/adClass.js +105 -0
- package/package.json +1 -1
- package/style/wd-font-icon.wxss +1472 -1469
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
options: {
|
|
3
|
+
virtualHost: true,
|
|
4
|
+
},
|
|
5
|
+
data: {
|
|
6
|
+
},
|
|
7
|
+
properties: {
|
|
8
|
+
dataClipboardText: {
|
|
9
|
+
type: String,
|
|
10
|
+
value: '',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
methods: {
|
|
14
|
+
// 复制到剪贴板
|
|
15
|
+
copyClipBoard: function () {
|
|
16
|
+
wx.setClipboardData({
|
|
17
|
+
data: this.data.dataClipboardText,
|
|
18
|
+
success() {
|
|
19
|
+
wx.getClipboardData({
|
|
20
|
+
success() {},
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<view class="markdown-it-code-copy" bindtap="copyClipBoard"></view>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: WdTd;
|
|
3
|
+
src: url("t.eot"), url("t_iefix.eot") format("embedded-opentype"),
|
|
4
|
+
url("t.woff") format("woff"), url("t.ttf") format("truetype"),
|
|
5
|
+
url("t.svg") format("svg"),
|
|
6
|
+
url("https://comp-public-replace-1303824488-cos.weda.tencent.com/icon/0.0.7/t.eot"),
|
|
7
|
+
url("https://comp-public-replace-1303824488-cos.weda.tencent.com/icon/0.0.7/t_iefix.eot")
|
|
8
|
+
format("embedded-opentype"),
|
|
9
|
+
url("https://comp-public-replace-1303824488-cos.weda.tencent.com/icon/0.0.7/t.woff")
|
|
10
|
+
format("woff"),
|
|
11
|
+
url("https://comp-public-replace-1303824488-cos.weda.tencent.com/icon/0.0.7/t.ttf")
|
|
12
|
+
format("truetype"),
|
|
13
|
+
url("https://comp-public-replace-1303824488-cos.weda.tencent.com/icon/0.0.7/t.svg")
|
|
14
|
+
format("svg");
|
|
15
|
+
font-weight: 400;
|
|
16
|
+
font-style: normal;
|
|
17
|
+
}
|
|
18
|
+
.wd-markdown {
|
|
19
|
+
padding: 1rem;
|
|
20
|
+
}
|
|
21
|
+
.markdown-it-code-wrap {
|
|
22
|
+
position: relative;
|
|
23
|
+
}
|
|
24
|
+
.markdown-it-code-copy {
|
|
25
|
+
font-family: WdTd !important;
|
|
26
|
+
vertical-align: middle;
|
|
27
|
+
font-size: 14px;
|
|
28
|
+
border: none;
|
|
29
|
+
background: transparent;
|
|
30
|
+
position: absolute; top: 7.5px; right: 6px; cursor: pointer; outline: none;
|
|
31
|
+
}
|
|
32
|
+
i.markdown-it-code-copy {
|
|
33
|
+
font-style: normal;
|
|
34
|
+
}
|
|
35
|
+
.markdown-it-code-copy::before {
|
|
36
|
+
content: '\E1AC';
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: 0;
|
|
39
|
+
right: 0;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
width: 20px;
|
|
42
|
+
height: 20px;
|
|
43
|
+
display: inline-block;
|
|
44
|
+
text-align: center;
|
|
45
|
+
}
|
|
46
|
+
.markdown-it-code-copy:hover::before {
|
|
47
|
+
background: #eef1f4;
|
|
48
|
+
}
|
|
49
|
+
|
|
@@ -32,10 +32,7 @@ Component({
|
|
|
32
32
|
});
|
|
33
33
|
if (fileList && fileList[0] && fileList[0].tempFileURL) {
|
|
34
34
|
this.setData({
|
|
35
|
-
originValue: this.data.originValue.replace(
|
|
36
|
-
new RegExp(url, 'g'),
|
|
37
|
-
fileList[0].tempFileURL
|
|
38
|
-
),
|
|
35
|
+
originValue: this.data.originValue.replace(new RegExp(url, 'g'), fileList[0].tempFileURL),
|
|
39
36
|
});
|
|
40
37
|
}
|
|
41
38
|
}
|
|
@@ -50,7 +47,7 @@ Component({
|
|
|
50
47
|
.replace(/<table/g, `<table class="table" `)
|
|
51
48
|
.replace(/<th/g, `<th class="th" `)
|
|
52
49
|
.replace(/<td/g, `<td class="td" `)
|
|
53
|
-
.replace(/<p
|
|
50
|
+
.replace(/<p>/g, `<p class="p"> `);
|
|
54
51
|
this.setData({ originValue: initValue });
|
|
55
52
|
|
|
56
53
|
try {
|
|
@@ -70,7 +67,7 @@ Component({
|
|
|
70
67
|
await Promise.all(
|
|
71
68
|
imgs.map(async (img) => {
|
|
72
69
|
await this.getSrc(img, regex);
|
|
73
|
-
})
|
|
70
|
+
}),
|
|
74
71
|
);
|
|
75
72
|
if (initValue !== this.data.originValue) {
|
|
76
73
|
this.setData({ __html: this.data.originValue });
|
|
@@ -26,12 +26,20 @@
|
|
|
26
26
|
<!-- <view wx:elif="{{n.name==='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchtap="linkTap"> -->
|
|
27
27
|
<view wx:elif="{{n.name==='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline-block;{{n.attrs.style}}" data-i="{{i}}">
|
|
28
28
|
<!-- <node childs="{{n.children}}" opts="{{opts}}" style="display:inherit" /> -->
|
|
29
|
+
<block wx:if="{{n.attrs.class==='__preCodeCopyWrap'}}">
|
|
30
|
+
<copy dataClipboardText="{{n.attrs.href}}"></copy>
|
|
31
|
+
</block>
|
|
32
|
+
<block wx:else >
|
|
29
33
|
<wd-unified-link url="{{n.attrs.href}}" options="{{n.attrs.options}}">
|
|
30
34
|
<node childs="{{n.children}}" opts="{{opts}}" style="display: inherit" />
|
|
31
35
|
</wd-unified-link>
|
|
36
|
+
</block>
|
|
37
|
+
|
|
32
38
|
</view>
|
|
39
|
+
|
|
33
40
|
<video wx:elif="{{n.name==='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" object-fit="{{n.attrs['object-fit']}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError" />
|
|
34
41
|
<audio wx:elif="{{n.name==='audio'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError" />
|
|
42
|
+
|
|
35
43
|
<rich-text wx:else id="{{n.attrs.id}}" style="{{n.f}}" user-select="{{opts[4]}}" nodes="{{[n]}}" />
|
|
36
44
|
</template>
|
|
37
45
|
<block wx:for="{{childs}}" wx:for-item="n1" wx:for-index="i1" wx:key="i1">
|
|
@@ -20,9 +20,7 @@
|
|
|
20
20
|
z-index: 10;
|
|
21
21
|
}
|
|
22
22
|
.wd-tooltip__hidden {
|
|
23
|
-
|
|
24
|
-
bottom: -100vh;
|
|
25
|
-
visibility: hidden;
|
|
23
|
+
display: none;
|
|
26
24
|
}
|
|
27
25
|
.wd-tooltip__container {
|
|
28
26
|
line-height: 18px;
|
|
@@ -32,9 +30,8 @@
|
|
|
32
30
|
padding: 12px;
|
|
33
31
|
white-space: nowrap;
|
|
34
32
|
line-height: 18px;
|
|
35
|
-
box-shadow: 0 6px 30px 5px rgba(0, 0, 0, 0.05),
|
|
36
|
-
0
|
|
37
|
-
inset 0 0.5px 0 #dcdcdc, inset 0.5px 0 0 #dcdcdc, inset 0 -0.5px 0 #dcdcdc,
|
|
33
|
+
box-shadow: 0 6px 30px 5px rgba(0, 0, 0, 0.05), 0 16px 24px 2px rgba(0, 0, 0, 0.04),
|
|
34
|
+
0 8px 10px -5px rgba(0, 0, 0, 0.08), inset 0 0.5px 0 #dcdcdc, inset 0.5px 0 0 #dcdcdc, inset 0 -0.5px 0 #dcdcdc,
|
|
38
35
|
inset -0.5px 0 0 #dcdcdc;
|
|
39
36
|
}
|
|
40
37
|
.wd-tooltip__arrow {
|
|
@@ -260,10 +260,10 @@ Component({
|
|
|
260
260
|
const initFormData = convertRemoteValueToFormData(datasourceType, dataSourceProfile, cleanInitValue);
|
|
261
261
|
const formDetailInitValue = this._initValueFormDetail();
|
|
262
262
|
const initValues = { ...formDetailInitValue, ...initFormData };
|
|
263
|
-
this.setValue(initValues);
|
|
263
|
+
this.setValue(initValues, true);
|
|
264
264
|
// eslint-disable-next-line rulesdir/no-timer
|
|
265
265
|
setTimeout(() => {
|
|
266
|
-
this.setValue(initValues);
|
|
266
|
+
this.setValue(initValues, true);
|
|
267
267
|
this.setData({
|
|
268
268
|
formData: initValues,
|
|
269
269
|
initialValues: initValues,
|
|
@@ -195,20 +195,29 @@ Component({
|
|
|
195
195
|
* @returns
|
|
196
196
|
*/
|
|
197
197
|
getTempValue(value) {
|
|
198
|
+
// 处理数组
|
|
198
199
|
if (Array.isArray(value)) {
|
|
199
|
-
return value.map((
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
200
|
+
return value.map((element) => {
|
|
201
|
+
if (typeof element === 'object' && element !== null) {
|
|
202
|
+
const obj = typeof element === 'object' && element !== null ? element : {};
|
|
203
|
+
const cleaned = {};
|
|
204
|
+
Object.keys(obj).forEach((key) => {
|
|
205
|
+
cleaned[key] = obj[key] === null || obj[key] === undefined || obj[key] === '' ? null : obj[key];
|
|
206
|
+
});
|
|
207
|
+
return cleaned;
|
|
208
|
+
}
|
|
209
|
+
return element;
|
|
207
210
|
});
|
|
208
211
|
}
|
|
212
|
+
// 处理单个对象
|
|
213
|
+
|
|
214
|
+
// 非数组/对象直接返回
|
|
209
215
|
return value;
|
|
210
216
|
},
|
|
211
217
|
change(params, { isUpdateParentForm = false, isUpdateChildValue = true } = {}) {
|
|
218
|
+
if (this.data.disabled || this.data.readOnly) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
212
221
|
const { objValue, name, addDefaultValue } = this.data;
|
|
213
222
|
let value = deepClone(params.value);
|
|
214
223
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<block wx:if="{{visible}}">
|
|
2
|
-
<wd-form-item-obj id="{{id}}" mode="{{mode}}" className="{{className}}" style="{{style}}" label="{{label}}" labelVisible="{{labelVisible}}" labelTips="{{labelTips}}" labelWidth="{{labelWidth}}" labelAlign="{{labelAlign}}" labelWrap="{{labelWrap}}" extra="{{extra}}" classRoot="{{classRoot}}" layout="{{_layout}}">
|
|
2
|
+
<wd-form-item-obj id="{{id}}" mode="{{mode}}" className="{{className}}" style="{{style}}" label="{{label}}" labelVisible="{{labelVisible}}" labelTips="{{labelTips}}" labelWidth="{{labelWidth}}" labelAlign="{{labelAlign}}" labelWrap="{{labelWrap}}" extra="{{extra}}" classRoot="{{classRoot}}" layout="{{_layout}}" status="{{status}}">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</wd-form-item-obj>
|
|
5
5
|
</block>
|
|
@@ -2,12 +2,7 @@ import { WD_PREFIX } from '../../utils/constant';
|
|
|
2
2
|
import { textToString } from '../../utils/platform';
|
|
3
3
|
import classNames from '../../utils/classnames';
|
|
4
4
|
import itemBehavior from '../form-field-behavior/item-behavior';
|
|
5
|
-
import {
|
|
6
|
-
convertSize,
|
|
7
|
-
convertLayout,
|
|
8
|
-
convertLabelAlign,
|
|
9
|
-
convertPx,
|
|
10
|
-
} from '../../utils/getFormLegacy';
|
|
5
|
+
import { convertSize, convertLayout, convertLabelAlign, convertPx } from '../../utils/getFormLegacy';
|
|
11
6
|
|
|
12
7
|
Component({
|
|
13
8
|
options: { virtualHost: true, styleIsolation: 'shared' },
|
|
@@ -36,13 +31,12 @@ Component({
|
|
|
36
31
|
methods: {
|
|
37
32
|
setIconName() {
|
|
38
33
|
this.setData({
|
|
39
|
-
iconName:
|
|
40
|
-
this.data.iconName === 'chevrondown' ? 'chevronup' : 'chevrondown',
|
|
34
|
+
iconName: this.data.iconName === 'chevrondown' ? 'chevronup' : 'chevrondown',
|
|
41
35
|
});
|
|
42
36
|
},
|
|
43
37
|
},
|
|
44
38
|
observers: {
|
|
45
|
-
'className,labelWidth,labelAlign,labelWrap,layout,required,requiredFlag,size,classRoot,borderedH5,disabled,controlAlign':
|
|
39
|
+
'className,labelWidth,labelAlign,labelWrap,layout,required,requiredFlag,size,classRoot,borderedH5,disabled,controlAlign,status':
|
|
46
40
|
function (
|
|
47
41
|
className,
|
|
48
42
|
_labelWidth,
|
|
@@ -55,7 +49,8 @@ Component({
|
|
|
55
49
|
classRoot,
|
|
56
50
|
borderedH5,
|
|
57
51
|
disabled,
|
|
58
|
-
controlAlign
|
|
52
|
+
controlAlign,
|
|
53
|
+
status,
|
|
59
54
|
) {
|
|
60
55
|
const { item, itemWrap, classPrefix } = this.data;
|
|
61
56
|
const sizeTemp = convertSize(_size);
|
|
@@ -66,26 +61,20 @@ Component({
|
|
|
66
61
|
const labelRoot = `${root}__label`;
|
|
67
62
|
const labelWidth = convertPx(_labelWidth);
|
|
68
63
|
const labelStyle = labelWidth ? `width:${labelWidth}` : '';
|
|
69
|
-
const itemLayout = this.properties.isWdFormDetail
|
|
70
|
-
? `${classPrefix}-form-item--detail`
|
|
71
|
-
: `${item}-`;
|
|
64
|
+
const itemLayout = this.properties.isWdFormDetail ? `${classPrefix}-form-item--detail` : `${item}-`;
|
|
72
65
|
const cls = classNames(
|
|
73
66
|
item,
|
|
74
67
|
className,
|
|
75
|
-
`${classPrefix}-mp-form-item ${item}--weui item-size-height-${size} ${root}-root ${classPrefix}-mp-${classRoot}-root ${classPrefix}-mp-form-item-obj`,
|
|
68
|
+
`${classPrefix}-mp-form-item ${item}--weui item-size-height-${size} ${root}-root ${classPrefix}-mp-${classRoot}-root ${classPrefix}-mp-form-item-obj ${classPrefix}-mp-form-obj-${status}`,
|
|
76
69
|
{
|
|
77
70
|
'is-required': requiredFlag && required,
|
|
78
71
|
'is-borderless': !borderedH5,
|
|
79
|
-
[`${itemLayout}-horizontal-left`]:
|
|
80
|
-
|
|
81
|
-
[`${itemLayout}-
|
|
82
|
-
|
|
83
|
-
[`${itemLayout}-vertical-left`]:
|
|
84
|
-
layout === 'vertical' && labelAlign === 'left',
|
|
85
|
-
[`${itemLayout}-vertical-right`]:
|
|
86
|
-
layout === 'vertical' && labelAlign === 'right',
|
|
72
|
+
[`${itemLayout}-horizontal-left`]: layout === 'horizontal' && labelAlign === 'left',
|
|
73
|
+
[`${itemLayout}-horizontal-right`]: layout === 'horizontal' && labelAlign === 'right',
|
|
74
|
+
[`${itemLayout}-vertical-left`]: layout === 'vertical' && labelAlign === 'left',
|
|
75
|
+
[`${itemLayout}-vertical-right`]: layout === 'vertical' && labelAlign === 'right',
|
|
87
76
|
[`${item}--label-${labelAlign}`]: !!labelAlign,
|
|
88
|
-
}
|
|
77
|
+
},
|
|
89
78
|
);
|
|
90
79
|
const labelCls = classNames(`${itemWrap}__label`, labelRoot, {
|
|
91
80
|
'is-nowrap': !labelWrap,
|
|
@@ -104,12 +93,7 @@ Component({
|
|
|
104
93
|
controlWrapCls,
|
|
105
94
|
});
|
|
106
95
|
},
|
|
107
|
-
'readBeforeAfter,before,after,readValue': function (
|
|
108
|
-
readBeforeAfter,
|
|
109
|
-
before,
|
|
110
|
-
after,
|
|
111
|
-
readValue
|
|
112
|
-
) {
|
|
96
|
+
'readBeforeAfter,before,after,readValue': function (readBeforeAfter, before, after, readValue) {
|
|
113
97
|
const _readValue = textToString(readValue);
|
|
114
98
|
const _before = readBeforeAfter && textToString(before);
|
|
115
99
|
const _after = readBeforeAfter && textToString(after);
|
|
@@ -15,8 +15,7 @@ import equal from '../../utils/deepEqual';
|
|
|
15
15
|
* @param currentName 当前表单项名称
|
|
16
16
|
* @returns
|
|
17
17
|
*/
|
|
18
|
-
const getValueName = (operateName, currentName) =>
|
|
19
|
-
operateName.replace(new RegExp(`^${currentName}(\\.)?`), '');
|
|
18
|
+
const getValueName = (operateName, currentName) => operateName.replace(new RegExp(`^${currentName}(\\.)?`), '');
|
|
20
19
|
|
|
21
20
|
Component({
|
|
22
21
|
options: { virtualHost: true },
|
|
@@ -86,14 +85,10 @@ Component({
|
|
|
86
85
|
* @returns
|
|
87
86
|
*/
|
|
88
87
|
addFormItem(childName, formItem) {
|
|
89
|
-
if (
|
|
90
|
-
isNil(childName) ||
|
|
91
|
-
!formItem ||
|
|
92
|
-
(typeof childName === 'string' && childName.length === 0)
|
|
93
|
-
) {
|
|
88
|
+
if (isNil(childName) || !formItem || (typeof childName === 'string' && childName.length === 0)) {
|
|
94
89
|
// childName 没设置或为空串的时候不受表单容器控制
|
|
95
90
|
console.warn(
|
|
96
|
-
`组件 #${formItem?.id} 表单key(表单输入类组件 childName 属性)
|
|
91
|
+
`组件 #${formItem?.id} 表单key(表单输入类组件 childName 属性)没设置或为空串的时候不受表单容器控制`,
|
|
97
92
|
);
|
|
98
93
|
return noop;
|
|
99
94
|
}
|
|
@@ -105,9 +100,7 @@ Component({
|
|
|
105
100
|
}
|
|
106
101
|
that.setData({ formsItemMap });
|
|
107
102
|
return () => {
|
|
108
|
-
const removedArr = formsItemMap[childName].filter(
|
|
109
|
-
(item) => item !== formItem
|
|
110
|
-
);
|
|
103
|
+
const removedArr = formsItemMap[childName].filter((item) => item !== formItem);
|
|
111
104
|
if (removedArr.length <= 0) {
|
|
112
105
|
delete formsItemMap[childName];
|
|
113
106
|
} else {
|
|
@@ -121,8 +114,7 @@ Component({
|
|
|
121
114
|
},
|
|
122
115
|
methods: {
|
|
123
116
|
updateWidgetAPI(apis = {}) {
|
|
124
|
-
const { name, objValue, label, visible, readOnly, disabled, status } =
|
|
125
|
-
this.data;
|
|
117
|
+
const { name, objValue, label, visible, readOnly, disabled, status } = this.data;
|
|
126
118
|
this.setReadonlyAttributes?.({
|
|
127
119
|
...apis,
|
|
128
120
|
label,
|
|
@@ -140,16 +132,12 @@ Component({
|
|
|
140
132
|
},
|
|
141
133
|
// 父级普通表单对象
|
|
142
134
|
getParentForm() {
|
|
143
|
-
const parent = this?.$widget?.closest(
|
|
144
|
-
(w) => w.getConfig?.().componentType === 'form'
|
|
145
|
-
);
|
|
135
|
+
const parent = this?.$widget?.closest((w) => w.getConfig?.().componentType === 'form');
|
|
146
136
|
return parent;
|
|
147
137
|
},
|
|
148
138
|
// 父级嵌套表单对象
|
|
149
139
|
getParentFormObj() {
|
|
150
|
-
const parent = this?.$widget?.closest(
|
|
151
|
-
(w) => w.getConfig?.().componentType === 'formObj'
|
|
152
|
-
);
|
|
140
|
+
const parent = this?.$widget?.closest((w) => w.getConfig?.().componentType === 'formObj');
|
|
153
141
|
return parent;
|
|
154
142
|
},
|
|
155
143
|
/**
|
|
@@ -169,10 +157,7 @@ Component({
|
|
|
169
157
|
if (!Array.isArray(items)) {
|
|
170
158
|
items = [items];
|
|
171
159
|
}
|
|
172
|
-
const newValue = lodashGet(
|
|
173
|
-
value,
|
|
174
|
-
getValueName(childName, this.data.name)
|
|
175
|
-
);
|
|
160
|
+
const newValue = lodashGet(value, getValueName(childName, this.data.name));
|
|
176
161
|
items.forEach((item) => {
|
|
177
162
|
if (item?.setValue && !equal(item.value, newValue)) {
|
|
178
163
|
item.setValue(newValue);
|
|
@@ -189,10 +174,10 @@ Component({
|
|
|
189
174
|
* @param param1.isUpdateChildValue 是否更新子组件值, 因子组件值变化调用change时不去触发updateChildValueWithoutForm;因为外部设置了值,则触发updateChildValueWithoutForm去更新子组件值
|
|
190
175
|
* @returns
|
|
191
176
|
*/
|
|
192
|
-
change(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
177
|
+
change(params, { isUpdateParentForm = false, isUpdateChildValue = true } = {}) {
|
|
178
|
+
if (this.data.disabled || this.data.readOnly) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
196
181
|
const { objValue, name } = this.data;
|
|
197
182
|
let value = deepClone(params.value);
|
|
198
183
|
|
|
@@ -260,9 +245,7 @@ Component({
|
|
|
260
245
|
|
|
261
246
|
if (params.name) {
|
|
262
247
|
// 判断是否将当前的name前缀加上,以便父级嵌套表单更新值
|
|
263
|
-
const nameTemp = `${
|
|
264
|
-
!params.name.startsWith(name) && name ? `${name}.` : ''
|
|
265
|
-
}${params.name}`;
|
|
248
|
+
const nameTemp = `${!params.name.startsWith(name) && name ? `${name}.` : ''}${params.name}`;
|
|
266
249
|
// 将值同步给父级嵌套表单
|
|
267
250
|
parentFormObj?.__setValueImmediate__?.({
|
|
268
251
|
name: nameTemp,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<block wx:if="{{visible}}">
|
|
2
|
-
<wd-form-item-obj id="{{id}}" mode="{{mode}}" className="{{className}}" style="{{style}}" label="{{label}}" labelVisible="{{labelVisible}}" labelTips="{{labelTips}}" labelWidth="{{labelWidth}}" labelAlign="{{labelAlign}}" labelWrap="{{labelWrap}}" extra="{{extra}}" classRoot="{{classRoot}}" layout="{{_layout}}">
|
|
2
|
+
<wd-form-item-obj id="{{id}}" mode="{{mode}}" className="{{className}}" style="{{style}}" label="{{label}}" labelVisible="{{labelVisible}}" labelTips="{{labelTips}}" labelWidth="{{labelWidth}}" labelAlign="{{labelAlign}}" labelWrap="{{labelWrap}}" extra="{{extra}}" classRoot="{{classRoot}}" layout="{{_layout}}" status="{{status}}">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</wd-form-item-obj>
|
|
5
5
|
</block>
|
|
@@ -2,6 +2,7 @@ import MarkdownIt from './utils/markdown-it.min.js';
|
|
|
2
2
|
import highlight from './utils/highlight.min.js';
|
|
3
3
|
import hljsJs from './utils/hljs_javascript.min.js';
|
|
4
4
|
import hljsCss from './utils/hljs_css.min.js';
|
|
5
|
+
import { addCustomClassPlugin, copy } from './utils/adClass.js';
|
|
5
6
|
Component({
|
|
6
7
|
options: {
|
|
7
8
|
virtualHost: true,
|
|
@@ -57,12 +58,15 @@ Component({
|
|
|
57
58
|
},
|
|
58
59
|
...options,
|
|
59
60
|
});
|
|
61
|
+
md.use(copy);
|
|
62
|
+
md.use(addCustomClassPlugin);
|
|
60
63
|
this.setData({ mdInstance: md });
|
|
61
64
|
this.triggerEvent('onReady', { markdownInstance: md });
|
|
62
65
|
this.setData({
|
|
63
66
|
__html: md.render(this.data.value),
|
|
64
67
|
});
|
|
65
68
|
},
|
|
69
|
+
|
|
66
70
|
updateWidgetAPI() {
|
|
67
71
|
this.setReadonlyAttributes &&
|
|
68
72
|
this.setReadonlyAttributes({
|