zy-react-library 2.1.11 → 2.2.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 +13 -32
- package/components/Cascader/Area/index.d.ts +25 -0
- package/components/Cascader/Area/index.js +1 -0
- package/components/Cascader/Basic/index.d.ts +31 -0
- package/components/Cascader/Basic/index.js +1 -0
- package/components/Cascader/Dictionary/index.d.ts +34 -0
- package/components/Cascader/Dictionary/index.js +1 -0
- package/components/Cascader/Industry/index.d.ts +25 -0
- package/components/Cascader/Industry/index.js +1 -0
- package/components/Editor/index.d.ts +29 -0
- package/components/Editor/index.js +1 -0
- package/components/Excel/index.d.ts +22 -0
- package/components/Excel/index.js +1 -0
- package/components/FormBuilder/FormBuilder.d.ts +66 -0
- package/components/FormBuilder/FormBuilder.js +1 -0
- package/components/FormBuilder/FormItemsRenderer.d.ts +286 -0
- package/components/FormBuilder/FormItemsRenderer.js +1 -0
- package/components/FormBuilder/index.d.ts +7 -0
- package/components/FormBuilder/index.js +1 -0
- package/components/HeaderBack/index.d.ts +18 -0
- package/components/HeaderBack/index.js +1 -0
- package/components/HeaderBack/index.less +26 -0
- package/components/HiddenInfo/gwj/index.d.ts +26 -0
- package/components/HiddenInfo/gwj/index.js +1 -0
- package/components/Icon/AddIcon/index.d.ts +6 -0
- package/components/Icon/AddIcon/index.js +1 -0
- package/components/Icon/BackIcon/index.d.ts +6 -0
- package/components/Icon/BackIcon/index.js +1 -0
- package/components/Icon/DeleteIcon/index.d.ts +6 -0
- package/components/Icon/DeleteIcon/index.js +1 -0
- package/components/Icon/DownloadIcon/index.d.ts +6 -0
- package/components/Icon/DownloadIcon/index.js +1 -0
- package/components/Icon/EditIcon/index.d.ts +6 -0
- package/components/Icon/EditIcon/index.js +1 -0
- package/components/Icon/ExportIcon/index.d.ts +6 -0
- package/components/Icon/ExportIcon/index.js +1 -0
- package/components/Icon/ImportIcon/index.d.ts +6 -0
- package/components/Icon/ImportIcon/index.js +1 -0
- package/components/Icon/LocationIcon/index.d.ts +6 -0
- package/components/Icon/LocationIcon/index.js +1 -0
- package/components/Icon/PrintIcon/index.d.ts +6 -0
- package/components/Icon/PrintIcon/index.js +1 -0
- package/components/Icon/ResetIcon/index.d.ts +6 -0
- package/components/Icon/ResetIcon/index.js +1 -0
- package/components/Icon/SearchIcon/index.d.ts +6 -0
- package/components/Icon/SearchIcon/index.js +1 -0
- package/components/Icon/VideoIcon/index.d.ts +6 -0
- package/components/Icon/VideoIcon/index.js +1 -0
- package/components/Icon/ViewIcon/index.d.ts +6 -0
- package/components/Icon/ViewIcon/index.js +1 -0
- package/components/ImportFile/index.d.ts +29 -0
- package/components/ImportFile/index.js +1 -0
- package/components/LeftTree/Area/index.d.ts +26 -0
- package/components/LeftTree/Area/index.js +1 -0
- package/components/LeftTree/Basic/index.d.ts +27 -0
- package/components/LeftTree/Basic/index.js +1 -0
- package/components/LeftTree/Department/Gwj/index.d.ts +31 -0
- package/components/LeftTree/Department/Gwj/index.js +1 -0
- package/components/LeftTree/Dictionary/index.d.ts +34 -0
- package/components/LeftTree/Dictionary/index.js +1 -0
- package/components/Map/CesiumMap.js +1 -0
- package/components/Map/MapSelector.d.ts +29 -0
- package/components/Map/MapSelector.js +1 -0
- package/components/Map/h.png +0 -0
- package/components/Map/index.d.ts +27 -0
- package/components/Map/index.js +1 -0
- package/components/Map/index.less +5 -0
- package/components/Page/index.d.ts +36 -0
- package/components/Page/index.js +1 -0
- package/components/Pdf/index.d.ts +22 -0
- package/components/Pdf/index.js +1 -0
- package/components/Pdf/index.less +3 -0
- package/components/PreviewExcel/index.d.ts +18 -0
- package/components/PreviewExcel/index.js +1 -0
- package/components/PreviewImg/index.d.ts +12 -0
- package/components/PreviewImg/index.js +1 -0
- package/components/PreviewPdf/index.d.ts +18 -0
- package/components/PreviewPdf/index.js +1 -0
- package/components/PreviewWord/index.d.ts +18 -0
- package/components/PreviewWord/index.js +1 -0
- package/components/SeamlessScroll/index.d.ts +51 -0
- package/components/SeamlessScroll/index.js +1 -0
- package/components/Search/index.d.ts +49 -0
- package/components/Search/index.js +1 -0
- package/components/Select/Basic/index.d.ts +35 -0
- package/components/Select/Basic/index.js +1 -0
- package/components/Select/Dictionary/index.d.ts +33 -0
- package/components/Select/Dictionary/index.js +1 -0
- package/components/Select/Personnel/Gwj/index.d.ts +72 -0
- package/components/Select/Personnel/Gwj/index.js +1 -0
- package/components/SelectCreate/index.d.ts +29 -0
- package/components/SelectCreate/index.js +1 -0
- package/components/SelectTree/Area/index.d.ts +25 -0
- package/components/SelectTree/Area/index.js +1 -0
- package/components/SelectTree/Basic/index.d.ts +35 -0
- package/components/SelectTree/Basic/index.js +1 -0
- package/components/SelectTree/Department/Gwj/index.d.ts +61 -0
- package/components/SelectTree/Department/Gwj/index.js +1 -0
- package/components/SelectTree/Dictionary/index.d.ts +34 -0
- package/components/SelectTree/Dictionary/index.js +1 -0
- package/components/SelectTree/HiddenLevel/Gwj/index.d.ts +32 -0
- package/components/SelectTree/HiddenLevel/Gwj/index.js +1 -0
- package/components/SelectTree/HiddenPart/Gwj/index.d.ts +38 -0
- package/components/SelectTree/HiddenPart/Gwj/index.js +1 -0
- package/components/SelectTree/Industry/index.d.ts +25 -0
- package/components/SelectTree/Industry/index.js +1 -0
- package/components/Signature/index.d.ts +28 -0
- package/components/Signature/index.js +1 -0
- package/components/Table/index.d.ts +29 -0
- package/components/Table/index.js +1 -0
- package/components/Table/index.less +14 -0
- package/components/TooltipPreviewImg/index.d.ts +6 -0
- package/components/TooltipPreviewImg/index.js +1 -0
- package/components/Upload/index.d.ts +32 -0
- package/components/Upload/index.js +1 -0
- package/components/Video/AliPlayer.d.ts +45 -0
- package/components/Video/AliPlayer.js +1 -0
- package/components/Video/index.d.ts +20 -0
- package/components/Video/index.js +1 -0
- package/components/Word/index.d.ts +22 -0
- package/components/Word/index.js +1 -0
- package/css/common.less +35 -0
- package/enum/formItemRender/index.d.ts +68 -0
- package/enum/formItemRender/index.js +1 -0
- package/hooks/useDeleteFile/index.d.ts +22 -0
- package/hooks/useDeleteFile/index.js +1 -0
- package/hooks/useDictionary/index.d.ts +24 -0
- package/hooks/useDictionary/index.js +1 -0
- package/hooks/useDownloadBlob/index.d.ts +16 -0
- package/hooks/useDownloadBlob/index.js +1 -0
- package/hooks/useDownloadFile/index.d.ts +14 -0
- package/hooks/useDownloadFile/index.js +1 -0
- package/hooks/useGetFile/index.d.ts +49 -0
- package/hooks/useGetFile/index.js +1 -0
- package/hooks/useGetUrlQuery/index.d.ts +4 -0
- package/hooks/useGetUrlQuery/index.js +1 -0
- package/hooks/useGetUserInfo/index.d.ts +21 -0
- package/hooks/useGetUserInfo/index.js +1 -0
- package/hooks/useIdle/index.d.ts +11 -0
- package/hooks/useIdle/index.js +1 -0
- package/hooks/useImportFile/index.d.ts +16 -0
- package/hooks/useImportFile/index.js +1 -0
- package/hooks/useIsExistenceDuplicateSelection/index.d.ts +22 -0
- package/hooks/useIsExistenceDuplicateSelection/index.js +1 -0
- package/hooks/useTable/index.d.ts +75 -0
- package/hooks/useTable/index.js +1 -0
- package/hooks/useUploadFile/index.d.ts +67 -0
- package/hooks/useUploadFile/index.js +1 -0
- package/hooks/useUrlQueryCriteria/index.d.ts +8 -0
- package/hooks/useUrlQueryCriteria/index.js +1 -0
- package/package.json +8 -6
- package/regular/index.d.ts +59 -0
- package/regular/index.js +1 -0
- package/utils/index.d.ts +395 -0
- package/utils/index.js +1 -0
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,15 +50,7 @@ import "zy-react-library/css/common.less";
|
|
|
50
50
|
|
|
51
51
|
`common.less` 提供组件库通用样式,适合在应用入口统一引入。
|
|
52
52
|
|
|
53
|
-
##
|
|
54
|
-
|
|
55
|
-
| 文件 | 引入路径 | 简要说明 |
|
|
56
|
-
| --- | --- | --- |
|
|
57
|
-
| `area.json` | `zy-react-library/json/area.json` | 行政区域树形数据,供地区级联、地区树选择使用。 |
|
|
58
|
-
| `industry.json` | `zy-react-library/json/industry.json` | 行业分类树形数据,供行业级联、行业树选择使用。 |
|
|
59
|
-
| `nation.json` | `zy-react-library/json/nation.json` | 民族数据列表。 |
|
|
60
|
-
|
|
61
|
-
## 枚举
|
|
53
|
+
## 枚举
|
|
62
54
|
|
|
63
55
|
### FORM_ITEM_RENDER_ENUM
|
|
64
56
|
|
|
@@ -88,18 +80,7 @@ import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
|
|
88
80
|
| `DATETIME` | `"datetime"` | `antd DatePicker` 日期时间 | `DatePickerProps` |
|
|
89
81
|
| `DATETIME_RANGE` | `"datetimeRange"` | `antd DatePicker.RangePicker` 日期时间范围 | `RangePickerProps` |
|
|
90
82
|
| `DIVIDER` | `"divider"` | `antd Divider` | `DividerProps` |
|
|
91
|
-
| `FORM_LIST` | `"formList"` | `antd Form.List` | `FormListProps` |
|
|
92
|
-
|
|
93
|
-
### 其他枚举
|
|
94
|
-
|
|
95
|
-
| 枚举 | 引入路径 | 简要说明 |
|
|
96
|
-
| --- |------------------------------------| --- |
|
|
97
|
-
| `DICTIONARY_APP_KEY_ENUM` | `zy-react-library/enum/dictionary` | 字典接口使用的 `appKey` 常量,包含 `DEFAULT`、`GWJ`。 |
|
|
98
|
-
| `HIDDEN_SOURCE_ENUM` | `zy-react-library/enum/hidden/gwj` | 隐患来源选项列表。 |
|
|
99
|
-
| `HIDDEN_STATE_ENUM` | `zy-react-library/enum/hidden/gwj` | 隐患状态选项列表。 |
|
|
100
|
-
| `HIDDEN_RECTIFICATION_TYPE_ENUM` | `zy-react-library/enum/hidden/gwj` | 隐患整改类型选项列表。 |
|
|
101
|
-
| `UPLOAD_FILE_TYPE_ENUM` | `zy-react-library/enum/uploadFile` | 文件上传类型编码枚举。 |
|
|
102
|
-
| `UPLOAD_FILE_PATH_ENUM` | `zy-react-library/enum/uploadFile` | 文件上传类型编码到服务端路径标识的映射。 |
|
|
83
|
+
| `FORM_LIST` | `"formList"` | `antd Form.List` | `FormListProps` |
|
|
103
84
|
|
|
104
85
|
## 表单配置类型
|
|
105
86
|
|
|
@@ -232,22 +213,22 @@ import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
|
|
232
213
|
| `TooltipPreviewImg` | `files=[]`、`fileUrlKey="filePath"`。 |
|
|
233
214
|
| `SelectCreate` | `showDelete=true`、`label=""`、`maxCount=1`,内部固定 `mode="tags"`。 |
|
|
234
215
|
| `BasicSelect` | `placeholder=""`、`data=[]`、`nameKey="name"`、`idKey="id"`,内置 `showSearch=true`、`allowClear=true`、`optionFilterProp="children"`。 |
|
|
235
|
-
| `DictionarySelect` | `appKey=
|
|
216
|
+
| `DictionarySelect` | `appKey="0bb989ecada5470c87635018ece9f327"`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
|
|
236
217
|
| `PersonnelSelect` | `params={}`、`placeholder="人员"`、`isNeedCorpInfoId=false`、`isNeedDepartmentId=true`、`isNeedPostId=false`、`extraParams={}`,内部默认额外参数 `{ noMain: "", eqEmploymentFlag: 1 }`。 |
|
|
237
218
|
| `BasicSelectTree` | `getNodePathsIsIncludeOneself=true`、`placeholder=""`、`treeData=[]`、`nameKey="name"`、`idKey="id"`、`childrenKey="children"`、`onlyLastLevel=false`,内置 `showSearch=true`、`allowClear=true`、`style={ width: "100%" }`。 |
|
|
238
219
|
| `AreaSelectTree` | 内部使用 `area.json`,默认 `nameKey="label"`、`idKey="value"`。 |
|
|
239
220
|
| `IndustrySelectTree` | 内部使用 `industry.json`,默认 `nameKey="dict_label"`、`idKey="dict_value"`、`childrenKey="childrenList"`。 |
|
|
240
221
|
| `DepartmentSelectTree` | `params={}`、`placeholder="部门"`、`isNeedCorpInfoId=false`、`isNeedParentId=false`、`searchType="current"`,内部固定 `childrenKey="childrenList"`。 |
|
|
241
|
-
| `DictionarySelectTree` | `appKey=
|
|
222
|
+
| `DictionarySelectTree` | `appKey="0bb989ecada5470c87635018ece9f327"`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
|
|
242
223
|
| `HiddenLevelSelectTree` | `isShowNeglect=true`、`isShowLarger=true`、`isShowMajor=true`,内部固定 `placeholder="隐患级别"`、`onlyLastLevel=true`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
|
|
243
224
|
| `HiddenPartSelectTree` | `params={}`、`isNeedCorpInfoId=false`,内部固定 `placeholder="隐患部位"`、`nameKey="hiddenregion"`、`idKey="hiddenregionId"`。 |
|
|
244
225
|
| `BasicCascader` | `getNodePathsIsIncludeOneself=true`、`placeholder=""`、`data=[]`、`nameKey="name"`、`idKey="id"`、`childrenKey="children"`。 |
|
|
245
226
|
| `AreaCascader` | 内部使用 `area.json`,默认 `nameKey="label"`、`idKey="value"`。 |
|
|
246
227
|
| `IndustryCascader` | 内部使用 `industry.json`,默认 `nameKey="dict_label"`、`idKey="dict_value"`、`childrenKey="childrenList"`。 |
|
|
247
|
-
| `DictionaryCascader` | `appKey=
|
|
228
|
+
| `DictionaryCascader` | `appKey="0bb989ecada5470c87635018ece9f327"`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
|
|
248
229
|
| `BasicLeftTree` | `getNodePathsIsIncludeOneself=true`、`treeData=[]`、`nameKey="name"`、`idKey="id"`、`childrenKey="children"`,搜索框固定宽度容器 `300`。 |
|
|
249
230
|
| `AreaLeftTree` | 内部使用 `area.json`,默认 `nameKey="label"`、`idKey="value"`。 |
|
|
250
|
-
| `DictionaryLeftTree` | `appKey=
|
|
231
|
+
| `DictionaryLeftTree` | `appKey="0bb989ecada5470c87635018ece9f327"`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
|
|
251
232
|
| `DepartmentLeftTree` | `params={}`、`searchType="current"`,内部固定 `childrenKey="childrenList"`。 |
|
|
252
233
|
| `Map` | `longitudeProps="longitude"`、`latitudeProps="latitude"`、`required=true`、`area=""`、`showArea=false`、`disable=false`、`type="baidu"`。 |
|
|
253
234
|
| `MapSelector` | `area=""`、`showArea=false`、`disable=false`、`type="baidu"`;弹窗宽度 `1000`、`maskClosable=false`、地图容器高度 `500px`。 |
|
|
@@ -832,7 +813,7 @@ import DictionarySelect from "zy-react-library/components/Select/Dictionary";
|
|
|
832
813
|
|
|
833
814
|
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
834
815
|
| --- | --- | --- | --- | --- |
|
|
835
|
-
| `appKey` | `string` | 否 | `
|
|
816
|
+
| `appKey` | `string` | 否 | `"0bb989ecada5470c87635018ece9f327"` | 字典应用 key。 |
|
|
836
817
|
| `dictValue` | `string` | 是 | `""` | 字典类型值;为空会输出缺少参数错误。 |
|
|
837
818
|
| `nameKey` | `string` | 否 | `"dictLabel"` | 标签字段名。 |
|
|
838
819
|
| `idKey` | `string` | 否 | `"dictValue"` | 值字段名。 |
|
|
@@ -970,7 +951,7 @@ import DictionarySelectTree from "zy-react-library/components/SelectTree/Diction
|
|
|
970
951
|
|
|
971
952
|
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
972
953
|
| --- | --- | --- | --- | --- |
|
|
973
|
-
| `appKey` | `string` | 否 | `
|
|
954
|
+
| `appKey` | `string` | 否 | `"0bb989ecada5470c87635018ece9f327"` | 字典应用 key。 |
|
|
974
955
|
| `dictValue` | `string` | 是 | - | 字典类型值。 |
|
|
975
956
|
| `nameKey` | `string` | 否 | 节点标签字段名。 |
|
|
976
957
|
| `idKey` | `string` | 否 | 节点值字段名。 |
|
|
@@ -1118,7 +1099,7 @@ import DictionaryCascader from "zy-react-library/components/Cascader/Dictionary"
|
|
|
1118
1099
|
|
|
1119
1100
|
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
1120
1101
|
| --- | --- | --- | --- | --- |
|
|
1121
|
-
| `appKey` | `string` | 否 | `
|
|
1102
|
+
| `appKey` | `string` | 否 | `"0bb989ecada5470c87635018ece9f327"` | 字典应用 key。 |
|
|
1122
1103
|
| `dictValue` | `string` | 是 | - | 字典类型值。 |
|
|
1123
1104
|
| `nameKey` | `string` | 否 | 节点标签字段名。 |
|
|
1124
1105
|
| `idKey` | `string` | 否 | 节点值字段名。 |
|
|
@@ -1177,7 +1158,7 @@ import DictionaryLeftTree from "zy-react-library/components/LeftTree/Dictionary"
|
|
|
1177
1158
|
|
|
1178
1159
|
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
1179
1160
|
| --- | --- | --- | --- | --- |
|
|
1180
|
-
| `appKey` | `string` | 否 | `
|
|
1161
|
+
| `appKey` | `string` | 否 | `"0bb989ecada5470c87635018ece9f327"` | 字典应用 key。 |
|
|
1181
1162
|
| `dictValue` | `string` | 是 | `""` | 字典类型值;为空会输出缺少参数错误。 |
|
|
1182
1163
|
| `nameKey` | `string` | 否 | `"dictLabel"` | 节点标题字段名。 |
|
|
1183
1164
|
| `idKey` | `string` | 否 | `"dictValue"` | 节点 key 字段名。 |
|
|
@@ -1238,7 +1219,7 @@ import DepartmentLeftTree from "zy-react-library/components/LeftTree/Department/
|
|
|
1238
1219
|
| `useImportFile` | `returnType="object"`;执行导入时 `options.files=[]`、`options.params={}`。 |
|
|
1239
1220
|
| `useDownloadBlob` | `returnType="object"`;执行下载时 `options.name=""`、`options.type=""`、`options.params={}`,未传 `type` 时使用 `application/vnd.ms-excel`,未传 `name` 时使用当前时间 `YYYY-MM-DD HH:mm:ss`。 |
|
|
1240
1221
|
| `useDownloadFile` | `returnType="object"`;未传 `name` 时从 `url` 中截取文件名。 |
|
|
1241
|
-
| `useDictionary` | `returnType="object"`;执行获取时 `appKey=
|
|
1222
|
+
| `useDictionary` | `returnType="object"`;执行获取时 `appKey="0bb989ecada5470c87635018ece9f327"`。 |
|
|
1242
1223
|
| `useGetUserInfo` | `returnType="object"`。 |
|
|
1243
1224
|
| `useIdle` | `timeout=10000`、`events=["mousemove","mousedown","resize","keydown","touchstart","wheel"]`。 |
|
|
1244
1225
|
| `useIsExistenceDuplicateSelection` | `message="存在重复项,请勿重复选择"`。 |
|
|
@@ -1484,7 +1465,7 @@ useDictionary("object"): { loading: boolean; getDictionary: getDictionaryFunctio
|
|
|
1484
1465
|
|
|
1485
1466
|
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
1486
1467
|
| --- | --- | --- | --- | --- |
|
|
1487
|
-
| `appKey` | `string` | 否 | `
|
|
1468
|
+
| `appKey` | `string` | 否 | `"0bb989ecada5470c87635018ece9f327"` | 字典应用 key。 |
|
|
1488
1469
|
| `dictValue` | `string` | 是 | - | 字典类型值。 |
|
|
1489
1470
|
|
|
1490
1471
|
返回 `Promise<DictionaryItem[]>`。
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { BasicCascaderProps } from "../Basic";
|
|
3
|
+
|
|
4
|
+
export interface AreaCascaderItem {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
children: AreaCascaderItem[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 组件属性
|
|
12
|
+
*/
|
|
13
|
+
export interface AreaCascaderProps extends Omit<BasicCascaderProps, "options" | "placeholder" | "nameKey" | "idKey" | "childrenKey" | "onGetNodePaths" | "onGetData"> {
|
|
14
|
+
/** 获取父级节点 */
|
|
15
|
+
onGetNodePaths?: (nodes: AreaCascaderItem[]) => void;
|
|
16
|
+
/** 获取数据 */
|
|
17
|
+
onGetData?: (data: AreaCascaderItem[], processedData: AreaCascaderItem[]) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 属地级联组件
|
|
22
|
+
*/
|
|
23
|
+
declare const AreaCascader: FC<AreaCascaderProps>;
|
|
24
|
+
|
|
25
|
+
export default AreaCascader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import a from"zy-react-data/json/area.json";import e from"../Basic/index.js";import{jsx as r}from"react/jsx-runtime";function t(t){const{...o}=t;return r(e,{data:a,nameKey:"label",idKey:"value",...o})}t.displayName="AreaCascader";export{t as default};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CascaderProps } from "antd/es/cascader";
|
|
2
|
+
import type { FC } from "react";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 组件属性
|
|
6
|
+
*/
|
|
7
|
+
export interface BasicCascaderProps extends Omit<CascaderProps, "fieldNames"> {
|
|
8
|
+
/** 树形数据 label 字段,默认 name */
|
|
9
|
+
nameKey?: string;
|
|
10
|
+
/** 树形数据 value 字段,默认 id */
|
|
11
|
+
idKey?: string;
|
|
12
|
+
/** 树形数据 children 字段,默认 children */
|
|
13
|
+
childrenKey?: string;
|
|
14
|
+
/** 决定 onGetNodePaths 是否包含自身节点,默认 true */
|
|
15
|
+
getNodePathsIsIncludeOneself?: boolean;
|
|
16
|
+
/** 获取父级节点 */
|
|
17
|
+
onGetNodePaths?: (nodes: Record<string, any>[]) => void;
|
|
18
|
+
/** 占位符 */
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
/** 控制只能选择到第几级 */
|
|
21
|
+
level?: number;
|
|
22
|
+
/** 获取数据 */
|
|
23
|
+
onGetData?: (data: Record<string, any>[], processedData: Record<string, any>[]) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 基础级联组件
|
|
28
|
+
*/
|
|
29
|
+
declare const BasicCascader: FC<BasicCascaderProps>;
|
|
30
|
+
|
|
31
|
+
export default BasicCascader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Cascader as e}from"antd";import{useMemo as a,useEffect as t}from"react";import{processTreeDataByLevel as n}from"../../../utils/index.js";import{jsx as r}from"react/jsx-runtime";function l(l){const{onGetData:o,onChange:i,onGetNodePaths:d,getNodePathsIsIncludeOneself:c=!0,placeholder:s="",data:m=[],nameKey:h="name",idKey:f="id",childrenKey:p="children",level:u,...y}=l,v=a(()=>u?n({data:m,level:u,childrenKey:p,currentLevel:1}):m,[m,u,p]);return t(()=>{o?.(m,v)},[m,v]),r(e,{options:v,placeholder:`请选择${s}`,onChange:(e,a)=>{if(a&&d){const e=(e=>{let a=e;return!c&&e&&(a=e.slice(0,-1)),a||[]})(a);d?.(e)}i?.(e,a)},onClear:()=>{d?.([])},fieldNames:{label:h,value:f,children:p},...y})}l.displayName="BasicCascader";export{l as default};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { BasicCascaderProps } from "../Basic";
|
|
3
|
+
|
|
4
|
+
export interface DictionaryCascaderItem {
|
|
5
|
+
dictValue: string;
|
|
6
|
+
dictLabel: string;
|
|
7
|
+
children: DictionaryCascaderItem[];
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 组件属性
|
|
13
|
+
*/
|
|
14
|
+
export interface DictionaryCascaderProps extends Omit<BasicCascaderProps, "options" | "nameKey" | "idKey" | "childrenKey" | "onGetNodePaths" | "onGetData"> {
|
|
15
|
+
/** appKey,默认 DICTIONARY_APP_KEY_ENUM.DEFAULT(0bb989ecada5470c87635018ece9f327) */
|
|
16
|
+
appKey?: string;
|
|
17
|
+
/** 要获取的字典 */
|
|
18
|
+
dictValue: string;
|
|
19
|
+
/** 树形数据 label 字段,默认 dictLabel */
|
|
20
|
+
nameKey?: string;
|
|
21
|
+
/** 树形数据 value 字段,默认 dictValue */
|
|
22
|
+
idKey?: string;
|
|
23
|
+
/** 获取父级节点 */
|
|
24
|
+
onGetNodePaths?: (nodes: DictionaryCascaderItem[]) => void;
|
|
25
|
+
/** 获取数据 */
|
|
26
|
+
onGetData?: (data: DictionaryCascaderItem[], processedData: DictionaryCascaderItem[]) => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 数据字典级联组件
|
|
31
|
+
*/
|
|
32
|
+
declare const DictionaryCascader: FC<DictionaryCascaderProps>;
|
|
33
|
+
|
|
34
|
+
export default DictionaryCascader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{request as a}from"@cqsjjb/jjb-common-lib/http.js";import{useState as e,useEffect as t}from"react";import{DICTIONARY_APP_KEY_ENUM as i}from"zy-react-data/enum/dictionary";import{executeWithCache as r}from"../../../utils/index.js";import c from"../Basic/index.js";import{jsx as o}from"react/jsx-runtime";function n(n){const{appKey:d=i.DEFAULT,dictValue:s="",nameKey:m="dictLabel",idKey:p="dictValue",...y}=n,[u,l]=e([]);return t(()=>{(async()=>{if(!Object.values(i).includes(d))return void console.error(`【DictionaryCascader】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${d}`);if(!s)return void console.error("【DictionaryCascader】 缺少 dictValue 参数");const e={appKey:d,dictValue:s};await r(e,async()=>{const{data:e}=await a("/config/dict-trees/list/by/dictValues","get",{appKey:d,dictValue:s});return e},l)})()},[s]),o(c,{data:u,nameKey:m,idKey:p,...y})}n.displayName="DictionaryCascader";export{n as default};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { BasicCascaderProps } from "../Basic";
|
|
3
|
+
|
|
4
|
+
export interface IndustryCascaderItem {
|
|
5
|
+
dict_value: string;
|
|
6
|
+
dict_label: string;
|
|
7
|
+
childrenList: IndustryCascaderItem[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 组件属性
|
|
12
|
+
*/
|
|
13
|
+
export interface IndustryCascaderProps extends Omit<BasicCascaderProps, "options" | "placeholder" | "nameKey" | "idKey" | "childrenKey" | "onGetNodePaths" | "onGetData"> {
|
|
14
|
+
/** 获取父级节点 */
|
|
15
|
+
onGetNodePaths?: (nodes: IndustryCascaderItem[]) => void;
|
|
16
|
+
/** 获取数据 */
|
|
17
|
+
onGetData?: (data: IndustryCascaderItem[], processedData: IndustryCascaderItem[]) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 行业类型级联组件
|
|
22
|
+
*/
|
|
23
|
+
declare const IndustryCascader: FC<IndustryCascaderProps>;
|
|
24
|
+
|
|
25
|
+
export default IndustryCascader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"zy-react-data/json/industry.json";import e from"../Basic/index.js";import{jsx as r}from"react/jsx-runtime";function a(a){const{...i}=a;return r(e,{data:t,nameKey:"dict_label",idKey:"dict_value",childrenKey:"childrenList",...i})}a.displayName="IndustryCascader";export{a as default};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IDomEditor } from "@wangeditor/editor";
|
|
2
|
+
import type { ForwardRefExoticComponent, RefAttributes } from "react";
|
|
3
|
+
|
|
4
|
+
export interface EditorProps {
|
|
5
|
+
/** 编辑器内容值 */
|
|
6
|
+
value?: string;
|
|
7
|
+
/** 内容改变回调 */
|
|
8
|
+
onChange?: (html: string) => void;
|
|
9
|
+
/** 是否禁用 */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface EditorRef {
|
|
14
|
+
/** 获取编辑器实例 */
|
|
15
|
+
getEditorInstance: () => IDomEditor | null;
|
|
16
|
+
/** 获取HTML内容 */
|
|
17
|
+
getHtml: () => string | undefined;
|
|
18
|
+
/** 设置HTML内容 */
|
|
19
|
+
setHtml: (value: string) => void;
|
|
20
|
+
/** 获取文本内容 */
|
|
21
|
+
getText: () => string | undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 富文本编辑器组件
|
|
26
|
+
*/
|
|
27
|
+
declare const Editor: ForwardRefExoticComponent<EditorProps & RefAttributes<EditorRef>>;
|
|
28
|
+
|
|
29
|
+
export default Editor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Toolbar as e,Editor as t}from"@wangeditor/editor-for-react";import{forwardRef as o,useState as r,useEffect as l,useImperativeHandle as d}from"react";import{normalizeEmptyHtml as i}from"../../utils/index.js";import"@wangeditor/editor/dist/css/style.css";import{jsx as s,Fragment as a,jsxs as n}from"react/jsx-runtime";const m=o(({value:o,onChange:m,disabled:c},g)=>{const[u,f]=r(null),[p,x]=r("");return l(()=>{x(o)},[o]),l(()=>{u&&(c?u.disable():u.enable())},[c]),l(()=>()=>{u&&(u.destroy(),f(null))},[u]),d(g,()=>({getEditorInstance:()=>u,getHtml:()=>u&&u.getHtml(),setHtml:e=>{u&&u.setHtml(e)},getText:()=>u&&u.getText()})),s(a,{children:n("div",{style:{border:"1px solid #ccc"},children:[s(e,{editor:u,defaultConfig:{excludeKeys:["group-image","group-video","insertLink","emotion","todo","fullScreen","insertTable","codeBlock"]},mode:"default",style:{borderBottom:"1px solid #ccc"}}),s(t,{defaultConfig:{placeholder:"请输入内容..."},value:p,onCreated:e=>{f(e),c&&e.disable()},onChange:e=>{x(e.getHtml()),m?.(i(e.getHtml()))},mode:"default",style:{height:"500px",overflowY:"hidden"}})]})})});m.displayName="Editor";export{m as default};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
|
|
3
|
+
export interface ExcelProps {
|
|
4
|
+
/** 是否显示弹窗 */
|
|
5
|
+
visible?: boolean;
|
|
6
|
+
/** 关闭回调 */
|
|
7
|
+
onCancel?: () => void;
|
|
8
|
+
/** xlsx 文件地址 */
|
|
9
|
+
file?: string;
|
|
10
|
+
/** xlsx 文件名 */
|
|
11
|
+
name?: string;
|
|
12
|
+
/** 是否内联展示 */
|
|
13
|
+
inline?: boolean;
|
|
14
|
+
/** 弹窗标题 */
|
|
15
|
+
title?: string;
|
|
16
|
+
/** 内容样式 */
|
|
17
|
+
style?: Record<string, any>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare const Excel: FC<ExcelProps>;
|
|
21
|
+
|
|
22
|
+
export default Excel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Modal as e,Button as t,message as r,Spin as n}from"antd";import i from"exceljs";import{useRef as o,useState as l,useEffect as c}from"react";import a from"x-data-spreadsheet";import u from"../../hooks/useDownloadFile/index.js";import{getFileUrl as s}from"../../utils/index.js";import"x-data-spreadsheet/dist/xspreadsheet.css";import{jsx as d}from"react/jsx-runtime";function h(h){const{visible:x=!1,onCancel:w,file:p,name:v,inline:g=!1,title:y="Excel预览",style:C={}}=h,E=o(null),k=o(null),I=o(!1),T=s(),[b,j]=l(!1),{downloadFile:S}=u();c(()=>{if(!x&&!g||!p)return;I.current=!1;const e=setTimeout(()=>{(async()=>{j(!0),E.current.innerHTML="";try{const e=await fetch(p.includes(T)?p:T+p);if(!e.ok)throw new Error("加载 Excel 文件失败");const t=await e.arrayBuffer(),r=new i.Workbook;if(await r.xlsx.load(t),I.current)return;new a(E.current,{mode:"read",showToolbar:!1,showContextmenu:!1,view:{height:()=>E.current?.clientHeight||520,width:()=>E.current?.clientWidth||800}}).loadData(function(e){const t=[];return e.worksheets.forEach(e=>{t.push(function(e){const t={name:e.name,rows:{},cols:{len:e.columnCount||26},merges:e.model?.merges||[]};return e.columns.forEach((e,r)=>{e.width&&(t.cols[r]={width:Math.round(8*e.width)})}),e.eachRow({includeEmpty:!0},(e,r)=>{const n={cells:{}};e.height&&(n.height=Math.round(1.4*e.height)),e.eachCell({includeEmpty:!0},(e,t)=>{n.cells[t-1]={text:m(e)}}),t.rows[r-1]=n}),(t.merges||[]).forEach(e=>{const r=function(e){const[t,r=t]=e.split(":"),n=f(t),i=f(r);return{sri:n.rowIndex,sci:n.colIndex,eri:i.rowIndex,eci:i.colIndex}}(e),n=t.rows[r.sri]?.cells?.[r.sci];n&&(n.merge=[r.eri-r.sri,r.eci-r.sci])}),t}(e))}),t.length>0?t:[{name:"Sheet1",rows:{}}]}(r))}catch{r.error("加载 Excel 文件失败"),!g&&w&&w()}finally{I.current||j(!1)}})()},100);return()=>{I.current=!0,E.current&&(E.current.innerHTML=""),e&&clearTimeout(e)}},[x,g,p]);const D=()=>d(n,{spinning:b,children:d("div",{style:{height:"72vh",overflow:"hidden",...C},children:d("div",{ref:E,style:{width:"100%",height:"100%"}})})});return g?D():d("div",{ref:k,children:d(e,{style:{top:100,maxWidth:"calc(100vw - 32px)",paddingBottom:24},open:x,mask:{closable:!1},width:1e3,title:y,onCancel:()=>{w()},getContainer:!1,footer:[d(t,{onClick:()=>{w()},children:"关闭"},"cancel"),d(t,{type:"primary",onClick:()=>{S({url:p,name:v})},children:"下载"},"download")],children:D()})})}function m(e){if(null===e.value||void 0===e.value)return"";if(e.formula)return null===e.result||void 0===e.result?`=${e.formula}`:String(e.result);if(e.text)return e.text;if(e.value instanceof Date)return e.value.toLocaleDateString();if("object"==typeof e.value){if(e.value.text)return e.value.text;if(e.value.richText)return e.value.richText.map(e=>e.text).join("");if(void 0!==e.value.result)return String(e.value.result)}return String(e.value)}function f(e){const t=/^([A-Z]+)(\d+)$/i.exec(e);return t?{rowIndex:Number(t[2])-1,colIndex:(r=t[1],r.toUpperCase().split("").reduce((e,t)=>26*e+t.charCodeAt(0)-64,0)-1)}:{rowIndex:0,colIndex:0};var r}h.displayName="Excel";export{h as default};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { FormInstance, FormProps } from "antd/es/form";
|
|
2
|
+
import type { Gutter } from "antd/es/grid/row";
|
|
3
|
+
import type { ReactElement, ReactNode } from "react";
|
|
4
|
+
import type { FormOption } from "./FormItemsRenderer";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 深度部分类型,将所有嵌套属性都变为可选
|
|
8
|
+
*/
|
|
9
|
+
export type DeepPartial<T> = T extends object
|
|
10
|
+
? { [P in keyof T]?: DeepPartial<T[P]> }
|
|
11
|
+
: T;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* FormBuilder 组件属性
|
|
15
|
+
*/
|
|
16
|
+
export interface FormBuilderProps<Values = any> extends Omit<FormProps, "form" | "onFinish"> {
|
|
17
|
+
/** 表单初始值 */
|
|
18
|
+
values?: DeepPartial<Values>;
|
|
19
|
+
/** 表单配置项数组 */
|
|
20
|
+
options: FormOption<Values>[];
|
|
21
|
+
/** 栅格间距,默认 24 */
|
|
22
|
+
gutter?: Gutter | [Gutter, Gutter];
|
|
23
|
+
/** 占据栅格列数,默认 12 */
|
|
24
|
+
span?: number;
|
|
25
|
+
/** 自动生成必填规则,默认 true */
|
|
26
|
+
useAutoGenerateRequired?: boolean;
|
|
27
|
+
/** 是否显示操作按钮区域,默认 true */
|
|
28
|
+
showActionButtons?: boolean;
|
|
29
|
+
/** 提交按钮文字,默认 "提交" */
|
|
30
|
+
submitButtonText?: string;
|
|
31
|
+
/** 取消按钮文字,默认 "取消" */
|
|
32
|
+
cancelButtonText?: string;
|
|
33
|
+
/** 是否显示提交按钮,默认 true */
|
|
34
|
+
showSubmitButton?: boolean;
|
|
35
|
+
/** 是否显示取消按钮,默认 true */
|
|
36
|
+
showCancelButton?: boolean;
|
|
37
|
+
/** 自定义操作按钮组 */
|
|
38
|
+
customActionButtons?: ReactNode;
|
|
39
|
+
/** 额外操作按钮组 */
|
|
40
|
+
extraActionButtons?: ReactNode;
|
|
41
|
+
/** 是否处于加载状态,默认 false */
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
/** 表单实例(通过 Form.useForm() 创建) */
|
|
44
|
+
form: FormInstance<Values>;
|
|
45
|
+
/** 表单提交时的回调函数 */
|
|
46
|
+
onFinish?: (values: Values) => void;
|
|
47
|
+
/** 历史记录对象,用于返回上一页,默认使用 window.history.back */
|
|
48
|
+
history?: {
|
|
49
|
+
goBack?: () => void;
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 表单构建器组件
|
|
56
|
+
*/
|
|
57
|
+
type FormBuilderComponent = {
|
|
58
|
+
useForm: typeof import("antd").Form.useForm;
|
|
59
|
+
useWatch: typeof import("antd").Form.useWatch;
|
|
60
|
+
} & {
|
|
61
|
+
<Values = any>(props: FormBuilderProps<Values>): ReactElement;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
declare const FormBuilder: FormBuilderComponent;
|
|
65
|
+
|
|
66
|
+
export default FormBuilder;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Form as e,Spin as t,Row as o,Col as r,Space as i,Button as n,message as s}from"antd";import{useState as l,useEffect as a}from"react";import{throttle as u}from"throttle-debounce";import c from"./FormItemsRenderer.js";import{jsx as d,jsxs as m}from"react/jsx-runtime";const p=p=>{const{values:h,options:g,gutter:w=24,span:x=12,labelCol:y={span:4},useAutoGenerateRequired:b=!0,showActionButtons:B=!0,submitButtonText:f="提交",cancelButtonText:v="取消",showSubmitButton:A=!0,showCancelButton:C=!0,customActionButtons:F,extraActionButtons:T,history:k,loading:W=!1,...q}=p,[z,E]=l(window.innerWidth),R=u(50,()=>{const e=document.querySelector("#page-layout");e&&E(e.offsetWidth)});return a(()=>{const e=setTimeout(()=>{R()},0);return B&&window.addEventListener("resize",R),()=>{B&&window.removeEventListener("resize",R),clearTimeout(e)}},[B]),d(t,{spinning:W,children:m(e,{labelCol:y,scrollToFirstError:!0,wrapperCol:{span:24-y.span},initialValues:h,onFinishFailed:()=>{s.error("请补全必填项")},style:{width:`calc(100% - ${2*w}px)`,margin:"0 auto"},...q,children:[d(o,{gutter:w,children:d(c,{options:g,labelCol:y,span:x,gutter:w,useAutoGenerateRequired:b,initialValues:h})}),B&&m("div",{style:{position:"relative",zIndex:"99"},children:[d("div",{style:{height:"32px"}}),d(o,{style:{textAlign:"center",backgroundColor:"rgb(241, 241, 242)",padding:"10px 0",position:"fixed",bottom:"0",width:z,margin:"0 -44px"},children:d(r,{span:24,style:{textAlign:"center"},children:F||m(i,{children:[A&&d(n,{type:"primary",htmlType:"submit",children:f}),T,C&&d(n,{onClick:()=>{k?.goBack?k.goBack():window.history.back()},children:v})]})})})]})]})})};p.displayName="FormBuilder",p.useForm=e.useForm,p.useWatch=e.useWatch;export{p as default};
|