@cloudbase/weda-ui 3.4.11 → 3.4.12
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/dist/configs/components/common/form-input-required.js +3 -3
- package/dist/configs/components/customer-service.js +3 -0
- package/dist/configs/components/dataView.js +20 -10
- package/dist/configs/components/form-checkbox.js +15 -2
- package/dist/configs/components/form-email.js +17 -2
- package/dist/configs/components/form-input.js +17 -2
- package/dist/configs/components/form-phone.js +17 -2
- package/dist/configs/components/form-radio.js +15 -2
- package/dist/configs/components/form-select-multiple.js +362 -0
- package/dist/configs/components/form-switch.js +15 -2
- package/dist/configs/components/form-text-area.js +15 -2
- package/dist/configs/components/form-url.js +17 -2
- package/dist/configs/components/form-user-tree-select.js +13 -0
- package/dist/configs/components/listView.js +32 -49
- package/dist/configs/components/table.json +1 -54
- package/dist/configs/components/wd-bubble.js +46 -8
- package/dist/configs/components/wd-button.js +3 -0
- package/dist/configs/components/wd-checkbox.js +464 -0
- package/dist/configs/components/wd-form.js +66 -10
- package/dist/configs/components/wd-input-email.js +37 -0
- package/dist/configs/components/wd-input-phone.js +43 -0
- package/dist/configs/components/wd-input-url.js +37 -0
- package/dist/configs/components/wd-input.js +94 -0
- package/dist/configs/components/wd-official-account.js +87 -0
- package/dist/configs/components/wd-radio.js +443 -0
- package/dist/configs/components/wd-switch.js +315 -0
- package/dist/configs/components/wd-table.js +8 -56
- package/dist/configs/components/wd-textarea.js +82 -0
- package/dist/configs/components/wd-tree.js +443 -0
- package/dist/configs/components/web-view.js +3 -0
- package/dist/configs/index.js +24 -1
- package/dist/configs/type-utils/type-form.js +681 -0
- package/dist/docs/common/components/json-schema-view.js +1 -1
- package/dist/docs/common/components/methods-view.js +1 -1
- package/dist/docs/common/components/properties-view.js +3 -1
- package/dist/docs/common/format.js +7 -7
- package/dist/docs/common/tableView.js +3 -1
- package/dist/enum/index.js +196 -0
- package/dist/style/index.scss +1 -1
- package/dist/web/actions/showMessage/index.js +4 -1
- package/dist/web/components/carousel/index.js +1 -1
- package/dist/web/components/customer-service/customer-service.js +19 -2
- package/dist/web/components/dataView/index.js +16 -3
- package/dist/web/components/flow/common/hooks/useCommonFlowData/flow-get.js +5 -1
- package/dist/web/components/flow/common/request.js +5 -5
- package/dist/web/components/flow/modules/operations/controls-items/flow-task-info-modal.js +90 -0
- package/dist/web/components/form/formcell/index.css +13 -1
- package/dist/web/components/form/formcell/index.js +1 -1
- package/dist/web/components/form/location/components/LocationH5/location.h5.js +1 -1
- package/dist/web/components/form/select/dropdown-select/index.js +7 -1
- package/dist/web/components/form/select/h5.js +18 -8
- package/dist/web/components/form/select/index.js +9 -9
- package/dist/web/components/form/select/region/index.js +1 -1
- package/dist/web/components/form/selectMultiple/dropdown-select/h5.js +111 -0
- package/dist/web/components/form/selectMultiple/dropdown-select/index.css +270 -0
- package/dist/web/components/form/selectMultiple/dropdown-select/index.js +206 -0
- package/dist/web/components/form/selectMultiple/dropdown-select/pc.js +115 -0
- package/dist/web/components/form/selectMultiple/dropdown-select/ui.js +113 -0
- package/dist/web/components/form/selectMultiple/h5.js +40 -0
- package/dist/web/components/form/selectMultiple/index.js +94 -0
- package/dist/web/components/form/selectMultiple/request.js +76 -0
- package/dist/web/components/form/selectMultiple/status/allEmpty.js +5 -0
- package/dist/web/components/form/selectMultiple/status/empty.js +19 -0
- package/dist/web/components/form/selectMultiple/status/index.css +63 -0
- package/dist/web/components/form/selectMultiple/status/index.js +7 -0
- package/dist/web/components/form/selectMultiple/status/loading.js +19 -0
- package/dist/web/components/form/selectMultiple/status/propsType.js +1 -0
- package/dist/web/components/form/selectMultiple/status/retry.js +19 -0
- package/dist/web/components/form/tips/index.css +9 -3
- package/dist/web/components/form/uploader/index.css +10 -0
- package/dist/web/components/form/uploader/uploader.h5.js +60 -62
- package/dist/web/components/form/uploader/uploader.pc.js +48 -41
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +8 -33
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +8 -37
- package/dist/web/components/form/userOrgSelect/common/fetch-data-service.js +76 -50
- package/dist/web/components/form/userOrgSelect/common/utils.js +24 -8
- package/dist/web/components/form/userOrgSelect/component/depart-select/depart-select-pc.js +3 -8
- package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +14 -18
- package/dist/web/components/form/userOrgSelect/component/depart-select/org-modal-pc.js +20 -14
- package/dist/web/components/form/userOrgSelect/component/modal-select-h5.js +1 -1
- package/dist/web/components/form/userOrgSelect/component/org-tree.js +21 -9
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +57 -10
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +2 -7
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.js +6 -4
- package/dist/web/components/form/userOrgSelect/component/userOrgSelect.css +8 -2
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +25 -51
- package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +3 -3
- package/dist/web/components/form-input-hooks/index.js +39 -14
- package/dist/web/components/form-select-multiple/index.js +26 -0
- package/dist/web/components/form-user-tree-select/index.js +2 -2
- package/dist/web/components/formdetail/index.css +31 -1
- package/dist/web/components/formdetail/index.js +30 -0
- package/dist/web/components/index.js +17 -1
- package/dist/web/components/listView/index.js +20 -5
- package/dist/web/components/phone/index.js +26 -1
- package/dist/web/components/phoneCode/index.js +3 -1
- package/dist/web/components/richText/index.css +70 -67
- package/dist/web/components/richText/index.js +311 -251
- package/dist/web/components/richText/richtext.module.css +1 -0
- package/dist/web/components/richTextView/index.css +39 -0
- package/dist/web/components/richTextView/index.js +1 -1
- package/dist/web/components/share/index.js +26 -1
- package/dist/web/components/wd-checkbox/checkbox.js +34 -0
- package/dist/web/components/wd-checkbox/index.js +3 -0
- package/dist/web/components/wd-checkbox-list/checkboxList.js +140 -0
- package/dist/web/components/wd-checkbox-list/index.js +3 -0
- package/dist/web/components/wd-form/index.js +25 -12
- package/dist/web/components/wd-form/wd-form.js +42 -0
- package/dist/web/components/wd-form-cell/index.js +3 -0
- package/dist/web/components/wd-form-cell/wd-form-cell.js +42 -0
- package/dist/web/components/wd-form-item/index.js +4 -0
- package/dist/web/components/wd-form-item/wd-form-item.js +55 -0
- package/dist/web/components/wd-form-item/wd-input-group.js +24 -0
- package/dist/web/components/wd-input/index.js +3 -0
- package/dist/web/components/wd-input/wd-input.js +155 -0
- package/dist/web/components/wd-input-email/index.js +3 -0
- package/dist/web/components/wd-input-email/wd-input-email.js +13 -0
- package/dist/web/components/wd-input-group/index.js +3 -0
- package/dist/web/components/wd-input-group/wd-input-group.js +10 -0
- package/dist/web/components/wd-input-phone/index.js +3 -0
- package/dist/web/components/wd-input-phone/wd-input-phone.js +14 -0
- package/dist/web/components/wd-input-url/index.js +3 -0
- package/dist/web/components/wd-input-url/wd-input-url.js +13 -0
- package/dist/web/components/wd-input-wrap/index.js +3 -0
- package/dist/web/components/wd-input-wrap/wd-input-wrap.js +18 -0
- package/dist/web/components/wd-official-account/index.css +29 -0
- package/dist/web/components/wd-official-account/index.js +36 -0
- package/dist/web/components/wd-radio/index.js +3 -0
- package/dist/web/components/wd-radio/wd-radio.js +30 -0
- package/dist/web/components/wd-radio-list/index.js +3 -0
- package/dist/web/components/wd-radio-list/wd-radio-list.js +104 -0
- package/dist/web/components/wd-switch/index.js +3 -0
- package/dist/web/components/wd-switch/wd-switch.js +52 -0
- package/dist/web/components/wd-table/components/FieldRender/index.js +5 -4
- package/dist/web/components/wd-table/components/Table/index.js +12 -2
- package/dist/web/components/wd-table/hooks/useQueryParams.js +4 -1
- package/dist/web/components/wd-table/utils/index.js +6 -2
- package/dist/web/components/wd-table/wd-table.js +70 -57
- package/dist/web/components/wd-textarea/index.js +3 -0
- package/dist/web/components/wd-textarea/wd-textarea.js +78 -0
- package/dist/web/components/wd-tree/index.js +3 -0
- package/dist/web/components/wd-tree/utils.js +291 -0
- package/dist/web/components/wd-tree/wd-tree.js +193 -0
- package/dist/web/utils/constant.js +16 -0
- package/dist/web/utils/datasource.js +2 -2
- package/dist/web/utils/date.js +3 -3
- package/dist/web/utils/hooks/useFormLegacy.js +111 -0
- package/dist/web/utils/tool.js +12 -2
- package/dist/web/weda-ui.css +193 -3
- package/package.json +6 -5
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { defineConfig, Type } from '../type-utils';
|
|
2
|
+
import { FORM_ITEM_DATA, FORM_ITEM_DATA_TITLE, FORM_ITEM_EVENTS, FORM_ITEM_METHODS, FORM_ITEM_META, getFormItemClasses, ItemData, } from '../type-utils/type-form';
|
|
3
|
+
// 属性类型定义,同时提供给 url/phone/email 三个组件使用
|
|
4
|
+
const WD_INPUT_DATA = {
|
|
5
|
+
// 通用
|
|
6
|
+
name: FORM_ITEM_DATA.name,
|
|
7
|
+
inputValue: FORM_ITEM_DATA.inputValue,
|
|
8
|
+
placeholder: FORM_ITEM_DATA.placeholder,
|
|
9
|
+
size: FORM_ITEM_DATA.size,
|
|
10
|
+
block: FORM_ITEM_DATA.block,
|
|
11
|
+
// 标题
|
|
12
|
+
...FORM_ITEM_DATA_TITLE,
|
|
13
|
+
// 输入框
|
|
14
|
+
clearable: FORM_ITEM_DATA.clearable,
|
|
15
|
+
before: FORM_ITEM_DATA.before,
|
|
16
|
+
after: FORM_ITEM_DATA.after,
|
|
17
|
+
prefixType: FORM_ITEM_DATA.prefixType,
|
|
18
|
+
prefixIcon: FORM_ITEM_DATA.prefixIcon,
|
|
19
|
+
prefixSrc: FORM_ITEM_DATA.prefixSrc,
|
|
20
|
+
suffixType: FORM_ITEM_DATA.suffixType,
|
|
21
|
+
suffixIcon: FORM_ITEM_DATA.suffixIcon,
|
|
22
|
+
suffixSrc: FORM_ITEM_DATA.suffixSrc,
|
|
23
|
+
extra: FORM_ITEM_DATA.extra,
|
|
24
|
+
password: FORM_ITEM_DATA.password,
|
|
25
|
+
type: FORM_ITEM_DATA.type,
|
|
26
|
+
counterVisible: FORM_ITEM_DATA.counterVisible,
|
|
27
|
+
focus: FORM_ITEM_DATA.focus,
|
|
28
|
+
borderedH5: FORM_ITEM_DATA.borderedH5,
|
|
29
|
+
borderedPc: FORM_ITEM_DATA.borderedPc,
|
|
30
|
+
// 小程序开放能力
|
|
31
|
+
isNickNameType: FORM_ITEM_DATA.isNickNameType,
|
|
32
|
+
// 状态校验
|
|
33
|
+
maxLength: FORM_ITEM_DATA.maxLength,
|
|
34
|
+
rules: FORM_ITEM_DATA.rules,
|
|
35
|
+
status: FORM_ITEM_DATA.status,
|
|
36
|
+
required: FORM_ITEM_DATA.required,
|
|
37
|
+
requiredFlag: FORM_ITEM_DATA.requiredFlag,
|
|
38
|
+
requiredMsg: FORM_ITEM_DATA.requiredMsg,
|
|
39
|
+
};
|
|
40
|
+
const data = Type.Partial(Type.Object(WD_INPUT_DATA));
|
|
41
|
+
const properties = Type.Pick(ItemData, [
|
|
42
|
+
'name',
|
|
43
|
+
'label',
|
|
44
|
+
'required',
|
|
45
|
+
'before',
|
|
46
|
+
'after',
|
|
47
|
+
'visible',
|
|
48
|
+
'disabled',
|
|
49
|
+
'readOnly',
|
|
50
|
+
'value',
|
|
51
|
+
]);
|
|
52
|
+
const classes = getFormItemClasses('input');
|
|
53
|
+
// 组件配置
|
|
54
|
+
const config = defineConfig({
|
|
55
|
+
$schema: 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/schema/lcds_component.json',
|
|
56
|
+
data,
|
|
57
|
+
properties,
|
|
58
|
+
classes,
|
|
59
|
+
methods: [
|
|
60
|
+
FORM_ITEM_METHODS.setValue,
|
|
61
|
+
FORM_ITEM_METHODS.setVisible,
|
|
62
|
+
FORM_ITEM_METHODS.setDisabled,
|
|
63
|
+
FORM_ITEM_METHODS.clearValue,
|
|
64
|
+
FORM_ITEM_METHODS.setReadOnly,
|
|
65
|
+
FORM_ITEM_METHODS.handleValidate,
|
|
66
|
+
FORM_ITEM_METHODS.clearValidate,
|
|
67
|
+
],
|
|
68
|
+
events: [
|
|
69
|
+
FORM_ITEM_EVENTS.change,
|
|
70
|
+
FORM_ITEM_EVENTS.focus,
|
|
71
|
+
FORM_ITEM_EVENTS.blur,
|
|
72
|
+
FORM_ITEM_EVENTS.confirm,
|
|
73
|
+
FORM_ITEM_EVENTS.clear,
|
|
74
|
+
],
|
|
75
|
+
meta: {
|
|
76
|
+
description: '用于输入/查看较短文本内容。',
|
|
77
|
+
icon: '../../icons/Input.svg',
|
|
78
|
+
title: '单行输入',
|
|
79
|
+
name: 'WdInput',
|
|
80
|
+
componentName: 'Input',
|
|
81
|
+
categoryOrder: 500,
|
|
82
|
+
componentOrder: 350,
|
|
83
|
+
docsUrl: 'https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/form/WdInput',
|
|
84
|
+
category: FORM_ITEM_META.category,
|
|
85
|
+
shortcut: FORM_ITEM_META.shortcut,
|
|
86
|
+
group: FORM_ITEM_META.group,
|
|
87
|
+
visible: FORM_ITEM_META.visible,
|
|
88
|
+
},
|
|
89
|
+
compConfig: {
|
|
90
|
+
componentType: 'formField',
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
export default config;
|
|
94
|
+
export { WD_INPUT_DATA };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Date: 2023-04-18 19:14:39
|
|
3
|
+
* @LastEditTime: 2023-05-11 15:56:50
|
|
4
|
+
* @Description:
|
|
5
|
+
*/
|
|
6
|
+
import { defineConfig, Type } from '../type-utils';
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
$schema: 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/schema/lcds_component.json',
|
|
9
|
+
data: {
|
|
10
|
+
properties: {},
|
|
11
|
+
},
|
|
12
|
+
events: [
|
|
13
|
+
{
|
|
14
|
+
title: '公众号加载成功',
|
|
15
|
+
name: 'load',
|
|
16
|
+
'x-platforms': ['MP'],
|
|
17
|
+
remarks: '公众号加载成功时触发',
|
|
18
|
+
detail: {
|
|
19
|
+
status: Type.Number({
|
|
20
|
+
description: '状态码',
|
|
21
|
+
}),
|
|
22
|
+
errMsg: Type.String({
|
|
23
|
+
description: '错误信息',
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
title: '公众号加载失败',
|
|
29
|
+
name: 'error',
|
|
30
|
+
'x-platforms': ['MP'],
|
|
31
|
+
remarks: '公众号加载失败时触发',
|
|
32
|
+
detail: {
|
|
33
|
+
status: Type.Number({
|
|
34
|
+
description: '状态码',
|
|
35
|
+
}),
|
|
36
|
+
errMsg: Type.String({
|
|
37
|
+
description: '错误信息',
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
classes: [
|
|
43
|
+
{
|
|
44
|
+
name: '根元素',
|
|
45
|
+
selector: '.wd-official-account',
|
|
46
|
+
description: '公众号关注组件根元素',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: '小程序端根元素',
|
|
50
|
+
selector: '.wd-mp-official-account',
|
|
51
|
+
description: '可以为小程序端的组件编写样式',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
meta: {
|
|
55
|
+
name: 'WdOfficialAccount',
|
|
56
|
+
title: '公众号关注组件',
|
|
57
|
+
description: '可在小程序内展示公众号关注入口,方便用户快捷关注或访问公众号。',
|
|
58
|
+
category: '小程序',
|
|
59
|
+
icon: '../icons/OfficialAccount.svg',
|
|
60
|
+
platform: ['MP'],
|
|
61
|
+
visible: ['APP'],
|
|
62
|
+
docsUrl: 'https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/wxOpen/WdOfficialAccount',
|
|
63
|
+
inlineStyleForm: {
|
|
64
|
+
$blockedAll: true,
|
|
65
|
+
},
|
|
66
|
+
categoryOrder: 700,
|
|
67
|
+
componentOrder: 590,
|
|
68
|
+
validate: [
|
|
69
|
+
{
|
|
70
|
+
rule: 'checkSameComponentInOnePage',
|
|
71
|
+
options: {
|
|
72
|
+
allowFailure: true,
|
|
73
|
+
title: '$POSITION$使用了多个微信公众号组件,发布后将仅展示第一个。',
|
|
74
|
+
description: '使用了多个微信公众号组件,发布后将仅展示第一个。',
|
|
75
|
+
type: 'mp',
|
|
76
|
+
version: '',
|
|
77
|
+
matchedPublishedPlatform: ['miniprogram'],
|
|
78
|
+
extra: {
|
|
79
|
+
usePositionTemplate: true,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
propertyPanelTips: '当前组件不支持PC或H5构建,发布后将默认隐藏,请注意页面布局 \n请先前往[微信公众平台](https://developers.weixin.qq.com/miniprogram/dev/component/official-account.html),在设置-关注公众号模块绑定公众号',
|
|
85
|
+
stylePanelTips: '该组件高度固定为84px,宽度不小于300px,可通过调整外层普通容器的宽度调整组件宽度。',
|
|
86
|
+
},
|
|
87
|
+
});
|
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
import { defineConfig, Tuple, Type } from '../type-utils';
|
|
2
|
+
import { FORM_ITEM_DATA_TITLE, FORM_ITEM_METHODS, FORM_ITEM_META, ItemData, } from '../type-utils/type-form';
|
|
3
|
+
const WD_RADIO_DIRECTION = [
|
|
4
|
+
{
|
|
5
|
+
label: '纵向',
|
|
6
|
+
value: 'vertical',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
label: '横向',
|
|
10
|
+
value: 'inline',
|
|
11
|
+
},
|
|
12
|
+
];
|
|
13
|
+
const WD_RADIO_SIZE = [
|
|
14
|
+
{
|
|
15
|
+
label: '默认',
|
|
16
|
+
value: '',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: '大',
|
|
20
|
+
value: 'lg',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: '中',
|
|
24
|
+
value: 'md',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: '小',
|
|
28
|
+
value: 'sm',
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
// 属性分类
|
|
32
|
+
const X_CATEGORY = {
|
|
33
|
+
COMMON: '通用',
|
|
34
|
+
TITLE: '标题',
|
|
35
|
+
OPTION: '选项',
|
|
36
|
+
VERIFY: '状态/校验',
|
|
37
|
+
};
|
|
38
|
+
// 输入组件状态
|
|
39
|
+
export const WD_RADIO_STATUS = [
|
|
40
|
+
{
|
|
41
|
+
label: '编辑',
|
|
42
|
+
value: 'edit',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: '禁用',
|
|
46
|
+
value: 'disabled',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
label: '只读',
|
|
50
|
+
value: 'readOnly',
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
// 属性类型定义
|
|
54
|
+
const data = Type.Object({
|
|
55
|
+
name: Type.String({
|
|
56
|
+
title: '绑定字段',
|
|
57
|
+
type: 'string',
|
|
58
|
+
'x-index': 10,
|
|
59
|
+
default: 'formRadio',
|
|
60
|
+
remarks: '提交表单时会将组件值提交保存到所配置的字段中',
|
|
61
|
+
'x-category': X_CATEGORY.COMMON,
|
|
62
|
+
'x-rules': [
|
|
63
|
+
{
|
|
64
|
+
message: '该字段必填',
|
|
65
|
+
required: true,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
message: '必须以字母开头,仅能输入字母或下划线或数字',
|
|
69
|
+
pattern: '^[a-zA-Z][0-9a-zA-Z_]*$',
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
required: true,
|
|
73
|
+
description: '表单字段的Key值,用于提交数据时,匹配数据模型字段标识。页面内需保证唯一。',
|
|
74
|
+
}),
|
|
75
|
+
range: Type.Array(Type.Object({
|
|
76
|
+
label: Type.String({
|
|
77
|
+
type: 'string',
|
|
78
|
+
title: '选项名称',
|
|
79
|
+
default: '选项1',
|
|
80
|
+
}),
|
|
81
|
+
value: Type.String({
|
|
82
|
+
type: 'string',
|
|
83
|
+
title: '选项值',
|
|
84
|
+
default: '1',
|
|
85
|
+
}),
|
|
86
|
+
}, {
|
|
87
|
+
default: {
|
|
88
|
+
label: '选项1',
|
|
89
|
+
value: '1',
|
|
90
|
+
},
|
|
91
|
+
display: 'label',
|
|
92
|
+
}), {
|
|
93
|
+
type: 'array',
|
|
94
|
+
title: '选项',
|
|
95
|
+
default: [
|
|
96
|
+
{
|
|
97
|
+
label: '选项1',
|
|
98
|
+
value: '1',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
label: '选项2',
|
|
102
|
+
value: '2',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
remarks: '供用户进行选择的选项列表',
|
|
106
|
+
'x-category': X_CATEGORY.COMMON,
|
|
107
|
+
'x-index': 20,
|
|
108
|
+
'x-props': {
|
|
109
|
+
'data-withBindMeta': true,
|
|
110
|
+
},
|
|
111
|
+
'x-component': 'list',
|
|
112
|
+
'x-linkages': [
|
|
113
|
+
{
|
|
114
|
+
type: 'value:schema',
|
|
115
|
+
schema: {
|
|
116
|
+
items: {
|
|
117
|
+
path: 'range.*',
|
|
118
|
+
type: 'object',
|
|
119
|
+
default: {
|
|
120
|
+
label: "{{'选项' + ($self.value.length+1)}}",
|
|
121
|
+
value: "{{($self.value.length+1) + ''}}",
|
|
122
|
+
},
|
|
123
|
+
display: 'label',
|
|
124
|
+
properties: {
|
|
125
|
+
label: {
|
|
126
|
+
type: 'string',
|
|
127
|
+
title: '选项名称',
|
|
128
|
+
default: '选项1',
|
|
129
|
+
},
|
|
130
|
+
value: {
|
|
131
|
+
type: 'string',
|
|
132
|
+
title: '选项值',
|
|
133
|
+
default: '1',
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
target: 'range',
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
}),
|
|
142
|
+
value: Type.String({
|
|
143
|
+
title: '选中值',
|
|
144
|
+
type: 'string',
|
|
145
|
+
'x-index': 30,
|
|
146
|
+
default: '',
|
|
147
|
+
'x-category': X_CATEGORY.COMMON,
|
|
148
|
+
remarks: '默认选中的选项',
|
|
149
|
+
}),
|
|
150
|
+
size: Type.StringEnum({
|
|
151
|
+
title: '组件尺寸',
|
|
152
|
+
type: 'string',
|
|
153
|
+
'x-index': 40,
|
|
154
|
+
default: '',
|
|
155
|
+
description: '单选组件的尺寸宽度,仅在PC端生效',
|
|
156
|
+
enum: Tuple(WD_RADIO_SIZE),
|
|
157
|
+
'x-category': X_CATEGORY.COMMON,
|
|
158
|
+
'x-platforms': ['PCWEB'],
|
|
159
|
+
}),
|
|
160
|
+
...FORM_ITEM_DATA_TITLE,
|
|
161
|
+
extra: Type.String({
|
|
162
|
+
title: '下方提示',
|
|
163
|
+
type: 'string',
|
|
164
|
+
description: '配置后提示内容常显在组件下方',
|
|
165
|
+
'x-index': 120,
|
|
166
|
+
'x-category': X_CATEGORY.OPTION,
|
|
167
|
+
}),
|
|
168
|
+
direction: Type.StringEnum({
|
|
169
|
+
title: '排版方向',
|
|
170
|
+
type: 'string',
|
|
171
|
+
'x-index': 130,
|
|
172
|
+
default: 'vertical',
|
|
173
|
+
enum: Tuple(WD_RADIO_DIRECTION),
|
|
174
|
+
'x-category': X_CATEGORY.OPTION,
|
|
175
|
+
}),
|
|
176
|
+
borderedH5: Type.Boolean({
|
|
177
|
+
title: '移动端显示下划线',
|
|
178
|
+
type: 'boolean',
|
|
179
|
+
default: true,
|
|
180
|
+
description: '关闭后移动端不显示底部下划线',
|
|
181
|
+
'x-index': 140,
|
|
182
|
+
'x-category': X_CATEGORY.OPTION,
|
|
183
|
+
}),
|
|
184
|
+
// 新增且需兼容 disabled
|
|
185
|
+
status: Type.StringEnum({
|
|
186
|
+
title: '状态',
|
|
187
|
+
enum: Tuple(WD_RADIO_STATUS),
|
|
188
|
+
default: 'edit',
|
|
189
|
+
type: 'string',
|
|
190
|
+
'x-index': 170,
|
|
191
|
+
'x-category': X_CATEGORY.VERIFY,
|
|
192
|
+
}),
|
|
193
|
+
required: Type.Boolean({
|
|
194
|
+
title: '必填',
|
|
195
|
+
type: 'boolean',
|
|
196
|
+
'x-index': 180,
|
|
197
|
+
default: false,
|
|
198
|
+
remarks: '启用后该组件强制必填,值不可为空',
|
|
199
|
+
'x-category': X_CATEGORY.VERIFY,
|
|
200
|
+
'x-linkages': [
|
|
201
|
+
{
|
|
202
|
+
type: 'value:visible',
|
|
203
|
+
target: '*(requiredFlag,requiredMsg)',
|
|
204
|
+
condition: '{{$self.value}}',
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
}),
|
|
208
|
+
requiredFlag: Type.Boolean({
|
|
209
|
+
title: '必填标识',
|
|
210
|
+
type: 'boolean',
|
|
211
|
+
'x-index': 190,
|
|
212
|
+
default: true,
|
|
213
|
+
remarks: '启用后,组件若要求必填,则会显示必填星号标记',
|
|
214
|
+
'x-category': X_CATEGORY.VERIFY,
|
|
215
|
+
}),
|
|
216
|
+
requiredMsg: Type.String({
|
|
217
|
+
title: '必填校验提示',
|
|
218
|
+
type: 'string',
|
|
219
|
+
'x-index': 200,
|
|
220
|
+
default: '该项为必填项',
|
|
221
|
+
'x-category': X_CATEGORY.VERIFY,
|
|
222
|
+
remarks: '启用必填,但组件值为空时的提示信息',
|
|
223
|
+
}),
|
|
224
|
+
format: Type.String({
|
|
225
|
+
title: '字段类型',
|
|
226
|
+
type: 'string',
|
|
227
|
+
'x-index': 210,
|
|
228
|
+
default: '',
|
|
229
|
+
display: false,
|
|
230
|
+
'x-category': X_CATEGORY.COMMON,
|
|
231
|
+
'x-platforms': [],
|
|
232
|
+
'x-linkages': [
|
|
233
|
+
{
|
|
234
|
+
type: 'value:visible',
|
|
235
|
+
target: 'range',
|
|
236
|
+
condition: "{{$self.value!='x-enum'}}",
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
type: 'value:visible',
|
|
240
|
+
target: 'tipBlock',
|
|
241
|
+
condition: "{{$self.value=='x-enum'}}",
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
}),
|
|
245
|
+
enumName: Type.String({
|
|
246
|
+
title: '通用选项集名称',
|
|
247
|
+
type: 'string',
|
|
248
|
+
'x-index': 220,
|
|
249
|
+
default: '',
|
|
250
|
+
display: false,
|
|
251
|
+
'x-category': X_CATEGORY.COMMON,
|
|
252
|
+
'x-platforms': [],
|
|
253
|
+
}),
|
|
254
|
+
tipBlock: Type.String({
|
|
255
|
+
title: '选项',
|
|
256
|
+
type: 'string',
|
|
257
|
+
'x-index': 230,
|
|
258
|
+
default: '',
|
|
259
|
+
'x-category': X_CATEGORY.COMMON,
|
|
260
|
+
'x-props': {
|
|
261
|
+
'data-hidebind': true,
|
|
262
|
+
},
|
|
263
|
+
'x-component': 'selection-tip',
|
|
264
|
+
}),
|
|
265
|
+
});
|
|
266
|
+
const properties = Type.Pick(ItemData, [
|
|
267
|
+
'name',
|
|
268
|
+
'value',
|
|
269
|
+
'label',
|
|
270
|
+
'required',
|
|
271
|
+
'visible',
|
|
272
|
+
'disabled',
|
|
273
|
+
'readOnly',
|
|
274
|
+
]);
|
|
275
|
+
// export default
|
|
276
|
+
const config = defineConfig({
|
|
277
|
+
$schema: 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/schema/lcds_component.json',
|
|
278
|
+
// 属性定义
|
|
279
|
+
data,
|
|
280
|
+
// 只读属性定义
|
|
281
|
+
properties,
|
|
282
|
+
// 样式API
|
|
283
|
+
classes: [
|
|
284
|
+
{
|
|
285
|
+
name: '根元素',
|
|
286
|
+
selector: `.wd-radio-root`,
|
|
287
|
+
description: '组件最外层元素',
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
name: 'H5 端根元素',
|
|
291
|
+
selector: `.wd-h5-radio-root`,
|
|
292
|
+
description: '可设定 H5 端的根元素样式',
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: 'PC 端根元素',
|
|
296
|
+
selector: `.wd-pc-radio-root`,
|
|
297
|
+
description: '可设定 PC 端的根元素样式',
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
name: '小程序端根元素',
|
|
301
|
+
selector: `.wd-mp-radio-root`,
|
|
302
|
+
description: '可设定小程序端的根元素样式',
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: '无边框状态',
|
|
306
|
+
selector: `.wd-radio-root.is-borderless`,
|
|
307
|
+
description: '设置组件无边框状态样式',
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
name: '必填状态',
|
|
311
|
+
selector: `.wd-radio-root.is-required`,
|
|
312
|
+
description: '设置组件必填状态样式',
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
name: '标题',
|
|
316
|
+
selector: `.wd-radio__label`,
|
|
317
|
+
description: '组件标题元素',
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
name: '标题禁用状态',
|
|
321
|
+
selector: `.wd-radio__label.is-disabled`,
|
|
322
|
+
description: '设置组件标题禁用状态样式',
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: '标题不换行',
|
|
326
|
+
selector: `.wd-radio__label.is-nowrap`,
|
|
327
|
+
description: '设置组件标题不换行时状态样式',
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
name: '提示文字',
|
|
331
|
+
selector: `.wd-radio__help`,
|
|
332
|
+
description: '设置组件提示文字样式',
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
name: '校验信息',
|
|
336
|
+
selector: `.wd-radio__error`,
|
|
337
|
+
description: '设置组件校验信息样式',
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
name: '组件本身',
|
|
341
|
+
selector: '.wd-radio-group',
|
|
342
|
+
description: '组件本身元素',
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
name: '行内排版',
|
|
346
|
+
selector: '.wd-radio-group--inner',
|
|
347
|
+
description: '组件行内排版样式',
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
name: '选项样式',
|
|
351
|
+
selector: '.wd-radio-wrap',
|
|
352
|
+
description: '选项样式',
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
name: '选项禁用状态',
|
|
356
|
+
selector: '.wd-radio-wrap.is-disabled',
|
|
357
|
+
description: '选项禁用状态',
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
name: '选项只读状态',
|
|
361
|
+
selector: '.wd-radio-wrap.is-disabled',
|
|
362
|
+
description: '选项只读状态',
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
name: '小尺寸',
|
|
366
|
+
selector: '.wd-radio-wrap.size-sm',
|
|
367
|
+
description: '小尺寸样式(仅PC端有效)',
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
name: '默认尺寸',
|
|
371
|
+
selector: '.wd-radio-wrap.size-md',
|
|
372
|
+
description: '默认、中尺寸样式(仅PC端有效)',
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
name: '大尺寸',
|
|
376
|
+
selector: '.wd-radio-wrap.size-lg',
|
|
377
|
+
description: '大尺寸样式',
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
name: '勾选状态',
|
|
381
|
+
selector: '.wd-radio-wrap.is-checked',
|
|
382
|
+
description: '选项勾选状态',
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
name: '按钮背景样式',
|
|
386
|
+
selector: '.wd-radio-inner',
|
|
387
|
+
description: '选项按钮背景样式',
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
name: '按钮样式',
|
|
391
|
+
selector: '.wd-radio-inner::before',
|
|
392
|
+
description: '选项按钮样式',
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
name: '文本样式',
|
|
396
|
+
selector: '.wd-radio-label',
|
|
397
|
+
description: '选项内部文本样式',
|
|
398
|
+
},
|
|
399
|
+
],
|
|
400
|
+
// 组件方法
|
|
401
|
+
methods: [
|
|
402
|
+
FORM_ITEM_METHODS.setValue,
|
|
403
|
+
FORM_ITEM_METHODS.setVisible,
|
|
404
|
+
FORM_ITEM_METHODS.setDisabled,
|
|
405
|
+
FORM_ITEM_METHODS.clearValue,
|
|
406
|
+
FORM_ITEM_METHODS.setReadOnly,
|
|
407
|
+
FORM_ITEM_METHODS.handleValidate,
|
|
408
|
+
FORM_ITEM_METHODS.clearValidate,
|
|
409
|
+
],
|
|
410
|
+
// 组件对外暴露事件
|
|
411
|
+
events: [
|
|
412
|
+
{
|
|
413
|
+
title: '值改变',
|
|
414
|
+
name: 'change',
|
|
415
|
+
detail: {
|
|
416
|
+
value: Type.BasicTypeUnion({
|
|
417
|
+
type: 'string',
|
|
418
|
+
description: '单选组件选中值',
|
|
419
|
+
}),
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
],
|
|
423
|
+
// 组件元信息
|
|
424
|
+
meta: {
|
|
425
|
+
name: 'WdRadio',
|
|
426
|
+
title: '单选',
|
|
427
|
+
// 组件别名,用于生成组件 id,例如 Icon1
|
|
428
|
+
componentName: 'Radio',
|
|
429
|
+
description: '用于在页面中平铺展示多个可选项,由用户选择其一的场景',
|
|
430
|
+
icon: '../../icons/Radio.svg',
|
|
431
|
+
categoryOrder: 500,
|
|
432
|
+
componentOrder: 380,
|
|
433
|
+
docsUrl: 'https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/form/WdRadio',
|
|
434
|
+
category: FORM_ITEM_META.category,
|
|
435
|
+
shortcut: FORM_ITEM_META.shortcut,
|
|
436
|
+
group: FORM_ITEM_META.group,
|
|
437
|
+
visible: FORM_ITEM_META.visible,
|
|
438
|
+
},
|
|
439
|
+
compConfig: {
|
|
440
|
+
componentType: 'formField',
|
|
441
|
+
},
|
|
442
|
+
});
|
|
443
|
+
export default config;
|