zy-react-library 1.1.52 → 1.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.
@@ -11,8 +11,10 @@ export interface BasicCascaderProps extends Omit<CascaderProps, "fieldNames"> {
11
11
  idKey?: string;
12
12
  /** 树形数据 children 字段,默认 children */
13
13
  childrenKey?: string;
14
- /** 决定 onGetNodePaths 是否包含自身节点,默认 true */
14
+ /** @deprecated 已弃用,请使用 getNodePathsIsIncludeOneself */
15
15
  onGetNodePathsIsIncludeOneself?: boolean;
16
+ /** 决定 onGetNodePaths 是否包含自身节点,默认 true */
17
+ getNodePathsIsIncludeOneself?: boolean;
16
18
  /** 获取父级节点 */
17
19
  onGetNodePaths?: (nodes: Record<string, any>[]) => void;
18
20
  /** 占位符 */
@@ -1 +1 @@
1
- import{Cascader as e}from"antd";import{useMemo as a,useEffect as t}from"react";import{processTreeDataByLevel as n}from"../../../utils/index.js";import{jsx as r}from"react/jsx-runtime";function l(l){const{onGetData:o,onChange:i,onGetNodePaths:d,onGetNodePathsIsIncludeOneself:c=!0,placeholder:s="",data:m=[],nameKey:h="name",idKey:f="id",childrenKey:p="children",level:u,...y}=l,v=a(()=>u?n({data:m,level:u,childrenKey:p,currentLevel:1}):m,[m,u,p]);return t(()=>{o?.(m,v)},[m,v]),r(e,{options:v,placeholder:`请选择${s}`,onChange:(e,a)=>{if(a&&d){const e=(e=>{let a=e;return!c&&e&&(a=e.slice(0,-1)),a||[]})(a);d?.(e)}i?.(e,a)},fieldNames:{label:h,value:f,children:p},...y})}l.displayName="BasicCascader";export{l as default};
1
+ import{Cascader as e}from"antd";import{useMemo as n,useEffect as a}from"react";import{processTreeDataByLevel as t}from"../../../utils/index.js";import{jsx as o}from"react/jsx-runtime";function l(l){const{onGetData:s,onChange:d,onGetNodePaths:r,onGetNodePathsIsIncludeOneself:c,getNodePathsIsIncludeOneself:i=!0,placeholder:h="",data:m=[],nameKey:f="name",idKey:u="id",childrenKey:p="children",level:I,...N}=l;void 0!==c&&console.warn("【BasicCascader】 onGetNodePathsIsIncludeOneself 参数已弃用,请使用 getNodePathsIsIncludeOneself 参数");const v=void 0!==c?c:i,y=n(()=>I?t({data:m,level:I,childrenKey:p,currentLevel:1}):m,[m,I,p]);return a(()=>{s?.(m,y)},[m,y]),o(e,{options:y,placeholder:`请选择${h}`,onChange:(e,n)=>{if(n&&r){const e=(e=>{let n=e;return!v&&e&&(n=e.slice(0,-1)),n||[]})(n);r?.(e)}d?.(e,n)},fieldNames:{label:f,value:u,children:p},...N})}l.displayName="BasicCascader";export{l as default};
@@ -1,4 +1,5 @@
1
1
  import type { FormInstance, FormProps } from "antd/es/form";
2
+ import type { useForm, useWatch } from "antd/es/form/Form";
2
3
  import type { Gutter } from "antd/es/grid/row";
3
4
  import type { FC, ReactNode } from "react";
4
5
  import type { FormOption, FormValues } from "./FormItemsRenderer";
@@ -40,6 +41,9 @@ export interface FormBuilderProps extends Omit<FormProps, "form"> {
40
41
  /**
41
42
  * 表单构建器组件
42
43
  */
43
- declare const FormBuilder: FC<FormBuilderProps>;
44
+ declare const FormBuilder: FC<FormBuilderProps> & {
45
+ useForm: typeof useForm;
46
+ useWatch: typeof useWatch;
47
+ };
44
48
 
45
49
  export default FormBuilder;
@@ -1 +1 @@
1
- import{Spin as t,Form as e,Row as i,Col as n,Space as o,Button as r,message as l}from"antd";import{useState as s,useEffect as a}from"react";import{throttle as d}from"throttle-debounce";import u from"./FormItemsRenderer.js";import{jsx as c,jsxs as p}from"react/jsx-runtime";const m=m=>{const{values:h,options:g,gutter:w=24,span:x=12,labelCol:y={span:4},useAutoGenerateRequired:b=!0,showActionButtons:f=!0,submitButtonText:B="提交",cancelButtonText:v="取消",showSubmitButton:A=!0,showCancelButton:C=!0,customActionButtons:T,extraActionButtons:F,loading:k=!1,...q}=m,[z,E]=s(window.innerWidth),R=d(50,()=>{const t=document.querySelector("#page-layout");t&&E(t.offsetWidth)});return a(()=>{const t=setTimeout(()=>{R()},0);return f&&window.addEventListener("resize",R),()=>{f&&window.removeEventListener("resize",R),clearTimeout(t)}},[f]),c(t,{spinning:k,children:p(e,{labelCol:y,scrollToFirstError:!0,wrapperCol:{span:24-y.span},initialValues:h,onFinishFailed:()=>{l.error("请补全必填项")},style:{width:`calc(100% - ${2*w}px)`,margin:"0 auto"},...q,children:[c(i,{gutter:w,children:c(u,{options:g,labelCol:y,span:x,gutter:w,useAutoGenerateRequired:b,initialValues:h})}),f&&p("div",{style:{position:"relative",zIndex:"9"},children:[c("div",{style:{height:"32px"}}),c(i,{style:{textAlign:"center",backgroundColor:"rgb(241, 241, 242)",padding:"10px 0",position:"fixed",bottom:"0",width:z,margin:"0 -44px"},children:c(n,{span:24,style:{textAlign:"center"},children:T||p(o,{children:[A&&c(r,{type:"primary",htmlType:"submit",children:B}),F,C&&c(r,{onClick:()=>{window.history.back()},children:v})]})})})]})]})})};m.displayName="FormBuilder";export{m as default};
1
+ import{Form as e,Spin as t,Row as o,Col as r,Space as i,Button as n,message as s}from"antd";import{useState as l,useEffect as a}from"react";import{throttle as u}from"throttle-debounce";import d from"./FormItemsRenderer.js";import{jsx as c,jsxs as m}from"react/jsx-runtime";const p=p=>{const{values:h,options:g,gutter:w=24,span:x=12,labelCol:y={span:4},useAutoGenerateRequired:b=!0,showActionButtons:f=!0,submitButtonText:B="提交",cancelButtonText:v="取消",showSubmitButton:A=!0,showCancelButton:C=!0,customActionButtons:F,extraActionButtons:T,loading:W=!1,...k}=p,[q,z]=l(window.innerWidth),E=u(50,()=>{const e=document.querySelector("#page-layout");e&&z(e.offsetWidth)});return a(()=>{const e=setTimeout(()=>{E()},0);return f&&window.addEventListener("resize",E),()=>{f&&window.removeEventListener("resize",E),clearTimeout(e)}},[f]),c(t,{spinning:W,children:m(e,{labelCol:y,scrollToFirstError:!0,wrapperCol:{span:24-y.span},initialValues:h,onFinishFailed:()=>{s.error("请补全必填项")},style:{width:`calc(100% - ${2*w}px)`,margin:"0 auto"},...k,children:[c(o,{gutter:w,children:c(d,{options:g,labelCol:y,span:x,gutter:w,useAutoGenerateRequired:b,initialValues:h})}),f&&m("div",{style:{position:"relative",zIndex:"9"},children:[c("div",{style:{height:"32px"}}),c(o,{style:{textAlign:"center",backgroundColor:"rgb(241, 241, 242)",padding:"10px 0",position:"fixed",bottom:"0",width:q,margin:"0 -44px"},children:c(r,{span:24,style:{textAlign:"center"},children:F||m(i,{children:[A&&c(n,{type:"primary",htmlType:"submit",children:B}),T,C&&c(n,{onClick:()=>{window.history.back()},children:v})]})})})]})]})})};p.displayName="FormBuilder",p.useForm=e.useForm,p.useWatch=e.useWatch;export{p as default};
@@ -1 +1 @@
1
- import{InfoCircleOutlined as e}from"@ant-design/icons";import{Input as r,DatePicker as n,Form as l,Col as t,Divider as s,Row as a,Button as o,Tooltip as d,Checkbox as i,Radio as u,Select as p,InputNumber as c}from"antd";import m from"dayjs";import{FORM_ITEM_RENDER_ENUM as h}from"../../enum/formItemRender/index.js";import{jsx as y,Fragment as E,jsxs as b}from"react/jsx-runtime";const{TextArea:f}=r,{RangePicker:T}=n,v=({options:v,labelCol:A,gutter:I=24,span:Y=12,collapse:D=!1,useAutoGenerateRequired:R=!0,initialValues:w})=>{const C=l.useFormInstance(),U=()=>{const e=C.getFieldsValue();return 0===Object.keys(e).length&&w?w:e},M=e=>"function"==typeof e.componentProps?e.componentProps(U()):e.componentProps||{},N=e=>{const r="function"==typeof e.formItemProps?e.formItemProps(U()):e.formItemProps||{};return[h.DATE,h.DATE_MONTH,h.DATE_YEAR,h.DATETIME].includes(e.render)&&(r.getValueFromEvent=(e,r)=>r,r.getValueProps=e=>({value:e?m(e):void 0})),[h.DATE_WEEK].includes(e.render)&&(r.getValueFromEvent=(e,r)=>r,r.getValueProps=e=>({value:e?m(e,"YYYY-wo"):void 0})),[h.DATE_RANGE,h.DATETIME_RANGE].includes(e.render)&&(r.getValueFromEvent=(e,r)=>r,r.getValueProps=e=>({value:Array.isArray(e)?e.map(e=>e?m(e):void 0):void 0})),r},P=e=>"function"==typeof e?e(U()):e??!0,x=e=>{if(e.render===h.DIVIDER)return[];const r=[];switch(e.render||h.INPUT){case h.INPUT:!1!==e.useConstraints&&r.push({max:50,message:"最多输入50字符"});break;case h.TEXTAREA:!1!==e.useConstraints&&r.push({max:500,message:"最多输入500字符"});break;case h.INPUT_NUMBER:case h.NUMBER:!1!==e.useConstraints&&r.push({pattern:/^(\d+)(\.\d{1,2})?$/,message:"请输入正确的数字,最多保留两位小数"}),!1!==e.useConstraints&&r.push({validator:(e,r)=>r&&Math.abs(Number.parseFloat(r))>999999999?Promise.reject("输入数值超出安全范围"):Promise.resolve()})}if(!R)return e.rules?Array.isArray(e.rules)?[...e.rules,...r]:[e.rules,...r]:r;if(P(e.required)){const n=!e.render||[h.INPUT,h.TEXTAREA,h.INPUT_NUMBER,h.NUMBER].includes(e.render);return r.push({required:!0,message:`${n?"请输入":"请选择"}${e.label}`}),e.rules&&(Array.isArray(e.rules)?r.push(...e.rules):r.push(e.rules)),r}return e.rules?Array.isArray(e.rules)?[...e.rules,...r]:[e.rules,...r]:r},g=e=>e.key||e.name,B=e=>{const r=e.render===h.DIVIDER?24:e.span??Y,n=e.labelCol??(24===r?{span:A.span/2}:A);return{span:r,labelCol:n,wrapperCol:e.wrapperCol??{span:24-n.span}}},_=(e,r)=>({value:e[r.valueKey],label:"function"==typeof r.labelKey?r.labelKey(e):e[r.labelKey],disabled:e.disabled}),k=e=>{const l=M(e),s=(e=>({valueKey:e?.itemsField?.valueKey||"bianma",labelKey:e?.itemsField?.labelKey||"name"}))(e),o=e.render||h.INPUT,d=e.placeholder||`请${[h.INPUT,h.TEXTAREA,h.INPUT_NUMBER,h.NUMBER].includes(o)?"输入":"选择"}${e.label}`;switch(o){case h.INPUT:return y(r,{placeholder:d,maxLength:!1!==e.useConstraints?50:9999,...l});case h.TEXTAREA:return y(f,{placeholder:d,maxLength:!1!==e.useConstraints?500:9999,showCount:!0,rows:3,...l});case h.INPUT_NUMBER:case h.NUMBER:return y(c,{placeholder:d,style:{width:"100%"},...l});case h.SELECT:return y(p,{placeholder:d,showSearch:!0,allowClear:!0,optionFilterProp:"children",...l,children:(e.items||[]).map(e=>{const{value:r,label:n,disabled:l}=_(e,s);return y(p.Option,{value:r,disabled:l,children:n},r)})});case h.RADIO:return y(u.Group,{...l,children:(e.items||[]).map(e=>{const{value:r,label:n,disabled:l}=_(e,s);return y(u,{value:r,disabled:l,children:n},r)})});case h.CHECKBOX:return y(i.Group,{...l,children:e.checkboxCol?y(a,{children:(e.items||[]).map(r=>{const{value:n,label:l,disabled:a}=_(r,s);return y(t,{span:e.checkboxCol,children:y(i,{value:n,disabled:a,children:l})},n)})}):(e.items||[]).map(e=>{const{value:r,label:n,disabled:l}=_(e,s);return y(i,{value:r,disabled:l,children:n},r)})});case h.DATE:return y(n,{placeholder:d,format:"YYYY-MM-DD",style:{width:"100%"},...l});case h.DATE_MONTH:return y(n,{picker:"month",placeholder:d,format:"YYYY-MM",style:{width:"100%"},...l});case h.DATE_YEAR:return y(n,{picker:"year",placeholder:d,format:"YYYY",style:{width:"100%"},...l});case h.DATE_WEEK:return y(n,{picker:"week",placeholder:d,format:"YYYY-wo",style:{width:"100%"},...l});case h.DATE_RANGE:return y(T,{placeholder:[`请选择开始${e.label}`,`请选择结束${e.label}`],format:"YYYY-MM-DD",style:{width:"100%"},...l});case h.DATETIME:return y(n,{showTime:!0,placeholder:d,format:"YYYY-MM-DD HH:mm:ss",style:{width:"100%"},...l});case h.DATETIME_RANGE:return y(T,{showTime:!0,placeholder:[`请选择开始${e.label}`,`请选择结束${e.label}`],format:"YYYY-MM-DD HH:mm:ss",style:{width:"100%"},...l});case h.DIVIDER:return null;default:return o}},V=r=>r.tip?b(E,{children:[r.label,y(d,{title:r.tip,children:y(e,{style:{marginLeft:4,fontSize:12}})})]}):r.label,F=({option:e,style:r,col:n,index:s})=>{const a=N(e);return delete a.dependencies,delete a.shouldUpdate,("function"==typeof(o=e.hidden)?o(U()):o)?null:y(t,{span:n.span,style:r,children:y(l.Item,{name:e.name,label:V(e),rules:x(e),labelCol:n.labelCol,wrapperCol:n.wrapperCol,preserve:!1,...a,children:k(e)})},g(e)||s);var o},K=({option:e,style:r,col:n,index:a})=>{const o=M(e);return e.customizeRender?y(t,{span:n.span,style:r,children:e.render},g(e)||a):e.onlyForLabel?y(l.Item,{name:e.name,noStyle:!0,preserve:!1,children:y("input",{type:"hidden"})},g(e)||a):e.render===h.DIVIDER?y(t,{span:n.span,style:r,children:y(s,{orientation:"left",...o,children:e.label})},g(e)||a):null};return y(E,{children:v.map((e,r)=>{const n=B(e),s=(e=>D&&e>=3?{display:"none"}:void 0)(r),d=N(e);return K({option:e,style:s,col:n,index:r})||(e.render===h.FORM_LIST?((e,r,n,s)=>{const d=(e=>{const r={showAddButton:!0,showRemoveButton:!0,addButtonText:"添加",removeButtonText:"删除",options:[],addDefaultValue:{},addInsertIndex:void 0};return"function"==typeof e.formListUniqueProps?{...r,...e.formListUniqueProps(U())}:{...r,...e.formListUniqueProps||{}}})(e),i=M(e);return y(t,{span:n.span,style:s,children:y(l.List,{name:e.name,...i,children:(e,{add:r,remove:n,move:i})=>y(E,{children:e.map((e,u)=>{const p=((e,r,n,l,t,s)=>"function"==typeof e?e(r,n,{field:r,fieldIndex:n,add:l,remove:t,move:s}):e??[])(d.options,e,u,r,n,i);return y(a,{gutter:I,children:p.map((a,i)=>{const c=B(a),m=N(a);delete m.dependencies,delete m.shouldUpdate;const h={option:a,style:s,col:c,index:`${u}_${i}`};return K(h)||(i===p.length-1?y(t,{span:c.span,style:s,children:y(l.Item,{label:V(a),labelCol:c.labelCol,wrapperCol:c.wrapperCol,preserve:!1,required:P(a.required),...m,children:b("div",{style:{display:"flex",gap:10,alignItems:"center",justifyContent:"space-between"},children:[y("div",{style:{flex:1},children:y(l.Item,{noStyle:!0,rules:x(a),name:a.name,children:k(a)})}),u>=1?d.showRemoveButton&&y(o,{type:"primary",danger:!0,onClick:()=>n(e.name),children:d.removeButtonText}):d.showAddButton&&y(o,{type:"primary",onClick:()=>r(d.addDefaultValue,d.addInsertIndex),children:d.addButtonText})]})})},g(a)||i):F(h))})},e.key)})})})},g(e)||r)})(e,r,n,s):(e.shouldUpdate??e.dependencies)||(d.shouldUpdate??d.dependencies)?((e,r,n,t)=>{const s=N(e);return y(l.Item,{noStyle:!0,preserve:!1,shouldUpdate:e.shouldUpdate??s.shouldUpdate,dependencies:e.dependencies??s.dependencies,children:()=>F({option:e,style:n,col:t,index:r})},g(e)||r)})(e,r,s,n):F({option:e,style:s,col:n,index:r}))})})};v.displayName="FormItemsRenderer";export{v as default};
1
+ import{InfoCircleOutlined as e}from"@ant-design/icons";import{Input as r,DatePicker as n,Form as l,Col as t,Divider as s,Row as a,Button as o,Checkbox as d,Radio as i,Select as u,InputNumber as p,Tooltip as c}from"antd";import m from"dayjs";import{FORM_ITEM_RENDER_ENUM as h}from"../../enum/formItemRender/index.js";import{jsx as y,Fragment as E,jsxs as b}from"react/jsx-runtime";const{TextArea:f}=r,{RangePicker:T}=n,v=({options:v,labelCol:A,gutter:I=24,span:Y=12,collapse:D=!1,useAutoGenerateRequired:R=!0,initialValues:w})=>{const C=l.useFormInstance(),U=()=>{const e=C.getFieldsValue();return 0===Object.keys(e).length&&w?w:e},M=e=>"function"==typeof e.componentProps?e.componentProps(U()):e.componentProps||{},N=e=>{const r="function"==typeof e.formItemProps?e.formItemProps(U()):e.formItemProps||{};return[h.DATE,h.DATE_MONTH,h.DATE_YEAR,h.DATETIME].includes(e.render)&&(r.getValueFromEvent=(e,r)=>r,r.getValueProps=e=>({value:e?m(e):void 0})),[h.DATE_WEEK].includes(e.render)&&(r.getValueFromEvent=(e,r)=>r,r.getValueProps=e=>({value:e?m(e,"YYYY-wo"):void 0})),[h.DATE_RANGE,h.DATETIME_RANGE].includes(e.render)&&(r.getValueFromEvent=(e,r)=>r,r.getValueProps=e=>({value:Array.isArray(e)?e.map(e=>e?m(e):void 0):void 0})),r},P=e=>"function"==typeof e?e(U()):e??!0,x=e=>{if(e.render===h.DIVIDER)return[];const r=[];switch(e.render||h.INPUT){case h.INPUT:!1!==e.useConstraints&&r.push({max:50,message:"最多输入50字符"});break;case h.TEXTAREA:!1!==e.useConstraints&&r.push({max:500,message:"最多输入500字符"});break;case h.INPUT_NUMBER:case h.NUMBER:!1!==e.useConstraints&&r.push({pattern:/^(\d+)(\.\d{1,2})?$/,message:"请输入正确的数字,最多保留两位小数"}),!1!==e.useConstraints&&r.push({validator:(e,r)=>r&&Math.abs(Number.parseFloat(r))>999999999?Promise.reject("输入数值超出安全范围"):Promise.resolve()})}if(!R)return e.rules?Array.isArray(e.rules)?[...e.rules,...r]:[e.rules,...r]:r;if(P(e.required)){const n=!e.render||[h.INPUT,h.TEXTAREA,h.INPUT_NUMBER,h.NUMBER].includes(e.render);return r.push({required:!0,message:`${n?"请输入":"请选择"}${e.label}`}),e.rules&&(Array.isArray(e.rules)?r.push(...e.rules):r.push(e.rules)),r}return e.rules?Array.isArray(e.rules)?[...e.rules,...r]:[e.rules,...r]:r},g=e=>e.key||e.name,B=e=>{const r=e.render===h.DIVIDER?24:e.span??Y,n=e.labelCol??(24===r?{span:A.span/2}:A);return{span:r,labelCol:n,wrapperCol:e.wrapperCol??{span:24-n.span}}},_=(e,r)=>({value:e[r.valueKey],label:"function"==typeof r.labelKey?r.labelKey(e):e[r.labelKey],disabled:e.disabled}),k=e=>{const l=M(e),s=(e=>({valueKey:e?.itemsField?.valueKey||"bianma",labelKey:e?.itemsField?.labelKey||"name"}))(e),o=e.render||h.INPUT,c=e.placeholder||`请${[h.INPUT,h.TEXTAREA,h.INPUT_NUMBER,h.NUMBER].includes(o)?"输入":"选择"}${e.label}`;switch(o){case h.INPUT:return y(r,{placeholder:c,maxLength:!1!==e.useConstraints?50:9999,...l});case h.TEXTAREA:return y(f,{placeholder:c,maxLength:!1!==e.useConstraints?500:9999,showCount:!0,rows:3,...l});case h.INPUT_NUMBER:case h.NUMBER:return y(p,{placeholder:c,style:{width:"100%"},...l});case h.SELECT:return y(u,{placeholder:c,showSearch:!0,allowClear:!0,optionFilterProp:"children",...l,children:(e.items||[]).map(e=>{const{value:r,label:n,disabled:l}=_(e,s);return y(u.Option,{value:r,disabled:l,children:n},r)})});case h.RADIO:return y(i.Group,{...l,children:(e.items||[]).map(e=>{const{value:r,label:n,disabled:l}=_(e,s);return y(i,{value:r,disabled:l,children:n},r)})});case h.CHECKBOX:return y(d.Group,{...l,children:e.checkboxCol?y(a,{children:(e.items||[]).map(r=>{const{value:n,label:l,disabled:a}=_(r,s);return y(t,{span:e.checkboxCol,children:y(d,{value:n,disabled:a,children:l})},n)})}):(e.items||[]).map(e=>{const{value:r,label:n,disabled:l}=_(e,s);return y(d,{value:r,disabled:l,children:n},r)})});case h.DATE:return y(n,{placeholder:c,format:"YYYY-MM-DD",style:{width:"100%"},...l});case h.DATE_MONTH:return y(n,{picker:"month",placeholder:c,format:"YYYY-MM",style:{width:"100%"},...l});case h.DATE_YEAR:return y(n,{picker:"year",placeholder:c,format:"YYYY",style:{width:"100%"},...l});case h.DATE_WEEK:return y(n,{picker:"week",placeholder:c,format:"YYYY-wo",style:{width:"100%"},...l});case h.DATE_RANGE:return y(T,{placeholder:[`请选择开始${e.label}`,`请选择结束${e.label}`],format:"YYYY-MM-DD",style:{width:"100%"},...l});case h.DATETIME:return y(n,{showTime:!0,placeholder:c,format:"YYYY-MM-DD HH:mm:ss",style:{width:"100%"},...l});case h.DATETIME_RANGE:return y(T,{showTime:!0,placeholder:[`请选择开始${e.label}`,`请选择结束${e.label}`],format:"YYYY-MM-DD HH:mm:ss",style:{width:"100%"},...l});case h.DIVIDER:return null;default:return o}},V=r=>r.tip?b(E,{children:[r.label,y(c,{title:r.tip,children:y(e,{style:{marginLeft:4,fontSize:12}})})]}):r.label,F=({option:e,style:r,col:n,index:s})=>{const a=N(e);return delete a.dependencies,delete a.shouldUpdate,("function"==typeof(o=e.hidden)?o(U()):o)?null:y(t,{span:n.span,style:r,children:y(l.Item,{name:e.name,label:V(e),rules:x(e),labelCol:n.labelCol,wrapperCol:n.wrapperCol,preserve:!1,...a,children:k(e)})},g(e)||s);var o},K=({option:e,style:r,col:n,index:a})=>{const o=M(e);return e.customizeRender?y(t,{span:n.span,style:r,children:e.render},g(e)||a):e.onlyForLabel?y(l.Item,{name:e.name,noStyle:!0,preserve:!1,children:y("input",{type:"hidden"})},g(e)||a):e.render===h.DIVIDER?y(t,{span:n.span,style:r,children:y(s,{orientation:"left",...o,children:e.label})},g(e)||a):null};return y(E,{children:v.map((e,r)=>{const n=B(e),s=(e=>D&&e>=3?{display:"none"}:void 0)(r),d=N(e);return K({option:e,style:s,col:n,index:r})||(e.render===h.FORM_LIST?((e,r,n,s)=>{const d=(e=>{const r={showAddButton:!0,showRemoveButton:!0,addButtonText:"添加",removeButtonText:"删除",options:[],addDefaultValue:{},addInsertIndex:void 0};return"function"==typeof e.formListUniqueProps?{...r,...e.formListUniqueProps(U())}:{...r,...e.formListUniqueProps||{}}})(e),i=M(e);return y(t,{span:n.span,style:s,children:y(l.List,{name:e.name,...i,children:(e,{add:r,remove:n,move:i})=>y(E,{children:e.map((e,u)=>{const p=((e,r,n,l,t,s)=>"function"==typeof e?e(r,n,{field:r,fieldIndex:n,add:l,remove:t,move:s}):e??[])(d.options,e,u,r,n,i);return y(a,{gutter:I,children:p.map((a,i)=>{const c=B(a),m=N(a);delete m.dependencies,delete m.shouldUpdate;const h={option:a,style:s,col:c,index:`${u}_${i}`};return K(h)||(i===p.length-1?y(t,{span:c.span,style:s,children:y(l.Item,{label:V(a),labelCol:c.labelCol,wrapperCol:c.wrapperCol,preserve:!1,required:P(a.required),...m,children:b("div",{style:{display:"flex",gap:10,alignItems:"center",justifyContent:"space-between"},children:[y("div",{style:{flex:1},children:y(l.Item,{noStyle:!0,rules:x(a),name:a.name,children:k(a)})}),u>=1?d.showRemoveButton&&y(o,{type:"primary",danger:!0,onClick:()=>n(e.name),children:d.removeButtonText}):d.showAddButton&&y(o,{type:"primary",onClick:()=>r(d.addDefaultValue,d.addInsertIndex),children:d.addButtonText})]})})},g(a)||i):F(h))})},e.key)})})})},g(e)||r)})(e,r,n,s):(e.shouldUpdate??e.dependencies)||(d.shouldUpdate??d.dependencies)?((e,r,n,t)=>{const s=N(e);return y(l.Item,{noStyle:!0,preserve:!1,shouldUpdate:e.shouldUpdate??s.shouldUpdate,dependencies:e.dependencies??s.dependencies,children:()=>F({option:e,style:n,col:t,index:r})},g(e)||r)})(e,r,s,n):F({option:e,style:s,col:n,index:r}))})})};v.displayName="FormItemsRenderer";export{v as default};
@@ -11,8 +11,10 @@ export interface BasicLeftTreeProps extends Omit<TreeProps, "fieldNames"> {
11
11
  idKey?: string;
12
12
  /** 树形数据 children 字段,默认 children */
13
13
  childrenKey?: string;
14
- /** 决定 onGetNodePaths 是否包含自身节点,默认 true */
14
+ /** @deprecated 已弃用,请使用 getNodePathsIsIncludeOneself */
15
15
  onGetNodePathsIsIncludeOneself?: boolean;
16
+ /** 决定 onGetNodePaths 是否包含自身节点,默认 true */
17
+ getNodePathsIsIncludeOneself?: boolean;
16
18
  /** 获取父级节点 */
17
19
  onGetNodePaths?: () => Record<string, any>[];
18
20
  /** 获取数据 */
@@ -1 +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,onGetNodePathsIsIncludeOneself: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,G=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]})},O=e=>e.map(e=>({...e,[f]:G(e[f]),[y]:e[y]?O(e[y]):void 0})),P=E(m,v),b=O(P);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:b,fieldNames:{title:f,key:p,children:y},...g})]})};o.displayName="BasicLeftTree";export{o as default};
1
+ import{Input as e,Tree as n}from"antd";import{useState as t,useEffect as s}from"react";import{getTreeNodePaths as r}from"../../../utils/index.js";import{jsxs as d,jsx as o}from"react/jsx-runtime";const{Search:a}=e,i=e=>{const{onGetData:i,onSelect:c,onGetNodePaths:l,onGetNodePathsIsIncludeOneself:h,getNodePathsIsIncludeOneself:u=!0,expandedKeys:f,treeData:m=[],nameKey:p="name",idKey:y="id",childrenKey:g="children",...I}=e;void 0!==h&&console.warn("【BasicLeftTree】 onGetNodePathsIsIncludeOneself 参数已弃用,请使用 getNodePathsIsIncludeOneself 参数");const x=void 0!==h?h:u,[K,N]=t([]),[v,O]=t(""),[P,G]=t(!0);s(()=>{N(f)},[f]);const S=(e,n,t=[])=>(e.forEach(e=>{e[g]&&((e[p].includes(n)||e[g].some(e=>e[p].includes(n)))&&t.push(e[y]),S(e[g],n,t))}),t),B=(e,n)=>n?e.reduce((e,t)=>{const s=t[p].includes(n),r=t[g]?B(t[g],n):[];return(s||r.length>0)&&e.push({...t,[g]:r.length>0?r:void 0}),e},[]):e,D=e=>{if(!v)return e;const n=e.indexOf(v);if(-1===n)return e;const t=e.substring(0,n),s=e.substring(n+v.length);return d("span",{children:[t,o("span",{style:{color:"#f50"},children:v}),s]})},E=e=>e.map(e=>({...e,[p]:D(e[p]),[g]:e[g]?E(e[g]):void 0})),b=B(m,v),j=E(b);return s(()=>{i?.(m)},[m]),d("div",{style:{width:300},children:[o(a,{style:{marginBottom:8},placeholder:"输入关键字进行过滤",onSearch:async e=>{e!==v&&(e=>{if(O(e),G(!0),!e)return void N([]);const n=S(m,e);N(n)})(e)}}),o(n,{onExpand:e=>{N(e),G(!1)},onSelect:(e,n)=>{if(e.length>0&&l){const n=e[0],t=r({data:m,targetId:n,idKey:y,childrenKey:g,isIncludeOneself:x});l?.(t)}c?.(e,n)},autoExpandParent:P,expandedKeys:K,treeData:j,fieldNames:{title:p,key:y,children:g},...I})]})};i.displayName="BasicLeftTree";export{i as default};
@@ -1,6 +1,6 @@
1
1
  import type { FC } from "react";
