zy-react-library 1.2.37 → 1.2.39

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.
@@ -176,8 +176,15 @@ export type FormOptionCustomRender<O extends boolean = false, C extends boolean
176
176
  * 表单配置项
177
177
  */
178
178
  export type FormOption
179
- = { [K in keyof FORM_ITEM_RENDER_TYPE_MAP]: FormOptionByRender<K, false, false> }[keyof FORM_ITEM_RENDER_TYPE_MAP]
180
- ;
179
+ = | FormOptionDefault<false, false>
180
+ | FormOptionDefault<false, true>
181
+ | FormOptionDefault<true, false>
182
+ | { [K in keyof FORM_ITEM_RENDER_TYPE_MAP]: FormOptionByRender<K, false, false> }[keyof FORM_ITEM_RENDER_TYPE_MAP]
183
+ | { [K in keyof FORM_ITEM_RENDER_TYPE_MAP]: FormOptionByRender<K, false, true> }[keyof FORM_ITEM_RENDER_TYPE_MAP]
184
+ | { [K in keyof FORM_ITEM_RENDER_TYPE_MAP]: FormOptionByRender<K, true, false> }[keyof FORM_ITEM_RENDER_TYPE_MAP]
185
+ | FormOptionCustomRender<false, false>
186
+ | FormOptionCustomRender<false, true>
187
+ | FormOptionCustomRender<true, false>;
181
188
 
182
189
  /**
183
190
  * FormItemsRenderer 组件属性
@@ -25,7 +25,7 @@ export interface PageProps {
25
25
  /** 额外底部操作按钮组 */
26
26
  extraActionButtons?: ReactNode;
27
27
  /** 内容区域 */
28
- children?: ReactNode | (() => ReactNode);
28
+ children: ReactNode | (() => ReactNode);
29
29
  }
30
30
 
31
31
  /** 页面布局组件 */
@@ -18,6 +18,8 @@ export type TableProps<DataSource, U, ValueType> = Omit<AntdTableProps, "columns
18
18
  align?: "left" | "right" | "center";
19
19
  /** 超过宽度是否自动省略,默认 true */
20
20
  ellipsis?: boolean;
21
+ /** 表格高度,默认自适应 */
22
+ height?: number;
21
23
  };
22
24
 
