@cloudbase/weda-ui 3.4.11 → 3.4.13
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-date.js +1 -1
- package/dist/configs/components/form-depart-tree-select.js +1 -1
- package/dist/configs/components/form-email.js +17 -2
- package/dist/configs/components/form-input.js +17 -2
- package/dist/configs/components/form-location.js +1 -1
- package/dist/configs/components/form-multi-region.js +1 -1
- package/dist/configs/components/form-phone.js +17 -2
- package/dist/configs/components/form-radio.js +15 -2
- package/dist/configs/components/form-rich-text.js +1 -1
- package/dist/configs/components/form-select-multiple.js +362 -0
- package/dist/configs/components/form-select.js +1 -1
- package/dist/configs/components/form-switch.js +16 -3
- package/dist/configs/components/form-text-area.js +15 -2
- package/dist/configs/components/form-time.js +1 -1
- package/dist/configs/components/form-url.js +17 -2
- package/dist/configs/components/form-user-tree-select.js +14 -1
- 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 +11 -59
- 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 +9 -3
- package/dist/web/components/form/select/h5.js +18 -8
- package/dist/web/components/form/select/index.js +9 -10
- 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 +76 -15
- 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 +10 -6
- package/dist/web/components/form-input-hooks/index.js +41 -15
- package/dist/web/components/form-select-multiple/index.js +26 -0
- package/dist/web/components/form-upload-file/index.js +0 -1
- 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 +33 -1
- package/dist/web/components/index.js +27 -11
- package/dist/web/components/listView/index.js +20 -5
- package/dist/web/components/navigationBar/common.js +1 -1
- package/dist/web/components/navigationBar/horizontalMenu.js +1 -1
- package/dist/web/components/navigationBar/index.css +11 -0
- package/dist/web/components/navigationBar/index.js +8 -1
- 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/table/ImportFileModalByApi/uploadCSVFile.js +1 -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/hooks/use-remote-value.js +9 -2
- package/dist/web/components/wd-form/index.js +69 -34
- 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-icon/wd-icon.js +10 -2
- 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/FilterFieldsPanel/FilterFieldItem.js +4 -0
- package/dist/web/components/wd-table/components/Table/index.js +40 -9
- package/dist/web/components/wd-table/hooks/useQueryParams.js +4 -1
- package/dist/web/components/wd-table/hooks/useTableData.js +6 -1
- package/dist/web/components/wd-table/hooks/useViewFields.js +1 -1
- package/dist/web/components/wd-table/utils/index.js +6 -2
- package/dist/web/components/wd-table/wd-table.js +125 -99
- 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 +112 -0
- package/dist/web/utils/tool.js +12 -2
- package/dist/web/weda-ui.css +197 -3
- package/package.json +6 -5
|
@@ -0,0 +1,681 @@
|
|
|
1
|
+
import { Type, Tuple } from './index';
|
|
2
|
+
import { WD_INPUT_SIZE, WD_INPUT_LABEL_ALIGN, WD_INPUT_LAYOUT, WD_INPUT_TYPE, WD_INPUT_STATUS, WD_INPUT_RULES, WD_INPUT_VALIDATE_STATUS, WD_INPUT_ICON_TYPE, WD_ICON_ENUM, } from '../../enum';
|
|
3
|
+
const WD_ICON_OPTIONS = WD_ICON_ENUM.map((item) => ({
|
|
4
|
+
label: item,
|
|
5
|
+
value: item,
|
|
6
|
+
}));
|
|
7
|
+
/**
|
|
8
|
+
* 去掉某些属性
|
|
9
|
+
*/
|
|
10
|
+
export const omit = (obj, fields) => {
|
|
11
|
+
const clone = { ...obj };
|
|
12
|
+
if (Array.isArray(fields)) {
|
|
13
|
+
fields.forEach((k) => delete clone[k]);
|
|
14
|
+
}
|
|
15
|
+
return clone;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* 包含某些属性
|
|
19
|
+
*/
|
|
20
|
+
export const pick = (obj, fields) => {
|
|
21
|
+
const result = {};
|
|
22
|
+
if (Array.isArray(fields)) {
|
|
23
|
+
fields.forEach((k) => {
|
|
24
|
+
obj[k] && (result[k] = obj[k]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
// 属性分类
|
|
30
|
+
const X_CATEGORY = {
|
|
31
|
+
COMMON: '通用',
|
|
32
|
+
TITLE: '标题',
|
|
33
|
+
INPUT_BOX: '输入框',
|
|
34
|
+
MP: '小程序能力',
|
|
35
|
+
VERIFY: '状态/校验',
|
|
36
|
+
PRIVATE: '不对外展示',
|
|
37
|
+
};
|
|
38
|
+
// 表单组件属性集合
|
|
39
|
+
export const FORM_ITEM_DATA = {
|
|
40
|
+
/** 通用 */
|
|
41
|
+
name: Type.String({
|
|
42
|
+
title: '绑定字段',
|
|
43
|
+
type: 'string',
|
|
44
|
+
default: 'formInput',
|
|
45
|
+
required: true,
|
|
46
|
+
description: '表单字段的Key值,用于提交数据时,匹配数据模型字段标识。页面内需保证唯一。',
|
|
47
|
+
'x-index': 10,
|
|
48
|
+
'x-category': X_CATEGORY.COMMON,
|
|
49
|
+
'x-rules': [
|
|
50
|
+
{
|
|
51
|
+
message: '该字段必填',
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
message: '必须以字母开头,仅能输入字母或下划线或数字',
|
|
56
|
+
pattern: '^[a-zA-Z][0-9a-zA-Z_]*$',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
}),
|
|
60
|
+
value: Type.String({
|
|
61
|
+
title: '输入值',
|
|
62
|
+
type: 'string',
|
|
63
|
+
default: '',
|
|
64
|
+
'x-category': X_CATEGORY.COMMON,
|
|
65
|
+
'x-index': 20,
|
|
66
|
+
}),
|
|
67
|
+
inputValue: Type.String({
|
|
68
|
+
title: '输入值',
|
|
69
|
+
type: 'string',
|
|
70
|
+
default: '',
|
|
71
|
+
'x-category': X_CATEGORY.COMMON,
|
|
72
|
+
'x-index': 21,
|
|
73
|
+
}),
|
|
74
|
+
placeholder: Type.String({
|
|
75
|
+
title: '占位文字',
|
|
76
|
+
type: 'string',
|
|
77
|
+
default: '请输入',
|
|
78
|
+
'x-index': 30,
|
|
79
|
+
'x-category': X_CATEGORY.COMMON,
|
|
80
|
+
}),
|
|
81
|
+
size: Type.StringEnum({
|
|
82
|
+
title: '组件尺寸',
|
|
83
|
+
enum: Tuple(WD_INPUT_SIZE),
|
|
84
|
+
type: 'string',
|
|
85
|
+
default: '',
|
|
86
|
+
description: '尺寸配置仅对PC端生效,表单场景下默认会跟随表单容器的组件尺寸配置',
|
|
87
|
+
'x-index': 40,
|
|
88
|
+
'x-platforms': ['PCWEB'],
|
|
89
|
+
'x-category': X_CATEGORY.COMMON,
|
|
90
|
+
}),
|
|
91
|
+
block: Type.Boolean({
|
|
92
|
+
title: '横向占满',
|
|
93
|
+
type: 'boolean',
|
|
94
|
+
default: true,
|
|
95
|
+
'x-index': 41,
|
|
96
|
+
'x-platforms': ['PCWEB'],
|
|
97
|
+
'x-category': X_CATEGORY.COMMON,
|
|
98
|
+
}),
|
|
99
|
+
/** 标题 */
|
|
100
|
+
label: Type.String({
|
|
101
|
+
title: '标题内容',
|
|
102
|
+
type: 'string',
|
|
103
|
+
default: '标题',
|
|
104
|
+
'x-index': 50,
|
|
105
|
+
'x-category': X_CATEGORY.TITLE,
|
|
106
|
+
}),
|
|
107
|
+
labelVisible: Type.Boolean({
|
|
108
|
+
title: '显示标题',
|
|
109
|
+
type: 'boolean',
|
|
110
|
+
default: true,
|
|
111
|
+
'x-index': 60,
|
|
112
|
+
'x-category': X_CATEGORY.TITLE,
|
|
113
|
+
}),
|
|
114
|
+
labelAlign: Type.StringEnum({
|
|
115
|
+
title: '标题对齐',
|
|
116
|
+
enum: Tuple(WD_INPUT_LABEL_ALIGN),
|
|
117
|
+
type: 'string',
|
|
118
|
+
default: '',
|
|
119
|
+
description: '表单场景下默认会跟随表单容器的标题对齐配置',
|
|
120
|
+
'x-index': 70,
|
|
121
|
+
'x-category': X_CATEGORY.TITLE,
|
|
122
|
+
}),
|
|
123
|
+
labelWrap: Type.Boolean({
|
|
124
|
+
title: '标题换行',
|
|
125
|
+
type: 'boolean',
|
|
126
|
+
default: false,
|
|
127
|
+
description: '如果标题内容过长关闭时只显示一行、溢出省略;开启时换行展示。表单场景下默认会跟随表单容器的标题换行配置',
|
|
128
|
+
'x-index': 80,
|
|
129
|
+
'x-category': X_CATEGORY.TITLE,
|
|
130
|
+
}),
|
|
131
|
+
layout: Type.StringEnum({
|
|
132
|
+
title: '标题位置',
|
|
133
|
+
enum: Tuple(WD_INPUT_LAYOUT),
|
|
134
|
+
type: 'string',
|
|
135
|
+
default: '',
|
|
136
|
+
description: '设置标题在表单组件的展示位置,表单场景下默认会跟随表单容器的标题的位置配置',
|
|
137
|
+
'x-index': 90,
|
|
138
|
+
'x-category': X_CATEGORY.TITLE,
|
|
139
|
+
'x-linkages': [
|
|
140
|
+
{
|
|
141
|
+
type: 'value:visible',
|
|
142
|
+
target: 'labelWidth',
|
|
143
|
+
condition: '{{$self.value !== "vertical"}}',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
}),
|
|
147
|
+
labelWidth: Type.String({
|
|
148
|
+
title: '标题宽度',
|
|
149
|
+
type: 'string',
|
|
150
|
+
description: '表单场景下默认会跟随表单容器的标题宽度配置',
|
|
151
|
+
'x-index': 100,
|
|
152
|
+
'x-category': X_CATEGORY.TITLE,
|
|
153
|
+
'x-helper-text': '您可以输入数值 + px、%等单位,示例:200px',
|
|
154
|
+
}),
|
|
155
|
+
labelTips: Type.String({
|
|
156
|
+
title: '标题提示',
|
|
157
|
+
type: 'string',
|
|
158
|
+
description: '配置标题的工具提示内容',
|
|
159
|
+
'x-platforms': ['MOBILEWEB', 'PCWEB', 'WEB'],
|
|
160
|
+
'x-helper-text': '标题的提示语暂不支持小程序端',
|
|
161
|
+
'x-index': 110,
|
|
162
|
+
'x-category': X_CATEGORY.TITLE,
|
|
163
|
+
}),
|
|
164
|
+
/** 输入 */
|
|
165
|
+
clearable: Type.Boolean({
|
|
166
|
+
title: '显示清空按钮',
|
|
167
|
+
type: 'boolean',
|
|
168
|
+
default: true,
|
|
169
|
+
description: '开启后提供快捷清空按钮',
|
|
170
|
+
'x-index': 120,
|
|
171
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
172
|
+
}),
|
|
173
|
+
before: Type.String({
|
|
174
|
+
title: '前缀文字',
|
|
175
|
+
type: 'string',
|
|
176
|
+
description: '表单输入框显示前缀文字,表单提交场景下前缀文字会作为表单内容一起提交到数据模型中',
|
|
177
|
+
'x-index': 130,
|
|
178
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
179
|
+
}),
|
|
180
|
+
after: Type.String({
|
|
181
|
+
title: '后缀文字',
|
|
182
|
+
type: 'string',
|
|
183
|
+
description: '表单输入框显示后缀文字,表单提交场景下后缀文字会作为表单内容一起提交到数据模型中',
|
|
184
|
+
'x-index': 140,
|
|
185
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
186
|
+
}),
|
|
187
|
+
prefixType: Type.StringEnum({
|
|
188
|
+
enum: Tuple(WD_INPUT_ICON_TYPE),
|
|
189
|
+
title: '前缀图标类型',
|
|
190
|
+
default: '',
|
|
191
|
+
description: '选择图标的类型',
|
|
192
|
+
'x-index': 150,
|
|
193
|
+
'x-linkages': [
|
|
194
|
+
{
|
|
195
|
+
type: 'value:visible',
|
|
196
|
+
target: '*(prefixIcon)',
|
|
197
|
+
condition: "{{$self.value === 'inner'}}",
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
type: 'value:visible',
|
|
201
|
+
target: '*(prefixSrc)',
|
|
202
|
+
condition: "{{$self.value ==='custom'}}",
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
206
|
+
}),
|
|
207
|
+
prefixIcon: Type.StringEnum({
|
|
208
|
+
title: '前缀图标',
|
|
209
|
+
type: 'string',
|
|
210
|
+
enum: Tuple(WD_ICON_OPTIONS),
|
|
211
|
+
description: '表单输入框中展示前图标',
|
|
212
|
+
default: 'success',
|
|
213
|
+
'x-index': 151,
|
|
214
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
215
|
+
'x-component': 'icon2',
|
|
216
|
+
}),
|
|
217
|
+
prefixSrc: Type.String({
|
|
218
|
+
'x-component': 'image',
|
|
219
|
+
'x-rules': [
|
|
220
|
+
{
|
|
221
|
+
message: '请输入合法的图片地址',
|
|
222
|
+
pattern: '^(((https?)://)|/resources/)[^\\s]+$',
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
title: '前缀图标',
|
|
226
|
+
default: '',
|
|
227
|
+
description: '设置自定义图标地址',
|
|
228
|
+
'x-index': 152,
|
|
229
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
230
|
+
}),
|
|
231
|
+
suffixType: Type.StringEnum({
|
|
232
|
+
enum: Tuple(WD_INPUT_ICON_TYPE),
|
|
233
|
+
title: '后缀图标类型',
|
|
234
|
+
default: '',
|
|
235
|
+
description: '选择图标的类型',
|
|
236
|
+
'x-index': 160,
|
|
237
|
+
'x-linkages': [
|
|
238
|
+
{
|
|
239
|
+
type: 'value:visible',
|
|
240
|
+
target: '*(suffixIcon)',
|
|
241
|
+
condition: "{{$self.value === 'inner'}}",
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
type: 'value:visible',
|
|
245
|
+
target: '*(suffixSrc)',
|
|
246
|
+
condition: "{{$self.value ==='custom'}}",
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
250
|
+
}),
|
|
251
|
+
suffixIcon: Type.StringEnum({
|
|
252
|
+
title: '后缀图标',
|
|
253
|
+
type: 'string',
|
|
254
|
+
enum: Tuple(WD_ICON_OPTIONS),
|
|
255
|
+
default: 'success',
|
|
256
|
+
description: '表单输入框中展示后图标',
|
|
257
|
+
'x-index': 161,
|
|
258
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
259
|
+
'x-component': 'icon2',
|
|
260
|
+
}),
|
|
261
|
+
suffixSrc: Type.String({
|
|
262
|
+
'x-component': 'image',
|
|
263
|
+
'x-rules': [
|
|
264
|
+
{
|
|
265
|
+
message: '请输入合法的图片地址',
|
|
266
|
+
pattern: '^(((https?)://)|/resources/)[^\\s]+$',
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
title: '后缀图标',
|
|
270
|
+
default: '',
|
|
271
|
+
description: '设置自定义图标地址',
|
|
272
|
+
'x-index': 162,
|
|
273
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
274
|
+
}),
|
|
275
|
+
extra: Type.String({
|
|
276
|
+
title: '下方提示',
|
|
277
|
+
type: 'string',
|
|
278
|
+
description: '配置后提示内容常显在输入框下方',
|
|
279
|
+
'x-index': 170,
|
|
280
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
281
|
+
}),
|
|
282
|
+
password: Type.Boolean({
|
|
283
|
+
title: '展示为密码',
|
|
284
|
+
type: 'boolean',
|
|
285
|
+
default: false,
|
|
286
|
+
description: '输入内容以密码的形式展示',
|
|
287
|
+
'x-index': 180,
|
|
288
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
289
|
+
}),
|
|
290
|
+
type: Type.StringEnum({
|
|
291
|
+
title: '输入键盘类型',
|
|
292
|
+
enum: Tuple(WD_INPUT_TYPE),
|
|
293
|
+
default: 'text',
|
|
294
|
+
type: 'string',
|
|
295
|
+
description: '控制移动端输入键盘的展示形式',
|
|
296
|
+
'x-index': 190,
|
|
297
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
298
|
+
}),
|
|
299
|
+
counterVisible: Type.Boolean({
|
|
300
|
+
title: '显示字数',
|
|
301
|
+
type: 'boolean',
|
|
302
|
+
default: false,
|
|
303
|
+
'x-index': 200,
|
|
304
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
305
|
+
}),
|
|
306
|
+
focus: Type.Boolean({
|
|
307
|
+
title: '自动获取焦点',
|
|
308
|
+
type: 'boolean',
|
|
309
|
+
default: false,
|
|
310
|
+
description: '开启后页面加载后光标自动定位到该输入框',
|
|
311
|
+
'x-index': 210,
|
|
312
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
313
|
+
}),
|
|
314
|
+
borderedH5: Type.Boolean({
|
|
315
|
+
title: '移动端显示下划线',
|
|
316
|
+
type: 'boolean',
|
|
317
|
+
default: true,
|
|
318
|
+
description: '关闭后移动端不显示底部下划线',
|
|
319
|
+
'x-index': 220,
|
|
320
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
321
|
+
}),
|
|
322
|
+
borderedPc: Type.Boolean({
|
|
323
|
+
title: 'PC端显示输入边框',
|
|
324
|
+
type: 'boolean',
|
|
325
|
+
default: true,
|
|
326
|
+
description: '关闭后PC端不显示输入边框',
|
|
327
|
+
'x-index': 230,
|
|
328
|
+
'x-category': X_CATEGORY.INPUT_BOX,
|
|
329
|
+
}),
|
|
330
|
+
/** 小程序能力 */
|
|
331
|
+
isNickNameType: Type.Boolean({
|
|
332
|
+
title: '小程序端获取微信昵称',
|
|
333
|
+
type: 'boolean',
|
|
334
|
+
default: false,
|
|
335
|
+
'x-platforms': ['MP'],
|
|
336
|
+
'x-index': 240,
|
|
337
|
+
'x-category': X_CATEGORY.MP,
|
|
338
|
+
}),
|
|
339
|
+
/** 状态/校验 */
|
|
340
|
+
maxLength: Type.Number({
|
|
341
|
+
title: '最大长度',
|
|
342
|
+
type: 'number',
|
|
343
|
+
default: 140,
|
|
344
|
+
'x-index': 250,
|
|
345
|
+
'x-category': X_CATEGORY.VERIFY,
|
|
346
|
+
}),
|
|
347
|
+
rules: Type.Array(Type.Object({
|
|
348
|
+
format: Type.String({
|
|
349
|
+
enum: Tuple(WD_INPUT_RULES),
|
|
350
|
+
type: 'string',
|
|
351
|
+
title: '校验规则',
|
|
352
|
+
default: '',
|
|
353
|
+
'x-linkages': [
|
|
354
|
+
{
|
|
355
|
+
type: 'value:state',
|
|
356
|
+
state: {
|
|
357
|
+
value: "{{ '请输入正确格式的'+($self.value === '' ? '内容' : $self.props.enum.find(item => { return item.value === $self.value }) && $self.props.enum.find(item => { return item.value === $self.value }).label )}}",
|
|
358
|
+
},
|
|
359
|
+
target: 'dataForm.message',
|
|
360
|
+
condition: '{{$self.inputed}}',
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
type: 'value:state',
|
|
364
|
+
state: {
|
|
365
|
+
value: "{{ {'':'', 'id':'/^[1-9]\\\\d{5}(18|19|([23]\\\\d))\\\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\\\d{3}[0-9Xx]$/', 'bankCard':'/^([1-9]{1})(\\d{7,29})$/' , 'email':'/^\\\\w{6,18}@\\\\w{2,4}\\\\.(com)|(net)$/', 'num':'/^-?\\\\d*\\\\.?\\\\d+$/', 'cn':'/^[/u4e00-/u9fa5]$/', 'mobile':'/^[1][3,4,5,6,7,8,9][0-9]{9}$/', 'tel':'/^(0\\\\d{2,3}-)?(\\\\d{7,8})$/', 'url': '/http://([\\\\w-]+\\\\.)+[\\\\w-]+(/[\\\\w- ./?%&=]*)?/', 'carId':'/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/', 'cnName':'/^[/u4e00-/u9fa5]$/', 'enName':'/^[A-Za-z]+$/', 'userName':'/^[a-zA-Z0-9_-]{4,16}$/', 'address': '/.*/', 'date':'/^\\\\d{4}(\\\\-)\\\\d{1,2}\\\\1\\\\d{1,2}$/', 'numVcode':'/^[0-9]{4,8}$/', 'vcode':'/^.{4,}$/', 'hkMc':'/^[LTlt]{1}[0-9]{8}$/', 'code': '/^[1-9][0-9]{5}$/', 'taiWan':'/^[0-9]{8,10}$/', 'passport':'/^((1[45]\\\\d{7})|(G\\\\d{8})|(P\\\\d{7})|(S\\\\d{7,8})|(E\\\\d{8}))?$/', 'money':'/^([1-9][\\\\d]{0,7}|0)(\\\\.[\\\\d]{1,2})?$/'}[$self.value] }}",
|
|
366
|
+
},
|
|
367
|
+
target: 'dataForm.pattern',
|
|
368
|
+
condition: '{{$self.inputed}}',
|
|
369
|
+
},
|
|
370
|
+
],
|
|
371
|
+
}),
|
|
372
|
+
message: Type.String({
|
|
373
|
+
title: '提示信息',
|
|
374
|
+
default: '请输入正确格式的内容',
|
|
375
|
+
}),
|
|
376
|
+
pattern: Type.Optional(Type.String({
|
|
377
|
+
title: '正则',
|
|
378
|
+
'x-component': 'textarea',
|
|
379
|
+
'x-helper-text': '支持匹配正则字面量如 /^weda$/i,或匹配字符串如 ^weda$',
|
|
380
|
+
})),
|
|
381
|
+
}, {
|
|
382
|
+
title: 'tabs',
|
|
383
|
+
default: {
|
|
384
|
+
icon: '自定义',
|
|
385
|
+
title: '自定义',
|
|
386
|
+
message: '请输入正确格式的内容',
|
|
387
|
+
},
|
|
388
|
+
'x-display': "({'':'自定义','id':'身份证','bankCard':'银行卡','email':'邮箱','num':'数字','cn':'中文','mobile':'手机号','tel':'固定电话','url':'网址','carId':'车牌','cnName':'中文名','enName':'英文名','userName':'用户名','address':'地址', 'date':'日期','numVcode':'数字验证码(4-8位)', 'vcode':'其他验证码(4位以上的中英文字符)', 'code':'编码', 'hkMc':'港澳通行证', 'taiWan':'台湾通行证', 'passport':'护照', 'money':'金额'})[this.format] || '自定义'",
|
|
389
|
+
}), {
|
|
390
|
+
title: '校验规则',
|
|
391
|
+
default: [],
|
|
392
|
+
type: 'string',
|
|
393
|
+
'x-index': 260,
|
|
394
|
+
'x-category': X_CATEGORY.VERIFY,
|
|
395
|
+
'x-component': 'list',
|
|
396
|
+
}),
|
|
397
|
+
validateStatus: Type.StringEnum({
|
|
398
|
+
title: '校验状态',
|
|
399
|
+
enum: Tuple(WD_INPUT_VALIDATE_STATUS),
|
|
400
|
+
type: 'string',
|
|
401
|
+
default: 'success',
|
|
402
|
+
'x-index': 270,
|
|
403
|
+
'x-category': X_CATEGORY.VERIFY,
|
|
404
|
+
}),
|
|
405
|
+
status: Type.StringEnum({
|
|
406
|
+
title: '状态',
|
|
407
|
+
enum: Tuple(WD_INPUT_STATUS),
|
|
408
|
+
default: 'edit',
|
|
409
|
+
type: 'string',
|
|
410
|
+
'x-index': 280,
|
|
411
|
+
'x-category': X_CATEGORY.VERIFY,
|
|
412
|
+
}),
|
|
413
|
+
required: Type.Boolean({
|
|
414
|
+
title: '必填',
|
|
415
|
+
type: 'boolean',
|
|
416
|
+
default: false,
|
|
417
|
+
'x-index': 290,
|
|
418
|
+
'x-category': X_CATEGORY.VERIFY,
|
|
419
|
+
'x-linkages': [
|
|
420
|
+
{
|
|
421
|
+
type: 'value:visible',
|
|
422
|
+
target: '*(requiredFlag,requiredMsg)',
|
|
423
|
+
condition: '{{$self.value}}',
|
|
424
|
+
},
|
|
425
|
+
],
|
|
426
|
+
}),
|
|
427
|
+
requiredFlag: Type.Boolean({
|
|
428
|
+
type: 'boolean',
|
|
429
|
+
title: '必填标识',
|
|
430
|
+
default: true,
|
|
431
|
+
remarks: '启用后,组件若要求必填,则会显示必填星号标记',
|
|
432
|
+
'x-index': 300,
|
|
433
|
+
'x-category': X_CATEGORY.VERIFY,
|
|
434
|
+
}),
|
|
435
|
+
requiredMsg: Type.String({
|
|
436
|
+
type: 'string',
|
|
437
|
+
title: '必填校验提示',
|
|
438
|
+
default: '该项为必填项',
|
|
439
|
+
'x-index': 310,
|
|
440
|
+
'x-category': X_CATEGORY.VERIFY,
|
|
441
|
+
}),
|
|
442
|
+
/** 提供给widget挂载的属性 */
|
|
443
|
+
visible: Type.Boolean({
|
|
444
|
+
title: '是否展示',
|
|
445
|
+
description: '组件是否展示',
|
|
446
|
+
'x-platforms': [],
|
|
447
|
+
}),
|
|
448
|
+
disabled: Type.Boolean({
|
|
449
|
+
title: '是否禁用',
|
|
450
|
+
description: '组件是否禁用',
|
|
451
|
+
'x-platforms': [],
|
|
452
|
+
}),
|
|
453
|
+
readOnly: Type.Boolean({
|
|
454
|
+
title: '是否只读',
|
|
455
|
+
description: '组件是否只读',
|
|
456
|
+
'x-platforms': [],
|
|
457
|
+
}),
|
|
458
|
+
};
|
|
459
|
+
// 各组件标题一致,统一导出,x-index 从 50-110
|
|
460
|
+
export const FORM_ITEM_DATA_TITLE = pick(FORM_ITEM_DATA, [
|
|
461
|
+
'label',
|
|
462
|
+
'labelVisible',
|
|
463
|
+
'labelAlign',
|
|
464
|
+
'labelWrap',
|
|
465
|
+
'layout',
|
|
466
|
+
'labelWidth',
|
|
467
|
+
'labelTips',
|
|
468
|
+
]);
|
|
469
|
+
// 表单组件事件集合
|
|
470
|
+
const DEFAULT_DETAIL = { value: Type.String({ description: '输入值' }) };
|
|
471
|
+
export const FORM_ITEM_EVENTS = {
|
|
472
|
+
change: {
|
|
473
|
+
name: 'change',
|
|
474
|
+
title: '输入改变',
|
|
475
|
+
detail: DEFAULT_DETAIL,
|
|
476
|
+
},
|
|
477
|
+
focus: {
|
|
478
|
+
name: 'focus',
|
|
479
|
+
title: '聚焦',
|
|
480
|
+
detail: DEFAULT_DETAIL,
|
|
481
|
+
},
|
|
482
|
+
blur: {
|
|
483
|
+
name: 'blur',
|
|
484
|
+
title: '失焦',
|
|
485
|
+
detail: DEFAULT_DETAIL,
|
|
486
|
+
},
|
|
487
|
+
confirm: {
|
|
488
|
+
name: 'confirm',
|
|
489
|
+
title: '回车',
|
|
490
|
+
detail: DEFAULT_DETAIL,
|
|
491
|
+
},
|
|
492
|
+
clear: {
|
|
493
|
+
name: 'clear',
|
|
494
|
+
title: '清除内容',
|
|
495
|
+
detail: { originValue: Type.String({ description: '输入被清除前的值' }) },
|
|
496
|
+
},
|
|
497
|
+
};
|
|
498
|
+
// 表单方法集合
|
|
499
|
+
export const FORM_ITEM_METHODS = {
|
|
500
|
+
setValue: {
|
|
501
|
+
name: 'setValue',
|
|
502
|
+
label: '设置值',
|
|
503
|
+
params: {
|
|
504
|
+
properties: {
|
|
505
|
+
value: {
|
|
506
|
+
title: '值',
|
|
507
|
+
type: 'string',
|
|
508
|
+
},
|
|
509
|
+
},
|
|
510
|
+
},
|
|
511
|
+
description: '通过 $w.id1.setValue("weda") 设置组件值',
|
|
512
|
+
},
|
|
513
|
+
setVisible: {
|
|
514
|
+
name: 'setVisible',
|
|
515
|
+
label: '设置显隐',
|
|
516
|
+
params: {
|
|
517
|
+
properties: {
|
|
518
|
+
value: {
|
|
519
|
+
title: '显示',
|
|
520
|
+
type: 'boolean',
|
|
521
|
+
},
|
|
522
|
+
},
|
|
523
|
+
},
|
|
524
|
+
description: '通过 $w.id1.setVisible(false) 设置组件为隐藏',
|
|
525
|
+
},
|
|
526
|
+
setDisabled: {
|
|
527
|
+
name: 'setDisabled',
|
|
528
|
+
label: '设置禁用',
|
|
529
|
+
params: {
|
|
530
|
+
properties: {
|
|
531
|
+
value: {
|
|
532
|
+
title: '禁用',
|
|
533
|
+
type: 'boolean',
|
|
534
|
+
},
|
|
535
|
+
},
|
|
536
|
+
},
|
|
537
|
+
description: '通过 $w.id1.setDisabled(true) 设置组件为禁用',
|
|
538
|
+
},
|
|
539
|
+
setReadOnly: {
|
|
540
|
+
name: 'setReadOnly',
|
|
541
|
+
label: '设置只读',
|
|
542
|
+
params: {
|
|
543
|
+
properties: {
|
|
544
|
+
value: {
|
|
545
|
+
title: '只读',
|
|
546
|
+
type: 'boolean',
|
|
547
|
+
},
|
|
548
|
+
},
|
|
549
|
+
},
|
|
550
|
+
description: '通过 $w.id1.setReadOnly(true) 设置组件为只读',
|
|
551
|
+
},
|
|
552
|
+
clearValue: {
|
|
553
|
+
name: 'clearValue',
|
|
554
|
+
label: '清空值',
|
|
555
|
+
description: '通过 $w.id1.clearValue() 清空组件值',
|
|
556
|
+
},
|
|
557
|
+
resetValue: {
|
|
558
|
+
name: 'resetValue',
|
|
559
|
+
label: '重置值',
|
|
560
|
+
description: '通过 $w.id1.resetValue() 重置组件为初始值',
|
|
561
|
+
},
|
|
562
|
+
clearValidate: {
|
|
563
|
+
name: 'clearValidate',
|
|
564
|
+
label: '清除校验',
|
|
565
|
+
description: '通过 $w.id1.clearValidate() 清除组件校验',
|
|
566
|
+
},
|
|
567
|
+
handleValidate: {
|
|
568
|
+
name: 'handleValidate',
|
|
569
|
+
label: '触发校验',
|
|
570
|
+
description: '通过 $w.id1.handleValidate() 校验组件值',
|
|
571
|
+
},
|
|
572
|
+
};
|
|
573
|
+
// 表单样式集合
|
|
574
|
+
export const getFormItemClasses = (classRoot) => {
|
|
575
|
+
if (classRoot.startsWith('wd-')) {
|
|
576
|
+
classRoot = classRoot.slice(3);
|
|
577
|
+
}
|
|
578
|
+
return [
|
|
579
|
+
{
|
|
580
|
+
name: '根元素',
|
|
581
|
+
selector: `.wd-${classRoot}-root`,
|
|
582
|
+
description: '组件最外层元素',
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
name: 'H5 端根元素',
|
|
586
|
+
selector: `.wd-h5-${classRoot}-root`,
|
|
587
|
+
description: '可设定 H5 端的根元素样式',
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
name: 'PC 端根元素',
|
|
591
|
+
selector: `.wd-pc-${classRoot}-root`,
|
|
592
|
+
description: '可设定 PC 端的根元素样式',
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
name: '小程序端根元素',
|
|
596
|
+
selector: `.wd-mp-${classRoot}-root`,
|
|
597
|
+
description: '可设定小程序端的根元素样式',
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
name: '无边框状态',
|
|
601
|
+
selector: `.wd-${classRoot}-root.is-borderless`,
|
|
602
|
+
description: '设置组件无边框状态样式',
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
name: '必填状态',
|
|
606
|
+
selector: `.wd-${classRoot}-root.is-required`,
|
|
607
|
+
description: '设置组件必填状态样式',
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
name: '标题',
|
|
611
|
+
selector: `.wd-${classRoot}__label`,
|
|
612
|
+
description: '组件标题元素',
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
name: '标题禁用状态',
|
|
616
|
+
selector: `.wd-${classRoot}__label.is-disabled`,
|
|
617
|
+
description: '设置组件标题禁用状态样式',
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
name: '标题不换行',
|
|
621
|
+
selector: `.wd-${classRoot}__label.is-nowrap`,
|
|
622
|
+
description: '设置组件标题不换行时状态样式',
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
name: '前缀文字',
|
|
626
|
+
selector: `.wd-${classRoot}__text-before`,
|
|
627
|
+
description: '设置组件前缀文字样式',
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
name: '后缀文字',
|
|
631
|
+
selector: `.wd-${classRoot}__text-after`,
|
|
632
|
+
description: '设置组件后缀文字样式',
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
name: '前缀图标',
|
|
636
|
+
selector: `.wd-${classRoot}__icon-before`,
|
|
637
|
+
description: '设置组件前缀图标样式',
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
name: '后缀图标',
|
|
641
|
+
selector: `.wd-${classRoot}__icon-after`,
|
|
642
|
+
description: '设置组件后缀图标样式',
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
name: '提示文字',
|
|
646
|
+
selector: `.wd-${classRoot}__help`,
|
|
647
|
+
description: '设置组件提示文字样式',
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
name: '校验信息',
|
|
651
|
+
selector: `.wd-${classRoot}__error`,
|
|
652
|
+
description: '设置组件校验信息样式',
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
name: '组件本身',
|
|
656
|
+
selector: `.wd-${classRoot}-${classRoot}`,
|
|
657
|
+
description: '组件本身元素',
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
name: '组件输入禁用状态',
|
|
661
|
+
selector: `.wd-${classRoot}-${classRoot}.is-disabled`,
|
|
662
|
+
description: '组件本身元素',
|
|
663
|
+
},
|
|
664
|
+
];
|
|
665
|
+
};
|
|
666
|
+
// 表单配置集合
|
|
667
|
+
export const FORM_ITEM_META = {
|
|
668
|
+
group: {
|
|
669
|
+
通用: {
|
|
670
|
+
'x-index': -1,
|
|
671
|
+
expand: true,
|
|
672
|
+
},
|
|
673
|
+
},
|
|
674
|
+
shortcut: {
|
|
675
|
+
props: ['name', 'label'],
|
|
676
|
+
formauto: true,
|
|
677
|
+
},
|
|
678
|
+
visible: ['APP'],
|
|
679
|
+
category: '表单',
|
|
680
|
+
};
|
|
681
|
+
export const ItemData = Type.Partial(Type.Object(FORM_ITEM_DATA));
|
|
@@ -8,7 +8,7 @@ export default function JsonSchemaView({ schema, }) {
|
|
|
8
8
|
}
|
|
9
9
|
if (properties) {
|
|
10
10
|
return (_jsx("ul", { children: Object.entries(properties).map(([name, config]) => {
|
|
11
|
-
return (_jsxs("li", { children: [_jsx("b", { children: name }), ":", _jsx("code", { children: config.type }), config.description] }, name));
|
|
11
|
+
return (_jsxs("li", { children: [_jsx("b", { children: name }), ":", _jsx("code", { children: config.type }), (config === null || config === void 0 ? void 0 : config.description) || (config === null || config === void 0 ? void 0 : config.title)] }, name));
|
|
12
12
|
}) }));
|
|
13
13
|
}
|
|
14
14
|
}
|