amis-core 1.0.0-beta.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/dist/Root.js +94 -0
- package/dist/RootRenderer.js +288 -0
- package/dist/SchemaRenderer.js +323 -0
- package/dist/Scoped.js +252 -0
- package/dist/WithRootStore.js +44 -0
- package/dist/WithStore.js +179 -0
- package/dist/__tests__/compat.test.d.ts +1 -0
- package/dist/__tests__/factory.test.d.ts +1 -0
- package/dist/__tests__/filter.test.d.ts +1 -0
- package/dist/__tests__/helper.d.ts +13 -0
- package/dist/__tests__/tokenize.test.d.ts +1 -0
- package/dist/actions/Action.js +119 -0
- package/dist/actions/AjaxAction.js +96 -0
- package/dist/actions/BreakAction.js +35 -0
- package/dist/actions/BroadcastAction.js +49 -0
- package/dist/actions/CmptAction.js +60 -0
- package/dist/actions/ContinueAction.js +35 -0
- package/dist/actions/CopyAction.js +43 -0
- package/dist/actions/CustomAction.js +49 -0
- package/dist/actions/DialogAction.js +104 -0
- package/dist/actions/DrawerAction.js +66 -0
- package/dist/actions/EmailAction.js +48 -0
- package/dist/actions/LinkAction.js +52 -0
- package/dist/actions/LoopAction.js +107 -0
- package/dist/actions/PageAction.js +80 -0
- package/dist/actions/ParallelAction.js +40 -0
- package/dist/actions/SwitchAction.js +52 -0
- package/dist/actions/ToastAction.js +35 -0
- package/dist/components/LazyComponent.js +99 -0
- package/dist/env.js +20 -0
- package/dist/envOverwrite.js +43 -0
- package/dist/factory.js +308 -0
- package/dist/index.js +218 -0
- package/dist/index2.js +255 -0
- package/dist/locale.js +114 -0
- package/dist/renderers/Form.js +1162 -0
- package/dist/renderers/Item.js +636 -0
- package/dist/renderers/Options.js +881 -0
- package/dist/renderers/Placeholder.js +31 -0
- package/dist/renderers/builtin.js +27 -0
- package/dist/renderers/wrapControl.js +507 -0
- package/dist/src/Root.d.ts +37 -0
- package/dist/src/RootRenderer.d.ts +27 -0
- package/dist/src/SchemaRenderer.d.ts +37 -0
- package/dist/src/Scoped.d.ts +38 -0
- package/dist/src/WithRootStore.d.ts +737 -0
- package/dist/src/WithStore.d.ts +5 -0
- package/dist/src/actions/Action.d.ts +38 -0
- package/dist/src/actions/AjaxAction.d.ts +25 -0
- package/dist/src/actions/BreakAction.d.ts +15 -0
- package/dist/src/actions/BroadcastAction.d.ts +16 -0
- package/dist/src/actions/CmptAction.d.ts +20 -0
- package/dist/src/actions/ContinueAction.d.ts +15 -0
- package/dist/src/actions/CopyAction.d.ts +20 -0
- package/dist/src/actions/CustomAction.d.ts +17 -0
- package/dist/src/actions/Decorators.d.ts +25 -0
- package/dist/src/actions/DialogAction.d.ts +57 -0
- package/dist/src/actions/DrawerAction.d.ts +30 -0
- package/dist/src/actions/EmailAction.d.ts +23 -0
- package/dist/src/actions/LinkAction.d.ts +24 -0
- package/dist/src/actions/LoopAction.d.ts +19 -0
- package/dist/src/actions/PageAction.d.ts +39 -0
- package/dist/src/actions/ParallelAction.d.ts +8 -0
- package/dist/src/actions/SwitchAction.d.ts +11 -0
- package/dist/src/actions/ToastAction.d.ts +19 -0
- package/dist/src/actions/index.d.ts +21 -0
- package/dist/src/components/LazyComponent.d.ts +32 -0
- package/dist/src/env.d.ts +172 -0
- package/dist/src/envOverwrite.d.ts +4 -0
- package/dist/src/factory.d.ts +78 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/src/locale.d.ts +82 -0
- package/dist/src/renderers/Form.d.ts +352 -0
- package/dist/src/renderers/Item.d.ts +795 -0
- package/dist/src/renderers/Options.d.ts +150 -0
- package/dist/src/renderers/Placeholder.d.ts +6 -0
- package/dist/src/renderers/builtin.d.ts +1 -0
- package/dist/src/renderers/wrapControl.d.ts +446 -0
- package/dist/src/schema.d.ts +369 -0
- package/dist/src/store/app.d.ts +89 -0
- package/dist/src/store/combo.d.ts +8504 -0
- package/dist/src/store/crud.d.ts +124 -0
- package/dist/src/store/form.d.ts +3394 -0
- package/dist/src/store/formItem.d.ts +130 -0
- package/dist/src/store/iRenderer.d.ts +46 -0
- package/dist/src/store/index.d.ts +105 -0
- package/dist/src/store/list.d.ts +270 -0
- package/dist/src/store/manager.d.ts +115 -0
- package/dist/src/store/modal.d.ts +84 -0
- package/dist/src/store/node.d.ts +22 -0
- package/dist/src/store/pagination.d.ts +58 -0
- package/dist/src/store/root.d.ts +79 -0
- package/dist/src/store/service.d.ts +71 -0
- package/dist/src/store/table-v2.d.ts +309 -0
- package/dist/src/store/table.d.ts +8334 -0
- package/dist/src/theme.d.ts +83 -0
- package/dist/src/types.d.ts +217 -0
- package/dist/src/utils/Animation.d.ts +22 -0
- package/dist/src/utils/ColorScale.d.ts +19 -0
- package/dist/src/utils/DataSchema.d.ts +25 -0
- package/dist/src/utils/DataScope.d.ts +23 -0
- package/dist/src/utils/RootClose.d.ts +4 -0
- package/dist/src/utils/SimpleMap.d.ts +8 -0
- package/dist/src/utils/api.d.ts +27 -0
- package/dist/src/utils/attachmentAdpator.d.ts +7 -0
- package/dist/src/utils/autobind.d.ts +7 -0
- package/dist/src/utils/columnsSplit.d.ts +1 -0
- package/dist/src/utils/dataMapping.d.ts +3 -0
- package/dist/src/utils/date.d.ts +4 -0
- package/dist/src/utils/debug.d.ts +26 -0
- package/dist/src/utils/dom.d.ts +13 -0
- package/dist/src/utils/errors.d.ts +6 -0
- package/dist/src/utils/escapeHtml.d.ts +1 -0
- package/dist/src/utils/filter-schema.d.ts +12 -0
- package/dist/src/utils/filter.d.ts +1 -0
- package/dist/src/utils/formatDuration.d.ts +1 -0
- package/dist/src/utils/formula.d.ts +16 -0
- package/dist/src/utils/getVariable.d.ts +3 -0
- package/dist/src/utils/grammar.d.ts +4 -0
- package/dist/src/utils/handleAction.d.ts +6 -0
- package/dist/src/utils/helper.d.ts +286 -0
- package/dist/src/utils/icon.d.ts +12 -0
- package/dist/src/utils/image.d.ts +17 -0
- package/dist/src/utils/index.d.ts +12 -0
- package/dist/src/utils/isPureVariable.d.ts +1 -0
- package/dist/src/utils/json-schema-2-amis-schema.d.ts +6 -0
- package/dist/src/utils/keyToPath.d.ts +6 -0
- package/dist/src/utils/makeSorter.d.ts +1 -0
- package/dist/src/utils/markdown.d.ts +5 -0
- package/dist/src/utils/normalizeLink.d.ts +1 -0
- package/dist/src/utils/normalizeOptions.d.ts +7 -0
- package/dist/src/utils/object.d.ts +15 -0
- package/dist/src/utils/offset.d.ts +14 -0
- package/dist/src/utils/offsetParent.d.ts +4 -0
- package/dist/src/utils/optionValueCompare.d.ts +3 -0
- package/dist/src/utils/position.d.ts +15 -0
- package/dist/src/utils/prettyBytes.d.ts +1 -0
- package/dist/src/utils/renderer-event.d.ts +44 -0
- package/dist/src/utils/replaceText.d.ts +6 -0
- package/dist/src/utils/resize-sensor.d.ts +6 -0
- package/dist/src/utils/resolveVariable.d.ts +1 -0
- package/dist/src/utils/resolveVariableAndFilter.d.ts +1 -0
- package/dist/src/utils/scrollPosition.d.ts +6 -0
- package/dist/src/utils/string2regExp.d.ts +1 -0
- package/dist/src/utils/stripNumber.d.ts +1 -0
- package/dist/src/utils/style.d.ts +10 -0
- package/dist/src/utils/tokenize.d.ts +1 -0
- package/dist/src/utils/tpl-builtin.d.ts +18 -0
- package/dist/src/utils/tpl-lodash.d.ts +4 -0
- package/dist/src/utils/tpl.d.ts +11 -0
- package/dist/src/utils/validations.d.ts +39 -0
- package/dist/store/app.js +190 -0
- package/dist/store/combo.js +154 -0
- package/dist/store/crud.js +413 -0
- package/dist/store/form.js +579 -0
- package/dist/store/formItem.js +846 -0
- package/dist/store/iRenderer.js +189 -0
- package/dist/store/index.js +103 -0
- package/dist/store/list.js +248 -0
- package/dist/store/manager.js +56 -0
- package/dist/store/modal.js +54 -0
- package/dist/store/node.js +93 -0
- package/dist/store/pagination.js +60 -0
- package/dist/store/root.js +45 -0
- package/dist/store/service.js +415 -0
- package/dist/store/table-v2.js +471 -0
- package/dist/store/table.js +1105 -0
- package/dist/theme.js +93 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/Animation.js +290 -0
- package/dist/utils/DataSchema.js +120 -0
- package/dist/utils/DataScope.js +151 -0
- package/dist/utils/SimpleMap.js +46 -0
- package/dist/utils/api.js +555 -0
- package/dist/utils/autobind.js +94 -0
- package/dist/utils/dataMapping.js +136 -0
- package/dist/utils/date.js +90 -0
- package/dist/utils/debug.js +343 -0
- package/dist/utils/errors.js +23 -0
- package/dist/utils/escapeHtml.js +24 -0
- package/dist/utils/filter-schema.js +75 -0
- package/dist/utils/filter.js +481 -0
- package/dist/utils/formatDuration.js +27 -0
- package/dist/utils/formula.js +165 -0
- package/dist/utils/getVariable.js +29 -0
- package/dist/utils/grammar.js +54 -0
- package/dist/utils/helper.js +1283 -0
- package/dist/utils/isPureVariable.js +16 -0
- package/dist/utils/keyToPath.js +34 -0
- package/dist/utils/makeSorter.js +30 -0
- package/dist/utils/normalizeLink.js +47 -0
- package/dist/utils/normalizeOptions.js +92 -0
- package/dist/utils/object.js +156 -0
- package/dist/utils/offset.js +36 -0
- package/dist/utils/offsetParent.js +27 -0
- package/dist/utils/optionValueCompare.js +25 -0
- package/dist/utils/position.js +50 -0
- package/dist/utils/prettyBytes.js +28 -0
- package/dist/utils/renderer-event.js +131 -0
- package/dist/utils/replaceText.js +35 -0
- package/dist/utils/resize-sensor.js +177 -0
- package/dist/utils/resolveVariable.js +39 -0
- package/dist/utils/resolveVariableAndFilter.js +37 -0
- package/dist/utils/string2regExp.js +18 -0
- package/dist/utils/stripNumber.js +20 -0
- package/dist/utils/tokenize.js +33 -0
- package/dist/utils/tpl-builtin.js +71 -0
- package/dist/utils/tpl-lodash.js +71 -0
- package/dist/utils/tpl.js +140 -0
- package/dist/utils/validations.js +377 -0
- package/package.json +121 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RendererProps } from '../factory';
|
|
3
|
+
import { IFormStore } from '../store/form';
|
|
4
|
+
import { SchemaNode, Action } from '../types';
|
|
5
|
+
import { IScopedContext } from '../Scoped';
|
|
6
|
+
import type { LabelAlign } from './Item';
|
|
7
|
+
import { ActionSchema, BaseSchema, DialogSchemaBase, SchemaApi, SchemaClassName, SchemaCollection, SchemaDefaultData, SchemaExpression, SchemaMessage, SchemaName, SchemaRedirect, SchemaReload } from '../schema';
|
|
8
|
+
export interface FormSchemaHorizontal {
|
|
9
|
+
left?: number;
|
|
10
|
+
right?: number;
|
|
11
|
+
leftFixed?: boolean | number | 'xs' | 'sm' | 'md' | 'lg';
|
|
12
|
+
justify?: boolean;
|
|
13
|
+
labelAlign?: 'left' | 'right';
|
|
14
|
+
}
|
|
15
|
+
export interface SchemaMap {
|
|
16
|
+
form: FormSchema;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Form 表单渲染器。
|
|
20
|
+
*
|
|
21
|
+
* 说明:https://baidu.gitee.io/amis/docs/components/form/index
|
|
22
|
+
*/
|
|
23
|
+
export interface FormSchema extends BaseSchema {
|
|
24
|
+
/**
|
|
25
|
+
* 指定为表单渲染器。
|
|
26
|
+
*/
|
|
27
|
+
type: 'form';
|
|
28
|
+
/**
|
|
29
|
+
* 表单标题
|
|
30
|
+
*/
|
|
31
|
+
title?: string;
|
|
32
|
+
/**
|
|
33
|
+
* 按钮集合,会固定在底部显示。
|
|
34
|
+
*/
|
|
35
|
+
actions?: Array<ActionSchema>;
|
|
36
|
+
/**
|
|
37
|
+
* 表单项集合
|
|
38
|
+
*/
|
|
39
|
+
body?: SchemaCollection;
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated 请用类型 tabs
|
|
42
|
+
*/
|
|
43
|
+
tabs?: any;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated 请用类型 fieldSet
|
|
46
|
+
*/
|
|
47
|
+
fieldSet?: any;
|
|
48
|
+
data?: SchemaDefaultData;
|
|
49
|
+
/**
|
|
50
|
+
* 是否开启调试,开启后会在顶部实时显示表单项数据。
|
|
51
|
+
*/
|
|
52
|
+
debug?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* 用来初始化表单数据
|
|
55
|
+
*/
|
|
56
|
+
initApi?: SchemaApi;
|
|
57
|
+
/**
|
|
58
|
+
* Form 用来获取初始数据的 api,与initApi不同的是,会一直轮询请求该接口,直到返回 finished 属性为 true 才 结束。
|
|
59
|
+
*/
|
|
60
|
+
initAsyncApi?: SchemaApi;
|
|
61
|
+
/**
|
|
62
|
+
* 设置了initAsyncApi后,默认会从返回数据的data.finished来判断是否完成,也可以设置成其他的xxx,就会从data.xxx中获取
|
|
63
|
+
*/
|
|
64
|
+
initFinishedField?: string;
|
|
65
|
+
/**
|
|
66
|
+
* 设置了initAsyncApi以后,默认拉取的时间间隔
|
|
67
|
+
*/
|
|
68
|
+
initCheckInterval?: number;
|
|
69
|
+
/**
|
|
70
|
+
* 是否初始加载
|
|
71
|
+
*/
|
|
72
|
+
initFetch?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* 建议改成 api 的 sendOn 属性。
|
|
75
|
+
*/
|
|
76
|
+
initFetchOn?: SchemaExpression;
|
|
77
|
+
/**
|
|
78
|
+
* 设置后将轮询调用 initApi
|
|
79
|
+
*/
|
|
80
|
+
interval?: number;
|
|
81
|
+
/**
|
|
82
|
+
* 是否静默拉取
|
|
83
|
+
*/
|
|
84
|
+
silentPolling?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* 配置停止轮询的条件
|
|
87
|
+
*/
|
|
88
|
+
stopAutoRefreshWhen?: string;
|
|
89
|
+
/**
|
|
90
|
+
* 是否开启本地缓存
|
|
91
|
+
*/
|
|
92
|
+
persistData?: string;
|
|
93
|
+
/**
|
|
94
|
+
* 提交成功后清空本地缓存
|
|
95
|
+
*/
|
|
96
|
+
clearPersistDataAfterSubmit?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Form 用来保存数据的 api。
|
|
99
|
+
*
|
|
100
|
+
* 详情:https://baidu.gitee.io/amis/docs/components/form/index#%E8%A1%A8%E5%8D%95%E6%8F%90%E4%BA%A4
|
|
101
|
+
*/
|
|
102
|
+
api?: SchemaApi;
|
|
103
|
+
/**
|
|
104
|
+
* Form 也可以配置 feedback。
|
|
105
|
+
*/
|
|
106
|
+
feedback?: DialogSchemaBase;
|
|
107
|
+
/**
|
|
108
|
+
* 设置此属性后,表单提交发送保存接口后,还会继续轮询请求该接口,直到返回 finished 属性为 true 才 结束。
|
|
109
|
+
*/
|
|
110
|
+
asyncApi?: SchemaApi;
|
|
111
|
+
/**
|
|
112
|
+
* 轮询请求的时间间隔,默认为 3秒。设置 asyncApi 才有效
|
|
113
|
+
*/
|
|
114
|
+
checkInterval?: number;
|
|
115
|
+
/**
|
|
116
|
+
* 如果决定结束的字段名不是 `finished` 请设置此属性,比如 `is_success`
|
|
117
|
+
*/
|
|
118
|
+
finishedField?: string;
|
|
119
|
+
/**
|
|
120
|
+
* 提交完后重置表单
|
|
121
|
+
*/
|
|
122
|
+
resetAfterSubmit?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* 提交后清空表单
|
|
125
|
+
*/
|
|
126
|
+
clearAfterSubmit?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* 配置表单项默认的展示方式。
|
|
129
|
+
*/
|
|
130
|
+
mode?: 'normal' | 'inline' | 'horizontal';
|
|
131
|
+
/**
|
|
132
|
+
* 表单项显示为几列
|
|
133
|
+
*/
|
|
134
|
+
columnCount?: number;
|
|
135
|
+
/**
|
|
136
|
+
* 如果是水平排版,这个属性可以细化水平排版的左右宽度占比。
|
|
137
|
+
*/
|
|
138
|
+
horizontal?: FormSchemaHorizontal;
|
|
139
|
+
/**
|
|
140
|
+
* 是否自动将第一个表单元素聚焦。
|
|
141
|
+
*/
|
|
142
|
+
autoFocus?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* 消息文案配置,记住这个优先级是最低的,如果你的接口返回了 msg,接口返回的优先。
|
|
145
|
+
*/
|
|
146
|
+
messages?: {
|
|
147
|
+
/**
|
|
148
|
+
* 表单验证失败时的提示
|
|
149
|
+
*/
|
|
150
|
+
validateFailed?: string;
|
|
151
|
+
} & SchemaMessage;
|
|
152
|
+
name?: SchemaName;
|
|
153
|
+
/**
|
|
154
|
+
* 配置容器 panel className
|
|
155
|
+
*/
|
|
156
|
+
panelClassName?: SchemaClassName;
|
|
157
|
+
/**
|
|
158
|
+
* 设置主键 id, 当设置后,检测表单是否完成时(asyncApi),只会携带此数据。
|
|
159
|
+
* @default id
|
|
160
|
+
*/
|
|
161
|
+
primaryField?: string;
|
|
162
|
+
redirect?: SchemaRedirect;
|
|
163
|
+
reload?: SchemaReload;
|
|
164
|
+
/**
|
|
165
|
+
* 修改的时候是否直接提交表单。
|
|
166
|
+
*/
|
|
167
|
+
submitOnChange?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* 表单初始先提交一次,联动的时候有用
|
|
170
|
+
*/
|
|
171
|
+
submitOnInit?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* 默认的提交按钮名称,如果设置成空,则可以把默认按钮去掉。
|
|
174
|
+
*/
|
|
175
|
+
submitText?: string;
|
|
176
|
+
/**
|
|
177
|
+
* 默认表单提交自己会通过发送 api 保存数据,但是也可以设定另外一个 form 的 name 值,或者另外一个 `CRUD` 模型的 name 值。 如果 target 目标是一个 `Form` ,则目标 `Form` 会重新触发 `initApi` 和 `schemaApi`,api 可以拿到当前 form 数据。如果目标是一个 `CRUD` 模型,则目标模型会重新触发搜索,参数为当前 Form 数据。
|
|
178
|
+
*/
|
|
179
|
+
target?: string;
|
|
180
|
+
/**
|
|
181
|
+
* 是否用 panel 包裹起来
|
|
182
|
+
*/
|
|
183
|
+
wrapWithPanel?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* 是否固定底下的按钮在底部。
|
|
186
|
+
*/
|
|
187
|
+
affixFooter?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* 页面离开提示,为了防止页面不小心跳转而导致表单没有保存。
|
|
190
|
+
*/
|
|
191
|
+
promptPageLeave?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* 具体的提示信息,选填。
|
|
194
|
+
*/
|
|
195
|
+
promptPageLeaveMessage?: string;
|
|
196
|
+
/**
|
|
197
|
+
* 组合校验规则,选填
|
|
198
|
+
*/
|
|
199
|
+
rules?: Array<{
|
|
200
|
+
rule: string;
|
|
201
|
+
message: string;
|
|
202
|
+
name?: string | Array<string>;
|
|
203
|
+
}>;
|
|
204
|
+
/**
|
|
205
|
+
* 禁用回车提交
|
|
206
|
+
*/
|
|
207
|
+
preventEnterSubmit?: boolean;
|
|
208
|
+
/**
|
|
209
|
+
* 表单label的对齐方式
|
|
210
|
+
*/
|
|
211
|
+
labelAlign?: LabelAlign;
|
|
212
|
+
}
|
|
213
|
+
export declare type FormGroup = FormSchema & {
|
|
214
|
+
title?: string;
|
|
215
|
+
className?: string;
|
|
216
|
+
};
|
|
217
|
+
export declare type FormGroupNode = FormGroup | FormGroupArray;
|
|
218
|
+
export interface FormGroupArray extends Array<FormGroupNode> {
|
|
219
|
+
}
|
|
220
|
+
export declare type FormHorizontal = FormSchemaHorizontal;
|
|
221
|
+
export interface FormProps extends RendererProps, Omit<FormSchema, 'mode' | 'className'> {
|
|
222
|
+
data: any;
|
|
223
|
+
store: IFormStore;
|
|
224
|
+
wrapperComponent: React.ElementType;
|
|
225
|
+
canAccessSuperData: boolean;
|
|
226
|
+
trimValues?: boolean;
|
|
227
|
+
lazyLoad?: boolean;
|
|
228
|
+
simpleMode?: boolean;
|
|
229
|
+
onInit?: (values: object, props: any) => any;
|
|
230
|
+
onReset?: (values: object) => void;
|
|
231
|
+
onSubmit?: (values: object, action: any) => any;
|
|
232
|
+
onChange?: (values: object, diff: object, props: any) => any;
|
|
233
|
+
onFailed?: (reason: string, errors: any) => any;
|
|
234
|
+
onFinished: (values: object, action: any) => any;
|
|
235
|
+
onValidate: (values: object, form: any) => any;
|
|
236
|
+
messages: {
|
|
237
|
+
fetchSuccess?: string;
|
|
238
|
+
fetchFailed?: string;
|
|
239
|
+
saveSuccess?: string;
|
|
240
|
+
saveFailed?: string;
|
|
241
|
+
validateFailed?: string;
|
|
242
|
+
};
|
|
243
|
+
rules: Array<{
|
|
244
|
+
rule: string;
|
|
245
|
+
message: string;
|
|
246
|
+
name?: string | Array<string>;
|
|
247
|
+
}>;
|
|
248
|
+
lazyChange?: boolean;
|
|
249
|
+
formLazyChange?: boolean;
|
|
250
|
+
}
|
|
251
|
+
export default class Form extends React.Component<FormProps, object> {
|
|
252
|
+
static defaultProps: {
|
|
253
|
+
title: string;
|
|
254
|
+
submitText: string;
|
|
255
|
+
initFetch: boolean;
|
|
256
|
+
wrapWithPanel: boolean;
|
|
257
|
+
mode: string;
|
|
258
|
+
collapsable: boolean;
|
|
259
|
+
controlWidth: string;
|
|
260
|
+
horizontal: {
|
|
261
|
+
left: number;
|
|
262
|
+
right: number;
|
|
263
|
+
offset: number;
|
|
264
|
+
};
|
|
265
|
+
columnCount: number;
|
|
266
|
+
panelClassName: string;
|
|
267
|
+
messages: {
|
|
268
|
+
fetchFailed: string;
|
|
269
|
+
saveSuccess: string;
|
|
270
|
+
saveFailed: string;
|
|
271
|
+
};
|
|
272
|
+
wrapperComponent: string;
|
|
273
|
+
finishedField: string;
|
|
274
|
+
initFinishedField: string;
|
|
275
|
+
labelAlign: string;
|
|
276
|
+
};
|
|
277
|
+
static propsList: Array<string>;
|
|
278
|
+
hooks: {
|
|
279
|
+
[propName: string]: Array<() => Promise<any>>;
|
|
280
|
+
};
|
|
281
|
+
asyncCancel: () => void;
|
|
282
|
+
disposeOnValidate: () => void;
|
|
283
|
+
disposeRulesValidate: () => void;
|
|
284
|
+
shouldLoadInitApi: boolean;
|
|
285
|
+
timer: ReturnType<typeof setTimeout>;
|
|
286
|
+
mounted: boolean;
|
|
287
|
+
lazyEmitChange: import("lodash").DebouncedFunc<any>;
|
|
288
|
+
unBlockRouting?: () => void;
|
|
289
|
+
constructor(props: FormProps);
|
|
290
|
+
componentDidMount(): void;
|
|
291
|
+
componentDidUpdate(prevProps: FormProps): void;
|
|
292
|
+
componentWillUnmount(): void;
|
|
293
|
+
blockRouting(): any;
|
|
294
|
+
beforePageUnload(e: any): any;
|
|
295
|
+
onInit(): Promise<void>;
|
|
296
|
+
reload(subPath?: string, query?: any, ctx?: any, silent?: boolean): void;
|
|
297
|
+
receive(values: object): void;
|
|
298
|
+
silentReload(target?: string, query?: any): void;
|
|
299
|
+
initInterval(value: any): any;
|
|
300
|
+
isValidated(): boolean;
|
|
301
|
+
validate(forceValidate?: boolean): Promise<boolean>;
|
|
302
|
+
clearErrors(): void;
|
|
303
|
+
getValues(): any;
|
|
304
|
+
setValues(value: any): void;
|
|
305
|
+
submit(fn?: (values: object) => Promise<any>): Promise<any>;
|
|
306
|
+
flush(): void;
|
|
307
|
+
reset(): void;
|
|
308
|
+
addHook(fn: () => any, type?: 'validate' | 'init' | 'flush'): () => void;
|
|
309
|
+
removeHook(fn: () => any, type?: string): void;
|
|
310
|
+
handleChange(value: any, name: string, submit: boolean, changePristine?: boolean): void;
|
|
311
|
+
formItemDispatchEvent(dispatchEvent: any): (type: string, data: any) => void;
|
|
312
|
+
emitChange(submit: boolean): Promise<void>;
|
|
313
|
+
handleBulkChange(values: Object, submit: boolean): void;
|
|
314
|
+
handleFormSubmit(e: React.UIEvent<any>): any;
|
|
315
|
+
handleAction(e: React.UIEvent<any> | void, action: Action, data: object, throwErrors?: boolean, delegate?: IScopedContext): any;
|
|
316
|
+
handleQuery(query: any): void;
|
|
317
|
+
handleDialogConfirm(values: object[], action: Action, ctx: any, targets: Array<any>): void;
|
|
318
|
+
handleDialogClose(confirmed?: boolean): void;
|
|
319
|
+
handleDrawerConfirm(values: object[], action: Action, ctx: any, targets: Array<any>): void;
|
|
320
|
+
handleDrawerClose(): void;
|
|
321
|
+
submitToTarget(target: string, values: object): void;
|
|
322
|
+
reloadTarget(target: string, data?: any): void;
|
|
323
|
+
closeTarget(target: string): void;
|
|
324
|
+
openFeedback(dialog: any, ctx: any): Promise<unknown>;
|
|
325
|
+
buildActions(): ActionSchema[] | {
|
|
326
|
+
type: string;
|
|
327
|
+
label: any;
|
|
328
|
+
primary: boolean;
|
|
329
|
+
}[] | undefined;
|
|
330
|
+
renderFormItems(schema: Partial<FormSchema> & {
|
|
331
|
+
controls?: Array<any>;
|
|
332
|
+
}, region?: string, otherProps?: Partial<FormProps>): React.ReactNode;
|
|
333
|
+
renderChildren(children: Array<any>, region: string, otherProps?: Partial<FormProps>): React.ReactNode;
|
|
334
|
+
renderChild(control: SchemaNode, key?: any, otherProps?: Partial<FormProps>, region?: string): React.ReactNode;
|
|
335
|
+
renderBody(): JSX.Element;
|
|
336
|
+
render(): JSX.Element;
|
|
337
|
+
}
|
|
338
|
+
export declare class FormRenderer extends Form {
|
|
339
|
+
static contextType: React.Context<IScopedContext>;
|
|
340
|
+
constructor(props: FormProps, context: IScopedContext);
|
|
341
|
+
componentDidMount(): void;
|
|
342
|
+
componentWillUnmount(): void;
|
|
343
|
+
doAction(action: Action, data?: object, throwErrors?: boolean): any;
|
|
344
|
+
handleAction(e: React.UIEvent<any> | undefined, action: Action, ctx: object, throwErrors?: boolean, delegate?: IScopedContext): any;
|
|
345
|
+
handleDialogConfirm(values: object[], action: Action, ctx: any, targets: Array<any>): void;
|
|
346
|
+
submitToTarget(target: string, values: object): void;
|
|
347
|
+
reloadTarget(target: string, data: any): void;
|
|
348
|
+
closeTarget(target: string): void;
|
|
349
|
+
reload(target?: string, query?: any, ctx?: any, silent?: boolean): void;
|
|
350
|
+
receive(values: object, name?: string): void;
|
|
351
|
+
setData(values: object): void;
|
|
352
|
+
}
|