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.
Files changed (155) hide show
  1. package/README.md +13 -32
  2. package/components/Cascader/Area/index.d.ts +25 -0
  3. package/components/Cascader/Area/index.js +1 -0
  4. package/components/Cascader/Basic/index.d.ts +31 -0
  5. package/components/Cascader/Basic/index.js +1 -0
  6. package/components/Cascader/Dictionary/index.d.ts +34 -0
  7. package/components/Cascader/Dictionary/index.js +1 -0
  8. package/components/Cascader/Industry/index.d.ts +25 -0
  9. package/components/Cascader/Industry/index.js +1 -0
  10. package/components/Editor/index.d.ts +29 -0
  11. package/components/Editor/index.js +1 -0
  12. package/components/Excel/index.d.ts +22 -0
  13. package/components/Excel/index.js +1 -0
  14. package/components/FormBuilder/FormBuilder.d.ts +66 -0
  15. package/components/FormBuilder/FormBuilder.js +1 -0
  16. package/components/FormBuilder/FormItemsRenderer.d.ts +286 -0
  17. package/components/FormBuilder/FormItemsRenderer.js +1 -0
  18. package/components/FormBuilder/index.d.ts +7 -0
  19. package/components/FormBuilder/index.js +1 -0
  20. package/components/HeaderBack/index.d.ts +18 -0
  21. package/components/HeaderBack/index.js +1 -0
  22. package/components/HeaderBack/index.less +26 -0
  23. package/components/HiddenInfo/gwj/index.d.ts +26 -0
  24. package/components/HiddenInfo/gwj/index.js +1 -0
  25. package/components/Icon/AddIcon/index.d.ts +6 -0
  26. package/components/Icon/AddIcon/index.js +1 -0
  27. package/components/Icon/BackIcon/index.d.ts +6 -0
  28. package/components/Icon/BackIcon/index.js +1 -0
  29. package/components/Icon/DeleteIcon/index.d.ts +6 -0
  30. package/components/Icon/DeleteIcon/index.js +1 -0
  31. package/components/Icon/DownloadIcon/index.d.ts +6 -0
  32. package/components/Icon/DownloadIcon/index.js +1 -0
  33. package/components/Icon/EditIcon/index.d.ts +6 -0
  34. package/components/Icon/EditIcon/index.js +1 -0
  35. package/components/Icon/ExportIcon/index.d.ts +6 -0
  36. package/components/Icon/ExportIcon/index.js +1 -0
  37. package/components/Icon/ImportIcon/index.d.ts +6 -0
  38. package/components/Icon/ImportIcon/index.js +1 -0
  39. package/components/Icon/LocationIcon/index.d.ts +6 -0
  40. package/components/Icon/LocationIcon/index.js +1 -0
  41. package/components/Icon/PrintIcon/index.d.ts +6 -0
  42. package/components/Icon/PrintIcon/index.js +1 -0
  43. package/components/Icon/ResetIcon/index.d.ts +6 -0
  44. package/components/Icon/ResetIcon/index.js +1 -0
  45. package/components/Icon/SearchIcon/index.d.ts +6 -0
  46. package/components/Icon/SearchIcon/index.js +1 -0
  47. package/components/Icon/VideoIcon/index.d.ts +6 -0
  48. package/components/Icon/VideoIcon/index.js +1 -0
  49. package/components/Icon/ViewIcon/index.d.ts +6 -0
  50. package/components/Icon/ViewIcon/index.js +1 -0
  51. package/components/ImportFile/index.d.ts +29 -0
  52. package/components/ImportFile/index.js +1 -0
  53. package/components/LeftTree/Area/index.d.ts +26 -0
  54. package/components/LeftTree/Area/index.js +1 -0
  55. package/components/LeftTree/Basic/index.d.ts +27 -0
  56. package/components/LeftTree/Basic/index.js +1 -0
  57. package/components/LeftTree/Department/Gwj/index.d.ts +31 -0
  58. package/components/LeftTree/Department/Gwj/index.js +1 -0
  59. package/components/LeftTree/Dictionary/index.d.ts +34 -0
  60. package/components/LeftTree/Dictionary/index.js +1 -0
  61. package/components/Map/CesiumMap.js +1 -0
  62. package/components/Map/MapSelector.d.ts +29 -0
  63. package/components/Map/MapSelector.js +1 -0
  64. package/components/Map/h.png +0 -0
  65. package/components/Map/index.d.ts +27 -0
  66. package/components/Map/index.js +1 -0
  67. package/components/Map/index.less +5 -0
  68. package/components/Page/index.d.ts +36 -0
  69. package/components/Page/index.js +1 -0
  70. package/components/Pdf/index.d.ts +22 -0
  71. package/components/Pdf/index.js +1 -0
  72. package/components/Pdf/index.less +3 -0
  73. package/components/PreviewExcel/index.d.ts +18 -0
  74. package/components/PreviewExcel/index.js +1 -0
  75. package/components/PreviewImg/index.d.ts +12 -0
  76. package/components/PreviewImg/index.js +1 -0
  77. package/components/PreviewPdf/index.d.ts +18 -0
  78. package/components/PreviewPdf/index.js +1 -0
  79. package/components/PreviewWord/index.d.ts +18 -0
  80. package/components/PreviewWord/index.js +1 -0
  81. package/components/SeamlessScroll/index.d.ts +51 -0
  82. package/components/SeamlessScroll/index.js +1 -0
  83. package/components/Search/index.d.ts +49 -0
  84. package/components/Search/index.js +1 -0
  85. package/components/Select/Basic/index.d.ts +35 -0
  86. package/components/Select/Basic/index.js +1 -0
  87. package/components/Select/Dictionary/index.d.ts +33 -0
  88. package/components/Select/Dictionary/index.js +1 -0
  89. package/components/Select/Personnel/Gwj/index.d.ts +72 -0
  90. package/components/Select/Personnel/Gwj/index.js +1 -0
  91. package/components/SelectCreate/index.d.ts +29 -0
  92. package/components/SelectCreate/index.js +1 -0
  93. package/components/SelectTree/Area/index.d.ts +25 -0
  94. package/components/SelectTree/Area/index.js +1 -0
  95. package/components/SelectTree/Basic/index.d.ts +35 -0
  96. package/components/SelectTree/Basic/index.js +1 -0
  97. package/components/SelectTree/Department/Gwj/index.d.ts +61 -0
  98. package/components/SelectTree/Department/Gwj/index.js +1 -0
  99. package/components/SelectTree/Dictionary/index.d.ts +34 -0
  100. package/components/SelectTree/Dictionary/index.js +1 -0
  101. package/components/SelectTree/HiddenLevel/Gwj/index.d.ts +32 -0
  102. package/components/SelectTree/HiddenLevel/Gwj/index.js +1 -0
  103. package/components/SelectTree/HiddenPart/Gwj/index.d.ts +38 -0
  104. package/components/SelectTree/HiddenPart/Gwj/index.js +1 -0
  105. package/components/SelectTree/Industry/index.d.ts +25 -0
  106. package/components/SelectTree/Industry/index.js +1 -0
  107. package/components/Signature/index.d.ts +28 -0
  108. package/components/Signature/index.js +1 -0
  109. package/components/Table/index.d.ts +29 -0
  110. package/components/Table/index.js +1 -0
  111. package/components/Table/index.less +14 -0
  112. package/components/TooltipPreviewImg/index.d.ts +6 -0
  113. package/components/TooltipPreviewImg/index.js +1 -0
  114. package/components/Upload/index.d.ts +32 -0
  115. package/components/Upload/index.js +1 -0
  116. package/components/Video/AliPlayer.d.ts +45 -0
  117. package/components/Video/AliPlayer.js +1 -0
  118. package/components/Video/index.d.ts +20 -0
  119. package/components/Video/index.js +1 -0
  120. package/components/Word/index.d.ts +22 -0
  121. package/components/Word/index.js +1 -0
  122. package/css/common.less +35 -0
  123. package/enum/formItemRender/index.d.ts +68 -0
  124. package/enum/formItemRender/index.js +1 -0
  125. package/hooks/useDeleteFile/index.d.ts +22 -0
  126. package/hooks/useDeleteFile/index.js +1 -0
  127. package/hooks/useDictionary/index.d.ts +24 -0
  128. package/hooks/useDictionary/index.js +1 -0
  129. package/hooks/useDownloadBlob/index.d.ts +16 -0
  130. package/hooks/useDownloadBlob/index.js +1 -0
  131. package/hooks/useDownloadFile/index.d.ts +14 -0
  132. package/hooks/useDownloadFile/index.js +1 -0
  133. package/hooks/useGetFile/index.d.ts +49 -0
  134. package/hooks/useGetFile/index.js +1 -0
  135. package/hooks/useGetUrlQuery/index.d.ts +4 -0
  136. package/hooks/useGetUrlQuery/index.js +1 -0
  137. package/hooks/useGetUserInfo/index.d.ts +21 -0
  138. package/hooks/useGetUserInfo/index.js +1 -0
  139. package/hooks/useIdle/index.d.ts +11 -0
  140. package/hooks/useIdle/index.js +1 -0
  141. package/hooks/useImportFile/index.d.ts +16 -0
  142. package/hooks/useImportFile/index.js +1 -0
  143. package/hooks/useIsExistenceDuplicateSelection/index.d.ts +22 -0
  144. package/hooks/useIsExistenceDuplicateSelection/index.js +1 -0
  145. package/hooks/useTable/index.d.ts +75 -0
  146. package/hooks/useTable/index.js +1 -0
  147. package/hooks/useUploadFile/index.d.ts +67 -0
  148. package/hooks/useUploadFile/index.js +1 -0
  149. package/hooks/useUrlQueryCriteria/index.d.ts +8 -0
  150. package/hooks/useUrlQueryCriteria/index.js +1 -0
  151. package/package.json +8 -6
  152. package/regular/index.d.ts +59 -0
  153. package/regular/index.js +1 -0
  154. package/utils/index.d.ts +395 -0
  155. package/utils/index.js +1 -0