23
25
  /**
@@ -1 +1 @@
1
- import{ProTable as e}from"@ant-design/pro-components";import t from"dayjs";import{useState as o,useEffect as n,useMemo as r}from"react";import{throttle as s}from"throttle-debounce";import{useAntdResizableHeader as a}from"use-antd-resizable-header";import{getDataType as i,getIndexColumn as l}from"../../utils/index.js";import"use-antd-resizable-header/dist/style.css";import"./index.less";import{jsx as c}from"react/jsx-runtime";const d="tableLocalStorageLastCleanup";function m(e){const t=process.env?.app?.basename,o=decodeURIComponent(window.location.pathname),n="Undefined"===i(e)?"":`#{${e}}`;return{size:`${t}#${o}${n}#size`,resizable:`${t}#${o}${n}#resizable`,columnState:`${t}#${o}${n}#columnState`}}function u(i){const{columns:u=[],showIndexColumn:p=!0,ellipsis:b=!0,align:f="center",indexColumnFixed:g="left",rowKey:h="id",storeIndex:y,disabledResizer:S=!1,...w}=i,z=process.env.app.antd["ant-prefix"],$=`.${z||"ant"}-table`,x=`${$}-wrapper`,v=`${$}-body`,[C,I]=o((R=y,window.localStorage.getItem(m(R).size)||"default"));var R;const[_,E]=o(0),K=m(y),N=!S,{components:T,resizableColumns:W,tableWidth:j,resetColumns:k}=a({columns:u,columnsState:{persistenceKey:K.resizable,persistenceType:"localStorage"}}),q=s(50,()=>{try{const e=document.querySelector(x),t=document.querySelector(v),o=document.querySelector(".page-layout-footer"),n=o?o.offsetHeight:0;if(t&&e){const o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s=o.bottom-r.bottom;E(innerHeight-r.top-s-(window.__IN_BASE__?38:22)-n)}}catch(e){window.console.error(e)}});n(()=>{let e,o;return N&&(e=new MutationObserver(e=>e.forEach(()=>q())),o=new ResizeObserver(e=>e.forEach(()=>q())),setTimeout(()=>q(),500),o.observe(document.body),e.observe(document.body,{subtree:!0,childList:!0})),function(){const e=t(),o=localStorage.getItem(d),n=o?t(o):null;if(!n||e.diff(n,"day")>=10){const t=[];for(let e=0;e<localStorage.length;e++){const o=localStorage.key(e);o&&(o.endsWith("#columnState")||o.endsWith("#size")||o.endsWith("#resizable"))&&t.push(o)}t.forEach(e=>{localStorage.removeItem(e)}),localStorage.setItem(d,e.toISOString())}}(),()=>{e&&o&&N&&(o.unobserve(document.body),e.disconnect(document.body))}},[]),n(()=>{!function(e,t){window.localStorage.setItem(m(t).size,e)}(C,y)},[C]);const B=r(()=>(()=>{const e=[...W];p&&e.unshift({...l(i.pagination),fixed:g});const t=e=>({align:f,ellipsis:b,...e,...e.children?{children:e.children.map(t)}:{}});return e.map(t)})(),[W,p,f,b,g,i.pagination]);return c("div",{className:"table-layout card-layout",children:c(e,{ghost:!0,search:!1,scroll:{x:j,y:N?_:void 0},options:{reload:!1,fullScreen:!0,setting:{checkedReset:!0,extra:c("a",{className:`${z}-pro-table-column-setting-action-rest-button`,onClick:k,children:"重置列宽"})}},components:T,columnsState:{persistenceKey:K.columnState,persistenceType:"localStorage"},onSizeChange:I,columns:B,bordered:!0,size:"small",rowKey:h,...w})})}u.displayName="Table";export{u as default};
1
+ import{ProTable as e}from"@ant-design/pro-components";import t from"dayjs";import{useState as o,useEffect as n,useMemo as r}from"react";import{throttle as s}from"throttle-debounce";import{useAntdResizableHeader as a}from"use-antd-resizable-header";import{getDataType as i,getIndexColumn as l}from"../../utils/index.js";import"use-antd-resizable-header/dist/style.css";import"./index.less";import{jsx as c}from"react/jsx-runtime";const d="tableLocalStorageLastCleanup";function m(e){const t=process.env?.app?.basename,o=decodeURIComponent(window.location.pathname),n="Undefined"===i(e)?"":`#{${e}}`;return{size:`${t}#${o}${n}#size`,resizable:`${t}#${o}${n}#resizable`,columnState:`${t}#${o}${n}#columnState`}}function u(i){const{columns:u=[],showIndexColumn:p=!0,ellipsis:b=!0,align:g="center",indexColumnFixed:f="left",rowKey:h="id",storeIndex:y,disabledResizer:S=!1,height:w,...z}=i,$=process.env.app.antd["ant-prefix"],x=`.${$||"ant"}-table`,v=`${x}-wrapper`,C=`${x}-body`,[I,R]=o((_=y,window.localStorage.getItem(m(_).size)||"default"));var _;const[E,K]=o(0),N=m(y),T=!S,{components:W,resizableColumns:j,tableWidth:k,resetColumns:q}=a({columns:u,columnsState:{persistenceKey:N.resizable,persistenceType:"localStorage"}}),B=s(50,()=>{try{const e=document.querySelector(v),t=document.querySelector(C),o=document.querySelector(".page-layout-footer"),n=o?o.offsetHeight:0;if(t&&e){const o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s=o.bottom-r.bottom;K(innerHeight-r.top-s-(window.__IN_BASE__?38:22)-n)}}catch(e){window.console.error(e)}});n(()=>{let e,o;return T&&(e=new MutationObserver(e=>e.forEach(()=>B())),o=new ResizeObserver(e=>e.forEach(()=>B())),setTimeout(()=>B(),500),o.observe(document.body),e.observe(document.body,{subtree:!0,childList:!0})),function(){const e=t(),o=localStorage.getItem(d),n=o?t(o):null;if(!n||e.diff(n,"day")>=10){const t=[];for(let e=0;e<localStorage.length;e++){const o=localStorage.key(e);o&&(o.endsWith("#columnState")||o.endsWith("#size")||o.endsWith("#resizable"))&&t.push(o)}t.forEach(e=>{localStorage.removeItem(e)}),localStorage.setItem(d,e.toISOString())}}(),()=>{e&&o&&T&&(o.unobserve(document.body),e.disconnect(document.body))}},[]),n(()=>{!function(e,t){window.localStorage.setItem(m(t).size,e)}(I,y)},[I]);const L=r(()=>(()=>{const e=[...j];p&&e.unshift({...l(i.pagination),fixed:f});const t=e=>({align:g,ellipsis:b,...e,...e.children?{children:e.children.map(t)}:{}});return e.map(t)})(),[j,p,g,b,f,i.pagination]);return c("div",{className:"table-layout card-layout",children:c(e,{ghost:!0,search:!1,scroll:{x:k,y:w||(T?E:void 0)},options:{reload:!1,fullScreen:!0,setting:{checkedReset:!0,extra:c("a",{className:`${$}-pro-table-column-setting-action-rest-button`,onClick:q,children:"重置列宽"})}},components:W,columnsState:{persistenceKey:N.columnState,persistenceType:"localStorage"},onSizeChange:R,columns:L,bordered:!0,size:"small",rowKey:h,...z})})}u.displayName="Table";export{u as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "1.2.37",
4
+ "version": "1.2.39",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",