@hzab/list-render 1.10.2 → 1.10.5
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/CHANGELOG.md +8 -0
- package/README.md +77 -59
- package/package.json +1 -1
- package/src/common/constant.ts +4 -0
- package/src/common/handleQuerySchema.ts +576 -302
- package/src/components/Formily/FormilyEditTable.tsx +33 -7
- package/src/components/Formily/FormilyField.tsx +68 -68
- package/src/list-render.jsx +74 -16
- package/src/query-render/index.jsx +95 -92
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -49,59 +49,61 @@ const listDM = useMemo(
|
|
|
49
49
|
|
|
50
50
|
### InfoPanel Attributes
|
|
51
51
|
|
|
52
|
-
| 属性名称 | 属性类型 | 必须 | 默认值
|
|
53
|
-
| --------------------------- | ------------------------- | ---- |
|
|
54
|
-
| layout | string | 否 | default
|
|
55
|
-
| className | string | 否 | -
|
|
56
|
-
| idKey | string | 否 | id
|
|
57
|
-
| schema | Object | 是 | -
|
|
58
|
-
| model | Object | 是 | -
|
|
59
|
-
| isPatchUpdate | boolean | 否 | false
|
|
60
|
-
| list | Array | | -
|
|
61
|
-
| closeAutoRequest | Boolean | | false
|
|
62
|
-
| hasQuery | Boolean | | true
|
|
63
|
-
| verticalHeader | Boolean | | false
|
|
64
|
-
| search | String | | -
|
|
65
|
-
| filters | Array | | []
|
|
66
|
-
| queryConf | Object | | {}
|
|
67
|
-
| createText | String/ReactNote | | 新增
|
|
68
|
-
| hasCreate | Boolean | | true
|
|
69
|
-
| hasAction | Boolean | | true
|
|
70
|
-
| hasEdit | Boolean/Function | | true
|
|
71
|
-
| hasDel | Boolean/Function | | true
|
|
72
|
-
| hasDetail | Boolean/Function | | true
|
|
73
|
-
| hasDelTips | String/Function | | "确认删除该项?"
|
|
74
|
-
| tableConf | Object | | {}
|
|
75
|
-
| tableProps | Object | | {}
|
|
76
|
-
| cardConf | Object | | {}
|
|
77
|
-
| cardProps | Object | | {}
|
|
78
|
-
| fetchOnEdit | Boolean | | true
|
|
79
|
-
| fetchById | Boolean | | true
|
|
80
|
-
| modalMode | string | | dialog
|
|
81
|
-
| modalConf | Object | | {}
|
|
82
|
-
| modalDetailProps | Object | | {}
|
|
83
|
-
| modalFormProps | Object | | {}
|
|
84
|
-
| modalProps | Object | | {}
|
|
85
|
-
| schemaScope | Object | | {}
|
|
86
|
-
| components | Object | | {}
|
|
87
|
-
| detailComponents | Object | | {}
|
|
88
|
-
| hasPagination | Boolean | | true
|
|
89
|
-
| paginationConf | Object | | {}
|
|
90
|
-
| formInitialValues | Object | | {}
|
|
91
|
-
| Slots | Object | | {}
|
|
92
|
-
| getFieldListOpt | Object | | {}
|
|
93
|
-
| onGetListEnd | Function | | -
|
|
94
|
-
| onCreateSuc | Function | | -
|
|
95
|
-
| onEditSuc | Function | | -
|
|
96
|
-
| onDelSuc | Function | | -
|
|
97
|
-
| onFormModalClose | Function | | -
|
|
98
|
-
| modalFormMount | Function | | -
|
|
99
|
-
| msgConf | Object | | {}
|
|
100
|
-
| i18n | Object | | {}
|
|
101
|
-
| queryFormInitialValues | Object | | {}
|
|
102
|
-
| queryFormIsExtendModelQuery | Boolean | | false
|
|
103
|
-
| useFormData | boolean | 否 |
|
|
104
|
-
| editMode | modal/line/line-cell/cell | 否 | modal
|
|
52
|
+
| 属性名称 | 属性类型 | 必须 | 默认值 | 描述 |
|
|
53
|
+
| --------------------------- | ------------------------- | ---- | -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
54
|
+
| layout | string | 否 | default | 列表渲染类型格式 |
|
|
55
|
+
| className | string | 否 | - | 外层 div className |
|
|
56
|
+
| idKey | string | 否 | id | 唯一值字段的 key |
|
|
57
|
+
| schema | Object | 是 | - | 字段描述文件,包含各个字段的信息 |
|
|
58
|
+
| model | Object | 是 | - | 数据模型,包含 CURD 接口信息,传入 DataModel 的实例 |
|
|
59
|
+
| isPatchUpdate | boolean | 否 | false | 编辑提交接口是否使用 patch 发起请求 |
|
|
60
|
+
| list | Array | | - | 本地数据源 |
|
|
61
|
+
| closeAutoRequest | Boolean | | false | 是否关闭加载完毕后自动发起请求。true 时组件 didMount 不自动发起请求 |
|
|
62
|
+
| hasQuery | Boolean | | true | 是否包含搜索、筛选框、搜索按钮等 |
|
|
63
|
+
| verticalHeader | Boolean | | false | 搜索项和新增按钮是否处于不同的行等 |
|
|
64
|
+
| search | String | | - | 传入空字符串时,不包含搜索框;传入非空字符串时,显示搜索框,同时传入的字符串作为搜索框的占位符 |
|
|
65
|
+
| filters | Array | | [] | 字符串数组,可以包含要筛选的字段 key 值(schema 中的 name),或者字符串 '$timerange'(时间范围筛选专用) |
|
|
66
|
+
| queryConf | Object | | {} | 设置 query 参数的 key |
|
|
67
|
+
| createText | String/ReactNote | | 新增 | 新增按钮文案 |
|
|
68
|
+
| hasCreate | Boolean | | true | 是否显示新增按钮 |
|
|
69
|
+
| hasAction | Boolean | | true | 是否在表格的最右增加一个“操作”列;hasAction 为 true 时,下面的 hasEdit/hasDel 才会生效 |
|
|
70
|
+
| hasEdit | Boolean/Function | | true | 是否显示编辑按钮,可传入回调控制当前行是否显示 |
|
|
71
|
+
| hasDel | Boolean/Function | | true | 是否显示删除按钮,可传入回调控制当前行是否显示 |
|
|
72
|
+
| hasDetail | Boolean/Function | | true | 是否显示详情按钮,可传入回调控制当前行是否显示 |
|
|
73
|
+
| hasDelTips | String/Function | | "确认删除该项?" | 删除按钮自定义提示,可传入回调根据当前行数据显示对应提示 |
|
|
74
|
+
| tableConf | Object | | {} | Table 相关配置 |
|
|
75
|
+
| tableProps | Object | | {} | 直接传给 Table 的 props,相关 API 可直接参考 antd table 组件 |
|
|
76
|
+
| cardConf | Object | | {} | Card 相关配置 |
|
|
77
|
+
| cardProps | Object | | {} | 直接传给 cardRender 的 props,因内部渲染使用的的是详情组件,相关 API 可直接参考 @hzab/schema-descriptions 组件 |
|
|
78
|
+
| fetchOnEdit | Boolean | | true | 展示编辑弹框时,是否会调用一次详情接口进行回填;若为 false,则会使用表格列表接口返回的 row 数据进行回填 |
|
|
79
|
+
| fetchById | Boolean | | true | 编辑中的详情请求,是否使用 id 作为入参的 key |
|
|
80
|
+
| modalMode | string | | dialog | 新增/编辑表单、详情 展示模式: dialog drawer |
|
|
81
|
+
| modalConf | Object | | {} | modal/Drawer 配置对象 |
|
|
82
|
+
| modalDetailProps | Object | | {} | modal descriptions 配置对象 |
|
|
83
|
+
| modalFormProps | Object | | {} | modal/drawer fromRender 配置对象 |
|
|
84
|
+
| modalProps | Object | | {} | modal/drawer 配置对象 |
|
|
85
|
+
| schemaScope | Object | | {} | formRender schemaScope props |
|
|
86
|
+
| components | Object | | {} | formRender components props 自定义组件 |
|
|
87
|
+
| detailComponents | Object | | {} | descriptions components props 自定义组件 |
|
|
88
|
+
| hasPagination | Boolean | | true | 是否显示分页 |
|
|
89
|
+
| paginationConf | Object | | {} | 可自定义 Pagination props,进行 pagination 相关设置 |
|
|
90
|
+
| formInitialValues | Object | | {} | 给新增、编辑对话框中的表单增加默认值 |
|
|
91
|
+
| Slots | Object | | {} | 组件插槽 |
|
|
92
|
+
| getFieldListOpt | Object | | {} | getFieldList opt 参数 |
|
|
93
|
+
| onGetListEnd | Function | | - | 请求列表成功返回的回调 |
|
|
94
|
+
| onCreateSuc | Function | | - | 新增成功返回的回调 |
|
|
95
|
+
| onEditSuc | Function | | - | 编辑成功返回的回调 |
|
|
96
|
+
| onDelSuc | Function | | - | 删除成功返回的回调 |
|
|
97
|
+
| onFormModalClose | Function | | - | 表单弹窗关闭回调 |
|
|
98
|
+
| modalFormMount | Function | | - | 新增、编辑弹窗 Form 渲染完成回调 |
|
|
99
|
+
| msgConf | Object | | {} | 新增、编辑、删除、列表查询,详情查询的报错 msg 提示设置 |
|
|
100
|
+
| i18n | Object | | {} | 文案配置 |
|
|
101
|
+
| queryFormInitialValues | Object | | {} | 列表上方查询 Form 默认值 |
|
|
102
|
+
| queryFormIsExtendModelQuery | Boolean | | false | 列表上方查询 Form 默认值是否继承 data-model.query 置 |
|
|
103
|
+
| useFormData | boolean | 否 | | 是否使用 form data 提交数据 |
|
|
104
|
+
| editMode | modal/line/line-cell/cell | 否 | modal | 编辑模式: modal 弹窗/抽屉编辑; line 编辑整行,编辑按钮在操作列; line-cell 编辑整行,操作按钮在单元格; cell 编辑指定单元格 |
|
|
105
|
+
| appendUrlQuery | boolean | 否 | true | 筛选条件改变时是否将参数(对象形式)设置到 url query 中 |
|
|
106
|
+
| appendUrlQueryKey | string | 否 | URL_PARAM_NAME = "defaultSearchParams" | 自定义设置 url query 对象参数的 key |
|
|
105
107
|
|
|
106
108
|
- fetchOnEdit 展示编辑弹框时,是否会调用一次详情接口进行回填(某些场景下,列表接口只返回部分部分字段,只有详情接口会返回全部字段);若为 false,则会使用表格列表接口返回的 row 数据进行回填
|
|
107
109
|
|
|
@@ -555,21 +557,23 @@ async function test() {
|
|
|
555
557
|
|
|
556
558
|
- example 本地开发测试代码
|
|
557
559
|
- src 组件源码
|
|
558
|
-
- lib 组件打包编译后的代码
|
|
559
560
|
|
|
560
561
|
## 命令
|
|
561
562
|
|
|
563
|
+
- Mac 执行该命令,设置 pre-commit 为可执行文件
|
|
564
|
+
|
|
565
|
+
- npm run mac-chmod
|
|
566
|
+
- chmod +x .husky && chmod +x .husky/pre-commit
|
|
567
|
+
|
|
568
|
+
- 生成文档:npm run docs
|
|
562
569
|
- 本地运行:npm run dev
|
|
563
|
-
- 测试环境打包编译:npm run build-flow-dev
|
|
564
|
-
- 生产环境打包编译:npm run build
|
|
565
570
|
|
|
566
571
|
## 发布
|
|
567
572
|
|
|
568
|
-
-
|
|
569
|
-
|
|
573
|
+
- npm 源和云效源都需要发布
|
|
574
|
+
|
|
570
575
|
- 命令:npm publish --access public
|
|
571
576
|
- 发布目录:
|
|
572
|
-
- lib
|
|
573
577
|
- src
|
|
574
578
|
|
|
575
579
|
### 迭代发布命令
|
|
@@ -578,10 +582,24 @@ async function test() {
|
|
|
578
582
|
- 0.x.0: npm run publish-minor
|
|
579
583
|
- x.0.0: npm run publish-major
|
|
580
584
|
|
|
585
|
+
### nrm
|
|
586
|
+
|
|
587
|
+
- 安装
|
|
588
|
+
npm install -g nrm
|
|
589
|
+
- 增加源
|
|
590
|
+
nrm add aliyun https://packages.aliyun.com/62046985b3ead41b374a17f7/npm/npm-registry/
|
|
591
|
+
- 切换源
|
|
592
|
+
nrm use aliyun
|
|
593
|
+
nrm use npm
|
|
594
|
+
- 登录(账号密码在 https://packages.aliyun.com/npm/npm-registry/guide 查看)
|
|
595
|
+
npm login --registry=https://packages.aliyun.com/62046985b3ead41b374a17f7/npm/npm-registry/
|
|
596
|
+
|
|
581
597
|
## 配置
|
|
582
598
|
|
|
583
599
|
### 配置文件
|
|
584
600
|
|
|
601
|
+
- 本地配置文件:config/config.js
|
|
602
|
+
|
|
585
603
|
### webpack 配置文件
|
|
586
604
|
|
|
587
605
|
- config/webpack.config.js
|
package/package.json
CHANGED