2
- import type { BasicLeftTreeProps } from "../../Basic";
3
2
  import type { DepartmentSelectTreeProps } from "../../../SelectTree/Department/Gwj";
3
+ import type { BasicLeftTreeProps } from "../../Basic";
4
4
 
5
5
  /**
6
6
  * 组件属性
@@ -1 +1 @@
1
- import{Modal as e,Form as t,Row as i,Col as n,Select as a,Input as r,Button as l,Spin as o}from"antd";import{useRef as s,useState as d,useEffect as c}from"react";import{dynamicLoadJs as u,dynamicLoadCss as p}from"../../utils/index.js";import m from"./CesiumMap.js";import"./index.less";import{jsxs as w,jsx as h}from"react/jsx-runtime";const g=g=>{const{visible:y,onClose:b,longitude:C,latitude:f,onConfirm:L,area:v="",showArea:M=!1,disable:k=!1,type:B="baidu"}=g,j=s(null),x=s(null),O=s(null),[G,A]=d(!1),[I,F]=d(C||""),[K,D]=d(f||""),[N,R]=d(""),[z,E]=d("");c(()=>{F(C||""),D(f||""),E(v||"")},[C,f,v]);const P=()=>{if(!window?.BMapGL?.Map)return void setTimeout(()=>{P()},50);const e=new window.BMapGL.Map(j.current);if(x.current=e,e.centerAndZoom(new window.BMapGL.Point(C||window.mapLongitude,f||window.mapLatitude),16),e.enableScrollWheelZoom(!0),C&&f){const t=new window.BMapGL.Point(C,f),i=new window.BMapGL.Marker(t);e.addOverlay(i)}k||e.addEventListener("click",t=>{e.clearOverlays();const i=new window.BMapGL.Point(t.latlng.lng,t.latlng.lat),n=new window.BMapGL.Marker(i);e.addOverlay(n),D(t.latlng.lat),F(t.latlng.lng)})},T=()=>{if(A(!0),j.current){if(!x.current){if("baidu"===B)return void P();"cesium"===B&&(()=>{const{init:e,flyTo:t,addMarkPoint:i,getLongitudeAndLatitude:n}=new m,{viewer:a}=e();x.current=a,t({longitude:C||window.mapLongitude,latitude:f||window.mapLatitude,height:9e5}),C&&f&&i({longitude:C,latitude:f}),n((e,t)=>{if(e)return;const{longitude:i,latitude:n}=t;D(n),F(i)})})()}A(!1)}},H=()=>{R(""),x.current&&(x.current.destroy(),x.current=null),b&&b()};c(()=>{let e;return y&&(e=setTimeout(()=>{window.mapLongitude||window.mapLatitude?"baidu"!==B?"cesium"===B&&(async()=>{window.Cesium?T():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"}}),T()):(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"),T())})():(async()=>{window.BMapGL?T():window?.base?.loadDynamicResource?(await window.base.loadDynamicResource({url:"https://api.map.baidu.com/api?v=1.0&type=webgl&ak=OElqFYoKiAH8KFtph8ftLKF5NlNrbCUr&callback=initialize",type:"script",attr:{type:"text/javascript"}}),T()):(await u("https://api.map.baidu.com/api?v=1.0&type=webgl&ak=OElqFYoKiAH8KFtph8ftLKF5NlNrbCUr&callback=initialize"),T())})():console.error("【Map】 请在window设置变量 mapLongitude 和 mapLatitude,以供地图初始化坐标使用")},100)),()=>{e&&clearTimeout(e)}},[y]);const S=()=>{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(()=>()=>{S()},[]),w(e,{open:y,title:"坐标",onCancel:H,width:1e3,destroyOnHidden:!1,maskClosable:!1,afterClose:S,footer:[h(l,{onClick:H,children:"取消"},"back"),!k&&h(l,{type:"primary",onClick:()=>{L&&L(I,K,{area:z}),H()},children:"确定"},"submit")],children:[w(t,{labelAlign:"right",labelCol:{span:6},wrapperCol:{span:18},children:[M&&h(i,{gutter:24,children:h(n,{span:12,children:h(t.Item,{label:"所属区域",children:w(a,{value:z,onChange:e=>E(e),allowClear:!0,children:[h(a.Option,{value:"1",children:"东港区"}),h(a.Option,{value:"2",children:"西港区"})]})})})}),!k&&"baidu"===B&&w(i,{gutter:24,children:[h(n,{span:12,children:h(t.Item,{label:"关键字搜索",children:h(r,{value:N,onChange:e=>R(e.target.value),allowClear:!0})})}),h(n,{span:12,children:w(t.Item,{label:" ",colon:!1,style:{textAlign:"right"},children:[h(l,{type:"primary",onClick:()=>{N&&x.current&&(O.current=new window.BMapGL.LocalSearch(x.current,{renderOptions:{map:x.current}}),O.current.search(N))},children:"搜索"}),h(l,{onClick:()=>{R(""),x.current&&O.current.search("")},style:{marginLeft:8},children:"重置"})]})})]}),w(i,{gutter:24,children:[h(n,{span:12,children:h(t.Item,{label:"经度",children:h(r,{disabled:!0,value:I})})}),h(n,{span:12,children:h(t.Item,{label:"纬度",children:h(r,{disabled:!0,value:K})})})]})]}),h("div",{ref:j,id:"map_container",style:{width:"100%",height:"500px",position:"relative"},children:h(o,{size:"large",tip:"地图正在加载中...",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};
1
+ import{Modal as e,Form as i,Row as t,Col as n,Select as a,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,O]=s(!1),[I,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),n=new window.BMapGL.Marker(t);e.addOverlay(n),z(i.latlng.lat),A(i.latlng.lng)})},E=()=>{if(O(!0),j.current){if(!x.current){if("baidu"===k)return void W();"cesium"===k&&(()=>{const{init:e,flyTo:i,addMarkPoint:t,getLongitudeAndLatitude:n}=new w,{viewer:a}=e();x.current=a,i({longitude:v||window.mapLongitude,latitude:C||window.mapLatitude,height:9e5}),v&&C&&t({longitude:v,latitude:C}),n((e,i)=>{if(e)return;const{longitude:t,latitude:n}=i;z(n),A(t)})})()}O(!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,maskClosable:!1,afterClose:$,footer:[h(l,{onClick:Z,children:"取消"},"back"),!B&&h(l,{type:"primary",onClick:()=>{f&&f(I,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(n,{span:12,children:h(i.Item,{label:"所属区域",children:m(a,{value:T,onChange:e=>S(e),allowClear:!0,children:[h(a.Option,{value:"1",children:"东港区"}),h(a.Option,{value:"2",children:"西港区"})]})})})}),!B&&"baidu"===k&&m(t,{gutter:24,children:[h(n,{span:12,children:h(i.Item,{label:"关键字搜索",children:h(r,{value:K,onChange:e=>P(e.target.value),allowClear:!0})})}),h(n,{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(n,{span:12,children:h(i.Item,{label:"经度",children:h(r,{disabled:!0,value:I})})}),h(n,{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",tip:"地图正在加载中...",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};
@@ -1 +1 @@
1
- import{Space as e,Button as t}from"antd";import{useState as i,useEffect as o}from"react";import{throttle as r}from"throttle-debounce";import n from"../HeaderBack/index.js";import{jsxs as d,jsx as a}from"react/jsx-runtime";function s(s){const{headerTitle:c,history:l,isShowHeader:h=!0,headerPrevious:m=!0,isShowFooter:p=!0,isShowAllAction:u=!0,backButtonText:g="关闭",contentPadding:x="20px",customActionButtons:y,extraActionButtons:w}=s,[f,v]=i(window.innerWidth),b=r(50,()=>{const e=document.querySelector("#page-layout");e&&v(e.offsetWidth)});return o(()=>{const e=setTimeout(()=>{b()},0);return u&&p&&window.addEventListener("resize",b),()=>{u&&p&&window.removeEventListener("resize",b),clearTimeout(e)}},[u,p]),d("div",{className:"page-layout",id:"page-layout",children:[u&&h&&a(n,{title:c,history:l,previous:m}),d("div",{style:{padding:x},children:[s.children,u&&p&&d("div",{className:"page-layout-footer",style:{position:"relative",zIndex:"9"},children:[a("div",{style:{height:"52px"}}),a("div",{style:{textAlign:"center",backgroundColor:"rgb(241, 241, 242)",padding:"10px 0",position:"fixed",bottom:"0",width:f,margin:"0px -20px"},children:y||d(e,{children:[w,a(t,{onClick:()=>l?.goBack?.()||window.history.back(),children:g})]})})]})]})]})}s.displayName="Page";export{s as default};
1
+ import{Space as e,Button as t}from"antd";import{useState as o,useEffect as i}from"react";import{throttle as r}from"throttle-debounce";import n from"../HeaderBack/index.js";import{jsxs as d,jsx as a}from"react/jsx-runtime";function s(s){const{headerTitle:c,history:l,isShowHeader:p=!0,headerPrevious:u=!0,isShowFooter:h=!0,isShowAllAction:m=!0,backButtonText:g="关闭",contentPadding:y="20px",customActionButtons:f,extraActionButtons:x,children:w}=s,[v,b]=o(window.innerWidth),k=r(50,()=>{const e=document.querySelector("#page-layout");e&&b(e.offsetWidth)});return i(()=>{const e=setTimeout(()=>{k()},0);return m&&h&&window.addEventListener("resize",k),()=>{m&&h&&window.removeEventListener("resize",k),clearTimeout(e)}},[m,h]),d("div",{className:"page-layout",id:"page-layout",children:[m&&p&&a(n,{title:c,history:l,previous:u}),d("div",{style:{padding:y},children:[w&&"function"==typeof w?w():w,m&&h&&d("div",{className:"page-layout-footer",style:{position:"relative",zIndex:"9"},children:[a("div",{style:{height:"52px"}}),a("div",{style:{textAlign:"center",backgroundColor:"rgb(241, 241, 242)",padding:"10px 0",position:"fixed",bottom:"0",width:v,margin:"0px -20px"},children:f||d(e,{children:[x,a(t,{onClick:()=>l?.goBack?.()||window.history.back(),children:g})]})})]})]})]})}s.displayName="Page";export{s as default};
@@ -1 +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 s}from"react/jsx-runtime";const u=e((e,u)=>{const{value:a=!0,list:d=[],step:m=1,limitScrollNum:f=3,hover:h=!0,direction:p="up",singleHeight:g=0,singleWidth:y=0,singleWaitTime:w=1e3,isRemUnit:b=!1,isWatch:v=!0,delay:$=0,ease:x="ease-in",count:M=-1,copyNum:T=1,wheel:N=!1,singleLine:S=!1,children:W,className:A}=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>=f,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})`} ${$}ms`,overflow:"hidden",display:S?"flex":"block"},O="left"===p||"right"===p,P=O?{float:"left",overflow:"hidden",display:S?"flex":"block",flexShrink:S?0:1}:{overflow:"hidden"},Q=b?Number.parseInt(window.getComputedStyle(document.documentElement,null).fontSize):1,V=y*Q,X=g*Q;n(()=>{X>0&&X%m>0&&console.error("如果设置了单步滚动,step 需是单步大小的约数,否则无法保证单步滚动结束的位置是否准确。~~~~~")},[X,m]);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,m,!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(u,()=>({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(()=>{v&&oe()},[d,v]),n(()=>()=>{Z(),L.current&&clearTimeout(L.current)},[]);const ce=()=>c(s,{children:[i("div",{ref:E,style:P,children:W}),J?Array.from({length:T}).map((e,t)=>i("div",{style:P,children:W},`copy-${t}`)):null]});return i("div",{ref:k,className:A,children:i("div",N&&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()})})});u.displayName="SeamlessScroll";export{u as default};
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{value: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:v=!0,delay:$=0,ease:x="ease-in",count:M=-1,copyNum:T=1,wheel:N=!1,singleLine:S=!1,children:W,className:A}=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})`} ${$}ms`,overflow:"hidden",display:S?"flex":"block"},O="left"===p||"right"===p,P=O?{float:"left",overflow:"hidden",display:S?"flex":"block",flexShrink:S?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(()=>{v&&oe()},[d,v]),n(()=>()=>{Z(),L.current&&clearTimeout(L.current)},[]);const ce=()=>c(u,{children:[i("div",{ref:E,style:P,children:W&&"function"==typeof W?W():W}),J?Array.from({length:T}).map((e,t)=>i("div",{style:P,children:W&&"function"==typeof W?W():W},`copy-${t}`)):null]});return i("div",{ref:k,className:A,children:i("div",N&&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};
@@ -1,4 +1,5 @@
1
1
  import type { FormInstance, FormProps } from "antd/es/form";
2
+ import type { useForm, useWatch } from "antd/es/form/Form";
2
3
  import type { FC, ReactNode } from "react";
3
4
  import type { FormOption } from "../FormBuilder/FormItemsRenderer";
4
5
 
@@ -36,6 +37,9 @@ export interface SearchProps extends Omit<FormProps, "form" | "onFinish"> {
36
37
  * 搜索表单组件
37
38
  * 支持自动展开/收起功能,当表单项超过4个时显示展开/收起按钮
38
39
  */
