@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
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Select,
|
|
4
|
+
Form,
|
|
5
|
+
CnNumberPicker,
|
|
6
|
+
CnTooltip,
|
|
7
|
+
Dialog,
|
|
8
|
+
CnSwitch,
|
|
9
|
+
CnRadioGroup,
|
|
10
|
+
CnRadio,
|
|
11
|
+
Collapse,
|
|
12
|
+
Icon,
|
|
13
|
+
Balloon,
|
|
14
|
+
} from '@cainiaofe/cn-ui';
|
|
3
15
|
|
|
4
|
-
import MddTableForm from '
|
|
16
|
+
import MddTableForm from '$src/components/mdd-table-form';
|
|
5
17
|
import MultiAjaxSchemaForm from './MultiAjaxSchemaForm';
|
|
6
18
|
import ActionPanel from './Actions';
|
|
7
|
-
import useSwagger from '
|
|
8
|
-
import buildSwaggerApiJson from '
|
|
9
|
-
import buildFieldsToCompJson from '
|
|
10
|
-
import MddTableSimpleArray from '
|
|
11
|
-
import FormilySelect from '
|
|
12
|
-
import TableFormProxy from '
|
|
13
|
-
import { columnsTypeOptions } from '../../const';
|
|
19
|
+
import useSwagger from '$src/hooks/useSwagger';
|
|
20
|
+
import buildSwaggerApiJson from '$src/utils/buildSwaggerApiJson';
|
|
21
|
+
import buildFieldsToCompJson from '$src/utils/buildFieldsToCompJson';
|
|
22
|
+
import MddTableSimpleArray from '$src/components/mdd-table-simple-array';
|
|
23
|
+
import FormilySelect from '$src/components/formily-select';
|
|
24
|
+
import TableFormProxy from '$src/components/ajax-schema-form/formily-table-form-proxy';
|
|
14
25
|
import styles from './DetailColumns.module.scss';
|
|
15
26
|
|
|
16
27
|
const { Panel } = Collapse;
|
|
@@ -24,14 +35,17 @@ export default function DetailColumns(props) {
|
|
|
24
35
|
data.set('hideCardTitle', true);
|
|
25
36
|
forceUpdate();
|
|
26
37
|
|
|
27
|
-
return () => {
|
|
28
|
-
|
|
38
|
+
return () => {
|
|
39
|
+
data.set('hideCardTitle', false);
|
|
40
|
+
forceUpdate();
|
|
41
|
+
};
|
|
42
|
+
}, []);
|
|
29
43
|
|
|
30
44
|
const onAddHandle = () => {
|
|
31
45
|
data.add(
|
|
32
46
|
{
|
|
33
47
|
moduleName: '',
|
|
34
|
-
|
|
48
|
+
hideSelfCard: true,
|
|
35
49
|
params: [],
|
|
36
50
|
canUpdateOtherColumns: true,
|
|
37
51
|
canBeUpdated: true,
|
|
@@ -66,9 +80,18 @@ export default function DetailColumns(props) {
|
|
|
66
80
|
<CnRadio value="column">上下布局</CnRadio>
|
|
67
81
|
</CnRadioGroup>
|
|
68
82
|
</Form.Item>
|
|
69
|
-
<Form.Item labelAlign="left" label="
|
|
70
|
-
<
|
|
83
|
+
<Form.Item labelAlign="left" label="高度" name="height">
|
|
84
|
+
<CnNumberPicker defaultValue={data.get('height')} min={0} max={100} innerAfter="%" style={{ width: 90 }} />
|
|
85
|
+
<CnTooltip trigger={<Icon type="prompt" style={{ marginLeft: 6 }} />}>0-100 的整数,0 表示自动高度</CnTooltip>
|
|
71
86
|
</Form.Item>
|
|
87
|
+
<Form.Item labelAlign="left" label="隐藏父级卡片" name="hideCard">
|
|
88
|
+
<CnSwitch checked={data.get('hideCard')} />
|
|
89
|
+
</Form.Item>
|
|
90
|
+
{!data.get('hideCard') && (
|
|
91
|
+
<Form.Item labelAlign="left" label="隐藏父级卡片头部" name="hideCardTitle">
|
|
92
|
+
<CnSwitch checked={data.get('hideCardTitle')} />
|
|
93
|
+
</Form.Item>
|
|
94
|
+
)}
|
|
72
95
|
<Form.Item labelAlign="top" label="">
|
|
73
96
|
<MddTableSimpleArray
|
|
74
97
|
data={data.get('columnsBoxes')}
|
|
@@ -83,7 +106,8 @@ export default function DetailColumns(props) {
|
|
|
83
106
|
}}
|
|
84
107
|
onAdd={onAddHandle}
|
|
85
108
|
onRemove={(index) => onRemoveHandle(index)}
|
|
86
|
-
|
|
109
|
+
otherInfo={{ columnsDirection: data.get('columnsDirection') }}
|
|
110
|
+
// onRemove={onRemoveHandle}
|
|
87
111
|
/>
|
|
88
112
|
</Form.Item>
|
|
89
113
|
{data.get('hideCardTitle') ? null : <ActionPanel schema={data} />}
|
|
@@ -91,100 +115,143 @@ export default function DetailColumns(props) {
|
|
|
91
115
|
);
|
|
92
116
|
}
|
|
93
117
|
|
|
94
|
-
|
|
95
118
|
function customTitleRender(props) {
|
|
96
|
-
const { data, index, onChange, moduleDataSource } = props;
|
|
119
|
+
const { data, index, onChange, moduleDataSource, otherInfo = {} } = props;
|
|
97
120
|
|
|
98
|
-
return
|
|
99
|
-
<div className={styles.
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
121
|
+
return (
|
|
122
|
+
<div className={styles.title}>
|
|
123
|
+
<div className={styles.titleItem}>
|
|
124
|
+
<label className={styles.titleItemLabel}>模块地址</label>
|
|
125
|
+
<Select.AutoComplete
|
|
126
|
+
placeholder="请选择或者输入模块地址"
|
|
127
|
+
hasClear
|
|
128
|
+
size="small"
|
|
129
|
+
style={{
|
|
130
|
+
minWidth: 280,
|
|
131
|
+
}}
|
|
132
|
+
dataSource={moduleDataSource?.l4ModuleOptions || moduleDataSource || []}
|
|
133
|
+
value={data?.moduleName}
|
|
134
|
+
onChange={(v) => onChange({ ...data, moduleName: v })}
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
137
|
+
{otherInfo?.columnsDirection === 'row' && (
|
|
138
|
+
<div className={styles.titleItem}>
|
|
139
|
+
<label className={styles.titleItemLabel}>
|
|
140
|
+
<Balloon
|
|
141
|
+
trigger={
|
|
142
|
+
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
143
|
+
占列数 <Icon type="help" size="small" />
|
|
144
|
+
</div>
|
|
145
|
+
}
|
|
146
|
+
align="t"
|
|
147
|
+
>
|
|
148
|
+
<b>左右布局时,占列数之和应为24</b>
|
|
149
|
+
</Balloon>
|
|
150
|
+
</label>
|
|
151
|
+
<CnNumberPicker
|
|
152
|
+
size="small"
|
|
153
|
+
min={0}
|
|
154
|
+
max={24}
|
|
155
|
+
value={data?.cols}
|
|
156
|
+
onChange={(v) => onChange({ ...data, cols: v })}
|
|
157
|
+
placeholder="占列数 之和应为24"
|
|
158
|
+
/>
|
|
159
|
+
</div>
|
|
160
|
+
)}
|
|
128
161
|
</div>
|
|
129
|
-
|
|
162
|
+
);
|
|
130
163
|
}
|
|
131
164
|
|
|
132
165
|
const layoutConfig = {
|
|
133
166
|
wrapperCol: { span: 16 },
|
|
134
|
-
labelCol: { span: 8 }
|
|
135
|
-
}
|
|
167
|
+
labelCol: { span: 8 },
|
|
168
|
+
};
|
|
136
169
|
|
|
137
170
|
function contentRender(props) {
|
|
138
|
-
return <ContentRender {...props}
|
|
171
|
+
return <ContentRender {...props} />;
|
|
139
172
|
}
|
|
140
173
|
|
|
141
174
|
const ContentRender = (props) => {
|
|
142
|
-
const { data, index, onChange } = props;
|
|
175
|
+
const { data, index, onChange, otherInfo = {} } = props;
|
|
143
176
|
// const [_, forceUpdate] = React.useState({});
|
|
144
177
|
|
|
145
|
-
return
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
href="https://yuque.antfin.com/docs/share/b146be2b-dec0-4f0d-80e4-c11a34a701bc"
|
|
157
|
-
title="在vscode插件中按住ctrl再点击查看"
|
|
158
|
-
className="help-link"
|
|
159
|
-
>
|
|
160
|
-
帮助
|
|
161
|
-
</a>
|
|
162
|
-
</div>
|
|
163
|
-
}
|
|
164
|
-
>
|
|
165
|
-
<TableFormProxy
|
|
166
|
-
keyTitle={'key(参数名)'}
|
|
167
|
-
valueTitle={'value(参数值) - .$ALL 可获取整个动态对象'}
|
|
168
|
-
value={data?.params}
|
|
169
|
-
onChange={(v) => onChange({ index, record: { ...data, params: v } })}
|
|
170
|
-
/>
|
|
171
|
-
</Form.Item>
|
|
172
|
-
<Collapse accordion>
|
|
173
|
-
<Panel
|
|
174
|
-
title={
|
|
175
|
-
<Balloon trigger={<div style={{ width: 'fit-content', display: 'flex', alignItems: 'center' }}>其他配置:<Icon type="help" size="small" /></div>} align="t">
|
|
176
|
-
配置以下属性后,方可在每个分栏中 使用【触发其他分栏刷新】事件,引擎会监听 并自动更新其他分栏(触发一个 detail:updateColumns 事件。若分栏为 FTP 类型 则支持自动刷新,其他页面类型暂不支持)。
|
|
177
|
-
<div><b>建议在每个分栏模块中写胶水代码,手动控制其他分栏刷新。</b></div>
|
|
178
|
-
</Balloon>
|
|
179
|
-
}
|
|
180
|
-
>
|
|
181
|
-
<Form.Item {...layoutConfig} label="可以触发其他分栏刷新" name="">
|
|
182
|
-
<CnSwitch
|
|
183
|
-
defaultChecked={data?.canUpdateOtherColumns}
|
|
184
|
-
onChange={(v) => onChange({ index, record: { ...data, canUpdateOtherColumns: v } })}
|
|
178
|
+
return (
|
|
179
|
+
<>
|
|
180
|
+
{otherInfo?.columnsDirection === 'column' && (
|
|
181
|
+
<Form.Item wrapperCol={{ span: 20 }} labelCol={{ span: 4 }} label="高度" name="">
|
|
182
|
+
<CnNumberPicker
|
|
183
|
+
min={0}
|
|
184
|
+
max={100}
|
|
185
|
+
innerAfter="%"
|
|
186
|
+
style={{ width: 90 }}
|
|
187
|
+
defaultValue={data?.height}
|
|
188
|
+
onChange={(v) => onChange({ index, record: { ...data, height: v } })}
|
|
185
189
|
/>
|
|
190
|
+
<CnTooltip trigger={<Icon type="prompt" style={{ marginLeft: 6 }} />}>
|
|
191
|
+
仅在上下布局中生效:0-100 的整数,0 表示自动高度
|
|
192
|
+
</CnTooltip>
|
|
186
193
|
</Form.Item>
|
|
187
|
-
|
|
194
|
+
)}
|
|
195
|
+
<Form.Item
|
|
196
|
+
name=""
|
|
197
|
+
wrapperCol={{ span: 20 }}
|
|
198
|
+
labelCol={{ span: 4 }}
|
|
199
|
+
style={{ position: 'relative' }}
|
|
200
|
+
label={
|
|
201
|
+
<div>
|
|
202
|
+
参数
|
|
203
|
+
<a
|
|
204
|
+
rel="noreferrer"
|
|
205
|
+
target="_blank"
|
|
206
|
+
href="https://yuque.antfin.com/docs/share/b146be2b-dec0-4f0d-80e4-c11a34a701bc"
|
|
207
|
+
title="在vscode插件中按住ctrl再点击查看"
|
|
208
|
+
className="help-link"
|
|
209
|
+
>
|
|
210
|
+
帮助
|
|
211
|
+
</a>
|
|
212
|
+
</div>
|
|
213
|
+
}
|
|
214
|
+
>
|
|
215
|
+
<TableFormProxy
|
|
216
|
+
keyTitle={'key(参数名)'}
|
|
217
|
+
valueTitle={'value(参数值) - .$ALL 可获取整个动态对象'}
|
|
218
|
+
value={data?.params}
|
|
219
|
+
onChange={(v) => onChange({ index, record: { ...data, params: v } })}
|
|
220
|
+
/>
|
|
221
|
+
</Form.Item>
|
|
222
|
+
<Form.Item wrapperCol={{ span: 20 }} labelCol={{ span: 4 }} label="隐藏 当前栏 卡片" name="">
|
|
223
|
+
<CnSwitch
|
|
224
|
+
defaultChecked={data?.hideSelfCard}
|
|
225
|
+
onChange={(v) => onChange({ index, record: { ...data, hideSelfCard: v } })}
|
|
226
|
+
/>
|
|
227
|
+
</Form.Item>
|
|
228
|
+
<Collapse accordion>
|
|
229
|
+
<Panel
|
|
230
|
+
title={
|
|
231
|
+
<Balloon
|
|
232
|
+
trigger={
|
|
233
|
+
<div style={{ width: 'fit-content', display: 'flex', alignItems: 'center' }}>
|
|
234
|
+
其他配置:
|
|
235
|
+
<Icon type="help" size="small" />
|
|
236
|
+
</div>
|
|
237
|
+
}
|
|
238
|
+
align="t"
|
|
239
|
+
>
|
|
240
|
+
配置以下属性后,方可在每个分栏中 使用【触发其他分栏刷新】事件,引擎会监听 并自动更新其他分栏(触发一个
|
|
241
|
+
detail:updateColumns 事件。若分栏为 FTP 类型 则支持自动刷新,其他页面类型暂不支持)。
|
|
242
|
+
<div>
|
|
243
|
+
<b>建议在每个分栏模块中写胶水代码,手动控制其他分栏刷新。</b>
|
|
244
|
+
</div>
|
|
245
|
+
</Balloon>
|
|
246
|
+
}
|
|
247
|
+
>
|
|
248
|
+
<Form.Item {...layoutConfig} label="可以触发其他分栏刷新" name="">
|
|
249
|
+
<CnSwitch
|
|
250
|
+
defaultChecked={data?.canUpdateOtherColumns}
|
|
251
|
+
onChange={(v) => onChange({ index, record: { ...data, canUpdateOtherColumns: v } })}
|
|
252
|
+
/>
|
|
253
|
+
</Form.Item>
|
|
254
|
+
{/* <Form.Item {...layoutConfig} label={
|
|
188
255
|
<Balloon trigger={<div>可被其他分栏刷新<Icon type="help" size="small" /></div>} align="t">
|
|
189
256
|
<b>以FTP页面格式 被更新,其他页面类型暂不支持</b>
|
|
190
257
|
</Balloon>
|
|
@@ -194,23 +261,36 @@ const ContentRender = (props) => {
|
|
|
194
261
|
onChange={(v) => onChange({ index, record: { ...data, canBeUpdated: v } })}
|
|
195
262
|
/>
|
|
196
263
|
</Form.Item> */}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
264
|
+
<Form.Item {...layoutConfig} label={'可被其他分栏刷新'} name="">
|
|
265
|
+
<CnSwitch
|
|
266
|
+
defaultChecked={data?.canBeUpdated}
|
|
267
|
+
onChange={(v) => onChange({ index, record: { ...data, canBeUpdated: v } })}
|
|
268
|
+
/>
|
|
269
|
+
</Form.Item>
|
|
270
|
+
<Form.Item
|
|
271
|
+
{...layoutConfig}
|
|
272
|
+
label={
|
|
273
|
+
<Balloon
|
|
274
|
+
trigger={
|
|
275
|
+
<div>
|
|
276
|
+
当前分栏为FTP时自动刷新
|
|
277
|
+
<Icon type="help" size="small" />
|
|
278
|
+
</div>
|
|
279
|
+
}
|
|
280
|
+
align="t"
|
|
281
|
+
>
|
|
282
|
+
<b>以FTP页面格式 被更新,其他页面类型暂不支持</b>
|
|
283
|
+
</Balloon>
|
|
284
|
+
}
|
|
285
|
+
name=""
|
|
286
|
+
>
|
|
287
|
+
<CnSwitch
|
|
288
|
+
defaultChecked={data?.autoUpdateWhenIsFTP}
|
|
289
|
+
onChange={(v) => onChange({ index, record: { ...data, autoUpdateWhenIsFTP: v } })}
|
|
290
|
+
/>
|
|
291
|
+
</Form.Item>
|
|
292
|
+
</Panel>
|
|
293
|
+
</Collapse>
|
|
294
|
+
</>
|
|
295
|
+
);
|
|
296
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Form, Input, Switch, Select } from '@cainiaofe/cn-ui';
|
|
3
3
|
import ActionPanel from './Actions';
|
|
4
|
-
import TableFormProxy from '
|
|
5
|
-
import useModule from '
|
|
4
|
+
import TableFormProxy from '$src/components/ajax-schema-form/table-form-proxy';
|
|
5
|
+
import useModule from '$src/hooks/useModule';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 自定义详情内容, 引入源码、其他页面等
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Form, Dialog, Switch, CnMessage, Input, Icon } from '@cainiaofe/cn-ui';
|
|
3
|
-
import MddTableForm from '
|
|
2
|
+
import { Form, Dialog, Switch, CnMessage, Input, Icon, NumberPicker } from '@cainiaofe/cn-ui';
|
|
3
|
+
import MddTableForm from '$src/components/mdd-table-form';
|
|
4
4
|
import MultiAjaxSchemaForm from './MultiAjaxSchemaForm';
|
|
5
|
-
import useSwagger from '
|
|
6
|
-
import buildSwaggerApiJson from '
|
|
7
|
-
import buildFieldsToCompJson from '
|
|
8
|
-
import MddForm from '
|
|
5
|
+
import useSwagger from '$src/hooks/useSwagger';
|
|
6
|
+
import buildSwaggerApiJson from '$src/utils/buildSwaggerApiJson';
|
|
7
|
+
import buildFieldsToCompJson from '$src/utils/buildFieldsToCompJson';
|
|
8
|
+
import MddForm from '$src/components/mdd-form';
|
|
9
9
|
import ActionPanel from './Actions';
|
|
10
10
|
import { columnsTypeOptionsWithCnTable } from '../../const';
|
|
11
11
|
|
|
@@ -141,13 +141,18 @@ export default function DetailTable(props) {
|
|
|
141
141
|
onChange={({ index, record }) => onPaginationChangeHandle({ index, record })}
|
|
142
142
|
/>
|
|
143
143
|
|
|
144
|
-
<Form.Item labelAlign="left" label="
|
|
144
|
+
<Form.Item labelAlign="left" label="是否隐藏通用顶部操作区:" name="hideCommonToolbar">
|
|
145
145
|
<Switch autoWidth size="small" defaultChecked={data.get('hideCommonToolbar')} />
|
|
146
146
|
</Form.Item>
|
|
147
147
|
|
|
148
148
|
<div style={{ marginLeft: '10px', marginBottom: 8 }}>
|
|
149
149
|
<label>最大高度:</label>
|
|
150
|
-
<
|
|
150
|
+
<NumberPicker
|
|
151
|
+
value={data.get('maxHeight')}
|
|
152
|
+
size="small"
|
|
153
|
+
onChange={(v) => tablePropsChange('maxHeight', v)}
|
|
154
|
+
min={0}
|
|
155
|
+
/>
|
|
151
156
|
<span className="mdd-tip">
|
|
152
157
|
<Icon type="prompt" /> 该属性可以实现一屏展示,支持calc函数,eg: calc(100vh - 100px)
|
|
153
158
|
</span>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import MddTableForm from '
|
|
2
|
+
import MddTableForm from '$src/components/mdd-table-form';
|
|
3
3
|
|
|
4
4
|
export default function HeaderToolbarPanel({ schema }) {
|
|
5
5
|
const mddFormRef = React.useRef();
|
|
@@ -19,7 +19,8 @@ export default function HeaderToolbarPanel({ schema }) {
|
|
|
19
19
|
const onAddHandle = () => {
|
|
20
20
|
schema.add(
|
|
21
21
|
{
|
|
22
|
-
type: 'batch-add',
|
|
22
|
+
// type: 'batch-add',
|
|
23
|
+
type: 'editButton',
|
|
23
24
|
label: '批量新增',
|
|
24
25
|
action: {
|
|
25
26
|
type: 'drawer', // 目前必须是 drawer
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { Input, Switch, Icon } from '@cainiaofe/cn-ui';
|
|
3
|
-
import MddTableForm from '
|
|
2
|
+
import { Input, Switch, Icon, NumberPicker } from '@cainiaofe/cn-ui';
|
|
3
|
+
import MddTableForm from '$src/components/mdd-table-form';
|
|
4
4
|
import { columnsTypeOptionsWithEditCnTable } from '../const';
|
|
5
5
|
|
|
6
6
|
export default function TablePanel({ schema, swaggerFields = [] }) {
|
|
@@ -15,6 +15,8 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
|
|
|
15
15
|
const primaryKey = schema.get('primaryKey');
|
|
16
16
|
// 批量操作
|
|
17
17
|
const columns = schema.get('columns');
|
|
18
|
+
// 显示序号
|
|
19
|
+
const showIndex = schema.get('showIndex');
|
|
18
20
|
|
|
19
21
|
const onAddHandle = (key) => {
|
|
20
22
|
switch (key) {
|
|
@@ -47,6 +49,11 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
|
|
|
47
49
|
schema.update('', value, 'primaryKey');
|
|
48
50
|
};
|
|
49
51
|
|
|
52
|
+
// 基础属性变更
|
|
53
|
+
const onBaseInfoChange = (key, value) => {
|
|
54
|
+
schema.update('', value, key);
|
|
55
|
+
};
|
|
56
|
+
|
|
50
57
|
return (
|
|
51
58
|
<div>
|
|
52
59
|
<div style={{ marginLeft: '10px', marginBottom: 8 }}>
|
|
@@ -69,11 +76,57 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
|
|
|
69
76
|
|
|
70
77
|
<div style={{ marginLeft: '10px', marginBottom: 8 }}>
|
|
71
78
|
<label>最大高度:</label>
|
|
72
|
-
<
|
|
79
|
+
<NumberPicker
|
|
80
|
+
value={schema.get('maxHeight')}
|
|
81
|
+
size="small"
|
|
82
|
+
onChange={(v) => schema.update('', v, 'maxHeight')}
|
|
83
|
+
min={0}
|
|
84
|
+
/>
|
|
73
85
|
<span className="mdd-tip">
|
|
74
86
|
<Icon type="prompt" /> 该属性可以实现一屏展示,支持calc函数,eg: calc(100vh - 100px)
|
|
75
87
|
</span>
|
|
76
88
|
</div>
|
|
89
|
+
|
|
90
|
+
<div style={{ marginLeft: '10px', marginBottom: 8 }}>
|
|
91
|
+
<label>是否显示序号:</label>
|
|
92
|
+
<Switch autoWidth checked={showIndex} size="small" onChange={(v) => onBaseInfoChange('showIndex', v)} />
|
|
93
|
+
<span className="mdd-tip">
|
|
94
|
+
<Icon type="prompt" /> 纯前端自动序号{' '}
|
|
95
|
+
</span>
|
|
96
|
+
</div>
|
|
97
|
+
<div style={{ marginLeft: '10px', marginBottom: 8 }}>
|
|
98
|
+
<label>是否开启虚拟滚动:</label>
|
|
99
|
+
<Switch
|
|
100
|
+
autoWidth
|
|
101
|
+
checked={schema.get('useVirtual')}
|
|
102
|
+
size="small"
|
|
103
|
+
onChange={(v) => onBaseInfoChange('useVirtual', v)}
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
<div style={{ marginLeft: '10px', marginBottom: 8 }}>
|
|
107
|
+
<label>是否开启自动列宽:</label>
|
|
108
|
+
<Switch
|
|
109
|
+
autoWidth
|
|
110
|
+
checked={schema.get('columnsAutoWidth')}
|
|
111
|
+
size="small"
|
|
112
|
+
onChange={(v) => onBaseInfoChange('columnsAutoWidth', v)}
|
|
113
|
+
/>
|
|
114
|
+
<span className="mdd-tip">
|
|
115
|
+
<Icon type="prompt" /> 如果有性能问题可以关闭该属性,同时手动设置列宽
|
|
116
|
+
</span>
|
|
117
|
+
</div>
|
|
118
|
+
<div style={{ marginLeft: '10px', marginBottom: 8 }}>
|
|
119
|
+
<label>是否隐藏通用顶部操作区:</label>
|
|
120
|
+
<Switch
|
|
121
|
+
autoWidth
|
|
122
|
+
checked={schema.get('hideCommonToolbar')}
|
|
123
|
+
size="small"
|
|
124
|
+
onChange={(v) => onBaseInfoChange('hideCommonToolbar', v)}
|
|
125
|
+
/>
|
|
126
|
+
<span className="mdd-tip">
|
|
127
|
+
<Icon type="prompt" /> 是否隐藏table顶部操作区的通用操作按钮,比如全屏、斑马线、列设置、尺寸等
|
|
128
|
+
</span>
|
|
129
|
+
</div>
|
|
77
130
|
</div>
|
|
78
131
|
);
|
|
79
132
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import MddTableForm, { PenetrateTypes } from '
|
|
3
|
-
import {
|
|
4
|
-
import { propFields } from '
|
|
5
|
-
|
|
6
|
-
const FormComponentOptions = [...componentOptions];
|
|
7
|
-
FormComponentOptions.splice(3, 0, { value: 'input-password', label: '密码输入框' });
|
|
8
|
-
// FormComponentOptions.splice(8, 1); // 表单去除级联选择器
|
|
2
|
+
import MddTableForm, { PenetrateTypes } from '$src/components/mdd-table-form';
|
|
3
|
+
import { FormComponentOptions } from '../const';
|
|
4
|
+
import { propFields } from '$src/common/comp-schema/fields/propFields';
|
|
9
5
|
|
|
10
6
|
export default function FormItemsPanel({ schema, swaggerFields = [] }) {
|
|
11
7
|
const mddFormRef = React.useRef();
|
|
@@ -56,7 +52,7 @@ export default function FormItemsPanel({ schema, swaggerFields = [] }) {
|
|
|
56
52
|
ref={mddFormRef}
|
|
57
53
|
data={fields || []}
|
|
58
54
|
penetrateType={PenetrateTypes.FORM}
|
|
59
|
-
componentOptions={FormComponentOptions}
|
|
55
|
+
componentOptions={[...FormComponentOptions, , { value: 'blocks-form', label: '表单区块' }]}
|
|
60
56
|
swaggerFieldDataSource={swaggerFields}
|
|
61
57
|
title="配置表单项"
|
|
62
58
|
onAdd={onAddHandle}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
// import { Modal, Button } from 'antd';
|
|
3
3
|
|
|
4
|
-
import DataSourceSelect from '
|
|
4
|
+
import DataSourceSelect from '$src/components/data-source-select';
|
|
5
5
|
|
|
6
6
|
// const AsyncDataSourceSetter = observer((props) => {
|
|
7
7
|
// const [visible, setVisible] = useState(false);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
// import { Modal, Button } from 'antd';
|
|
3
3
|
|
|
4
|
-
import ParamsSelect from '
|
|
4
|
+
import ParamsSelect from '$src/components/params-select';
|
|
5
5
|
|
|
6
6
|
// const SubmitActionSetter = observer((props) => {
|
|
7
7
|
// const [visible, setVisible] = useState(false);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Form, NumberPicker, Select, Input, Switch } from '@cainiaofe/cn-ui';
|
|
3
|
-
import MddTableForm, { PenetrateTypes } from '
|
|
4
|
-
import MddForm from '
|
|
3
|
+
import MddTableForm, { PenetrateTypes } from '$src/components/mdd-table-form';
|
|
4
|
+
import MddForm from '$src/components/mdd-form';
|
|
5
5
|
import { componentOptions } from '../const';
|
|
6
6
|
|
|
7
|
-
import { propFields } from '
|
|
7
|
+
import { propFields } from '$src/common/comp-schema/fields/propFields';
|
|
8
8
|
|
|
9
9
|
const labelDataSource = [
|
|
10
10
|
{
|
|
@@ -83,10 +83,14 @@ export default function FilterPanel({ schema, swaggerFields = [] }) {
|
|
|
83
83
|
const mddFormRef = React.useRef();
|
|
84
84
|
const [_, forceUpdate] = React.useState({});
|
|
85
85
|
React.useEffect(() => {
|
|
86
|
-
|
|
86
|
+
const handleUpdated = (changeData, ignoreUpdate) => {
|
|
87
87
|
!ignoreUpdate && forceUpdate({});
|
|
88
|
-
}
|
|
89
|
-
|
|
88
|
+
};
|
|
89
|
+
schema.on('$updated', handleUpdated);
|
|
90
|
+
return () => {
|
|
91
|
+
schema.off('$updated', handleUpdated);
|
|
92
|
+
};
|
|
93
|
+
}, [schema]);
|
|
90
94
|
|
|
91
95
|
const fields = schema.get('fields');
|
|
92
96
|
|
|
@@ -121,7 +125,7 @@ export default function FilterPanel({ schema, swaggerFields = [] }) {
|
|
|
121
125
|
ref={mddFormRef}
|
|
122
126
|
data={fields}
|
|
123
127
|
penetrateType={PenetrateTypes.FILTER}
|
|
124
|
-
componentOptions={componentOptions}
|
|
128
|
+
componentOptions={[...componentOptions, { value: 'blocks-filter', label: '筛选项区块' }]}
|
|
125
129
|
title="配置查询条件"
|
|
126
130
|
onAdd={onAddHandle}
|
|
127
131
|
onRemove={onRemoveHandle}
|
|
@@ -140,6 +144,9 @@ export default function FilterPanel({ schema, swaggerFields = [] }) {
|
|
|
140
144
|
schema.set(item.name, item.value);
|
|
141
145
|
}}
|
|
142
146
|
>
|
|
147
|
+
<Form.Item label="默认展开:" name="defaultExpand" help="仅在 新版布局中生效">
|
|
148
|
+
<Switch defaultChecked={schema.get('defaultExpand')} />
|
|
149
|
+
</Form.Item>
|
|
143
150
|
<Form.Item label="文本位置:" name="labelAlign">
|
|
144
151
|
<Select dataSource={labelDataSource} defaultValue={schema.get('labelAlign')} />
|
|
145
152
|
</Form.Item>
|