@zonos/amino 5.4.8 → 5.4.10
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
2
|
import type { BaseProps } from "../../types/BaseProps";
|
|
3
3
|
import type { ReactComponent } from "../../types/ReactComponent";
|
|
4
4
|
type SimpleTableHeaderBaseProps = {
|
|
@@ -17,6 +17,11 @@ type SimpleTableHeaderBaseProps = {
|
|
|
17
17
|
* Disable padding on cells
|
|
18
18
|
*/
|
|
19
19
|
noPadding?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Determines cell content wrapping method
|
|
22
|
+
* @default 'nowrap'
|
|
23
|
+
*/
|
|
24
|
+
textWrapMethod?: 'truncate' | 'normal' | 'nowrap';
|
|
20
25
|
/**
|
|
21
26
|
* Minimum width of column in percent
|
|
22
27
|
* @default undefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../../_tslib-bd4862e8.js"),l=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";var e=require("../../_tslib-bd4862e8.js"),l=require("react/jsx-runtime"),t=require("react"),o=require("clsx"),i=require("../checkbox/Checkbox.js"),a=require("../skeleton/Skeleton.js"),n=require("../text/Text.js"),d=require("../tooltip/Tooltip.js"),r=require("../../style-inject.es-d4ddeae4.js");function s(e){return e&&e.__esModule?e:{default:e}}require("framer-motion"),require("../help-text/HelpText.js"),require("../../styles/constants/theme.js"),require("../../icons/CheckmarkIcon.js"),require("../../icons/icon-base/_IconBase.js"),require("../../global.module-569e4fd5.js"),require("../../utils/getTestId.js"),require("@mui/material/styles"),require("@mui/material/Tooltip"),require("../flex/Flex.js");var m=s(t),c=s(o),u="Amino_SimpleTable-module__tableContainer--UsGFZ",b="Amino_SimpleTable-module__tableStyled--Q3YSy",_="Amino_SimpleTable-module__noPadding--b5Y-c",h="Amino_SimpleTable-module__withHover--eL3XX",p="Amino_SimpleTable-module__clickable--XnaaE",y="Amino_SimpleTable-module__allowTextWrap--yVvjm",S="Amino_SimpleTable-module__loading--bvjof",x="Amino_SimpleTable-module__skeletonCellWrapper--I8vJ7",v="Amino_SimpleTable-module__shouldTruncate--x-zmL",g="Amino_SimpleTable-module__styledCheckbox---753a";r.styleInject(".Amino_SimpleTable-module__tableContainer--UsGFZ{width:100%}.Amino_SimpleTable-module__tableStyled--Q3YSy{border-collapse:initial;border-spacing:0;font-size:var(--amino-font-size-base);width:100%}.Amino_SimpleTable-module__tableStyled--Q3YSy>thead{text-transform:none}.Amino_SimpleTable-module__tableStyled--Q3YSy>thead>tr{border-bottom:var(--amino-border-subtle);height:48px}.Amino_SimpleTable-module__tableStyled--Q3YSy>thead>tr>th{background-color:var(--amino-gray-0);border-bottom:var(--amino-border-subtle);padding:12px;position:-webkit-sticky;position:sticky;top:0;white-space:nowrap}.Amino_SimpleTable-module__tableStyled--Q3YSy>thead>tr>th.Amino_SimpleTable-module__noPadding--b5Y-c{padding:0}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr{height:48px}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr.Amino_SimpleTable-module__withHover--eL3XX:hover{background-color:var(--amino-hover-color)}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr.Amino_SimpleTable-module__clickable--XnaaE{cursor:pointer}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr:not(:hover) .row-hover-show{visibility:collapse}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td{border-bottom:var(--amino-border-subtle);padding:0}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td>:first-child{display:block;height:100%;padding:12px;white-space:nowrap;width:100%}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td>:first-child.Amino_SimpleTable-module__noPadding--b5Y-c{padding:0}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td>:first-child.Amino_SimpleTable-module__allowTextWrap--yVvjm{white-space:normal}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td>:first-child.Amino_SimpleTable-module__loading--bvjof{text-align:center}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td>:first-child.Amino_SimpleTable-module__skeletonCellWrapper--I8vJ7{display:flex}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td>:first-child:not(:hover) .cell-hover-show{visibility:collapse}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td.Amino_SimpleTable-module__shouldTruncate--x-zmL{max-width:0}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td.Amino_SimpleTable-module__shouldTruncate--x-zmL>:first-child{overflow:hidden;text-overflow:ellipsis}.Amino_SimpleTable-module__styledCheckbox---753a{display:inline-flex;padding:12px}");var T=function(e){switch(e){case"center":return"center";case"end":return"flex-end";default:return"flex-start"}};exports.SimpleTable=function(o){var r=o.className,s=o.CustomLinkComponent,j=o.getRowLink,k=o.headers,f=o.items,A=o.keyExtractor,C=o.loading,w=void 0!==C&&C,Y=o.loadingItems,q=void 0===Y?10:Y,Q=o.loadingSkeletonHeight,N=void 0===Q?13:Q,H=o.maxHeight,R=void 0===H?"100%":H,L=o.noHoverBackground,W=void 0!==L&&L,F=o.onRowClick,I=o.onRowHover,M=o.renderFooter,P=o.selectable,X=void 0===P?{enabled:!1}:P,z=o.style,E=function(e,t){var o=t[e.key],i=function(o){var i=m.default.Children.toArray(o).some((function(e){return!!m.default.isValidElement(e)&&/row-hover-show|cell-hover-show/.test(e.props.className)})),a=c.default("truncate"===e.textWrapMethod&&!i&&v),n=c.default(e.noPadding&&_,"normal"===e.textWrapMethod&&y),r={textAlign:e.align||"start"};if(j&&!X.anySelected&&!e.disabledLink){var u=s||"a";return l.jsx("td",{className:a,children:l.jsx(d.Tooltip,{disabled:"truncate"!==e.textWrapMethod,subtitle:o,children:l.jsx(u,{className:n,href:j(t),style:r,children:o})})})}return l.jsx("td",{className:a,children:l.jsx(d.Tooltip,{disabled:"truncate"!==e.textWrapMethod,subtitle:o,children:l.jsx("span",{className:n,style:r,children:o})})})};return e.renderCustom?l.jsx(l.Fragment,{children:i(e.renderCustom(o,t))}):l.jsx(l.Fragment,{children:i(String(o))})};return l.jsx("div",{className:c.default(u,r),style:e.__assign({maxHeight:R},z),children:l.jsxs("table",{className:b,children:[l.jsxs("colgroup",{children:[!!X.onHeaderCheckboxChange&&l.jsx("col",{width:0}),k.map((function(e){return l.jsx("col",{width:void 0!==e.width?"".concat(e.width,"%"):void 0},e.key)}))]}),l.jsx("thead",{children:l.jsxs("tr",{children:[!!X.onHeaderCheckboxChange&&l.jsx("th",{className:_,children:X.renderCustomHeaderCheckbox||l.jsx(i.Checkbox,{checked:!w&&X.headerCheckboxValue||!1,className:g,disabled:w,onChange:X.onHeaderCheckboxChange})}),k.map((function(e){return l.jsx("th",{className:c.default(e.noPadding&&_),style:{textAlign:e.align||"start"},children:"string"==typeof e.name?l.jsx(n.Text,{color:"gray800",type:"small-header",children:e.name}):e.name},e.key)}))]})}),l.jsx("tbody",{children:w?e.__spreadArray([],e.__read(Array(q).keys()),!1).map((function(e){return l.jsxs("tr",{children:[X.enabled&&l.jsx("td",{children:l.jsx("div",{children:l.jsx(a.Skeleton,{height:N},e)})}),k.map((function(t){return l.jsx("td",{className:c.default(S,t.noPadding&&_),children:l.jsx("div",{className:x,style:{justifyContent:T(t.align)},children:l.jsx(a.Skeleton,{height:N,style:{width:"50%"}},e)})},t.key)}))]},e)})):f.map((function(e,o){var a,n,d,r=!!F||!!X.anySelected&&!!X.onRowCheckboxChange;return l.jsxs("tr",{className:c.default(r&&p,!W&&h),onClick:function(l){var t,i,a;X.anySelected?(null===(t=X.isRowCheckboxDisabled)||void 0===t?void 0:t.call(X,e,o))||(l.preventDefault(),null===(i=X.onRowCheckboxChange)||void 0===i||i.call(X,!(null===(a=X.isRowChecked)||void 0===a?void 0:a.call(X,e,o)),e,o)):null==F||F(e)},onMouseEnter:function(){return null==I?void 0:I(e)},children:[X.enabled&&l.jsx("td",{children:(null===(a=X.renderCustomRowCheckbox)||void 0===a?void 0:a.call(X,e,o))||l.jsx(i.Checkbox,{checked:(null===(n=X.isRowChecked)||void 0===n?void 0:n.call(X,e,o))||!1,disabled:(null===(d=X.isRowCheckboxDisabled)||void 0===d?void 0:d.call(X,e,o))||!1,onChange:function(l){var t;return null===(t=X.onRowCheckboxChange)||void 0===t?void 0:t.call(X,l,e,o)}})}),k.map((function(o){return l.jsx(t.Fragment,{children:E(o,e)},o.key)}))]},A(e))}))}),M]})})};
|