@hzab/form-render 1.7.18 → 1.7.19

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.
Files changed (98) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/LICENSE +21 -0
  3. package/dist/common/date-utils.d.ts +1 -0
  4. package/dist/common/event.d.ts +5 -0
  5. package/dist/common/formily-utils.d.ts +54 -0
  6. package/dist/common/global-props-context.d.ts +8 -0
  7. package/dist/common/location-utils.d.ts +6 -0
  8. package/dist/common/schema-handler.d.ts +90 -0
  9. package/dist/common/schema-merge.d.ts +12 -0
  10. package/dist/components/ArrayBase/index.d.ts +75 -0
  11. package/dist/components/ArrayBase/style.d.ts +2 -0
  12. package/dist/components/ArrayCards/index.d.ts +13 -0
  13. package/dist/components/ArrayCards/style.d.ts +4 -0
  14. package/dist/components/ArrayTable/index.d.ts +51 -0
  15. package/dist/components/ArrayTable/style.d.ts +7 -0
  16. package/dist/components/CheckboxWithTip/index.d.ts +15 -0
  17. package/dist/components/DatePicker/index.d.ts +5 -0
  18. package/dist/components/LocationListPicker/components/AddrList/index.d.ts +3 -0
  19. package/dist/components/LocationListPicker/components/Popup/index.d.ts +15 -0
  20. package/dist/components/LocationListPicker/index.d.ts +3 -0
  21. package/dist/components/LocationPicker/Map/AMap/common/loader.d.ts +2 -0
  22. package/dist/components/LocationPicker/Map/AMap/common/utils.d.ts +130 -0
  23. package/dist/components/LocationPicker/common/utils.d.ts +19 -0
  24. package/dist/components/LocationPicker/components/ModalContent/index.d.ts +3 -0
  25. package/dist/components/LocationPicker/components/Notice/index.d.ts +2 -0
  26. package/dist/components/LocationPicker/components/PickerInfo/index.d.ts +3 -0
  27. package/dist/components/LocationPicker/components/ResInfo/index.d.ts +8 -0
  28. package/dist/components/LocationPicker/index.d.ts +3 -0
  29. package/dist/components/LocationPicker/servers/index.d.ts +21 -0
  30. package/dist/components/PersonnelSelect/index.d.ts +6 -0
  31. package/dist/components/PersonnelSelect/type.d.ts +88 -0
  32. package/dist/components/RadioGroupWithTip/index.d.ts +14 -0
  33. package/dist/components/RichEditor/components/handleMobileRem/index.d.ts +3 -0
  34. package/dist/components/RichEditor/components/handleMobileVw/index.d.ts +3 -0
  35. package/dist/components/RichEditor/index.d.ts +32 -0
  36. package/dist/components/Text/index.d.ts +9 -0
  37. package/dist/components/TreeCheckbox/common/utils.d.ts +74 -0
  38. package/dist/components/TreeCheckbox/components/CheckboxTable/index.d.ts +2 -0
  39. package/dist/components/TreeCheckbox/components/Render/index.d.ts +2 -0
  40. package/dist/components/TreeCheckbox/components/TabsRender/index.d.ts +2 -0
  41. package/dist/components/TreeCheckbox/index.d.ts +3 -0
  42. package/dist/components/Upload/common/OfflineUpload.d.ts +3 -0
  43. package/dist/components/Upload/common/checkFileType.d.ts +3 -0
  44. package/dist/components/Upload/common/customRequest.d.ts +32 -0
  45. package/dist/components/Upload/common/fileName.d.ts +3 -0
  46. package/dist/components/Upload/common/handleIOFileList.d.ts +133 -0
  47. package/dist/components/Upload/common/nanoid.d.ts +2 -0
  48. package/dist/components/Upload/components/Image/index.d.ts +3 -0
  49. package/dist/components/Upload/components/ItemList/ItemRender.d.ts +2 -0
  50. package/dist/components/Upload/components/ItemList/index.d.ts +2 -0
  51. package/dist/components/Upload/components/PreviewModal/index.d.ts +5 -0
  52. package/dist/components/Upload/components/PreviewModal/previewRender.d.ts +12 -0
  53. package/dist/components/Upload/index.d.ts +2 -0
  54. package/dist/components/UserSelect/index.d.ts +29 -0
  55. package/dist/components/index.d.ts +14 -0
  56. package/dist/globalConfig.d.ts +6 -0
  57. package/dist/index.cjs +9 -0
  58. package/dist/index.css +2 -0
  59. package/dist/index.d.ts +7 -0
  60. package/dist/index.js +3227 -0
  61. package/package.json +79 -72
  62. package/src/common/schema-handler.ts +2 -2
  63. package/src/components/ArrayBase/index.tsx +7 -5
  64. package/src/components/ArrayCards/index.tsx +5 -4
  65. package/src/components/ArrayTable/index.tsx +9 -7
  66. package/src/components/DatePicker/index.tsx +1 -1
  67. package/src/components/LocationListPicker/components/Popup/index.tsx +1 -1
  68. package/src/components/LocationListPicker/index.tsx +3 -3
  69. package/src/components/LocationPicker/Map/AMap/common/utils.ts +9 -9
  70. package/src/components/LocationPicker/common/utils.ts +5 -5
  71. package/src/components/LocationPicker/components/ModalContent/index.tsx +5 -5
  72. package/src/components/PersonnelSelect/type.ts +1 -1
  73. package/src/components/RichEditor/components/handleMobileRem/index.tsx +2 -2
  74. package/src/components/RichEditor/components/handleMobileVw/index.tsx +1 -1
  75. package/src/components/RichEditor/index.tsx +1 -1
  76. package/src/components/TreeCheckbox/common/utils.ts +1 -1
  77. package/src/components/Upload/common/handleIOFileList.ts +2 -2
  78. package/src/components/Upload/uploader-input.jsx +1 -1
  79. package/src/components/Upload/uploader.jsx +6 -12
  80. package/src/components/UserSelect/index.tsx +1 -1
  81. package/src/global.d.ts +12 -0
  82. package/src/index.tsx +2 -2
  83. package/src/vite-env.d.ts +1 -0
  84. package/README.md +0 -330
  85. package/docs/README.md +0 -21
  86. package/docs/components/ArrayCards.md +0 -68
  87. package/docs/components/ArrayTable.md +0 -111
  88. package/docs/components/CheckboxWithTip.md +0 -43
  89. package/docs/components/DatePicker.md +0 -54
  90. package/docs/components/LocationListPicker.md +0 -41
  91. package/docs/components/LocationPicker.md +0 -67
  92. package/docs/components/PersonnelSelect.md +0 -77
  93. package/docs/components/RadioGroupWithTip.md +0 -43
  94. package/docs/components/RichEditor.md +0 -94
  95. package/docs/components/Text.md +0 -26
  96. package/docs/components/TreeCheckbox.md +0 -52
  97. package/docs/components/Upload.md +0 -77
  98. package/docs/components/UserSelect.md +0 -59
