@cniot/mdd-editor 0.2.0-beta.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.MD +311 -11
- package/build/index.cjs.js +27 -25
- package/build/index.es.js +3679 -507
- package/build/style.css +1 -1
- package/package.json +1 -1
- package/src/ai/LocalAIDrawer.jsx +211 -0
- package/src/ai/bridgeClient.js +76 -0
- package/src/ai/pageIR.js +148 -0
- package/src/components/address-select/formily.jsx +1 -1
- package/src/components/ajax-schema-form/formily-table-form-proxy.jsx +1 -1
- package/src/components/ajax-schema-form/formily.jsx +1 -1
- package/src/components/ajax-schema-form/table-form-proxy.jsx +1 -1
- package/src/components/ajax-schema-form/table-form.jsx +1 -1
- package/src/components/data-source-select/formily.jsx +1 -1
- package/src/components/dynamic-value/base/formily.jsx +1 -1
- package/src/components/dynamic-value/date/formily.jsx +1 -1
- package/src/components/formily-select/index.tsx +1 -1
- package/src/components/params-select/formily.jsx +1 -1
- package/src/components/time-range/formily.jsx +1 -1
- package/src/hooks/useSchema.jsx +5 -5
- package/src/hooks/useSwagger.jsx +2 -2
- package/src/schema/base-schema/AjaxSchema.js +1 -1
- package/src/schema/base-schema/AjaxSchemaQueue.js +1 -1
- package/src/schema/blocks/edit-table.js +57 -0
- package/src/schema/blocks/filter.js +49 -0
- package/src/schema/blocks/form.js +49 -0
- package/src/schema/blocks/index.js +32 -10
- package/src/schema/blocks/table.js +3 -4
- package/src/schema/detail/detail-item.js +5 -5
- package/src/schema/detail/index.js +26 -18
- package/src/schema/edit-table/header-toolbar.js +1 -1
- package/src/schema/edit-table/index.js +10 -5
- package/src/schema/edit-table/table.js +10 -2
- package/src/schema/formily-form/data-source.js +1 -1
- package/src/schema/formily-form/form-schema.js +1 -1
- package/src/schema/formily-form/index.js +8 -8
- package/src/schema/formily-form-v2/form-info.js +2 -2
- package/src/schema/formily-form-v2/form-items.js +1 -1
- package/src/schema/formily-form-v2/index.js +3 -3
- package/src/schema/ftp/data-source.js +1 -1
- package/src/schema/ftp/filter.js +2 -2
- package/src/schema/ftp/header-toolbar.js +1 -1
- package/src/schema/ftp/index.js +4 -4
- package/src/schema/ftp/middle-item.js +1 -1
- package/src/schema/ftp/table.js +9 -3
- package/src/schema/util.js +3 -3
- package/src/services/index.js +1 -1
- package/src/template/blocks/EditTable.jsx +62 -0
- package/src/template/blocks/Filter.jsx +137 -0
- package/src/template/blocks/Form.jsx +136 -0
- package/src/template/blocks/Table.jsx +4 -4
- package/src/template/const.js +22 -5
- package/src/template/detail/DetailItems.jsx +6 -1
- package/src/template/detail/components/Actions.jsx +1 -1
- package/src/template/detail/components/DetailCard.jsx +8 -5
- package/src/template/detail/components/DetailColumns.jsx +193 -113
- package/src/template/detail/components/DetailCustom.jsx +2 -2
- package/src/template/detail/components/DetailTable.jsx +13 -8
- package/src/template/detail/components/MultiAjaxSchemaForm.jsx +1 -1
- package/src/template/edit-table/HeaderToolbar.jsx +3 -2
- package/src/template/edit-table/Table.jsx +56 -3
- package/src/template/formily-form-v2/FormInfo.jsx +1 -1
- package/src/template/formily-form-v2/FormItems.jsx +4 -8
- package/src/template/formilyform/components/AsyncDataSourceSetter/index.tsx +1 -1
- package/src/template/formilyform/components/SubmitActionSetter/index.tsx +1 -1
- package/src/template/ftp/DataSource.jsx +1 -1
- package/src/template/ftp/Filter.jsx +14 -7
- package/src/template/ftp/HeaderToolbar.jsx +8 -4
- package/src/template/ftp/Middle.jsx +11 -7
- package/src/template/ftp/Table.jsx +143 -12
- package/src/template/simple-ftp/Table.jsx +2 -2
- package/src/toolbar.jsx +76 -14
- package/src/utils/buildFieldsToCompJson.js +3 -3
- package/src/utils/persistentStorage.js +1 -1
- package/src/utils/swagger/api2SchemaFromSwagger.js +7 -7
package/src/schema/ftp/filter.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import JSONWatch from '
|
|
2
|
-
import { getDefaultFomrLabelAlign } from '
|
|
1
|
+
import JSONWatch from '$src/utils/JSONWatch';
|
|
2
|
+
import { getDefaultFomrLabelAlign } from '$src/utils';
|
|
3
3
|
|
|
4
4
|
export default class Filter extends JSONWatch {
|
|
5
5
|
constructor(props) {
|
package/src/schema/ftp/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import JSONWatch from '
|
|
2
|
-
import { EVENT_KEY } from '
|
|
1
|
+
import JSONWatch from '$src/utils/JSONWatch';
|
|
2
|
+
import { EVENT_KEY } from '$src/common/const';
|
|
3
3
|
import Schema from '../Schema';
|
|
4
4
|
import { Message } from '@cainiaofe/cn-ui';
|
|
5
5
|
import Table from './table';
|
|
@@ -8,8 +8,8 @@ import Filter from './filter';
|
|
|
8
8
|
// import Tab from './tab';
|
|
9
9
|
// import DataSource from './data-source';
|
|
10
10
|
import AjaxSchema from '../base-schema/AjaxSchema';
|
|
11
|
-
import buildSwaggerApiJson from '
|
|
12
|
-
import buildFieldsToCompJson from '
|
|
11
|
+
import buildSwaggerApiJson from '$src/utils/buildSwaggerApiJson';
|
|
12
|
+
import buildFieldsToCompJson from '$src/utils/buildFieldsToCompJson';
|
|
13
13
|
|
|
14
14
|
import MiddleItem from './middle-item';
|
|
15
15
|
|
package/src/schema/ftp/table.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
/* eslint-disable indent */
|
|
2
|
-
import JSONWatch from '
|
|
2
|
+
import JSONWatch from '$src/utils/JSONWatch';
|
|
3
3
|
import AjaxSchema from '../base-schema/AjaxSchema';
|
|
4
4
|
|
|
5
5
|
export default class TableSchema extends JSONWatch {
|
|
6
6
|
constructor(props) {
|
|
7
7
|
const {
|
|
8
8
|
columns = [],
|
|
9
|
+
rowDoubleClick = [],
|
|
9
10
|
actionColumns = [],
|
|
10
11
|
bulkActions = [],
|
|
11
12
|
primaryKey = 'id',
|
|
12
13
|
tree = false, // 开启树形
|
|
14
|
+
treeLinkageCheck = false, // 树形 是否父子级联勾选
|
|
13
15
|
showIndex = false, // 是否显示序号
|
|
14
|
-
hideCommonToolbar = false, //
|
|
16
|
+
hideCommonToolbar = false, // 是否隐藏通用顶部操作区
|
|
17
|
+
actionMaxCharNum, // 操作列按钮最长字符数,可能会对一码多端效果造成影响,慎用
|
|
15
18
|
actionWidth, // 操作列宽度
|
|
16
19
|
showSelect = false, // 是否显示勾选操作
|
|
17
20
|
remoteSort = false, // 是否开启远程排序
|
|
@@ -33,6 +36,7 @@ export default class TableSchema extends JSONWatch {
|
|
|
33
36
|
|
|
34
37
|
super({
|
|
35
38
|
columns,
|
|
39
|
+
rowDoubleClick,
|
|
36
40
|
actionColumns,
|
|
37
41
|
bulkActions,
|
|
38
42
|
primaryKey,
|
|
@@ -40,12 +44,14 @@ export default class TableSchema extends JSONWatch {
|
|
|
40
44
|
tree,
|
|
41
45
|
showIndex,
|
|
42
46
|
hideCommonToolbar,
|
|
47
|
+
actionMaxCharNum,
|
|
43
48
|
actionWidth,
|
|
44
49
|
showSelect,
|
|
45
50
|
rowDetailModule,
|
|
46
51
|
remoteSort,
|
|
47
52
|
useVirtual,
|
|
48
53
|
columnsAutoWidth,
|
|
54
|
+
treeLinkageCheck,
|
|
49
55
|
...more,
|
|
50
56
|
});
|
|
51
57
|
this.initAjaxSchemaData(loadChildrenDataApi);
|
|
@@ -92,7 +98,7 @@ export default class TableSchema extends JSONWatch {
|
|
|
92
98
|
* {array} actionColumns 操作列
|
|
93
99
|
* {object} pagination 分页
|
|
94
100
|
*/
|
|
95
|
-
if (['columns', 'actionColumns', 'bulkActions'].includes(key)) {
|
|
101
|
+
if (['columns', 'actionColumns', 'bulkActions', 'rowDoubleClick'].includes(key)) {
|
|
96
102
|
this.data[key].splice(index, 1, data);
|
|
97
103
|
} else {
|
|
98
104
|
this.data[key] = data;
|
package/src/schema/util.js
CHANGED
|
@@ -5,9 +5,9 @@ import FormilyFormSchema from './formily-form';
|
|
|
5
5
|
import FormilyFormV2Schema from './formily-form-v2';
|
|
6
6
|
import DetailSchema from './detail';
|
|
7
7
|
import EditTableSchema from './edit-table';
|
|
8
|
-
import { EVENT_KEY, MDD_SCHEMA_LS_KEY } from '
|
|
9
|
-
import storage from '
|
|
10
|
-
import { IS_VSCODE, emitSave } from '
|
|
8
|
+
import { EVENT_KEY, MDD_SCHEMA_LS_KEY } from '$src/common/const';
|
|
9
|
+
import storage from '$src/utils/persistentStorage';
|
|
10
|
+
import { IS_VSCODE, emitSave } from '$src/utils/vscode';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* 构建schema对象
|
package/src/services/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// import { request } from 'ice';
|
|
2
2
|
import axios from 'axios';
|
|
3
|
-
import jsonSchemaRefParser from '
|
|
3
|
+
import jsonSchemaRefParser from '$src/utils/jsonSchemaRefParser';
|
|
4
4
|
// import $RefParser from '@apidevtools/json-schema-ref-parser';
|
|
5
5
|
|
|
6
6
|
function transferOpenAPI3ToSwagger2(data) {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Input, Switch, Icon, NumberPicker } from '@cainiaofe/cn-ui';
|
|
3
|
+
import MddTableForm from '$src/components/mdd-table-form';
|
|
4
|
+
import { columnsTypeOptionsWithEditCnTable } from '../const';
|
|
5
|
+
|
|
6
|
+
export default function EditTablePanel({ schema }) {
|
|
7
|
+
const columnMddFormRef = React.useRef();
|
|
8
|
+
const [_, forceUpdate] = useState({});
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
schema.on('$updated', (changeData, ignoreUpdate) => {
|
|
11
|
+
!ignoreUpdate && forceUpdate({});
|
|
12
|
+
});
|
|
13
|
+
}, []);
|
|
14
|
+
|
|
15
|
+
const columns = schema.get('columns');
|
|
16
|
+
|
|
17
|
+
const onAddHandle = (key) => {
|
|
18
|
+
switch (key) {
|
|
19
|
+
case 'columns':
|
|
20
|
+
schema.add(
|
|
21
|
+
{
|
|
22
|
+
type: 'text',
|
|
23
|
+
label: '展示项',
|
|
24
|
+
name: '',
|
|
25
|
+
},
|
|
26
|
+
'columns',
|
|
27
|
+
true,
|
|
28
|
+
);
|
|
29
|
+
columnMddFormRef.current?.updateData(schema.get('columns'));
|
|
30
|
+
break;
|
|
31
|
+
default:
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const onRemoveHandle = (index, key) => {
|
|
36
|
+
schema.remove(index, key, true);
|
|
37
|
+
columnMddFormRef.current?.updateData(schema.get('columns'));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const onChangeHandle = ({ index, record }, key) => {
|
|
41
|
+
schema.update(index, record, key, true);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div>
|
|
46
|
+
<MddTableForm
|
|
47
|
+
ref={columnMddFormRef}
|
|
48
|
+
data={columns}
|
|
49
|
+
title="配置可编辑表格列"
|
|
50
|
+
componentOptions={columnsTypeOptionsWithEditCnTable.filter(
|
|
51
|
+
(col) => !['blocks-edit-table', 'blocks-table'].includes(col.value),
|
|
52
|
+
)}
|
|
53
|
+
onAdd={() => onAddHandle('columns')}
|
|
54
|
+
onRemove={(index) => onRemoveHandle(index, 'columns')}
|
|
55
|
+
onChange={({ index, record }) => onChangeHandle({ index, record }, 'columns')}
|
|
56
|
+
onSort={(newList) => {
|
|
57
|
+
schema.setItemAll(newList, 'columns', true);
|
|
58
|
+
}}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Form, NumberPicker, Select, Input, Switch } from '@cainiaofe/cn-ui';
|
|
3
|
+
import MddTableForm, { PenetrateTypes } from '$src/components/mdd-table-form';
|
|
4
|
+
import MddForm from '$src/components/mdd-form';
|
|
5
|
+
import { componentOptions } from '../const';
|
|
6
|
+
|
|
7
|
+
import { propFields } from '$src/common/comp-schema/fields/propFields';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const Default_Add_Schema = {
|
|
11
|
+
type: 'input',
|
|
12
|
+
label: '输入框',
|
|
13
|
+
name: '',
|
|
14
|
+
input: propFields.input,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// 缓存保存逻辑下拉数据源
|
|
18
|
+
const Save_Selected_Options = [
|
|
19
|
+
{
|
|
20
|
+
label: '不开启',
|
|
21
|
+
value: '',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: '开启客户端缓存',
|
|
25
|
+
value: 'local',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: '开启服务端缓存',
|
|
29
|
+
value: 'server',
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const FormColOpts = [
|
|
34
|
+
{
|
|
35
|
+
label: '自适应',
|
|
36
|
+
value: 0,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: '1',
|
|
40
|
+
value: 1,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: '2',
|
|
44
|
+
value: 2,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: '3',
|
|
48
|
+
value: 3,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: '4',
|
|
52
|
+
value: 4,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: '5',
|
|
56
|
+
value: 5,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: '6',
|
|
60
|
+
value: 6,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: '7',
|
|
64
|
+
value: 7,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: '8',
|
|
68
|
+
value: 8,
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
export default function FilterPanel({ schema, swaggerFields = [] }) {
|
|
73
|
+
const mddFormRef = React.useRef();
|
|
74
|
+
const [_, forceUpdate] = React.useState({});
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
schema.on('$updated', (changeData, ignoreUpdate) => {
|
|
77
|
+
!ignoreUpdate && forceUpdate({});
|
|
78
|
+
});
|
|
79
|
+
}, []);
|
|
80
|
+
|
|
81
|
+
const fields = schema.get('fields');
|
|
82
|
+
|
|
83
|
+
const refreshMddTableForm = () => {
|
|
84
|
+
mddFormRef.current?.updateData(schema.get('fields'));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const onAddHandle = () => {
|
|
88
|
+
schema.add(Default_Add_Schema, 'fields', true);
|
|
89
|
+
refreshMddTableForm();
|
|
90
|
+
};
|
|
91
|
+
const onRemoveHandle = (index) => {
|
|
92
|
+
schema.remove(index, 'fields', true);
|
|
93
|
+
refreshMddTableForm();
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const onChangeHandle = ({ index, record }) => {
|
|
97
|
+
// 移除多余propsField
|
|
98
|
+
for (const k in propFields) {
|
|
99
|
+
if (record.type !== k) {
|
|
100
|
+
!['name'].includes(k) && delete record[k];
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
schema.update(index, record, 'fields', true);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<div>
|
|
109
|
+
{/* MddTableForm 组件已经内置了状态,在需要update的时候再刷新,不要每次schema变化就刷新 */}
|
|
110
|
+
<MddTableForm
|
|
111
|
+
ref={mddFormRef}
|
|
112
|
+
data={fields}
|
|
113
|
+
penetrateType={PenetrateTypes.FILTER}
|
|
114
|
+
componentOptions={componentOptions}
|
|
115
|
+
title="配置查询条件"
|
|
116
|
+
onAdd={onAddHandle}
|
|
117
|
+
onRemove={onRemoveHandle}
|
|
118
|
+
onChange={onChangeHandle}
|
|
119
|
+
swaggerFieldDataSource={swaggerFields}
|
|
120
|
+
onSort={(newList) => {
|
|
121
|
+
schema.setFieldsAll(newList, true);
|
|
122
|
+
}}
|
|
123
|
+
/>
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 兼容老的格式,老格式是boolean 类型现在改成string类型
|
|
130
|
+
* https://alidocs.dingtalk.com/i/nodes/Obva6QBXJwxNZoMOC34Bmylx8n4qY5Pr
|
|
131
|
+
*/
|
|
132
|
+
function adaptorSaveSelected(enableSaveSelected) {
|
|
133
|
+
if (typeof enableSaveSelected === 'boolean') {
|
|
134
|
+
return enableSaveSelected === true ? Save_Selected_Options[1].value : Save_Selected_Options[0].value;
|
|
135
|
+
}
|
|
136
|
+
return enableSaveSelected;
|
|
137
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Form, NumberPicker, Select, Input, Switch } from '@cainiaofe/cn-ui';
|
|
3
|
+
import MddTableForm, { PenetrateTypes } from '$src/components/mdd-table-form';
|
|
4
|
+
import MddForm from '$src/components/mdd-form';
|
|
5
|
+
import { FormComponentOptions } from '../const';
|
|
6
|
+
|
|
7
|
+
import { propFields } from '$src/common/comp-schema/fields/propFields';
|
|
8
|
+
|
|
9
|
+
const Default_Add_Schema = {
|
|
10
|
+
type: 'input',
|
|
11
|
+
label: '输入框',
|
|
12
|
+
name: '',
|
|
13
|
+
input: propFields.input,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// 缓存保存逻辑下拉数据源
|
|
17
|
+
const Save_Selected_Options = [
|
|
18
|
+
{
|
|
19
|
+
label: '不开启',
|
|
20
|
+
value: '',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: '开启客户端缓存',
|
|
24
|
+
value: 'local',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: '开启服务端缓存',
|
|
28
|
+
value: 'server',
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const FormColOpts = [
|
|
33
|
+
{
|
|
34
|
+
label: '自适应',
|
|
35
|
+
value: 0,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: '1',
|
|
39
|
+
value: 1,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: '2',
|
|
43
|
+
value: 2,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: '3',
|
|
47
|
+
value: 3,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: '4',
|
|
51
|
+
value: 4,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: '5',
|
|
55
|
+
value: 5,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
label: '6',
|
|
59
|
+
value: 6,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
label: '7',
|
|
63
|
+
value: 7,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: '8',
|
|
67
|
+
value: 8,
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
export default function FilterPanel({ schema, swaggerFields = [] }) {
|
|
72
|
+
const mddFormRef = React.useRef();
|
|
73
|
+
const [_, forceUpdate] = React.useState({});
|
|
74
|
+
React.useEffect(() => {
|
|
75
|
+
schema.on('$updated', (changeData, ignoreUpdate) => {
|
|
76
|
+
!ignoreUpdate && forceUpdate({});
|
|
77
|
+
});
|
|
78
|
+
}, []);
|
|
79
|
+
|
|
80
|
+
const fields = schema.get('fields');
|
|
81
|
+
|
|
82
|
+
const refreshMddTableForm = () => {
|
|
83
|
+
mddFormRef.current?.updateData(schema.get('fields'));
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const onAddHandle = () => {
|
|
87
|
+
schema.add(Default_Add_Schema, 'fields', true);
|
|
88
|
+
refreshMddTableForm();
|
|
89
|
+
};
|
|
90
|
+
const onRemoveHandle = (index) => {
|
|
91
|
+
schema.remove(index, 'fields', true);
|
|
92
|
+
refreshMddTableForm();
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const onChangeHandle = ({ index, record }) => {
|
|
96
|
+
// 移除多余propsField
|
|
97
|
+
for (const k in propFields) {
|
|
98
|
+
if (record.type !== k) {
|
|
99
|
+
!['name'].includes(k) && delete record[k];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
schema.update(index, record, 'fields', true);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<div>
|
|
108
|
+
{/* MddTableForm 组件已经内置了状态,在需要update的时候再刷新,不要每次schema变化就刷新 */}
|
|
109
|
+
<MddTableForm
|
|
110
|
+
ref={mddFormRef}
|
|
111
|
+
data={fields}
|
|
112
|
+
penetrateType={PenetrateTypes.FORM}
|
|
113
|
+
componentOptions={FormComponentOptions}
|
|
114
|
+
title="配置表单项"
|
|
115
|
+
onAdd={onAddHandle}
|
|
116
|
+
onRemove={onRemoveHandle}
|
|
117
|
+
onChange={onChangeHandle}
|
|
118
|
+
swaggerFieldDataSource={swaggerFields}
|
|
119
|
+
onSort={(newList) => {
|
|
120
|
+
schema.setFieldsAll(newList, true);
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* 兼容老的格式,老格式是boolean 类型现在改成string类型
|
|
129
|
+
* https://alidocs.dingtalk.com/i/nodes/Obva6QBXJwxNZoMOC34Bmylx8n4qY5Pr
|
|
130
|
+
*/
|
|
131
|
+
function adaptorSaveSelected(enableSaveSelected) {
|
|
132
|
+
if (typeof enableSaveSelected === 'boolean') {
|
|
133
|
+
return enableSaveSelected === true ? Save_Selected_Options[1].value : Save_Selected_Options[0].value;
|
|
134
|
+
}
|
|
135
|
+
return enableSaveSelected;
|
|
136
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { Input, Switch, Icon, NumberPicker } from '@cainiaofe/cn-ui';
|
|
3
|
-
import MddTableForm from '
|
|
4
|
-
import MddForm from '
|
|
5
|
-
import AjaxSchemaForm from '
|
|
3
|
+
import MddTableForm from '$src/components/mdd-table-form';
|
|
4
|
+
import MddForm from '$src/components/mdd-form';
|
|
5
|
+
import AjaxSchemaForm from '$src/components/ajax-schema-form';
|
|
6
6
|
import { columnsTypeOptionsWithCnTable } from '../const';
|
|
7
7
|
|
|
8
|
-
export default function TablePanel({ schema
|
|
8
|
+
export default function TablePanel({ schema }) {
|
|
9
9
|
const columnMddFormRef = React.useRef();
|
|
10
10
|
|
|
11
11
|
const [_, forceUpdate] = useState({});
|
package/src/template/const.js
CHANGED
|
@@ -78,6 +78,12 @@ export const componentOptions = [
|
|
|
78
78
|
},
|
|
79
79
|
];
|
|
80
80
|
|
|
81
|
+
export const FormComponentOptions = [...componentOptions];
|
|
82
|
+
FormComponentOptions.splice(3, 0, { value: 'input-password', label: '密码输入框' });
|
|
83
|
+
FormComponentOptions.splice(3, 0, { value: 'message', label: '信息提示' });
|
|
84
|
+
FormComponentOptions.splice(3, 0, { value: 'global-phone-picker', label: '国际电话输入框' });
|
|
85
|
+
// FormComponentOptions.splice(8, 1); // 表单去除级联选择器
|
|
86
|
+
|
|
81
87
|
// 列类型数据
|
|
82
88
|
export const columnsTypeOptions = [
|
|
83
89
|
{
|
|
@@ -120,10 +126,6 @@ export const columnsTypeOptions = [
|
|
|
120
126
|
value: 'images',
|
|
121
127
|
label: '附件/图片',
|
|
122
128
|
},
|
|
123
|
-
{
|
|
124
|
-
value: 'blocks-table',
|
|
125
|
-
label: '列表区块',
|
|
126
|
-
},
|
|
127
129
|
{
|
|
128
130
|
value: 'custom',
|
|
129
131
|
label: '自定义',
|
|
@@ -189,6 +191,10 @@ export const columnsTypeOptionsWithCnTable = [
|
|
|
189
191
|
// value: 'cn-file',
|
|
190
192
|
// label: '附件',
|
|
191
193
|
// },
|
|
194
|
+
{
|
|
195
|
+
value: 'blocks-table',
|
|
196
|
+
label: '列表区块',
|
|
197
|
+
},
|
|
192
198
|
];
|
|
193
199
|
|
|
194
200
|
// edit table 只有文本
|
|
@@ -229,7 +235,18 @@ export const columnsTypeOptionsWithEditCnTable = [
|
|
|
229
235
|
value: 'edit-cascader-select',
|
|
230
236
|
label: '级联选择器',
|
|
231
237
|
},
|
|
232
|
-
|
|
238
|
+
{
|
|
239
|
+
value: 'upload',
|
|
240
|
+
label: 'OSS上传',
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
value: 'blocks-table',
|
|
244
|
+
label: '列表区块',
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
value: 'blocks-edit-table',
|
|
248
|
+
label: '可编辑表格区块',
|
|
249
|
+
},
|
|
233
250
|
{
|
|
234
251
|
value: 'edit-custom',
|
|
235
252
|
label: '自定义',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Input, Select, Balloon, Icon } from '@cainiaofe/cn-ui';
|
|
3
|
-
import MddTableArray from '
|
|
3
|
+
import MddTableArray from '$src/components/mdd-table-array';
|
|
4
4
|
import DetailCard from './components/DetailCard';
|
|
5
5
|
import DetailImageView from './components/DetailImageView';
|
|
6
6
|
import DetailTable from './components/DetailTable';
|
|
@@ -70,6 +70,11 @@ const customTitleRender = (props) => {
|
|
|
70
70
|
// 类型是步骤条
|
|
71
71
|
data.initStepSource();
|
|
72
72
|
}
|
|
73
|
+
if (key === 'type' && val === 'detail-columns') {
|
|
74
|
+
data.set('hideCard', true);
|
|
75
|
+
} else {
|
|
76
|
+
data.set('hideCard', false);
|
|
77
|
+
}
|
|
73
78
|
onChange(data);
|
|
74
79
|
};
|
|
75
80
|
return (
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Form, CnNumberPicker, Dialog, CnSwitch, CnRadioGroup, CnRadio } from '@cainiaofe/cn-ui';
|
|
3
|
-
import MddTableForm from '
|
|
3
|
+
import MddTableForm from '$src/components/mdd-table-form';
|
|
4
4
|
import MultiAjaxSchemaForm from './MultiAjaxSchemaForm';
|
|
5
5
|
import ActionPanel from './Actions';
|
|
6
|
-
import useSwagger from '
|
|
7
|
-
import buildSwaggerApiJson from '
|
|
8
|
-
import buildFieldsToCompJson from '
|
|
6
|
+
import useSwagger from '$src/hooks/useSwagger';
|
|
7
|
+
import buildSwaggerApiJson from '$src/utils/buildSwaggerApiJson';
|
|
8
|
+
import buildFieldsToCompJson from '$src/utils/buildFieldsToCompJson';
|
|
9
9
|
import { columnsTypeOptions } from '../../const';
|
|
10
10
|
|
|
11
|
+
const _columnsTypeOptions = [...columnsTypeOptions];
|
|
12
|
+
_columnsTypeOptions.splice(5, 0, { value: 'message', label: '信息提示' });
|
|
13
|
+
|
|
11
14
|
// 额外formily schema字段
|
|
12
15
|
const extraFieldSchema = {
|
|
13
16
|
renderToTitle: {
|
|
@@ -141,7 +144,7 @@ export default function DetailCard(props) {
|
|
|
141
144
|
title=""
|
|
142
145
|
extraFieldSchema={extraFieldSchema}
|
|
143
146
|
swaggerFieldDataSource={responseFields}
|
|
144
|
-
componentOptions={
|
|
147
|
+
componentOptions={_columnsTypeOptions}
|
|
145
148
|
onAdd={() => onAddHandle()}
|
|
146
149
|
onRemove={(index) => onRemoveHandle(index)}
|
|
147
150
|
onChange={({ index, record }) => onChangeHandle({ index, record })}
|