zy-react-library 1.1.1 → 1.1.3

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 (75) hide show
  1. package/README.md +5 -1
  2. package/components/Cascader/Area/index.js +1 -20
  3. package/components/Cascader/Basic/index.js +1 -64
  4. package/components/Cascader/Dictionary/index.js +1 -42
  5. package/components/Cascader/Industry/index.js +1 -20
  6. package/components/Editor/index.js +1 -102
  7. package/components/FormBuilder/FormBuilder.js +1 -87
  8. package/components/FormBuilder/FormItemsRenderer.js +1 -591
  9. package/components/FormBuilder/index.js +1 -3
  10. package/components/HeaderBack/index.js +1 -37
  11. package/components/HiddenInfo/gwj/index.js +1 -518
  12. package/components/Icon/AddIcon/index.js +1 -9
  13. package/components/Icon/BackIcon/index.js +1 -9
  14. package/components/Icon/DeleteIcon/index.js +1 -9
  15. package/components/Icon/DownloadIcon/index.js +1 -9
  16. package/components/Icon/EditIcon/index.js +1 -9
  17. package/components/Icon/ExportIcon/index.js +1 -9
  18. package/components/Icon/ImportIcon/index.js +1 -9
  19. package/components/Icon/LocationIcon/index.js +1 -9
  20. package/components/Icon/PrintIcon/index.js +1 -9
  21. package/components/Icon/ResetIcon/index.js +1 -9
  22. package/components/Icon/SearchIcon/index.js +1 -9
  23. package/components/Icon/VideoIcon/index.js +1 -9
  24. package/components/Icon/ViewIcon/index.js +1 -9
  25. package/components/ImportFile/index.js +1 -91
  26. package/components/LeftTree/Area/index.js +1 -15
  27. package/components/LeftTree/Basic/index.js +1 -171
  28. package/components/LeftTree/Department/Gwj/index.js +1 -32
  29. package/components/LeftTree/Dictionary/index.js +1 -42
  30. package/components/Map/MapSelector.js +1 -254
  31. package/components/Map/index.js +1 -77
  32. package/components/Page/index.js +1 -50
  33. package/components/Pdf/index.js +1 -134
  34. package/components/PreviewImg/index.js +1 -32
  35. package/components/PreviewPdf/index.js +1 -86
  36. package/components/Search/index.js +1 -141
  37. package/components/Select/Basic/index.js +1 -76
  38. package/components/Select/Dictionary/index.js +1 -42
  39. package/components/Select/Personnel/Gwj/index.js +1 -49
  40. package/components/SelectCreate/index.js +1 -55
  41. package/components/SelectTree/Area/index.js +1 -26
  42. package/components/SelectTree/Basic/index.js +1 -102
  43. package/components/SelectTree/Department/Gwj/index.js +1 -46
  44. package/components/SelectTree/Dictionary/index.js +1 -42
  45. package/components/SelectTree/HiddenLevel/Gwj/index.js +1 -72
  46. package/components/SelectTree/HiddenPart/Gwj/index.js +1 -39
  47. package/components/SelectTree/Industry/index.js +1 -27
  48. package/components/Signature/index.js +1 -94
  49. package/components/Table/index.js +1 -73
  50. package/components/Table/index.less +7 -1
  51. package/components/TooltipPreviewImg/index.js +1 -27
  52. package/components/Upload/index.js +1 -275
  53. package/components/Video/AliPlayer.js +1 -160
  54. package/components/Video/index.js +1 -90
  55. package/css/common.less +4 -0
  56. package/enum/dictionary/index.js +1 -7
  57. package/enum/formItemRender/index.js +1 -37
  58. package/enum/hidden/gwj/index.js +1 -31
  59. package/enum/uploadFile/gwj/index.js +1 -176
  60. package/hooks/useDeleteFile/index.js +1 -101
  61. package/hooks/useDictionary/index.js +1 -66
  62. package/hooks/useDownloadBlob/index.js +1 -79
  63. package/hooks/useDownloadFile/index.js +1 -81
  64. package/hooks/useGetFile/index.js +1 -74
  65. package/hooks/useGetUrlQuery/index.js +1 -16
  66. package/hooks/useGetUserInfo/index.js +1 -49
  67. package/hooks/useIdle/index.js +1 -67
  68. package/hooks/useImportFile/index.js +1 -59
  69. package/hooks/useIsExistenceDuplicateSelection/index.js +1 -20
  70. package/hooks/useTable/index.js +1 -113
  71. package/hooks/useUploadFile/index.js +1 -149
  72. package/hooks/useUrlQueryCriteria/index.js +1 -77
  73. package/package.json +18 -1
  74. package/regular/index.js +1 -61
  75. package/utils/index.js +1 -587
