@flatbiz/antd 4.2.27 → 4.2.29
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/esm/button-operate/index.js +1 -1
- package/esm/{button-operate-2f27502d.js → button-operate-260750d4.js} +2 -2
- package/esm/{button-operate-2f27502d.js.map → button-operate-260750d4.js.map} +1 -1
- package/esm/button-wrapper/index.js +1 -1
- package/esm/{button-wrapper-698da5b1.js → button-wrapper-6441881c.js} +2 -2
- package/esm/{button-wrapper-698da5b1.js.map → button-wrapper-6441881c.js.map} +1 -1
- package/esm/check-list/index.js +2 -1
- package/esm/check-list/index.js.map +1 -1
- package/esm/dialog-alert/index.js +1 -1
- package/esm/dialog-confirm/index.js +1 -1
- package/esm/{dialog-confirm-0ebd95e5.js → dialog-confirm-4b387b9b.js} +2 -2
- package/esm/{dialog-confirm-0ebd95e5.js.map → dialog-confirm-4b387b9b.js.map} +1 -1
- package/esm/dialog-drawer/index.js +1 -1
- package/esm/dialog-modal/index.js +1 -1
- package/esm/{dialog-modal-910b7cec.js → dialog-modal-8568caf2.js} +2 -2
- package/esm/{dialog-modal-910b7cec.js.map → dialog-modal-8568caf2.js.map} +1 -1
- package/esm/dropdown-menu-wrapper/index.js +1 -1
- package/esm/{dropdown-menu-wrapper-3d2b8cda.js → dropdown-menu-wrapper-bd05860d.js} +2 -2
- package/esm/{dropdown-menu-wrapper-3d2b8cda.js.map → dropdown-menu-wrapper-bd05860d.js.map} +1 -1
- package/esm/easy-table/index.js +2 -2
- package/esm/easy-table/index.js.map +1 -1
- package/esm/fba-utils/index.js +1 -1
- package/esm/fba-utils-1e895394.js +3 -0
- package/esm/fba-utils-1e895394.js.map +1 -0
- package/esm/form-grid/index.js +1 -1
- package/esm/form-grid/index.js.map +1 -1
- package/esm/form-item-group/index.js +1 -1
- package/esm/form-item-hidden/index.css +0 -0
- package/esm/form-item-hidden/index.js +5 -0
- package/esm/form-item-hidden/index.js.map +1 -0
- package/esm/form-item-wrapper/index.js +1 -1
- package/esm/form-item-wrapper/index.js.map +1 -1
- package/esm/local-loading/index.js +2 -1
- package/esm/local-loading/index.js.map +1 -1
- package/esm/permission/index.js +1 -1
- package/esm/table-cell-render/index.js +1 -1
- package/esm/time-range-picker-wrapper-form-item/index.js +1 -1
- package/esm/tree-wrapper/index.js +1 -1
- package/index.d.ts +19 -3
- package/package.json +1 -1
- package/esm/attach-properties-to-component-9d9644cf.js +0 -3
- package/esm/attach-properties-to-component-9d9644cf.js.map +0 -1
- package/esm/fba-utils-a4c7d94d.js +0 -3
- package/esm/fba-utils-a4c7d94d.js.map +0 -1
|
@@ -9,5 +9,5 @@ import './../input-search-wrapper/index.css';
|
|
|
9
9
|
import './../request-status/index.css';
|
|
10
10
|
import './index.css';
|
|
11
11
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
12
|
-
import e from"@ant-design/icons/es/icons/CaretDownFilled";import r from"@ant-design/icons/es/icons/MoreOutlined";import{classNames as t}from"@dimjs/utils/cjs/class-names";import{isArray as a}from"@dimjs/lang/cjs/is-array";import{extend as n}from"@dimjs/utils/cjs/extend";import{hooks as i}from"@wove/react/cjs/hooks";import{_ as l,a as u}from"../_rollupPluginBabelHelpers-1f4d8910.js";import{cloneState as s}from"@dimjs/model";import{treeToArray as o,treeToTiledArray as c,treeLeafParentsArray as d,isUndefinedOrNull as f,treeFilter as v}from"@flatbiz/utils";import{Tree as m,Button as p,message as h}from"antd";import{forwardRef as g,useState as b,useMemo as y,useRef as L,useImperativeHandle as C,Fragment as w,isValidElement as j}from"react";import{a as q}from"../button-operate-2f27502d.js";import{D as R}from"../dropdown-menu-wrapper-3d2b8cda.js";import{fbaHooks as k}from"../fba-hooks/index.js";import{I as N}from"../input-search-wrapper-10d4a9b9.js";import{R as S}from"../request-status-03fc60e2.js";import{Model as T}from"@dimjs/model-react";import{isObject as P}from"@dimjs/lang/cjs/is-object";import{dequal as A}from"dequal";import{jsxs as D,jsx as E}from"react/jsx-runtime";import"@dimjs/lang/cjs/is-undefined";import"@dimjs/lang/cjs/is-plain-object";import"@dimjs/lang/cjs/is-string";import"@dimjs/lang/cjs/is-promise";import"../button-wrapper-698da5b1.js";import"@ant-design/icons/es/icons/LoadingOutlined";import"../config-provider-wrapper-dfe8f592.js";import"antd/es/locale/en_US";import"antd/es/locale/zh_CN";import"dayjs";import"dayjs/locale/en";import"dayjs/locale/zh-cn";import"dayjs/plugin/advancedFormat";import"dayjs/plugin/customParseFormat";import"dayjs/plugin/localeData";import"dayjs/plugin/utc";import"dayjs/plugin/weekday";import"dayjs/plugin/weekOfYear";import"dayjs/plugin/weekYear";import"../fba-utils-a4c7d94d.js";import"../use-responsive-point-21b8c601.js";var I={treeList:[],treeTiledArray:[],queryIsEmpty:false};var x={actions:{setTreeList:function e(r){return function(e){e.treeList=r.treeList||[];e.treeTiledArray=o(e.treeList,r.childrenName);e.requestStatus="request-success"}},resetTreeList:function e(){return function(e){e.treeList=[]}},changeRequestStatus:function e(r){return function(e){e.requestStatus=r;if(r==="request-error"){e.treeList=[]}}},treeListAppendChildren:function e(r){return function(e){var t=o(e.treeList,r.childrenName);var n=t.find((function(e){return e[r.valueName]===r.value}));if(n){if(a(r.appendList)&&r.appendList.length>0){n[r.childrenName]=r.appendList}else{n.isLeaf=true}}e.treeTiledArray=o(e.treeList,r.childrenName)}}},state:I};var O={};var V=function e(r){if(!O[r]){O[r]=T(x)}return O[r]};var K=function e(r,t,a){var n=c(t,a);return d(r,n,true,{value:"value",parentValue:"parentValue"})};var F=function e(r,t){var n=f(r)?[]:r;n=a(n)?n:[n];n=n.map((function(e){if(P(e))return e[t.value];return e}));return n};var _=function e(r,t){var a=F(r,t);var n={};a.forEach((function(e){n[e]=true}));return n};var M=function e(r,t,a){if(f(r)&&f(t))return true;var n=_(r,a);var i=_(t,a);var l=A(n,i);return l};var U=["serviceConfig","effectDependencyList","selectorTreeList","value","onChange","modelKey","checkableResponseParentNode","checkable","onSelectorTreeListChange","treeItemDataAdapter","searchValue","showSearch","searchPlaceholder","requestMessageConfig","labelInValueFieldNames","labelInValue","disabledCanUse","menuLayoutType","menuTriggerType"];var z=g((function(o,d){var g=o.serviceConfig,T=o.effectDependencyList,P=o.selectorTreeList,A=o.value,I=o.onChange,x=o.modelKey,O=o.checkableResponseParentNode,_=O===void 0?true:O,z=o.checkable,B=o.onSelectorTreeListChange,W=o.treeItemDataAdapter,Y=o.searchValue,H=o.showSearch,G=o.searchPlaceholder,J=o.requestMessageConfig,Q=o.labelInValueFieldNames,X=o.labelInValue,Z=o.disabledCanUse,$=o.menuLayoutType,ee=o.menuTriggerType,re=l(o,U);var te=o.hasOwnProperty("selectorTreeList");var ae=g||{};var ne=T||[];var ie=b(),le=ie[0],ue=ie[1];var se=V(x).useStore(),oe=se[0],ce=se[1];var de=k.useSafeState(false),fe=de[0],ve=de[1];var me="request-progress-"+o.modelKey;var pe=y((function(){return u({label:"label",value:"value",children:"children"},o.fieldNames)}),[o.fieldNames]);var he=L();var ge=$===undefined?"fold":$;var be=ee===undefined?"click":ee;var ye=z===true;var Le=y((function(){return u({label:"label",value:"value"},Q)}),[Q]);var Ce=b(),we=Ce[0],je=Ce[1];var qe=L(true);var Re=b(0),ke=Re[0],Ne=Re[1];var Se=L();var Te=y((function(){var e=F(A,Le);return e}),[Le,A]);k.useEffectCustom((function(){if(f(A)&&qe.current||oe.treeList.length==0)return;qe.current=false;if(!M(A,Se.current,Le)){console.log("modelKey:"+x+" TreeWrapper key refresh",A,Se.current);Se.current=ye?Te:Te[0];var e=Ie(Te,true);ue(Array.from(new Set(e)));he.current=Te;Ne(Date.now())}}),[A,oe.treeList]);var Pe=function e(r){return r===""||f(r)};var Ae=function e(r){var t=ae.onRequestResultAdapter?ae.onRequestResultAdapter(r):r;return t};k.useEffectCustom((function(){je(Y)}),[Y]);var De=i.useCallbackRef((function(){return new Promise((function(e,r){var t,a,i,l,u;var s=function(){try{return e()}catch(e){return r(e)}};var o=function(e){try{ve(false);void h.error(e.message||"数据查询异常...");return s()}catch(e){return r(e)}};try{if(!ae.onRequest){throw new Error("onRequest 调用接口服务不能为空")}t=ae.requiredParamsKeys;a=n({},ae.params);if(t){i=t.find((function(e){return Pe(a[e])}));if(i){console.warn("TreeWrapper组件:参数:"+t.join("、")+"不能为空");return e()}}var c=function(){try{return s()}catch(e){return o(e)}};var d=function(e){try{window[me]=false;ve(false);void ce.changeRequestStatus("request-error");return c()}catch(e){return o(e)}};try{ve(true);return Promise.resolve(ce.changeRequestStatus("request-progress")).then((function(e){try{window[me]=true;return Promise.resolve(ae.onRequest==null?void 0:ae.onRequest(a)).then((function(e){try{l=e;u=Ae(l);Ee(u||[]);ve(false);window[me]=false;return c()}catch(e){return d(e)}}),d)}catch(e){return d(e)}}),d)}catch(e){d(e)}}catch(e){o(e)}}))}));k.useEffectCustom((function(){if(te)return;if(Boolean(ne.length)){void De();return}var e=V(x).getState();if(e.requestStatus==="request-success"){return}if(!window[me]){void De();return}}),ne);k.useEffectCustom((function(){if(te){Ee(P||[])}}),[P]);var Ee=i.useCallbackRef((function(e){if((e==null?void 0:e.length)===0&&oe.treeList.length===0){void ce.changeRequestStatus("request-success");return}void ce.setTreeList({treeList:e||[],childrenName:pe.children});B==null?void 0:B(e)}));var Ie=i.useCallbackRef((function(e,r){var t=[];e.forEach((function(e){if(!r&&le!=null&&le.includes(e))return;var a=K(e,oe.treeList,pe);t=t.concat(a.map((function(e){return e.value})))}));return t}));i.useUpdateEffect((function(){if(we){var e=c(oe.treeList||[],pe);var r=e.filter((function(e){var r;return(r=e.label)==null?void 0:r.includes(we||"")}));ue((function(e){var t=Ie(r.map((function(e){return e.value}))).concat(e||[]);return Array.from(new Set(t))}))}else{ue([])}}),[we]);C(d,(function(){return{onClearSelectorList:function e(){void ce.resetTreeList()},getTreeDataList:function e(){return oe.treeList}}}));var xe=i.useCallbackRef((function(e){ue(e)}));var Oe=i.useCallbackRef((function(e,r,t){Se.current=e;var n=f(r)?[]:a(r)?r:[r];if(f(e)){I==null?void 0:I(e,r,t);return}if(X){var i=Le.label;var l=Le.value;var u=n.map((function(e){var r;return r={},r[i]=e[pe.label],r[l]=e[pe.value],r}));if(a(e)){I==null?void 0:I(u,n,t)}else{I==null?void 0:I(u[0],n[0],t)}}else{if(a(e)){I==null?void 0:I(e,n,t)}else{I==null?void 0:I(e,n[0],t)}}}));var Ve=i.useCallbackRef((function(e,r){var t=o.checkStrictly?e.checked:e;t=f(e)?[]:e;t=a(t)?t:[t];var n=[];var i=[];var l=[];var u=[];t.forEach((function(e){var r=oe.treeTiledArray.find((function(r){return r[pe.value]===e}));if(!r)return;var t=r==null?void 0:r[pe.children];if(!a(t)||t.length===0){n.push(r);i.push(r[pe.value])}l.push(r);u.push(r[pe.value])}));if(z){ue((function(e){var r=Ie(i).concat(e||[]);return Array.from(new Set(r))}));if(!_&&!o.checkStrictly){Oe(i,n,l)}else{Oe(u,l,l)}}else{if(t[0]){var s=l.find((function(e){return e[pe.value]===t[0]}));Oe(t[0],s,[s])}else{var c=r.node[pe.value];var d=oe.treeTiledArray.find((function(e){return e[pe.value]===c}));Oe(undefined,d,[d])}}}));var Ke=i.useCallbackRef((function(e){return W==null?void 0:W(e)}));var Fe=y((function(){var e=function e(r){return r==null?void 0:r.map((function(r){var n;var i=(Ke==null?void 0:Ke(r))||r;var l=Z?undefined:i.disabled;var s=i[pe.label];var o;if(we){var c=s.indexOf(we);var d=s.substring(0,c);var f=s.slice(c+we.length);o=c>-1?D("span",{className:t({"v-tree-item-disabled":i.disabled}),children:[d,E("span",{className:"site-tree-search-value",children:we}),f]}):null}if(!o){o=E("span",{className:t({"v-tree-item-disabled":i.disabled}),children:s})}var v=i[pe.children];return u({},i,(n={disabled:l},n[pe.label]=o,n._treeItemName=s,n._disabled=i.disabled,n[pe.children]=a(v)&&v.length>0?e(v):undefined,n))}))};var r=s(oe.treeList||[]);if(we){return e(v(s(oe.treeList||[]),(function(e){var r;var t=(r=e[pe.label])==null?void 0:r.toLowerCase();return t.indexOf(we.toLowerCase())>=0})))}return e(r)}),[oe.treeList,Ke,Z,pe.label,pe.children,we]);var _e=i.useCallbackRef((function(e){return new Promise((function(r,t){return new Promise((function(a,n){var i,l,u,s;if(e[pe.children]){r();return a()}var c=function(){try{return a()}catch(e){return n(e)}};var d=function(e){try{void h.error(e.message||"数据加载异常...");t();return c()}catch(e){return n(e)}};try{return Promise.resolve((i=o.loadDataServiceConfig)==null?void 0:i.onRequest==null?void 0:i.onRequest((l=o.loadDataServiceConfig)==null?void 0:l.getParams==null?void 0:l.getParams(e))).then((function(t){try{u=t;s=ae.onRequestResultAdapter?ae.onRequestResultAdapter(u):u;void ce.treeListAppendChildren({value:e[pe.value],appendList:s,childrenName:pe.children,valueName:pe.value}).then((function(e){Ee(e.treeList);r()}));return c()}catch(e){return d(e)}}),d)}catch(e){d(e)}}))}))}));var Me=i.useCallbackRef((function(e){var r=e==null?void 0:e[pe.children];var t=o.loadDataFlag;var a=t?!e.isLeaf:false;var n=r&&r.length>0||a;return!n}));var Ue=i.useCallbackRef((function(e){var a,n;var i=e._treeItemName||e[pe.label];if(ge==="fold"){var l;var s=[];if((l=o.menuOptions)!=null&&l.fold){var c,d,f;s=((c=o.menuOptions)==null?void 0:(d=c[ge])==null?void 0:d.call(c,u({},e,(f={},f[pe.label]=i,f))))||[]}else{var v;s=(o.getMenuOptions==null?void 0:o.getMenuOptions(u({},e,(v={},v[pe.label]=i,v))))||[]}return D(w,{children:[E("span",{className:"tree-item-title",children:e==null?void 0:e[pe.label]}),s.length>0&&E(R,{menuList:s,children:E(r,{})})]})}var m=(a=o.menuOptions)==null?void 0:a.tile==null?void 0:a.tile(u({},e,(n={},n[pe.label]=i,n)));return D(w,{children:[E("span",{className:"tree-item-title",children:e==null?void 0:e[pe.label]}),m?E(q,u({},m,{gap:5,className:t("tree-item-title-operate",m.className)})):null]})}));var ze=i.useDebounceCallback((function(e){je(e);o.onSearchValueChange==null?void 0:o.onSearchValueChange(e)}),300);var Be=i.useCallbackRef((function(e){ze(e.target.value)}));var We=i.useCallbackRef((function(e){if(!o.icon)return null;if(j(o.icon))return o.icon;var r=Me(e.data);return o.icon(u({},e,{isParent:!r,isLeaf:r}))}));var Ye=y((function(){return{title:pe.label,key:pe.value,children:pe.children}}),[pe]);var He=Fe.length>0&&oe.requestStatus!=="request-error";var Ge=u({showLine:{showLeafIcon:false},titleRender:Ue,blockNode:true,switcherIcon:E(e,{})},re,{fieldNames:Ye,expandedKeys:le,treeData:Fe,onExpand:xe,loadData:o.loadDataFlag?_e:undefined,style:u({width:"100%"},re.style),icon:We});var Je={onCheck:Ve,checkable:z,defaultCheckedKeys:he.current};var Qe={onSelect:Ve,multiple:false,defaultSelectedKeys:he.current};var Xe=z?Je:Qe;var Ze=t("v-tree-wrapper","v-tree-wrapper-menu-"+be);var $e=oe.treeList.length>0&&!He&&we;return D("div",{className:Ze,children:[!!H&&D("div",{className:"v-tree-wrapper-search-area",children:[E(N,{className:"v-tree-wrapper-search",placeholder:G,onChange:Be,value:Y,allowClear:true}),!!o.searchExtraElement&&E("span",{className:"v-tree-wrapper-search-extra",children:o.searchExtraElement})]}),He?E(m,u({},Xe,Ge,{className:"v-tree-wrapper-tree"}),ke):E(S,{status:oe.requestStatus,loading:fe,messageConfig:u({"request-success":$e?"搜索结果为空":"暂无数据"},J),errorButton:E(p,{type:"primary",onClick:De,children:"重新获取数据"})})]})}));z.defaultProps={disabledCanUse:true};export{z as TreeWrapper};
|
|
12
|
+
import e from"@ant-design/icons/es/icons/CaretDownFilled";import r from"@ant-design/icons/es/icons/MoreOutlined";import{classNames as t}from"@dimjs/utils/cjs/class-names";import{isArray as a}from"@dimjs/lang/cjs/is-array";import{extend as n}from"@dimjs/utils/cjs/extend";import{hooks as i}from"@wove/react/cjs/hooks";import{_ as l,a as u}from"../_rollupPluginBabelHelpers-1f4d8910.js";import{cloneState as s}from"@dimjs/model";import{treeToArray as o,treeToTiledArray as c,treeLeafParentsArray as d,isUndefinedOrNull as f,treeFilter as v}from"@flatbiz/utils";import{Tree as m,Button as p,message as h}from"antd";import{forwardRef as g,useState as b,useMemo as y,useRef as L,useImperativeHandle as C,Fragment as w,isValidElement as j}from"react";import{a as q}from"../button-operate-260750d4.js";import{D as R}from"../dropdown-menu-wrapper-bd05860d.js";import{fbaHooks as k}from"../fba-hooks/index.js";import{I as N}from"../input-search-wrapper-10d4a9b9.js";import{R as S}from"../request-status-03fc60e2.js";import{Model as T}from"@dimjs/model-react";import{isObject as P}from"@dimjs/lang/cjs/is-object";import{dequal as A}from"dequal";import{jsxs as D,jsx as E}from"react/jsx-runtime";import"@dimjs/lang/cjs/is-undefined";import"@dimjs/lang/cjs/is-plain-object";import"@dimjs/lang/cjs/is-string";import"@dimjs/lang/cjs/is-promise";import"../button-wrapper-6441881c.js";import"@ant-design/icons/es/icons/LoadingOutlined";import"../config-provider-wrapper-dfe8f592.js";import"antd/es/locale/en_US";import"antd/es/locale/zh_CN";import"dayjs";import"dayjs/locale/en";import"dayjs/locale/zh-cn";import"dayjs/plugin/advancedFormat";import"dayjs/plugin/customParseFormat";import"dayjs/plugin/localeData";import"dayjs/plugin/utc";import"dayjs/plugin/weekday";import"dayjs/plugin/weekOfYear";import"dayjs/plugin/weekYear";import"../fba-utils-1e895394.js";import"../use-responsive-point-21b8c601.js";var I={treeList:[],treeTiledArray:[],queryIsEmpty:false};var x={actions:{setTreeList:function e(r){return function(e){e.treeList=r.treeList||[];e.treeTiledArray=o(e.treeList,r.childrenName);e.requestStatus="request-success"}},resetTreeList:function e(){return function(e){e.treeList=[]}},changeRequestStatus:function e(r){return function(e){e.requestStatus=r;if(r==="request-error"){e.treeList=[]}}},treeListAppendChildren:function e(r){return function(e){var t=o(e.treeList,r.childrenName);var n=t.find((function(e){return e[r.valueName]===r.value}));if(n){if(a(r.appendList)&&r.appendList.length>0){n[r.childrenName]=r.appendList}else{n.isLeaf=true}}e.treeTiledArray=o(e.treeList,r.childrenName)}}},state:I};var O={};var V=function e(r){if(!O[r]){O[r]=T(x)}return O[r]};var K=function e(r,t,a){var n=c(t,a);return d(r,n,true,{value:"value",parentValue:"parentValue"})};var F=function e(r,t){var n=f(r)?[]:r;n=a(n)?n:[n];n=n.map((function(e){if(P(e))return e[t.value];return e}));return n};var _=function e(r,t){var a=F(r,t);var n={};a.forEach((function(e){n[e]=true}));return n};var M=function e(r,t,a){if(f(r)&&f(t))return true;var n=_(r,a);var i=_(t,a);var l=A(n,i);return l};var U=["serviceConfig","effectDependencyList","selectorTreeList","value","onChange","modelKey","checkableResponseParentNode","checkable","onSelectorTreeListChange","treeItemDataAdapter","searchValue","showSearch","searchPlaceholder","requestMessageConfig","labelInValueFieldNames","labelInValue","disabledCanUse","menuLayoutType","menuTriggerType"];var z=g((function(o,d){var g=o.serviceConfig,T=o.effectDependencyList,P=o.selectorTreeList,A=o.value,I=o.onChange,x=o.modelKey,O=o.checkableResponseParentNode,_=O===void 0?true:O,z=o.checkable,B=o.onSelectorTreeListChange,W=o.treeItemDataAdapter,Y=o.searchValue,H=o.showSearch,G=o.searchPlaceholder,J=o.requestMessageConfig,Q=o.labelInValueFieldNames,X=o.labelInValue,Z=o.disabledCanUse,$=o.menuLayoutType,ee=o.menuTriggerType,re=l(o,U);var te=o.hasOwnProperty("selectorTreeList");var ae=g||{};var ne=T||[];var ie=b(),le=ie[0],ue=ie[1];var se=V(x).useStore(),oe=se[0],ce=se[1];var de=k.useSafeState(false),fe=de[0],ve=de[1];var me="request-progress-"+o.modelKey;var pe=y((function(){return u({label:"label",value:"value",children:"children"},o.fieldNames)}),[o.fieldNames]);var he=L();var ge=$===undefined?"fold":$;var be=ee===undefined?"click":ee;var ye=z===true;var Le=y((function(){return u({label:"label",value:"value"},Q)}),[Q]);var Ce=b(),we=Ce[0],je=Ce[1];var qe=L(true);var Re=b(0),ke=Re[0],Ne=Re[1];var Se=L();var Te=y((function(){var e=F(A,Le);return e}),[Le,A]);k.useEffectCustom((function(){if(f(A)&&qe.current||oe.treeList.length==0)return;qe.current=false;if(!M(A,Se.current,Le)){console.log("modelKey:"+x+" TreeWrapper key refresh",A,Se.current);Se.current=ye?Te:Te[0];var e=Ie(Te,true);ue(Array.from(new Set(e)));he.current=Te;Ne(Date.now())}}),[A,oe.treeList]);var Pe=function e(r){return r===""||f(r)};var Ae=function e(r){var t=ae.onRequestResultAdapter?ae.onRequestResultAdapter(r):r;return t};k.useEffectCustom((function(){je(Y)}),[Y]);var De=i.useCallbackRef((function(){return new Promise((function(e,r){var t,a,i,l,u;var s=function(){try{return e()}catch(e){return r(e)}};var o=function(e){try{ve(false);void h.error(e.message||"数据查询异常...");return s()}catch(e){return r(e)}};try{if(!ae.onRequest){throw new Error("onRequest 调用接口服务不能为空")}t=ae.requiredParamsKeys;a=n({},ae.params);if(t){i=t.find((function(e){return Pe(a[e])}));if(i){console.warn("TreeWrapper组件:参数:"+t.join("、")+"不能为空");return e()}}var c=function(){try{return s()}catch(e){return o(e)}};var d=function(e){try{window[me]=false;ve(false);void ce.changeRequestStatus("request-error");return c()}catch(e){return o(e)}};try{ve(true);return Promise.resolve(ce.changeRequestStatus("request-progress")).then((function(e){try{window[me]=true;return Promise.resolve(ae.onRequest==null?void 0:ae.onRequest(a)).then((function(e){try{l=e;u=Ae(l);Ee(u||[]);ve(false);window[me]=false;return c()}catch(e){return d(e)}}),d)}catch(e){return d(e)}}),d)}catch(e){d(e)}}catch(e){o(e)}}))}));k.useEffectCustom((function(){if(te)return;if(Boolean(ne.length)){void De();return}var e=V(x).getState();if(e.requestStatus==="request-success"){return}if(!window[me]){void De();return}}),ne);k.useEffectCustom((function(){if(te){Ee(P||[])}}),[P]);var Ee=i.useCallbackRef((function(e){if((e==null?void 0:e.length)===0&&oe.treeList.length===0){void ce.changeRequestStatus("request-success");return}void ce.setTreeList({treeList:e||[],childrenName:pe.children});B==null?void 0:B(e)}));var Ie=i.useCallbackRef((function(e,r){var t=[];e.forEach((function(e){if(!r&&le!=null&&le.includes(e))return;var a=K(e,oe.treeList,pe);t=t.concat(a.map((function(e){return e.value})))}));return t}));i.useUpdateEffect((function(){if(we){var e=c(oe.treeList||[],pe);var r=e.filter((function(e){var r;return(r=e.label)==null?void 0:r.includes(we||"")}));ue((function(e){var t=Ie(r.map((function(e){return e.value}))).concat(e||[]);return Array.from(new Set(t))}))}else{ue([])}}),[we]);C(d,(function(){return{onClearSelectorList:function e(){void ce.resetTreeList()},getTreeDataList:function e(){return oe.treeList}}}));var xe=i.useCallbackRef((function(e){ue(e)}));var Oe=i.useCallbackRef((function(e,r,t){Se.current=e;var n=f(r)?[]:a(r)?r:[r];if(f(e)){I==null?void 0:I(e,r,t);return}if(X){var i=Le.label;var l=Le.value;var u=n.map((function(e){var r;return r={},r[i]=e[pe.label],r[l]=e[pe.value],r}));if(a(e)){I==null?void 0:I(u,n,t)}else{I==null?void 0:I(u[0],n[0],t)}}else{if(a(e)){I==null?void 0:I(e,n,t)}else{I==null?void 0:I(e,n[0],t)}}}));var Ve=i.useCallbackRef((function(e,r){var t=o.checkStrictly?e.checked:e;t=f(e)?[]:e;t=a(t)?t:[t];var n=[];var i=[];var l=[];var u=[];t.forEach((function(e){var r=oe.treeTiledArray.find((function(r){return r[pe.value]===e}));if(!r)return;var t=r==null?void 0:r[pe.children];if(!a(t)||t.length===0){n.push(r);i.push(r[pe.value])}l.push(r);u.push(r[pe.value])}));if(z){ue((function(e){var r=Ie(i).concat(e||[]);return Array.from(new Set(r))}));if(!_&&!o.checkStrictly){Oe(i,n,l)}else{Oe(u,l,l)}}else{if(t[0]){var s=l.find((function(e){return e[pe.value]===t[0]}));Oe(t[0],s,[s])}else{var c=r.node[pe.value];var d=oe.treeTiledArray.find((function(e){return e[pe.value]===c}));Oe(undefined,d,[d])}}}));var Ke=i.useCallbackRef((function(e){return W==null?void 0:W(e)}));var Fe=y((function(){var e=function e(r){return r==null?void 0:r.map((function(r){var n;var i=(Ke==null?void 0:Ke(r))||r;var l=Z?undefined:i.disabled;var s=i[pe.label];var o;if(we){var c=s.indexOf(we);var d=s.substring(0,c);var f=s.slice(c+we.length);o=c>-1?D("span",{className:t({"v-tree-item-disabled":i.disabled}),children:[d,E("span",{className:"site-tree-search-value",children:we}),f]}):null}if(!o){o=E("span",{className:t({"v-tree-item-disabled":i.disabled}),children:s})}var v=i[pe.children];return u({},i,(n={disabled:l},n[pe.label]=o,n._treeItemName=s,n._disabled=i.disabled,n[pe.children]=a(v)&&v.length>0?e(v):undefined,n))}))};var r=s(oe.treeList||[]);if(we){return e(v(s(oe.treeList||[]),(function(e){var r;var t=(r=e[pe.label])==null?void 0:r.toLowerCase();return t.indexOf(we.toLowerCase())>=0})))}return e(r)}),[oe.treeList,Ke,Z,pe.label,pe.children,we]);var _e=i.useCallbackRef((function(e){return new Promise((function(r,t){return new Promise((function(a,n){var i,l,u,s;if(e[pe.children]){r();return a()}var c=function(){try{return a()}catch(e){return n(e)}};var d=function(e){try{void h.error(e.message||"数据加载异常...");t();return c()}catch(e){return n(e)}};try{return Promise.resolve((i=o.loadDataServiceConfig)==null?void 0:i.onRequest==null?void 0:i.onRequest((l=o.loadDataServiceConfig)==null?void 0:l.getParams==null?void 0:l.getParams(e))).then((function(t){try{u=t;s=ae.onRequestResultAdapter?ae.onRequestResultAdapter(u):u;void ce.treeListAppendChildren({value:e[pe.value],appendList:s,childrenName:pe.children,valueName:pe.value}).then((function(e){Ee(e.treeList);r()}));return c()}catch(e){return d(e)}}),d)}catch(e){d(e)}}))}))}));var Me=i.useCallbackRef((function(e){var r=e==null?void 0:e[pe.children];var t=o.loadDataFlag;var a=t?!e.isLeaf:false;var n=r&&r.length>0||a;return!n}));var Ue=i.useCallbackRef((function(e){var a,n;var i=e._treeItemName||e[pe.label];if(ge==="fold"){var l;var s=[];if((l=o.menuOptions)!=null&&l.fold){var c,d,f;s=((c=o.menuOptions)==null?void 0:(d=c[ge])==null?void 0:d.call(c,u({},e,(f={},f[pe.label]=i,f))))||[]}else{var v;s=(o.getMenuOptions==null?void 0:o.getMenuOptions(u({},e,(v={},v[pe.label]=i,v))))||[]}return D(w,{children:[E("span",{className:"tree-item-title",children:e==null?void 0:e[pe.label]}),s.length>0&&E(R,{menuList:s,children:E(r,{})})]})}var m=(a=o.menuOptions)==null?void 0:a.tile==null?void 0:a.tile(u({},e,(n={},n[pe.label]=i,n)));return D(w,{children:[E("span",{className:"tree-item-title",children:e==null?void 0:e[pe.label]}),m?E(q,u({},m,{gap:5,className:t("tree-item-title-operate",m.className)})):null]})}));var ze=i.useDebounceCallback((function(e){je(e);o.onSearchValueChange==null?void 0:o.onSearchValueChange(e)}),300);var Be=i.useCallbackRef((function(e){ze(e.target.value)}));var We=i.useCallbackRef((function(e){if(!o.icon)return null;if(j(o.icon))return o.icon;var r=Me(e.data);return o.icon(u({},e,{isParent:!r,isLeaf:r}))}));var Ye=y((function(){return{title:pe.label,key:pe.value,children:pe.children}}),[pe]);var He=Fe.length>0&&oe.requestStatus!=="request-error";var Ge=u({showLine:{showLeafIcon:false},titleRender:Ue,blockNode:true,switcherIcon:E(e,{})},re,{fieldNames:Ye,expandedKeys:le,treeData:Fe,onExpand:xe,loadData:o.loadDataFlag?_e:undefined,style:u({width:"100%"},re.style),icon:We});var Je={onCheck:Ve,checkable:z,defaultCheckedKeys:he.current};var Qe={onSelect:Ve,multiple:false,defaultSelectedKeys:he.current};var Xe=z?Je:Qe;var Ze=t("v-tree-wrapper","v-tree-wrapper-menu-"+be);var $e=oe.treeList.length>0&&!He&&we;return D("div",{className:Ze,children:[!!H&&D("div",{className:"v-tree-wrapper-search-area",children:[E(N,{className:"v-tree-wrapper-search",placeholder:G,onChange:Be,value:Y,allowClear:true}),!!o.searchExtraElement&&E("span",{className:"v-tree-wrapper-search-extra",children:o.searchExtraElement})]}),He?E(m,u({},Xe,Ge,{className:"v-tree-wrapper-tree"}),ke):E(S,{status:oe.requestStatus,loading:fe,messageConfig:u({"request-success":$e?"搜索结果为空":"暂无数据"},J),errorButton:E(p,{type:"primary",onClick:De,children:"重新获取数据"})})]})}));z.defaultProps={disabledCanUse:true};export{z as TreeWrapper};
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
package/index.d.ts
CHANGED
|
@@ -745,6 +745,7 @@ export declare const EasyTable: import("react").ForwardRefExoticComponent<EasyTa
|
|
|
745
745
|
* EasyTable.Filter设置 isPure = true,FormItem无布局规则
|
|
746
746
|
*3. EasyTable.Filter中内置了 Form 标签,当children为函数时,可获取form实例
|
|
747
747
|
*4. 默认布局下,可通过设置 filterOperate 设置操作按钮
|
|
748
|
+
*5. Filter 子节点包含 hidden = true 会被忽略
|
|
748
749
|
*```
|
|
749
750
|
*/
|
|
750
751
|
Filter: (props: EasyTableFilterProps) => JSX.Element;
|
|
@@ -1162,9 +1163,11 @@ export declare const fbaHooks: {
|
|
|
1162
1163
|
import("react").Dispatch<import("react").SetStateAction<S>>
|
|
1163
1164
|
];
|
|
1164
1165
|
};
|
|
1166
|
+
declare function attachPropertiesToComponent<C, P extends Record<string, unknown>>(component: C, properties: P): C & P;
|
|
1165
1167
|
export declare const fbaUtils: {
|
|
1166
1168
|
hasPermission: (name?: string) => boolean;
|
|
1167
1169
|
getPermissionList: () => string[];
|
|
1170
|
+
attachPropertiesToComponent: typeof attachPropertiesToComponent;
|
|
1168
1171
|
};
|
|
1169
1172
|
export type FileImportProps = {
|
|
1170
1173
|
onImportFinish: (data?: TAny) => void;
|
|
@@ -1293,17 +1296,30 @@ export declare const FormItemGroup: {
|
|
|
1293
1296
|
HorizontalUnion: (props: FormItemHorizontalUnionProps) => JSX.Element;
|
|
1294
1297
|
Card: import("react").FC<FormItemCardProps>;
|
|
1295
1298
|
};
|
|
1299
|
+
export type FormItemHiddenProps = {
|
|
1300
|
+
name: string;
|
|
1301
|
+
};
|
|
1302
|
+
export declare const FormItemHidden: (props: FormItemHiddenProps) => JSX.Element;
|
|
1296
1303
|
export interface FormItemWrapperProps extends FormItemProps {
|
|
1297
1304
|
wrapper?: (children: ReactNode) => ReactElement;
|
|
1298
1305
|
/** 设置wrapper后,before、after失效 */
|
|
1299
1306
|
before?: ReactNode;
|
|
1300
1307
|
/** 设置wrapper后,before、after失效 */
|
|
1301
1308
|
after?: ReactNode;
|
|
1309
|
+
/** value 序列化处理 */
|
|
1310
|
+
inputNormalize?: (value?: TAny) => TAny;
|
|
1311
|
+
/**
|
|
1312
|
+
* onChange 参数序列化处理
|
|
1313
|
+
* 如果设置 normalize 属性,outputNormalize将失效
|
|
1314
|
+
*/
|
|
1315
|
+
outputNormalize?: (value?: TAny) => TAny;
|
|
1302
1316
|
}
|
|
1303
1317
|
/**
|
|
1304
|
-
* 对 Form.Item
|
|
1305
|
-
*
|
|
1306
|
-
*
|
|
1318
|
+
* 对 Form.Item 包装处理
|
|
1319
|
+
* ```
|
|
1320
|
+
* 1. 为 children 增加 before、after
|
|
1321
|
+
* 2. 对输入、输出数据进行序列化处理
|
|
1322
|
+
* ```
|
|
1307
1323
|
*/
|
|
1308
1324
|
export declare const FormItemWrapper: (props: FormItemWrapperProps) => JSX.Element;
|
|
1309
1325
|
export type GapProps = {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attach-properties-to-component-9d9644cf.js","sources":["@flatbiz/antd/src/_utils/attach-properties-to-component.ts"],"sourcesContent":["export function attachPropertiesToComponent<C, P extends Record<string, unknown>>(\n component: C,\n properties: P,\n): C & P {\n const ret = component as Record<string, unknown>;\n for (const key in properties) {\n if (properties.hasOwnProperty(key)) {\n ret[key] = properties[key];\n }\n }\n return ret as C & P;\n}\n"],"names":["attachPropertiesToComponent","component","properties","ret","key","hasOwnProperty"],"mappings":";AAAO,SAASA,EACdC,EACAC,GAEA,IAAMC,EAAMF,EACZ,IAAK,IAAMG,KAAOF,EAAY,CAC5B,GAAIA,EAAWG,eAAeD,GAAM,CAClCD,EAAIC,GAAOF,EAAWE,EACxB,CACF,CACA,OAAOD,CACT"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
2
|
-
import{isArray as r}from"@dimjs/lang/cjs/is-array";import{getGlobalData as i}from"@flatbiz/utils";var t=function t(){var e=i(),s=e.elemAclLimits;var a=r(s)?s:[];return a};var e=function r(i){if(!i)return true;var e=t();if(e.includes(i)){return true}return false};var s={hasPermission:e,getPermissionList:t};export{s as f};
|
|
3
|
-
//# sourceMappingURL=fba-utils-a4c7d94d.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fba-utils-a4c7d94d.js","sources":["@flatbiz/antd/src/fba-utils/fba-utils.ts"],"sourcesContent":["import { isArray } from '@dimjs/lang';\nimport { getGlobalData } from '@flatbiz/utils';\n\nconst getPermissionList = () => {\n const { elemAclLimits } = getGlobalData<{ elemAclLimits: string[] }>();\n const permissionList: string[] = isArray(elemAclLimits) ? elemAclLimits : [];\n return permissionList;\n};\n\nconst hasPermission = (name?: string) => {\n if (!name) return true;\n const permissionList = getPermissionList();\n if (permissionList.includes(name)) {\n return true;\n }\n return false;\n};\n\nexport const fbaUtils = {\n hasPermission,\n getPermissionList,\n};\n"],"names":["getPermissionList","_getGlobalData","getGlobalData","elemAclLimits","permissionList","_isArray","hasPermission","name","includes","fbaUtils"],"mappings":";kGAGA,IAAMA,EAAoB,SAApBA,IACJ,IAAAC,EAA0BC,IAAlBC,EAAaF,EAAbE,cACR,IAAMC,EAA2BC,EAAQF,GAAiBA,EAAgB,GAC1E,OAAOC,CACT,EAEA,IAAME,EAAgB,SAAhBA,EAAiBC,GACrB,IAAKA,EAAM,OAAO,KAClB,IAAMH,EAAiBJ,IACvB,GAAII,EAAeI,SAASD,GAAO,CACjC,OAAO,IACT,CACA,OAAO,KACT,EAEO,IAAME,EAAW,CACtBH,cAAAA,EACAN,kBAAAA"}
|