@flatbiz/antd 4.4.16 → 4.4.18
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/card-layout/index.css +1 -1
- package/esm/card-layout/index.js +1 -1
- package/esm/card-layout/index.js.map +1 -1
- package/esm/drag-form-list/index.js +1 -1
- package/esm/drag-form-list/index.js.map +1 -1
- package/esm/easy-table/index.js +1 -1
- package/esm/easy-table/index.js.map +1 -1
- package/esm/form-list-wrapper/index.css +1 -1
- package/esm/form-list-wrapper/index.js +1 -1
- package/esm/form-list-wrapper/index.js.map +1 -1
- package/esm/label-value-layout/index.js.map +1 -1
- package/esm/label-value-render/index.js +1 -1
- package/esm/label-value-render/index.js.map +1 -1
- package/index.d.ts +19 -5
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.block-layout{background-color:var(--block-bg-color)}.light-theme .block-layout{color:rgba(0,0,0,.88)}.dark-theme .block-layout{color:hsla(0,0%,100%,.85)}.card-layout{border-radius:6px;padding:15px}.card-layout-title-sign{padding-left:10px;position:relative}.card-layout-title-sign:before{background:var(--color-primary,#1677ff);border-radius:3px;
|
|
1
|
+
.block-layout{background-color:var(--block-bg-color)}.light-theme .block-layout{color:rgba(0,0,0,.88)}.dark-theme .block-layout{color:hsla(0,0%,100%,.85)}.card-layout{border-radius:6px;padding:15px}.card-layout-title-sign{padding-left:10px;position:relative}.card-layout-title-sign:before{background:var(--color-primary,#1677ff);border-radius:3px;content:"";height:13px;left:0;position:absolute;top:50%;transform:translateY(-50%);width:3px}.card-layout-title{align-items:center;display:flex;position:relative}.card-layout-title+.card-layout-content{margin-top:8px}.card-layout-title-content{font-size:16px;font-weight:500}.card-layout-subtitle,.card-layout-title-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.card-layout-subtitle{color:#969696;flex:1;font-size:12px}.card-layout-title-extra{margin-left:15px}.card-layout-desc,.card-layout-desc-list{font-size:12px;opacity:.7}.card-layout+.card-layout,.card-layout-desc+.card-layout-content,.card-layout-desc-list+.card-layout-content{margin-top:8px}.card-layout-title-fixed{display:flex;flex-direction:column;height:100%;overflow:hidden}.card-layout-title-fixed>.card-layout-content{flex:1;overflow-y:auto}.card-layout-small{padding:8px 15px}.card-layout-small .card-layout-content{margin-top:0}.card-layout-small .card-layout-title-content{font-size:14px}.card-layout-small .card-layout-title-sign:before{height:11px}.card-layout-tight{border-radius:0;padding:0}
|
package/esm/card-layout/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import './index.css';
|
|
3
3
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
4
|
-
import{isArray as t}from"@dimjs/lang/cjs/is-array";import{
|
|
4
|
+
import{isArray as t}from"@dimjs/lang/cjs/is-array";import{_ as e}from"../_rollupPluginBabelHelpers-a0769acd.js";import{extend as l}from"@dimjs/utils/cjs/extend";import{classNames as i}from"@dimjs/utils/cjs/class-names";import{Space as a}from"antd";import{Fragment as r}from"react";import{B as s}from"../index-1f45bfd5.js";import{jsx as d,jsxs as c}from"react/jsx-runtime";var n=function n(o){var u;var m=i("card-layout",{"card-layout-tight":o.layoutType==="tight","card-layout-title-fixed":o.titleFixed,"card-layout-small":o.size==="small"},o.className);var y=l(o.style,{padding:o.padding,width:o.width,height:o.height,overflowY:!o.titleFixed&&(o.height||(u=o.style)!=null&&u.height)?"auto":undefined});if(o.hidden)return d(r,{});return c(s,{className:m,style:y,onClick:o.onClick,children:[o.title||o.titleExtra?c("div",{className:i("card-layout-title",{"card-layout-title-sign":o.title?o.titleLeftLine:false}),style:o.titleStyle,children:[o.subTitle?c(r,{children:[d("div",{className:"card-layout-title-content",style:o.titleContentStyle,children:o.title}),d("div",{className:"card-layout-subtitle",style:e({marginLeft:10},o.subTitleStyle),children:o.subTitle})]}):d("div",{className:"card-layout-title-content",style:e({flex:1},o.titleContentStyle),children:o.title}),o.titleExtra?d("div",{className:"card-layout-title-extra",style:o.titleExtraStyle,children:o.titleExtra}):null]}):null,o.desc&&!t(o.desc)?d("div",{className:"card-layout-desc",children:o.desc}):null,o.desc&&t(o.desc)?d("div",{className:"card-layout-desc-list",children:d(a,{direction:"vertical",size:0,children:o.desc.map((function(t,e){return d(r,{children:t},e)}))})}):null,o.children?d("div",{className:"card-layout-content",style:o.contentStyle,children:o.children}):null]})};n.defaultProps={titleLeftLine:true,layoutType:"layer"};export{n as CardLayout};
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/card-layout/card-layout.tsx"],"sourcesContent":["import { isArray } from '@dimjs/lang';\nimport { classNames, extend } from '@dimjs/utils';\nimport { Space } from 'antd';\nimport { Fragment, type CSSProperties, type ReactElement, type ReactNode } from 'react';\nimport { BlockLayout } from '../block-layout';\nimport './style.less';\n\nexport type CardLayoutProps = {\n /** 描述 */\n desc?: string | string[] | ReactElement | ReactElement[];\n /** 标题 */\n title?: string | ReactElement;\n /**\n * layoutType 布局类型\n * ```\n * 1. layer:分层布局\n * 2. tight:紧凑布局(没有外边距)\n * ```\n */\n layoutType?: 'layer' | 'tight';\n /** 隐藏标题左侧符号 */\n titleLeftLine?: boolean;\n titleStyle?: CSSProperties;\n titleContentStyle?: CSSProperties;\n titleExtraStyle?: CSSProperties;\n contentStyle?: CSSProperties;\n /** 优先级大于 style padding */\n padding?: CSSProperties['padding'];\n /** 优先级大于 style width */\n width?: CSSProperties['width'];\n /** 优先级大于 style height */\n height?: CSSProperties['height'];\n /** 标题右侧布局 */\n titleExtra?: string | ReactElement;\n /** 当存在滚动条时,标题固定,滚动区域为内部部分 */\n titleFixed?: boolean;\n /**\n * 间距尺寸\n * 1. default = 15\n * 2. small = 8\n */\n size?: 'default' | 'small';\n onClick?: (event) => void;\n hidden?: boolean;\n children?: ReactNode;\n className?: string;\n style?: CSSProperties;\n};\n\n/**\n * 卡片结构布局,替代 SimpleLayout 组件\n * @param props\n * @returns\n * ```\n * 1. layoutType 布局类型\n * layer:分层布局\n * tight:紧凑布局(没有外边距)\n * ```\n */\nexport const CardLayout = (props: CardLayoutProps) => {\n const className = classNames(\n 'card-layout',\n {\n 'card-layout-tight': props.layoutType === 'tight',\n // 'card-layout-formlabel-left': labelAlign === 'left',\n 'card-layout-title-fixed': props.titleFixed,\n 'card-layout-small': props.size === 'small',\n },\n props.className,\n );\n\n // const theme = fbaHooks.useThemeToken();\n const style = extend(\n // { '--card-layout-colorPrimary': theme.colorPrimary },\n props.style,\n {\n padding: props.padding,\n width: props.width,\n height: props.height,\n overflowY: !props.titleFixed && (props.height || props.style?.height) ? 'auto' : undefined,\n },\n );\n\n if (props.hidden) return <Fragment />;\n\n return (\n <BlockLayout className={className} style={style} onClick={props.onClick}>\n {props.title || props.titleExtra ? (\n <div\n className={classNames('card-layout-title', {\n 'card-layout-title-sign': props.title ? props.titleLeftLine : false,\n })}\n style={props.titleStyle}\n >\n <div className=\"card-layout-title-content\" style={props.titleContentStyle}>\n {props.title}\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/card-layout/card-layout.tsx"],"sourcesContent":["import { isArray } from '@dimjs/lang';\nimport { classNames, extend } from '@dimjs/utils';\nimport { Space } from 'antd';\nimport { Fragment, type CSSProperties, type ReactElement, type ReactNode } from 'react';\nimport { BlockLayout } from '../block-layout';\nimport './style.less';\n\nexport type CardLayoutProps = {\n /** 描述 */\n desc?: string | string[] | ReactElement | ReactElement[];\n /** 标题 */\n title?: string | ReactElement;\n /** 子标题,在标题右侧 */\n subTitle?: string | ReactElement;\n /**\n * layoutType 布局类型\n * ```\n * 1. layer:分层布局\n * 2. tight:紧凑布局(没有外边距)\n * ```\n */\n layoutType?: 'layer' | 'tight';\n /** 隐藏标题左侧符号 */\n titleLeftLine?: boolean;\n titleStyle?: CSSProperties;\n titleContentStyle?: CSSProperties;\n subTitleStyle?: CSSProperties;\n titleExtraStyle?: CSSProperties;\n contentStyle?: CSSProperties;\n /** 优先级大于 style padding */\n padding?: CSSProperties['padding'];\n /** 优先级大于 style width */\n width?: CSSProperties['width'];\n /** 优先级大于 style height */\n height?: CSSProperties['height'];\n /** 标题右侧布局 */\n titleExtra?: string | ReactElement;\n /** 当存在滚动条时,标题固定,滚动区域为内部部分 */\n titleFixed?: boolean;\n /**\n * 间距尺寸\n * 1. default = 15\n * 2. small = 8\n */\n size?: 'default' | 'small';\n onClick?: (event) => void;\n hidden?: boolean;\n children?: ReactNode;\n className?: string;\n style?: CSSProperties;\n};\n\n/**\n * 卡片结构布局,替代 SimpleLayout 组件\n * @param props\n * @returns\n * ```\n * 1. layoutType 布局类型\n * layer:分层布局\n * tight:紧凑布局(没有外边距)\n * ```\n */\nexport const CardLayout = (props: CardLayoutProps) => {\n const className = classNames(\n 'card-layout',\n {\n 'card-layout-tight': props.layoutType === 'tight',\n // 'card-layout-formlabel-left': labelAlign === 'left',\n 'card-layout-title-fixed': props.titleFixed,\n 'card-layout-small': props.size === 'small',\n },\n props.className,\n );\n\n // const theme = fbaHooks.useThemeToken();\n const style = extend(\n // { '--card-layout-colorPrimary': theme.colorPrimary },\n props.style,\n {\n padding: props.padding,\n width: props.width,\n height: props.height,\n overflowY: !props.titleFixed && (props.height || props.style?.height) ? 'auto' : undefined,\n },\n );\n\n if (props.hidden) return <Fragment />;\n\n return (\n <BlockLayout className={className} style={style} onClick={props.onClick}>\n {props.title || props.titleExtra ? (\n <div\n className={classNames('card-layout-title', {\n 'card-layout-title-sign': props.title ? props.titleLeftLine : false,\n })}\n style={props.titleStyle}\n >\n {props.subTitle ? (\n <Fragment>\n <div className=\"card-layout-title-content\" style={props.titleContentStyle}>\n {props.title}\n </div>\n <div className=\"card-layout-subtitle\" style={{ marginLeft: 10, ...props.subTitleStyle }}>\n {props.subTitle}\n </div>\n </Fragment>\n ) : (\n <div\n className=\"card-layout-title-content\"\n style={{\n flex: 1,\n ...props.titleContentStyle,\n }}\n >\n {props.title}\n </div>\n )}\n\n {props.titleExtra ? (\n <div className=\"card-layout-title-extra\" style={props.titleExtraStyle}>\n {props.titleExtra}\n </div>\n ) : null}\n </div>\n ) : null}\n {props.desc && !isArray(props.desc) ? <div className=\"card-layout-desc\">{props.desc}</div> : null}\n {props.desc && isArray(props.desc) ? (\n <div className=\"card-layout-desc-list\">\n <Space direction=\"vertical\" size={0}>\n {(props.desc as string[]).map((item, index) => {\n return <Fragment key={index}>{item}</Fragment>;\n })}\n </Space>\n </div>\n ) : null}\n {props.children ? (\n <div className=\"card-layout-content\" style={props.contentStyle}>\n {props.children}\n </div>\n ) : null}\n </BlockLayout>\n );\n};\n\nCardLayout.defaultProps = {\n titleLeftLine: true,\n layoutType: 'layer',\n};\n"],"names":["CardLayout","props","_props$style","className","_classNames","layoutType","titleFixed","size","style","_extend","padding","width","height","overflowY","undefined","hidden","_jsx","Fragment","_jsxs","BlockLayout","onClick","children","title","titleExtra","titleLeftLine","titleStyle","subTitle","titleContentStyle","_extends","marginLeft","subTitleStyle","flex","titleExtraStyle","desc","_isArray","Space","direction","map","item","index","contentStyle","defaultProps"],"mappings":";wXA8DaA,EAAa,SAAbA,EAAcC,GAA2B,IAAAC,EACpD,IAAMC,EAAYC,EAChB,cACA,CACE,oBAAqBH,EAAMI,aAAe,QAE1C,0BAA2BJ,EAAMK,WACjC,oBAAqBL,EAAMM,OAAS,SAEtCN,EAAME,WAIR,IAAMK,EAAQC,EAEZR,EAAMO,MACN,CACEE,QAAST,EAAMS,QACfC,MAAOV,EAAMU,MACbC,OAAQX,EAAMW,OACdC,WAAYZ,EAAMK,aAAeL,EAAMW,SAAMV,EAAID,EAAMO,QAANN,MAAAA,EAAaU,QAAU,OAASE,YAIrF,GAAIb,EAAMc,OAAQ,OAAOC,EAACC,EAAQ,CAAE,GAEpC,OACEC,EAACC,EAAW,CAAChB,UAAWA,EAAWK,MAAOA,EAAOY,QAASnB,EAAMmB,QAAQC,SAAA,CACrEpB,EAAMqB,OAASrB,EAAMsB,WACpBL,EAAA,MAAA,CACEf,UAAWC,EAAW,oBAAqB,CACzC,yBAA0BH,EAAMqB,MAAQrB,EAAMuB,cAAgB,QAEhEhB,MAAOP,EAAMwB,WAAWJ,UAEvBpB,EAAMyB,SACLR,EAACD,EAAQ,CAAAI,UACPL,EAAA,MAAA,CAAKb,UAAU,4BAA4BK,MAAOP,EAAM0B,kBAAkBN,SACvEpB,EAAMqB,QAETN,EAAA,MAAA,CAAKb,UAAU,uBAAuBK,MAAKoB,EAAA,CAAIC,WAAY,IAAO5B,EAAM6B,eAAgBT,SACrFpB,EAAMyB,cAIXV,EAAA,MAAA,CACEb,UAAU,4BACVK,MAAKoB,EAAA,CACHG,KAAM,GACH9B,EAAM0B,mBACTN,SAEDpB,EAAMqB,QAIVrB,EAAMsB,WACLP,EAAA,MAAA,CAAKb,UAAU,0BAA0BK,MAAOP,EAAM+B,gBAAgBX,SACnEpB,EAAMsB,aAEP,QAEJ,KACHtB,EAAMgC,OAASC,EAAQjC,EAAMgC,MAAQjB,EAAA,MAAA,CAAKb,UAAU,mBAAkBkB,SAAEpB,EAAMgC,OAAc,KAC5FhC,EAAMgC,MAAQC,EAAQjC,EAAMgC,MAC3BjB,EAAA,MAAA,CAAKb,UAAU,wBAAuBkB,SACpCL,EAACmB,EAAK,CAACC,UAAU,WAAW7B,KAAM,EAAEc,SAChCpB,EAAMgC,KAAkBI,KAAI,SAACC,EAAMC,GACnC,OAAOvB,EAACC,EAAQ,CAAAI,SAAciB,GAARC,UAI1B,KACHtC,EAAMoB,SACLL,EAAA,MAAA,CAAKb,UAAU,sBAAsBK,MAAOP,EAAMuC,aAAanB,SAC5DpB,EAAMoB,WAEP,OAGV,EAEArB,EAAWyC,aAAe,CACxBjB,cAAe,KACfnB,WAAY"}
|
|
@@ -9,5 +9,5 @@ import './../flex-layout/index.css';
|
|
|
9
9
|
import './../text-symbol-wrapper/index.css';
|
|
10
10
|
import './index.css';
|
|
11
11
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
12
|
-
import{classNames as e}from"@dimjs/utils/cjs/class-names";import{hooks as r}from"@wove/react/cjs/hooks";import{_ as t}from"../_rollupPluginBabelHelpers-a0769acd.js";import{DndContext as i,closestCenter as n,DragOverlay as a}from"@dnd-kit/core";import{useSortable as o,SortableContext as d,verticalListSortingStrategy as l,arrayMove as m}from"@dnd-kit/sortable";import{toArray as s,getUuid as u}from"@flatbiz/utils";import{Form as
|
|
12
|
+
import{classNames as e}from"@dimjs/utils/cjs/class-names";import{hooks as r}from"@wove/react/cjs/hooks";import{_ as t}from"../_rollupPluginBabelHelpers-a0769acd.js";import{DndContext as i,closestCenter as n,DragOverlay as a}from"@dnd-kit/core";import{useSortable as o,SortableContext as d,verticalListSortingStrategy as l,arrayMove as m}from"@dnd-kit/sortable";import{toArray as s,getUuid as u}from"@flatbiz/utils";import{Form as p,Empty as c}from"antd";import{Fragment as f,useState as g,useRef as v,useMemo as h}from"react";import{B as y}from"../index-1f45bfd5.js";import{ButtonWrapper as I}from"../button-wrapper/index.js";import{FormItemGroup as x}from"../form-item-group/index.js";import{TextSymbolWrapper as j}from"../text-symbol-wrapper/index.js";import D from"@ant-design/icons/es/icons/DragOutlined";import{CSS as b}from"@dnd-kit/utilities";import{jsx as L,jsxs as N}from"react/jsx-runtime";import"@ant-design/icons/es/icons/LoadingOutlined";import"@dimjs/lang/cjs/is-promise";import"../index-7f4ad045.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-hooks/index.js";import"@dimjs/lang/cjs/is-array";import"../use-responsive-point-21b8c601.js";import"@dimjs/utils/cjs/extend";import"../fba-utils/index.js";import"../flex-layout/index.js";function C(i){var n=p.useFormInstance();var a=i.isOverlay?false:i.getItemDragDisabled==null?void 0:i.getItemDragDisabled(i.uid,i.index);var d=o({id:i.uid,disabled:a}),l=d.listeners,m=d.setNodeRef,s=d.transform,u=d.transition;var c=r.useCallbackRef((function(){var e=i.dragIcon?i.dragIcon:L(D,{});return i.dragDisabled?L(f,{}):L("span",t({className:"drag-form-list-item-trigger"},l,{children:L("span",{children:e})}))}));var g=t({transform:b.Transform.toString(s),transition:u},i.style);var v=e("drag-form-list-item",{"drag-form-list-item-grap":i.isGray,"drag-form-list-item-disabled":a},i.className);return N("div",{style:t({},g),ref:m,className:v,children:[L(p.Item,{noStyle:true,children:c()}),L("div",{className:"drag-form-list-item-content",children:i.children({formListFieldData:i.formListFieldData,operation:i.formListOperate,formStageCompleteName:i.formStageCompleteName,index:i.index,getInsideFormItemName:function e(r){return[i.formListFieldData.name,r]},getInsideFormItemData:function e(){return n.getFieldValue(i.formStageCompleteName)||{}},prevCompleteName:i.prevCompleteName,uidKey:i.uidFieldName})})]})}var w=function e(r){if(r.wrapper)return r.wrapper({children:r.children});return r.children};var F=function e(r){var i,n,a;var o=(i=r.formListItemTitleHProps)==null?void 0:i.gap;var d=r.dragDisabled?[]:[{width:35,mainItem:L("div",{style:{marginRight:o===undefined?-15:-o}})}];return L(x.HorizontalUnion,t({},r.formListItemTitleHProps,{style:t({marginBottom:10},(n=r.formListItemTitleHProps)==null?void 0:n.style),groupConfigList:d.concat(((a=r.formListItemTitleList)==null?void 0:a.map((function(e){if(e.required){return{width:e.width,mainItem:L("div",{style:{textAlign:"center"},children:L(j,{text:e.title,symbolType:"required"})})}}return{width:e.width,mainItem:L("div",{style:{textAlign:"center"},children:e.title})}})))||[])}))};var k=function o(x){var j=[].concat(x.prevCompleteName,s(x.name));var D=g(),b=D[0],k=D[1];var R=p.useFormInstance();var S=v([]);var T=x.uidFieldName||"uid";var A=p.useWatch(j,R);var P=r.useCallbackRef((function(e){return e==null?void 0:e[T]}));function E(e){var r=e.active;k(r.id)}var O=r.useCallbackRef((function(){return R.getFieldValue(j)||[]}));function H(e){var r=e.active,t=e.over;var i=O();if(r.id!==t.id){var n=i.findIndex((function(e){return P(e)===r.id}));var a=i.findIndex((function(e){return P(e)===t.id}));var o=m(i,n,a);R.setFields([{name:x.name,value:o}]);x.onDropChange==null?void 0:x.onDropChange(o)}k(undefined)}var B=h((function(){if(!b)return undefined;var e=O();var r=e.findIndex((function(e){return P(e)===b}));return S.current.find((function(e){return e.name===r}))}),[b,O,P]);var _=x.itemGap?x.itemGap/2:8;return L(y,{className:e("drag-form-list",x.className),style:x.style,children:L(i,{collisionDetection:n,onDragStart:E,onDragEnd:H,children:L(p.List,{name:x.name,rules:x.rules,children:function e(r,i,n){var o;var m=n.errors;S.current=r;return N("div",{style:{borderRadius:"6px",border:m!=null&&m.length?"1px solid #ff4d4f":"1px solid transparent"},children:[(o=x.formListItemTitleList)!=null&&o.length?L(F,{formListItemTitleList:x.formListItemTitleList,formListItemTitleHProps:x.formListItemTitleHorizontalUnionProps,dragDisabled:x.dragDisabled}):null,!x.hiddenEmptyRender&&!(A!=null&&A.length)?L(c,{image:c.PRESENTED_IMAGE_SIMPLE,style:{margin:"15px 0"}}):null,L(w,{wrapper:x.formListChildrenWrapper,children:N(f,{children:[L(d,{items:O().map((function(e){return P(e)})),strategy:l,children:N(f,{children:[r.map((function(e,r){var n=P(O()[r]);if(!n)return null;return L(C,{formListOperate:i,formListFieldData:e,uid:n,dragIcon:x.dragIcon,getItemDragDisabled:x.getItemDragDisabled,dragDisabled:x.dragDisabled,isGray:!!n&&n===b,index:r,formStageCompleteName:[].concat(j,[e.name]),prevCompleteName:j,uidFieldName:T,style:t({},x.itemStyle,{padding:_+"px 0 "+_+"px 0"}),children:x.children},n+"-"+e.key)})),x.onCustomAddRowButton?x.onCustomAddRowButton(i):L(I,{hidden:x.hiddenAddRowButton,type:"dashed",block:true,onClick:function e(){var r;return i.add(t((r={},r[T]=u(),r),x.getAddRowDefaultValues==null?void 0:x.getAddRowDefaultValues()))},children:"添加"})]})}),L(a,{dropAnimation:{duration:0},children:b&&B?L(C,{isOverlay:true,uid:b,className:"drag-form-list-overlay",formListFieldData:B,dragIcon:x.dragIcon,formListOperate:null,index:0,formStageCompleteName:[].concat(j,[B.name]),prevCompleteName:j,uidFieldName:T,children:x.children},b):null}),L(p.ErrorList,{errors:m?[L("div",{style:{color:"#ff4d4f",padding:"5px"},children:m})]:undefined})]})})]})}})})})};export{k as DragFormList};
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/drag-form-list/sortable-item.tsx","@flatbiz/antd/src/drag-form-list/drag-form-list.tsx"],"sourcesContent":["import { DragOutlined } from '@ant-design/icons';\nimport { classNames } from '@dimjs/utils';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport { hooks } from '@wove/react';\nimport { Form, type FormListFieldData, type FormListOperation } from 'antd';\nimport { Fragment, type CSSProperties, type ReactElement } from 'react';\nimport { type DragFormListContentProps, type DragFormListProps } from './types';\nexport type SortableItemProps = {\n formListFieldData: FormListFieldData;\n formListOperate: FormListOperation;\n dragIcon?: DragFormListProps['dragIcon'];\n getItemDragDisabled?: DragFormListProps['getItemDragDisabled'];\n dragDisabled?: DragFormListProps['dragDisabled'];\n isGray?: boolean;\n className?: string;\n style?: CSSProperties;\n uid: string | number;\n index: number;\n isOverlay?: boolean;\n formStageCompleteName: (string | number)[];\n children: (data: DragFormListContentProps) => ReactElement;\n prevCompleteName: (string | number)[];\n uidFieldName: string;\n};\nexport function SortableItem(props: SortableItemProps) {\n const form = Form.useFormInstance();\n const isDisabled = props.isOverlay ? false : props.getItemDragDisabled?.(props.uid, props.index);\n const { listeners, setNodeRef, transform, transition } = useSortable({\n id: props.uid,\n disabled: isDisabled,\n });\n\n const dragIconRender = hooks.useCallbackRef(() => {\n const dragIcon = props.dragIcon ? props.dragIcon : <DragOutlined />;\n return props.dragDisabled ? (\n <Fragment />\n ) : (\n <span className=\"drag-form-list-item-trigger\" {...listeners}>\n <span>{dragIcon}</span>\n </span>\n );\n });\n\n const style = {\n transform: CSS.Transform.toString(transform),\n transition,\n ...props.style,\n };\n\n const cname = classNames(\n 'drag-form-list-item',\n {\n 'drag-form-list-item-grap': props.isGray,\n 'drag-form-list-item-disabled': isDisabled,\n },\n props.className,\n );\n return (\n <div style={{ ...style }} ref={setNodeRef} className={cname}>\n <Form.Item style={{ margin: 0 }}>{dragIconRender()}</Form.Item>\n <div className=\"drag-form-list-item-content\">\n {props.children({\n formListFieldData: props.formListFieldData,\n operation: props.formListOperate,\n formStageCompleteName: props.formStageCompleteName,\n index: props.index,\n getInsideFormItemName: (key: string) => {\n return [props.formListFieldData.name, key];\n },\n getInsideFormItemData: () => {\n return form.getFieldValue(props.formStageCompleteName) || {};\n },\n prevCompleteName: props.prevCompleteName,\n uidKey: props.uidFieldName,\n })}\n </div>\n </div>\n );\n}\n","import { classNames } from '@dimjs/utils';\nimport { closestCenter, DndContext, DragOverlay } from '@dnd-kit/core';\nimport { arrayMove, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';\nimport { getUuid, toArray, type TAny, type TPlainObject } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { Empty, Form, type FormListFieldData } from 'antd';\nimport { Fragment, useMemo, useRef, useState, type ReactElement } from 'react';\nimport { BlockLayout } from '../block-layout';\nimport { ButtonWrapper } from '../button-wrapper';\nimport { FormItemGroup } from '../form-item-group';\nimport { FormItemHorizontalUnionProps } from '../form-item-group/horizontal-union';\nimport { TextSymbolWrapper } from '../text-symbol-wrapper';\nimport { SortableItem } from './sortable-item';\nimport './style.less';\nimport { type DragFormListProps } from './types';\n\ntype FormListChildrenWrapperProps = {\n wrapper?: DragFormListProps['formListChildrenWrapper'];\n\n children: ReactElement;\n};\nconst FormListChildrenWrapper = (props: FormListChildrenWrapperProps) => {\n if (props.wrapper) return props.wrapper({ children: props.children });\n return props.children;\n};\n\nconst FormListTitleRender = (props: {\n formListItemTitleList: DragFormListProps['formListItemTitleList'];\n formListItemTitleHProps?: DragFormListProps['formListItemTitleHorizontalUnionProps'];\n dragDisabled?: boolean;\n}) => {\n const gap = props.formListItemTitleHProps?.gap;\n const innerList: FormItemHorizontalUnionProps['groupConfigList'] = props.dragDisabled\n ? []\n : [{ width: 35, mainItem: <div style={{ marginRight: gap === undefined ? -15 : -gap }} /> }];\n return (\n <FormItemGroup.HorizontalUnion\n {...props.formListItemTitleHProps}\n style={{ marginBottom: 10, ...props.formListItemTitleHProps?.style }}\n groupConfigList={innerList.concat(\n props.formListItemTitleList?.map((item) => {\n if (item.required) {\n return {\n width: item.width,\n mainItem: (\n <div style={{ textAlign: 'center' }}>\n <TextSymbolWrapper text={item.title} symbolType=\"required\" />\n </div>\n ),\n };\n }\n return { width: item.width, mainItem: <div style={{ textAlign: 'center' }}>{item.title}</div> };\n }) || [],\n )}\n />\n );\n};\n\n/**\n * 可拖拽FormList\n * ```\n * Demo: https://fex.qa.tcshuke.com/docs/admin/main/form/list\n * 1. FormList数组中必须要有唯一值字段,默认值字段名称uid,可通过uidFieldName自定义设置\n * ```\n */\nexport const DragFormList = (props: DragFormListProps) => {\n const stageCompleteName = [...props.prevCompleteName, ...toArray(props.name)] as Array<string | number>;\n const [dragActiveId, setDragActiveId] = useState<string | number>();\n const form = Form.useFormInstance();\n const formListOperationRef = useRef<FormListFieldData[]>([]);\n\n const uidFieldName = props.uidFieldName || 'uid';\n // 使用 useWatch 可确保FormList在变更后及时刷新\n const formListValue = Form.useWatch(stageCompleteName, form);\n\n const getUidValue = hooks.useCallbackRef((item) => {\n return item?.[uidFieldName] as string | number;\n });\n\n function handleDragStart(event) {\n const { active } = event;\n setDragActiveId(active.id);\n }\n\n const getItems = hooks.useCallbackRef(() => {\n /** 只能通过getFieldValue取值 */\n return (form.getFieldValue(stageCompleteName) || []) as TPlainObject[];\n });\n\n function handleDragEnd(event) {\n const { active, over } = event;\n const items = getItems();\n if (active.id !== over.id) {\n const oldIndex = items.findIndex((item) => getUidValue(item) === active.id);\n const newIndex = items.findIndex((item) => getUidValue(item) === over.id);\n const newList = arrayMove<TPlainObject>(items, oldIndex, newIndex);\n form.setFields([\n {\n name: props.name,\n value: newList,\n },\n ]);\n props.onDropChange?.(newList);\n }\n setDragActiveId(undefined);\n }\n\n const dragOverlayItem = useMemo(() => {\n if (!dragActiveId) return undefined;\n const items = getItems();\n const targetIndex = items.findIndex((item) => getUidValue(item) === dragActiveId);\n return formListOperationRef.current.find((item) => item.name === targetIndex);\n }, [dragActiveId, getItems, getUidValue]);\n\n return (\n <BlockLayout className={classNames('drag-form-list', props.className)} style={props.style}>\n <DndContext collisionDetection={closestCenter} onDragStart={handleDragStart} onDragEnd={handleDragEnd}>\n <Form.List name={props.name} rules={props.rules}>\n {(fields, operation, { errors }) => {\n formListOperationRef.current = fields;\n return (\n <div\n style={{\n borderRadius: '6px',\n border: errors?.length ? '1px solid #ff4d4f' : '1px solid transparent',\n }}\n >\n {props.formListItemTitleList?.length ? (\n <FormListTitleRender\n formListItemTitleList={props.formListItemTitleList}\n formListItemTitleHProps={props.formListItemTitleHorizontalUnionProps}\n dragDisabled={props.dragDisabled}\n />\n ) : null}\n {!props.hiddenEmptyRender && !formListValue?.length ? (\n <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} style={{ margin: '15px 0' }} />\n ) : null}\n <FormListChildrenWrapper wrapper={props.formListChildrenWrapper}>\n <Fragment>\n <SortableContext\n items={getItems().map((temp) => getUidValue(temp))}\n strategy={verticalListSortingStrategy}\n >\n <Fragment>\n {fields.map((item, index) => {\n const uid = getUidValue(getItems()[index]);\n if (!uid) return null;\n return (\n <SortableItem\n formListOperate={operation}\n formListFieldData={item}\n uid={uid}\n key={`${uid}-${item.key}`}\n dragIcon={props.dragIcon}\n getItemDragDisabled={props.getItemDragDisabled}\n dragDisabled={props.dragDisabled}\n isGray={!!uid && uid === dragActiveId}\n index={index}\n formStageCompleteName={[...stageCompleteName, item.name]}\n prevCompleteName={stageCompleteName}\n uidFieldName={uidFieldName}\n style={props.itemStyle}\n >\n {props.children}\n </SortableItem>\n );\n })}\n {props.onCustomAddRowButton ? (\n props.onCustomAddRowButton(operation)\n ) : (\n <ButtonWrapper\n hidden={props.hiddenAddRowButton}\n type=\"dashed\"\n block\n onClick={() =>\n operation.add({\n [uidFieldName]: getUuid(),\n ...props.getAddRowDefaultValues?.(),\n })\n }\n >\n 添加\n </ButtonWrapper>\n )}\n </Fragment>\n </SortableContext>\n <DragOverlay dropAnimation={{ duration: 0 }}>\n {dragActiveId && dragOverlayItem ? (\n <SortableItem\n isOverlay={true}\n uid={dragActiveId}\n key={dragActiveId}\n className=\"drag-form-list-overlay\"\n formListFieldData={dragOverlayItem}\n dragIcon={props.dragIcon}\n formListOperate={null as TAny}\n index={0}\n formStageCompleteName={[...stageCompleteName, dragOverlayItem.name]}\n prevCompleteName={stageCompleteName}\n uidFieldName={uidFieldName}\n >\n {props.children}\n </SortableItem>\n ) : null}\n </DragOverlay>\n <Form.ErrorList\n errors={\n errors\n ? [<div style={{ color: '#ff4d4f', padding: '5px' }}>{errors}</div>]\n : undefined\n }\n />\n </Fragment>\n </FormListChildrenWrapper>\n </div>\n );\n }}\n </Form.List>\n </DndContext>\n </BlockLayout>\n );\n};\n"],"names":["SortableItem","props","form","Form","useFormInstance","isDisabled","isOverlay","getItemDragDisabled","uid","index","_useSortable","useSortable","id","disabled","listeners","setNodeRef","transform","transition","dragIconRender","_hooks","useCallbackRef","dragIcon","_jsx","_DragOutlined","dragDisabled","Fragment","_extends","className","children","style","CSS","Transform","toString","cname","_classNames","isGray","_jsxs","ref","Item","margin","formListFieldData","operation","formListOperate","formStageCompleteName","getInsideFormItemName","key","name","getInsideFormItemData","getFieldValue","prevCompleteName","uidKey","uidFieldName","FormListChildrenWrapper","wrapper","FormListTitleRender","_props$formListItemTi","_props$formListItemTi2","_props$formListItemTi3","gap","formListItemTitleHProps","innerList","width","mainItem","marginRight","undefined","FormItemGroup","HorizontalUnion","marginBottom","groupConfigList","concat","formListItemTitleList","map","item","required","textAlign","TextSymbolWrapper","text","title","symbolType","DragFormList","stageCompleteName","toArray","_useState","useState","dragActiveId","setDragActiveId","formListOperationRef","useRef","formListValue","useWatch","getUidValue","handleDragStart","event","active","getItems","handleDragEnd","over","items","oldIndex","findIndex","newIndex","newList","arrayMove","setFields","value","onDropChange","dragOverlayItem","useMemo","targetIndex","current","find","BlockLayout","DndContext","collisionDetection","closestCenter","onDragStart","onDragEnd","List","rules","fields","_ref","_props$formListItemTi4","errors","borderRadius","border","length","formListItemTitleHorizontalUnionProps","hiddenEmptyRender","Empty","image","PRESENTED_IMAGE_SIMPLE","formListChildrenWrapper","SortableContext","temp","strategy","verticalListSortingStrategy","itemStyle","onCustomAddRowButton","ButtonWrapper","hidden","hiddenAddRowButton","type","block","onClick","_extends2","add","getUuid","getAddRowDefaultValues","DragOverlay","dropAnimation","duration","ErrorList","color","padding"],"mappings":";0hDAyBO,SAASA,EAAaC,GAC3B,IAAMC,EAAOC,EAAKC,kBAClB,IAAMC,EAAaJ,EAAMK,UAAY,MAAQL,EAAMM,iCAANN,EAAMM,oBAAsBN,EAAMO,IAAKP,EAAMQ,OAC1F,IAAAC,EAAyDC,EAAY,CACnEC,GAAIX,EAAMO,IACVK,SAAUR,IAFJS,EAASJ,EAATI,UAAWC,EAAUL,EAAVK,WAAYC,EAASN,EAATM,UAAWC,EAAUP,EAAVO,WAK1C,IAAMC,EAAiBC,EAAMC,gBAAe,WAC1C,IAAMC,EAAWpB,EAAMoB,SAAWpB,EAAMoB,SAAWC,EAAAC,MACnD,OAAOtB,EAAMuB,aACXF,EAACG,EAAQ,CAAA,GAETH,EAAA,OAAAI,EAAA,CAAMC,UAAU,+BAAkCb,EAAS,CAAAc,SACzDN,EAAA,OAAA,CAAAM,SAAOP,MAGb,IAEA,IAAMQ,EAAKH,EAAA,CACTV,UAAWc,EAAIC,UAAUC,SAAShB,GAClCC,WAAAA,GACGhB,EAAM4B,OAG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BAAiB,KACjBjC,MAAO,EACPkC,sBAAqB,GAAA0B,OAAMW,GAAmB0B,EAAgB5D,OAC9DG,iBAAkB+B,EAClB7B,aAAcA,EAAavB,SAE1B3B,EAAM2B,UAVFwD,GAYL,OAEN9D,EAACnB,EAAKoJ,UAAS,CACb7B,OACEA,EACI,CAACpG,EAAA,MAAA,CAAKO,MAAO,CAAE2H,MAAO,UAAWC,QAAS,OAAQ7H,SAAE8F,KACpD1D,mBAOlB,OAKV"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/drag-form-list/sortable-item.tsx","@flatbiz/antd/src/drag-form-list/drag-form-list.tsx"],"sourcesContent":["import { DragOutlined } from '@ant-design/icons';\nimport { classNames } from '@dimjs/utils';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport { hooks } from '@wove/react';\nimport { Form, type FormListFieldData, type FormListOperation } from 'antd';\nimport { Fragment, type CSSProperties, type ReactElement } from 'react';\nimport { type DragFormListContentProps, type DragFormListProps } from './types';\nexport type SortableItemProps = {\n formListFieldData: FormListFieldData;\n formListOperate: FormListOperation;\n dragIcon?: DragFormListProps['dragIcon'];\n getItemDragDisabled?: DragFormListProps['getItemDragDisabled'];\n dragDisabled?: DragFormListProps['dragDisabled'];\n isGray?: boolean;\n className?: string;\n style?: CSSProperties;\n uid: string | number;\n index: number;\n isOverlay?: boolean;\n formStageCompleteName: (string | number)[];\n children: (data: DragFormListContentProps) => ReactElement;\n prevCompleteName: (string | number)[];\n uidFieldName: string;\n};\nexport function SortableItem(props: SortableItemProps) {\n const form = Form.useFormInstance();\n const isDisabled = props.isOverlay\n ? false\n : props.getItemDragDisabled?.(props.uid, props.index);\n const { listeners, setNodeRef, transform, transition } = useSortable({\n id: props.uid,\n disabled: isDisabled,\n });\n\n const dragIconRender = hooks.useCallbackRef(() => {\n const dragIcon = props.dragIcon ? props.dragIcon : <DragOutlined />;\n return props.dragDisabled ? (\n <Fragment />\n ) : (\n <span className=\"drag-form-list-item-trigger\" {...listeners}>\n <span>{dragIcon}</span>\n </span>\n );\n });\n\n const style = {\n transform: CSS.Transform.toString(transform),\n transition,\n ...props.style,\n };\n\n const cname = classNames(\n 'drag-form-list-item',\n {\n 'drag-form-list-item-grap': props.isGray,\n 'drag-form-list-item-disabled': isDisabled,\n },\n props.className\n );\n return (\n <div style={{ ...style }} ref={setNodeRef} className={cname}>\n <Form.Item noStyle>{dragIconRender()}</Form.Item>\n <div className=\"drag-form-list-item-content\">\n {props.children({\n formListFieldData: props.formListFieldData,\n operation: props.formListOperate,\n formStageCompleteName: props.formStageCompleteName,\n index: props.index,\n getInsideFormItemName: (key: string) => {\n return [props.formListFieldData.name, key];\n },\n getInsideFormItemData: () => {\n return form.getFieldValue(props.formStageCompleteName) || {};\n },\n prevCompleteName: props.prevCompleteName,\n uidKey: props.uidFieldName,\n })}\n </div>\n </div>\n );\n}\n","import { classNames } from '@dimjs/utils';\nimport { closestCenter, DndContext, DragOverlay } from '@dnd-kit/core';\nimport { arrayMove, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';\nimport { getUuid, toArray, type TAny, type TPlainObject } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { Empty, Form, type FormListFieldData } from 'antd';\nimport { Fragment, useMemo, useRef, useState, type ReactElement } from 'react';\nimport { BlockLayout } from '../block-layout';\nimport { ButtonWrapper } from '../button-wrapper';\nimport { FormItemGroup } from '../form-item-group';\nimport { FormItemHorizontalUnionProps } from '../form-item-group/horizontal-union';\nimport { TextSymbolWrapper } from '../text-symbol-wrapper';\nimport { SortableItem } from './sortable-item';\nimport './style.less';\nimport { type DragFormListProps } from './types';\n\ntype FormListChildrenWrapperProps = {\n wrapper?: DragFormListProps['formListChildrenWrapper'];\n\n children: ReactElement;\n};\nconst FormListChildrenWrapper = (props: FormListChildrenWrapperProps) => {\n if (props.wrapper) return props.wrapper({ children: props.children });\n return props.children;\n};\n\nconst FormListTitleRender = (props: {\n formListItemTitleList: DragFormListProps['formListItemTitleList'];\n formListItemTitleHProps?: DragFormListProps['formListItemTitleHorizontalUnionProps'];\n dragDisabled?: boolean;\n}) => {\n const gap = props.formListItemTitleHProps?.gap;\n const innerList: FormItemHorizontalUnionProps['groupConfigList'] = props.dragDisabled\n ? []\n : [\n {\n width: 35,\n mainItem: <div style={{ marginRight: gap === undefined ? -15 : -gap }} />,\n },\n ];\n return (\n <FormItemGroup.HorizontalUnion\n {...props.formListItemTitleHProps}\n style={{ marginBottom: 10, ...props.formListItemTitleHProps?.style }}\n groupConfigList={innerList.concat(\n props.formListItemTitleList?.map((item) => {\n if (item.required) {\n return {\n width: item.width,\n mainItem: (\n <div style={{ textAlign: 'center' }}>\n <TextSymbolWrapper text={item.title} symbolType=\"required\" />\n </div>\n ),\n };\n }\n return {\n width: item.width,\n mainItem: <div style={{ textAlign: 'center' }}>{item.title}</div>,\n };\n }) || [],\n )}\n />\n );\n};\n\n/**\n * 可拖拽FormList\n * ```\n * Demo: https://fex.qa.tcshuke.com/docs/admin/main/form/list\n * 1. FormList数组中必须要有唯一值字段,默认值字段名称uid,可通过uidFieldName自定义设置\n * 2. 通过 itemGap 设置FormList Item 之间间隙\n * ```\n */\nexport const DragFormList = (props: DragFormListProps) => {\n const stageCompleteName = [...props.prevCompleteName, ...toArray(props.name)] as Array<string | number>;\n const [dragActiveId, setDragActiveId] = useState<string | number>();\n const form = Form.useFormInstance();\n const formListOperationRef = useRef<FormListFieldData[]>([]);\n\n const uidFieldName = props.uidFieldName || 'uid';\n // 使用 useWatch 可确保FormList在变更后及时刷新\n const formListValue = Form.useWatch(stageCompleteName, form);\n\n const getUidValue = hooks.useCallbackRef((item) => {\n return item?.[uidFieldName] as string | number;\n });\n\n function handleDragStart(event) {\n const { active } = event;\n setDragActiveId(active.id);\n }\n\n const getItems = hooks.useCallbackRef(() => {\n /** 只能通过getFieldValue取值 */\n return (form.getFieldValue(stageCompleteName) || []) as TPlainObject[];\n });\n\n function handleDragEnd(event) {\n const { active, over } = event;\n const items = getItems();\n if (active.id !== over.id) {\n const oldIndex = items.findIndex((item) => getUidValue(item) === active.id);\n const newIndex = items.findIndex((item) => getUidValue(item) === over.id);\n const newList = arrayMove<TPlainObject>(items, oldIndex, newIndex);\n form.setFields([\n {\n name: props.name,\n value: newList,\n },\n ]);\n props.onDropChange?.(newList);\n }\n setDragActiveId(undefined);\n }\n\n const dragOverlayItem = useMemo(() => {\n if (!dragActiveId) return undefined;\n const items = getItems();\n const targetIndex = items.findIndex((item) => getUidValue(item) === dragActiveId);\n return formListOperationRef.current.find((item) => item.name === targetIndex);\n }, [dragActiveId, getItems, getUidValue]);\n\n const gapHalf = props.itemGap ? props.itemGap / 2 : 8;\n\n return (\n <BlockLayout className={classNames('drag-form-list', props.className)} style={props.style}>\n <DndContext collisionDetection={closestCenter} onDragStart={handleDragStart} onDragEnd={handleDragEnd}>\n <Form.List name={props.name} rules={props.rules}>\n {(fields, operation, { errors }) => {\n formListOperationRef.current = fields;\n return (\n <div\n style={{\n borderRadius: '6px',\n border: errors?.length ? '1px solid #ff4d4f' : '1px solid transparent',\n }}\n >\n {props.formListItemTitleList?.length ? (\n <FormListTitleRender\n formListItemTitleList={props.formListItemTitleList}\n formListItemTitleHProps={props.formListItemTitleHorizontalUnionProps}\n dragDisabled={props.dragDisabled}\n />\n ) : null}\n {!props.hiddenEmptyRender && !formListValue?.length ? (\n <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} style={{ margin: '15px 0' }} />\n ) : null}\n <FormListChildrenWrapper wrapper={props.formListChildrenWrapper}>\n <Fragment>\n <SortableContext\n items={getItems().map((temp) => getUidValue(temp))}\n strategy={verticalListSortingStrategy}\n >\n <Fragment>\n {fields.map((item, index) => {\n const uid = getUidValue(getItems()[index]);\n if (!uid) return null;\n return (\n <SortableItem\n formListOperate={operation}\n formListFieldData={item}\n uid={uid}\n key={`${uid}-${item.key}`}\n dragIcon={props.dragIcon}\n getItemDragDisabled={props.getItemDragDisabled}\n dragDisabled={props.dragDisabled}\n isGray={!!uid && uid === dragActiveId}\n index={index}\n formStageCompleteName={[...stageCompleteName, item.name]}\n prevCompleteName={stageCompleteName}\n uidFieldName={uidFieldName}\n style={{\n ...props.itemStyle,\n padding: `${gapHalf}px 0 ${gapHalf}px 0`,\n }}\n >\n {props.children}\n </SortableItem>\n );\n })}\n {props.onCustomAddRowButton ? (\n props.onCustomAddRowButton(operation)\n ) : (\n <ButtonWrapper\n hidden={props.hiddenAddRowButton}\n type=\"dashed\"\n block\n onClick={() =>\n operation.add({\n [uidFieldName]: getUuid(),\n ...props.getAddRowDefaultValues?.(),\n })\n }\n >\n 添加\n </ButtonWrapper>\n )}\n </Fragment>\n </SortableContext>\n <DragOverlay dropAnimation={{ duration: 0 }}>\n {dragActiveId && dragOverlayItem ? (\n <SortableItem\n isOverlay={true}\n uid={dragActiveId}\n key={dragActiveId}\n className=\"drag-form-list-overlay\"\n formListFieldData={dragOverlayItem}\n dragIcon={props.dragIcon}\n formListOperate={null as TAny}\n index={0}\n formStageCompleteName={[...stageCompleteName, dragOverlayItem.name]}\n prevCompleteName={stageCompleteName}\n uidFieldName={uidFieldName}\n >\n {props.children}\n </SortableItem>\n ) : null}\n </DragOverlay>\n <Form.ErrorList\n errors={\n errors\n ? [<div style={{ color: '#ff4d4f', padding: '5px' }}>{errors}</div>]\n : undefined\n }\n />\n </Fragment>\n </FormListChildrenWrapper>\n </div>\n );\n }}\n </Form.List>\n </DndContext>\n </BlockLayout>\n );\n};\n"],"names":["SortableItem","props","form","Form","useFormInstance","isDisabled","isOverlay","getItemDragDisabled","uid","index","_useSortable","useSortable","id","disabled","listeners","setNodeRef","transform","transition","dragIconRender","_hooks","useCallbackRef","dragIcon","_jsx","_DragOutlined","dragDisabled","Fragment","_extends","className","children","style","CSS","Transform","toString","cname","_classNames","isGray","_jsxs","ref","Item","noStyle","formListFieldData","operation","formListOperate","formStageCompleteName","getInsideFormItemName","key","name","getInsideFormItemData","getFieldValue","prevCompleteName","uidKey","uidFieldName","FormListChildrenWrapper","wrapper","FormListTitleRender","_props$formListItemTi","_props$formListItemTi2","_props$formListItemTi3","gap","formListItemTitleHProps","innerList","width","mainItem","marginRight","undefined","FormItemGroup","HorizontalUnion","marginBottom","groupConfigList","concat","formListItemTitleList","map","item","required","textAlign","TextSymbolWrapper","text","title","symbolType","DragFormList","stageCompleteName","toArray","_useState","useState","dragActiveId","setDragActiveId","formListOperationRef","useRef","formListValue","useWatch","getUidValue","handleDragStart","event","active","getItems","handleDragEnd","over","items","oldIndex","findIndex","newIndex","newList","arrayMove","setFields","value","onDropChange","dragOverlayItem","useMemo","targetIndex","current","find","gapHalf","itemGap","BlockLayout","DndContext","collisionDetection","closestCenter","onDragStart","onDragEnd","List","rules","fields","_ref","_props$formListItemTi4","errors","borderRadius","border","length","formListItemTitleHorizontalUnionProps","hiddenEmptyRender","Empty","image","PRESENTED_IMAGE_SIMPLE","margin","formListChildrenWrapper","SortableContext","temp","strategy","verticalListSortingStrategy","itemStyle","padding","onCustomAddRowButton","ButtonWrapper","hidden","hiddenAddRowButton","type","block","onClick","_extends2","add","getUuid","getAddRowDefaultValues","DragOverlay","dropAnimation","duration","ErrorList","color"],"mappings":";0hDAyBO,SAASA,EAAaC,GAC3B,IAAMC,EAAOC,EAAKC,kBAClB,IAAMC,EAAaJ,EAAMK,UACrB,MACAL,EAAMM,iCAANN,EAAMM,oBAAsBN,EAAMO,IAAKP,EAAMQ,OACjD,IAAAC,EAAyDC,EAAY,CACnEC,GAAIX,EAAMO,IACVK,SAAUR,IAFJS,EAASJ,EAATI,UAAWC,EAAUL,EAAVK,WAAYC,EAASN,EAATM,UAAWC,EAAUP,EAAVO,WAK1C,IAAMC,EAAiBC,EAAMC,gBAAe,WAC1C,IAAMC,EAAWpB,EAAMoB,SAAWpB,EAAMoB,SAAWC,EAAAC,MACnD,OAAOtB,EAAMuB,aACXF,EAACG,EAAQ,CAAA,GAETH,EAAA,OAAAI,EAAA,CAAMC,UAAU,+BAAkCb,EA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BAAsB,UAAA,EAA5BtJ,EAAMsJ,0BAEZ,EAAA3H,SACF,YAMPN,EAACkI,EAAW,CAACC,cAAe,CAAEC,SAAU,GAAI9H,SACzCwD,GAAgBsB,EACfpF,EAACtB,EAAY,CACXM,UAAW,KACXE,IAAK4E,EAELzD,UAAU,yBACVa,kBAAmBkE,EACnBrF,SAAUpB,EAAMoB,SAChBqB,gBAAiB,KACjBjC,MAAO,EACPkC,sBAAqB,GAAA0B,OAAMW,GAAmB0B,EAAgB5D,OAC9DG,iBAAkB+B,EAClB7B,aAAcA,EAAavB,SAE1B3B,EAAM2B,UAVFwD,GAYL,OAEN9D,EAACnB,EAAKwJ,UAAS,CACb/B,OACEA,EACI,CAACtG,EAAA,MAAA,CAAKO,MAAO,CAAE+H,MAAO,UAAWhB,QAAS,OAAQhH,SAAEgG,KACpD5D,mBAOlB,OAKV"}
|
package/esm/easy-table/index.js
CHANGED
|
@@ -15,5 +15,5 @@ import './../table-scrollbar/index.css';
|
|
|
15
15
|
import './../table-title-tooltip/index.css';
|
|
16
16
|
import './index.css';
|
|
17
17
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
18
|
-
import{fbaUtils as e}from"../fba-utils/index.js";import{classNames as t}from"@dimjs/utils/cjs/class-names";import{isUndefined as r}from"@dimjs/lang/cjs/is-undefined";import{isArray as i}from"@dimjs/lang/cjs/is-array";import{get as n}from"@dimjs/utils/cjs/get";import{_ as a,a as o}from"../_rollupPluginBabelHelpers-a0769acd.js";import{hooks as l}from"@wove/react/cjs/hooks";import{cloneState as s}from"@dimjs/model";import{Form as u,message as c,Table as d}from"antd";import{createContext as f,forwardRef as p,useState as m,useMemo as g,useRef as v,useImperativeHandle as y,useContext as h,Children as C,Fragment as S}from"react";import{P as b,S as j}from"../index-6677fbfc.js";import{noop as F,isUndefinedOrNull as q,getUuid as z,isMacEnv as x}from"@flatbiz/utils";import{Model as R}from"@dimjs/model-react";import{jsx as N,jsxs as w}from"react/jsx-runtime";import P from"@ant-design/icons/es/icons/DownOutlined";import k from"@ant-design/icons/es/icons/UpOutlined";import{isFragment as T}from"react-is";import{B as D}from"../index-1f45bfd5.js";import{ButtonWrapper as K}from"../button-wrapper/index.js";import{EasyForm as A}from"../easy-form/index.js";import{FormGrid as E}from"../form-grid/index.js";import{fbaHooks as V}from"../fba-hooks/index.js";import{TableScrollbar as B}from"../table-scrollbar/index.js";import{TableTitleTooltip as I}from"../table-title-tooltip/index.js";import{TipsWrapper as L}from"../tips-wrapper/index.js";import"@ant-design/icons/es/icons/LoadingOutlined";import"@dimjs/lang/cjs/is-promise";import"../index-7f4ad045.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"@dimjs/utils/cjs/extend";import"../box-grid/index.js";import"@dimjs/lang/cjs/is-number";import"ahooks";import"../form-wrapper/index.js";import"../pre-defined-class-name/index.js";import"../use-responsive-point-21b8c601.js";import"@ant-design/icons/es/icons/QuestionCircleOutlined";var O=f({onRequest:F,tableList:[],getEasyTableRef:function e(){}});var W={queryCondition:{},isInit:true};var _={actions:{updateFilterCondition:function e(t){return function(e){e.queryCondition=a({},e.queryCondition,t)}},resetFilterCondition:function e(t){return function(e){e.queryCondition=a({},W.queryCondition,t)}},updateInitStatus:function e(){return function(e){e.isInit=false}}},state:W};var H={};var U=function e(t){if(!H[t]){H[t]=R(_)}return H[t]};var G=p((function(e,o){var d;var f=m(),p=f[0],h=f[1];var C=m(0),S=C[0],j=C[1];var F=m(false),q=F[0],z=F[1];var x=l.useId(undefined,"easy-table-key");var R=g((function(){return e.cacheSwitch?location.pathname:x}),[x,e.cacheSwitch]);var P=U(R).useStore(),k=P[0],T=P[1];var D=e.pageSize||((d=e.initialPaginationParams)==null?void 0:d.pageSize)||10;var K=e.initRequest===undefined?true:e.initRequest;var A=m(false),E=A[0],V=A[1];var B=v();var I=v([]);var L=m(),W=L[0],_=L[1];var H=a({list:"list",total:"total",pageNo:"pageNo",pageSize:"pageSize"},e.fieldNames);var G=u.useForm(e.form),Q=G[0];var Y=l.useCallbackRef((function(t){return new Promise((function(r,a){var o,l,u,d,f,p,m,g,v,y,C,S;var b=function(){try{return r()}catch(e){return a(e)}};var F=function(t){try{z(false);if(e.onRequestErrorHandle){e.onRequestErrorHandle(t)}else{void c.error(t.message)}return b()}catch(e){return a(e)}};try{z(true);return Promise.resolve(T.updateFilterCondition(t)).then((function(t){try{o=t;l=s(o.queryCondition||{});u=e.serviceConfig,d=u.requestParamsAdapter,f=u.onRequest,p=u.requestResultAdapter,m=u.dynamicColumsAdapter;g=d?d(l):l;return Promise.resolve(f(g)).then((function(t){try{v=t||{};B.current=v;e.onDataSourceChange==null?void 0:e.onDataSourceChange(v);y=v;if(p){y=p(v)}if(m){C=m(v,I.current);_(C)}S=n(y,H.list);h(i(S)?S:[]);j(n(y,H.total));z(false);return b()}catch(e){return F(e)}}),F)}catch(e){return F(e)}}),F)}catch(e){F(e)}}))}));var $=l.useCallbackRef((function(e){return new Promise((function(t,r){return Promise.resolve(T.resetFilterCondition()).then((function(i){try{Q.resetFields();if(e){void T.updateFilterCondition(e);Q.setFieldsValue(e)}return t()}catch(e){return r(e)}}),r)}))}));var J=function e(t,r){if(E){var i;return i={},i[H.pageNo]=t,i[H.pageSize]=r||D,i}else{return{}}};var M=l.useCallbackRef((function(t){return new Promise((function(r,i){var n;n=a({},J(1,k.queryCondition[H.pageSize]),e.initialValues,t);return Promise.resolve(T.resetFilterCondition(n)).then((function(e){try{Q.resetFields();if(t){Q.setFieldsValue(t)}void Y(n);return r()}catch(e){return i(e)}}),i)}))}));var X=l.useCallbackRef((function(){return a({},k.queryCondition,Q.getFieldsValue())}));var Z=function t(){return{onRequest:Y,clearQueryCondition:$,getRequestParams:X,onResetRequest:M,form:Q,getDataSource:function e(){return B.current},onFilterDataSource:function e(t){h(t)},onClearDataSource:function e(){j(0);h([])},onUpdateDataSource:function t(r){h(r);B.current=r;e.onDataSourceChange==null?void 0:e.onDataSourceChange(r)}}};y(o,(function(){return Z()}));var ee=function e(t){V(t)};var te=function e(t){I.current=t};var re=function t(){var r=Q.getFieldsValue();if(e.onFormFinish){e.onFormFinish(a({},r,J(1,k.queryCondition[H.pageSize])))}else{void Y(a({},r,J(1,k.queryCondition[H.pageSize])))}};var ie=r(e.isFull)?true:e.isFull;var ne=t("fba-easy-table",{"fba-easy-table-full":ie,"fba-easy-table-filter-fixed":e.filterFixed,"fba-easy-table-pagination-fixed":e.paginationFixed},e.className);var ae=g((function(){return a({showSizeChanger:true,current:k.queryCondition[H.pageNo]||1,pageSize:k.queryCondition[H.pageSize]||D,total:S,showTotal:function e(t){return"共 "+t+" 条记录"}},e.pagination)}),[H.pageNo,H.pageSize,D,e.pagination,k.queryCondition,S]);var oe=l.useCallbackRef((function(t,r){var i,n;void Y((i={},i[H.pageSize]=r,i[H.pageNo]=t,i));(n=e.pagination)==null||n.onChange==null?void 0:n.onChange(t,r)}));var le=t("fba-easy-table-wrapper",{"fba-easy-table-wrapper-inline":e.isInline},e.className);var se=typeof e.children==="function"?e.children(B.current):e.children;return N(O.Provider,{value:{onSetBaseColumns:te,getEasyTableRef:Z,modelKey:R,onRequest:Y,tableDataSource:p,tableTotal:S,loading:q,fieldNames:H,pageSize:D,initRequest:K,initialValues:e.initialValues||{},onSetPaginationStatus:ee,paginationStatus:E,onFormFinish:re,form:Q,paginationFixed:e.paginationFixed||false,foldKeys:e.foldKeys||[],dynamicColumns:W},children:e.paginationFixed?w("div",{className:le,style:e.style,children:[N("div",{className:ne,children:se}),S>0&&N("div",{className:"fba-easy-table-pagination",children:N(b,a({size:"small"},ae,{onChange:oe}))})]}):N("div",{className:le,style:e.style,children:se})})}));var Q=function e(i){var n=h(O);var o=i.queryButtonProps,s=i.resetButtonProps,u=i.filterOperate,c=i.formClassName,d=c===void 0?"":c,f=i.defaultResetButtonTriggerRequest,p=i.filterWrapperStyle,v=i.filterWrapperClassName,y=i.rightOperateAreaAppendType,S=i.easyFormProps;var b=n.modelKey,j=n.foldKeys,F=n.fieldNames,q=n.onRequest,z=n.pageSize,x=n.paginationStatus,R=n.initialValues,V=n.form,B=n.onFormFinish;var I=typeof i.children==="function"?i.children(V):i.children;var L=y||"cover";var W=g((function(){if(T(I)){return C.toArray(I.props.children)}else{return C.toArray(I)}}),[I]);var _=m(false),H=_[0],G=_[1];var Q=U(b).useStore(),Y=Q[0],$=Q[1];var J=l.useCallbackRef((function(){return new Promise((function(e,t){var i;return Promise.resolve($.resetFilterCondition()).then((function(n){try{V.resetFields();if(r(f)||f){if(x){q(a((i={},i[F.pageNo]=1,i[F.pageSize]=z,i),R))}else{q(R)}}return e()}catch(e){return t(e)}}),t)}))}));var M=g((function(){var e=[!(o!=null&&o.hidden)?N(K,a({type:"primary",htmlType:"submit"},o,{children:(o==null?void 0:o.text)||"查询"}),"1"):null,!(s!=null&&s.hidden)?N(K,a({onClick:J},s,{children:(s==null?void 0:s.text)||"重置"}),"2"):null].filter(Boolean);var t=u==null?void 0:u(V);var r=t==null?void 0:t.rightList;var i=(t==null?void 0:t.leftList)||[];var n=e;if(r){if(L==="afterAppend"){n=[].concat(e,r)}else if(L==="beforeAppend"){n=[].concat(r,e)}else{n=r}}if(j.length>0){var l=N(K,{type:"link",style:{padding:"0"},onClick:function e(){G(!H)},children:H?w("span",{children:["收起",N(k,{style:{marginLeft:3,fontSize:12}})]}):w("span",{children:["展开",N(P,{style:{marginLeft:3,fontSize:12}})]})},"fold-trigger");if(n.length>0||i.length===0){n.push(l)}else if((i==null?void 0:i.length)>0){i.push(l)}}return W.map((function(e,t){if(!H&&j.find((function(t){return".$"+t===e.key})))return null;if(e.props["hidden"])return null;if(e.type["domTypeName"]==="FormCol")return e;return N(E.Col,{children:e},t)})).filter(Boolean).concat(N(E.OperateCol,a({},t,{leftList:i,rightList:n}),999))}),[W,u,j,V,J,H,o,s,L]);return N(D,{className:t("easy-table-filter",v),style:p,children:N(A,a({form:V,autoComplete:"off",onFinish:B,initialValues:a({},R,Y.queryCondition),className:d,style:i.formStyle,isPure:true,labelWidth:"80",labelAlign:"right",formItemGap:"15"},S,{children:i.isPure?I:N(E.Row,{gutter:[15,0],gridSize:i.formGridSize,children:M})}))})};var Y=function e(){var t=h(O);return t.getEasyTableRef()};var $=function e(){var t=h(O);return{current:t.getEasyTableRef()}};var J=["children","rowKey","pagination","isSync"],M=["tooltip","tipsWrapperProps","title"];var X=function e(r){var i=h(O);var n=r.children,l=r.rowKey,s=r.pagination,u=r.isSync,c=o(r,J);var f=i.modelKey,p=i.fieldNames,m=i.onRequest,v=i.tableDataSource,y=i.initRequest,C=i.pageSize,b=i.tableTotal,F=i.loading,R=i.initialValues,P=i.paginationFixed,k=i.onSetPaginationStatus,T=i.dynamicColumns;var K=U(f).useStore(),A=K[0],E=K[1];V.useEffectCustom((function(){i.onSetBaseColumns(r.columns||[])}),[r.columns]);var W=g((function(){if(P||s===false)return false;return a({showSizeChanger:true,current:A.queryCondition[p.pageNo]||1,pageSize:A.queryCondition[p.pageSize]||C,total:b,showTotal:function e(t){return"共 "+t+" 条记录"}},r.pagination,{selectComponentClass:j})}),[p.pageNo,p.pageSize,C,s,P,r.pagination,A.queryCondition,b]);var _=function e(t,i,n,a){if(a.action==="paginate"&&W){var o;m((o={},o[p.pageSize]=t.pageSize,o[p.pageNo]=t.current,o))}else{r.onChange==null?void 0:r.onChange(t,i,n,a)}};var H=g((function(){if(!v)return undefined;if(v.length===0){return[]}if(typeof l==="string"&&q(v[0][l])){return v.map((function(e){e[l]=z();return e}))}return v}),[v,l]);V.useEffectCustom((function(){var e=P||W!==false;k(e);if(y!==false||!A.isInit){if(e){var t;void m(a((t={},t[p.pageNo]=1,t[p.pageSize]=C,t),R,A.queryCondition))}else{void m(R)}}else{void E.updateFilterCondition(R)}void E.updateInitStatus()}),[]);var G=g((function(){var e=T?T:r.columns;return e.map((function(e){var t=e.tooltip,r=e.tipsWrapperProps,i=e.title,n=o(e,M);if(typeof i==="string"&&r){if(typeof r==="string"){return a({},n,{title:N(L,{tipType:"popover",popoverProps:{content:r},children:i})})}return a({},n,{title:N(L,a({},r,{children:i}))})}if(typeof i==="string"&&!!t){return a({},n,{title:N(I,{tooltip:t,title:i})})}return e}))}),[T,r.columns]);var Q=function e(){if(u&&!H){return w(S,{children:[n,N(d,{size:"small",scroll:{x:"max-content"},bordered:true,columns:G,rowKey:l,loading:true},"1")]})}if(x()){return w(S,{children:[n,N(d,a({size:"small",scroll:{x:"max-content"},bordered:true},c,{columns:G,pagination:W,rowKey:l,onChange:_,loading:F,dataSource:H}),"2")]})}return w(S,{children:[n,N(B,{children:N(d,a({size:"small",scroll:{x:"max-content"},bordered:true},c,{columns:G,pagination:W,rowKey:l,onChange:_,loading:F,dataSource:H}),"3")})]})};return N(D,{className:t("easy-table-table",{"ett-empty-show-small":r.emptyShowSize==="small"},r.tableWrapperClassName),style:r.tableWrapperStyle,children:Q()})};var Z=e.attachPropertiesToComponent(G,{Filter:Q,Table:X,useEasyTablRef:$,useEasyTable:Y});export{Z as EasyTable};
|
|
18
|
+
import{fbaUtils as e}from"../fba-utils/index.js";import{classNames as t}from"@dimjs/utils/cjs/class-names";import{isUndefined as r}from"@dimjs/lang/cjs/is-undefined";import{isArray as i}from"@dimjs/lang/cjs/is-array";import{get as n}from"@dimjs/utils/cjs/get";import{_ as a,a as o}from"../_rollupPluginBabelHelpers-a0769acd.js";import{hooks as l}from"@wove/react/cjs/hooks";import{cloneState as s}from"@dimjs/model";import{Form as u,message as c,Table as d}from"antd";import{createContext as f,forwardRef as p,useState as m,useMemo as g,useRef as v,useImperativeHandle as y,useContext as h,Children as C,Fragment as S}from"react";import{P as b,S as j}from"../index-6677fbfc.js";import{noop as F,isUndefinedOrNull as q,getUuid as z,isMacEnv as x}from"@flatbiz/utils";import{Model as w}from"@dimjs/model-react";import{jsx as R,jsxs as N}from"react/jsx-runtime";import P from"@ant-design/icons/es/icons/DownOutlined";import k from"@ant-design/icons/es/icons/UpOutlined";import{isFragment as T}from"react-is";import{B as D}from"../index-1f45bfd5.js";import{ButtonWrapper as K}from"../button-wrapper/index.js";import{EasyForm as A}from"../easy-form/index.js";import{FormGrid as E}from"../form-grid/index.js";import{fbaHooks as V}from"../fba-hooks/index.js";import{TableScrollbar as B}from"../table-scrollbar/index.js";import{TableTitleTooltip as I}from"../table-title-tooltip/index.js";import{TipsWrapper as L}from"../tips-wrapper/index.js";import"@ant-design/icons/es/icons/LoadingOutlined";import"@dimjs/lang/cjs/is-promise";import"../index-7f4ad045.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"@dimjs/utils/cjs/extend";import"../box-grid/index.js";import"@dimjs/lang/cjs/is-number";import"ahooks";import"../form-wrapper/index.js";import"../pre-defined-class-name/index.js";import"../use-responsive-point-21b8c601.js";import"@ant-design/icons/es/icons/QuestionCircleOutlined";var O=f({onRequest:F,tableList:[],getEasyTableRef:function e(){}});var W={queryCondition:{},isInit:true};var _={actions:{updateFilterCondition:function e(t){return function(e){e.queryCondition=a({},e.queryCondition,t)}},resetFilterCondition:function e(t){return function(e){e.queryCondition=a({},W.queryCondition,t)}},updateInitStatus:function e(){return function(e){e.isInit=false}}},state:W};var H={};var U=function e(t){if(!H[t]){H[t]=w(_)}return H[t]};var G=p((function(e,o){var d;var f=m(),p=f[0],h=f[1];var C=m(0),S=C[0],j=C[1];var F=m(false),q=F[0],z=F[1];var x=l.useId(undefined,"easy-table-key");var w=g((function(){if(e.cacheSwitch===true){return location.pathname}if(typeof e.cacheSwitch==="string"){return e.cacheSwitch}return x}),[x,e.cacheSwitch]);var P=U(w).useStore(),k=P[0],T=P[1];var D=e.pageSize||((d=e.initialPaginationParams)==null?void 0:d.pageSize)||10;var K=e.initRequest===undefined?true:e.initRequest;var A=m(false),E=A[0],V=A[1];var B=v();var I=v([]);var L=m(),W=L[0],_=L[1];var H=a({list:"list",total:"total",pageNo:"pageNo",pageSize:"pageSize"},e.fieldNames);var G=u.useForm(e.form),Q=G[0];var Y=l.useCallbackRef((function(t){return new Promise((function(r,a){var o,l,u,d,f,p,m,g,v,y,C,S;var b=function(){try{return r()}catch(e){return a(e)}};var F=function(t){try{z(false);if(e.onRequestErrorHandle){e.onRequestErrorHandle(t)}else{void c.error(t.message)}return b()}catch(e){return a(e)}};try{z(true);return Promise.resolve(T.updateFilterCondition(t)).then((function(t){try{o=t;l=s(o.queryCondition||{});u=e.serviceConfig,d=u.requestParamsAdapter,f=u.onRequest,p=u.requestResultAdapter,m=u.dynamicColumsAdapter;g=d?d(l):l;return Promise.resolve(f(g)).then((function(t){try{v=t||{};B.current=v;e.onDataSourceChange==null?void 0:e.onDataSourceChange(v);y=v;if(p){y=p(v)}if(m){C=m(v,I.current);_(C)}S=n(y,H.list);h(i(S)?S:[]);j(n(y,H.total));z(false);return b()}catch(e){return F(e)}}),F)}catch(e){return F(e)}}),F)}catch(e){F(e)}}))}));var $=l.useCallbackRef((function(e){return new Promise((function(t,r){return Promise.resolve(T.resetFilterCondition()).then((function(i){try{Q.resetFields();if(e){void T.updateFilterCondition(e);Q.setFieldsValue(e)}return t()}catch(e){return r(e)}}),r)}))}));var J=function e(t,r){if(E){var i;return i={},i[H.pageNo]=t,i[H.pageSize]=r||D,i}else{return{}}};var M=l.useCallbackRef((function(t){return new Promise((function(r,i){var n;n=a({},J(1,k.queryCondition[H.pageSize]),e.initialValues,t);return Promise.resolve(T.resetFilterCondition(n)).then((function(e){try{Q.resetFields();if(t){Q.setFieldsValue(t)}void Y(n);return r()}catch(e){return i(e)}}),i)}))}));var X=l.useCallbackRef((function(){return a({},k.queryCondition,Q.getFieldsValue())}));var Z=function t(){return{onRequest:Y,clearQueryCondition:$,getRequestParams:X,onResetRequest:M,form:Q,getDataSource:function e(){return B.current},onFilterDataSource:function e(t){h(t)},onClearDataSource:function e(){j(0);h([])},onUpdateDataSource:function t(r){h(r);B.current=r;e.onDataSourceChange==null?void 0:e.onDataSourceChange(r)}}};y(o,(function(){return Z()}));var ee=function e(t){V(t)};var te=function e(t){I.current=t};var re=function t(){var r=Q.getFieldsValue();if(e.onFormFinish){e.onFormFinish(a({},r,J(1,k.queryCondition[H.pageSize])))}else{void Y(a({},r,J(1,k.queryCondition[H.pageSize])))}};var ie=r(e.isFull)?true:e.isFull;var ne=t("fba-easy-table",{"fba-easy-table-full":ie,"fba-easy-table-filter-fixed":e.filterFixed,"fba-easy-table-pagination-fixed":e.paginationFixed},e.className);var ae=g((function(){return a({showSizeChanger:true,current:k.queryCondition[H.pageNo]||1,pageSize:k.queryCondition[H.pageSize]||D,total:S,showTotal:function e(t){return"共 "+t+" 条记录"}},e.pagination)}),[H.pageNo,H.pageSize,D,e.pagination,k.queryCondition,S]);var oe=l.useCallbackRef((function(t,r){var i,n;void Y((i={},i[H.pageSize]=r,i[H.pageNo]=t,i));(n=e.pagination)==null||n.onChange==null?void 0:n.onChange(t,r)}));var le=t("fba-easy-table-wrapper",{"fba-easy-table-wrapper-inline":e.isInline},e.className);var se=typeof e.children==="function"?e.children(B.current):e.children;return R(O.Provider,{value:{onSetBaseColumns:te,getEasyTableRef:Z,modelKey:w,onRequest:Y,tableDataSource:p,tableTotal:S,loading:q,fieldNames:H,pageSize:D,initRequest:K,initialValues:e.initialValues||{},onSetPaginationStatus:ee,paginationStatus:E,onFormFinish:re,form:Q,paginationFixed:e.paginationFixed||false,foldKeys:e.foldKeys||[],dynamicColumns:W},children:e.paginationFixed?N("div",{className:le,style:e.style,children:[R("div",{className:ne,children:se}),S>0&&R("div",{className:"fba-easy-table-pagination",children:R(b,a({size:"small"},ae,{onChange:oe}))})]}):R("div",{className:le,style:e.style,children:se})})}));var Q=function e(i){var n=h(O);var o=i.queryButtonProps,s=i.resetButtonProps,u=i.filterOperate,c=i.formClassName,d=c===void 0?"":c,f=i.defaultResetButtonTriggerRequest,p=i.filterWrapperStyle,v=i.filterWrapperClassName,y=i.rightOperateAreaAppendType,S=i.easyFormProps;var b=n.modelKey,j=n.foldKeys,F=n.fieldNames,q=n.onRequest,z=n.pageSize,x=n.paginationStatus,w=n.initialValues,V=n.form,B=n.onFormFinish;var I=typeof i.children==="function"?i.children(V):i.children;var L=y||"cover";var W=g((function(){if(T(I)){return C.toArray(I.props.children)}else{return C.toArray(I)}}),[I]);var _=m(false),H=_[0],G=_[1];var Q=U(b).useStore(),Y=Q[0],$=Q[1];var J=l.useCallbackRef((function(){return new Promise((function(e,t){var i;return Promise.resolve($.resetFilterCondition()).then((function(n){try{V.resetFields();if(r(f)||f){if(x){q(a((i={},i[F.pageNo]=1,i[F.pageSize]=z,i),w))}else{q(w)}}return e()}catch(e){return t(e)}}),t)}))}));var M=g((function(){var e=[!(o!=null&&o.hidden)?R(K,a({type:"primary",htmlType:"submit"},o,{children:(o==null?void 0:o.text)||"查询"}),"1"):null,!(s!=null&&s.hidden)?R(K,a({onClick:J},s,{children:(s==null?void 0:s.text)||"重置"}),"2"):null].filter(Boolean);var t=u==null?void 0:u(V);var r=t==null?void 0:t.rightList;var i=(t==null?void 0:t.leftList)||[];var n=e;if(r){if(L==="afterAppend"){n=[].concat(e,r)}else if(L==="beforeAppend"){n=[].concat(r,e)}else{n=r}}if(j.length>0){var l=R(K,{type:"link",style:{padding:"0"},onClick:function e(){G(!H)},children:H?N("span",{children:["收起",R(k,{style:{marginLeft:3,fontSize:12}})]}):N("span",{children:["展开",R(P,{style:{marginLeft:3,fontSize:12}})]})},"fold-trigger");if(n.length>0||i.length===0){n.push(l)}else if((i==null?void 0:i.length)>0){i.push(l)}}return W.map((function(e,t){if(!H&&j.find((function(t){return".$"+t===e.key})))return null;if(e.props["hidden"])return null;if(e.type["domTypeName"]==="FormCol")return e;return R(E.Col,{children:e},t)})).filter(Boolean).concat(R(E.OperateCol,a({},t,{leftList:i,rightList:n}),999))}),[W,u,j,V,J,H,o,s,L]);return R(D,{className:t("easy-table-filter",v),style:p,children:R(A,a({form:V,autoComplete:"off",onFinish:B,initialValues:a({},w,Y.queryCondition),className:d,style:i.formStyle,isPure:true,labelWidth:"80",labelAlign:"right",formItemGap:"15"},S,{children:i.isPure?I:R(E.Row,{gutter:[15,0],gridSize:i.formGridSize,children:M})}))})};var Y=function e(){var t=h(O);return t.getEasyTableRef()};var $=function e(){var t=h(O);return{current:t.getEasyTableRef()}};var J=["children","rowKey","pagination","isSync"],M=["tooltip","tipsWrapperProps","title"];var X=function e(r){var i=h(O);var n=r.children,l=r.rowKey,s=r.pagination,u=r.isSync,c=o(r,J);var f=i.modelKey,p=i.fieldNames,m=i.onRequest,v=i.tableDataSource,y=i.initRequest,C=i.pageSize,b=i.tableTotal,F=i.loading,w=i.initialValues,P=i.paginationFixed,k=i.onSetPaginationStatus,T=i.dynamicColumns;var K=U(f).useStore(),A=K[0],E=K[1];V.useEffectCustom((function(){i.onSetBaseColumns(r.columns||[])}),[r.columns]);var W=g((function(){if(P||s===false)return false;return a({showSizeChanger:true,current:A.queryCondition[p.pageNo]||1,pageSize:A.queryCondition[p.pageSize]||C,total:b,showTotal:function e(t){return"共 "+t+" 条记录"}},r.pagination,{selectComponentClass:j})}),[p.pageNo,p.pageSize,C,s,P,r.pagination,A.queryCondition,b]);var _=function e(t,i,n,a){if(a.action==="paginate"&&W){var o;m((o={},o[p.pageSize]=t.pageSize,o[p.pageNo]=t.current,o))}else{r.onChange==null?void 0:r.onChange(t,i,n,a)}};var H=g((function(){if(!v)return undefined;if(v.length===0){return[]}if(typeof l==="string"&&q(v[0][l])){return v.map((function(e){e[l]=z();return e}))}return v}),[v,l]);V.useEffectCustom((function(){var e=P||W!==false;k(e);if(y!==false||!A.isInit){if(e){var t;void m(a((t={},t[p.pageNo]=1,t[p.pageSize]=C,t),w,A.queryCondition))}else{void m(w)}}else{void E.updateFilterCondition(w)}void E.updateInitStatus()}),[]);var G=g((function(){var e=T?T:r.columns;return e.map((function(e){var t=e.tooltip,r=e.tipsWrapperProps,i=e.title,n=o(e,M);if(typeof i==="string"&&r){if(typeof r==="string"){return a({},n,{title:R(L,{tipType:"popover",popoverProps:{content:r},children:i})})}return a({},n,{title:R(L,a({},r,{children:i}))})}if(typeof i==="string"&&!!t){return a({},n,{title:R(I,{tooltip:t,title:i})})}return e}))}),[T,r.columns]);var Q=function e(){if(u&&!H){return N(S,{children:[n,R(d,{size:"small",scroll:{x:"max-content"},bordered:true,columns:G,rowKey:l,loading:true},"1")]})}if(x()){return N(S,{children:[n,R(d,a({size:"small",scroll:{x:"max-content"},bordered:true},c,{columns:G,pagination:W,rowKey:l,onChange:_,loading:F,dataSource:H}),"2")]})}return N(S,{children:[n,R(B,{children:R(d,a({size:"small",scroll:{x:"max-content"},bordered:true},c,{columns:G,pagination:W,rowKey:l,onChange:_,loading:F,dataSource:H}),"3")})]})};return R(D,{className:t("easy-table-table",{"ett-empty-show-small":r.emptyShowSize==="small"},r.tableWrapperClassName),style:r.tableWrapperStyle,children:Q()})};var Z=e.attachPropertiesToComponent(G,{Filter:Q,Table:X,useEasyTablRef:$,useEasyTable:Y});export{Z as EasyTable};
|
|
19
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/easy-table/context.ts","@flatbiz/antd/src/easy-table/model.ts","@flatbiz/antd/src/easy-table/easy-table.tsx","@flatbiz/antd/src/easy-table/filter.tsx","@flatbiz/antd/src/easy-table/hooks.ts","@flatbiz/antd/src/easy-table/table.tsx","@flatbiz/antd/src/easy-table/index.ts"],"sourcesContent":["import { noop, TPlainObject } from '@flatbiz/utils';\nimport { FormInstance } from 'antd';\nimport { createContext } from 'react';\nimport { EasyTableRefApi, TEasyTableTableColumn } from './type';\n\n// export const [useEasyTableCtx, EasyTableCtxProvider] = createCtx<{\n// modelKey: string;\n// onRequest: (params?: TPlainObject) => void;\n// tableList: TPlainObject[];\n// tableTotal: number;\n// loading?: boolean;\n// fieldNames: TPlainObject;\n// pageSize: number;\n// initRequest: boolean;\n// initialValues: TPlainObject;\n// onSetPaginationStatus: (status: boolean) => void;\n// paginationStatus: boolean;\n// onFormFinish?: (values?: TPlainObject) => void;\n// form: FormInstance;\n// getEasyTableRef: () => EasyTableRefApi;\n// paginationFixed: boolean;\n// foldKeys: string[];\n// }>();\n\nexport type EditableFieldContextContextApi = {\n modelKey: string;\n onRequest: (params?: TPlainObject) => void;\n tableDataSource?: TPlainObject[];\n tableTotal: number;\n loading?: boolean;\n fieldNames: TPlainObject;\n pageSize: number;\n initRequest: boolean;\n initialValues: TPlainObject;\n onSetPaginationStatus: (status: boolean) => void;\n paginationStatus: boolean;\n onFormFinish?: (values?: TPlainObject) => void;\n form: FormInstance;\n getEasyTableRef: () => EasyTableRefApi;\n paginationFixed: boolean;\n foldKeys: string[];\n dynamicColumns?: TEasyTableTableColumn<TPlainObject>[];\n onSetBaseColumns: (baseColumns?: TEasyTableTableColumn<TPlainObject>[]) => void;\n};\n\nexport const EasyTableContext = createContext<EditableFieldContextContextApi>({\n onRequest: noop,\n tableList: [],\n getEasyTableRef: () => {\n //\n },\n} as unknown as EditableFieldContextContextApi);\n","import { API, ModelType } from '@dimjs/model';\nimport { Model } from '@dimjs/model-react';\nimport { TAny, TPlainObject } from '@flatbiz/utils';\n\nexport type ModelState = {\n queryCondition: TPlainObject;\n isInit: boolean;\n};\n\ntype ModelActionParams = {\n updateFilterCondition?: Partial<ModelState['queryCondition']>;\n resetFilterCondition?: TPlainObject;\n updateInitStatus: void;\n};\n\nconst defaultState: ModelState = {\n queryCondition: {},\n isInit: true,\n};\n\nconst _EasyTableModel: ModelType<ModelState, ModelActionParams> = {\n actions: {\n updateFilterCondition: (params) => {\n return (state) => {\n state.queryCondition = {\n ...state.queryCondition,\n ...params,\n };\n };\n },\n resetFilterCondition: (params) => {\n return (state) => {\n state.queryCondition = {\n ...defaultState.queryCondition,\n ...params,\n };\n };\n },\n updateInitStatus: () => {\n return (state) => {\n state.isInit = false;\n };\n },\n },\n state: defaultState,\n};\n\nconst easyTableModels: Record<string, API<ModelType<ModelState, ModelActionParams, TAny>>> = {};\n\n/**\n * ```\n * 使用方式\n * const [state, actions] = selectorWrapperModel('key值').useStore();\n * ```\n */\nexport const easyTableModel = (key: string) => {\n if (!easyTableModels[key]) {\n easyTableModels[key] = Model(_EasyTableModel);\n }\n return easyTableModels[key];\n};\n","import { isArray, isUndefined } from '@dimjs/lang';\nimport { cloneState } from '@dimjs/model';\nimport { classNames, get } from '@dimjs/utils';\nimport { TAny, TPlainObject } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { Form, FormInstance, message, PaginationProps } from 'antd';\nimport {\n CSSProperties,\n forwardRef,\n ReactElement,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { PaginationWrapper } from '../pagination-wrapper';\nimport { EasyTableContext } from './context';\nimport { easyTableModel } from './model';\nimport './style.less';\nimport { EasyTableRefApi, TEasyTableTableColumn } from './type';\n\ntype EasyTableServiceConfig = {\n /** 接口配置 */\n onRequest: (params?: TPlainObject) => Promise<TPlainObject | TPlainObject[]>;\n /** 请求参数处理 */\n requestParamsAdapter?: (params: TPlainObject) => TPlainObject;\n /**\n * 接口相应数据处理\n * ```\n * 返回数据为对象,包含两个字段\n * 1. 表格列表数据 - Array\n * 2. 表格条数总数 - Number\n * 其中 字段key 命名会通过 fieldNames 进行转义\n * 例如:\n * fieldNames={{\n * list: 'aList',\n * total: 'aTotal',\n * }}\n * serviceConfig={{\n * url: '/v1/board/list',\n * requestResultAdapter: (respData) => {\n * return {\n * aList: respData.data.rows,\n * aTotal: respData.page.total,\n * };\n * },\n * }}\n * ```\n */\n requestResultAdapter?: (params: TAny) => TPlainObject;\n /**\n * 动态列自定义渲染\n * ```\n * 1. respData: 接口返回数据\n * 2. columns: Table columns配置项\n * ```\n *\n */\n dynamicColumsAdapter?: (\n respData?: TAny,\n columns?: TEasyTableTableColumn<TPlainObject>[],\n ) => TEasyTableTableColumn<TPlainObject>[] | undefined;\n};\n\nexport type EasyTableProps = {\n className?: string;\n style?: CSSProperties;\n children: ReactElement | ReactElement[] | ((dataSource?: TAny) => ReactElement);\n /**\n * EasyTable唯一值,可用于缓存查询条件\n * @deprecated 已过时,如果需要缓存数据请设置 cacheSwitch 参数\n */\n modelKey?: string;\n /**\n * 缓存查询条件开关,默认false\n * ```\n * 是否缓存表格查询条件,在路由跳转回来时,不会丢失\n * ```\n */\n cacheSwitch?: boolean;\n /** 接口数据配置 */\n serviceConfig: EasyTableServiceConfig;\n /**\n * 1. 查询条件Form initialValues\n * 2. 接口其他参数,例如常量类型\n */\n initialValues?: TPlainObject;\n /**\n * 分页初始化参数,默认值: pageSize = 10\n * @deprecated 已过时 4.3.0版本移除,使用 pageSize 赋值\n */\n initialPaginationParams?: { pageSize?: number };\n /** 分页单页条数,默认值:10 */\n pageSize?: number;\n /**\n * 字段映射,默认值:{ list:'list', total:'total', pageNo:'pageNo', pageSize:'pageSize' }\n * ```\n * 1. list、total用于解析接口响应数据,可以配置多级,例如:{ list: 'data.rows', total: 'page.total' }\n * 2. pageNo、pageSize用于接口分页入参Key定义,只能一级,例如:pageNo: 'page'\n * ```\n */\n fieldNames?: {\n list?: string;\n total?: string;\n pageNo?: string;\n pageSize?: string;\n };\n /** 初始化是否请求,默认值:true */\n initRequest?: boolean;\n /** 表格数据变更回调 */\n onDataSourceChange?: (dataSource: TAny) => void;\n /** 如果自定义查询按钮,可设置 Form onFinish */\n onFormFinish?: (values?: TPlainObject) => void;\n /** 在父节点高度下,上下铺满;默认值:true */\n isFull?: boolean;\n /** 查询条件固定,不随滚动条滚动 */\n filterFixed?: boolean;\n /** 分页区域固定,不随滚动条滚动 */\n paginationFixed?: boolean;\n /**\n * 1. 配合paginationFixed=true一起使用有效果\n * 2. 当使用Table内的pagination时,在EasyTable.Table中配置分页属性\n */\n pagination?: PaginationProps;\n /**\n * 查询条件展开、收起,被收起key数组;数组内容为EasyTable.Filter 子节点key值\n */\n foldKeys?: string[];\n /** 自定义处理服务异常 */\n onRequestErrorHandle?: (error) => void;\n /**\n * 是否inline模式\n * ```\n * 1. 缩短 EasyTable.Filter 与 EasyTable.Table 之间的距离\n * 2. 取消内边距\n * ```\n */\n isInline?: boolean;\n /** Form 实例 */\n form?: FormInstance;\n};\n\nexport const EasyTable = forwardRef<EasyTableRefApi, EasyTableProps>((props, ref) => {\n const [dataSource, setDataSource] = useState<TPlainObject[]>();\n const [total, setTotal] = useState<number>(0);\n const [loading, setLoading] = useState<boolean>(false);\n const easyTableId = hooks.useId(undefined, 'easy-table-key');\n\n const modelKey = useMemo(() => {\n return props.cacheSwitch ? location.pathname : easyTableId;\n }, [easyTableId, props.cacheSwitch]);\n\n const [state, actions] = easyTableModel(modelKey).useStore();\n const pageSize = props.pageSize || props.initialPaginationParams?.pageSize || 10;\n const initRequest = props.initRequest === undefined ? true : props.initRequest;\n const [paginationStatus, setPaginationStatus] = useState(false);\n const respOriginalDataRef = useRef<TAny>();\n const baseColumnsRef = useRef<TEasyTableTableColumn<TPlainObject>[]>([]);\n const [dynamicColumns, setDynamicColumns] = useState<TEasyTableTableColumn<TPlainObject>[]>();\n\n const fieldNames = {\n list: 'list',\n total: 'total',\n pageNo: 'pageNo',\n pageSize: 'pageSize',\n ...props.fieldNames,\n };\n\n const [form] = Form.useForm(props.form);\n\n const onInnerRequest = hooks.useCallbackRef(async (params) => {\n try {\n setLoading(true);\n const allState = await actions.updateFilterCondition(params);\n const queryCondition = cloneState(allState.queryCondition || {});\n const { requestParamsAdapter, onRequest, requestResultAdapter, dynamicColumsAdapter } =\n props.serviceConfig;\n const paramsNew = requestParamsAdapter ? requestParamsAdapter(queryCondition) : queryCondition;\n const respData = (await onRequest(paramsNew)) || {};\n respOriginalDataRef.current = respData;\n props.onDataSourceChange?.(respData);\n let respDataNew: TPlainObject = respData;\n if (requestResultAdapter) {\n respDataNew = requestResultAdapter(respData);\n }\n if (dynamicColumsAdapter) {\n const dynamicColumns = dynamicColumsAdapter(respData, baseColumnsRef.current);\n /** 不要添加默认值 */\n setDynamicColumns(dynamicColumns);\n }\n const respList = get(respDataNew, fieldNames.list);\n setDataSource(isArray(respList) ? respList : []);\n setTotal(get(respDataNew, fieldNames.total));\n setLoading(false);\n } catch (error) {\n setLoading(false);\n if (props.onRequestErrorHandle) {\n props.onRequestErrorHandle(error);\n } else {\n void message.error(error.message);\n }\n }\n });\n\n const clearQueryCondition = hooks.useCallbackRef(async (values?: TPlainObject) => {\n await actions.resetFilterCondition();\n form.resetFields();\n if (values) {\n void actions.updateFilterCondition(values);\n form.setFieldsValue(values);\n }\n });\n\n const getPaginationData = (pageNo: number, _pageSize: number) => {\n if (paginationStatus) {\n return {\n [fieldNames.pageNo]: pageNo,\n [fieldNames.pageSize]: _pageSize || pageSize,\n };\n } else {\n return {};\n }\n };\n\n const onResetRequest = hooks.useCallbackRef(async (values?: TPlainObject) => {\n const params = {\n ...getPaginationData(1, state.queryCondition[fieldNames.pageSize]),\n ...props.initialValues,\n ...values,\n };\n await actions.resetFilterCondition(params);\n form.resetFields();\n if (values) {\n form.setFieldsValue(values);\n }\n void onInnerRequest(params);\n });\n\n const getRequestParams = hooks.useCallbackRef(() => {\n return {\n ...state.queryCondition,\n ...form.getFieldsValue(),\n };\n });\n\n const getEasyTableRef = () => {\n return {\n /**\n * 参数\n * 1. 不用添加已存在的搜索条件\n * 2. 此处可重新\n */\n onRequest: onInnerRequest,\n clearQueryCondition,\n getRequestParams,\n onResetRequest,\n form,\n getDataSource: () => {\n return respOriginalDataRef.current;\n },\n onFilterDataSource: (filterDataSource) => {\n setDataSource(filterDataSource);\n },\n onClearDataSource: () => {\n setTotal(0);\n setDataSource([]);\n },\n onUpdateDataSource: (dataList) => {\n setDataSource(dataList);\n respOriginalDataRef.current = dataList;\n props.onDataSourceChange?.(dataList);\n },\n };\n };\n\n useImperativeHandle(ref, () => {\n return getEasyTableRef();\n });\n\n const onSetPaginationStatus = (status: boolean) => {\n setPaginationStatus(status);\n };\n const onSetBaseColumns = (base) => {\n baseColumnsRef.current = base;\n };\n\n const onFormFinish = () => {\n const values = form.getFieldsValue();\n if (props.onFormFinish) {\n props.onFormFinish({\n ...values,\n ...getPaginationData(1, state.queryCondition[fieldNames.pageSize]),\n });\n } else {\n void onInnerRequest({\n ...values,\n ...getPaginationData(1, state.queryCondition[fieldNames.pageSize]),\n });\n }\n };\n const isFull = isUndefined(props.isFull) ? true : props.isFull;\n const className = classNames(\n 'fba-easy-table',\n {\n 'fba-easy-table-full': isFull,\n 'fba-easy-table-filter-fixed': props.filterFixed,\n 'fba-easy-table-pagination-fixed': props.paginationFixed,\n },\n props.className,\n );\n\n const paginationData = useMemo(() => {\n return {\n showSizeChanger: true,\n current: state.queryCondition[fieldNames.pageNo] || 1,\n pageSize: state.queryCondition[fieldNames.pageSize] || pageSize,\n total: total,\n showTotal: (total) => `共 ${total} 条记录`,\n ...props.pagination,\n };\n }, [fieldNames.pageNo, fieldNames.pageSize, pageSize, props.pagination, state.queryCondition, total]);\n\n const onChange = hooks.useCallbackRef((page: number, pageSize: number) => {\n void onInnerRequest({\n [fieldNames.pageSize]: pageSize,\n [fieldNames.pageNo]: page,\n });\n props.pagination?.onChange?.(page, pageSize);\n });\n\n const wrapperClassName = classNames(\n 'fba-easy-table-wrapper',\n {\n 'fba-easy-table-wrapper-inline': props.isInline,\n },\n props.className,\n );\n\n const children =\n typeof props.children === 'function' ? props.children(respOriginalDataRef.current) : props.children;\n\n return (\n <EasyTableContext.Provider\n value={{\n onSetBaseColumns,\n getEasyTableRef,\n modelKey,\n onRequest: onInnerRequest,\n tableDataSource: dataSource,\n tableTotal: total,\n loading,\n fieldNames,\n pageSize,\n initRequest,\n initialValues: props.initialValues || {},\n onSetPaginationStatus,\n paginationStatus,\n onFormFinish,\n form,\n paginationFixed: props.paginationFixed || false,\n foldKeys: props.foldKeys || [],\n dynamicColumns,\n }}\n >\n {props.paginationFixed ? (\n <div className={wrapperClassName} style={props.style}>\n <div className={className}>{children}</div>\n {total > 0 && (\n <div className=\"fba-easy-table-pagination\">\n <PaginationWrapper size=\"small\" {...paginationData} onChange={onChange} />\n </div>\n )}\n </div>\n ) : (\n <div className={wrapperClassName} style={props.style}>\n {children}\n </div>\n )}\n </EasyTableContext.Provider>\n );\n});\n","import { DownOutlined, UpOutlined } from '@ant-design/icons';\nimport { isUndefined } from '@dimjs/lang';\nimport { classNames } from '@dimjs/utils';\nimport { TAny } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { FormInstance } from 'antd';\nimport { Children, CSSProperties, ReactElement, useContext, useMemo, useState } from 'react';\nimport { isFragment } from 'react-is';\nimport { BlockLayout } from '../block-layout';\nimport { ButtonWrapper, ButtonWrapperProps } from '../button-wrapper';\nimport { EasyForm, EasyFormProps } from '../easy-form';\nimport { FormGrid } from '../form-grid';\nimport { FormOperateColProps } from '../form-grid/form-operate-col';\nimport { FormRowProps } from '../form-grid/form-row';\nimport { EasyTableContext } from './context';\nimport { easyTableModel } from './model';\n\nexport type EasyTableFilterProps = {\n children: ReactElement | ReactElement[] | ((form: FormInstance) => ReactElement);\n /** isPure = true时无效 */\n filterOperate?: (form: FormInstance) => FormOperateColProps;\n /** 是否为纯净模式(查询条件布局是否自定义), */\n isPure?: boolean;\n /** 查询按钮配置 */\n queryButtonProps?: Omit<ButtonWrapperProps, 'onClick'> & { text?: string };\n /** 重置按钮配置 */\n resetButtonProps?: Omit<ButtonWrapperProps, 'onClick'> & { text?: string };\n /**\n * 网格布局设置\n * default = { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 6 };\n * small = { xs: 24, sm: 8, md: 8, lg: 6, xl: 6, xxl: 6 };\n */\n formGridSize?: FormRowProps['gridSize'];\n /**\n * @deprecated已过期,使用 easyFormProps.className 配置\n */\n formClassName?: string;\n /**\n * @deprecated已过期,使用 easyFormProps.style 配置\n */\n formStyle?: CSSProperties;\n /** filter Form 外层 BlockLayout style */\n filterWrapperStyle?: CSSProperties;\n /** filter Form 外层 BlockLayout className */\n filterWrapperClassName?: string;\n /**\n * 自定义 filterOperate.rightList 后 默认【查询、重置】按钮处理逻辑\n * 1. cover:覆盖内部查询重置按钮(默认值)\n * 2. beforeAppend:添加到【查询重置】按钮前面\n * 3. afterAppend:添加到【查询重置】按钮后面\n *\n * 如果想隐藏【查询、重置】按钮中的某一个,可设置 queryButtonProps.hidden、resetButtonProps.hidden\n */\n rightOperateAreaAppendType?: 'cover' | 'beforeAppend' | 'afterAppend';\n /** 默认重启按钮触发请求,默认值:true */\n defaultResetButtonTriggerRequest?: boolean;\n easyFormProps?: Omit<\n EasyFormProps,\n 'isPure' | 'column' | 'forceColumn' | 'width' | 'gridGutter' | 'children'\n >;\n};\n\n/**\n * 过滤条件\n *```\n * 1. 用法1\n * -- 默认网格布局 规则:{ xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 6 }\n * <EasyTableFilter>\n * <FormItemWrapper name=\"field1\" label=\"条件1\">xxx</FormItemWrapper>\n * </EasyTableFilter>\n *\n * -- 自定义网格布局 使用 FormCol组件包装 FormItemWrapper\n * <EasyTableFilter>\n * <FormCol span={12}><FormItemWrapper name=\"field1\" label=\"条件1\">xxx</FormItemWrapper></FormCol>\n * </EasyTableFilter>\n *\n * -- children 可为 function\n * <EasyTableFilter>\n * {(form) => {\n * return <FormItemWrapper name=\"field1\" label=\"条件1\">xxx</FormItemWrapper>\n * }}\n * </EasyTableFilter>\n *\n * 2. 用户2(自定义布局)\n * EasyTableFilter设置 isPure = true,FormItem无布局规则\n * 3. EasyTableFilter中内置了 Form 标签,当children为函数时,可获取form实例\n * 4. 默认布局下,可通过设置 filterOperate 设置操作按钮\n * 5. Filter 子节点包含 hidden = true 会被忽略\n * 6. 如果想隐藏【查询、重置】按钮中的某一个,可设置 queryButtonProps.hidden、resetButtonProps.hidden\n * 7. 通过设置 defaultResetButtonTriggerRequest,默认重启按钮触发请求,默认值:true\n * 8. EasyTableFilter 子节点可使用 FormItemWrapper,FormItemWrapper中可配置label宽度等\n *```\n */\nexport const EasyTableFilter = (props: EasyTableFilterProps) => {\n const ctx = useContext(EasyTableContext);\n const {\n queryButtonProps,\n resetButtonProps,\n filterOperate,\n formClassName = '',\n defaultResetButtonTriggerRequest,\n filterWrapperStyle,\n filterWrapperClassName,\n rightOperateAreaAppendType,\n easyFormProps,\n } = props;\n const {\n modelKey,\n foldKeys,\n fieldNames,\n onRequest,\n pageSize,\n paginationStatus,\n initialValues,\n form,\n onFormFinish,\n } = ctx;\n const children = typeof props.children === 'function' ? props.children(form) : props.children;\n\n const rightOperateAreaAppendTypeFt = rightOperateAreaAppendType || 'cover';\n const childrens = useMemo(() => {\n if (isFragment(children)) {\n return Children.toArray((children as ReactElement).props.children) as ReactElement[];\n } else {\n return Children.toArray(children) as ReactElement[];\n }\n }, [children]);\n\n const [openFold, setOpenFold] = useState(false);\n\n const [state, actions] = easyTableModel(modelKey).useStore();\n\n const onReset = hooks.useCallbackRef(async () => {\n await actions.resetFilterCondition();\n form.resetFields();\n if (isUndefined(defaultResetButtonTriggerRequest) || defaultResetButtonTriggerRequest) {\n if (paginationStatus) {\n onRequest({\n [fieldNames.pageNo]: 1,\n [fieldNames.pageSize]: pageSize,\n ...initialValues,\n });\n } else {\n onRequest(initialValues);\n }\n }\n });\n\n const formRowChildren = useMemo(() => {\n const defaultRightList = [\n !queryButtonProps?.hidden ? (\n <ButtonWrapper key=\"1\" type=\"primary\" htmlType=\"submit\" {...queryButtonProps}>\n {queryButtonProps?.text || '查询'}\n </ButtonWrapper>\n ) : null,\n !resetButtonProps?.hidden ? (\n <ButtonWrapper key=\"2\" onClick={onReset} {...resetButtonProps}>\n {resetButtonProps?.text || '重置'}\n </ButtonWrapper>\n ) : null,\n ].filter(Boolean);\n const customFormOperateCol = filterOperate?.(form);\n const customRightList = customFormOperateCol?.rightList;\n const leftList: TAny[] = customFormOperateCol?.leftList || [];\n\n let rightList: TAny[] = defaultRightList;\n if (customRightList) {\n if (rightOperateAreaAppendTypeFt === 'afterAppend') {\n rightList = [...defaultRightList, ...customRightList];\n } else if (rightOperateAreaAppendTypeFt === 'beforeAppend') {\n rightList = [...customRightList, ...defaultRightList];\n } else {\n rightList = customRightList;\n }\n }\n\n if (foldKeys.length > 0) {\n const changeFolditem = (\n <ButtonWrapper\n type=\"link\"\n key=\"fold-trigger\"\n style={{ padding: '0' }}\n onClick={() => {\n setOpenFold(!openFold);\n }}\n >\n {openFold ? (\n <span>\n 收起\n <UpOutlined style={{ marginLeft: 3, fontSize: 12 }} />\n </span>\n ) : (\n <span>\n 展开\n <DownOutlined style={{ marginLeft: 3, fontSize: 12 }} />\n </span>\n )}\n </ButtonWrapper>\n );\n\n if (rightList.length > 0 || leftList.length === 0) {\n rightList.push(changeFolditem);\n } else if (leftList?.length > 0) {\n leftList.push(changeFolditem);\n }\n }\n\n return childrens\n .map((item, index) => {\n if (!openFold && foldKeys.find((keyItem) => `.$${keyItem}` === item.key)) return null;\n if (item.props['hidden']) return null;\n if (item.type['domTypeName'] === 'FormCol') return item;\n return <FormGrid.Col key={index}>{item}</FormGrid.Col>;\n })\n .filter(Boolean)\n .concat(\n <FormGrid.OperateCol key={999} {...customFormOperateCol} leftList={leftList} rightList={rightList} />,\n );\n }, [\n childrens,\n filterOperate,\n foldKeys,\n form,\n onReset,\n openFold,\n queryButtonProps,\n resetButtonProps,\n rightOperateAreaAppendTypeFt,\n ]);\n\n return (\n <BlockLayout\n className={classNames('easy-table-filter', filterWrapperClassName)}\n style={filterWrapperStyle}\n >\n <EasyForm\n form={form}\n autoComplete=\"off\"\n onFinish={onFormFinish}\n initialValues={{\n ...initialValues,\n ...state.queryCondition,\n }}\n className={formClassName}\n style={props.formStyle}\n isPure={true}\n labelWidth=\"80\"\n labelAlign=\"right\"\n formItemGap=\"15\"\n {...easyFormProps}\n >\n {props.isPure ? (\n children\n ) : (\n <FormGrid.Row gutter={[15, 0]} gridSize={props.formGridSize}>\n {formRowChildren}\n </FormGrid.Row>\n )}\n </EasyForm>\n </BlockLayout>\n );\n};\n","import { useContext } from 'react';\nimport { EasyTableContext } from './context';\n\n/**\n * 在 EasyTable子组件内才可使用\n * @returns\n */\nexport const useEasyTable = () => {\n const ctx = useContext(EasyTableContext);\n return ctx.getEasyTableRef();\n};\n\n/**\n *\n * @deprecated 已过时 @4.3.0版本移除,请使用 useEasyTable\n * @returns\n */\nexport const useEasyTablRef = () => {\n const ctx = useContext(EasyTableContext);\n return {\n current: ctx.getEasyTableRef(),\n };\n};\n","import { classNames } from '@dimjs/utils';\nimport { getUuid, isMacEnv, isUndefinedOrNull, TAny, TPlainObject } from '@flatbiz/utils';\nimport { Table, TableProps } from 'antd';\nimport { CSSProperties, Fragment, ReactElement, useContext, useMemo } from 'react';\nimport { BlockLayout } from '../block-layout';\nimport { fbaHooks } from '../fba-hooks';\nimport { SmallSelect } from '../pagination-wrapper/select';\nimport { TableScrollbar } from '../table-scrollbar';\nimport { TableTitleTooltip } from '../table-title-tooltip';\nimport { TipsWrapper } from '../tips-wrapper';\nimport { EasyTableContext } from './context';\nimport { easyTableModel } from './model';\nimport { TEasyTableTableColumn } from './type';\n\nexport type EasyTableTableProps<T> = Omit<\n TableProps<TAny>,\n 'dataSource' | 'loading' | 'rowKey' | 'columns'\n> & {\n children?: ReactElement | ReactElement[];\n /**\n * 表格行 key 的取值,\n * ```\n * 如果 rowKey 为string类型\n * 1. 组件会判断表格列表数据第一条是否存在当前rowKey对象的数据,如果没有组件内部会动态添加唯一值\n * 2. 基于上一条的逻辑,如果表格数据没有唯一值,可指定 rowKey 值为table数据中不存在的字段名,例如:rowKey=\"_uid\"\n * 3. 如果触发上述逻辑,表格数据中会多出rowKey对应的键值对数据\n * ```\n */\n rowKey: TableProps<TAny>['rowKey'];\n /** table Form 外层 SimpleLayout className */\n tableWrapperStyle?: CSSProperties;\n /** table Form 外层 SimpleLayout className */\n tableWrapperClassName?: string;\n columns: TEasyTableTableColumn<T>[];\n /**\n * 数据加载与表格初始化渲染 是否同步\n * @version 4.4.6\n * ```\n * 1. true:获取数据后再初始化渲染表格(可用于实现表格中defaultXxxx相关功能的使用)\n * ```\n */\n isSync?: boolean;\n /**\n * 空效果显示尺寸,默认值:small\n * @version 4.4.6\n */\n emptyShowSize?: 'small' | 'large';\n};\n\n/**\n * 表格渲染\n * @param props\n * ```\n * 1. 继承了 TableProps 可设置antd table功能\n * 2. 分页功能已内置处理,不调用 onChange\n * ```\n */\nexport const EasyTableTable = <T extends TPlainObject>(props: EasyTableTableProps<T>) => {\n const ctx = useContext(EasyTableContext);\n const { children, rowKey, pagination, isSync, ...otherProps } = props;\n\n const {\n modelKey,\n fieldNames,\n onRequest,\n tableDataSource,\n initRequest,\n pageSize,\n tableTotal,\n loading,\n initialValues,\n paginationFixed,\n onSetPaginationStatus,\n dynamicColumns,\n } = ctx;\n const [state, actions] = easyTableModel(modelKey).useStore();\n\n fbaHooks.useEffectCustom(() => {\n ctx.onSetBaseColumns((props.columns || []) as TEasyTableTableColumn<TPlainObject>[]);\n }, [props.columns]);\n\n const tablePaginationData = useMemo(() => {\n if (paginationFixed || pagination === false) return false;\n return {\n showSizeChanger: true,\n current: state.queryCondition[fieldNames.pageNo] || 1,\n pageSize: state.queryCondition[fieldNames.pageSize] || pageSize,\n total: tableTotal,\n showTotal: (total) => `共 ${total} 条记录`,\n ...props.pagination,\n selectComponentClass: SmallSelect,\n };\n }, [\n fieldNames.pageNo,\n fieldNames.pageSize,\n pageSize,\n pagination,\n paginationFixed,\n props.pagination,\n state.queryCondition,\n tableTotal,\n ]);\n\n const onChangePage: TableProps<TAny>['onChange'] = (pagination, filters, sorter, extra) => {\n if (extra.action === 'paginate' && tablePaginationData) {\n onRequest({\n [fieldNames.pageSize]: pagination.pageSize,\n [fieldNames.pageNo]: pagination.current,\n });\n } else {\n props.onChange?.(pagination, filters, sorter, extra);\n }\n };\n\n const dataSource = useMemo(() => {\n if (!tableDataSource) return undefined;\n if (tableDataSource.length === 0) {\n return [];\n }\n if (typeof rowKey === 'string' && isUndefinedOrNull(tableDataSource[0][rowKey])) {\n return tableDataSource.map((item) => {\n item[rowKey] = getUuid();\n return item;\n });\n }\n return tableDataSource;\n }, [tableDataSource, rowKey]);\n\n fbaHooks.useEffectCustom(() => {\n const hasPagination = paginationFixed || tablePaginationData !== false;\n onSetPaginationStatus(hasPagination);\n if (initRequest !== false || !state.isInit) {\n if (hasPagination) {\n void onRequest({\n [fieldNames.pageNo]: 1,\n [fieldNames.pageSize]: pageSize,\n ...initialValues,\n ...state.queryCondition,\n });\n } else {\n void onRequest(initialValues);\n }\n } else {\n void actions.updateFilterCondition(initialValues);\n }\n void actions.updateInitStatus();\n }, []);\n\n const columns = useMemo(() => {\n const columns = dynamicColumns ? dynamicColumns : props.columns;\n\n return columns.map((item) => {\n const { tooltip, tipsWrapperProps, title, ...otherProps } = item;\n if (typeof title === 'string' && tipsWrapperProps) {\n if (typeof tipsWrapperProps === 'string') {\n return {\n ...otherProps,\n title: (\n <TipsWrapper tipType=\"popover\" popoverProps={{ content: tipsWrapperProps }}>\n {title}\n </TipsWrapper>\n ),\n };\n }\n return {\n ...otherProps,\n title: <TipsWrapper {...tipsWrapperProps}>{title}</TipsWrapper>,\n };\n }\n if (typeof title === 'string' && !!tooltip) {\n return {\n ...otherProps,\n title: <TableTitleTooltip tooltip={tooltip} title={title}></TableTitleTooltip>,\n };\n }\n return item;\n });\n }, [dynamicColumns, props.columns]);\n\n const tableRender = () => {\n if (isSync && !dataSource) {\n /** loading表格 */\n return (\n <Fragment>\n {children}\n <Table\n key=\"1\"\n size=\"small\"\n scroll={{ x: 'max-content' }}\n bordered\n columns={columns}\n rowKey={rowKey}\n loading={true}\n />\n </Fragment>\n );\n }\n if (isMacEnv()) {\n return (\n <Fragment>\n {children}\n <Table\n key=\"2\"\n size=\"small\"\n scroll={{ x: 'max-content' }}\n bordered\n {...otherProps}\n columns={columns}\n pagination={tablePaginationData}\n rowKey={rowKey}\n onChange={onChangePage}\n loading={loading}\n dataSource={dataSource}\n />\n </Fragment>\n );\n }\n return (\n <Fragment>\n {children}\n <TableScrollbar>\n <Table\n key=\"3\"\n size=\"small\"\n scroll={{ x: 'max-content' }}\n bordered\n {...otherProps}\n columns={columns}\n pagination={tablePaginationData}\n rowKey={rowKey}\n onChange={onChangePage}\n loading={loading}\n dataSource={dataSource}\n />\n </TableScrollbar>\n </Fragment>\n );\n };\n\n return (\n <BlockLayout\n className={classNames(\n 'easy-table-table',\n { 'ett-empty-show-small': props.emptyShowSize === 'small' },\n props.tableWrapperClassName,\n )}\n style={props.tableWrapperStyle}\n >\n {tableRender()}\n </BlockLayout>\n );\n};\n","import { fbaUtils } from '../fba-utils';\nimport { EasyTable as EasyTableInner } from './easy-table';\nimport { EasyTableFilter } from './filter';\nimport { useEasyTable, useEasyTablRef } from './hooks';\nimport { EasyTableTable } from './table';\n\n/**\n * 对 查询条件+表格数据 进行深度封装,内置数据交互处理\n * ```\n * Demo https://fex.qa.tcshuke.com/docs/admin/main/crud/easy-table\n *\n * 1. 废弃modelKey参数\n * 2. 如果需要在路由跳转回退中缓存查询条件,设置cacheSwitch=true\n * 3. 需要获取查询条件、主动发起请求等可通过ref、useEasyTable操作\n * 4. 可通过属性 initRequest 设置初始化是否请求数据\n * 5. 可通过属性 fieldNames 来设置自定义变量,默认值为:list、total、pageNo、pageSize\n * 6. isFull=true,设置【在父节点高度下,上下铺满】(默认值:true)\n * 7. filterFixed=true,设置查询条件固定,不随滚动条滚动\n * 8. paginationFixed=true,可设置分页条件在底部固定,不随滚动条滚动\n * 9. foldKeys=string[],查询条件展开、收起,被收起数组内容为EasyTable.Filter 子节点key值\n * 10. windows环境下,会在EasyTable.Table外部包装一下 TableScrollbar,提高windows下table左右滚动体验\n * ```\n */\nexport const EasyTable = fbaUtils.attachPropertiesToComponent(EasyTableInner, {\n /**\n * 过滤条件\n *```\n * 1. 用法1\n * -- 默认网格布局 规则:{ xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 6 }\n * <EasyTable.Filter>\n * <FormItemWrapper name=\"field1\" label=\"条件1\">xxx</FormItemWrapper>\n * </EasyTable.Filter>\n *\n * -- 自定义网格布局 使用 FormCol组件包装 FormItemWrapper\n * <EasyTable.Filter>\n * <FormCol span={12}><FormItemWrapper name=\"field1\" label=\"条件1\">xxx</FormItemWrapper></FormCol>\n * </EasyTable.Filter>\n *\n * -- children 可为 function\n * <EasyTable.Filter>\n * {(form) => {\n * return <FormItemWrapper name=\"field1\" label=\"条件1\">xxx</FormItemWrapper>\n * }}\n * </EasyTable.Filter>\n * 2. 用户2(自定义布局)\n * EasyTable.Filter设置 isPure = true,FormItem无布局规则\n * 3. EasyTable.Filter中内置了 Form 标签,当children为函数时,可获取form实例\n * 4. 默认布局下,可通过设置 filterOperate 设置操作按钮\n * 5. Filter 子节点包含 hidden = true 会被忽略\n * 6. 如果想隐藏【查询、重置】按钮中的某一个,可设置 queryButtonProps.hidden、resetButtonProps.hidden\n * 7. EasyTableFilter 子节点可使用 FormItemWrapper,FormItemWrapper中可配置label宽度等\n * 8. 通过easyFormProps属性可整体控制子节点FormItem布局\n *```\n */\n Filter: EasyTableFilter,\n /**\n * 表格渲染\n * @param props\n * ```\n * 1. 继承了 TableProps 可设置antd table功能\n * 2. 分页功能已内置处理,不调用 onChange\n * ```\n */\n Table: EasyTableTable,\n /**\n * @deprecated 已过时 4.3.0版本移除,请使用 useEasyTable\n */\n useEasyTablRef: useEasyTablRef,\n\n /** 在 EasyTable子组件内才可使用 */\n useEasyTable: useEasyTable,\n});\n"],"names":["EasyTableContext","createContext","onRequest","noop","tableList","getEasyTableRef","defaultState","queryCondition","isInit","_EasyTableModel","actions","updateFilterCondition","params","state","_extends","resetFilterCondition","updateInitStatus","easyTableModels","easyTableModel","key","Model","EasyTable","forwardRef","props","ref","_props$initialPaginat","_useState","useState","dataSource","setDataSource","_useState2","total","setTotal","_useState3","loading","setLoading","easyTableId","_hooks","useId","undefined","modelKey","useMemo","cacheSwitch","location","pathname","_easyTableModel$useSt","useStore","pageSize","initialPaginationParams","initRequest","_useState4","paginationStatus","setPaginationStatus","respOriginalDataRef","useRef","baseColumnsRef","_useState5","dynamicColumns","setDynamicColumns","fieldNames","list","pageNo","_Form$useForm","Form","useForm","form","onInnerRequest","useCallbackRef","Promise","$return","$error","allState","_props$serviceConfig","requestParamsAdapter","requestResultAdapter","dynamicColumsAdapter","paramsNew","_respData","respDataNew","_dynamicColumns","respList","$Try_1_Post","$boundEx","$Try_1_Catch","error","onRequestErrorHandle","message","resolve","then","$await_2","cloneState","serviceConfig","$await_3","respData","current","onDataSourceChange","_get","_isArray","clearQueryCondition","values","$await_4","resetFields","setFieldsValue","getPaginationData","_pageSize","_ref","onResetRequest","initialValues","$await_5","getRequestParams","getFieldsValue","getDataSource","onFilterDataSource","filterDataSource","onClearDataSource","onUpdateDataSource","dataList","useImperativeHandle","onSetPaginationStatus","status","onSetBaseColumns","base","onFormFinish","isFull","_isUndefined","className","_classNames","filterFixed","paginationFixed","paginationData","showSizeChanger","showTotal","pagination","onChange","page","_onInnerRequest","_props$pagination","wrapperClassName","isInline","children","_jsx","Provider","value","tableDataSource","tableTotal","foldKeys","_jsxs","style","PaginationWrapper","size","EasyTableFilter","ctx","useContext","queryButtonProps","resetButtonProps","filterOperate","_props$formClassName","formClassName","defaultResetButtonTriggerRequest","filterWrapperStyle","filterWrapperClassName","rightOperateAreaAppendType","easyFormProps","rightOperateAreaAppendTypeFt","childrens","isFragment","Children","toArray","openFold","setOpenFold","onReset","_extends2","$await_1","formRowChildren","defaultRightList","hidden","ButtonWrapper","type","htmlType","text","onClick","filter","Boolean","customFormOperateCol","customRightList","rightList","leftList","concat","length","changeFolditem","padding","_UpOutlined","marginLeft","fontSize","_DownOutlined","push","map","item","index","find","keyItem","FormGrid","Col","OperateCol","BlockLayout","EasyForm","autoComplete","onFinish","formStyle","isPure","labelWidth","labelAlign","formItemGap","Row","gutter","gridSize","formGridSize","useEasyTable","useEasyTablRef","EasyTableTable","rowKey","isSync","otherProps","_objectWithoutPropertiesLoose","_excluded","fbaHooks","useEffectCustom","columns","tablePaginationData","selectComponentClass","SmallSelect","onChangePage","filters","sorter","extra","action","_onRequest","isUndefinedOrNull","getUuid","hasPagination","tooltip","tipsWrapperProps","title","_excluded2","TipsWrapper","tipType","popoverProps","content","TableTitleTooltip","tableRender","Fragment","Table","scroll","x","bordered","isMacEnv","TableScrollbar","emptyShowSize","tableWrapperClassName","tableWrapperStyle","fbaUtils","attachPropertiesToComponent","EasyTableInner","Filter"],"mappings":";yoEA6CO,IAAMA,EAAmBC,EAA8C,CAC5EC,UAAWC,EACXC,UAAW,GACXC,gBAAiB,SAAAA,IACf,IClCJ,IAAMC,EAA2B,CAC/BC,eAAgB,CAAE,EAClBC,OAAQ,MAGV,IAAMC,EAA4D,CAChEC,QAAS,CACPC,sBAAuB,SAAAA,EAACC,GACtB,OAAO,SAACC,GACNA,EAAMN,eAAcO,EAAA,CAAA,EACfD,EAAMN,eACNK,GAGR,EACDG,qBAAsB,SAAAA,EAACH,GACrB,OAAO,SAACC,GACNA,EAAMN,eAAcO,EAAA,CAAA,EACfR,EAAaC,eACbK,GAGR,EACDI,iBAAkB,SAAAA,IAChB,OAAO,SAACH,GACNA,EAAML,OAAS,MAEnB,GAEFK,MAAOP,GAGT,IAAMW,EAAuF,CAAA,EAQtF,IAAMC,EAAiB,SAAjBA,EAAkBC,GAC7B,IAAKF,EAAgBE,GAAM,CACzBF,EAAgBE,GAAOC,EAAMX,EAC/B,CACA,OAAOQ,EAAgBE,EACzB,ECkFO,IAAME,EAAYC,GAA4C,SAACC,EAAOC,GAAQ,IAAAC,EACnF,IAAAC,EAAoCC,IAA7BC,EAAUF,EAAA,GAAEG,EAAaH,EAAA,GAChC,IAAAI,EAA0BH,EAAiB,GAApCI,E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.js","sources":["@flatbiz/antd/src/easy-table/context.ts","@flatbiz/antd/src/easy-table/model.ts","@flatbiz/antd/src/easy-table/easy-table.tsx","@flatbiz/antd/src/easy-table/filter.tsx","@flatbiz/antd/src/easy-table/hooks.ts","@flatbiz/antd/src/easy-table/table.tsx","@flatbiz/antd/src/easy-table/index.ts"],"sourcesContent":["import { noop, TPlainObject } from '@flatbiz/utils';\nimport { FormInstance } from 'antd';\nimport { createContext } from 'react';\nimport { EasyTableRefApi, TEasyTableTableColumn } from './type';\n\n// export const [useEasyTableCtx, EasyTableCtxProvider] = createCtx<{\n// modelKey: string;\n// onRequest: (params?: TPlainObject) => void;\n// tableList: TPlainObject[];\n// tableTotal: number;\n// loading?: boolean;\n// fieldNames: TPlainObject;\n// pageSize: number;\n// initRequest: boolean;\n// initialValues: TPlainObject;\n// onSetPaginationStatus: (status: boolean) => void;\n// paginationStatus: boolean;\n// onFormFinish?: (values?: TPlainObject) => void;\n// form: FormInstance;\n// getEasyTableRef: () => EasyTableRefApi;\n// paginationFixed: boolean;\n// foldKeys: string[];\n// }>();\n\nexport type EditableFieldContextContextApi = {\n modelKey: string;\n onRequest: (params?: TPlainObject) => void;\n tableDataSource?: TPlainObject[];\n tableTotal: number;\n loading?: boolean;\n fieldNames: TPlainObject;\n pageSize: number;\n initRequest: boolean;\n initialValues: TPlainObject;\n onSetPaginationStatus: (status: boolean) => void;\n paginationStatus: boolean;\n onFormFinish?: (values?: TPlainObject) => void;\n form: FormInstance;\n getEasyTableRef: () => EasyTableRefApi;\n paginationFixed: boolean;\n foldKeys: string[];\n dynamicColumns?: TEasyTableTableColumn<TPlainObject>[];\n onSetBaseColumns: (baseColumns?: TEasyTableTableColumn<TPlainObject>[]) => void;\n};\n\nexport const EasyTableContext = createContext<EditableFieldContextContextApi>({\n onRequest: noop,\n tableList: [],\n getEasyTableRef: () => {\n //\n },\n} as unknown as EditableFieldContextContextApi);\n","import { API, ModelType } from '@dimjs/model';\nimport { Model } from '@dimjs/model-react';\nimport { TAny, TPlainObject } from '@flatbiz/utils';\n\nexport type ModelState = {\n queryCondition: TPlainObject;\n isInit: boolean;\n};\n\ntype ModelActionParams = {\n updateFilterCondition?: Partial<ModelState['queryCondition']>;\n resetFilterCondition?: TPlainObject;\n updateInitStatus: void;\n};\n\nconst defaultState: ModelState = {\n queryCondition: {},\n isInit: true,\n};\n\nconst _EasyTableModel: ModelType<ModelState, ModelActionParams> = {\n actions: {\n updateFilterCondition: (params) => {\n return (state) => {\n state.queryCondition = {\n ...state.queryCondition,\n ...params,\n };\n };\n },\n resetFilterCondition: (params) => {\n return (state) => {\n state.queryCondition = {\n ...defaultState.queryCondition,\n ...params,\n };\n };\n },\n updateInitStatus: () => {\n return (state) => {\n state.isInit = false;\n };\n },\n },\n state: defaultState,\n};\n\nconst easyTableModels: Record<string, API<ModelType<ModelState, ModelActionParams, TAny>>> = {};\n\n/**\n * ```\n * 使用方式\n * const [state, actions] = selectorWrapperModel('key值').useStore();\n * ```\n */\nexport const easyTableModel = (key: string) => {\n if (!easyTableModels[key]) {\n easyTableModels[key] = Model(_EasyTableModel);\n }\n return easyTableModels[key];\n};\n","import { isArray, isUndefined } from '@dimjs/lang';\nimport { cloneState } from '@dimjs/model';\nimport { classNames, get } from '@dimjs/utils';\nimport { TAny, TPlainObject } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { Form, FormInstance, message, PaginationProps } from 'antd';\nimport {\n CSSProperties,\n forwardRef,\n ReactElement,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { PaginationWrapper } from '../pagination-wrapper';\nimport { EasyTableContext } from './context';\nimport { easyTableModel } from './model';\nimport './style.less';\nimport { EasyTableRefApi, TEasyTableTableColumn } from './type';\n\ntype EasyTableServiceConfig = {\n /** 接口配置 */\n onRequest: (params?: TPlainObject) => Promise<TPlainObject | TPlainObject[]>;\n /** 请求参数处理 */\n requestParamsAdapter?: (params: TPlainObject) => TPlainObject;\n /**\n * 接口相应数据处理\n * ```\n * 返回数据为对象,包含两个字段\n * 1. 表格列表数据 - Array\n * 2. 表格条数总数 - Number\n * 其中 字段key 命名会通过 fieldNames 进行转义\n * 例如:\n * fieldNames={{\n * list: 'aList',\n * total: 'aTotal',\n * }}\n * serviceConfig={{\n * url: '/v1/board/list',\n * requestResultAdapter: (respData) => {\n * return {\n * aList: respData.data.rows,\n * aTotal: respData.page.total,\n * };\n * },\n * }}\n * ```\n */\n requestResultAdapter?: (params: TAny) => TPlainObject;\n /**\n * 动态列自定义渲染\n * ```\n * 1. respData: 接口返回数据\n * 2. columns: Table columns配置项\n * ```\n *\n */\n dynamicColumsAdapter?: (\n respData?: TAny,\n columns?: TEasyTableTableColumn<TPlainObject>[],\n ) => TEasyTableTableColumn<TPlainObject>[] | undefined;\n};\n\nexport type EasyTableProps = {\n className?: string;\n style?: CSSProperties;\n children: ReactElement | ReactElement[] | ((dataSource?: TAny) => ReactElement);\n /**\n * EasyTable唯一值,可用于缓存查询条件\n * @deprecated 已过时,如果需要缓存数据请设置 cacheSwitch 参数\n */\n modelKey?: string;\n /**\n * 缓存查询条件开关,默认false\n * ```\n * 1. 是否缓存表格查询条件,在路由跳转回来时,不会丢失\n * 2. 如果一个页面有多个EasyTable,并需要缓存查询条件,可设置cacheSwitch为唯一字符串\n * ```\n */\n cacheSwitch?: boolean | string;\n /** 接口数据配置 */\n serviceConfig: EasyTableServiceConfig;\n /**\n * 1. 查询条件Form initialValues\n * 2. 接口其他参数,例如常量类型\n */\n initialValues?: TPlainObject;\n /**\n * 分页初始化参数,默认值: pageSize = 10\n * @deprecated 已过时 4.3.0版本移除,使用 pageSize 赋值\n */\n initialPaginationParams?: { pageSize?: number };\n /** 分页单页条数,默认值:10 */\n pageSize?: number;\n /**\n * 字段映射,默认值:{ list:'list', total:'total', pageNo:'pageNo', pageSize:'pageSize' }\n * ```\n * 1. list、total用于解析接口响应数据,可以配置多级,例如:{ list: 'data.rows', total: 'page.total' }\n * 2. pageNo、pageSize用于接口分页入参Key定义,只能一级,例如:pageNo: 'page'\n * ```\n */\n fieldNames?: {\n list?: string;\n total?: string;\n pageNo?: string;\n pageSize?: string;\n };\n /** 初始化是否请求,默认值:true */\n initRequest?: boolean;\n /** 表格数据变更回调 */\n onDataSourceChange?: (dataSource: TAny) => void;\n /** 如果自定义查询按钮,可设置 Form onFinish */\n onFormFinish?: (values?: TPlainObject) => void;\n /** 在父节点高度下,上下铺满;默认值:true */\n isFull?: boolean;\n /** 查询条件固定,不随滚动条滚动 */\n filterFixed?: boolean;\n /** 分页区域固定,不随滚动条滚动 */\n paginationFixed?: boolean;\n /**\n * 1. 配合paginationFixed=true一起使用有效果\n * 2. 当使用Table内的pagination时,在EasyTable.Table中配置分页属性\n */\n pagination?: PaginationProps;\n /**\n * 查询条件展开、收起,被收起key数组;数组内容为EasyTable.Filter 子节点key值\n */\n foldKeys?: string[];\n /** 自定义处理服务异常 */\n onRequestErrorHandle?: (error) => void;\n /**\n * 是否inline模式\n * ```\n * 1. 缩短 EasyTable.Filter 与 EasyTable.Table 之间的距离\n * 2. 取消内边距\n * ```\n */\n isInline?: boolean;\n /** Form 实例 */\n form?: FormInstance;\n};\n\nexport const EasyTable = forwardRef<EasyTableRefApi, EasyTableProps>((props, ref) => {\n const [dataSource, setDataSource] = useState<TPlainObject[]>();\n const [total, setTotal] = useState<number>(0);\n const [loading, setLoading] = useState<boolean>(false);\n const easyTableId = hooks.useId(undefined, 'easy-table-key');\n\n const modelKey = useMemo(() => {\n if (props.cacheSwitch === true) {\n return location.pathname;\n }\n if (typeof props.cacheSwitch === 'string') {\n return props.cacheSwitch;\n }\n return easyTableId;\n }, [easyTableId, props.cacheSwitch]);\n\n const [state, actions] = easyTableModel(modelKey).useStore();\n const pageSize = props.pageSize || props.initialPaginationParams?.pageSize || 10;\n const initRequest = props.initRequest === undefined ? true : props.initRequest;\n const [paginationStatus, setPaginationStatus] = useState(false);\n const respOriginalDataRef = useRef<TAny>();\n const baseColumnsRef = useRef<TEasyTableTableColumn<TPlainObject>[]>([]);\n const [dynamicColumns, setDynamicColumns] = useState<TEasyTableTableColumn<TPlainObject>[]>();\n\n const fieldNames = {\n list: 'list',\n total: 'total',\n pageNo: 'pageNo',\n pageSize: 'pageSize',\n ...props.fieldNames,\n };\n\n const [form] = Form.useForm(props.form);\n\n const onInnerRequest = hooks.useCallbackRef(async (params) => {\n try {\n setLoading(true);\n const allState = await actions.updateFilterCondition(params);\n const queryCondition = cloneState(allState.queryCondition || {});\n const { requestParamsAdapter, onRequest, requestResultAdapter, dynamicColumsAdapter } =\n props.serviceConfig;\n const paramsNew = requestParamsAdapter ? requestParamsAdapter(queryCondition) : queryCondition;\n const respData = (await onRequest(paramsNew)) || {};\n respOriginalDataRef.current = respData;\n props.onDataSourceChange?.(respData);\n let respDataNew: TPlainObject = respData;\n if (requestResultAdapter) {\n respDataNew = requestResultAdapter(respData);\n }\n if (dynamicColumsAdapter) {\n const dynamicColumns = dynamicColumsAdapter(respData, baseColumnsRef.current);\n /** 不要添加默认值 */\n setDynamicColumns(dynamicColumns);\n }\n const respList = get(respDataNew, fieldNames.list);\n setDataSource(isArray(respList) ? respList : []);\n setTotal(get(respDataNew, fieldNames.total));\n setLoading(false);\n } catch (error) {\n setLoading(false);\n if (props.onRequestErrorHandle) {\n props.onRequestErrorHandle(error);\n } else {\n void message.error(error.message);\n }\n }\n });\n\n const clearQueryCondition = hooks.useCallbackRef(async (values?: TPlainObject) => {\n await actions.resetFilterCondition();\n form.resetFields();\n if (values) {\n void actions.updateFilterCondition(values);\n form.setFieldsValue(values);\n }\n });\n\n const getPaginationData = (pageNo: number, _pageSize: number) => {\n if (paginationStatus) {\n return {\n [fieldNames.pageNo]: pageNo,\n [fieldNames.pageSize]: _pageSize || pageSize,\n };\n } else {\n return {};\n }\n };\n\n const onResetRequest = hooks.useCallbackRef(async (values?: TPlainObject) => {\n const params = {\n ...getPaginationData(1, state.queryCondition[fieldNames.pageSize]),\n ...props.initialValues,\n ...values,\n };\n await actions.resetFilterCondition(params);\n form.resetFields();\n if (values) {\n form.setFieldsValue(values);\n }\n void onInnerRequest(params);\n });\n\n const getRequestParams = hooks.useCallbackRef(() => {\n return {\n ...state.queryCondition,\n ...form.getFieldsValue(),\n };\n });\n\n const getEasyTableRef = () => {\n return {\n /**\n * 参数\n * 1. 不用添加已存在的搜索条件\n * 2. 此处可重新\n */\n onRequest: onInnerRequest,\n clearQueryCondition,\n getRequestParams,\n onResetRequest,\n form,\n getDataSource: () => {\n return respOriginalDataRef.current;\n },\n onFilterDataSource: (filterDataSource) => {\n setDataSource(filterDataSource);\n },\n onClearDataSource: () => {\n setTotal(0);\n setDataSource([]);\n },\n onUpdateDataSource: (dataList) => {\n setDataSource(dataList);\n respOriginalDataRef.current = dataList;\n props.onDataSourceChange?.(dataList);\n },\n };\n };\n\n useImperativeHandle(ref, () => {\n return getEasyTableRef();\n });\n\n const onSetPaginationStatus = (status: boolean) => {\n setPaginationStatus(status);\n };\n const onSetBaseColumns = (base) => {\n baseColumnsRef.current = base;\n };\n\n const onFormFinish = () => {\n const values = form.getFieldsValue();\n if (props.onFormFinish) {\n props.onFormFinish({\n ...values,\n ...getPaginationData(1, state.queryCondition[fieldNames.pageSize]),\n });\n } else {\n void onInnerRequest({\n ...values,\n ...getPaginationData(1, state.queryCondition[fieldNames.pageSize]),\n });\n }\n };\n const isFull = isUndefined(props.isFull) ? true : props.isFull;\n const className = classNames(\n 'fba-easy-table',\n {\n 'fba-easy-table-full': isFull,\n 'fba-easy-table-filter-fixed': props.filterFixed,\n 'fba-easy-table-pagination-fixed': props.paginationFixed,\n },\n props.className,\n );\n\n const paginationData = useMemo(() => {\n return {\n showSizeChanger: true,\n current: state.queryCondition[fieldNames.pageNo] || 1,\n pageSize: state.queryCondition[fieldNames.pageSize] || pageSize,\n total: total,\n showTotal: (total) => `共 ${total} 条记录`,\n ...props.pagination,\n };\n }, [fieldNames.pageNo, fieldNames.pageSize, pageSize, props.pagination, state.queryCondition, total]);\n\n const onChange = hooks.useCallbackRef((page: number, pageSize: number) => {\n void onInnerRequest({\n [fieldNames.pageSize]: pageSize,\n [fieldNames.pageNo]: page,\n });\n props.pagination?.onChange?.(page, pageSize);\n });\n\n const wrapperClassName = classNames(\n 'fba-easy-table-wrapper',\n {\n 'fba-easy-table-wrapper-inline': props.isInline,\n },\n props.className,\n );\n\n const children =\n typeof props.children === 'function' ? props.children(respOriginalDataRef.current) : props.children;\n\n return (\n <EasyTableContext.Provider\n value={{\n onSetBaseColumns,\n getEasyTableRef,\n modelKey,\n onRequest: onInnerRequest,\n tableDataSource: dataSource,\n tableTotal: total,\n loading,\n fieldNames,\n pageSize,\n initRequest,\n initialValues: props.initialValues || {},\n onSetPaginationStatus,\n paginationStatus,\n onFormFinish,\n form,\n paginationFixed: props.paginationFixed || false,\n foldKeys: props.foldKeys || [],\n dynamicColumns,\n }}\n >\n {props.paginationFixed ? (\n <div className={wrapperClassName} style={props.style}>\n <div className={className}>{children}</div>\n {total > 0 && (\n <div className=\"fba-easy-table-pagination\">\n <PaginationWrapper size=\"small\" {...paginationData} onChange={onChange} />\n </div>\n )}\n </div>\n ) : (\n <div className={wrapperClassName} style={props.style}>\n {children}\n </div>\n )}\n </EasyTableContext.Provider>\n );\n});\n","import { DownOutlined, UpOutlined } from '@ant-design/icons';\nimport { isUndefined } from '@dimjs/lang';\nimport { classNames } from '@dimjs/utils';\nimport { TAny } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { FormInstance } from 'antd';\nimport { Children, CSSProperties, ReactElement, useContext, useMemo, useState } from 'react';\nimport { isFragment } from 'react-is';\nimport { BlockLayout } from '../block-layout';\nimport { ButtonWrapper, ButtonWrapperProps } from '../button-wrapper';\nimport { EasyForm, EasyFormProps } from '../easy-form';\nimport { FormGrid } from '../form-grid';\nimport { FormOperateColProps } from '../form-grid/form-operate-col';\nimport { FormRowProps } from '../form-grid/form-row';\nimport { EasyTableContext } from './context';\nimport { easyTableModel } from './model';\n\nexport type EasyTableFilterProps = {\n children: ReactElement | ReactElement[] | ((form: FormInstance) => ReactElement);\n /** isPure = true时无效 */\n filterOperate?: (form: FormInstance) => FormOperateColProps;\n /** 是否为纯净模式(查询条件布局是否自定义), */\n isPure?: boolean;\n /** 查询按钮配置 */\n queryButtonProps?: Omit<ButtonWrapperProps, 'onClick'> & { text?: string };\n /** 重置按钮配置 */\n resetButtonProps?: Omit<ButtonWrapperProps, 'onClick'> & { text?: string };\n /**\n * 网格布局设置\n * default = { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 6 };\n * small = { xs: 24, sm: 8, md: 8, lg: 6, xl: 6, xxl: 6 };\n */\n formGridSize?: FormRowProps['gridSize'];\n /**\n * @deprecated已过期,使用 easyFormProps.className 配置\n */\n formClassName?: string;\n /**\n * @deprecated已过期,使用 easyFormProps.style 配置\n */\n formStyle?: CSSProperties;\n /** filter Form 外层 BlockLayout style */\n filterWrapperStyle?: CSSProperties;\n /** filter Form 外层 BlockLayout className */\n filterWrapperClassName?: string;\n /**\n * 自定义 filterOperate.rightList 后 默认【查询、重置】按钮处理逻辑\n * 1. cover:覆盖内部查询重置按钮(默认值)\n * 2. beforeAppend:添加到【查询重置】按钮前面\n * 3. afterAppend:添加到【查询重置】按钮后面\n *\n * 如果想隐藏【查询、重置】按钮中的某一个,可设置 queryButtonProps.hidden、resetButtonProps.hidden\n */\n rightOperateAreaAppendType?: 'cover' | 'beforeAppend' | 'afterAppend';\n /** 默认重启按钮触发请求,默认值:true */\n defaultResetButtonTriggerRequest?: boolean;\n easyFormProps?: Omit<\n EasyFormProps,\n 'isPure' | 'column' | 'forceColumn' | 'width' | 'gridGutter' | 'children'\n >;\n};\n\n/**\n * 过滤条件\n *```\n * 1. 用法1\n * -- 默认网格布局 规则:{ xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 6 }\n * <EasyTableFilter>\n * <FormItemWrapper name=\"field1\" label=\"条件1\">xxx</FormItemWrapper>\n * </EasyTableFilter>\n *\n * -- 自定义网格布局 使用 FormCol组件包装 FormItemWrapper\n * <EasyTableFilter>\n * <FormCol span={12}><FormItemWrapper name=\"field1\" label=\"条件1\">xxx</FormItemWrapper></FormCol>\n * </EasyTableFilter>\n *\n * -- children 可为 function\n * <EasyTableFilter>\n * {(form) => {\n * return <FormItemWrapper name=\"field1\" label=\"条件1\">xxx</FormItemWrapper>\n * }}\n * </EasyTableFilter>\n *\n * 2. 用户2(自定义布局)\n * EasyTableFilter设置 isPure = true,FormItem无布局规则\n * 3. EasyTableFilter中内置了 Form 标签,当children为函数时,可获取form实例\n * 4. 默认布局下,可通过设置 filterOperate 设置操作按钮\n * 5. Filter 子节点包含 hidden = true 会被忽略\n * 6. 如果想隐藏【查询、重置】按钮中的某一个,可设置 queryButtonProps.hidden、resetButtonProps.hidden\n * 7. 通过设置 defaultResetButtonTriggerRequest,默认重启按钮触发请求,默认值:true\n * 8. EasyTableFilter 子节点可使用 FormItemWrapper,FormItemWrapper中可配置label宽度等\n *```\n */\nexport const EasyTableFilter = (props: EasyTableFilterProps) => {\n const ctx = useContext(EasyTableContext);\n const {\n queryButtonProps,\n resetButtonProps,\n filterOperate,\n formClassName = '',\n defaultResetButtonTriggerRequest,\n filterWrapperStyle,\n filterWrapperClassName,\n rightOperateAreaAppendType,\n easyFormProps,\n } = props;\n const {\n modelKey,\n foldKeys,\n fieldNames,\n onRequest,\n pageSize,\n paginationStatus,\n initialValues,\n form,\n onFormFinish,\n } = ctx;\n const children = typeof props.children === 'function' ? props.children(form) : props.children;\n\n const rightOperateAreaAppendTypeFt = rightOperateAreaAppendType || 'cover';\n const childrens = useMemo(() => {\n if (isFragment(children)) {\n return Children.toArray((children as ReactElement).props.children) as ReactElement[];\n } else {\n return Children.toArray(children) as ReactElement[];\n }\n }, [children]);\n\n const [openFold, setOpenFold] = useState(false);\n\n const [state, actions] = easyTableModel(modelKey).useStore();\n\n const onReset = hooks.useCallbackRef(async () => {\n await actions.resetFilterCondition();\n form.resetFields();\n if (isUndefined(defaultResetButtonTriggerRequest) || defaultResetButtonTriggerRequest) {\n if (paginationStatus) {\n onRequest({\n [fieldNames.pageNo]: 1,\n [fieldNames.pageSize]: pageSize,\n ...initialValues,\n });\n } else {\n onRequest(initialValues);\n }\n }\n });\n\n const formRowChildren = useMemo(() => {\n const defaultRightList = [\n !queryButtonProps?.hidden ? (\n <ButtonWrapper key=\"1\" type=\"primary\" htmlType=\"submit\" {...queryButtonProps}>\n {queryButtonProps?.text || '查询'}\n </ButtonWrapper>\n ) : null,\n !resetButtonProps?.hidden ? (\n <ButtonWrapper key=\"2\" onClick={onReset} {...resetButtonProps}>\n {resetButtonProps?.text || '重置'}\n </ButtonWrapper>\n ) : null,\n ].filter(Boolean);\n const customFormOperateCol = filterOperate?.(form);\n const customRightList = customFormOperateCol?.rightList;\n const leftList: TAny[] = customFormOperateCol?.leftList || [];\n\n let rightList: TAny[] = defaultRightList;\n if (customRightList) {\n if (rightOperateAreaAppendTypeFt === 'afterAppend') {\n rightList = [...defaultRightList, ...customRightList];\n } else if (rightOperateAreaAppendTypeFt === 'beforeAppend') {\n rightList = [...customRightList, ...defaultRightList];\n } else {\n rightList = customRightList;\n }\n }\n\n if (foldKeys.length > 0) {\n const changeFolditem = (\n <ButtonWrapper\n type=\"link\"\n key=\"fold-trigger\"\n style={{ padding: '0' }}\n onClick={() => {\n setOpenFold(!openFold);\n }}\n >\n {openFold ? (\n <span>\n 收起\n <UpOutlined style={{ marginLeft: 3, fontSize: 12 }} />\n </span>\n ) : (\n <span>\n 展开\n <DownOutlined style={{ marginLeft: 3, fontSize: 12 }} />\n </span>\n )}\n </ButtonWrapper>\n );\n\n if (rightList.length > 0 || leftList.length === 0) {\n rightList.push(changeFolditem);\n } else if (leftList?.length > 0) {\n leftList.push(changeFolditem);\n }\n }\n\n return childrens\n .map((item, index) => {\n if (!openFold && foldKeys.find((keyItem) => `.$${keyItem}` === item.key)) return null;\n if (item.props['hidden']) return null;\n if (item.type['domTypeName'] === 'FormCol') return item;\n return <FormGrid.Col key={index}>{item}</FormGrid.Col>;\n })\n .filter(Boolean)\n .concat(\n <FormGrid.OperateCol key={999} {...customFormOperateCol} leftList={leftList} rightList={rightList} />,\n );\n }, [\n childrens,\n filterOperate,\n foldKeys,\n form,\n onReset,\n openFold,\n queryButtonProps,\n resetButtonProps,\n rightOperateAreaAppendTypeFt,\n ]);\n\n return (\n <BlockLayout\n className={classNames('easy-table-filter', filterWrapperClassName)}\n style={filterWrapperStyle}\n >\n <EasyForm\n form={form}\n autoComplete=\"off\"\n onFinish={onFormFinish}\n initialValues={{\n ...initialValues,\n ...state.queryCondition,\n }}\n className={formClassName}\n style={props.formStyle}\n isPure={true}\n labelWidth=\"80\"\n labelAlign=\"right\"\n formItemGap=\"15\"\n {...easyFormProps}\n >\n {props.isPure ? (\n children\n ) : (\n <FormGrid.Row gutter={[15, 0]} gridSize={props.formGridSize}>\n {formRowChildren}\n </FormGrid.Row>\n )}\n </EasyForm>\n </BlockLayout>\n );\n};\n","import { useContext } from 'react';\nimport { EasyTableContext } from './context';\n\n/**\n * 在 EasyTable子组件内才可使用\n * @returns\n */\nexport const useEasyTable = () => {\n const ctx = useContext(EasyTableContext);\n return ctx.getEasyTableRef();\n};\n\n/**\n *\n * @deprecated 已过时 @4.3.0版本移除,请使用 useEasyTable\n * @returns\n */\nexport const useEasyTablRef = () => {\n const ctx = useContext(EasyTableContext);\n return {\n current: ctx.getEasyTableRef(),\n };\n};\n","import { classNames } from '@dimjs/utils';\nimport { getUuid, isMacEnv, isUndefinedOrNull, TAny, TPlainObject } from '@flatbiz/utils';\nimport { Table, TableProps } from 'antd';\nimport { CSSProperties, Fragment, ReactElement, useContext, useMemo } from 'react';\nimport { BlockLayout } from '../block-layout';\nimport { fbaHooks } from '../fba-hooks';\nimport { SmallSelect } from '../pagination-wrapper/select';\nimport { TableScrollbar } from '../table-scrollbar';\nimport { TableTitleTooltip } from '../table-title-tooltip';\nimport { TipsWrapper } from '../tips-wrapper';\nimport { EasyTableContext } from './context';\nimport { easyTableModel } from './model';\nimport { TEasyTableTableColumn } from './type';\n\nexport type EasyTableTableProps<T> = Omit<\n TableProps<TAny>,\n 'dataSource' | 'loading' | 'rowKey' | 'columns'\n> & {\n children?: ReactElement | ReactElement[];\n /**\n * 表格行 key 的取值,\n * ```\n * 如果 rowKey 为string类型\n * 1. 组件会判断表格列表数据第一条是否存在当前rowKey对象的数据,如果没有组件内部会动态添加唯一值\n * 2. 基于上一条的逻辑,如果表格数据没有唯一值,可指定 rowKey 值为table数据中不存在的字段名,例如:rowKey=\"_uid\"\n * 3. 如果触发上述逻辑,表格数据中会多出rowKey对应的键值对数据\n * ```\n */\n rowKey: TableProps<TAny>['rowKey'];\n /** table Form 外层 SimpleLayout className */\n tableWrapperStyle?: CSSProperties;\n /** table Form 外层 SimpleLayout className */\n tableWrapperClassName?: string;\n columns: TEasyTableTableColumn<T>[];\n /**\n * 数据加载与表格初始化渲染 是否同步\n * @version 4.4.6\n * ```\n * 1. true:获取数据后再初始化渲染表格(可用于实现表格中defaultXxxx相关功能的使用)\n * ```\n */\n isSync?: boolean;\n /**\n * 空效果显示尺寸,默认值:small\n * @version 4.4.6\n */\n emptyShowSize?: 'small' | 'large';\n};\n\n/**\n * 表格渲染\n * @param props\n * ```\n * 1. 继承了 TableProps 可设置antd table功能\n * 2. 分页功能已内置处理,不调用 onChange\n * ```\n */\nexport const EasyTableTable = <T extends TPlainObject>(props: EasyTableTableProps<T>) => {\n const ctx = useContext(EasyTableContext);\n const { children, rowKey, pagination, isSync, ...otherProps } = props;\n\n const {\n modelKey,\n fieldNames,\n onRequest,\n tableDataSource,\n initRequest,\n pageSize,\n tableTotal,\n loading,\n initialValues,\n paginationFixed,\n onSetPaginationStatus,\n dynamicColumns,\n } = ctx;\n const [state, actions] = easyTableModel(modelKey).useStore();\n\n fbaHooks.useEffectCustom(() => {\n ctx.onSetBaseColumns((props.columns || []) as TEasyTableTableColumn<TPlainObject>[]);\n }, [props.columns]);\n\n const tablePaginationData = useMemo(() => {\n if (paginationFixed || pagination === false) return false;\n return {\n showSizeChanger: true,\n current: state.queryCondition[fieldNames.pageNo] || 1,\n pageSize: state.queryCondition[fieldNames.pageSize] || pageSize,\n total: tableTotal,\n showTotal: (total) => `共 ${total} 条记录`,\n ...props.pagination,\n selectComponentClass: SmallSelect,\n };\n }, [\n fieldNames.pageNo,\n fieldNames.pageSize,\n pageSize,\n pagination,\n paginationFixed,\n props.pagination,\n state.queryCondition,\n tableTotal,\n ]);\n\n const onChangePage: TableProps<TAny>['onChange'] = (pagination, filters, sorter, extra) => {\n if (extra.action === 'paginate' && tablePaginationData) {\n onRequest({\n [fieldNames.pageSize]: pagination.pageSize,\n [fieldNames.pageNo]: pagination.current,\n });\n } else {\n props.onChange?.(pagination, filters, sorter, extra);\n }\n };\n\n const dataSource = useMemo(() => {\n if (!tableDataSource) return undefined;\n if (tableDataSource.length === 0) {\n return [];\n }\n if (typeof rowKey === 'string' && isUndefinedOrNull(tableDataSource[0][rowKey])) {\n return tableDataSource.map((item) => {\n item[rowKey] = getUuid();\n return item;\n });\n }\n return tableDataSource;\n }, [tableDataSource, rowKey]);\n\n fbaHooks.useEffectCustom(() => {\n const hasPagination = paginationFixed || tablePaginationData !== false;\n onSetPaginationStatus(hasPagination);\n if (initRequest !== false || !state.isInit) {\n if (hasPagination) {\n void onRequest({\n [fieldNames.pageNo]: 1,\n [fieldNames.pageSize]: pageSize,\n ...initialValues,\n ...state.queryCondition,\n });\n } else {\n void onRequest(initialValues);\n }\n } else {\n void actions.updateFilterCondition(initialValues);\n }\n void actions.updateInitStatus();\n }, []);\n\n const columns = useMemo(() => {\n const columns = dynamicColumns ? dynamicColumns : props.columns;\n\n return columns.map((item) => {\n const { tooltip, tipsWrapperProps, title, ...otherProps } = item;\n if (typeof title === 'string' && tipsWrapperProps) {\n if (typeof tipsWrapperProps === 'string') {\n return {\n ...otherProps,\n title: (\n <TipsWrapper tipType=\"popover\" popoverProps={{ content: tipsWrapperProps }}>\n {title}\n </TipsWrapper>\n ),\n };\n }\n return {\n ...otherProps,\n title: <TipsWrapper {...tipsWrapperProps}>{title}</TipsWrapper>,\n };\n }\n if (typeof title === 'string' && !!tooltip) {\n return {\n ...otherProps,\n title: <TableTitleTooltip tooltip={tooltip} title={title}></TableTitleTooltip>,\n };\n }\n return item;\n });\n }, [dynamicColumns, props.columns]);\n\n const tableRender = () => {\n if (isSync && !dataSource) {\n /** loading表格 */\n return (\n <Fragment>\n {children}\n <Table\n key=\"1\"\n size=\"small\"\n scroll={{ x: 'max-content' }}\n bordered\n columns={columns}\n rowKey={rowKey}\n loading={true}\n />\n </Fragment>\n );\n }\n if (isMacEnv()) {\n return (\n <Fragment>\n {children}\n <Table\n key=\"2\"\n size=\"small\"\n scroll={{ x: 'max-content' }}\n bordered\n {...otherProps}\n columns={columns}\n pagination={tablePaginationData}\n rowKey={rowKey}\n onChange={onChangePage}\n loading={loading}\n dataSource={dataSource}\n />\n </Fragment>\n );\n }\n return (\n <Fragment>\n {children}\n <TableScrollbar>\n <Table\n key=\"3\"\n size=\"small\"\n scroll={{ x: 'max-content' }}\n bordered\n {...otherProps}\n columns={columns}\n pagination={tablePaginationData}\n rowKey={rowKey}\n onChange={onChangePage}\n loading={loading}\n dataSource={dataSource}\n />\n </TableScrollbar>\n </Fragment>\n );\n };\n\n return (\n <BlockLayout\n className={classNames(\n 'easy-table-table',\n { 'ett-empty-show-small': props.emptyShowSize === 'small' },\n props.tableWrapperClassName,\n )}\n style={props.tableWrapperStyle}\n >\n {tableRender()}\n </BlockLayout>\n );\n};\n","import { fbaUtils } from '../fba-utils';\nimport { EasyTable as EasyTableInner } from './easy-table';\nimport { EasyTableFilter } from './filter';\nimport { useEasyTable, useEasyTablRef } from './hooks';\nimport { EasyTableTable } from './table';\n\n/**\n * 对 查询条件+表格数据 进行深度封装,内置数据交互处理\n * ```\n * Demo https://fex.qa.tcshuke.com/docs/admin/main/crud/easy-table\n *\n * 1. 废弃modelKey参数\n * 2. 如果需要在路由跳转回退中缓存查询条件,设置cacheSwitch=true\n * 3. 需要获取查询条件、主动发起请求等可通过ref、useEasyTable操作\n * 4. 可通过属性 initRequest 设置初始化是否请求数据\n * 5. 可通过属性 fieldNames 来设置自定义变量,默认值为:list、total、pageNo、pageSize\n * 6. isFull=true,设置【在父节点高度下,上下铺满】(默认值:true)\n * 7. filterFixed=true,设置查询条件固定,不随滚动条滚动\n * 8. paginationFixed=true,可设置分页条件在底部固定,不随滚动条滚动\n * 9. foldKeys=string[],查询条件展开、收起,被收起数组内容为EasyTable.Filter 子节点key值\n * 10. windows环境下,会在EasyTable.Table外部包装一下 TableScrollbar,提高windows下table左右滚动体验\n * ```\n */\nexport const EasyTable = fbaUtils.attachPropertiesToComponent(EasyTableInner, {\n /**\n * 过滤条件\n *```\n * 1. 用法1\n * -- 默认网格布局 规则:{ xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 6 }\n * <EasyTable.Filter>\n * <FormItemWrapper name=\"field1\" label=\"条件1\">xxx</FormItemWrapper>\n * </EasyTable.Filter>\n *\n * -- 自定义网格布局 使用 FormCol组件包装 FormItemWrapper\n * <EasyTable.Filter>\n * <FormCol span={12}><FormItemWrapper name=\"field1\" label=\"条件1\">xxx</FormItemWrapper></FormCol>\n * </EasyTable.Filter>\n *\n * -- children 可为 function\n * <EasyTable.Filter>\n * {(form) => {\n * return <FormItemWrapper name=\"field1\" label=\"条件1\">xxx</FormItemWrapper>\n * }}\n * </EasyTable.Filter>\n * 2. 用户2(自定义布局)\n * EasyTable.Filter设置 isPure = true,FormItem无布局规则\n * 3. EasyTable.Filter中内置了 Form 标签,当children为函数时,可获取form实例\n * 4. 默认布局下,可通过设置 filterOperate 设置操作按钮\n * 5. Filter 子节点包含 hidden = true 会被忽略\n * 6. 如果想隐藏【查询、重置】按钮中的某一个,可设置 queryButtonProps.hidden、resetButtonProps.hidden\n * 7. EasyTableFilter 子节点可使用 FormItemWrapper,FormItemWrapper中可配置label宽度等\n * 8. 通过easyFormProps属性可整体控制子节点FormItem布局\n *```\n */\n Filter: EasyTableFilter,\n /**\n * 表格渲染\n * @param props\n * ```\n * 1. 继承了 TableProps 可设置antd table功能\n * 2. 分页功能已内置处理,不调用 onChange\n * ```\n */\n Table: EasyTableTable,\n /**\n * @deprecated 已过时 4.3.0版本移除,请使用 useEasyTable\n */\n useEasyTablRef: useEasyTablRef,\n\n /** 在 EasyTable子组件内才可使用 */\n useEasyTable: useEasyTable,\n});\n"],"names":["EasyTableContext","createContext","onRequest","noop","tableList","getEasyTableRef","defaultState","queryCondition","isInit","_EasyTableModel","actions","updateFilterCondition","params","state","_extends","resetFilterCondition","updateInitStatus","easyTableModels","easyTableModel","key","Model","EasyTable","forwardRef","props","ref","_props$initialPaginat","_useState","useState","dataSource","setDataSource","_useState2","total","setTotal","_useState3","loading","setLoading","easyTableId","_hooks","useId","undefined","modelKey","useMemo","cacheSwitch","location","pathname","_easyTableModel$useSt","useStore","pageSize","initialPaginationParams","initRequest","_useState4","paginationStatus","setPaginationStatus","respOriginalDataRef","useRef","baseColumnsRef","_useState5","dynamicColumns","setDynamicColumns","fieldNames","list","pageNo","_Form$useForm","Form","useForm","form","onInnerRequest","useCallbackRef","Promise","$return","$error","allState","_props$serviceConfig","requestParamsAdapter","requestResultAdapter","dynamicColumsAdapter","paramsNew","_respData","respDataNew","_dynamicColumns","respList","$Try_1_Post","$boundEx","$Try_1_Catch","error","onRequestErrorHandle","message","resolve","then","$await_2","cloneState","serviceConfig","$await_3","respData","current","onDataSourceChange","_get","_isArray","clearQueryCondition","values","$await_4","resetFields","setFieldsValue","getPaginationData","_pageSize","_ref","onResetRequest","initialValues","$await_5","getRequestParams","getFieldsValue","getDataSource","onFilterDataSource","filterDataSource","onClearDataSource","onUpdateDataSource","dataList","useImperativeHandle","onSetPaginationStatus","status","onSetBaseColumns","base","onFormFinish","isFull","_isUndefined","className","_classNames","filterFixed","paginationFixed","paginationData","showSizeChanger","showTotal","pagination","onChange","page","_onInnerRequest","_props$pagination","wrapperClassName","isInline","children","_jsx","Provider","value","tableDataSource","tableTotal","foldKeys","_jsxs","style","PaginationWrapper","size","EasyTableFilter","ctx","useContext","queryButtonProps","resetButtonProps","filterOperate","_props$formClassName","formClassName","defaultResetButtonTriggerRequest","filterWrapperStyle","filterWrapperClassName","rightOperateAreaAppendType","easyFormProps","rightOperateAreaAppendTypeFt","childrens","isFragment","Children","toArray","openFold","setOpenFold","onReset","_extends2","$await_1","formRowChildren","defaultRightList","hidden","ButtonWrapper","type","htmlType","text","onClick","filter","Boolean","customFormOperateCol","customRightList","rightList","leftList","concat","length","changeFolditem","padding","_UpOutlined","marginLeft","fontSize","_DownOutlined","push","map","item","index","find","keyItem","FormGrid","Col","OperateCol","BlockLayout","EasyForm","autoComplete","onFinish","formStyle","isPure","labelWidth","labelAlign","formItemGap","Row","gutter","gridSize","formGridSize","useEasyTable","useEasyTablRef","EasyTableTable","rowKey","isSync","otherProps","_objectWithoutPropertiesLoose","_excluded","fbaHooks","useEffectCustom","columns","tablePaginationData","selectComponentClass","SmallSelect","onChangePage","filters","sorter","extra","action","_onRequest","isUndefinedOrNull","getUuid","hasPagination","tooltip","tipsWrapperProps","title","_excluded2","TipsWrapper","tipType","popoverProps","content","TableTitleTooltip","tableRender","Fragment","Table","scroll","x","bordered","isMacEnv","TableScrollbar","emptyShowSize","tableWrapperClassName","tableWrapperStyle","fbaUtils","attachPropertiesToComponent","EasyTableInner","Filter"],"mappings":";yoEA6CO,IAAMA,EAAmBC,EAA8C,CAC5EC,UAAWC,EACXC,UAAW,GACXC,gBAAiB,SAAAA,IACf,IClCJ,IAAMC,EAA2B,CAC/BC,eAAgB,CAAE,EAClBC,OAAQ,MAGV,IAAMC,EAA4D,CAChEC,QAAS,CACPC,sBAAuB,SAAAA,EAACC,GACtB,OAAO,SAACC,GACNA,EAAMN,eAAcO,EAAA,CAAA,EACfD,EAAMN,eACNK,GAGR,EACDG,qBAAsB,SAAAA,EAACH,GACrB,OAAO,SAACC,GACNA,EAAMN,eAAcO,EAAA,CAAA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,EACDC,EAACoH,EAAc,CAAArH,SACbC,EAAC+G,EAAK7O,EAAA,CAEJuI,KAAK,QACLuG,OAAQ,CAAEC,EAAG,eACbC,SAAQ,MACJhC,EAAU,CACdK,QAASA,EACT/F,WAAYgG,EACZR,OAAQA,EACRvF,SAAUkG,EACVrM,QAASA,EACTN,WAAYA,IAVR,WAiBd,OACEgH,EAACgE,EAAW,CACV/E,UAAWC,EACT,mBACA,CAAE,uBAAwBvG,EAAM0O,gBAAkB,SAClD1O,EAAM2O,uBAER/G,MAAO5H,EAAM4O,kBAAkBxH,SAE9B8G,KAGP,ECpOO,IAAMpO,EAAY+O,EAASC,4BAA4BC,EAAgB,CA+B5EC,OAAQjH,EASRqG,MAAOhC,EAIPD,eAAgBA,EAGhBD,aAAcA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.form-list-wrapper{background-color:var(--block-bg-color)}.union-after-text,.union-before-text{align-self:flex-start;flex-shrink:0;line-height:32px}.union-after-element,.union-before-element{align-self:flex-start}.form-item-group-horizontal-union .v-flex-layout .ant-form-item{align-self:flex-start;margin-bottom:0}.form-item-group-horizontal-union .v-flex-layout{align-items:flex-start}
|
|
1
|
+
.form-list-wrapper{background-color:var(--block-bg-color)}.form-list-item-content .ant-form-item{margin-bottom:0}.union-after-text,.union-before-text{align-self:flex-start;flex-shrink:0;line-height:32px}.union-after-element,.union-before-element{align-self:flex-start}.form-item-group-horizontal-union .v-flex-layout .ant-form-item{align-self:flex-start;margin-bottom:0}.form-item-group-horizontal-union .v-flex-layout{align-items:flex-start}
|
|
@@ -9,5 +9,5 @@ import './../flex-layout/index.css';
|
|
|
9
9
|
import './../text-symbol-wrapper/index.css';
|
|
10
10
|
import './index.css';
|
|
11
11
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
12
|
-
import{classNames as e}from"@dimjs/utils/cjs/class-names";import{_ as t}from"../_rollupPluginBabelHelpers-a0769acd.js";import{toArray as r,getUuid as i}from"@flatbiz/utils";import{Form as o,Empty as n}from"antd";import{useRef as l,Fragment as a}from"react";import{ButtonWrapper as s}from"../button-wrapper/index.js";import{FormItemGroup as m}from"../form-item-group/index.js";import{TextSymbolWrapper as d}from"../text-symbol-wrapper/index.js";import{jsx as p,jsxs as u}from"react/jsx-runtime";import"@ant-design/icons/es/icons/LoadingOutlined";import"@dimjs/lang/cjs/is-promise";import"@wove/react/cjs/hooks";import"../index-7f4ad045.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-hooks/index.js";import"@dimjs/lang/cjs/is-array";import"../use-responsive-point-21b8c601.js";import"@dimjs/utils/cjs/extend";import"../fba-utils/index.js";import"../flex-layout/index.js";var c=function e(t){if(t.wrapper)return t.wrapper({children:t.children});return t.children};var f=function e(r){var i,o;return p(m.HorizontalUnion,t({},r.formListItemTitleHProps,{style:t({marginBottom:10},(i=r.formListItemTitleHProps)==null?void 0:i.style),groupConfigList:((o=r.formListItemTitleList)==null?void 0:o.map((function(e){if(e.required){return{width:e.width,mainItem:p("div",{style:{textAlign:"center"},children:p(d,{text:e.title,symbolType:"required"})})}}return{width:e.width,mainItem:p("div",{style:{textAlign:"center"},children:e.title})}})))||[]}))};var
|
|
12
|
+
import{classNames as e}from"@dimjs/utils/cjs/class-names";import{_ as t}from"../_rollupPluginBabelHelpers-a0769acd.js";import{toArray as r,getUuid as i}from"@flatbiz/utils";import{Form as o,Empty as n}from"antd";import{useRef as l,Fragment as a}from"react";import{ButtonWrapper as s}from"../button-wrapper/index.js";import{FormItemGroup as m}from"../form-item-group/index.js";import{TextSymbolWrapper as d}from"../text-symbol-wrapper/index.js";import{jsx as p,jsxs as u}from"react/jsx-runtime";import"@ant-design/icons/es/icons/LoadingOutlined";import"@dimjs/lang/cjs/is-promise";import"@wove/react/cjs/hooks";import"../index-7f4ad045.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-hooks/index.js";import"@dimjs/lang/cjs/is-array";import"../use-responsive-point-21b8c601.js";import"@dimjs/utils/cjs/extend";import"../fba-utils/index.js";import"../flex-layout/index.js";var c=function e(t){if(t.wrapper)return t.wrapper({children:t.children});return t.children};var f=function e(r){var i,o;return p(m.HorizontalUnion,t({},r.formListItemTitleHProps,{style:t({marginBottom:10},(i=r.formListItemTitleHProps)==null?void 0:i.style),groupConfigList:((o=r.formListItemTitleList)==null?void 0:o.map((function(e){if(e.required){return{width:e.width,mainItem:p("div",{style:{textAlign:"center"},children:p(d,{text:e.title,symbolType:"required"})})}}return{width:e.width,mainItem:p("div",{style:{textAlign:"center"},children:e.title})}})))||[]}))};var g=function m(d){var g=[].concat(d.prevCompleteName,r(d.name));var h=o.useFormInstance();var y=l([]);var j=d.uidFieldName||"uid";var v=o.useWatch(g,h);var x=d.itemGap?d.itemGap/2:8;return p("div",{className:e("form-list-wrapper",d.className),style:d.style,children:p(o.List,{name:d.name,rules:d.rules,children:function e(r,l,m){var w;var L=m.errors;y.current=r;return u("div",{style:{borderRadius:"6px",border:L!=null&&L.length?"1px solid #ff4d4f":"1px solid transparent"},children:[(w=d.formListItemTitleList)!=null&&w.length?p(f,{formListItemTitleList:d.formListItemTitleList,formListItemTitleHProps:d.formListItemTitleHorizontalUnionProps}):null,!d.hiddenEmptyRender&&!(v!=null&&v.length)?p(n,{image:n.PRESENTED_IMAGE_SIMPLE,style:{margin:"15px 0"}}):null,p(c,{wrapper:d.formListChildrenWrapper,children:u(a,{children:[r.map((function(e,t){var r=[].concat(g,[e.name]);return p("div",{className:"form-list-item-content",style:{padding:x+"px 0 "+x+"px 0"},children:d.children({formListFieldData:e,operation:l,formStageCompleteName:r,prevCompleteName:g,index:t,getInsideFormItemName:function t(r){return[e.name,r]},getInsideFormItemData:function e(){return h.getFieldValue(r)},uidKey:j})},e.key)})),d.onCustomAddRowButton?d.onCustomAddRowButton(l):p(s,{hidden:d.hiddenAddRowButton,type:"dashed",block:true,onClick:function e(){var r;return l.add(t((r={},r[j]=i(),r),d.getAddRowDefaultValues==null?void 0:d.getAddRowDefaultValues()))},children:"添加"}),p(o.ErrorList,{errors:L.length?[p("div",{style:{color:"#ff4d4f",padding:"5px"},children:L})]:undefined})]})})]})}})})};export{g as FormListWrapper};
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/form-list-wrapper/form-list-wrapper.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { getUuid, toArray } from '@flatbiz/utils';\nimport { Empty, Form, type FormListFieldData } from 'antd';\nimport { Fragment, useRef, type ReactElement } from 'react';\nimport { ButtonWrapper } from '../button-wrapper';\nimport { FormItemGroup } from '../form-item-group';\nimport { TextSymbolWrapper } from '../text-symbol-wrapper';\nimport './style.less';\nimport { type FormListWrapperProps } from './types';\n\ntype FormListChildrenWrapperProps = {\n wrapper?: FormListWrapperProps['formListChildrenWrapper'];\n children: ReactElement;\n};\nconst FormListChildrenWrapper = (props: FormListChildrenWrapperProps) => {\n if (props.wrapper) return props.wrapper({ children: props.children });\n return props.children;\n};\n\nconst FormListTitleRender = (props: {\n formListItemTitleList: FormListWrapperProps['formListItemTitleList'];\n formListItemTitleHProps?: FormListWrapperProps['formListItemTitleHorizontalUnionProps'];\n}) => {\n return (\n <FormItemGroup.HorizontalUnion\n {...props.formListItemTitleHProps}\n style={{ marginBottom: 10, ...props.formListItemTitleHProps?.style }}\n groupConfigList={\n props.formListItemTitleList?.map((item) => {\n if (item.required) {\n return {\n width: item.width,\n mainItem: (\n <div style={{ textAlign: 'center' }}>\n <TextSymbolWrapper text={item.title} symbolType=\"required\" />\n </div>\n ),\n };\n }\n return {\n width: item.width,\n mainItem: <div style={{ textAlign: 'center' }}>{item.title}</div>,\n };\n }) || []\n }\n />\n );\n};\n\n/**\n * Form.List 包装组件,使用更简单\n * ```\n * Demo: https://fex.qa.tcshuke.com/docs/admin/main/form/list\n * 1. FormList数组中必须要有唯一值字段,默认值字段名称uid,可通过uidFieldName自定义设置\n * ```\n */\nexport const FormListWrapper = (props: FormListWrapperProps) => {\n const stageCompleteName = [...props.prevCompleteName, ...toArray(props.name)] as Array<string | number>;\n const form = Form.useFormInstance();\n const formListOperationRef = useRef<FormListFieldData[]>([]);\n const uidFieldName = props.uidFieldName || 'uid';\n const formListValue = Form.useWatch(stageCompleteName, form);\n\n return (\n <div className={classNames('form-list-wrapper', props.className)} style={props.style}>\n <Form.List name={props.name} rules={props.rules}>\n {(fields, operation, { errors }) => {\n formListOperationRef.current = fields;\n return (\n <div\n style={{\n borderRadius: '6px',\n border: errors?.length ? '1px solid #ff4d4f' : '1px solid transparent',\n }}\n >\n {props.formListItemTitleList?.length ? (\n <FormListTitleRender\n formListItemTitleList={props.formListItemTitleList}\n formListItemTitleHProps={props.formListItemTitleHorizontalUnionProps}\n />\n ) : null}\n {!props.hiddenEmptyRender && !formListValue?.length ? (\n <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} style={{ margin: '15px 0' }} />\n ) : null}\n <FormListChildrenWrapper wrapper={props.formListChildrenWrapper}>\n <Fragment>\n {fields.map((field, index) => {\n const formStageCompleteName = [...stageCompleteName, field.name];\n return (\n <
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/form-list-wrapper/form-list-wrapper.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { getUuid, toArray } from '@flatbiz/utils';\nimport { Empty, Form, type FormListFieldData } from 'antd';\nimport { Fragment, useRef, type ReactElement } from 'react';\nimport { ButtonWrapper } from '../button-wrapper';\nimport { FormItemGroup } from '../form-item-group';\nimport { TextSymbolWrapper } from '../text-symbol-wrapper';\nimport './style.less';\nimport { type FormListWrapperProps } from './types';\n\ntype FormListChildrenWrapperProps = {\n wrapper?: FormListWrapperProps['formListChildrenWrapper'];\n children: ReactElement;\n};\nconst FormListChildrenWrapper = (props: FormListChildrenWrapperProps) => {\n if (props.wrapper) return props.wrapper({ children: props.children });\n return props.children;\n};\n\nconst FormListTitleRender = (props: {\n formListItemTitleList: FormListWrapperProps['formListItemTitleList'];\n formListItemTitleHProps?: FormListWrapperProps['formListItemTitleHorizontalUnionProps'];\n}) => {\n return (\n <FormItemGroup.HorizontalUnion\n {...props.formListItemTitleHProps}\n style={{ marginBottom: 10, ...props.formListItemTitleHProps?.style }}\n groupConfigList={\n props.formListItemTitleList?.map((item) => {\n if (item.required) {\n return {\n width: item.width,\n mainItem: (\n <div style={{ textAlign: 'center' }}>\n <TextSymbolWrapper text={item.title} symbolType=\"required\" />\n </div>\n ),\n };\n }\n return {\n width: item.width,\n mainItem: <div style={{ textAlign: 'center' }}>{item.title}</div>,\n };\n }) || []\n }\n />\n );\n};\n\n/**\n * Form.List 包装组件,使用更简单\n * ```\n * Demo: https://fex.qa.tcshuke.com/docs/admin/main/form/list\n * 1. FormList数组中必须要有唯一值字段,默认值字段名称uid,可通过uidFieldName自定义设置\n * 2. 通过 itemGap 设置FormList Item 之间间隙\n * ```\n */\nexport const FormListWrapper = (props: FormListWrapperProps) => {\n const stageCompleteName = [...props.prevCompleteName, ...toArray(props.name)] as Array<string | number>;\n const form = Form.useFormInstance();\n const formListOperationRef = useRef<FormListFieldData[]>([]);\n const uidFieldName = props.uidFieldName || 'uid';\n const formListValue = Form.useWatch(stageCompleteName, form);\n\n const gapHalf = props.itemGap ? props.itemGap / 2 : 8;\n\n return (\n <div className={classNames('form-list-wrapper', props.className)} style={props.style}>\n <Form.List name={props.name} rules={props.rules}>\n {(fields, operation, { errors }) => {\n formListOperationRef.current = fields;\n return (\n <div\n style={{\n borderRadius: '6px',\n border: errors?.length ? '1px solid #ff4d4f' : '1px solid transparent',\n }}\n >\n {props.formListItemTitleList?.length ? (\n <FormListTitleRender\n formListItemTitleList={props.formListItemTitleList}\n formListItemTitleHProps={props.formListItemTitleHorizontalUnionProps}\n />\n ) : null}\n {!props.hiddenEmptyRender && !formListValue?.length ? (\n <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} style={{ margin: '15px 0' }} />\n ) : null}\n <FormListChildrenWrapper wrapper={props.formListChildrenWrapper}>\n <Fragment>\n {fields.map((field, index) => {\n const formStageCompleteName = [...stageCompleteName, field.name];\n return (\n <div\n key={field.key}\n className=\"form-list-item-content\"\n style={{ padding: `${gapHalf}px 0 ${gapHalf}px 0` }}\n >\n {props.children({\n formListFieldData: field,\n operation: operation,\n formStageCompleteName,\n prevCompleteName: stageCompleteName,\n index,\n getInsideFormItemName: (key: string) => {\n return [field.name, key];\n },\n getInsideFormItemData: () => {\n return form.getFieldValue(formStageCompleteName);\n },\n uidKey: uidFieldName,\n })}\n </div>\n );\n })}\n {props.onCustomAddRowButton ? (\n props.onCustomAddRowButton(operation)\n ) : (\n <ButtonWrapper\n hidden={props.hiddenAddRowButton}\n type=\"dashed\"\n block\n onClick={() =>\n operation.add({\n [uidFieldName]: getUuid(),\n ...props.getAddRowDefaultValues?.(),\n })\n }\n >\n 添加\n </ButtonWrapper>\n )}\n\n <Form.ErrorList\n errors={\n errors.length\n ? [\n <div\n style={{\n color: '#ff4d4f',\n padding: '5px',\n }}\n >\n {errors}\n </div>,\n ]\n : undefined\n }\n />\n </Fragment>\n </FormListChildrenWrapper>\n </div>\n );\n }}\n </Form.List>\n </div>\n );\n};\n"],"names":["FormListChildrenWrapper","props","wrapper","children","FormListTitleRender","_props$formListItemTi","_props$formListItemTi2","_jsx","FormItemGroup","HorizontalUnion","_extends","formListItemTitleHProps","style","marginBottom","groupConfigList","formListItemTitleList","map","item","required","width","mainItem","textAlign","TextSymbolWrapper","text","title","symbolType","FormListWrapper","stageCompleteName","concat","prevCompleteName","toArray","name","form","Form","useFormInstance","formListOperationRef","useRef","uidFieldName","formListValue","useWatch","gapHalf","itemGap","className","_classNames","List","rules","fields","operation","_ref","_props$formListItemTi3","errors","current","_jsxs","borderRadius","border","length","formListItemTitleHorizontalUnionProps","hiddenEmptyRender","Empty","image","PRESENTED_IMAGE_SIMPLE","margin","formListChildrenWrapper","Fragment","field","index","formStageCompleteName","padding","formListFieldData","getInsideFormItemName","key","getInsideFormItemData","getFieldValue","uidKey","onCustomAddRowButton","ButtonWrapper","hidden","hiddenAddRowButton","type","block","onClick","_extends2","add","getUuid","getAddRowDefaultValues","ErrorList","color","undefined"],"mappings":";kqCAcA,IAAMA,EAA0B,SAA1BA,EAA2BC,GAC/B,GAAIA,EAAMC,QAAS,OAAOD,EAAMC,QAAQ,CAAEC,SAAUF,EAAME,WAC1D,OAAOF,EAAME,QACf,EAEA,IAAMC,EAAsB,SAAtBA,EAAuBH,GAGvB,IAAAI,EAAAC,EACJ,OACEC,EAACC,EAAcC,gBAAeC,EAAA,CAAA,EACxBT,EAAMU,wBAAuB,CACjCC,MAAKF,EAAA,CAAIG,aAAc,KAAER,EAAKJ,EAAMU,0BAANN,UAAAA,EAAAA,EAA+BO,OAC7DE,kBACER,EAAAL,EAAMc,wBAANT,UAAAA,EAAAA,EAA6BU,KAAI,SAACC,GAChC,GAAIA,EAAKC,SAAU,CACjB,MAAO,CACLC,MAAOF,EAAKE,MACZC,SACEb,EAAA,MAAA,CAAKK,MAAO,CAAES,UAAW,UAAWlB,SAClCI,EAACe,EAAiB,CAACC,KAAMN,EAAKO,MAAOC,WAAW,eAIxD,CACA,MAAO,CACLN,MAAOF,EAAKE,MACZC,SAAUb,EAAA,MAAA,CAAKK,MAAO,CAAES,UAAW,UAAWlB,SAAEc,EAAKO,QAExD,MAAK,KAId,MAUaE,EAAkB,SAAlBA,EAAmBzB,GAC9B,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AmBJ,EACnBjB,UAAWA,EACXmB,sBAAAA,EACArC,iBAAkBF,EAClBsC,MAAAA,EACAI,sBAAuB,SAAAA,EAACC,GACtB,MAAO,CAACN,EAAMjC,KAAMuC,EACrB,EACDC,sBAAuB,SAAAA,IACrB,OAAOvC,EAAKwC,cAAcN,EAC3B,EACDO,OAAQpC,KAhBL2B,EAAMM,IAoBjB,IACCrE,EAAMyE,qBACLzE,EAAMyE,qBAAqB3B,GAE3BxC,EAACoE,EAAa,CACZC,OAAQ3E,EAAM4E,mBACdC,KAAK,SACLC,MAAK,KACLC,QAAS,SAAAA,IAAA,IAAAC,EAAA,OACPlC,EAAUmC,IAAGxE,GAAAuE,EAAA,CAAA,EAAAA,EACV5C,GAAe8C,IAASF,GACtBhF,EAAMmF,wBAAsB,UAAA,EAA5BnF,EAAMmF,0BAEZ,EAAAjF,SACF,OAKHI,EAAC0B,EAAKoD,UAAS,CACbnC,OACEA,EAAOK,OACH,CACEhD,EAAA,MAAA,CACEK,MAAO,CACL0E,MAAO,UACPnB,QAAS,OACThE,SAED+C,KAGLqC,mBAOlB,KAIR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/label-value-layout/label-value-layout.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { getUuid } from '@flatbiz/utils';\nimport { Descriptions } from 'antd';\nimport { CSSProperties, ReactElement, useMemo } from 'react';\nimport './style.less';\n\nexport type LabelValueLayoutProps = {\n options: {\n label: string | ReactElement;\n value?: string | number | ReactElement | null;\n span?: number;\n hidden?: boolean;\n }[];\n labelWidth?: number | 'auto';\n // 一行占几组,默认1\n column?: number;\n /** 添加边框 */\n bordered?: boolean;\n className?: string;\n style?: CSSProperties;\n /** 边框 row 内边距 */\n borderedRowPadding?: CSSProperties['padding'];\n};\n\n/**\n * options[].span 是 Description.Item 的数量。 span={2} 会占用两个 DescriptionItem 的宽度\n * options[].hidden 是否隐藏 Description.Item\n */\nexport const LabelValueLayout = (props: LabelValueLayoutProps) => {\n const labelWidth = props.labelWidth === 'auto' ? 'auto' : `${props.labelWidth || 120}px`;\n const className = classNames('v-label-value-layout', props.className, {\n 'lvl-bordered-padding': props.borderedRowPadding,\n });\n const style = {\n '--v-label-value-layout-Width': labelWidth,\n '--v-label-value-layout-row-padding': props.borderedRowPadding,\n ...props.style,\n } as CSSProperties;\n\n const options = useMemo(() => {\n const dataList = props.options.filter((item) => !item.hidden);\n return dataList.map((item) => {\n return { key: getUuid(), ...item };\n });\n }, [props.options]);\n\n return (\n <Descriptions\n column={props.column || 1}\n bordered={props.bordered}\n size=\"small\"\n className={className}\n style={style}\n >\n {options.map((item) => {\n return (\n <Descriptions.Item key={item.key} label={item.label} span={item.span}>\n {item.value}\n </Descriptions.Item>\n );\n })}\n </Descriptions>\n );\n};\n"],"names":["LabelValueLayout","props","labelWidth","className","_classNames","borderedRowPadding","style","_extends","options","useMemo","dataList","filter","item","hidden","map","key","getUuid","_jsx","Descriptions","column","bordered","size","children","Item","label","span","value"],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/label-value-layout/label-value-layout.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { getUuid } from '@flatbiz/utils';\nimport { Descriptions } from 'antd';\nimport { CSSProperties, ReactElement, useMemo } from 'react';\nimport './style.less';\n\nexport type LabelValueLayoutProps = {\n options: {\n label: string | ReactElement;\n value?: string | number | ReactElement | null;\n span?: number;\n hidden?: boolean;\n }[];\n labelWidth?: number | 'auto';\n // 一行占几组,默认1\n column?: number;\n /** 添加边框 */\n bordered?: boolean;\n className?: string;\n style?: CSSProperties;\n /** 边框 row 内边距 */\n borderedRowPadding?: CSSProperties['padding'];\n};\n\n/**\n * @deprecated 已过期,请使用 LabelValueRender 组件\n * options[].span 是 Description.Item 的数量。 span={2} 会占用两个 DescriptionItem 的宽度\n * options[].hidden 是否隐藏 Description.Item\n */\nexport const LabelValueLayout = (props: LabelValueLayoutProps) => {\n const labelWidth = props.labelWidth === 'auto' ? 'auto' : `${props.labelWidth || 120}px`;\n const className = classNames('v-label-value-layout', props.className, {\n 'lvl-bordered-padding': props.borderedRowPadding,\n });\n const style = {\n '--v-label-value-layout-Width': labelWidth,\n '--v-label-value-layout-row-padding': props.borderedRowPadding,\n ...props.style,\n } as CSSProperties;\n\n const options = useMemo(() => {\n const dataList = props.options.filter((item) => !item.hidden);\n return dataList.map((item) => {\n return { key: getUuid(), ...item };\n });\n }, [props.options]);\n\n return (\n <Descriptions\n column={props.column || 1}\n bordered={props.bordered}\n size=\"small\"\n className={className}\n style={style}\n >\n {options.map((item) => {\n return (\n <Descriptions.Item key={item.key} label={item.label} span={item.span}>\n {item.value}\n </Descriptions.Item>\n );\n })}\n </Descriptions>\n );\n};\n"],"names":["LabelValueLayout","props","labelWidth","className","_classNames","borderedRowPadding","style","_extends","options","useMemo","dataList","filter","item","hidden","map","key","getUuid","_jsx","Descriptions","column","bordered","size","children","Item","label","span","value"],"mappings":";gRA6BaA,EAAmB,SAAnBA,EAAoBC,GAC/B,IAAMC,EAAaD,EAAMC,aAAe,OAAS,QAAYD,EAAMC,YAAc,KAAO,KACxF,IAAMC,EAAYC,EAAW,uBAAwBH,EAAME,UAAW,CACpE,uBAAwBF,EAAMI,qBAEhC,IAAMC,EAAKC,EAAA,CACT,+BAAgCL,EAChC,qCAAsCD,EAAMI,oBACzCJ,EAAMK,OAGX,IAAME,EAAUC,GAAQ,WACtB,IAAMC,EAAWT,EAAMO,QAAQG,QAAO,SAACC,GAAI,OAAMA,EAAKC,UACtD,OAAOH,EAASI,KAAI,SAACF,GACnB,OAAAL,EAAA,CAASQ,IAAKC,KAAcJ,EAC9B,GACF,GAAG,CAACX,EAAMO,UAEV,OACES,EAACC,EAAY,CACXC,OAAQlB,EAAMkB,QAAU,EACxBC,SAAUnB,EAAMmB,SAChBC,KAAK,QACLlB,UAAWA,EACXG,MAAOA,EAAMgB,SAEZd,EAAQM,KAAI,SAACF,GACZ,OACEK,EAACC,EAAaK,KAAI,CAAgBC,MAAOZ,EAAKY,MAAOC,KAAMb,EAAKa,KAAKH,SAClEV,EAAKc,OADgBd,EAAKG,SAOvC"}
|
|
@@ -4,5 +4,5 @@ import './../fba-hooks/index.css';
|
|
|
4
4
|
import './../tips-wrapper/index.css';
|
|
5
5
|
import './index.css';
|
|
6
6
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
7
|
-
import{hooks as e}from"@wove/react/cjs/hooks";import{classNames as r}from"@dimjs/utils/cjs/class-names";import{_ as l}from"../_rollupPluginBabelHelpers-a0769acd.js";import{useState as i,useMemo as t,Fragment as a}from"react";import{fbaHooks as s,BoxGrid as n,TextSymbolWrapper as o}from"@flatbiz/antd";import{arrayTotal as u,isUndefinedOrNull as p}from"@flatbiz/utils";import{TextOverflow as
|
|
7
|
+
import{hooks as e}from"@wove/react/cjs/hooks";import{classNames as r}from"@dimjs/utils/cjs/class-names";import{_ as l}from"../_rollupPluginBabelHelpers-a0769acd.js";import{useState as i,useMemo as t,Fragment as a}from"react";import{fbaHooks as s,BoxGrid as n,TextSymbolWrapper as o}from"@flatbiz/antd";import{arrayTotal as u,isUndefinedOrNull as p}from"@flatbiz/utils";import{TextOverflow as m}from"../text-overflow/index.js";import{TipsWrapper as d}from"../tips-wrapper/index.js";import{jsx as f,jsxs as v}from"react/jsx-runtime";import"@dimjs/lang/cjs/is-string";import"ahooks";import"antd";import"../fba-hooks/index.js";import"@dimjs/lang/cjs/is-array";import"../use-responsive-point-21b8c601.js";import"@ant-design/icons/es/icons/QuestionCircleOutlined";var c=function e(r){var i=[];var t=0;var a=[];for(var s=0;s<r.length;s++){var n=r[s];var o=n.grid;var p=l({},n,{grid:o});if(t+o<=24&&o>0){t+=o;a.push(p)}else{i.push(a);t=o;a=[p]}}if(a.length>0){i.push(a)}if(i.length>0){i=i.map((function(e,r){if(e.length===1){e[0].grid=24}else{var l=u(e,"grid");var t=e[e.length-1];if(l<24){t.grid=24-l+t.grid}}if(r===i.length-1){return e.map((function(e){e.isLast=true;return e}))}return e}))}var m=[];i.forEach((function(e){m=m.concat(e)}));console.log("resultsFt",m);return m};var x=function u(x){var h=s.useResponsivePoint()||"";var g=i(),b=g[0],j=g[1];var y=x.column,w=x.forceColumn,N=x.labelAlign,k=x.labelWidth,B=x.options,C=x.border,P=x.width;var R=p(x.ellipsis)?true:x.ellipsis;var S=!C?h==="xs"||b==="xs":false;var T=t((function(){if(w){var e=24/w;return{xs:e,sm:e,md:e,lg:e,xl:e,xxl:e}}var r={1:{xs:24,sm:24,md:24,lg:24,xl:24,xxl:24},2:{xs:24,sm:12,md:12,lg:12,xl:12,xxl:12},3:{xs:24,sm:12,md:12,lg:8,xl:8,xxl:8},4:{xs:24,sm:12,md:12,lg:6,xl:6,xxl:6}};return!y?r[4]:r[y]}),[y,w]);var q=t((function(){if(!b)return undefined;var e=[];B.forEach((function(r){if(!r.hidden){var i=undefined;if(r.span){i=r.span*6;if(b==="xs"){i=24}else if(b==="sm"){i=i>12?i:12}}e.push(l({},r,{grid:i?i:T[b]}))}}));return c(e.filter(Boolean))}),[b,T]);var z=C?"":":";var E=function e(){return q==null?void 0:q.map((function(e,i){var t=p(e.ellipsis)?R:e.ellipsis;var s=S?undefined:k||100;var u=""+e.label+z;if(e.tips&&t){u=f(d,{tipType:"tooltip",tooltipProps:{title:e.tips},children:f(m,{text:u})})}else if(e.tips){u=f(d,{tipType:"tooltip",tooltipProps:{title:e.tips},children:u})}else if(t){u=f(m,{text:u})}return f(n.Col,l({},T,{span:e.grid,className:r("label-value-tr",{"label-value-last-tr":e.isLast}),children:!e.replenish?v(a,{children:[f("span",{className:"label-value-label",style:l({width:s},x.labelStyle),children:e.required?f(o,{text:u,symbolType:"required"}):u}),t?f("span",{className:"label-value-value",style:x.valueStyle,children:f(m,{text:e.value})}):f("span",{className:"label-value-value",style:x.valueStyle,children:e.value})]}):f(a,{})}),i)})).filter(Boolean)};var L=e.useCallbackRef((function(e){j(e)}));var _=t((function(){if(["xs","sm"].includes(h)||!P){return{}}return{width:P}}),[h]);var A=N||(C?"left":"right");return f(n.Row,{style:l({},_,x.style),className:r("label-value-render","label-value-render-"+A,{"label-value-render-border":C,"label-value-render-vertical":S},x.className),gutter:C?[0,0]:[30,0],onBoxBreakpointChange:L,children:E()})};export{x as LabelValueRender};
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/label-value-render/utils.ts","@flatbiz/antd/src/label-value-render/label-value.tsx"],"sourcesContent":["import { arrayTotal } from '@flatbiz/utils';\nimport { TLabelValueRenderItem } from './types';\n\nexport const getRenderGrid = (dataList: TLabelValueRenderItem[]) => {\n let results: TLabelValueRenderItem[][] = [];\n\n let currentSum = 0;\n let currentArr: TLabelValueRenderItem[] = [];\n for (let i = 0; i < dataList.length; i++) {\n const item = dataList[i];\n const grid = item.grid as number;\n const temp = {\n ...item,\n grid: grid,\n } as TLabelValueRenderItem;\n if (currentSum + grid <= 24 && grid > 0) {\n currentSum += grid;\n currentArr.push(temp);\n } else {\n results.push(currentArr);\n currentSum = grid;\n currentArr = [temp];\n }\n }\n\n if (currentArr.length > 0) {\n results.push(currentArr);\n }\n if (results.length > 0) {\n results = results.map((item, index) => {\n if (item.length === 1) {\n item[0].grid = 24;\n } else {\n const total = arrayTotal(item, 'grid');\n const lastItem = item[item.length - 1];\n if (total < 24) {\n lastItem.grid = 24 - total + lastItem.grid;\n }\n }\n if (index === results.length - 1) {\n return item.map((temp) => {\n temp.isLast = true;\n return temp;\n });\n }\n return item;\n });\n }\n\n let resultsFt: TLabelValueRenderItem[] = [];\n results.forEach((item) => {\n resultsFt = resultsFt.concat(item);\n });\n console.log('resultsFt', resultsFt);\n return resultsFt;\n};\n","import { CSSProperties, Fragment, ReactElement, useMemo, useState } from 'react';\n\nimport { classNames } from '@dimjs/utils';\nimport { BoxGrid, fbaHooks, TBoxBreakpoint, TextSymbolWrapper } from '@flatbiz/antd';\nimport { isUndefinedOrNull } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { TextOverflow } from '../text-overflow';\nimport { TipsWrapper } from '../tips-wrapper';\nimport './style.less';\nimport { TLabelValueItem, TLabelValueRenderItem } from './types';\nimport { getRenderGrid } from './utils';\n\nexport type LabelValueRenderProps = {\n className?: string;\n style?: CSSProperties;\n /**\n * 定义一行显示几列, 默认值:3\n * ```\n * 1. 当外层宽度尺寸大于 992px(lg) 时,一行显示几列\n * 1. 当外层宽度尺寸小于992px(lg),为xs、sm、md情况下不受column值影响,响应式布局\n * 2. 宽度尺寸定义\n * xs: 宽度 < 576px\n * sm: 宽度 ≥ 576px\n * md: 宽度 ≥ 768px\n * lg: 宽度 ≥ 992px\n * xl: 宽度 ≥ 1200px\n * xxl: 宽度 ≥ 1600px\n * 3. 列数尺寸定义\n * {\n * 1: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24, xxl: 24 },\n * 2: { xs: 24, sm: 12, md: 12, lg: 12, xl: 12, xxl: 12 },\n * 3: { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 8 },\n * 4: { xs: 24, sm: 12, md: 12, lg: 6, xl: 6, xxl: 6 },\n * };\n * ```\n */\n column?: 1 | 2 | 3 | 4;\n /**\n * 强制定义一行显示几列,不考虑响应式\n * ```\n * 1. 优先级大于column\n * 2. 建议优先使用column配置\n * ```\n */\n forceColumn?: 1 | 2 | 3 | 4;\n /** 数据源配置 */\n dataList: TLabelValueItem[];\n /**\n * 超过宽度将自动省略,默认值:true\n */\n ellipsis?: boolean;\n /** 是否添加边框 */\n border?: boolean;\n /** label对齐方式 */\n labelAlign?: 'left' | 'right' | 'center';\n /** label 宽度,默认值:100 */\n labelWidth?: number;\n width?: number;\n /** label 样式 */\n labelStyle?: CSSProperties;\n /** value 样式 */\n valueStyle?: CSSProperties;\n};\n\n/**\n * label+value 列表布局\n * ```\n * 1. 可设置超出隐藏、必填标识、设置隐藏、添加说明标签等功能\n * 2. 可自定义设置占用网格列数\n * 3. 内置响应式布局\n * ```\n */\nexport const LabelValueRender = (props: LabelValueRenderProps) => {\n const screenType = fbaHooks.useResponsivePoint() || '';\n const [breakpoint, setBreakpoint] = useState<TBoxBreakpoint>();\n\n const { column, forceColumn, labelAlign, labelWidth, dataList, border, width } = props;\n\n const ellipsis = isUndefinedOrNull(props.ellipsis) ? true : props.ellipsis;\n\n const isVertical = !border ? screenType === 'xs' || breakpoint === 'xs' : false;\n\n const gridSize = useMemo(() => {\n if (forceColumn) {\n const num = 24 / forceColumn;\n return { xs: num, sm: num, md: num, lg: num, xl: num, xxl: num };\n }\n const columnMap = {\n 1: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24, xxl: 24 },\n 2: { xs: 24, sm: 12, md: 12, lg: 12, xl: 12, xxl: 12 },\n 3: { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 8 },\n 4: { xs: 24, sm: 12, md: 12, lg: 6, xl: 6, xxl: 6 },\n };\n return !column ? columnMap[3] : columnMap[column];\n }, [column, forceColumn]);\n\n const renderList = useMemo(() => {\n if (!breakpoint) return undefined;\n const dataListNew: TLabelValueRenderItem[] = [];\n dataList.forEach((item) => {\n if (!item.hidden) {\n let grid: number | undefined = undefined;\n if (item.span) {\n grid = item.span * 6;\n if (breakpoint === 'xs') {\n grid = 24;\n } else if (breakpoint === 'sm') {\n grid = grid > 12 ? grid : 12;\n }\n }\n dataListNew.push({\n ...item,\n grid: grid ? grid : gridSize[breakpoint],\n });\n }\n });\n\n return getRenderGrid(dataListNew.filter(Boolean));\n }, [breakpoint, gridSize]);\n\n const colon = border ? '' : ':';\n\n const getFormRowChildren = () => {\n return renderList\n ?.map((item, index) => {\n const ellipsisFt = isUndefinedOrNull(item.ellipsis) ? ellipsis : item.ellipsis;\n\n const width = isVertical ? undefined : labelWidth || 100;\n\n let labelContent: ReactElement | string = `${item.label}${colon}`;\n\n if (item.tips && ellipsisFt) {\n labelContent = (\n <TipsWrapper tipType=\"tooltip\" tooltipProps={{ title: item.tips }}>\n <TextOverflow text={labelContent as unknown as string} />\n </TipsWrapper>\n );\n } else if (item.tips) {\n labelContent = (\n <TipsWrapper tipType=\"tooltip\" tooltipProps={{ title: item.tips }}>\n {labelContent}\n </TipsWrapper>\n );\n } else if (ellipsisFt) {\n labelContent = <TextOverflow text={labelContent as unknown as string} />;\n }\n\n return (\n <BoxGrid.Col\n key={index}\n {...gridSize}\n span={item.grid}\n className={classNames('label-value-tr', { 'label-value-last-tr': item.isLast })}\n >\n {!item.replenish ? (\n <Fragment>\n <span className=\"label-value-label\" style={{ width, ...props.labelStyle }}>\n {item.required ? (\n <TextSymbolWrapper text={labelContent} symbolType=\"required\" />\n ) : (\n labelContent\n )}\n </span>\n {ellipsisFt ? (\n <span className=\"label-value-value\" style={props.valueStyle}>\n <TextOverflow text={item.value as string} />\n </span>\n ) : (\n <span className=\"label-value-value\" style={props.valueStyle}>\n {item.value}\n </span>\n )}\n </Fragment>\n ) : (\n <Fragment />\n )}\n </BoxGrid.Col>\n );\n })\n .filter(Boolean);\n };\n\n const onBoxBreakpointChange = hooks.useCallbackRef((breakpoint: TBoxBreakpoint) => {\n setBreakpoint(breakpoint);\n });\n\n const innerStyle = useMemo(() => {\n /** 小屏幕不控制宽度 */\n if (['xs', 'sm'].includes(screenType) || !width) {\n return {};\n }\n return { width };\n }, [screenType]);\n\n const align = labelAlign || (border ? 'left' : 'right');\n\n return (\n <BoxGrid.Row\n style={{ ...innerStyle, ...props.style }}\n className={classNames(\n 'label-value-render',\n `label-value-render-${align}`,\n {\n 'label-value-render-border': border,\n 'label-value-render-vertical': isVertical,\n },\n props.className,\n )}\n gutter={border ? [0, 0] : [30, 0]}\n onBoxBreakpointChange={onBoxBreakpointChange}\n >\n {getFormRowChildren()}\n </BoxGrid.Row>\n );\n};\n"],"names":["getRenderGrid","dataList","results","currentSum","currentArr","i","length","item","grid","temp","_extends","push","map","index","total","arrayTotal","lastItem","isLast","resultsFt","forEach","concat","console","log","LabelValueRender","props","screenType","fbaHooks","useResponsivePoint","_useState","useState","breakpoint","setBreakpoint","column","forceColumn","labelAlign","labelWidth","border","width","ellipsis","isUndefinedOrNull","isVertical","gridSize","useMemo","num","xs","sm","md","lg","xl","xxl","columnMap","renderList","undefined","dataListNew","hidden","span","filter","Boolean","colon","getFormRowChildren","ellipsisFt","labelContent","label","tips","_jsx","TipsWrapper","tipType","tooltipProps","title","children","TextOverflow","text","BoxGrid","Col","className","_classNames","replenish","_jsxs","Fragment","style","labelStyle","required","TextSymbolWrapper","symbolType","valueStyle","value","onBoxBreakpointChange","_hooks","useCallbackRef","innerStyle","includes","align","Row","gutter"],"mappings":";svBAGO,IAAMA,EAAgB,SAAhBA,EAAiBC,GAC5B,IAAIC,EAAqC,GAEzC,IAAIC,EAAa,EACjB,IAAIC,EAAsC,GAC1C,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,EAASK,OAAQD,IAAK,CACxC,IAAME,EAAON,EAASI,GACtB,IAAMG,EAAOD,EAAKC,KAClB,IAAMC,EAAIC,EAAA,CAAA,EACLH,EAAI,CACPC,KAAMA,IAER,GAAIL,EAAaK,GAAQ,IAAMA,EAAO,EAAG,CACvCL,GAAcK,EACdJ,EAAWO,KAAKF,EAClB,KAAO,CACLP,EAAQS,KAAKP,GACbD,EAAaK,EACbJ,EAAa,CAACK,EAChB,CACF,CAEA,GAAIL,EAAWE,OAAS,EAAG,CACzBJ,EAAQS,KAAKP,EACf,CACA,GAAIF,EAAQI,OAAS,EAAG,CACtBJ,EAAUA,EAAQU,KAAI,SAACL,EAAMM,GAC3B,GAAIN,EAAKD,SAAW,EAAG,CACrBC,EAAK,GAAGC,KAAO,EACjB,KAAO,CACL,IAAMM,EAAQC,EAAWR,EAAM,QAC/B,IAAMS,EAAWT,EAAKA,EAAKD,OAAS,GACpC,GAAIQ,EAAQ,GAAI,CACdE,EAASR,KAAO,GAAKM,EAAQE,EAASR,IACxC,CACF,CACA,GAAIK,IAAUX,EAA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CACZc,KAAMhD,EAAKC,KACXkE,UAAWC,EAAW,iBAAkB,CAAE,sBAAuBpE,EAAKU,SAAUoD,UAE9E9D,EAAKqE,UACLC,EAACC,EAAQ,CAAAT,UACPL,EAAA,OAAA,CAAMU,UAAU,oBAAoBK,MAAKrE,EAAA,CAAI2B,MAAAA,GAAUb,EAAMwD,YAAaX,SACvE9D,EAAK0E,SACJjB,EAACkB,EAAiB,CAACX,KAAMV,EAAcsB,WAAW,aAElDtB,IAGHD,EACCI,EAAA,OAAA,CAAMU,UAAU,oBAAoBK,MAAOvD,EAAM4D,WAAWf,SAC1DL,EAACM,EAAY,CAACC,KAAMhE,EAAK8E,UAG3BrB,EAAA,OAAA,CAAMU,UAAU,oBAAoBK,MAAOvD,EAAM4D,WAAWf,SACzD9D,EAAK8E,WAKZrB,EAACc,EAAU,MAzBRjE,EA6BX,IACC2C,OAAOC,UAGZ,IAAM6B,EAAwBC,EAAMC,gBAAe,SAAC1D,GAClDC,EAAcD,EAChB,IAEA,IAAM2D,EAAa/C,GAAQ,WAEzB,GAAI,CAAC,KAAM,MAAMgD,SAASjE,KAAgBY,EAAO,CAC/C,MAAO,EACT,CACA,MAAO,CAAEA,MAAAA,EACX,GAAG,CAACZ,IAEJ,IAAMkE,EAAQzD,IAAeE,EAAS,OAAS,SAE/C,OACE4B,EAACQ,EAAQoB,IAAG,CACVb,MAAKrE,EAAO+E,CAAAA,EAAAA,EAAejE,EAAMuD,OACjCL,UAAWC,EACT,qBAAoB,sBACEgB,EACtB,CACE,4BAA6BvD,EAC7B,8BAA+BI,GAEjChB,EAAMkD,WAERmB,OAAQzD,EAAS,CAAC,EAAG,GAAK,CAAC,GAAI,GAC/BkD,sBAAuBA,EAAsBjB,SAE5CV,KAGP"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/label-value-render/utils.ts","@flatbiz/antd/src/label-value-render/label-value.tsx"],"sourcesContent":["import { arrayTotal } from '@flatbiz/utils';\nimport { TLabelValueRenderItem } from './types';\n\nexport const getRenderGrid = (dataList: TLabelValueRenderItem[]) => {\n let results: TLabelValueRenderItem[][] = [];\n\n let currentSum = 0;\n let currentArr: TLabelValueRenderItem[] = [];\n for (let i = 0; i < dataList.length; i++) {\n const item = dataList[i];\n const grid = item.grid as number;\n const temp = {\n ...item,\n grid: grid,\n } as TLabelValueRenderItem;\n if (currentSum + grid <= 24 && grid > 0) {\n currentSum += grid;\n currentArr.push(temp);\n } else {\n results.push(currentArr);\n currentSum = grid;\n currentArr = [temp];\n }\n }\n\n if (currentArr.length > 0) {\n results.push(currentArr);\n }\n if (results.length > 0) {\n results = results.map((item, index) => {\n if (item.length === 1) {\n item[0].grid = 24;\n } else {\n const total = arrayTotal(item, 'grid');\n const lastItem = item[item.length - 1];\n if (total < 24) {\n lastItem.grid = 24 - total + lastItem.grid;\n }\n }\n if (index === results.length - 1) {\n return item.map((temp) => {\n temp.isLast = true;\n return temp;\n });\n }\n return item;\n });\n }\n\n let resultsFt: TLabelValueRenderItem[] = [];\n results.forEach((item) => {\n resultsFt = resultsFt.concat(item);\n });\n console.log('resultsFt', resultsFt);\n return resultsFt;\n};\n","import { CSSProperties, Fragment, ReactElement, useMemo, useState } from 'react';\n\nimport { classNames } from '@dimjs/utils';\nimport { BoxGrid, fbaHooks, TBoxBreakpoint, TextSymbolWrapper } from '@flatbiz/antd';\nimport { isUndefinedOrNull } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { TextOverflow } from '../text-overflow';\nimport { TipsWrapper } from '../tips-wrapper';\nimport './style.less';\nimport { TLabelValueItem, TLabelValueRenderItem } from './types';\nimport { getRenderGrid } from './utils';\n\nexport type LabelValueRenderProps = {\n className?: string;\n style?: CSSProperties;\n /**\n * 定义一行显示几列, 默认值:4\n * ```\n * 1. 当外层宽度尺寸大于 992px(lg) 时,一行显示几列\n * 1. 当外层宽度尺寸小于992px(lg),为xs、sm、md情况下不受column值影响,响应式布局\n * 2. 宽度尺寸定义\n * xs: 宽度 < 576px\n * sm: 宽度 ≥ 576px\n * md: 宽度 ≥ 768px\n * lg: 宽度 ≥ 992px\n * xl: 宽度 ≥ 1200px\n * xxl: 宽度 ≥ 1600px\n * 3. 列数尺寸定义\n * {\n * 1: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24, xxl: 24 },\n * 2: { xs: 24, sm: 12, md: 12, lg: 12, xl: 12, xxl: 12 },\n * 3: { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 8 },\n * 4: { xs: 24, sm: 12, md: 12, lg: 6, xl: 6, xxl: 6 },\n * };\n * ```\n */\n column?: 1 | 2 | 3 | 4;\n /**\n * 强制定义一行显示几列,不考虑响应式\n * ```\n * 1. 优先级大于column\n * 2. 建议优先使用column配置\n * ```\n */\n forceColumn?: 1 | 2 | 3 | 4;\n /** 数据源配置 */\n options: TLabelValueItem[];\n /**\n * 超过宽度将自动省略,默认值:true\n */\n ellipsis?: boolean;\n /** 是否添加边框 */\n border?: boolean;\n /** label对齐方式 */\n labelAlign?: 'left' | 'right' | 'center';\n /** label 宽度,默认值:100 */\n labelWidth?: number;\n width?: number;\n /** label 样式 */\n labelStyle?: CSSProperties;\n /** value 样式 */\n valueStyle?: CSSProperties;\n};\n\n/**\n * label+value 列表布局\n * ```\n * 1. 可设置超出隐藏、必填标识、设置隐藏、添加说明标签等功能\n * 2. 可自定义设置占用网格列数\n * 3. 内置响应式布局\n * ```\n */\nexport const LabelValueRender = (props: LabelValueRenderProps) => {\n const screenType = fbaHooks.useResponsivePoint() || '';\n const [breakpoint, setBreakpoint] = useState<TBoxBreakpoint>();\n\n const { column, forceColumn, labelAlign, labelWidth, options, border, width } = props;\n\n const ellipsis = isUndefinedOrNull(props.ellipsis) ? true : props.ellipsis;\n\n const isVertical = !border ? screenType === 'xs' || breakpoint === 'xs' : false;\n\n const gridSize = useMemo(() => {\n if (forceColumn) {\n const num = 24 / forceColumn;\n return { xs: num, sm: num, md: num, lg: num, xl: num, xxl: num };\n }\n const columnMap = {\n 1: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24, xxl: 24 },\n 2: { xs: 24, sm: 12, md: 12, lg: 12, xl: 12, xxl: 12 },\n 3: { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 8 },\n 4: { xs: 24, sm: 12, md: 12, lg: 6, xl: 6, xxl: 6 },\n };\n return !column ? columnMap[4] : columnMap[column];\n }, [column, forceColumn]);\n\n const renderList = useMemo(() => {\n if (!breakpoint) return undefined;\n const dataListNew: TLabelValueRenderItem[] = [];\n options.forEach((item) => {\n if (!item.hidden) {\n let grid: number | undefined = undefined;\n if (item.span) {\n grid = item.span * 6;\n if (breakpoint === 'xs') {\n grid = 24;\n } else if (breakpoint === 'sm') {\n grid = grid > 12 ? grid : 12;\n }\n }\n dataListNew.push({\n ...item,\n grid: grid ? grid : gridSize[breakpoint],\n });\n }\n });\n\n return getRenderGrid(dataListNew.filter(Boolean));\n }, [breakpoint, gridSize]);\n\n const colon = border ? '' : ':';\n\n const getFormRowChildren = () => {\n return renderList\n ?.map((item, index) => {\n const ellipsisFt = isUndefinedOrNull(item.ellipsis) ? ellipsis : item.ellipsis;\n\n const width = isVertical ? undefined : labelWidth || 100;\n\n let labelContent: ReactElement | string = `${item.label}${colon}`;\n\n if (item.tips && ellipsisFt) {\n labelContent = (\n <TipsWrapper tipType=\"tooltip\" tooltipProps={{ title: item.tips }}>\n <TextOverflow text={labelContent as unknown as string} />\n </TipsWrapper>\n );\n } else if (item.tips) {\n labelContent = (\n <TipsWrapper tipType=\"tooltip\" tooltipProps={{ title: item.tips }}>\n {labelContent}\n </TipsWrapper>\n );\n } else if (ellipsisFt) {\n labelContent = <TextOverflow text={labelContent as unknown as string} />;\n }\n\n return (\n <BoxGrid.Col\n key={index}\n {...gridSize}\n span={item.grid}\n className={classNames('label-value-tr', { 'label-value-last-tr': item.isLast })}\n >\n {!item.replenish ? (\n <Fragment>\n <span className=\"label-value-label\" style={{ width, ...props.labelStyle }}>\n {item.required ? (\n <TextSymbolWrapper text={labelContent} symbolType=\"required\" />\n ) : (\n labelContent\n )}\n </span>\n {ellipsisFt ? (\n <span className=\"label-value-value\" style={props.valueStyle}>\n <TextOverflow text={item.value as string} />\n </span>\n ) : (\n <span className=\"label-value-value\" style={props.valueStyle}>\n {item.value}\n </span>\n )}\n </Fragment>\n ) : (\n <Fragment />\n )}\n </BoxGrid.Col>\n );\n })\n .filter(Boolean);\n };\n\n const onBoxBreakpointChange = hooks.useCallbackRef((breakpoint: TBoxBreakpoint) => {\n setBreakpoint(breakpoint);\n });\n\n const innerStyle = useMemo(() => {\n /** 小屏幕不控制宽度 */\n if (['xs', 'sm'].includes(screenType) || !width) {\n return {};\n }\n return { width };\n }, [screenType]);\n\n const align = labelAlign || (border ? 'left' : 'right');\n\n return (\n <BoxGrid.Row\n style={{ ...innerStyle, ...props.style }}\n className={classNames(\n 'label-value-render',\n `label-value-render-${align}`,\n {\n 'label-value-render-border': border,\n 'label-value-render-vertical': isVertical,\n },\n props.className,\n )}\n gutter={border ? [0, 0] : [30, 0]}\n onBoxBreakpointChange={onBoxBreakpointChange}\n >\n {getFormRowChildren()}\n </BoxGrid.Row>\n );\n};\n"],"names":["getRenderGrid","dataList","results","currentSum","currentArr","i","length","item","grid","temp","_extends","push","map","index","total","arrayTotal","lastItem","isLast","resultsFt","forEach","concat","console","log","LabelValueRender","props","screenType","fbaHooks","useResponsivePoint","_useState","useState","breakpoint","setBreakpoint","column","forceColumn","labelAlign","labelWidth","options","border","width","ellipsis","isUndefinedOrNull","isVertical","gridSize","useMemo","num","xs","sm","md","lg","xl","xxl","columnMap","renderList","undefined","dataListNew","hidden","span","filter","Boolean","colon","getFormRowChildren","ellipsisFt","labelContent","label","tips","_jsx","TipsWrapper","tipType","tooltipProps","title","children","TextOverflow","text","BoxGrid","Col","className","_classNames","replenish","_jsxs","Fragment","style","labelStyle","required","TextSymbolWrapper","symbolType","valueStyle","value","onBoxBreakpointChange","_hooks","useCallbackRef","innerStyle","includes","align","Row","gutter"],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BrB,EAAA,OAAA,CAAMU,UAAU,oBAAoBK,MAAOxD,EAAM6D,WAAWf,SACzD/D,EAAK+E,WAKZrB,EAACc,EAAU,MAzBRlE,EA6BX,IACC4C,OAAOC,UAGZ,IAAM6B,EAAwBC,EAAMC,gBAAe,SAAC3D,GAClDC,EAAcD,EAChB,IAEA,IAAM4D,EAAa/C,GAAQ,WAEzB,GAAI,CAAC,KAAM,MAAMgD,SAASlE,KAAgBa,EAAO,CAC/C,MAAO,EACT,CACA,MAAO,CAAEA,MAAAA,EACX,GAAG,CAACb,IAEJ,IAAMmE,EAAQ1D,IAAeG,EAAS,OAAS,SAE/C,OACE4B,EAACQ,EAAQoB,IAAG,CACVb,MAAKtE,EAAOgF,CAAAA,EAAAA,EAAelE,EAAMwD,OACjCL,UAAWC,EACT,qBAAoB,sBACEgB,EACtB,CACE,4BAA6BvD,EAC7B,8BAA+BI,GAEjCjB,EAAMmD,WAERmB,OAAQzD,EAAS,CAAC,EAAG,GAAK,CAAC,GAAI,GAC/BkD,sBAAuBA,EAAsBjB,SAE5CV,KAGP"}
|
package/index.d.ts
CHANGED
|
@@ -559,6 +559,8 @@ export type CardLayoutProps = {
|
|
|
559
559
|
desc?: string | string[] | ReactElement | ReactElement[];
|
|
560
560
|
/** 标题 */
|
|
561
561
|
title?: string | ReactElement;
|
|
562
|
+
/** 子标题,在标题右侧 */
|
|
563
|
+
subTitle?: string | ReactElement;
|
|
562
564
|
/**
|
|
563
565
|
* layoutType 布局类型
|
|
564
566
|
* ```
|
|
@@ -571,6 +573,7 @@ export type CardLayoutProps = {
|
|
|
571
573
|
titleLeftLine?: boolean;
|
|
572
574
|
titleStyle?: CSSProperties;
|
|
573
575
|
titleContentStyle?: CSSProperties;
|
|
576
|
+
subTitleStyle?: CSSProperties;
|
|
574
577
|
titleExtraStyle?: CSSProperties;
|
|
575
578
|
contentStyle?: CSSProperties;
|
|
576
579
|
/** 优先级大于 style padding */
|
|
@@ -1884,12 +1887,15 @@ export type DragFormListProps = {
|
|
|
1884
1887
|
formListChildrenWrapper?: (props: {
|
|
1885
1888
|
children: ReactElement;
|
|
1886
1889
|
}) => ReactElement;
|
|
1890
|
+
/** Antd Form.List rules 属性 */
|
|
1887
1891
|
rules?: FormListProps["rules"];
|
|
1888
1892
|
/**
|
|
1889
1893
|
* 设置FormList字段标题&必填标志
|
|
1890
1894
|
* ```
|
|
1891
1895
|
* demo: http://dev.flatjs.com:6007/pages/flat/oss-demo/main/form/list?env=me
|
|
1892
1896
|
* 1. 会根据数组顺序进行渲染
|
|
1897
|
+
* 2. 未设置width的元素,参与等分剩余宽度
|
|
1898
|
+
* 3. 设置width 要与FormList children中的item宽度相同,不然内容与标题无法对齐
|
|
1893
1899
|
* ```
|
|
1894
1900
|
*/
|
|
1895
1901
|
formListItemTitleList?: {
|
|
@@ -1899,12 +1905,15 @@ export type DragFormListProps = {
|
|
|
1899
1905
|
}[];
|
|
1900
1906
|
/** formListItemTitle HorizontalUnionProps 配置 */
|
|
1901
1907
|
formListItemTitleHorizontalUnionProps?: Omit<FormItemHorizontalUnionProps, "groupConfigList">;
|
|
1908
|
+
/** FormList Item 之间间隙 */
|
|
1909
|
+
itemGap?: number;
|
|
1902
1910
|
};
|
|
1903
1911
|
/**
|
|
1904
1912
|
* 可拖拽FormList
|
|
1905
1913
|
* ```
|
|
1906
1914
|
* Demo: https://fex.qa.tcshuke.com/docs/admin/main/form/list
|
|
1907
1915
|
* 1. FormList数组中必须要有唯一值字段,默认值字段名称uid,可通过uidFieldName自定义设置
|
|
1916
|
+
* 2. 通过 itemGap 设置FormList Item 之间间隙
|
|
1908
1917
|
* ```
|
|
1909
1918
|
*/
|
|
1910
1919
|
export declare const DragFormList: (props: DragFormListProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2186,10 +2195,11 @@ export type EasyTableProps = {
|
|
|
2186
2195
|
/**
|
|
2187
2196
|
* 缓存查询条件开关,默认false
|
|
2188
2197
|
* ```
|
|
2189
|
-
* 是否缓存表格查询条件,在路由跳转回来时,不会丢失
|
|
2198
|
+
* 1. 是否缓存表格查询条件,在路由跳转回来时,不会丢失
|
|
2199
|
+
* 2. 如果一个页面有多个EasyTable,并需要缓存查询条件,可设置cacheSwitch为唯一字符串
|
|
2190
2200
|
* ```
|
|
2191
2201
|
*/
|
|
2192
|
-
cacheSwitch?: boolean;
|
|
2202
|
+
cacheSwitch?: boolean | string;
|
|
2193
2203
|
/** 接口数据配置 */
|
|
2194
2204
|
serviceConfig: EasyTableServiceConfig;
|
|
2195
2205
|
/**
|
|
@@ -3026,12 +3036,15 @@ export type FormListWrapperProps = {
|
|
|
3026
3036
|
}[];
|
|
3027
3037
|
/** formListItemTitle HorizontalUnionProps 配置 */
|
|
3028
3038
|
formListItemTitleHorizontalUnionProps?: Omit<FormItemHorizontalUnionProps, "groupConfigList">;
|
|
3039
|
+
/** FormList Item 之间间隙 */
|
|
3040
|
+
itemGap?: number;
|
|
3029
3041
|
};
|
|
3030
3042
|
/**
|
|
3031
3043
|
* Form.List 包装组件,使用更简单
|
|
3032
3044
|
* ```
|
|
3033
3045
|
* Demo: https://fex.qa.tcshuke.com/docs/admin/main/form/list
|
|
3034
3046
|
* 1. FormList数组中必须要有唯一值字段,默认值字段名称uid,可通过uidFieldName自定义设置
|
|
3047
|
+
* 2. 通过 itemGap 设置FormList Item 之间间隙
|
|
3035
3048
|
* ```
|
|
3036
3049
|
*/
|
|
3037
3050
|
export declare const FormListWrapper: (props: FormListWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3164,13 +3177,14 @@ export type LabelValueLayoutProps = {
|
|
|
3164
3177
|
borderedRowPadding?: CSSProperties["padding"];
|
|
3165
3178
|
};
|
|
3166
3179
|
/**
|
|
3180
|
+
* @deprecated 已过期,请使用 LabelValueRender 组件
|
|
3167
3181
|
* options[].span 是 Description.Item 的数量。 span={2} 会占用两个 DescriptionItem 的宽度
|
|
3168
3182
|
* options[].hidden 是否隐藏 Description.Item
|
|
3169
3183
|
*/
|
|
3170
3184
|
export declare const LabelValueLayout: (props: LabelValueLayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
3171
3185
|
export type TLabelValueItem = {
|
|
3172
3186
|
label: string | ReactElement;
|
|
3173
|
-
value
|
|
3187
|
+
value?: string | number | ReactElement;
|
|
3174
3188
|
/** 一行有4列,当前labelValue数据占用的列数,默认是根据LabelValueRender.column配置来 */
|
|
3175
3189
|
span?: 1 | 2 | 3 | 4;
|
|
3176
3190
|
/** 是否隐藏 */
|
|
@@ -3186,7 +3200,7 @@ export type LabelValueRenderProps = {
|
|
|
3186
3200
|
className?: string;
|
|
3187
3201
|
style?: CSSProperties;
|
|
3188
3202
|
/**
|
|
3189
|
-
* 定义一行显示几列, 默认值:
|
|
3203
|
+
* 定义一行显示几列, 默认值:4
|
|
3190
3204
|
* ```
|
|
3191
3205
|
* 1. 当外层宽度尺寸大于 992px(lg) 时,一行显示几列
|
|
3192
3206
|
* 1. 当外层宽度尺寸小于992px(lg),为xs、sm、md情况下不受column值影响,响应式布局
|
|
@@ -3216,7 +3230,7 @@ export type LabelValueRenderProps = {
|
|
|
3216
3230
|
*/
|
|
3217
3231
|
forceColumn?: 1 | 2 | 3 | 4;
|
|
3218
3232
|
/** 数据源配置 */
|
|
3219
|
-
|
|
3233
|
+
options: TLabelValueItem[];
|
|
3220
3234
|
/**
|
|
3221
3235
|
* 超过宽度将自动省略,默认值:true
|
|
3222
3236
|
*/
|