@@ -0,0 +1,72 @@
1
+ import type { FC } from "react";
2
+ import type { BasicSelectProps } from "../../Basic";
3
+
4
+ export interface PersonnelSelectItem {
5
+ id: string;
6
+ name: string;
7
+ corpinfoId: string;
8
+ corpinfoName: string;
9
+ departmentId: string;
10
+ departmentName: string;
11
+ postId: string;
12
+ postName: string;
13
+ userId: string;
14
+ username: string;
15
+ [key: string]: any;
16
+ }
17
+
18
+ /**
19
+ * 请求参数
20
+ */
21
+ export interface Params {
22
+ /** 企业id */
23
+ corpinfoId?: string;
24
+ /** 岗位id */
25
+ postId?: string;
26
+ /** 部门id */
27
+ departmentId?: string;
28
+ }
29
+
30
+ /**
31
+ * 额外请求参数
32
+ */
33
+ export interface ExtraParams {
34
+ /** 返回值是否存在主账号,1 不返回主账号,默认有主账号 */
35
+ noMain?: 1 | "";
36
+ /** 入职状态 0-离职, 1-在职, 2-信息变更中, 3-未入职, 4-实习生, 5-实习结束, 6-退休, 7-劳务派遣, 8-劳务派遣结束, 11-入职待审核, 10-离职待审核 */
37
+ eqEmploymentFlag?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 11 | 10;
38
+ /** 是否流动人员 1-流动,0-固定人员 */
39
+ flowFlag?: 1 | 0;
40
+ /** 是否在人资系统中存在 1-是,0-否 */
41
+ rzFlag?: 1 | 0;
42
+ [key: string]: any;
43
+ }
44
+
45
+ /**
46
+ * 组件属性
47
+ */
48
+ export interface PersonnelSelectProps extends Omit<BasicSelectProps, "data" | "placeholder" | "nameKey" | "idKey" | "onGetOption" | "onGetData"> {
49
+ /** 请求参数 */
50
+ params?: Params;
51
+ /** 占位符,默认"人员" */
52
+ placeholder?: string;
53
+ /** 是否需要企业id,默认 false */
54
+ isNeedCorpInfoId?: boolean;
55
+ /** 是否需要岗位id,默认 false */
56
+ isNeedPostId?: boolean;
57
+ /** 是否需要部门id,默认 true */
58
+ isNeedDepartmentId?: boolean;
59
+ /** 额外请求参数 */
60
+ extraParams?: ExtraParams;
61
+ /** 获取选中的项 */
62
+ onGetOption?: (option: PersonnelSelectItem | PersonnelSelectItem[]) => void;
63
+ /** 获取数据 */
64
+ onGetData?: (data: PersonnelSelectItem[]) => void;
65
+ }
66
+
67
+ /**
68
+ * 人员下拉组件(港务局版本)
69
+ */
70
+ declare const PersonnelSelect: FC<PersonnelSelectProps>;
71
+
72
+ export default PersonnelSelect;
@@ -0,0 +1 @@
1
+ import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as t,useEffect as r}from"react";import{executeWithCache as o,getBaseGateway as n}from"../../../../utils/index.js";import i from"../../Basic/index.js";import{jsx as a}from"react/jsx-runtime";function s(s){const{params:m={},placeholder:p="人员",isNeedCorpInfoId:d=!1,isNeedDepartmentId:f=!0,isNeedPostId:c=!1,extraParams:l={},...u}=s,I={noMain:"",eqEmploymentFlag:1},[y,g]=t([]);return r(()=>{(async()=>{if(!d&&!f&&!c)return void console.error("【PersonnelSelect】 请至少传入一个参数");if(d&&(!m.corpinfoId||"string"!=typeof m.corpinfoId))return;if(f&&(!m.departmentId||"string"!=typeof m.departmentId))return;if(c&&(!m.postId||"string"!=typeof m.postId))return;const t={...I,...l},r={params:m,extraParams:t};await o(r,async()=>{const{data:r}=await e(`/${n()}/user/listAll`,"get",{...m,...t,time:(new Date).getTime()});return r},g)})()},[JSON.stringify(m),d,f,c,JSON.stringify(l)]),a(i,{data:y,placeholder:p,...u})}s.displayName="PersonnelSelect";export{s as default};
@@ -0,0 +1,29 @@
1
+ import type { SelectProps } from "antd/es/select";
2
+ import type { FC } from "react";
3
+
4
+ export interface SelectCreateOption {
5
+ /** 选项的唯一标识符 */
6
+ id: string | number;
7
+ /** 选项的显示名称 */
8
+ name: string;
9
+ /** 其他自定义属性 */
10
+ [key: string]: any;
11
+ }
12
+
13
+ export interface SelectCreateProps extends SelectProps {
14
+ /** 选项列表 */
15
+ items: SelectCreateOption[];
16
+ /** 是否显示删除图标,默认 true */
17
+ showDelete?: boolean;
18
+ /** 标签名称,用于占位符显示 */
19
+ label?: string;
20
+ /** 删除选项时的回调函数 */
21
+ onDelete?: (option: SelectCreateOption) => void;
22
+ }
23
+
24
+ /**
25
+ * 可创建选项的选择器组件
26
+ */
27
+ declare const SelectCreate: FC<SelectCreateProps>;
28
+
29
+ export default SelectCreate;
@@ -0,0 +1 @@
1
+ import{CloseCircleOutlined as e}from"@ant-design/icons";import{Select as t}from"antd";import{jsx as n,jsxs as a}from"react/jsx-runtime";function o(o){const{items:i,showDelete:l=!0,label:r="",maxCount:s=1,onDelete:m,...p}=o;return n(t,{mode:"tags",maxCount:s,placeholder:`请选择${r},无对应选项可直接输入创建选项`,optionRender:t=>a("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[n("span",{children:t.label}),l&&n(e,{style:{marginRight:10},onClick:e=>{e.stopPropagation(),(e=>{m?.(e)})(t)}})]}),options:i.map(e=>({value:e.id,label:e.name})),...p})}o.displayName="SelectCreate";export{o as default};
@@ -0,0 +1,25 @@
1
+ import type { FC } from "react";
2
+ import type { BasicSelectTreeProps } from "../Basic";
3
+
4
+ export interface AreaSelectTreeItem {
5
+ value: string;
6
+ label: string;
7
+ children: AreaSelectTreeItem[];
8
+ }
9
+
10
+ /**
11
+ * 组件属性
12
+ */
13
+ export interface AreaSelectTreeProps extends Omit<BasicSelectTreeProps, "treeData" | "placeholder" | "nameKey" | "idKey" | "childrenKey" | "onGetNodePaths" | "onGetData"> {
14
+ /** 获取父级节点 */
15
+ onGetNodePaths?: (nodes: AreaSelectTreeItem[]) => void;
16
+ /** 获取数据 */
17
+ onGetData?: (data: AreaSelectTreeItem[], processedData: AreaSelectTreeItem[]) => void;
18
+ }
19
+
20
+ /**
21
+ * 属地下拉树组件
22
+ */
23
+ declare const AreaSelectTree: FC<AreaSelectTreeProps>;
24
+
25
+ export default AreaSelectTree;
@@ -0,0 +1 @@
1
+ import e from"zy-react-data/json/area.json";import a from"../Basic/index.js";import{jsx as r}from"react/jsx-runtime";function t(t){const{...o}=t;return r(a,{treeData:e,nameKey:"label",idKey:"value",...o})}t.displayName="AreaSelectTree";export{t as default};
@@ -0,0 +1,35 @@
1
+ import type { TreeSelectProps } from "antd/es/tree-select";
2
+ import type { FC } from "react";
3
+
4
+ /**
5
+ * 组件属性
6
+ */
7
+ export interface BasicSelectTreeProps extends Omit<TreeSelectProps, "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
+ /** 获取 label */
23
+ onGetLabel?: (label: string | string[]) => void;
24
+ /** 获取数据 */
25
+ onGetData?: (data: Record<string, any>[], processedData: Record<string, any>[]) => void;
26
+ /** 是否只允许选择最后一级,默认 false */
27
+ onlyLastLevel?: boolean;
28
+ }
29
+
30
+ /**
31
+ * 基础下拉树组件
32
+ */
33
+ declare const BasicSelectTree: FC<BasicSelectTreeProps>;
34
+
35
+ export default BasicSelectTree;
@@ -0,0 +1 @@
1
+ import{TreeSelect as e}from"antd";import{useMemo as l,useEffect as t}from"react";import{processTreeDataByLevel as a,processTreeDataForOnlyLastLevel as r,getDataType as n,getTreeNodePaths as o,arrayObjectDeduplication as i}from"../../../utils/index.js";import{jsx as c}from"react/jsx-runtime";function d(d){const{onGetData:s,onChange:h,onGetLabel:u,onGetNodePaths:y,getNodePathsIsIncludeOneself:f=!0,placeholder:m="",treeData:p=[],nameKey:v="name",idKey:I="id",childrenKey:g="children",level:K,onlyLastLevel:C=!1,...L}=d,S=l(()=>{let e=K?a({data:p,level:K,childrenKey:g,currentLevel:1}):p;return e=r({data:e,childrenKey:g,onlyLastLevel:C}),e},[p,K,g,C]);return t(()=>{s?.(p,S)},[p,S]),c(e,{showSearch:!0,style:{width:"100%"},styles:{popup:{root:{maxHeight:400,overflow:"auto"}}},placeholder:`请选择${m}`,onChange:(e,l,t)=>{if(e){if("Array"===n(e)){if(y){const l=[];for(let t=0;t<e.length;t++){const a=L.labelInValue||L.treeCheckStrictly?e[t].value:e[t],r=o({data:p,targetId:a,idKey:I,childrenKey:g,isIncludeOneself:f});l.push(...r)}const t=i(l,I);y?.(t)}u?.(L.labelInValue||L.treeCheckStrictly?e.map(e=>e.label):l)}else if(y||u){const l=L.labelInValue||L.treeCheckStrictly?e.value:e,t=o({data:p,targetId:l,idKey:I,childrenKey:g,isIncludeOneself:f});y?.(t),u?.(t[t.length-1][v])}}else y?.([]),u?.("");h?.(L.labelInValue||L.treeCheckStrictly?e.map(e=>e.value):e,l,t)},allowClear:!0,treeData:S,fieldNames:{label:v,value:I,children:g},treeNodeFilterProp:v,showCheckedStrategy:e.SHOW_ALL,...L})}d.displayName="BasicSelectTree";export{d as default};
@@ -0,0 +1,61 @@
1
+ import type { FC } from "react";
2
+ import type { BasicSelectTreeProps } from "../../Basic";
3
+
4
+ export interface DepartmentSelectTreeItem {
5
+ id: string;
6
+ name: string;
7
+ childrenList: DepartmentSelectTreeItem[];
8
+ [key: string]: any;
9
+ }
10
+
11
+ /**
12
+ * 企业类型枚举(用于 inType)
13
+ */
14
+ type InType = 0 | 1 | 2 | 3 | 4 | 5 | 6;
15
+
16
+ /**
17
+ * 企业类型枚举(用于 enterpriseType)
18
+ */
19
+ type EnterpriseType = 1 | 2 | 3;
20
+
21
+ /**
22
+ * 请求参数
23
+ */
24
+ export interface Params {
25
+ /** 企业id */
26
+ eqCorpinfoId?: string;
27
+ /** 父级部门id */
28
+ eqParentId?: string;
29
+ /** 企业类型 0-普通企业 1-集团单位 2-股份单位 3-相关方企业 4-货主单位 5-驻港单位 6-物资中心 */
30
+ inType?: InType[];
31
+ /** 企业类型 1-监管 2-企业 3-相关方 */
32
+ enterpriseType?: EnterpriseType | EnterpriseType[];
33
+ [key: string]: any;
34
+ }
35
+
36
+ /**
37
+ * 组件属性
38
+ */
39
+ export interface DepartmentSelectTreeProps extends Omit<BasicSelectTreeProps, "treeData" | "placeholder" | "nameKey" | "idKey" | "childrenKey" | "onGetNodePaths" | "onGetData"> {
40
+ /** 请求参数 */
41
+ params?: Params;
42
+ /** 占位符,默认"部门" */
43
+ placeholder?: string;
44
+ /** 是否需要企业id,默认 false */
45
+ isNeedCorpInfoId?: boolean;
46
+ /** 是否需要父级部门id,默认 false */
47
+ isNeedParentId?: boolean;
48
+ /** 查询的企业类型,默认current,current 接收 eqCorpinfoId 或者 eqParentId,all 不接受任何参数,inType 接收 inType 或者 enterpriseType */
49
+ searchType?: "current" | "all" | "inType";
50
+ /** 获取父级节点 */
51
+ onGetNodePaths?: (nodes: DepartmentSelectTreeItem[]) => void;
52
+ /** 获取数据 */
53
+ onGetData?: (data: DepartmentSelectTreeItem[], processedData: DepartmentSelectTreeItem[]) => void;
54
+ }
55
+
56
+ /**
57
+ * 部门下拉树组件(港务局版本)
58
+ */
59
+ declare const DepartmentSelectTree: FC<DepartmentSelectTreeProps>;
60
+
61
+ export default DepartmentSelectTree;
@@ -0,0 +1 @@
1
+ import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as r,useEffect as t}from"react";import{executeWithCache as n,getBaseGateway as i}from"../../../../utils/index.js";import p from"../../Basic/index.js";import{jsx as a}from"react/jsx-runtime";function s(s){const{params:d={},placeholder:o="部门",isNeedCorpInfoId:l=!1,isNeedParentId:c=!1,searchType:m="current",...y}=s,[T,f]=r([]);return t(()=>{(async()=>{if("current"===m){if(l&&!d.eqCorpinfoId)return;if(c&&!d.eqParentId)return}let r="";const t={...d,time:(new Date).getTime()};"current"===m&&(r=`/${i()}/department/listTree`,delete t.inType,delete t.enterpriseType),"all"===m&&(r=`/${i()}/department/listAllTree`,delete t.inType,delete t.enterpriseType,delete t.eqCorpinfoId,delete t.eqParentId),"inType"===m&&(r=`/${i()}/department/listAllTreeByCorpType`,delete t.eqCorpinfoId,delete t.eqParentId,t.enterpriseType&&!Array.isArray(t.enterpriseType)&&(t.enterpriseType=[t.enterpriseType]));const p={searchType:m,params:d};await n(p,async()=>{const{data:n}=await e(r,"post",t);return n},f)})()},[JSON.stringify(d),l,c,m]),a(p,{treeData:T,placeholder:o,childrenKey:"childrenList",...y})}s.displayName="DepartmentSelectTree";export{s as default};
@@ -0,0 +1,34 @@
1
+ import type { FC } from "react";
2
+ import type { BasicSelectTreeProps } from "../Basic";
3
+
4
+ export interface DictionarySelectTreeItem {
5
+ dictValue: string;
6
+ dictLabel: string;
7
+ children: DictionarySelectTreeItem[];
8
+ [key: string]: any;
9
+ }
10
+
11
+ /**
12
+ * 组件属性
13
+ */
14
+ export interface DictionarySelectTreeProps extends Omit<BasicSelectTreeProps, "treeData" | "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: DictionarySelectTreeItem[]) => void;
25
+ /** 获取数据 */
26
+ onGetData?: (data: DictionarySelectTreeItem[], processedData: DictionarySelectTreeItem[]) => void;
27
+ }
28
+
29
+ /**
30
+ * 数据字典下拉树组件
31
+ */
32
+ declare const DictionarySelectTree: FC<DictionarySelectTreeProps>;
33
+
34
+ export default DictionarySelectTree;
@@ -0,0 +1 @@
1
+ import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as t,useEffect as i}from"react";import{DICTIONARY_APP_KEY_ENUM as r}from"zy-react-data/enum/dictionary";import{executeWithCache as a}from"../../../utils/index.js";import c from"../Basic/index.js";import{jsx as o}from"react/jsx-runtime";function n(n){const{appKey:s=r.DEFAULT,dictValue:d="",nameKey:l="dictLabel",idKey:m="dictValue",...p}=n,[y,u]=t([]);return i(()=>{(async()=>{if(!Object.values(r).includes(s))return void console.error(`【DictionarySelectTree】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${s}`);if(!d)return void console.error("【DictionarySelectTree】 缺少 dictValue 参数");const t={appKey:s,dictValue:d};await a(t,async()=>{const{data:t}=await e("/config/dict-trees/list/by/dictValues","get",{appKey:s,dictValue:d});return t},u)})()},[d]),o(c,{treeData:y,nameKey:l,idKey:m,...p})}n.displayName="DictionarySelectTree";export{n as default};
@@ -0,0 +1,32 @@
1
+ import type { FC } from "react";
2
+ import type { BasicSelectTreeProps } from "../../Basic";
3
+
4
+ export interface HiddenLevelSelectTreeItem {
5
+ dictValue: string;
6
+ dictLabel: string;
7
+ children: HiddenLevelSelectTreeItem[];
8
+ [key: string]: any;
9
+ }
10
+
11
+ /**
12
+ * 组件属性
13
+ */
14
+ export interface HiddenLevelSelectTreeProps extends Omit<BasicSelectTreeProps, "treeData" | "nameKey" | "idKey" | "childrenKey" | "level" | "onGetNodePaths" | "onGetData"> {
15
+ /** 是否显示忽略隐患,默认 true */
16
+ isShowNeglect?: boolean;
17
+ /** 是否显示较大隐患,默认 true */
18
+ isShowLarger?: boolean;
19
+ /** 是否显示重大隐患,默认 true */
20
+ isShowMajor?: boolean;
21
+ /** 获取父级节点 */
22
+ onGetNodePaths?: (nodes: HiddenLevelSelectTreeItem[]) => void;
23
+ /** 获取数据 */
24
+ onGetData?: (data: HiddenLevelSelectTreeItem[], processedData: HiddenLevelSelectTreeItem[]) => void;
25
+ }
26
+
27
+ /**
28
+ * 隐患级别下拉树组件(港务局版本)
29
+ */
30
+ declare const HiddenLevelSelectTree: FC<HiddenLevelSelectTreeProps>;
31
+
32
+ export default HiddenLevelSelectTree;
@@ -0,0 +1 @@
1
+ import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as t,useEffect as i}from"react";import{DICTIONARY_APP_KEY_ENUM as r}from"zy-react-data/enum/dictionary";import a from"../../Basic/index.js";import{jsx as d}from"react/jsx-runtime";function c(c){const{isShowNeglect:l=!0,isShowLarger:n=!0,isShowMajor:o=!0,...s}=c,[m,h]=t([]);return i(()=>{(async()=>{h([]);const{data:t}=await e("/config/dict-trees/list/by/dictValues","get",{appKey:r.GWJ,dictValue:"hiddenLevel"}),i=(e=>{const t=e=>e&&Array.isArray(e)?e.filter(e=>"hiddenLevel1001"===e.dictValue?l:"jdyh001"===e.dictValue?n:"hiddenLevel0002"===e.dictValue?o:(e.children&&e.children.length>0&&(e.children=t(e.children)),!0)):[];return t(e)})(t);h(i)})()},[]),d(a,{treeData:m,placeholder:"隐患级别",onlyLastLevel:!0,nameKey:"dictLabel",idKey:"dictValue",...s})}c.displayName="HiddenLevelSelectTree";export{c as default};
@@ -0,0 +1,38 @@
1
+ import type { FC } from "react";
2
+ import type { BasicSelectTreeProps } from "../../Basic";
3
+
4
+ export interface HiddenPartSelectTreeItem {
5
+ hiddenregionId: string;
6
+ hiddenregion: string;
7
+ children: HiddenPartSelectTreeItem[];
8
+ [key: string]: any;
9
+ }
10
+
11
+ /**
12
+ * 请求参数
13
+ */
14
+ export interface Params {
15
+ /** 企业id */
16
+ eqCorpinfoId?: string;
17
+ }
18
+
19
+ /**
20
+ * 组件属性
21
+ */
22
+ export interface HiddenPartSelectTreeProps extends Omit<BasicSelectTreeProps, "treeData" | "nameKey" | "idKey" | "childrenKey" | "onGetNodePaths" | "onGetData"> {
23
+ /** 请求参数 */
24
+ params?: Params;
25
+ /** 是否需要企业id,默认 false */
26
+ isNeedCorpInfoId?: boolean;
27
+ /** 获取父级节点 */
28
+ onGetNodePaths?: (nodes: HiddenPartSelectTreeItem[]) => void;
29
+ /** 获取数据 */
30
+ onGetData?: (data: HiddenPartSelectTreeItem[], processedData: HiddenPartSelectTreeItem[]) => void;
31
+ }
32
+
33
+ /**
34
+ * 隐患部位下拉树组件(港务局版本)
35
+ */
36
+ declare const HiddenPartSelectTree: FC<HiddenPartSelectTreeProps>;
37
+
38
+ export default HiddenPartSelectTree;
@@ -0,0 +1 @@
1
+ import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as r,useEffect as i}from"react";import t from"../../Basic/index.js";import{jsx as o}from"react/jsx-runtime";function n(n){const{params:d={},isNeedCorpInfoId:a=!1,...s}=n,[m,p]=r([]);return i(()=>{(async()=>{if(p([]),a&&!d.eqCorpinfoId)return;const{data:r}=await e("/hidden/hiddenRegion/listByTree","post",d);p(r)})()},[JSON.stringify(d),a]),o(t,{treeData:m,placeholder:"隐患部位",nameKey:"hiddenregion",idKey:"hiddenregionId",...s})}n.displayName="HiddenPartSelectTree";export{n as default};
@@ -0,0 +1,25 @@
1
+ import type { FC } from "react";
2
+ import type { BasicSelectTreeProps } from "../Basic";
3
+
4
+ export interface IndustrySelectTreeItem {
5
+ dict_value: string;
6
+ dict_label: string;
7
+ childrenList: IndustrySelectTreeItem[];
8
+ }
9
+
10
+ /**
11
+ * 组件属性
12
+ */
13
+ export interface IndustrySelectTreeProps extends Omit<BasicSelectTreeProps, "treeData" | "placeholder" | "nameKey" | "idKey" | "childrenKey" | "onGetNodePaths" | "onGetData"> {
14
+ /** 获取父级节点 */
15
+ onGetNodePaths?: (nodes: IndustrySelectTreeItem[]) => void;
16
+ /** 获取数据 */
17
+ onGetData?: (data: IndustrySelectTreeItem[], processedData: IndustrySelectTreeItem[]) => void;
18
+ }
19
+
20
+ /**
21
+ * 行业类型下拉树组件
22
+ */
23
+ declare const IndustrySelectTree: FC<IndustrySelectTreeProps>;
24
+
25
+ export default IndustrySelectTree;
@@ -0,0 +1 @@
1
+ import e from"zy-react-data/json/industry.json";import t from"../Basic/index.js";import{jsx as r}from"react/jsx-runtime";function i(i){const{...a}=i;return r(t,{treeData:e,nameKey:"dict_label",idKey:"dict_value",childrenKey:"childrenList",...a})}i.displayName="IndustrySelectTree";export{i as default};
@@ -0,0 +1,28 @@
1
+ import type { FC } from "react";
2
+
3
+ export interface SignatureValue {
4
+ /** 签字时间,YYYY-MM-DD HH:mm:ss */
5
+ time: string;
6
+ /** 签字图片的 base64 编码 */
7
+ base64: string;
8
+ /** 签字图片的 file 对象 */
9
+ file: File;
10
+ }
11
+
12
+ export interface SignatureProps {
13
+ /** 确认签字回调 */
14
+ onConfirm: (value: SignatureValue) => void;
15
+ /** 签字区域宽度,默认 752 */
16
+ width?: number;
17
+ /** 签字区域高度,默认 300 */
18
+ height?: number;
19
+ /** 回显的签字图片 */
20
+ url?: string;
21
+ }
22
+
23
+ /**
24
+ * 签字组件
25
+ */
26
+ declare const Signature: FC<SignatureProps>;
27
+
28
+ export default Signature;
@@ -0,0 +1 @@
1
+ import{Button as r,Image as e,Modal as i,message as t}from"antd";import n from"dayjs";import{useState as o,useRef as c,useEffect as a}from"react";import d from"react-signature-canvas";import{base642File as l}from"../../utils/index.js";import{jsxs as h,Fragment as m,jsx as s}from"react/jsx-runtime";function p(p){const{onConfirm:u,width:f=752,height:g=300,url:y="",...b}=p,[k,C]=o(!1),v=c(null),[w,x]=o("");return a(()=>{x(y)},[y]),h(m,{children:[s("div",{children:s(r,{type:"primary",onClick:()=>{C(!0)},children:w?"重新签字":"手写签字"})}),w&&s("div",{style:{border:"1px dashed #d9d9d9",width:"100%",height:g,marginTop:16},children:s(e,{src:w,style:{width:"100%",height:g,objectFit:"contain"}})}),s(i,{title:"签字",width:800,open:k,mask:{closable:!1},onCancel:()=>C(!1),footer:[s(r,{onClick:()=>v.current.clear(),children:"重签"},"clear"),s(r,{onClick:()=>{C(!1),v.current.clear()},children:"取消"},"cancel"),s(r,{type:"primary",onClick:()=>{if(v.current.isEmpty())return void t.warning("请签名");const r=v.current.toDataURL();x(r),u({time:n().format("YYYY-MM-DD HH:mm:ss"),base64:r,file:l(r)}),v.current.clear(),C(!1)},children:"确定"},"ok")],children:s("div",{style:{border:"1px dashed #d9d9d9"},children:s(d,{ref:v,penColor:"black",canvasProps:{width:f,height:g},backgroundColor:"rgb(255,255,255)",...b})})})]})}p.displayName="Signature";export{p as default};
@@ -0,0 +1,29 @@
1
+ import type { ProTableProps } from "@ant-design/pro-table";
2
+ import type { TableProps as AntdTableProps } from "antd";
3
+ import type { FC } from "react";
4
+
5
+ /**
6
+ * TablePro 组件属性
7
+ */
8
+ export type TableProps<DataSource, U, ValueType> = Omit<AntdTableProps, "columns"> & ProTableProps<DataSource, U, ValueType> & {
9
+ /** 当一个路由下存在多个表格的情况下 需要给每一个表格设置一个唯一存储索引 若没有设置则使用默认索引,请注意缓存数据会被覆盖 */
10
+ storeIndex?: string;
11
+ /** 是否禁用内容区滚动,默认 false */
12
+ disabledResizer?: boolean;
13
+ /** 是否显示索引列,默认 true */
14
+ showIndexColumn?: boolean;
15
+ /** 索引列是否固定,默认 left */
16
+ indexColumnFixed?: "left" | "right" | boolean;
17
+ /** 列的对齐方式,默认 center */
18
+ align?: "left" | "right" | "center";
19
+ /** 超过宽度是否自动省略,默认 true */
20
+ ellipsis?: boolean;
21
+ /** 表格高度,默认自适应 */
22
+ height?: number;
23
+ };
24
+
25
+ /**
26
+ * 表格组件
27
+ */
28
+ declare const Table: <DataSource, U, ValueType = "text">(props: TableProps<DataSource, U, ValueType>) => ReturnType<FC>;
29
+ export default Table;
@@ -0,0 +1 @@
1
+ import{ProTable as e}from"@ant-design/pro-components";import{useState as t,useEffect as o,useMemo as n}from"react";import{throttle as s}from"throttle-debounce";import{useAntdResizableHeader as r}from"use-antd-resizable-header";import{getDataType as i,getIndexColumn as a}from"../../utils/index.js";import"use-antd-resizable-header/dist/style.css";import"./index.less";import{jsx as c}from"react/jsx-runtime";function l(e){const t=process.env?.app?.basename,o=decodeURIComponent(window.location.pathname),n="Undefined"===i(e)?"":`#{${e}}`;return{size:`${t}#${o}${n}#size`,resizable:`${t}#${o}${n}#resizable`,columnState:`${t}#${o}${n}#columnState`}}function d(i){const{columns:d=[],showIndexColumn:m=!0,ellipsis:u=!0,align:p="center",indexColumnFixed:b="left",rowKey:h="id",storeIndex:f,disabledResizer:g=!1,height:y,...w}=i,S=process.env.app.antd["ant-prefix"],z=`.${S||"ant"}-table`,$=`${z}-wrapper`,x=`${z}-body`,[v,C]=t((I=f,window.sessionStorage.getItem(l(I).size)||"default"));var I;const[R,_]=t(0),K=l(f),N=!g,{components:T,resizableColumns:q,tableWidth:B,resetColumns:E}=r({columns:d,columnsState:{persistenceKey:K.resizable,persistenceType:"sessionStorage"}}),j=s(50,()=>{try{const e=document.querySelector($),t=document.querySelector(x),o=document.querySelector(".page-layout-footer"),n=o?o.offsetHeight:0;if(t&&e){const o=e.getBoundingClientRect(),s=t.getBoundingClientRect(),r=o.bottom-s.bottom;_(innerHeight-s.top-r-(window.__IN_BASE__?38:22)-n)}}catch(e){window.console.error(e)}});o(()=>{let e,t;return N&&(e=new MutationObserver(e=>e.forEach(()=>j())),t=new ResizeObserver(e=>e.forEach(()=>j())),setTimeout(()=>j(),500),t.observe(document.body),e.observe(document.body,{subtree:!0,childList:!0})),()=>{e&&t&&N&&(t.unobserve(document.body),e.disconnect(document.body))}},[]),o(()=>{!function(e,t){window.sessionStorage.setItem(l(t).size,e)}(v,f)},[v]);const k=n(()=>(()=>{const e=[...q];m&&e.unshift({...a(i.pagination),fixed:b});const t=e=>({align:p,ellipsis:u,...e,...e.children?{children:e.children.map(t)}:{}});return e.map(t)})(),[q,m,p,u,b,i.pagination]);return c("div",{className:"table-layout card-layout",children:c(e,{ghost:!0,search:!1,scroll:{x:B,y:y||(N?R:void 0)},options:{reload:!1,fullScreen:!0,setting:{checkedReset:!0,extra:c("a",{className:`${S}-pro-table-column-setting-action-rest-button`,onClick:E,children:"重置列宽"})}},components:T,columnsState:{persistenceKey:K.columnState,persistenceType:"sessionStorage"},onSizeChange:C,columns:k,bordered:!0,size:"small",rowKey:h,...w})})}d.displayName="Table";export{d as default};
@@ -0,0 +1,14 @@
1
+ .@{ant-prefix}-table-cell-scrollbar {
2
+ width: 15px;
3
+ }
4
+
5
+ .@{ant-prefix}-table-cell {
6
+ .@{ant-prefix}-btn-link {
7
+ padding: 0;
8
+ }
9
+ }
10
+
11
+ .@{ant-prefix}-pro-table-list-toolbar-container {
12
+ padding-top: 0 !important;
13
+ padding-bottom: 16px;
14
+ }
@@ -0,0 +1,6 @@
1
+ import type { FC } from "react";
2
+ import type { PreviewImgProps } from "../PreviewImg";
3
+
4
+ declare const TooltipPreviewImg: FC<PreviewImgProps>;
5
+
6
+ export default TooltipPreviewImg;
@@ -0,0 +1 @@
1
+ import{Tooltip as e,Tag as i}from"antd";import r from"../PreviewImg/index.js";import{jsx as t}from"react/jsx-runtime";const l=l=>{const{files:n=[],fileUrlKey:o="filePath"}=l;return t(e,{placement:"top",title:n.length>0?t(r,{files:n,fileUrlKey:o}):t("span",{children:"暂无图片"}),children:t(i,{children:"预览"})})};l.displayName="TooltipPreviewImg";export{l as default};
@@ -0,0 +1,32 @@
1
+ import type { UploadProps as AntUploadProps, UploadFile } from "antd/es/upload";
2
+ import type { FC, ReactNode } from "react";
3
+
4
+ /**
5
+ * Upload 组件属性
6
+ */
7
+ export interface UploadProps extends Omit<AntUploadProps, "fileList"> {
8
+ /** 文件列表 */
9
+ value?: UploadFile[];
10
+ /** 图片分辨率限制,如 "1920*1080" */
11
+ ratio?: `${number}*${number}`;
12
+ /** 是否显示提示,默认 true */
13
+ showTip?: boolean;
14
+ /** 文件大小限制(单位:MB),默认 10 */
15
+ size?: number;
16
+ /** 自定义提示内容 */
17
+ tipContent?: ReactNode;
18
+ /** listType 为 text 时上传按钮文本 */
19
+ uploadButtonText?: string;
20
+ /** 要上传的文件类型,默认 image */
21
+ fileType?: "image" | "video" | "document";
22
+ /** 获取上传过服务器删除的附件 */
23
+ onGetRemoveFile?: (file: Omit<UploadFile, "originFileObj">) => void;
24
+ }
25
+
26
+ /**
27
+ * 文件上传组件
28
+ * 支持文件格式、大小、分辨率验证,支持图片预览
29
+ */
30
+ declare const Upload: FC<UploadProps>;
31
+
32
+ export default Upload;
@@ -0,0 +1 @@
1
+ import{PlusOutlined as e,VideoCameraAddOutlined as t,UploadOutlined as n}from"@ant-design/icons";import{Upload as i,Modal as r,Button as o,message as l}from"antd";import{useState as a,useRef as s}from"react";import{jsxs as d,Fragment as c,jsx as u}from"react/jsx-runtime";const m=m=>{const{value:p=[],onChange:h,onPreview:g,onRemove:f,onGetRemoveFile:w,beforeUpload:v,maxCount:y,listType:$,accept:x,ratio:j="",showTip:F=!0,multiple:b=!0,size:C,tipContent:T,uploadButtonText:U,fileType:R,...P}=m,[z,L]=a(!1),[O,S]=a(""),B=s(new Set),I=".jpg,.jpeg,.png",M=".pdf,.doc,.docx",A=".mp4",D=R||(()=>{if(x){if("*"===x)return"document";const e=x.split(",");return e.some(e=>A.split(",").includes(e))?"video":e.some(e=>M.split(",").includes(e))?"document":e.some(e=>I.split(",").includes(e))?"image":"document"}return"image"})(),G="image"===D,N="video"===D,W="document"===D,k=$||("*"===x?"text":"image"===D?"picture-card":"text"),q=x?"*"===x?"":x:G?I:N?A:W?M:I,E=y||(N?1:G||W?4:1),H=C||(N?100:10),J=U||(N?"上传视频":"上传附件"),K=q.replace(/\./g,"").split(",").join("、"),Q=()=>T||`${[`最多上传${E}个文件`,q?`并且只能上传${K}格式的文件`:"可以上传任意格式的文件",H?`文件大小不能超过${H}M`:"",j?`只能上传${j}分辨率的图片`:""].filter(Boolean).join(",")}。`,V=G?u("div",{children:u(e,{style:{fontSize:32}})}):u(o,{type:"primary",icon:u(N?t:n,{}),children:J});return d(c,{children:[u(i,{fileList:p,multiple:b,maxCount:E,listType:k,accept:q,onChange:({fileList:e})=>{const t=q?q.split(","):[],n=j?j.split("*"):[],i=1024*H*1024,r=new Set(p.map(e=>e.uid)),o=e.filter(e=>!r.has(e.uid));if(0===o.length)return void h?.(e);const a=e=>{const n=e.name?.substring(e.name.lastIndexOf("."),e.name.length)||"";return!(t.length>0&&!t.includes(n)&&(B.current.has(e.uid)||(B.current.add(e.uid),l.warning(`${e.name}:只能上传${K}格式的文件`)),1))},s=e=>!(i&&e.size>i&&(B.current.has(e.uid)||(B.current.add(e.uid),l.warning(`${e.name}:文件大小不能超过${H}M`)),1)),d=e=>new Promise(t=>{if(2!==n.length||!e.type?.startsWith("image/"))return void t(!0);const i=t=>new Promise(i=>{const r=new Image;r.onload=()=>{const t=r.width===+n[0]&&r.height===+n[1];t||B.current.has(e.uid)||(B.current.add(e.uid),l.warning(`${e.name}:只能上传${j}分辨率的图片`)),i(t)},r.onerror=()=>i(!1),r.src=t});if(e.url)i(e.url).then(t);else{const n=new FileReader;n.onload=e=>{i(e.target.result).then(t)},n.onerror=()=>t(!1),n.readAsDataURL(e.originFileObj)}});(async e=>{const t=[],n=[];for(const i of e)a(i)&&s(i)&&await d(i)?t.push(i):n.push(i);return{validFiles:t,invalidFiles:n}})(o).then(({validFiles:e})=>{const t=[...p,...e];h?.(t)})},onPreview:e=>{G&&(S(e.url||e.thumbUrl),L(!0)),g?.(e)},onRemove:e=>(B.current.delete(e.uid),e.originFileObj||w?.(e),f?.(e)),beforeUpload:(e,t)=>!!v&&v(e,t),...P,children:p.length>=E?null:V}),F?Q()&&u("div",{style:{marginTop:10,color:"#ff4d4f"},children:Q()}):null,u(r,{open:z,title:"查看图片",footer:null,onCancel:()=>{L(!1)},children:u("img",{alt:"preview",style:{width:"100%",objectFit:"scale-down"},src:O})})]})};m.displayName="Upload";export{m as default};
@@ -0,0 +1,45 @@
1
+ import type { ForwardRefExoticComponent, RefAttributes } from "react";
2
+
3
+ export interface AliPlayerProps {
4
+ /** 播放地址 */
5
+ source?: string | string[];
6
+ /** 阿里的 vid */
7
+ vid?: string;
8
+ /** 阿里的 playAuth */
9
+ playAuth?: string;
10
+ /** 封面地址 */
11
+ cover?: string;
12
+ /** 播放器宽度,默认 100% */
13
+ width?: string;
14
+ /** 播放器高度,默认 600px */
15
+ height?: string;
16
+ /** 是否自动播放 */
17
+ autoplay?: boolean;
18
+ /** 是否显示进度条 */
19
+ showProgress?: boolean;
20
+ /** 是否直播模式 */
21
+ isLive?: boolean;
22
+ /** 播放开始时间 */
23
+ playTime?: number;
24
+ /** 播放结束事件 */
25
+ onEnded?: () => void;
26
+ /** 播放进度更新事件 */
27
+ onTimeupdate?: (currentTime: number) => void;
28
+ /** 获取播放器实例 */
29
+ onGetPlayerInstance?: (player: any) => void;
30
+ /** 传递给 AliPlayer 的属性 */
31
+ aliPlayerProps?: Record<string, any>;
32
+ }
33
+
34
+ export interface AliPlayerRef {
35
+ play: () => void;
36
+ pause: () => void;
37
+ getPlayerInstance: () => any;
38
+ }
39
+
40
+ /**
41
+ * 视频播放组件
42
+ */
43
+ declare const AliPlayer: ForwardRefExoticComponent<AliPlayerProps & RefAttributes<AliPlayerRef>>;
44
+
45
+ export default AliPlayer;
@@ -0,0 +1 @@
1
+ import{useDocumentVisibility as e}from"ahooks";import{uniqueId as a}from"lodash-es";import{forwardRef as t,useRef as i,useImperativeHandle as r,useEffect as n}from"react";import{dynamicLoadJs as l,dynamicLoadCss as s}from"../../utils/index.js";import{jsx as o}from"react/jsx-runtime";const p=t(({source:t="",vid:p="",playAuth:y="",cover:c="",width:m="100%",height:u="600px",autoplay:d=!0,showProgress:g=!0,isLive:h=!1,playTime:b=0,onEnded:w,onTimeupdate:x,onGetPlayerInstance:f,aliPlayerProps:v},P)=>{const k=i(null),D=i(null),j=e(),B=i(a("_")).current;r(P,()=>({play:()=>{k.current&&k.current.play()},pause:()=>{k.current&&k.current.pause()},getPlayerInstance:()=>k.current}));const L=()=>{k.current&&(k.current.dispose(),k.current=null)};return n(()=>((t||p&&y)&&(async()=>{if(!D.current)return;window.Aliplayer||(window?.base?.loadDynamicResource?(await window.base.loadDynamicResource({url:"https://g.alicdn.com/apsara-media-box/imp-web-player/2.27.0/aliplayer-min.js",type:"script",attr:{type:"text/javascript"}}),await window.base.loadDynamicResource({url:"https://g.alicdn.com/apsara-media-box/imp-web-player/2.27.0/skins/default/aliplayer-min.css",type:"link",attr:{rel:"stylesheet",type:"text/css"}})):(await l("https://g.alicdn.com/apsara-media-box/imp-web-player/2.27.0/aliplayer-min.js"),await s("https://g.alicdn.com/apsara-media-box/imp-web-player/2.27.0/skins/default/aliplayer-min.css"))),L();const e=[{name:"bigPlayButton",align:"blabs",x:30,y:80},{name:"H5Loading",align:"cc"},{name:"errorDisplay",align:"tlabs",x:0,y:0},{name:"infoDisplay"},{name:"tooltip",align:"blabs",x:0,y:56},{name:"thumbnail"},{name:"controlBar",align:"blabs",x:0,y:0,children:[{name:"playButton",align:"tl",x:15,y:12},{name:"timeDisplay",align:"tl",x:10,y:7},{name:"fullScreenButton",align:"tr",x:10,y:12},{name:"setting",align:"tr",x:15,y:12},{name:"volume",align:"tr",x:5,y:10}]}];g&&e[e.length-1].children.unshift({name:"progress",align:"blabs",x:0,y:44}),k.current=new window.Aliplayer({id:B,...t?{source:t}:{vid:p,playauth:y,qualitySort:"asc",format:"m3u8",encryptType:1,mediaType:"video",isLive:!0,rePlay:!1,playsinline:!0,controlBarVisibility:"hover"},cover:c,width:m,height:u,autoplay:d,isLive:h,useH5Prism:!0,skinLayout:e,...v},e=>{f&&f(e),d&&e.play(),e.on("ended",()=>{w&&w()}),e.on("timeupdate",()=>{x&&x(e.getCurrentTime())}),b>0&&e.seek(b)})})(),()=>{L()}),[t,p,y]),n(()=>{"hidden"===j?k.current&&k.current.pause():k.current&&k.current.play()},[j]),o("div",{ref:D,id:B,style:{width:m,height:u}})});p.displayName="AliPlayer";export{p as default};
@@ -0,0 +1,20 @@
1
+ import type { ForwardRefExoticComponent, RefAttributes } from "react";
2
+ import type { AliPlayerProps, AliPlayerRef } from "./AliPlayer";
3
+
4
+ export interface VideoProps extends AliPlayerProps {
5
+ /** 弹窗标题,默认 “视频” */
6
+ title?: string;
7
+ /** 是否显示弹窗 */
8
+ visible?: boolean;
9
+ /** 是否内联模式 */
10
+ inline?: boolean;
11
+ /** 弹窗关闭事件 */
12
+ onCancel?: () => void;
13
+ }
14
+
15
+ /**
16
+ * 视频播放组件
17
+ */
18
+ declare const Video: ForwardRefExoticComponent<VideoProps & RefAttributes<AliPlayerRef>>;
19
+
20
+ export default Video;
@@ -0,0 +1 @@
1
+ import{Modal as e,Button as r}from"antd";import{forwardRef as t,useState as n,useRef as a,useImperativeHandle as o,useEffect as i}from"react";import{getFileUrl as l}from"../../utils/index.js";import s from"./AliPlayer.js";import{jsx as c}from"react/jsx-runtime";const u=t(({source:t="",vid:u="",playAuth:p="",cover:d="",autoplay:m=!0,showProgress:y=!0,playTime:h=0,inline:P=!1,isLive:f=!1,width:v="100%",height:g="600px",title:w="视频",visible:x=!1,onCancel:I,onEnded:T,onTimeupdate:j,onGetPlayerInstance:A,aliPlayerProps:C={}},b)=>{const[k,E]=n(!1),G=a(null);o(b,()=>({play:()=>{G.current&&G.current.play()},pause:()=>{G.current&&G.current.pause()},getPlayerInstance:()=>G.current&&G.current.getPlayerInstance()}));const L=I?x:k,N=I||E;i(()=>{P||(L?G.current&&G.current.play():G.current&&G.current.pause())},[L,P]);const V=c(s,{ref:G,source:(()=>{if(t)return t.includes("http")||t.includes("https")?t:l()+t})(),vid:u,playAuth:p,cover:d,autoplay:m,showProgress:y,playTime:h,isLive:f,width:v,height:g,aliPlayerProps:C,onEnded:T,onTimeupdate:j,onGetPlayerInstance:A});return P?V:c(e,{open:L,width:800,title:w,footer:[c(r,{onClick:()=>N(!1),children:"关闭"},"cancel")],mask:{closable:!1},onCancel:()=>N(!1),children:V})});u.displayName="Video";export{u as default};
@@ -0,0 +1,22 @@
1
+ import type { FC } from "react";
2
+
3
+ export interface WordProps {
4
+ /** 是否显示弹窗 */
5
+ visible?: boolean;
6
+ /** 关闭回调 */
7
+ onCancel?: () => void;
8
+ /** docx 文件地址 */
9
+ file?: string;
10
+ /** docx 文件名 */
11
+ name?: string;
12
+ /** 是否内联展示 */
13
+ inline?: boolean;
14
+ /** 弹窗标题 */
15
+ title?: string;
16
+ /** 内容样式 */
17
+ style?: Record<string, any>;
18
+ }
19
+
20
+ declare const Word: FC<WordProps>;
21
+
22
+ export default Word;