etendo-ui-library 1.3.61 → 1.3.62
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/dist-native/components/button/Button.d.ts +1 -1
- package/dist-native/components/button/Button.js +1 -1
- package/dist-native/components/button/Button.types.d.ts +2 -1
- package/dist-native/components/table/Table.js +1 -1
- package/dist-web/components/button/Button.d.ts +1 -1
- package/dist-web/components/button/Button.js +3 -4
- package/dist-web/components/button/Button.types.d.ts +2 -1
- package/dist-web/components/table/Table.js +10 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonProps } from './Button.types';
|
|
3
|
-
declare const Button: ({ text, onPress, fontSize, typeStyle, disabled, width, height, iconLeft, iconRight, paddingHorizontal, paddingVertical, loading, }: ButtonProps) => React.JSX.Element;
|
|
3
|
+
declare const Button: ({ text, onPress, fontSize, typeStyle, disabled, width, height, iconLeft, iconRight, paddingHorizontal, paddingVertical, loading, metadata, }: ButtonProps) => React.JSX.Element;
|
|
4
4
|
export default Button;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _colors=require("../../styles/colors");var _Button=require("./Button.styles");var _this=this,_jsxFileName="/home/jenkins/agent/workspace/etendo_ui_library_develop/etendo_ui_library/src/components/button/Button.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var Button=function Button(_ref){var text=_ref.text,onPress=_ref.onPress,_ref$fontSize=_ref.fontSize,fontSize=_ref$fontSize===void 0?16:_ref$fontSize,typeStyle=_ref.typeStyle,disabled=_ref.disabled,_ref$width=_ref.width,width=_ref$width===void 0?'auto':_ref$width,height=_ref.height,iconLeft=_ref.iconLeft,iconRight=_ref.iconRight,_ref$paddingHorizonta=_ref.paddingHorizontal,paddingHorizontal=_ref$paddingHorizonta===void 0?12:_ref$paddingHorizonta,_ref$paddingVertical=_ref.paddingVertical,paddingVertical=_ref$paddingVertical===void 0?12:_ref$paddingVertical,_ref$loading=_ref.loading,loading=_ref$loading===void 0?false:_ref$loading;var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),isHovered=_useState2[0],setIsHovered=_useState2[1];var getHoveredBackgroundColor=function getHoveredBackgroundColor(backgroundColor){switch(backgroundColor){case'primary':return _colors.TERTIARY_800;case'secondary':return _colors.SECONDARY_300;case'terciary':return _colors.TERTIARY_50;case'whiteBorder':return _colors.PRIMARY_100;}};var getHoveredTextColorAndViewColor=function getHoveredTextColorAndViewColor(typeStyle){switch(typeStyle){case'white':return _colors.TERTIARY_800;case'whiteBorder':return _colors.NEUTRAL_50;case'primary':return _colors.NEUTRAL_50;default:return _colors.PRIMARY_100;}};var stateStyleContainer=function stateStyleContainer(pressed){if(disabled){return _Button.ButtonStyleVariant[typeStyle].containerDisabled;}if(pressed&&!isHovered&&!loading&&typeStyle==='whiteBorder'){return Object.assign({},_Button.ButtonStyleVariant[typeStyle].container,{opacity:0.7,backgroundColor:'transparent'});}if(pressed&&!loading){var hoveredBackgroundColor=getHoveredBackgroundColor(typeStyle);return Object.assign({},_Button.ButtonStyleVariant[typeStyle].container,{opacity:0.7,backgroundColor:hoveredBackgroundColor});}if(isHovered&&!loading){var _hoveredBackgroundColor=getHoveredBackgroundColor(typeStyle);return Object.assign({},_Button.ButtonStyleVariant[typeStyle].container,{backgroundColor:_hoveredBackgroundColor});}return _Button.ButtonStyleVariant[typeStyle].container;};var handleHoverIn=function handleHoverIn(){setIsHovered(true);};var handleHoverOut=function handleHoverOut(){setIsHovered(false);};var stateStyleText=function stateStyleText(){if(loading&&!iconLeft&&!iconRight){return{color:'transparent'};}if(disabled){return _Button.ButtonStyleVariant[typeStyle].textDisabled;}if(isHovered&&!loading){var hoveredTextColor=getHoveredTextColorAndViewColor(typeStyle);if(hoveredTextColor){return Object.assign({},_Button.ButtonStyleVariant[typeStyle].text,{color:hoveredTextColor});}}return _Button.ButtonStyleVariant[typeStyle].text;};var stateStyleIcon=function stateStyleIcon(){var _ButtonStyleVariant$t2;if(disabled){return _Button.ButtonStyleVariant[typeStyle].imageDisabled;}if(isHovered&&!loading){var _ButtonStyleVariant$t;return isHovered?getHoveredTextColorAndViewColor(typeStyle):(_ButtonStyleVariant$t=_Button.ButtonStyleVariant[typeStyle])==null?void 0:_ButtonStyleVariant$t.imageColor;}return(_ButtonStyleVariant$t2=_Button.ButtonStyleVariant[typeStyle])==null?void 0:_ButtonStyleVariant$t2.imageColor;};var stateSizeIndicator=function stateSizeIndicator(iconComponent){var _iconComponent$props,_iconComponent$props$,_iconComponent$props4,_iconComponent$props5;if(iconComponent!=null&&(_iconComponent$props=iconComponent.props)!=null&&(_iconComponent$props$=_iconComponent$props.style)!=null&&_iconComponent$props$.height){var _iconComponent$props2,_iconComponent$props3;return iconComponent==null?void 0:(_iconComponent$props2=iconComponent.props)==null?void 0:(_iconComponent$props3=_iconComponent$props2.style)==null?void 0:_iconComponent$props3.height;}if(iconComponent!=null&&(_iconComponent$props4=iconComponent.props)!=null&&(_iconComponent$props5=_iconComponent$props4.style)!=null&&_iconComponent$props5.width){var _iconComponent$props6,_iconComponent$props7;return iconComponent==null?void 0:(_iconComponent$props6=iconComponent.props)==null?void 0:(_iconComponent$props7=_iconComponent$props6.style)==null?void 0:_iconComponent$props7.width;}return 16;};var renderIcon=function renderIcon(icon){var _icon$props,_icon$props$style,_icon$props2,_icon$props2$style;var _ref2=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref2$marginRight=_ref2.marginRight,marginRight=_ref2$marginRight===void 0?0:_ref2$marginRight,_ref2$marginLeft=_ref2.marginLeft,marginLeft=_ref2$marginLeft===void 0?0:_ref2$marginLeft;if(!icon)return null;var iconSize=stateSizeIndicator(icon);var iconColor=stateStyleIcon();if(loading){return _react.default.createElement(_reactNative.ActivityIndicator,{size:iconSize,color:iconColor,style:{marginRight:marginRight,marginLeft:marginLeft},__self:_this,__source:{fileName:_jsxFileName,lineNumber:
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _colors=require("../../styles/colors");var _Button=require("./Button.styles");var _this=this,_jsxFileName="/home/jenkins/agent/workspace/etendo_ui_library_develop/etendo_ui_library/src/components/button/Button.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var Button=function Button(_ref){var text=_ref.text,onPress=_ref.onPress,_ref$fontSize=_ref.fontSize,fontSize=_ref$fontSize===void 0?16:_ref$fontSize,typeStyle=_ref.typeStyle,disabled=_ref.disabled,_ref$width=_ref.width,width=_ref$width===void 0?'auto':_ref$width,height=_ref.height,iconLeft=_ref.iconLeft,iconRight=_ref.iconRight,_ref$paddingHorizonta=_ref.paddingHorizontal,paddingHorizontal=_ref$paddingHorizonta===void 0?12:_ref$paddingHorizonta,_ref$paddingVertical=_ref.paddingVertical,paddingVertical=_ref$paddingVertical===void 0?12:_ref$paddingVertical,_ref$loading=_ref.loading,loading=_ref$loading===void 0?false:_ref$loading,metadata=_ref.metadata;var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),isHovered=_useState2[0],setIsHovered=_useState2[1];var getHoveredBackgroundColor=function getHoveredBackgroundColor(backgroundColor){switch(backgroundColor){case'primary':return _colors.TERTIARY_800;case'secondary':return _colors.SECONDARY_300;case'terciary':return _colors.TERTIARY_50;case'whiteBorder':return _colors.PRIMARY_100;}};var getHoveredTextColorAndViewColor=function getHoveredTextColorAndViewColor(typeStyle){switch(typeStyle){case'white':return _colors.TERTIARY_800;case'whiteBorder':return _colors.NEUTRAL_50;case'primary':return _colors.NEUTRAL_50;default:return _colors.PRIMARY_100;}};var stateStyleContainer=function stateStyleContainer(pressed){if(disabled){return _Button.ButtonStyleVariant[typeStyle].containerDisabled;}if(pressed&&!isHovered&&!loading&&typeStyle==='whiteBorder'){return Object.assign({},_Button.ButtonStyleVariant[typeStyle].container,{opacity:0.7,backgroundColor:'transparent'});}if(pressed&&!loading){var hoveredBackgroundColor=getHoveredBackgroundColor(typeStyle);return Object.assign({},_Button.ButtonStyleVariant[typeStyle].container,{opacity:0.7,backgroundColor:hoveredBackgroundColor});}if(isHovered&&!loading){var _hoveredBackgroundColor=getHoveredBackgroundColor(typeStyle);return Object.assign({},_Button.ButtonStyleVariant[typeStyle].container,{backgroundColor:_hoveredBackgroundColor});}return _Button.ButtonStyleVariant[typeStyle].container;};var handleHoverIn=function handleHoverIn(){setIsHovered(true);};var handleHoverOut=function handleHoverOut(){setIsHovered(false);};var stateStyleText=function stateStyleText(){if(loading&&!iconLeft&&!iconRight){return{color:'transparent'};}if(disabled){return _Button.ButtonStyleVariant[typeStyle].textDisabled;}if(isHovered&&!loading){var hoveredTextColor=getHoveredTextColorAndViewColor(typeStyle);if(hoveredTextColor){return Object.assign({},_Button.ButtonStyleVariant[typeStyle].text,{color:hoveredTextColor});}}return _Button.ButtonStyleVariant[typeStyle].text;};var stateStyleIcon=function stateStyleIcon(){var _ButtonStyleVariant$t2;if(disabled){return _Button.ButtonStyleVariant[typeStyle].imageDisabled;}if(isHovered&&!loading){var _ButtonStyleVariant$t;return isHovered?getHoveredTextColorAndViewColor(typeStyle):(_ButtonStyleVariant$t=_Button.ButtonStyleVariant[typeStyle])==null?void 0:_ButtonStyleVariant$t.imageColor;}return(_ButtonStyleVariant$t2=_Button.ButtonStyleVariant[typeStyle])==null?void 0:_ButtonStyleVariant$t2.imageColor;};var stateSizeIndicator=function stateSizeIndicator(iconComponent){var _iconComponent$props,_iconComponent$props$,_iconComponent$props4,_iconComponent$props5;if(iconComponent!=null&&(_iconComponent$props=iconComponent.props)!=null&&(_iconComponent$props$=_iconComponent$props.style)!=null&&_iconComponent$props$.height){var _iconComponent$props2,_iconComponent$props3;return iconComponent==null?void 0:(_iconComponent$props2=iconComponent.props)==null?void 0:(_iconComponent$props3=_iconComponent$props2.style)==null?void 0:_iconComponent$props3.height;}if(iconComponent!=null&&(_iconComponent$props4=iconComponent.props)!=null&&(_iconComponent$props5=_iconComponent$props4.style)!=null&&_iconComponent$props5.width){var _iconComponent$props6,_iconComponent$props7;return iconComponent==null?void 0:(_iconComponent$props6=iconComponent.props)==null?void 0:(_iconComponent$props7=_iconComponent$props6.style)==null?void 0:_iconComponent$props7.width;}return 16;};var renderIcon=function renderIcon(icon){var _icon$props,_icon$props$style,_icon$props2,_icon$props2$style;var _ref2=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref2$marginRight=_ref2.marginRight,marginRight=_ref2$marginRight===void 0?0:_ref2$marginRight,_ref2$marginLeft=_ref2.marginLeft,marginLeft=_ref2$marginLeft===void 0?0:_ref2$marginLeft;if(!icon)return null;var iconSize=stateSizeIndicator(icon);var iconColor=stateStyleIcon();if(loading){return _react.default.createElement(_reactNative.ActivityIndicator,{size:iconSize,color:iconColor,style:{marginRight:marginRight,marginLeft:marginLeft},__self:_this,__source:{fileName:_jsxFileName,lineNumber:149,columnNumber:9}});}return _react.default.cloneElement(icon,{style:{width:(icon==null?void 0:(_icon$props=icon.props)==null?void 0:(_icon$props$style=_icon$props.style)==null?void 0:_icon$props$style.width)||16,height:(icon==null?void 0:(_icon$props2=icon.props)==null?void 0:(_icon$props2$style=_icon$props2.style)==null?void 0:_icon$props2$style.height)||16,marginRight:marginRight,marginLeft:marginLeft},fill:iconColor});};var handleOnPress=function handleOnPress(){onPress&&(metadata?onPress(metadata):onPress());};return _react.default.createElement(_reactNative.TouchableOpacity,{disabled:disabled!=null?disabled:loading,__self:_this,__source:{fileName:_jsxFileName,lineNumber:172,columnNumber:5}},_react.default.createElement(_reactNative.Pressable,{onHoverIn:handleHoverIn,onHoverOut:handleHoverOut,style:function style(_ref3){var pressed=_ref3.pressed;return[stateStyleContainer(pressed),{height:height,width:width,paddingHorizontal:paddingHorizontal,paddingVertical:paddingVertical}];},disabled:disabled!=null?disabled:loading,onPress:handleOnPress,__self:_this,__source:{fileName:_jsxFileName,lineNumber:173,columnNumber:7}},renderIcon(iconLeft,{marginRight:iconLeft&&text?8:0}),loading&&!iconLeft&&!iconRight&&_react.default.createElement(_reactNative.ActivityIndicator,{size:fontSize,color:stateStyleIcon(),style:_Button.styles.indicatorCenterStyle,__self:_this,__source:{fileName:_jsxFileName,lineNumber:186,columnNumber:11}}),_react.default.createElement(_reactNative.Text,{style:[stateStyleText(),{fontSize:fontSize}],__self:_this,__source:{fileName:_jsxFileName,lineNumber:192,columnNumber:9}},text),renderIcon(iconRight,{marginLeft:iconRight&&text?8:0})));};var _default=exports.default=Button;
|
|
@@ -14,7 +14,7 @@ export interface IconStyleProps {
|
|
|
14
14
|
marginLeft?: DimensionValue;
|
|
15
15
|
}
|
|
16
16
|
export interface ButtonProps {
|
|
17
|
-
onPress?: () => void;
|
|
17
|
+
onPress?: (...params: any[]) => void;
|
|
18
18
|
text?: string;
|
|
19
19
|
typeStyle: ButtonStyleType;
|
|
20
20
|
iconLeft?: React.ReactElement;
|
|
@@ -26,4 +26,5 @@ export interface ButtonProps {
|
|
|
26
26
|
paddingHorizontal?: DimensionValue;
|
|
27
27
|
paddingVertical?: DimensionValue;
|
|
28
28
|
loading?: boolean;
|
|
29
|
+
metadata?: any;
|
|
29
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _Table=require("./Table.styles");var _TableHeaders=_interopRequireDefault(require("./components/TableHeaders"));var _TableCell=_interopRequireDefault(require("./components/TableCell"));var _table_utils=require("../../helpers/table_utils");var _secondaryComponents=require("../secondaryComponents");var _colors=require("../../styles/colors");var _TableEmpty=_interopRequireDefault(require("./components/TableEmpty"));var _containers=require("../containers");var _this=this,_jsxFileName="/home/jenkins/agent/workspace/etendo_ui_library_develop/etendo_ui_library/src/components/table/Table.tsx";var Table=function Table(_ref){var data=_ref.data,columns=_ref.columns,title=_ref.title,onRowPress=_ref.onRowPress,tableHeight=_ref.tableHeight,isLoading=_ref.isLoading,textEmptyTable=_ref.textEmptyTable,commentEmptyTable=_ref.commentEmptyTable,onLoadMoreData=_ref.onLoadMoreData,_ref$isLoadingMoreDat=_ref.isLoadingMoreData,isLoadingMoreData=_ref$isLoadingMoreDat===void 0?true:_ref$isLoadingMoreDat,_ref$pageSize=_ref.pageSize,pageSize=_ref$pageSize===void 0?3:_ref$pageSize,_ref$currentPage=_ref.currentPage,currentPage=_ref$currentPage===void 0?0:_ref$currentPage;var handleLoadMore=function handleLoadMore(){if(isLoadingMoreData&&!isLoading&&onLoadMoreData){onLoadMoreData(currentPage+1,pageSize);}};var RenderItem=function RenderItem(item,index){return _react.default.createElement(_reactNative.Pressable,{onPress:function onPress(){if(onRowPress){onRowPress((0,_table_utils.findPrimaryId)(columns,item));}},style:[_Table.styles.row,(0,_table_utils.paintOddRows)(index)],__self:_this,__source:{fileName:_jsxFileName,lineNumber:39,columnNumber:7}},columns.map(function(col,colIndex){return col.visible&&_react.default.createElement(_reactNative.View,{style:[_Table.styles.cell,col.cellStyle,{width:col.width}],key:'movementTable'+colIndex,__self:_this,__source:{fileName:_jsxFileName,lineNumber:
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _Table=require("./Table.styles");var _TableHeaders=_interopRequireDefault(require("./components/TableHeaders"));var _TableCell=_interopRequireDefault(require("./components/TableCell"));var _table_utils=require("../../helpers/table_utils");var _secondaryComponents=require("../secondaryComponents");var _colors=require("../../styles/colors");var _TableEmpty=_interopRequireDefault(require("./components/TableEmpty"));var _containers=require("../containers");var _this=this,_jsxFileName="/home/jenkins/agent/workspace/etendo_ui_library_develop/etendo_ui_library/src/components/table/Table.tsx";var Table=function Table(_ref){var data=_ref.data,columns=_ref.columns,title=_ref.title,onRowPress=_ref.onRowPress,tableHeight=_ref.tableHeight,isLoading=_ref.isLoading,textEmptyTable=_ref.textEmptyTable,commentEmptyTable=_ref.commentEmptyTable,onLoadMoreData=_ref.onLoadMoreData,_ref$isLoadingMoreDat=_ref.isLoadingMoreData,isLoadingMoreData=_ref$isLoadingMoreDat===void 0?true:_ref$isLoadingMoreDat,_ref$pageSize=_ref.pageSize,pageSize=_ref$pageSize===void 0?3:_ref$pageSize,_ref$currentPage=_ref.currentPage,currentPage=_ref$currentPage===void 0?0:_ref$currentPage;var handleLoadMore=function handleLoadMore(){if(isLoadingMoreData&&!isLoading&&onLoadMoreData){onLoadMoreData(currentPage+1,pageSize);}};var RenderItem=function RenderItem(item,index){return _react.default.createElement(_reactNative.Pressable,{onPress:function onPress(){if(onRowPress){onRowPress((0,_table_utils.findPrimaryId)(columns,item));}},style:[_Table.styles.row,(0,_table_utils.paintOddRows)(index)],__self:_this,__source:{fileName:_jsxFileName,lineNumber:39,columnNumber:7}},columns.map(function(col,colIndex){var components=[];if(col.components){var updatedComponents=col.components.map(function(component){return _react.default.cloneElement(component,{metadata:item});});components=updatedComponents;}return col.visible&&_react.default.createElement(_reactNative.View,{style:[_Table.styles.cell,col.cellStyle,{width:col.width}],key:'movementTable'+colIndex,__self:_this,__source:{fileName:_jsxFileName,lineNumber:58,columnNumber:15}},col.components?_react.default.createElement(_containers.ButtonContainer,{buttons:components,__self:_this,__source:{fileName:_jsxFileName,lineNumber:62,columnNumber:19}}):_react.default.createElement(_TableCell.default,{label:col.key?item[col.key]:'',key:'tableCell'+index,__self:_this,__source:{fileName:_jsxFileName,lineNumber:64,columnNumber:19}}));}));};var RenderSkeleton=function RenderSkeleton(index){return _react.default.createElement(_reactNative.View,{style:[_Table.styles.row,(0,_table_utils.paintOddRows)(index)],__self:_this,__source:{fileName:_jsxFileName,lineNumber:79,columnNumber:7}},columns.map(function(col,colIndex){return col.visible&&_react.default.createElement(_secondaryComponents.SkeletonRowTable,{key:colIndex,width:col.width,color:_colors.NEUTRAL_300,indexRow:index,indexColumn:colIndex,__self:_this,__source:{fileName:_jsxFileName,lineNumber:83,columnNumber:15}});}));};return _react.default.createElement(_reactNative.View,{style:[_Table.styles.container,(0,_table_utils.removeHeaderBorder)(title),{height:tableHeight}],__self:_this,__source:{fileName:_jsxFileName,lineNumber:98,columnNumber:5}},_react.default.createElement(_TableHeaders.default,{title:title,columns:columns,isLoading:!(isLoading&&!data.length),__self:_this,__source:{fileName:_jsxFileName,lineNumber:104,columnNumber:7}}),_react.default.createElement(_reactNative.FlatList,{data:isLoadingMoreData&&isLoading&&!data.length?Array(pageSize).fill({}):data,renderItem:function renderItem(item){return isLoadingMoreData&&isLoading&&!data.length&&onLoadMoreData?RenderSkeleton(item.index):RenderItem(item.item,item.index);},ListEmptyComponent:_react.default.createElement(_TableEmpty.default,{commentEmptyTable:commentEmptyTable,textEmptyTable:textEmptyTable,__self:_this,__source:{fileName:_jsxFileName,lineNumber:122,columnNumber:11}}),keyExtractor:function keyExtractor(_item,index){return'Table: '+index;},ListFooterComponent:function ListFooterComponent(){return isLoadingMoreData&&onLoadMoreData&&isLoading&&Boolean(data.length)&&RenderSkeleton(data.length);},onEndReached:function onEndReached(){return handleLoadMore();},onEndReachedThreshold:0.2,__self:_this,__source:{fileName:_jsxFileName,lineNumber:110,columnNumber:7}}));};var _default=exports.default=Table;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonProps } from './Button.types';
|
|
3
|
-
declare const Button: ({ text, onPress, fontSize, typeStyle, disabled, width, height, iconLeft, iconRight, paddingHorizontal, paddingVertical, loading, }: ButtonProps) => React.JSX.Element;
|
|
3
|
+
declare const Button: ({ text, onPress, fontSize, typeStyle, disabled, width, height, iconLeft, iconRight, paddingHorizontal, paddingVertical, loading, metadata, }: ButtonProps) => React.JSX.Element;
|
|
4
4
|
export default Button;
|
|
@@ -31,7 +31,8 @@ var Button = function Button(_ref) {
|
|
|
31
31
|
_ref$paddingVertical = _ref.paddingVertical,
|
|
32
32
|
paddingVertical = _ref$paddingVertical === void 0 ? 12 : _ref$paddingVertical,
|
|
33
33
|
_ref$loading = _ref.loading,
|
|
34
|
-
loading = _ref$loading === void 0 ? false : _ref$loading
|
|
34
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
35
|
+
metadata = _ref.metadata;
|
|
35
36
|
var _useState = useState(false),
|
|
36
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
37
38
|
isHovered = _useState2[0],
|
|
@@ -164,9 +165,7 @@ var Button = function Button(_ref) {
|
|
|
164
165
|
});
|
|
165
166
|
};
|
|
166
167
|
var handleOnPress = function handleOnPress() {
|
|
167
|
-
|
|
168
|
-
onPress();
|
|
169
|
-
}
|
|
168
|
+
onPress && (metadata ? onPress(metadata) : onPress());
|
|
170
169
|
};
|
|
171
170
|
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
172
171
|
disabled: disabled !== null && disabled !== void 0 ? disabled : loading
|
|
@@ -14,7 +14,7 @@ export interface IconStyleProps {
|
|
|
14
14
|
marginLeft?: DimensionValue;
|
|
15
15
|
}
|
|
16
16
|
export interface ButtonProps {
|
|
17
|
-
onPress?: () => void;
|
|
17
|
+
onPress?: (...params: any[]) => void;
|
|
18
18
|
text?: string;
|
|
19
19
|
typeStyle: ButtonStyleType;
|
|
20
20
|
iconLeft?: React.ReactElement;
|
|
@@ -26,4 +26,5 @@ export interface ButtonProps {
|
|
|
26
26
|
paddingHorizontal?: DimensionValue;
|
|
27
27
|
paddingVertical?: DimensionValue;
|
|
28
28
|
loading?: boolean;
|
|
29
|
+
metadata?: any;
|
|
29
30
|
}
|
|
@@ -38,13 +38,22 @@ var Table = function Table(_ref) {
|
|
|
38
38
|
},
|
|
39
39
|
style: [styles.row, paintOddRows(index)]
|
|
40
40
|
}, columns.map(function (col, colIndex) {
|
|
41
|
+
var components = [];
|
|
42
|
+
if (col.components) {
|
|
43
|
+
var updatedComponents = col.components.map(function (component) {
|
|
44
|
+
return /*#__PURE__*/React.cloneElement(component, {
|
|
45
|
+
metadata: item
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
components = updatedComponents;
|
|
49
|
+
}
|
|
41
50
|
return col.visible && /*#__PURE__*/React.createElement(View, {
|
|
42
51
|
style: [styles.cell, col.cellStyle, {
|
|
43
52
|
width: col.width
|
|
44
53
|
}],
|
|
45
54
|
key: 'movementTable' + colIndex
|
|
46
55
|
}, col.components ? /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
47
|
-
buttons:
|
|
56
|
+
buttons: components
|
|
48
57
|
}) : /*#__PURE__*/React.createElement(TableCell, {
|
|
49
58
|
label: col.key ? item[col.key] : '',
|
|
50
59
|
key: 'tableCell' + index
|