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 @@
1
+ import{Modal as r,Button as e,message as n,Spin as t}from"antd";import{renderAsync as i}from"docx-preview";import{useRef as o,useState as l,useEffect as a}from"react";import c from"../../hooks/useDownloadFile/index.js";import{getFileUrl as d}from"../../utils/index.js";import{jsx as u}from"react/jsx-runtime";function s(s){const{visible:f=!1,onCancel:m,file:p,name:h,inline:w=!1,title:g="Word预览",style:y={}}=s,v=o(null),x=o(null),k=o(!1),W=d(),[C,b]=l(!1),{downloadFile:T}=c();a(()=>{if(!f&&!w||!p)return;k.current=!1;const r=setTimeout(()=>{(async()=>{b(!0),v.current.innerHTML="";try{const r=await fetch(p.includes(W)?p:W+p);if(!r.ok)throw new Error("加载 Word 文件失败");const e=await r.arrayBuffer();if(k.current)return;await i(e,v.current,null,{className:"docx-preview",inWrapper:!0,ignoreWidth:!1,ignoreHeight:!1,breakPages:!0})}catch{n.error("加载 Word 文件失败"),!w&&m&&m()}finally{k.current||b(!1)}})()},100);return()=>{k.current=!0,v.current&&(v.current.innerHTML=""),r&&clearTimeout(r)}},[f,w,p]);const j=()=>u(t,{spinning:C,children:u("div",{style:{height:"72vh",overflowY:"auto",padding:"24px",background:"#f5f5f5",...y},children:u("div",{ref:v})})});return w?j():u("div",{ref:x,children:u(r,{style:{top:100,maxWidth:"calc(100vw - 32px)",paddingBottom:24},open:f,mask:{closable:!1},width:900,title:g,onCancel:()=>{m()},getContainer:!1,footer:[u(e,{onClick:()=>{m()},children:"关闭"},"cancel"),u(e,{type:"primary",onClick:()=>{T({url:p,name:h})},children:"下载"},"download")],children:j()})})}s.displayName="Word";export{s as default};
@@ -0,0 +1,35 @@
1
+ .@{ant-prefix}-modal-header {
2
+ border-bottom: 1px solid #ccc !important;
3
+ margin: 0 -24px 15px -24px !important;
4
+ padding: 0 24px 15px 24px !important;
5
+ }
6
+
7
+ .@{ant-prefix}-modal-footer {
8
+ justify-content: center !important;
9
+ }
10
+
11
+ .search-layout {
12
+ position: relative;
13
+
14
+ &::after {
15
+ content: '';
16
+ position: absolute;
17
+ bottom: -10px;
18
+ left: -20px;
19
+ right: -20px;
20
+ height: 10px;
21
+ background-color: rgb(241, 241, 242);
22
+ }
23
+
24
+ + .table-layout {
25
+ padding-top: 26px !important;
26
+ }
27
+ }
28
+
29
+ .table-layout {
30
+ }
31
+
32
+ .card-layout {
33
+ background-color: #fff;
34
+ border-radius: 6px;
35
+ }
@@ -0,0 +1,68 @@
1
+ import type { CheckboxProps } from "antd/es/checkbox";
2
+ import type { DatePickerProps, MonthPickerProps, RangePickerProps, WeekPickerProps } from "antd/es/date-picker";
3
+ import type { DividerProps } from "antd/es/divider";
4
+ import type { FormListProps } from "antd/es/form";
5
+ import type { InputProps, TextAreaProps } from "antd/es/input";
6
+ import type { InputNumberProps } from "antd/es/input-number";
7
+ import type { RadioProps } from "antd/es/radio";
8
+ import type { SelectProps } from "antd/es/select";
9
+
10
+ /**
11
+ * 表单项类型枚举
12
+ */
13
+ export declare const FORM_ITEM_RENDER_ENUM: {
14
+ /** 映射为 antd Input */
15
+ INPUT: "input";
16
+ /** 映射为 antd Input.TextArea */
17
+ TEXTAREA: "textarea";
18
+ /** 映射为 antd InputNumber */
19
+ INPUT_NUMBER: "inputNumber";
20
+ /** 映射为 antd InputNumber */
21
+ NUMBER: "number";
22
+ /** 映射为 antd InputNumber */
23
+ INTEGER: "integer";
24
+ /** 映射为 antd Select */
25
+ SELECT: "select";
26
+ /** 映射为 antd Radio.Group */
27
+ RADIO: "radio";
28
+ /** 映射为 antd Checkbox.Group */
29
+ CHECKBOX: "checkbox";
30
+ /** 映射为 antd DatePicker,日期格式为YYYY-MM-DD */
31
+ DATE: "date";
32
+ /** 映射为 antd DatePicker.MonthPicker,日期格式为YYYY-MM */
33
+ DATE_MONTH: "dateMonth";
34
+ /** 映射为 antd DatePicker.YearPicker,日期格式为YYYY */
35
+ DATE_YEAR: "dateYear";
36
+ /** 映射为 antd DatePicker.WeekPicker,日期格式为YYYY-wo */
37
+ DATE_WEEK: "dateWeek";
38
+ /** 映射为 antd DatePicker.RangePicker,日期格式为YYYY-MM-DD */
39
+ DATE_RANGE: "dateRange";
40
+ /** 映射为 antd DatePicker,日期格式为YYYY-MM-DD HH:mm:ss */
41
+ DATETIME: "datetime";
42
+ /** 映射为 antd DatePicker.RangePicker,日期格式为YYYY-MM-DD HH:mm:ss */
43
+ DATETIME_RANGE: "datetimeRange";
44
+ /** 映射为 antd Divider */
45
+ DIVIDER: "divider";
46
+ /** 映射为 antd FormList */
47
+ FORM_LIST: "formList";
48
+ };
49
+
50
+ export interface FORM_ITEM_RENDER_TYPE_MAP {
51
+ input: InputProps;
52
+ textarea: TextAreaProps;
53
+ inputNumber: InputNumberProps;
54
+ number: InputNumberProps;
55
+ integer: InputNumberProps;
56
+ select: SelectProps;
57
+ radio: RadioProps;
58
+ checkbox: CheckboxProps;
59
+ date: DatePickerProps;
60
+ dateMonth: MonthPickerProps;
61
+ dateYear: DatePickerProps;
62
+ dateWeek: WeekPickerProps;
63
+ dateRange: RangePickerProps;
64
+ datetime: DatePickerProps;
65
+ datetimeRange: RangePickerProps;
66
+ divider: DividerProps;
67
+ formList: FormListProps;
68
+ }
@@ -0,0 +1 @@
1
+ const e={INPUT:"input",TEXTAREA:"textarea",INPUT_NUMBER:"inputNumber",NUMBER:"number",INTEGER:"integer",SELECT:"select",RADIO:"radio",CHECKBOX:"checkbox",DATE:"date",DATE_MONTH:"dateMonth",DATE_YEAR:"dateYear",DATE_WEEK:"dateWeek",DATE_RANGE:"dateRange",DATETIME:"datetime",DATETIME_RANGE:"datetimeRange",DIVIDER:"divider",FORM_LIST:"formList"};export{e as FORM_ITEM_RENDER_ENUM};
@@ -0,0 +1,22 @@
1
+ export interface DeleteFileItem {
2
+ /** 文件URL */
3
+ filePath?: string;
4
+ /** 文件ID */
5
+ id?: string;
6
+ [key: string]: any;
7
+ }
8
+
9
+ export interface DeleteFileOptions {
10
+ /** 要删除的文件列表 */
11
+ files: DeleteFileItem[];
12
+ /** 是否单文件删除 */
13
+ single?: boolean;
14
+ }
15
+
16
+ export type DeleteFileFunction = (options: DeleteFileOptions) => Promise<void | any>;
17
+
18
+ /**
19
+ * 删除文件
20
+ */
21
+ export default function useDeleteFile(returnType: "array"): [boolean, DeleteFileFunction];
22
+ export default function useDeleteFile(returnType?: "object"): { loading: boolean; deleteFile: DeleteFileFunction };
@@ -0,0 +1 @@
1
+ import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as i}from"react";import{getBaseGateway as t}from"../../utils/index.js";function l(l="object"){const[r,o]=i(!1);let s=0;const n=i=>{if(i)return s++,s>0&&o(!0),new Promise((l,r)=>{const{files:n=[],single:f=!0}=i;if(n)if(Array.isArray(n)){if(0===n.length)return s--,s<=0&&o(!1),void l();if(f){if(!n[0].filePath)return s--,s<=0&&o(!1),void l()}else if(0===n.filter(e=>e.id).length)return s--,s<=0&&o(!1),void l();e(f?`/${t()}/imgFiles/delete?filePath=${n[0].filePath}`:`/${t()}/imgFiles/ids?ids=${n.filter(e=>e.id).map(e=>e.id)}`,"delete").then(e=>{l(e.data)}).catch(e=>{r(e)}).finally(()=>{s--,s<=0&&o(!1)})}else console.error("【deleteFile】 的 files 需要是一个数组");else console.error("【deleteFile】 缺少 files 参数")});console.error("【deleteFile】 缺少 options 参数")};return"array"===l?[r,n]:{loading:r,deleteFile:n}}export{l as default};
@@ -0,0 +1,24 @@
1
+ export interface getDictionaryOptions {
2
+ /** appKey,默认 DICTIONARY_APP_KEY_ENUM.DEFAULT(0bb989ecada5470c87635018ece9f327) */
3
+ appKey?: string;
4
+ /** 要获取的字典 */
5
+ dictValue: string;
6
+ }
7
+
8
+ export interface DictionaryItem {
9
+ /** label */
10
+ dictLabel: string;
11
+ /** value */
12
+ dictValue: string;
13
+ /** 子级 */
14
+ children: DictionaryItem[];
15
+ [key: string]: any;
16
+ }
17
+
18
+ export type getDictionaryFunction = (options: getDictionaryOptions) => Promise<DictionaryItem[]>;
19
+
20
+ /**
21
+ * 获取数据字典
22
+ */
23
+ export default function useDictionary(returnType: "array"): [boolean, getDictionaryFunction];
24
+ export default function useDictionary(returnType?: "object"): { loading: boolean; getDictionary: getDictionaryFunction };
@@ -0,0 +1 @@
1
+ import{request as t}from"@cqsjjb/jjb-common-lib/http.js";import{useState as o}from"react";import{DICTIONARY_APP_KEY_ENUM as e}from"zy-react-data/enum/dictionary";function i(i="object"){const[r,a]=o(!1);let c=0;const n=o=>{if(o)return c++,c>0&&a(!0),new Promise((i,r)=>{const{appKey:n=e.DEFAULT,dictValue:s}=o;Object.values(e).includes(n)?s?t("/config/dict-trees/list/by/dictValues","get",{appKey:n,dictValue:s}).then(t=>{i(t.data)}).catch(t=>{r(t)}).finally(()=>{c--,c<=0&&a(!1)}):console.error("【getDictionary】 缺少 options.dictValue 参数"):console.error(`【getDictionary】 传入的 options.appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 options.appKey 是 ${n}`)});console.error("【getDictionary】 缺少 options 参数")};return"array"===i?[r,n]:{loading:r,getDictionary:n}}export{i as default};
@@ -0,0 +1,16 @@
1
+ interface UseDownloadBlobOptions {
2
+ /** 下载文件的自定义文件名(不含后缀),默认为当前时间戳 */
3
+ name?: string;
4
+ /** Blob 对象的 MIME 类型,默认为 Excel 类型 */
5
+ type?: string;
6
+ /** 请求时携带的查询参数对象 */
7
+ params?: Record<string, any>;
8
+ }
9
+
10
+ export type DownloadBlobFunction = (url: string, options?: UseDownloadBlobOptions) => Promise<{ data: Blob }>;
11
+
12
+ /**
13
+ * 下载Blob流文件
14
+ */
15
+ export default function useDownloadBlob(returnType: "array"): [boolean, DownloadBlobFunction];
16
+ export default function useDownloadBlob(returnType?: "object"): { loading: boolean; downloadBlob: DownloadBlobFunction };
@@ -0,0 +1 @@
1
+ import{message as o}from"antd";import e from"dayjs";import{useState as n}from"react";function t(t="object"){const[r,a]=n(!1);let d=0;const c=(n,t)=>{if(d++,d>0&&a(!0),n)return new Promise((r,c)=>{const{name:l="",type:s="",params:i={}}=t,m=new URL((process.env.app.API_HOST||window.__JJB_ENVIRONMENT__.API_HOST)+n);Object.entries(i).forEach(([o,e])=>{m.searchParams.append(o,e)}),fetch(m,{method:"GET",mode:"cors",headers:{"Content-Type":"application/json",token:window.sessionStorage.token}}).then(o=>{if(o.ok)return o.blob();console.error("【downloadBlob】 网络响应异常")}).then(o=>{const n=new Blob([o],{type:s||"application/vnd.ms-excel"}),t=document.createElement("a"),a=window.URL.createObjectURL(n);t.style.display="none",t.href=a,t.download=l||e().format("YYYY-MM-DD HH:mm:ss"),document.body.appendChild(t),t.click(),document.body.removeChild(t),window.URL.revokeObjectURL(a),r({data:n})}).catch(e=>{o.error("导出失败"),c(e)}).finally(()=>{d--,d<=0&&a(!1)})});console.error("【downloadBlob】 缺少 url 参数")};return"array"===t?[r,c]:{loading:r,downloadBlob:c}}export{t as default};
@@ -0,0 +1,14 @@
1
+ export interface DownloadFileOptions {
2
+ /** 下载文件的URL */
3
+ url: string;
4
+ /** 下载文件的自定义文件名 */
5
+ name?: string;
6
+ }
7
+
8
+ export type DownloadFileFunction = (options: DownloadFileOptions) => void;
9
+
10
+ /**
11
+ * 下载文件
12
+ */
13
+ export default function useDownloadFile(returnType: "array"): [boolean, DownloadFileFunction];
14
+ export default function useDownloadFile(returnType?: "object"): { loading: boolean; downloadFile: DownloadFileFunction };
@@ -0,0 +1 @@
1
+ import{Modal as o,message as e}from"antd";import{useState as n}from"react";import{getFileUrl as t,getFileSuffix as c,getFileName as r}from"../../utils/index.js";function l(l="object"){const[d,a]=n(!1);let i=0;const m=n=>{i++,i>0&&a(!0);const{url:l,name:d}=n;l?o.confirm({title:"提示",content:"确定要下载此文件吗?",onOk:()=>{const o=t();let n=d;n?!c(n)&&c(l)&&(n=`${n}.${c(l)}`):n=r(l),fetch(l.includes(o)?l:o+l).then(o=>o.blob()).then(o=>{const e=document.createElement("a");document.body.appendChild(e),e.style.display="none";const t=window.URL.createObjectURL(o);e.href=t,e.download=`${n}`,e.click(),document.body.removeChild(e),window.URL.revokeObjectURL(t)}).catch(()=>{e.error("下载失败")}).finally(()=>{i--,i<=0&&a(!1)})},onCancel:()=>{i--,i<=0&&a(!1)}}):console.error("【downloadFile】 缺少 url 参数")};return"array"===l?[d,m]:{loading:d,downloadFile:m}}export{l as default};
@@ -0,0 +1,49 @@
1
+ export interface GetFileItem {
2
+ /** 文件路径 */
3
+ filePath: string;
4
+ /** 文件名称 */
5
+ fileName: string;
6
+ /** 文件ID */
7
+ id: string;
8
+ /** 文件URL(由addingPrefixToFile函数添加) */
9
+ url: string;
10
+ /** 文件名称(由addingPrefixToFile函数添加) */
11
+ name: string;
12
+ [key: string]: any;
13
+ }
14
+
15
+ export interface BaseParams {
16
+ /** 文件类型 */
17
+ eqType: number;
18
+ }
19
+
20
+ export interface SingleGetFileOptions extends BaseParams {
21
+ /** 外键ID */
22
+ eqForeignKey: string;
23
+ /** 是否单文件获取 */
24
+ single?: true;
25
+ }
26
+
27
+ export interface MultipleGetFileOptions extends BaseParams {
28
+ /** dataSource 中外键ID的 key */
29
+ foreignKey: string;
30
+ /** 是否单文件获取 */
31
+ single: false;
32
+ /** 数据源 */
33
+ dataSource: Record<string, any>[];
34
+ }
35
+
36
+ export type SingleFileResponse = GetFileItem[];
37
+
38
+ export type MultipleFileResponse = Array<Record<string, any> & { files: GetFileItem[] }>;
39
+
40
+ export interface GetFileFunction {
41
+ (options: SingleGetFileOptions): Promise<SingleFileResponse>;
42
+ (options: MultipleGetFileOptions): Promise<MultipleFileResponse>;
43
+ }
44
+
45
+ /**
46
+ * 获取文件
47
+ */
48
+ export default function useGetFile(returnType: "array"): [boolean, GetFileFunction];
49
+ export default function useGetFile(returnType?: "object"): { loading: boolean; getFile: GetFileFunction };
@@ -0,0 +1 @@
1
+ import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as o}from"react";import{UPLOAD_FILE_TYPE_ENUM as r}from"zy-react-data/enum/uploadFile";import{getBaseGateway as i,addingPrefixToFile as t}from"../../utils/index.js";function n(n="object"){const[l,s]=o(!1);let a=0;const c=o=>{if(o)return a++,a>0&&s(!0),new Promise((n,l)=>{const{eqType:c,eqForeignKey:p,single:f=!0,foreignKey:g,dataSource:u}=o;if(!c)return void console.error("【getFile】 缺少 options.eqType 参数");if(!Object.values(r).includes(c))return void console.error(`【getFile】 传入的 eqType 不在 UPLOAD_FILE_TYPE_ENUM 中,当前传入的 eqType 是 ${c}`);if(f){if(null==p||""===p)return void console.error("【getFile】 缺少 options.eqForeignKey 参数")}else{if(null==g||""===g)return void console.error("【getFile】 缺少 options.foreignKey 参数");if(null==u||""===u)return void console.error("【getFile】 缺少 options.dataSource 参数");if(0===u.length)return s(!1),void n(u)}const y=f?{eqType:c,eqForeignKey:p}:{eqType:c,inForeignKey:u.map(e=>e[g]).join(",")};e(`/${i()}/imgFiles/listAll`,"get",y).then(e=>{if(f)n(t(e.data).map(e=>({...e,type:void 0})));else{const o=new Map;e.data.forEach(e=>{o.has(e.foreignKey)||o.set(e.foreignKey,[]),o.get(e.foreignKey).push({...e,type:void 0})});const r=u.map(e=>{const r=e[g],i=o.has(r)?t(o.get(r)):[];return{...e,files:i}});n(r)}}).catch(e=>{l(e)}).finally(()=>{a--,a<=0&&s(!1)})});console.error("【getFile】 缺少 options 参数")};return"array"===n?[l,c]:{loading:l,getFile:c}}export{n as default};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 获取路由参数
3
+ */
4
+ export default function useGetUrlQuery(): Record<string, any>;
@@ -0,0 +1 @@
1
+ function n(){const n=new URLSearchParams(window.location.search),o={};for(const[e,r]of n.entries())o[e]=r;return o}export{n as default};
@@ -0,0 +1,21 @@
1
+ interface UserInfoData {
2
+ corpinfoId: string;
3
+ corpinfoName: string;
4
+ departmentId: string;
5
+ departmentName: string;
6
+ id: string;
7
+ name: string;
8
+ postId: string;
9
+ postName: string;
10
+ userId: string;
11
+ username: string;
12
+ [key: string]: any;
13
+ }
14
+
15
+ export type getUserInfoFunction = () => Promise<UserInfoData>;
16
+
17
+ /**
18
+ * 获取用户信息
19
+ */
20
+ export default function useGetUserInfo(returnType: "array"): [boolean, getUserInfoFunction];
21
+ export default function useGetUserInfo(returnType?: "object"): { loading: boolean; getUserInfo: getUserInfoFunction };
@@ -0,0 +1 @@
1
+ import{request as t}from"@cqsjjb/jjb-common-lib/http.js";import{useState as o}from"react";import{getBaseGateway as e}from"../../utils/index.js";function r(r="object"){const[n,a]=o(!1);let i=0;const s=()=>(i++,i>0&&a(!0),new Promise((o,r)=>{t(`/${e()}/user/getInfo`,"get",{}).then(t=>{o(t.data)}).catch(t=>{r(t)}).finally(()=>{i--,i<=0&&a(!1)})}));return"array"===r?[n,s]:{loading:n,getUserInfo:s}}export{r as default};
@@ -0,0 +1,11 @@
1
+ export interface UseIdleOptions {
2
+ /** 空闲超时时间(毫秒),默认值 10000 */
3
+ timeout?: number;
4
+ /** 监听的事件列表,默认值 ["mousemove", "mousedown", "resize", "keydown", "touchstart", "wheel"] */
5
+ events?: string[];
6
+ }
7
+
8
+ /**
9
+ * 检测用户是否处于空闲状态
10
+ */
11
+ export default function useIdle(options?: UseIdleOptions): boolean;
@@ -0,0 +1 @@
1
+ import{useState as e,useEffect as t}from"react";function o(o={}){const{timeout:r=1e4,events:n=["mousemove","mousedown","resize","keydown","touchstart","wheel"]}=o,[s,i]=e(!1);return t(()=>{let e;const t=()=>{i(!0)},o=()=>{clearTimeout(e),e=setTimeout(t,r)};s||o();const u=()=>{s?i(!1):o()};return n.forEach(e=>{window.addEventListener(e,u,{passive:!0})}),()=>{clearTimeout(e),n.forEach(e=>{window.removeEventListener(e,u)})}},[r,n,s]),s}export{o as default};
@@ -0,0 +1,16 @@
1
+ import type { UploadFile } from "antd/es/upload";
2
+
3
+ interface UseImportFileOptions {
4
+ /** 要上传的文件数组 */
5
+ files: UploadFile[];
6
+ /** 额外携带的参数对象 */
7
+ params?: Record<string, any>;
8
+ }
9
+
10
+ export type ImportFileFunction = (url: string, options: UseImportFileOptions) => Promise<any>;
11
+
12
+ /**
13
+ * 导入文件
14
+ */
15
+ export default function useImportFile(returnType: "array"): [boolean, ImportFileFunction];
16
+ export default function useImportFile(returnType?: "object"): { loading: boolean; importFile: ImportFileFunction };
@@ -0,0 +1 @@
1
+ import{request as o}from"@cqsjjb/jjb-common-lib/http.js";import{useState as r}from"react";function t(t="object"){const[e,i]=r(!1);let n=0;const a=(r,t)=>{if(n++,n>0&&i(!0),r)return new Promise((e,a)=>{const{files:l=[],params:c={}}=t,p=new FormData;l.forEach(o=>{o.originFileObj&&p.append("file",o.originFileObj)}),Object.keys(c).forEach(o=>{p.append(o,c[o])}),o(r,"post",p,{"Content-Type":"multipart/form-data"}).then(o=>{e(o)}).catch(o=>{a(o)}).finally(()=>{n--,n<=0&&i(!1)})});console.error("【importFile】 缺少 url 参数")};return"array"===t?[e,a]:{loading:e,importFile:a}}export{t as default};
@@ -0,0 +1,22 @@
1
+ interface IsExistenceDuplicateSelectionOptions<T> {
2
+ /** 需要检查重复项的目标数组 */
3
+ data: T[];
4
+ /** 用于去重判断的对象属性名 */
5
+ key: keyof T | string;
6
+ /** 可选的错误提示信息 */
7
+ message?: string;
8
+ }
9
+
10
+ /**
11
+ * 检查数组中是否存在重复项的函数
12
+ */
13
+ interface IsExistenceDuplicateSelectionFunction {
14
+ <T>(options: IsExistenceDuplicateSelectionOptions<T>): Promise<void>;
15
+ }
16
+
17
+ /**
18
+ * 检查数组中是否存在重复项
19
+ */
20
+ export default function useIsExistenceDuplicateSelection(): {
21
+ isExistenceDuplicateSelection: IsExistenceDuplicateSelectionFunction;
22
+ };
@@ -0,0 +1 @@
1
+ import{message as e}from"antd";import{uniqBy as t}from"lodash-es";function r(){return{isExistenceDuplicateSelection:r=>{const{data:n,key:o,message:s="存在重复项,请勿重复选择"}=r;return new Promise(r=>{t(n,o).length!==n.length?e.error(s):r()})}}}export{r as default};
@@ -0,0 +1,75 @@
1
+ import type { AntdTableOptions, AntdTableResult, Data, Params, Service } from "ahooks/lib/useAntdTable/types";
2
+ import type { FormInstance } from "antd/es/form";
3
+
4
+ type FormValues = Record<string, any>;
5
+ /**
6
+ * useTable 钩子的选项参数
7
+ */
8
+ export interface UseTableOptions<TData extends Data, TParams extends Params> extends Omit<AntdTableOptions<TData, TParams>, "defaultParams" | "form" | "defaultType"> {
9
+ /** 是否使用分页,默认是 */
10
+ usePagination?: boolean;
11
+ /** 默认分页参数,默认 { current: 1; pageSize: 10 } */
12
+ defaultPagination?: { current: number; pageSize: number };
13
+ /** 是否使用存储查询条件,默认是 */
14
+ useStorageQueryCriteria?: boolean;
15
+ /** 是否使用数据权限,默认是 */
16
+ usePermission?: boolean;
17
+ /** 额外参数 */
18
+ params?: Record<string, any> | (() => Record<string, any>);
19
+ /** 表单数据转换函数,在每次请求之前调用,接收当前搜索的表单项,要求返回一个对象 */
20
+ transform?: (formData: FormValues) => FormValues;
21
+ /** 表单实例(通过 Form.useForm() 创建) */
22
+ form?: FormInstance;
23
+ }
24
+
25
+ /**
26
+ * 基础分页配置接口
27
+ */
28
+ export interface BasePaginationConfig {
29
+ /** 当前页码 */
30
+ current: number;
31
+ /** 每页数量 */
32
+ pageSize: number;
33
+ /** 总数 */
34
+ total: number;
35
+ }
36
+
37
+ /**
38
+ * 扩展分页配置接口
39
+ */
40
+ export interface ExtendedPaginationConfig extends BasePaginationConfig {
41
+ /** 显示快速跳转 */
42
+ showQuickJumper: boolean;
43
+ /** 显示页码选择器 */
44
+ showSizeChanger: boolean;
45
+ }
46
+
47
+ /**
48
+ * useTable 钩子返回的结果
49
+ */
50
+ export interface UseTableResult<TData extends Data, TParams extends Params> extends AntdTableResult<TData, TParams> {
51
+ /** 表格属性 */
52
+ tableProps: {
53
+ /** 表格数据 */
54
+ dataSource: TData["list"];
55
+ /** 表格加载状态 */
56
+ loading: boolean;
57
+ /** 表格改变 */
58
+ onChange: (pagination: any, filters?: any, sorter?: any) => void;
59
+ /** 分页属性 */
60
+ pagination: false | ExtendedPaginationConfig;
61
+ [key: string]: any;
62
+ };
63
+ /** 查询方法,等于直接调用 search.submit */
64
+ getData: () => void;
65
+ }
66
+
67
+ /**
68
+ * 自定义 useTable,继承 ahooks 的 useAntdTable,根据需求进行扩展
69
+ */
70
+ declare function useTable<TData extends Data, TParams extends Params>(
71
+ service: Service<TData, TParams>,
72
+ options?: UseTableOptions<TData, TParams>,
73
+ ): UseTableResult<TData, TParams>;
74
+
75
+ export default useTable;
@@ -0,0 +1 @@
1
+ import{useAntdTable as e}from"ahooks";import t from"../useUrlQueryCriteria/index.js";function a(a,r){if(!a)return void console.error("【useTable】 缺少 service 参数");const{params:n,transform:o,...i}=r||{},{useStorageQueryCriteria:s=!0,usePagination:u=!0,usePermission:c=!0,defaultType:p="advance",defaultCurrent:l=1,defaultPageSize:g=20,defaultPagination:f={current:l,pageSize:g},...m}=i,{setUrlCriteriaQuery:y,getUrlCriteriaQuery:d}=t(),h=s?d("searchFormKeys","searchFormValues"):{},P=s&&u?d("paginationKeys","paginationValues"):{},S=Object.keys(h).length>0?h:{},b=u?Object.keys(P).length>0?P:f:{},z=e(function(e,t={},a,r){const n=("function"==typeof t?t():t)||{};return async({current:t,pageSize:o},i={})=>{let s=i;if("function"==typeof a){const e=a(i);e&&"object"==typeof e&&(s={...i,...e})}const u={pageIndex:t,pageSize:o,...s,...n};r&&(u.menuPath=window.location.pathname);const c=await e(u);return{list:c.data||[],total:c.totalCount||0,...c}}}(a,n,o,c),{...m,defaultParams:[b,S],defaultType:p,onSuccess:(e,t)=>{i.onSuccess&&i.onSuccess(e,t),s&&y(t[1]??{},u?{current:z.tableProps.pagination.current,pageSize:z.tableProps.pagination.pageSize}:{})}});return{...z,tableProps:{...z.tableProps,pagination:!!u&&{...z.tableProps.pagination,showQuickJumper:!0,showSizeChanger:!0}},getData:z.search.submit}}export{a as default};
@@ -0,0 +1,67 @@
1
+ export interface UploadFile {
2
+ /** 原始文件对象 */
3
+ originFileObj?: File;
4
+ /** 文件URL */
5
+ filePath?: string;
6
+ /** 文件ID */
7
+ id?: string;
8
+ [key: string]: any;
9
+ }
10
+
11
+ export interface BaseParams {
12
+ /** 文件类型 */
13
+ type: number;
14
+ /** 企业id */
15
+ corpinfoId?: string;
16
+ }
17
+
18
+ export interface SingleParams extends BaseParams {
19
+ /** 外键id - 单文件上传时可选 */
20
+ foreignKey?: string;
21
+ }
22
+
23
+ export interface MultipleParams extends BaseParams {
24
+ /** 外键id - 多文件上传时必填 */
25
+ foreignKey: string;
26
+ }
27
+
28
+ export interface SingleUploadFileOptions {
29
+ /** 要上传的文件 */
30
+ files: UploadFile[];
31
+ /** 是否单文件上传 */
32
+ single?: true;
33
+ /** 上传的参数 */
34
+ params: SingleParams;
35
+ }
36
+
37
+ export interface MultipleUploadFileOptions {
38
+ /** 要上传的文件 */
39
+ files: UploadFile[];
40
+ /** 是否单文件上传 */
41
+ single: false;
42
+ /** 上传的参数 */
43
+ params: MultipleParams;
44
+ }
45
+
46
+ export interface SingleFileResponse {
47
+ /** 文件路径 */
48
+ filePath: string;
49
+ [key: string]: any;
50
+ }
51
+
52
+ export interface MultipleFileResponse {
53
+ /** 文件ID */
54
+ id: string;
55
+ [key: string]: any;
56
+ }
57
+
58
+ export interface UploadFileFunction {
59
+ (options: SingleUploadFileOptions): Promise<SingleFileResponse>;
60
+ (options: MultipleUploadFileOptions): Promise<MultipleFileResponse>;
61
+ }
62
+
63
+ /**
64
+ * 上传文件
65
+ */
66
+ export default function useUploadFile(returnType: "array"): [boolean, UploadFileFunction];
67
+ export default function useUploadFile(returnType?: "object"): { loading: boolean; uploadFile: UploadFileFunction };
@@ -0,0 +1 @@
1
+ import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as o}from"react";import{UPLOAD_FILE_TYPE_ENUM as r,UPLOAD_FILE_PATH_ENUM as i}from"zy-react-data/enum/uploadFile";import{getBaseGateway as t}from"../../utils/index.js";function l(l="object"){const[n,a]=o(!1);let p=0;const s=o=>{if(o)return p++,p>0&&a(!0),new Promise((l,n)=>{const{files:s=[],single:f=!0,params:d}=o;if(!s)return void console.error("【uploadFile】 缺少 files 参数");if(!Array.isArray(s))return void console.error("【uploadFile】 的 files 需要是一个数组");if(!d)return void console.error("【uploadFile】 缺少 options.params 参数");if(!d.type)return void console.error("【uploadFile】 缺少 options.params.type 参数");if(!Object.values(r).includes(d.type))return void console.error(`【uploadFile】 传入的 type 不在 UPLOAD_FILE_TYPE_ENUM 中,当前传入的 type 是 ${d.type}`);const u=i[d.type];if(!u)return void console.error(`【uploadFile】未找到 type ${d.type} 对应的 path `);if(!f){if(!d.hasOwnProperty("foreignKey"))return void console.error("【uploadFile】 的 single 是 false,缺少 options.params.foreignKey 参数");void 0!==d.foreignKey&&null!==d.foreignKey||(d.foreignKey="")}if(0===s.length)return p--,p<=0&&a(!1),void l(f?{filePath:""}:{id:d.foreignKey});const c=new FormData;if(s.forEach(e=>{e.originFileObj&&c.append("files",e.originFileObj)}),Object.keys(d).forEach(e=>{c.append(e,d[e])}),c.append("path",u),0===c.getAll("files").length)return p--,p<=0&&a(!1),void l(f?{filePath:s[0].filePath}:{id:d.foreignKey});e(f?`/${t()}/imgFiles/save`:`/${t()}/imgFiles/batchSave`,"post",c,{"Content-Type":"multipart/form-data"}).then(e=>{l(f?{filePath:e.data.filePath}:{id:e.data.foreignKey})}).catch(e=>{n(e)}).finally(()=>{p--,p<=0&&a(!1)})});console.error("【uploadFile】 缺少 options 参数")};return"array"===l?[n,s]:{loading:n,uploadFile:s}}export{l as default};
@@ -0,0 +1,8 @@
1
+ export type SetUrlCriteriaQueryFunction = (searchForm: Record<string, any>, pagination: Record<string, any>) => void;
2
+
3
+ export type GetUrlCriteriaQueryFunction = (keysStr: "searchFormKeys" | "paginationKeys" | string, valuesStr: "searchFormValues" | "paginationValues" | string) => Record<string, any>;
4
+
5
+ /**
6
+ * 处理搜索条件缓存到 URL
7
+ */
8
+ export default function useUrlQueryCriteria(): { setUrlCriteriaQuery: SetUrlCriteriaQueryFunction; getUrlCriteriaQuery: GetUrlCriteriaQueryFunction };
@@ -0,0 +1 @@
1
+ import s from"@ahooksjs/use-url-state";function e(){const[e,r]=s({searchFormKeys:"",searchFormValues:"",paginationKeys:"",paginationValues:""},{navigateMode:"replace"});return{setUrlCriteriaQuery:function(s,e){const t=s=>{const e=[],r=[];return Object.entries(s).forEach(([s,t])=>{t&&(e.push(s),Array.isArray(t)?r.push(`[${t.join("|")}]`):r.push(t))}),{keys:e.join(","),values:r.join(",")}},i=t(s),a=t(e);r({searchFormKeys:i.keys||void 0,searchFormValues:i.values||void 0,paginationKeys:a.keys||void 0,paginationValues:a.values||void 0})},getUrlCriteriaQuery:function(s,r){const t=e[s]?e[s].split(","):[],i=e[r]?e[r].split(","):[],a={};return t.forEach((s,e)=>{if(i[e])if(i[e].startsWith("[")&&i[e].endsWith("]")){const r=i[e].substring(1,i[e].length-1);a[s]=r?r.split("|"):[]}else a[s]=i[e]}),a}}}export{e as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "2.1.11",
4
+ "version": "2.2.0",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",
@@ -11,7 +11,6 @@
11
11
  "css",
12
12
  "enum",
13
13
  "hooks",
14
- "json",
15
14
  "regular",
16
15
  "utils",
17
16
  "README.md"
@@ -22,9 +21,10 @@
22
21
  "scripts": {
23
22
  "build": "rollup -c",
24
23
  "build:watch": "rollup -c -w",
24
+ "prepublishOnly": "npm run build",
25
25
  "patch": "npm version patch",
26
26
  "minor": "npm version minor",
27
- "publish": "npm publish",
27
+ "release": "npm publish",
28
28
  "postinstall": "echo 'Thanks for using our component library!'"
29
29
  },
30
30
  "dependencies": {
@@ -62,9 +62,10 @@
62
62
  "eslint-plugin-react-hooks": "^7.0.0",
63
63
  "eslint-plugin-react-refresh": "^0.4.23",
64
64
  "glob": "^13.0.0",
65
- "rollup": "^4.54.0",
66
65
  "react": "^18.3.1",
67
- "typescript": "^5.9.3"
66
+ "rollup": "^4.54.0",
67
+ "typescript": "^5.9.3",
68
+ "zy-react-data": "^1.0.0"
68
69
  },
69
70
  "peerDependencies": {
70
71
  "@ahooksjs/use-url-state": ">=3.5.1 <4",
@@ -72,6 +73,7 @@
72
73
  "@ant-design/pro-components": ">=3.1.14-6 <4",
73
74
  "ahooks": ">=3.9.5 <4",
74
75
  "antd": ">=6.4.4 <7",
75
- "react": ">=18.3.1 <19"
76
+ "react": ">=18.3.1 <19",
77
+ "zy-react-data": ">=1.0.0"
76
78
  }
77
79
  }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * 匹配中国手机号码,可包含国家代码86,支持各种运营商号段。
