zy-react-library 2.1.11 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -32
- package/components/Cascader/Area/index.d.ts +25 -0
- package/components/Cascader/Area/index.js +1 -0
- package/components/Cascader/Basic/index.d.ts +31 -0
- package/components/Cascader/Basic/index.js +1 -0
- package/components/Cascader/Dictionary/index.d.ts +34 -0
- package/components/Cascader/Dictionary/index.js +1 -0
- package/components/Cascader/Industry/index.d.ts +25 -0
- package/components/Cascader/Industry/index.js +1 -0
- package/components/Editor/index.d.ts +29 -0
- package/components/Editor/index.js +1 -0
- package/components/Excel/index.d.ts +22 -0
- package/components/Excel/index.js +1 -0
- package/components/FormBuilder/FormBuilder.d.ts +66 -0
- package/components/FormBuilder/FormBuilder.js +1 -0
- package/components/FormBuilder/FormItemsRenderer.d.ts +286 -0
- package/components/FormBuilder/FormItemsRenderer.js +1 -0
- package/components/FormBuilder/index.d.ts +7 -0
- package/components/FormBuilder/index.js +1 -0
- package/components/HeaderBack/index.d.ts +18 -0
- package/components/HeaderBack/index.js +1 -0
- package/components/HeaderBack/index.less +26 -0
- package/components/HiddenInfo/gwj/index.d.ts +26 -0
- package/components/HiddenInfo/gwj/index.js +1 -0
- package/components/Icon/AddIcon/index.d.ts +6 -0
- package/components/Icon/AddIcon/index.js +1 -0
- package/components/Icon/BackIcon/index.d.ts +6 -0
- package/components/Icon/BackIcon/index.js +1 -0
- package/components/Icon/DeleteIcon/index.d.ts +6 -0
- package/components/Icon/DeleteIcon/index.js +1 -0
- package/components/Icon/DownloadIcon/index.d.ts +6 -0
- package/components/Icon/DownloadIcon/index.js +1 -0
- package/components/Icon/EditIcon/index.d.ts +6 -0
- package/components/Icon/EditIcon/index.js +1 -0
- package/components/Icon/ExportIcon/index.d.ts +6 -0
- package/components/Icon/ExportIcon/index.js +1 -0
- package/components/Icon/ImportIcon/index.d.ts +6 -0
- package/components/Icon/ImportIcon/index.js +1 -0
- package/components/Icon/LocationIcon/index.d.ts +6 -0
- package/components/Icon/LocationIcon/index.js +1 -0
- package/components/Icon/PrintIcon/index.d.ts +6 -0
- package/components/Icon/PrintIcon/index.js +1 -0
- package/components/Icon/ResetIcon/index.d.ts +6 -0
- package/components/Icon/ResetIcon/index.js +1 -0
- package/components/Icon/SearchIcon/index.d.ts +6 -0
- package/components/Icon/SearchIcon/index.js +1 -0
- package/components/Icon/VideoIcon/index.d.ts +6 -0
- package/components/Icon/VideoIcon/index.js +1 -0
- package/components/Icon/ViewIcon/index.d.ts +6 -0
- package/components/Icon/ViewIcon/index.js +1 -0
- package/components/ImportFile/index.d.ts +29 -0
- package/components/ImportFile/index.js +1 -0
- package/components/LeftTree/Area/index.d.ts +26 -0
- package/components/LeftTree/Area/index.js +1 -0
- package/components/LeftTree/Basic/index.d.ts +27 -0
- package/components/LeftTree/Basic/index.js +1 -0
- package/components/LeftTree/Department/Gwj/index.d.ts +31 -0
- package/components/LeftTree/Department/Gwj/index.js +1 -0
- package/components/LeftTree/Dictionary/index.d.ts +34 -0
- package/components/LeftTree/Dictionary/index.js +1 -0
- package/components/Map/CesiumMap.js +1 -0
- package/components/Map/MapSelector.d.ts +29 -0
- package/components/Map/MapSelector.js +1 -0
- package/components/Map/h.png +0 -0
- package/components/Map/index.d.ts +27 -0
- package/components/Map/index.js +1 -0
- package/components/Map/index.less +5 -0
- package/components/Page/index.d.ts +36 -0
- package/components/Page/index.js +1 -0
- package/components/Pdf/index.d.ts +22 -0
- package/components/Pdf/index.js +1 -0
- package/components/Pdf/index.less +3 -0
- package/components/PreviewExcel/index.d.ts +18 -0
- package/components/PreviewExcel/index.js +1 -0
- package/components/PreviewImg/index.d.ts +12 -0
- package/components/PreviewImg/index.js +1 -0
- package/components/PreviewPdf/index.d.ts +18 -0
- package/components/PreviewPdf/index.js +1 -0
- package/components/PreviewWord/index.d.ts +18 -0
- package/components/PreviewWord/index.js +1 -0
- package/components/SeamlessScroll/index.d.ts +51 -0
- package/components/SeamlessScroll/index.js +1 -0
- package/components/Search/index.d.ts +49 -0
- package/components/Search/index.js +1 -0
- package/components/Select/Basic/index.d.ts +35 -0
- package/components/Select/Basic/index.js +1 -0
- package/components/Select/Dictionary/index.d.ts +33 -0
- package/components/Select/Dictionary/index.js +1 -0
- package/components/Select/Personnel/Gwj/index.d.ts +72 -0
- package/components/Select/Personnel/Gwj/index.js +1 -0
- package/components/SelectCreate/index.d.ts +29 -0
- package/components/SelectCreate/index.js +1 -0
- package/components/SelectTree/Area/index.d.ts +25 -0
- package/components/SelectTree/Area/index.js +1 -0
- package/components/SelectTree/Basic/index.d.ts +35 -0
- package/components/SelectTree/Basic/index.js +1 -0
- package/components/SelectTree/Department/Gwj/index.d.ts +61 -0
- package/components/SelectTree/Department/Gwj/index.js +1 -0
- package/components/SelectTree/Dictionary/index.d.ts +34 -0
- package/components/SelectTree/Dictionary/index.js +1 -0
- package/components/SelectTree/HiddenLevel/Gwj/index.d.ts +32 -0
- package/components/SelectTree/HiddenLevel/Gwj/index.js +1 -0
- package/components/SelectTree/HiddenPart/Gwj/index.d.ts +38 -0
- package/components/SelectTree/HiddenPart/Gwj/index.js +1 -0
- package/components/SelectTree/Industry/index.d.ts +25 -0
- package/components/SelectTree/Industry/index.js +1 -0
- package/components/Signature/index.d.ts +28 -0
- package/components/Signature/index.js +1 -0
- package/components/Table/index.d.ts +29 -0
- package/components/Table/index.js +1 -0
- package/components/Table/index.less +14 -0
- package/components/TooltipPreviewImg/index.d.ts +6 -0
- package/components/TooltipPreviewImg/index.js +1 -0
- package/components/Upload/index.d.ts +32 -0
- package/components/Upload/index.js +1 -0
- package/components/Video/AliPlayer.d.ts +45 -0
- package/components/Video/AliPlayer.js +1 -0
- package/components/Video/index.d.ts +20 -0
- package/components/Video/index.js +1 -0
- package/components/Word/index.d.ts +22 -0
- package/components/Word/index.js +1 -0
- package/css/common.less +35 -0
- package/enum/formItemRender/index.d.ts +68 -0
- package/enum/formItemRender/index.js +1 -0
- package/hooks/useDeleteFile/index.d.ts +22 -0
- package/hooks/useDeleteFile/index.js +1 -0
- package/hooks/useDictionary/index.d.ts +24 -0
- package/hooks/useDictionary/index.js +1 -0
- package/hooks/useDownloadBlob/index.d.ts +16 -0
- package/hooks/useDownloadBlob/index.js +1 -0
- package/hooks/useDownloadFile/index.d.ts +14 -0
- package/hooks/useDownloadFile/index.js +1 -0
- package/hooks/useGetFile/index.d.ts +49 -0
- package/hooks/useGetFile/index.js +1 -0
- package/hooks/useGetUrlQuery/index.d.ts +4 -0
- package/hooks/useGetUrlQuery/index.js +1 -0
- package/hooks/useGetUserInfo/index.d.ts +21 -0
- package/hooks/useGetUserInfo/index.js +1 -0
- package/hooks/useIdle/index.d.ts +11 -0
- package/hooks/useIdle/index.js +1 -0
- package/hooks/useImportFile/index.d.ts +16 -0
- package/hooks/useImportFile/index.js +1 -0
- package/hooks/useIsExistenceDuplicateSelection/index.d.ts +22 -0
- package/hooks/useIsExistenceDuplicateSelection/index.js +1 -0
- package/hooks/useTable/index.d.ts +75 -0
- package/hooks/useTable/index.js +1 -0
- package/hooks/useUploadFile/index.d.ts +67 -0
- package/hooks/useUploadFile/index.js +1 -0
- package/hooks/useUrlQueryCriteria/index.d.ts +8 -0
- package/hooks/useUrlQueryCriteria/index.js +1 -0
- package/package.json +8 -6
- package/regular/index.d.ts +59 -0
- package/regular/index.js +1 -0
- package/utils/index.d.ts +395 -0
- package/utils/index.js +1 -0
|
@@ -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){return r(a,{treeData:e,nameKey:"label",idKey:"value",...t})}t.displayName="AreaLeftTree";export{t as default};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TreeProps } from "antd/es/tree";
|
|
2
|
+
import type { FC } from "react";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 组件属性
|
|
6
|
+
*/
|
|
7
|
+
export interface BasicLeftTreeProps extends Omit<TreeProps, "fieldNames"> {
|
|
8
|
+
/** 树形数据 title 字段,默认 name */
|
|
9
|
+
nameKey?: string;
|
|
10
|
+
/** 树形数据 key 字段,默认 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
|
+
onGetData?: (data: Record<string, any>[]) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 基础左侧树组件
|
|
24
|
+
*/
|
|
25
|
+
declare const BasicLeftTree: FC<BasicLeftTreeProps>;
|
|
26
|
+
|
|
27
|
+
export default BasicLeftTree;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Input as e,Tree as t}from"antd";import{useState as n,useEffect as r}from"react";import{getTreeNodePaths as s}from"../../../utils/index.js";import{jsxs as d,jsx as i}from"react/jsx-runtime";const{Search:a}=e,o=e=>{const{onGetData:o,onSelect:c,onGetNodePaths:l,getNodePathsIsIncludeOneself:h=!0,expandedKeys:u,treeData:m=[],nameKey:f="name",idKey:p="id",childrenKey:y="children",...g}=e,[x,K]=n([]),[v,I]=n(""),[N,S]=n(!0);r(()=>{K(u)},[u]);const D=(e,t,n=[])=>(e.forEach(e=>{e[y]&&((e[f].includes(t)||e[y].some(e=>e[f].includes(t)))&&n.push(e[p]),D(e[y],t,n))}),n),E=(e,t)=>t?e.reduce((e,n)=>{const r=n[f].includes(t),s=n[y]?E(n[y],t):[];return(r||s.length>0)&&e.push({...n,[y]:s.length>0?s:void 0}),e},[]):e,O=e=>{if(!v)return e;const t=e.indexOf(v);if(-1===t)return e;const n=e.substring(0,t),r=e.substring(t+v.length);return d("span",{children:[n,i("span",{style:{color:"#f50"},children:v}),r]})},P=e=>e.map(e=>({...e,[f]:O(e[f]),[y]:e[y]?P(e[y]):void 0})),b=E(m,v),j=P(b);return r(()=>{o?.(m)},[m]),d("div",{style:{width:300},children:[i(a,{style:{marginBottom:8},placeholder:"输入关键字进行过滤",onSearch:async e=>{e!==v&&(e=>{if(I(e),S(!0),!e)return void K([]);const t=D(m,e);K(t)})(e)}}),i(t,{onExpand:e=>{K(e),S(!1)},onSelect:(e,t)=>{if(e.length>0&&l){const t=e[0],n=s({data:m,targetId:t,idKey:p,childrenKey:y,isIncludeOneself:h});l?.(n)}c?.(e,t)},autoExpandParent:N,expandedKeys:x,treeData:j,fieldNames:{title:f,key:p,children:y},...g})]})};o.displayName="BasicLeftTree";export{o as default};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { DepartmentSelectTreeProps } from "../../../SelectTree/Department/Gwj";
|
|
3
|
+
import type { BasicLeftTreeProps } from "../../Basic";
|
|
4
|
+
|
|
5
|
+
export interface DepartmentLeftTreeItem {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
childrenList: DepartmentLeftTreeItem[];
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 组件属性
|
|
14
|
+
*/
|
|
15
|
+
export interface DepartmentLeftTreeProps extends Omit<BasicLeftTreeProps, "treeData" | "nameKey" | "idKey" | "childrenKey" | "onGetNodePaths" | "onGetData"> {
|
|
16
|
+
/** 请求参数 */
|
|
17
|
+
params?: DepartmentSelectTreeProps["params"];
|
|
18
|
+
/** 查询的企业类型 */
|
|
19
|
+
searchType?: DepartmentSelectTreeProps["searchType"];
|
|
20
|
+
/** 获取父级节点 */
|
|
21
|
+
onGetNodePaths?: (nodes: DepartmentLeftTreeItem[]) => void;
|
|
22
|
+
/** 获取数据 */
|
|
23
|
+
onGetData?: (data: DepartmentLeftTreeItem[], processedData: DepartmentLeftTreeItem[]) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 部门左侧树组件(港务局版本)
|
|
28
|
+
*/
|
|
29
|
+
declare const DepartmentLeftTree: FC<DepartmentLeftTreeProps>;
|
|
30
|
+
|
|
31
|
+
export default DepartmentLeftTree;
|
|
@@ -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 n,getBaseGateway as p}from"../../../../utils/index.js";import i from"../../Basic/index.js";import{jsx as a}from"react/jsx-runtime";function s(s){const{params:l={},searchType:o="current",...d}=s,[m,y]=t([]);return r(()=>{(async()=>{let t="";const r={...l,time:(new Date).getTime()};"current"===o&&(t=`/${p()}/department/listTree`,delete r.inType,delete r.enterpriseType),"all"===o&&(t=`/${p()}/department/listAllTree`,delete r.inType,delete r.enterpriseType,delete r.eqCorpinfoId,delete r.eqParentId),"inType"===o&&(t=`/${p()}/department/listAllTreeByCorpType`,delete r.eqCorpinfoId,delete r.eqParentId,r.enterpriseType&&!Array.isArray(r.enterpriseType)&&(r.enterpriseType=[r.enterpriseType]));const i={searchType:o,params:l};await n(i,async()=>{const{data:n}=await e(t,"post",r);return n},y)})()},[]),a(i,{treeData:m,childrenKey:"childrenList",...d})}s.displayName="DepartmentLeftTree";export{s as default};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { BasicLeftTreeProps } from "../Basic";
|
|
3
|
+
|
|
4
|
+
export interface DictionaryLeftTreeItem {
|
|
5
|
+
dictValue: string;
|
|
6
|
+
dictLabel: string;
|
|
7
|
+
children: DictionaryLeftTreeItem[];
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 组件属性
|
|
13
|
+
*/
|
|
14
|
+
export interface DictionaryLeftTreeProps extends Omit<BasicLeftTreeProps, "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: DictionaryLeftTreeItem[]) => void;
|
|
25
|
+
/** 获取数据 */
|
|
26
|
+
onGetData?: (data: DictionaryLeftTreeItem[], processedData: DictionaryLeftTreeItem[]) => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 数据字典左侧树组件
|
|
31
|
+
*/
|
|
32
|
+
declare const DictionaryLeftTree: FC<DictionaryLeftTreeProps>;
|
|
33
|
+
|
|
34
|
+
export default DictionaryLeftTree;
|
|
@@ -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 o from"../Basic/index.js";import{jsx as c}from"react/jsx-runtime";function n(n){const{appKey:s=r.DEFAULT,dictValue:d="",nameKey:m="dictLabel",idKey:p="dictValue",...y}=n,[u,l]=t([]);return i(()=>{(async()=>{if(!Object.values(r).includes(s))return void console.error(`【DictionaryLeftTree】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${s}`);if(!d)return void console.error("【DictionaryLeftTree】 缺少 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},l)})()},[d]),c(o,{treeData:u,nameKey:m,idKey:p,...y})}n.displayName="DictionaryLeftTree";export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./h.png";class i{viewer;currentMarkPointId;init=()=>{const e="06494bcf2d4b66df7f3c586cc65af0cb",i=["0","1","2","3","4","5","6","7"];return this.viewer=new window.Cesium.Viewer("map_container",{animation:!1,homeButton:!0,geocoder:!0,baseLayerPicker:!1,timeline:!1,fullscreenButton:!0,infoBox:!0,sceneModePicker:!0,navigationInstructionsInitiallyVisible:!1,navigationHelpButton:!1,selectionIndicator:!1,imageryProvider:new window.Cesium.WebMapTileServiceImageryProvider({url:`https://t{s}.tianditu.gov.cn/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=${e}`,subdomains:i,layer:"tdtImgLayer",style:"default",format:"image/jpeg",tileMatrixSetID:"GoogleMapsCompatible",show:!0})}),this.viewer._cesiumWidget._creditContainer.style.display="none",this.viewer.imageryLayers.addImageryProvider(new window.Cesium.WebMapTileServiceImageryProvider({url:`https://t{s}.tianditu.gov.cn/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg&tk=${e}`,subdomains:i,layer:"tdtCiaLayer",style:"default",format:"image/jpeg",tileMatrixSetID:"GoogleMapsCompatible",show:!0})),this.initObliquePhotography(),{viewer:this.viewer}};initObliquePhotography=()=>{this.viewer.scene.globe.depthTestAgainstTerrain=!0,window.Cesium.ExperimentalFeatures.enableModelExperimental=!0;const e=window.mapObliquePhotography||[];for(let i=0;i<e.length;i++)this.createObliquePhotography(e[i])};createObliquePhotography=e=>{const i=new window.Cesium.Cesium3DTileset({url:e,skipLevelOfDetail:!0,baseScreenSpaceError:1024,maximumScreenSpaceError:128,skipScreenSpaceErrorFactor:16,skipLevels:1,immediatelyLoadDesiredLevelOfDetail:!1,loadSiblings:!0,cullWithChildrenBounds:!0,cullRequestsWhileMoving:!0,cullRequestsWhileMovingMultiplier:10,preloadWhenHidden:!0,preferLeaves:!0,maximumMemoryUsage:128,progressiveResolutionHeightFraction:.5,dynamicScreenSpaceErrorDensity:.5,dynamicScreenSpaceErrorFactor:1,dynamicScreenSpaceError:!0});i.readyPromise.then(e=>{const i=window.Cesium.Cartographic.fromCartesian(e.boundingSphere.center),t=window.Cesium.Math.toDegrees(i.longitude),r=window.Cesium.Math.toDegrees(i.latitude),n=window.Cesium.Cartesian3.fromDegrees(t,r,0),o=window.Cesium.Cartesian3.fromDegrees(t,r,5),a=window.Cesium.Cartesian3.subtract(o,n,new window.Cesium.Cartesian3);e.modelMatrix=window.Cesium.Matrix4.fromTranslation(a)}),this.viewer.scene.primitives.add(i)};flyTo=({longitude:e,latitude:i,height:t})=>{this.viewer.camera.flyTo({destination:this.getPosition(e,i,t),duration:2})};getPosition=(e,i,t=0)=>window.Cesium.Cartesian3.fromDegrees(e,i,t);clearMarkPoint=()=>{this.currentMarkPointId&&(this.viewer.entities.removeById(this.currentMarkPointId),this.currentMarkPointId=null)};getLongitudeAndLatitude=i=>{new window.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas).setInputAction(t=>{this.clearMarkPoint();const r=this.viewer.camera.pickEllipsoid(t.position,this.viewer.scene.globe.ellipsoid);if(r){const t=window.Cesium.Cartographic.fromCartesian(r),n=window.Cesium.Math.toDegrees(t.longitude),o=window.Cesium.Math.toDegrees(t.latitude);this.currentMarkPointId=window.Cesium.createGuid(),this.viewer.entities.add(new window.Cesium.Entity({id:this.currentMarkPointId,position:r,billboard:{image:e,width:23,height:25,verticalOrigin:window.Cesium.VerticalOrigin.BOTTOM,horizontalOrigin:window.Cesium.HorizontalOrigin.CENTER,heightReference:window.Cesium.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY,clampToGround:!0}})),i&&"function"==typeof i&&i(null,{longitude:n,latitude:o})}else i&&"function"==typeof i&&i(new Error("【Map】 无法获取坐标"),null)},window.Cesium.ScreenSpaceEventType.LEFT_CLICK)};addMarkPoint=({longitude:i,latitude:t})=>{const r=window.Cesium.Cartesian3.fromDegrees(i,t);this.currentMarkPointId=window.Cesium.createGuid(),this.viewer.entities.add(new window.Cesium.Entity({id:this.currentMarkPointId,position:r,billboard:{image:e,width:23,height:25,verticalOrigin:window.Cesium.VerticalOrigin.BOTTOM,horizontalOrigin:window.Cesium.HorizontalOrigin.CENTER,heightReference:window.Cesium.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY,clampToGround:!0}}))}}export{i as default};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
|
|
3
|
+
export interface MapSelectorProps {
|
|
4
|
+
/** 是否显示弹窗 */
|
|
5
|
+
visible: boolean;
|
|
6
|
+
/** 关闭弹窗回调 */
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
/** 经度值 */
|
|
9
|
+
longitude?: number | string;
|
|
10
|
+
/** 纬度值 */
|
|
11
|
+
latitude?: number | string;
|
|
12
|
+
/** 所属区域 */
|
|
13
|
+
area?: string;
|
|
14
|
+
/** 是否显示所属区域 */
|
|
15
|
+
showArea?: boolean;
|
|
16
|
+
/** 是否只查看 */
|
|
17
|
+
disable?: boolean;
|
|
18
|
+
/** 确认选择回调 */
|
|
19
|
+
onConfirm?: (longitude: number | string, latitude: number | string, extra: { area: string }) => void;
|
|
20
|
+
/** 地图类型,默认 baidu */
|
|
21
|
+
type?: "baidu" | "cesium";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 定位组件弹窗
|
|
26
|
+
*/
|
|
27
|
+
declare const MapSelector: FC<MapSelectorProps>;
|
|
28
|
+
|
|
29
|
+
export default MapSelector;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Modal as e,Form as i,Row as t,Col as a,Select as n,Input as r,Button as l,Spin as o}from"antd";import{useRef as d,useState as s,useEffect as c}from"react";import{dynamicLoadJs as u,dynamicLoadCss as p}from"../../utils/index.js";import w from"./CesiumMap.js";import"./index.less";import{jsxs as m,jsx as h}from"react/jsx-runtime";const g=g=>{const{visible:y,onClose:b,longitude:v,latitude:C,onConfirm:f,area:L="",showArea:M=!1,disable:B=!1,type:k="baidu"}=g,j=d(null),x=d(null),D=d(null),[G,I]=s(!1),[O,A]=s(v||""),[R,z]=s(C||""),[K,P]=s(""),[T,S]=s("");c(()=>{A(v||""),z(C||""),S(L||"")},[v,C,L]);const W=()=>{if(!window?.BMapGL?.Map)return void setTimeout(()=>{W()},50);const e=new window.BMapGL.Map(j.current);if(x.current=e,e.centerAndZoom(new window.BMapGL.Point(v||window.mapLongitude,C||window.mapLatitude),16),e.enableScrollWheelZoom(!0),v&&C){const i=new window.BMapGL.Point(v,C),t=new window.BMapGL.Marker(i);e.addOverlay(t)}B||e.addEventListener("click",i=>{e.clearOverlays();const t=new window.BMapGL.Point(i.latlng.lng,i.latlng.lat),a=new window.BMapGL.Marker(t);e.addOverlay(a),z(i.latlng.lat),A(i.latlng.lng)})},E=()=>{if(I(!0),j.current){if(!x.current){if("baidu"===k)return void W();"cesium"===k&&(()=>{const{init:e,flyTo:i,addMarkPoint:t,getLongitudeAndLatitude:a}=new w,{viewer:n}=e();x.current=n,i({longitude:v||window.mapLongitude,latitude:C||window.mapLatitude,height:9e5}),v&&C&&t({longitude:v,latitude:C}),B||a((e,i)=>{if(e)return;const{longitude:t,latitude:a}=i;z(a),A(t)})})()}I(!1)}},Z=()=>{P(""),x.current&&(x.current.destroy(),x.current=null),b&&b()};c(()=>{let e;return y&&(e=setTimeout(()=>{(()=>{if(window.mapLongitude||window.mapLatitude)return"baidu"===k?window.mapBaiDuKey?void(async()=>{window.BMapGL?E():window?.base?.loadDynamicResource?(await window.base.loadDynamicResource({url:`https://api.map.baidu.com/api?v=1.0&type=webgl&ak=${window.mapBaiDuKey}&callback=initialize`,type:"script",attr:{type:"text/javascript"}}),E()):(await u(`https://api.map.baidu.com/api?v=1.0&type=webgl&ak=${window.mapBaiDuKey}&callback=initialize`),E())})():void console.error("【Map】 请在window设置变量 mapBaiDuKey,以供地图初始化加载使用"):void("cesium"===k&&(async()=>{window.Cesium?E():window?.base?.loadDynamicResource?(await window.base.loadDynamicResource({url:"https://cesium.com/downloads/cesiumjs/releases/1.91/Build/Cesium/Cesium.js",type:"script",attr:{type:"text/javascript"}}),await window.base.loadDynamicResource({url:"https://cesium.com/downloads/cesiumjs/releases/1.91/Build/Cesium/Widgets/widgets.css",type:"link",attr:{rel:"stylesheet",type:"text/css"}}),E()):(await u("https://cesium.com/downloads/cesiumjs/releases/1.91/Build/Cesium/Cesium.js"),await p("https://cesium.com/downloads/cesiumjs/releases/1.91/Build/Cesium/Widgets/widgets.css"),E())})());console.error("【Map】 请在window设置变量 mapLongitude 和 mapLatitude,以供地图初始化坐标使用")})()},100)),()=>{e&&clearTimeout(e)}},[y]);const $=()=>{if(x.current){try{x.current.clearOverlays(),x.current.destroy(),x.current=null}catch(e){console.warn("Error destroying map on unmount:",e)}x.current=null}};return c(()=>()=>{$()},[]),m(e,{open:y,title:"坐标",onCancel:Z,width:1e3,destroyOnHidden:!1,mask:{closable:!1},afterClose:$,footer:[h(l,{onClick:Z,children:"取消"},"back"),!B&&h(l,{type:"primary",onClick:()=>{f&&f(O,R,{area:T}),Z()},children:"确定"},"submit")],children:[m(i,{labelAlign:"right",labelCol:{span:6},wrapperCol:{span:18},children:[M&&h(t,{gutter:24,children:h(a,{span:12,children:h(i.Item,{label:"所属区域",children:h(n,{value:T,onChange:e=>S(e),allowClear:!0,options:[{value:"1",label:"东港区"},{value:"2",label:"西港区"}]})})})}),!B&&"baidu"===k&&m(t,{gutter:24,children:[h(a,{span:12,children:h(i.Item,{label:"关键字搜索",children:h(r,{value:K,onChange:e=>P(e.target.value),allowClear:!0})})}),h(a,{span:12,children:m(i.Item,{label:" ",colon:!1,style:{textAlign:"right"},children:[h(l,{type:"primary",onClick:()=>{K&&x.current&&(D.current=new window.BMapGL.LocalSearch(x.current,{renderOptions:{map:x.current}}),D.current.search(K))},children:"搜索"}),h(l,{onClick:()=>{P(""),x.current&&D.current.search("")},style:{marginLeft:8},children:"重置"})]})})]}),m(t,{gutter:24,children:[h(a,{span:12,children:h(i.Item,{label:"经度",children:h(r,{disabled:!0,value:O})})}),h(a,{span:12,children:h(i.Item,{label:"纬度",children:h(r,{disabled:!0,value:R})})})]})]}),h("div",{ref:j,id:"map_container",style:{width:"100%",height:"500px",position:"relative"},children:h(o,{size:"large",description:"地图正在加载中...",spinning:G,children:h("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e3}})})})]})};g.displayName="MapSelector";export{g as default};
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
|
|
3
|
+
export interface MapProps {
|
|
4
|
+
/** 经度属性名,默认 longitude */
|
|
5
|
+
longitudeProps?: string;
|
|
6
|
+
/** 纬度属性名,默认 latitude */
|
|
7
|
+
latitudeProps?: string;
|
|
8
|
+
/** 经纬度是否必填,默认 true */
|
|
9
|
+
required?: boolean;
|
|
10
|
+
/** 所属区域 */
|
|
11
|
+
area?: string;
|
|
12
|
+
/** 是否显示所属区域 */
|
|
13
|
+
showArea?: boolean;
|
|
14
|
+
/** 是否只查看 */
|
|
15
|
+
disable?: boolean;
|
|
16
|
+
/** 确认选择回调 */
|
|
17
|
+
onConfirm?: (longitude: number | string, latitude: number | string, extra: { area: string }) => void;
|
|
18
|
+
/** 地图类型,默认 baidu */
|
|
19
|
+
type?: "baidu" | "cesium";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 定位组件
|
|
24
|
+
*/
|
|
25
|
+
declare const Map: FC<MapProps>;
|
|
26
|
+
|
|
27
|
+
export default Map;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Form as e,Row as r,Col as i,Input as l,Button as a}from"antd";import{useState as t}from"react";import d from"./MapSelector.js";import{jsxs as n,Fragment as s,jsx as o}from"react/jsx-runtime";const m=m=>{const{longitudeProps:u="longitude",latitudeProps:p="latitude",onConfirm:c,required:h=!0,area:g="",showArea:b=!1,disable:f=!1,type:y="baidu"}=m,q=e.useFormInstance(),[C,F]=t(!1),[I,x]=t(""),[V,j]=t("");return n(s,{children:[n(r,{gutter:24,children:[o(i,{span:12,children:o(e.Item,{label:"经度",name:u,rules:[{required:h,message:"请选择经度"}],children:o(l,{disabled:!0})})}),o(i,{span:12,children:o(e.Item,{label:"纬度",required:h,children:n("div",{style:{display:"flex",gap:10},children:[o(e.Item,{name:p,noStyle:!0,rules:[{required:h,message:"请选择纬度"}],children:o(l,{disabled:!0})}),o(a,{type:"primary",onClick:()=>{F(!0),x(q.getFieldValue(u)),j(q.getFieldValue(p))},children:"地图定位"})]})})})]}),o(d,{visible:C,onClose:()=>F(!1),longitude:I,latitude:V,area:g,type:y,showArea:b,disable:f,onConfirm:(e,r,i)=>{x(e),j(r),q.setFieldsValue({[u]:e,[p]:r}),c?.(e,r,i),F(!1)}})]})};m.displayName="Map";export{m as default};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { FC, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export interface PageProps {
|
|
4
|
+
/** 头部返回组件的标题 */
|
|
5
|
+
headerTitle?: ReactNode;
|
|
6
|
+
/** 历史记录对象,用于返回上一页,默认使用 window.history.back */
|
|
7
|
+
history?: {
|
|
8
|
+
goBack?: () => void;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
/** 是否显示头部组件,默认 true */
|
|
12
|
+
isShowHeader?: boolean;
|
|
13
|
+
/** 是否显示头部组件返回按钮,默认 true */
|
|
14
|
+
headerPrevious?: boolean;
|
|
15
|
+
/** 是否显示底部组件,默认 true */
|
|
16
|
+
isShowFooter?: boolean;
|
|
17
|
+
/** 是否显示头部和底部组件,默认 true */
|
|
18
|
+
isShowAllAction?: boolean;
|
|
19
|
+
/** 是否处于加载状态,默认 false */
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
/** 取消按钮文字,默认 "关闭" */
|
|
22
|
+
backButtonText?: string;
|
|
23
|
+
/** 内容区域的padding,默认 "20px" */
|
|
24
|
+
contentPadding?: string;
|
|
25
|
+
/** 自定义底部操作按钮组 */
|
|
26
|
+
customActionButtons?: ReactNode;
|
|
27
|
+
/** 额外底部操作按钮组 */
|
|
28
|
+
extraActionButtons?: ReactNode;
|
|
29
|
+
/** 内容区域 */
|
|
30
|
+
children: ReactNode | (() => ReactNode);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** 页面布局组件 */
|
|
34
|
+
declare const Page: FC<PageProps>;
|
|
35
|
+
|
|
36
|
+
export default Page;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Spin as e,Space as t,Button as i}from"antd";import{useState as o,useEffect as n}from"react";import{throttle as r}from"throttle-debounce";import d from"../HeaderBack/index.js";import{jsx as a,jsxs as s}from"react/jsx-runtime";function c(c){const{headerTitle:l,history:p,isShowHeader:h=!0,headerPrevious:u=!0,isShowFooter:m=!0,isShowAllAction:g=!0,loading:y=!1,backButtonText:f="关闭",contentPadding:x="20px",customActionButtons:w,extraActionButtons:v,children:k}=c,[b,B]=o(window.innerWidth),A=r(50,()=>{const e=document.querySelector("#page-layout");e&&B(e.offsetWidth)});return n(()=>{const e=setTimeout(()=>{A()},0);return g&&m&&window.addEventListener("resize",A),()=>{g&&m&&window.removeEventListener("resize",A),clearTimeout(e)}},[g,m]),a(e,{spinning:y,children:s("div",{className:"page-layout",id:"page-layout",children:[g&&h&&a(d,{title:l,history:p,previous:u}),s("div",{style:{padding:x},children:[k&&"function"==typeof k?k():k,g&&m&&s("div",{className:"page-layout-footer",style:{position:"relative",zIndex:"99"},children:[a("div",{style:{height:"52px"}}),a("div",{style:{textAlign:"center",backgroundColor:"rgb(241, 241, 242)",padding:"10px 0",position:"fixed",bottom:"0",width:b,margin:"0px -20px"},children:w||s(t,{children:[v,a(i,{onClick:()=>{p?.goBack?p.goBack():window.history.back()},children:f})]})})]})]})]})})}c.displayName="Page";export{c as default};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CSSProperties, FC } from "react";
|
|
2
|
+
|
|
3
|
+
export interface PdfProps {
|
|
4
|
+
/** pdf 文件地址 */
|
|
5
|
+
file: string;
|
|
6
|
+
/** pdf 文件名 */
|
|
7
|
+
name?: string;
|
|
8
|
+
/** 是否显示弹窗 */
|
|
9
|
+
visible?: boolean;
|
|
10
|
+
/** 弹窗的标题,默认 ”PDF预览“ */
|
|
11
|
+
title?: string;
|
|
12
|
+
/** 关闭弹窗的方法 */
|
|
13
|
+
onCancel?: () => void;
|
|
14
|
+
/** 是否使用内联模式,true为不使用弹窗,默认 false */
|
|
15
|
+
inline?: boolean;
|
|
16
|
+
/** 内联模式下的样式 */
|
|
17
|
+
style?: CSSProperties;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare const Pdf: FC<PdfProps>;
|
|
21
|
+
|
|
22
|
+
export default Pdf;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useFullscreen as e}from"ahooks";import{Modal as r,Button as o,Spin as i,message as n}from"antd";import{useState as t,useRef as l}from"react";import{pdfjs as a,Document as d,Page as c}from"react-pdf";import s from"../../hooks/useDownloadFile/index.js";import{getFileUrl as p}from"../../utils/index.js";import"react-pdf/dist/Page/AnnotationLayer.css";import"react-pdf/dist/Page/TextLayer.css";import"./index.less";import{jsx as m,Fragment as f}from"react/jsx-runtime";function h(h){const{visible:u=!1,onCancel:x,file:g,name:v,inline:y=!1,title:w="PDF预览",style:k={}}=h,C=p(),[j,F]=t(0),[P,b]=t(600),L=l(null),[S,{enterFullscreen:D,exitFullscreen:A}]=e(L),{downloadFile:N}=s();a.GlobalWorkerOptions.workerSrc=`//unpkg.com/pdfjs-dist@${a.version}/build/pdf.worker.min.mjs`;const W=({numPages:e})=>{F(e)},$=()=>{n.error("加载 PDF 文件失败"),x&&x()},z=({width:e})=>{b(e)},B=()=>m(f,{children:m("div",{style:{height:S?"calc(100vh - 40px - 24px - 8px - 32px - 12px)":"72vh",overflowY:"auto",padding:"24px",...k},children:m(d,{file:g.includes(C)?g:C+g,onLoadSuccess:W,onLoadError:$,loading:m("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"65vh"},children:m(i,{size:"large"})}),children:Array.from({length:j}).map((e,r)=>m(c,{pageNumber:r+1,onLoadSuccess:z},`page_${r+1}`))})})});return y?B():m("div",{ref:L,children:m(r,{style:{top:S?0:100,maxWidth:S?"100vw":"calc(100vw - 32px)",paddingBottom:S?0:24},open:u,mask:{closable:!1},width:S?"100vw":P+100,title:w,onCancel:()=>{S&&A(),x()},getContainer:!1,footer:[m(o,{onClick:()=>{S&&A(),x()},children:"关闭"},"cancel"),m(o,{onClick:()=>{S?A():D()},children:S?"退出全屏":"全屏"},"fullScreen"),m(o,{type:"primary",onClick:()=>{S&&A(),N({url:g,name:v})},children:"下载"},"download")],children:B()})})}h.displayName="Pdf";export{h as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
|
|
3
|
+
export interface PreviewExcelProps {
|
|
4
|
+
/** 文件列表,和 name、url 冲突 */
|
|
5
|
+
files?: { filePath?: string; fileName?: string; name?: string; url?: string; [key: string]: string }[];
|
|
6
|
+
/** 文件名字段名,传入 files 时会优先查找是否存在 name、fileName */
|
|
7
|
+
nameKey?: string;
|
|
8
|
+
/** 文件路径字段名,传入 files 时会优先查找是否存在 filePath、url */
|
|
9
|
+
urlKey?: string;
|
|
10
|
+
/** 单个文件名,和 files 冲突 */
|
|
11
|
+
name?: string;
|
|
12
|
+
/** 单个文件路径,和 files 冲突 */
|
|
13
|
+
url?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare const PreviewExcel: FC<PreviewExcelProps>;
|
|
17
|
+
|
|
18
|
+
export default PreviewExcel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Space as e,Button as l}from"antd";import{useState as i}from"react";import{getFileName as r}from"../../utils/index.js";import n from"../Excel/index.js";import{jsxs as a,Fragment as m,jsx as t}from"react/jsx-runtime";const c=c=>{const{files:o=[],nameKey:s="",urlKey:d="",name:p="",url:h=""}=c,[f,u]=i(!1),[y,x]=i(""),[v,C]=i(""),g=(e,l)=>{u(!0),x(e),C(l)},j=()=>{u(!1),x(""),C("")},P=e=>e.name||e.fileName||e[s]||r(e.filePath||e.url||e[d]),b=e=>e.filePath||e.url||e[d];return 0===o.length&&p&&h?a(m,{children:[a(e,{children:[t("span",{children:p}),t(l,{type:"primary",size:"small",onClick:()=>g(h,p),children:"预览"})]}),t(n,{visible:f,file:y,name:v,onCancel:j})]}):o.length>0&&!p&&!h?a(m,{children:[o.map(i=>t("div",{style:{marginTop:5},children:a(e,{children:[t("span",{children:P(i)}),t(l,{type:"primary",size:"small",onClick:()=>g(b(i),P(i)),children:"预览"})]})},b(i))),t(n,{visible:f,file:y,name:v,onCancel:j})]}):null};c.displayName="PreviewExcel";export{c as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
|
|
3
|
+
export interface PreviewImgProps {
|
|
4
|
+
/** 图片列表 */
|
|
5
|
+
files: string[] | { filePath?: string; [key: string]: string }[];
|
|
6
|
+
/** 图片地址的key,默认 filePath */
|
|
7
|
+
fileUrlKey?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare const PreviewImg: FC<PreviewImgProps>;
|
|
11
|
+
|
|
12
|
+
export default PreviewImg;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Image as t}from"antd";import{getFileUrl as r}from"../../utils/index.js";import{jsx as e}from"react/jsx-runtime";const i=i=>{const{files:o=[],fileUrlKey:m="filePath"}=i,a=r();return e(t.PreviewGroup,{children:o.filter(Boolean).map(r=>e(t,{src:r[m]?a+r[m]:a+r,styles:{root:{marginRight:10,marginBottom:10}},width:100,height:100,alt:""},r[m]||r))})};i.displayName="PreviewImg";export{i as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
|
|
3
|
+
export interface PreviewPdfProps {
|
|
4
|
+
/** 文件列表,和 name、url 冲突 */
|
|
5
|
+
files?: { filePath?: string; fileName?: string; name?: string; [key: string]: string }[];
|
|
6
|
+
/** 文件名字段名,传入 files 时会优先查找是否存在 name、fileName */
|
|
7
|
+
nameKey?: string;
|
|
8
|
+
/** 文件路径字段名,传入 files 时会优先查找是否存在 filePath */
|
|
9
|
+
urlKey?: string;
|
|
10
|
+
/** 单个文件名,和 files 冲突 */
|
|
11
|
+
name?: string;
|
|
12
|
+
/** 单个文件路径,和 files 冲突 */
|
|
13
|
+
url?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare const PreviewPdf: FC<PreviewPdfProps>;
|
|
17
|
+
|
|
18
|
+
export default PreviewPdf;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Space as e,Button as i}from"antd";import{useState as l}from"react";import{getFileName as n}from"../../utils/index.js";import r from"../Pdf/index.js";import{jsxs as a,Fragment as m,jsx as t}from"react/jsx-runtime";const o=o=>{const{files:s=[],nameKey:c="",urlKey:d="",name:f="",url:p=""}=o,[h,y]=l(!1),[u,P]=l(""),[v,x]=l(""),C=(e,i)=>{y(!0),P(e),x(i)},g=()=>{y(!1),P(""),x("")},j=e=>e.name||e.fileName||e[c]||n(e.filePath||e[d]);return 0===s.length&&f&&p?a(m,{children:[a(e,{children:[t("span",{children:f}),t(i,{type:"primary",size:"small",onClick:()=>C(p,f),children:"预览"})]}),t(r,{visible:h,file:u,name:v,onCancel:g})]}):s.length>0&&!f&&!p?a(m,{children:[s.map(l=>t("div",{style:{marginTop:5},children:a(e,{children:[t("span",{children:j(l)}),t(i,{type:"primary",size:"small",onClick:()=>C(l.filePath||l[d],j(l)),children:"预览"})]})},l.filePath||l[d])),t(r,{visible:h,file:u,name:v,onCancel:g})]}):null};o.displayName="PreviewPdf";export{o as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
|
|
3
|
+
export interface PreviewWordProps {
|
|
4
|
+
/** 文件列表,和 name、url 冲突 */
|
|
5
|
+
files?: { filePath?: string; fileName?: string; name?: string; url?: string; [key: string]: string }[];
|
|
6
|
+
/** 文件名字段名,传入 files 时会优先查找是否存在 name、fileName */
|
|
7
|
+
nameKey?: string;
|
|
8
|
+
/** 文件路径字段名,传入 files 时会优先查找是否存在 filePath、url */
|
|
9
|
+
urlKey?: string;
|
|
10
|
+
/** 单个文件名,和 files 冲突 */
|
|
11
|
+
name?: string;
|
|
12
|
+
/** 单个文件路径,和 files 冲突 */
|
|
13
|
+
url?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare const PreviewWord: FC<PreviewWordProps>;
|
|
17
|
+
|
|
18
|
+
export default PreviewWord;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Space as e,Button as i}from"antd";import{useState as l}from"react";import{getFileName as r}from"../../utils/index.js";import n from"../Word/index.js";import{jsxs as a,Fragment as m,jsx as t}from"react/jsx-runtime";const o=o=>{const{files:s=[],nameKey:c="",urlKey:d="",name:p="",url:h=""}=o,[f,u]=l(!1),[y,v]=l(""),[x,C]=l(""),g=(e,i)=>{u(!0),v(e),C(i)},j=()=>{u(!1),v(""),C("")},P=e=>e.name||e.fileName||e[c]||r(e.filePath||e.url||e[d]),b=e=>e.filePath||e.url||e[d];return 0===s.length&&p&&h?a(m,{children:[a(e,{children:[t("span",{children:p}),t(i,{type:"primary",size:"small",onClick:()=>g(h,p),children:"预览"})]}),t(n,{visible:f,file:y,name:x,onCancel:j})]}):s.length>0&&!p&&!h?a(m,{children:[s.map(l=>t("div",{style:{marginTop:5},children:a(e,{children:[t("span",{children:P(l)}),t(i,{type:"primary",size:"small",onClick:()=>g(b(l),P(l)),children:"预览"})]})},b(l))),t(n,{visible:f,file:y,name:x,onCancel:j})]}):null};o.displayName="PreviewWord";export{o as default};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, RefAttributes } from "react";
|
|
2
|
+
|
|
3
|
+
export interface SeamlessScrollProps {
|
|
4
|
+
/** 是否开启自动滚动,默认 true */
|
|
5
|
+
isAutoScroll?: boolean;
|
|
6
|
+
/** 原始数据列表 */
|
|
7
|
+
list: unknown[];
|
|
8
|
+
/** 步进速度,step 需是单步大小的约数,值越大滚动的越快,默认 1 */
|
|
9
|
+
step?: number;
|
|
10
|
+
/** 开启滚动的数据量,默认 3 */
|
|
11
|
+
limitScrollNum?: number;
|
|
12
|
+
/** 是否开启鼠标悬停,默认 true */
|
|
13
|
+
hover?: boolean;
|
|
14
|
+
/** 控制滚动方向,默认 up */
|
|
15
|
+
direction?: "up" | "down" | "left" | "right";
|
|
16
|
+
/** 单步运动停止的高度,默认 0 */
|
|
17
|
+
singleHeight?: number;
|
|
18
|
+
/** 单步运动停止的宽度,默认 0 */
|
|
19
|
+
singleWidth?: number;
|
|
20
|
+
/** 单步停止等待时间,默认 1000ms */
|
|
21
|
+
singleWaitTime?: number;
|
|
22
|
+
/** 是否开启 rem 度量,默认 false */
|
|
23
|
+
isRemUnit?: boolean;
|
|
24
|
+
/** 开启数据更新监听,默认 true */
|
|
25
|
+
isWatch?: boolean;
|
|
26
|
+
/** 动画时间,默认 0 */
|
|
27
|
+
delay?: number;
|
|
28
|
+
/** 动画方式,默认 ease-in */
|
|
29
|
+
ease?: string | { x1: number; y1: number; x2: number; y2: number };
|
|
30
|
+
/** 动画循环次数,-1 表示一直动画,默认 -1 */
|
|
31
|
+
count?: number;
|
|
32
|
+
/** 拷贝几份滚动列表,默认 1 */
|
|
33
|
+
copyNum?: number;
|
|
34
|
+
/** 开启鼠标悬停时支持滚轮滚动,默认 false */
|
|
35
|
+
wheel?: boolean;
|
|
36
|
+
/** 启用单行滚动,默认 false */
|
|
37
|
+
singleLine?: boolean;
|
|
38
|
+
/** 自定义类名 */
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface SeamlessScrollRef {
|
|
43
|
+
reset: () => void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 无缝滚动组件
|
|
48
|
+
*/
|
|
49
|
+
declare const SeamlessScroll: ForwardRefExoticComponent<SeamlessScrollProps & RefAttributes<SeamlessScrollRef>>;
|
|
50
|
+
|
|
51
|
+
export default SeamlessScroll;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{forwardRef as e,useRef as t,useState as r,useEffect as n,useImperativeHandle as l}from"react";import{throttle as o}from"throttle-debounce";import{jsx as i,jsxs as c,Fragment as u}from"react/jsx-runtime";const s=e((e,s)=>{const{isAutoScroll:a=!0,list:d=[],step:f=1,limitScrollNum:m=3,hover:h=!0,direction:p="up",singleHeight:y=0,singleWidth:g=0,singleWaitTime:w=1e3,isRemUnit:b=!1,isWatch:$=!0,delay:v=0,ease:x="ease-in",count:M=-1,copyNum:S=1,wheel:T=!1,singleLine:N=!1,children:A,className:W}=e,k=t(null),E=t(null),F=t(null),H=t(null),L=t(null),q=t(!1),[z,Y]=r(0),[j,C]=r(0),[I,R]=r(0),[U,B]=r(0),[D,G]=r(0),J=d.length>=m,K={width:z?`${z}px`:"auto",transform:`translate(${I}px,${U}px)`,transition:`all ${"string"==typeof x?x:`cubic-bezier(${x.x1}, ${x.y1}, ${x.x2}, ${x.y2})`} ${v}ms`,overflow:"hidden",display:N?"flex":"block"},O="left"===p||"right"===p,P=O?{float:"left",overflow:"hidden",display:N?"flex":"block",flexShrink:N?0:1}:{overflow:"hidden"},Q=b?Number.parseInt(window.getComputedStyle(document.documentElement,null).fontSize):1,V=g*Q,X=y*Q;n(()=>{X>0&&X%f>0&&console.error("如果设置了单步滚动,step 需是单步大小的约数,否则无法保证单步滚动结束的位置是否准确。~~~~~")},[X,f]);const Z=()=>{H.current&&(cancelAnimationFrame(H.current),H.current=null)},_=(e,t,r)=>{H.current=requestAnimationFrame(()=>{const n=j/2,l=z/2;if(("up"===e||"down"===e)&&n<=0)return;if(("left"===e||"right"===e)&&l<=0)return;let o=U,i=I;"up"===e?B(e=>Math.abs(e)>=n?(G(e=>e+1),o=-t,-t):(o=e-t,e-t)):"down"===e?B(e=>e>=0?(G(e=>e+1),o=-1*n+t,-1*n+t):(o=e+t,e+t)):"left"===e?R(e=>Math.abs(e)>=l?(G(e=>e+1),i=-t,-t):(i=e-t,e-t)):"right"===e&&R(e=>e>=0?(G(e=>e+1),i=-1*l+t,-1*l+t):(i=e+t,e+t)),r||(L.current&&clearTimeout(L.current),X?Math.abs(o)%X<t?L.current=window.setTimeout(()=>{ee()},w):ee():V&&Math.abs(i)%V<t?L.current=window.setTimeout(()=>{ee()},w):ee())})},ee=()=>{Z(),!q.current&&J&&D!==M?_(p,f,!1):G(0)},te=()=>{if(d&&"boolean"!=typeof d&&d.length>100&&console.warn(`数据达到了${d.length}条有点多哦~,可能会造成部分老旧浏览器卡顿。`),O){let e=E.current?.offsetWidth||0;e=2*e+1,Y(e)}J?requestAnimationFrame(()=>{const e=F.current?.offsetHeight||0;e>0?C(e):setTimeout(()=>{const e=F.current?.offsetHeight||0;e>0&&C(e)},100)}):(Z(),R(0),B(0))},re=()=>{q.current=!1,ee()},ne=()=>{q.current=!0,L.current&&clearTimeout(L.current),Z()},le=h&&a&&J,oe=()=>{Z(),te()},ie=o(30,e=>{Z();const t=X||15;e.deltaY<0&&_("down",t,!0),e.deltaY>0&&_("up",t,!0)});l(s,()=>({reset:oe})),n(()=>{J&&te()},[J]),n(()=>{J&&a&&(j>0||z>0)&&!q.current&&ee()},[j,z]),n(()=>{a?re():ne()},[a]),n(()=>{0!==M&&re()},[M]),n(()=>{$&&oe()},[d,$]),n(()=>()=>{Z(),L.current&&clearTimeout(L.current)},[]);const ce=()=>c(u,{children:[i("div",{ref:E,style:P,children:A&&"function"==typeof A?A():A}),J?Array.from({length:S}).map((e,t)=>i("div",{style:P,children:A&&"function"==typeof A?A():A},`copy-${t}`)):null]});return i("div",{ref:k,className:W,children:i("div",T&&h?{ref:F,style:K,onMouseEnter:()=>{le&&ne()},onMouseLeave:()=>{le&&re()},onWheel:e=>{le&&ie(e)},children:ce()}:{ref:F,style:K,onMouseEnter:()=>{le&&ne()},onMouseLeave:()=>{le&&re()},children:ce()})})});s.displayName="SeamlessScroll";export{s as default};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { FormInstance, FormProps } from "antd/es/form";
|
|
2
|
+
import type { ReactElement, ReactNode } from "react";
|
|
3
|
+
import type { FormListOption, FormListUniqueProps, FormOption } from "../FormBuilder";
|
|
4
|
+
import type { DeepPartial } from "../FormBuilder/FormBuilder";
|
|
5
|
+
|
|
6
|
+
export type { FormListOption, FormListUniqueProps, FormOption };
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Search 组件属性
|
|
10
|
+
*/
|
|
11
|
+
export interface SearchProps<Values = any> extends Omit<FormProps, "form" | "onFinish" | "onReset"> {
|
|
12
|
+
/** 表单配置项数组 */
|
|
13
|
+
options: FormOption<Values>[];
|
|
14
|
+
/** 表单值 */
|
|
15
|
+
values?: DeepPartial<Values>;
|
|
16
|
+
/** 搜索和重置都会触发的回调 */
|
|
17
|
+
onFinish?: (values: Values, type: "submit" | "reset") => void;
|
|
18
|
+
/** 搜索回调 */
|
|
19
|
+
onSubmit?: (values: Values) => void;
|
|
20
|
+
/** 重置回调 */
|
|
21
|
+
onReset?: (values: Values) => void;
|
|
22
|
+
/** 搜索按钮文本,默认"搜索" */
|
|
23
|
+
searchText?: string;
|
|
24
|
+
/** 重置按钮文本,默认"重置" */
|
|
25
|
+
resetText?: string;
|
|
26
|
+
/** 是否显示搜索按钮,默认 true */
|
|
27
|
+
showSearchButton?: boolean;
|
|
28
|
+
/** 是否显示重置按钮,默认 true */
|
|
29
|
+
showResetButton?: boolean;
|
|
30
|
+
/** 额外的底部按钮组 */
|
|
31
|
+
extraButtons?: ReactNode;
|
|
32
|
+
/** 表单实例(通过 Form.useForm() 创建) */
|
|
33
|
+
form: FormInstance<Values>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 搜索表单组件
|
|
38
|
+
* 支持自动展开/收起功能,当表单项超过4个时显示展开/收起按钮
|
|
39
|
+
*/
|
|
40
|
+
type SearchComponent = {
|
|
41
|
+
useForm: typeof import("antd").Form.useForm;
|
|
42
|
+
useWatch: typeof import("antd").Form.useWatch;
|
|
43
|
+
} & {
|
|
44
|
+
<Values = any>(props: SearchProps<Values>): ReactElement;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
declare const Search: SearchComponent;
|
|
48
|
+
|
|
49
|
+
export default Search;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DownOutlined as e,UpOutlined as t}from"@ant-design/icons";import{Form as o,Row as n,Col as r,Button as l}from"antd";import{useState as s,useRef as i,useEffect as a}from"react";import c from"../FormBuilder/FormItemsRenderer.js";import m from"../Icon/ResetIcon/index.js";import u from"../Icon/SearchIcon/index.js";import{jsx as d,jsxs as h}from"react/jsx-runtime";const p=p=>{const{labelCol:f={span:6},options:y=[],values:b={},onFinish:g,onSubmit:x,onReset:C,searchText:F="搜索",resetText:I="重置",showSearchButton:w=!0,showResetButton:j=!0,extraButtons:k,form:R,...S}=p,[V,v]=s(!0),[B,A]=s(6),[N,T]=s(!1),$=i(`search-${Date.now()}`);return a(()=>{y&&0!==y.length&&setTimeout(()=>{const e=document.querySelectorAll(`.${$.current}>.${window.process.env.app.antd["ant-prefix"]}-col`).length-(k?2:1);A({0:24,1:18,2:12,3:6}[e%4]||6),T(e>3)},0)},[y,k]),d("div",{className:"search-layout card-layout",children:d(o,{form:R,labelCol:f,initialValues:b,...S,children:h(n,{className:$.current,children:[d(c,{options:y,labelCol:f,span:6,collapse:V,useAutoGenerateRequired:!1,initialValues:b}),d(r,{span:N&&V?6:B,children:h(o.Item,{label:" ",labelCol:{span:2},colon:!1,style:{textAlign:"right"},children:[w&&d(l,{type:"primary",icon:d(u,{}),onClick:()=>{const e=R.getFieldsValue();g?.(e,"submit"),x?.(e)},children:F}),j&&d(l,{style:{marginLeft:8},icon:d(m,{}),onClick:()=>{const e=R.getFieldsValue(),t={};Object.keys(e).forEach(e=>{t[e]=b.hasOwnProperty(e)?b[e]:void 0}),R.setFieldsValue(t),g?.(b,"reset"),C?.(b)},children:I}),N&&d(l,{type:"link",icon:d(V?e:t,{}),onClick:()=>{v(!V)},style:{marginLeft:8},children:V?"展开":"收起"})]})}),k&&d(r,{span:24,children:d(o.Item,{label:" ",colon:!1,labelCol:{span:0},children:k})})]})})})};p.displayName="Search",p.useForm=o.useForm,p.useWatch=o.useWatch;export{p as default};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SelectProps } from "antd/es/select";
|
|
2
|
+
import type { FC, ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 组件属性
|
|
6
|
+
*/
|
|
7
|
+
export interface BasicSelectProps extends SelectProps {
|
|
8
|
+
/** 数据源 */
|
|
9
|
+
data: Record<string, any>[];
|
|
10
|
+
/** 数据 label 字段,默认 name */
|
|
11
|
+
nameKey?: string;
|
|
12
|
+
/** 数据 value 字段,默认 id */
|
|
13
|
+
idKey?: string;
|
|
14
|
+
/** 占位符 */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/** 获取 label */
|
|
17
|
+
onGetLabel?: (label: string | string[]) => void;
|
|
18
|
+
/** 获取选中的项 */
|
|
19
|
+
onGetOption?: (option: Record<string, any> | Record<string, any>[]) => void;
|
|
20
|
+
/** 获取数据 */
|
|
21
|
+
onGetData?: (data: Record<string, any>[]) => void;
|
|
22
|
+
/** 自定义 label 的渲染函数 */
|
|
23
|
+
labelRender?: (item: Record<string, any>) => ReactNode;
|
|
24
|
+
/** 排除的项 */
|
|
25
|
+
exclude?: string[];
|
|
26
|
+
/** 包含的项 */
|
|
27
|
+
include?: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 基础下拉组件
|
|
32
|
+
*/
|
|
33
|
+
declare const BasicSelect: FC<BasicSelectProps>;
|
|
34
|
+
|
|
35
|
+
export default BasicSelect;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Select as e}from"antd";import{useMemo as t,useEffect as l}from"react";import{getUnmatchedItems as a,getMatchedItems as n}from"../../../utils/index.js";import{jsx as o}from"react/jsx-runtime";function i(i){const{onGetData:r,onChange:s,onGetLabel:d,onGetOption:c,placeholder:p="",data:f=[],nameKey:h="name",idKey:m="id",labelRender:u,exclude:y=[],include:g=[],...x}=i,K=t(()=>{let e=f;return y.length>0&&(e=a({list:e,value:y,idKey:m})),g.length>0&&(e=n({list:e,value:g,idKey:m})),e},[f,y,g,m]);return l(()=>{r?.(K)},[K]),o(e,{placeholder:`请选择${p}`,showSearch:{optionFilterProp:"children"},allowClear:!0,onChange:(e,t)=>{if(d||c)if(Array.isArray(e))if(e.length>0){const t=[],l=[];e.forEach(e=>{const a=K.find(t=>t[m]===e);a&&(t.push(a),l.push(a[h]))}),d?.(l),c?.(t)}else d?.([]),c?.([]);else if(e){const t=K.find(t=>t[m]===e);d?.(t[h]),c?.(t)}else d?.(""),c?.({});s?.(e,t)},options:K.map(e=>({value:e[m],label:u?u(e):e[h]})),...x})}i.displayName="BasicSelect";export{i as default};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { BasicSelectProps } from "../Basic";
|
|
3
|
+
|
|
4
|
+
export interface DictionarySelectItem {
|
|
5
|
+
dictValue: string;
|
|
6
|
+
dictLabel: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 组件属性
|
|
12
|
+
*/
|
|
13
|
+
export interface DictionarySelectProps extends Omit<BasicSelectProps, "data" | "nameKey" | "idKey" | "onGetOption" | "onGetData"> {
|
|
14
|
+
/** appKey,默认 DICTIONARY_APP_KEY_ENUM.DEFAULT(0bb989ecada5470c87635018ece9f327) */
|
|
15
|
+
appKey?: string;
|
|
16
|
+
/** 要获取的字典 */
|
|
17
|
+
dictValue: string;
|
|
18
|
+
/** 树形数据 label 字段,默认 dictLabel */
|
|
19
|
+
nameKey?: string;
|
|
20
|
+
/** 树形数据 value 字段,默认 dictValue */
|
|
21
|
+
idKey?: string;
|
|
22
|
+
/** 获取选中的项 */
|
|
23
|
+
onGetOption?: (option: DictionarySelectItem | DictionarySelectItem[]) => void;
|
|
24
|
+
/** 获取数据 */
|
|
25
|
+
onGetData?: (data: DictionarySelectItem[]) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 数据字典下拉组件
|
|
30
|
+
*/
|
|
31
|
+
declare const DictionarySelect: FC<DictionarySelectProps>;
|
|
32
|
+
|
|
33
|
+
export default DictionarySelect;
|
|
@@ -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 a}from"zy-react-data/enum/dictionary";import{executeWithCache as r}from"../../../utils/index.js";import c from"../Basic/index.js";import{jsx as o}from"react/jsx-runtime";function n(n){const{appKey:d=a.DEFAULT,dictValue:s="",nameKey:l="dictLabel",idKey:m="dictValue",...p}=n,[y,u]=t([]);return i(()=>{(async()=>{if(!Object.values(a).includes(d))return void console.error(`【DictionarySelect】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${d}`);if(!s)return void console.error("【DictionarySelect】 缺少 dictValue 参数");const t={appKey:d,dictValue:s};await r(t,async()=>{const{data:t}=await e("/config/dict-trees/list/by/dictValues","get",{appKey:d,dictValue:s});return t},u)})()},[s]),o(c,{data:y,nameKey:l,idKey:m,...p})}n.displayName="DictionarySelect";export{n as default};
|