39
- declare const Search: FC<SearchProps>;
40
+ declare const Search: FC<SearchProps> & {
41
+ useForm: typeof useForm;
42
+ useWatch: typeof useWatch;
43
+ };
40
44
 
41
45
  export default Search;
@@ -1 +1 @@
1
- import{DownOutlined as e,UpOutlined as t}from"@ant-design/icons";import{Form as o,Row as n,Col as l,Button as r}from"antd";import{useState as i,useRef as s,useEffect as a}from"react";import c from"../FormBuilder/FormItemsRenderer.js";import m from"../Icon/ResetIcon/index.js";import d from"../Icon/SearchIcon/index.js";import{jsx as p,jsxs as u}from"react/jsx-runtime";const h=h=>{const{labelCol:f={span:6},options:y=[],values:b={},onFinish:g,onSubmit:x,onReset:C,searchText:I="搜索",resetText:w="重置",showSearchButton:F=!0,showResetButton:j=!0,extraButtons:k,form:R,...S}=h,[V,v]=i(!0),[B,A]=i(6),[N,T]=i(!1),$=s(`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]),p("div",{className:"search-layout card-layout",children:p(o,{form:R,labelCol:f,initialValues:b,...S,children:u(n,{className:$.current,children:[p(c,{options:y,labelCol:f,span:6,collapse:V,useAutoGenerateRequired:!1,initialValues:b}),p(l,{span:N&&V?6:B,children:u(o.Item,{label:" ",labelCol:{span:2},colon:!1,style:{textAlign:"right"},children:[F&&p(r,{type:"primary",icon:p(d,{}),onClick:()=>{const e=R.getFieldsValue();g?.(e,"submit"),x?.(e)},children:I}),j&&p(r,{style:{marginLeft:8},icon:p(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:w}),N&&p(r,{type:"link",icon:p(V?e:t,{}),onClick:()=>{v(!V)},style:{marginLeft:8},children:V?"展开":"收起"})]})}),k&&p(l,{span:24,children:p(o.Item,{label:" ",colon:!1,labelCol:{span:0},children:k})})]})})})};h.displayName="Search";export{h as default};
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};
@@ -11,8 +11,10 @@ export interface BasicSelectTreeProps extends Omit<TreeSelectProps, "fieldNames"
11
11
  idKey?: string;
12
12
  /** 树形数据 children 字段,默认 children */
13
13
  childrenKey?: string;
14
- /** 决定 onGetNodePaths 是否包含自身节点,默认 true */
14
+ /** @deprecated 已弃用,请使用 getNodePathsIsIncludeOneself */
15
15
  onGetNodePathsIsIncludeOneself?: boolean;
16
+ /** 决定 onGetNodePaths 是否包含自身节点,默认 true */
17
+ getNodePathsIsIncludeOneself?: boolean;
16
18
  /** 获取父级节点 */
17
19
  onGetNodePaths?: (nodes: Record<string, any>[]) => void;
18
20
  /** 占位符 */
@@ -1 +1 @@
1
- import{TreeSelect as e}from"antd";import{useMemo as l,useEffect as t}from"react";import{processTreeDataByLevel as a,processTreeDataForOnlyLastLevel as r,getDataType as n,getTreeNodePaths as o,arrayObjectDeduplication as i}from"../../../utils/index.js";import{jsx as c}from"react/jsx-runtime";function d(d){const{onGetData:s,onChange:h,onGetLabel:u,onGetNodePaths:y,onGetNodePathsIsIncludeOneself:f=!0,placeholder:m="",treeData:p=[],nameKey:v="name",idKey:I="id",childrenKey:K="children",level:g,onlyLastLevel:C=!1,...L}=d,S=l(()=>{let e=g?a({data:p,level:g,childrenKey:K,currentLevel:1}):p;return e=r({data:e,childrenKey:K,onlyLastLevel:C}),e},[p,g,K,C]);return t(()=>{s?.(p,S)},[p,S]),c(e,{showSearch:!0,style:{width:"100%"},styles:{popup:{root:{maxHeight:400,overflow:"auto"}}},placeholder:`请选择${m}`,onChange:(e,l,t)=>{if(e){if("Array"===n(e)){if(y){const l=[];for(let t=0;t<e.length;t++){const a=L.labelInValue||L.treeCheckStrictly?e[t].value:e[t],r=o({data:p,targetId:a,idKey:I,childrenKey:K,isIncludeOneself:f});l.push(...r)}const t=i(l,I);y?.(t)}u?.(L.labelInValue||L.treeCheckStrictly?e.map(e=>e.label):l)}else if(y||u){const l=L.labelInValue||L.treeCheckStrictly?e.value:e,t=o({data:p,targetId:l,idKey:I,childrenKey:K,isIncludeOneself:f});y?.(t),u?.(t[t.length-1][v])}}else y?.([]),u?.("");h?.(L.labelInValue||L.treeCheckStrictly?e.map(e=>e.value):e,l,t)},allowClear:!0,treeData:S,fieldNames:{label:v,value:I,children:K},treeNodeFilterProp:v,showCheckedStrategy:e.SHOW_ALL,...L})}d.displayName="BasicSelectTree";export{d as default};
1
+ import{TreeSelect as e}from"antd";import{useMemo as l,useEffect as t}from"react";import{processTreeDataByLevel as a,processTreeDataForOnlyLastLevel as n,getDataType as r,getTreeNodePaths as o,arrayObjectDeduplication as s}from"../../../utils/index.js";import{jsx as c}from"react/jsx-runtime";function d(d){const{onGetData:i,onChange:h,onGetLabel:u,onGetNodePaths:y,onGetNodePathsIsIncludeOneself:f,getNodePathsIsIncludeOneself:m=!0,placeholder:I="",treeData:p=[],nameKey:v="name",idKey:g="id",childrenKey:K="children",level:S,onlyLastLevel:C=!1,...L}=d;void 0!==f&&console.warn("【BasicSelectTree】 onGetNodePathsIsIncludeOneself 参数已弃用,请使用 getNodePathsIsIncludeOneself 参数");const N=void 0!==f?f:m,b=l(()=>{let e=S?a({data:p,level:S,childrenKey:K,currentLevel:1}):p;return e=n({data:e,childrenKey:K,onlyLastLevel:C}),e},[p,S,K,C]);return t(()=>{i?.(p,b)},[p,b]),c(e,{showSearch:!0,style:{width:"100%"},styles:{popup:{root:{maxHeight:400,overflow:"auto"}}},placeholder:`请选择${I}`,onChange:(e,l,t)=>{if(e){if("Array"===r(e)){if(y){const l=[];for(let t=0;t<e.length;t++){const a=L.labelInValue||L.treeCheckStrictly?e[t].value:e[t],n=o({data:p,targetId:a,idKey:g,childrenKey:K,isIncludeOneself:N});l.push(...n)}const t=s(l,g);y?.(t)}u?.(L.labelInValue||L.treeCheckStrictly?e.map(e=>e.label):l)}else if(y||u){const l=L.labelInValue||L.treeCheckStrictly?e.value:e,t=o({data:p,targetId:l,idKey:g,childrenKey:K,isIncludeOneself:N});y?.(t),u?.(t[t.length-1][v])}}else y?.([]),u?.("");h?.(L.labelInValue||L.treeCheckStrictly?e.map(e=>e.value):e,l,t)},allowClear:!0,treeData:b,fieldNames:{label:v,value:g,children:K},treeNodeFilterProp:v,showCheckedStrategy:e.SHOW_ALL,...L})}d.displayName="BasicSelectTree";export{d as default};
@@ -93,6 +93,7 @@ export declare const UPLOAD_FILE_TYPE_ENUM: {
93
93
  164: 164; // cover_of_education_and_training_courses - 课程封面
94
94
  165: 165; // online_learning_sign_signature - 在线学习签到签字
95
95
  166: 166; // online_learning_exam_signature - 在线学习考试签字
96
+ 167: 167; // course_work_question_content - 课题工作题内容
96
97
  302: 302; // fire_safety_inspection_passed_images - 消防点检检查合格
97
98
  };
98
99
 
@@ -191,5 +192,6 @@ export declare const UPLOAD_FILE_PATH_ENUM: {
191
192
  164: "cover_of_education_and_training_courses";
192
193
  165: "online_learning_sign_signature";
193
194
  166: "online_learning_exam_signature";
195
+ 167: "course_work_question_content";
194
196
  302: "fire_safety_inspection_passed_images";
195
197
  };
@@ -1 +1 @@
1
- const e={10:10,11:11,12:12,13:13,14:14,15:15,16:16,19:19,601:601,602:602,603:603,604:604,605:605,3:3,4:4,5:5,6:6,7:7,8:8,9:9,17:17,18:18,20:20,21:21,22:22,23:23,50:50,101:101,102:102,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,128:128,129:129,130:130,131:131,132:132,133:133,134:134,135:135,136:136,137:137,138:138,139:139,140:140,141:141,142:142,143:143,144:144,146:146,145:145,147:147,148:148,149:149,150:150,151:151,152:152,153:153,154:154,155:155,156:156,157:157,158:158,159:159,160:160,161:161,162:162,163:163,164:164,165:165,166:166,302:302},_={10:"labor_contract_image",11:"commercial_insurance_image",12:"certificate_information",13:"user_avatar",14:"id_card_photo",15:"social_security_card_photo",16:"work_related_injury_insurance_certificate",19:"three_level_safety_education_training",601:"gate_access_vehicle_license_photo",602:"gate_access_vehicle_photo",603:"gate_access_vehicle_attachment",604:"emission_standard_certificate",605:"motor_vehicle_registration_certificate_green_book",3:"hidden_danger_photo",4:"hidden_danger_rectification_photo",5:"hidden_danger_verification_photo",6:"certificate_photo",7:"confined_space_plan",8:"hidden_danger_rectification_plan",9:"confined_space_confirmation_signature",17:"special_equipment_inspection_photo",18:"personnel_certificate",20:"major_hazard_source_alarm_before_handling_photo",21:"major_hazard_source_alarm_after_handling_photo",22:"smart_access_control_external_vehicle_driver_license_photo",23:"smart_access_control_external_vehicle_registration_photo",50:"safety_and_environmental_inspection_final_acceptance_image",101:"hidden_danger_extension_temporary_measures_attachment",102:"hidden_danger_video",105:"blind_plate_position_map",106:"temporary_disposal_information",107:"rectification_suggestions_and_plan",108:"major_hidden_danger_investigation_report",109:"major_hidden_danger_safety_committee_or_party_committee_resolution_record",110:"significant_hidden_danger_rectification_temporary_disposal_measures",111:"significant_hidden_danger_rectification_hidden_danger_rectification_process_record",112:"supplement_major_hidden_danger_information",113:"safety_committee_office_meeting_record",114:"alarm_photo",115:"fire_equipment_type_qualification_photo",116:"hot_work_personnel_photo",117:"safety_pledge_signature",118:"hot_work_unit_responsible_person_confirmation_signature",119:"on_site_jurisdiction_unit_responsible_person_signature",120:"hot_work_permit_issuing_unit_signature",121:"hot_work_permit_signature",122:"pre_hot_work_jurisdiction_unit_confirmation_signature",123:"on_site_responsible_person_confirmation_signature",124:"post_hot_work_site_jurisdiction_unit_confirmation",125:"delayed_fire_monitoring_pictures",126:"safety_and_environmental_inspection_initiation_signature",127:"inspector_confirmation_signature",128:"inspected_person_confirmation_signature",129:"safety_and_environmental_inspection_appeal_signature",130:"hk_safety_committee_office_director_safety_director_issuance",131:"hot_work_contracting_unit_signature",132:"safety_director_approval",133:"branch_safety_director_approval",134:"project_authority_review_signature",135:"branch_manager_approval_signature",136:"accident_incident",137:"accident_incident",138:"hidden_disposal_plan",139:"safety_environmental_inspection_inspection_signature",140:"safety_environmental_inspection_inspection_situation",141:"safety_environmental_inspection_inspector_signature",142:"safety_environmental_inspection_inspected_signature",143:"safety_environmental_inspection_inspected_file",144:"safety_environmental_inspection_defense_signature",145:"qualified_list_inspection",146:"safety_environmental_inspection_acceptance",147:"hidden_qualified_listInspection_signature",148:"special_qualification",149:"safety_qualification",150:"promise_bookmark_photo",151:"project_related_materials",152:"legal_and_regulatory_database",153:"regulations_resource_library",154:"responsibility_based_resource_library",155:"institutional_resource_library",156:"security_management_agreement",157:"supervision_personnel_vehicle",158:"supervision_personnel_vehicle_license",159:"special_operation_personnel_photo",160:"special_equipment_operator_photo",161:"main_responsible_person_photo",162:"photos_safety_production_management_personnel",163:"education_and_training_application",164:"cover_of_education_and_training_courses",165:"online_learning_sign_signature",166:"online_learning_exam_signature",302:"fire_safety_inspection_passed_images"};export{_ as UPLOAD_FILE_PATH_ENUM,e as UPLOAD_FILE_TYPE_ENUM};
1
+ const e={10:10,11:11,12:12,13:13,14:14,15:15,16:16,19:19,601:601,602:602,603:603,604:604,605:605,3:3,4:4,5:5,6:6,7:7,8:8,9:9,17:17,18:18,20:20,21:21,22:22,23:23,50:50,101:101,102:102,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,128:128,129:129,130:130,131:131,132:132,133:133,134:134,135:135,136:136,137:137,138:138,139:139,140:140,141:141,142:142,143:143,144:144,146:146,145:145,147:147,148:148,149:149,150:150,151:151,152:152,153:153,154:154,155:155,156:156,157:157,158:158,159:159,160:160,161:161,162:162,163:163,164:164,165:165,166:166,167:167,302:302},_={10:"labor_contract_image",11:"commercial_insurance_image",12:"certificate_information",13:"user_avatar",14:"id_card_photo",15:"social_security_card_photo",16:"work_related_injury_insurance_certificate",19:"three_level_safety_education_training",601:"gate_access_vehicle_license_photo",602:"gate_access_vehicle_photo",603:"gate_access_vehicle_attachment",604:"emission_standard_certificate",605:"motor_vehicle_registration_certificate_green_book",3:"hidden_danger_photo",4:"hidden_danger_rectification_photo",5:"hidden_danger_verification_photo",6:"certificate_photo",7:"confined_space_plan",8:"hidden_danger_rectification_plan",9:"confined_space_confirmation_signature",17:"special_equipment_inspection_photo",18:"personnel_certificate",20:"major_hazard_source_alarm_before_handling_photo",21:"major_hazard_source_alarm_after_handling_photo",22:"smart_access_control_external_vehicle_driver_license_photo",23:"smart_access_control_external_vehicle_registration_photo",50:"safety_and_environmental_inspection_final_acceptance_image",101:"hidden_danger_extension_temporary_measures_attachment",102:"hidden_danger_video",105:"blind_plate_position_map",106:"temporary_disposal_information",107:"rectification_suggestions_and_plan",108:"major_hidden_danger_investigation_report",109:"major_hidden_danger_safety_committee_or_party_committee_resolution_record",110:"significant_hidden_danger_rectification_temporary_disposal_measures",111:"significant_hidden_danger_rectification_hidden_danger_rectification_process_record",112:"supplement_major_hidden_danger_information",113:"safety_committee_office_meeting_record",114:"alarm_photo",115:"fire_equipment_type_qualification_photo",116:"hot_work_personnel_photo",117:"safety_pledge_signature",118:"hot_work_unit_responsible_person_confirmation_signature",119:"on_site_jurisdiction_unit_responsible_person_signature",120:"hot_work_permit_issuing_unit_signature",121:"hot_work_permit_signature",122:"pre_hot_work_jurisdiction_unit_confirmation_signature",123:"on_site_responsible_person_confirmation_signature",124:"post_hot_work_site_jurisdiction_unit_confirmation",125:"delayed_fire_monitoring_pictures",126:"safety_and_environmental_inspection_initiation_signature",127:"inspector_confirmation_signature",128:"inspected_person_confirmation_signature",129:"safety_and_environmental_inspection_appeal_signature",130:"hk_safety_committee_office_director_safety_director_issuance",131:"hot_work_contracting_unit_signature",132:"safety_director_approval",133:"branch_safety_director_approval",134:"project_authority_review_signature",135:"branch_manager_approval_signature",136:"accident_incident",137:"accident_incident",138:"hidden_disposal_plan",139:"safety_environmental_inspection_inspection_signature",140:"safety_environmental_inspection_inspection_situation",141:"safety_environmental_inspection_inspector_signature",142:"safety_environmental_inspection_inspected_signature",143:"safety_environmental_inspection_inspected_file",144:"safety_environmental_inspection_defense_signature",145:"qualified_list_inspection",146:"safety_environmental_inspection_acceptance",147:"hidden_qualified_listInspection_signature",148:"special_qualification",149:"safety_qualification",150:"promise_bookmark_photo",151:"project_related_materials",152:"legal_and_regulatory_database",153:"regulations_resource_library",154:"responsibility_based_resource_library",155:"institutional_resource_library",156:"security_management_agreement",157:"supervision_personnel_vehicle",158:"supervision_personnel_vehicle_license",159:"special_operation_personnel_photo",160:"special_equipment_operator_photo",161:"main_responsible_person_photo",162:"photos_safety_production_management_personnel",163:"education_and_training_application",164:"cover_of_education_and_training_courses",165:"online_learning_sign_signature",166:"online_learning_exam_signature",167:"course_work_question_content",302:"fire_safety_inspection_passed_images"};export{_ as UPLOAD_FILE_PATH_ENUM,e as UPLOAD_FILE_TYPE_ENUM};
@@ -18,7 +18,7 @@ export interface UseTableOptions<TData extends Data, TParams extends Params> ext
18
18
  params?: Record<string, any> | (() => Record<string, any>);
19
19
  /** 表单数据转换函数,在每次请求之前调用,接收当前搜索的表单项,要求返回一个对象 */
20
20
  transform?: (formData: FormValues) => FormValues;
21
- /** 回调函数 */
21
+ /** @deprecated 已弃用,请使用 onSuccess */
22
22
  callback?: (list: any[], data: any) => void;
23
23
  /** 表单实例(通过 Form.useForm() 创建) */
24
24
  form?: FormInstance;
@@ -1 +1 @@
1
- import{useAntdTable as e}from"ahooks";import a from"../useUrlQueryCriteria/index.js";function t(t,r){if(!t)return void console.error("【useTable】 缺少 service 参数");const{params:n,transform:o,...i}=r||{},{useStorageQueryCriteria:s=!0,usePagination:u=!0,usePermission:c=!0,defaultType:l="advance",defaultCurrent:p=1,defaultPageSize:g=20,defaultPagination:f={current:p,pageSize:g},...d}=i,{setUrlCriteriaQuery:m,getUrlCriteriaQuery:y}=a(),b=s?y("searchFormKeys","searchFormValues"):{},h=s&&u?y("paginationKeys","paginationValues"):{},P=Object.keys(b).length>0?b:{},S=u?Object.keys(h).length>0?h:f:{},z=e(function(e,a={},t,r){const n=("function"==typeof a?a():a)||{};return async({current:a,pageSize:o},i={})=>{let s=i;if("function"==typeof t){const e=t(i);e&&"object"==typeof e&&(s={...i,...e})}const u={pageIndex:a,pageSize:o,...s,...n};r&&(u.menuPath=window.location.pathname);const c=await e(u);return{list:c.data||[],total:c.totalCount||0,...c}}}(t,n,o,c),{...d,defaultParams:[S,P],defaultType:l,onSuccess:(e,a)=>{i.onSuccess&&i.onSuccess(e,a),s&&m(a[1]??{},u?{current:z.tableProps.pagination.current,pageSize:z.tableProps.pagination.pageSize}:{})}});return i.callback&&i.callback(z?.data?.list||[],z?.data||{}),{...z,tableProps:{...z.tableProps,pagination:!!u&&{...z.tableProps.pagination,showQuickJumper:!0,showSizeChanger:!0}},getData:z.search.submit}}export{t as default};
1
+ import{useAntdTable as e}from"ahooks";import a from"../useUrlQueryCriteria/index.js";function t(t,r){if(!t)return void console.error("【useTable】 缺少 service 参数");const{params:n,transform:o,...i}=r||{},{useStorageQueryCriteria:s=!0,usePagination:c=!0,usePermission:u=!0,defaultType:l="advance",defaultCurrent:p=1,defaultPageSize:g=20,defaultPagination:f={current:p,pageSize:g},...d}=i,{setUrlCriteriaQuery:b,getUrlCriteriaQuery:m}=a(),y=s?m("searchFormKeys","searchFormValues"):{},S=s&&c?m("paginationKeys","paginationValues"):{},h=Object.keys(y).length>0?y:{},P=c?Object.keys(S).length>0?S:f:{},k=e(function(e,a={},t,r){const n=("function"==typeof a?a():a)||{};return async({current:a,pageSize:o},i={})=>{let s=i;if("function"==typeof t){const e=t(i);e&&"object"==typeof e&&(s={...i,...e})}const c={pageIndex:a,pageSize:o,...s,...n};r&&(c.menuPath=window.location.pathname);const u=await e(c);return{list:u.data||[],total:u.totalCount||0,...u}}}(t,n,o,u),{...d,defaultParams:[P,h],defaultType:l,onSuccess:(e,a)=>{i.onSuccess&&i.onSuccess(e,a),s&&b(a[1]??{},c?{current:k.tableProps.pagination.current,pageSize:k.tableProps.pagination.pageSize}:{})}});return void 0!==i.callback&&console.warn("【useTable】 callback 参数已弃用,请使用 onSuccess 参数"),i.callback&&i.callback(k?.data?.list||[],k?.data||{}),{...k,tableProps:{...k.tableProps,pagination:!!c&&{...k.tableProps.pagination,showQuickJumper:!0,showSizeChanger:!0}},getData:k.search.submit}}export{t as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "1.1.52",
4
+ "version": "1.2.0",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",
@@ -46,15 +46,22 @@
46
46
  "use-antd-resizable-header": "^3.2.2"
47
47
  },
48
48
  "devDependencies": {
49
+ "@antfu/eslint-config": "^5.4.1",
49
50
  "@babel/core": "^7.28.5",
50
51
  "@babel/preset-react": "^7.28.5",
52
+ "@eslint-react/eslint-plugin": "^2.2.2",
51
53
  "@rollup/plugin-babel": "^6.1.0",
52
54
  "@rollup/plugin-commonjs": "^29.0.0",
53
55
  "@rollup/plugin-image": "^3.0.3",
54
56
  "@rollup/plugin-json": "^6.1.0",
55
57
  "@rollup/plugin-node-resolve": "^16.0.3",
56
58
  "@rollup/plugin-terser": "^0.4.4",
59
+ "eslint": "^9.37.0",
60
+ "eslint-plugin-format": "^1.0.2",
61
+ "eslint-plugin-react-hooks": "^7.0.0",
62
+ "eslint-plugin-react-refresh": "^0.4.23",
57
63
  "glob": "^13.0.0",
58
- "rollup": "^4.54.0"
64
+ "rollup": "^4.54.0",
65
+ "typescript": "^5.9.3"
59
66
  }
60
67
  }
package/utils/index.js CHANGED
@@ -1 +1 @@
1
- import{ID_NUMBER}from"../regular/index.js";import dayjs from"dayjs";function serialNumber(e,t){return(e.current-1)*e.pageSize+(t+1)}function toArrayString(value){return value?eval(value).map(String):[]}function interceptTheSuffix(e,t){return e.substring(e.lastIndexOf("."),e.length).toLowerCase()===t.toLowerCase()}function image2Base64(e){return new Promise(t=>{const n=new Image;n.src=e,n.crossOrigin="Anonymous",n.onload=function(){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0,n.width,n.height);const r=n.src.substring(n.src.lastIndexOf(".")+1).toLowerCase();t(e.toDataURL(`image/${r}`))}})}function image2Base642(e){return new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=e=>{t(e.target.result)},r.onerror=e=>{n(e)}})}function base642File(e,t="file"){const n=e.split(","),r=n[0].match(/:(.*?);/)[1],i=r.split("/")[1],a=atob(n[1]);let o=a.length;const s=new Uint8Array(o);for(;o--;)s[o]=a.charCodeAt(o);return new File([s],`${t}.${i}`,{type:r})}function checkImgExists(e){return new Promise((t,n)=>{const r=new Image;r.src=e,r.onload=function(e){t(e)},r.onerror=function(e){n(e)}})}function getDataType(e){return Object.prototype.toString.call(e).slice(8,-1)}function ArrayDeduplication(e){return[...new Set(e)]}function arrayObjectDeduplication(e,t){const n={};return e.reduce((e,r)=>(n[r[t]]||(n[r[t]]=!0,e.push(r)),e),[])}function findCharIndex(e){const{str:t,char:n,num:r}=e;let i=t.indexOf(n);if(-1===i)return-1;for(let e=0;e<r-1;e++)if(i=t.indexOf(n,i+1),-1===i)return-1;return i}function randoms(e,t){return Math.random()*(t-e+1)+e}function numFormat(e){if(e){const t=e.toString().split("."),n=t[0].split("").reverse();let r=[];for(let e=0;e<n.length;e++)e%3==0&&0!==e&&r.push(","),r.push(n[e]);return r.reverse(),r=t[1]?r.join("").concat(`.${t[1]}`):r.join(""),r}}function isEmpty(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}function getUrlParam(e){const t=new RegExp(`(^|&)${e}=([^&]*)(&|$)`),n=window.location.search.substr(1).match(t);return null!=n?decodeURI(n[2]):""}function paging(e){const{list:t,currentPage:n,pageSize:r}=e;return t.filter((e,t)=>t<+n*+r&&t>=(+n-1)*+r)}function getFileSuffix(e){return e.substring(e.lastIndexOf(".")+1)}function getFileName(e){return e?e.substring(e.lastIndexOf("/")+1):""}function readTxtDocument(e){return new Promise(t=>{const n=getFileUrl()+e,r=new XMLHttpRequest;r.open("get",n,!0),r.responseType="blob",r.onload=function(e){const n=new FileReader;n.readAsText(e.target.response,"GB2312"),n.onload=function(){t(n.result)}},r.send()})}function secondConversion(e){if(!e)return 0;const t=Number.parseInt(e/60/60,10),n=Number.parseInt(e/60%60,10),r=Number.parseInt(e%60,10);return t?`${t}小时${n}分钟${r}秒`:n?`${n}分钟${r}秒`:`${r}秒`}function addingPrefixToFile(e,t={}){if(!e)return[];const{pathKey:n="filePath",nameKey:r="fileName",idKey:i="id"}=t,a=getFileUrl();for(let t=0;t<e.length;t++)e[t].url=a+e[t][n],e[t].name=e[t][r]||getFileName(e[t][n]),e[t].id=e[t][i];return e}function getLabelName(e){const{status:t,list:n,idKey:r="bianma",nameKey:i="name"}=e;for(let e=0;e<n.length;e++)if(t?.toString()===n[e][r]?.toString())return n[e][i]}function calculateFileSize(e){return e>1024?`${(""+e/1024).substring(0,(""+e/1024).lastIndexOf(".")+3)}MB`:`${e}KB`}function idCardGetDateAndGender(e){let t="",n="";if(ID_NUMBER.test(e)){const r=e.substring(6,14),i=e.substring(16,17),a=`${r.substring(0,4)}-${r.substring(4,6)}-${r.substring(6,8)}`,o=new Date(a.replace(/-/g,"/")),s=o.getMonth()+1;let l;const c=o.getDate();let u;l=s<10?`0${s}`:s,u=c<10?`0${c}`:c,t=i%2==1?"1":"0",n=`${o.getFullYear()}-${l}-${u}`}return{sex:t,date:n}}function getMatchedItems(e){const{list:t,value:n,idKey:r="bianma"}=e;return t.filter(e=>n.includes(e[r]))}function getUnmatchedItems(e){const{list:t,value:n,idKey:r="bianma"}=e;return t.filter(e=>!n.includes(e[r]))}function listTransTree(e){const{json:t,idKey:n,parentIdKey:r,childrenKey:i}=e,a=[],o={};let s=0,l=0;const c=t.length;for(;s<c;s++)o[t[s][n]]=t[s];for(;l<c;l++){const e=t[l],n=o[e[r]];n?(!n[i]&&(n[i]=[]),n[i].push(e)):a.push(e)}return a}function isEmptyToWhether(e,t={}){const{yesText:n="是",noText:r="否",yesValue:i="1"}=t;return isEmpty(e)?"":e.toString()===i.toString()?n:r}function createGuid(e=32){let t="";for(let n=0;n<e;n++)t+="abcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(36*Math.random()));return t}function getIndexColumn(e){return{title:"序号",key:"index",width:70,render:(t,n,r)=>!1===e?r+1:serialNumber(e,r)}}function getTreeNodePaths(e){const{data:t,targetId:n,idKey:r,childrenKey:i,path:a=[],isIncludeOneself:o}=e;for(let e=0;e<t.length;e++){const s=t[e],l=[...a,s];if(s[r]===n)return o?l:a;if(s[i]&&s[i].length>0){const e=getTreeNodePaths({data:s[i],targetId:n,idKey:r,childrenKey:i,path:l,isIncludeOneself:o});if(e)return e}}return null}const processTreeDataByLevel=e=>{const{data:t,level:n,childrenKey:r,currentLevel:i=1}=e;return t.map(e=>{const t={...e};return n&&i>=n?(t.isLeaf=!0,delete t[r]):e[r]&&e[r].length>0?t[r]=processTreeDataByLevel({data:e[r],currentLevel:i+1,level:n,childrenKey:r}):t.isLeaf=!0,t})},processTreeDataForOnlyLastLevel=e=>{const{data:t,childrenKey:n,onlyLastLevel:r=!1}=e;return r?t.map(e=>{const t=e[n]&&e[n].length>0,i={...e,selectable:!t};return t&&(i[n]=processTreeDataForOnlyLastLevel({data:e[n],childrenKey:n,onlyLastLevel:r})),i}):t},validatorEndTime=(e,t="结束时间不能早于开始时间")=>({validator:(n,r)=>r&&e&&r<e?Promise.reject(t):Promise.resolve()}),validatorTimeGTCurrentDay=(e="需要大于当前时间")=>({validator:(t,n)=>n&&n<=dayjs().format("YYYY-MM-DD HH:mm:ss")?Promise.reject(e):Promise.resolve()});function dynamicLoadJs(e){return new Promise((t,n)=>{const r=document.createElement("script");r.type="text/javascript",r.src=e,r.onload=t,r.onerror=n,document.body.appendChild(r)})}function dynamicLoadCss(e){return new Promise((t,n)=>{const r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.href=e,r.onload=t,r.onerror=n,document.head.appendChild(r)})}function normalizeEmptyHtml(e){if(!e)return"";const t=e.replace(/\s+/g,"").toLowerCase();return"<p><br></p>"===t||"<p></p>"===t||""===t?"":e}function getFileUrl(){return process.env.app.fileUrl}export{ArrayDeduplication,addingPrefixToFile,arrayObjectDeduplication,base642File,calculateFileSize,checkImgExists,createGuid,dynamicLoadCss,dynamicLoadJs,findCharIndex,getDataType,getFileName,getFileSuffix,getFileUrl,getIndexColumn,getLabelName,getMatchedItems,getTreeNodePaths,getUnmatchedItems,getUrlParam,idCardGetDateAndGender,image2Base64,image2Base642,interceptTheSuffix,isEmpty,isEmptyToWhether,listTransTree,normalizeEmptyHtml,numFormat,paging,processTreeDataByLevel,processTreeDataForOnlyLastLevel,randoms,readTxtDocument,secondConversion,serialNumber,toArrayString,validatorEndTime,validatorTimeGTCurrentDay};
1
+ import dayjs from"dayjs";import{ID_NUMBER}from"../regular/index.js";function serialNumber(e,t){return(e.current-1)*e.pageSize+(t+1)}function toArrayString(value){return value?eval(value).map(String):[]}function interceptTheSuffix(e,t){return e.substring(e.lastIndexOf("."),e.length).toLowerCase()===t.toLowerCase()}function image2Base64(e){return new Promise(t=>{const n=new Image;n.src=e,n.crossOrigin="Anonymous",n.onload=function(){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0,n.width,n.height);const r=n.src.substring(n.src.lastIndexOf(".")+1).toLowerCase();t(e.toDataURL(`image/${r}`))}})}function image2Base642(e){return new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=e=>{t(e.target.result)},r.onerror=e=>{n(e)}})}function base642File(e,t="file"){const n=e.split(","),r=n[0].match(/:(.*?);/)[1],i=r.split("/")[1],a=atob(n[1]);let o=a.length;const s=new Uint8Array(o);for(;o--;)s[o]=a.charCodeAt(o);return new File([s],`${t}.${i}`,{type:r})}function checkImgExists(e){return new Promise((t,n)=>{const r=new Image;r.src=e,r.onload=function(e){t(e)},r.onerror=function(e){n(e)}})}function getDataType(e){return Object.prototype.toString.call(e).slice(8,-1)}function ArrayDeduplication(e){return[...new Set(e)]}function arrayObjectDeduplication(e,t){const n={};return e.reduce((e,r)=>(n[r[t]]||(n[r[t]]=!0,e.push(r)),e),[])}function findCharIndex(e){const{str:t,char:n,num:r}=e;let i=t.indexOf(n);if(-1===i)return-1;for(let e=0;e<r-1;e++)if(i=t.indexOf(n,i+1),-1===i)return-1;return i}function randoms(e,t){return Math.random()*(t-e+1)+e}function numFormat(e){if(e){const t=e.toString().split("."),n=t[0].split("").reverse();let r=[];for(let e=0;e<n.length;e++)e%3==0&&0!==e&&r.push(","),r.push(n[e]);return r.reverse(),r=t[1]?r.join("").concat(`.${t[1]}`):r.join(""),r}}function isEmpty(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}function getUrlParam(e){const t=new RegExp(`(^|&)${e}=([^&]*)(&|$)`),n=window.location.search.substr(1).match(t);return null!=n?decodeURI(n[2]):""}function paging(e){const{list:t,currentPage:n,pageSize:r}=e;return t.filter((e,t)=>t<+n*+r&&t>=(+n-1)*+r)}function getFileSuffix(e){return e.substring(e.lastIndexOf(".")+1)}function getFileName(e){return e?e.substring(e.lastIndexOf("/")+1):""}function readTxtDocument(e){return new Promise(t=>{const n=getFileUrl()+e,r=new XMLHttpRequest;r.open("get",n,!0),r.responseType="blob",r.onload=function(e){const n=new FileReader;n.readAsText(e.target.response,"GB2312"),n.onload=function(){t(n.result)}},r.send()})}function secondConversion(e){if(!e)return 0;const t=Number.parseInt((e/60/60).toString(),10),n=Number.parseInt((e/60%60).toString(),10),r=Number.parseInt((e%60).toString(),10);return t?`${t}小时${n}分钟${r}秒`:n?`${n}分钟${r}秒`:`${r}秒`}function addingPrefixToFile(e,t={}){if(!e)return[];const{pathKey:n="filePath",nameKey:r="fileName",idKey:i="id"}=t,a=getFileUrl();for(let t=0;t<e.length;t++)e[t].url=a+e[t][n],e[t].name=e[t][r]||getFileName(e[t][n]),e[t].id=e[t][i];return e}function getLabelName(e){const{status:t,list:n,idKey:r="bianma",nameKey:i="name"}=e;for(let e=0;e<n.length;e++)if(t?.toString()===n[e][r]?.toString())return n[e][i]}function calculateFileSize(e){return e>1024?`${(""+e/1024).substring(0,(""+e/1024).lastIndexOf(".")+3)}MB`:`${e}KB`}function idCardGetDateAndGender(e){let t="",n="";if(ID_NUMBER.test(e)){const r=e.substring(6,14),i=e.substring(16,17),a=`${r.substring(0,4)}-${r.substring(4,6)}-${r.substring(6,8)}`,o=new Date(a.replace(/-/g,"/")),s=o.getMonth()+1;let l;const c=o.getDate();let u;l=s<10?`0${s}`:s,u=c<10?`0${c}`:c,t=i%2==1?"1":"0",n=`${o.getFullYear()}-${l}-${u}`}return{sex:t,date:n}}function getMatchedItems(e){const{list:t,value:n,idKey:r="bianma"}=e;return t.filter(e=>n.includes(e[r]))}function getUnmatchedItems(e){const{list:t,value:n,idKey:r="bianma"}=e;return t.filter(e=>!n.includes(e[r]))}function listTransTree(e){const{json:t,idKey:n,parentIdKey:r,childrenKey:i}=e,a=[],o={};let s=0,l=0;const c=t.length;for(;s<c;s++)o[t[s][n]]=t[s];for(;l<c;l++){const e=t[l],n=o[e[r]];n?(!n[i]&&(n[i]=[]),n[i].push(e)):a.push(e)}return a}function isEmptyToWhether(e,t={}){const{yesText:n="是",noText:r="否",yesValue:i="1"}=t;return isEmpty(e)?"":e.toString()===i.toString()?n:r}function createGuid(e=32){let t="";for(let n=0;n<e;n++)t+="abcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(36*Math.random()));return t}function getIndexColumn(e){return{title:"序号",key:"index",width:70,render:(t,n,r)=>!1===e?r+1:serialNumber(e,r)}}function getTreeNodePaths(e){const{data:t,targetId:n,idKey:r,childrenKey:i,path:a=[],isIncludeOneself:o}=e;for(let e=0;e<t.length;e++){const s=t[e],l=[...a,s];if(s[r]===n)return o?l:a;if(s[i]&&s[i].length>0){const e=getTreeNodePaths({data:s[i],targetId:n,idKey:r,childrenKey:i,path:l,isIncludeOneself:o});if(e)return e}}return null}const processTreeDataByLevel=e=>{const{data:t,level:n,childrenKey:r,currentLevel:i=1}=e;return t.map(e=>{const t={...e};return n&&i>=n?(t.isLeaf=!0,delete t[r]):e[r]&&e[r].length>0?t[r]=processTreeDataByLevel({data:e[r],currentLevel:i+1,level:n,childrenKey:r}):t.isLeaf=!0,t})},processTreeDataForOnlyLastLevel=e=>{const{data:t,childrenKey:n,onlyLastLevel:r=!1}=e;return r?t.map(e=>{const t=e[n]&&e[n].length>0,i={...e,selectable:!t};return t&&(i[n]=processTreeDataForOnlyLastLevel({data:e[n],childrenKey:n,onlyLastLevel:r})),i}):t},validatorEndTime=(e,t="结束时间不能早于开始时间")=>({validator:(n,r)=>r&&e&&r<e?Promise.reject(t):Promise.resolve()}),validatorTimeGTCurrentDay=(e="需要大于当前时间")=>({validator:(t,n)=>n&&n<=dayjs().format("YYYY-MM-DD HH:mm:ss")?Promise.reject(e):Promise.resolve()});function dynamicLoadJs(e){return new Promise((t,n)=>{const r=document.createElement("script");r.type="text/javascript",r.src=e,r.onload=t,r.onerror=n,document.body.appendChild(r)})}function dynamicLoadCss(e){return new Promise((t,n)=>{const r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.href=e,r.onload=t,r.onerror=n,document.head.appendChild(r)})}function normalizeEmptyHtml(e){if(!e)return"";const t=e.replace(/\s+/g,"").toLowerCase();return"<p><br></p>"===t||"<p></p>"===t||""===t?"":e}function getFileUrl(){return process.env.app.fileUrl}export{ArrayDeduplication,addingPrefixToFile,arrayObjectDeduplication,base642File,calculateFileSize,checkImgExists,createGuid,dynamicLoadCss,dynamicLoadJs,findCharIndex,getDataType,getFileName,getFileSuffix,getFileUrl,getIndexColumn,getLabelName,getMatchedItems,getTreeNodePaths,getUnmatchedItems,getUrlParam,idCardGetDateAndGender,image2Base64,image2Base642,interceptTheSuffix,isEmpty,isEmptyToWhether,listTransTree,normalizeEmptyHtml,numFormat,paging,processTreeDataByLevel,processTreeDataForOnlyLastLevel,randoms,readTxtDocument,secondConversion,serialNumber,toArrayString,validatorEndTime,validatorTimeGTCurrentDay};