@baishuyun/coze-provider 0.0.1
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/.turbo/turbo-build.log +22 -0
- package/CHANGELOG.md +7 -0
- package/dist/index.d.mts +42 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +1766 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1732 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +50 -0
- package/src/const.ts +1 -0
- package/src/coze-language-model.ts +150 -0
- package/src/coze-provider.ts +102 -0
- package/src/evt-sample.ts +28 -0
- package/src/index.ts +4 -0
- package/src/stream-trasnformer/fields-json-transform-stream.ts +108 -0
- package/src/stream-trasnformer/llm-chunk-injector-transform-stream.ts +66 -0
- package/src/stream-trasnformer/llm-part-transform-stream.ts +34 -0
- package/src/stream-trasnformer/mcp-chunk-filter-transform-stream.ts +52 -0
- package/src/stream-trasnformer/suggestion-transform-stream.ts +35 -0
- package/src/types.ts +26 -0
- package/src/utils/build-widget-name.ts +15 -0
- package/src/utils/enqueue-text-info.ts +35 -0
- package/src/utils/excel2json.ts +44 -0
- package/src/utils/fields-json-rebuild/default-builder.ts +3 -0
- package/src/utils/fields-json-rebuild/index.ts +82 -0
- package/src/utils/fields-json-rebuild/rebuild-address.ts +36 -0
- package/src/utils/fields-json-rebuild/rebuild-button.ts +46 -0
- package/src/utils/fields-json-rebuild/rebuild-checkbox-group.ts +35 -0
- package/src/utils/fields-json-rebuild/rebuild-combo-checker.ts +38 -0
- package/src/utils/fields-json-rebuild/rebuild-data-linker.ts +30 -0
- package/src/utils/fields-json-rebuild/rebuild-data-loader.ts +89 -0
- package/src/utils/fields-json-rebuild/rebuild-data-query.ts +34 -0
- package/src/utils/fields-json-rebuild/rebuild-date-time.ts +61 -0
- package/src/utils/fields-json-rebuild/rebuild-dept-group.ts +38 -0
- package/src/utils/fields-json-rebuild/rebuild-dept.ts +37 -0
- package/src/utils/fields-json-rebuild/rebuild-image.ts +61 -0
- package/src/utils/fields-json-rebuild/rebuild-line.ts +22 -0
- package/src/utils/fields-json-rebuild/rebuild-location.ts +37 -0
- package/src/utils/fields-json-rebuild/rebuild-number.ts +58 -0
- package/src/utils/fields-json-rebuild/rebuild-radio-group.ts +36 -0
- package/src/utils/fields-json-rebuild/rebuild-select.ts +37 -0
- package/src/utils/fields-json-rebuild/rebuild-signature.ts +26 -0
- package/src/utils/fields-json-rebuild/rebuild-sn.ts +26 -0
- package/src/utils/fields-json-rebuild/rebuild-subform.ts +71 -0
- package/src/utils/fields-json-rebuild/rebuild-text.ts +66 -0
- package/src/utils/fields-json-rebuild/rebuild-textarea.ts +44 -0
- package/src/utils/fields-json-rebuild/rebuild-upload.ts +31 -0
- package/src/utils/fields-json-rebuild/rebuild-user-group.ts +39 -0
- package/src/utils/fields-json-rebuild/rebuild-user.ts +39 -0
- package/src/utils/mcp-to-llm-chunk.ts +105 -0
- package/src/utils/parse-multi-modal-message.ts +34 -0
- package/src/utils/prompt-to-model-msg.ts +93 -0
- package/tsconfig.json +14 -0
- package/tsup.config.ts +16 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { buildWidgetName } from "../build-widget-name";
|
|
2
|
+
|
|
3
|
+
export const rebuildDataLinker = (truncatedJson: unknown) => {
|
|
4
|
+
const { widget, label, ...rest } = (truncatedJson as any) || {};
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
widget: {
|
|
8
|
+
widgetName: buildWidgetName(),
|
|
9
|
+
widgetNameAlias: "",
|
|
10
|
+
customCls: null,
|
|
11
|
+
enable: true,
|
|
12
|
+
visible: true,
|
|
13
|
+
allowBlank: true,
|
|
14
|
+
rely: {
|
|
15
|
+
widgets: [],
|
|
16
|
+
},
|
|
17
|
+
linkFilter: {},
|
|
18
|
+
allowAdd: true, //允许新增关联表数据
|
|
19
|
+
refType: "form", //关联表的类型,只能是form
|
|
20
|
+
...widget,
|
|
21
|
+
linkFields: [],
|
|
22
|
+
labelStyle: label,
|
|
23
|
+
type: "linkdata",
|
|
24
|
+
},
|
|
25
|
+
label,
|
|
26
|
+
lineWidth: 6,
|
|
27
|
+
tab: null,
|
|
28
|
+
...rest,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { buildWidgetName } from "../build-widget-name";
|
|
2
|
+
|
|
3
|
+
const tmpMapFields2Fields = (mapFieldsFromTruncatedJson: unknown[]) => {
|
|
4
|
+
if (!mapFieldsFromTruncatedJson || !mapFieldsFromTruncatedJson.length) {
|
|
5
|
+
return mapFieldsFromTruncatedJson;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return mapFieldsFromTruncatedJson.map((mf: any, index: number) => {
|
|
9
|
+
return {
|
|
10
|
+
id: index,
|
|
11
|
+
|
|
12
|
+
// name: "_widget_1761976674767",
|
|
13
|
+
// form: "a2f34ef882158a3e97da4ef7",
|
|
14
|
+
// tag: buildWidgetName("f_", index),
|
|
15
|
+
|
|
16
|
+
title: mf.field,
|
|
17
|
+
text: mf.field,
|
|
18
|
+
icon: `icon-widget-${mf.type}`,
|
|
19
|
+
type: mf.type,
|
|
20
|
+
isEditable: true,
|
|
21
|
+
group: "dimension,filter,select",
|
|
22
|
+
formula: "",
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const tmpMapFields2MapFields = (mapFieldsFromTruncatedJson: unknown[]) => {
|
|
28
|
+
if (!mapFieldsFromTruncatedJson || !mapFieldsFromTruncatedJson.length) {
|
|
29
|
+
return mapFieldsFromTruncatedJson;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return mapFieldsFromTruncatedJson.map((mf: any) => {
|
|
33
|
+
return {
|
|
34
|
+
mode: "depend",
|
|
35
|
+
...mf,
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const rebuildDataLoader = (truncatedJson: unknown) => {
|
|
41
|
+
const { widget, label, ...rest } = (truncatedJson as any) || {};
|
|
42
|
+
return {
|
|
43
|
+
widget: {
|
|
44
|
+
type: "dataload",
|
|
45
|
+
widgetName: buildWidgetName(),
|
|
46
|
+
widgetNameAlias: "",
|
|
47
|
+
customCls: null,
|
|
48
|
+
width: 350,
|
|
49
|
+
text: label,
|
|
50
|
+
enable: true,
|
|
51
|
+
visible: true,
|
|
52
|
+
allowBlank: true,
|
|
53
|
+
allowAddData: true, // 允许新增数据源数据
|
|
54
|
+
...widget,
|
|
55
|
+
mode: "list", //一直是 list 应该是废弃的
|
|
56
|
+
loaddataconfig: {
|
|
57
|
+
extendSet: {
|
|
58
|
+
sort: ["datahelp", "module", "formEvent"],
|
|
59
|
+
status: true,
|
|
60
|
+
triggerField: "",
|
|
61
|
+
triggerFieldMode: "none",
|
|
62
|
+
},
|
|
63
|
+
dataloadmode: ["add", "cover"],
|
|
64
|
+
filter: {
|
|
65
|
+
cond: [],
|
|
66
|
+
rel: "and",
|
|
67
|
+
},
|
|
68
|
+
defaultSort: [],
|
|
69
|
+
treeFields: {},
|
|
70
|
+
mode: "list",
|
|
71
|
+
selectFields: [],
|
|
72
|
+
triggerControl: null,
|
|
73
|
+
triggerWidget: null,
|
|
74
|
+
triggerFieldMode: "none",
|
|
75
|
+
triggerField: null,
|
|
76
|
+
forms: widget?.loaddataconfig?.forms,
|
|
77
|
+
selectArg: [],
|
|
78
|
+
selectRel: "and",
|
|
79
|
+
fields: tmpMapFields2Fields(widget?.loaddataconfig?.mapFields),
|
|
80
|
+
mapFields: tmpMapFields2MapFields(widget?.loaddataconfig?.mapFields),
|
|
81
|
+
},
|
|
82
|
+
labelStyle: label,
|
|
83
|
+
},
|
|
84
|
+
label,
|
|
85
|
+
lineWidth: 6,
|
|
86
|
+
tab: null,
|
|
87
|
+
...rest,
|
|
88
|
+
};
|
|
89
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { buildWidgetName } from "../build-widget-name";
|
|
2
|
+
|
|
3
|
+
export const rebuildDataQuery = (truncatedJson: unknown) => {
|
|
4
|
+
const { widget, label, ...rest } = (truncatedJson as any) || {};
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
widget: {
|
|
8
|
+
widgetName: buildWidgetName(),
|
|
9
|
+
widgetNameAlias: "",
|
|
10
|
+
customCls: null,
|
|
11
|
+
enable: true,
|
|
12
|
+
visible: true,
|
|
13
|
+
allowBlank: true,
|
|
14
|
+
linkFilter: {},
|
|
15
|
+
rely: {
|
|
16
|
+
widgets: [],
|
|
17
|
+
},
|
|
18
|
+
showMode: "one", //显示数据条数 one 一条 many 多条
|
|
19
|
+
allowAdd: true, //允许新增关联表数据,只有 refType 为 form才可以选择true
|
|
20
|
+
refType: "form", //关联表的类型,根据 linkForm 表的类型决定的。 form 表单 etl_table 视图 aggregate_table 聚合表
|
|
21
|
+
showType: "none", //数据显示模式 none 默认 label 标题
|
|
22
|
+
addExtendSet: [],
|
|
23
|
+
...widget,
|
|
24
|
+
linkFields: [],
|
|
25
|
+
labelStyle: label,
|
|
26
|
+
type: "linkquery",
|
|
27
|
+
},
|
|
28
|
+
description: null,
|
|
29
|
+
label,
|
|
30
|
+
lineWidth: 6,
|
|
31
|
+
tab: null,
|
|
32
|
+
...rest,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export const rebuildDatetime = (truncatedJson: unknown) => {
|
|
2
|
+
const { widget, label, ...rest } = (truncatedJson as any) || {};
|
|
3
|
+
|
|
4
|
+
return {
|
|
5
|
+
widget: {
|
|
6
|
+
type: "datetime",
|
|
7
|
+
height: 34,
|
|
8
|
+
width: 350,
|
|
9
|
+
enable: true,
|
|
10
|
+
visible: true,
|
|
11
|
+
allowBlank: true,
|
|
12
|
+
funMode: "module",
|
|
13
|
+
widgetName: `_widget_${Date.now()}`,
|
|
14
|
+
|
|
15
|
+
widgetNameAlias: "",
|
|
16
|
+
customCls: null,
|
|
17
|
+
value: "today", //默认值, today 填写当前时间 ,如果是数字,如 1762957800000 ,是自定义的时间,为所选时间的时间戳的毫秒级,
|
|
18
|
+
rely: null,
|
|
19
|
+
module: null,
|
|
20
|
+
libs: [],
|
|
21
|
+
extendSet: {
|
|
22
|
+
sort: ["datahelp", "module", "formEvent"],
|
|
23
|
+
status: true,
|
|
24
|
+
triggerField: "",
|
|
25
|
+
triggerFieldMode: "none",
|
|
26
|
+
version: 1,
|
|
27
|
+
},
|
|
28
|
+
hint: "",
|
|
29
|
+
dateLimit: {
|
|
30
|
+
//日期范围
|
|
31
|
+
week: {
|
|
32
|
+
//可选择星期
|
|
33
|
+
enable: false, //是否开启可选择星期
|
|
34
|
+
value: [
|
|
35
|
+
//星期 星期一到天,用1-7代表
|
|
36
|
+
1, 2, 6,
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
start: {
|
|
40
|
+
//最早可选时间
|
|
41
|
+
enable: false, //是否开启最早可选时间
|
|
42
|
+
mode: "dynamic", //模式: dynamic 动态 static 固定值 fieldValue 字段值
|
|
43
|
+
value: "yesterday", //限定的值: today 今天 yesterday 昨天 tomorrow 明天 7day_before 七天前 7day_after 七天后 30day_before 30天前 30day_after 30天后
|
|
44
|
+
},
|
|
45
|
+
end: {
|
|
46
|
+
//最晚可选时间
|
|
47
|
+
enable: false, //是否开启最晚可选时间
|
|
48
|
+
mode: "static", //模式: dynamic 动态 static 固定值 fieldValue 字段值
|
|
49
|
+
value: 1762093800000, //限定的值:这种数字的为 选择的固定值,时间的时间戳,毫秒级别 ,如果为 _widget_1762154537014 这种,为字段的值,这个字段需要也是日期字段,和当前这个字段是同一个 format的
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
...widget,
|
|
54
|
+
labelStyle: label,
|
|
55
|
+
},
|
|
56
|
+
label,
|
|
57
|
+
lineWidth: 6,
|
|
58
|
+
tab: null,
|
|
59
|
+
...rest,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { buildWidgetName } from "../build-widget-name";
|
|
2
|
+
|
|
3
|
+
export const rebuildDeptGroup = (truncatedJson: unknown) => {
|
|
4
|
+
const { widget, label, ...rest } = (truncatedJson as any) || {};
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
widget: {
|
|
8
|
+
type: "deptgroup",
|
|
9
|
+
widgetName: buildWidgetName(),
|
|
10
|
+
widgetNameAlias: "",
|
|
11
|
+
customCls: null,
|
|
12
|
+
height: "34",
|
|
13
|
+
width: 350,
|
|
14
|
+
enable: true,
|
|
15
|
+
visible: true,
|
|
16
|
+
allowBlank: true,
|
|
17
|
+
funMode: "module",
|
|
18
|
+
module: null,
|
|
19
|
+
libs: [],
|
|
20
|
+
extendSet: {
|
|
21
|
+
sort: ["datahelp", "module", "formEvent"],
|
|
22
|
+
status: true,
|
|
23
|
+
triggerField: "",
|
|
24
|
+
triggerFieldMode: "none",
|
|
25
|
+
version: 1,
|
|
26
|
+
},
|
|
27
|
+
noRepeat: false,
|
|
28
|
+
limit: {},
|
|
29
|
+
valueOption: 0,
|
|
30
|
+
...widget,
|
|
31
|
+
labelStyle: label,
|
|
32
|
+
},
|
|
33
|
+
label,
|
|
34
|
+
lineWidth: 6,
|
|
35
|
+
tab: null,
|
|
36
|
+
...rest,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { buildWidgetName } from "../build-widget-name";
|
|
2
|
+
|
|
3
|
+
export const rebuildDept = (truncatedJson: unknown) => {
|
|
4
|
+
const { widget, label, ...rest } = (truncatedJson as any) || {};
|
|
5
|
+
return {
|
|
6
|
+
widget: {
|
|
7
|
+
type: "dept",
|
|
8
|
+
widgetName: buildWidgetName(),
|
|
9
|
+
widgetNameAlias: "",
|
|
10
|
+
customCls: null,
|
|
11
|
+
height: "34",
|
|
12
|
+
width: 350,
|
|
13
|
+
enable: true,
|
|
14
|
+
visible: true,
|
|
15
|
+
allowBlank: true,
|
|
16
|
+
funMode: "module",
|
|
17
|
+
module: null,
|
|
18
|
+
libs: [],
|
|
19
|
+
extendSet: {
|
|
20
|
+
sort: ["datahelp", "module", "formEvent"],
|
|
21
|
+
status: true,
|
|
22
|
+
triggerField: "",
|
|
23
|
+
triggerFieldMode: "none",
|
|
24
|
+
version: 1,
|
|
25
|
+
},
|
|
26
|
+
noRepeat: false,
|
|
27
|
+
limit: {},
|
|
28
|
+
valueOption: 0,
|
|
29
|
+
...widget,
|
|
30
|
+
labelStyle: label,
|
|
31
|
+
},
|
|
32
|
+
label,
|
|
33
|
+
lineWidth: 6,
|
|
34
|
+
tab: null,
|
|
35
|
+
...rest,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { buildWidgetName } from "../build-widget-name";
|
|
2
|
+
|
|
3
|
+
export const rebuildImage = (truncatedJson: unknown) => {
|
|
4
|
+
const { widget, label, ...rest }: any = (truncatedJson as any) || {};
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
widget: {
|
|
8
|
+
type: "image",
|
|
9
|
+
widgetName: buildWidgetName(),
|
|
10
|
+
widgetNameAlias: "",
|
|
11
|
+
customCls: null,
|
|
12
|
+
height: 100,
|
|
13
|
+
enable: true,
|
|
14
|
+
visible: true,
|
|
15
|
+
allowBlank: true,
|
|
16
|
+
funMode: "module",
|
|
17
|
+
module: null,
|
|
18
|
+
libs: [],
|
|
19
|
+
extendSet: {
|
|
20
|
+
sort: ["datahelp", "module", "formEvent"],
|
|
21
|
+
status: true,
|
|
22
|
+
triggerField: "",
|
|
23
|
+
triggerFieldMode: "none",
|
|
24
|
+
version: 1,
|
|
25
|
+
},
|
|
26
|
+
download: true, //打包下载
|
|
27
|
+
is_file_down: true, //操作权限 可下载
|
|
28
|
+
check_image_exif: true, //照片支持查看EXIF扩展信息
|
|
29
|
+
online_edit: false,
|
|
30
|
+
online_edit_record: false,
|
|
31
|
+
fileType: [
|
|
32
|
+
//支持上传的类型,默认,不可以设置
|
|
33
|
+
"jpg",
|
|
34
|
+
"jpeg",
|
|
35
|
+
"png",
|
|
36
|
+
"gif",
|
|
37
|
+
"bmp",
|
|
38
|
+
"tif",
|
|
39
|
+
],
|
|
40
|
+
compressed: true, //三方图片压缩
|
|
41
|
+
wxOriginalComponent: true, //微信/企业微信原生拍照模式
|
|
42
|
+
onlyCamera: false, //仅允许拍照上传
|
|
43
|
+
preview: true, //是否可以预览 默认 不可以设置
|
|
44
|
+
watermarkSwitch: true, //水印属性
|
|
45
|
+
watermarkPosition: "center", //水印位置
|
|
46
|
+
watermarkFieldTitle: true, //是否显示水印字段标题
|
|
47
|
+
watermarkSize: "14", //水印字体大小 不可以设置
|
|
48
|
+
watermarkFixedField: {},
|
|
49
|
+
previewWidth: 450, //预览的宽 默认 不可以设置
|
|
50
|
+
previewHeight: 450, //预览的高 默认 不可以设置
|
|
51
|
+
browserCompress: true, //浏览器图片压缩
|
|
52
|
+
quality: 0.7, //压缩图片比例,开启 浏览器图片压缩 后才能设置
|
|
53
|
+
...widget,
|
|
54
|
+
labelStyle: label,
|
|
55
|
+
},
|
|
56
|
+
label,
|
|
57
|
+
lineWidth: 6,
|
|
58
|
+
tab: null,
|
|
59
|
+
...rest,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { buildWidgetName } from "../build-widget-name";
|
|
2
|
+
|
|
3
|
+
export const rebuildLine = (truncatedJson: unknown) => {
|
|
4
|
+
const { widget, label, ...rest } = (truncatedJson as any) || {};
|
|
5
|
+
return {
|
|
6
|
+
widget: {
|
|
7
|
+
type: "separator",
|
|
8
|
+
widgetName: buildWidgetName(),
|
|
9
|
+
widgetNameAlias: "",
|
|
10
|
+
customCls: null,
|
|
11
|
+
enable: true,
|
|
12
|
+
visible: true,
|
|
13
|
+
allowBlank: true,
|
|
14
|
+
...widget,
|
|
15
|
+
labelStyle: label,
|
|
16
|
+
},
|
|
17
|
+
label,
|
|
18
|
+
lineWidth: 12,
|
|
19
|
+
tab: null,
|
|
20
|
+
...rest,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { buildWidgetName } from "../build-widget-name";
|
|
2
|
+
|
|
3
|
+
export const rebuildLocation = (truncatedJson: unknown) => {
|
|
4
|
+
const { widget, label, ...rest } = (truncatedJson as any) || {};
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
widget: {
|
|
8
|
+
type: "location",
|
|
9
|
+
widgetName: buildWidgetName(),
|
|
10
|
+
widgetNameAlias: "",
|
|
11
|
+
customCls: null,
|
|
12
|
+
enable: true,
|
|
13
|
+
visible: true,
|
|
14
|
+
allowBlank: true,
|
|
15
|
+
funMode: "module",
|
|
16
|
+
module: null,
|
|
17
|
+
libs: [],
|
|
18
|
+
extendSet: {
|
|
19
|
+
sort: ["datahelp", "module", "formEvent"],
|
|
20
|
+
status: true,
|
|
21
|
+
triggerField: "",
|
|
22
|
+
triggerFieldMode: "none",
|
|
23
|
+
version: 1,
|
|
24
|
+
},
|
|
25
|
+
adjustable: true, //允许移动端微调
|
|
26
|
+
lnglatVisible: true, //显示经纬度坐标
|
|
27
|
+
autoLocation: true, //移动端自动触发定位
|
|
28
|
+
enablePcLocation: true, //允许PC端定位并选择位置
|
|
29
|
+
...widget,
|
|
30
|
+
labelStyle: label,
|
|
31
|
+
},
|
|
32
|
+
label,
|
|
33
|
+
lineWidth: 6,
|
|
34
|
+
tab: null,
|
|
35
|
+
...rest,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { buildWidgetName } from "../build-widget-name";
|
|
2
|
+
|
|
3
|
+
export const rebuildNumber = (value: unknown): unknown => {
|
|
4
|
+
const { widget, label, ...rest } = (value as any) || {};
|
|
5
|
+
return {
|
|
6
|
+
widget: {
|
|
7
|
+
type: "number",
|
|
8
|
+
widgetName: buildWidgetName(),
|
|
9
|
+
widgetNameAlias: "",
|
|
10
|
+
triggerEvent: false,
|
|
11
|
+
customCls: null,
|
|
12
|
+
height: 34,
|
|
13
|
+
width: 350,
|
|
14
|
+
enable: true,
|
|
15
|
+
visible: true,
|
|
16
|
+
allowBlank: true,
|
|
17
|
+
funMode: "module",
|
|
18
|
+
module: null,
|
|
19
|
+
libs: [],
|
|
20
|
+
extendSet: {
|
|
21
|
+
sort: ["datahelp", "module", "formEvent"],
|
|
22
|
+
status: true,
|
|
23
|
+
triggerField: "",
|
|
24
|
+
triggerFieldMode: "none",
|
|
25
|
+
version: 1,
|
|
26
|
+
},
|
|
27
|
+
// regex,
|
|
28
|
+
// hint: placeholder,
|
|
29
|
+
noRepeat: false,
|
|
30
|
+
alertinfo: {
|
|
31
|
+
icon: "success",
|
|
32
|
+
tip: "请设置提示内容",
|
|
33
|
+
},
|
|
34
|
+
allowDecimals: true, //允许小数,默认值 true,已废弃
|
|
35
|
+
allowNegative: true, //允许负数,默认值 true ,已废弃
|
|
36
|
+
// maxNumber: max, //限定数值范围 最大值
|
|
37
|
+
// minNumber: min, //限定数值范围 最小值
|
|
38
|
+
displayMode: "percent", // 新的格式, percent 百分比 number 数值
|
|
39
|
+
precision: null, //保留小数位数
|
|
40
|
+
thousandsSeparator: false, //显示千分符
|
|
41
|
+
notround: true, //不四舍五入
|
|
42
|
+
format: "", //旧的格式,新的由多个属性来控制,前端代码会用其他几个参数拼接出正确的这个值。 其中结尾有% 代表百分比 ,没有%代表数字 ,然后小数点后面的0的个数代表 保留的小数位数,如果小数点后面没有0代表(如0.%),代表没有设置 保留小数位数,保留用户输入的所有小数
|
|
43
|
+
afterSuffix: {
|
|
44
|
+
//单位
|
|
45
|
+
zh_cn: "", //中文的
|
|
46
|
+
en_us: "", //英文的
|
|
47
|
+
zh_tw: "", //繁体的
|
|
48
|
+
},
|
|
49
|
+
...widget,
|
|
50
|
+
labelStyle: label,
|
|
51
|
+
},
|
|
52
|
+
// description,
|
|
53
|
+
label,
|
|
54
|
+
lineWidth: 6,
|
|
55
|
+
tab: null,
|
|
56
|
+
...rest,
|
|
57
|
+
};
|
|
58
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const rebuildRadioGroup = (truncatedJson: unknown) => {
|
|
2
|
+
const { widget, label, ...rest } = (truncatedJson as any) || {};
|
|
3
|
+
return {
|
|
4
|
+
widget: {
|
|
5
|
+
enable: true,
|
|
6
|
+
visible: true,
|
|
7
|
+
allowBlank: true,
|
|
8
|
+
funMode: "module",
|
|
9
|
+
module: null,
|
|
10
|
+
libs: [],
|
|
11
|
+
// items: options,
|
|
12
|
+
layout: "vertical",
|
|
13
|
+
stopCancel: false,
|
|
14
|
+
widgetName: `_widget_${Date.now()}`,
|
|
15
|
+
widgetNameAlias: "",
|
|
16
|
+
customCls: null,
|
|
17
|
+
value: null,
|
|
18
|
+
extendSet: {
|
|
19
|
+
sort: ["datahelp", "module", "formEvent"],
|
|
20
|
+
status: true,
|
|
21
|
+
triggerField: "",
|
|
22
|
+
triggerFieldMode: "none",
|
|
23
|
+
version: 1,
|
|
24
|
+
},
|
|
25
|
+
colorEnable: true, //颜色 是否开启颜色
|
|
26
|
+
...widget,
|
|
27
|
+
type: "radiogroup",
|
|
28
|
+
},
|
|
29
|
+
// description,
|
|
30
|
+
label,
|
|
31
|
+
lineWidth: 6,
|
|
32
|
+
tab: null,
|
|
33
|
+
...rest,
|
|
34
|
+
labelStyle: label,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const rebuildSelect = (truncatedJson: unknown) => {
|
|
2
|
+
const { widget, label, ...rest } = (truncatedJson as any) || {};
|
|
3
|
+
return {
|
|
4
|
+
widget: {
|
|
5
|
+
type: "combo",
|
|
6
|
+
height: 34,
|
|
7
|
+
width: 350,
|
|
8
|
+
enable: true,
|
|
9
|
+
visible: true,
|
|
10
|
+
allowBlank: true,
|
|
11
|
+
mode: 1,
|
|
12
|
+
allowAddLinkData: false,
|
|
13
|
+
// items: options,
|
|
14
|
+
widgetName: `_widget_${Date.now()}`,
|
|
15
|
+
widgetNameAlias: "",
|
|
16
|
+
customCls: null,
|
|
17
|
+
funMode: "module",
|
|
18
|
+
module: null,
|
|
19
|
+
libs: [],
|
|
20
|
+
extendSet: {
|
|
21
|
+
sort: ["datahelp", "module", "formEvent"],
|
|
22
|
+
status: true,
|
|
23
|
+
triggerField: "",
|
|
24
|
+
triggerFieldMode: "none",
|
|
25
|
+
version: 1,
|
|
26
|
+
},
|
|
27
|
+
colorEnable: true, //颜色 是否开启颜色
|
|
28
|
+
...widget,
|
|
29
|
+
labelStyle: label,
|
|
30
|
+
},
|
|
31
|
+
// description,
|
|
32
|
+
label,
|
|
33
|
+
lineWidth: 6,
|
|
34
|
+
tab: null,
|
|
35
|
+
...rest,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { buildWidgetName } from "../build-widget-name";
|
|
2
|
+
|
|
3
|
+
export const rebuildSignature = (truncatedJson: unknown) => {
|
|
4
|
+
const { widget, label, ...rest } = (truncatedJson as any) || {};
|
|
5
|
+
return {
|
|
6
|
+
widget: {
|
|
7
|
+
type: "signature",
|
|
8
|
+
widgetName: buildWidgetName(),
|
|
9
|
+
widgetNameAlias: "",
|
|
10
|
+
customCls: null,
|
|
11
|
+
height: 34,
|
|
12
|
+
width: 350,
|
|
13
|
+
enable: true,
|
|
14
|
+
visible: true,
|
|
15
|
+
allowBlank: true,
|
|
16
|
+
rely: null,
|
|
17
|
+
...widget,
|
|
18
|
+
labelStyle: label,
|
|
19
|
+
},
|
|
20
|
+
description: null,
|
|
21
|
+
label,
|
|
22
|
+
lineWidth: 6,
|
|
23
|
+
tab: null,
|
|
24
|
+
...rest,
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { buildWidgetName } from "../build-widget-name";
|
|
2
|
+
|
|
3
|
+
export const rebuildSn = (truncatedJson: unknown) => {
|
|
4
|
+
const { widget, label, ...rest } = (truncatedJson as any) || {};
|
|
5
|
+
return {
|
|
6
|
+
widget: {
|
|
7
|
+
type: "sn",
|
|
8
|
+
widgetName: buildWidgetName(),
|
|
9
|
+
widgetNameAlias: "",
|
|
10
|
+
triggerEvent: 0,
|
|
11
|
+
customCls: null,
|
|
12
|
+
width: 350,
|
|
13
|
+
enable: true,
|
|
14
|
+
visible: true,
|
|
15
|
+
// rules: rules,
|
|
16
|
+
importMode: 1, //导入模式 1 excel末尾递增 2 excel最大值递增 3 excel/表单最大值比较递增
|
|
17
|
+
...widget,
|
|
18
|
+
labelStyle: label,
|
|
19
|
+
},
|
|
20
|
+
// description,
|
|
21
|
+
label,
|
|
22
|
+
lineWidth: 6,
|
|
23
|
+
tab: null,
|
|
24
|
+
...rest,
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { rebuildFieldsJsonStructure } from ".";
|
|
2
|
+
import { buildWidgetName } from "../build-widget-name";
|
|
3
|
+
|
|
4
|
+
export const rebuildSubform = (originObj: unknown = {}) => {
|
|
5
|
+
const { widget, label, ...rest } = originObj as any;
|
|
6
|
+
return {
|
|
7
|
+
widget: {
|
|
8
|
+
type: "subform",
|
|
9
|
+
widgetName: buildWidgetName(),
|
|
10
|
+
widgetNameAlias: "",
|
|
11
|
+
customCls: null,
|
|
12
|
+
enable: true,
|
|
13
|
+
visible: true,
|
|
14
|
+
allowBlank: true,
|
|
15
|
+
labelStyle: label,
|
|
16
|
+
extendSet: {
|
|
17
|
+
sort: ["datahelp", "module", "formEvent"],
|
|
18
|
+
status: true,
|
|
19
|
+
triggerField: "",
|
|
20
|
+
triggerFieldMode: "none",
|
|
21
|
+
version: 1,
|
|
22
|
+
},
|
|
23
|
+
items: (widget.items || []).map((item: any, index: number) => {
|
|
24
|
+
const result = rebuildFieldsJsonStructure(item, true);
|
|
25
|
+
|
|
26
|
+
result.widget.widgetName = buildWidgetName("_widget", index);
|
|
27
|
+
|
|
28
|
+
return result;
|
|
29
|
+
}),
|
|
30
|
+
sortable: true, //启用子表单数据排序
|
|
31
|
+
allowImportV2: false, //从excel导入数据
|
|
32
|
+
sticky_column: {
|
|
33
|
+
//PC端冻结前 n 列
|
|
34
|
+
limit: 2, //多少列 范围 1-3
|
|
35
|
+
enable: true, //是否开启
|
|
36
|
+
},
|
|
37
|
+
sticky_column_mobile: {
|
|
38
|
+
//移动端冻结前 n 列
|
|
39
|
+
limit: 1, //多少列 范围 1-3
|
|
40
|
+
enable: true, //是否开启
|
|
41
|
+
},
|
|
42
|
+
mobileStyle: "table", //移动端显示样式 list 纵向展开 table 横向表格
|
|
43
|
+
subform_create: true, //可新增记录
|
|
44
|
+
subform_insert: true, //可插入记录
|
|
45
|
+
subform_edit: true, //可编辑已有记录
|
|
46
|
+
subform_delete: true, //可删除已有记录
|
|
47
|
+
subform_fill: true, //允许填报数据
|
|
48
|
+
subform_import: true, //允许导入数据
|
|
49
|
+
subform_dataload: true, //允许数据加载
|
|
50
|
+
loaddataconfig: {
|
|
51
|
+
//数据加载设置
|
|
52
|
+
mode: "tree",
|
|
53
|
+
extendSet: {
|
|
54
|
+
sort: ["datahelp", "module", "formEvent"],
|
|
55
|
+
status: true,
|
|
56
|
+
triggerField: "",
|
|
57
|
+
triggerFieldMode: "none",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
allowLoadData: false, //是否开启数据加载
|
|
61
|
+
allowAddData: true, //允许新增数据源数据
|
|
62
|
+
subformloaddataTitle: "数据加载", //数据加载显示的标题
|
|
63
|
+
subFieldShowRules: [], //子字段显隐规则
|
|
64
|
+
quick_fill: true, //从excel填报数据
|
|
65
|
+
},
|
|
66
|
+
description: null,
|
|
67
|
+
label,
|
|
68
|
+
lineWidth: 12,
|
|
69
|
+
tab: null,
|
|
70
|
+
};
|
|
71
|
+
};
|