package/README.md CHANGED
@@ -11,4 +11,8 @@ yarn add zy-react-library
11
11
 
12
12
  ### v1.0.0 (2025-10-22)
13
13
 
14
- - 🎉 初始版本发布
14
+ - 🎉 初始版本发布
15
+
16
+ ### v1.1.2 (2025-12-25)
17
+
18
+ - 🎉 优化编译效果
@@ -1,20 +1 @@
1
- import Area from "../../../json/area.json";
2
- import BasicCascader from "../Basic";
3
-
4
- /**
5
- * 属地级联组件
6
- */
7
- function AreaCascader(props) {
8
- const {
9
- placeholder = "属地",
10
- ...restProps
11
- } = props;
12
-
13
- return (
14
- <BasicCascader data={Area} placeholder={placeholder} nameKey="label" idKey="value" {...restProps} />
15
- );
16
- }
17
-
18
- AreaCascader.displayName = "AreaCascader";
19
-
20
- export default AreaCascader;
1
+ import e from"../../../json/area.json";import a from"../Basic/index.js";import{jsx as r}from"react/jsx-runtime";function o(o){const{placeholder:t="属地",...i}=o;return r(a,{data:e,placeholder:t,nameKey:"label",idKey:"value",...i})}o.displayName="AreaCascader";export{o as default};
@@ -1,64 +1 @@
1
- import { Cascader } from "antd";
2
- import { useEffect } from "react";
3
- import { processTreeDataByLevel } from "../../../utils";
4
-
5
- /**
6
- * 基础级联组件(不建议直接使用此组件,二次继承使用)
7
- */
8
- function BasicCascader(props) {
9
- const {
10
- onGetData,
11
- onChange,
12
- onGetNodePaths,
13
- onGetNodePathsIsIncludeOneself = true,
14
- placeholder = "",
15
- data = [],
16
- nameKey = "name",
17
- idKey = "id",
18
- childrenKey = "children",
19
- level,
20
- ...restProps
21
- } = props;
22
-
23
- // 根据 level 处理树数据
24
- const processedData = level
25
- ? processTreeDataByLevel({
26
- data,
27
- level,
28
- childrenKey,
29
- currentLevel: 1,
30
- })
31
- : data;
32
-
33
- const getNodePaths = (selectedOptions) => {
34
- let nodePaths = selectedOptions;
35
- if (!onGetNodePathsIsIncludeOneself && selectedOptions) {
36
- nodePaths = selectedOptions.slice(0, -1);
37
- }
38
- return nodePaths || [];
39
- };
40
-
41
- const handleChange = (value, selectedOptions) => {
42
- const parentNodes = getNodePaths(selectedOptions);
43
- onGetNodePaths?.(parentNodes);
44
- onChange?.(value, selectedOptions);
45
- };
46
-
47
- useEffect(() => {
48
- onGetData?.(data, processedData);
49
- }, [data, processedData]);
50
-
51
- return (
52
- <Cascader
53
- options={processedData}
54
- placeholder={`请选择${placeholder}`}
55
- onChange={handleChange}
56
- fieldNames={{ label: nameKey, value: idKey, children: childrenKey }}
57
- {...restProps}
58
- />
59
- );
60
- }
61
-
62
- BasicCascader.displayName = "BasicCascader";
63
-
64
- export default BasicCascader;
1
+ import{Cascader as e}from"antd";import{useEffect as a}from"react";import{processTreeDataByLevel as t}from"../../../utils/index.js";import{jsx as n}from"react/jsx-runtime";function r(r){const{onGetData:l,onChange:o,onGetNodePaths:d,onGetNodePathsIsIncludeOneself:i=!0,placeholder:c="",data:s=[],nameKey:m="name",idKey:h="id",childrenKey:p="children",level:u,...f}=r,y=u?t({data:s,level:u,childrenKey:p,currentLevel:1}):s;return a(()=>{l?.(s,y)},[s,y]),n(e,{options:y,placeholder:`请选择${c}`,onChange:(e,a)=>{const t=(e=>{let a=e;return!i&&e&&(a=e.slice(0,-1)),a||[]})(a);d?.(t),o?.(e,a)},fieldNames:{label:m,value:h,children:p},...f})}r.displayName="BasicCascader";export{r as default};
@@ -1,42 +1 @@
1
- import { request } from "@cqsjjb/jjb-common-lib/http";
2
- import { useEffect, useState } from "react";
3
- import { DICTIONARY_APP_KEY_ENUM } from "../../../enum/dictionary";
4
- import BasicCascader from "../Basic";
5
-
6
- /**
7
- * 数据字典级联组件
8
- */
9
- function DictionaryCascader(props) {
10
- const {
11
- appKey = DICTIONARY_APP_KEY_ENUM.DEFAULT,
12
- dictValue = "",
13
- nameKey = "dictLabel",
14
- idKey = "dictValue",
15
- ...restProps
16
- } = props;
17
-
18
- const [treeData, setTreeData] = useState([]);
19
-
20
- const getData = async () => {
21
- if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) {
22
- console.error("传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中");
23
- return;
24
- }
25
-
26
- setTreeData([]);
27
- const { data } = await request("/config/dict-trees/list/by/dictValues", "get", { appKey, dictValue });
28
- setTreeData(data);
29
- };
30
-
31
- useEffect(() => {
32
- dictValue && getData();
33
- }, [dictValue]);
34
-
35
- return (
36
- <BasicCascader data={treeData} nameKey={nameKey} idKey={idKey} {...restProps} />
37
- );
38
- }
39
-
40
- DictionaryCascader.displayName = "DictionaryCascader";
41
-
42
- export default DictionaryCascader;
1
+ import{request as e}from"@cqsjjb/jjb-common-lib/http";import{useState as t,useEffect as i}from"react";import{DICTIONARY_APP_KEY_ENUM as a}from"../../../enum/dictionary/index.js";import r from"../Basic/index.js";import{jsx as o}from"react/jsx-runtime";function c(c){const{appKey:n=a.DEFAULT,dictValue:d="",nameKey:m="dictLabel",idKey:s="dictValue",...p}=c,[l,u]=t([]);return i(()=>{d&&(async()=>{if(!Object.values(a).includes(n))return void console.error("传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中");u([]);const{data:t}=await e("/config/dict-trees/list/by/dictValues","get",{appKey:n,dictValue:d});u(t)})()},[d]),o(r,{data:l,nameKey:m,idKey:s,...p})}c.displayName="DictionaryCascader";export{c as default};
@@ -1,20 +1 @@
1
- import Industry from "../../../json/industry.json";
2
- import BasicCascader from "../Basic";
3
-
4
- /**
5
- * 行业类型级联组件
6
- */
7
- function IndustryCascader(props) {
8
- const {
9
- placeholder = "行业类型",
10
- ...restProps
11
- } = props;
12
-
13
- return (
14
- <BasicCascader data={Industry} placeholder={placeholder} nameKey="dict_label" idKey="dict_value" childrenKey="childrenList" {...restProps} />
15
- );
16
- }
17
-
18
- IndustryCascader.displayName = "IndustryCascader";
19
-
20
- export default IndustryCascader;
1
+ import e from"../../../json/industry.json";import r from"../Basic/index.js";import{jsx as t}from"react/jsx-runtime";function a(a){const{placeholder:i="行业类型",...d}=a;return t(r,{data:e,placeholder:i,nameKey:"dict_label",idKey:"dict_value",childrenKey:"childrenList",...d})}a.displayName="IndustryCascader";export{a as default};
@@ -1,102 +1 @@
1
- import { Editor as ReactEditor, Toolbar } from "@wangeditor/editor-for-react";
2
- import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
3
- import { normalizeEmptyHtml } from "../../utils";
4
- import "@wangeditor/editor/dist/css/style.css";
5
-
6
- /**
7
- * 富文本编辑器组件
8
- */
9
- const Editor = forwardRef(({
10
- value,
11
- onChange,
12
- disabled,
13
- }, ref) => {
14
- const [editor, setEditor] = useState(null);
15
-
16
- const [html, setHtml] = useState("");
17
-
18
- useEffect(() => {
19
- setHtml(value);
20
- }, [value]);
21
-
22
- useEffect(() => {
23
- if (!editor)
24
- return;
25
- if (disabled)
26
- editor.disable();
27
- else editor.enable();
28
- }, [disabled]);
29
-
30
- useEffect(() => {
31
- return () => {
32
- if (!editor)
33
- return;
34
- editor.destroy();
35
- setEditor(null);
36
- };
37
- }, [editor]);
38
-
39
- useImperativeHandle(ref, () => ({
40
- getEditorInstance: () => editor,
41
- getHtml: () => editor && editor.getHtml(),
42
- setHtml: (value) => {
43
- editor && editor.setHtml(value);
44
- },
45
- getText: () => editor && editor.getText(),
46
- }));
47
-
48
- const handleCreated = (editor) => {
49
- setEditor(editor);
50
- if (disabled)
51
- editor.disable();
52
- };
53
-
54
- const handleChange = (editor) => {
55
- setHtml(editor.getHtml());
56
- onChange?.(normalizeEmptyHtml(editor.getHtml()));
57
- };
58
-
59
- // 工具栏配置
60
- const toolbarConfig = {
61
- excludeKeys: [
62
- "group-image",
63
- "group-video",
64
- "insertLink",
65
- "emotion",
66
- "todo",
67
- "fullScreen",
68
- "insertTable",
69
- "codeBlock",
70
- ],
71
- };
72
-
73
- // 编辑器配置
74
- const editorConfig = {
75
- placeholder: "请输入内容...",
76
- };
77
-
78
- return (
79
- <>
80
- <div style={{ border: "1px solid #ccc" }}>
81
- <Toolbar
82
- editor={editor}
83
- defaultConfig={toolbarConfig}
84
- mode="default"
85
- style={{ borderBottom: "1px solid #ccc" }}
86
- />
87
- <ReactEditor
88
- defaultConfig={editorConfig}
89
- value={html}
90
- onCreated={handleCreated}
91
- onChange={handleChange}
92
- mode="default"
93
- style={{ height: "500px", overflowY: "hidden" }}
94
- />
95
- </div>
96
- </>
97
- );
98
- });
99
-
100
- Editor.displayName = "Editor";
101
-
102
- export default Editor;
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};
@@ -1,87 +1 @@
1
- import { Button, Col, Form, message, Row, Space, Spin } from "antd";
2
- import FormItemsRenderer from "./FormItemsRenderer";
3
-
4
- /**
5
- * 表单构建器组件
6
- */
7
- const FormBuilder = (props) => {
8
- const {
9
- values,
10
- options,
11
- gutter = 24,
12
- span = 12,
13
- labelCol = { span: 4 },
14
- useAutoGenerateRequired = true,
15
- showActionButtons = true,
16
- submitButtonText = "提交",
17
- cancelButtonText = "取消",
18
- showSubmitButton = true,
19
- showCancelButton = true,
20
- customActionButtons,
21
- extraActionButtons,
22
- loading = false,
23
- ...restProps
24
- } = props;
25
-
26
- const handleCancel = () => {
27
- window.history.back();
28
- };
29
-
30
- return (
31
- <Spin spinning={loading}>
32
- <Form
33
- labelCol={labelCol}
34
- scrollToFirstError
35
- wrapperCol={{ span: 24 - labelCol.span }}
36
- initialValues={values}
37
- onFinishFailed={() => {
38
- message.error("请补全必填项");
39
- }}
40
- style={{ width: `calc(100% - ${gutter * 2}px)`, margin: `0 auto` }}
41
- {...restProps}
42
- >
43
- <Row gutter={gutter}>
44
- <FormItemsRenderer
45
- options={options}
46
- labelCol={labelCol}
47
- span={span}
48
- gutter={gutter}
49
- useAutoGenerateRequired={useAutoGenerateRequired}
50
- initialValues={values}
51
- />
52
- </Row>
53
- {showActionButtons && (
54
- <>
55
- <div style={{ height: "52px" }}></div>
56
- <Row
57
- gutter={gutter}
58
- style={{ textAlign: "center", backgroundColor: "rgb(241, 241, 242)", margin: "0px -44px", padding: "10px 0", position: "fixed", bottom: "0", width: "100%" }}
59
- >
60
- <Col span={24} style={{ textAlign: "center" }}>
61
- {customActionButtons || (
62
- <Space>
63
- {showSubmitButton && (
64
- <Button type="primary" htmlType="submit">
65
- {submitButtonText}
66
- </Button>
67
- )}
68
- {extraActionButtons}
69
- {showCancelButton && (
70
- <Button onClick={handleCancel}>
71
- {cancelButtonText}
72
- </Button>
73
- )}
74
- </Space>
75
- )}
76
- </Col>
77
- </Row>
78
- </>
79
- )}
80
- </Form>
81
- </Spin>
82
- );
83
- };
84
-
85
- FormBuilder.displayName = "FormBuilder";
86
-
87
- export default FormBuilder;
1
+ import{Spin as e,Form as t,Row as n,Col as i,Space as r,Button as o,message as s}from"antd";import{useState as l,useEffect as a}from"react";import d from"./FormItemsRenderer.js";import{jsx as u,jsxs as c,Fragment as p}from"react/jsx-runtime";const m=m=>{const{values:h,options:g,gutter:w=24,span:x=12,labelCol:b={span:4},useAutoGenerateRequired:y=!0,showActionButtons:f=!0,submitButtonText:B="提交",cancelButtonText:A="取消",showSubmitButton:C=!0,showCancelButton:T=!0,customActionButtons:v,extraActionButtons:F,loading:k=!1,...q}=m,[E,R]=l(window.innerWidth),j=()=>{const e=document.querySelector("#page");e&&R(e.offsetWidth)};return a(()=>{const e=setTimeout(()=>{j()},0);return window.addEventListener("resize",j),()=>{window.removeEventListener("resize",j),clearTimeout(e)}},[]),u(e,{spinning:k,children:c(t,{labelCol:b,scrollToFirstError:!0,wrapperCol:{span:24-b.span},initialValues:h,onFinishFailed:()=>{s.error("请补全必填项")},style:{width:`calc(100% - ${2*w}px)`,margin:"0 auto"},...q,children:[u(n,{gutter:w,children:u(d,{options:g,labelCol:b,span:x,gutter:w,useAutoGenerateRequired:y,initialValues:h})}),f&&c(p,{children:[u("div",{style:{height:"32px"}}),u(n,{style:{textAlign:"center",backgroundColor:"rgb(241, 241, 242)",padding:"10px 0",position:"fixed",bottom:"0",width:E,margin:"0 -44px"},children:u(i,{span:24,style:{textAlign:"center"},children:v||c(r,{children:[C&&u(o,{type:"primary",htmlType:"submit",children:B}),F,T&&u(o,{onClick:()=>{window.history.back()},children:A})]})})})]})]})})};m.displayName="FormBuilder";export{m as default};