3
+ */
4
+ export const PHONE: RegExp;
5
+
6
+ /**
7
+ * 匹配中国大陆的统一社会信用代码。
8
+ */
9
+ export const UNIFIED_SOCIAL_CREDIT_CODE: RegExp;
10
+
11
+ /**
12
+ * 匹配中国大陆的身份证号码,包括15位和18位号码,并验证最后一位校验码。
13
+ */
14
+ export const ID_NUMBER: RegExp;
15
+
16
+ /**
17
+ * 匹配中国大陆的移动电话号码,不包含国家代码。
18
+ */
19
+ export const MOBILE_PHONE: RegExp;
20
+
21
+ /**
22
+ * 匹配浮点数,允许整数、一位或两位小数,以及零的情况。
23
+ */
24
+ export const FLOATING_POINT_NUMBER: RegExp;
25
+
26
+ /**
27
+ * 两位小数。
28
+ */
29
+ export const TWO_DECIMAL_PLACES: RegExp;
30
+
31
+ /**
32
+ * 一位小数(非必须)。
33
+ */
34
+ export const ONE_DECIMAL_PLACES: RegExp;
35
+
36
+ /**
37
+ * 匹配中国大陆的车牌号码。
38
+ */
39
+ export const LICENSE_PLATE_NUMBER: RegExp;
40
+
41
+ /**
42
+ * 匹配强密码,要求至少8个字符,包含大小写字母、数字和特殊字符。
43
+ */
44
+ export const STRONG_PASSWORD: RegExp;
45
+
46
+ /**
47
+ * 匹配完整的HTML标签,包括开始标签和结束标签。
48
+ */
49
+ export const HTML_TAG: RegExp;
50
+
51
+ /**
52
+ * 匹配中国大陆的邮政编码。
53
+ */
54
+ export const POSTAL_CODE: RegExp;
55
+
56
+ /**
57
+ * 匹配座机号码。
58
+ */
59
+ export const TEL_PHONE: RegExp;
@@ -0,0 +1 @@
1
+ const d=/^(?:(?:\+|00)86)?1(?:3\d|4[5-7|9]|5[0-3|5-9]|6[5-7]|7[0-8]|8\d|9[1|89])\d{8}$/,$=/^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/,A=/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[12]\d|30|31)\d{3}[\dX]$/i,H=/^(13\d|14[579]|15[0-3,5-9]|166|17[0135-8]|18\d|19[89])\d{8}$/,J=/(^[1-9](\d+)?(\.\d{1,2})?$)|(^(0)$)|(^\d\.\d(\d)?$)/,N=/^\d+\.\d{2}$/,P=/^\d+(\.\d?)?$/,Z=/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$/,X=/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z\d]).{8,}$/,a=/<[^>]*>/g,g=/^(0[1-7]|1[0-356]|2[0-7]|3[0-6]|4[0-7]|5[1-7]|6[1-7]|7[0-5]|8[013-6])\d{4}$/g,o=/^(?:(?:\d{3}-)?\d{8}|^(?:\d{4}-)?\d{7,8})(?:-\d+)?$/;export{J as FLOATING_POINT_NUMBER,a as HTML_TAG,A as ID_NUMBER,Z as LICENSE_PLATE_NUMBER,H as MOBILE_PHONE,P as ONE_DECIMAL_PLACES,d as PHONE,g as POSTAL_CODE,X as STRONG_PASSWORD,o as TEL_PHONE,N as TWO_DECIMAL_PLACES,$ as UNIFIED_SOCIAL_CREDIT_CODE};