package/README.md DELETED
@@ -1,330 +0,0 @@
1
- # @hzab/form-render
2
-
3
- formily schema 表单渲染组件
4
-
5
- # 组件
6
-
7
- ## Tips
8
-
9
- - antd 组件样式需要手动引入
10
-
11
- ## 自研组件
12
-
13
- | x-component | 说明 | 文档 |
14
- | ----------- | ---- | ---- |
15
- | Upload | 文件上传(OSS / 私有化等) | [README](docs/components/Upload.md) |
16
- | LocationPicker | 地图选点 | [README](docs/components/LocationPicker.md) |
17
- | LocationListPicker | 多地址 / 点位列表选择 | [README](docs/components/LocationListPicker.md) |
18
- | RichEditor / Editor | 富文本编辑器 | [README](docs/components/RichEditor.md) |
19
- | TreeCheckbox | 树形多选复选框 | [README](docs/components/TreeCheckbox.md) |
20
- | UserSelect | 人员下拉(本地 options) | [README](docs/components/UserSelect.md) |
21
- | PersonnelSelect / RemoteSelect | 远程人员搜索下拉 | [README](docs/components/PersonnelSelect.md) |
22
- | DatePicker | 日期选择(含 RangePicker 拆分字段) | [README](docs/components/DatePicker.md) |
23
- | RadioGroupWithTip | 带描述的单选 | [README](docs/components/RadioGroupWithTip.md) |
24
- | CheckboxWithTip | 带描述的多选 | [README](docs/components/CheckboxWithTip.md) |
25
- | ArrayTable | 自增表格 | [README](docs/components/ArrayTable.md) |
26
- | ArrayCards | 自增卡片 | [README](docs/components/ArrayCards.md) |
27
- | Text | 只读文本展示 | [README](docs/components/Text.md) |
28
-
29
- 内置 antd / c-formily-antd 组件(Input、Select、FormGrid 等)通过 `FormRender` 注册,Schema 约定见下方 Schema 章节。
30
-
31
- ## 示例
32
-
33
- 本地文档站(antd 风格):左侧组件列表,组件页上方为 Demo、下方为 API。
34
-
35
- ```bash
36
- npm run dev
37
- ```
38
-
39
- 打开 http://localhost:3000 (HashRouter,路径形如 `/#/components/upload`):
40
-
41
- - `/#/` 组件总览
42
- - `/#/components/*` 各组件 Demo + API
43
- - `/#/lab/*` 综合 / 场景示例
44
-
45
- #### 项目初始化时挂载全局组件
46
-
47
- ```jsx
48
- import { setFormilyGlobalComponents } from "@hzab/utils/src/formily/global-components";
49
-
50
- // 挂载 Test1 组件到 formRender 组件
51
- setFormilyGlobalComponents({
52
- Test1() {
53
- return <div>Test1</div>;
54
- },
55
- });
56
-
57
- // 挂载 Test2 组件到 formRender 组件
58
- setFormilyGlobalComponents({
59
- Test2() {
60
- return <div>Test2</div>;
61
- },
62
- Test3() {
63
- return <div>Test3</div>;
64
- },
65
- });
66
- ```
67
-
68
- ```jsx
69
- import FormRender from "@hzab/form-render";
70
-
71
- // testSchema 为 formily 生成的 schema json
72
- <FormRender schema={testSchema} />;
73
- ```
74
-
75
- #### 组件远程数据
76
-
77
- - 使用 schemaScope 传入全局配置变量,在响应器的动作响应中调用
78
-
79
- ```jsx
80
- // schema
81
- {
82
- "form": {
83
- "labelCol": 6,
84
- "wrapperCol": 12
85
- },
86
- "schema": {
87
- "type": "object",
88
- "properties": {
89
- "parentId": {
90
- "type": "string",
91
- "title": "上级菜单",
92
- "x-decorator": "FormItem",
93
- "x-component": "TreeSelect",
94
- "x-validator": [],
95
- "x-component-props": {},
96
- "x-decorator-props": {},
97
- "x-reactions": {
98
- "fulfill": {
99
- "run": "fetchMenuTree($self);"
100
- }
101
- },
102
- "name": "parentId",
103
- "x-designable-id": "i012z5nbd5z",
104
- "x-index": 0
105
- }
106
- }
107
- }
108
- }
109
-
110
- // formRender
111
- <FormRender
112
- schema={testSchema}
113
- schemaScope={{
114
- fetchMenuTree(field) {
115
- // 模拟请求
116
- setTimeout(() => {
117
- // field 目标组件的 配置参数
118
- // 通过 field.component[1] 可以动态配置目标组件的 props
119
- // 树选择器 数据源
120
- field.component[1].treeData = [{ value: 1, label: 1 }];
121
- }, 1000)
122
- },
123
- }}
124
- />
125
- ```
126
-
127
- #### 自定义组件
128
-
129
- - 使用 components 传入自定义组件,在 schema 中 x-component 配置对应的组件名称
130
-
131
- ```jsx
132
- // schema
133
- {
134
- "form": {
135
- "labelCol": 6,
136
- "wrapperCol": 12
137
- },
138
- "schema": {
139
- "type": "object",
140
- "properties": {
141
- "parentId": {
142
- "type": "string",
143
- "title": "图标选择器",
144
- "x-decorator": "FormItem",
145
- "x-component": "IconSelect",
146
- "x-validator": [],
147
- "x-component-props": {},
148
- "x-decorator-props": {},
149
- "x-reactions": {},
150
- "name": "parentId",
151
- "x-designable-id": "i012z5nbd5z",
152
- "x-index": 0
153
- }
154
- }
155
- }
156
- }
157
-
158
- // formRender
159
- <FormRender
160
- schema={testSchema}
161
- components={{
162
- // 自定义组件
163
- IconSelect() {
164
- return "IconSelect";
165
- },
166
- }}
167
- />
168
- ```
169
-
170
- ## API
171
-
172
- ### FormRender Attributes
173
-
174
- | 参数 | 类型 | 必填 | 默认值 | 说明 |
175
- | ------------------ | -------- | ---- | ---------- | ------------------------------------------------------------------------------------------ |
176
- | schema | Object | 是 | - | 数据信息的 schema |
177
- | schemaScope | Object | 否 | - | 全局作用域,用于实现协议表达式变量注入 |
178
- | layout | Object | 否 | horizontal | 表单布局,horizontal vertical \ inline |
179
- | initialValues | Object | 否 | - | form 初始值 |
180
- | components | Object | 否 | - | 自定义组件 |
181
- | formOptions | Object | 否 | - | createForm 的参数 |
182
- | emptyValue | string | 否 | N/A | 只读模式 PreviewText emptyValue 配置 |
183
- | disabled | boolean | 否 | - | 禁用状态 |
184
- | readOnly | boolean | 否 | - | 只读状态 |
185
- | onFormValuesChange | Function | 否 | - | 表单事件 (form)=>{} https://core.formilyjs.org/zh-CN/api/entry/form-effect-hooks |
186
- | onFieldValueChange | Function | 否 | - | 表单项事件 (field, form)=>{} https://core.formilyjs.org/zh-CN/api/entry/field-effect-hooks |
187
-
188
- ### 方法 Methods
189
-
190
- | 名称 | 参数 | 说明 |
191
- | ---- | --------- | -------------- |
192
- | init | form 实例 | 组件初始化执行 |
193
-
194
- ### 全局配置(缩略图 / 预览域名)
195
-
196
- 项目初始化时可配置上传预览相关全局参数(见 `src/globalConfig.ts`):
197
-
198
- ```js
199
- import {
200
- setFormRenderPCGlobalServeConfig,
201
- setFormRenderPCGlobalServeConfigs,
202
- getFormRenderPCGlobalServeConfig,
203
- } from "@hzab/form-render/src/globalConfig";
204
-
205
- // 设置单个配置
206
- setFormRenderPCGlobalServeConfig("serverUrl", "/api/v1/user/oss/getWebOssConfig");
207
-
208
- // 批量设置
209
- setFormRenderPCGlobalServeConfigs({
210
- serverUrl: "/api/v1/user/oss/getWebOssConfig",
211
- // 其他如缩略图相关配置
212
- });
213
-
214
- getFormRenderPCGlobalServeConfig();
215
- ```
216
-
217
- ### Schema
218
-
219
- - 使用 表单编辑器生成:https://designable-antd.formilyjs.org/
220
-
221
- ```js
222
- {
223
- "form": {
224
- "labelCol": 6,
225
- "wrapperCol": 12
226
- },
227
- "schema": {
228
- "type": "object",
229
- "properties": {
230
- // 参数 key
231
- "parentId": {
232
- "type": "string",
233
- // 参数 label
234
- "title": "上级菜单",
235
- "x-decorator": "FormItem",
236
- // 渲染的组件
237
- "x-component": "TreeSelect",
238
- // 组件校验
239
- "x-validator": [],
240
- // 组件配置
241
- "x-component-props": {
242
- "virtual": true,
243
- "allowClear": true,
244
- "showSearch": true
245
- },
246
- // 容器配置
247
- "x-decorator-props": {},
248
- // 响应器
249
- "x-reactions": {
250
- // 依赖字段
251
- "dependencies": [
252
- {
253
- "property": "value",
254
- "type": "any"
255
- }
256
- ],
257
- // 响应动作
258
- "fulfill": {
259
- // 属性响应,只支持 JS 表达式
260
- "state": {
261
- "visible": "{{$deps.menuType === \"C\" || $deps.menuType === \"F\"}}"
262
- },
263
- // 动作响应,支持 JS 语句
264
- "run": "fetchMenuTree($self);"
265
- }
266
- },
267
- // 参数 key
268
- "name": "parentId",
269
- // 组件在编辑器中的 ID(必须唯一)
270
- "x-designable-id": "i012z5nbd5z",
271
- // 组件在表单中的顺序(必须唯一)
272
- "x-index": 0,
273
- // 是否在 table 中展示,目前需要手动添加配置
274
- "inTable": false
275
- }
276
- }
277
- }
278
- }
279
- ```
280
-
281
- # 组件开发流程
282
-
283
- - 在 config/webpack.config/webpack.config.dev.js 中按需修改 alias 配置的包名,便于本地调试
284
- - 在 example/typings.d.ts 中按需修改 declare module 配置的包名,解决 ts 报错问题
285
- - npm run dev
286
-
287
- ## 文件目录
288
-
289
- - example 本地 demo / 手工测试页面
290
- - src 组件源码
291
- - docs 组件文档
292
- - tests 单元测试
293
-
294
- ## 命令
295
-
296
- - 本地运行:npm run dev
297
- - 打包编译:npm run build
298
- - 单元测试:npm test
299
- - 测试监听:npm run test:watch
300
- - 测试覆盖率:npm run test:coverage
301
-
302
- ## 发布
303
-
304
- - npm 源和云效源都需要发布
305
-
306
- - 命令:npm publish --access public
307
- - 发布目录:
308
- - src
309
-
310
- ### nrm
311
-
312
- - 安装
313
- npm install -g nrm
314
- - 增加源
315
- nrm add aliyun https://packages.aliyun.com/62046985b3ead41b374a17f7/npm/npm-registry/
316
- - 切换源
317
- nrm use aliyun
318
- nrm use npm
319
- - 登录(账号密码在 https://packages.aliyun.com/npm/npm-registry/guide 查看)
320
- npm login --registry=https://packages.aliyun.com/62046985b3ead41b374a17f7/npm/npm-registry/
321
-
322
- ## 配置
323
-
324
- ### 配置文件
325
-
326
- - 本地配置文件:config/config.js
327
-
328
- ### webpack 配置文件
329
-
330
- - config/webpack.config.js
package/docs/README.md DELETED
@@ -1,21 +0,0 @@
1
- # 组件文档
2
-
3
- 自研表单组件说明,与源码目录分离,位于仓库根目录 `docs/`。
4
-
5
- | 组件 | 文档 |
6
- | ---- | ---- |
7
- | Upload | [Upload.md](./components/Upload.md) |
8
- | LocationPicker | [LocationPicker.md](./components/LocationPicker.md) |
9
- | LocationListPicker | [LocationListPicker.md](./components/LocationListPicker.md) |
10
- | RichEditor | [RichEditor.md](./components/RichEditor.md) |
11
- | TreeCheckbox | [TreeCheckbox.md](./components/TreeCheckbox.md) |
12
- | UserSelect | [UserSelect.md](./components/UserSelect.md) |
13
- | PersonnelSelect | [PersonnelSelect.md](./components/PersonnelSelect.md) |
14
- | DatePicker | [DatePicker.md](./components/DatePicker.md) |
15
- | RadioGroupWithTip | [RadioGroupWithTip.md](./components/RadioGroupWithTip.md) |
16
- | CheckboxWithTip | [CheckboxWithTip.md](./components/CheckboxWithTip.md) |
17
- | ArrayTable | [ArrayTable.md](./components/ArrayTable.md) |
18
- | ArrayCards | [ArrayCards.md](./components/ArrayCards.md) |
19
- | Text | [Text.md](./components/Text.md) |
20
-
21
- FormRender 总览见根目录 [README.md](../README.md)。
@@ -1,68 +0,0 @@
1
- # ArrayCards
2
-
3
- 自增卡片列表,基于 Formily ArrayCards,通过 ArrayBase mixin 提供增删改排序子组件。
4
-
5
- ArrayBase 回调(`onAdd` / `onRemove` / `onSortStart` 等)与导出 hooks 说明见 [ArrayTable README](./ArrayTable.md)。
6
-
7
- ## Schema 示例
8
-
9
- ```json
10
- {
11
- "type": "array",
12
- "x-component": "ArrayCards",
13
- "x-component-props": {
14
- "title": "卡片"
15
- },
16
- "items": {
17
- "type": "object",
18
- "properties": {
19
- "index": { "type": "void", "x-component": "ArrayCards.Index" },
20
- "name": {
21
- "type": "string",
22
- "title": "名称",
23
- "x-decorator": "FormItem",
24
- "x-component": "Input"
25
- },
26
- "remove": { "type": "void", "x-component": "ArrayCards.Remove" },
27
- "moveDown": { "type": "void", "x-component": "ArrayCards.MoveDown" },
28
- "moveUp": { "type": "void", "x-component": "ArrayCards.MoveUp" }
29
- }
30
- },
31
- "properties": {
32
- "addition": {
33
- "type": "void",
34
- "title": "添加条目",
35
- "x-component": "ArrayCards.Addition"
36
- }
37
- }
38
- }
39
- ```
40
-
41
- ### ArrayCards Attributes
42
-
43
- | 参数 | 类型 | 必填 | 默认值 | 说明 |
44
- | --------------------- | -------- | ---- | ------ | ---- |
45
- | title | ReactNode | 否 | - | 卡片标题(可与 Index 组合) |
46
- | onAdd | Function | 否 | - | 新增回调 |
47
- | onCopy | Function | 否 | - | 复制回调 |
48
- | onRemove | Function | 否 | - | 删除回调 |
49
- | onMoveDown | Function | 否 | - | 下移回调 |
50
- | onMoveUp | Function | 否 | - | 上移回调 |
51
- | deletePopconfirm | boolean | 否 | - | 删除是否二次确认 |
52
- | deletePopconfirmTitle | Function\|ReactNode | 否 | - | 删除确认文案 |
53
- | disabled | boolean | 否 | - | 禁用 |
54
-
55
- 其余 props 透传 antd Card。
56
-
57
- ### 子组件(x-component)
58
-
59
- | 名称 | 说明 |
60
- | -------------------- | ---- |
61
- | ArrayCards.Index | 序号 |
62
- | ArrayCards.Remove | 删除 |
63
- | ArrayCards.Copy | 复制 |
64
- | ArrayCards.MoveDown | 下移 |
65
- | ArrayCards.MoveUp | 上移 |
66
- | ArrayCards.Addition | 新增卡片 |
67
-
68
- 完整交互示例见 `example/pages/array-base-demo`。
@@ -1,111 +0,0 @@
1
- # ArrayTable
2
-
3
- 自增表格,基于 Formily ArrayTable 扩展,支持分页、拖拽排序回调,并通过 ArrayBase mixin 暴露增删改操作子组件。
4
-
5
- ## Schema 示例
6
-
7
- ```json
8
- {
9
- "type": "array",
10
- "x-component": "ArrayTable",
11
- "x-component-props": {
12
- "onSortStart": "{{onSortStart}}",
13
- "onSortEnd": "{{onSortEnd}}",
14
- "deletePopconfirm": true
15
- },
16
- "items": {
17
- "type": "object",
18
- "properties": {
19
- "column1": {
20
- "type": "void",
21
- "x-component": "ArrayTable.Column",
22
- "x-component-props": { "title": "排序", "width": 50 },
23
- "properties": {
24
- "sort": { "type": "void", "x-component": "ArrayTable.SortHandle" }
25
- }
26
- },
27
- "column2": {
28
- "type": "void",
29
- "x-component": "ArrayTable.Column",
30
- "x-component-props": { "title": "序号", "width": 50 },
31
- "properties": {
32
- "index": { "type": "void", "x-component": "ArrayTable.Index" }
33
- }
34
- },
35
- "name": {
36
- "type": "void",
37
- "x-component": "ArrayTable.Column",
38
- "x-component-props": { "title": "名称" },
39
- "properties": {
40
- "name": {
41
- "type": "string",
42
- "x-decorator": "FormItem",
43
- "x-component": "Input"
44
- }
45
- }
46
- },
47
- "operations": {
48
- "type": "void",
49
- "x-component": "ArrayTable.Column",
50
- "x-component-props": { "title": "操作" },
51
- "properties": {
52
- "remove": { "type": "void", "x-component": "ArrayTable.Remove" },
53
- "moveDown": { "type": "void", "x-component": "ArrayTable.MoveDown" },
54
- "moveUp": { "type": "void", "x-component": "ArrayTable.MoveUp" }
55
- }
56
- }
57
- }
58
- },
59
- "properties": {
60
- "addition": {
61
- "type": "void",
62
- "title": "添加条目",
63
- "x-component": "ArrayTable.Addition"
64
- }
65
- }
66
- }
67
- ```
68
-
69
- ### ArrayTable Attributes
70
-
71
- | 参数 | 类型 | 必填 | 默认值 | 说明 |
72
- | --------------------- | -------- | ---- | ------ | ---- |
73
- | onAdd | Function | 否 | - | 新增回调 `(index) => void` |
74
- | onCopy | Function | 否 | - | 复制回调 |
75
- | onRemove | Function | 否 | - | 删除回调 |
76
- | onMoveDown | Function | 否 | - | 下移回调 |
77
- | onMoveUp | Function | 否 | - | 上移回调 |
78
- | onSortStart | Function | 否 | - | 拖拽排序开始 |
79
- | onSortEnd | Function | 否 | - | 拖拽排序结束 |
80
- | deletePopconfirm | boolean | 否 | - | 删除是否二次确认 |
81
- | deletePopconfirmTitle | Function\|ReactNode | 否 | - | 删除确认文案 |
82
- | disabled | boolean | 否 | - | 禁用 |
83
-
84
- 其余 props 透传 antd Table。
85
-
86
- ### 子组件(x-component)
87
-
88
- | 名称 | 说明 |
89
- | ----------------------- | ---- |
90
- | ArrayTable.Column | 列容器 |
91
- | ArrayTable.SortHandle | 拖拽排序手柄 |
92
- | ArrayTable.Index | 行序号 |
93
- | ArrayTable.Remove | 删除 |
94
- | ArrayTable.MoveDown | 下移 |
95
- | ArrayTable.MoveUp | 上移 |
96
- | ArrayTable.Addition | 新增行 |
97
-
98
- ### 从 ArrayTable 导出的 API(ArrayBase)
99
-
100
- 可通过 `ArrayTable`(或直接从包内 ArrayBase 相关导出)使用:
101
-
102
- | 名称 | 说明 |
103
- | ------------------- | ---- |
104
- | useArray | 获取当前 Array 上下文 |
105
- | useIndex | 获取当前行 index |
106
- | useRecord | 获取当前行 record |
107
- | isAdditionComponent | 判断 schema 是否为 Addition 组件 |
108
- | isColumnComponent | 判断是否为 Column |
109
- | isOperationsComponent | 判断是否为 Operations |
110
-
111
- 完整交互示例见 `example/pages/array-base-demo`。
@@ -1,43 +0,0 @@
1
- # CheckboxWithTip
2
-
3
- 带描述文案、支持单项禁用的多选组。数据优先取 `dataSource`,否则取 Formily `field.dataSource`(schema `enum`)。
4
-
5
- ## Schema 示例
6
-
7
- ```json
8
- {
9
- "x-component": "CheckboxWithTip",
10
- "enum": [
11
- {
12
- "label": "人力填报",
13
- "value": 1,
14
- "desc": "由人力在后台填报信息。"
15
- },
16
- {
17
- "label": "个人填报",
18
- "value": 2,
19
- "desc": "由个人在移动端填报信息。",
20
- "disabled": true
21
- }
22
- ]
23
- }
24
- ```
25
-
26
- ### CheckboxWithTip Attributes
27
-
28
- | 参数 | 类型 | 必填 | 默认值 | 说明 |
29
- | ---------- | -------- | ---- | ------ | ---- |
30
- | value | Array | 否 | - | 当前选中值数组 |
31
- | onChange | Function | 否 | - | 选中变化回调 |
32
- | dataSource | Array | 否 | field.dataSource | 选项列表,见下表 |
33
-
34
- 其余 props 透传 antd `Checkbox.Group`。
35
-
36
- ### dataSource / enum 子项
37
-
38
- | 参数 | 类型 | 必填 | 默认值 | 说明 |
39
- | -------- | -------------- | ---- | ------ | ---- |
40
- | label | string | 是 | - | 主标题 |
41
- | value | string\|number | 是 | - | 选项值 |
42
- | desc | string | 否 | - | 描述文案 |
43
- | disabled | boolean | 否 | false | 单项禁用 |
@@ -1,54 +0,0 @@
1
- # DatePicker
2
-
3
- 基于 `c-formily-antd` DatePicker 的封装,统一日期格式化;`RangePicker` 支持将起止时间拆分写入同级字段。
4
-
5
- ## Schema 示例
6
-
7
- ```json
8
- {
9
- "x-component": "DatePicker",
10
- "x-component-props": {
11
- "showTime": true
12
- }
13
- }
14
- ```
15
-
16
- ```json
17
- {
18
- "x-component": "DatePicker.RangePicker",
19
- "x-component-props": {
20
- "isSplitTimes": true,
21
- "startKey": "startTime",
22
- "endKey": "endTime"
23
- }
24
- }
25
- ```
26
-
27
- ### DatePicker Attributes
28
-
29
- | 参数 | 类型 | 必填 | 默认值 | 说明 |
30
- | -------- | ------- | ---- | ------ | ---- |
31
- | format | string | 否 | 按 picker / showTime 推导 | 日期展示与解析格式 |
32
- | picker | string | 否 | date | `date` / `week` / `month` / `quarter` / `year` |
33
- | showTime | boolean | 否 | false | 是否显示时间;为 true 时默认 format 为 `YYYY-MM-DD HH:mm:ss` |
34
-
35
- 未传 `format` 时的默认值:
36
-
37
- | picker / showTime | 默认 format |
38
- | ----------------- | ----------- |
39
- | month | `YYYY-MM` |
40
- | quarter | `YYYY-\QQ` |
41
- | year | `YYYY` |
42
- | week | `gggg-wo` |
43
- | showTime=true | `YYYY-MM-DD HH:mm:ss` |
44
- | 其他 | `YYYY-MM-DD` |
45
-
46
- ### DatePicker.RangePicker Attributes
47
-
48
- | 参数 | 类型 | 必填 | 默认值 | 说明 |
49
- | ------------ | ------- | ---- | ----------- | ---- |
50
- | isSplitTimes | boolean | 否 | false | 为 true 时,将起止时间写入同级 `startKey` / `endKey` 字段 |
51
- | startKey | string | 否 | startTime | 拆分后的开始时间字段名 |
52
- | endKey | string | 否 | endTime | 拆分后的结束时间字段名 |
53
-
54
- 嵌套在 `ArrayTable` / `ArrayCards` 内时,拆分结果写入当前行(父级)对象。
@@ -1,41 +0,0 @@
1
- # LocationListPicker
2
-
3
- 多地址 / 点位列表选择器,基于高德地图,支持点位与多边形绘制。
4
-
5
- ## 使用前安装依赖
6
-
7
- ```bash
8
- npm install @amap/amap-jsapi-loader
9
- ```
10
-
11
- ## Schema 示例
12
-
13
- ```json
14
- {
15
- "x-component": "LocationListPicker",
16
- "x-component-props": {
17
- "hasPoint": true,
18
- "hasPolygon": false,
19
- "isAutoSearch": true
20
- }
21
- }
22
- ```
23
-
24
- ### LocationListPicker Attributes
25
-
26
- | 参数 | 类型 | 必填 | 默认值 | 说明 |
27
- | -------------- | -------- | ---- | ------ | ---- |
28
- | value | Array | 否 | - | 地址列表数据 |
29
- | readOnly | boolean | 否 | false | 只读 |
30
- | disabled | boolean | 否 | false | 禁用 |
31
- | hasPoint | boolean | 否 | true | 是否支持新增点位 |
32
- | hasPolygon | boolean | 否 | false | 是否支持新增多边形 |
33
- | isAutoSearch | boolean | 否 | - | 搜索框是否自动搜索 |
34
- | listProps | Object | 否 | - | 左侧地址列表区域配置 |
35
- | popupProps | Object | 否 | - | 弹层 / 编辑弹窗配置 |
36
- | ItemRender | Function | 否 | - | 自定义列表项渲染 |
37
- | markerIconConf | Object | 否 | - | marker 图标配置 |
38
- | loading | boolean | 否 | false | 加载态 |
39
- | onChange | Function | 否 | - | 列表变化回调 |
40
-
41
- 表单值一般为地址对象数组(组件会为缺失项自动补 `id`)。