zy-react-library 2.2.0 → 2.2.1
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
CHANGED
|
@@ -37,7 +37,7 @@ import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
|
|
37
37
|
|
|
38
38
|
- 本文档根据当前包内 `.d.ts` 类型声明整理。
|
|
39
39
|
- 继承自 `antd`、`@ant-design/pro-components`、`ahooks` 的原生属性不逐项展开,文档会说明继承关系;库自身新增的参数逐项列出。
|
|
40
|
-
- `css` 仅做简要说明。
|
|
40
|
+
- `css` 仅做简要说明。
|
|
41
41
|
- 参数表中的 `-` 表示源码未设置显式默认值;`undefined` 表示源码显式传入或保留为 `undefined`。
|
|
42
42
|
|
|
43
43
|
## 基础样式
|
|
@@ -50,7 +50,7 @@ import "zy-react-library/css/common.less";
|
|
|
50
50
|
|
|
51
51
|
`common.less` 提供组件库通用样式,适合在应用入口统一引入。
|
|
52
52
|
|
|
53
|
-
## 枚举
|
|
53
|
+
## 枚举
|
|
54
54
|
|
|
55
55
|
### FORM_ITEM_RENDER_ENUM
|
|
56
56
|
|
|
@@ -80,7 +80,7 @@ import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
|
|
80
80
|
| `DATETIME` | `"datetime"` | `antd DatePicker` 日期时间 | `DatePickerProps` |
|
|
81
81
|
| `DATETIME_RANGE` | `"datetimeRange"` | `antd DatePicker.RangePicker` 日期时间范围 | `RangePickerProps` |
|
|
82
82
|
| `DIVIDER` | `"divider"` | `antd Divider` | `DividerProps` |
|
|
83
|
-
| `FORM_LIST` | `"formList"` | `antd Form.List` | `FormListProps` |
|
|
83
|
+
| `FORM_LIST` | `"formList"` | `antd Form.List` | `FormListProps` |
|
|
84
84
|
|
|
85
85
|
## 表单配置类型
|
|
86
86
|
|
|
@@ -213,22 +213,22 @@ import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
|
|
213
213
|
| `TooltipPreviewImg` | `files=[]`、`fileUrlKey="filePath"`。 |
|
|
214
214
|
| `SelectCreate` | `showDelete=true`、`label=""`、`maxCount=1`,内部固定 `mode="tags"`。 |
|
|
215
215
|
| `BasicSelect` | `placeholder=""`、`data=[]`、`nameKey="name"`、`idKey="id"`,内置 `showSearch=true`、`allowClear=true`、`optionFilterProp="children"`。 |
|
|
216
|
-
| `DictionarySelect` | `appKey="0bb989ecada5470c87635018ece9f327"`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
|
|
216
|
+
| `DictionarySelect` | `appKey="0bb989ecada5470c87635018ece9f327"`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
|
|
217
217
|
| `PersonnelSelect` | `params={}`、`placeholder="人员"`、`isNeedCorpInfoId=false`、`isNeedDepartmentId=true`、`isNeedPostId=false`、`extraParams={}`,内部默认额外参数 `{ noMain: "", eqEmploymentFlag: 1 }`。 |
|
|
218
218
|
| `BasicSelectTree` | `getNodePathsIsIncludeOneself=true`、`placeholder=""`、`treeData=[]`、`nameKey="name"`、`idKey="id"`、`childrenKey="children"`、`onlyLastLevel=false`,内置 `showSearch=true`、`allowClear=true`、`style={ width: "100%" }`。 |
|
|
219
219
|
| `AreaSelectTree` | 内部使用 `area.json`,默认 `nameKey="label"`、`idKey="value"`。 |
|
|
220
220
|
| `IndustrySelectTree` | 内部使用 `industry.json`,默认 `nameKey="dict_label"`、`idKey="dict_value"`、`childrenKey="childrenList"`。 |
|
|
221
221
|
| `DepartmentSelectTree` | `params={}`、`placeholder="部门"`、`isNeedCorpInfoId=false`、`isNeedParentId=false`、`searchType="current"`,内部固定 `childrenKey="childrenList"`。 |
|
|
222
|
-
| `DictionarySelectTree` | `appKey="0bb989ecada5470c87635018ece9f327"`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
|
|
222
|
+
| `DictionarySelectTree` | `appKey="0bb989ecada5470c87635018ece9f327"`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
|
|
223
223
|
| `HiddenLevelSelectTree` | `isShowNeglect=true`、`isShowLarger=true`、`isShowMajor=true`,内部固定 `placeholder="隐患级别"`、`onlyLastLevel=true`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
|
|
224
224
|
| `HiddenPartSelectTree` | `params={}`、`isNeedCorpInfoId=false`,内部固定 `placeholder="隐患部位"`、`nameKey="hiddenregion"`、`idKey="hiddenregionId"`。 |
|
|
225
225
|
| `BasicCascader` | `getNodePathsIsIncludeOneself=true`、`placeholder=""`、`data=[]`、`nameKey="name"`、`idKey="id"`、`childrenKey="children"`。 |
|
|
226
226
|
| `AreaCascader` | 内部使用 `area.json`,默认 `nameKey="label"`、`idKey="value"`。 |
|
|
227
227
|
| `IndustryCascader` | 内部使用 `industry.json`,默认 `nameKey="dict_label"`、`idKey="dict_value"`、`childrenKey="childrenList"`。 |
|
|
228
|
-
| `DictionaryCascader` | `appKey="0bb989ecada5470c87635018ece9f327"`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
|
|
228
|
+
| `DictionaryCascader` | `appKey="0bb989ecada5470c87635018ece9f327"`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
|
|
229
229
|
| `BasicLeftTree` | `getNodePathsIsIncludeOneself=true`、`treeData=[]`、`nameKey="name"`、`idKey="id"`、`childrenKey="children"`,搜索框固定宽度容器 `300`。 |
|
|
230
230
|
| `AreaLeftTree` | 内部使用 `area.json`,默认 `nameKey="label"`、`idKey="value"`。 |
|
|
231
|
-
| `DictionaryLeftTree` | `appKey="0bb989ecada5470c87635018ece9f327"`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
|
|
231
|
+
| `DictionaryLeftTree` | `appKey="0bb989ecada5470c87635018ece9f327"`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
|
|
232
232
|
| `DepartmentLeftTree` | `params={}`、`searchType="current"`,内部固定 `childrenKey="childrenList"`。 |
|
|
233
233
|
| `Map` | `longitudeProps="longitude"`、`latitudeProps="latitude"`、`required=true`、`area=""`、`showArea=false`、`disable=false`、`type="baidu"`。 |
|
|
234
234
|
| `MapSelector` | `area=""`、`showArea=false`、`disable=false`、`type="baidu"`;弹窗宽度 `1000`、`maskClosable=false`、地图容器高度 `500px`。 |
|
|
@@ -813,7 +813,7 @@ import DictionarySelect from "zy-react-library/components/Select/Dictionary";
|
|
|
813
813
|
|
|
814
814
|
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
815
815
|
| --- | --- | --- | --- | --- |
|
|
816
|
-
| `appKey` | `string` | 否 | `"0bb989ecada5470c87635018ece9f327"` | 字典应用 key。 |
|
|
816
|
+
| `appKey` | `string` | 否 | `"0bb989ecada5470c87635018ece9f327"` | 字典应用 key。 |
|
|
817
817
|
| `dictValue` | `string` | 是 | `""` | 字典类型值;为空会输出缺少参数错误。 |
|
|
818
818
|
| `nameKey` | `string` | 否 | `"dictLabel"` | 标签字段名。 |
|
|
819
819
|
| `idKey` | `string` | 否 | `"dictValue"` | 值字段名。 |
|
|
@@ -951,7 +951,7 @@ import DictionarySelectTree from "zy-react-library/components/SelectTree/Diction
|
|
|
951
951
|
|
|
952
952
|
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
953
953
|
| --- | --- | --- | --- | --- |
|
|
954
|
-
| `appKey` | `string` | 否 | `"0bb989ecada5470c87635018ece9f327"` | 字典应用 key。 |
|
|
954
|
+
| `appKey` | `string` | 否 | `"0bb989ecada5470c87635018ece9f327"` | 字典应用 key。 |
|
|
955
955
|
| `dictValue` | `string` | 是 | - | 字典类型值。 |
|
|
956
956
|
| `nameKey` | `string` | 否 | 节点标签字段名。 |
|
|
957
957
|
| `idKey` | `string` | 否 | 节点值字段名。 |
|
|
@@ -1099,7 +1099,7 @@ import DictionaryCascader from "zy-react-library/components/Cascader/Dictionary"
|
|
|
1099
1099
|
|
|
1100
1100
|
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
1101
1101
|
| --- | --- | --- | --- | --- |
|
|
1102
|
-
| `appKey` | `string` | 否 | `"0bb989ecada5470c87635018ece9f327"` | 字典应用 key。 |
|
|
1102
|
+
| `appKey` | `string` | 否 | `"0bb989ecada5470c87635018ece9f327"` | 字典应用 key。 |
|
|
1103
1103
|
| `dictValue` | `string` | 是 | - | 字典类型值。 |
|
|
1104
1104
|
| `nameKey` | `string` | 否 | 节点标签字段名。 |
|
|
1105
1105
|
| `idKey` | `string` | 否 | 节点值字段名。 |
|
|
@@ -1158,7 +1158,7 @@ import DictionaryLeftTree from "zy-react-library/components/LeftTree/Dictionary"
|
|
|
1158
1158
|
|
|
1159
1159
|
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
1160
1160
|
| --- | --- | --- | --- | --- |
|
|
1161
|
-
| `appKey` | `string` | 否 | `"0bb989ecada5470c87635018ece9f327"` | 字典应用 key。 |
|
|
1161
|
+
| `appKey` | `string` | 否 | `"0bb989ecada5470c87635018ece9f327"` | 字典应用 key。 |
|
|
1162
1162
|
| `dictValue` | `string` | 是 | `""` | 字典类型值;为空会输出缺少参数错误。 |
|
|
1163
1163
|
| `nameKey` | `string` | 否 | `"dictLabel"` | 节点标题字段名。 |
|
|
1164
1164
|
| `idKey` | `string` | 否 | `"dictValue"` | 节点 key 字段名。 |
|
|
@@ -1219,7 +1219,7 @@ import DepartmentLeftTree from "zy-react-library/components/LeftTree/Department/
|
|
|
1219
1219
|
| `useImportFile` | `returnType="object"`;执行导入时 `options.files=[]`、`options.params={}`。 |
|
|
1220
1220
|
| `useDownloadBlob` | `returnType="object"`;执行下载时 `options.name=""`、`options.type=""`、`options.params={}`,未传 `type` 时使用 `application/vnd.ms-excel`,未传 `name` 时使用当前时间 `YYYY-MM-DD HH:mm:ss`。 |
|
|
1221
1221
|
| `useDownloadFile` | `returnType="object"`;未传 `name` 时从 `url` 中截取文件名。 |
|
|
1222
|
-
| `useDictionary` | `returnType="object"`;执行获取时 `appKey="0bb989ecada5470c87635018ece9f327"`。 |
|
|
1222
|
+
| `useDictionary` | `returnType="object"`;执行获取时 `appKey="0bb989ecada5470c87635018ece9f327"`。 |
|
|
1223
1223
|
| `useGetUserInfo` | `returnType="object"`。 |
|
|
1224
1224
|
| `useIdle` | `timeout=10000`、`events=["mousemove","mousedown","resize","keydown","touchstart","wheel"]`。 |
|
|
1225
1225
|
| `useIsExistenceDuplicateSelection` | `message="存在重复项,请勿重复选择"`。 |
|
|
@@ -1465,7 +1465,7 @@ useDictionary("object"): { loading: boolean; getDictionary: getDictionaryFunctio
|
|
|
1465
1465
|
|
|
1466
1466
|
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
1467
1467
|
| --- | --- | --- | --- | --- |
|
|
1468
|
-
| `appKey` | `string` | 否 | `"0bb989ecada5470c87635018ece9f327"` | 字典应用 key。 |
|
|
1468
|
+
| `appKey` | `string` | 否 | `"0bb989ecada5470c87635018ece9f327"` | 字典应用 key。 |
|
|
1469
1469
|
| `dictValue` | `string` | 是 | - | 字典类型值。 |
|
|
1470
1470
|
|
|
1471
1471
|
返回 `Promise<DictionaryItem[]>`。
|
|
@@ -3,7 +3,7 @@ import type { ColProps } from "antd/es/col";
|
|
|
3
3
|
import type { FormItemProps, Rule } from "antd/es/form";
|
|
4
4
|
import type { FormListFieldData } from "antd/es/form/FormList";
|
|
5
5
|
import type { Gutter } from "antd/es/grid/row";
|
|
6
|
-
import type { CSSProperties, ReactElement, ReactNode } from "react";
|
|
6
|
+
import type { CSSProperties, Key, ReactElement, ReactNode } from "react";
|
|
7
7
|
import type { FORM_ITEM_RENDER_TYPE_MAP } from "../../enum/formItemRender";
|
|
8
8
|
import type { DeepPartial } from "./FormBuilder";
|
|
9
9
|
|
|
@@ -98,7 +98,7 @@ export interface FormOptionBase<
|
|
|
98
98
|
Dependencies = NamePath<Values>,
|
|
99
99
|
> {
|
|
100
100
|
/** React 需要的 key,如果传递了唯一的 name,则不需要 */
|
|
101
|
-
key?:
|
|
101
|
+
key?: Key;
|
|
102
102
|
/** 表单项字段名 */
|
|
103
103
|
name?: Name;
|
|
104
104
|
/** 表单项标签 */
|
|
@@ -1,11 +1,33 @@
|
|
|
1
|
-
import type { ProTableProps } from "@ant-design/pro-
|
|
2
|
-
import type { TableProps as AntdTableProps } from "antd";
|
|
1
|
+
import type { ProColumns, ProTableProps } from "@ant-design/pro-components";
|
|
2
|
+
import type { TableProps as AntdTableProps, TableColumnType } from "antd";
|
|
3
3
|
import type { FC } from "react";
|
|
4
4
|
|
|
5
|
+
/** 保留 Ant Design 推导的嵌套元组路径,移除宽泛字符串和普通数组 */
|
|
6
|
+
type StrictTableDataIndex<DataIndex> = DataIndex extends string
|
|
7
|
+
? never
|
|
8
|
+
: DataIndex extends readonly unknown[]
|
|
9
|
+
? number extends DataIndex["length"] ? never : DataIndex
|
|
10
|
+
: DataIndex extends number ? DataIndex : never;
|
|
11
|
+
|
|
12
|
+
/** 表格字段索引,支持一级字段和嵌套字段路径提示 */
|
|
13
|
+
export type TableDataIndex<DataSource>
|
|
14
|
+
= | Extract<keyof DataSource, string | number>
|
|
15
|
+
| StrictTableDataIndex<NonNullable<TableColumnType<DataSource>["dataIndex"]>>;
|
|
16
|
+
|
|
17
|
+
/** 表格列配置 */
|
|
18
|
+
export type TableColumn<DataSource, ValueType = "text"> = Omit<ProColumns<DataSource, ValueType>, "children" | "dataIndex"> & {
|
|
19
|
+
/** 当前列对应的数据字段 */
|
|
20
|
+
dataIndex?: TableDataIndex<DataSource>;
|
|
21
|
+
/** 多级表头子列 */
|
|
22
|
+
children?: TableColumn<DataSource, ValueType>[];
|
|
23
|
+
};
|
|
24
|
+
|
|
5
25
|
/**
|
|
6
|
-
*
|
|
26
|
+
* Table 组件属性
|
|
7
27
|
*/
|
|
8
|
-
export type TableProps<DataSource, U, ValueType> = Omit<AntdTableProps
|
|
28
|
+
export type TableProps<DataSource, U = Record<string, unknown>, ValueType = "text"> = Omit<AntdTableProps<DataSource>, "columns"> & Omit<ProTableProps<DataSource, U, ValueType>, "columns"> & {
|
|
29
|
+
/** 表格列配置 */
|
|
30
|
+
columns: TableColumn<DataSource, ValueType>[];
|
|
9
31
|
/** 当一个路由下存在多个表格的情况下 需要给每一个表格设置一个唯一存储索引 若没有设置则使用默认索引,请注意缓存数据会被覆盖 */
|
|
10
32
|
storeIndex?: string;
|
|
11
33
|
/** 是否禁用内容区滚动,默认 false */
|
|
@@ -25,5 +47,5 @@ export type TableProps<DataSource, U, ValueType> = Omit<AntdTableProps, "columns
|
|
|
25
47
|
/**
|
|
26
48
|
* 表格组件
|
|
27
49
|
*/
|
|
28
|
-
declare const Table: <DataSource, U, ValueType = "text">(props: TableProps<DataSource, U, ValueType>) => ReturnType<FC>;
|
|
50
|
+
declare const Table: <DataSource, U = Record<string, unknown>, ValueType = "text">(props: TableProps<DataSource, U, ValueType>) => ReturnType<FC>;
|
|
29
51
|
export default Table;
|